[balsa/wip/gtk4: 212/351] Revert the uncrustify



commit ea0d6aefd3f6c78244ad55af6d8be34f821f6b9e
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Fri Mar 9 11:54:36 2018 -0500

    Revert the uncrustify
    
    so that we can continue to cherry-pick from master.

 libbalsa/abook-completion.c              |   47 +-
 libbalsa/abook-completion.h              |   26 +-
 libbalsa/address-book-extern.c           |  264 +--
 libbalsa/address-book-extern.h           |   30 +-
 libbalsa/address-book-gpe.c              |  614 +++---
 libbalsa/address-book-gpe.h              |   32 +-
 libbalsa/address-book-ldap.c             |  863 +++----
 libbalsa/address-book-ldap.h             |   62 +-
 libbalsa/address-book-ldif.c             |  326 +--
 libbalsa/address-book-ldif.h             |    4 +-
 libbalsa/address-book-osmo.c             |  476 ++--
 libbalsa/address-book-rubrica.c          |  640 +++---
 libbalsa/address-book-rubrica.h          |   16 +-
 libbalsa/address-book-text.c             |  306 +--
 libbalsa/address-book-text.h             |   34 +-
 libbalsa/address-book-vcard.c            |  253 +--
 libbalsa/address-book-vcard.h            |   14 +-
 libbalsa/address-book.c                  |  195 +-
 libbalsa/address-book.h                  |  132 +-
 libbalsa/address-view.c                  |  372 ++--
 libbalsa/address-view.h                  |   48 +-
 libbalsa/address.c                       |  786 +++----
 libbalsa/address.h                       |   87 +-
 libbalsa/application-helpers.c           |   89 +-
 libbalsa/application-helpers.h           |   38 +-
 libbalsa/body.c                          |  488 ++--
 libbalsa/body.h                          |  123 +-
 libbalsa/completion.c                    |   30 +-
 libbalsa/completion.h                    |   40 +-
 libbalsa/files.c                         |   61 +-
 libbalsa/files.h                         |   27 +-
 libbalsa/filter-error.c                  |   25 +-
 libbalsa/filter-file.c                   |  295 +--
 libbalsa/filter-file.h                   |   33 +-
 libbalsa/filter-funcs.c                  |  874 +++----
 libbalsa/filter-funcs.h                  |   82 +-
 libbalsa/filter-private.h                |   14 +-
 libbalsa/filter.c                        |  359 ++--
 libbalsa/filter.h                        |  122 +-
 libbalsa/folder-scanners.c               |  236 +--
 libbalsa/folder-scanners.h               |   60 +-
 libbalsa/gforest.c                       |   20 +-
 libbalsa/gmime-application-pkcs7.c       |  117 +-
 libbalsa/gmime-application-pkcs7.h       |   36 +-
 libbalsa/gmime-filter-header.c           |  203 +-
 libbalsa/gmime-filter-header.h           |   47 +-
 libbalsa/gmime-gpgme-signature.c         |  162 +-
 libbalsa/gmime-gpgme-signature.h         |   44 +-
 libbalsa/gmime-multipart-crypt.c         |  330 ++--
 libbalsa/gmime-multipart-crypt.h         |   45 +-
 libbalsa/gmime-part-rfc2440.c            |  323 ++--
 libbalsa/gmime-part-rfc2440.h            |   37 +-
 libbalsa/html.c                          |  890 +++----
 libbalsa/html.h                          |   71 +-
 libbalsa/identity-widgets.c              |  814 +++----
 libbalsa/identity-widgets.h              |   42 +-
 libbalsa/identity.c                      |  168 +-
 libbalsa/identity.h                      |  182 +-
 libbalsa/imap-server.c                   |  500 ++---
 libbalsa/imap-server.h                   |   48 +-
 libbalsa/information.c                   |   97 +-
 libbalsa/information.h                   |   31 +-
 libbalsa/libbalsa-conf.c                 |  207 +-
 libbalsa/libbalsa-conf.h                 |  160 +-
 libbalsa/libbalsa-gpgme-cb.c             |  351 ++--
 libbalsa/libbalsa-gpgme-cb.h             |   24 +-
 libbalsa/libbalsa-gpgme-keys.c           |  839 +++----
 libbalsa/libbalsa-gpgme-keys.h           |   72 +-
 libbalsa/libbalsa-gpgme-widgets.c        | 1146 ++++-----
 libbalsa/libbalsa-gpgme-widgets.h        |   65 +-
 libbalsa/libbalsa-gpgme.c                | 1092 ++++-----
 libbalsa/libbalsa-gpgme.h                |  138 +-
 libbalsa/libbalsa-progress.c             |  509 ++--
 libbalsa/libbalsa-progress.h             |   51 +-
 libbalsa/libbalsa-vfs.c                  |  325 +--
 libbalsa/libbalsa-vfs.h                  |  103 +-
 libbalsa/libbalsa.c                      |  587 ++---
 libbalsa/libbalsa.h                      |   91 +-
 libbalsa/libbalsa_private.h              |   28 +-
 libbalsa/macosx-helpers.c                |   53 +-
 libbalsa/macosx-helpers.h                |   26 +-
 libbalsa/mailbackend.h                   |   12 +-
 libbalsa/mailbox-filter.c                |   56 +-
 libbalsa/mailbox-filter.h                |   36 +-
 libbalsa/mailbox.c                       | 2216 +++++++----------
 libbalsa/mailbox.h                       |  613 +++---
 libbalsa/mailbox_imap.c                  | 3078 ++++++++++-------------
 libbalsa/mailbox_imap.h                  |   74 +-
 libbalsa/mailbox_local.c                 | 1406 +++++------
 libbalsa/mailbox_local.h                 |   80 +-
 libbalsa/mailbox_maildir.c               |  683 +++---
 libbalsa/mailbox_maildir.h               |   19 +-
 libbalsa/mailbox_mbox.c                  | 1336 +++++------
 libbalsa/mailbox_mbox.h                  |   15 +-
 libbalsa/mailbox_mh.c                    |  981 ++++----
 libbalsa/mailbox_mh.h                    |   22 +-
 libbalsa/mailbox_pop3.c                  | 1041 ++++----
 libbalsa/mailbox_pop3.h                  |   16 +-
 libbalsa/mailbox_remote.c                |   59 +-
 libbalsa/mailbox_remote.h                |   20 +-
 libbalsa/message.c                       |  881 +++----
 libbalsa/message.h                       |  171 +-
 libbalsa/mime-stream-shared.c            |  107 +-
 libbalsa/mime-stream-shared.h            |   18 +-
 libbalsa/mime.c                          |  931 +++----
 libbalsa/mime.h                          |   31 +-
 libbalsa/misc.c                          | 1048 ++++-----
 libbalsa/misc.h                          |  153 +-
 libbalsa/missing.h                       |   17 +-
 libbalsa/missing_time.c                  |   31 +-
 libbalsa/rfc2445.c                       |  505 ++--
 libbalsa/rfc2445.h                       |   45 +-
 libbalsa/rfc3156.c                       |  724 +++---
 libbalsa/rfc3156.h                       |  120 +-
 libbalsa/rfc6350.c                       |  481 ++--
 libbalsa/rfc6350.h                       |   28 +-
 libbalsa/send.c                          |  842 +++----
 libbalsa/send.h                          |   48 +-
 libbalsa/server.c                        |  361 ++--
 libbalsa/server.h                        |   98 +-
 libbalsa/smtp-server.c                   |  265 +--
 libbalsa/smtp-server.h                   |   44 +-
 libbalsa/source-viewer.c                 |  117 +-
 libbalsa/url.c                           |  375 ++--
 libbalsa/url.h                           |   50 +-
 libinit_balsa/assistant_helper.c         |   75 +-
 libinit_balsa/assistant_helper.h         |   53 +-
 libinit_balsa/assistant_init.c           |   47 +-
 libinit_balsa/assistant_init.h           |   12 +-
 libinit_balsa/assistant_page_defclient.c |   41 +-
 libinit_balsa/assistant_page_defclient.h |   42 +-
 libinit_balsa/assistant_page_directory.c |  160 +-
 libinit_balsa/assistant_page_directory.h |   58 +-
 libinit_balsa/assistant_page_finish.c    |   28 +-
 libinit_balsa/assistant_page_finish.h    |   12 +-
 libinit_balsa/assistant_page_user.c      |  210 +-
 libinit_balsa/assistant_page_user.h      |   62 +-
 libinit_balsa/assistant_page_welcome.c   |   30 +-
 libinit_balsa/assistant_page_welcome.h   |   12 +-
 libnetclient/net-client-pop.c            | 1559 +++++-------
 libnetclient/net-client-pop.h            |  238 +--
 libnetclient/net-client-smtp.c           | 1298 +++++------
 libnetclient/net-client-smtp.h           |  195 +-
 libnetclient/net-client-utils.c          |  533 ++---
 libnetclient/net-client-utils.h          |   97 +-
 libnetclient/net-client.c                |  933 +++----
 libnetclient/net-client.h                |  250 +--
 src/ab-main.c                            |  529 ++---
 src/ab-window.c                          |  469 ++--
 src/ab-window.h                          |   33 +-
 src/address-book-config.c                |  373 ++--
 src/address-book-config.h                |   29 +-
 src/balsa-app.c                          |  407 ++--
 src/balsa-app.h                          |   86 +-
 src/balsa-cite-bar.c                     |   68 +-
 src/balsa-cite-bar.h                     |   33 +-
 src/balsa-icons.c                        |  247 +-
 src/balsa-icons.h                        |   91 +-
 src/balsa-index.c                        | 1452 +++++-------
 src/balsa-index.h                        |  296 ++--
 src/balsa-mblist.c                       |  936 +++----
 src/balsa-mblist.h                       |   79 +-
 src/balsa-message.c                      | 1952 ++++++--------
 src/balsa-message.h                      |  159 +-
 src/balsa-mime-widget-callbacks.c        |  158 +-
 src/balsa-mime-widget-callbacks.h        |   30 +-
 src/balsa-mime-widget-crypto.c           |  370 ++--
 src/balsa-mime-widget-crypto.h           |   45 +-
 src/balsa-mime-widget-image.c            |   76 +-
 src/balsa-mime-widget-image.h            |    8 +-
 src/balsa-mime-widget-message.c          |  568 ++---
 src/balsa-mime-widget-message.h          |   46 +-
 src/balsa-mime-widget-multipart.c        |   29 +-
 src/balsa-mime-widget-multipart.h        |   19 +-
 src/balsa-mime-widget-text.c             |  693 +++---
 src/balsa-mime-widget-text.h             |   18 +-
 src/balsa-mime-widget-vcalendar.c        |  259 +-
 src/balsa-mime-widget-vcalendar.h        |   20 +-
 src/balsa-mime-widget.c                  |  206 +-
 src/balsa-mime-widget.h                  |   33 +-
 src/balsa-print-object-decor.c           |  200 +-
 src/balsa-print-object-decor.h           |   33 +-
 src/balsa-print-object-default.c         |  143 +-
 src/balsa-print-object-default.h         |   31 +-
 src/balsa-print-object-header.c          |  513 ++--
 src/balsa-print-object-header.h          |   52 +-
 src/balsa-print-object-image.c           |  107 +-
 src/balsa-print-object-image.h           |   28 +-
 src/balsa-print-object-text.c            |  822 +++----
 src/balsa-print-object-text.h            |   52 +-
 src/balsa-print-object.c                 |  304 +--
 src/balsa-print-object.h                 |   71 +-
 src/filter-edit-callbacks.c              | 1172 ++++-----
 src/filter-edit-dialog.c                 |  231 +-
 src/filter-edit.h                        |   74 +-
 src/filter-export-callbacks.c            |   36 +-
 src/filter-export-dialog.c               |   36 +-
 src/filter-export.h                      |   17 +-
 src/filter-run-callbacks.c               |  340 +--
 src/filter-run-dialog.c                  |  228 +-
 src/filter-run.h                         |   78 +-
 src/folder-conf.c                        |  481 ++--
 src/folder-conf.h                        |   28 +-
 src/information-dialog.c                 |  231 +-
 src/information-dialog.h                 |   30 +-
 src/mailbox-conf.c                       | 1221 ++++------
 src/mailbox-conf.h                       |   73 +-
 src/mailbox-node.c                       | 1019 ++++-----
 src/mailbox-node.h                       |   91 +-
 src/main-window.c                        | 2715 +++++++++------------
 src/main-window.h                        |  148 +-
 src/main.c                               |  236 +--
 src/message-window.c                     |  476 ++---
 src/message-window.h                     |   17 +-
 src/pref-manager.c                       | 1008 +++-----
 src/pref-manager.h                       |   13 +-
 src/print-gtk.c                          |  622 +++---
 src/print.h                              |   19 +-
 src/quote-color.c                        |   26 +-
 src/quote-color.h                        |   17 +-
 src/save-restore.c                       | 1136 ++++-----
 src/save-restore.h                       |   53 +-
 src/sendmsg-window.c                     | 4060 +++++++++++++-----------------
 src/sendmsg-window.h                     |  216 +-
 src/spell-check.c                        |  420 ++--
 src/spell-check.h                        |   45 +-
 src/store-address.c                      |  187 +-
 src/store-address.h                      |   12 +-
 src/toolbar-factory.c                    |  324 +--
 src/toolbar-factory.h                    |   51 +-
 src/toolbar-prefs.c                      |  317 +--
 src/toolbar-prefs.h                      |   10 +-
 232 files changed, 31845 insertions(+), 41738 deletions(-)
---
diff --git a/libbalsa/abook-completion.c b/libbalsa/abook-completion.c
index d14ce2d..3d63592 100644
--- a/libbalsa/abook-completion.c
+++ b/libbalsa/abook-completion.c
@@ -6,20 +6,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "abook-completion.h"
 
@@ -34,8 +34,7 @@
  * Create a new CompletionData
  */
 CompletionData *
-completion_data_new(InternetAddress *ia,
-                    const gchar     *nick_name)
+completion_data_new(InternetAddress * ia, const gchar * nick_name)
 {
     GString *string;
     gchar *address_string;
@@ -51,16 +50,13 @@ completion_data_new(InternetAddress *ia,
     ret->ia = ia;
 
     string = g_string_new(nick_name);
-    if (string->len > 0) {
-        g_string_append_c(string, ' ');
-    }
+    if (string->len > 0)
+       g_string_append_c(string, ' ');
     address_string = internet_address_to_string(ia, FALSE);
     /* Remove '"' and '<'. */
-    for (p = q = address_string; *p; p++) {
-        if ((*p != '"') && (*p != '<')) {
+    for (p = q = address_string; *p; p++)
+        if (*p != '"' && *p != '<')
             *q++ = *p;
-        }
-    }
     *q = '\0';
     g_string_append(string, address_string);
     g_free(address_string);
@@ -76,29 +72,26 @@ completion_data_new(InternetAddress *ia,
     return ret;
 }
 
-
 /*
  * Free a CompletionData
  */
 void
-completion_data_free(CompletionData *data)
+completion_data_free(CompletionData * data)
 {
     g_object_unref(data->ia);
     g_free(data->string);
     g_free(data);
 }
 
-
 /*
  * The LibBalsaCompletionFunc
  */
 gchar *
-completion_data_extract(CompletionData *data)
+completion_data_extract(CompletionData * data)
 {
     return data->string;
 }
 
-
 /*
  * A LibBalsaCompletionStrncmpFunc for matching words instead of the
  * whole string.
@@ -107,9 +100,7 @@ completion_data_extract(CompletionData *data)
  */
 
 gint
-strncmp_word(const gchar *s1,
-             const gchar *s2,
-             gsize        n)
+strncmp_word(const gchar * s1, const gchar * s2, gsize n)
 {
     const gchar *match;
     gint retval;
@@ -119,12 +110,10 @@ strncmp_word(const gchar *s1,
 
     match = s2;
     do {
-        if (!(retval = strncmp(s1, match, n))) {
-            break;
-        }
-        if ((match = strchr(match, ' '))) {
-            ++match;
-        }
+       if (!(retval = strncmp(s1, match, n)))
+           break;
+       if ((match = strchr(match, ' ')))
+           ++match;
     } while (match);
 
     return retval;
diff --git a/libbalsa/abook-completion.h b/libbalsa/abook-completion.h
index ac97a28..dc01697 100644
--- a/libbalsa/abook-completion.h
+++ b/libbalsa/abook-completion.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -29,16 +29,14 @@
 
 typedef struct _CompletionData CompletionData;
 struct _CompletionData {
-    gchar *string;
-    InternetAddress *ia;
+       gchar *string;
+       InternetAddress *ia;
 };
 
-CompletionData *completion_data_new(InternetAddress *ia,
-                                    const gchar     *nick_name);
-void completion_data_free(CompletionData *data);
-gchar *completion_data_extract(CompletionData *data);
-gint strncmp_word(const gchar *s1,
-                  const gchar *s2,
-                  gsize        n);
+CompletionData *completion_data_new(InternetAddress * ia,
+                                    const gchar * nick_name);
+void completion_data_free(CompletionData * data);
+gchar *completion_data_extract(CompletionData * data);
+gint strncmp_word(const gchar * s1, const gchar * s2, gsize n);
 
 #endif
diff --git a/libbalsa/address-book-extern.c b/libbalsa/address-book-extern.c
index caeed21..328d4ee 100644
--- a/libbalsa/address-book-extern.c
+++ b/libbalsa/address-book-extern.c
@@ -6,38 +6,38 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
-   A external source (program opened via popen) address book
-   If you do not have ant appriopriate program installed, use
-   following script:
- #! /bin/sh
-   f=$HOME/.extern-addrbook
-   if test "$1" != ""; then
-   perl -ne 'BEGIN{print "#ldb '"$1"'\n"} print if /'"$1"'/i;' "$f"
-   else
-   echo "#ldb"
-   cat "$f"
-   fi
-
-   where $HOME/.extern-addrbook contains:
-   mailbox1@example.comTABnameTABx
-   ...
- */
+  A external source (program opened via popen) address book
+  If you do not have ant appriopriate program installed, use
+  following script:
+  #! /bin/sh 
+  f=$HOME/.extern-addrbook 
+  if test "$1" != ""; then
+  perl -ne 'BEGIN{print "#ldb '"$1"'\n"} print if /'"$1"'/i;' "$f"
+  else
+  echo "#ldb"
+  cat "$f"
+  fi
+ 
+  where $HOME/.extern-addrbook contains:
+  mailbox1@example.comTABnameTABx
+  ...
+*/
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #define _POSIX_C_SOURCE 2
 #include "address-book-extern.h"
@@ -60,35 +60,35 @@ static LibBalsaAddressBookClass *parent_class = NULL;
 
 static void libbalsa_address_book_extern_class_init(LibBalsaAddressBookExternClass *klass);
 static void libbalsa_address_book_extern_init(LibBalsaAddressBookExtern *ab);
-static void libbalsa_address_book_externq_finalize(GObject *object);
+static void libbalsa_address_book_externq_finalize(GObject * object);
 
-static LibBalsaABErr libbalsa_address_book_externq_load(LibBalsaAddressBook *ab,
-                                                        const gchar         *filter,
-                                                        LibBalsaAddressBookLoadFunc
-                                                        callback,
-                                                        gpointer             closure);
+static LibBalsaABErr libbalsa_address_book_externq_load(LibBalsaAddressBook* ab, 
+                                                        const gchar *filter,
+                                                        LibBalsaAddressBookLoadFunc 
+                                                        callback, 
+                                                        gpointer closure);
 static LibBalsaABErr libbalsa_address_book_externq_add_address(LibBalsaAddressBook *ab,
-                                                               LibBalsaAddress     *address);
+                                                               LibBalsaAddress *address);
 
 static LibBalsaABErr libbalsa_address_book_externq_remove_address(LibBalsaAddressBook *ab,
-                                                                  LibBalsaAddress     *address);
+                                                                  LibBalsaAddress *address);
 
 static LibBalsaABErr libbalsa_address_book_externq_modify_address(LibBalsaAddressBook *ab,
-                                                                  LibBalsaAddress     *address,
-                                                                  LibBalsaAddress     *newval);
+                                                                  LibBalsaAddress *address,
+                                                                  LibBalsaAddress *newval);
 
 static void libbalsa_address_book_extern_save_config(LibBalsaAddressBook *ab,
-                                                     const gchar         *prefix);
+                                                      const gchar * prefix);
 static void libbalsa_address_book_externq_load_config(LibBalsaAddressBook *ab,
-                                                      const gchar         *prefix);
+                                                      const gchar * prefix);
 
 static gboolean parse_extern_file(LibBalsaAddressBookExtern *addr_extern,
-                                  gchar *pattern,
-                                  void (*cb)(const gchar *, const gchar *, void *),
-                                  void *data);
+                                   gchar *pattern,
+                                   void (*cb)(const gchar*,const gchar*,void*),
+                                   void *data);
 
-static GList *libbalsa_address_book_extern_alias_complete(LibBalsaAddressBook *ab,
-                                                          const gchar         *prefix);
+static GList *libbalsa_address_book_extern_alias_complete(LibBalsaAddressBook *ab, 
+                                                           const gchar * prefix);
 
 struct _LibBalsaAddressBookExternClass {
     LibBalsaAddressBookClass parent_class;
@@ -106,11 +106,11 @@ struct _LibBalsaAddressBookExtern {
 };
 
 G_DEFINE_TYPE(LibBalsaAddressBookExtern, libbalsa_address_book_extern,
-              LIBBALSA_TYPE_ADDRESS_BOOK)
+        LIBBALSA_TYPE_ADDRESS_BOOK)
 
 static void
 libbalsa_address_book_extern_class_init(LibBalsaAddressBookExternClass *
-                                        klass)
+                                         klass)
 {
     LibBalsaAddressBookClass *address_book_class;
     GObjectClass *object_class;
@@ -124,25 +124,24 @@ libbalsa_address_book_extern_class_init(LibBalsaAddressBookExternClass *
 
     address_book_class->load = libbalsa_address_book_externq_load;
     address_book_class->add_address =
-        libbalsa_address_book_externq_add_address;
+       libbalsa_address_book_externq_add_address;
     address_book_class->remove_address =
-        libbalsa_address_book_externq_remove_address;
+       libbalsa_address_book_externq_remove_address;
     address_book_class->modify_address =
-        libbalsa_address_book_externq_modify_address;
+       libbalsa_address_book_externq_modify_address;
 
     address_book_class->save_config =
-        libbalsa_address_book_extern_save_config;
+       libbalsa_address_book_extern_save_config;
     address_book_class->load_config =
-        libbalsa_address_book_externq_load_config;
+       libbalsa_address_book_externq_load_config;
 
     address_book_class->alias_complete =
-        libbalsa_address_book_extern_alias_complete;
+       libbalsa_address_book_extern_alias_complete;
 
 }
 
-
 static void
-libbalsa_address_book_extern_init(LibBalsaAddressBookExtern *ab)
+libbalsa_address_book_extern_init(LibBalsaAddressBookExtern * ab)
 {
     ab->load = NULL;
     ab->save = NULL;
@@ -150,9 +149,8 @@ libbalsa_address_book_extern_init(LibBalsaAddressBookExtern *ab)
     ab->mtime = 0;
 }
 
-
 static void
-libbalsa_address_book_externq_finalize(GObject *object)
+libbalsa_address_book_externq_finalize(GObject * object)
 {
     LibBalsaAddressBookExtern *addr_extern;
 
@@ -165,19 +163,17 @@ libbalsa_address_book_externq_finalize(GObject *object)
     G_OBJECT_CLASS(parent_class)->finalize(object);
 }
 
-
 LibBalsaAddressBook *
-libbalsa_address_book_externq_new(const gchar *name,
-                                  const gchar *load,
-                                  const gchar *save)
+libbalsa_address_book_externq_new(const gchar * name, const gchar * load,
+                                  const gchar * save)
 {
     LibBalsaAddressBookExtern *abvc;
     LibBalsaAddressBook *ab;
 
     abvc =
         LIBBALSA_ADDRESS_BOOK_EXTERN(g_object_new
-                                         (LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN,
-                                         NULL));
+                                     (LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN,
+                                      NULL));
     ab = LIBBALSA_ADDRESS_BOOK(abvc);
 
     libbalsa_address_book_set_name(ab, name);
@@ -187,18 +183,15 @@ libbalsa_address_book_externq_new(const gchar *name,
     return ab;
 }
 
-
 struct lbe_load_data {
     LibBalsaAddressBook *ab;
     LibBalsaAddressBookLoadFunc callback;
     gpointer closure;
 };
 static void
-lbe_load_cb(const gchar *email,
-            const gchar *name,
-            void        *data)
+lbe_load_cb(const gchar *email, const gchar *name, void *data)
 {
-    struct lbe_load_data *d = (struct lbe_load_data *)data;
+    struct lbe_load_data *d = (struct lbe_load_data*)data;
     LibBalsaAddress *address = libbalsa_address_new();
 
     /* The extern database doesn't support Id's, sorry! */
@@ -209,12 +202,11 @@ lbe_load_cb(const gchar *email,
     g_object_unref(G_OBJECT(address));
 }
 
-
 static LibBalsaABErr
-libbalsa_address_book_externq_load(LibBalsaAddressBook        *ab,
-                                   const gchar                *filter,
-                                   LibBalsaAddressBookLoadFunc callback,
-                                   gpointer                    closure)
+libbalsa_address_book_externq_load(LibBalsaAddressBook * ab, 
+                                   const gchar *filter,
+                                   LibBalsaAddressBookLoadFunc callback, 
+                                   gpointer closure)
 {
     gboolean rc = TRUE;
     struct lbe_load_data data;
@@ -222,23 +214,22 @@ libbalsa_address_book_externq_load(LibBalsaAddressBook        *ab,
 
     /* Erase the current address list */
     libbalsa_clear_list(&addr_extern->address_list, g_object_unref);
-    if (callback) {
+    if(callback) {
         data.ab = ab;
         data.callback = callback;
-        data.closure = closure;
+        data.closure  = closure;
         rc = parse_extern_file(addr_extern,
-                               " ", lbe_load_cb, &data);
+                                " ", lbe_load_cb, &data);
         callback(ab, NULL, closure);
     }
     return rc ? LBABERR_OK : LBABERR_CANNOT_READ;
 }
 
-
 static gboolean
 parse_extern_file(LibBalsaAddressBookExtern *addr_extern,
-                  gchar *pattern,
-                  void (*cb)(const gchar *, const gchar *, void *),
-                  void *data)
+                   gchar *pattern,
+                   void (*cb)(const gchar *, const gchar *, void*),
+                   void *data)
 {
     FILE *gc;
     gchar string[LINE_LEN];
@@ -246,96 +237,85 @@ parse_extern_file(LibBalsaAddressBookExtern *addr_extern,
     gchar command[LINE_LEN];
 
     /* Start the program */
-    g_snprintf(command, sizeof(command), "%s \"%s\"",
+    g_snprintf(command, sizeof(command), "%s \"%s\"", 
                addr_extern->load, pattern);
+    
+    gc = popen(command,"r");
 
-    gc = popen(command, "r");
-
-    if (gc == NULL) {
+    if (gc == NULL) 
         return FALSE;
-    }
 
     if (fgets(string, sizeof(string), gc)) {
-        /* The first line should be junk, just debug output */
+    /* The first line should be junk, just debug output */
 #ifdef DEBUG
         printf("%s\n", string);
 #endif
     }  /* FIXME check error */
-
+       
     while (fgets(string, sizeof(string), gc)) {
-        int i = sscanf(string, "%" LINE_LEN_STR "[^\t]\t"
-                       "%" LINE_LEN_STR "[^\t]"
-                       "%" LINE_LEN_STR "[^\n]",
-                       email, name, tmp);
+        int i=sscanf(string, "%" LINE_LEN_STR "[^\t]\t"
+                             "%" LINE_LEN_STR "[^\t]"
+                             "%" LINE_LEN_STR "[^\n]",
+                             email, name, tmp);
 #ifdef DEBUG
         printf("%s =>%i\n", string, i);
 #endif
-        if (i < 2) {
-            continue;
-        }
+        if(i<2) continue;
 #ifdef DEBUG
-        printf("%s,%s,%s\n", email, name, tmp);
+        printf("%s,%s,%s\n",email,name,tmp);
 #endif
         cb(email, name, data);
     }
     pclose(gc);
-
+    
     return TRUE;
 }
 
-
 static LibBalsaABErr
-libbalsa_address_book_externq_add_address(LibBalsaAddressBook *ab,
-                                          LibBalsaAddress     *new_address)
+libbalsa_address_book_externq_add_address(LibBalsaAddressBook * ab,
+                                          LibBalsaAddress * new_address)
 {
     gchar command[LINE_LEN];
     LibBalsaAddressBookExtern *ex;
-    FILE *gc;
+    FILE *gc; 
     g_return_val_if_fail(LIBBALSA_IS_ADDRESS_BOOK_EXTERN(ab), LBABERR_OK);
 
     ex = LIBBALSA_ADDRESS_BOOK_EXTERN(ab);
-    if (ex->save) {
+    if(ex->save) {
         const gchar *addr = libbalsa_address_get_addr(new_address);
-        g_snprintf(command, sizeof(command), "%s \"%s\" \"%s\" \"%s\"",
+        g_snprintf(command, sizeof(command), "%s \"%s\" \"%s\" \"%s\"", 
                    ex->save,
                    addr,
                    libbalsa_address_get_full_name(new_address), "TODO");
-
-        if ((gc = popen(command, "r")) == NULL) {
+        
+        if( (gc = popen(command, "r")) == NULL)
             return LBABERR_CANNOT_WRITE;
-        }
-        if (fclose(gc) != 0) {
+        if(fclose(gc) != 0) 
             return LBABERR_CANNOT_WRITE;
-        }
         return LBABERR_OK;
-    } else {
-        return LBABERR_CANNOT_WRITE;
-    }
+    } else return LBABERR_CANNOT_WRITE;
 }
 
-
 static LibBalsaABErr
 libbalsa_address_book_externq_remove_address(LibBalsaAddressBook *ab,
-                                             LibBalsaAddress     *address)
+                                             LibBalsaAddress *address)
 {
     /* FIXME: implement */
     return LBABERR_CANNOT_WRITE;
 }
 
-
 static LibBalsaABErr
 libbalsa_address_book_externq_modify_address(LibBalsaAddressBook *ab,
-                                             LibBalsaAddress     *address,
-                                             LibBalsaAddress     *newval)
+                                             LibBalsaAddress *address,
+                                             LibBalsaAddress *newval)
 {
     /* FIXME: implement */
     return LBABERR_CANNOT_WRITE;
 }
 
-
 static void
-libbalsa_address_book_extern_save_config(LibBalsaAddressBook *ab,
-                                         const gchar         *prefix)
+libbalsa_address_book_extern_save_config(LibBalsaAddressBook * ab,
+                                          const gchar * prefix)
 {
     LibBalsaAddressBookExtern *vc;
 
@@ -346,15 +326,13 @@ libbalsa_address_book_extern_save_config(LibBalsaAddressBook *ab,
     libbalsa_conf_set_string("Load", vc->load);
     libbalsa_conf_set_string("Save", vc->save);
 
-    if (LIBBALSA_ADDRESS_BOOK_CLASS(parent_class)->save_config) {
-        LIBBALSA_ADDRESS_BOOK_CLASS(parent_class)->save_config(ab, prefix);
-    }
+    if (LIBBALSA_ADDRESS_BOOK_CLASS(parent_class)->save_config)
+       LIBBALSA_ADDRESS_BOOK_CLASS(parent_class)->save_config(ab, prefix);
 }
 
-
 static void
-libbalsa_address_book_externq_load_config(LibBalsaAddressBook *ab,
-                                          const gchar         *prefix)
+libbalsa_address_book_externq_load_config(LibBalsaAddressBook * ab,
+                                          const gchar * prefix)
 {
     LibBalsaAddressBookExtern *vc;
 
@@ -366,31 +344,25 @@ libbalsa_address_book_externq_load_config(LibBalsaAddressBook *ab,
     vc->load = libbalsa_conf_get_string("Load");
     vc->save = libbalsa_conf_get_string("Save");
 
-    if (LIBBALSA_ADDRESS_BOOK_CLASS(parent_class)->load_config) {
-        LIBBALSA_ADDRESS_BOOK_CLASS(parent_class)->load_config(ab, prefix);
-    }
+    if (LIBBALSA_ADDRESS_BOOK_CLASS(parent_class)->load_config)
+       LIBBALSA_ADDRESS_BOOK_CLASS(parent_class)->load_config(ab, prefix);
 }
 
-
 static void
-lbe_expand_cb(const gchar *email,
-              const gchar *name,
-              void        *d)
+lbe_expand_cb(const gchar *email, const gchar *name, void *d)
 {
-    GList **res = (GList **)d;
-    if (email && *email) {
-        if (!name || !*name) {
+    GList **res = (GList**)d;
+    if(email && *email) {
+        if(!name || !*name)
             name = _("No-Name");
-        }
         *res = g_list_prepend(*res,
                               internet_address_mailbox_new(name, email));
     }
 }
 
-
-static GList *
-libbalsa_address_book_extern_alias_complete(LibBalsaAddressBook *ab,
-                                            const gchar         *prefix)
+static GList*
+libbalsa_address_book_extern_alias_complete(LibBalsaAddressBook * ab,
+                                             const gchar * prefix)
 {
     LibBalsaAddressBookExtern *ex;
     GList *res = NULL;
@@ -399,54 +371,48 @@ libbalsa_address_book_extern_alias_complete(LibBalsaAddressBook *ab,
 
     ex = LIBBALSA_ADDRESS_BOOK_EXTERN(ab);
 
-    if (!libbalsa_address_book_get_expand_aliases(ab)) {
-        return NULL;
-    }
+    if (!libbalsa_address_book_get_expand_aliases(ab))
+       return NULL;
 
-    if (!parse_extern_file(ex, (gchar *)prefix, lbe_expand_cb, &res)) {
+    if(!parse_extern_file(ex, (gchar *)prefix, lbe_expand_cb, &res))
         return NULL;
-    }
-
+       
     res = g_list_reverse(res);
 
     return res;
 }
 
-
 /*
  * Getters
  */
 
 const gchar *
-libbalsa_address_book_extern_get_load(LibBalsaAddressBookExtern *addr_extern)
+libbalsa_address_book_extern_get_load(LibBalsaAddressBookExtern * addr_extern)
 {
     return addr_extern->load;
 }
 
-
 const gchar *
-libbalsa_address_book_extern_get_save(LibBalsaAddressBookExtern *addr_extern)
+libbalsa_address_book_extern_get_save(LibBalsaAddressBookExtern * addr_extern)
 {
     return addr_extern->save;
 }
 
-
 /*
  * Setters
  */
 
 void
-libbalsa_address_book_extern_set_load(LibBalsaAddressBookExtern *addr_extern,
-                                      const gchar               *load)
+libbalsa_address_book_extern_set_load(LibBalsaAddressBookExtern * addr_extern,
+                                      const gchar               * load)
 {
     g_free(addr_extern->load);
     addr_extern->load = g_strdup(load);
 }
 
-
 void
-libbalsa_address_book_extern_set_save(LibBalsaAddressBookExtern *addr_extern,
-                                      const gchar               *save)
+libbalsa_address_book_extern_set_save(LibBalsaAddressBookExtern * addr_extern,
+                                      const gchar               * save)
 {
     g_free(addr_extern->save);
     addr_extern->save = g_strdup(save);
diff --git a/libbalsa/address-book-extern.h b/libbalsa/address-book-extern.h
index 9bff93c..e4e5281 100644
--- a/libbalsa/address-book-extern.h
+++ b/libbalsa/address-book-extern.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -30,26 +30,26 @@
 
 #define LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN (libbalsa_address_book_extern_get_type())
 G_DECLARE_FINAL_TYPE(LibBalsaAddressBookExtern, libbalsa_address_book_extern,
-                     LIBBALSA, ADDRESS_BOOK_EXTERN, LibBalsaAddressBook)
+        LIBBALSA, ADDRESS_BOOK_EXTERN, LibBalsaAddressBook)
 
-LibBalsaAddressBook * libbalsa_address_book_externq_new(const gchar * name,
-                                                        const gchar * load,
-                                                        const char *save);
+LibBalsaAddressBook *libbalsa_address_book_externq_new(const gchar * name,
+                                                       const gchar * load,
+                                                       const char * save);
 
 /*
  * Getters
  */
 const gchar
-*libbalsa_address_book_extern_get_load(LibBalsaAddressBookExtern *addr_extern);
+    *libbalsa_address_book_extern_get_load(LibBalsaAddressBookExtern * addr_extern);
 const gchar
-*libbalsa_address_book_extern_get_save(LibBalsaAddressBookExtern *addr_extern);
+    *libbalsa_address_book_extern_get_save(LibBalsaAddressBookExtern * addr_extern);
 
 /*
  * Setters
  */
-void libbalsa_address_book_extern_set_load(LibBalsaAddressBookExtern *addr_extern,
-                                           const gchar               *load);
-void libbalsa_address_book_extern_set_save(LibBalsaAddressBookExtern *addr_extern,
-                                           const gchar               *save);
+void libbalsa_address_book_extern_set_load(LibBalsaAddressBookExtern * addr_extern,
+                                           const gchar               * load);
+void libbalsa_address_book_extern_set_save(LibBalsaAddressBookExtern * addr_extern,
+                                           const gchar               * save);
 
 #endif
diff --git a/libbalsa/address-book-gpe.c b/libbalsa/address-book-gpe.c
index 9fd27d7..15f6540 100644
--- a/libbalsa/address-book-gpe.c
+++ b/libbalsa/address-book-gpe.c
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -21,62 +21,67 @@
 /*
  * GPE address book
  * NOTES:
-   See
-   http://cvs.handhelds.org/cgi-bin/viewcvs.cgi/gpe/base/gpe-contacts
-   Tags must be UPPERCASE.
+ See 
+ http://cvs.handhelds.org/cgi-bin/viewcvs.cgi/gpe/base/gpe-contacts
+ Tags must be UPPERCASE.
  */
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #if defined(HAVE_SQLITE)
 
-#   include "address-book-gpe.h"
+#include "address-book-gpe.h"
 
-#   include <stdio.h>
-#   include <stdlib.h>
-#   include <string.h>
-#   include <sys/stat.h>
-#   include <sys/types.h>
-#   include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <time.h>
 
-#   include "address-book.h"
-#   include "information.h"
+#include "address-book.h"
+#include "information.h"
 
-#   define ASSURE_GPE_DIR \
-    do {gchar *dir = g_strconcat(g_get_home_dir(), "/.gpe", NULL); \
-        mkdir(dir, S_IRUSR | S_IWUSR | S_IXUSR); g_free(dir);} while (0)
+#define ASSURE_GPE_DIR\
+    do {gchar* dir = g_strconcat(g_get_home_dir(), "/.gpe", NULL);\
+ mkdir(dir, S_IRUSR|S_IWUSR|S_IXUSR); g_free(dir);}while(0)
 
-static void libbalsa_address_book_gpe_class_init(LibBalsaAddressBookGpeClass *
-                                                 klass);
-static void libbalsa_address_book_gpe_init(LibBalsaAddressBookGpe *ab_gpe);
-static void libbalsa_address_book_gpe_finalize(GObject *object);
+static void
+libbalsa_address_book_gpe_class_init(LibBalsaAddressBookGpeClass *
+                                     klass);
+static void libbalsa_address_book_gpe_init(LibBalsaAddressBookGpe * ab_gpe);
+static void libbalsa_address_book_gpe_finalize(GObject * object);
 
-static LibBalsaABErr libbalsa_address_book_gpe_load(LibBalsaAddressBook        *ab,
-                                                    const gchar                *filter,
-                                                    LibBalsaAddressBookLoadFunc callback,
-                                                    gpointer                    closure);
+static LibBalsaABErr libbalsa_address_book_gpe_load(LibBalsaAddressBook * ab, 
+                                                    const gchar *filter,
+                                                    LibBalsaAddressBookLoadFunc callback, 
+                                                    gpointer closure);
 
-static void libbalsa_address_book_gpe_close_db(LibBalsaAddressBookGpe *ab_gpe);
-static LibBalsaABErr libbalsa_address_book_gpe_add_address(LibBalsaAddressBook *ab,
-                                                           LibBalsaAddress     *address);
-static LibBalsaABErr libbalsa_address_book_gpe_remove_address(LibBalsaAddressBook *ab,
-                                                              LibBalsaAddress     *address);
-static LibBalsaABErr libbalsa_address_book_gpe_modify_address(LibBalsaAddressBook *ab,
-                                                              LibBalsaAddress     *address,
-                                                              LibBalsaAddress     *newval);
+static void
+libbalsa_address_book_gpe_close_db(LibBalsaAddressBookGpe *ab_gpe);
+static LibBalsaABErr
+libbalsa_address_book_gpe_add_address(LibBalsaAddressBook *ab,
+                                      LibBalsaAddress *address);
+static LibBalsaABErr
+libbalsa_address_book_gpe_remove_address(LibBalsaAddressBook *ab,
+                                         LibBalsaAddress *address);
+static LibBalsaABErr
+libbalsa_address_book_gpe_modify_address(LibBalsaAddressBook *ab,
+                                         LibBalsaAddress *address,
+                                         LibBalsaAddress *newval);
 
 
 static GList *libbalsa_address_book_gpe_alias_complete(LibBalsaAddressBook *ab,
-                                                       const gchar         *prefix);
+                                                       const gchar *prefix);
 
 struct _LibBalsaAddressBookGpe {
     LibBalsaAddressBook parent;
-#   ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE3
     sqlite3 *db;
-#   else                        /* HAVE_SQLITE3 */
+#else                           /* HAVE_SQLITE3 */
     sqlite *db;
-#   endif                       /* HAVE_SQLITE3 */
+#endif                          /* HAVE_SQLITE3 */
 };
 
 struct _LibBalsaAddressBookGpeClass {
@@ -84,10 +89,10 @@ struct _LibBalsaAddressBookGpeClass {
 };
 
 G_DEFINE_TYPE(LibBalsaAddressBookGpe, libbalsa_address_book_gpe,
-              LIBBALSA_TYPE_ADDRESS_BOOK)
+        LIBBALSA_TYPE_ADDRESS_BOOK)
 
 static void
-libbalsa_address_book_gpe_class_init(LibBalsaAddressBookGpeClass *klass)
+libbalsa_address_book_gpe_class_init(LibBalsaAddressBookGpeClass * klass)
 {
     LibBalsaAddressBookClass *address_book_class;
     GObjectClass *object_class;
@@ -99,18 +104,17 @@ libbalsa_address_book_gpe_class_init(LibBalsaAddressBookGpeClass *klass)
 
     address_book_class->load = libbalsa_address_book_gpe_load;
     address_book_class->add_address = libbalsa_address_book_gpe_add_address;
-    address_book_class->remove_address =
+    address_book_class->remove_address = 
         libbalsa_address_book_gpe_remove_address;
     address_book_class->modify_address =
         libbalsa_address_book_gpe_modify_address;
 
-    address_book_class->alias_complete =
-        libbalsa_address_book_gpe_alias_complete;
+    address_book_class->alias_complete = 
+       libbalsa_address_book_gpe_alias_complete;
 }
 
-
 static void
-libbalsa_address_book_gpe_init(LibBalsaAddressBookGpe *ab_gpe)
+libbalsa_address_book_gpe_init(LibBalsaAddressBookGpe * ab_gpe)
 {
     LibBalsaAddressBook *ab;
 
@@ -120,16 +124,14 @@ libbalsa_address_book_gpe_init(LibBalsaAddressBookGpe *ab_gpe)
     libbalsa_address_book_set_is_expensive(ab, FALSE);
 }
 
-
 static void
-libbalsa_address_book_gpe_finalize(GObject *object)
+libbalsa_address_book_gpe_finalize(GObject * object)
 {
     libbalsa_address_book_gpe_close_db(LIBBALSA_ADDRESS_BOOK_GPE(object));
 
     G_OBJECT_CLASS(libbalsa_address_book_gpe_parent_class)->finalize(object);
 }
 
-
 LibBalsaAddressBook *
 libbalsa_address_book_gpe_new(const gchar *name)
 {
@@ -137,8 +139,8 @@ libbalsa_address_book_gpe_new(const gchar *name)
     LibBalsaAddressBook *ab;
 
     ab_gpe = LIBBALSA_ADDRESS_BOOK_GPE(g_object_new
-                                           (LIBBALSA_TYPE_ADDRESS_BOOK_GPE,
-                                           NULL));
+                                       (LIBBALSA_TYPE_ADDRESS_BOOK_GPE,
+                                        NULL));
     ab = LIBBALSA_ADDRESS_BOOK(ab_gpe);
     libbalsa_address_book_set_name(ab, name);
 
@@ -148,45 +150,43 @@ libbalsa_address_book_gpe_new(const gchar *name)
     return ab;
 }
 
-
 /*
  * Close the SQLite db....
  */
 static void
-libbalsa_address_book_gpe_close_db(LibBalsaAddressBookGpe *ab_gpe)
+libbalsa_address_book_gpe_close_db(LibBalsaAddressBookGpe * ab_gpe)
 {
     if (ab_gpe->db) {
-#   ifdef HAVE_SQLITE3
-        sqlite3_close(ab_gpe->db);
-#   else                        /* HAVE_SQLITE3 */
-        sqlite_close(ab_gpe->db);
-#   endif                       /* HAVE_SQLITE3 */
-        ab_gpe->db = NULL;
+#ifdef HAVE_SQLITE3
+       sqlite3_close(ab_gpe->db);
+#else                           /* HAVE_SQLITE3 */
+       sqlite_close(ab_gpe->db);
+#endif                          /* HAVE_SQLITE3 */
+       ab_gpe->db = NULL;
     }
 }
 
-
 /*
  * Opens the SQLite db
  */
-#   ifndef HAVE_SQLITE3
-#      define DB_NAME "/.gpe/contacts"
-#   endif                       /* HAVE_SQLITE3 */
+#ifndef HAVE_SQLITE3
+#define DB_NAME "/.gpe/contacts"
+#endif                          /* HAVE_SQLITE3 */
 static const char *schema_str =
-    "create table contacts (urn INTEGER NOT NULL, tag TEXT NOT NULL, "
-    "value TEXT NOT NULL)";
+"create table contacts (urn INTEGER NOT NULL, tag TEXT NOT NULL, "
+"value TEXT NOT NULL)";
 
 static const char *schema2_str =
-    "create table contacts_urn (urn INTEGER PRIMARY KEY)";
+"create table contacts_urn (urn INTEGER PRIMARY KEY)";
 
 static int
-libbalsa_address_book_gpe_open_db(LibBalsaAddressBookGpe *ab_gpe)
+libbalsa_address_book_gpe_open_db(LibBalsaAddressBookGpe * ab_gpe)
 {
-#   ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE3
     gchar *dir, *name;
 
     dir = g_build_filename(g_get_home_dir(), ".gpe", NULL);
-    mkdir(dir, S_IRUSR | S_IWUSR | S_IXUSR);
+    mkdir(dir, S_IRUSR|S_IWUSR|S_IXUSR);
     name = g_build_filename(dir, "contacts", NULL);
     g_free(dir);
 
@@ -199,23 +199,23 @@ libbalsa_address_book_gpe_open_db(LibBalsaAddressBookGpe *ab_gpe)
     }
     g_free(name);
 
-    sqlite3_exec(ab_gpe->db, schema_str, NULL, NULL, NULL);
+    sqlite3_exec(ab_gpe->db, schema_str,  NULL, NULL, NULL);
     sqlite3_exec(ab_gpe->db, schema2_str, NULL, NULL, NULL);
-#   else                        /* HAVE_SQLITE3 */
+#else                           /* HAVE_SQLITE3 */
     gchar *name, *errmsg = NULL;
 
     ASSURE_GPE_DIR;
     name = g_strconcat(g_get_home_dir(), DB_NAME, NULL);
     ab_gpe->db = sqlite_open(name, 0, &errmsg);
     g_free(name);
-    if (ab_gpe->db == NULL) {
+    if(ab_gpe->db == NULL) {
         printf("Cannot open: %s\n", errmsg);
         free(errmsg);
         return 0;
     }
-    sqlite_exec (ab_gpe->db, schema_str, NULL, NULL, NULL);
+    sqlite_exec (ab_gpe->db, schema_str,  NULL, NULL, NULL);
     sqlite_exec (ab_gpe->db, schema2_str, NULL, NULL, NULL);
-#   endif                       /* HAVE_SQLITE3 */
+#endif                          /* HAVE_SQLITE3 */
 
     return 1;
 }
@@ -225,76 +225,69 @@ libbalsa_address_book_gpe_open_db(LibBalsaAddressBookGpe *ab_gpe)
  * a callback to fill in the LibBalsaAddress object.
  * see http://www.handhelds.org:8080/wiki/WellKnownDBTags for tag list
  * We only use limited subset.
- *
-   given_name         # how to handle "J. Edgar Hoover"?
-   middle_initial
-   family_name        # nb family name is written first in many cultures
-   nickname
-   home_email         # multiple addresses, separated by commas
-   work_organization
-   work_email         # multiple addresses, separated by commas
- */
+ * 
+ given_name         # how to handle "J. Edgar Hoover"?
+ middle_initial
+ family_name        # nb family name is written first in many cultures
+ nickname
+ home_email         # multiple addresses, separated by commas
+ work_organization
+ work_email         # multiple addresses, separated by commas
+*/
 
 
 static int
-gpe_read_attr(void  *arg,
-              int    argc,
-              char **argv,
-              char **names)
+gpe_read_attr(void *arg, int argc, char **argv, char **names)
 {
     LibBalsaAddress *address = arg;
 
     /* follow read_entry_data/db_set_multi_data */
-    if ((g_ascii_strcasecmp(argv[0], "NAME") == 0) &&
-        (libbalsa_address_get_full_name(address) == NULL)) {
+    if(g_ascii_strcasecmp(argv[0], "NAME") == 0 &&
+       libbalsa_address_get_full_name(address) == NULL) {
         libbalsa_address_set_full_name(address, argv[1]);
-    } else if ((g_ascii_strcasecmp(argv[0], "GIVEN_NAME") == 0) &&
-               (libbalsa_address_get_first_name(address) == NULL)) {
+    } else if(g_ascii_strcasecmp(argv[0], "GIVEN_NAME") == 0 &&
+              libbalsa_address_get_first_name(address) == NULL) {
         libbalsa_address_set_first_name(address, argv[1]);
-    } else if ((g_ascii_strcasecmp(argv[0], "FAMILY_NAME") == 0) &&
-               (libbalsa_address_get_last_name(address) == NULL)) {
+    } else if(g_ascii_strcasecmp(argv[0], "FAMILY_NAME") == 0 &&
+              libbalsa_address_get_last_name(address) == NULL) {
         libbalsa_address_set_last_name(address, argv[1]);
-    } else if ((g_ascii_strcasecmp(argv[0], "NICKNAME") == 0) &&
-               (libbalsa_address_get_nick_name(address) == NULL)) {
+    } else if(g_ascii_strcasecmp(argv[0], "NICKNAME") == 0 &&
+              libbalsa_address_get_nick_name(address) == NULL) {
         libbalsa_address_set_nick_name(address, argv[1]);
-    } else if ((g_ascii_strcasecmp(argv[0], "WORK.ORGANIZATION") == 0) &&
-               (libbalsa_address_get_organization(address) == NULL)) {
+    } else if(g_ascii_strcasecmp(argv[0], "WORK.ORGANIZATION") == 0 &&
+              libbalsa_address_get_organization(address) == NULL) {
         libbalsa_address_set_organization(address, argv[1]);
-    } else if (g_ascii_strcasecmp(argv[0], "HOME.EMAIL") == 0) {
+    } else if(g_ascii_strcasecmp(argv[0], "HOME.EMAIL") == 0) {
         libbalsa_address_add_addr(address, argv[1]);
-    } else if (g_ascii_strcasecmp(argv[0], "WORK.EMAIL") == 0) {
+    } else if(g_ascii_strcasecmp(argv[0], "WORK.EMAIL") == 0) {
         libbalsa_address_add_addr(address, argv[1]);
     }
 
     return 0;
 }
 
-
 /*
  * create_name()
  *
  * Creates a full name from a given first name and surname.
- *
+ * 
  * Returns:
  *   gchar * a full name
  *   NULL on failure (both first and last names invalid.
  */
 static gchar *
-create_name(const gchar *first,
-            const gchar *last)
+create_name(const gchar * first, const gchar * last)
 {
-    if ((first == NULL) && (last == NULL)) {
-        return NULL;
-    } else if (first == NULL) {
-        return g_strdup(last);
-    } else if (last == NULL) {
-        return g_strdup(first);
-    } else {
-        return g_strdup_printf("%s %s", first, last);
-    }
+    if ((first == NULL) && (last == NULL))
+       return NULL;
+    else if (first == NULL)
+       return g_strdup(last);
+    else if (last == NULL)
+       return g_strdup(first);
+    else
+       return g_strdup_printf("%s %s", first, last);
 }
 
-
 struct gpe_closure {
     LibBalsaAddressBookLoadFunc callback;
     gpointer closure;
@@ -302,28 +295,25 @@ struct gpe_closure {
 };
 
 static int
-gpe_read_address(void  *arg,
-                 int    argc,
-                 char **argv,
-                 char **names)
+gpe_read_address(void *arg, int argc, char **argv, char **names)
 {
     struct gpe_closure *gc = arg;
     LibBalsaAddress *address = libbalsa_address_new();
     guint uid = atoi(argv[0]);
 
     /* follow read_entry_data. FIXME: error reporting */
-#   ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE3
     gchar *sql =
         sqlite3_mprintf("select tag,value from contacts where urn=%d",
                         uid);
     sqlite3_exec(gc->gpe->db, sql, gpe_read_attr, address, NULL);
     sqlite3_free(sql);
-#   else                        /* HAVE_SQLITE3 */
+#else                           /* HAVE_SQLITE3 */
     sqlite_exec_printf (gc->gpe->db,
                         "select tag,value from contacts where urn=%d",
                         gpe_read_attr, a, NULL, uid);
-#   endif                       /* HAVE_SQLITE3 */
-    if (libbalsa_address_get_addr_list(address) == NULL) {
+#endif                          /* HAVE_SQLITE3 */
+    if(libbalsa_address_get_addr_list(address) == NULL) {
         /* entry without address: ignore! */
         g_object_unref(address);
         return 0;
@@ -334,8 +324,8 @@ gpe_read_address(void  *arg,
         gchar *full_name;
 
         first_name = libbalsa_address_get_first_name(address);
-        last_name = libbalsa_address_get_last_name(address);
-        full_name = create_name(first_name, last_name);
+        last_name  = libbalsa_address_get_last_name(address);
+        full_name  = create_name(first_name, last_name);
         libbalsa_address_set_full_name(address, full_name);
         g_free(full_name);
     }
@@ -350,10 +340,10 @@ gpe_read_address(void  *arg,
  * opens the db only if needed.
  */
 static LibBalsaABErr
-libbalsa_address_book_gpe_load(LibBalsaAddressBook        *ab,
-                               const gchar                *filter,
+libbalsa_address_book_gpe_load(LibBalsaAddressBook * ab,
+                               const gchar *filter,
                                LibBalsaAddressBookLoadFunc callback,
-                               gpointer                    closure)
+                               gpointer closure)
 {
     LibBalsaAddressBookGpe *ab_gpe;
     gchar *err = NULL;
@@ -363,23 +353,20 @@ libbalsa_address_book_gpe_load(LibBalsaAddressBook        *ab,
 
     g_return_val_if_fail(LIBBALSA_IS_ADDRESS_BOOK_GPE(ab), LBABERR_OK);
 
-    if (callback == NULL) {
-        return LBABERR_OK;
-    }
+    if (callback == NULL)
+       return LBABERR_OK;
 
     ab_gpe = LIBBALSA_ADDRESS_BOOK_GPE(ab);
-
-    if (ab_gpe->db == NULL) {
-        if (!libbalsa_address_book_gpe_open_db(ab_gpe)) {
+    
+    if (ab_gpe->db == NULL)
+        if (!libbalsa_address_book_gpe_open_db(ab_gpe))
             return LBABERR_CANNOT_CONNECT;
-        }
-    }
 
     gc.callback = callback;
-    gc.closure = closure;
-    gc.gpe = ab_gpe;
+    gc.closure  = closure;
+    gc.gpe      = ab_gpe;
     /* FIXME: error reporting */
-#   ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE3
     if (filter && *filter) {
         gchar *sql =
             sqlite3_mprintf("select distinct urn from contacts where "
@@ -397,30 +384,30 @@ libbalsa_address_book_gpe_load(LibBalsaAddressBook        *ab,
                          "select distinct urn from contacts_urn",
                          gpe_read_address, &gc, &err);
     }
-#   else                        /* HAVE_SQLITE3 */
-    if (filter && *filter) {
+#else                           /* HAVE_SQLITE3 */
+    if(filter && *filter) {
         r = sqlite_exec_printf
-                (ab_gpe->db,
-                "select distinct urn from contacts where "
-                "(upper(tag)='FAMILY_NAME' or upper(tag)='GIVEN_NAME' or "
-                "upper(tag)='NAME' or "
-                "upper(tag)='WORK.EMAIL' or upper(tag)='HOME.EMAIL') "
-                "and value LIKE '%q%%'",
-                gpe_read_address, &gc, &err, filter);
+            (ab_gpe->db, 
+             "select distinct urn from contacts where "
+             "(upper(tag)='FAMILY_NAME' or upper(tag)='GIVEN_NAME' or "
+             "upper(tag)='NAME' or "
+             "upper(tag)='WORK.EMAIL' or upper(tag)='HOME.EMAIL') "
+             "and value LIKE '%q%%'",
+             gpe_read_address, &gc, &err, filter);
     } else {
         r = sqlite_exec(ab_gpe->db, "select distinct urn from contacts_urn",
                         gpe_read_address, &gc, &err);
     }
-#   endif                       /* HAVE_SQLITE3 */
+#endif                          /* HAVE_SQLITE3 */
 
-    if (r != SQLITE_OK) {
+    if(r != SQLITE_OK) {
         printf("r=%d err=%s\n", r, err);
         libbalsa_address_book_set_status(ab, err);
-#   ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE3
         sqlite3_free(err);
-#   else                        /* HAVE_SQLITE3 */
+#else                           /* HAVE_SQLITE3 */
         free(err);
-#   endif                       /* HAVE_SQLITE3 */
+#endif                          /* HAVE_SQLITE3 */
         ret = LBABERR_CANNOT_READ;
     } else {
         libbalsa_address_book_set_status(ab, NULL);
@@ -431,104 +418,98 @@ libbalsa_address_book_gpe_load(LibBalsaAddressBook        *ab,
     return ret;
 }
 
-
-#   ifdef HAVE_SQLITE3
-#      define INSERT_ATTR(db, id, attr, val) \
-    do { if ((val) && *(val)) { \
-             sql = sqlite3_mprintf("insert into contacts values ('%d', '%q', '%q')", \
-                                   (id), (attr), (val)); \
-             sqlite3_exec((db), sql, NULL, NULL, NULL); \
-             sqlite3_free(sql);}} while (0)
-#   else                        /* HAVE_SQLITE3 */
-#      define INSERT_ATTR(db, id, attr, val) \
-    do { if ((val) && *(val)) { \
-             sqlite_exec_printf((db), "insert into contacts values ('%d', '%q', '%q')", \
-                                NULL, NULL, NULL, (id), (attr), (val));}} while (0);
-#   endif                       /* HAVE_SQLITE3 */
+#ifdef HAVE_SQLITE3
+#define INSERT_ATTR(db,id,attr,val) \
+ do { if( (val) && *(val)) {\
+ sql = sqlite3_mprintf("insert into contacts values ('%d', '%q', '%q')",\
+                       (id), (attr), (val));\
+ sqlite3_exec((db), sql, NULL, NULL, NULL);\
+ sqlite3_free(sql);}} while(0)
+#else                           /* HAVE_SQLITE3 */
+#define INSERT_ATTR(db,id,attr,val) \
+ do { if( (val) && *(val)) {\
+ sqlite_exec_printf((db), "insert into contacts values ('%d', '%q', '%q')",\
+                    NULL, NULL, NULL, (id), (attr), (val));}} while(0);
+#endif                          /* HAVE_SQLITE3 */
 
 static LibBalsaABErr
 libbalsa_address_book_gpe_add_address(LibBalsaAddressBook *ab,
-                                      LibBalsaAddress     *address)
+                                       LibBalsaAddress *address)
 {
     LibBalsaAddressBookGpe *ab_gpe = LIBBALSA_ADDRESS_BOOK_GPE(ab);
     const gchar *addr;
     int r;
     guint id;
     char *err = NULL;
-#   ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE3
     gchar *sql;
-#   endif                       /* HAVE_SQLITE3 */
+#endif                          /* HAVE_SQLITE3 */
 
     g_return_val_if_fail(address != NULL, LBABERR_CANNOT_WRITE);
     addr = libbalsa_address_get_addr(address);
     g_return_val_if_fail(addr != NULL, LBABERR_CANNOT_WRITE);
 
     if (ab_gpe->db == NULL) {
-        if (!libbalsa_address_book_gpe_open_db(ab_gpe)) {
-            return LBABERR_CANNOT_CONNECT;
-        }
+        if(!libbalsa_address_book_gpe_open_db(ab_gpe))
+           return LBABERR_CANNOT_CONNECT;
     }
-#   ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE3
     r = sqlite3_exec(ab_gpe->db, "insert into contacts_urn values (NULL)",
                      NULL, NULL, &err);
     if (r != SQLITE_OK) {
         libbalsa_address_book_set_status(ab, err);
         sqlite3_free(err);
-#   else                        /* HAVE_SQLITE3 */
+#else                           /* HAVE_SQLITE3 */
     r = sqlite_exec(ab_gpe->db, "insert into contacts_urn values (NULL)",
                     NULL, NULL, &err);
     if (r != SQLITE_OK) {
         libbalsa_address_book_set_status(ab, err);
         free(err);
-#   endif                       /* HAVE_SQLITE3 */
+#endif                          /* HAVE_SQLITE3 */
         return LBABERR_CANNOT_WRITE;
     }
     /* FIXME: duplicate detection! */
 
-#   ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE3
     id = sqlite3_last_insert_rowid(ab_gpe->db);
-#   else                        /* HAVE_SQLITE3 */
+#else                           /* HAVE_SQLITE3 */
     id = sqlite_last_insert_rowid(ab_gpe->db);
-#   endif                       /* HAVE_SQLITE3 */
-    INSERT_ATTR(ab_gpe->db, id, "NAME",
+#endif                          /* HAVE_SQLITE3 */
+    INSERT_ATTR(ab_gpe->db,id, "NAME",
                 libbalsa_address_get_full_name(address));
-    INSERT_ATTR(ab_gpe->db, id, "GIVEN_NAME",
+    INSERT_ATTR(ab_gpe->db,id, "GIVEN_NAME",
                 libbalsa_address_get_first_name(address));
-    INSERT_ATTR(ab_gpe->db, id, "FAMILY_NAME",
+    INSERT_ATTR(ab_gpe->db,id, "FAMILY_NAME",
                 libbalsa_address_get_last_name(address));
-    INSERT_ATTR(ab_gpe->db, id, "NICKNAME",
+    INSERT_ATTR(ab_gpe->db,id, "NICKNAME",
                 libbalsa_address_get_nick_name(address));
-    INSERT_ATTR(ab_gpe->db, id, "WORK.ORGANIZATION",
+    INSERT_ATTR(ab_gpe->db,id, "WORK.ORGANIZATION",
                 libbalsa_address_get_organization(address));
-    INSERT_ATTR(ab_gpe->db, id, "WORK.EMAIL", addr);
-#   ifdef HAVE_SQLITE3
+    INSERT_ATTR(ab_gpe->db,id, "WORK.EMAIL", addr);
+#ifdef HAVE_SQLITE3
     sql = sqlite3_mprintf("insert into contacts values "
                           "('%d', 'MODIFIED', %d)",
                           id, time(NULL));
     sqlite3_exec(ab_gpe->db, sql, NULL, NULL, NULL);
     sqlite3_free(sql);
-#   else                        /* HAVE_SQLITE3 */
+#else                           /* HAVE_SQLITE3 */
     sqlite_exec_printf(ab_gpe->db, "insert into contacts values "
                        "('%d', 'MODIFIED', %d)", NULL, NULL, NULL,
                        id, time(NULL));
-#   endif                       /* HAVE_SQLITE3 */
+#endif                          /* HAVE_SQLITE3 */
     return LBABERR_OK;
 }
-
-
-#   ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE3
 static gchar *
-db_delete_by_uid(sqlite3 *db,
-                 guint    uid)
+db_delete_by_uid(sqlite3 * db, guint uid)
 {
     int r;
     gchar *err;
     gchar *sql;
 
     if (sqlite3_exec(db, "begin transaction", NULL, NULL, &err) !=
-        SQLITE_OK) {
+        SQLITE_OK)
         return err;
-    }
 
     sql = sqlite3_mprintf("delete from contacts where urn='%d'", uid);
     r = sqlite3_exec(db, sql, NULL, NULL, &err);
@@ -554,40 +535,32 @@ db_delete_by_uid(sqlite3 *db,
 
     return NULL;
 }
-
-
-#   else                        /* HAVE_SQLITE3 */
-static gchar *
-db_delete_by_uid(sqlite *db,
-                 guint   uid)
+#else                           /* HAVE_SQLITE3 */
+static gchar*
+db_delete_by_uid(sqlite *db, guint uid)
 {
     int r;
     gchar *err;
-
-    if ((r = sqlite_exec(db, "begin transaction",
-                         NULL, NULL, &err)) == SQLITE_OK) {
+    
+    if( (r=sqlite_exec(db, "begin transaction",
+                       NULL, NULL, &err)) == SQLITE_OK)
         return err;
-    }
-
-    if (((r = sqlite_exec_printf(db, "delete from contacts where urn='%d'",
-                                 NULL, NULL, &err, uid)) == SQLITE_OK) &&
-        ((r = sqlite_exec_printf(db, "delete from contacts_urn where urn='%d'",
-                                 NULL, NULL, &err, uid)) == SQLITE_OK) &&
-        ((r = sqlite_exec(db, "commit transaction", NULL,
-                          NULL, &err)) == SQLITE_OK)) {
-        return NULL;
-    }
-
+    
+    if( (r=sqlite_exec_printf(db, "delete from contacts where urn='%d'",
+                              NULL, NULL, &err, uid)) == SQLITE_OK &&
+        (r=sqlite_exec_printf(db, "delete from contacts_urn where urn='%d'",
+                              NULL, NULL, &err, uid)) == SQLITE_OK &&
+        (r=sqlite_exec(db, "commit transaction", NULL,
+                       NULL, &err)) == SQLITE_OK) return NULL;
+    
     sqlite_exec(db, "rollback transaction", NULL, NULL, NULL);
     return err;
 }
-
-
-#   endif                       /* HAVE_SQLITE3 */
+#endif                          /* HAVE_SQLITE3 */
 
 static LibBalsaABErr
 libbalsa_address_book_gpe_remove_address(LibBalsaAddressBook *ab,
-                                         LibBalsaAddress     *address)
+                                          LibBalsaAddress *address)
 {
     LibBalsaAddressBookGpe *ab_gpe = LIBBALSA_ADDRESS_BOOK_GPE(ab);
     guint uid;
@@ -596,81 +569,76 @@ libbalsa_address_book_gpe_remove_address(LibBalsaAddressBook *ab,
     g_return_val_if_fail(address != NULL, LBABERR_CANNOT_WRITE);
 
     if (ab_gpe->db == NULL) {
-        if ( !libbalsa_address_book_gpe_open_db(ab_gpe)) {
-            return LBABERR_CANNOT_CONNECT;
-        }
+        if( !libbalsa_address_book_gpe_open_db(ab_gpe))
+           return LBABERR_CANNOT_CONNECT;
     }
     uid = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(address), "urn"));
-    if (!uid) {/* safety check, perhaps unnecessary */
+    if(!uid)/* safety check, perhaps unnecessary */
         return LBABERR_CANNOT_WRITE;
-    }
 
     err = db_delete_by_uid(ab_gpe->db, uid);
-    if (err) {
+    if(err) {
         libbalsa_address_book_set_status(ab, err);
-#   ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE3
         sqlite3_free(err);
-#   else                        /* HAVE_SQLITE3 */
+#else                           /* HAVE_SQLITE3 */
         free(err);
-#   endif                       /* HAVE_SQLITE3 */
+#endif                          /* HAVE_SQLITE3 */
         return LBABERR_CANNOT_WRITE;
-    } else {
-        return LBABERR_OK;
-    }
+    } else return LBABERR_OK;
 }
 
 
 /** libbalsa_address_book_gpe_modify_address:
     modify given address.
- */
-#   ifdef HAVE_SQLITE3
-#      define INSERT_ATTR_R(db, id, attr, val) \
-    if ((val) && *(val)) { \
-        sql = sqlite3_mprintf("insert into contacts values ('%d', '%q', '%q')", \
-                              (id), (attr), (val)); \
-        r = sqlite3_exec((db), sql, NULL, NULL, &err); \
-        sqlite3_free(sql); \
-        if (r != SQLITE_OK) { goto rollback;} }
-#   else                        /* HAVE_SQLITE3 */
-#      define INSERT_ATTR_R(db, id, attr, val) \
-    if ((val) && *(val)) { \
-        if ((r = sqlite_exec_printf \
-                     ((db), "insert into contacts values ('%d', '%q', '%q')", \
-                     NULL, NULL, &err, (id), (attr), (val))) != SQLITE_OK) { \
-            goto rollback;} }
-#   endif                       /* HAVE_SQLITE3 */
+*/
+#ifdef HAVE_SQLITE3
+#define INSERT_ATTR_R(db,id,attr,val) \
+ if ((val) && *(val)) {\
+ sql = sqlite3_mprintf("insert into contacts values ('%d', '%q', '%q')",\
+                       (id), (attr), (val));\
+ r = sqlite3_exec((db), sql, NULL, NULL, &err);\
+ sqlite3_free(sql);\
+ if (r != SQLITE_OK) goto rollback;}
+#else                           /* HAVE_SQLITE3 */
+#define INSERT_ATTR_R(db,id,attr,val) \
+ if( (val) && *(val)) {\
+ if( (r=sqlite_exec_printf \
+         ((db), "insert into contacts values ('%d', '%q', '%q')",\
+                    NULL, NULL, &err, (id), (attr), (val))) != SQLITE_OK)\
+    goto rollback;}
+#endif                          /* HAVE_SQLITE3 */
 
 static LibBalsaABErr
 libbalsa_address_book_gpe_modify_address(LibBalsaAddressBook *ab,
-                                         LibBalsaAddress     *address,
-                                         LibBalsaAddress     *newval)
+                                         LibBalsaAddress *address,
+                                         LibBalsaAddress *newval)
 {
     LibBalsaAddressBookGpe *ab_gpe = LIBBALSA_ADDRESS_BOOK_GPE(ab);
     const gchar *addr;
     guint uid;
     int r;
     char *err;
-#   ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE3
     gchar *sql;
-#   endif                       /* HAVE_SQLITE3 */
+#endif                          /* HAVE_SQLITE3 */
 
     g_return_val_if_fail(address != NULL, LBABERR_CANNOT_WRITE);
-    g_return_val_if_fail(newval != NULL, LBABERR_CANNOT_WRITE);
+    g_return_val_if_fail(newval  != NULL, LBABERR_CANNOT_WRITE);
 
     addr = libbalsa_address_get_addr(newval);
     g_return_val_if_fail(addr != NULL, LBABERR_CANNOT_WRITE);
 
     if (ab_gpe->db == NULL) {
-        if ( !libbalsa_address_book_gpe_open_db(ab_gpe)) {
-            return LBABERR_CANNOT_CONNECT;
-        }
+        if( !libbalsa_address_book_gpe_open_db(ab_gpe))
+           return LBABERR_CANNOT_CONNECT;
     }
     uid = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(address), "urn"));
     /* safety check, perhaps unnecessary */
     g_return_val_if_fail(uid, LBABERR_CANNOT_WRITE);
 
     /* do the real work here */
-#   ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE3
     if ((r = sqlite3_exec(ab_gpe->db, "begin transaction",
                           NULL, NULL, &err)) != SQLITE_OK) {
         libbalsa_address_book_set_status(ab, err);
@@ -687,93 +655,82 @@ libbalsa_address_book_gpe_modify_address(LibBalsaAddressBook *ab,
                           " upper(tag)='MODIFIED')", uid);
     r = sqlite3_exec(ab_gpe->db, sql, NULL, NULL, &err);
     sqlite3_free(sql);
-    if (r != SQLITE_OK) {
+    if (r != SQLITE_OK)
         goto rollback;
-    }
-#   else                        /* HAVE_SQLITE3 */
-    if ((r = sqlite_exec(ab_gpe->db, "begin transaction",
-                         NULL, NULL, &err)) != SQLITE_OK) {
+#else                           /* HAVE_SQLITE3 */
+    if( (r=sqlite_exec(ab_gpe->db, "begin transaction",
+                       NULL, NULL, &err)) != SQLITE_OK) {
         libbalsa_address_book_set_status(ab, err);
         free(err); /* failed, so soon!? */
         return LBABERR_CANNOT_WRITE;
     }
 
-    if ((r = sqlite_exec_printf
-                 (ab_gpe->db,
-                 "delete from contacts where urn='%d' and "
-                 "(upper(tag)='NAME' or upper(tag)='GIVEN_NAME' or "
-                 "upper(tag)='NICKNAME' or upper(tag)='WORK.ORGANIZATION' or "
-                 "upper(tag)='WORK.EMAIL' or upper(tag)='MODIFIED')",
-                 NULL, NULL, &err, uid)) != SQLITE_OK) {
+    if( (r=sqlite_exec_printf
+         (ab_gpe->db,
+          "delete from contacts where urn='%d' and "
+          "(upper(tag)='NAME' or upper(tag)='GIVEN_NAME' or "
+          "upper(tag)='NICKNAME' or upper(tag)='WORK.ORGANIZATION' or "
+          "upper(tag)='WORK.EMAIL' or upper(tag)='MODIFIED')",
+          NULL, NULL, &err, uid)) != SQLITE_OK)
         goto rollback;
-    }
-#   endif                       /* HAVE_SQLITE3 */
-    INSERT_ATTR_R(ab_gpe->db, uid, "NAME",
+#endif                          /* HAVE_SQLITE3 */
+    INSERT_ATTR_R(ab_gpe->db,uid, "NAME",
                   libbalsa_address_get_full_name(newval));
-    INSERT_ATTR_R(ab_gpe->db, uid, "GIVEN_NAME",
+    INSERT_ATTR_R(ab_gpe->db,uid, "GIVEN_NAME",
                   libbalsa_address_get_first_name(newval));
-    INSERT_ATTR_R(ab_gpe->db, uid, "FAMILY_NAME",
+    INSERT_ATTR_R(ab_gpe->db,uid, "FAMILY_NAME",
                   libbalsa_address_get_last_name(newval));
-    INSERT_ATTR_R(ab_gpe->db, uid, "NICKNAME",
+    INSERT_ATTR_R(ab_gpe->db,uid, "NICKNAME",
                   libbalsa_address_get_nick_name(newval));
-    INSERT_ATTR_R(ab_gpe->db, uid, "WORK.ORGANIZATION",
+    INSERT_ATTR_R(ab_gpe->db,uid, "WORK.ORGANIZATION",
                   libbalsa_address_get_organization(newval));
-    INSERT_ATTR_R(ab_gpe->db, uid, "WORK.EMAIL", addr);
-#   ifdef HAVE_SQLITE3
+    INSERT_ATTR_R(ab_gpe->db,uid, "WORK.EMAIL", addr);
+#ifdef HAVE_SQLITE3
     sql = sqlite3_mprintf("insert into contacts values "
                           "('%d', 'MODIFIED', %d)", uid, time(NULL));
     r = sqlite3_exec(ab_gpe->db, sql, NULL, NULL, &err);
     sqlite3_free(sql);
-    if (r != SQLITE_OK) {
+    if (r != SQLITE_OK)
         goto rollback;
-    }
 
     if (sqlite3_exec(ab_gpe->db, "commit transaction", NULL, NULL, &err) ==
-        SQLITE_OK) {
+        SQLITE_OK)
         return LBABERR_OK;
-    }
-#   else                        /* HAVE_SQLITE3 */
-    if ((r = sqlite_exec_printf(ab_gpe->db, "insert into contacts values "
-                                "('%d', 'MODIFIED', %d)", NULL, NULL, &err,
-                                uid, time(NULL))) != SQLITE_OK) {
+#else                           /* HAVE_SQLITE3 */
+    if( (r=sqlite_exec_printf(ab_gpe->db, "insert into contacts values "
+                              "('%d', 'MODIFIED', %d)", NULL, NULL, &err,
+                              uid, time(NULL))) != SQLITE_OK)
         goto rollback;
-    }
+    
+    if( (r=sqlite_exec(ab_gpe->db, "commit transaction", NULL,
+                       NULL, &err)) == SQLITE_OK) return LBABERR_OK;
+#endif                          /* HAVE_SQLITE3 */
 
-    if ((r = sqlite_exec(ab_gpe->db, "commit transaction", NULL,
-                         NULL, &err)) == SQLITE_OK) {
-        return LBABERR_OK;
-    }
-#   endif                       /* HAVE_SQLITE3 */
-
-rollback:
+ rollback:
     libbalsa_address_book_set_status(ab, err);
-#   ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE3
     sqlite3_free(err);
     sqlite3_exec(ab_gpe->db, "rollback transaction", NULL, NULL, NULL);
-#   else                        /* HAVE_SQLITE3 */
+#else                           /* HAVE_SQLITE3 */
     free(err);
     sqlite_exec(ab_gpe->db, "rollback transaction", NULL, NULL, NULL);
-#   endif                       /* HAVE_SQLITE3 */
+#endif                          /* HAVE_SQLITE3 */
 
     return LBABERR_CANNOT_WRITE;
 }
 
-
 struct gpe_completion_closure {
-#   ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE3
     sqlite3 *db;
-#   else                        /* HAVE_SQLITE3 */
+#else                           /* HAVE_SQLITE3 */
     sqlite *db;
-#   endif                       /* HAVE_SQLITE3 */
+#endif                          /* HAVE_SQLITE3 */
     const gchar *prefix;
     GList *res;
 };
 
 static int
-gpe_read_completion(void  *arg,
-                    int    argc,
-                    char **argv,
-                    char **names)
+gpe_read_completion(void *arg, int argc, char **argv, char **names)
 {
     struct gpe_completion_closure *gc = arg;
     LibBalsaAddress *address = libbalsa_address_new();
@@ -781,7 +738,7 @@ gpe_read_completion(void  *arg,
     GList *addr_list;
     GList *l;
     guint uid = atoi(argv[0]);
-#   ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE3
     gchar *sql;
 
     /* follow read_entry_data. FIXME: error reporting */
@@ -789,13 +746,13 @@ gpe_read_completion(void  *arg,
                           uid);
     sqlite3_exec(gc->db, sql, gpe_read_attr, address, NULL);
     sqlite3_free(sql);
-#   else                        /* HAVE_SQLITE3 */
+#else                           /* HAVE_SQLITE3 */
 
     /* follow read_entry_data. FIXME: error reporting */
     sqlite_exec_printf(gc->db,
                        "select tag,value from contacts where urn=%d",
                        gpe_read_attr, a, NULL, uid);
-#   endif                       /* HAVE_SQLITE3 */
+#endif                          /* HAVE_SQLITE3 */
 
     addr_list = libbalsa_address_get_addr_list(address);
     if (addr_list == NULL) {
@@ -810,8 +767,8 @@ gpe_read_completion(void  *arg,
         gchar *full_name;
 
         first_name = libbalsa_address_get_first_name(address);
-        last_name = libbalsa_address_get_last_name(address);
-        full_name = create_name(first_name, last_name);
+        last_name  = libbalsa_address_get_last_name(address);
+        full_name  = create_name(first_name, last_name);
         libbalsa_address_set_full_name(address, full_name);
         g_free(full_name);
     }
@@ -827,12 +784,11 @@ gpe_read_completion(void  *arg,
     return 0;
 }
 
-
 static GList *
-libbalsa_address_book_gpe_alias_complete(LibBalsaAddressBook *ab,
-                                         const gchar         *prefix)
+libbalsa_address_book_gpe_alias_complete(LibBalsaAddressBook * ab,
+                                         const gchar * prefix)
 {
-    static const char *query =
+    static const char *query = 
         "select distinct urn from contacts where "
         "(upper(tag)='FAMILY_NAME' or upper(tag)='GIVEN_NAME' or "
         "upper(tag)='NAME' or "
@@ -847,48 +803,42 @@ libbalsa_address_book_gpe_alias_complete(LibBalsaAddressBook *ab,
 
     ab_gpe = LIBBALSA_ADDRESS_BOOK_GPE(ab);
 
-    if (!libbalsa_address_book_get_expand_aliases(ab)) {
+    if (!libbalsa_address_book_get_expand_aliases(ab))
         return NULL;
-    }
     if (ab_gpe->db == NULL) {
-        if ( !libbalsa_address_book_gpe_open_db(ab_gpe)) {
-            return NULL;
-        }
+        if( !libbalsa_address_book_gpe_open_db(ab_gpe))
+           return NULL;
     }
 
     gcc.db = ab_gpe->db;
     gcc.prefix = prefix;
     gcc.res = NULL;
-#   ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE3
     if (prefix) {
         gchar *sql = sqlite3_mprintf(query, prefix);
         r = sqlite3_exec(ab_gpe->db, sql, gpe_read_completion, &gcc, &err);
         sqlite3_free(sql);
-    } else {
+    } else
         r = sqlite3_exec(ab_gpe->db,
                          "select distinct urn from contacts_urn",
                          gpe_read_completion, &gcc, &err);
-    }
-    if (err) {
+    if(err) {
         printf("r=%d err=%s\n", r, err);
         sqlite3_free(err);
     }
-#   else                        /* HAVE_SQLITE3 */
-    if (prefix) {
+#else                           /* HAVE_SQLITE3 */
+    if(prefix)
         r = sqlite_exec_printf(ab_gpe->db, query,
                                gpe_read_completion, &gcc, &err,
                                prefix);
-    } else {
+    else
         r = sqlite_exec(ab_gpe->db, "select distinct urn from contacts_urn",
                         gpe_read_completion, &gcc, &err);
-    }
-    if (err) {
+    if(err) {
         printf("r=%d err=%s\n", r, err);
         free(err);
     }
-#   endif                       /* HAVE_SQLITE3 */
+#endif                          /* HAVE_SQLITE3 */
     return gcc.res;
 }
-
-
-#endif                          /* WITH_SQLITE */
+#endif                         /* WITH_SQLITE */
diff --git a/libbalsa/address-book-gpe.h b/libbalsa/address-book-gpe.h
index fe556cd..27a63d5 100644
--- a/libbalsa/address-book-gpe.h
+++ b/libbalsa/address-book-gpe.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -26,24 +26,24 @@
 #define __LIBBALSA_ADDRESS_BOOK_GPE_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #ifdef HAVE_SQLITE
 
-#   ifdef HAVE_SQLITE3
-#      include <sqlite3.h>
-#   else                        /* HAVE_SQLITE3 */
-#      include <sqlite.h>
-#   endif                       /* HAVE_SQLITE3 */
+#ifdef HAVE_SQLITE3
+#include <sqlite3.h>
+#else                           /* HAVE_SQLITE3 */
+#include <sqlite.h>
+#endif                          /* HAVE_SQLITE3 */
 
-#   include "address-book.h"
+#include "address-book.h"
 
-#   define LIBBALSA_TYPE_ADDRESS_BOOK_GPE (libbalsa_address_book_gpe_get_type())
+#define LIBBALSA_TYPE_ADDRESS_BOOK_GPE (libbalsa_address_book_gpe_get_type())
 G_DECLARE_FINAL_TYPE(LibBalsaAddressBookGpe, libbalsa_address_book_gpe,
-                     LIBBALSA, ADDRESS_BOOK_GPE, LibBalsaAddressBook)
+        LIBBALSA, ADDRESS_BOOK_GPE, LibBalsaAddressBook)
 
-LibBalsaAddressBook * libbalsa_address_book_gpe_new(const gchar * name);
+LibBalsaAddressBook *libbalsa_address_book_gpe_new(const gchar *name);
 
 #endif /* HAVE_SQLITE */
-#endif                          /* __LIBBALSA_ADDRESS_BOOK_GPE_H__ */
+#endif                         /* __LIBBALSA_ADDRESS_BOOK_GPE_H__ */
diff --git a/libbalsa/address-book-ldap.c b/libbalsa/address-book-ldap.c
index e905cd6..7e13715 100644
--- a/libbalsa/address-book-ldap.c
+++ b/libbalsa/address-book-ldap.c
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -23,8 +23,7 @@
  * NOTES:
  * a) ldap caching deleted since it is deprecated in openldap-2.1.x series.
  * b) In principle, only inetOrgPerson class may have mail attributes, see
- * eg:
- * http://www.andrew.cmu.edu/user/dd26/ldap.akbkhome.com/objectclass/organizationalPerson.html
+ * eg: http://www.andrew.cmu.edu/user/dd26/ldap.akbkhome.com/objectclass/organizationalPerson.html
  *
  * However, ActiveDirectory apparently gets it wrong (or its
  * administrators, may be?) and all the objects are of
@@ -32,35 +31,35 @@
  *
  */
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #if ENABLE_LDAP
 
-#   include "address-book-ldap.h"
+#include "address-book-ldap.h"
 
-#   include <glib.h>
-#   include <sys/time.h>
-#   include <string.h>
-#   include <lber.h>
-#   include <ldap.h>
+#include <glib.h>
+#include <sys/time.h>
+#include <string.h>
+#include <lber.h>
+#include <ldap.h>
 
-#   ifdef HAVE_CYRUS_SASL
-#      include <sasl.h>
-#   endif
+#ifdef HAVE_CYRUS_SASL
+#include <sasl.h>
+#endif
 
-#   include "address-book.h"
-#   include "information.h"
-#   include "libbalsa-conf.h"
-#   include <glib/gi18n.h>
+#include "address-book.h"
+#include "information.h"
+#include "libbalsa-conf.h"
+#include <glib/gi18n.h>
 
 static const int DEBUG_LDAP = 0;
 /* don't search when prefix has length shorter than LDAP_MIN_LEN */
-static const unsigned ABL_MIN_LEN = 2;
+static const unsigned ABL_MIN_LEN=2;
 static const int ABL_SIZE_LIMIT = 5000;       /* full list   */
 static const int ABL_SIZE_LIMIT_LOOKUP = 50; /* quick lookup */
 /* Which parameters do we want back? */
-static char *book_attrs[] = {
+static char* book_attrs[] = {
     "cn",        /* maps to displayed name */
     "mail",      /* maps to itself         */
     "sn",        /* maps to last name      */
@@ -70,7 +69,7 @@ static char *book_attrs[] = {
     NULL
 };
 
-static char *complete_attrs[] = {
+static char* complete_attrs[] = {
     "cn",        /* maps to displayed name */
     "mail",      /* maps to itself         */
     "sn",        /* maps to last name      */
@@ -79,39 +78,44 @@ static char *complete_attrs[] = {
 };
 /* End of FIXME */
 
-static void libbalsa_address_book_ldap_class_init(LibBalsaAddressBookLdapClass *klass);
-static void libbalsa_address_book_ldap_init(LibBalsaAddressBookLdap *ab);
-static void libbalsa_address_book_ldap_finalize(GObject *object);
+static void
+libbalsa_address_book_ldap_class_init(LibBalsaAddressBookLdapClass * klass);
+static void libbalsa_address_book_ldap_init(LibBalsaAddressBookLdap * ab);
+static void libbalsa_address_book_ldap_finalize(GObject * object);
 
-static LibBalsaABErr libbalsa_address_book_ldap_load(LibBalsaAddressBook        *ab,
-                                                     const gchar                *filter,
-                                                     LibBalsaAddressBookLoadFunc callback,
-                                                     gpointer                    closure);
+static LibBalsaABErr libbalsa_address_book_ldap_load(LibBalsaAddressBook * ab, 
+                                                     const gchar *filter,
+                                                     LibBalsaAddressBookLoadFunc callback, 
+                                                     gpointer closure);
 
-static LibBalsaABErr libbalsa_address_book_ldap_add_address(LibBalsaAddressBook *ab,
-                                                            LibBalsaAddress     *address);
-static LibBalsaABErr libbalsa_address_book_ldap_remove_address(LibBalsaAddressBook *ab,
-                                                               LibBalsaAddress     *address);
-static LibBalsaABErr libbalsa_address_book_ldap_modify_address(LibBalsaAddressBook *ab,
-                                                               LibBalsaAddress     *address,
-                                                               LibBalsaAddress     *newval);
+static LibBalsaABErr
+libbalsa_address_book_ldap_add_address(LibBalsaAddressBook *ab,
+                                       LibBalsaAddress *address);
+static LibBalsaABErr
+libbalsa_address_book_ldap_remove_address(LibBalsaAddressBook *ab,
+                                          LibBalsaAddress *address);
+static LibBalsaABErr
+libbalsa_address_book_ldap_modify_address(LibBalsaAddressBook *ab,
+                                          LibBalsaAddress *address,
+                                          LibBalsaAddress *newval);
 
-static gboolean libbalsa_address_book_ldap_open_connection(LibBalsaAddressBookLdap *ab);
+static gboolean
+libbalsa_address_book_ldap_open_connection(LibBalsaAddressBookLdap * ab);
 
 static void libbalsa_address_book_ldap_save_config(LibBalsaAddressBook *ab,
-                                                   const gchar         *prefix);
+                                                  const gchar * prefix);
 static void libbalsa_address_book_ldap_load_config(LibBalsaAddressBook *ab,
-                                                   const gchar         *prefix);
+                                                  const gchar * prefix);
 
-static GList *libbalsa_address_book_ldap_alias_complete(LibBalsaAddressBook *ab,
-                                                        const gchar         *prefix);
+static GList *libbalsa_address_book_ldap_alias_complete(LibBalsaAddressBook * ab,
+                                                        const gchar * prefix);
 
-static LibBalsaAddress *libbalsa_address_book_ldap_get_address(LibBalsaAddressBook *ab,
-                                                               LDAPMessage         *e);
+static LibBalsaAddress*
+libbalsa_address_book_ldap_get_address(LibBalsaAddressBook * ab,
+                                       LDAPMessage * e);
 
 
-static gchar *create_name(gchar *,
-                          gchar *);
+static gchar *create_name(gchar *, gchar *);
 
 struct _LibBalsaAddressBookLdap {
     LibBalsaAddressBook parent;
@@ -131,10 +135,10 @@ struct _LibBalsaAddressBookLdapClass {
 };
 
 G_DEFINE_TYPE(LibBalsaAddressBookLdap, libbalsa_address_book_ldap,
-              LIBBALSA_TYPE_ADDRESS_BOOK)
+        LIBBALSA_TYPE_ADDRESS_BOOK)
 
 static void
-libbalsa_address_book_ldap_class_init(LibBalsaAddressBookLdapClass *klass)
+libbalsa_address_book_ldap_class_init(LibBalsaAddressBookLdapClass * klass)
 {
     LibBalsaAddressBookClass *address_book_class;
     GObjectClass *object_class;
@@ -146,37 +150,35 @@ libbalsa_address_book_ldap_class_init(LibBalsaAddressBookLdapClass *klass)
 
     address_book_class->load = libbalsa_address_book_ldap_load;
     address_book_class->add_address = libbalsa_address_book_ldap_add_address;
-    address_book_class->remove_address =
+    address_book_class->remove_address = 
         libbalsa_address_book_ldap_remove_address;
     address_book_class->modify_address =
         libbalsa_address_book_ldap_modify_address;
 
     address_book_class->save_config =
-        libbalsa_address_book_ldap_save_config;
+       libbalsa_address_book_ldap_save_config;
     address_book_class->load_config =
-        libbalsa_address_book_ldap_load_config;
+       libbalsa_address_book_ldap_load_config;
 
-    address_book_class->alias_complete =
-        libbalsa_address_book_ldap_alias_complete;
+    address_book_class->alias_complete = 
+       libbalsa_address_book_ldap_alias_complete;
 }
 
-
 static void
-libbalsa_address_book_ldap_init(LibBalsaAddressBookLdap *ab)
+libbalsa_address_book_ldap_init(LibBalsaAddressBookLdap * ab)
 {
     ab->host = NULL;
     ab->base_dn = NULL;
     ab->bind_dn = NULL;
     ab->priv_book_dn = NULL;
-    ab->passwd = NULL;
+    ab->passwd  = NULL;
     ab->enable_tls = FALSE;
     ab->directory = NULL;
     libbalsa_address_book_set_is_expensive(LIBBALSA_ADDRESS_BOOK(ab), TRUE);
 }
 
-
 static void
-libbalsa_address_book_ldap_finalize(GObject *object)
+libbalsa_address_book_ldap_finalize(GObject * object)
 {
     LibBalsaAddressBookLdap *addr_ldap;
 
@@ -193,23 +195,19 @@ libbalsa_address_book_ldap_finalize(GObject *object)
     G_OBJECT_CLASS(libbalsa_address_book_ldap_parent_class)->finalize(object);
 }
 
-
 LibBalsaAddressBook *
-libbalsa_address_book_ldap_new(const gchar *name,
-                               const gchar *host,
-                               const gchar *base_dn,
-                               const gchar *bind_dn,
-                               const gchar *passwd,
-                               const gchar *priv_book_dn,
-                               gboolean     enable_tls)
+libbalsa_address_book_ldap_new(const gchar *name, const gchar *host,
+                               const gchar *base_dn, const gchar *bind_dn,
+                               const gchar *passwd, const gchar *priv_book_dn,
+                               gboolean enable_tls)
 {
     LibBalsaAddressBookLdap *ab_ldap;
     LibBalsaAddressBook *ab;
 
     ab_ldap =
         LIBBALSA_ADDRESS_BOOK_LDAP(g_object_new
-                                       (LIBBALSA_TYPE_ADDRESS_BOOK_LDAP,
-                                       NULL));
+                                   (LIBBALSA_TYPE_ADDRESS_BOOK_LDAP,
+                                    NULL));
     ab = LIBBALSA_ADDRESS_BOOK(ab_ldap);
 
     libbalsa_address_book_set_name(ab, name);
@@ -226,79 +224,65 @@ libbalsa_address_book_ldap_new(const gchar *name,
     return ab;
 }
 
-
 /*
  * Close the ldap connection....
  */
 void
-libbalsa_address_book_ldap_close_connection(LibBalsaAddressBookLdap *ab_ldap)
+libbalsa_address_book_ldap_close_connection(LibBalsaAddressBookLdap * ab_ldap)
 {
     if (ab_ldap->directory) {
-        ldap_unbind_ext(ab_ldap->directory, NULL, NULL);
-        ab_ldap->directory = NULL;
+       ldap_unbind_ext(ab_ldap->directory, NULL, NULL);
+       ab_ldap->directory = NULL;
     }
 }
 
-
 /*
  * Opens the ldap connection, and binds to the server.
  * returns ldap status.
  */
-#   ifdef HAVE_CYRUS_SASL
+#ifdef HAVE_CYRUS_SASL
 static int
-abl_interaction(unsigned                 flags,
-                sasl_interact_t         *interact,
+abl_interaction(unsigned flags, sasl_interact_t *interact,
                 LibBalsaAddressBookLdap *ab_ldap)
 {
-    switch (interact->id) {
+    switch(interact->id) {
     case SASL_CB_PASS: break;
-
     case SASL_CB_GETREALM:
     case SASL_CB_AUTHNAME:
-    case SASL_CB_USER:
+    case SASL_CB_USER:   
     case SASL_CB_NOECHOPROMPT:
-    case SASL_CB_ECHOPROMPT:
+    case SASL_CB_ECHOPROMPT:  
         printf("unhandled SASL request %d.\n", interact->id);
         return LDAP_INAVAILABLE;
     }
 
-    interact->result = ab_ldap->passwd;
+    interact->result = ab_ldap->passwd;;
     interact->len = interact->result ? strlen(interact->result) : 0;
     return LDAP_SUCCESS;
 }
 
 
-int
-abl_interact(LDAP    *ld,
-             unsigned flags,
-             void    *defaults,
-             void    *interact )
+int abl_interact(LDAP *ld, unsigned flags, void* defaults, void *interact )
 {
-    if ( ld == NULL ) {
-        return LDAP_PARAM_ERROR;
-    }
+    if( ld == NULL ) return LDAP_PARAM_ERROR;
 
     if (flags == LDAP_SASL_INTERACTIVE) {
         fputs( _("SASL Interaction\n"), stderr );
     }
 
-    while ( interact->id != SASL_CB_LIST_END ) {
+    while( interact->id != SASL_CB_LIST_END ) {
         int rc = lbabl_interaction(flags, interact, defaults);
 
-        if ( rc ) {
-            return rc;
-        }
+        if( rc )  return rc;
         interact++;
     }
 
     return LDAP_SUCCESS;
 }
-
-
-#   endif
+#endif
 
 static int
-libbalsa_address_book_ldap_open_connection(LibBalsaAddressBookLdap *ab_ldap)
+libbalsa_address_book_ldap_open_connection(LibBalsaAddressBookLdap * ab_ldap)
 {
     int result;
     static const int version = LDAP_VERSION3;
@@ -310,56 +294,52 @@ libbalsa_address_book_ldap_open_connection(LibBalsaAddressBookLdap *ab_ldap)
     ldap_initialize(&ab_ldap->directory, ab_ldap->host);
     if (ab_ldap->directory == NULL) { /* very unlikely... */
         libbalsa_address_book_set_status(ab, "Host not found");
-        return LDAP_SERVER_DOWN;
+       return LDAP_SERVER_DOWN;
     }
     /* ignore error if the V3 LDAP cannot be set */
     v3_enabled =
         ldap_set_option(ab_ldap->directory, LDAP_OPT_PROTOCOL_VERSION, &version)
-        == LDAP_OPT_SUCCESS;
-    if (!v3_enabled) {
-        printf("Too old LDAP server - interaction may fail.\n");
-    }
-    if (v3_enabled && ab_ldap->enable_tls) {
-#   ifdef HAVE_LDAP_TLS
+       == LDAP_OPT_SUCCESS;
+    if(!v3_enabled) printf("Too old LDAP server - interaction may fail.\n");
+    if(v3_enabled && ab_ldap->enable_tls) {
+#ifdef HAVE_LDAP_TLS
         /* turn TLS on  but what if we have SSL already on? */
         result = ldap_start_tls_s(ab_ldap->directory, NULL, NULL);
-        if (result != LDAP_SUCCESS) {
+        if(result != LDAP_SUCCESS) {
             ldap_unbind_ext(ab_ldap->directory, NULL, NULL);
             ab_ldap->directory = NULL;
             libbalsa_address_book_set_status(ab, ldap_err2string(result));
             return result;
         }
-#   else /* HAVE_LDAP_TLS */
-        libbalsa_address_book_set_status(ab, _("TLS requested but not compiled in"));
-        return LDAP_INAPPRIOPRIATE_AUTH;
-
-#   endif /* HAVE_LDAP_TLS */
+#else /* HAVE_LDAP_TLS */
+     libbalsa_address_book_set_status(ab, _("TLS requested but not compiled in"));
+     return LDAP_INAPPRIOPRIATE_AUTH;
+#endif /* HAVE_LDAP_TLS */
     }
 
-#   ifdef HAVE_CYRUS_SASL
+#ifdef HAVE_CYRUS_SASL
     result = ldap_sasl_interactive_bind_s(ab_ldap->directory, ab_ldap->bind_dn, NULL,
                                           NULL, NULL,
                                           LDAP_SASL_QUIET, abl_interact, ab_ldap);
-#   else /* HAVE_CYRUS_SASL */
+#else /* HAVE_CYRUS_SASL */
     {
-        struct berval cred;
-        cred.bv_val = ab_ldap->passwd;
-        cred.bv_len = ab_ldap->passwd ? strlen(ab_ldap->passwd) : 0;
-        result = ldap_sasl_bind_s(ab_ldap->directory, ab_ldap->bind_dn, NULL, &cred,
-                                  NULL, NULL, NULL);
+     struct berval   cred;
+     cred.bv_val = ab_ldap->passwd;
+     cred.bv_len = ab_ldap->passwd ? strlen(ab_ldap->passwd) : 0;
+     result = ldap_sasl_bind_s(ab_ldap->directory, ab_ldap->bind_dn, NULL, &cred,
+                              NULL, NULL, NULL);
     }
-#   endif /* HAVE_CYRUS_SASL */
+#endif /* HAVE_CYRUS_SASL */
 
     /* do not follow referrals (OpenLDAP binds anonymously here, which will usually
      * fail */
-    if (result == LDAP_SUCCESS) {
-        result = ldap_set_option(ab_ldap->directory, LDAP_OPT_REFERRALS, (void *)LDAP_OPT_OFF);
-    }
+    if (result == LDAP_SUCCESS)
+       result = ldap_set_option(ab_ldap->directory, LDAP_OPT_REFERRALS, (void *)LDAP_OPT_OFF);
 
     if (result != LDAP_SUCCESS) {
         libbalsa_address_book_set_status(ab, ldap_err2string(result));
-        ldap_unbind_ext(ab_ldap->directory, NULL, NULL);
-        ab_ldap->directory = NULL;
+       ldap_unbind_ext(ab_ldap->directory, NULL, NULL);
+       ab_ldap->directory = NULL;
     }
     return result;
 }
@@ -370,10 +350,10 @@ libbalsa_address_book_ldap_open_connection(LibBalsaAddressBookLdap *ab_ldap)
  * opens the connection only if needed.
  */
 static LibBalsaABErr
-libbalsa_address_book_ldap_load(LibBalsaAddressBook        *ab,
-                                const gchar                *filter,
+libbalsa_address_book_ldap_load(LibBalsaAddressBook * ab,
+                                const gchar *filter,
                                 LibBalsaAddressBookLoadFunc callback,
-                                gpointer                    closure)
+                                gpointer closure)
 {
     LibBalsaAddressBookLdap *ab_ldap;
     LibBalsaAddress *address;
@@ -383,63 +363,59 @@ libbalsa_address_book_ldap_load(LibBalsaAddressBook        *ab,
 
     g_return_val_if_fail ( LIBBALSA_IS_ADDRESS_BOOK_LDAP(ab), LBABERR_OK);
 
-    if (callback == NULL) {
-        return LBABERR_OK;
-    }
+    if (callback == NULL)
+       return LBABERR_OK;
 
     ab_ldap = LIBBALSA_ADDRESS_BOOK_LDAP(ab);
     /*
      * Connect to the server.
      */
-    for (attempt = 0; attempt < 2; attempt++) {
+    for(attempt=0; attempt<2; attempt++) {
         if (ab_ldap->directory == NULL) {
-            if ((rc = libbalsa_address_book_ldap_open_connection(ab_ldap))
-                != LDAP_SUCCESS) {
+            if ((rc=libbalsa_address_book_ldap_open_connection(ab_ldap))
+                != LDAP_SUCCESS)
                 return LBABERR_CANNOT_CONNECT;
-            }
         }
-
-        /*
-         * Attempt to search for e-mail addresses. It returns success
-         * or failure, but not all the matches.
+        
+        /* 
+         * Attempt to search for e-mail addresses. It returns success 
+         * or failure, but not all the matches. 
          * we use the asynchronous lookup to fetch the results in chunks
          * in case we exceed administrative limits.
-         */
+         */ 
         /* g_print("Performing full lookup…\n"); */
-        ldap_filter = filter
+        ldap_filter = filter 
             ? g_strdup_printf("(&(objectClass=organizationalPerson)(mail=*)"
                               "(|(cn=%s*)(sn=%s*)(mail=%s*@*)))",
                               filter, filter, filter)
             : g_strdup("(&(objectClass=organizationalPerson)(mail=*))");
-        if (DEBUG_LDAP) {
-            g_print("Send LDAP request: %s (basedn=%s)\n", ldap_filter,
-                    ab_ldap->base_dn);
-        }
-        if (ldap_search_ext(ab_ldap->directory, ab_ldap->base_dn,
-                            LDAP_SCOPE_SUBTREE,
-                            ldap_filter, book_attrs, 0, NULL, NULL,
-                            NULL, ABL_SIZE_LIMIT, &msgid) != LDAP_SUCCESS) {
+       if(DEBUG_LDAP)
+           g_print("Send LDAP request: %s (basedn=%s)\n", ldap_filter,
+                   ab_ldap->base_dn);
+        if(ldap_search_ext(ab_ldap->directory, ab_ldap->base_dn,
+                           LDAP_SCOPE_SUBTREE, 
+                           ldap_filter, book_attrs, 0, NULL, NULL,
+                           NULL, ABL_SIZE_LIMIT, &msgid) != LDAP_SUCCESS) {
             libbalsa_address_book_ldap_close_connection(ab_ldap);
             continue; /* try again */
         }
-        /*
+        /* 
          * Now loop over all the results, and spit out the output.
          */
-
-        while ((rc = ldap_result(ab_ldap->directory, msgid,
-                                 LDAP_MSG_ONE, NULL, &result)) > 0) {
+        
+        while((rc=ldap_result(ab_ldap->directory, msgid, 
+                              LDAP_MSG_ONE, NULL, &result))>0) {
             msg = ldap_first_entry(ab_ldap->directory, result);
-            if (!msg || (ldap_msgtype( msg ) == LDAP_RES_SEARCH_RESULT)) {
+            if (!msg || ldap_msgtype( msg ) == LDAP_RES_SEARCH_RESULT)
                 break;
-            }
             address = libbalsa_address_book_ldap_get_address(ab, msg);
             callback(ab, address, closure);
             g_object_unref(address);
         }
-        if (rc == -1) { /* try again */
+        if(rc == -1) { /* try again */
             libbalsa_address_book_ldap_close_connection(ab_ldap);
             continue;
-        }
+       }
         callback(ab, NULL, closure);
         ldap_msgfree(result);
         libbalsa_address_book_set_status(ab, NULL);
@@ -454,9 +430,9 @@ libbalsa_address_book_ldap_load(LibBalsaAddressBook        *ab,
 /* libbalsa_address_book_ldap_get_address:
  * loads a single address from connection specified by LDAPMessage.
  */
-static LibBalsaAddress *
-libbalsa_address_book_ldap_get_address(LibBalsaAddressBook *ab,
-                                       LDAPMessage         *e)
+static LibBalsaAddress* 
+libbalsa_address_book_ldap_get_address(LibBalsaAddressBook * ab,
+                                      LDAPMessage * e)
 {
     LibBalsaAddressBookLdap *ab_ldap;
     gchar *email = NULL, *cn = NULL, *org = NULL, *uid = NULL;
@@ -470,48 +446,40 @@ libbalsa_address_book_ldap_get_address(LibBalsaAddressBook *ab,
     ab_ldap = LIBBALSA_ADDRESS_BOOK_LDAP(ab);
 
     for (attr = ldap_first_attribute(ab_ldap->directory, e, &ber);
-         attr != NULL; attr = ldap_next_attribute(ab_ldap->directory, e, ber)) {
-        /*
-         * For each attribute, get the attribute name and values.
-         */
-        if ((vals = ldap_get_values_len(ab_ldap->directory, e, attr)) != NULL) {
-            for (i = 0; vals[i] != NULL; i++) {
-                if (g_ascii_strcasecmp(attr, "sn") == 0) {
-                    if (last == NULL) {
+        attr != NULL; attr=ldap_next_attribute(ab_ldap->directory, e, ber)) {
+       /*
+        * For each attribute, get the attribute name and values.
+        */
+       if ((vals=ldap_get_values_len(ab_ldap->directory, e, attr)) != NULL) {
+           for (i = 0; vals[i] != NULL; i++) {
+               if (g_ascii_strcasecmp(attr, "sn") == 0) {
+                    if (last == NULL)
                         last = g_strndup(vals[i]->bv_val, vals[i]->bv_len);
-                    }
                 } else if (g_ascii_strcasecmp(attr, "cn") == 0) {
-                    if (cn == NULL) {
+                    if (cn == NULL)
                         cn = g_strndup(vals[i]->bv_val, vals[i]->bv_len);
-                    }
                 } else if (g_ascii_strcasecmp(attr, "givenName") == 0) {
-                    if (first == NULL) {
+                    if (first == NULL)
                         first = g_strndup(vals[i]->bv_val, vals[i]->bv_len);
-                    }
                 } else if (g_ascii_strcasecmp(attr, "o") == 0) {
-                    if (org == NULL) {
+                    if (org == NULL)
                         org = g_strndup(vals[i]->bv_val, vals[i]->bv_len);
-                    }
                 } else if (g_ascii_strcasecmp(attr, "uid") == 0) {
-                    if (uid == NULL) {
+                    if (uid == NULL)
                         uid = g_strndup(vals[i]->bv_val, vals[i]->bv_len);
-                    }
                 } else if (g_ascii_strcasecmp(attr, "mail") == 0) {
-                    if (email == NULL) {
+                    if (email == NULL)
                         email = g_strndup(vals[i]->bv_val, vals[i]->bv_len);
-                    }
                 }
-            }
-            ldap_value_free_len(vals);
-        }
+           }
+           ldap_value_free_len(vals);
+       }
         ldap_memfree(attr);
     }
     /*
      * Record will have e-mail (searched)
      */
-    if (email == NULL) {
-        email = g_strdup("none");
-    }
+    if(email == NULL) email = g_strdup("none");
 
     address = libbalsa_address_new();
     if (cn != NULL) {
@@ -543,10 +511,8 @@ libbalsa_address_book_ldap_get_address(LibBalsaAddressBook *ab,
     return address;
 }
 
-
-static InternetAddress *
-lbabl_get_internet_address(LDAP        *dir,
-                           LDAPMessage *e)
+static InternetAddress*
+lbabl_get_internet_address(LDAP *dir, LDAPMessage * e)
 {
     InternetAddress *ia;
     BerElement *ber = NULL;
@@ -556,108 +522,81 @@ lbabl_get_internet_address(LDAP        *dir,
     gchar *email = NULL, *sn = NULL, *cn = NULL, *first = NULL;
 
     for (attr = ldap_first_attribute(dir, e, &ber);
-         attr != NULL;
+        attr != NULL; 
          attr = ldap_next_attribute(dir, e, ber)) {
-        /*
-         * For each attribute, get the attribute name and values.
-         */
-        if ((vals = ldap_get_values_len(dir, e, attr)) != NULL) {
-            for (i = 0; vals[i] != NULL; i++) {
-                if ((g_ascii_strcasecmp(attr, "sn") == 0) && (!sn)) {
-                    sn = g_strndup(vals[i]->bv_val, vals[i]->bv_len);
-                }
-                if ((g_ascii_strcasecmp(attr, "cn") == 0) && (!cn)) {
-                    cn = g_strndup(vals[i]->bv_val, vals[i]->bv_len);
-                }
-                if ((g_ascii_strcasecmp(attr, "givenName") == 0) && (!first)) {
-                    first = g_strndup(vals[i]->bv_val, vals[i]->bv_len);
-                }
-                if ((g_ascii_strcasecmp(attr, "mail") == 0) && (!email)) {
-                    email = g_strndup(vals[i]->bv_val, vals[i]->bv_len);
-                }
-            }
-            ldap_value_free_len(vals);
-        }
+       /*
+        * For each attribute, get the attribute name and values.
+        */
+       if ((vals = ldap_get_values_len(dir, e, attr)) != NULL) {
+           for (i = 0; vals[i] != NULL; i++) {
+               if ((g_ascii_strcasecmp(attr, "sn") == 0) && (!sn))
+                   sn = g_strndup(vals[i]->bv_val, vals[i]->bv_len);
+               if ((g_ascii_strcasecmp(attr, "cn") == 0) && (!cn))
+                   cn = g_strndup(vals[i]->bv_val, vals[i]->bv_len);
+               if ((g_ascii_strcasecmp(attr, "givenName") == 0) && (!first))
+                   first = g_strndup(vals[i]->bv_val, vals[i]->bv_len);
+               if ((g_ascii_strcasecmp(attr, "mail") == 0) && (!email))
+                   email = g_strndup(vals[i]->bv_val, vals[i]->bv_len);
+           }
+           ldap_value_free_len(vals);
+       }
         ldap_memfree(attr);
     }
     /*
      * Record will have e-mail (searched)
      */
-    if (email == NULL) {
-        email = g_strdup("none");
-    }
+    if(email == NULL) email = g_strdup("none");
     g_return_val_if_fail(email != NULL, NULL);
 
-    if (!cn) {
+    if(!cn)
         cn = create_name(first, sn);
-    }
     ia = internet_address_mailbox_new(cn, email);
-    g_free(email);
-    g_free(sn);
-    g_free(cn);
-    g_free(first);
+    g_free(email); g_free(sn); g_free(cn); g_free(first);
 
     return ia;
 }
-
-
 /*
  * create_name()
  *
  * Creates a full name from a given first name and surname.
- *
+ * 
  * Returns:
  *   gchar * a full name
  *   NULL on failure (both first and last names invalid.
  */
 static gchar *
-create_name(gchar *first,
-            gchar *last)
+create_name(gchar * first, gchar * last)
 {
-    if ((first == NULL) && (last == NULL)) {
-        return NULL;
-    } else if (first == NULL) {
-        return g_strdup(last);
-    } else if (last == NULL) {
-        return g_strdup(first);
-    } else {
-        return g_strdup_printf("%s %s", first, last);
-    }
+    if ((first == NULL) && (last == NULL))
+       return NULL;
+    else if (first == NULL)
+       return g_strdup(last);
+    else if (last == NULL)
+       return g_strdup(first);
+    else
+       return g_strdup_printf("%s %s", first, last);
 }
 
-
-#   define SETMOD(mods, modarr, op, attr, strv, val) \
-    do { (mods) = &(modarr); (modarr).mod_type = attr; (modarr).mod_op = op; \
-         (strv)[0] = (char *)(val); (modarr).mod_values = strv; \
-    } while (0)
+#define SETMOD(mods,modarr,op,attr,strv,val) \
+   do { (mods) = &(modarr); (modarr).mod_type=attr; (modarr).mod_op=op;\
+        (strv)[0]=(char*)(val); (modarr).mod_values=strv; \
+      } while(0)
 
 static LibBalsaABErr
 libbalsa_address_book_ldap_add_address(LibBalsaAddressBook *ab,
-                                       LibBalsaAddress     *address)
+                                       LibBalsaAddress *address)
 {
     static char *object_class_values[] =
-    {
-        "person", "organizationalPerson", "inetOrgPerson", NULL
-    };
+        { "person", "organizationalPerson", "inetOrgPerson", NULL };
     gchar *dn;
     LDAPMod *mods[7];
     LDAPMod modarr[6];
     int cnt;
-    char *cn[] = {
-        NULL, NULL
-    };
-    char *gn[] = {
-        NULL, NULL
-    };
-    char *org[] = {
-        NULL, NULL
-    };
-    char *sn[] = {
-        NULL, NULL
-    };
-    char *mail[] = {
-        NULL, NULL
-    };
+    char *cn[]   = {NULL, NULL};
+    char *gn[]   = {NULL, NULL};
+    char *org[]  = {NULL, NULL};
+    char *sn[]   = {NULL, NULL};
+    char *mail[] = {NULL, NULL};
     LibBalsaAddressBookLdap *ab_ldap = LIBBALSA_ADDRESS_BOOK_LDAP(ab);
     const gchar *addr;
     const gchar *item;
@@ -667,12 +606,11 @@ libbalsa_address_book_ldap_add_address(LibBalsaAddressBook *ab,
     g_return_val_if_fail(addr != NULL, LBABERR_CANNOT_WRITE);
 
     if (ab_ldap->directory == NULL) {
-        if (libbalsa_address_book_ldap_open_connection(ab_ldap) != LDAP_SUCCESS) {
-            return LBABERR_CANNOT_CONNECT;
-        }
+        if(libbalsa_address_book_ldap_open_connection(ab_ldap) != LDAP_SUCCESS)
+           return LBABERR_CANNOT_CONNECT;
     }
 
-    if (ab_ldap->priv_book_dn == NULL) {
+    if(ab_ldap->priv_book_dn == NULL) {
         libbalsa_address_book_set_status
             (ab, _("Undefined location of user address book"));
         return LBABERR_CANNOT_WRITE;
@@ -689,29 +627,29 @@ libbalsa_address_book_ldap_add_address(LibBalsaAddressBook *ab,
 
     item = libbalsa_address_get_full_name(address);
     if (item != NULL) {
-        SETMOD(mods[cnt], modarr[cnt], LDAP_MOD_ADD, "cn", cn, item);
+        SETMOD(mods[cnt],modarr[cnt],LDAP_MOD_ADD,"cn",cn,item);
         cnt++;
     }
 
     item = libbalsa_address_get_first_name(address);
     if (item != NULL) {
-        SETMOD(mods[cnt], modarr[cnt], LDAP_MOD_ADD, "givenName", gn, item);
+        SETMOD(mods[cnt],modarr[cnt],LDAP_MOD_ADD,"givenName",gn, item);
         cnt++;
     }
 
     item = libbalsa_address_get_last_name(address);
     if (item != NULL) {
-        SETMOD(mods[cnt], modarr[cnt], LDAP_MOD_ADD, "sn", sn, item);
+        SETMOD(mods[cnt],modarr[cnt],LDAP_MOD_ADD,"sn",sn,item);
         cnt++;
     }
 
     item = libbalsa_address_get_organization(address);
     if (item != NULL) {
-        SETMOD(mods[cnt], modarr[cnt], LDAP_MOD_ADD, "o", org, item);
+        SETMOD(mods[cnt],modarr[cnt],LDAP_MOD_ADD,"o",org, item);
         cnt++;
     }
 
-    SETMOD(mods[cnt], modarr[cnt], LDAP_MOD_ADD, "mail", mail, addr);
+    SETMOD(mods[cnt],modarr[cnt],LDAP_MOD_ADD,"mail",mail, addr);
     cnt++;
 
     mods[cnt] = NULL;
@@ -719,38 +657,33 @@ libbalsa_address_book_ldap_add_address(LibBalsaAddressBook *ab,
     cnt = 0;
     do {
         int rc = ldap_add_ext_s(ab_ldap->directory, dn, mods, NULL, NULL);
-        switch (rc) {
-        case LDAP_SUCCESS: g_free(dn);
-            return LBABERR_OK;
-
+        switch(rc) {
+        case LDAP_SUCCESS: g_free(dn); return LBABERR_OK;
         case LDAP_ALREADY_EXISTS:
-            g_free(dn);
-            libbalsa_address_book_set_status(ab, ldap_err2string(rc));
-            return LBABERR_DUPLICATE;
-
+           g_free(dn);
+           libbalsa_address_book_set_status(ab, ldap_err2string(rc));
+           return LBABERR_DUPLICATE;
         case LDAP_SERVER_DOWN:
             libbalsa_address_book_ldap_close_connection(ab_ldap);
-            if ((rc = libbalsa_address_book_ldap_open_connection(ab_ldap))
-                != LDAP_SUCCESS) {
-                g_free(dn);
-                return LBABERR_CANNOT_CONNECT;
-            }
-
+        if( (rc=libbalsa_address_book_ldap_open_connection(ab_ldap))
+           != LDAP_SUCCESS) {
+           g_free(dn);
+           return LBABERR_CANNOT_CONNECT;
+       }
         /* fall through */
         default:
             fprintf(stderr, "ldap_add for dn=“%s” failed[0x%x]: %s\n",
                     dn, rc, ldap_err2string(rc));
         }
-    } while (cnt++ < 1);
+    } while(cnt++<1);
     g_free(dn);
     libbalsa_address_book_set_status(ab, NULL);
     return LBABERR_CANNOT_WRITE;
 }
 
-
 static LibBalsaABErr
 libbalsa_address_book_ldap_remove_address(LibBalsaAddressBook *ab,
-                                          LibBalsaAddress     *address)
+                                          LibBalsaAddress *address)
 {
     LibBalsaAddressBookLdap *ab_ldap = LIBBALSA_ADDRESS_BOOK_LDAP(ab);
     const gchar *addr;
@@ -762,10 +695,9 @@ libbalsa_address_book_ldap_remove_address(LibBalsaAddressBook *ab,
     g_return_val_if_fail(addr != NULL, LBABERR_CANNOT_WRITE);
 
     if (ab_ldap->directory == NULL) {
-        if ((rc = libbalsa_address_book_ldap_open_connection(ab_ldap))
-            != LDAP_SUCCESS) {
-            return LBABERR_CANNOT_CONNECT;
-        }
+        if( (rc=libbalsa_address_book_ldap_open_connection(ab_ldap))
+           != LDAP_SUCCESS)
+           return LBABERR_CANNOT_CONNECT;
     }
 
     dn = g_strdup_printf("mail=%s,%s",
@@ -774,24 +706,21 @@ libbalsa_address_book_ldap_remove_address(LibBalsaAddressBook *ab,
     cnt = 0;
     do {
         rc = ldap_delete_ext_s(ab_ldap->directory, dn, NULL, NULL);
-        switch (rc) {
-        case LDAP_SUCCESS: g_free(dn);
-            return LBABERR_OK;
-
+        switch(rc) {
+        case LDAP_SUCCESS: g_free(dn); return LBABERR_OK;
         case LDAP_SERVER_DOWN:
             libbalsa_address_book_ldap_close_connection(ab_ldap);
-            if ((rc = libbalsa_address_book_ldap_open_connection(ab_ldap))
-                != LDAP_SUCCESS) {
+           if( (rc=libbalsa_address_book_ldap_open_connection(ab_ldap))
+               != LDAP_SUCCESS) {
                 g_free(dn);
-                return LBABERR_CANNOT_CONNECT;
-            }
-
-        /* fall through */
+               return LBABERR_CANNOT_CONNECT;
+           }
+            /* fall through */
         default:
             fprintf(stderr, "ldap_delete for dn=“%s” failed[0x%x]: %s\n",
                     dn, rc, ldap_err2string(rc));
         }
-    } while (cnt++ < 1);
+    } while(cnt++<1);
     g_free(dn);
     libbalsa_address_book_set_status(ab, ldap_err2string(rc));
     return LBABERR_CANNOT_WRITE;
@@ -800,29 +729,21 @@ libbalsa_address_book_ldap_remove_address(LibBalsaAddressBook *ab,
 
 /** libbalsa_address_book_ldap_modify_address:
     modify given address. If mail address has changed, remove and add.
- */
-#   define STREQ(a, b) (g_strcmp0((a), (b)) == 0)
+*/
+#define STREQ(a,b) (g_strcmp0((a),(b))==0)
 static LibBalsaABErr
 libbalsa_address_book_ldap_modify_address(LibBalsaAddressBook *ab,
-                                          LibBalsaAddress     *address,
-                                          LibBalsaAddress     *newval)
+                                          LibBalsaAddress *address,
+                                          LibBalsaAddress *newval)
 {
     gchar *dn;
     LDAPMod *mods[5];
     LDAPMod modarr[4];
     int rc, cnt;
-    char *cn[] = {
-        NULL, NULL
-    };
-    char *gn[] = {
-        NULL, NULL
-    };
-    char *org[] = {
-        NULL, NULL
-    };
-    char *sn[] = {
-        NULL, NULL
-    };
+    char *cn[]   = {NULL, NULL};
+    char *gn[]   = {NULL, NULL};
+    char *org[]  = {NULL, NULL};
+    char *sn[]   = {NULL, NULL};
     LibBalsaAddressBookLdap *ab_ldap = LIBBALSA_ADDRESS_BOOK_LDAP(ab);
     const gchar *addr;
     const gchar *new_addr;
@@ -837,22 +758,20 @@ libbalsa_address_book_ldap_modify_address(LibBalsaAddressBook *ab,
     new_addr = libbalsa_address_get_addr(newval);
     g_return_val_if_fail(new_addr != NULL, LBABERR_CANNOT_WRITE);
 
-    if (!STREQ(addr, new_addr)) {
+    if(!STREQ(addr, new_addr)) {
         /* email address has changed, we have to remove old entry and
          * add a new one. */
-        if ((rc = libbalsa_address_book_ldap_add_address(ab, newval))
-            != LBABERR_OK) {
+        if( (rc=libbalsa_address_book_ldap_add_address(ab, newval))
+            != LBABERR_OK)
             return rc;
-        }
         return libbalsa_address_book_ldap_remove_address(ab, address);
     }
     /* the email address has not changed, continue with changing other
      * attributes. */
     if (ab_ldap->directory == NULL) {
-        if ((rc = libbalsa_address_book_ldap_open_connection(ab_ldap))
-            != LDAP_SUCCESS) {
-            return LBABERR_CANNOT_CONNECT;
-        }
+        if( (rc=libbalsa_address_book_ldap_open_connection(ab_ldap))
+           != LDAP_SUCCESS)
+           return LBABERR_CANNOT_CONNECT;
     }
 
     dn = g_strdup_printf("mail=%s,%s",
@@ -863,50 +782,46 @@ libbalsa_address_book_ldap_modify_address(LibBalsaAddressBook *ab,
     item = libbalsa_address_get_full_name(address);
     new_item = libbalsa_address_get_full_name(newval);
     if (!STREQ(item, new_item)) {
-        if (new_item != NULL) {
-            SETMOD(mods[cnt], modarr[cnt], LDAP_MOD_REPLACE, "cn", cn, new_item);
-        } else {
-            SETMOD(mods[cnt], modarr[cnt], LDAP_MOD_DELETE, "cn", cn, item);
-        }
+        if (new_item != NULL)
+            SETMOD(mods[cnt],modarr[cnt],LDAP_MOD_REPLACE,"cn",cn, new_item);
+        else
+            SETMOD(mods[cnt],modarr[cnt],LDAP_MOD_DELETE,"cn",cn, item);
         cnt++;
     }
 
     item = libbalsa_address_get_first_name(address);
     new_item = libbalsa_address_get_first_name(newval);
     if (!STREQ(item, new_item)) {
-        if (new_item != NULL) {
-            SETMOD(mods[cnt], modarr[cnt], LDAP_MOD_REPLACE, "givenName", gn, new_item);
-        } else {
-            SETMOD(mods[cnt], modarr[cnt], LDAP_MOD_DELETE, "givenName", gn, item);
-        }
+        if (new_item != NULL)
+            SETMOD(mods[cnt],modarr[cnt],LDAP_MOD_REPLACE,"givenName",gn, new_item);
+        else
+            SETMOD(mods[cnt],modarr[cnt],LDAP_MOD_DELETE,"givenName",gn, item);
         cnt++;
     }
 
     item = libbalsa_address_get_last_name(address);
     new_item = libbalsa_address_get_last_name(newval);
     if (!STREQ(item, new_item)) {
-        if (new_item != NULL) {
-            SETMOD(mods[cnt], modarr[cnt], LDAP_MOD_REPLACE, "sn", sn, new_item);
-        } else {
-            SETMOD(mods[cnt], modarr[cnt], LDAP_MOD_DELETE, "sn", sn, item);
-        }
+        if (new_item != NULL)
+            SETMOD(mods[cnt],modarr[cnt],LDAP_MOD_REPLACE,"sn",sn, new_item);
+        else
+            SETMOD(mods[cnt],modarr[cnt],LDAP_MOD_DELETE,"sn",sn, item);
         cnt++;
     }
 
     item = libbalsa_address_get_organization(address);
     new_item = libbalsa_address_get_organization(newval);
     if (!STREQ(item, new_item)) {
-        if (new_item != NULL) {
-            SETMOD(mods[cnt], modarr[cnt], LDAP_MOD_REPLACE, "o", org, new_item);
-        } else {
-            SETMOD(mods[cnt], modarr[cnt], LDAP_MOD_DELETE, "o", org, item);
-        }
+        if (new_item != NULL)
+            SETMOD(mods[cnt],modarr[cnt],LDAP_MOD_REPLACE,"o", org, new_item);
+        else
+            SETMOD(mods[cnt],modarr[cnt],LDAP_MOD_DELETE,"o", org, item);
         cnt++;
     }
 
     mods[cnt] = NULL;
 
-    if (cnt == 0) {
+    if(cnt == 0) {
         /* nothing to modify */
         g_free(dn);
         return LBABERR_OK;
@@ -914,32 +829,29 @@ libbalsa_address_book_ldap_modify_address(LibBalsaAddressBook *ab,
     cnt = 0;
     do {
         rc = ldap_modify_ext_s(ab_ldap->directory, dn, mods, NULL, NULL);
-        switch (rc) {
+        switch(rc) {
         case LDAP_SUCCESS: return LBABERR_OK;
-
         case LDAP_SERVER_DOWN:
             libbalsa_address_book_ldap_close_connection(ab_ldap);
-            if ((rc = libbalsa_address_book_ldap_open_connection(ab_ldap))
-                != LDAP_SUCCESS) {
-                g_free(dn);
-                return LBABERR_CANNOT_CONNECT;
-            }
-
-        /* fall through */
+           if( (rc=libbalsa_address_book_ldap_open_connection(ab_ldap))
+               != LDAP_SUCCESS) {
+               g_free(dn);
+               return LBABERR_CANNOT_CONNECT;
+           }
+            /* fall through */
         default:
             fprintf(stderr, "ldap_modify for dn=“%s” failed[0x%x]: %s\n",
                     dn, rc, ldap_err2string(rc));
         }
-    } while (cnt++ < 1);
+    } while(cnt++<1);
     g_free(dn);
     libbalsa_address_book_set_status(ab, ldap_err2string(rc));
     return LBABERR_CANNOT_WRITE;
 }
 
-
 static void
-libbalsa_address_book_ldap_save_config(LibBalsaAddressBook *ab,
-                                       const gchar         *prefix)
+libbalsa_address_book_ldap_save_config(LibBalsaAddressBook * ab,
+                                      const gchar * prefix)
 {
     LibBalsaAddressBookClass *parent_class =
         LIBBALSA_ADDRESS_BOOK_CLASS(libbalsa_address_book_ldap_parent_class);
@@ -950,28 +862,19 @@ libbalsa_address_book_ldap_save_config(LibBalsaAddressBook *ab,
     ldap = LIBBALSA_ADDRESS_BOOK_LDAP(ab);
 
     libbalsa_conf_set_string("Host", ldap->host);
-    if (ldap->base_dn) {
-        libbalsa_conf_set_string("BaseDN", ldap->base_dn);
-    }
-    if (ldap->bind_dn) {
-        libbalsa_conf_private_set_string("BindDN", ldap->bind_dn);
-    }
-    if (ldap->passwd) {
-        libbalsa_conf_private_set_string("Passwd", ldap->passwd);
-    }
-    if (ldap->priv_book_dn) {
+    if(ldap->base_dn) libbalsa_conf_set_string("BaseDN", ldap->base_dn);
+    if(ldap->bind_dn) libbalsa_conf_private_set_string("BindDN", ldap->bind_dn);
+    if(ldap->passwd)  libbalsa_conf_private_set_string("Passwd", ldap->passwd);
+    if(ldap->priv_book_dn)
         libbalsa_conf_set_string("BookDN", ldap->priv_book_dn);
-    }
     libbalsa_conf_set_bool("EnableTLS", ldap->enable_tls);
-    if (parent_class->save_config != NULL) {
-        parent_class->save_config(ab, prefix);
-    }
+    if (parent_class->save_config != NULL)
+       parent_class->save_config(ab, prefix);
 }
 
-
 static void
-libbalsa_address_book_ldap_load_config(LibBalsaAddressBook *ab,
-                                       const gchar         *prefix)
+libbalsa_address_book_ldap_load_config(LibBalsaAddressBook * ab,
+                                      const gchar * prefix)
 {
     LibBalsaAddressBookClass *parent_class =
         LIBBALSA_ADDRESS_BOOK_CLASS(libbalsa_address_book_ldap_parent_class);
@@ -983,31 +886,26 @@ libbalsa_address_book_ldap_load_config(LibBalsaAddressBook *ab,
 
     ldap->host = libbalsa_conf_get_string("Host");
     ldap->base_dn = libbalsa_conf_get_string("BaseDN");
-    if (ldap->base_dn && (*ldap->base_dn == 0)) {
-        g_free(ldap->base_dn);
-        ldap->base_dn = NULL;
+    if(ldap->base_dn && *ldap->base_dn == 0) { 
+       g_free(ldap->base_dn); ldap->base_dn = NULL; 
     }
 
     ldap->bind_dn = libbalsa_conf_private_get_string("BindDN");
-    if (ldap->bind_dn && (*ldap->bind_dn == 0)) {
-        g_free(ldap->bind_dn);
-        ldap->bind_dn = NULL;
+    if(ldap->bind_dn && *ldap->bind_dn == 0) { 
+       g_free(ldap->bind_dn); ldap->bind_dn = NULL; 
     }
     ldap->passwd = libbalsa_conf_private_get_string("Passwd");
-    if (ldap->passwd && (*ldap->passwd == 0)) {
-        g_free(ldap->passwd);
-        ldap->passwd = NULL;
+    if(ldap->passwd && *ldap->passwd == 0) { 
+       g_free(ldap->passwd); ldap->passwd = NULL; 
     }
     ldap->priv_book_dn = libbalsa_conf_get_string("BookDN");
-    if (ldap->priv_book_dn && (*ldap->priv_book_dn == 0)) {
-        g_free(ldap->priv_book_dn);
-        ldap->priv_book_dn = NULL;
+    if(ldap->priv_book_dn && *ldap->priv_book_dn == 0) { 
+       g_free(ldap->priv_book_dn); ldap->priv_book_dn = NULL; 
     }
     ldap->enable_tls = libbalsa_conf_get_bool("EnableTLS");
 
-    if (parent_class->load_config != NULL) {
-        parent_class->load_config(ab, prefix);
-    }
+    if (parent_class->load_config != NULL)
+       parent_class->load_config(ab, prefix);
 }
 
 
@@ -1032,7 +930,7 @@ libbalsa_address_book_ldap_load_config(LibBalsaAddressBook *ab,
  * NOTE: This function does not escape embedded NUL, as the input
  * function is NUL terminated.
  */
-static gchar *
+static gchar*
 rfc_2254_escape(const gchar *raw)
 {
     gchar *new;
@@ -1045,45 +943,28 @@ rfc_2254_escape(const gchar *raw)
          step[0] != '\0';
          step++) {
         switch (step[0]) {
-        case '*':
-            str[0] = '\\';
-            str++;
-            str[0] = '2';
-            str++;
-            str[0] = 'a';
-            str++;
-            break;
-
-        case '(':
-            str[0] = '\\';
-            str++;
-            str[0] = '2';
-            str++;
-            str[0] = '8';
-            str++;
-            break;
-
-        case ')':
-            str[0] = '\\';
-            str++;
-            str[0] = '2';
-            str++;
-            str[0] = '9';
-            str++;
-            break;
-
-        case '\\':
-            str[0] = '\\';
-            str++;
-            str[0] = '5';
-            str++;
-            str[0] = 'c';
-            str++;
-            break;
-
-        default:
-            str[0] = step[0];
-            str++;
+            case '*':
+                str[0] = '\\'; str++;
+                str[0] = '2'; str++;
+                str[0] = 'a'; str++;
+                break;
+            case '(':
+                str[0] = '\\'; str++;
+                str[0] = '2'; str++;
+                str[0] = '8'; str++;
+                break;
+            case ')':
+                str[0] = '\\'; str++;
+                str[0] = '2'; str++;
+                str[0] = '9'; str++;
+                break;
+            case '\\':
+                str[0] = '\\'; str++;
+                str[0] = '5'; str++;
+                str[0] = 'c'; str++;
+                break;
+            default:
+                str[0] = step[0]; str++;
         }
     }
     str[0] = '\0';
@@ -1094,32 +975,28 @@ rfc_2254_escape(const gchar *raw)
 
 
 static GList *
-libbalsa_address_book_ldap_alias_complete(LibBalsaAddressBook *ab,
-                                          const gchar         *prefix)
+libbalsa_address_book_ldap_alias_complete(LibBalsaAddressBook * ab,
+                                         const gchar * prefix)
 {
-    static struct timeval timeout = {
-        15, 0
-    };                                         /* 15 sec timeout */
+    static struct timeval timeout = { 15, 0 }; /* 15 sec timeout */
     LibBalsaAddressBookLdap *ab_ldap;
     InternetAddress *addr;
     GList *res = NULL;
-    gchar *filter;
-    gchar *ldap;
+    gchar* filter;
+    gchar* ldap;
     int rc;
-    LDAPMessage *e, *result;
+    LDAPMessage * e, *result;
 
     g_return_val_if_fail ( LIBBALSA_ADDRESS_BOOK_LDAP(ab), NULL);
 
     ab_ldap = LIBBALSA_ADDRESS_BOOK_LDAP(ab);
 
-    if (!libbalsa_address_book_get_expand_aliases(ab) || (strlen(prefix) < ABL_MIN_LEN)) {
+    if (!libbalsa_address_book_get_expand_aliases(ab) || strlen(prefix)<ABL_MIN_LEN)
         return NULL;
-    }
     if (ab_ldap->directory == NULL) {
-        if ((rc = libbalsa_address_book_ldap_open_connection(ab_ldap))
-            != LDAP_SUCCESS) {
-            return NULL;
-        }
+        if( (rc=libbalsa_address_book_ldap_open_connection(ab_ldap))
+           != LDAP_SUCCESS)
+           return NULL;
     }
 
     /*
@@ -1130,165 +1007,143 @@ libbalsa_address_book_ldap_alias_complete(LibBalsaAddressBook *ab,
 
     filter = g_strdup_printf("(&(objectClass=organizationalPerson)(mail=*)"
                              "(|(cn=%s*)(sn=%s*)(mail=%s*@*)))",
-                             ldap, ldap, ldap);
+                            ldap, ldap, ldap);
     g_free(ldap);
     result = NULL;
     rc = ldap_search_ext_s(ab_ldap->directory, ab_ldap->base_dn,
-                           LDAP_SCOPE_SUBTREE, filter, complete_attrs, 0,
+                           LDAP_SCOPE_SUBTREE, filter, complete_attrs, 0, 
                            NULL, NULL, &timeout, ABL_SIZE_LIMIT_LOOKUP,
                            &result);
-    if (DEBUG_LDAP) {
-        g_print("Sent LDAP request: %s (basedn=%s) res=0x%x\n",
+    if(DEBUG_LDAP)
+        g_print("Sent LDAP request: %s (basedn=%s) res=0x%x\n", 
                 filter, ab_ldap->base_dn, rc);
-    }
     g_free(filter);
     switch (rc) {
     case LDAP_SUCCESS:
     case LDAP_PARTIAL_RESULTS:
-        if (result) {
-            for (e = ldap_first_entry(ab_ldap->directory, result);
-                 e != NULL; e = ldap_next_entry(ab_ldap->directory, e)) {
-                addr = lbabl_get_internet_address(ab_ldap->directory, e);
-                res = g_list_prepend(res, addr);
-            }
-        }
-
+       if (result)
+           for(e = ldap_first_entry(ab_ldap->directory, result);
+               e != NULL; e = ldap_next_entry(ab_ldap->directory, e)) {
+               addr = lbabl_get_internet_address(ab_ldap->directory, e);
+               res = g_list_prepend(res, addr);
+           }
     case LDAP_SIZELIMIT_EXCEEDED:
     case LDAP_TIMELIMIT_EXCEEDED:
-        /*
-         * These are administrative limits, so don't warn about them.
-         * Particularly SIZELIMIT can be nasty on big directories.
-         */
-        break;
-
+       /*
+        * These are administrative limits, so don't warn about them.
+        * Particularly SIZELIMIT can be nasty on big directories.
+        */
+       break;
     case LDAP_SERVER_DOWN:
         libbalsa_address_book_ldap_close_connection(ab_ldap);
         g_print("Server down. Next attempt will try to reconnect.\n");
         break;
-
     default:
-        /*
-         * Until we know for sure, complain about all other errors.
-         */
-        fprintf(stderr, "alias_complete::ldap_search_st: %s\n",
+       /*
+        * Until we know for sure, complain about all other errors.
+        */
+       fprintf(stderr, "alias_complete::ldap_search_st: %s\n",
                 ldap_err2string(rc));
-        break;
+       break;
     }
 
     /* printf("ldap_alias_complete:: result=%p\n", result); */
-    if (result) {
-        ldap_msgfree(result);
-    }
+    if(result) ldap_msgfree(result);
 
-    if (res) {
-        res = g_list_reverse(res);
-    }
+    if(res) res = g_list_reverse(res);
 
     return res;
 }
 
-
 /*
  * Getters
  */
 
 const gchar *
-libbalsa_address_book_ldap_get_host(LibBalsaAddressBookLdap *ab_ldap)
+libbalsa_address_book_ldap_get_host(LibBalsaAddressBookLdap * ab_ldap)
 {
     return ab_ldap->host;
 }
 
-
 const gchar *
-libbalsa_address_book_ldap_get_base_dn(LibBalsaAddressBookLdap *ab_ldap)
+libbalsa_address_book_ldap_get_base_dn(LibBalsaAddressBookLdap * ab_ldap)
 {
     return ab_ldap->base_dn;
 }
 
-
 const gchar *
-libbalsa_address_book_ldap_get_bind_dn(LibBalsaAddressBookLdap *ab_ldap)
+libbalsa_address_book_ldap_get_bind_dn(LibBalsaAddressBookLdap * ab_ldap)
 {
     return ab_ldap->bind_dn;
 }
 
-
 const gchar *
-libbalsa_address_book_ldap_get_passwd(LibBalsaAddressBookLdap *ab_ldap)
+libbalsa_address_book_ldap_get_passwd(LibBalsaAddressBookLdap * ab_ldap)
 {
     return ab_ldap->passwd;
 }
 
-
 const gchar *
-libbalsa_address_book_ldap_get_book_dn(LibBalsaAddressBookLdap *ab_ldap)
+libbalsa_address_book_ldap_get_book_dn(LibBalsaAddressBookLdap * ab_ldap)
 {
     return ab_ldap->priv_book_dn;
 }
 
-
 gboolean
-libbalsa_address_book_ldap_get_enable_tls(LibBalsaAddressBookLdap *ab_ldap)
+libbalsa_address_book_ldap_get_enable_tls(LibBalsaAddressBookLdap * ab_ldap)
 {
     return ab_ldap->enable_tls;
 }
 
-
 /*
  * Setters
  */
 
 void
-libbalsa_address_book_ldap_set_host(LibBalsaAddressBookLdap *ab_ldap,
-                                    const gchar             *host)
+libbalsa_address_book_ldap_set_host(LibBalsaAddressBookLdap * ab_ldap,
+                                    const gchar             * host)
 {
     g_free(ab_ldap->host);
     ab_ldap->host = g_strdup(host);
 }
 
-
 void
-libbalsa_address_book_ldap_set_base_dn(LibBalsaAddressBookLdap *ab_ldap,
-                                       const gchar             *base_dn)
+libbalsa_address_book_ldap_set_base_dn(LibBalsaAddressBookLdap * ab_ldap,
+                                       const gchar             * base_dn)
 {
     g_free(ab_ldap->base_dn);
     ab_ldap->base_dn = g_strdup(base_dn);
 }
 
-
 void
-libbalsa_address_book_ldap_set_bind_dn(LibBalsaAddressBookLdap *ab_ldap,
-                                       const gchar             *bind_dn)
+libbalsa_address_book_ldap_set_bind_dn(LibBalsaAddressBookLdap * ab_ldap,
+                                       const gchar             * bind_dn)
 {
     g_free(ab_ldap->bind_dn);
     ab_ldap->bind_dn = g_strdup(bind_dn);
 }
 
-
 void
-libbalsa_address_book_ldap_set_passwd(LibBalsaAddressBookLdap *ab_ldap,
-                                      const gchar             *passwd)
+libbalsa_address_book_ldap_set_passwd(LibBalsaAddressBookLdap * ab_ldap,
+                                      const gchar             * passwd)
 {
     g_free(ab_ldap->passwd);
     ab_ldap->passwd = g_strdup(passwd);
 }
 
-
 void
-libbalsa_address_book_ldap_set_book_dn(LibBalsaAddressBookLdap *ab_ldap,
-                                       const gchar             *book_dn)
+libbalsa_address_book_ldap_set_book_dn(LibBalsaAddressBookLdap * ab_ldap,
+                                       const gchar             * book_dn)
 {
     g_free(ab_ldap->priv_book_dn);
     ab_ldap->priv_book_dn = g_strdup(book_dn);
 }
 
-
 void
-libbalsa_address_book_ldap_set_enable_tls(LibBalsaAddressBookLdap *ab_ldap,
-                                          gboolean                 enable_tls)
+libbalsa_address_book_ldap_set_enable_tls(LibBalsaAddressBookLdap * ab_ldap,
+                                          gboolean                  enable_tls)
 {
     ab_ldap->enable_tls = enable_tls;
 }
 
-
-#endif                          /*LDAP_ENABLED */
+#endif                         /*LDAP_ENABLED */
diff --git a/libbalsa/address-book-ldap.h b/libbalsa/address-book-ldap.h
index 5dfccd1..3481968 100644
--- a/libbalsa/address-book-ldap.h
+++ b/libbalsa/address-book-ldap.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -32,42 +32,42 @@
 
 #define LIBBALSA_TYPE_ADDRESS_BOOK_LDAP (libbalsa_address_book_ldap_get_type())
 G_DECLARE_FINAL_TYPE(LibBalsaAddressBookLdap, libbalsa_address_book_ldap,
-                     LIBBALSA, ADDRESS_BOOK_LDAP, LibBalsaAddressBook)
+        LIBBALSA, ADDRESS_BOOK_LDAP, LibBalsaAddressBook)
 
-LibBalsaAddressBook * libbalsa_address_book_ldap_new(const gchar * name,
-                                                     const gchar * host,
-                                                     const gchar * base_dn,
-                                                     const gchar * bind_dn,
-                                                     const gchar * passwd,
-                                                     const gchar * priv_book_dn,
-                                                     gboolean enable_tls);
+LibBalsaAddressBook *libbalsa_address_book_ldap_new(const gchar *name,
+                                                   const gchar *host,
+                                                   const gchar *base_dn,
+                                                   const gchar *bind_dn,
+                                                   const gchar *passwd,
+                                                    const gchar *priv_book_dn,
+                                                    gboolean enable_tls);
 void libbalsa_address_book_ldap_close_connection(LibBalsaAddressBookLdap *ab);
 
 /*
  * Getters
  */
-const gchar *libbalsa_address_book_ldap_get_host(LibBalsaAddressBookLdap *ab_ldap);
-const gchar *libbalsa_address_book_ldap_get_passwd(LibBalsaAddressBookLdap *ab_ldap);
-const gchar *libbalsa_address_book_ldap_get_base_dn(LibBalsaAddressBookLdap *ab_ldap);
-const gchar *libbalsa_address_book_ldap_get_bind_dn(LibBalsaAddressBookLdap *ab_ldap);
-const gchar *libbalsa_address_book_ldap_get_book_dn(LibBalsaAddressBookLdap *ab_ldap);
+const gchar * libbalsa_address_book_ldap_get_host   (LibBalsaAddressBookLdap * ab_ldap);
+const gchar * libbalsa_address_book_ldap_get_passwd (LibBalsaAddressBookLdap * ab_ldap);
+const gchar * libbalsa_address_book_ldap_get_base_dn(LibBalsaAddressBookLdap * ab_ldap);
+const gchar * libbalsa_address_book_ldap_get_bind_dn(LibBalsaAddressBookLdap * ab_ldap);
+const gchar * libbalsa_address_book_ldap_get_book_dn(LibBalsaAddressBookLdap * ab_ldap);
 gboolean      libbalsa_address_book_ldap_get_enable_tls(LibBalsaAddressBookLdap *
                                                         ab_ldap);
 
 /*
  * Setters
  */
-void libbalsa_address_book_ldap_set_host(LibBalsaAddressBookLdap *ab_ldap,
-                                         const gchar             *host);
-void libbalsa_address_book_ldap_set_passwd(LibBalsaAddressBookLdap *ab_ldap,
-                                           const gchar             *passwd);
-void libbalsa_address_book_ldap_set_base_dn(LibBalsaAddressBookLdap *ab_ldap,
-                                            const gchar             *base_dn);
-void libbalsa_address_book_ldap_set_bind_dn(LibBalsaAddressBookLdap *ab_ldap,
-                                            const gchar             *bind_dn);
-void libbalsa_address_book_ldap_set_book_dn(LibBalsaAddressBookLdap *ab_ldap,
-                                            const gchar             *book_dn);
-void libbalsa_address_book_ldap_set_enable_tls(LibBalsaAddressBookLdap *ab_ldap,
-                                               gboolean                 enable_tls);
+void libbalsa_address_book_ldap_set_host      (LibBalsaAddressBookLdap * ab_ldap,
+                                               const gchar             * host);
+void libbalsa_address_book_ldap_set_passwd    (LibBalsaAddressBookLdap * ab_ldap,
+                                               const gchar             * passwd);
+void libbalsa_address_book_ldap_set_base_dn   (LibBalsaAddressBookLdap * ab_ldap,
+                                               const gchar             * base_dn);
+void libbalsa_address_book_ldap_set_bind_dn   (LibBalsaAddressBookLdap * ab_ldap,
+                                               const gchar             * bind_dn);
+void libbalsa_address_book_ldap_set_book_dn   (LibBalsaAddressBookLdap * ab_ldap,
+                                               const gchar             * book_dn);
+void libbalsa_address_book_ldap_set_enable_tls(LibBalsaAddressBookLdap * ab_ldap,
+                                               gboolean                  enable_tls);
 
-#endif                          /* __LIBBALSA_ADDRESS_BOOK_LDAP_H__ */
+#endif                         /* __LIBBALSA_ADDRESS_BOOK_LDAP_H__ */
diff --git a/libbalsa/address-book-ldif.c b/libbalsa/address-book-ldif.c
index 78dccf3..cb40996 100644
--- a/libbalsa/address-book-ldif.c
+++ b/libbalsa/address-book-ldif.c
@@ -23,7 +23,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "address-book-ldif.h"
 
@@ -32,15 +32,18 @@
 
 #include <glib/gi18n.h>
 
-static void libbalsa_address_book_ldif_class_init(LibBalsaAddressBookLdifClass *
-                                                  klass);
+static void
+libbalsa_address_book_ldif_class_init(LibBalsaAddressBookLdifClass *
+                                      klass);
 
-static LibBalsaABErr libbalsa_address_book_ldif_parse_address(FILE            *stream_in,
-                                                              LibBalsaAddress *address_in,
-                                                              FILE            *stream_out,
-                                                              LibBalsaAddress *address_out);
-static LibBalsaABErr libbalsa_address_book_ldif_save_address(FILE            *stream,
-                                                             LibBalsaAddress *address);
+static LibBalsaABErr
+libbalsa_address_book_ldif_parse_address(FILE * stream_in,
+                                         LibBalsaAddress * address_in,
+                                         FILE * stream_out,
+                                         LibBalsaAddress * address_out);
+static LibBalsaABErr
+libbalsa_address_book_ldif_save_address(FILE * stream,
+                                        LibBalsaAddress * address);
 
 struct _LibBalsaAddressBookLdif {
     LibBalsaAddressBookText parent;
@@ -54,13 +57,12 @@ G_DEFINE_TYPE(LibBalsaAddressBookLdif, libbalsa_address_book_ldif,
               LIBBALSA_TYPE_ADDRESS_BOOK_TEXT)
 
 static void
-libbalsa_address_book_ldif_init(LibBalsaAddressBookLdif *ab_ldif)
+libbalsa_address_book_ldif_init(LibBalsaAddressBookLdif * ab_ldif)
 {
 }
 
-
 static void
-libbalsa_address_book_ldif_class_init(LibBalsaAddressBookLdifClass *klass)
+libbalsa_address_book_ldif_class_init(LibBalsaAddressBookLdifClass * klass)
 {
     LibBalsaAddressBookTextClass *address_book_text_class =
         LIBBALSA_ADDRESS_BOOK_TEXT_CLASS(klass);
@@ -71,18 +73,16 @@ libbalsa_address_book_ldif_class_init(LibBalsaAddressBookLdifClass *klass)
         libbalsa_address_book_ldif_save_address;
 }
 
-
 /* Public method */
 LibBalsaAddressBook *
-libbalsa_address_book_ldif_new(const gchar *name,
-                               const gchar *path)
+libbalsa_address_book_ldif_new(const gchar * name, const gchar * path)
 {
     LibBalsaAddressBookLdif *ab_ldif;
 
     ab_ldif =
         LIBBALSA_ADDRESS_BOOK_LDIF(g_object_new
-                                       (LIBBALSA_TYPE_ADDRESS_BOOK_LDIF,
-                                       NULL));
+                                   (LIBBALSA_TYPE_ADDRESS_BOOK_LDIF,
+                                    NULL));
 
     libbalsa_address_book_set_name(LIBBALSA_ADDRESS_BOOK(ab_ldif), name);
     libbalsa_address_book_text_set_path(LIBBALSA_ADDRESS_BOOK_TEXT(ab_ldif), path);
@@ -90,146 +90,123 @@ libbalsa_address_book_ldif_new(const gchar *name,
     return LIBBALSA_ADDRESS_BOOK(ab_ldif);
 }
 
-
 /* Helpers */
 
 /* according to rfc2849, value_spec must be either 7-bit ASCII
    (safe-string) or a base64-string. Or an url, which is not
    implemented yet.
- */
-static gchar *
-string_to_value_spec(const gchar *str)
+*/
+static gchar*
+string_to_value_spec(const gchar* str)
 {
     gboolean issafe = TRUE;
-    const gchar *p;
+    const gchar* p;
 
-    for (p = str; *p != '\0' && issafe; p++) {
-        issafe = (*p & 0x80) == 0;
-    }
+    for(p = str; *p != '\0' && issafe; p++)
+       issafe = (*p &0x80) == 0;
 
     if (issafe) {
-        return g_strconcat(" ", str, NULL);
+       return g_strconcat(" ",str, NULL);
     } else {
-        gsize len;
-        gsize sz;
-        gchar *res;
+       gsize len;
+       gsize sz;
+       gchar *res;
         gsize outlen;
         gint state = 0;
         gint save = 0;
 
-        len = strlen(str);
-        sz = (len / 3 + 1) * 4 + 1;
-        res = g_malloc(sz + 2);
-        strcpy(res, ": ");
+       len = strlen(str);
+       sz = (len / 3 + 1) * 4 + 1;
+       res = g_malloc(sz + 2);
+       strcpy(res, ": ");
         outlen = g_base64_encode_step((const guchar *) str, len, FALSE, res + 2,
                                       &state, &save);
         outlen += g_base64_encode_close(FALSE, res + 2 + outlen, &state, &save);
         res[2 + outlen] = '\0';
 
-        return res;
+       return res;
     }
 }
 
-
-static gchar *
-value_spec_to_string(gchar *str)
+static gchar*
+value_spec_to_string(gchar* str)
 {
     gchar *res;
-    if (str[0] == ':') {
+    if(str[0] == ':') {
         gsize out_len;
 
         res = (gchar *) g_base64_decode(g_strchug(str + 1), &out_len);
-    } else {
-        res = g_strdup(g_strstrip(str));
-    }
+    } else
+       res = g_strdup(g_strstrip(str));
     return res;
 }
 
-
 /* member_value_to_mail:
  * str: dn of a an address book entry.
  * returns: email address associated with the entry.
  * We are cheap and just parse the dn. This may not work generally.
  */
-static gchar *
-member_value_to_mail(gchar *str)
+static gchar*
+member_value_to_mail(gchar* str)
 {
     gchar *res, *unencoded = value_spec_to_string(str);
     gchar *mail = strstr(unencoded, "mail=");
-    if (mail) {
-        gchar *eos = strchr(mail, ',');
-        if (eos) {
-            *eos = '\0';
-        }
-        res = g_strdup(mail + 5);
-    } else {
-        res = NULL;
-    }
+    if(mail) {
+        gchar *eos = strchr(mail,',');
+        if(eos) *eos = '\0';
+        res = g_strdup(mail+5);
+    } else res = NULL;
     g_free(unencoded);
     return res;
 }
 
-
-static gchar *
-read_line(FILE *f)
+       
+static gchar*
+read_line(FILE* f)
 {
     char buf[256];
-    GString *res = g_string_new("");
+    GString* res = g_string_new("");
     int len, emptyp = 1;
-
-    while ( fgets(buf, sizeof(buf), f)) {
-        emptyp = 0;
-        g_string_append(res, buf);
-        if (((len = strlen(buf)) > 0) && (buf[len - 1] == '\n')) {
-            break;
-        }
+    
+    while( fgets(buf, sizeof(buf), f)) {
+       emptyp = 0;
+       g_string_append(res, buf);
+       if((len=strlen(buf))> 0 && buf[len-1] == '\n') break;
     }
     g_strchomp(res->str);
-    if (res->str[res->len] == '\n') {
-        res->str[res->len] = '\0';
-    }
+    if(res->str[res->len] == '\n') res->str[res->len] = '\0';
 
     return g_string_free(res, emptyp);
 }
 
-
 /* build_name:
    Builds a full name and returns the pointer to the allocated memory chunk.
-   Returns a NULL pointer if it couldn't figure out a name.
- */
+   Returns a NULL pointer if it couldn't figure out a name. 
+*/
 static gchar *
-build_name(const gchar *cn,
-           const gchar *givenname,
-           const gchar *surname)
+build_name(const gchar *cn, const gchar *givenname, const gchar *surname)
 {
     gchar *name = NULL;
 
-    if (cn && *cn) {
-        name = g_strdup(cn);
-    } else if (givenname && *givenname && surname && *surname) {
-        name = g_strconcat (givenname, " ", surname, NULL);
-    } else if (givenname && *givenname) {
-        name = g_strdup(givenname);
-    } else if (surname && *surname) {
-        name = g_strdup(surname);
-    } else {
-        name = g_strdup(_("No-Name"));
-    }
+    if(cn && *cn) {
+       name = g_strdup(cn);
+    } else if(givenname && *givenname && surname && *surname) {
+       name = g_strconcat (givenname," ",surname,NULL);
+    } else if(givenname && *givenname) {
+       name = g_strdup(givenname);
+    } else if(surname && *surname) {
+       name = g_strdup(surname);
+    } else name = g_strdup(_("No-Name")); 
     return name;
 }
 
-
 /* address_new_prefill:
    takes over the string ownership!
- */
+*/
 static void
-address_new_prefill(LibBalsaAddress *address,
-                    GList           *address_list,
-                    gchar           *nickn,
-                    gchar           *givenn,
-                    gchar           *surn,
-                    gchar           *fulln,
-                    gchar           *org)
+address_new_prefill(LibBalsaAddress * address, GList * address_list,
+                    gchar * nickn, gchar * givenn, gchar * surn,
+                    gchar * fulln, gchar * org)
 {
     gchar *full_name;
 
@@ -264,33 +241,30 @@ address_new_prefill(LibBalsaAddress *address,
                                        full_name != NULL ? full_name : _("No-Id"));
     }
 
-    if (full_name == NULL) {
+    if (full_name == NULL)
         libbalsa_address_set_full_name(address, _("No-Name"));
-    }
 
     g_free(full_name);
 }
 
-
 /* Class methods */
 
 /*
  * Write various lines to the output stream.
  */
 static void
-lbab_ldif_write_dn(FILE            *stream,
-                   LibBalsaAddress *address)
+lbab_ldif_write_dn(FILE * stream, LibBalsaAddress * address)
 {
     const gchar *full_name = libbalsa_address_get_full_name(address);
     gchar *cn = NULL;
     const gchar *addr;
     gchar *value, *value_spec;
 
-    if ((full_name != NULL) && (full_name[0] != '\0')) {
+    if (full_name != NULL && full_name[0] != '\0') {
         cn = g_strdup(full_name);
     } else {
         const gchar *first_name = libbalsa_address_get_first_name(address);
-        const gchar *last_name = libbalsa_address_get_last_name(address);
+        const gchar *last_name  = libbalsa_address_get_last_name(address);
 
         cn = build_name(NULL, first_name, last_name);
         if (cn == NULL) {
@@ -304,11 +278,10 @@ lbab_ldif_write_dn(FILE            *stream,
     }
 
     addr = libbalsa_address_get_addr(address);
-    if ((addr != NULL) && (addr[0] != '\0')) {
+    if (addr != NULL && addr[0] != '\0') {
         value = g_strdup_printf("cn=%s,mail=%s", cn, addr);
-    } else {
+    } else
         value = g_strdup_printf("cn=%s", cn);
-    }
     value_spec = string_to_value_spec(value);
     fprintf(stream, "dn:%s\n", value_spec);
     g_free(value_spec);
@@ -320,10 +293,8 @@ lbab_ldif_write_dn(FILE            *stream,
     g_free(cn);
 }
 
-
 static void
-lbab_ldif_write_addresses(FILE            *stream,
-                          LibBalsaAddress *address)
+lbab_ldif_write_addresses(FILE * stream, LibBalsaAddress * address)
 {
     GList *list;
 
@@ -331,7 +302,7 @@ lbab_ldif_write_addresses(FILE            *stream,
          list != NULL; list = list->next) {
         const gchar *mail = list->data;
 
-        if ((mail != NULL) && (mail[0] != '\0')) {
+        if (mail != NULL && mail[0] != '\0') {
             gchar *value_spec = string_to_value_spec(mail);
             fprintf(stream, "mail:%s\n", value_spec);
             g_free(value_spec);
@@ -339,38 +310,32 @@ lbab_ldif_write_addresses(FILE            *stream,
     }
 }
 
-
 static void
-lbab_ldif_write_surname(FILE            *stream,
-                        LibBalsaAddress *address)
+lbab_ldif_write_surname(FILE * stream, LibBalsaAddress * address)
 {
     const gchar *last_name = libbalsa_address_get_last_name(address);
 
-    if ((last_name != NULL) && (last_name[0] != '\0')) {
+    if (last_name != NULL && last_name[0] != '\0') {
         gchar *value_spec = string_to_value_spec(last_name);
         fprintf(stream, "sn:%s\n", value_spec);
         g_free(value_spec);
     }
 }
 
-
 static void
-lbab_ldif_write_givenname(FILE            *stream,
-                          LibBalsaAddress *address)
+lbab_ldif_write_givenname(FILE * stream, LibBalsaAddress * address)
 {
     const gchar *first_name = libbalsa_address_get_first_name(address);
 
-    if ((first_name != NULL) && (first_name[0] != '\0')) {
+    if (first_name != NULL && first_name[0] != '\0') {
         gchar *value_spec = string_to_value_spec(first_name);
         fprintf(stream, "givenname:%s\n", value_spec);
         g_free(value_spec);
     }
 }
 
-
 static void
-lbab_ldif_write_nickname(FILE            *stream,
-                         LibBalsaAddress *address)
+lbab_ldif_write_nickname(FILE * stream, LibBalsaAddress * address)
 {
     const gchar *nick_name = libbalsa_address_get_nick_name(address);
 
@@ -381,10 +346,8 @@ lbab_ldif_write_nickname(FILE            *stream,
     }
 }
 
-
 static void
-lbab_ldif_write_organization(FILE            *stream,
-                             LibBalsaAddress *address)
+lbab_ldif_write_organization(FILE * stream, LibBalsaAddress * address)
 {
     const gchar *organization = libbalsa_address_get_nick_name(address);
 
@@ -395,72 +358,65 @@ lbab_ldif_write_organization(FILE            *stream,
     }
 }
 
-
 /*
  * Parse one address from the input stream; if an output stream is
  * given, create an item on it for the output address.
  */
 static LibBalsaABErr
-libbalsa_address_book_ldif_parse_address(FILE            *stream,
-                                         LibBalsaAddress *address,
-                                         FILE            *stream_out,
-                                         LibBalsaAddress *address_out)
+libbalsa_address_book_ldif_parse_address(FILE * stream,
+                                         LibBalsaAddress * address,
+                                         FILE * stream_out,
+                                         LibBalsaAddress * address_out)
 {
     gchar *line;
     gchar *surname = NULL, *givenname = NULL, *nickname = NULL,
-          *fullname = NULL, *organization = NULL;
+       *fullname = NULL, *organization = NULL;
     gint in_ldif = FALSE;
     GList *address_list = NULL;
     guint wrote = 0;
 
-    for (; (line = read_line(stream)) != NULL || in_ldif; g_free(line)) {
+    for (; (line=read_line(stream)) != NULL || in_ldif; g_free(line) ) {
         if (line) {
             /*
              * Check if it is a card.
              */
             if (g_ascii_strncasecmp(line, "dn:", 3) == 0) {
                 in_ldif = TRUE;
-                if (stream_out) {
+                if (stream_out)
                     lbab_ldif_write_dn(stream_out, address_out);
-                }
                 continue;
             }
 
             if (!in_ldif) {
-                if (stream_out && *line) {
+                if (stream_out && *line)
                     fprintf(stream_out, "%s\n", line);
-                }
                 continue;
             }
 
             g_strchomp(line);
         }
 
-        if (!line || (line[0] == '\0')) {
+       if (!line || line[0] == '\0') {
             LibBalsaABErr res = LBABERR_CANNOT_READ;
             /*
              * We are done loading a card.
              */
             if (address_list) {
                 if (stream_out) {
-                    if (!(wrote & (1 << LAST_NAME))) {
+                    if (!(wrote & (1 << LAST_NAME)))
                         lbab_ldif_write_surname(stream_out, address_out);
-                    }
-                    if (!(wrote & (1 << FIRST_NAME))) {
+                    if (!(wrote & (1 << FIRST_NAME)))
                         lbab_ldif_write_givenname(stream_out, address_out);
-                    }
-                    if (!(wrote & (1 << NICK_NAME))) {
+                    if (!(wrote & (1 << NICK_NAME)))
                         lbab_ldif_write_nickname(stream_out, address_out);
-                    }
-                    if (!(wrote & (1 << ORGANIZATION))) {
+                    if (!(wrote & (1 << ORGANIZATION)))
                         lbab_ldif_write_organization(stream_out, address_out);
-                    }
                     lbab_ldif_write_addresses(stream_out, address_out);
                     res = fprintf(stream_out, "\n") < 0 ?
                         LBABERR_CANNOT_WRITE : LBABERR_OK;
                 }
 
-                if (address) {
+               if (address) {
                     address_new_prefill(address,
                                         g_list_reverse(address_list),
                                         nickname, givenname, surname,
@@ -469,7 +425,7 @@ libbalsa_address_book_ldif_parse_address(FILE            *stream,
                     return LBABERR_OK;
                 }
                 g_list_free_full(address_list, g_free);
-            }
+           } 
             /* Record without e-mail address, or we're not creating
              * addresses: free memory. */
             g_free(fullname);
@@ -479,87 +435,85 @@ libbalsa_address_book_ldif_parse_address(FILE            *stream,
             g_free(organization);
             g_free(line);
             return res;
-        }
+       }
 
-        if (g_ascii_strncasecmp(line, "cn:", 3) == 0) {
-            fullname = value_spec_to_string(g_strchug(line + 3));
-            continue;
-        }
+       if (g_ascii_strncasecmp(line, "cn:", 3) == 0) {
+           fullname = value_spec_to_string(g_strchug(line + 3));
+           continue;
+       }
 
-        if (g_ascii_strncasecmp(line, "sn:", 3) == 0) {
-            surname = value_spec_to_string(g_strchug(line + 3));
+       if (g_ascii_strncasecmp(line, "sn:", 3) == 0) {
+           surname = value_spec_to_string(g_strchug(line + 3));
             if (stream_out) {
                 lbab_ldif_write_surname(stream_out, address_out);
                 wrote |= 1 << LAST_NAME;
             }
-            continue;
-        }
+           continue;
+       }
 
-        if (g_ascii_strncasecmp(line, "givenname:", 10) == 0) {
-            givenname = value_spec_to_string(g_strchug(line + 10));
+       if (g_ascii_strncasecmp(line, "givenname:", 10) == 0) {
+           givenname = value_spec_to_string(g_strchug(line + 10));
             if (stream_out) {
                 lbab_ldif_write_givenname(stream_out, address_out);
                 wrote |= 1 << FIRST_NAME;
             }
-            continue;
-        }
+           continue;
+       }
 
-        if (g_ascii_strncasecmp(line, "xmozillanickname:", 17) == 0) {
-            nickname = value_spec_to_string(g_strchug(line + 17));
+       if (g_ascii_strncasecmp(line, "xmozillanickname:", 17) == 0) {
+           nickname = value_spec_to_string(g_strchug(line + 17));
             if (stream_out) {
                 lbab_ldif_write_nickname(stream_out, address_out);
                 wrote |= 1 << NICK_NAME;
             }
-            continue;
-        }
+           continue;
+       }
 
-        if (g_ascii_strncasecmp(line, "o:", 2) == 0) {
-            organization = value_spec_to_string(g_strchug(line + 2));
+       if (g_ascii_strncasecmp(line, "o:", 2) == 0) {
+           organization = value_spec_to_string(g_strchug(line + 2));
             if (stream_out) {
                 lbab_ldif_write_organization(stream_out, address_out);
                 wrote |= 1 << ORGANIZATION;
             }
-            continue;
-        }
+           continue;
+       }
 
-        if (g_ascii_strncasecmp(line, "member:", 7) == 0) {
+       if (g_ascii_strncasecmp(line, "member:", 7) == 0) {
             address_list =
                 g_list_prepend(address_list,
                                member_value_to_mail(g_strchug(line + 7)));
-            continue;
-        }
-
-        /*
-         * fetch all e-mail fields
-         */
-        if (g_ascii_strncasecmp(line, "mail:", 5) == 0) {
-            address_list =
-                g_list_prepend(address_list,
-                               value_spec_to_string(g_strchug(line + 5)));
-            continue;
-        }
-
-        /*
+           continue;
+       }
+
+       /*
+        * fetch all e-mail fields
+        */
+       if (g_ascii_strncasecmp(line, "mail:", 5) == 0) {
+           address_list = 
+               g_list_prepend(address_list, 
+                              value_spec_to_string(g_strchug(line + 5)));
+           continue;
+       }
+
+        /* 
          * unknown line
          */
-        if (stream_out && *line) {
+        if (stream_out && *line)
             fprintf(stream_out, "%s\n", line);
-        }
     }
 
     return LBABERR_CANNOT_READ;
 }
 
-
 /*
  * Write one address to the output stream.
  */
 static LibBalsaABErr
-libbalsa_address_book_ldif_save_address(FILE            *stream,
-                                        LibBalsaAddress *address)
+libbalsa_address_book_ldif_save_address(FILE * stream,
+                                        LibBalsaAddress * address)
 {
-    if ((fseek(stream, -2, SEEK_END) == 0)
-        && ((fgetc(stream) != '\n') || (fgetc(stream) != '\n'))) {
+    if (fseek(stream, -2, SEEK_END) == 0
+        && (fgetc(stream) != '\n' || fgetc(stream) != '\n')) {
         fseek(stream, 0, SEEK_END);
         fputc('\n', stream);
     }
diff --git a/libbalsa/address-book-ldif.h b/libbalsa/address-book-ldif.h
index dd3731f..15209d5 100644
--- a/libbalsa/address-book-ldif.h
+++ b/libbalsa/address-book-ldif.h
@@ -31,7 +31,7 @@
 G_DECLARE_FINAL_TYPE(LibBalsaAddressBookLdif, libbalsa_address_book_ldif,
                      LIBBALSA, ADDRESS_BOOK_LDIF, LibBalsaAddressBookText)
 
-LibBalsaAddressBook * libbalsa_address_book_ldif_new(const gchar * name,
-                                                     const gchar * path);
+LibBalsaAddressBook *libbalsa_address_book_ldif_new(const gchar * name,
+                                                    const gchar * path);
 
 #endif /* __LIBBALSA_ADDRESS_BOOK_LDIF_H__ */
diff --git a/libbalsa/address-book-osmo.c b/libbalsa/address-book-osmo.c
index 744e5f4..4dad611 100644
--- a/libbalsa/address-book-osmo.c
+++ b/libbalsa/address-book-osmo.c
@@ -27,50 +27,49 @@
  * Add remarks here...
  */
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #if defined(HAVE_OSMO)
 
-#   include <string.h>
-#   include <glib.h>
-#   include <gio/gio.h>
-#   include <glib/gi18n.h>
+#include <string.h>
+#include <glib.h>
+#include <gio/gio.h>
+#include <glib/gi18n.h>
 
-#   include "address-book.h"
-#   include "rfc6350.h"
-#   include "address-book-osmo.h"
-#   include "misc.h"
+#include "address-book.h"
+#include "rfc6350.h"
+#include "address-book-osmo.h"
+#include "misc.h"
 
 
-/* for the time being, osmo svn rev. 1099 accepts only reading via DBus, not writing new or
-   modified records */
-#   undef OSMO_CAN_WRITE
+/* for the time being, osmo svn rev. 1099 accepts only reading via DBus, not writing new or modified records 
*/
+#undef OSMO_CAN_WRITE
 
 
-#   define LOOKUP_MIN_LEN                                  2U
+#define LOOKUP_MIN_LEN                                 2U
 
 
 static void libbalsa_address_book_osmo_dispose(GObject *object);
-static LibBalsaABErr libbalsa_address_book_osmo_load(LibBalsaAddressBook        *ab,
-                                                     const gchar                *filter,
+static LibBalsaABErr libbalsa_address_book_osmo_load(LibBalsaAddressBook                *ab,
+                                                     const gchar                                *filter,
                                                      LibBalsaAddressBookLoadFunc callback,
-                                                     gpointer                    closure);
+                                                     gpointer                                   closure);
 static GList *libbalsa_address_book_osmo_alias_complete(LibBalsaAddressBook *ab,
-                                                        const gchar         *prefix);
+                                                        const gchar                    *prefix);
 static GList *osmo_read_addresses(LibBalsaAddressBookOsmo *osmo,
-                                  const gchar             *filter,
-                                  GError                 **error);
+                                                                 const gchar                     *filter,
+                                                                 GError                                  
**error);
 
 
 struct _LibBalsaAddressBookOsmo {
-    LibBalsaAddressBook parent;
+       LibBalsaAddressBook parent;
 
-    GDBusProxy *proxy;
+       GDBusProxy *proxy;
 };
 
 struct _LibBalsaAddressBookOsmoClass {
-    LibBalsaAddressBookClass parent_class;
+       LibBalsaAddressBookClass parent_class;
 };
 
 G_DEFINE_TYPE(LibBalsaAddressBookOsmo, libbalsa_address_book_osmo, LIBBALSA_TYPE_ADDRESS_BOOK);
@@ -79,22 +78,22 @@ G_DEFINE_TYPE(LibBalsaAddressBookOsmo, libbalsa_address_book_osmo, LIBBALSA_TYPE
 static void
 libbalsa_address_book_osmo_class_init(LibBalsaAddressBookOsmoClass *klass)
 {
-    LibBalsaAddressBookClass *address_book_class;
-    GObjectClass *object_class;
+       LibBalsaAddressBookClass *address_book_class;
+       GObjectClass *object_class;
 
-    object_class = G_OBJECT_CLASS(klass);
-    address_book_class = LIBBALSA_ADDRESS_BOOK_CLASS(klass);
+       object_class = G_OBJECT_CLASS(klass);
+       address_book_class = LIBBALSA_ADDRESS_BOOK_CLASS(klass);
 
-    object_class->dispose = libbalsa_address_book_osmo_dispose;
+       object_class->dispose = libbalsa_address_book_osmo_dispose;
 
-    address_book_class->load = libbalsa_address_book_osmo_load;
-#   if defined(OSMO_CAN_WRITE)
-    address_book_class->add_address = libbalsa_address_book_osmo_add_address;
-    address_book_class->remove_address = libbalsa_address_book_osmo_remove_address;
-    address_book_class->modify_address = libbalsa_address_book_osmo_modify_address;
-#   endif
+       address_book_class->load = libbalsa_address_book_osmo_load;
+#if defined(OSMO_CAN_WRITE)
+       address_book_class->add_address = libbalsa_address_book_osmo_add_address;
+       address_book_class->remove_address = libbalsa_address_book_osmo_remove_address;
+       address_book_class->modify_address = libbalsa_address_book_osmo_modify_address;
+#endif
 
-    address_book_class->alias_complete = libbalsa_address_book_osmo_alias_complete;
+       address_book_class->alias_complete = libbalsa_address_book_osmo_alias_complete;
 }
 
 
@@ -108,71 +107,71 @@ libbalsa_address_book_osmo_init(LibBalsaAddressBookOsmo *osmo)
 static void
 libbalsa_address_book_osmo_dispose(GObject *object)
 {
-    LibBalsaAddressBookOsmo *osmo;
+       LibBalsaAddressBookOsmo *osmo;
 
-    osmo = LIBBALSA_ADDRESS_BOOK_OSMO(object);
-    g_clear_object(&osmo->proxy);
+       osmo = LIBBALSA_ADDRESS_BOOK_OSMO(object);
+        g_clear_object(&osmo->proxy);
 
-    G_OBJECT_CLASS(libbalsa_address_book_osmo_parent_class)->dispose(object);
+       G_OBJECT_CLASS(libbalsa_address_book_osmo_parent_class)->dispose(object);
 }
 
 
 LibBalsaAddressBook *
 libbalsa_address_book_osmo_new(const gchar *name)
 {
-    LibBalsaAddressBook *ab = NULL;
-    LibBalsaAddressBookOsmo *osmo;
+       LibBalsaAddressBook *ab = NULL;
+       LibBalsaAddressBookOsmo *osmo;
 
-    osmo = LIBBALSA_ADDRESS_BOOK_OSMO(g_object_new(LIBBALSA_TYPE_ADDRESS_BOOK_OSMO, NULL));
-    ab = LIBBALSA_ADDRESS_BOOK(osmo);
-    libbalsa_address_book_set_name(ab, name);
+       osmo = LIBBALSA_ADDRESS_BOOK_OSMO(g_object_new(LIBBALSA_TYPE_ADDRESS_BOOK_OSMO, NULL));
+       ab = LIBBALSA_ADDRESS_BOOK(osmo);
+        libbalsa_address_book_set_name(ab, name);
 
-    return ab;
+       return ab;
 }
 
 
 static LibBalsaABErr
-libbalsa_address_book_osmo_load(LibBalsaAddressBook        *ab,
-                                const gchar                *filter,
+libbalsa_address_book_osmo_load(LibBalsaAddressBook            *ab,
+                                const gchar                            *filter,
                                 LibBalsaAddressBookLoadFunc callback,
-                                gpointer                    closure)
+                                gpointer                                       closure)
 {
-    LibBalsaABErr result;
-
-    g_return_val_if_fail (LIBBALSA_IS_ADDRESS_BOOK_OSMO(ab), LBABERR_OK);
-
-    if (callback == NULL) {
-        result = LBABERR_OK;
-    } else {
-        LibBalsaAddressBookOsmo *osmo;
-        GError *error = NULL;
-        GList *addresses;
-
-        osmo = LIBBALSA_ADDRESS_BOOK_OSMO(ab);
-
-        addresses = osmo_read_addresses(osmo, filter, &error);
-        if (error != NULL) {
-            gchar *status =
-                g_strdup_printf(_("Reading Osmo contacts failed: %s"),
-                                error->message);
-            libbalsa_address_book_set_status(ab, status);
-            g_free(status);
-            g_error_free(error);
-            result = LBABERR_CANNOT_SEARCH;
-        } else {
-            GList *this_addr;
-
-            for (this_addr = addresses; this_addr != NULL; this_addr = this_addr->next) {
-                callback(ab, LIBBALSA_ADDRESS(this_addr->data), closure);
-            }
-            callback(ab, NULL, closure);
-            g_list_free_full(addresses, g_object_unref);
-            libbalsa_address_book_set_status(ab, NULL);
-            result = LBABERR_OK;
-        }
-    }
-
-    return result;
+       LibBalsaABErr result;
+
+       g_return_val_if_fail (LIBBALSA_IS_ADDRESS_BOOK_OSMO(ab), LBABERR_OK);
+
+       if (callback == NULL) {
+               result = LBABERR_OK;
+       } else {
+               LibBalsaAddressBookOsmo *osmo;
+               GError *error = NULL;
+               GList *addresses;
+
+               osmo = LIBBALSA_ADDRESS_BOOK_OSMO(ab);
+
+               addresses = osmo_read_addresses(osmo, filter, &error);
+               if (error != NULL) {
+                        gchar *status =
+                            g_strdup_printf(_("Reading Osmo contacts failed: %s"),
+                                            error->message);
+                       libbalsa_address_book_set_status(ab, status);
+                        g_free(status);
+                       g_error_free(error);
+                       result = LBABERR_CANNOT_SEARCH;
+               } else {
+                       GList *this_addr;
+
+                       for (this_addr = addresses; this_addr != NULL; this_addr = this_addr->next) {
+                               callback(ab, LIBBALSA_ADDRESS(this_addr->data), closure);
+                       }
+                       callback(ab, NULL, closure);
+                       g_list_free_full(addresses, g_object_unref);
+                       libbalsa_address_book_set_status(ab, NULL);
+                       result = LBABERR_OK;
+               }
+       }
+
+       return result;
 }
 
 
@@ -183,21 +182,20 @@ libbalsa_address_book_osmo_load(LibBalsaAddressBook        *ab,
  * \return TRUE if needle is found anywhere in haystack
  */
 static gboolean
-utf8_strstr(const gchar *haystack,
-            const gchar *utf8_needle)
+utf8_strstr(const gchar *haystack, const gchar *utf8_needle)
 {
-    gboolean result;
-
-    if (haystack != NULL) {
-        gchar *test;
-
-        test = g_utf8_casefold(haystack, -1);
-        result = (strstr(test, utf8_needle) != NULL);
-        g_free(test);
-    } else {
-        result = FALSE;
-    }
-    return result;
+       gboolean result;
+
+       if (haystack != NULL) {
+               gchar *test;
+
+               test = g_utf8_casefold(haystack, -1);
+               result = (strstr(test, utf8_needle) != NULL);
+               g_free(test);
+       } else {
+               result = FALSE;
+       }
+       return result;
 }
 
 
@@ -207,79 +205,77 @@ utf8_strstr(const gchar *haystack,
  * \param utf8_needle utf8 "needle" string as returned by g_utf8_casefold()
  * \return TRUE if any address string field contains needle
  *
- * The fields checked are LibBalsaAddress::full_name, LibBalsaAddress::first_name,
- * LibBalsaAddress::last_name,
+ * The fields checked are LibBalsaAddress::full_name, LibBalsaAddress::first_name, 
LibBalsaAddress::last_name,
  * LibBalsaAddress::nick_name and LibBalsaAddress::organization.
  */
 static inline gboolean
-utf8_lba_strstr(LibBalsaAddress *address,
-                const gchar     *utf8_needle)
+utf8_lba_strstr(LibBalsaAddress *address, const gchar *utf8_needle)
 {
-    return utf8_strstr(libbalsa_address_get_full_name(address), utf8_needle) ||
-           utf8_strstr(libbalsa_address_get_first_name(address), utf8_needle) ||
-           utf8_strstr(libbalsa_address_get_last_name(address), utf8_needle) ||
-           utf8_strstr(libbalsa_address_get_nick_name(address), utf8_needle) ||
-           utf8_strstr(libbalsa_address_get_organization(address), utf8_needle);
+       return utf8_strstr(libbalsa_address_get_full_name(address), utf8_needle) ||
+               utf8_strstr(libbalsa_address_get_first_name(address), utf8_needle) ||
+               utf8_strstr(libbalsa_address_get_last_name(address), utf8_needle) ||
+               utf8_strstr(libbalsa_address_get_nick_name(address), utf8_needle) ||
+               utf8_strstr(libbalsa_address_get_organization(address), utf8_needle);
 }
 
 
 static GList *
 libbalsa_address_book_osmo_alias_complete(LibBalsaAddressBook *ab,
-                                          const gchar         *prefix)
+                                          const gchar            *prefix)
 {
-    LibBalsaAddressBookOsmo *osmo;
-    GError *error = NULL;
-    GList *addresses;
-    GList *result = NULL;
-
-    g_return_val_if_fail(LIBBALSA_ADDRESS_BOOK_OSMO(ab), NULL);
-
-    osmo = LIBBALSA_ADDRESS_BOOK_OSMO(ab);
-
-    if (!libbalsa_address_book_get_expand_aliases(ab) ||
-        (strlen(prefix) < LOOKUP_MIN_LEN)) {
-        return NULL;
-    }
-
-    g_debug("%s: filter for %s", __func__, prefix);
-    addresses = osmo_read_addresses(osmo, prefix, &error);
-    if (error != NULL) {
-        g_warning("%s: cannot read contacts from Osmo: %s", __func__, error->message);
-        g_error_free(error);
-    } else {
-        GList *p;
-        gchar *utf8_filter;
-
-        utf8_filter = g_utf8_casefold(prefix, -1);
-        for (p = addresses; p != NULL; p = p->next) {
-            LibBalsaAddress *this_addr = LIBBALSA_ADDRESS(p->data);
-            GList *this_mail;
-            gboolean names_match;
-
-            names_match = utf8_lba_strstr(this_addr, utf8_filter);
-            for (this_mail = libbalsa_address_get_addr_list(this_addr);
-                 this_mail != NULL; this_mail = this_mail->next) {
-                const gchar *mail_addr = (gchar *) this_mail->data;
-
-                if (names_match || (strstr(mail_addr, prefix) != NULL)) {
-                    const gchar *full_name;
-                    InternetAddress *addr;
-
-                    full_name =
-                        libbalsa_address_get_full_name(this_addr),
-                    g_debug("%s: found %s <%s>", __func__,
-                            full_name, mail_addr);
-                    addr = internet_address_mailbox_new(full_name,
-                                                        mail_addr);
-                    result = g_list_prepend(result, g_object_ref(addr));
-                }
-            }
-        }
-        g_free(utf8_filter);
-        g_list_free_full(addresses, g_object_unref);
-    }
-
-    return g_list_reverse(result);
+       LibBalsaAddressBookOsmo *osmo;
+       GError *error = NULL;
+       GList *addresses;
+       GList *result = NULL;
+
+       g_return_val_if_fail(LIBBALSA_ADDRESS_BOOK_OSMO(ab), NULL);
+
+       osmo = LIBBALSA_ADDRESS_BOOK_OSMO(ab);
+
+       if (!libbalsa_address_book_get_expand_aliases(ab) ||
+            strlen(prefix) < LOOKUP_MIN_LEN) {
+               return NULL;
+       }
+
+       g_debug("%s: filter for %s", __func__, prefix);
+       addresses = osmo_read_addresses(osmo, prefix, &error);
+       if (error != NULL) {
+               g_warning("%s: cannot read contacts from Osmo: %s", __func__, error->message);
+               g_error_free(error);
+       } else {
+               GList *p;
+               gchar *utf8_filter;
+
+               utf8_filter = g_utf8_casefold(prefix, -1);
+               for (p = addresses; p != NULL; p = p->next) {
+                       LibBalsaAddress *this_addr = LIBBALSA_ADDRESS(p->data);
+                       GList *this_mail;
+                       gboolean names_match;
+
+                       names_match = utf8_lba_strstr(this_addr, utf8_filter);
+                       for (this_mail = libbalsa_address_get_addr_list(this_addr);
+                             this_mail != NULL; this_mail = this_mail->next) {
+                               const gchar *mail_addr = (gchar *) this_mail->data;
+
+                               if (names_match || (strstr(mail_addr, prefix) != NULL)) {
+                                        const gchar *full_name;
+                                       InternetAddress *addr;
+
+                                        full_name =
+                                            libbalsa_address_get_full_name(this_addr),
+                                       g_debug("%s: found %s <%s>", __func__,
+                                                full_name, mail_addr);
+                                       addr = internet_address_mailbox_new(full_name,
+                                                mail_addr);
+                                       result = g_list_prepend(result, g_object_ref(addr));
+                               }
+                       }
+               }
+               g_free(utf8_filter);
+               g_list_free_full(addresses, g_object_unref);
+       }
+
+       return g_list_reverse(result);
 }
 
 
@@ -288,102 +284,86 @@ libbalsa_address_book_osmo_alias_complete(LibBalsaAddressBook *ab,
  * \param osmo Osmo address book object
  * \param filter search filter, NULL or "" for all entries
  * \param error filled with error information on error
- * \return a list \ref LibBalsaAddress items on success or NULL on error or if no item matches
- * the search filter
+ * \return a list \ref LibBalsaAddress items on success or NULL on error or if no item matches the search 
filter
  *
- * Create the proxy LibBalsaAddressBookOsmo::proxy if required, and ask Osmo for addresses.
- * Only items with any mail address are
- * added to the returned list.  The caller can distinguish between an error and an empty query
- * result by checking if error is not
+ * Create the proxy LibBalsaAddressBookOsmo::proxy if required, and ask Osmo for addresses.  Only items with 
any mail address are
+ * added to the returned list.  The caller can distinguish between an error and an empty query result by 
checking if error is not
  * NULL.
  *
  * \note The caller must free the returned list.
  */
 static GList *
 osmo_read_addresses(LibBalsaAddressBookOsmo *osmo,
-                    const gchar             *filter,
-                    GError                 **error)
+                                       const gchar                             *filter,
+                                       GError                                  **error)
 {
-    GList *addresses = NULL;
-
-    /* connect to DBus unless we already have a proxy */
-    if (osmo->proxy == NULL) {
-        osmo->proxy =
-            g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
-                                          G_DBUS_PROXY_FLAGS_NONE,
-                                          NULL,
-                                          "org.clayo.osmo.Contacts",
-                                          "/org/clayo/osmo/Contacts",
-                                          "org.clayo.osmo.Contacts",
-                                          NULL,
-                                          error);
-    }
-
-    /* proceed only if we have the proxy */
-    if (osmo->proxy != NULL) {
-        GVariant *request;
-        GVariant *reply;
-
-        if (filter != NULL) {
-            request = g_variant_new("(s)", filter);
-        } else {
-            request = g_variant_new("(s)", "");
-        }
-        reply = g_dbus_proxy_call_sync(osmo->proxy,
-                                       "Find",
-                                       request,
-                                       G_DBUS_CALL_FLAGS_NONE,
-                                       -1,
-                                       NULL,
-                                       error);
-
-        /* proceed only if we got a reply */
-        if (reply != NULL) {
-            gchar *vcards;
-            GInputStream *stream;
-            GDataInputStream *data;
-            gboolean eos;
-
-            /* create a stream from the VCards */
-            g_variant_get(reply, "(s)", &vcards);
-            stream = g_memory_input_stream_new_from_data(vcards, -1, NULL);
-            data = g_data_input_stream_new(stream);
-            g_data_input_stream_set_newline_type(data, G_DATA_STREAM_NEWLINE_TYPE_CR_LF);
-
-            /* decode all returned VCard's, skip those without email addresses */
-            eos = FALSE;
-            do {
-                LibBalsaAddress *this_addr;
-
-                this_addr = rfc6350_parse_from_stream(data, &eos, error);
-                if (this_addr != NULL) {
-                    if (libbalsa_address_get_addr(this_addr) != NULL) {
-                        addresses = g_list_prepend(addresses, this_addr);
-                    } else {
-                        g_object_unref(G_OBJECT(this_addr));
-                    }
-                }
-            } while (!eos && (*error == NULL));
-
-            /* clean up */
-            g_object_unref(G_OBJECT(data));
-            g_object_unref(G_OBJECT(stream));
-            g_free(vcards);
-            g_variant_unref(reply);
-
-            /* drop list on error, reverse order otherwise */
-            if (addresses != NULL) {
-                if (*error != NULL) {
-                    libbalsa_clear_list(&addresses, g_object_unref);
-                } else {
-                    addresses = g_list_reverse(addresses);
-                }
-            }
-        }
-    }
-
-    return addresses;
+       GList *addresses = NULL;
+
+       /* connect to DBus unless we already have a proxy */
+       if (osmo->proxy == NULL) {
+               osmo->proxy =
+                       g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, NULL, 
"org.clayo.osmo.Contacts",
+                                                                                 "/org/clayo/osmo/Contacts", 
"org.clayo.osmo.Contacts", NULL, error);
+       }
+
+       /* proceed only if we have the proxy */
+       if (osmo->proxy != NULL) {
+               GVariant *request;
+               GVariant *reply;
+
+               if (filter != NULL) {
+                       request = g_variant_new("(s)", filter);
+               } else {
+                       request = g_variant_new("(s)", "");
+               }
+               reply = g_dbus_proxy_call_sync(osmo->proxy, "Find", request, G_DBUS_CALL_FLAGS_NONE, -1, 
NULL, error);
+
+               /* proceed only if we got a reply */
+               if (reply != NULL) {
+                       gchar *vcards;
+                       GInputStream *stream;
+                       GDataInputStream *data;
+                       gboolean eos;
+
+                       /* create a stream from the VCards */
+                       g_variant_get(reply, "(s)", &vcards);
+                       stream = g_memory_input_stream_new_from_data(vcards, -1, NULL);
+                       data = g_data_input_stream_new(stream);
+                       g_data_input_stream_set_newline_type(data, G_DATA_STREAM_NEWLINE_TYPE_CR_LF);
+
+                       /* decode all returned VCard's, skip those without email addresses */
+                       eos = FALSE;
+                       do {
+                               LibBalsaAddress *this_addr;
+
+                               this_addr = rfc6350_parse_from_stream(data, &eos, error);
+                               if (this_addr != NULL) {
+                                       if (libbalsa_address_get_addr(this_addr) != NULL) {
+                                               addresses = g_list_prepend(addresses, this_addr);
+                                       } else {
+                                               g_object_unref(G_OBJECT(this_addr));
+                                       }
+                               }
+                       } while (!eos && (*error == NULL));
+
+                       /* clean up */
+                       g_object_unref(G_OBJECT(data));
+                       g_object_unref(G_OBJECT(stream));
+                       g_free(vcards);
+                       g_variant_unref(reply);
+
+                       /* drop list on error, reverse order otherwise */
+                       if (addresses != NULL) {
+                               if (*error != NULL) {
+                                       libbalsa_clear_list(&addresses, g_object_unref);
+                               } else {
+                                       addresses = g_list_reverse(addresses);
+                               }
+                       }
+               }
+       }
+
+       return addresses;
 }
 
-
 #endif /* HAVE_OSMO */
diff --git a/libbalsa/address-book-rubrica.c b/libbalsa/address-book-rubrica.c
index 043dd64..29205f6 100644
--- a/libbalsa/address-book-rubrica.c
+++ b/libbalsa/address-book-rubrica.c
@@ -9,14 +9,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -26,71 +26,69 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "address-book-rubrica.h"
 
 #if HAVE_RUBRICA
 
-#   include <sys/types.h>
-#   include <sys/stat.h>
-#   include <fcntl.h>
-#   include <string.h>
-#   include <unistd.h>
-#   include <libxml/parser.h>
-#   include <libxml/tree.h>
-#   include "libbalsa-conf.h"
-#   include "abook-completion.h"
-#   include "misc.h"
-#   include <glib/gi18n.h>
-
-
-static void libbalsa_address_book_rubrica_class_init(LibBalsaAddressBookRubricaClass *
-                                                     klass);
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include "libbalsa-conf.h"
+#include "abook-completion.h"
+#include "misc.h"
+#include <glib/gi18n.h>
+
+
+static void
+libbalsa_address_book_rubrica_class_init(LibBalsaAddressBookRubricaClass *
+                                        klass);
 static void libbalsa_address_book_rubrica_init(LibBalsaAddressBookRubrica *
-                                               ab_rubrica);
-static void libbalsa_address_book_rubrica_finalize(GObject *object);
+                                              ab_rubrica);
+static void libbalsa_address_book_rubrica_finalize(GObject * object);
 
 static LibBalsaABErr libbalsa_address_book_rubrica_load(LibBalsaAddressBook
-                                                                *ab,
-                                                        const gchar *
-                                                        filter,
-                                                        LibBalsaAddressBookLoadFunc
-                                                        callback,
-                                                        gpointer data);
+                                                       * ab,
+                                                       const gchar *
+                                                       filter,
+                                                       LibBalsaAddressBookLoadFunc
+                                                       callback,
+                                                       gpointer data);
 static GList
-*libbalsa_address_book_rubrica_alias_complete(LibBalsaAddressBook *ab,
-                                              const gchar         *prefix);
-static LibBalsaABErr libbalsa_address_book_rubrica_add_address(LibBalsaAddressBook *ab,
-                                                               LibBalsaAddress     *new_address);
-static LibBalsaABErr libbalsa_address_book_rubrica_remove_address(LibBalsaAddressBook *ab,
-                                                                  LibBalsaAddress     *address);
-static LibBalsaABErr libbalsa_address_book_rubrica_modify_address(LibBalsaAddressBook *ab,
-                                                                  LibBalsaAddress     *address,
-                                                                  LibBalsaAddress     *newval);
+    *libbalsa_address_book_rubrica_alias_complete(LibBalsaAddressBook * ab,
+                                                 const gchar * prefix);
+static LibBalsaABErr
+libbalsa_address_book_rubrica_add_address(LibBalsaAddressBook * ab,
+                                         LibBalsaAddress * new_address);
+static LibBalsaABErr
+libbalsa_address_book_rubrica_remove_address(LibBalsaAddressBook * ab,
+                                            LibBalsaAddress * address);
+static LibBalsaABErr
+libbalsa_address_book_rubrica_modify_address(LibBalsaAddressBook * ab,
+                                            LibBalsaAddress * address,
+                                            LibBalsaAddress * newval);
 
 static LibBalsaABErr lbab_rubrica_load_xml(LibBalsaAddressBookRubrica *
-                                           ab_rubrica,
-                                           xmlDocPtr *docptr);
-static void lbab_insert_address_node(const LibBalsaAddress *address,
-                                     xmlNodePtr             parent);
-static gboolean lbab_rubrica_starts_from(const gchar *str,
-                                         const gchar *filter_hi);
+                                          ab_rubrica, xmlDocPtr * docptr);
+static void lbab_insert_address_node(const LibBalsaAddress * address,
+                                    xmlNodePtr parent);
+static gboolean lbab_rubrica_starts_from(const gchar * str,
+                                        const gchar * filter_hi);
 
 static GSList *extract_cards(xmlNodePtr card);
-static void extract_data(xmlNodePtr entry,
-                         gchar    **first_name,
-                         gchar    **last_name,
-                         gchar    **nick_name);
-static void extract_work(xmlNodePtr entry,
-                         gchar    **org);
-static void extract_net(xmlNodePtr entry,
-                        GList    **mail_addrs);
-static gchar *xml_node_get_attr(xmlNodePtr     node,
-                                const xmlChar *attname);
+static void extract_data(xmlNodePtr entry, gchar ** first_name,
+                        gchar ** last_name, gchar ** nick_name);
+static void extract_work(xmlNodePtr entry, gchar ** org);
+static void extract_net(xmlNodePtr entry, GList ** mail_addrs);
+static gchar *xml_node_get_attr(xmlNodePtr node, const xmlChar * attname);
 static gchar *xml_node_get_text(xmlNodePtr node);
 
-#   define CXMLCHARP(x)  ((const xmlChar *)(x))
+#define CXMLCHARP(x)  ((const xmlChar *)(x))
 
 struct _LibBalsaAddressBookRubrica {
     LibBalsaAddressBookText parent;
@@ -117,12 +115,12 @@ struct _LibBalsaAddressBookRubricaClass {
 };
 
 G_DEFINE_TYPE(LibBalsaAddressBookRubrica, libbalsa_address_book_rubrica,
-              LIBBALSA_TYPE_ADDRESS_BOOK_TEXT);
+        LIBBALSA_TYPE_ADDRESS_BOOK_TEXT);
 
 
 static void
 libbalsa_address_book_rubrica_class_init(LibBalsaAddressBookRubricaClass *
-                                         klass)
+                                        klass)
 {
     LibBalsaAddressBookClass *address_book_class;
     GObjectClass *object_class;
@@ -134,19 +132,18 @@ libbalsa_address_book_rubrica_class_init(LibBalsaAddressBookRubricaClass *
 
     address_book_class->load = libbalsa_address_book_rubrica_load;
     address_book_class->add_address =
-        libbalsa_address_book_rubrica_add_address;
+       libbalsa_address_book_rubrica_add_address;
     address_book_class->remove_address =
-        libbalsa_address_book_rubrica_remove_address;
+       libbalsa_address_book_rubrica_remove_address;
     address_book_class->modify_address =
-        libbalsa_address_book_rubrica_modify_address;
+       libbalsa_address_book_rubrica_modify_address;
 
     address_book_class->alias_complete =
-        libbalsa_address_book_rubrica_alias_complete;
+       libbalsa_address_book_rubrica_alias_complete;
 }
 
-
 static void
-libbalsa_address_book_rubrica_init(LibBalsaAddressBookRubrica *ab_rubrica)
+libbalsa_address_book_rubrica_init(LibBalsaAddressBookRubrica * ab_rubrica)
 {
     ab_rubrica->name_complete =
         libbalsa_completion_new((LibBalsaCompletionFunc)
@@ -154,9 +151,8 @@ libbalsa_address_book_rubrica_init(LibBalsaAddressBookRubrica *ab_rubrica)
     libbalsa_completion_set_compare(ab_rubrica->name_complete, strncmp_word);
 }
 
-
 static void
-libbalsa_address_book_rubrica_finalize(GObject *object)
+libbalsa_address_book_rubrica_finalize(GObject * object)
 {
     LibBalsaAddressBookRubrica *ab_rubrica;
 
@@ -167,20 +163,18 @@ libbalsa_address_book_rubrica_finalize(GObject *object)
     G_OBJECT_CLASS(libbalsa_address_book_rubrica_parent_class)->finalize(object);
 }
 
-
 /* Public method */
 LibBalsaAddressBook *
-libbalsa_address_book_rubrica_new(const gchar *name,
-                                  const gchar *path)
+libbalsa_address_book_rubrica_new(const gchar * name, const gchar * path)
 {
     LibBalsaAddressBookRubrica *ab_rubrica;
     LibBalsaAddressBookText *ab_text;
     LibBalsaAddressBook *ab;
 
     ab_rubrica =
-        LIBBALSA_ADDRESS_BOOK_RUBRICA(g_object_new
-                                          (LIBBALSA_TYPE_ADDRESS_BOOK_RUBRICA,
-                                          NULL));
+       LIBBALSA_ADDRESS_BOOK_RUBRICA(g_object_new
+                                     (LIBBALSA_TYPE_ADDRESS_BOOK_RUBRICA,
+                                      NULL));
     ab_text = LIBBALSA_ADDRESS_BOOK_TEXT(ab_rubrica);
     ab = LIBBALSA_ADDRESS_BOOK(ab_rubrica);
 
@@ -190,16 +184,15 @@ libbalsa_address_book_rubrica_new(const gchar *name,
     return ab;
 }
 
-
 /* Class methods */
 static LibBalsaABErr
-libbalsa_address_book_rubrica_load(LibBalsaAddressBook        *ab,
-                                   const gchar                *filter,
-                                   LibBalsaAddressBookLoadFunc callback,
-                                   gpointer                    data)
+libbalsa_address_book_rubrica_load(LibBalsaAddressBook * ab,
+                                  const gchar * filter,
+                                  LibBalsaAddressBookLoadFunc callback,
+                                  gpointer data)
 {
     LibBalsaAddressBookRubrica *ab_rubrica =
-        LIBBALSA_ADDRESS_BOOK_RUBRICA(ab);
+       LIBBALSA_ADDRESS_BOOK_RUBRICA(ab);
     LibBalsaAddressBookText *ab_text = LIBBALSA_ADDRESS_BOOK_TEXT(ab);
     LibBalsaABErr load_res;
     gchar *filter_hi = NULL;
@@ -210,59 +203,51 @@ libbalsa_address_book_rubrica_load(LibBalsaAddressBook        *ab,
 
     /* try to load the xml file if necessary */
     load_res = lbab_rubrica_load_xml(ab_rubrica, NULL);
-    if (load_res != LBABERR_OK) {
-        return load_res;
-    }
+    if (load_res != LBABERR_OK)
+       return load_res;
 
-    if (filter) {
-        filter_hi = g_utf8_strup(filter, -1);
-    }
+    if (filter)
+       filter_hi = g_utf8_strup(filter, -1);
 
     for (list = ab_rubrica->item_list; list; list = list->next) {
-        LibBalsaAddress *address = LIBBALSA_ADDRESS(list->data);
+       LibBalsaAddress *address = LIBBALSA_ADDRESS(list->data);
 
-        if (!address) {
-            continue;
-        }
+       if (!address)
+           continue;
 
-        if (callback &&
-            (!filter_hi ||
-             lbab_rubrica_starts_from(libbalsa_address_get_last_name(address), filter_hi) ||
-             lbab_rubrica_starts_from(libbalsa_address_get_full_name(address), filter_hi))) {
-            callback(ab, address, data);
-        }
-    }
-    if (callback) {
-        callback(ab, NULL, data);
+       if (callback &&
+           (!filter_hi ||
+            lbab_rubrica_starts_from(libbalsa_address_get_last_name(address), filter_hi) ||
+            lbab_rubrica_starts_from(libbalsa_address_get_full_name(address), filter_hi)))
+           callback(ab, address, data);
     }
+    if (callback)
+       callback(ab, NULL, data);
 
     g_free(filter_hi);
 
     return LBABERR_OK;
 }
 
-
 /* Alias complete method */
 static GList *
-libbalsa_address_book_rubrica_alias_complete(LibBalsaAddressBook *ab,
-                                             const gchar         *prefix)
+libbalsa_address_book_rubrica_alias_complete(LibBalsaAddressBook * ab,
+                                            const gchar * prefix)
 {
     LibBalsaAddressBookRubrica *ab_rubrica =
         LIBBALSA_ADDRESS_BOOK_RUBRICA(ab);
     GList *list;
     GList *res = NULL;
 
-    if (!libbalsa_address_book_get_expand_aliases(ab)) {
+    if (!libbalsa_address_book_get_expand_aliases(ab))
         return NULL;
-    }
 
-    if (lbab_rubrica_load_xml(ab_rubrica, NULL) != LBABERR_OK) {
+    if (lbab_rubrica_load_xml(ab_rubrica, NULL) != LBABERR_OK)
         return NULL;
-    }
 
     for (list =
-             libbalsa_completion_complete(ab_rubrica->name_complete,
-                                          (gchar *) prefix);
+         libbalsa_completion_complete(ab_rubrica->name_complete,
+                                      (gchar *) prefix);
          list != NULL; list = list->next) {
         InternetAddress *ia = ((CompletionData *) list->data)->ia;
         res = g_list_prepend(res, g_object_ref(ia));
@@ -271,14 +256,13 @@ libbalsa_address_book_rubrica_alias_complete(LibBalsaAddressBook *ab,
     return g_list_reverse(res);
 }
 
-
 /* store address method */
 static LibBalsaABErr
-libbalsa_address_book_rubrica_add_address(LibBalsaAddressBook *ab,
-                                          LibBalsaAddress     *new_address)
+libbalsa_address_book_rubrica_add_address(LibBalsaAddressBook * ab,
+                                         LibBalsaAddress * new_address)
 {
     LibBalsaAddressBookRubrica *ab_rubrica =
-        LIBBALSA_ADDRESS_BOOK_RUBRICA(ab);
+       LIBBALSA_ADDRESS_BOOK_RUBRICA(ab);
     LibBalsaAddressBookText *ab_text = LIBBALSA_ADDRESS_BOOK_TEXT(ab);
     const gchar *path;
     int fd;
@@ -288,79 +272,74 @@ libbalsa_address_book_rubrica_add_address(LibBalsaAddressBook *ab,
 
     /* try to load the current file (an empty file is ok) */
     result = lbab_rubrica_load_xml(ab_rubrica, &doc);
-    if ((result != LBABERR_OK) && (result != LBABERR_CANNOT_READ)) {
-        return result;
-    }
+    if (result != LBABERR_OK && result != LBABERR_CANNOT_READ)
+       return result;
 
     /* eject if we already have this address */
     if (g_slist_find_custom(ab_rubrica->item_list, new_address,
-                            (GCompareFunc) libbalsa_address_compare)) {
-        xmlFreeDoc(doc);
-        return LBABERR_DUPLICATE;
+                           (GCompareFunc) libbalsa_address_compare)) {
+       xmlFreeDoc(doc);
+       return LBABERR_DUPLICATE;
     }
 
     /* try to open the address book for writing */
     path = libbalsa_address_book_text_get_path(ab_text);
     if ((fd = open(path, O_WRONLY | O_CREAT, 0666)) == -1) {
-        xmlFreeDoc(doc);
-        return LBABERR_CANNOT_WRITE;
+       xmlFreeDoc(doc);
+       return LBABERR_CANNOT_WRITE;
     }
     if (libbalsa_lock_file(path, fd, TRUE, TRUE, FALSE) < 0) {
-        xmlFreeDoc(doc);
-        close(fd);
-        return LBABERR_CANNOT_WRITE;
+       xmlFreeDoc(doc);
+       close(fd);
+       return LBABERR_CANNOT_WRITE;
     }
 
     /* create a new xml document if necessary */
     if (!doc) {
-        doc = xmlNewDoc(CXMLCHARP("1.0"));
-        root_element =
-            xmlNewDocNode(doc, NULL, CXMLCHARP("Rubrica"), NULL);
-        xmlDocSetRootElement(doc, root_element);
-        xmlNewProp(root_element, CXMLCHARP("version"), CXMLCHARP("2.0.1"));
-        xmlNewProp(root_element, CXMLCHARP("fileformat"), CXMLCHARP("0"));
-        xmlNewProp(root_element, CXMLCHARP("doctype"),
-                   CXMLCHARP("AddressBook"));
-    } else {
-        root_element = xmlDocGetRootElement(doc);
-    }
+       doc = xmlNewDoc(CXMLCHARP("1.0"));
+       root_element =
+           xmlNewDocNode(doc, NULL, CXMLCHARP("Rubrica"), NULL);
+       xmlDocSetRootElement(doc, root_element);
+       xmlNewProp(root_element, CXMLCHARP("version"), CXMLCHARP("2.0.1"));
+       xmlNewProp(root_element, CXMLCHARP("fileformat"), CXMLCHARP("0"));
+       xmlNewProp(root_element, CXMLCHARP("doctype"),
+                  CXMLCHARP("AddressBook"));
+    } else
+       root_element = xmlDocGetRootElement(doc);
 
     /* insert a new card */
     lbab_insert_address_node(new_address, root_element);
 
     /* store the document */
-    if (xmlSaveFormatFileEnc(path, doc, "UTF-8", 1) == -1) {
-        result = LBABERR_CANNOT_WRITE;
-    } else {
-        result = LBABERR_OK;
-    }
+    if (xmlSaveFormatFileEnc(path, doc, "UTF-8", 1) == -1)
+       result = LBABERR_CANNOT_WRITE;
+    else
+       result = LBABERR_OK;
     libbalsa_unlock_file(path, fd, FALSE);
     close(fd);
     xmlFreeDoc(doc);
-    ab_rubrica->mtime = 0;      /* force re-load upon the next access */
+    ab_rubrica->mtime = 0;     /* force re-load upon the next access */
 
     /* done */
     return result;
 }
 
-
 /* Remove address method */
 static LibBalsaABErr
-libbalsa_address_book_rubrica_remove_address(LibBalsaAddressBook *ab,
-                                             LibBalsaAddress     *address)
+libbalsa_address_book_rubrica_remove_address(LibBalsaAddressBook * ab,
+                                            LibBalsaAddress * address)
 {
     return libbalsa_address_book_rubrica_modify_address(ab, address, NULL);
 }
 
-
 /* Remove address method */
 static LibBalsaABErr
-libbalsa_address_book_rubrica_modify_address(LibBalsaAddressBook *ab,
-                                             LibBalsaAddress     *address,
-                                             LibBalsaAddress     *newval)
+libbalsa_address_book_rubrica_modify_address(LibBalsaAddressBook * ab,
+                                            LibBalsaAddress * address,
+                                            LibBalsaAddress * newval)
 {
     LibBalsaAddressBookRubrica *ab_rubrica =
-        LIBBALSA_ADDRESS_BOOK_RUBRICA(ab);
+       LIBBALSA_ADDRESS_BOOK_RUBRICA(ab);
     LibBalsaAddressBookText *ab_text = LIBBALSA_ADDRESS_BOOK_TEXT(ab);
     int fd;
     xmlDocPtr doc = NULL;
@@ -371,31 +350,30 @@ libbalsa_address_book_rubrica_modify_address(LibBalsaAddressBook *ab,
     const gchar *path;
 
     /* try to load the current file */
-    if ((result = lbab_rubrica_load_xml(ab_rubrica, &doc)) != LBABERR_OK) {
-        return result;
-    }
+    if ((result = lbab_rubrica_load_xml(ab_rubrica, &doc)) != LBABERR_OK)
+       return result;
 
     /* check if we have a node with the correct full name */
     if (!(root_element = xmlDocGetRootElement(doc)) ||
-        xmlStrcmp(root_element->name, CXMLCHARP("Rubrica"))) {
-        xmlFreeDoc(doc);
-        return LBABERR_ADDRESS_NOT_FOUND;
+       xmlStrcmp(root_element->name, CXMLCHARP("Rubrica"))) {
+       xmlFreeDoc(doc);
+       return LBABERR_ADDRESS_NOT_FOUND;
     }
     card = root_element->children;
     found = FALSE;
     while (card && !found) {
-        if (xmlStrcmp(card->name, CXMLCHARP("Card"))) {
-            gchar *full_name = xml_node_get_attr(card, CXMLCHARP("name"));
+       if (xmlStrcmp(card->name, CXMLCHARP("Card"))) {
+           gchar *full_name = xml_node_get_attr(card, CXMLCHARP("name"));
 
-            if (full_name) {
-                found = !g_ascii_strcasecmp(libbalsa_address_get_full_name(address), full_name);
-                g_free(full_name);
-            }
-        }
+           if (full_name) {
+               found = !g_ascii_strcasecmp(libbalsa_address_get_full_name(address), full_name);
+               g_free(full_name);
+           }
+       }
     }
     if (!found) {
-        xmlFreeDoc(doc);
-        return LBABERR_ADDRESS_NOT_FOUND;
+       xmlFreeDoc(doc);
+       return LBABERR_ADDRESS_NOT_FOUND;
     }
 
     /* remove the card from the document */
@@ -403,42 +381,39 @@ libbalsa_address_book_rubrica_modify_address(LibBalsaAddressBook *ab,
     xmlFreeNode(card);
 
     /* add the new card */
-    if (newval) {
-        lbab_insert_address_node(newval, root_element);
-    }
+    if (newval)
+       lbab_insert_address_node(newval, root_element);
 
     path = libbalsa_address_book_text_get_path(ab_text);
     /* try to open the address book for writing */
     if ((fd = open(path, O_WRONLY | O_CREAT, 0666)) == -1) {
-        xmlFreeDoc(doc);
-        return LBABERR_CANNOT_WRITE;
+       xmlFreeDoc(doc);
+       return LBABERR_CANNOT_WRITE;
     }
     if (libbalsa_lock_file(path, fd, TRUE, TRUE, FALSE) < 0) {
-        xmlFreeDoc(doc);
-        close(fd);
-        return LBABERR_CANNOT_WRITE;
+       xmlFreeDoc(doc);
+       close(fd);
+       return LBABERR_CANNOT_WRITE;
     }
 
     /* store the document */
-    if (xmlSaveFormatFileEnc(path, doc, "UTF-8", 1) == -1) {
-        result = LBABERR_CANNOT_WRITE;
-    } else {
-        result = LBABERR_OK;
-    }
+    if (xmlSaveFormatFileEnc(path, doc, "UTF-8", 1) == -1)
+       result = LBABERR_CANNOT_WRITE;
+    else
+       result = LBABERR_OK;
     libbalsa_unlock_file(path, fd, FALSE);
     close(fd);
     xmlFreeDoc(doc);
-    ab_rubrica->mtime = 0;      /* force re-load upon the next access */
+    ab_rubrica->mtime = 0;     /* force re-load upon the next access */
 
     /* done */
     return result;
 }
 
-
 /* -- helpers -- */
 static LibBalsaABErr
-lbab_rubrica_load_xml(LibBalsaAddressBookRubrica *ab_rubrica,
-                      xmlDocPtr                  *docptr)
+lbab_rubrica_load_xml(LibBalsaAddressBookRubrica * ab_rubrica,
+                     xmlDocPtr * docptr)
 {
     LibBalsaAddressBook *ab = LIBBALSA_ADDRESS_BOOK(ab_rubrica);
     LibBalsaAddressBookText *ab_text = LIBBALSA_ADDRESS_BOOK_TEXT(ab_rubrica);
@@ -452,18 +427,16 @@ lbab_rubrica_load_xml(LibBalsaAddressBookRubrica *ab_rubrica,
     GSList *list;
 
     /* init the return pointer (if any) */
-    if (docptr) {
-        *docptr = NULL;
-    }
+    if (docptr)
+       *docptr = NULL;
 
     /* eject if the file did not change on disk and no document result pointer is passed */
     path = libbalsa_address_book_text_get_path(ab_text);
-    if (!docptr && (stat(path, &stat_buf) == 0)) {
-        if (stat_buf.st_mtime == ab_rubrica->mtime) {
-            return LBABERR_OK;
-        } else {
-            ab_rubrica->mtime = stat_buf.st_mtime;
-        }
+    if (!docptr && stat(path, &stat_buf) == 0) {
+       if (stat_buf.st_mtime == ab_rubrica->mtime)
+           return LBABERR_OK;
+       else
+           ab_rubrica->mtime = stat_buf.st_mtime;
     }
 
     /* free old data */
@@ -472,77 +445,71 @@ lbab_rubrica_load_xml(LibBalsaAddressBookRubrica *ab_rubrica,
 
 
     /* try to read the address book */
-    if ((fd = open(path, O_RDONLY)) == -1) {
-        return LBABERR_CANNOT_READ;
-    }
+    if ((fd = open(path, O_RDONLY)) == -1)
+       return LBABERR_CANNOT_READ;
     if (libbalsa_lock_file(path, fd, FALSE, TRUE, FALSE) < 0) {
-        close(fd);
-        return LBABERR_CANNOT_READ;
+       close(fd);
+       return LBABERR_CANNOT_READ;
     }
 
     doc = xmlParseFile(path);
     libbalsa_unlock_file(path, fd, FALSE);
     close(fd);
-    if (!doc) {
-        return LBABERR_CANNOT_READ;
-    }
+    if (!doc)
+       return LBABERR_CANNOT_READ;
 
     /* Get the root element node and extract cards if it is a Rubrica book */
     root_element = xmlDocGetRootElement(doc);
-    if (!xmlStrcmp(root_element->name, CXMLCHARP("Rubrica"))) {
-        ab_rubrica->item_list = extract_cards(root_element->children);
-    }
+    if (!xmlStrcmp(root_element->name, CXMLCHARP("Rubrica")))
+       ab_rubrica->item_list = extract_cards(root_element->children);
 
     /* return the document if requested of free it */
-    if (docptr) {
-        *docptr = doc;
-    } else {
-        xmlFreeDoc(doc);
-    }
+    if (docptr)
+       *docptr = doc;
+    else
+       xmlFreeDoc(doc);
 
     /* build the completion list */
     // FIXME - Rubrica provides groups...
     completion_list = NULL;
     for (list = ab_rubrica->item_list; list; list = list->next) {
-        LibBalsaAddress *address = LIBBALSA_ADDRESS(list->data);
-        GList *l;
+       LibBalsaAddress *address = LIBBALSA_ADDRESS(list->data);
+       GList *l;
         GList *addr_list;
 
-        if (!address) {
-            continue;
-        }
+       if (!address)
+           continue;
 
         addr_list = libbalsa_address_get_addr_list(address);
-        if (libbalsa_address_book_get_dist_list_mode(ab)
-            && (addr_list != NULL) && (addr_list->next != NULL)) {
-            /* Create a group address. */
-            InternetAddress *ia =
-                internet_address_group_new(libbalsa_address_get_full_name(address));
+       if (libbalsa_address_book_get_dist_list_mode(ab)
+            && addr_list != NULL && addr_list->next != NULL) {
+           /* Create a group address. */
+           InternetAddress *ia =
+               internet_address_group_new(libbalsa_address_get_full_name(address));
             InternetAddressGroup *group = (InternetAddressGroup *) ia;
 
-            for (l = addr_list; l != NULL; l = l->next) {
-                InternetAddress *member =
-                    internet_address_mailbox_new(NULL, l->data);
-                internet_address_group_add_member(group, member);
-                g_object_unref(member);
-            }
-            cmp_data = completion_data_new(ia, libbalsa_address_get_nick_name(address));
-            completion_list = g_list_prepend(completion_list, cmp_data);
-            g_object_unref(ia);
-        } else {
-            /* Create name addresses. */
-            GList *l;
-
-            for (l = addr_list; l != NULL; l = l->next) {
-                InternetAddress *ia =
-                    internet_address_mailbox_new(libbalsa_address_get_full_name(
-                                                     address), l->data);
-                cmp_data = completion_data_new(ia, libbalsa_address_get_nick_name(address));
-                completion_list =
-                    g_list_prepend(completion_list, cmp_data);
-                g_object_unref(ia);
-            }
-        }
+           for (l = addr_list; l != NULL; l = l->next) {
+               InternetAddress *member =
+                   internet_address_mailbox_new(NULL, l->data);
+               internet_address_group_add_member(group, member);
+               g_object_unref(member);
+           }
+           cmp_data = completion_data_new(ia, libbalsa_address_get_nick_name(address));
+           completion_list = g_list_prepend(completion_list, cmp_data);
+           g_object_unref(ia);
+       } else {
+           /* Create name addresses. */
+           GList *l;
+
+           for (l = addr_list; l != NULL; l = l->next) {
+               InternetAddress *ia =
+                   internet_address_mailbox_new(libbalsa_address_get_full_name(address), l->data);
+               cmp_data = completion_data_new(ia, libbalsa_address_get_nick_name(address));
+               completion_list =
+                   g_list_prepend(completion_list, cmp_data);
+               g_object_unref(ia);
+           }
+       }
     }
 
     completion_list = g_list_reverse(completion_list);
@@ -552,10 +519,9 @@ lbab_rubrica_load_xml(LibBalsaAddressBookRubrica *ab_rubrica,
     return LBABERR_OK;
 }
 
-
 static void
-lbab_insert_address_node(const LibBalsaAddress *address,
-                         xmlNodePtr             parent)
+lbab_insert_address_node(const LibBalsaAddress * address,
+                        xmlNodePtr parent)
 {
     xmlNodePtr new_addr;
     xmlNodePtr new_data;
@@ -568,42 +534,39 @@ lbab_insert_address_node(const LibBalsaAddress *address,
     /* create the Data section of the card */
     new_data = xmlNewChild(new_addr, NULL, CXMLCHARP("Data"), NULL);
     xmlNewChild(new_data, NULL, CXMLCHARP("FirstName"),
-                CXMLCHARP(libbalsa_address_get_first_name(address)));
+               CXMLCHARP(libbalsa_address_get_first_name(address)));
     xmlNewChild(new_data, NULL, CXMLCHARP("LastName"),
-                CXMLCHARP(libbalsa_address_get_last_name(address)));
+               CXMLCHARP(libbalsa_address_get_last_name(address)));
     xmlNewChild(new_data, NULL, CXMLCHARP("NickName"),
-                CXMLCHARP(libbalsa_address_get_nick_name(address)));
+               CXMLCHARP(libbalsa_address_get_nick_name(address)));
 
     /* create the Work section of the card */
     new_data = xmlNewChild(new_addr, NULL, CXMLCHARP("Work"), NULL);
     xmlNewChild(new_data, NULL, CXMLCHARP("Organization"),
-                CXMLCHARP(libbalsa_address_get_organization(address)));
+               CXMLCHARP(libbalsa_address_get_organization(address)));
 
     /* create the Net section of the card */
     new_data = xmlNewChild(new_addr, NULL, CXMLCHARP("Net"), NULL);
     for (l = libbalsa_address_get_addr_list(address); l != NULL; l = l->next) {
-        xmlNodePtr new_mail =
-            xmlNewChild(new_data, NULL, CXMLCHARP("Uri"),
-                        CXMLCHARP(l->data));
-        xmlNewProp(new_mail, CXMLCHARP("type"), CXMLCHARP("email"));
+       xmlNodePtr new_mail =
+           xmlNewChild(new_data, NULL, CXMLCHARP("Uri"),
+                       CXMLCHARP(l->data));
+       xmlNewProp(new_mail, CXMLCHARP("type"), CXMLCHARP("email"));
     }
 }
 
-
 /* Case-insensitive utf-8 string-has-prefix */
 static gboolean
-lbab_rubrica_starts_from(const gchar *str,
-                         const gchar *filter_hi)
+lbab_rubrica_starts_from(const gchar * str, const gchar * filter_hi)
 {
-    if (!str) {
-        return FALSE;
-    }
+    if (!str)
+       return FALSE;
 
     while (*str && *filter_hi &&
-           g_unichar_toupper(g_utf8_get_char(str)) ==
-           g_utf8_get_char(filter_hi)) {
-        str = g_utf8_next_char(str);
-        filter_hi = g_utf8_next_char(filter_hi);
+          g_unichar_toupper(g_utf8_get_char(str)) ==
+          g_utf8_get_char(filter_hi)) {
+       str = g_utf8_next_char(str);
+       filter_hi = g_utf8_next_char(filter_hi);
     }
 
     return *filter_hi == '\0';
@@ -617,24 +580,24 @@ extract_cards(xmlNodePtr card)
     GSList *addrlist = NULL;
 
     while (card) {
-        if (!xmlStrcmp(card->name, CXMLCHARP("Card"))) {
-            LibBalsaAddress *address = libbalsa_address_new();
-            xmlNodePtr children;
+       if (!xmlStrcmp(card->name, CXMLCHARP("Card"))) {
+           LibBalsaAddress *address = libbalsa_address_new();
+           xmlNodePtr children;
             gchar *full_name;
             GList *address_list = NULL;
 
             full_name = xml_node_get_attr(card, CXMLCHARP("name"));
-            libbalsa_address_set_full_name(address, full_name);
+           libbalsa_address_set_full_name(address, full_name);
             g_free(full_name);
 
-            children = card->children;
-            while (children) {
-                if (!xmlStrcmp(children->name, CXMLCHARP("Data"))) {
+           children = card->children;
+           while (children) {
+               if (!xmlStrcmp(children->name, CXMLCHARP("Data"))) {
                     gchar *first_name;
                     gchar *last_name = NULL;
                     gchar *nick_name = NULL;
 
-                    extract_data(children->children,
+                   extract_data(children->children,
                                  &first_name, &last_name, &nick_name);
 
                     libbalsa_address_set_first_name(address, first_name);
@@ -647,25 +610,24 @@ extract_cards(xmlNodePtr card)
                 } else if (!xmlStrcmp(children->name, CXMLCHARP("Work"))) {
                     gchar *organization = NULL;
 
-                    extract_work(children->children, &organization);
+                   extract_work(children->children, &organization);
                     libbalsa_address_set_organization(address, organization);
                     g_free(organization);
                 } else if (!xmlStrcmp(children->name, CXMLCHARP("Net"))) {
-                    extract_net(children->children, &address_list);
+                   extract_net(children->children, &address_list);
                     libbalsa_address_set_addr_list(address, address_list);
                 }
 
-                children = children->next;
-            }
+               children = children->next;
+           }
 
-            if (address_list != NULL) {
-                addrlist = g_slist_prepend(addrlist, address);
-            } else {
-                g_object_unref(address);
-            }
-        }
+           if (address_list != NULL)
+               addrlist = g_slist_prepend(addrlist, address);
+           else
+               g_object_unref(address);
+       }
 
-        card = card->next;
+       card = card->next;
     }
 
     return addrlist;
@@ -673,10 +635,8 @@ extract_cards(xmlNodePtr card)
 
 
 static void
-extract_data(xmlNodePtr entry,
-             gchar    **first_name,
-             gchar    **last_name,
-             gchar    **nick_name)
+extract_data(xmlNodePtr entry, gchar ** first_name, gchar ** last_name,
+            gchar ** nick_name)
 {
     gchar *title = NULL;
     gchar *prefix = NULL;
@@ -685,96 +645,88 @@ extract_data(xmlNodePtr entry,
     GString *_first_name = NULL;
 
     while (entry) {
-        if (!xmlStrcmp(entry->name, CXMLCHARP("FirstName"))) {
-            first = xml_node_get_text(entry);
-        } else if (!xmlStrcmp(entry->name, CXMLCHARP("MiddleName"))) {
-            middle = xml_node_get_text(entry);
-        } else if (!xmlStrcmp(entry->name, CXMLCHARP("Title"))) {
-            title = xml_node_get_text(entry);
-        } else if (!xmlStrcmp(entry->name, CXMLCHARP("NamePrefix"))) {
-            prefix = xml_node_get_text(entry);
-        } else if (!xmlStrcmp(entry->name, CXMLCHARP("LastName"))) {
-            *last_name = xml_node_get_text(entry);
-        } else if (!xmlStrcmp(entry->name, CXMLCHARP("NickName"))) {
-            *nick_name = xml_node_get_text(entry);
-        }
-
-        entry = entry->next;
+       if (!xmlStrcmp(entry->name, CXMLCHARP("FirstName")))
+           first = xml_node_get_text(entry);
+       else if (!xmlStrcmp(entry->name, CXMLCHARP("MiddleName")))
+           middle = xml_node_get_text(entry);
+       else if (!xmlStrcmp(entry->name, CXMLCHARP("Title")))
+           title = xml_node_get_text(entry);
+       else if (!xmlStrcmp(entry->name, CXMLCHARP("NamePrefix")))
+           prefix = xml_node_get_text(entry);
+       else if (!xmlStrcmp(entry->name, CXMLCHARP("LastName")))
+           *last_name = xml_node_get_text(entry);
+       else if (!xmlStrcmp(entry->name, CXMLCHARP("NickName")))
+           *nick_name = xml_node_get_text(entry);
+
+       entry = entry->next;
     }
 
     /* construct first name */
-    if (title) {
-        _first_name = g_string_new(title);
-    }
+    if (title)
+       _first_name = g_string_new(title);
 
     if (prefix) {
-        if (_first_name) {
-            _first_name = g_string_append_c(_first_name, ' ');
-            _first_name = g_string_append(_first_name, prefix);
-        } else {
-            _first_name = g_string_new(prefix);
-        }
+       if (_first_name) {
+           _first_name = g_string_append_c(_first_name, ' ');
+           _first_name = g_string_append(_first_name, prefix);
+       } else
+           _first_name = g_string_new(prefix);
     }
 
     if (first) {
-        if (_first_name) {
-            _first_name = g_string_append_c(_first_name, ' ');
-            _first_name = g_string_append(_first_name, first);
-        } else {
-            _first_name = g_string_new(first);
-        }
+       if (_first_name) {
+           _first_name = g_string_append_c(_first_name, ' ');
+           _first_name = g_string_append(_first_name, first);
+       } else
+           _first_name = g_string_new(first);
     }
 
     if (middle) {
-        if (_first_name) {
-            _first_name = g_string_append_c(_first_name, ' ');
-            _first_name = g_string_append(_first_name, middle);
-        } else {
-            _first_name = g_string_new(middle);
-        }
+       if (_first_name) {
+           _first_name = g_string_append_c(_first_name, ' ');
+           _first_name = g_string_append(_first_name, middle);
+       } else
+           _first_name = g_string_new(middle);
     }
 
-    if (_first_name) {
-        *first_name = g_string_free(_first_name, FALSE);
-    } else {
-        *first_name = NULL;
-    }
+    if (_first_name)
+       *first_name = g_string_free(_first_name, FALSE);
+    else
+       *first_name = NULL;
 }
 
 
 static void
-extract_work(xmlNodePtr entry,
-             gchar    **org)
+extract_work(xmlNodePtr entry, gchar ** org)
 {
     while (entry) {
-        if (!xmlStrcmp(entry->name, CXMLCHARP("Organization"))) {
-            *org = xml_node_get_text(entry);
-            return;
-        }
+       if (!xmlStrcmp(entry->name, CXMLCHARP("Organization"))) {
+           *org = xml_node_get_text(entry);
+           return;
+       }
 
-        entry = entry->next;
+       entry = entry->next;
     }
 }
 
 
 static void
-extract_net(xmlNodePtr entry,
-            GList    **mail_addrs)
+extract_net(xmlNodePtr entry, GList ** mail_addrs)
 {
     while (entry != NULL) {
-        if (!xmlStrcmp(entry->name, CXMLCHARP("Uri"))) {
+       if (!xmlStrcmp(entry->name, CXMLCHARP("Uri"))) {
             gchar *uri_type = NULL;
             gchar *mail_addr;
 
-            uri_type = xml_node_get_attr(entry, CXMLCHARP("type"));
-            if ((g_strcmp0(uri_type, "email") == 0)
-                && ((mail_addr = xml_node_get_text(entry)) != NULL)) {
+           uri_type = xml_node_get_attr(entry, CXMLCHARP("type"));
+           if (g_strcmp0(uri_type, "email") == 0
+                && (mail_addr = xml_node_get_text(entry)) != NULL) {
                 *mail_addrs = g_list_prepend(*mail_addrs, mail_addr);
             }
             g_free(uri_type);
         }
 
-        entry = entry->next;
+       entry = entry->next;
     }
 }
 
@@ -784,17 +736,15 @@ xml_node_get_text(xmlNodePtr node)
 {
     g_return_val_if_fail(node != NULL, NULL);
 
-    if (((node = node->children) != NULL) && (node->type == XML_TEXT_NODE)) {
-        return g_strdup((const gchar *) node->content);
-    }
+    if ((node = node->children) != NULL && node->type == XML_TEXT_NODE)
+       return g_strdup((const gchar *) node->content);
 
     return NULL;
 }
 
 
 static gchar *
-xml_node_get_attr(xmlNodePtr     node,
-                  const xmlChar *attname)
+xml_node_get_attr(xmlNodePtr node, const xmlChar * attname)
 {
     xmlAttrPtr props;
 
@@ -802,16 +752,16 @@ xml_node_get_attr(xmlNodePtr     node,
 
     props = node->properties;
     while (props != NULL) {
-        if ((props->type == XML_ATTRIBUTE_NODE)
-            && !xmlStrcmp(props->name, attname) && props->children
-            && (props->children->type == XML_TEXT_NODE)) {
-            return g_strdup((const gchar *) props->children->content);
+       if (props->type == XML_ATTRIBUTE_NODE
+           && !xmlStrcmp(props->name, attname) && props->children
+           && props->children->type == XML_TEXT_NODE) {
+           return g_strdup((const gchar *) props->children->content);
         }
-        props = props->next;
+       props = props->next;
     }
 
     return NULL;
 }
 
 
-#endif                          /* HAVE_RUBRICA */
+#endif                         /* HAVE_RUBRICA */
diff --git a/libbalsa/address-book-rubrica.h b/libbalsa/address-book-rubrica.h
index 2934dac..2902c5a 100644
--- a/libbalsa/address-book-rubrica.h
+++ b/libbalsa/address-book-rubrica.h
@@ -9,14 +9,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -34,7 +34,7 @@
 G_DECLARE_FINAL_TYPE(LibBalsaAddressBookRubrica, libbalsa_address_book_rubrica,
                      LIBBALSA, ADDRESS_BOOK_RUBRICA, LibBalsaAddressBookText)
 
-LibBalsaAddressBook * libbalsa_address_book_rubrica_new(const gchar * name,
-                                                        const gchar * path);
+LibBalsaAddressBook *libbalsa_address_book_rubrica_new(const gchar * name,
+                                                      const gchar * path);
 
-#endif                          /* __LIBBALSA_ADDRESS_BOOK_RUBRICA_H__ */
+#endif                         /* __LIBBALSA_ADDRESS_BOOK_RUBRICA_H__ */
diff --git a/libbalsa/address-book-text.c b/libbalsa/address-book-text.c
index 3b0795b..3d06fe2 100644
--- a/libbalsa/address-book-text.c
+++ b/libbalsa/address-book-text.c
@@ -6,27 +6,27 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
  * LibBalsaAddressBookText
- *
+ * 
  * The code that is common to vCard (== GnomeCard) and LDIF address
  * books ...
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "address-book-text.h"
 
@@ -44,29 +44,39 @@
 /* FIXME: Arbitrary constant */
 #define LINE_LEN 256
 
-static void libbalsa_address_book_text_class_init(LibBalsaAddressBookTextClass *
-                                                  klass);
-static void libbalsa_address_book_text_init(LibBalsaAddressBookText *ab_text);
-static void libbalsa_address_book_text_finalize(GObject *object);
-
-static LibBalsaABErr libbalsa_address_book_text_load(LibBalsaAddressBook        *ab,
-                                                     const gchar                *filter,
-                                                     LibBalsaAddressBookLoadFunc callback,
-                                                     gpointer                    data);
-static LibBalsaABErr libbalsa_address_book_text_add_address(LibBalsaAddressBook *ab,
-                                                            LibBalsaAddress     *address);
-static LibBalsaABErr libbalsa_address_book_text_remove_address(LibBalsaAddressBook *ab,
-                                                               LibBalsaAddress     *address);
-static LibBalsaABErr libbalsa_address_book_text_modify_address(LibBalsaAddressBook *ab,
-                                                               LibBalsaAddress     *address,
-                                                               LibBalsaAddress     *newval);
-
-static void libbalsa_address_book_text_save_config(LibBalsaAddressBook *ab,
-                                                   const gchar         *prefix);
-static void libbalsa_address_book_text_load_config(LibBalsaAddressBook *ab,
-                                                   const gchar         *prefix);
-static GList *libbalsa_address_book_text_alias_complete(LibBalsaAddressBook *ab,
-                                                        const gchar         *prefix);
+static void
+libbalsa_address_book_text_class_init(LibBalsaAddressBookTextClass *
+                                      klass);
+static void
+libbalsa_address_book_text_init(LibBalsaAddressBookText * ab_text);
+static void
+libbalsa_address_book_text_finalize(GObject * object);
+
+static LibBalsaABErr
+libbalsa_address_book_text_load(LibBalsaAddressBook * ab,
+                                const gchar * filter,
+                                LibBalsaAddressBookLoadFunc callback,
+                                gpointer data);
+static LibBalsaABErr
+libbalsa_address_book_text_add_address(LibBalsaAddressBook * ab,
+                                       LibBalsaAddress * address);
+static LibBalsaABErr
+libbalsa_address_book_text_remove_address(LibBalsaAddressBook * ab,
+                                          LibBalsaAddress * address);
+static LibBalsaABErr
+libbalsa_address_book_text_modify_address(LibBalsaAddressBook * ab,
+                                          LibBalsaAddress * address,
+                                          LibBalsaAddress * newval);
+
+static void
+libbalsa_address_book_text_save_config(LibBalsaAddressBook * ab,
+                                        const gchar * prefix);
+static void
+libbalsa_address_book_text_load_config(LibBalsaAddressBook * ab,
+                                       const gchar * prefix);
+static GList *
+libbalsa_address_book_text_alias_complete(LibBalsaAddressBook * ab,
+                                          const gchar * prefix);
 
 /* GObject class stuff */
 
@@ -81,10 +91,10 @@ typedef struct {
 } LibBalsaAddressBookTextPrivate;
 
 G_DEFINE_TYPE_WITH_PRIVATE(LibBalsaAddressBookText, libbalsa_address_book_text,
-                           LIBBALSA_TYPE_ADDRESS_BOOK)
+        LIBBALSA_TYPE_ADDRESS_BOOK)
 
 static void
-libbalsa_address_book_text_class_init(LibBalsaAddressBookTextClass *klass)
+libbalsa_address_book_text_class_init(LibBalsaAddressBookTextClass * klass)
 {
     LibBalsaAddressBookClass *address_book_class;
     GObjectClass *object_class;
@@ -111,9 +121,8 @@ libbalsa_address_book_text_class_init(LibBalsaAddressBookTextClass *klass)
         libbalsa_address_book_text_alias_complete;
 }
 
-
 static void
-libbalsa_address_book_text_init(LibBalsaAddressBookText *ab_text)
+libbalsa_address_book_text_init(LibBalsaAddressBookText * ab_text)
 {
     LibBalsaAddressBookTextPrivate *priv =
         libbalsa_address_book_text_get_instance_private(ab_text);
@@ -128,7 +137,6 @@ libbalsa_address_book_text_init(LibBalsaAddressBookText *ab_text)
     libbalsa_completion_set_compare(priv->name_complete, strncmp_word);
 }
 
-
 typedef struct {
     long begin;
     long end;
@@ -144,19 +152,16 @@ lbab_text_item_new(void)
     return item;
 }
 
-
 static void
-lbab_text_item_free(LibBalsaAddressBookTextItem *item)
+lbab_text_item_free(LibBalsaAddressBookTextItem * item)
 {
-    if (item->address) {
+    if (item->address)
         g_object_unref(item->address);
-    }
     g_free(item);
 }
 
-
 static void
-libbalsa_address_book_text_finalize(GObject *object)
+libbalsa_address_book_text_finalize(GObject * object)
 {
     LibBalsaAddressBookText *ab_text = LIBBALSA_ADDRESS_BOOK_TEXT(object);
     LibBalsaAddressBookTextPrivate *priv =
@@ -169,20 +174,18 @@ libbalsa_address_book_text_finalize(GObject *object)
     G_OBJECT_CLASS(libbalsa_address_book_text_parent_class)->finalize(object);
 }
 
-
 /* Load helpers */
 
 /* returns true if the book has changed or there is an error */
 static gboolean
-lbab_text_address_book_need_reload(LibBalsaAddressBookText *ab_text)
+lbab_text_address_book_need_reload(LibBalsaAddressBookText * ab_text)
 {
     LibBalsaAddressBookTextPrivate *priv =
         libbalsa_address_book_text_get_instance_private(ab_text);
     struct stat stat_buf;
 
-    if (stat(priv->path, &stat_buf) == -1) {
+    if (stat(priv->path, &stat_buf) == -1)
         return TRUE;
-    }
 
     if (stat_buf.st_mtime > priv->mtime) {
         priv->mtime = stat_buf.st_mtime;
@@ -192,15 +195,12 @@ lbab_text_address_book_need_reload(LibBalsaAddressBookText *ab_text)
     return FALSE;
 }
 
-
 /* Case-insensitive utf-8 string-has-prefix */
 static gboolean
-lbab_text_starts_from(const gchar *str,
-                      const gchar *filter_hi)
+lbab_text_starts_from(const gchar * str, const gchar * filter_hi)
 {
-    if (!str) {
+    if (!str)
         return FALSE;
-    }
 
     while (*str && *filter_hi &&
            g_unichar_toupper(g_utf8_get_char(str)) ==
@@ -212,23 +212,21 @@ lbab_text_starts_from(const gchar *str,
     return *filter_hi == '\0';
 }
 
-
 /* To create distribution lists based on the ORG field:
  * #define MAKE_GROUP_BY_ORGANIZATION TRUE
  */
 #if MAKE_GROUP_BY_ORGANIZATION
 static void
-lbab_text_group_address(const gchar *group_name,
-                        GSList      *lbab_text_group_addresses,
-                        GList      **completion_list)
+lbab_text_group_address(const gchar * group_name,
+                        GSList * lbab_text_group_addresses,
+                        GList ** completion_list)
 {
     GSList *l;
     CompletionData *cmp_data;
     InternetAddress *ia;
 
-    if (!lbab_text_group_addresses || !lbab_text_group_addresses->next) {
+    if (!lbab_text_group_addresses || !lbab_text_group_addresses->next)
         return;
-    }
 
     ia = internet_address_group_new(group_name);
     for (l = lbab_text_group_addresses; l; l = l->next) {
@@ -239,7 +237,7 @@ lbab_text_group_address(const gchar *group_name,
              mailbox = mailbox->next) {
             InternetAddress *member =
                 internet_address_mailbox_new(libbalsa_address_get_full_name(address),
-                                             mailbox->data);
+                                            mailbox->data);
             internet_address_group_add_member((InternetAddressGroup *)ia, member);
             g_object_unref(member);
         }
@@ -250,42 +248,36 @@ lbab_text_group_address(const gchar *group_name,
     g_object_unref(ia);
     *completion_list = g_list_prepend(*completion_list, cmp_data);
 }
-
-
 #endif                          /* MAKE_GROUP_BY_ORGANIZATION */
 
 /* GCompareFunc for LibBalsaAddressBookTextItem */
 static gint
-lbab_text_item_compare(LibBalsaAddressBookTextItem *a,
-                       LibBalsaAddressBookTextItem *b)
+lbab_text_item_compare(LibBalsaAddressBookTextItem * a,
+                       LibBalsaAddressBookTextItem * b)
 {
     g_return_val_if_fail(a != NULL, -1);
     g_return_val_if_fail(b != NULL, 1);
 
-    if (a->address == NULL) {
+    if (a->address == NULL)
         return -1;
-    }
-    if (b->address == NULL) {
+    if (b->address == NULL)
         return 1;
-    }
 
     return g_ascii_strcasecmp(libbalsa_address_get_full_name(a->address),
                               libbalsa_address_get_full_name(b->address));
 }
 
-
 /* Load the book from the stream */
 static gboolean
-lbab_text_load_file(LibBalsaAddressBookText *ab_text,
-                    FILE                    *stream)
+lbab_text_load_file(LibBalsaAddressBookText * ab_text, FILE * stream)
 {
     LibBalsaAddressBookTextPrivate *priv =
         libbalsa_address_book_text_get_instance_private(ab_text);
     LibBalsaAddressBook *ab = ( LibBalsaAddressBook *) ab_text;
-    LibBalsaABErr (*parse_address) (FILE            *stream_in,
-                                    LibBalsaAddress *address,
-                                    FILE            *stream_out,
-                                    LibBalsaAddress *newval);
+    LibBalsaABErr(*parse_address) (FILE * stream_in,
+                                   LibBalsaAddress * address,
+                                   FILE * stream_out,
+                                   LibBalsaAddress * newval);
     GSList *list = NULL;
     GList *completion_list = NULL;
     CompletionData *cmp_data;
@@ -293,9 +285,8 @@ lbab_text_load_file(LibBalsaAddressBookText *ab_text,
     GHashTable *group_table;
 #endif                          /* MAKE_GROUP_BY_ORGANIZATION */
 
-    if (!lbab_text_address_book_need_reload(ab_text)) {
+    if (!lbab_text_address_book_need_reload(ab_text))
         return TRUE;
-    }
 
     libbalsa_clear_slist(&priv->item_list, (GDestroyNotify) lbab_text_item_free);
     libbalsa_completion_clear_items(priv->name_complete);
@@ -315,9 +306,8 @@ lbab_text_load_file(LibBalsaAddressBookText *ab_text,
         list = g_slist_prepend(list, item);
     }
 
-    if (!list) {
+    if (!list)
         return TRUE;
-    }
 
     priv->item_list =
         g_slist_sort(list, (GCompareFunc) lbab_text_item_compare);
@@ -335,13 +325,12 @@ lbab_text_load_file(LibBalsaAddressBookText *ab_text,
 #endif                          /* MAKE_GROUP_BY_ORGANIZATION */
         GList *addr_list;
 
-        if (!address) {
+        if (!address)
             continue;
-        }
 
         addr_list = libbalsa_address_get_addr_list(address);
-        if (libbalsa_address_book_get_dist_list_mode(ab)
-            && (addr_list != NULL) && (addr_list->next != NULL)) {
+       if (libbalsa_address_book_get_dist_list_mode(ab)
+            && addr_list != NULL && addr_list->next != NULL) {
             /* Create a group address. */
             InternetAddress *ia =
                 internet_address_group_new(libbalsa_address_get_full_name(address));
@@ -373,9 +362,8 @@ lbab_text_load_file(LibBalsaAddressBookText *ab_text,
         }
 
 #if MAKE_GROUP_BY_ORGANIZATION
-        if (!address->organization || !*address->organization) {
+        if (!address->organization || !*address->organization)
             continue;
-        }
         groups = g_strsplit(address->organization, ";", 0);
         for (group = groups; *group; group++) {
             gchar *group_name;
@@ -408,24 +396,19 @@ lbab_text_load_file(LibBalsaAddressBookText *ab_text,
     return TRUE;
 }
 
-
 /* Lock and unlock an address book file */
 static gboolean
-lbab_text_lock_book(LibBalsaAddressBookText *ab_text,
-                    FILE                    *stream,
-                    gboolean                 exclusive)
+lbab_text_lock_book(LibBalsaAddressBookText * ab_text, FILE * stream,
+                    gboolean exclusive)
 {
     LibBalsaAddressBookTextPrivate *priv =
         libbalsa_address_book_text_get_instance_private(ab_text);
 
     return (libbalsa_lock_file
-                (priv->path, fileno(stream), exclusive, TRUE, TRUE) >= 0);
+            (priv->path, fileno(stream), exclusive, TRUE, TRUE) >= 0);
 }
-
-
 static void
-lbab_text_unlock_book(LibBalsaAddressBookText *ab_text,
-                      FILE                    *stream)
+lbab_text_unlock_book(LibBalsaAddressBookText * ab_text, FILE * stream)
 {
     LibBalsaAddressBookTextPrivate *priv =
         libbalsa_address_book_text_get_instance_private(ab_text);
@@ -433,14 +416,12 @@ lbab_text_unlock_book(LibBalsaAddressBookText *ab_text,
     libbalsa_unlock_file(priv->path, fileno(stream), TRUE);
 }
 
-
 /* Modify helpers */
 
 /* Create a temporary file for the modified book */
 static LibBalsaABErr
-lbab_text_open_temp(LibBalsaAddressBookText *ab_text,
-                    gchar                  **path,
-                    FILE                   **stream)
+lbab_text_open_temp(LibBalsaAddressBookText * ab_text, gchar ** path,
+                    FILE ** stream)
 {
     LibBalsaAddressBookTextPrivate *priv =
         libbalsa_address_book_text_get_instance_private(ab_text);
@@ -459,17 +440,15 @@ lbab_text_open_temp(LibBalsaAddressBookText *ab_text,
     return LBABERR_OK;
 }
 
-
 /* Rename the temporary file as the real book */
 static LibBalsaABErr
-lbab_text_close_temp(LibBalsaAddressBookText *ab_text,
-                     const gchar             *path)
+lbab_text_close_temp(LibBalsaAddressBookText * ab_text, const gchar * path)
 {
     LibBalsaAddressBookTextPrivate *priv =
         libbalsa_address_book_text_get_instance_private(ab_text);
 
-    if ((unlink(priv->path) < 0)
-        && (g_file_error_from_errno(errno) != G_FILE_ERROR_NOENT)) {
+    if (unlink(priv->path) < 0
+        && g_file_error_from_errno(errno) != G_FILE_ERROR_NOENT) {
 #if DEBUG
         g_message("Failed to unlink address book file “%s”\n"
                   " new address book file saved as “%s”", priv->path,
@@ -490,13 +469,10 @@ lbab_text_close_temp(LibBalsaAddressBookText *ab_text,
     return LBABERR_OK;
 }
 
-
 /* Copy part of one stream to another */
 static LibBalsaABErr
-lbab_text_copy_stream(FILE *stream_in,
-                      long  begin,
-                      long  end,
-                      FILE *stream_out)
+lbab_text_copy_stream(FILE * stream_in, long begin, long end,
+                      FILE * stream_out)
 {
     gint count;
     size_t len;
@@ -511,26 +487,23 @@ lbab_text_copy_stream(FILE *stream_in,
         gchar buf[4096];
 
         len = MIN(sizeof buf, (size_t) count);
-        if (fread(buf, 1, len, stream_in) < len) {
+        if (fread(buf, 1, len, stream_in) < len)
             return LBABERR_CANNOT_READ;
-        }
-        if (fwrite(buf, 1, len, stream_out) < len) {
+        if (fwrite(buf, 1, len, stream_out) < len)
             return LBABERR_CANNOT_WRITE;
-        }
     }
 
     return LBABERR_OK;
 }
 
-
 /* Class methods */
 
 /* Load method */
 static LibBalsaABErr
-libbalsa_address_book_text_load(LibBalsaAddressBook        *ab,
-                                const gchar                *filter,
+libbalsa_address_book_text_load(LibBalsaAddressBook * ab,
+                                const gchar * filter,
                                 LibBalsaAddressBookLoadFunc callback,
-                                gpointer                    data)
+                                gpointer data)
 {
     LibBalsaAddressBookText *ab_text = LIBBALSA_ADDRESS_BOOK_TEXT(ab);
     LibBalsaAddressBookTextPrivate *priv =
@@ -541,9 +514,8 @@ libbalsa_address_book_text_load(LibBalsaAddressBook        *ab,
     gchar *filter_hi = NULL;
 
     stream = fopen(priv->path, "r");
-    if (!stream) {
+    if (!stream)
         return LBABERR_CANNOT_READ;
-    }
 
     ok = lbab_text_lock_book(ab_text, stream, FALSE);
     if (ok) {
@@ -551,47 +523,41 @@ libbalsa_address_book_text_load(LibBalsaAddressBook        *ab,
         lbab_text_unlock_book(ab_text, stream);
     }
     fclose(stream);
-    if (!ok) {
+    if (!ok)
         return LBABERR_CANNOT_READ;
-    }
 
-    if (filter) {
+    if (filter)
         filter_hi = g_utf8_strup(filter, -1);
-    }
 
     for (list = priv->item_list; list; list = list->next) {
         LibBalsaAddressBookTextItem *item = list->data;
         LibBalsaAddress *address = item->address;
 
-        if (!address) {
+        if (!address)
             continue;
-        }
 
         if (callback
             && (!filter_hi
                 ||
                 lbab_text_starts_from(libbalsa_address_get_last_name
-                                          (address), filter_hi)
+                                      (address), filter_hi)
                 ||
                 lbab_text_starts_from(libbalsa_address_get_full_name
-                                          (address), filter_hi))) {
+                                      (address), filter_hi)))
             callback(ab, address, data);
-        }
     }
-    if (callback) {
+    if (callback)
         callback(ab, NULL, data);
-    }
 
     g_free(filter_hi);
 
     return LBABERR_OK;
 }
 
-
 /* Add address method */
 static LibBalsaABErr
-libbalsa_address_book_text_add_address(LibBalsaAddressBook *ab,
-                                       LibBalsaAddress     *new_address)
+libbalsa_address_book_text_add_address(LibBalsaAddressBook * ab,
+                                       LibBalsaAddress * new_address)
 {
     LibBalsaAddressBookText *ab_text = LIBBALSA_ADDRESS_BOOK_TEXT(ab);
     LibBalsaAddressBookTextPrivate *priv =
@@ -601,9 +567,8 @@ libbalsa_address_book_text_add_address(LibBalsaAddressBook *ab,
     LibBalsaABErr res = LBABERR_OK;
 
     stream = fopen(priv->path, "a+");
-    if (stream == NULL) {
+    if (stream == NULL)
         return LBABERR_CANNOT_WRITE;
-    }
 
     if (!lbab_text_lock_book(ab_text, stream, TRUE)) {
         fclose(stream);
@@ -616,12 +581,11 @@ libbalsa_address_book_text_add_address(LibBalsaAddressBook *ab,
 
     new_item.address = new_address;
     if (g_slist_find_custom(priv->item_list, &new_item,
-                            (GCompareFunc) lbab_text_item_compare)) {
+                            (GCompareFunc) lbab_text_item_compare))
         return LBABERR_DUPLICATE;
-    }
 
     res = LIBBALSA_ADDRESS_BOOK_TEXT_GET_CLASS(ab_text)->save_address
-            (stream, new_address);
+        (stream, new_address);
 
     lbab_text_unlock_book(ab_text, stream);
     fclose(stream);
@@ -632,21 +596,19 @@ libbalsa_address_book_text_add_address(LibBalsaAddressBook *ab,
     return res;
 }
 
-
 /* Remove address method */
 static LibBalsaABErr
-libbalsa_address_book_text_remove_address(LibBalsaAddressBook *ab,
-                                          LibBalsaAddress     *address)
+libbalsa_address_book_text_remove_address(LibBalsaAddressBook * ab,
+                                          LibBalsaAddress * address)
 {
     return libbalsa_address_book_text_modify_address(ab, address, NULL);
 }
 
-
 /* Modify address method */
 static LibBalsaABErr
-libbalsa_address_book_text_modify_address(LibBalsaAddressBook *ab,
-                                          LibBalsaAddress     *address,
-                                          LibBalsaAddress     *newval)
+libbalsa_address_book_text_modify_address(LibBalsaAddressBook * ab,
+                                          LibBalsaAddress * address,
+                                          LibBalsaAddress * newval)
 {
     LibBalsaAddressBookText *ab_text = LIBBALSA_ADDRESS_BOOK_TEXT(ab);
     LibBalsaAddressBookTextPrivate *priv =
@@ -659,9 +621,8 @@ libbalsa_address_book_text_modify_address(LibBalsaAddressBook *ab,
     gchar *path = NULL;
     FILE *stream_out = NULL;
 
-    if ((stream_in = fopen(priv->path, "r")) == NULL) {
+    if ((stream_in = fopen(priv->path, "r")) == NULL)
         return LBABERR_CANNOT_READ;
-    }
 
     if (!lbab_text_lock_book(ab_text, stream_in, FALSE)) {
         fclose(stream_in);
@@ -682,34 +643,28 @@ libbalsa_address_book_text_modify_address(LibBalsaAddressBook *ab,
 
     res = lbab_text_open_temp(ab_text, &path, &stream_out);
 
-    if (res == LBABERR_OK) {
+    if (res == LBABERR_OK)
         res = lbab_text_copy_stream(stream_in, 0, item->begin, stream_out);
-    }
 
-    if ((res == LBABERR_OK) && newval) {
+    if (res == LBABERR_OK && newval)
         res = LIBBALSA_ADDRESS_BOOK_TEXT_GET_CLASS(ab)->parse_address
-                (stream_in, NULL, stream_out, newval);
-    }
+            (stream_in, NULL, stream_out, newval);
 
-    if (res == LBABERR_OK) {
+    if (res == LBABERR_OK)
         res = lbab_text_copy_stream(stream_in, item->end, -1, stream_out);
-    }
 
     lbab_text_unlock_book(ab_text, stream_in);
     fclose(stream_in);
 
-    if (stream_out) {
+    if (stream_out)
         fclose(stream_out);
-    }
 
-    if (res == LBABERR_OK) {
+    if (res == LBABERR_OK)
         res = lbab_text_close_temp(ab_text, path);
-    }
 #if DEBUG
-    else {
+    else
         g_message("Failed to write to temporary address book file “%s”\n"
                   " changes not saved", path);
-    }
 #endif                          /* DEBUG */
     g_free(path);
 
@@ -719,11 +674,10 @@ libbalsa_address_book_text_modify_address(LibBalsaAddressBook *ab,
     return res;
 }
 
-
 /* Save config method */
 static void
-libbalsa_address_book_text_save_config(LibBalsaAddressBook *ab,
-                                       const gchar         *prefix)
+libbalsa_address_book_text_save_config(LibBalsaAddressBook * ab,
+                                       const gchar * prefix)
 {
     LibBalsaAddressBookText *ab_text = LIBBALSA_ADDRESS_BOOK_TEXT(ab);
     LibBalsaAddressBookTextPrivate *priv =
@@ -731,15 +685,13 @@ libbalsa_address_book_text_save_config(LibBalsaAddressBook *ab,
 
     libbalsa_conf_set_string("Path", priv->path);
 
-    LIBBALSA_ADDRESS_BOOK_CLASS(libbalsa_address_book_text_parent_class)->save_config(ab,
-                                                                                      prefix);
+    LIBBALSA_ADDRESS_BOOK_CLASS(libbalsa_address_book_text_parent_class)->save_config(ab, prefix);
 }
 
-
 /* Load config method */
 static void
-libbalsa_address_book_text_load_config(LibBalsaAddressBook *ab,
-                                       const gchar         *prefix)
+libbalsa_address_book_text_load_config(LibBalsaAddressBook * ab,
+                                       const gchar * prefix)
 {
     LibBalsaAddressBookText *ab_text = LIBBALSA_ADDRESS_BOOK_TEXT(ab);
     LibBalsaAddressBookTextPrivate *priv =
@@ -748,15 +700,13 @@ libbalsa_address_book_text_load_config(LibBalsaAddressBook *ab,
     g_free(priv->path);
     priv->path = libbalsa_conf_get_string("Path");
 
-    LIBBALSA_ADDRESS_BOOK_CLASS(libbalsa_address_book_text_parent_class)->load_config(ab,
-                                                                                      prefix);
+    LIBBALSA_ADDRESS_BOOK_CLASS(libbalsa_address_book_text_parent_class)->load_config(ab, prefix);
 }
 
-
 /* Alias complete method */
 static GList *
-libbalsa_address_book_text_alias_complete(LibBalsaAddressBook *ab,
-                                          const gchar         *prefix)
+libbalsa_address_book_text_alias_complete(LibBalsaAddressBook * ab,
+                                          const gchar * prefix)
 {
     LibBalsaAddressBookText *ab_text = LIBBALSA_ADDRESS_BOOK_TEXT(ab);
     LibBalsaAddressBookTextPrivate *priv =
@@ -765,14 +715,12 @@ libbalsa_address_book_text_alias_complete(LibBalsaAddressBook *ab,
     GList *list;
     GList *res = NULL;
 
-    if (!libbalsa_address_book_get_expand_aliases(ab)) {
+    if (!libbalsa_address_book_get_expand_aliases(ab))
         return NULL;
-    }
 
     stream = fopen(priv->path, "r");
-    if (!stream) {
+    if (!stream)
         return NULL;
-    }
 
     if (!lbab_text_lock_book(ab_text, stream, FALSE)) {
         fclose(stream);
@@ -785,8 +733,8 @@ libbalsa_address_book_text_alias_complete(LibBalsaAddressBook *ab,
     fclose(stream);
 
     for (list =
-             libbalsa_completion_complete(priv->name_complete,
-                                          (gchar *) prefix);
+         libbalsa_completion_complete(priv->name_complete,
+                                      (gchar *) prefix);
          list; list = list->next) {
         InternetAddress *ia = ((CompletionData *) list->data)->ia;
         g_object_ref(ia);
@@ -796,13 +744,12 @@ libbalsa_address_book_text_alias_complete(LibBalsaAddressBook *ab,
     return g_list_reverse(res);
 }
 
-
 /*
  * Getter
  */
 
 const gchar *
-libbalsa_address_book_text_get_path(LibBalsaAddressBookText *ab_text)
+libbalsa_address_book_text_get_path(LibBalsaAddressBookText * ab_text)
 {
     LibBalsaAddressBookTextPrivate *priv =
         libbalsa_address_book_text_get_instance_private(ab_text);
@@ -810,14 +757,13 @@ libbalsa_address_book_text_get_path(LibBalsaAddressBookText *ab_text)
     return priv->path;
 }
 
-
 /*
  * Setter
  */
 
 void
-libbalsa_address_book_text_set_path(LibBalsaAddressBookText *ab_text,
-                                    const gchar             *path)
+libbalsa_address_book_text_set_path(LibBalsaAddressBookText * ab_text,
+                                    const gchar             * path)
 {
     LibBalsaAddressBookTextPrivate *priv =
         libbalsa_address_book_text_get_instance_private(ab_text);
diff --git a/libbalsa/address-book-text.h b/libbalsa/address-book-text.h
index 79363bb..6208adb 100644
--- a/libbalsa/address-book-text.h
+++ b/libbalsa/address-book-text.h
@@ -6,21 +6,21 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
  * LibBalsaAddressBookText
- *
+ * 
  * The code that is common to vCard (== GnomeCard) and LDIF address
  * books ...
  */
@@ -33,18 +33,18 @@
 #include "address-book.h"
 #include "completion.h"
 
-#define LIBBALSA_TYPE_ADDRESS_BOOK_TEXT (libbalsa_address_book_text_get_type())
+#define LIBBALSA_TYPE_ADDRESS_BOOK_TEXT        (libbalsa_address_book_text_get_type())
 G_DECLARE_DERIVABLE_TYPE(LibBalsaAddressBookText, libbalsa_address_book_text,
-                         LIBBALSA, ADDRESS_BOOK_TEXT, LibBalsaAddressBook)
+        LIBBALSA, ADDRESS_BOOK_TEXT, LibBalsaAddressBook)
 
 struct _LibBalsaAddressBookTextClass {
     LibBalsaAddressBookClass parent_class;
-    LibBalsaABErr (*parse_address) (FILE            *stream_in,
-                                    LibBalsaAddress *address_in,
-                                    FILE            *stream_out,
-                                    LibBalsaAddress *address_out);
-    LibBalsaABErr (*save_address)  (FILE            *stream,
-                                    LibBalsaAddress *address);
+     LibBalsaABErr(*parse_address) (FILE * stream_in,
+                                    LibBalsaAddress * address_in,
+                                    FILE * stream_out,
+                                    LibBalsaAddress * address_out);
+     LibBalsaABErr(*save_address)  (FILE * stream,
+                                    LibBalsaAddress * address);
 };
 
 typedef struct _LibBalsaAddressBookText LibBalsaAddressBookText;
@@ -54,13 +54,13 @@ typedef struct _LibBalsaAddressBookTextClass LibBalsaAddressBookTextClass;
  * Getter
  */
 
-const gchar *libbalsa_address_book_text_get_path(LibBalsaAddressBookText *ab_text);
+const gchar * libbalsa_address_book_text_get_path(LibBalsaAddressBookText * ab_text);
 
 /*
  * Setter
  */
 
-void libbalsa_address_book_text_set_path(LibBalsaAddressBookText *ab_text,
-                                         const gchar             *path);
+void libbalsa_address_book_text_set_path(LibBalsaAddressBookText * ab_text,
+                                         const gchar             * path);
 
 #endif                          /* __LIBBALSA_ADDRESS_BOOK_TEXT_H__ */
diff --git a/libbalsa/address-book-vcard.c b/libbalsa/address-book-vcard.c
index 0c623da..270d97f 100644
--- a/libbalsa/address-book-vcard.c
+++ b/libbalsa/address-book-vcard.c
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -27,7 +27,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "address-book-vcard.h"
 
@@ -39,15 +39,18 @@
 /* FIXME: Arbitrary constant */
 #define LINE_LEN 256
 
-static void libbalsa_address_book_vcard_class_init(LibBalsaAddressBookVcardClass *
-                                                   klass);
+static void
+libbalsa_address_book_vcard_class_init(LibBalsaAddressBookVcardClass *
+                                       klass);
 
-static LibBalsaABErr libbalsa_address_book_vcard_parse_address(FILE            *stream_in,
-                                                               LibBalsaAddress *address_in,
-                                                               FILE            *stream_out,
-                                                               LibBalsaAddress *address_out);
-static LibBalsaABErr libbalsa_address_book_vcard_save_address(FILE            *stream,
-                                                              LibBalsaAddress *address);
+static LibBalsaABErr
+libbalsa_address_book_vcard_parse_address(FILE * stream_in,
+                                          LibBalsaAddress * address_in,
+                                          FILE * stream_out,
+                                          LibBalsaAddress * address_out);
+static LibBalsaABErr
+libbalsa_address_book_vcard_save_address(FILE * stream,
+                                         LibBalsaAddress * address);
 
 struct _LibBalsaAddressBookVcard {
     LibBalsaAddressBookText parent;
@@ -62,7 +65,7 @@ G_DEFINE_TYPE(LibBalsaAddressBookVcard, libbalsa_address_book_vcard,
 
 static void
 libbalsa_address_book_vcard_class_init(LibBalsaAddressBookVcardClass *
-                                       klass)
+                                      klass)
 {
     LibBalsaAddressBookTextClass *address_book_text_class =
         LIBBALSA_ADDRESS_BOOK_TEXT_CLASS(klass);
@@ -73,25 +76,22 @@ libbalsa_address_book_vcard_class_init(LibBalsaAddressBookVcardClass *
         libbalsa_address_book_vcard_save_address;
 }
 
-
 static void
-libbalsa_address_book_vcard_init(LibBalsaAddressBookVcard *ab_vcard)
+libbalsa_address_book_vcard_init(LibBalsaAddressBookVcard * ab_vcard)
 {
 }
 
-
 /* Public method */
 LibBalsaAddressBook *
-libbalsa_address_book_vcard_new(const gchar *name,
-                                const gchar *path)
+libbalsa_address_book_vcard_new(const gchar * name, const gchar * path)
 {
     LibBalsaAddressBookVcard *ab_vcard;
     LibBalsaAddressBook *ab;
 
     ab_vcard =
         LIBBALSA_ADDRESS_BOOK_VCARD(g_object_new
-                                        (LIBBALSA_TYPE_ADDRESS_BOOK_VCARD,
-                                        NULL));
+                                    (LIBBALSA_TYPE_ADDRESS_BOOK_VCARD,
+                                     NULL));
     ab = LIBBALSA_ADDRESS_BOOK(ab_vcard);
 
     libbalsa_address_book_set_name(ab, name);
@@ -100,121 +100,97 @@ libbalsa_address_book_vcard_new(const gchar *name,
     return ab;
 }
 
-
 static gchar *
-validate_vcard_string(gchar *vcstr)
+validate_vcard_string(gchar * vcstr)
 {
-    gchar *utf8res;
+    gchar * utf8res;
     gsize b_written;
 
     /* check if it's a utf8 clean string and return it in this case */
-    if (!vcstr || g_utf8_validate(vcstr, -1, NULL)) {
-        return vcstr;
-    }
+    if (!vcstr || g_utf8_validate(vcstr, -1, NULL))
+       return vcstr;
 
     /* try to convert from the user's locale setting */
     utf8res = g_locale_to_utf8(vcstr, -1, NULL, &b_written, NULL);
-    if (!utf8res) {
-        return vcstr;
-    }
+    if (!utf8res)
+       return vcstr;
 
     g_free(vcstr);
     return utf8res;
 }
 
-
 static void
-lbab_vcard_write_begin(FILE *stream)
+lbab_vcard_write_begin(FILE * stream)
 {
     fprintf(stream, "\nBEGIN:VCARD\n");
 }
 
-
 static void
-lbab_vcard_write_fn(FILE            *stream,
-                    LibBalsaAddress *address)
+lbab_vcard_write_fn(FILE * stream, LibBalsaAddress * address)
 {
     const gchar *full_name = libbalsa_address_get_full_name(address);
 
-    if (full_name && (*full_name != '\0')) {
+    if (full_name && *full_name != '\0')
         fprintf(stream, "FN:%s\n", full_name);
-    }
 }
 
-
 static void
-lbab_vcard_write_n(FILE            *stream,
-                   LibBalsaAddress *address)
+lbab_vcard_write_n(FILE * stream, LibBalsaAddress * address)
 {
     const gchar *first_name = libbalsa_address_get_first_name(address);
     const gchar *last_name = libbalsa_address_get_last_name(address);
 
-    if (first_name && (*first_name != '\0')) {
-        if (last_name && (*last_name != '\0')) {
+    if (first_name && *first_name != '\0') {
+        if (last_name && *last_name != '\0') {
             fprintf(stream, "N:%s;%s\n", last_name, first_name);
-        } else {
+        } else
             fprintf(stream, "N:;%s\n", first_name);
-        }
-    } else if (last_name && (*last_name != '\0')) {
+    } else if (last_name && *last_name != '\0') {
         fprintf(stream, "N:%s\n", last_name);
-    } else {
+    } else
         fprintf(stream, "N:%s\n", _("No-Name"));
-    }
 }
 
-
 static void
-lbab_vcard_write_nickname(FILE            *stream,
-                          LibBalsaAddress *address)
+lbab_vcard_write_nickname(FILE * stream, LibBalsaAddress * address)
 {
     const gchar *nick_name = libbalsa_address_get_nick_name(address);
 
-    if (nick_name && (*nick_name != '\0')) {
+    if (nick_name && *nick_name != '\0')
         fprintf(stream, "NICKNAME:%s\n", nick_name);
-    }
 }
 
-
 static void
-lbab_vcard_write_org(FILE            *stream,
-                     LibBalsaAddress *address)
+lbab_vcard_write_org(FILE * stream, LibBalsaAddress * address)
 {
     const gchar *organization = libbalsa_address_get_organization(address);
 
-    if (organization && (*organization != '\0')) {
+    if (organization && *organization != '\0')
         fprintf(stream, "ORG:%s\n", organization);
-    }
 }
 
-
 static void
-lbab_vcard_write_addresses(FILE            *stream,
-                           LibBalsaAddress *address)
+lbab_vcard_write_addresses(FILE * stream, LibBalsaAddress * address)
 {
     GList *list;
 
     for (list = libbalsa_address_get_addr_list(address);
-         list != NULL; list = list->next) {
+         list != NULL; list = list->next)
         fprintf(stream, "EMAIL;INTERNET:%s\n", (gchar *) list->data);
-    }
 }
 
-
 static void
-lbab_vcard_write_unknown(FILE        *stream,
-                         const gchar *string)
+lbab_vcard_write_unknown(FILE * stream, const gchar * string)
 {
-    if (*string) {
+    if (*string)
         fprintf(stream, "%s\n", string);
-    }
 }
 
-
 static LibBalsaABErr
-lbab_vcard_write_end(FILE *stream)
+lbab_vcard_write_end(FILE * stream)
 {
     return fprintf(stream, "END:VCARD\n") > 0 ?
-           LBABERR_OK : LBABERR_CANNOT_WRITE;
+        LBABERR_OK : LBABERR_CANNOT_WRITE;
 }
 
 
@@ -225,10 +201,10 @@ lbab_vcard_write_end(FILE *stream)
  * given, create an item on it for the output address.
  */
 static LibBalsaABErr
-libbalsa_address_book_vcard_parse_address(FILE            *stream,
-                                          LibBalsaAddress *address,
-                                          FILE            *stream_out,
-                                          LibBalsaAddress *address_out)
+libbalsa_address_book_vcard_parse_address(FILE * stream,
+                                          LibBalsaAddress * address,
+                                          FILE * stream_out,
+                                          LibBalsaAddress * address_out)
 {
     gchar string[LINE_LEN];
     gchar *name = NULL, *nick_name = NULL, *org = NULL;
@@ -238,49 +214,43 @@ libbalsa_address_book_vcard_parse_address(FILE            *stream,
     guint wrote = 0;
 
     while (fgets(string, sizeof(string), stream)) {
-        /*
-         * Check if it is a card.
-         */
-        if (g_ascii_strncasecmp(string, "BEGIN:VCARD", 11) == 0) {
-            in_vcard = TRUE;
-            if (stream_out) {
+       /*
+        * Check if it is a card.
+        */
+       if (g_ascii_strncasecmp(string, "BEGIN:VCARD", 11) == 0) {
+           in_vcard = TRUE;
+            if (stream_out)
                 lbab_vcard_write_begin(stream_out);
-            }
-            continue;
-        }
+           continue;
+       }
 
-        if (g_ascii_strncasecmp(string, "END:VCARD", 9) == 0) {
+       if (g_ascii_strncasecmp(string, "END:VCARD", 9) == 0) {
             LibBalsaABErr res = LBABERR_CANNOT_READ;
             /*
              * We are done loading a card.
              */
-            if (addr_list) {
+           if (addr_list) {
                 if (stream_out) {
-                    if (!(wrote & (1 << FULL_NAME))) {
+                    if (!(wrote & (1 << FULL_NAME)))
                         lbab_vcard_write_fn(stream_out, address_out);
-                    }
-                    if (!(wrote & (1 << FIRST_NAME))) {
+                    if (!(wrote & (1 << FIRST_NAME)))
                         lbab_vcard_write_n(stream_out, address_out);
-                    }
-                    if (!(wrote & (1 << NICK_NAME))) {
+                    if (!(wrote & (1 << NICK_NAME)))
                         lbab_vcard_write_nickname(stream_out, address_out);
-                    }
-                    if (!(wrote & (1 << ORGANIZATION))) {
+                    if (!(wrote & (1 << ORGANIZATION)))
                         lbab_vcard_write_org(stream_out, address_out);
-                    }
                     lbab_vcard_write_addresses(stream_out, address_out);
                     res = lbab_vcard_write_end(stream_out);
                 }
                 if (address) {
-                    if (full_name) {
+                    if (full_name)
                         libbalsa_address_set_full_name(address, full_name);
-                    } else if (name) {
+                    else if (name)
                         libbalsa_address_set_full_name(address, name);
-                    } else if (nick_name) {
+                    else if (nick_name)
                         libbalsa_address_set_full_name(address, nick_name);
-                    } else {
+                    else
                         libbalsa_address_set_full_name(address, _("No-Name"));
-                    }
 
                     libbalsa_address_set_last_name(address, last_name);
                     libbalsa_address_set_first_name(address, first_name);
@@ -300,7 +270,7 @@ libbalsa_address_book_vcard_parse_address(FILE            *stream,
                     return res;
                 }
                 g_list_free_full(addr_list, g_free);
-            }
+           }
             /* Record without e-mail address, or we're not creating
              * addresses: free memory. */
             g_free(full_name);
@@ -311,86 +281,83 @@ libbalsa_address_book_vcard_parse_address(FILE            *stream,
             g_free(org);
 
             return res;
-        }
+       }
 
-        if (!in_vcard) {
-            continue;
-        }
+       if (!in_vcard)
+           continue;
 
-        g_strchomp(string);
+       g_strchomp(string);
 
-        if (g_ascii_strncasecmp(string, "FN:", 3) == 0) {
-            full_name = g_strdup(string + 3);
-            full_name = validate_vcard_string(full_name);
+       if (g_ascii_strncasecmp(string, "FN:", 3) == 0) {
+           full_name = g_strdup(string + 3);
+           full_name = validate_vcard_string(full_name);
             if (stream_out) {
                 lbab_vcard_write_fn(stream_out, address_out);
                 wrote |= 1 << FULL_NAME;
             }
-            continue;
-        }
+           continue;
+       }
 
-        if (g_ascii_strncasecmp(string, "N:", 2) == 0) {
-            name = libbalsa_address_extract_name(string + 2, &last_name,
+       if (g_ascii_strncasecmp(string, "N:", 2) == 0) {
+           name = libbalsa_address_extract_name(string + 2, &last_name,
                                                  &first_name);
-            name = validate_vcard_string(name);
-            last_name = validate_vcard_string(last_name);
-            first_name = validate_vcard_string(first_name);
+           name = validate_vcard_string(name);
+           last_name = validate_vcard_string(last_name);
+           first_name = validate_vcard_string(first_name);
             if (stream_out) {
                 lbab_vcard_write_n(stream_out, address_out);
                 wrote |= 1 << FIRST_NAME;
             }
-            continue;
-        }
+           continue;
+       }
 
-        if (g_ascii_strncasecmp(string, "NICKNAME:", 9) == 0) {
-            nick_name = g_strdup(string + 9);
-            nick_name = validate_vcard_string(nick_name);
+       if (g_ascii_strncasecmp(string, "NICKNAME:", 9) == 0) {
+           nick_name = g_strdup(string + 9);
+           nick_name = validate_vcard_string(nick_name);
             if (stream_out) {
                 lbab_vcard_write_nickname(stream_out, address_out);
                 wrote |= 1 << NICK_NAME;
             }
-            continue;
-        }
+           continue;
+       }
 
-        if (g_ascii_strncasecmp(string, "ORG:", 4) == 0) {
-            org = g_strdup(string + 4);
-            org = validate_vcard_string(org);
+       if (g_ascii_strncasecmp(string, "ORG:", 4) == 0) {
+           org = g_strdup(string + 4);
+           org = validate_vcard_string(org);
             if (stream_out) {
                 lbab_vcard_write_org(stream_out, address_out);
                 wrote |= 1 << ORGANIZATION;
             }
-            continue;
-        }
-
-        /*
-         * fetch all e-mail fields
-         */
-        if (g_ascii_strncasecmp(string, "EMAIL", 5) == 0) {
-            gchar *ptr = strchr(string + 5, ':');
-            if (ptr) {
-                addr_list = g_list_prepend(addr_list, g_strdup(ptr + 1));
-            }
-            continue;
-        }
+           continue;
+       }
+
+       /*
+        * fetch all e-mail fields
+        */
+       if (g_ascii_strncasecmp(string, "EMAIL", 5) == 0) {
+           gchar *ptr = strchr(string + 5, ':');
+           if (ptr) {
+               addr_list = g_list_prepend(addr_list, g_strdup(ptr + 1));
+           }
+           continue;
+       }
 
         /*
          * unknown line
          */
-        if (stream_out) {
+        if (stream_out)
             lbab_vcard_write_unknown(stream_out, string);
-        }
     }
 
     return LBABERR_CANNOT_READ;
 }
 
-
 /*
  * Write one address to the output stream.
  */
 static LibBalsaABErr
-libbalsa_address_book_vcard_save_address(FILE            *stream,
-                                         LibBalsaAddress *address)
+libbalsa_address_book_vcard_save_address(FILE * stream,
+                                         LibBalsaAddress * address)
 {
     lbab_vcard_write_begin(stream);
     lbab_vcard_write_fn(stream, address);
diff --git a/libbalsa/address-book-vcard.h b/libbalsa/address-book-vcard.h
index 370a221..7d193a5 100644
--- a/libbalsa/address-book-vcard.h
+++ b/libbalsa/address-book-vcard.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -31,7 +31,7 @@
 G_DECLARE_FINAL_TYPE(LibBalsaAddressBookVcard, libbalsa_address_book_vcard,
                      LIBBALSA, ADDRESS_BOOK_VCARD, LibBalsaAddressBookText)
 
-LibBalsaAddressBook * libbalsa_address_book_vcard_new(const gchar * name,
-                                                      const gchar * path);
+LibBalsaAddressBook *libbalsa_address_book_vcard_new(const gchar * name,
+                                                    const gchar * path);
 
 #endif /* __LIBBALSA_ADDRESS_BOOK_VCARD_H__ */
diff --git a/libbalsa/address-book.c b/libbalsa/address-book.c
index 233d948..2351710 100644
--- a/libbalsa/address-book.c
+++ b/libbalsa/address-book.c
@@ -6,20 +6,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "address-book.h"
 
@@ -30,24 +30,24 @@
 #include "libbalsa-conf.h"
 
 static void libbalsa_address_book_class_init(LibBalsaAddressBookClass *
-                                             klass);
-static void libbalsa_address_book_init(LibBalsaAddressBook *ab);
-static void libbalsa_address_book_finalize(GObject *object);
+                                            klass);
+static void libbalsa_address_book_init(LibBalsaAddressBook * ab);
+static void libbalsa_address_book_finalize(GObject * object);
 
 static void libbalsa_address_book_real_save_config(LibBalsaAddressBook *
-                                                   ab,
-                                                   const gchar *group);
+                                                  ab,
+                                                  const gchar * group);
 static void libbalsa_address_book_real_load_config(LibBalsaAddressBook *
-                                                   ab,
-                                                   const gchar *group);
+                                                  ab,
+                                                  const gchar * group);
 
 typedef struct {
     /* The gnome_config prefix where we save this address book */
     gchar *config_prefix;
     gchar *name;
     gchar *ext_op_code;    /* extra description for last operation */
-    gboolean is_expensive; /* is lookup to the address book expensive?
-                              e.g. LDAP address book */
+    gboolean is_expensive; /* is lookup to the address book expensive? 
+                             e.g. LDAP address book */
     gboolean expand_aliases;
 
     gboolean dist_list_mode;
@@ -56,7 +56,7 @@ typedef struct {
 G_DEFINE_TYPE_WITH_PRIVATE(LibBalsaAddressBook, libbalsa_address_book, G_TYPE_OBJECT)
 
 static void
-libbalsa_address_book_class_init(LibBalsaAddressBookClass *klass)
+libbalsa_address_book_class_init(LibBalsaAddressBookClass * klass)
 {
     GObjectClass *object_class;
 
@@ -73,9 +73,8 @@ libbalsa_address_book_class_init(LibBalsaAddressBookClass *klass)
     object_class->finalize = libbalsa_address_book_finalize;
 }
 
-
 static void
-libbalsa_address_book_init(LibBalsaAddressBook *ab)
+libbalsa_address_book_init(LibBalsaAddressBook * ab)
 {
     LibBalsaAddressBookPrivate *priv = libbalsa_address_book_get_instance_private(ab);
 
@@ -84,12 +83,11 @@ libbalsa_address_book_init(LibBalsaAddressBook *ab)
     priv->name = NULL;
     priv->expand_aliases = TRUE;
     priv->dist_list_mode = FALSE;
-    priv->is_expensive = FALSE;
+    priv->is_expensive   = FALSE;
 }
 
-
 static void
-libbalsa_address_book_finalize(GObject *object)
+libbalsa_address_book_finalize(GObject * object)
 {
     LibBalsaAddressBook *ab = LIBBALSA_ADDRESS_BOOK(object);
     LibBalsaAddressBookPrivate *priv = libbalsa_address_book_get_instance_private(ab);
@@ -100,9 +98,8 @@ libbalsa_address_book_finalize(GObject *object)
     G_OBJECT_CLASS(libbalsa_address_book_parent_class)->finalize(object);
 }
 
-
 LibBalsaAddressBook *
-libbalsa_address_book_new_from_config(const gchar *group)
+libbalsa_address_book_new_from_config(const gchar * group)
 {
     gchar *type_str;
     GType type;
@@ -114,16 +111,16 @@ libbalsa_address_book_new_from_config(const gchar *group)
 
     if (got_default == TRUE) {
         /* type entry missing, skip it */
-        libbalsa_conf_pop_group();
-        return NULL;
+       libbalsa_conf_pop_group();
+       return NULL;
     }
 
     type = g_type_from_name(type_str);
     if (type == 0) {
         /* type unknown, skip it */
-        g_free(type_str);
-        libbalsa_conf_pop_group();
-        return NULL;
+       g_free(type_str);
+       libbalsa_conf_pop_group();
+       return NULL;
     }
 
     address_book = g_object_new(type, NULL);
@@ -136,12 +133,11 @@ libbalsa_address_book_new_from_config(const gchar *group)
 
 }
 
-
 LibBalsaABErr
-libbalsa_address_book_load(LibBalsaAddressBook        *ab,
-                           const gchar                *filter,
+libbalsa_address_book_load(LibBalsaAddressBook * ab,
+                           const gchar * filter,
                            LibBalsaAddressBookLoadFunc callback,
-                           gpointer                    closure)
+                           gpointer closure)
 {
     g_return_val_if_fail(LIBBALSA_IS_ADDRESS_BOOK(ab), LBABERR_OK);
     g_assert(LIBBALSA_ADDRESS_BOOK_GET_CLASS(ab) != NULL);
@@ -150,10 +146,9 @@ libbalsa_address_book_load(LibBalsaAddressBook        *ab,
                                                      closure);
 }
 
-
 LibBalsaABErr
-libbalsa_address_book_add_address(LibBalsaAddressBook *ab,
-                                  LibBalsaAddress     *address)
+libbalsa_address_book_add_address(LibBalsaAddressBook * ab,
+                                  LibBalsaAddress * address)
 {
     g_return_val_if_fail(LIBBALSA_IS_ADDRESS_BOOK(ab), LBABERR_OK);
     g_return_val_if_fail(LIBBALSA_IS_ADDRESS(address), LBABERR_OK);
@@ -162,10 +157,9 @@ libbalsa_address_book_add_address(LibBalsaAddressBook *ab,
     return LIBBALSA_ADDRESS_BOOK_GET_CLASS(ab)->add_address(ab, address);
 }
 
-
 LibBalsaABErr
-libbalsa_address_book_remove_address(LibBalsaAddressBook *ab,
-                                     LibBalsaAddress     *address)
+libbalsa_address_book_remove_address(LibBalsaAddressBook * ab,
+                                     LibBalsaAddress * address)
 {
     g_return_val_if_fail(LIBBALSA_IS_ADDRESS_BOOK(ab), LBABERR_OK);
     g_return_val_if_fail(LIBBALSA_IS_ADDRESS(address), LBABERR_OK);
@@ -175,11 +169,10 @@ libbalsa_address_book_remove_address(LibBalsaAddressBook *ab,
                                                                address);
 }
 
-
 LibBalsaABErr
-libbalsa_address_book_modify_address(LibBalsaAddressBook *ab,
-                                     LibBalsaAddress     *address,
-                                     LibBalsaAddress     *newval)
+libbalsa_address_book_modify_address(LibBalsaAddressBook * ab,
+                                     LibBalsaAddress * address,
+                                     LibBalsaAddress * newval)
 {
     LibBalsaABErr res;
 
@@ -190,17 +183,15 @@ libbalsa_address_book_modify_address(LibBalsaAddressBook *ab,
     res =
         LIBBALSA_ADDRESS_BOOK_GET_CLASS(ab)->modify_address(ab, address,
                                                             newval);
-    if (res == LBABERR_OK) {
+    if (res == LBABERR_OK)
         libbalsa_address_set_copy(address, newval);
-    }
 
     return res;
 }
 
-
 void
-libbalsa_address_book_set_status(LibBalsaAddressBook *ab,
-                                 const gchar         *status)
+libbalsa_address_book_set_status(LibBalsaAddressBook * ab,
+                                 const gchar         * status)
 {
     LibBalsaAddressBookPrivate *priv = libbalsa_address_book_get_instance_private(ab);
 
@@ -209,10 +200,9 @@ libbalsa_address_book_set_status(LibBalsaAddressBook *ab,
     priv->ext_op_code = g_strdup(status);
 }
 
-
 void
-libbalsa_address_book_save_config(LibBalsaAddressBook *ab,
-                                  const gchar         *group)
+libbalsa_address_book_save_config(LibBalsaAddressBook * ab,
+                                  const gchar * group)
 {
     g_return_if_fail(LIBBALSA_IS_ADDRESS_BOOK(ab));
     g_assert(LIBBALSA_ADDRESS_BOOK_GET_CLASS(ab) != NULL);
@@ -225,10 +215,9 @@ libbalsa_address_book_save_config(LibBalsaAddressBook *ab,
     libbalsa_conf_pop_group();
 }
 
-
 void
-libbalsa_address_book_load_config(LibBalsaAddressBook *ab,
-                                  const gchar         *group)
+libbalsa_address_book_load_config(LibBalsaAddressBook * ab,
+                                 const gchar * group)
 {
     LibBalsaAddressBookPrivate *priv = libbalsa_address_book_get_instance_private(ab);
 
@@ -239,15 +228,13 @@ libbalsa_address_book_load_config(LibBalsaAddressBook *ab,
     LIBBALSA_ADDRESS_BOOK_GET_CLASS(ab)->load_config(ab, group);
     libbalsa_conf_pop_group();
 
-    if (priv->is_expensive < 0) {
+    if (priv->is_expensive < 0)
         priv->is_expensive = FALSE;
-    }
 }
 
-
 GList *
-libbalsa_address_book_alias_complete(LibBalsaAddressBook *ab,
-                                     const gchar         *prefix)
+libbalsa_address_book_alias_complete(LibBalsaAddressBook * ab,
+                                     const gchar * prefix)
 {
     g_return_val_if_fail(LIBBALSA_IS_ADDRESS_BOOK(ab), NULL);
     g_assert(LIBBALSA_ADDRESS_BOOK_GET_CLASS(ab) != NULL);
@@ -257,8 +244,8 @@ libbalsa_address_book_alias_complete(LibBalsaAddressBook *ab,
 
 
 static void
-libbalsa_address_book_real_save_config(LibBalsaAddressBook *ab,
-                                       const gchar         *group)
+libbalsa_address_book_real_save_config(LibBalsaAddressBook * ab,
+                                      const gchar * group)
 {
     LibBalsaAddressBookPrivate *priv = libbalsa_address_book_get_instance_private(ab);
 
@@ -275,10 +262,9 @@ libbalsa_address_book_real_save_config(LibBalsaAddressBook *ab,
     priv->config_prefix = g_strdup(group);
 }
 
-
 static void
-libbalsa_address_book_real_load_config(LibBalsaAddressBook *ab,
-                                       const gchar         *group)
+libbalsa_address_book_real_load_config(LibBalsaAddressBook * ab,
+                                      const gchar * group)
 {
     LibBalsaAddressBookPrivate *priv = libbalsa_address_book_get_instance_private(ab);
     gboolean def;
@@ -292,11 +278,10 @@ libbalsa_address_book_real_load_config(LibBalsaAddressBook *ab,
 
     priv->is_expensive =
         libbalsa_conf_get_bool_with_default("IsExpensive", &def);
-    if (def) {
+    if (def)
         /* Default will be supplied by the backend, or in
          * libbalsa_address_book_load_config. */
         priv->is_expensive = -1;
-    }
 
     priv->dist_list_mode = libbalsa_conf_get_bool("DistListMode=false");
 
@@ -304,135 +289,109 @@ libbalsa_address_book_real_load_config(LibBalsaAddressBook *ab,
     priv->name = libbalsa_conf_get_string("Name=Address Book");
 }
 
-
-const gchar *
-libbalsa_address_book_strerror(LibBalsaAddressBook *ab,
-                               LibBalsaABErr        err)
+const gchar*
+libbalsa_address_book_strerror(LibBalsaAddressBook * ab, LibBalsaABErr err)
 {
     LibBalsaAddressBookPrivate *priv = libbalsa_address_book_get_instance_private(ab);
     const gchar *s;
 
     g_return_val_if_fail(ab, NULL);
-    if (priv->ext_op_code) {
-        return priv->ext_op_code;
-    }
-
-    switch (err) {
-    case LBABERR_OK:             s = _("No error");
-        break;
-
-    case LBABERR_CANNOT_READ:    s = _("Cannot read from address book");
-        break;
-
-    case LBABERR_CANNOT_WRITE:   s = _("Cannot write to address book");
+    if(priv->ext_op_code)
+       return priv->ext_op_code;
+
+    switch(err) {
+    case LBABERR_OK:             s= _("No error"); break;
+    case LBABERR_CANNOT_READ:    s= _("Cannot read from address book"); break;
+    case LBABERR_CANNOT_WRITE:   s= _("Cannot write to address book");  break;
+    case LBABERR_CANNOT_CONNECT: s= _("Cannot connect to the server");  break; 
+    case LBABERR_CANNOT_SEARCH:  s= _("Cannot search in the address book"); 
         break;
-
-    case LBABERR_CANNOT_CONNECT: s = _("Cannot connect to the server");
-        break;
-
-    case LBABERR_CANNOT_SEARCH:  s = _("Cannot search in the address book");
-        break;
-
-    case LBABERR_DUPLICATE:      s = _("Cannot add duplicate entry");
-        break;
-
+    case LBABERR_DUPLICATE:      s= _("Cannot add duplicate entry");    break;
     case LBABERR_ADDRESS_NOT_FOUND:
-        s = _("Cannot find address in address book");
-        break;
-
-    default: s = _("Unknown error");
-        break;
+        s= _("Cannot find address in address book"); break;
+    default: s= _("Unknown error"); break;
     }
     return s;
 }
 
-
 /*
  * Getters
  */
 
 gboolean
-libbalsa_address_book_get_dist_list_mode(LibBalsaAddressBook *ab)
+libbalsa_address_book_get_dist_list_mode(LibBalsaAddressBook * ab)
 {
     LibBalsaAddressBookPrivate *priv = libbalsa_address_book_get_instance_private(ab);
 
     return priv->dist_list_mode;
 }
 
-
 gboolean
-libbalsa_address_book_get_expand_aliases(LibBalsaAddressBook *ab)
+libbalsa_address_book_get_expand_aliases(LibBalsaAddressBook * ab)
 {
     LibBalsaAddressBookPrivate *priv = libbalsa_address_book_get_instance_private(ab);
 
     return priv->expand_aliases;
 }
 
-
 gboolean
-libbalsa_address_book_get_is_expensive(LibBalsaAddressBook *ab)
+libbalsa_address_book_get_is_expensive(LibBalsaAddressBook * ab)
 {
     LibBalsaAddressBookPrivate *priv = libbalsa_address_book_get_instance_private(ab);
 
     return priv->is_expensive;
 }
 
-
 const gchar *
-libbalsa_address_book_get_name(LibBalsaAddressBook *ab)
+libbalsa_address_book_get_name(LibBalsaAddressBook * ab)
 {
     LibBalsaAddressBookPrivate *priv = libbalsa_address_book_get_instance_private(ab);
 
     return priv->name;
 }
 
-
 const gchar *
-libbalsa_address_book_get_config_prefix(LibBalsaAddressBook *ab)
+libbalsa_address_book_get_config_prefix(LibBalsaAddressBook * ab)
 {
     LibBalsaAddressBookPrivate *priv = libbalsa_address_book_get_instance_private(ab);
 
     return priv->config_prefix;
 }
 
-
 /*
  * Setters
  */
 
 void
-libbalsa_address_book_set_dist_list_mode(LibBalsaAddressBook *ab,
-                                         gboolean             dist_list_mode)
+libbalsa_address_book_set_dist_list_mode(LibBalsaAddressBook * ab,
+                                         gboolean              dist_list_mode)
 {
     LibBalsaAddressBookPrivate *priv = libbalsa_address_book_get_instance_private(ab);
 
     priv->dist_list_mode = dist_list_mode;
 }
 
-
 void
-libbalsa_address_book_set_expand_aliases(LibBalsaAddressBook *ab,
-                                         gboolean             expand_aliases)
+libbalsa_address_book_set_expand_aliases(LibBalsaAddressBook * ab,
+                                         gboolean              expand_aliases)
 {
     LibBalsaAddressBookPrivate *priv = libbalsa_address_book_get_instance_private(ab);
 
     priv->expand_aliases = expand_aliases;
 }
 
-
 void
-libbalsa_address_book_set_is_expensive(LibBalsaAddressBook *ab,
-                                       gboolean             is_expensive)
+libbalsa_address_book_set_is_expensive(LibBalsaAddressBook * ab,
+                                       gboolean              is_expensive)
 {
     LibBalsaAddressBookPrivate *priv = libbalsa_address_book_get_instance_private(ab);
 
     priv->is_expensive = is_expensive;
 }
 
-
 void
-libbalsa_address_book_set_name(LibBalsaAddressBook *ab,
-                               const gchar         *name)
+libbalsa_address_book_set_name(LibBalsaAddressBook * ab,
+                               const gchar         * name)
 {
     LibBalsaAddressBookPrivate *priv = libbalsa_address_book_get_instance_private(ab);
 
diff --git a/libbalsa/address-book.h b/libbalsa/address-book.h
index 907841e..39f5277 100644
--- a/libbalsa/address-book.h
+++ b/libbalsa/address-book.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -36,111 +36,109 @@ typedef enum {
     LBABERR_DUPLICATE,
     LBABERR_ADDRESS_NOT_FOUND
 } LibBalsaABErr;
-
+    
 typedef struct _LibBalsaAddressBook LibBalsaAddressBook;
 typedef struct _LibBalsaAddressBookClass LibBalsaAddressBookClass;
 
 typedef LibBalsaABErr (*LibBalsaAddressBookLoadFunc)(LibBalsaAddressBook *ab,
-                                                     LibBalsaAddress     *address,
-                                                     gpointer             closure);
+                                                     LibBalsaAddress *address,
+                                                     gpointer closure);
 
 struct _LibBalsaAddressBookClass {
     GObjectClass parent;
 
-    LibBalsaABErr (*load) (LibBalsaAddressBook        *ab,
-                           const gchar                *filter,
+    LibBalsaABErr (*load) (LibBalsaAddressBook * ab,
+                           const gchar *filter,
                            LibBalsaAddressBookLoadFunc callback,
-                           gpointer                    closure);
+                           gpointer closure);
 
     /* adds given address to the address book, updating the permanent
      * storage. */
-    LibBalsaABErr (*add_address) (LibBalsaAddressBook *ab,
-                                  LibBalsaAddress     *address);
+    LibBalsaABErr (*add_address) (LibBalsaAddressBook * ab,
+                                  LibBalsaAddress * address);
 
     /* remove given address to the address book, updating the permanent
      * storage. */
-    LibBalsaABErr (*remove_address) (LibBalsaAddressBook *ab,
-                                     LibBalsaAddress     *address);
+    LibBalsaABErr (*remove_address) (LibBalsaAddressBook * ab,
+                                     LibBalsaAddress * address);
 
     /* Sets new entries for given address, copying fields from newval.
      * Updates the permanent storage. */
-    LibBalsaABErr (*modify_address) (LibBalsaAddressBook *ab,
-                                     LibBalsaAddress     *address,
-                                     LibBalsaAddress     *newval);
+    LibBalsaABErr (*modify_address) (LibBalsaAddressBook * ab,
+                                     LibBalsaAddress * address,
+                                     LibBalsaAddress * newval);
 
-    void (*save_config) (LibBalsaAddressBook *ab,
-                         const gchar         *prefix);
-    void (*load_config) (LibBalsaAddressBook *ab,
-                         const gchar         *prefix);
+    void (*save_config) (LibBalsaAddressBook * ab, const gchar * prefix);
+    void (*load_config) (LibBalsaAddressBook * ab, const gchar * prefix);
 
-    GList * (*alias_complete) (LibBalsaAddressBook *ab,
-                               const gchar         *prefix);
+    GList* (*alias_complete) (LibBalsaAddressBook * ab, const gchar *prefix);
 };
 
 LibBalsaAddressBook *libbalsa_address_book_new_from_config(const gchar *
-                                                           prefix);
+                                                          prefix);
 
 /*
-   This will call the callback function once for each address in the
-   address book.  The recipient should make sure to ref the address if
-   they will be keeping a reference to it around. The callback may
-   occur asynchronously.
-
-   After all addresses are loaded the callback will be called with
-   address==NULL.
- */
-LibBalsaABErr libbalsa_address_book_load(LibBalsaAddressBook        *ab,
-                                         const char                 *filter,
+  This will call the callback function once for each address in the
+  address book.  The recipient should make sure to ref the address if
+  they will be keeping a reference to it around. The callback may
+  occur asynchronously.
+  
+  After all addresses are loaded the callback will be called with
+  address==NULL.  
+*/
+LibBalsaABErr libbalsa_address_book_load(LibBalsaAddressBook * ab,
+                                         const char *filter,
                                          LibBalsaAddressBookLoadFunc callback,
-                                         gpointer                    closure);
+                                         gpointer closure);
 
 LibBalsaABErr libbalsa_address_book_add_address(LibBalsaAddressBook *ab,
-                                                LibBalsaAddress     *address);
+                                                LibBalsaAddress *address);
 LibBalsaABErr libbalsa_address_book_remove_address(LibBalsaAddressBook *ab,
-                                                   LibBalsaAddress     *address);
+                                                   LibBalsaAddress *address);
 LibBalsaABErr libbalsa_address_book_modify_address(LibBalsaAddressBook *ab,
-                                                   LibBalsaAddress     *address,
-                                                   LibBalsaAddress     *newval);
+                                                   LibBalsaAddress *address,
+                                                   LibBalsaAddress *newval);
 
-void libbalsa_address_book_set_status(LibBalsaAddressBook *ab,
-                                      const gchar         *status);
-void libbalsa_address_book_save_config(LibBalsaAddressBook *ab,
-                                       const gchar         *prefix);
-void libbalsa_address_book_load_config(LibBalsaAddressBook *ab,
-                                       const gchar         *prefix);
+void libbalsa_address_book_set_status(LibBalsaAddressBook * ab,
+                                      const gchar         * status);
+void libbalsa_address_book_save_config(LibBalsaAddressBook * ab,
+                                      const gchar * prefix);
+void libbalsa_address_book_load_config(LibBalsaAddressBook * ab,
+                                      const gchar * prefix);
 
-const gchar *libbalsa_address_book_strerror(LibBalsaAddressBook *ab,
-                                            LibBalsaABErr        err);
+const gchar* libbalsa_address_book_strerror(LibBalsaAddressBook * ab,
+                                           LibBalsaABErr err);
 
 /*
 
-   Returns a list of LibBalsaAddress objects. The caller is responsible
-   for unref()ing these address objects when it is finished with them
-   and for freeing the list.
+ Returns a list of LibBalsaAddress objects. The caller is responsible
+ for unref()ing these address objects when it is finished with them
+ and for freeing the list.
 
- */
-GList *libbalsa_address_book_alias_complete(LibBalsaAddressBook *ab,
-                                            const gchar         *prefix);
+*/
+GList *libbalsa_address_book_alias_complete(LibBalsaAddressBook * ab, 
+                                           const gchar *prefix);
 
 /*
  * Getters
  */
-gboolean      libbalsa_address_book_get_dist_list_mode(LibBalsaAddressBook *ab);
-gboolean      libbalsa_address_book_get_expand_aliases(LibBalsaAddressBook *ab);
-gboolean      libbalsa_address_book_get_is_expensive(LibBalsaAddressBook *ab);
-const gchar *libbalsa_address_book_get_name(LibBalsaAddressBook *ab);
-const gchar *libbalsa_address_book_get_config_prefix(LibBalsaAddressBook *ab);
+gboolean      libbalsa_address_book_get_dist_list_mode(LibBalsaAddressBook * ab);
+gboolean      libbalsa_address_book_get_expand_aliases(LibBalsaAddressBook * ab);
+gboolean      libbalsa_address_book_get_is_expensive  (LibBalsaAddressBook * ab);
+const gchar * libbalsa_address_book_get_name          (LibBalsaAddressBook * ab);
+const gchar * libbalsa_address_book_get_config_prefix (LibBalsaAddressBook * ab);
 
 /*
  * Setters
  */
-void libbalsa_address_book_set_dist_list_mode(LibBalsaAddressBook *ab,
-                                              gboolean             dist_list_mode);
-void libbalsa_address_book_set_expand_aliases(LibBalsaAddressBook *ab,
-                                              gboolean             expand_aliases);
-void libbalsa_address_book_set_is_expensive(LibBalsaAddressBook *ab,
-                                            gboolean             is_expensive);
-void libbalsa_address_book_set_name(LibBalsaAddressBook *ab,
-                                    const gchar         *name);
+void libbalsa_address_book_set_dist_list_mode(LibBalsaAddressBook * ab,
+                                              gboolean              dist_list_mode);
+void libbalsa_address_book_set_expand_aliases(LibBalsaAddressBook * ab,
+                                              gboolean              expand_aliases);
+void libbalsa_address_book_set_is_expensive  (LibBalsaAddressBook * ab,
+                                              gboolean              is_expensive);
+void libbalsa_address_book_set_name          (LibBalsaAddressBook * ab,
+                                              const gchar         * name);
 
 #endif
+
diff --git a/libbalsa/address-view.c b/libbalsa/address-view.c
index 5dfd491..10d121d 100644
--- a/libbalsa/address-view.c
+++ b/libbalsa/address-view.c
@@ -26,7 +26,7 @@
 
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "address-view.h"
 
@@ -57,7 +57,7 @@ typedef struct {
     GtkEntryClass parent_class;
 } LibBalsaAddressViewEntryClass;
 
-static void lbav_popup_completions(LibBalsaAddressViewEntry *entry);
+static void lbav_popup_completions(LibBalsaAddressViewEntry * entry);
 
 /*
  *     GObject class boilerplate
@@ -68,48 +68,44 @@ enum {
     ENTRY_LAST_SIGNAL
 };
 
-static guint address_view_entry_signals[ENTRY_LAST_SIGNAL] = {
-    0
-};
+static guint address_view_entry_signals[ENTRY_LAST_SIGNAL] = { 0 };
 
 static void
-libbalsa_address_view_entry_init(LibBalsaAddressViewEntry *entry)
+libbalsa_address_view_entry_init(LibBalsaAddressViewEntry * entry)
 {
 }
 
-
 static GType libbalsa_address_view_entry_get_type(void);
 
 G_DEFINE_TYPE(LibBalsaAddressViewEntry, libbalsa_address_view_entry, GTK_TYPE_ENTRY)
 
 static void
-libbalsa_address_view_entry_class_init(LibBalsaAddressViewEntryClass *klass)
+libbalsa_address_view_entry_class_init(LibBalsaAddressViewEntryClass * klass)
 {
     GtkBindingSet *binding_set;
 
     /**
-     * LibBalsaAddressViewEntry::popup-completions:
-     * @entry: the object which received the signal
-     *
-     * The ::popup-completions signal is bound to the Esc key.
-     **/
-    address_view_entry_signals[POPUP_COMPLETIONS] =
-        g_signal_new_class_handler("popup-completions",
-                                   G_OBJECT_CLASS_TYPE(klass),
-                                   G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
-                                   G_CALLBACK(lbav_popup_completions),
-                                   NULL, NULL, NULL,
-                                   G_TYPE_NONE, 0);
-
-    binding_set = gtk_binding_set_by_class(klass);
-    gtk_binding_entry_add_signal(binding_set,
-                                 GDK_KEY_Escape, 0,
-                                 "popup-completions", 0);
+    * LibBalsaAddressViewEntry::popup-completions:
+    * @entry: the object which received the signal
+    *
+    * The ::popup-completions signal is bound to the Esc key.
+    **/
+     address_view_entry_signals[POPUP_COMPLETIONS] =
+         g_signal_new_class_handler("popup-completions",
+                                    G_OBJECT_CLASS_TYPE(klass),
+                                    G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+                                    G_CALLBACK(lbav_popup_completions),
+                                    NULL, NULL, NULL,
+                                    G_TYPE_NONE, 0);
+
+     binding_set = gtk_binding_set_by_class(klass);
+     gtk_binding_entry_add_signal(binding_set,
+                                  GDK_KEY_Escape, 0,
+                                  "popup-completions", 0);
 }
 
-
 static GtkWidget *
-libbalsa_address_view_entry_new(LibBalsaAddressView *address_view)
+libbalsa_address_view_entry_new(LibBalsaAddressView * address_view)
 {
     LibBalsaAddressViewEntry *entry;
 
@@ -119,7 +115,6 @@ libbalsa_address_view_entry_new(LibBalsaAddressView *address_view)
     return (GtkWidget *) entry;
 }
 
-
 /*************************************************************
  *
  * LibBalsaAddressView
@@ -159,20 +154,17 @@ enum {
     LAST_SIGNAL
 };
 
-static guint address_view_signals[LAST_SIGNAL] = {
-    0
-};
+static guint address_view_signals[LAST_SIGNAL] = { 0 };
 
 G_DEFINE_TYPE(LibBalsaAddressView, libbalsa_address_view, GTK_TYPE_GRID)
 
 static void
-libbalsa_address_view_init(LibBalsaAddressView *address_view)
+libbalsa_address_view_init(LibBalsaAddressView * address_view)
 {
 }
 
-
 static void
-libbalsa_address_view_finalize(GObject *object)
+libbalsa_address_view_finalize(GObject * object)
 {
     LibBalsaAddressView *address_view = LIBBALSA_ADDRESS_VIEW(object);
 
@@ -181,23 +173,22 @@ libbalsa_address_view_finalize(GObject *object)
     G_OBJECT_CLASS(libbalsa_address_view_parent_class)->finalize(object);
 }
 
-
 static void
-libbalsa_address_view_class_init(LibBalsaAddressViewClass *klass)
+libbalsa_address_view_class_init(LibBalsaAddressViewClass * klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS(klass);
 
     object_class->finalize = libbalsa_address_view_finalize;
 
-    /**
-     * LibBalsaAddressView::open-address-book:
-     * @address_view: the object which received the signal
-     * @widget:       a #GtkWidget in the row in @address_view
-     *                that will contain the address
-     *
-     * The ::open-address-book signal is emitted when the address book
-     * button is clicked.
-     **/
+  /**
+   * LibBalsaAddressView::open-address-book:
+   * @address_view: the object which received the signal
+   * @widget:       a #GtkWidget in the row in @address_view
+   *                that will contain the address
+   *
+   * The ::open-address-book signal is emitted when the address book
+   * button is clicked.
+   **/
     address_view_signals[OPEN_ADDRESS_BOOK] =
         g_signal_new("open-address-book",
                      G_OBJECT_CLASS_TYPE(object_class),
@@ -205,13 +196,13 @@ libbalsa_address_view_class_init(LibBalsaAddressViewClass *klass)
                      g_cclosure_marshal_VOID__OBJECT,
                      G_TYPE_NONE, 1, G_TYPE_OBJECT);
 
-    /**
-     * LibBalsaAddressView::view-changed:
-     * @address_view: the object which received the signal
-     *
-     * The ::view-changed signal is emitted when an address in the view
-     * has been edited or removed.
-     **/
+  /**
+   * LibBalsaAddressView::view-changed:
+   * @address_view: the object which received the signal
+   *
+   * The ::view-changed signal is emitted when an address in the view
+   * has been edited or removed.
+   **/
     address_view_signals[VIEW_CHANGED] =
         g_signal_new("view-changed",
                      G_OBJECT_CLASS_TYPE(object_class),
@@ -220,7 +211,6 @@ libbalsa_address_view_class_init(LibBalsaAddressViewClass *klass)
                      G_TYPE_NONE, 0);
 }
 
-
 /*
  *     Static data.
  */
@@ -248,14 +238,14 @@ enum {
     LIBBALSA_ADDRESS_VIEW_ENTRY_COLUMN
 };
 
-#define lbav_get_button(a, r) \
-    gtk_grid_get_child_at((GtkGrid *)(a), LIBBALSA_ADDRESS_VIEW_BUTTON_COLUMN, (r))
-#define lbav_get_combo(a, r) \
-    gtk_grid_get_child_at((GtkGrid *)(a), LIBBALSA_ADDRESS_VIEW_COMBO_COLUMN, (r))
-#define lbav_get_entry(a, r) \
-    gtk_grid_get_child_at((GtkGrid *)(a), LIBBALSA_ADDRESS_VIEW_ENTRY_COLUMN, (r))
-#define lbav_remove_row(a, r) \
-    gtk_grid_remove_row((GtkGrid *)(a), (r))
+#define lbav_get_button(a,r) \
+        gtk_grid_get_child_at((GtkGrid*)(a),LIBBALSA_ADDRESS_VIEW_BUTTON_COLUMN,(r))
+#define lbav_get_combo(a,r) \
+        gtk_grid_get_child_at((GtkGrid*)(a),LIBBALSA_ADDRESS_VIEW_COMBO_COLUMN,(r))
+#define lbav_get_entry(a,r) \
+        gtk_grid_get_child_at((GtkGrid*)(a),LIBBALSA_ADDRESS_VIEW_ENTRY_COLUMN,(r))
+#define lbav_remove_row(a,r) \
+        gtk_grid_remove_row((GtkGrid*)(a),(r))
 
 typedef enum {
     WITH_BOOK_ICON,
@@ -268,36 +258,31 @@ static GdkPixbuf *lbav_book_icon, *lbav_close_icon, *lbav_drop_down_icon;
 /*
  * Forward references
  */
-static gboolean lbav_completion_match_func(GtkEntryCompletion  *completion,
-                                           const gchar         *key,
-                                           GtkTreeIter         *iter,
-                                           LibBalsaAddressView *address_view);
+static gboolean lbav_completion_match_func(GtkEntryCompletion * completion,
+                                           const gchar * key,
+                                           GtkTreeIter * iter,
+                                           LibBalsaAddressView * address_view);
 
-static gboolean lbav_completion_match_selected_cb(GtkEntryCompletion  *completion,
-                                                  GtkTreeModel        *model,
-                                                  GtkTreeIter         *iter,
-                                                  LibBalsaAddressView *address_view);
+static gboolean lbav_completion_match_selected_cb(GtkEntryCompletion * completion,
+                                                  GtkTreeModel * model,
+                                                  GtkTreeIter * iter,
+                                                  LibBalsaAddressView * address_view);
 
-static void lbav_entry_changed_cb(GtkEntry            *entry,
-                                  LibBalsaAddressView *address_view);
+static void lbav_entry_changed_cb(GtkEntry * entry, LibBalsaAddressView * address_view);
 
-static void lbav_insert_text_cb(GtkEditable         *editable,
-                                const gchar         *text,
-                                gint                 length,
-                                gint                *position,
-                                LibBalsaAddressView *address_view);
+static void lbav_insert_text_cb(GtkEditable * editable,
+                                const gchar * text,
+                                gint length,
+                                gint * position, LibBalsaAddressView * address_view);
 
 static void lbav_notify_has_focus_cb(GtkEntry            *entry,
                                      GParamSpec          *pspec,
                                      LibBalsaAddressView *address_view);
 
-static void lbav_insert_row(LibBalsaAddressView    *address_view,
-                            gint                    row,
-                            gint                    type,
-                            LibbalsaAddressViewIcon icon);
+static void lbav_insert_row(LibBalsaAddressView * address_view, gint row,
+                            gint type, LibbalsaAddressViewIcon icon);
 
-static gint lbav_ensure_blank_row(LibBalsaAddressView *address_view,
-                                  gint                 type);
+static gint lbav_ensure_blank_row(LibBalsaAddressView * address_view, gint type);
 
 /*
  *     Helpers
@@ -307,8 +292,8 @@ static gint lbav_ensure_blank_row(LibBalsaAddressView *address_view,
  *     Create a GList of addresses matching the prefix.
  */
 static GList *
-lbav_get_matching_addresses(LibBalsaAddressView         *address_view,
-                            const gchar                 *prefix,
+lbav_get_matching_addresses(LibBalsaAddressView * address_view,
+                            const gchar * prefix,
                             LibBalsaAddressViewMatchType type)
 {
     GList *match = NULL, *list;
@@ -322,11 +307,10 @@ lbav_get_matching_addresses(LibBalsaAddressView         *address_view,
         LibBalsaAddressBook *ab;
 
         ab = LIBBALSA_ADDRESS_BOOK(list->data);
-        if ((type == LIBBALSA_ADDRESS_VIEW_MATCH_FAST)
+        if (type == LIBBALSA_ADDRESS_VIEW_MATCH_FAST
             && (!libbalsa_address_book_get_expand_aliases(ab) ||
-                libbalsa_address_book_get_is_expensive(ab))) {
+                libbalsa_address_book_get_is_expensive(ab)))
             continue;
-        }
 
         match =
             g_list_concat(match,
@@ -338,16 +322,14 @@ lbav_get_matching_addresses(LibBalsaAddressView         *address_view,
     return match;
 }
 
-
 /*
  *     Update the GtkEntryCompletion's GtkTreeModel with
  *     the list of addresses.
  */
 static void
-lbav_append_addresses(LibBalsaAddressView *address_view,
-                      GtkEntryCompletion  *completion,
-                      GList               *match,
-                      const gchar         *prefix)
+lbav_append_addresses(LibBalsaAddressView * address_view,
+                      GtkEntryCompletion * completion,
+                      GList * match, const gchar * prefix)
 {
     GtkListStore *store;
     GtkTreeIter iter;
@@ -378,59 +360,53 @@ lbav_append_addresses(LibBalsaAddressView *address_view,
     }
 }
 
-
 /*
  *     Fetch a GList of addresses matching the active entry and update
  *     the GtkEntryCompletion's list.
  */
 static void
-lbav_entry_setup_matches(LibBalsaAddressView         *address_view,
-                         GtkEntry                    *entry,
-                         GtkEntryCompletion          *completion,
+lbav_entry_setup_matches(LibBalsaAddressView * address_view,
+                         GtkEntry * entry,
+                         GtkEntryCompletion * completion,
                          LibBalsaAddressViewMatchType type)
 {
     const gchar *prefix;
     GList *match = NULL;
 
     prefix = gtk_entry_get_text(entry);
-    if (*prefix) {
+    if (*prefix)
         match = lbav_get_matching_addresses(address_view, prefix, type);
-    }
     lbav_append_addresses(address_view, completion, match, prefix);
     g_list_free_full(match, g_object_unref);
 }
 
-
 /*
  *     Get a type-string
  */
 static const gchar *
-lbav_type_string(LibBalsaAddressView *address_view,
-                 gint                 type)
+lbav_type_string(LibBalsaAddressView * address_view, gint type)
 {
     return address_view->n_types > 0 ? address_view->types[type] : "";
 }
 
-
 /*
  * Callback for the address-book button
  */
 static void
-lbav_book_button_clicked(GtkButton           *button,
-                         LibBalsaAddressView *address_view)
+lbav_book_button_clicked(GtkButton           * button,
+                         LibBalsaAddressView * address_view)
 {
     g_signal_emit(address_view,
                   address_view_signals[OPEN_ADDRESS_BOOK], 0, button);
 }
 
-
 /*
  * Callback for the close button
  */
 
 static void
-lbav_close_button_clicked(GtkWidget           *button,
-                          LibBalsaAddressView *address_view)
+lbav_close_button_clicked(GtkWidget           * button,
+                          LibBalsaAddressView * address_view)
 {
     gint row;
     GtkWidget *child;
@@ -452,14 +428,12 @@ lbav_close_button_clicked(GtkWidget           *button,
     g_signal_emit(address_view, address_view_signals[VIEW_CHANGED], 0);
 }
 
-
 /*
  * Create an action button for a row
  */
 
 static void
-lbav_set_button(LibBalsaAddressView    *address_view,
-                gint                    row,
+lbav_set_button(LibBalsaAddressView * address_view, gint row,
                 LibbalsaAddressViewIcon icon)
 {
     GtkGrid *grid = (GtkGrid *) address_view;
@@ -486,12 +460,11 @@ lbav_set_button(LibBalsaAddressView    *address_view,
                     LIBBALSA_ADDRESS_VIEW_BUTTON_COLUMN, row, 1, 1);
 }
 
-
 /*
  * Callback for the combo_box "changed"signal
  */
 static gboolean
-lbav_combo_changed_idle(LibBalsaAddressView *address_view)
+lbav_combo_changed_idle(LibBalsaAddressView * address_view)
 {
     /* The type of an address was changed. We make it the last address
      * of the new type, moving the row if necessary. */
@@ -553,22 +526,19 @@ lbav_combo_changed_idle(LibBalsaAddressView *address_view)
     return G_SOURCE_REMOVE;
 }
 
-
 static void
-lbav_combo_changed(GtkComboBox         *combo_box,
-                   LibBalsaAddressView *address_view)
+lbav_combo_changed(GtkComboBox *combo_box, LibBalsaAddressView * address_view)
 {
     address_view->changed_combo = (GtkWidget *) g_object_ref(combo_box);
     g_idle_add((GSourceFunc) lbav_combo_changed_idle, g_object_ref(address_view));
 }
 
-
 /*
  * Callback for the entry "activate" signal
  */
 static void
-lbav_entry_activated(GtkEntry            *entry,
-                     LibBalsaAddressView *address_view)
+lbav_entry_activated(GtkEntry            * entry,
+                     LibBalsaAddressView * address_view)
 {
     gint row;
     GtkWidget *child;
@@ -591,16 +561,13 @@ lbav_entry_activated(GtkEntry            *entry,
     g_signal_emit(address_view, address_view_signals[VIEW_CHANGED], 0);
 }
 
-
 /*
  * Insert and populate a row
  */
 
 static void
-lbav_insert_row(LibBalsaAddressView    *address_view,
-                gint                    row,
-                gint                    type,
-                LibbalsaAddressViewIcon icon)
+lbav_insert_row(LibBalsaAddressView * address_view, gint row,
+                gint type, LibbalsaAddressViewIcon icon)
 {
     GtkGrid *grid = (GtkGrid *) address_view;
     GtkWidget *entry;
@@ -665,7 +632,7 @@ lbav_insert_row(LibBalsaAddressView    *address_view,
     g_signal_connect(entry, "insert-text",
                      G_CALLBACK(lbav_insert_text_cb), address_view);
     g_signal_connect_after(entry, "notify::has-focus",
-                           G_CALLBACK(lbav_notify_has_focus_cb), address_view);
+                          G_CALLBACK(lbav_notify_has_focus_cb), address_view);
 
     gtk_grid_attach(grid, entry,
                     LIBBALSA_ADDRESS_VIEW_ENTRY_COLUMN, row, 1, 1);
@@ -674,14 +641,12 @@ lbav_insert_row(LibBalsaAddressView    *address_view,
     }
 }
 
-
 /*
  *     Make sure we have a blank line; use the specified type.
  */
 
 static gint
-lbav_ensure_blank_row(LibBalsaAddressView *address_view,
-                      gint                 type)
+lbav_ensure_blank_row(LibBalsaAddressView * address_view, gint type)
 {
     gint row;
     GtkWidget *child;
@@ -693,7 +658,7 @@ lbav_ensure_blank_row(LibBalsaAddressView *address_view,
         const gchar *name;
 
         name = gtk_entry_get_text(GTK_ENTRY(child));
-        if ((name == NULL) || (name[0] == '\0')) {
+        if (name == NULL || name[0] == '\0') {
             lbav_remove_row(address_view, row);
         } else {
             /* Make sure the row has a close button. */
@@ -718,46 +683,41 @@ lbav_ensure_blank_row(LibBalsaAddressView *address_view,
     return row;
 }
 
-
 /*
  *     Replace non-printable chars by spaces
  */
 static void
-lbav_clean_text(gchar *text)
+lbav_clean_text(gchar * text)
 {
     gchar *p;
     gboolean was_graph = FALSE;
 
     p = text;
     while (*p) {
-        gunichar c = g_utf8_get_char(p);
+        gunichar c  = g_utf8_get_char(p);
         gchar *next = g_utf8_next_char(p);
 
         if (g_unichar_isprint(c)) {
             was_graph = g_unichar_isgraph(c);
             p = next;
         } else {
-            if (was_graph) {
+            if (was_graph)
                 *p++ = ' ';
-            }
             was_graph = FALSE;
-            if (p != next) {
+            if (p != next)
                 memmove(p, next, strlen(next) + 1);
-            }
         }
     }
 }
 
-
 /*
  *     Add the addresses in an InternetAddressList, starting at row and
  *     inserting lines of the same type as necessary;
  *     on return, row points to the last line inserted.
  */
 static void
-lbav_add_from_list(LibBalsaAddressView *address_view,
-                   gint                 row,
-                   InternetAddressList *list)
+lbav_add_from_list(LibBalsaAddressView * address_view,
+                   gint row, InternetAddressList * list)
 {
     gint type;
     int i;
@@ -788,38 +748,33 @@ lbav_add_from_list(LibBalsaAddressView *address_view,
     g_signal_emit(address_view, address_view_signals[VIEW_CHANGED], 0);
 }
 
-
 /*
  *     Add the addresses in a string, starting at row and
  *     inserting lines of the same type as necessary;
  *     returns TRUE if any valid addresses were found.
  */
 static gboolean
-lbav_add_from_string(LibBalsaAddressView *address_view,
-                     gint                 row,
-                     const gchar         *string)
+lbav_add_from_string(LibBalsaAddressView * address_view,
+                     gint row, const gchar * string)
 {
     InternetAddressList *list;
     gboolean retval = FALSE;
 
     list = internet_address_list_parse_string(string);
     if (list != NULL) {
-        if ((retval = (internet_address_list_length(list) > 0))) {
+        if ((retval = (internet_address_list_length(list) > 0)))
             lbav_add_from_list(address_view, row, list);
-        }
         g_object_unref(list);
     }
 
     return retval;
 }
 
-
 /*
  *     Remove addresses of the given type
  */
 static void
-lbav_remove_type(LibBalsaAddressView *address_view,
-                 gint                 type)
+lbav_remove_type(LibBalsaAddressView * address_view, gint type)
 {
     gint row;
     GtkWidget *child;
@@ -839,16 +794,14 @@ lbav_remove_type(LibBalsaAddressView *address_view,
     g_signal_emit(address_view, address_view_signals[VIEW_CHANGED], 0);
 }
 
-
 /*
  *     Add the addresses
  */
 static void
-lbav_add_addresses(LibBalsaAddressView *address_view,
-                   gint                 type,
-                   const gchar         *addresses)
+lbav_add_addresses(LibBalsaAddressView * address_view, gint type,
+                   const gchar * addresses)
 {
-    if ((addresses != NULL) && (addresses[0] != '\0')) {
+    if (addresses != NULL && addresses[0] != '\0') {
         gint row;
 
         row = lbav_ensure_blank_row(address_view, type);
@@ -860,13 +813,12 @@ lbav_add_addresses(LibBalsaAddressView *address_view,
     }
 }
 
-
 /*
  *     Find an address_type
  */
 static guint
-lbav_get_type(LibBalsaAddressView *address_view,
-              const gchar         *address_type)
+lbav_get_type(LibBalsaAddressView * address_view,
+              const gchar * address_type)
 {
     gint type;
 
@@ -879,7 +831,6 @@ lbav_get_type(LibBalsaAddressView *address_view,
     return type;
 }
 
-
 /*
  * Callbacks.
  */
@@ -888,26 +839,23 @@ lbav_get_type(LibBalsaAddressView *address_view,
  *     Callback for the entry's "changed" signal
  */
 static void
-lbav_entry_changed_cb(GtkEntry            *entry,
-                      LibBalsaAddressView *address_view)
+lbav_entry_changed_cb(GtkEntry * entry, LibBalsaAddressView * address_view)
 {
     GtkEntryCompletion *completion;
 
     completion = gtk_entry_get_completion(entry);
 
-    if (gtk_widget_get_window(GTK_WIDGET(entry))) {
+    if (gtk_widget_get_window(GTK_WIDGET(entry)))
         lbav_entry_setup_matches(address_view, entry, completion,
                                  LIBBALSA_ADDRESS_VIEW_MATCH_FAST);
-    }
     address_view->last_was_escape = FALSE;
 }
 
-
 /*
  *     Class method for LibBalsaAddressViewEntry::popup-completions
  */
 static void
-lbav_popup_completions(LibBalsaAddressViewEntry *view_entry)
+lbav_popup_completions(LibBalsaAddressViewEntry * view_entry)
 {
     LibBalsaAddressView *address_view = view_entry->address_view;
     GtkEntry *entry = (GtkEntry *) view_entry;
@@ -929,17 +877,15 @@ lbav_popup_completions(LibBalsaAddressViewEntry *view_entry)
                                       address_view);
 }
 
-
 /*
  *     Callback for the entry's "insert_text" event -
  *     replace control chars by spaces
  */
 static void
-lbav_insert_text_cb(GtkEditable         *editable,
-                    const gchar         *text,
-                    gint                 length,
-                    gint                *position,
-                    LibBalsaAddressView *address_view)
+lbav_insert_text_cb(GtkEditable * editable,
+                    const gchar * text,
+                    gint length,
+                    gint * position, LibBalsaAddressView * address_view)
 {
     gchar *p;
     gchar *ins_text = g_strndup(text, length);
@@ -949,13 +895,12 @@ lbav_insert_text_cb(GtkEditable         *editable,
     while (*p != '\0') {
         gchar *next = g_utf8_next_char(p);
 
-        if (g_unichar_isprint(g_utf8_get_char(p))) {
+        if (g_unichar_isprint(g_utf8_get_char(p)))
             p = next;
-        } else {
+        else {
             *p++ = ' ';
-            if (p != next) {
+            if (p != next)
                 memmove(p, next, strlen(next) + 1);
-            }
         }
     }
 
@@ -971,28 +916,26 @@ lbav_insert_text_cb(GtkEditable         *editable,
     g_free(ins_text);
 }
 
-
 /*
  *     The completion's GtkEntryCompletionMatchFunc.
  */
 static gboolean
-lbav_completion_match_func(GtkEntryCompletion  *completion,
-                           const gchar         *key,
-                           GtkTreeIter         *iter,
-                           LibBalsaAddressView *address_view)
+lbav_completion_match_func(GtkEntryCompletion * completion,
+                           const gchar * key,
+                           GtkTreeIter * iter,
+                           LibBalsaAddressView * address_view)
 {
     return TRUE;
 }
 
-
 /*
  *     Callback for the completion's "match-selected" signal
  */
 static gboolean
-lbav_completion_match_selected_cb(GtkEntryCompletion  *completion,
-                                  GtkTreeModel        *model,
-                                  GtkTreeIter         *iter,
-                                  LibBalsaAddressView *address_view)
+lbav_completion_match_selected_cb(GtkEntryCompletion * completion,
+                                  GtkTreeModel * model,
+                                  GtkTreeIter * iter,
+                                  LibBalsaAddressView * address_view)
 {
     gchar *name;
     GtkWidget *entry;
@@ -1011,7 +954,6 @@ lbav_completion_match_selected_cb(GtkEntryCompletion  *completion,
     return TRUE;
 }
 
-
 /*
  * notify::has-focus callback
  * If only one completion matches, fill it into the entry
@@ -1031,7 +973,7 @@ lbav_notify_has_focus_cb(GtkEntry            *entry,
 
     name = gtk_entry_get_text(entry);
 
-    if ((name == NULL) || (name[0] == '\0')) {
+    if (name == NULL || name[0] == '\0') {
         /* No text to match */
         return;
     }
@@ -1071,7 +1013,6 @@ lbav_notify_has_focus_cb(GtkEntry            *entry,
     g_list_free_full(match, g_object_unref);
 }
 
-
 /*
  *     Public API.
  */
@@ -1080,10 +1021,9 @@ lbav_notify_has_focus_cb(GtkEntry            *entry,
  *     Allocate a new LibBalsaAddressView for use.
  */
 LibBalsaAddressView *
-libbalsa_address_view_new(const gchar *const *types,
-                          guint               n_types,
-                          GList              *address_book_list,
-                          gboolean            fallback)
+libbalsa_address_view_new(const gchar * const *types,
+                          guint n_types,
+                          GList * address_book_list, gboolean fallback)
 {
     LibBalsaAddressView *address_view;
 
@@ -1100,13 +1040,12 @@ libbalsa_address_view_new(const gchar *const *types,
     return address_view;
 }
 
-
 /*
  *     Set default domain.
  */
 void
-libbalsa_address_view_set_domain(LibBalsaAddressView *address_view,
-                                 const gchar         *domain)
+libbalsa_address_view_set_domain(LibBalsaAddressView * address_view,
+                                 const gchar * domain)
 {
     g_return_if_fail(LIBBALSA_IS_ADDRESS_VIEW(address_view));
 
@@ -1114,14 +1053,13 @@ libbalsa_address_view_set_domain(LibBalsaAddressView *address_view,
     address_view->domain = g_strdup(domain);
 }
 
-
 /*
  *     Set the addresses
  */
 void
-libbalsa_address_view_set_from_string(LibBalsaAddressView *address_view,
-                                      const gchar         *address_type,
-                                      const gchar         *addresses)
+libbalsa_address_view_set_from_string(LibBalsaAddressView * address_view,
+                                      const gchar * address_type,
+                                      const gchar * addresses)
 {
     gint type;
 
@@ -1135,14 +1073,13 @@ libbalsa_address_view_set_from_string(LibBalsaAddressView *address_view,
     lbav_add_addresses(address_view, type, addresses);
 }
 
-
 /*
  *     Add addresses
  */
 void
-libbalsa_address_view_add_from_string(LibBalsaAddressView *address_view,
-                                      const gchar         *address_type,
-                                      const gchar         *addresses)
+libbalsa_address_view_add_from_string(LibBalsaAddressView * address_view,
+                                      const gchar * address_type,
+                                      const gchar * addresses)
 {
     gint type;
 
@@ -1155,14 +1092,13 @@ libbalsa_address_view_add_from_string(LibBalsaAddressView *address_view,
     lbav_add_addresses(address_view, type, addresses);
 }
 
-
 /*
  *     Add addresses to an existing row
  */
 void
-libbalsa_address_view_add_to_row(LibBalsaAddressView *address_view,
-                                 GtkWidget           *button,
-                                 const gchar         *addresses)
+libbalsa_address_view_add_to_row(LibBalsaAddressView * address_view,
+                                 GtkWidget * button,
+                                 const gchar * addresses)
 {
     gint row;
     GtkWidget *child;
@@ -1183,14 +1119,13 @@ libbalsa_address_view_add_to_row(LibBalsaAddressView *address_view,
     lbav_ensure_blank_row(address_view, type);
 }
 
-
 /*
  *     Set the address from an InternetAddressList
  */
 void
-libbalsa_address_view_set_from_list(LibBalsaAddressView *address_view,
-                                    const gchar         *address_type,
-                                    InternetAddressList *list)
+libbalsa_address_view_set_from_list(LibBalsaAddressView * address_view,
+                                    const gchar * address_type,
+                                    InternetAddressList * list)
 {
     gint type;
 
@@ -1202,7 +1137,7 @@ libbalsa_address_view_set_from_list(LibBalsaAddressView *address_view,
 
     lbav_remove_type(address_view, type);
 
-    if ((list != NULL) && (internet_address_list_length(list) > 0)) {
+    if (list != NULL && internet_address_list_length(list) > 0) {
         gint row;
 
         row = lbav_ensure_blank_row(address_view, type);
@@ -1213,12 +1148,11 @@ libbalsa_address_view_set_from_list(LibBalsaAddressView *address_view,
     }
 }
 
-
 /*
  *     Number of complete addresses, or -1 if any is incomplete.
  */
 gint
-libbalsa_address_view_n_addresses(LibBalsaAddressView *address_view)
+libbalsa_address_view_n_addresses(LibBalsaAddressView * address_view)
 {
     gint addresses = 0;
     gint type;
@@ -1236,15 +1170,14 @@ libbalsa_address_view_n_addresses(LibBalsaAddressView *address_view)
     return addresses;
 }
 
-
 /*
  *     Create InternetAddressList corresponding to the view content.
  *     The list, which is NULL only on error, must be destroyed using
  *     g_object_unref().
  */
 InternetAddressList *
-libbalsa_address_view_get_list(LibBalsaAddressView *address_view,
-                               const gchar         *address_type)
+libbalsa_address_view_get_list(LibBalsaAddressView * address_view,
+                               const gchar * address_type)
 {
     gint type;
     InternetAddressList *address_list;
@@ -1280,23 +1213,20 @@ libbalsa_address_view_get_list(LibBalsaAddressView *address_view,
     return address_list;
 }
 
-
 void
-libbalsa_address_view_set_book_icon(GdkPixbuf *book_icon)
+libbalsa_address_view_set_book_icon(GdkPixbuf * book_icon)
 {
     g_set_object(&lbav_book_icon, book_icon);
 }
 
-
 void
-libbalsa_address_view_set_close_icon(GdkPixbuf *close_icon)
+libbalsa_address_view_set_close_icon(GdkPixbuf * close_icon)
 {
     g_set_object(&lbav_close_icon, close_icon);
 }
 
-
 void
-libbalsa_address_view_set_drop_down_icon(GdkPixbuf *drop_down_icon)
+libbalsa_address_view_set_drop_down_icon(GdkPixbuf * drop_down_icon)
 {
     g_set_object(&lbav_drop_down_icon, drop_down_icon);
 }
diff --git a/libbalsa/address-view.h b/libbalsa/address-view.h
index 7965870..9391823 100644
--- a/libbalsa/address-view.h
+++ b/libbalsa/address-view.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -31,37 +31,37 @@ G_BEGIN_DECLS
 G_DECLARE_FINAL_TYPE(LibBalsaAddressView, libbalsa_address_view,
                      LIBBALSA, ADDRESS_VIEW, GtkGrid)
 
-LibBalsaAddressView * libbalsa_address_view_new(const gchar * const *types,
-                                                guint n_types,
-                                                GList * address_book_list,
-                                                gboolean fallback);
-void libbalsa_address_view_set_domain(LibBalsaAddressView *address_view,
-                                      const gchar         *domain);
+LibBalsaAddressView *libbalsa_address_view_new(const gchar * const *types,
+                                               guint n_types,
+                                               GList * address_book_list,
+                                               gboolean fallback);
+void libbalsa_address_view_set_domain(LibBalsaAddressView * address_view,
+                                      const gchar * domain);
 void libbalsa_address_view_set_from_string(LibBalsaAddressView *
                                            address_view,
-                                           const gchar *address_type,
-                                           const gchar *addresses);
+                                           const gchar * address_type,
+                                           const gchar * addresses);
 void libbalsa_address_view_add_from_string(LibBalsaAddressView *
                                            address_view,
-                                           const gchar *address_type,
-                                           const gchar *addresses);
-void libbalsa_address_view_add_to_row(LibBalsaAddressView *address_view,
-                                      GtkWidget           *button,
-                                      const gchar         *addresses);
+                                           const gchar * address_type,
+                                           const gchar * addresses);
+void libbalsa_address_view_add_to_row(LibBalsaAddressView * address_view,
+                                      GtkWidget * button,
+                                      const gchar * addresses);
 void libbalsa_address_view_set_from_list(LibBalsaAddressView *
                                          address_view,
-                                         const gchar         *address_type,
-                                         InternetAddressList *list);
+                                         const gchar * address_type,
+                                         InternetAddressList * list);
 
-gint libbalsa_address_view_n_addresses(LibBalsaAddressView *address_view);
+gint libbalsa_address_view_n_addresses(LibBalsaAddressView * address_view);
 InternetAddressList *libbalsa_address_view_get_list(LibBalsaAddressView *
                                                     address_view,
                                                     const gchar *
                                                     address_type);
 
-void libbalsa_address_view_set_book_icon(GdkPixbuf *book_icon);
-void libbalsa_address_view_set_close_icon(GdkPixbuf *close_icon);
-void libbalsa_address_view_set_drop_down_icon(GdkPixbuf *drop_down_icon);
+void libbalsa_address_view_set_book_icon(GdkPixbuf * book_icon);
+void libbalsa_address_view_set_close_icon(GdkPixbuf * close_icon);
+void libbalsa_address_view_set_drop_down_icon(GdkPixbuf * drop_down_icon);
 
 G_END_DECLS
 
diff --git a/libbalsa/address.c b/libbalsa/address.c
index c25564a..12aa7fd 100644
--- a/libbalsa/address.c
+++ b/libbalsa/address.c
@@ -19,7 +19,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "address.h"
 
@@ -29,14 +29,14 @@
 #include "misc.h"
 #include <glib/gi18n.h>
 
-static void libbalsa_address_class_init(LibBalsaAddressClass *klass);
-static void libbalsa_address_init(LibBalsaAddress *ab);
-static void libbalsa_address_finalize(GObject *object);
+static void libbalsa_address_class_init(LibBalsaAddressClass * klass);
+static void libbalsa_address_init(LibBalsaAddress * ab);
+static void libbalsa_address_finalize(GObject * object);
 
-static gchar **vcard_strsplit(const gchar *string);
+static gchar ** vcard_strsplit(const gchar * string);
 
 /* General address structure to be used with address books.
- */
+*/
 struct _LibBalsaAddress {
     GObject parent;
 
@@ -74,7 +74,7 @@ struct _LibBalsaAddressClass {
 G_DEFINE_TYPE(LibBalsaAddress, libbalsa_address, G_TYPE_OBJECT)
 
 static void
-libbalsa_address_class_init(LibBalsaAddressClass *klass)
+libbalsa_address_class_init(LibBalsaAddressClass * klass)
 {
     GObjectClass *object_class;
 
@@ -82,9 +82,8 @@ libbalsa_address_class_init(LibBalsaAddressClass *klass)
     object_class->finalize = libbalsa_address_finalize;
 }
 
-
 static void
-libbalsa_address_init(LibBalsaAddress *addr)
+libbalsa_address_init(LibBalsaAddress * addr)
 {
     addr->nick_name = NULL;
     addr->full_name = NULL;
@@ -94,9 +93,8 @@ libbalsa_address_init(LibBalsaAddress *addr)
     addr->addr_list = NULL;
 }
 
-
 static void
-libbalsa_address_finalize(GObject *object)
+libbalsa_address_finalize(GObject * object)
 {
     LibBalsaAddress *addr;
 
@@ -115,14 +113,12 @@ libbalsa_address_finalize(GObject *object)
     G_OBJECT_CLASS(libbalsa_address_parent_class)->finalize(object);
 }
 
-
 LibBalsaAddress *
 libbalsa_address_new(void)
 {
     return g_object_new(LIBBALSA_TYPE_ADDRESS, NULL);
 }
 
-
 /** Extract full name in order from <string> that has GnomeCard format
    and returns the pointer to the allocated memory chunk.
 
@@ -130,15 +126,12 @@ libbalsa_address_new(void)
 
    [1] VCARD 1.2 specs: http://www.imc.org/pdi/vcard-21.txt
    [2] VCARD 3.0 specs, RFC 2426 (http://www.ietf.org/rfc/rfc2426.txt)
- */
-gchar *
-libbalsa_address_extract_name(const gchar *string,
-                              gchar      **last_name,
-                              gchar      **first_name)
+*/
+gchar*
+libbalsa_address_extract_name(const gchar * string, gchar ** last_name,
+                              gchar ** first_name)
 {
-    enum GCardFieldOrder {
-        LAST = 0, FIRST, MIDDLE, PREFIX, SUFFIX
-    };
+    enum GCardFieldOrder { LAST = 0, FIRST, MIDDLE, PREFIX, SUFFIX };
     guint cpt, j;
     gchar **fld, **name_arr;
     gchar *res = NULL;
@@ -153,38 +146,31 @@ libbalsa_address_extract_name(const gchar *string,
         return NULL;
     }
 
-    if (fld[LAST] && *fld[LAST]) {
+    if (fld[LAST] && *fld[LAST])
         *last_name = g_strdup(fld[LAST]);
-    }
 
-    if (fld[FIRST] && *fld[FIRST]) {
+    if (fld[FIRST] && *fld[FIRST])
         *first_name = fld[MIDDLE] && *fld[MIDDLE] ?
             g_strconcat(fld[FIRST], " ", fld[MIDDLE], NULL) :
             g_strdup(fld[FIRST]);
-    }
 
     name_arr = g_malloc((cpt + 1) * sizeof(gchar *));
 
     j = 0;
-    if ((cpt > PREFIX) && (*fld[PREFIX] != '\0')) {
-        name_arr[j++] = g_strdup(fld[PREFIX]);
-    }
+    if (cpt > PREFIX && *fld[PREFIX] != '\0')
+       name_arr[j++] = g_strdup(fld[PREFIX]);
 
-    if ((cpt > FIRST) && (*fld[FIRST] != '\0')) {
-        name_arr[j++] = g_strdup(fld[FIRST]);
-    }
+    if (cpt > FIRST && *fld[FIRST] != '\0')
+       name_arr[j++] = g_strdup(fld[FIRST]);
 
-    if ((cpt > MIDDLE) && (*fld[MIDDLE] != '\0')) {
-        name_arr[j++] = g_strdup(fld[MIDDLE]);
-    }
+    if (cpt > MIDDLE && *fld[MIDDLE] != '\0')
+       name_arr[j++] = g_strdup(fld[MIDDLE]);
 
-    if ((cpt > LAST) && (*fld[LAST] != '\0')) {
-        name_arr[j++] = g_strdup(fld[LAST]);
-    }
+    if (cpt > LAST && *fld[LAST] != '\0')
+       name_arr[j++] = g_strdup(fld[LAST]);
 
-    if ((cpt > SUFFIX) && (*fld[SUFFIX] != '\0')) {
-        name_arr[j++] = g_strdup(fld[SUFFIX]);
-    }
+    if (cpt > SUFFIX && *fld[SUFFIX] != '\0')
+       name_arr[j++] = g_strdup(fld[SUFFIX]);
 
     name_arr[j] = NULL;
 
@@ -197,30 +183,25 @@ libbalsa_address_extract_name(const gchar *string,
     return res;
 }
 
-
 /* Duplicates some code from address-book-vcard.c:
  */
-static gchar *
-validate_vcard_string(gchar       *vcstr,
-                      const gchar *charset)
+static gchar*
+validate_vcard_string(gchar * vcstr, const gchar * charset)
 {
-    gchar *utf8res;
+    gchar * utf8res;
     gsize b_written;
 
     /* check if it's a utf8 clean string and return it in this case */
-    if (!vcstr || g_utf8_validate(vcstr, -1, NULL)) {
-        return vcstr;
-    }
+    if (!vcstr || g_utf8_validate(vcstr, -1, NULL))
+       return vcstr;
 
     /* convert from the passed charset or as fallback from the locale setting */
     if (charset && g_ascii_strcasecmp(charset, "utf-8")) {
-        utf8res = g_convert(vcstr, -1, "utf-8", charset, NULL, &b_written, NULL);
-    } else {
-        utf8res = g_locale_to_utf8(vcstr, -1, NULL, &b_written, NULL);
-    }
-    if (!utf8res) {
-        return vcstr;
-    }
+       utf8res = g_convert(vcstr, -1, "utf-8", charset, NULL, &b_written, NULL);
+    } else
+       utf8res = g_locale_to_utf8(vcstr, -1, NULL, &b_written, NULL);
+    if (!utf8res)
+       return vcstr;
 
     g_free(vcstr);
     return utf8res;
@@ -228,16 +209,16 @@ validate_vcard_string(gchar       *vcstr,
 
 
 static inline gchar *
-vcard_qp_decode(gchar *str)
+vcard_qp_decode(gchar * str)
 {
     gint len = strlen(str);
-    gchar *newstr = g_malloc0(len + 1);
+    gchar * newstr = g_malloc0(len + 1);
     int state = 0;
     guint32 save;
 
     /* qp decode the input string */
     g_mime_encoding_quoted_decode_step((unsigned char *) str, len,
-                                       (unsigned char *) newstr, &state, &save);
+                                   (unsigned char *) newstr, &state, &save);
 
     /* free input and return new string */
     g_free(str);
@@ -246,16 +227,16 @@ vcard_qp_decode(gchar *str)
 
 
 static inline gchar *
-vcard_b64_decode(gchar *str)
+vcard_b64_decode(gchar * str)
 {
     gint len = strlen(str);
-    gchar *newstr = g_malloc0(len + 1);
+    gchar * newstr = g_malloc0(len + 1);
     int state = 0;
     guint32 save;
 
     /* base64 decode the input string */
     g_mime_encoding_base64_decode_step((unsigned char *) str, len,
-                                       (unsigned char *) newstr, &state, &save);
+                                   (unsigned char *) newstr, &state, &save);
 
     /* free input and return new string */
     g_free(str);
@@ -264,16 +245,14 @@ vcard_b64_decode(gchar *str)
 
 
 static inline gchar *
-vcard_charset_to_utf8(gchar       *str,
-                      const gchar *charset)
+vcard_charset_to_utf8(gchar * str, const gchar * charset)
 {
     gsize bytes_written;
-    gchar *convstr;
+    gchar * convstr;
 
     /* convert only if the source is known and not utf-8 */
-    if (!charset || !g_ascii_strcasecmp(charset, "utf-8")) {
-        return str;
-    }
+    if (!charset || !g_ascii_strcasecmp(charset, "utf-8"))
+       return str;
 
     convstr = g_convert(str, -1, "utf-8", charset, NULL, &bytes_written, NULL);
     g_free(str);
@@ -285,7 +264,7 @@ vcard_charset_to_utf8(gchar       *str,
  * (b) ignoring '\;' sequences (c) always returning as many elements as
  * possible and (d) unescape '\;' sequences in the resulting array */
 static gchar **
-vcard_strsplit(const gchar *string)
+vcard_strsplit(const gchar * string)
 {
     GSList *string_list = NULL, *slist;
     gchar **str_array, *s;
@@ -296,48 +275,46 @@ vcard_strsplit(const gchar *string)
 
     remainder = string;
     s = strchr(remainder, ';');
-    while (s && s > remainder && s[-1] == '\\') {
-        s = strchr(s + 1, ';');
-    }
+    while (s && s > remainder && s[-1] == '\\')
+       s = strchr(s + 1, ';');
 
     while (s) {
-        gsize len;
+       gsize len;
 
-        len = s - remainder;
+       len = s - remainder;
         /* skip empty fields: */
         if (len > 0) {
             string_list =
                 g_slist_prepend(string_list, g_strndup(remainder, len));
             n++;
         }
-        remainder = s + 1;
-        s = strchr(remainder, ';');
-        while (s && s > remainder && s[-1] == '\\') {
-            s = strchr(s + 1, ';');
-        }
+       remainder = s + 1;
+       s = strchr(remainder, ';');
+       while (s && s > remainder && s[-1] == '\\')
+           s = strchr(s + 1, ';');
     }
 
     if (*string) {
-        n++;
-        string_list = g_slist_prepend(string_list, g_strdup(remainder));
+       n++;
+       string_list = g_slist_prepend(string_list, g_strdup(remainder));
     }
 
-    str_array = g_new(gchar *, n + 1);
+    str_array = g_new(gchar*, n + 1);
 
     str_array[n--] = NULL;
     for (slist = string_list; slist; slist = slist->next) {
-        gchar *str = (gchar *) slist->data;
-        gchar *p;
-
-        while ((p = strstr(str, "\\;"))) {
-            gchar *newstr = g_malloc(strlen(str));
-
-            strncpy(newstr, str, p - str);
-            strcpy(newstr + (p - str), p + 1);
-            g_free(str);
-            str = newstr;
-        }
-        str_array[n--] = str;
+       gchar * str = (gchar *) slist->data;
+       gchar * p;
+
+       while ((p = strstr(str, "\\;"))) {
+           gchar * newstr = g_malloc(strlen(str));
+
+           strncpy(newstr, str, p - str);
+           strcpy(newstr + (p - str), p + 1);
+           g_free(str);
+           str = newstr;
+       }
+       str_array[n--] = str;
     }
 
     g_slist_free(string_list);
@@ -345,95 +322,90 @@ vcard_strsplit(const gchar *string)
     return str_array;
 }
 
-
 /*
  * Create a LibBalsaAddress from a vCard; return NULL if the string does
  * not contain a complete vCard with at least one email address.
  */
 
-LibBalsaAddress *
-libbalsa_address_new_from_vcard(const gchar *str,
-                                const gchar *charset)
+LibBalsaAddress*
+libbalsa_address_new_from_vcard(const gchar *str, const gchar *charset)
 {
     gchar *name = NULL, *nick_name = NULL, *org = NULL;
     gchar *full_name = NULL, *last_name = NULL, *first_name = NULL;
     gint in_vcard = FALSE;
     GList *addr_list = NULL;
     const gchar *string, *next_line;
-    gchar *vcard;
+    gchar * vcard;
 
     g_return_val_if_fail(str, NULL);
 
     /* rfc 2425 unfold the string */
     vcard = g_strdup(str);
     while ((string = strstr(vcard, "\r\n ")) ||
-           (string = strstr(vcard, "\r\n\t"))) {
-        gchar *newstr = g_malloc0(strlen(vcard) - 2);
+          (string = strstr(vcard, "\r\n\t"))) {
+       gchar * newstr = g_malloc0(strlen(vcard) - 2);
 
-        strncpy(newstr, vcard, string - vcard);
-        strcpy(newstr + (string - vcard), string + 3);
-        g_free(vcard);
-        vcard = newstr;
+       strncpy(newstr, vcard, string - vcard);
+       strcpy(newstr + (string - vcard), string + 3);
+       g_free(vcard);
+       vcard = newstr;
     }
     while ((string = strstr(vcard, "\n ")) ||
-           (string = strstr(vcard, "\n\t"))) {
-        gchar *newstr = g_malloc(strlen(vcard) - 1);
+          (string = strstr(vcard, "\n\t"))) {
+       gchar * newstr = g_malloc(strlen(vcard) - 1);
 
-        strncpy(newstr, vcard, string - vcard);
-        strcpy(newstr + (string - vcard), string + 2);
-        g_free(vcard);
-        vcard = newstr;
+       strncpy(newstr, vcard, string - vcard);
+       strcpy(newstr + (string - vcard), string + 2);
+       g_free(vcard);
+       vcard = newstr;
     }
 
     /* may contain \r's when decoded from base64... */
     while ((string = strstr(vcard, "\r\n ")) ||
-           (string = strstr(vcard, "\r\n\t"))) {
-        gchar *newstr = g_malloc(strlen(vcard) - 2);
+          (string = strstr(vcard, "\r\n\t"))) {
+       gchar * newstr = g_malloc(strlen(vcard) - 2);
 
-        strncpy(newstr, vcard, string - vcard);
-        strcpy(newstr + (string - vcard), string + 3);
-        g_free(vcard);
-        vcard = newstr;
+       strncpy(newstr, vcard, string - vcard);
+       strcpy(newstr + (string - vcard), string + 3);
+       g_free(vcard);
+       vcard = newstr;
     }
 
     /* process */
-    for (string = vcard; *string; string = next_line) {
+    for(string = vcard; *string; string = next_line) {
         gchar *line;
 
         next_line = strchr(string, '\n');
-        if (next_line) {
+        if (next_line)
             ++next_line;
-        } else {
+        else
             next_line = string + strlen(string);
-        }
-        /*
-         * Check if it is a card.
-         */
-        if (g_ascii_strncasecmp(string, "BEGIN:VCARD", 11) == 0) {
-            in_vcard = TRUE;
-        } else if (in_vcard) {
-            if (g_ascii_strncasecmp(string, "END:VCARD", 9) == 0) {
-                /*
-                 * We are done loading a card.
-                 */
-                LibBalsaAddress *address;
-
-                if (!addr_list) {
+       /*
+        * Check if it is a card.
+        */
+       if (g_ascii_strncasecmp(string, "BEGIN:VCARD", 11) == 0)
+           in_vcard = TRUE;
+       else if (in_vcard) {
+           if (g_ascii_strncasecmp(string, "END:VCARD", 9) == 0) {
+               /*
+                * We are done loading a card.
+                */
+               LibBalsaAddress *address;
+
+               if (!addr_list)
                     break;
-                }
 
-                address = g_object_new(LIBBALSA_TYPE_ADDRESS, NULL);
+               address = g_object_new(LIBBALSA_TYPE_ADDRESS, NULL);
 
-                if (full_name) {
-                    address->full_name = full_name;
-                    g_free(name);
-                } else if (name) {
-                    address->full_name = name;
-                } else if (nick_name) {
-                    address->full_name = g_strdup(nick_name);
-                } else {
-                    address->full_name = g_strdup(_("No-Name"));
-                }
+               if (full_name) {
+                   address->full_name = full_name;
+                   g_free(name);
+               } else if (name)
+                   address->full_name = name;
+               else if (nick_name)
+                   address->full_name = g_strdup(nick_name);
+               else
+                   address->full_name = g_strdup(_("No-Name"));
 
                 address->last_name = last_name;
                 address->first_name = first_name;
@@ -447,61 +419,57 @@ libbalsa_address_new_from_vcard(const gchar *str,
             line = g_strndup(string, next_line - string);
             g_strchomp(line);
 
-            /* Encoding of national characters:
-             * - vcard 2.1 allows charset=xxx and encoding=(base64|quoted-printable|8bit)
-             * - Thunderbird claims to use vcard 2.1, but uses only "quoted-printable",
-             *   and the charset from part MIME header
-             * - vcard 3.0 (rfc 2426) allows "encoding=b", the charset must be taken
-             *   from the content-type MIME header */
-            if (strchr(line, ':')) {
-                gchar **parts = g_strsplit(line, ":", 2);
-                gchar **tokens;
-                gint n;
-
-                /* split control stuff into tokens */
-                tokens = g_strsplit(parts[0], ";", -1);
-
-                /* find encoding= */
-                for (n = 0; tokens[n]; n++) {
-                    if (!g_ascii_strncasecmp(tokens[n], "encoding=", 9)) {
-                        if (!g_ascii_strcasecmp(tokens[n] + 9, "base64")) {
-                            /* vcard 2.1: use the charset parameter (below) */
-                            parts[1] = vcard_b64_decode(parts[1]);
-                        } else if (!g_ascii_strcasecmp(tokens[n] + 9, "b")) {
-                            /* rfc 2426: charset from MIME part */
-                            parts[1] = vcard_b64_decode(parts[1]);
-                            parts[1] = vcard_charset_to_utf8(parts[1], charset);
-                        } else if (!g_ascii_strcasecmp(tokens[n] + 9, "quoted-printable")) {
-                            /* vcard 2.1: use the charset parameter (below) */
-                            parts[1] = vcard_qp_decode(parts[1]);
-                        }
-                    }
-                }
-
-                /* find quoted-printable */
-                for (n = 0; tokens[n]; n++) {
-                    if (!g_ascii_strcasecmp(tokens[n], "quoted-printable")) {
-                        /* Thunderbird: broken vcard 2.1, charset from MIME part */
-                        parts[1] = vcard_qp_decode(parts[1]);
-                        parts[1] = vcard_charset_to_utf8(parts[1], charset);
-                    }
-                }
-
-                /* find charset= (vcard 2.1 only) */
-                for (n = 0; tokens[n]; n++) {
-                    if (!g_ascii_strncasecmp(tokens[n], "charset=", 8)) {
-                        parts[1] = vcard_charset_to_utf8(parts[1], tokens[n] + 8);
-                    }
-                }
-
-                /* construct the result */
-                g_free(line);
-                line = g_strdup_printf("%s:%s", tokens[0], parts[1]);
-
-                /* clean up */
-                g_strfreev(tokens);
-                g_strfreev(parts);
-            }
+           /* Encoding of national characters:
+            * - vcard 2.1 allows charset=xxx and encoding=(base64|quoted-printable|8bit)
+            * - Thunderbird claims to use vcard 2.1, but uses only "quoted-printable",
+            *   and the charset from part MIME header
+            * - vcard 3.0 (rfc 2426) allows "encoding=b", the charset must be taken
+            *   from the content-type MIME header */
+           if (strchr(line, ':')) {
+               gchar ** parts = g_strsplit(line, ":", 2);
+               gchar ** tokens;
+               gint n;
+
+               /* split control stuff into tokens */
+               tokens = g_strsplit(parts[0], ";", -1);
+
+               /* find encoding= */
+               for (n = 0; tokens[n]; n++)
+                   if (!g_ascii_strncasecmp(tokens[n], "encoding=", 9)) {
+                       if (!g_ascii_strcasecmp(tokens[n] + 9, "base64")) {
+                           /* vcard 2.1: use the charset parameter (below) */
+                           parts[1] = vcard_b64_decode(parts[1]);
+                       } else if (!g_ascii_strcasecmp(tokens[n] + 9, "b")) {
+                           /* rfc 2426: charset from MIME part */
+                           parts[1] = vcard_b64_decode(parts[1]);
+                           parts[1] = vcard_charset_to_utf8(parts[1], charset);
+                       } else if (!g_ascii_strcasecmp(tokens[n] + 9, "quoted-printable")) {
+                           /* vcard 2.1: use the charset parameter (below) */
+                           parts[1] = vcard_qp_decode(parts[1]);
+                       }
+                   }
+
+               /* find quoted-printable */
+               for (n = 0; tokens[n]; n++)
+                   if (!g_ascii_strcasecmp(tokens[n], "quoted-printable")) {
+                       /* Thunderbird: broken vcard 2.1, charset from MIME part */
+                       parts[1] = vcard_qp_decode(parts[1]);
+                       parts[1] = vcard_charset_to_utf8(parts[1], charset);
+                   }
+
+               /* find charset= (vcard 2.1 only) */
+               for (n = 0; tokens[n]; n++)
+                   if (!g_ascii_strncasecmp(tokens[n], "charset=", 8))
+                       parts[1] = vcard_charset_to_utf8(parts[1], tokens[n] + 8);
+
+               /* construct the result */
+               g_free(line);
+               line = g_strdup_printf("%s:%s", tokens[0], parts[1]);
+
+               /* clean up */
+               g_strfreev(tokens);
+               g_strfreev(parts);
+           }
 
             if (g_ascii_strncasecmp(line, "FN:", 3) == 0) {
 
@@ -527,17 +495,17 @@ libbalsa_address_new_from_vcard(const gchar *str,
                 nick_name = validate_vcard_string(nick_name, charset);
 
             } else if (g_ascii_strncasecmp(line, "ORG:", 4) == 0) {
-                gchar **org_strs = vcard_strsplit(line + 4);
+               gchar ** org_strs = vcard_strsplit(line + 4);
 
                 g_free(org);
                 org = g_strjoinv(", ", org_strs);
-                g_strfreev(org_strs);
+               g_strfreev(org_strs);
                 org = validate_vcard_string(org, charset);
 
             } else if (g_ascii_strncasecmp(line, "EMAIL:", 6) == 0) {
 
-                addr_list =
-                    g_list_prepend(addr_list, g_strdup(line + 6));
+               addr_list =
+                   g_list_prepend(addr_list, g_strdup(line + 6));
             }
             g_free(line);
         }
@@ -554,16 +522,13 @@ libbalsa_address_new_from_vcard(const gchar *str,
     return NULL;
 }
 
-
 void
-libbalsa_address_set_copy(LibBalsaAddress *dest,
-                          LibBalsaAddress *src)
+libbalsa_address_set_copy(LibBalsaAddress * dest, LibBalsaAddress * src)
 {
     GList *src_al, *dst_al;
 
-    if (dest == src) {          /* safety check */
+    if (dest == src)            /* safety check */
         return;
-    }
 
     g_free(dest->nick_name);
     dest->nick_name = g_strdup(src->nick_name);
@@ -578,16 +543,13 @@ libbalsa_address_set_copy(LibBalsaAddress *dest,
     g_list_free_full(dest->addr_list, g_free);
 
     dst_al = NULL;
-    for (src_al = src->addr_list; src_al; src_al = src_al->next) {
+    for (src_al = src->addr_list; src_al; src_al = src_al->next)
         dst_al = g_list_prepend(dst_al, g_strdup(src_al->data));
-    }
     dest->addr_list = g_list_reverse(dst_al);
 }
 
-
 static gchar *
-rfc2822_mailbox(const gchar *full_name,
-                const gchar *address)
+rfc2822_mailbox(const gchar * full_name, const gchar * address)
 {
     InternetAddress *ia;
     gchar *new_str;
@@ -599,21 +561,19 @@ rfc2822_mailbox(const gchar *full_name,
     return new_str;
 }
 
-
-static gchar *
-rfc2822_group(const gchar *full_name,
-              GList       *addr_list)
+static gchar*
+rfc2822_group(const gchar *full_name, GList *addr_list)
 {
     InternetAddress *ia;
     gchar *res;
 
     ia = internet_address_group_new(full_name);
     for (; addr_list; addr_list = addr_list->next) {
-        InternetAddress *member;
+       InternetAddress *member;
 
-        member = internet_address_mailbox_new(NULL, addr_list->data);
-        internet_address_group_add_member(INTERNET_ADDRESS_GROUP(ia), member);
-        g_object_unref(member);
+       member = internet_address_mailbox_new(NULL, addr_list->data);
+       internet_address_group_add_member(INTERNET_ADDRESS_GROUP(ia), member);
+       g_object_unref(member);
     }
     res = internet_address_to_string(ia, FALSE);
     g_object_unref(ia);
@@ -621,83 +581,72 @@ rfc2822_group(const gchar *full_name,
     return res;
 }
 
-
 /*
    Get a string version of this address.
 
    If n == -1 then return all addresses, else return the n'th one.
    If n > the number of addresses, will cause an error.
- */
+*/
 gchar *
-libbalsa_address_to_gchar(LibBalsaAddress *address,
-                          gint             n)
+libbalsa_address_to_gchar(LibBalsaAddress * address, gint n)
 {
     gchar *retc = NULL;
 
     g_return_val_if_fail(LIBBALSA_IS_ADDRESS(address), NULL);
 
-    if (address->addr_list == NULL) {
+    if (address->addr_list == NULL)
         return NULL;
-    }
     if (n == -1) {
-        if (address->addr_list->next != NULL) {
+        if (address->addr_list->next != NULL)
             retc = rfc2822_group(address->full_name, address->addr_list);
-        } else {
+        else
             retc = rfc2822_mailbox(address->full_name,
                                    address->addr_list->data);
-        }
     } else {
-        const gchar *mailbox = g_list_nth_data(address->addr_list, n);
-        g_return_val_if_fail(mailbox != NULL, NULL);
+       const gchar *mailbox = g_list_nth_data(address->addr_list, n);
+       g_return_val_if_fail(mailbox != NULL, NULL);
 
-        retc = rfc2822_mailbox(address->full_name, mailbox);
+       retc = rfc2822_mailbox(address->full_name, mailbox);
     }
 
     return retc;
 }
 
-
 /* Helper */
 static const gchar *
-lba_get_name_or_mailbox(InternetAddressList *addr_list,
-                        gboolean             get_name,
-                        gboolean             in_group)
+lba_get_name_or_mailbox(InternetAddressList * addr_list,
+                        gboolean get_name, gboolean in_group)
 {
     const gchar *retval = NULL;
     InternetAddress *ia;
     gint i, len;
 
-    if (addr_list == NULL) {
-        return NULL;
-    }
+    if (addr_list == NULL)
+       return NULL;
 
     len = internet_address_list_length(addr_list);
     for (i = 0; i < len; i++) {
         ia = internet_address_list_get_address (addr_list, i);
 
-        if (get_name && ia->name && *ia->name) {
+        if (get_name && ia->name && *ia->name)
             return ia->name;
-        }
 
-        if (INTERNET_ADDRESS_IS_MAILBOX (ia)) {
+        if (INTERNET_ADDRESS_IS_MAILBOX (ia))
             retval = INTERNET_ADDRESS_MAILBOX (ia)->addr;
-        } else {
-            if (in_group) {
+        else {
+            if (in_group)
                 g_message("Ignoring nested group address");
-            } else {
+            else
                 retval = lba_get_name_or_mailbox(INTERNET_ADDRESS_GROUP(ia)->members,
-                                                 get_name, TRUE);
-            }
+                       get_name, TRUE);
         }
-        if (retval) {
+        if (retval)
             break;
-        }
     }
 
     return retval;
 }
 
-
 /* Get either a name or a mailbox from an InternetAddressList. */
 const gchar *
 libbalsa_address_get_name_from_list(InternetAddressList *addr_list)
@@ -705,7 +654,6 @@ libbalsa_address_get_name_from_list(InternetAddressList *addr_list)
     return lba_get_name_or_mailbox(addr_list, TRUE, FALSE);
 }
 
-
 /* Get a mailbox from an InternetAddressList. */
 const gchar *
 libbalsa_address_get_mailbox_from_list(InternetAddressList *addr_list)
@@ -713,10 +661,9 @@ libbalsa_address_get_mailbox_from_list(InternetAddressList *addr_list)
     return lba_get_name_or_mailbox(addr_list, FALSE, FALSE);
 }
 
-
 /* Number of individual mailboxes in an InternetAddressList. */
 gint
-libbalsa_address_n_mailboxes_in_list(InternetAddressList *addr_list)
+libbalsa_address_n_mailboxes_in_list(InternetAddressList * addr_list)
 {
     gint i, len, n_mailboxes = 0;
 
@@ -727,29 +674,27 @@ libbalsa_address_n_mailboxes_in_list(InternetAddressList *addr_list)
         const InternetAddress *ia =
             internet_address_list_get_address(addr_list, i);
 
-        if (INTERNET_ADDRESS_IS_MAILBOX(ia)) {
+        if (INTERNET_ADDRESS_IS_MAILBOX(ia))
             ++n_mailboxes;
-        } else {
+        else
             n_mailboxes +=
                 libbalsa_address_n_mailboxes_in_list(INTERNET_ADDRESS_GROUP
-                                                         (ia)->members);
-        }
+                                                     (ia)->members);
     }
 
     return n_mailboxes;
 }
 
-
 /* =================================================================== */
 /*                                UI PART                              */
 /* =================================================================== */
 
 /** libbalsa_address_set_edit_entries() initializes the GtkEntry widgets
     in entries with values from address
- */
+*/
 void
-libbalsa_address_set_edit_entries(const LibBalsaAddress *address,
-                                  GtkWidget            **entries)
+libbalsa_address_set_edit_entries(const LibBalsaAddress * address,
+                                  GtkWidget **entries)
 {
     gchar *new_name = NULL;
     gchar *new_email = NULL;
@@ -766,57 +711,52 @@ libbalsa_address_set_edit_entries(const LibBalsaAddress *address,
                          && address->addr_list->data ?
                          address->addr_list->data : "");
     /* initialize the organization... */
-    if (!address || (address->organization == NULL)) {
-        new_organization = g_strdup("");
-    } else {
-        new_organization = g_strdup(address->organization);
-    }
+    if (!address || address->organization == NULL)
+       new_organization = g_strdup("");
+    else
+       new_organization = g_strdup(address->organization);
 
     /* if the message only contains an e-mail address */
-    if (!address || (address->full_name == NULL)) {
-        new_name = g_strdup(new_email);
-    } else {
+    if (!address || address->full_name == NULL)
+       new_name = g_strdup(new_email);
+    else {
         gchar **names;
         g_assert(address);
-        /* make sure address->personal is not all whitespace */
-        new_name = g_strstrip(g_strdup(address->full_name));
+       /* make sure address->personal is not all whitespace */
+       new_name = g_strstrip(g_strdup(address->full_name));
 
-        /* guess the first name and last name */
-        if (*new_name != '\0') {
-            names = g_strsplit(new_name, " ", 0);
+       /* guess the first name and last name */
+       if (*new_name != '\0') {
+           names = g_strsplit(new_name, " ", 0);
 
-            for (cnt = 0; names[cnt]; cnt++) {
-            }
+           for (cnt=0; names[cnt]; cnt++)
+               ;
 
-            /* get first name */
-            first_name = g_strdup(address->first_name
+           /* get first name */
+           first_name = g_strdup(address->first_name
                                   ? address->first_name : names[0]);
 
-            /* get last name */
-            if (address->last_name) {
+           /* get last name */
+            if(address->last_name)
                 last_name = g_strdup(address->last_name);
-            } else {
-                if (cnt == 1) {
+            else {
+                if (cnt == 1)
                     last_name = g_strdup("");
-                } else {
+                else
                     last_name = g_strdup(names[cnt - 1]);
-                }
             }
-            g_strfreev(names);
-        }
+           g_strfreev(names);
+       }
     }
 
-    if (first_name == NULL) {
-        first_name = g_strdup("");
-    }
-    if (last_name == NULL) {
-        last_name = g_strdup("");
-    }
-    if (!address || (address->nick_name == NULL)) {
-        nick_name = g_strdup("");
-    } else {
-        nick_name = g_strdup(address->nick_name);
-    }
+    if (first_name == NULL)
+       first_name = g_strdup("");
+    if (last_name == NULL)
+       last_name = g_strdup("");
+    if (!address || address->nick_name == NULL)
+       nick_name = g_strdup("");
+    else
+       nick_name = g_strdup(address->nick_name);
 
     /* Full name must be set after first and last names. */
     gtk_entry_set_text(GTK_ENTRY(entries[FIRST_NAME]), first_name);
@@ -826,7 +766,7 @@ libbalsa_address_set_edit_entries(const LibBalsaAddress *address,
     gtk_entry_set_text(GTK_ENTRY(entries[ORGANIZATION]), new_organization);
 
     store = GTK_LIST_STORE(gtk_tree_view_get_model
-                               (GTK_TREE_VIEW(entries[EMAIL_ADDRESS])));
+                           (GTK_TREE_VIEW(entries[EMAIL_ADDRESS])));
     gtk_list_store_clear(store);
     if (address) {
         GList *list;
@@ -842,11 +782,9 @@ libbalsa_address_set_edit_entries(const LibBalsaAddress *address,
 
     gtk_editable_select_region(GTK_EDITABLE(entries[FULL_NAME]), 0, -1);
 
-    for (cnt = FULL_NAME + 1; cnt < NUM_FIELDS; cnt++) {
-        if (GTK_IS_EDITABLE(entries[cnt])) {
+    for (cnt = FULL_NAME + 1; cnt < NUM_FIELDS; cnt++)
+        if (GTK_IS_EDITABLE(entries[cnt]))
             gtk_editable_set_position(GTK_EDITABLE(entries[cnt]), 0);
-        }
-    }
 
     g_free(new_name);
     g_free(first_name);
@@ -857,15 +795,13 @@ libbalsa_address_set_edit_entries(const LibBalsaAddress *address,
     gtk_widget_grab_focus(entries[FULL_NAME]);
 }
 
-
 /** libbalsa_address_get_edit_widget() returns an widget adapted
     for a LibBalsaAddress edition, with initial values set if address
     is provided. The edit entries are set in entries array
     and enumerated with LibBalsaAddressField constants
- */
+*/
 static void
-lba_entry_changed(GtkEntry  *entry,
-                  GtkEntry **entries)
+lba_entry_changed(GtkEntry * entry, GtkEntry ** entries)
 {
     gchar *full_name =
         g_strconcat(gtk_entry_get_text(entries[FIRST_NAME]), " ",
@@ -874,25 +810,19 @@ lba_entry_changed(GtkEntry  *entry,
     g_free(full_name);
 }
 
-
 static void
-lba_cell_edited(GtkCellRendererText *cell,
-                const gchar         *path_string,
-                const gchar         *new_text,
-                GtkListStore        *store)
+lba_cell_edited(GtkCellRendererText * cell, const gchar * path_string,
+                const gchar * new_text, GtkListStore * store)
 {
     GtkTreeIter iter;
 
     if (gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(store),
-                                            &iter, path_string)) {
+                                            &iter, path_string))
         gtk_list_store_set(store, &iter, 0, new_text, -1);
-    }
 }
 
-
 static GtkWidget *
-lba_addr_list_widget(GCallback changed_cb,
-                     gpointer  changed_data)
+lba_addr_list_widget(GCallback changed_cb, gpointer changed_data)
 {
     GtkListStore *store;
     GtkWidget *tree_view;
@@ -908,10 +838,9 @@ lba_addr_list_widget(GCallback changed_cb,
     g_object_set(renderer, "editable", TRUE, NULL);
     g_signal_connect(renderer, "edited", G_CALLBACK(lba_cell_edited),
                      store);
-    if (changed_cb) {
+    if (changed_cb)
         g_signal_connect_swapped(renderer, "edited",
                                  changed_cb, changed_data);
-    }
 
     column = gtk_tree_view_column_new_with_attributes(NULL, renderer,
                                                       "text", 0, NULL);
@@ -920,10 +849,8 @@ lba_addr_list_widget(GCallback changed_cb,
     return tree_view;
 }
 
-
 static void
-add_row(GtkWidget *button,
-        gpointer   data)
+add_row(GtkWidget*button, gpointer data)
 {
     GtkTreeView *tv = GTK_TREE_VIEW(data);
     GtkListStore *store = GTK_LIST_STORE(gtk_tree_view_get_model(tv));
@@ -936,18 +863,17 @@ add_row(GtkWidget *button,
     gtk_tree_path_free(path);
 }
 
-
 const gchar *libbalsa_address_target_list[] = {
     "text/plain",
     "x-application/x-addr"
 };
 
 static void
-addrlist_drag_received_cb(GtkWidget        *widget,
-                          GdkDragContext   *context,
-                          GtkSelectionData *selection_data,
-                          guint32           time,
-                          gpointer          data)
+addrlist_drag_received_cb(GtkWidget        * widget,
+                          GdkDragContext   * context,
+                          GtkSelectionData * selection_data,
+                          guint32            time,
+                          gpointer           data)
 {
     GtkTreeView *tree_view = GTK_TREE_VIEW(widget);
     GtkTreeModel *model = gtk_tree_view_get_model(tree_view);
@@ -957,8 +883,8 @@ addrlist_drag_received_cb(GtkWidget        *widget,
 
     printf("drag_received:\n");
     /* Deal with what we are given from source */
-    if ((selection_data != NULL)
-        && (gtk_selection_data_get_length(selection_data) >= 0)) {
+    if (selection_data != NULL
+        && gtk_selection_data_get_length(selection_data) >= 0) {
         const gchar *target;
 
         target = gtk_selection_data_get_target(selection_data);
@@ -966,8 +892,8 @@ addrlist_drag_received_cb(GtkWidget        *widget,
         if (target == g_intern_static_string("x-application/x-addr")) {
             addr = *(LibBalsaAddress **) gtk_selection_data_get_data(selection_data);
 
-            if ((addr != NULL) && (addr->addr_list != NULL)) {
-                g_print ("string: %s\n", (gchar *) addr->addr_list->data);
+            if (addr != NULL && addr->addr_list != NULL) {
+                g_print ("string: %s\n", (gchar*) addr->addr_list->data);
                 gtk_list_store_insert_with_values(GTK_LIST_STORE(model),
                                                   &iter, 99999,
                                                   0,
@@ -975,79 +901,72 @@ addrlist_drag_received_cb(GtkWidget        *widget,
                                                   -1);
                 dnd_success = TRUE;
             }
-        } else if ((target == g_intern_static_string("text/plain")) ||
-                   (target == g_intern_static_string("STRING"))) {
+        } else if (target == g_intern_static_string("text/plain") ||
+                   target == g_intern_static_string("STRING")) {
             g_print("text/plain target not implemented.\n");
         } else {
             g_print ("nothing good");
         }
     }
 
-    if (!dnd_success) {
+    if (!dnd_success)
         g_print ("DnD data transfer failed!\n");
-    }
 
     gtk_drag_finish(context, dnd_success, time);
 }
 
-
 static gboolean
-addrlist_drag_drop_cb(GtkWidget      *widget,
-                      GdkDragContext *context,
-                      gint            x,
-                      gint            y,
-                      guint           time,
-                      gpointer        user_data)
+addrlist_drag_drop_cb(GtkWidget *widget, GdkDragContext *context,
+                      gint x, gint y, guint time, gpointer user_data)
 {
-    gboolean is_valid_drop_site;
-    GdkContentFormats *formats;
+  gboolean        is_valid_drop_site;
+  GdkContentFormats *formats;
 
-    /* Check to see if (x,y) is a valid drop site within widget */
-    is_valid_drop_site = TRUE;
+  /* Check to see if (x,y) is a valid drop site within widget */
+  is_valid_drop_site = TRUE;
 
-    /* If the source offers a target */
-    formats = gdk_drag_context_get_formats(context);
-    if (formats != NULL) {
-        const gchar *const *mime_types;
-        gsize n_mime_types;
-        const gchar *target_type;
+  /* If the source offers a target */
+  formats = gdk_drag_context_get_formats(context);
+  if (formats != NULL) {
+      const gchar * const *mime_types;
+      gsize                n_mime_types;
+      const gchar         *target_type;
 
-        mime_types = gdk_content_formats_get_mime_types(formats, &n_mime_types);
-        g_assert(n_mime_types > LIBBALSA_ADDRESS_TRG_ADDRESS);
+      mime_types = gdk_content_formats_get_mime_types(formats, &n_mime_types);
+      g_assert(n_mime_types > LIBBALSA_ADDRESS_TRG_ADDRESS);
 
-        /* Choose the best target type */
-        target_type =
-            g_intern_static_string(mime_types[LIBBALSA_ADDRESS_TRG_ADDRESS]);
+      /* Choose the best target type */
+      target_type =
+          g_intern_static_string(mime_types[LIBBALSA_ADDRESS_TRG_ADDRESS]);
 
-        /* Request the data from the source. */
-        printf("drag_drop requests target=%p\n", target_type);
-        gtk_drag_get_data
+      /* Request the data from the source. */
+      printf("drag_drop requests target=%p\n", target_type);
+      gtk_drag_get_data
         (
-            widget,      /* will receive 'drag-data-received' signal */
-            context,     /* represents the current state of the DnD */
-            target_type, /* the target type we want */
-            time         /* time stamp */
-        );
-    } else {
-        is_valid_drop_site = FALSE;
-    }
-
-    return is_valid_drop_site;
+         widget,         /* will receive 'drag-data-received' signal */
+         context,        /* represents the current state of the DnD */
+         target_type,    /* the target type we want */
+         time            /* time stamp */
+         );
+  } else {
+      is_valid_drop_site = FALSE;
+  }
+
+  return  is_valid_drop_site;
 }
 
 
-GtkWidget *
+GtkWidget*
 libbalsa_address_get_edit_widget(const LibBalsaAddress *address,
-                                 GtkWidget            **entries,
-                                 GCallback              changed_cb,
-                                 gpointer               changed_data)
+                                 GtkWidget **entries,
+                                 GCallback changed_cb, gpointer changed_data)
 {
     static const gchar *labels[NUM_FIELDS] = {
-        N_("D_isplayed Name:"),
-        N_("_First Name:"),
-        N_("_Last Name:"),
-        N_("_Nickname:"),
-        N_("O_rganization:"),
+       N_("D_isplayed Name:"),
+       N_("_First Name:"),
+       N_("_Last Name:"),
+       N_("_Nickname:"),
+       N_("O_rganization:"),
         N_("_Email Address:")
     };
 
@@ -1061,18 +980,17 @@ libbalsa_address_get_edit_widget(const LibBalsaAddress *address,
     g_object_set(G_OBJECT(grid), "margin", HIG_PADDING, NULL);
 
     for (cnt = 0; cnt < NUM_FIELDS; cnt++) {
-        if (!labels[cnt]) {
+        if (!labels[cnt])
             continue;
-        }
-        label = gtk_label_new_with_mnemonic(_(labels[cnt]));
-        gtk_widget_set_halign(label, GTK_ALIGN_END);
+       label = gtk_label_new_with_mnemonic(_(labels[cnt]));
+       gtk_widget_set_halign(label, GTK_ALIGN_END);
         if (cnt == EMAIL_ADDRESS) {
             GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 1);
             GtkWidget *but = gtk_button_new_with_mnemonic(_("A_dd"));
             GdkContentFormats *formats;
 
             entries[cnt] = lba_addr_list_widget(changed_cb,
-                                                changed_data);
+                                                   changed_data);
             gtk_box_pack_start(GTK_BOX(box), label);
             gtk_box_pack_start(GTK_BOX(box), but);
             lhs = box;
@@ -1093,21 +1011,20 @@ libbalsa_address_get_edit_widget(const LibBalsaAddress *address,
                               G_CALLBACK (addrlist_drag_drop_cb), NULL);
         } else {
             entries[cnt] = gtk_entry_new();
-            if (changed_cb) {
+            if (changed_cb)
                 g_signal_connect_swapped(entries[cnt], "changed",
                                          changed_cb, changed_data);
-            }
             lhs = label;
         }
-        gtk_label_set_mnemonic_widget(GTK_LABEL(label), entries[cnt]);
+       gtk_label_set_mnemonic_widget(GTK_LABEL(label), entries[cnt]);
 
-        gtk_grid_attach(GTK_GRID(grid), lhs, 0, cnt + 1, 1, 1);
+       gtk_grid_attach(GTK_GRID(grid), lhs, 0, cnt + 1, 1, 1);
 
-        gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+       gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
 
         gtk_widget_set_hexpand(entries[cnt], TRUE);
         gtk_widget_set_vexpand(entries[cnt], TRUE);
-        gtk_grid_attach(GTK_GRID(grid), entries[cnt], 1, cnt + 1, 1, 1);
+       gtk_grid_attach(GTK_GRID(grid), entries[cnt], 1, cnt + 1, 1, 1);
     }
     g_signal_connect(entries[FIRST_NAME], "changed",
                      G_CALLBACK(lba_entry_changed), entries);
@@ -1130,14 +1047,13 @@ libbalsa_address_get_edit_widget(const LibBalsaAddress *address,
     return grid;
 }
 
-
 LibBalsaAddress *
-libbalsa_address_new_from_edit_entries(GtkWidget **entries)
+libbalsa_address_new_from_edit_entries(GtkWidget ** entries)
 {
-#define SET_FIELD(f, e) \
-    do { (f) = g_strstrip(gtk_editable_get_chars(GTK_EDITABLE(e), 0, -1)); \
-         if ( !(f) || !*(f)) { g_free(f); (f) = NULL; }                    \
-         else { while ((p = strchr(address->full_name, ';'))) { *p = ',';} } } while (0)
+#define SET_FIELD(f,e)\
+  do{ (f) = g_strstrip(gtk_editable_get_chars(GTK_EDITABLE(e), 0, -1));\
+      if( !(f) || !*(f)) { g_free(f); (f) = NULL; }                    \
+ else { while( (p=strchr(address->full_name,';'))) *p = ','; }  } while(0)
 
     LibBalsaAddress *address;
     char *p;
@@ -1155,15 +1071,15 @@ libbalsa_address_new_from_edit_entries(GtkWidget **entries)
        by commas. */
 
     address = libbalsa_address_new();
-    SET_FIELD(address->full_name, entries[FULL_NAME]);
+    SET_FIELD(address->full_name,   entries[FULL_NAME]);
     if (!address->full_name) {
         g_object_unref(address);
         return NULL;
     }
-    SET_FIELD(address->first_name, entries[FIRST_NAME]);
-    SET_FIELD(address->last_name, entries[LAST_NAME]);
-    SET_FIELD(address->nick_name, entries[NICK_NAME]);
-    SET_FIELD(address->organization, entries[ORGANIZATION]);
+    SET_FIELD(address->first_name,  entries[FIRST_NAME]);
+    SET_FIELD(address->last_name,   entries[LAST_NAME]);
+    SET_FIELD(address->nick_name,   entries[NICK_NAME]);
+    SET_FIELD(address->organization,entries[ORGANIZATION]);
 
     model = gtk_tree_view_get_model(GTK_TREE_VIEW(entries[EMAIL_ADDRESS]));
     for (valid = gtk_tree_model_get_iter_first(model, &iter); valid;
@@ -1171,23 +1087,20 @@ libbalsa_address_new_from_edit_entries(GtkWidget **entries)
         gchar *email;
 
         gtk_tree_model_get(model, &iter, 0, &email, -1);
-        if (email && *email) {
+        if (email && *email)
             list = g_list_prepend(list, email);
-        }
     }
     address->addr_list = g_list_reverse(list);
 
     return address;
 }
 
-
 /*
  * Comparison func
  */
 
 gint
-libbalsa_address_compare(LibBalsaAddress *a,
-                         LibBalsaAddress *b)
+libbalsa_address_compare(LibBalsaAddress *a, LibBalsaAddress *b)
 {
     g_return_val_if_fail(a != NULL, -1);
     g_return_val_if_fail(b != NULL, 1);
@@ -1195,121 +1108,106 @@ libbalsa_address_compare(LibBalsaAddress *a,
     return g_ascii_strcasecmp(a->full_name, b->full_name);
 }
 
-
 /*
  * Getters
  */
 
 const gchar *
-libbalsa_address_get_full_name(const LibBalsaAddress *address)
+libbalsa_address_get_full_name(const LibBalsaAddress * address)
 {
     return address->full_name;
 }
 
-
 const gchar *
-libbalsa_address_get_first_name(const LibBalsaAddress *address)
+libbalsa_address_get_first_name(const LibBalsaAddress * address)
 {
     return address->first_name;
 }
 
-
 const gchar *
-libbalsa_address_get_last_name(const LibBalsaAddress *address)
+libbalsa_address_get_last_name(const LibBalsaAddress * address)
 {
     return address->last_name;
 }
 
-
 const gchar *
-libbalsa_address_get_nick_name(const LibBalsaAddress *address)
+libbalsa_address_get_nick_name(const LibBalsaAddress * address)
 {
     return address->nick_name;
 }
 
-
 const gchar *
-libbalsa_address_get_organization(const LibBalsaAddress *address)
+libbalsa_address_get_organization(const LibBalsaAddress * address)
 {
     return address->organization;
 }
 
-
 const gchar *
-libbalsa_address_get_addr(const LibBalsaAddress *address)
+libbalsa_address_get_addr(const LibBalsaAddress * address)
 {
     return address->addr_list != NULL ? address->addr_list->data : NULL;
 }
 
-
 GList *
-libbalsa_address_get_addr_list(const LibBalsaAddress *address)
+libbalsa_address_get_addr_list(const LibBalsaAddress * address)
 {
     return address->addr_list;
 }
 
-
 /*
  * Setters
  */
 
 void
-libbalsa_address_set_full_name(LibBalsaAddress *address,
-                               const gchar     *full_name)
+libbalsa_address_set_full_name(LibBalsaAddress * address,
+                               const gchar     * full_name)
 {
     g_free(address->full_name);
     address->full_name = g_strdup(full_name);
 }
 
-
 void
-libbalsa_address_set_first_name(LibBalsaAddress *address,
-                                const gchar     *first_name)
+libbalsa_address_set_first_name(LibBalsaAddress * address,
+                                const gchar     * first_name)
 {
     g_free(address->first_name);
     address->first_name = g_strdup(first_name);
 }
 
-
 void
-libbalsa_address_set_last_name(LibBalsaAddress *address,
-                               const gchar     *last_name)
+libbalsa_address_set_last_name(LibBalsaAddress * address,
+                               const gchar     * last_name)
 {
     g_free(address->last_name);
     address->last_name = g_strdup(last_name);
 }
 
-
 void
-libbalsa_address_set_nick_name(LibBalsaAddress *address,
-                               const gchar     *nick_name)
+libbalsa_address_set_nick_name(LibBalsaAddress * address,
+                               const gchar     * nick_name)
 {
     g_free(address->nick_name);
     address->nick_name = g_strdup(nick_name);
 }
 
-
 void
-libbalsa_address_set_organization(LibBalsaAddress *address,
-                                  const gchar     *organization)
+libbalsa_address_set_organization(LibBalsaAddress * address,
+                                  const gchar     * organization)
 {
     g_free(address->organization);
     address->organization = g_strdup(organization);
 }
 
-
 void
-libbalsa_address_set_addr_list(LibBalsaAddress *address,
-                               GList           *addr_list)
+libbalsa_address_set_addr_list(LibBalsaAddress * address,
+                               GList           * addr_list)
 {
     g_list_free_full(address->addr_list, g_free);
     address->addr_list = addr_list;
 }
 
-
-void
-libbalsa_address_add_addr(LibBalsaAddress *address,
-                          const gchar     *addr)
+void libbalsa_address_add_addr(LibBalsaAddress * address,
+                               const gchar     * addr)
 {
     address->addr_list = g_list_prepend(address->addr_list, g_strdup(addr));
 }
diff --git a/libbalsa/address.h b/libbalsa/address.h
index e78beca..f92c1ed 100644
--- a/libbalsa/address.h
+++ b/libbalsa/address.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -41,18 +41,16 @@ enum _LibBalsaAddressField {
 
 LibBalsaAddress *libbalsa_address_new(void);
 LibBalsaAddress *libbalsa_address_new_from_vcard(const gchar *str,
-                                                 const gchar *charset);
-gchar *libbalsa_address_extract_name(const gchar *string,
-                                     gchar      **last_name,
-                                     gchar      **first_name);
+                                                const gchar *charset);
+gchar * libbalsa_address_extract_name(const gchar * string,
+                                      gchar ** last_name,
+                                      gchar ** first_name);
 
-void libbalsa_address_set_copy(LibBalsaAddress *dest,
-                               LibBalsaAddress *src);
-gchar *libbalsa_address_to_gchar(LibBalsaAddress *address,
-                                 gint             n);
+void libbalsa_address_set_copy(LibBalsaAddress *dest, LibBalsaAddress *src);
+gchar *libbalsa_address_to_gchar(LibBalsaAddress * address, gint n);
 
 const gchar *libbalsa_address_get_name_from_list(InternetAddressList
-                                                 *addr_list);
+                                                 * addr_list);
 const gchar *libbalsa_address_get_mailbox_from_list(InternetAddressList *
                                                     addr_list);
 gint libbalsa_address_n_mailboxes_in_list(InternetAddressList *
@@ -64,16 +62,15 @@ gint libbalsa_address_n_mailboxes_in_list(InternetAddressList *
 
 /** libbalsa_address_set_edit_entries() initializes the GtkEntry widgets
     in entries with values from address
- */
-void libbalsa_address_set_edit_entries(const LibBalsaAddress *address,
-                                       GtkWidget            **entries);
-
+*/
+void libbalsa_address_set_edit_entries(const LibBalsaAddress * address,
+                                       GtkWidget ** entries);
 /** libbalsa_address_get_edit_widget() returns an widget adapted for a
     LibBalsaAddress edition, with initial values set if address is
     provided. The edit entries are set in entries array and enumerated
     with LibBalsaAddressField constants. The widget accepts drops of
     type TARGET_ADDRESS and TARGET_STRING.
- */
+*/
 
 enum {
     LIBBALSA_ADDRESS_TRG_STRING,
@@ -84,9 +81,9 @@ enum {
 extern const gchar *libbalsa_address_target_list[2];
 
 GtkWidget *libbalsa_address_get_edit_widget(const LibBalsaAddress *addr,
-                                            GtkWidget            **entries,
-                                            GCallback              changed_cb,
-                                            gpointer               changed_data);
+                                            GtkWidget **entries,
+                                            GCallback changed_cb,
+                                            gpointer changed_data);
 LibBalsaAddress *libbalsa_address_new_from_edit_entries(GtkWidget **widget);
 
 /*
@@ -99,31 +96,31 @@ gint libbalsa_address_compare(LibBalsaAddress *a,
  * Getters
  */
 
-const gchar *libbalsa_address_get_full_name(const LibBalsaAddress *address);
-const gchar *libbalsa_address_get_first_name(const LibBalsaAddress *address);
-const gchar *libbalsa_address_get_last_name(const LibBalsaAddress *address);
-const gchar *libbalsa_address_get_nick_name(const LibBalsaAddress *address);
-const gchar *libbalsa_address_get_organization(const LibBalsaAddress *address);
-const gchar *libbalsa_address_get_addr(const LibBalsaAddress *address);
-GList *libbalsa_address_get_addr_list(const LibBalsaAddress *address);
+const gchar * libbalsa_address_get_full_name   (const LibBalsaAddress * address);
+const gchar * libbalsa_address_get_first_name  (const LibBalsaAddress * address);
+const gchar * libbalsa_address_get_last_name   (const LibBalsaAddress * address);
+const gchar * libbalsa_address_get_nick_name   (const LibBalsaAddress * address);
+const gchar * libbalsa_address_get_organization(const LibBalsaAddress * address);
+const gchar * libbalsa_address_get_addr        (const LibBalsaAddress * address);
+GList       * libbalsa_address_get_addr_list   (const LibBalsaAddress * address);
 
 /*
  * Setters
  */
 
-void libbalsa_address_set_full_name(LibBalsaAddress *address,
-                                    const gchar     *full_name);
-void libbalsa_address_set_first_name(LibBalsaAddress *address,
-                                     const gchar     *first_name);
-void libbalsa_address_set_last_name(LibBalsaAddress *address,
-                                    const gchar     *last_name);
-void libbalsa_address_set_nick_name(LibBalsaAddress *address,
-                                    const gchar     *nick_name);
-void libbalsa_address_set_organization(LibBalsaAddress *address,
-                                       const gchar     *organization);
-void libbalsa_address_set_addr_list(LibBalsaAddress *address,
-                                    GList           *addr_list);
-void libbalsa_address_add_addr(LibBalsaAddress *address,
-                               const gchar     *addr);
-
-#endif                          /* __LIBBALSA_ADDRESS_H__ */
+void libbalsa_address_set_full_name   (LibBalsaAddress * address,
+                                       const gchar     * full_name);
+void libbalsa_address_set_first_name  (LibBalsaAddress * address,
+                                       const gchar     * first_name);
+void libbalsa_address_set_last_name   (LibBalsaAddress * address,
+                                       const gchar     * last_name);
+void libbalsa_address_set_nick_name   (LibBalsaAddress * address,
+                                       const gchar     * nick_name);
+void libbalsa_address_set_organization(LibBalsaAddress * address,
+                                       const gchar     * organization);
+void libbalsa_address_set_addr_list   (LibBalsaAddress * address,
+                                       GList           * addr_list);
+void libbalsa_address_add_addr        (LibBalsaAddress * address,
+                                       const gchar     * addr);
+
+#endif                         /* __LIBBALSA_ADDRESS_H__ */
diff --git a/libbalsa/application-helpers.c b/libbalsa/application-helpers.c
index f66f174..619ed35 100644
--- a/libbalsa/application-helpers.c
+++ b/libbalsa/application-helpers.c
@@ -21,7 +21,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <gtk/gtk.h>
@@ -29,23 +29,21 @@
 #include "application-helpers.h"
 
 typedef struct {
-    GAction *action;
+    GAction  *action;
     GVariant *parameter;
 } AccelInfo;
 
 static void
-accel_info_free(AccelInfo *info)
+accel_info_free(AccelInfo * info)
 {
-    if (info->parameter) {
+    if (info->parameter)
         g_variant_unref(info->parameter);
-    }
     g_free(info);
 }
 
-
 static gboolean
-accel_activate(GtkAccelGroup  *accel_group,
-               GObject        *acceleratable,
+accel_activate(GtkAccelGroup * accel_group,
+               GObject       * acceleratable,
                guint           keyval,
                GdkModifierType modifier,
                gpointer        user_data)
@@ -57,12 +55,11 @@ accel_activate(GtkAccelGroup  *accel_group,
     return TRUE;
 }
 
-
 static void
-extract_accel_from_menu_item(GMenuModel    *model,
-                             gint           item,
-                             GActionMap    *action_map,
-                             GtkAccelGroup *accel_group)
+extract_accel_from_menu_item(GMenuModel    * model,
+                             gint            item,
+                             GActionMap    * action_map,
+                             GtkAccelGroup * accel_group)
 {
     GMenuAttributeIter *iter;
     const gchar *key;
@@ -74,14 +71,13 @@ extract_accel_from_menu_item(GMenuModel    *model,
     iter = g_menu_model_iterate_item_attributes(model, item);
     while (g_menu_attribute_iter_get_next(iter, &key, &value)) {
         if (g_str_equal(key, "action")
-            && g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
+            && g_variant_is_of_type(value, G_VARIANT_TYPE_STRING))
             action = g_variant_get_string(value, NULL);
-        } else if (g_str_equal(key, "accel")
-                   && g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
+        else if (g_str_equal(key, "accel")
+                 && g_variant_is_of_type(value, G_VARIANT_TYPE_STRING))
             accel = g_variant_get_string(value, NULL);
-        } else if (g_str_equal(key, "target")) {
+        else if (g_str_equal(key, "target"))
             target = g_variant_ref(value);
-        }
         g_variant_unref(value);
     }
     g_object_unref(iter);
@@ -105,16 +101,14 @@ extract_accel_from_menu_item(GMenuModel    *model,
                                 closure);
     }
 
-    if (target) {
+    if (target)
         g_variant_unref(target);
-    }
 }
 
-
 static void
-extract_accels_from_menu(GMenuModel    *model,
-                         GActionMap    *action_map,
-                         GtkAccelGroup *accel_group)
+extract_accels_from_menu(GMenuModel    * model,
+                         GActionMap    * action_map,
+                         GtkAccelGroup * accel_group)
 {
     gint i, n = g_menu_model_get_n_items(model);
     GMenuLinkIter *iter;
@@ -133,10 +127,9 @@ extract_accels_from_menu(GMenuModel    *model,
     }
 }
 
-
 static GtkAccelGroup *
-get_accel_group(GMenuModel *model,
-                GActionMap *action_map)
+get_accel_group(GMenuModel * model,
+                GActionMap * action_map)
 {
     GtkAccelGroup *accel_group;
 
@@ -146,7 +139,6 @@ get_accel_group(GMenuModel *model,
     return accel_group;
 }
 
-
 /*
  * libbalsa_window_get_menu_bar
  *
@@ -165,12 +157,12 @@ get_accel_group(GMenuModel *model,
  */
 
 GtkWidget *
-libbalsa_window_get_menu_bar(GtkApplicationWindow *window,
-                             const GActionEntry   *entries,
-                             gint                  n_entries,
-                             const gchar          *ui_file,
-                             GError              **error,
-                             gpointer              cb_data)
+libbalsa_window_get_menu_bar(GtkApplicationWindow * window,
+                             const GActionEntry   * entries,
+                             gint                   n_entries,
+                             const gchar          * ui_file,
+                             GError              ** error,
+                             gpointer               cb_data)
 {
     GActionMap *map = G_ACTION_MAP(window);
     GtkBuilder *builder;
@@ -195,7 +187,6 @@ libbalsa_window_get_menu_bar(GtkApplicationWindow *window,
     return menu_bar;
 }
 
-
 /*
  * libbalsa_window_set_accels
  *
@@ -207,26 +198,24 @@ libbalsa_window_get_menu_bar(GtkApplicationWindow *window,
  */
 
 void
-libbalsa_window_set_accels(GtkApplicationWindow *window,
-                           GMenuModel           *menu_model)
+libbalsa_window_set_accels(GtkApplicationWindow * window,
+                           GMenuModel           * menu_model)
 {
     GSList *accel_groups;
     GtkAccelGroup *accel_group;
 
     /* Remove current accelerators: */
     accel_groups = gtk_accel_groups_from_object(G_OBJECT(window));
-    if (accel_groups) {
+    if (accel_groups)
         /* Last is first... */
         gtk_window_remove_accel_group(GTK_WINDOW(window),
                                       accel_groups->data);
-    }
 
     accel_group = get_accel_group(menu_model, G_ACTION_MAP(window));
     gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
     g_object_unref(accel_group);
 }
 
-
 /*
  * libbalsa_window_add_accelerator
  *
@@ -238,9 +227,9 @@ libbalsa_window_set_accels(GtkApplicationWindow *window,
  */
 
 void
-libbalsa_window_add_accelerator(GtkApplicationWindow *window,
-                                const gchar          *accel,
-                                const gchar          *action_name)
+libbalsa_window_add_accelerator(GtkApplicationWindow * window,
+                                const gchar          * accel,
+                                const gchar          * action_name)
 {
     GActionMap *action_map = G_ACTION_MAP(window);
     guint accel_key;
@@ -279,7 +268,6 @@ libbalsa_window_add_accelerator(GtkApplicationWindow *window,
     gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
 }
 
-
 /*
  * libbalsa_toggle_activated
  *
@@ -292,9 +280,9 @@ libbalsa_window_add_accelerator(GtkApplicationWindow *window,
  */
 
 void
-libbalsa_toggle_activated(GSimpleAction *action,
-                          GVariant      *parameter,
-                          gpointer       user_data)
+libbalsa_toggle_activated(GSimpleAction * action,
+                          GVariant      * parameter,
+                          gpointer        user_data)
 {
     GVariant *action_state;
     gboolean state;
@@ -305,7 +293,6 @@ libbalsa_toggle_activated(GSimpleAction *action,
     g_variant_unref(action_state);
 }
 
-
 /*
  * libbalsa_radio_activated
  *
@@ -318,9 +305,9 @@ libbalsa_toggle_activated(GSimpleAction *action,
  */
 
 void
-libbalsa_radio_activated(GSimpleAction *action,
-                         GVariant      *parameter,
-                         gpointer       user_data)
+libbalsa_radio_activated(GSimpleAction * action,
+                         GVariant      * parameter,
+                         gpointer        user_data)
 {
     g_action_change_state(G_ACTION(action), parameter);
 }
diff --git a/libbalsa/application-helpers.h b/libbalsa/application-helpers.h
index 5458040..a460a0a 100644
--- a/libbalsa/application-helpers.h
+++ b/libbalsa/application-helpers.h
@@ -26,31 +26,31 @@
 #define   __LIBBALSA_APPLICATION_HELPERS_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+#error "Include config.h before this file."
 #endif
 
 #include <gtk/gtk.h>
 
-GtkWidget *libbalsa_window_get_menu_bar(GtkApplicationWindow *window,
-                                        const GActionEntry   *entries,
-                                        gint                  n_entries,
-                                        const gchar          *ui_file,
-                                        GError              **error,
-                                        gpointer              cb_data);
+GtkWidget *libbalsa_window_get_menu_bar(GtkApplicationWindow * window,
+                                        const GActionEntry   * entries,
+                                        gint                   n_entries,
+                                        const gchar          * ui_file,
+                                        GError              ** error,
+                                        gpointer               cb_data);
 
-void libbalsa_window_set_accels(GtkApplicationWindow *window,
-                                GMenuModel           *menu_model);
+void libbalsa_window_set_accels        (GtkApplicationWindow * window,
+                                        GMenuModel           * menu_model);
 
-void libbalsa_window_add_accelerator(GtkApplicationWindow *window,
-                                     const gchar          *accel,
-                                     const gchar          *action_name);
+void libbalsa_window_add_accelerator   (GtkApplicationWindow * window,
+                                        const gchar          * accel,
+                                        const gchar          * action_name);
 
-void libbalsa_toggle_activated(GSimpleAction *action,
-                               GVariant      *parameter,
-                               gpointer       user_data);
+void libbalsa_toggle_activated         (GSimpleAction        * action,
+                                        GVariant             * parameter,
+                                        gpointer               user_data);
 
-void libbalsa_radio_activated(GSimpleAction *action,
-                              GVariant      *parameter,
-                              gpointer       user_data);
+void libbalsa_radio_activated          (GSimpleAction        * action,
+                                        GVariant             * parameter,
+                                        gpointer               user_data);
 
-#endif                          /* __LIBBALSA_APPLICATION_HELPERS_H__ */
+#endif                         /* __LIBBALSA_APPLICATION_HELPERS_H__ */
diff --git a/libbalsa/body.c b/libbalsa/body.c
index cb30ac3..83d2f4f 100644
--- a/libbalsa/body.c
+++ b/libbalsa/body.c
@@ -6,20 +6,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <sys/types.h>
@@ -35,7 +35,7 @@
 #include <glib/gi18n.h>
 
 LibBalsaMessageBody *
-libbalsa_message_body_new(LibBalsaMessage *message)
+libbalsa_message_body_new(LibBalsaMessage * message)
 {
     LibBalsaMessageBody *body;
 
@@ -66,11 +66,10 @@ libbalsa_message_body_new(LibBalsaMessage *message)
 
 
 void
-libbalsa_message_body_free(LibBalsaMessageBody *body)
+libbalsa_message_body_free(LibBalsaMessageBody * body)
 {
-    if (body == NULL) {
-        return;
-    }
+    if (body == NULL)
+       return;
 
     g_free(body->buffer);
     g_free(body->html_buffer);
@@ -79,7 +78,7 @@ libbalsa_message_body_free(LibBalsaMessageBody *body)
     g_free(body->filename);
     g_clear_object(&body->file_uri);
     if (body->temp_filename) {
-        unlink(body->temp_filename);
+       unlink(body->temp_filename);
         g_free(body->temp_filename);
     }
 
@@ -99,7 +98,7 @@ libbalsa_message_body_free(LibBalsaMessageBody *body)
 
 
 static LibBalsaMessageHeaders *
-libbalsa_message_body_extract_embedded_headers(GMimeMessage *msg)
+libbalsa_message_body_extract_embedded_headers(GMimeMessage* msg)
 {
     LibBalsaMessageHeaders *ehdr;
     const char *subj;
@@ -112,18 +111,16 @@ libbalsa_message_body_extract_embedded_headers(GMimeMessage *msg)
 
     subj = g_mime_message_get_subject(msg);
     if (subj) {
-        ehdr->subject =
-            g_mime_utils_header_decode_text(subj);
-        libbalsa_utf8_sanitize(&ehdr->subject, TRUE, NULL);
-    } else {
-        ehdr->subject = g_strdup(_("(No subject)"));
-    }
+       ehdr->subject =
+           g_mime_utils_header_decode_text(subj);
+       libbalsa_utf8_sanitize(&ehdr->subject, TRUE, NULL);
+    } else 
+       ehdr->subject = g_strdup(_("(No subject)"));
     g_mime_message_get_date(msg, &ehdr->date, &offset);
 
     return ehdr;
 }
 
-
 /* Create a LibBalsaMessageBody with structure matching the GMimeObject;
  * the body may already have the necessary parts, so we check before
  * allocating new ones; it may have too many, so we free any that are no
@@ -132,50 +129,46 @@ libbalsa_message_body_extract_embedded_headers(GMimeMessage *msg)
 
 /* First some helpers. */
 static void
-libbalsa_message_body_set_filename(LibBalsaMessageBody *body)
+libbalsa_message_body_set_filename(LibBalsaMessageBody * body)
 {
     if (GMIME_IS_PART(body->mime_part)) {
-        g_free(body->filename);
-        body->filename =
-            g_strdup(g_mime_part_get_filename(GMIME_PART(body->mime_part)));
+       g_free(body->filename);
+       body->filename =
+           g_strdup(g_mime_part_get_filename(GMIME_PART(body->mime_part)));
     }
 }
 
-
 static void
-libbalsa_message_body_set_types(LibBalsaMessageBody *body)
+libbalsa_message_body_set_types(LibBalsaMessageBody * body)
 {
     GMimeContentType *type;
 
     type = g_mime_object_get_content_type(body->mime_part);
-    if (g_mime_content_type_is_type(type, "audio", "*")) {
-        body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_AUDIO;
-    } else if (g_mime_content_type_is_type(type, "application", "*")) {
-        body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_APPLICATION;
-    } else if (g_mime_content_type_is_type(type, "image", "*")) {
-        body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_IMAGE;
-    } else if (g_mime_content_type_is_type(type, "message", "*")) {
-        body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_MESSAGE;
-    } else if (g_mime_content_type_is_type(type, "model", "*")) {
-        body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_MODEL;
-    } else if (g_mime_content_type_is_type(type, "multipart", "*")) {
-        body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART;
-    } else if (g_mime_content_type_is_type(type, "text", "*")) {
-        body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_TEXT;
-    } else if (g_mime_content_type_is_type(type, "video", "*")) {
-        body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_VIDEO;
-    } else {
-        body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_OTHER;
-    }
+    if      (g_mime_content_type_is_type(type, "audio", "*"))
+       body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_AUDIO;
+    else if (g_mime_content_type_is_type(type, "application", "*"))
+       body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_APPLICATION;
+    else if (g_mime_content_type_is_type(type, "image", "*"))
+       body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_IMAGE;
+    else if (g_mime_content_type_is_type(type, "message", "*"))
+       body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_MESSAGE;
+    else if (g_mime_content_type_is_type(type, "model", "*"))
+       body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_MODEL;
+    else if (g_mime_content_type_is_type(type, "multipart", "*"))
+       body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART;
+    else if (g_mime_content_type_is_type(type, "text", "*"))
+       body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_TEXT;
+    else if (g_mime_content_type_is_type(type, "video", "*"))
+       body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_VIDEO;
+    else body->body_type = LIBBALSA_MESSAGE_BODY_TYPE_OTHER;
 
     g_free(body->content_type);
     body->content_type = g_mime_content_type_to_string(type);
 }
 
-
 static LibBalsaMessageBody **
-libbalsa_message_body_set_message_part(LibBalsaMessageBody  *body,
-                                       LibBalsaMessageBody **next_part)
+libbalsa_message_body_set_message_part(LibBalsaMessageBody * body,
+                                      LibBalsaMessageBody ** next_part)
 {
     GMimeMessagePart *message_part;
     GMimeMessage *embedded_message;
@@ -187,10 +180,9 @@ libbalsa_message_body_set_message_part(LibBalsaMessageBody  *body,
         libbalsa_message_headers_destroy(body->embhdrs);
         body->embhdrs =
             libbalsa_message_body_extract_embedded_headers
-                (embedded_message);
-        if (!*next_part) {
+            (embedded_message);
+        if (!*next_part)
             *next_part = libbalsa_message_body_new(body->message);
-        }
         libbalsa_message_body_set_mime_body(*next_part,
                                             embedded_message->mime_part);
     }
@@ -198,29 +190,26 @@ libbalsa_message_body_set_message_part(LibBalsaMessageBody  *body,
     return *next_part ? &(*next_part)->next : next_part;
 }
 
-
 static LibBalsaMessageBody **
-libbalsa_message_body_set_multipart(LibBalsaMessageBody  *body,
-                                    LibBalsaMessageBody **next_part)
+libbalsa_message_body_set_multipart(LibBalsaMessageBody * body,
+                                   LibBalsaMessageBody ** next_part)
 {
     GMimeMultipart *multipart = GMIME_MULTIPART(body->mime_part);
     GMimeObject *part;
     int count, i;
-
+    
     count = g_mime_multipart_get_count (multipart);
     for (i = 0; i < count; i++) {
-        part = g_mime_multipart_get_part (multipart, i);
-        if (!*next_part) {
-            *next_part = libbalsa_message_body_new(body->message);
-        }
-        libbalsa_message_body_set_mime_body(*next_part, part);
-        next_part = &(*next_part)->next;
+       part = g_mime_multipart_get_part (multipart, i);
+       if (!*next_part)
+           *next_part = libbalsa_message_body_new(body->message);
+       libbalsa_message_body_set_mime_body(*next_part, part);
+       next_part = &(*next_part)->next;
     }
 
     return next_part;
 }
 
-
 static void
 libbalsa_message_body_set_text_rfc822headers(LibBalsaMessageBody *body)
 {
@@ -230,55 +219,53 @@ libbalsa_message_body_set_text_rfc822headers(LibBalsaMessageBody *body)
     headers = libbalsa_message_body_get_stream(body, NULL);
 
     if (headers != NULL) {
-        GMimeMessage *dummy_msg;
-        GMimeParser *parser;
+       GMimeMessage *dummy_msg;
+       GMimeParser *parser;
 
-        g_mime_stream_reset(headers);
-        parser = g_mime_parser_new_with_stream(headers);
-        g_object_unref(headers);
-        dummy_msg = g_mime_parser_construct_message(parser);
-        g_object_unref(parser);
+       g_mime_stream_reset(headers);
+       parser = g_mime_parser_new_with_stream(headers);
+       g_object_unref(headers);
+       dummy_msg = g_mime_parser_construct_message(parser);
+       g_object_unref(parser);
 
-        body->embhdrs = libbalsa_message_body_extract_embedded_headers(dummy_msg);
-        g_object_unref(dummy_msg);
+       body->embhdrs = libbalsa_message_body_extract_embedded_headers(dummy_msg);
+       g_object_unref(dummy_msg);
     }
 
     libbalsa_mailbox_unlock_store(body->message->mailbox);
 }
 
-
 static void
-libbalsa_message_body_set_parts(LibBalsaMessageBody *body)
+libbalsa_message_body_set_parts(LibBalsaMessageBody * body)
 {
     LibBalsaMessageBody **next_part = &body->parts;
 
-    if (GMIME_IS_MESSAGE_PART(body->mime_part)) {
-        next_part = libbalsa_message_body_set_message_part(body, next_part);
-    } else if (GMIME_IS_MULTIPART(body->mime_part)) {
-        next_part = libbalsa_message_body_set_multipart(body, next_part);
-    } else {
-        gchar *mime_type;
+    if (GMIME_IS_MESSAGE_PART(body->mime_part))
+       next_part = libbalsa_message_body_set_message_part(body, next_part);
+    else if (GMIME_IS_MULTIPART(body->mime_part))
+       next_part = libbalsa_message_body_set_multipart(body, next_part);
+    else {
+       gchar *mime_type;
 
-        mime_type = libbalsa_message_body_get_mime_type(body);
-        if (strcmp(mime_type, "text/rfc822-headers") == 0) {
-            libbalsa_message_body_set_text_rfc822headers(body);
-        }
-        g_free(mime_type);
+       mime_type = libbalsa_message_body_get_mime_type(body);
+       if (strcmp(mime_type, "text/rfc822-headers") == 0) {
+           libbalsa_message_body_set_text_rfc822headers(body);
+       }
+       g_free(mime_type);
     }
 
     /* Free any parts that weren't used; the test isn't strictly
      * necessary, but it should fail unless something really strange has
      * happened, so it's worth including. */
     if (*next_part) {
-        libbalsa_message_body_free(*next_part);
-        *next_part = NULL;
+       libbalsa_message_body_free(*next_part);
+       *next_part = NULL;
     }
 }
 
-
 void
-libbalsa_message_body_set_mime_body(LibBalsaMessageBody *body,
-                                    GMimeObject         *mime_part)
+libbalsa_message_body_set_mime_body(LibBalsaMessageBody * body,
+                                   GMimeObject * mime_part)
 {
     g_return_if_fail(body != NULL);
     g_return_if_fail(GMIME_IS_OBJECT(mime_part));
@@ -290,18 +277,16 @@ libbalsa_message_body_set_mime_body(LibBalsaMessageBody *body,
     libbalsa_message_body_set_parts(body);
 }
 
-
 LibBalsaMessageBodyType
-libbalsa_message_body_type(LibBalsaMessageBody *body)
+libbalsa_message_body_type(LibBalsaMessageBody * body)
 {
     /* FIXME: this could be a virtual function... OR not? */
     return body->body_type;
 }
 
-
 gchar *
-libbalsa_message_body_get_parameter(LibBalsaMessageBody *body,
-                                    const gchar         *param)
+libbalsa_message_body_get_parameter(LibBalsaMessageBody * body,
+                                   const gchar * param)
 {
     GMimeContentType *type;
     gchar *res = NULL;
@@ -309,43 +294,39 @@ libbalsa_message_body_get_parameter(LibBalsaMessageBody *body,
     g_return_val_if_fail(body != NULL, NULL);
 
     if (body->mime_part) {
-        type = g_mime_object_get_content_type(body->mime_part);
-        res = g_strdup(g_mime_content_type_get_parameter(type, param));
+       type = g_mime_object_get_content_type(body->mime_part);
+       res = g_strdup(g_mime_content_type_get_parameter(type, param));
     } else if (body->content_type) {
-        type = g_mime_content_type_new_from_string(body->content_type);
-        res = g_strdup(g_mime_content_type_get_parameter(type, param));
-        g_object_unref(type);
+       type = g_mime_content_type_new_from_string(body->content_type);
+       res = g_strdup(g_mime_content_type_get_parameter(type, param));
+       g_object_unref(type);
     }
 
     return res;
 }
 
-
 static gchar *
-libbalsa_message_body_get_cid(LibBalsaMessageBody *body)
+libbalsa_message_body_get_cid(LibBalsaMessageBody * body)
 {
     const gchar *content_id = body->mime_part ?
         g_mime_object_get_content_id(body->mime_part) : body->content_id;
 
     if (content_id) {
-        if ((content_id[0] == '<')
-            && (content_id[strlen(content_id) - 1] == '>')) {
+        if (content_id[0] == '<'
+            && content_id[strlen(content_id) - 1] == '>')
             return g_strndup(content_id + 1, strlen(content_id) - 2);
-        }
         return g_strdup(content_id);
     }
 
     return NULL;
 }
 
-
 /* libbalsa_message_body_save_temporary:
    check if body has already its copy in temporary file and if not,
    allocates a temporary file name and saves the body there.
- */
+*/
 gboolean
-libbalsa_message_body_save_temporary(LibBalsaMessageBody *body,
-                                     GError             **err)
+libbalsa_message_body_save_temporary(LibBalsaMessageBody * body, GError **err)
 {
     if (!body) {
         g_set_error(err, LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_ACCESS_ERROR,
@@ -361,10 +342,10 @@ libbalsa_message_body_save_temporary(LibBalsaMessageBody *body,
         filename = body->filename ?
             g_strdup(body->filename) : libbalsa_message_body_get_cid(body);
 
-        if (!filename) {
-            fd = g_file_open_tmp("balsa-body-XXXXXX",
+        if (!filename)
+           fd = g_file_open_tmp("balsa-body-XXXXXX",
                                  &body->temp_filename, err);
-        } else {
+        else {
             const gchar *tempdir =
                 libbalsa_message_get_tempdir(body->message);
 
@@ -388,50 +369,46 @@ libbalsa_message_body_save_temporary(LibBalsaMessageBody *body,
         }
 
         if (fd < 0) {
-            if (err && !*err) {
+            if (err && !*err)
                 g_set_error(err, LIBBALSA_ERROR_QUARK, 1,
                             "Failed to create temporary file");
-            }
             return FALSE;
         }
 
-        if ((tmp_stream = g_mime_stream_fs_new(fd)) != NULL) {
+        if ((tmp_stream = g_mime_stream_fs_new(fd)) != NULL)
             return libbalsa_message_body_save_stream(body, tmp_stream,
                                                      FALSE, err);
-        } else {
+        else {
             g_set_error(err, LIBBALSA_ERROR_QUARK, 1,
                         _("Failed to create output stream"));
             close(fd);
             return FALSE;
         }
     } else {
-        /* the temporary name has been already allocated on previous
-           save_temporary action. We just check if the file is still there.
-         */
-        struct stat s;
-        if ((stat(body->temp_filename, &s) == 0) &&
-            S_ISREG(s.st_mode) &&
-            (s.st_uid == getuid())) {
-            return TRUE;
-        } else {
-            return libbalsa_message_body_save(body, body->temp_filename,
+       /* the temporary name has been already allocated on previous
+          save_temporary action. We just check if the file is still there.
+       */
+       struct stat s;
+       if (stat(body->temp_filename, &s) == 0 && 
+           S_ISREG(s.st_mode) && 
+           s.st_uid == getuid())
+           return TRUE;
+       else
+           return libbalsa_message_body_save(body, body->temp_filename,
                                               S_IRUSR,
                                               FALSE, err);
-        }
     }
 }
 
-
 /* libbalsa_message_body_save:
    NOTE: has to use libbalsa_safe_open to set the file access privileges
    to safe.
- */
+*/
 gboolean
-libbalsa_message_body_save(LibBalsaMessageBody *body,
-                           const gchar         *filename,
-                           mode_t               mode,
-                           gboolean             filter_crlf,
-                           GError             **err)
+libbalsa_message_body_save(LibBalsaMessageBody * body,
+                          const gchar * filename, mode_t mode,
+                           gboolean filter_crlf,
+                           GError **err)
 {
     int fd;
     int flags = O_CREAT | O_EXCL | O_WRONLY;
@@ -441,14 +418,12 @@ libbalsa_message_body_save(LibBalsaMessageBody *body,
     flags |= O_NOFOLLOW;
 #endif
 
-    if ((fd = libbalsa_safe_open(filename, flags, mode, err)) < 0) {
-        return FALSE;
-    }
+    if ((fd = libbalsa_safe_open(filename, flags, mode, err)) < 0)
+       return FALSE;
 
-    if ((out_stream = g_mime_stream_fs_new(fd)) != NULL) {
+    if ((out_stream = g_mime_stream_fs_new(fd)) != NULL)
         return libbalsa_message_body_save_stream(body, out_stream,
                                                  filter_crlf, err);
-    }
 
     /* could not create stream */
     g_set_error(err, LIBBALSA_ERROR_QUARK, 1,
@@ -459,25 +434,22 @@ libbalsa_message_body_save(LibBalsaMessageBody *body,
 
 
 gboolean
-libbalsa_message_body_save_vfs(LibBalsaMessageBody *body,
-                               LibbalsaVfs         *dest,
-                               mode_t               mode,
-                               gboolean             filter_crlf,
-                               GError             **err)
+libbalsa_message_body_save_vfs(LibBalsaMessageBody * body,
+                               LibbalsaVfs * dest, mode_t mode,
+                               gboolean filter_crlf,
+                               GError **err)
 {
-    GMimeStream *out_stream;
-
-    if (!(out_stream = libbalsa_vfs_create_stream(dest, mode, TRUE, err))) {
+    GMimeStream * out_stream;
+    
+    if (!(out_stream = libbalsa_vfs_create_stream(dest, mode, TRUE, err)))
         return FALSE;
-    }
 
     return libbalsa_message_body_save_stream(body, out_stream, filter_crlf, err);
 }
 
-
 static GMimeStream *
-libbalsa_message_body_stream_add_filter(GMimeStream *stream,
-                                        GMimeFilter *filter)
+libbalsa_message_body_stream_add_filter(GMimeStream * stream,
+                                        GMimeFilter * filter)
 {
     if (!GMIME_IS_STREAM_FILTER(stream)) {
         GMimeStream *filtered_stream =
@@ -492,10 +464,9 @@ libbalsa_message_body_stream_add_filter(GMimeStream *stream,
     return stream;
 }
 
-
 static GMimeStream *
-libbalsa_message_body_get_part_stream(LibBalsaMessageBody *body,
-                                      GError             **err)
+libbalsa_message_body_get_part_stream(LibBalsaMessageBody * body,
+                                      GError ** err)
 {
     GMimeStream *stream;
     GMimeDataWrapper *wrapper;
@@ -523,17 +494,16 @@ libbalsa_message_body_get_part_stream(LibBalsaMessageBody *body,
         filter = g_mime_filter_basic_new(encoding, FALSE);
         stream = libbalsa_message_body_stream_add_filter(stream, filter);
         break;
-
     default:
         break;
     }
 
     /* convert text bodies but HTML - gtkhtml does conversion on its own. */
-    if ((libbalsa_message_body_type(body) == LIBBALSA_MESSAGE_BODY_TYPE_TEXT)
-        && (strcmp(mime_type = libbalsa_message_body_get_mime_type(body),
-                   "text/html") != 0)
-        && ((charset = libbalsa_message_body_charset(body)) != NULL)
-        && (g_ascii_strcasecmp(charset, "unknown-8bit") != 0)) {
+    if (libbalsa_message_body_type(body) == LIBBALSA_MESSAGE_BODY_TYPE_TEXT
+        && strcmp(mime_type = libbalsa_message_body_get_mime_type(body),
+                  "text/html") != 0
+        && (charset = libbalsa_message_body_charset(body)) != NULL
+        && g_ascii_strcasecmp(charset, "unknown-8bit") != 0) {
         GMimeStream *stream_null;
         GMimeStream *stream_filter;
         GMimeFilter *filter_windows;
@@ -553,7 +523,7 @@ libbalsa_message_body_get_part_stream(LibBalsaMessageBody *body,
         g_object_unref(stream_filter);
 
         charset = g_mime_filter_windows_real_charset(GMIME_FILTER_WINDOWS
-                                                         (filter_windows));
+                                                     (filter_windows));
         if ((filter = g_mime_filter_charset_new(charset, "UTF-8"))) {
             stream =
                 libbalsa_message_body_stream_add_filter(stream, filter);
@@ -568,15 +538,14 @@ libbalsa_message_body_get_part_stream(LibBalsaMessageBody *body,
     return stream;
 }
 
-
 static GMimeStream *
-libbalsa_message_body_get_message_part_stream(LibBalsaMessageBody *body,
-                                              GError             **err)
+libbalsa_message_body_get_message_part_stream(LibBalsaMessageBody * body,
+                                              GError ** err)
 {
     GMimeStream *stream;
     ssize_t bytes_written;
     GMimeMessage *msg = g_mime_message_part_get_message
-            (GMIME_MESSAGE_PART(body->mime_part));
+        (GMIME_MESSAGE_PART(body->mime_part));
 
     stream = g_mime_stream_mem_new();
     libbalsa_mailbox_lock_store(body->message->mailbox);
@@ -598,16 +567,14 @@ libbalsa_message_body_get_message_part_stream(LibBalsaMessageBody *body,
     return stream;
 }
 
-
 GMimeStream *
-libbalsa_message_body_get_stream(LibBalsaMessageBody *body,
-                                 GError             **err)
+libbalsa_message_body_get_stream(LibBalsaMessageBody * body, GError **err)
 {
     g_return_val_if_fail(body != NULL, NULL);
     g_return_val_if_fail(body->message != NULL, NULL);
 
     if (!body->message->mailbox) {
-        if ((err != NULL) && (*err == NULL)) {
+        if (err != NULL && *err == NULL) {
             g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                         LIBBALSA_MAILBOX_ACCESS_ERROR,
                         "Internal error in get_stream");
@@ -616,8 +583,8 @@ libbalsa_message_body_get_stream(LibBalsaMessageBody *body,
     }
 
     if (!libbalsa_mailbox_get_message_part(body->message, body, err)
-        || (body->mime_part == NULL)) {
-        if ((err != NULL) && (*err == NULL)) {
+        || body->mime_part == NULL) {
+        if (err != NULL && *err == NULL) {
             g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                         LIBBALSA_MAILBOX_ACCESS_ERROR,
                         "Cannot get stream for part");
@@ -628,12 +595,12 @@ libbalsa_message_body_get_stream(LibBalsaMessageBody *body,
     g_assert(GMIME_PART_GET_CLASS(body->mime_part) != NULL);
     if (!(GMIME_IS_PART(body->mime_part)
           || GMIME_IS_MESSAGE_PART(body->mime_part))) {
-        if ((err != NULL) && (*err == NULL)) {
+        if (err != NULL && *err == NULL) {
             g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                         LIBBALSA_MAILBOX_ACCESS_ERROR,
                         "Cannot get stream for part of type %s",
                         g_type_name(G_TYPE_FROM_INSTANCE
-                                        (body->mime_part)));
+                                    (body->mime_part)));
         }
         return NULL;
     }
@@ -641,18 +608,15 @@ libbalsa_message_body_get_stream(LibBalsaMessageBody *body,
     /* We handle "real" parts and embedded rfc822 messages
        differently. There is probably a way to unify if we use
        GMimeObject common denominator.  */
-    if (GMIME_IS_MESSAGE_PART(body->mime_part)) {
+    if (GMIME_IS_MESSAGE_PART(body->mime_part))
         return libbalsa_message_body_get_message_part_stream(body, err);
-    }
 
     return libbalsa_message_body_get_part_stream(body, err);
 }
 
-
 gssize
-libbalsa_message_body_get_content(LibBalsaMessageBody *body,
-                                  gchar              **buf,
-                                  GError             **err)
+libbalsa_message_body_get_content(LibBalsaMessageBody * body, gchar ** buf,
+                                  GError **err)
 {
     GMimeStream *stream, *stream_mem;
     GByteArray *array;
@@ -664,9 +628,8 @@ libbalsa_message_body_get_content(LibBalsaMessageBody *body,
 
     *buf = NULL;
     stream = libbalsa_message_body_get_stream(body, err);
-    if (!stream) {
+    if (!stream)
         return -1;
-    }
 
     array = g_byte_array_new();
     stream_mem = g_mime_stream_mem_new_with_byte_array(array);
@@ -680,10 +643,10 @@ libbalsa_message_body_get_content(LibBalsaMessageBody *body,
     g_object_unref(stream_mem);
 
     if (len >= 0) {
-        guint8 zero = 0;
+       guint8 zero = 0;
         len = array->len;
-        /* NULL-terminate, in case it is used as a string. */
-        g_byte_array_append(array, &zero, 1);
+       /* NULL-terminate, in case it is used as a string. */
+       g_byte_array_append(array, &zero, 1);
         *buf = (gchar *) g_byte_array_free(array, FALSE);
     } else {
         g_byte_array_free(array, TRUE);
@@ -695,10 +658,8 @@ libbalsa_message_body_get_content(LibBalsaMessageBody *body,
     return len;
 }
 
-
 GdkPixbuf *
-libbalsa_message_body_get_pixbuf(LibBalsaMessageBody *body,
-                                 GError             **err)
+libbalsa_message_body_get_pixbuf(LibBalsaMessageBody * body, GError ** err)
 {
     GMimeStream *stream;
     gchar *mime_type;
@@ -706,9 +667,8 @@ libbalsa_message_body_get_pixbuf(LibBalsaMessageBody *body,
     GdkPixbuf *pixbuf = NULL;
 
     stream = libbalsa_message_body_get_stream(body, err);
-    if (!stream) {
+    if (!stream)
         return pixbuf;
-    }
 
     libbalsa_mailbox_lock_store(body->message->mailbox);
     g_mime_stream_reset(stream);
@@ -732,11 +692,9 @@ libbalsa_message_body_get_pixbuf(LibBalsaMessageBody *body,
         gssize count;
         gchar buf[4096];
 
-        while ((count = g_mime_stream_read(stream, buf, sizeof(buf))) > 0) {
-            if (!gdk_pixbuf_loader_write(loader, (guchar *) buf, count, err)) {
+        while ((count = g_mime_stream_read(stream, buf, sizeof(buf))) > 0)
+            if (!gdk_pixbuf_loader_write(loader, (guchar *) buf, count, err))
                 break;
-            }
-        }
 
         if (!*err && gdk_pixbuf_loader_close(loader, err)) {
             pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
@@ -752,20 +710,17 @@ libbalsa_message_body_get_pixbuf(LibBalsaMessageBody *body,
     return pixbuf;
 }
 
-
 gboolean
-libbalsa_message_body_save_stream(LibBalsaMessageBody *body,
-                                  GMimeStream         *dest,
-                                  gboolean             filter_crlf,
-                                  GError             **err)
+libbalsa_message_body_save_stream(LibBalsaMessageBody * body,
+                                  GMimeStream * dest, gboolean filter_crlf,
+                                  GError ** err)
 {
     GMimeStream *stream;
     ssize_t len;
 
     stream = libbalsa_message_body_get_stream(body, err);
-    if (!body->mime_part) {
+    if (!body->mime_part)
         return FALSE;
-    }
     g_clear_error(err);
 
     libbalsa_mailbox_lock_store(body->message->mailbox);
@@ -781,130 +736,119 @@ libbalsa_message_body_save_stream(LibBalsaMessageBody *body,
 
         len = g_mime_stream_write_to_stream(stream, dest);
         g_object_unref(stream);
-    } else {
+    } else
         /* body->mime_part is neither a GMimePart nor a GMimeMessagePart. */
         len = g_mime_object_write_to_stream(body->mime_part, dest);
-    }
 
     libbalsa_mailbox_unlock_store(body->message->mailbox);
     g_object_unref(dest);
 
-    if (len < 0) {
+    if (len < 0)
         g_set_error(err, LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_ACCESS_ERROR,
                     "Write error in save_stream");
-    }
 
     return len >= 0;
 }
 
-
 gchar *
-libbalsa_message_body_get_mime_type(LibBalsaMessageBody *body)
+libbalsa_message_body_get_mime_type(LibBalsaMessageBody * body)
 {
     gchar *res, *tmp;
 
     g_return_val_if_fail(body != NULL, NULL);
 
-    if (!body->content_type) {
-        return g_strdup("text/plain");
-    }
+    if (!body->content_type)
+       return g_strdup("text/plain");
 
     tmp = strchr(body->content_type, ';');
     res = g_ascii_strdown(body->content_type,
-                          tmp ? tmp - body->content_type : -1);
+                          tmp ? tmp-body->content_type : -1);
     return res;
 }
 
-
 gboolean
-libbalsa_message_body_is_multipart(LibBalsaMessageBody *body)
+libbalsa_message_body_is_multipart(LibBalsaMessageBody * body)
 {
     return body->mime_part ?
-           GMIME_IS_MULTIPART(body->mime_part) :
-           body->body_type == LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART;
+       GMIME_IS_MULTIPART(body->mime_part) :
+       body->body_type == LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART;
 }
 
-
 gboolean
-libbalsa_message_body_is_inline(LibBalsaMessageBody *body)
+libbalsa_message_body_is_inline(LibBalsaMessageBody * body)
 {
     const gchar *disposition;
 
     g_return_val_if_fail(body->mime_part == NULL ||
-                         GMIME_IS_OBJECT(body->mime_part), FALSE);
-
-    if (body->mime_part) {
-        disposition = g_mime_object_get_header(body->mime_part,
-                                               "Content-Disposition");
-    } else {
-        disposition = body->content_dsp;
-    }
-
-    if (!disposition) {
-        /* Default disposition is in-line for text/plain, and generally
-         * attachment for other content types.  Default content type is
-         * text/plain except in multipart/digest, where it is
-         * message/rfc822; in either case, we want to in-line the part.
-         */
+                        GMIME_IS_OBJECT(body->mime_part), FALSE);
+
+    if (body->mime_part)
+       disposition = g_mime_object_get_header(body->mime_part,
+                                              "Content-Disposition");
+    else
+       disposition = body->content_dsp;
+
+    if (!disposition)
+       /* Default disposition is in-line for text/plain, and generally
+        * attachment for other content types.  Default content type is
+        * text/plain except in multipart/digest, where it is
+        * message/rfc822; in either case, we want to in-line the part.
+        */
         return (body->content_type == NULL
                 || g_ascii_strcasecmp(body->content_type,
                                       "message/rfc822") == 0
                 || g_ascii_strcasecmp(body->content_type,
                                       "text/plain") == 0);
-    }
 
     return g_ascii_strncasecmp(disposition,
                                GMIME_DISPOSITION_INLINE,
                                strlen(GMIME_DISPOSITION_INLINE)) == 0;
 }
 
-
 /* libbalsa_message_body_is_flowed:
  * test whether a message body is format=flowed */
 gboolean
-libbalsa_message_body_is_flowed(LibBalsaMessageBody *body)
+libbalsa_message_body_is_flowed(LibBalsaMessageBody * body)
 {
     gchar *content_type;
     gboolean flowed = FALSE;
 
     content_type = libbalsa_message_body_get_mime_type(body);
     if (g_ascii_strcasecmp(content_type, "text/plain") == 0) {
-        gchar *format =
-            libbalsa_message_body_get_parameter(body, "format");
+       gchar *format =
+           libbalsa_message_body_get_parameter(body, "format");
 
-        if (format) {
-            flowed = (g_ascii_strcasecmp(format, "flowed") == 0);
-            g_free(format);
-        }
+       if (format) {
+           flowed = (g_ascii_strcasecmp(format, "flowed") == 0);
+           g_free(format);
+       }
     }
     g_free(content_type);
 
     return flowed;
 }
 
-
 gboolean
-libbalsa_message_body_is_delsp(LibBalsaMessageBody *body)
+libbalsa_message_body_is_delsp(LibBalsaMessageBody * body)
 {
     gboolean delsp = FALSE;
 
     if (libbalsa_message_body_is_flowed(body)) {
-        gchar *delsp_param =
-            libbalsa_message_body_get_parameter(body, "delsp");
+       gchar *delsp_param =
+           libbalsa_message_body_get_parameter(body, "delsp");
 
-        if (delsp_param) {
-            delsp = (g_ascii_strcasecmp(delsp_param, "yes") == 0);
-            g_free(delsp_param);
-        }
+       if (delsp_param) {
+           delsp = (g_ascii_strcasecmp(delsp_param, "yes") == 0);
+           g_free(delsp_param);
+       }
     }
 
     return delsp;
 }
-
-
+    
 LibBalsaMessageBody *
-libbalsa_message_body_get_by_id(LibBalsaMessageBody *body,
-                                const gchar         *id)
+libbalsa_message_body_get_by_id(LibBalsaMessageBody * body,
+                               const gchar * id)
 {
     LibBalsaMessageBody *res;
     gchar *cid;
@@ -912,9 +856,8 @@ libbalsa_message_body_get_by_id(LibBalsaMessageBody *body,
 
     g_return_val_if_fail(id != NULL, NULL);
 
-    if (body == NULL) {
-        return NULL;
-    }
+    if (body == NULL)
+       return NULL;
 
     cid = libbalsa_message_body_get_cid(body);
     matches = (g_strcmp0(id, cid) == 0);
@@ -923,34 +866,29 @@ libbalsa_message_body_get_by_id(LibBalsaMessageBody *body,
         return body;
     }
 
-    if ((res = libbalsa_message_body_get_by_id(body->parts, id)) != NULL) {
-        return res;
-    }
+    if ((res = libbalsa_message_body_get_by_id(body->parts, id)) != NULL)
+       return res;
 
     return libbalsa_message_body_get_by_id(body->next, id);
 }
 
-
 #ifdef HAVE_GPGME
 LibBalsaMsgProtectState
 libbalsa_message_body_protect_state(LibBalsaMessageBody *body)
 {
-    LibBalsaMsgProtectState state;
-
-    if ((body == NULL) || (body->sig_info == NULL) ||
-        (body->sig_info->status == GPG_ERR_NOT_SIGNED) ||
-        (body->sig_info->status == GPG_ERR_CANCELED)) {
-        state = LIBBALSA_MSG_PROTECT_NONE;
-    } else if (body->sig_info->status != GPG_ERR_NO_ERROR) {
-        state = LIBBALSA_MSG_PROTECT_SIGN_BAD;
-    } else if ((body->sig_info->summary & GPGME_SIGSUM_VALID) == GPGME_SIGSUM_VALID) {
-        state = LIBBALSA_MSG_PROTECT_SIGN_GOOD;
-    } else {
-        state = LIBBALSA_MSG_PROTECT_SIGN_NOTRUST;
-    }
-
-    return state;
+       LibBalsaMsgProtectState state;
+
+       if ((body == NULL) || (body->sig_info == NULL) || (body->sig_info->status == GPG_ERR_NOT_SIGNED) ||
+               (body->sig_info->status == GPG_ERR_CANCELED)) {
+               state = LIBBALSA_MSG_PROTECT_NONE;
+       } else if (body->sig_info->status != GPG_ERR_NO_ERROR) {
+               state = LIBBALSA_MSG_PROTECT_SIGN_BAD;
+       } else if ((body->sig_info->summary & GPGME_SIGSUM_VALID) == GPGME_SIGSUM_VALID) {
+               state = LIBBALSA_MSG_PROTECT_SIGN_GOOD;
+       } else {
+               state = LIBBALSA_MSG_PROTECT_SIGN_NOTRUST;
+       }
+
+       return state;
 }
-
-
 #endif
diff --git a/libbalsa/body.h b/libbalsa/body.h
index f52abd3..b33313f 100644
--- a/libbalsa/body.h
+++ b/libbalsa/body.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -22,7 +22,7 @@
 #define __LIBBALSA_BODY_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include <stdio.h>
@@ -35,7 +35,7 @@
 #include "libbalsa-vfs.h"
 
 #ifdef HAVE_GPGME
-#   include "gmime-gpgme-signature.h"
+#include "gmime-gpgme-signature.h"
 #endif
 
 typedef enum _LibBalsaMessageBodyType LibBalsaMessageBodyType;
@@ -64,88 +64,81 @@ enum _LibBalsaAttachMode {
 #define LIBBALSA_MESSAGE_BODY_UNSAFE \
     (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
 struct _LibBalsaMessageBody {
-    LibBalsaMessage *message;   /* The message of which this is a part */
+    LibBalsaMessage *message;  /* The message of which this is a part */
     /* FIXME: remove buffer and buf_len to decrease memory usage. */
-    gchar *buffer;              /* holds raw data of the MIME part, or NULL */
+    gchar *buffer;             /* holds raw data of the MIME part, or NULL */
     gchar *html_buffer;         /* holds the html representation of the part or NULL */
     ssize_t buflen;             /* size of the block */
-    LibBalsaMessageHeaders *embhdrs;  /* headers of a message/rfc822 or text/rfc822-headers part
-                                       */
+    LibBalsaMessageHeaders *embhdrs;  /* headers of a message/rfc822 or text/rfc822-headers part */
     LibBalsaMessageBodyType body_type;
     gchar *content_type;        /* value of the Content-Type header of
                                  * the body including mime type with
                                  * optional parameters. NULL, if text/plain. */
-    const gchar *content_dsp;   /* content-disposition */
+    const gchar *content_dsp;  /* content-disposition */ 
     const gchar *content_id;    /* content-id */
-    gchar *filename;            /* holds filename for attachments and such (used mostly for
-                                   sending) */
-    LibbalsaVfs *file_uri;      /* file uri for attachments (used for sending) */
+    gchar *filename;           /* holds filename for attachments and such (used mostly for sending) */
+    LibbalsaVfs * file_uri;     /* file uri for attachments (used for sending) */
     LibBalsaAttachMode attach_mode; /* attachment mode for sending */
-    gchar *temp_filename;       /* Holds the filename of a the temporary file where this part is
-                                   saved */
-    gchar *charset;             /* the charset, used for sending, replying. */
-    GMimeObject *mime_part;     /* mime body */
+    gchar *temp_filename;      /* Holds the filename of a the temporary file where this part is saved */
+    gchar *charset;            /* the charset, used for sending, replying. */
+    GMimeObject *mime_part;    /* mime body */
 
 #ifdef HAVE_GPGME
     gboolean was_encrypted;
-    GMimeGpgmeSigstat *sig_info;  /* info about a pgp signature body */
+    GMimeGpgmeSigstat* sig_info;  /* info about a pgp signature body */
 #endif
 
-    LibBalsaMessageBody *next;  /* Next part in the message */
-    LibBalsaMessageBody *parts; /* The parts of a multipart or message/rfc822 message */
+    LibBalsaMessageBody *next; /* Next part in the message */
+    LibBalsaMessageBody *parts;        /* The parts of a multipart or message/rfc822 message */
 };
 
-LibBalsaMessageBody *libbalsa_message_body_new(LibBalsaMessage *message);
-void libbalsa_message_body_free(LibBalsaMessageBody *body);
+LibBalsaMessageBody *libbalsa_message_body_new(LibBalsaMessage * message);
+void libbalsa_message_body_free(LibBalsaMessageBody * body);
 
 LibBalsaMessageBodyType libbalsa_message_body_type(LibBalsaMessageBody *
-                                                   body);
-
-void libbalsa_message_body_set_mime_body(LibBalsaMessageBody *body,
-                                         GMimeObject         *mime_part);
-
-GMimeStream *libbalsa_message_body_get_stream(LibBalsaMessageBody *body,
-                                              GError             **err);
-gssize libbalsa_message_body_get_content(LibBalsaMessageBody *body,
-                                         gchar              **buf,
-                                         GError             **err);
-GdkPixbuf *libbalsa_message_body_get_pixbuf(LibBalsaMessageBody *body,
-                                            GError             **err);
-
-gboolean libbalsa_message_body_save_stream(LibBalsaMessageBody *body,
-                                           GMimeStream         *dest,
-                                           gboolean             filter_crlf,
-                                           GError             **err);
-gboolean libbalsa_message_body_save(LibBalsaMessageBody *body,
-                                    const gchar         *filename,
-                                    mode_t               mode,
-                                    gboolean             filter_crlf,
-                                    GError             **err);
-gboolean libbalsa_message_body_save_vfs(LibBalsaMessageBody *body,
-                                        LibbalsaVfs         *dest,
-                                        mode_t               mode,
-                                        gboolean             filter_crlf,
-                                        GError             **err);
-gboolean libbalsa_message_body_save_temporary(LibBalsaMessageBody *body,
-                                              GError             **err);
-
-gchar *libbalsa_message_body_get_parameter(LibBalsaMessageBody *body,
-                                           const gchar         *param);
-gchar *libbalsa_message_body_get_mime_type(LibBalsaMessageBody *body);
-
-gboolean libbalsa_message_body_is_multipart(LibBalsaMessageBody *body);
-gboolean libbalsa_message_body_is_inline(LibBalsaMessageBody *body);
-gboolean libbalsa_message_body_is_flowed(LibBalsaMessageBody *body);
-gboolean libbalsa_message_body_is_delsp(LibBalsaMessageBody *body);
+                                                  body);
+
+void libbalsa_message_body_set_mime_body(LibBalsaMessageBody * body,
+                                        GMimeObject * mime_part);
+
+GMimeStream *libbalsa_message_body_get_stream(LibBalsaMessageBody * body,
+                                              GError **err);
+gssize libbalsa_message_body_get_content(LibBalsaMessageBody * body,
+                                         gchar ** buf, GError **err);
+GdkPixbuf *libbalsa_message_body_get_pixbuf(LibBalsaMessageBody * body,
+                                            GError ** err);
+
+gboolean libbalsa_message_body_save_stream(LibBalsaMessageBody * body,
+                                           GMimeStream * dest,
+                                           gboolean filter_crlf,
+                                           GError **err);
+gboolean libbalsa_message_body_save(LibBalsaMessageBody * body,
+                                    const gchar * filename, mode_t mode,
+                                    gboolean filter_crlf, GError **err);
+gboolean libbalsa_message_body_save_vfs(LibBalsaMessageBody * body,
+                                        LibbalsaVfs * dest,
+                                        mode_t mode,
+                                        gboolean filter_crlf,
+                                        GError **err);
+gboolean libbalsa_message_body_save_temporary(LibBalsaMessageBody * body,
+                                              GError **err);
+
+gchar *libbalsa_message_body_get_parameter(LibBalsaMessageBody * body,
+                                          const gchar * param);
+gchar *libbalsa_message_body_get_mime_type(LibBalsaMessageBody * body);
+
+gboolean libbalsa_message_body_is_multipart(LibBalsaMessageBody * body);
+gboolean libbalsa_message_body_is_inline(LibBalsaMessageBody* body);
+gboolean libbalsa_message_body_is_flowed(LibBalsaMessageBody * body);
+gboolean libbalsa_message_body_is_delsp(LibBalsaMessageBody * body);
 
 LibBalsaMessageBody *libbalsa_message_body_get_by_id(LibBalsaMessageBody *
                                                      body,
-                                                     const gchar *id);
+                                                     const gchar * id);
 
 #ifdef HAVE_GPGME
 LibBalsaMsgProtectState libbalsa_message_body_protect_state(LibBalsaMessageBody *body);
-
 #endif
 
 
-#endif                          /* __LIBBALSA_BODY_H__ */
+#endif                         /* __LIBBALSA_BODY_H__ */
diff --git a/libbalsa/completion.c b/libbalsa/completion.c
index 308d17e..840a320 100644
--- a/libbalsa/completion.c
+++ b/libbalsa/completion.c
@@ -152,7 +152,6 @@ libbalsa_completion_new(LibBalsaCompletionFunc func)
     return gcomp;
 }
 
-
 /**
  * libbalsa_completion_add_items:
  * @cmp: the #LibBalsaCompletion.
@@ -161,8 +160,8 @@ libbalsa_completion_new(LibBalsaCompletionFunc func)
  * Adds items to the #LibBalsaCompletion.
  **/
 void
-libbalsa_completion_add_items(LibBalsaCompletion *cmp,
-                              GList              *items)
+libbalsa_completion_add_items(LibBalsaCompletion * cmp,
+                              GList              * items)
 {
     GList *it;
 
@@ -177,7 +176,6 @@ libbalsa_completion_add_items(LibBalsaCompletion *cmp,
     }
 }
 
-
 /**
  * libbalsa_completion_clear_items:
  * @cmp: the #LibBalsaCompletion.
@@ -185,7 +183,7 @@ libbalsa_completion_add_items(LibBalsaCompletion *cmp,
  * Removes all items from the #LibBalsaCompletion.
  **/
 void
-libbalsa_completion_clear_items(LibBalsaCompletion *cmp)
+libbalsa_completion_clear_items(LibBalsaCompletion * cmp)
 {
     g_return_if_fail(cmp != NULL);
 
@@ -194,7 +192,6 @@ libbalsa_completion_clear_items(LibBalsaCompletion *cmp)
     g_clear_pointer(&cmp->prefix, (GDestroyNotify) g_free);
 }
 
-
 /**
  * libbalsa_completion_complete:
  * @cmp: the #LibBalsaCompletion.
@@ -207,8 +204,8 @@ libbalsa_completion_clear_items(LibBalsaCompletion *cmp)
  * target items.
  **/
 GList *
-libbalsa_completion_complete(LibBalsaCompletion *cmp,
-                             const gchar        *prefix)
+libbalsa_completion_complete(LibBalsaCompletion * cmp,
+                             const gchar        * prefix)
 {
     gsize plen, len;
     gboolean done = FALSE;
@@ -220,7 +217,7 @@ libbalsa_completion_complete(LibBalsaCompletion *cmp,
     len = strlen(prefix);
     if (cmp->prefix && cmp->cache) {
         plen = strlen(cmp->prefix);
-        if ((plen <= len) && !cmp->strncmp_func(prefix, cmp->prefix, plen)) {
+        if (plen <= len && !cmp->strncmp_func(prefix, cmp->prefix, plen)) {
             /* use the cache */
             list = cmp->cache;
             while (list) {
@@ -230,9 +227,8 @@ libbalsa_completion_complete(LibBalsaCompletion *cmp,
                                       cmp->func ? cmp->func(list->
                                                             data) : (gchar
                                                                      *)
-                                      list->data, len)) {
+                                      list->data, len))
                     cmp->cache = g_list_delete_link(cmp->cache, list);
-                }
 
                 list = next;
             }
@@ -246,21 +242,19 @@ libbalsa_completion_complete(LibBalsaCompletion *cmp,
         for (list = cmp->items; list != NULL && *prefix != '\0'; list = list->next) {
             if (cmp->strncmp_func(prefix,
                                   cmp->func ? cmp->func(list->data)
-                                  : (gchar *) list->data,
+                                            : (gchar *) list->data,
                                   len) == 0) {
                 cmp->cache = g_list_prepend(cmp->cache, list->data);
             }
         }
     }
     g_clear_pointer(&cmp->prefix, (GDestroyNotify) g_free);
-    if (cmp->cache != NULL) {
+    if (cmp->cache != NULL)
         cmp->prefix = g_strdup(prefix);
-    }
 
     return *prefix != '\0' ? cmp->cache : cmp->items;
 }
 
-
 /**
  * libbalsa_completion_free:
  * @cmp: the #LibBalsaCompletion.
@@ -268,7 +262,7 @@ libbalsa_completion_complete(LibBalsaCompletion *cmp,
  * Frees all memory used by the #LibBalsaCompletion.
  **/
 void
-libbalsa_completion_free(LibBalsaCompletion *cmp)
+libbalsa_completion_free(LibBalsaCompletion * cmp)
 {
     g_return_if_fail(cmp != NULL);
 
@@ -276,7 +270,6 @@ libbalsa_completion_free(LibBalsaCompletion *cmp)
     g_free(cmp);
 }
 
-
 /**
  * libbalsa_completion_set_compare:
  * @cmp: a #LibBalsaCompletion.
@@ -286,11 +279,10 @@ libbalsa_completion_free(LibBalsaCompletion *cmp)
  * comparison function is strncmp().
  **/
 void
-libbalsa_completion_set_compare(LibBalsaCompletion           *cmp,
+libbalsa_completion_set_compare(LibBalsaCompletion          * cmp,
                                 LibBalsaCompletionStrncmpFunc strncmp_func)
 {
     cmp->strncmp_func = strncmp_func;
 }
 
-
 #define __G_COMPLETION_C__
diff --git a/libbalsa/completion.h b/libbalsa/completion.h
index 493ab2b..46082ba 100644
--- a/libbalsa/completion.h
+++ b/libbalsa/completion.h
@@ -58,33 +58,39 @@ typedef gchar *(*LibBalsaCompletionFunc) (gpointer);
 /* LibBalsaCompletion
  */
 
-typedef gint (*LibBalsaCompletionStrncmpFunc) (const gchar *s1,
-                                               const gchar *s2,
-                                               gsize        n);
+typedef gint (*LibBalsaCompletionStrncmpFunc) (const gchar * s1,
+                                               const gchar * s2,
+                                               gsize         n);
 
 struct _LibBalsaCompletion {
-    GList *items;
-    LibBalsaCompletionFunc func;
+    GList                        *items;
+    LibBalsaCompletionFunc        func;
 
-    gchar *prefix;
-    GList *cache;
+    gchar                        *prefix;
+    GList                        *cache;
     LibBalsaCompletionStrncmpFunc strncmp_func;
 };
 
-LibBalsaCompletion *libbalsa_completion_new(LibBalsaCompletionFunc func);
+LibBalsaCompletion *
+libbalsa_completion_new          (LibBalsaCompletionFunc func);
 
-void libbalsa_completion_add_items(LibBalsaCompletion *cmp,
-                                   GList              *items);
+void
+libbalsa_completion_add_items    (LibBalsaCompletion * cmp,
+                                  GList              * items);
 
-void libbalsa_completion_clear_items(LibBalsaCompletion *cmp);
+void
+libbalsa_completion_clear_items  (LibBalsaCompletion * cmp);
 
-GList *libbalsa_completion_complete(LibBalsaCompletion *cmp,
-                                    const gchar        *prefix);
+GList *
+libbalsa_completion_complete     (LibBalsaCompletion * cmp,
+                                  const gchar        * prefix);
 
-void libbalsa_completion_set_compare(LibBalsaCompletion *cmp,
-                                     LibBalsaCompletionStrncmpFunc
-                                     strncmp_func);
+void
+libbalsa_completion_set_compare  (LibBalsaCompletion * cmp,
+                                  LibBalsaCompletionStrncmpFunc
+                                                       strncmp_func);
 
-void libbalsa_completion_free(LibBalsaCompletion *cmp);
+void
+libbalsa_completion_free         (LibBalsaCompletion * cmp);
 
 G_END_DECLS
diff --git a/libbalsa/files.c b/libbalsa/files.c
index ffe5b64..88715d7 100644
--- a/libbalsa/files.c
+++ b/libbalsa/files.c
@@ -6,20 +6,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "files.h"
 
@@ -43,32 +43,29 @@ static const gchar *permanent_prefixes[] = {
  * We ignore proper slashing of names. Ie, /prefix//splice//file won't be caught.
  */
 gchar *
-balsa_file_finder(const gchar *filename,
-                  const gchar *splice)
+balsa_file_finder(const gchar  * filename,
+                  const gchar  * splice)
 {
     gchar *cat;
     guint i;
 
     g_return_val_if_fail(filename, NULL);
 
-    if (splice == NULL) {
-        splice = "";
-    }
+    if (splice == NULL)
+       splice = "";
 
     for (i = 0; i < G_N_ELEMENTS(permanent_prefixes); i++) {
-        cat = g_build_filename(permanent_prefixes[i], splice, filename, NULL);
+       cat = g_build_filename(permanent_prefixes[i], splice, filename, NULL);
 
-        if (g_file_test(cat, G_FILE_TEST_IS_REGULAR)) {
-            return cat;
-        }
+       if (g_file_test(cat, G_FILE_TEST_IS_REGULAR))
+           return cat;
 
-        g_free(cat);
+       g_free(cat);
     }
 
     cat = g_build_filename("images", filename, NULL);
-    if (g_file_test(cat, G_FILE_TEST_IS_REGULAR)) {
+    if (g_file_test(cat, G_FILE_TEST_IS_REGULAR))
         return cat;
-    }
     g_free(cat);
 
     g_warning("Cannot find expected file “%s” (spliced with “%s”)", filename, splice);
@@ -86,9 +83,8 @@ libbalsa_default_attachment_pixbuf(gint size)
     icon = balsa_pixmap_finder ("attachment.png");
     tmp = gdk_pixbuf_new_from_file(icon, NULL);
     g_free(icon);
-    if (!tmp) {
+    if (!tmp)
         return NULL;
-    }
 
     retval = gdk_pixbuf_scale_simple(tmp, size, size, GDK_INTERP_BILINEAR);
     g_object_unref(tmp);
@@ -105,36 +101,34 @@ libbalsa_default_attachment_pixbuf(gint size)
  *   return the complete path to the icon file.
  */
 GdkPixbuf *
-libbalsa_icon_finder(GtkWidget         *widget,
-                     const char        *mime_type,
-                     const LibbalsaVfs *for_file,
-                     gchar            **used_type,
-                     gint               width)
+libbalsa_icon_finder(GtkWidget         * widget,
+                     const char        * mime_type,
+                     const LibbalsaVfs * for_file,
+                     gchar            ** used_type,
+                     gint                width)
 {
     const gchar *content_type;
     GdkPixbuf *pixbuf = NULL;
     GtkIconTheme *icon_theme;
     GIcon *icon;
 
-    if (mime_type) {
+    if (mime_type)
         content_type = mime_type;
-    } else if (for_file) {
+    else if (for_file) {
         content_type = libbalsa_vfs_get_mime_type(for_file);
-    } else {
+    } else
         content_type = "application/octet-stream";
-    }
 
     /* ask GIO for the icon */
-    if ((icon_theme = gtk_icon_theme_get_default()) == NULL) {
+    if ((icon_theme = gtk_icon_theme_get_default()) == NULL)
         return NULL;
-    }
 
     icon = g_content_type_get_icon(content_type);
 
     if (icon != NULL) {
         if (G_IS_THEMED_ICON(icon)) {
             gint i;
-            const gchar *const *icon_names;
+            const gchar * const *icon_names;
 
             icon_names = g_themed_icon_get_names((GThemedIcon *) icon);
 
@@ -154,9 +148,8 @@ libbalsa_icon_finder(GtkWidget         *widget,
         pixbuf = libbalsa_default_attachment_pixbuf(width);
     }
 
-    if (used_type) {
+    if (used_type)
         *used_type = g_strdup(content_type);
-    }
 
     return pixbuf;
 }
diff --git a/libbalsa/files.h b/libbalsa/files.h
index 858db2f..dc93135 100644
--- a/libbalsa/files.h
+++ b/libbalsa/files.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -29,21 +29,20 @@
 
 /* filename is the filename (naw!)
  * splice is what to put in between the prefix and the filename, if desired
- * prefixes is a null-termed array of strings of prefixes to try. There are defaults that are
- * always
+ * prefixes is a null-termed array of strings of prefixes to try. There are defaults that are always
  *   tried.
  * We ignore proper slashing of names. Ie, /prefix//splice//file won't be caught.
  */
 
-gchar *balsa_file_finder(const gchar *filename,
-                         const gchar *splice);
+gchar *balsa_file_finder(const gchar  * filename,
+                         const gchar  * splice);
 
 #define balsa_pixmap_finder(filename) (balsa_file_finder((filename), "pixmaps"))
 
-GdkPixbuf *libbalsa_icon_finder(GtkWidget         *widget,
-                                const char        *mime_type,
-                                const LibbalsaVfs *for_file,
-                                gchar            **used_type,
-                                gint               width);
+GdkPixbuf *libbalsa_icon_finder(GtkWidget         * widget,
+                                const char        * mime_type,
+                                const LibbalsaVfs * for_file,
+                                gchar            ** used_type,
+                                gint                width);
 
 #endif
diff --git a/libbalsa/filter-error.c b/libbalsa/filter-error.c
index 715ad6f..3696318 100644
--- a/libbalsa/filter-error.c
+++ b/libbalsa/filter-error.c
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -24,15 +24,14 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include "filter.h"
 #include <glib/gi18n.h>
 
 /*
- * Error reporting use this global gint. All function that positions it will destroy previous
- * error, so
+ * Error reporting use this global gint. All function that positions it will destroy previous error, so
  * be sure to check it after each function in which error can occur.
  */
 
@@ -57,7 +56,7 @@ gchar *filter_errlist[] = {
  * Returns a pointer to the appropriate string in filter_errlist
  * based on the errnum passed.  It corrects the sign of the integer
  * if need be.
- *
+ * 
  * Arguments:
  *    gint filter_errno - the error number for which a string is requested
  *
@@ -68,7 +67,7 @@ gchar *
 filter_strerror(gint error)
 {
     return _(filter_errlist[(error > 0) ? error : -error]);
-}                               /* end filter_strerror() */
+}                              /* end filter_strerror() */
 
 
 /*
@@ -81,10 +80,10 @@ filter_strerror(gint error)
  *    gchar *s - string to be prepended to the error message.
  */
 void
-filter_perror(const gchar *s)
+filter_perror(const gchar * s)
 {
     gchar *error_string;
 
     error_string = filter_strerror(filter_errno);
-    g_warning("%s: %s\n", s, error_string);
-}                               /* end filter_perror */
+    g_warning("%s: %s\n", s,error_string);
+}                              /* end filter_perror */
diff --git a/libbalsa/filter-file.c b/libbalsa/filter-file.c
index e77457c..d0c874e 100644
--- a/libbalsa/filter-file.c
+++ b/libbalsa/filter-file.c
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -26,7 +26,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "filter-file.h"
 
@@ -47,33 +47,32 @@
  * filter_errno.
  */
 
-LibBalsaFilter *
+LibBalsaFilter*
 libbalsa_filter_new_from_config(void)
 {
-    LibBalsaFilter *newf = libbalsa_filter_new();
+    LibBalsaFilter * newf = libbalsa_filter_new();
     gchar *str, *p;
     /* First we load the fixed part of the filter */
-    newf->name = libbalsa_conf_get_string("Name");
-    p = str = libbalsa_conf_get_string("Condition");
-    newf->sound = libbalsa_conf_get_string("Sound");
-    newf->popup_text = libbalsa_conf_get_string("Popup-text");
-    newf->action = libbalsa_conf_get_int("Action-type");
+    newf->name          = libbalsa_conf_get_string("Name");
+    p = str             = libbalsa_conf_get_string("Condition");
+    newf->sound         = libbalsa_conf_get_string("Sound");
+    newf->popup_text    = libbalsa_conf_get_string("Popup-text");
+    newf->action        = libbalsa_conf_get_int("Action-type");
     newf->action_string = libbalsa_conf_get_string("Action-string");
-    newf->condition = libbalsa_condition_new_from_string(&p);
+    newf->condition     = libbalsa_condition_new_from_string(&p);
     g_free(str);
-    if (newf->sound[0] == '\0') {
-        g_free(newf->sound);
-        newf->sound = NULL;
+    if (newf->sound[0]=='\0') {
+       g_free(newf->sound);
+       newf->sound=NULL;
     }
-    if (newf->popup_text[0] == '\0') {
-        g_free(newf->popup_text);
-        newf->popup_text = NULL;
+    if (newf->popup_text[0]=='\0') {
+       g_free(newf->popup_text);
+       newf->popup_text=NULL;
     }
 
     return newf;
 }
 
-
 /*
  * libbalsa_conditions_save_config saves a list of conditions using
  * prefix and filter_section_name to create the name of the section We
@@ -91,123 +90,117 @@ libbalsa_filter_new_from_config(void)
  */
 
 void
-libbalsa_filter_save_config(LibBalsaFilter *fil)
+libbalsa_filter_save_config(LibBalsaFilter * fil)
 {
     gchar *str = libbalsa_condition_to_string(fil->condition);
-    libbalsa_conf_set_string("Name", fil->name);
-    libbalsa_conf_set_string("Condition", str);
-    libbalsa_conf_set_string("Sound", fil->sound);
-    libbalsa_conf_set_string("Popup-text", fil->popup_text);
-    libbalsa_conf_set_int("Action-type", fil->action);
+    libbalsa_conf_set_string("Name",          fil->name);
+    libbalsa_conf_set_string("Condition",     str);
+    libbalsa_conf_set_string("Sound",         fil->sound);
+    libbalsa_conf_set_string("Popup-text",    fil->popup_text);
+    libbalsa_conf_set_int("Action-type",      fil->action);
     libbalsa_conf_set_string("Action-string", fil->action_string);
     g_free(str);
 }
 
-
 /* Loads the filters associated to the mailbox
  * Note : does not clean current filters list (normally the caller did it)
  * Position filter_errno
  */
 
 void
-libbalsa_mailbox_filters_load_config(LibBalsaMailbox *mbox)
+libbalsa_mailbox_filters_load_config(LibBalsaMailbox* mbox)
 {
-    gint i, nb_filters;
-    gchar **filters_names = NULL;
-    LibBalsaFilter *fil;
+    gint i,nb_filters;
+    gchar **filters_names=NULL;
+    LibBalsaFilter* fil;
     gboolean def;
-    GSList *lst;
+    GSList * lst;
 
     /* We load the associated filters */
-    libbalsa_conf_get_vector_with_default(MAILBOX_FILTERS_KEY, &nb_filters,
-                                          &filters_names, &def);
+    libbalsa_conf_get_vector_with_default(MAILBOX_FILTERS_KEY,&nb_filters,
+                                        &filters_names,&def);
     if (!def) {
-        for (i = 0; i < nb_filters; i++) {
-            fil = libbalsa_filter_get_by_name(filters_names[i]);
-            if (fil) {
-                LibBalsaMailboxFilter *mf = g_new(LibBalsaMailboxFilter, 1);
-
-                mf->actual_filter = fil;
-                mbox->filters = g_slist_prepend(mbox->filters, mf);
-            } else {
-                libbalsa_information(LIBBALSA_INFORMATION_WARNING,
-                                     _("Invalid filters %s for mailbox %s"),
+       for(i=0;i<nb_filters;i++) {
+           fil = libbalsa_filter_get_by_name(filters_names[i]);
+           if (fil) {
+               LibBalsaMailboxFilter* mf = g_new(LibBalsaMailboxFilter,1);
+
+               mf->actual_filter = fil;
+               mbox->filters=g_slist_prepend(mbox->filters, mf);
+           }
+           else
+               libbalsa_information(LIBBALSA_INFORMATION_WARNING,
+                                    _("Invalid filters %s for mailbox %s"),
                                      filters_names[i], mbox->name);
-            }
-        }
-        mbox->filters = g_slist_reverse(mbox->filters);
+       }
+       mbox->filters=g_slist_reverse(mbox->filters);
     }
     g_strfreev(filters_names);
     if (!def) {
-        libbalsa_conf_get_vector_with_default(MAILBOX_FILTERS_WHEN_KEY,
-                                              &nb_filters, &filters_names, &def);
-        if (def) {
-            for (lst = mbox->filters; lst != NULL; lst = lst->next) {
-                FILTER_WHEN_SETFLAG((LibBalsaMailboxFilter *)lst->data,
-                                    FILTER_WHEN_NEVER);
-            }
-        } else {
-            lst = mbox->filters;
-            for (i = 0; i < nb_filters && lst != NULL; i++) {
-                ((LibBalsaMailboxFilter *)lst->data)->when =
+       libbalsa_conf_get_vector_with_default(MAILBOX_FILTERS_WHEN_KEY,
+                                             &nb_filters,&filters_names,&def);
+       if (def)
+           for(lst = mbox->filters; lst != NULL; lst = lst->next)
+               FILTER_WHEN_SETFLAG((LibBalsaMailboxFilter*)lst->data,
+                                   FILTER_WHEN_NEVER);
+       else {
+           lst=mbox->filters;
+           for (i=0;i<nb_filters && lst != NULL;i++) {
+               ((LibBalsaMailboxFilter*)lst->data)->when =
                     atoi(filters_names[i]);
-                lst = lst->next;
-            }
-        }
-        g_strfreev(filters_names);
+               lst = lst->next;
+           }
+       }
+       g_strfreev(filters_names);
     }
-    filter_errno = FILTER_NOERR;
+    filter_errno=FILTER_NOERR;
 }
 
-
 /* Saves the filters associated to the mailbox
  */
 
 void
-libbalsa_mailbox_filters_save_config(LibBalsaMailbox *mbox)
+libbalsa_mailbox_filters_save_config(LibBalsaMailbox * mbox)
 {
-    gint i, nb_filters = 0;
-    gchar **filters_names;
-    GSList *fil, *names = NULL, *lst;
+    gint i,nb_filters=0;
+    gchar ** filters_names;
+    GSList * fil,* names=NULL,* lst;
 
     /* First we construct a list containing the names of associated filters
-     * Note : in all the following we never copy the filters name, so we don't have to (and me
-     * must not!) free any gchar *
+     * Note : in all the following we never copy the filters name, so we don't have to (and me must not!) 
free any gchar *
      * That's why we only free g_slist and gchar **
      */
     for (fil = mbox->filters; fil != NULL; fil = fil->next) {
-        names = g_slist_prepend(names,
-                                ((LibBalsaMailboxFilter *)fil->data)->actual_filter->name);
-        nb_filters++;
+       names=g_slist_prepend(names,
+                              ((LibBalsaMailboxFilter*)fil->data)->actual_filter->name);
+       nb_filters++;
     }
-    names = g_slist_reverse(names);
+    names=g_slist_reverse(names);
     /* Second we construct the vector of gchar * */
-    filters_names = g_new(gchar *, nb_filters);
-    lst = names;
-    for (i = 0; i < nb_filters; i++) {
-        filters_names[i] = (gchar *)lst->data;
-        lst = lst->next;
+    filters_names=g_new(gchar *,nb_filters);
+    lst=names;
+    for(i=0; i<nb_filters; i++) {
+       filters_names[i]=(gchar*)lst->data;
+       lst = lst->next;
     }
     g_slist_free(names);
-    libbalsa_conf_set_vector(MAILBOX_FILTERS_KEY, nb_filters,
-                             (const gchar **)filters_names);
+    libbalsa_conf_set_vector(MAILBOX_FILTERS_KEY,nb_filters,
+                            (const gchar**)filters_names);
 
-    fil = mbox->filters;
-    for (i = 0; i < nb_filters; i++) {
-        filters_names[i] =
+    fil=mbox->filters;
+    for (i=0;i<nb_filters;i++) {
+       filters_names[i]=
             g_strdup_printf("%d",
-                            ((LibBalsaMailboxFilter *)fil->data)->when);
-        fil = fil->next;
-    }
-    libbalsa_conf_set_vector(MAILBOX_FILTERS_WHEN_KEY, nb_filters,
-                             (const gchar **)filters_names);
-    for (i = 0; i < nb_filters; i++) {
-        g_free(filters_names[i]);
+                            ((LibBalsaMailboxFilter*)fil->data)->when);
+       fil = fil->next;
     }
+    libbalsa_conf_set_vector(MAILBOX_FILTERS_WHEN_KEY,nb_filters,
+                            (const gchar**)filters_names);
+    for (i=0;i<nb_filters;i++)
+       g_free(filters_names[i]);
     g_free(filters_names);
 }
 
-
 /* Temporary code for transition from 2.0.x */
 static LibBalsaCondition *
 libbalsa_condition_new_from_config()
@@ -230,72 +223,65 @@ libbalsa_condition_new_from_config()
 
     switch (newc->type) {
     case CONDITION_STRING:
-        newc->match.string.fields = fields;
-        newc->match.string.string =
-            libbalsa_conf_get_string("Match-string");
-        newc->match.string.user_header =
-            CONDITION_CHKMATCH(newc, CONDITION_MATCH_US_HEAD) ?
-            libbalsa_conf_get_string("User-header") : NULL;
-        break;
-
+       newc->match.string.fields = fields;
+       newc->match.string.string =
+           libbalsa_conf_get_string("Match-string");
+       newc->match.string.user_header =
+           CONDITION_CHKMATCH(newc, CONDITION_MATCH_US_HEAD) ?
+           libbalsa_conf_get_string("User-header") : NULL;
+       break;
     case CONDITION_REGEX:
-        newc->match.regex.fields = fields;
+       newc->match.regex.fields = fields;
 #if 0
-        libbalsa_conf_get_vector("Reg-exps", &nbregexs, &regexs);
-        for (i = 0; i < nbregexs && (filter_errno == FILTER_NOERR); i++) {
-            newreg = g_new(LibBalsaConditionRegex, 1);
-            newreg->string = regexs[i];
-            newreg->compiled = NULL;
-            newc->match.regexs =
-                g_slist_prepend(newc->match.regexs, newreg);
-        }
-        newc->match.regexs = g_slist_reverse(newc->match.regexs);
-        /* Free the array of (gchar*)'s, but not the strings pointed by them */
-        g_free(regexs);
+       libbalsa_conf_get_vector("Reg-exps", &nbregexs, &regexs);
+       for (i = 0; i < nbregexs && (filter_errno == FILTER_NOERR); i++) {
+           newreg = g_new(LibBalsaConditionRegex, 1);
+           newreg->string = regexs[i];
+           newreg->compiled = NULL;
+           newc->match.regexs =
+               g_slist_prepend(newc->match.regexs, newreg);
+       }
+       newc->match.regexs = g_slist_reverse(newc->match.regexs);
+       /* Free the array of (gchar*)'s, but not the strings pointed by them */
+       g_free(regexs);
 #endif
-        break;
-
+       break;
     case CONDITION_DATE:
-        str = libbalsa_conf_get_string("Low-date");
-        if (str[0] == '\0') {
-            newc->match.date.date_low = 0;
-        } else {
-            (void) strptime("00:00:00", "%T", &date);
-            p = (gchar *) strptime(str, "%Y-%m-%d", &date);
-            if (!p || (*p != '\0')) {
-                filter_errno = FILTER_EFILESYN;
-            } else {
-                newc->match.date.date_low = mktime(&date);
-            }
-        }
-        g_free(str);
-        str = libbalsa_conf_get_string("High-date");
-        if (str[0] == '\0') {
-            newc->match.date.date_high = 0;
-        } else {
-            (void) strptime("23:59:59", "%T", &date);
-            p = (gchar *) strptime(str, "%Y-%m-%d", &date);
-            if (!p || (*p != '\0')) {
-                filter_errno = FILTER_EFILESYN;
-            } else {
-                newc->match.date.date_high = mktime(&date);
-            }
-        }
-        g_free(str);
-        break;
-
+       str = libbalsa_conf_get_string("Low-date");
+       if (str[0] == '\0')
+           newc->match.date.date_low = 0;
+       else {
+           (void) strptime("00:00:00", "%T", &date);
+           p = (gchar *) strptime(str, "%Y-%m-%d", &date);
+           if (!p || *p != '\0')
+               filter_errno = FILTER_EFILESYN;
+           else
+               newc->match.date.date_low = mktime(&date);
+       }
+       g_free(str);
+       str = libbalsa_conf_get_string("High-date");
+       if (str[0] == '\0')
+           newc->match.date.date_high = 0;
+       else {
+           (void) strptime("23:59:59", "%T", &date);
+           p = (gchar *) strptime(str, "%Y-%m-%d", &date);
+           if (!p || *p != '\0')
+               filter_errno = FILTER_EFILESYN;
+           else
+               newc->match.date.date_high = mktime(&date);
+       }
+       g_free(str);
+       break;
     case CONDITION_FLAG:
-        newc->match.flags = libbalsa_conf_get_int("Flags");
-        break;
-
+       newc->match.flags = libbalsa_conf_get_int("Flags");
+       break;
     default:
-        filter_errno = FILTER_EFILESYN;
+       filter_errno = FILTER_EFILESYN;
     }
 
     return newc;
 }
 
-
 /* Load a list of conditions using prefix and filter_section_name to locate
  * the section in config file
  * Will correctly set filter flags
@@ -311,15 +297,13 @@ typedef struct {
 } LibBalsaTempCondition;
 
 static gint
-compare_conditions_order(gconstpointer a,
-                         gconstpointer b)
+compare_conditions_order(gconstpointer a, gconstpointer b)
 {
     const LibBalsaTempCondition *t1 = a;
     const LibBalsaTempCondition *t2 = b;
     return t2->order - t1->order;
 }
 
-
 #define CONDITION_SECTION_PREFIX "condition-"
 
 struct lbc_new_info {
@@ -328,9 +312,7 @@ struct lbc_new_info {
 };
 
 static gboolean
-lbc_new_helper(const gchar *key,
-               const gchar *value,
-               gpointer     data)
+lbc_new_helper(const gchar * key, const gchar * value, gpointer data)
 {
     struct lbc_new_info *info = data;
     LibBalsaCondition *cond;
@@ -362,9 +344,8 @@ lbc_new_helper(const gchar *key,
     return filter_errno != FILTER_NOERR;
 }
 
-
 LibBalsaCondition *
-libbalsa_condition_new_2_0(const gchar       *filter_section_name,
+libbalsa_condition_new_2_0(const gchar * filter_section_name,
                            ConditionMatchType cmt)
 {
     struct lbc_new_info info;
@@ -391,7 +372,7 @@ libbalsa_condition_new_2_0(const gchar       *filter_section_name,
         for (l = info.tmp_list; l != NULL; l = l->next) {
             LibBalsaTempCondition *tmp =
                 (LibBalsaTempCondition *) (l->data);
-            LibBalsaCondition *res =
+            LibBalsaCondition *res = 
                 libbalsa_condition_new_bool_ptr(FALSE, cmt, tmp->cnd,
                                                 cond_2_0);
             libbalsa_condition_unref(tmp->cnd);
diff --git a/libbalsa/filter-file.h b/libbalsa/filter-file.h
index 10bfd47..cef87d6 100644
--- a/libbalsa/filter-file.h
+++ b/libbalsa/filter-file.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -35,29 +35,28 @@
 
 /* Load conditions list using filter_section_name as prefix to find sections */
 
-void libbalsa_conditions_new_from_config(gchar          *prefix,
-                                         gchar          *filter_section_name,
-                                         LibBalsaFilter *fil);
+void libbalsa_conditions_new_from_config(gchar* prefix,
+                                         gchar * filter_section_name,
+                                         LibBalsaFilter* fil);
 
 /* Save conditions list using filter_section_name as prefix to create
  * sections. */
 
-void libbalsa_clean_condition_sections(const gchar *prefix,
-                                       const gchar *filter_section_name);
+void libbalsa_clean_condition_sections(const gchar * prefix,
+                                      const gchar * filter_section_name);
 
-void libbalsa_conditions_save_config(GSList      *conds,
-                                     const gchar *prefix,
-                                     const gchar *filter_section_name);
+void libbalsa_conditions_save_config(GSList * conds,const gchar * prefix,
+                                     const gchar * filter_section_name);
 
-void libbalsa_filter_save_config(LibBalsaFilter *f);
+void libbalsa_filter_save_config(LibBalsaFilter * f);
 
 /* libbalsa_filter_new_from_config can position filter_errno on error */
-LibBalsaFilter *libbalsa_filter_new_from_config(void);
+LibBalsaFilter* libbalsa_filter_new_from_config(void);
 
 /* Loads the filters associated to the mailbox */
-void libbalsa_mailbox_filters_load_config(LibBalsaMailbox *mbox);
+void libbalsa_mailbox_filters_load_config(LibBalsaMailbox * mbox);
 
 /* Saves the filters associated to the mailbox */
-void libbalsa_mailbox_filters_save_config(LibBalsaMailbox *mbox);
+void libbalsa_mailbox_filters_save_config(LibBalsaMailbox * mbox);
 
 #endif  /* __FILTER_FILE_H__ */
diff --git a/libbalsa/filter-funcs.c b/libbalsa/filter-funcs.c
index a6b3c5d..64541a6 100644
--- a/libbalsa/filter-funcs.c
+++ b/libbalsa/filter-funcs.c
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -23,7 +23,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <glib/gi18n.h>
@@ -39,158 +39,132 @@
 
 /* Conditions */
 
-static gchar *
+static gchar*
 get_quoted_string(gchar **pstr)
 {
     gchar *str = *pstr;
     GString *res = g_string_new("");
-    if (*str == '"') {
-        while (*++str && *str != '"') {
-            if (*str == '\\') {
-                str++;
-            }
+    if(*str == '"') {
+        while(*++str && *str != '"') {
+            if(*str == '\\') str++;
             g_string_append_c(res, *str);
         }
-        if (*str == '"') {
-            ++str;
-        }
+       if(*str == '"')
+         ++str;
     } else {
-        while (*++str && !isspace((int)*str)) {
+        while(*++str && !isspace((int)*str))
             g_string_append_c(res, *str);
-        }
     }
     *pstr = str;
     return g_string_free(res, FALSE);
 }
 
-
 static void
-append_quoted_string(GString    *res,
-                     const char *str)
+append_quoted_string(GString *res, const char *str)
 {
     g_string_append_c(res, '"');
-    while (*str) {
-        if ((*str == '"') || (*str == '\\')) {
+    while(*str) {
+        if(*str == '"' || *str == '\\')
             g_string_append_c(res, '\\');
-        }
         g_string_append_c(res, *str++);
     }
     g_string_append_c(res, '"');
 }
 
-
 static LibBalsaCondition *
-lbcond_new(ConditionMatchType type,
-           gboolean           negated)
+lbcond_new(ConditionMatchType type, gboolean negated)
 {
     LibBalsaCondition *cond;
 
     cond = g_new(LibBalsaCondition, 1);
-    cond->type = type;
-    cond->negate = !!negated;
+    cond->type      = type;
+    cond->negate    = !!negated;
     cond->ref_count = 1;
 
     return cond;
 }
 
-
 #ifndef FIXME
-LibBalsaCondition *
+LibBalsaCondition*
 libbalsa_condition_new(void)
 {
     LibBalsaCondition *cond;
 
     cond = lbcond_new(CONDITION_STRING, FALSE);
-    cond->match.string.fields = 0;
-    cond->match.string.string = NULL;
+    cond->match.string.fields      = 0;
+    cond->match.string.string      = NULL;
     cond->match.string.user_header = NULL;
     return cond;
 }
-
-
 #endif
 
-static LibBalsaCondition *
-libbalsa_condition_new_string_parse(gboolean negated,
-                                    gchar  **string)
+static LibBalsaCondition*
+libbalsa_condition_new_string_parse(gboolean negated, gchar **string)
 {
     char *str, *user_header = NULL;
     int i, headers = atoi(*string);
-    for (i = 0; (*string)[i] && isdigit((int)(*string)[i]); i++) {
-    }
-    if ((*string)[i] != ' ') {
+    for(i=0; (*string)[i] && isdigit((int)(*string)[i]); i++)
+        ;
+    if((*string)[i] != ' ')
         return NULL;
-    }
-    *string += i + 1;
-    if ( headers & CONDITION_MATCH_US_HEAD) {
+    *string += i+1;
+    if( headers & CONDITION_MATCH_US_HEAD) {
         user_header = get_quoted_string(string);
-        if (!user_header) {
-            return NULL;
-        }
-        if (*(*string)++ != ' ') {
-            g_free(user_header);
+        if(!user_header)
             return NULL;
+        if(*(*string)++ != ' ') {
+            g_free(user_header); return NULL;
         }
     }
     str = get_quoted_string(string);
-    if (str == NULL) {
+    if(str == NULL) {
         g_free(user_header);
         return NULL;
     }
     return libbalsa_condition_new_string(negated, headers, str, user_header);
 }
 
-
-LibBalsaCondition *
-libbalsa_condition_new_string(gboolean negated,
-                              unsigned headers,
-                              gchar   *str,
-                              gchar   *user_header)
+LibBalsaCondition*
+libbalsa_condition_new_string(gboolean negated, unsigned headers,
+                              gchar *str, gchar *user_header)
 {
     LibBalsaCondition *cond;
 
     cond = lbcond_new(CONDITION_STRING, negated);
-    cond->match.string.fields = headers;
-    cond->match.string.string = str;
+    cond->match.string.fields      = headers;
+    cond->match.string.string      = str;
     cond->match.string.user_header = user_header;
 
     return cond;
 }
-
-
-LibBalsaCondition *
-libbalsa_condition_new_date(gboolean negated,
-                            time_t  *from,
-                            time_t  *to)
+LibBalsaCondition*
+libbalsa_condition_new_date(gboolean negated, time_t *from, time_t *to)
 {
     LibBalsaCondition *cond;
 
     cond = lbcond_new(CONDITION_DATE, negated);
-    cond->match.date.date_low = from ? *from : 0;
+    cond->match.date.date_low  = from ? *from : 0;
     cond->match.date.date_high = to   ? *to   : 0;
 
     return cond;
 }
 
-
-static LibBalsaCondition *
-libbalsa_condition_new_date_parse(gboolean negated,
-                                  gchar  **string)
+static LibBalsaCondition*
+libbalsa_condition_new_date_parse(gboolean negated, gchar **string)
 {
     LibBalsaCondition *cond;
     gchar *hi, *lo = get_quoted_string(string);
     time_t tlo, thi;
     struct tm date;
 
-    if (lo == NULL) {
+    if(lo == NULL)
         return NULL;
-    }
-    if (*(*string)++ != ' ') {
+    if(*(*string)++ != ' ') {
         g_free(lo);
         return NULL;
     }
-    hi = get_quoted_string(string);
-    if (hi == NULL) {
+    hi=get_quoted_string(string);
+    if(hi == NULL) {
         g_free(lo);
         return NULL;
     }
@@ -198,21 +172,21 @@ libbalsa_condition_new_date_parse(gboolean negated,
     /* strptime with our format will not set time, only date */
     memset(&date, 0, sizeof(date));
 
-    if (*lo == '\0') {
-        tlo = 0;
-    } else {
+    if(*lo == '\0')
+       tlo = 0;
+    else {
         strptime(lo, "%Y-%m-%d", &date);
         tlo = mktime(&date);
     }
-    if (*hi == '\0') {
-        thi = 0;
-    } else {
+    if(*hi == '\0')
+       thi =  0;
+    else {
         strptime(hi, "%Y-%m-%d", &date);
-        thi = mktime(&date) + 24 * 3600 - 1 /* 24*3600 - 1 = 23:59:59 */;
+        thi = mktime(&date) + 24*3600 - 1 /* 24*3600 - 1 = 23:59:59 */;
     }
-
+        
     cond = lbcond_new(CONDITION_DATE, negated);
-    cond->match.date.date_low = tlo;
+    cond->match.date.date_low  = tlo;
     cond->match.date.date_high = thi;
     g_free(lo);
     g_free(hi);
@@ -220,23 +194,19 @@ libbalsa_condition_new_date_parse(gboolean negated,
     return cond;
 }
 
-
-static LibBalsaCondition *
-libbalsa_condition_new_flag(gboolean negated,
-                            gchar  **string)
+static LibBalsaCondition*
+libbalsa_condition_new_flag(gboolean negated, gchar **string)
 {
     int i, flags = atoi(*string);
-    for (i = 0; (*string)[i] && isdigit((int)(*string)[i]); i++) {
-    }
+    for(i=0; (*string)[i] && isdigit((int)(*string)[i]); i++)
+        ;
     *string += i;
 
     return libbalsa_condition_new_flag_enum(negated, flags);
 }
 
-
-LibBalsaCondition *
-libbalsa_condition_new_flag_enum(gboolean            negated,
-                                 LibBalsaMessageFlag flags)
+LibBalsaCondition*
+libbalsa_condition_new_flag_enum(gboolean negated, LibBalsaMessageFlag flags)
 {
     LibBalsaCondition *cond;
 
@@ -246,20 +216,17 @@ libbalsa_condition_new_flag_enum(gboolean            negated,
     return cond;
 }
 
-
-static LibBalsaCondition *
-libbalsa_condition_new_bool(gboolean           negated,
-                            ConditionMatchType cmt,
-                            gchar            **string)
+static LibBalsaCondition*
+libbalsa_condition_new_bool(gboolean negated, ConditionMatchType cmt,
+                            gchar **string)
 {
     LibBalsaCondition *left, *right, *retval;
 
     left = libbalsa_condition_new_from_string(string);
-    if (left == NULL) {
+    if(left == NULL)
         return NULL;
-    }
-    if ((*(*string)++ != ' ') ||
-        ((right = libbalsa_condition_new_from_string(string)) == NULL)) {
+    if(*(*string)++ != ' ' || 
+       (right = libbalsa_condition_new_from_string(string)) == NULL) {
         libbalsa_condition_unref(left);
         return NULL;
     }
@@ -271,103 +238,86 @@ libbalsa_condition_new_bool(gboolean           negated,
     return retval;
 }
 
-
 /* libbalsa_condition_new_bool_ptr
  *
  * refs the left and right conditions, so the caller must unref
  * after calling.
  */
-LibBalsaCondition *
-libbalsa_condition_new_bool_ptr(gboolean           negated,
-                                ConditionMatchType cmt,
+LibBalsaCondition*
+libbalsa_condition_new_bool_ptr(gboolean negated, ConditionMatchType cmt,
                                 LibBalsaCondition *left,
                                 LibBalsaCondition *right)
 {
     LibBalsaCondition *cond;
 
-    g_return_val_if_fail(left != NULL || right != NULL, NULL);
+    g_return_val_if_fail(left != NULL || right != NULL,  NULL);
 
-    if (!left) {
+    if (!left)
         return libbalsa_condition_ref(right);
-    }
-    if (!right) {
+    if (!right)
         return libbalsa_condition_ref(left);
-    }
 
     cond = lbcond_new(cmt, negated);
-    cond->match.andor.left = libbalsa_condition_ref(left);
+    cond->match.andor.left  = libbalsa_condition_ref(left);
     cond->match.andor.right = libbalsa_condition_ref(right);
 
     return cond;
 }
 
-
-static LibBalsaCondition *
-libbalsa_condition_new_and(gboolean negated,
-                           gchar  **string)
+static LibBalsaCondition*
+libbalsa_condition_new_and(gboolean negated, gchar **string)
 {
     return libbalsa_condition_new_bool(negated, CONDITION_AND, string);
 }
 
-
-static LibBalsaCondition *
-libbalsa_condition_new_or(gboolean negated,
-                          gchar  **string)
+static LibBalsaCondition*
+libbalsa_condition_new_or(gboolean negated, gchar **string)
 {
     return libbalsa_condition_new_bool(negated, CONDITION_OR, string);
 }
 
-
-LibBalsaCondition *
+LibBalsaCondition*
 libbalsa_condition_new_from_string(gchar **string)
 {
     static const struct {
         const char *key;
         unsigned keylen;
-        LibBalsaCondition *(*parser)(gboolean negate,
-                                     gchar  **str);
+        LibBalsaCondition *(*parser)(gboolean negate, gchar **str);
     } cond_types[] = {
         { "STRING ", 7, libbalsa_condition_new_string_parse },
-        { "DATE ", 5, libbalsa_condition_new_date_parse   },
-        { "FLAG ", 5, libbalsa_condition_new_flag   },
-        { "AND ", 4, libbalsa_condition_new_and    },
-        { "OR ", 3, libbalsa_condition_new_or     }
+        { "DATE ",   5, libbalsa_condition_new_date_parse   },
+        { "FLAG ",   5, libbalsa_condition_new_flag   },
+        { "AND ",    4, libbalsa_condition_new_and    },
+        { "OR ",     3, libbalsa_condition_new_or     }
     };
     gboolean negated;
     unsigned i;
 
-    if (!*string) { /* empty string -> no condition */
+    if(!*string)  /* empty string -> no condition */
         return NULL;
-    }
-    if (strncmp(*string, "NOT ", 4) == 0) {
+    if(strncmp(*string, "NOT ", 4) == 0) {
         negated = TRUE;
         *string += 4;
-    } else {
-        negated = FALSE;
-    }
+    } else negated = FALSE;
 
-    for (i = 0; i < G_N_ELEMENTS(cond_types); i++) {
-        if (strncmp(*string, cond_types[i].key, cond_types[i].keylen) == 0) {
+    for(i=0; i<G_N_ELEMENTS(cond_types); i++)
+        if(strncmp(*string, cond_types[i].key, cond_types[i].keylen) == 0) {
             *string += cond_types[i].keylen;
             return cond_types[i].parser(negated, string);
         }
-    }
-    return NULL;
+    return NULL;    
 }
 
-
 static void
-cond_to_string(LibBalsaCondition *cond,
-               GString           *res)
+cond_to_string(LibBalsaCondition * cond, GString *res)
 {
     char str[80];
     GDate date;
 
-    if (cond->negate) {
+    if(cond->negate)
         g_string_append(res, "NOT ");
-    }
 
-    switch (cond->type) {
+    switch(cond->type) {
     case CONDITION_STRING:
         g_string_append_printf(res, "STRING %u ", cond->match.string.fields);
         if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_US_HEAD)) {
@@ -375,52 +325,42 @@ cond_to_string(LibBalsaCondition *cond,
             g_string_append_c(res, ' ');
         }
         append_quoted_string(res, cond->match.string.string);
-        break;
-
+       break;
     case CONDITION_REGEX:
 #if 0
         /* FIXME! */
-#endif
-        break;
-
+#endif        
+       break;
     case CONDITION_DATE:
         g_string_append(res, "DATE ");
-        if (cond->match.date.date_low) {
-            g_date_set_time_t(&date, cond->match.date.date_low);
-            g_date_strftime(str, sizeof(str), "%Y-%m-%d", &date);
-        } else {
-            str[0] = '\0';
-        }
+       if (cond->match.date.date_low) {
+           g_date_set_time_t(&date, cond->match.date.date_low);
+           g_date_strftime(str, sizeof(str), "%Y-%m-%d", &date);
+       } else str[0]='\0';
         append_quoted_string(res, str);
         g_string_append_c(res, ' ');
-        if (cond->match.date.date_high) {
-            g_date_set_time_t(&date, cond->match.date.date_high);
-            g_date_strftime(str, sizeof(str), "%Y-%m-%d", &date);
-        } else {
-            str[0] = '\0';
-        }
+       if (cond->match.date.date_high) {
+           g_date_set_time_t(&date, cond->match.date.date_high);
+           g_date_strftime(str, sizeof(str), "%Y-%m-%d", &date);
+       } else str[0]='\0';
         append_quoted_string(res, str);
-        break;
-
+       break;
     case CONDITION_FLAG:
         g_string_append_printf(res, "FLAG %u", cond->match.flags);
         break;
-
     case CONDITION_AND:
     case CONDITION_OR:
         g_string_append(res, cond->type == CONDITION_OR ? "OR " : "AND ");
         cond_to_string(cond->match.andor.left, res);
         g_string_append_c(res, ' ');
         cond_to_string(cond->match.andor.right, res);
-        break;
-
+       break;
     case CONDITION_NONE:
         break;
     }
 }
 
-
-gchar *
+gchar*
 libbalsa_condition_to_string(LibBalsaCondition *cond)
 {
     GString *res;
@@ -431,10 +371,8 @@ libbalsa_condition_to_string(LibBalsaCondition *cond)
     return g_string_free(res, FALSE);
 }
 
-
 static void
-append_header_names(LibBalsaCondition *cond,
-                    GString           *res)
+append_header_names(LibBalsaCondition *cond, GString *res)
 {
     static const struct {
         unsigned header;
@@ -448,13 +386,13 @@ append_header_names(LibBalsaCondition *cond,
     };
 
     unsigned i;
-    if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_US_HEAD)) {
+    if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_US_HEAD)) {
         g_string_append_printf(res, _("Header:%s"),
                                cond->match.string.user_header);
     }
-    for (i = 0; i < G_N_ELEMENTS(header_name_map); ++i) {
+    for (i=0; i<G_N_ELEMENTS(header_name_map); ++i) {
         if (CONDITION_CHKMATCH(cond, header_name_map[i].header)) {
-            if (res->len > 0) {
+            if (res->len>0) {
                 g_string_append_printf(res, ",%s",
                                        _(header_name_map[i].header_name));
             } else {
@@ -464,10 +402,8 @@ append_header_names(LibBalsaCondition *cond,
     }
 }
 
-
 static void
-append_flag_names(LibBalsaCondition *cond,
-                  GString           *res)
+append_flag_names(LibBalsaCondition *cond, GString *res)
 {
     static const struct {
         LibBalsaMessageFlag flag;
@@ -480,7 +416,7 @@ append_flag_names(LibBalsaCondition *cond,
     };
     unsigned i;
     gsize len = res->len;
-    for (i = 0; i < G_N_ELEMENTS(flag_name_map); ++i) {
+    for (i=0; i<G_N_ELEMENTS(flag_name_map); ++i) {
         if (cond->match.flags & flag_name_map[i].flag) {
             if (res->len == len) {
                 res = g_string_append(res, _(flag_name_map[i].flag_name));
@@ -492,68 +428,55 @@ append_flag_names(LibBalsaCondition *cond,
     }
 }
 
-
-gchar *
+gchar*
 libbalsa_condition_to_string_user(LibBalsaCondition *cond)
 {
     GDate date;
     char str[80];
     GString *res = g_string_new("");
 
-    if (cond->negate) {
+    if(cond->negate)
         g_string_append(res, _("Not "));
-    }
 
-    switch (cond->type) {
+    switch(cond->type) {
     case CONDITION_STRING:
         append_header_names(cond, res);
         g_string_append_c(res, ' ');
         append_quoted_string(res, cond->match.string.string);
-        break;
-
+       break;
     case CONDITION_REGEX:
 #if 0
         /* FIXME! */
-#endif
-        break;
-
+#endif        
+       break;
     case CONDITION_DATE:
-        if (cond->match.date.date_low) {
-            g_date_set_time_t(&date, cond->match.date.date_low);
-            g_date_strftime(str, sizeof(str), _("From %Y-%m-%d"), &date);
-        } else {
-            str[0] = '\0';
-        }
+       if (cond->match.date.date_low) {
+           g_date_set_time_t(&date, cond->match.date.date_low);
+           g_date_strftime(str, sizeof(str), _("From %Y-%m-%d"), &date);
+       } else str[0]='\0';
         append_quoted_string(res, str);
         g_string_append_c(res, ' ');
-        if (cond->match.date.date_high) {
-            g_date_set_time_t(&date, cond->match.date.date_high);
-            g_date_strftime(str, sizeof(str), _("To %Y-%m-%d"), &date);
-        } else {
-            str[0] = '\0';
-        }
+       if (cond->match.date.date_high) {
+           g_date_set_time_t(&date, cond->match.date.date_high);
+           g_date_strftime(str, sizeof(str), _("To %Y-%m-%d"), &date);
+       } else str[0]='\0';
         append_quoted_string(res, str);
-        break;
-
+       break;
     case CONDITION_FLAG:
         append_flag_names(cond, res);
         break;
-
     case CONDITION_AND:
         g_string_append(res, _("And"));
         break;
-
     case CONDITION_OR:
         g_string_append(res, _("Or"));
-        break;
-
+       break;
     case CONDITION_NONE:
         break;
     }
     return g_string_free(res, FALSE);
 }
 
-
 /*
  * condition_delete_regex()
  *
@@ -564,75 +487,64 @@ libbalsa_condition_to_string_user(LibBalsaCondition *cond)
  *    gpointer throwaway - unused
  */
 void
-libbalsa_condition_regex_free(LibBalsaConditionRegex *reg,
-                              gpointer                throwaway)
+libbalsa_condition_regex_free(LibBalsaConditionRegex* reg, gpointer throwaway)
 {
-    if (!reg) {
-        return;
-    }
+    if (!reg)
+       return;
 
     g_free(reg->string);
-    if (reg->compiled) {
+    if (reg->compiled) 
         g_regex_unref(reg->compiled);
-    }
-}                               /* end condition_regex_free() */
-
+}                              /* end condition_regex_free() */
 
-void
-regexs_free(GSList *regexs)
+void 
+regexs_free(GSList * regexs)
 {
     g_slist_free_full(regexs, (GDestroyNotify) libbalsa_condition_regex_free);
 }                               /* end condition_free_regexs() */
 
-
-void
-libbalsa_condition_unref(LibBalsaCondition *cond)
+void 
+libbalsa_condition_unref(LibBalsaCondition* cond)
 {
-    if (!cond) { /* passing NULL is OK */
+    if(!cond) /* passing NULL is OK */
         return;
-    }
 
     g_return_if_fail(cond->ref_count > 0);
 
-    if (--cond->ref_count > 0) {
+    if (--cond->ref_count > 0)
         return;
-    }
 
     switch (cond->type) {
     case CONDITION_STRING:
-        g_free(cond->match.string.string);
-        g_free(cond->match.string.user_header);
-        break;
-
+       g_free(cond->match.string.string);
+       g_free(cond->match.string.user_header);
+       break;
     case CONDITION_REGEX:
-    /* FIXME: regexs_free(cond->match.regexs); */
+       /* FIXME: regexs_free(cond->match.regexs); */
     case CONDITION_DATE:
     case CONDITION_FLAG:
-        /* nothing to do */
+       /* nothing to do */
         break;
-
     case CONDITION_AND:
     case CONDITION_OR:
         libbalsa_condition_unref(cond->match.andor.left);
         libbalsa_condition_unref(cond->match.andor.right);
         break;
-
     case CONDITION_NONE:
-        /* to avoid warnings */
-        break;
+       /* to avoid warnings */
+       break;
     }
     g_free(cond);
-}                              /* end libbalsa_condition_unref() */
+}                             /* end libbalsa_condition_unref() */
 
 
 /* libbalsa_condition_ref(LibBalsaCondition * cond)
  */
-LibBalsaCondition *
-libbalsa_condition_ref(LibBalsaCondition *cond)
+LibBalsaCondition*
+libbalsa_condition_ref(LibBalsaCondition* cond)
 {
-    if (!cond) { /* passing NULL is OK */
+    if(!cond) /* passing NULL is OK */
         return cond;
-    }
 
     g_return_val_if_fail(cond->ref_count > 0, NULL);
 
@@ -641,100 +553,83 @@ libbalsa_condition_ref(LibBalsaCondition *cond)
     return cond;
 }
 
-
 /* Helper to compare regexs */
 #if 0
 static gboolean
-compare_regexs(GSList *c1,
-               GSList *c2)
+compare_regexs(GSList * c1,GSList * c2)
 {
     GSList *l2 = g_slist_copy(c2);
-    LibBalsaConditionRegex *r1, *r2;
-
-    for (; c1 && l2; c1 = g_slist_next(c1)) {
-        GSList *tmp;
-        r1 = c1->data;
-        for (tmp = l2; tmp; tmp = g_slist_next(tmp)) {
-            r2 = tmp->data;
-            if (g_ascii_strcasecmp(r1->string, r2->string) == 0) {
-                l2 = g_slist_remove(l2, r2);
-                break;
-            }
-        }
-        /* Not found */
-        if (!tmp) {
-            break;
-        }
-    }
-    if (!l2 && !c1) {
-        return TRUE;
+    LibBalsaConditionRegex * r1,* r2;
+
+    for (;c1 && l2;c1 = g_slist_next(c1)) {
+       GSList * tmp;
+       r1 = c1->data;
+       for (tmp = l2;tmp;tmp = g_slist_next(tmp)) {
+           r2 = tmp->data;
+           if (g_ascii_strcasecmp(r1->string,r2->string)==0) {
+               l2 = g_slist_remove(l2, r2);
+               break;
+           }
+       }
+       /* Not found */
+       if (!tmp)  break;
     }
+    if (!l2 && !c1)
+       return TRUE;
     g_slist_free(l2);
     return FALSE;
 }
-
-
 #endif
 /* Helper to compare conditions, a bit obscure at first glance
    but we have to compare complex structure, so we must check
    all fields.
    NULL conditions are OK, and compare equal only if both are NULL.
- */
+*/
 
 static gboolean
-lbcond_compare_string_conditions(LibBalsaCondition *c1,
-                                 LibBalsaCondition *c2)
+lbcond_compare_string_conditions(LibBalsaCondition * c1,
+                                 LibBalsaCondition * c2)
 {
-    if ((c1->match.string.fields != c2->match.string.fields)
+    if (c1->match.string.fields != c2->match.string.fields
         || (CONDITION_CHKMATCH(c1, CONDITION_MATCH_US_HEAD)
             && g_ascii_strcasecmp(c1->match.string.user_header,
-                                  c2->match.string.user_header))) {
+                                  c2->match.string.user_header)))
         return FALSE;
-    }
 
     return (g_ascii_strcasecmp(c1->match.string.string,
                                c2->match.string.string) == 0);
 }
 
-
 gboolean
-libbalsa_condition_compare(LibBalsaCondition *c1,
-                           LibBalsaCondition *c2)
+libbalsa_condition_compare(LibBalsaCondition *c1,LibBalsaCondition *c2)
 {
     gboolean res = FALSE;
 
-    if (c1 == c2) {
+    if (c1 == c2) 
         return TRUE;
-    }
 
-    if ((c1 == NULL) || (c2 == NULL)
-        || (c1->type != c2->type) || (c1->negate != c2->negate)) {
+    if (c1 == NULL || c2 == NULL
+        || c1->type != c2->type || c1->negate != c2->negate)
         return FALSE;
-    }
 
     switch (c1->type) {
     case CONDITION_STRING:
         res = lbcond_compare_string_conditions(c1, c2);
         break;
-
     case CONDITION_REGEX:
 #if 0
-        if ((c2->type == CONDITION_REGEX) && FIXME !
-            compare_regexs(c1->match.regexs, c2->match.regexs)) {
+        if ((c2->type == CONDITION_REGEX) && FIXME!
+            compare_regexs(c1->match.regexs,c2->match.regexs))
             OK = TRUE;
-        }
 #endif
         break;
-
     case CONDITION_DATE:
         res = (c1->match.date.date_low == c2->match.date.date_low &&
                c1->match.date.date_high == c2->match.date.date_high);
         break;
-
     case CONDITION_FLAG:
         res = (c1->match.flags == c2->match.flags);
         break;
-
     case CONDITION_AND:
     case CONDITION_OR:
         /* We could declare c1 and c2 equal if (c1->left == c2->right)
@@ -746,14 +641,12 @@ libbalsa_condition_compare(LibBalsaCondition *c1,
                libbalsa_condition_compare(c1->match.andor.right,
                                           c2->match.andor.right));
         break;
-
     case CONDITION_NONE:
         break;
     }
     return res;
 }
 
-
 /* BIG FIXME : result of certain function of regex compilation are useless
  * and we should have a way to tell which regexs we were unable to compile
  * that's for later
@@ -769,28 +662,25 @@ libbalsa_condition_compare(LibBalsaCondition *c1,
  * Position filter_errno
  */
 #if 0
-static gboolean
-condition_regcomp(LibBalsaConditionRegex *cre)
+static gboolean 
+condition_regcomp(LibBalsaConditionRegex* cre)
 {
     gint rc;
 
     filter_errno = FILTER_NOERR;
-    if (cre->compiled) {
-        return TRUE;
-    }
+    if (cre->compiled) return TRUE;
 
-    cre->compiled = g_new(regex_t, 1);
+    cre->compiled = g_new(regex_t,1);
     rc = regcomp(cre->compiled, cre->string, FILTER_REGCOMP);
 
     if (rc != 0) {
-        gchar errorstring[256];
-        regerror(rc, cre->compiled, errorstring, 256);
-        filter_errno = FILTER_EREGSYN;
-        return FALSE;
+       gchar errorstring[256];
+       regerror(rc, cre->compiled, errorstring, 256);
+       filter_errno = FILTER_EREGSYN;
+       return FALSE;
     }
     return TRUE;
-}                               /* end condition_regcomp() */
-
+}                              /* end condition_regcomp() */
 
 /*
  * condition_compile_regexs
@@ -803,19 +693,15 @@ condition_regcomp(LibBalsaConditionRegex *cre)
  * Position filter_errno (by calling condition_regcomp)
  */
 void
-libbalsa_condition_compile_regexs(LibBalsaCondition *cond)
+libbalsa_condition_compile_regexs(LibBalsaCondition* cond)
 {
-    GSList *regex;
+    GSList * regex;
 
-    if (cond->type == CONDITION_REGEX) {
-        for (regex = cond->match.regexs;
-             regex && condition_regcomp((LibBalsaConditionRegex *)regex->data);
-             regex = g_slist_next(regex)) {
-        }
-    }
+    if (cond->type==CONDITION_REGEX)
+       for(regex=cond->match.regexs;
+            regex && condition_regcomp((LibBalsaConditionRegex*)regex->data);
+            regex=g_slist_next(regex));
 }                       /* end of condition_compile_regexs */
-
-
 #endif
 /* Filters */
 
@@ -826,48 +712,41 @@ libbalsa_condition_compile_regexs(LibBalsaCondition *cond)
  * Position flags according to condition type
  */
 
-static void
-filter_condition_validity(LibBalsaFilter    *fil,
-                          LibBalsaCondition *cond)
+static void 
+filter_condition_validity(LibBalsaFilter* fil, LibBalsaCondition* cond)
 {
 #if 0
     /* Test validity of condition */
-    if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_US_HEAD) &&
-        (!cond->user_header || (cond->user_header[0] == '\0'))) {
-        FILTER_CLRFLAG(fil, FILTER_VALID);
-        return;
+    if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_US_HEAD) && 
+       (!cond->user_header || cond->user_header[0]=='\0')) {
+       FILTER_CLRFLAG(fil,FILTER_VALID);
+       return;
     }
     switch (cond->type) {
     case CONDITION_STRING:
-        if (!cond->match.string) {
-            FILTER_CLRFLAG(fil, FILTER_VALID);
-        }
-        break;
-
+       if (!cond->match.string)
+           FILTER_CLRFLAG(fil,FILTER_VALID);
+       break;
     case CONDITION_REGEX:
-        if (!cond->match.regexs) {
-            FILTER_CLRFLAG(fil, FILTER_VALID);
-        }
-        FILTER_CLRFLAG(fil, FILTER_COMPILED);
-        break;
-
+       if (!cond->match.regexs)
+           FILTER_CLRFLAG(fil,FILTER_VALID);
+       FILTER_CLRFLAG(fil,FILTER_COMPILED);
+       break;
     case CONDITION_FLAG:
     case CONDITION_DATE:
     case CONDITION_NONE:
-        break;
+       break;
     }
 #endif
 }
 
-
 void
-libbalsa_filter_prepend_condition(LibBalsaFilter    *fil,
-                                  LibBalsaCondition *cond,
+libbalsa_filter_prepend_condition(LibBalsaFilter* fil, LibBalsaCondition* cond,
                                   ConditionMatchType op)
 {
     LibBalsaCondition *res;
 
-    filter_condition_validity(fil, cond);
+    filter_condition_validity(fil,cond);
 
     res = libbalsa_condition_new_bool_ptr(FALSE, op, cond, fil->condition);
     libbalsa_condition_unref(cond);
@@ -875,7 +754,6 @@ libbalsa_filter_prepend_condition(LibBalsaFilter    *fil,
     fil->condition = res;
 }
 
-
 /*
  * libbalsa_filter_compile_regexs
  *
@@ -888,35 +766,33 @@ libbalsa_filter_prepend_condition(LibBalsaFilter    *fil,
  *    gboolean - TRUE for success, FALSE otherwise.
  */
 gboolean
-libbalsa_filter_compile_regexs(LibBalsaFilter *fil)
+libbalsa_filter_compile_regexs(LibBalsaFilter* fil)
 {
 #if 0
     FIXME;
     filter_errno = FILTER_NOERR;
 
     if (fil->cond_tree.conditions) {
-        GSList *lst;
-        for (lst = fil->cond_tree.conditions;
+       GSList * lst;
+       for (lst = fil->cond_tree.conditions;
              lst && filter_errno == FILTER_NOERR;
-             lst = g_slist_next(lst)) {
-            libbalsa_condition_compile_regexs((LibBalsaCondition *) lst->data);
-        }
-        if (filter_errno != FILTER_NOERR) {
-            gchar *errorstring =
+             lst = g_slist_next(lst))
+           libbalsa_condition_compile_regexs((LibBalsaCondition*) lst->data);
+       if (filter_errno != FILTER_NOERR) {
+           gchar * errorstring =
                 g_strdup_printf("Unable to compile filter %s", fil->name);
-            filter_perror(errorstring);
-            g_free(errorstring);
-            FILTER_CLRFLAG(fil, FILTER_VALID);
-            return FALSE;
-        }
-
+           filter_perror(errorstring);
+           g_free(errorstring);
+           FILTER_CLRFLAG(fil, FILTER_VALID);
+           return FALSE;
+       }
+       
     }
     FILTER_SETFLAG(fil, FILTER_COMPILED);
 #endif
     return TRUE;
 }                       /* end of filter_compile_regexs */
 
-
 /*
  * libbalsa_filter_free()
  *
@@ -927,24 +803,21 @@ libbalsa_filter_compile_regexs(LibBalsaFilter *fil)
  *    gpointer free_conditions - <>0 => free conditions also
  */
 void
-libbalsa_filter_free(LibBalsaFilter *fil,
-                     gpointer        free_conditions)
+libbalsa_filter_free(LibBalsaFilter* fil, gpointer free_conditions)
 {
-    if (!fil) {
-        return;
-    }
+    if (!fil)
+       return;
 
     g_free(fil->name);
     g_free(fil->sound);
     g_free(fil->popup_text);
     g_free(fil->action_string);
 
-    if (GPOINTER_TO_INT(free_conditions)) {
+    if (GPOINTER_TO_INT(free_conditions)) 
         libbalsa_condition_unref(fil->condition);
-    }
 
     g_free(fil);
-}                               /* end filter_free() */
+}                              /* end filter_free() */
 
 
 /*
@@ -957,17 +830,15 @@ libbalsa_filter_free(LibBalsaFilter *fil,
  *    gboolean free_conditions : if TRUE filter conditions are also freed
  */
 void
-libbalsa_filter_clear_filters(GSList *filter_list,
-                              gint    free_conditions)
+libbalsa_filter_clear_filters(GSList* filter_list,gint free_conditions)
 {
-    if (!filter_list) {
-        return;
-    }
+    if (!filter_list)
+       return;
 
-    g_slist_foreach(filter_list, (GFunc) libbalsa_filter_free,
+    g_slist_foreach(filter_list, (GFunc) libbalsa_filter_free, 
                     GINT_TO_POINTER(free_conditions));
     g_slist_free(filter_list);
-}                               /* end filter_clear_filters() */
+}                              /* end filter_clear_filters() */
 
 
 /*
@@ -984,219 +855,185 @@ libbalsa_filter_new(void)
 {
     LibBalsaFilter *newfil;
 
-    newfil = g_new(LibBalsaFilter, 1);
+    newfil = g_new(LibBalsaFilter,1);
 
-    newfil->name = NULL;
-    newfil->flags = FILTER_EMPTY;     /* In particular filter is INVALID */
+    newfil->name=NULL;
+    newfil->flags     = FILTER_EMPTY; /* In particular filter is INVALID */
     newfil->condition = NULL;
-    newfil->sound = NULL;
+    newfil->sound     = NULL;
     newfil->popup_text = NULL;
-    newfil->action = FILTER_NOTHING;
+    newfil->action    = FILTER_NOTHING;
     newfil->action_string = NULL;
 
-    filter_errno = FILTER_NOERR;
+    filter_errno=FILTER_NOERR;
     return (newfil);
-}                               /* end filter_new() */
-
+}                              /* end filter_new() */
 
 #if 0
-static GString *
-match_field_decode(LibBalsaCondition *cnd,
-                   GString           *buffer,
-                   gchar             *str_format)
+static GString*
+match_field_decode(LibBalsaCondition* cnd, GString *buffer,gchar *str_format)
 {
-    GString *str = g_string_new("[");
-    gboolean coma = FALSE;
+    GString * str=g_string_new("[");
+    gboolean coma=FALSE;
 
     /* FIXME : what to do with body match ? */
 
-    if (CONDITION_CHKMATCH(cnd, CONDITION_MATCH_TO)) {
-        str = g_string_append(str, "\"To\"");
-        coma = TRUE;
+    if (CONDITION_CHKMATCH(cnd,CONDITION_MATCH_TO)) {
+       str=g_string_append(str,"\"To\"");
+       coma=TRUE;
     }
-    if (CONDITION_CHKMATCH(cnd, CONDITION_MATCH_FROM)) {
-        str = g_string_append(str, coma ? ",\"From\"" : "\"From\"");
-        coma = TRUE;
+    if (CONDITION_CHKMATCH(cnd,CONDITION_MATCH_FROM)) {
+       str=g_string_append(str,coma ? ",\"From\"" : "\"From\"");
+       coma=TRUE;
     }
-    if (CONDITION_CHKMATCH(cnd, CONDITION_MATCH_CC)) {
-        str = g_string_append(str, coma ? ",\"Cc\"" : "\"Cc\"");
-        coma = TRUE;
+    if (CONDITION_CHKMATCH(cnd,CONDITION_MATCH_CC)) {
+       str=g_string_append(str,coma ? ",\"Cc\"" : "\"Cc\"");
+       coma=TRUE;
     }
-    if (CONDITION_CHKMATCH(cnd, CONDITION_MATCH_SUBJECT)) {
-        str = g_string_append(str, coma ? ",\"Subject\"" : "\"Subject\"");
-        coma = TRUE;
+    if (CONDITION_CHKMATCH(cnd,CONDITION_MATCH_SUBJECT)) {
+       str=g_string_append(str,coma ? ",\"Subject\"" : "\"Subject\"");
+       coma=TRUE;
     }
-    if (CONDITION_CHKMATCH(cnd, CONDITION_MATCH_US_HEAD) &&
+    if (CONDITION_CHKMATCH(cnd,CONDITION_MATCH_US_HEAD) &&
         cnd->match.string.user_header) {
-        if (coma) {
-            str = g_string_append_c(str, ',');
-        }
-        str = g_string_append_c(str, '\"');
-        str = g_string_append(str, cnd->match.string.user_header);
-        str = g_string_append_c(str, '\"');
+       if (coma)
+           str=g_string_append_c(str,',');
+       str=g_string_append_c(str,'\"');
+       str=g_string_append(str,cnd->match.string.user_header);
+       str=g_string_append_c(str,'\"');
     }
-    g_string_append(str, "] ");
-    if (str->len > 3) {
-        gchar *temp = g_strdup_printf(str_format, "header", str->str);
-        buffer = g_string_append(buffer, temp);
-        g_free(temp);
+    g_string_append(str,"] ");
+    if (str->len>3) {
+       gchar * temp=g_strdup_printf(str_format,"header",str->str);
+       buffer=g_string_append(buffer,temp);
+       g_free(temp);
     }
-    g_string_free(str, TRUE);
+    g_string_free(str,TRUE);
     return buffer;
 }
 
-
-static GString *
-export_condition(LibBalsaCondition *cnd,
-                 GString           *buffer)
+static GString*
+export_condition(LibBalsaCondition* cnd, GString * buffer)
 {
-    gchar *str;
+    gchar * str;
 
-    if (cnd->negate) {
-        buffer = g_string_append(buffer, "not ");
-    }
+    if (cnd->negate)
+       buffer=g_string_append(buffer,"not ");
 
     switch (cnd->type) {
     case CONDITION_STRING:
-        str = g_strconcat("%s :contains %s ", "\"", cnd->match.string.string,
-                          "\"", NULL);
-        buffer = match_field_decode(cnd, buffer, str);
-        g_free(str);
-        break;
-
+       str=g_strconcat("%s :contains %s ","\"",cnd->match.string.string,
+                        "\"",NULL);
+       buffer=match_field_decode(cnd,buffer,str);
+       g_free(str);
+       break;
     case CONDITION_REGEX:
         /* FIXME: do not generate non-conformant sieve script */
-        if (cnd->match.regexs->next) {
-            buffer = g_string_append(buffer, "ANYOF(");
-            parent = TRUE;
-        } else {
-            parent = FALSE;
-        }
-        for (lst = cnd->match.regexs; lst; ) {
-            /* This is not in RFC 3028, consider it as an extension :) */
-            str = g_strconcat("%s :regex %s ",
-                              ((LibBalsaConditionRegex *)lst->data)->string, NULL);
-            buffer = match_field_decode(cnd, buffer, str);
-            g_free(str);
-            lst = g_slist_next(lst);
-            if (lst) {
-                buffer = g_string_append_c(buffer, ',');
-            }
-        }
-        if (parent) {
-            buffer = g_string_append_c(buffer, ')');
-        }
-        break;
-
+       if (cnd->match.regexs->next) {
+           buffer=g_string_append(buffer,"ANYOF(");
+           parent=TRUE;
+       }
+       else parent=FALSE;
+       for (lst=cnd->match.regexs;lst;) {
+           /* This is not in RFC 3028, consider it as an extension :) */
+           str=g_strconcat("%s :regex %s ",
+                            ((LibBalsaConditionRegex*)lst->data)->string,NULL);
+           buffer=match_field_decode(cnd, buffer, str);
+           g_free(str);
+           lst=g_slist_next(lst);
+           if (lst)
+               buffer=g_string_append_c(buffer,',');
+       }
+       if (parent) buffer = g_string_append_c(buffer,')');
+       break;
     case CONDITION_FLAG:
-        /* FIXME */
-        buffer = g_string_append(buffer, "TRUE");
-
+       /* FIXME */
+       buffer=g_string_append(buffer,"TRUE");
     case CONDITION_DATE:
-    /*FIXME */
+       /*FIXME */
     case CONDITION_NONE:
     case CONDITION_AND:
     case CONDITION_OR:
         g_warning("%s: FIXME!\n", __func__);
-        /* Should not occur */
-        buffer = g_string_append(buffer, "TRUE");
+       /* Should not occur */
+       buffer=g_string_append(buffer,"TRUE");
     }
     return buffer;
 }
-
-
 #endif
 
 gboolean
-libbalsa_filter_export_sieve(LibBalsaFilter *fil,
-                             gchar          *filename)
+libbalsa_filter_export_sieve(LibBalsaFilter* fil, gchar* filename)
 {
-    FILE *fp;
+    FILE * fp;
 #if 0
-    GString *buffer;
+    GString * buffer;
 #endif
     gint nb = 0;
 
-    fp = fopen(filename, "w");
-    if (!fp) {
-        return FALSE;
-    }
+    fp=fopen(filename,"w");
+    if (!fp) return FALSE;
 #if 0
-    buffer = g_string_new("# Sieve script automatically generated by Balsa "
-                          "(Exporting a Balsa filter)\n");
+    buffer=g_string_new("# Sieve script automatically generated by Balsa "
+                        "(Exporting a Balsa filter)\n");
 #endif
     g_warning("%s: FIXME!\n", __func__);
 #if 0
-
+    
     if (fil->condition) {
-        buffer = g_string_append(buffer, "IF ");
-        if (fil->cond_tree.conditions->next) {
-            if (fil->cond_tree.op == FILTER_OP_OR) {
-                buffer = g_string_append(buffer, "ANYOF(");
-            } else {
-                buffer = g_string_append(buffer, "ALLOF(");
-            }
-            parent = TRUE;
-        } else {
-            parent = FALSE;
-        }
-        for (conds = fil->cond_tree.conditions; conds; ) {
-            LibBalsaCondition *cnd = (LibBalsaCondition *)conds->data;
-            buffer = export_condition(cnd, buffer);
-            conds = g_slist_next(conds);
-            if (conds) {
-                buffer = g_string_append(buffer, ",\n");
-            }
-        }
-        if (parent) {
-            buffer = g_string_append(buffer, ")\n{\n");
-        } else {
-            buffer = g_string_append(buffer, "\n{\n");
-        }
-        switch (fil->action) {
-        case FILTER_COPY:
-            /* FIXME : I translate COPY to a keep;fileinto sequence, don't know if it's OK */
-            buffer = g_string_append(buffer, "keep;\n");
-
-        case FILTER_MOVE:
-            temp = g_strconcat("fileinto \"", fil->action_string, "\";\n", NULL);
-            buffer = g_string_append(buffer, temp);
-            g_free(temp);
-            break;
-
-        case FILTER_TRASH:
-            buffer = g_string_append(buffer, "discard;\n");
-            break;
-
-        /* FIXME how to code other actions */
+       buffer=g_string_append(buffer,"IF ");
+       if (fil->cond_tree.conditions->next) {
+           if (fil->cond_tree.op==FILTER_OP_OR)
+               buffer=g_string_append(buffer,"ANYOF(");    
+           else buffer=g_string_append(buffer,"ALLOF(");
+           parent=TRUE;
+       }
+       else parent=FALSE;
+       for (conds=fil->cond_tree.conditions; conds;) {
+           LibBalsaCondition* cnd=(LibBalsaCondition*)conds->data;
+           buffer=export_condition(cnd,buffer);
+           conds=g_slist_next(conds);
+           if (conds)
+               buffer=g_string_append(buffer,",\n");
+       }
+       if (parent) 
+           buffer=g_string_append(buffer,")\n{\n");
+       else
+           buffer=g_string_append(buffer,"\n{\n");
+       switch (fil->action) {
+       case FILTER_COPY:
+           /* FIXME : I translate COPY to a keep;fileinto sequence, don't know if it's OK */
+           buffer=g_string_append(buffer,"keep;\n");
+       case FILTER_MOVE:
+           temp=g_strconcat("fileinto \"",fil->action_string,"\";\n",NULL);
+           buffer=g_string_append(buffer,temp);
+           g_free(temp);
+           break;
+       case FILTER_TRASH:
+           buffer=g_string_append(buffer,"discard;\n");
+           break;
+           /* FIXME how to code other actions */
         case FILTER_NOTHING: break;
-
         case FILTER_PRINT:   break;
-
         case FILTER_RUN:     break;
-        }
-        buffer = g_string_append(buffer, "}\n");
+       }
+       buffer=g_string_append(buffer,"}\n");
     }
-    nb = fwrite(buffer->str, buffer->len, 1, fp);
-    g_string_free(buffer, TRUE);
+    nb=fwrite(buffer->str,buffer->len,1,fp);
+    g_string_free(buffer,TRUE);
 #endif
-    if (fclose(fp) != 0) {
-        nb = 0;
-    }
-    return nb == 1 ? TRUE : FALSE;
+    if (fclose(fp)!=0) nb=0;
+    return nb==1 ? TRUE : FALSE;
 }             /* end of filter_export_sieve */
 
-
 /*
  * compare_filters
  *
  * callback for sorting a GtkTreeView
  */
 static gint
-compare_filters(GtkTreeModel *model,
-                GtkTreeIter  *a,
-                GtkTreeIter  *b,
-                gpointer      user_data)
+compare_filters(GtkTreeModel * model, GtkTreeIter * a, GtkTreeIter * b,
+                gpointer user_data)
 {
     gchar *stra, *strb;
     gint ret_val;
@@ -1212,7 +1049,6 @@ compare_filters(GtkTreeModel *model,
     return ret_val;
 }
 
-
 /*
  * libbalsa_filter_list_new
  *
@@ -1227,11 +1063,9 @@ compare_filters(GtkTreeModel *model,
  * sorted               does the list need to be sorted?
  */
 GtkTreeView *
-libbalsa_filter_list_new(gboolean         with_data,
-                         const gchar     *title,
+libbalsa_filter_list_new(gboolean with_data, const gchar * title,
                          GtkSelectionMode mode,
-                         GCallback        selection_changed_cb,
-                         gboolean         sorted)
+                         GCallback selection_changed_cb, gboolean sorted)
 {
     GtkListStore *list_store;
     GtkTreeView *view;
@@ -1243,7 +1077,7 @@ libbalsa_filter_list_new(gboolean         with_data,
         gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER) :
         gtk_list_store_new(1, G_TYPE_STRING);
     view = GTK_TREE_VIEW(gtk_tree_view_new_with_model
-                             (GTK_TREE_MODEL(list_store)));
+                         (GTK_TREE_MODEL(list_store)));
     g_object_unref(list_store);
 
     renderer = gtk_cell_renderer_text_new();
@@ -1251,16 +1085,14 @@ libbalsa_filter_list_new(gboolean         with_data,
         gtk_tree_view_column_new_with_attributes(title, renderer, "text",
                                                  0, NULL);
     gtk_tree_view_append_column(view, column);
-    if (!title) {
+    if (!title)
         gtk_tree_view_set_headers_visible(view, FALSE);
-    }
 
     selection = gtk_tree_view_get_selection(view);
     gtk_tree_selection_set_mode(selection, mode);
-    if (selection_changed_cb) {
+    if (selection_changed_cb)
         g_signal_connect(G_OBJECT(selection), "changed",
                          selection_changed_cb, NULL);
-    }
 
     if (sorted) {
         gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 0,
diff --git a/libbalsa/filter-funcs.h b/libbalsa/filter-funcs.h
index 3f79584..f7faf3c 100644
--- a/libbalsa/filter-funcs.h
+++ b/libbalsa/filter-funcs.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -35,47 +35,44 @@
 
 /*  match flags */
 #define CONDITION_EMPTY         0       /* for initialization */
-#define CONDITION_MATCH_TO      1 << 0    /* match in the To: field */
-#define CONDITION_MATCH_FROM    1 << 1    /* match in the From: field */
-#define CONDITION_MATCH_SUBJECT 1 << 2    /* match in the Subject field */
-#define CONDITION_MATCH_CC      1 << 3    /* match in the cc: field */
-#define CONDITION_MATCH_US_HEAD 1 << 4    /* match in a user header */
-#define CONDITION_MATCH_BODY    1 << 7    /* match in the body */
+#define CONDITION_MATCH_TO      1<<0   /* match in the To: field */
+#define CONDITION_MATCH_FROM    1<<1   /* match in the From: field */
+#define CONDITION_MATCH_SUBJECT 1<<2   /* match in the Subject field */
+#define CONDITION_MATCH_CC      1<<3   /* match in the cc: field */
+#define CONDITION_MATCH_US_HEAD 1<<4    /* match in a user header */
+#define CONDITION_MATCH_BODY    1<<7   /* match in the body */
 
 /* match_fields macros */
 #define CONDITION_SETMATCH(x, y) \
-    ((((LibBalsaCondition *)(x))->match.string.fields) |= (y))
+          ((((LibBalsaCondition*)(x))->match.string.fields) |= (y))
 #define CONDITION_CLRMATCH(x, y) \
-    ((((LibBalsaCondition *)(x))->match.string.fields) &= ~(y))
+          ((((LibBalsaCondition*)(x))->match.string.fields) &= ~(y))
 #define CONDITION_CHKMATCH(x, y) \
-    ((((LibBalsaCondition *)(x))->match.string.fields) & (y))
+          ((((LibBalsaCondition*)(x))->match.string.fields) & (y))
 
 /* Filter defintions */
 /* filter flags */
-#define FILTER_EMPTY         0  /* for clearing bitfields */
+#define FILTER_EMPTY         0 /* for clearing bitfields */
 
-#define FILTER_VALID         1 << 1       /* ready to filter (eg regex strings
-                                             have been compiled with regcomp(), with no
-                                                errors...) */
-#define FILTER_COMPILED      1 << 2       /* the filter needs to be compiled (ie there are
-                                             uncompiled regex) */
+#define FILTER_VALID         1<<1      /* ready to filter (eg regex strings 
+                                          have been compiled with regcomp(), with no errors...) */           
                          
+#define FILTER_COMPILED      1<<2      /* the filter needs to be compiled (ie there are uncompiled regex) */
 
 /* flag operation macros */
-#define FILTER_SETFLAG(x, y) ((((LibBalsaFilter *)(x))->flags) |= (y))
-#define FILTER_CLRFLAG(x, y) ((((LibBalsaFilter *)(x))->flags) &= ~(y))
-#define FILTER_CHKFLAG(x, y) ((((LibBalsaFilter *)(x))->flags) & (y))
+#define FILTER_SETFLAG(x, y) ((((LibBalsaFilter*)(x))->flags) |= (y))
+#define FILTER_CLRFLAG(x, y) ((((LibBalsaFilter*)(x))->flags) &= ~(y))
+#define FILTER_CHKFLAG(x, y) ((((LibBalsaFilter*)(x))->flags) & (y))
 
 /* Conditions */
 
-LibBalsaCondition *libbalsa_condition_new(void);
-
-void libbalsa_conditions_free(GSList *conditions);
+LibBalsaCondition* libbalsa_condition_new(void);
 
-LibBalsaConditionRegex *libbalsa_condition_regex_new(void);
+void libbalsa_conditions_free(GSList * conditions);
 
+LibBalsaConditionRegex* libbalsa_condition_regex_new(void);
 void libbalsa_condition_regex_free(LibBalsaConditionRegex *, gpointer);
 void regexs_free(GSList *);
-void libbalsa_condition_compile_regexs(LibBalsaCondition *cond);
+void libbalsa_condition_compile_regexs(LibBalsaCondition* cond);
 gboolean libbalsa_condition_compare(LibBalsaCondition *c1,
                                     LibBalsaCondition *c2);
 
@@ -84,28 +81,21 @@ gboolean libbalsa_condition_compare(LibBalsaCondition *c1,
  * free_condition is a gint into a gpointer : if <>0 the function frees filter conditions also
  */
 LibBalsaFilter *libbalsa_filter_new(void);
-void libbalsa_filter_free(LibBalsaFilter *,
-                          gpointer free_condition);
-void libbalsa_filter_clear_filters(GSList *,
-                                   gint free_conditions);
-void libbalsa_filter_append_condition(LibBalsaFilter *,
-                                      LibBalsaCondition *);
-void libbalsa_filter_prepend_condition(LibBalsaFilter *,
-                                       LibBalsaCondition *,
+void libbalsa_filter_free(LibBalsaFilter *, gpointer free_condition);
+void libbalsa_filter_clear_filters(GSList *,gint free_conditions);
+void libbalsa_filter_append_condition(LibBalsaFilter*, LibBalsaCondition *);
+void libbalsa_filter_prepend_condition(LibBalsaFilter*, LibBalsaCondition*,
                                        ConditionMatchType op);
-
-void libbalsa_filter_delete_regex(LibBalsaFilter *, LibBalsaCondition *,
+void libbalsa_filter_delete_regex(LibBalsaFilter*,LibBalsaCondition*,
                                   LibBalsaConditionRegex *, gpointer);
 gboolean libbalsa_filter_compile_regexs(LibBalsaFilter *);
 
-gboolean libbalsa_filter_export_sieve(LibBalsaFilter *fil,
-                                      gchar          *filename);
+gboolean libbalsa_filter_export_sieve(LibBalsaFilter* fil, gchar* filename);
 
 /* GtkTreeView helper */
-GtkTreeView *libbalsa_filter_list_new(gboolean         with_data,
-                                      const gchar     *title,
+GtkTreeView *libbalsa_filter_list_new(gboolean with_data,
+                                      const gchar * title,
                                       GtkSelectionMode mode,
-                                      GCallback        selection_changed_cb,
-                                      gboolean         sorted);
-
-#endif                          /* __FILTER_FUNCS_H__ */
+                                      GCallback selection_changed_cb,
+                                      gboolean sorted);
+#endif                         /* __FILTER_FUNCS_H__ */
diff --git a/libbalsa/filter-private.h b/libbalsa/filter-private.h
index 8817314..4cfbfb3 100644
--- a/libbalsa/filter-private.h
+++ b/libbalsa/filter-private.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -27,7 +27,7 @@
 #define __FILTER_PRIVATE_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 
@@ -41,4 +41,4 @@ struct _LibBalsaConditionRegex {
     GRegex *compiled;
 };
 
-#endif                          /* __FILTER_PRIVATE_H__ */
+#endif                         /* __FILTER_PRIVATE_H__ */
diff --git a/libbalsa/filter.c b/libbalsa/filter.c
index 5227a0a..bf78ad9 100644
--- a/libbalsa/filter.c
+++ b/libbalsa/filter.c
@@ -28,7 +28,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "filter.h"
 
@@ -36,7 +36,7 @@
 #include <string.h>
 
 #if HAVE_CANBERRA
-#   include <canberra-gtk.h>
+#include <canberra-gtk.h>
 #endif                          /* HAVE_CANBERRA */
 
 #include "libbalsa.h"
@@ -49,72 +49,64 @@
 
 /* filters_trash_mbox points to a mailbox that is used as Trash by filters
  *  code. */
-static LibBalsaMailbox *filters_trash_mbox = NULL;
+static LibBalsaMailbox* filters_trash_mbox = NULL;
 
 static UrlToMailboxMapper url_to_mailbox_mapper = NULL;
-static GSList **filter_list = NULL;
+static GSList** filter_list = NULL;
 void
-libbalsa_filters_set_trash(LibBalsaMailbox *new_trash)
+libbalsa_filters_set_trash(LibBalsaMailbox* new_trash)
 {
     filters_trash_mbox = new_trash;
 }
 
-
 void
 libbalsa_filters_set_url_mapper(UrlToMailboxMapper u2mm)
 {
     url_to_mailbox_mapper = u2mm;
 }
-
-
 void
-libbalsa_filters_set_filter_list(GSList **list)
+libbalsa_filters_set_filter_list(GSList** list)
 {
     filter_list = list;
 }
 
-
 /*------------------------------------------------------------------------
-   ---- Helper functions (also exported to have a fine-grained API) -------
- */
+  ---- Helper functions (also exported to have a fine-grained API) -------
+*/
 /* libbalsa_condition_regex_set:
    steals the string.
- */
+*/
 void
-libbalsa_condition_regex_set(LibBalsaConditionRegex *reg,
-                             gchar                  *str)
+libbalsa_condition_regex_set(LibBalsaConditionRegex * reg, gchar *str)
 {
     g_free(reg->string);
     reg->string = str;
 }
 
-
-const gchar *
-libbalsa_condition_regex_get(LibBalsaConditionRegex *reg)
+const gchar*
+libbalsa_condition_regex_get(LibBalsaConditionRegex * reg)
 {
     return reg->string;
 }
 
-
 void
-libbalsa_condition_prepend_regex(LibBalsaCondition      *cond,
-                                 LibBalsaConditionRegex *new_reg)
+libbalsa_condition_prepend_regex(LibBalsaCondition* cond,
+                                 LibBalsaConditionRegex * new_reg)
 {
     g_warning("%s: fixme!\n", __func__);
 #if 0
-    cond->match.regexs =
-        g_slist_prepend(cond->match.regexs, new_reg);
+  cond->match.regexs =
+      g_slist_prepend(cond->match.regexs, new_reg);
 #endif
 }
 
-
 gboolean
-libbalsa_condition_matches(LibBalsaCondition *cond,
-                           LibBalsaMessage   *message)
+libbalsa_condition_matches(LibBalsaCondition* cond,
+                          LibBalsaMessage * message)
 {
     gboolean match = FALSE;
-    gchar *str;
-    GString *body;
+    gchar * str;
+    GString * body;
     gboolean will_ref;
 
     g_return_val_if_fail(cond, FALSE);
@@ -123,9 +115,9 @@ libbalsa_condition_matches(LibBalsaCondition *cond,
     switch (cond->type) {
     case CONDITION_STRING:
         will_ref =
-            (CONDITION_CHKMATCH(cond, CONDITION_MATCH_CC) ||
-             CONDITION_CHKMATCH(cond, CONDITION_MATCH_BODY));
-        if (will_ref) {
+            (CONDITION_CHKMATCH(cond,CONDITION_MATCH_CC) ||
+             CONDITION_CHKMATCH(cond,CONDITION_MATCH_BODY));
+        if(will_ref) {
             gboolean is_refed =
                 libbalsa_message_body_ref(message, FALSE, FALSE);
             if (!is_refed) {
@@ -136,47 +128,41 @@ libbalsa_condition_matches(LibBalsaCondition *cond,
             }
         }
         /* do the work */
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_TO)
+       if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_TO)
             && message->headers->to_list) {
             str =
                 internet_address_list_to_string(message->headers->to_list,
                                                 FALSE);
-            match = libbalsa_utf8_strstr(str, cond->match.string.string);
-            g_free(str);
-            if (match) {
-                break;
-            }
-        }
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_FROM)
+           match=libbalsa_utf8_strstr(str,cond->match.string.string);
+           g_free(str);
+            if(match) break;
+       }
+       if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_FROM)
             && message->headers->from) {
             str =
                 internet_address_list_to_string(message->headers->from,
                                                 FALSE);
-            match = libbalsa_utf8_strstr(str, cond->match.string.string);
-            g_free(str);
-            if (match) {
-                break;
-            }
-        }
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_SUBJECT)) {
-            if (libbalsa_utf8_strstr(LIBBALSA_MESSAGE_GET_SUBJECT(message),
+           match=libbalsa_utf8_strstr(str,cond->match.string.string);
+           g_free(str);
+           if (match) break;
+       }
+       if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_SUBJECT)) {
+           if (libbalsa_utf8_strstr(LIBBALSA_MESSAGE_GET_SUBJECT(message),
                                      cond->match.string.string)) {
                 match = TRUE;
                 break;
             }
-        }
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_CC)
+       }
+       if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_CC)
             && message->headers->cc_list) {
             str =
                 internet_address_list_to_string(message->headers->cc_list,
                                                 FALSE);
-            match = libbalsa_utf8_strstr(str, cond->match.string.string);
-            g_free(str);
-            if (match) {
-                break;
-            }
-        }
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_US_HEAD)) {
+           match=libbalsa_utf8_strstr(str,cond->match.string.string);
+           g_free(str);
+           if (match) break;
+       }
+       if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_US_HEAD)) {
             if (cond->match.string.user_header) {
                 const gchar *header =
                     libbalsa_message_get_user_header(message,
@@ -189,51 +175,41 @@ libbalsa_condition_matches(LibBalsaCondition *cond,
                     break;
                 }
             }
-        }
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_BODY)) {
-            if (!message->mailbox) {
-                return FALSE; /* We don't want to match if an error occurred */
-            }
+       }
+       if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_BODY)) {
+           if (!message->mailbox)
+               return FALSE; /* We don't want to match if an error occurred */
             body =
                 content2reply(message->body_list, NULL, 0, FALSE, FALSE);
-            if (body) {
-                if (body->str) {
+           if (body) {
+               if (body->str)
                     match = libbalsa_utf8_strstr(body->str,
                                                  cond->match.string.string);
-                }
-                g_string_free(body, TRUE);
-            }
-        }
-        if (will_ref) {
-            libbalsa_message_body_unref(message);
-        }
-        break;
-
+               g_string_free(body,TRUE);
+           }
+       }
+        if(will_ref) libbalsa_message_body_unref(message);
+       break;
     case CONDITION_REGEX:
         break;
-
     case CONDITION_DATE:
-        match = message->headers->date >= cond->match.date.date_low
-            && (cond->match.date.date_high == 0 ||
-                message->headers->date <= cond->match.date.date_high);
+        match = message->headers->date>=cond->match.date.date_low
+              && (cond->match.date.date_high==0 ||
+                   message->headers->date<=cond->match.date.date_high);
         break;
-
     case CONDITION_FLAG:
         match = LIBBALSA_MESSAGE_HAS_FLAG(message, cond->match.flags);
         break;
-
     case CONDITION_AND:
         match =
-            libbalsa_condition_matches(cond->match.andor.left, message) &&
-            libbalsa_condition_matches(cond->match.andor.right, message);
+           libbalsa_condition_matches(cond->match.andor.left, message) &&
+           libbalsa_condition_matches(cond->match.andor.right, message);
         break;
-
     case CONDITION_OR:
         match =
-            libbalsa_condition_matches(cond->match.andor.left, message) ||
-            libbalsa_condition_matches(cond->match.andor.right, message);
+           libbalsa_condition_matches(cond->match.andor.left, message) ||
+           libbalsa_condition_matches(cond->match.andor.right, message);
         break;
-
     case CONDITION_NONE:
         break;
     }
@@ -241,45 +217,42 @@ libbalsa_condition_matches(LibBalsaCondition *cond,
     return cond->negate ? !match : match;
 }
 
-
 /*--------- Filtering functions -------------------------------*/
 
 gint
-filters_prepare_to_run(GSList *filters)
+filters_prepare_to_run(GSList * filters)
 {
-    LibBalsaFilter *fil;
-    gboolean ok = TRUE;
-
-    for (; filters != NULL; filters = filters->next) {
-        fil = (LibBalsaFilter *) filters->data;
-        if (!FILTER_CHKFLAG(fil, FILTER_VALID)) {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _("Invalid filter: %s"), fil->name);
-            ok = FALSE;
-        } else if (!FILTER_CHKFLAG(fil, FILTER_COMPILED)) {
-            ok = libbalsa_filter_compile_regexs(fil);
-        }
+    LibBalsaFilter* fil;
+    gboolean ok=TRUE;
+
+    for(; filters != NULL; filters = filters->next) {
+       fil=(LibBalsaFilter*) filters->data;
+       if (!FILTER_CHKFLAG(fil,FILTER_VALID)) {
+               libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                                     _("Invalid filter: %s"),fil->name);
+           ok=FALSE;
+       }
+       else if (!FILTER_CHKFLAG(fil,FILTER_COMPILED))
+           ok=libbalsa_filter_compile_regexs(fil);
     }
 
     return ok;
 }
 
-
 /* Apply the filter's action to the messages in the list; returns TRUE
  * if message(s) were moved to the trash. */
 gboolean
-libbalsa_filter_mailbox_messages(LibBalsaFilter  *filt,
-                                 LibBalsaMailbox *mailbox,
-                                 GArray          *msgnos)
+libbalsa_filter_mailbox_messages(LibBalsaFilter * filt,
+                                LibBalsaMailbox * mailbox,
+                                GArray * msgnos)
 {
-    gboolean result = FALSE;
+    gboolean result=FALSE;
     LibBalsaMailbox *mbox;
     GError *err = NULL;
     gchar **parts, **p;
 
-    if (msgnos->len == 0) {
-        return FALSE;
-    }
+    if (msgnos->len == 0)
+       return FALSE;
 
 #if HAVE_CANBERRA
     if (filt->sound) {
@@ -290,84 +263,72 @@ libbalsa_filter_mailbox_messages(LibBalsaFilter  *filt,
         g_message("(%s) play %s, %s", __func__, filt->sound, ca_strerror(rc));
     }
 #endif                          /* HAVE_CANBERRA */
-    if (filt->popup_text) {
-        libbalsa_information(LIBBALSA_INFORMATION_MESSAGE,
-                             "%s",
-                             filt->popup_text);
-    }
+    if (filt->popup_text)
+       libbalsa_information(LIBBALSA_INFORMATION_MESSAGE,
+                            "%s",
+                            filt->popup_text);
 
     libbalsa_lock_mailbox(mailbox);
 
     switch (filt->action) {
     case FILTER_COPY:
-        mbox = url_to_mailbox_mapper(filt->action_string);
-        if (!mbox) {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _("Bad mailbox name for filter: %s"),
-                                 filt->name);
-        } else if (!libbalsa_mailbox_messages_copy(mailbox, msgnos, mbox, &err)) {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _("Error when copying messages: %s"),
+       mbox = url_to_mailbox_mapper(filt->action_string);
+       if (!mbox)
+           libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                                _("Bad mailbox name for filter: %s"),
+                                filt->name);
+       else if (!libbalsa_mailbox_messages_copy(mailbox, msgnos, mbox, &err))
+           libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                                _("Error when copying messages: %s"),
                                  err ? err->message : "?");
-        } else if (mbox == filters_trash_mbox) {
-            result = TRUE;
-        }
-        break;
-
+       else if (mbox == filters_trash_mbox)
+           result = TRUE;
+       break;
     case FILTER_TRASH:
-        if (!filters_trash_mbox ||
-            !libbalsa_mailbox_messages_move(mailbox, msgnos,
-                                            filters_trash_mbox, &err)) {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _("Error when trashing messages: %s"),
+       if (!filters_trash_mbox ||
+           !libbalsa_mailbox_messages_move(mailbox, msgnos,
+                                           filters_trash_mbox, &err))
+           libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                                _("Error when trashing messages: %s"),
                                  err ? err->message : "?");
-        } else {
-            result = TRUE;
-        }
-        break;
-
+       else
+           result = TRUE;
+       break;
     case FILTER_MOVE:
-        mbox = url_to_mailbox_mapper(filt->action_string);
-        if (!mbox) {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _("Bad mailbox name for filter: %s"),
-                                 filt->name);
-        } else if (!libbalsa_mailbox_messages_move(mailbox, msgnos, mbox, &err)) {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _("Error when moving messages: %s"),
+       mbox = url_to_mailbox_mapper(filt->action_string);
+       if (!mbox)
+           libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                                _("Bad mailbox name for filter: %s"),
+                                filt->name);
+       else if (!libbalsa_mailbox_messages_move(mailbox, msgnos, mbox, &err))
+           libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                                _("Error when moving messages: %s"),
                                  err ? err->message : "?");
-        } else if (mbox == filters_trash_mbox) {
-            result = TRUE;
-        }
-        break;
-
+       else if (mbox == filters_trash_mbox)
+           result = TRUE;
+       break;
     case FILTER_COLOR:
         parts = g_strsplit(filt->action_string, ";", 2);
         for (p = parts; *p; p++) {
-            if (g_str_has_prefix(*p, "foreground:")) {
+            if (g_str_has_prefix(*p, "foreground:"))
                 libbalsa_mailbox_set_foreground(mailbox, msgnos,
                                                 (*p) + 11);
-            }
-            if (g_str_has_prefix(*p, "background:")) {
+            if (g_str_has_prefix(*p, "background:"))
                 libbalsa_mailbox_set_background(mailbox, msgnos,
                                                 (*p) + 11);
-            }
         }
         g_strfreev(parts);
         break;
-
     case FILTER_PRINT:
-        /* FIXME : to be implemented */
-        break;
-
+       /* FIXME : to be implemented */
+       break;
     case FILTER_RUN:
-        /* FIXME : to be implemented */
-        break;
-
+       /* FIXME : to be implemented */
+       break;
     case FILTER_NOTHING:
     case FILTER_N_TYPES:
-        /* Nothing to do */
-        break;
+       /* Nothing to do */
+       break;
     }
     g_clear_error(&err);
     libbalsa_unlock_mailbox(mailbox);
@@ -375,120 +336,104 @@ libbalsa_filter_mailbox_messages(LibBalsaFilter  *filt,
     return result;
 }
 
-
 /*--------- End of Filtering functions -------------------------------*/
 
-LibBalsaFilter *
-libbalsa_filter_get_by_name(const gchar *fname)
+LibBalsaFilter*
+libbalsa_filter_get_by_name(const gchar * fname)
 {
-    GSList *list;
+    GSList * list;
     gint fnamelen;
 
     g_return_val_if_fail(filter_list, NULL);
-    if (!fname || (fname[0] == '\0')) {
-        return NULL;
-    }
+    if (!fname || fname[0]=='\0') return NULL;
 
     fnamelen = strlen(fname);
     for (list = *filter_list; list != NULL; list = list->next) {
-        gint len = strlen(((LibBalsaFilter *)list->data)->name);
+       gint len = strlen(((LibBalsaFilter*)list->data)->name);
 
-        if (strncmp(fname, ((LibBalsaFilter *)list->data)->name,
-                    MAX(len, fnamelen)) == 0) {
-            return (LibBalsaFilter *)list->data;
-        }
+       if (strncmp(fname,((LibBalsaFilter*)list->data)->name,
+                   MAX(len,fnamelen))==0)
+           return (LibBalsaFilter*)list->data;
     }
     return NULL;
 }
 
-
 /* Check whether the condition tests the message body, and if so,
  * whether it's already loaded; used by the imap mailbox driver to
  * decide whether to do a server-side match. */
 gboolean
-libbalsa_condition_can_match(LibBalsaCondition *cond,
-                             LibBalsaMessage   *message)
+libbalsa_condition_can_match(LibBalsaCondition * cond,
+                            LibBalsaMessage * message)
 {
-    if (!message) {
-        return FALSE;
-    }
+    if (!message)
+       return FALSE;
 
     switch (cond->type) {
     case CONDITION_STRING:
-        return !(CONDITION_CHKMATCH(cond, CONDITION_MATCH_BODY)
-                 && message->body_list == NULL)
-               && !(CONDITION_CHKMATCH(cond, CONDITION_MATCH_US_HEAD)
-                    && message->mime_msg == NULL);
-
+       return !(CONDITION_CHKMATCH(cond, CONDITION_MATCH_BODY)
+                && message->body_list == NULL)
+           && !(CONDITION_CHKMATCH(cond, CONDITION_MATCH_US_HEAD)
+                && message->mime_msg == NULL);
     case CONDITION_AND:
     case CONDITION_OR:
-        return libbalsa_condition_can_match(cond->match.andor.left,
-                                            message)
-               && libbalsa_condition_can_match(cond->match.andor.right,
-                                               message);
-
+       return libbalsa_condition_can_match(cond->match.andor.left,
+                                           message)
+           && libbalsa_condition_can_match(cond->match.andor.right,
+                                           message);
     default:
-        return TRUE;
+       return TRUE;
     }
 }
 
-
 /* Check whether a condition looks only at flags; if it does, test
  * whether the given message's flags match it, and return the result in
  * *match; used by mailbox backends to decide when the full
  * LibBalsaMessage is needed. */
 gboolean
-libbalsa_condition_is_flag_only(LibBalsaCondition *cond,
-                                LibBalsaMailbox   *mailbox,
-                                guint              msgno,
-                                gboolean          *match)
+libbalsa_condition_is_flag_only(LibBalsaCondition * cond,
+                                LibBalsaMailbox * mailbox,
+                                guint msgno,
+                               gboolean * match)
 {
     gboolean retval;
     gboolean left_match, right_match;
 
     switch (cond->type) {
     case CONDITION_FLAG:
-        if (match) {
+        if (match)
             *match =
                 libbalsa_mailbox_msgno_has_flags(mailbox, msgno,
                                                  cond->match.flags, 0);
-        }
         retval = TRUE;
         break;
-
     case CONDITION_AND:
         retval =
             libbalsa_condition_is_flag_only(cond->match.andor.left,
                                             mailbox, msgno,
-                                            match ? &left_match : NULL)
+                                           match ? &left_match : NULL)
             && libbalsa_condition_is_flag_only(cond->match.andor.right,
                                                mailbox, msgno,
                                                match ? &right_match : NULL);
-        if (retval && match) {
+        if (retval && match)
             *match = left_match && right_match;
-        }
         break;
-
     case CONDITION_OR:
         retval =
             libbalsa_condition_is_flag_only(cond->match.andor.left,
                                             mailbox, msgno,
-                                            match ? &left_match : NULL)
+                                           match ? &left_match : NULL)
             && libbalsa_condition_is_flag_only(cond->match.andor.right,
                                                mailbox, msgno,
                                                match ? &right_match : NULL);
-        if (retval && match) {
+        if (retval && match)
             *match = left_match || right_match;
-        }
         break;
-
     default:
         return FALSE;
     }
 
-    if (retval && match && cond->negate) {
+    if (retval && match && cond->negate)
         *match = !*match;
-    }
 
     return retval;
 }
diff --git a/libbalsa/filter.h b/libbalsa/filter.h
index 6d2a097..37aa042 100644
--- a/libbalsa/filter.h
+++ b/libbalsa/filter.h
@@ -6,20 +6,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 /*
  * filter.h
- *
+ * 
  * Header for libfilter, the mail filtering porting of balsa
  *
  * Authors:  Joel Becker - Emmanuel Allaud
@@ -38,7 +38,7 @@ typedef struct _LibBalsaConditionRegex LibBalsaConditionRegex;
 /* Conditions definition :
  * a condition is the basic component of a filter
  * It can be of type (mimic the old filter types) :
- * - CONDITION_STRING : matches when a string is contained in
+ * - CONDITION_STRING : matches when a string is contained in 
  *   one of the specified fields
  * - CONDITION_REGEX : matches when one of the reg exs matches on one
  *   of the specified fields
@@ -59,7 +59,7 @@ typedef enum {
     CONDITION_DATE,
     CONDITION_FLAG,
     CONDITION_AND, /* Condition has a list of subconditions and
-                   * matches if all the subconditions match. */
+                    * matches if all the subconditions match. */
     CONDITION_OR   /* Condition has a list of subconditions and
                     * matches if any subcondition matches. */
 } ConditionMatchType;
@@ -75,8 +75,8 @@ struct _LibBalsaCondition {
         struct {
             unsigned fields;     /* Contains the header list for
                                   * that this search should look in. */
-            gchar *string;
-            gchar *user_header;  /* This is !=NULL and gives the name
+            gchar * string;     
+            gchar * user_header; /* This is !=NULL and gives the name
                                   * of the user header against which
                                   * we make the match if fields
                                   * includes
@@ -89,12 +89,12 @@ struct _LibBalsaCondition {
             /* GSList * regexs; */
         } regex;
         /* CONDITION_DATE */
-        struct {
-            time_t date_low, date_high; /* for CONDITION_DATE            */
-                                        /* (date_high==0=>no high limit) */
-        } date;
+       struct {
+           time_t date_low,date_high; /* for CONDITION_DATE            */
+                                       /* (date_high==0=>no high limit) */
+       } date;
         /* CONDITION_FLAG */
-        LibBalsaMessageFlag flags;
+       LibBalsaMessageFlag flags;
 
         /* CONDITION_AND and CONDITION_OR */
         struct {
@@ -103,26 +103,25 @@ struct _LibBalsaCondition {
     } match;
 };
 
-LibBalsaCondition *libbalsa_condition_new_from_string(gchar **string);
-gchar *libbalsa_condition_to_string(LibBalsaCondition *cond);
-gchar *libbalsa_condition_to_string_user(LibBalsaCondition *cond);
+LibBalsaCondition* libbalsa_condition_new_from_string(gchar **string);
+gchar*             libbalsa_condition_to_string(LibBalsaCondition *cond);
+gchar*             libbalsa_condition_to_string_user(LibBalsaCondition *cond);
 
-LibBalsaCondition *libbalsa_condition_new_flag_enum(gboolean            negated,
+LibBalsaCondition* libbalsa_condition_new_flag_enum(gboolean negated,
                                                     LibBalsaMessageFlag flgs);
 
-LibBalsaCondition *libbalsa_condition_new_string(gboolean negated,
+LibBalsaCondition* libbalsa_condition_new_string(gboolean negated,
                                                  unsigned headers,
-                                                 gchar   *str,
-                                                 gchar   *user_header);
-LibBalsaCondition *libbalsa_condition_new_date(gboolean negated,
-                                               time_t  *from,
-                                               time_t  *to);
-LibBalsaCondition *libbalsa_condition_new_bool_ptr(gboolean           negated,
+                                                 gchar *str,
+                                                 gchar *user_header);
+LibBalsaCondition* libbalsa_condition_new_date(gboolean negated,
+                                               time_t *from, time_t *to);
+LibBalsaCondition* libbalsa_condition_new_bool_ptr(gboolean negated,
                                                    ConditionMatchType cmt,
                                                    LibBalsaCondition *left,
                                                    LibBalsaCondition *right);
-LibBalsaCondition *libbalsa_condition_ref(LibBalsaCondition *cnd);
-void               libbalsa_condition_unref(LibBalsaCondition *);
+LibBalsaCondition* libbalsa_condition_ref(LibBalsaCondition* cnd);
+void               libbalsa_condition_unref(LibBalsaCondition*); 
 
 
 typedef enum {
@@ -132,7 +131,7 @@ typedef enum {
 } FilterOpType;
 
 /* Filter definition :
- * a filter is defined by
+ * a filter is defined by 
  * - a list of conditions and a gint conditions_op
  *   specifying the logical op to apply on the result of the condition match
  * - an action to perform on match : move, copy, print or trash the
@@ -176,15 +175,15 @@ typedef struct _LibBalsaFilter {
                                    * one. */
 
     /* The notification fields : NULL signifies no notification */
-    gchar *sound;
-    gchar *popup_text;
+    gchar * sound;
+    gchar * popup_text;
 
     /* The action */
     FilterActionType action;
-    /* action_string depends on action :
+    /* action_string depends on action : 
      * - if action is FILTER_MOVE, or FILTER_COPY, action_string is
      *   the URL (this is mandatory because it determines UNIQUELY
-     *   the mailbox, unlike the name) of the mailbox to move/copy
+     *   the mailbox, unlike the name) of the mailbox to move/copy 
      *   the matching message
      * - if action is FILTER_RUN, action_string is the command to run
      *   for now this is the way to specify parameters (replaced by
@@ -199,7 +198,7 @@ typedef struct _LibBalsaFilter {
      * - if action is FILTER_TRASH it's NULL
      * - FIXME if action is FILTER_PRINT it could be the print command ?
      */
-    gchar *action_string;
+    gchar * action_string;
 } LibBalsaFilter;
 
 /*
@@ -208,47 +207,45 @@ typedef struct _LibBalsaFilter {
  * functions, virtual folders..., not only filtering
  */
 
-void libbalsa_condition_regex_set(LibBalsaConditionRegex *reg,
-                                  gchar                  *str);
-
+void libbalsa_condition_regex_set(LibBalsaConditionRegex * reg, gchar *str);
 /* returns pointer to internal data, treat with caution! */
-const gchar *libbalsa_condition_regex_get(LibBalsaConditionRegex *reg);
+const gchar* libbalsa_condition_regex_get(LibBalsaConditionRegex * reg);
 
-void libbalsa_condition_prepend_regex(LibBalsaCondition      *cond,
+void libbalsa_condition_prepend_regex(LibBalsaCondition* cond,
                                       LibBalsaConditionRegex *new_reg);
 
-/** libbalsa_condition_matches() checks whether given message matches the
+/** libbalsa_condition_matches() checks whether given message matches the 
  * condition. */
-gboolean libbalsa_condition_matches(LibBalsaCondition *cond,
-                                    LibBalsaMessage   *message);
+gboolean libbalsa_condition_matches(LibBalsaCondition* cond,
+                                    LibBalsaMessage* message);
 
 /* Filtering functions */
 /* FIXME : perhaps I should try to use multithreading -> but we must
    therefore use lock very well */
 /* prepare_filters_to_run will test all filters for correctness,
    compile regexs if needed
- * Return
+ * Return 
  * - TRUE on success (all filters are valid, ready to be applied)
  * - FALSE if there are invalid filters
  */
 
-gint filters_prepare_to_run(GSList *filters);
+gint filters_prepare_to_run(GSList * filters);
 
 /* Apply the filter action to the list of messages.
  * It returns TRUE if the trash bin has been filled with something
  * this is used to call enable_empty_trash after
  */
 
-gboolean libbalsa_filter_mailbox_messages(LibBalsaFilter  *filt,
-                                          LibBalsaMailbox *mailbox,
-                                          GArray          *msgnos);
+gboolean libbalsa_filter_mailbox_messages(LibBalsaFilter * filt,
+                                         LibBalsaMailbox * mailbox,
+                                         GArray * msgnos);
 
 /*
  * libbalsa_filter_get_by_name()
  * search in the filter list the filter of name fname or NULL if unfound
  */
 
-LibBalsaFilter *libbalsa_filter_get_by_name(const gchar *fname);
+LibBalsaFilter* libbalsa_filter_get_by_name(const gchar* fname);
 
 /*
  * Dialog calls
@@ -256,41 +253,38 @@ LibBalsaFilter *libbalsa_filter_get_by_name(const gchar *fname);
 /* filters_edit_dialog launches (guess what :) the filters edit dialog box
  * to modify the list of all filters
  */
-void filters_edit_dialog(GtkWindow *parent);
+void filters_edit_dialog(GtkWindow * parent);
 
 /* filter_run_dialog edits and runs the list of filters of the mailbox
  */
-void filters_run_dialog(LibBalsaMailbox *mbox,
-                        GtkWindow       *parent);
+void filters_run_dialog(LibBalsaMailbox * mbox, GtkWindow * parent);
 
 /* filter_export_dialog to export filters as sieve scripts
  */
 
-void filters_export_dialog(GtkWindow *parent);
-
-void libbalsa_filters_set_trash(LibBalsaMailbox *new_trash);
+void filters_export_dialog(GtkWindow * parent);
 
-typedef LibBalsaMailbox * (*UrlToMailboxMapper)(const gchar *url);
+void libbalsa_filters_set_trash(LibBalsaMailbox* new_trash);
+typedef LibBalsaMailbox* (*UrlToMailboxMapper)(const gchar* url);
 void libbalsa_filters_set_url_mapper(UrlToMailboxMapper u2mm);
-void libbalsa_filters_set_filter_list(GSList **list);
+void libbalsa_filters_set_filter_list(GSList** list);
 
 /*
  * Error calls
  */
 gchar *filter_strerror(gint filter_errnum);
-void filter_perror(const gchar *s);
+void filter_perror(const gchar * s);
 
 /* Test */
-gboolean libbalsa_condition_can_match(LibBalsaCondition *cond,
-                                      LibBalsaMessage   *message);
-gboolean libbalsa_condition_is_flag_only(LibBalsaCondition *cond,
-                                         LibBalsaMailbox   *mailbox,
-                                         guint              msgno,
-                                         gboolean          *match);
+gboolean libbalsa_condition_can_match(LibBalsaCondition * cond,
+                                     LibBalsaMessage * message);
+gboolean libbalsa_condition_is_flag_only(LibBalsaCondition * cond,
+                                         LibBalsaMailbox * mailbox,
+                                         guint msgno, gboolean * match);
 
 /* Compatibility */
 LibBalsaCondition *libbalsa_condition_new_2_0(const gchar *
                                               filter_section_name,
                                               ConditionMatchType cmt);
 
-#endif                          /* __FILTER_H__ */
+#endif                         /* __FILTER_H__ */
diff --git a/libbalsa/folder-scanners.c b/libbalsa/folder-scanners.c
index 13bff21..b2822c6 100644
--- a/libbalsa/folder-scanners.c
+++ b/libbalsa/folder-scanners.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "folder-scanners.h"
 
@@ -40,24 +40,22 @@
 #include "imap-server.h"
 
 #ifndef PATH_MAX
-#   define PATH_MAX _POSIX_PATH_MAX
+#define PATH_MAX _POSIX_PATH_MAX
 #endif
 
-typedef void (*local_scanner_helper) (gpointer     rnode,
-                                      const gchar *prefix,
-                                      LocalCheck   check_local_path,
-                                      LocalMark    mark_local_path,
+typedef void (*local_scanner_helper) (gpointer rnode,
+                                      const gchar * prefix,
+                                      LocalCheck check_local_path,
+                                      LocalMark mark_local_path,
                                       LocalHandler folder_handler,
                                       LocalHandler mailbox_handler,
-                                      guint       *depth);
+                                      guint * depth);
 static void
-libbalsa_scanner_mdir(gpointer     rnode,
-                      const gchar *prefix,
-                      LocalCheck   check_local_path,
-                      LocalMark    mark_local_path,
+libbalsa_scanner_mdir(gpointer rnode, const gchar * prefix,
+                      LocalCheck check_local_path,
+                      LocalMark mark_local_path,
                       LocalHandler folder_handler,
-                      LocalHandler mailbox_handler,
-                      guint       *depth)
+                      LocalHandler mailbox_handler, guint * depth)
 {
     DIR *dpc;
     struct dirent *de;
@@ -66,28 +64,24 @@ libbalsa_scanner_mdir(gpointer     rnode,
     gpointer parent_node = NULL;
 
     if (!check_local_path(prefix, *depth)
-        || !mark_local_path(rnode)) {
+        || !mark_local_path(rnode))
         return;
-    }
 
     dpc = opendir(prefix);
-    if (!dpc) {
+    if (!dpc)
         return;
-    }
 
     /*
      * if we don't find any subdirectories inside, we'll go
      * and ignore this one too...
      */
     while ((de = readdir(dpc)) != NULL) {
-        if (de->d_name[0] == '.') {
+        if (de->d_name[0] == '.')
             continue;
-        }
         snprintf(filename, PATH_MAX, "%s/%s", prefix, de->d_name);
         /* ignore file if it can't be read. */
-        if ((stat(filename, &st) == -1) || (access(filename, R_OK) == -1)) {
+        if (stat(filename, &st) == -1 || access(filename, R_OK) == -1)
             continue;
-        }
 
         if (S_ISDIR(st.st_mode)) {
             /*
@@ -98,7 +92,7 @@ libbalsa_scanner_mdir(gpointer     rnode,
             if ((foo == LIBBALSA_TYPE_MAILBOX_MH) ||
                 (foo == LIBBALSA_TYPE_MAILBOX_MAILDIR)) {
                 parent_node =
-                    mailbox_handler(rnode, de->d_name, filename, foo);
+                   mailbox_handler(rnode, de->d_name, filename, foo);
                 ++*depth;
                 libbalsa_scanner_mdir(parent_node, filename,
                                       check_local_path, mark_local_path,
@@ -112,15 +106,13 @@ libbalsa_scanner_mdir(gpointer     rnode,
     closedir(dpc);
 }
 
-
 static void
-libbalsa_scanner_local_dir_helper(gpointer     rnode,
-                                  const gchar *prefix,
-                                  LocalCheck   check_local_path,
-                                  LocalMark    mark_local_path,
+libbalsa_scanner_local_dir_helper(gpointer rnode, const gchar * prefix,
+                                  LocalCheck check_local_path,
+                                  LocalMark mark_local_path,
                                   LocalHandler folder_handler,
                                   LocalHandler mailbox_handler,
-                                  guint       *depth)
+                                  guint * depth)
 {
     DIR *dpc;
     struct dirent *de;
@@ -130,40 +122,36 @@ libbalsa_scanner_local_dir_helper(gpointer     rnode,
     gpointer current_node;
 
     if (!check_local_path(prefix, *depth)
-        || !mark_local_path(rnode)) {
+        || !mark_local_path(rnode))
         return;
-    }
 
     dpc = opendir(prefix);
-    if (!dpc) {
+    if (!dpc)
         return;
-    }
 
     while ((de = readdir(dpc)) != NULL) {
-        if (de->d_name[0] == '.') {
+        if (de->d_name[0] == '.')
             continue;
-        }
         snprintf(filename, PATH_MAX, "%s/%s", prefix, de->d_name);
 
         /* ignore file if it can't be read. */
-        if ((stat(filename, &st) == -1) || (access(filename, R_OK) == -1)) {
+        if (stat(filename, &st) == -1 || access(filename, R_OK) == -1)
             continue;
-        }
 
         if (S_ISDIR(st.st_mode)) {
-            local_scanner_helper helper;
+           local_scanner_helper helper;
             mailbox_type = libbalsa_mailbox_type_from_path(filename);
 
             if ((mailbox_type == LIBBALSA_TYPE_MAILBOX_MH) ||
                 (mailbox_type == LIBBALSA_TYPE_MAILBOX_MAILDIR)) {
                 current_node =
                     mailbox_handler(rnode, de->d_name, filename, mailbox_type);
-                helper = libbalsa_scanner_mdir;
+               helper = libbalsa_scanner_mdir;
             } else {
                 gchar *name = g_path_get_basename(prefix);
                 current_node = folder_handler(rnode, name, filename, 0);
                 g_free(name);
-                helper = libbalsa_scanner_local_dir_helper;
+               helper = libbalsa_scanner_local_dir_helper;
             }
 
             ++*depth;
@@ -175,23 +163,21 @@ libbalsa_scanner_local_dir_helper(gpointer     rnode,
             mailbox_type = libbalsa_mailbox_type_from_path(filename);
             if (mailbox_type != G_TYPE_OBJECT) {
                 mark_local_path(mailbox_handler
-                                    (rnode, de->d_name, filename,
-                                    mailbox_type));
+                                (rnode, de->d_name, filename,
+                                 mailbox_type));
             }
         }
     }
     closedir(dpc);
 }
 
-
 void
-libbalsa_scanner_local_dir(gpointer     rnode,
-                           const gchar *prefix,
-                           LocalCheck   check_local_path,
-                           LocalMark    mark_local_path,
+libbalsa_scanner_local_dir(gpointer rnode, const gchar * prefix,
+                           LocalCheck check_local_path,
+                           LocalMark mark_local_path,
                            LocalHandler folder_handler,
                            LocalHandler mailbox_handler,
-                           GType        mailbox_type)
+                           GType mailbox_type)
 {
     guint depth = 0;
     local_scanner_helper helper =
@@ -204,25 +190,23 @@ libbalsa_scanner_local_dir(gpointer     rnode,
            mark_local_path, folder_handler, mailbox_handler, &depth);
 }
 
-
 /* ---------------------------------------------------------------------
- * IMAP folder scanner functions
+ * IMAP folder scanner functions 
  * --------------------------------------------------------------------- */
-struct browser_state {
-    ImapHandler *handle_imap_path;
-    ImapMark *mark_imap_path;
-    GHashTable *subfolders;
-    gchar *imap_path;
-    gboolean subscribed;
-    int delim;
-    void *cb_data;     /* data passed to {mailbox,folder}_handlers */
+struct browser_state
+{
+  ImapHandler* handle_imap_path;
+  ImapMark* mark_imap_path;
+  GHashTable* subfolders;
+  gchar *imap_path;
+  gboolean subscribed;
+  int delim;
+  void* cb_data;       /* data passed to {mailbox,folder}_handlers */
 };
 
 static void
-libbalsa_imap_list_cb(ImapMboxHandle       *handle,
-                      int                   delim,
-                      ImapMboxFlags         flags,
-                      char                 *folder,
+libbalsa_imap_list_cb(ImapMboxHandle * handle, int delim,
+                      ImapMboxFlags flags, char *folder,
                       struct browser_state *state)
 {
     gboolean noselect, marked;
@@ -231,14 +215,12 @@ libbalsa_imap_list_cb(ImapMboxHandle       *handle,
 
     g_return_if_fail(folder && *folder);
 
-    if (delim) {
-        state->delim = delim;
-    }
+    if(delim) state->delim = delim;
 
     f = folder[strlen(folder) - 1] == delim ?
         g_strdup(folder) : g_strdup_printf("%s%c", folder, delim);
 
-    if (strcmp(f, state->imap_path) == 0) {
+    if(strcmp(f, state->imap_path) == 0) {
         g_free(f);
         return;
     }
@@ -252,7 +234,7 @@ libbalsa_imap_list_cb(ImapMboxHandle       *handle,
         ImapMboxFlags lsub_flags;
 
         if (!g_hash_table_lookup_extended
-                (state->subfolders, f, NULL, &tmp)) {
+            (state->subfolders, f, NULL, &tmp)) {
             /* This folder wasn't listed in the LSUB responses. */
             g_free(f);
             return;
@@ -269,30 +251,24 @@ libbalsa_imap_list_cb(ImapMboxHandle       *handle,
     if (noscan) {
         g_hash_table_remove(state->subfolders, f);
         g_free(f);
-    } else {
+    } else
         g_hash_table_insert(state->subfolders, f, NULL);
-    }
 
     marked = IMAP_MBOX_HAS_FLAG(flags, IMLIST_MARKED);
     state->handle_imap_path(folder, delim, noselect, noscan, marked,
                             state->cb_data);
 }
 
-
 static void
-libbalsa_imap_lsub_cb(ImapMboxHandle       *handle,
-                      int                   delim,
-                      ImapMboxFlags         flags,
-                      char                 *folder,
+libbalsa_imap_lsub_cb(ImapMboxHandle * handle, int delim,
+                      ImapMboxFlags flags, char *folder,
                       struct browser_state *state)
 {
     gchar *f;
 
     g_return_if_fail(folder && *folder);
 
-    if (delim) {
-        state->delim = delim;
-    }
+    if(delim) state->delim = delim;
 
     f = folder[strlen(folder) - 1] == delim ?
         g_strdup(folder) : g_strdup_printf("%s%c", folder, delim);
@@ -300,29 +276,22 @@ libbalsa_imap_lsub_cb(ImapMboxHandle       *handle,
     g_hash_table_insert(state->subfolders, f, GINT_TO_POINTER(flags));
 }
 
-
 /* executed with GDK lock OFF.
  * see HACKING file for proper locking order description.
  */
 static gboolean
-steal_key(gpointer key,
-          gpointer value,
-          GList  **res)
+steal_key(gpointer key, gpointer value, GList **res)
 {
     *res = g_list_prepend(*res, key);
     return TRUE;
 }
-
-
-static GList *
+static GList*
 steal_keys_to_list(GHashTable *h)
 {
     GList *res = NULL;
     g_hash_table_foreach_steal(h, (GHRFunc)steal_key, &res);
     return res;
 }
-
-
 /* libbalsa_imap_browse: recursive helper.
  *
  * path:                the imap path to be browsed;
@@ -334,13 +303,10 @@ steal_keys_to_list(GHashTable *h)
  * depth:               depth of the recursion.
  */
 static gboolean
-libbalsa_imap_browse(const gchar          *path,
-                     struct browser_state *state,
-                     ImapMboxHandle       *handle,
-                     LibBalsaServer       *server,
-                     ImapCheck             check_imap_path,
-                     guint                *depth,
-                     GError              **error)
+libbalsa_imap_browse(const gchar * path, struct browser_state *state,
+                     ImapMboxHandle* handle, LibBalsaServer * server,
+                     ImapCheck check_imap_path, guint * depth,
+                     GError **error)
 {
     GList *list, *el;
     gboolean browse;
@@ -348,23 +314,21 @@ libbalsa_imap_browse(const gchar          *path,
     gboolean ret = TRUE;
     gint i;
     gchar *tmp;
-
-    if (*path) {
-        if (!state->delim) {
+    
+    if(*path) {
+       if(!state->delim) {
             g_signal_handlers_block_by_func(handle, libbalsa_imap_list_cb,
                                             state);
-            state->delim = imap_mbox_handle_get_delim(handle, path);
+           state->delim = imap_mbox_handle_get_delim(handle, path);
             g_signal_handlers_unblock_by_func(handle, libbalsa_imap_list_cb,
                                               state);
         }
-        if (path[strlen(path) - 1] != state->delim) {
-            state->imap_path = g_strdup_printf("%s%c", path, state->delim);
-        } else {
-            state->imap_path = g_strdup(path);
-        }
-    } else {
+       if(path[strlen(path) - 1] != state->delim)
+           state->imap_path = g_strdup_printf("%s%c", path, state->delim);
+       else
+           state->imap_path = g_strdup(path);
+    } else 
         state->imap_path = g_strdup(path);
-    }
 
     /* Send LSUB command if we're in subscribed mode, to find paths.
      * Note that flags in the LSUB response aren't authoritative
@@ -386,11 +350,10 @@ libbalsa_imap_browse(const gchar          *path,
      * - we are, and the LSUB command gave any responses, to get
      *   authoritative flags.
      */
-    if (!state->subscribed || (g_hash_table_size(state->subfolders) > 0)) {
+    if (!state->subscribed || g_hash_table_size(state->subfolders) > 0)
         rc = imap_mbox_list(handle, state->imap_path);
-    }
     g_free(state->imap_path);
-    if (rc != IMR_OK) {
+    if(rc != IMR_OK) {
         g_set_error(error,
                     LIBBALSA_SCANNER_ERROR,
                     LIBBALSA_SCANNER_ERROR_IMAP,
@@ -414,15 +377,13 @@ libbalsa_imap_browse(const gchar          *path,
         g_free(tmp);
     }
 
-    if (browse) {
+    if (browse)
         for (el = list; el; el = el->next) {
             ret = libbalsa_imap_browse(el->data, state, handle, server,
                                        check_imap_path, depth, error);
-            if (!ret) {
+            if(!ret)
                 break;
-            }
         }
-    }
 
     --*depth;
 
@@ -430,47 +391,41 @@ libbalsa_imap_browse(const gchar          *path,
     return ret;
 }
 
-
 void
-libbalsa_scanner_imap_dir(gpointer        rnode,
-                          LibBalsaServer *server,
-                          const gchar    *path,
-                          int             delim,
-                          gboolean        subscribed,
-                          gboolean        list_inbox,
-                          ImapCheck       check_imap_path,
-                          ImapMark        mark_imap_path,
-                          ImapHandler     handle_imap_path,
-                          gpointer        cb_data,
-                          GError        **error)
+libbalsa_scanner_imap_dir(gpointer rnode, LibBalsaServer * server, 
+                          const gchar* path, int delim,
+                          gboolean subscribed, gboolean list_inbox,
+                          ImapCheck check_imap_path,
+                          ImapMark mark_imap_path,
+                          ImapHandler handle_imap_path,
+                          gpointer cb_data,
+                          GError **error)
 {
     struct browser_state state;
     guint i;
-    ImapMboxHandle *handle;
+    ImapMboxHandle* handle;
     gulong list_handler_id, lsub_handler_id;
 
-    if (!LIBBALSA_IS_IMAP_SERVER(server)) {
-        return;
-    }
-    handle =
+    if (!LIBBALSA_IS_IMAP_SERVER(server))
+            return;
+    handle = 
         libbalsa_imap_server_get_handle(LIBBALSA_IMAP_SERVER(server), error);
     if (!handle) { /* FIXME: propagate error here and translate message */
-        if (!*error) {
+        if(!*error)
             g_set_error(error,
                         LIBBALSA_SCANNER_ERROR,
                         LIBBALSA_SCANNER_ERROR_IMAP,
                         "Could not connect to the server");
-        }
         return;
     }
 
     state.handle_imap_path = handle_imap_path;
-    state.mark_imap_path = mark_imap_path;
-    state.cb_data = cb_data;
-    state.subscribed = subscribed;
-    state.delim = delim;
+    state.mark_imap_path   = mark_imap_path;
+    state.cb_data          = cb_data;
+    state.subscribed       = subscribed;
+    state.delim            = delim;
     state.subfolders = g_hash_table_new_full(g_str_hash, g_str_equal,
-                                             g_free, NULL);
+                                            g_free, NULL);
 
     list_handler_id =
         g_signal_connect(G_OBJECT(handle), "list-response",
@@ -496,8 +451,7 @@ libbalsa_scanner_imap_dir(gpointer        rnode,
     g_hash_table_destroy(state.subfolders);
 
     g_signal_handler_disconnect(G_OBJECT(handle), list_handler_id);
-    if (lsub_handler_id) {
+    if (lsub_handler_id)
         g_signal_handler_disconnect(G_OBJECT(handle), lsub_handler_id);
-    }
     libbalsa_imap_server_release_handle(LIBBALSA_IMAP_SERVER(server), handle);
 }
diff --git a/libbalsa/folder-scanners.h b/libbalsa/folder-scanners.h
index 1d4ade8..b52e476 100644
--- a/libbalsa/folder-scanners.h
+++ b/libbalsa/folder-scanners.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -23,36 +23,32 @@
 #include <glib-object.h>
 #include "libbalsa.h"
 
-typedef gboolean LocalCheck (const gchar *fn, guint depth);
-typedef gboolean LocalMark (gpointer node);
-typedef gpointer LocalHandler (gpointer root, const char *d_name,
-                               const char *fn, GType type);
+typedef gboolean LocalCheck(const gchar * fn, guint depth);
+typedef gboolean LocalMark(gpointer node);
+typedef gpointer LocalHandler(gpointer root, const char *d_name,
+                             const char *fn, GType type);
 
-typedef gboolean ImapCheck (const char *fn, LibBalsaServer *server,
-                            guint depth);
-typedef void ImapMark (const char *fn, gpointer data);
-typedef void ImapHandler (const char *fn, char delim, gint noselect,
-                          gint marked, gint noscan, gpointer data);
+typedef gboolean ImapCheck(const char *fn, LibBalsaServer * server,
+                           guint depth);
+typedef void ImapMark(const char *fn, gpointer data);
+typedef void ImapHandler(const char *fn, char delim, gint noselect,
+                        gint marked, gint noscan, gpointer data);
 
 /* read_dir used by mailbox-node append-subtree callback */
-void libbalsa_scanner_local_dir(gpointer     rnode,
-                                const gchar *prefix,
-                                LocalCheck   check_local_path,
-                                LocalMark    mark_local_path,
-                                LocalHandler folder_handler,
+void libbalsa_scanner_local_dir(gpointer rnode, const gchar * prefix, 
+                               LocalCheck check_local_path,
+                               LocalMark mark_local_path,
+                               LocalHandler folder_handler, 
                                 LocalHandler mailbox_handler,
-                                GType        parent_type);
+                                GType parent_type);
 
-void libbalsa_scanner_imap_dir(gpointer        rnode,
-                               LibBalsaServer *server,
-                               const gchar    *path,
-                               int             delim,
-                               gboolean        subscribed,
-                               gboolean        list_inbox,
-                               ImapCheck       check_imap_path,
-                               ImapMark        mark_imap_path,
-                               ImapHandler     handle_imap_path,
-                               gpointer        cb_data,
-                               GError        **error);
+void libbalsa_scanner_imap_dir(gpointer rnode, LibBalsaServer * server, 
+                               const gchar* path, int delim,
+                              gboolean subscribed, gboolean list_inbox,
+                               ImapCheck check_imap_path,
+                               ImapMark mark_imap_path,
+                               ImapHandler handle_imap_path,
+                               gpointer cb_data, 
+                               GError **error);
 
-#endif                          /* __FOLDER_SCANNERS_H__ */
+#endif                         /* __FOLDER_SCANNERS_H__ */
diff --git a/libbalsa/gforest.c b/libbalsa/gforest.c
index 0c7dac2..a36b04e 100644
--- a/libbalsa/gforest.c
+++ b/libbalsa/gforest.c
@@ -1,6 +1,6 @@
 /* Balsa E-Mail Library
  * Copyright (C) 1998 Stuart Parmenter
- *
+ *  
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
  * License as published by the Free Software Foundation; either
@@ -19,16 +19,16 @@
 #include "gforest.h"
 
 GForrest *
-g_forest_new(void)
+g_forest_new (void)
 {
-    GForrest *gf;
+  GForrest *gf;
 
-    gf = g_malloc (sizeof (GForest));
-    gf->key = NULL;
-    gf->data = NULL;
-    gf->list = NULL;
-    gf->sibling = NULL;
-    gf->children = NULL;
+  gf = g_malloc (sizeof (GForest));
+  gf->key = NULL;
+  gf->data = NULL;
+  gf->list = NULL;
+  gf->sibling = NULL;
+  gf->children = NULL;
 
-    return gf;
+  return gf;
 }
diff --git a/libbalsa/gmime-application-pkcs7.c b/libbalsa/gmime-application-pkcs7.c
index 96650cb..fdc24de 100644
--- a/libbalsa/gmime-application-pkcs7.c
+++ b/libbalsa/gmime-application-pkcs7.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifdef HAVE_CONFIG_H
-#   include <config.h>
+#include <config.h>
 #endif
 
 #include <string.h>
@@ -39,7 +39,7 @@
 
 
 #ifdef G_LOG_DOMAIN
-#   undef G_LOG_DOMAIN
+#  undef G_LOG_DOMAIN
 #endif
 #define G_LOG_DOMAIN "crypto"
 
@@ -55,10 +55,9 @@
  * decrypting it again. In this case, validity is undefined.
  */
 GMimeObject *
-g_mime_application_pkcs7_decrypt_verify(GMimePart          *pkcs7,
-                                        GMimeGpgmeSigstat **signature,
-                                        GtkWindow          *parent,
-                                        GError            **err)
+g_mime_application_pkcs7_decrypt_verify(GMimePart * pkcs7,
+                                       GMimeGpgmeSigstat ** signature,
+                                       GtkWindow * parent, GError ** err)
 {
     GMimeObject *decrypted;
     GMimeDataWrapper *wrapper;
@@ -72,12 +71,12 @@ g_mime_application_pkcs7_decrypt_verify(GMimePart          *pkcs7,
 
     /* get the smime type */
     smime_type =
-        g_mime_object_get_content_type_parameter(GMIME_OBJECT(pkcs7),
-                                                 "smime-type");
+       g_mime_object_get_content_type_parameter(GMIME_OBJECT(pkcs7),
+                                                "smime-type");
     if (!smime_type
-        || (g_ascii_strcasecmp(smime_type, "enveloped-data")
-            && g_ascii_strcasecmp(smime_type, "signed-data"))) {
-        return NULL;
+       || (g_ascii_strcasecmp(smime_type, "enveloped-data")
+           && g_ascii_strcasecmp(smime_type, "signed-data"))) {
+       return NULL;
     }
 
     /* get the ciphertext stream */
@@ -91,25 +90,24 @@ g_mime_application_pkcs7_decrypt_verify(GMimePart          *pkcs7,
     filtered_stream = g_mime_stream_filter_new(stream);
     crlf_filter = g_mime_filter_crlf_new(FALSE, FALSE);
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(filtered_stream),
-                             crlf_filter);
+                            crlf_filter);
     g_object_unref(crlf_filter);
 
     /* get the cleartext */
-    if (g_ascii_strcasecmp(smime_type, "enveloped-data") == 0) {
-        *signature =
-            libbalsa_gpgme_decrypt(ciphertext, filtered_stream,
-                                   GPGME_PROTOCOL_CMS, parent, err);
-    } else {
-        *signature =
-            libbalsa_gpgme_verify(ciphertext, filtered_stream,
-                                  GPGME_PROTOCOL_CMS, TRUE, err);
-    }
+    if (g_ascii_strcasecmp(smime_type, "enveloped-data") == 0)
+       *signature =
+           libbalsa_gpgme_decrypt(ciphertext, filtered_stream,
+                                  GPGME_PROTOCOL_CMS, parent, err);
+    else
+       *signature =
+           libbalsa_gpgme_verify(ciphertext, filtered_stream,
+                                 GPGME_PROTOCOL_CMS, TRUE, err);
     if (!*signature) {
-        g_object_unref(filtered_stream);
-        g_object_unref(ciphertext);
-        g_object_unref(stream);
+       g_object_unref(filtered_stream);
+       g_object_unref(ciphertext);
+       g_object_unref(stream);
 
-        return NULL;
+       return NULL;
     }
 
     g_mime_stream_flush(filtered_stream);
@@ -124,12 +122,11 @@ g_mime_application_pkcs7_decrypt_verify(GMimePart          *pkcs7,
     decrypted = g_mime_parser_construct_part(parser);
     g_object_unref(parser);
 
-    if (decrypted) {
-        g_object_ref(decrypted);
-    } else {
-        g_set_error(err, GMIME_PKCS7_ERR_QUARK, 42,
-                    _("Failed to decrypt MIME part: parse error"));
-    }
+    if (decrypted)
+       g_object_ref(decrypted);
+    else
+       g_set_error(err, GMIME_PKCS7_ERR_QUARK, 42,
+                   _("Failed to decrypt MIME part: parse error"));
 
     return decrypted;
 }
@@ -142,50 +139,48 @@ g_mime_application_pkcs7_decrypt_verify(GMimePart          *pkcs7,
  * about the reason.
  */
 gboolean
-g_mime_application_pkcs7_encrypt(GMimePart   *pkcs7,
-                                 GMimeObject *content,
-                                 GPtrArray   *recipients,
-                                 gboolean     trust_all,
-                                 GtkWindow   *parent,
-                                 GError     **err)
+g_mime_application_pkcs7_encrypt(GMimePart * pkcs7, GMimeObject * content,
+                                GPtrArray * recipients,
+                                gboolean trust_all, GtkWindow * parent,
+                                GError ** err)
 {
     GMimeDataWrapper *wrapper;
     GMimeStream *filtered_stream;
     GMimeStream *stream, *ciphertext;
     GMimeFilter *crlf_filter;
-
+       
     g_return_val_if_fail(GMIME_IS_PART(pkcs7), FALSE);
     g_return_val_if_fail(GMIME_IS_OBJECT(content), FALSE);
-
+       
     /* get the cleartext */
     stream = g_mime_stream_mem_new();
     filtered_stream = g_mime_stream_filter_new(stream);
-
+       
     crlf_filter = g_mime_filter_crlf_new(TRUE, FALSE);
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(filtered_stream),
-                             crlf_filter);
+                            crlf_filter);
     g_object_unref(crlf_filter);
-
+       
     g_mime_object_write_to_stream(content, filtered_stream);
     g_mime_stream_flush(filtered_stream);
     g_object_unref(filtered_stream);
-
+       
     /* reset the content stream */
     g_mime_stream_reset(stream);
-
+       
     /* encrypt the content stream */
     ciphertext = g_mime_stream_mem_new();
     if (!libbalsa_gpgme_encrypt
-            (recipients, NULL, stream, ciphertext, GPGME_PROTOCOL_CMS, TRUE,
-            trust_all, parent, err)) {
-        g_object_unref(ciphertext);
-        g_object_unref(stream);
-        return FALSE;
+       (recipients, NULL, stream, ciphertext, GPGME_PROTOCOL_CMS, TRUE,
+        trust_all, parent, err)) {
+       g_object_unref(ciphertext);
+       g_object_unref(stream);
+       return FALSE;
     }
-
+       
     g_object_unref(stream);
     g_mime_stream_reset(ciphertext);
-
+       
     /* set the encrypted mime part as content of the pkcs7 object */
     wrapper = g_mime_data_wrapper_new();
     g_mime_data_wrapper_set_stream(wrapper, ciphertext);
@@ -193,15 +188,15 @@ g_mime_application_pkcs7_encrypt(GMimePart   *pkcs7,
     g_mime_part_set_content_object(GMIME_PART(pkcs7), wrapper);
     g_mime_part_set_filename(GMIME_PART(pkcs7), "smime.p7m");
     g_mime_part_set_content_encoding(GMIME_PART(pkcs7),
-                                     GMIME_CONTENT_ENCODING_BASE64);
+                                    GMIME_CONTENT_ENCODING_BASE64);
     g_object_unref(wrapper);
 
     /* set the content-type params for this part */
     g_mime_object_set_content_type_parameter(GMIME_OBJECT(pkcs7),
-                                             "smime-type",
-                                             "enveloped-data");
+                                            "smime-type",
+                                            "enveloped-data");
     g_mime_object_set_content_type_parameter(GMIME_OBJECT(pkcs7), "name",
-                                             "smime.p7m");
-
+                                            "smime.p7m");
+       
     return TRUE;
 }
diff --git a/libbalsa/gmime-application-pkcs7.h b/libbalsa/gmime-application-pkcs7.h
index 3a64657..e419a9f 100644
--- a/libbalsa/gmime-application-pkcs7.h
+++ b/libbalsa/gmime-application-pkcs7.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -25,19 +25,19 @@ G_BEGIN_DECLS
 #include <gmime/gmime.h>
 
 
-GMimeObject *g_mime_application_pkcs7_decrypt_verify(GMimePart *pkcs7,
-                                                     GMimeGpgmeSigstat
-                                                              **signature,
-                                                     GtkWindow *
-                                                     parent,
-                                                     GError   **err);
-gboolean g_mime_application_pkcs7_encrypt(GMimePart   *pkcs7,
-                                          GMimeObject *content,
-                                          GPtrArray   *recipients,
-                                          gboolean     trust_all,
-                                          GtkWindow   *parent,
-                                          GError     **err);
+    GMimeObject *g_mime_application_pkcs7_decrypt_verify(GMimePart * pkcs7,
+                                                        GMimeGpgmeSigstat
+                                                        ** signature,
+                                                        GtkWindow *
+                                                        parent,
+                                                        GError ** err);
+       gboolean g_mime_application_pkcs7_encrypt(GMimePart * pkcs7,
+                                 GMimeObject * content,
+                                        GPtrArray * recipients,
+                                        gboolean trust_all,
+                                        GtkWindow * parent,
+                                        GError ** err);
 
 G_END_DECLS
 
-#endif                          /* __GMIME_APPLICATION_PKCS7_H__ */
+#endif                         /* __GMIME_APPLICATION_PKCS7_H__ */
diff --git a/libbalsa/gmime-filter-header.c b/libbalsa/gmime-filter-header.c
index f95c9f9..2568b5a 100644
--- a/libbalsa/gmime-filter-header.c
+++ b/libbalsa/gmime-filter-header.c
@@ -1,25 +1,18 @@
 /* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
 /* GMime message header filter
  * Written/Copyright (c) by Albrecht Dreß <albrecht dress arcor de> 2017
- * This module remove RFC 822 massage headers which shall not be sent to the MTA from from a
- * message stream, including Bcc, Status,
+ * This module remove RFC 822 massage headers which shall not be sent to the MTA from from a message stream, 
including Bcc, Status,
  * X-Status and X-Balsa-*.
  *
- * The basic structure of this file has been shamelessly stolen from the gmime-filter-* files,
- * written by Jeffrey Stedfast.
+ * The basic structure of this file has been shamelessly stolen from the gmime-filter-* files, written by 
Jeffrey Stedfast.
  *
- * This library is free software; you can redistribute it and/or modify it under the terms of
- * the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 
General Public License
+ * as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any 
later version.
  *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
- * License for more details.
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 
the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
details.
  *
- * You should have received a copy of the GNU Lesser General Public License along with this
- * library; if not, write to the Free
+ * You should have received a copy of the GNU Lesser General Public License along with this library; if not, 
write to the Free
  * Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
@@ -29,20 +22,10 @@
 static void g_mime_filter_header_class_init(GMimeFilterHeaderClass *klass);
 
 static GMimeFilter *filter_copy(GMimeFilter *filter);
-static void filter_filter(GMimeFilter *filter,
-                          char        *in,
-                          size_t       len,
-                          size_t       prespace,
-                          char       **out,
-                          size_t      *outlen,
-                          size_t      *outprespace);
-static void filter_complete(GMimeFilter *filter,
-                            char        *in,
-                            size_t       len,
-                            size_t       prespace,
-                            char       **out,
-                            size_t      *outlen,
-                            size_t      *outprespace);
+static void filter_filter(GMimeFilter *filter, char *in, size_t len, size_t prespace, char **out, size_t 
*outlen,
+                                                 size_t *outprespace);
+static void filter_complete(GMimeFilter *filter, char *in, size_t len, size_t prespace, char **out, size_t 
*outlen,
+                                                       size_t *outprespace);
 static void filter_reset(GMimeFilter *filter);
 
 
@@ -52,125 +35,109 @@ G_DEFINE_TYPE(GMimeFilterHeader, g_mime_filter_header, GMIME_TYPE_FILTER)
 static void
 g_mime_filter_header_class_init(GMimeFilterHeaderClass *klass)
 {
-    GMimeFilterClass *filter_class = GMIME_FILTER_CLASS(klass);
+       GMimeFilterClass *filter_class = GMIME_FILTER_CLASS(klass);
 
-    filter_class->copy = filter_copy;
-    filter_class->filter = filter_filter;
-    filter_class->complete = filter_complete;
-    filter_class->reset = filter_reset;
+       filter_class->copy = filter_copy;
+       filter_class->filter = filter_filter;
+       filter_class->complete = filter_complete;
+       filter_class->reset = filter_reset;
 }
 
-
 static void
 g_mime_filter_header_init(GMimeFilterHeader *self)
 {
-    self->headers_done = FALSE;
-    self->drop_header = FALSE;
+       self->headers_done = FALSE;
+       self->drop_header = FALSE;
 }
 
-
 static GMimeFilter *
 filter_copy(GMimeFilter *filter)
 {
-    return g_mime_filter_header_new();
+       return g_mime_filter_header_new();
 }
 
-
 static void
-filter_filter(GMimeFilter *filter,
-              char        *inbuf,
-              size_t       inlen,
-              size_t       prespace,
-              char       **outbuf,
-              size_t      *outlen,
-              size_t      *outprespace)
+filter_filter(GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
+                 char **outbuf, size_t *outlen, size_t *outprespace)
 {
-    GMimeFilterHeader *self = GMIME_FILTER_HEADER(filter);
-
-    g_mime_filter_set_size(filter, inlen, FALSE);
-
-    if (self->headers_done) {
-        memcpy(filter->outbuf, inbuf, inlen);
-        *outlen = inlen;
-    } else {
-        gchar *newline;
-        gchar *outptr;
-
-        outptr = filter->outbuf;
-        *outlen = 0U;
-        newline = memchr(inbuf, '\n', inlen);
-        while ((newline != NULL) && !self->headers_done) {
-            size_t count;
-
-            /* number of chars in this line */
-            count = (newline - inbuf) + 1U;
-
-            /* check for for folded header continuation */
-            if ((inbuf[0] == ' ') || (inbuf[0] == '\t')) {
-                /* nothing to do, do not change the state */
-            } else if (newline == inbuf) {
-                self->headers_done = TRUE;
-            } else if (((count >= 4U) && (g_ascii_strncasecmp(inbuf, "Bcc:", 4U) == 0)) ||
-                       ((count >= 7U) && (g_ascii_strncasecmp(inbuf, "Status:", 7U) == 0)) ||
-                       ((count >= 9U) && (g_ascii_strncasecmp(inbuf, "X-Status:", 9U) == 0)) ||
-                       ((count >= 8U) && (g_ascii_strncasecmp(inbuf, "X-Balsa-", 8U) == 0))) {
-                self->drop_header = TRUE;
-            } else {
-                self->drop_header = FALSE;
-            }
-
-            /* copy if we want to keep this header */
-            if (!self->drop_header) {
-                memcpy(outptr, inbuf, count);
-                outptr = &outptr[count];
-                *outlen += count;
-            }
-
-            /* adjust */
-            inbuf = &inbuf[count];
-            inlen -= count;
-            if (!self->headers_done && (inlen > 0)) {
-                newline = memchr(inbuf, '\n', inlen);
-            } else {
-                newline = NULL;
-            }
-        }
-
-        /* back up left-over data */
-        if (inlen > 0U) {
-            g_mime_filter_backup(filter, inbuf, inlen);
-        }
-    }
-    *outprespace = filter->outpre;
-    *outbuf = filter->outbuf;
+       GMimeFilterHeader *self = GMIME_FILTER_HEADER(filter);
+
+       g_mime_filter_set_size(filter, inlen, FALSE);
+
+       if (self->headers_done) {
+               memcpy(filter->outbuf, inbuf, inlen);
+               *outlen = inlen;
+       } else {
+               gchar *newline;
+               gchar *outptr;
+
+               outptr = filter->outbuf;
+               *outlen = 0U;
+               newline = memchr(inbuf, '\n', inlen);
+               while ((newline != NULL) && !self->headers_done) {
+                       size_t count;
+
+                       /* number of chars in this line */
+                       count = (newline - inbuf) + 1U;
+
+                       /* check for for folded header continuation */
+                       if ((inbuf[0] == ' ') || (inbuf[0] == '\t')) {
+                               /* nothing to do, do not change the state */
+                       } else if (newline == inbuf) {
+                               self->headers_done = TRUE;
+                       } else if (((count >= 4U) && (g_ascii_strncasecmp(inbuf, "Bcc:", 4U) == 0)) ||
+                                          ((count >= 7U) && (g_ascii_strncasecmp(inbuf, "Status:", 7U) == 
0)) ||
+                                          ((count >= 9U) && (g_ascii_strncasecmp(inbuf, "X-Status:", 9U) == 
0)) ||
+                                          ((count >= 8U) && (g_ascii_strncasecmp(inbuf, "X-Balsa-", 8U) == 
0))) {
+                               self->drop_header = TRUE;
+                       } else {
+                               self->drop_header = FALSE;
+                       }
+
+                       /* copy if we want to keep this header */
+                       if (!self->drop_header) {
+                               memcpy(outptr, inbuf, count);
+                               outptr = &outptr[count];
+                               *outlen += count;
+                       }
+
+                       /* adjust */
+                       inbuf = &inbuf[count];
+                       inlen -= count;
+                       if (!self->headers_done && (inlen > 0)) {
+                               newline = memchr(inbuf, '\n', inlen);
+                       } else {
+                               newline = NULL;
+                       }
+               }
+
+               /* back up left-over data */
+               if (inlen > 0U) {
+                       g_mime_filter_backup(filter, inbuf, inlen);
+               }
+       }
+       *outprespace = filter->outpre;
+       *outbuf = filter->outbuf;
 }
 
-
 static void
-filter_complete(GMimeFilter *filter,
-                char        *inbuf,
-                size_t       inlen,
-                size_t       prespace,
-                char       **outbuf,
-                size_t      *outlen,
-                size_t      *outprespace)
+filter_complete(GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
+                               char **outbuf, size_t *outlen, size_t *outprespace)
 {
-    filter_filter(filter, inbuf, inlen, prespace, outbuf, outlen, outprespace);
+       filter_filter(filter, inbuf, inlen, prespace, outbuf, outlen, outprespace);
 }
 
-
 static void
 filter_reset(GMimeFilter *filter)
 {
 }
 
-
 GMimeFilter *
 g_mime_filter_header_new()
 {
-    GMimeFilterHeader *header;
+       GMimeFilterHeader *header;
 
-    header = g_object_new(GMIME_TYPE_FILTER_HEADER, NULL);
+       header = g_object_new(GMIME_TYPE_FILTER_HEADER, NULL);
 
-    return (GMimeFilter *) header;
+       return (GMimeFilter *) header;
 }
diff --git a/libbalsa/gmime-filter-header.h b/libbalsa/gmime-filter-header.h
index 3d5dd2c..34095aa 100644
--- a/libbalsa/gmime-filter-header.h
+++ b/libbalsa/gmime-filter-header.h
@@ -1,25 +1,18 @@
 /* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
 /* GMime message header filter
  * Written/Copyright (c) by Albrecht Dreß <albrecht dress arcor de> 2017
- * This module remove RFC 822 massage headers which shall not be sent to the MTA from from a
- * message stream, including Bcc, Status,
+ * This module remove RFC 822 massage headers which shall not be sent to the MTA from from a message stream, 
including Bcc, Status,
  * X-Status and X-Balsa-*.
  *
- * The basic structure of this file has been shamelessly stolen from the gmime-filter-* files,
- * written by Jeffrey Stedfast.
+ * The basic structure of this file has been shamelessly stolen from the gmime-filter-* files, written by 
Jeffrey Stedfast.
  *
- * This library is free software; you can redistribute it and/or modify it under the terms of
- * the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 
General Public License
+ * as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any 
later version.
  *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
- * License for more details.
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 
the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
details.
  *
- * You should have received a copy of the GNU Lesser General Public License along with this
- * library; if not, write to the Free
+ * You should have received a copy of the GNU Lesser General Public License along with this library; if not, 
write to the Free
  * Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
@@ -31,31 +24,23 @@
 G_BEGIN_DECLS
 
 #define GMIME_TYPE_FILTER_HEADER            (g_mime_filter_header_get_type())
-#define GMIME_FILTER_HEADER(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), \
-                                                                        GMIME_TYPE_FILTER_HEADER, \
-                                                                        GMimeFilterHeader))
-#define GMIME_FILTER_HEADER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), \
-                                                                     GMIME_TYPE_FILTER_HEADER, \
-                                                                     GMimeFilterHeaderClass))
-#define GMIME_IS_FILTER_HEADER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
-                                                                        GMIME_TYPE_FILTER_HEADER))
-#define GMIME_IS_FILTER_HEADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), \
-                                                                     GMIME_TYPE_FILTER_HEADER))
-#define GMIME_FILTER_HEADER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), \
-                                                                       GMIME_TYPE_FILTER_HEADER, \
-                                                                       GMimeFilterHeaderClass))
+#define GMIME_FILTER_HEADER(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GMIME_TYPE_FILTER_HEADER, 
GMimeFilterHeader))
+#define GMIME_FILTER_HEADER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GMIME_TYPE_FILTER_HEADER, 
GMimeFilterHeaderClass))
+#define GMIME_IS_FILTER_HEADER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GMIME_TYPE_FILTER_HEADER))
+#define GMIME_IS_FILTER_HEADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GMIME_TYPE_FILTER_HEADER))
+#define GMIME_FILTER_HEADER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GMIME_TYPE_FILTER_HEADER, 
GMimeFilterHeaderClass))
 
 typedef struct _GMimeFilterHeader GMimeFilterHeader;
 typedef struct _GMimeFilterHeaderClass GMimeFilterHeaderClass;
 
 struct _GMimeFilterHeader {
-    GMimeFilter parent_object;
-    gboolean headers_done;
-    gboolean drop_header;
+       GMimeFilter parent_object;
+       gboolean headers_done;
+       gboolean drop_header;
 };
 
 struct _GMimeFilterHeaderClass {
-    GMimeFilterClass parent_class;
+       GMimeFilterClass parent_class;
 };
 
 GType g_mime_filter_header_get_type(void);
diff --git a/libbalsa/gmime-gpgme-signature.c b/libbalsa/gmime-gpgme-signature.c
index 8bff553..746a60e 100644
--- a/libbalsa/gmime-gpgme-signature.c
+++ b/libbalsa/gmime-gpgme-signature.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <ctype.h>
@@ -34,7 +34,7 @@
 #include "gmime-gpgme-signature.h"
 
 #ifdef G_LOG_DOMAIN
-#   undef G_LOG_DOMAIN
+#  undef G_LOG_DOMAIN
 #endif
 #define G_LOG_DOMAIN "crypto"
 
@@ -43,8 +43,8 @@
 static GObjectClass *g_mime_gpgme_sigstat_parent_class = NULL;
 
 static void g_mime_gpgme_sigstat_class_init(GMimeGpgmeSigstatClass *
-                                            klass);
-static void g_mime_gpgme_sigstat_finalize(GMimeGpgmeSigstat *self);
+                                           klass);
+static void g_mime_gpgme_sigstat_finalize(GMimeGpgmeSigstat * self);
 
 
 /* GMimeGpgmeSigstat related stuff */
@@ -54,22 +54,22 @@ g_mime_gpgme_sigstat_get_type(void)
     static GType g_mime_gpgme_sigstat_type = 0;
 
     if (!g_mime_gpgme_sigstat_type) {
-        static const GTypeInfo g_mime_gpgme_sigstat_info = {
-            sizeof(GMimeGpgmeSigstatClass),     /* class_size */
-            NULL,               /* base_init */
-            NULL,               /* base_finalize */
-            (GClassInitFunc) g_mime_gpgme_sigstat_class_init,   /* class_init */
-            NULL,               /* class_finalize */
-            NULL,               /* class_data */
-            sizeof(GMimeGpgmeSigstat),  /* instance_size */
-            0,                  /* n_preallocs */
-            NULL,           /* instance_init */
-            /* no value_table */
-        };
-
-        g_mime_gpgme_sigstat_type =
-            g_type_register_static(G_TYPE_OBJECT, "GMimeGpgmeSigstat",
-                                   &g_mime_gpgme_sigstat_info, 0);
+       static const GTypeInfo g_mime_gpgme_sigstat_info = {
+           sizeof(GMimeGpgmeSigstatClass),     /* class_size */
+           NULL,               /* base_init */
+           NULL,               /* base_finalize */
+           (GClassInitFunc) g_mime_gpgme_sigstat_class_init,   /* class_init */
+           NULL,               /* class_finalize */
+           NULL,               /* class_data */
+           sizeof(GMimeGpgmeSigstat),  /* instance_size */
+           0,                  /* n_preallocs */
+           NULL,           /* instance_init */
+           /* no value_table */
+       };
+
+       g_mime_gpgme_sigstat_type =
+           g_type_register_static(G_TYPE_OBJECT, "GMimeGpgmeSigstat",
+                                  &g_mime_gpgme_sigstat_info, 0);
     }
 
     return g_mime_gpgme_sigstat_type;
@@ -79,11 +79,11 @@ g_mime_gpgme_sigstat_get_type(void)
 GMimeGpgmeSigstat *
 g_mime_gpgme_sigstat_new(gpgme_ctx_t ctx)
 {
-    GMimeGpgmeSigstat *result;
+       GMimeGpgmeSigstat *result;
 
-    result = GMIME_GPGME_SIGSTAT(g_object_new(GMIME_TYPE_GPGME_SIGSTAT, NULL));
-    result->protocol = gpgme_get_protocol(ctx);
-    result->status = GPG_ERR_NOT_SIGNED;
+       result = GMIME_GPGME_SIGSTAT(g_object_new(GMIME_TYPE_GPGME_SIGSTAT, NULL));
+       result->protocol = gpgme_get_protocol(ctx);
+       result->status = GPG_ERR_NOT_SIGNED;
     return result;
 }
 
@@ -108,47 +108,42 @@ g_mime_gpgme_sigstat_new_from_gpgme_ctx(gpgme_ctx_t ctx)
         sig_stat->validity = result->signatures->validity;
     }
 
-    return sig_stat;
+       return sig_stat;
 }
 
-
 void
 g_mime_gpgme_sigstat_load_key(GMimeGpgmeSigstat *sigstat)
 {
-    g_return_if_fail(GMIME_IS_GPGME_SIGSTAT(sigstat));
+       g_return_if_fail(GMIME_IS_GPGME_SIGSTAT(sigstat));
 
-    if ((sigstat->key == NULL) && ((sigstat->summary & GPGME_SIGSUM_KEY_MISSING) == 0)) {
-        gpgme_ctx_t ctx;
+       if ((sigstat->key == NULL) && ((sigstat->summary & GPGME_SIGSUM_KEY_MISSING) == 0)) {
+               gpgme_ctx_t ctx;
 
-        ctx = libbalsa_gpgme_new_with_proto(sigstat->protocol, NULL, NULL, NULL);
-        sigstat->key = libbalsa_gpgme_load_key(ctx, sigstat->fingerprint, NULL);
-        gpgme_release(ctx);
-    }
+               ctx = libbalsa_gpgme_new_with_proto(sigstat->protocol, NULL, NULL, NULL);
+               sigstat->key = libbalsa_gpgme_load_key(ctx, sigstat->fingerprint, NULL);
+               gpgme_release(ctx);
+       }
 }
 
-
 const gchar *
 g_mime_gpgme_sigstat_protocol_name(const GMimeGpgmeSigstat *sigstat)
 {
-    g_return_val_if_fail(GMIME_IS_GPGME_SIGSTAT(sigstat), NULL);
+       g_return_val_if_fail(GMIME_IS_GPGME_SIGSTAT(sigstat), NULL);
 
     switch (sigstat->protocol) {
     case GPGME_PROTOCOL_OpenPGP:
-        return _("PGP signature: ");
-
+       return _("PGP signature: ");
     case GPGME_PROTOCOL_CMS:
-        return _("S/MIME signature: ");
-
+       return _("S/MIME signature: ");
     default:
-        return _("(unknown protocol) ");
+       return _("(unknown protocol) ");
     }
 }
 
-
 static inline void
 append_time_t(GString     *str,
-              const gchar *format,
-              time_t       when,
+                         const gchar *format,
+                         time_t       when,
               const gchar *date_string)
 {
     if (when != (time_t) 0) {
@@ -160,11 +155,10 @@ append_time_t(GString     *str,
     }
 }
 
-
 gchar *
 g_mime_gpgme_sigstat_to_gchar(const GMimeGpgmeSigstat *info,
-                              gboolean                 full_details,
-                              const gchar             *date_string)
+                                                         gboolean                 full_details,
+                                                         const gchar             *date_string)
 {
     GString *msg;
 
@@ -172,20 +166,19 @@ g_mime_gpgme_sigstat_to_gchar(const GMimeGpgmeSigstat *info,
     g_return_val_if_fail(date_string != NULL, NULL);
     msg = g_string_new(g_mime_gpgme_sigstat_protocol_name(info));
     msg = g_string_append(msg, libbalsa_gpgme_sig_stat_to_gchar(info->status));
-    g_string_append_printf(msg, _("\nSignature validity: %s"),
-                           libbalsa_gpgme_validity_to_gchar(info->validity));
+    g_string_append_printf(msg, _("\nSignature validity: %s"), libbalsa_gpgme_validity_to_gchar(info-> 
validity));
     append_time_t(msg, _("\nSigned on: %s"), info->sign_time, date_string);
     if (info->fingerprint) {
-        g_string_append_printf(msg, _("\nKey fingerprint: %s"), info->fingerprint);
+       g_string_append_printf(msg, _("\nKey fingerprint: %s"), info->fingerprint);
     }
 
     /* append key data */
     if (full_details && (info->key != NULL)) {
-        gchar *key_data;
+       gchar *key_data;
 
-        key_data = libbalsa_gpgme_key_to_gchar(info->key, info->fingerprint);
-        g_string_append_printf(msg, "\n%s", key_data);
-        g_free(key_data);
+       key_data = libbalsa_gpgme_key_to_gchar(info->key, info->fingerprint);
+       g_string_append_printf(msg, "\n%s", key_data);
+       g_free(key_data);
     }
 
     return g_string_free(msg, FALSE);
@@ -193,28 +186,25 @@ g_mime_gpgme_sigstat_to_gchar(const GMimeGpgmeSigstat *info,
 
 
 static void
-g_mime_gpgme_sigstat_class_init(GMimeGpgmeSigstatClass *klass)
+g_mime_gpgme_sigstat_class_init(GMimeGpgmeSigstatClass * klass)
 {
     GObjectClass *gobject_klass = G_OBJECT_CLASS(klass);
     g_mime_gpgme_sigstat_parent_class = g_type_class_peek(G_TYPE_OBJECT);
 
     gobject_klass->finalize =
-        (GObjectFinalizeFunc) g_mime_gpgme_sigstat_finalize;
+       (GObjectFinalizeFunc) g_mime_gpgme_sigstat_finalize;
 }
 
-
 static void
-g_mime_gpgme_sigstat_finalize(GMimeGpgmeSigstat *self)
+g_mime_gpgme_sigstat_finalize(GMimeGpgmeSigstat * self)
 {
     g_free(self->fingerprint);
-    if (self->key) {
-        gpgme_key_unref(self->key);
-    }
+    if (self->key)
+       gpgme_key_unref(self->key);
 
     g_mime_gpgme_sigstat_parent_class->finalize(G_OBJECT(self));
 }
 
-
 static gchar *
 hex_decode(const gchar *hexstr)
 {
@@ -223,29 +213,25 @@ hex_decode(const gchar *hexstr)
     int inlen;
 
     inlen = strlen(hexstr);
-    if ((inlen & 1) == 1) {
+    if ((inlen & 1) == 1)
         return g_strdup(hexstr);
-    }
 
     result = g_new0(gchar, (inlen >> 1) + 1);
     for (outp = result; *hexstr; outp++) {
-        if (isdigit(*hexstr)) {
+        if (isdigit(*hexstr))
             *outp = (*hexstr - '0') << 4;
-        } else {
-            *outp = (toupper(*hexstr) - 'A' + 10) << 4;
-        }
+        else
+            *outp = (toupper(*hexstr) -'A' + 10) << 4;
         hexstr++;
-        if (isdigit(*hexstr)) {
+        if (isdigit(*hexstr))
             *outp |= *hexstr - '0';
-        } else {
-            *outp |= toupper(*hexstr) - 'A' + 10;
-        }
+        else
+            *outp |= toupper(*hexstr) -'A' + 10;
         hexstr++;
     }
     return result;
 }
 
-
 /*
  * Change some fields in a S/MIME certificate to human-readable text.
  * Note: doesn't do any sophisticated error-checking...
@@ -268,9 +254,8 @@ libbalsa_cert_subject_readable(const gchar *subject)
     GString *result;
     gchar *readable_subject;
 
-    if (!subject) {
+    if (!subject)
         return NULL;
-    }
 
     result = g_string_new(NULL);
     elements = g_strsplit(subject, ",", -1);
@@ -282,30 +267,25 @@ libbalsa_cert_subject_readable(const gchar *subject)
             *equals++ = '\0';
             for (ldap_elem = ldap_id_list;
                  ldap_elem->ldap_id && strcmp(ldap_elem->ldap_id, elements[n]);
-                 ldap_elem++) {
-            }
-            if (ldap_elem->ldap_id) {
+                 ldap_elem++);
+            if (ldap_elem->ldap_id)
                 result = g_string_append(result, ldap_elem->readable);
-            } else {
+            else
                 result = g_string_append(result, elements[n]);
-            }
             result = g_string_append_c(result, '=');
-
+            
             if (*equals == '#') {
                 gchar *decoded;
 
                 decoded = hex_decode(equals + 1);
                 result = g_string_append(result, decoded);
                 g_free(decoded);
-            } else {
+            } else
                 result = g_string_append(result, equals);
-            }
-        } else {
+        } else
             result = g_string_append(result, elements[n]);
-        }
-        if (elements[n + 1]) {
+        if (elements[n + 1])
             result = g_string_append_c(result, ',');
-        }
     }
     g_strfreev(elements);
     readable_subject = g_string_free(result, FALSE);
diff --git a/libbalsa/gmime-gpgme-signature.h b/libbalsa/gmime-gpgme-signature.h
index 7c021c8..7fde9d0 100644
--- a/libbalsa/gmime-gpgme-signature.h
+++ b/libbalsa/gmime-gpgme-signature.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -26,20 +26,12 @@
 G_BEGIN_DECLS
 
 /* the signature status as returned by gpgme as a GObject */
-#define GMIME_TYPE_GPGME_SIGSTAT            (g_mime_gpgme_sigstat_get_type())
-#define GMIME_GPGME_SIGSTAT(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), \
-                                                                        GMIME_TYPE_GPGME_SIGSTAT, \
-                                                                        GMimeGpgmeSigstat))
-#define GMIME_GPGME_SIGSTAT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), \
-                                                                     GMIME_TYPE_GPGME_SIGSTAT, \
-                                                                     GMimeGpgmeSigstatClass))
-#define GMIME_IS_GPGME_SIGSTAT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
-                                                                        GMIME_TYPE_GPGME_SIGSTAT))
-#define GMIME_IS_GPGME_SIGSTAT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), \
-                                                                     GMIME_TYPE_GPGME_SIGSTAT))
-#define GMIME_GPGME_SIGSTAT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), \
-                                                                       GMIME_TYPE_GPGME_SIGSTAT, \
-                                                                       GMimeGpgmeSigstatClass))
+#define GMIME_TYPE_GPGME_SIGSTAT           (g_mime_gpgme_sigstat_get_type())
+#define GMIME_GPGME_SIGSTAT(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GMIME_TYPE_GPGME_SIGSTAT, 
GMimeGpgmeSigstat))
+#define GMIME_GPGME_SIGSTAT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GMIME_TYPE_GPGME_SIGSTAT, 
GMimeGpgmeSigstatClass))
+#define GMIME_IS_GPGME_SIGSTAT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GMIME_TYPE_GPGME_SIGSTAT))
+#define GMIME_IS_GPGME_SIGSTAT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GMIME_TYPE_GPGME_SIGSTAT))
+#define GMIME_GPGME_SIGSTAT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GMIME_TYPE_GPGME_SIGSTAT, 
GMimeGpgmeSigstatClass))
 
 typedef struct _GMimeGpgmeSigstat GMimeGpgmeSigstat;
 typedef struct _GMimeGpgmeSigstatClass GMimeGpgmeSigstatClass;
@@ -67,21 +59,21 @@ struct _GMimeGpgmeSigstatClass {
 
 GType g_mime_gpgme_sigstat_get_type(void);
 GMimeGpgmeSigstat *g_mime_gpgme_sigstat_new(gpgme_ctx_t ctx)
-G_GNUC_WARN_UNUSED_RESULT;
+       G_GNUC_WARN_UNUSED_RESULT;
 GMimeGpgmeSigstat *g_mime_gpgme_sigstat_new_from_gpgme_ctx(gpgme_ctx_t ctx)
-G_GNUC_WARN_UNUSED_RESULT;
+       G_GNUC_WARN_UNUSED_RESULT;
 void g_mime_gpgme_sigstat_load_key(GMimeGpgmeSigstat *sigstat);
 
 const gchar *g_mime_gpgme_sigstat_protocol_name(const GMimeGpgmeSigstat *sigstat);
 gchar *g_mime_gpgme_sigstat_to_gchar(const GMimeGpgmeSigstat *info,
-                                     gboolean                 full_details,
-                                     const gchar             *date_string)
-G_GNUC_WARN_UNUSED_RESULT;
+                                                                        gboolean                 
full_details,
+                                                                        const gchar             *date_string)
+       G_GNUC_WARN_UNUSED_RESULT;
 
 gchar *libbalsa_cert_subject_readable(const gchar *subject)
-G_GNUC_WARN_UNUSED_RESULT;
+       G_GNUC_WARN_UNUSED_RESULT;
 
 
 G_END_DECLS
 
-#endif                          /* __GMIME_GPGME_SIGNATURE_H__ */
+#endif                         /* __GMIME_GPGME_SIGNATURE_H__ */
diff --git a/libbalsa/gmime-multipart-crypt.c b/libbalsa/gmime-multipart-crypt.c
index 7f52f51..9457196 100644
--- a/libbalsa/gmime-multipart-crypt.c
+++ b/libbalsa/gmime-multipart-crypt.c
@@ -11,21 +11,21 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
-#endif                          /* HAVE_CONFIG_H */
+#include "config.h"
+#endif                         /* HAVE_CONFIG_H */
 
 #include <string.h>
 #include <unistd.h>
@@ -37,7 +37,7 @@
 
 
 #ifdef G_LOG_DOMAIN
-#   undef G_LOG_DOMAIN
+#  undef G_LOG_DOMAIN
 #endif
 #define G_LOG_DOMAIN "crypto"
 
@@ -53,7 +53,7 @@
  * Ref: RFC 3156, sect. 3.
  **/
 static void
-sign_prepare(GMimeObject *mime_part)
+sign_prepare(GMimeObject * mime_part)
 {
     GMimeContentEncoding encoding;
     GMimeObject *subpart;
@@ -62,40 +62,35 @@ sign_prepare(GMimeObject *mime_part)
         GMimeMultipart *multipart;
         int i, n;
 
-        multipart = (GMimeMultipart *) mime_part;
+       multipart = (GMimeMultipart *) mime_part;
 
-        if (GMIME_IS_MULTIPART_SIGNED(multipart) ||
-            GMIME_IS_MULTIPART_ENCRYPTED(multipart)) {
-            /* must not modify these parts as they must be treated as opaque */
-            return;
-        }
+       if (GMIME_IS_MULTIPART_SIGNED(multipart) ||
+           GMIME_IS_MULTIPART_ENCRYPTED(multipart)) {
+           /* must not modify these parts as they must be treated as opaque */
+           return;
+       }
 
-        n = g_mime_multipart_get_count(multipart);
-        for (i = 0; i < n; i++) {
-            subpart = g_mime_multipart_get_part(multipart, i);
-            sign_prepare(subpart);
-        }
+       n = g_mime_multipart_get_count(multipart);
+       for (i = 0; i < n; i++) {
+           subpart = g_mime_multipart_get_part(multipart, i);
+           sign_prepare(subpart);
+       }
     } else if (GMIME_IS_MESSAGE_PART(mime_part)) {
-        subpart = GMIME_MESSAGE_PART(mime_part)->message->mime_part;
-        sign_prepare(subpart);
+       subpart = GMIME_MESSAGE_PART(mime_part)->message->mime_part;
+       sign_prepare(subpart);
     } else {
-        encoding = g_mime_part_get_content_encoding(GMIME_PART(mime_part));
-        if ((encoding != GMIME_CONTENT_ENCODING_BASE64) &&
-            (encoding != GMIME_CONTENT_ENCODING_7BIT)) {
-            g_mime_part_set_content_encoding(GMIME_PART(mime_part),
-                                             GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE);
-        }
+       encoding = g_mime_part_get_content_encoding(GMIME_PART(mime_part));
+       if ((encoding != GMIME_CONTENT_ENCODING_BASE64) && (encoding != GMIME_CONTENT_ENCODING_7BIT))
+           g_mime_part_set_content_encoding(GMIME_PART(mime_part),
+                                            GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE);
     }
 }
 
 
 gboolean
-g_mime_gpgme_mps_sign(GMimeMultipartSigned *mps,
-                      GMimeObject          *content,
-                      const gchar          *userid,
-                      gpgme_protocol_t      protocol,
-                      GtkWindow            *parent,
-                      GError              **err)
+g_mime_gpgme_mps_sign(GMimeMultipartSigned * mps, GMimeObject * content,
+                     const gchar * userid, gpgme_protocol_t protocol,
+                     GtkWindow * parent, GError ** err)
 {
     GMimeStream *stream;
     GMimeStream *filtered;
@@ -125,8 +120,7 @@ g_mime_gpgme_mps_sign(GMimeMultipartSigned *mps,
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(filtered), filter);
     g_object_unref(filter);
 
-    /* Note: see rfc3156, section 5.4 (this is the main difference between rfc2015 and rfc3156)
-     */
+    /* Note: see rfc3156, section 5.4 (this is the main difference between rfc2015 and rfc3156) */
     filter = g_mime_filter_strip_new();
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(filtered), filter);
     g_object_unref(filter);
@@ -147,13 +141,13 @@ g_mime_gpgme_mps_sign(GMimeMultipartSigned *mps,
 
     /* sign the content stream */
     hash_algo =
-        libbalsa_gpgme_sign(userid, filtered, sigstream, protocol, FALSE,
-                            parent, err);
+       libbalsa_gpgme_sign(userid, filtered, sigstream, protocol, FALSE,
+                           parent, err);
     g_object_unref(filtered);
     if (hash_algo == GPGME_MD_NONE) {
-        g_object_unref(sigstream);
-        g_object_unref(stream);
-        return FALSE;
+       g_object_unref(sigstream);
+       g_object_unref(stream);
+       return FALSE;
     }
 
     g_mime_stream_reset(sigstream);
@@ -162,14 +156,14 @@ g_mime_gpgme_mps_sign(GMimeMultipartSigned *mps,
     /* set the multipart/signed protocol and micalg */
     content_type = g_mime_object_get_content_type(GMIME_OBJECT(mps));
     if (protocol == GPGME_PROTOCOL_OpenPGP) {
-        micalg =
-            g_strdup_printf("PGP-%s", gpgme_hash_algo_name(hash_algo));
-        proto_type = "application/pgp-signature";
-        sig_subtype = "pgp-signature";
+       micalg =
+           g_strdup_printf("PGP-%s", gpgme_hash_algo_name(hash_algo));
+       proto_type = "application/pgp-signature";
+       sig_subtype = "pgp-signature";
     } else {
-        micalg = g_strdup(gpgme_hash_algo_name(hash_algo));
-        proto_type = "application/pkcs7-signature";
-        sig_subtype = "pkcs7-signature";
+       micalg = g_strdup(gpgme_hash_algo_name(hash_algo));
+       proto_type = "application/pkcs7-signature";
+       sig_subtype = "pkcs7-signature";
     }
     g_mime_content_type_set_parameter(content_type, "micalg", micalg);
     g_free(micalg);
@@ -195,9 +189,9 @@ g_mime_gpgme_mps_sign(GMimeMultipartSigned *mps,
      * the CipherContext class - maybe ::sign can take/output a
      * GMimePart instead. */
     if (protocol == GPGME_PROTOCOL_CMS) {
-        g_mime_part_set_content_encoding(signature,
-                                         GMIME_CONTENT_ENCODING_BASE64);
-        g_mime_part_set_filename(signature, "smime.p7m");
+       g_mime_part_set_content_encoding(signature,
+                                        GMIME_CONTENT_ENCODING_BASE64);
+       g_mime_part_set_filename(signature, "smime.p7m");
     }
 
     /* save the content and signature parts */
@@ -212,8 +206,7 @@ g_mime_gpgme_mps_sign(GMimeMultipartSigned *mps,
 
 
 GMimeGpgmeSigstat *
-g_mime_gpgme_mps_verify(GMimeMultipartSigned *mps,
-                        GError              **error)
+g_mime_gpgme_mps_verify(GMimeMultipartSigned * mps, GError ** error)
 {
     const gchar *protocol;
     gpgme_protocol_t crypto_prot;
@@ -230,57 +223,54 @@ g_mime_gpgme_mps_verify(GMimeMultipartSigned *mps,
     g_return_val_if_fail(GMIME_IS_MULTIPART_SIGNED(mps), NULL);
 
     if (g_mime_multipart_get_count(GMIME_MULTIPART(mps)) < 2) {
-        g_set_error(error, GMIME_ERROR, GMIME_ERROR_PARSE_ERROR, "%s",
-                    _
-                        ("Cannot verify multipart/signed part due to missing subparts."));
-        return NULL;
+       g_set_error(error, GMIME_ERROR, GMIME_ERROR_PARSE_ERROR, "%s",
+                   _
+                   ("Cannot verify multipart/signed part due to missing subparts."));
+       return NULL;
     }
 
     /* grab the protocol so we can configure the GpgME context */
     protocol =
-        g_mime_object_get_content_type_parameter(GMIME_OBJECT(mps),
-                                                 "protocol");
+       g_mime_object_get_content_type_parameter(GMIME_OBJECT(mps),
+                                                "protocol");
     if (protocol) {
-        if (g_ascii_strcasecmp("application/pgp-signature", protocol) == 0) {
-            crypto_prot = GPGME_PROTOCOL_OpenPGP;
-        } else if ((g_ascii_strcasecmp
-                        ("application/pkcs7-signature", protocol) == 0)
-                   || (g_ascii_strcasecmp("application/x-pkcs7-signature",
-                                          protocol) == 0)) {
-            crypto_prot = GPGME_PROTOCOL_CMS;
-        } else {
-            crypto_prot = GPGME_PROTOCOL_UNKNOWN;
-        }
-    } else {
-        crypto_prot = GPGME_PROTOCOL_UNKNOWN;
-    }
+       if (g_ascii_strcasecmp("application/pgp-signature", protocol) == 0)
+           crypto_prot = GPGME_PROTOCOL_OpenPGP;
+       else if (g_ascii_strcasecmp
+                ("application/pkcs7-signature", protocol) == 0
+                || g_ascii_strcasecmp("application/x-pkcs7-signature",
+                                      protocol) == 0)
+           crypto_prot = GPGME_PROTOCOL_CMS;
+       else
+           crypto_prot = GPGME_PROTOCOL_UNKNOWN;
+    } else
+       crypto_prot = GPGME_PROTOCOL_UNKNOWN;
 
     /* eject on unknown protocols */
     if (crypto_prot == GPGME_PROTOCOL_UNKNOWN) {
-        g_set_error(error, GPGME_ERROR_QUARK, GPG_ERR_INV_VALUE,
-                    _("unsupported protocol “%s”"), protocol);
-        return NULL;
+       g_set_error(error, GPGME_ERROR_QUARK, GPG_ERR_INV_VALUE,
+                   _("unsupported protocol “%s”"), protocol);
+       return NULL;
     }
 
     signature =
-        g_mime_multipart_get_part(GMIME_MULTIPART(mps),
-                                  GMIME_MULTIPART_SIGNED_SIGNATURE);
+       g_mime_multipart_get_part(GMIME_MULTIPART(mps),
+                                 GMIME_MULTIPART_SIGNED_SIGNATURE);
 
     /* make sure the protocol matches the signature content-type */
     content_type = g_mime_content_type_to_string(signature->content_type);
     if (g_ascii_strcasecmp(content_type, protocol) != 0) {
-        g_set_error(error, GMIME_ERROR, GMIME_ERROR_PARSE_ERROR, "%s",
-                    _
-                    (
-                        "Cannot verify multipart/signed part: signature content-type does not match 
protocol."));
-        g_free(content_type);
-        return NULL;
+       g_set_error(error, GMIME_ERROR, GMIME_ERROR_PARSE_ERROR, "%s",
+                   _
+                   ("Cannot verify multipart/signed part: signature content-type does not match protocol."));
+       g_free(content_type);
+       return NULL;
     }
     g_free(content_type);
 
     content =
-        g_mime_multipart_get_part(GMIME_MULTIPART(mps),
-                                  GMIME_MULTIPART_SIGNED_CONTENT);
+       g_mime_multipart_get_part(GMIME_MULTIPART(mps),
+                                 GMIME_MULTIPART_SIGNED_CONTENT);
 
     /* get the content stream */
     stream = g_mime_stream_mem_new();
@@ -289,7 +279,7 @@ g_mime_gpgme_mps_verify(GMimeMultipartSigned *mps,
     /* Note: see rfc2015 or rfc3156, section 5.1 */
     crlf_filter = g_mime_filter_crlf_new(TRUE, FALSE);
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(filtered_stream),
-                             crlf_filter);
+                            crlf_filter);
     g_object_unref(crlf_filter);
 
     g_mime_object_write_to_stream(content, filtered_stream);
@@ -302,14 +292,14 @@ g_mime_gpgme_mps_verify(GMimeMultipartSigned *mps,
 
     /* a s/mime signature is always encoded, a pgp signature shouldn't,
      * but there exist implementations which encode it... */
-    sigstream = g_mime_stream_mem_new();
-    g_mime_data_wrapper_write_to_stream(wrapper, sigstream);
+       sigstream = g_mime_stream_mem_new();
+       g_mime_data_wrapper_write_to_stream(wrapper, sigstream);
     g_mime_stream_reset(sigstream);
 
     /* verify the signature */
     result =
-        libbalsa_gpgme_verify(stream, sigstream, crypto_prot, FALSE,
-                              error);
+       libbalsa_gpgme_verify(stream, sigstream, crypto_prot, FALSE,
+                             error);
     g_object_unref(stream);
     g_object_unref(sigstream);
 
@@ -318,12 +308,10 @@ g_mime_gpgme_mps_verify(GMimeMultipartSigned *mps,
 
 
 gboolean
-g_mime_gpgme_mpe_encrypt(GMimeMultipartEncrypted *mpe,
-                         GMimeObject             *content,
-                         GPtrArray               *recipients,
-                         gboolean                 trust_all,
-                         GtkWindow               *parent,
-                         GError                 **err)
+g_mime_gpgme_mpe_encrypt(GMimeMultipartEncrypted * mpe,
+                        GMimeObject * content, GPtrArray * recipients,
+                        gboolean trust_all, GtkWindow * parent,
+                        GError ** err)
 {
     GMimeStream *filtered_stream;
     GMimeStream *ciphertext;
@@ -342,7 +330,7 @@ g_mime_gpgme_mpe_encrypt(GMimeMultipartEncrypted *mpe,
 
     crlf_filter = g_mime_filter_crlf_new(TRUE, FALSE);
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(filtered_stream),
-                             crlf_filter);
+                            crlf_filter);
     g_object_unref(crlf_filter);
 
     g_mime_object_write_to_stream(content, filtered_stream);
@@ -355,11 +343,11 @@ g_mime_gpgme_mpe_encrypt(GMimeMultipartEncrypted *mpe,
     /* encrypt the content stream */
     ciphertext = g_mime_stream_mem_new();
     if (!libbalsa_gpgme_encrypt
-            (recipients, NULL, stream, ciphertext, GPGME_PROTOCOL_OpenPGP,
-            FALSE, trust_all, parent, err)) {
-        g_object_unref(ciphertext);
-        g_object_unref(stream);
-        return FALSE;
+       (recipients, NULL, stream, ciphertext, GPGME_PROTOCOL_OpenPGP,
+        FALSE, trust_all, parent, err)) {
+       g_object_unref(ciphertext);
+       g_object_unref(stream);
+       return FALSE;
     }
 
     g_object_unref(stream);
@@ -367,27 +355,27 @@ g_mime_gpgme_mpe_encrypt(GMimeMultipartEncrypted *mpe,
 
     /* construct the version part */
     version_part =
-        g_mime_part_new_with_type("application", "pgp-encrypted");
+       g_mime_part_new_with_type("application", "pgp-encrypted");
     g_mime_part_set_content_encoding(version_part,
-                                     GMIME_CONTENT_ENCODING_7BIT);
+                                    GMIME_CONTENT_ENCODING_7BIT);
     stream =
-        g_mime_stream_mem_new_with_buffer("Version: 1\n",
-                                          strlen("Version: 1\n"));
+       g_mime_stream_mem_new_with_buffer("Version: 1\n",
+                                         strlen("Version: 1\n"));
     wrapper =
-        g_mime_data_wrapper_new_with_stream(stream,
-                                            GMIME_CONTENT_ENCODING_7BIT);
+       g_mime_data_wrapper_new_with_stream(stream,
+                                           GMIME_CONTENT_ENCODING_7BIT);
     g_mime_part_set_content_object(version_part, wrapper);
     g_object_unref(wrapper);
     g_object_unref(stream);
 
     /* construct the encrypted mime part */
     encrypted_part =
-        g_mime_part_new_with_type("application", "octet-stream");
+       g_mime_part_new_with_type("application", "octet-stream");
     g_mime_part_set_content_encoding(encrypted_part,
-                                     GMIME_CONTENT_ENCODING_7BIT);
+                                    GMIME_CONTENT_ENCODING_7BIT);
     wrapper =
-        g_mime_data_wrapper_new_with_stream(ciphertext,
-                                            GMIME_CONTENT_ENCODING_7BIT);
+       g_mime_data_wrapper_new_with_stream(ciphertext,
+                                           GMIME_CONTENT_ENCODING_7BIT);
     g_mime_part_set_content_object(encrypted_part, wrapper);
     g_object_unref(ciphertext);
     g_object_unref(wrapper);
@@ -396,13 +384,13 @@ g_mime_gpgme_mpe_encrypt(GMimeMultipartEncrypted *mpe,
     /* FIXME: make sure there aren't any other parts?? */
     g_mime_multipart_add(GMIME_MULTIPART(mpe), GMIME_OBJECT(version_part));
     g_mime_multipart_add(GMIME_MULTIPART(mpe),
-                         GMIME_OBJECT(encrypted_part));
+                        GMIME_OBJECT(encrypted_part));
     g_object_unref(encrypted_part);
     g_object_unref(version_part);
 
     /* set the content-type params for this multipart/encrypted part */
     g_mime_object_set_content_type_parameter(GMIME_OBJECT(mpe), "protocol",
-                                             "application/pgp-encrypted");
+                                            "application/pgp-encrypted");
     g_mime_multipart_set_boundary(GMIME_MULTIPART(mpe), NULL);
 
     return TRUE;
@@ -410,7 +398,7 @@ g_mime_gpgme_mpe_encrypt(GMimeMultipartEncrypted *mpe,
 
 
 static GMimeStream *
-g_mime_data_wrapper_get_decoded_stream(GMimeDataWrapper *wrapper)
+g_mime_data_wrapper_get_decoded_stream(GMimeDataWrapper * wrapper)
 {
     GMimeStream *decoded_stream;
     GMimeFilter *decoder;
@@ -421,17 +409,16 @@ g_mime_data_wrapper_get_decoded_stream(GMimeDataWrapper *wrapper)
     case GMIME_CONTENT_ENCODING_BASE64:
     case GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE:
     case GMIME_CONTENT_ENCODING_UUENCODE:
-        decoder = g_mime_filter_basic_new(wrapper->encoding, FALSE);
-        decoded_stream = g_mime_stream_filter_new(wrapper->stream);
-        g_mime_stream_filter_add(GMIME_STREAM_FILTER(decoded_stream),
-                                 decoder);
-        g_object_unref(decoder);
-        break;
-
+       decoder = g_mime_filter_basic_new(wrapper->encoding, FALSE);
+       decoded_stream = g_mime_stream_filter_new(wrapper->stream);
+       g_mime_stream_filter_add(GMIME_STREAM_FILTER(decoded_stream),
+                                decoder);
+       g_object_unref(decoder);
+       break;
     default:
-        decoded_stream = wrapper->stream;
-        g_object_ref(wrapper->stream);
-        break;
+       decoded_stream = wrapper->stream;
+       g_object_ref(wrapper->stream);
+       break;
     }
 
     return decoded_stream;
@@ -439,10 +426,9 @@ g_mime_data_wrapper_get_decoded_stream(GMimeDataWrapper *wrapper)
 
 
 GMimeObject *
-g_mime_gpgme_mpe_decrypt(GMimeMultipartEncrypted *mpe,
-                         GMimeGpgmeSigstat      **signature,
-                         GtkWindow               *parent,
-                         GError                 **err)
+g_mime_gpgme_mpe_decrypt(GMimeMultipartEncrypted * mpe,
+                        GMimeGpgmeSigstat ** signature,
+                        GtkWindow * parent, GError ** err)
 {
     GMimeObject *decrypted, *version, *encrypted;
     GMimeStream *stream, *ciphertext;
@@ -458,53 +444,51 @@ g_mime_gpgme_mpe_decrypt(GMimeMultipartEncrypted *mpe,
     g_return_val_if_fail(GMIME_IS_MULTIPART_ENCRYPTED(mpe), NULL);
 
     if (signature && *signature) {
-        g_object_unref(G_OBJECT(*signature));
-        *signature = NULL;
+       g_object_unref(G_OBJECT(*signature));
+       *signature = NULL;
     }
 
     protocol =
-        g_mime_object_get_content_type_parameter(GMIME_OBJECT(mpe),
-                                                 "protocol");
+       g_mime_object_get_content_type_parameter(GMIME_OBJECT(mpe),
+                                                "protocol");
 
     /* make sure the protocol is present and matches the cipher encrypt protocol */
     if (!protocol
-        || (g_ascii_strcasecmp("application/pgp-encrypted",
-                               protocol) != 0)) {
-        g_set_error(err, GMIME_ERROR, GMIME_ERROR_PROTOCOL_ERROR,
-                    _
-                    (
-                        "Cannot decrypt multipart/encrypted part: unsupported encryption protocol “%s”."),
-                    protocol ? protocol : _("(none)"));
-        return NULL;
+       || g_ascii_strcasecmp("application/pgp-encrypted",
+                             protocol) != 0) {
+       g_set_error(err, GMIME_ERROR, GMIME_ERROR_PROTOCOL_ERROR,
+                   _
+                   ("Cannot decrypt multipart/encrypted part: unsupported encryption protocol “%s”."),
+                   protocol ? protocol : _("(none)"));
+       return NULL;
     }
 
     version =
-        g_mime_multipart_get_part(GMIME_MULTIPART(mpe),
-                                  GMIME_MULTIPART_ENCRYPTED_VERSION);
+       g_mime_multipart_get_part(GMIME_MULTIPART(mpe),
+                                 GMIME_MULTIPART_ENCRYPTED_VERSION);
 
     /* make sure the protocol matches the version part's content-type */
     content_type = g_mime_content_type_to_string(version->content_type);
     if (g_ascii_strcasecmp(content_type, protocol) != 0) {
-        g_set_error(err, GMIME_ERROR, GMIME_ERROR_PROTOCOL_ERROR, "%s",
-                    _
-                    (
-                        "Cannot decrypt multipart/encrypted part: content-type does not match protocol."));
-        g_free(content_type);
-        return NULL;
+       g_set_error(err, GMIME_ERROR, GMIME_ERROR_PROTOCOL_ERROR, "%s",
+                   _
+                   ("Cannot decrypt multipart/encrypted part: content-type does not match protocol."));
+       g_free(content_type);
+       return NULL;
     }
     g_free(content_type);
 
     /* get the encrypted part and check that it is of type application/octet-stream */
     encrypted =
-        g_mime_multipart_get_part(GMIME_MULTIPART(mpe),
-                                  GMIME_MULTIPART_ENCRYPTED_CONTENT);
+       g_mime_multipart_get_part(GMIME_MULTIPART(mpe),
+                                 GMIME_MULTIPART_ENCRYPTED_CONTENT);
     mime_type = g_mime_object_get_content_type(encrypted);
     if (!g_mime_content_type_is_type
-            (mime_type, "application", "octet-stream")) {
-        g_set_error(err, GMIME_ERROR, GMIME_ERROR_PROTOCOL_ERROR, "%s",
-                    _
-                        ("Cannot decrypt multipart/encrypted part: unexpected content type"));
-        return NULL;
+       (mime_type, "application", "octet-stream")) {
+       g_set_error(err, GMIME_ERROR, GMIME_ERROR_PROTOCOL_ERROR, "%s",
+                   _
+                   ("Cannot decrypt multipart/encrypted part: unexpected content type"));
+       return NULL;
     }
 
     /* get the ciphertext stream */
@@ -516,18 +500,18 @@ g_mime_gpgme_mpe_decrypt(GMimeMultipartEncrypted *mpe,
     filtered_stream = g_mime_stream_filter_new(stream);
     crlf_filter = g_mime_filter_crlf_new(FALSE, FALSE);
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(filtered_stream),
-                             crlf_filter);
+                            crlf_filter);
     g_object_unref(crlf_filter);
 
     /* get the cleartext */
     sigstat =
-        libbalsa_gpgme_decrypt(ciphertext, filtered_stream,
-                               GPGME_PROTOCOL_OpenPGP, parent, err);
+       libbalsa_gpgme_decrypt(ciphertext, filtered_stream,
+                              GPGME_PROTOCOL_OpenPGP, parent, err);
     if (!sigstat) {
-        g_object_unref(filtered_stream);
-        g_object_unref(ciphertext);
-        g_object_unref(stream);
-        return NULL;
+       g_object_unref(filtered_stream);
+       g_object_unref(ciphertext);
+       g_object_unref(stream);
+       return NULL;
     }
 
     g_mime_stream_flush(filtered_stream);
@@ -543,22 +527,20 @@ g_mime_gpgme_mpe_decrypt(GMimeMultipartEncrypted *mpe,
     g_object_unref(parser);
 
     if (!decrypted) {
-        g_set_error(err, GMIME_ERROR, GMIME_ERROR_PARSE_ERROR, "%s",
-                    _
-                    (
-                        "Cannot decrypt multipart/encrypted part: failed to parse decrypted content"));
-        g_object_unref(G_OBJECT(sigstat));
-        return NULL;
+       g_set_error(err, GMIME_ERROR, GMIME_ERROR_PARSE_ERROR, "%s",
+                   _
+                   ("Cannot decrypt multipart/encrypted part: failed to parse decrypted content"));
+       g_object_unref(G_OBJECT(sigstat));
+       return NULL;
     }
 
 
     /* cache the decrypted part */
     if (signature) {
-        if (sigstat->status != GPG_ERR_NOT_SIGNED) {
-            *signature = sigstat;
-        } else {
-            g_object_unref(G_OBJECT(sigstat));
-        }
+       if (sigstat->status != GPG_ERR_NOT_SIGNED)
+           *signature = sigstat;
+       else
+           g_object_unref(G_OBJECT(sigstat));
     }
 
     return decrypted;
diff --git a/libbalsa/gmime-multipart-crypt.h b/libbalsa/gmime-multipart-crypt.h
index 3ac03d8..a5dd0c8 100644
--- a/libbalsa/gmime-multipart-crypt.h
+++ b/libbalsa/gmime-multipart-crypt.h
@@ -11,14 +11,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -27,7 +27,7 @@
 #define __GMIME_MULTIPART_CRYPT_H__
 
 #ifdef HAVE_CONFIG_H
-#   include <config.h>
+#include <config.h>
 #endif
 
 #include <glib.h>
@@ -40,27 +40,22 @@
 G_BEGIN_DECLS
 
 
-GMimeGpgmeSigstat *g_mime_gpgme_mps_verify(GMimeMultipartSigned *mps,
-                                           GError              **error);
-gboolean g_mime_gpgme_mps_sign(GMimeMultipartSigned *mps,
-                               GMimeObject          *content,
-                               const gchar          *userid,
-                               gpgme_protocol_t      protocol,
-                               GtkWindow            *parent,
-                               GError              **err);
-gboolean g_mime_gpgme_mpe_encrypt(GMimeMultipartEncrypted *mpe,
-                                  GMimeObject             *content,
-                                  GPtrArray               *recipients,
-                                  gboolean                 trust_all,
-                                  GtkWindow               *parent,
-                                  GError                 **err);
-GMimeObject *g_mime_gpgme_mpe_decrypt(GMimeMultipartEncrypted *mpe,
-                                      GMimeGpgmeSigstat      **signature,
-                                      GtkWindow               *parent,
-                                      GError                 **err);
+GMimeGpgmeSigstat *g_mime_gpgme_mps_verify(GMimeMultipartSigned * mps,
+                                          GError ** error);
+gboolean g_mime_gpgme_mps_sign(GMimeMultipartSigned * mps,
+                         GMimeObject * content, const gchar * userid,
+                         gpgme_protocol_t protocol, GtkWindow * parent,
+                         GError ** err);
+gboolean g_mime_gpgme_mpe_encrypt(GMimeMultipartEncrypted * mpe,
+                            GMimeObject * content, GPtrArray * recipients,
+                            gboolean trust_all, GtkWindow * parent,
+                            GError ** err);
+GMimeObject *g_mime_gpgme_mpe_decrypt(GMimeMultipartEncrypted * mpe,
+                                     GMimeGpgmeSigstat ** signature,
+                                     GtkWindow * parent, GError ** err);
 
 
 G_END_DECLS
 
 
-#endif                          /* __GMIME_MULTIPART_CRYPT_H__ */
+#endif                         /* __GMIME_MULTIPART_CRYPT_H__ */
diff --git a/libbalsa/gmime-part-rfc2440.c b/libbalsa/gmime-part-rfc2440.c
index 3fe2014..199dfe0 100644
--- a/libbalsa/gmime-part-rfc2440.c
+++ b/libbalsa/gmime-part-rfc2440.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+#include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <string.h>
@@ -30,7 +30,7 @@
 
 
 #ifdef G_LOG_DOMAIN
-#   undef G_LOG_DOMAIN
+#  undef G_LOG_DOMAIN
 #endif
 #define G_LOG_DOMAIN "crypto"
 
@@ -49,7 +49,7 @@
  * are always classified as GMIME_PART_RFC2440_NONE.
  */
 GMimePartRfc2440Mode
-g_mime_part_check_rfc2440(GMimePart *part)
+g_mime_part_check_rfc2440(GMimePart * part)
 {
     GMimeDataWrapper *wrapper;
     GMimeStream *stream;
@@ -62,51 +62,47 @@ g_mime_part_check_rfc2440(GMimePart *part)
     g_return_val_if_fail(wrapper, GMIME_PART_RFC2440_NONE);
 
     stream = g_mime_data_wrapper_get_stream(wrapper);
-    if (!stream || ((slen = g_mime_stream_length(stream)) < 0)) {
-        return retval;
-    }
+    if (!stream || (slen = g_mime_stream_length(stream)) < 0)
+       return retval;
 
     g_mime_stream_reset(stream);
 
     /* check if the complete stream fits in the buffer */
     if (slen < RFC2440_BUF_LEN - 1) {
-        g_mime_stream_read(stream, buf, slen);
-        buf[slen] = '\0';
-
-        if (!strncmp(buf, "-----BEGIN PGP MESSAGE-----", 27) &&
-            strstr(buf, "-----END PGP MESSAGE-----")) {
-            retval = GMIME_PART_RFC2440_ENCRYPTED;
-        } else if (!strncmp(buf, "-----BEGIN PGP SIGNED MESSAGE-----", 34)) {
-            gchar *p1, *p2;
-
-            p1 = strstr(buf, "-----BEGIN PGP SIGNATURE-----");
-            p2 = strstr(buf, "-----END PGP SIGNATURE-----");
-            if (p1 && p2 && (p2 > p1)) {
-                retval = GMIME_PART_RFC2440_SIGNED;
-            }
-        }
+       g_mime_stream_read(stream, buf, slen);
+       buf[slen] = '\0';
+
+       if (!strncmp(buf, "-----BEGIN PGP MESSAGE-----", 27) &&
+           strstr(buf, "-----END PGP MESSAGE-----"))
+           retval = GMIME_PART_RFC2440_ENCRYPTED;
+       else if (!strncmp(buf, "-----BEGIN PGP SIGNED MESSAGE-----", 34)) {
+           gchar *p1, *p2;
+
+           p1 = strstr(buf, "-----BEGIN PGP SIGNATURE-----");
+           p2 = strstr(buf, "-----END PGP SIGNATURE-----");
+           if (p1 && p2 && p2 > p1)
+               retval = GMIME_PART_RFC2440_SIGNED;
+       }
     } else {
-        /* check if the beginning of the stream matches */
-        g_mime_stream_read(stream, buf, 34);
-        g_mime_stream_seek(stream, 1 - RFC2440_BUF_LEN,
-                           GMIME_STREAM_SEEK_END);
-        if (!strncmp(buf, "-----BEGIN PGP MESSAGE-----", 27)) {
-            g_mime_stream_read(stream, buf, RFC2440_BUF_LEN - 1);
-            buf[RFC2440_BUF_LEN - 1] = '\0';
-            if (strstr(buf, "-----END PGP MESSAGE-----")) {
-                retval = GMIME_PART_RFC2440_ENCRYPTED;
-            }
-        } else if (!strncmp(buf, "-----BEGIN PGP SIGNED MESSAGE-----", 34)) {
-            gchar *p1, *p2;
-
-            g_mime_stream_read(stream, buf, RFC2440_BUF_LEN - 1);
-            buf[RFC2440_BUF_LEN - 1] = '\0';
-            p1 = strstr(buf, "-----BEGIN PGP SIGNATURE-----");
-            p2 = strstr(buf, "-----END PGP SIGNATURE-----");
-            if (p1 && p2 && (p2 > p1)) {
-                retval = GMIME_PART_RFC2440_SIGNED;
-            }
-        }
+       /* check if the beginning of the stream matches */
+       g_mime_stream_read(stream, buf, 34);
+       g_mime_stream_seek(stream, 1 - RFC2440_BUF_LEN,
+                          GMIME_STREAM_SEEK_END);
+       if (!strncmp(buf, "-----BEGIN PGP MESSAGE-----", 27)) {
+           g_mime_stream_read(stream, buf, RFC2440_BUF_LEN - 1);
+           buf[RFC2440_BUF_LEN - 1] = '\0';
+           if (strstr(buf, "-----END PGP MESSAGE-----"))
+               retval = GMIME_PART_RFC2440_ENCRYPTED;
+       } else if (!strncmp(buf, "-----BEGIN PGP SIGNED MESSAGE-----", 34)) {
+           gchar *p1, *p2;
+
+           g_mime_stream_read(stream, buf, RFC2440_BUF_LEN - 1);
+           buf[RFC2440_BUF_LEN - 1] = '\0';
+           p1 = strstr(buf, "-----BEGIN PGP SIGNATURE-----");
+           p2 = strstr(buf, "-----END PGP SIGNATURE-----");
+           if (p1 && p2 && p2 > p1)
+               retval = GMIME_PART_RFC2440_SIGNED;
+       }
     }
 
     return retval;
@@ -132,12 +128,10 @@ g_mime_part_check_rfc2440(GMimePart *part)
  * failed, an exception will be set on err to provide more information.
  */
 gboolean
-g_mime_part_rfc2440_sign_encrypt(GMimePart  *part,
-                                 const char *sign_userid,
-                                 GPtrArray  *recipients,
-                                 gboolean    trust_all,
-                                 GtkWindow  *parent,
-                                 GError    **err)
+g_mime_part_rfc2440_sign_encrypt(GMimePart * part, const char *sign_userid,
+                                GPtrArray * recipients,
+                                gboolean trust_all, GtkWindow * parent,
+                                GError ** err)
 {
     GMimeDataWrapper *wrapper;
     GMimeStream *stream, *cipherstream;
@@ -160,41 +154,39 @@ g_mime_part_rfc2440_sign_encrypt(GMimePart  *part,
 
     /* do the crypto operation */
     if (recipients == NULL) {
-        if (libbalsa_gpgme_sign
-                (sign_userid, stream, cipherstream, GPGME_PROTOCOL_OpenPGP,
-                TRUE, parent, err) == GPGME_MD_NONE) {
-            result = FALSE;
-        } else {
-            result = TRUE;
-        }
-    } else {
-        result =
-            libbalsa_gpgme_encrypt(recipients, sign_userid, stream,
-                                   cipherstream, GPGME_PROTOCOL_OpenPGP,
-                                   TRUE, trust_all, parent, err);
-    }
+       if (libbalsa_gpgme_sign
+           (sign_userid, stream, cipherstream, GPGME_PROTOCOL_OpenPGP,
+            TRUE, parent, err) == GPGME_MD_NONE)
+           result = FALSE;
+    else
+           result = TRUE;
+    } else
+       result =
+           libbalsa_gpgme_encrypt(recipients, sign_userid, stream,
+                                  cipherstream, GPGME_PROTOCOL_OpenPGP,
+                                  TRUE, trust_all, parent, err);
     if (!result) {
-        g_object_unref(cipherstream);
-        return result;
+       g_object_unref(cipherstream);
+       return result;
     }
 
     /* add the headers to encrypted ascii armor output: as there is no
      * "insert" method for the byte array, first remove the leading "BEGIN
      * PGP MESSAGE" (27 chars) and prepend it again... */
     if (recipients && g_mime_object_get_content_type(GMIME_OBJECT(part))) {
-        const gchar *charset =
-            g_mime_object_get_content_type_parameter(GMIME_OBJECT(part),
-                                                     "charset");
-        gchar *rfc2440header;
-
-        rfc2440header =
-            g_strdup_printf("-----BEGIN PGP MESSAGE-----\nCharset: %s\n"
-                            "Comment: created by Balsa " BALSA_VERSION
-                            " (http://balsa.gnome.org)", charset);
-        g_byte_array_remove_range(cipherdata, 0, 27);
-        g_byte_array_prepend(cipherdata, (guint8 *) rfc2440header,
-                             strlen(rfc2440header));
-        g_free(rfc2440header);
+       const gchar *charset =
+           g_mime_object_get_content_type_parameter(GMIME_OBJECT(part),
+                                                    "charset");
+       gchar *rfc2440header;
+       
+       rfc2440header =
+           g_strdup_printf("-----BEGIN PGP MESSAGE-----\nCharset: %s\n"
+                           "Comment: created by Balsa " BALSA_VERSION
+                           " (http://balsa.gnome.org)", charset);
+       g_byte_array_remove_range(cipherdata, 0, 27);
+       g_byte_array_prepend(cipherdata, (guint8 *) rfc2440header,
+                            strlen(rfc2440header));
+       g_free(rfc2440header);
     }
 
     /* replace the content of the part */
@@ -209,20 +201,19 @@ g_mime_part_rfc2440_sign_encrypt(GMimePart  *part,
      * armor.
      */
     if (recipients == NULL) {
-        if (g_mime_part_get_content_encoding(part) !=
-            GMIME_CONTENT_ENCODING_BASE64) {
-            g_mime_part_set_content_encoding(part,
-                                             GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE);
-        }
-        g_mime_data_wrapper_set_encoding(wrapper,
-                                         GMIME_CONTENT_ENCODING_DEFAULT);
+       if (g_mime_part_get_content_encoding(part) !=
+           GMIME_CONTENT_ENCODING_BASE64)
+           g_mime_part_set_content_encoding(part,
+                                    GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE);
+       g_mime_data_wrapper_set_encoding(wrapper,
+                                        GMIME_CONTENT_ENCODING_DEFAULT);
     } else {
-        g_mime_part_set_content_encoding(part,
-                                         GMIME_CONTENT_ENCODING_7BIT);
-        g_mime_data_wrapper_set_encoding(wrapper,
-                                         GMIME_CONTENT_ENCODING_7BIT);
-        g_mime_object_set_content_type_parameter(GMIME_OBJECT(part),
-                                                 "charset", "US-ASCII");
+       g_mime_part_set_content_encoding(part,
+                                        GMIME_CONTENT_ENCODING_7BIT);
+       g_mime_data_wrapper_set_encoding(wrapper,
+                                        GMIME_CONTENT_ENCODING_7BIT);
+       g_mime_object_set_content_type_parameter(GMIME_OBJECT(part),
+                                                "charset", "US-ASCII");
     }
 
     g_mime_part_set_content_object(part, wrapper);
@@ -246,8 +237,7 @@ g_mime_part_rfc2440_sign_encrypt(GMimePart  *part,
  * verified output of the crypto engine.
  */
 GMimeGpgmeSigstat *
-g_mime_part_rfc2440_verify(GMimePart *part,
-                           GError   **err)
+g_mime_part_rfc2440_verify(GMimePart * part, GError ** err)
 {
     GMimeStream *stream;
     GMimeStream *plainstream;
@@ -268,15 +258,15 @@ g_mime_part_rfc2440_verify(GMimePart *part,
 
     /* verify the signature */
     result =
-        libbalsa_gpgme_verify(stream, plainstream, GPGME_PROTOCOL_OpenPGP,
-                              TRUE, err);
+       libbalsa_gpgme_verify(stream, plainstream, GPGME_PROTOCOL_OpenPGP,
+                             TRUE, err);
 
     /* upon success, replace the signed content by the checked one */
-    if (result && (g_mime_stream_length(plainstream) > 0)) {
-        wrapper = g_mime_data_wrapper_new();
-        g_mime_data_wrapper_set_stream(wrapper, plainstream);
-        g_mime_part_set_content_object(GMIME_PART(part), wrapper);
-        g_object_unref(wrapper);
+    if (result && g_mime_stream_length(plainstream) > 0) {
+       wrapper = g_mime_data_wrapper_new();
+       g_mime_data_wrapper_set_stream(wrapper, plainstream);
+       g_mime_part_set_content_object(GMIME_PART(part), wrapper);
+       g_object_unref(wrapper);
     }
     g_object_unref(plainstream);
 
@@ -300,9 +290,8 @@ g_mime_part_rfc2440_verify(GMimePart *part,
  * verified.
  */
 GMimeGpgmeSigstat *
-g_mime_part_rfc2440_decrypt(GMimePart *part,
-                            GtkWindow *parent,
-                            GError   **err)
+g_mime_part_rfc2440_decrypt(GMimePart * part, GtkWindow * parent,
+                           GError ** err)
 {
     GMimeStream *stream;
     GMimeStream *plainstream;
@@ -327,71 +316,69 @@ g_mime_part_rfc2440_decrypt(GMimePart *part,
 
     /* decrypt and (if possible) verify the input */
     result =
-        libbalsa_gpgme_decrypt(stream, plainstream, GPGME_PROTOCOL_OpenPGP,
-                               parent, err);
+       libbalsa_gpgme_decrypt(stream, plainstream, GPGME_PROTOCOL_OpenPGP,
+                              parent, err);
 
     if (result != NULL) {
-        GMimeStream *filter_stream;
-        GMimeStream *out_stream;
-        GMimeFilter *filter;
-
-        /* strip crlf off encrypted stuff coming from Winbloze crap */
-        filter_stream = g_mime_stream_filter_new(plainstream);
-        filter = g_mime_filter_crlf_new(FALSE, FALSE);
-        g_mime_stream_filter_add(GMIME_STREAM_FILTER(filter_stream),
-                                 filter);
-        g_object_unref(filter);
-
-        /* replace the old contents by the decrypted stuff */
-        out_stream = g_mime_stream_mem_new();
-        wrapper = g_mime_data_wrapper_new();
-        g_mime_data_wrapper_set_stream(wrapper, out_stream);
-        g_mime_part_set_content_object(part, wrapper);
+       GMimeStream *filter_stream;
+       GMimeStream *out_stream;
+       GMimeFilter *filter;
+
+       /* strip crlf off encrypted stuff coming from Winbloze crap */
+       filter_stream = g_mime_stream_filter_new(plainstream);
+       filter = g_mime_filter_crlf_new(FALSE, FALSE);
+       g_mime_stream_filter_add(GMIME_STREAM_FILTER(filter_stream),
+                                filter);
+       g_object_unref(filter);
+
+       /* replace the old contents by the decrypted stuff */
+       out_stream = g_mime_stream_mem_new();
+       wrapper = g_mime_data_wrapper_new();
+       g_mime_data_wrapper_set_stream(wrapper, out_stream);
+       g_mime_part_set_content_object(part, wrapper);
         g_object_unref(wrapper);
-        g_mime_stream_reset(filter_stream);
-        g_mime_stream_write_to_stream(filter_stream, out_stream);
-        g_object_unref(filter_stream);
-
-        g_mime_part_set_content_encoding(part,
-                                         GMIME_CONTENT_ENCODING_8BIT);
-
-        /*
-         * Set the charset of the decrypted content to the RFC 2440
-         * "Charset:" header.  If it is not present, RFC 2440 defines that
-         * the contents should be utf-8, but real-life applications (e.g.
-         * pgp4pine) tend to use "some" charset, so "unknown-8bit" is a
-         * safe choice in this case and if no other charset is given.
-         */
-        if (g_mime_object_get_content_type(GMIME_OBJECT(part))) {
-            gchar *up_headbuf = g_ascii_strup(headbuf, -1);
-            gchar *p;
-
-            if ((p = strstr(up_headbuf, "CHARSET: "))) {
-                gchar *line_end;
-
-                p += 9;
-                line_end = p;
-                while (*line_end > ' ') {
-                    line_end++;
-                }
-                *line_end = '\0';
-                g_mime_object_set_content_type_parameter(GMIME_OBJECT
-                                                             (part), "charset",
-                                                         p);
-            } else {
-                if (!g_ascii_strcasecmp
-                        ("us-ascii",
-                        g_mime_object_get_content_type_parameter(GMIME_OBJECT
-                                                                     (part),
-                                                                 "charset"))) {
-                    g_mime_object_set_content_type_parameter(GMIME_OBJECT
-                                                                 (part),
-                                                             "charset",
-                                                             "unknown-8bit");
-                }
-            }
-            g_free(up_headbuf);
-        }
+       g_mime_stream_reset(filter_stream);
+       g_mime_stream_write_to_stream(filter_stream, out_stream);
+       g_object_unref(filter_stream);
+
+       g_mime_part_set_content_encoding(part,
+                                        GMIME_CONTENT_ENCODING_8BIT);
+
+       /*
+        * Set the charset of the decrypted content to the RFC 2440
+        * "Charset:" header.  If it is not present, RFC 2440 defines that
+        * the contents should be utf-8, but real-life applications (e.g.
+        * pgp4pine) tend to use "some" charset, so "unknown-8bit" is a
+        * safe choice in this case and if no other charset is given.
+        */
+       if (g_mime_object_get_content_type(GMIME_OBJECT(part))) {
+           gchar *up_headbuf = g_ascii_strup(headbuf, -1);
+           gchar *p;
+ 
+           if ((p = strstr(up_headbuf, "CHARSET: "))) {
+               gchar *line_end;
+ 
+               p += 9;
+               line_end = p;
+               while (*line_end > ' ')
+                   line_end++;
+               *line_end = '\0';
+               g_mime_object_set_content_type_parameter(GMIME_OBJECT
+                                                        (part), "charset",
+                                                        p);
+           } else {
+               if (!g_ascii_strcasecmp
+                   ("us-ascii",
+                    g_mime_object_get_content_type_parameter(GMIME_OBJECT
+                                                             (part),
+                                                                 "charset")))
+                   g_mime_object_set_content_type_parameter(GMIME_OBJECT
+                                                            (part),
+                                                            "charset",
+                                                            "unknown-8bit");
+           }
+           g_free(up_headbuf);
+       }
     }
     g_object_unref(plainstream);
     g_object_unref(stream);
diff --git a/libbalsa/gmime-part-rfc2440.h b/libbalsa/gmime-part-rfc2440.h
index 486002e..19bcbfc 100644
--- a/libbalsa/gmime-part-rfc2440.h
+++ b/libbalsa/gmime-part-rfc2440.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -30,7 +30,7 @@ G_BEGIN_DECLS
 
 
 typedef enum _GMimePartRfc2440Mode GMimePartRfc2440Mode;
-enum _GMimePartRfc2440Mode {
+enum _GMimePartRfc2440Mode { 
     GMIME_PART_RFC2440_NONE,
     GMIME_PART_RFC2440_SIGNED,
     GMIME_PART_RFC2440_ENCRYPTED
@@ -38,22 +38,21 @@ enum _GMimePartRfc2440Mode {
 
 
 /* part status check */
-GMimePartRfc2440Mode g_mime_part_check_rfc2440(GMimePart *part);
+GMimePartRfc2440Mode g_mime_part_check_rfc2440(GMimePart * part);
 
 /* crypto routines */
-gboolean g_mime_part_rfc2440_sign_encrypt(GMimePart  *part,
-                                          const char *sign_userid,
-                                          GPtrArray  *recipients,
-                                          gboolean    trust_all,
-                                          GtkWindow  *parent,
-                                          GError    **err);
-GMimeGpgmeSigstat *g_mime_part_rfc2440_verify(GMimePart *part,
-                                              GError   **err);
-GMimeGpgmeSigstat *g_mime_part_rfc2440_decrypt(GMimePart *part,
-                                               GtkWindow *parent,
-                                               GError   **err);
+gboolean g_mime_part_rfc2440_sign_encrypt(GMimePart * part,
+                                    const char *sign_userid,
+                                    GPtrArray * recipients,
+                                    gboolean trust_all,
+                                    GtkWindow * parent, GError ** err);
+GMimeGpgmeSigstat *g_mime_part_rfc2440_verify(GMimePart * part,
+                                    GError ** err);
+GMimeGpgmeSigstat *g_mime_part_rfc2440_decrypt(GMimePart * part,
+                                              GtkWindow * parent,
+                                                GError ** err);
 
 G_END_DECLS
 
 
-#endif                          /* __GMIME_PART_RFC2440_H__ */
+#endif                         /* __GMIME_PART_RFC2440_H__ */
diff --git a/libbalsa/html.c b/libbalsa/html.c
index 1ac585f..65a218b 100644
--- a/libbalsa/html.c
+++ b/libbalsa/html.c
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -36,7 +36,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "html.h"
 
@@ -53,8 +53,7 @@
  * otherwise, caller must g_free buf
  */
 static gssize
-lbh_get_body_content(LibBalsaMessageBody *body,
-                     gchar              **buf)
+lbh_get_body_content(LibBalsaMessageBody * body, gchar ** buf)
 {
     gssize len;
     GError *err = NULL;
@@ -77,19 +76,15 @@ lbh_get_body_content(LibBalsaMessageBody *body,
     return libbalsa_html_filter(html_type, buf, len);
 }
 
+# if defined(HAVE_WEBKIT)
 
-#   if defined(HAVE_WEBKIT)
-
-#      ifdef HTML2TEXT
+#ifdef HTML2TEXT
 
 /* common function for all Webkit versions */
 static void
-html2text(gchar **text,
-          gsize   len)
+html2text(gchar ** text, gsize len)
 {
-    gchar *html2text[] = {
-        HTML2TEXT, NULL, NULL, NULL
-    };
+    gchar *html2text[] = { HTML2TEXT, NULL, NULL, NULL };
     GFile *html_data;
     GFileIOStream *stream;
     GError *err = NULL;
@@ -106,12 +101,12 @@ html2text(gchar **text,
             gint pathidx;
 
             g_output_stream_flush(ostream, NULL, NULL);
-#         if defined(HTML2TEXT_UCOPT)
+#if defined(HTML2TEXT_UCOPT)
             html2text[1] = "--unicode-snob";
             pathidx = 2;
-#         else
+#else
             pathidx = 1;
-#         endif
+#endif
             html2text[pathidx] = g_file_get_path(html_data);
             if (g_spawn_sync(NULL, html2text, NULL,
                              G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL,
@@ -134,53 +129,52 @@ html2text(gchar **text,
     }
 }
 
+#else
 
-#      else
+#define html2text(p, l)
 
-#         define html2text(p, l)
+#endif
 
-#      endif
-
-#      if defined(USE_WEBKIT2)
+#  if defined(USE_WEBKIT2)
 
 /*
  * Experimental support for WebKit2.
  */
 
-#         define DEBUG_WEBKIT2 FALSE
-#         if DEBUG_WEBKIT2
-#            define d(x) x
-#         else
-#            define d(x)
-#         endif
+#define DEBUG_WEBKIT2 FALSE
+#if DEBUG_WEBKIT2
+#define d(x) x
+#else
+#define d(x)
+#endif
 
 /* WebKitContextMenuItem uses GtkAction, which is deprecated.
  * We don't use it, but it breaks the git-tree build, so we just mangle
  * it: */
-#         define GtkAction GAction
-#         include <webkit2/webkit2.h>
-#         undef GtkAction
+#define GtkAction GAction
+#include <webkit2/webkit2.h>
+#undef GtkAction
 
 typedef struct {
-    LibBalsaMessageBody *body;
-    LibBalsaHtmlCallback hover_cb;
-    LibBalsaHtmlCallback clicked_cb;
-    GtkWidget *info_bar;
-    WebKitWebView *web_view;
-    gchar *uri;
+    LibBalsaMessageBody  *body;
+    LibBalsaHtmlCallback  hover_cb;
+    LibBalsaHtmlCallback  clicked_cb;
+    GtkWidget            *info_bar;
+    WebKitWebView        *web_view;
+    gchar                *uri;
     LibBalsaHtmlSearchCallback search_cb;
-    gpointer search_cb_data;
-    gchar *search_text;
+    gpointer                   search_cb_data;
+    gchar                    * search_text;
 } LibBalsaWebKitInfo;
 
-#         define LIBBALSA_HTML_INFO "libbalsa-webkit2-info"
+#define LIBBALSA_HTML_INFO "libbalsa-webkit2-info"
 
 /*
  * Unlike older HTML widgets, webkit2 wants UTF-8 text
  */
 static gssize
-lbh_get_body_content_utf8(LibBalsaMessageBody *body,
-                          gchar              **utf8_text)
+lbh_get_body_content_utf8(LibBalsaMessageBody  * body,
+                          gchar               ** utf8_text)
 {
     gchar *text;
     gssize len;
@@ -188,9 +182,8 @@ lbh_get_body_content_utf8(LibBalsaMessageBody *body,
     gsize utf8_len;
 
     len = lbh_get_body_content(body, &text);
-    if (len < 0) {
+    if (len < 0)
         return len;
-    }
 
     charset = libbalsa_message_body_charset(body);
     if (charset) {
@@ -210,55 +203,51 @@ lbh_get_body_content_utf8(LibBalsaMessageBody *body,
     return strlen(text);
 }
 
-
 /*
  * GDestroyNotify func
  */
 static void
-lbh_webkit_info_free(LibBalsaWebKitInfo *info)
+lbh_webkit_info_free(LibBalsaWebKitInfo * info)
 {
     if (info->uri) {
         g_free(info->uri);
-        (*info->hover_cb)(NULL);
+        (*info->hover_cb) (NULL);
     }
 
     g_free(info->search_text);
     g_free(info);
 }
 
-
 /*
  * Callback for the "mouse-target-changed" signal
  */
 static void
-lbh_mouse_target_changed_cb(WebKitWebView       *web_view,
-                            WebKitHitTestResult *hit_test_result,
-                            guint                modifiers,
-                            gpointer             data)
+lbh_mouse_target_changed_cb(WebKitWebView       * web_view,
+                            WebKitHitTestResult * hit_test_result,
+                            guint                 modifiers,
+                            gpointer              data)
 {
     LibBalsaWebKitInfo *info = data;
     const gchar *uri;
 
     uri = webkit_hit_test_result_get_link_uri(hit_test_result);
 
-    if (g_strcmp0(uri, info->uri) == 0) {
+    if (g_strcmp0(uri, info->uri) == 0)
         /* No change */
         return;
-    }
 
     if (info->uri) {
         g_free(info->uri);
         info->uri = NULL;
-        (*info->hover_cb)(NULL);
+        (*info->hover_cb) (NULL);
     }
 
     if (uri) {
         info->uri = g_strdup(uri);
-        (*info->hover_cb)(uri);
+        (*info->hover_cb) (uri);
     }
 }
 
-
 /*
  * Callback for the "decide-policy" signal
  *
@@ -266,8 +255,8 @@ lbh_mouse_target_changed_cb(WebKitWebView       *web_view,
  */
 
 static void
-lbh_navigation_policy_decision(WebKitPolicyDecision *decision,
-                               gpointer              data)
+lbh_navigation_policy_decision(WebKitPolicyDecision * decision,
+                               gpointer               data)
 {
     LibBalsaWebKitInfo *info = data;
     WebKitNavigationPolicyDecision *navigation_decision;
@@ -279,7 +268,7 @@ lbh_navigation_policy_decision(WebKitPolicyDecision *decision,
     navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION(decision);
     navigation_action =
         webkit_navigation_policy_decision_get_navigation_action
-            (navigation_decision);
+        (navigation_decision);
     navigation_type =
         webkit_navigation_action_get_navigation_type(navigation_action);
     request = webkit_navigation_action_get_request(navigation_action);
@@ -292,21 +281,18 @@ lbh_navigation_policy_decision(WebKitPolicyDecision *decision,
                   navigation_type));
         webkit_policy_decision_use(decision);
         break;
-
     case WEBKIT_NAVIGATION_TYPE_LINK_CLICKED:
         d(g_print("%s clicked %s\n", __func__, uri));
-        (*info->clicked_cb)(uri);
-
+        (*info->clicked_cb) (uri);
     default:
         d(g_print("%s type %d, ignored\n", __func__, navigation_type));
         webkit_policy_decision_ignore(decision);
     }
 }
 
-
 static void
-lbh_new_window_policy_decision(WebKitPolicyDecision *decision,
-                               gpointer              data)
+lbh_new_window_policy_decision(WebKitPolicyDecision * decision,
+                               gpointer               data)
 {
     WebKitNavigationPolicyDecision *navigation_decision;
     WebKitNavigationAction *navigation_action;
@@ -315,57 +301,51 @@ lbh_new_window_policy_decision(WebKitPolicyDecision *decision,
 
     navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION(decision);
     navigation_action =
-        webkit_navigation_policy_decision_get_navigation_action
+         webkit_navigation_policy_decision_get_navigation_action
             (navigation_decision);
     switch (webkit_navigation_action_get_navigation_type
-                (navigation_action)) {
+            (navigation_action)) {
     case WEBKIT_NAVIGATION_TYPE_LINK_CLICKED:
         request = webkit_navigation_action_get_request(navigation_action);
         d(g_print("%s clicked %s\n", __func__,
                   webkit_uri_request_get_uri(request)));
-        (*info->clicked_cb)(webkit_uri_request_get_uri(request));
-
+        (*info->clicked_cb) (webkit_uri_request_get_uri(request));
     default:
         d(g_print("%s type %d, ignored\n", __func__,
                   webkit_navigation_action_get_navigation_type
-                      (navigation_action)));
+                  (navigation_action)));
 
         webkit_policy_decision_ignore(decision);
     }
 }
 
-
 static void
-lbh_response_policy_decision(WebKitPolicyDecision *decision,
-                             gpointer              data)
+lbh_response_policy_decision(WebKitPolicyDecision * decision,
+                             gpointer               data)
 {
     d(g_print("%s uri %s, ignored\n", __func__,
               webkit_uri_request_get_uri
-                  (webkit_response_policy_decision_get_request
-                      (WEBKIT_RESPONSE_POLICY_DECISION(decision)))));
+              (webkit_response_policy_decision_get_request
+               (WEBKIT_RESPONSE_POLICY_DECISION(decision)))));
     webkit_policy_decision_ignore(decision);
 }
 
-
 static gboolean
-lbh_decide_policy_cb(WebKitWebView           *web_view,
-                     WebKitPolicyDecision    *decision,
-                     WebKitPolicyDecisionType decision_type,
-                     gpointer                 data)
+lbh_decide_policy_cb(WebKitWebView           * web_view,
+                     WebKitPolicyDecision    * decision,
+                     WebKitPolicyDecisionType  decision_type,
+                     gpointer                  data)
 {
     switch (decision_type) {
     case WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION:
         lbh_navigation_policy_decision(decision, data);
         break;
-
     case WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION:
         lbh_new_window_policy_decision(decision, data);
         break;
-
     case WEBKIT_POLICY_DECISION_TYPE_RESPONSE:
         lbh_response_policy_decision(decision, data);
         break;
-
     default:
         /* Making no decision results in
          * webkit_policy_decision_use(). */
@@ -375,7 +355,6 @@ lbh_decide_policy_cb(WebKitWebView           *web_view,
     return TRUE;
 }
 
-
 /*
  * Show the GtkInfoBar for asking about downloading images
  *
@@ -383,9 +362,8 @@ lbh_decide_policy_cb(WebKitWebView           *web_view,
  */
 
 static void
-lbh_info_bar_response_cb(GtkInfoBar *info_bar,
-                         gint        response_id,
-                         gpointer    data)
+lbh_info_bar_response_cb(GtkInfoBar * info_bar,
+                         gint response_id, gpointer data)
 {
     LibBalsaWebKitInfo *info = data;
 
@@ -406,49 +384,47 @@ lbh_info_bar_response_cb(GtkInfoBar *info_bar,
     info->info_bar = NULL;
 }
 
-
 static void
-lbh_info_bar_realize_cb(GtkInfoBar *info_bar)
+lbh_info_bar_realize_cb(GtkInfoBar * info_bar)
 {
     gtk_info_bar_set_default_response(info_bar, GTK_RESPONSE_CLOSE);
 }
 
-
 static GtkWidget *
-lbh_info_bar(LibBalsaWebKitInfo *info)
+lbh_info_bar(LibBalsaWebKitInfo * info)
 {
     GtkWidget *info_bar_widget;
     GtkInfoBar *info_bar;
     GtkWidget *label;
     GtkWidget *content_area;
-#         ifdef GTK_INFO_BAR_WRAPPING_IS_BROKEN
+#ifdef GTK_INFO_BAR_WRAPPING_IS_BROKEN
     static const gchar text[] =
-        N_("This message part contains images "
-           "from a remote server.\n"
-           "To protect your privacy, "
-           "Balsa has not downloaded them.\n"
-           "You may choose to download them "
-           "if you trust the server.");
-#         else                  /* GTK_INFO_BAR_WRAPPING_IS_BROKEN */
+                 N_("This message part contains images "
+                    "from a remote server.\n"
+                    "To protect your privacy, "
+                    "Balsa has not downloaded them.\n"
+                    "You may choose to download them "
+                    "if you trust the server.");
+#else                           /* GTK_INFO_BAR_WRAPPING_IS_BROKEN */
     static const gchar text[] =
-        N_("This message part contains images "
-           "from a remote server. "
-           "To protect your privacy, "
-           "Balsa has not downloaded them. "
-           "You may choose to download them "
-           "if you trust the server.");
-#         endif                 /* GTK_INFO_BAR_WRAPPING_IS_BROKEN */
+                 N_("This message part contains images "
+                    "from a remote server. "
+                    "To protect your privacy, "
+                    "Balsa has not downloaded them. "
+                    "You may choose to download them "
+                    "if you trust the server.");
+#endif                          /* GTK_INFO_BAR_WRAPPING_IS_BROKEN */
 
     info_bar_widget =
         gtk_info_bar_new_with_buttons(_("_Download images"),
-                                      GTK_RESPONSE_OK,
-                                      _("_Close"), GTK_RESPONSE_CLOSE,
-                                      NULL);
+                                     GTK_RESPONSE_OK,
+                                     _("_Close"), GTK_RESPONSE_CLOSE,
+                                     NULL);
 
     info_bar = GTK_INFO_BAR(info_bar_widget);
     gtk_orientable_set_orientation(GTK_ORIENTABLE
-                                       (gtk_info_bar_get_action_area
-                                           (info_bar)), GTK_ORIENTATION_VERTICAL);
+                                   (gtk_info_bar_get_action_area
+                                    (info_bar)), GTK_ORIENTATION_VERTICAL);
 
     label = gtk_label_new(_(text));
     gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
@@ -465,14 +441,13 @@ lbh_info_bar(LibBalsaWebKitInfo *info)
     return info_bar_widget;
 }
 
-
 /*
  * Callback for the "resource-load-started" signal
  */
 static void
-lbh_resource_notify_response_cb(WebKitWebResource *resource,
-                                GParamSpec        *pspec,
-                                gpointer           data)
+lbh_resource_notify_response_cb(WebKitWebResource * resource,
+                                GParamSpec        * pspec,
+                                gpointer            data)
 {
     LibBalsaWebKitInfo *info = data;
     const gchar *mime_type;
@@ -481,9 +456,8 @@ lbh_resource_notify_response_cb(WebKitWebResource *resource,
     response = webkit_web_resource_get_response(resource);
     mime_type = webkit_uri_response_get_mime_type(response);
     d(g_print("%s mime-type %s\n", __func__, mime_type));
-    if (g_ascii_strncasecmp(mime_type, "image/", 6) != 0) {
+    if (g_ascii_strncasecmp(mime_type, "image/", 6) != 0)
         return;
-    }
 
     if (info->info_bar) {
         d(g_print("%s %s destroy info_bar\n", __func__,
@@ -498,43 +472,39 @@ lbh_resource_notify_response_cb(WebKitWebResource *resource,
     }
 }
 
-
 static void
-lbh_resource_load_started_cb(WebKitWebView     *web_view,
-                             WebKitWebResource *resource,
-                             WebKitURIRequest  *request,
-                             gpointer           data)
+lbh_resource_load_started_cb(WebKitWebView     * web_view,
+                             WebKitWebResource * resource,
+                             WebKitURIRequest  * request,
+                             gpointer            data)
 {
     const gchar *uri;
 
     uri = webkit_uri_request_get_uri(request);
-    if (!g_ascii_strcasecmp(uri, "about:blank")) {
+    if (!g_ascii_strcasecmp(uri, "about:blank"))
         return;
-    }
 
     g_signal_connect(resource, "notify::response",
                      G_CALLBACK(lbh_resource_notify_response_cb), data);
 }
 
-
 /*
  * Callback for the "web-process-crashed" signal
  */
 static gboolean
-lbh_web_process_crashed_cb(WebKitWebView *web_view,
-                           gpointer       data)
+lbh_web_process_crashed_cb(WebKitWebView * web_view,
+                           gpointer        data)
 {
     d(g_print("%s\n", __func__));
     return FALSE;
 }
 
-
 /*
  * WebKitURISchemeRequestCallback for "cid:" URIs
  */
 static void
-lbh_cid_cb(WebKitURISchemeRequest *request,
-           gpointer                data)
+lbh_cid_cb(WebKitURISchemeRequest * request,
+           gpointer                 data)
 {
     LibBalsaWebKitInfo *info = *(LibBalsaWebKitInfo **) data;
     const gchar *path;
@@ -544,7 +514,7 @@ lbh_cid_cb(WebKitURISchemeRequest *request,
     d(g_print("%s path %s\n", __func__, path));
 
     if ((body =
-             libbalsa_message_get_part_by_id(info->body->message, path))) {
+         libbalsa_message_get_part_by_id(info->body->message, path))) {
         gchar *content;
         gssize len;
 
@@ -564,16 +534,15 @@ lbh_cid_cb(WebKitURISchemeRequest *request,
     }
 }
 
-
 /*
  * Callback for the "context-menu" signal
  */
 static gboolean
-lbh_context_menu_cb(WebKitWebView       *web_view,
-                    WebKitContextMenu   *context_menu,
-                    GdkEvent            *event,
-                    WebKitHitTestResult *hit_test_result,
-                    gpointer             data)
+lbh_context_menu_cb(WebKitWebView       * web_view,
+                    WebKitContextMenu   * context_menu,
+                    GdkEvent            * event,
+                    WebKitHitTestResult * hit_test_result,
+                    gpointer              data)
 {
     GtkWidget *parent;
     gboolean retval;
@@ -590,9 +559,8 @@ lbh_context_menu_cb(WebKitWebView       *web_view,
     return retval;
 }
 
-
 /* Create a new WebKitWebView widget:
- * body                 LibBalsaMessageBody that belongs to the
+ * body                LibBalsaMessageBody that belongs to the
  *                      LibBalsaMessage from which to extract any
  *                     HTML objects (by url);
  * hover_cb             callback for link-hover signal;
@@ -600,9 +568,9 @@ lbh_context_menu_cb(WebKitWebView       *web_view,
  */
 
 GtkWidget *
-libbalsa_html_new(LibBalsaMessageBody *body,
-                  LibBalsaHtmlCallback hover_cb,
-                  LibBalsaHtmlCallback clicked_cb)
+libbalsa_html_new(LibBalsaMessageBody * body,
+                  LibBalsaHtmlCallback  hover_cb,
+                  LibBalsaHtmlCallback  clicked_cb)
 {
     gchar *text;
     gssize len;
@@ -618,17 +586,16 @@ libbalsa_html_new(LibBalsaMessageBody *body,
         "<[^>]*src\\s*=\\s*['\"]?\\s*[^c][^i][^d][^:]";
 
     len = lbh_get_body_content_utf8(body, &text);
-    if (len < 0) {
+    if (len < 0)
         return NULL;
-    }
 
     info = g_new(LibBalsaWebKitInfo, 1);
-    info->body = body;
-    info->hover_cb = hover_cb;
-    info->clicked_cb = clicked_cb;
-    info->info_bar = NULL;
-    info->uri = NULL;
-    info->search_text = NULL;
+    info->body            = body;
+    info->hover_cb        = hover_cb;
+    info->clicked_cb      = clicked_cb;
+    info->info_bar        = NULL;
+    info->uri             = NULL;
+    info->search_text     = NULL;
 
     widget = webkit_web_view_new();
     /* WebkitWebView is uncontrollably scrollable, so if we don't set a
@@ -658,7 +625,7 @@ libbalsa_html_new(LibBalsaMessageBody *body,
     webkit_settings_set_enable_plugins(settings, FALSE);
     webkit_settings_set_auto_load_images
         (settings,
-        g_regex_match_simple(cid_regex, text, G_REGEX_CASELESS, 0));
+         g_regex_match_simple(cid_regex, text, G_REGEX_CASELESS, 0));
 
     g_signal_connect(web_view, "mouse-target-changed",
                      G_CALLBACK(lbh_mouse_target_changed_cb), info);
@@ -689,53 +656,45 @@ libbalsa_html_new(LibBalsaMessageBody *body,
     return vbox;
 }
 
-
 void
-libbalsa_html_to_string(gchar **text,
-                        size_t  len)
+libbalsa_html_to_string(gchar ** text, size_t len)
 {
     /* this widget does not support conversion to a string. */
     html2text(text, len);
 }
 
-
 /*
  * We may be passed either the WebKitWebView or its container:
  */
 static gboolean
-lbh_get_web_view(GtkWidget      *widget,
-                 WebKitWebView **web_view)
+lbh_get_web_view(GtkWidget * widget, WebKitWebView ** web_view)
 {
-    if (!WEBKIT_IS_WEB_VIEW(widget)) {
+    if (!WEBKIT_IS_WEB_VIEW(widget))
         widget =
             g_object_get_data(G_OBJECT(widget), "libbalsa-html-web-view");
-    }
 
     *web_view = (WebKitWebView *) widget;
 
     return WEBKIT_IS_WEB_VIEW(*web_view);
 }
 
-
 /*
  * Does the widget support zoom?
  */
 gboolean
-libbalsa_html_can_zoom(GtkWidget *widget)
+libbalsa_html_can_zoom(GtkWidget * widget)
 {
     WebKitWebView *web_view;
 
     return lbh_get_web_view(widget, &web_view);
 }
 
-
 /*
  * Zoom the widget.
  */
-#         define LIBBALSA_HTML_ZOOM_FACTOR 1.2
+#define LIBBALSA_HTML_ZOOM_FACTOR 1.2
 void
-libbalsa_html_zoom(GtkWidget *widget,
-                   gint       in_out)
+libbalsa_html_zoom(GtkWidget * widget, gint in_out)
 {
     WebKitWebView *web_view;
 
@@ -748,15 +707,12 @@ libbalsa_html_zoom(GtkWidget *widget,
         case +1:
             zoom_level *= LIBBALSA_HTML_ZOOM_FACTOR;
             break;
-
         case -1:
             zoom_level /= LIBBALSA_HTML_ZOOM_FACTOR;
             break;
-
         case 0:
             zoom_level = 1.0;
             break;
-
         default:
             break;
         }
@@ -765,76 +721,68 @@ libbalsa_html_zoom(GtkWidget *widget,
     }
 }
 
-
 /*
  * Does the widget support selecting text?
  */
 gboolean
-libbalsa_html_can_select(GtkWidget *widget)
+libbalsa_html_can_select(GtkWidget * widget)
 {
     WebKitWebView *web_view;
 
     return lbh_get_web_view(widget, &web_view);
 }
 
-
 /*
  * Select all the text.
  */
 void
-libbalsa_html_select_all(GtkWidget *widget)
+libbalsa_html_select_all(GtkWidget * widget)
 {
     WebKitWebView *web_view;
 
-    if (lbh_get_web_view(widget, &web_view)) {
+    if (lbh_get_web_view(widget, &web_view))
         webkit_web_view_execute_editing_command
             (web_view, WEBKIT_EDITING_COMMAND_SELECT_ALL);
-    }
 }
 
-
 /*
  * Copy selected text to the clipboard.
  */
 void
-libbalsa_html_copy(GtkWidget *widget)
+libbalsa_html_copy(GtkWidget * widget)
 {
     WebKitWebView *web_view;
 
-    if (lbh_get_web_view(widget, &web_view)) {
+    if (lbh_get_web_view(widget, &web_view))
         webkit_web_view_execute_editing_command
             (web_view, WEBKIT_EDITING_COMMAND_COPY);
-    }
 }
 
-
 /*
  * Does the widget support searching text?
  */
 gboolean
-libbalsa_html_can_search(GtkWidget *widget)
+libbalsa_html_can_search(GtkWidget * widget)
 {
     WebKitWebView *web_view;
 
     return lbh_get_web_view(widget, &web_view);
 }
 
-
 /*
  * Search for the text; if text is empty, call the callback with TRUE
  * (for consistency with GtkTextIter methods).
  */
 
 static void
-lbh_search_failed_to_find_text_cb(WebKitFindController *controller,
-                                  gpointer              data)
+lbh_search_failed_to_find_text_cb(WebKitFindController * controller,
+                                  gpointer               data)
 {
     LibBalsaWebKitInfo *info = data;
 
     (*info->search_cb)(info->search_text, FALSE, info->search_cb_data);
 }
 
-
 static void
 lbh_search_found_text_cb(WebKitFindController *controller,
                          guint                 match_count,
@@ -845,11 +793,10 @@ lbh_search_found_text_cb(WebKitFindController *controller,
     (*info->search_cb)(info->search_text, TRUE, info->search_cb_data);
 }
 
-
 static void
-lbh_search_init(LibBalsaWebKitInfo        *info,
-                WebKitFindController      *controller,
-                const gchar               *text,
+lbh_search_init(LibBalsaWebKitInfo       * info,
+                WebKitFindController     * controller,
+                const gchar              * text,
                 gboolean                   find_forward,
                 gboolean                   wrap,
                 LibBalsaHtmlSearchCallback search_cb,
@@ -879,41 +826,36 @@ lbh_search_init(LibBalsaWebKitInfo        *info,
     }
 
     find_options = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE;
-    if (!find_forward) {
+    if (!find_forward)
         find_options |= WEBKIT_FIND_OPTIONS_BACKWARDS;
-    }
-    if (wrap) {
+    if (wrap)
         find_options |= WEBKIT_FIND_OPTIONS_WRAP_AROUND;
-    }
 
     webkit_find_controller_search(controller, text, find_options,
                                   G_MAXUINT);
 }
 
-
 static void
-lbh_search_continue(WebKitFindController *controller,
-                    const gchar          *text,
-                    gboolean              find_forward,
-                    gboolean              wrap)
+lbh_search_continue(WebKitFindController * controller,
+                    const gchar          * text,
+                    gboolean               find_forward,
+                    gboolean               wrap)
 {
     guint32 find_options;
     guint32 orig_find_options;
 
     orig_find_options = find_options =
-            webkit_find_controller_get_options(controller);
+        webkit_find_controller_get_options(controller);
 
-    if (!find_forward) {
+    if (!find_forward)
         find_options |= WEBKIT_FIND_OPTIONS_BACKWARDS;
-    } else {
+    else
         find_options &= ~WEBKIT_FIND_OPTIONS_BACKWARDS;
-    }
 
-    if (wrap) {
+    if (wrap)
         find_options |= WEBKIT_FIND_OPTIONS_WRAP_AROUND;
-    } else {
+    else
         find_options &= ~WEBKIT_FIND_OPTIONS_WRAP_AROUND;
-    }
 
     if (find_options != orig_find_options) {
         /* No setter for find-options, so we start a new search */
@@ -921,18 +863,16 @@ lbh_search_continue(WebKitFindController *controller,
                                       G_MAXUINT);
     } else {
         /* OK to use next/previous methods */
-        if (find_forward) {
+        if (find_forward)
             webkit_find_controller_search_next(controller);
-        } else {
+        else
             webkit_find_controller_search_previous(controller);
-        }
     }
 }
 
-
 void
-libbalsa_html_search(GtkWidget                 *widget,
-                     const gchar               *text,
+libbalsa_html_search(GtkWidget                * widget,
+                     const gchar              * text,
                      gboolean                   find_forward,
                      gboolean                   wrap,
                      LibBalsaHtmlSearchCallback search_cb,
@@ -957,56 +897,51 @@ libbalsa_html_search(GtkWidget                 *widget,
     }
 }
 
-
 /*
  * We do not need selection bounds.
  */
 gboolean
-libbalsa_html_get_selection_bounds(GtkWidget    *widget,
-                                   GdkRectangle *selection_bounds)
+libbalsa_html_get_selection_bounds(GtkWidget    * widget,
+                                   GdkRectangle * selection_bounds)
 {
     return FALSE;
 }
 
-
 /*
  * Get the WebKitWebView widget from the container; we need to connect
  * to its "populate-popup" signal.
  */
 GtkWidget *
-libbalsa_html_popup_menu_widget(GtkWidget *widget)
+libbalsa_html_popup_menu_widget(GtkWidget * widget)
 {
     return NULL;
 }
 
-
 GtkWidget *
-libbalsa_html_get_view_widget(GtkWidget *widget)
+libbalsa_html_get_view_widget(GtkWidget * widget)
 {
     WebKitWebView *web_view;
 
     return lbh_get_web_view(widget, &web_view) ?
-           GTK_WIDGET(web_view) : NULL;
+        GTK_WIDGET(web_view) : NULL;
 }
 
-
 /*
  * Does the widget support printing?
  */
 gboolean
-libbalsa_html_can_print(GtkWidget *widget)
+libbalsa_html_can_print(GtkWidget * widget)
 {
     WebKitWebView *web_view;
 
     return lbh_get_web_view(widget, &web_view);
 }
 
-
 /*
  * Print the widget's content.
  */
 void
-libbalsa_html_print(GtkWidget *widget)
+libbalsa_html_print(GtkWidget * widget)
 {
     WebKitWebView *web_view;
 
@@ -1015,9 +950,8 @@ libbalsa_html_print(GtkWidget *widget)
         WebKitPrintOperation *print_operation;
         WebKitPrintOperationResponse response;
 
-        if (!settings) {
+        if (!settings)
             settings = gtk_print_settings_new();
-        }
 
         print_operation = webkit_print_operation_new(web_view);
         webkit_print_operation_set_print_settings(print_operation,
@@ -1034,20 +968,19 @@ libbalsa_html_print(GtkWidget *widget)
     }
 }
 
-
-#      else                     /* defined(USE_WEBKIT2) */
-#         include <webkit/webkit.h>
-#         include <JavaScriptCore/JavaScript.h>
+#  else                         /* defined(USE_WEBKIT2) */
+#include <webkit/webkit.h>
+#include <JavaScriptCore/JavaScript.h>
 
 typedef struct {
-    LibBalsaMessageBody *body;
-    LibBalsaHtmlCallback hover_cb;
-    LibBalsaHtmlCallback clicked_cb;
-    WebKitWebFrame *frame;
-    gboolean download_images;
-    GtkWidget *vbox;
-    gboolean has_info_bar;
-    WebKitWebView *web_view;
+    LibBalsaMessageBody  *body;
+    LibBalsaHtmlCallback  hover_cb;
+    LibBalsaHtmlCallback  clicked_cb;
+    WebKitWebFrame       *frame;
+    gboolean              download_images;
+    GtkWidget            *vbox;
+    gboolean              has_info_bar;
+    WebKitWebView        *web_view;
 } LibBalsaWebKitInfo;
 
 /*
@@ -1056,17 +989,16 @@ typedef struct {
  * Pass the URI to the handler set by the caller
  */
 static void
-lbh_hovering_over_link_cb(GtkWidget   *web_view,
-                          const gchar *title,
-                          const gchar *uri,
-                          gpointer     data)
+lbh_hovering_over_link_cb(GtkWidget   * web_view,
+                          const gchar * title,
+                          const gchar * uri,
+                          gpointer      data)
 {
     LibBalsaWebKitInfo *info = data;
 
     (*info->hover_cb)(uri);
 }
 
-
 /*
  * Callback for the "navigation-policy-decision-requested" signal
  *
@@ -1075,12 +1007,12 @@ lbh_hovering_over_link_cb(GtkWidget   *web_view,
  * are supposed to open in their own windows.
  */
 static gboolean
-lbh_navigation_policy_decision_requested_cb(WebKitWebView             *web_view,
-                                            WebKitWebFrame            *frame,
-                                            WebKitNetworkRequest      *request,
-                                            WebKitWebNavigationAction *action,
-                                            WebKitWebPolicyDecision   *decision,
-                                            gpointer                   data)
+lbh_navigation_policy_decision_requested_cb(WebKitWebView             * web_view,
+                                            WebKitWebFrame            * frame,
+                                            WebKitNetworkRequest      * request,
+                                            WebKitWebNavigationAction * action,
+                                            WebKitWebPolicyDecision   * decision,
+                                            gpointer                    data)
 {
     WebKitWebNavigationReason reason;
     LibBalsaWebKitInfo *info = data;
@@ -1089,21 +1021,21 @@ lbh_navigation_policy_decision_requested_cb(WebKitWebView             *web_view,
 
     /* First request is for "about:blank"; we must allow it, but first
      * we store the main frame, so we can detect a new frame later. */
-    if (!info->frame) {
+    if (!info->frame)
         info->frame = frame;
-    } else if ((web_view == info->web_view)
-               && (frame != info->frame)
-               && (reason == WEBKIT_WEB_NAVIGATION_REASON_OTHER)) {
-        g_message("%s new frame ignored:\n URI=“%s”", __func__,
+    else if (web_view == info->web_view
+             && frame != info->frame
+             && reason == WEBKIT_WEB_NAVIGATION_REASON_OTHER) {
+        g_message("%s new frame ignored:\n URI=“%s”", __func__, 
                   webkit_network_request_get_uri(request));
         webkit_web_policy_decision_ignore(decision);
         return TRUE;
     }
 
-    if ((reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) ||
-        ((web_view != info->web_view)
-         && (reason == WEBKIT_WEB_NAVIGATION_REASON_OTHER))) {
-        (*info->clicked_cb)(webkit_network_request_get_uri(request));
+    if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED ||
+        (web_view != info->web_view
+         && reason == WEBKIT_WEB_NAVIGATION_REASON_OTHER)) {
+        (*info->clicked_cb) (webkit_network_request_get_uri(request));
         webkit_web_policy_decision_ignore(decision);
         return TRUE;
     }
@@ -1111,15 +1043,13 @@ lbh_navigation_policy_decision_requested_cb(WebKitWebView             *web_view,
     return FALSE;
 }
 
-
 /*
  * Show the GtkInfoBar for asking about downloading images
  */
 
 static void
-lbh_info_bar_response_cb(GtkInfoBar *info_bar,
-                         gint        response_id,
-                         gpointer    user_data)
+lbh_info_bar_response_cb(GtkInfoBar * info_bar,
+                         gint response_id, gpointer user_data)
 {
     LibBalsaWebKitInfo *info = user_data;
 
@@ -1131,7 +1061,7 @@ lbh_info_bar_response_cb(GtkInfoBar *info_bar,
             webkit_web_view_reload_bypass_cache(info->web_view);
             webkit_web_view_load_string(info->web_view, text, "text/html",
                                         libbalsa_message_body_charset
-                                            (info->body), NULL);
+                                        (info->body), NULL);
             g_free(text);
         }
     }
@@ -1139,9 +1069,8 @@ lbh_info_bar_response_cb(GtkInfoBar *info_bar,
     gtk_widget_destroy(GTK_WIDGET(info_bar));
 }
 
-
 static void
-lbh_show_info_bar(LibBalsaWebKitInfo *info)
+lbh_show_info_bar(LibBalsaWebKitInfo * info)
 {
     GtkWidget *info_bar_widget;
     GtkInfoBar *info_bar;
@@ -1154,15 +1083,14 @@ lbh_show_info_bar(LibBalsaWebKitInfo *info)
                     "You may choose to download them "
                     "if you trust the server.");
 
-    if (info->has_info_bar) {
+    if (info->has_info_bar)
         return;
-    }
 
     info_bar_widget =
         gtk_info_bar_new_with_buttons(_("_Download images"),
-                                      GTK_RESPONSE_OK,
-                                      _("_Close"), GTK_RESPONSE_CLOSE,
-                                      NULL);
+                                     GTK_RESPONSE_OK,
+                                     _("_Close"), GTK_RESPONSE_CLOSE,
+                                     NULL);
     gtk_box_pack_start(GTK_BOX(info->vbox), info_bar_widget);
 
     info_bar = GTK_INFO_BAR(info_bar_widget);
@@ -1181,7 +1109,6 @@ lbh_show_info_bar(LibBalsaWebKitInfo *info)
     info->has_info_bar = TRUE;
 }
 
-
 /*
  * Callback for the "resource-request-starting" signal
  *
@@ -1190,28 +1117,26 @@ lbh_show_info_bar(LibBalsaWebKitInfo *info)
  */
 
 static void
-lbh_resource_request_starting_cb(WebKitWebView         *web_view,
-                                 WebKitWebFrame        *frame,
-                                 WebKitWebResource     *resource,
-                                 WebKitNetworkRequest  *request,
-                                 WebKitNetworkResponse *response,
-                                 gpointer               data)
+lbh_resource_request_starting_cb(WebKitWebView         * web_view,
+                                 WebKitWebFrame        * frame,
+                                 WebKitWebResource     * resource,
+                                 WebKitNetworkRequest  * request,
+                                 WebKitNetworkResponse * response,
+                                 gpointer                data)
 {
     const gchar *uri = webkit_network_request_get_uri(request);
     LibBalsaWebKitInfo *info = data;
 
-    if (!g_ascii_strcasecmp(uri, "about:blank")) {
+    if (!g_ascii_strcasecmp(uri, "about:blank"))
         return;
-    }
 
     if (g_ascii_strncasecmp(uri, "cid:", 4)) {
         /* Not a "cid:" request: disable loading. */
         static GHashTable *cache = NULL;
 
-        if (!cache) {
+        if (!cache)
             cache = g_hash_table_new_full(g_str_hash, g_str_equal,
                                           g_free, NULL);
-        }
 
         if (!g_hash_table_lookup(cache, uri)) {
             if (info->download_images) {
@@ -1227,7 +1152,7 @@ lbh_resource_request_starting_cb(WebKitWebView         *web_view,
 
         /* Replace "cid:" request with a "file:" request. */
         if ((body =
-                 libbalsa_message_get_part_by_id(info->body->message, uri + 4))
+             libbalsa_message_get_part_by_id(info->body->message, uri + 4))
             && libbalsa_message_body_save_temporary(body, NULL)) {
             gchar *file_uri =
                 g_strconcat("file://", body->temp_filename, NULL);
@@ -1237,7 +1162,6 @@ lbh_resource_request_starting_cb(WebKitWebView         *web_view,
     }
 }
 
-
 /*
  * To handle a clicked link that is supposed to open in a new window
  * (specifically, has the attribute 'target="_blank"'), we must allow
@@ -1249,76 +1173,71 @@ lbh_resource_request_starting_cb(WebKitWebView         *web_view,
  * Allow the new window only if it is needed because a link was clicked.
  */
 static gboolean
-lbh_new_window_policy_decision_requested_cb(WebKitWebView             *web_view,
-                                            WebKitWebFrame            *frame,
-                                            WebKitNetworkRequest      *request,
-                                            WebKitWebNavigationAction *action,
-                                            WebKitWebPolicyDecision   *decision,
-                                            gpointer                   data)
+lbh_new_window_policy_decision_requested_cb(WebKitWebView             * web_view,
+                                            WebKitWebFrame            * frame,
+                                            WebKitNetworkRequest      * request,
+                                            WebKitWebNavigationAction * action,
+                                            WebKitWebPolicyDecision   * decision,
+                                            gpointer                    data)
 {
     WebKitWebNavigationReason reason;
 
     g_object_get(action, "reason", &reason, NULL);
 
-    if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) {
+    if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED)
         return FALSE;
-    }
 
     webkit_web_policy_decision_ignore(decision);
     return TRUE;
 }
 
-
 /*
  * Idle handler to actually unref it.
  */
 static gboolean
-lbh_web_view_ready_idle(WebKitWebView *web_view)
+lbh_web_view_ready_idle(WebKitWebView * web_view)
 {
     g_object_unref(g_object_ref_sink(web_view));
 
     return FALSE;
 }
 
-
 /*
  * Window is ready, now we destroy it.
  */
 static gboolean
-lbh_web_view_ready_cb(WebKitWebView *web_view,
-                      gpointer       data)
+lbh_web_view_ready_cb(WebKitWebView * web_view,
+                      gpointer        data)
 {
     g_idle_add((GSourceFunc) lbh_web_view_ready_idle, web_view);
 
     return TRUE;
 }
 
-
 /*
  * WebKit wants a new window.
  */
 static WebKitWebView *
-lbh_create_web_view_cb(WebKitWebView  *web_view,
-                       WebKitWebFrame *frame,
-                       gpointer        data)
+lbh_create_web_view_cb(WebKitWebView  * web_view,
+                       WebKitWebFrame * frame,
+                       gpointer         data)
 {
     GtkWidget *widget;
 
     widget = webkit_web_view_new();
     g_signal_connect(widget, "navigation-policy-decision-requested",
                      G_CALLBACK
-                         (lbh_navigation_policy_decision_requested_cb), data);
+                     (lbh_navigation_policy_decision_requested_cb), data);
     g_signal_connect(widget, "web-view-ready", G_CALLBACK(lbh_web_view_ready_cb),
                      NULL);
 
     return WEBKIT_WEB_VIEW(widget);
 }
 
-
 /* Create a new WebKitWebView widget:
  * text                        the HTML source;
  * len                 length of text;
- * body                 LibBalsaMessageBody that belongs to the
+ * body                LibBalsaMessageBody that belongs to the
  *                      LibBalsaMessage from which to extract any
  *                     HTML objects (by url);
  * hover_cb             callback for link-hover signal;
@@ -1326,9 +1245,9 @@ lbh_create_web_view_cb(WebKitWebView  *web_view,
  */
 
 GtkWidget *
-libbalsa_html_new(LibBalsaMessageBody *body,
-                  LibBalsaHtmlCallback hover_cb,
-                  LibBalsaHtmlCallback clicked_cb)
+libbalsa_html_new(LibBalsaMessageBody * body,
+                  LibBalsaHtmlCallback  hover_cb,
+                  LibBalsaHtmlCallback  clicked_cb)
 {
     gchar *text;
     gssize len;
@@ -1338,18 +1257,17 @@ libbalsa_html_new(LibBalsaMessageBody *body,
     LibBalsaWebKitInfo *info;
 
     len = lbh_get_body_content(body, &text);
-    if (len < 0) {
+    if (len < 0)
         return NULL;
-    }
 
     info = g_new(LibBalsaWebKitInfo, 1);
-    info->body = body;
-    info->hover_cb = hover_cb;
-    info->clicked_cb = clicked_cb;
-    info->frame = NULL;
+    info->body            = body;
+    info->hover_cb        = hover_cb;
+    info->clicked_cb      = clicked_cb;
+    info->frame           = NULL;
     info->download_images = FALSE;
-    info->has_info_bar = FALSE;
-    info->vbox = vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+    info->has_info_bar    = FALSE;
+    info->vbox = vbox     = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
 
     widget = webkit_web_view_new();
     gtk_widget_set_vexpand(widget, TRUE);
@@ -1361,15 +1279,15 @@ libbalsa_html_new(LibBalsaMessageBody *body,
                            g_free);
 
     g_object_set(webkit_web_view_get_settings(web_view),
-                 "enable-scripts", FALSE,
-                 "enable-plugins", FALSE,
+                 "enable-scripts",   FALSE,
+                 "enable-plugins",   FALSE,
                  NULL);
 
     g_signal_connect(web_view, "hovering-over-link",
                      G_CALLBACK(lbh_hovering_over_link_cb), info);
     g_signal_connect(web_view, "navigation-policy-decision-requested",
                      G_CALLBACK
-                         (lbh_navigation_policy_decision_requested_cb), info);
+                     (lbh_navigation_policy_decision_requested_cb), info);
     g_signal_connect(web_view, "resource-request-starting",
                      G_CALLBACK(lbh_resource_request_starting_cb), info);
     g_signal_connect(web_view, "new-window-policy-decision-requested",
@@ -1388,19 +1306,15 @@ libbalsa_html_new(LibBalsaMessageBody *body,
     return vbox;
 }
 
-
 void
-libbalsa_html_to_string(gchar **text,
-                        size_t  len)
+libbalsa_html_to_string(gchar ** text, size_t len)
 {
     /* this widget does not support conversion to a string. */
     html2text(text, len);
 }
 
-
 static gboolean
-lbh_get_web_view(GtkWidget      *widget,
-                 WebKitWebView **web_view)
+lbh_get_web_view(GtkWidget * widget, WebKitWebView ** web_view)
 {
     *web_view =
         g_object_get_data(G_OBJECT(widget), "libbalsa-html-web-view");
@@ -1408,25 +1322,22 @@ lbh_get_web_view(GtkWidget      *widget,
     return *web_view && WEBKIT_IS_WEB_VIEW(*web_view);
 }
 
-
 /*
  * Does the widget support zoom?
  */
 gboolean
-libbalsa_html_can_zoom(GtkWidget *widget)
+libbalsa_html_can_zoom(GtkWidget * widget)
 {
     WebKitWebView *web_view;
 
     return lbh_get_web_view(widget, &web_view);
 }
 
-
 /*
  * Zoom the widget.
  */
 void
-libbalsa_html_zoom(GtkWidget *widget,
-                   gint       in_out)
+libbalsa_html_zoom(GtkWidget * widget, gint in_out)
 {
     WebKitWebView *web_view;
 
@@ -1435,88 +1346,77 @@ libbalsa_html_zoom(GtkWidget *widget,
         case +1:
             webkit_web_view_zoom_in(web_view);
             break;
-
         case -1:
             webkit_web_view_zoom_out(web_view);
             break;
-
         case 0:
             webkit_web_view_set_zoom_level(web_view, 1.0);
             break;
-
         default:
             break;
         }
     }
 }
 
-
 /*
  * Does the widget support selecting text?
  */
 gboolean
-libbalsa_html_can_select(GtkWidget *widget)
+libbalsa_html_can_select(GtkWidget * widget)
 {
     WebKitWebView *web_view;
 
     return lbh_get_web_view(widget, &web_view);
 }
 
-
 /*
  * Select all the text.
  */
 void
-libbalsa_html_select_all(GtkWidget *widget)
+libbalsa_html_select_all(GtkWidget * widget)
 {
     WebKitWebView *web_view;
 
-    if (lbh_get_web_view(widget, &web_view)) {
+    if (lbh_get_web_view(widget, &web_view))
         webkit_web_view_select_all(web_view);
-    }
 }
 
-
 /*
  * Copy selected text to the clipboard.
  */
 void
-libbalsa_html_copy(GtkWidget *widget)
+libbalsa_html_copy(GtkWidget * widget)
 {
     WebKitWebView *web_view;
 
-    if (lbh_get_web_view(widget, &web_view)) {
+    if (lbh_get_web_view(widget, &web_view))
         webkit_web_view_copy_clipboard(web_view);
-    }
 }
 
-
 /*
  * Does the widget support searching text?
  */
 gboolean
-libbalsa_html_can_search(GtkWidget *widget)
+libbalsa_html_can_search(GtkWidget * widget)
 {
     WebKitWebView *web_view;
 
     return lbh_get_web_view(widget, &web_view);
 }
 
-
 /*
  * JavaScript-based helpers for text search
  */
 static JSGlobalContextRef
-lbh_js_get_global_context(WebKitWebView *web_view)
+lbh_js_get_global_context(WebKitWebView * web_view)
 {
     WebKitWebFrame *web_frame = webkit_web_view_get_main_frame(web_view);
     return webkit_web_frame_get_global_context(web_frame);
 }
 
-
 static JSValueRef
-lbh_js_run_script(JSContextRef ctx,
-                  const gchar *script)
+lbh_js_run_script(JSContextRef  ctx,
+                  const gchar * script)
 {
     JSStringRef str;
     JSValueRef value;
@@ -1528,27 +1428,25 @@ lbh_js_run_script(JSContextRef ctx,
     return value;
 }
 
-
 static gint
-lbh_js_object_get_property(JSContextRef ctx,
-                           JSObjectRef  object,
-                           const gchar *property_name)
+lbh_js_object_get_property(JSContextRef  ctx,
+                           JSObjectRef   object,
+                           const gchar * property_name)
 {
-    JSStringRef str = JSStringCreateWithUTF8CString(property_name);
+    JSStringRef str  = JSStringCreateWithUTF8CString(property_name);
     JSValueRef value = JSObjectGetProperty(ctx, object, str, NULL);
     JSStringRelease(str);
 
     return (gint) JSValueToNumber(ctx, value, NULL);
 }
 
-
 /*
  * Search for the text; if text is empty, return TRUE (for consistency
  * with GtkTextIter methods).
  */
 void
-libbalsa_html_search(GtkWidget                 *widget,
-                     const gchar               *text,
+libbalsa_html_search(GtkWidget                * widget,
+                     const gchar              * text,
                      gboolean                   find_forward,
                      gboolean                   wrap,
                      LibBalsaHtmlSearchCallback search_cb,
@@ -1557,9 +1455,8 @@ libbalsa_html_search(GtkWidget                 *widget,
     WebKitWebView *web_view;
     gboolean retval;
 
-    if (!lbh_get_web_view(widget, &web_view)) {
+    if (!lbh_get_web_view(widget, &web_view))
         return;
-    }
 
     if (!*text) {
         gchar script[] = "window.getSelection().removeAllRanges()";
@@ -1578,14 +1475,13 @@ libbalsa_html_search(GtkWidget                 *widget,
     return;
 }
 
-
 /*
  * Get the rectangle containing the currently selected text, for
  * scrolling.
  */
 gboolean
-libbalsa_html_get_selection_bounds(GtkWidget    *widget,
-                                   GdkRectangle *selection_bounds)
+libbalsa_html_get_selection_bounds(GtkWidget    * widget,
+                                   GdkRectangle * selection_bounds)
 {
     WebKitWebView *web_view;
     JSGlobalContextRef ctx;
@@ -1593,9 +1489,8 @@ libbalsa_html_get_selection_bounds(GtkWidget    *widget,
         "window.getSelection().getRangeAt(0).getBoundingClientRect()";
     JSValueRef value;
 
-    if (!lbh_get_web_view(widget, &web_view)) {
+    if (!lbh_get_web_view(widget, &web_view))
         return FALSE;
-    }
 
     ctx = lbh_js_get_global_context(web_view);
     value = lbh_js_run_script(ctx, script);
@@ -1623,45 +1518,41 @@ libbalsa_html_get_selection_bounds(GtkWidget    *widget,
     return FALSE;
 }
 
-
 /*
  * Get the WebKitWebView widget from the container; we need to connect
  * to its "populate-popup" signal.
  */
 GtkWidget *
-libbalsa_html_popup_menu_widget(GtkWidget *widget)
+libbalsa_html_popup_menu_widget(GtkWidget * widget)
 {
     WebKitWebView *web_view;
 
     return lbh_get_web_view(widget, &web_view) ?
-           GTK_WIDGET(web_view) : NULL;
+        GTK_WIDGET(web_view) : NULL;
 }
 
-
 GtkWidget *
-libbalsa_html_get_view_widget(GtkWidget *widget)
+libbalsa_html_get_view_widget(GtkWidget * widget)
 {
     return libbalsa_html_popup_menu_widget(widget);
 }
 
-
 /*
  * Does the widget support printing?
  */
 gboolean
-libbalsa_html_can_print(GtkWidget *widget)
+libbalsa_html_can_print(GtkWidget * widget)
 {
     WebKitWebView *web_view;
 
     return lbh_get_web_view(widget, &web_view);
 }
 
-
 /*
  * Print the widget's content.
  */
 void
-libbalsa_html_print(GtkWidget *widget)
+libbalsa_html_print(GtkWidget * widget)
 {
     WebKitWebView *web_view;
 
@@ -1671,19 +1562,18 @@ libbalsa_html_print(GtkWidget *widget)
     }
 }
 
-
-#      endif                    /* defined(USE_WEBKIT2) */
-#   else                        /* defined(HAVE_WEBKIT) */
+#  endif                        /* defined(USE_WEBKIT2) */
+# else                          /* defined(HAVE_WEBKIT) */
 
 /* Code for GtkHTML-4 */
-#      include <gtkhtml/gtkhtml.h>
-#      include <gtkhtml/gtkhtml-stream.h>
+#include <gtkhtml/gtkhtml.h>
+#include <gtkhtml/gtkhtml-stream.h>
 
 /* Forward reference. */
-static gboolean libbalsa_html_url_requested(GtkWidget       *html,
-                                            const gchar     *url,
-                                            gpointer         stream,
-                                            LibBalsaMessage *msg);
+static gboolean libbalsa_html_url_requested(GtkWidget * html,
+                                           const gchar * url,
+                                           gpointer stream,
+                                           LibBalsaMessage * msg);
 
 typedef struct {
     LibBalsaHtmlCallback hover_cb;
@@ -1691,70 +1581,60 @@ typedef struct {
 } LibBalsaHTMLInfo;
 
 static void
-lbh_navigation_requested_cb(GtkWidget   *widget,
-                            const gchar *uri,
-                            gpointer     data)
+lbh_navigation_requested_cb(GtkWidget   * widget,
+                            const gchar * uri,
+                            gpointer      data)
 {
     LibBalsaHTMLInfo *info = data;
 
-    if (info->clicked_cb) {
+    if (info->clicked_cb)
         (*info->clicked_cb)(uri);
-    }
 }
 
-
 static void
-lbh_hovering_over_link_cb(GtkWidget   *widget,
-                          const gchar *uri,
-                          gpointer     data)
+lbh_hovering_over_link_cb(GtkWidget   * widget,
+                          const gchar * uri,
+                          gpointer      data)
 {
     LibBalsaHTMLInfo *info = data;
 
-    if (info->hover_cb) {
-        (*info->hover_cb)(uri);
-    }
+    if (info->hover_cb)
+        (*info->hover_cb) (uri);
 }
 
-
 /* Callback for exporting an HTML part as text/plain. */
 static gboolean
-libbalsa_html_receiver_fn(gpointer     engine,
-                          const gchar *data,
-                          size_t       len,
-                          GString     *export_string)
+libbalsa_html_receiver_fn(gpointer engine, const gchar * data, size_t len,
+                         GString * export_string)
 {
     g_string_append(export_string, data);
     return TRUE;
 }
 
-
 /* Widget-dependent helper. */
 static void
-libbalsa_html_write_mime_stream(GtkHTMLStream *stream,
-                                GMimeStream   *mime_stream)
+libbalsa_html_write_mime_stream(GtkHTMLStream * stream,
+                                GMimeStream * mime_stream)
 {
     gint i;
     char buf[4096];
 
-    while ((i = g_mime_stream_read(mime_stream, buf, sizeof(buf))) > 0) {
-        gtk_html_stream_write(stream, buf, i);
-    }
+    while ((i = g_mime_stream_read(mime_stream, buf, sizeof(buf))) > 0)
+       gtk_html_stream_write(stream, buf, i);
     gtk_html_stream_close(stream, GTK_HTML_STREAM_OK);
 }
 
-
 /* Helper for creating a new GtkHTML widget:
  * text                        the HTML source;
  * len                 length of text;
  * charset             source charset, or NULL;
- * export_string        if we want the text exported as text/plain, a
- *                      GString to receive it; otherwise NULL;
+ * export_string       if we want the text exported as text/plain, a
+ *                     GString to receive it; otherwise NULL;
  */
 static GtkWidget *
-lbh_new(const gchar *text,
-        size_t       len,
-        const gchar *charset,
-        GString     *export_string)
+lbh_new(const gchar * text, size_t len,
+       const gchar * charset,
+        GString * export_string)
 {
     GtkWidget *html;
     GtkHTMLStream *stream;
@@ -1762,8 +1642,8 @@ lbh_new(const gchar *text,
     html = gtk_html_new();
     stream = gtk_html_begin(GTK_HTML(html));
     if (len > 0) {
-        if (charset && (g_ascii_strcasecmp(charset, "us-ascii") != 0)
-            && (g_ascii_strcasecmp(charset, "utf-8") != 0)) {
+        if (charset && g_ascii_strcasecmp(charset, "us-ascii") != 0
+            && g_ascii_strcasecmp(charset, "utf-8") != 0) {
             const gchar *charset_iconv;
             gchar *s;
             gsize bytes_written;
@@ -1777,25 +1657,21 @@ lbh_new(const gchar *text,
                           __func__, charset_iconv, error->message);
                 g_error_free(error);
                 gtk_html_write(GTK_HTML(html), stream, text, len);
-            } else {
+            } else
                 gtk_html_write(GTK_HTML(html), stream, s, bytes_written);
-            }
             g_free(s);
-        } else {
+        } else
             gtk_html_write(GTK_HTML(html), stream, text, len);
-        }
-    }
-    if (export_string) {
-        gtk_html_export(GTK_HTML(html), "text/plain",
-                        (GtkHTMLSaveReceiverFn) libbalsa_html_receiver_fn,
-                        export_string);
     }
+    if (export_string)
+       gtk_html_export(GTK_HTML(html), "text/plain",
+                       (GtkHTMLSaveReceiverFn) libbalsa_html_receiver_fn,
+                       export_string);
     gtk_html_end(GTK_HTML(html), stream, GTK_HTML_STREAM_OK);
-    if (export_string) {
-        gtk_html_export(GTK_HTML(html), "text/plain",
-                        (GtkHTMLSaveReceiverFn) libbalsa_html_receiver_fn,
-                        export_string);
-    }
+    if (export_string)
+       gtk_html_export(GTK_HTML(html), "text/plain",
+                       (GtkHTMLSaveReceiverFn) libbalsa_html_receiver_fn,
+                       export_string);
 
     gtk_html_set_editable(GTK_HTML(html), FALSE);
     gtk_html_allow_selection(GTK_HTML(html), TRUE);
@@ -1803,20 +1679,19 @@ lbh_new(const gchar *text,
     return html;
 }
 
-
 /* Create a new HtmlView widget:
  * text                        the HTML source;
  * len                 length of text;
- * body                 LibBalsaMessageBody that belongs to the
+ * body                LibBalsaMessageBody that belongs to the
  *                      LibBalsaMessage from which to extract any
  *                     HTML objects (by url);
  * hover_cb             callback for the "on-url" signal;
  * link_clicked_cb     callback for the "link-clicked" signal;
  */
 GtkWidget *
-libbalsa_html_new(LibBalsaMessageBody *body,
-                  LibBalsaHtmlCallback hover_cb,
-                  LibBalsaHtmlCallback clicked_cb)
+libbalsa_html_new(LibBalsaMessageBody * body,
+                  LibBalsaHtmlCallback  hover_cb,
+                  LibBalsaHtmlCallback  clicked_cb)
 {
     gssize len;
     gchar *text;
@@ -1824,9 +1699,8 @@ libbalsa_html_new(LibBalsaMessageBody *body,
     LibBalsaHTMLInfo *info;
 
     len = lbh_get_body_content(body, &text);
-    if (len < 0) {
+    if (len < 0)
         return NULL;
-    }
 
     widget = lbh_new(text, len, libbalsa_message_body_charset(body), NULL);
     g_free(text);
@@ -1849,20 +1723,18 @@ libbalsa_html_new(LibBalsaMessageBody *body,
     return widget;
 }
 
-
 /* Use an HtmlView widget to convert html text to a (null-terminated) string:
  * text                        the HTML source;
  * len                 length of text;
  * frees and reallocates the string.
  */
 void
-libbalsa_html_to_string(gchar **text,
-                        size_t  len)
+libbalsa_html_to_string(gchar ** text, size_t len)
 {
     GtkWidget *html;
     GString *str;
 
-    str = g_string_new(NULL);   /* We want only the text, in str. */
+    str = g_string_new(NULL);  /* We want only the text, in str. */
     html = lbh_new(*text, len, NULL, str);
     gtk_widget_destroy(html);
 
@@ -1870,88 +1742,77 @@ libbalsa_html_to_string(gchar **text,
     *text = g_string_free(str, FALSE);
 }
 
-
 /*
  * Does the widget support zoom?
  */
 gboolean
-libbalsa_html_can_zoom(GtkWidget *widget)
+libbalsa_html_can_zoom(GtkWidget * widget)
 {
     return GTK_IS_HTML(widget);
 }
 
-
 /*
  * Zoom the widget.
  */
 void
-libbalsa_html_zoom(GtkWidget *widget,
-                   gint       in_out)
+libbalsa_html_zoom(GtkWidget * widget, gint in_out)
 {
     switch (in_out) {
     case +1:
-        gtk_html_zoom_in(GTK_HTML(widget));
-        break;
-
+       gtk_html_zoom_in(GTK_HTML(widget));
+       break;
     case -1:
-        gtk_html_zoom_out(GTK_HTML(widget));
-        break;
-
+       gtk_html_zoom_out(GTK_HTML(widget));
+       break;
     case 0:
-        gtk_html_zoom_reset(GTK_HTML(widget));
-        break;
-
+       gtk_html_zoom_reset(GTK_HTML(widget));
+       break;
     default:
-        break;
+       break;
     }
 }
 
-
 /*
  * Does the widget support selecting text?
  */
 gboolean
-libbalsa_html_can_select(GtkWidget *widget)
+libbalsa_html_can_select(GtkWidget * widget)
 {
     return GTK_IS_HTML(widget);
 }
 
-
 /*
  * Select all the text.
  */
 void
-libbalsa_html_select_all(GtkWidget *widget)
+libbalsa_html_select_all(GtkWidget * widget)
 {
     gtk_html_select_all(GTK_HTML(widget));
 }
 
-
 /*
  * Copy selected text to the clipboard.
  */
 void
-libbalsa_html_copy(GtkWidget *widget)
+libbalsa_html_copy(GtkWidget * widget)
 {
     gtk_html_copy(GTK_HTML(widget));
 }
 
-
 /*
  * Does the widget support printing?
  */
 gboolean
-libbalsa_html_can_print(GtkWidget *widget)
+libbalsa_html_can_print(GtkWidget * widget)
 {
     return GTK_IS_HTML(widget);
 }
 
-
 /*
  * Print the widget's content.
  */
 void
-libbalsa_html_print(GtkWidget *widget)
+libbalsa_html_print(GtkWidget * widget)
 {
     GtkPrintOperation *operation = gtk_print_operation_new();
     gtk_html_print_operation_run(GTK_HTML(widget), operation,
@@ -1960,37 +1821,31 @@ libbalsa_html_print(GtkWidget *widget)
     g_object_unref(operation);
 }
 
-
 static gboolean
-libbalsa_html_url_requested(GtkWidget       *html,
-                            const gchar     *url,
-                            gpointer         stream,
-                            LibBalsaMessage *msg)
+libbalsa_html_url_requested(GtkWidget * html, const gchar * url,
+                           gpointer stream, LibBalsaMessage * msg)
 {
     LibBalsaMessageBody *body;
     GMimeStream *mime_stream;
 
     if (strncmp(url, "cid:", 4)) {
-        /* printf("non-local URL request ignored: %s\n", url); */
-        return FALSE;
+       /* printf("non-local URL request ignored: %s\n", url); */
+       return FALSE;
     }
     if ((body =
-             libbalsa_message_get_part_by_id(msg, url + 4)) == NULL) {
-        gchar *s = g_strconcat("<", url + 4, ">", NULL);
+         libbalsa_message_get_part_by_id(msg, url + 4)) == NULL) {
+       gchar *s = g_strconcat("<", url + 4, ">", NULL);
 
-        if (s == NULL) {
-            return FALSE;
-        }
+       if (s == NULL)
+           return FALSE;
 
-        body = libbalsa_message_get_part_by_id(msg, s);
-        g_free(s);
-        if (body == NULL) {
-            return FALSE;
-        }
+       body = libbalsa_message_get_part_by_id(msg, s);
+       g_free(s);
+       if (body == NULL)
+           return FALSE;
     }
-    if (!(mime_stream = libbalsa_message_body_get_stream(body, NULL))) {
+    if (!(mime_stream = libbalsa_message_body_get_stream(body, NULL)))
         return FALSE;
-    }
 
     libbalsa_mailbox_lock_store(msg->mailbox);
     g_mime_stream_reset(mime_stream);
@@ -2002,20 +1857,18 @@ libbalsa_html_url_requested(GtkWidget       *html,
     return TRUE;
 }
 
-
 /*
  * Neither widget supports searching text
  */
 gboolean
-libbalsa_html_can_search(GtkWidget *widget)
+libbalsa_html_can_search(GtkWidget * widget)
 {
     return FALSE;
 }
 
-
 void
-libbalsa_html_search(GtkWidget                 *widget,
-                     const gchar               *text,
+libbalsa_html_search(GtkWidget                * widget,
+                     const gchar              * text,
                      gboolean                   find_forward,
                      gboolean                   wrap,
                      LibBalsaHtmlSearchCallback search_cb,
@@ -2023,15 +1876,13 @@ libbalsa_html_search(GtkWidget                 *widget,
 {
 }
 
-
 gboolean
-libbalsa_html_get_selection_bounds(GtkWidget    *widget,
-                                   GdkRectangle *selection_bounds)
+libbalsa_html_get_selection_bounds(GtkWidget    * widget,
+                                   GdkRectangle * selection_bounds)
 {
     return FALSE;
 }
 
-
 /*
  * Neither widget implements its own popup widget.
  */
@@ -2041,25 +1892,21 @@ libbalsa_html_popup_menu_widget(GtkWidget *widget)
     return NULL;
 }
 
-
 /*
  * Each widget is its own view widget.
  */
 GtkWidget *
-libbalsa_html_get_view_widget(GtkWidget *widget)
+libbalsa_html_get_view_widget(GtkWidget * widget)
 {
     return widget;
 }
 
-
-#   endif                       /* defined(HAVE_WEBKIT) */
+# endif                         /* defined(HAVE_WEBKIT) */
 
 /* Filter text/enriched or text/richtext to text/html, if we have GMime
  * >= 2.1.0; free and reallocate the text. */
 guint
-libbalsa_html_filter(LibBalsaHTMLType html_type,
-                     gchar          **text,
-                     guint            len)
+libbalsa_html_filter(LibBalsaHTMLType html_type, gchar ** text, guint len)
 {
     guint retval = len;
     GMimeStream *stream;
@@ -2071,16 +1918,14 @@ libbalsa_html_filter(LibBalsaHTMLType html_type,
 
     switch (html_type) {
     case LIBBALSA_HTML_TYPE_ENRICHED:
-        flags = 0;
-        break;
-
+       flags = 0;
+       break;
     case LIBBALSA_HTML_TYPE_RICHTEXT:
-        flags = GMIME_FILTER_ENRICHED_IS_RICHTEXT;
-        break;
-
+       flags = GMIME_FILTER_ENRICHED_IS_RICHTEXT;
+       break;
     case LIBBALSA_HTML_TYPE_HTML:
     default:
-        return retval;
+       return retval;
     }
 
     stream = g_mime_stream_mem_new();
@@ -2105,33 +1950,26 @@ libbalsa_html_filter(LibBalsaHTMLType html_type,
     return retval;
 }
 
-
 LibBalsaHTMLType
-libbalsa_html_type(const gchar *mime_type)
-{
-    if (!strcmp(mime_type, "text/html")) {
-        return LIBBALSA_HTML_TYPE_HTML;
-    }
-    if (!strcmp(mime_type, "text/enriched")) {
-        return LIBBALSA_HTML_TYPE_ENRICHED;
-    }
-    if (!strcmp(mime_type, "text/richtext")) {
-        return LIBBALSA_HTML_TYPE_RICHTEXT;
-    }
+libbalsa_html_type(const gchar * mime_type)
+{
+    if (!strcmp(mime_type, "text/html"))
+       return LIBBALSA_HTML_TYPE_HTML;
+    if (!strcmp(mime_type, "text/enriched"))
+       return LIBBALSA_HTML_TYPE_ENRICHED;
+    if (!strcmp(mime_type, "text/richtext"))
+       return LIBBALSA_HTML_TYPE_RICHTEXT;
     return LIBBALSA_HTML_TYPE_NONE;
 }
 
-
-#else                           /* HAVE_HTML_WIDGET */
+#else                          /* HAVE_HTML_WIDGET */
 
 LibBalsaHTMLType
-libbalsa_html_type(const gchar *mime_type)
+libbalsa_html_type(const gchar * mime_type)
 {
-    if (!strcmp(mime_type, "text/html")) {
-        return LIBBALSA_HTML_TYPE_HTML;
-    }
+    if (!strcmp(mime_type, "text/html"))
+       return LIBBALSA_HTML_TYPE_HTML;
     return LIBBALSA_HTML_TYPE_NONE;
 }
 
-
-#endif                          /* HAVE_HTML_WIDGET */
+#endif                         /* HAVE_HTML_WIDGET */
diff --git a/libbalsa/html.h b/libbalsa/html.h
index 03bbd92..2a067a1 100644
--- a/libbalsa/html.h
+++ b/libbalsa/html.h
@@ -6,26 +6,26 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef   __LIBBALSA_HTML_H__
-#define  __LIBBALSA_HTML_H__
+# define  __LIBBALSA_HTML_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
-#include <gtk/gtk.h>
+#  include <gtk/gtk.h>
 #include "libbalsa.h"
 
 /* We need this enum even if we're not using GtkHtml. */
@@ -36,48 +36,45 @@ typedef enum {
     LIBBALSA_HTML_TYPE_RICHTEXT
 } LibBalsaHTMLType;
 
-#ifdef HAVE_HTML_WIDGET
+# ifdef HAVE_HTML_WIDGET
 
-typedef void (*LibBalsaHtmlCallback) (const gchar *uri);
+typedef void (*LibBalsaHtmlCallback) (const gchar * uri);
 
-GtkWidget *libbalsa_html_new(LibBalsaMessageBody *body,
+GtkWidget *libbalsa_html_new(LibBalsaMessageBody * body,
                              LibBalsaHtmlCallback hover_cb,
                              LibBalsaHtmlCallback clicked_cb);
-void libbalsa_html_to_string(gchar **text,
-                             size_t  len);
-gboolean libbalsa_html_can_zoom(GtkWidget *widget);
-void libbalsa_html_zoom(GtkWidget *widget,
-                        gint       in_out);
-gboolean libbalsa_html_can_select(GtkWidget *widget);
-void libbalsa_html_select_all(GtkWidget *widget);
-void libbalsa_html_copy(GtkWidget *widget);
-guint libbalsa_html_filter(LibBalsaHTMLType html_type,
-                           gchar          **text,
-                           guint            len);
+void libbalsa_html_to_string(gchar ** text, size_t len);
+gboolean libbalsa_html_can_zoom(GtkWidget * widget);
+void libbalsa_html_zoom(GtkWidget * widget, gint in_out);
+gboolean libbalsa_html_can_select(GtkWidget * widget);
+void libbalsa_html_select_all(GtkWidget * widget);
+void libbalsa_html_copy(GtkWidget * widget);
+guint libbalsa_html_filter(LibBalsaHTMLType html_type, gchar ** text,
+                          guint len);
 
-typedef void (*LibBalsaHtmlSearchCallback)(const gchar *text,
-                                           gboolean     found,
-                                           gpointer     data);
-gboolean libbalsa_html_can_search(GtkWidget *widget);
-void libbalsa_html_search(GtkWidget                 *widget,
-                          const gchar               *text,
+typedef void (*LibBalsaHtmlSearchCallback)(const gchar * text,
+                                           gboolean      found,
+                                           gpointer      data);
+gboolean libbalsa_html_can_search(GtkWidget * widget);
+void libbalsa_html_search(GtkWidget                * widget,
+                          const gchar              * text,
                           gboolean                   find_forward,
                           gboolean                   wrap,
                           LibBalsaHtmlSearchCallback search_cb,
                           gpointer                   cb_data);
-gboolean libbalsa_html_get_selection_bounds(GtkWidget *widget,
+gboolean libbalsa_html_get_selection_bounds(GtkWidget * widget,
                                             GdkRectangle *
                                             selection_bounds);
 
-#   define LIBBALSA_HTML_POPUP_EVENT "libbalsa-html-popup-event"
-GtkWidget *libbalsa_html_popup_menu_widget(GtkWidget *widget);
-GtkWidget *libbalsa_html_get_view_widget(GtkWidget *widget);
+#define LIBBALSA_HTML_POPUP_EVENT "libbalsa-html-popup-event"
+GtkWidget *libbalsa_html_popup_menu_widget(GtkWidget * widget);
+GtkWidget *libbalsa_html_get_view_widget(GtkWidget * widget);
 
-gboolean libbalsa_html_can_print(GtkWidget *widget);
-void libbalsa_html_print(GtkWidget *widget);
+gboolean libbalsa_html_can_print(GtkWidget * widget);
+void libbalsa_html_print(GtkWidget * widget);
 
-#endif                          /* HAVE_HTML_WIDGET */
+# endif                                /* HAVE_HTML_WIDGET */
 
-LibBalsaHTMLType libbalsa_html_type(const gchar *mime_type);
+LibBalsaHTMLType libbalsa_html_type(const gchar * mime_type);
 
-#endif                          /* __LIBBALSA_HTML_H__ */
+#endif                         /* __LIBBALSA_HTML_H__ */
diff --git a/libbalsa/identity-widgets.c b/libbalsa/identity-widgets.c
index e7fdd7f..b1f2224 100644
--- a/libbalsa/identity-widgets.c
+++ b/libbalsa/identity-widgets.c
@@ -18,7 +18,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "identity-widgets.h"
 
@@ -44,32 +44,27 @@ static const guint padding = 6;
  */
 
 static LibBalsaIdentity *
-get_selected_identity(GtkTreeView *tree)
+get_selected_identity(GtkTreeView * tree)
 {
     GtkTreeSelection *select = gtk_tree_view_get_selection(tree);
     GtkTreeModel *model = gtk_tree_view_get_model(tree);
     GtkTreeIter iter;
     LibBalsaIdentity *identity = NULL;
 
-    if (gtk_tree_selection_get_selected(select, &model, &iter)) {
+    if (gtk_tree_selection_get_selected(select, &model, &iter))
         gtk_tree_model_get(model, &iter, IDENT_COLUMN, &identity, -1);
-    }
 
     return identity;
 }
 
-
 static gint
-compare_identities(LibBalsaIdentity *id1,
-                   LibBalsaIdentity *id2)
+compare_identities(LibBalsaIdentity *id1, LibBalsaIdentity *id2)
 {
     return g_ascii_strcasecmp(id1->identity_name, id2->identity_name);
 }
 
-
 static gboolean
-select_identity(GtkTreeView      *tree,
-                LibBalsaIdentity *identity)
+select_identity(GtkTreeView * tree, LibBalsaIdentity * identity)
 {
     GtkTreeModel *model = gtk_tree_view_get_model(tree);
     GtkTreeIter iter;
@@ -93,11 +88,10 @@ select_identity(GtkTreeView      *tree,
     return FALSE;
 }
 
-
 static void
-identity_list_update_real(GtkTreeView      *tree,
-                          GList            *identities,
-                          LibBalsaIdentity *default_id)
+identity_list_update_real(GtkTreeView * tree,
+                          GList * identities,
+                          LibBalsaIdentity * default_id)
 {
     GtkListStore *store = GTK_LIST_STORE(gtk_tree_view_get_model(tree));
     GList *sorted, *list;
@@ -111,7 +105,7 @@ identity_list_update_real(GtkTreeView      *tree,
     sorted = g_list_sort(g_list_copy(identities),
                          (GCompareFunc) compare_identities);
     for (list = sorted; list != NULL; list = list->next) {
-        LibBalsaIdentity *ident = LIBBALSA_IDENTITY(list->data);
+        LibBalsaIdentity* ident = LIBBALSA_IDENTITY(list->data);
         gtk_list_store_append(store, &iter);
         gtk_list_store_set(store, &iter,
                            DEFAULT_COLUMN, ident == default_id,
@@ -121,12 +115,10 @@ identity_list_update_real(GtkTreeView      *tree,
     }
     g_list_free(sorted);
 
-    if (!select_identity(tree, current)) {
+    if (!select_identity(tree, current))
         select_identity(tree, default_id);
-    }
 }
 
-
 /*
  * Common code for making a GtkTreeView list of identities:
  *
@@ -136,9 +128,8 @@ identity_list_update_real(GtkTreeView      *tree,
  * toggled_title        title for the boolean column.
  */
 static GtkWidget *
-libbalsa_identity_tree(GCallback toggled_cb,
-                       gpointer  toggled_data,
-                       gchar    *toggled_title)
+libbalsa_identity_tree(GCallback toggled_cb, gpointer toggled_data,
+                       gchar * toggled_title)
 {
     GtkListStore *store;
     GtkWidget *tree;
@@ -171,7 +162,6 @@ libbalsa_identity_tree(GCallback toggled_cb,
     return tree;
 }
 
-
 /*
  * The Select Identity dialog; called from compose window.
  */
@@ -188,24 +178,23 @@ struct SelectDialogInfo_ {
 typedef struct SelectDialogInfo_ SelectDialogInfo;
 
 /* Forward references: */
-static void sd_destroy_notify(SelectDialogInfo *sdi);
-static void sd_response_cb(GtkWidget        *dialog,
-                           gint              response,
-                           SelectDialogInfo *sdi);
-static void sd_idle_add_response_ok(SelectDialogInfo *sdi);
-static gboolean sd_response_ok(SelectDialogInfo *sdi);
+static void sd_destroy_notify(SelectDialogInfo * sdi);
+static void sd_response_cb(GtkWidget * dialog, gint response,
+                           SelectDialogInfo * sdi);
+static void sd_idle_add_response_ok(SelectDialogInfo * sdi);
+static gboolean sd_response_ok(SelectDialogInfo * sdi);
 
 /*
  * Public method: create and show the dialog.
  */
 #define LIBBALSA_IDENTITY_SELECT_DIALOG_KEY "libbalsa-identity-select-dialog"
 void
-libbalsa_identity_select_dialog(GtkWindow               *parent,
-                                const gchar             *prompt,
-                                GList                   *identities,
-                                LibBalsaIdentity        *initial_id,
+libbalsa_identity_select_dialog(GtkWindow * parent,
+                                const gchar * prompt,
+                                GList * identities,
+                                LibBalsaIdentity * initial_id,
                                 LibBalsaIdentityCallback update,
-                                gpointer                 data)
+                                gpointer data)
 {
     GtkWidget *dialog;
     GtkWidget *tree;
@@ -229,12 +218,12 @@ libbalsa_identity_select_dialog(GtkWindow               *parent,
     sdi->data = data;
     sdi->idle_handler_id = 0;
     sdi->dialog = dialog =
-            gtk_dialog_new_with_buttons(prompt, parent,
-                                        GTK_DIALOG_DESTROY_WITH_PARENT |
-                                        libbalsa_dialog_flags(),
-                                        _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                        _("_OK"), GTK_RESPONSE_OK,
-                                        NULL);
+        gtk_dialog_new_with_buttons(prompt, parent,
+                                    GTK_DIALOG_DESTROY_WITH_PARENT |
+                                    libbalsa_dialog_flags(),
+                                    _("_Cancel"), GTK_RESPONSE_CANCEL,
+                                    _("_OK"),     GTK_RESPONSE_OK,
+                                    NULL);
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(dialog, parent);
 #endif
@@ -244,8 +233,8 @@ libbalsa_identity_select_dialog(GtkWindow               *parent,
     gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
 
     sdi->tree = tree =
-            libbalsa_identity_tree(G_CALLBACK(sd_idle_add_response_ok), sdi,
-                                   _("Current"));
+        libbalsa_identity_tree(G_CALLBACK(sd_idle_add_response_ok), sdi,
+                               _("Current"));
     g_signal_connect_swapped(tree, "row-activated",
                              G_CALLBACK(sd_idle_add_response_ok), sdi);
     identity_list_update_real(GTK_TREE_VIEW(tree), identities, initial_id);
@@ -262,21 +251,17 @@ libbalsa_identity_select_dialog(GtkWindow               *parent,
     gtk_widget_grab_focus(tree);
 }
 
-
 /* GDestroyNotify for sdi. */
 static void
-sd_destroy_notify(SelectDialogInfo *sdi)
+sd_destroy_notify(SelectDialogInfo * sdi)
 {
     libbalsa_clear_source_id(&sdi->idle_handler_id);
     g_free(sdi);
 }
 
-
 /* Callback for the dialog's "response" signal. */
 static void
-sd_response_cb(GtkWidget        *dialog,
-               gint              response,
-               SelectDialogInfo *sdi)
+sd_response_cb(GtkWidget * dialog, gint response, SelectDialogInfo * sdi)
 {
     if (response == GTK_RESPONSE_OK) {
         GtkTreeSelection *selection =
@@ -303,21 +288,18 @@ sd_response_cb(GtkWidget        *dialog,
     gtk_widget_destroy(dialog);
 }
 
-
 /* Helper for adding idles. */
 static void
-sd_idle_add_response_ok(SelectDialogInfo *sdi)
+sd_idle_add_response_ok(SelectDialogInfo * sdi)
 {
-    if (!sdi->idle_handler_id) {
+    if (!sdi->idle_handler_id)
         sdi->idle_handler_id =
             g_idle_add((GSourceFunc) sd_response_ok, sdi);
-    }
 }
 
-
 /* Idle handler for sending the OK response to the dialog. */
 static gboolean
-sd_response_ok(SelectDialogInfo *sdi)
+sd_response_ok(SelectDialogInfo * sdi)
 {
     if (sdi->idle_handler_id) {
         sdi->idle_handler_id = 0;
@@ -326,7 +308,6 @@ sd_response_ok(SelectDialogInfo *sdi)
     return FALSE;
 }
 
-
 /*
  * End of the Select Identity dialog
  */
@@ -341,124 +322,93 @@ typedef struct {
 } IdentityDeleteInfo;
 
 /* button actions */
-static gboolean close_cb(GObject *dialog);
-static void new_ident_cb(GtkTreeView *tree,
-                         GObject     *dialog);
-static void delete_ident_cb(GtkTreeView *tree,
-                            GtkWidget   *dialog);
-static void delete_ident_response(GtkWidget          *confirm,
-                                  gint                response,
-                                  IdentityDeleteInfo *di);
-static void help_ident_cb(GtkWidget *widget);
-
-static void set_default_ident_cb(GtkTreeView       *tree,
-                                 GtkTreePath       *path,
-                                 GtkTreeViewColumn *column,
-                                 gpointer           data);
-static void config_frame_button_select_cb(GtkTreeSelection *selection,
-                                          GtkDialog        *dialog);
-
-static void ident_dialog_add_checkbutton(GtkWidget *,
-                                         gint,
-                                         GtkDialog *,
-                                         const gchar *,
-                                         const gchar *,
-                                         gboolean sensitive);
-static void ident_dialog_add_check_and_entry(GtkWidget *,
-                                             gint,
-                                             GtkDialog *,
-                                             const gchar *,
-                                             const gchar *);
-static void ident_dialog_add_entry(GtkWidget *,
-                                   gint,
-                                   GtkDialog *,
-                                   const gchar *,
-                                   const gchar *);
+static gboolean close_cb(GObject * dialog);
+static void new_ident_cb(GtkTreeView * tree, GObject * dialog);
+static void delete_ident_cb(GtkTreeView * tree, GtkWidget * dialog);
+static void delete_ident_response(GtkWidget * confirm, gint response,
+                                  IdentityDeleteInfo * di);
+static void help_ident_cb(GtkWidget * widget);
+
+static void set_default_ident_cb(GtkTreeView * tree, GtkTreePath * path,
+                                 GtkTreeViewColumn * column,
+                                 gpointer data);
+static void config_frame_button_select_cb(GtkTreeSelection * selection,
+                                          GtkDialog * dialog);
+
+static void ident_dialog_add_checkbutton(GtkWidget *, gint, GtkDialog *,
+                                         const gchar *, const gchar *,
+                                        gboolean sensitive);
+static void ident_dialog_add_check_and_entry(GtkWidget *, gint, GtkDialog *,
+                                             const gchar *, const gchar *);
+static void ident_dialog_add_entry(GtkWidget *, gint, GtkDialog *,
+                                   const gchar *, const gchar *);
 static void ident_dialog_add_keysel_entry(GtkWidget   *grid,
-                                          gint         row,
-                                          GtkDialog   *dialog,
-                                          const gchar *label_name,
-                                          const gchar *entry_key);
-
+                                                                                 gint         row,
+                                                                                 GtkDialog   *dialog,
+                                                                                 const gchar *label_name,
+                                                                                 const gchar *entry_key);
 typedef enum LibBalsaIdentityPathType_ {
     LBI_PATH_TYPE_FACE,
     LBI_PATH_TYPE_XFACE
 } LibBalsaIdentityPathType;
-static void ident_dialog_add_file_chooser_button(GtkWidget *grid,
-                                                 gint       row,
-                                                 GtkDialog *dialog,
+static void ident_dialog_add_file_chooser_button(GtkWidget * grid,
+                                                 gint row,
+                                                 GtkDialog * dialog,
                                                  LibBalsaIdentityPathType
                                                  type);
-static void ident_dialog_add_boxes(GtkWidget   *grid,
-                                   gint         row,
-                                   GtkDialog   *dialog,
-                                   const gchar *key1,
-                                   const gchar *key2);
-static const gchar *ident_dialog_get_text(GObject *,
-                                          const gchar *);
-static gboolean ident_dialog_get_bool(GObject *,
-                                      const gchar *);
-static gchar *ident_dialog_get_path(GObject     *dialog,
-                                    const gchar *key);
+static void ident_dialog_add_boxes(GtkWidget * grid, gint row,
+                                   GtkDialog * dialog, const gchar * key1,
+                                   const gchar * key2);
+static const gchar *ident_dialog_get_text(GObject *, const gchar *);
+static gboolean ident_dialog_get_bool(GObject *, const gchar *);
+static gchar *ident_dialog_get_path(GObject * dialog, const gchar * key);
 static gboolean ident_dialog_update(GObject *);
-static void config_dialog_select(GtkTreeSelection *selection,
-                                 GtkDialog        *dialog);
-
-static void display_frame_update(GObject          *dialog,
-                                 LibBalsaIdentity *ident);
-static void display_frame_set_field(GObject     *dialog,
-                                    const gchar *key,
-                                    const gchar *value);
-static void display_frame_set_boolean(GObject     *dialog,
-                                      const gchar *key,
-                                      gboolean     value);
-static void display_frame_set_path(GObject     *dialog,
-                                   const gchar *key,
-                                   const gchar *value,
-                                   gboolean     use_chooser);
-
-
-static void identity_list_update(GtkTreeView *tree);
-static void set_identity_name_in_tree(GtkTreeView      *tree,
-                                      LibBalsaIdentity *identity,
-                                      const gchar      *name);
-static void md_response_cb(GtkWidget   *dialog,
-                           gint         response,
-                           GtkTreeView *tree);
-static void md_name_changed(GtkEntry    *name,
-                            GtkTreeView *tree);
-
-static void ident_dialog_add_gpg_menu(GtkWidget   *grid,
-                                      gint         row,
-                                      GtkDialog   *dialog,
-                                      const gchar *label_name,
-                                      const gchar *menu_key);
-static void add_show_menu(const char *label,
-                          gpointer    data,
-                          GtkWidget  *menu);
-static void ident_dialog_free_values(GPtrArray *values);
-
-static void display_frame_set_gpg_mode(GObject     *dialog,
-                                       const gchar *key,
-                                       gint        *value);
-
-static void ident_dialog_add_smtp_menu(GtkWidget   *grid,
-                                       gint         row,
-                                       GtkDialog   *dialog,
-                                       const gchar *label_name,
-                                       const gchar *menu_key,
-                                       GSList      *smtp_servers);
-static void display_frame_set_server(GObject            *dialog,
-                                     const gchar        *key,
-                                     LibBalsaSmtpServer *smtp_server);
-
-static gpointer ident_dialog_get_value(GObject     *dialog,
-                                       const gchar *key);
+static void config_dialog_select(GtkTreeSelection * selection,
+                                 GtkDialog * dialog);
+
+static void display_frame_update(GObject * dialog, LibBalsaIdentity* ident);
+static void display_frame_set_field(GObject * dialog, const gchar* key,
+                                    const gchar* value);
+static void display_frame_set_boolean(GObject * dialog, const gchar* key,
+                                      gboolean value);
+static void display_frame_set_path(GObject * dialog, const gchar * key,
+                                   const gchar * value, gboolean use_chooser);
+
+
+static void identity_list_update(GtkTreeView * tree);
+static void set_identity_name_in_tree(GtkTreeView * tree,
+                                     LibBalsaIdentity * identity,
+                                     const gchar * name);
+static void md_response_cb(GtkWidget * dialog, gint response,
+                           GtkTreeView * tree);
+static void md_name_changed(GtkEntry * name, GtkTreeView * tree);
+
+static void ident_dialog_add_gpg_menu(GtkWidget * grid, gint row,
+                                      GtkDialog * dialog,
+                                      const gchar * label_name,
+                                      const gchar * menu_key);
+static void add_show_menu(const char *label, gpointer data,
+                          GtkWidget * menu);
+static void ident_dialog_free_values(GPtrArray * values);
+
+static void display_frame_set_gpg_mode(GObject * dialog,
+                                       const gchar * key, gint * value);
+
+static void ident_dialog_add_smtp_menu(GtkWidget * grid, gint row,
+                                       GtkDialog * dialog,
+                                       const gchar * label_name,
+                                       const gchar * menu_key,
+                                      GSList * smtp_servers);
+static void display_frame_set_server(GObject * dialog,
+                                     const gchar * key,
+                                     LibBalsaSmtpServer * smtp_server);
+
+static gpointer ident_dialog_get_value(GObject * dialog,
+                                       const gchar * key);
 
 /* Callback for the "toggled" signal of the "Default" column. */
 static void
-toggle_cb(GObject *dialog,
-          gchar   *path)
+toggle_cb(GObject * dialog, gchar * path)
 {
     GtkTreeView *tree = g_object_get_data(dialog, "tree");
     GtkTreeModel *model = gtk_tree_view_get_model(tree);
@@ -466,9 +416,8 @@ toggle_cb(GObject *dialog,
 
     /* Save any changes to current identity; if it's not valid, just
      * return. */
-    if (!ident_dialog_update(dialog)) {
-        return;
-    }
+    if (!ident_dialog_update(dialog))
+       return;
 
     if (gtk_tree_model_get_iter_from_string(model, &iter, path)) {
         LibBalsaIdentity *identity, **default_id;
@@ -480,20 +429,17 @@ toggle_cb(GObject *dialog,
     }
 }
 
-
 /*
  * Create and return a frame containing a list of the identities in
  * the application and a number of buttons to edit, create, and delete
  * identities.  Also provides a way to set the default identity.
  */
-static GtkWidget *
-libbalsa_identity_config_frame(GList            **identities,
-                               LibBalsaIdentity **defid,
-                               GtkWidget         *dialog,
-                               void (            *cb)(gpointer),
-                               gpointer           data)
+static GtkWidget*
+libbalsa_identity_config_frame(GList** identities,
+                              LibBalsaIdentity** defid, GtkWidget * dialog,
+                               void (*cb)(gpointer), gpointer data)
 {
-    GtkWidget *config_frame = gtk_frame_new(NULL);
+    GtkWidget* config_frame = gtk_frame_new(NULL);
     GtkWidget *tree;
 
     tree = libbalsa_identity_tree(G_CALLBACK(toggle_cb), dialog,
@@ -503,7 +449,7 @@ libbalsa_identity_config_frame(GList            **identities,
     g_object_set_data(G_OBJECT(tree), "identities", identities);
     g_object_set_data(G_OBJECT(tree), "default-id", defid);
     g_object_set_data(G_OBJECT(tree), "callback", cb);
-    g_object_set_data(G_OBJECT(tree), "cb-data", data);
+    g_object_set_data(G_OBJECT(tree), "cb-data",  data);
 
     g_object_set(G_OBJECT(tree), "margin", 0, NULL); /* Seriously? */
     gtk_container_add(GTK_CONTAINER(config_frame), tree);
@@ -513,13 +459,12 @@ libbalsa_identity_config_frame(GList            **identities,
     return config_frame;
 }
 
-
 /* identity_list_update:
  * Update the list of identities in the config frame, displaying the
  * available identities in the application, and which is default.
  */
 static void
-identity_list_update(GtkTreeView *tree)
+identity_list_update(GtkTreeView * tree)
 {
     GList **identities =
         g_object_get_data(G_OBJECT(tree), "identities");
@@ -529,7 +474,6 @@ identity_list_update(GtkTreeView *tree)
     identity_list_update_real(tree, *identities, *default_id);
 }
 
-
 enum {
     IDENTITY_RESPONSE_HELP = GTK_RESPONSE_HELP,
     IDENTITY_RESPONSE_CLOSE = GTK_RESPONSE_CANCEL,
@@ -539,43 +483,39 @@ enum {
 
 /* callback for the "changed" signal */
 static void
-config_frame_button_select_cb(GtkTreeSelection *selection,
-                              GtkDialog        *dialog)
+config_frame_button_select_cb(GtkTreeSelection * selection,
+                              GtkDialog * dialog)
 {
     config_dialog_select(selection, dialog);
 }
 
-
 /*
  * Callback for the close button.
  * Call ident_dialog_update to save any changes, and close the dialog if
  * OK.
  */
 static gboolean
-close_cb(GObject *dialog)
+close_cb(GObject * dialog)
 {
     return ident_dialog_update(dialog);
 }
 
-
 /*
  * Create a new identity
  */
 static void
-new_ident_cb(GtkTreeView *tree,
-             GObject     *dialog)
+new_ident_cb(GtkTreeView * tree, GObject * dialog)
 {
     LibBalsaIdentity *ident;
     GList **identities;
     GtkWidget *name_entry;
     void (*cb)(gpointer) = g_object_get_data(G_OBJECT(tree), "callback");
-    gpointer data = g_object_get_data(G_OBJECT(tree), "cb-data");
+    gpointer data        = g_object_get_data(G_OBJECT(tree), "cb-data");
 
     /* Save any changes to current identity; if it's not valid, just
      * return. */
-    if (!ident_dialog_update(dialog)) {
-        return;
-    }
+    if (!ident_dialog_update(dialog))
+       return;
 
     ident = LIBBALSA_IDENTITY(libbalsa_identity_new());
     identities = g_object_get_data(G_OBJECT(tree), "identities");
@@ -593,10 +533,10 @@ new_ident_cb(GtkTreeView *tree,
 /*
  * Helper: append a notebook page containing a table
  */
-static GtkWidget *
-append_ident_notebook_page(GtkNotebook *notebook,
-                           const gchar *tab_label,
-                           const gchar *footnote)
+static GtkWidget*
+append_ident_notebook_page(GtkNotebook * notebook,
+                          const gchar * tab_label,
+                           const gchar * footnote)
 {
     GtkWidget *vbox;
     GtkWidget *grid;
@@ -606,10 +546,10 @@ append_ident_notebook_page(GtkNotebook *notebook,
     g_object_set(G_OBJECT(grid), "margin", padding, NULL);
     gtk_box_pack_start(GTK_BOX(vbox), grid);
     if (footnote) {
-        GtkWidget *label;
+       GtkWidget *label;
 
-        label = gtk_label_new(footnote);
-        gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+       label = gtk_label_new(footnote);
+       gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
         gtk_box_pack_start(GTK_BOX(vbox), label);
     }
     gtk_notebook_append_page(notebook, vbox, gtk_label_new(tab_label));
@@ -629,13 +569,13 @@ static const struct {
     const gchar *basename;
     const gchar *info;
 } path_info[] = {
-    /* Translators: please do not translate Face. */
+        /* Translators: please do not translate Face. */
     {N_("_Face Path"),
      "identity-facepath",
      "identity-facebox",
      ".face",
      "Face"},
-    /* Translators: please do not translate Face. */
+        /* Translators: please do not translate Face. */
     {N_("_X-Face Path"),
      "identity-xfacepath",
      "identity-xfacebox",
@@ -644,14 +584,12 @@ static const struct {
 };
 
 #define LIBBALSA_IDENTITY_CHECK "libbalsa-identity-check"
-static void md_sig_path_changed_cb(GtkToggleButton *sig_button,
-                                   GObject         *dialog);
+static void md_sig_path_changed_cb(GtkToggleButton * sig_button,
+                                   GObject * dialog);
 
-static GtkWidget *
-setup_ident_frame(GtkDialog *dialog,
-                  gboolean   createp,
-                  gpointer   tree,
-                  GSList    *smtp_servers)
+static GtkWidget*
+setup_ident_frame(GtkDialog * dialog, gboolean createp, gpointer tree,
+                  GSList * smtp_servers)
 {
     GtkNotebook *notebook = GTK_NOTEBOOK(gtk_notebook_new());
     GtkWidget *grid;
@@ -664,7 +602,7 @@ setup_ident_frame(GtkDialog *dialog,
     grid = append_ident_notebook_page(notebook, _("General"), NULL);
     row = 0;
     ident_dialog_add_entry(grid, row++, dialog, _("_Identity name:"),
-                           "identity-name");
+                          "identity-name");
     ident_dialog_add_entry(grid, row++, dialog, _("_Full name:"),
                            "identity-fullname");
     ident_dialog_add_entry(grid, row++, dialog, _("_Mailing address:"),
@@ -710,8 +648,8 @@ setup_ident_frame(GtkDialog *dialog,
                                      _("Signature _path"),
                                      "identity-sigpath");
     ident_dialog_add_checkbutton(grid, row++, dialog,
-                                 _("_Execute signature"),
-                                 "identity-sigexecutable", FALSE);
+                                _("_Execute signature"),
+                                "identity-sigexecutable", FALSE);
     ident_dialog_add_checkbutton(grid, row++, dialog,
                                  _("Incl_ude signature"),
                                  "identity-sigappend", FALSE);
@@ -745,8 +683,8 @@ setup_ident_frame(GtkDialog *dialog,
                                  _("encrypt messages by default"),
                                  "identity-gpgencrypt", TRUE);
     ident_dialog_add_gpg_menu(grid, row++, dialog,
-                              _("default protocol"),
-                              "identity-crypt-protocol");
+                                _("default protocol"),
+                                "identity-crypt-protocol");
     ident_dialog_add_checkbutton(grid, row++, dialog,
                                  _("always trust GnuPG keys to encrypt messages"),
                                  "identity-trust-always", TRUE);
@@ -754,13 +692,13 @@ setup_ident_frame(GtkDialog *dialog,
                                  _("remind me if messages can be encrypted"),
                                  "identity-warn-send-plain", TRUE);
     ident_dialog_add_keysel_entry(grid, row++, dialog,
-                                  _("use secret key with this id for signing GnuPG messages\n"
-                                    "(leave empty for automatic selection)"),
-                                  "identity-keyid");
+                                         _("use secret key with this id for signing GnuPG messages\n"
+                                               "(leave empty for automatic selection)"),
+                                                                 "identity-keyid");
     ident_dialog_add_keysel_entry(grid, row++, dialog,
-                                  _("use certificate with this id for signing S/MIME messages\n"
-                                    "(leave empty for automatic selection)"),
-                                  "identity-keyid-sm");
+                                         _("use certificate with this id for signing S/MIME messages\n"
+                                               "(leave empty for automatic selection)"),
+                                                                 "identity-keyid-sm");
 #ifndef HAVE_GPGME
     gtk_widget_set_sensitive(grid, FALSE);
 #endif
@@ -780,30 +718,24 @@ setup_ident_frame(GtkDialog *dialog,
     return GTK_WIDGET(notebook);
 }
 
-
 /* Callback for the "changed" signal of the name entry; updates the name
  * in the tree. */
 static void
-md_name_changed(GtkEntry    *name,
-                GtkTreeView *tree)
+md_name_changed(GtkEntry * name, GtkTreeView * tree)
 {
     set_identity_name_in_tree(tree, get_selected_identity(tree),
-                              gtk_entry_get_text(name));
+                             gtk_entry_get_text(name));
 }
 
-
 /*
  * Create and add a GtkCheckButton to the given dialog with caption
  * and add a pointer to it stored under the given key.  The check
  * button is initialized to the given value.
  */
 static void
-ident_dialog_add_checkbutton(GtkWidget   *grid,
-                             gint         row,
-                             GtkDialog   *dialog,
-                             const gchar *check_label,
-                             const gchar *check_key,
-                             gboolean     sensitive)
+ident_dialog_add_checkbutton(GtkWidget * grid, gint row,
+                             GtkDialog * dialog, const gchar * check_label,
+                             const gchar * check_key, gboolean sensitive)
 {
     GtkWidget *check;
 
@@ -812,7 +744,6 @@ ident_dialog_add_checkbutton(GtkWidget   *grid,
     gtk_widget_set_sensitive(check, sensitive);
 }
 
-
 /*
  * Create and add a GtkCheckButton to the given dialog with caption
  * and add a pointer to it stored under the given key, which is
@@ -820,11 +751,9 @@ ident_dialog_add_checkbutton(GtkWidget   *grid,
  * given value.
  */
 static void
-ident_dialog_add_check_and_entry(GtkWidget   *grid,
-                                 gint         row,
-                                 GtkDialog   *dialog,
-                                 const gchar *check_label,
-                                 const gchar *entry_key)
+ident_dialog_add_check_and_entry(GtkWidget * grid, gint row,
+                                 GtkDialog * dialog, const gchar * check_label,
+                                 const gchar * entry_key)
 {
     GtkWidget *check, *entry;
 
@@ -848,11 +777,8 @@ ident_dialog_add_check_and_entry(GtkWidget   *grid,
  * is initialized to the init_value given.
  */
 static void
-ident_dialog_add_entry(GtkWidget   *grid,
-                       gint         row,
-                       GtkDialog   *dialog,
-                       const gchar *label_name,
-                       const gchar *entry_key)
+ident_dialog_add_entry(GtkWidget * grid, gint row, GtkDialog * dialog,
+                       const gchar * label_name, const gchar * entry_key)
 {
     GtkWidget *label;
     GtkWidget *entry;
@@ -862,44 +788,40 @@ ident_dialog_add_entry(GtkWidget   *grid,
     entry = libbalsa_create_grid_entry(grid, NULL, NULL, row, NULL, label);
 
     g_object_set_data(G_OBJECT(dialog), entry_key, entry);
-    if (row == 0) {
+    if (row == 0)
         gtk_widget_grab_focus(entry);
-    }
 }
 
 
 #ifdef HAVE_GPGME
 static void
-choose_key(GtkButton *button,
-           gpointer   user_data)
+choose_key(GtkButton *button, gpointer user_data)
 {
-    const gchar *target;
-    gpgme_protocol_t protocol;
-    const gchar *email;
-    gchar *keyid;
-    GError *error = NULL;
-
-    target = g_object_get_data(G_OBJECT(button), "target");
-    if (strcmp(target, "identity-keyid") == 0) {
-        protocol = GPGME_PROTOCOL_OpenPGP;
-    } else {
-        protocol = GPGME_PROTOCOL_CMS;
-    }
-
-    email = ident_dialog_get_text(G_OBJECT(user_data), "identity-address");
-    keyid = libbalsa_gpgme_get_seckey(protocol, email, GTK_WINDOW(user_data), &error);
-    if (keyid != NULL) {
-        display_frame_set_field(G_OBJECT(user_data), target, keyid);
-        g_free(keyid);
-    }
-    if (error != NULL) {
+       const gchar *target;
+       gpgme_protocol_t protocol;
+       const gchar *email;
+       gchar *keyid;
+       GError *error = NULL;
+
+       target = g_object_get_data(G_OBJECT(button), "target");
+       if (strcmp(target, "identity-keyid") == 0) {
+               protocol = GPGME_PROTOCOL_OpenPGP;
+       } else {
+               protocol = GPGME_PROTOCOL_CMS;
+       }
+
+       email = ident_dialog_get_text(G_OBJECT(user_data), "identity-address");
+       keyid = libbalsa_gpgme_get_seckey(protocol, email, GTK_WINDOW(user_data), &error);
+       if (keyid != NULL) {
+               display_frame_set_field(G_OBJECT(user_data), target, keyid);
+               g_free(keyid);
+       }
+       if (error != NULL) {
         libbalsa_information(LIBBALSA_INFORMATION_WARNING,
                              _("Error selecting key: %s"), error->message);
         g_clear_error(&error);
-    }
+       }
 }
-
-
 #endif
 
 
@@ -911,21 +833,20 @@ choose_key(GtkButton *button,
  */
 static void
 ident_dialog_add_keysel_entry(GtkWidget   *grid,
-                              gint         row,
-                              GtkDialog   *dialog,
-                              const gchar *label_name,
-                              const gchar *entry_key)
+                                                         gint         row,
+                                                         GtkDialog   *dialog,
+                                         const gchar *label_name,
+                                                         const gchar *entry_key)
 {
-    GtkWidget *button;
+       GtkWidget *button;
 
-    ident_dialog_add_entry(grid, row, dialog, label_name, entry_key);
-    button = gtk_button_new_with_label(_("Choose…"));
+       ident_dialog_add_entry(grid, row, dialog, label_name, entry_key);
+       button = gtk_button_new_with_label(_("Choose…"));
 #ifdef HAVE_GPGME
-    g_object_set_data_full(G_OBJECT(button), "target", g_strdup(
-                               entry_key), (GDestroyNotify) g_free);
-    g_signal_connect(button, "clicked", G_CALLBACK(choose_key), dialog);
+       g_object_set_data_full(G_OBJECT(button), "target", g_strdup(entry_key), (GDestroyNotify) g_free);
+       g_signal_connect(button, "clicked", G_CALLBACK(choose_key), dialog);
 #endif
-    gtk_grid_attach(GTK_GRID(grid), button, 2, row, 1, 1);
+       gtk_grid_attach(GTK_GRID(grid), button, 2, row, 1, 1);
 }
 
 
@@ -938,8 +859,7 @@ ident_dialog_add_keysel_entry(GtkWidget   *grid,
 
 /* Callbacks and helpers. */
 static void
-file_chooser_check_cb(GtkToggleButton *button,
-                      GtkWidget       *chooser)
+file_chooser_check_cb(GtkToggleButton * button, GtkWidget * chooser)
 {
     gtk_widget_set_sensitive(chooser,
                              gtk_toggle_button_get_active(button));
@@ -947,12 +867,9 @@ file_chooser_check_cb(GtkToggleButton *button,
     g_signal_emit_by_name(chooser, "selection-changed");
 }
 
-
 static void
-md_face_path_changed(const gchar             *filename,
-                     gboolean                 active,
-                     LibBalsaIdentityPathType type,
-                     gpointer                 data)
+md_face_path_changed(const gchar * filename, gboolean active,
+                     LibBalsaIdentityPathType type, gpointer data)
 {
     gchar *content;
     gsize size;
@@ -980,7 +897,7 @@ md_face_path_changed(const gchar             *filename,
 
     if (size > 998) {
         libbalsa_information(LIBBALSA_INFORMATION_WARNING,
-                             /* Translators: please do not translate Face. */
+                /* Translators: please do not translate Face. */
                              _("Face header file %s is too long "
                                "(%lu bytes)."), filename, (unsigned long)size);
         g_free(content);
@@ -990,20 +907,18 @@ md_face_path_changed(const gchar             *filename,
 
     if (libbalsa_text_attr_string(content)) {
         libbalsa_information(LIBBALSA_INFORMATION_WARNING,
-                             /* Translators: please do not translate Face. */
+                /* Translators: please do not translate Face. */
                              _("Face header file %s contains "
                                "binary data."), filename);
         g_free(content);
         return;
     }
 
-    if (type == LBI_PATH_TYPE_FACE) {
+    if (type == LBI_PATH_TYPE_FACE)
         image = libbalsa_get_image_from_face_header(content, &err);
-    }
 #if HAVE_COMPFACE
-    else if (type == LBI_PATH_TYPE_XFACE) {
+    else if (type == LBI_PATH_TYPE_XFACE)
         image = libbalsa_get_image_from_x_face_header(content, &err);
-    }
 #endif                          /* HAVE_COMPFACE */
     else {
         gtk_widget_hide(face_box);
@@ -1012,7 +927,7 @@ md_face_path_changed(const gchar             *filename,
     }
     if (err) {
         libbalsa_information(LIBBALSA_INFORMATION_WARNING,
-                             /* Translators: please do not translate Face. */
+                /* Translators: please do not translate Face. */
                              _("Error loading Face: %s"), err->message);
         g_error_free(err);
         g_free(content);
@@ -1026,13 +941,11 @@ md_face_path_changed(const gchar             *filename,
     g_free(content);
 }
 
-
 /* Callback for the "selection-changed" signal of the signature path
  * file chooser; sets sensitivity of the signature-related buttons. */
 
 static void
-md_sig_path_changed(gboolean active,
-                    GObject *dialog)
+md_sig_path_changed(gboolean active, GObject * dialog)
 {
     guint i;
     static gchar *button_key[] = {
@@ -1051,19 +964,15 @@ md_sig_path_changed(gboolean active,
     }
 }
 
-
 static void
-md_sig_path_changed_cb(GtkToggleButton *sig_button,
-                       GObject         *dialog)
+md_sig_path_changed_cb(GtkToggleButton *sig_button, GObject *dialog)
 {
     md_sig_path_changed(gtk_toggle_button_get_active(sig_button), dialog);
 }
 
-
 #define LIBBALSA_IDENTITY_INFO "libbalsa-identity-info"
 static void
-file_chooser_cb(GtkWidget *chooser,
-                gpointer   data)
+file_chooser_cb(GtkWidget * chooser, gpointer data)
 {
     gchar *filename;
     LibBalsaIdentityPathType type;
@@ -1077,24 +986,22 @@ file_chooser_cb(GtkWidget *chooser,
     }
 
     type = GPOINTER_TO_UINT(g_object_get_data
-                                (G_OBJECT(chooser), LIBBALSA_IDENTITY_INFO));
+                            (G_OBJECT(chooser), LIBBALSA_IDENTITY_INFO));
     check = g_object_get_data(G_OBJECT(chooser), LIBBALSA_IDENTITY_CHECK);
     active = gtk_toggle_button_get_active(check);
 
 #if 0
-    if (type == LBI_PATH_TYPE_SIG) {
+    if (type == LBI_PATH_TYPE_SIG)
         md_sig_path_changed(filename, active, data);
-    } else
+    else
 #endif
-    md_face_path_changed(filename, active, type, data);
+        md_face_path_changed(filename, active, type, data);
     g_free(filename);
 }
 
-
 static void
-ident_dialog_add_file_chooser_button(GtkWidget               *grid,
-                                     gint                     row,
-                                     GtkDialog               *dialog,
+ident_dialog_add_file_chooser_button(GtkWidget * grid, gint row,
+                                     GtkDialog * dialog,
                                      LibBalsaIdentityPathType type)
 {
     GtkWidget *check;
@@ -1130,13 +1037,9 @@ ident_dialog_add_file_chooser_button(GtkWidget               *grid,
                      G_CALLBACK(file_chooser_cb), dialog);
 }
 
-
 static void
-ident_dialog_add_boxes(GtkWidget   *grid,
-                       gint         row,
-                       GtkDialog   *dialog,
-                       const gchar *key1,
-                       const gchar *key2)
+ident_dialog_add_boxes(GtkWidget * grid, gint row, GtkDialog * dialog,
+                       const gchar * key1, const gchar *key2)
 {
     GtkWidget *hbox, *vbox;
 
@@ -1150,21 +1053,19 @@ ident_dialog_add_boxes(GtkWidget   *grid,
     gtk_box_pack_start(GTK_BOX(hbox), vbox);
 }
 
-
 /* set_identity_name_in_tree:
  * update the tree to reflect the (possibly) new name of the identity
  */
 static void
-set_identity_name_in_tree(GtkTreeView      *tree,
-                          LibBalsaIdentity *identity,
-                          const gchar      *name)
+set_identity_name_in_tree(GtkTreeView * tree, LibBalsaIdentity * identity,
+                  const gchar * name)
 {
     GtkTreeModel *model = gtk_tree_view_get_model(tree);
     GtkTreeIter iter;
     gboolean valid;
 
     for (valid =
-             gtk_tree_model_get_iter_first(model, &iter);
+         gtk_tree_model_get_iter_first(model, &iter);
          valid;
          valid = gtk_tree_model_iter_next(model, &iter)) {
         LibBalsaIdentity *tmp;
@@ -1178,7 +1079,6 @@ set_identity_name_in_tree(GtkTreeView      *tree,
     }
 }
 
-
 /*
  * Update the identity object associated with the edit/new dialog,
  * validating along the way.  Correct validation results in a true
@@ -1186,10 +1086,10 @@ set_identity_name_in_tree(GtkTreeView      *tree,
  */
 
 static gboolean
-ident_dialog_update(GObject *dlg)
+ident_dialog_update(GObject * dlg)
 {
-    LibBalsaIdentity *id;
-    LibBalsaIdentity *exist_ident;
+    LibBalsaIdentity* id;
+    LibBalsaIdentity* exist_ident;
     InternetAddress *ia;
     GtkWidget *tree;
     GList **identities, *list;
@@ -1198,9 +1098,8 @@ ident_dialog_update(GObject *dlg)
     gchar *path;
 
     id = g_object_get_data(dlg, "identity");
-    if (!id) {
+    if (!id)
         return TRUE;
-    }
     tree = g_object_get_data(dlg, "tree");
     identities = g_object_get_data(G_OBJECT(tree), "identities");
 
@@ -1216,8 +1115,8 @@ ident_dialog_update(GObject *dlg)
     for (list = *identities; list != NULL; list = list->next) {
         exist_ident = list->data;
 
-        if ((g_ascii_strcasecmp(exist_ident->identity_name, text) == 0)
-            && (id != exist_ident)) {
+        if (g_ascii_strcasecmp(exist_ident->identity_name, text) == 0
+            && id != exist_ident) {
             libbalsa_information(LIBBALSA_INFORMATION_ERROR,
                                  _("Error: An identity with that"
                                    " name already exists"));
@@ -1236,36 +1135,34 @@ ident_dialog_update(GObject *dlg)
     g_object_unref(ia);
 
     libbalsa_identity_set_replyto(id,
-                                  ident_dialog_get_text(dlg, "identity-replyto"));
+            ident_dialog_get_text(dlg, "identity-replyto"));
     libbalsa_identity_set_domain(id,
-                                 ident_dialog_get_text(dlg, "identity-domain"));
+            ident_dialog_get_text(dlg, "identity-domain"));
     libbalsa_identity_set_bcc(id,
-                              ident_dialog_get_text(dlg, "identity-bcc"));
+            ident_dialog_get_text(dlg, "identity-bcc"));
     libbalsa_identity_set_reply_string(id,
-                                       ident_dialog_get_text(dlg, "identity-replystring"));
+            ident_dialog_get_text(dlg, "identity-replystring"));
     libbalsa_identity_set_forward_string(id,
-                                         ident_dialog_get_text(dlg, "identity-forwardstring"));
+            ident_dialog_get_text(dlg, "identity-forwardstring"));
     libbalsa_identity_set_send_mp_alternative(id,
-                                              ident_dialog_get_bool(dlg,
-                                                                    "identity-sendmpalternative"));
+            ident_dialog_get_bool(dlg, "identity-sendmpalternative"));
     libbalsa_identity_set_smtp_server(id,
-                                      ident_dialog_get_value(dlg, "identity-smtp-server"));
+            ident_dialog_get_value(dlg, "identity-smtp-server"));
 
     libbalsa_identity_set_signature_path(id,
-                                         ident_dialog_get_text(dlg, "identity-sigpath"));
+            ident_dialog_get_text(dlg, "identity-sigpath"));
     libbalsa_identity_set_sig_executable(id,
-                                         ident_dialog_get_bool(dlg, "identity-sigexecutable"));
+            ident_dialog_get_bool(dlg, "identity-sigexecutable"));
     libbalsa_identity_set_sig_sending(id,
-                                      ident_dialog_get_bool(dlg, "identity-sigappend"));
+            ident_dialog_get_bool(dlg, "identity-sigappend"));
     libbalsa_identity_set_sig_whenforward(id,
-                                          ident_dialog_get_bool(dlg,
-                                                                "identity-sigwhenforward"));
+            ident_dialog_get_bool(dlg, "identity-sigwhenforward"));
     libbalsa_identity_set_sig_whenreply(id,
-                                        ident_dialog_get_bool(dlg, "identity-sigwhenreply"));
+            ident_dialog_get_bool(dlg, "identity-sigwhenreply"));
     libbalsa_identity_set_sig_separator(id,
-                                        ident_dialog_get_bool(dlg, "identity-sigseparator"));
+            ident_dialog_get_bool(dlg, "identity-sigseparator"));
     libbalsa_identity_set_sig_prepend(id,
-                                      ident_dialog_get_bool(dlg, "identity-sigprepend"));
+            ident_dialog_get_bool(dlg, "identity-sigprepend"));
 
     path = ident_dialog_get_path(dlg, "identity-facepath");
     libbalsa_identity_set_face_path(id, path);
@@ -1276,22 +1173,20 @@ ident_dialog_update(GObject *dlg)
     g_free(path);
 
     libbalsa_identity_set_request_mdn(id,
-                                      ident_dialog_get_bool(dlg, "identity-requestmdn"));
+            ident_dialog_get_bool(dlg, "identity-requestmdn"));
     libbalsa_identity_set_request_dsn(id,
-                                      ident_dialog_get_bool(dlg, "identity-requestdsn"));
+            ident_dialog_get_bool(dlg, "identity-requestdsn"));
 
     libbalsa_identity_set_gpg_sign(id,
-                                   ident_dialog_get_bool(dlg, "identity-gpgsign"));
+            ident_dialog_get_bool(dlg, "identity-gpgsign"));
     libbalsa_identity_set_gpg_encrypt(id,
-                                      ident_dialog_get_bool(dlg, "identity-gpgencrypt"));
+            ident_dialog_get_bool(dlg, "identity-gpgencrypt"));
     libbalsa_identity_set_always_trust(id,
-                                       ident_dialog_get_bool(dlg, "identity-trust-always"));
+            ident_dialog_get_bool(dlg, "identity-trust-always"));
     libbalsa_identity_set_warn_send_plain(id,
-                                          ident_dialog_get_bool(dlg,
-                                                                "identity-warn-send-plain"));
+            ident_dialog_get_bool(dlg, "identity-warn-send-plain"));
     libbalsa_identity_set_crypt_protocol(id,
-                                         GPOINTER_TO_INT(ident_dialog_get_value (dlg,
-                                                                                 
"identity-crypt-protocol")));
+            GPOINTER_TO_INT(ident_dialog_get_value (dlg, "identity-crypt-protocol")));
 
     dup = g_strdup(ident_dialog_get_text(dlg, "identity-keyid"));
     libbalsa_identity_set_force_gpg_key_id(id, g_strstrip(dup));
@@ -1310,17 +1205,15 @@ ident_dialog_update(GObject *dlg)
  * given key accesses the entry using object data.
  */
 static const gchar *
-ident_dialog_get_text(GObject     *dialog,
-                      const gchar *key)
+ident_dialog_get_text(GObject * dialog, const gchar * key)
 {
     GtkEntry *entry;
     GtkToggleButton *check;
 
     entry = g_object_get_data(dialog, key);
     check = g_object_get_data(G_OBJECT(entry), LIBBALSA_IDENTITY_CHECK);
-    if (check && !gtk_toggle_button_get_active(check)) {
+    if (check && !gtk_toggle_button_get_active(check))
         return NULL;
-    }
     return gtk_entry_get_text(entry);
 }
 
@@ -1331,8 +1224,7 @@ ident_dialog_get_text(GObject     *dialog,
  * data
  */
 static gboolean
-ident_dialog_get_bool(GObject     *dialog,
-                      const gchar *key)
+ident_dialog_get_bool(GObject* dialog, const gchar* key)
 {
     GtkToggleButton *button;
 
@@ -1346,15 +1238,13 @@ ident_dialog_get_bool(GObject     *dialog,
  * given key accesses the file chooser using object data.
  */
 static gchar *
-ident_dialog_get_path(GObject     *dialog,
-                      const gchar *key)
+ident_dialog_get_path(GObject * dialog, const gchar * key)
 {
     GtkWidget *chooser;
 
     chooser = g_object_get_data(dialog, key);
-    if (!gtk_widget_get_sensitive(chooser)) {
+    if (!gtk_widget_get_sensitive(chooser))
         return NULL;
-    }
 
     return gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser));
 }
@@ -1364,10 +1254,8 @@ ident_dialog_get_path(GObject     *dialog,
  * Set the default identity to the currently selected.
  */
 static void
-set_default_ident_cb(GtkTreeView       *tree,
-                     GtkTreePath       *path,
-                     GtkTreeViewColumn *column,
-                     gpointer           data)
+set_default_ident_cb(GtkTreeView * tree, GtkTreePath * path,
+                     GtkTreeViewColumn * column, gpointer data)
 {
     LibBalsaIdentity *ident, **default_id;
 
@@ -1385,8 +1273,7 @@ set_default_ident_cb(GtkTreeView       *tree,
  * and close the dialog.
  */
 static void
-identity_delete_selected(GtkTreeView *tree,
-                         GtkWidget   *dialog)
+identity_delete_selected(GtkTreeView * tree, GtkWidget * dialog)
 {
     GtkTreeSelection *selection = gtk_tree_view_get_selection(tree);
     GtkTreeModel *model;
@@ -1395,12 +1282,11 @@ identity_delete_selected(GtkTreeView *tree,
     LibBalsaIdentity *ident;
     GList **identities;
     void (*cb)(gpointer) = g_object_get_data(G_OBJECT(tree), "callback");
-    gpointer data = g_object_get_data(G_OBJECT(tree), "cb-data");
+    gpointer data        = g_object_get_data(G_OBJECT(tree), "cb-data");
 
     /* Save the path to the current row. */
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
         return;
-    }
     path = gtk_tree_model_get_path(model, &iter);
 
     ident = get_selected_identity(tree);
@@ -1422,16 +1308,14 @@ identity_delete_selected(GtkTreeView *tree,
     cb(data);
 }
 
-
 /*
  * Delete the currently selected identity after confirming.
  */
 static void
-delete_ident_cb(GtkTreeView *tree,
-                GtkWidget   *dialog)
+delete_ident_cb(GtkTreeView * tree, GtkWidget * dialog)
 {
-    LibBalsaIdentity *ident, **default_id;
-    GtkWidget *confirm;
+    LibBalsaIdentity* ident, **default_id;
+    GtkWidget* confirm;
     IdentityDeleteInfo *di;
 
     ident = get_selected_identity(tree);
@@ -1456,25 +1340,21 @@ delete_ident_cb(GtkTreeView *tree,
     gtk_widget_show(confirm);
 }
 
-
 static void
-delete_ident_response(GtkWidget          *confirm,
-                      gint                response,
-                      IdentityDeleteInfo *di)
+delete_ident_response(GtkWidget * confirm, gint response,
+                      IdentityDeleteInfo * di)
 {
-    if (response == GTK_RESPONSE_OK) {
+    if(response == GTK_RESPONSE_OK)
         identity_delete_selected(di->tree, di->dialog);
-    }
     gtk_widget_set_sensitive(di->dialog, TRUE);
     gtk_widget_destroy(confirm);
 }
 
-
 /*
  * Show the help file.
  */
 static void
-help_ident_cb(GtkWidget *widget)
+help_ident_cb(GtkWidget * widget)
 {
     GError *err = NULL;
 
@@ -1488,32 +1368,28 @@ help_ident_cb(GtkWidget *widget)
     }
 }
 
-
 /* libbalsa_identity_config_dialog displays an identity management
    dialog. The dialog has a specified parent, existing list of
    identites, the default one. Additionally, a callback is passed that
    will be executed when the identity list is modified: new entries
    are added or other entries are removed. */
 static void
-lbi_free_smtp_server_list(GSList **smtp_server_list)
+lbi_free_smtp_server_list(GSList ** smtp_server_list)
 {
     g_slist_free_full(*smtp_server_list, g_object_unref);
     g_free(smtp_server_list);
 }
 
-
 void
-libbalsa_identity_config_dialog(GtkWindow         *parent,
-                                GList            **identities,
-                                LibBalsaIdentity **default_id,
-                                GSList            *smtp_servers,
-                                void (            *changed_cb)(gpointer))
+libbalsa_identity_config_dialog(GtkWindow *parent, GList **identities,
+                               LibBalsaIdentity **default_id, GSList * smtp_servers,
+                               void (*changed_cb)(gpointer))
 {
     static GtkWidget *dialog = NULL;
-    GtkWidget *frame;
-    GtkWidget *display_frame;
-    GtkWidget *hbox;
-    GtkTreeView *tree;
+    GtkWidget* frame;
+    GtkWidget* display_frame;
+    GtkWidget* hbox;
+    GtkTreeView* tree;
     GtkTreeSelection *select;
     GSList **smtp_server_list;
 
@@ -1528,11 +1404,11 @@ libbalsa_identity_config_dialog(GtkWindow         *parent,
                                     parent, /* must NOT be modal */
                                     GTK_DIALOG_DESTROY_WITH_PARENT |
                                     libbalsa_dialog_flags(),
-                                    _("_Help"), IDENTITY_RESPONSE_HELP,
+                                    _("_Help"),             IDENTITY_RESPONSE_HELP,
                                     /* Translators: button "New" identity */
                                     C_("identity", "_New"), IDENTITY_RESPONSE_NEW,
-                                    _("_Remove"), IDENTITY_RESPONSE_REMOVE,
-                                    _("_Close"), IDENTITY_RESPONSE_CLOSE,
+                                    _("_Remove"),           IDENTITY_RESPONSE_REMOVE,
+                                    _("_Close"),            IDENTITY_RESPONSE_CLOSE,
                                     NULL);
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(dialog, parent);
@@ -1560,8 +1436,8 @@ libbalsa_identity_config_dialog(GtkWindow         *parent,
     display_frame = setup_ident_frame(GTK_DIALOG(dialog),
                                       FALSE, tree, smtp_servers);
     g_object_weak_ref(G_OBJECT(display_frame),
-                      (GWeakNotify) lbi_free_smtp_server_list,
-                      smtp_server_list);
+                     (GWeakNotify) lbi_free_smtp_server_list,
+                     smtp_server_list);
 
     gtk_widget_set_hexpand(display_frame, TRUE);
     gtk_box_pack_start(GTK_BOX(hbox), display_frame);
@@ -1575,32 +1451,24 @@ libbalsa_identity_config_dialog(GtkWindow         *parent,
     gtk_widget_grab_focus(GTK_WIDGET(tree));
 }
 
-
 /* Callback for the "response" signal of the dialog. */
 static void
-md_response_cb(GtkWidget   *dialog,
-               gint         response,
-               GtkTreeView *tree)
+md_response_cb(GtkWidget * dialog, gint response, GtkTreeView * tree)
 {
     switch (response) {
     case IDENTITY_RESPONSE_CLOSE:
-        if (close_cb(G_OBJECT(dialog))) {
+        if (close_cb(G_OBJECT(dialog)))
             break;
-        }
         return;
-
     case IDENTITY_RESPONSE_NEW:
         new_ident_cb(tree, G_OBJECT(dialog));
         return;
-
     case IDENTITY_RESPONSE_REMOVE:
         delete_ident_cb(tree, dialog);
         return;
-
     case IDENTITY_RESPONSE_HELP:
         help_ident_cb(dialog);
         return;
-
     default:
         break;
     }
@@ -1608,15 +1476,13 @@ md_response_cb(GtkWidget   *dialog,
     gtk_widget_destroy(dialog);
 }
 
-
 /* config_dialog_select
  *
  * called when the tree's selection changes
  * manage the button sensitivity, and update the display frame
  */
 static void
-config_dialog_select(GtkTreeSelection *selection,
-                     GtkDialog        *dialog)
+config_dialog_select(GtkTreeSelection * selection, GtkDialog * dialog)
 {
     LibBalsaIdentity *ident, **default_id;
     GtkTreeView *tree = gtk_tree_selection_get_tree_view(selection);
@@ -1629,26 +1495,22 @@ config_dialog_select(GtkTreeSelection *selection,
     g_object_set_data(G_OBJECT(dialog), "identity", ident);
 }
 
-
 static void
-display_frame_update(GObject          *dialog,
-                     LibBalsaIdentity *ident)
+display_frame_update(GObject * dialog, LibBalsaIdentity* ident)
 {
     GtkWidget *face_box;
 
-    if (!ident) {
+    if (!ident)
         return;
-    }
 
     ident_dialog_update(dialog);
     display_frame_set_field(dialog, "identity-name", ident->identity_name);
     display_frame_set_field(dialog, "identity-fullname", ident->ia ? ident->ia->name : NULL);
-    if (ident->ia && INTERNET_ADDRESS_IS_MAILBOX (ident->ia)) {
+    if (ident->ia && INTERNET_ADDRESS_IS_MAILBOX (ident->ia))
         display_frame_set_field(dialog, "identity-address",
                                 INTERNET_ADDRESS_MAILBOX(ident->ia)->addr);
-    } else {
+    else
         display_frame_set_field(dialog, "identity-address", NULL);
-    }
 
     display_frame_set_field(dialog, "identity-replyto", ident->replyto);
     display_frame_set_field(dialog, "identity-domain", ident->domain);
@@ -1701,39 +1563,36 @@ display_frame_update(GObject          *dialog,
     display_frame_set_boolean(dialog, "identity-warn-send-plain",
                               ident->warn_send_plain);
     display_frame_set_gpg_mode(dialog, "identity-crypt-protocol",
-                               &ident->crypt_protocol);
+                          &ident->crypt_protocol);
     display_frame_set_field(dialog, "identity-keyid", ident->force_gpg_key_id);
     display_frame_set_field(dialog, "identity-keyid-sm", ident->force_smime_key_id);
 }
 
 
 static void
-display_frame_set_field(GObject     *dialog,
-                        const gchar *key,
-                        const gchar *value)
+display_frame_set_field(GObject * dialog,
+                        const gchar* key,
+                        const gchar* value)
 {
     GtkEntry *entry = g_object_get_data(dialog, key);
 
     gtk_entry_set_text(entry, value ? value : "");
 }
 
-
 static void
-display_frame_set_boolean(GObject     *dialog,
-                          const gchar *key,
-                          gboolean     value)
+display_frame_set_boolean(GObject * dialog,
+                          const gchar* key,
+                          gboolean value)
 {
     GtkToggleButton *check = g_object_get_data(dialog, key);
 
     gtk_toggle_button_set_active(check, value);
 }
 
-
 static void
-display_frame_set_path(GObject     *dialog,
-                       const gchar *key,
-                       const gchar *value,
-                       gboolean     use_chooser)
+display_frame_set_path(GObject * dialog,
+                       const gchar* key,
+                       const gchar* value, gboolean use_chooser)
 {
     gboolean set = (value && *value);
     GtkWidget *chooser = g_object_get_data(dialog, key);
@@ -1741,11 +1600,10 @@ display_frame_set_path(GObject     *dialog,
         g_object_get_data(G_OBJECT(chooser), LIBBALSA_IDENTITY_CHECK);
 
     if (set) {
-        if (use_chooser) {
+        if(use_chooser)
             gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(chooser), value);
-        } else {
+        else
             gtk_entry_set_text(GTK_ENTRY(chooser), value);
-        }
     }
     gtk_widget_set_sensitive(GTK_WIDGET(chooser), set);
     gtk_toggle_button_set_active(check, set);
@@ -1753,29 +1611,25 @@ display_frame_set_path(GObject     *dialog,
 
 
 static void
-display_frame_set_gpg_mode(GObject     *dialog,
-                           const gchar *key,
-                           gint        *value)
+display_frame_set_gpg_mode(GObject * dialog, const gchar* key, gint * value)
 {
     GtkComboBox *opt_menu = g_object_get_data(G_OBJECT(dialog), key);
 
-    switch (*value) {
-    case LIBBALSA_PROTECT_OPENPGP:
-        gtk_combo_box_set_active(opt_menu, 1);
-        break;
-
-    case LIBBALSA_PROTECT_SMIMEV3:
-        gtk_combo_box_set_active(opt_menu, 2);
-        break;
-
-    case LIBBALSA_PROTECT_RFC3156:
-    default:
-        gtk_combo_box_set_active(opt_menu, 0);
-        *value = LIBBALSA_PROTECT_RFC3156;
-    }
+    switch (*value)
+        {
+        case LIBBALSA_PROTECT_OPENPGP:
+           gtk_combo_box_set_active(opt_menu, 1);
+            break;
+        case LIBBALSA_PROTECT_SMIMEV3:
+           gtk_combo_box_set_active(opt_menu, 2);
+            break;
+        case LIBBALSA_PROTECT_RFC3156:
+        default:
+           gtk_combo_box_set_active(opt_menu, 0);
+            *value = LIBBALSA_PROTECT_RFC3156;
+        }
 }
 
-
 /*
  * Add an option menu to the given dialog with a label next to it
  * explaining the contents.  A reference to the entry is stored as
@@ -1783,11 +1637,8 @@ display_frame_set_gpg_mode(GObject     *dialog,
  */
 
 static void
-ident_dialog_add_gpg_menu(GtkWidget   *grid,
-                          gint         row,
-                          GtkDialog   *dialog,
-                          const gchar *label_name,
-                          const gchar *menu_key)
+ident_dialog_add_gpg_menu(GtkWidget * grid, gint row, GtkDialog * dialog,
+                          const gchar * label_name, const gchar * menu_key)
 {
     GtkWidget *label;
     GtkWidget *opt_menu;
@@ -1812,12 +1663,9 @@ ident_dialog_add_gpg_menu(GtkWidget   *grid,
                   GINT_TO_POINTER(LIBBALSA_PROTECT_SMIMEV3), opt_menu);
 }
 
-
 /* add_show_menu: helper function */
 static void
-add_show_menu(const char *label,
-              gpointer    data,
-              GtkWidget  *menu)
+add_show_menu(const char *label, gpointer data, GtkWidget * menu)
 {
     GPtrArray *values =
         g_object_get_data(G_OBJECT(menu), "identity-value");
@@ -1826,22 +1674,17 @@ add_show_menu(const char *label,
     g_ptr_array_add(values, data);
 }
 
-
 /* ident_dialog_free_values: helper function */
 static void
-ident_dialog_free_values(GPtrArray *values)
+ident_dialog_free_values(GPtrArray * values)
 {
     g_ptr_array_free(values, TRUE);
 }
 
-
 static void
-ident_dialog_add_smtp_menu(GtkWidget   *grid,
-                           gint         row,
-                           GtkDialog   *dialog,
-                           const gchar *label_name,
-                           const gchar *menu_key,
-                           GSList      *smtp_servers)
+ident_dialog_add_smtp_menu(GtkWidget * grid, gint row, GtkDialog * dialog,
+                           const gchar * label_name,
+                           const gchar * menu_key, GSList * smtp_servers)
 {
     GtkWidget *label;
     GtkWidget *combo_box;
@@ -1867,11 +1710,9 @@ ident_dialog_add_smtp_menu(GtkWidget   *grid,
     }
 }
 
-
 static void
-display_frame_set_server(GObject            *dialog,
-                         const gchar        *key,
-                         LibBalsaSmtpServer *smtp_server)
+display_frame_set_server(GObject * dialog, const gchar * key,
+                         LibBalsaSmtpServer * smtp_server)
 {
     GtkComboBox *combo_box = g_object_get_data(G_OBJECT(dialog), key);
     GPtrArray *values;
@@ -1880,21 +1721,18 @@ display_frame_set_server(GObject            *dialog,
     values = g_object_get_data(G_OBJECT(combo_box), "identity-value");
 
     for (i = 0; i < values->len; i++) {
-        if (g_ptr_array_index(values, i) == smtp_server) {
+        if (g_ptr_array_index(values, i) == smtp_server)
             gtk_combo_box_set_active(combo_box, i);
-        }
     }
 }
 
-
 /*
  * Get the value of the active option menu item
  */
 static gpointer
-ident_dialog_get_value(GObject     *dialog,
-                       const gchar *key)
+ident_dialog_get_value(GObject * dialog, const gchar * key)
 {
-    GtkWidget *menu;
+    GtkWidget * menu;
     gint value;
     GPtrArray *values;
 
@@ -1905,7 +1743,6 @@ ident_dialog_get_value(GObject     *dialog,
     return g_ptr_array_index(values, value);
 }
 
-
 /*
  * End of the Manage Identities dialog
  */
@@ -1915,10 +1752,10 @@ ident_dialog_get_value(GObject     *dialog,
  */
 
 GtkWidget *
-libbalsa_identity_combo_box(GList       *identities,
-                            const gchar *active_name,
-                            GCallback    changed_cb,
-                            gpointer     changed_data)
+libbalsa_identity_combo_box(GList       * identities,
+                            const gchar * active_name,
+                            GCallback     changed_cb,
+                            gpointer      changed_data)
 {
     GList *list;
     GtkListStore *store;
@@ -1945,7 +1782,7 @@ libbalsa_identity_combo_box(GList       *identities,
 
         ident = list->data;
         from = internet_address_to_string(ident->ia, FALSE);
-        name = g_strconcat("(", ident->identity_name, ")", NULL);
+       name = g_strconcat("(", ident->identity_name, ")", NULL);
 
         gtk_list_store_append(store, &iter);
         gtk_list_store_set(store, &iter,
@@ -1957,9 +1794,8 @@ libbalsa_identity_combo_box(GList       *identities,
         g_free(from);
         g_free(name);
 
-        if (g_strcmp0(active_name, ident->identity_name) == 0) {
+        if (g_strcmp0(active_name, ident->identity_name) == 0)
             gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo_box), &iter);
-        }
     }
     g_object_unref(store);
 
diff --git a/libbalsa/identity-widgets.h b/libbalsa/identity-widgets.h
index 54b931c..12e7e8c 100644
--- a/libbalsa/identity-widgets.h
+++ b/libbalsa/identity-widgets.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -22,7 +22,7 @@
 #define __LIBBALSA_IDENTITY_WIDGETS_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include <gtk/gtk.h>
@@ -30,26 +30,26 @@
 
 G_BEGIN_DECLS
 
-void libbalsa_identity_config_dialog(GtkWindow         *parent,
-                                     GList            **identities,
-                                     LibBalsaIdentity **current,
-                                     GSList            *smtp_servers,
-                                     void (            *changed_cb)(gpointer));
+void libbalsa_identity_config_dialog(GtkWindow         * parent,
+                                     GList            ** identities,
+                                     LibBalsaIdentity ** current,
+                                     GSList            * smtp_servers,
+                                     void              (*changed_cb)(gpointer));
 
-typedef void (*LibBalsaIdentityCallback) (gpointer          data,
-                                          LibBalsaIdentity *identity);
+typedef void (*LibBalsaIdentityCallback) (gpointer           data,
+                                          LibBalsaIdentity * identity);
 
-void libbalsa_identity_select_dialog(GtkWindow               *parent,
-                                     const gchar             *prompt,
-                                     GList                   *identities,
-                                     LibBalsaIdentity        *initial_id,
+void libbalsa_identity_select_dialog(GtkWindow              * parent,
+                                     const gchar            * prompt,
+                                     GList                  * identities,
+                                     LibBalsaIdentity       * initial_id,
                                      LibBalsaIdentityCallback update,
                                      gpointer                 data);
 
-GtkWidget *libbalsa_identity_combo_box(GList       *identities,
-                                       const gchar *active_name,
-                                       GCallback    changed_cb,
-                                       gpointer     changed_data);
+GtkWidget * libbalsa_identity_combo_box(GList       * identities,
+                                        const gchar * active_name,
+                                        GCallback     changed_cb,
+                                        gpointer      changed_data);
 
 G_END_DECLS
 
diff --git a/libbalsa/identity.c b/libbalsa/identity.c
index c5fbb5e..aed5356 100644
--- a/libbalsa/identity.c
+++ b/libbalsa/identity.c
@@ -18,7 +18,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "identity.h"
 
@@ -30,11 +30,11 @@
 #include "misc.h"
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#  include "macosx-helpers.h"
 #endif
 
 #ifdef HAVE_GPGME
-#   include "libbalsa-gpgme.h"
+#  include "libbalsa-gpgme.h"
 #endif
 
 #include <string.h>
@@ -45,27 +45,26 @@
  */
 
 /* Forward references. */
-static void libbalsa_identity_dispose(GObject *object);
-static void libbalsa_identity_finalize(GObject *object);
+static void libbalsa_identity_dispose(GObject* object);
+static void libbalsa_identity_finalize(GObject* object);
 
 G_DEFINE_TYPE(LibBalsaIdentity, libbalsa_identity, G_TYPE_OBJECT)
 
 static void
-libbalsa_identity_class_init(LibBalsaIdentityClass *klass)
+libbalsa_identity_class_init(LibBalsaIdentityClass* klass)
 {
-    GObjectClass *object_class;
+    GObjectClass* object_class;
 
     object_class = G_OBJECT_CLASS(klass);
-    object_class->dispose = libbalsa_identity_dispose;
+    object_class->dispose  = libbalsa_identity_dispose;
     object_class->finalize = libbalsa_identity_finalize;
 }
 
-
 /*
  * Instance inititialization function: set defaults for new objects.
  */
 static void
-libbalsa_identity_init(LibBalsaIdentity *ident)
+libbalsa_identity_init(LibBalsaIdentity* ident)
 {
     ident->identity_name = NULL;
     ident->ia = NULL;
@@ -92,17 +91,16 @@ libbalsa_identity_init(LibBalsaIdentity *ident)
     ident->request_mdn = FALSE;
     ident->request_dsn = FALSE;
     /*
-       ident->face = NULL;
-       ident->x_face = NULL;
-     */
+    ident->face = NULL;
+    ident->x_face = NULL;
+    */
 }
 
-
 /*
  * Destroy the object, freeing all the values in the process.
  */
 static void
-libbalsa_identity_dispose(GObject *object)
+libbalsa_identity_dispose(GObject * object)
 {
     LibBalsaIdentity *ident = LIBBALSA_IDENTITY(object);
 
@@ -112,9 +110,8 @@ libbalsa_identity_dispose(GObject *object)
     G_OBJECT_CLASS(libbalsa_identity_parent_class)->dispose(object);
 }
 
-
 static void
-libbalsa_identity_finalize(GObject *object)
+libbalsa_identity_finalize(GObject * object)
 {
     LibBalsaIdentity *ident = LIBBALSA_IDENTITY(object);
 
@@ -133,7 +130,6 @@ libbalsa_identity_finalize(GObject *object)
     G_OBJECT_CLASS(libbalsa_identity_parent_class)->finalize(object);
 }
 
-
 /*
  * Public methods.
  */
@@ -142,7 +138,7 @@ libbalsa_identity_finalize(GObject *object)
  * Create a new object with the default identity name.  Does not add
  * it to the list of identities for the application.
  */
-GObject *
+GObject*
 libbalsa_identity_new(void)
 {
     return libbalsa_identity_new_with_name(_("New Identity"));
@@ -153,10 +149,10 @@ libbalsa_identity_new(void)
  * Create a new object with the specified identity name.  Does not add
  * it to the list of identities for the application.
  */
-GObject *
-libbalsa_identity_new_with_name(const gchar *ident_name)
+GObject*
+libbalsa_identity_new_with_name(const gchar* ident_name)
 {
-    LibBalsaIdentity *ident;
+    LibBalsaIdentity* ident;
 
     ident = g_object_new(LIBBALSA_TYPE_IDENTITY, NULL);
     libbalsa_identity_set_identity_name(ident, ident_name);
@@ -166,8 +162,7 @@ libbalsa_identity_new_with_name(const gchar *ident_name)
 
 
 void
-libbalsa_identity_set_identity_name(LibBalsaIdentity *ident,
-                                    const gchar      *name)
+libbalsa_identity_set_identity_name(LibBalsaIdentity* ident, const gchar* name)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
 
@@ -177,8 +172,8 @@ libbalsa_identity_set_identity_name(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_address(LibBalsaIdentity *ident,
-                              InternetAddress  *ia)
+libbalsa_identity_set_address(LibBalsaIdentity * ident,
+                              InternetAddress * ia)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
 
@@ -187,8 +182,7 @@ libbalsa_identity_set_address(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_replyto(LibBalsaIdentity *ident,
-                              const gchar      *address)
+libbalsa_identity_set_replyto(LibBalsaIdentity* ident, const gchar* address)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
 
@@ -198,8 +192,7 @@ libbalsa_identity_set_replyto(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_domain(LibBalsaIdentity *ident,
-                             const gchar      *dom)
+libbalsa_identity_set_domain(LibBalsaIdentity* ident, const gchar* dom)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
 
@@ -209,8 +202,7 @@ libbalsa_identity_set_domain(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_bcc(LibBalsaIdentity *ident,
-                          const gchar      *bcc)
+libbalsa_identity_set_bcc(LibBalsaIdentity* ident, const gchar* bcc)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
 
@@ -220,8 +212,7 @@ libbalsa_identity_set_bcc(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_reply_string(LibBalsaIdentity *ident,
-                                   const gchar      *reply)
+libbalsa_identity_set_reply_string(LibBalsaIdentity* ident, const gchar* reply)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
 
@@ -231,8 +222,7 @@ libbalsa_identity_set_reply_string(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_forward_string(LibBalsaIdentity *ident,
-                                     const gchar      *forward)
+libbalsa_identity_set_forward_string(LibBalsaIdentity* ident, const gchar* forward)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
 
@@ -242,8 +232,7 @@ libbalsa_identity_set_forward_string(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_send_mp_alternative(LibBalsaIdentity *ident,
-                                          gboolean          send_mp_alternative)
+libbalsa_identity_set_send_mp_alternative(LibBalsaIdentity* ident, gboolean send_mp_alternative)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
     ident->send_mp_alternative = send_mp_alternative;
@@ -251,8 +240,7 @@ libbalsa_identity_set_send_mp_alternative(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_signature_path(LibBalsaIdentity *ident,
-                                     const gchar      *path)
+libbalsa_identity_set_signature_path(LibBalsaIdentity* ident, const gchar* path)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
 
@@ -262,8 +250,7 @@ libbalsa_identity_set_signature_path(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_sig_executable(LibBalsaIdentity *ident,
-                                     gboolean          sig_executable)
+libbalsa_identity_set_sig_executable(LibBalsaIdentity* ident, gboolean sig_executable)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
     ident->sig_executable = sig_executable;
@@ -271,8 +258,7 @@ libbalsa_identity_set_sig_executable(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_sig_sending(LibBalsaIdentity *ident,
-                                  gboolean          sig_sending)
+libbalsa_identity_set_sig_sending(LibBalsaIdentity* ident, gboolean sig_sending)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
     ident->sig_sending = sig_sending;
@@ -280,8 +266,7 @@ libbalsa_identity_set_sig_sending(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_sig_whenforward(LibBalsaIdentity *ident,
-                                      gboolean          forward)
+libbalsa_identity_set_sig_whenforward(LibBalsaIdentity* ident, gboolean forward)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
     ident->sig_whenforward = forward;
@@ -289,8 +274,7 @@ libbalsa_identity_set_sig_whenforward(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_sig_whenreply(LibBalsaIdentity *ident,
-                                    gboolean          reply)
+libbalsa_identity_set_sig_whenreply(LibBalsaIdentity* ident, gboolean reply)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
     ident->sig_whenreply = reply;
@@ -298,8 +282,7 @@ libbalsa_identity_set_sig_whenreply(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_sig_separator(LibBalsaIdentity *ident,
-                                    gboolean          separator)
+libbalsa_identity_set_sig_separator(LibBalsaIdentity* ident, gboolean separator)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
     ident->sig_separator = separator;
@@ -307,8 +290,7 @@ libbalsa_identity_set_sig_separator(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_sig_prepend(LibBalsaIdentity *ident,
-                                  gboolean          prepend)
+libbalsa_identity_set_sig_prepend(LibBalsaIdentity* ident, gboolean prepend)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
     ident->sig_prepend = prepend;
@@ -316,8 +298,7 @@ libbalsa_identity_set_sig_prepend(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_face_path(LibBalsaIdentity *ident,
-                                const gchar      *path)
+libbalsa_identity_set_face_path(LibBalsaIdentity *ident, const gchar *path)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
 
@@ -327,8 +308,7 @@ libbalsa_identity_set_face_path(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_x_face_path(LibBalsaIdentity *ident,
-                                  const gchar      *path)
+libbalsa_identity_set_x_face_path(LibBalsaIdentity *ident, const gchar *path)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
 
@@ -338,8 +318,7 @@ libbalsa_identity_set_x_face_path(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_request_mdn(LibBalsaIdentity *ident,
-                                  gboolean          request)
+libbalsa_identity_set_request_mdn(LibBalsaIdentity *ident, gboolean request)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
     ident->request_mdn = request;
@@ -347,8 +326,7 @@ libbalsa_identity_set_request_mdn(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_request_dsn(LibBalsaIdentity *ident,
-                                  gboolean          request)
+libbalsa_identity_set_request_dsn(LibBalsaIdentity *ident, gboolean request)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
     ident->request_dsn = request;
@@ -356,8 +334,7 @@ libbalsa_identity_set_request_dsn(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_always_trust(LibBalsaIdentity *ident,
-                                   gboolean          trust)
+libbalsa_identity_set_always_trust(LibBalsaIdentity *ident, gboolean trust)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
     ident->always_trust = trust;
@@ -365,8 +342,7 @@ libbalsa_identity_set_always_trust(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_warn_send_plain(LibBalsaIdentity *ident,
-                                      gboolean          warn)
+libbalsa_identity_set_warn_send_plain(LibBalsaIdentity *ident, gboolean warn)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
     ident->warn_send_plain = warn;
@@ -374,8 +350,7 @@ libbalsa_identity_set_warn_send_plain(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_force_gpg_key_id(LibBalsaIdentity *ident,
-                                       const gchar      *key_id)
+libbalsa_identity_set_force_gpg_key_id(LibBalsaIdentity *ident, const gchar *key_id)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
 
@@ -385,8 +360,7 @@ libbalsa_identity_set_force_gpg_key_id(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_force_smime_key_id(LibBalsaIdentity *ident,
-                                         const gchar      *key_id)
+libbalsa_identity_set_force_smime_key_id(LibBalsaIdentity *ident, const gchar *key_id)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
 
@@ -397,22 +371,18 @@ libbalsa_identity_set_force_smime_key_id(LibBalsaIdentity *ident,
 
 /** Returns a signature for given identity, adding a signature prefix
     if needed. parent can be NULL. */
-gchar *
-libbalsa_identity_get_signature(LibBalsaIdentity *ident,
-                                GError          **error)
+gchar*
+libbalsa_identity_get_signature(LibBalsaIdentity * ident, GError ** error)
 {
     gchar *ret = NULL, *path;
     gchar *retval;
 
-    if ((ident->signature_path == NULL) || (*ident->signature_path == '\0')) {
-        return NULL;
-    }
+    if (ident->signature_path == NULL || *ident->signature_path == '\0')
+       return NULL;
 
     path = libbalsa_expand_path(ident->signature_path);
     if (ident->sig_executable) {
-        gchar *argv[] = {
-            "/bin/sh", "-c", path, NULL
-        };
+        gchar *argv[] = {"/bin/sh", "-c", path, NULL};
         gchar *standard_error = NULL;
 
         if (!g_spawn_sync(NULL, argv, NULL, G_SPAWN_DEFAULT, NULL, NULL,
@@ -426,16 +396,15 @@ libbalsa_identity_get_signature(LibBalsaIdentity *ident,
         }
         g_free(standard_error);
     } else {
-        if (!g_file_get_contents(path, &ret, NULL, error)) {
+       if (!g_file_get_contents(path, &ret, NULL, error)) {
             g_prefix_error(error, _("Cannot read signature file “%s”: "),
                            ident->signature_path);
-        }
+       }
     }
     g_free(path);
 
-    if (((error != NULL) && (*error != NULL)) || (ret == NULL)) {
+    if ((error != NULL && *error != NULL) || ret == NULL)
         return NULL;
-    }
 
     if (!libbalsa_utf8_sanitize(&ret, FALSE, NULL)) {
         g_set_error(error, LIBBALSA_ERROR_QUARK, -1,
@@ -456,10 +425,9 @@ libbalsa_identity_get_signature(LibBalsaIdentity *ident,
     return retval;
 }
 
-
 void
-libbalsa_identity_set_smtp_server(LibBalsaIdentity   *ident,
-                                  LibBalsaSmtpServer *smtp_server)
+libbalsa_identity_set_smtp_server(LibBalsaIdentity * ident,
+                                  LibBalsaSmtpServer * smtp_server)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
 
@@ -470,13 +438,13 @@ libbalsa_identity_set_smtp_server(LibBalsaIdentity   *ident,
 /* libbalsa_identity_new_config:
    factory-type method creating new Identity object from given
    configuration data.
- */
-LibBalsaIdentity *
-libbalsa_identity_new_config(const gchar *name)
+*/
+LibBalsaIdentity*
+libbalsa_identity_new_config(const gchar* name)
 {
-    LibBalsaIdentity *ident;
+    LibBalsaIdentity* ident;
     gchar *fname, *email;
-    gchar *tmpstr;
+    gchar* tmpstr;
 
     fname = libbalsa_conf_get_string("FullName");
     email = libbalsa_conf_get_string("Address");
@@ -529,19 +497,16 @@ libbalsa_identity_new_config(const gchar *name)
     return ident;
 }
 
-
 void
-libbalsa_identity_save(LibBalsaIdentity *ident,
-                       const gchar      *group)
+libbalsa_identity_save(LibBalsaIdentity* ident, const gchar* group)
 {
     g_return_if_fail(ident);
 
     libbalsa_conf_push_group(group);
     libbalsa_conf_set_string("FullName", ident->ia ? ident->ia->name : NULL);
 
-    if (ident->ia && INTERNET_ADDRESS_IS_MAILBOX (ident->ia)) {
+    if (ident->ia && INTERNET_ADDRESS_IS_MAILBOX (ident->ia))
         libbalsa_conf_set_string("Address", INTERNET_ADDRESS_MAILBOX(ident->ia)->addr);
-    }
 
     libbalsa_conf_set_string("ReplyTo", ident->replyto);
     libbalsa_conf_set_string("Domain", ident->domain);
@@ -560,12 +525,10 @@ libbalsa_identity_save(LibBalsaIdentity *ident,
     libbalsa_conf_set_bool("SigReply", ident->sig_whenreply);
     libbalsa_conf_set_bool("SigSeparator", ident->sig_separator);
     libbalsa_conf_set_bool("SigPrepend", ident->sig_prepend);
-    if (ident->face) {
+    if (ident->face)
         libbalsa_conf_set_string("FacePath", ident->face);
-    }
-    if (ident->x_face) {
+    if (ident->x_face)
         libbalsa_conf_set_string("XFacePath", ident->x_face);
-    }
     libbalsa_conf_set_bool("RequestMDN", ident->request_mdn);
     libbalsa_conf_set_bool("RequestDSN", ident->request_dsn);
 
@@ -584,8 +547,7 @@ libbalsa_identity_save(LibBalsaIdentity *ident,
 /* collected helper stuff for GPGME support */
 
 void
-libbalsa_identity_set_gpg_sign(LibBalsaIdentity *ident,
-                               gboolean          sign)
+libbalsa_identity_set_gpg_sign(LibBalsaIdentity* ident, gboolean sign)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
     ident->gpg_sign = sign;
@@ -593,8 +555,7 @@ libbalsa_identity_set_gpg_sign(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_gpg_encrypt(LibBalsaIdentity *ident,
-                                  gboolean          encrypt)
+libbalsa_identity_set_gpg_encrypt(LibBalsaIdentity* ident, gboolean encrypt)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
     ident->gpg_encrypt = encrypt;
@@ -602,8 +563,7 @@ libbalsa_identity_set_gpg_encrypt(LibBalsaIdentity *ident,
 
 
 void
-libbalsa_identity_set_crypt_protocol(LibBalsaIdentity *ident,
-                                     gint              protocol)
+libbalsa_identity_set_crypt_protocol(LibBalsaIdentity* ident, gint protocol)
 {
     g_return_if_fail(LIBBALSA_IS_IDENTITY(ident));
     ident->crypt_protocol = protocol;
diff --git a/libbalsa/identity.h b/libbalsa/identity.h
index 1adeb8f..69d8092 100644
--- a/libbalsa/identity.h
+++ b/libbalsa/identity.h
@@ -22,7 +22,7 @@
 #define __LIBBALSA_IDENTITY_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include <gmime/internet-address.h>
@@ -33,108 +33,90 @@
 G_BEGIN_DECLS
 
 #define LIBBALSA_TYPE_IDENTITY (libbalsa_identity_get_type ())
-G_DECLARE_FINAL_TYPE(LibBalsaIdentity,
-                     libbalsa_identity,
-                     LIBBALSA,
-                     IDENTITY,
-                     GObject)
-
-struct _LibBalsaIdentity {
-    GObject object;
-
-    gchar *identity_name;
-
-    InternetAddress *ia;
-    gchar *replyto;
-    gchar *domain;
-    gchar *bcc;
-    gchar *reply_string;
-    gchar *forward_string;
-    gboolean send_mp_alternative;
-
-    gchar *signature_path;
-    gboolean sig_executable;
-    gboolean sig_sending;
-    gboolean sig_whenforward;
-    gboolean sig_whenreply;
-    gboolean sig_separator;
-    gboolean sig_prepend;
-    gchar *face;
-    gchar *x_face;
-    gboolean request_mdn;
-    gboolean request_dsn;
-
-    gboolean gpg_sign;
-    gboolean gpg_encrypt;
-    gboolean always_trust;
-    gboolean warn_send_plain;
-    gint crypt_protocol;
-    gchar *force_gpg_key_id;
-    gchar *force_smime_key_id;
-    LibBalsaSmtpServer *smtp_server;
-};
-
-struct _LibBalsaIdentityClass {
-    GObjectClass parent_class;
-};
+G_DECLARE_FINAL_TYPE(LibBalsaIdentity, libbalsa_identity, LIBBALSA, IDENTITY, GObject)
+
+    struct _LibBalsaIdentity
+    {
+        GObject object;
+
+        gchar* identity_name;
+
+        InternetAddress *ia;
+        gchar* replyto;
+        gchar* domain;
+        gchar* bcc;
+        gchar* reply_string;
+        gchar* forward_string;
+        gboolean send_mp_alternative;
+
+        gchar* signature_path;
+        gboolean sig_executable;
+       gboolean sig_sending;
+        gboolean sig_whenforward;
+        gboolean sig_whenreply;
+        gboolean sig_separator;
+        gboolean sig_prepend;
+        gchar *face;
+        gchar *x_face;
+       gboolean request_mdn;
+       gboolean request_dsn;
+
+       gboolean gpg_sign;
+       gboolean gpg_encrypt;
+       gboolean always_trust;
+       gboolean warn_send_plain;
+       gint crypt_protocol;
+        gchar *force_gpg_key_id;
+        gchar *force_smime_key_id;
+       LibBalsaSmtpServer *smtp_server;
+    };
+
+    struct _LibBalsaIdentityClass
+    {
+        GObjectClass parent_class;
+    };
 
 
 /* Function prototypes */
-GObject *libbalsa_identity_new(void);
-GObject *libbalsa_identity_new_with_name(const gchar *ident_name);
-
-void libbalsa_identity_set_identity_name(LibBalsaIdentity *,
-                                         const gchar *);
-void libbalsa_identity_set_address(LibBalsaIdentity *,
-                                   InternetAddress *);
-void libbalsa_identity_set_replyto(LibBalsaIdentity *,
-                                   const gchar *);
-void libbalsa_identity_set_domain(LibBalsaIdentity *,
-                                  const gchar *);
-void libbalsa_identity_set_bcc(LibBalsaIdentity *,
-                               const gchar *);
-void libbalsa_identity_set_reply_string(LibBalsaIdentity *,
-                                        const gchar *);
-void libbalsa_identity_set_forward_string(LibBalsaIdentity *,
-                                          const gchar *);
-
-void libbalsa_identity_set_send_mp_alternative(LibBalsaIdentity *, gboolean);
-void libbalsa_identity_set_signature_path(LibBalsaIdentity *,
-                                          const gchar *);
-
-void libbalsa_identity_set_sig_executable(LibBalsaIdentity *, gboolean);
-void libbalsa_identity_set_sig_sending(LibBalsaIdentity *, gboolean);
-void libbalsa_identity_set_sig_whenforward(LibBalsaIdentity *, gboolean);
-void libbalsa_identity_set_sig_whenreply(LibBalsaIdentity *, gboolean);
-void libbalsa_identity_set_sig_separator(LibBalsaIdentity *, gboolean);
-void libbalsa_identity_set_sig_prepend(LibBalsaIdentity *, gboolean);
-void libbalsa_identity_set_face_path(LibBalsaIdentity *,
-                                     const gchar *);
-void libbalsa_identity_set_x_face_path(LibBalsaIdentity *,
-                                       const gchar *);
-
-void libbalsa_identity_set_request_mdn(LibBalsaIdentity *, gboolean);
-void libbalsa_identity_set_request_dsn(LibBalsaIdentity *, gboolean);
-void libbalsa_identity_set_always_trust(LibBalsaIdentity *, gboolean);
-void libbalsa_identity_set_warn_send_plain(LibBalsaIdentity *, gboolean);
-void libbalsa_identity_set_force_gpg_key_id(LibBalsaIdentity *,
-                                            const gchar *);
-void libbalsa_identity_set_force_smime_key_id(LibBalsaIdentity *,
-                                              const gchar *);
-
-gchar *libbalsa_identity_get_signature(LibBalsaIdentity *,
-                                       GError **);
-void libbalsa_identity_set_smtp_server(LibBalsaIdentity *ident,
-                                       LibBalsaSmtpServer *
-                                       smtp_server);
-
-void libbalsa_identity_set_gpg_sign(LibBalsaIdentity *, gboolean);
-void libbalsa_identity_set_gpg_encrypt(LibBalsaIdentity *, gboolean);
-void libbalsa_identity_set_crypt_protocol(LibBalsaIdentity *ident, gint);
-
-LibBalsaIdentity *libbalsa_identity_new_config(const gchar *name);
-void libbalsa_identity_save(LibBalsaIdentity *id,
-                            const gchar      *prefix);
+    GObject* libbalsa_identity_new(void);
+    GObject* libbalsa_identity_new_with_name(const gchar* ident_name);
+
+    void libbalsa_identity_set_identity_name(LibBalsaIdentity*, const gchar*);
+    void libbalsa_identity_set_address(LibBalsaIdentity*, InternetAddress*);
+    void libbalsa_identity_set_replyto(LibBalsaIdentity*, const gchar*);
+    void libbalsa_identity_set_domain(LibBalsaIdentity*, const gchar*);
+    void libbalsa_identity_set_bcc(LibBalsaIdentity*, const gchar*);
+    void libbalsa_identity_set_reply_string(LibBalsaIdentity* , const gchar*);
+    void libbalsa_identity_set_forward_string(LibBalsaIdentity*, const gchar*);
+    void libbalsa_identity_set_send_mp_alternative(LibBalsaIdentity*, gboolean);
+    void libbalsa_identity_set_signature_path(LibBalsaIdentity*, const gchar*);
+    void libbalsa_identity_set_sig_executable(LibBalsaIdentity*, gboolean);
+    void libbalsa_identity_set_sig_sending(LibBalsaIdentity*, gboolean);
+    void libbalsa_identity_set_sig_whenforward(LibBalsaIdentity*, gboolean);
+    void libbalsa_identity_set_sig_whenreply(LibBalsaIdentity*, gboolean);
+    void libbalsa_identity_set_sig_separator(LibBalsaIdentity*, gboolean);
+    void libbalsa_identity_set_sig_prepend(LibBalsaIdentity*, gboolean);
+    void libbalsa_identity_set_face_path(LibBalsaIdentity*, const gchar*);
+    void libbalsa_identity_set_x_face_path(LibBalsaIdentity*, const gchar*);
+    void libbalsa_identity_set_request_mdn(LibBalsaIdentity*, gboolean);
+    void libbalsa_identity_set_request_dsn(LibBalsaIdentity*, gboolean);
+    void libbalsa_identity_set_always_trust(LibBalsaIdentity*, gboolean);
+    void libbalsa_identity_set_warn_send_plain(LibBalsaIdentity*, gboolean);
+    void libbalsa_identity_set_force_gpg_key_id(LibBalsaIdentity*, const gchar *);
+    void libbalsa_identity_set_force_smime_key_id(LibBalsaIdentity*, const gchar *);
+
+    gchar* libbalsa_identity_get_signature(LibBalsaIdentity *,
+                                           GError **);
+    void libbalsa_identity_set_smtp_server(LibBalsaIdentity * ident,
+                                           LibBalsaSmtpServer *
+                                           smtp_server);
+
+    void libbalsa_identity_set_gpg_sign(LibBalsaIdentity*, gboolean);
+    void libbalsa_identity_set_gpg_encrypt(LibBalsaIdentity*, gboolean);
+    void libbalsa_identity_set_crypt_protocol(LibBalsaIdentity* ident, gint);
+
+    LibBalsaIdentity* libbalsa_identity_new_config(const gchar* name);
+    void libbalsa_identity_save(LibBalsaIdentity* id, const gchar* prefix);
 
 
 G_END_DECLS
diff --git a/libbalsa/imap-server.c b/libbalsa/imap-server.c
index a6be37a..4426a23 100644
--- a/libbalsa/imap-server.c
+++ b/libbalsa/imap-server.c
@@ -5,25 +5,25 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 /*
-   LibBalsaImapServer is a class for managing connections to one IMAP
-   server. Idle connections are disconnected after a timeout, or when
-   the user switches to offline mode.
- */
+  LibBalsaImapServer is a class for managing connections to one IMAP
+  server. Idle connections are disconnected after a timeout, or when
+  the user switches to offline mode.
+*/
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "imap-server.h"
 
@@ -31,7 +31,7 @@
 #include <stdlib.h>
 
 #if defined(HAVE_LIBSECRET)
-#   include <libsecret/secret.h>
+#include <libsecret/secret.h>
 #endif                          /* defined(HAVE_LIBSECRET) */
 
 #include "libbalsa.h"
@@ -45,29 +45,29 @@
 #define REQ_SSL(s) (LIBBALSA_SERVER(s)->use_ssl)
 
 /** wait 60 seconds for packets */
-#define IMAP_CMD_TIMEOUT (60 * 1000)
+#define IMAP_CMD_TIMEOUT (60*1000)
 
 static LibBalsaServerClass *parent_class = NULL;
 
 struct LibBalsaImapServer_ {
     LibBalsaServer server;
-
+    
     guint connection_cleanup_id;
     gchar *key;
     guint max_connections;
     gboolean offline_mode;
-
+    
     GMutex lock; /* protects the following members */
     guint used_connections;
     GList *used_handles;
     GList *free_handles;
-    unsigned persistent_cache : 1; /* if TRUE, messages will be cached in
-                                      $HOME and preserved between
-                                      sessions. If FALSE, messages will be
-                                      kept in /tmp and cleaned on exit. */
-    unsigned has_fetch_bug : 1;
-    unsigned use_status : 1; /**< server has fast STATUS command */
-    unsigned use_idle : 1;  /**< IDLE will work: no dummy firewall on the way */
+    unsigned persistent_cache:1; /* if TRUE, messages will be cached in
+                                    $HOME and preserved between
+                                    sessions. If FALSE, messages will be
+                                    kept in /tmp and cleaned on exit. */
+    unsigned has_fetch_bug:1;
+    unsigned use_status:1; /**< server has fast STATUS command */
+    unsigned use_idle:1;  /**< IDLE will work: no dummy firewall on the way */
 };
 
 typedef struct LibBalsaImapServerClass_ {
@@ -75,17 +75,17 @@ typedef struct LibBalsaImapServerClass_ {
 
 } LibBalsaImapServerClass;
 
-static void libbalsa_imap_server_class_init(LibBalsaImapServerClass *klass);
-static void libbalsa_imap_server_init(LibBalsaImapServer *server);
-static void libbalsa_imap_server_finalize(GObject *object);
+static void libbalsa_imap_server_class_init(LibBalsaImapServerClass * klass);
+static void libbalsa_imap_server_init(LibBalsaImapServer * server);
+static void libbalsa_imap_server_finalize(GObject * object);
 static gboolean connection_cleanup(gpointer ptr);
 
 /* Poll every 5 minutes - must be shortest ouf of the times here. */
-#define CONNECTION_CLEANUP_POLL_PERIOD  (2 * 60)
+#define CONNECTION_CLEANUP_POLL_PERIOD  (2*60)
 /* Cleanup connections more then 10 minutes idle */
-#define CONNECTION_CLEANUP_IDLE_TIME    (10 * 60)
+#define CONNECTION_CLEANUP_IDLE_TIME    (10*60)
 /* Send NOOP after 20 minutes to keep a connection alive */
-#define CONNECTION_CLEANUP_NOOP_TIME    (20 * 60)
+#define CONNECTION_CLEANUP_NOOP_TIME    (20*60)
 /* We try to avoid too many connections per server */
 #define MAX_CONNECTIONS_PER_SERVER 20
 
@@ -98,22 +98,16 @@ struct handle_info {
     void *last_user;
 };
 
-static int
-by_handle(gconstpointer a,
-          gconstpointer b)
+static int by_handle(gconstpointer a, gconstpointer b)
 {
-    return ((struct handle_info *)a)->handle != b;
+    return ((struct handle_info*)a)->handle != b;
 }
 
-
-static int
-by_last_user(gconstpointer a,
-             gconstpointer b)
+static int by_last_user(gconstpointer a, gconstpointer b)
 {
-    return ((struct handle_info *)a)->last_user != b;
+    return ((struct handle_info*)a)->last_user != b;
 }
 
-
 GType
 libbalsa_imap_server_get_type(void)
 {
@@ -140,14 +134,12 @@ libbalsa_imap_server_get_type(void)
     return server_type;
 }
 
-
-static void
-libbalsa_imap_server_set_username(LibBalsaServer *server,
-                                  const gchar    *name)
+static void libbalsa_imap_server_set_username(LibBalsaServer * server,
+                                              const gchar * name)
 {
-    if (server->host && name) { /* we have been initialized... */
+    if(server->host && name) { /* we have been initialized... */
         LibBalsaImapServer *imap_server = LIBBALSA_IMAP_SERVER(server);
-
+        
         g_mutex_lock(&imap_servers_lock);
         g_hash_table_steal(imap_servers, imap_server->key);
         g_free(imap_server->key);
@@ -157,14 +149,11 @@ libbalsa_imap_server_set_username(LibBalsaServer *server,
     }
     (parent_class)->set_username(server, name);
 }
-
-
 static void
-libbalsa_imap_server_set_host(LibBalsaServer *server,
-                              const gchar    *host,
-                              gboolean        use_ssl)
+libbalsa_imap_server_set_host(LibBalsaServer * server,
+                              const gchar * host, gboolean use_ssl)
 {
-    if (server->user && host) { /* we have been initialized... */
+    if(server->user && host) { /* we have been initialized... */
         LibBalsaImapServer *imap_server = LIBBALSA_IMAP_SERVER(server);
         g_mutex_lock(&imap_servers_lock);
         g_hash_table_steal(imap_servers, imap_server->key);
@@ -175,10 +164,8 @@ libbalsa_imap_server_set_host(LibBalsaServer *server,
     }
     (parent_class)->set_host(server, host, use_ssl);
 }
-
-
 static void
-libbalsa_imap_server_class_init(LibBalsaImapServerClass *klass)
+libbalsa_imap_server_class_init(LibBalsaImapServerClass * klass)
 {
     GObjectClass *object_class;
     LibBalsaServerClass *server_class;
@@ -197,9 +184,8 @@ libbalsa_imap_server_class_init(LibBalsaImapServerClass *klass)
 #endif
 }
 
-
 static void
-libbalsa_imap_server_init(LibBalsaImapServer *imap_server)
+libbalsa_imap_server_init(LibBalsaImapServer * imap_server)
 {
     LIBBALSA_SERVER(imap_server)->protocol = "imap";
     imap_server->key = NULL;
@@ -210,14 +196,13 @@ libbalsa_imap_server_init(LibBalsaImapServer *imap_server)
     imap_server->free_handles = NULL;
     imap_server->persistent_cache = TRUE;
     imap_server->use_idle = TRUE;
-    imap_server->connection_cleanup_id =
+    imap_server->connection_cleanup_id = 
         g_timeout_add_seconds(CONNECTION_CLEANUP_POLL_PERIOD,
                               connection_cleanup, imap_server);
 }
 
-
 static void
-libbalsa_imap_server_finalize(GObject *object)
+libbalsa_imap_server_finalize(GObject * object)
 {
     LibBalsaImapServer *imap_server;
 
@@ -238,93 +223,76 @@ libbalsa_imap_server_finalize(GObject *object)
     G_OBJECT_CLASS(parent_class)->finalize(object);
 }
 
-
 gint ImapDebug = 0;
 #define BALSA_TEST_IMAP 1
 
 static void
-monitor_cb(const char *buffer,
-           int         length,
-           int         direction,
-           void       *arg)
+monitor_cb(const char *buffer, int length, int direction, void *arg)
 {
 #if BALSA_TEST_IMAP
-    if (ImapDebug) {
-        const gchar *passwd = NULL;
-        int i;
-
-        if (direction) {
-            const gchar *login;
-            int login_length;
-
-            login = g_strstr_len(buffer, length, "LOGIN ");
-            if (login) {
-                login_length = 6;
-            } else {
-                login = g_strstr_len(buffer, length, "AUTHENTICATE PLAIN");
-                login_length = 18;
-            }
+  if (ImapDebug) {
+    const gchar *passwd = NULL;
+    int i;
 
-            if (login) {
-                const gchar *user = login + login_length;
-                passwd = g_strstr_len(user, length - (user - buffer), " ");
-                if (passwd) {
-                    int new_len = ++passwd - buffer;
-                    if (new_len < length) {
-                        length = new_len;
-                    } else {
-                        passwd = NULL;
-                    }
-                }
-            }
+    if (direction) {
+      const gchar *login;
+      int login_length;
+          
+      login = g_strstr_len(buffer, length, "LOGIN ");
+      if (login) {
+        login_length = 6;
+      } else {
+        login = g_strstr_len(buffer, length, "AUTHENTICATE PLAIN");
+        login_length = 18;
+      }
+
+      if (login) {
+        const gchar *user = login + login_length;
+        passwd = g_strstr_len(user, length - (user - buffer), " ");
+        if (passwd) {
+          int new_len = ++passwd - buffer;
+          if (new_len < length)
+            length = new_len;
+          else
+            passwd = NULL;
         }
+      }
+    }
 
-        printf("IMAP %c: ", direction ? 'C' : 'S');
-        for (i = 0; i < length; i++) {
-            putchar(buffer[i]);
-        }
+    printf("IMAP %c: ", direction ? 'C' : 'S');
+    for (i = 0; i < length; i++)
+      putchar(buffer[i]);
 
-        if (passwd) {
-            puts("(password hidden)");
-        }
+    if (passwd)
+      puts("(password hidden)");
 
-        fflush(NULL);
-    }
+    fflush(NULL);
+  }
 #endif                          /* BALSA_TEST_IMAP */
-    if (direction) {
-        ((struct handle_info *) arg)->last_used = time(NULL);
-    }
+  if (direction)
+    ((struct handle_info *) arg)->last_used = time(NULL);
 }
 
-
 static void
-is_info_cb(ImapMboxHandle *h,
-           ImapResponse    rc,
-           const gchar    *str,
-           void           *arg)
+is_info_cb(ImapMboxHandle *h, ImapResponse rc, const gchar* str, void *arg)
 {
     LibBalsaInformationType it;
     LibBalsaServer *is = LIBBALSA_SERVER(arg);
     const gchar *fmt;
 
-    switch (rc) {
+    switch(rc) {
     case IMR_ALERT: /* IMAP host name + message */
         fmt = _("IMAP server %s alert:\n%s");
-        it = LIBBALSA_INFORMATION_ERROR;
+        it = LIBBALSA_INFORMATION_ERROR; 
         break;
-
     case IMR_BAD: /* IMAP host name + message */
         fmt = _("IMAP server %s error: %s");
         it = LIBBALSA_INFORMATION_ERROR;
         break;
-
-    case IMR_BYE:
-    case IMR_NO:
+    case IMR_BYE: 
+    case IMR_NO: 
         /* IMAP host name + message */
-        fmt = "%s: %s";
-        it = LIBBALSA_INFORMATION_MESSAGE;
-        break;
-
+        fmt = "%s: %s";  it = LIBBALSA_INFORMATION_MESSAGE; break;
     default:
         return;
     }
@@ -349,18 +317,13 @@ lb_imap_server_info_new(LibBalsaServer *server)
     info = g_new0(struct handle_info, 1);
     info->handle = handle;
     imap_handle_set_monitorcb(handle, monitor_cb, info);
-    imap_handle_set_infocb(handle, is_info_cb, server);
-    imap_handle_set_usercb(handle, libbalsa_server_user_cb, server);
-    switch (server->tls_mode) {
-    case LIBBALSA_TLS_DISABLED: mode = IMAP_TLS_DISABLED;
-        break;
-
+    imap_handle_set_infocb(handle,    is_info_cb, server);
+    imap_handle_set_usercb(handle,    libbalsa_server_user_cb, server);
+    switch(server->tls_mode) {
+    case LIBBALSA_TLS_DISABLED: mode = IMAP_TLS_DISABLED; break;
     default:
-    case LIBBALSA_TLS_ENABLED: mode = IMAP_TLS_ENABLED;
-        break;
-
-    case LIBBALSA_TLS_REQUIRED: mode = IMAP_TLS_REQUIRED;
-        break;
+    case LIBBALSA_TLS_ENABLED : mode = IMAP_TLS_ENABLED;  break;
+    case LIBBALSA_TLS_REQUIRED: mode = IMAP_TLS_REQUIRED; break;
     }
     imap_handle_set_tls_mode(handle, mode);
     imap_handle_set_option(handle, IMAP_OPT_ANONYMOUS, server->try_anonymous);
@@ -379,7 +342,6 @@ lb_imap_server_info_new(LibBalsaServer *server)
     return info;
 }
 
-
 /* Clean up and free a struct handle_info. */
 static void
 lb_imap_server_info_free(struct handle_info *info)
@@ -391,11 +353,10 @@ lb_imap_server_info_free(struct handle_info *info)
     g_free(info);
 }
 
-
 /* Check handles periodically; shut down inactive ones, and send NOOP to
  * host to keep active connections alive. */
 static void
-lb_imap_server_cleanup(LibBalsaImapServer *imap_server)
+lb_imap_server_cleanup(LibBalsaImapServer * imap_server)
 {
     time_t idle_marker;
     GList *list;
@@ -403,9 +364,8 @@ lb_imap_server_cleanup(LibBalsaImapServer *imap_server)
     /* Quit if there is an action going on, eg. an connection is being
      * opened and the user is asked to confirm the certificate or
      * provide password, etc. */
-    if (!g_mutex_trylock(&imap_server->lock)) {
-        return;
-    }
+    if(!g_mutex_trylock(&imap_server->lock))
+        return; 
 
     idle_marker = time(NULL) - CONNECTION_CLEANUP_IDLE_TIME;
 
@@ -429,10 +389,10 @@ lb_imap_server_cleanup(LibBalsaImapServer *imap_server)
     for (list = imap_server->used_handles; list; list = list->next) {
         struct handle_info *info = list->data;
         /* We poll selected handles each time (unless IDLE is on
-           already).  Remaining handles are just kept alive. */
-        if ((imap_mbox_is_selected(info->handle) &&
-             !imap_server->use_idle) ||
-            (info->last_used < idle_marker)) {
+           already).  Remaining handles are just kept alive. */ 
+        if ( (imap_mbox_is_selected(info->handle) &&
+              !imap_server->use_idle) || 
+            info->last_used < idle_marker) {
             /* ignore errors here - the point is to keep the
                connection alive and if there is no connection, noop
                will be, well, no-op. Other operations may possibly
@@ -444,9 +404,7 @@ lb_imap_server_cleanup(LibBalsaImapServer *imap_server)
     g_mutex_unlock(&imap_server->lock);
 }
 
-
-static gboolean
-connection_cleanup(gpointer ptr)
+static gboolean connection_cleanup(gpointer ptr)
 {
     LibBalsaImapServer *imap_server;
 
@@ -458,19 +416,16 @@ connection_cleanup(gpointer ptr)
     return TRUE;
 }
 
-
-static LibBalsaImapServer *
-get_or_create(const gchar *username,
-              const gchar *host)
+static LibBalsaImapServer* get_or_create(const gchar *username,
+                                         const gchar *host)
 {
     LibBalsaImapServer *imap_server;
     gchar *key;
 
     if (!imap_servers) {
-        g_mutex_lock(&imap_servers_lock);
-        if (!imap_servers) {
+       g_mutex_lock(&imap_servers_lock);
+        if (!imap_servers)
             imap_servers = g_hash_table_new(g_str_hash, g_str_equal);
-        }
         g_mutex_unlock(&imap_servers_lock);
     }
 
@@ -490,7 +445,6 @@ get_or_create(const gchar *username,
     return imap_server;
 }
 
-
 /**
  * libbalsa_imap_server_new:
  * @username: username to use to login
@@ -500,15 +454,13 @@ get_or_create(const gchar *username,
  *
  * Return value: A #LibBalsaImapServer
  **/
-LibBalsaImapServer *
-libbalsa_imap_server_new(const gchar *username,
-                         const gchar *host)
+LibBalsaImapServer* libbalsa_imap_server_new(const gchar *username,
+                                             const gchar *host)
 {
     return get_or_create(username, host);
 }
 
-
-LibBalsaImapServer *
+LibBalsaImapServer*
 libbalsa_imap_server_new_from_config(void)
 {
     LibBalsaServer tmp_server;
@@ -518,7 +470,7 @@ libbalsa_imap_server_new_from_config(void)
     gint tls_mode, conn_limit;
 
     tmp_server.host = libbalsa_conf_get_string("Server");
-    if (strrchr(tmp_server.host, ':') == NULL) {
+    if(strrchr(tmp_server.host, ':') == NULL) {
         gint port;
         port = libbalsa_conf_get_int_with_default("Port", &d);
         if (!d) {
@@ -526,11 +478,10 @@ libbalsa_imap_server_new_from_config(void)
             g_free(tmp_server.host);
             tmp_server.host = newhost;
         }
-    }
+    }       
     tmp_server.user = libbalsa_conf_private_get_string("Username");
-    if (!tmp_server.user) {
+    if (!tmp_server.user)
         tmp_server.user = g_strdup(getenv("USER"));
-    }
 
     imap_server = get_or_create(tmp_server.user, tmp_server.host);
     server = LIBBALSA_SERVER(imap_server);
@@ -542,37 +493,23 @@ libbalsa_imap_server_new_from_config(void)
         server->host = tmp_server.host;
     }
     d1 = libbalsa_conf_get_bool_with_default("Anonymous", &d);
-    if (!d) {
-        server->try_anonymous = !!d1;
-    }
+    if(!d) server->try_anonymous = !!d1;
     server->use_ssl |= libbalsa_conf_get_bool("SSL=false");
     tls_mode = libbalsa_conf_get_int_with_default("TLSMode", &d);
-    if (!d) {
-        server->tls_mode = tls_mode;
-    }
+    if(!d) server->tls_mode = tls_mode;
     conn_limit = libbalsa_conf_get_int_with_default("ConnectionLimit", &d);
-    if (!d) {
-        imap_server->max_connections = conn_limit;
-    }
+    if(!d) imap_server->max_connections = conn_limit;
     d1 = libbalsa_conf_get_bool_with_default("PersistentCache", &d);
-    if (!d) {
-        imap_server->persistent_cache = !!d1;
-    }
+    if(!d) imap_server->persistent_cache = !!d1;
     d1 = libbalsa_conf_get_bool_with_default("HasFetchBug", &d);
-    if (!d) {
-        imap_server->has_fetch_bug = !!d1;
-    }
+    if(!d) imap_server->has_fetch_bug = !!d1;
     d1 = libbalsa_conf_get_bool_with_default("UseStatus", &d);
-    if (!d) {
-        imap_server->use_status = !!d1;
-    }
+    if(!d) imap_server->use_status = !!d1;
     d1 = libbalsa_conf_get_bool_with_default("UseIdle", &d);
-    if (!d) {
-        imap_server->use_idle = !!d1;
-    }
+    if(!d) imap_server->use_idle = !!d1;
     if (!server->passwd) {
         server->remember_passwd = libbalsa_conf_get_bool("RememberPasswd=false");
-        if (server->remember_passwd) {
+        if(server->remember_passwd) {
 #if defined(HAVE_LIBSECRET)
             GError *err = NULL;
 
@@ -580,8 +517,8 @@ libbalsa_imap_server_new_from_config(void)
                 secret_password_lookup_sync(LIBBALSA_SERVER_SECRET_SCHEMA,
                                             NULL, &err,
                                             "protocol", server->protocol,
-                                            "server", server->host,
-                                            "user", server->user,
+                                            "server",   server->host,
+                                            "user",     server->user,
                                             NULL);
             if (err) {
                 libbalsa_free_password(server->passwd);
@@ -598,11 +535,11 @@ libbalsa_imap_server_new_from_config(void)
                     server->passwd = buff;
                     secret_password_store_sync
                         (LIBBALSA_SERVER_SECRET_SCHEMA, NULL,
-                        _("Balsa passwords"), server->passwd, NULL, &err,
-                        "protocol", server->protocol,
-                        "server", server->host,
-                        "user", server->user,
-                        NULL);
+                         _("Balsa passwords"), server->passwd, NULL, &err,
+                         "protocol", server->protocol,
+                         "server",   server->host,
+                         "user",     server->user,
+                         NULL);
                     /* We could in principle clear the password in the
                      * config file here but we do not for the backward
                      * compatibility. */
@@ -615,14 +552,14 @@ libbalsa_imap_server_new_from_config(void)
             }
 #else
             server->passwd = libbalsa_conf_private_get_string("Password");
-            if (server->passwd != NULL) {
-                gchar *buff = libbalsa_rot(server->passwd);
-                libbalsa_free_password(server->passwd);
-                server->passwd = buff;
-            }
+           if (server->passwd != NULL) {
+               gchar *buff = libbalsa_rot(server->passwd);
+               libbalsa_free_password(server->passwd);
+               server->passwd = buff;
+           }
 #endif                          /* defined(HAVE_LIBSECRET) */
-        }
-        if (server->passwd && (server->passwd[0] == '\0')) {
+       }
+        if(server->passwd && server->passwd[0] == '\0') {
             libbalsa_free_password(server->passwd);
             server->passwd = NULL;
         }
@@ -630,7 +567,6 @@ libbalsa_imap_server_new_from_config(void)
     return imap_server;
 }
 
-
 void
 libbalsa_imap_server_save_config(LibBalsaImapServer *server)
 {
@@ -638,47 +574,39 @@ libbalsa_imap_server_save_config(LibBalsaImapServer *server)
     libbalsa_conf_set_int("ConnectionLimit", server->max_connections);
     libbalsa_conf_set_bool("PersistentCache", server->persistent_cache);
     libbalsa_conf_set_bool("HasFetchBug", server->has_fetch_bug);
-    libbalsa_conf_set_bool("UseStatus", server->use_status);
-    libbalsa_conf_set_bool("UseIdle", server->use_idle);
+    libbalsa_conf_set_bool("UseStatus",   server->use_status);
+    libbalsa_conf_set_bool("UseIdle",     server->use_idle);
 }
 
-
 /* handle_connection_error() releases handle_info data, clears password
    and sets err apriopriately */
 static void
-handle_connection_error(int                 rc,
-                        struct handle_info *info,
-                        LibBalsaServer     *server,
-                        GError            **err)
+handle_connection_error(int rc, struct handle_info *info,
+                        LibBalsaServer *server, GError **err)
 {
     gchar *msg = imap_mbox_handle_get_last_msg(info->handle);
-    switch (rc) {
+    switch(rc) {
     case IMAP_AUTH_FAILURE:
-        libbalsa_server_set_password(server, NULL);
-        break;
-
+        libbalsa_server_set_password(server, NULL); break;
     case IMAP_CONNECT_FAILED:
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_NETWORK_ERROR,
                     _("Cannot connect to %s"), server->host);
         break;
-
     case IMAP_AUTH_CANCELLED:
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_AUTH_CANCELLED,
                     _("Cannot connect to the server: %s"), msg);
         break;
-
     default:
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_AUTH_ERROR,
                     _("Cannot connect to the server: %s"), msg);
-    }
+    }    
     g_free(msg);
     lb_imap_server_info_free(info);
 }
 
-
 /**
  * libbalsa_imap_server_get_handle:
  * @server: A #LibBalsaImapServer
@@ -687,21 +615,19 @@ handle_connection_error(int                 rc,
  * connects.  If there is no password set, the user is asked to supply
  * one.  Handle is apriopriate for all commands that work in AUTHENTICATED
  * state (LIST, SUBSCRIBE, CREATE, APPEND) but it MUST not be used for
- * select -- use libbalsa_imap_server_get_handle_with_user for that purpose.
+ * select -- use libbalsa_imap_server_get_handle_with_user for that purpose. 
  *
  * Return value: a handle to the server, or %NULL when there are no
  * free connections.
  **/
-ImapMboxHandle *
-libbalsa_imap_server_get_handle(LibBalsaImapServer *imap_server,
-                                GError            **err)
+ImapMboxHandle*
+libbalsa_imap_server_get_handle(LibBalsaImapServer *imap_server, GError **err)
 {
     LibBalsaServer *server = LIBBALSA_SERVER(imap_server);
     struct handle_info *info = NULL;
 
-    if (!imap_server || imap_server->offline_mode) {
+    if (!imap_server || imap_server->offline_mode)
         return NULL;
-    }
 
     g_mutex_lock(&imap_server->lock);
     /* look for free connection */
@@ -709,36 +635,35 @@ libbalsa_imap_server_get_handle(LibBalsaImapServer *imap_server,
         GList *conn;
         conn = g_list_find_custom(imap_server->free_handles, NULL,
                                   by_last_user);
-        if (!conn) {
+        if (!conn)
             conn = imap_server->free_handles;
-        }
-        info = (struct handle_info *)conn->data;
+        info = (struct handle_info*)conn->data;
         imap_server->free_handles =
             g_list_delete_link(imap_server->free_handles, conn);
     }
     /* create if used < max connections */
     if (!info
-        && (imap_server->used_connections < imap_server->max_connections)) {
-        g_mutex_unlock(&imap_server->lock);
+        && imap_server->used_connections < imap_server->max_connections) {
+       g_mutex_unlock(&imap_server->lock);
         info = lb_imap_server_info_new(server);
         g_mutex_lock(&imap_server->lock);
         /* FIXME: after dropping and reacquiring the lock,
          * (imap_server->used_connections < imap_server->max_connections)
          * might no longer be true--do we care?
-           if (imap_server->used_connections >= imap_server->max_connections) {
+        if (imap_server->used_connections >= imap_server->max_connections) {
             lb_imap_server_info_free(info);
             g_mutex_unlock(&imap_server->lock);
             return NULL;
-           }
+        }
          */
     }
     if (info) {
-        if (imap_mbox_is_disconnected(info->handle)) {
+        if(imap_mbox_is_disconnected(info->handle)) {
             ImapResult rc;
 
-            rc = imap_mbox_handle_connect(info->handle, server->host,
-                                          REQ_SSL(server));
-            if (rc != IMAP_SUCCESS) {
+            rc=imap_mbox_handle_connect(info->handle, server->host,
+                                        REQ_SSL(server));
+            if(rc != IMAP_SUCCESS) {
                 handle_connection_error(rc, info, server, err);
                 g_mutex_unlock(&imap_server->lock);
                 return NULL;
@@ -755,7 +680,6 @@ libbalsa_imap_server_get_handle(LibBalsaImapServer *imap_server,
     return info ? info->handle : NULL;
 }
 
-
 /**
  * libbalsa_imap_server_get_handle_with_user:
  * @server: A #LibBalsaImapServer
@@ -770,31 +694,27 @@ libbalsa_imap_server_get_handle(LibBalsaImapServer *imap_server,
  * Return value: a handle to the server, or %NULL when there are no free
  * connections.
  **/
-ImapMboxHandle *
+ImapMboxHandle*
 libbalsa_imap_server_get_handle_with_user(LibBalsaImapServer *imap_server,
-                                          gpointer            user,
-                                          GError            **err)
+                                          gpointer user, GError **err)
 {
     LibBalsaServer *server = LIBBALSA_SERVER(imap_server);
     struct handle_info *info = NULL;
 
-    if (imap_server->offline_mode) {
+    if (imap_server->offline_mode)
         return NULL;
-    }
 
     g_mutex_lock(&imap_server->lock);
     /* look for free reusable connection */
     if (imap_server->free_handles) {
-        GList *conn = NULL;
-        if (user) {
+        GList *conn=NULL;
+        if (user)
             conn = g_list_find_custom(imap_server->free_handles, user,
                                       by_last_user);
-        }
-        if (!conn) {
+        if (!conn)
             conn = imap_server->free_handles;
-        }
         if (conn) {
-            info = (struct handle_info *)conn->data;
+            info = (struct handle_info*)conn->data;
             imap_server->free_handles =
                 g_list_delete_link(imap_server->free_handles, conn);
         }
@@ -803,32 +723,31 @@ libbalsa_imap_server_get_handle_with_user(LibBalsaImapServer *imap_server,
      * always leave one connection for actions without user, i.e.
      * those that do not SELECT any mailbox. */
     if (!info
-        && (imap_server->used_connections < imap_server->max_connections - 1)) {
-        g_mutex_unlock(&imap_server->lock);
+        && imap_server->used_connections < imap_server->max_connections-1) {
+       g_mutex_unlock(&imap_server->lock);
         info = lb_imap_server_info_new(server);
-        if (!info) {
+        if (!info)
             return NULL;
-        }
         g_mutex_lock(&imap_server->lock);
         /* FIXME: after dropping and reacquiring the lock,
          * (imap_server->used_connections < imap_server->max_connections)
          * might no longer be true--do we care?
-           if (imap_server->used_connections >= imap_server->max_connections) {
+        if (imap_server->used_connections >= imap_server->max_connections) {
             lb_imap_server_info_free(info);
             g_mutex_unlock(&imap_server->lock);
             return NULL;
-           }
+        }
          */
     }
     /* reuse a free connection */
     if (!info && imap_server->free_handles) {
         GList *conn;
         conn = imap_server->free_handles;
-        info = (struct handle_info *)conn->data;
+        info = (struct handle_info*)conn->data;
         imap_server->free_handles =
             g_list_delete_link(imap_server->free_handles, conn);
     }
-    if (!info) {
+    if(!info) {
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_TOOMANYOPEN_ERROR,
                     _("Exceeded the number of connections per server %s"),
@@ -840,9 +759,9 @@ libbalsa_imap_server_get_handle_with_user(LibBalsaImapServer *imap_server,
     if (imap_mbox_is_disconnected(info->handle)) {
         ImapResult rc;
 
-        rc = imap_mbox_handle_connect(info->handle, server->host,
-                                      REQ_SSL(server));
-        if (rc != IMAP_SUCCESS) {
+        rc=imap_mbox_handle_connect(info->handle, server->host,
+                                    REQ_SSL(server));
+        if(rc != IMAP_SUCCESS) {
             handle_connection_error(rc, info, server, err);
             g_mutex_unlock(&imap_server->lock);
             return NULL;
@@ -858,7 +777,6 @@ libbalsa_imap_server_get_handle_with_user(LibBalsaImapServer *imap_server,
     return info->handle;
 }
 
-
 /**
  * libbalsa_imap_server_release_handle:
  * @server: A #LibBalsaImapServer
@@ -866,38 +784,34 @@ libbalsa_imap_server_get_handle_with_user(LibBalsaImapServer *imap_server,
  *
  * Releases the @handle to the connection cache.
  **/
-void
-libbalsa_imap_server_release_handle(LibBalsaImapServer *imap_server,
-                                    ImapMboxHandle     *handle)
+void libbalsa_imap_server_release_handle(LibBalsaImapServer *imap_server,
+                                         ImapMboxHandle* handle)
 {
     struct handle_info *info = NULL;
 
-    if (!handle) {
+    if (!handle)
         return;
-    }
 
     g_mutex_lock(&imap_server->lock);
     /* remove from used list */
     if (imap_server->used_handles) {
         GList *conn;
         conn = g_list_find_custom(imap_server->used_handles, handle, by_handle);
-        info = (struct handle_info *)conn->data;
+        info = (struct handle_info*)conn->data;
         imap_server->used_handles =
             g_list_delete_link(imap_server->used_handles, conn);
         imap_server->used_connections--;
     }
     /* check max_connections */
-    if (imap_server->used_connections >= imap_server->max_connections) {
+    if (imap_server->used_connections >= imap_server->max_connections)
         lb_imap_server_info_free(info);
-    } else {
-        /* add to free list */
+    else
+    /* add to free list */
         imap_server->free_handles = g_list_append(imap_server->free_handles,
                                                   info);
-    }
     g_mutex_unlock(&imap_server->lock);
 }
 
-
 /**
  * libbalsa_imap_server_set_max_connections:
  * @server: A #LibBalsaImapServer
@@ -908,35 +822,30 @@ libbalsa_imap_server_release_handle(LibBalsaImapServer *imap_server,
  **/
 void
 libbalsa_imap_server_set_max_connections(LibBalsaImapServer *server,
-                                         int                 max)
+                                         int max)
 {
     server->max_connections = max;
     printf("set_max_connections: set to %d\n", max);
 }
 
-
 int
 libbalsa_imap_server_get_max_connections(LibBalsaImapServer *server)
 {
     return server->max_connections;
 }
 
-
 void
 libbalsa_imap_server_enable_persistent_cache(LibBalsaImapServer *server,
-                                             gboolean            enable)
+                                             gboolean enable)
 {
     server->persistent_cache = !!enable;
 }
-
-
 gboolean
 libbalsa_imap_server_has_persistent_cache(LibBalsaImapServer *srv)
 {
     return srv->persistent_cache;
 }
 
-
 /**
  * libbalsa_imap_server_force_disconnect:
  * @server: A #LibBalsaImapServer
@@ -954,16 +863,13 @@ libbalsa_imap_server_force_disconnect(LibBalsaImapServer *imap_server)
     g_mutex_unlock(&imap_server->lock);
 }
 
-
 /**
  * libbalsa_imap_server_close_all_connections:
  *
  * Forces a logout on all connections on all servers, used when cleaning up.
  **/
-static void
-close_all_connections_cb(gpointer key,
-                         gpointer value,
-                         gpointer user_data)
+static void close_all_connections_cb(gpointer key, gpointer value,
+                                     gpointer user_data)
 {
 #if 0
     libbalsa_imap_server_force_disconnect(LIBBALSA_IMAP_SERVER(value));
@@ -971,20 +877,16 @@ close_all_connections_cb(gpointer key,
     libbalsa_imap_server_set_offline_mode(LIBBALSA_IMAP_SERVER(value), TRUE);
 #endif
 }
-
-
 void
 libbalsa_imap_server_close_all_connections(void)
 {
-    g_mutex_lock(&imap_servers_lock);
-    if (imap_servers) {
+       g_mutex_lock(&imap_servers_lock);
+    if (imap_servers)
         g_hash_table_foreach(imap_servers, close_all_connections_cb, NULL);
-    }
     g_mutex_unlock(&imap_servers_lock);
     libbalsa_imap_purge_temp_dir(0);
 }
 
-
 /**
  * libbalsa_imap_server_has_free_handles:
  * @server: A #LibBalsaImapServer
@@ -994,8 +896,7 @@ libbalsa_imap_server_close_all_connections(void)
  *
  * Return value: is %TRUE when there are free connections.
  **/
-gboolean
-libbalsa_imap_server_has_free_handles(LibBalsaImapServer *imap_server)
+gboolean libbalsa_imap_server_has_free_handles(LibBalsaImapServer *imap_server)
 {
     gboolean result;
     g_mutex_lock(&imap_server->lock);
@@ -1005,7 +906,6 @@ libbalsa_imap_server_has_free_handles(LibBalsaImapServer *imap_server)
     return result;
 }
 
-
 /**
  * libbalsa_imap_server_is_offline:
  * @server: A #LibBalsaImapServer
@@ -1014,13 +914,11 @@ libbalsa_imap_server_has_free_handles(LibBalsaImapServer *imap_server)
  *
  * Return value: is %TRUE when this server is in offline mode.
  **/
-gboolean
-libbalsa_imap_server_is_offline(LibBalsaImapServer *server)
+gboolean libbalsa_imap_server_is_offline(LibBalsaImapServer *server)
 {
     return server->offline_mode;
 }
 
-
 /**
  * libbalsa_imap_server_set_offline_mode:
  * @server: A #LibBalsaImapServer
@@ -1029,52 +927,43 @@ libbalsa_imap_server_is_offline(LibBalsaImapServer *server)
  * When @offline is %TRUE switches @server to offline mode, and disconnects all
  * connections. When @offline is %FALSE, allow new connections.
  **/
-void
-libbalsa_imap_server_set_offline_mode(LibBalsaImapServer *server,
-                                      gboolean            offline)
+void libbalsa_imap_server_set_offline_mode(LibBalsaImapServer *server,
+                                           gboolean offline)
 {
     server->offline_mode = offline;
-    if (offline) {
+    if (offline)
         libbalsa_imap_server_force_disconnect(server);
-    }
 }
 
-
 void
-libbalsa_imap_server_set_bug(LibBalsaImapServer   *server,
-                             LibBalsaImapServerBug bug,
-                             gboolean              hasp)
+libbalsa_imap_server_set_bug(LibBalsaImapServer *server,
+                             LibBalsaImapServerBug bug, gboolean hasp)
 {
-    server->has_fetch_bug = !!hasp;
+    server->has_fetch_bug = !! hasp;
 }
 
-
 gboolean
-libbalsa_imap_server_has_bug(LibBalsaImapServer   *server,
+libbalsa_imap_server_has_bug(LibBalsaImapServer *server,
                              LibBalsaImapServerBug bug)
 {
     return server->has_fetch_bug;
 }
 
-
 void
-libbalsa_imap_server_set_use_status(LibBalsaImapServer *server,
-                                    gboolean            use_status)
+libbalsa_imap_server_set_use_status(LibBalsaImapServer *server, 
+                                    gboolean use_status)
 {
     server->use_status = !!use_status;
 }
-
-
 gboolean
 libbalsa_imap_server_get_use_status(LibBalsaImapServer *server)
 {
     return server->use_status;
 }
 
-
 void
-libbalsa_imap_server_set_use_idle(LibBalsaImapServer *server,
-                                  gboolean            use_idle)
+libbalsa_imap_server_set_use_idle(LibBalsaImapServer *server, 
+                                  gboolean use_idle)
 {
     GList *list;
 
@@ -1088,7 +977,6 @@ libbalsa_imap_server_set_use_idle(LibBalsaImapServer *server,
     }
 }
 
-
 gboolean
 libbalsa_imap_server_get_use_idle(LibBalsaImapServer *server)
 {
diff --git a/libbalsa/imap-server.h b/libbalsa/imap-server.h
index a2be3be..03e285d 100644
--- a/libbalsa/imap-server.h
+++ b/libbalsa/imap-server.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -36,52 +36,48 @@
     (G_TYPE_CHECK_CLASS_TYPE(klass, LIBBALSA_TYPE_IMAP_SERVER))
 
 GType libbalsa_imap_server_get_type(void);
-
 typedef struct LibBalsaImapServer_ LibBalsaImapServer;
 
-LibBalsaImapServer *libbalsa_imap_server_new(const gchar *username,
+LibBalsaImapServer* libbalsa_imap_server_new(const gchar *username,
                                              const gchar *host);
-LibBalsaImapServer *libbalsa_imap_server_new_from_config(void);
+LibBalsaImapServer* libbalsa_imap_server_new_from_config(void);
 void libbalsa_imap_server_save_config(LibBalsaImapServer *server);
-struct _ImapMboxHandle *libbalsa_imap_server_get_handle
-    (LibBalsaImapServer *server,
-    GError             **err);
-struct _ImapMboxHandle *libbalsa_imap_server_get_handle_with_user
-    (LibBalsaImapServer *imap_server,
-    gpointer             user,
-    GError             **err);
-void libbalsa_imap_server_release_handle(LibBalsaImapServer     *server,
-                                         struct _ImapMboxHandle *handle);
+struct _ImapMboxHandle* libbalsa_imap_server_get_handle
+                          (LibBalsaImapServer *server, GError **err);
+struct _ImapMboxHandle* libbalsa_imap_server_get_handle_with_user
+                          (LibBalsaImapServer *imap_server,
+                           gpointer user, GError **err);
+void libbalsa_imap_server_release_handle(LibBalsaImapServer *server,
+                                         struct _ImapMboxHandle* handle);
 void libbalsa_imap_server_set_max_connections(LibBalsaImapServer *server,
-                                              int                 max);
+                                              int max);
 int  libbalsa_imap_server_get_max_connections(LibBalsaImapServer *server);
 void libbalsa_imap_server_enable_persistent_cache(LibBalsaImapServer *server,
-                                                  gboolean            enable);
+                                                  gboolean enable);
 gboolean libbalsa_imap_server_has_persistent_cache(LibBalsaImapServer *srv);
 void libbalsa_imap_server_force_disconnect(LibBalsaImapServer *server);
 void libbalsa_imap_server_close_all_connections(void);
 gboolean libbalsa_imap_server_has_free_handles(LibBalsaImapServer *server);
 gboolean libbalsa_imap_server_is_offline(LibBalsaImapServer *server);
 void libbalsa_imap_server_set_offline_mode(LibBalsaImapServer *server,
-                                           gboolean            offline);
+                                           gboolean offline);
 
 typedef enum {
     ISBUG_FETCH /* Some servers cannot fetch message parts properly
                  * we will fetch entire messages instead. */
 } LibBalsaImapServerBug;
 
-void libbalsa_imap_server_set_bug(LibBalsaImapServer   *server,
-                                  LibBalsaImapServerBug bug,
-                                  gboolean              hasp);
+void libbalsa_imap_server_set_bug(LibBalsaImapServer *server,
+                                  LibBalsaImapServerBug bug, gboolean hasp);
 
-gboolean libbalsa_imap_server_has_bug(LibBalsaImapServer   *server,
+gboolean libbalsa_imap_server_has_bug(LibBalsaImapServer *server,
                                       LibBalsaImapServerBug bug);
 void libbalsa_imap_server_set_use_status(LibBalsaImapServer *server,
-                                         gboolean            use_status);
+                                         gboolean use_status);
 gboolean libbalsa_imap_server_get_use_status(LibBalsaImapServer *server);
 
 void libbalsa_imap_server_set_use_idle(LibBalsaImapServer *server,
-                                       gboolean            use_idle);
+                                       gboolean use_idle);
 gboolean libbalsa_imap_server_get_use_idle(LibBalsaImapServer *server);
 
 extern gint ImapDebug;
diff --git a/libbalsa/information.c b/libbalsa/information.c
index 3544ffd..52d1c25 100644
--- a/libbalsa/information.c
+++ b/libbalsa/information.c
@@ -6,27 +6,27 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "information.h"
 #include "libbalsa.h"
 
 #ifdef HAVE_NOTIFY
-#   include <libnotify/notify.h>
-#   include <gtk/gtk.h>
+#include <libnotify/notify.h>
+#include <gtk/gtk.h>
 #endif
 #include <string.h>
 
@@ -36,17 +36,16 @@ struct information_data {
     gchar *msg;
 };
 
-static gboolean libbalsa_information_idle_handler(struct information_data *);
+static gboolean libbalsa_information_idle_handler(struct information_data*);
 
 LibBalsaInformationFunc libbalsa_real_information_func;
 
 #ifdef HAVE_NOTIFY
-static void lbi_notification_closed_cb(NotifyNotification *note,
-                                       gpointer            data);
+static void lbi_notification_closed_cb(NotifyNotification * note,
+                                       gpointer data);
 
 static void
-lbi_notification_parent_weak_notify(gpointer data,
-                                    GObject *parent)
+lbi_notification_parent_weak_notify(gpointer data, GObject * parent)
 {
     NotifyNotification *note = NOTIFY_NOTIFICATION(data);
     g_signal_handlers_disconnect_by_func(note, lbi_notification_closed_cb,
@@ -55,17 +54,13 @@ lbi_notification_parent_weak_notify(gpointer data,
     g_object_unref(note);
 }
 
-
 static void
-lbi_notification_closed_cb(NotifyNotification *note,
-                           gpointer            data)
+lbi_notification_closed_cb(NotifyNotification * note, gpointer data)
 {
     GObject *parent = G_OBJECT(data);
     g_object_weak_unref(parent, lbi_notification_parent_weak_notify, note);
     g_object_unref(note);
 }
-
-
 #endif
 
 /*
@@ -79,10 +74,8 @@ lbi_notification_closed_cb(NotifyNotification *note,
  *
  */
 void
-libbalsa_information_varg(GtkWindow              *parent,
-                          LibBalsaInformationType type,
-                          const char             *fmt,
-                          va_list                 ap)
+libbalsa_information_varg(GtkWindow *parent, LibBalsaInformationType type,
+                          const char *fmt, va_list ap)
 {
     struct information_data *data;
 
@@ -100,15 +93,12 @@ libbalsa_information_varg(GtkWindow              *parent,
         case LIBBALSA_INFORMATION_MESSAGE:
             icon_str = "dialog-information";
             break;
-
         case LIBBALSA_INFORMATION_WARNING:
             icon_str = "dialog-warning";
             break;
-
         case LIBBALSA_INFORMATION_ERROR:
             icon_str = "dialog-error";
             break;
-
         default:
             icon_str = NULL;
             break;
@@ -120,32 +110,24 @@ libbalsa_information_varg(GtkWindow              *parent,
         for (p = msg; (q = strpbrk(p, "<>&\"")) != NULL; p = ++q) {
             g_string_append_len(escaped, p, q - p);
             switch (*q) {
-            case '<': g_string_append(escaped, "&lt;");
-                break;
-
-            case '>': g_string_append(escaped, "&gt;");
-                break;
-
-            case '&': g_string_append(escaped, "&amp;");
-                break;
-
-            case '"': g_string_append(escaped, "&quot;");
-                break;
-
-            default: break;
+                case '<': g_string_append(escaped, "&lt;");   break;
+                case '>': g_string_append(escaped, "&gt;");   break;
+                case '&': g_string_append(escaped, "&amp;");  break;
+                case '"': g_string_append(escaped, "&quot;"); break;
+                default: break;
             }
         }
         g_string_append(escaped, p);
         g_free(msg);
 
-#   if HAVE_NOTIFY >= 7
+#if HAVE_NOTIFY >= 7
         note = notify_notification_new("Balsa", escaped->str, icon_str);
         notify_notification_set_hint(note, "desktop-entry",
                                      g_variant_new_string("balsa"));
-#   else
+#else
         /* prior to 0.7.0 */
         note = notify_notification_new("Balsa", escaped->str, icon_str, NULL);
-#   endif
+#endif
 
         g_string_free(escaped, TRUE);
 
@@ -158,9 +140,8 @@ libbalsa_information_varg(GtkWindow              *parent,
             g_signal_connect(note, "closed",
                              G_CALLBACK(lbi_notification_closed_cb),
                              parent);
-        } else {
+        } else
             g_object_unref(note);
-        }
         return;
     }
     /* Fall through to the ordinary notification scheme */
@@ -171,40 +152,32 @@ libbalsa_information_varg(GtkWindow              *parent,
 
     /* We format the string here. It must be free()d in the idle
      * handler We parse the args here because by the time the idle
-     * function runs we will no longer be in this stack frame.
+     * function runs we will no longer be in this stack frame. 
      */
     data->msg = g_strdup_vprintf(fmt, ap);
-    if (parent) {
+    if (parent)
         g_object_add_weak_pointer(G_OBJECT(parent),
                                   (gpointer) & data->parent);
-    }
     g_idle_add((GSourceFunc) libbalsa_information_idle_handler, data);
 }
 
-
 void
 libbalsa_information(LibBalsaInformationType type,
-                     const char             *fmt,
-                     ...)
+                     const char *fmt, ...)
 {
     va_list va_args;
 
 #ifndef DEBUG
-    if (type == LIBBALSA_INFORMATION_DEBUG) {
-        return;
-    }
+    if (type == LIBBALSA_INFORMATION_DEBUG) return;
 #endif
     va_start(va_args, fmt);
     libbalsa_information_varg(NULL, type, fmt, va_args);
     va_end(va_args);
 }
 
-
 void
-libbalsa_information_parented(GtkWindow              *parent,
-                              LibBalsaInformationType type,
-                              const char             *fmt,
-                              ...)
+libbalsa_information_parented(GtkWindow *parent, LibBalsaInformationType type,
+                              const char *fmt, ...)
 {
     va_list va_args;
 
@@ -213,9 +186,8 @@ libbalsa_information_parented(GtkWindow              *parent,
     va_end(va_args);
 }
 
-
 /*
- * This is an idle handler, so we need to grab the GDK lock
+ * This is an idle handler, so we need to grab the GDK lock 
  */
 static gboolean
 libbalsa_information_idle_handler(struct information_data *data)
@@ -224,10 +196,9 @@ libbalsa_information_idle_handler(struct information_data *data)
                                    data->message_type,
                                    data->msg);
 
-    if (data->parent) {
-        g_object_remove_weak_pointer(G_OBJECT(data->parent),
-                                     (gpointer) & data->parent);
-    }
+    if(data->parent)
+        g_object_remove_weak_pointer(G_OBJECT(data->parent), 
+                                     (gpointer) &data->parent);
     g_free(data->msg);
     g_free(data);
     return FALSE;
diff --git a/libbalsa/information.h b/libbalsa/information.h
index 163813c..68ad779 100644
--- a/libbalsa/information.h
+++ b/libbalsa/information.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -34,25 +34,22 @@ enum _LibBalsaInformationType {
 
 typedef enum _LibBalsaInformationType LibBalsaInformationType;
 
-typedef void (*LibBalsaInformationFunc) (GtkWindow              *parent,
+typedef void (*LibBalsaInformationFunc) (GtkWindow *parent, 
                                          LibBalsaInformationType message_type,
-                                         const gchar            *fmt);
+                                         const gchar * fmt);
 
 
 extern LibBalsaInformationFunc libbalsa_real_information_func;
 
 void libbalsa_information(LibBalsaInformationType type,
-                          const char             *fmt,
-                          ...)
-G_GNUC_PRINTF(2, 3);
-void libbalsa_information_parented(GtkWindow              *parent,
+                          const char *fmt, ...)
+       G_GNUC_PRINTF(2, 3);
+void libbalsa_information_parented(GtkWindow *parent,
                                    LibBalsaInformationType type,
-                                   const char             *fmt,
-                                   ...)
-G_GNUC_PRINTF(3, 4);
-void libbalsa_information_varg(GtkWindow              *parent,
+                                   const char *fmt, ...)
+       G_GNUC_PRINTF(3, 4);
+void libbalsa_information_varg(GtkWindow *parent,
                                LibBalsaInformationType type,
-                               const char             *fmt,
-                               va_list                 ap);
+                               const char *fmt, va_list ap);
 
 #endif
diff --git a/libbalsa/libbalsa-conf.c b/libbalsa/libbalsa-conf.c
index 613e26d..821443f 100644
--- a/libbalsa/libbalsa-conf.c
+++ b/libbalsa/libbalsa-conf.c
@@ -6,20 +6,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "libbalsa-conf.h"
 
@@ -56,7 +56,7 @@ static GSList *lbc_groups;
     ((priv) ? ++lbc_conf_priv.changes : ++lbc_conf.changes)
 
 static gchar *
-lbc_readfile(const gchar *filename)
+lbc_readfile(const gchar * filename)
 {
     gchar *buf;
     gchar **split;
@@ -76,41 +76,35 @@ lbc_readfile(const gchar *filename)
     return buf;
 }
 
-
 static void
-lbc_init(LibBalsaConf *conf,
-         const gchar  *filename,
-         const gchar  *old_dir,
-         gboolean private)
+lbc_init(LibBalsaConf * conf, const gchar * filename,
+         const gchar * old_dir, gboolean private)
 {
     struct stat buf;
     GError *error = NULL;
     gint rc;
 
     conf->private = private;
-    if (!conf->path) {
+    if (!conf->path)
         conf->path =
             g_build_filename(g_get_home_dir(), ".balsa", filename, NULL);
-    }
     rc = stat(conf->path, &buf);
     if (conf->key_file) {
-        if ((rc >= 0) && (buf.st_mtime <= conf->mtime)) {
+        if (rc >= 0 && buf.st_mtime <= conf->mtime)
             /* found the config file, and it hasn't been touched since
              * we loaded it */
             return;
-        }
     } else {
         conf->key_file = g_key_file_new();
-        if (rc < 0) {
+        if (rc < 0)
             /* no config file--must be first time startup */
             return;
-        }
     }
     conf->mtime = buf.st_mtime;
 
     libbalsa_assure_balsa_dir();
     if (!g_key_file_load_from_file
-            (conf->key_file, conf->path, G_KEY_FILE_NONE, &error)) {
+        (conf->key_file, conf->path, G_KEY_FILE_NONE, &error)) {
         gchar *old_path;
         gchar *key_file_text;
         static gboolean warn = TRUE;
@@ -134,7 +128,7 @@ lbc_init(LibBalsaConf *conf,
              * revert to the default ';'. */
             g_key_file_set_list_separator(conf->key_file, ';');
         }
-        if ((key_file_text == NULL) || (error != NULL)) {
+        if (key_file_text == NULL || error != NULL) {
 #if DEBUG
             g_message("Could not load key file from file “%s”: %s",
                       old_path,
@@ -144,16 +138,14 @@ lbc_init(LibBalsaConf *conf,
             warn = FALSE;
         }
         g_free(old_path);
-        if (warn) {
+        if (warn)
             libbalsa_information(LIBBALSA_INFORMATION_WARNING,
                                  _("Your Balsa configuration "
                                    "is now stored in "
                                    "“~/.balsa/config”."));
-        }
     }
 }
 
-
 static GRecMutex lbc_mutex;
 
 static void
@@ -169,27 +161,24 @@ lbc_lock(void)
     }
 }
 
-
 static void
 lbc_unlock(void)
 {
     g_rec_mutex_unlock(&lbc_mutex);
 }
 
-
-/*
+/* 
  * Call @func for each group that begins with @prefix.
  * @func is called with arguments:
  *   const gchar * @key                the group;
  *   const gchar * @value      the trailing part of the group name,
- *                              following the @prefix;
+ *                             following the @prefix;
  *   gpointer @data            the @data passed in.
  * Iteration terminates when @func returns TRUE.
  */
 void
-libbalsa_conf_foreach_group(const gchar            *prefix,
-                            LibBalsaConfForeachFunc func,
-                            gpointer                data)
+libbalsa_conf_foreach_group(const gchar * prefix,
+                            LibBalsaConfForeachFunc func, gpointer data)
 {
     gchar **groups, **group;
     gsize pref_len = strlen(prefix);
@@ -199,50 +188,45 @@ libbalsa_conf_foreach_group(const gchar            *prefix,
     groups = g_key_file_get_groups(lbc_conf.key_file, NULL);
     for (group = groups; *group; group++) {
         if (g_str_has_prefix(*group, prefix)
-            && func(*group, *group + pref_len, data)) {
+            && func(*group, *group + pref_len, data))
             break;
-        }
     }
     g_strfreev(groups);
 
     lbc_unlock();
 }
 
-
 void
-libbalsa_conf_foreach_keys(const gchar            *group,
-                           LibBalsaConfForeachFunc func,
-                           gpointer                data)
+libbalsa_conf_foreach_keys(const gchar * group,
+                          LibBalsaConfForeachFunc func, gpointer data)
 {
     gchar **keys, **key;
 
     lbc_lock();
 
     if ((keys = g_key_file_get_keys(lbc_conf.key_file, group, NULL, NULL))) {
-        for (key = keys; *key; key++) {
-            gchar *val = g_key_file_get_value(lbc_conf.key_file, group, *key, NULL);
-            if (func(*key, val, data)) {
-                g_free(val);
-                break;
-            }
-            g_free(val);
-        }
-        g_strfreev(keys);
+       for (key = keys; *key; key++) {
+           gchar * val = g_key_file_get_value(lbc_conf.key_file, group, *key, NULL);
+           if (func(*key, val, data)) {
+               g_free(val);
+               break;
+           }
+           g_free(val);
+       }
+       g_strfreev(keys);
     }
 
     lbc_unlock();
 }
 
-
 void
-libbalsa_conf_push_group(const gchar *group)
+libbalsa_conf_push_group(const gchar * group)
 {
 
     lbc_lock();                 /* Will be held until prefix is popped. */
     lbc_groups = g_slist_prepend(lbc_groups, g_strdup(group));
 }
 
-
 void
 libbalsa_conf_pop_group(void)
 {
@@ -251,10 +235,8 @@ libbalsa_conf_pop_group(void)
     lbc_unlock();               /* Held since prefix was pushed. */
 }
 
-
 void
-libbalsa_conf_remove_group_(const char *group,
-                            gboolean    priv)
+libbalsa_conf_remove_group_(const char *group, gboolean priv)
 {
     lbc_lock();
     g_key_file_remove_group(LBC_KEY_FILE(priv), group, NULL);
@@ -262,7 +244,6 @@ libbalsa_conf_remove_group_(const char *group,
     lbc_unlock();
 }
 
-
 gboolean
 libbalsa_conf_has_group(const char *group)
 {
@@ -270,33 +251,28 @@ libbalsa_conf_has_group(const char *group)
             g_key_file_has_group(lbc_conf_priv.key_file, group));
 }
 
-
 gboolean
-libbalsa_conf_has_key(const gchar *key)
+libbalsa_conf_has_key(const gchar * key)
 {
     /* g_key_file_has_key returns FALSE on error, but that is OK */
     return (g_key_file_has_key(lbc_conf.key_file, lbc_groups->data,
                                key, NULL) ||
             g_key_file_has_key(lbc_conf_priv.key_file, lbc_groups->data,
-                               key, NULL));
+                                  key, NULL));
 }
 
-
 static void
-lbc_remove_key(LibBalsaConf *conf,
-               const char   *key)
+lbc_remove_key(LibBalsaConf * conf, const char *key)
 {
     GError *error = NULL;
 
     g_key_file_remove_key(conf->key_file, lbc_groups->data, key, &error);
-    if (error) {
+    if (error)
         g_error_free(error);
-    } else {
+    else
         ++conf->changes;
-    }
 }
 
-
 void
 libbalsa_conf_clean_key(const char *key)
 {
@@ -306,39 +282,31 @@ libbalsa_conf_clean_key(const char *key)
     lbc_unlock();
 }
 
-
 void
-libbalsa_conf_set_bool_(const char *path,
-                        gboolean    value,
-                        gboolean    priv)
+libbalsa_conf_set_bool_(const char *path, gboolean value, gboolean priv)
 {
     g_key_file_set_boolean(LBC_KEY_FILE(priv), lbc_groups->data, path,
                            value);
     LBC_CHANGED(priv);
 }
 
-
 static gchar *
-lbc_get_key(const char  *path,
-            const char **defval)
+lbc_get_key(const char *path, const char **defval)
 {
     const gchar *equals;
     gchar *key;
 
     equals = strchr(path, '=');
     key = equals ? g_strndup(path, equals - path) : g_strdup(path);
-    if (defval) {
+    if (defval)
         *defval = equals ? ++equals : NULL;
-    }
 
     return key;
 }
 
-
 gboolean
-libbalsa_conf_get_bool_with_default_(const char *path,
-                                     gboolean   *def,
-                                     gboolean    priv)
+libbalsa_conf_get_bool_with_default_(const char *path, gboolean * def,
+                                     gboolean priv)
 {
     gchar *key;
     const gchar *defval;
@@ -355,18 +323,15 @@ libbalsa_conf_get_bool_with_default_(const char *path,
         retval = g_strcmp0(defval, "true") == 0;
     }
 
-    if (def) {
+    if (def)
         *def = error != NULL;
-    }
 
     return retval;
 }
 
-
 gint
 libbalsa_conf_get_int_with_default_(const char *path,
-                                    gboolean   *def,
-                                    gboolean    priv)
+                                    gboolean * def, gboolean priv)
 {
     gchar *key;
     const gchar *defval;
@@ -380,23 +345,19 @@ libbalsa_conf_get_int_with_default_(const char *path,
     g_free(key);
     if (error) {
         g_error_free(error);
-        if (defval) {
+        if (defval)
             retval = g_ascii_strtoull(defval, NULL, 10);
-        }
     }
 
-    if (def) {
+    if (def)
         *def = error != NULL;
-    }
 
     return retval;
 }
 
-
 gdouble
 libbalsa_conf_get_double_with_default_(const char *path,
-                                       gboolean   *def,
-                                       gboolean    priv)
+                                      gboolean * def, gboolean priv)
 {
     gchar *key;
     const gchar *defval;
@@ -406,60 +367,48 @@ libbalsa_conf_get_double_with_default_(const char *path,
     key = lbc_get_key(path, &defval);
     retval =
         g_key_file_get_double(LBC_KEY_FILE(priv), lbc_groups->data, key,
-                              &error);
+                             &error);
     g_free(key);
     if (error) {
         g_error_free(error);
-        if (defval) {
+        if (defval)
             retval = g_ascii_strtod(defval, NULL);
-        }
     }
 
-    if (def) {
+    if (def)
         *def = error != NULL;
-    }
 
     return retval;
 }
 
-
 void
-libbalsa_conf_set_int_(const char *path,
-                       int         value,
-                       gboolean    priv)
+libbalsa_conf_set_int_(const char *path, int value, gboolean priv)
 {
     g_key_file_set_integer(LBC_KEY_FILE(priv), lbc_groups->data, path,
                            value);
     LBC_CHANGED(priv);
 }
 
-
 void
-libbalsa_conf_set_double_(const char *path,
-                          double      value,
-                          gboolean    priv)
+libbalsa_conf_set_double_(const char *path, double value, gboolean priv)
 {
     g_key_file_set_double(LBC_KEY_FILE(priv), lbc_groups->data, path,
-                          value);
+                         value);
     LBC_CHANGED(priv);
 }
 
-
 void
-libbalsa_conf_set_string_(const char *path,
-                          const char *value,
-                          gboolean    priv)
+libbalsa_conf_set_string_(const char *path, const char *value,
+                          gboolean priv)
 {
     g_key_file_set_string(LBC_KEY_FILE(priv), lbc_groups->data, path,
                           value ? value : "");
     LBC_CHANGED(priv);
 }
 
-
 gchar *
-libbalsa_conf_get_string_with_default_(const char *path,
-                                       gboolean   *def,
-                                       gboolean    priv)
+libbalsa_conf_get_string_with_default_(const char *path, gboolean * def,
+                                       gboolean priv)
 {
     gchar *key;
     const gchar *defval;
@@ -476,17 +425,14 @@ libbalsa_conf_get_string_with_default_(const char *path,
         retval = g_strdup(defval);
     }
 
-    if (def) {
+    if (def)
         *def = error != NULL;
-    }
 
     return retval;
 }
 
-
 void
-libbalsa_conf_set_vector(const char       *path,
-                         int               argc,
+libbalsa_conf_set_vector(const char *path, int argc,
                          const char *const argv[])
 {
     g_key_file_set_string_list(lbc_conf.key_file, lbc_groups->data, path,
@@ -494,12 +440,9 @@ libbalsa_conf_set_vector(const char       *path,
     ++lbc_conf.changes;
 }
 
-
 void
-libbalsa_conf_get_vector_with_default(const char *path,
-                                      gint       *argcp,
-                                      char     ***argvp,
-                                      gboolean   *def)
+libbalsa_conf_get_vector_with_default(const char *path, gint * argcp,
+                                      char ***argvp, gboolean * def)
 {
     GError *error = NULL;
     gsize len;
@@ -508,18 +451,15 @@ libbalsa_conf_get_vector_with_default(const char *path,
         g_key_file_get_string_list(lbc_conf.key_file, lbc_groups->data,
                                    path, &len, &error);
     *argcp = len;
-    if (error) {
+    if (error)
         g_error_free(error);
-    }
 
-    if (def) {
+    if (def)
         *def = error != NULL;
-    }
 }
 
-
 static void
-lbc_drop_all(LibBalsaConf *conf)
+lbc_drop_all(LibBalsaConf * conf)
 {
     g_key_file_free(conf->key_file);
     conf->key_file = NULL;
@@ -528,7 +468,6 @@ lbc_drop_all(LibBalsaConf *conf)
     conf->changes = 0;
 }
 
-
 void
 libbalsa_conf_drop_all(void)
 {
@@ -538,17 +477,15 @@ libbalsa_conf_drop_all(void)
     lbc_unlock();
 }
 
-
 static void
-lbc_sync(LibBalsaConf *conf)
+lbc_sync(LibBalsaConf * conf)
 {
     gchar *buf;
     gsize len;
     GError *error = NULL;
 
-    if (!conf->changes) {
+    if (!conf->changes)
         return;
-    }
 
     buf = g_key_file_to_data(conf->key_file, &len, &error);
     if (error) {
@@ -571,8 +508,8 @@ lbc_sync(LibBalsaConf *conf)
             g_error_free(error);
 #if DEBUG
         } else {
-            g_message("Failed to rewrite config file “%s”;"
-                      " changes not saved", conf->path);
+                g_message("Failed to rewrite config file “%s”;"
+                          " changes not saved", conf->path);
 #endif                          /* DEBUG */
         }
     } else if (conf->private) {
@@ -582,7 +519,6 @@ lbc_sync(LibBalsaConf *conf)
     g_free(buf);
 }
 
-
 static guint lbc_sync_idle_id;
 G_LOCK_DEFINE_STATIC(lbc_sync_idle_id);
 
@@ -601,7 +537,6 @@ libbalsa_conf_sync(void)
     lbc_unlock();
 }
 
-
 static gboolean
 libbalsa_conf_sync_idle_cb(gpointer data)
 {
@@ -610,7 +545,6 @@ libbalsa_conf_sync_idle_cb(gpointer data)
     return FALSE;
 }
 
-
 void
 libbalsa_conf_queue_sync(void)
 {
@@ -618,10 +552,9 @@ libbalsa_conf_queue_sync(void)
 #if DEBUG
     g_print("%s id %d, will be set if zero\n", __func__, lbc_sync_idle_id);
 #endif                          /* DEBUG */
-    if (!lbc_sync_idle_id) {
+    if (!lbc_sync_idle_id)
         lbc_sync_idle_id =
             g_idle_add((GSourceFunc) libbalsa_conf_sync_idle_cb, NULL);
-    }
 #if DEBUG
     g_print("%s id now %d\n", __func__, lbc_sync_idle_id);
 #endif                          /* DEBUG */
diff --git a/libbalsa/libbalsa-conf.h b/libbalsa/libbalsa-conf.h
index 6f48eaf..e566ca2 100644
--- a/libbalsa/libbalsa-conf.h
+++ b/libbalsa/libbalsa-conf.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -24,111 +24,101 @@
 #include <gtk/gtk.h>
 
 void libbalsa_conf_push_group(const char *group);
-void libbalsa_conf_remove_group_(const char *group,
-                                 gboolean    priv);
-
+void libbalsa_conf_remove_group_(const char *group, gboolean priv);
 #define libbalsa_conf_remove_group(group) \
-    (libbalsa_conf_remove_group_((group), FALSE))
+        (libbalsa_conf_remove_group_((group),FALSE))
 #define libbalsa_conf_private_remove_group(group) \
-    (libbalsa_conf_remove_group_((group), TRUE))
+        (libbalsa_conf_remove_group_((group),TRUE))
 
 gboolean libbalsa_conf_has_group(const char *group);
 gboolean libbalsa_conf_has_key(const gchar *key);
 
 /* Wrapper for iterating over groups. */
-typedef gboolean (*LibBalsaConfForeachFunc)(const gchar *key,
-                                            const gchar *value,
-                                            gpointer     data);
-void libbalsa_conf_foreach_group(const gchar            *prefix,
+typedef gboolean (*LibBalsaConfForeachFunc)(const gchar * key,
+                                            const gchar * value,
+                                            gpointer data);
+void libbalsa_conf_foreach_group(const gchar * prefix,
                                  LibBalsaConfForeachFunc func,
-                                 gpointer                data);
-
-void libbalsa_conf_foreach_keys(const gchar            *group,
-                                LibBalsaConfForeachFunc func,
-                                gpointer                data);
+                                 gpointer data);
 
-void libbalsa_conf_pop_group(void);
-void libbalsa_conf_clean_key(const char *key);
+void libbalsa_conf_foreach_keys              (const gchar * group,
+                                             LibBalsaConfForeachFunc func,
+                                             gpointer data);
 
-void libbalsa_conf_set_bool_(const char *path,
-                             gboolean    value,
-                             gboolean    priv);
+void libbalsa_conf_pop_group                 (void);
+void libbalsa_conf_clean_key                 (const char *key);
 
-#define libbalsa_conf_set_bool(path, new_value) \
-    (libbalsa_conf_set_bool_((path), (new_value), FALSE))
+void libbalsa_conf_set_bool_                 (const char *path,
+                                             gboolean value,
+                                              gboolean priv);
+#define libbalsa_conf_set_bool(path,new_value) \
+        (libbalsa_conf_set_bool_((path),(new_value),FALSE))
 
 gboolean libbalsa_conf_get_bool_with_default_(const char *path,
-                                              gboolean   *def,
-                                              gboolean    priv);
-
-#define libbalsa_conf_get_bool_with_default(path, def) \
-    (libbalsa_conf_get_bool_with_default_((path), (def), FALSE))
+                                              gboolean * def,
+                                              gboolean priv);
+#define libbalsa_conf_get_bool_with_default(path,def) \
+        (libbalsa_conf_get_bool_with_default_((path),(def),FALSE))
 #define libbalsa_conf_get_bool(path) \
-    (libbalsa_conf_get_bool_with_default_ ((path), NULL, FALSE))
-
-gint libbalsa_conf_get_int_with_default_(const char *path,
-                                         gboolean   *def,
-                                         gboolean    priv);
+        (libbalsa_conf_get_bool_with_default_ ((path), NULL, FALSE))
 
+gint libbalsa_conf_get_int_with_default_     (const char *path,
+                                             gboolean * def,
+                                              gboolean priv);
 #define libbalsa_conf_get_int(path) \
-    (libbalsa_conf_get_int_with_default_ ((path), NULL, FALSE))
+        (libbalsa_conf_get_int_with_default_ ((path), NULL, FALSE))
 #define libbalsa_conf_get_int_with_default(path, def) \
-    (libbalsa_conf_get_int_with_default_ ((path), (def), FALSE))
-
-gdouble libbalsa_conf_get_double_with_default_(const char *path,
-                                               gboolean   *def,
-                                               gboolean    priv);
+        (libbalsa_conf_get_int_with_default_ ((path), (def), FALSE))
 
+gdouble libbalsa_conf_get_double_with_default_ (const char *path,
+                                             gboolean * def,
+                                              gboolean priv);
 #define libbalsa_conf_get_double(path) \
-    (libbalsa_conf_get_double_with_default_ ((path), NULL, FALSE))
+        (libbalsa_conf_get_double_with_default_ ((path), NULL, FALSE))
 #define libbalsa_conf_get_double_with_default(path, def) \
-    (libbalsa_conf_get_double_with_default_ ((path), (def), FALSE))
-
-void libbalsa_conf_set_int_(const char *path,
-                            int         value,
-                            gboolean    priv);
-
-#define libbalsa_conf_set_int(path, new_value) \
-    (libbalsa_conf_set_int_((path), (new_value), FALSE))
-
-void libbalsa_conf_set_double_(const char *path,
-                               double      value,
-                               gboolean    priv);
-
-#define libbalsa_conf_set_double(path, new_value) \
-    (libbalsa_conf_set_double_((path), (new_value), FALSE))
-
-void libbalsa_conf_set_string_(const char *path,
-                               const char *value,
-                               gboolean    priv);
-
-#define libbalsa_conf_set_string(path, new_value) \
-    (libbalsa_conf_set_string_((path), (new_value), FALSE))
-#define libbalsa_conf_private_set_string(path, new_value) \
-    (libbalsa_conf_set_string_((path), (new_value), TRUE))
-
-char *libbalsa_conf_get_string_with_default_(const char *path,
-                                             gboolean   *def,
-                                             gboolean    priv);
-
+        (libbalsa_conf_get_double_with_default_ ((path), (def), FALSE))
+
+void libbalsa_conf_set_int_                  (const char *path,
+                                             int value,
+                                             gboolean priv);
+#define libbalsa_conf_set_int(path,new_value) \
+        (libbalsa_conf_set_int_((path),(new_value),FALSE))
+
+void libbalsa_conf_set_double_               (const char *path,
+                                             double value,
+                                             gboolean priv);
+#define libbalsa_conf_set_double(path,new_value) \
+        (libbalsa_conf_set_double_((path),(new_value),FALSE))
+
+void libbalsa_conf_set_string_               (const char *path,
+                                             const char *value,
+                                              gboolean priv);
+#define libbalsa_conf_set_string(path,new_value) \
+        (libbalsa_conf_set_string_((path),(new_value),FALSE))
+#define libbalsa_conf_private_set_string(path,new_value) \
+        (libbalsa_conf_set_string_((path),(new_value),TRUE))
+
+char *libbalsa_conf_get_string_with_default_ (const char *path,
+                                              gboolean * def,
+                                              gboolean priv);
 #define libbalsa_conf_get_string(path) \
-    (libbalsa_conf_get_string_with_default_((path), NULL, FALSE))
+        (libbalsa_conf_get_string_with_default_((path),NULL, FALSE))
 #define libbalsa_conf_get_string_with_default(path, def) \
-    (libbalsa_conf_get_string_with_default_((path), (def), FALSE))
+        (libbalsa_conf_get_string_with_default_((path),(def), FALSE))
 #define libbalsa_conf_private_get_string(path) \
-    (libbalsa_conf_get_string_with_default_((path), NULL, TRUE))
+        (libbalsa_conf_get_string_with_default_((path),NULL, TRUE))
 
-void libbalsa_conf_set_vector(const char       *path,
-                              int               argc,
-                              const char *const argv[]);
+void libbalsa_conf_set_vector                (const char *path,
+                                             int argc,
+                                              const char *const argv[]);
 
-void libbalsa_conf_get_vector_with_default(const char *path,
-                                           gint       *argcp,
-                                           char     ***argvp,
-                                           gboolean   *def);
+void libbalsa_conf_get_vector_with_default   (const char *path,
+                                              gint * argcp,
+                                              char ***argvp,
+                                              gboolean * def);
 
-void libbalsa_conf_drop_all(void);
-void libbalsa_conf_sync(void);
-void libbalsa_conf_queue_sync(void);
+void libbalsa_conf_drop_all                  (void);
+void libbalsa_conf_sync                      (void);
+void libbalsa_conf_queue_sync                (void);
 
 #endif                          /* __LIBCONFIG_H__ */
diff --git a/libbalsa/libbalsa-gpgme-cb.c b/libbalsa/libbalsa-gpgme-cb.c
index 4d58e05..83f416c 100644
--- a/libbalsa/libbalsa-gpgme-cb.c
+++ b/libbalsa/libbalsa-gpgme-cb.c
@@ -19,15 +19,15 @@
 
 
 #ifdef HAVE_CONFIG_H
-#   include <config.h>
+#include <config.h>
 #endif
 
 #ifdef HAVE_LOCALE_H
-#   include <locale.h>
+#include <locale.h>
 #endif
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#include "macosx-helpers.h"
 #endif
 
 #include <gpgme.h>
@@ -41,7 +41,7 @@
 
 
 #ifdef G_LOG_DOMAIN
-#   undef G_LOG_DOMAIN
+#  undef G_LOG_DOMAIN
 #endif
 #define G_LOG_DOMAIN "crypto"
 
@@ -66,72 +66,65 @@ typedef struct {
 } ask_passphrase_data_t;
 
 
-static void key_selection_changed_cb(GtkTreeSelection *selection,
-                                     gpgme_key_t      *key);
-static gint sort_iter_cmp_fn(GtkTreeModel *model,
-                             GtkTreeIter  *a,
-                             GtkTreeIter  *b,
-                             gpointer      data);
-static gchar *get_passphrase_real(const gchar *uid_hint,
-                                  const gchar *passphrase_info,
-                                  int          prev_was_bad,
-                                  GtkWindow   *parent);
+static void key_selection_changed_cb(GtkTreeSelection * selection,
+                                    gpgme_key_t * key);
+static gint sort_iter_cmp_fn(GtkTreeModel *model, GtkTreeIter *a,
+                                        GtkTreeIter *b, gpointer data);
+static gchar *get_passphrase_real(const gchar * uid_hint,
+                                 const gchar * passphrase_info,
+                                 int prev_was_bad, GtkWindow * parent);
 
 static gboolean get_passphrase_idle(gpointer data);
 
 
 gpgme_error_t
-lb_gpgme_passphrase(void        *hook,
-                    const gchar *uid_hint,
-                    const gchar *passphrase_info,
-                    int          prev_was_bad,
-                    int          fd)
+lb_gpgme_passphrase(void *hook, const gchar * uid_hint,
+                   const gchar * passphrase_info, int prev_was_bad,
+                   int fd)
 {
     int foo, bar;
     gchar *passwd;
     gchar *p;
     GtkWindow *parent;
 
-    if (hook && GTK_IS_WINDOW(hook)) {
-        parent = (GtkWindow *) hook;
-    } else {
-        parent = NULL;
-    }
-
-    if (!libbalsa_am_i_subthread()) {
-        passwd =
-            get_passphrase_real(uid_hint, passphrase_info, prev_was_bad,
-                                parent);
-    } else {
-        static GMutex get_passphrase_lock;
-        ask_passphrase_data_t apd;
-
-        g_mutex_lock(&get_passphrase_lock);
-        g_cond_init(&apd.cond);
-        apd.uid_hint = uid_hint;
-        apd.was_bad = prev_was_bad;
-        apd.passphrase_info = passphrase_info;
-        apd.parent = parent;
-        apd.done = FALSE;
-        g_idle_add(get_passphrase_idle, &apd);
-        while (!apd.done) {
-            g_cond_wait(&apd.cond, &get_passphrase_lock);
-        }
-        g_cond_clear(&apd.cond);
-        g_mutex_unlock(&get_passphrase_lock);
-        passwd = apd.res;
+    if (hook && GTK_IS_WINDOW(hook))
+       parent = (GtkWindow *) hook;
+    else
+       parent = NULL;
+
+    if (!libbalsa_am_i_subthread())
+       passwd =
+           get_passphrase_real(uid_hint, passphrase_info, prev_was_bad,
+                               parent);
+    else {
+       static GMutex get_passphrase_lock;
+       ask_passphrase_data_t apd;
+
+       g_mutex_lock(&get_passphrase_lock);
+       g_cond_init(&apd.cond);
+       apd.uid_hint = uid_hint;
+       apd.was_bad = prev_was_bad;
+       apd.passphrase_info = passphrase_info;
+       apd.parent = parent;
+       apd.done = FALSE;
+       g_idle_add(get_passphrase_idle, &apd);
+       while (!apd.done) {
+               g_cond_wait(&apd.cond, &get_passphrase_lock);
+       }
+       g_cond_clear(&apd.cond);
+       g_mutex_unlock(&get_passphrase_lock);
+       passwd = apd.res;
     }
 
     if (!passwd) {
-        foo = write(fd, "\n", 1);
-        return foo > 0 ? GPG_ERR_CANCELED : GPG_ERR_EIO;
+       foo = write(fd, "\n", 1);
+       return foo > 0 ? GPG_ERR_CANCELED : GPG_ERR_EIO;
     }
 
     /* send the passphrase and erase the string */
     foo = write(fd, passwd, strlen(passwd));
-    for (p = passwd; *p; p++) {
-        *p = random();
-    }
+    for (p = passwd; *p; p++)
+       *p = random();
     g_free(passwd);
     bar = write(fd, "\n", 1);
     return foo > 0 && bar > 0 ? GPG_ERR_NO_ERROR : GPG_ERR_EIO;
@@ -139,35 +132,29 @@ lb_gpgme_passphrase(void        *hook,
 
 
 static void
-lb_gpgme_row_activated_cb(GtkTreeView       *tree_view,
-                          GtkTreePath       *path,
-                          GtkTreeViewColumn *column,
-                          gpointer           user_data)
+lb_gpgme_row_activated_cb(GtkTreeView       * tree_view,
+                          GtkTreePath       * path,
+                          GtkTreeViewColumn * column,
+                          gpointer            user_data)
 {
     GtkTreeIter iter;
     GtkTreeModel *model;
 
     model = gtk_tree_view_get_model(tree_view);
     if (gtk_tree_model_get_iter(model, &iter, path)) {
-        gpgme_key_t key;
-        GtkWidget *dialog;
+       gpgme_key_t key;
+       GtkWidget *dialog;
 
         gtk_tree_model_get(model, &iter, GPG_KEY_PTR_COLUMN, &key, -1);
-        dialog = libbalsa_key_dialog(GTK_WINDOW(
-                                         user_data), GTK_BUTTONS_CLOSE, key, GPG_SUBKEY_CAP_ALL, NULL,
-                                     NULL);
+        dialog = libbalsa_key_dialog(GTK_WINDOW(user_data), GTK_BUTTONS_CLOSE, key, GPG_SUBKEY_CAP_ALL, 
NULL, NULL);
         (void) gtk_dialog_run(GTK_DIALOG(dialog));
         gtk_widget_destroy(dialog);
     }
 }
 
-
 gpgme_key_t
-lb_gpgme_select_key(const gchar     *user_name,
-                    lb_key_sel_md_t  mode,
-                    GList           *keys,
-                    gpgme_protocol_t protocol,
-                    GtkWindow       *parent)
+lb_gpgme_select_key(const gchar * user_name, lb_key_sel_md_t mode, GList * keys,
+                   gpgme_protocol_t protocol, GtkWindow * parent)
 {
     GtkWidget *dialog;
     GtkWidget *vbox;
@@ -175,21 +162,21 @@ lb_gpgme_select_key(const gchar     *user_name,
     GtkWidget *scrolled_window;
     GtkWidget *tree_view;
     GtkListStore *model;
-    GtkTreeSortable *sortable;
+       GtkTreeSortable *sortable;
     GtkTreeSelection *selection;
     GtkTreeIter iter;
     gchar *prompt;
     gpgme_key_t use_key = NULL;
     gint width, height;
-    GtkCellRenderer *renderer;
-    GtkTreeViewColumn *column;
+       GtkCellRenderer *renderer;
+       GtkTreeViewColumn *column;
 
     /* FIXME: create dialog according to the Gnome HIG */
     dialog = gtk_dialog_new_with_buttons(_("Select key"),
-                                         parent,
-                                         GTK_DIALOG_DESTROY_WITH_PARENT |
+                                        parent,
+                                        GTK_DIALOG_DESTROY_WITH_PARENT |
                                          libbalsa_dialog_flags(),
-                                         _("_OK"), GTK_RESPONSE_OK,
+                                         _("_OK"),     GTK_RESPONSE_OK,
                                          _("_Cancel"), GTK_RESPONSE_CANCEL,
                                          NULL);
     gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL);
@@ -202,29 +189,26 @@ lb_gpgme_select_key(const gchar     *user_name,
     gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), vbox);
     g_object_set(G_OBJECT(vbox), "margin", 12, NULL);
     switch (mode) {
-    case LB_SELECT_PRIVATE_KEY:
-        prompt =
-            g_strdup_printf(_("Select the private key for the signer “%s”"),
-                            user_name);
-        break;
-
-    case LB_SELECT_PUBLIC_KEY_USER:
-        prompt =
-            g_strdup_printf(_("Select the public key for the recipient “%s”"),
-                            user_name);
-        break;
-
-    case LB_SELECT_PUBLIC_KEY_ANY:
-        prompt =
-            g_strdup_printf(_("There seems to be no public key for recipient "
-                              "“%s” in your key ring.\nIf you are sure that the "
-                              "recipient owns a different key, select it from "
-                              "the list."), user_name);
-        break;
-
-    default:
-        g_assert_not_reached();
-    }
+       case LB_SELECT_PRIVATE_KEY:
+               prompt =
+                       g_strdup_printf(_("Select the private key for the signer “%s”"),
+                                                       user_name);
+               break;
+       case LB_SELECT_PUBLIC_KEY_USER:
+               prompt =
+                       g_strdup_printf(_("Select the public key for the recipient “%s”"),
+                                       user_name);
+               break;
+       case LB_SELECT_PUBLIC_KEY_ANY:
+               prompt =
+                       g_strdup_printf(_("There seems to be no public key for recipient "
+                                 "“%s” in your key ring.\nIf you are sure that the "
+                                                         "recipient owns a different key, select it from "
+                                                         "the list."), user_name);
+               break;
+       default:
+               g_assert_not_reached();
+       }
     label = gtk_label_new(prompt);
     gtk_widget_set_halign(label, GTK_ALIGN_START);
     g_free(prompt);
@@ -236,15 +220,15 @@ lb_gpgme_select_key(const gchar     *user_name,
 
     scrolled_window = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW
-                                            (scrolled_window),
-                                        GTK_SHADOW_ETCHED_IN);
+                                       (scrolled_window),
+                                       GTK_SHADOW_ETCHED_IN);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
-                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+       GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
     gtk_widget_set_vexpand(scrolled_window, TRUE);
     gtk_box_pack_start(GTK_BOX(vbox), scrolled_window);
 
-    model = gtk_list_store_new(GPG_KEY_NUM_COLUMNS, G_TYPE_STRING,      /* user ID */
-                               G_TYPE_POINTER); /* key */
+    model = gtk_list_store_new(GPG_KEY_NUM_COLUMNS, G_TYPE_STRING,     /* user ID */
+                              G_TYPE_POINTER); /* key */
     sortable = GTK_TREE_SORTABLE(model);
     gtk_tree_sortable_set_sort_func(sortable, 0, sort_iter_cmp_fn, NULL, NULL);
     gtk_tree_sortable_set_sort_column_id(sortable, 0, GTK_SORT_ASCENDING);
@@ -257,35 +241,35 @@ lb_gpgme_select_key(const gchar     *user_name,
     g_object_set_data(G_OBJECT(selection), "first", GUINT_TO_POINTER(1));
     gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
     g_signal_connect(G_OBJECT(selection), "changed",
-                     G_CALLBACK(key_selection_changed_cb), &use_key);
+                    G_CALLBACK(key_selection_changed_cb), &use_key);
 
     /* add the keys */
     while (keys != NULL) {
-        gpgme_key_t key = (gpgme_key_t) keys->data;
-
-        /* simply add the primary uid -- the user can show the full key details */
-        if ((key->uids != NULL) && (key->uids->uid != NULL)) {
-            gchar *uid_info;
-
-            uid_info = libbalsa_cert_subject_readable(key->uids->uid);
-            gtk_list_store_append(model, &iter);
-            gtk_list_store_set(model, &iter,
-                               GPG_KEY_USER_ID_COLUMN, uid_info,
-                               GPG_KEY_PTR_COLUMN, key, -1);
-            g_free(uid_info);
-        }
-        keys = keys->next;
+       gpgme_key_t key = (gpgme_key_t) keys->data;
+
+       /* simply add the primary uid -- the user can show the full key details */
+       if ((key->uids != NULL) && (key->uids->uid != NULL)) {
+               gchar *uid_info;
+
+               uid_info = libbalsa_cert_subject_readable(key->uids->uid);
+               gtk_list_store_append(model, &iter);
+               gtk_list_store_set(model, &iter,
+                       GPG_KEY_USER_ID_COLUMN, uid_info,
+                               GPG_KEY_PTR_COLUMN, key, -1);
+               g_free(uid_info);
+       }
+       keys = keys->next;
     }
 
     g_object_unref(G_OBJECT(model));
 
-    renderer = gtk_cell_renderer_text_new();
-    column =
-        gtk_tree_view_column_new_with_attributes(_("User ID"),
-                                                 renderer, "text", 0,
-                                                 NULL);
-    gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
-    gtk_tree_view_column_set_resizable(column, TRUE);
+       renderer = gtk_cell_renderer_text_new();
+       column =
+           gtk_tree_view_column_new_with_attributes(_("User ID"),
+                                                    renderer, "text", 0,
+                                                    NULL);
+       gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
+       gtk_tree_view_column_set_resizable(column, TRUE);
 
     gtk_container_add(GTK_CONTAINER(scrolled_window), tree_view);
 
@@ -294,7 +278,7 @@ lb_gpgme_select_key(const gchar     *user_name,
     gtk_window_set_default_size(GTK_WINDOW(dialog), (2 * width) / 3, (2 * height) / 3);
 
     if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_OK) {
-        use_key = NULL;
+       use_key = NULL;
     }
     gtk_widget_destroy(dialog);
 
@@ -304,8 +288,8 @@ lb_gpgme_select_key(const gchar     *user_name,
 
 gboolean
 lb_gpgme_accept_low_trust_key(const gchar *user_name,
-                              gpgme_key_t  key,
-                              GtkWindow   *parent)
+                                                         gpgme_key_t  key,
+                                                         GtkWindow   *parent)
 {
     GtkWidget *dialog;
     gint result;
@@ -315,13 +299,10 @@ lb_gpgme_accept_low_trust_key(const gchar *user_name,
     g_return_val_if_fail((user_name != NULL) && (key != NULL), FALSE);
 
     /* create the dialog */
-    message2 =
-        g_strdup_printf(_("The owner trust for this key is “%s” only.\nUse this key anyway?"),
-                        libbalsa_gpgme_validity_to_gchar_short(key->owner_trust));
-    dialog =
-        libbalsa_key_dialog(parent, GTK_BUTTONS_YES_NO, key, GPG_SUBKEY_CAP_ENCRYPT, _(
-                                "Insufficient key owner trust"),
-                            message2);
+    message2 = g_strdup_printf(_("The owner trust for this key is “%s” only.\nUse this key anyway?"),
+       libbalsa_gpgme_validity_to_gchar_short(key->owner_trust));
+    dialog = libbalsa_key_dialog(parent, GTK_BUTTONS_YES_NO, key, GPG_SUBKEY_CAP_ENCRYPT, _("Insufficient 
key owner trust"),
+       message2);
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(dialog, parent);
 #endif
@@ -337,18 +318,13 @@ lb_gpgme_accept_low_trust_key(const gchar *user_name,
 #include "padlock-keyhole.xpm"
 
 /*
- * FIXME - usually, the passphrase should /never/ be requested using this function, but directly
- * by GnuPG using pinentry which
- * guarantees, inter alia, the use of safe (unpagable) memory.  For GnuPG >= 2.1 the pinentry
- * mode has to be set to
- * GPGME_PINENTRY_MODE_LOOPBACK to enable the passphrase callback.  Consider to remove this
- * function completely...
+ * FIXME - usually, the passphrase should /never/ be requested using this function, but directly by GnuPG 
using pinentry which
+ * guarantees, inter alia, the use of safe (unpagable) memory.  For GnuPG >= 2.1 the pinentry mode has to be 
set to
+ * GPGME_PINENTRY_MODE_LOOPBACK to enable the passphrase callback.  Consider to remove this function 
completely...
  */
 static gchar *
-get_passphrase_real(const gchar *uid_hint,
-                    const gchar *passphrase_info,
-                    int          prev_was_bad,
-                    GtkWindow   *parent)
+get_passphrase_real(const gchar * uid_hint, const gchar * passphrase_info,
+                   int prev_was_bad, GtkWindow * parent)
 {
     static GdkPixbuf *padlock_keyhole = NULL;
     GtkWidget *dialog, *entry, *vbox, *hbox;
@@ -356,9 +332,9 @@ get_passphrase_real(const gchar *uid_hint,
 
     /* FIXME: create dialog according to the Gnome HIG */
     dialog = gtk_dialog_new_with_buttons(_("Enter Passphrase"), parent,
-                                         GTK_DIALOG_DESTROY_WITH_PARENT |
+                                        GTK_DIALOG_DESTROY_WITH_PARENT |
                                          libbalsa_dialog_flags(),
-                                         _("_OK"), GTK_RESPONSE_OK,
+                                         _("_OK"),     GTK_RESPONSE_OK,
                                          _("_Cancel"), GTK_RESPONSE_CANCEL,
                                          NULL);
 #if HAVE_MACOSX_DESKTOP
@@ -370,26 +346,22 @@ get_passphrase_real(const gchar *uid_hint,
 
     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
     gtk_box_pack_start(GTK_BOX(hbox), vbox);
-    if (!padlock_keyhole) {
-        padlock_keyhole =
-            gdk_pixbuf_new_from_xpm_data(padlock_keyhole_xpm);
-    }
+    if (!padlock_keyhole)
+       padlock_keyhole =
+           gdk_pixbuf_new_from_xpm_data(padlock_keyhole_xpm);
     gtk_box_pack_start(GTK_BOX(vbox), gtk_image_new_from_pixbuf(padlock_keyhole));
     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
     gtk_box_pack_start(GTK_BOX(hbox), vbox);
-    if (prev_was_bad) {
-        prompt =
-            g_strdup_printf(_
-                            (
-                                "%s\nThe passphrase for this key was bad, please try again!\n\nKey: %s"),
-                            passphrase_info, uid_hint);
-    } else {
-        prompt =
-            g_strdup_printf(_
-                            (
-                                "%s\nPlease enter the passphrase for the secret key!\n\nKey: %s"),
-                            passphrase_info, uid_hint);
-    }
+    if (prev_was_bad)
+       prompt =
+           g_strdup_printf(_
+                           ("%s\nThe passphrase for this key was bad, please try again!\n\nKey: %s"),
+                           passphrase_info, uid_hint);
+    else
+       prompt =
+           g_strdup_printf(_
+                           ("%s\nPlease enter the passphrase for the secret key!\n\nKey: %s"),
+                           passphrase_info, uid_hint);
     gtk_box_pack_start(GTK_BOX(vbox), gtk_label_new(prompt));
     g_free(prompt);
     entry = gtk_entry_new();
@@ -401,11 +373,10 @@ get_passphrase_real(const gchar *uid_hint,
     gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
     gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
     gtk_widget_grab_focus(entry);
-    if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
-        passwd = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
-    } else {
-        passwd = NULL;
-    }
+    if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK)
+       passwd = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
+    else
+       passwd = NULL;
 
     gtk_widget_destroy(dialog);
 
@@ -422,8 +393,8 @@ get_passphrase_idle(gpointer data)
     ask_passphrase_data_t *apd = (ask_passphrase_data_t *) data;
 
     apd->res =
-        get_passphrase_real(apd->uid_hint, apd->passphrase_info,
-                            apd->was_bad, apd->parent);
+       get_passphrase_real(apd->uid_hint, apd->passphrase_info,
+                           apd->was_bad, apd->parent);
     apd->done = TRUE;
     g_cond_signal(&apd->cond);
     return FALSE;
@@ -432,43 +403,39 @@ get_passphrase_idle(gpointer data)
 
 /* callback function if a new row is selected in the list */
 static void
-key_selection_changed_cb(GtkTreeSelection *selection,
-                         gpgme_key_t      *key)
+key_selection_changed_cb(GtkTreeSelection * selection, gpgme_key_t * key)
 {
     GtkDialog *dialog =
-        GTK_DIALOG(g_object_get_data(G_OBJECT(selection), "dialog"));
+       GTK_DIALOG(g_object_get_data(G_OBJECT(selection), "dialog"));
 
     if (GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(selection), "first")) != 0) {
-        gtk_tree_selection_unselect_all(selection);
-        g_object_set_data(G_OBJECT(selection), "first", GUINT_TO_POINTER(0));
+       gtk_tree_selection_unselect_all(selection);
+       g_object_set_data(G_OBJECT(selection), "first", GUINT_TO_POINTER(0));
     } else {
         GtkTreeIter iter;
         GtkTreeModel *model;
 
         if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
-            gtk_tree_model_get(model, &iter, GPG_KEY_PTR_COLUMN, key, -1);
-            gtk_dialog_set_response_sensitive(dialog, GTK_RESPONSE_OK, TRUE);
+               gtk_tree_model_get(model, &iter, GPG_KEY_PTR_COLUMN, key, -1);
+               gtk_dialog_set_response_sensitive(dialog, GTK_RESPONSE_OK, TRUE);
         } else {
-            gtk_dialog_set_response_sensitive(dialog, GTK_RESPONSE_OK, FALSE);
+               gtk_dialog_set_response_sensitive(dialog, GTK_RESPONSE_OK, FALSE);
         }
     }
 }
 
-
 /* compare function for the key list */
 static gint
-sort_iter_cmp_fn(GtkTreeModel *model,
-                 GtkTreeIter  *a,
-                 GtkTreeIter  *b,
-                 gpointer      data)
+sort_iter_cmp_fn(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b,
+                                gpointer data)
 {
-    gchar *name1, *name2;
-    gint result;
-
-    gtk_tree_model_get(model, a, 0, &name1, -1);
-    gtk_tree_model_get(model, b, 0, &name2, -1);
-    result = g_utf8_collate(name1, name2);
-    g_free(name1);
-    g_free(name2);
-    return result;
-}
+       gchar *name1, *name2;
+       gint result;
+
+       gtk_tree_model_get(model, a, 0, &name1, -1);
+       gtk_tree_model_get(model, b, 0, &name2, -1);
+       result = g_utf8_collate(name1, name2);
+       g_free(name1);
+       g_free(name2);
+       return result;
+ }
diff --git a/libbalsa/libbalsa-gpgme-cb.h b/libbalsa/libbalsa-gpgme-cb.h
index fb2e6f6..4c64fd8 100644
--- a/libbalsa/libbalsa-gpgme-cb.h
+++ b/libbalsa/libbalsa-gpgme-cb.h
@@ -22,7 +22,7 @@
 
 
 #ifdef HAVE_CONFIG_H
-#   include <config.h>
+#include <config.h>
 #endif
 
 #include <gpgme.h>
@@ -40,22 +40,18 @@ typedef enum {
 } lb_key_sel_md_t;
 
 
-gpgme_error_t lb_gpgme_passphrase(void        *hook,
-                                  const gchar *uid_hint,
-                                  const gchar *passphrase_info,
-                                  int          prev_was_bad,
-                                  int          fd);
-gpgme_key_t lb_gpgme_select_key(const gchar     *user_name,
-                                lb_key_sel_md_t  mode,
-                                GList           *keys,
-                                gpgme_protocol_t protocol,
-                                GtkWindow       *parent);
+gpgme_error_t lb_gpgme_passphrase(void *hook, const gchar * uid_hint,
+                                 const gchar * passphrase_info,
+                                 int prev_was_bad, int fd);
+gpgme_key_t lb_gpgme_select_key(const gchar * user_name, lb_key_sel_md_t mode,
+                               GList * keys, gpgme_protocol_t protocol,
+                               GtkWindow * parent);
 gboolean lb_gpgme_accept_low_trust_key(const gchar *user_name,
-                                       gpgme_key_t  key,
-                                       GtkWindow   *parent);
+                                                                  gpgme_key_t  key,
+                                                                          GtkWindow   *parent);
 
 
 G_END_DECLS
 
 
-#endif                          /* LIBBALSA_GPGME_CB_H_ */
+#endif                         /* LIBBALSA_GPGME_CB_H_ */
diff --git a/libbalsa/libbalsa-gpgme-keys.c b/libbalsa/libbalsa-gpgme-keys.c
index 88bfcd6..f45566e 100644
--- a/libbalsa/libbalsa-gpgme-keys.c
+++ b/libbalsa/libbalsa-gpgme-keys.c
@@ -28,208 +28,196 @@
 
 
 #ifdef G_LOG_DOMAIN
-#   undef G_LOG_DOMAIN
+#  undef G_LOG_DOMAIN
 #endif
 #define G_LOG_DOMAIN "crypto"
 
 
 /* key server thread data */
 typedef struct _keyserver_op_t {
-    gpgme_ctx_t gpgme_ctx;
-    gchar *fingerprint;
-    GtkWindow *parent;
+       gpgme_ctx_t gpgme_ctx;
+       gchar *fingerprint;
+       GtkWindow *parent;
 } keyserver_op_t;
 
 
 static inline gboolean check_key(const gpgme_key_t key,
-                                 gboolean          secret,
-                                 gboolean          on_keyserver,
-                                 gint64            now);
+                                                                gboolean          secret,
+                                                                gboolean          on_keyserver,
+                                                                gint64            now);
 static gpointer gpgme_keyserver_run(gpointer user_data);
 static GtkWidget *gpgme_keyserver_do_import(keyserver_op_t *keyserver_op,
-                                            gpgme_key_t     key)
-G_GNUC_WARN_UNUSED_RESULT;
-static gboolean gpgme_import_key(gpgme_ctx_t  ctx,
-                                 gpgme_key_t  key,
-                                 gchar      **import_info,
-                                 gpgme_key_t *imported_key,
-                                 GError     **error);
+                                                                                   gpgme_key_t     key)
+       G_GNUC_WARN_UNUSED_RESULT;
+static gboolean gpgme_import_key(gpgme_ctx_t   ctx,
+                                                                gpgme_key_t   key,
+                                                                gchar       **import_info,
+                                                                gpgme_key_t  *imported_key,
+                                                                GError      **error);
 static gchar *gpgme_import_res_to_gchar(gpgme_import_result_t import_result)
-G_GNUC_WARN_UNUSED_RESULT;
+       G_GNUC_WARN_UNUSED_RESULT;
 static gboolean show_keyserver_dialog(gpointer user_data);
 static void keyserver_op_free(keyserver_op_t *keyserver_op);
 
 
 /* documentation: see header file */
 gboolean
-libbalsa_gpgme_list_keys(gpgme_ctx_t  ctx,
-                         GList      **keys,
-                         guint       *bad_keys,
-                         const gchar *pattern,
-                         gboolean     secret,
-                         gboolean     on_keyserver,
-                         GError     **error)
+libbalsa_gpgme_list_keys(gpgme_ctx_t   ctx,
+                                                GList       **keys,
+                                                guint        *bad_keys,
+                                                const gchar  *pattern,
+                                                gboolean      secret,
+                                                gboolean      on_keyserver,
+                                                GError      **error)
 {
-    gpgme_error_t gpgme_err;
-    gpgme_keylist_mode_t kl_save;
-    gpgme_keylist_mode_t kl_mode;
-
-    g_return_val_if_fail((ctx != NULL) && (keys != NULL), FALSE);
-
-    /* set key list mode to external if we want to search a remote key server, or to the local
-       key ring */
-    kl_save = gpgme_get_keylist_mode(ctx);
-    if (on_keyserver) {
-        kl_mode = (kl_save & ~GPGME_KEYLIST_MODE_LOCAL) | GPGME_KEYLIST_MODE_EXTERN;
-    } else {
-        kl_mode = (kl_save & ~GPGME_KEYLIST_MODE_EXTERN) | GPGME_KEYLIST_MODE_LOCAL;
-    }
-    gpgme_err = gpgme_set_keylist_mode(ctx, kl_mode);
-    if (gpgme_err != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, gpgme_err, _("error setting key list mode"));
-    }
-
-    /* list keys */
-    if (gpgme_err == GPG_ERR_NO_ERROR) {
-        gpgme_err = gpgme_op_keylist_start(ctx, pattern, (int) secret);
-        if (gpgme_err != GPG_ERR_NO_ERROR) {
-            libbalsa_gpgme_set_error(error, gpgme_err, _(
-                                         "could not list keys for “%s”"), pattern);
-        } else {
-            GDateTime *current_time;
-            gint64 now;
-            guint bad = 0U;
-
-            /* get the current time so we can check for expired keys */
-            current_time = g_date_time_new_now_utc();
-            now = g_date_time_to_unix(current_time);
-            g_date_time_unref(current_time);
-
-            /* loop over all keys */
-            // FIXME - this may be /very/ slow, show a spinner?
-            do {
-                gpgme_key_t key;
-
-                gpgme_err = gpgme_op_keylist_next(ctx, &key);
-                if (gpgme_err == GPG_ERR_NO_ERROR) {
-                    if (check_key(key, secret, on_keyserver, now)) {
-                        *keys = g_list_prepend(*keys, key);
-                    } else {
-                        bad++;
-                        gpgme_key_unref(key);
-                    }
-                } else if (gpgme_err_code(gpgme_err) != GPG_ERR_EOF) {
-                    libbalsa_gpgme_set_error(error, gpgme_err, _(
-                                                 "could not list keys for “%s”"), pattern);
-                } else {
-                    /* nothing to do, see MISRA C:2012, Rule 15.7 */
-                }
-            } while (gpgme_err == GPG_ERR_NO_ERROR);
-            gpgme_op_keylist_end(ctx);
-
-            if (*keys != NULL) {
-                *keys = g_list_reverse(*keys);
-            }
-            if (bad_keys != NULL) {
-                *bad_keys = bad;
-            }
-        }
-    }
-    gpgme_set_keylist_mode(ctx, kl_save);
-
-    return (gpgme_err_code(gpgme_err) == GPG_ERR_EOF);
+       gpgme_error_t gpgme_err;
+       gpgme_keylist_mode_t kl_save;
+       gpgme_keylist_mode_t kl_mode;
+
+       g_return_val_if_fail((ctx != NULL) && (keys != NULL), FALSE);
+
+       /* set key list mode to external if we want to search a remote key server, or to the local key ring */
+       kl_save = gpgme_get_keylist_mode(ctx);
+       if (on_keyserver) {
+               kl_mode = (kl_save & ~GPGME_KEYLIST_MODE_LOCAL) | GPGME_KEYLIST_MODE_EXTERN;
+       } else {
+               kl_mode = (kl_save & ~GPGME_KEYLIST_MODE_EXTERN) | GPGME_KEYLIST_MODE_LOCAL;
+       }
+       gpgme_err = gpgme_set_keylist_mode(ctx, kl_mode);
+       if (gpgme_err != GPG_ERR_NO_ERROR) {
+               libbalsa_gpgme_set_error(error, gpgme_err, _("error setting key list mode"));
+       }
+
+       /* list keys */
+       if (gpgme_err == GPG_ERR_NO_ERROR) {
+               gpgme_err = gpgme_op_keylist_start(ctx, pattern, (int) secret);
+               if (gpgme_err != GPG_ERR_NO_ERROR) {
+                       libbalsa_gpgme_set_error(error, gpgme_err, _("could not list keys for “%s”"), 
pattern);
+               } else {
+                       GDateTime *current_time;
+                       gint64 now;
+                       guint bad = 0U;
+
+                       /* get the current time so we can check for expired keys */
+                       current_time = g_date_time_new_now_utc();
+                       now = g_date_time_to_unix(current_time);
+                       g_date_time_unref(current_time);
+
+                       /* loop over all keys */
+                       // FIXME - this may be /very/ slow, show a spinner?
+                       do {
+                               gpgme_key_t key;
+
+                               gpgme_err = gpgme_op_keylist_next(ctx, &key);
+                               if (gpgme_err == GPG_ERR_NO_ERROR) {
+                                       if (check_key(key, secret, on_keyserver, now)) {
+                                               *keys = g_list_prepend(*keys, key);
+                                       } else {
+                                               bad++;
+                                               gpgme_key_unref(key);
+                                       }
+                               } else if (gpgme_err_code(gpgme_err) != GPG_ERR_EOF) {
+                                       libbalsa_gpgme_set_error(error, gpgme_err, _("could not list keys for 
“%s”"), pattern);
+                               } else {
+                                       /* nothing to do, see MISRA C:2012, Rule 15.7 */
+                               }
+                       } while (gpgme_err == GPG_ERR_NO_ERROR);
+                       gpgme_op_keylist_end(ctx);
+
+                       if (*keys != NULL) {
+                               *keys = g_list_reverse(*keys);
+                       }
+                       if (bad_keys != NULL) {
+                               *bad_keys = bad;
+                       }
+               }
+       }
+       gpgme_set_keylist_mode(ctx, kl_save);
+
+       return (gpgme_err_code(gpgme_err) == GPG_ERR_EOF);
 }
 
 
 gpgme_key_t
-libbalsa_gpgme_load_key(gpgme_ctx_t  ctx,
-                        const gchar *fingerprint,
-                        GError     **error)
+libbalsa_gpgme_load_key(gpgme_ctx_t   ctx,
+                                               const gchar  *fingerprint,
+                                               GError      **error)
 {
-    gpgme_key_t key = NULL;
-    gpgme_error_t gpgme_err;
-    gpgme_keylist_mode_t kl_mode;
-
-    g_return_val_if_fail((ctx != NULL) && (fingerprint != NULL), NULL);
-
-    /* only use the local key ring */
-    kl_mode = gpgme_get_keylist_mode(ctx);
-    gpgme_err = gpgme_set_keylist_mode(ctx,
-                                       (kl_mode & ~GPGME_KEYLIST_MODE_EXTERN) |
-                                       GPGME_KEYLIST_MODE_LOCAL);
-    if (gpgme_err != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, gpgme_err, _("error setting key list mode"));
-    }
-
-    if (gpgme_err == GPG_ERR_NO_ERROR) {
-        gpgme_err = gpgme_op_keylist_start(ctx, fingerprint, 0);
-        if (gpgme_err != GPG_ERR_NO_ERROR) {
-            libbalsa_gpgme_set_error(error, gpgme_err, _(
-                                         "could not list keys for “%s”"), fingerprint);
-        } else {
-            gpgme_err = gpgme_op_keylist_next(ctx, &key);
-            if (gpgme_err != GPG_ERR_NO_ERROR) {
-                libbalsa_gpgme_set_error(error, gpgme_err, _(
-                                             "could not list keys for “%s”"), fingerprint);
-            } else {
-                gpgme_key_t next_key;
-
-                /* verify this is the only one */
-                gpgme_err = gpgme_op_keylist_next(ctx, &next_key);
-                if (gpgme_err == GPG_ERR_NO_ERROR) {
-                    libbalsa_gpgme_set_error(error, GPG_ERR_AMBIGUOUS,
-                                             _("ambiguous keys for “%s”"), fingerprint);
-                    gpgme_key_unref(next_key);
-                    gpgme_key_unref(key);
-                    key = NULL;
-                }
-            }
-        }
-    }
-    gpgme_set_keylist_mode(ctx, kl_mode);
-
-    return key;
+       gpgme_key_t key = NULL;
+       gpgme_error_t gpgme_err;
+       gpgme_keylist_mode_t kl_mode;
+
+       g_return_val_if_fail((ctx != NULL) && (fingerprint != NULL), NULL);
+
+       /* only use the local key ring */
+       kl_mode = gpgme_get_keylist_mode(ctx);
+       gpgme_err = gpgme_set_keylist_mode(ctx, (kl_mode & ~GPGME_KEYLIST_MODE_EXTERN) | 
GPGME_KEYLIST_MODE_LOCAL);
+       if (gpgme_err != GPG_ERR_NO_ERROR) {
+               libbalsa_gpgme_set_error(error, gpgme_err, _("error setting key list mode"));
+       }
+
+       if (gpgme_err == GPG_ERR_NO_ERROR) {
+               gpgme_err = gpgme_op_keylist_start(ctx, fingerprint, 0);
+               if (gpgme_err != GPG_ERR_NO_ERROR) {
+                       libbalsa_gpgme_set_error(error, gpgme_err, _("could not list keys for “%s”"), 
fingerprint);
+               } else {
+                       gpgme_err = gpgme_op_keylist_next(ctx, &key);
+                       if (gpgme_err != GPG_ERR_NO_ERROR) {
+                               libbalsa_gpgme_set_error(error, gpgme_err, _("could not list keys for “%s”"), 
fingerprint);
+                       } else {
+                               gpgme_key_t next_key;
+
+                               /* verify this is the only one */
+                               gpgme_err = gpgme_op_keylist_next(ctx, &next_key);
+                               if (gpgme_err == GPG_ERR_NO_ERROR) {
+                                       libbalsa_gpgme_set_error(error, GPG_ERR_AMBIGUOUS, _("ambiguous keys 
for “%s”"), fingerprint);
+                                       gpgme_key_unref(next_key);
+                                       gpgme_key_unref(key);
+                                       key = NULL;
+                               }
+                       }
+               }
+       }
+       gpgme_set_keylist_mode(ctx, kl_mode);
+
+       return key;
 }
 
 
 /* documentation: see header file */
 gboolean
 libbalsa_gpgme_keyserver_op(const gchar *fingerprint,
-                            GtkWindow   *parent,
-                            GError     **error)
+                                                       GtkWindow   *parent,
+                                                       GError      **error)
 {
-    keyserver_op_t *keyserver_op;
-    gboolean result = FALSE;
-
-    g_return_val_if_fail(fingerprint != NULL, FALSE);
-
-    keyserver_op = g_new0(keyserver_op_t, 1U);
-    keyserver_op->gpgme_ctx = libbalsa_gpgme_new_with_proto(GPGME_PROTOCOL_OpenPGP,
-                                                            NULL,
-                                                            NULL,
-                                                            error);
-    if (keyserver_op->gpgme_ctx != NULL) {
-        size_t fp_len;
-        GThread *keyserver_th;
-
-        /* apparently it is not possible to search a key server for fingerprints longer than 16
-           hex chars (64 bit)... */
-        fp_len = strlen(fingerprint);
-        if (fp_len > 16U) {
-            keyserver_op->fingerprint = g_strdup(&fingerprint[fp_len - 16U]);
-        } else {
-            keyserver_op->fingerprint = g_strdup(fingerprint);
-        }
-        keyserver_op->parent = parent;
-
-        /* launch thread which takes ownership of the control data structure */
-        keyserver_th = g_thread_new("keyserver", gpgme_keyserver_run, keyserver_op);
-        g_thread_unref(keyserver_th);
-        result = TRUE;
-    } else {
-        keyserver_op_free(keyserver_op);
-        result = FALSE;
-    }
+       keyserver_op_t *keyserver_op;
+       gboolean result = FALSE;
+
+       g_return_val_if_fail(fingerprint != NULL, FALSE);
+
+       keyserver_op = g_new0(keyserver_op_t, 1U);
+       keyserver_op->gpgme_ctx = libbalsa_gpgme_new_with_proto(GPGME_PROTOCOL_OpenPGP, NULL, NULL, error);
+       if (keyserver_op->gpgme_ctx != NULL) {
+               size_t fp_len;
+               GThread *keyserver_th;
+
+               /* apparently it is not possible to search a key server for fingerprints longer than 16 hex 
chars (64 bit)... */
+               fp_len = strlen(fingerprint);
+               if (fp_len > 16U) {
+                       keyserver_op->fingerprint = g_strdup(&fingerprint[fp_len - 16U]);
+               } else {
+                       keyserver_op->fingerprint = g_strdup(fingerprint);
+               }
+               keyserver_op->parent = parent;
+
+               /* launch thread which takes ownership of the control data structure */
+               keyserver_th = g_thread_new("keyserver", gpgme_keyserver_run, keyserver_op);
+               g_thread_unref(keyserver_th);
+               result = TRUE;
+       } else {
+       keyserver_op_free(keyserver_op);
+       result = FALSE;
+       }
 
     return result;
 }
@@ -237,77 +225,75 @@ libbalsa_gpgme_keyserver_op(const gchar *fingerprint,
 
 /* documentation: see header file */
 gchar *
-libbalsa_gpgme_export_key(gpgme_ctx_t  ctx,
-                          gpgme_key_t  key,
-                          const gchar *name,
-                          GError     **error)
+libbalsa_gpgme_export_key(gpgme_ctx_t   ctx,
+                                                 gpgme_key_t   key,
+                                                 const gchar  *name,
+                                                 GError      **error)
 {
-    gpgme_error_t gpgme_err;
-    gpgme_data_t buffer;
-    gchar *result = NULL;
-
-    g_return_val_if_fail((ctx != NULL) && (key != NULL), FALSE);
-
-    gpgme_set_armor(ctx, 1);
-    gpgme_err = gpgme_data_new(&buffer);
-    if (gpgme_err != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, gpgme_err, _("cannot create data buffer"));
-    } else {
-        gpgme_key_t keys[2];
-
-        keys[0] = key;
-        keys[1] = NULL;
-        gpgme_err = gpgme_op_export_keys(ctx, keys, 0, buffer);
-        if (gpgme_err != GPG_ERR_NO_ERROR) {
-            libbalsa_gpgme_set_error(error, gpgme_err, _("exporting key for “%s” failed"),
-                                     name);
-        } else {
-            off_t key_size;
-
-            /* as we are working on a memory buffer, we can omit error checking... */
-            key_size = gpgme_data_seek(buffer, 0, SEEK_END);
-            result = g_malloc0(key_size + 1);
-            (void) gpgme_data_seek(buffer, 0, SEEK_SET);
-            (void) gpgme_data_read(buffer, result, key_size);
-        }
-        gpgme_data_release(buffer);
-    }
-
-    return result;
+       gpgme_error_t gpgme_err;
+       gpgme_data_t buffer;
+       gchar *result = NULL;
+
+       g_return_val_if_fail((ctx != NULL) && (key != NULL), FALSE);
+
+       gpgme_set_armor(ctx, 1);
+       gpgme_err = gpgme_data_new(&buffer);
+       if (gpgme_err != GPG_ERR_NO_ERROR) {
+               libbalsa_gpgme_set_error(error, gpgme_err, _("cannot create data buffer"));
+       } else {
+               gpgme_key_t keys[2];
+
+               keys[0] = key;
+               keys[1] = NULL;
+               gpgme_err = gpgme_op_export_keys(ctx, keys, 0, buffer);
+               if (gpgme_err != GPG_ERR_NO_ERROR) {
+                       libbalsa_gpgme_set_error(error, gpgme_err, _("exporting key for “%s” failed"), name);
+               } else {
+                       off_t key_size;
+
+                       /* as we are working on a memory buffer, we can omit error checking... */
+                       key_size = gpgme_data_seek(buffer, 0, SEEK_END);
+                       result = g_malloc0(key_size + 1);
+                       (void) gpgme_data_seek(buffer, 0, SEEK_SET);
+                       (void) gpgme_data_read(buffer, result, key_size);
+               }
+               gpgme_data_release(buffer);
+       }
+
+       return result;
 }
 
 
 /* documentation: see header file */
 gboolean
-libbalsa_gpgme_import_ascii_key(gpgme_ctx_t  ctx,
-                                const gchar *key_buf,
-                                gchar      **import_info,
-                                GError     **error)
+libbalsa_gpgme_import_ascii_key(gpgme_ctx_t   ctx,
+                                                               const gchar  *key_buf,
+                                                               gchar       **import_info,
+                                                               GError      **error)
 {
-    gpgme_data_t buffer;
-    gpgme_error_t gpgme_err;
-    gboolean result = FALSE;
-
-    g_return_val_if_fail((ctx != NULL) && (key_buf != NULL), FALSE);
-
-    gpgme_err = gpgme_data_new_from_mem(&buffer, key_buf, strlen(key_buf), 1);
-    if (gpgme_err != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, gpgme_err, _("cannot create data buffer"));
-    } else {
-        gpgme_err = gpgme_op_import(ctx, buffer);
-        if (gpgme_err != GPG_ERR_NO_ERROR) {
-            libbalsa_gpgme_set_error(error, gpgme_err,
-                                     _("importing ASCII-armored key data failed"));
-        } else {
-            result = TRUE;
-            if (import_info != NULL) {
-                *import_info = gpgme_import_res_to_gchar(gpgme_op_import_result(ctx));
-            }
-        }
-        gpgme_data_release(buffer);
-    }
-
-    return result;
+       gpgme_data_t buffer;
+       gpgme_error_t gpgme_err;
+       gboolean result = FALSE;
+
+       g_return_val_if_fail((ctx != NULL) && (key_buf != NULL), FALSE);
+
+       gpgme_err = gpgme_data_new_from_mem(&buffer, key_buf, strlen(key_buf), 1);
+       if (gpgme_err != GPG_ERR_NO_ERROR) {
+               libbalsa_gpgme_set_error(error, gpgme_err, _("cannot create data buffer"));
+       } else {
+               gpgme_err = gpgme_op_import(ctx, buffer);
+               if (gpgme_err != GPG_ERR_NO_ERROR) {
+                       libbalsa_gpgme_set_error(error, gpgme_err, _("importing ASCII-armored key data 
failed"));
+               } else {
+                       result = TRUE;
+                       if (import_info != NULL) {
+                               *import_info = gpgme_import_res_to_gchar(gpgme_op_import_result(ctx));
+                       }
+               }
+               gpgme_data_release(buffer);
+       }
+
+       return result;
 }
 
 
@@ -321,36 +307,32 @@ libbalsa_gpgme_import_ascii_key(gpgme_ctx_t  ctx,
  * \param now current time stamp in UTC
  * \return TRUE if the key is usable, FALSE if it is expired, disabled, revoked or invalid
  *
- * Note that GpgME provides less information for keys on a key server, in particular regarding
- * the sub-keys, so the check has to be
+ * Note that GpgME provides less information for keys on a key server, in particular regarding the sub-keys, 
so the check has to be
  * relaxed for this case.
  */
 static inline gboolean
 check_key(const gpgme_key_t key,
-          gboolean          secret,
-          gboolean          on_keyserver,
-          gint64            now)
+                 gboolean          secret,
+                 gboolean          on_keyserver,
+                 gint64            now)
 {
-    gboolean result = FALSE;
-
-    if ((key->expired == 0U) && (key->revoked == 0U) && (key->disabled == 0U) &&
-        (key->invalid == 0U)) {
-        gpgme_subkey_t subkey = key->subkeys;
-
-        while (!result && (subkey != NULL)) {
-            if ((on_keyserver || (secret && (subkey->can_sign != 0U)) ||
-                 (!secret && (subkey->can_encrypt != 0U))) &&
-                (subkey->expired == 0U) && (subkey->revoked == 0U) &&
-                (subkey->disabled == 0U) && (subkey->invalid == 0U) &&
-                ((subkey->expires == 0) || (subkey->expires > (long int) now))) {
-                result = TRUE;
-            } else {
-                subkey = subkey->next;
-            }
-        }
-    }
-
-    return result;
+       gboolean result = FALSE;
+
+       if ((key->expired == 0U) && (key->revoked == 0U) && (key->disabled == 0U) && (key->invalid == 0U)) {
+               gpgme_subkey_t subkey = key->subkeys;
+
+               while (!result && (subkey != NULL)) {
+                       if ((on_keyserver || (secret && (subkey->can_sign != 0U)) || (!secret && 
(subkey->can_encrypt != 0U))) &&
+                               (subkey->expired == 0U) && (subkey->revoked == 0U) && (subkey->disabled == 
0U) && (subkey->invalid == 0U) &&
+                               ((subkey->expires == 0) || (subkey->expires > (long int) now))) {
+                               result = TRUE;
+                       } else {
+                               subkey = subkey->next;
+                       }
+               }
+       }
+
+       return result;
 }
 
 
@@ -359,62 +341,45 @@ check_key(const gpgme_key_t key,
  * \param user_data thread data, cast'ed to \ref keyserver_op_t *
  * \return always NULL
  *
- * Use the passed key server thread data to call libbalsa_gpgme_list_keys().  On success, check
- * if exactly \em one key has been
- * returned and call gpgme_keyserver_do_import() as to import or update it in this case.  Call
- * show_keyserver_dialog() as idle
+ * Use the passed key server thread data to call libbalsa_gpgme_list_keys().  On success, check if exactly 
\em one key has been
+ * returned and call gpgme_keyserver_do_import() as to import or update it in this case.  Call 
show_keyserver_dialog() as idle
  * callback to present the user the results.
  */
 static gpointer
 gpgme_keyserver_run(gpointer user_data)
 {
-    keyserver_op_t *keyserver_op = (keyserver_op_t *) user_data;
-    GList *keys = NULL;
-    gboolean result;
-    GError *error = NULL;
-
-    result = libbalsa_gpgme_list_keys(keyserver_op->gpgme_ctx,
-                                      &keys,
-                                      NULL,
-                                      keyserver_op->fingerprint,
-                                      FALSE,
-                                      TRUE,
-                                      &error);
-    if (result) {
-        GtkWidget *dialog;
-
-        if (keys == NULL) {
-            dialog = gtk_message_dialog_new(keyserver_op->parent,
-                                            GTK_DIALOG_DESTROY_WITH_PARENT | libbalsa_dialog_flags(),
-                                            GTK_MESSAGE_INFO,
-                                            GTK_BUTTONS_CLOSE,
-                                            _(
-                                                "Cannot find a key with fingerprint %s on the key server."),
-                                            keyserver_op->fingerprint);
-        } else if (keys->next != NULL) {
-            dialog = gtk_message_dialog_new(keyserver_op->parent,
-                                            GTK_DIALOG_DESTROY_WITH_PARENT | libbalsa_dialog_flags(),
-                                            GTK_MESSAGE_WARNING,
-                                            GTK_BUTTONS_CLOSE,
-                                            ngettext(
-                                                "Found %u key with fingerprint %s on the key server. Please 
check and import the proper key manually.",
-                                                "Found %u keys with fingerprint %s on the key server. Please 
check and import the proper key manually.",
-                                                g_list_length(keys)),
-                                            g_list_length(keys),
-                                            keyserver_op->fingerprint);
-        } else {
-            dialog = gpgme_keyserver_do_import(keyserver_op, (gpgme_key_t) keys->data);
-        }
-        g_list_free_full(keys, (GDestroyNotify) gpgme_key_unref);
-        g_idle_add(show_keyserver_dialog, dialog);
-    } else {
-        libbalsa_information(LIBBALSA_INFORMATION_ERROR, _(
-                                 "Searching the key server failed: %s"), error->message);
-        g_error_free(error);
-    }
-    keyserver_op_free(keyserver_op);
-
-    return NULL;
+       keyserver_op_t *keyserver_op = (keyserver_op_t *) user_data;
+       GList *keys = NULL;
+       gboolean result;
+       GError *error = NULL;
+
+       result = libbalsa_gpgme_list_keys(keyserver_op->gpgme_ctx, &keys, NULL, keyserver_op->fingerprint, 
FALSE, TRUE, &error);
+       if (result) {
+               GtkWidget *dialog;
+
+               if (keys == NULL) {
+                       dialog = gtk_message_dialog_new(keyserver_op->parent,
+                               GTK_DIALOG_DESTROY_WITH_PARENT | libbalsa_dialog_flags(), GTK_MESSAGE_INFO, 
GTK_BUTTONS_CLOSE,
+                               _("Cannot find a key with fingerprint %s on the key server."), 
keyserver_op->fingerprint);
+               } else if (keys->next != NULL) {
+                       dialog = gtk_message_dialog_new(keyserver_op->parent,
+                               GTK_DIALOG_DESTROY_WITH_PARENT | libbalsa_dialog_flags(), 
GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
+                               ngettext("Found %u key with fingerprint %s on the key server. Please check 
and import the proper key manually.",
+                                        "Found %u keys with fingerprint %s on the key server. Please check 
and import the proper key manually.",
+                                        g_list_length(keys)),
+                               g_list_length(keys), keyserver_op->fingerprint);
+               } else {
+                       dialog = gpgme_keyserver_do_import(keyserver_op, (gpgme_key_t) keys->data);
+               }
+               g_list_free_full(keys, (GDestroyNotify) gpgme_key_unref);
+               g_idle_add(show_keyserver_dialog, dialog);
+       } else {
+               libbalsa_information(LIBBALSA_INFORMATION_ERROR, _("Searching the key server failed: %s"), 
error->message);
+               g_error_free(error);
+       }
+       keyserver_op_free(keyserver_op);
+
+       return NULL;
 }
 
 
@@ -424,54 +389,37 @@ gpgme_keyserver_run(gpointer user_data)
  * \param key the key which shall be imported
  * \return a GtkDialog with information about the import
  *
- * Run gpgme_import_key() and create a dialogue either containing an error message on error, or
- * the import data and the key details
+ * Run gpgme_import_key() and create a dialogue either containing an error message on error, or the import 
data and the key details
  * on success.
  */
 static GtkWidget *
 gpgme_keyserver_do_import(keyserver_op_t *keyserver_op,
-                          gpgme_key_t     key)
+                                                 gpgme_key_t     key)
 {
-    GtkWidget *dialog;
-    gboolean import_res;
-    gchar *import_msg = NULL;
-    GError *error = NULL;
-    gpgme_key_t imported_key = NULL;
-
-    import_res = gpgme_import_key(keyserver_op->gpgme_ctx,
-                                  key,
-                                  &import_msg,
-                                  &imported_key,
-                                  &error);
-    if (!import_res) {
-        dialog = gtk_message_dialog_new(keyserver_op->parent,
-                                        GTK_DIALOG_DESTROY_WITH_PARENT | libbalsa_dialog_flags(),
-                                        GTK_MESSAGE_ERROR,
-                                        GTK_BUTTONS_CLOSE,
-                                        "%s",
-                                        error->message);
-        g_error_free(error);
-    } else {
-        if (imported_key == NULL) {
-            dialog = gtk_message_dialog_new(keyserver_op->parent,
-                                            GTK_DIALOG_DESTROY_WITH_PARENT | libbalsa_dialog_flags(),
-                                            GTK_MESSAGE_INFO,
-                                            GTK_BUTTONS_CLOSE,
-                                            "%s",
-                                            import_msg);
-        } else {
-            dialog = libbalsa_key_dialog(keyserver_op->parent,
-                                         GTK_BUTTONS_CLOSE,
-                                         imported_key,
-                                         GPG_SUBKEY_CAP_ALL,
-                                         NULL,
-                                         import_msg);
-            gpgme_key_unref(imported_key);
-        }
-        g_free(import_msg);
-    }
-
-    return dialog;
+       GtkWidget *dialog;
+       gboolean import_res;
+       gchar *import_msg = NULL;
+       GError *error = NULL;
+       gpgme_key_t imported_key = NULL;
+
+       import_res = gpgme_import_key(keyserver_op->gpgme_ctx, key, &import_msg, &imported_key, &error);
+       if (!import_res) {
+               dialog = gtk_message_dialog_new(keyserver_op->parent, GTK_DIALOG_DESTROY_WITH_PARENT | 
libbalsa_dialog_flags(),
+                       GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", error->message);
+               g_error_free(error);
+       } else {
+               if (imported_key == NULL) {
+                       dialog = gtk_message_dialog_new(keyserver_op->parent, GTK_DIALOG_DESTROY_WITH_PARENT 
| libbalsa_dialog_flags(),
+                               GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "%s", import_msg);
+               } else {
+                       dialog = libbalsa_key_dialog(keyserver_op->parent, GTK_BUTTONS_CLOSE, imported_key, 
GPG_SUBKEY_CAP_ALL,
+                               NULL, import_msg);
+                       gpgme_key_unref(imported_key);
+               }
+               g_free(import_msg);
+       }
+
+       return dialog;
 }
 
 
@@ -479,55 +427,50 @@ gpgme_keyserver_do_import(keyserver_op_t *keyserver_op,
  *
  * \param ctx GpgME context
  * \param key key which shall be imported or updated
- * \param import_info filled with a newly allocated string giving more information about a
- * successful operation
+ * \param import_info filled with a newly allocated string giving more information about a successful 
operation
  * \param imported_key filled with the imported key on success
  * \param error filled with error information on error, may be NULL
  * \return TRUE if the import operation was successful
  *
- * Try to import or update the passed key, typically returned by libbalsa_gpgme_list_keys()
- * searching a key server, using the
- * passed GpgME context.  On success, fill the information message with a human-readable
- * description.
+ * Try to import or update the passed key, typically returned by libbalsa_gpgme_list_keys() searching a key 
server, using the
+ * passed GpgME context.  On success, fill the information message with a human-readable description.
  *
- * \note As the import operation will retrieve more information from the key server, the
- * returned key will include more information
+ * \note As the import operation will retrieve more information from the key server, the returned key will 
include more information
  *       than the originally passed key.
  */
 static gboolean
-gpgme_import_key(gpgme_ctx_t  ctx,
-                 gpgme_key_t  key,
-                 gchar      **import_info,
-                 gpgme_key_t *imported_key,
-                 GError     **error)
+gpgme_import_key(gpgme_ctx_t   ctx,
+                                gpgme_key_t   key,
+                                gchar       **import_info,
+                                gpgme_key_t  *imported_key,
+                                GError      **error)
 {
-    gpgme_error_t gpgme_err;
-    gpgme_key_t keys[2];
-    gboolean result;
-
-    keys[0] = key;
-    keys[1] = NULL;
-    gpgme_err = gpgme_op_import_keys(ctx, keys);
-    if (gpgme_err != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, gpgme_err, _("error importing key"));
-        result = FALSE;
-        *import_info = NULL;
-    } else {
-        gpgme_import_result_t import_result;
-
-        import_result = gpgme_op_import_result(ctx);
-        *import_info = gpgme_import_res_to_gchar(import_result);
-
-        /* the key has been considered: load the possibly changed key from the local ring,
-           ignoring any errors */
-        if ((import_result->considered != 0) && (key->subkeys != NULL)) {
-            *imported_key = libbalsa_gpgme_load_key(ctx, key->subkeys->fpr, error);
-        }
-
-        result = TRUE;
-    }
-
-    return result;
+       gpgme_error_t gpgme_err;
+       gpgme_key_t keys[2];
+       gboolean result;
+
+       keys[0] = key;
+       keys[1] = NULL;
+       gpgme_err = gpgme_op_import_keys(ctx, keys);
+       if (gpgme_err != GPG_ERR_NO_ERROR) {
+               libbalsa_gpgme_set_error(error, gpgme_err, _("error importing key"));
+               result = FALSE;
+               *import_info = NULL;
+       } else {
+               gpgme_import_result_t import_result;
+
+               import_result = gpgme_op_import_result(ctx);
+               *import_info = gpgme_import_res_to_gchar(import_result);
+
+               /* the key has been considered: load the possibly changed key from the local ring, ignoring 
any errors */
+               if ((import_result->considered != 0) && (key->subkeys != NULL)) {
+                       *imported_key = libbalsa_gpgme_load_key(ctx, key->subkeys->fpr, error);
+               }
+
+               result = TRUE;
+       }
+
+       return result;
 }
 
 
@@ -536,59 +479,52 @@ gpgme_import_key(gpgme_ctx_t  ctx,
  * \param import_result GpgME import result data
  * \return a newly allocated human-readable string containing the key import results
  *
- * This helper function collects the information about the last import operation using the
- * passed context into a human-readable
+ * This helper function collects the information about the last import operation using the passed context 
into a human-readable
  * string.
  */
 static gchar *
 gpgme_import_res_to_gchar(gpgme_import_result_t import_result)
 {
-    gchar *import_info;
-
-    if (import_result->considered == 0) {
-        import_info = g_strdup(_("No key was imported or updated."));
-    } else {
-        if (import_result->imported != 0) {
-            import_info = g_strdup(_("The key was imported into the local key ring."));
-        } else if (import_result->unchanged == 0) {
-            GString *info;
-
-            info = g_string_new(_("The key was updated in the local key ring:"));
-            if (import_result->new_user_ids > 0) {
-                g_string_append_printf(info,
-                                       ngettext("\n\342\200\242 %d new user ID",
-                                                "\n\342\200\242 %d new user IDs",
-                                                import_result->new_user_ids),
-                                       import_result->new_user_ids);
-            }
-            if (import_result->new_sub_keys > 0) {
-                g_string_append_printf(info,
-                                       ngettext("\n\342\200\242 %d new subkey",
-                                                "\n\342\200\242 %d new subkeys",
-                                                import_result->new_sub_keys),
-                                       import_result->new_sub_keys);
-            }
-            if (import_result->new_signatures > 0) {
-                g_string_append_printf(info,
-                                       ngettext("\n\342\200\242 %d new signature",
-                                                "\n\342\200\242 %d new signatures",
-                                                import_result->new_signatures),
-                                       import_result->new_signatures);
-            }
-            if (import_result->new_revocations > 0) {
-                g_string_append_printf(info,
-                                       ngettext("\n\342\200\242 %d new revocation",
-                                                "\n\342\200\242 %d new revocations",
-                                                import_result->new_revocations),
-                                       import_result->new_revocations);
-            }
-            import_info = g_string_free(info, FALSE);
-        } else {
-            import_info = g_strdup(_("The existing key in the key ring was not changed."));
-        }
-    }
-
-    return import_info;
+       gchar *import_info;
+
+       if (import_result->considered == 0) {
+               import_info = g_strdup(_("No key was imported or updated."));
+       } else {
+               if (import_result->imported != 0) {
+                       import_info = g_strdup(_("The key was imported into the local key ring."));
+               } else if (import_result->unchanged == 0) {
+                       GString *info;
+
+                       info = g_string_new(_("The key was updated in the local key ring:"));
+                       if (import_result->new_user_ids > 0) {
+                               g_string_append_printf(info,
+                                       ngettext("\n\342\200\242 %d new user ID", "\n\342\200\242 %d new user 
IDs", import_result->new_user_ids),
+                                       import_result->new_user_ids);
+                       }
+                       if (import_result->new_sub_keys > 0) {
+                               g_string_append_printf(info,
+                                       ngettext("\n\342\200\242 %d new subkey", "\n\342\200\242 %d new 
subkeys", import_result->new_sub_keys),
+                                       import_result->new_sub_keys);
+                       }
+                       if (import_result->new_signatures > 0) {
+                               g_string_append_printf(info,
+                                       ngettext("\n\342\200\242 %d new signature", "\n\342\200\242 %d new 
signatures",
+                                               import_result->new_signatures),
+                                       import_result->new_signatures);
+                       }
+                       if (import_result->new_revocations > 0) {
+                               g_string_append_printf(info,
+                                       ngettext("\n\342\200\242 %d new revocation", "\n\342\200\242 %d new 
revocations",
+                                               import_result->new_revocations),
+                                               import_result->new_revocations);
+                       }
+                       import_info = g_string_free(info, FALSE);
+               } else {
+                       import_info = g_strdup(_("The existing key in the key ring was not changed."));
+               }
+       }
+
+       return import_info;
 }
 
 
@@ -602,11 +538,11 @@ gpgme_import_res_to_gchar(gpgme_import_result_t import_result)
 static gboolean
 show_keyserver_dialog(gpointer user_data)
 {
-    GtkWidget *dialog = GTK_WIDGET(user_data);
+       GtkWidget *dialog = GTK_WIDGET(user_data);
 
     gtk_dialog_run(GTK_DIALOG(dialog));
     gtk_widget_destroy(dialog);
-    return FALSE;
+       return FALSE;
 }
 
 
@@ -614,17 +550,16 @@ show_keyserver_dialog(gpointer user_data)
  *
  * \param keyserver_op key server thread data
  *
- * Destroy the GpgME context and all other allocated data in the passed key server thread data
- * structure and the structure itself.
+ * Destroy the GpgME context and all other allocated data in the passed key server thread data structure and 
the structure itself.
  */
 static void
 keyserver_op_free(keyserver_op_t *keyserver_op)
 {
-    if (keyserver_op != NULL) {
-        if (keyserver_op->gpgme_ctx != NULL) {
-            gpgme_release(keyserver_op->gpgme_ctx);
-        }
-        g_free(keyserver_op->fingerprint);
-        g_free(keyserver_op);
-    }
+       if (keyserver_op != NULL) {
+               if (keyserver_op->gpgme_ctx != NULL) {
+                       gpgme_release(keyserver_op->gpgme_ctx);
+               }
+               g_free(keyserver_op->fingerprint);
+               g_free(keyserver_op);
+       }
 }
diff --git a/libbalsa/libbalsa-gpgme-keys.h b/libbalsa/libbalsa-gpgme-keys.h
index b073fab..dcef961 100644
--- a/libbalsa/libbalsa-gpgme-keys.h
+++ b/libbalsa/libbalsa-gpgme-keys.h
@@ -24,7 +24,7 @@
 
 
 #ifdef HAVE_CONFIG_H
-#   include <config.h>
+#include <config.h>
 #endif
 
 #include <gpgme.h>
@@ -38,35 +38,30 @@ G_BEGIN_DECLS
  *
  * \param ctx GpgME context
  * \param keys filled with a list of gpgme_key_t items matching the search pattern
- * \param bad_keys filled with the number of matching keys which are expired, disabled, revoked
- * or invalid, may be NULL
+ * \param bad_keys filled with the number of matching keys which are expired, disabled, revoked or invalid, 
may be NULL
  * \param pattern key search pattern (e.g. name, fingerprint, ...), may be NULL to list all keys
  * \param secret TRUE to search for private keys, FALSE to search for public keys
  * \param on_keyserver TRUE to search on a key server, FALSE to search the local key ring
  * \param error filled with error information on error, may be NULL
  * \return TRUE on success, or FALSE if any error occurred
  *
- * Use the passed context to search for keys matching the passed criteria.  Note that even if
- * the function returns success, the
+ * Use the passed context to search for keys matching the passed criteria.  Note that even if the function 
returns success, the
  * list of keys may be empty if no matching key could be found.
  *
- * \note Listing external (key server) keys for a fingerprint longer than 16 hex characters
- * fails, so be sure to cut them
+ * \note Listing external (key server) keys for a fingerprint longer than 16 hex characters fails, so be 
sure to cut them
  *       appropriately when calling this function with \em on_keyserver == TRUE.\n
  *       The returned list of keys shall be freed by the caller.
- * \todo We might want to add flags for returning only keys which have the is_qualified (subkey
- * can be used for qualified
- *       signatures according to local government regulations) and/or is_de_vs (complies with
- * the rules for classified information
+ * \todo We might want to add flags for returning only keys which have the is_qualified (subkey can be used 
for qualified
+ *       signatures according to local government regulations) and/or is_de_vs (complies with the rules for 
classified information
  *       in Germany at the restricted level, VS-NfD, requires gpgme >= 1.9.0) properties set.
  */
-gboolean libbalsa_gpgme_list_keys(gpgme_ctx_t  ctx,
-                                  GList      **keys,
-                                  guint       *bad_keys,
-                                  const gchar *pattern,
-                                  gboolean     secret,
-                                  gboolean     on_keyserver,
-                                  GError     **error);
+gboolean libbalsa_gpgme_list_keys(gpgme_ctx_t   ctx,
+                                                                 GList       **keys,
+                                                                 guint        *bad_keys,
+                                                                 const gchar  *pattern,
+                                                                 gboolean      secret,
+                                                                 gboolean      on_keyserver,
+                                                                 GError      **error);
 
 /** \brief Load a key
  *
@@ -75,14 +70,13 @@ gboolean libbalsa_gpgme_list_keys(gpgme_ctx_t  ctx,
  * \param error filled with error information on error, may be NULL
  * \return the key matching the passed fingerprint, or NULL on error
  *
- * Return the key matching the passed fingerprint from the local key ring. The function returns
- * NULL if either no or more than one
+ * Return the key matching the passed fingerprint from the local key ring. The function returns NULL if 
either no or more than one
  * key is available.
  */
-gpgme_key_t libbalsa_gpgme_load_key(gpgme_ctx_t  ctx,
-                                    const gchar *fingerprint,
-                                    GError     **error)
-G_GNUC_WARN_UNUSED_RESULT;
+gpgme_key_t libbalsa_gpgme_load_key(gpgme_ctx_t   ctx,
+                                                                       const gchar  *fingerprint,
+                                                                       GError      **error)
+       G_GNUC_WARN_UNUSED_RESULT;
 
 /** \brief Search the key server for a key
  *
@@ -91,17 +85,15 @@ G_GNUC_WARN_UNUSED_RESULT;
  * \param error filled with error information on error, may be NULL
  * \return TRUE on success, or FALSE on error
  *
- * Launch a new thread for searching the passed fingerprint on the key servers.  If the key is
- * found, it is imported or updated in
+ * Launch a new thread for searching the passed fingerprint on the key servers.  If the key is found, it is 
imported or updated in
  * the local key ring, and a dialogue is displayed.
  *
- * \note The passed fingerprint may be longer than 16 hex characters (see \ref
- * libbalsa_gpgme_list_keys) and is truncated
+ * \note The passed fingerprint may be longer than 16 hex characters (see \ref libbalsa_gpgme_list_keys) and 
is truncated
  *       appropriately by this function if necessary.
  */
-gboolean libbalsa_gpgme_keyserver_op(const gchar *fingerprint,
-                                     GtkWindow   *parent,
-                                     GError     **error);
+gboolean libbalsa_gpgme_keyserver_op(const gchar  *fingerprint,
+                                                                        GtkWindow    *parent,
+                                                                        GError      **error);
 
 /** \brief Export a public key
  *
@@ -115,11 +107,11 @@ gboolean libbalsa_gpgme_keyserver_op(const gchar *fingerprint,
  *
  * \note The returned string shall be freed by the caller.
  */
-gchar *libbalsa_gpgme_export_key(gpgme_ctx_t  ctx,
-                                 gpgme_key_t  key,
-                                 const gchar *name,
-                                 GError     **error)
-G_GNUC_WARN_UNUSED_RESULT;
+gchar *libbalsa_gpgme_export_key(gpgme_ctx_t   ctx,
+                                                                gpgme_key_t   key,
+                                                                const gchar  *name,
+                                                                GError      **error)
+       G_GNUC_WARN_UNUSED_RESULT;
 
 /** \brief Import an ASCII-armoured key
  *
@@ -131,10 +123,10 @@ G_GNUC_WARN_UNUSED_RESULT;
  *
  * Import an ASCII-armoured GnuPG key into the key ring.
  */
-gboolean libbalsa_gpgme_import_ascii_key(gpgme_ctx_t  ctx,
-                                         const gchar *key_buf,
-                                         gchar      **import_info,
-                                         GError     **error);
+gboolean libbalsa_gpgme_import_ascii_key(gpgme_ctx_t   ctx,
+                                                                                const gchar  *key_buf,
+                                                                                gchar       **import_info,
+                                                                                GError      **error);
 
 
 G_END_DECLS
diff --git a/libbalsa/libbalsa-gpgme-widgets.c b/libbalsa/libbalsa-gpgme-widgets.c
index f58371f..0205e19 100644
--- a/libbalsa/libbalsa-gpgme-widgets.c
+++ b/libbalsa/libbalsa-gpgme-widgets.c
@@ -27,437 +27,393 @@
 
 
 #ifdef G_LOG_DOMAIN
-#   undef G_LOG_DOMAIN
+#  undef G_LOG_DOMAIN
 #endif
 #define G_LOG_DOMAIN "crypto"
 
 
 
-#define BULLET_STR      "\302\240\342\200\242\302\240"
+#define BULLET_STR     "\302\240\342\200\242\302\240"
 
 
 static gchar *create_status_str(gboolean revoked,
-                                gboolean expired,
-                                gboolean disabled,
-                                gboolean invalid)
-G_GNUC_WARN_UNUSED_RESULT;
-static gchar *create_uid_str(const gpgme_user_id_t uid,
-                             gboolean             *warn)
-G_GNUC_WARN_UNUSED_RESULT;
+                                                               gboolean expired,
+                                                               gboolean disabled,
+                                                               gboolean invalid)
+       G_GNUC_WARN_UNUSED_RESULT;
+static gchar *create_uid_str(const gpgme_user_id_t  uid,
+                                                        gboolean              *warn)
+       G_GNUC_WARN_UNUSED_RESULT;
 
 static gint create_key_grid_row(GtkGrid     *grid,
-                                gint         row,
-                                const gchar *key,
-                                const gchar *value,
-                                gboolean     warn);
+                                                               gint         row,
+                                                               const gchar *key,
+                                                               const gchar *value,
+                                                               gboolean     warn);
 static GtkWidget *create_key_uid_widget(const gpgme_user_id_t uid)
-G_GNUC_WARN_UNUSED_RESULT;
+       G_GNUC_WARN_UNUSED_RESULT;
 static GtkWidget *create_key_label_with_warn(const gchar *text,
-                                             gboolean     warn)
-G_GNUC_WARN_UNUSED_RESULT;
+                                                                                        gboolean     warn)
+       G_GNUC_WARN_UNUSED_RESULT;
 static GtkWidget *create_subkey_widget(gpgme_subkey_t subkey)
-G_GNUC_WARN_UNUSED_RESULT;
+       G_GNUC_WARN_UNUSED_RESULT;
 static gchar *create_purpose_str(gboolean can_sign,
-                                 gboolean can_encrypt,
-                                 gboolean can_certify,
-                                 gboolean can_auth)
-G_GNUC_WARN_UNUSED_RESULT;
+                                                            gboolean can_encrypt,
+                                                                gboolean can_certify,
+                                                                gboolean can_auth)
+       G_GNUC_WARN_UNUSED_RESULT;
 static gchar *create_subkey_type_str(gpgme_subkey_t subkey)
-G_GNUC_WARN_UNUSED_RESULT;
+       G_GNUC_WARN_UNUSED_RESULT;
 
 
 /* documentation: see header file */
 GtkWidget *
-libbalsa_gpgme_key(gpgme_key_t          key,
-                   const gchar         *fingerprint,
-                   lb_gpg_subkey_capa_t subkey_capa,
-                   gboolean             expanded)
+libbalsa_gpgme_key(gpgme_key_t           key,
+                                  const gchar          *fingerprint,
+                                  lb_gpg_subkey_capa_t  subkey_capa,
+                                  gboolean              expanded)
 {
-    GtkWidget *key_data;
-    gchar *status_str;
-    gchar *uid_readable;
-    gint row = 0;
-
-    g_return_val_if_fail(key != NULL, NULL);
-
-    key_data = gtk_grid_new();
-    gtk_grid_set_row_spacing(GTK_GRID(key_data), 2);
-    gtk_grid_set_column_spacing(GTK_GRID(key_data), 6);
-
-    /* print a warning for a bad key status */
-    status_str = create_status_str(key->expired != 0U,
-                                   key->revoked != 0U,
-                                   key->disabled != 0U,
-                                   key->invalid != 0U);
-    if (strlen(status_str) > 0U) {
-        row = create_key_grid_row(GTK_GRID(key_data), row, _("Key status:"), status_str, TRUE);
-    }
-    g_free(status_str);
-
-    /* primary User ID */
-    if (key->uids == NULL) {
-        row = create_key_grid_row(GTK_GRID(key_data), row, _("User ID:"), _("None"), FALSE);
-    } else {
-        GtkWidget *label;
-
-        if (key->uids->next != NULL) {
-            label = gtk_label_new(_("Primary user ID:"));
-        } else {
-            label = gtk_label_new(_("User ID:"));
-        }
-        gtk_widget_set_halign(label, GTK_ALIGN_START);
-        gtk_grid_attach(GTK_GRID(key_data), label, 0, row, 1, 1);
-
-        gtk_grid_attach(GTK_GRID(key_data), create_key_uid_widget(key->uids), 1, row++, 1, 1);
-    }
-
-    /* owner trust is valid for OpenPGP only */
-    if (key->protocol == GPGME_PROTOCOL_OpenPGP) {
-        row = create_key_grid_row(GTK_GRID(key_data), row, _("Key owner trust:"),
-                                  libbalsa_gpgme_validity_to_gchar_short(
-                                      key->owner_trust), FALSE);
-    }
-
-    /* add additional UID's (if any) */
-    if ((key->uids != NULL) && (key->uids->next != NULL)) {
-        GtkWidget *uid_expander;
-        GtkWidget *uid_box;
-        gpgme_user_id_t uid;
-
-        uid_expander = gtk_expander_new(_("Additional User IDs"));
-        gtk_expander_set_expanded(GTK_EXPANDER(uid_expander), expanded);
-        gtk_grid_attach(GTK_GRID(key_data), uid_expander, 0, row++, 2, 1);
-
-        uid_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
-        gtk_widget_set_margin_start(uid_box, 12);
-        gtk_container_add(GTK_CONTAINER(uid_expander), uid_box);
-        for (uid = key->uids->next; uid != NULL; uid = uid->next) {
-            gtk_box_pack_end(GTK_BOX(uid_box), create_key_uid_widget(uid));
-        }
-    }
-
-    /* add the issuer information for CMS only */
-    if (key->protocol == GPGME_PROTOCOL_CMS) {
-        GtkWidget *issuer_expander;
-        GtkWidget *issuer_grid;
-        gint issuer_row = 0;
-
-        issuer_expander = gtk_expander_new(_("Issuer"));
-        gtk_expander_set_expanded(GTK_EXPANDER(issuer_expander), expanded);
-        gtk_grid_attach(GTK_GRID(key_data), issuer_expander, 0, row++, 2, 1);
-
-        issuer_grid = gtk_grid_new();
-        gtk_widget_set_margin_start(issuer_grid, 12);
-        gtk_grid_set_column_spacing(GTK_GRID(issuer_grid), 6);
-        gtk_container_add(GTK_CONTAINER(issuer_expander), issuer_grid);
-
-        if (key->issuer_name != NULL) {
-            uid_readable = libbalsa_cert_subject_readable(key->issuer_name);
-            issuer_row = create_key_grid_row(GTK_GRID(issuer_grid), issuer_row, _(
-                                                 "Name:"), uid_readable, FALSE);
-            g_free(uid_readable);
-        }
-        if (key->issuer_serial != NULL) {
-            issuer_row =
-                create_key_grid_row(GTK_GRID(issuer_grid), issuer_row, _(
-                                        "Serial number:"), key->issuer_serial, FALSE);
-        }
-        if (key->chain_id != NULL) {
-            (void) create_key_grid_row(GTK_GRID(issuer_grid), issuer_row, _(
-                                           "Chain ID:"), key->chain_id, FALSE);
-        }
-    }
-
-    /* subkey information */
-    if (((fingerprint != NULL) || (subkey_capa != 0U)) && (key->subkeys != NULL)) {
-        GtkWidget *subkey_expander;
-        GtkWidget *subkey_box;
-        gpgme_subkey_t subkey;
-
-        if (fingerprint != NULL) {
-            subkey_expander = gtk_expander_new(_("Subkey used"));
-        } else if (subkey_capa != GPG_SUBKEY_CAP_ALL) {
-            gchar *capa_str;
-            gchar *label_str;
-
-            /* indicate that we show only subkeys with certain capabilities */
-            capa_str =
-                create_purpose_str((subkey_capa & GPG_SUBKEY_CAP_SIGN) != 0U,
-                                   (subkey_capa & GPG_SUBKEY_CAP_ENCRYPT) != 0U,
-                                   (subkey_capa & GPG_SUBKEY_CAP_CERTIFY) != 0U,
-                                   (subkey_capa & GPG_SUBKEY_CAP_AUTH) != 0U);
-            label_str = g_strdup_printf(_("Subkeys (%s only)"), capa_str);
-            subkey_expander = gtk_expander_new(label_str);
-            g_free(label_str);
-            g_free(capa_str);
-        } else {
-            subkey_expander = gtk_expander_new(_("Subkeys"));
-        }
-        gtk_expander_set_expanded(GTK_EXPANDER(subkey_expander), expanded);
-        gtk_grid_attach(GTK_GRID(key_data), subkey_expander, 0, row++, 2, 1);
-
-        subkey_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
-        gtk_widget_set_margin_start(subkey_box, 12);
-        gtk_container_add(GTK_CONTAINER(subkey_expander), subkey_box);
-
-        for (subkey = key->subkeys; subkey != NULL; subkey = subkey->next) {
-            if (fingerprint != NULL) {
-                if (strcmp(fingerprint, subkey->fpr) == 0) {
-                    gtk_box_pack_end(GTK_BOX(subkey_box), create_subkey_widget(subkey));
-                }
-            } else if ((((subkey_capa & GPG_SUBKEY_CAP_SIGN) != 0U) &&
-                        (subkey->can_sign != 0)) ||
-                       (((subkey_capa & GPG_SUBKEY_CAP_ENCRYPT) != 0U) &&
-                        (subkey->can_encrypt != 0)) ||
-                       (((subkey_capa & GPG_SUBKEY_CAP_CERTIFY) != 0U) &&
-                        (subkey->can_certify != 0)) ||
-                       (((subkey_capa & GPG_SUBKEY_CAP_AUTH) != 0U) &&
-                        (subkey->can_authenticate != 0))) {
-                gtk_box_pack_end(GTK_BOX(subkey_box), create_subkey_widget(subkey));
-            } else {
-                /* do not print this subkey */
-            }
-        }
-    }
-
-    return key_data;
+       GtkWidget *key_data;
+       gchar *status_str;
+       gchar *uid_readable;
+       gint row = 0;
+
+       g_return_val_if_fail(key != NULL, NULL);
+
+       key_data = gtk_grid_new();
+       gtk_grid_set_row_spacing(GTK_GRID(key_data), 2);
+       gtk_grid_set_column_spacing(GTK_GRID(key_data), 6);
+
+       /* print a warning for a bad key status */
+       status_str = create_status_str(key->expired != 0U, key->revoked != 0U, key->disabled != 0U, 
key->invalid != 0U);
+       if (strlen(status_str) > 0U) {
+               row = create_key_grid_row(GTK_GRID(key_data), row, _("Key status:"), status_str, TRUE);
+       }
+       g_free(status_str);
+
+       /* primary User ID */
+       if (key->uids == NULL) {
+               row = create_key_grid_row(GTK_GRID(key_data), row, _("User ID:"), _("None"), FALSE);
+       } else {
+               GtkWidget *label;
+
+               if (key->uids->next != NULL) {
+                       label = gtk_label_new(_("Primary user ID:"));
+               } else {
+                       label = gtk_label_new(_("User ID:"));
+               }
+               gtk_widget_set_halign(label, GTK_ALIGN_START);
+               gtk_grid_attach(GTK_GRID(key_data), label, 0, row, 1, 1);
+
+               gtk_grid_attach(GTK_GRID(key_data), create_key_uid_widget(key->uids), 1, row++, 1, 1);
+       }
+
+       /* owner trust is valid for OpenPGP only */
+       if (key->protocol == GPGME_PROTOCOL_OpenPGP) {
+               row = create_key_grid_row(GTK_GRID(key_data), row, _("Key owner trust:"),
+                       libbalsa_gpgme_validity_to_gchar_short(key->owner_trust), FALSE);
+       }
+
+       /* add additional UID's (if any) */
+       if ((key->uids != NULL) && (key->uids->next != NULL)) {
+               GtkWidget *uid_expander;
+               GtkWidget *uid_box;
+               gpgme_user_id_t uid;
+
+               uid_expander = gtk_expander_new(_("Additional User IDs"));
+               gtk_expander_set_expanded(GTK_EXPANDER(uid_expander), expanded);
+               gtk_grid_attach(GTK_GRID(key_data), uid_expander, 0, row++, 2, 1);
+
+               uid_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
+               gtk_widget_set_margin_start(uid_box, 12);
+               gtk_container_add(GTK_CONTAINER(uid_expander), uid_box);
+               for (uid = key->uids->next; uid != NULL; uid = uid->next) {
+                       gtk_box_pack_end(GTK_BOX(uid_box), create_key_uid_widget(uid));
+               }
+       }
+
+       /* add the issuer information for CMS only */
+       if (key->protocol == GPGME_PROTOCOL_CMS) {
+               GtkWidget *issuer_expander;
+               GtkWidget *issuer_grid;
+               gint issuer_row = 0;
+
+               issuer_expander = gtk_expander_new(_("Issuer"));
+               gtk_expander_set_expanded(GTK_EXPANDER(issuer_expander), expanded);
+               gtk_grid_attach(GTK_GRID(key_data), issuer_expander, 0, row++, 2, 1);
+
+               issuer_grid = gtk_grid_new();
+               gtk_widget_set_margin_start(issuer_grid, 12);
+               gtk_grid_set_column_spacing(GTK_GRID(issuer_grid), 6);
+               gtk_container_add(GTK_CONTAINER(issuer_expander), issuer_grid);
+
+               if (key->issuer_name != NULL) {
+                       uid_readable = libbalsa_cert_subject_readable(key->issuer_name);
+                       issuer_row = create_key_grid_row(GTK_GRID(issuer_grid), issuer_row, _("Name:"), 
uid_readable, FALSE);
+                       g_free(uid_readable);
+               }
+               if (key->issuer_serial != NULL) {
+                       issuer_row = create_key_grid_row(GTK_GRID(issuer_grid), issuer_row, _("Serial 
number:"), key->issuer_serial, FALSE);
+               }
+               if (key->chain_id != NULL) {
+                       (void) create_key_grid_row(GTK_GRID(issuer_grid), issuer_row, _("Chain ID:"), 
key->chain_id, FALSE);
+               }
+       }
+
+       /* subkey information */
+       if (((fingerprint != NULL) || (subkey_capa != 0U)) && (key->subkeys != NULL)) {
+               GtkWidget *subkey_expander;
+               GtkWidget *subkey_box;
+               gpgme_subkey_t subkey;
+
+               if (fingerprint != NULL) {
+                       subkey_expander = gtk_expander_new(_("Subkey used"));
+               } else if (subkey_capa != GPG_SUBKEY_CAP_ALL) {
+                       gchar *capa_str;
+                       gchar *label_str;
+
+                       /* indicate that we show only subkeys with certain capabilities */
+                       capa_str = create_purpose_str((subkey_capa & GPG_SUBKEY_CAP_SIGN) != 0U, (subkey_capa 
& GPG_SUBKEY_CAP_ENCRYPT) != 0U,
+                               (subkey_capa & GPG_SUBKEY_CAP_CERTIFY) != 0U, (subkey_capa & 
GPG_SUBKEY_CAP_AUTH) != 0U);
+                       label_str = g_strdup_printf(_("Subkeys (%s only)"), capa_str);
+                       subkey_expander = gtk_expander_new(label_str);
+                       g_free(label_str);
+                       g_free(capa_str);
+               } else {
+                       subkey_expander = gtk_expander_new(_("Subkeys"));
+               }
+               gtk_expander_set_expanded(GTK_EXPANDER(subkey_expander), expanded);
+               gtk_grid_attach(GTK_GRID(key_data), subkey_expander, 0, row++, 2, 1);
+
+               subkey_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
+               gtk_widget_set_margin_start(subkey_box, 12);
+               gtk_container_add(GTK_CONTAINER(subkey_expander), subkey_box);
+
+               for (subkey = key->subkeys; subkey != NULL; subkey = subkey->next) {
+                       if (fingerprint != NULL) {
+                               if (strcmp(fingerprint, subkey->fpr) == 0) {
+                                       gtk_box_pack_end(GTK_BOX(subkey_box), create_subkey_widget(subkey));
+                               }
+                       } else if ((((subkey_capa & GPG_SUBKEY_CAP_SIGN) != 0U) && (subkey->can_sign != 0)) ||
+                                          (((subkey_capa & GPG_SUBKEY_CAP_ENCRYPT) != 0U) && 
(subkey->can_encrypt != 0)) ||
+                                          (((subkey_capa & GPG_SUBKEY_CAP_CERTIFY) != 0U) && 
(subkey->can_certify != 0)) ||
+                                          (((subkey_capa & GPG_SUBKEY_CAP_AUTH) != 0U) && 
(subkey->can_authenticate != 0))) {
+                               gtk_box_pack_end(GTK_BOX(subkey_box), create_subkey_widget(subkey));
+                       } else {
+                               /* do not print this subkey */
+                       }
+               }
+       }
+
+       return key_data;
 }
 
 
 /* documentation: see header file */
 gchar *
 libbalsa_gpgme_key_to_gchar(gpgme_key_t  key,
-                            const gchar *fingerprint)
+                                                       const gchar *fingerprint)
 {
-    GString *result;
-    gchar *status_str;
-
-    g_return_val_if_fail((key != NULL) && (fingerprint != NULL), NULL);
-
-    result = g_string_new(NULL);
-
-    /* print a warning for a bad key status */
-    status_str = create_status_str(key->expired != 0U,
-                                   key->revoked != 0U,
-                                   key->disabled != 0U,
-                                   key->invalid != 0U);
-    if (strlen(status_str) > 0U) {
-        g_string_append_printf(result, "%s %s\n", _("Key status:"), status_str);
-    }
-    g_free(status_str);
-
-    /* primary User ID */
-    if (key->uids == NULL) {
-        g_string_append_printf(result, "%s %s", _("User ID:"), _("None"));
-    } else {
-        gchar *uid_str;
-
-        uid_str = create_uid_str(key->uids, NULL);
-        if (key->uids->next != NULL) {
-            g_string_append_printf(result, "%s %s", _("Primary user ID:"), uid_str);
-        } else {
-            g_string_append_printf(result, "%s %s", _("User ID:"), uid_str);
-        }
-        g_free(uid_str);
-    }
-
-    /* owner trust is valid for OpenPGP only */
-    if (key->protocol == GPGME_PROTOCOL_OpenPGP) {
-        g_string_append_printf(result, "\n%s %s", _(
-                                   "Key owner trust:"),
-                               libbalsa_gpgme_validity_to_gchar_short(key->owner_trust));
-    }
-
-    /* add additional UID's (if any) */
-    if ((key->uids != NULL) && (key->uids->next != NULL)) {
-        gpgme_user_id_t uid;
-
-        g_string_append_printf(result, "\n%s", _("Additional User IDs"));
-        for (uid = key->uids->next; uid != NULL; uid = uid->next) {
-            gchar *uid_str;
-
-            uid_str = create_uid_str(uid, NULL);
-            g_string_append_printf(result, "\n" BULLET_STR "%s", uid_str);
-            g_free(uid_str);
-        }
-    }
-
-    /* add the issuer information for CMS only */
-    if (key->protocol == GPGME_PROTOCOL_CMS) {
-        g_string_append_printf(result, "\n%s", _("Issuer"));
-
-        if (key->issuer_name != NULL) {
-            gchar *issuer_readable;
-
-            issuer_readable = libbalsa_cert_subject_readable(key->issuer_name);
-            g_string_append_printf(result, "\n" BULLET_STR "%s %s", _("Name:"),
-                                   issuer_readable);
-            g_free(issuer_readable);
-        }
-        if (key->issuer_serial != NULL) {
-            g_string_append_printf(result, "\n" BULLET_STR "%s %s", _(
-                                       "Serial number:"), key->issuer_serial);
-        }
-        if (key->chain_id != NULL) {
-            g_string_append_printf(result, "\n" BULLET_STR "%s %s", _(
-                                       "Chain ID:"), key->chain_id);
-        }
-    }
-
-    /* subkey information */
-    if (key->subkeys != NULL) {
-        gpgme_subkey_t subkey;
-
-        g_string_append_printf(result, "\n%s", _("Subkey used"));
-        for (subkey = key->subkeys; subkey != NULL; subkey = subkey->next) {
-            if (strcmp(fingerprint, subkey->fpr) == 0) {
-                gchar *details_str;
-                gchar *timebuf;
-
-                details_str = create_status_str(subkey->expired != 0U,
-                                                subkey->revoked != 0U,
-                                                subkey->disabled != 0U,
-                                                subkey->invalid != 0U);
-                if (strlen(details_str) > 0U) {
-                    g_string_append_printf(result, "\n" BULLET_STR "%s %s", _(
-                                               "Status:"), details_str);
-                }
-                g_free(details_str);
-
-                g_string_append_printf(result, "\n" BULLET_STR "%s %s", _(
-                                           "Fingerprint:"), subkey->fpr);
-
-                details_str = create_subkey_type_str(subkey);
-                g_string_append_printf(result, "\n" BULLET_STR "%s %s", _("Type:"),
-                                       details_str);
-                g_free(details_str);
-
-                details_str = create_purpose_str(subkey->can_sign != 0U,
-                                                 subkey->can_encrypt != 0,
-                                                 subkey->can_certify != 0U,
-                                                 subkey->can_authenticate != 0U);
-                if (strlen(details_str) > 0U) {
-                    g_string_append_printf(result, "\n" BULLET_STR "%s %s", _(
-                                               "Capabilities:"), details_str);
-                }
-                g_free(details_str);
-
-                if (subkey->timestamp == -1) {
-                    timebuf = g_strdup(_("invalid timestamp"));
-                } else if (subkey->timestamp == 0) {
-                    timebuf = g_strdup(_("not available"));
-                } else {
-                    timebuf = libbalsa_date_to_utf8(subkey->timestamp, "%x %X");
-                }
-                g_string_append_printf(result, "\n" BULLET_STR "%s %s", _("Created:"), timebuf);
-                g_free(timebuf);
-
-                if (subkey->expires == 0) {
-                    timebuf = g_strdup(_("never"));
-                } else {
-                    timebuf = libbalsa_date_to_utf8(subkey->expires, "%x %X");
-                }
-                g_string_append_printf(result, "\n" BULLET_STR "%s %s", _("Expires:"), timebuf);
-                g_free(timebuf);
-            }
-        }
-    }
-
-    return g_string_free(result, FALSE);
+       GString *result;
+       gchar *status_str;
+
+       g_return_val_if_fail((key != NULL) && (fingerprint != NULL), NULL);
+
+       result = g_string_new(NULL);
+
+       /* print a warning for a bad key status */
+       status_str = create_status_str(key->expired != 0U, key->revoked != 0U, key->disabled != 0U, 
key->invalid != 0U);
+       if (strlen(status_str) > 0U) {
+               g_string_append_printf(result, "%s %s\n", _("Key status:"), status_str);
+       }
+       g_free(status_str);
+
+       /* primary User ID */
+       if (key->uids == NULL) {
+               g_string_append_printf(result, "%s %s", _("User ID:"), _("None"));
+       } else {
+               gchar *uid_str;
+
+               uid_str = create_uid_str(key->uids, NULL);
+               if (key->uids->next != NULL) {
+                       g_string_append_printf(result, "%s %s", _("Primary user ID:"), uid_str);
+               } else {
+                       g_string_append_printf(result, "%s %s", _("User ID:"), uid_str);
+               }
+               g_free(uid_str);
+       }
+
+       /* owner trust is valid for OpenPGP only */
+       if (key->protocol == GPGME_PROTOCOL_OpenPGP) {
+               g_string_append_printf(result, "\n%s %s", _("Key owner trust:"), 
libbalsa_gpgme_validity_to_gchar_short(key->owner_trust));
+       }
+
+       /* add additional UID's (if any) */
+       if ((key->uids != NULL) && (key->uids->next != NULL)) {
+               gpgme_user_id_t uid;
+
+               g_string_append_printf(result, "\n%s", _("Additional User IDs"));
+               for (uid = key->uids->next; uid != NULL; uid = uid->next) {
+                       gchar *uid_str;
+
+                       uid_str = create_uid_str(uid, NULL);
+                       g_string_append_printf(result, "\n" BULLET_STR "%s", uid_str);
+                       g_free(uid_str);
+               }
+       }
+
+       /* add the issuer information for CMS only */
+       if (key->protocol == GPGME_PROTOCOL_CMS) {
+               g_string_append_printf(result, "\n%s", _("Issuer"));
+
+               if (key->issuer_name != NULL) {
+                       gchar *issuer_readable;
+
+                       issuer_readable = libbalsa_cert_subject_readable(key->issuer_name);
+                       g_string_append_printf(result, "\n" BULLET_STR "%s %s", _("Name:"), issuer_readable);
+                       g_free(issuer_readable);
+               }
+               if (key->issuer_serial != NULL) {
+                       g_string_append_printf(result, "\n" BULLET_STR "%s %s", _("Serial number:"), 
key->issuer_serial);
+               }
+               if (key->chain_id != NULL) {
+                       g_string_append_printf(result, "\n" BULLET_STR "%s %s", _("Chain ID:"), 
key->chain_id);
+               }
+       }
+
+       /* subkey information */
+       if (key->subkeys != NULL) {
+               gpgme_subkey_t subkey;
+
+               g_string_append_printf(result, "\n%s", _("Subkey used"));
+               for (subkey = key->subkeys; subkey != NULL; subkey = subkey->next) {
+                       if (strcmp(fingerprint, subkey->fpr) == 0) {
+                               gchar *details_str;
+                               gchar *timebuf;
+
+                               details_str = create_status_str(subkey->expired != 0U, subkey->revoked != 0U, 
subkey->disabled != 0U,
+                                       subkey->invalid != 0U);
+                               if (strlen(details_str) > 0U) {
+                                       g_string_append_printf(result, "\n" BULLET_STR "%s %s", _("Status:"), 
details_str);
+                               }
+                               g_free(details_str);
+
+                               g_string_append_printf(result, "\n" BULLET_STR "%s %s", _("Fingerprint:"), 
subkey->fpr);
+
+                               details_str = create_subkey_type_str(subkey);
+                               g_string_append_printf(result, "\n" BULLET_STR "%s %s", _("Type:"), 
details_str);
+                               g_free(details_str);
+
+                               details_str = create_purpose_str(subkey->can_sign != 0U, subkey->can_encrypt 
!= 0, subkey->can_certify != 0U,
+                                       subkey->can_authenticate != 0U);
+                               if (strlen(details_str) > 0U) {
+                                       g_string_append_printf(result, "\n" BULLET_STR "%s %s", 
_("Capabilities:"), details_str);
+                               }
+                               g_free(details_str);
+
+                               if (subkey->timestamp == -1) {
+                                       timebuf = g_strdup(_("invalid timestamp"));
+                               } else if (subkey->timestamp == 0) {
+                                       timebuf = g_strdup(_("not available"));
+                               } else {
+                                       timebuf = libbalsa_date_to_utf8(subkey->timestamp, "%x %X");
+                               }
+                               g_string_append_printf(result, "\n" BULLET_STR "%s %s", _("Created:"), 
timebuf);
+                               g_free(timebuf);
+
+                               if (subkey->expires == 0) {
+                                       timebuf = g_strdup(_("never"));
+                               } else {
+                                       timebuf = libbalsa_date_to_utf8(subkey->expires, "%x %X");
+                               }
+                               g_string_append_printf(result, "\n" BULLET_STR "%s %s", _("Expires:"), 
timebuf);
+                               g_free(timebuf);
+                       }
+               }
+       }
+
+       return g_string_free(result, FALSE);
 }
 
 
 /* documentation: see header file */
 GtkWidget *
-libbalsa_key_dialog(GtkWindow           *parent,
-                    GtkButtonsType       buttons,
-                    gpgme_key_t          key,
-                    lb_gpg_subkey_capa_t subkey_capa,
-                    const gchar         *message1,
-                    const gchar         *message2)
+libbalsa_key_dialog(GtkWindow            *parent,
+                                   GtkButtonsType                buttons,
+                                   gpgme_key_t           key,
+                                       lb_gpg_subkey_capa_t  subkey_capa,
+                                       const gchar          *message1,
+                                       const gchar          *message2)
 {
-    GtkWidget *dialog;
-    GtkWidget *hbox;
-    GtkWidget *icon;
-    GtkWidget *vbox;
-    GtkWidget *label;
-    GtkWidget *key_data;
-    GtkWidget *scrolledw;
-
-    g_return_val_if_fail(key != NULL, NULL);
-
-    switch (buttons) {
-    case GTK_BUTTONS_CLOSE:
-        dialog = gtk_dialog_new_with_buttons(NULL,
-                                             parent,
-                                             GTK_DIALOG_DESTROY_WITH_PARENT | libbalsa_dialog_flags(),
-                                             _("Close"),
-                                             GTK_RESPONSE_CLOSE,
-                                             NULL);
-        break;
-
-    case GTK_BUTTONS_YES_NO:
-        dialog = gtk_dialog_new_with_buttons(NULL,
-                                             parent,
-                                             GTK_DIALOG_DESTROY_WITH_PARENT | libbalsa_dialog_flags(),
-                                             _("No"),
-                                             GTK_RESPONSE_NO,
-                                             _("Yes"),
-                                             GTK_RESPONSE_YES,
-                                             NULL);
-        break;
-
-    default:
-        g_error("%s: buttons type %d not yet implemented", __func__, buttons);
-    }
-    gtk_window_set_resizable(GTK_WINDOW(dialog), TRUE);
-
-    hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
-    g_object_set(G_OBJECT(hbox), "margin", 6, NULL);
-    gtk_widget_set_vexpand(hbox, TRUE);
-    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox);
-    gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);
-
-    /* standard key icon; "application-certificate" would be an alternative... */
-    icon = gtk_image_new_from_icon_name("dialog-password");
-    gtk_box_pack_start(GTK_BOX(hbox), icon);
-    gtk_widget_set_valign(icon, GTK_ALIGN_START);
-
-    vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
-    gtk_widget_set_hexpand(vbox, TRUE);
-    gtk_box_pack_start(GTK_BOX(hbox), vbox);
-    gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);
-
-    if (message1 != NULL) {
-        char *markup;
-
-        label = gtk_label_new(NULL);
-        markup = g_markup_printf_escaped("<b><big>%s</big></b>", message1);
-        gtk_label_set_markup(GTK_LABEL(label), markup);
-        g_free(markup);
-        gtk_box_pack_start(GTK_BOX(vbox), label);
-        gtk_label_set_line_wrap(GTK_LABEL(label), FALSE);
-    }
-
-    if (message2 != NULL) {
-        label = gtk_label_new(message2);
-        gtk_widget_set_halign(label, GTK_ALIGN_START);
-        gtk_box_pack_start(GTK_BOX(vbox), label);
-        gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
-    }
-
-    scrolledw = gtk_scrolled_window_new(NULL, NULL);
-    gtk_widget_set_vexpand(scrolledw, TRUE);
-    gtk_widget_set_margin_top(scrolledw, 6);
-    gtk_box_pack_start(GTK_BOX(vbox), scrolledw);
-    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(
-                                       scrolledw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-    gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scrolledw), 120);
-
-    key_data = libbalsa_gpgme_key(key, NULL, subkey_capa, TRUE);
-    gtk_container_add(GTK_CONTAINER(scrolledw), key_data);
-
-    return dialog;
+       GtkWidget *dialog;
+       GtkWidget *hbox;
+       GtkWidget *icon;
+       GtkWidget *vbox;
+       GtkWidget *label;
+       GtkWidget *key_data;
+       GtkWidget *scrolledw;
+
+       g_return_val_if_fail(key != NULL, NULL);
+
+       switch (buttons) {
+       case GTK_BUTTONS_CLOSE:
+               dialog = gtk_dialog_new_with_buttons(NULL, parent, GTK_DIALOG_DESTROY_WITH_PARENT | 
libbalsa_dialog_flags(),
+                       _("Close"), GTK_RESPONSE_CLOSE, NULL);
+               break;
+       case GTK_BUTTONS_YES_NO:
+               dialog = gtk_dialog_new_with_buttons(NULL, parent, GTK_DIALOG_DESTROY_WITH_PARENT | 
libbalsa_dialog_flags(),
+                       _("No"), GTK_RESPONSE_NO, _("Yes"), GTK_RESPONSE_YES, NULL);
+               break;
+       default:
+               g_error("%s: buttons type %d not yet implemented", __func__, buttons);
+       }
+       gtk_window_set_resizable(GTK_WINDOW(dialog), TRUE);
+
+       hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
+       g_object_set(G_OBJECT(hbox), "margin", 6, NULL);
+        gtk_widget_set_vexpand(hbox, TRUE);
+       gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox);
+       gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);
+
+       /* standard key icon; "application-certificate" would be an alternative... */
+       icon = gtk_image_new_from_icon_name("dialog-password");
+       gtk_box_pack_start(GTK_BOX(hbox), icon);
+       gtk_widget_set_valign(icon, GTK_ALIGN_START);
+
+       vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
+        gtk_widget_set_hexpand(vbox, TRUE);
+       gtk_box_pack_start(GTK_BOX(hbox), vbox);
+       gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);
+
+       if (message1 != NULL) {
+               char *markup;
+
+               label = gtk_label_new(NULL);
+               markup = g_markup_printf_escaped("<b><big>%s</big></b>", message1);
+               gtk_label_set_markup(GTK_LABEL(label), markup);
+               g_free(markup);
+               gtk_box_pack_start(GTK_BOX(vbox), label);
+               gtk_label_set_line_wrap(GTK_LABEL(label), FALSE);
+       }
+
+       if (message2 != NULL) {
+               label = gtk_label_new(message2);
+               gtk_widget_set_halign(label, GTK_ALIGN_START);
+               gtk_box_pack_start(GTK_BOX(vbox), label);
+               gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+       }
+
+       scrolledw = gtk_scrolled_window_new(NULL, NULL);
+        gtk_widget_set_vexpand(scrolledw, TRUE);
+        gtk_widget_set_margin_top(scrolledw, 6);
+       gtk_box_pack_start(GTK_BOX(vbox), scrolledw);
+       gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledw), GTK_POLICY_NEVER, 
GTK_POLICY_AUTOMATIC);
+       gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scrolledw), 120);
+
+       key_data = libbalsa_gpgme_key(key, NULL, subkey_capa, TRUE);
+       gtk_container_add(GTK_CONTAINER(scrolledw), key_data);
+
+       return dialog;
 }
 
 
@@ -471,31 +427,30 @@ libbalsa_key_dialog(GtkWindow           *parent,
  * \param invalid TRUE if the item is invalid
  * \return a human-readable string containing the states which may be empty
  *
- * \todo Add the is_qualified ([sub]key can be used for qualified signatures according to local
- * government regulations) flag?
+ * \todo Add the is_qualified ([sub]key can be used for qualified signatures according to local government 
regulations) flag?
  */
 static gchar *
 create_status_str(gboolean revoked,
-                  gboolean expired,
-                  gboolean disabled,
-                  gboolean invalid)
+                                 gboolean expired,
+                                 gboolean disabled,
+                                 gboolean invalid)
 {
-    GString *status;
-
-    status = g_string_new(NULL);
-    if (revoked) {
-        status = g_string_append(status, _("revoked"));
-    }
-    if (expired) {
-        g_string_append_printf(status, "%s%s", (status->len > 0U) ? ", " : "", _("expired"));
-    }
-    if (disabled) {
-        g_string_append_printf(status, "%s%s", (status->len > 0U) ? ", " : "", _("disabled"));
-    }
-    if (invalid) {
-        g_string_append_printf(status, "%s%s", (status->len > 0U) ? ", " : "", _("invalid"));
-    }
-    return g_string_free(status, FALSE);
+       GString *status;
+
+       status = g_string_new(NULL);
+       if (revoked) {
+               status = g_string_append(status, _("revoked"));
+       }
+       if (expired) {
+               g_string_append_printf(status, "%s%s", (status->len > 0U) ? ", " : "", _("expired"));
+       }
+       if (disabled) {
+               g_string_append_printf(status, "%s%s", (status->len > 0U) ? ", " : "", _("disabled"));
+       }
+       if (invalid) {
+               g_string_append_printf(status, "%s%s", (status->len > 0U) ? ", " : "", _("invalid"));
+       }
+       return g_string_free(status, FALSE);
 }
 
 
@@ -505,37 +460,35 @@ create_status_str(gboolean revoked,
  * \param warn filled with TRUE if the UID is revoked or invalid
  * \return a newly allocated string containing the UID string
  *
- * Create a string containing the passed UID subject.  If the UID is revoked or invalid, the
- * status information is added in '(…)'.
+ * Create a string containing the passed UID subject.  If the UID is revoked or invalid, the status 
information is added in '(…)'.
  *
  * \todo Do we want to add more details from the gpgme_user_id_t data?
  */
 static gchar *
-create_uid_str(const gpgme_user_id_t uid,
-               gboolean             *warn)
+create_uid_str(const gpgme_user_id_t uid, gboolean *warn)
 {
-    gchar *uid_readable;
-    gchar *uid_status;
-    gchar *result;
-    gboolean do_warn;
-
-    uid_readable = libbalsa_cert_subject_readable(uid->uid);
-    uid_status = create_status_str(uid->revoked != 0U, FALSE, FALSE, uid->invalid != 0U);
-    if (uid_status[0] != '\0') {
-        result = g_strdup_printf("%s (%s)", uid_readable, uid_status);
-        g_free(uid_readable);
-        g_free(uid_status);
-        do_warn = TRUE;
-    } else {
-        result = uid_readable;
-        do_warn = FALSE;
-    }
-
-    if (warn != NULL) {
-        *warn = do_warn;
-    }
-
-    return result;
+       gchar *uid_readable;
+       gchar *uid_status;
+       gchar *result;
+       gboolean do_warn;
+
+       uid_readable = libbalsa_cert_subject_readable(uid->uid);
+       uid_status = create_status_str(uid->revoked != 0U, FALSE, FALSE, uid->invalid != 0U);
+       if (uid_status[0] != '\0') {
+               result = g_strdup_printf("%s (%s)", uid_readable, uid_status);
+               g_free(uid_readable);
+               g_free(uid_status);
+               do_warn = TRUE;
+       } else {
+               result = uid_readable;
+               do_warn = FALSE;
+       }
+
+       if (warn != NULL) {
+               *warn = do_warn;
+       }
+
+       return result;
 }
 
 
@@ -550,23 +503,23 @@ create_uid_str(const gpgme_user_id_t uid,
  */
 static gint
 create_key_grid_row(GtkGrid     *grid,
-                    gint         row,
-                    const gchar *key,
-                    const gchar *value,
-                    gboolean     warn)
+                                       gint         row,
+                                       const gchar *key,
+                                       const gchar *value,
+                                       gboolean     warn)
 {
-    GtkWidget *label;
+       GtkWidget *label;
 
-    label = gtk_label_new(key);
-    gtk_widget_set_halign(label, GTK_ALIGN_START);
-    gtk_grid_attach(GTK_GRID(grid), label, 0, row, 1, 1);
+       label = gtk_label_new(key);
+       gtk_widget_set_halign(label, GTK_ALIGN_START);
+       gtk_grid_attach(GTK_GRID(grid), label, 0, row, 1, 1);
 
-    label = create_key_label_with_warn(value, warn);
-    gtk_widget_set_halign(label, GTK_ALIGN_START);
-    gtk_widget_set_hexpand(label, TRUE);
-    gtk_grid_attach(GTK_GRID(grid), label, 1, row, 1, 1);
+       label = create_key_label_with_warn(value, warn);
+       gtk_widget_set_halign(label, GTK_ALIGN_START);
+       gtk_widget_set_hexpand(label, TRUE);
+       gtk_grid_attach(GTK_GRID(grid), label, 1, row, 1, 1);
 
-    return row + 1;
+       return row + 1;
 }
 
 
@@ -575,27 +528,25 @@ create_key_grid_row(GtkGrid     *grid,
  * \param uid UID
  * \return the uid widget
  *
- * Create a widget containing the passed UID subject.  If the UID is revoked or invalid, a
- * warning icon is prepended, and the
+ * Create a widget containing the passed UID subject.  If the UID is revoked or invalid, a warning icon is 
prepended, and the
  * status information is added.
  *
  * \sa create_uid_str()
  *
- * \todo We might want to show the TOFU data (requires gpgme >= 1.7.0, and
- * GPGME_KEYLIST_MODE_WITH_TOFU in key listing options).
+ * \todo We might want to show the TOFU data (requires gpgme >= 1.7.0, and GPGME_KEYLIST_MODE_WITH_TOFU in 
key listing options).
  *       Maybe also add an expander?
  */
 static GtkWidget *
 create_key_uid_widget(const gpgme_user_id_t uid)
 {
-    gchar *buf;
-    gboolean warn;
-    GtkWidget *result;
-
-    buf = create_uid_str(uid, &warn);
-    result = create_key_label_with_warn(buf, warn);
-    g_free(buf);
-    return result;
+       gchar *buf;
+       gboolean warn;
+       GtkWidget *result;
+
+       buf = create_uid_str(uid, &warn);
+       result = create_key_label_with_warn(buf, warn);
+       g_free(buf);
+       return result;
 }
 
 
@@ -605,43 +556,41 @@ create_key_uid_widget(const gpgme_user_id_t uid)
  * \param warn TRUE if a visible warning shall be included
  * \return the widget
  *
- * If \em warn is FALSE, the returned item is simply a GtkLabel.  Otherwise, it is a box,
- * containing the label printed in red, with
- * a warning icon prepended.  In both cases, the label is start-justified, selectable and
- * line-wrappable.
+ * If \em warn is FALSE, the returned item is simply a GtkLabel.  Otherwise, it is a box, containing the 
label printed in red, with
+ * a warning icon prepended.  In both cases, the label is start-justified, selectable and line-wrappable.
  */
 static GtkWidget *
 create_key_label_with_warn(const gchar *text,
-                           gboolean     warn)
+                                                  gboolean     warn)
 {
-    GtkWidget *result;
-
-    if (warn) {
-        GtkWidget *icon;
-        GtkWidget *label;
-        gchar *buf;
-
-        result = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
-        icon = gtk_image_new_from_icon_name("gtk-dialog-warning");
-        gtk_box_pack_start(GTK_BOX(result), icon);
-        buf = g_markup_printf_escaped("<span fgcolor=\"red\">%s</span>", text);
-        label = gtk_label_new(NULL);
-        gtk_label_set_markup(GTK_LABEL(label), buf);
-        g_free(buf);
-        gtk_widget_set_halign(label, GTK_ALIGN_START);
-        gtk_widget_set_hexpand(label, TRUE);
-        gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
-        gtk_label_set_selectable(GTK_LABEL(label), TRUE);
-        gtk_box_pack_start(GTK_BOX(result), label);
-    } else {
-        result = gtk_label_new(text);
-        gtk_widget_set_halign(result, GTK_ALIGN_START);
-        gtk_widget_set_hexpand(result, TRUE);
-        gtk_label_set_selectable(GTK_LABEL(result), TRUE);
-        gtk_label_set_line_wrap(GTK_LABEL(result), TRUE);
-    }
-
-    return result;
+       GtkWidget *result;
+
+       if (warn) {
+               GtkWidget *icon;
+               GtkWidget *label;
+               gchar *buf;
+
+               result = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
+               icon = gtk_image_new_from_icon_name("gtk-dialog-warning");
+               gtk_box_pack_start(GTK_BOX(result), icon);
+               buf = g_markup_printf_escaped("<span fgcolor=\"red\">%s</span>", text);
+               label = gtk_label_new(NULL);
+               gtk_label_set_markup(GTK_LABEL(label), buf);
+               g_free(buf);
+               gtk_widget_set_halign(label, GTK_ALIGN_START);
+               gtk_widget_set_hexpand(label, TRUE);
+               gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+               gtk_label_set_selectable(GTK_LABEL(label), TRUE);
+               gtk_box_pack_start(GTK_BOX(result), label);
+       } else {
+               result = gtk_label_new(text);
+               gtk_widget_set_halign(result, GTK_ALIGN_START);
+               gtk_widget_set_hexpand(result, TRUE);
+               gtk_label_set_selectable(GTK_LABEL(result), TRUE);
+               gtk_label_set_line_wrap(GTK_LABEL(result), TRUE);
+       }
+
+       return result;
 }
 
 
@@ -650,71 +599,59 @@ create_key_label_with_warn(const gchar *text,
  * \param subkey the subkey which shall be added
  * \return a nes GtkGrid containing the subkey information
  *
- * \note Time stamps are formatted using "%x %X" (preferred locale's date and time format), so
- * we can avoid passing Balsa's
+ * \note Time stamps are formatted using "%x %X" (preferred locale's date and time format), so we can avoid 
passing Balsa's
  *       user-defined format string down here.  We might want to change this.
  */
 static GtkWidget *
 create_subkey_widget(gpgme_subkey_t subkey)
 {
-    GtkWidget *subkey_grid;
-    gint subkey_row = 0;
-    gchar *details_str;
-    gchar *timebuf;
-
-    subkey_grid = gtk_grid_new();
-    gtk_grid_set_column_spacing(GTK_GRID(subkey_grid), 6);
-
-    /* print a warning for a bad subkey status */
-    details_str = create_status_str(subkey->expired != 0U,
-                                    subkey->revoked != 0U,
-                                    subkey->disabled != 0U,
-                                    subkey->invalid != 0U);
-    if (strlen(details_str) > 0U) {
-        subkey_row = create_key_grid_row(GTK_GRID(subkey_grid), subkey_row, _(
-                                             "Status:"), details_str, TRUE);
-    }
-    g_free(details_str);
-
-    subkey_row = create_key_grid_row(GTK_GRID(subkey_grid), subkey_row, _(
-                                         "Fingerprint:"), subkey->fpr, FALSE);
-
-    details_str = create_subkey_type_str(subkey);
-    subkey_row = create_key_grid_row(GTK_GRID(subkey_grid), subkey_row, _(
-                                         "Type:"), details_str, FALSE);
-    g_free(details_str);
-
-    details_str = create_purpose_str(subkey->can_sign != 0U,
-                                     subkey->can_encrypt != 0,
-                                     subkey->can_certify != 0U,
-                                     subkey->can_authenticate != 0U);
-    if (strlen(details_str) > 0U) {
-        subkey_row = create_key_grid_row(GTK_GRID(subkey_grid), subkey_row, _(
-                                             "Capabilities:"), details_str, FALSE);
-    }
-    g_free(details_str);
-
-    if (subkey->timestamp == -1) {
-        timebuf = g_strdup(_("invalid timestamp"));
-    } else if (subkey->timestamp == 0) {
-        timebuf = g_strdup(_("not available"));
-    } else {
-        timebuf = libbalsa_date_to_utf8(subkey->timestamp, "%x %X");
-    }
-    subkey_row = create_key_grid_row(GTK_GRID(subkey_grid), subkey_row, _(
-                                         "Created:"), timebuf, FALSE);
-    g_free(timebuf);
-
-    if (subkey->expires == 0) {
-        timebuf = g_strdup(_("never"));
-    } else {
-        timebuf = libbalsa_date_to_utf8(subkey->expires, "%x %X");
-    }
-    (void) create_key_grid_row(GTK_GRID(subkey_grid), subkey_row, _("Expires:"), timebuf,
-                               FALSE);
-    g_free(timebuf);
-
-    return subkey_grid;
+       GtkWidget *subkey_grid;
+       gint subkey_row = 0;
+       gchar *details_str;
+       gchar *timebuf;
+
+       subkey_grid = gtk_grid_new();
+       gtk_grid_set_column_spacing(GTK_GRID(subkey_grid), 6);
+
+       /* print a warning for a bad subkey status */
+       details_str = create_status_str(subkey->expired != 0U, subkey->revoked != 0U, subkey->disabled != 0U, 
subkey->invalid != 0U);
+       if (strlen(details_str) > 0U) {
+               subkey_row = create_key_grid_row(GTK_GRID(subkey_grid), subkey_row, _("Status:"), 
details_str, TRUE);
+       }
+       g_free(details_str);
+
+       subkey_row = create_key_grid_row(GTK_GRID(subkey_grid), subkey_row, _("Fingerprint:"), subkey->fpr, 
FALSE);
+
+       details_str = create_subkey_type_str(subkey);
+       subkey_row = create_key_grid_row(GTK_GRID(subkey_grid), subkey_row, _("Type:"), details_str, FALSE);
+       g_free(details_str);
+
+       details_str = create_purpose_str(subkey->can_sign != 0U, subkey->can_encrypt != 0, 
subkey->can_certify != 0U,
+               subkey->can_authenticate != 0U);
+       if (strlen(details_str) > 0U) {
+               subkey_row = create_key_grid_row(GTK_GRID(subkey_grid), subkey_row, _("Capabilities:"), 
details_str, FALSE);
+       }
+       g_free(details_str);
+
+       if (subkey->timestamp == -1) {
+               timebuf = g_strdup(_("invalid timestamp"));
+       } else if (subkey->timestamp == 0) {
+               timebuf = g_strdup(_("not available"));
+       } else {
+               timebuf = libbalsa_date_to_utf8(subkey->timestamp, "%x %X");
+       }
+       subkey_row = create_key_grid_row(GTK_GRID(subkey_grid), subkey_row, _("Created:"), timebuf, FALSE);
+       g_free(timebuf);
+
+       if (subkey->expires == 0) {
+               timebuf = g_strdup(_("never"));
+       } else {
+               timebuf = libbalsa_date_to_utf8(subkey->expires, "%x %X");
+       }
+       (void) create_key_grid_row(GTK_GRID(subkey_grid), subkey_row, _("Expires:"), timebuf, FALSE);
+       g_free(timebuf);
+
+       return subkey_grid;
 }
 
 
@@ -724,39 +661,35 @@ create_subkey_widget(gpgme_subkey_t subkey)
  * \param can_encrypt indicates that the subkey can be used for encryption
  * \param can_certify indicates that the subkey can be used to create key certificates
  * \param can_auth indicates that the subkey can be used for authentication
- * \return a string indicating whether a subkey can be used for signing, encryption,
- * certification or authentication
+ * \return a string indicating whether a subkey can be used for signing, encryption, certification or 
authentication
  *
- * \todo Add the is_qualified (subkey can be used for qualified signatures according to local
- * government regulations) and is_de_vs
- *       (complies with the rules for classified information in Germany at the restricted level,
- * VS-NfD, requires gpgme >= 1.9.0)
+ * \todo Add the is_qualified (subkey can be used for qualified signatures according to local government 
regulations) and is_de_vs
+ *       (complies with the rules for classified information in Germany at the restricted level, VS-NfD, 
requires gpgme >= 1.9.0)
  *       flags?
  */
 static gchar *
 create_purpose_str(gboolean can_sign,
-                   gboolean can_encrypt,
-                   gboolean can_certify,
-                   gboolean can_auth)
+                                  gboolean can_encrypt,
+                                  gboolean can_certify,
+                                  gboolean can_auth)
 {
-    GString *purpose;
-
-    purpose = g_string_new(NULL);
-
-    if (can_sign) {
-        purpose = g_string_append(purpose, _("sign"));
-    }
-    if (can_encrypt) {
-        g_string_append_printf(purpose, "%s%s", (purpose->len > 0U) ? ", " : "", _("encrypt"));
-    }
-    if (can_certify) {
-        g_string_append_printf(purpose, "%s%s", (purpose->len > 0U) ? ", " : "", _("certify"));
-    }
-    if (can_auth) {
-        g_string_append_printf(purpose, "%s%s", (purpose->len > 0U) ? ", " : "",
-                               _("authenticate"));
-    }
-    return g_string_free(purpose, FALSE);
+       GString *purpose;
+
+       purpose = g_string_new(NULL);
+
+       if (can_sign) {
+               purpose = g_string_append(purpose, _("sign"));
+       }
+       if (can_encrypt) {
+               g_string_append_printf(purpose, "%s%s", (purpose->len > 0U) ? ", " : "", _("encrypt"));
+       }
+       if (can_certify) {
+               g_string_append_printf(purpose, "%s%s", (purpose->len > 0U) ? ", " : "", _("certify"));
+       }
+       if (can_auth) {
+               g_string_append_printf(purpose, "%s%s", (purpose->len > 0U) ? ", " : "", _("authenticate"));
+       }
+       return g_string_free(purpose, FALSE);
 }
 
 
@@ -765,27 +698,24 @@ create_purpose_str(gboolean can_sign,
  * \param subkey the subkey
  * \return a newly allocated string containing a human-readable description of the subkey type
  *
- * Create a string containing the length of the subkey in bits, the public key algorithm
- * supported by it and for ECC algorithms the
+ * Create a string containing the length of the subkey in bits, the public key algorithm supported by it and 
for ECC algorithms the
  * name of the curve.
  */
 static gchar *
 create_subkey_type_str(gpgme_subkey_t subkey)
 {
-    GString *type_str;
-    const gchar *algo;
-
-    type_str = g_string_new(NULL);
-    g_string_append_printf(type_str, ngettext("%u bit",
-                                              "%u bits",
-                                              subkey->length), subkey->length);
-    algo = gpgme_pubkey_algo_name(subkey->pubkey_algo);
-    if (algo != NULL) {
-        g_string_append_printf(type_str, " %s", algo);
-    }
-    if (subkey->curve != NULL) {
-        g_string_append_printf(type_str, _(" curve “%s”"), subkey->curve);
-    }
-
-    return g_string_free(type_str, FALSE);
+       GString *type_str;
+       const gchar *algo;
+
+       type_str = g_string_new(NULL);
+       g_string_append_printf(type_str, ngettext("%u bit", "%u bits", subkey->length), subkey->length);
+       algo = gpgme_pubkey_algo_name(subkey->pubkey_algo);
+       if (algo != NULL) {
+               g_string_append_printf(type_str, " %s", algo);
+       }
+       if (subkey->curve != NULL) {
+               g_string_append_printf(type_str, _(" curve “%s”"), subkey->curve);
+       }
+
+       return g_string_free(type_str, FALSE);
 }
diff --git a/libbalsa/libbalsa-gpgme-widgets.h b/libbalsa/libbalsa-gpgme-widgets.h
index 20f74e9..0cda361 100644
--- a/libbalsa/libbalsa-gpgme-widgets.h
+++ b/libbalsa/libbalsa-gpgme-widgets.h
@@ -24,7 +24,7 @@
 
 
 #ifdef HAVE_CONFIG_H
-#   include <config.h>
+#include <config.h>
 #endif
 
 #include <gpgme.h>
@@ -36,37 +36,32 @@ G_BEGIN_DECLS
 
 /* defines the capabilities a subkey can have */
 typedef enum {
-    GPG_SUBKEY_CAP_SIGN = (1U << 0),
-    GPG_SUBKEY_CAP_ENCRYPT = (1U << 1),
-    GPG_SUBKEY_CAP_CERTIFY = (1U << 2),
-    GPG_SUBKEY_CAP_AUTH = (1U << 3)
+       GPG_SUBKEY_CAP_SIGN     = (1U << 0),
+       GPG_SUBKEY_CAP_ENCRYPT = (1U << 1),
+       GPG_SUBKEY_CAP_CERTIFY = (1U << 2),
+       GPG_SUBKEY_CAP_AUTH = (1U << 3)
 } lb_gpg_subkey_capa_t;
 
-#define GPG_SUBKEY_CAP_ALL (GPG_SUBKEY_CAP_SIGN + GPG_SUBKEY_CAP_ENCRYPT + \
-                            GPG_SUBKEY_CAP_CERTIFY + GPG_SUBKEY_CAP_AUTH)
+#define GPG_SUBKEY_CAP_ALL (GPG_SUBKEY_CAP_SIGN + GPG_SUBKEY_CAP_ENCRYPT + GPG_SUBKEY_CAP_CERTIFY + 
GPG_SUBKEY_CAP_AUTH)
 
 
 /** \brief Create a key widget
  *
  * \param key GnuPG or S/MIME key
- * \param fingerprint fingerprint of the subkey which shall be displayed, NULL to display all
- * subkeys with certain capabilities
- * \param subkey_capa mask of capabilities for which subkeys shall be included, used only if \em
- * fingerprint is NULL
+ * \param fingerprint fingerprint of the subkey which shall be displayed, NULL to display all subkeys with 
certain capabilities
+ * \param subkey_capa mask of capabilities for which subkeys shall be included, used only if \em fingerprint 
is NULL
  * \param expanded whether the expanders shall be initially expanded
  * \return a new widget containing details about the key
  *
- * Create a widget containing most information about the key, including all UID's, all requested
- * subkeys and the issuer (S/MIME
- * only).  Note that no information about the OpenPGP signatures of the UID's are included, as
- * it is expensive to retrieve all
+ * Create a widget containing most information about the key, including all UID's, all requested subkeys and 
the issuer (S/MIME
+ * only).  Note that no information about the OpenPGP signatures of the UID's are included, as it is 
expensive to retrieve all
  * signatures of a key.
  */
-GtkWidget *libbalsa_gpgme_key(gpgme_key_t          key,
-                              const gchar         *fingerprint,
-                              lb_gpg_subkey_capa_t subkey_capa,
-                              gboolean             expanded)
-G_GNUC_WARN_UNUSED_RESULT;
+GtkWidget *libbalsa_gpgme_key(gpgme_key_t           key,
+                                                         const gchar          *fingerprint,
+                                                         lb_gpg_subkey_capa_t  subkey_capa,
+                                                         gboolean              expanded)
+       G_GNUC_WARN_UNUSED_RESULT;
 
 
 /** \brief Key details as human-readable string
@@ -75,38 +70,34 @@ G_GNUC_WARN_UNUSED_RESULT;
  * \param fingerprint fingerprint of the subkey which shall be printed, <i>must not</i> be NULL
  * \return a newly allocated string containing the key details
  *
- * Create a human-readable multiline string containing the key details, including the details of
- * the subkey identified by the
- * passed fingerprint.  The string is basically a printable version of libbalsa_gpgme_key() for
- * the same key and fingerprint, with
+ * Create a human-readable multiline string containing the key details, including the details of the subkey 
identified by the
+ * passed fingerprint.  The string is basically a printable version of libbalsa_gpgme_key() for the same key 
and fingerprint, with
  * the expanders opened.
  */
 gchar *libbalsa_gpgme_key_to_gchar(gpgme_key_t  key,
-                                   const gchar *fingerprint)
-G_GNUC_WARN_UNUSED_RESULT;
+                                                                  const gchar *fingerprint)
+       G_GNUC_WARN_UNUSED_RESULT;
 
 
 /** \brief Create a key message dialogue
  *
  * \param parent transient parent window, may be NULL
- * \param buttons set of buttons to use (currently only GTK_BUTTONS_CLOSE and GTK_BUTTONS_YES_NO
- * are implemented)
+ * \param buttons set of buttons to use (currently only GTK_BUTTONS_CLOSE and GTK_BUTTONS_YES_NO are 
implemented)
  * \param key key data which shall be displayed
  * \param subkey_capa mask of capabilities for which subkeys shall be included
- * \param message1 primary message, printed centred in bold and a little larger, may be NULL to
- * omit
+ * \param message1 primary message, printed centred in bold and a little larger, may be NULL to omit
  * \param message2 secondary message, printed start-aligned id normal font, may be NULL to omit
  * \return the new dialogue
  *
  * Create a new dialogue, similar to e.g. gtk_message_dialog_new().
  */
-GtkWidget *libbalsa_key_dialog(GtkWindow           *parent,
-                               GtkButtonsType       buttons,
-                               gpgme_key_t          key,
-                               lb_gpg_subkey_capa_t subkey_capa,
-                               const gchar         *message1,
-                               const gchar         *message2)
-G_GNUC_WARN_UNUSED_RESULT;
+GtkWidget *libbalsa_key_dialog(GtkWindow            *parent,
+                                                          GtkButtonsType                buttons,
+                                                          gpgme_key_t           key,
+                                                          lb_gpg_subkey_capa_t  subkey_capa,
+                                                          const gchar          *message1,
+                                                          const gchar          *message2)
+       G_GNUC_WARN_UNUSED_RESULT;
 
 
 G_END_DECLS
diff --git a/libbalsa/libbalsa-gpgme.c b/libbalsa/libbalsa-gpgme.c
index 0c4e537..a093e69 100644
--- a/libbalsa/libbalsa-gpgme.c
+++ b/libbalsa/libbalsa-gpgme.c
@@ -19,15 +19,15 @@
 
 
 #ifdef HAVE_CONFIG_H
-#   include <config.h>
+#include <config.h>
 #endif
 
 #ifdef HAVE_LOCALE_H
-#   include <locale.h>
+#include <locale.h>
 #endif
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#include "macosx-helpers.h"
 #endif
 
 #include <string.h>
@@ -43,44 +43,39 @@
 
 
 #ifdef G_LOG_DOMAIN
-#   undef G_LOG_DOMAIN
+#  undef G_LOG_DOMAIN
 #endif
 #define G_LOG_DOMAIN "crypto"
 
 
-static gboolean gpgme_add_signer(gpgme_ctx_t  ctx,
-                                 const gchar *signer,
-                                 GtkWindow   *parent,
-                                 GError     **error);
+static gboolean gpgme_add_signer(gpgme_ctx_t ctx, const gchar * signer,
+                                GtkWindow * parent, GError ** error);
 static gpgme_key_t *gpgme_build_recipients(gpgme_ctx_t ctx,
-                                           GPtrArray  *rcpt_list,
-                                           gboolean    accept_low_trust,
-                                           GtkWindow  *parent,
-                                           GError    **error);
-static gpgme_error_t get_key_from_name(gpgme_ctx_t  ctx,
-                                       gpgme_key_t *key,
-                                       const gchar *name,
-                                       gboolean     secret,
-                                       gboolean     accept_all,
-                                       GtkWindow   *parent,
-                                       GError     **error);
-static void release_keylist(gpgme_key_t *keylist);
+                                          GPtrArray * rcpt_list,
+                                          gboolean accept_low_trust,
+                                          GtkWindow * parent,
+                                          GError ** error);
+static gpgme_error_t get_key_from_name(gpgme_ctx_t   ctx,
+                                                                          gpgme_key_t  *key,
+                                                                          const gchar  *name,
+                                                                          gboolean      secret,
+                                                                          gboolean      accept_all,
+                                                                          GtkWindow    *parent,
+                                                                          GError      **error);
+static void release_keylist(gpgme_key_t * keylist);
 
 /* callbacks for gpgme file handling */
-static ssize_t g_mime_gpgme_stream_rd(GMimeStream *stream,
-                                      void        *buffer,
-                                      size_t       size);
-static ssize_t g_mime_gpgme_stream_wr(GMimeStream *stream,
-                                      void        *buffer,
-                                      size_t       size);
+static ssize_t g_mime_gpgme_stream_rd(GMimeStream * stream, void *buffer,
+                                     size_t size);
+static ssize_t g_mime_gpgme_stream_wr(GMimeStream * stream, void *buffer,
+                                     size_t size);
 static void cb_data_release(void *handle);
 
 static gchar *utf8_valid_str(const char *gpgme_str)
-G_GNUC_WARN_UNUSED_RESULT;
+       G_GNUC_WARN_UNUSED_RESULT;
 
 #if defined(ENABLE_NLS)
 static const gchar *get_utf8_locale(int category);
-
 #endif
 
 
@@ -110,9 +105,9 @@ static lbgpgme_accept_low_trust_cb accept_low_trust_cb = NULL;
  *       from this module.
  */
 void
-libbalsa_gpgme_init(gpgme_passphrase_cb_t       get_passphrase,
-                    lbgpgme_select_key_cb       select_key,
-                    lbgpgme_accept_low_trust_cb accept_low_trust)
+libbalsa_gpgme_init(gpgme_passphrase_cb_t get_passphrase,
+                   lbgpgme_select_key_cb select_key,
+                   lbgpgme_accept_low_trust_cb accept_low_trust)
 {
     gpgme_engine_info_t e;
     const gchar *agent_info;
@@ -123,43 +118,43 @@ libbalsa_gpgme_init(gpgme_passphrase_cb_t       get_passphrase,
 #ifdef ENABLE_NLS
     gpgme_set_locale(NULL, LC_CTYPE, get_utf8_locale(LC_CTYPE));
     gpgme_set_locale(NULL, LC_MESSAGES, get_utf8_locale(LC_MESSAGES));
-#endif                          /* ENABLE_NLS */
+#endif                         /* ENABLE_NLS */
 
     /* dump the available engines */
     if (gpgme_get_engine_info(&e) == GPG_ERR_NO_ERROR) {
-        while (e) {
-            g_debug("protocol %s: engine %s (home %s, version %s)",
-                    gpgme_get_protocol_name(e->protocol),
-                    e->file_name, e->home_dir, e->version);
-            e = e->next;
-        }
+       while (e) {
+               g_debug("protocol %s: engine %s (home %s, version %s)",
+                     gpgme_get_protocol_name(e->protocol),
+                     e->file_name, e->home_dir, e->version);
+           e = e->next;
+       }
     }
 
     /* check for gpg-agent */
     agent_info = g_getenv("GPG_AGENT_INFO");
     if (agent_info) {
-        g_debug("gpg-agent found: %s", agent_info);
-        gpgme_passphrase_cb = NULL;
+       g_debug("gpg-agent found: %s", agent_info);
+       gpgme_passphrase_cb = NULL;
     } else {
-        gpgme_passphrase_cb = get_passphrase;
+       gpgme_passphrase_cb = get_passphrase;
     }
 
     /* verify that the engines we need are there */
     if (gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP) ==
-        GPG_ERR_NO_ERROR) {
-        g_debug("OpenPGP protocol supported");
-        has_proto_openpgp = TRUE;
+       GPG_ERR_NO_ERROR) {
+       g_debug("OpenPGP protocol supported");
+       has_proto_openpgp = TRUE;
     } else {
-        g_warning("OpenPGP protocol not supported, basic crypto will not work!");
-        has_proto_openpgp = FALSE;
+       g_warning("OpenPGP protocol not supported, basic crypto will not work!");
+       has_proto_openpgp = FALSE;
     }
 
     if (gpgme_engine_check_version(GPGME_PROTOCOL_CMS) == GPG_ERR_NO_ERROR) {
-        g_debug("CMS (aka S/MIME) protocol supported");
-        has_proto_cms = TRUE;
+       g_debug("CMS (aka S/MIME) protocol supported");
+       has_proto_cms = TRUE;
     } else {
-        g_warning("CMS protocol not supported, S/MIME will not work!");
-        has_proto_cms = FALSE;
+       g_warning("CMS protocol not supported, S/MIME will not work!");
+       has_proto_cms = FALSE;
     }
 
     /* remember callbacks */
@@ -180,13 +175,11 @@ libbalsa_gpgme_check_crypto_engine(gpgme_protocol_t protocol)
 {
     switch (protocol) {
     case GPGME_PROTOCOL_OpenPGP:
-        return has_proto_openpgp;
-
+       return has_proto_openpgp;
     case GPGME_PROTOCOL_CMS:
-        return has_proto_cms;
-
+       return has_proto_cms;
     default:
-        return FALSE;
+       return FALSE;
     }
 }
 
@@ -202,40 +195,37 @@ libbalsa_gpgme_check_crypto_engine(gpgme_protocol_t protocol)
  * This helper function creates a new GpgME context for the specified protocol.
  */
 gpgme_ctx_t
-libbalsa_gpgme_new_with_proto(gpgme_protocol_t      protocol,
-                              gpgme_passphrase_cb_t callback,
-                              GtkWindow            *parent,
-                              GError              **error)
+libbalsa_gpgme_new_with_proto(gpgme_protocol_t        protocol,
+                                                         gpgme_passphrase_cb_t   callback,
+                                                         GtkWindow                              *parent,
+                                                         GError                **error)
 {
-    gpgme_error_t err;
-    gpgme_ctx_t ctx = NULL;
+       gpgme_error_t err;
+       gpgme_ctx_t ctx = NULL;
 
     /* create the GpgME context */
-    err = gpgme_new(&ctx);
-    if (err != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, err, _("could not create context"));
-    } else {
-        err = gpgme_set_protocol(ctx, protocol);
-        if (err != GPG_ERR_NO_ERROR) {
-            libbalsa_gpgme_set_error(error, err, _(
-                                         "could not set protocol “%s”"),
-                                     gpgme_get_protocol_name(protocol));
-            gpgme_release(ctx);
-            ctx = NULL;
-        } else {
-            if (protocol == GPGME_PROTOCOL_CMS) {
-                /* s/mime signing fails with error "not implemented" if a passphrase callback
-                   has been set... */
-                gpgme_set_passphrase_cb(ctx, NULL, NULL);
-                /* ...but make sure the user certificate is always included when signing */
-                gpgme_set_include_certs(ctx, 1);
-            } else {
-                gpgme_set_passphrase_cb(ctx, callback, parent);
-            }
-        }
-    }
-
-    return ctx;
+       err = gpgme_new(&ctx);
+       if (err != GPG_ERR_NO_ERROR) {
+               libbalsa_gpgme_set_error(error, err, _("could not create context"));
+       } else {
+               err = gpgme_set_protocol(ctx, protocol);
+               if (err != GPG_ERR_NO_ERROR) {
+                       libbalsa_gpgme_set_error(error, err, _("could not set protocol “%s”"), 
gpgme_get_protocol_name(protocol));
+                   gpgme_release(ctx);
+                   ctx = NULL;
+               } else {
+                       if (protocol == GPGME_PROTOCOL_CMS) {
+                               /* s/mime signing fails with error "not implemented" if a passphrase callback 
has been set... */
+                               gpgme_set_passphrase_cb(ctx, NULL, NULL);
+                               /* ...but make sure the user certificate is always included when signing */
+                               gpgme_set_include_certs(ctx, 1);
+                       } else {
+                               gpgme_set_passphrase_cb(ctx, callback, parent);
+                       }
+               }
+       }
+
+       return ctx;
 }
 
 
@@ -249,35 +239,34 @@ libbalsa_gpgme_new_with_proto(gpgme_protocol_t      protocol,
  * Set the configuration and key ring folder for a GpgME context.
  */
 gboolean
-libbalsa_gpgme_ctx_set_home(gpgme_ctx_t  ctx,
-                            const gchar *home_dir,
-                            GError     **error)
+libbalsa_gpgme_ctx_set_home(gpgme_ctx_t   ctx,
+                                                       const gchar  *home_dir,
+                                                       GError      **error)
 {
-    gpgme_protocol_t protocol;
-    gpgme_engine_info_t engine_info;
-    gpgme_engine_info_t this_engine;
-    gboolean result = FALSE;
+       gpgme_protocol_t protocol;
+       gpgme_engine_info_t engine_info;
+       gpgme_engine_info_t this_engine;
+       gboolean result = FALSE;
 
-    g_return_val_if_fail(ctx != NULL, FALSE);
+       g_return_val_if_fail(ctx != NULL, FALSE);
 
-    protocol = gpgme_get_protocol(ctx);
+       protocol = gpgme_get_protocol(ctx);
     engine_info = gpgme_ctx_get_engine_info(ctx);
     for (this_engine = engine_info;
-         (this_engine != NULL) && (this_engine->protocol != protocol);
-         this_engine = this_engine->next) {
-        /* nothing to do */
+        (this_engine != NULL) && (this_engine->protocol != protocol);
+        this_engine = this_engine->next) {
+       /* nothing to do */
     }
     if (this_engine != NULL) {
-        gpgme_error_t err;
-
-        err = gpgme_ctx_set_engine_info(ctx, protocol, this_engine->file_name, home_dir);
-        if (err == GPG_ERR_NO_ERROR) {
-            result = TRUE;
-        } else {
-            libbalsa_gpgme_set_error(error, err, _(
-                                         "could not set folder “%s” for engine “%s”"), home_dir,
-                                     gpgme_get_protocol_name(protocol));
-        }
+       gpgme_error_t err;
+
+       err = gpgme_ctx_set_engine_info(ctx, protocol, this_engine->file_name, home_dir);
+       if (err == GPG_ERR_NO_ERROR) {
+               result = TRUE;
+       } else {
+               libbalsa_gpgme_set_error(error, err, _("could not set folder “%s” for engine “%s”"), home_dir,
+                       gpgme_get_protocol_name(protocol));
+       }
     }
 
     return result;
@@ -299,19 +288,17 @@ libbalsa_gpgme_ctx_set_home(gpgme_ctx_t  ctx,
  * new signature object on success.
  */
 GMimeGpgmeSigstat *
-libbalsa_gpgme_verify(GMimeStream     *content,
-                      GMimeStream     *sig_plain,
-                      gpgme_protocol_t protocol,
-                      gboolean         singlepart_mode,
-                      GError         **error)
+libbalsa_gpgme_verify(GMimeStream * content, GMimeStream * sig_plain,
+                     gpgme_protocol_t protocol, gboolean singlepart_mode,
+                     GError ** error)
 {
     gpgme_error_t err;
     gpgme_ctx_t ctx;
     struct gpgme_data_cbs cbs = {
-        (gpgme_data_read_cb_t) g_mime_gpgme_stream_rd,  /* read method */
-        (gpgme_data_write_cb_t) g_mime_gpgme_stream_wr, /* write method */
-        NULL,                   /* seek method */
-        cb_data_release         /* release method */
+       (gpgme_data_read_cb_t) g_mime_gpgme_stream_rd,  /* read method */
+       (gpgme_data_write_cb_t) g_mime_gpgme_stream_wr, /* write method */
+       NULL,                   /* seek method */
+       cb_data_release         /* release method */
     };
     gpgme_data_t cont_data;
     gpgme_data_t sig_plain_data;
@@ -321,50 +308,48 @@ libbalsa_gpgme_verify(GMimeStream     *content,
     g_return_val_if_fail(GMIME_IS_STREAM(content), NULL);
     g_return_val_if_fail(GMIME_IS_STREAM(sig_plain), NULL);
     g_return_val_if_fail(protocol == GPGME_PROTOCOL_OpenPGP ||
-                         protocol == GPGME_PROTOCOL_CMS, NULL);
+                        protocol == GPGME_PROTOCOL_CMS, NULL);
 
     /* create the GpgME context (no passphrase callback needed) */
     ctx = libbalsa_gpgme_new_with_proto(protocol, NULL, NULL, error);
     if (ctx == NULL) {
-        return NULL;
+       return NULL;
     }
 
     /* create the message stream */
     if ((err =
-             gpgme_data_new_from_cbs(&cont_data, &cbs,
-                                     content)) != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, err,
-                                 _("could not get data from stream"));
-        gpgme_release(ctx);
-        return NULL;
+        gpgme_data_new_from_cbs(&cont_data, &cbs,
+                                content)) != GPG_ERR_NO_ERROR) {
+       libbalsa_gpgme_set_error(error, err,
+                              _("could not get data from stream"));
+       gpgme_release(ctx);
+       return NULL;
     }
 
     /* create data object for the detached signature stream or the
      * "decrypted" plaintext */
     if ((err =
-             gpgme_data_new_from_cbs(&sig_plain_data, &cbs,
-                                     sig_plain)) != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, err,
-                                 _("could not get data from stream"));
-        gpgme_data_release(cont_data);
-        gpgme_release(ctx);
-        return NULL;
+        gpgme_data_new_from_cbs(&sig_plain_data, &cbs,
+                                sig_plain)) != GPG_ERR_NO_ERROR) {
+       libbalsa_gpgme_set_error(error, err,
+                              _("could not get data from stream"));
+       gpgme_data_release(cont_data);
+       gpgme_release(ctx);
+       return NULL;
     }
 
     /* verify the signature */
-    if (singlepart_mode) {
-        err = gpgme_op_verify(ctx, cont_data, NULL, sig_plain_data);
-    } else {
-        err = gpgme_op_verify(ctx, sig_plain_data, cont_data, NULL);
-    }
+    if (singlepart_mode)
+       err = gpgme_op_verify(ctx, cont_data, NULL, sig_plain_data);
+    else
+       err = gpgme_op_verify(ctx, sig_plain_data, cont_data, NULL);
     if (err != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, err,
-                                 _("signature verification failed"));
-        result = g_mime_gpgme_sigstat_new(ctx);
-        result->status = err;
-    } else {
-        result = g_mime_gpgme_sigstat_new_from_gpgme_ctx(ctx);
-    }
+       libbalsa_gpgme_set_error(error, err,
+                              _("signature verification failed"));
+       result = g_mime_gpgme_sigstat_new(ctx);
+       result->status = err;
+    } else
+       result = g_mime_gpgme_sigstat_new_from_gpgme_ctx(ctx);
 
     /* release gmgme data buffers, destroy the context and return the
      * signature object */
@@ -395,13 +380,10 @@ libbalsa_gpgme_verify(GMimeStream     *content,
  * called by GpgME if no GPG Agent is running.
  */
 gpgme_hash_algo_t
-libbalsa_gpgme_sign(const gchar     *userid,
-                    GMimeStream     *istream,
-                    GMimeStream     *ostream,
-                    gpgme_protocol_t protocol,
-                    gboolean         singlepart_mode,
-                    GtkWindow       *parent,
-                    GError         **error)
+libbalsa_gpgme_sign(const gchar * userid, GMimeStream * istream,
+                   GMimeStream * ostream, gpgme_protocol_t protocol,
+                   gboolean singlepart_mode, GtkWindow * parent,
+                   GError ** error)
 {
     gpgme_error_t err;
     gpgme_ctx_t ctx;
@@ -410,39 +392,37 @@ libbalsa_gpgme_sign(const gchar     *userid,
     gpgme_data_t out;
     gpgme_hash_algo_t hash_algo;
     struct gpgme_data_cbs cbs = {
-        (gpgme_data_read_cb_t) g_mime_gpgme_stream_rd,  /* read method */
-        (gpgme_data_write_cb_t) g_mime_gpgme_stream_wr, /* write method */
-        NULL,                   /* seek method */
-        cb_data_release         /* release method */
+       (gpgme_data_read_cb_t) g_mime_gpgme_stream_rd,  /* read method */
+       (gpgme_data_write_cb_t) g_mime_gpgme_stream_wr, /* write method */
+       NULL,                   /* seek method */
+       cb_data_release         /* release method */
     };
 
     /* paranoia checks */
     g_return_val_if_fail(GMIME_IS_STREAM(istream), GPGME_MD_NONE);
     g_return_val_if_fail(GMIME_IS_STREAM(ostream), GPGME_MD_NONE);
     g_return_val_if_fail(protocol == GPGME_PROTOCOL_OpenPGP ||
-                         protocol == GPGME_PROTOCOL_CMS, GPGME_MD_NONE);
+                        protocol == GPGME_PROTOCOL_CMS, GPGME_MD_NONE);
 
     /* create the GpgME context (passphrase callback required) */
     ctx = libbalsa_gpgme_new_with_proto(protocol, gpgme_passphrase_cb, parent, error);
     if (ctx == NULL) {
-        return GPGME_MD_NONE;
+       return GPGME_MD_NONE;
     }
 
     /* set the signature mode */
     if (singlepart_mode) {
-        if (protocol == GPGME_PROTOCOL_OpenPGP) {
-            sig_mode = GPGME_SIG_MODE_CLEAR;
-        } else {
-            sig_mode = GPGME_SIG_MODE_NORMAL;
-        }
-    } else {
-        sig_mode = GPGME_SIG_MODE_DETACH;
-    }
+       if (protocol == GPGME_PROTOCOL_OpenPGP)
+           sig_mode = GPGME_SIG_MODE_CLEAR;
+       else
+           sig_mode = GPGME_SIG_MODE_NORMAL;
+    } else
+       sig_mode = GPGME_SIG_MODE_DETACH;
 
     /* find the secret key for the "sign_for" address */
     if (!gpgme_add_signer(ctx, userid, parent, error)) {
-        gpgme_release(ctx);
-        return GPGME_MD_NONE;
+       gpgme_release(ctx);
+       return GPGME_MD_NONE;
     }
 
     /* OpenPGP signatures are ASCII armored */
@@ -450,31 +430,30 @@ libbalsa_gpgme_sign(const gchar     *userid,
 
     /* create gpgme data objects */
     if ((err =
-             gpgme_data_new_from_cbs(&in, &cbs,
-                                     istream)) != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, err,
-                                 _("could not get data from stream"));
-        gpgme_release(ctx);
-        return GPGME_MD_NONE;
+        gpgme_data_new_from_cbs(&in, &cbs,
+                                istream)) != GPG_ERR_NO_ERROR) {
+       libbalsa_gpgme_set_error(error, err,
+                              _("could not get data from stream"));
+       gpgme_release(ctx);
+       return GPGME_MD_NONE;
     }
     if ((err =
-             gpgme_data_new_from_cbs(&out, &cbs,
-                                     ostream)) != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, err,
-                                 _("could not create new data object"));
-        gpgme_data_release(in);
-        gpgme_release(ctx);
-        return GPGME_MD_NONE;
+        gpgme_data_new_from_cbs(&out, &cbs,
+                                ostream)) != GPG_ERR_NO_ERROR) {
+       libbalsa_gpgme_set_error(error, err,
+                              _("could not create new data object"));
+       gpgme_data_release(in);
+       gpgme_release(ctx);
+       return GPGME_MD_NONE;
     }
 
     /* sign and get the used hash algorithm */
     err = gpgme_op_sign(ctx, in, out, sig_mode);
     if (err != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, err, _("signing failed"));
-        hash_algo = GPGME_MD_NONE;
-    } else {
-        hash_algo = gpgme_op_sign_result(ctx)->signatures->hash_algo;
-    }
+       libbalsa_gpgme_set_error(error, err, _("signing failed"));
+       hash_algo = GPGME_MD_NONE;
+    } else
+       hash_algo = gpgme_op_sign_result(ctx)->signatures->hash_algo;
 
     /* clean up */
     gpgme_data_release(in);
@@ -508,15 +487,11 @@ libbalsa_gpgme_sign(const gchar     *userid,
  * only.
  */
 gboolean
-libbalsa_gpgme_encrypt(GPtrArray       *recipients,
-                       const char      *sign_for,
-                       GMimeStream     *istream,
-                       GMimeStream     *ostream,
-                       gpgme_protocol_t protocol,
-                       gboolean         singlepart_mode,
-                       gboolean         trust_all_keys,
-                       GtkWindow       *parent,
-                       GError         **error)
+libbalsa_gpgme_encrypt(GPtrArray * recipients, const char *sign_for,
+                      GMimeStream * istream, GMimeStream * ostream,
+                      gpgme_protocol_t protocol, gboolean singlepart_mode,
+                      gboolean trust_all_keys, GtkWindow * parent,
+                      GError ** error)
 {
     gpgme_ctx_t ctx;
     gpgme_error_t err;
@@ -524,10 +499,10 @@ libbalsa_gpgme_encrypt(GPtrArray       *recipients,
     gpgme_data_t plain;
     gpgme_data_t crypt;
     struct gpgme_data_cbs cbs = {
-        (gpgme_data_read_cb_t) g_mime_gpgme_stream_rd,  /* read method */
-        (gpgme_data_write_cb_t) g_mime_gpgme_stream_wr, /* write method */
-        NULL,                   /* seek method */
-        cb_data_release         /* release method */
+       (gpgme_data_read_cb_t) g_mime_gpgme_stream_rd,  /* read method */
+       (gpgme_data_write_cb_t) g_mime_gpgme_stream_wr, /* write method */
+       NULL,                   /* seek method */
+       cb_data_release         /* release method */
     };
 
     /* paranoia checks */
@@ -535,98 +510,94 @@ libbalsa_gpgme_encrypt(GPtrArray       *recipients,
     g_return_val_if_fail(GMIME_IS_STREAM(istream), FALSE);
     g_return_val_if_fail(GMIME_IS_STREAM(ostream), FALSE);
     g_return_val_if_fail(protocol == GPGME_PROTOCOL_OpenPGP ||
-                         protocol == GPGME_PROTOCOL_CMS, FALSE);
+                        protocol == GPGME_PROTOCOL_CMS, FALSE);
 
     /* create the GpgME context (passphrase callback required) */
     ctx = libbalsa_gpgme_new_with_proto(protocol, gpgme_passphrase_cb, parent, error);
     if (ctx == NULL) {
-        return FALSE;
+       return FALSE;
     }
 
     /* sign & encrypt is valid only for single-part OpenPGP */
-    if ((sign_for != NULL)
-        && (!singlepart_mode || (protocol != GPGME_PROTOCOL_OpenPGP))) {
-        if (error) {
-            g_set_error(error, GPGME_ERROR_QUARK, GPG_ERR_INV_ENGINE,
-                        _
-                            ("combined signing and encryption is defined only for RFC 2440"));
-        }
-        gpgme_release(ctx);
-        return FALSE;
+    if (sign_for != NULL
+       && (!singlepart_mode || protocol != GPGME_PROTOCOL_OpenPGP)) {
+       if (error)
+           g_set_error(error, GPGME_ERROR_QUARK, GPG_ERR_INV_ENGINE,
+                       _
+                       ("combined signing and encryption is defined only for RFC 2440"));
+       gpgme_release(ctx);
+       return FALSE;
     }
 
     /* if requested, find the secret key for "userid" */
     if (sign_for && !gpgme_add_signer(ctx, sign_for, parent, error)) {
-        gpgme_release(ctx);
-        return FALSE;
+       gpgme_release(ctx);
+       return FALSE;
     }
 
     /* build the list of recipients */
     if (!
-        (rcpt_keys =
-             gpgme_build_recipients(ctx, recipients, trust_all_keys, parent,
-                                    error))) {
-        gpgme_release(ctx);
-        return FALSE;
+       (rcpt_keys =
+        gpgme_build_recipients(ctx, recipients, trust_all_keys, parent,
+                               error))) {
+       gpgme_release(ctx);
+       return FALSE;
     }
 
     /* create the data objects */
     if (protocol == GPGME_PROTOCOL_OpenPGP) {
-        gpgme_set_armor(ctx, 1);
-        gpgme_set_textmode(ctx, singlepart_mode);
+       gpgme_set_armor(ctx, 1);
+       gpgme_set_textmode(ctx, singlepart_mode);
     } else {
-        gpgme_set_armor(ctx, 0);
-        gpgme_set_textmode(ctx, 0);
+       gpgme_set_armor(ctx, 0);
+       gpgme_set_textmode(ctx, 0);
     }
     if ((err =
-             gpgme_data_new_from_cbs(&plain, &cbs,
-                                     istream)) != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, err,
-                                 _("could not get data from stream"));
-        release_keylist(rcpt_keys);
-        gpgme_release(ctx);
-        return FALSE;
+        gpgme_data_new_from_cbs(&plain, &cbs,
+                                istream)) != GPG_ERR_NO_ERROR) {
+       libbalsa_gpgme_set_error(error, err,
+                              _("could not get data from stream"));
+       release_keylist(rcpt_keys);
+       gpgme_release(ctx);
+       return FALSE;
     }
     if ((err =
-             gpgme_data_new_from_cbs(&crypt, &cbs,
-                                     ostream)) != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, err,
-                                 _("could not create new data object"));
-        release_keylist(rcpt_keys);
-        gpgme_data_release(plain);
-        gpgme_release(ctx);
-        return FALSE;
+        gpgme_data_new_from_cbs(&crypt, &cbs,
+                                ostream)) != GPG_ERR_NO_ERROR) {
+       libbalsa_gpgme_set_error(error, err,
+                              _("could not create new data object"));
+       release_keylist(rcpt_keys);
+       gpgme_data_release(plain);
+       gpgme_release(ctx);
+       return FALSE;
     }
 
     /* do the encrypt or sign and encrypt operation
      * Note: we set "always trust" here, as if we detected an untrusted key
      * earlier, the user already accepted it */
-    if (sign_for) {
-        err =
-            gpgme_op_encrypt_sign(ctx, rcpt_keys,
-                                  GPGME_ENCRYPT_ALWAYS_TRUST, plain,
-                                  crypt);
-    } else {
-        err =
-            gpgme_op_encrypt(ctx, rcpt_keys, GPGME_ENCRYPT_ALWAYS_TRUST,
-                             plain, crypt);
-    }
+    if (sign_for)
+       err =
+           gpgme_op_encrypt_sign(ctx, rcpt_keys,
+                                 GPGME_ENCRYPT_ALWAYS_TRUST, plain,
+                                 crypt);
+    else
+       err =
+           gpgme_op_encrypt(ctx, rcpt_keys, GPGME_ENCRYPT_ALWAYS_TRUST,
+                            plain, crypt);
 
     release_keylist(rcpt_keys);
     gpgme_data_release(plain);
     gpgme_data_release(crypt);
     gpgme_release(ctx);
     if (err != GPG_ERR_NO_ERROR) {
-        if (sign_for) {
-            libbalsa_gpgme_set_error(error, err,
-                                     _("signing and encryption failed"));
-        } else {
-            libbalsa_gpgme_set_error(error, err, _("encryption failed"));
-        }
-        return FALSE;
-    } else {
-        return TRUE;
-    }
+       if (sign_for)
+               libbalsa_gpgme_set_error(error, err,
+                                  _("signing and encryption failed"));
+       else
+               libbalsa_gpgme_set_error(error, err, _("encryption failed"));
+       return FALSE;
+    } else
+       return TRUE;
 }
 
 
@@ -645,11 +616,9 @@ libbalsa_gpgme_encrypt(GPtrArray       *recipients,
  * be GPG_ERR_NOT_SIGNED.
  */
 GMimeGpgmeSigstat *
-libbalsa_gpgme_decrypt(GMimeStream     *crypted,
-                       GMimeStream     *plain,
-                       gpgme_protocol_t protocol,
-                       GtkWindow       *parent,
-                       GError         **error)
+libbalsa_gpgme_decrypt(GMimeStream * crypted, GMimeStream * plain,
+                      gpgme_protocol_t protocol, GtkWindow * parent,
+                      GError ** error)
 {
     gpgme_ctx_t ctx;
     gpgme_error_t err;
@@ -657,52 +626,52 @@ libbalsa_gpgme_decrypt(GMimeStream     *crypted,
     gpgme_data_t crypt_data;
     GMimeGpgmeSigstat *result;
     struct gpgme_data_cbs cbs = {
-        (gpgme_data_read_cb_t) g_mime_gpgme_stream_rd,  /* read method */
-        (gpgme_data_write_cb_t) g_mime_gpgme_stream_wr, /* write method */
-        NULL,                   /* seek method */
-        cb_data_release         /* release method */
+       (gpgme_data_read_cb_t) g_mime_gpgme_stream_rd,  /* read method */
+       (gpgme_data_write_cb_t) g_mime_gpgme_stream_wr, /* write method */
+       NULL,                   /* seek method */
+       cb_data_release         /* release method */
     };
 
     /* paranoia checks */
     g_return_val_if_fail(GMIME_IS_STREAM(crypted), NULL);
     g_return_val_if_fail(GMIME_IS_STREAM(plain), NULL);
     g_return_val_if_fail(protocol == GPGME_PROTOCOL_OpenPGP ||
-                         protocol == GPGME_PROTOCOL_CMS, NULL);
+                        protocol == GPGME_PROTOCOL_CMS, NULL);
 
     /* create the GpgME context (passphrase callback required) */
     ctx = libbalsa_gpgme_new_with_proto(protocol, gpgme_passphrase_cb, parent, error);
     if (ctx == NULL) {
-        return NULL;
+       return NULL;
     }
 
     /* create the data streams */
     if ((err =
-             gpgme_data_new_from_cbs(&crypt_data, &cbs,
-                                     crypted)) != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, err,
-                                 _("could not get data from stream"));
-        gpgme_release(ctx);
-        return NULL;
+        gpgme_data_new_from_cbs(&crypt_data, &cbs,
+                                crypted)) != GPG_ERR_NO_ERROR) {
+       libbalsa_gpgme_set_error(error, err,
+                              _("could not get data from stream"));
+       gpgme_release(ctx);
+       return NULL;
     }
     if ((err =
-             gpgme_data_new_from_cbs(&plain_data, &cbs,
-                                     plain)) != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, err,
-                                 _("could not create new data object"));
-        gpgme_data_release(crypt_data);
-        gpgme_release(ctx);
-        return NULL;
+        gpgme_data_new_from_cbs(&plain_data, &cbs,
+                                plain)) != GPG_ERR_NO_ERROR) {
+       libbalsa_gpgme_set_error(error, err,
+                              _("could not create new data object"));
+       gpgme_data_release(crypt_data);
+       gpgme_release(ctx);
+       return NULL;
     }
 
     /* try to decrypt */
     if ((err =
-             gpgme_op_decrypt_verify(ctx, crypt_data,
-                                     plain_data)) != GPG_ERR_NO_ERROR) {
-        libbalsa_gpgme_set_error(error, err, _("decryption failed"));
-        result = NULL;
+        gpgme_op_decrypt_verify(ctx, crypt_data,
+                                plain_data)) != GPG_ERR_NO_ERROR) {
+       libbalsa_gpgme_set_error(error, err, _("decryption failed"));
+       result = NULL;
     } else {
-        /* decryption successful, check for signature */
-        result = g_mime_gpgme_sigstat_new_from_gpgme_ctx(ctx);
+       /* decryption successful, check for signature */
+       result = g_mime_gpgme_sigstat_new_from_gpgme_ctx(ctx);
     }
 
     /* clean up */
@@ -722,35 +691,34 @@ libbalsa_gpgme_decrypt(GMimeStream     *crypted,
  * \param error Filled with error information on error
  * \return a newly allocated string containing the ASCII-armored public key on success
  *
- * Return the ASCII-armored key matching the passed pattern.  If necessary, the user is asked to
- * select a key from a list of
+ * Return the ASCII-armored key matching the passed pattern.  If necessary, the user is asked to select a 
key from a list of
  * multiple matching keys.
  */
 gchar *
-libbalsa_gpgme_get_pubkey(gpgme_protocol_t protocol,
-                          const gchar     *name,
-                          GtkWindow       *parent,
-                          GError         **error)
+libbalsa_gpgme_get_pubkey(gpgme_protocol_t   protocol,
+                                                 const gchar       *name,
+                                                 GtkWindow             *parent,
+                                                 GError           **error)
 {
-    gpgme_ctx_t ctx;
-    gchar *armored_key = NULL;
+       gpgme_ctx_t ctx;
+       gchar *armored_key = NULL;
 
-    g_return_val_if_fail(name != NULL, NULL);
+       g_return_val_if_fail(name != NULL, NULL);
 
-    ctx = libbalsa_gpgme_new_with_proto(protocol, NULL, NULL, error);
-    if (ctx != NULL) {
-        gpgme_error_t gpgme_err;
-        gpgme_key_t key = NULL;
-
-        gpgme_err = get_key_from_name(ctx, &key, name, FALSE, FALSE, parent, error);
-        if (gpgme_err == GPG_ERR_NO_ERROR) {
-            armored_key = libbalsa_gpgme_export_key(ctx, key, name, error);
-            gpgme_key_unref(key);
-        }
-        gpgme_release(ctx);
-    }
+       ctx = libbalsa_gpgme_new_with_proto(protocol, NULL, NULL, error);
+       if (ctx != NULL) {
+               gpgme_error_t gpgme_err;
+               gpgme_key_t key = NULL;
+
+               gpgme_err = get_key_from_name(ctx, &key, name, FALSE, FALSE, parent, error);
+               if (gpgme_err == GPG_ERR_NO_ERROR) {
+                       armored_key = libbalsa_gpgme_export_key(ctx, key, name, error);
+                       gpgme_key_unref(key);
+               }
+           gpgme_release(ctx);
+       }
 
-    return armored_key;
+       return armored_key;
 }
 
 
@@ -760,70 +728,60 @@ libbalsa_gpgme_get_pubkey(gpgme_protocol_t protocol,
  * \param name email address for which the key shall be selected
  * \param parent parent window to be passed to the callback functions
  * \param error Filled with error information on error
- * \return a newly allocated string containing the key id key on success, shall be freed by the
- * caller
+ * \return a newly allocated string containing the key id key on success, shall be freed by the caller
  *
- * Call libbalsa_gpgme_list_keys() to list all secret keys for the passed protocol, and \em
- * always call \ref select_key_cb to let
+ * Call libbalsa_gpgme_list_keys() to list all secret keys for the passed protocol, and \em always call \ref 
select_key_cb to let
  * the user choose the secret key, even if only one is available.
  */
 gchar *
-libbalsa_gpgme_get_seckey(gpgme_protocol_t protocol,
-                          const gchar     *name,
-                          GtkWindow       *parent,
-                          GError         **error)
+libbalsa_gpgme_get_seckey(gpgme_protocol_t   protocol,
+                                                 const gchar       *name,
+                                                 GtkWindow             *parent,
+                                                 GError           **error)
 {
-    gpgme_ctx_t ctx;
-    gchar *keyid = NULL;
-
-    ctx = libbalsa_gpgme_new_with_proto(protocol, NULL, NULL, error);
-    if (ctx != NULL) {
-        GList *keys = NULL;
-
-        /* let gpgme list all available keys */
-        if (libbalsa_gpgme_list_keys(ctx, &keys, NULL, name, TRUE, FALSE, error)) {
-            if (keys != NULL) {
-                gpgme_key_t key;
-
-                /* let the user select a key from the list, even if there is only one */
-                if (select_key_cb != NULL) {
-                    key =
-                        select_key_cb(name, LB_SELECT_PRIVATE_KEY, keys, gpgme_get_protocol(
-                                          ctx), parent);
-                    if (key != NULL) {
-                        gpgme_subkey_t subkey;
-
-                        for (subkey = key->subkeys;
-                             (subkey != NULL) && (keyid == NULL);
-                             subkey = subkey->next) {
-                            if ((subkey->can_sign != 0) && (subkey->expired == 0U) &&
-                                (subkey->revoked == 0U) &&
-                                (subkey->disabled == 0U) && (subkey->invalid == 0U)) {
-                                keyid = g_strdup(subkey->keyid);
-                            }
-                        }
-                    }
-                }
-                g_list_free_full(keys, (GDestroyNotify) gpgme_key_unref);
-            } else {
-                GtkWidget *dialog;
-
-                dialog = gtk_message_dialog_new(parent,
-                                                GTK_DIALOG_DESTROY_WITH_PARENT | libbalsa_dialog_flags(),
-                                                GTK_MESSAGE_INFO,
-                                                GTK_BUTTONS_CLOSE,
-                                                _(
-                                                    "No private key for protocol %s is available for the 
signer “%s”"),
-                                                gpgme_get_protocol_name(protocol),
-                                                name);
-                (void) gtk_dialog_run(GTK_DIALOG(dialog));
-                gtk_widget_destroy(dialog);
-            }
-        }
-        gpgme_release(ctx);
-    }
-
-    return keyid;
+       gpgme_ctx_t ctx;
+       gchar *keyid = NULL;
+
+       ctx = libbalsa_gpgme_new_with_proto(protocol, NULL, NULL, error);
+       if (ctx != NULL) {
+               GList *keys = NULL;
+
+               /* let gpgme list all available keys */
+               if (libbalsa_gpgme_list_keys(ctx, &keys, NULL, name, TRUE, FALSE, error)) {
+                       if (keys != NULL) {
+                               gpgme_key_t key;
+
+                               /* let the user select a key from the list, even if there is only one */
+                               if (select_key_cb != NULL) {
+                                       key = select_key_cb(name, LB_SELECT_PRIVATE_KEY, keys, 
gpgme_get_protocol(ctx), parent);
+                                       if (key != NULL) {
+                                               gpgme_subkey_t subkey;
+
+                                               for (subkey = key->subkeys; (subkey != NULL) && (keyid == 
NULL); subkey = subkey->next) {
+                                                       if ((subkey->can_sign != 0) && (subkey->expired == 
0U) && (subkey->revoked == 0U) &&
+                                                               (subkey->disabled == 0U) && (subkey->invalid 
== 0U)) {
+                                                               keyid = g_strdup(subkey->keyid);
+                                                       }
+                                               }
+                                       }
+                               }
+                               g_list_free_full(keys, (GDestroyNotify) gpgme_key_unref);
+                       } else {
+                               GtkWidget *dialog;
+
+                               dialog = gtk_message_dialog_new(parent,
+                                       GTK_DIALOG_DESTROY_WITH_PARENT | libbalsa_dialog_flags(),
+                                       GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
+                                       _("No private key for protocol %s is available for the signer “%s”"),
+                                       gpgme_get_protocol_name(protocol), name);
+                               (void) gtk_dialog_run(GTK_DIALOG(dialog));
+                               gtk_widget_destroy(dialog);
+                       }
+               }
+           gpgme_release(ctx);
+       }
+
+       return keyid;
 }
 
 
@@ -831,13 +789,13 @@ libbalsa_gpgme_get_seckey(gpgme_protocol_t protocol,
  * set a GError form GpgME information
  */
 void
-libbalsa_gpgme_set_error(GError      **error,
-                         gpgme_error_t gpgme_err,
-                         const gchar  *format,
-                         ...)
+libbalsa_gpgme_set_error(GError        **error,
+                                            gpgme_error_t   gpgme_err,
+                                                const gchar    *format,
+                                                ...)
 {
     if (error != NULL) {
-        gchar errbuf[4096];             /* should be large enough... */
+       gchar errbuf[4096];             /* should be large enough... */
         gchar *errstr;
         gchar *srcstr;
         gchar *msgstr;
@@ -862,19 +820,19 @@ libbalsa_gpgme_set_error(GError      **error,
 static gchar *
 utf8_valid_str(const char *gpgme_str)
 {
-    gchar *result;
-
-    if (gpgme_str != NULL) {
-        if (g_utf8_validate(gpgme_str, -1, NULL)) {
-            result = g_strdup(gpgme_str);
-        } else {
-            gsize bytes_written;
-            result = g_locale_to_utf8(gpgme_str, -1, NULL, &bytes_written, NULL);
-        }
-    } else {
-        result = NULL;
-    }
-    return result;
+       gchar *result;
+
+       if (gpgme_str != NULL) {
+               if (g_utf8_validate(gpgme_str, -1, NULL)) {
+                       result = g_strdup(gpgme_str);
+               } else {
+                       gsize bytes_written;
+                       result = g_locale_to_utf8(gpgme_str, -1, NULL, &bytes_written, NULL);
+               }
+       } else {
+               result = NULL;
+       }
+       return result;
 }
 
 
@@ -882,16 +840,13 @@ utf8_valid_str(const char *gpgme_str)
  * callback to get data from a stream
  */
 static ssize_t
-g_mime_gpgme_stream_rd(GMimeStream *stream,
-                       void        *buffer,
-                       size_t       size)
+g_mime_gpgme_stream_rd(GMimeStream * stream, void *buffer, size_t size)
 {
     ssize_t result;
 
     result = g_mime_stream_read(stream, buffer, size);
-    if ((result == -1) && g_mime_stream_eos(stream)) {
-        result = 0;
-    }
+    if (result == -1 && g_mime_stream_eos(stream))
+       result = 0;
 
     return result;
 }
@@ -901,9 +856,7 @@ g_mime_gpgme_stream_rd(GMimeStream *stream,
  * callback to write data to a stream
  */
 static ssize_t
-g_mime_gpgme_stream_wr(GMimeStream *stream,
-                       void        *buffer,
-                       size_t       size)
+g_mime_gpgme_stream_wr(GMimeStream * stream, void *buffer, size_t size)
 {
     return g_mime_stream_write(stream, buffer, size);
 }
@@ -924,113 +877,98 @@ cb_data_release(void *handle)
  * \param ctx GpgME context
  * \param key filled with the key on success
  * \param name pattern (mail address or fingerprint) of the requested key
- * \param secret TRUE to select a secret (private) key for signing, FALSE to select a public key
- * for encryption
+ * \param secret TRUE to select a secret (private) key for signing, FALSE to select a public key for 
encryption
  * \param accept_all TRUE to accept a low-trust public key without confirmation
  * \param parent transient parent window
  * \param error filled with a human-readable error on error, may be NULL
- * \return GPG_ERR_GENERAL if listing the keys failed, GPG_ERR_NO_KEY if no suitable key is
- * available, GPG_ERR_CANCELED if the user
- *         cancelled the operation, GPG_ERR_AMBIGUOUS if multiple keys exist, or
- * GPG_ERR_NOT_TRUSTED if the key is not trusted
+ * \return GPG_ERR_GENERAL if listing the keys failed, GPG_ERR_NO_KEY if no suitable key is available, 
GPG_ERR_CANCELED if the user
+ *         cancelled the operation, GPG_ERR_AMBIGUOUS if multiple keys exist, or GPG_ERR_NOT_TRUSTED if the 
key is not trusted
  *
- * Get a key for a name or a fingerprint.  A name will always be enclosed in "<...>" to get an
- * exact match.  If \em secret is set,
- * choose only secret (private) keys (signing).  Otherwise, choose only public keys
- *(encryption).  If multiple keys would match,
- * call the key selection CB \ref select_key_cb (if present).  If no matching key could be found
- * or if any error occurs, return an
+ * Get a key for a name or a fingerprint.  A name will always be enclosed in "<...>" to get an exact match.  
If \em secret is set,
+ * choose only secret (private) keys (signing).  Otherwise, choose only public keys (encryption).  If 
multiple keys would match,
+ * call the key selection CB \ref select_key_cb (if present).  If no matching key could be found or if any 
error occurs, return an
  * appropriate error code.
  */
 static gpgme_error_t
-get_key_from_name(gpgme_ctx_t  ctx,
-                  gpgme_key_t *key,
-                  const gchar *name,
-                  gboolean     secret,
-                  gboolean     accept_all,
-                  GtkWindow   *parent,
-                  GError     **error)
+get_key_from_name(gpgme_ctx_t   ctx,
+                                 gpgme_key_t  *key,
+                                 const gchar  *name,
+                                 gboolean      secret,
+                                 gboolean      accept_all,
+                                 GtkWindow    *parent,
+                                 GError      **error)
 {
-    gchar *mail_name;
-    gboolean list_res;
-    GList *keys = NULL;
-    gpgme_key_t selected;
-    guint bad_keys = 0U;
-    gpgme_error_t result;
-
-    /* enclose a mail address into "<...>" to perform an exact search */
-    if (strchr(name, '@') != NULL) {
-        mail_name = g_strconcat("<", name, ">", NULL);
-    } else {
-        mail_name = g_strdup(name);
-    }
-
-    /* let gpgme list keys */
-    list_res = libbalsa_gpgme_list_keys(ctx, &keys, &bad_keys, mail_name, secret, FALSE, error);
-    g_free(mail_name);
-    if (!list_res) {
-        return GPG_ERR_GENERAL;
-    }
-
-    if (keys == NULL) {
-        if (bad_keys > 0U) {
-            g_set_error(error, GPGME_ERROR_QUARK, GPG_ERR_KEY_SELECTION,
-                        _(
-                            "A key for “%s” is present, but it is expired, disabled, revoked or invalid"),
-                        name);
-        } else {
-            g_set_error(error, GPGME_ERROR_QUARK, GPG_ERR_KEY_SELECTION,
-                        _("Could not find a key for “%s”"), name);
-        }
-        return secret ? GPG_ERR_NO_SECKEY : GPG_ERR_NO_PUBKEY;
-    }
-
-    /* let the user select a key from the list if there is more than one */
-    result = GPG_ERR_NO_ERROR;
-    if (g_list_length(keys) > 1U) {
-        if (select_key_cb != NULL) {
-            selected = select_key_cb(name,
-                                     secret ? LB_SELECT_PRIVATE_KEY : LB_SELECT_PUBLIC_KEY_USER,
-                                     keys,
-                                     gpgme_get_protocol(ctx),
-                                     parent);
-            if (selected == NULL) {
-                result = GPG_ERR_CANCELED;
-            }
-        } else {
-            g_set_error(error, GPGME_ERROR_QUARK, GPG_ERR_KEY_SELECTION,
-                        _("Multiple keys for “%s”"), name);
-            selected = NULL;
-            result = GPG_ERR_AMBIGUOUS;
-        }
-    } else {
-        selected = (gpgme_key_t) keys->data;
-    }
-
-    /* ref the selected key, free all others and the list */
-    if (selected != NULL) {
-        gpgme_key_ref(selected);
-    }
-    g_list_free_full(keys, (GDestroyNotify) gpgme_key_unref);
-
-    /* OpenPGP: ask the user if a low-validity key should be trusted for encryption (Note:
-       owner_trust is not applicable to
-     * S/MIME certificates) */
-    if ((selected != NULL) &&
-        (result == GPG_ERR_NO_ERROR) && !secret && !accept_all &&
-        (gpgme_get_protocol(ctx) == GPGME_PROTOCOL_OpenPGP) &&
-        (selected->owner_trust < GPGME_VALIDITY_FULL)) {
-        if ((accept_low_trust_cb == NULL) || !accept_low_trust_cb(name, selected, parent)) {
-            gpgme_key_unref(selected);
-            selected = NULL;
-            g_set_error(error, GPGME_ERROR_QUARK, GPG_ERR_KEY_SELECTION,
-                        _("Insufficient key validity"));
-            result = GPG_ERR_NOT_TRUSTED;
-        }
-    }
-
-    *key = selected;
-    return result;
+       gchar *mail_name;
+       gboolean list_res;
+       GList *keys = NULL;
+       gpgme_key_t selected;
+       guint bad_keys = 0U;
+       gpgme_error_t result;
+
+       /* enclose a mail address into "<...>" to perform an exact search */
+       if (strchr(name, '@') != NULL) {
+               mail_name = g_strconcat("<", name, ">", NULL);
+       } else {
+               mail_name = g_strdup(name);
+       }
+
+       /* let gpgme list keys */
+       list_res = libbalsa_gpgme_list_keys(ctx, &keys, &bad_keys, mail_name, secret, FALSE, error);
+       g_free(mail_name);
+       if (!list_res) {
+               return GPG_ERR_GENERAL;
+       }
+
+       if (keys == NULL) {
+               if (bad_keys > 0U) {
+                       g_set_error(error, GPGME_ERROR_QUARK, GPG_ERR_KEY_SELECTION,
+                               _("A key for “%s” is present, but it is expired, disabled, revoked or 
invalid"), name);
+               } else {
+                       g_set_error(error, GPGME_ERROR_QUARK, GPG_ERR_KEY_SELECTION,
+                               _("Could not find a key for “%s”"), name);
+               }
+               return secret ? GPG_ERR_NO_SECKEY : GPG_ERR_NO_PUBKEY;
+       }
+
+       /* let the user select a key from the list if there is more than one */
+       result = GPG_ERR_NO_ERROR;
+       if (g_list_length(keys) > 1U) {
+               if (select_key_cb != NULL) {
+                       selected = select_key_cb(name, secret ? LB_SELECT_PRIVATE_KEY : 
LB_SELECT_PUBLIC_KEY_USER,
+                               keys, gpgme_get_protocol(ctx), parent);
+                       if (selected == NULL) {
+                               result = GPG_ERR_CANCELED;
+                       }
+               } else {
+                       g_set_error(error, GPGME_ERROR_QUARK, GPG_ERR_KEY_SELECTION, _("Multiple keys for 
“%s”"), name);
+                       selected = NULL;
+                       result = GPG_ERR_AMBIGUOUS;
+               }
+       } else {
+               selected = (gpgme_key_t) keys->data;
+       }
+
+       /* ref the selected key, free all others and the list */
+       if (selected != NULL) {
+               gpgme_key_ref(selected);
+       }
+       g_list_free_full(keys, (GDestroyNotify) gpgme_key_unref);
+
+       /* OpenPGP: ask the user if a low-validity key should be trusted for encryption (Note: owner_trust is 
not applicable to
+        * S/MIME certificates) */
+       if ((selected != NULL) &&
+                (result == GPG_ERR_NO_ERROR) && !secret && !accept_all && (gpgme_get_protocol(ctx) == 
GPGME_PROTOCOL_OpenPGP) &&
+               (selected->owner_trust < GPGME_VALIDITY_FULL)) {
+               if ((accept_low_trust_cb == NULL) || !accept_low_trust_cb(name, selected, parent)) {
+                       gpgme_key_unref(selected);
+                       selected = NULL;
+                       g_set_error(error, GPGME_ERROR_QUARK, GPG_ERR_KEY_SELECTION, _("Insufficient key 
validity"));
+                       result = GPG_ERR_NOT_TRUSTED;
+               }
+       }
+
+       *key = selected;
+       return result;
 }
 
 
@@ -1042,34 +980,32 @@ get_key_from_name(gpgme_ctx_t  ctx,
  * \param error filled with a human-readable error on error, may be NULL
  * \return the selected key or NULL if the user cancelled the operation
  *
- * This helper function loads all available keys and calls \ref select_key_cb to let the user
- * choose one of them.
+ * This helper function loads all available keys and calls \ref select_key_cb to let the user choose one of 
them.
  */
 static gpgme_key_t
-get_pubkey(gpgme_ctx_t  ctx,
-           const gchar *name,
-           GtkWindow   *parent,
-           GError     **error)
+get_pubkey(gpgme_ctx_t   ctx,
+                  const gchar  *name,
+                  GtkWindow    *parent,
+                  GError      **error)
 {
-    GList *keys = NULL;
-    gpgme_key_t key = NULL;
-
-    /* let gpgme list all available keys */
-    if (libbalsa_gpgme_list_keys(ctx, &keys, NULL, NULL, FALSE, FALSE, error)) {
-        if (keys != NULL) {
-            /* let the user select a key from the list, even if there is only one */
-            if (select_key_cb != NULL) {
-                key = select_key_cb(name, LB_SELECT_PUBLIC_KEY_ANY, keys, gpgme_get_protocol(
-                                        ctx), parent);
-                if (key != NULL) {
-                    gpgme_key_ref(key);
-                }
-            }
-            g_list_free_full(keys, (GDestroyNotify) gpgme_key_unref);
-        }
-    }
-
-    return key;
+       GList *keys = NULL;
+       gpgme_key_t key = NULL;
+
+       /* let gpgme list all available keys */
+       if (libbalsa_gpgme_list_keys(ctx, &keys, NULL, NULL, FALSE, FALSE, error)) {
+               if (keys != NULL) {
+                       /* let the user select a key from the list, even if there is only one */
+                       if (select_key_cb != NULL) {
+                               key = select_key_cb(name, LB_SELECT_PUBLIC_KEY_ANY, keys, 
gpgme_get_protocol(ctx), parent);
+                               if (key != NULL) {
+                                       gpgme_key_ref(key);
+                               }
+                       }
+                       g_list_free_full(keys, (GDestroyNotify) gpgme_key_unref);
+               }
+       }
+
+       return key;
 }
 
 
@@ -1084,22 +1020,21 @@ get_pubkey(gpgme_ctx_t  ctx,
  * Add the signer's key to the list of signers of the passed context.
  */
 static gboolean
-gpgme_add_signer(gpgme_ctx_t  ctx,
-                 const gchar *signer,
-                 GtkWindow   *parent,
-                 GError     **error)
+gpgme_add_signer(gpgme_ctx_t   ctx,
+                                const gchar  *signer,
+                                GtkWindow    *parent,
+                                GError      **error)
 {
-    gpgme_error_t result;
-    gpgme_key_t key = NULL;
+       gpgme_error_t result;
+       gpgme_key_t key = NULL;
 
     /* note: private (secret) key has never low trust... */
-    result = get_key_from_name(ctx, &key, signer, TRUE, FALSE, parent, error);
-    if (result == GPG_ERR_NO_ERROR) {
-        /* set the key (the previous operation guaranteed that it exists, no need 2 check return
-           values...) */
-        (void) gpgme_signers_add(ctx, key);
-        gpgme_key_unref(key);
-    }
+       result = get_key_from_name(ctx, &key, signer, TRUE, FALSE, parent, error);
+       if (result == GPG_ERR_NO_ERROR) {
+               /* set the key (the previous operation guaranteed that it exists, no need 2 check return 
values...) */
+               (void) gpgme_signers_add(ctx, key);
+               gpgme_key_unref(key);
+       }
 
     return (result == GPG_ERR_NO_ERROR);
 }
@@ -1112,54 +1047,49 @@ gpgme_add_signer(gpgme_ctx_t  ctx,
  * \param accept_low_trust TRUE to accept low-trust keys without confirmation
  * \param parent transient parent window
  * \param error filled with a human-readable error on error, may be NULL
- * \return a newly allocated, NULL-terminated array of keys on success, NULL if any error
- * occurred
+ * \return a newly allocated, NULL-terminated array of keys on success, NULL if any error occurred
  *
  * Build an array of keys for all recipients in rcpt_list and return it.
  *
  * \note The caller shall free the returned list by calling release_keylist().
  */
 static gpgme_key_t *
-gpgme_build_recipients(gpgme_ctx_t ctx,
-                       GPtrArray  *rcpt_list,
-                       gboolean    accept_low_trust,
-                       GtkWindow  *parent,
-                       GError    **error)
+gpgme_build_recipients(gpgme_ctx_t   ctx,
+                                          GPtrArray    *rcpt_list,
+                                          gboolean      accept_low_trust,
+                                          GtkWindow    *parent,
+                                          GError      **error)
 {
-    gpgme_key_t *rcpt = g_new0(gpgme_key_t, rcpt_list->len + 1U);
-    gpgme_error_t select_res;
-    guint num_rcpts;
-
-    /* try to find the public key for every recipient */
-    select_res = GPG_ERR_NO_ERROR;
-    for (num_rcpts = 0U;
-         (select_res == GPG_ERR_NO_ERROR) && (num_rcpts < rcpt_list->len);
-         num_rcpts++) {
-        gchar *name = (gchar *) g_ptr_array_index(rcpt_list, num_rcpts);
-        gpgme_key_t key = NULL;
-
-        select_res = get_key_from_name(ctx, &key, name, FALSE, accept_low_trust, parent, error);
-
-        /* if no public key exists for the user, as fallback list all keys so an other one may
-           be selected */
-        if (select_res == GPG_ERR_NO_PUBKEY) {
-            key = get_pubkey(ctx, name, parent, error);
-            if (key != NULL) {
-                select_res = GPG_ERR_NO_ERROR;                          /* got one, clear error
-                                                                           state */
-            }
-        }
-
-        /* set the recipient */
-        rcpt[num_rcpts] = key;
-    }
-
-    if (select_res != GPG_ERR_NO_ERROR) {
-        release_keylist(rcpt);
-        rcpt = NULL;
-    }
-
-    return rcpt;
+       gpgme_key_t *rcpt = g_new0(gpgme_key_t, rcpt_list->len + 1U);
+       gpgme_error_t select_res;
+       guint num_rcpts;
+
+       /* try to find the public key for every recipient */
+       select_res = GPG_ERR_NO_ERROR;
+       for (num_rcpts = 0U; (select_res == GPG_ERR_NO_ERROR) && (num_rcpts < rcpt_list->len); num_rcpts++) {
+               gchar *name = (gchar *) g_ptr_array_index(rcpt_list, num_rcpts);
+               gpgme_key_t key = NULL;
+
+               select_res = get_key_from_name(ctx, &key, name, FALSE, accept_low_trust, parent, error);
+
+               /* if no public key exists for the user, as fallback list all keys so an other one may be 
selected */
+               if (select_res == GPG_ERR_NO_PUBKEY) {
+                       key = get_pubkey(ctx, name, parent, error);
+                       if (key != NULL) {
+                               select_res = GPG_ERR_NO_ERROR;          /* got one, clear error state */
+                       }
+               }
+
+               /* set the recipient */
+               rcpt[num_rcpts] = key;
+       }
+
+       if (select_res != GPG_ERR_NO_ERROR) {
+               release_keylist(rcpt);
+               rcpt = NULL;
+       }
+
+       return rcpt;
 }
 
 
@@ -1168,13 +1098,13 @@ gpgme_build_recipients(gpgme_ctx_t ctx,
  * finally release the array itself
  */
 static void
-release_keylist(gpgme_key_t *keylist)
+release_keylist(gpgme_key_t * keylist)
 {
     gpgme_key_t *key = keylist;
 
     while (*key) {
-        gpgme_key_unref(*key);
-        key++;
+       gpgme_key_unref(*key);
+       key++;
     }
     g_free(keylist);
 }
@@ -1188,21 +1118,17 @@ static const gchar *
 get_utf8_locale(int category)
 {
     gchar *locale;
-    static gchar localebuf[64]; /* should be large enough */
+    static gchar localebuf[64];        /* should be large enough */
     gchar *dot;
 
-    if (!(locale = setlocale(category, NULL))) {
-        return NULL;
-    }
+    if (!(locale = setlocale(category, NULL)))
+       return NULL;
     strncpy(localebuf, locale, 57);
     localebuf[57] = '\0';
     dot = strchr(localebuf, '.');
-    if (!dot) {
-        dot = localebuf + strlen(localebuf);
-    }
+    if (!dot)
+       dot = localebuf + strlen(localebuf);
     strcpy(dot, ".UTF-8");
     return localebuf;
 }
-
-
 #endif
diff --git a/libbalsa/libbalsa-gpgme.h b/libbalsa/libbalsa-gpgme.h
index 6d5b4e6..8a52164 100644
--- a/libbalsa/libbalsa-gpgme.h
+++ b/libbalsa/libbalsa-gpgme.h
@@ -22,7 +22,7 @@
 
 
 #ifdef HAVE_CONFIG_H
-#   include <config.h>
+#include <config.h>
 #endif
 
 #include <gpgme.h>
@@ -52,11 +52,11 @@ G_BEGIN_DECLS
  * - parent window
  * Return: the key the user selected, or NULL if the operation shall be cancelled
  */
-typedef gpgme_key_t (*lbgpgme_select_key_cb) (const gchar *,
-                                              lb_key_sel_md_t,
-                                              GList *,
-                                              gpgme_protocol_t,
-                                              GtkWindow *);
+typedef gpgme_key_t(*lbgpgme_select_key_cb) (const gchar *,
+                                                                                        lb_key_sel_md_t,
+                                                                                        GList *,
+                                                                                        gpgme_protocol_t,
+                                                                                        GtkWindow *);
 
 /** Callback to ask the user whether a key with low trust shall be accepted
  * Parameters:
@@ -65,77 +65,75 @@ typedef gpgme_key_t (*lbgpgme_select_key_cb) (const gchar *,
  * - parent window
  * Return: TRUE to accept the key, FALSE to reject it
  */
-typedef gboolean (*lbgpgme_accept_low_trust_cb) (const gchar *,
-                                                 gpgme_key_t,
-                                                 GtkWindow *);
+typedef gboolean(*lbgpgme_accept_low_trust_cb) (const gchar *,
+                                                                                               gpgme_key_t,
+                                                                                               GtkWindow *);
 
 
 
 void libbalsa_gpgme_init(gpgme_passphrase_cb_t       get_passphrase,
-                         lbgpgme_select_key_cb       select_key_cb,
-                         lbgpgme_accept_low_trust_cb accept_low_trust);
+                                                lbgpgme_select_key_cb       select_key_cb,
+                                                lbgpgme_accept_low_trust_cb accept_low_trust);
 gboolean libbalsa_gpgme_check_crypto_engine(gpgme_protocol_t protocol);
-gpgme_ctx_t libbalsa_gpgme_new_with_proto(gpgme_protocol_t      protocol,
-                                          gpgme_passphrase_cb_t callback,
-                                          GtkWindow            *parent,
-                                          GError              **error)
-G_GNUC_WARN_UNUSED_RESULT;
-gboolean libbalsa_gpgme_ctx_set_home(gpgme_ctx_t  ctx,
-                                     const gchar *home_dir,
-                                     GError     **error);
-
-GMimeGpgmeSigstat *libbalsa_gpgme_verify(GMimeStream     *content,
-                                         GMimeStream     *sig_plain,
-                                         gpgme_protocol_t protocol,
-                                         gboolean         singlepart_mode,
-                                         GError         **error)
-G_GNUC_WARN_UNUSED_RESULT;
-
-gpgme_hash_algo_t libbalsa_gpgme_sign(const gchar     *userid,
-                                      GMimeStream     *istream,
-                                      GMimeStream     *ostream,
-                                      gpgme_protocol_t protocol,
-                                      gboolean         singlepart_mode,
-                                      GtkWindow       *parent,
-                                      GError         **error);
-
-gboolean libbalsa_gpgme_encrypt(GPtrArray       *recipients,
-                                const char      *sign_for,
-                                GMimeStream     *istream,
-                                GMimeStream     *ostream,
-                                gpgme_protocol_t protocol,
-                                gboolean         singlepart_mode,
-                                gboolean         trust_all_keys,
-                                GtkWindow       *parent,
-                                GError         **error);
-
-GMimeGpgmeSigstat *libbalsa_gpgme_decrypt(GMimeStream     *crypted,
-                                          GMimeStream     *plain,
-                                          gpgme_protocol_t protocol,
-                                          GtkWindow       *parent,
-                                          GError         **error)
-G_GNUC_WARN_UNUSED_RESULT;
-
-gchar *libbalsa_gpgme_get_pubkey(gpgme_protocol_t protocol,
-                                 const gchar     *name,
-                                 GtkWindow       *parent,
-                                 GError         **error)
-G_GNUC_WARN_UNUSED_RESULT;
-
-gchar *libbalsa_gpgme_get_seckey(gpgme_protocol_t protocol,
-                                 const gchar     *name,
-                                 GtkWindow       *parent,
-                                 GError         **error)
-G_GNUC_WARN_UNUSED_RESULT;
-
-void libbalsa_gpgme_set_error(GError      **error,
-                              gpgme_error_t gpgme_err,
-                              const gchar  *format,
-                              ...)
-G_GNUC_PRINTF(3, 4);
+gpgme_ctx_t libbalsa_gpgme_new_with_proto(gpgme_protocol_t        protocol,
+                                                                                 gpgme_passphrase_cb_t   
callback,
+                                                                                 GtkWindow                   
           *parent,
+                                                                                 GError                
**error)
+       G_GNUC_WARN_UNUSED_RESULT;
+gboolean libbalsa_gpgme_ctx_set_home(gpgme_ctx_t   ctx,
+                                                                        const gchar  *home_dir,
+                                                                        GError      **error);
+
+GMimeGpgmeSigstat *libbalsa_gpgme_verify(GMimeStream * content,
+                                        GMimeStream * sig_plain,
+                                        gpgme_protocol_t protocol,
+                                        gboolean singlepart_mode,
+                                        GError ** error)
+       G_GNUC_WARN_UNUSED_RESULT;
+
+gpgme_hash_algo_t libbalsa_gpgme_sign(const gchar * userid,
+                                     GMimeStream * istream,
+                                     GMimeStream * ostream,
+                                     gpgme_protocol_t protocol,
+                                     gboolean singlepart_mode,
+                                     GtkWindow * parent, GError ** error);
+
+gboolean libbalsa_gpgme_encrypt(GPtrArray * recipients,
+                          const char *sign_for,
+                          GMimeStream * istream,
+                          GMimeStream * ostream,
+                          gpgme_protocol_t protocol,
+                          gboolean singlepart_mode,
+                          gboolean trust_all_keys,
+                          GtkWindow * parent, GError ** error);
+
+GMimeGpgmeSigstat *libbalsa_gpgme_decrypt(GMimeStream * crypted,
+                                         GMimeStream * plain,
+                                         gpgme_protocol_t protocol,
+                                         GtkWindow * parent,
+                                         GError ** error)
+       G_GNUC_WARN_UNUSED_RESULT;
+
+gchar *libbalsa_gpgme_get_pubkey(gpgme_protocol_t   protocol,
+                                                                const gchar       *name,
+                                                                GtkWindow                 *parent,
+                                                                GError           **error)
+       G_GNUC_WARN_UNUSED_RESULT;
+
+gchar *libbalsa_gpgme_get_seckey(gpgme_protocol_t   protocol,
+                                                                const gchar       *name,
+                                                                GtkWindow                 *parent,
+                                                                GError           **error)
+       G_GNUC_WARN_UNUSED_RESULT;
+
+void libbalsa_gpgme_set_error(GError        **error,
+                                                 gpgme_error_t   gpgme_err,
+                                                         const gchar    *format,
+                                                         ...)
+       G_GNUC_PRINTF(3, 4);
 
 
 G_END_DECLS
 
 
-#endif                          /* LIBBALSA_GPGME_H_ */
+#endif                         /* LIBBALSA_GPGME_H_ */
diff --git a/libbalsa/libbalsa-progress.c b/libbalsa/libbalsa-progress.c
index 5c3894a..4a19da3 100644
--- a/libbalsa/libbalsa-progress.c
+++ b/libbalsa/libbalsa-progress.c
@@ -23,148 +23,141 @@
 #include "libbalsa.h"
 
 
-/* note: this value is forced as minimum and maximum width of the dialogue, which may be wrong
-   for /very/ high-resolution screens */
-#define PROGRESS_DIALOG_WIDTH           320
-#define FADER_DURATION                          500U
-#define ACTIVITY_DURATION                       100U
+/* note: this value is forced as minimum and maximum width of the dialogue, which may be wrong for /very/ 
high-resolution screens */
+#define PROGRESS_DIALOG_WIDTH          320
+#define FADER_DURATION                         500U
+#define ACTIVITY_DURATION                      100U
 
 
 typedef struct {
-    ProgressDialog *dialog;
-    const gchar *title;
-    GtkWindow *parent;
-    const gchar *id;
-    gboolean done;
-    GCond cond;
+       ProgressDialog *dialog;
+       const gchar    *title;
+       GtkWindow      *parent;
+       const gchar    *id;
+       gboolean        done;
+       GCond           cond;
 } create_progress_dlg_t;
 
 
 typedef struct {
-    ProgressDialog *dialog;
-    gchar *id;
-    gboolean finished;
-    gchar *message;
-    gdouble fraction;
+       ProgressDialog *dialog;
+       gchar          *id;
+       gboolean        finished;
+       gchar              *message;
+       gdouble         fraction;
 } update_progress_data_t;
 
 
 typedef struct {
-    GtkWidget *revealer;
-    GtkWidget *progress;
-    GtkWidget *label;
-    guint activity_id;
-    guint fadeout_id;
+       GtkWidget *revealer;
+       GtkWidget *progress;
+       GtkWidget *label;
+       guint      activity_id;
+       guint      fadeout_id;
 } progress_widget_data_t;
 
 
 static void libbalsa_progress_dialog_ensure_real(ProgressDialog *progress_dialog,
-                                                 const gchar    *dialog_title,
-                                                 GtkWindow      *parent,
-                                                 const gchar    *progress_id);
+                                                                                    const gchar    
*dialog_title,
+                                                                                                GtkWindow    
  *parent,
+                                                                                                const gchar  
  *progress_id);
 static gboolean libbalsa_progress_dialog_create_cb(create_progress_dlg_t *dlg_data);
 
 static void progress_dialog_response_cb(GtkWidget *dialog,
-                                        gint       response);
+                                           gint       response);
 static void progress_dialog_destroy_cb(GtkWidget G_GNUC_UNUSED *widget,
-                                       ProgressDialog          *progress_dialog);
+                                                                          ProgressDialog          
*progress_dialog);
 static progress_widget_data_t *find_progress_data_by_name(GtkContainer *container,
-                                                          const gchar  *id);
+                                                                                                             
    const gchar  *id);
 static GtkWidget *create_progress_widget(const gchar *progress_id)
-G_GNUC_WARN_UNUSED_RESULT;
+       G_GNUC_WARN_UNUSED_RESULT;
 static gboolean remove_progress_widget(progress_widget_data_t *progress_data);
 static void libbalsa_progress_dialog_update_real(ProgressDialog *progress_dialog,
-                                                 const gchar    *progress_id,
-                                                 gboolean        finished,
-                                                 gdouble         fraction,
-                                                 const gchar    *message);
+                                                                                                const gchar  
  *progress_id,
+                                                                                                gboolean     
   finished,
+                                                                                                gdouble      
   fraction,
+                                                                                                const gchar  
  *message);
 static gboolean libbalsa_progress_dialog_update_cb(update_progress_data_t *upd_data);
 static gboolean progress_activity(GtkProgressBar *progress);
 
 
 void
 libbalsa_progress_dialog_ensure(ProgressDialog *progress_dialog,
-                                const gchar    *dialog_title,
-                                GtkWindow      *parent,
-                                const gchar    *progress_id)
+                                                               const gchar    *dialog_title,
+                                                               GtkWindow      *parent,
+                                                               const gchar    *progress_id)
 {
-    g_return_if_fail(
-        (progress_dialog != NULL) && (dialog_title != NULL) && (progress_id != NULL));
-
-    g_mutex_lock(&progress_dialog->mutex);
-
-    if (libbalsa_am_i_subthread()) {
-        create_progress_dlg_t dlgdata;
-
-        /* shift the work to an idle callback, and return only after it has been run */
-        dlgdata.dialog = progress_dialog;
-        dlgdata.title = dialog_title;
-        dlgdata.parent = parent;
-        dlgdata.id = progress_id;
-        dlgdata.done = FALSE;
-        g_cond_init(&dlgdata.cond);
-        g_idle_add((GSourceFunc) libbalsa_progress_dialog_create_cb, &dlgdata);
-
-        while (!dlgdata.done) {
-            g_cond_wait(&dlgdata.cond, &progress_dialog->mutex);
-        }
-        g_cond_clear(&dlgdata.cond);
-    } else {
-        libbalsa_progress_dialog_ensure_real(progress_dialog, dialog_title, parent,
-                                             progress_id);
-    }
-
-    g_mutex_unlock(&progress_dialog->mutex);
+       g_return_if_fail((progress_dialog != NULL) && (dialog_title != NULL) && (progress_id != NULL));
+
+       g_mutex_lock(&progress_dialog->mutex);
+
+       if (libbalsa_am_i_subthread()) {
+               create_progress_dlg_t dlgdata;
+
+               /* shift the work to an idle callback, and return only after it has been run */
+               dlgdata.dialog = progress_dialog;
+               dlgdata.title = dialog_title;
+               dlgdata.parent = parent;
+               dlgdata.id = progress_id;
+               dlgdata.done = FALSE;
+               g_cond_init(&dlgdata.cond);
+               g_idle_add((GSourceFunc) libbalsa_progress_dialog_create_cb, &dlgdata);
+
+               while (!dlgdata.done) {
+                       g_cond_wait(&dlgdata.cond, &progress_dialog->mutex);
+               }
+               g_cond_clear(&dlgdata.cond);
+       } else {
+               libbalsa_progress_dialog_ensure_real(progress_dialog, dialog_title, parent, progress_id);
+       }
+
+       g_mutex_unlock(&progress_dialog->mutex);
 }
 
 
 void
 libbalsa_progress_dialog_update(ProgressDialog *progress_dialog,
-                                const gchar    *progress_id,
-                                gboolean        finished,
-                                gdouble         fraction,
-                                const gchar    *message,
-                                ...)
+                                                               const gchar    *progress_id,
+                                                               gboolean        finished,
+                                                               gdouble         fraction,
+                                                               const gchar    *message,
+                                                               ...)
 {
-    g_return_if_fail((progress_dialog != NULL) && (progress_id != NULL));
-
-    g_mutex_lock(&progress_dialog->mutex);
-
-    /* nothing to do if the progress dialogue has been closed */
-    if (progress_dialog->dialog != NULL) {
-        gchar *real_msg;
-
-        if (message != NULL) {
-            va_list args;
-
-            va_start(args, message);
-            real_msg = g_strdup_vprintf(message, args);
-            va_end(args);
-        } else {
-            real_msg = NULL;
-        }
-
-        if (libbalsa_am_i_subthread()) {
-            update_progress_data_t *update_data;
-
-            update_data = g_malloc(sizeof(update_progress_data_t));
-            update_data->dialog = progress_dialog;
-            update_data->id = g_strdup(progress_id);
-            update_data->finished = finished;
-            update_data->fraction = fraction;
-            update_data->message = real_msg;
-            g_idle_add((GSourceFunc) libbalsa_progress_dialog_update_cb, update_data);
-        } else {
-            libbalsa_progress_dialog_update_real(progress_dialog,
-                                                 progress_id,
-                                                 finished,
-                                                 fraction,
-                                                 real_msg);
-            g_free(real_msg);
-        }
-    }
-
-    g_mutex_unlock(&progress_dialog->mutex);
+       g_return_if_fail((progress_dialog != NULL) && (progress_id != NULL));
+
+       g_mutex_lock(&progress_dialog->mutex);
+
+       /* nothing to do if the progress dialogue has been closed */
+       if (progress_dialog->dialog != NULL) {
+               gchar *real_msg;
+
+               if (message != NULL) {
+                       va_list args;
+
+                       va_start(args, message);
+                       real_msg = g_strdup_vprintf(message, args);
+                       va_end(args);
+               } else {
+                       real_msg = NULL;
+               }
+
+               if (libbalsa_am_i_subthread()) {
+                       update_progress_data_t *update_data;
+
+                       update_data = g_malloc(sizeof(update_progress_data_t));
+                       update_data->dialog = progress_dialog;
+                       update_data->id = g_strdup(progress_id);
+                       update_data->finished = finished;
+                       update_data->fraction = fraction;
+                       update_data->message = real_msg;
+                       g_idle_add((GSourceFunc) libbalsa_progress_dialog_update_cb, update_data);
+               } else {
+                       libbalsa_progress_dialog_update_real(progress_dialog, progress_id, finished, 
fraction, real_msg);
+                       g_free(real_msg);
+               }
+       }
+
+       g_mutex_unlock(&progress_dialog->mutex);
 }
 
 
@@ -173,49 +166,42 @@ libbalsa_progress_dialog_update(ProgressDialog *progress_dialog,
 /* note: the mutex ProgressDialog::mutex is always locked when this function is called */
 static void
 libbalsa_progress_dialog_ensure_real(ProgressDialog *progress_dialog,
-                                     const gchar    *dialog_title,
-                                     GtkWindow      *parent,
-                                     const gchar    *progress_id)
+                                                                    const gchar    *dialog_title,
+                                                                    GtkWindow      *parent,
+                                                                    const gchar    *progress_id)
 {
-    GtkWidget *content_box;
-    const progress_widget_data_t *progress_data;
+       GtkWidget *content_box;
+       const progress_widget_data_t *progress_data;
 
     if (progress_dialog->dialog == NULL) {
-        progress_dialog->dialog = gtk_dialog_new_with_buttons(dialog_title,
-                                                              parent,
-                                                              GTK_DIALOG_DESTROY_WITH_PARENT | 
libbalsa_dialog_flags(),
-                                                              _("_Hide"),
-                                                              GTK_RESPONSE_CLOSE,
-                                                              NULL);
-        gtk_window_set_role(GTK_WINDOW(progress_dialog->dialog), "progress_dialog");
-        gtk_window_set_default_size(GTK_WINDOW(
-                                        progress_dialog->dialog), PROGRESS_DIALOG_WIDTH, -1);
+       progress_dialog->dialog = gtk_dialog_new_with_buttons(dialog_title, parent,
+               GTK_DIALOG_DESTROY_WITH_PARENT | libbalsa_dialog_flags(), _("_Hide"), GTK_RESPONSE_CLOSE, 
NULL);
+       gtk_window_set_role(GTK_WINDOW(progress_dialog->dialog), "progress_dialog");
+        gtk_window_set_default_size(GTK_WINDOW(progress_dialog->dialog), PROGRESS_DIALOG_WIDTH, -1);
 
         gtk_window_set_resizable(GTK_WINDOW(progress_dialog->dialog), FALSE);
-        g_signal_connect(G_OBJECT(progress_dialog->dialog), "response",
-                         G_CALLBACK(progress_dialog_response_cb), NULL);
-        g_signal_connect(G_OBJECT(progress_dialog->dialog), "destroy",
-                         G_CALLBACK(progress_dialog_destroy_cb), progress_dialog);
+        g_signal_connect(G_OBJECT(progress_dialog->dialog), "response", 
G_CALLBACK(progress_dialog_response_cb), NULL);
+        g_signal_connect(G_OBJECT(progress_dialog->dialog), "destroy", 
G_CALLBACK(progress_dialog_destroy_cb), progress_dialog);
 
-        content_box = gtk_dialog_get_content_area(GTK_DIALOG(progress_dialog->dialog));
-        gtk_box_set_spacing(GTK_BOX(content_box), 6);
+       content_box = gtk_dialog_get_content_area(GTK_DIALOG(progress_dialog->dialog));
+       gtk_box_set_spacing(GTK_BOX(content_box), 6);
 
         gtk_widget_show(progress_dialog->dialog);
     } else {
-        content_box = gtk_dialog_get_content_area(GTK_DIALOG(progress_dialog->dialog));
+       content_box = gtk_dialog_get_content_area(GTK_DIALOG(progress_dialog->dialog));
     }
 
     progress_data = find_progress_data_by_name(GTK_CONTAINER(content_box), progress_id);
     if (progress_data != NULL) {
-        if (!gtk_revealer_get_child_revealed(GTK_REVEALER(progress_data->revealer))) {
-            gtk_revealer_set_reveal_child(GTK_REVEALER(progress_data->revealer), TRUE);
-        }
+       if (!gtk_revealer_get_child_revealed(GTK_REVEALER(progress_data->revealer))) {
+               gtk_revealer_set_reveal_child(GTK_REVEALER(progress_data->revealer), TRUE);
+       }
     } else {
-        GtkWidget *progress_widget;
+       GtkWidget *progress_widget;
 
-        progress_widget = create_progress_widget(progress_id);
-        gtk_revealer_set_reveal_child(GTK_REVEALER(progress_widget), TRUE);
-        gtk_box_pack_start(GTK_BOX(content_box), progress_widget);
+       progress_widget = create_progress_widget(progress_id);
+       gtk_revealer_set_reveal_child(GTK_REVEALER(progress_widget), TRUE);
+       gtk_box_pack_start(GTK_BOX(content_box), progress_widget);
     }
 }
 
@@ -224,16 +210,13 @@ libbalsa_progress_dialog_ensure_real(ProgressDialog *progress_dialog,
 static gboolean
 libbalsa_progress_dialog_create_cb(create_progress_dlg_t *dlg_data)
 {
-    g_mutex_lock(&dlg_data->dialog->mutex);
-    libbalsa_progress_dialog_ensure_real(dlg_data->dialog,
-                                         dlg_data->title,
-                                         dlg_data->parent,
-                                         dlg_data->id);
-    dlg_data->done = TRUE;
-    g_cond_signal(&dlg_data->cond);
-    g_mutex_unlock(&dlg_data->dialog->mutex);
-
-    return G_SOURCE_REMOVE;
+       g_mutex_lock(&dlg_data->dialog->mutex);
+       libbalsa_progress_dialog_ensure_real(dlg_data->dialog, dlg_data->title, dlg_data->parent, 
dlg_data->id);
+       dlg_data->done = TRUE;
+       g_cond_signal(&dlg_data->cond);
+       g_mutex_unlock(&dlg_data->dialog->mutex);
+
+       return G_SOURCE_REMOVE;
 }
 
 
@@ -249,86 +232,78 @@ progress_dialog_response_cb(GtkWidget *dialog,
 
 static void
 progress_dialog_destroy_cb(GtkWidget G_GNUC_UNUSED *widget,
-                           ProgressDialog          *progress_dialog)
+                                                  ProgressDialog          *progress_dialog)
 {
-    g_mutex_lock(&progress_dialog->mutex);
-    progress_dialog->dialog = NULL;
-    g_mutex_unlock(&progress_dialog->mutex);
+       g_mutex_lock(&progress_dialog->mutex);
+       progress_dialog->dialog = NULL;
+       g_mutex_unlock(&progress_dialog->mutex);
 }
 
 
 static void
 progress_data_destroy_cb(GtkWidget G_GNUC_UNUSED *widget,
-                         progress_widget_data_t  *progress_data)
+                                                progress_widget_data_t  *progress_data)
 {
-    libbalsa_clear_source_id(&progress_data->activity_id);
-    libbalsa_clear_source_id(&progress_data->fadeout_id);
+       libbalsa_clear_source_id(&progress_data->activity_id);
+       libbalsa_clear_source_id(&progress_data->fadeout_id);
 }
 
-
 typedef struct {
-    const gchar *id;
+    const gchar            *id;
     progress_widget_data_t *data;
 } find_progress_data_info;
 
 static void
-find_progress_data_func(GtkWidget               *child,
-                        find_progress_data_info *info)
+find_progress_data_func(GtkWidget               * child,
+                        find_progress_data_info * info)
 {
-    if ((info->data == NULL) && (strcmp(gtk_widget_get_name(child), info->id) == 0)) {
+    if (info->data == NULL && strcmp(gtk_widget_get_name(child), info->id) == 0)
         info->data = g_object_get_data(G_OBJECT(child), "data");
-    }
 }
 
-
 static progress_widget_data_t *
 find_progress_data_by_name(GtkContainer *container,
-                           const gchar  *id)
+                                                  const gchar  *id)
 {
-    find_progress_data_info info = {
-        id, NULL
-    };
+        find_progress_data_info info = {id, NULL};
 
-    gtk_container_foreach(container, (GtkCallback) find_progress_data_func, &info);
+        gtk_container_foreach(container, (GtkCallback) find_progress_data_func, &info);
 
-    return info.data;
+        return info.data;
 }
 
 
 static GtkWidget *
 create_progress_widget(const gchar *progress_id)
 {
-    GtkWidget *box;
-    GtkWidget *label;
-    progress_widget_data_t *widget_data;
-
-    widget_data = g_malloc0(sizeof(progress_widget_data_t));
-    widget_data->revealer = gtk_revealer_new();
-    gtk_revealer_set_transition_type(GTK_REVEALER(
-                                         widget_data->revealer),
-                                     GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
-    gtk_revealer_set_transition_duration(GTK_REVEALER(widget_data->revealer), FADER_DURATION);
-    gtk_revealer_set_reveal_child(GTK_REVEALER(widget_data->revealer), FALSE);
-    gtk_widget_set_name(widget_data->revealer, progress_id);
-    g_object_set_data_full(G_OBJECT(widget_data->revealer), "data", widget_data, g_free);
-    g_signal_connect(G_OBJECT(widget_data->revealer), "destroy",
-                     G_CALLBACK(progress_data_destroy_cb), widget_data);
-
-    box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
-    gtk_container_add(GTK_CONTAINER(widget_data->revealer), box);
-
-    label = gtk_label_new(progress_id);
-    gtk_box_pack_start(GTK_BOX(box), label);
-
-    widget_data->label = gtk_label_new(" ");
-    gtk_label_set_line_wrap(GTK_LABEL(widget_data->label), TRUE);
-    gtk_box_pack_start(GTK_BOX(box), widget_data->label);
-
-    widget_data->progress = gtk_progress_bar_new();
-    g_object_set(G_OBJECT(widget_data->progress), "margin", 2, NULL);
-    gtk_box_pack_start(GTK_BOX(box), widget_data->progress);
-
-    return widget_data->revealer;
+       GtkWidget *box;
+       GtkWidget *label;
+       progress_widget_data_t *widget_data;
+
+       widget_data = g_malloc0(sizeof(progress_widget_data_t));
+       widget_data->revealer = gtk_revealer_new();
+       gtk_revealer_set_transition_type(GTK_REVEALER(widget_data->revealer), 
GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
+       gtk_revealer_set_transition_duration(GTK_REVEALER(widget_data->revealer), FADER_DURATION);
+       gtk_revealer_set_reveal_child(GTK_REVEALER(widget_data->revealer), FALSE);
+       gtk_widget_set_name(widget_data->revealer, progress_id);
+       g_object_set_data_full(G_OBJECT(widget_data->revealer), "data", widget_data, g_free);
+    g_signal_connect(G_OBJECT(widget_data->revealer), "destroy", G_CALLBACK(progress_data_destroy_cb), 
widget_data);
+
+       box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
+       gtk_container_add(GTK_CONTAINER(widget_data->revealer), box);
+
+       label = gtk_label_new(progress_id);
+       gtk_box_pack_start(GTK_BOX(box), label);
+
+       widget_data->label = gtk_label_new(" ");
+       gtk_label_set_line_wrap(GTK_LABEL(widget_data->label), TRUE);
+       gtk_box_pack_start(GTK_BOX(box), widget_data->label);
+
+       widget_data->progress = gtk_progress_bar_new();
+        g_object_set(G_OBJECT(widget_data->progress), "margin", 2, NULL);
+       gtk_box_pack_start(GTK_BOX(box), widget_data->progress);
+
+       return widget_data->revealer;
 }
 
 
@@ -336,35 +311,34 @@ static void
 count_revealers(GtkWidget *widget,
                 gpointer   data)
 {
-    guint *count = (guint *) data;
+       guint *count = (guint *) data;
 
-    if (GTK_IS_REVEALER(widget)) {
-        *count += 1U;
-    }
+       if (GTK_IS_REVEALER(widget)) {
+               *count += 1U;
+       }
 }
 
 
 static gboolean
 remove_progress_widget(progress_widget_data_t *progress_data)
 {
-    GtkWidget *parent_dialog;
-    GtkWidget *content_box;
-    guint rev_children = 0U;
-
-    progress_data->fadeout_id = 0U;
-    parent_dialog = gtk_widget_get_toplevel(progress_data->revealer);
-    gtk_widget_destroy(progress_data->revealer);
-
-    /* count the GtkRevealer children left, so we can just destroy the dialogue if there is none
-     */
-    content_box = gtk_dialog_get_content_area(GTK_DIALOG(parent_dialog));
-    gtk_container_foreach(GTK_CONTAINER(content_box), count_revealers, &rev_children);
-    if (rev_children == 0U) {
-        gtk_widget_destroy(parent_dialog);
-    } else {
-        gtk_window_resize(GTK_WINDOW(parent_dialog), PROGRESS_DIALOG_WIDTH, 1);
-    }
-    return FALSE;
+       GtkWidget *parent_dialog;
+       GtkWidget *content_box;
+       guint rev_children = 0U;
+
+       progress_data->fadeout_id = 0U;
+       parent_dialog = gtk_widget_get_toplevel(progress_data->revealer);
+       gtk_widget_destroy(progress_data->revealer);
+
+       /* count the GtkRevealer children left, so we can just destroy the dialogue if there is none */
+       content_box = gtk_dialog_get_content_area(GTK_DIALOG(parent_dialog));
+       gtk_container_foreach(GTK_CONTAINER(content_box), count_revealers, &rev_children);
+       if (rev_children == 0U) {
+               gtk_widget_destroy(parent_dialog);
+       } else {
+               gtk_window_resize(GTK_WINDOW(parent_dialog), PROGRESS_DIALOG_WIDTH, 1);
+       }
+       return FALSE;
 }
 
 
@@ -372,72 +346,63 @@ remove_progress_widget(progress_widget_data_t *progress_data)
 static gboolean
 libbalsa_progress_dialog_update_cb(update_progress_data_t *upd_data)
 {
-    g_mutex_lock(&upd_data->dialog->mutex);
-    libbalsa_progress_dialog_update_real(upd_data->dialog,
-                                         upd_data->id,
-                                         upd_data->finished,
-                                         upd_data->fraction,
-                                         upd_data->message);
-    g_mutex_unlock(&upd_data->dialog->mutex);
-    g_free(upd_data->id);
-    g_free(upd_data->message);
-    g_free(upd_data);
-    return G_SOURCE_REMOVE;
+       g_mutex_lock(&upd_data->dialog->mutex);
+       libbalsa_progress_dialog_update_real(upd_data->dialog, upd_data->id, upd_data->finished, 
upd_data->fraction, upd_data->message);
+       g_mutex_unlock(&upd_data->dialog->mutex);
+       g_free(upd_data->id);
+       g_free(upd_data->message);
+       g_free(upd_data);
+       return G_SOURCE_REMOVE;
 }
 
 
 /* note: the mutex ProgressDialog::mutex is always locked when this function is called */
 static void
 libbalsa_progress_dialog_update_real(ProgressDialog *progress_dialog,
-                                     const gchar    *progress_id,
-                                     gboolean        finished,
-                                     gdouble         fraction,
-                                     const gchar    *message)
+                                                                        const gchar    *progress_id,
+                                                                        gboolean        finished,
+                                                                        gdouble         fraction,
+                                                                        const gchar    *message)
 {
-    if (progress_dialog->dialog == NULL) {
-        if (finished) {
-            libbalsa_information(LIBBALSA_INFORMATION_MESSAGE, "%s:\n%s", progress_id, message);
-        }
-    } else {
-        GtkWidget *content_box;
-        progress_widget_data_t *progress_data;
-
-        content_box = gtk_dialog_get_content_area(GTK_DIALOG(progress_dialog->dialog));
-        progress_data = find_progress_data_by_name(GTK_CONTAINER(content_box), progress_id);
-        if (progress_data != NULL) {
-            if (message != NULL) {
-                gtk_label_set_text(GTK_LABEL(progress_data->label), message);
-            }
-            if (isnan(fraction) != 1) {
-                if (isinf(fraction) != 0) {
-                    if (progress_data->activity_id == 0U) {
-                        gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress_data->progress));
-                        progress_data->activity_id =
-                            g_timeout_add(ACTIVITY_DURATION,
-                                          (GSourceFunc) progress_activity,
-                                          progress_data->progress);
-                    }
-                } else {
-                    libbalsa_clear_source_id(&progress_data->activity_id);
-                    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(
-                                                      progress_data->progress), fraction);
-                }
-            }
-            if (finished) {
-                gtk_revealer_set_reveal_child(GTK_REVEALER(progress_data->revealer), FALSE);
-                gtk_widget_set_name(progress_data->revealer, "_none_");
-                progress_data->fadeout_id = g_timeout_add(FADER_DURATION,
-                                                          (GSourceFunc) remove_progress_widget,
-                                                          progress_data);
-            }
-        }
-    }
+       if (progress_dialog->dialog == NULL) {
+               if (finished) {
+                       libbalsa_information(LIBBALSA_INFORMATION_MESSAGE, "%s:\n%s", progress_id, message);
+               }
+       } else {
+               GtkWidget *content_box;
+               progress_widget_data_t *progress_data;
+
+               content_box = gtk_dialog_get_content_area(GTK_DIALOG(progress_dialog->dialog));
+               progress_data = find_progress_data_by_name(GTK_CONTAINER(content_box), progress_id);
+               if (progress_data != NULL) {
+                       if (message != NULL) {
+                               gtk_label_set_text(GTK_LABEL(progress_data->label), message);
+                       }
+                       if (isnan(fraction) != 1) {
+                               if (isinf(fraction) != 0) {
+                                       if (progress_data->activity_id == 0U) {
+                                               
gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress_data->progress));
+                                               progress_data->activity_id =
+                                                       g_timeout_add(ACTIVITY_DURATION, (GSourceFunc) 
progress_activity, progress_data->progress);
+                                       }
+                               } else {
+                                       libbalsa_clear_source_id(&progress_data->activity_id);
+                                       
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_data->progress), fraction);
+                               }
+                       }
+                       if (finished) {
+                               gtk_revealer_set_reveal_child(GTK_REVEALER(progress_data->revealer), FALSE);
+                               gtk_widget_set_name(progress_data->revealer, "_none_");
+                               progress_data->fadeout_id = g_timeout_add(FADER_DURATION, (GSourceFunc) 
remove_progress_widget, progress_data);
+                       }
+               }
+       }
 }
 
 
 static gboolean
 progress_activity(GtkProgressBar *progress)
 {
-    gtk_progress_bar_pulse(progress);
-    return TRUE;
+       gtk_progress_bar_pulse(progress);
+       return TRUE;
 }
diff --git a/libbalsa/libbalsa-progress.h b/libbalsa/libbalsa-progress.h
index 30ce15f..ce33105 100644
--- a/libbalsa/libbalsa-progress.h
+++ b/libbalsa/libbalsa-progress.h
@@ -22,7 +22,7 @@
 
 
 #ifdef HAVE_CONFIG_H
-#   include <config.h>
+#include <config.h>
 #endif
 
 #include <gtk/gtk.h>
@@ -30,15 +30,13 @@
 
 /** \brief Progress dialogue
  *
- * Structure containing the actual progress dialogue widget and a mutex for protecting
- * concurrent accesses.  As to initialise a
- * variable of this type, put it either in static memory, or set the \ref ProgressDialog::dialog
- * to NULL and initialise \ref
+ * Structure containing the actual progress dialogue widget and a mutex for protecting concurrent accesses.  
As to initialise a
+ * variable of this type, put it either in static memory, or set the \ref ProgressDialog::dialog to NULL and 
initialise \ref
  * ProgressDialog::mutex.
  */
 typedef struct {
-    GtkWidget *dialog;
-    GMutex mutex;
+       GtkWidget *dialog;
+       GMutex     mutex;
 } ProgressDialog;
 
 
@@ -49,48 +47,41 @@ typedef struct {
  * \param parent parent window
  * \param progress_id progress identifier, also used as section title, \em must be unique
  *
- * If the passed progress dialogue \ref ProgressDialog::dialog is NULL, a new dialogue is
- * created.
+ * If the passed progress dialogue \ref ProgressDialog::dialog is NULL, a new dialogue is created.
  *
- * If no progress section with the passed id exists, it is appended.  An already existing
- * section is revealed if necessary.
+ * If no progress section with the passed id exists, it is appended.  An already existing section is 
revealed if necessary.
  *
- * \note This function may be called from a thread.  In this case, the function will block in
- * the thread until the "real" work has
+ * \note This function may be called from a thread.  In this case, the function will block in the thread 
until the "real" work has
  *       been done in the main thread.
  */
 void libbalsa_progress_dialog_ensure(ProgressDialog *progress_dialog,
-                                     const gchar    *dialog_title,
-                                     GtkWindow      *parent,
-                                     const gchar    *progress_id);
+                                                                        const gchar    *dialog_title,
+                                                                        GtkWindow      *parent,
+                                                                        const gchar    *progress_id);
 
 
 /** \brief Progress dialogue update
  *
  * \param progress_dialog progress dialogue, initialised by libbalsa_progress_dialog_ensure()
  * \param progress_id progress identifier passed to libbalsa_progress_dialog_ensure()
- * \param finished indicates whether the progress element shall be removed from the dialogue.
- * When no progress elements are left,
+ * \param finished indicates whether the progress element shall be removed from the dialogue.  When no 
progress elements are left,
  *                 the dialogue is destroyed
- * \param fraction progress bar value between 0.0 and 1.0, or INF to switch to activity mode, or
- * NAN to keep the current value
- * \param message printf-like format string which shall be printed above the progress bar, or
- * NULL to keep the current message
+ * \param fraction progress bar value between 0.0 and 1.0, or INF to switch to activity mode, or NAN to keep 
the current value
+ * \param message printf-like format string which shall be printed above the progress bar, or NULL to keep 
the current message
  * \param ... additional arguments for the message format string
  *
  * Update the information of the passed progress dialogue.
  *
- * \note This function may be called from a thread.  In this case, the "real" work is done in an
- * idle callback and may therefore
+ * \note This function may be called from a thread.  In this case, the "real" work is done in an idle 
callback and may therefore
  *       be performed only after this function returns.
  */
 void libbalsa_progress_dialog_update(ProgressDialog *progress_dialog,
-                                     const gchar    *progress_id,
-                                     gboolean        finished,
-                                     gdouble         fraction,
-                                     const gchar    *message,
-                                     ...)
-G_GNUC_PRINTF(5, 6);
+                                                                        const gchar    *progress_id,
+                                                                        gboolean        finished,
+                                                                        gdouble         fraction,
+                                                                        const gchar    *message,
+                                                                        ...)
+       G_GNUC_PRINTF(5, 6);
 
 
 #endif /* LIBBALSA_PROGRESS_H_ */
diff --git a/libbalsa/libbalsa-vfs.c b/libbalsa/libbalsa-vfs.c
index 0f01cab..7275c1b 100644
--- a/libbalsa/libbalsa-vfs.c
+++ b/libbalsa/libbalsa-vfs.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "libbalsa-vfs.h"
 
@@ -50,24 +50,24 @@
 
 
 struct _LibbalsaVfsPriv {
-    gchar *file_uri;
-    gchar *file_utf8;
-    gchar *folder_uri;
-    gchar *mime_type;
-    gchar *charset;
+    gchar * file_uri;
+    gchar * file_utf8;
+    gchar * folder_uri;
+    gchar * mime_type;
+    gchar * charset;
     LibBalsaTextAttribute text_attr;
-    GFile *gio_gfile;
-    GFileInfo *info;
+    GFile * gio_gfile;
+    GFileInfo * info;
 };
 
 
 static GObjectClass *libbalsa_vfs_parent_class = NULL;
 
 
-static void libbalsa_vfs_class_init(LibbalsaVfsClass *klass);
-static void libbalsa_vfs_init(LibbalsaVfs *self);
-static void libbalsa_vfs_dispose(LibbalsaVfs *self);
-static void libbalsa_vfs_finalize(LibbalsaVfs *self);
+static void libbalsa_vfs_class_init(LibbalsaVfsClass * klass);
+static void libbalsa_vfs_init(LibbalsaVfs * self);
+static void libbalsa_vfs_dispose(LibbalsaVfs * self);
+static void libbalsa_vfs_finalize(LibbalsaVfs * self);
 
 
 gboolean
@@ -106,7 +106,7 @@ libbalsa_vfs_get_type(void)
 
 
 static void
-libbalsa_vfs_class_init(LibbalsaVfsClass *klass)
+libbalsa_vfs_class_init(LibbalsaVfsClass * klass)
 {
     GObjectClass *gobject_klass = G_OBJECT_CLASS(klass);
 
@@ -119,16 +119,16 @@ libbalsa_vfs_class_init(LibbalsaVfsClass *klass)
 
 
 static void
-libbalsa_vfs_init(LibbalsaVfs *self)
+libbalsa_vfs_init(LibbalsaVfs * self)
 {
     self->priv = NULL;
 }
 
 
 static void
-libbalsa_vfs_dispose(LibbalsaVfs *self)
+libbalsa_vfs_dispose(LibbalsaVfs * self)
 {
-    struct _LibbalsaVfsPriv *priv;
+    struct _LibbalsaVfsPriv * priv;
 
     g_return_if_fail(self != NULL);
     priv = self->priv;
@@ -143,9 +143,9 @@ libbalsa_vfs_dispose(LibbalsaVfs *self)
 
 
 static void
-libbalsa_vfs_finalize(LibbalsaVfs *self)
+libbalsa_vfs_finalize(LibbalsaVfs * self)
 {
-    struct _LibbalsaVfsPriv *priv;
+    struct _LibbalsaVfsPriv * priv;
 
     g_return_if_fail(self != NULL);
     priv = self->priv;
@@ -171,20 +171,19 @@ libbalsa_vfs_new(void)
 
 
 LibbalsaVfs *
-libbalsa_vfs_new_from_uri(const gchar *uri)
+libbalsa_vfs_new_from_uri(const gchar * uri)
 {
-    LibbalsaVfs *retval;
+    LibbalsaVfs * retval;
 
     g_return_val_if_fail(uri, NULL);
-    if (!(retval = libbalsa_vfs_new())) {
+    if (!(retval = libbalsa_vfs_new()))
         return NULL;
-    }
 
     if (!(retval->priv = g_new0(struct _LibbalsaVfsPriv, 1))) {
         g_object_unref(G_OBJECT(retval));
         return NULL;
     }
-    retval->priv->text_attr = (LibBalsaTextAttribute) - 1;
+    retval->priv->text_attr = (LibBalsaTextAttribute) -1;
 
     retval->priv->file_uri = g_strdup(uri);
     retval->priv->gio_gfile = g_file_new_for_uri(uri);
@@ -196,12 +195,11 @@ libbalsa_vfs_new_from_uri(const gchar *uri)
 /* create a new LibbalsaVfs object by appending text to the existing object
  * file (note: text is in utf8, not escaped) */
 LibbalsaVfs *
-libbalsa_vfs_append(const LibbalsaVfs *file,
-                    const gchar       *text)
+libbalsa_vfs_append(const LibbalsaVfs * file, const gchar * text)
 {
-    gchar *p;
-    gchar *q;
-    LibbalsaVfs *retval;
+    gchar * p;
+    gchar * q;
+    LibbalsaVfs * retval;
 
     g_return_val_if_fail(file, NULL);
     g_return_val_if_fail(file->priv, NULL);
@@ -212,9 +210,8 @@ libbalsa_vfs_append(const LibbalsaVfs *file,
     p = g_strconcat("/", text, NULL);
     q = g_filename_to_uri(p, NULL, NULL);
     g_free(p);
-    if (!q) {
+    if (!q)
         return NULL;
-    }
 
     /* append to the existing uri and create the new object from it */
     p = g_strconcat(file->priv->file_uri, q + 8, NULL);
@@ -229,12 +226,11 @@ libbalsa_vfs_append(const LibbalsaVfs *file,
  * object dir which describes a folder (note: filename is in utf8, not
  * escaped) */
 LibbalsaVfs *
-libbalsa_vfs_dir_append(const LibbalsaVfs *dir,
-                        const gchar       *filename)
-{
-    gchar *p;
-    gchar *q;
-    LibbalsaVfs *retval;
+libbalsa_vfs_dir_append(const LibbalsaVfs * dir, const gchar * filename)
+{   
+    gchar * p;
+    gchar * q;
+    LibbalsaVfs * retval;
 
     g_return_val_if_fail(dir, NULL);
     g_return_val_if_fail(dir->priv, NULL);
@@ -245,9 +241,8 @@ libbalsa_vfs_dir_append(const LibbalsaVfs *dir,
     p = g_strconcat("/", filename, NULL);
     q = g_filename_to_uri(p, NULL, NULL);
     g_free(p);
-    if (!q) {
+    if (!q)
         return NULL;
-    }
 
     /* append to the existing uri and create the new object from it */
     p = g_strconcat(dir->priv->file_uri, q + 7, NULL);
@@ -260,9 +255,9 @@ libbalsa_vfs_dir_append(const LibbalsaVfs *dir,
 
 /* return the text uri of the passed file, removing the last component */
 const gchar *
-libbalsa_vfs_get_folder(const LibbalsaVfs *file)
+libbalsa_vfs_get_folder(const LibbalsaVfs * file)
 {
-    struct _LibbalsaVfsPriv *priv;
+    struct _LibbalsaVfsPriv * priv;
 
     g_return_val_if_fail(file, NULL);
     g_return_val_if_fail(file->priv, NULL);
@@ -270,12 +265,11 @@ libbalsa_vfs_get_folder(const LibbalsaVfs *file)
     g_return_val_if_fail(priv->file_uri, NULL);
 
     if (!priv->folder_uri) {
-        gchar *p;
+        gchar * p;
 
         if ((priv->folder_uri = g_strdup(priv->file_uri)) &&
-            (p = g_utf8_strrchr(priv->folder_uri, -1, g_utf8_get_char("/")))) {
+            (p = g_utf8_strrchr(priv->folder_uri, -1, g_utf8_get_char("/"))))
             *p = '\0';
-        }
     }
 
     return priv->folder_uri;
@@ -284,7 +278,7 @@ libbalsa_vfs_get_folder(const LibbalsaVfs *file)
 
 /* return the text uri of the passed file */
 const gchar *
-libbalsa_vfs_get_uri(const LibbalsaVfs *file)
+libbalsa_vfs_get_uri(const LibbalsaVfs * file)
 {
     g_return_val_if_fail(file, NULL);
     g_return_val_if_fail(file->priv, NULL);
@@ -296,9 +290,9 @@ libbalsa_vfs_get_uri(const LibbalsaVfs *file)
 
 /* return the text uri of the passed file as utf8 string (%xx replaced) */
 const gchar *
-libbalsa_vfs_get_uri_utf8(const LibbalsaVfs *file)
+libbalsa_vfs_get_uri_utf8(const LibbalsaVfs * file)
 {
-    struct _LibbalsaVfsPriv *priv;
+    struct _LibbalsaVfsPriv * priv;
 
     g_return_val_if_fail(file, NULL);
     g_return_val_if_fail(file->priv, NULL);
@@ -306,12 +300,11 @@ libbalsa_vfs_get_uri_utf8(const LibbalsaVfs *file)
     g_return_val_if_fail(priv->file_uri, NULL);
 
     if (!priv->file_utf8) {
-        gchar *p;
-        gchar *q;
+        gchar * p;
+        gchar * q;
 
-        if (!(p = priv->file_utf8 = g_malloc(strlen(priv->file_uri) + 1))) {
+        if (!(p = priv->file_utf8 = g_malloc(strlen(priv->file_uri) + 1)))
             return NULL;
-        }
         q = priv->file_uri;
         while (*q != '\0') {
             if (*q == '%') {
@@ -320,12 +313,10 @@ libbalsa_vfs_get_uri_utf8(const LibbalsaVfs *file)
                         g_ascii_xdigit_value(q[2]);
                     *p++ = (gchar) val;
                     q += 3;
-                } else {
+                } else
                     *p++ = *q++; /* hmmm - shouldn't happen! */
-                }
-            } else {
+            } else
                 *p++ = *q++;
-            }
         }
         *p = '\0';
     }
@@ -335,24 +326,23 @@ libbalsa_vfs_get_uri_utf8(const LibbalsaVfs *file)
 
 
 const gchar *
-libbalsa_vfs_get_basename_utf8(const LibbalsaVfs *file)
+libbalsa_vfs_get_basename_utf8(const LibbalsaVfs * file)
 {
-    const gchar *uri_utf8 = libbalsa_vfs_get_uri_utf8(file);
-    const gchar *p;
+    const gchar * uri_utf8 = libbalsa_vfs_get_uri_utf8(file);
+    const gchar * p;
 
     if (uri_utf8 &&
-        (p = g_utf8_strrchr(uri_utf8, -1, g_utf8_get_char("/")))) {
+        (p = g_utf8_strrchr(uri_utf8, -1, g_utf8_get_char("/"))))
         return p + 1;
-    } else {
+    else
         return NULL;
-    }
 }
 
 
 const gchar *
-libbalsa_vfs_get_mime_type(const LibbalsaVfs *file)
+libbalsa_vfs_get_mime_type(const LibbalsaVfs * file)
 {
-    struct _LibbalsaVfsPriv *priv;
+    struct _LibbalsaVfsPriv * priv;
 
     g_return_val_if_fail(file, NULL);
     g_return_val_if_fail(file->priv, NULL);
@@ -363,21 +353,18 @@ libbalsa_vfs_get_mime_type(const LibbalsaVfs *file)
         /* use GIO to determine the mime type of the file */
         g_return_val_if_fail(priv->gio_gfile, FALSE);
 
-        if (!priv->info) {
-            priv->info =
+        if (!priv->info)
+            priv->info = 
                 g_file_query_info(priv->gio_gfile, GIO_INFO_ATTS,
                                   G_FILE_QUERY_INFO_NONE, NULL, NULL);
-        }
-        if (priv->info) {
+        if (priv->info)
             priv->mime_type =
                 g_strdup(g_file_info_get_attribute_string(priv->info,
                                                           G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE));
-        }
 
         /* always fall back to application/octet-stream */
-        if (!priv->mime_type) {
+        if (!priv->mime_type)
             priv->mime_type = g_strdup("application/octet-stream");
-        }
     }
 
     return priv->mime_type;
@@ -385,23 +372,22 @@ libbalsa_vfs_get_mime_type(const LibbalsaVfs *file)
 
 
 const gchar *
-libbalsa_vfs_get_charset(const LibbalsaVfs *file)
+libbalsa_vfs_get_charset(const LibbalsaVfs * file)
 {
-    struct _LibbalsaVfsPriv *priv;
+    struct _LibbalsaVfsPriv * priv;
 
     g_return_val_if_fail(file, NULL);
     g_return_val_if_fail(file->priv, NULL);
     priv = file->priv;
     g_return_val_if_fail(priv->file_uri, NULL);
 
-    if (!priv->charset && (priv->text_attr == (LibBalsaTextAttribute) - 1)) {
+    if (!priv->charset && priv->text_attr == (LibBalsaTextAttribute) -1) {
         libbalsa_vfs_get_text_attr(file);
 
-        if (!(priv->text_attr & LIBBALSA_TEXT_HI_BIT)) {
+        if (!(priv->text_attr & LIBBALSA_TEXT_HI_BIT))
             priv->charset = g_strdup("us-ascii");
-        } else if (priv->text_attr & LIBBALSA_TEXT_HI_UTF8) {
+        else if (priv->text_attr & LIBBALSA_TEXT_HI_UTF8)
             priv->charset = g_strdup("utf-8");
-        }
     }
 
     return priv->charset;
@@ -409,17 +395,17 @@ libbalsa_vfs_get_charset(const LibbalsaVfs *file)
 
 
 LibBalsaTextAttribute
-libbalsa_vfs_get_text_attr(const LibbalsaVfs *file)
+libbalsa_vfs_get_text_attr(const LibbalsaVfs * file)
 {
-    struct _LibbalsaVfsPriv *priv;
+    struct _LibbalsaVfsPriv * priv;
 
     g_return_val_if_fail(file, 0);
     g_return_val_if_fail(file->priv, 0);
     priv = file->priv;
     g_return_val_if_fail(priv->file_uri, 0);
 
-    if (priv->text_attr == (LibBalsaTextAttribute) - 1) {
-        GInputStream *stream;
+    if (priv->text_attr == (LibBalsaTextAttribute) -1) {
+        GInputStream * stream;
 
         /* use GIO to determine the text attributes of the file */
         g_return_val_if_fail(priv->gio_gfile, 0);
@@ -442,20 +428,18 @@ libbalsa_vfs_get_text_attr(const LibbalsaVfs *file)
                                                       NULL,
                                                       NULL)) > 0)) {
                 new_chars[bytes_read] = '\0';
-
+                
                 if (!has_esc || !has_hi_bit || !has_hi_ctrl) {
-                    guchar *p;
+                    guchar * p;
 
-                    for (p = (guchar *) new_chars; *p; p++) {
-                        if (*p == 0x1b) {
+                    for (p = (guchar *) new_chars; *p; p++)
+                        if (*p == 0x1b)
                             has_esc = TRUE;
-                        } else if (*p >= 0x80) {
+                        else if (*p >= 0x80) {
                             has_hi_bit = TRUE;
-                            if (*p <= 0x9f) {
+                            if (*p <= 0x9f)
                                 has_hi_ctrl = TRUE;
-                            }
                         }
-                    }
                 }
 
                 if (is_utf8) {
@@ -463,33 +447,27 @@ libbalsa_vfs_get_text_attr(const LibbalsaVfs *file)
 
                     new_chars = buf;
                     if (!g_utf8_validate(buf, -1, &end)) {
-                        if (g_utf8_get_char_validated(end, -1) == (gunichar) (-1)) {
+                        if (g_utf8_get_char_validated(end, -1) == (gunichar) (-1))
                             is_utf8 = FALSE;
-                        } else {
+                        else
                             /* copy any remaining bytes, including the
                              * terminating '\0', to start of buffer */
-                            while ((*new_chars = *end++) != '\0') {
+                            while ((*new_chars = *end++) != '\0')
                                 new_chars++;
-                            }
-                        }
                     }
                 }
             }
 
             g_object_unref(stream);
 
-            if (has_esc) {
+            if (has_esc)
                 priv->text_attr |= LIBBALSA_TEXT_ESC;
-            }
-            if (has_hi_bit) {
+            if (has_hi_bit)
                 priv->text_attr |= LIBBALSA_TEXT_HI_BIT;
-            }
-            if (has_hi_ctrl) {
+            if (has_hi_ctrl)
                 priv->text_attr |= LIBBALSA_TEXT_HI_CTRL;
-            }
-            if (is_utf8 && has_hi_bit) {
+            if (is_utf8 && has_hi_bit)
                 priv->text_attr |= LIBBALSA_TEXT_HI_UTF8;
-            }
         }
     }
 
@@ -498,9 +476,9 @@ libbalsa_vfs_get_text_attr(const LibbalsaVfs *file)
 
 
 guint64
-libbalsa_vfs_get_size(const LibbalsaVfs *file)
+libbalsa_vfs_get_size(const LibbalsaVfs * file)
 {
-    struct _LibbalsaVfsPriv *priv;
+    struct _LibbalsaVfsPriv * priv;
 
     g_return_val_if_fail(file, 0);
     g_return_val_if_fail(file->priv, 0);
@@ -510,15 +488,13 @@ libbalsa_vfs_get_size(const LibbalsaVfs *file)
     /* use GIO to determine the size of the file */
     g_return_val_if_fail(priv->gio_gfile, 0);
 
-    if (!priv->info) {
-        priv->info =
+    if (!priv->info)
+        priv->info = 
             g_file_query_info(priv->gio_gfile, GIO_INFO_ATTS,
                               G_FILE_QUERY_INFO_NONE, NULL, NULL);
-    }
-    if (priv->info) {
+    if (priv->info)
         return g_file_info_get_attribute_uint64(priv->info,
                                                 G_FILE_ATTRIBUTE_STANDARD_SIZE);
-    }
 
     return 0;
 }
@@ -527,12 +503,10 @@ libbalsa_vfs_get_size(const LibbalsaVfs *file)
 /* get a GMime stream for the passed file, either read-only or in
  * read-write mode */
 GMimeStream *
-libbalsa_vfs_create_stream(const LibbalsaVfs *file,
-                           mode_t             mode,
-                           gboolean           rdwr,
-                           GError           **err)
+libbalsa_vfs_create_stream(const LibbalsaVfs * file, mode_t mode, 
+                           gboolean rdwr, GError ** err)
 {
-    struct _LibbalsaVfsPriv *priv;
+    struct _LibbalsaVfsPriv * priv;
     GMimeStream *stream;
 
     g_return_val_if_fail(file, NULL);
@@ -552,10 +526,10 @@ libbalsa_vfs_create_stream(const LibbalsaVfs *file,
 
 /* return TRUE if the passed file exists */
 gboolean
-libbalsa_vfs_file_exists(const LibbalsaVfs *file)
+libbalsa_vfs_file_exists(const LibbalsaVfs * file)
 {
     gboolean result = FALSE;
-    struct _LibbalsaVfsPriv *priv;
+    struct _LibbalsaVfsPriv * priv;
 
     g_return_val_if_fail(file, FALSE);
     g_return_val_if_fail(file->priv, FALSE);
@@ -565,11 +539,10 @@ libbalsa_vfs_file_exists(const LibbalsaVfs *file)
     /* use GIO to get the file's attributes - fails if the file does not exist */
     g_return_val_if_fail(priv->gio_gfile, 0);
 
-    if (!priv->info) {
-        priv->info =
+    if (!priv->info)
+        priv->info = 
             g_file_query_info(priv->gio_gfile, GIO_INFO_ATTS,
                               G_FILE_QUERY_INFO_NONE, NULL, NULL);
-    }
     result = priv->info != NULL;
 
     return result;
@@ -577,11 +550,10 @@ libbalsa_vfs_file_exists(const LibbalsaVfs *file)
 
 
 gboolean
-libbalsa_vfs_is_regular_file(const LibbalsaVfs *file,
-                             GError           **err)
+libbalsa_vfs_is_regular_file(const LibbalsaVfs * file, GError **err)
 {
     gboolean result = FALSE;
-    struct _LibbalsaVfsPriv *priv;
+    struct _LibbalsaVfsPriv * priv;
 
     g_return_val_if_fail(file, FALSE);
     g_return_val_if_fail(file->priv, FALSE);
@@ -591,27 +563,25 @@ libbalsa_vfs_is_regular_file(const LibbalsaVfs *file,
     /* use GIO to check if the file is a regular one which can be read */
     g_return_val_if_fail(priv->gio_gfile, 0);
 
-    if (!priv->info) {
-        priv->info =
+    if (!priv->info)
+        priv->info = 
             g_file_query_info(priv->gio_gfile, GIO_INFO_ATTS,
                               G_FILE_QUERY_INFO_NONE, NULL, err);
-    }
     if (priv->info) {
-        if (g_file_info_get_file_type(priv->info) != G_FILE_TYPE_REGULAR) {
+        if (g_file_info_get_file_type(priv->info) != G_FILE_TYPE_REGULAR)
             g_set_error(err, LIBBALSA_VFS_ERROR_QUARK, -1,
                         _("not a regular file"));
-        } else if (!g_file_info_get_attribute_boolean(priv->info,
-                                                      G_FILE_ATTRIBUTE_ACCESS_CAN_READ)) {
+        else if (!g_file_info_get_attribute_boolean(priv->info,
+                                                    G_FILE_ATTRIBUTE_ACCESS_CAN_READ)) {
             /* the read flag may not be set for some remote file systems (like smb),
              * so try to actually open the file... */
-            GFileInputStream *stream = g_file_read(priv->gio_gfile, NULL, err);
+            GFileInputStream * stream = g_file_read(priv->gio_gfile, NULL, err);
             if (stream) {
                 g_object_unref(stream);
                 result = TRUE;
             }
-        } else {
+        } else
             result = TRUE;
-        }
     }
 
     return result;
@@ -620,11 +590,10 @@ libbalsa_vfs_is_regular_file(const LibbalsaVfs *file,
 
 /* unlink the passed file, return 0 on success and -1 on error */
 gint
-libbalsa_vfs_file_unlink(const LibbalsaVfs *file,
-                         GError           **err)
+libbalsa_vfs_file_unlink(const LibbalsaVfs * file, GError **err)
 {
     gint result = -1;
-    struct _LibbalsaVfsPriv *priv;
+    struct _LibbalsaVfsPriv * priv;
 
     g_return_val_if_fail(file, -1);
     g_return_val_if_fail(file->priv, -1);
@@ -633,21 +602,18 @@ libbalsa_vfs_file_unlink(const LibbalsaVfs *file,
 
     /* use GIO to delete the file */
     g_return_val_if_fail(priv->gio_gfile, -1);
-    if (g_file_delete(priv->gio_gfile, NULL, err)) {
+    if (g_file_delete(priv->gio_gfile, NULL, err))
         result = 0;
-    }
 
     return result;
 }
 
 
 gboolean
-libbalsa_vfs_launch_app(const LibbalsaVfs *file,
-                        GObject           *object,
-                        GError           **err)
+libbalsa_vfs_launch_app(const LibbalsaVfs * file, GObject * object, GError **err)
 {
     GAppInfo *app;
-    GList *args;
+    GList * args;
     gboolean result;
 
     g_return_val_if_fail(file != NULL, FALSE);
@@ -667,25 +633,23 @@ libbalsa_vfs_launch_app(const LibbalsaVfs *file,
 
 
 gboolean
-libbalsa_vfs_launch_app_for_body(LibBalsaMessageBody *mime_body,
-                                 GObject             *object,
-                                 GError             **err)
+libbalsa_vfs_launch_app_for_body(LibBalsaMessageBody * mime_body,
+                                 GObject * object, GError **err)
 {
     gchar *uri;
-    LibbalsaVfs *file;
+    LibbalsaVfs * file;
     gboolean result;
 
     g_return_val_if_fail(mime_body != NULL, FALSE);
     g_return_val_if_fail(object != NULL, FALSE);
 
-    if (!libbalsa_message_body_save_temporary(mime_body, err)) {
+    if (!libbalsa_message_body_save_temporary(mime_body, err))
         return FALSE;
-    }
 
     uri = g_filename_to_uri(mime_body->temp_filename, NULL, NULL);
     file = libbalsa_vfs_new_from_uri(uri);
     g_free(uri);
-    result = libbalsa_vfs_launch_app(file, object, err);
+    result = libbalsa_vfs_launch_app(file,object , err);
     g_object_unref(file);
 
     return result;
@@ -693,19 +657,18 @@ libbalsa_vfs_launch_app_for_body(LibBalsaMessageBody *mime_body,
 
 
 gchar *
-libbalsa_vfs_content_description(const gchar *mime_type)
+libbalsa_vfs_content_description(const gchar * mime_type)
 {
     g_return_val_if_fail(mime_type != NULL, NULL);
 
     return g_content_type_get_description(mime_type);
 }
 
-
 gchar *
-libbalsa_vfs_content_type_of_buffer(const guchar *buffer,
-                                    gsize         length)
+libbalsa_vfs_content_type_of_buffer(const guchar * buffer,
+                                    gsize length)
 {
-    gchar *retval;
+    gchar * retval;
     gboolean content_uncertain;
 
     g_return_val_if_fail(buffer != NULL, NULL);
@@ -720,19 +683,17 @@ libbalsa_vfs_content_type_of_buffer(const guchar *buffer,
 }
 
 
-static void
-gio_add_vfs_menu_item(GtkMenu  *menu,
-                      GAppInfo *app,
-                      GCallback callback,
-                      gpointer  data)
+static void 
+gio_add_vfs_menu_item(GtkMenu * menu, GAppInfo *app, GCallback callback,
+                      gpointer data)
 {
     gchar *menu_label =
         g_strdup_printf(_("Open with %s"), g_app_info_get_name(app));
     GtkWidget *menu_item = gtk_menu_item_new_with_label (menu_label);
-
+    
     g_object_ref(G_OBJECT(app));
     g_object_set_data_full(G_OBJECT(menu_item), LIBBALSA_VFS_MIME_ACTION,
-                           app, g_object_unref);
+                          app, g_object_unref);
     g_signal_connect(G_OBJECT (menu_item), "activate", callback, data);
     gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
     g_free(menu_label);
@@ -741,58 +702,52 @@ gio_add_vfs_menu_item(GtkMenu  *menu,
 
 /* fill the passed menu with vfs items */
 void
-libbalsa_vfs_fill_menu_by_content_type(GtkMenu     *menu,
-                                       const gchar *content_type,
-                                       GCallback    callback,
-                                       gpointer     data)
+libbalsa_vfs_fill_menu_by_content_type(GtkMenu * menu,
+                                      const gchar * content_type,
+                                      GCallback callback, gpointer data)
 {
-    GList *list;
+    GList* list;
     GAppInfo *def_app;
     GList *app_list;
-
+    
     g_return_if_fail(data != NULL);
 
-    if ((def_app = g_app_info_get_default_for_type(content_type, FALSE))) {
+    if ((def_app = g_app_info_get_default_for_type(content_type, FALSE)))
         gio_add_vfs_menu_item(menu, def_app, callback, data);
-    }
 
     app_list = g_app_info_get_all_for_type(content_type);
     for (list = app_list; list != NULL; list = list->next) {
         GAppInfo *app = G_APP_INFO(list->data);
 
         if (app && g_app_info_should_show(app) &&
-            (!def_app || !g_app_info_equal(app, def_app))) {
+            (!def_app || !g_app_info_equal(app, def_app)))
             gio_add_vfs_menu_item(menu, app, callback, data);
-        }
     }
-    if (def_app) {
+    if (def_app)
         g_object_unref(def_app);
-    }
     if (app_list) {
         g_list_foreach(app_list, (GFunc) g_object_unref, NULL);
         g_list_free(app_list);
     }
 }
 
-
 GtkWidget *
-libbalsa_vfs_mime_button(LibBalsaMessageBody *mime_body,
-                         const gchar         *content_type,
-                         GCallback            callback,
-                         gpointer             data)
+libbalsa_vfs_mime_button(LibBalsaMessageBody * mime_body,
+                         const gchar * content_type,
+                         GCallback callback, gpointer data)
 {
     GtkWidget *button = NULL;
     gchar *msg;
     GAppInfo *app = g_app_info_get_default_for_type(content_type, FALSE);
 
     if (app) {
-        msg = g_strdup_printf(_("Open _part with %s"), g_app_info_get_name(app));
-        button = gtk_button_new_with_mnemonic(msg);
-        g_object_set_data_full(G_OBJECT(button), LIBBALSA_VFS_MIME_ACTION,
-                               (gpointer) app, g_object_unref);
-        g_free(msg);
+       msg = g_strdup_printf(_("Open _part with %s"), g_app_info_get_name(app));
+       button = gtk_button_new_with_mnemonic(msg);
+       g_object_set_data_full(G_OBJECT(button), LIBBALSA_VFS_MIME_ACTION,
+                              (gpointer) app, g_object_unref);
+       g_free(msg);
 
-        g_signal_connect(G_OBJECT(button), "clicked",
+       g_signal_connect(G_OBJECT(button), "clicked",
                          callback, data);
     }
 
diff --git a/libbalsa/libbalsa-vfs.h b/libbalsa/libbalsa-vfs.h
index 1b02297..1ccbde4 100644
--- a/libbalsa/libbalsa-vfs.h
+++ b/libbalsa/libbalsa-vfs.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -34,14 +34,11 @@ G_BEGIN_DECLS
 
 /* a vfs file description as GObject */
 #define LIBBALSA_TYPE_VFS            (libbalsa_vfs_get_type())
-#define LIBBALSA_VFS(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), LIBBALSA_TYPE_VFS, \
-                                                                 LibbalsaVfs))
-#define LIBBALSA_VFS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), LIBBALSA_TYPE_VFS, \
-                                                              LibbalsaVfsClass))
+#define LIBBALSA_VFS(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), LIBBALSA_TYPE_VFS, LibbalsaVfs))
+#define LIBBALSA_VFS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), LIBBALSA_TYPE_VFS, LibbalsaVfsClass))
 #define LIBBALSA_IS_VFS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), LIBBALSA_TYPE_VFS))
 #define LIBBALSA_IS_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), LIBBALSA_TYPE_VFS))
-#define LIBBALSA_VFS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), LIBBALSA_TYPE_VFS, \
-                                                                LibbalsaVfsClass))
+#define LIBBALSA_VFS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), LIBBALSA_TYPE_VFS, LibbalsaVfsClass))
 
 typedef struct _LibbalsaVfsClass LibbalsaVfsClass;
 
@@ -49,7 +46,7 @@ typedef struct _LibbalsaVfsClass LibbalsaVfsClass;
 struct _LibbalsaVfs {
     GObject parent;
 
-    struct _LibbalsaVfsPriv *priv;
+    struct _LibbalsaVfsPriv * priv;
 };
 
 struct _LibbalsaVfsClass {
@@ -59,52 +56,52 @@ struct _LibbalsaVfsClass {
 gboolean libbalsa_vfs_local_only(void);
 
 GType libbalsa_vfs_get_type(void);
-LibbalsaVfs *libbalsa_vfs_new(void);
-LibbalsaVfs *libbalsa_vfs_new_from_uri(const gchar *uri);
-LibbalsaVfs *libbalsa_vfs_append(const LibbalsaVfs *file,
-                                 const gchar       *text);
-LibbalsaVfs *libbalsa_vfs_dir_append(const LibbalsaVfs *dir,
-                                     const gchar       *filename);
-const gchar *libbalsa_vfs_get_folder(const LibbalsaVfs *file);
-const gchar *libbalsa_vfs_get_uri(const LibbalsaVfs *file);
-const gchar *libbalsa_vfs_get_uri_utf8(const LibbalsaVfs *file);
-const gchar *libbalsa_vfs_get_basename_utf8(const LibbalsaVfs *file);
-const gchar *libbalsa_vfs_get_mime_type(const LibbalsaVfs *file);
-const gchar *libbalsa_vfs_get_charset(const LibbalsaVfs *file);
-LibBalsaTextAttribute libbalsa_vfs_get_text_attr(const LibbalsaVfs *file);
-guint64 libbalsa_vfs_get_size(const LibbalsaVfs *file);
-GMimeStream *libbalsa_vfs_create_stream(const LibbalsaVfs *file,
-                                        mode_t             mode,
-                                        gboolean           rdwr,
-                                        GError           **err);
-gboolean libbalsa_vfs_file_exists(const LibbalsaVfs *file);
-gboolean libbalsa_vfs_is_regular_file(const LibbalsaVfs *file,
-                                      GError           **err);
-gint libbalsa_vfs_file_unlink(const LibbalsaVfs *file,
-                              GError           **err);
+LibbalsaVfs * libbalsa_vfs_new(void);
+LibbalsaVfs * libbalsa_vfs_new_from_uri(const gchar * uri);
+LibbalsaVfs * libbalsa_vfs_append(const LibbalsaVfs * file,
+                                  const gchar * text);
+LibbalsaVfs * libbalsa_vfs_dir_append(const LibbalsaVfs * dir,
+                                      const gchar * filename);
+const gchar * libbalsa_vfs_get_folder(const LibbalsaVfs * file);
+const gchar * libbalsa_vfs_get_uri(const LibbalsaVfs * file);
+const gchar * libbalsa_vfs_get_uri_utf8(const LibbalsaVfs * file);
+const gchar * libbalsa_vfs_get_basename_utf8(const LibbalsaVfs * file);
+const gchar * libbalsa_vfs_get_mime_type(const LibbalsaVfs * file);
+const gchar * libbalsa_vfs_get_charset(const LibbalsaVfs * file);
+LibBalsaTextAttribute libbalsa_vfs_get_text_attr(const LibbalsaVfs * file);
+guint64 libbalsa_vfs_get_size(const LibbalsaVfs * file);
+GMimeStream * libbalsa_vfs_create_stream(const LibbalsaVfs * file,
+                                         mode_t mode, 
+                                         gboolean rdwr,
+                                         GError ** err);
+gboolean libbalsa_vfs_file_exists(const LibbalsaVfs * file);
+gboolean libbalsa_vfs_is_regular_file(const LibbalsaVfs * file,
+                                      GError **err);
+gint libbalsa_vfs_file_unlink(const LibbalsaVfs * file,
+                              GError **err);
 
 /* application launch helpers */
-gboolean libbalsa_vfs_launch_app(const LibbalsaVfs *file,
-                                 GObject           *object,
-                                 GError           **err);
-gboolean libbalsa_vfs_launch_app_for_body(LibBalsaMessageBody *mime_body,
-                                          GObject             *object,
-                                          GError             **err);
-void libbalsa_vfs_fill_menu_by_content_type(GtkMenu     *menu,
-                                            const gchar *content_type,
-                                            GCallback    callback,
-                                            gpointer     data);
-GtkWidget *libbalsa_vfs_mime_button(LibBalsaMessageBody *mime_body,
-                                    const gchar         *content_type,
-                                    GCallback            callback,
-                                    gpointer             data);
+gboolean libbalsa_vfs_launch_app(const LibbalsaVfs * file,
+                                 GObject * object,
+                                 GError **err);
+gboolean libbalsa_vfs_launch_app_for_body(LibBalsaMessageBody * mime_body,
+                                          GObject * object,
+                                          GError **err);
+void libbalsa_vfs_fill_menu_by_content_type(GtkMenu * menu,
+                                            const gchar * content_type,
+                                            GCallback callback,
+                                            gpointer data);
+GtkWidget * libbalsa_vfs_mime_button(LibBalsaMessageBody * mime_body,
+                                     const gchar * content_type,
+                                     GCallback callback,
+                                     gpointer data);
 
 /* content type helpers */
-gchar *libbalsa_vfs_content_description(const gchar *mime_type);
-gchar *libbalsa_vfs_content_type_of_buffer(const guchar *buffer,
-                                           gsize         length);
+gchar * libbalsa_vfs_content_description(const gchar * mime_type);
+gchar * libbalsa_vfs_content_type_of_buffer(const guchar * buffer,
+                                            gsize length);
 
 G_END_DECLS
 
 
-#endif                          /* __LIBBALSA_VFS_H__ */
+#endif                         /* __LIBBALSA_VFS_H__ */
diff --git a/libbalsa/libbalsa.c b/libbalsa/libbalsa.c
index 5dd0f7f..25683a1 100644
--- a/libbalsa/libbalsa.c
+++ b/libbalsa/libbalsa.c
@@ -6,20 +6,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "libbalsa.h"
 
@@ -35,24 +35,24 @@
 #include <openssl/err.h>
 
 #ifdef HAVE_NOTIFY
-#   include <libnotify/notify.h>
+#include <libnotify/notify.h>
 #endif
 
 #if ENABLE_LDAP
-#   include <ldap.h>
+#include <ldap.h>
 #endif
 
 #if HAVE_COMPFACE
-#   include <compface.h>
+#include <compface.h>
 #endif                          /* HAVE_COMPFACE */
 
 #if HAVE_GTKSOURCEVIEW
-#   include <gtksourceview/gtksource.h>
+#include <gtksourceview/gtksource.h>
 #endif
 
 #if HAVE_GCR
-#   define GCR_API_SUBJECT_TO_CHANGE
-#   include <gcr/gcr.h>
+#define GCR_API_SUBJECT_TO_CHANGE
+#include <gcr/gcr.h>
 #endif
 
 #include "misc.h"
@@ -63,8 +63,7 @@ static GThread *main_thread_id;
 
 
 void
-libbalsa_message(const char *fmt,
-                 ...)
+libbalsa_message(const char *fmt, ...)
 {
     va_list va_args;
 
@@ -74,7 +73,6 @@ libbalsa_message(const char *fmt,
     va_end(va_args);
 }
 
-
 void
 libbalsa_init(LibBalsaInformationFunc information_callback)
 {
@@ -129,9 +127,9 @@ libbalsa_init(LibBalsaInformationFunc information_callback)
 
 /* libbalsa_rot:
    return rot13'ed string.
- */
+*/
 gchar *
-libbalsa_rot(const gchar *pass)
+libbalsa_rot(const gchar * pass)
 {
     gchar *buff;
     gint len = 0, i = 0;
@@ -142,13 +140,12 @@ libbalsa_rot(const gchar *pass)
     buff = g_strdup(pass);
 
     for (i = 0; i < len; i++) {
-        if (((buff[i] <= 'M') && (buff[i] >= 'A'))
-            || ((buff[i] <= 'm') && (buff[i] >= 'a'))) {
-            buff[i] += 13;
-        } else if (((buff[i] <= 'Z') && (buff[i] >= 'N'))
-                   || ((buff[i] <= 'z') && (buff[i] >= 'n'))) {
-            buff[i] -= 13;
-        }
+       if ((buff[i] <= 'M' && buff[i] >= 'A')
+           || (buff[i] <= 'm' && buff[i] >= 'a'))
+           buff[i] += 13;
+       else if ((buff[i] <= 'Z' && buff[i] >= 'N')
+                || (buff[i] <= 'z' && buff[i] >= 'n'))
+           buff[i] -= 13;
     }
     return buff;
 }
@@ -165,29 +162,29 @@ libbalsa_rot(const gchar *pass)
    3. Append the domainname to the user name.
    4. Append the hostname to the user name.
 
- */
-gchar *
+*/
+gchar*
 libbalsa_guess_email_address(void)
 {
     /* Q: Find this location with configure? or at run-time? */
-    static const gchar *MAILNAME_FILE = "/etc/mailname";
-    gchar *preset, *domain;
+    static const gchar* MAILNAME_FILE = "/etc/mailname";
+    gchar* preset, *domain;
     gchar *mailname;
 
-    if (g_getenv("EMAIL") != NULL) {                 /* 1. */
+    if(g_getenv("EMAIL") != NULL){                  /* 1. */
         preset = g_strdup(g_getenv("EMAIL"));
     } else if (g_file_get_contents(MAILNAME_FILE, &mailname, NULL, NULL)) { /* 2. */
-        gchar *newline;
+       gchar *newline;
 
-        newline = strchr(mailname, '\n');
-        if (newline != NULL) {
-            newline[0] = '\0';
-        }
+       newline = strchr(mailname, '\n');
+       if (newline != NULL) {
+               newline[0] = '\0';
+       }
         preset = g_strconcat(g_get_user_name(), "@", mailname, NULL);
         g_free(mailname);
-    } else if ((domain = libbalsa_get_domainname())) {   /* 3. */
+    }else if((domain = libbalsa_get_domainname())){ /* 3. */
         preset = g_strconcat(g_get_user_name(), "@", domain, NULL);
-        g_free(domain);
+        g_free(domain);    
     } else {                                        /* 4. */
         char hostbuf[512];
 
@@ -197,44 +194,41 @@ libbalsa_guess_email_address(void)
     return preset;
 }
 
-
 /* libbalsa_guess_mail_spool
 
    Returns an allocated gchar * with our best guess of the user's
    mail spool file.
- */
+*/
 gchar *
 libbalsa_guess_mail_spool(void)
 {
     gchar *env;
     gchar *spool;
     static const gchar *guesses[] = {
-        "/var/mail/",
-        "/var/spool/mail/",
-        "/usr/spool/mail/",
-        "/usr/mail/",
-        NULL
+       "/var/mail/",
+       "/var/spool/mail/",
+       "/usr/spool/mail/",
+       "/usr/mail/",
+       NULL
     };
 
-    if ((env = getenv("MAIL")) != NULL) {
-        return g_strdup(env);
-    }
+    if ((env = getenv("MAIL")) != NULL)
+       return g_strdup(env);
 
     if ((env = getenv("USER")) != NULL) {
         int i;
 
-        for (i = 0; guesses[i] != NULL; i++) {
-            spool = g_strconcat(guesses[i], env, NULL);
+       for (i = 0; guesses[i] != NULL; i++) {
+           spool = g_strconcat(guesses[i], env, NULL);
 
-            if (g_file_test(spool, G_FILE_TEST_EXISTS)) {
-                return spool;
-            }
+           if (g_file_test(spool, G_FILE_TEST_EXISTS))
+               return spool;
 
-            g_free(spool);
-        }
+           g_free(spool);
+       }
     }
 
-    /* libmutt's configure.in indicates that this
+    /* libmutt's configure.in indicates that this 
      * ($HOME/mailbox) exists on
      * some systems, and it's a good enough default if we
      * can't guess it any other way. */
@@ -242,28 +236,25 @@ libbalsa_guess_mail_spool(void)
 }
 
 
-gboolean
-libbalsa_ldap_exists(const gchar *server)
+gboolean libbalsa_ldap_exists(const gchar *server)
 {
 #if ENABLE_LDAP
     LDAP *ldap;
     ldap_initialize(&ldap, server);
 
-    if (ldap) {
-        ldap_unbind_ext(ldap, NULL, NULL);
-        return TRUE;
+    if(ldap) {
+       ldap_unbind_ext(ldap, NULL, NULL);
+       return TRUE;
     }
 #endif /* #if ENABLE_LDAP */
 
     return FALSE;
 }
 
-
-gchar *
-libbalsa_date_to_utf8(const time_t date,
-                      const gchar *date_string)
+gchar*
+libbalsa_date_to_utf8(const time_t date, const gchar *date_string)
 {
-    gchar *result;
+       gchar *result;
 
     g_return_val_if_fail(date_string != NULL, NULL);
 
@@ -271,31 +262,29 @@ libbalsa_date_to_utf8(const time_t date,
         /* Missing "Date:" field?  It is required by RFC 2822. */
         result = NULL;
     } else {
-        GDateTime *footime;
+       GDateTime *footime;
 
-        footime = g_date_time_new_from_unix_local(date);
-        result = g_date_time_format(footime, date_string);
-        g_date_time_unref(footime);
+       footime = g_date_time_new_from_unix_local(date);
+       result = g_date_time_format(footime, date_string);
+       g_date_time_unref(footime);
     }
     return result;
 }
 
-
 LibBalsaMessageStatus
 libbalsa_get_icon_from_flags(LibBalsaMessageFlag flags)
 {
     LibBalsaMessageStatus icon;
-    if (flags & LIBBALSA_MESSAGE_FLAG_DELETED) {
-        icon = LIBBALSA_MESSAGE_STATUS_DELETED;
-    } else if (flags & LIBBALSA_MESSAGE_FLAG_NEW) {
-        icon = LIBBALSA_MESSAGE_STATUS_UNREAD;
-    } else if (flags & LIBBALSA_MESSAGE_FLAG_FLAGGED) {
-        icon = LIBBALSA_MESSAGE_STATUS_FLAGGED;
-    } else if (flags & LIBBALSA_MESSAGE_FLAG_REPLIED) {
-        icon = LIBBALSA_MESSAGE_STATUS_REPLIED;
-    } else {
-        icon = LIBBALSA_MESSAGE_STATUS_ICONS_NUM;
-    }
+    if (flags & LIBBALSA_MESSAGE_FLAG_DELETED)
+       icon = LIBBALSA_MESSAGE_STATUS_DELETED;
+    else if (flags & LIBBALSA_MESSAGE_FLAG_NEW)
+       icon = LIBBALSA_MESSAGE_STATUS_UNREAD;
+    else if (flags & LIBBALSA_MESSAGE_FLAG_FLAGGED)
+       icon = LIBBALSA_MESSAGE_STATUS_FLAGGED;
+    else if (flags & LIBBALSA_MESSAGE_FLAG_REPLIED)
+       icon = LIBBALSA_MESSAGE_STATUS_REPLIED;
+    else
+       icon = LIBBALSA_MESSAGE_STATUS_ICONS_NUM;
     return icon;
 }
 
@@ -315,7 +304,7 @@ typedef struct {
 static gboolean
 ask_idle(gpointer data)
 {
-    AskData *ad = (AskData *)data;
+    AskData* ad = (AskData*)data;
     printf("ask_idle: ENTER %p\n", data);
     ad->res = (ad->cb)(ad->arg);
     ad->done = TRUE;
@@ -324,14 +313,12 @@ ask_idle(gpointer data)
     return FALSE;
 }
 
-
 /* libbalsa_ask_mt:
    executed with GDK UNLOCKED. see mailbox_imap_open() and
    imap_dir_cb()/imap_folder_imap_dir().
- */
+*/
 static int
-libbalsa_ask(gboolean (*cb)(void *arg),
-             void      *arg)
+libbalsa_ask(gboolean (*cb)(void *arg), void *arg)
 {
     AskData ad;
 
@@ -344,14 +331,14 @@ libbalsa_ask(gboolean (*cb)(void *arg),
     printf("Side thread asks the following question.\n");
     g_mutex_init(&ad.lock);
     g_cond_init(&ad.condvar);
-    ad.cb = cb;
+    ad.cb  = cb;
     ad.arg = arg;
     ad.done = FALSE;
 
     g_mutex_lock(&ad.lock);
     g_idle_add(ask_idle, &ad);
     while (!ad.done) {
-        g_cond_wait(&ad.condvar, &ad.lock);
+       g_cond_wait(&ad.condvar, &ad.lock);
     }
 
     g_cond_clear(&ad.condvar);
@@ -360,38 +347,34 @@ libbalsa_ask(gboolean (*cb)(void *arg),
 }
 
 
-static int libbalsa_ask_for_cert_acceptance(X509       *cert,
-                                            const char *explanation);
+static int libbalsa_ask_for_cert_acceptance(X509 *cert,
+                                           const char *explanation);
 
 #ifndef HAVE_GCR
 
-static char *
+static char*
 asn1time_to_string(ASN1_UTCTIME *tm)
 {
     char buf[64];
-    BIO *bio = BIO_new(BIO_s_mem());
-    strncpy(buf, _("Invalid date"), sizeof(buf));
-    buf[sizeof(buf) - 1] = '\0';
+    BIO *bio  = BIO_new(BIO_s_mem());
+    strncpy(buf, _("Invalid date"), sizeof(buf)); buf[sizeof(buf)-1]='\0';
 
-    if (ASN1_TIME_print(bio, tm)) {
+    if(ASN1_TIME_print(bio, tm)) {
         int cnt;
-        cnt = BIO_read(bio, buf, sizeof(buf) - 1);
+        cnt = BIO_read(bio, buf, sizeof(buf)-1);
         buf[cnt] = '\0';
     }
     BIO_free(bio);
     return g_strdup(buf);
 }
 
-
-static char *
-x509_get_part(char       *line,
-              const char *ndx)
+static char*
+x509_get_part (char *line, const char *ndx)
 {
     static char ret[256];
     char *c;
 
-    strncpy (ret, _("Unknown"), sizeof (ret));
-    ret[sizeof(ret) - 1] = '\0';
+    strncpy (ret, _("Unknown"), sizeof (ret)); ret[sizeof(ret)-1]='\0';
 
     c = strstr(line, ndx);
     if (c) {
@@ -399,45 +382,32 @@ x509_get_part(char       *line,
 
         c += strlen (ndx);
         c2 = strchr (c, '/');
-        if (c2) {
+        if (c2)
             *c2 = '\0';
-        }
         strncpy (ret, c, sizeof (ret));
-        if (c2) {
+        if (c2)
             *c2 = '/';
-        }
     }
 
     return ret;
 }
-
-
 static void
-x509_fingerprint(char    *s,
-                 unsigned len,
-                 X509    *cert)
+x509_fingerprint (char *s, unsigned len, X509 * cert)
 {
     unsigned j, i, n, c;
     unsigned char md[EVP_MAX_MD_SIZE];
 
 
     X509_digest(cert, EVP_md5(), md, &n);
-    if (len < 3 * n) {
-        n = len / 3;
-    }
-    for (j = i = 0; j < n; j++) {
-        c = (md[j] >> 4) & 0xF;
-        s[i++] = c < 10 ? c + '0' : c + 'A' - 10;
-        c = md[j] & 0xF;
-        s[i++] = c < 10 ? c + '0' : c + 'A' - 10;
-        if (j < n - 1) {
-            s[i++] = ':';
-        }
+    if(len<3*n) n = len/3;
+    for (j=i=0; j<n; j++) {
+        c = (md[j] >>4) & 0xF; s[i++] = c<10 ? c + '0' : c+'A'-10;
+        c = md[j] & 0xF;       s[i++] = c<10 ? c + '0' : c+'A'-10;
+        if(j<n-1) s[i++] = ':';
     }
     s[i] = '\0';
 }
 
-
 #endif  /* HAVE_GCR */
 
 static GList *accepted_certs = NULL; /* certs accepted for this session */
@@ -453,11 +423,9 @@ libbalsa_certs_destroy(void)
     g_mutex_unlock(&certificate_lock);
 }
 
-
 /* compare Example 10-7 in the OpenSSL book */
 gboolean
-libbalsa_is_cert_known(X509 *cert,
-                       long  vfy_result)
+libbalsa_is_cert_known(X509* cert, long vfy_result)
 {
     X509 *tmpcert = NULL;
     FILE *fp;
@@ -466,65 +434,60 @@ libbalsa_is_cert_known(X509 *cert,
     GList *lst;
 
     g_mutex_lock(&certificate_lock);
-    for (lst = accepted_certs; lst; lst = lst->next) {
+    for(lst = accepted_certs; lst; lst = lst->next) {
         int X509_res = X509_cmp(cert, lst->data);
-        if (X509_res == 0) {
-            g_mutex_unlock(&certificate_lock);
+        if(X509_res == 0) {
+               g_mutex_unlock(&certificate_lock);
             return TRUE;
-        }
+       }
     }
-
+    
     cert_name = g_strconcat(g_get_home_dir(), "/.balsa/certificates", NULL);
 
     fp = fopen(cert_name, "rt");
     g_free(cert_name);
-    if (fp) {
-        /*
-           printf("Looking for cert: %s\n",
+    if(fp) {
+        /* 
+        printf("Looking for cert: %s\n", 
                X509_NAME_oneline(X509_get_subject_name (cert),
                                  buf, sizeof (buf)));
-         */
+        */
         res = FALSE;
         while ((tmpcert = PEM_read_X509(fp, NULL, NULL, NULL)) != NULL) {
-            res = X509_cmp(cert, tmpcert) == 0;
+            res = X509_cmp(cert, tmpcert)==0;
             X509_free(tmpcert);
-            if (res) {
-                break;
-            }
+            if(res) break;
         }
         ERR_clear_error();
         fclose(fp);
     }
     g_mutex_unlock(&certificate_lock);
-
-    if (!res) {
-        const char *reason = X509_verify_cert_error_string(vfy_result);
-        res = libbalsa_ask_for_cert_acceptance(cert, reason);
-        g_mutex_lock(&certificate_lock);
-        if (res == 2) {
-            cert_name = g_strconcat(g_get_home_dir(),
-                                    "/.balsa/certificates", NULL);
+    
+    if(!res) {
+       const char *reason = X509_verify_cert_error_string(vfy_result);
+       res = libbalsa_ask_for_cert_acceptance(cert, reason);
+       g_mutex_lock(&certificate_lock);
+       if(res == 2) {
+           cert_name = g_strconcat(g_get_home_dir(),
+                                   "/.balsa/certificates", NULL);
             libbalsa_assure_balsa_dir();
-            fp = fopen(cert_name, "a");
-            if (fp) {
-                if (PEM_write_X509 (fp, cert)) {
-                    res = TRUE;
-                }
-                fclose(fp);
-            }
-            g_free(cert_name);
-        }
-        if (res == 1) {
-            accepted_certs =
-                g_list_prepend(accepted_certs, X509_dup(cert));
-        }
-        g_mutex_unlock(&certificate_lock);
+           fp = fopen(cert_name, "a");
+           if (fp) {
+               if(PEM_write_X509 (fp, cert))
+                   res = TRUE;
+               fclose(fp);
+           }
+           g_free(cert_name);
+       }
+       if(res == 1)
+           accepted_certs = 
+               g_list_prepend(accepted_certs, X509_dup(cert));
+       g_mutex_unlock(&certificate_lock);
     }
 
     return res;
 }
 
-
 /* libbalsa_ask_for_cert_acceptance():
    returns:
    OP_EXIT on reject.
@@ -532,7 +495,7 @@ libbalsa_is_cert_known(X509 *cert,
    OP_MAX - on accept once.
    TODO: check treading issues.
 
- */
+*/
 struct AskCertData {
     X509 *certificate;
     const char *explanation;
@@ -543,7 +506,7 @@ struct AskCertData {
 static int
 ask_cert_real(void *data)
 {
-    struct AskCertData *acd = (struct AskCertData *)data;
+    struct AskCertData *acd = (struct AskCertData*)data;
     GtkWidget *dialog;
     GtkWidget *cert_widget;
     GString *str;
@@ -584,44 +547,39 @@ ask_cert_real(void *data)
     gtk_widget_set_vexpand(cert_widget, TRUE);
     gtk_box_pack_start(vbox, cert_widget);
 
-    switch (gtk_dialog_run(GTK_DIALOG(dialog))) {
+    switch(gtk_dialog_run(GTK_DIALOG(dialog))) {
     case 0:
-        i = 1;
-        break;
-
+       i = 1;
+       break;
     case 1:
-        i = 2;
-        break;
-
+       i = 2;
+       break;
     case GTK_RESPONSE_CANCEL:
     default:
-        i = 0;
-        break;
+       i = 0;
+       break;
     }
     gtk_widget_destroy(dialog);
     return i;
 }
 
-
 #else
 
 static int
 ask_cert_real(void *data)
 {
     static const char *part[] =
-    {
-        "/CN=", "/Email=", "/O=", "/OU=", "/L=", "/ST=", "/C="
-    };
+        {"/CN=", "/Email=", "/O=", "/OU=", "/L=", "/ST=", "/C="};
 
-    struct AskCertData *acd = (struct AskCertData *)data;
+    struct AskCertData *acd = (struct AskCertData*)data;
     X509 *cert = acd->certificate;
     char buf[256]; /* fingerprint requires EVP_MAX_MD_SIZE*3 */
     char *name = NULL, *c, *valid_from, *valid_until;
-    GtkWidget *dialog, *label;
+    GtkWidget* dialog, *label;
     unsigned i;
     GtkBox *vbox;
 
-    GString *str = g_string_new("");
+    GString* str = g_string_new("");
 
     g_string_printf(str, _("Authenticity of this certificate "
                            "could not be verified.\n"
@@ -644,7 +602,7 @@ ask_cert_real(void *data)
 
     buf[0] = '\0';
     x509_fingerprint (buf, sizeof (buf), cert);
-    valid_from = asn1time_to_string(X509_get_notBefore(cert));
+    valid_from  = asn1time_to_string(X509_get_notBefore(cert));
     valid_until = asn1time_to_string(X509_get_notAfter(cert)),
     c = g_strdup_printf(_("<b>This certificate is valid</b>\n"
                           "from %s\n"
@@ -652,10 +610,8 @@ ask_cert_real(void *data)
                           "<b>Fingerprint:</b> %s"),
                         valid_from, valid_until,
                         buf);
-    g_string_append(str, c);
-    g_free(c);
-    g_free(valid_from);
-    g_free(valid_until);
+    g_string_append(str, c); g_free(c);
+    g_free(valid_from); g_free(valid_until);
 
     /* This string uses markup, so we must replace "&" with "&amp;" */
     c = str->str;
@@ -673,7 +629,7 @@ ask_cert_real(void *data)
                                          libbalsa_dialog_flags(),
                                          _("_Accept Once"), 0,
                                          _("Accept & _Save"), 1,
-                                         _("_Reject"), GTK_RESPONSE_CANCEL,
+                                         _("_Reject"), GTK_RESPONSE_CANCEL, 
                                          NULL);
     gtk_window_set_role(GTK_WINDOW(dialog), "tls_cert_dialog");
     label = gtk_label_new(str->str);
@@ -686,33 +642,25 @@ ask_cert_real(void *data)
     gtk_widget_set_vexpand(label, TRUE);
     gtk_box_pack_start(vbox, label);
 
-    switch (gtk_dialog_run(GTK_DIALOG(dialog))) {
-    case 0: i = 1;
-        break;
-
-    case 1: i = 2;
-        break;
-
+    switch(gtk_dialog_run(GTK_DIALOG(dialog))) {
+    case 0: i = 1; break;
+    case 1: i = 2; break;
     case GTK_RESPONSE_CANCEL:
-    default: i = 0;
-        break;
+    default: i=0; break;
     }
     gtk_widget_destroy(dialog);
     /* Process some events to let the window disappear:
-    * not really necessary but helps with debugging. */
-    while (gtk_events_pending()) {
+     * not really necessary but helps with debugging. */
+   while(gtk_events_pending()) 
         gtk_main_iteration_do(FALSE);
-    }
     printf("%s returns %d\n", __FUNCTION__, i);
     return i;
 }
 
-
-#endif  /* HAVE_GCR */
+#endif /* HAVE_GCR */
 
 static int
-libbalsa_ask_for_cert_acceptance(X509       *cert,
-                                 const char *explanation)
+libbalsa_ask_for_cert_acceptance(X509 *cert, const char *explanation)
 {
     struct AskCertData acd;
     acd.certificate = cert;
@@ -724,8 +672,8 @@ libbalsa_ask_for_cert_acceptance(X509       *cert,
 static int
 ask_timeout_real(void *data)
 {
-    const char *host = (const char *)data;
-    GtkWidget *dialog;
+    const char *host = (const char*)data;
+    GtkWidget* dialog;
     int i;
 
     dialog = gtk_message_dialog_new(NULL, /* FIXME: NULL parent */
@@ -735,38 +683,31 @@ ask_timeout_real(void *data)
                                     _("Connection to %s timed out. Abort?"),
                                     host);
     gtk_window_set_role(GTK_WINDOW(dialog), "timeout_dialog");
-    switch (gtk_dialog_run(GTK_DIALOG(dialog))) {
-    case GTK_RESPONSE_YES: i = 1;
-        break;
-
-    case GTK_RESPONSE_NO: i = 0;
-        break;
-
+    switch(gtk_dialog_run(GTK_DIALOG(dialog))) {
+    case GTK_RESPONSE_YES: i = 1; break;
+    case GTK_RESPONSE_NO: i = 0; break;
     default: printf("Unknown response. Defaulting to 'yes'.\n");
         i = 1;
     }
     gtk_widget_destroy(dialog);
     /* Process some events to let the window disappear:
-    * not really necessary but helps with debugging. */
-    while (gtk_events_pending()) {
+     * not really necessary but helps with debugging. */
+   while(gtk_events_pending()) 
         gtk_main_iteration_do(FALSE);
-    }
     printf("%s returns %d\n", __FUNCTION__, i);
     return i;
 }
 
-
 gboolean
 libbalsa_abort_on_timeout(const char *host)
-{
-    /* It appears not to be entirely thread safe... Some locks do not
-       get released as they should be. */
+{  /* It appears not to be entirely thread safe... Some locks do not
+      get released as they should be. */
     char *hostname;
 
     hostname = g_alloca (strlen (host) + 1);
     strcpy (hostname, host);
-
-    return libbalsa_ask(ask_timeout_real, hostname) != 0;
+    
+    return libbalsa_ask(ask_timeout_real, hostname) != 0; 
 }
 
 
@@ -776,7 +717,6 @@ libbalsa_get_main_thread(void)
     return main_thread_id;
 }
 
-
 gboolean
 libbalsa_am_i_subthread(void)
 {
@@ -784,26 +724,24 @@ libbalsa_am_i_subthread(void)
 }
 
 
-#include "libbalsa_private.h"   /* for prototypes */
+#include "libbalsa_private.h"  /* for prototypes */
 static GMutex mailbox_mutex;
-static GCond mailbox_cond;
+static GCond  mailbox_cond;
 
 /* Lock/unlock a mailbox; no argument checking--we'll assume the caller
- * took care of that.
+ * took care of that. 
  */
 #define LIBBALSA_DEBUG_THREADS FALSE
 void
-libbalsa_lock_mailbox(LibBalsaMailbox *mailbox)
+libbalsa_lock_mailbox(LibBalsaMailbox * mailbox)
 {
-    GThread *thread_id = g_thread_self();
+       GThread *thread_id = g_thread_self();
 
     g_mutex_lock(&mailbox_mutex);
 
-    if (mailbox->thread_id && (mailbox->thread_id != thread_id)) {
-        while (mailbox->lock) {
+    if (mailbox->thread_id && mailbox->thread_id != thread_id)
+        while (mailbox->lock)
             g_cond_wait(&mailbox_cond, &mailbox_mutex);
-        }
-    }
 
     /* We'll assume that no-one would destroy a mailbox while we've been
      * trying to lock it. If they have, we have larger problems than
@@ -814,23 +752,22 @@ libbalsa_lock_mailbox(LibBalsaMailbox *mailbox)
     g_mutex_unlock(&mailbox_mutex);
 }
 
-
 void
-libbalsa_unlock_mailbox(LibBalsaMailbox *mailbox)
+libbalsa_unlock_mailbox(LibBalsaMailbox * mailbox)
 {
-    GThread *self;
+       GThread *self;
 
     self = g_thread_self();
 
     g_mutex_lock(&mailbox_mutex);
 
-    if ((mailbox->lock == 0) || (self != mailbox->thread_id)) {
-        g_warning("Not holding mailbox lock!!!");
+    if (mailbox->lock == 0 || self != mailbox->thread_id) {
+       g_warning("Not holding mailbox lock!!!");
         g_mutex_unlock(&mailbox_mutex);
-        return;
+       return;
     }
 
-    if (--mailbox->lock == 0) {
+    if(--mailbox->lock == 0) {
         mailbox->thread_id = 0;
         g_cond_broadcast(&mailbox_cond);
     }
@@ -840,44 +777,36 @@ libbalsa_unlock_mailbox(LibBalsaMailbox *mailbox)
 
 
 /* Initialized by the front end. */
-void (*libbalsa_progress_set_text) (LibBalsaProgress *progress,
-                                    const gchar      *text,
-                                    guint             total);
-void (*libbalsa_progress_set_fraction) (LibBalsaProgress *progress,
-                                        gdouble           fraction);
-void (*libbalsa_progress_set_activity) (gboolean     set,
-                                        const gchar *text);
+void (*libbalsa_progress_set_text) (LibBalsaProgress * progress,
+                                    const gchar * text, guint total);
+void (*libbalsa_progress_set_fraction) (LibBalsaProgress * progress,
+                                        gdouble fraction);
+void (*libbalsa_progress_set_activity) (gboolean set, const gchar * text);
 
 /*
  * Face and X-Face header support.
  */
 gchar *
-libbalsa_get_header_from_path(const gchar *header,
-                              const gchar *path,
-                              gsize       *size,
-                              GError     **err)
+libbalsa_get_header_from_path(const gchar * header, const gchar * path,
+                              gsize * size, GError ** err)
 {
     gchar *buf, *content;
     size_t name_len;
     gchar *p, *q;
 
-    if (!g_file_get_contents(path, &buf, size, err)) {
+    if (!g_file_get_contents(path, &buf, size, err))
         return NULL;
-    }
 
     content = buf;
     name_len = strlen(header);
-    if (g_ascii_strncasecmp(content, header, name_len) == 0) {
+    if (g_ascii_strncasecmp(content, header, name_len) == 0)
         /* Skip header and trailing colon: */
         content += name_len + 1;
-    }
 
     /* Unfold. */
-    for (p = q = content; *p; p++) {
-        if ((*p != '\r') && (*p != '\n')) {
+    for (p = q = content; *p; p++)
+        if (*p != '\r' && *p != '\n')
             *q++ = *p;
-        }
-    }
     *q = '\0';
 
     content = g_strdup(content);
@@ -886,10 +815,8 @@ libbalsa_get_header_from_path(const gchar *header,
     return content;
 }
 
-
 GtkWidget *
-libbalsa_get_image_from_face_header(const gchar *content,
-                                    GError     **err)
+libbalsa_get_image_from_face_header(const gchar * content, GError ** err)
 {
     GMimeStream *stream;
     GMimeStream *stream_filter;
@@ -908,20 +835,19 @@ libbalsa_get_image_from_face_header(const gchar *content,
     g_object_unref(stream_filter);
 
     array = GMIME_STREAM_MEM(stream)->buffer;
-    if (array->len == 0) {
+    if (array->len == 0)
         g_set_error(err, LIBBALSA_IMAGE_ERROR,
                     LIBBALSA_IMAGE_ERROR_NO_DATA, _("No image data"));
-    } else {
+    else {
         GdkPixbufLoader *loader =
             gdk_pixbuf_loader_new_with_type("png", NULL);
 
         gdk_pixbuf_loader_write(loader, array->data, array->len, err);
         gdk_pixbuf_loader_close(loader, *err ? NULL : err);
 
-        if (!*err) {
+        if (!*err)
             image = gtk_image_new_from_pixbuf(gdk_pixbuf_loader_get_pixbuf
-                                                  (loader));
-        }
+                                              (loader));
         g_object_unref(loader);
     }
     g_object_unref(stream);
@@ -929,11 +855,9 @@ libbalsa_get_image_from_face_header(const gchar *content,
     return image;
 }
 
-
 #if HAVE_COMPFACE
 GtkWidget *
-libbalsa_get_image_from_x_face_header(const gchar *content,
-                                      GError     **err)
+libbalsa_get_image_from_x_face_header(const gchar * content, GError ** err)
 {
     gchar buf[2048];
     GdkPixbuf *pixbuf;
@@ -949,7 +873,6 @@ libbalsa_get_image_from_x_face_header(const gchar *content,
         g_set_error(err, LIBBALSA_IMAGE_ERROR, LIBBALSA_IMAGE_ERROR_FORMAT,
                     _("Invalid input format"));
         return image;
-
     case -2:
         g_set_error(err, LIBBALSA_IMAGE_ERROR, LIBBALSA_IMAGE_ERROR_BUFFER,
                     _("Internal buffer overrun"));
@@ -973,14 +896,13 @@ libbalsa_get_image_from_x_face_header(const gchar *content,
             g_object_unref(pixbuf);
             return image;
         }
-        for (j = 0, q = pixels; j < 3; j++) {
-            for (k = 15; k >= 0; --k) {
+        for (j = 0, q = pixels; j < 3; j++)
+            for (k = 15; k >= 0; --k){
                 guchar c = x[j] & (1 << k) ? 0x00 : 0xff;
                 *q++ = c;       /* red   */
                 *q++ = c;       /* green */
                 *q++ = c;       /* blue  */
             }
-        }
         p = strchr(p, '\n') + 1;
         pixels += gdk_pixbuf_get_rowstride(pixbuf);
     }
@@ -990,8 +912,6 @@ libbalsa_get_image_from_x_face_header(const gchar *content,
 
     return image;
 }
-
-
 #endif                          /* HAVE_COMPFACE */
 
 #if HAVE_GTKSOURCEVIEW
@@ -1002,57 +922,52 @@ libbalsa_source_view_new(gboolean highlight_phrases)
     GtkWidget *sview;
 
 
-    static GtkSourceLanguageManager *lm = NULL;
-    static GtkSourceStyleScheme *scheme = NULL;
-    static GtkSourceLanguage *src_lang = NULL;
+    static GtkSourceLanguageManager * lm = NULL;
+    static GtkSourceStyleScheme * scheme = NULL;
+    static GtkSourceLanguage * src_lang = NULL;
 
     /* initialise the source language manager if necessary */
     if (!lm) {
-        const gchar *const *lm_dpaths;
-
-        if ((lm = gtk_source_language_manager_new()) &&
-            (lm_dpaths = gtk_source_language_manager_get_search_path(lm))) {
-            gchar **lm_rpaths;
-            gint n;
-
-            /* add the balsa share path to the language manager's paths - we
-             * cannot simply replace it as it still wants to see the
-             * RelaxNG schema... */
-            for (n = 0; lm_dpaths[n]; n++) {
-            }
-            lm_rpaths = g_new0(gchar *, n + 2);
-            for (n = 0; lm_dpaths[n]; n++) {
-                lm_rpaths[n] = g_strdup(lm_dpaths[n]);
-            }
-            lm_rpaths[n] = g_strdup(BALSA_DATA_PREFIX "/gtksourceview-3.0");
-            gtk_source_language_manager_set_search_path(lm, lm_rpaths);
-            g_strfreev(lm_rpaths);
-
-            /* try to load the language */
-            if ((src_lang =
-                     gtk_source_language_manager_get_language(lm, "balsa"))) {
-                GtkSourceStyleSchemeManager *smgr =
-                    gtk_source_style_scheme_manager_get_default();
-                gchar *sm_paths[] = {
-                    BALSA_DATA_PREFIX "/gtksourceview-3.0",
-                    NULL
-                };
-
-                /* try to load the colouring scheme */
-                gtk_source_style_scheme_manager_set_search_path(smgr, sm_paths);
-                scheme = gtk_source_style_scheme_manager_get_scheme(smgr, "balsa-mail");
-            }
-        }
+       const gchar * const * lm_dpaths;
+
+       if ((lm = gtk_source_language_manager_new()) &&
+           (lm_dpaths = gtk_source_language_manager_get_search_path(lm))) {
+           gchar ** lm_rpaths;
+           gint n;
+
+           /* add the balsa share path to the language manager's paths - we
+            * cannot simply replace it as it still wants to see the
+            * RelaxNG schema... */
+           for (n = 0; lm_dpaths[n]; n++);
+           lm_rpaths = g_new0(gchar *, n + 2);
+           for (n = 0; lm_dpaths[n]; n++)
+               lm_rpaths[n] = g_strdup(lm_dpaths[n]);
+           lm_rpaths[n] = g_strdup(BALSA_DATA_PREFIX "/gtksourceview-3.0");
+           gtk_source_language_manager_set_search_path(lm, lm_rpaths);
+           g_strfreev(lm_rpaths);
+
+           /* try to load the language */
+           if ((src_lang =
+                gtk_source_language_manager_get_language(lm, "balsa"))) {
+               GtkSourceStyleSchemeManager *smgr =
+                   gtk_source_style_scheme_manager_get_default();
+               gchar * sm_paths[] = {
+                   BALSA_DATA_PREFIX "/gtksourceview-3.0",
+                   NULL };
+           
+               /* try to load the colouring scheme */
+               gtk_source_style_scheme_manager_set_search_path(smgr, sm_paths);
+               scheme = gtk_source_style_scheme_manager_get_scheme(smgr, "balsa-mail");
+           }
+       }
     }
 
     /* create a new buffer and set the language and scheme */
     sbuffer = gtk_source_buffer_new(NULL);
-    if (src_lang) {
-        gtk_source_buffer_set_language(sbuffer, src_lang);
-    }
-    if (scheme) {
-        gtk_source_buffer_set_style_scheme(sbuffer, scheme);
-    }
+    if (src_lang)
+       gtk_source_buffer_set_language(sbuffer, src_lang);
+    if (scheme)
+       gtk_source_buffer_set_style_scheme(sbuffer, scheme);
     gtk_source_buffer_set_highlight_syntax(sbuffer, TRUE);
     gtk_source_buffer_set_highlight_matching_brackets(sbuffer, FALSE);
 
@@ -1062,8 +977,6 @@ libbalsa_source_view_new(gboolean highlight_phrases)
 
     return sview;
 }
-
-
 #endif  /* HAVE_GTKSOURCEVIEW */
 
 /*
@@ -1074,49 +987,43 @@ GQuark
 libbalsa_scanner_error_quark(void)
 {
     static GQuark quark = 0;
-    if (quark == 0) {
+    if (quark == 0)
         quark = g_quark_from_static_string("libbalsa-scanner-error-quark");
-    }
     return quark;
 }
 
-
 GQuark
 libbalsa_mailbox_error_quark(void)
 {
     static GQuark quark = 0;
-    if (quark == 0) {
+    if (quark == 0)
         quark = g_quark_from_static_string("libbalsa-mailbox-error-quark");
-    }
     return quark;
 }
 
-
 GQuark
 libbalsa_image_error_quark(void)
 {
     static GQuark quark = 0;
-    if (quark == 0) {
+    if (quark == 0)
         quark = g_quark_from_static_string("libbalsa-image-error-quark");
-    }
     return quark;
 }
 
-
 GtkDialogFlags
 libbalsa_dialog_flags(void)
 {
-    static GtkDialogFlags dialog_flags = GTK_DIALOG_USE_HEADER_BAR;
-    static gint check_done = 0;
-
-    if (g_atomic_int_get(&check_done) == 0) {
-        const gchar *dialog_env;
-
-        dialog_env = g_getenv("BALSA_DIALOG_HEADERBAR");
-        if ((dialog_env != NULL) && (atoi(dialog_env) == 0)) {
-            dialog_flags = (GtkDialogFlags) 0;
-        }
-        g_atomic_int_set(&check_done, 1);
-    }
-    return dialog_flags;
+       static GtkDialogFlags dialog_flags = GTK_DIALOG_USE_HEADER_BAR;
+       static gint check_done = 0;
+
+       if (g_atomic_int_get(&check_done) == 0) {
+               const gchar *dialog_env;
+
+               dialog_env = g_getenv("BALSA_DIALOG_HEADERBAR");
+               if ((dialog_env != NULL) && (atoi(dialog_env) == 0)) {
+                       dialog_flags = (GtkDialogFlags) 0;
+               }
+               g_atomic_int_set(&check_done, 1);
+       }
+       return dialog_flags;
 }
diff --git a/libbalsa/libbalsa.h b/libbalsa/libbalsa.h
index e1d9e34..9fbdc5e 100644
--- a/libbalsa/libbalsa.h
+++ b/libbalsa/libbalsa.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -22,7 +22,7 @@
 #define __LIBBALSA_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 typedef struct _LibBalsaCondition LibBalsaCondition;
@@ -52,22 +52,22 @@ typedef struct _LibbalsaVfs LibbalsaVfs;
 #include "address-book-extern.h"
 
 #if ENABLE_LDAP
-#   include "address-book-ldap.h"
+#include "address-book-ldap.h"
 #endif
 #if HAVE_SQLITE
-#   include "address-book-gpe.h"
+#include "address-book-gpe.h"
 #endif
 #if HAVE_RUBRICA
-#   include "address-book-rubrica.h"
+#include "address-book-rubrica.h"
 #endif
 #if HAVE_OSMO
-#   include "address-book-osmo.h"
+#include "address-book-osmo.h"
 #endif
 
 /* Callback for testing whether a mailbox or server can be reached: */
-typedef void LibBalsaCanReachCallback (GObject *object,
-                                       gboolean can_reach,
-                                       gpointer cb_data);
+typedef void LibBalsaCanReachCallback(GObject * object,
+                                      gboolean  can_reach,
+                                      gpointer  cb_data);
 
 #include "mailbox.h"
 #include "mailbox_local.h"
@@ -82,10 +82,8 @@ typedef void LibBalsaCanReachCallback (GObject *object,
  * Error domains for GError:
  */
 GQuark libbalsa_scanner_error_quark(void);
-
 #define LIBBALSA_SCANNER_ERROR libbalsa_scanner_error_quark()
 GQuark libbalsa_mailbox_error_quark(void);
-
 #define LIBBALSA_MAILBOX_ERROR libbalsa_mailbox_error_quark()
 
 /*
@@ -113,15 +111,14 @@ enum {
  * Initialize the library
  */
 void libbalsa_init(LibBalsaInformationFunc information_callback);
-void libbalsa_set_spool(const gchar *spool);
+void libbalsa_set_spool(const gchar * spool);
 
-void libbalsa_show_message_source(GtkApplication  *application,
-                                  LibBalsaMessage *msg,
-                                  const gchar     *font,
-                                  gboolean        *escape_specials,
-                                  gint            *width,
-                                  gint            *height);
-gchar *libbalsa_rot(const gchar *pass);
+void libbalsa_show_message_source(GtkApplication * application,
+                                  LibBalsaMessage * msg,
+                                  const gchar * font,
+                                  gboolean *escape_specials,
+                                  gint * width, gint * height);
+gchar *libbalsa_rot(const gchar * pass);
 
 gchar *libbalsa_guess_email_address(void);
 gchar *libbalsa_guess_mail_spool(void);
@@ -134,22 +131,19 @@ gchar *libbalsa_guess_ldap_server(void);
 gchar *libbalsa_guess_imap_inbox(void);
 
 
-gchar *libbalsa_date_to_utf8(time_t       date,
-                             const gchar *date_string);
+gchar* libbalsa_date_to_utf8(time_t date, const gchar *date_string);
 LibBalsaMessageStatus libbalsa_get_icon_from_flags(LibBalsaMessageFlag flags);
 
-gboolean libbalsa_is_cert_known(X509 *cert,
-                                long  vfy_result);
+gboolean libbalsa_is_cert_known(X509* cert, long vfy_result);
 void libbalsa_certs_destroy(void);
 
 gboolean libbalsa_abort_on_timeout(const char *host);
 
 GThread *libbalsa_get_main_thread(void);
 gboolean libbalsa_am_i_subthread(void);
-void libbalsa_message(const char *fmt,
-                      ...)
-G_GNUC_PRINTF(1, 2);
-gchar *libbalsa_rot(const gchar *pass);
+void libbalsa_message(const char *fmt, ...)
+       G_GNUC_PRINTF(1, 2);
+gchar * libbalsa_rot(const gchar * pass);
 
 typedef enum {
     LIBBALSA_PROGRESS_NO = 0,
@@ -165,37 +159,33 @@ typedef enum {
 #define LIBBALSA_PROGRESS_MIN_UPDATE_USECS 50000
 #define LIBBALSA_PROGRESS_MIN_UPDATE_STEP  0.05
 
-extern void (*libbalsa_progress_set_text)(LibBalsaProgress *progress,
-                                          const gchar *text,
-                                          guint total);
-extern void (*libbalsa_progress_set_fraction) (LibBalsaProgress *progress,
-                                               gdouble           fraction);
-extern void (*libbalsa_progress_set_activity) (gboolean     set,
-                                               const gchar *text);
+extern void (*libbalsa_progress_set_text) (LibBalsaProgress * progress,
+                                           const gchar * text,
+                                           guint total);
+extern void (*libbalsa_progress_set_fraction) (LibBalsaProgress * progress,
+                                               gdouble fraction);
+extern void (*libbalsa_progress_set_activity) (gboolean set,
+                                               const gchar * text);
 
 /*
  * Face and X-Face header support.
  */
-gchar *libbalsa_get_header_from_path(const gchar *header,
-                                     const gchar *path,
-                                     gsize       *size,
-                                     GError     **err);
-GtkWidget *libbalsa_get_image_from_face_header(const gchar *content,
-                                               GError     **err);
-
+gchar *libbalsa_get_header_from_path(const gchar * header,
+                                     const gchar * path, gsize * size,
+                                     GError ** err);
+GtkWidget *libbalsa_get_image_from_face_header(const gchar * content,
+                                               GError ** err);
 #if HAVE_COMPFACE
-GtkWidget *libbalsa_get_image_from_x_face_header(const gchar *content,
-                                                 GError     **err);
-
+GtkWidget *libbalsa_get_image_from_x_face_header(const gchar * content,
+                                                 GError ** err);
 #endif                          /* HAVE_COMPFACE */
 
 GQuark libbalsa_image_error_quark(void);
-
 #define LIBBALSA_IMAGE_ERROR libbalsa_image_error_quark()
 enum LibBalsaImageError {
     LIBBALSA_IMAGE_ERROR_NO_DATA
 #if HAVE_COMPFACE
-    ,
+        ,
     LIBBALSA_IMAGE_ERROR_FORMAT,
     LIBBALSA_IMAGE_ERROR_BUFFER,
     LIBBALSA_IMAGE_ERROR_BAD_DATA
@@ -206,7 +196,6 @@ GtkDialogFlags libbalsa_dialog_flags(void);
 
 #if HAVE_GTKSOURCEVIEW
 GtkWidget *libbalsa_source_view_new(gboolean highlight_phrases);
-
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 #endif                          /* __LIBBALSA_H__ */
diff --git a/libbalsa/libbalsa_private.h b/libbalsa/libbalsa_private.h
index c51dd9d..dc3b3a7 100644
--- a/libbalsa/libbalsa_private.h
+++ b/libbalsa/libbalsa_private.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -22,7 +22,7 @@
 #define __LIBBALSA_PRIVATE_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include <unistd.h>
@@ -40,13 +40,13 @@ struct LibBalsaMailboxIndexEntry_ {
     unsigned long size;
     gchar *foreground;
     gchar *background;
-    unsigned foreground_set : 1;
-    unsigned background_set : 1;
-    unsigned unseen : 1;
-    unsigned idle_pending : 1;
-};
+    unsigned foreground_set:1;
+    unsigned background_set:1;
+    unsigned unseen:1;
+    unsigned idle_pending:1;
+} ;
 
-void libbalsa_lock_mailbox(LibBalsaMailbox *mailbox);
-void libbalsa_unlock_mailbox(LibBalsaMailbox *mailbox);
+void libbalsa_lock_mailbox(LibBalsaMailbox * mailbox);
+void libbalsa_unlock_mailbox(LibBalsaMailbox * mailbox);
 
-#endif                          /* __LIBBALSA_PRIVATE_H__ */
+#endif                         /* __LIBBALSA_PRIVATE_H__ */
diff --git a/libbalsa/macosx-helpers.c b/libbalsa/macosx-helpers.c
index 085e9e2..15cec6b 100644
--- a/libbalsa/macosx-helpers.c
+++ b/libbalsa/macosx-helpers.c
@@ -1,60 +1,55 @@
 /*
  * macosx-helpers.h
- *
+ *  
  * Helper functions for managing the IGE Mac Integration stuff
  *
  * Copyright (C) 2004 Albrecht Dre� <albrecht dress arcor de>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
-
+ 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #if HAVE_MACOSX_DESKTOP
 
-#   include <gtk/gtk.h>
-#   include <ige-mac-integration.h>
-#   include "macosx-helpers.h"
+#include <gtk/gtk.h>
+#include <ige-mac-integration.h>
+#include "macosx-helpers.h"
 
 
-static gboolean update_osx_menubar(GtkWidget     *widget,
-                                   GdkEventFocus *event,
-                                   GtkWindow     *window);
+static gboolean update_osx_menubar(GtkWidget *widget, GdkEventFocus *event, GtkWindow *window);
 
 
 void
-libbalsa_macosx_menu(GtkWidget    *window,
-                     GtkMenuShell *menubar)
+libbalsa_macosx_menu(GtkWidget *window, GtkMenuShell *menubar)
 {
     g_object_set_data(G_OBJECT(window), "osx-menubar", menubar);
     g_signal_connect(window, "notify::has-focus",
-                     G_CALLBACK(update_osx_menubar), window);
+                    G_CALLBACK(update_osx_menubar), window);
 }
 
 
 void
-libbalsa_macosx_menu_for_parent(GtkWidget *window,
-                                GtkWindow *parent)
+libbalsa_macosx_menu_for_parent(GtkWidget *window, GtkWindow *parent)
 {
-    if (parent) {
-        g_signal_connect(window, "notify::has-focus",
-                         G_CALLBACK(update_osx_menubar), parent);
-    } else {
-        g_message("called %s for widget %p with NULL parent", __func__, window);
-    }
+    if(parent)
+       g_signal_connect(window, "notify::has-focus",
+                        G_CALLBACK(update_osx_menubar), parent);
+    else
+       g_message("called %s for widget %p with NULL parent", __func__, window);
 }
 
 
@@ -62,20 +57,16 @@ libbalsa_macosx_menu_for_parent(GtkWidget *window,
  * get the "osx-menubar" from the user data object, and set it as OS X main menu
  */
 static void
-update_osx_menubar(GtkWidget  *widget,
-                   GParamSpec *pspec,
-                   GtkWindow  *window)
+update_osx_menubar(GtkWidget *widget, GParamSpec *pspec, GtkWindow *window)
 {
     GtkMenuShell *menubar;
 
     g_return_if_fail(window != NULL);
-    if (!gtk_widget_has_focus(widget)) {
+    if (!gtk_widget_has_focus(widget))
         return;
-    }
     menubar = GTK_MENU_SHELL(g_object_get_data(G_OBJECT(window), "osx-menubar"));
     g_return_if_fail(menubar != NULL);
     ige_mac_menu_set_menu_bar(menubar);
 }
 
-
 #endif  /* HAVE_MACOSX_DESKTOP */
diff --git a/libbalsa/macosx-helpers.h b/libbalsa/macosx-helpers.h
index 90310d0..3b80696 100644
--- a/libbalsa/macosx-helpers.h
+++ b/libbalsa/macosx-helpers.h
@@ -1,39 +1,37 @@
 /*
  * macosx-helpers.h
- *
+ *  
  * Helper functions for managing the IGE Mac Integration stuff
  *
  * Copyright (C) 2004 Albrecht Dre� <albrecht dress arcor de>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
-
+ 
 #ifndef __MACOSX_HELPERS__
 #define __MACOSX_HELPERS__
-
+ 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #if HAVE_MACOSX_DESKTOP
 
-#   include <gtk/gtk.h>
+#include <gtk/gtk.h>
 
-void libbalsa_macosx_menu(GtkWidget    *window,
-                          GtkMenuShell *menubar);
-void libbalsa_macosx_menu_for_parent(GtkWidget *window,
-                                     GtkWindow *parent);
+void libbalsa_macosx_menu(GtkWidget * window, GtkMenuShell *menubar);
+void libbalsa_macosx_menu_for_parent(GtkWidget *window, GtkWindow *parent);
 
 #endif  /* HAVE_MACOSX_DESKTOP */
 
diff --git a/libbalsa/mailbackend.h b/libbalsa/mailbackend.h
index 762cac3..eab6cc3 100644
--- a/libbalsa/mailbackend.h
+++ b/libbalsa/mailbackend.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -22,4 +22,4 @@
 #define __LIBBALSA_MAILBACKEND_H__
 
 
-#endif                          /* __LIBBALSA_MAILBACKEND_H__ */
+#endif                         /* __LIBBALSA_MAILBACKEND_H__ */
diff --git a/libbalsa/mailbox-filter.c b/libbalsa/mailbox-filter.c
index 58ca983..6647021 100644
--- a/libbalsa/mailbox-filter.c
+++ b/libbalsa/mailbox-filter.c
@@ -6,27 +6,27 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 /*
  * mailbox_filter.h
- *
+ * 
  * Header defining filters associated to mailbox
  * Basically it's a filter plus fields related to automatic running
  * Author : Emmanuel Allaud
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <string.h>
@@ -41,22 +41,18 @@
  * There is no copy, the new list references object of the source list
  */
 
-GSList *
-libbalsa_mailbox_filters_when(GSList *filters,
-                              gint    when)
+GSList* 
+libbalsa_mailbox_filters_when(GSList * filters, gint when)
 {
-    GSList *lst = NULL;
-    for (; filters != NULL; filters = filters->next) {
-        if (FILTER_WHEN_CHKFLAG((LibBalsaMailboxFilter *)filters->data, when)) {
-            lst = g_slist_prepend(lst, ((LibBalsaMailboxFilter *)filters->data)->actual_filter);
-        }
-    }
+    GSList * lst = NULL;
+    for (; filters != NULL; filters = filters->next)
+       if (FILTER_WHEN_CHKFLAG((LibBalsaMailboxFilter*)filters->data,when))
+           lst = g_slist_prepend(lst,((LibBalsaMailboxFilter*)filters->data)->actual_filter);
     lst = g_slist_reverse(lst);
 
     return lst;
 }
 
-
 /* Looks for a mailbox filters group with MBOX_URL field equals to mbox->url
  * returns the group name or NULL if none found
  * The returned string has to be freed by the caller
@@ -67,9 +63,8 @@ struct lbmf_section_lookup_info {
 };
 
 static gboolean
-lbmf_section_lookup_func(const gchar *key,
-                         const gchar *value,
-                         gpointer     data)
+lbmf_section_lookup_func(const gchar * key, const gchar * value,
+                         gpointer data)
 {
     struct lbmf_section_lookup_info *info = data;
     gchar *url;
@@ -77,17 +72,15 @@ lbmf_section_lookup_func(const gchar *key,
     libbalsa_conf_push_group(key);
     url = libbalsa_conf_get_string(MAILBOX_FILTERS_URL_KEY);
     libbalsa_conf_pop_group();
-    if (strcmp(url, info->name) == 0) {
+    if (strcmp(url, info->name) == 0)
         info->group = g_strdup(key);
-    }
     g_free(url);
 
     return info->group != NULL;
 }
 
-
 gchar *
-mailbox_filters_section_lookup(const gchar *name)
+mailbox_filters_section_lookup(const gchar * name)
 {
     struct lbmf_section_lookup_info info;
 
@@ -96,22 +89,21 @@ mailbox_filters_section_lookup(const gchar *name)
     info.name = name;
     info.group = NULL;
     libbalsa_conf_foreach_group(MAILBOX_FILTERS_SECTION_PREFIX,
-                                lbmf_section_lookup_func, &info);
+                                  lbmf_section_lookup_func, &info);
 
     return info.group;
 }
 
-
 void
-config_mailbox_filters_load(LibBalsaMailbox *mbox)
+config_mailbox_filters_load(LibBalsaMailbox * mbox)
 {
-    gchar *group;
+    gchar * group;
 
     group = mailbox_filters_section_lookup(mbox->url ? mbox->url : mbox->name);
     if (group) {
-        libbalsa_conf_push_group(group);
-        g_free(group);
-        libbalsa_mailbox_filters_load_config(mbox);
-        libbalsa_conf_pop_group();
+       libbalsa_conf_push_group(group);
+       g_free(group);
+       libbalsa_mailbox_filters_load_config(mbox);
+       libbalsa_conf_pop_group();
     }
 }
diff --git a/libbalsa/mailbox-filter.h b/libbalsa/mailbox-filter.h
index d24c1ff..ee9eb29 100644
--- a/libbalsa/mailbox-filter.h
+++ b/libbalsa/mailbox-filter.h
@@ -6,20 +6,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 /*
  * mailbox_filter.h
- *
+ * 
  * Header defining filters associated to mailbox
  * Basically it's a filter plus fields related to automatic running
  * Author : Emmanuel Allaud
@@ -34,15 +34,11 @@
 #define MAILBOX_FILTERS_URL_KEY "Mailbox-URL"
 
 /*
- * Defines for the when field of mailbox controlling when to automatically run associated
- * filters of a mailbox
- * For now : on incoming mails, before closing a mailbox (to have something like a purge
- * mechanism)
+ * Defines for the when field of mailbox controlling when to automatically run associated filters of a 
mailbox
+ * For now : on incoming mails, before closing a mailbox (to have something like a purge mechanism)
  * FIXME : we need surely more than that
- * We should be able to remember the last message in the mailbox that has been filtered (so that
- * automatic filtering
- * leads to apply filters only on those messages in the mailbox that have never been filtered
- * before)
+ * We should be able to remember the last message in the mailbox that has been filtered (so that automatic 
filtering
+ * leads to apply filters only on those messages in the mailbox that have never been filtered before)
  */
 
 #define FILTER_WHEN_NEVER    0          /* Ie manual only */
@@ -57,19 +53,17 @@
 #define FILTER_WHEN_CHKFLAG(x, y) (((x)->when) & (y))
 
 typedef struct _LibBalsaMailboxFilter {
-    LibBalsaFilter *actual_filter;
+    LibBalsaFilter* actual_filter;
     gint when;
 } LibBalsaMailboxFilter;
 
 /* Returns a slist of filters having the corresponding when field */
 
-GSList *libbalsa_mailbox_filters_when(GSList *filters,
-                                      gint    when);
+GSList * libbalsa_mailbox_filters_when(GSList * filters, gint when);
 
 /* Loads the filters associated to the mailbox */
-void config_mailbox_filters_load(LibBalsaMailbox *mbox);
-
+void config_mailbox_filters_load(LibBalsaMailbox * mbox);
 /* Saves the filters associated to the mailbox */
-gchar *mailbox_filters_section_lookup(const gchar *url);
+gchar * mailbox_filters_section_lookup(const gchar * url);
 
-#endif                          /* __MAILBOX_FILTER_H__ */
+#endif                         /* __MAILBOX_FILTER_H__ */
diff --git a/libbalsa/mailbox.c b/libbalsa/mailbox.c
index 533fe45..3a8046c 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <ctype.h>
@@ -39,31 +39,31 @@
 #include <glib/gi18n.h>
 
 /* Class functions */
-static void libbalsa_mailbox_class_init(LibBalsaMailboxClass *klass);
-static void libbalsa_mailbox_init(LibBalsaMailbox *mailbox);
-static void libbalsa_mailbox_dispose(GObject *object);
-static void libbalsa_mailbox_finalize(GObject *object);
-
-static void libbalsa_mailbox_real_release_message(LibBalsaMailbox *mailbox,
-                                                  LibBalsaMessage *message);
-static gboolean libbalsa_mailbox_real_messages_copy(LibBalsaMailbox *mailbox,
-                                                    GArray          *msgnos,
-                                                    LibBalsaMailbox *dest,
-                                                    GError         **err);
-static gboolean libbalsa_mailbox_real_can_do(LibBalsaMailbox               *mbox,
+static void libbalsa_mailbox_class_init(LibBalsaMailboxClass * klass);
+static void libbalsa_mailbox_init(LibBalsaMailbox * mailbox);
+static void libbalsa_mailbox_dispose(GObject * object);
+static void libbalsa_mailbox_finalize(GObject * object);
+
+static void libbalsa_mailbox_real_release_message (LibBalsaMailbox * mailbox,
+                                                   LibBalsaMessage * message);
+static gboolean
+libbalsa_mailbox_real_messages_copy(LibBalsaMailbox * mailbox,
+                                    GArray * msgnos,
+                                    LibBalsaMailbox * dest, GError **err);
+static gboolean libbalsa_mailbox_real_can_do(LibBalsaMailbox* mbox,
                                              enum LibBalsaMailboxCapability c);
-static void libbalsa_mailbox_real_sort(LibBalsaMailbox *mbox,
-                                       GArray          *sort_array);
-static gboolean libbalsa_mailbox_real_can_match(LibBalsaMailbox   *mailbox,
+static void libbalsa_mailbox_real_sort(LibBalsaMailbox* mbox,
+                                       GArray *sort_array);
+static gboolean libbalsa_mailbox_real_can_match(LibBalsaMailbox  *mailbox,
                                                 LibBalsaCondition *condition);
-static void libbalsa_mailbox_real_save_config(LibBalsaMailbox *mailbox,
-                                              const gchar     *group);
-static void libbalsa_mailbox_real_load_config(LibBalsaMailbox *mailbox,
-                                              const gchar     *group);
-static gboolean libbalsa_mailbox_real_close_backend(LibBalsaMailbox *
-                                                    mailbox);
-static void libbalsa_mailbox_real_lock_store(LibBalsaMailbox *mailbox,
-                                             gboolean         lock);
+static void libbalsa_mailbox_real_save_config(LibBalsaMailbox * mailbox,
+                                              const gchar * group);
+static void libbalsa_mailbox_real_load_config(LibBalsaMailbox * mailbox,
+                                              const gchar * group);
+static gboolean libbalsa_mailbox_real_close_backend (LibBalsaMailbox *
+                                                     mailbox);
+static void libbalsa_mailbox_real_lock_store(LibBalsaMailbox * mailbox,
+                                             gboolean lock);
 
 /* SIGNALS MEANINGS :
    - CHANGED: notification signal sent by the mailbox to allow the
@@ -73,7 +73,7 @@ static void libbalsa_mailbox_real_lock_store(LibBalsaMailbox *mailbox,
    Also when the unread message count might have changed.
    - MESSAGE_EXPUNGED: sent when a message is expunged.  This signal is
    used to update lists of msgnos when messages are renumbered.
- */
+*/
 
 enum {
     CHANGED,
@@ -127,7 +127,7 @@ libbalsa_mailbox_get_type(void)
             NULL,
             NULL
         };
-
+    
         static const GInterfaceInfo mbox_drag_source_info = {
             (GInterfaceInitFunc) mbox_drag_source_init,
             NULL,
@@ -139,7 +139,7 @@ libbalsa_mailbox_get_type(void)
             NULL,
             NULL
         };
-
+    
         mailbox_type =
             g_type_register_static(G_TYPE_OBJECT, "LibBalsaMailbox",
                                    &mailbox_info, 0);
@@ -157,9 +157,8 @@ libbalsa_mailbox_get_type(void)
     return mailbox_type;
 }
 
-
 static void
-libbalsa_mailbox_class_init(LibBalsaMailboxClass *klass)
+libbalsa_mailbox_class_init(LibBalsaMailboxClass * klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS(klass);
 
@@ -168,7 +167,7 @@ libbalsa_mailbox_class_init(LibBalsaMailboxClass *klass)
     /* This signal is emitted by the mailbox when new messages are
        retrieved (check mail or opening of the mailbox). This is used
        by GUI to sync on the mailbox content (see BalsaIndex)
-     */
+    */   
     libbalsa_mailbox_signals[CHANGED] =
         g_signal_new("changed",
                      G_TYPE_FROM_CLASS(object_class),
@@ -212,12 +211,12 @@ libbalsa_mailbox_class_init(LibBalsaMailboxClass *klass)
     klass->get_message = NULL;
     klass->prepare_threading = NULL;
     klass->fetch_message_structure = NULL;
-    klass->fetch_headers = NULL;
+    klass->fetch_headers           = NULL;
     klass->release_message = libbalsa_mailbox_real_release_message;
     klass->get_message_part = NULL;
     klass->get_message_stream = NULL;
     klass->messages_change_flags = NULL;
-    klass->messages_copy = libbalsa_mailbox_real_messages_copy;
+    klass->messages_copy  = libbalsa_mailbox_real_messages_copy;
     klass->can_do = libbalsa_mailbox_real_can_do;
     klass->set_threading = NULL;
     klass->update_view_filter = NULL;
@@ -225,18 +224,17 @@ libbalsa_mailbox_class_init(LibBalsaMailboxClass *klass)
     klass->check = NULL;
     klass->message_match = NULL;
     klass->can_match = libbalsa_mailbox_real_can_match;
-    klass->save_config = libbalsa_mailbox_real_save_config;
-    klass->load_config = libbalsa_mailbox_real_load_config;
-    klass->close_backend = libbalsa_mailbox_real_close_backend;
+    klass->save_config  = libbalsa_mailbox_real_save_config;
+    klass->load_config  = libbalsa_mailbox_real_load_config;
+    klass->close_backend  = libbalsa_mailbox_real_close_backend;
     klass->total_messages = NULL;
     klass->duplicate_msgnos = NULL;
-    klass->lock_store = libbalsa_mailbox_real_lock_store;
+    klass->lock_store  = libbalsa_mailbox_real_lock_store;
     klass->test_can_reach = NULL;
 }
 
-
 static void
-libbalsa_mailbox_init(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_init(LibBalsaMailbox * mailbox)
 {
     mailbox->lock = FALSE;
     mailbox->is_directory = FALSE;
@@ -252,9 +250,9 @@ libbalsa_mailbox_init(LibBalsaMailbox *mailbox)
     mailbox->readonly = FALSE;
     mailbox->disconnected = FALSE;
 
-    mailbox->filters = NULL;
+    mailbox->filters=NULL;
     mailbox->filters_loaded = FALSE;
-    mailbox->view = NULL;
+    mailbox->view=NULL;
     /* mailbox->stamp is incremented before we use it, so it won't be
      * zero for a long, long time... */
     mailbox->stamp = g_random_int() / 2;
@@ -262,7 +260,6 @@ libbalsa_mailbox_init(LibBalsaMailbox *mailbox)
     mailbox->no_reassemble = FALSE;
 }
 
-
 /*
  * libbalsa_mailbox_dispose:
  *
@@ -270,19 +267,16 @@ libbalsa_mailbox_init(LibBalsaMailbox *mailbox)
  * decremented to 0
  */
 
-static void lbm_get_index_entry_expunged_cb(LibBalsaMailbox *mailbox,
-                                            guint            seqno);
-static void lbm_msgno_changed_expunged_cb(LibBalsaMailbox *mailbox,
-                                          guint            seqno);
+static void lbm_get_index_entry_expunged_cb(LibBalsaMailbox * mailbox, guint seqno);
+static void lbm_msgno_changed_expunged_cb(LibBalsaMailbox * mailbox, guint seqno);
 
 static void
-libbalsa_mailbox_dispose(GObject *object)
+libbalsa_mailbox_dispose(GObject * object)
 {
     LibBalsaMailbox *mailbox = LIBBALSA_MAILBOX(object);
 
-    while (mailbox->open_ref > 0) {
+    while (mailbox->open_ref > 0)
         libbalsa_mailbox_close(mailbox, FALSE);
-    }
 
     if (mailbox->msgnos_pending != NULL) {
         g_signal_handlers_disconnect_by_func(mailbox,
@@ -308,7 +302,7 @@ libbalsa_mailbox_dispose(GObject *object)
 }
 
 
-static gchar *
+static gchar*
 get_from_field(LibBalsaMessage *message)
 {
     InternetAddressList *address_list = NULL;
@@ -320,11 +314,10 @@ get_from_field(LibBalsaMessage *message)
 
     if (message->headers) {
         if (message->mailbox->view &&
-            (message->mailbox->view->show == LB_MAILBOX_SHOW_TO)) {
+            message->mailbox->view->show == LB_MAILBOX_SHOW_TO)
             address_list = message->headers->to_list;
-        } else {
+        else
             address_list = message->headers->from;
-        }
     }
 
     if (address_list) {
@@ -335,14 +328,12 @@ get_from_field(LibBalsaMessage *message)
                 internet_address_list_get_address(address_list, i);
             if (ia->name && *ia->name) {
                 name_str = ia->name;
-                if (i < len - 1) {
+                if (i < len - 1)
                     append_dots = TRUE;
-                }
             } else if (INTERNET_ADDRESS_IS_MAILBOX(ia)) {
                 name_str = ((InternetAddressMailbox *) ia)->addr;
-                if (i < len - 1) {
+                if (i < len - 1)
                     append_dots = TRUE;
-                }
             } else {
                 InternetAddressGroup *g = (InternetAddressGroup *) ia;
                 gint gi, glen =
@@ -352,66 +343,61 @@ get_from_field(LibBalsaMessage *message)
                         internet_address_list_get_address(g->members, gi);
                     if (ia2->name && *ia2->name) {
                         name_str = ia2->name;
-                        if (gi < glen - 1) {
+                        if (gi < glen - 1)
                             append_dots = TRUE;
-                        }
                     } else if (INTERNET_ADDRESS_IS_MAILBOX(ia2)) {
                         name_str = ((InternetAddressMailbox *) ia2)->addr;
-                        if (gi < glen - 1) {
+                        if (gi < glen - 1)
                             append_dots = TRUE;
-                        }
                     }
                 }
             }
         }
     }
 
-    if (name_str == NULL) {
+    if (name_str == NULL)
         name_str = "";
-    }
     from = append_dots ? g_strconcat(name_str, ",…", NULL)
-        : g_strdup(name_str);
+                       : g_strdup(name_str);
     libbalsa_utf8_sanitize(&from, TRUE, NULL);
 
     return from;
 }
 
-
 static void
-lbm_index_entry_populate_from_msg(LibBalsaMailboxIndexEntry *entry,
-                                  LibBalsaMessage           *msg)
+lbm_index_entry_populate_from_msg(LibBalsaMailboxIndexEntry * entry,
+                                  LibBalsaMessage * msg)
 {
-    entry->from = get_from_field(msg);
-    entry->subject = g_strdup(LIBBALSA_MESSAGE_GET_SUBJECT(msg));
-    entry->msg_date = msg->headers->date;
+    entry->from          = get_from_field(msg);
+    entry->subject       = g_strdup(LIBBALSA_MESSAGE_GET_SUBJECT(msg));
+    entry->msg_date      = msg->headers->date;
     entry->internal_date = 0; /* FIXME */
-    entry->status_icon = libbalsa_get_icon_from_flags(msg->flags);
-    entry->attach_icon = libbalsa_message_get_attach_icon(msg);
-    entry->size = msg->length;
-    entry->foreground = NULL;
-    entry->background = NULL;
+    entry->status_icon   = libbalsa_get_icon_from_flags(msg->flags);
+    entry->attach_icon   = libbalsa_message_get_attach_icon(msg);
+    entry->size          = msg->length;
+    entry->foreground     = NULL;
+    entry->background     = NULL;
     entry->foreground_set = 0;
     entry->background_set = 0;
-    entry->unseen = LIBBALSA_MESSAGE_IS_UNREAD(msg);
-    entry->idle_pending = 0;
+    entry->unseen        = LIBBALSA_MESSAGE_IS_UNREAD(msg);
+    entry->idle_pending  = 0;
     libbalsa_mailbox_msgno_changed(msg->mailbox, msg->msgno);
 }
 
-
-static LibBalsaMailboxIndexEntry *
+static LibBalsaMailboxIndexEntry*
 lbm_index_entry_new_pending(void)
 {
-    LibBalsaMailboxIndexEntry *entry = g_new(LibBalsaMailboxIndexEntry, 1);
+    LibBalsaMailboxIndexEntry *entry = g_new(LibBalsaMailboxIndexEntry,1);
     entry->idle_pending = 1;
     return entry;
 }
 
-
 static void
 lbm_index_entry_free(LibBalsaMailboxIndexEntry *entry)
 {
-    if (entry) {
-        if (!entry->idle_pending) {
+    if(entry) {
+        if (!entry->idle_pending)
+        {
             g_free(entry->from);
             g_free(entry->subject);
         }
@@ -419,17 +405,15 @@ lbm_index_entry_free(LibBalsaMailboxIndexEntry *entry)
     }
 }
 
-
 void
-libbalsa_mailbox_index_entry_clear(LibBalsaMailbox *mailbox,
-                                   guint            msgno)
+libbalsa_mailbox_index_entry_clear(LibBalsaMailbox * mailbox, guint msgno)
 {
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
     g_return_if_fail(msgno > 0);
 
     if (msgno <= mailbox->mindex->len) {
         LibBalsaMailboxIndexEntry **entry = (LibBalsaMailboxIndexEntry **)
-            &g_ptr_array_index(mailbox->mindex, msgno - 1);
+            & g_ptr_array_index(mailbox->mindex, msgno - 1);
         lbm_index_entry_free(*entry);
         *entry = NULL;
 
@@ -437,37 +421,33 @@ libbalsa_mailbox_index_entry_clear(LibBalsaMailbox *mailbox,
     }
 }
 
-
 #define VALID_ENTRY(entry) \
     ((entry) && !((LibBalsaMailboxIndexEntry *) (entry))->idle_pending)
 
 void
-libbalsa_mailbox_index_set_flags(LibBalsaMailbox    *mailbox,
-                                 unsigned            msgno,
-                                 LibBalsaMessageFlag f)
+libbalsa_mailbox_index_set_flags(LibBalsaMailbox *mailbox,
+                                 unsigned msgno, LibBalsaMessageFlag f)
 {
     LibBalsaMailboxIndexEntry *entry;
 
-    if (msgno > mailbox->mindex->len) {
+    if (msgno > mailbox->mindex->len)
         return;
-    }
 
-    entry = g_ptr_array_index(mailbox->mindex, msgno - 1);
+    entry = g_ptr_array_index(mailbox->mindex, msgno-1);
     if (VALID_ENTRY(entry)) {
-        entry->status_icon =
+        entry->status_icon = 
             libbalsa_get_icon_from_flags(f);
         entry->unseen = f & LIBBALSA_MESSAGE_FLAG_NEW;
         libbalsa_mailbox_msgno_changed(mailbox, msgno);
     }
 }
 
-
 /* libbalsa_mailbox_finalize:
    destroys mailbox.
- */
+*/
 
 static void
-libbalsa_mailbox_finalize(GObject *object)
+libbalsa_mailbox_finalize(GObject * object)
 {
     LibBalsaMailbox *mailbox;
 
@@ -489,10 +469,9 @@ libbalsa_mailbox_finalize(GObject *object)
     G_OBJECT_CLASS(parent_class)->finalize(object);
 }
 
-
 /* Create a new mailbox by loading it from a config entry... */
 LibBalsaMailbox *
-libbalsa_mailbox_new_from_config(const gchar *group)
+libbalsa_mailbox_new_from_config(const gchar * group)
 {
     gchar *type_str;
     GType type;
@@ -517,19 +496,18 @@ libbalsa_mailbox_new_from_config(const gchar *group)
         return NULL;
     }
 
-    /* Handle Local mailboxes.
-     * They are now separate classes for each type
+    /* Handle Local mailboxes. 
+     * They are now separate classes for each type 
      * FIXME: This should be removed in som efuture release.
      */
     if ( type == LIBBALSA_TYPE_MAILBOX_LOCAL ) {
         gchar *path = libbalsa_conf_get_string("Path");
         type = libbalsa_mailbox_type_from_path(path);
-        if (type != G_TYPE_OBJECT) {
+        if (type != G_TYPE_OBJECT)
             libbalsa_conf_set_string("Type", g_type_name(type));
-        } else {
+        else
             libbalsa_information(LIBBALSA_INFORMATION_WARNING,
                                  _("Bad local mailbox path “%s”"), path);
-        }
     }
     mailbox = (type != G_TYPE_OBJECT ? g_object_new(type, NULL) : NULL);
     if (mailbox == NULL) {
@@ -538,7 +516,7 @@ libbalsa_mailbox_new_from_config(const gchar *group)
                              type_str);
     } else {
         g_assert(LIBBALSA_MAILBOX_GET_CLASS(mailbox) != NULL);
-        LIBBALSA_MAILBOX_GET_CLASS(mailbox)->load_config(mailbox, group);
+       LIBBALSA_MAILBOX_GET_CLASS(mailbox)->load_config(mailbox, group);
     }
 
     libbalsa_conf_pop_group();
@@ -547,29 +525,24 @@ libbalsa_mailbox_new_from_config(const gchar *group)
     return mailbox;
 }
 
-
 static void
 libbalsa_mailbox_free_mindex(LibBalsaMailbox *mailbox)
 {
-    if (mailbox->mindex) {
+    if(mailbox->mindex) {
         unsigned i;
         /* we could have used g_ptr_array_foreach but it is >=2.4.0 */
-        for (i = 0; i < mailbox->mindex->len; i++) {
+        for(i=0; i<mailbox->mindex->len; i++)
             lbm_index_entry_free(g_ptr_array_index(mailbox->mindex, i));
-        }
         g_ptr_array_free(mailbox->mindex, TRUE);
         mailbox->mindex = NULL;
     }
 }
 
-
-static gboolean lbm_set_threading(LibBalsaMailbox *mailbox,
+static gboolean lbm_set_threading(LibBalsaMailbox * mailbox,
                                   LibBalsaMailboxThreadingType
                                   thread_type);
-
 gboolean
-libbalsa_mailbox_open(LibBalsaMailbox *mailbox,
-                      GError         **err)
+libbalsa_mailbox_open(LibBalsaMailbox * mailbox, GError **err)
 {
     gboolean retval;
 
@@ -581,28 +554,26 @@ libbalsa_mailbox_open(LibBalsaMailbox *mailbox,
 
     if (mailbox->open_ref > 0) {
         mailbox->open_ref++;
-        libbalsa_mailbox_check(mailbox);
+       libbalsa_mailbox_check(mailbox);
         retval = TRUE;
     } else {
-        LibBalsaMailboxState saved_state;
+       LibBalsaMailboxState saved_state;
 
         mailbox->stamp++;
-        if (mailbox->mindex) {
-            g_warning("mindex set - I leak memory");
-        }
+        if(mailbox->mindex) g_warning("mindex set - I leak memory");
         mailbox->mindex = g_ptr_array_new();
 
-        saved_state = mailbox->state;
-        mailbox->state = LB_MAILBOX_STATE_OPENING;
+       saved_state = mailbox->state;
+       mailbox->state = LB_MAILBOX_STATE_OPENING;
         retval =
             LIBBALSA_MAILBOX_GET_CLASS(mailbox)->open_mailbox(mailbox, err);
-        if (retval) {
+        if(retval) {
             mailbox->open_ref++;
-            mailbox->state = LB_MAILBOX_STATE_OPEN;
-        } else {
-            mailbox->state = saved_state;
+           mailbox->state = LB_MAILBOX_STATE_OPEN;
+       } else {
+           mailbox->state = saved_state;
             libbalsa_mailbox_free_mindex(mailbox);
-        }
+       }
     }
 
     libbalsa_unlock_mailbox(mailbox);
@@ -610,38 +581,30 @@ libbalsa_mailbox_open(LibBalsaMailbox *mailbox,
     return retval;
 }
 
-
 /* libbalsa_mailbox_is_valid:
    mailbox is valid when:
    a). it is closed, b). it is open and has proper client context.
- */
+*/
 gboolean
-libbalsa_mailbox_is_valid(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_is_valid(LibBalsaMailbox * mailbox)
 {
-    if (mailbox->open_ref == 0) {
-        return TRUE;
-    }
-    if (MAILBOX_CLOSED(mailbox)) {
-        return FALSE;
-    }
+    if(mailbox->open_ref == 0) return TRUE;
+    if(MAILBOX_CLOSED(mailbox)) return FALSE;
     return TRUE;
 }
 
-
 gboolean
 libbalsa_mailbox_is_open(LibBalsaMailbox *mailbox)
 {
     g_return_val_if_fail(mailbox != NULL, FALSE);
     g_return_val_if_fail(LIBBALSA_IS_MAILBOX(mailbox), FALSE);
+    
 
-
-    return mailbox->open_ref > 0; /* this will break unlisted mailbox types */
+    return mailbox->open_ref>0; /* this will break unlisted mailbox types */
 }
-
-
+    
 void
-libbalsa_mailbox_close(LibBalsaMailbox *mailbox,
-                       gboolean         expunge)
+libbalsa_mailbox_close(LibBalsaMailbox * mailbox, gboolean expunge)
 {
     g_return_if_fail(mailbox != NULL);
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
@@ -652,27 +615,26 @@ libbalsa_mailbox_close(LibBalsaMailbox *mailbox,
     libbalsa_lock_mailbox(mailbox);
 
     if (--mailbox->open_ref == 0) {
-        mailbox->state = LB_MAILBOX_STATE_CLOSING;
+       mailbox->state = LB_MAILBOX_STATE_CLOSING;
         /* do not try expunging read-only mailboxes, it's a waste of time */
         expunge = expunge && !mailbox->readonly;
         LIBBALSA_MAILBOX_GET_CLASS(mailbox)->close_mailbox(mailbox, expunge);
-        if (mailbox->msg_tree) {
+        if(mailbox->msg_tree) {
             g_node_destroy(mailbox->msg_tree);
             mailbox->msg_tree = NULL;
         }
         libbalsa_mailbox_free_mindex(mailbox);
         mailbox->stamp++;
-        mailbox->state = LB_MAILBOX_STATE_CLOSED;
+       mailbox->state = LB_MAILBOX_STATE_CLOSED;
     }
 
     libbalsa_unlock_mailbox(mailbox);
     g_object_unref(mailbox);
 }
 
-
 void
-libbalsa_mailbox_set_unread_messages_flag(LibBalsaMailbox *mailbox,
-                                          gboolean         has_unread)
+libbalsa_mailbox_set_unread_messages_flag(LibBalsaMailbox * mailbox,
+                                          gboolean has_unread)
 {
     g_return_if_fail(mailbox != NULL);
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
@@ -681,40 +643,36 @@ libbalsa_mailbox_set_unread_messages_flag(LibBalsaMailbox *mailbox,
     libbalsa_mailbox_changed(mailbox);
 }
 
-
 /* libbalsa_mailbox_progress_notify:
    there has been a progress in current operation.
- */
+*/
 void
-libbalsa_mailbox_progress_notify(LibBalsaMailbox      *mailbox,
-                                 LibBalsaMailboxNotify action,
-                                 gdouble               fraction,
-                                 const gchar          *message,
-                                 ...)
+libbalsa_mailbox_progress_notify(LibBalsaMailbox       *mailbox,
+                                                                LibBalsaMailboxNotify  action,
+                                                                gdouble                        fraction,
+                                                                const gchar           *message,
+                                                                ...)
 {
-    gchar *full_msg;
+       gchar *full_msg;
 
     g_return_if_fail(mailbox != NULL);
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
 
     if (message != NULL) {
-        va_list args;
+       va_list args;
 
-        va_start(args, message);
-        full_msg = g_strdup_vprintf(message, args);
-        va_end(args);
+       va_start(args, message);
+       full_msg = g_strdup_vprintf(message, args);
+       va_end(args);
     } else {
-        full_msg = NULL;
+       full_msg = NULL;
     }
-    g_signal_emit(G_OBJECT(
-                      mailbox), libbalsa_mailbox_signals[PROGRESS_NOTIFY], 0, (gint) action, fraction,
-                  full_msg);
-    g_free(full_msg);
+    g_signal_emit(G_OBJECT(mailbox), libbalsa_mailbox_signals[PROGRESS_NOTIFY], 0, (gint) action, fraction, 
full_msg);
+       g_free(full_msg);
 }
 
-
 void
-libbalsa_mailbox_check(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_check(LibBalsaMailbox * mailbox)
 {
     g_return_if_fail(mailbox != NULL);
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
@@ -730,9 +688,8 @@ libbalsa_mailbox_check(LibBalsaMailbox *mailbox)
     libbalsa_unlock_mailbox(mailbox);
 }
 
-
 static gboolean
-lbm_changed_idle_cb(LibBalsaMailbox *mailbox)
+lbm_changed_idle_cb(LibBalsaMailbox * mailbox)
 {
     libbalsa_lock_mailbox(mailbox);
     g_signal_emit(mailbox, libbalsa_mailbox_signals[CHANGED], 0);
@@ -741,25 +698,22 @@ lbm_changed_idle_cb(LibBalsaMailbox *mailbox)
     return FALSE;
 }
 
-
 static void
-lbm_changed_schedule_idle(LibBalsaMailbox *mailbox)
+lbm_changed_schedule_idle(LibBalsaMailbox * mailbox)
 {
     libbalsa_lock_mailbox(mailbox);
-    if (!mailbox->changed_idle_id) {
+    if (!mailbox->changed_idle_id)
         mailbox->changed_idle_id =
             g_idle_add((GSourceFunc) lbm_changed_idle_cb, mailbox);
-    }
     libbalsa_unlock_mailbox(mailbox);
 }
 
-
 void
-libbalsa_mailbox_changed(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_changed(LibBalsaMailbox * mailbox)
 {
     libbalsa_lock_mailbox(mailbox);
     if (!g_signal_has_handler_pending
-            (mailbox, libbalsa_mailbox_signals[CHANGED], 0, TRUE)) {
+        (mailbox, libbalsa_mailbox_signals[CHANGED], 0, TRUE)) {
         /* No one cares, so don't set any message counts--that might
          * cause mailbox->view to be created. */
         libbalsa_unlock_mailbox(mailbox);
@@ -770,10 +724,10 @@ libbalsa_mailbox_changed(LibBalsaMailbox *mailbox)
         /* Both counts are valid. */
         libbalsa_mailbox_set_total(mailbox,
                                    libbalsa_mailbox_total_messages
-                                       (mailbox));
+                                   (mailbox));
         libbalsa_mailbox_set_unread(mailbox, mailbox->unread_messages);
     } else if (mailbox->has_unread_messages
-               && (libbalsa_mailbox_get_unread(mailbox) <= 0)) {
+               && libbalsa_mailbox_get_unread(mailbox) <= 0) {
         /* Mail has arrived in a closed mailbox since our last check;
          * total is unknown, but mailbox->has_unread_messages is valid. */
         libbalsa_mailbox_set_total(mailbox, -1);
@@ -784,7 +738,6 @@ libbalsa_mailbox_changed(LibBalsaMailbox *mailbox)
     libbalsa_unlock_mailbox(mailbox);
 }
 
-
 /* libbalsa_mailbox_message_match:
  * Tests if message with msgno matches the conditions cached in the
  * search_iter: this is used
@@ -792,9 +745,9 @@ libbalsa_mailbox_changed(LibBalsaMailbox *mailbox)
    special way to implement it for speed/bandwidth reasons
  */
 gboolean
-libbalsa_mailbox_message_match(LibBalsaMailbox           *mailbox,
-                               guint                      msgno,
-                               LibBalsaMailboxSearchIter *search_iter)
+libbalsa_mailbox_message_match(LibBalsaMailbox * mailbox,
+                               guint msgno,
+                               LibBalsaMailboxSearchIter * search_iter)
 {
     gboolean match;
 
@@ -805,27 +758,23 @@ libbalsa_mailbox_message_match(LibBalsaMailbox           *mailbox,
     g_assert(LIBBALSA_MAILBOX_GET_CLASS(mailbox) != NULL);
 
     if (libbalsa_condition_is_flag_only(search_iter->condition,
-                                        mailbox, msgno, &match)) {
+                                        mailbox, msgno, &match))
         return match;
-    }
 
     return LIBBALSA_MAILBOX_GET_CLASS(mailbox)->message_match(mailbox,
                                                               msgno,
                                                               search_iter);
 }
 
-
-gboolean
-libbalsa_mailbox_real_can_match(LibBalsaMailbox   *mailbox,
-                                LibBalsaCondition *condition)
+gboolean libbalsa_mailbox_real_can_match(LibBalsaMailbox  *mailbox,
+                                         LibBalsaCondition *condition)
 {
     /* By default : all filters is OK */
     return TRUE;
 }
 
-
 gboolean
-libbalsa_mailbox_can_match(LibBalsaMailbox   *mailbox,
+libbalsa_mailbox_can_match(LibBalsaMailbox * mailbox,
                            LibBalsaCondition *condition)
 {
     g_return_val_if_fail(mailbox != NULL, FALSE);
@@ -836,11 +785,10 @@ libbalsa_mailbox_can_match(LibBalsaMailbox   *mailbox,
                                                           condition);
 }
 
-
 /* Helper function to run the "on reception" filters on a mailbox */
 
 static gboolean
-lbm_run_filters_on_reception_idle_cb(LibBalsaMailbox *mailbox)
+lbm_run_filters_on_reception_idle_cb(LibBalsaMailbox * mailbox)
 {
     GSList *filters;
     guint progress_count;
@@ -851,12 +799,11 @@ lbm_run_filters_on_reception_idle_cb(LibBalsaMailbox *mailbox)
     guint progress_total;
     LibBalsaProgress progress;
 
-    g_object_add_weak_pointer(G_OBJECT(mailbox), (gpointer) & mailbox);
+    g_object_add_weak_pointer(G_OBJECT(mailbox), (gpointer) &mailbox);
     g_object_unref(mailbox);
-    if (!mailbox) {
+    if (!mailbox)
         return FALSE;
-    }
-    g_object_remove_weak_pointer(G_OBJECT(mailbox), (gpointer) & mailbox);
+    g_object_remove_weak_pointer(G_OBJECT(mailbox), (gpointer) &mailbox);
 
     if (!mailbox->filters_loaded) {
         config_mailbox_filters_load(mailbox);
@@ -866,9 +813,8 @@ lbm_run_filters_on_reception_idle_cb(LibBalsaMailbox *mailbox)
     filters = libbalsa_mailbox_filters_when(mailbox->filters,
                                             FILTER_WHEN_INCOMING);
 
-    if (!filters) {
+    if (!filters)
         return FALSE;
-    }
     if (!filters_prepare_to_run(filters)) {
         g_slist_free(filters);
         return FALSE;
@@ -880,22 +826,20 @@ lbm_run_filters_on_reception_idle_cb(LibBalsaMailbox *mailbox)
 
         if (filter->condition
             && !libbalsa_condition_is_flag_only(filter->condition, NULL, 0,
-                                                NULL)) {
+                                                NULL))
             ++progress_count;
-        }
     }
 
     libbalsa_lock_mailbox(mailbox);
-    if (!recent_undeleted) {
+    if (!recent_undeleted)
         recent_undeleted =
             libbalsa_condition_new_bool_ptr(FALSE, CONDITION_AND,
                                             libbalsa_condition_new_flag_enum
-                                                (FALSE,
-                                                LIBBALSA_MESSAGE_FLAG_RECENT),
+                                            (FALSE,
+                                             LIBBALSA_MESSAGE_FLAG_RECENT),
                                             libbalsa_condition_new_flag_enum
-                                                (TRUE,
-                                                LIBBALSA_MESSAGE_FLAG_DELETED));
-    }
+                                            (TRUE,
+                                             LIBBALSA_MESSAGE_FLAG_DELETED));
 
     text = g_strdup_printf(_("Applying filter rules to %s"), mailbox->name);
     total = libbalsa_mailbox_total_messages(mailbox);
@@ -912,9 +856,8 @@ lbm_run_filters_on_reception_idle_cb(LibBalsaMailbox *mailbox)
         guint msgno;
         GArray *msgnos;
 
-        if (!filter->condition) {
+        if (!filter->condition)
             continue;
-        }
 
         use_progress = !libbalsa_condition_is_flag_only(filter->condition,
                                                         NULL, 0, NULL);
@@ -927,15 +870,13 @@ lbm_run_filters_on_reception_idle_cb(LibBalsaMailbox *mailbox)
 
         msgnos = g_array_new(FALSE, FALSE, sizeof(guint));
         for (msgno = 1; msgno <= total; msgno++) {
-            if (libbalsa_mailbox_message_match(mailbox, msgno, search_iter)) {
+            if (libbalsa_mailbox_message_match(mailbox, msgno, search_iter))
                 g_array_append_val(msgnos, msgno);
-            }
-            if (use_progress) {
+            if (use_progress)
                 libbalsa_progress_set_fraction(&progress,
-                                               ((gdouble)++ progress_count)
+                                               ((gdouble) ++progress_count)
                                                /
                                                ((gdouble) progress_total));
-            }
         }
         libbalsa_mailbox_search_iter_unref(search_iter);
 
@@ -951,9 +892,8 @@ lbm_run_filters_on_reception_idle_cb(LibBalsaMailbox *mailbox)
     return FALSE;
 }
 
-
 void
-libbalsa_mailbox_run_filters_on_reception(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_run_filters_on_reception(LibBalsaMailbox * mailbox)
 {
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
 
@@ -961,10 +901,9 @@ libbalsa_mailbox_run_filters_on_reception(LibBalsaMailbox *mailbox)
                g_object_ref(mailbox));
 }
 
-
 void
-libbalsa_mailbox_save_config(LibBalsaMailbox *mailbox,
-                             const gchar     *group)
+libbalsa_mailbox_save_config(LibBalsaMailbox * mailbox,
+                             const gchar * group)
 {
     g_return_if_fail(mailbox != NULL);
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
@@ -983,15 +922,13 @@ libbalsa_mailbox_save_config(LibBalsaMailbox *mailbox,
     libbalsa_conf_pop_group();
 }
 
-
 static void
-libbalsa_mailbox_real_release_message(LibBalsaMailbox *mailbox,
-                                      LibBalsaMessage *message)
+libbalsa_mailbox_real_release_message(LibBalsaMailbox * mailbox,
+                                      LibBalsaMessage * message)
 {
     g_clear_object(&message->mime_msg);
 }
 
-
 struct MsgCopyData {
     LibBalsaMailbox *src_mailbox;
     GArray *msgnos;
@@ -1002,73 +939,61 @@ struct MsgCopyData {
 };
 
 static gboolean
-copy_iterator(LibBalsaMessageFlag *flags,
-              GMimeStream        **stream,
-              void                *arg)
+copy_iterator(LibBalsaMessageFlag *flags, GMimeStream **stream, void * arg)
 {
-    struct MsgCopyData *mcd = (struct MsgCopyData *)arg;
+    struct MsgCopyData *mcd = (struct MsgCopyData*)arg;
     guint msgno;
-    gboolean (*msgno_has_flags)(LibBalsaMailbox *,
-                                guint,
-                                LibBalsaMessageFlag,
-                                LibBalsaMessageFlag);
+    gboolean (*msgno_has_flags)(LibBalsaMailbox *, guint,
+                               LibBalsaMessageFlag, LibBalsaMessageFlag);
     LibBalsaMailbox *mailbox = mcd->src_mailbox;
 
     g_assert(LIBBALSA_MAILBOX_GET_CLASS(mailbox) != NULL);
 
-    if (mcd->current_idx >= mcd->msgnos->len) {
-        return FALSE; /* no more messages */
+    if(mcd->current_idx >= mcd->msgnos->len)
+       return FALSE; /* no more messages */
 
-    }
     g_clear_object(&mcd->stream);
     msgno_has_flags = LIBBALSA_MAILBOX_GET_CLASS(mailbox)->msgno_has_flags;
     msgno = g_array_index(mcd->msgnos, guint, mcd->current_idx);
 
-    libbalsa_progress_set_fraction(&mcd->progress,
-                                   ((gdouble) (mcd->current_idx + 1)) /
-                                   ((gdouble) mcd->msgnos->len));
+    libbalsa_progress_set_fraction(&mcd->progress, 
+                                  ((gdouble) (mcd->current_idx + 1)) /
+                                  ((gdouble) mcd->msgnos->len));
     mcd->current_idx++;
-
+    
     *flags = 0;
     /* Copy flags. */
-    if (msgno_has_flags(mailbox, msgno, LIBBALSA_MESSAGE_FLAG_NEW, 0)) {
-        *flags |= LIBBALSA_MESSAGE_FLAG_NEW;
-    }
+    if (msgno_has_flags(mailbox, msgno, LIBBALSA_MESSAGE_FLAG_NEW, 0))
+       *flags |= LIBBALSA_MESSAGE_FLAG_NEW;
     if (msgno_has_flags
-            (mailbox, msgno, LIBBALSA_MESSAGE_FLAG_REPLIED, 0)) {
-        *flags |= LIBBALSA_MESSAGE_FLAG_REPLIED;
-    }
+       (mailbox, msgno, LIBBALSA_MESSAGE_FLAG_REPLIED, 0))
+       *flags |= LIBBALSA_MESSAGE_FLAG_REPLIED;
     if (msgno_has_flags
-            (mailbox, msgno, LIBBALSA_MESSAGE_FLAG_FLAGGED, 0)) {
-        *flags |= LIBBALSA_MESSAGE_FLAG_FLAGGED;
-    }
+       (mailbox, msgno, LIBBALSA_MESSAGE_FLAG_FLAGGED, 0))
+       *flags |= LIBBALSA_MESSAGE_FLAG_FLAGGED;
     if (msgno_has_flags
-            (mailbox, msgno, LIBBALSA_MESSAGE_FLAG_DELETED, 0)) {
-        *flags |= LIBBALSA_MESSAGE_FLAG_DELETED;
-    }
+       (mailbox, msgno, LIBBALSA_MESSAGE_FLAG_DELETED, 0))
+       *flags |= LIBBALSA_MESSAGE_FLAG_DELETED;
 
     /* Copy stream */
     *stream = libbalsa_mailbox_get_message_stream(mailbox, msgno, TRUE);
-    if (!*stream) {
-        printf("Connection broken for message %u\n",
-               (unsigned)msgno);
-        return FALSE;
+    if(!*stream) {
+       printf("Connection broken for message %u\n",
+              (unsigned)msgno);
+       return FALSE;
     }
 
     return TRUE;
 }
 
-
 /* Default method; imap backend replaces with its own method, optimized
  * for server-side copy, but falls back to this one if it's not a
  * server-side copy. */
-static void lbm_queue_check(LibBalsaMailbox *mailbox);
-
+static void lbm_queue_check(LibBalsaMailbox * mailbox);
 static gboolean
-libbalsa_mailbox_real_messages_copy(LibBalsaMailbox *mailbox,
-                                    GArray          *msgnos,
-                                    LibBalsaMailbox *dest,
-                                    GError         **err)
+libbalsa_mailbox_real_messages_copy(LibBalsaMailbox * mailbox,
+                                    GArray * msgnos,
+                                    LibBalsaMailbox * dest, GError ** err)
 {
     gchar *text;
     guint successfully_copied;
@@ -1091,40 +1016,36 @@ libbalsa_mailbox_real_messages_copy(LibBalsaMailbox *mailbox,
     mcd.current_idx = 0;
     mcd.copied_cnt = 0;
     successfully_copied =
-        LIBBALSA_MAILBOX_GET_CLASS(dest)->add_messages(dest,
-                                                       copy_iterator,
-                                                       &mcd,
-                                                       err);
+       LIBBALSA_MAILBOX_GET_CLASS(dest)->add_messages(dest,
+                                                      copy_iterator,
+                                                      &mcd,
+                                                      err);
     g_clear_object(&mcd.stream);
 
     libbalsa_progress_set_text(&mcd.progress, NULL, 0);
 
-    if (successfully_copied) {
+    if (successfully_copied)
         /* Some messages copied. */
         lbm_queue_check(dest);
-    }
 
     return successfully_copied == msgnos->len;
 }
 
-
-static gint mbox_compare_func(const SortTuple *a,
-                              const SortTuple *b,
-                              LibBalsaMailbox *mbox);
+static gint mbox_compare_func(const SortTuple * a,
+                              const SortTuple * b,
+                              LibBalsaMailbox * mbox);
 
 static void
-libbalsa_mailbox_real_sort(LibBalsaMailbox *mbox,
-                           GArray          *sort_array)
+libbalsa_mailbox_real_sort(LibBalsaMailbox* mbox, GArray *sort_array)
 {
     /* Sort the array */
     g_array_sort_with_data(sort_array,
                            (GCompareDataFunc) mbox_compare_func, mbox);
 }
 
-
 static void
-libbalsa_mailbox_real_save_config(LibBalsaMailbox *mailbox,
-                                  const gchar     *group)
+libbalsa_mailbox_real_save_config(LibBalsaMailbox * mailbox,
+                                  const gchar * group)
 {
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
     g_assert(LIBBALSA_MAILBOX_GET_CLASS(mailbox) != NULL);
@@ -1134,10 +1055,9 @@ libbalsa_mailbox_real_save_config(LibBalsaMailbox *mailbox,
     libbalsa_conf_set_string("Name", mailbox->name);
 }
 
-
 static void
-libbalsa_mailbox_real_load_config(LibBalsaMailbox *mailbox,
-                                  const gchar     *group)
+libbalsa_mailbox_real_load_config(LibBalsaMailbox * mailbox,
+                                  const gchar * group)
 {
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
 
@@ -1148,24 +1068,20 @@ libbalsa_mailbox_real_load_config(LibBalsaMailbox *mailbox,
     mailbox->name = libbalsa_conf_get_string("Name=Mailbox");
 }
 
-
 static gboolean
-libbalsa_mailbox_real_close_backend(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_real_close_backend(LibBalsaMailbox * mailbox)
 {
     return TRUE;                /* Default is noop. */
 }
 
-
 static void
-libbalsa_mailbox_real_lock_store(LibBalsaMailbox *mailbox,
-                                 gboolean         lock)
+libbalsa_mailbox_real_lock_store(LibBalsaMailbox * mailbox, gboolean lock)
 {
     /* Default is noop. */
 }
 
-
 GType
-libbalsa_mailbox_type_from_path(const gchar *path)
+libbalsa_mailbox_type_from_path(const gchar * path)
 /* libbalsa_get_mailbox_storage_type:
    returns one of LIBBALSA_TYPE_MAILBOX_IMAP,
    LIBBALSA_TYPE_MAILBOX_MAILDIR, LIBBALSA_TYPE_MAILBOX_MH,
@@ -1174,53 +1090,45 @@ libbalsa_mailbox_type_from_path(const gchar *path)
 {
     struct stat st;
 
-    if (strncmp(path, "imap://", 7) == 0) {
+    if(strncmp(path, "imap://", 7) == 0)
         return LIBBALSA_TYPE_MAILBOX_IMAP;
-    }
 
-    if (stat (path, &st) == -1) {
+    if (stat (path, &st) == -1)
         return G_TYPE_OBJECT;
-    }
-
+    
     if (S_ISDIR (st.st_mode)) {
         char tmp[_POSIX_PATH_MAX];
 
         /* check for maildir-style mailbox */
         snprintf (tmp, sizeof (tmp), "%s/cur", path);
-        if ((stat (tmp, &st) == 0) && S_ISDIR (st.st_mode)) {
+        if (stat (tmp, &st) == 0 && S_ISDIR (st.st_mode))
             return LIBBALSA_TYPE_MAILBOX_MAILDIR;
-        }
-
+    
         /* check for mh-style mailbox */
         snprintf (tmp, sizeof (tmp), "%s/.mh_sequences", path);
-        if (access (tmp, F_OK) == 0) {
+        if (access (tmp, F_OK) == 0)
             return LIBBALSA_TYPE_MAILBOX_MH;
-        }
 
         snprintf (tmp, sizeof (tmp), "%s/.xmhcache", path);
-        if (access (tmp, F_OK) == 0) {
+        if (access (tmp, F_OK) == 0)
             return LIBBALSA_TYPE_MAILBOX_MH;
-        }
-
+    
         snprintf (tmp, sizeof (tmp), "%s/.mew_cache", path);
-        if (access (tmp, F_OK) == 0) {
+        if (access (tmp, F_OK) == 0)
             return LIBBALSA_TYPE_MAILBOX_MH;
-        }
 
         snprintf (tmp, sizeof (tmp), "%s/.mew-cache", path);
-        if (access (tmp, F_OK) == 0) {
+        if (access (tmp, F_OK) == 0)
             return LIBBALSA_TYPE_MAILBOX_MH;
-        }
 
-        /*
+        /* 
          * ok, this isn't an mh folder, but mh mode can be used to read
-         * Usenet news from the spool. ;-)
+         * Usenet news from the spool. ;-) 
          */
 
         snprintf (tmp, sizeof (tmp), "%s/.overview", path);
-        if (access (tmp, F_OK) == 0) {
+        if (access (tmp, F_OK) == 0)
             return LIBBALSA_TYPE_MAILBOX_MH;
-        }
 
     } else {
         /* Minimal check for an mbox */
@@ -1230,11 +1138,10 @@ libbalsa_mailbox_type_from_path(const gchar *path)
             gchar buf[5];
             guint len = read(fd, buf, sizeof buf);
             close(fd);
-            if ((len == 0)
-                || ((len == sizeof buf)
-                    && (strncmp(buf, "From ", sizeof buf) == 0))) {
+            if (len == 0
+                || (len == sizeof buf
+                    && strncmp(buf, "From ", sizeof buf) == 0))
                 return LIBBALSA_TYPE_MAILBOX_MBOX;
-            }
         }
     }
 
@@ -1242,45 +1149,37 @@ libbalsa_mailbox_type_from_path(const gchar *path)
     return G_TYPE_OBJECT;
 }
 
-
 /* Each of the next three methods emits a signal that will be caught by
  * a GtkTreeView, so the emission must be made holding the gdk lock.
  */
 
 static LibBalsaMailboxIndexEntry *lbm_get_index_entry(LibBalsaMailbox *
-                                                      lmm,
-                                                      guint msgno);
-
+                                                     lmm, guint msgno);
 /* Does the node (non-NULL) have unseen children? */
 static gboolean
-lbm_node_has_unseen_child(LibBalsaMailbox *lmm,
-                          GNode           *node)
+lbm_node_has_unseen_child(LibBalsaMailbox * lmm, GNode * node)
 {
     for (node = node->children; node; node = node->next) {
-        LibBalsaMailboxIndexEntry *entry =
-            /* g_ptr_array_index(lmm->mindex, msgno - 1); ?? */
-            lbm_get_index_entry(lmm, GPOINTER_TO_UINT(node->data));
-        if ((entry && entry->unseen) || lbm_node_has_unseen_child(lmm, node)) {
-            return TRUE;
-        }
+       LibBalsaMailboxIndexEntry *entry =
+           /* g_ptr_array_index(lmm->mindex, msgno - 1); ?? */
+           lbm_get_index_entry(lmm, GPOINTER_TO_UINT(node->data));
+       if ((entry && entry->unseen) || lbm_node_has_unseen_child(lmm, node))
+           return TRUE;
     }
     return FALSE;
 }
 
-
 /* Protects access to mailbox->msgnos_changed; may be locked
  * with or without the gdk lock, so WE MUST NOT GRAB THE GDK LOCK WHILE
  * HOLDING IT. */
 
 static GMutex msgnos_changed_lock;
 
-static void lbm_update_msgnos(LibBalsaMailbox *mailbox,
-                              guint            seqno,
-                              GArray          *msgnos);
+static void lbm_update_msgnos(LibBalsaMailbox * mailbox, guint seqno,
+                              GArray * msgnos);
 
 static void
-lbm_msgno_changed_expunged_cb(LibBalsaMailbox *mailbox,
-                              guint            seqno)
+lbm_msgno_changed_expunged_cb(LibBalsaMailbox * mailbox, guint seqno)
 {
     g_mutex_lock(&msgnos_changed_lock);
     lbm_update_msgnos(mailbox, seqno, mailbox->msgnos_changed);
@@ -1289,15 +1188,13 @@ lbm_msgno_changed_expunged_cb(LibBalsaMailbox *mailbox,
 
 
 static void
-lbm_msgno_row_changed(LibBalsaMailbox *mailbox,
-                      guint            msgno,
-                      GtkTreeIter     *iter)
+lbm_msgno_row_changed(LibBalsaMailbox * mailbox, guint msgno,
+                      GtkTreeIter * iter)
 {
-    if (!iter->user_data) {
+    if (!iter->user_data)
         iter->user_data =
             g_node_find(mailbox->msg_tree, G_PRE_ORDER, G_TRAVERSE_ALL,
                         GUINT_TO_POINTER(msgno));
-    }
 
     if (iter->user_data) {
         GtkTreePath *path;
@@ -1312,13 +1209,12 @@ lbm_msgno_row_changed(LibBalsaMailbox *mailbox,
 
 
 static gboolean
-lbm_msgnos_changed_idle_cb(LibBalsaMailbox *mailbox)
+lbm_msgnos_changed_idle_cb(LibBalsaMailbox * mailbox)
 {
     guint i;
 
-    if (!mailbox->msgnos_changed) {
+    if (!mailbox->msgnos_changed)
         return FALSE;
-    }
 
 #define DEBUG FALSE
 #if DEBUG
@@ -1331,9 +1227,8 @@ lbm_msgnos_changed_idle_cb(LibBalsaMailbox *mailbox)
         guint msgno = g_array_index(mailbox->msgnos_changed, guint, i);
         GtkTreeIter iter;
 
-        if (!MAILBOX_OPEN(mailbox)) {
+        if (!MAILBOX_OPEN(mailbox))
             break;
-        }
 
 #if DEBUG
         g_print("%s %s msgno %d\n", __func__, mailbox->name, msgno);
@@ -1357,9 +1252,8 @@ lbm_msgnos_changed_idle_cb(LibBalsaMailbox *mailbox)
 
 
 static void
-lbm_msgno_changed(LibBalsaMailbox *mailbox,
-                  guint            seqno,
-                  GtkTreeIter     *iter)
+lbm_msgno_changed(LibBalsaMailbox * mailbox, guint seqno,
+                  GtkTreeIter * iter)
 {
     if (libbalsa_am_i_subthread()) {
         g_mutex_lock(&msgnos_changed_lock);
@@ -1370,31 +1264,27 @@ lbm_msgno_changed(LibBalsaMailbox *mailbox,
                              G_CALLBACK(lbm_msgno_changed_expunged_cb),
                              NULL);
         }
-        if (mailbox->msgnos_changed->len == 0) {
+        if (mailbox->msgnos_changed->len == 0)
             g_idle_add((GSourceFunc) lbm_msgnos_changed_idle_cb,
                        g_object_ref(mailbox));
-        }
 
         g_array_append_val(mailbox->msgnos_changed, seqno);
         g_mutex_unlock(&msgnos_changed_lock);
 
         /* Not calling lbm_msgno_row_changed, so we must make sure
          * iter->user_data is set: */
-        if (!iter->user_data) {
+        if (!iter->user_data)
             iter->user_data =
                 g_node_find(mailbox->msg_tree, G_PRE_ORDER, G_TRAVERSE_ALL,
                             GUINT_TO_POINTER(seqno));
-        }
         return;
     }
 
     lbm_msgno_row_changed(mailbox, seqno, iter);
 }
 
-
 void
-libbalsa_mailbox_msgno_changed(LibBalsaMailbox *mailbox,
-                               guint            seqno)
+libbalsa_mailbox_msgno_changed(LibBalsaMailbox * mailbox, guint seqno)
 {
     GtkTreeIter iter;
 
@@ -1410,13 +1300,11 @@ libbalsa_mailbox_msgno_changed(LibBalsaMailbox *mailbox,
         GNode *parent = ((GNode *) iter.user_data)->parent;
 
         iter.user_data = parent;
-        if (parent && ((seqno = GPOINTER_TO_UINT(parent->data)) > 0)) {
+        if (parent && (seqno = GPOINTER_TO_UINT(parent->data)) > 0)
             lbm_msgno_changed(mailbox, seqno, &iter);
-        }
     }
 }
 
-
 static gboolean
 lbm_need_threading_idle_cb(LibBalsaMailbox *mailbox)
 {
@@ -1431,19 +1319,15 @@ lbm_need_threading_idle_cb(LibBalsaMailbox *mailbox)
     return FALSE;
 }
 
-
 void
-libbalsa_mailbox_msgno_inserted(LibBalsaMailbox *mailbox,
-                                guint            seqno,
-                                GNode           *parent,
-                                GNode          **sibling)
+libbalsa_mailbox_msgno_inserted(LibBalsaMailbox *mailbox, guint seqno,
+                                GNode * parent, GNode ** sibling)
 {
     GtkTreeIter iter;
     GtkTreePath *path;
 
-    if (!mailbox->msg_tree) {
+    if (!mailbox->msg_tree)
         return;
-    }
 #undef SANITY_CHECK
 #ifdef SANITY_CHECK
     g_return_if_fail(!g_node_find(mailbox->msg_tree,
@@ -1475,10 +1359,8 @@ libbalsa_mailbox_msgno_inserted(LibBalsaMailbox *mailbox,
     mailbox->msg_tree_changed = TRUE;
 }
 
-
 static void
-libbalsa_mailbox_msgno_filt_in(LibBalsaMailbox *mailbox,
-                               guint            seqno)
+libbalsa_mailbox_msgno_filt_in(LibBalsaMailbox *mailbox, guint seqno)
 {
     GtkTreeIter iter;
     GtkTreePath *path;
@@ -1501,36 +1383,28 @@ libbalsa_mailbox_msgno_filt_in(LibBalsaMailbox *mailbox,
     lbm_changed_schedule_idle(mailbox);
 }
 
-
 /*
  * libbalsa_mailbox_msgno_removed and helpers
  */
-struct remove_data {
-    LibBalsaMailbox *mailbox;
-    unsigned seqno;
-    GNode *node;
-};
+struct remove_data {LibBalsaMailbox *mailbox; unsigned seqno; GNode *node; };
 static gboolean
-decrease_post(GNode   *node,
-              gpointer data)
+decrease_post(GNode *node, gpointer data)
 {
-    struct remove_data *dt = (struct remove_data *)data;
+    struct remove_data *dt = (struct remove_data*)data;
     unsigned seqno = GPOINTER_TO_UINT(node->data);
-    if (seqno == dt->seqno) {
+    if(seqno == dt->seqno) 
         dt->node = node;
-    } else if (seqno > dt->seqno) {
-        GtkTreeIter iter;
-        node->data = GUINT_TO_POINTER(seqno - 1);
+    else if(seqno>dt->seqno) {
+        GtkTreeIter iter; 
+        node->data = GUINT_TO_POINTER(seqno-1);
         iter.user_data = node;
         lbm_msgno_changed(dt->mailbox, seqno, &iter);
     }
     return FALSE;
 }
 
-
 void
-libbalsa_mailbox_msgno_removed(LibBalsaMailbox *mailbox,
-                               guint            seqno)
+libbalsa_mailbox_msgno_removed(LibBalsaMailbox * mailbox, guint seqno)
 {
     GtkTreeIter iter;
     GtkTreePath *path;
@@ -1584,11 +1458,10 @@ libbalsa_mailbox_msgno_removed(LibBalsaMailbox *mailbox,
         iter.user_data = child;
         g_signal_emit(mailbox, libbalsa_mbox_model_signals[ROW_INSERTED], 0,
                       path, &iter);
-        if (child->children) {
+        if (child->children)
             g_signal_emit(mailbox,
                           libbalsa_mbox_model_signals[ROW_HAS_CHILD_TOGGLED],
                           0, path, &iter);
-        }
         gtk_tree_path_next(path);
     }
 
@@ -1610,15 +1483,13 @@ libbalsa_mailbox_msgno_removed(LibBalsaMailbox *mailbox,
                       libbalsa_mbox_model_signals[ROW_HAS_CHILD_TOGGLED], 0,
                       path, &iter);
     }
-
+    
     gtk_tree_path_free(path);
     mailbox->stamp++;
 }
 
-
 static void
-libbalsa_mailbox_msgno_filt_out(LibBalsaMailbox *mailbox,
-                                GNode           *node)
+libbalsa_mailbox_msgno_filt_out(LibBalsaMailbox * mailbox, GNode * node)
 {
     GtkTreeIter iter;
     GtkTreePath *path;
@@ -1647,11 +1518,10 @@ libbalsa_mailbox_msgno_filt_out(LibBalsaMailbox *mailbox,
         iter.user_data = child;
         g_signal_emit(mailbox, libbalsa_mbox_model_signals[ROW_INSERTED], 0,
                       path, &iter);
-        if (child->children) {
+        if (child->children)
             g_signal_emit(mailbox,
                           libbalsa_mbox_model_signals[ROW_HAS_CHILD_TOGGLED],
                           0, path, &iter);
-        }
         gtk_tree_path_next(path);
     }
 
@@ -1666,7 +1536,7 @@ libbalsa_mailbox_msgno_filt_out(LibBalsaMailbox *mailbox,
                       libbalsa_mbox_model_signals[ROW_HAS_CHILD_TOGGLED], 0,
                       path, &iter);
     }
-
+    
     gtk_tree_path_free(path);
     mailbox->stamp++;
 
@@ -1674,7 +1544,6 @@ libbalsa_mailbox_msgno_filt_out(LibBalsaMailbox *mailbox,
     lbm_changed_schedule_idle(mailbox);
 }
 
-
 /*
  * Check whether to filter the message in or out of the view:
  * - if it's in the view and doesn't match the condition, filter it out,
@@ -1684,10 +1553,9 @@ libbalsa_mailbox_msgno_filt_out(LibBalsaMailbox *mailbox,
  */
 
 static void
-lbm_msgno_filt_check(LibBalsaMailbox           *mailbox,
-                     guint                      seqno,
-                     LibBalsaMailboxSearchIter *search_iter,
-                     gboolean                   hold_selected)
+lbm_msgno_filt_check(LibBalsaMailbox * mailbox, guint seqno,
+                     LibBalsaMailboxSearchIter * search_iter,
+                     gboolean hold_selected)
 {
     gboolean match;
     GNode *node;
@@ -1703,42 +1571,37 @@ lbm_msgno_filt_check(LibBalsaMailbox           *mailbox,
                                                  LIBBALSA_MESSAGE_FLAG_SELECTED)
                 : TRUE;
 #if 1
-            /* a hack. The whole filtering idea is bit silly since we
-               keep checking flags (or maybe more!) on all messages so
-               that the time spent on changing the selection grows
-               linearly with the mailbox size!  */
-            if (LIBBALSA_IS_MAILBOX_IMAP(mailbox) &&
-                !libbalsa_mailbox_imap_is_connected
-                    (LIBBALSA_MAILBOX_IMAP(mailbox))) {
-                filt_out = FALSE;
-            }
+           /* a hack. The whole filtering idea is bit silly since we
+              keep checking flags (or maybe more!) on all messages so
+              that the time spent on changing the selection grows
+              linearly with the mailbox size!  */
+           if (LIBBALSA_IS_MAILBOX_IMAP(mailbox) &&
+               !libbalsa_mailbox_imap_is_connected
+               (LIBBALSA_MAILBOX_IMAP(mailbox)))
+               filt_out = FALSE;
 #endif
-            if (filt_out) {
+            if (filt_out)
                 libbalsa_mailbox_msgno_filt_out(mailbox, node);
-            }
         }
     } else {
-        if (match) {
+        if (match)
             libbalsa_mailbox_msgno_filt_in(mailbox, seqno);
-        }
     }
 }
 
-
 typedef struct {
-    LibBalsaMailbox *mailbox;
-    guint seqno;
+    LibBalsaMailbox           *mailbox;
+    guint                      seqno;
     LibBalsaMailboxSearchIter *search_iter;
-    gboolean hold_selected;
+    gboolean                   hold_selected;
 } LibBalsaMailboxMsgnoFiltCheckInfo;
 
 static gboolean
-lbm_msgno_filt_check_idle_cb(LibBalsaMailboxMsgnoFiltCheckInfo *info)
+lbm_msgno_filt_check_idle_cb(LibBalsaMailboxMsgnoFiltCheckInfo * info)
 {
-    if (MAILBOX_OPEN(info->mailbox)) {
+    if (MAILBOX_OPEN(info->mailbox))
         lbm_msgno_filt_check(info->mailbox, info->seqno, info->search_iter,
                              info->hold_selected);
-    }
 
     g_object_unref(info->mailbox);
     libbalsa_mailbox_search_iter_unref(info->search_iter);
@@ -1747,12 +1610,10 @@ lbm_msgno_filt_check_idle_cb(LibBalsaMailboxMsgnoFiltCheckInfo *info)
     return FALSE;
 }
 
-
 void
-libbalsa_mailbox_msgno_filt_check(LibBalsaMailbox           *mailbox,
-                                  guint                      seqno,
-                                  LibBalsaMailboxSearchIter *search_iter,
-                                  gboolean                   hold_selected)
+libbalsa_mailbox_msgno_filt_check(LibBalsaMailbox * mailbox, guint seqno,
+                                  LibBalsaMailboxSearchIter * search_iter,
+                                  gboolean hold_selected)
 {
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
 
@@ -1774,16 +1635,14 @@ libbalsa_mailbox_msgno_filt_check(LibBalsaMailbox           *mailbox,
     }
 }
 
-
 /* Search iters */
 LibBalsaMailboxSearchIter *
-libbalsa_mailbox_search_iter_new(LibBalsaCondition *condition)
+libbalsa_mailbox_search_iter_new(LibBalsaCondition * condition)
 {
     LibBalsaMailboxSearchIter *iter;
 
-    if (!condition) {
+    if (!condition)
         return NULL;
-    }
 
     iter = g_slice_new(LibBalsaMailboxSearchIter);
     iter->mailbox = NULL;
@@ -1795,68 +1654,59 @@ libbalsa_mailbox_search_iter_new(LibBalsaCondition *condition)
     return iter;
 }
 
-
 /* Create a LibBalsaMailboxSearchIter for a mailbox's view_filter. */
 LibBalsaMailboxSearchIter *
-libbalsa_mailbox_search_iter_view(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_search_iter_view(LibBalsaMailbox * mailbox)
 {
     g_return_val_if_fail(LIBBALSA_IS_MAILBOX(mailbox), NULL);
 
     return libbalsa_mailbox_search_iter_new(mailbox->view_filter);
 }
 
-
 /* Increment reference count of a LibBalsaMailboxSearchIter, if it is
  * valid */
 LibBalsaMailboxSearchIter *
-libbalsa_mailbox_search_iter_ref(LibBalsaMailboxSearchIter *search_iter)
+libbalsa_mailbox_search_iter_ref(LibBalsaMailboxSearchIter * search_iter)
 {
-    if (search_iter) {
+    if (search_iter)
         ++search_iter->ref_count;
-    }
 
     return search_iter;
 }
 
-
 /* Decrement reference count of a LibBalsaMailboxSearchIter, if it is
  * non-NULL and valid, and free it if it goes to zero */
 void
-libbalsa_mailbox_search_iter_unref(LibBalsaMailboxSearchIter *search_iter)
+libbalsa_mailbox_search_iter_unref(LibBalsaMailboxSearchIter * search_iter)
 {
     LibBalsaMailbox *mailbox;
 
-    if (!search_iter || (--search_iter->ref_count > 0)) {
+    if (!search_iter || --search_iter->ref_count > 0)
         return;
-    }
 
     mailbox = search_iter->mailbox;
-    if (mailbox && LIBBALSA_MAILBOX_GET_CLASS(mailbox)->search_iter_free) {
+    if (mailbox && LIBBALSA_MAILBOX_GET_CLASS(mailbox)->search_iter_free)
         LIBBALSA_MAILBOX_GET_CLASS(mailbox)->search_iter_free(search_iter);
-    }
 
     libbalsa_condition_unref(search_iter->condition);
     g_slice_free(LibBalsaMailboxSearchIter, search_iter);
 }
 
-
 /* GNode iterators; they return the root node when they run out of nodes,
  * and find the appropriate starting node when called with the root. */
 static GNode *
-lbm_next(GNode *node)
+lbm_next(GNode * node)
 {
     /* next is:     our first child, if we have one;
      *              else our sibling, if we have one;
      *              else the sibling of our first ancestor who has
      *              one.  */
-    if (node->children) {
+    if (node->children)
         return node->children;
-    }
 
     do {
-        if (node->next) {
+        if (node->next)
             return node->next;
-        }
         node = node->parent;
         g_assert(node != NULL);
     } while (!G_NODE_IS_ROOT(node));
@@ -1864,47 +1714,39 @@ lbm_next(GNode *node)
     return node;
 }
 
-
 static GNode *
-lbm_last_descendant(GNode *node)
+lbm_last_descendant(GNode * node)
 {
     if (node->children) {
         GNode *tmp;
 
         node = node->children;
-        while ((tmp = node->next) || (tmp = node->children)) {
+        while ((tmp = node->next) || (tmp = node->children))
             node = tmp;
-        }
     }
     return node;
 }
 
-
 static GNode *
-lbm_prev(GNode *node)
+lbm_prev(GNode * node)
 {
-    if (G_NODE_IS_ROOT(node)) {
+    if (G_NODE_IS_ROOT(node))
         return lbm_last_descendant(node);
-    }
 
     /* previous is: if we have a sibling,
      *                      if it has children, its last descendant;
      *                      else the sibling;
      *              else our parent. */
-    if (node->prev) {
+    if (node->prev)
         return lbm_last_descendant(node->prev);
-    }
 
     return node->parent;
 }
 
-
 /* Find a message in the tree-model, by its message number. */
 gboolean
-libbalsa_mailbox_msgno_find(LibBalsaMailbox *mailbox,
-                            guint            seqno,
-                            GtkTreePath    **path,
-                            GtkTreeIter     *iter)
+libbalsa_mailbox_msgno_find(LibBalsaMailbox * mailbox, guint seqno,
+                            GtkTreePath ** path, GtkTreeIter * iter)
 {
     GtkTreeIter tmp_iter;
 
@@ -1912,25 +1754,21 @@ libbalsa_mailbox_msgno_find(LibBalsaMailbox *mailbox,
     g_return_val_if_fail(seqno > 0, FALSE);
 
     if (!mailbox->msg_tree || !(tmp_iter.user_data =
-                                    g_node_find(mailbox->msg_tree, G_PRE_ORDER, G_TRAVERSE_ALL,
-                                                GINT_TO_POINTER(seqno)))) {
+        g_node_find(mailbox->msg_tree, G_PRE_ORDER, G_TRAVERSE_ALL,
+                    GINT_TO_POINTER(seqno))))
         return FALSE;
-    }
 
     tmp_iter.stamp = mailbox->stamp;
 
-    if (path) {
+    if (path)
         *path =
             gtk_tree_model_get_path(GTK_TREE_MODEL(mailbox), &tmp_iter);
-    }
-    if (iter) {
+    if (iter)
         *iter = tmp_iter;
-    }
 
     return TRUE;
 }
 
-
 struct AddMessageData {
     GMimeStream *stream;
     LibBalsaMessageFlag flags;
@@ -1938,27 +1776,22 @@ struct AddMessageData {
 };
 
 static gboolean
-msg_iterator(LibBalsaMessageFlag *flg,
-             GMimeStream        **stream,
-             void                *arg)
+msg_iterator(LibBalsaMessageFlag *flg, GMimeStream **stream, void *arg)
 {
-    struct AddMessageData *amd = (struct AddMessageData *)arg;
-    if (amd->processed) {
+    struct AddMessageData * amd = (struct AddMessageData*)arg;
+    if (amd->processed)
         return FALSE;
-    }
     amd->processed = TRUE;
     *flg = amd->flags;
-    /* Make sure ::add_messages does not destroy the stream. */
+ /* Make sure ::add_messages does not destroy the stream. */
     *stream = g_object_ref(amd->stream);
     return TRUE;
 }
 
-
 gboolean
-libbalsa_mailbox_add_message(LibBalsaMailbox    *mailbox,
-                             GMimeStream        *stream,
-                             LibBalsaMessageFlag flags,
-                             GError            **err)
+libbalsa_mailbox_add_message(LibBalsaMailbox * mailbox,
+                             GMimeStream * stream,
+                             LibBalsaMessageFlag flags, GError ** err)
 {
     guint retval;
     struct AddMessageData amd;
@@ -1968,17 +1801,16 @@ libbalsa_mailbox_add_message(LibBalsaMailbox    *mailbox,
     libbalsa_lock_mailbox(mailbox);
 
     amd.stream = stream;
-    amd.flags = flags;
+    amd.flags  = flags;
     amd.processed = FALSE;
     retval =
-        LIBBALSA_MAILBOX_GET_CLASS(mailbox)->add_messages(mailbox,
-                                                          msg_iterator, &amd,
-                                                          err);
+        LIBBALSA_MAILBOX_GET_CLASS(mailbox)->add_messages(mailbox, 
+                                                         msg_iterator, &amd,
+                                                         err);
     if (retval) {
         if (!(flags & LIBBALSA_MESSAGE_FLAG_DELETED)
-            && (flags & LIBBALSA_MESSAGE_FLAG_NEW)) {
+            && (flags & LIBBALSA_MESSAGE_FLAG_NEW))
             libbalsa_mailbox_set_unread_messages_flag(mailbox, TRUE);
-        }
         lbm_queue_check(mailbox);
     }
 
@@ -1987,12 +1819,11 @@ libbalsa_mailbox_add_message(LibBalsaMailbox    *mailbox,
     return retval;
 }
 
-
 guint
-libbalsa_mailbox_add_messages(LibBalsaMailbox           *mailbox,
-                              LibBalsaAddMessageIterator iterator,
-                              void                      *arg,
-                              GError                   **err)
+libbalsa_mailbox_add_messages(LibBalsaMailbox * mailbox,
+                             LibBalsaAddMessageIterator iterator,
+                             void *arg,
+                             GError ** err)
 {
     guint retval;
 
@@ -2002,18 +1833,17 @@ libbalsa_mailbox_add_messages(LibBalsaMailbox           *mailbox,
     libbalsa_lock_mailbox(mailbox);
 
     retval =
-        LIBBALSA_MAILBOX_GET_CLASS(mailbox)->add_messages(mailbox,
-                                                          iterator, arg,
-                                                          err);
+        LIBBALSA_MAILBOX_GET_CLASS(mailbox)->add_messages(mailbox, 
+                                                         iterator, arg,
+                                                         err);
 
     if (retval) {
 #ifdef FIXED
-        /* this is something that should be returned/taken care of by
-           add_messages? */
+       /* this is something that should be returned/taken care of by
+          add_messages? */
         if (!(flags & LIBBALSA_MESSAGE_FLAG_DELETED)
-            && (flags & LIBBALSA_MESSAGE_FLAG_NEW)) {
+            && (flags & LIBBALSA_MESSAGE_FLAG_NEW))
             libbalsa_mailbox_set_unread_messages_flag(mailbox, TRUE);
-        }
 #endif
         lbm_queue_check(mailbox);
     }
@@ -2023,9 +1853,8 @@ libbalsa_mailbox_add_messages(LibBalsaMailbox           *mailbox,
     return retval;
 }
 
-
 gboolean
-libbalsa_mailbox_close_backend(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_close_backend(LibBalsaMailbox * mailbox)
 {
     g_return_val_if_fail(mailbox != NULL, FALSE);
     g_return_val_if_fail(LIBBALSA_IS_MAILBOX(mailbox), FALSE);
@@ -2034,9 +1863,8 @@ libbalsa_mailbox_close_backend(LibBalsaMailbox *mailbox)
     return LIBBALSA_MAILBOX_GET_CLASS(mailbox)->close_backend(mailbox);
 }
 
-
 guint
-libbalsa_mailbox_total_messages(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_total_messages(LibBalsaMailbox * mailbox)
 {
     g_return_val_if_fail(mailbox != NULL, 0);
     g_return_val_if_fail(LIBBALSA_IS_MAILBOX(mailbox), 0);
@@ -2045,10 +1873,8 @@ libbalsa_mailbox_total_messages(LibBalsaMailbox *mailbox)
     return LIBBALSA_MAILBOX_GET_CLASS(mailbox)->total_messages(mailbox);
 }
 
-
 gboolean
-libbalsa_mailbox_sync_storage(LibBalsaMailbox *mailbox,
-                              gboolean         expunge)
+libbalsa_mailbox_sync_storage(LibBalsaMailbox * mailbox, gboolean expunge)
 {
     gboolean retval = TRUE;
 
@@ -2072,17 +1898,14 @@ libbalsa_mailbox_sync_storage(LibBalsaMailbox *mailbox,
     return retval;
 }
 
-
 static void
-lbm_cache_message(LibBalsaMailbox *mailbox,
-                  guint            msgno,
-                  LibBalsaMessage *message)
+lbm_cache_message(LibBalsaMailbox * mailbox, guint msgno,
+                  LibBalsaMessage * message)
 {
     LibBalsaMailboxIndexEntry *entry;
 
-    if (mailbox->mindex->len < msgno) {
+    if (mailbox->mindex->len < msgno)
         g_ptr_array_set_size(mailbox->mindex, msgno);
-    }
 
     entry = g_ptr_array_index(mailbox->mindex, msgno - 1);
 
@@ -2090,15 +1913,12 @@ lbm_cache_message(LibBalsaMailbox *mailbox,
         g_ptr_array_index(mailbox->mindex, msgno - 1) =
             entry = g_new(LibBalsaMailboxIndexEntry, 1);
         lbm_index_entry_populate_from_msg(entry, message);
-    } else if (entry->idle_pending) {
+    } else if (entry->idle_pending)
         lbm_index_entry_populate_from_msg(entry, message);
-    }
 }
 
-
 LibBalsaMessage *
-libbalsa_mailbox_get_message(LibBalsaMailbox *mailbox,
-                             guint            msgno)
+libbalsa_mailbox_get_message(LibBalsaMailbox * mailbox, guint msgno)
 {
     LibBalsaMessage *message;
 
@@ -2115,28 +1935,25 @@ libbalsa_mailbox_get_message(LibBalsaMailbox *mailbox,
         return NULL;
     }
 
-    if ( !((msgno > 0) && (msgno <= libbalsa_mailbox_total_messages(mailbox)))) {
-        libbalsa_unlock_mailbox(mailbox);
-        g_warning("get_message: msgno %d out of range", msgno);
-        return NULL;
+    if( !(msgno > 0 && msgno <= libbalsa_mailbox_total_messages(mailbox)) ) {
+       libbalsa_unlock_mailbox(mailbox);
+       g_warning("get_message: msgno %d out of range", msgno);
+       return NULL;
     }
 
     message = LIBBALSA_MAILBOX_GET_CLASS(mailbox)->get_message(mailbox,
                                                                msgno);
-    if (message && mailbox->mindex) {
+    if (message && mailbox->mindex)
         /* Cache the message info, if we do not already have it. */
         lbm_cache_message(mailbox, msgno, message);
-    }
 
     libbalsa_unlock_mailbox(mailbox);
 
     return message;
 }
 
-
 gboolean
-libbalsa_mailbox_prepare_threading(LibBalsaMailbox *mailbox,
-                                   guint            start)
+libbalsa_mailbox_prepare_threading(LibBalsaMailbox * mailbox, guint start)
 {
     g_return_val_if_fail(mailbox != NULL, FALSE);
     g_return_val_if_fail(LIBBALSA_IS_MAILBOX(mailbox), FALSE);
@@ -2146,10 +1963,9 @@ libbalsa_mailbox_prepare_threading(LibBalsaMailbox *mailbox,
                                                                   start);
 }
 
-
 gboolean
-libbalsa_mailbox_fetch_message_structure(LibBalsaMailbox  *mailbox,
-                                         LibBalsaMessage  *message,
+libbalsa_mailbox_fetch_message_structure(LibBalsaMailbox *mailbox,
+                                         LibBalsaMessage *message,
                                          LibBalsaFetchFlag flags)
 {
     g_return_val_if_fail(mailbox != NULL, FALSE);
@@ -2158,13 +1974,12 @@ libbalsa_mailbox_fetch_message_structure(LibBalsaMailbox  *mailbox,
     g_assert(LIBBALSA_MAILBOX_GET_CLASS(mailbox) != NULL);
 
     return LIBBALSA_MAILBOX_GET_CLASS(mailbox)
-           ->fetch_message_structure(mailbox, message, flags);
+        ->fetch_message_structure(mailbox, message, flags);
 }
 
-
 void
-libbalsa_mailbox_release_message(LibBalsaMailbox *mailbox,
-                                 LibBalsaMessage *message)
+libbalsa_mailbox_release_message(LibBalsaMailbox * mailbox,
+                                 LibBalsaMessage * message)
 {
     g_return_if_fail(mailbox != NULL);
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
@@ -2176,7 +1991,6 @@ libbalsa_mailbox_release_message(LibBalsaMailbox *mailbox,
     LIBBALSA_MAILBOX_GET_CLASS(mailbox)->release_message(mailbox, message);
 }
 
-
 void
 libbalsa_mailbox_set_msg_headers(LibBalsaMailbox *mailbox,
                                  LibBalsaMessage *message)
@@ -2186,17 +2000,16 @@ libbalsa_mailbox_set_msg_headers(LibBalsaMailbox *mailbox,
     g_return_if_fail(message != NULL);
     g_assert(LIBBALSA_MAILBOX_GET_CLASS(mailbox) != NULL);
 
-    if (!message->has_all_headers) {
+    if(!message->has_all_headers) {
         LIBBALSA_MAILBOX_GET_CLASS(mailbox)->fetch_headers(mailbox, message);
         message->has_all_headers = 1;
     }
 }
 
-
 gboolean
-libbalsa_mailbox_get_message_part(LibBalsaMessage     *message,
+libbalsa_mailbox_get_message_part(LibBalsaMessage    *message,
                                   LibBalsaMessageBody *part,
-                                  GError             **err)
+                                  GError **err)
 {
     g_return_val_if_fail(message != NULL, FALSE);
     g_return_val_if_fail(message->mailbox != NULL, FALSE);
@@ -2205,14 +2018,12 @@ libbalsa_mailbox_get_message_part(LibBalsaMessage     *message,
     g_return_val_if_fail(part != NULL, FALSE);
 
     return LIBBALSA_MAILBOX_GET_CLASS(message->mailbox)
-           ->get_message_part(message, part, err);
+        ->get_message_part(message, part, err);
 }
 
-
 GMimeStream *
-libbalsa_mailbox_get_message_stream(LibBalsaMailbox *mailbox,
-                                    guint            msgno,
-                                    gboolean         peek)
+libbalsa_mailbox_get_message_stream(LibBalsaMailbox * mailbox, guint msgno,
+                                   gboolean peek)
 {
     g_return_val_if_fail(LIBBALSA_IS_MAILBOX(mailbox), NULL);
     g_return_val_if_fail(msgno <= libbalsa_mailbox_total_messages(mailbox),
@@ -2221,16 +2032,15 @@ libbalsa_mailbox_get_message_stream(LibBalsaMailbox *mailbox,
 
     return LIBBALSA_MAILBOX_GET_CLASS(mailbox)->get_message_stream(mailbox,
                                                                    msgno,
-                                                                   peek);
+                                                                  peek);
 }
 
-
 /* libbalsa_mailbox_change_msgs_flags() changes stored message flags
    and is to be used only internally by libbalsa.
- */
+*/
 gboolean
-libbalsa_mailbox_messages_change_flags(LibBalsaMailbox    *mailbox,
-                                       GArray             *msgnos,
+libbalsa_mailbox_messages_change_flags(LibBalsaMailbox * mailbox,
+                                       GArray * msgnos,
                                        LibBalsaMessageFlag set,
                                        LibBalsaMessageFlag clear)
 {
@@ -2244,16 +2054,14 @@ libbalsa_mailbox_messages_change_flags(LibBalsaMailbox    *mailbox,
     real_flag = (set | clear) & LIBBALSA_MESSAGE_FLAGS_REAL;
     g_return_val_if_fail(!mailbox->readonly || !real_flag, FALSE);
 
-    if (msgnos->len == 0) {
-        return TRUE;
-    }
+    if (msgnos->len == 0)
+       return TRUE;
 
-    if (real_flag) {
-        libbalsa_lock_mailbox(mailbox);
-    }
+    if (real_flag)
+       libbalsa_lock_mailbox(mailbox);
 
     retval = LIBBALSA_MAILBOX_GET_CLASS(mailbox)->
-        messages_change_flags(mailbox, msgnos, set, clear);
+       messages_change_flags(mailbox, msgnos, set, clear);
 
     if (retval && mailbox->mindex && mailbox->view_filter) {
         LibBalsaMailboxSearchIter *iter_view =
@@ -2266,21 +2074,18 @@ libbalsa_mailbox_messages_change_flags(LibBalsaMailbox    *mailbox,
         libbalsa_mailbox_search_iter_unref(iter_view);
     }
 
-    if (real_flag) {
-        libbalsa_unlock_mailbox(mailbox);
-    }
+    if (real_flag)
+       libbalsa_unlock_mailbox(mailbox);
 
-    if ((set & LIBBALSA_MESSAGE_FLAG_DELETED) && retval) {
+    if ((set & LIBBALSA_MESSAGE_FLAG_DELETED) && retval)
         libbalsa_mailbox_changed(mailbox);
-    }
 
     return retval;
 }
 
-
 gboolean
-libbalsa_mailbox_msgno_change_flags(LibBalsaMailbox    *mailbox,
-                                    guint               msgno,
+libbalsa_mailbox_msgno_change_flags(LibBalsaMailbox * mailbox,
+                                    guint msgno,
                                     LibBalsaMessageFlag set,
                                     LibBalsaMessageFlag clear)
 {
@@ -2298,13 +2103,10 @@ libbalsa_mailbox_msgno_change_flags(LibBalsaMailbox    *mailbox,
     return retval;
 }
 
-
 /* Copy messages with msgnos in the list from mailbox to dest. */
 gboolean
-libbalsa_mailbox_messages_copy(LibBalsaMailbox *mailbox,
-                               GArray          *msgnos,
-                               LibBalsaMailbox *dest,
-                               GError         **err)
+libbalsa_mailbox_messages_copy(LibBalsaMailbox * mailbox, GArray * msgnos,
+                               LibBalsaMailbox * dest, GError **err)
 {
     gboolean retval;
 
@@ -2319,13 +2121,11 @@ libbalsa_mailbox_messages_copy(LibBalsaMailbox *mailbox,
     return retval;
 }
 
-
 /* Move messages with msgnos in the list from mailbox to dest. */
 gboolean
-libbalsa_mailbox_messages_move(LibBalsaMailbox *mailbox,
-                               GArray          *msgnos,
-                               LibBalsaMailbox *dest,
-                               GError         **err)
+libbalsa_mailbox_messages_move(LibBalsaMailbox * mailbox,
+                               GArray * msgnos,
+                               LibBalsaMailbox * dest, GError **err)
 {
     gboolean retval;
 
@@ -2335,22 +2135,19 @@ libbalsa_mailbox_messages_move(LibBalsaMailbox *mailbox,
     libbalsa_lock_mailbox(mailbox);
     if (libbalsa_mailbox_messages_copy(mailbox, msgnos, dest, err)) {
         retval = libbalsa_mailbox_messages_change_flags
-                (mailbox, msgnos, LIBBALSA_MESSAGE_FLAG_DELETED,
-                (LibBalsaMessageFlag) 0);
-        if (!retval) {
-            g_set_error(err, LIBBALSA_MAILBOX_ERROR,
+            (mailbox, msgnos, LIBBALSA_MESSAGE_FLAG_DELETED,
+             (LibBalsaMessageFlag) 0);
+       if(!retval)
+           g_set_error(err,LIBBALSA_MAILBOX_ERROR,
                         LIBBALSA_MAILBOX_COPY_ERROR,
-                        _("Removing messages from source mailbox failed"));
-        }
-    } else {
+                       _("Removing messages from source mailbox failed"));
+    } else
         retval = FALSE;
-    }
     libbalsa_unlock_mailbox(mailbox);
 
     return retval;
 }
 
-
 /*
  * Mailbox views.
  *
@@ -2361,9 +2158,9 @@ libbalsa_mailbox_messages_move(LibBalsaMailbox *mailbox,
  * Returns TRUE if the message tree was updated.
  */
 gboolean
-libbalsa_mailbox_set_view_filter(LibBalsaMailbox   *mailbox,
+libbalsa_mailbox_set_view_filter(LibBalsaMailbox *mailbox,
                                  LibBalsaCondition *cond,
-                                 gboolean           update_immediately)
+                                 gboolean update_immediately)
 {
     gboolean retval = FALSE;
 
@@ -2371,9 +2168,8 @@ libbalsa_mailbox_set_view_filter(LibBalsaMailbox   *mailbox,
 
     libbalsa_lock_mailbox(mailbox);
 
-    if (!libbalsa_condition_compare(mailbox->view_filter, cond)) {
+    if (!libbalsa_condition_compare(mailbox->view_filter, cond))
         mailbox->view_filter_pending = TRUE;
-    }
 
     libbalsa_condition_unref(mailbox->view_filter);
     mailbox->view_filter = libbalsa_condition_ref(cond);
@@ -2390,20 +2186,17 @@ libbalsa_mailbox_set_view_filter(LibBalsaMailbox   *mailbox,
     return retval;
 }
 
-
 void
-libbalsa_mailbox_make_view_filter_persistent(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_make_view_filter_persistent(LibBalsaMailbox * mailbox)
 {
     libbalsa_condition_unref(mailbox->persistent_view_filter);
     mailbox->persistent_view_filter =
         libbalsa_condition_ref(mailbox->view_filter);
 }
 
-
 /* Test message flags. */
 gboolean
-libbalsa_mailbox_msgno_has_flags(LibBalsaMailbox    *mailbox,
-                                 guint               msgno,
+libbalsa_mailbox_msgno_has_flags(LibBalsaMailbox * mailbox, guint msgno,
                                  LibBalsaMessageFlag set,
                                  LibBalsaMessageFlag unset)
 {
@@ -2416,21 +2209,19 @@ libbalsa_mailbox_msgno_has_flags(LibBalsaMailbox    *mailbox,
                                                                 unset);
 }
 
-
 /* Inquire method: check whether mailbox driver can perform operation
    in question. In principle, all operations should be supported but
    some of them may be expensive under certain circumstances and are
    best avoided. */
 static gboolean
-libbalsa_mailbox_real_can_do(LibBalsaMailbox               *mbox,
+libbalsa_mailbox_real_can_do(LibBalsaMailbox* mbox,
                              enum LibBalsaMailboxCapability cap)
 {
     return TRUE;
 }
 
-
 gboolean
-libbalsa_mailbox_can_do(LibBalsaMailbox               *mailbox,
+libbalsa_mailbox_can_do(LibBalsaMailbox *mailbox,
                         enum LibBalsaMailboxCapability cap)
 {
     g_assert(LIBBALSA_MAILBOX_GET_CLASS(mailbox) != NULL);
@@ -2439,38 +2230,33 @@ libbalsa_mailbox_can_do(LibBalsaMailbox               *mailbox,
 }
 
 
-static void lbm_sort(LibBalsaMailbox *mbox,
-                     GNode           *parent);
+static void lbm_sort(LibBalsaMailbox * mbox, GNode * parent);
 
 static void
-lbm_check_and_sort(LibBalsaMailbox *mailbox)
+lbm_check_and_sort(LibBalsaMailbox * mailbox)
 {
-    if (mailbox->msg_tree) {
+    if (mailbox->msg_tree)
         lbm_sort(mailbox, mailbox->msg_tree);
-    }
 
     libbalsa_mailbox_changed(mailbox);
 }
 
-
 static gboolean
-lbm_set_threading_idle_cb(LibBalsaMailbox *mailbox)
+lbm_set_threading_idle_cb(LibBalsaMailbox * mailbox)
 {
     lbm_check_and_sort(mailbox);
     g_object_unref(mailbox);
     return FALSE;
 }
 
-
 static gboolean
-lbm_set_threading(LibBalsaMailbox             *mailbox,
+lbm_set_threading(LibBalsaMailbox * mailbox,
                   LibBalsaMailboxThreadingType thread_type)
 {
     g_assert(LIBBALSA_MAILBOX_GET_CLASS(mailbox) != NULL);
 
-    if (!MAILBOX_OPEN(mailbox)) {
+    if (!MAILBOX_OPEN(mailbox))
         return FALSE;
-    }
 
     LIBBALSA_MAILBOX_GET_CLASS(mailbox)->set_threading(mailbox,
                                                        thread_type);
@@ -2483,9 +2269,8 @@ lbm_set_threading(LibBalsaMailbox             *mailbox,
     return TRUE;
 }
 
-
 void
-libbalsa_mailbox_set_threading(LibBalsaMailbox             *mailbox,
+libbalsa_mailbox_set_threading(LibBalsaMailbox *mailbox,
                                LibBalsaMailboxThreadingType thread_type)
 {
     g_return_if_fail(mailbox != NULL);
@@ -2496,24 +2281,23 @@ libbalsa_mailbox_set_threading(LibBalsaMailbox             *mailbox,
     libbalsa_unlock_mailbox(mailbox);
 }
 
-
 /* =================================================================== *
-* Mailbox view methods                                                *
-* =================================================================== */
+ * Mailbox view methods                                                *
+ * =================================================================== */
 
 static LibBalsaMailboxView libbalsa_mailbox_view_default = {
-    NULL,                       /* identity_name        */
-    LB_MAILBOX_THREADING_FLAT,  /* threading_type       */
-    0,                          /* filter               */
-    LB_MAILBOX_SORT_TYPE_ASC,   /* sort_type            */
+    NULL,                      /* identity_name        */
+    LB_MAILBOX_THREADING_FLAT, /* threading_type       */
+    0,                         /* filter               */
+    LB_MAILBOX_SORT_TYPE_ASC,  /* sort_type            */
     LB_MAILBOX_SORT_NO,         /* sort_field           */
     LB_MAILBOX_SORT_NO,         /* sort_field_prev      */
-    LB_MAILBOX_SHOW_UNSET,      /* show                 */
-    LB_MAILBOX_SUBSCRIBE_UNSET, /* subscribe            */
-    0,                          /* exposed              */
-    0,                          /* open                 */
-    1,                          /* in_sync              */
-    0,                          /* used                 */
+    LB_MAILBOX_SHOW_UNSET,     /* show                 */
+    LB_MAILBOX_SUBSCRIBE_UNSET,        /* subscribe            */
+    0,                         /* exposed              */
+    0,                         /* open                 */
+    1,                         /* in_sync              */
+    0,                         /* used                 */
 #ifdef HAVE_GPGME
     LB_MAILBOX_CHK_CRYPT_MAYBE, /* gpg_chk_mode         */
 #endif
@@ -2533,192 +2317,161 @@ libbalsa_mailbox_view_new(void)
     return view;
 }
 
-
 void
-libbalsa_mailbox_view_free(LibBalsaMailboxView *view)
+libbalsa_mailbox_view_free(LibBalsaMailboxView * view)
 {
-    if (!view) {
+    if (!view)
         return;
-    }
 
     g_free(view->identity_name);
     g_free(view);
 }
 
-
 /* helper */
 static LibBalsaMailboxView *
-lbm_get_view(LibBalsaMailbox *mailbox)
+lbm_get_view(LibBalsaMailbox * mailbox)
 {
-    if (!mailbox) {
-        return &libbalsa_mailbox_view_default;
-    }
+    if (!mailbox)
+       return &libbalsa_mailbox_view_default;
 
-    if (!mailbox->view) {
+    if (!mailbox->view)
         mailbox->view = libbalsa_mailbox_view_new();
-    }
 
     return mailbox->view;
 }
 
-
 /* Set methods; NULL mailbox is valid, and changes the default value. */
 
 gboolean
-libbalsa_mailbox_set_identity_name(LibBalsaMailbox *mailbox,
-                                   const gchar     *identity_name)
+libbalsa_mailbox_set_identity_name(LibBalsaMailbox * mailbox,
+                                  const gchar * identity_name)
 {
     LibBalsaMailboxView *view = lbm_get_view(mailbox);
 
     if (g_strcmp0(view->identity_name, identity_name) != 0) {
-        g_free(view->identity_name);
-        view->identity_name = g_strdup(identity_name);
-        if (mailbox) {
-            view->in_sync = 0;
-        }
-        return TRUE;
-    } else {
-        return FALSE;
-    }
+       g_free(view->identity_name);
+       view->identity_name = g_strdup(identity_name);
+       if (mailbox)
+           view->in_sync = 0;
+       return TRUE;
+    } else
+       return FALSE;
 }
 
-
 void
-libbalsa_mailbox_set_threading_type(LibBalsaMailbox *mailbox,
-                                    LibBalsaMailboxThreadingType
-                                    threading_type)
+libbalsa_mailbox_set_threading_type(LibBalsaMailbox * mailbox,
+                                LibBalsaMailboxThreadingType
+                                threading_type)
 {
     LibBalsaMailboxView *view = lbm_get_view(mailbox);
 
     if (view->threading_type != threading_type) {
-        view->threading_type = threading_type;
-        if (mailbox) {
-            view->in_sync = 0;
-        }
+       view->threading_type = threading_type;
+       if (mailbox)
+           view->in_sync = 0;
     }
 }
 
-
 void
-libbalsa_mailbox_set_sort_type(LibBalsaMailbox        *mailbox,
-                               LibBalsaMailboxSortType sort_type)
+libbalsa_mailbox_set_sort_type(LibBalsaMailbox * mailbox,
+                           LibBalsaMailboxSortType sort_type)
 {
     LibBalsaMailboxView *view = lbm_get_view(mailbox);
 
     if (view->sort_type != sort_type) {
-        view->sort_type = sort_type;
-        if (mailbox) {
-            view->in_sync = 0;
-        }
+       view->sort_type = sort_type;
+       if (mailbox)
+           view->in_sync = 0;
     }
 }
 
-
 void
-libbalsa_mailbox_set_sort_field(LibBalsaMailbox          *mailbox,
-                                LibBalsaMailboxSortFields sort_field)
+libbalsa_mailbox_set_sort_field(LibBalsaMailbox * mailbox,
+                            LibBalsaMailboxSortFields sort_field)
 {
     LibBalsaMailboxView *view = lbm_get_view(mailbox);
 
     if (view->sort_field != sort_field) {
-        view->sort_field_prev = view->sort_field;
-        view->sort_field = sort_field;
-        if (mailbox) {
-            view->in_sync = 0;
-        }
+       view->sort_field_prev = view->sort_field;
+       view->sort_field = sort_field;
+       if (mailbox)
+           view->in_sync = 0;
     }
 }
 
-
 gboolean
-libbalsa_mailbox_set_show(LibBalsaMailbox    *mailbox,
-                          LibBalsaMailboxShow show)
+libbalsa_mailbox_set_show(LibBalsaMailbox * mailbox, LibBalsaMailboxShow show)
 {
     LibBalsaMailboxView *view = lbm_get_view(mailbox);
 
     if (view->show != show) {
-        /* Don't set not in sync if we're just replacing UNSET with the
-         * default. */
-        if (mailbox && (view->show != LB_MAILBOX_SHOW_UNSET)) {
-            view->in_sync = 0;
-        }
-        view->show = show;
-        return TRUE;
-    } else {
-        return FALSE;
-    }
+       /* Don't set not in sync if we're just replacing UNSET with the
+        * default. */
+       if (mailbox && view->show != LB_MAILBOX_SHOW_UNSET)
+           view->in_sync = 0;
+       view->show = show;
+       return TRUE;
+    } else
+       return FALSE;
 }
 
-
 gboolean
-libbalsa_mailbox_set_subscribe(LibBalsaMailbox         *mailbox,
+libbalsa_mailbox_set_subscribe(LibBalsaMailbox * mailbox,
                                LibBalsaMailboxSubscribe subscribe)
 {
     LibBalsaMailboxView *view = lbm_get_view(mailbox);
 
     if (view->subscribe != subscribe) {
-        /* Don't set not in sync if we're just replacing UNSET with the
-         * default. */
-        if (mailbox && (view->subscribe != LB_MAILBOX_SUBSCRIBE_UNSET)) {
-            view->in_sync = 0;
-        }
-        view->subscribe = subscribe;
-        return TRUE;
-    } else {
-        return FALSE;
-    }
+       /* Don't set not in sync if we're just replacing UNSET with the
+        * default. */
+       if (mailbox && view->subscribe != LB_MAILBOX_SUBSCRIBE_UNSET)
+           view->in_sync = 0;
+       view->subscribe = subscribe;
+       return TRUE;
+    } else
+       return FALSE;
 }
 
-
 void
-libbalsa_mailbox_set_exposed(LibBalsaMailbox *mailbox,
-                             gboolean         exposed)
+libbalsa_mailbox_set_exposed(LibBalsaMailbox * mailbox, gboolean exposed)
 {
     LibBalsaMailboxView *view = lbm_get_view(mailbox);
 
     if (view->exposed != exposed) {
-        view->exposed = exposed ? 1 : 0;
-        if (mailbox) {
-            view->in_sync = 0;
-        }
+       view->exposed = exposed ? 1 : 0;
+       if (mailbox)
+           view->in_sync = 0;
     }
 }
 
-
 void
-libbalsa_mailbox_set_open(LibBalsaMailbox *mailbox,
-                          gboolean         open)
+libbalsa_mailbox_set_open(LibBalsaMailbox * mailbox, gboolean open)
 {
     LibBalsaMailboxView *view = lbm_get_view(mailbox);
 
     if (view->open != open) {
-        view->open = open ? 1 : 0;
-        if (mailbox) {
-            view->in_sync = 0;
-        }
+       view->open = open ? 1 : 0;
+       if (mailbox)
+           view->in_sync = 0;
     }
 }
 
-
 void
-libbalsa_mailbox_set_filter(LibBalsaMailbox *mailbox,
-                            gint             filter)
+libbalsa_mailbox_set_filter(LibBalsaMailbox * mailbox, gint filter)
 {
     LibBalsaMailboxView *view = lbm_get_view(mailbox);
 
     if (view->filter != filter) {
-        view->filter = filter;
-        if (mailbox) {
-            view->in_sync = 0;
-        }
+       view->filter = filter;
+       if (mailbox)
+           view->in_sync = 0;
     }
 }
 
-
 #ifdef HAVE_GPGME
-gboolean
-libbalsa_mailbox_set_crypto_mode(LibBalsaMailbox      *mailbox,
-                                 LibBalsaChkCryptoMode gpg_chk_mode)
+gboolean 
+libbalsa_mailbox_set_crypto_mode(LibBalsaMailbox * mailbox,
+                                LibBalsaChkCryptoMode gpg_chk_mode)
 {
     LibBalsaMailboxView *view;
 
@@ -2726,19 +2479,15 @@ libbalsa_mailbox_set_crypto_mode(LibBalsaMailbox      *mailbox,
 
     view = mailbox->view;
     if (view->gpg_chk_mode != gpg_chk_mode) {
-        view->gpg_chk_mode = gpg_chk_mode;
-        return TRUE;
-    } else {
-        return FALSE;
-    }
+       view->gpg_chk_mode = gpg_chk_mode;
+       return TRUE;
+    } else
+       return FALSE;
 }
-
-
 #endif
 
 void
-libbalsa_mailbox_set_unread(LibBalsaMailbox *mailbox,
-                            gint             unread)
+libbalsa_mailbox_set_unread(LibBalsaMailbox * mailbox, gint unread)
 {
     LibBalsaMailboxView *view;
 
@@ -2749,15 +2498,13 @@ libbalsa_mailbox_set_unread(LibBalsaMailbox *mailbox,
     view->used = 1;
 
     if (view->unread != unread) {
-        view->unread = unread;
+       view->unread = unread;
         view->in_sync = 0;
     }
 }
 
-
 void
-libbalsa_mailbox_set_total(LibBalsaMailbox *mailbox,
-                           gint             total)
+libbalsa_mailbox_set_total(LibBalsaMailbox * mailbox, gint total)
 {
     LibBalsaMailboxView *view;
 
@@ -2767,15 +2514,13 @@ libbalsa_mailbox_set_total(LibBalsaMailbox *mailbox,
     view = lbm_get_view(mailbox);
 
     if (view->total != total) {
-        view->total = total;
+       view->total = total;
         view->in_sync = 0;
     }
 }
 
-
 void
-libbalsa_mailbox_set_mtime(LibBalsaMailbox *mailbox,
-                           time_t           mtime)
+libbalsa_mailbox_set_mtime(LibBalsaMailbox * mailbox, time_t mtime)
 {
     LibBalsaMailboxView *view;
 
@@ -2785,143 +2530,128 @@ libbalsa_mailbox_set_mtime(LibBalsaMailbox *mailbox,
     view = lbm_get_view(mailbox);
 
     if (view->mtime != mtime) {
-        view->mtime = mtime;
+       view->mtime = mtime;
         view->in_sync = 0;
     }
 }
 
-
 /* End of set methods. */
 
 /* Get methods; NULL mailbox is valid, and returns the default value. */
 
 const gchar *
-libbalsa_mailbox_get_identity_name(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_get_identity_name(LibBalsaMailbox * mailbox)
 {
     return (mailbox && mailbox->view) ?
-           mailbox->view->identity_name :
-           libbalsa_mailbox_view_default.identity_name;
+       mailbox->view->identity_name :
+       libbalsa_mailbox_view_default.identity_name;
 }
 
 
 LibBalsaMailboxThreadingType
-libbalsa_mailbox_get_threading_type(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_get_threading_type(LibBalsaMailbox * mailbox)
 {
     return (mailbox && mailbox->view) ?
-           mailbox->view->threading_type :
-           libbalsa_mailbox_view_default.threading_type;
+       mailbox->view->threading_type :
+       libbalsa_mailbox_view_default.threading_type;
 }
 
-
 LibBalsaMailboxSortType
-libbalsa_mailbox_get_sort_type(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_get_sort_type(LibBalsaMailbox * mailbox)
 {
     return (mailbox && mailbox->view) ?
-           mailbox->view->sort_type : libbalsa_mailbox_view_default.sort_type;
+       mailbox->view->sort_type : libbalsa_mailbox_view_default.sort_type;
 }
 
-
 LibBalsaMailboxSortFields
-libbalsa_mailbox_get_sort_field(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_get_sort_field(LibBalsaMailbox * mailbox)
 {
     return (mailbox && mailbox->view) ?
-           mailbox->view->sort_field :
-           libbalsa_mailbox_view_default.sort_field;
+       mailbox->view->sort_field :
+       libbalsa_mailbox_view_default.sort_field;
 }
 
-
 LibBalsaMailboxShow
-libbalsa_mailbox_get_show(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_get_show(LibBalsaMailbox * mailbox)
 {
     return (mailbox && mailbox->view) ?
-           mailbox->view->show : libbalsa_mailbox_view_default.show;
+       mailbox->view->show : libbalsa_mailbox_view_default.show;
 }
 
-
 LibBalsaMailboxSubscribe
-libbalsa_mailbox_get_subscribe(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_get_subscribe(LibBalsaMailbox * mailbox)
 {
     return (mailbox && mailbox->view) ?
-           mailbox->view->subscribe : libbalsa_mailbox_view_default.subscribe;
+       mailbox->view->subscribe : libbalsa_mailbox_view_default.subscribe;
 }
 
-
 gboolean
-libbalsa_mailbox_get_exposed(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_get_exposed(LibBalsaMailbox * mailbox)
 {
     return (mailbox && mailbox->view) ?
-           mailbox->view->exposed : libbalsa_mailbox_view_default.exposed;
+       mailbox->view->exposed : libbalsa_mailbox_view_default.exposed;
 }
 
-
 gboolean
-libbalsa_mailbox_get_open(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_get_open(LibBalsaMailbox * mailbox)
 {
     return (mailbox && mailbox->view) ?
-           mailbox->view->open : libbalsa_mailbox_view_default.open;
+       mailbox->view->open : libbalsa_mailbox_view_default.open;
 }
 
-
 gint
-libbalsa_mailbox_get_filter(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_get_filter(LibBalsaMailbox * mailbox)
 {
     return (mailbox && mailbox->view) ?
-           mailbox->view->filter : libbalsa_mailbox_view_default.filter;
+       mailbox->view->filter : libbalsa_mailbox_view_default.filter;
 }
 
-
 #ifdef HAVE_GPGME
 LibBalsaChkCryptoMode
-libbalsa_mailbox_get_crypto_mode(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_get_crypto_mode(LibBalsaMailbox * mailbox)
 {
     return (mailbox && mailbox->view) ?
-           mailbox->view->gpg_chk_mode :
-           libbalsa_mailbox_view_default.gpg_chk_mode;
+       mailbox->view->gpg_chk_mode :
+       libbalsa_mailbox_view_default.gpg_chk_mode;
 }
-
-
 #endif
 
 gint
-libbalsa_mailbox_get_unread(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_get_unread(LibBalsaMailbox * mailbox)
 {
     if (mailbox && mailbox->view) {
         mailbox->view->used = 1;
-        return mailbox->view->unread;
-    } else {
+       return mailbox->view->unread;
+    } else 
         return libbalsa_mailbox_view_default.unread;
-    }
 }
 
-
 gint
-libbalsa_mailbox_get_total(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_get_total(LibBalsaMailbox * mailbox)
 {
     return (mailbox && mailbox->view) ?
-           mailbox->view->total : libbalsa_mailbox_view_default.total;
+       mailbox->view->total : libbalsa_mailbox_view_default.total;
 }
 
-
 time_t
-libbalsa_mailbox_get_mtime(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_get_mtime(LibBalsaMailbox * mailbox)
 {
     return (mailbox && mailbox->view) ?
-           mailbox->view->mtime : libbalsa_mailbox_view_default.mtime;
+       mailbox->view->mtime : libbalsa_mailbox_view_default.mtime;
 }
 
-
 /* End of get methods. */
 
 /* =================================================================== *
-* GtkTreeModel implementation functions.                              *
-* Important:
-* do not forget to modify LibBalsaMailbox::stamp on each modification
-* of the message list.
-* =================================================================== */
+ * GtkTreeModel implementation functions.                              *
+ * Important:
+ * do not forget to modify LibBalsaMailbox::stamp on each modification
+ * of the message list.
+ * =================================================================== */
 
 /* Iterator invalidation macros. */
 #define VALID_ITER(iter, tree_model) \
-    ((iter) != NULL && \
+    ((iter)!= NULL && \
      (iter)->user_data != NULL && \
      LIBBALSA_IS_MAILBOX(tree_model) && \
      ((LibBalsaMailbox *) tree_model)->stamp == (iter)->stamp)
@@ -2929,35 +2659,35 @@ libbalsa_mailbox_get_mtime(LibBalsaMailbox *mailbox)
     ((iter)->stamp = ((LibBalsaMailbox *) tree_model)->stamp)
 #define INVALIDATE_ITER(iter) ((iter)->stamp = 0)
 
-static GtkTreeModelFlags mbox_model_get_flags(GtkTreeModel *tree_model);
-static gint         mbox_model_get_n_columns(GtkTreeModel *tree_model);
-static GType        mbox_model_get_column_type(GtkTreeModel *tree_model,
-                                               gint          index);
-static gboolean     mbox_model_get_iter(GtkTreeModel *tree_model,
-                                        GtkTreeIter  *iter,
-                                        GtkTreePath  *path);
-static GtkTreePath *mbox_model_get_path(GtkTreeModel *tree_model,
-                                        GtkTreeIter  *iter);
-static void         mbox_model_get_value(GtkTreeModel *tree_model,
-                                         GtkTreeIter  *iter,
-                                         gint          column,
-                                         GValue       *value);
-static gboolean     mbox_model_iter_next(GtkTreeModel *tree_model,
-                                         GtkTreeIter  *iter);
-static gboolean     mbox_model_iter_children(GtkTreeModel *tree_model,
-                                             GtkTreeIter  *iter,
-                                             GtkTreeIter  *parent);
-static gboolean     mbox_model_iter_has_child(GtkTreeModel *tree_model,
-                                              GtkTreeIter  *iter);
-static gint         mbox_model_iter_n_children(GtkTreeModel *tree_model,
-                                               GtkTreeIter  *iter);
-static gboolean     mbox_model_iter_nth_child(GtkTreeModel *tree_model,
-                                              GtkTreeIter  *iter,
-                                              GtkTreeIter  *parent,
-                                              gint          n);
-static gboolean     mbox_model_iter_parent(GtkTreeModel *tree_model,
-                                           GtkTreeIter  *iter,
-                                           GtkTreeIter  *child);
+static GtkTreeModelFlags mbox_model_get_flags  (GtkTreeModel      *tree_model);
+static gint         mbox_model_get_n_columns   (GtkTreeModel      *tree_model);
+static GType        mbox_model_get_column_type (GtkTreeModel      *tree_model,
+                                                gint               index);
+static gboolean     mbox_model_get_iter        (GtkTreeModel      *tree_model,
+                                                GtkTreeIter       *iter,
+                                                GtkTreePath       *path);
+static GtkTreePath *mbox_model_get_path        (GtkTreeModel      *tree_model,
+                                                GtkTreeIter       *iter);
+static void         mbox_model_get_value       (GtkTreeModel      *tree_model,
+                                                GtkTreeIter       *iter,
+                                                gint               column,
+                                                GValue            *value);
+static gboolean     mbox_model_iter_next       (GtkTreeModel      *tree_model,
+                                                GtkTreeIter       *iter);
+static gboolean     mbox_model_iter_children   (GtkTreeModel      *tree_model,
+                                                GtkTreeIter       *iter,
+                                                GtkTreeIter       *parent);
+static gboolean     mbox_model_iter_has_child  (GtkTreeModel      *tree_model,
+                                                GtkTreeIter       *iter);
+static gint         mbox_model_iter_n_children (GtkTreeModel      *tree_model,
+                                                GtkTreeIter       *iter);
+static gboolean     mbox_model_iter_nth_child  (GtkTreeModel      *tree_model,
+                                                GtkTreeIter       *iter,
+                                                GtkTreeIter       *parent,
+                                                gint               n);
+static gboolean     mbox_model_iter_parent     (GtkTreeModel      *tree_model,
+                                                GtkTreeIter       *iter,
+                                                GtkTreeIter       *child);
 
 
 static GType mbox_model_col_type[LB_MBOX_N_COLS];
@@ -2965,70 +2695,65 @@ static GType mbox_model_col_type[LB_MBOX_N_COLS];
 static void
 mbox_model_init(GtkTreeModelIface *iface)
 {
-    iface->get_flags = mbox_model_get_flags;
-    iface->get_n_columns = mbox_model_get_n_columns;
+    iface->get_flags       = mbox_model_get_flags;
+    iface->get_n_columns   = mbox_model_get_n_columns;
     iface->get_column_type = mbox_model_get_column_type;
-    iface->get_iter = mbox_model_get_iter;
-    iface->get_path = mbox_model_get_path;
-    iface->get_value = mbox_model_get_value;
-    iface->iter_next = mbox_model_iter_next;
-    iface->iter_children = mbox_model_iter_children;
-    iface->iter_has_child = mbox_model_iter_has_child;
+    iface->get_iter        = mbox_model_get_iter;
+    iface->get_path        = mbox_model_get_path;
+    iface->get_value       = mbox_model_get_value;
+    iface->iter_next       = mbox_model_iter_next;
+    iface->iter_children   = mbox_model_iter_children;
+    iface->iter_has_child  = mbox_model_iter_has_child;
     iface->iter_n_children = mbox_model_iter_n_children;
-    iface->iter_nth_child = mbox_model_iter_nth_child;
-    iface->iter_parent = mbox_model_iter_parent;
+    iface->iter_nth_child  = mbox_model_iter_nth_child;
+    iface->iter_parent     = mbox_model_iter_parent;
 
-    mbox_model_col_type[LB_MBOX_MSGNO_COL] = G_TYPE_UINT;
-    mbox_model_col_type[LB_MBOX_MARKED_COL] = GDK_TYPE_PIXBUF;
-    mbox_model_col_type[LB_MBOX_ATTACH_COL] = GDK_TYPE_PIXBUF;
-    mbox_model_col_type[LB_MBOX_FROM_COL] = G_TYPE_STRING;
+    mbox_model_col_type[LB_MBOX_MSGNO_COL]   = G_TYPE_UINT;
+    mbox_model_col_type[LB_MBOX_MARKED_COL]  = GDK_TYPE_PIXBUF;
+    mbox_model_col_type[LB_MBOX_ATTACH_COL]  = GDK_TYPE_PIXBUF;
+    mbox_model_col_type[LB_MBOX_FROM_COL]    = G_TYPE_STRING;
     mbox_model_col_type[LB_MBOX_SUBJECT_COL] = G_TYPE_STRING;
-    mbox_model_col_type[LB_MBOX_DATE_COL] = G_TYPE_STRING;
-    mbox_model_col_type[LB_MBOX_SIZE_COL] = G_TYPE_STRING;
-    mbox_model_col_type[LB_MBOX_WEIGHT_COL] = G_TYPE_UINT;
-    mbox_model_col_type[LB_MBOX_STYLE_COL] = G_TYPE_UINT;
-    mbox_model_col_type[LB_MBOX_FOREGROUND_COL] = G_TYPE_STRING;
+    mbox_model_col_type[LB_MBOX_DATE_COL]    = G_TYPE_STRING;
+    mbox_model_col_type[LB_MBOX_SIZE_COL]    = G_TYPE_STRING;
+    mbox_model_col_type[LB_MBOX_WEIGHT_COL]  = G_TYPE_UINT;
+    mbox_model_col_type[LB_MBOX_STYLE_COL]   = G_TYPE_UINT;
+    mbox_model_col_type[LB_MBOX_FOREGROUND_COL]     = G_TYPE_STRING;
     mbox_model_col_type[LB_MBOX_FOREGROUND_SET_COL] = G_TYPE_UINT;
-    mbox_model_col_type[LB_MBOX_BACKGROUND_COL] = G_TYPE_STRING;
+    mbox_model_col_type[LB_MBOX_BACKGROUND_COL]     = G_TYPE_STRING;
     mbox_model_col_type[LB_MBOX_BACKGROUND_SET_COL] = G_TYPE_UINT;
 
 
     libbalsa_mbox_model_signals[ROW_CHANGED] =
-        g_signal_lookup("row-changed", GTK_TYPE_TREE_MODEL);
+        g_signal_lookup("row-changed",           GTK_TYPE_TREE_MODEL);
     libbalsa_mbox_model_signals[ROW_DELETED] =
-        g_signal_lookup("row-deleted", GTK_TYPE_TREE_MODEL);
+        g_signal_lookup("row-deleted",           GTK_TYPE_TREE_MODEL);
     libbalsa_mbox_model_signals[ROW_HAS_CHILD_TOGGLED] =
         g_signal_lookup("row-has-child-toggled", GTK_TYPE_TREE_MODEL);
     libbalsa_mbox_model_signals[ROW_INSERTED] =
-        g_signal_lookup("row-inserted", GTK_TYPE_TREE_MODEL);
+        g_signal_lookup("row-inserted",          GTK_TYPE_TREE_MODEL);
     libbalsa_mbox_model_signals[ROWS_REORDERED] =
-        g_signal_lookup("rows-reordered", GTK_TYPE_TREE_MODEL);
+        g_signal_lookup("rows-reordered",        GTK_TYPE_TREE_MODEL);
 }
 
-
 static GtkTreeModelFlags
 mbox_model_get_flags(GtkTreeModel *tree_model)
 {
     return 0;
 }
 
-
 static gint
 mbox_model_get_n_columns(GtkTreeModel *tree_model)
 {
     return LB_MBOX_N_COLS;
 }
 
-
 static GType
-mbox_model_get_column_type(GtkTreeModel *tree_model,
-                           gint          index)
+mbox_model_get_column_type(GtkTreeModel *tree_model, gint index)
 {
-    g_return_val_if_fail(index >= 0 && index < LB_MBOX_N_COLS, G_TYPE_BOOLEAN);
+    g_return_val_if_fail(index>=0 && index <LB_MBOX_N_COLS, G_TYPE_BOOLEAN);
     return mbox_model_col_type[index];
 }
 
-
 static gboolean
 mbox_model_get_iter(GtkTreeModel *tree_model,
                     GtkTreeIter  *iter,
@@ -3046,49 +2771,42 @@ mbox_model_get_iter(GtkTreeModel *tree_model,
 
     g_return_val_if_fail(depth > 0, FALSE);
 
-    if (!mbox_model_iter_nth_child(tree_model, iter, NULL, indices[0])) {
+    if (!mbox_model_iter_nth_child(tree_model, iter, NULL, indices[0]))
         return FALSE;
-    }
 
     for (i = 1; i < depth; i++) {
         parent = *iter;
         if (!mbox_model_iter_nth_child(tree_model, iter, &parent,
-                                       indices[i])) {
+                                       indices[i]))
             return FALSE;
-        }
     }
 
     return TRUE;
 }
 
-
 static GtkTreePath *
-mbox_model_get_path_helper(GNode *node,
-                           GNode *msg_tree)
+mbox_model_get_path_helper(GNode * node, GNode * msg_tree)
 {
     GtkTreePath *path = gtk_tree_path_new();
 
     while (node->parent) {
-        gint i = g_node_child_position(node->parent, node);
-        if (i < 0) {
-            gtk_tree_path_free(path);
-            return NULL;
-        }
-        gtk_tree_path_prepend_index(path, i);
-        node = node->parent;
+       gint i = g_node_child_position(node->parent, node);
+       if (i < 0) {
+           gtk_tree_path_free(path);
+           return NULL;
+       }
+       gtk_tree_path_prepend_index(path, i);
+       node = node->parent;
     }
 
-    if (node == msg_tree) {
-        return path;
-    }
+    if (node == msg_tree)
+       return path;
     gtk_tree_path_free(path);
     return NULL;
 }
 
-
 static GtkTreePath *
-mbox_model_get_path(GtkTreeModel *tree_model,
-                    GtkTreeIter  *iter)
+mbox_model_get_path(GtkTreeModel * tree_model, GtkTreeIter * iter)
 {
     GNode *node;
 #ifdef SANITY_CHECK
@@ -3100,9 +2818,8 @@ mbox_model_get_path(GtkTreeModel *tree_model,
     node = iter->user_data;
 #ifdef SANITY_CHECK
     for (parent_node = node->parent; parent_node;
-         parent_node = parent_node->parent) {
+         parent_node = parent_node->parent)
         g_return_val_if_fail(parent_node != node, NULL);
-    }
 #endif
 
     g_return_val_if_fail(node->parent != NULL, NULL);
@@ -3112,11 +2829,10 @@ mbox_model_get_path(GtkTreeModel *tree_model,
                                       msg_tree);
 }
 
-
-/* mbox_model_get_value:
-   FIXME: still includes some debugging code in case fetching the
-   message failed.
- */
+/* mbox_model_get_value: 
+  FIXME: still includes some debugging code in case fetching the
+  message failed.
+*/
 
 static GdkPixbuf *status_icons[LIBBALSA_MESSAGE_STATUS_ICONS_NUM];
 static GdkPixbuf *attach_icons[LIBBALSA_MESSAGE_ATTACH_ICONS_NUM];
@@ -3126,17 +2842,15 @@ static GdkPixbuf *attach_icons[LIBBALSA_MESSAGE_ATTACH_ICONS_NUM];
 static GMutex get_index_entry_lock;
 
 static void
-lbm_get_index_entry_expunged_cb(LibBalsaMailbox *mailbox,
-                                guint            seqno)
+lbm_get_index_entry_expunged_cb(LibBalsaMailbox * mailbox, guint seqno)
 {
     g_mutex_lock(&get_index_entry_lock);
     lbm_update_msgnos(mailbox, seqno, mailbox->msgnos_pending);
     g_mutex_unlock(&get_index_entry_lock);
 }
 
-
 static void
-lbm_get_index_entry_real(LibBalsaMailbox *mailbox)
+lbm_get_index_entry_real(LibBalsaMailbox * mailbox)
 {
     guint i;
 
@@ -3149,19 +2863,17 @@ lbm_get_index_entry_real(LibBalsaMailbox *mailbox)
         guint msgno = g_array_index(mailbox->msgnos_pending, guint, i);
         LibBalsaMessage *message;
 
-        if (!MAILBOX_OPEN(mailbox)) {
+        if (!MAILBOX_OPEN(mailbox))
             break;
-        }
 
 #if DEBUG
         g_print("%s %s msgno %d\n", __func__, mailbox->name, msgno);
 #endif
         g_mutex_unlock(&get_index_entry_lock);
-        if ((message = libbalsa_mailbox_get_message(mailbox, msgno))) {
+        if ((message = libbalsa_mailbox_get_message(mailbox, msgno)))
             /* get-message has cached the message info, so we just unref
              * message. */
             g_object_unref(message);
-        }
         g_mutex_lock(&get_index_entry_lock);
     }
 
@@ -3177,23 +2889,19 @@ lbm_get_index_entry_real(LibBalsaMailbox *mailbox)
 
 
 static LibBalsaMailboxIndexEntry *
-lbm_get_index_entry(LibBalsaMailbox *lmm,
-                    guint            msgno)
+lbm_get_index_entry(LibBalsaMailbox * lmm, guint msgno)
 {
     LibBalsaMailboxIndexEntry *entry;
 
-    if (!lmm->mindex) {
+    if (!lmm->mindex)
         return NULL;
-    }
 
-    if (lmm->mindex->len < msgno ) {
+    if (lmm->mindex->len < msgno )
         g_ptr_array_set_size(lmm->mindex, msgno);
-    }
 
     entry = g_ptr_array_index(lmm->mindex, msgno - 1);
-    if (entry) {
+    if (entry)
         return entry->idle_pending ? NULL : entry;
-    }
 
     g_mutex_lock(&get_index_entry_lock);
     if (!lmm->msgnos_pending) {
@@ -3207,9 +2915,9 @@ lbm_get_index_entry(LibBalsaMailbox *lmm,
 
         g_object_ref(lmm);
         get_index_entry_thread =
-            g_thread_new("lbm_get_index_entry_real",
-                         (GThreadFunc) lbm_get_index_entry_real,
-                         lmm);
+               g_thread_new("lbm_get_index_entry_real",
+                                        (GThreadFunc) lbm_get_index_entry_real,
+                                                lmm);
         g_thread_unref(get_index_entry_thread);
     }
 
@@ -3223,127 +2931,107 @@ lbm_get_index_entry(LibBalsaMailbox *lmm,
     return entry;
 }
 
-
 gchar **libbalsa_mailbox_date_format;
 static void
 mbox_model_get_value(GtkTreeModel *tree_model,
                      GtkTreeIter  *iter,
-                     gint          column,
-                     GValue       *value)
+                     gint column,
+                     GValue *value)
 {
-    LibBalsaMailbox *lmm = LIBBALSA_MAILBOX(tree_model);
-    LibBalsaMailboxIndexEntry *msg = NULL;
+    LibBalsaMailbox* lmm = LIBBALSA_MAILBOX(tree_model);
+    LibBalsaMailboxIndexEntry* msg = NULL;
     guint msgno;
     gchar *tmp;
-
+    
     g_return_if_fail(VALID_ITER(iter, tree_model));
     g_return_if_fail(column >= 0 &&
                      column < (gint) G_N_ELEMENTS(mbox_model_col_type));
-
+ 
     g_value_init (value, mbox_model_col_type[column]);
-    msgno = GPOINTER_TO_UINT(((GNode *)iter->user_data)->data );
+    msgno = GPOINTER_TO_UINT( ((GNode*)iter->user_data)->data );
 
-    if (column == LB_MBOX_MSGNO_COL) {
+    if(column == LB_MBOX_MSGNO_COL) {
         g_value_set_uint(value, msgno);
         return;
     }
-    g_return_if_fail(msgno <= libbalsa_mailbox_total_messages(lmm));
+    g_return_if_fail(msgno<=libbalsa_mailbox_total_messages(lmm));
     msg = lbm_get_index_entry(lmm, msgno);
-    switch (column) {
-    /* case LB_MBOX_MSGNO_COL: handled above */
+    switch(column) {
+        /* case LB_MBOX_MSGNO_COL: handled above */
     case LB_MBOX_MARKED_COL:
-        if (msg && (msg->status_icon < LIBBALSA_MESSAGE_STATUS_ICONS_NUM)) {
+        if (msg && msg->status_icon < LIBBALSA_MESSAGE_STATUS_ICONS_NUM)
             g_value_set_object(value, status_icons[msg->status_icon]);
-        }
         break;
-
     case LB_MBOX_ATTACH_COL:
-        if (msg && (msg->attach_icon < LIBBALSA_MESSAGE_ATTACH_ICONS_NUM)) {
+        if (msg && msg->attach_icon < LIBBALSA_MESSAGE_ATTACH_ICONS_NUM)
             g_value_set_object(value, attach_icons[msg->attach_icon]);
-        }
         break;
-
     case LB_MBOX_FROM_COL:
-        if (msg) {
-            if (msg->from) {
+       if(msg) {
+            if (msg->from)
                 g_value_set_string(value, msg->from);
-            } else {
+            else
                 g_value_set_static_string(value, _("from unknown"));
-            }
-        } else {
+        } else
             g_value_set_static_string(value, _("Loading…"));
-        }
         break;
-
     case LB_MBOX_SUBJECT_COL:
-        if (msg) {
-            g_value_set_string(value, msg->subject);
-        }
+        if(msg) g_value_set_string(value, msg->subject);
         break;
-
     case LB_MBOX_DATE_COL:
-        if (msg) {
+        if(msg) {
             tmp = libbalsa_date_to_utf8(msg->msg_date,
-                                        *libbalsa_mailbox_date_format);
+                                       *libbalsa_mailbox_date_format);
             g_value_take_string(value, tmp);
         }
         break;
-
     case LB_MBOX_SIZE_COL:
-        if (msg) {
+        if(msg) {
             tmp = libbalsa_size_to_gchar(msg->size);
             g_value_take_string(value, tmp);
-        } else {
-            g_value_set_static_string(value, "          ");
         }
+        else g_value_set_static_string(value, "          ");
         break;
-
     case LB_MBOX_WEIGHT_COL:
         g_value_set_uint(value, msg && msg->unseen
                          ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL);
         break;
-
     case LB_MBOX_STYLE_COL:
         g_value_set_uint(value, msg &&
-                         lbm_node_has_unseen_child(lmm,
-                                                   (GNode *) iter->user_data)
+                        lbm_node_has_unseen_child(lmm,
+                                                  (GNode *) iter->user_data)
                          ? PANGO_STYLE_OBLIQUE : PANGO_STYLE_NORMAL);
         break;
-
     case LB_MBOX_FOREGROUND_COL:
-        if (msg) {
+        if(msg) {
             tmp = g_strdup(msg->foreground);
             g_value_take_string(value, tmp);
         }
         break;
-
     case LB_MBOX_FOREGROUND_SET_COL:
         g_value_set_uint(value, msg && msg->foreground_set);
         break;
-
     case LB_MBOX_BACKGROUND_COL:
-        if (msg) {
+        if(msg) {
             tmp = g_strdup(msg->background);
             g_value_take_string(value, tmp);
         }
         break;
-
     case LB_MBOX_BACKGROUND_SET_COL:
         g_value_set_uint(value, msg && msg->background_set);
         break;
     }
 }
 
-
 static gboolean
-mbox_model_iter_next(GtkTreeModel *tree_model,
-                     GtkTreeIter  *iter)
+mbox_model_iter_next(GtkTreeModel      *tree_model,
+                     GtkTreeIter       *iter)
 {
     GNode *node;
     g_return_val_if_fail(VALID_ITER(iter, tree_model), FALSE);
 
     node = iter->user_data;
-    if (node && (node = node->next)) {
+    if(node && (node = node->next)) {
         iter->user_data = node;
         VALIDATE_ITER(iter, tree_model);
         return TRUE;
@@ -3353,11 +3041,10 @@ mbox_model_iter_next(GtkTreeModel *tree_model,
     }
 }
 
-
 static gboolean
-mbox_model_iter_children(GtkTreeModel *tree_model,
-                         GtkTreeIter  *iter,
-                         GtkTreeIter  *parent)
+mbox_model_iter_children(GtkTreeModel      *tree_model,
+                         GtkTreeIter       *iter,
+                         GtkTreeIter       *parent)
 {
     GNode *node;
 
@@ -3366,21 +3053,19 @@ mbox_model_iter_children(GtkTreeModel *tree_model,
                          VALID_ITER(parent, tree_model), FALSE);
 
     node = parent ? parent->user_data
-        : LIBBALSA_MAILBOX(tree_model)->msg_tree;
+                  : LIBBALSA_MAILBOX(tree_model)->msg_tree;
     node = node->children;
     if (node) {
         iter->user_data = node;
         VALIDATE_ITER(iter, tree_model);
         return TRUE;
-    } else {
+    } else
         return FALSE;
-    }
 }
 
-
 static gboolean
-mbox_model_iter_has_child(GtkTreeModel *tree_model,
-                          GtkTreeIter  *iter)
+mbox_model_iter_has_child(GtkTreeModel  * tree_model,
+                          GtkTreeIter   * iter)
 {
     GNode *node;
 
@@ -3392,65 +3077,58 @@ mbox_model_iter_has_child(GtkTreeModel *tree_model,
     return (node->children != NULL);
 }
 
-
 static gint
-mbox_model_iter_n_children(GtkTreeModel *tree_model,
-                           GtkTreeIter  *iter)
+mbox_model_iter_n_children(GtkTreeModel      *tree_model,
+                           GtkTreeIter       *iter)
 {
     GNode *node;
 
     g_return_val_if_fail(iter == NULL || VALID_ITER(iter, tree_model), 0);
 
     node = iter ? iter->user_data
-        : LIBBALSA_MAILBOX(tree_model)->msg_tree;
+                : LIBBALSA_MAILBOX(tree_model)->msg_tree;
 
     return node ? g_node_n_children(node) : 0;
 }
 
-
 static gboolean
-mbox_model_iter_nth_child(GtkTreeModel *tree_model,
-                          GtkTreeIter  *iter,
-                          GtkTreeIter  *parent,
-                          gint          n)
+mbox_model_iter_nth_child(GtkTreeModel  * tree_model,
+                          GtkTreeIter   * iter,
+                          GtkTreeIter   * parent,
+                          gint            n)
 {
     GNode *node;
 
     INVALIDATE_ITER(iter);
-    if (!LIBBALSA_MAILBOX(tree_model)->msg_tree) {
+    if(!LIBBALSA_MAILBOX(tree_model)->msg_tree) 
         return FALSE; /* really, this should be never called when
                        * msg_tree == NULL but the FALSE response is
                        * fair as well and only a bit dirtier.
                        * I have more critical problems to debug now. */
-    }
     g_return_val_if_fail(parent == NULL
-                         || VALID_ITER(parent, tree_model), FALSE);
+                         ||VALID_ITER(parent, tree_model), FALSE);
 
     node = parent ? parent->user_data
-        : LIBBALSA_MAILBOX(tree_model)->msg_tree;
-    if (!node) {
-        /* the tree has been destroyed already (mailbox has been
-         * closed), there is nothing to iterate over. This happens
-         * only if mailbox is closed but a view is still active.
-         */
+                  : LIBBALSA_MAILBOX(tree_model)->msg_tree;
+    if(!node) /* the tree has been destroyed already (mailbox has been
+               * closed), there is nothing to iterate over. This happens
+               * only if mailbox is closed but a view is still active. 
+               */
         return FALSE;
-    }
     node = g_node_nth_child(node, n);
 
     if (node) {
         iter->user_data = node;
         VALIDATE_ITER(iter, tree_model);
         return TRUE;
-    } else {
+    } else
         return FALSE;
-    }
 }
 
-
 static gboolean
-mbox_model_iter_parent(GtkTreeModel *tree_model,
-                       GtkTreeIter  *iter,
-                       GtkTreeIter  *child)
+mbox_model_iter_parent(GtkTreeModel     * tree_model,
+                       GtkTreeIter      * iter,
+                       GtkTreeIter      * child)
 {
     GNode *node;
 
@@ -3460,216 +3138,181 @@ mbox_model_iter_parent(GtkTreeModel *tree_model,
 
     node = child->user_data;
     node = node->parent;
-    if (node && (node != LIBBALSA_MAILBOX(tree_model)->msg_tree)) {
+    if (node && node != LIBBALSA_MAILBOX(tree_model)->msg_tree) {
         iter->user_data = node;
         VALIDATE_ITER(iter, tree_model);
         return TRUE;
-    } else {
+    } else
         return FALSE;
-    }
 }
 
-
 /* Set icons used in tree view. */
 
 /* Icons for status column. */
 void
-libbalsa_mailbox_set_unread_icon(GdkPixbuf *pixbuf)
+libbalsa_mailbox_set_unread_icon(GdkPixbuf * pixbuf)
 {
     g_set_object(&status_icons[LIBBALSA_MESSAGE_STATUS_UNREAD], pixbuf);
 }
 
-
-void
-libbalsa_mailbox_set_trash_icon(GdkPixbuf *pixbuf)
+void libbalsa_mailbox_set_trash_icon(GdkPixbuf * pixbuf)
 {
     g_set_object(&status_icons[LIBBALSA_MESSAGE_STATUS_DELETED], pixbuf);
 }
 
-
-void
-libbalsa_mailbox_set_flagged_icon(GdkPixbuf *pixbuf)
+void libbalsa_mailbox_set_flagged_icon(GdkPixbuf * pixbuf)
 {
     g_set_object(&status_icons[LIBBALSA_MESSAGE_STATUS_FLAGGED], pixbuf);
 }
 
-
-void
-libbalsa_mailbox_set_replied_icon(GdkPixbuf *pixbuf)
+void libbalsa_mailbox_set_replied_icon(GdkPixbuf * pixbuf)
 {
     g_set_object(&status_icons[LIBBALSA_MESSAGE_STATUS_REPLIED], pixbuf);
 }
 
-
 /* Icons for attachment column. */
-void
-libbalsa_mailbox_set_attach_icon(GdkPixbuf *pixbuf)
+void libbalsa_mailbox_set_attach_icon(GdkPixbuf * pixbuf)
 {
     g_set_object(&attach_icons[LIBBALSA_MESSAGE_ATTACH_ATTACH], pixbuf);
 }
 
-
 #ifdef HAVE_GPGME
-void
-libbalsa_mailbox_set_good_icon(GdkPixbuf *pixbuf)
+void libbalsa_mailbox_set_good_icon(GdkPixbuf * pixbuf)
 {
     g_set_object(&attach_icons[LIBBALSA_MESSAGE_ATTACH_GOOD], pixbuf);
 }
 
-
-void
-libbalsa_mailbox_set_notrust_icon(GdkPixbuf *pixbuf)
+void libbalsa_mailbox_set_notrust_icon(GdkPixbuf * pixbuf)
 {
     g_set_object(&attach_icons[LIBBALSA_MESSAGE_ATTACH_NOTRUST], pixbuf);
 }
 
-
-void
-libbalsa_mailbox_set_bad_icon(GdkPixbuf *pixbuf)
+void libbalsa_mailbox_set_bad_icon(GdkPixbuf * pixbuf)
 {
     g_set_object(&attach_icons[LIBBALSA_MESSAGE_ATTACH_BAD], pixbuf);
 }
 
-
-void
-libbalsa_mailbox_set_sign_icon(GdkPixbuf *pixbuf)
+void libbalsa_mailbox_set_sign_icon(GdkPixbuf * pixbuf)
 {
     g_set_object(&attach_icons[LIBBALSA_MESSAGE_ATTACH_SIGN], pixbuf);
 }
 
-
-void
-libbalsa_mailbox_set_encr_icon(GdkPixbuf *pixbuf)
+void libbalsa_mailbox_set_encr_icon(GdkPixbuf * pixbuf)
 {
     g_set_object(&attach_icons[LIBBALSA_MESSAGE_ATTACH_ENCR], pixbuf);
 }
-
-
 #endif /* HAVE_GPGME */
 
 /* =================================================================== *
-* GtkTreeDragSource implementation functions.                         *
-* =================================================================== */
+ * GtkTreeDragSource implementation functions.                         *
+ * =================================================================== */
 
-static gboolean mbox_row_draggable(GtkTreeDragSource *drag_source,
-                                   GtkTreePath       *path);
-static gboolean mbox_drag_data_delete(GtkTreeDragSource *drag_source,
-                                      GtkTreePath       *path);
-static gboolean mbox_drag_data_get(GtkTreeDragSource *drag_source,
-                                   GtkTreePath       *path,
-                                   GtkSelectionData  *selection_data);
+static gboolean mbox_row_draggable(GtkTreeDragSource * drag_source,
+                                   GtkTreePath * path);
+static gboolean mbox_drag_data_delete(GtkTreeDragSource * drag_source,
+                                      GtkTreePath * path);
+static gboolean mbox_drag_data_get(GtkTreeDragSource * drag_source,
+                                   GtkTreePath * path,
+                                   GtkSelectionData * selection_data);
 
 static void
-mbox_drag_source_init(GtkTreeDragSourceIface *iface)
+mbox_drag_source_init(GtkTreeDragSourceIface * iface)
 {
-    iface->row_draggable = mbox_row_draggable;
+    iface->row_draggable    = mbox_row_draggable;
     iface->drag_data_delete = mbox_drag_data_delete;
-    iface->drag_data_get = mbox_drag_data_get;
+    iface->drag_data_get    = mbox_drag_data_get;
 }
 
-
 /* These three methods are apparently never called, so what they return
  * is irrelevant.  The code reflects guesses about what they should
  * return if they were ever called.
  */
 static gboolean
-mbox_row_draggable(GtkTreeDragSource *drag_source,
-                   GtkTreePath       *path)
+mbox_row_draggable(GtkTreeDragSource * drag_source, GtkTreePath * path)
 {
     /* All rows are valid sources. */
     return TRUE;
 }
 
-
 static gboolean
-mbox_drag_data_delete(GtkTreeDragSource *drag_source,
-                      GtkTreePath       *path)
+mbox_drag_data_delete(GtkTreeDragSource * drag_source, GtkTreePath * path)
 {
     /* The "drag-data-received" callback handles deleting messages that
      * are dragged out of the mailbox, so we don't. */
     return FALSE;
 }
 
-
 static gboolean
-mbox_drag_data_get(GtkTreeDragSource *drag_source,
-                   GtkTreePath       *path,
-                   GtkSelectionData  *selection_data)
+mbox_drag_data_get(GtkTreeDragSource * drag_source, GtkTreePath * path,
+                   GtkSelectionData * selection_data)
 {
     /* The "drag-data-get" callback passes the list of selected messages
      * to the GtkSelectionData, so we don't. */
     return FALSE;
 }
 
-
 /* =================================================================== *
-* GtkTreeSortable implementation functions.                           *
-* =================================================================== */
-
-static gboolean mbox_get_sort_column_id(GtkTreeSortable *sortable,
-                                        gint            *sort_column_id,
-                                        GtkSortType     *order);
-static void mbox_set_sort_column_id(GtkTreeSortable *sortable,
-                                    gint             sort_column_id,
-                                    GtkSortType      order);
-static void mbox_set_sort_func(GtkTreeSortable       *sortable,
-                               gint                   sort_column_id,
-                               GtkTreeIterCompareFunc func,
-                               gpointer               data,
-                               GDestroyNotify         destroy);
-static void mbox_set_default_sort_func(GtkTreeSortable       *sortable,
+ * GtkTreeSortable implementation functions.                           *
+ * =================================================================== */
+
+static gboolean mbox_get_sort_column_id(GtkTreeSortable * sortable,
+                                        gint * sort_column_id,
+                                        GtkSortType * order);
+static void mbox_set_sort_column_id(GtkTreeSortable * sortable,
+                                    gint sort_column_id,
+                                    GtkSortType order);
+static void mbox_set_sort_func(GtkTreeSortable * sortable,
+                               gint sort_column_id,
+                               GtkTreeIterCompareFunc func, gpointer data,
+                               GDestroyNotify destroy);
+static void mbox_set_default_sort_func(GtkTreeSortable * sortable,
                                        GtkTreeIterCompareFunc func,
-                                       gpointer               data,
-                                       GDestroyNotify         destroy);
-static gboolean mbox_has_default_sort_func(GtkTreeSortable *sortable);
+                                       gpointer data,
+                                       GDestroyNotify destroy);
+static gboolean mbox_has_default_sort_func(GtkTreeSortable * sortable);
 
 static void
-mbox_sortable_init(GtkTreeSortableIface *iface)
+mbox_sortable_init(GtkTreeSortableIface * iface)
 {
-    iface->get_sort_column_id = mbox_get_sort_column_id;
-    iface->set_sort_column_id = mbox_set_sort_column_id;
-    iface->set_sort_func = mbox_set_sort_func;
+    iface->get_sort_column_id    = mbox_get_sort_column_id;
+    iface->set_sort_column_id    = mbox_set_sort_column_id;
+    iface->set_sort_func         = mbox_set_sort_func;
     iface->set_default_sort_func = mbox_set_default_sort_func;
     iface->has_default_sort_func = mbox_has_default_sort_func;
 }
 
-
 static gint
-mbox_compare_from(LibBalsaMailboxIndexEntry *message_a,
-                  LibBalsaMailboxIndexEntry *message_b)
+mbox_compare_from(LibBalsaMailboxIndexEntry * message_a,
+                  LibBalsaMailboxIndexEntry * message_b)
 {
     return g_ascii_strcasecmp(message_a->from, message_b->from);
 }
 
-
 static gint
-mbox_compare_subject(LibBalsaMailboxIndexEntry *message_a,
-                     LibBalsaMailboxIndexEntry *message_b)
+mbox_compare_subject(LibBalsaMailboxIndexEntry * message_a,
+                     LibBalsaMailboxIndexEntry * message_b)
 {
     return g_ascii_strcasecmp(message_a->subject, message_b->subject);
 }
 
-
 static gint
-mbox_compare_date(LibBalsaMailboxIndexEntry *message_a,
-                  LibBalsaMailboxIndexEntry *message_b)
+mbox_compare_date(LibBalsaMailboxIndexEntry * message_a,
+                  LibBalsaMailboxIndexEntry * message_b)
 {
     return message_a->msg_date - message_b->msg_date;
 }
 
-
 static gint
-mbox_compare_size(LibBalsaMailboxIndexEntry *message_a,
-                  LibBalsaMailboxIndexEntry *message_b)
+mbox_compare_size(LibBalsaMailboxIndexEntry * message_a,
+                  LibBalsaMailboxIndexEntry * message_b)
 {
     return message_a->size - message_b->size;
 }
 
-
 static gint
-mbox_compare_func(const SortTuple *a,
-                  const SortTuple *b,
-                  LibBalsaMailbox *mbox)
+mbox_compare_func(const SortTuple * a,
+                  const SortTuple * b,
+                  LibBalsaMailbox * mbox)
 {
     guint msgno_a;
     guint msgno_b;
@@ -3677,40 +3320,35 @@ mbox_compare_func(const SortTuple *a,
 
     msgno_a = GPOINTER_TO_UINT(a->node->data);
     msgno_b = GPOINTER_TO_UINT(b->node->data);
-    if (mbox->view->sort_field == LB_MAILBOX_SORT_NO) {
-        retval = msgno_a - msgno_b;
-    } else {
-        LibBalsaMailboxIndexEntry *message_a;
-        LibBalsaMailboxIndexEntry *message_b;
-
-        message_a = g_ptr_array_index(mbox->mindex, msgno_a - 1);
-        message_b = g_ptr_array_index(mbox->mindex, msgno_b - 1);
-
-        if (!(VALID_ENTRY(message_a) && VALID_ENTRY(message_b))) {
-            return 0;
-        }
-
-        switch (mbox->view->sort_field) {
-        case LB_MAILBOX_SORT_SENDER:
-            retval = mbox_compare_from(message_a, message_b);
-            break;
-
-        case LB_MAILBOX_SORT_SUBJECT:
-            retval = mbox_compare_subject(message_a, message_b);
-            break;
-
-        case LB_MAILBOX_SORT_DATE:
-            retval = mbox_compare_date(message_a, message_b);
-            break;
-
-        case LB_MAILBOX_SORT_SIZE:
-            retval = mbox_compare_size(message_a, message_b);
-            break;
-
-        default:
-            retval = 0;
-            break;
-        }
+    if (mbox->view->sort_field == LB_MAILBOX_SORT_NO)
+       retval = msgno_a - msgno_b;
+    else {
+       LibBalsaMailboxIndexEntry *message_a;
+       LibBalsaMailboxIndexEntry *message_b;
+
+       message_a = g_ptr_array_index(mbox->mindex, msgno_a - 1);
+       message_b = g_ptr_array_index(mbox->mindex, msgno_b - 1);
+
+       if (!(VALID_ENTRY(message_a) && VALID_ENTRY(message_b)))
+           return 0;
+
+       switch (mbox->view->sort_field) {
+       case LB_MAILBOX_SORT_SENDER:
+           retval = mbox_compare_from(message_a, message_b);
+           break;
+       case LB_MAILBOX_SORT_SUBJECT:
+           retval = mbox_compare_subject(message_a, message_b);
+           break;
+       case LB_MAILBOX_SORT_DATE:
+           retval = mbox_compare_date(message_a, message_b);
+           break;
+       case LB_MAILBOX_SORT_SIZE:
+           retval = mbox_compare_size(message_a, message_b);
+           break;
+       default:
+           retval = 0;
+           break;
+       }
 
         if (retval == 0) {
             /* resolve ties using previous sort column */
@@ -3718,19 +3356,15 @@ mbox_compare_func(const SortTuple *a,
             case LB_MAILBOX_SORT_SENDER:
                 retval = mbox_compare_from(message_a, message_b);
                 break;
-
             case LB_MAILBOX_SORT_SUBJECT:
                 retval = mbox_compare_subject(message_a, message_b);
                 break;
-
             case LB_MAILBOX_SORT_DATE:
                 retval = mbox_compare_date(message_a, message_b);
                 break;
-
             case LB_MAILBOX_SORT_SIZE:
                 retval = mbox_compare_size(message_a, message_b);
                 break;
-
             default:
                 retval = 0;
                 break;
@@ -3745,7 +3379,6 @@ mbox_compare_func(const SortTuple *a,
     return retval;
 }
 
-
 /*
  * Sort part of the mailbox tree.
  *
@@ -3753,24 +3386,20 @@ mbox_compare_func(const SortTuple *a,
  * for only the nodes where we do have them.
  */
 static gboolean
-lbm_has_valid_index_entry(LibBalsaMailbox *mailbox,
-                          guint            msgno)
+lbm_has_valid_index_entry(LibBalsaMailbox * mailbox, guint msgno)
 {
     LibBalsaMailboxIndexEntry *entry;
 
-    if (msgno > mailbox->mindex->len) {
+    if (msgno > mailbox->mindex->len)
         return FALSE;
-    }
 
     entry = g_ptr_array_index(mailbox->mindex, msgno - 1);
 
     return VALID_ENTRY(entry);
 }
 
-
 static void
-lbm_sort(LibBalsaMailbox *mbox,
-         GNode           *parent)
+lbm_sort(LibBalsaMailbox * mbox, GNode * parent)
 {
     GArray *sort_array;
     GPtrArray *node_array;
@@ -3786,9 +3415,8 @@ lbm_sort(LibBalsaMailbox *mbox,
     g_assert(LIBBALSA_MAILBOX_GET_CLASS(mbox) != NULL);
 
     node = parent->children;
-    if (!node) {
+    if (!node)
         return;
-    }
 
     if (node->next == NULL) {
         lbm_sort(mbox, node);
@@ -3801,7 +3429,7 @@ lbm_sort(LibBalsaMailbox *mbox,
         SortTuple sort_tuple;
         guint msgno = GPOINTER_TO_UINT(tmp_node->data);
 
-        if (can_sort_all || lbm_has_valid_index_entry(mbox, msgno)) {
+       if (can_sort_all || lbm_has_valid_index_entry(mbox, msgno)) {
             /* We have the sort fields. */
             sort_tuple.offset = node_array->len;
             sort_tuple.node = tmp_node;
@@ -3825,7 +3453,7 @@ lbm_sort(LibBalsaMailbox *mbox,
 
         tmp_node = g_ptr_array_index(node_array, i);
         msgno = GPOINTER_TO_UINT(tmp_node->data);
-        if (can_sort_all || lbm_has_valid_index_entry(mbox, msgno)) {
+       if (can_sort_all || lbm_has_valid_index_entry(mbox, msgno)) {
             /* This is one of the nodes we sorted: find out which one
              * goes here. */
             g_assert(j < sort_array->len);
@@ -3833,21 +3461,18 @@ lbm_sort(LibBalsaMailbox *mbox,
         }
         if (tmp_node->prev != prev) {
             /* Change the links. */
-            if (prev) {
+            if (prev)
                 prev->next = tmp_node;
-            } else {
+            else
                 node = parent->children = tmp_node;
-            }
             tmp_node->prev = prev;
             mbox->msg_tree_changed = TRUE;
-        } else {
+        } else
             g_assert(prev == NULL || prev->next == tmp_node);
-        }
         prev = tmp_node;
     }
-    if (prev != NULL) {
+    if (prev != NULL)
         prev->next = NULL;
-    }
 
     /* Let the world know about our new order */
     if (node_array->len > 0) {
@@ -3868,7 +3493,7 @@ lbm_sort(LibBalsaMailbox *mbox,
         iter.stamp = mbox->stamp;
         iter.user_data = parent;
         path = parent->parent ? mbox_model_get_path(GTK_TREE_MODEL(mbox), &iter)
-            : gtk_tree_path_new();
+                              : gtk_tree_path_new();
         gtk_tree_model_rows_reordered(GTK_TREE_MODEL(mbox),
                                       path, &iter, new_order);
         gtk_tree_path_free(path);
@@ -3878,17 +3503,15 @@ lbm_sort(LibBalsaMailbox *mbox,
     g_array_free(sort_array, TRUE);
     g_ptr_array_free(node_array, TRUE);
 
-    for (tmp_node = node; tmp_node; tmp_node = tmp_node->next) {
+    for (tmp_node = node; tmp_node; tmp_node = tmp_node->next)
         lbm_sort(mbox, tmp_node);
-    }
 }
 
-
 /* called from gtk-tree-view-column */
 static gboolean
-mbox_get_sort_column_id(GtkTreeSortable *sortable,
-                        gint            *sort_column_id,
-                        GtkSortType     *order)
+mbox_get_sort_column_id(GtkTreeSortable * sortable,
+                        gint            * sort_column_id,
+                        GtkSortType     * order)
 {
     LibBalsaMailbox *mbox = (LibBalsaMailbox *) sortable;
 
@@ -3900,40 +3523,34 @@ mbox_get_sort_column_id(GtkTreeSortable *sortable,
         case LB_MAILBOX_SORT_NO:
             *sort_column_id = LB_MBOX_MSGNO_COL;
             break;
-
         case LB_MAILBOX_SORT_SENDER:
             *sort_column_id = LB_MBOX_FROM_COL;
             break;
-
         case LB_MAILBOX_SORT_SUBJECT:
             *sort_column_id = LB_MBOX_SUBJECT_COL;
             break;
-
         case LB_MAILBOX_SORT_DATE:
             *sort_column_id = LB_MBOX_DATE_COL;
             break;
-
         case LB_MAILBOX_SORT_SIZE:
             *sort_column_id = LB_MBOX_SIZE_COL;
             break;
         }
     }
 
-    if (order) {
+    if (order)
         *order = (mbox->view->sort_type ==
                   LB_MAILBOX_SORT_TYPE_DESC ? GTK_SORT_DESCENDING :
                   GTK_SORT_ASCENDING);
-    }
 
     return TRUE;
 }
 
-
 /* called from gtk-tree-view-column */
 static void
-mbox_set_sort_column_id(GtkTreeSortable *sortable,
-                        gint             sort_column_id,
-                        GtkSortType      order)
+mbox_set_sort_column_id(GtkTreeSortable * sortable,
+                        gint              sort_column_id,
+                        GtkSortType       order)
 {
     LibBalsaMailbox *mbox = (LibBalsaMailbox *) sortable;
     LibBalsaMailboxView *view;
@@ -3949,19 +3566,15 @@ mbox_set_sort_column_id(GtkTreeSortable *sortable,
     case LB_MBOX_MSGNO_COL:
         new_field = LB_MAILBOX_SORT_NO;
         break;
-
     case LB_MBOX_FROM_COL:
         new_field = LB_MAILBOX_SORT_SENDER;
         break;
-
     case LB_MBOX_SUBJECT_COL:
         new_field = LB_MAILBOX_SORT_SUBJECT;
         break;
-
     case LB_MBOX_DATE_COL:
         new_field = LB_MAILBOX_SORT_DATE;
         break;
-
     case LB_MBOX_SIZE_COL:
         new_field = LB_MAILBOX_SORT_SIZE;
         break;
@@ -3970,9 +3583,8 @@ mbox_set_sort_column_id(GtkTreeSortable *sortable,
     new_type = (order == GTK_SORT_DESCENDING ? LB_MAILBOX_SORT_TYPE_DESC :
                 LB_MAILBOX_SORT_TYPE_ASC);
 
-    if ((view->sort_field == new_field) && (view->sort_type == new_type)) {
+    if (view->sort_field == new_field && view->sort_type == new_type)
         return;
-    }
 
     if (view->sort_field != new_field) {
         view->sort_field_prev = view->sort_field;
@@ -3988,10 +3600,9 @@ mbox_set_sort_column_id(GtkTreeSortable *sortable,
 
         rc = libbalsa_mailbox_prepare_threading(mbox, 0);
 
-        if (!rc) {
+        if (!rc)
             /* Prepare-threading failed--perhaps mailbox was closed. */
             return;
-        }
     }
     libbalsa_lock_mailbox(mbox);
     lbm_sort(mbox, mbox->msg_tree);
@@ -4000,41 +3611,34 @@ mbox_set_sort_column_id(GtkTreeSortable *sortable,
     libbalsa_mailbox_changed(mbox);
 }
 
-
 static void
-mbox_set_sort_func(GtkTreeSortable       *sortable,
-                   gint                   sort_column_id,
+mbox_set_sort_func(GtkTreeSortable * sortable,
+                   gint sort_column_id,
                    GtkTreeIterCompareFunc func,
-                   gpointer               data,
-                   GDestroyNotify         destroy)
+                   gpointer data, GDestroyNotify destroy)
 {
     g_warning("%s called but not implemented.\n", __func__);
 }
 
-
 static void
-mbox_set_default_sort_func(GtkTreeSortable       *sortable,
+mbox_set_default_sort_func(GtkTreeSortable * sortable,
                            GtkTreeIterCompareFunc func,
-                           gpointer               data,
-                           GDestroyNotify         destroy)
+                           gpointer data, GDestroyNotify destroy)
 {
     g_warning("%s called but not implemented.\n", __func__);
 }
 
-
 /* called from gtk-tree-view-column */
 static gboolean
-mbox_has_default_sort_func(GtkTreeSortable *sortable)
+mbox_has_default_sort_func(GtkTreeSortable * sortable)
 {
     return FALSE;
 }
 
-
 /* Helpers for set-threading-type. */
 void
-libbalsa_mailbox_unlink_and_prepend(LibBalsaMailbox *mailbox,
-                                    GNode           *node,
-                                    GNode           *parent)
+libbalsa_mailbox_unlink_and_prepend(LibBalsaMailbox * mailbox,
+                                    GNode * node, GNode * parent)
 {
     GtkTreeIter iter;
     GtkTreePath *path;
@@ -4087,18 +3691,16 @@ libbalsa_mailbox_unlink_and_prepend(LibBalsaMailbox *mailbox,
         g_signal_emit(mailbox,
                       libbalsa_mbox_model_signals[ROW_INSERTED], 0,
                       path, &iter);
-        if (node->children) {
+        if (node->children)
             g_signal_emit(mailbox,
                           libbalsa_mbox_model_signals[ROW_HAS_CHILD_TOGGLED],
                           0, path, &iter);
-        }
         gtk_tree_path_free(path);
 
         mailbox->msg_tree_changed = TRUE;
     }
 }
 
-
 struct lbm_update_msg_tree_info {
     LibBalsaMailbox *mailbox;
     GNode *new_tree;
@@ -4108,40 +3710,37 @@ struct lbm_update_msg_tree_info {
 
 /* GNodeTraverseFunc for making a reverse lookup array into a tree. */
 static gboolean
-lbm_update_msg_tree_populate(GNode                           *node,
+lbm_update_msg_tree_populate(GNode * node, 
                              struct lbm_update_msg_tree_info *mti)
 {
     guint msgno;
 
     msgno = GPOINTER_TO_UINT(node->data);
 
-    if (msgno < mti->total) {
+    if (msgno < mti->total)
         mti->nodes[msgno] = node;
-    }
 
     return FALSE;
 }
 
-
 /* GNodeTraverseFunc for pruning the current tree; mti->nodes is a
  * reverse lookup array into the new tree, so a NULL value is a node
  * that doesn't appear in the new tree. */
 static gboolean
-lbm_update_msg_tree_prune(GNode                           *node,
+lbm_update_msg_tree_prune(GNode * node,
                           struct lbm_update_msg_tree_info *mti)
 {
     guint msgno;
 
     msgno = GPOINTER_TO_UINT(node->data);
-    if ((msgno >= mti->total) || !mti->nodes[msgno]) {
+    if (msgno >= mti->total || !mti->nodes[msgno]) {
         /* It's a bottom-up traverse, so the node's remaining children
          * are all in the new tree; we'll promote them to be children of
          * the node's parent, which might even be where they finish up. */
-        while (node->children) {
+        while (node->children)
             libbalsa_mailbox_unlink_and_prepend(mti->mailbox,
                                                 node->children,
                                                 node->parent);
-        }
         /* Now we can destroy the node. */
         libbalsa_mailbox_unlink_and_prepend(mti->mailbox, node, NULL);
     }
@@ -4149,52 +3748,44 @@ lbm_update_msg_tree_prune(GNode                           *node,
     return FALSE;
 }
 
-
 /* GNodeTraverseFunc for checking parent-child relationships; mti->nodes
  * is a reverse lookup array into the old tree, so a NULL value means a
  * node that isn't in the current tree, and we insert one; because the
  * traverse is top-down, a missing parent will have been inserted before
  * we get to the child. */
 static gboolean
-lbm_update_msg_tree_move(GNode                           *new_node,
+lbm_update_msg_tree_move(GNode * new_node,
                          struct lbm_update_msg_tree_info *mti)
 {
     guint msgno;
     GNode *node;
     GNode *parent;
 
-    if (!new_node->parent) {
+    if (!new_node->parent)
         return FALSE;
-    }
 
     msgno = GPOINTER_TO_UINT(new_node->data);
-    if (msgno >= mti->total) {
+    if (msgno >= mti->total)
         return FALSE;
-    }
 
     node = mti->nodes[msgno];
-    if (!node) {
+    if (!node)
         mti->nodes[msgno] = node = g_node_new(new_node->data);
-    }
 
     msgno = GPOINTER_TO_UINT(new_node->parent->data);
-    if (msgno >= mti->total) {
+    if (msgno >= mti->total)
         return FALSE;
-    }
 
     parent = mti->nodes[msgno];
 
-    if (parent && (parent != node->parent)) {
+    if (parent && parent != node->parent)
         libbalsa_mailbox_unlink_and_prepend(mti->mailbox, node, parent);
-    }
 
     return FALSE;
 }
 
-
 static void
-lbm_update_msg_tree(LibBalsaMailbox *mailbox,
-                    GNode           *new_tree)
+lbm_update_msg_tree(LibBalsaMailbox * mailbox, GNode * new_tree)
 {
     struct lbm_update_msg_tree_info mti;
 
@@ -4222,9 +3813,8 @@ lbm_update_msg_tree(LibBalsaMailbox *mailbox,
     g_free(mti.nodes);
 }
 
-
 static void
-lbm_set_msg_tree(LibBalsaMailbox *mailbox)
+lbm_set_msg_tree(LibBalsaMailbox * mailbox)
 {
     GtkTreeIter iter;
     GNode *node;
@@ -4232,9 +3822,8 @@ lbm_set_msg_tree(LibBalsaMailbox *mailbox)
 
     iter.stamp = ++mailbox->stamp;
 
-    if (!mailbox->msg_tree) {
+    if (!mailbox->msg_tree)
         return;
-    }
 
     path = gtk_tree_path_new();
     gtk_tree_path_down(path);
@@ -4244,29 +3833,25 @@ lbm_set_msg_tree(LibBalsaMailbox *mailbox)
         g_signal_emit(mailbox,
                       libbalsa_mbox_model_signals[ROW_INSERTED], 0, path,
                       &iter);
-        if (node->children) {
+        if (node->children)
             g_signal_emit(mailbox,
                           libbalsa_mbox_model_signals
                           [ROW_HAS_CHILD_TOGGLED], 0, path, &iter);
-        }
         gtk_tree_path_next(path);
     }
 
     gtk_tree_path_free(path);
 }
 
-
 void
-libbalsa_mailbox_set_msg_tree(LibBalsaMailbox *mailbox,
-                              GNode           *new_tree)
+libbalsa_mailbox_set_msg_tree(LibBalsaMailbox * mailbox, GNode * new_tree)
 {
     if (mailbox->msg_tree && mailbox->msg_tree->children) {
         lbm_update_msg_tree(mailbox, new_tree);
         g_node_destroy(new_tree);
     } else {
-        if (mailbox->msg_tree) {
+        if (mailbox->msg_tree)
             g_node_destroy(mailbox->msg_tree);
-        }
         mailbox->msg_tree = new_tree;
         lbm_set_msg_tree(mailbox);
     }
@@ -4274,26 +3859,23 @@ libbalsa_mailbox_set_msg_tree(LibBalsaMailbox *mailbox,
     mailbox->msg_tree_changed = TRUE;
 }
 
-
 static GMimeMessage *
-lbm_get_mime_msg(LibBalsaMailbox *mailbox,
-                 LibBalsaMessage *msg)
+lbm_get_mime_msg(LibBalsaMailbox * mailbox, LibBalsaMessage * msg)
 {
     GMimeMessage *mime_msg;
 
-    if (!msg->mime_msg) {
+    if (!msg->mime_msg)
         libbalsa_mailbox_fetch_message_structure(mailbox, msg,
                                                  LB_FETCH_RFC822_HEADERS);
-    }
     mime_msg = msg->mime_msg;
-    if (mime_msg) {
+    if (mime_msg)
         g_object_ref(mime_msg);
-    } else {
+    else {
         GMimeStream *stream;
         GMimeParser *parser;
 
         stream = libbalsa_mailbox_get_message_stream(mailbox, msg->msgno,
-                                                     TRUE);
+                                                    TRUE);
         parser = g_mime_parser_new_with_stream(stream);
         g_object_unref(stream);
         mime_msg = g_mime_parser_construct_message(parser);
@@ -4304,29 +3886,24 @@ lbm_get_mime_msg(LibBalsaMailbox *mailbox,
     return mime_msg;
 }
 
-
 /* Try to reassemble messages of type message/partial with the given id;
  * if successful, delete the parts, so we don't keep creating the whole
  * message. */
 
 static void
-lbm_try_reassemble_func(GMimeObject *parent,
-                        GMimeObject *mime_part,
-                        gpointer     data)
+lbm_try_reassemble_func(GMimeObject * parent, GMimeObject * mime_part,
+                        gpointer data)
 {
-    if (GMIME_IS_MESSAGE_PART(mime_part)) {
+    if (GMIME_IS_MESSAGE_PART(mime_part))
         mime_part = ((GMimeMessagePart *) mime_part)->message->mime_part;
-    }
     if (GMIME_IS_MESSAGE_PARTIAL(mime_part)) {
         const GMimeMessagePartial **partial = data;
         *partial = (GMimeMessagePartial *) mime_part;
     }
 }
 
-
 static void
-lbm_try_reassemble(LibBalsaMailbox *mailbox,
-                   const gchar     *id)
+lbm_try_reassemble(LibBalsaMailbox * mailbox, const gchar * id)
 {
     gchar *text;
     guint total_messages;
@@ -4350,9 +3927,8 @@ lbm_try_reassemble(LibBalsaMailbox *mailbox,
         if (libbalsa_mailbox_msgno_has_flags(mailbox, msgno,
                                              LIBBALSA_MESSAGE_FLAG_DELETED,
                                              0)
-            || !(message = libbalsa_mailbox_get_message(mailbox, msgno))) {
+            || !(message = libbalsa_mailbox_get_message(mailbox, msgno)))
             continue;
-        }
 
         if (!libbalsa_message_is_partial(message, &tmp_id)) {
             g_object_unref(message);
@@ -4365,9 +3941,8 @@ lbm_try_reassemble(LibBalsaMailbox *mailbox,
                 (GMimeMessagePartial *) mime_message->mime_part;
 
             g_ptr_array_add(partials, partial);
-            if (g_mime_message_partial_get_total(partial) > 0) {
+            if (g_mime_message_partial_get_total(partial) > 0)
                 total = g_mime_message_partial_get_total(partial);
-            }
             g_object_ref(partial);
             g_object_unref(mime_message);
 
@@ -4393,9 +3968,8 @@ lbm_try_reassemble(LibBalsaMailbox *mailbox,
             if (libbalsa_mailbox_msgno_has_flags(mailbox, msgno,
                                                  LIBBALSA_MESSAGE_FLAG_DELETED,
                                                  0)
-                || !(message = libbalsa_mailbox_get_message(mailbox, msgno))) {
+                || !(message = libbalsa_mailbox_get_message(mailbox, msgno)))
                 continue;
-            }
 
             if (!libbalsa_message_is_multipart(message)) {
                 g_object_unref(message);
@@ -4408,11 +3982,10 @@ lbm_try_reassemble(LibBalsaMailbox *mailbox,
                                      mime_message->mime_part,
                                      lbm_try_reassemble_func, &partial);
             if (partial
-                && (strcmp(g_mime_message_partial_get_id(partial), id) == 0)) {
+                && strcmp(g_mime_message_partial_get_id(partial), id) == 0) {
                 g_ptr_array_add(partials, partial);
-                if (g_mime_message_partial_get_total(partial) > 0) {
+                if (g_mime_message_partial_get_total(partial) > 0)
                     total = g_mime_message_partial_get_total(partial);
-                }
                 g_object_ref(partial);
                 /* We will leave  this message undeleted, as it may have
                  * some warning content.
@@ -4452,11 +4025,10 @@ lbm_try_reassemble(LibBalsaMailbox *mailbox,
     libbalsa_progress_set_text(&progress, NULL, 0);
 }
 
-
 #define LBM_TRY_REASSEMBLE_IDS "libbalsa-mailbox-try-reassemble-ids"
 
 static gboolean
-lbm_try_reassemble_idle(LibBalsaMailbox *mailbox)
+lbm_try_reassemble_idle(LibBalsaMailbox * mailbox)
 {
     GSList *id, *ids;
 
@@ -4465,9 +4037,8 @@ lbm_try_reassemble_idle(LibBalsaMailbox *mailbox)
     libbalsa_lock_mailbox(mailbox);
 
     ids = g_object_get_data(G_OBJECT(mailbox), LBM_TRY_REASSEMBLE_IDS);
-    for (id = ids; id; id = id->next) {
+    for (id = ids; id; id = id->next)
         lbm_try_reassemble(mailbox, id->data);
-    }
 
     g_slist_free_full(ids, g_free);
     g_object_set_data(G_OBJECT(mailbox), LBM_TRY_REASSEMBLE_IDS, NULL);
@@ -4479,16 +4050,14 @@ lbm_try_reassemble_idle(LibBalsaMailbox *mailbox)
     return FALSE;
 }
 
-
 void
-libbalsa_mailbox_try_reassemble(LibBalsaMailbox *mailbox,
-                                const gchar     *id)
+libbalsa_mailbox_try_reassemble(LibBalsaMailbox * mailbox,
+                                const gchar * id)
 {
     GSList *ids;
 
-    if (mailbox->no_reassemble) {
+    if (mailbox->no_reassemble)
         return;
-    }
 
     ids = g_object_get_data(G_OBJECT(mailbox), LBM_TRY_REASSEMBLE_IDS);
     if (!ids) {
@@ -4502,105 +4071,88 @@ libbalsa_mailbox_try_reassemble(LibBalsaMailbox *mailbox,
     }
 }
 
-
 /* Use "message-expunged" signal to update an array of msgnos. */
 static void
-lbm_update_msgnos(LibBalsaMailbox *mailbox,
-                  guint            seqno,
-                  GArray          *msgnos)
+lbm_update_msgnos(LibBalsaMailbox * mailbox, guint seqno, GArray * msgnos)
 {
     guint i, j;
 
     for (i = j = 0; i < msgnos->len; i++) {
         guint msgno = g_array_index(msgnos, guint, i);
-        if (msgno == seqno) {
+        if (msgno == seqno)
             continue;
-        }
-        if (msgno > seqno) {
+        if (msgno > seqno)
             --msgno;
-        }
         g_array_index(msgnos, guint, j) = msgno;
         ++j;
     }
     msgnos->len = j;
 }
 
-
 void
-libbalsa_mailbox_register_msgnos(LibBalsaMailbox *mailbox,
-                                 GArray          *msgnos)
+libbalsa_mailbox_register_msgnos(LibBalsaMailbox * mailbox,
+                                 GArray * msgnos)
 {
     g_signal_connect(mailbox, "message-expunged",
                      G_CALLBACK(lbm_update_msgnos), msgnos);
 }
 
-
 void
-libbalsa_mailbox_unregister_msgnos(LibBalsaMailbox *mailbox,
-                                   GArray          *msgnos)
+libbalsa_mailbox_unregister_msgnos(LibBalsaMailbox * mailbox,
+                                   GArray * msgnos)
 {
-    if (mailbox && msgnos) {
-        g_signal_handlers_disconnect_by_func(mailbox, lbm_update_msgnos,
+    if (mailbox && msgnos)
+       g_signal_handlers_disconnect_by_func(mailbox, lbm_update_msgnos,
                                              msgnos);
-    }
 }
 
-
 /* Accessors for LibBalsaMailboxIndexEntry */
 LibBalsaMessageStatus
-libbalsa_mailbox_msgno_get_status(LibBalsaMailbox *mailbox,
-                                  guint            msgno)
+libbalsa_mailbox_msgno_get_status(LibBalsaMailbox * mailbox, guint msgno)
 {
     LibBalsaMailboxIndexEntry *entry =
         g_ptr_array_index(mailbox->mindex, msgno - 1);
     return VALID_ENTRY(entry) ?
-           entry->status_icon : LIBBALSA_MESSAGE_STATUS_ICONS_NUM;
+        entry->status_icon : LIBBALSA_MESSAGE_STATUS_ICONS_NUM;
 }
 
-
 const gchar *
-libbalsa_mailbox_msgno_get_subject(LibBalsaMailbox *mailbox,
-                                   guint            msgno)
+libbalsa_mailbox_msgno_get_subject(LibBalsaMailbox * mailbox, guint msgno)
 {
     LibBalsaMailboxIndexEntry *entry =
         g_ptr_array_index(mailbox->mindex, msgno - 1);
     return VALID_ENTRY(entry) ? entry->subject : NULL;
 }
 
-
 /* Update icons, but only if entry has been allocated. */
 void
-libbalsa_mailbox_msgno_update_attach(LibBalsaMailbox *mailbox,
-                                     guint            msgno,
-                                     LibBalsaMessage *message)
+libbalsa_mailbox_msgno_update_attach(LibBalsaMailbox * mailbox,
+                                    guint msgno, LibBalsaMessage * message)
 {
     LibBalsaMailboxIndexEntry *entry;
     LibBalsaMessageAttach attach_icon;
 
-    if (!mailbox || !mailbox->mindex || (mailbox->mindex->len < msgno)) {
-        return;
-    }
+    if (!mailbox || !mailbox->mindex || mailbox->mindex->len < msgno)
+       return;
 
     entry = g_ptr_array_index(mailbox->mindex, msgno - 1);
-    if (!VALID_ENTRY(entry)) {
-        return;
-    }
+    if (!VALID_ENTRY(entry))
+       return;
 
     attach_icon = libbalsa_message_get_attach_icon(message);
     if (entry->attach_icon != attach_icon) {
         GtkTreeIter iter;
 
-        entry->attach_icon = attach_icon;
+       entry->attach_icon = attach_icon;
         iter.user_data = NULL;
-        lbm_msgno_changed(mailbox, msgno, &iter);
+       lbm_msgno_changed(mailbox, msgno, &iter);
     }
 }
 
-
 /* Queued check. */
 
 static void
-lbm_check_real(LibBalsaMailbox *mailbox)
+lbm_check_real(LibBalsaMailbox * mailbox)
 {
     libbalsa_lock_mailbox(mailbox);
     libbalsa_mailbox_check(mailbox);
@@ -4608,9 +4160,8 @@ lbm_check_real(LibBalsaMailbox *mailbox)
     g_object_unref(mailbox);
 }
 
-
 static gboolean
-lbm_check_idle(LibBalsaMailbox *mailbox)
+lbm_check_idle(LibBalsaMailbox * mailbox)
 {
     GThread *check_thread;
 
@@ -4625,19 +4176,16 @@ lbm_check_idle(LibBalsaMailbox *mailbox)
     return FALSE;
 }
 
-
 static void
-lbm_queue_check(LibBalsaMailbox *mailbox)
+lbm_queue_check(LibBalsaMailbox * mailbox)
 {
     libbalsa_lock_mailbox(mailbox);
-    if (!mailbox->queue_check_idle_id) {
+    if (!mailbox->queue_check_idle_id)
         mailbox->queue_check_idle_id =
             g_idle_add((GSourceFunc) lbm_check_idle, mailbox);
-    }
     libbalsa_unlock_mailbox(mailbox);
 }
 
-
 /* Search mailbox for a message matching the condition in search_iter,
  * starting at iter, either forward or backward, and abandoning the
  * search if message stop_msgno is reached; return value indicates
@@ -4648,33 +4196,32 @@ lbm_queue_check(LibBalsaMailbox *mailbox)
  * if return value is FALSE, iter is invalid.
  */
 gboolean
-libbalsa_mailbox_search_iter_step(LibBalsaMailbox           *mailbox,
-                                  LibBalsaMailboxSearchIter *search_iter,
-                                  GtkTreeIter               *iter,
-                                  gboolean                   forward,
-                                  guint                      stop_msgno)
+libbalsa_mailbox_search_iter_step(LibBalsaMailbox * mailbox,
+                                  LibBalsaMailboxSearchIter * search_iter,
+                                  GtkTreeIter * iter,
+                                  gboolean forward,
+                                  guint stop_msgno)
 {
     GNode *node;
     gboolean retval = FALSE;
     gint total;
 
     node = iter->user_data;
-    if (!node) {
+    if (!node)
         node = mailbox->msg_tree;
-    }
 
     total = libbalsa_mailbox_total_messages(mailbox);
-    for (;; ) {
+    for (;;) {
         guint msgno;
 
         node = forward ? lbm_next(node) : lbm_prev(node);
         msgno = GPOINTER_TO_UINT(node->data);
-        if ((msgno == stop_msgno)
-            || (--total < 0) /* Runaway? */ ) {
+        if (msgno == stop_msgno
+           || --total < 0 /* Runaway? */ ) {
             retval = FALSE;
             break;
         }
-        if ((msgno > 0)
+        if (msgno > 0
             && libbalsa_mailbox_message_match(mailbox, msgno,
                                               search_iter)) {
             iter->user_data = node;
@@ -4683,41 +4230,36 @@ libbalsa_mailbox_search_iter_step(LibBalsaMailbox           *mailbox,
         }
     }
 
-    if (retval) {
+    if (retval)
         VALIDATE_ITER(iter, mailbox);
-    } else {
-        INVALIDATE_ITER(iter);
-    }
+    else
+       INVALIDATE_ITER(iter);
 
     return retval;
 }
 
-
 /* Remove duplicates */
 
 gboolean
-libbalsa_mailbox_can_move_duplicates(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_can_move_duplicates(LibBalsaMailbox * mailbox)
 {
     g_assert(LIBBALSA_MAILBOX_GET_CLASS(mailbox) != NULL);
 
     return LIBBALSA_MAILBOX_GET_CLASS(mailbox)->duplicate_msgnos != NULL;
 }
 
-
 gint
-libbalsa_mailbox_move_duplicates(LibBalsaMailbox *mailbox,
-                                 LibBalsaMailbox *dest,
-                                 GError         **err)
+libbalsa_mailbox_move_duplicates(LibBalsaMailbox * mailbox,
+                                 LibBalsaMailbox * dest, GError ** err)
 {
     GArray *msgnos = NULL;
     gint retval;
 
     g_assert(LIBBALSA_MAILBOX_GET_CLASS(mailbox) != NULL);
 
-    if (libbalsa_mailbox_can_move_duplicates(mailbox)) {
+    if (libbalsa_mailbox_can_move_duplicates(mailbox))
         msgnos =
             LIBBALSA_MAILBOX_GET_CLASS(mailbox)->duplicate_msgnos(mailbox);
-    }
 
     if (mailbox->state == LB_MAILBOX_STATE_CLOSED) {
         /* duplicate msgnos was interrupted */
@@ -4727,28 +4269,25 @@ libbalsa_mailbox_move_duplicates(LibBalsaMailbox *mailbox,
         return 0;
     }
 
-    if (!msgnos) {
+    if (!msgnos)
         return 0;
-    }
 
     if (msgnos->len > 0) {
-        if (dest && (mailbox != dest)) {
+        if (dest && mailbox != dest)
             libbalsa_mailbox_messages_move(mailbox, msgnos, dest, err);
-        } else {
+        else
             libbalsa_mailbox_messages_change_flags(mailbox, msgnos,
                                                    LIBBALSA_MESSAGE_FLAG_DELETED,
                                                    0);
-        }
     }
     retval = msgnos->len;
     g_array_free(msgnos, TRUE);
     return retval;
 }
 
-
 /* Lock and unlock the mail store. NULL mailbox is not an error. */
-void
-libbalsa_mailbox_lock_store(LibBalsaMailbox *mailbox)
+void 
+libbalsa_mailbox_lock_store(LibBalsaMailbox * mailbox)
 {
     if (mailbox != NULL) {
         g_assert(LIBBALSA_MAILBOX_GET_CLASS(mailbox) != NULL);
@@ -4757,9 +4296,8 @@ libbalsa_mailbox_lock_store(LibBalsaMailbox *mailbox)
     }
 }
 
-
-void
-libbalsa_mailbox_unlock_store(LibBalsaMailbox *mailbox)
+void 
+libbalsa_mailbox_unlock_store(LibBalsaMailbox * mailbox)
 {
     if (mailbox != NULL) {
         g_assert(LIBBALSA_MAILBOX_GET_CLASS(mailbox) != NULL);
@@ -4768,28 +4306,22 @@ libbalsa_mailbox_unlock_store(LibBalsaMailbox *mailbox)
     }
 }
 
-
 void
-libbalsa_mailbox_cache_message(LibBalsaMailbox *mailbox,
-                               guint            msgno,
-                               LibBalsaMessage *message)
+libbalsa_mailbox_cache_message(LibBalsaMailbox * mailbox, guint msgno,
+                               LibBalsaMessage * message)
 {
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
-    if (!mailbox->mindex) {
+    if (!mailbox->mindex)
         return;
-    }
     g_return_if_fail(msgno > 0);
     g_return_if_fail(LIBBALSA_IS_MESSAGE(message));
 
     lbm_cache_message(mailbox, msgno, message);
 }
 
-
 static void
-lbm_set_color(LibBalsaMailbox *mailbox,
-              GArray          *msgnos,
-              const gchar     *color,
-              gboolean         foreground)
+lbm_set_color(LibBalsaMailbox * mailbox, GArray * msgnos,
+              const gchar * color, gboolean foreground)
 {
     guint i;
 
@@ -4797,15 +4329,13 @@ lbm_set_color(LibBalsaMailbox *mailbox,
         guint msgno = g_array_index(msgnos, guint, i);
         LibBalsaMailboxIndexEntry *entry;
 
-        if (msgno > mailbox->mindex->len) {
+        if (msgno > mailbox->mindex->len)
             return;
-        }
 
         entry = g_ptr_array_index(mailbox->mindex, msgno - 1);
-        if (!entry) {
+        if (!entry)
             entry = g_ptr_array_index(mailbox->mindex, msgno - 1) =
-                    g_new0(LibBalsaMailboxIndexEntry, 1);
-        }
+                g_new0(LibBalsaMailboxIndexEntry, 1);
 
         if (foreground) {
             g_free(entry->foreground);
@@ -4819,29 +4349,23 @@ lbm_set_color(LibBalsaMailbox *mailbox,
     }
 }
 
-
 void
-libbalsa_mailbox_set_foreground(LibBalsaMailbox *mailbox,
-                                GArray          *msgnos,
-                                const gchar     *color)
+libbalsa_mailbox_set_foreground(LibBalsaMailbox * mailbox, GArray * msgnos,
+                                const gchar * color)
 {
     lbm_set_color(mailbox, msgnos, color, TRUE);
 }
 
-
 void
-libbalsa_mailbox_set_background(LibBalsaMailbox *mailbox,
-                                GArray          *msgnos,
-                                const gchar     *color)
+libbalsa_mailbox_set_background(LibBalsaMailbox * mailbox, GArray * msgnos,
+                                const gchar * color)
 {
     lbm_set_color(mailbox, msgnos, color, FALSE);
 }
 
-
-void
-libbalsa_mailbox_test_can_reach(LibBalsaMailbox          *mailbox,
-                                LibBalsaCanReachCallback *cb,
-                                gpointer                  cb_data)
+void libbalsa_mailbox_test_can_reach(LibBalsaMailbox          * mailbox,
+                                     LibBalsaCanReachCallback * cb,
+                                     gpointer                   cb_data)
 {
     g_assert(LIBBALSA_MAILBOX_GET_CLASS(mailbox) != NULL);
 
diff --git a/libbalsa/mailbox.h b/libbalsa/mailbox.h
index 7c46e83..834c41a 100644
--- a/libbalsa/mailbox.h
+++ b/libbalsa/mailbox.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -22,7 +22,7 @@
 #define __LIBBALSA_MAILBOX_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include <gdk/gdk.h>
@@ -41,30 +41,30 @@
     (G_TYPE_CHECK_CLASS_TYPE ((klass), LIBBALSA_TYPE_MAILBOX))
 #define LIBBALSA_MAILBOX_GET_CLASS(mailbox) \
     (G_TYPE_INSTANCE_GET_CLASS ((mailbox), LIBBALSA_TYPE_MAILBOX, \
-                                LibBalsaMailboxClass))
+                               LibBalsaMailboxClass))
 
 #define MAILBOX_OPEN(mailbox)     (mailbox->state != LB_MAILBOX_STATE_CLOSED)
 
 #define MAILBOX_CLOSED(mailbox)   (mailbox->state == LB_MAILBOX_STATE_CLOSED)
 
-#define RETURN_IF_MAILBOX_CLOSED(mailbox) \
-    do { \
-        if (MAILBOX_CLOSED (mailbox)) \
-        { \
-            g_print (_("*** ERROR: Mailbox Stream Closed: %s ***\n"), __PRETTY_FUNCTION__); \
-            libbalsa_unlock_mailbox (mailbox); \
-            return; \
-        } \
-    } while (0)
-#define RETURN_VAL_IF_CONTEXT_CLOSED(mailbox, val) \
-    do { \
-        if (MAILBOX_CLOSED (mailbox)) \
-        { \
-            g_print (_("*** ERROR: Mailbox Stream Closed: %s ***\n"), __PRETTY_FUNCTION__); \
-            libbalsa_unlock_mailbox (mailbox); \
-            return (val); \
-        } \
-    } while (0)
+#define RETURN_IF_MAILBOX_CLOSED(mailbox)\
+do {\
+  if (MAILBOX_CLOSED (mailbox))\
+    {\
+      g_print (_("*** ERROR: Mailbox Stream Closed: %s ***\n"), __PRETTY_FUNCTION__);\
+      libbalsa_unlock_mailbox (mailbox);\
+      return;\
+    }\
+} while (0)
+#define RETURN_VAL_IF_CONTEXT_CLOSED(mailbox, val)\
+do {\
+  if (MAILBOX_CLOSED (mailbox))\
+    {\
+      g_print (_("*** ERROR: Mailbox Stream Closed: %s ***\n"), __PRETTY_FUNCTION__);\
+      libbalsa_unlock_mailbox (mailbox);\
+      return (val);\
+    }\
+} while (0)
 
 
 typedef enum {
@@ -90,9 +90,9 @@ typedef enum {
 } LibBalsaMailboxSortType;
 
 typedef enum {
-    LIBBALSA_NTFY_INIT,
-    LIBBALSA_NTFY_UPDATE,
-    LIBBALSA_NTFY_FINISHED
+       LIBBALSA_NTFY_INIT,
+       LIBBALSA_NTFY_UPDATE,
+       LIBBALSA_NTFY_FINISHED
 } LibBalsaMailboxNotify;
 
 
@@ -118,8 +118,8 @@ typedef enum {
 } LibBalsaMailboxSubscribe;
 
 typedef enum {
-    LB_FETCH_RFC822_HEADERS = 1 << 0, /* prepare all rfc822 headers */
-        LB_FETCH_STRUCTURE = 1 << 1 /* prepare message structure */
+    LB_FETCH_RFC822_HEADERS = 1<<0, /* prepare all rfc822 headers */
+    LB_FETCH_STRUCTURE      = 1<<1  /* prepare message structure */
 } LibBalsaFetchFlag;
 
 typedef enum {
@@ -157,16 +157,16 @@ struct _LibBalsaMailboxView {
      * LibBalsaCondition to a GUI configuration is not always
      * possible.  Therefore, we provide this variable for GUI's
      * convinence.  */
-    int filter;
-    LibBalsaMailboxSortType sort_type;
-    LibBalsaMailboxSortFields sort_field;
-    LibBalsaMailboxSortFields sort_field_prev;
-    LibBalsaMailboxShow show;
-    LibBalsaMailboxSubscribe subscribe;
+    int      filter; 
+    LibBalsaMailboxSortType      sort_type;
+    LibBalsaMailboxSortFields    sort_field;
+    LibBalsaMailboxSortFields    sort_field_prev;
+    LibBalsaMailboxShow          show;
+    LibBalsaMailboxSubscribe     subscribe;
     gboolean exposed;
     gboolean open;
-    gboolean in_sync;           /* view is in sync with config */
-    gboolean used;              /* keep track of usage         */
+    gboolean in_sync;          /* view is in sync with config */
+    gboolean used;             /* keep track of usage         */
 
 #ifdef HAVE_GPGME
     LibBalsaChkCryptoMode gpg_chk_mode;
@@ -188,14 +188,14 @@ struct _LibBalsaMailbox {
     GObject object;
     gint stamp; /* used to determine iterators' validity. Increased on each
                  * modification of mailbox. */
-
+    
     gchar *config_prefix;       /* unique string identifying mailbox */
                                 /* in the config file                */
     gchar *name;                /* displayed name for a special mailbox; */
                                 /* Isn't it a GUI thing?                 */
     gchar *url; /* Unique resource locator, file://, imap:// etc */
     guint open_ref;
-
+    
     int lock; /* 0 if mailbox is unlocked; */
               /* >0 if mailbox is (recursively locked). */
     GThread *thread_id; /* id of thread that locked the mailbox */
@@ -207,12 +207,12 @@ struct _LibBalsaMailbox {
                          * displaying/columns of GtkTreeModel interface
                          * and NOTHING else. */
     GNode *msg_tree; /* the possibly filtered tree of messages;
-                     * gdk lock MUST BE HELD when accessing. */
+                      * gdk lock MUST BE HELD when accessing. */
     LibBalsaCondition *view_filter; /* to choose a subset of messages
                                      * to be displayed, e.g., only
                                      * undeleted. */
-    LibBalsaCondition *persistent_view_filter; /* the part of the view
-                                                * filter that will persist
+    LibBalsaCondition *persistent_view_filter; /* the part of the view 
+                                                * filter that will persist 
                                                 * to the next time the
                                                 * mailbox is opened */
     gboolean view_filter_pending;  /* a view filter has been set
@@ -225,7 +225,7 @@ struct _LibBalsaMailbox {
                             * used for automatical scrolling down on opening.
                             */
     /* Associated filters (struct mailbox_filter) */
-    GSList *filters;
+    GSList * filters;
     gboolean filters_loaded;
 
     LibBalsaMailboxView *view;
@@ -253,126 +253,106 @@ struct _LibBalsaMailboxSearchIter {
     gint stamp;
     LibBalsaMailbox *mailbox;
     LibBalsaCondition *condition;
-    gpointer user_data;         /* private backend info */
+    gpointer user_data;                /* private backend info */
 };
 
 /** Iterates over a list of messages, returning each time it is called
     flags and the stream to a message. It is the responsibility of the
     called to un-ref the stream after use. */
 typedef gboolean (*LibBalsaAddMessageIterator)(LibBalsaMessageFlag *,
-                                               GMimeStream **stream,
-                                               void *);
+                                              GMimeStream **stream,
+                                              void *);
 
 struct _LibBalsaMailboxClass {
     GObjectClass parent_class;
 
     /* Signals */
-    void (*changed) (LibBalsaMailbox *mailbox);
-    void (*message_expunged) (LibBalsaMailbox *mailbox,
-                              guint            seqno);
-    void (*progress_notify) (LibBalsaMailbox *mailbox,
-                             gint             action,
-                             gdouble          fraction,
-                             gchar           *message);
+    void (*changed) (LibBalsaMailbox * mailbox);
+    void (*message_expunged) (LibBalsaMailbox * mailbox, guint seqno);
+    void (*progress_notify) (LibBalsaMailbox * mailbox, gint action, gdouble fraction, gchar *message);
 
     /* Virtual Functions */
-    gboolean (*open_mailbox) (LibBalsaMailbox *mailbox,
-                              GError         **err);
-    void (*close_mailbox) (LibBalsaMailbox *mailbox,
-                           gboolean         expunge);
-    LibBalsaMessage *(*get_message) (LibBalsaMailbox *mailbox,
-                                     guint            msgno);
-    gboolean (*prepare_threading)(LibBalsaMailbox *mailbox,
-                                  guint            start);
-    gboolean (*fetch_message_structure)(LibBalsaMailbox  *mailbox,
-                                        LibBalsaMessage  *message,
+    gboolean (*open_mailbox) (LibBalsaMailbox * mailbox, GError **err);
+    void (*close_mailbox) (LibBalsaMailbox * mailbox, gboolean expunge);
+    LibBalsaMessage *(*get_message) (LibBalsaMailbox * mailbox, guint msgno);
+    gboolean (*prepare_threading)(LibBalsaMailbox *mailbox, guint start);
+    gboolean (*fetch_message_structure)(LibBalsaMailbox *mailbox,
+                                        LibBalsaMessage * message,
                                         LibBalsaFetchFlag flags);
     void (*fetch_headers)(LibBalsaMailbox *mailbox,
-                          LibBalsaMessage *message);
-    void (*release_message) (LibBalsaMailbox *mailbox,
-                             LibBalsaMessage *message);
-    gboolean (*get_message_part) (LibBalsaMessage     *message,
-                                  LibBalsaMessageBody *part,
-                                  GError             **err);
-    GMimeStream *(*get_message_stream) (LibBalsaMailbox *mailbox,
-                                        guint            msgno,
-                                        gboolean         peek);
-
-    void (*check) (LibBalsaMailbox *mailbox);
-
-    void (*search_iter_free) (LibBalsaMailboxSearchIter *iter);
-    gboolean (*message_match) (LibBalsaMailbox           *mailbox,
-                               guint                      msgno,
-                               LibBalsaMailboxSearchIter *search_iter);
-    gboolean (*can_match) (LibBalsaMailbox   *mailbox,
-                           LibBalsaCondition *condition);
-    void (*save_config) (LibBalsaMailbox *mailbox,
-                         const gchar     *prefix);
-    void (*load_config) (LibBalsaMailbox *mailbox,
-                         const gchar     *prefix);
-    gboolean (*sync) (LibBalsaMailbox *mailbox,
-                      gboolean         expunge);
-    guint (*add_messages) (LibBalsaMailbox           *mailbox,
-                           LibBalsaAddMessageIterator msg_iterator,
-                           void                      *iter_arg,
-                           GError                   **err);
-    gboolean (*messages_change_flags) (LibBalsaMailbox    *mailbox,
-                                       GArray             *msgnos,
-                                       LibBalsaMessageFlag set,
-                                       LibBalsaMessageFlag clear);
-    gboolean (*messages_copy) (LibBalsaMailbox *mailbox,
-                               GArray          *msgnos,
-                               LibBalsaMailbox *dest,
-                               GError         **err);
+                          LibBalsaMessage * message);
+    void (*release_message) (LibBalsaMailbox * mailbox,
+                            LibBalsaMessage * message);
+    gboolean (*get_message_part) (LibBalsaMessage *message,
+                                 LibBalsaMessageBody *part,
+                                  GError **err);
+    GMimeStream *(*get_message_stream) (LibBalsaMailbox * mailbox,
+                                        guint msgno, gboolean peek);
+
+    void (*check) (LibBalsaMailbox * mailbox);
+
+    void (*search_iter_free) (LibBalsaMailboxSearchIter * iter);
+    gboolean (*message_match) (LibBalsaMailbox * mailbox,
+                              guint msgno,
+                              LibBalsaMailboxSearchIter *search_iter);
+    gboolean (*can_match) (LibBalsaMailbox * mailbox,
+                          LibBalsaCondition *condition);
+    void (*save_config) (LibBalsaMailbox * mailbox, const gchar * prefix);
+    void (*load_config) (LibBalsaMailbox * mailbox, const gchar * prefix);
+    gboolean (*sync) (LibBalsaMailbox * mailbox, gboolean expunge);
+    guint (*add_messages) (LibBalsaMailbox * mailbox,
+                          LibBalsaAddMessageIterator msg_iterator,
+                          void *iter_arg, GError ** err);
+    gboolean (*messages_change_flags) (LibBalsaMailbox * mailbox,
+                                      GArray *msgnos,
+                                      LibBalsaMessageFlag set,
+                                      LibBalsaMessageFlag clear);
+    gboolean (*messages_copy) (LibBalsaMailbox * mailbox, GArray *msgnos,
+                              LibBalsaMailbox * dest, GError **err);
     /* Test message flags */
-    gboolean (*msgno_has_flags) (LibBalsaMailbox    *mailbox,
-                                 guint               msgno,
-                                 LibBalsaMessageFlag set,
-                                 LibBalsaMessageFlag unset);
+    gboolean(*msgno_has_flags) (LibBalsaMailbox * mailbox, guint msgno,
+                                LibBalsaMessageFlag set,
+                                LibBalsaMessageFlag unset);
 
-    gboolean (*can_do) (LibBalsaMailbox               *mailbox,
+    gboolean (*can_do) (LibBalsaMailbox *mailbox,
                         enum LibBalsaMailboxCapability cap);
-    void (*set_threading) (LibBalsaMailbox             *mailbox,
-                           LibBalsaMailboxThreadingType thread_type);
-    void (*update_view_filter) (LibBalsaMailbox   *mailbox,
+    void (*set_threading) (LibBalsaMailbox * mailbox,
+                          LibBalsaMailboxThreadingType thread_type);
+    void (*update_view_filter) (LibBalsaMailbox * mailbox,
                                 LibBalsaCondition *view_filter);
-    void (*sort) (LibBalsaMailbox *mailbox,
-                  GArray          *sort_array);
-    gboolean (*close_backend)(LibBalsaMailbox *mailbox);
-    guint (*total_messages)(LibBalsaMailbox *mailbox);
-    GArray *(*duplicate_msgnos) (LibBalsaMailbox *mailbox);
-    void (*lock_store) (LibBalsaMailbox *mailbox,
-                        gboolean         lock);
-    void (*test_can_reach) (LibBalsaMailbox          *mailbox,
-                            LibBalsaCanReachCallback *cb,
-                            gpointer                  cb_data);
+    void (*sort) (LibBalsaMailbox * mailbox, GArray *sort_array);
+    gboolean (*close_backend)(LibBalsaMailbox * mailbox);
+    guint (*total_messages)(LibBalsaMailbox * mailbox);
+    GArray *(*duplicate_msgnos) (LibBalsaMailbox * mailbox);
+    void (*lock_store) (LibBalsaMailbox * mailbox, gboolean lock);
+    void (*test_can_reach) (LibBalsaMailbox          * mailbox,
+                            LibBalsaCanReachCallback * cb,
+                            gpointer                   cb_data);
 };
 
 GType libbalsa_mailbox_get_type(void);
 
-LibBalsaMailbox *libbalsa_mailbox_new_from_config(const gchar *prefix);
+LibBalsaMailbox *libbalsa_mailbox_new_from_config(const gchar * prefix);
 
-/*
- * open and close a mailbox
+/* 
+ * open and close a mailbox 
  */
 /* XXX these need to return a value if they failed */
-gboolean libbalsa_mailbox_open(LibBalsaMailbox *mailbox,
-                               GError         **err);
-gboolean libbalsa_mailbox_is_valid(LibBalsaMailbox *mailbox);
+gboolean libbalsa_mailbox_open(LibBalsaMailbox * mailbox, GError **err);
+gboolean libbalsa_mailbox_is_valid(LibBalsaMailbox * mailbox);
 gboolean libbalsa_mailbox_is_open(LibBalsaMailbox *mailbox);
-void libbalsa_mailbox_close(LibBalsaMailbox *mailbox,
-                            gboolean         expunge);
-
-void libbalsa_mailbox_check(LibBalsaMailbox *mailbox);
-void libbalsa_mailbox_changed(LibBalsaMailbox *mailbox);
-void libbalsa_mailbox_set_unread_messages_flag(LibBalsaMailbox *mailbox,
-                                               gboolean         has_unread);
-void libbalsa_mailbox_progress_notify(LibBalsaMailbox      *mailbox,
-                                      LibBalsaMailboxNotify action,
-                                      gdouble               fraction,
-                                      const gchar          *message,
-                                      ...)
-G_GNUC_PRINTF(4, 5);
+void libbalsa_mailbox_close(LibBalsaMailbox * mailbox, gboolean expunge);
+
+void libbalsa_mailbox_check(LibBalsaMailbox * mailbox);
+void libbalsa_mailbox_changed(LibBalsaMailbox * mailbox);
+void libbalsa_mailbox_set_unread_messages_flag(LibBalsaMailbox * mailbox,
+                                              gboolean has_unread);
+void libbalsa_mailbox_progress_notify(LibBalsaMailbox       *mailbox,
+                                                                         LibBalsaMailboxNotify  action,
+                                                                         gdouble                        
fraction,
+                                                                         const gchar           *message,
+                                                                         ...)
+       G_GNUC_PRINTF(4, 5);
 
 /** Message access functions.
  */
@@ -383,22 +363,22 @@ G_GNUC_PRINTF(4, 5);
     produce message index unless more information was requested to be
     prefetched.
  */
-LibBalsaMessage *libbalsa_mailbox_get_message(LibBalsaMailbox *mailbox,
-                                              guint            msgno);
+LibBalsaMessage *libbalsa_mailbox_get_message(LibBalsaMailbox * mailbox,
+                                             guint msgno);
 
 /** libbalsa_mailbox_prepare_threading() requests prefetching of information
     needed for client-side message threading.
     msgnos are related to currently set view.
     Returns TRUE if successful; FALSE may mean that the mailbox was
     closed during the operation.
- */
-gboolean libbalsa_mailbox_prepare_threading(LibBalsaMailbox *mailbox,
-                                            guint            start);
+*/
+gboolean libbalsa_mailbox_prepare_threading(LibBalsaMailbox * mailbox,
+                                            guint start);
 
 /** libbalsa_mailbox_fetch_message_structure() fetches detailed
     message structure for given message. It can also fetch all RFC822
     headers of the message.
- */
+*/
 gboolean libbalsa_mailbox_fetch_message_structure(LibBalsaMailbox *
                                                   mailbox,
                                                   LibBalsaMessage *
@@ -409,26 +389,25 @@ gboolean libbalsa_mailbox_fetch_message_structure(LibBalsaMailbox *
     content and structure are no longer needed. It's passed to the
     maildir and mh backends to unref the mime_message, but is a noop
     for other backends.
- */
-void libbalsa_mailbox_release_message(LibBalsaMailbox *mailbox,
-                                      LibBalsaMessage *message);
+*/
+void libbalsa_mailbox_release_message(LibBalsaMailbox * mailbox,
+                                     LibBalsaMessage * message);
 
-void libbalsa_mailbox_set_msg_headers(LibBalsaMailbox *mailbox,
-                                      LibBalsaMessage *message);
+void libbalsa_mailbox_set_msg_headers(LibBalsaMailbox * mailbox,
+                                     LibBalsaMessage * message);
 
 /** libbalsa_mailbox_get_message_part() ensures that a selected, single
     part of the message is loaded.
- */
-gboolean libbalsa_mailbox_get_message_part(LibBalsaMessage     *message,
-                                           LibBalsaMessageBody *part,
-                                           GError             **err);
+*/
+gboolean libbalsa_mailbox_get_message_part(LibBalsaMessage    *message,
+                                          LibBalsaMessageBody *part,
+                                           GError **err);
 
 /** libbalsa_mailbox_get_message_stream() returns a message stream associated
     with full RFC822 text of the message.
- */
-GMimeStream *libbalsa_mailbox_get_message_stream(LibBalsaMailbox *mailbox,
-                                                 guint            msgno,
-                                                 gboolean         peek);
+*/
+GMimeStream *libbalsa_mailbox_get_message_stream(LibBalsaMailbox * mailbox,
+                                                guint msgno, gboolean peek);
 
 
 /** libbalsa_mailbox_sync_storage() asks the mailbox to synchronise
@@ -436,101 +415,98 @@ GMimeStream *libbalsa_mailbox_get_message_stream(LibBalsaMailbox *mailbox,
     update storage immediately and for them this operation may be
     no-op. When expunge is set, driver is supposed to clean up the mailbox,
     including physical removal of old deleted messages.
- */
+*/
 
-gboolean libbalsa_mailbox_sync_storage(LibBalsaMailbox *mailbox,
-                                       gboolean         expunge);
+gboolean libbalsa_mailbox_sync_storage(LibBalsaMailbox * mailbox,
+                                       gboolean expunge);
 
 /* This function returns TRUE if the mailbox can be matched
    against the given filters (eg : IMAP mailbox can't
    use the SEARCH IMAP command for regex match, so the
    match is done via default filtering funcs->can be slow)
  */
-gboolean libbalsa_mailbox_can_match(LibBalsaMailbox   *mailbox,
-                                    LibBalsaCondition *condition);
-gboolean libbalsa_mailbox_message_match(LibBalsaMailbox           *mailbox,
-                                        guint                      msgno,
-                                        LibBalsaMailboxSearchIter *search_iter);
+gboolean libbalsa_mailbox_can_match(LibBalsaMailbox  *mailbox,
+                                   LibBalsaCondition *condition);
+gboolean libbalsa_mailbox_message_match(LibBalsaMailbox  *mailbox,
+                                       guint msgno,
+                                       LibBalsaMailboxSearchIter *search_iter);
 
 /* Search iter */
 LibBalsaMailboxSearchIter
-*libbalsa_mailbox_search_iter_new(LibBalsaCondition *condition);
+    *libbalsa_mailbox_search_iter_new(LibBalsaCondition * condition);
 LibBalsaMailboxSearchIter
-*libbalsa_mailbox_search_iter_view(LibBalsaMailbox *mailbox);
+    *libbalsa_mailbox_search_iter_view(LibBalsaMailbox * mailbox);
 LibBalsaMailboxSearchIter
-*libbalsa_mailbox_search_iter_ref(LibBalsaMailboxSearchIter *iter);
-void libbalsa_mailbox_search_iter_unref(LibBalsaMailboxSearchIter *iter);
-gboolean libbalsa_mailbox_search_iter_step(LibBalsaMailbox *mailbox,
-                                           LibBalsaMailboxSearchIter
-                                                           *search_iter,
-                                           GtkTreeIter     *iter,
-                                           gboolean         forward,
-                                           guint            stop_msgno);
+    *libbalsa_mailbox_search_iter_ref(LibBalsaMailboxSearchIter * iter);
+void libbalsa_mailbox_search_iter_unref(LibBalsaMailboxSearchIter * iter);
+gboolean libbalsa_mailbox_search_iter_step(LibBalsaMailbox * mailbox,
+                                          LibBalsaMailboxSearchIter 
+                                          * search_iter,
+                                          GtkTreeIter * iter,
+                                          gboolean forward,
+                                          guint stop_msgno);
 
 /* Default filtering function (on reception)
    It is ONLY FOR INTERNAL USE
- */
-void libbalsa_mailbox_run_filters_on_reception(LibBalsaMailbox *mailbox);
+*/
+void libbalsa_mailbox_run_filters_on_reception(LibBalsaMailbox * mailbox);
 
-void libbalsa_mailbox_save_config(LibBalsaMailbox *mailbox,
-                                  const gchar     *prefix);
+void libbalsa_mailbox_save_config(LibBalsaMailbox * mailbox,
+                                 const gchar * prefix);
 
-gboolean libbalsa_mailbox_add_message(LibBalsaMailbox    *mailbox,
-                                      GMimeStream        *stream,
+gboolean libbalsa_mailbox_add_message(LibBalsaMailbox * mailbox,
+                                      GMimeStream * stream,
                                       LibBalsaMessageFlag flags,
-                                      GError            **err);
+                                      GError ** err);
 
-guint libbalsa_mailbox_add_messages(LibBalsaMailbox           *mailbox,
-                                    LibBalsaAddMessageIterator msg_iterator,
-                                    void                      *arg,
-                                    GError                   **err);
+guint libbalsa_mailbox_add_messages(LibBalsaMailbox * mailbox,
+                                   LibBalsaAddMessageIterator msg_iterator,
+                                   void *arg,
+                                   GError ** err);
 
-gboolean libbalsa_mailbox_close_backend(LibBalsaMailbox *mailbox);
+gboolean libbalsa_mailbox_close_backend(LibBalsaMailbox * mailbox);
 
 /* Message number-list methods */
-gboolean libbalsa_mailbox_messages_change_flags(LibBalsaMailbox    *mailbox,
-                                                GArray             *msgnos,
-                                                LibBalsaMessageFlag set,
-                                                LibBalsaMessageFlag clear);
-gboolean libbalsa_mailbox_messages_copy(LibBalsaMailbox *mailbox,
-                                        GArray          *msgnos,
-                                        LibBalsaMailbox *dest,
-                                        GError         **err);
-gboolean libbalsa_mailbox_messages_move(LibBalsaMailbox *mailbox,
-                                        GArray          *msgnos,
-                                        LibBalsaMailbox *dest,
-                                        GError         **err);
+gboolean libbalsa_mailbox_messages_change_flags(LibBalsaMailbox * mailbox,
+                                               GArray * msgnos,
+                                               LibBalsaMessageFlag set,
+                                               LibBalsaMessageFlag clear);
+gboolean libbalsa_mailbox_messages_copy(LibBalsaMailbox * mailbox,
+                                       GArray * msgnos,
+                                       LibBalsaMailbox * dest, GError **err);
+gboolean libbalsa_mailbox_messages_move(LibBalsaMailbox * mailbox,
+                                       GArray * msgnos,
+                                       LibBalsaMailbox * dest, GError **err);
 
 /*
  * misc mailbox releated functions
  */
-GType libbalsa_mailbox_type_from_path(const gchar *filename);
+GType libbalsa_mailbox_type_from_path(const gchar * filename);
 
-guint libbalsa_mailbox_total_messages(LibBalsaMailbox *mailbox);
-gboolean libbalsa_mailbox_can_move_duplicates(LibBalsaMailbox *mailbox);
-gint libbalsa_mailbox_move_duplicates(LibBalsaMailbox *mailbox,
-                                      LibBalsaMailbox *dest,
-                                      GError         **err);
+guint libbalsa_mailbox_total_messages(LibBalsaMailbox * mailbox);
+gboolean libbalsa_mailbox_can_move_duplicates(LibBalsaMailbox * mailbox);
+gint libbalsa_mailbox_move_duplicates(LibBalsaMailbox * mailbox,
+                                      LibBalsaMailbox * dest,
+                                      GError ** err);
 
 /*
  * Mailbox views-related functions.
  */
 typedef struct LibBalsaMailboxIndexEntry_ LibBalsaMailboxIndexEntry;
 void libbalsa_mailbox_index_entry_set_no(LibBalsaMailboxIndexEntry *entry,
-                                         unsigned                   no);
-void libbalsa_mailbox_index_entry_clear(LibBalsaMailbox *mailbox,
-                                        guint            msgno);
-void libbalsa_mailbox_index_set_flags(LibBalsaMailbox    *mailbox,
-                                      unsigned            msgno,
-                                      LibBalsaMessageFlag f);
-gboolean libbalsa_mailbox_set_view_filter(LibBalsaMailbox *mailbox,
+                                         unsigned no);
+void libbalsa_mailbox_index_entry_clear(LibBalsaMailbox * mailbox,
+                                        guint msgno);
+void libbalsa_mailbox_index_set_flags(LibBalsaMailbox *mailbox,
+                                     unsigned msgno, LibBalsaMessageFlag f);
+gboolean libbalsa_mailbox_set_view_filter(LibBalsaMailbox * mailbox,
                                           LibBalsaCondition *
                                           filter_condition,
-                                          gboolean         update_immediately);
+                                          gboolean update_immediately);
 void libbalsa_mailbox_make_view_filter_persistent(LibBalsaMailbox *
                                                   mailbox);
 
-gboolean libbalsa_mailbox_can_do(LibBalsaMailbox               *mailbox,
+gboolean libbalsa_mailbox_can_do(LibBalsaMailbox *mailbox,
                                  enum LibBalsaMailboxCapability cap);
 
 /** libbalsa_mailbox_set_threading() uses backend-optimized threading mode
@@ -539,161 +515,142 @@ gboolean libbalsa_mailbox_can_do(LibBalsaMailbox               *mailbox,
     libbalsa_mailbox_set_threading() is the public method;
     libbalsa_mailbox_set_msg_tree and libbalsa_mailbox_unlink_and_prepend
     are helpers for the subclass methods.
- */
-void libbalsa_mailbox_set_threading(LibBalsaMailbox             *mailbox,
-                                    LibBalsaMailboxThreadingType thread_type);
-void libbalsa_mailbox_set_msg_tree(LibBalsaMailbox *mailbox,
-                                   GNode           *msg_tree);
-void libbalsa_mailbox_unlink_and_prepend(LibBalsaMailbox *mailbox,
-                                         GNode           *node,
-                                         GNode           *parent);
+*/
+void libbalsa_mailbox_set_threading(LibBalsaMailbox *mailbox,
+                                   LibBalsaMailboxThreadingType thread_type);
+void libbalsa_mailbox_set_msg_tree(LibBalsaMailbox * mailbox,
+                                  GNode * msg_tree);
+void libbalsa_mailbox_unlink_and_prepend(LibBalsaMailbox * mailbox,
+                                        GNode * node, GNode * parent);
 
 /* Mailbox views. */
 LibBalsaMailboxView *libbalsa_mailbox_view_new(void);
-void libbalsa_mailbox_view_free(LibBalsaMailboxView *view);
-gboolean libbalsa_mailbox_set_identity_name(LibBalsaMailbox *mailbox,
-                                            const gchar     *identity_name);
-void libbalsa_mailbox_set_threading_type(LibBalsaMailbox *mailbox,
-                                         LibBalsaMailboxThreadingType
-                                         threading_type);
-void libbalsa_mailbox_set_sort_type(LibBalsaMailbox        *mailbox,
-                                    LibBalsaMailboxSortType sort_type);
-void libbalsa_mailbox_set_sort_field(LibBalsaMailbox          *mailbox,
-                                     LibBalsaMailboxSortFields sort_field);
-gboolean libbalsa_mailbox_set_show(LibBalsaMailbox    *mailbox,
-                                   LibBalsaMailboxShow show);
-gboolean libbalsa_mailbox_set_subscribe(LibBalsaMailbox *mailbox,
+void libbalsa_mailbox_view_free(LibBalsaMailboxView * view);
+gboolean libbalsa_mailbox_set_identity_name(LibBalsaMailbox * mailbox,
+                                           const gchar * identity_name);
+void libbalsa_mailbox_set_threading_type(LibBalsaMailbox * mailbox,
+                                        LibBalsaMailboxThreadingType
+                                        threading_type);
+void libbalsa_mailbox_set_sort_type(LibBalsaMailbox * mailbox,
+                                   LibBalsaMailboxSortType sort_type);
+void libbalsa_mailbox_set_sort_field(LibBalsaMailbox * mailbox,
+                                    LibBalsaMailboxSortFields sort_field);
+gboolean libbalsa_mailbox_set_show(LibBalsaMailbox * mailbox,
+                                  LibBalsaMailboxShow show);
+gboolean libbalsa_mailbox_set_subscribe(LibBalsaMailbox * mailbox,
                                         LibBalsaMailboxSubscribe
                                         subscribe);
-void libbalsa_mailbox_set_exposed(LibBalsaMailbox *mailbox,
-                                  gboolean         exposed);
-void libbalsa_mailbox_set_open(LibBalsaMailbox *mailbox,
-                               gboolean         open);
-void libbalsa_mailbox_set_filter(LibBalsaMailbox *mailbox,
-                                 gint             filter);
-
+void libbalsa_mailbox_set_exposed(LibBalsaMailbox * mailbox,
+                                 gboolean exposed);
+void libbalsa_mailbox_set_open(LibBalsaMailbox * mailbox, gboolean open);
+void libbalsa_mailbox_set_filter(LibBalsaMailbox * mailbox, gint filter);
 #ifdef HAVE_GPGME
-gboolean libbalsa_mailbox_set_crypto_mode(LibBalsaMailbox      *mailbox,
-                                          LibBalsaChkCryptoMode gpg_chk_mode);
-
+gboolean libbalsa_mailbox_set_crypto_mode(LibBalsaMailbox * mailbox,
+                                         LibBalsaChkCryptoMode gpg_chk_mode);
 #endif
-void libbalsa_mailbox_set_unread(LibBalsaMailbox *mailbox,
-                                 gint             unread);
-void libbalsa_mailbox_set_total(LibBalsaMailbox *mailbox,
-                                gint             total);
-void libbalsa_mailbox_set_mtime(LibBalsaMailbox *mailbox,
-                                time_t           mtime);
-
-const gchar *libbalsa_mailbox_get_identity_name(LibBalsaMailbox *mailbox);
-LibBalsaMailboxThreadingType libbalsa_mailbox_get_threading_type(LibBalsaMailbox *mailbox);
+void libbalsa_mailbox_set_unread(LibBalsaMailbox * mailbox, gint unread);
+void libbalsa_mailbox_set_total (LibBalsaMailbox * mailbox, gint total);
+void libbalsa_mailbox_set_mtime (LibBalsaMailbox * mailbox, time_t mtime);
+
+const gchar *libbalsa_mailbox_get_identity_name(LibBalsaMailbox * mailbox);
+LibBalsaMailboxThreadingType
+libbalsa_mailbox_get_threading_type(LibBalsaMailbox * mailbox);
 LibBalsaMailboxSortType libbalsa_mailbox_get_sort_type(LibBalsaMailbox *
-                                                       mailbox);
+                                                      mailbox);
 LibBalsaMailboxSortFields libbalsa_mailbox_get_sort_field(LibBalsaMailbox *
-                                                          mailbox);
-LibBalsaMailboxShow libbalsa_mailbox_get_show(LibBalsaMailbox *mailbox);
+                                                         mailbox);
+LibBalsaMailboxShow libbalsa_mailbox_get_show(LibBalsaMailbox * mailbox);
 LibBalsaMailboxSubscribe libbalsa_mailbox_get_subscribe(LibBalsaMailbox *
                                                         mailbox);
-gboolean libbalsa_mailbox_get_exposed(LibBalsaMailbox *mailbox);
-gboolean libbalsa_mailbox_get_open(LibBalsaMailbox *mailbox);
-gint libbalsa_mailbox_get_filter(LibBalsaMailbox *mailbox);
-
+gboolean libbalsa_mailbox_get_exposed(LibBalsaMailbox * mailbox);
+gboolean libbalsa_mailbox_get_open(LibBalsaMailbox * mailbox);
+gint libbalsa_mailbox_get_filter(LibBalsaMailbox * mailbox);
 #ifdef HAVE_GPGME
-LibBalsaChkCryptoMode libbalsa_mailbox_get_crypto_mode(LibBalsaMailbox *mailbox);
-
+LibBalsaChkCryptoMode libbalsa_mailbox_get_crypto_mode(LibBalsaMailbox * mailbox);
 #endif
-gint libbalsa_mailbox_get_unread(LibBalsaMailbox *mailbox);
-gint libbalsa_mailbox_get_total(LibBalsaMailbox *mailbox);
-time_t libbalsa_mailbox_get_mtime(LibBalsaMailbox *mailbox);
+gint libbalsa_mailbox_get_unread(LibBalsaMailbox * mailbox);
+gint libbalsa_mailbox_get_total (LibBalsaMailbox * mailbox);
+time_t libbalsa_mailbox_get_mtime(LibBalsaMailbox * mailbox);
 
 /** force update of given msgno */
-void libbalsa_mailbox_msgno_changed(LibBalsaMailbox *mailbox,
-                                    guint            seqno);
-void libbalsa_mailbox_msgno_inserted(LibBalsaMailbox *mailbox,
-                                     guint            seqno,
-                                     GNode           *parent,
-                                     GNode          **sibling);
-void libbalsa_mailbox_msgno_removed(LibBalsaMailbox *mailbox,
-                                    guint            seqno);
-void libbalsa_mailbox_msgno_filt_check(LibBalsaMailbox *mailbox,
-                                       guint            seqno,
-                                       LibBalsaMailboxSearchIter
-                                                       *search_iter,
-                                       gboolean         hold_selected);
+void libbalsa_mailbox_msgno_changed(LibBalsaMailbox  *mailbox, guint seqno);
+void libbalsa_mailbox_msgno_inserted(LibBalsaMailbox * mailbox,
+                                     guint seqno, GNode * parent,
+                                     GNode ** sibling);
+void libbalsa_mailbox_msgno_removed(LibBalsaMailbox  *mailbox, guint seqno);
+void libbalsa_mailbox_msgno_filt_check(LibBalsaMailbox * mailbox,
+                                      guint seqno,
+                                      LibBalsaMailboxSearchIter
+                                      * search_iter,
+                                      gboolean hold_selected);
 
 /* Search */
-gboolean libbalsa_mailbox_msgno_find(LibBalsaMailbox *mailbox,
-                                     guint            seqno,
-                                     GtkTreePath    **path,
-                                     GtkTreeIter     *iter);
-
+gboolean libbalsa_mailbox_msgno_find(LibBalsaMailbox * mailbox,
+                                    guint seqno,
+                                    GtkTreePath ** path,
+                                    GtkTreeIter * iter);
 /* Manage message flags */
-gboolean libbalsa_mailbox_msgno_change_flags(LibBalsaMailbox    *mailbox,
-                                             guint               msgno,
+gboolean libbalsa_mailbox_msgno_change_flags(LibBalsaMailbox * mailbox,
+                                             guint msgno,
                                              LibBalsaMessageFlag set,
                                              LibBalsaMessageFlag clear);
-
 /* Test message flags */
-gboolean libbalsa_mailbox_msgno_has_flags(LibBalsaMailbox    *mailbox,
-                                          guint               seqno,
+gboolean libbalsa_mailbox_msgno_has_flags(LibBalsaMailbox * mailbox,
+                                          guint seqno,
                                           LibBalsaMessageFlag set,
                                           LibBalsaMessageFlag unset);
 
 /* set icons */
-void libbalsa_mailbox_set_unread_icon(GdkPixbuf *pixbuf);
-void libbalsa_mailbox_set_trash_icon(GdkPixbuf *pixbuf);
-void libbalsa_mailbox_set_flagged_icon(GdkPixbuf *pixbuf);
-void libbalsa_mailbox_set_replied_icon(GdkPixbuf *pixbuf);
-void libbalsa_mailbox_set_attach_icon(GdkPixbuf *pixbuf);
-
+void libbalsa_mailbox_set_unread_icon(GdkPixbuf * pixbuf);
+void libbalsa_mailbox_set_trash_icon(GdkPixbuf * pixbuf);
+void libbalsa_mailbox_set_flagged_icon(GdkPixbuf * pixbuf);
+void libbalsa_mailbox_set_replied_icon(GdkPixbuf * pixbuf);
+void libbalsa_mailbox_set_attach_icon(GdkPixbuf * pixbuf);
 #ifdef HAVE_GPGME
-void libbalsa_mailbox_set_good_icon(GdkPixbuf *pixbuf);
-void libbalsa_mailbox_set_notrust_icon(GdkPixbuf *pixbuf);
-void libbalsa_mailbox_set_bad_icon(GdkPixbuf *pixbuf);
-void libbalsa_mailbox_set_sign_icon(GdkPixbuf *pixbuf);
-void libbalsa_mailbox_set_encr_icon(GdkPixbuf *pixbuf);
-
+void libbalsa_mailbox_set_good_icon(GdkPixbuf * pixbuf);
+void libbalsa_mailbox_set_notrust_icon(GdkPixbuf * pixbuf);
+void libbalsa_mailbox_set_bad_icon(GdkPixbuf * pixbuf);
+void libbalsa_mailbox_set_sign_icon(GdkPixbuf * pixbuf);
+void libbalsa_mailbox_set_encr_icon(GdkPixbuf * pixbuf);
 #endif /* HAVE_GPGME */
 
 /* Partial messages */
-void libbalsa_mailbox_try_reassemble(LibBalsaMailbox *mailbox,
-                                     const gchar     *id);
+void libbalsa_mailbox_try_reassemble(LibBalsaMailbox * mailbox,
+                                    const gchar * id);
 
 /* Message numbers and arrays */
-void libbalsa_mailbox_register_msgnos(LibBalsaMailbox *mailbox,
-                                      GArray          *msgnos);
-void libbalsa_mailbox_unregister_msgnos(LibBalsaMailbox *mailbox,
-                                        GArray          *msgnos);
+void libbalsa_mailbox_register_msgnos(LibBalsaMailbox * mailbox,
+                                     GArray * msgnos);
+void libbalsa_mailbox_unregister_msgnos(LibBalsaMailbox * mailbox,
+                                       GArray * msgnos);
 
 /* Accessors for LibBalsaMailboxIndexEntry */
 LibBalsaMessageStatus libbalsa_mailbox_msgno_get_status(LibBalsaMailbox *
-                                                        mailbox,
-                                                        guint msgno);
-const gchar *libbalsa_mailbox_msgno_get_subject(LibBalsaMailbox *mailbox,
-                                                guint            msgno);
-void libbalsa_mailbox_msgno_update_attach(LibBalsaMailbox *mailbox,
-                                          guint            msgno,
-                                          LibBalsaMessage *message);
-void libbalsa_mailbox_cache_message(LibBalsaMailbox *mailbox,
-                                    guint            msgno,
-                                    LibBalsaMessage *message);
+                                                       mailbox,
+                                                       guint msgno);
+const gchar *libbalsa_mailbox_msgno_get_subject(LibBalsaMailbox * mailbox,
+                                               guint msgno);
+void libbalsa_mailbox_msgno_update_attach(LibBalsaMailbox * mailbox,
+                                         guint msgno,
+                                         LibBalsaMessage * message);
+void libbalsa_mailbox_cache_message(LibBalsaMailbox * mailbox, guint msgno,
+                                    LibBalsaMessage * message);
 
 /* Set the foreground and background colors of an array of messages */
-void libbalsa_mailbox_set_foreground(LibBalsaMailbox *mailbox,
-                                     GArray          *msgnos,
-                                     const gchar     *color);
-void libbalsa_mailbox_set_background(LibBalsaMailbox *mailbox,
-                                     GArray          *msgnos,
-                                     const gchar     *color);
+void libbalsa_mailbox_set_foreground(LibBalsaMailbox * mailbox,
+                                     GArray * msgnos, const gchar * color);
+void libbalsa_mailbox_set_background(LibBalsaMailbox * mailbox,
+                                     GArray * msgnos, const gchar * color);
 
 /* Lock and unlock the mail store--currently, a no-op except for mbox.
  */
-void libbalsa_mailbox_lock_store(LibBalsaMailbox *mailbox);
-void libbalsa_mailbox_unlock_store(LibBalsaMailbox *mailbox);
+void libbalsa_mailbox_lock_store  (LibBalsaMailbox * mailbox);
+void libbalsa_mailbox_unlock_store(LibBalsaMailbox * mailbox);
 
 /* Check whether a mailbox can be reached */
-void libbalsa_mailbox_test_can_reach(LibBalsaMailbox          *mailbox,
-                                     LibBalsaCanReachCallback *cb,
-                                     gpointer                  cb_data);
+void libbalsa_mailbox_test_can_reach(LibBalsaMailbox          * mailbox,
+                                     LibBalsaCanReachCallback * cb,
+                                     gpointer                   cb_data);
 
 /* columns ids */
 typedef enum {
@@ -715,4 +672,4 @@ typedef enum {
 
 extern gchar **libbalsa_mailbox_date_format;
 
-#endif                          /* __LIBBALSA_MAILBOX_H__ */
+#endif                         /* __LIBBALSA_MAILBOX_H__ */
diff --git a/libbalsa/mailbox_imap.c b/libbalsa/mailbox_imap.c
index 81bf096..2bbb8ed 100644
--- a/libbalsa/mailbox_imap.c
+++ b/libbalsa/mailbox_imap.c
@@ -5,29 +5,29 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /* NOTES:
 
-   CACHING: persistent cache is implemented using a directory.
+   CACHING: persistent cache is implemented using a directory. 
 
    CONNECTIONS: there is always one connection per opened mailbox to
    keep track of untagged responses. Understand idea of untagged
    responses particularly for shared mailboxes before you try messing
    with this.
- */
+*/
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 
@@ -63,19 +63,19 @@
 struct _LibBalsaMailboxImap {
     LibBalsaMailboxRemote mailbox;
     ImapMboxHandle *handle;     /* stream that has this mailbox selected */
-    guint handle_refs;          /* reference counter */
-    gint search_stamp;          /* search result validator */
+    guint handle_refs;         /* reference counter */
+    gint search_stamp;         /* search result validator */
 
-    gchar *path;                /* Imap local path (third part of URL) */
-    ImapUID uid_validity;
+    gchar *path;               /* Imap local path (third part of URL) */
+    ImapUID      uid_validity;
 
-    GArray *messages_info;
+    GArray* messages_info;
     GPtrArray *msgids; /* message-ids */
 
     GArray *sort_ranks;
     guint unread_update_id;
     LibBalsaMailboxSortFields sort_field;
-    unsigned opened : 1;
+    unsigned opened:1;
 
     ImapAclType rights;     /* RFC 4314 'myrights' */
     GList *acls;            /* RFC 4314 acl's */
@@ -92,42 +92,43 @@ struct message_info {
 
 static LibBalsaMailboxClass *parent_class = NULL;
 
-static off_t ImapCacheSize = 30 * 1024 * 1024; /* 30MB */
+static off_t ImapCacheSize = 30*1024*1024; /* 30MB */
 
-/* issue message if downloaded part has more than this size */
-static unsigned SizeMsgThreshold = 50 * 1024;
-static void libbalsa_mailbox_imap_dispose(GObject *object);
-static void libbalsa_mailbox_imap_finalize(GObject *object);
+ /* issue message if downloaded part has more than this size */
+static unsigned SizeMsgThreshold = 50*1024;
+static void libbalsa_mailbox_imap_dispose(GObject * object);
+static void libbalsa_mailbox_imap_finalize(GObject * object);
 static void libbalsa_mailbox_imap_class_init(LibBalsaMailboxImapClass *
-                                             klass);
-static void libbalsa_mailbox_imap_init(LibBalsaMailboxImap *mailbox);
-static gboolean libbalsa_mailbox_imap_open(LibBalsaMailbox *mailbox,
-                                           GError         **err);
-static void libbalsa_mailbox_imap_close(LibBalsaMailbox *mailbox,
-                                        gboolean         expunge);
+                                            klass);
+static void libbalsa_mailbox_imap_init(LibBalsaMailboxImap * mailbox);
+static gboolean libbalsa_mailbox_imap_open(LibBalsaMailbox * mailbox,
+                                          GError **err);
+static void libbalsa_mailbox_imap_close(LibBalsaMailbox * mailbox,
+                                        gboolean expunge);
 static GMimeStream *libbalsa_mailbox_imap_get_message_stream(LibBalsaMailbox *
-                                                             mailbox,
-                                                             guint    msgno,
-                                                             gboolean peek);
-static void libbalsa_mailbox_imap_check(LibBalsaMailbox *mailbox);
-
-static void libbalsa_mailbox_imap_search_iter_free(LibBalsaMailboxSearchIter *iter);
-static gboolean libbalsa_mailbox_imap_message_match(LibBalsaMailbox *mailbox,
-                                                    guint            msgno,
-                                                    LibBalsaMailboxSearchIter
-                                                                    *search_iter);
-static gboolean libbalsa_mailbox_imap_can_match(LibBalsaMailbox   *mbox,
-                                                LibBalsaCondition *condition);
-static void libbalsa_mailbox_imap_save_config(LibBalsaMailbox *mailbox,
-                                              const gchar     *prefix);
-static void libbalsa_mailbox_imap_load_config(LibBalsaMailbox *mailbox,
-                                              const gchar     *prefix);
-
-static gboolean libbalsa_mailbox_imap_sync(LibBalsaMailbox *mailbox,
-                                           gboolean         expunge);
-static LibBalsaMessage *libbalsa_mailbox_imap_get_message(LibBalsaMailbox *
-                                                          mailbox,
-                                                          guint msgno);
+                                                            mailbox,
+                                                            guint msgno,
+                                                            gboolean peek);
+static void libbalsa_mailbox_imap_check(LibBalsaMailbox * mailbox);
+
+static void
+libbalsa_mailbox_imap_search_iter_free(LibBalsaMailboxSearchIter * iter);
+static gboolean libbalsa_mailbox_imap_message_match(LibBalsaMailbox* mailbox,
+                                                   guint msgno,
+                                                   LibBalsaMailboxSearchIter
+                                                   * search_iter);
+static gboolean libbalsa_mailbox_imap_can_match(LibBalsaMailbox  *mbox,
+                                               LibBalsaCondition *condition);
+static void libbalsa_mailbox_imap_save_config(LibBalsaMailbox * mailbox,
+                                             const gchar * prefix);
+static void libbalsa_mailbox_imap_load_config(LibBalsaMailbox * mailbox,
+                                             const gchar * prefix);
+
+static gboolean libbalsa_mailbox_imap_sync(LibBalsaMailbox * mailbox,
+                                           gboolean expunge);
+static LibBalsaMessage* libbalsa_mailbox_imap_get_message(LibBalsaMailbox*
+                                                         mailbox,
+                                                         guint msgno);
 static gboolean libbalsa_mailbox_imap_prepare_threading(LibBalsaMailbox *
                                                         mailbox,
                                                         guint start);
@@ -140,53 +141,51 @@ static gboolean libbalsa_mailbox_imap_fetch_structure(LibBalsaMailbox *
 static void libbalsa_mailbox_imap_fetch_headers(LibBalsaMailbox *mailbox,
                                                 LibBalsaMessage *message);
 static gboolean libbalsa_mailbox_imap_get_msg_part(LibBalsaMessage *msg,
-                                                   LibBalsaMessageBody *,
-                                                   GError         **err);
+                                                  LibBalsaMessageBody *,
+                                                   GError **err);
 static GArray *libbalsa_mailbox_imap_duplicate_msgnos(LibBalsaMailbox *
-                                                      mailbox);
+                                                     mailbox);
 
-static guint libbalsa_mailbox_imap_add_messages(LibBalsaMailbox           *mailbox,
-                                                LibBalsaAddMessageIterator mi,
-                                                void                      *mi_arg,
-                                                GError                   **err);
+static guint libbalsa_mailbox_imap_add_messages(LibBalsaMailbox *mailbox,
+                                               LibBalsaAddMessageIterator mi,
+                                               void *mi_arg,
+                                               GError ** err);
 
-static gboolean lbm_imap_messages_change_flags(LibBalsaMailbox    *mailbox,
-                                               GArray             *seqno,
-                                               LibBalsaMessageFlag set,
-                                               LibBalsaMessageFlag clear);
+static gboolean lbm_imap_messages_change_flags(LibBalsaMailbox * mailbox,
+                                               GArray * seqno,
+                                              LibBalsaMessageFlag set,
+                                              LibBalsaMessageFlag clear);
 static gboolean libbalsa_mailbox_imap_msgno_has_flags(LibBalsaMailbox *
-                                                      mailbox,
-                                                      guint seqno,
+                                                      mailbox, guint seqno,
                                                       LibBalsaMessageFlag
                                                       set,
                                                       LibBalsaMessageFlag
                                                       unset);
-static gboolean libbalsa_mailbox_imap_can_do(LibBalsaMailbox               *mbox,
+static gboolean libbalsa_mailbox_imap_can_do(LibBalsaMailbox* mbox,
                                              enum LibBalsaMailboxCapability c);
 
 static void libbalsa_mailbox_imap_set_threading(LibBalsaMailbox *mailbox,
-                                                LibBalsaMailboxThreadingType
-                                                thread_type);
+                                               LibBalsaMailboxThreadingType
+                                               thread_type);
 static void lbm_imap_update_view_filter(LibBalsaMailbox   *mailbox,
                                         LibBalsaCondition *view_filter);
 static void libbalsa_mailbox_imap_sort(LibBalsaMailbox *mailbox,
-                                       GArray          *array);
+                                       GArray *array);
 static guint libbalsa_mailbox_imap_total_messages(LibBalsaMailbox *
-                                                  mailbox);
+                                                 mailbox);
 static gboolean libbalsa_mailbox_imap_messages_copy(LibBalsaMailbox *
-                                                    mailbox,
-                                                    GArray  *msgnos,
-                                                    LibBalsaMailbox *
-                                                    dest,
+                                                   mailbox,
+                                                   GArray * msgnos,
+                                                   LibBalsaMailbox *
+                                                   dest,
                                                     GError **err);
 
-static void server_host_settings_changed_cb(LibBalsaServer  *server,
-                                            LibBalsaMailbox *mailbox);
+static void server_host_settings_changed_cb(LibBalsaServer * server,
+                                           LibBalsaMailbox * mailbox);
 
-static struct message_info *
-message_info_from_msgno(
-    LibBalsaMailboxImap *mimap,
-    guint                msgno)
+static struct message_info *message_info_from_msgno(
+                                                 LibBalsaMailboxImap * mimap,
+                                                 guint msgno)
 {
     struct message_info *msg_info;
 
@@ -195,16 +194,14 @@ message_info_from_msgno(
                LIBBALSA_MAILBOX(mimap)->name, msgno,
                mimap->messages_info->len);
         msg_info = NULL;
-    } else {
+    } else
         msg_info =
             &g_array_index(mimap->messages_info, struct message_info,
                            msgno - 1);
-    }
 
     return msg_info;
 }
 
-
 #define IMAP_MAILBOX_UID_VALIDITY(mailbox) (LIBBALSA_MAILBOX_IMAP(mailbox)->uid_validity)
 
 GType
@@ -213,30 +210,29 @@ libbalsa_mailbox_imap_get_type(void)
     static GType mailbox_type = 0;
 
     if (!mailbox_type) {
-        static const GTypeInfo mailbox_info = {
-            sizeof(LibBalsaMailboxImapClass),
+       static const GTypeInfo mailbox_info = {
+           sizeof(LibBalsaMailboxImapClass),
             NULL,               /* base_init */
             NULL,               /* base_finalize */
-            (GClassInitFunc) libbalsa_mailbox_imap_class_init,
+           (GClassInitFunc) libbalsa_mailbox_imap_class_init,
             NULL,               /* class_finalize */
             NULL,               /* class_data */
-            sizeof(LibBalsaMailboxImap),
+           sizeof(LibBalsaMailboxImap),
             0,                  /* n_preallocs */
-            (GInstanceInitFunc) libbalsa_mailbox_imap_init
-        };
+           (GInstanceInitFunc) libbalsa_mailbox_imap_init
+       };
 
-        mailbox_type =
-            g_type_register_static(LIBBALSA_TYPE_MAILBOX_REMOTE,
-                                   "LibBalsaMailboxImap",
-                                   &mailbox_info, 0);
+       mailbox_type =
+           g_type_register_static(LIBBALSA_TYPE_MAILBOX_REMOTE,
+                                  "LibBalsaMailboxImap",
+                                  &mailbox_info, 0);
     }
 
     return mailbox_type;
 }
 
-
 static void
-libbalsa_mailbox_imap_class_init(LibBalsaMailboxImapClass *klass)
+libbalsa_mailbox_imap_class_init(LibBalsaMailboxImapClass * klass)
 {
     GObjectClass *object_class;
     LibBalsaMailboxClass *libbalsa_mailbox_class;
@@ -246,71 +242,69 @@ libbalsa_mailbox_imap_class_init(LibBalsaMailboxImapClass *klass)
 
     parent_class = g_type_class_peek_parent(klass);
 
-    object_class->dispose = libbalsa_mailbox_imap_dispose;
+    object_class->dispose  = libbalsa_mailbox_imap_dispose;
     object_class->finalize = libbalsa_mailbox_imap_finalize;
 
     libbalsa_mailbox_class->open_mailbox = libbalsa_mailbox_imap_open;
     libbalsa_mailbox_class->close_mailbox = libbalsa_mailbox_imap_close;
 
     libbalsa_mailbox_class->check = libbalsa_mailbox_imap_check;
-
+    
     libbalsa_mailbox_class->search_iter_free =
-        libbalsa_mailbox_imap_search_iter_free;
+       libbalsa_mailbox_imap_search_iter_free;
     libbalsa_mailbox_class->message_match =
-        libbalsa_mailbox_imap_message_match;
+       libbalsa_mailbox_imap_message_match;
     libbalsa_mailbox_class->can_match =
-        libbalsa_mailbox_imap_can_match;
+       libbalsa_mailbox_imap_can_match;
 
     libbalsa_mailbox_class->save_config =
-        libbalsa_mailbox_imap_save_config;
+       libbalsa_mailbox_imap_save_config;
     libbalsa_mailbox_class->load_config =
-        libbalsa_mailbox_imap_load_config;
+       libbalsa_mailbox_imap_load_config;
     libbalsa_mailbox_class->sync = libbalsa_mailbox_imap_sync;
     libbalsa_mailbox_class->get_message = libbalsa_mailbox_imap_get_message;
     libbalsa_mailbox_class->prepare_threading =
         libbalsa_mailbox_imap_prepare_threading;
-    libbalsa_mailbox_class->fetch_message_structure =
+    libbalsa_mailbox_class->fetch_message_structure = 
         libbalsa_mailbox_imap_fetch_structure;
-    libbalsa_mailbox_class->fetch_headers =
+    libbalsa_mailbox_class->fetch_headers = 
         libbalsa_mailbox_imap_fetch_headers;
-    libbalsa_mailbox_class->get_message_part =
+    libbalsa_mailbox_class->get_message_part = 
         libbalsa_mailbox_imap_get_msg_part;
     libbalsa_mailbox_class->get_message_stream =
-        libbalsa_mailbox_imap_get_message_stream;
+       libbalsa_mailbox_imap_get_message_stream;
     libbalsa_mailbox_class->duplicate_msgnos =
         libbalsa_mailbox_imap_duplicate_msgnos;
     libbalsa_mailbox_class->add_messages = libbalsa_mailbox_imap_add_messages;
     libbalsa_mailbox_class->messages_change_flags =
-        lbm_imap_messages_change_flags;
+       lbm_imap_messages_change_flags;
     libbalsa_mailbox_class->msgno_has_flags =
-        libbalsa_mailbox_imap_msgno_has_flags;
+       libbalsa_mailbox_imap_msgno_has_flags;
     libbalsa_mailbox_class->can_do =
-        libbalsa_mailbox_imap_can_do;
+       libbalsa_mailbox_imap_can_do;
     libbalsa_mailbox_class->set_threading =
-        libbalsa_mailbox_imap_set_threading;
+       libbalsa_mailbox_imap_set_threading;
     libbalsa_mailbox_class->update_view_filter =
         lbm_imap_update_view_filter;
     libbalsa_mailbox_class->sort = libbalsa_mailbox_imap_sort;
     libbalsa_mailbox_class->total_messages =
-        libbalsa_mailbox_imap_total_messages;
+       libbalsa_mailbox_imap_total_messages;
     libbalsa_mailbox_class->messages_copy =
-        libbalsa_mailbox_imap_messages_copy;
+       libbalsa_mailbox_imap_messages_copy;
 }
 
-
 static void
-libbalsa_mailbox_imap_init(LibBalsaMailboxImap *mailbox)
+libbalsa_mailbox_imap_init(LibBalsaMailboxImap * mailbox)
 {
     mailbox->path = NULL;
     mailbox->handle = NULL;
     mailbox->handle_refs = 0;
     mailbox->sort_ranks = g_array_new(FALSE, FALSE, sizeof(guint));
-    mailbox->sort_field = -1;   /* Initially invalid. */
+    mailbox->sort_field = -1;  /* Initially invalid. */
 }
 
-
 static void
-libbalsa_mailbox_imap_dispose(GObject *object)
+libbalsa_mailbox_imap_dispose(GObject * object)
 {
     LibBalsaMailboxRemote *remote;
     LibBalsaMailboxImap *mailbox;
@@ -321,7 +315,7 @@ libbalsa_mailbox_imap_dispose(GObject *object)
                                              G_SIGNAL_MATCH_DATA, 0,
                                              (GQuark) 0, NULL, NULL,
                                              remote);
-        g_clear_object(&remote->server);
+       g_clear_object(&remote->server);
     }
 
     mailbox = LIBBALSA_MAILBOX_IMAP(object);
@@ -330,14 +324,13 @@ libbalsa_mailbox_imap_dispose(GObject *object)
     G_OBJECT_CLASS(parent_class)->dispose(object);
 }
 
-
 /* libbalsa_mailbox_imap_finalize:
    NOTE: we have to close mailbox ourselves without waiting for
    LibBalsaMailbox::finalize because we want to destroy server as well,
-   and close requires server for proper operation.
- */
+   and close requires server for proper operation.  
+*/
 static void
-libbalsa_mailbox_imap_finalize(GObject *object)
+libbalsa_mailbox_imap_finalize(GObject * object)
 {
     LibBalsaMailboxImap *mailbox;
 
@@ -354,8 +347,7 @@ libbalsa_mailbox_imap_finalize(GObject *object)
     G_OBJECT_CLASS(parent_class)->finalize(object);
 }
 
-
-LibBalsaMailbox *
+LibBalsaMailbox*
 libbalsa_mailbox_imap_new(void)
 {
     LibBalsaMailbox *mailbox;
@@ -364,13 +356,12 @@ libbalsa_mailbox_imap_new(void)
     return mailbox;
 }
 
-
 /* libbalsa_mailbox_imap_update_url:
    this is to be used only by mailboxImap functions, with exception
    for the folder scanner, which has to go around libmutt limitations.
- */
+*/
 void
-libbalsa_mailbox_imap_update_url(LibBalsaMailboxImap *mailbox)
+libbalsa_mailbox_imap_update_url(LibBalsaMailboxImap* mailbox)
 {
     LibBalsaServer *s = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
 
@@ -378,10 +369,8 @@ libbalsa_mailbox_imap_update_url(LibBalsaMailboxImap *mailbox)
     LIBBALSA_MAILBOX(mailbox)->url = libbalsa_imap_url(s, mailbox->path);
 }
 
-
 void
-libbalsa_mailbox_imap_set_path(LibBalsaMailboxImap *mailbox,
-                               const gchar         *path)
+libbalsa_mailbox_imap_set_path(LibBalsaMailboxImap* mailbox, const gchar* path)
 {
     g_return_if_fail(mailbox);
     g_free(mailbox->path);
@@ -389,11 +378,9 @@ libbalsa_mailbox_imap_set_path(LibBalsaMailboxImap *mailbox,
     libbalsa_mailbox_imap_update_url(mailbox);
 }
 
-
 gboolean
-libbalsa_imap_get_quota(LibBalsaMailboxImap *mailbox,
-                        gulong              *max_kbyte,
-                        gulong              *used_kbyte)
+libbalsa_imap_get_quota(LibBalsaMailboxImap * mailbox,
+                        gulong *max_kbyte, gulong *used_kbyte)
 {
     g_return_val_if_fail(LIBBALSA_MAILBOX_IMAP(mailbox), FALSE);
 
@@ -401,51 +388,44 @@ libbalsa_imap_get_quota(LibBalsaMailboxImap *mailbox,
                                max_kbyte, used_kbyte) == IMR_OK;
 }
 
-
 /* converts ACL's to a standard RFC 4314 acl string */
 static char *
 imap_acl_to_str(ImapAclType acl)
 {
     GString *rights;
     /* include "cd" for RFC 2086 support: */
-    static const char *flags = "lrswipkxteacd";
+    static const char * flags = "lrswipkxteacd";
     unsigned n;
 
     rights = g_string_new("");
-    for (n = 0; n < strlen(flags); n++) {
-        if (acl & (1 << n)) {
+    for (n = 0; n < strlen(flags); n++)
+        if (acl & (1 << n))
             rights = g_string_append_c(rights, flags[n]);
-        }
-    }
     return g_string_free(rights, FALSE);
 }
 
-
 gchar *
-libbalsa_imap_get_rights(LibBalsaMailboxImap *mailbox)
+libbalsa_imap_get_rights(LibBalsaMailboxImap * mailbox)
 {
     g_return_val_if_fail(LIBBALSA_MAILBOX_IMAP(mailbox), NULL);
 
-    if (mailbox->rights == IMAP_ACL_NONE) {
+    if (mailbox->rights == IMAP_ACL_NONE)
         return NULL;
-    } else {
+    else
         return imap_acl_to_str(mailbox->rights);
-    }
 }
 
-
 gchar **
-libbalsa_imap_get_acls(LibBalsaMailboxImap *mailbox)
+libbalsa_imap_get_acls(LibBalsaMailboxImap * mailbox)
 {
-    gchar **acls;
+    gchar ** acls;
     guint n;
     GList *p;
 
     g_return_val_if_fail(LIBBALSA_MAILBOX_IMAP(mailbox), NULL);
 
-    if (!mailbox->acls) {
+    if (!mailbox->acls)
         return NULL;
-    }
     acls = g_new0(char *, 2 * g_list_length(mailbox->acls) + 1);
     n = 0;
     for (p = mailbox->acls; p != NULL; p = p->next, n += 2) {
@@ -455,49 +435,44 @@ libbalsa_imap_get_acls(LibBalsaMailboxImap *mailbox)
     return acls;
 }
 
-
-const gchar *
-libbalsa_mailbox_imap_get_path(LibBalsaMailboxImap *mailbox)
+const gchar*
+libbalsa_mailbox_imap_get_path(LibBalsaMailboxImap * mailbox)
 {
     return mailbox->path;
 }
 
-
 static void
-server_host_settings_changed_cb(LibBalsaServer  *server,
-                                LibBalsaMailbox *mailbox)
+server_host_settings_changed_cb(LibBalsaServer * server,
+                               LibBalsaMailbox * mailbox)
 {
     libbalsa_mailbox_imap_update_url(LIBBALSA_MAILBOX_IMAP(mailbox));
 }
 
-
-static gchar *
+static gchar*
 get_cache_dir(gboolean is_persistent)
 {
     gchar *fname;
-    if (is_persistent) {
+    if(is_persistent) {
         const gchar *home = g_get_home_dir();
         fname = g_strconcat(home, G_DIR_SEPARATOR_S ".balsa"
                             G_DIR_SEPARATOR_S "imap-cache", NULL);
-    } else {
+    } else
         fname = g_strconcat(g_get_tmp_dir(),
                             G_DIR_SEPARATOR_S "/balsa-",
                             g_get_user_name(), NULL);
-    }
 
     return fname;
 }
 
-
-static gchar *
+static gchar*
 get_header_cache_path(LibBalsaMailboxImap *mimap)
 {
     LibBalsaServer *s = LIBBALSA_MAILBOX_REMOTE(mimap)->server;
     gchar *cache_dir = get_cache_dir(TRUE); /* FIXME */
     gchar *header_file = g_strdup_printf("%s@%s-%s-%u-headers2",
-                                         s->user, s->host,
-                                         (mimap->path ? mimap->path : "INBOX"),
-                                         mimap->uid_validity);
+                                        s->user, s->host,
+                                        (mimap->path ? mimap->path : "INBOX"),
+                                        mimap->uid_validity);
     gchar *encoded_path = libbalsa_urlencode(header_file);
     g_free(header_file);
     header_file = g_build_filename(cache_dir, encoded_path, NULL);
@@ -507,16 +482,14 @@ get_header_cache_path(LibBalsaMailboxImap *mimap)
     return header_file;
 }
 
-
-static gchar **
-get_cache_name_pair(LibBalsaMailboxImap *mailbox,
-                    const gchar         *type,
-                    ImapUID              uid)
+static gchar**
+get_cache_name_pair(LibBalsaMailboxImap* mailbox, const gchar *type,
+                    ImapUID uid)
 {
-    LibBalsaServer *s = LIBBALSA_MAILBOX_REMOTE(mailbox)->server;
+    LibBalsaServer *s      = LIBBALSA_MAILBOX_REMOTE(mailbox)->server;
     LibBalsaImapServer *is = LIBBALSA_IMAP_SERVER(s);
     gboolean is_persistent = libbalsa_imap_server_has_persistent_cache(is);
-    gchar **res = g_malloc(3 * sizeof(gchar *));
+    gchar **res = g_malloc(3*sizeof(gchar*));
     ImapUID uid_validity = LIBBALSA_MAILBOX_IMAP(mailbox)->uid_validity;
     gchar *fname;
 
@@ -532,47 +505,42 @@ get_cache_name_pair(LibBalsaMailboxImap *mailbox,
     return res;
 }
 
-
 /* clean_cache:
    removes unused entries from the cache file.
- */
+*/
 struct file_info {
-    char *name;
-    off_t size;
+    char  *name;
+    off_t  size;
     time_t time;
 };
 static gint
-cmp_by_time(gconstpointer a,
-            gconstpointer b)
+cmp_by_time (gconstpointer  a, gconstpointer  b)
 {
-    return ((const struct file_info *)b)->time
-           - ((const struct file_info *)a)->time;
+    return ((const struct file_info*)b)->time
+        -((const struct file_info*)a)->time;
 }
 
-
 static void
-clean_dir(const char *dir_name,
-          off_t       cache_size)
+clean_dir(const char *dir_name, off_t cache_size)
 {
-    DIR *dir;
-    struct dirent *key;
+    DIR* dir;
+    struct dirent* key;
     GList *list, *lst;
     off_t sz;
     dir = opendir(dir_name);
-    if (!dir) {
+    if(!dir)
         return;
-    }
 
     list = NULL;
-    while ((key = readdir(dir)) != NULL) {
+    while ( (key=readdir(dir)) != NULL) {
         struct stat st;
         struct file_info *fi;
         gchar *fname = g_build_filename(dir_name, key->d_name, NULL);
-        if ((stat(fname, &st) == -1) || !S_ISREG(st.st_mode)) {
-            g_free(fname);
+        if(stat(fname, &st) == -1 || !S_ISREG(st.st_mode)) {
+           g_free(fname);
             continue;
-        }
-        fi = g_new(struct file_info, 1);
+       }
+        fi = g_new(struct file_info,1);
         fi->name = fname;
         fi->size = st.st_size;
         fi->time = st.st_atime;
@@ -582,10 +550,10 @@ clean_dir(const char *dir_name,
 
     list = g_list_sort(list, cmp_by_time);
     sz = 0;
-    for (lst = list; lst; lst = lst->next) {
-        struct file_info *fi = (struct file_info *)(lst->data);
+    for(lst = list; lst; lst = lst->next) {
+        struct file_info *fi = (struct file_info*)(lst->data);
         sz += fi->size;
-        if (sz > cache_size) {
+        if(sz>cache_size) {
             /* printf("removing %s\n", fi->name); */
             unlink(fi->name);
         }
@@ -595,31 +563,28 @@ clean_dir(const char *dir_name,
     g_list_free(list);
 }
 
-
 static gboolean
-clean_cache(LibBalsaMailbox *mailbox)
+clean_cache(LibBalsaMailbox* mailbox)
 {
-    LibBalsaServer *s = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
+    LibBalsaServer *s= LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
     gboolean is_persistent =
         libbalsa_imap_server_has_persistent_cache(LIBBALSA_IMAP_SERVER(s));
-    gchar *dir;
+    gchar* dir;
 
     dir = get_cache_dir(is_persistent);
     clean_dir(dir, ImapCacheSize);
     g_free(dir);
-
+ 
     return TRUE;
 }
-
-
 struct ImapCacheManager;
-static struct ImapCacheManager *imap_cache_manager_new_from_file(const char *header_cache_path);
+static struct ImapCacheManager*imap_cache_manager_new_from_file(const char *header_cache_path);
 static void imap_cache_manager_free(struct ImapCacheManager *icm);
 static struct ImapCacheManager *icm_store_cached_data(ImapMboxHandle *h);
-static void icm_restore_from_cache(ImapMboxHandle          *h,
+static void icm_restore_from_cache(ImapMboxHandle *h,
                                    struct ImapCacheManager *icm);
 static gboolean icm_save_to_file(struct ImapCacheManager *icm,
-                                 const gchar             *path);
+                                const gchar *path);
 
 static ImapResult
 mi_reconnect(ImapMboxHandle *h)
@@ -630,111 +595,91 @@ mi_reconnect(ImapMboxHandle *h)
     unsigned old_next = imap_mbox_handle_get_uidnext(h);
 
     r = imap_mbox_handle_reconnect(h, NULL);
-    if (r == IMAP_SUCCESS) {
-        icm_restore_from_cache(h, icm);
-    }
+    if(r==IMAP_SUCCESS) icm_restore_from_cache(h, icm);
     imap_cache_manager_free(icm);
-    if ((imap_mbox_handle_get_exists(h) != old_cnt) ||
-        (imap_mbox_handle_get_uidnext(h) != old_next)) {
-        g_signal_emit_by_name(h, "exists-notify", 0);
-    }
+    if(imap_mbox_handle_get_exists(h) != old_cnt ||
+       imap_mbox_handle_get_uidnext(h) != old_next)
+       g_signal_emit_by_name(h, "exists-notify", 0);
     return r;
 }
-
-
 /* ImapIssue macro handles reconnecting. We might issue a
    LIBBALSA_INFORMATION_MESSAGE here but it would be overwritten by
    login information... */
-#define II(rc, h, line) \
-    {int trials = 2; do { \
-         if (imap_mbox_is_disconnected(h) && mi_reconnect(h) != IMAP_SUCCESS) \
-         {rc = IMR_NO; break;}; \
-         rc = line; \
-         if (imap_handle_op_cancelled(h)) { \
-             break;} \
-         else if (rc == IMR_SEVERED) {                             \
-             libbalsa_information(LIBBALSA_INFORMATION_WARNING, \
-                                  _("IMAP connection has been severed. Reconnecting…"));} \
-         else if (rc == IMR_PROTOCOL) {                               \
-             libbalsa_information(LIBBALSA_INFORMATION_WARNING, \
-                                  _("IMAP protocol error. Try enabling bug workarounds."));} \
-         else if (rc == IMR_BYE) {char *text = imap_mbox_handle_get_last_msg(h); \
-                                  libbalsa_information(LIBBALSA_INFORMATION_WARNING, \
-                                                       _( \
-                                                           "IMAP server has shut the connection: %s 
Reconnecting…"), \
-                                                       text); \
-                                  g_free(text);} \
-         else { break;} } while (trials -- > 0);}
-#define IIA(rc, h, line, cmd)                         \
-    {int trials = 2; do { \
-         if (imap_mbox_is_disconnected(h) && mi_reconnect(h) != IMAP_SUCCESS) \
-         {rc = 0; break;}; \
-         rc = line; \
-         if (imap_mbox_op_cancelled(h)) { \
-             break;} \
-         else if (rc != IMR_OK) { \
-             libbalsa_information(LIBBALSA_INFORMATION_WARNING, \
-                                  _( \
-                                      "Async IMAP cmd %s could not be executed. Reconnecting…"), \
-                                  cmd);} \
-         else { break;} } while (trials -- > 0);}
+#define II(rc,h,line) \
+   {int trials=2;do{\
+    if(imap_mbox_is_disconnected(h) &&mi_reconnect(h)!=IMAP_SUCCESS)\
+        {rc=IMR_NO;break;};\
+    rc=line; \
+    if(imap_handle_op_cancelled(h))\
+        break;\
+    else if(rc==IMR_SEVERED)                             \
+    libbalsa_information(LIBBALSA_INFORMATION_WARNING, \
+    _("IMAP connection has been severed. Reconnecting…")); \
+    else if(rc==IMR_PROTOCOL)                               \
+    libbalsa_information(LIBBALSA_INFORMATION_WARNING, \
+    _("IMAP protocol error. Try enabling bug workarounds.")); \
+    else if(rc==IMR_BYE) {char *text = imap_mbox_handle_get_last_msg(h); \
+    libbalsa_information(LIBBALSA_INFORMATION_WARNING, \
+    _("IMAP server has shut the connection: %s Reconnecting…"), text); \
+    g_free(text);}\
+    else break;}while(trials-->0);}
+#define IIA(rc,h,line,cmd)                         \
+   {int trials=2;do{\
+    if(imap_mbox_is_disconnected(h) &&mi_reconnect(h)!=IMAP_SUCCESS)\
+        {rc=0;break;};\
+    rc=line; \
+    if(imap_mbox_op_cancelled(h))\
+        break;\
+    else if(rc != IMR_OK) \
+    libbalsa_information(LIBBALSA_INFORMATION_WARNING, \
+     _("Async IMAP cmd %s could not be executed. Reconnecting…"),cmd); \
+    else break;}while(trials-->0);}
 
 static ImapMboxHandle *
-libbalsa_mailbox_imap_get_handle(LibBalsaMailboxImap *mimap,
-                                 GError             **err)
+libbalsa_mailbox_imap_get_handle(LibBalsaMailboxImap *mimap, GError **err)
 {
 
     g_return_val_if_fail(LIBBALSA_MAILBOX_IMAP(mimap), NULL);
 
-    if (!mimap->handle) {
+    if(!mimap->handle) {
         LibBalsaServer *server = LIBBALSA_MAILBOX_REMOTE_SERVER(mimap);
         LibBalsaImapServer *imap_server;
-        if (!LIBBALSA_IS_IMAP_SERVER(server)) {
+        if (!LIBBALSA_IS_IMAP_SERVER(server))
             return NULL;
-        }
         imap_server = LIBBALSA_IMAP_SERVER(server);
         mimap->handle = libbalsa_imap_server_get_handle(imap_server, err);
-        mimap->handle_refs = 1;
-    } else {
-        ++mimap->handle_refs;
-    }
+       mimap->handle_refs = 1;
+    } else
+       ++mimap->handle_refs;
 
     return mimap->handle;
 }
 
-
-#define RELEASE_HANDLE(mailbox, handle) \
+#define RELEASE_HANDLE(mailbox,handle) \
     libbalsa_imap_server_release_handle( \
-        LIBBALSA_IMAP_SERVER(LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox)), \
-        handle)
+               LIBBALSA_IMAP_SERVER(LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox)),\
+               handle)
 
 static void
-lbimap_update_flags(LibBalsaMessage *message,
-                    ImapMessage     *imsg)
+lbimap_update_flags(LibBalsaMessage *message, ImapMessage *imsg)
 {
     message->flags = 0;
-    if (!IMSG_FLAG_SEEN(imsg->flags)) {
+    if (!IMSG_FLAG_SEEN(imsg->flags))
         message->flags |= LIBBALSA_MESSAGE_FLAG_NEW;
-    }
-    if (IMSG_FLAG_DELETED(imsg->flags)) {
+    if (IMSG_FLAG_DELETED(imsg->flags))
         message->flags |= LIBBALSA_MESSAGE_FLAG_DELETED;
-    }
-    if (IMSG_FLAG_FLAGGED(imsg->flags)) {
+    if (IMSG_FLAG_FLAGGED(imsg->flags))
         message->flags |= LIBBALSA_MESSAGE_FLAG_FLAGGED;
-    }
-    if (IMSG_FLAG_ANSWERED(imsg->flags)) {
+    if (IMSG_FLAG_ANSWERED(imsg->flags))
         message->flags |= LIBBALSA_MESSAGE_FLAG_REPLIED;
-    }
-    if (IMSG_FLAG_RECENT(imsg->flags)) {
-        message->flags |= LIBBALSA_MESSAGE_FLAG_RECENT;
-    }
+    if (IMSG_FLAG_RECENT(imsg->flags))
+       message->flags |= LIBBALSA_MESSAGE_FLAG_RECENT;
 }
 
-
 /* mi_get_imsg is a thin wrapper around imap_mbox_handle_get_msg().
    We wrap around imap_mbox_handle_get_msg() in case the libimap data
    was invalidated by eg. disconnect.
- */
+*/
 struct collect_seq_data {
     unsigned *msgno_arr;
     unsigned cnt;
@@ -742,65 +687,52 @@ struct collect_seq_data {
     unsigned has_it;
 };
 
-static const unsigned MAX_CHUNK_LENGTH = 20;
+static const unsigned MAX_CHUNK_LENGTH = 20; 
 static gboolean
-collect_seq_cb(GNode   *node,
-               gpointer data)
+collect_seq_cb(GNode *node, gpointer data)
 {
     /* We prefetch envelopes in chunks to save on RTTs.
      * Try to get the messages both before and after the message. */
-    struct collect_seq_data *csd = (struct collect_seq_data *)data;
+    struct collect_seq_data *csd = (struct collect_seq_data*)data;
     unsigned msgno = GPOINTER_TO_UINT(node->data);
-    if (msgno == 0) { /* root node */
+    if(msgno==0) /* root node */
         return FALSE;
-    }
     csd->msgno_arr[(csd->cnt++) % MAX_CHUNK_LENGTH] = msgno;
-    if (csd->has_it > 0) {
-        csd->has_it++;
-    }
-    if (csd->needed_msgno == msgno) {
+    if(csd->has_it>0) csd->has_it++;
+    if(csd->needed_msgno == msgno)
         csd->has_it = 1;
-    }
     /* quit if we have enough messages and at least half of them are
      * after message in question. */
-    return csd->cnt >= MAX_CHUNK_LENGTH && csd->has_it * 2 > MAX_CHUNK_LENGTH;
+    return csd->cnt >= MAX_CHUNK_LENGTH && csd->has_it*2>MAX_CHUNK_LENGTH;
 }
 
-
 static int
-cmp_msgno(const void *a,
-          const void *b)
+cmp_msgno(const void* a, const void *b)
 {
-    return (*(unsigned *)a) - (*(unsigned *)b);
+    return (*(unsigned*)a) - (*(unsigned*)b);
 }
 
-
-static ImapMessage *
-mi_get_imsg(LibBalsaMailboxImap *mimap,
-            unsigned             msgno)
+static ImapMessage*
+mi_get_imsg(LibBalsaMailboxImap *mimap, unsigned msgno)
 {
-    ImapMessage *imsg;
+    ImapMessage* imsg;
     struct collect_seq_data csd;
     ImapResponse rc;
 
     /* This test too weak: I can imagine unsolicited ENVELOPE
      * responses sent from server that wil create the ImapMessage
      * structure but message size or UID etc will not be available. */
-    if (((imsg = imap_mbox_handle_get_msg(mimap->handle, msgno))
-         != NULL) && imsg->envelope) {
-        return imsg;
-    }
+    if( (imsg = imap_mbox_handle_get_msg(mimap->handle, msgno)) 
+        != NULL && imsg->envelope) return imsg;
     csd.needed_msgno = msgno;
-    csd.msgno_arr = g_malloc(MAX_CHUNK_LENGTH * sizeof(csd.msgno_arr[0]));
-    csd.cnt = 0;
-    csd.has_it = 0;
-    if (LIBBALSA_MAILBOX(mimap)->msg_tree) {
+    csd.msgno_arr    = g_malloc(MAX_CHUNK_LENGTH*sizeof(csd.msgno_arr[0]));
+    csd.cnt          = 0;
+    csd.has_it       = 0;
+    if(LIBBALSA_MAILBOX(mimap)->msg_tree) {
         g_node_traverse(LIBBALSA_MAILBOX(mimap)->msg_tree,
                         G_PRE_ORDER, G_TRAVERSE_ALL, -1, collect_seq_cb,
                         &csd);
-        if (csd.cnt > MAX_CHUNK_LENGTH) {
-            csd.cnt = MAX_CHUNK_LENGTH;
-        }
+        if(csd.cnt>MAX_CHUNK_LENGTH) csd.cnt = MAX_CHUNK_LENGTH;
         qsort(csd.msgno_arr, csd.cnt, sizeof(csd.msgno_arr[0]), cmp_msgno);
     } else {
         /* It may happen that we want to perform an automatic
@@ -810,13 +742,11 @@ mi_get_imsg(LibBalsaMailboxImap *mimap,
            LibBalsaMessage object are present, and these require that
            some basic information is fetched from the server.  */
         unsigned i, total_msgs = mimap->messages_info->len;
-        csd.cnt = msgno + MAX_CHUNK_LENGTH > total_msgs
-            ? total_msgs - msgno + 1 : MAX_CHUNK_LENGTH;
-        for (i = 0; i < csd.cnt; i++) {
-            csd.msgno_arr[i] = msgno + i;
-        }
+        csd.cnt = msgno+MAX_CHUNK_LENGTH>total_msgs
+            ? total_msgs-msgno+1 : MAX_CHUNK_LENGTH;
+        for(i=0; i<csd.cnt; i++) csd.msgno_arr[i] = msgno+i;
     }
-    II(rc, mimap->handle,
+    II(rc,mimap->handle,
        imap_mbox_handle_fetch_set(mimap->handle, csd.msgno_arr,
                                   csd.cnt,
                                   IMFETCH_FLAGS |
@@ -825,21 +755,19 @@ mi_get_imsg(LibBalsaMailboxImap *mimap,
                                   IMFETCH_RFC822SIZE |
                                   IMFETCH_CONTENT_TYPE));
     g_free(csd.msgno_arr);
-    if (rc != IMR_OK) {
+    if (rc != IMR_OK)
         return FALSE;
-    }
     return imap_mbox_handle_get_msg(mimap->handle, msgno);
 }
 
-
 /* Forward reference. */
-static void lbm_imap_get_unseen(LibBalsaMailboxImap *mimap);
+static void lbm_imap_get_unseen(LibBalsaMailboxImap * mimap);
 
 /** imap_flags_cb() is called by the imap backend when flags are
    fetched. Note that we may not have yet the preprocessed data in
    LibBalsaMessage.  We ignore the info in this case.
    OBSERVE: it must not trigger any IMAP activity under NO circumstances!
- */
+*/
 static gboolean
 idle_unread_update_cb(LibBalsaMailbox *mailbox)
 {
@@ -847,82 +775,71 @@ idle_unread_update_cb(LibBalsaMailbox *mailbox)
 
     libbalsa_lock_mailbox(mailbox);
     unread = mailbox->unread_messages;
-
+    
     lbm_imap_get_unseen(LIBBALSA_MAILBOX_IMAP(mailbox));
-    if (unread != mailbox->unread_messages) {
+    if(unread != mailbox->unread_messages)
         libbalsa_mailbox_set_unread_messages_flag(mailbox,
-                                                  mailbox->unread_messages > 0);
-    }
+                                                  mailbox->unread_messages>0);
     LIBBALSA_MAILBOX_IMAP(mailbox)->unread_update_id = 0;
     libbalsa_unlock_mailbox(mailbox);
     return FALSE;
 }
 
-
 static void
-imap_flags_cb(unsigned             cnt,
-              const unsigned       seqno[],
-              LibBalsaMailboxImap *mimap)
+imap_flags_cb(unsigned cnt, const unsigned seqno[], LibBalsaMailboxImap *mimap)
 {
     LibBalsaMailbox *mailbox = LIBBALSA_MAILBOX(mimap);
     unsigned i;
 
     libbalsa_lock_mailbox(mailbox);
-    for (i = 0; i < cnt; i++) {
-        struct message_info *msg_info =
+    for(i=0; i<cnt; i++) {
+        struct message_info *msg_info = 
             message_info_from_msgno(mimap, seqno[i]);
-        if (msg_info && msg_info->message) {
+        if(msg_info && msg_info->message) {
             LibBalsaMessageFlag flags;
             /* since we are talking here about updating just received,
                usually unsolicited flags from the server, we do not
                need to go to great lengths to assure that the
                connection is up. */
-            ImapMessage *imsg =
+            ImapMessage *imsg = 
                 imap_mbox_handle_get_msg(mimap->handle, seqno[i]);
-            if (!imsg) {
-                continue;
-            }
+            if(!imsg) continue;
 
             flags = msg_info->message->flags;
             lbimap_update_flags(msg_info->message, imsg);
-            if (flags == msg_info->message->flags) {
+            if (flags == msg_info->message->flags)
                 continue;
-            }
 
-            libbalsa_mailbox_index_set_flags(mailbox, seqno[i],
-                                             msg_info->message->flags);
-            ++mimap->search_stamp;
+           libbalsa_mailbox_index_set_flags(mailbox, seqno[i],
+                                            msg_info->message->flags);
+           ++mimap->search_stamp;
         }
     }
-    if (!mimap->unread_update_id) {
+    if(!mimap->unread_update_id)
         mimap->unread_update_id =
             g_idle_add((GSourceFunc)idle_unread_update_cb, mailbox);
-    }
     libbalsa_unlock_mailbox(mailbox);
 }
 
-
 static gboolean
 imap_exists_idle(gpointer data)
 {
-    LibBalsaMailboxImap *mimap = (LibBalsaMailboxImap *)data;
+    LibBalsaMailboxImap *mimap = (LibBalsaMailboxImap*)data;
     LibBalsaMailbox *mailbox = LIBBALSA_MAILBOX(mimap);
     unsigned cnt;
 
     libbalsa_lock_mailbox(mailbox);
 
-    mimap->sort_field = -1;     /* Invalidate. */
+    mimap->sort_field = -1;    /* Invalidate. */
 
-    if (mimap->handle && /* was it closed in meantime? */
-        ((cnt = imap_mbox_handle_get_exists(mimap->handle))
-         != mimap->messages_info->len)) {
+    if(mimap->handle && /* was it closed in meantime? */
+       (cnt = imap_mbox_handle_get_exists(mimap->handle))
+       != mimap->messages_info->len) {
         unsigned i;
-        struct message_info a = {
-            0
-        };
+        struct message_info a = {0};
         GNode *sibling = NULL;
 
-        if (cnt < mimap->messages_info->len) {
+        if(cnt<mimap->messages_info->len) {
             /* remove messages; we probably missed some EXPUNGE responses
                - the only sensible scenario is that the connection was
                severed. Still, we need to recover from this somehow... -
@@ -930,41 +847,39 @@ imap_exists_idle(gpointer data)
             printf("%s: expunge ignored? Had %u messages and now only %u. "
                    "Bug in the program or broken connection\n",
                    __func__, mimap->messages_info->len, cnt);
-            for (i = 0; i < mimap->messages_info->len; i++) {
+            for(i=0; i<mimap->messages_info->len; i++) {
                 gchar *msgid;
                 struct message_info *msg_info =
-                    message_info_from_msgno(mimap, i + 1);
-                if (!msg_info) {
+                    message_info_from_msgno(mimap, i+1);
+                if(!msg_info)
                     continue;
-                }
                 g_clear_object(&msg_info->message);
                 msgid = g_ptr_array_index(mimap->msgids, i);
-                if (msgid) {
+                if(msgid) { 
                     g_free(msgid);
                     g_ptr_array_index(mimap->msgids, i) = NULL;
                 }
                 libbalsa_mailbox_index_entry_clear(mailbox, i + 1);
             }
-            for (i = mimap->messages_info->len; i > cnt; i--) {
-                g_array_remove_index(mimap->messages_info, i - 1);
-                g_ptr_array_remove_index(mimap->msgids, i - 1);
+            for(i=mimap->messages_info->len; i>cnt; i--) {
+                g_array_remove_index(mimap->messages_info, i-1);
+                g_ptr_array_remove_index(mimap->msgids, i-1);
                 libbalsa_mailbox_msgno_removed(mailbox, i);
             }
-        }
+        } 
 
-        if (mailbox->msg_tree) {
+        if (mailbox->msg_tree)
             sibling = g_node_last_child(mailbox->msg_tree);
-        }
-        for (i = mimap->messages_info->len + 1; i <= cnt; i++) {
+        for(i=mimap->messages_info->len+1; i <= cnt; i++) {
             g_array_append_val(mimap->messages_info, a);
             g_ptr_array_add(mimap->msgids, NULL);
             libbalsa_mailbox_msgno_inserted(mailbox, i, mailbox->msg_tree,
                                             &sibling);
         }
         ++mimap->search_stamp;
-
-        libbalsa_mailbox_run_filters_on_reception(mailbox);
-        lbm_imap_get_unseen(LIBBALSA_MAILBOX_IMAP(mailbox));
+        
+       libbalsa_mailbox_run_filters_on_reception(mailbox);
+       lbm_imap_get_unseen(LIBBALSA_MAILBOX_IMAP(mailbox));    
     }
 
     libbalsa_unlock_mailbox(mailbox);
@@ -973,19 +888,15 @@ imap_exists_idle(gpointer data)
     return FALSE;
 }
 
-
 static void
-imap_exists_cb(ImapMboxHandle      *handle,
-               LibBalsaMailboxImap *mimap)
+imap_exists_cb(ImapMboxHandle *handle, LibBalsaMailboxImap *mimap)
 {
     g_object_ref(G_OBJECT(mimap));
     g_idle_add(imap_exists_idle, mimap);
 }
 
-
 static void
-imap_expunge_cb(ImapMboxHandle      *handle,
-                unsigned             seqno,
+imap_expunge_cb(ImapMboxHandle *handle, unsigned seqno,
                 LibBalsaMailboxImap *mimap)
 {
     ImapMessage *imsg;
@@ -998,15 +909,15 @@ imap_expunge_cb(ImapMboxHandle      *handle,
 
     libbalsa_mailbox_msgno_removed(mailbox, seqno);
     ++mimap->search_stamp;
-    mimap->sort_field = -1;     /* Invalidate. */
+    mimap->sort_field = -1;    /* Invalidate. */
 
     /* Use imap_mbox_handle_get_msg(mimap->handle, seqno)->uid, not
      * IMAP_MESSAGE_UID(msg_info->message), as the latter may try to
      * fetch the message from the server. */
     if ((imsg = imap_mbox_handle_get_msg(mimap->handle, seqno))) {
-        gchar **pair = get_cache_name_pair(mimap, "body", imsg->uid);
+       gchar **pair = get_cache_name_pair(mimap, "body", imsg->uid);
         gchar *fn = g_build_filename(pair[0], pair[1], NULL);
-        unlink(fn); /* ignore error; perhaps the message
+        unlink(fn); /* ignore error; perhaps the message 
                      * was not in the cache.  */
         g_free(fn);
         g_strfreev(pair);
@@ -1014,10 +925,9 @@ imap_expunge_cb(ImapMboxHandle      *handle,
 
     msg_info = message_info_from_msgno(mimap, seqno);
     if (msg_info) {
-        if (msg_info->message) {
+        if (msg_info->message)
             g_object_unref(msg_info->message);
-        }
-        g_array_remove_index(mimap->messages_info, seqno - 1);
+        g_array_remove_index(mimap->messages_info, seqno-1);
     }
 
     if (seqno <= mimap->msgids->len) {
@@ -1029,41 +939,38 @@ imap_expunge_cb(ImapMboxHandle      *handle,
     }
 
     for (i = seqno - 1; i < mimap->messages_info->len; i++) {
-        struct message_info *info =
-            &g_array_index(mimap->messages_info, struct message_info, i);
+       struct message_info *info =
+           &g_array_index(mimap->messages_info, struct message_info, i);
 
         g_assert(info != NULL);
-        if (info->message) {
-            info->message->msgno = i + 1;
-        }
+       if (info->message)
+           info->message->msgno = i + 1;
     }
 
     libbalsa_unlock_mailbox(mailbox);
 }
 
-
 static void
-libbalsa_mailbox_imap_release_handle(LibBalsaMailboxImap *mimap)
+libbalsa_mailbox_imap_release_handle(LibBalsaMailboxImap * mimap)
 {
     g_assert(mimap->handle != NULL);
     g_assert(mimap->handle_refs > 0);
 
     if (--mimap->handle_refs == 0) {
-        /* Only selected handles have these signal handlers, but we'll
-         * disconnect them anyway. */
-        g_signal_handlers_disconnect_matched(mimap->handle,
-                                             G_SIGNAL_MATCH_DATA,
-                                             0, 0, NULL, NULL, mimap);
+       /* Only selected handles have these signal handlers, but we'll
+        * disconnect them anyway. */
+       g_signal_handlers_disconnect_matched(mimap->handle,
+                                            G_SIGNAL_MATCH_DATA,
+                                            0, 0, NULL, NULL, mimap);
         imap_handle_set_flagscb(mimap->handle, NULL, NULL);
-        RELEASE_HANDLE(mimap, mimap->handle);
-        mimap->handle = NULL;
+       RELEASE_HANDLE(mimap, mimap->handle);
+       mimap->handle = NULL;
     }
 }
 
-
 static ImapMboxHandle *
 libbalsa_mailbox_imap_get_selected_handle(LibBalsaMailboxImap *mimap,
-                                          GError             **err)
+                                         GError **err)
 {
     LibBalsaServer *server;
     LibBalsaImapServer *imap_server;
@@ -1073,47 +980,43 @@ libbalsa_mailbox_imap_get_selected_handle(LibBalsaMailboxImap *mimap,
     g_return_val_if_fail(LIBBALSA_MAILBOX_IMAP(mimap), NULL);
 
     server = LIBBALSA_MAILBOX_REMOTE_SERVER(mimap);
-    if (!LIBBALSA_IS_IMAP_SERVER(server)) {
-        return NULL;
-    }
+    if (!LIBBALSA_IS_IMAP_SERVER(server))
+       return NULL;
     imap_server = LIBBALSA_IMAP_SERVER(server);
-    if (!mimap->handle) {
-        mimap->handle =
-            libbalsa_imap_server_get_handle_with_user(imap_server,
-                                                      mimap, err);
-        if (!mimap->handle) {
+    if(!mimap->handle) {
+        mimap->handle = 
+           libbalsa_imap_server_get_handle_with_user(imap_server,
+                                                     mimap, err);
+        if (!mimap->handle)
             return NULL;
-        }
     }
-    II(rc, mimap->handle,
+    II(rc,mimap->handle,
        imap_mbox_select(mimap->handle, mimap->path,
                         &(LIBBALSA_MAILBOX(mimap)->readonly)));
     if (rc != IMR_OK) {
-        gchar *msg = imap_mbox_handle_get_last_msg(mimap->handle);
-        g_set_error(err, LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_OPEN_ERROR,
-                    "%s", msg);
-        g_free(msg);
-        RELEASE_HANDLE(mimap, mimap->handle);
+       gchar *msg = imap_mbox_handle_get_last_msg(mimap->handle);
+       g_set_error(err, LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_OPEN_ERROR,
+                   "%s", msg);
+       g_free(msg);
+       RELEASE_HANDLE(mimap, mimap->handle);
         mimap->handle = NULL;
-        return NULL;
+       return NULL;
     }
 
     /* check if we have RFC 4314 acl's for the selected mailbox */
     if (imap_mbox_get_my_rights(mimap->handle, &mimap->rights, FALSE) ==
         IMR_OK) {
-        if (!IMAP_RIGHTS_CAN_WRITE(mimap->rights)) {
+        if (!IMAP_RIGHTS_CAN_WRITE(mimap->rights))
             LIBBALSA_MAILBOX(mimap)->readonly = TRUE;
-        }
-        if (mimap->rights & IMAP_ACL_ADMIN) {
+        if (mimap->rights & IMAP_ACL_ADMIN)
             imap_mbox_get_acl(mimap->handle, mimap->path, &mimap->acls);
-        }
     }
 
     /* test validity */
     uidval = imap_mbox_handle_get_validity(mimap->handle);
     if (mimap->uid_validity != uidval) {
-        mimap->uid_validity = uidval;
-        /* FIXME: update/remove msg uids */
+       mimap->uid_validity = uidval;
+       /* FIXME: update/remove msg uids */
     }
 
     imap_handle_set_flagscb(mimap->handle, (ImapFlagsCb)imap_flags_cb, mimap);
@@ -1127,47 +1030,41 @@ libbalsa_mailbox_imap_get_selected_handle(LibBalsaMailboxImap *mimap,
     return mimap->handle;
 }
 
-
 /* Get the list of unseen messages from the server and set
  * the unread-messages count. */
 static void
-lbm_imap_get_unseen(LibBalsaMailboxImap *mimap)
+lbm_imap_get_unseen(LibBalsaMailboxImap * mimap)
 {
     LibBalsaMailbox *mailbox;
     guint i, count, total;
 
-    if (!mimap->handle) {
-        return;
-    }
+    if (!mimap->handle)
+       return;
 
     mailbox = LIBBALSA_MAILBOX(mimap);
     total = imap_mbox_handle_get_exists(mimap->handle);
     mailbox->first_unread = total;
-    for (i = count = 0; i < total; i++) {
-        if (imap_mbox_handle_msgno_has_flags(mimap->handle,
-                                             i + 1,
-                                             0, IMSGF_SEEN | IMSGF_DELETED)) {
+    for(i=count=0; i<total; i++) {
+        if(imap_mbox_handle_msgno_has_flags(mimap->handle,
+                                            i+1,
+                                            0, IMSGF_SEEN|IMSGF_DELETED)) {
             count++;
-            if (mailbox->first_unread > i) {
-                mailbox->first_unread = i + 1;
-            }
+            if(mailbox->first_unread>i)
+                mailbox->first_unread = i+1;
         }
     }
-    if (count == 0) {
+    if(count == 0)
         mailbox->first_unread = 0;
-    }
     mailbox->unread_messages = count;
 
     libbalsa_mailbox_set_unread_messages_flag(mailbox, count > 0);
 }
 
-
 /* libbalsa_mailbox_imap_open:
    opens IMAP mailbox. On failure leaves the object in sane state.
- */
+*/
 static gboolean
-libbalsa_mailbox_imap_open(LibBalsaMailbox *mailbox,
-                           GError         **err)
+libbalsa_mailbox_imap_open(LibBalsaMailbox * mailbox, GError **err)
 {
     LibBalsaMailboxImap *mimap;
     unsigned i;
@@ -1181,79 +1078,71 @@ libbalsa_mailbox_imap_open(LibBalsaMailbox *mailbox,
 
     mimap->handle = libbalsa_mailbox_imap_get_selected_handle(mimap, err);
     if (!mimap->handle) {
-        mimap->opened = FALSE;
-        mailbox->disconnected = TRUE;
-        return FALSE;
+        mimap->opened         = FALSE;
+       mailbox->disconnected = TRUE;
+       return FALSE;
     }
 
-    mimap->opened = TRUE;
+    mimap->opened         = TRUE;
     mailbox->disconnected = FALSE;
     total_messages = imap_mbox_handle_get_exists(mimap->handle);
     mimap->messages_info = g_array_sized_new(FALSE, TRUE,
-                                             sizeof(struct message_info),
-                                             total_messages);
+                                            sizeof(struct message_info),
+                                            total_messages);
     mimap->msgids = g_ptr_array_sized_new(total_messages);
-    for (i = 0; i < total_messages; i++) {
-        struct message_info a = {
-            0
-        };
-        g_array_append_val(mimap->messages_info, a);
-        g_ptr_array_add(mimap->msgids, NULL);
+    for(i=0; i < total_messages; i++) {
+       struct message_info a = {0};
+       g_array_append_val(mimap->messages_info, a);
+       g_ptr_array_add(mimap->msgids, NULL);
     }
     icm = g_object_get_data(G_OBJECT(mailbox), "cache-manager");
-    if (!icm) { /* Try restoring from file... */
-        gchar *header_cache_path = get_header_cache_path(mimap);
-        icm = imap_cache_manager_new_from_file(header_cache_path);
-        g_free(header_cache_path);
+    if(!icm) { /* Try restoring from file... */
+       gchar *header_cache_path = get_header_cache_path(mimap);
+       icm = imap_cache_manager_new_from_file(header_cache_path);
+       g_free(header_cache_path);
         from_file = TRUE;
     }
     if (icm) {
         icm_restore_from_cache(mimap->handle, icm);
-        if (from_file) {
+        if (from_file)
             imap_cache_manager_free(icm);
-        } else {
+        else
             g_object_set_data(G_OBJECT(mailbox), "cache-manager", NULL);
-        }
     }
 
     mailbox->first_unread = imap_mbox_handle_first_unseen(mimap->handle);
     libbalsa_mailbox_run_filters_on_reception(mailbox);
     lbm_imap_get_unseen(mimap);
-    if (mimap->search_stamp) {
-        ++mimap->search_stamp;
-    } else {
-        mimap->search_stamp = mailbox->stamp;
-    }
+    if (mimap->search_stamp)
+       ++mimap->search_stamp;
+    else
+       mimap->search_stamp = mailbox->stamp;
 
 #ifdef DEBUG
     g_print(_("%s: Opening %s Refcount: %d\n"),
-            "LibBalsaMailboxImap", mailbox->name, mailbox->open_ref);
+           "LibBalsaMailboxImap", mailbox->name, mailbox->open_ref);
 #endif
     return TRUE;
 }
 
-
 static void
-free_messages_info(LibBalsaMailboxImap *mbox)
+free_messages_info(LibBalsaMailboxImap * mbox)
 {
     guint i;
     GArray *messages_info = mbox->messages_info;
 
-    if (messages_info->len != mbox->msgids->len) {
-        g_warning("free_messages_info: array sizes do not match.");
-    }
+    if(messages_info->len != mbox->msgids->len)
+       g_warning("free_messages_info: array sizes do not match.");
     for (i = 0; i < messages_info->len; i++) {
-        gchar *msgid;
-        struct message_info *msg_info =
-            &g_array_index(messages_info, struct message_info, i);
-        if (msg_info->message) {
-            msg_info->message->mailbox = NULL;
-            g_object_unref(msg_info->message);
-        }
-        msgid = g_ptr_array_index(mbox->msgids, i);
-        if (msgid) {
-            g_free(msgid);
-        }
+       gchar *msgid;
+       struct message_info *msg_info =
+           &g_array_index(messages_info, struct message_info, i);
+       if (msg_info->message) {
+           msg_info->message->mailbox = NULL;
+           g_object_unref(msg_info->message);
+       }
+       msgid = g_ptr_array_index(mbox->msgids, i);
+       if(msgid) g_free(msgid);
     }
     g_array_free(mbox->messages_info, TRUE);
     mbox->messages_info = NULL;
@@ -1261,12 +1150,10 @@ free_messages_info(LibBalsaMailboxImap *mbox)
     mbox->msgids = NULL;
 }
 
-
 static void
-libbalsa_mailbox_imap_close(LibBalsaMailbox *mailbox,
-                            gboolean         expunge)
+libbalsa_mailbox_imap_close(LibBalsaMailbox * mailbox, gboolean expunge)
 {
-    LibBalsaServer *s = LIBBALSA_MAILBOX_REMOTE(mailbox)->server;
+    LibBalsaServer *s      = LIBBALSA_MAILBOX_REMOTE(mailbox)->server;
     LibBalsaImapServer *is = LIBBALSA_IMAP_SERVER(s);
     gboolean is_persistent = libbalsa_imap_server_has_persistent_cache(is);
     LibBalsaMailboxImap *mbox = LIBBALSA_MAILBOX_IMAP(mailbox);
@@ -1278,37 +1165,32 @@ libbalsa_mailbox_imap_close(LibBalsaMailbox *mailbox,
 
     /* we do not attempt to reconnect here */
     if (expunge) {
-        if (is_persistent) {
-            /* We appreciate expunge info to simplify
-               next resync. */
-            imap_mbox_expunge_a(mbox->handle);
-        }
-        imap_mbox_close(mbox->handle);
-    } else {
-        imap_mbox_unselect(mbox->handle);
-    }
+       if (is_persistent) { /* We appreciate expunge info to simplify
+                               next resync. */
+           imap_mbox_expunge_a(mbox->handle);
+       }
+       imap_mbox_close(mbox->handle);
+    } else
+       imap_mbox_unselect(mbox->handle);
 
     /* We have received last notificiations, we can save the cache now. */
-    if (is_persistent) {
-        /* Implement only for persistent. Cache dir is shared for all
-           non-persistent caches. */
-        gchar *header_file = get_header_cache_path(mbox);
-        icm_save_to_file(icm, header_file);
-        g_free(header_file);
+    if(is_persistent) {
+       /* Implement only for persistent. Cache dir is shared for all
+          non-persistent caches. */
+       gchar *header_file = get_header_cache_path(mbox);
+       icm_save_to_file(icm, header_file);
+       g_free(header_file);
     }
     clean_cache(mailbox);
 
 
     free_messages_info(mbox);
     libbalsa_mailbox_imap_release_handle(mbox);
-    mbox->sort_field = -1;      /* Invalidate. */
+    mbox->sort_field = -1;     /* Invalidate. */
 }
 
-
-static FILE *
-get_cache_stream(LibBalsaMailboxImap *mimap,
-                 guint                uid,
-                 gboolean             peek)
+static FILE*
+get_cache_stream(LibBalsaMailboxImap *mimap, guint uid, gboolean peek)
 {
     FILE *stream;
     gchar **pair, *path;
@@ -1316,48 +1198,45 @@ get_cache_stream(LibBalsaMailboxImap *mimap,
     pair = get_cache_name_pair(mimap, "body", uid);
     path = g_build_filename(pair[0], pair[1], NULL);
     stream = fopen(path, "rb");
-    if (!stream) {
+    if(!stream) {
         FILE *cache;
-        ImapResponse rc;
+       ImapResponse rc;
 
-        g_mkdir_with_parents(pair[0], S_IRUSR | S_IWUSR | S_IXUSR);
+        g_mkdir_with_parents(pair[0], S_IRUSR|S_IWUSR|S_IXUSR);
 #if 0
-        if (msg->length > (signed)SizeMsgThreshold) {
-            libbalsa_information(LIBBALSA_INFORMATION_MESSAGE,
+        if(msg->length>(signed)SizeMsgThreshold)
+            libbalsa_information(LIBBALSA_INFORMATION_MESSAGE, 
                                  _("Downloading %ld kB"),
-                                 msg->length / 1024);
-        }
+                                 msg->length/1024);
 #endif
         cache = fopen(path, "wb");
-        if (cache) {
-            int ferr;
-            II(rc, mimap->handle,
+        if(cache) {
+           int ferr;
+            II(rc,mimap->handle,
                imap_mbox_handle_fetch_rfc822_uid(mimap->handle, uid, peek,
-                                                 cache));
-            ferr = ferror(cache);
+                                                cache));
+           ferr = ferror(cache);
             fclose(cache);
-            if (ferr || (rc != IMR_OK)) {
-                printf("Error fetching RFC822 message, removing cache.\n");
-                unlink(path);
-            }
+           if(ferr || rc != IMR_OK) {
+               printf("Error fetching RFC822 message, removing cache.\n");
+               unlink(path);
+           }
         }
-        stream = fopen(path, "rb");
+       stream = fopen(path,"rb");
     }
-    g_free(path);
+    g_free(path); 
     g_strfreev(pair);
     return stream;
 }
 
-
-/* libbalsa_mailbox_imap_get_message_stream:
+/* libbalsa_mailbox_imap_get_message_stream: 
    Fetch data from cache first, if available.
    When calling imap_fetch_message(), we make use of fact that
    imap_fetch_message doesn't set msg->path field.
- */
+*/
 static GMimeStream *
-libbalsa_mailbox_imap_get_message_stream(LibBalsaMailbox *mailbox,
-                                         guint            msgno,
-                                         gboolean         peek)
+libbalsa_mailbox_imap_get_message_stream(LibBalsaMailbox * mailbox,
+                                        guint msgno, gboolean peek)
 {
     FILE *stream;
     ImapMessage *imsg;
@@ -1374,7 +1253,7 @@ libbalsa_mailbox_imap_get_message_stream(LibBalsaMailbox *mailbox,
         return NULL;
     }
     imsg = mi_get_imsg(mimap, msgno);
-
+    
     stream = imsg ? get_cache_stream(mimap, imsg->uid, peek) : NULL;
 
     libbalsa_unlock_mailbox(mailbox);
@@ -1382,34 +1261,28 @@ libbalsa_mailbox_imap_get_message_stream(LibBalsaMailbox *mailbox,
     return stream ? g_mime_stream_file_new(stream) : NULL;
 }
 
-
 /* libbalsa_mailbox_imap_check:
    checks imap mailbox for new messages.
    Called with the mailbox locked.
- */
+*/
 struct mark_info {
     const gchar *path;
     gboolean marked;
 };
 
 static void
-lbm_imap_list_cb(ImapMboxHandle *handle,
-                 int             delim,
-                 ImapMboxFlags   flags,
-                 char           *folder,
-                 gpointer        data)
+lbm_imap_list_cb(ImapMboxHandle * handle, int delim, ImapMboxFlags flags,
+                 char *folder, gpointer data)
 {
     struct mark_info *info = data;
 
-    if ((strcmp(folder, info->path) == 0)
-        && IMAP_MBOX_HAS_FLAG(flags, IMLIST_MARKED)) {
+    if (strcmp(folder, info->path) == 0
+        && IMAP_MBOX_HAS_FLAG(flags, IMLIST_MARKED))
         info->marked = TRUE;
-    }
 }
 
-
 static gboolean
-lbm_imap_check(LibBalsaMailbox *mailbox)
+lbm_imap_check(LibBalsaMailbox * mailbox)
 {
     LibBalsaMailboxImap *mimap = LIBBALSA_MAILBOX_IMAP(mailbox);
     LibBalsaServer *server = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
@@ -1417,19 +1290,16 @@ lbm_imap_check(LibBalsaMailbox *mailbox)
     gulong id;
 
     handle = libbalsa_mailbox_imap_get_handle(mimap, NULL);
-    if (!handle) {
-        return FALSE;
-    }
+    if (!handle)
+       return FALSE;
 
-    if (libbalsa_imap_server_get_use_status(LIBBALSA_IMAP_SERVER(server))) {
+    if(libbalsa_imap_server_get_use_status(LIBBALSA_IMAP_SERVER(server))) {
         static struct ImapStatusResult info[] = {
-            { IMSTAT_UNSEEN, 0 }, { IMSTAT_NONE, 0 }
-        };
+            { IMSTAT_UNSEEN, 0 }, { IMSTAT_NONE, 0 } };
         /* cannot do status on an open mailbox */
         g_return_val_if_fail(!mimap->opened, FALSE);
-        if (imap_mbox_status(handle, mimap->path, info) != IMR_OK) {
+        if(imap_mbox_status(handle, mimap->path, info) != IMR_OK)
             return FALSE;
-        }
         libbalsa_mailbox_imap_release_handle(mimap);
         return info[0].result > 0;
     } else {
@@ -1440,9 +1310,8 @@ lbm_imap_check(LibBalsaMailbox *mailbox)
         id = g_signal_connect(G_OBJECT(handle), "list-response",
                               G_CALLBACK(lbm_imap_list_cb), &info);
 
-        if (imap_mbox_list(handle, mimap->path) != IMR_OK) {
+        if (imap_mbox_list(handle, mimap->path) != IMR_OK)
             info.marked = FALSE;
-        }
 
         g_signal_handler_disconnect(G_OBJECT(handle), id);
         libbalsa_mailbox_imap_release_handle(mimap);
@@ -1451,36 +1320,31 @@ lbm_imap_check(LibBalsaMailbox *mailbox)
     }
 }
 
-
 static void
-libbalsa_mailbox_imap_check(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_imap_check(LibBalsaMailbox * mailbox)
 {
     g_assert(LIBBALSA_IS_MAILBOX_IMAP(mailbox));
 
     if (!MAILBOX_OPEN(mailbox)) {
         libbalsa_mailbox_set_unread_messages_flag(mailbox,
                                                   lbm_imap_check(mailbox));
-        return;
+       return;
 
     }
 
-    if (LIBBALSA_MAILBOX_IMAP(mailbox)->handle) {
-        libbalsa_mailbox_imap_noop(LIBBALSA_MAILBOX_IMAP(mailbox));
-    } else {
-        g_warning("mailbox has open_ref>0 but no handle!\n");
-    }
+    if (LIBBALSA_MAILBOX_IMAP(mailbox)->handle)
+       libbalsa_mailbox_imap_noop(LIBBALSA_MAILBOX_IMAP(mailbox));
+    else
+       g_warning("mailbox has open_ref>0 but no handle!\n");
 }
 
-
 /* Search iters */
 
-static ImapSearchKey *lbmi_build_imap_query(const LibBalsaCondition *cond,
-                                            ImapSearchKey           *last);
-
+static ImapSearchKey *lbmi_build_imap_query(const LibBalsaCondition * cond,
+                                           ImapSearchKey * last);
 static gboolean
-libbalsa_mailbox_imap_message_match(LibBalsaMailbox           *mailbox,
-                                    guint                      msgno,
-                                    LibBalsaMailboxSearchIter *search_iter)
+libbalsa_mailbox_imap_message_match(LibBalsaMailbox* mailbox, guint msgno,
+                                   LibBalsaMailboxSearchIter * search_iter)
 {
     LibBalsaMailboxImap *mimap;
     struct message_info *msg_info;
@@ -1488,18 +1352,16 @@ libbalsa_mailbox_imap_message_match(LibBalsaMailbox           *mailbox,
 
     mimap = LIBBALSA_MAILBOX_IMAP(mailbox);
     msg_info = message_info_from_msgno(mimap, msgno);
-    if (!msg_info) {
+    if (!msg_info)
         return FALSE;
-    }
 
-    if (msg_info->message) {
+    if (msg_info->message)
         g_object_ref(msg_info->message);
-    } else if (imap_mbox_handle_get_msg(mimap->handle, msgno)
-               && imap_mbox_handle_get_msg(mimap->handle, msgno)->envelope) {
+    else if (imap_mbox_handle_get_msg(mimap->handle, msgno)
+             && imap_mbox_handle_get_msg(mimap->handle, msgno)->envelope)
         /* The backend has already downloaded the data, we can just
-         * convert it to LibBalsaMessage. */
+        * convert it to LibBalsaMessage. */
         libbalsa_mailbox_imap_get_message(mailbox, msgno);
-    }
     if (msg_info->message) {
         if (libbalsa_condition_can_match(search_iter->condition,
                                          msg_info->message)) {
@@ -1512,200 +1374,166 @@ libbalsa_mailbox_imap_message_match(LibBalsaMailbox           *mailbox,
         g_object_unref(msg_info->message);
     }
 
-    if ((search_iter->stamp != mimap->search_stamp) && search_iter->mailbox
-        && LIBBALSA_MAILBOX_GET_CLASS(search_iter->mailbox)->
-        search_iter_free) {
-        LIBBALSA_MAILBOX_GET_CLASS(search_iter->mailbox)->
-        search_iter_free(search_iter);
-    }
+    if (search_iter->stamp != mimap->search_stamp && search_iter->mailbox
+       && LIBBALSA_MAILBOX_GET_CLASS(search_iter->mailbox)->
+       search_iter_free)
+       LIBBALSA_MAILBOX_GET_CLASS(search_iter->mailbox)->
+           search_iter_free(search_iter);
 
     matchings = search_iter->user_data;
     if (!matchings) {
-        ImapSearchKey *query;
-        ImapResponse rc;
+       ImapSearchKey* query;
+       ImapResponse rc;
 
-        matchings = g_hash_table_new(NULL, NULL);
-        query = lbmi_build_imap_query(search_iter->condition, NULL);
-        II(rc, mimap->handle,
+       matchings = g_hash_table_new(NULL, NULL);
+       query = lbmi_build_imap_query(search_iter->condition, NULL);
+       II(rc,mimap->handle,
            imap_mbox_filter_msgnos(mimap->handle, query, matchings));
-        imap_search_key_free(query);
-        if (rc != IMR_OK) {
-            g_hash_table_destroy(matchings);
-            return FALSE;
-        }
-        search_iter->user_data = matchings;
-        search_iter->mailbox = mailbox;
-        search_iter->stamp = mimap->search_stamp;
+       imap_search_key_free(query);
+       if (rc != IMR_OK) {
+           g_hash_table_destroy(matchings);
+           return FALSE;
+       }
+       search_iter->user_data = matchings;
+       search_iter->mailbox = mailbox;
+       search_iter->stamp = mimap->search_stamp;
     }
 
     return g_hash_table_lookup(matchings, GUINT_TO_POINTER(msgno)) != NULL;
 }
 
-
 static void
-libbalsa_mailbox_imap_search_iter_free(LibBalsaMailboxSearchIter *iter)
+libbalsa_mailbox_imap_search_iter_free(LibBalsaMailboxSearchIter * iter)
 {
     GHashTable *matchings = iter->user_data;
 
     if (matchings) {
-        g_hash_table_destroy(matchings);
-        iter->user_data = NULL;
+       g_hash_table_destroy(matchings);
+       iter->user_data = NULL;
     }
     /* iter->condition and iter are freed in the LibBalsaMailbox method. */
 }
 
-
 /* add_or_query() adds a new term to an set of eqs. that can be or-ed.
    There are at least two ways to do it:
    a). transform a and b to NOT (NOT a NOT b)
    b). transform a and b to OR a b
    We keep it simple.
- */
-static ImapSearchKey *
-add_or_query(ImapSearchKey *or_query,
-             gboolean       neg,
-             ImapSearchKey *new_term)
+*/
+static ImapSearchKey*
+add_or_query(ImapSearchKey *or_query, gboolean neg, ImapSearchKey *new_term)
 {
-    if (!or_query) {
-        return new_term;
-    }
-    if (neg) {
+    if(!or_query) return new_term;
+    if(neg) {
         imap_search_key_set_next(new_term, or_query);
         return new_term;
-    } else {
-        return imap_search_key_new_or(FALSE, new_term, or_query);
-    }
+    } else return imap_search_key_new_or(FALSE, new_term, or_query);
 }
 
-
-static ImapSearchKey *
-lbmi_build_imap_query(const LibBalsaCondition *cond,
-                      ImapSearchKey           *next)
+static ImapSearchKey*
+lbmi_build_imap_query(const LibBalsaCondition* cond,
+                      ImapSearchKey *next)
 {
     gboolean neg;
     ImapSearchKey *query = NULL;
-    int cnt = 0;
+    int cnt=0;
 
-    if (!cond) {
-        return NULL;
-    }
+    if(!cond) return NULL;
     neg = cond->negate;
     switch (cond->type) {
     case CONDITION_STRING:
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_TO)) {
-            cnt++, query = add_or_query
-                    (query, neg, imap_search_key_new_string
-                        (neg, IMSE_S_TO, cond->match.string.string, NULL));
-        }
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_FROM)) {
-            cnt++, query = add_or_query
-                    (query, neg, imap_search_key_new_string
-                        (neg, IMSE_S_FROM, cond->match.string.string, NULL));
-        }
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_SUBJECT)) {
-            cnt++, query = add_or_query
-                    (query, neg, imap_search_key_new_string
-                        (neg, IMSE_S_SUBJECT, cond->match.string.string, NULL));
-        }
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_CC)) {
-            cnt++, query = add_or_query
-                    (query, neg, imap_search_key_new_string
-                        (neg, IMSE_S_CC, cond->match.string.string, NULL));
-        }
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_BODY)) {
-            cnt++, query = add_or_query
-                    (query, neg, imap_search_key_new_string
-                        (neg, IMSE_S_BODY, cond->match.string.string, NULL));
-        }
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_US_HEAD)) {
-            cnt++, query = add_or_query
-                    (query, neg, imap_search_key_new_string
-                        (neg, IMSE_S_HEADER, cond->match.string.string,
-                        cond->match.string.user_header));
-        }
-        if (neg && (cnt > 1)) {
+        if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_TO))
+            cnt++,query = add_or_query
+                (query, neg, imap_search_key_new_string
+                 (neg, IMSE_S_TO, cond->match.string.string, NULL));
+        if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_FROM))
+            cnt++,query = add_or_query
+                (query, neg, imap_search_key_new_string
+                 (neg, IMSE_S_FROM, cond->match.string.string, NULL));
+        if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_SUBJECT))
+            cnt++,query = add_or_query
+                (query, neg, imap_search_key_new_string
+                (neg, IMSE_S_SUBJECT,cond->match.string.string, NULL));
+        if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_CC))
+            cnt++,query = add_or_query
+                (query, neg, imap_search_key_new_string
+                 (neg, IMSE_S_CC, cond->match.string.string, NULL));
+        if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_BODY))
+            cnt++,query = add_or_query
+                (query, neg, imap_search_key_new_string
+                 (neg, IMSE_S_BODY, cond->match.string.string, NULL));
+        if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_US_HEAD))
+            cnt++,query = add_or_query
+                (query, neg, imap_search_key_new_string
+                 (neg, IMSE_S_HEADER, cond->match.string.string,
+                  cond->match.string.user_header));
+        if(neg && cnt>1)
             query = imap_search_key_new_not(FALSE, query);
-        }
         imap_search_key_set_next(query, next);
         break;
-
     case CONDITION_DATE: {
         ImapSearchKey *slo = NULL;
-        if (cond->match.date.date_low) {
-            query = slo = imap_search_key_new_date
-                        (IMSE_D_SINCE, FALSE, cond->match.date.date_low);
-        }
+        if (cond->match.date.date_low)
+            query  = slo = imap_search_key_new_date
+                (IMSE_D_SINCE, FALSE, cond->match.date.date_low);
         if (cond->match.date.date_high) {
             query = imap_search_key_new_date
-                    (IMSE_D_BEFORE, FALSE, cond->match.date.date_high);
-            if (slo) {
+                (IMSE_D_BEFORE, FALSE, cond->match.date.date_high);
+            if(slo)
                 imap_search_key_set_next(query, slo);
-            }
         }
         /* this might be redundant if only one limit was specified. */
-        if (query) {
+        if(query)
             query = imap_search_key_new_not(neg, query);
-        }
         break;
     }
-
     case CONDITION_FLAG:
-        if (cond->match.flags & LIBBALSA_MESSAGE_FLAG_REPLIED) {
-            cnt++, query = add_or_query
-                    (query, neg, imap_search_key_new_flag
-                        (neg, IMSGF_ANSWERED));
-        }
-        if (cond->match.flags & LIBBALSA_MESSAGE_FLAG_NEW) {
-            cnt++, query = add_or_query
-                    (query, neg, imap_search_key_new_flag
-                        (!neg, IMSGF_SEEN));
-        }
-        if (cond->match.flags & LIBBALSA_MESSAGE_FLAG_DELETED) {
-            cnt++, query = add_or_query
-                    (query, neg, imap_search_key_new_flag
-                        (neg, IMSGF_DELETED));
-        }
-        if (cond->match.flags & LIBBALSA_MESSAGE_FLAG_FLAGGED) {
-            cnt++, query = add_or_query
-                    (query, neg, imap_search_key_new_flag
-                        (neg, IMSGF_FLAGGED));
-        }
-        if (cond->match.flags & LIBBALSA_MESSAGE_FLAG_RECENT) {
-            cnt++, query = add_or_query
-                    (query, neg, imap_search_key_new_flag
-                        (neg, IMSGF_RECENT));
-        }
-        if (neg && (cnt > 1)) {
+        if (cond->match.flags & LIBBALSA_MESSAGE_FLAG_REPLIED)
+            cnt++,query = add_or_query
+                (query, neg, imap_search_key_new_flag
+                 (neg, IMSGF_ANSWERED));
+        if (cond->match.flags & LIBBALSA_MESSAGE_FLAG_NEW)
+            cnt++,query = add_or_query
+                (query, neg, imap_search_key_new_flag
+                 (!neg, IMSGF_SEEN));
+        if (cond->match.flags & LIBBALSA_MESSAGE_FLAG_DELETED)
+            cnt++,query = add_or_query
+                (query, neg, imap_search_key_new_flag
+                 (neg, IMSGF_DELETED));
+        if (cond->match.flags & LIBBALSA_MESSAGE_FLAG_FLAGGED)
+            cnt++,query = add_or_query
+                (query, neg, imap_search_key_new_flag
+                 (neg, IMSGF_FLAGGED));
+       if (cond->match.flags & LIBBALSA_MESSAGE_FLAG_RECENT)
+           cnt++, query = add_or_query
+               (query, neg, imap_search_key_new_flag
+                (neg, IMSGF_RECENT));
+        if(neg && cnt>1)
             query = imap_search_key_new_not(FALSE, query);
-        }
         imap_search_key_set_next(query, next);
         break;
-
     case CONDITION_AND:
-        if (neg) {
+        if(neg) {
             query = imap_search_key_new_not
-                    (TRUE, lbmi_build_imap_query
-                        (cond->match.andor.left,
-                        lbmi_build_imap_query
-                            (cond->match.andor.right, NULL)));
+                (TRUE, lbmi_build_imap_query
+                 (cond->match.andor.left,
+                  lbmi_build_imap_query
+                  (cond->match.andor.right, NULL)));
             imap_search_key_set_next(query, next);
-        } else {
+        } else
             query = lbmi_build_imap_query
-                    (cond->match.andor.left,
-                    lbmi_build_imap_query
-                        (cond->match.andor.right, next));
-        }
+                (cond->match.andor.left,
+                 lbmi_build_imap_query
+                 (cond->match.andor.right, next));
         break;
-
-    case CONDITION_OR:
-        query =
+    case CONDITION_OR: 
+        query = 
             imap_search_key_new_or
-                (neg,
-                lbmi_build_imap_query(cond->match.andor.left, NULL),
-                lbmi_build_imap_query(cond->match.andor.right, NULL));
-        imap_search_key_set_next(query, next);
+            (neg,
+             lbmi_build_imap_query(cond->match.andor.left, NULL),
+             lbmi_build_imap_query(cond->match.andor.right, NULL));
+            imap_search_key_set_next(query, next);
         break;
-
     case CONDITION_NONE:
     case CONDITION_REGEX:
     default:
@@ -1714,112 +1542,101 @@ lbmi_build_imap_query(const LibBalsaCondition *cond,
     return query;
 }
 
-
 typedef struct {
-    GHashTable *uids;
-    GHashTable *res;
+    GHashTable * uids;
+    GHashTable * res;
 } ImapSearchData;
 
 static void
-imap_matched(unsigned        uid,
-             ImapSearchData *data)
+imap_matched(unsigned uid, ImapSearchData* data)
 {
-    LibBalsaMessage *m =
-        g_hash_table_lookup(data->uids, GUINT_TO_POINTER(uid));
-    if (m) {
+    LibBalsaMessage* m = 
+        g_hash_table_lookup(data->uids,GUINT_TO_POINTER(uid)); 
+    if(m) 
         g_hash_table_insert(data->res, m, m);
-    } else {
+    else
         printf("Could not find UID: %u in message list\n", uid);
-    }
 }
 
-
 /* Gets the messages matching the conditions via the IMAP search command
    error is put to TRUE if an error occurred
- */
+*/
 
-GHashTable *
-libbalsa_mailbox_imap_get_matchings(LibBalsaMailboxImap *mbox,
-                                    LibBalsaCondition   *ct,
-                                    gboolean             only_recent,
-                                    gboolean            *err)
+GHashTable * libbalsa_mailbox_imap_get_matchings(LibBalsaMailboxImap* mbox,
+                                                LibBalsaCondition *ct,
+                                                gboolean only_recent,
+                                                gboolean * err)
 {
-    ImapSearchKey *query;
+    ImapSearchKey* query;
     ImapResponse rc = IMR_NO;
-    ImapSearchData *cbdata;
-    GHashTable *res;
+    ImapSearchData * cbdata;
+    GHashTable * res;
 
     *err = FALSE;
-
+    
     cbdata = g_new( ImapSearchData, 1 );
-    cbdata->uids = g_hash_table_new(NULL, NULL);
-    cbdata->res = g_hash_table_new(NULL, NULL);
+    cbdata->uids = g_hash_table_new(NULL, NULL); 
+    cbdata->res  = g_hash_table_new(NULL, NULL);
     query = lbmi_build_imap_query(ct /* FIXME: ONLY RECENT! */, NULL);
     if (query) {
 #ifdef UID_SEARCH_IMPLEMENTED
-        for (msgs = LIBBALSA_MAILBOX(mbox)->message_list; msgs;
-             msgs = msgs->next) {
-            LibBalsaMessage *m = LIBBALSA_MESSAGE(msgs->data);
-            ImapMessage *imsg = mi_get_imsg(mbox, m->msgno);
+       for(msgs= LIBBALSA_MAILBOX(mbox)->message_list; msgs;
+           msgs = msgs->next){
+           LibBalsaMessage *m = LIBBALSA_MESSAGE(msgs->data);
+           ImapMessage *imsg = mi_get_imsg(mbox, m->msgno);
             if (imsg) {
                 g_hash_table_insert(cbdata->uids,
-                                    GUINT_TO_POINTER(imsg->uid), m);
-            } else {
+                                   GUINT_TO_POINTER(imsg->uid), m);
+            } else
                 g_warning("Msg %d out of range\n", m->msgno);
-            }
-        }
-#else
+       }
+#else  
         g_warning("Search results ignored. Fixme!");
 #endif
-        II(rc, mbox->handle,
+        II(rc,mbox->handle,
            imap_mbox_uid_search(mbox->handle, query,
-                                (void (*)(unsigned, void *))imap_matched,
+                                (void(*)(unsigned,void*))imap_matched,
                                 cbdata));
         imap_search_key_free(query);
     }
     g_hash_table_destroy(cbdata->uids);
     /* Clean up on error */
     if (rc != IMR_OK) {
-        g_hash_table_destroy(cbdata->res);
-        cbdata->res = NULL;
-        *err = TRUE;
-        libbalsa_information(LIBBALSA_INFORMATION_DEBUG,
-                             _("IMAP SEARCH command failed for mailbox %s\n"
-                               "falling back to default searching method"),
-                             LIBBALSA_MAILBOX(mbox)->url);
-    }
+       g_hash_table_destroy(cbdata->res);
+       cbdata->res = NULL;
+       *err = TRUE;
+       libbalsa_information(LIBBALSA_INFORMATION_DEBUG,
+                            _("IMAP SEARCH command failed for mailbox %s\n"
+                              "falling back to default searching method"),
+                            LIBBALSA_MAILBOX(mbox)->url);
+    };
     res = cbdata->res;
     g_free(cbdata);
     return res;
 }
 
-
 /* Returns false if the conditions contain regex matches
    User must be informed that regex match on IMAP will
    be done by default filters functions hence leading to
    SLOW match
- */
-gboolean
-libbalsa_mailbox_imap_can_match(LibBalsaMailbox   *mailbox,
-                                LibBalsaCondition *condition)
+*/
+gboolean libbalsa_mailbox_imap_can_match(LibBalsaMailbox  *mailbox,
+                                        LibBalsaCondition *condition)
 {
 #if 0
     GSList *cnds;
-    for (cnds = conditions->cond_list; cnds; cnds = g_slist_next(cnds)) {
-        LibBalsaCondition *cnd = cnds->data;
-
-        if (cnd->type == CONDITION_REGEX) {
-            return FALSE;
-        }
+    for (cnds =  conditions->cond_list; cnds; cnds = g_slist_next(cnds)) {
+       LibBalsaCondition * cnd = cnds->data;
+       
+       if (cnd->type==CONDITION_REGEX) return FALSE;
     }
 #endif
     return TRUE;
 }
 
-
 static void
-libbalsa_mailbox_imap_save_config(LibBalsaMailbox *mailbox,
-                                  const gchar     *prefix)
+libbalsa_mailbox_imap_save_config(LibBalsaMailbox * mailbox,
+                                 const gchar * prefix)
 {
     LibBalsaMailboxImap *mimap;
 
@@ -1831,15 +1648,13 @@ libbalsa_mailbox_imap_save_config(LibBalsaMailbox *mailbox,
 
     libbalsa_server_save_config(LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox));
 
-    if (LIBBALSA_MAILBOX_CLASS(parent_class)->save_config) {
-        LIBBALSA_MAILBOX_CLASS(parent_class)->save_config(mailbox, prefix);
-    }
+    if (LIBBALSA_MAILBOX_CLASS(parent_class)->save_config)
+       LIBBALSA_MAILBOX_CLASS(parent_class)->save_config(mailbox, prefix);
 }
 
-
 static void
-libbalsa_mailbox_imap_load_config(LibBalsaMailbox *mailbox,
-                                  const gchar     *prefix)
+libbalsa_mailbox_imap_load_config(LibBalsaMailbox * mailbox,
+                                 const gchar * prefix)
 {
     LibBalsaMailboxImap *mimap;
     LibBalsaMailboxRemote *remote;
@@ -1851,45 +1666,42 @@ libbalsa_mailbox_imap_load_config(LibBalsaMailbox *mailbox,
     g_free(mimap->path);
     mimap->path = libbalsa_conf_get_string("Path");
     if (!mimap->path) {
-        mimap->path = g_strdup("INBOX");
-        libbalsa_information(LIBBALSA_INFORMATION_WARNING,
+       mimap->path = g_strdup("INBOX");
+       libbalsa_information(LIBBALSA_INFORMATION_WARNING,
                              _("No path found for mailbox “%s”, "
-                               "using “%s”"),
-                             mailbox->name, mimap->path);
+                              "using “%s”"),
+                            mailbox->name, mimap->path);
     }
 
     remote = LIBBALSA_MAILBOX_REMOTE(mailbox);
     remote->server = LIBBALSA_SERVER(libbalsa_imap_server_new_from_config());
 
     g_signal_connect(G_OBJECT(remote->server), "config-changed",
-                     G_CALLBACK(server_host_settings_changed_cb),
-                     (gpointer) mailbox);
+                    G_CALLBACK(server_host_settings_changed_cb),
+                    (gpointer) mailbox);
 
-    if (LIBBALSA_MAILBOX_CLASS(parent_class)->load_config) {
-        LIBBALSA_MAILBOX_CLASS(parent_class)->load_config(mailbox, prefix);
-    }
+    if (LIBBALSA_MAILBOX_CLASS(parent_class)->load_config)
+       LIBBALSA_MAILBOX_CLASS(parent_class)->load_config(mailbox, prefix);
 
     libbalsa_mailbox_imap_update_url(mimap);
 }
 
-
 /* libbalsa_mailbox_imap_subscribe:
    change subscribed status for a mailbox.
    Can be called for a closed mailbox.
  */
 gboolean
-libbalsa_mailbox_imap_subscribe(LibBalsaMailboxImap *mailbox,
-                                gboolean             subscribe)
+libbalsa_mailbox_imap_subscribe(LibBalsaMailboxImap * mailbox, 
+                                    gboolean subscribe)
 {
     ImapResponse rc;
-    ImapMboxHandle *handle;
+    ImapMboxHandle* handle;
 
     g_return_val_if_fail(LIBBALSA_IS_MAILBOX_IMAP(mailbox), FALSE);
 
     handle = libbalsa_mailbox_imap_get_handle(mailbox, NULL);
-    if (!handle) {
-        return FALSE;
-    }
+    if (!handle)
+       return FALSE;
 
     II(rc, handle, imap_mbox_subscribe(handle, mailbox->path, subscribe));
 
@@ -1897,7 +1709,6 @@ libbalsa_mailbox_imap_subscribe(LibBalsaMailboxImap *mailbox,
     return rc == IMR_OK;
 }
 
-
 /* libbalsa_mailbox_imap_noop:
  * pings the connection with NOOP for an open IMAP mailbox.
  * this keeps the connections alive.
@@ -1908,20 +1719,18 @@ libbalsa_mailbox_imap_subscribe(LibBalsaMailboxImap *mailbox,
  */
 
 void
-libbalsa_mailbox_imap_noop(LibBalsaMailboxImap *mimap)
+libbalsa_mailbox_imap_noop(LibBalsaMailboxImap* mimap)
 {
     g_return_if_fail(mimap != NULL);
 
-    if (mimap->handle) { /* we do not attempt to reconnect here */
-        if (imap_mbox_handle_noop(mimap->handle) != IMR_OK) {
-            /* FIXME: report error... */
-        }
-    }
+    if (mimap->handle) /* we do not attempt to reconnect here */
+       if (imap_mbox_handle_noop(mimap->handle) != IMR_OK) {
+           /* FIXME: report error... */
+       }
 }
 
-
 void
-libbalsa_mailbox_imap_force_disconnect(LibBalsaMailboxImap *mimap)
+libbalsa_mailbox_imap_force_disconnect(LibBalsaMailboxImap* mimap)
 {
     g_return_if_fail(mimap != NULL);
 
@@ -1934,9 +1743,8 @@ libbalsa_mailbox_imap_force_disconnect(LibBalsaMailboxImap *mimap)
     }
 }
 
-
 void
-libbalsa_mailbox_imap_reconnect(LibBalsaMailboxImap *mimap)
+libbalsa_mailbox_imap_reconnect(LibBalsaMailboxImap* mimap)
 {
     g_return_if_fail(mimap != NULL);
 
@@ -1946,46 +1754,41 @@ libbalsa_mailbox_imap_reconnect(LibBalsaMailboxImap *mimap)
                LIBBALSA_MAILBOX_REMOTE_SERVER(mimap)->host,
                (unsigned)time(NULL));
         if (imap_mbox_handle_reconnect
-                (mimap->handle, &(LIBBALSA_MAILBOX(mimap)->readonly))
-            == IMAP_SUCCESS) {
+            (mimap->handle, &(LIBBALSA_MAILBOX(mimap)->readonly))
+            == IMAP_SUCCESS)
             printf("Reconnected %s (%u)\n",
                    LIBBALSA_MAILBOX_REMOTE_SERVER(mimap)->host,
                    (unsigned)time(NULL));
-        }
     }
 }
 
-
 gboolean
-libbalsa_mailbox_imap_is_connected(LibBalsaMailboxImap *mimap)
+libbalsa_mailbox_imap_is_connected(LibBalsaMailboxImap* mimap)
 {
     return mimap->handle && !imap_mbox_is_disconnected(mimap->handle);
 }
 
-
 /* imap_close_all_connections:
    close all connections to leave the place cleanly.
- */
+*/
 void
 libbalsa_imap_close_all_connections(void)
 {
     libbalsa_imap_server_close_all_connections();
 }
 
-
 /* libbalsa_imap_rename_subfolder:
-   dir+parent determine current name.
+   dir+parent determine current name. 
    folder - new name. Can be called for a closed mailbox.
  */
 gboolean
-libbalsa_imap_rename_subfolder(LibBalsaMailboxImap *imap,
-                               const gchar         *new_parent,
-                               const gchar         *folder,
-                               gboolean             subscribe,
-                               GError             **err)
+libbalsa_imap_rename_subfolder(LibBalsaMailboxImap* imap,
+                               const gchar *new_parent, const gchar *folder, 
+                               gboolean subscribe,
+                               GError **err)
 {
     ImapResponse rc;
-    ImapMboxHandle *handle;
+    ImapMboxHandle* handle;
     gchar *new_path;
     char delim[2];
 
@@ -1994,20 +1797,19 @@ libbalsa_imap_rename_subfolder(LibBalsaMailboxImap *imap,
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_RENAME_ERROR,
                     _("Cannot get IMAP handle"));
-        return FALSE;
+       return FALSE;
     }
 
-    II(rc, handle,
+    II(rc,handle,
        imap_mbox_subscribe(handle, imap->path, FALSE));
     delim[0] = imap_mbox_handle_get_delim(handle, new_parent);
     delim[1] = '\0';
     new_path = g_build_path(delim, new_parent, folder, NULL);
     rc = imap_mbox_rename(handle, imap->path, new_path);
-    if (subscribe && (rc == IMR_OK)) {
-        rc = imap_mbox_subscribe(handle, new_path, TRUE);
-    }
+    if (subscribe && rc == IMR_OK)
+       rc = imap_mbox_subscribe(handle, new_path, TRUE);
     g_free(new_path);
-    if (rc != IMR_OK) {
+    if(rc != IMR_OK) {
         gchar *msg = imap_mbox_handle_get_last_msg(handle);
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_RENAME_ERROR,
@@ -2019,44 +1821,38 @@ libbalsa_imap_rename_subfolder(LibBalsaMailboxImap *imap,
     return rc == IMR_OK;
 }
 
-
 gboolean
-libbalsa_imap_new_subfolder(const gchar    *parent,
-                            const gchar    *folder,
-                            gboolean        subscribe,
-                            LibBalsaServer *server,
-                            GError        **err)
+libbalsa_imap_new_subfolder(const gchar *parent, const gchar *folder,
+                           gboolean subscribe, LibBalsaServer *server,
+                            GError **err)
 {
     ImapResponse rc;
-    ImapMboxHandle *handle;
+    ImapMboxHandle* handle;
     gchar *new_path;
 
-    if (!LIBBALSA_IS_IMAP_SERVER(server)) {
-        return FALSE;
-    }
+    if (!LIBBALSA_IS_IMAP_SERVER(server))
+       return FALSE;
     handle = libbalsa_imap_server_get_handle(LIBBALSA_IMAP_SERVER(server),
-                                             NULL);
+                                            NULL);
     if (!handle) {
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_RENAME_ERROR,
                     _("Cannot get IMAP handle"));
-        return FALSE;
+       return FALSE;
     }
     if (parent) {
         char delim[2];
         delim[0] = imap_mbox_handle_get_delim(handle, parent);
         delim[1] = '\0';
         new_path = g_build_path(delim, parent, folder, NULL);
-    } else {
+    } else
         new_path = g_strdup(folder);
-    }
-    II(rc, handle,
+    II(rc,handle,
        imap_mbox_create(handle, new_path));
-    if (subscribe && (rc == IMR_OK)) {
-        rc = imap_mbox_subscribe(handle, new_path, TRUE);
-    }
+    if (subscribe && rc == IMR_OK)
+       rc = imap_mbox_subscribe(handle, new_path, TRUE);
     g_free(new_path);
-    if (rc != IMR_OK) {
+    if(rc != IMR_OK) {
         gchar *msg = imap_mbox_handle_get_last_msg(handle);
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_RENAME_ERROR,
@@ -2068,27 +1864,24 @@ libbalsa_imap_new_subfolder(const gchar    *parent,
     return rc == IMR_OK;
 }
 
-
 gboolean
-libbalsa_imap_delete_folder(LibBalsaMailboxImap *mailbox,
-                            GError             **err)
+libbalsa_imap_delete_folder(LibBalsaMailboxImap *mailbox, GError **err)
 {
     ImapResponse rc;
-    ImapMboxHandle *handle;
+    ImapMboxHandle* handle;
 
     handle = libbalsa_mailbox_imap_get_handle(mailbox, NULL);
-    if (!handle) {
-        return FALSE;
-    }
+    if (!handle)
+       return FALSE;
 
     /* Some IMAP servers (UW2000) do not like removing subscribed mailboxes:
-     * they do not remove the mailbox from the subscription list since
+     * they do not remove the mailbox from the subscription list since 
      * the subscription list should be treated as a list of bookmarks,
      * not a list of physically existing mailboxes. */
     imap_mbox_subscribe(handle, mailbox->path, FALSE);
-    II(rc, handle,
+    II(rc,handle,
        imap_mbox_delete(handle, mailbox->path));
-    if (rc != IMR_OK) {
+    if(rc != IMR_OK) {
         gchar *msg = imap_mbox_handle_get_last_msg(handle);
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_DELETE_ERROR,
@@ -2100,10 +1893,8 @@ libbalsa_imap_delete_folder(LibBalsaMailboxImap *mailbox,
     return rc == IMR_OK;
 }
 
-
 gchar *
-libbalsa_imap_url(LibBalsaServer *server,
-                  const gchar    *path)
+libbalsa_imap_url(LibBalsaServer * server, const gchar * path)
 {
     gchar *enc = libbalsa_urlencode(server->user);
     gchar *url = g_strdup_printf("imap%s://%s@%s/%s",
@@ -2119,27 +1910,24 @@ libbalsa_imap_url(LibBalsaServer *server,
     return url;
 }
 
-
 gboolean
-libbalsa_mailbox_imap_sync(LibBalsaMailbox *mailbox,
-                           gboolean         expunge)
+libbalsa_mailbox_imap_sync(LibBalsaMailbox * mailbox, gboolean expunge)
 {
     LibBalsaMailboxImap *mimap = LIBBALSA_MAILBOX_IMAP(mailbox);
     gboolean res = TRUE;
 
     g_return_val_if_fail(mimap->opened, FALSE);
     /* we are always in sync, we need only to do expunge now and then */
-    if (expunge) {
+    if(expunge) {
         ImapResponse rc;
-        II(rc, mimap->handle,
+        II(rc,mimap->handle,
            imap_mbox_expunge(mimap->handle));
         res = (rc == IMR_OK);
     }
     return res;
 }
 
-
-static InternetAddress *
+static InternetAddress*
 imap_address_to_gmime_mailbox(ImapAddress *addr)
 {
     gchar *tmp = g_mime_utils_header_decode_text(addr->addr_spec);
@@ -2153,17 +1941,15 @@ imap_address_to_gmime_mailbox(ImapAddress *addr)
     return address;
 }
 
-
 static InternetAddressList *
-internet_address_new_list_from_imap_address(ImapAddress  *list,
+internet_address_new_list_from_imap_address(ImapAddress *list,
                                             ImapAddress **tail)
 {
     InternetAddress *addr;
     InternetAddressList *res;
 
-    if (!list) {
+    if (!list)
         return NULL;
-    }
 
     res = internet_address_list_new();
     do {
@@ -2188,9 +1974,8 @@ internet_address_new_list_from_imap_address(ImapAddress  *list,
                 list = imap_addr;
             } else {
                 /* tail */
-                if (tail) {
+                if (tail)
                     *tail = list;
-                }
                 return res;
             }
 
@@ -2198,57 +1983,52 @@ internet_address_new_list_from_imap_address(ImapAddress  *list,
         internet_address_list_add(res, addr);
         g_object_unref(addr);
 
-    } while (list && (list = list->next) != NULL);
+    } while (list &&  (list = list->next) != NULL);
     return res;
 }
 
-
 static InternetAddressList *
 internet_address_new_list_from_imap_address_list(ImapAddress *list)
 {
     return internet_address_new_list_from_imap_address(list, NULL);
 }
 
-
 static void
-lb_set_headers(LibBalsaMessageHeaders *headers,
-               ImapEnvelope           *envelope,
-               gboolean                is_embedded)
+lb_set_headers(LibBalsaMessageHeaders *headers, ImapEnvelope *  envelope,
+               gboolean is_embedded)
 {
     headers->date = envelope->date;
     headers->from =
-        internet_address_new_list_from_imap_address_list(envelope->from);
+       internet_address_new_list_from_imap_address_list(envelope->from);
     headers->reply_to =
         internet_address_new_list_from_imap_address_list(envelope->replyto);
     headers->to_list =
-        internet_address_new_list_from_imap_address_list(envelope->to);
+       internet_address_new_list_from_imap_address_list(envelope->to);
     headers->cc_list =
-        internet_address_new_list_from_imap_address_list(envelope->cc);
+       internet_address_new_list_from_imap_address_list(envelope->cc);
     headers->bcc_list =
-        internet_address_new_list_from_imap_address_list(envelope->bcc);
+       internet_address_new_list_from_imap_address_list(envelope->bcc);
 
-    if (is_embedded) {
+    if(is_embedded) {
         headers->subject =
             g_mime_utils_header_decode_text(envelope->subject);
         libbalsa_utf8_sanitize(&headers->subject, TRUE, NULL);
     }
 }
 
-
 static gboolean
 libbalsa_mailbox_imap_load_envelope(LibBalsaMailboxImap *mimap,
-                                    LibBalsaMessage     *message)
+                                   LibBalsaMessage *message)
 {
     ImapEnvelope *envelope;
-    ImapMessage *imsg;
+    ImapMessage* imsg;
     gchar *hdr;
-
+    
     g_return_val_if_fail(mimap->opened, FALSE);
     imsg = mi_get_imsg(mimap, message->msgno);
 
-    if (!imsg || !imsg->envelope) {
-        /* Connection severed and and restore
-         *  failed - deal with it! */
+    if(!imsg || !imsg->envelope) {/* Connection severed and and restore
+                                   *  failed - deal with it! */
         fprintf(stderr, "load_envelope failed!\n");
         return FALSE;
     }
@@ -2256,29 +2036,26 @@ libbalsa_mailbox_imap_load_envelope(LibBalsaMailboxImap *mimap,
     lbimap_update_flags(message, imsg);
 
     lb_set_headers(message->headers, imsg->envelope, FALSE);
-    if ((hdr = imsg->fetched_header_fields) && *hdr && (*hdr != '\r')) {
-        libbalsa_message_set_headers_from_string(message, hdr);
-    }
-    envelope = imsg->envelope;
+    if ((hdr = imsg->fetched_header_fields) && *hdr && *hdr != '\r')
+       libbalsa_message_set_headers_from_string(message, hdr);
+    envelope        = imsg->envelope;
     message->length = imsg->rfc822size;
     libbalsa_message_set_subject_from_header(message, envelope->subject);
     message->sender =
-        internet_address_new_list_from_imap_address_list(envelope->sender);
+       internet_address_new_list_from_imap_address_list(envelope->sender);
     libbalsa_message_set_in_reply_to_from_string(message,
-                                                 envelope->in_reply_to);
+                                                envelope->in_reply_to);
     if (envelope->message_id) {
-        message->message_id =
-            g_mime_utils_decode_message_id(envelope->message_id);
+       message->message_id =
+           g_mime_utils_decode_message_id(envelope->message_id);
     }
 
     return TRUE;
 }
 
-
 /* converts the backend data to LibBalsaMessage object */
-static LibBalsaMessage *
-libbalsa_mailbox_imap_get_message(LibBalsaMailbox *mailbox,
-                                  guint            msgno)
+static LibBalsaMessage*
+libbalsa_mailbox_imap_get_message(LibBalsaMailbox * mailbox, guint msgno)
 {
     struct message_info *msg_info;
     LibBalsaMailboxImap *mimap = (LibBalsaMailboxImap *) mailbox;
@@ -2292,123 +2069,96 @@ libbalsa_mailbox_imap_get_message(LibBalsaMailbox *mailbox,
 
     if (!msg_info->message) {
         LibBalsaMessage *msg = libbalsa_message_new();
-        msg->msgno = msgno;
+        msg->msgno   = msgno;
         msg->mailbox = mailbox;
         if (libbalsa_mailbox_imap_load_envelope(mimap, msg)) {
-            gchar *id;
-            msg_info->message = msg;
-            if (libbalsa_message_is_partial(msg, &id)) {
-                libbalsa_mailbox_try_reassemble(mailbox, id);
-                g_free(id);
-            }
-        } else {
+           gchar *id;
+            msg_info->message  = msg;
+           if (libbalsa_message_is_partial(msg, &id)) {
+               libbalsa_mailbox_try_reassemble(mailbox, id);
+               g_free(id);
+           }
+       } else 
             g_object_unref(G_OBJECT(msg));
-        }
-    }
-    if (msg_info->message) {
-        g_object_ref(msg_info->message); /* we want to keep one copy */
     }
+    if (msg_info->message)
+       g_object_ref(msg_info->message); /* we want to keep one copy */
     libbalsa_unlock_mailbox(mailbox);
 
     return msg_info->message;
 }
 
-
 static gboolean
-libbalsa_mailbox_imap_prepare_threading(LibBalsaMailbox *mailbox,
-                                        guint            start)
+libbalsa_mailbox_imap_prepare_threading(LibBalsaMailbox * mailbox,
+                                        guint start)
 {
     /* Nothing to do. */
     return TRUE;
 }
 
-
 static void
-lbm_imap_construct_body(LibBalsaMessageBody *lbbody,
-                        ImapBody            *imap_body)
+lbm_imap_construct_body(LibBalsaMessageBody *lbbody, ImapBody *imap_body)
 {
     const char *str;
     g_return_if_fail(lbbody);
     g_return_if_fail(imap_body);
 
-    switch (imap_body->media_basic) {
+    switch(imap_body->media_basic) {
     case IMBMEDIA_MULTIPART:
-        lbbody->body_type = LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART;
-        break;
-
+        lbbody->body_type = LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART; break;
     case IMBMEDIA_APPLICATION:
-        lbbody->body_type = LIBBALSA_MESSAGE_BODY_TYPE_APPLICATION;
-        break;
-
+        lbbody->body_type = LIBBALSA_MESSAGE_BODY_TYPE_APPLICATION; break;
     case IMBMEDIA_AUDIO:
-        lbbody->body_type = LIBBALSA_MESSAGE_BODY_TYPE_AUDIO;
-        break;
-
+        lbbody->body_type = LIBBALSA_MESSAGE_BODY_TYPE_AUDIO; break;
     case IMBMEDIA_IMAGE:
-        lbbody->body_type = LIBBALSA_MESSAGE_BODY_TYPE_IMAGE;
-        break;
-
+        lbbody->body_type = LIBBALSA_MESSAGE_BODY_TYPE_IMAGE; break;
     case IMBMEDIA_MESSAGE_RFC822:
     case IMBMEDIA_MESSAGE_OTHER:
-        lbbody->body_type = LIBBALSA_MESSAGE_BODY_TYPE_MESSAGE;
-        break;
-
+        lbbody->body_type = LIBBALSA_MESSAGE_BODY_TYPE_MESSAGE; break;
     case IMBMEDIA_TEXT:
-        lbbody->body_type = LIBBALSA_MESSAGE_BODY_TYPE_TEXT;
-        break;
-
+        lbbody->body_type = LIBBALSA_MESSAGE_BODY_TYPE_TEXT; break;
     default:
     case IMBMEDIA_OTHER:
-        lbbody->body_type = LIBBALSA_MESSAGE_BODY_TYPE_OTHER;
-        break;
+        lbbody->body_type = LIBBALSA_MESSAGE_BODY_TYPE_OTHER; break;
     }
 
     switch (imap_body->content_dsp) {
     case IMBDISP_INLINE:
-        lbbody->content_dsp = GMIME_DISPOSITION_INLINE;
-        break;
-
+       lbbody->content_dsp = GMIME_DISPOSITION_INLINE; break;
     case IMBDISP_ATTACHMENT:
-        lbbody->content_dsp = GMIME_DISPOSITION_ATTACHMENT;
-        break;
-
+       lbbody->content_dsp = GMIME_DISPOSITION_ATTACHMENT; break;
     case IMBDISP_OTHER:
-        lbbody->content_dsp = imap_body->content_dsp_other;
-        break;
+       lbbody->content_dsp = imap_body->content_dsp_other; break;
     }
     lbbody->content_id = imap_body->content_id;
     lbbody->content_type = imap_body_get_content_type(imap_body);
     /* get the name in the same way as g_mime_part_get_filename() does */
     str = imap_body_get_dsp_param(imap_body, "filename");
-    if (!str) {
-        str = imap_body_get_param(imap_body, "name");
-    }
-    if (str) {
-        lbbody->filename =
-            g_mime_utils_header_decode_text(str);
+    if(!str) str = imap_body_get_param(imap_body, "name");
+    if(str) {
+        lbbody->filename  =
+           g_mime_utils_header_decode_text(str);
         libbalsa_utf8_sanitize(&lbbody->filename, TRUE, NULL);
     }
-    lbbody->charset = g_strdup(imap_body_get_param(imap_body, "charset"));
-    if (imap_body->envelope) {
+    lbbody->charset   = g_strdup(imap_body_get_param(imap_body, "charset"));
+    if(imap_body->envelope) {
         lbbody->embhdrs = g_new0(LibBalsaMessageHeaders, 1);
         lb_set_headers(lbbody->embhdrs, imap_body->envelope, TRUE);
     }
-    if (imap_body->next) {
+    if(imap_body->next) {
         LibBalsaMessageBody *body = libbalsa_message_body_new(lbbody->message);
         lbm_imap_construct_body(body, imap_body->next);
         lbbody->next = body;
     }
-    if (imap_body->child) {
+    if(imap_body->child) {
         LibBalsaMessageBody *body = libbalsa_message_body_new(lbbody->message);
         lbm_imap_construct_body(body, imap_body->child);
         lbbody->parts = body;
     }
 }
 
-
 static gboolean
-get_struct_from_cache(LibBalsaMailbox  *mailbox,
-                      LibBalsaMessage  *message,
+get_struct_from_cache(LibBalsaMailbox *mailbox, LibBalsaMessage *message,
                       LibBalsaFetchFlag flags)
 {
     if (!message->mime_msg) {
@@ -2418,11 +2168,10 @@ get_struct_from_cache(LibBalsaMailbox  *mailbox,
         GMimeFilter *filter;
         GMimeParser *mime_parser;
         LibBalsaMailboxImap *mimap = LIBBALSA_MAILBOX_IMAP(mailbox);
-        ImapMessage *imsg = mi_get_imsg(mimap, message->msgno);
+       ImapMessage *imsg = mi_get_imsg(mimap, message->msgno);
 
-        if (!imsg) {
-            return FALSE;
-        }
+       if (!imsg)
+           return FALSE;
 
         pair = get_cache_name_pair(mimap, "body", imsg->uid);
 
@@ -2430,9 +2179,8 @@ get_struct_from_cache(LibBalsaMailbox  *mailbox,
         g_strfreev(pair);
         fd = open(filename, O_RDONLY);
         g_free(filename);
-        if (fd == -1) {
+        if (fd == -1)
             return FALSE;
-        }
 
         stream = g_mime_stream_fs_new(fd);
         fstream = g_mime_stream_filter_new(stream);
@@ -2449,10 +2197,10 @@ get_struct_from_cache(LibBalsaMailbox  *mailbox,
         message->mime_msg = g_mime_parser_construct_message(mime_parser);
         g_object_unref(mime_parser);
     }
-
+    
     /* follow libbalsa_mailbox_local_fetch_structure here;
      * perhaps create common helper */
-    if (flags & LB_FETCH_STRUCTURE) {
+    if(flags & LB_FETCH_STRUCTURE) {
         LibBalsaMessageBody *body = libbalsa_message_body_new(message);
         libbalsa_message_body_set_mime_body(body,
                                             message->mime_msg->mime_part);
@@ -2460,19 +2208,18 @@ get_struct_from_cache(LibBalsaMailbox  *mailbox,
         libbalsa_message_headers_from_gmime(message->headers,
                                             message->mime_msg);
     }
-    if (flags & LB_FETCH_RFC822_HEADERS) {
+    if(flags & LB_FETCH_RFC822_HEADERS) {
         g_assert(message->headers != NULL);
-        message->headers->user_hdrs =
+        message->headers->user_hdrs = 
             libbalsa_message_user_hdrs_from_gmime(message->mime_msg);
         message->has_all_headers = 1;
     }
     return TRUE;
 }
 
-
 static gboolean
-libbalsa_mailbox_imap_fetch_structure(LibBalsaMailbox  *mailbox,
-                                      LibBalsaMessage  *message,
+libbalsa_mailbox_imap_fetch_structure(LibBalsaMailbox *mailbox,
+                                      LibBalsaMessage *message,
                                       LibBalsaFetchFlag flags)
 {
     ImapResponse rc;
@@ -2490,51 +2237,45 @@ libbalsa_mailbox_imap_fetch_structure(LibBalsaMailbox  *mailbox,
        parts yet. Also, we save some RTTS for very small messages by
        fetching them in their entirety. */
     server = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
-    if (!imap_mbox_handle_can_do(mimap->handle, IMCAP_FETCHBODY) ||
-        libbalsa_imap_server_has_bug(LIBBALSA_IMAP_SERVER(server),
-                                     ISBUG_FETCH) ||
-        (LIBBALSA_MESSAGE_GET_LENGTH(message) < 8192) ||
-        (message->headers &&
-         (!message->headers->content_type ||
-          g_mime_content_type_is_type(message->headers->content_type, "text", "*")))) {
+    if(!imap_mbox_handle_can_do(mimap->handle, IMCAP_FETCHBODY) ||
+       libbalsa_imap_server_has_bug(LIBBALSA_IMAP_SERVER(server),
+                                    ISBUG_FETCH) ||
+       LIBBALSA_MESSAGE_GET_LENGTH(message)<8192 ||
+       (message->headers &&
+        (!message->headers->content_type ||
+         g_mime_content_type_is_type(message->headers->content_type, "text", "*"))) ){
         /* we could optimize this part a little bit: we do not need to
          * keep reopening the stream. */
-        GMimeStream *stream =
+        GMimeStream *stream = 
             libbalsa_mailbox_imap_get_message_stream(mailbox, message->msgno,
-                                                     FALSE);
-        if (!stream) { /* oops, connection broken or the message disappeared? */
+                                                    FALSE);
+        if(!stream) /* oops, connection broken or the message disappeared? */
             return FALSE;
-        }
         g_object_unref(stream);
     }
 
-    if (get_struct_from_cache(mailbox, message, flags)) {
+    if(get_struct_from_cache(mailbox, message, flags))
         return TRUE;
-    }
 
-    if (flags & LB_FETCH_RFC822_HEADERS) {
-        ift |= IMFETCH_RFC822HEADERS_SELECTED;
-    }
-    if (flags & LB_FETCH_STRUCTURE) {
-        ift |= IMFETCH_BODYSTRUCT;
-    }
+    if(flags & LB_FETCH_RFC822_HEADERS) ift |= IMFETCH_RFC822HEADERS_SELECTED;
+    if(flags & LB_FETCH_STRUCTURE)      ift |= IMFETCH_BODYSTRUCT;
 
     II(rc, mimap->handle,
        imap_mbox_handle_fetch_range(mimap->handle, message->msgno,
                                     message->msgno, ift));
-    if (rc == IMR_OK) { /* translate ImapData to LibBalsaMessage */
+    if(rc == IMR_OK) { /* translate ImapData to LibBalsaMessage */
         gchar *hdr;
         ImapMessage *im = imap_mbox_handle_get_msg(mimap->handle,
                                                    message->msgno);
-        /* in case of msg number discrepancies: */
+       /* in case of msg number discrepancies: */
         g_return_val_if_fail(im != NULL, FALSE);
-        if (flags & LB_FETCH_STRUCTURE) {
+        if(flags & LB_FETCH_STRUCTURE) {
             LibBalsaMessageBody *body = libbalsa_message_body_new(message);
             lbm_imap_construct_body(body, im->body);
             libbalsa_message_append_part(message, body);
         }
-        if ((flags & LB_FETCH_RFC822_HEADERS) &&
-            (hdr = im->fetched_header_fields) && *hdr && (*hdr != '\r')) {
+        if( (flags & LB_FETCH_RFC822_HEADERS) &&
+            (hdr = im->fetched_header_fields) && *hdr && *hdr != '\r') {
             libbalsa_message_set_headers_from_string(message, hdr);
             message->has_all_headers = 1;
         }
@@ -2544,7 +2285,6 @@ libbalsa_mailbox_imap_fetch_structure(LibBalsaMailbox  *mailbox,
     return FALSE;
 }
 
-
 static void
 libbalsa_mailbox_imap_fetch_headers(LibBalsaMailbox *mailbox,
                                     LibBalsaMessage *message)
@@ -2552,32 +2292,28 @@ libbalsa_mailbox_imap_fetch_headers(LibBalsaMailbox *mailbox,
     LibBalsaMailboxImap *mimap = LIBBALSA_MAILBOX_IMAP(mailbox);
     ImapResponse rc;
 
-    II(rc, mimap->handle,
+    II(rc,mimap->handle,
        imap_mbox_handle_fetch_range(mimap->handle,
                                     message->msgno,
                                     message->msgno,
                                     IMFETCH_RFC822HEADERS_SELECTED));
-    if (rc == IMR_OK) { /* translate ImapData to LibBalsaMessage */
+    if(rc == IMR_OK) { /* translate ImapData to LibBalsaMessage */
         const gchar *hdr;
         ImapMessage *im = imap_mbox_handle_get_msg(mimap->handle,
                                                    message->msgno);
-        if ((hdr = im->fetched_header_fields) && *hdr && (*hdr != '\r')) {
+        if ((hdr = im->fetched_header_fields) && *hdr && *hdr != '\r')
             libbalsa_message_set_headers_from_string(message, hdr);
-        }
     }
 }
 
-
 static gboolean
-is_child_of(LibBalsaMessageBody *body,
-            LibBalsaMessageBody *child,
-            GString             *s,
-            gboolean             modify)
+is_child_of(LibBalsaMessageBody *body, LibBalsaMessageBody *child,
+            GString *s, gboolean modify)
 {
     int i = 1;
     gboolean do_mod;
-    for (i = 1; body; body = body->next) {
-        if (body == child) {
+    for(i=1; body; body = body->next) {
+        if(body==child) {
             g_string_printf(s, "%u", i);
             return TRUE;
         }
@@ -2585,8 +2321,8 @@ is_child_of(LibBalsaMessageBody *body,
                    body->parts &&
                    body->parts->body_type ==
                    LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART);
-        if (is_child_of(body->parts, child, s, do_mod)) {
-            if (modify) {
+        if(is_child_of(body->parts, child, s, do_mod)){
+            if(modify) {
                 char buf[12];
                 snprintf(buf, sizeof(buf), "%u.", i);
                 g_string_prepend(s, buf);
@@ -2598,12 +2334,9 @@ is_child_of(LibBalsaMessageBody *body,
     return FALSE;
 }
 
-
 #if 0
 static void
-print_structure(LibBalsaMessageBody *part,
-                LibBalsaMessageBody *m,
-                int                  ind)
+print_structure(LibBalsaMessageBody *part, LibBalsaMessageBody* m, int ind)
 {
     static const char *t[] = {
         "LIBBALSA_MESSAGE_BODY_TYPE_OTHER",
@@ -2614,38 +2347,30 @@ print_structure(LibBalsaMessageBody *part,
         "LIBBALSA_MESSAGE_BODY_TYPE_MODEL",
         "LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART",
         "LIBBALSA_MESSAGE_BODY_TYPE_TEXT",
-        "LIBBALSA_MESSAGE_BODY_TYPE_VIDEO"
-    };
+        "LIBBALSA_MESSAGE_BODY_TYPE_VIDEO" };
 
-    int j, i = 1;
-    while (part) {
-        for (j = 0; j < ind; j++) {
-            putchar(' ');
-        }
+    int j,i=1;
+    while(part) {
+        for(j=0; j<ind; j++) putchar(' ');
         printf("%d: %s%s\n", i++, t[part->body_type],
                part == m ? " <--" : "");
-        if (part->parts) {
-            print_structure(part->parts, m, ind + 2);
-        }
+        if(part->parts)
+            print_structure(part->parts, m, ind+2);
         part = part->next;
     }
 }
-
-
 #endif
-static gchar *
-get_section_for(LibBalsaMessage     *msg,
-                LibBalsaMessageBody *part)
+static gchar*
+get_section_for(LibBalsaMessage *msg, LibBalsaMessageBody *part)
 {
     GString *section = g_string_new("");
     LibBalsaMessageBody *parent;
 
     parent = msg->body_list;
-    if (libbalsa_message_body_is_multipart(parent)) {
-        parent = parent->parts;
-    }
+    if (libbalsa_message_body_is_multipart(parent))
+       parent = parent->parts;
 
-    if (!is_child_of(parent, part, section, TRUE)) {
+    if(!is_child_of(parent, part, section, TRUE)) {
         g_warning("Internal error, part %p not found in msg %p.\n",
                   part, msg);
         g_string_free(section, TRUE);
@@ -2657,100 +2382,79 @@ get_section_for(LibBalsaMessage     *msg,
 #endif
     return g_string_free(section, FALSE);
 }
-
-
-struct part_data {
-    char *block;
-    unsigned pos;
-    ImapBody *body;
-};
+struct part_data { char *block; unsigned pos; ImapBody *body; };
 static void
-append_str(unsigned    seqno,
-           const char *buf,
-           size_t      buflen,
-           void       *arg)
+append_str(unsigned seqno, const char *buf, size_t buflen, void *arg)
 {
-    struct part_data *dt = (struct part_data *)arg;
+    struct part_data *dt = (struct part_data*)arg;
 
-    if (dt->pos + buflen > dt->body->octets) {
-        /*
-           fprintf(stderr, "IMAP server sends too much data but we just "
+    if(dt->pos + buflen > dt->body->octets) {
+        /* 
+        fprintf(stderr, "IMAP server sends too much data but we just "
                 "reallocate the block.\n"); */
-        dt->body->octets = dt->pos + buflen;
-        dt->block = g_realloc(dt->block, dt->body->octets);
+       dt->body->octets = dt->pos + buflen;
+       dt->block = g_realloc(dt->block, dt->body->octets);
     }
     memcpy(dt->block + dt->pos, buf, buflen);
     dt->pos += buflen;
 }
 
-
-static const char *
+static const char*
 encoding_names(ImapBodyEncoding enc)
 {
-    switch (enc) {
+    switch(enc) {
     case IMBENC_7BIT:   return "7bit";
-
     default:
     case IMBENC_8BIT:   return "8bit";
-
     case IMBENC_BINARY: return "binary";
-
     case IMBENC_BASE64: return "base64";
-
     case IMBENC_QUOTED: return "quoted-printable";
     }
 }
-
-
-static LibBalsaMessageBody *
-get_parent(LibBalsaMessageBody *root,
-           LibBalsaMessageBody *part,
+static LibBalsaMessageBody*
+get_parent(LibBalsaMessageBody *root, LibBalsaMessageBody *part,
            LibBalsaMessageBody *parent)
 {
-    while (root) {
+    while(root) {
         LibBalsaMessageBody *res;
-        if (root == part) {
+        if(root == part)
             return parent;
-        }
-        if (root->parts &&
-            ((res = get_parent(root->parts, part, root)) != NULL)) {
+        if(root->parts &&
+           (res = get_parent(root->parts, part, root)) != NULL)
             return res;
-        }
         root = root->next;
     }
     return NULL;
 }
-
-
 static gboolean
-lbm_imap_get_msg_part_from_cache(LibBalsaMessage     *msg,
-                                 LibBalsaMessageBody *part,
-                                 GError             **err)
+lbm_imap_get_msg_part_from_cache(LibBalsaMessage * msg,
+                                 LibBalsaMessageBody * part,
+                                 GError **err)
 {
     GMimeStream *partstream = NULL;
 
-    gchar **pair, *part_name;
+    gchar **pair,  *part_name;
     LibBalsaMailboxImap *mimap = LIBBALSA_MAILBOX_IMAP(msg->mailbox);
     FILE *fp;
     gchar *section;
     ImapMessage *imsg = mi_get_imsg(mimap, msg->msgno);
 
     if (!imsg) {
-        g_set_error(err,
-                    LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_ACCESS_ERROR,
-                    _("Error fetching message from IMAP server: %s"),
-                    imap_mbox_handle_get_last_msg(mimap->handle));
-        return FALSE;
+       g_set_error(err,
+                   LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_ACCESS_ERROR,
+                   _("Error fetching message from IMAP server: %s"), 
+                   imap_mbox_handle_get_last_msg(mimap->handle));
+       return FALSE;
     }
 
-    /* look for a part cache */
+   /* look for a part cache */
     section = get_section_for(msg, part);
     pair = get_cache_name_pair(mimap, "part", imsg->uid);
-    part_name = g_strconcat(pair[0], G_DIR_SEPARATOR_S,
-                            pair[1], "-", section, NULL);
-    fp = fopen(part_name, "rb+");
-
-    if (!fp) { /* no cache element */
+    part_name   = g_strconcat(pair[0], G_DIR_SEPARATOR_S,
+                              pair[1], "-", section, NULL);
+    fp = fopen(part_name,"rb+");
+    
+    if(!fp) { /* no cache element */
         struct part_data dt;
         ImapFetchBodyOptions ifbo;
         ImapResponse rc;
@@ -2758,9 +2462,9 @@ lbm_imap_get_msg_part_from_cache(LibBalsaMessage     *msg,
 
         libbalsa_lock_mailbox(msg->mailbox);
         mimap = LIBBALSA_MAILBOX_IMAP(msg->mailbox);
-
-        dt.body = imap_message_get_body_from_section(imsg, section);
-        if (!dt.body) {
+        
+        dt.body  = imap_message_get_body_from_section(imsg, section);
+        if(!dt.body) {
             /* This may happen if we reconnect the data dropping the
                body structures but still try refetching the
                message. This can be simulated by randomly
@@ -2768,53 +2472,50 @@ lbm_imap_get_msg_part_from_cache(LibBalsaMessage     *msg,
             fprintf(stderr, "Cannot find data for section %s\n", section);
             return FALSE;
         }
-        dt.block = g_malloc(dt.body->octets + 1);
-        dt.pos = 0;
-        if (dt.body->octets > SizeMsgThreshold) {
-            libbalsa_information(LIBBALSA_INFORMATION_MESSAGE,
+        dt.block = g_malloc(dt.body->octets+1);
+        dt.pos   = 0;
+        if(dt.body->octets>SizeMsgThreshold)
+            libbalsa_information(LIBBALSA_INFORMATION_MESSAGE, 
                                  _("Downloading %u kB"),
-                                 dt.body->octets / 1024);
-        }
-        /* Imap_mbox_handle_fetch_body fetches the MIME headers of the
+                                 dt.body->octets/1024);
+       /* Imap_mbox_handle_fetch_body fetches the MIME headers of the
          * section, followed by the text. We write this unfiltered to
          * the cache. The probably only exception is the main body
          * which has no headers. In this case, we have to fake them.
-         * We could and probably should dump there first the headers
+         * We could and probably should dump there first the headers 
          * that we have already fetched... */
         parent = get_parent(msg->body_list, part, NULL);
-        if (parent == NULL) {
+        if(parent == NULL)
             ifbo = IMFB_NONE;
-        } else {
-            if (parent->body_type == LIBBALSA_MESSAGE_BODY_TYPE_MESSAGE) {
+        else {
+            if(parent->body_type == LIBBALSA_MESSAGE_BODY_TYPE_MESSAGE)
                 ifbo = IMFB_HEADER;
-            } else {
+            else
                 ifbo = IMFB_MIME;
-            }
         }
         rc = IMR_OK;
-        if (dt.body->octets > 0) {
-            II(rc, mimap->handle,
-               imap_mbox_handle_fetch_body(mimap->handle, msg->msgno,
-                                           section, FALSE, ifbo, append_str, &dt));
-        }
+        if (dt.body->octets > 0)
+        II(rc,mimap->handle,
+           imap_mbox_handle_fetch_body(mimap->handle, msg->msgno,
+                                       section, FALSE, ifbo, append_str, &dt));
         libbalsa_unlock_mailbox(msg->mailbox);
-        if (rc != IMR_OK) {
+        if(rc != IMR_OK) {
             fprintf(stderr, "Error fetching imap message no %lu section %s\n",
                     msg->msgno, section);
             g_free(dt.block);
-            g_free(section);
+            g_free(section); 
             g_strfreev(pair);
             g_free(part_name);
             g_set_error(err,
                         LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_ACCESS_ERROR,
-                        _("Error fetching message from IMAP server: %s"),
+                        _("Error fetching message from IMAP server: %s"), 
                         imap_mbox_handle_get_last_msg(mimap->handle));
             return FALSE;
         }
-        g_mkdir_with_parents(pair[0], S_IRUSR | S_IWUSR | S_IXUSR);
+        g_mkdir_with_parents(pair[0], S_IRUSR|S_IWUSR|S_IXUSR);
         fp = fopen(part_name, "wb+");
-        if (!fp) {
-            g_free(section);
+        if(!fp) {
+            g_free(section); 
             g_strfreev(pair);
             g_free(part_name);
             g_set_error(err,
@@ -2822,61 +2523,58 @@ lbm_imap_get_msg_part_from_cache(LibBalsaMessage     *msg,
                         _("Cannot create temporary file"));
             return FALSE;
         }
-        if ((ifbo == IMFB_NONE) || (dt.body->octets == 0)) {
-            fprintf(fp, "MIME-version: 1.0\r\ncontent-type: %s\r\n"
+        if(ifbo == IMFB_NONE || dt.body->octets == 0) {
+            fprintf(fp,"MIME-version: 1.0\r\ncontent-type: %s\r\n"
                     "Content-Transfer-Encoding: %s\r\n\r\n",
                     part->content_type ? part->content_type : "text/plain",
                     encoding_names(dt.body->encoding));
         }
         /* Carefully save number of bytes actually read from the file. */
-        if (dt.pos) {
-            if ((fwrite(dt.block, 1, dt.pos, fp) != dt.pos)
-                || (fflush(fp) != 0)) {
-                fclose(fp);
-                /* we do not want to have an incomplete part in the cache
-                   so that the user still can try again later when the
-                   problem with writing (disk space?) is removed */
-                unlink(part_name);
-                g_set_error(err,
-                            LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_ACCESS_ERROR,
-                            _("Cannot write to temporary file %s"), part_name);
-                g_free(section);
-                g_strfreev(pair);
-                g_free(part_name);
-                g_free(dt.block);
-                return FALSE; /* something better ? */
+       if (dt.pos) {
+            if(fwrite(dt.block, 1, dt.pos, fp) != dt.pos
+               || fflush(fp) != 0) {
+            fclose(fp);
+            /* we do not want to have an incomplete part in the cache
+               so that the user still can try again later when the
+               problem with writing (disk space?) is removed */
+            unlink(part_name);
+            g_set_error(err,
+                        LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_ACCESS_ERROR,
+                        _("Cannot write to temporary file %s"), part_name);
+            g_free(section); 
+            g_strfreev(pair);
+            g_free(part_name);
+            g_free(dt.block);
+            return FALSE; /* something better ? */
             }
         }
         g_free(dt.block);
-        fseek(fp, 0, SEEK_SET);
+       fseek(fp, 0, SEEK_SET);
     }
     partstream = g_mime_stream_file_new (fp);
 
     {
-        GMimeParser *parser =
+        GMimeParser *parser =  
             g_mime_parser_new_with_stream (partstream);
         part->mime_part = g_mime_parser_construct_part (parser);
         g_object_unref (parser);
     }
     g_object_unref (partstream);
-    g_free(section);
+    g_free(section); 
     g_strfreev(pair);
     g_free(part_name);
 
     return TRUE;
 }
 
-
 /* Recursive helper for libbalsa_mailbox_imap_get_msg_part: ensure that
  * we have a mime_part, and if we are in a multipart/signed or
  * multipart/encrypted, ensure that all needed children are also
  * created. */
 static gboolean
-lbm_imap_get_msg_part(LibBalsaMessage     *msg,
-                      LibBalsaMessageBody *part,
-                      gboolean             need_children,
-                      GMimeObject         *parent_part,
-                      GError             **err)
+lbm_imap_get_msg_part(LibBalsaMessage * msg, LibBalsaMessageBody * part,
+                      gboolean need_children, GMimeObject * parent_part,
+                      GError **err)
 {
     g_return_val_if_fail(part, FALSE);
 
@@ -2884,241 +2582,215 @@ lbm_imap_get_msg_part(LibBalsaMessage     *msg,
         GMimeContentType *type =
             g_mime_content_type_new_from_string(part->content_type);
         if (g_mime_content_type_is_type(type, "multipart", "*")) {
-            if (g_mime_content_type_is_type(type, "multipart", "signed")) {
+            if (g_mime_content_type_is_type(type, "multipart", "signed"))
                 part->mime_part =
                     GMIME_OBJECT(g_mime_multipart_signed_new());
-            } else if (g_mime_content_type_is_type(type, "multipart",
-                                                   "encrypted")) {
+            else if (g_mime_content_type_is_type(type, "multipart",
+                                                 "encrypted"))
                 part->mime_part =
                     GMIME_OBJECT(g_mime_multipart_encrypted_new());
-            } else {
+            else
                 part->mime_part = GMIME_OBJECT(g_mime_multipart_new());
-            }
             g_mime_object_set_content_type(part->mime_part, type);
         } else {
             g_object_unref(type);
-            if (!lbm_imap_get_msg_part_from_cache(msg, part, err)) {
+            if (!lbm_imap_get_msg_part_from_cache(msg, part, err))
                 return FALSE;
-            }
         }
     }
 
     if (parent_part) {
         /* GMime will unref and so will we. */
         g_object_ref(part->mime_part);
-        g_mime_multipart_add(GMIME_MULTIPART(parent_part),
-                             part->mime_part);
+       g_mime_multipart_add(GMIME_MULTIPART(parent_part),
+                            part->mime_part);
     }
 
     if (GMIME_IS_MULTIPART_SIGNED(part->mime_part)
-        || GMIME_IS_MULTIPART_ENCRYPTED(part->mime_part)) {
+        || GMIME_IS_MULTIPART_ENCRYPTED(part->mime_part))
         need_children = TRUE;
-    }
 
     if (need_children) {
-        /* Get the children, if any,... */
+       /* Get the children, if any,... */
         if (GMIME_IS_MULTIPART(part->mime_part)) {
-            if (!lbm_imap_get_msg_part(msg, part->parts, TRUE,
-                                       part->mime_part, err)) {
+            if(!lbm_imap_get_msg_part(msg, part->parts, TRUE,
+                                      part->mime_part, err))
                 return FALSE;
-            }
         }
-        /* ...and siblings. */
-        if (part->next &&
-            !lbm_imap_get_msg_part(msg, part->next, TRUE, parent_part, err)) {
+       /* ...and siblings. */
+        if(part->next &&
+           !lbm_imap_get_msg_part(msg, part->next, TRUE, parent_part, err))
             return FALSE;
-        }
-        /* FIXME if GMIME_IS_MESSAGE_PART? */
+       /* FIXME if GMIME_IS_MESSAGE_PART? */
     }
     return GMIME_IS_PART(part->mime_part)
-           || GMIME_IS_MULTIPART(part->mime_part)
-           || GMIME_IS_MESSAGE_PART(part->mime_part);
+        || GMIME_IS_MULTIPART(part->mime_part)
+       || GMIME_IS_MESSAGE_PART(part->mime_part);
 }
 
-
 static gboolean
-libbalsa_mailbox_imap_get_msg_part(LibBalsaMessage     *msg,
+libbalsa_mailbox_imap_get_msg_part(LibBalsaMessage *msg,
                                    LibBalsaMessageBody *part,
-                                   GError             **err)
+                                   GError **err)
 {
-    if (part->mime_part) {
+    if (part->mime_part)
         return GMIME_IS_PART(part->mime_part)
-               || GMIME_IS_MULTIPART(part->mime_part)
-               || GMIME_IS_MESSAGE_PART(part->mime_part);
-    }
+            || GMIME_IS_MULTIPART(part->mime_part)
+            || GMIME_IS_MESSAGE_PART(part->mime_part);
 
     return lbm_imap_get_msg_part(msg, part, FALSE, NULL, err);
 }
 
-
 /* libbalsa_mailbox_imap_duplicate_msgnos: identify messages with same
    non-empty message-ids. An efficient implementation requires that a
    list of msgids is maintained client side. The algorithm consists of
    four phases:
    a). identify x=largest UID in the message-id hash.
    b). complete the message-id hash from (possibly new) envelopes.
-   c). check for any missing message-ids by fetching the header for
+   c). check for any missing message-ids by fetching the header for 
    UID>x.
-   d). identify duplicates in the message hash. When a duplicate
+   d). identify duplicates in the message hash. When a duplicate 
    is encountered, keep the one with lower MSGNO/UID.
- */
-static GArray *
+*/
+static GArray*
 libbalsa_mailbox_imap_duplicate_msgnos(LibBalsaMailbox *mailbox)
 {
     LibBalsaMailboxImap *mimap = LIBBALSA_MAILBOX_IMAP(mailbox);
     unsigned first_to_fetch = 1;
     GHashTable *dupes;
-    GArray *res;
+    GArray     *res;
     unsigned i;
     /* a+b. */
-    for (i = mimap->msgids->len; i >= 1; i--) {
-        ImapMessage *imsg;
-        gchar *msg_id = g_ptr_array_index(mimap->msgids, i - 1);
-        if (msg_id) {
-            first_to_fetch = i + 1;
+    for(i=mimap->msgids->len; i>=1; i--) {
+       ImapMessage *imsg;
+       gchar *msg_id = g_ptr_array_index(mimap->msgids, i-1);
+       if(msg_id) {
+            first_to_fetch = i+1;
             break;
-        } else {
-            imsg = imap_mbox_handle_get_msg(mimap->handle, i);
-            if (imsg && imsg->envelope) {
-                g_ptr_array_index(mimap->msgids, i - 1) =
-                    g_strdup(imsg->envelope->message_id);
-            }
-        }
+       } else {
+           imsg = imap_mbox_handle_get_msg(mimap->handle, i);
+           if(imsg && imsg->envelope)
+               g_ptr_array_index(mimap->msgids, i-1) =
+                   g_strdup(imsg->envelope->message_id);
+       }
     }
     /* c. */
-    if (imap_mbox_complete_msgids(mimap->handle, mimap->msgids,
-                                  first_to_fetch) != IMR_OK) {
-        return NULL;
-    }
+    if(imap_mbox_complete_msgids(mimap->handle, mimap->msgids,
+                                first_to_fetch) != IMR_OK)
+       return NULL;
     /* d. */
     dupes = g_hash_table_new(g_str_hash, g_str_equal);
-    res = g_array_new(FALSE, FALSE, sizeof(unsigned));
-    for (i = 1; i <= mimap->msgids->len; i++) {
-        gchar *msg_id = g_ptr_array_index(mimap->msgids, i - 1);
-        if (!msg_id) { /* g_warning("msgid not completed %u", i); */
-            continue;
-        }
-        if (!*msg_id || (*msg_id == '\r') || (*msg_id == '\n')) {
-            continue;
-        }
-        if (!g_hash_table_lookup(dupes, msg_id)) {
-            g_hash_table_insert(dupes, msg_id, GINT_TO_POINTER(1));
-        } else {
-            g_array_append_val(res, i);
-        }
+    res   = g_array_new(FALSE, FALSE, sizeof(unsigned));
+    for(i=1; i<=mimap->msgids->len; i++) {
+       gchar *msg_id = g_ptr_array_index(mimap->msgids, i-1);
+       if(!msg_id) { /* g_warning("msgid not completed %u", i); */continue; }
+       if(!*msg_id || *msg_id == '\r' || *msg_id == '\n') continue;
+       if(!g_hash_table_lookup(dupes, msg_id))
+           g_hash_table_insert(dupes, msg_id, GINT_TO_POINTER(1));
+       else {
+           g_array_append_val(res, i);
+       }
     }
     g_hash_table_destroy(dupes);
     printf("total elements: %d\n", res->len);
-    for (i = 0; i < res->len; i++) {
-        printf("%u ", GPOINTER_TO_UINT(g_array_index(res, unsigned, i)));
-    }
+    for(i=0; i<res->len; i++)
+       printf("%u ", GPOINTER_TO_UINT(g_array_index(res, unsigned, i)));
     puts("");
     return res;
 }
 
-
-/** Adds given set of messages to given imap mailbox.
+/** Adds given set of messages to given imap mailbox. 
     Method can be called on a closed mailbox.
     Called with mailbox locked.
- */
+*/
 #if 0
 static guint
-libbalsa_mailbox_imap_add_messages(LibBalsaMailbox           *mailbox,
-                                   LibBalsaAddMessageIterator msg_iterator,
-                                   void                      *arg,
-                                   GError                   **err)
+libbalsa_mailbox_imap_add_messages(LibBalsaMailbox * mailbox,
+                                  LibBalsaAddMessageIterator msg_iterator,
+                                  void *arg, GError ** err)
 {
     LibBalsaMailboxImap *mimap = LIBBALSA_MAILBOX_IMAP(mailbox);
     LibBalsaMessageFlag flags;
     GMimeStream *stream;
     unsigned successfully_copied = 0;
 
-    while ( msg_iterator(&flags, &stream, arg)) {
-        ImapMsgFlags imap_flags = IMAP_FLAGS_EMPTY;
-        ImapResponse rc;
-        GMimeStream *tmpstream;
-        GMimeFilter *crlffilter;
-        ImapMboxHandle *handle;
-        gint outfd;
-        gchar *outfile;
-        GMimeStream *outstream;
-        gssize len;
-
-        if (!(flags & LIBBALSA_MESSAGE_FLAG_NEW)) {
-            IMSG_FLAG_SET(imap_flags, IMSGF_SEEN);
-        }
-        if (flags & LIBBALSA_MESSAGE_FLAG_DELETED) {
-            IMSG_FLAG_SET(imap_flags, IMSGF_DELETED);
-        }
-        if (flags & LIBBALSA_MESSAGE_FLAG_FLAGGED) {
-            IMSG_FLAG_SET(imap_flags, IMSGF_FLAGGED);
-        }
-        if (flags & LIBBALSA_MESSAGE_FLAG_REPLIED) {
-            IMSG_FLAG_SET(imap_flags, IMSGF_ANSWERED);
-        }
-
-        tmpstream = g_mime_stream_filter_new(stream);
-
-        crlffilter =
-            g_mime_filter_crlf_new(TRUE,
-                                   FALSE);
-        g_mime_stream_filter_add(GMIME_STREAM_FILTER(tmpstream), crlffilter);
-        g_object_unref(crlffilter);
-
-        outfd = g_file_open_tmp("balsa-tmp-file-XXXXXX", &outfile, err);
-        if (outfd < 0) {
-            g_warning("Could not create temporary file: %s", (*err)->message);
-            g_object_unref(tmpstream);
-            g_object_unref(stream);
-            return successfully_copied;
-        }
-
-        handle = libbalsa_mailbox_imap_get_handle(mimap, err);
-        if (!handle) {
-            /* Perhaps the mailbox was closed and the authentication
-               failed or was cancelled? err is set already, we just
-               return. */
-            return successfully_copied;
-        }
-
-        outstream = g_mime_stream_fs_new(outfd);
-        libbalsa_mime_stream_shared_lock(stream);
-        g_mime_stream_write_to_stream(tmpstream, outstream);
-        libbalsa_mime_stream_shared_unlock(stream);
-        g_object_unref(tmpstream);
-        g_object_unref(stream);
-
-        len = g_mime_stream_tell(outstream);
-        g_mime_stream_reset(outstream);
-
-        if (len > (signed) SizeMsgThreshold) {
-            libbalsa_information(LIBBALSA_INFORMATION_MESSAGE,
-                                 _("Uploading %ld kB"), (long) len / 1024);
-        }
-        rc = imap_mbox_append_stream(handle, mimap->path,
-                                     imap_flags, outstream, len);
-        if (rc != IMR_OK) {
-            gchar *msg = imap_mbox_handle_get_last_msg(handle);
-            g_set_error(err, LIBBALSA_MAILBOX_ERROR,
-                        LIBBALSA_MAILBOX_APPEND_ERROR, "%s", msg);
-            g_free(msg);
-        }
-        libbalsa_mailbox_imap_release_handle(mimap);
-
-        g_object_unref(outstream);
-        unlink(outfile);
-        g_free(outfile);
-
-        if (rc != IMR_OK) {
-            return successfully_copied;
-        }
-
-        successfully_copied++;
+    while( msg_iterator(&flags, &stream, arg) ) {
+       ImapMsgFlags imap_flags = IMAP_FLAGS_EMPTY;
+       ImapResponse rc;
+       GMimeStream *tmpstream;
+       GMimeFilter *crlffilter;
+       ImapMboxHandle *handle;
+       gint outfd;
+       gchar *outfile;
+       GMimeStream *outstream;
+       gssize len;
+
+       if (!(flags & LIBBALSA_MESSAGE_FLAG_NEW))
+           IMSG_FLAG_SET(imap_flags, IMSGF_SEEN);
+       if (flags & LIBBALSA_MESSAGE_FLAG_DELETED)
+           IMSG_FLAG_SET(imap_flags, IMSGF_DELETED);
+       if (flags & LIBBALSA_MESSAGE_FLAG_FLAGGED)
+           IMSG_FLAG_SET(imap_flags, IMSGF_FLAGGED);
+       if (flags & LIBBALSA_MESSAGE_FLAG_REPLIED)
+           IMSG_FLAG_SET(imap_flags, IMSGF_ANSWERED);
+
+       tmpstream = g_mime_stream_filter_new(stream);
+
+       crlffilter =
+           g_mime_filter_crlf_new(TRUE,
+                                  FALSE);
+       g_mime_stream_filter_add(GMIME_STREAM_FILTER(tmpstream), crlffilter);
+       g_object_unref(crlffilter);
+
+       outfd = g_file_open_tmp("balsa-tmp-file-XXXXXX", &outfile, err);
+       if (outfd < 0) {
+           g_warning("Could not create temporary file: %s", (*err)->message);
+           g_object_unref(tmpstream);
+           g_object_unref(stream);
+           return successfully_copied;
+       }
+
+       handle = libbalsa_mailbox_imap_get_handle(mimap, err);
+       if (!handle)
+           /* Perhaps the mailbox was closed and the authentication
+              failed or was cancelled? err is set already, we just
+              return. */
+           return successfully_copied;
+
+       outstream = g_mime_stream_fs_new(outfd);
+       libbalsa_mime_stream_shared_lock(stream);
+       g_mime_stream_write_to_stream(tmpstream, outstream);
+       libbalsa_mime_stream_shared_unlock(stream);
+       g_object_unref(tmpstream);
+       g_object_unref(stream);
+
+       len = g_mime_stream_tell(outstream);
+       g_mime_stream_reset(outstream);
+
+       if (len > (signed) SizeMsgThreshold)
+           libbalsa_information(LIBBALSA_INFORMATION_MESSAGE,
+                                _("Uploading %ld kB"), (long) len / 1024);
+       rc = imap_mbox_append_stream(handle, mimap->path,
+                                    imap_flags, outstream, len);
+       if (rc != IMR_OK) {
+           gchar *msg = imap_mbox_handle_get_last_msg(handle);
+           g_set_error(err, LIBBALSA_MAILBOX_ERROR,
+                       LIBBALSA_MAILBOX_APPEND_ERROR, "%s", msg);
+           g_free(msg);
+       }
+       libbalsa_mailbox_imap_release_handle(mimap);
+
+       g_object_unref(outstream);
+       unlink(outfile);
+       g_free(outfile);
+
+       if(rc != IMR_OK)
+           return successfully_copied;
+
+       successfully_copied++;
     }
     return successfully_copied;
 }
-
-
 #else
 
 struct MultiAppendCbData {
@@ -3133,116 +2805,104 @@ struct MultiAppendCbData {
 static void
 macd_clear(struct MultiAppendCbData *macd)
 {
-    if (macd->outstream) {
-        g_object_unref(macd->outstream);
-        macd->outstream = NULL;
+    if(macd->outstream) {
+       g_object_unref(macd->outstream);
+       macd->outstream = NULL;
     }
 }
 
-
 static void
 macd_destroy(struct MultiAppendCbData *macd)
 {
     GList *outmsgs;
-    for (outmsgs = macd->outfiles; outmsgs; outmsgs = outmsgs->next) {
-        unlink(outmsgs->data);
-        g_free(outmsgs->data);
+    for(outmsgs = macd->outfiles; outmsgs; outmsgs = outmsgs->next) {
+       unlink(outmsgs->data);
+       g_free(outmsgs->data);
     }
     g_list_free(macd->outfiles);
 }
 
-
 static size_t
-multi_append_cb(char                *buf,
-                size_t               buflen,
-                ImapAppendMultiStage stage,
-                ImapMsgFlags        *return_flags,
-                void                *arg)
+multi_append_cb(char * buf, size_t buflen,
+               ImapAppendMultiStage stage,
+               ImapMsgFlags *return_flags, void *arg)
 {
-    struct MultiAppendCbData *macd = (struct MultiAppendCbData *)arg;
+    struct MultiAppendCbData *macd = (struct MultiAppendCbData*)arg;
 
-    switch (stage) {
+    switch(stage) {
     case IMA_STAGE_NEW_MSG: {
-        ImapMsgFlags imap_flags = IMAP_FLAGS_EMPTY;
-        GMimeStream *tmpstream;
-        GMimeFilter *crlffilter;
-        gint outfd;
-        GMimeStream *stream = NULL;
-        gint64 len;
-        LibBalsaMessageFlag flags;
-        GError **err = macd->err;
-        gchar *outf = NULL;
-
-        macd_clear(macd);
-
-        while ( macd->msg_iterator(&flags, &stream, macd->iterator_data) &&
-                !stream) {
-        }
-
-        if (!stream) { /* No more messages to append! */
-            return 0;
-        }
-
-        if (!(flags & LIBBALSA_MESSAGE_FLAG_NEW)) {
-            IMSG_FLAG_SET(imap_flags, IMSGF_SEEN);
-        }
-        if (flags & LIBBALSA_MESSAGE_FLAG_DELETED) {
-            IMSG_FLAG_SET(imap_flags, IMSGF_DELETED);
-        }
-        if (flags & LIBBALSA_MESSAGE_FLAG_FLAGGED) {
-            IMSG_FLAG_SET(imap_flags, IMSGF_FLAGGED);
-        }
-        if (flags & LIBBALSA_MESSAGE_FLAG_REPLIED) {
-            IMSG_FLAG_SET(imap_flags, IMSGF_ANSWERED);
-        }
-
-        tmpstream = g_mime_stream_filter_new(stream);
-
-        crlffilter =
-            g_mime_filter_crlf_new(TRUE,
-                                   FALSE);
-        g_mime_stream_filter_add(GMIME_STREAM_FILTER(tmpstream), crlffilter);
-        g_object_unref(crlffilter);
-
-        outfd = g_file_open_tmp("balsa-tmp-file-XXXXXX", &outf, err);
-        if (outfd < 0) {
-            g_warning("Could not create temporary file: %s", (*err)->message);
-            g_object_unref(tmpstream);
-            g_object_unref(stream);
-            return 0;
-        }
-
-        macd->outstream = g_mime_stream_fs_new(outfd);
-        macd->outfiles = g_list_append(macd->outfiles, outf);
-        libbalsa_mime_stream_shared_lock(stream);
-        g_mime_stream_write_to_stream(tmpstream, macd->outstream);
-        libbalsa_mime_stream_shared_unlock(stream);
-        g_object_unref(tmpstream);
-        g_object_unref(stream);
-
-        len = g_mime_stream_tell(macd->outstream);
-        g_mime_stream_reset(macd->outstream);
-
-        if (len > (signed) SizeMsgThreshold) {
-            libbalsa_information(LIBBALSA_INFORMATION_MESSAGE,
+       ImapMsgFlags imap_flags = IMAP_FLAGS_EMPTY;
+       GMimeStream *tmpstream;
+       GMimeFilter *crlffilter;
+       gint outfd;
+       GMimeStream *stream = NULL;
+       gint64 len;
+       LibBalsaMessageFlag flags;
+       GError**err = macd->err;
+       gchar *outf = NULL;
+
+       macd_clear(macd);
+
+       while( macd->msg_iterator(&flags, &stream, macd->iterator_data) &&
+              !stream)
+           ;
+
+       if(!stream) /* No more messages to append! */
+           return 0;
+
+       if (!(flags & LIBBALSA_MESSAGE_FLAG_NEW))
+           IMSG_FLAG_SET(imap_flags, IMSGF_SEEN);
+       if (flags & LIBBALSA_MESSAGE_FLAG_DELETED)
+           IMSG_FLAG_SET(imap_flags, IMSGF_DELETED);
+       if (flags & LIBBALSA_MESSAGE_FLAG_FLAGGED)
+           IMSG_FLAG_SET(imap_flags, IMSGF_FLAGGED);
+       if (flags & LIBBALSA_MESSAGE_FLAG_REPLIED)
+           IMSG_FLAG_SET(imap_flags, IMSGF_ANSWERED);
+
+       tmpstream = g_mime_stream_filter_new(stream);
+
+       crlffilter =
+           g_mime_filter_crlf_new(TRUE,
+                                  FALSE);
+       g_mime_stream_filter_add(GMIME_STREAM_FILTER(tmpstream), crlffilter);
+       g_object_unref(crlffilter);
+
+       outfd = g_file_open_tmp("balsa-tmp-file-XXXXXX", &outf, err);
+       if (outfd < 0) {
+           g_warning("Could not create temporary file: %s", (*err)->message);
+           g_object_unref(tmpstream);
+           g_object_unref(stream);
+           return 0;
+       }
+
+       macd->outstream = g_mime_stream_fs_new(outfd);
+       macd->outfiles = g_list_append(macd->outfiles, outf);
+       libbalsa_mime_stream_shared_lock(stream);
+       g_mime_stream_write_to_stream(tmpstream, macd->outstream);
+       libbalsa_mime_stream_shared_unlock(stream);
+       g_object_unref(tmpstream);
+       g_object_unref(stream);
+
+       len = g_mime_stream_tell(macd->outstream);
+       g_mime_stream_reset(macd->outstream);
+
+       if (len > (signed) SizeMsgThreshold)
+           libbalsa_information(LIBBALSA_INFORMATION_MESSAGE,
                                  _("Uploading %ld kB"),
                                  (long int) ((len + 512) / 1024));
-        }
 
-        *return_flags = imap_flags;
-        macd->copied++;
-        return g_mime_stream_length(macd->outstream);
+       *return_flags = imap_flags;
+       macd->copied++;
+       return g_mime_stream_length(macd->outstream);
     }
-    break;
-
+       break;
     case IMA_STAGE_PASS_DATA:
-        return g_mime_stream_read(macd->outstream, buf, buflen);
+       return g_mime_stream_read(macd->outstream, buf, buflen);
     }
     g_assert_not_reached();
     return 0;
 }
 
-
 struct append_to_cache_data {
     const gchar *user, *host, *path, *cache_dir;
     GList *curr_name;
@@ -3250,51 +2910,44 @@ struct append_to_cache_data {
 };
 
 static void
-create_cache_copy(const gchar *src,
-                  const gchar *cache_dir,
-                  const gchar *name)
+create_cache_copy(const gchar *src, const gchar *cache_dir, const gchar *name)
 {
     gchar *fname = libbalsa_urlencode(name);
     gchar *dst = g_build_filename(cache_dir, fname, NULL);
-    if (link(src, dst) != 0) {
-        /* Link failed possibly because the two caches reside on
-           different file systems. We attempt to copy the cache instead. */
-        FILE *in = fopen(src, "r");
-
-        if (in) {
-            FILE *out = fopen(dst, "w");
-            if (out) {
-                size_t sz;
-                char buf[65536];
-                gboolean err;
-                while ((sz = fread(buf, 1, sizeof(buf), in)) > 0) {
-                    if (fwrite(buf, 1, sz, out) != sz) {
-                        break;
-                    }
-                }
-                err = ferror(in) || ferror(out);
-                fclose(out);
-                if (err) {
-                    unlink(dst);
-                }
-            }
-            fclose(in);
-        }
+    if(link(src, dst) != 0) {
+       /* Link failed possibly because the two caches reside on
+          different file systems. We attempt to copy the cache instead. */
+       FILE *in  = fopen(src, "r");
+
+       if(in) {
+           FILE *out = fopen(dst, "w");
+           if(out) {
+               size_t sz;
+               char buf[65536];
+               gboolean err;
+               while( (sz=fread(buf, 1, sizeof(buf), in)) > 0)
+                   if(fwrite(buf, 1, sz, out) != sz)
+                       break;
+               err = ferror(in) || ferror(out);
+               fclose(out);
+               if(err)
+                   unlink(dst);
+           }
+           fclose(in);
+       }
     }
     g_free(fname);
     g_free(dst);
 }
 
-
 static void
-append_to_cache(unsigned uid,
-                void    *arg)
+append_to_cache(unsigned uid, void *arg)
 {
-    struct append_to_cache_data *atcd = (struct append_to_cache_data *)arg;
+    struct append_to_cache_data *atcd = (struct append_to_cache_data*)arg;
     gchar *name = g_strdup_printf("%s@%s-%s-%u-%u-%s",
-                                  atcd->user, atcd->host, atcd->path,
-                                  atcd->uid_validity,
-                                  uid, "body");
+                                 atcd->user, atcd->host, atcd->path,
+                                 atcd->uid_validity,
+                                 uid, "body");
     gchar *msg = atcd->curr_name->data;
 
     atcd->curr_name = atcd->curr_name->next;
@@ -3305,12 +2958,10 @@ append_to_cache(unsigned uid,
     g_free(name);
 }
 
-
 static guint
-libbalsa_mailbox_imap_add_messages(LibBalsaMailbox           *mailbox,
-                                   LibBalsaAddMessageIterator msg_iterator,
-                                   void                      *arg,
-                                   GError                   **err)
+libbalsa_mailbox_imap_add_messages(LibBalsaMailbox * mailbox,
+                                  LibBalsaAddMessageIterator msg_iterator,
+                                  void *arg, GError ** err)
 {
     LibBalsaMailboxImap *mimap = LIBBALSA_MAILBOX_IMAP(mailbox);
     ImapMboxHandle *handle = libbalsa_mailbox_imap_get_handle(mimap, err);
@@ -3319,10 +2970,10 @@ libbalsa_mailbox_imap_add_messages(LibBalsaMailbox           *mailbox,
     ImapSequence uid_sequence;
 
     if (!handle) {
-        /* Perhaps the mailbox was closed and the authentication
-           failed or was cancelled? err is set already, we just
-           return. */
-        return 0;
+       /* Perhaps the mailbox was closed and the authentication
+          failed or was cancelled? err is set already, we just
+          return. */
+       return 0;
     }
 
     macd.msg_iterator = msg_iterator;
@@ -3332,93 +2983,78 @@ libbalsa_mailbox_imap_add_messages(LibBalsaMailbox           *mailbox,
     macd.err = err;
     macd.copied = 0;
     imap_sequence_init(&uid_sequence);
-    rc = imap_mbox_append_multi(handle, mimap->path,
-                                multi_append_cb, &macd, &uid_sequence);
+    rc = imap_mbox_append_multi(handle,        mimap->path,
+                               multi_append_cb, &macd, &uid_sequence);
     libbalsa_mailbox_imap_release_handle(mimap);
     macd_clear(&macd);
 
-    if (!imap_sequence_empty(&uid_sequence) &&
-        (g_list_length(macd.outfiles) == imap_sequence_length(&uid_sequence))) {
-        /* Hurray, server returned UID data on appended messages! */
-        LibBalsaServer *s = LIBBALSA_MAILBOX_REMOTE(mailbox)->server;
-        LibBalsaImapServer *is = LIBBALSA_IMAP_SERVER(s);
-        gboolean is_persistent = libbalsa_imap_server_has_persistent_cache(is);
-        struct append_to_cache_data atcd;
-        gchar *cache_dir;
-
-        atcd.user = s->user;
-        atcd.host = s->host;
-        atcd.path = mimap->path ? mimap->path : "INBOX";
-        atcd.cache_dir = cache_dir = get_cache_dir(is_persistent);
-        atcd.curr_name = macd.outfiles;
-        atcd.uid_validity = uid_sequence.uid_validity;
-
-        imap_sequence_foreach(&uid_sequence, append_to_cache, &atcd);
-        imap_sequence_release(&uid_sequence);
-        g_free(cache_dir);
+    if(!imap_sequence_empty(&uid_sequence) &&
+       g_list_length(macd.outfiles) == imap_sequence_length(&uid_sequence)) {
+       /* Hurray, server returned UID data on appended messages! */
+       LibBalsaServer *s      = LIBBALSA_MAILBOX_REMOTE(mailbox)->server;
+       LibBalsaImapServer *is = LIBBALSA_IMAP_SERVER(s);
+       gboolean is_persistent = libbalsa_imap_server_has_persistent_cache(is);
+       struct append_to_cache_data atcd;
+       gchar *cache_dir;
+
+       atcd.user = s->user;
+       atcd.host = s->host;
+       atcd.path = mimap->path ? mimap->path : "INBOX";
+       atcd.cache_dir = cache_dir = get_cache_dir(is_persistent);
+       atcd.curr_name = macd.outfiles;
+       atcd.uid_validity = uid_sequence.uid_validity;
+
+       imap_sequence_foreach(&uid_sequence, append_to_cache, &atcd);
+       imap_sequence_release(&uid_sequence);
+       g_free(cache_dir);
     }
 
     macd_destroy(&macd);
     return rc == IMR_OK ? macd.copied : 0;
 }
-
-
 #endif
 
 static void
-transform_flags(LibBalsaMessageFlag set,
-                LibBalsaMessageFlag clr,
-                ImapMsgFlag        *flg_set,
-                ImapMsgFlag        *flg_clr)
+transform_flags(LibBalsaMessageFlag set, LibBalsaMessageFlag clr,
+                ImapMsgFlag *flg_set, ImapMsgFlag *flg_clr)
 {
     *flg_set = 0;
     *flg_clr = 0;
 
-    if (set & LIBBALSA_MESSAGE_FLAG_REPLIED) {
+    if (set & LIBBALSA_MESSAGE_FLAG_REPLIED)
         *flg_set |= IMSGF_ANSWERED;
-    }
-    if (clr & LIBBALSA_MESSAGE_FLAG_REPLIED) {
-        *flg_clr |= IMSGF_ANSWERED;
-    }
-    if (set & LIBBALSA_MESSAGE_FLAG_NEW) {
-        *flg_clr |= IMSGF_SEEN;
-    }
-    if (clr & LIBBALSA_MESSAGE_FLAG_NEW) {
-        *flg_set |= IMSGF_SEEN;
-    }
-    if (set & LIBBALSA_MESSAGE_FLAG_FLAGGED) {
-        *flg_set |= IMSGF_FLAGGED;
-    }
-    if (clr & LIBBALSA_MESSAGE_FLAG_FLAGGED) {
-        *flg_clr |= IMSGF_FLAGGED;
-    }
-    if (set & LIBBALSA_MESSAGE_FLAG_DELETED) {
-        *flg_set |= IMSGF_DELETED;
-    }
-    if (clr & LIBBALSA_MESSAGE_FLAG_DELETED) {
-        *flg_clr |= IMSGF_DELETED;
-    }
+    if (clr & LIBBALSA_MESSAGE_FLAG_REPLIED)
+       *flg_clr |= IMSGF_ANSWERED;
+    if (set & LIBBALSA_MESSAGE_FLAG_NEW)
+       *flg_clr |= IMSGF_SEEN;
+    if (clr & LIBBALSA_MESSAGE_FLAG_NEW)
+       *flg_set |= IMSGF_SEEN;
+    if (set & LIBBALSA_MESSAGE_FLAG_FLAGGED)
+       *flg_set |= IMSGF_FLAGGED;
+    if (clr & LIBBALSA_MESSAGE_FLAG_FLAGGED)
+       *flg_clr |= IMSGF_FLAGGED;
+    if (set & LIBBALSA_MESSAGE_FLAG_DELETED)
+       *flg_set |= IMSGF_DELETED;
+    if (clr & LIBBALSA_MESSAGE_FLAG_DELETED)
+       *flg_clr |= IMSGF_DELETED;
 }
 
-
 static void
-lbm_imap_change_user_flags(LibBalsaMailbox    *mailbox,
-                           GArray             *seqno,
+lbm_imap_change_user_flags(LibBalsaMailbox * mailbox, GArray * seqno,
                            LibBalsaMessageFlag set,
-                           LibBalsaMessageFlag clear)
+                          LibBalsaMessageFlag clear)
 {
     gint i;
     LibBalsaMailboxImap *mimap = LIBBALSA_MAILBOX_IMAP(mailbox);
 
-    set &= ~LIBBALSA_MESSAGE_FLAGS_REAL;
+    set   &= ~LIBBALSA_MESSAGE_FLAGS_REAL;
     clear &= ~LIBBALSA_MESSAGE_FLAGS_REAL;
-    if (!set && !clear) {
-        return;
-    }
+    if (!set && !clear)
+       return;
 
-    for (i = seqno->len; --i >= 0; ) {
-        guint msgno = g_array_index(seqno, guint, i);
-        struct message_info *msg_info =
+    for (i = seqno->len; --i >= 0;) {
+       guint msgno = g_array_index(seqno, guint, i);
+        struct message_info *msg_info = 
             message_info_from_msgno(mimap, msgno);
         if (msg_info) {
             msg_info->user_flags |= set;
@@ -3427,26 +3063,21 @@ lbm_imap_change_user_flags(LibBalsaMailbox    *mailbox,
     }
 }
 
-
 static gboolean
-lbm_imap_messages_change_flags(LibBalsaMailbox    *mailbox,
-                               GArray             *seqno,
-                               LibBalsaMessageFlag set,
-                               LibBalsaMessageFlag clear)
+lbm_imap_messages_change_flags(LibBalsaMailbox * mailbox, GArray * seqno,
+                              LibBalsaMessageFlag set,
+                              LibBalsaMessageFlag clear)
 {
     ImapMsgFlag flag_set, flag_clr;
     ImapResponse rc = IMR_OK;
     ImapMboxHandle *handle = LIBBALSA_MAILBOX_IMAP(mailbox)->handle;
 
-    if (seqno->len == 0) {
-        return TRUE;
-    }
+    if(seqno->len == 0) return TRUE;
     lbm_imap_change_user_flags(mailbox, seqno, set, clear);
 
-    if (!((set | clear) & LIBBALSA_MESSAGE_FLAGS_REAL)) {
-        /* No real flags. */
-        return TRUE;
-    }
+    if (!((set | clear) & LIBBALSA_MESSAGE_FLAGS_REAL))
+       /* No real flags. */
+       return TRUE;
 
     g_array_sort(seqno, cmp_msgno);
     transform_flags(set, clear, &flag_set, &flag_clr);
@@ -3454,25 +3085,21 @@ lbm_imap_messages_change_flags(LibBalsaMailbox    *mailbox,
        to unsolicited EXPUNGE responses are resolved. The issues are
        pretty much of a theoretical character but we do not want to
        risk the mail store integrity, do we? */
-    if (flag_set) {
+    if (flag_set)
         II(rc, handle,
            imap_mbox_store_flag(handle,
                                 seqno->len, (guint *) seqno->data,
                                 flag_set, TRUE));
-    }
-    if (rc && flag_clr) {
+    if (rc && flag_clr)
         II(rc, handle,
            imap_mbox_store_flag(handle,
                                 seqno->len, (guint *) seqno->data,
                                 flag_clr, FALSE));
-    }
     return rc == IMR_OK;
 }
 
-
 static gboolean
-libbalsa_mailbox_imap_msgno_has_flags(LibBalsaMailbox    *m,
-                                      unsigned            msgno,
+libbalsa_mailbox_imap_msgno_has_flags(LibBalsaMailbox * m, unsigned msgno,
                                       LibBalsaMessageFlag set,
                                       LibBalsaMessageFlag unset)
 {
@@ -3481,22 +3108,20 @@ libbalsa_mailbox_imap_msgno_has_flags(LibBalsaMailbox    *m,
     LibBalsaMailboxImap *mimap = LIBBALSA_MAILBOX_IMAP(m);
     ImapMboxHandle *handle;
 
-    user_set = set & ~LIBBALSA_MESSAGE_FLAGS_REAL;
+    user_set   = set   & ~LIBBALSA_MESSAGE_FLAGS_REAL;
     user_unset = unset & ~LIBBALSA_MESSAGE_FLAGS_REAL;
     if (user_set || user_unset) {
         struct message_info *msg_info =
             message_info_from_msgno(mimap, msgno);
         if (!msg_info ||
-            ((msg_info->user_flags & user_set) != user_set) ||
-            ((msg_info->user_flags & user_unset) != 0)) {
+            (msg_info->user_flags & user_set) != user_set ||
+            (msg_info->user_flags & user_unset) != 0)
             return FALSE;
-        }
     }
 
     transform_flags(set, unset, &flag_set, &flag_unset);
-    if (!flag_set && !flag_unset) {
+    if (!flag_set && !flag_unset)
         return TRUE;
-    }
 
     handle = mimap->handle;
     g_return_val_if_fail(handle, FALSE);
@@ -3504,31 +3129,26 @@ libbalsa_mailbox_imap_msgno_has_flags(LibBalsaMailbox    *m,
                                             flag_unset);
 }
 
-
 static gboolean
-libbalsa_mailbox_imap_can_do(LibBalsaMailbox               *mbox,
+libbalsa_mailbox_imap_can_do(LibBalsaMailbox* mbox,
                              enum LibBalsaMailboxCapability c)
 {
     LibBalsaMailboxImap *mimap;
-    if (!mbox) {
+    if(!mbox)
         return TRUE;
-    }
     mimap = LIBBALSA_MAILBOX_IMAP(mbox);
-    switch (c) {
+    switch(c) {
 #if !ENABLE_CLIENT_SIDE_SORT
     case LIBBALSA_MAILBOX_CAN_SORT:
         return imap_mbox_handle_can_do(mimap->handle, IMCAP_SORT);
-
 #endif
     case LIBBALSA_MAILBOX_CAN_THREAD:
         return imap_mbox_handle_can_do(mimap->handle, IMCAP_THREAD_REFERENCES);
-
     default:
         return TRUE;
     }
 }
 
-
 static ImapSortKey
 lbmi_get_imap_sort_key(LibBalsaMailbox *mbox)
 {
@@ -3536,93 +3156,76 @@ lbmi_get_imap_sort_key(LibBalsaMailbox *mbox)
 
     switch (mbox->view->sort_field) {
     default:
-    case LB_MAILBOX_SORT_NO:      key = IMSO_MSGNO;
-        break;
-
-    case LB_MAILBOX_SORT_SENDER:
+    case LB_MAILBOX_SORT_NO:     key = IMSO_MSGNO;   break;
+    case LB_MAILBOX_SORT_SENDER:    
         key = mbox->view->show == LB_MAILBOX_SHOW_TO
-            ? IMSO_TO : IMSO_FROM;
-        break;
-
-    case LB_MAILBOX_SORT_SUBJECT: key = IMSO_SUBJECT;
-        break;
-
-    case LB_MAILBOX_SORT_DATE:    key = IMSO_DATE;
-        break;
-
-    case LB_MAILBOX_SORT_SIZE:    key = IMSO_SIZE;
-        break;
+            ? IMSO_TO : IMSO_FROM;                   break;
+    case LB_MAILBOX_SORT_SUBJECT: key = IMSO_SUBJECT; break;
+    case LB_MAILBOX_SORT_DATE:    key = IMSO_DATE;    break;
+    case LB_MAILBOX_SORT_SIZE:    key = IMSO_SIZE;    break;
     }
 
     return key;
 }
-
-
+     
 static void
-libbalsa_mailbox_imap_set_threading(LibBalsaMailbox             *mailbox,
-                                    LibBalsaMailboxThreadingType thread_type)
+libbalsa_mailbox_imap_set_threading(LibBalsaMailbox *mailbox,
+                                   LibBalsaMailboxThreadingType thread_type)
 {
     LibBalsaMailboxImap *mimap = LIBBALSA_MAILBOX_IMAP(mailbox);
-    GNode *new_tree = NULL;
+    GNode * new_tree = NULL;
     guint msgno;
     ImapSearchKey *filter = lbmi_build_imap_query(mailbox->view_filter, NULL);
     ImapResponse rc;
-
+    
     mailbox->view->threading_type = thread_type;
-    switch (thread_type) {
+    switch(thread_type) {
     case LB_MAILBOX_THREADING_SIMPLE:
     case LB_MAILBOX_THREADING_JWZ:
-        II(rc, mimap->handle,
+        II(rc,mimap->handle,
            imap_mbox_thread(mimap->handle, "REFERENCES", filter));
-        if (rc == IMR_OK) {
+        if(rc == IMR_OK) {
             new_tree =
                 g_node_copy(imap_mbox_handle_get_thread_root(mimap->handle));
             break;
-        } else {
+        } else 
             libbalsa_information(LIBBALSA_INFORMATION_WARNING,
-                                 _("Server-side threading not supported."));
-        }
-
-    /* fall through */
+                            _("Server-side threading not supported."));
+        /* fall through */
     case LB_MAILBOX_THREADING_FLAT:
-        if (filter) {
-            II(rc, mimap->handle,
+        if(filter) {
+            II(rc,mimap->handle,
                imap_mbox_sort_filter(mimap->handle,
                                      lbmi_get_imap_sort_key(mailbox),
                                      mailbox->view->sort_type ==
                                      LB_MAILBOX_SORT_TYPE_ASC,
                                      filter));
-            if (rc == IMR_OK) {
+            if(rc == IMR_OK)
                 new_tree =
                     g_node_copy
-                        (imap_mbox_handle_get_thread_root(mimap->handle));
-            }
+                    (imap_mbox_handle_get_thread_root(mimap->handle));
         }
-        if (!new_tree) { /* fall back */
+        if(!new_tree) { /* fall back */
             new_tree = g_node_new(NULL);
-            for (msgno = 1; msgno <= mimap->messages_info->len; msgno++) {
+            for(msgno = 1; msgno <= mimap->messages_info->len; msgno++)
                 g_node_append_data(new_tree, GUINT_TO_POINTER(msgno));
-            }
         }
         break;
-
     default:
-        g_assert_not_reached();
-        new_tree = NULL;
+       g_assert_not_reached();
+       new_tree = NULL;
     }
     imap_search_key_free(filter);
 
     libbalsa_mailbox_set_msg_tree(mailbox, new_tree);
 }
 
-
 static void
 lbm_imap_update_view_filter(LibBalsaMailbox   *mailbox,
                             LibBalsaCondition *view_filter)
 {
 }
 
-
 /* Sorting
  *
  * To avoid multiple server queries when the view is threaded, we sort
@@ -3634,9 +3237,9 @@ lbm_imap_update_view_filter(LibBalsaMailbox   *mailbox,
  * (set to -1) whenever the cached ranks might be out of date.
  */
 static gint
-lbmi_compare_func(const SortTuple     *a,
-                  const SortTuple     *b,
-                  LibBalsaMailboxImap *mimap)
+lbmi_compare_func(const SortTuple * a,
+                 const SortTuple * b,
+                 LibBalsaMailboxImap * mimap)
 {
     unsigned seqnoa, seqnob;
     int retval;
@@ -3647,53 +3250,48 @@ lbmi_compare_func(const SortTuple     *a,
     seqnob = GPOINTER_TO_UINT(b->node->data);
     g_assert(seqnob <= mimap->sort_ranks->len);
     retval = g_array_index(mimap->sort_ranks, guint, seqnoa - 1) -
-        g_array_index(mimap->sort_ranks, guint, seqnob - 1);
+       g_array_index(mimap->sort_ranks, guint, seqnob - 1);
 
     return mbox->view->sort_type == LB_MAILBOX_SORT_TYPE_ASC ?
-           retval : -retval;
+        retval : -retval;
 }
 
-
 static void
-libbalsa_mailbox_imap_sort(LibBalsaMailbox *mbox,
-                           GArray          *array)
+libbalsa_mailbox_imap_sort(LibBalsaMailbox *mbox, GArray *array)
 {
     LibBalsaMailboxImap *mimap;
 
     mimap = LIBBALSA_MAILBOX_IMAP(mbox);
     if (mimap->sort_field != mbox->view->sort_field) {
-        /* Cached ranks are invalid. */
+       /* Cached ranks are invalid. */
         unsigned *msgno_arr;
         guint i, len;
 
         len = mimap->messages_info->len;
         msgno_arr = g_malloc(len * sizeof(unsigned));
-        for (i = 0; i < len; i++) {
+        for (i = 0; i < len; i++)
             msgno_arr[i] = i + 1;
-        }
         if (mbox->view->sort_field != LB_MAILBOX_SORT_NO) {
             ImapResponse rc;
-            /* Server-side sort of the whole mailbox. */
+           /* Server-side sort of the whole mailbox. */
             II(rc, LIBBALSA_MAILBOX_IMAP(mbox)->handle,
                imap_mbox_sort_msgno(LIBBALSA_MAILBOX_IMAP(mbox)->handle,
                                     lbmi_get_imap_sort_key(mbox), TRUE,
                                     msgno_arr, len)); /* ignore errors */
         }
         g_array_set_size(mimap->sort_ranks, len);
-        for (i = 0; i < len; i++) {
-            g_array_index(mimap->sort_ranks, guint, msgno_arr[i] - 1) = i;
-        }
-        g_free(msgno_arr);
-        /* Validate the cache. */
+        for (i = 0; i < len; i++)
+           g_array_index(mimap->sort_ranks, guint, msgno_arr[i] - 1) = i;
+       g_free(msgno_arr);
+       /* Validate the cache. */
         mimap->sort_field = mbox->view->sort_field;
     }
     g_array_sort_with_data(array, (GCompareDataFunc) lbmi_compare_func,
                            mimap);
 }
 
-
 static guint
-libbalsa_mailbox_imap_total_messages(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_imap_total_messages(LibBalsaMailbox * mailbox)
 {
     LibBalsaMailboxImap *mimap = (LibBalsaMailboxImap *) mailbox;
     guint cnt;
@@ -3702,104 +3300,100 @@ libbalsa_mailbox_imap_total_messages(LibBalsaMailbox *mailbox)
     return cnt;
 }
 
-
 /* Copy messages in the list to dest; use server-side copy if mailbox
  * and dest are on the same server, fall back to parent method
  * otherwise.
  */
 static gboolean
-libbalsa_mailbox_imap_messages_copy(LibBalsaMailbox *mailbox,
-                                    GArray          *msgnos,
-                                    LibBalsaMailbox *dest,
-                                    GError         **err)
+libbalsa_mailbox_imap_messages_copy(LibBalsaMailbox * mailbox,
+                                   GArray * msgnos,
+                                   LibBalsaMailbox * dest, GError **err)
 {
     if (LIBBALSA_IS_MAILBOX_IMAP(dest) &&
-        (LIBBALSA_MAILBOX_REMOTE(dest)->server ==
-         LIBBALSA_MAILBOX_REMOTE(mailbox)->server)) {
+       LIBBALSA_MAILBOX_REMOTE(dest)->server ==
+       LIBBALSA_MAILBOX_REMOTE(mailbox)->server) {
         gboolean ret;
-        LibBalsaMailboxImap *mimap = LIBBALSA_MAILBOX_IMAP(mailbox);
-        ImapMboxHandle *handle = LIBBALSA_MAILBOX_IMAP(mailbox)->handle;
-        ImapSequence uid_sequence;
-        unsigned *seqno = (unsigned *)msgnos->data, *uids;
-        unsigned im;
-        g_return_val_if_fail(handle, FALSE);
-
-        imap_sequence_init(&uid_sequence);
-        /* User server-side copy. */
-        g_array_sort(msgnos, cmp_msgno);
-        uids = g_new(unsigned, msgnos->len);
-        for (im = 0; im < msgnos->len; im++) {
-            ImapMessage *imsg = imap_mbox_handle_get_msg(handle, seqno[im]);
-            uids[im] = imsg ? imsg->uid : 0;
-        }
-
-        ret = imap_mbox_handle_copy(handle, msgnos->len,
+       LibBalsaMailboxImap *mimap = LIBBALSA_MAILBOX_IMAP(mailbox);
+       ImapMboxHandle *handle = LIBBALSA_MAILBOX_IMAP(mailbox)->handle;
+       ImapSequence uid_sequence;
+       unsigned *seqno = (unsigned*)msgnos->data, *uids;
+       unsigned im;
+       g_return_val_if_fail(handle, FALSE);
+       
+       imap_sequence_init(&uid_sequence);
+       /* User server-side copy. */
+       g_array_sort(msgnos, cmp_msgno);
+       uids = g_new(unsigned, msgnos->len);
+       for(im=0; im<msgnos->len; im++) {
+           ImapMessage * imsg = imap_mbox_handle_get_msg(handle, seqno[im]);
+           uids[im] = imsg ? imsg->uid : 0;
+       }
+           
+       ret = imap_mbox_handle_copy(handle, msgnos->len,
                                     (guint *) msgnos->data,
                                     LIBBALSA_MAILBOX_IMAP(dest)->path,
-                                    &uid_sequence)
-            == IMR_OK;
-        if (!ret) {
+                                   &uid_sequence)
+           == IMR_OK;
+        if(!ret) {
             gchar *msg = imap_mbox_handle_get_last_msg(handle);
             g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                         LIBBALSA_MAILBOX_COPY_ERROR,
                         "%s", msg);
             g_free(msg);
-        } else if (!imap_sequence_empty(&uid_sequence)) {
-            /* Copy cache files. */
-            GDir *dir;
-            LibBalsaServer *s = LIBBALSA_MAILBOX_REMOTE(mailbox)->server;
-            LibBalsaImapServer *is = LIBBALSA_IMAP_SERVER(s);
-            LibBalsaMailboxImap *dst_imap = LIBBALSA_MAILBOX_IMAP(dest);
-            gboolean is_persistent =
-                libbalsa_imap_server_has_persistent_cache(is);
-            gchar *dir_name = get_cache_dir(is_persistent);
-            gchar *src_prefix = g_strdup_printf("%s@%s-%s-%u-",
-                                                s->user, s->host,
-                                                (mimap->path
-                                                 ? mimap->path : "INBOX"),
-                                                mimap->uid_validity);
-            gchar *encoded_path = libbalsa_urlencode(src_prefix);
-            g_free(src_prefix);
-            dir = g_dir_open(dir_name, 0, NULL);
-            if (dir) {
-                const gchar *filename;
-                size_t prefix_length = strlen(encoded_path);
-                unsigned nth;
-                while ((filename = g_dir_read_name(dir)) != NULL) {
-                    unsigned msg_uid;
-                    gchar *tail;
-                    if (strncmp(encoded_path, filename, prefix_length)) {
-                        continue;
-                    }
-                    msg_uid = strtol(filename + prefix_length, &tail, 10);
-                    for (im = 0; im < msgnos->len; im++) {
-                        if (uids[im] > msg_uid) {
-                            break;
-                        } else if ((uids[im] == msg_uid) &&
-                                   (nth = imap_sequence_nth(&uid_sequence, im))
-                                   ) {
-                            gchar *src =
-                                g_build_filename(dir_name, filename, NULL);
-                            gchar *dst_prefix =
-                                g_strdup_printf("%s@%s-%s-%u-%u%s",
-                                                s->user, s->host,
-                                                (dst_imap->path
-                                                 ? dst_imap->path : "INBOX"),
-                                                uid_sequence.uid_validity,
-                                                nth, tail);
-
-                            create_cache_copy(src, dir_name, dst_prefix);
-                            g_free(dst_prefix);
-                            break;
-                        }
-                    }
-                }
-                g_dir_close(dir);
-            }
-            g_free(dir_name);
-        }
-        g_free(uids);
-        imap_sequence_release(&uid_sequence);
+        } else if(!imap_sequence_empty(&uid_sequence)) {
+           /* Copy cache files. */
+           GDir *dir;
+           LibBalsaServer *s      = LIBBALSA_MAILBOX_REMOTE(mailbox)->server;
+           LibBalsaImapServer *is = LIBBALSA_IMAP_SERVER(s);
+           LibBalsaMailboxImap *dst_imap = LIBBALSA_MAILBOX_IMAP(dest);
+           gboolean is_persistent =
+               libbalsa_imap_server_has_persistent_cache(is);
+           gchar *dir_name = get_cache_dir(is_persistent);
+           gchar *src_prefix = g_strdup_printf("%s@%s-%s-%u-",
+                                               s->user, s->host,
+                                               (mimap->path 
+                                                ? mimap->path : "INBOX"),
+                                               mimap->uid_validity);
+           gchar *encoded_path = libbalsa_urlencode(src_prefix);
+           g_free(src_prefix);
+           dir = g_dir_open(dir_name, 0, NULL);
+           if(dir) {
+               const gchar *filename;
+               size_t prefix_length = strlen(encoded_path);
+               unsigned nth;
+               while ((filename = g_dir_read_name(dir)) != NULL) {
+                   unsigned msg_uid;
+                   gchar *tail;
+                   if(strncmp(encoded_path, filename, prefix_length))
+                       continue;
+                   msg_uid = strtol(filename + prefix_length, &tail, 10);
+                   for(im = 0; im<msgnos->len; im++) {
+                       if(uids[im]>msg_uid) break;
+                       else if(uids[im]==msg_uid &&
+                               (nth = imap_sequence_nth(&uid_sequence, im))
+                                ) {
+                           gchar *src =
+                               g_build_filename(dir_name, filename, NULL);
+                           gchar *dst_prefix =
+                               g_strdup_printf("%s@%s-%s-%u-%u%s",
+                                               s->user, s->host,
+                                               (dst_imap->path 
+                                                ? dst_imap->path : "INBOX"),
+                                               uid_sequence.uid_validity,
+                                               nth, tail);
+
+                           create_cache_copy(src, dir_name, dst_prefix);
+                           g_free(dst_prefix);
+                           break;
+                       }
+                   }
+               }
+               g_dir_close(dir);
+           }
+           g_free(dir_name);
+       }
+       g_free(uids);
+       imap_sequence_release(&uid_sequence);
         return ret;
     }
 
@@ -3807,14 +3401,12 @@ libbalsa_mailbox_imap_messages_copy(LibBalsaMailbox *mailbox,
     return parent_class->messages_copy(mailbox, msgnos, dest, err);
 }
 
-
 void
 libbalsa_imap_set_cache_size(off_t cache_size)
 {
     ImapCacheSize = cache_size;
 }
 
-
 /** Purges the temporary directory used for non-persistent message
    caching. */
 void
@@ -3825,7 +3417,6 @@ libbalsa_imap_purge_temp_dir(off_t cache_size)
     g_free(dir_name);
 }
 
-
 /* ===================================================================
    ImapCacheManager implementation.  The main task of the
    ImapCacheManager is to reuse msgno->UID mappings. This is useful
@@ -3838,7 +3429,7 @@ libbalsa_imap_purge_temp_dir(off_t cache_size)
 
    The general scheme is that libimap does not cache any data
    persistently based on UIDs - this task is left to ImapCacheManager.
-   .
+ .
    ICM provides two main functions:
 
    - init_on_select() - preloads ImapMboxHandle msgno-based cache with
@@ -3855,25 +3446,24 @@ libbalsa_imap_purge_temp_dir(off_t cache_size)
  */
 struct ImapCacheManager {
     GHashTable *headers;
-    GArray *uidmap;
-    uint32_t uidvalidity;
-    uint32_t uidnext;
-    uint32_t exists;
+    GArray     *uidmap;
+    uint32_t    uidvalidity;
+    uint32_t    uidnext;
+    uint32_t    exists;
 };
 
-static struct ImapCacheManager *
+static struct ImapCacheManager*
 imap_cache_manager_new(guint cnt)
 {
     struct ImapCacheManager *icm = g_new0(struct ImapCacheManager, 1);
     icm->exists = cnt;
-    icm->headers =
+    icm->headers = 
         g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free);
-    icm->uidmap = g_array_sized_new(FALSE, TRUE, sizeof(uint32_t), cnt);
+    icm->uidmap = g_array_sized_new(FALSE,  TRUE, sizeof(uint32_t), cnt);
     return icm;
 }
 
-
-static struct ImapCacheManager *
+static struct ImapCacheManager*
 imap_cache_manager_new_from_file(const char *header_cache_path)
 {
     /* The cache data should be transferable between 32- and 64-bit
@@ -3882,49 +3472,46 @@ imap_cache_manager_new_from_file(const char *header_cache_path)
     ImapUID uid;
     struct ImapCacheManager *icm;
     FILE *f = fopen(header_cache_path, "rb");
-    if (!f) {
-        return NULL;
+    if(!f) {
+       return NULL;
     }
-    if (fread(&i, sizeof(i), 1, f) != 1) {
-        printf("Could not read cache table size.\n");
+    if(fread(&i, sizeof(i), 1, f) != 1) {
+       printf("Could not read cache table size.\n");
         fclose(f);
-        return NULL;
+       return NULL;
     }
-
+    
     icm = imap_cache_manager_new(i);
-    if ((fread(&icm->uidvalidity, sizeof(uint32_t), 1, f) != 1) ||
-        (fread(&icm->uidnext, sizeof(uint32_t), 1, f) != 1) ||
-        (fread(&icm->exists, sizeof(uint32_t), 1, f) != 1)) {
-        imap_cache_manager_free(icm);
-        printf("Couldn't read cache - aborting…\n");
+    if(fread(&icm->uidvalidity, sizeof(uint32_t), 1, f) != 1 ||
+       fread(&icm->uidnext,     sizeof(uint32_t), 1, f) != 1 ||
+       fread(&icm->exists,      sizeof(uint32_t), 1, f) != 1) {
+       imap_cache_manager_free(icm);
+       printf("Couldn't read cache - aborting…\n");
         fclose(f);
-        return NULL;
+       return NULL;
     }
 
     i = 0;
-    while (fread(&uid, sizeof(uid), 1, f) == 1) {
-        if (uid) {
-            uint32_t slen; /* Architecture-independent size */
-            gchar *s;
-            if (fread(&slen, sizeof(slen), 1, f) != 1) {
-                break;
-            }
-            s = g_malloc(slen + 1); /* slen would be sufficient? */
-            if (fread(s, 1, slen, f) != slen) {
+    while(fread(&uid, sizeof(uid), 1, f) == 1) {
+       if(uid) {
+           uint32_t slen; /* Architecture-independent size */
+           gchar *s;
+           if(fread(&slen, sizeof(slen), 1, f) != 1)
+               break;
+           s = g_malloc(slen+1); /* slen would be sufficient? */
+           if(fread(s, 1, slen, f) != slen)
                 break;
-            }
-            s[slen] = '\0'; /* Unneeded? */
-            g_hash_table_insert(icm->headers, GUINT_TO_POINTER(uid), s);
-        }
+           s[slen] = '\0'; /* Unneeded? */
+           g_hash_table_insert(icm->headers, GUINT_TO_POINTER(uid), s);
+       }
         g_array_append_val(icm->uidmap, uid);
-        i++;
+       i++;
     }
     fclose(f);
 
     return icm;
 }
 
-
 static void
 imap_cache_manager_free(struct ImapCacheManager *icm)
 {
@@ -3933,38 +3520,32 @@ imap_cache_manager_free(struct ImapCacheManager *icm)
     g_free(icm);
 }
 
-
 /* icm_init_on_select_() preloads header cache of the ImapMboxHandle object.
    It currently handles following cases:
    a). uidvalidity different - entire cache has to be invalidated.
    b). cache->exists == h->exists && cache->uidnext == h->uidnext:
    nothing has changed - feed entire cache.
    else fetch the message numbers for the UIDs in cache.
- */
+*/
 static void
-set_uid(ImapMboxHandle *handle,
-        unsigned        seqno,
-        void           *arg)
+set_uid(ImapMboxHandle *handle, unsigned seqno, void *arg)
 {
-    GArray *a = (GArray *)arg;
+    GArray *a = (GArray*)arg;
     g_array_append_val(a, seqno);
 }
 
-
 static void
-icm_restore_from_cache(ImapMboxHandle          *h,
-                       struct ImapCacheManager *icm)
+icm_restore_from_cache(ImapMboxHandle *h, struct ImapCacheManager *icm)
 {
     unsigned exists, uidvalidity, uidnext;
     unsigned i;
 
-    if (!icm || !h) {
+    if(!icm || ! h)
         return;
-    }
     uidvalidity = imap_mbox_handle_get_validity(h);
-    exists = imap_mbox_handle_get_exists(h);
+    exists  = imap_mbox_handle_get_exists(h);
     uidnext = imap_mbox_handle_get_uidnext(h);
-    if (icm->uidvalidity != uidvalidity) {
+    if(icm->uidvalidity != uidvalidity) {
         printf("Different validities old: %u new: %u - cache invalidated\n",
                icm->uidvalidity, uidvalidity);
         return;
@@ -3973,140 +3554,117 @@ icm_restore_from_cache(ImapMboxHandle          *h,
     /* There were some modifications to the mailbox but the situation
      * is not hopeless, we just need to get the seqnos of messages in
      * the cache. */
-    if (exists - icm->exists != uidnext - icm->uidnext) {
+    if(exists - icm->exists !=  uidnext - icm->uidnext) {
         ImapResponse rc;
         GArray *uidmap = g_array_sized_new(FALSE, TRUE,
                                            sizeof(uint32_t), icm->exists);
         ImapSearchKey *k;
-        unsigned lo = icm->uidmap->len + 1, hi = 0;
+        unsigned lo = icm->uidmap->len+1, hi = 0;
         /* printf("UIDSYNC:Searching range [1:%u]\n", icm->uidmap->len); */
-        for (i = 1; i <= icm->uidmap->len; i++) {
-            if (g_array_index(icm->uidmap, uint32_t, i - 1)) {
-                lo = i;
-                break;
-            }
-        }
-        for (i = icm->uidmap->len; i >= lo; i--) {
-            if (g_array_index(icm->uidmap, uint32_t, i - 1)) {
-                hi = i;
-                break;
-            }
-        }
+        for(i=1; i<=icm->uidmap->len; i++)
+            if(g_array_index(icm->uidmap, uint32_t, i-1)) {lo=i; break; }
+        for(i=icm->uidmap->len; i>=lo; i--)
+            if(g_array_index(icm->uidmap, uint32_t, i-1)) {hi=i; break; }
 
         k = imap_search_key_new_range(FALSE, FALSE, lo, hi);
         /* printf("UIDSYNC: Old vs new: exists: %u %u uidnext: %u %u "
                "- syncing uid map for msgno [%u:%u].\n",
                icm->exists, exists, icm->uidnext, uidnext, lo, hi); */
-        if (k) {
-            uidmap->len = lo - 1;
+        if(k) {
+            uidmap->len = lo-1;
             rc = imap_search_exec(h, TRUE, k, set_uid, uidmap);
             imap_search_key_free(k);
-        } else {
-            rc = IMR_NO;
-        }
-        if (rc != IMR_OK) {
+        } else rc = IMR_NO;
+        if(rc != IMR_OK) {
             g_array_free(uidmap, TRUE);
             return;
         }
-        g_array_free(icm->uidmap, TRUE);
-        icm->uidmap = uidmap;
+        g_array_free(icm->uidmap, TRUE); icm->uidmap = uidmap;
         /* printf("New uidmap has length: %u\n", icm->uidmap->len); */
     }
     /* One way or another, we have a valid uid->seqno map now;
      * The mailbox data can be resynced easily. */
 
-    for (i = 1; i <= icm->exists; i++) {
-        uint32_t uid = g_array_index(icm->uidmap, uint32_t, i - 1);
+    for(i=1; i<=icm->exists; i++) {
+        uint32_t uid = g_array_index(icm->uidmap, uint32_t, i-1);
         void *data = g_hash_table_lookup(icm->headers,
                                          GUINT_TO_POINTER(uid));
-        if (data) { /* if uid known */
+        if(data) /* if uid known */
             imap_mbox_handle_msg_deserialize(h, i, data);
-        }
     }
 }
 
-
 /** Stores (possibly persistently) data associated with given handle.
     This allows for quick restore between IMAP sessions and reduces
     synchronization overhead. */
-static struct ImapCacheManager *
+static struct ImapCacheManager*
 icm_store_cached_data(ImapMboxHandle *handle)
 {
     struct ImapCacheManager *icm;
     unsigned cnt, i;
 
-    if (!handle) {
+    if(!handle)
         return NULL;
-    }
 
     cnt = imap_mbox_handle_get_exists(handle);
     icm = imap_cache_manager_new(cnt);
     icm->uidvalidity = imap_mbox_handle_get_validity(handle);
-    icm->uidnext = imap_mbox_handle_get_uidnext(handle);
+    icm->uidnext     = imap_mbox_handle_get_uidnext(handle);
 
-    for (i = 0; i < cnt; i++) {
+    for(i=0; i<cnt; i++) {
         void *ptr;
-        ImapMessage *imsg = imap_mbox_handle_get_msg(handle, i + 1);
+        ImapMessage *imsg = imap_mbox_handle_get_msg(handle, i+1);
         unsigned uid;
-        if (imsg && ((ptr = imap_message_serialize(imsg)) != NULL)) {
+        if(imsg && (ptr = imap_message_serialize(imsg)) != NULL) {
             g_hash_table_insert(icm->headers,
                                 GUINT_TO_POINTER(imsg->uid), ptr);
             uid = imsg->uid;
-        } else {
-            uid = 0;
-        }
+        } else uid = 0;
         g_array_append_val(icm->uidmap, uid);
     }
     return icm;
 }
 
-
 static gboolean
-icm_save_header(uint32_t uid,
-                gpointer value,
-                FILE    *f)
+icm_save_header(uint32_t uid, gpointer value, FILE *f)
 {
-    if (fwrite(&uid, sizeof(uid), 1, f) != 1) {
-        return FALSE;
-    }
-    if (uid) {
-        uint32_t slen = imap_serialized_message_size(value);
-        if ((fwrite(&slen, sizeof(slen), 1, f) != 1) ||
-            (fwrite(value, 1, slen, f) != slen)) {
+    if(fwrite(&uid, sizeof(uid), 1, f) != 1) return FALSE;
+    if(uid) {
+       uint32_t slen = imap_serialized_message_size(value);
+       if(fwrite(&slen, sizeof(slen), 1, f) != 1 ||
+           fwrite(value, 1, slen, f) != slen)
             return FALSE;
-        }
     }
     return TRUE;
 }
 
 
 static gboolean
-icm_save_to_file(struct ImapCacheManager *icm,
-                 const gchar             *file_name)
+icm_save_to_file(struct ImapCacheManager *icm, const gchar *file_name)
 {
     gboolean success;
     FILE *f = fopen(file_name, "wb");
 
     success = f != NULL;
-    if (success) {
-        uint32_t i = icm->uidmap->len;
-        if ((fwrite(&i, sizeof(i), 1, f) != 1) ||
-            (fwrite(&icm->uidvalidity, sizeof(uint32_t), 1, f) != 1) ||
-            (fwrite(&icm->uidnext, sizeof(uint32_t), 1, f) != 1) ||
-            (fwrite(&icm->exists, sizeof(uint32_t), 1, f) != 1)) {
+    if(success) {
+       uint32_t i = icm->uidmap->len;
+       if(fwrite(&i, sizeof(i), 1, f) != 1                       ||
+           fwrite(&icm->uidvalidity, sizeof(uint32_t), 1, f) != 1 ||
+           fwrite(&icm->uidnext,     sizeof(uint32_t), 1, f) != 1 ||
+           fwrite(&icm->exists,      sizeof(uint32_t), 1, f) != 1) {
             success = FALSE;
         } else {
-            for (i = 0; i < icm->uidmap->len; i++) {
+            for(i = 0; i<icm->uidmap->len; i++) {
                 uint32_t uid = g_array_index(icm->uidmap, uint32_t, i);
                 gpointer value = g_hash_table_lookup(icm->headers,
                                                      GUINT_TO_POINTER(uid));
-                if (!icm_save_header(uid, value, f)) {
+                if(!icm_save_header(uid, value, f)) {
                     success = FALSE;
                     break;
                 }
             }
         }
-        fclose(f);
+       fclose(f);
     }
     return success;
 }
diff --git a/libbalsa/mailbox_imap.h b/libbalsa/mailbox_imap.h
index 2b42aa5..f7bb7a0 100644
--- a/libbalsa/mailbox_imap.h
+++ b/libbalsa/mailbox_imap.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -43,52 +43,46 @@ typedef struct _LibBalsaMailboxImapClass LibBalsaMailboxImapClass;
 
 LibBalsaMailbox *libbalsa_mailbox_imap_new(void);
 
-void libbalsa_mailbox_imap_update_url(LibBalsaMailboxImap *mailbox);
-void libbalsa_mailbox_imap_set_path(LibBalsaMailboxImap *mailbox,
-                                    const gchar         *path);
-const gchar *libbalsa_mailbox_imap_get_path(LibBalsaMailboxImap *mailbox);
+void libbalsa_mailbox_imap_update_url(LibBalsaMailboxImap* mailbox);
+void libbalsa_mailbox_imap_set_path(LibBalsaMailboxImap * mailbox,
+                                   const gchar * path);
+const gchar* libbalsa_mailbox_imap_get_path(LibBalsaMailboxImap * mailbox);
 
-gboolean libbalsa_mailbox_imap_subscribe(LibBalsaMailboxImap *mailbox,
-                                         gboolean             subscribe);
+gboolean libbalsa_mailbox_imap_subscribe(LibBalsaMailboxImap * mailbox, 
+                                         gboolean subscribe);
 
-GHashTable *libbalsa_mailbox_imap_get_matchings(LibBalsaMailboxImap *mbox,
-                                                LibBalsaCondition   *condition,
-                                                gboolean             only_recent,
-                                                gboolean            *err);
+GHashTable * libbalsa_mailbox_imap_get_matchings(LibBalsaMailboxImap* mbox,
+                                                LibBalsaCondition *condition,
+                                                gboolean only_recent,
+                                                gboolean * err);
 
-void libbalsa_mailbox_imap_noop(LibBalsaMailboxImap *mbox);
+void libbalsa_mailbox_imap_noop(LibBalsaMailboxImap* mbox);
 
-void libbalsa_mailbox_imap_force_disconnect(LibBalsaMailboxImap *mimap);
-gboolean libbalsa_mailbox_imap_is_connected(LibBalsaMailboxImap *mimap);
-void libbalsa_mailbox_imap_reconnect(LibBalsaMailboxImap *mimap);
+void libbalsa_mailbox_imap_force_disconnect(LibBalsaMailboxImap* mimap);
+gboolean libbalsa_mailbox_imap_is_connected(LibBalsaMailboxImap* mimap);
+void libbalsa_mailbox_imap_reconnect(LibBalsaMailboxImap* mimap);
 void libbalsa_imap_close_all_connections(void);
 
-gboolean libbalsa_imap_new_subfolder(const gchar    *parent,
-                                     const gchar    *folder,
-                                     gboolean        subscribe,
-                                     LibBalsaServer *server,
-                                     GError        **err);
+gboolean libbalsa_imap_new_subfolder(const gchar *parent, const gchar *folder,
+                                     gboolean subscribe,
+                                     LibBalsaServer *server, GError **err);
 
-gboolean libbalsa_imap_rename_subfolder(LibBalsaMailboxImap *mbox,
-                                        const gchar         *new_parent,
-                                        const gchar         *folder,
-                                        gboolean             subscr,
-                                        GError             **err);
+gboolean libbalsa_imap_rename_subfolder(LibBalsaMailboxImap* mbox,
+                                        const gchar *new_parent,
+                                        const gchar *folder, gboolean subscr,
+                                        GError **err);
 
-gboolean libbalsa_imap_delete_folder(LibBalsaMailboxImap *mailbox,
-                                     GError             **err);
+gboolean libbalsa_imap_delete_folder(LibBalsaMailboxImap * mailbox,
+                                     GError **err);
 
-gboolean libbalsa_imap_get_quota(LibBalsaMailboxImap *mailbox,
-                                 gulong              *max_kbyte,
-                                 gulong              *used_kbyte);
+gboolean libbalsa_imap_get_quota(LibBalsaMailboxImap * mailbox,
+                                 gulong *max_kbyte, gulong *used_kbyte);
 
-gchar *libbalsa_imap_get_rights(LibBalsaMailboxImap *mailbox);
-gchar **libbalsa_imap_get_acls(LibBalsaMailboxImap *mailbox);
+gchar *libbalsa_imap_get_rights(LibBalsaMailboxImap * mailbox);
+gchar **libbalsa_imap_get_acls(LibBalsaMailboxImap * mailbox);
 
-gchar *libbalsa_imap_url(LibBalsaServer *server,
-                         const gchar    *path);
+gchar *libbalsa_imap_url(LibBalsaServer * server, const gchar * path);
 
 void libbalsa_imap_set_cache_size(off_t cache_size);
 void libbalsa_imap_purge_temp_dir(off_t cache_size);
-
-#endif                          /* __LIBBALSA_MAILBOX_IMAP_H__ */
+#endif                         /* __LIBBALSA_MAILBOX_IMAP_H__ */
diff --git a/libbalsa/mailbox_local.c b/libbalsa/mailbox_local.c
index 64ffe92..ce6c61f 100644
--- a/libbalsa/mailbox_local.c
+++ b/libbalsa/mailbox_local.c
@@ -6,20 +6,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <sys/types.h>
@@ -40,31 +40,30 @@
 static LibBalsaMailboxClass *parent_class = NULL;
 
 static void libbalsa_mailbox_local_class_init(LibBalsaMailboxLocalClass *klass);
-static void libbalsa_mailbox_local_init(LibBalsaMailboxLocal *mailbox);
-static void libbalsa_mailbox_local_dispose(GObject *object);
-static void libbalsa_mailbox_local_finalize(GObject *object);
-
-static void libbalsa_mailbox_local_changed(LibBalsaMailbox *mailbox);
-static void libbalsa_mailbox_local_save_config(LibBalsaMailbox *mailbox,
-                                               const gchar     *prefix);
-static void libbalsa_mailbox_local_load_config(LibBalsaMailbox *mailbox,
-                                               const gchar     *prefix);
-
-static void libbalsa_mailbox_local_close_mailbox(LibBalsaMailbox *mailbox,
-                                                 gboolean         expunge);
+static void libbalsa_mailbox_local_init(LibBalsaMailboxLocal * mailbox);
+static void libbalsa_mailbox_local_dispose(GObject * object);
+static void libbalsa_mailbox_local_finalize(GObject * object);
+
+static void libbalsa_mailbox_local_changed(LibBalsaMailbox * mailbox);
+static void libbalsa_mailbox_local_save_config(LibBalsaMailbox * mailbox,
+                                              const gchar * prefix);
+static void libbalsa_mailbox_local_load_config(LibBalsaMailbox * mailbox,
+                                              const gchar * prefix);
+
+static void libbalsa_mailbox_local_close_mailbox(LibBalsaMailbox * mailbox,
+                                                 gboolean expunge);
 static LibBalsaMessage *libbalsa_mailbox_local_get_message(LibBalsaMailbox
-                                                                *mailbox,
+                                                           * mailbox,
                                                            guint msgno);
 static gboolean libbalsa_mailbox_local_message_match(LibBalsaMailbox *
-                                                     mailbox,
-                                                     guint msgno,
-                                                     LibBalsaMailboxSearchIter
-                                                          *iter);
+                                                    mailbox, guint msgno,
+                                                    LibBalsaMailboxSearchIter
+                                                    * iter);
 
 static void libbalsa_mailbox_local_set_threading(LibBalsaMailbox *mailbox,
-                                                 LibBalsaMailboxThreadingType
-                                                 thread_type);
-static void lbm_local_update_view_filter(LibBalsaMailbox   *mailbox,
+                                                LibBalsaMailboxThreadingType
+                                                thread_type);
+static void lbm_local_update_view_filter(LibBalsaMailbox * mailbox,
                                          LibBalsaCondition *view_filter);
 
 static gboolean libbalsa_mailbox_local_prepare_threading(LibBalsaMailbox *
@@ -81,22 +80,23 @@ static void libbalsa_mailbox_local_fetch_headers(LibBalsaMailbox *mailbox,
                                                  LibBalsaMessage *message);
 
 static gboolean libbalsa_mailbox_local_get_msg_part(LibBalsaMessage *msg,
-                                                    LibBalsaMessageBody *,
-                                                    GError         **err);
+                                                   LibBalsaMessageBody *,
+                                                    GError **err);
 
-static void lbm_local_sort(LibBalsaMailbox *mailbox,
-                           GArray          *sort_array);
-static guint libbalsa_mailbox_local_add_messages(LibBalsaMailbox           *mailbox,
-                                                 LibBalsaAddMessageIterator msg_iterator,
-                                                 gpointer                   iter_data,
-                                                 GError                   **err);
+static void lbm_local_sort(LibBalsaMailbox * mailbox, GArray *sort_array);
+static guint
+libbalsa_mailbox_local_add_messages(LibBalsaMailbox          * mailbox,
+                                    LibBalsaAddMessageIterator msg_iterator,
+                                    gpointer                   iter_data,
+                                    GError                  ** err);
 
 static GArray *libbalsa_mailbox_local_duplicate_msgnos(LibBalsaMailbox *
                                                        mailbox);
-static gboolean libbalsa_mailbox_local_messages_change_flags(LibBalsaMailbox    *mailbox,
-                                                             GArray             *msgnos,
-                                                             LibBalsaMessageFlag set,
-                                                             LibBalsaMessageFlag clear);
+static gboolean
+libbalsa_mailbox_local_messages_change_flags(LibBalsaMailbox * mailbox,
+                                             GArray * msgnos,
+                                             LibBalsaMessageFlag set,
+                                             LibBalsaMessageFlag clear);
 static gboolean libbalsa_mailbox_local_msgno_has_flags(LibBalsaMailbox *
                                                        mailbox,
                                                        guint msgno,
@@ -104,12 +104,12 @@ static gboolean libbalsa_mailbox_local_msgno_has_flags(LibBalsaMailbox *
                                                        set,
                                                        LibBalsaMessageFlag
                                                        unset);
-static void libbalsa_mailbox_local_test_can_reach(LibBalsaMailbox          *mailbox,
-                                                  LibBalsaCanReachCallback *cb,
-                                                  gpointer                  cb_data);
+static void libbalsa_mailbox_local_test_can_reach(LibBalsaMailbox          * mailbox,
+                                                  LibBalsaCanReachCallback * cb,
+                                                  gpointer                   cb_data);
 
 /* LibBalsaMailboxLocal class method: */
-static void lbm_local_real_remove_files(LibBalsaMailboxLocal *local);
+static void lbm_local_real_remove_files(LibBalsaMailboxLocal * local);
 
 GType
 libbalsa_mailbox_local_get_type(void)
@@ -117,30 +117,29 @@ libbalsa_mailbox_local_get_type(void)
     static GType mailbox_type = 0;
 
     if (!mailbox_type) {
-        static const GTypeInfo mailbox_info = {
-            sizeof(LibBalsaMailboxLocalClass),
+       static const GTypeInfo mailbox_info = {
+           sizeof(LibBalsaMailboxLocalClass),
             NULL,               /* base_init */
             NULL,               /* base_finalize */
-            (GClassInitFunc) libbalsa_mailbox_local_class_init,
+           (GClassInitFunc) libbalsa_mailbox_local_class_init,
             NULL,               /* class_finalize */
             NULL,               /* class_data */
-            sizeof(LibBalsaMailboxLocal),
+           sizeof(LibBalsaMailboxLocal),
             0,                  /* n_preallocs */
-            (GInstanceInitFunc) libbalsa_mailbox_local_init
-        };
+           (GInstanceInitFunc) libbalsa_mailbox_local_init
+       };
 
-        mailbox_type =
-            g_type_register_static(LIBBALSA_TYPE_MAILBOX,
-                                   "LibBalsaMailboxLocal",
+       mailbox_type =
+           g_type_register_static(LIBBALSA_TYPE_MAILBOX,
+                                  "LibBalsaMailboxLocal",
                                    &mailbox_info, 0);
     }
 
     return mailbox_type;
 }
 
-
 static void
-libbalsa_mailbox_local_class_init(LibBalsaMailboxLocalClass *klass)
+libbalsa_mailbox_local_class_init(LibBalsaMailboxLocalClass * klass)
 {
     GObjectClass *object_class;
     LibBalsaMailboxClass *libbalsa_mailbox_class;
@@ -150,33 +149,33 @@ libbalsa_mailbox_local_class_init(LibBalsaMailboxLocalClass *klass)
 
     parent_class = g_type_class_peek_parent(klass);
 
-    object_class->dispose = libbalsa_mailbox_local_dispose;
+    object_class->dispose  = libbalsa_mailbox_local_dispose;
     object_class->finalize = libbalsa_mailbox_local_finalize;
 
     libbalsa_mailbox_class->changed =
-        libbalsa_mailbox_local_changed;
+       libbalsa_mailbox_local_changed;
     libbalsa_mailbox_class->save_config =
-        libbalsa_mailbox_local_save_config;
+       libbalsa_mailbox_local_save_config;
     libbalsa_mailbox_class->load_config =
-        libbalsa_mailbox_local_load_config;
+       libbalsa_mailbox_local_load_config;
 
     libbalsa_mailbox_class->close_mailbox =
-        libbalsa_mailbox_local_close_mailbox;
+       libbalsa_mailbox_local_close_mailbox;
     libbalsa_mailbox_class->get_message =
-        libbalsa_mailbox_local_get_message;
-    libbalsa_mailbox_class->message_match =
+       libbalsa_mailbox_local_get_message;
+    libbalsa_mailbox_class->message_match = 
         libbalsa_mailbox_local_message_match;
     libbalsa_mailbox_class->set_threading =
-        libbalsa_mailbox_local_set_threading;
+       libbalsa_mailbox_local_set_threading;
     libbalsa_mailbox_class->update_view_filter =
         lbm_local_update_view_filter;
     libbalsa_mailbox_class->prepare_threading =
         libbalsa_mailbox_local_prepare_threading;
-    libbalsa_mailbox_class->fetch_message_structure =
+    libbalsa_mailbox_class->fetch_message_structure = 
         libbalsa_mailbox_local_fetch_structure;
-    libbalsa_mailbox_class->fetch_headers =
+    libbalsa_mailbox_class->fetch_headers = 
         libbalsa_mailbox_local_fetch_headers;
-    libbalsa_mailbox_class->get_message_part =
+    libbalsa_mailbox_class->get_message_part = 
         libbalsa_mailbox_local_get_msg_part;
     libbalsa_mailbox_class->sort = lbm_local_sort;
     libbalsa_mailbox_class->add_messages =
@@ -189,57 +188,52 @@ libbalsa_mailbox_local_class_init(LibBalsaMailboxLocalClass *klass)
         libbalsa_mailbox_local_duplicate_msgnos;
     libbalsa_mailbox_class->test_can_reach =
         libbalsa_mailbox_local_test_can_reach;
-    klass->check_files = NULL;
-    klass->set_path = NULL;
+    klass->check_files  = NULL;
+    klass->set_path     = NULL;
     klass->remove_files = lbm_local_real_remove_files;
 }
 
-
 static void
-libbalsa_mailbox_local_init(LibBalsaMailboxLocal *mailbox)
+libbalsa_mailbox_local_init(LibBalsaMailboxLocal * mailbox)
 {
-    mailbox->sync_id = 0;
+    mailbox->sync_id   = 0;
     mailbox->sync_time = 0;
-    mailbox->sync_cnt = 0;
+    mailbox->sync_cnt  = 0;
     mailbox->thread_id = 0;
     mailbox->save_tree_id = 0;
 }
 
-
 LibBalsaMailbox *
-libbalsa_mailbox_local_new(const gchar *path,
-                           gboolean     create)
+libbalsa_mailbox_local_new(const gchar * path, gboolean create)
 {
     GType magic_type = libbalsa_mailbox_type_from_path(path);
 
-    if (magic_type == LIBBALSA_TYPE_MAILBOX_MBOX) {
-        return libbalsa_mailbox_mbox_new(path, create);
-    } else if (magic_type == LIBBALSA_TYPE_MAILBOX_MH) {
-        return libbalsa_mailbox_mh_new(path, create);
-    } else if (magic_type == LIBBALSA_TYPE_MAILBOX_MAILDIR) {
-        return libbalsa_mailbox_maildir_new(path, create);
-    } else if (magic_type == LIBBALSA_TYPE_MAILBOX_IMAP) {
+    if(magic_type == LIBBALSA_TYPE_MAILBOX_MBOX)
+       return libbalsa_mailbox_mbox_new(path, create);
+    else if(magic_type == LIBBALSA_TYPE_MAILBOX_MH)
+       return libbalsa_mailbox_mh_new(path, create);
+    else if(magic_type == LIBBALSA_TYPE_MAILBOX_MAILDIR)
+       return libbalsa_mailbox_maildir_new(path, create);
+    else if(magic_type == LIBBALSA_TYPE_MAILBOX_IMAP) {
         g_warning("IMAP path given as a path to local mailbox.\n");
         return NULL;
-    } else {            /* mailbox non-existent or unreadable */
-        if (create) {
-            return libbalsa_mailbox_mbox_new(path, TRUE);
-        } else {
+    } else {           /* mailbox non-existent or unreadable */
+       if(create) 
+           return libbalsa_mailbox_mbox_new(path, TRUE);
+        else {
             g_warning("Unknown mailbox type\n");
             return NULL;
         }
     }
 }
 
-
 /* libbalsa_mailbox_local_set_path:
    returrns errno on error, 0 on success
    FIXME: proper suport for maildir and mh
- */
+*/
 gint
-libbalsa_mailbox_local_set_path(LibBalsaMailboxLocal *mailbox,
-                                const gchar          *path,
-                                gboolean              create)
+libbalsa_mailbox_local_set_path(LibBalsaMailboxLocal * mailbox,
+                                const gchar * path, gboolean create)
 {
     int i;
     LibBalsaMailboxLocalClass *klass;
@@ -252,34 +246,29 @@ libbalsa_mailbox_local_set_path(LibBalsaMailboxLocal *mailbox,
 
     if (LIBBALSA_MAILBOX(mailbox)->url != NULL) {
         const gchar *cur_path = libbalsa_mailbox_local_get_path(mailbox);
-        if (strcmp(path, cur_path) == 0) {
+        if (strcmp(path, cur_path) == 0)
             return 0;
-        } else if (access(path, F_OK) == 0) {   /* 0 == file does exist */
+        else if (access(path, F_OK) == 0)       /* 0 == file does exist */
             return EEXIST;
-        } else {
+        else
             i = rename(cur_path, path);
-        }
-    } else {
+    } else
         i = klass->check_files(path, create);
-    }
 
     /* update mailbox data */
     if (i == 0) {
-        if (klass->set_path) {
+        if (klass->set_path)
             klass->set_path(mailbox, path);
-        }
         g_free(LIBBALSA_MAILBOX(mailbox)->url);
         LIBBALSA_MAILBOX(mailbox)->url =
             g_strconcat("file://", path, NULL);
         return 0;
-    } else {
+    } else
         return errno ? errno : -1;
-    }
 }
 
-
 void
-libbalsa_mailbox_local_remove_files(LibBalsaMailboxLocal *local)
+libbalsa_mailbox_local_remove_files(LibBalsaMailboxLocal * local)
 {
     g_return_if_fail(LIBBALSA_IS_MAILBOX_LOCAL(local));
     g_assert(LIBBALSA_MAILBOX_LOCAL_GET_CLASS(local) != NULL);
@@ -287,14 +276,13 @@ libbalsa_mailbox_local_remove_files(LibBalsaMailboxLocal *local)
     LIBBALSA_MAILBOX_LOCAL_GET_CLASS(local)->remove_files(local);
 }
 
-
 /* libbalsa_mailbox_load_message:
    MAKE sure the mailbox is LOCKed before entering this routine.
- */
+*/
 
 static void
-lbml_add_message_to_pool(LibBalsaMailboxLocal *local,
-                         LibBalsaMessage      *message)
+lbml_add_message_to_pool(LibBalsaMailboxLocal * local,
+                         LibBalsaMessage * message)
 {
     LibBalsaMailboxLocalPool *item, *oldest;
 
@@ -306,19 +294,17 @@ lbml_add_message_to_pool(LibBalsaMailboxLocal *local,
             item->pool_seqno = local->pool_seqno;
             return;
         }
-        if (item->pool_seqno < oldest->pool_seqno) {
+        if (item->pool_seqno < oldest->pool_seqno)
             oldest = item;
-        }
     }
 
     g_set_object(&oldest->message, message);
     oldest->pool_seqno = local->pool_seqno;
 }
 
-
 static void
-lbm_local_get_message_with_msg_info(LibBalsaMailboxLocal *local,
-                                    guint                 msgno,
+lbm_local_get_message_with_msg_info(LibBalsaMailboxLocal * local,
+                                    guint msgno,
                                     LibBalsaMailboxLocalMessageInfo *
                                     msg_info)
 {
@@ -335,15 +321,11 @@ lbm_local_get_message_with_msg_info(LibBalsaMailboxLocal *local,
     lbml_add_message_to_pool(local, message);
 }
 
-
-static gboolean message_match_real(LibBalsaMailbox   *mailbox,
-                                   guint              msgno,
-                                   LibBalsaCondition *cond);
-
+static gboolean message_match_real(LibBalsaMailbox * mailbox, guint msgno,
+                                   LibBalsaCondition * cond);
 static void
-libbalsa_mailbox_local_load_message(LibBalsaMailboxLocal *local,
-                                    GNode               **sibling,
-                                    guint                 msgno,
+libbalsa_mailbox_local_load_message(LibBalsaMailboxLocal * local,
+                                    GNode ** sibling, guint msgno,
                                     LibBalsaMailboxLocalMessageInfo *
                                     msg_info)
 {
@@ -355,17 +337,15 @@ libbalsa_mailbox_local_load_message(LibBalsaMailboxLocal *local,
     if ((msg_info->flags & LIBBALSA_MESSAGE_FLAG_NEW)
         && !(msg_info->flags & LIBBALSA_MESSAGE_FLAG_DELETED)) {
         mbx->unread_messages++;
-        if (mbx->first_unread == 0) {
+        if (mbx->first_unread == 0)
             mbx->first_unread = msgno;
-        }
     }
 
     if (msg_info->flags & LIBBALSA_MESSAGE_FLAG_RECENT) {
         gchar *id;
 
-        if (!msg_info->message) {
+        if (!msg_info->message)
             lbm_local_get_message_with_msg_info(local, msgno, msg_info);
-        }
 
         if (libbalsa_message_is_partial(msg_info->message, &id)) {
             libbalsa_mailbox_try_reassemble(mbx, id);
@@ -373,20 +353,17 @@ libbalsa_mailbox_local_load_message(LibBalsaMailboxLocal *local,
         }
     }
 
-    if (!mbx->view_filter) {
+    if (!mbx->view_filter)
         match = TRUE;
-    } else if (!libbalsa_condition_is_flag_only(mbx->view_filter,
-                                                mbx, msgno, &match)) {
+    else if (!libbalsa_condition_is_flag_only(mbx->view_filter,
+                                              mbx, msgno, &match))
         match = message_match_real(mbx, msgno, mbx->view_filter);
-    }
 
-    if (match) {
+    if (match)
         libbalsa_mailbox_msgno_inserted(mbx, msgno, mbx->msg_tree,
                                         sibling);
-    }
 }
 
-
 /* Threading info. */
 typedef struct {
     gchar *message_id;
@@ -395,7 +372,7 @@ typedef struct {
 } LibBalsaMailboxLocalInfo;
 
 static void
-lbm_local_free_info(LibBalsaMailboxLocalInfo *info)
+lbm_local_free_info(LibBalsaMailboxLocalInfo * info)
 {
     if (info != NULL) {
         g_free(info->message_id);
@@ -405,9 +382,8 @@ lbm_local_free_info(LibBalsaMailboxLocalInfo *info)
     }
 }
 
-
 static void
-libbalsa_mailbox_local_dispose(GObject *object)
+libbalsa_mailbox_local_dispose(GObject * object)
 {
     LibBalsaMailboxLocal *ml;
 
@@ -423,9 +399,8 @@ libbalsa_mailbox_local_dispose(GObject *object)
     G_OBJECT_CLASS(parent_class)->dispose(object);
 }
 
-
 static void
-libbalsa_mailbox_local_finalize(GObject *object)
+libbalsa_mailbox_local_finalize(GObject * object)
 {
     LibBalsaMailboxLocal *ml;
 
@@ -434,27 +409,26 @@ libbalsa_mailbox_local_finalize(GObject *object)
     ml = LIBBALSA_MAILBOX_LOCAL(object);
 
     if (ml->threading_info != NULL) {
-        /* The memory owned by ml->threading_info was freed on closing,
-         * so we free only the array itself. */
-        g_ptr_array_free(ml->threading_info, TRUE);
+       /* The memory owned by ml->threading_info was freed on closing,
+        * so we free only the array itself. */
+       g_ptr_array_free(ml->threading_info, TRUE);
     }
 
     G_OBJECT_CLASS(parent_class)->finalize(object);
 }
 
 
-static void lbm_local_queue_save_tree(LibBalsaMailboxLocal *local);
+static void lbm_local_queue_save_tree(LibBalsaMailboxLocal * local);
 
 static void
-libbalsa_mailbox_local_changed(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_local_changed(LibBalsaMailbox * mailbox)
 {
     lbm_local_queue_save_tree(LIBBALSA_MAILBOX_LOCAL(mailbox));
 }
 
-
 static void
-libbalsa_mailbox_local_save_config(LibBalsaMailbox *mailbox,
-                                   const gchar     *prefix)
+libbalsa_mailbox_local_save_config(LibBalsaMailbox * mailbox,
+                                  const gchar * prefix)
 {
     LibBalsaMailboxLocal *local;
 
@@ -464,17 +438,15 @@ libbalsa_mailbox_local_save_config(LibBalsaMailbox *mailbox,
 
     libbalsa_conf_set_string("Path", libbalsa_mailbox_local_get_path(local));
 
-    if (LIBBALSA_MAILBOX_CLASS(parent_class)->save_config) {
-        LIBBALSA_MAILBOX_CLASS(parent_class)->save_config(mailbox, prefix);
-    }
+    if (LIBBALSA_MAILBOX_CLASS(parent_class)->save_config)
+       LIBBALSA_MAILBOX_CLASS(parent_class)->save_config(mailbox, prefix);
 }
 
-
 static void
-libbalsa_mailbox_local_load_config(LibBalsaMailbox *mailbox,
-                                   const gchar     *prefix)
+libbalsa_mailbox_local_load_config(LibBalsaMailbox * mailbox,
+                                  const gchar * prefix)
 {
-    gchar *path;
+    gchar* path;
     g_return_if_fail(LIBBALSA_IS_MAILBOX_LOCAL(mailbox));
 
     g_free(mailbox->url);
@@ -483,20 +455,17 @@ libbalsa_mailbox_local_load_config(LibBalsaMailbox *mailbox,
     mailbox->url = g_strconcat("file://", path, NULL);
     g_free(path);
 
-    if (LIBBALSA_MAILBOX_CLASS(parent_class)->load_config) {
-        LIBBALSA_MAILBOX_CLASS(parent_class)->load_config(mailbox, prefix);
-    }
+    if (LIBBALSA_MAILBOX_CLASS(parent_class)->load_config)
+       LIBBALSA_MAILBOX_CLASS(parent_class)->load_config(mailbox, prefix);
 }
 
-
 /*
  * Save and restore the message tree.
  */
 
 typedef struct {
-    GArray *array;
-    guint (*fileno)(LibBalsaMailboxLocal *local,
-                    guint                 msgno);
+    GArray * array;
+    guint (*fileno)(LibBalsaMailboxLocal * local, guint msgno);
     LibBalsaMailboxLocal *local;
 } LibBalsaMailboxLocalSaveTreeInfo;
 
@@ -512,9 +481,8 @@ typedef struct {
  * Save one item; return TRUE on error, to terminate the traverse.
  */
 static gboolean
-lbm_local_save_tree_item(guint                             msgno,
-                         guint                             a,
-                         LibBalsaMailboxLocalSaveTreeInfo *save_info)
+lbm_local_save_tree_item(guint msgno, guint a,
+                         LibBalsaMailboxLocalSaveTreeInfo * save_info)
 {
     LibBalsaMailboxLocalTreeInfo info;
 
@@ -532,25 +500,22 @@ lbm_local_save_tree_item(guint                             msgno,
     return g_array_append_val(save_info->array, info) == NULL;
 }
 
-
 static gboolean
-lbm_local_save_tree_func(GNode   *node,
-                         gpointer data)
+lbm_local_save_tree_func(GNode * node, gpointer data)
 {
     return node->parent ?
-           lbm_local_save_tree_item(GPOINTER_TO_UINT(node->data),
-                                    GPOINTER_TO_UINT(node->parent->data),
-                                    data) :
-           FALSE;
+        lbm_local_save_tree_item(GPOINTER_TO_UINT(node->data),
+                                 GPOINTER_TO_UINT(node->parent->data),
+                                 data) :
+        FALSE;
 }
 
-
 static gchar *
-lbm_local_get_cache_filename(LibBalsaMailboxLocal *local)
+lbm_local_get_cache_filename(LibBalsaMailboxLocal * local)
 {
     gchar *encoded_path;
     gchar *filename;
-
+    
     encoded_path =
         libbalsa_urlencode(libbalsa_mailbox_local_get_path(local));
     filename =
@@ -560,9 +525,8 @@ lbm_local_get_cache_filename(LibBalsaMailboxLocal *local)
     return filename;
 }
 
-
 static void
-lbm_local_save_tree(LibBalsaMailboxLocal *local)
+lbm_local_save_tree(LibBalsaMailboxLocal * local)
 {
     LibBalsaMailbox *mailbox = LIBBALSA_MAILBOX(local);
     gchar *filename;
@@ -571,18 +535,17 @@ lbm_local_save_tree(LibBalsaMailboxLocal *local)
 
     g_assert(LIBBALSA_MAILBOX_LOCAL_GET_CLASS(local) != NULL);
 
-    if (!mailbox->msg_tree || !mailbox->msg_tree_changed) {
+    if (!mailbox->msg_tree || !mailbox->msg_tree_changed)
         return;
-    }
     mailbox->msg_tree_changed = FALSE;
 
     filename = lbm_local_get_cache_filename(local);
 
     if (!mailbox->msg_tree->children
-        || ((libbalsa_mailbox_get_threading_type(mailbox) ==
-             LB_MAILBOX_THREADING_FLAT)
-            && (libbalsa_mailbox_get_sort_field(mailbox) ==
-                LB_MAILBOX_SORT_NO))) {
+        || (libbalsa_mailbox_get_threading_type(mailbox) ==
+            LB_MAILBOX_THREADING_FLAT
+            && libbalsa_mailbox_get_sort_field(mailbox) ==
+            LB_MAILBOX_SORT_NO)) {
         unlink(filename);
         g_free(filename);
         return;
@@ -612,10 +575,8 @@ lbm_local_save_tree(LibBalsaMailboxLocal *local)
     g_free(filename);
 }
 
-
 static gboolean
-lbm_local_restore_tree(LibBalsaMailboxLocal *local,
-                       guint                *total)
+lbm_local_restore_tree(LibBalsaMailboxLocal * local, guint * total)
 {
     LibBalsaMailbox *mailbox = LIBBALSA_MAILBOX(local);
     gchar *filename;
@@ -636,15 +597,14 @@ lbm_local_restore_tree(LibBalsaMailboxLocal *local,
     name = mailbox->name ? g_strdup(mailbox->name) :
         g_path_get_basename(libbalsa_mailbox_local_get_path(local));
 
-    if ((stat(filename, &st) < 0)
-        || (st.st_mtime < libbalsa_mailbox_get_mtime(mailbox))) {
+    if (stat(filename, &st) < 0
+        || st.st_mtime < libbalsa_mailbox_get_mtime(mailbox)) {
         /* No error, but we return FALSE so the caller can grab all the
          * message info needed to rethread from scratch. */
-        if (libbalsa_mailbox_total_messages(mailbox) > 0) {
+        if (libbalsa_mailbox_total_messages(mailbox) > 0)
             libbalsa_information(LIBBALSA_INFORMATION_DEBUG,
                                  _("Cache file for mailbox %s "
                                    "will be created"), name);
-        }
         g_free(filename);
         g_free(name);
         return FALSE;
@@ -663,12 +623,12 @@ lbm_local_restore_tree(LibBalsaMailboxLocal *local,
 
     info = (LibBalsaMailboxLocalTreeInfo *) contents;
     /* Sanity checks: first the file should have >= 1 record. */
-    if ((length < sizeof(LibBalsaMailboxLocalTreeInfo))
+    if (length < sizeof(LibBalsaMailboxLocalTreeInfo)
         /* First record is (0, total): */
-        || (info->msgno != 0)
+        || info->msgno != 0
         /* Total must be > 0 (no file is created for empty tree). */
-        || (info->value.total == 0)
-        || (info->value.total > libbalsa_mailbox_total_messages(mailbox))) {
+        || info->value.total == 0
+        || info->value.total > libbalsa_mailbox_total_messages(mailbox)) {
         libbalsa_information(LIBBALSA_INFORMATION_DEBUG,
                              _("Cache file for mailbox %s "
                                "will be repaired"), name);
@@ -684,7 +644,7 @@ lbm_local_restore_tree(LibBalsaMailboxLocal *local,
     get_info = LIBBALSA_MAILBOX_LOCAL_GET_CLASS(local)->get_info;
     while (++info < (LibBalsaMailboxLocalTreeInfo *) (contents + length)) {
         LibBalsaMailboxLocalMessageInfo *msg_info;
-        if ((info->msgno == 0) || (info->msgno > *total)
+        if (info->msgno == 0 || info->msgno > *total
             || seen[info->msgno - 1]) {
             libbalsa_information(LIBBALSA_INFORMATION_DEBUG,
                                  _("Cache file for mailbox %s "
@@ -697,7 +657,7 @@ lbm_local_restore_tree(LibBalsaMailboxLocal *local,
         seen[info->msgno - 1] = TRUE;
 
         if (sibling
-            && (info->value.parent == GPOINTER_TO_UINT(sibling->data))) {
+            && info->value.parent == GPOINTER_TO_UINT(sibling->data)) {
             /* This message is the first child of the previous one. */
             parent = sibling;
             sibling = NULL;
@@ -727,12 +687,12 @@ lbm_local_restore_tree(LibBalsaMailboxLocal *local,
 
         if (libbalsa_mailbox_msgno_has_flags(mailbox, info->msgno,
                                              LIBBALSA_MESSAGE_FLAG_NEW,
-                                             LIBBALSA_MESSAGE_FLAG_DELETED)) {
+                                             LIBBALSA_MESSAGE_FLAG_DELETED))
+        {
             ++mailbox->unread_messages;
-            if ((mailbox->first_unread == 0) ||
-                (mailbox->first_unread > info->msgno)) {
+            if (mailbox->first_unread == 0 ||
+                mailbox->first_unread > info->msgno)
                 mailbox->first_unread = info->msgno;
-            }
         }
     }
 
@@ -743,51 +703,45 @@ lbm_local_restore_tree(LibBalsaMailboxLocal *local,
     return TRUE;
 }
 
-
 static void
-lbm_local_save_tree_real(LibBalsaMailboxLocal *local)
+lbm_local_save_tree_real(LibBalsaMailboxLocal * local)
 {
     LibBalsaMailbox *mailbox = LIBBALSA_MAILBOX(local);
 
     libbalsa_lock_mailbox(mailbox);
 
-    if (MAILBOX_OPEN(mailbox) && mailbox->msg_tree_changed) {
+    if (MAILBOX_OPEN(mailbox) && mailbox->msg_tree_changed)
         lbm_local_save_tree(local);
-    }
     local->save_tree_id = 0;
 
     libbalsa_unlock_mailbox(mailbox);
 }
 
-
 static gboolean
-lbm_local_save_tree_idle(LibBalsaMailboxLocal *local)
+lbm_local_save_tree_idle(LibBalsaMailboxLocal * local)
 {
     lbm_local_save_tree_real(local);
 
     return FALSE;
 }
 
-
 static void
-lbm_local_queue_save_tree(LibBalsaMailboxLocal *local)
+lbm_local_queue_save_tree(LibBalsaMailboxLocal * local)
 {
     libbalsa_lock_mailbox((LibBalsaMailbox *) local);
-    if (!local->save_tree_id) {
+    if (!local->save_tree_id)
         local->save_tree_id =
             g_idle_add((GSourceFunc) lbm_local_save_tree_idle, local);
-    }
     libbalsa_unlock_mailbox((LibBalsaMailbox *) local);
 }
 
-
-/*
+/* 
  * End of save and restore the message tree.
  */
 
 static void
-libbalsa_mailbox_local_close_mailbox(LibBalsaMailbox *mailbox,
-                                     gboolean         expunge)
+libbalsa_mailbox_local_close_mailbox(LibBalsaMailbox * mailbox,
+                                     gboolean expunge)
 {
     LibBalsaMailboxLocal *local = LIBBALSA_MAILBOX_LOCAL(mailbox);
     guint i;
@@ -808,14 +762,14 @@ libbalsa_mailbox_local_close_mailbox(LibBalsaMailbox *mailbox,
         libbalsa_mailbox_set_threading(mailbox, cur_type);
     }
 
-    /* Save immediately. */
+        /* Save immediately. */
     libbalsa_clear_source_id(&local->save_tree_id);
     lbm_local_save_tree(local);
 
     if (local->threading_info) {
-        /* Free the memory owned by local->threading_info, but neither
-         * free nor truncate the array. */
-        for (i = local->threading_info->len; i > 0; ) {
+       /* Free the memory owned by local->threading_info, but neither
+        * free nor truncate the array. */
+        for (i = local->threading_info->len; i > 0;) {
             gpointer *entry =
                 &g_ptr_array_index(local->threading_info, --i);
             lbm_local_free_info(*entry);
@@ -830,18 +784,15 @@ libbalsa_mailbox_local_close_mailbox(LibBalsaMailbox *mailbox,
     }
     local->pool_seqno = 0;
 
-    if (LIBBALSA_MAILBOX_CLASS(parent_class)->close_mailbox) {
+    if (LIBBALSA_MAILBOX_CLASS(parent_class)->close_mailbox)
         LIBBALSA_MAILBOX_CLASS(parent_class)->close_mailbox(mailbox,
                                                             expunge);
-    }
 }
 
-
 /* LibBalsaMailbox get_message class method */
 
 static LibBalsaMessage *
-libbalsa_mailbox_local_get_message(LibBalsaMailbox *mailbox,
-                                   guint            msgno)
+libbalsa_mailbox_local_get_message(LibBalsaMailbox * mailbox, guint msgno)
 {
     LibBalsaMailboxLocal *local = LIBBALSA_MAILBOX_LOCAL(mailbox);
     LibBalsaMailboxLocalMessageInfo *msg_info;
@@ -849,26 +800,23 @@ libbalsa_mailbox_local_get_message(LibBalsaMailbox *mailbox,
     g_assert(LIBBALSA_MAILBOX_LOCAL_GET_CLASS(local) != NULL);
     msg_info = LIBBALSA_MAILBOX_LOCAL_GET_CLASS(local)->get_info(local, msgno);
 
-    if (msg_info->message) {
+    if (msg_info->message)
         return g_object_ref(msg_info->message);
-    }
 
     lbm_local_get_message_with_msg_info(local, msgno, msg_info);
 
     return msg_info->message;
 }
 
-
 /* Search iters. We do not use the fallback version because it does
    lot of reparsing. Instead, we use LibBalsaMailboxIndex entry
    whenever possible - it is so quite frequently. This is a big
    improvement for mailboxes of several megabytes and few thousand
    messages.
- */
+*/
 
 static gboolean
-message_match_real(LibBalsaMailbox   *mailbox,
-                   guint              msgno,
+message_match_real(LibBalsaMailbox *mailbox, guint msgno,
                    LibBalsaCondition *cond)
 {
     LibBalsaMailboxLocal *local = (LibBalsaMailboxLocal *) mailbox;
@@ -876,7 +824,7 @@ message_match_real(LibBalsaMailbox   *mailbox,
     gboolean match = FALSE;
     gboolean is_refed = FALSE;
     LibBalsaMailboxIndexEntry *entry =
-        g_ptr_array_index(mailbox->mindex, msgno - 1);
+        g_ptr_array_index(mailbox->mindex, msgno-1);
     LibBalsaMailboxLocalInfo *info =
         msgno <= local->threading_info->len ?
         g_ptr_array_index(local->threading_info, msgno - 1) : NULL;
@@ -886,29 +834,25 @@ message_match_real(LibBalsaMailbox   *mailbox,
      * fetch it here, and that will also populate entry and info. */
     if (!entry || !info) {
         message = libbalsa_mailbox_get_message(mailbox, msgno);
-        if (!message) {
+        if (!message)
             return FALSE;
-        }
         libbalsa_mailbox_local_cache_message(local, msgno, message);
-        entry = g_ptr_array_index(mailbox->mindex, msgno - 1);
-        info = g_ptr_array_index(local->threading_info, msgno - 1);
+        entry = g_ptr_array_index(mailbox->mindex, msgno-1);
+        info  = g_ptr_array_index(local->threading_info, msgno - 1);
     }
 
-    if (entry->idle_pending) {
+    if (entry->idle_pending)
         return FALSE;   /* Can't match. */
 
-    }
     switch (cond->type) {
     case CONDITION_STRING:
         if (CONDITION_CHKMATCH(cond, (CONDITION_MATCH_TO |
                                       CONDITION_MATCH_CC |
                                       CONDITION_MATCH_BODY))) {
-            if (!message) {
+            if (!message)
                 message = libbalsa_mailbox_get_message(mailbox, msgno);
-            }
-            if (!message) {
+            if (!message)
                 return FALSE;
-            }
             is_refed = libbalsa_message_body_ref(message, FALSE, FALSE);
             if (!is_refed) {
                 libbalsa_information(LIBBALSA_INFORMATION_ERROR,
@@ -920,7 +864,7 @@ message_match_real(LibBalsaMailbox   *mailbox,
         }
 
         /* do the work */
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_TO)) {
+       if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_TO)) {
             g_assert(is_refed);
             if (message->headers->to_list) {
                 gchar *str =
@@ -929,26 +873,25 @@ message_match_real(LibBalsaMailbox   *mailbox,
                 match =
                     libbalsa_utf8_strstr(str, cond->match.string.string);
                 g_free(str);
-                if (match) {
+                if (match)
                     break;
-                }
             }
-        }
+       }
         if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_FROM)) {
-            if (libbalsa_utf8_strstr(info->sender,
-                                     cond->match.string.string)) {
+           if (libbalsa_utf8_strstr(info->sender,
+                                     cond->match.string.string)) { 
                 match = TRUE;
                 break;
             }
         }
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_SUBJECT)) {
-            if (libbalsa_utf8_strstr(entry->subject,
-                                     cond->match.string.string)) {
+       if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_SUBJECT)) {
+           if (libbalsa_utf8_strstr(entry->subject,
+                                     cond->match.string.string)) { 
                 match = TRUE;
                 break;
             }
-        }
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_CC)) {
+       }
+       if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_CC)) {
             g_assert(is_refed);
             if (message->headers->cc_list) {
                 gchar *str =
@@ -957,21 +900,18 @@ message_match_real(LibBalsaMailbox   *mailbox,
                 match =
                     libbalsa_utf8_strstr(str, cond->match.string.string);
                 g_free(str);
-                if (match) {
+                if (match)
                     break;
-                }
             }
-        }
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_US_HEAD)) {
+       }
+       if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_US_HEAD)) {
             if (cond->match.string.user_header) {
                 const gchar *header;
 
-                if (!message) {
+                if (!message)
                     message = libbalsa_mailbox_get_message(mailbox, msgno);
-                }
-                if (!message) {
+                if (!message)
                     return FALSE;
-                }
                 header =
                     libbalsa_message_get_user_header(message,
                                                      cond->match.string.
@@ -982,78 +922,66 @@ message_match_real(LibBalsaMailbox   *mailbox,
                     break;
                 }
             }
-        }
-        if (CONDITION_CHKMATCH(cond, CONDITION_MATCH_BODY)) {
+       }
+       if (CONDITION_CHKMATCH(cond,CONDITION_MATCH_BODY)) {
             GString *body;
             g_assert(is_refed);
-            if (!message->mailbox) {
+           if (!message->mailbox) {
                 /* No need to body-unref */
                 g_object_unref(message);
-                return FALSE; /* We don't want to match if an error occurred */
+               return FALSE; /* We don't want to match if an error occurred */
             }
             body = content2reply(message->body_list, NULL, 0, FALSE, FALSE);
-            if (body) {
-                if (body->str) {
+           if (body) {
+               if (body->str)
                     match = libbalsa_utf8_strstr(body->str,
                                                  cond->match.string.string);
-                }
-                g_string_free(body, TRUE);
-            }
-        }
-        break;
-
+               g_string_free(body,TRUE);
+           }
+       }
+       break;
     case CONDITION_REGEX:
         break;
-
     case CONDITION_DATE:
-        match =
+        match = 
             entry->msg_date >= cond->match.date.date_low &&
-            (cond->match.date.date_high == 0 ||
-             entry->msg_date <= cond->match.date.date_high);
+            (cond->match.date.date_high==0 || 
+             entry->msg_date<=cond->match.date.date_high);
         break;
-
     case CONDITION_FLAG:
         match = libbalsa_mailbox_msgno_has_flags(mailbox, msgno,
                                                  cond->match.flags, 0);
         break;
-
     case CONDITION_AND:
         match =
             message_match_real(mailbox, msgno, cond->match.andor.left) &&
             message_match_real(mailbox, msgno, cond->match.andor.right);
         break;
-
     case CONDITION_OR:
         match =
             message_match_real(mailbox, msgno, cond->match.andor.left) ||
             message_match_real(mailbox, msgno, cond->match.andor.right);
         break;
-
     /* To avoid warnings */
     case CONDITION_NONE:
         break;
     }
-    if (message) {
-        if (is_refed) {
-            libbalsa_message_body_unref(message);
-        }
+    if(message) {
+        if(is_refed) libbalsa_message_body_unref(message);
         g_object_unref(message);
     }
     return cond->negate ? !match : match;
 }
-
-
 static gboolean
-libbalsa_mailbox_local_message_match(LibBalsaMailbox           *mailbox,
-                                     guint                      msgno,
-                                     LibBalsaMailboxSearchIter *iter)
+libbalsa_mailbox_local_message_match(LibBalsaMailbox * mailbox,
+                                    guint msgno,
+                                    LibBalsaMailboxSearchIter * iter)
 {
     return message_match_real(mailbox, msgno, iter->condition);
 }
 
-
 /*
- * private
+ * private 
  * PS: called by mail_progress_notify_cb:
  * loads incrementally new messages, if any.
  *  Mailbox lock MUST BE HELD before calling this function.
@@ -1063,32 +991,28 @@ libbalsa_mailbox_local_message_match(LibBalsaMailbox           *mailbox,
  *  other info.
  */
 void
-libbalsa_mailbox_local_cache_message(LibBalsaMailboxLocal *local,
-                                     guint                 msgno,
-                                     LibBalsaMessage      *message)
+libbalsa_mailbox_local_cache_message(LibBalsaMailboxLocal * local,
+                                     guint msgno,
+                                     LibBalsaMessage * message)
 {
     gpointer *entry;
     LibBalsaMailboxLocalInfo *info;
 
-    if (!message) {
+    if (!message)
         return;
-    }
 
     libbalsa_mailbox_cache_message(LIBBALSA_MAILBOX(local), msgno,
                                    message);
 
-    if (!local->threading_info) {
+    if (!local->threading_info)
         return;
-    }
 
-    while (local->threading_info->len < msgno) {
+    while (local->threading_info->len < msgno)
         g_ptr_array_add(local->threading_info, NULL);
-    }
     entry = &g_ptr_array_index(local->threading_info, msgno - 1);
 
-    if (*entry) {
+    if (*entry)
         return;
-    }
 
     *entry = info = g_new(LibBalsaMailboxLocalInfo, 1);
     info->message_id = g_strdup(message->message_id);
@@ -1096,26 +1020,22 @@ libbalsa_mailbox_local_cache_message(LibBalsaMailboxLocal *local,
         libbalsa_message_refs_for_threading(message);
 
     info->sender = NULL;
-    if (message->headers->from) {
+    if (message->headers->from)
         info->sender =
             internet_address_list_to_string(message->headers->from, FALSE);
-    }
-    if (!info->sender) {
+    if (!info->sender)
         info->sender = g_strdup("");
-    }
 }
 
-
 static gboolean
-lbml_load_messages_idle_cb(LibBalsaMailbox *mailbox)
+lbml_load_messages_idle_cb(LibBalsaMailbox * mailbox)
 {
     guint msgno;
     guint new_messages;
     LibBalsaMailboxLocal *local;
     guint lastno;
     GNode *lastn;
-    LibBalsaMailboxLocalMessageInfo *(*get_info) (LibBalsaMailboxLocal *,
-                                                  guint);
+    LibBalsaMailboxLocalMessageInfo *(*get_info) (LibBalsaMailboxLocal *, guint);
 
     local = (LibBalsaMailboxLocal *) mailbox;
     g_assert(LIBBALSA_MAILBOX_LOCAL_GET_CLASS(local) != NULL);
@@ -1124,9 +1044,9 @@ lbml_load_messages_idle_cb(LibBalsaMailbox *mailbox)
     local->load_messages_id = 0;
 
     if (!mailbox->msg_tree) {
-        /* Mailbox is closed, or no view has been created. */
+       /* Mailbox is closed, or no view has been created. */
         libbalsa_unlock_mailbox(mailbox);
-        return FALSE;
+       return FALSE;
     }
 
     lastno = libbalsa_mailbox_total_messages(mailbox);
@@ -1134,32 +1054,30 @@ lbml_load_messages_idle_cb(LibBalsaMailbox *mailbox)
     new_messages = lastno - msgno;
     lastn = g_node_last_child(mailbox->msg_tree);
     get_info = LIBBALSA_MAILBOX_LOCAL_GET_CLASS(local)->get_info;
-    while (++msgno <= lastno) {
+    while (++msgno <= lastno){
         LibBalsaMailboxLocalMessageInfo *msg_info = get_info(local, msgno);
 
-        libbalsa_mailbox_local_load_message(local, &lastn, msgno, msg_info);
+       libbalsa_mailbox_local_load_message(local, &lastn, msgno, msg_info);
 
-        if (msg_info->message) {
+       if (msg_info->message)
             libbalsa_mailbox_local_cache_message(local, msgno,
                                                  msg_info->message);
-        }
     }
 
     if (new_messages) {
-        libbalsa_mailbox_run_filters_on_reception(mailbox);
-        libbalsa_mailbox_set_unread_messages_flag(mailbox,
-                                                  mailbox->
-                                                  unread_messages > 0);
+       libbalsa_mailbox_run_filters_on_reception(mailbox);
+       libbalsa_mailbox_set_unread_messages_flag(mailbox,
+                                                 mailbox->
+                                                 unread_messages > 0);
     }
 
     libbalsa_unlock_mailbox(mailbox);
     return FALSE;
 }
 
-
 void
 libbalsa_mailbox_local_load_messages(LibBalsaMailbox *mailbox,
-                                     guint            msgno)
+                                     guint msgno)
 {
     LibBalsaMailboxLocal *local;
 
@@ -1175,33 +1093,29 @@ libbalsa_mailbox_local_load_messages(LibBalsaMailbox *mailbox,
     libbalsa_unlock_mailbox(mailbox);
 }
 
-
 /*
  * Threading
  */
 
-static void lbml_threading_jwz(LibBalsaMailbox *mailbox);
-static void lbml_threading_simple(LibBalsaMailbox             *mailbox,
-                                  LibBalsaMailboxThreadingType th_type);
+static void lbml_threading_jwz(LibBalsaMailbox * mailbox);
+static void lbml_threading_simple(LibBalsaMailbox * mailbox,
+                                 LibBalsaMailboxThreadingType th_type);
 
-void
-libbalsa_mailbox_local_set_threading_info(LibBalsaMailboxLocal *local)
+void 
+libbalsa_mailbox_local_set_threading_info(LibBalsaMailboxLocal * local)
 {
-    if (!local->threading_info) {
+    if (!local->threading_info)
         local->threading_info = g_ptr_array_new();
-    }
 }
 
-
 static void
-lbml_set_threading(LibBalsaMailbox             *mailbox,
+lbml_set_threading(LibBalsaMailbox * mailbox,
                    LibBalsaMailboxThreadingType thread_type)
 {
     switch (thread_type) {
     case LB_MAILBOX_THREADING_JWZ:
         lbml_threading_jwz(mailbox);
         break;
-
     case LB_MAILBOX_THREADING_FLAT:
     case LB_MAILBOX_THREADING_SIMPLE:
         lbml_threading_simple(mailbox, thread_type);
@@ -1209,14 +1123,13 @@ lbml_set_threading(LibBalsaMailbox             *mailbox,
     }
 }
 
-
 typedef struct {
     LibBalsaMailbox *mailbox;
     LibBalsaMailboxThreadingType thread_type;
 } LbmlSetThreadingInfo;
 
 static gboolean
-lbml_set_threading_idle_cb(LbmlSetThreadingInfo *info)
+lbml_set_threading_idle_cb(LbmlSetThreadingInfo * info)
 {
     lbml_set_threading(info->mailbox, info->thread_type);
     g_object_unref(info->mailbox);
@@ -1224,9 +1137,8 @@ lbml_set_threading_idle_cb(LbmlSetThreadingInfo *info)
     return FALSE;
 }
 
-
 static void
-libbalsa_mailbox_local_set_threading(LibBalsaMailbox *mailbox,
+libbalsa_mailbox_local_set_threading(LibBalsaMailbox * mailbox,
                                      LibBalsaMailboxThreadingType
                                      thread_type)
 {
@@ -1251,22 +1163,20 @@ libbalsa_mailbox_local_set_threading(LibBalsaMailbox *mailbox,
         mailbox->msg_tree_changed = FALSE;
 
         if (total < libbalsa_mailbox_total_messages(mailbox)) {
-            if (!natural) {
+            if (!natural)
                 /* Get message info for all messages that weren't restored,
                  * so we can thread and sort them correctly before the
                  * mailbox is displayed. */
                 libbalsa_mailbox_prepare_threading(mailbox, total);
-            }
             libbalsa_mailbox_local_load_messages(mailbox, total);
         }
 
 #if defined(DEBUG_LOADING_AND_THREADING)
         printf("after load messages: time=%lu\n", (unsigned long) time(NULL));
 #endif
-        if (natural) {
+        if (natural)
             /* No need to thread. */
             return;
-        }
     }
 
     if (libbalsa_am_i_subthread()) {
@@ -1286,28 +1196,26 @@ libbalsa_mailbox_local_set_threading(LibBalsaMailbox *mailbox,
     lbm_local_queue_save_tree(local);
 }
 
-
 void
-libbalsa_mailbox_local_msgno_removed(LibBalsaMailbox *mailbox,
-                                     guint            msgno)
+libbalsa_mailbox_local_msgno_removed(LibBalsaMailbox * mailbox,
+                                    guint msgno)
 {
     LibBalsaMailboxLocal *local = LIBBALSA_MAILBOX_LOCAL(mailbox);
 
     /* local might not have a threading-info array, and even if it does,
      * it might not be populated; we check both. */
-    if (local->threading_info && (msgno <= local->threading_info->len)) {
-        lbm_local_free_info(g_ptr_array_index(local->threading_info,
-                                              msgno - 1));
-        g_ptr_array_remove_index(local->threading_info, msgno - 1);
+    if (local->threading_info && msgno <= local->threading_info->len) {
+       lbm_local_free_info(g_ptr_array_index(local->threading_info,
+                                             msgno - 1));
+       g_ptr_array_remove_index(local->threading_info, msgno - 1);
     }
 
     libbalsa_mailbox_msgno_removed(mailbox, msgno);
 }
 
-
 static void
-lbm_local_update_view_filter(LibBalsaMailbox   *mailbox,
-                             LibBalsaCondition *view_filter)
+lbm_local_update_view_filter(LibBalsaMailbox * mailbox,
+                             LibBalsaCondition * view_filter)
 {
     guint total;
     LibBalsaProgress progress = LIBBALSA_PROGRESS_INIT;
@@ -1338,12 +1246,10 @@ lbm_local_update_view_filter(LibBalsaMailbox   *mailbox,
 
     /* If this is not a flags-only filter, the new mailbox tree is
      * temporary, so we don't want to save it. */
-    if (is_flag_only) {
+    if (is_flag_only)
         lbm_local_queue_save_tree(LIBBALSA_MAILBOX_LOCAL(mailbox));
-    }
 }
 
-
 /*
  * Prepare-threading method: brute force--create and destroy the
  * LibBalsaMessage; the back end is responsible for caching it here and
@@ -1353,21 +1259,18 @@ lbm_local_update_view_filter(LibBalsaMailbox   *mailbox,
 /* Helper: returns TRUE if msgno was not already cached, which means we
  * have new data for sorting or threading. */
 static gboolean
-lbm_local_prepare_msgno(LibBalsaMailboxLocal *local,
-                        guint                 msgno)
+lbm_local_prepare_msgno(LibBalsaMailboxLocal * local, guint msgno)
 {
     LibBalsaMessage *message;
 
-    if ((msgno <= local->threading_info->len)
-        && g_ptr_array_index(local->threading_info, msgno - 1)) {
+    if (msgno <= local->threading_info->len
+        && g_ptr_array_index(local->threading_info, msgno - 1))
         return FALSE;
-    }
 
     message =
         libbalsa_mailbox_get_message((LibBalsaMailbox *) local, msgno);
-    if (!message) {
+    if (!message)
         return FALSE;
-    }
 
     libbalsa_mailbox_local_cache_message(local, msgno, message);
     g_object_unref(message);
@@ -1375,10 +1278,9 @@ lbm_local_prepare_msgno(LibBalsaMailboxLocal *local,
     return TRUE;
 }
 
-
 /* Idle handler. */
 static gboolean
-lbm_local_thread_idle(LibBalsaMailboxLocal *local)
+lbm_local_thread_idle(LibBalsaMailboxLocal * local)
 {
     LibBalsaMailbox *mailbox = LIBBALSA_MAILBOX(local);
 
@@ -1398,12 +1300,11 @@ lbm_local_thread_idle(LibBalsaMailboxLocal *local)
     return FALSE;
 }
 
-
 /* The class method; prepare messages from start + 1 to the end of the
  * mailbox; return TRUE if successful. */
 static gboolean
-libbalsa_mailbox_local_prepare_threading(LibBalsaMailbox *mailbox,
-                                         guint            start)
+libbalsa_mailbox_local_prepare_threading(LibBalsaMailbox * mailbox,
+                                         guint start)
 {
     LibBalsaMailboxLocal *local = LIBBALSA_MAILBOX_LOCAL(mailbox);
     guint msgno;
@@ -1438,10 +1339,10 @@ libbalsa_mailbox_local_prepare_threading(LibBalsaMailbox *mailbox,
     libbalsa_progress_set_text(&progress, NULL, 0);
 
     if (retval && need_thread && !local->thread_id) {
-        if ((libbalsa_mailbox_get_threading_type(mailbox) !=
-             LB_MAILBOX_THREADING_FLAT)
-            || (libbalsa_mailbox_get_sort_field(mailbox) !=
-                LB_MAILBOX_SORT_NO)) {
+        if (libbalsa_mailbox_get_threading_type(mailbox) !=
+            LB_MAILBOX_THREADING_FLAT
+            || libbalsa_mailbox_get_sort_field(mailbox) !=
+            LB_MAILBOX_SORT_NO) {
             g_object_ref(local);
             local->thread_id =
                 g_idle_add((GSourceFunc) lbm_local_thread_idle, local);
@@ -1452,32 +1353,30 @@ libbalsa_mailbox_local_prepare_threading(LibBalsaMailbox *mailbox,
     return retval;
 }
 
-
 /* fetch message structure method: all local mailboxes have their own
  * methods, which ensure that message->mime_msg != NULL, then chain up
  * to this one.
  */
 
 static gboolean
-libbalsa_mailbox_local_fetch_structure(LibBalsaMailbox  *mailbox,
-                                       LibBalsaMessage  *message,
+libbalsa_mailbox_local_fetch_structure(LibBalsaMailbox *mailbox,
+                                       LibBalsaMessage *message,
                                        LibBalsaFetchFlag flags)
 {
     GMimeMessage *mime_message = message->mime_msg;
 
-    if (!mime_message || !mime_message->mime_part) {
-        return FALSE;
-    }
+    if (!mime_message || !mime_message->mime_part)
+       return FALSE;
 
-    if (flags & LB_FETCH_STRUCTURE) {
+    if(flags & LB_FETCH_STRUCTURE) {
         LibBalsaMessageBody *body = libbalsa_message_body_new(message);
         libbalsa_message_body_set_mime_body(body,
                                             mime_message->mime_part);
         libbalsa_message_append_part(message, body);
         libbalsa_message_headers_from_gmime(message->headers, mime_message);
     }
-    if (flags & LB_FETCH_RFC822_HEADERS) {
-        message->headers->user_hdrs =
+    if(flags & LB_FETCH_RFC822_HEADERS) {
+        message->headers->user_hdrs = 
             libbalsa_message_user_hdrs_from_gmime(mime_message);
         message->has_all_headers = 1;
     }
@@ -1485,48 +1384,45 @@ libbalsa_mailbox_local_fetch_structure(LibBalsaMailbox  *mailbox,
     return TRUE;
 }
 
-
 static void
-libbalsa_mailbox_local_fetch_headers(LibBalsaMailbox *mailbox,
-                                     LibBalsaMessage *message)
+libbalsa_mailbox_local_fetch_headers(LibBalsaMailbox * mailbox,
+                                    LibBalsaMessage * message)
 {
     g_return_if_fail(message->headers->user_hdrs == NULL);
 
-    if (message->mime_msg) {
-        message->headers->user_hdrs =
-            libbalsa_message_user_hdrs_from_gmime(message->mime_msg);
-    } else {
-        libbalsa_mailbox_fetch_message_structure(mailbox, message,
-                                                 LB_FETCH_RFC822_HEADERS);
-        libbalsa_mailbox_release_message(mailbox, message);
+    if (message->mime_msg)
+       message->headers->user_hdrs =
+           libbalsa_message_user_hdrs_from_gmime(message->mime_msg);
+    else {
+       libbalsa_mailbox_fetch_message_structure(mailbox, message,
+                                                LB_FETCH_RFC822_HEADERS);
+       libbalsa_mailbox_release_message(mailbox, message);
     }
 }
 
-
 static gboolean
-libbalsa_mailbox_local_get_msg_part(LibBalsaMessage     *msg,
+libbalsa_mailbox_local_get_msg_part(LibBalsaMessage *msg,
                                     LibBalsaMessageBody *part,
-                                    GError             **err)
+                                    GError **err)
 {
     g_return_val_if_fail(part->mime_part, FALSE);
 
     return GMIME_IS_PART(part->mime_part)
-           || GMIME_IS_MULTIPART(part->mime_part)
-           || GMIME_IS_MESSAGE_PART(part->mime_part);
+        || GMIME_IS_MULTIPART(part->mime_part)
+       || GMIME_IS_MESSAGE_PART(part->mime_part);
 }
 
-
 /*--------------------------------*/
 /*  Start of threading functions  */
 /*--------------------------------*/
 /*
  * This code includes two message threading functions.
  * The first is the implementation of jwz's algorithm describled at
- * http://www.jwz.org/doc/threading.html . The another is very simple and
- * trivial one. If you confirm that your mailbox includes every threaded
+ * http://www.jwz.org/doc/threading.html . The another is very simple and 
+ * trivial one. If you confirm that your mailbox includes every threaded 
  * messages, the later will be enough. Those functions are selectable on
  * each mailbox by setting the 'type' member in BalsaIndex. If you don't need
- * message threading functionality, just specify 'LB_MAILBOX_THREADING_FLAT'.
+ * message threading functionality, just specify 'LB_MAILBOX_THREADING_FLAT'. 
  *
  * ymnk jcraft com
  */
@@ -1540,31 +1436,23 @@ struct _ThreadingInfo {
 };
 typedef struct _ThreadingInfo ThreadingInfo;
 
-static gboolean lbml_set_parent(GNode         *node,
-                                ThreadingInfo *ti);
-static GNode *lbml_insert_node(GNode                    *node,
-                               LibBalsaMailboxLocalInfo *info,
-                               ThreadingInfo            *ti);
-static GNode *lbml_find_parent(LibBalsaMailboxLocalInfo *info,
-                               ThreadingInfo            *ti);
-static gboolean lbml_prune(GNode         *node,
-                           ThreadingInfo *ti);
-static void lbml_subject_gather(GNode         *node,
-                                ThreadingInfo *ti);
-static void lbml_subject_merge(GNode         *node,
-                               ThreadingInfo *ti);
-static const gchar *lbml_chop_re(const gchar *str);
-static gboolean lbml_construct(GNode         *node,
-                               ThreadingInfo *ti);
-
+static gboolean lbml_set_parent(GNode * node, ThreadingInfo * ti);
+static GNode *lbml_insert_node(GNode * node,
+                               LibBalsaMailboxLocalInfo * info,
+                               ThreadingInfo * ti);
+static GNode *lbml_find_parent(LibBalsaMailboxLocalInfo * info,
+                              ThreadingInfo * ti);
+static gboolean lbml_prune(GNode * node, ThreadingInfo * ti);
+static void lbml_subject_gather(GNode * node, ThreadingInfo * ti);
+static void lbml_subject_merge(GNode * node, ThreadingInfo * ti);
+static const gchar *lbml_chop_re(const gchar * str);
+static gboolean lbml_construct(GNode * node, ThreadingInfo * ti);
 #ifdef MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT
-static void lbml_clear_empty(GNode *root);
-
-#endif                          /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
+static void lbml_clear_empty(GNode * root);
+#endif                         /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
 
 static void
-lbml_info_setup(LibBalsaMailbox *mailbox,
-                ThreadingInfo   *ti)
+lbml_info_setup(LibBalsaMailbox * mailbox, ThreadingInfo * ti)
 {
     ti->mailbox = mailbox;
     ti->root = g_node_new(mailbox->msg_tree);
@@ -1572,20 +1460,17 @@ lbml_info_setup(LibBalsaMailbox *mailbox,
     ti->subject_table = NULL;
 }
 
-
 static void
-lbml_info_free(ThreadingInfo *ti)
+lbml_info_free(ThreadingInfo * ti)
 {
     g_hash_table_destroy(ti->id_table);
-    if (ti->subject_table) {
-        g_hash_table_destroy(ti->subject_table);
-    }
+    if (ti->subject_table)
+       g_hash_table_destroy(ti->subject_table);
     g_node_destroy(ti->root);
 }
 
-
 static void
-lbml_threading_jwz(LibBalsaMailbox *mailbox)
+lbml_threading_jwz(LibBalsaMailbox * mailbox)
 {
     /* This implementation of JWZ's algorithm uses a second tree, rooted
      * at ti.root, for the message IDs.  Each node in the second tree
@@ -1600,17 +1485,17 @@ lbml_threading_jwz(LibBalsaMailbox *mailbox)
 
     /* Traverse the mailbox's msg_tree, to build the second tree. */
     g_node_traverse(mailbox->msg_tree, G_POST_ORDER, G_TRAVERSE_ALL, -1,
-                    (GNodeTraverseFunc) lbml_set_parent, &ti);
+                   (GNodeTraverseFunc) lbml_set_parent, &ti);
     /* Prune the second tree. */
     g_node_traverse(ti.root, G_POST_ORDER, G_TRAVERSE_ALL, -1,
-                    (GNodeTraverseFunc) lbml_prune, &ti);
+                   (GNodeTraverseFunc) lbml_prune, &ti);
 
     /* Do the evil subject gather and merge on the second tree. */
     ti.subject_table = g_hash_table_new(g_str_hash, g_str_equal);
     g_node_children_foreach(ti.root, G_TRAVERSE_ALL,
-                            (GNodeForeachFunc) lbml_subject_gather, &ti);
+                           (GNodeForeachFunc) lbml_subject_gather, &ti);
     g_node_children_foreach(ti.root, G_TRAVERSE_ALL,
-                            (GNodeForeachFunc) lbml_subject_merge, &ti);
+                           (GNodeForeachFunc) lbml_subject_merge, &ti);
 
     /* Traverse the second tree and reparent corresponding nodes in the
      * mailbox's msg_tree. */
@@ -1619,69 +1504,57 @@ lbml_threading_jwz(LibBalsaMailbox *mailbox)
 
 #ifdef MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT
     lbml_clear_empty(ti.root);
-#endif                          /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
+#endif                         /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
 
     lbml_info_free(&ti);
 }
 
-
 static LibBalsaMailboxLocalInfo *
-lbml_get_info(GNode         *node,
-              ThreadingInfo *ti)
+lbml_get_info(GNode * node, ThreadingInfo * ti)
 {
     guint msgno = GPOINTER_TO_UINT(node->data);
     LibBalsaMailboxLocalInfo *info;
     LibBalsaMailboxLocal *local = LIBBALSA_MAILBOX_LOCAL(ti->mailbox);
 
-    if ((msgno == 0) || (msgno > local->threading_info->len)) {
+    if (msgno == 0 || msgno > local->threading_info->len)
         return NULL;
-    }
 
     info = g_ptr_array_index(local->threading_info, msgno - 1);
 
     return info;
 }
 
-
 static void
-lbml_unlink_and_prepend(GNode *node,
-                        GNode *parent)
+lbml_unlink_and_prepend(GNode * node, GNode * parent)
 {
     g_node_unlink(node);
     g_node_prepend(parent, node);
 }
 
-
 static void
-lbml_move_children(GNode *node,
-                   GNode *parent)
+lbml_move_children(GNode * node, GNode * parent)
 {
     GNode *child;
 
-    while ((child = node->children)) {
-        lbml_unlink_and_prepend(child, parent);
-    }
+    while ((child = node->children))
+       lbml_unlink_and_prepend(child, parent);
 }
 
-
 static gboolean
-lbml_set_parent(GNode         *msg_node,
-                ThreadingInfo *ti)
+lbml_set_parent(GNode * msg_node, ThreadingInfo * ti)
 {
     LibBalsaMailboxLocalInfo *info;
     GNode *node;
     GNode *parent;
     GNode *child;
 
-    if (!msg_node->parent) {
-        return FALSE;
-    }
+    if (!msg_node->parent)
+       return FALSE;
 
     info = lbml_get_info(msg_node, ti);
 
-    if (!info) { /* FIXME assert this? */
-        return FALSE;
-    }
+    if (!info) /* FIXME assert this? */
+       return FALSE;
 
     node = lbml_insert_node(msg_node, info, ti);
 
@@ -1708,26 +1581,25 @@ lbml_set_parent(GNode         *msg_node,
 
     parent = lbml_find_parent(info, ti);
 
-    if ((node->parent == parent)
-        /* Nothing to do... */
-        || (node == parent)) {
-        /* This message listed itself as its parent! Oh well... */
-        return FALSE;
-    }
+    if (node->parent == parent
+       /* Nothing to do... */
+       || node == parent)
+       /* This message listed itself as its parent! Oh well... */
+       return FALSE;
 
     child = node->children;
     while (child) {
-        GNode *next = child->next;
-        if ((child == parent) || g_node_is_ancestor(child, parent)) {
-            /* Prepending node to parent would create a
-             * loop; in lbml_find_parent, we just omit making
-             * the link, but here we really want to link the
-             * message's node to its parent, so we'll fix
-             * the tree: unlink the offending child and prepend it
-             * to the node's parent. */
-            lbml_unlink_and_prepend(child, node->parent);
-        }
-        child = next;
+       GNode *next = child->next;
+       if (child == parent || g_node_is_ancestor(child, parent)) {
+           /* Prepending node to parent would create a
+            * loop; in lbml_find_parent, we just omit making
+            * the link, but here we really want to link the
+            * message's node to its parent, so we'll fix
+            * the tree: unlink the offending child and prepend it
+            * to the node's parent. */
+           lbml_unlink_and_prepend(child, node->parent);
+       }
+       child = next;
     }
 
     lbml_unlink_and_prepend(node, parent);
@@ -1735,10 +1607,8 @@ lbml_set_parent(GNode         *msg_node,
     return FALSE;
 }
 
-
 static GNode *
-lbml_find_parent(LibBalsaMailboxLocalInfo *info,
-                 ThreadingInfo            *ti)
+lbml_find_parent(LibBalsaMailboxLocalInfo * info, ThreadingInfo * ti)
 {
     /*
      * For each element in the message's References field:
@@ -1759,42 +1629,36 @@ lbml_find_parent(LibBalsaMailboxLocalInfo *info,
     GHashTable *id_table = ti->id_table;
 
     for (reference = info->refs_for_threading; reference;
-         reference = reference->next) {
-        gchar *id = reference->data;
-        GNode *foo = g_hash_table_lookup(id_table, id);
+        reference = reference->next) {
+       gchar *id = reference->data;
+       GNode *foo = g_hash_table_lookup(id_table, id);
 
-        if (foo == NULL) {
-            foo = g_node_new(NULL);
-            g_hash_table_insert(id_table, id, foo);
-        }
+       if (foo == NULL) {
+           foo = g_node_new(NULL);
+           g_hash_table_insert(id_table, id, foo);
+       }
 
-        /* Avoid nasty surprises. */
-        if ((foo != parent) && !g_node_is_ancestor(foo, parent)) {
-            if (!foo->parent || (foo->parent == ti->root)) {
-                lbml_unlink_and_prepend(foo, parent);
-            }
-        }
+       /* Avoid nasty surprises. */
+       if (foo != parent && !g_node_is_ancestor(foo, parent))
+           if (!foo->parent || foo->parent == ti->root)
+               lbml_unlink_and_prepend(foo, parent);
 
-        parent = foo;
+       parent = foo;
     }
     return parent;
 }
 
-
 static gboolean
-lbml_is_replied(GNode         *msg_node,
-                ThreadingInfo *ti)
+lbml_is_replied(GNode * msg_node, ThreadingInfo * ti)
 {
     guint msgno = GPOINTER_TO_UINT(msg_node->data);
     return libbalsa_mailbox_msgno_get_status(ti->mailbox, msgno)
-           == LIBBALSA_MESSAGE_STATUS_REPLIED;
+       == LIBBALSA_MESSAGE_STATUS_REPLIED;
 }
 
-
 static GNode *
-lbml_insert_node(GNode                    *msg_node,
-                 LibBalsaMailboxLocalInfo *info,
-                 ThreadingInfo            *ti)
+lbml_insert_node(GNode * msg_node, LibBalsaMailboxLocalInfo * info,
+                ThreadingInfo * ti)
 {
     /*
      * If id_table contains an *empty* Container for this ID:
@@ -1809,87 +1673,75 @@ lbml_insert_node(GNode                    *msg_node,
     gchar *id = info->message_id;
     GHashTable *id_table = ti->id_table;
 
-    if (id) {
-        node = g_hash_table_lookup(id_table, id);
-    }
+    if (id)
+       node = g_hash_table_lookup(id_table, id);
 
     if (node) {
-        GNode *prev_msg_node = node->data;
-        /* If this message has not been replied to, or if the container
-         * is empty, store it in the container. If there was a message
-         * in the container already, swap it with this one, otherwise
-         * set the current one to NULL. */
-        if (!lbml_is_replied(msg_node, ti) || !prev_msg_node) {
-            node->data = msg_node;
-            msg_node = prev_msg_node;
-        }
+       GNode *prev_msg_node = node->data;
+       /* If this message has not been replied to, or if the container
+        * is empty, store it in the container. If there was a message
+        * in the container already, swap it with this one, otherwise
+        * set the current one to NULL. */
+       if (!lbml_is_replied(msg_node, ti) || !prev_msg_node) {
+           node->data = msg_node;
+           msg_node = prev_msg_node;
+       }
     }
     /* If we already stored the message in a previously empty container,
      * msg_node is NULL. If either the previous message or the current
      * one has been replied to, msg_node now points to a replied-to
      * message. */
-    if (msg_node) {
-        node = g_node_new(msg_node);
-    }
+    if (msg_node)
+       node = g_node_new(msg_node);
 
-    if (id) {
-        g_hash_table_insert(id_table, id, node);
-    }
+    if (id)
+       g_hash_table_insert(id_table, id, node);
 
     return node;
 }
 
-
 static gboolean
-lbml_prune(GNode         *node,
-           ThreadingInfo *ti)
+lbml_prune(GNode * node, ThreadingInfo * ti)
 {
     /*
-     * Recursively walk all containers under the root set. For each container:
+     * Recursively walk all containers under the root set. For each container: 
      *
-     * + If it is an empty container with no children, nuke it.
-     * + If the Container has no Message, but does have children,
-     *   remove this container but promote its children to this level
-     *  (that is, splice them in to the current child list.)
+     * + If it is an empty container with no children, nuke it. 
+     * + If the Container has no Message, but does have children, 
+     *   remove this container but promote its children to this level 
+     *  (that is, splice them in to the current child list.) 
      *
-     * Do not promote the children if doing so would promote them to
-     * the root set -- unless there is only one child, in which case, do.
+     * Do not promote the children if doing so would promote them to 
+     * the root set -- unless there is only one child, in which case, do. 
      */
 
-    if ((node->data != NULL) || (node == ti->root)) {
-        return FALSE;
-    }
+    if (node->data != NULL || node == ti->root)
+       return FALSE;
 
 #ifdef MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT
-    if ((node->children != NULL)
-        && ((node->parent != ti->root) || (node->children->next == NULL))) {
-        lbml_move_children(node, node->parent);
-    }
+    if (node->children != NULL
+       && (node->parent != ti->root || node->children->next == NULL))
+       lbml_move_children(node, node->parent);
 
-    if (node->children == NULL) {
-        g_node_destroy(node);
-    }
-#else                           /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
+    if (node->children == NULL)
+       g_node_destroy(node);
+#else                          /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
     lbml_move_children(node, node->parent);
     g_node_destroy(node);
-#endif                          /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
+#endif                         /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
 
     return FALSE;
 }
 
-
 static const gchar *
-lbml_get_subject(GNode         *node,
-                 ThreadingInfo *ti)
+lbml_get_subject(GNode * node, ThreadingInfo * ti)
 {
     guint msgno = GPOINTER_TO_UINT(((GNode *) node->data)->data);
     return libbalsa_mailbox_msgno_get_subject(ti->mailbox, msgno);
 }
 
-
 static void
-lbml_subject_gather(GNode         *node,
-                    ThreadingInfo *ti)
+lbml_subject_gather(GNode * node, ThreadingInfo * ti)
 {
     const gchar *subject = NULL, *old_subject;
     const gchar *chopped_subject = NULL;
@@ -1897,113 +1749,107 @@ lbml_subject_gather(GNode         *node,
     GHashTable *subject_table = ti->subject_table;
 
     /*
-     * If any two members of the root set have the same subject, merge them.
-     * This is so that messages which don't have References headers at all
-     * still get threaded (to the extent possible, at least.)
+     * If any two members of the root set have the same subject, merge them. 
+     * This is so that messages which don't have References headers at all 
+     * still get threaded (to the extent possible, at least.) 
      *
-     * + Construct a new hash table, subject_table, which associates subject
-     *   strings with Container objects.
+     * + Construct a new hash table, subject_table, which associates subject 
+     *   strings with Container objects. 
      *
-     * + For each Container in the root set:
+     * + For each Container in the root set: 
      *
-     *   Find the subject of that sub-tree:
+     *   Find the subject of that sub-tree: 
      *   + If there is a message in the Container, the subject is the subject of
-     *     that message.
+     *     that message. 
      *   + If there is no message in the Container, then the Container will have
      *     at least one child Container, and that Container will have a message.
-     *     Use the subject of that message instead.
-     *   + Strip ``Re:'', ``RE:'', ``RE[5]:'', ``Re: Re[4]: Re:'' and so on.
-     *   + If the subject is now "", give up on this
-     *   + Add this Container to the subject_table if: Container.
-     *     + There is no container in the table with this subject, or
-     *     + This one is an empty container and the old one is not: the empty
-     *       one is more interesting as a root, so put it in the table instead.
+     *     Use the subject of that message instead. 
+     *   + Strip ``Re:'', ``RE:'', ``RE[5]:'', ``Re: Re[4]: Re:'' and so on. 
+     *   + If the subject is now "", give up on this 
+     *   + Add this Container to the subject_table if: Container. 
+     *     + There is no container in the table with this subject, or 
+     *     + This one is an empty container and the old one is not: the empty 
+     *       one is more interesting as a root, so put it in the table instead. 
      *     + The container in the table has a ``Re:'' version of this subject,
      *       and this container has a non-``Re:'' version of this subject.
-     *       The non-re version is the more interesting of the two.
+     *       The non-re version is the more interesting of the two. 
      *
-     * + Now the subject_table is populated with one entry for each subject
-     *   which occurs in the root set. Now iterate over the root set,
-     *   and gather together the difference.
-     *
-     *   For each Container in the root set:
-     *
-     *   Find the subject of this Container (as above.)
-     *   Look up the Container of that subject in the table.
-     *   If it is null, or if it is this container, continue.
-     *   Otherwise, we want to group together this Container and the one
-     *   in the table. There are a few possibilities:
-     *     + If both are dummies, prepend one's children to the other, and
-     *       remove the now-empty container.
-     *
-     *     + If one container is a empty and the other is not, make the
-     *       non-empty one be a child of the empty, and a sibling of the
+     * + Now the subject_table is populated with one entry for each subject 
+     *   which occurs in the root set. Now iterate over the root set, 
+     *   and gather together the difference. 
+     * 
+     *   For each Container in the root set: 
+     * 
+     *   Find the subject of this Container (as above.) 
+     *   Look up the Container of that subject in the table. 
+     *   If it is null, or if it is this container, continue. 
+     *   Otherwise, we want to group together this Container and the one 
+     *   in the table. There are a few possibilities: 
+     *     + If both are dummies, prepend one's children to the other, and 
+     *       remove the now-empty container. 
+     * 
+     *     + If one container is a empty and the other is not, make the 
+     *       non-empty one be a child of the empty, and a sibling of the 
      *       other ``real'' messages with the
-     *       same subject (the empty's children.)
-     *     + If that container is a non-empty, and that message's subject
+     *       same subject (the empty's children.) 
+     *     + If that container is a non-empty, and that message's subject 
      *       does not begin with ``Re:'', but this message's subject does,
-     *       then make this be a child of the other.
-     *     + If that container is a non-empty, and that message's subject
-     *       begins with ``Re:'', but this message's subject does not,
-     *       then make that be a child of this one -- they were misordered.
-     *       (This happens somewhat implicitly, since if there are two
+     *       then make this be a child of the other. 
+     *     + If that container is a non-empty, and that message's subject 
+     *       begins with ``Re:'', but this message's subject does not, 
+     *       then make that be a child of this one -- they were misordered. 
+     *       (This happens somewhat implicitly, since if there are two 
      *       messages, one with Re: and one without, the one without
-     *       will be in the hash table, regardless of the order in which
-     *       they were seen.)
-     *
+     *       will be in the hash table, regardless of the order in which 
+     *       they were seen.) 
+     * 
      *     + Otherwise, make a new empty container and make both msgs be
-     *       a child of it. This catches the both-are-replies and
+     *       a child of it. This catches the both-are-replies and 
      *       neither-are-replies cases, and makes them be siblings instead of
-     *       asserting a hierarchical relationship which might not be true.
-     *
+     *       asserting a hierarchical relationship which might not be true. 
+     * 
      *     (People who reply to messages without using ``Re:'' and without
-     *     using a References line will break this slightly. Those people suck.)
-     *
+     *     using a References line will break this slightly. Those people suck.) 
+     * 
      *     (It has occurred to me that taking the date or message number into
      *     account would be one way of resolving some of the ambiguous cases,
-     *     but that's not altogether straightforward either.)
+     *     but that's not altogether straightforward either.) 
      */
 
     subject = lbml_get_subject(node, ti);
-    if (subject == NULL) {
-        return;
-    }
+    if (subject == NULL)
+       return;
     chopped_subject = lbml_chop_re(subject);
-    if ((chopped_subject == NULL)
-        || !strcmp(chopped_subject, _("(No subject)"))) {
-        return;
-    }
+    if (chopped_subject == NULL
+       || !strcmp(chopped_subject, _("(No subject)")))
+       return;
 
     old = g_hash_table_lookup(subject_table, chopped_subject);
 #ifdef MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT
-    if ((old == NULL) || ((node->data == NULL) && (old->data != NULL))) {
-        g_hash_table_insert(subject_table, (char *) chopped_subject,
-                            node);
-        return;
+    if (old == NULL || (node->data == NULL && old->data != NULL)) {
+       g_hash_table_insert(subject_table, (char *) chopped_subject,
+                           node);
+       return;
     }
-#else                           /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
+#else                          /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
     if (old == NULL) {
-        g_hash_table_insert(subject_table, (char *) chopped_subject,
-                            node);
-        return;
+       g_hash_table_insert(subject_table, (char *) chopped_subject,
+                           node);
+       return;
     }
-#endif                          /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
+#endif                         /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
 
     old_subject = lbml_get_subject(old, ti);
 
-    if ((old_subject != lbml_chop_re(old_subject))
-        && (subject == chopped_subject)) {
-        g_hash_table_insert(subject_table, (gchar *) chopped_subject,
-                            node);
-    }
+    if (old_subject != lbml_chop_re(old_subject)
+       && subject == chopped_subject)
+       g_hash_table_insert(subject_table, (gchar *) chopped_subject,
+                           node);
 }
 
-
 /* Swap data and children. */
 static void
-lbml_swap(GNode         *node1,
-          GNode         *node2,
-          ThreadingInfo *ti)
+lbml_swap(GNode * node1, GNode * node2, ThreadingInfo * ti)
 {
     GNode *tmp_node = g_node_new(NULL);
     gpointer tmp_data;
@@ -2018,120 +1864,108 @@ lbml_swap(GNode         *node1,
     node2->data = tmp_data;
 }
 
-
 static void
-lbml_subject_merge(GNode         *node,
-                   ThreadingInfo *ti)
+lbml_subject_merge(GNode * node, ThreadingInfo * ti)
 {
     const gchar *subject, *subject2;
     const gchar *chopped_subject, *chopped_subject2;
     GNode *node2;
 
     subject = lbml_get_subject(node, ti);
-    if (subject == NULL) {
-        return;
-    }
+    if (subject == NULL)
+       return;
     chopped_subject = lbml_chop_re(subject);
-    if (chopped_subject == NULL) {
-        return;
-    }
+    if (chopped_subject == NULL)
+       return;
 
     node2 = g_hash_table_lookup(ti->subject_table, chopped_subject);
-    if ((node2 == NULL) || (node2 == node)) {
-        return;
-    }
+    if (node2 == NULL || node2 == node)
+       return;
 
 #ifdef MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT
-    if ((node->data == NULL) && (node2->data == NULL)) {
-        lbml_move_children(node, node2);
-        g_node_destroy(node);
-        return;
+    if (node->data == NULL && node2->data == NULL) {
+       lbml_move_children(node, node2);
+       g_node_destroy(node);
+       return;
     }
 
-    if (node->data == NULL) {
-        /* node2 should be made a child of node, but unlinking node2
-         * could mess up the foreach, so we'll swap them and fall
-         * through to the next case. */
-        lbml_swap(node, node2, ti);
-    }
+    if (node->data == NULL)
+       /* node2 should be made a child of node, but unlinking node2
+        * could mess up the foreach, so we'll swap them and fall
+        * through to the next case. */
+       lbml_swap(node, node2, ti);
 
     if (node2->data == NULL) {
-        lbml_unlink_and_prepend(node, node2);
-        return;
+       lbml_unlink_and_prepend(node, node2);
+       return;
     }
-#endif                          /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
+#endif                         /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
 
     subject2 = lbml_get_subject(node2, ti);
     chopped_subject2 = lbml_chop_re(subject2);
 
-    if ((subject2 == chopped_subject2) && (subject != chopped_subject)) {
-        /* Make node a child of node2. */
-        lbml_unlink_and_prepend(node, node2);
-    } else if ((subject2 != chopped_subject2)
-               && (subject == chopped_subject)) {
-        /* Make node2 a child of node; as above, swap them to avoid
-         * unlinking node2. */
-        lbml_swap(node, node2, ti);
-        lbml_unlink_and_prepend(node, node2);
+    if ((subject2 == chopped_subject2) && subject != chopped_subject)
+       /* Make node a child of node2. */
+       lbml_unlink_and_prepend(node, node2);
+    else if ((subject2 != chopped_subject2)
+            && subject == chopped_subject) {
+       /* Make node2 a child of node; as above, swap them to avoid
+        * unlinking node2. */
+       lbml_swap(node, node2, ti);
+       lbml_unlink_and_prepend(node, node2);
 #ifdef MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT
     } else {
-        /* Make both node and node2 children of a new empty node; as
-         * above, swap node2 and the new node to avoid unlinking node2.
-         */
-        GNode *new_node = g_node_new(NULL);
-
-        lbml_move_children(node2, new_node);
-        new_node->data = node2->data;
-        node2->data = NULL;
-        lbml_unlink_and_prepend(node, node2);
-        lbml_unlink_and_prepend(new_node, node2);
-#endif                          /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
+       /* Make both node and node2 children of a new empty node; as
+        * above, swap node2 and the new node to avoid unlinking node2.
+        */
+       GNode *new_node = g_node_new(NULL);
+
+       lbml_move_children(node2, new_node);
+       new_node->data = node2->data;
+       node2->data = NULL;
+       lbml_unlink_and_prepend(node, node2);
+       lbml_unlink_and_prepend(new_node, node2);
+#endif                         /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
     }
 }
 
-
 /* The more heuristics should be added. */
 static const gchar *
-lbml_chop_re(const gchar *str)
+lbml_chop_re(const gchar * str)
 {
     const gchar *p = str;
     while (*p) {
-        while (*p && g_ascii_isspace((int) *p)) {
-            p++;
-        }
-        if (!*p) {
-            break;
-        }
-
-        if ((g_ascii_strncasecmp(p, "re:", 3) == 0)
-            || (g_ascii_strncasecmp(p, "aw:", 3) == 0)) {
-            p += 3;
-            continue;
-        } else if (g_ascii_strncasecmp(p, _("Re:"), strlen(_("Re:"))) == 0) {
-            /* should "re" be localized ? */
-            p += strlen(_("Re:"));
-            continue;
-        }
-        break;
+       while (*p && g_ascii_isspace((int) *p))
+           p++;
+       if (!*p)
+           break;
+
+       if (g_ascii_strncasecmp(p, "re:", 3) == 0
+           || g_ascii_strncasecmp(p, "aw:", 3) == 0) {
+           p += 3;
+           continue;
+       } else if (g_ascii_strncasecmp(p, _("Re:"), strlen(_("Re:"))) == 0) {
+           /* should "re" be localized ? */
+           p += strlen(_("Re:"));
+           continue;
+       }
+       break;
     }
     return p;
 }
 
-
 static gboolean
-lbml_construct(GNode         *node,
-               ThreadingInfo *ti)
+lbml_construct(GNode * node, ThreadingInfo * ti)
 {
     GNode *msg_node;
 
     if (node->parent && (msg_node = node->data)) {
         GNode *msg_parent = node->parent->data;
 
-        if (msg_parent && (msg_node->parent != msg_parent)
-            && !g_node_is_ancestor(msg_node, msg_parent)) {
+        if (msg_parent && msg_node->parent != msg_parent
+            && !g_node_is_ancestor(msg_node, msg_parent))
             libbalsa_mailbox_unlink_and_prepend(ti->mailbox, msg_node,
                                                 msg_parent);
-        }
     }
 
     return FALSE;
@@ -2140,138 +1974,116 @@ lbml_construct(GNode         *node,
 
 #ifdef MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT
 static void
-lbml_clear_empty(GNode *msg_tree)
+lbml_clear_empty(GNode * msg_tree)
 {
     GNode *node = msg_tree->children;
     while (node) {
-        GNode *next = node->next;
-        if (!node->data && !node->children) {
-            g_node_destroy(node);
-        }
-        node = next;
+       GNode *next = node->next;
+       if (!node->data && !node->children)
+           g_node_destroy(node);
+       node = next;
     }
 }
-
-
-#endif                          /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
+#endif                         /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
 
 /* yet another message threading function */
 
-static gboolean lbml_insert_message(GNode         *node,
-                                    ThreadingInfo *ti);
-static gboolean lbml_thread_message(GNode         *node,
-                                    ThreadingInfo *ti);
+static gboolean lbml_insert_message(GNode * node, ThreadingInfo * ti);
+static gboolean lbml_thread_message(GNode * node, ThreadingInfo * ti);
 
 static void
-lbml_threading_simple(LibBalsaMailbox             *mailbox,
-                      LibBalsaMailboxThreadingType type)
+lbml_threading_simple(LibBalsaMailbox * mailbox,
+                     LibBalsaMailboxThreadingType type)
 {
     GNode *msg_tree = mailbox->msg_tree;
     ThreadingInfo ti;
 
     lbml_info_setup(mailbox, &ti);
 
-    if (type == LB_MAILBOX_THREADING_SIMPLE) {
-        g_node_traverse(msg_tree, G_POST_ORDER, G_TRAVERSE_ALL,
-                        -1, (GNodeTraverseFunc) lbml_insert_message, &ti);
-    }
+    if (type == LB_MAILBOX_THREADING_SIMPLE)
+       g_node_traverse(msg_tree, G_POST_ORDER, G_TRAVERSE_ALL,
+                       -1, (GNodeTraverseFunc) lbml_insert_message, &ti);
 
     ti.type = type;
     g_node_traverse(msg_tree, G_POST_ORDER, G_TRAVERSE_ALL, -1,
-                    (GNodeTraverseFunc) lbml_thread_message, &ti);
+                   (GNodeTraverseFunc) lbml_thread_message, &ti);
 
 #ifdef MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT
     lbml_clear_empty(msg_tree);
-#endif                          /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
+#endif                         /* MAKE_EMPTY_CONTAINER_FOR_MISSING_PARENT */
 
     lbml_info_free(&ti);
 }
 
-
 static gboolean
-lbml_insert_message(GNode         *node,
-                    ThreadingInfo *ti)
+lbml_insert_message(GNode * node, ThreadingInfo * ti)
 {
     LibBalsaMailboxLocalInfo *info;
 
-    if (!node->parent) {
-        return FALSE;
-    }
+    if (!node->parent)
+       return FALSE;
 
     info = lbml_get_info(node, ti);
-    if (!info) {
-        return FALSE;
-    }
+    if (!info)
+       return FALSE;
 
-    if (info->message_id) {
-        g_hash_table_insert(ti->id_table, info->message_id, node);
-    }
+    if (info->message_id)
+       g_hash_table_insert(ti->id_table, info->message_id, node);
 
     return FALSE;
 }
 
-
 static gboolean
-lbml_thread_message(GNode         *node,
-                    ThreadingInfo *ti)
+lbml_thread_message(GNode * node, ThreadingInfo * ti)
 {
-    if (!node->parent) {
+    if (!node->parent)
         return FALSE;
-    }
 
     if (ti->type == LB_MAILBOX_THREADING_FLAT) {
-        if (node->parent != ti->mailbox->msg_tree) {
+        if (node->parent != ti->mailbox->msg_tree)
             libbalsa_mailbox_unlink_and_prepend(ti->mailbox, node,
                                                 ti->mailbox->msg_tree);
-        }
     } else {
         LibBalsaMailboxLocalInfo *info;
         GList *refs;
         GNode *parent = NULL;
 
         info = lbml_get_info(node, ti);
-        if (!info) {
+        if (!info)
             return FALSE;
-        }
 
         refs = info->refs_for_threading;
-        if (refs) {
+        if (refs)
             parent = g_hash_table_lookup(ti->id_table,
                                          g_list_last(refs)->data);
-        }
 
-        if (!parent) {
+        if (!parent)
             parent = ti->mailbox->msg_tree;
-        }
-        if ((parent != node->parent) && (parent != node)
-            && !g_node_is_ancestor(node, parent)) {
+        if (parent != node->parent && parent != node
+            && !g_node_is_ancestor(node, parent))
             libbalsa_mailbox_unlink_and_prepend(ti->mailbox, node, parent);
-        }
     }
 
     return FALSE;
 }
-
-
 /*------------------------------*/
 /*  End of threading functions  */
 /*------------------------------*/
 
 /* Helper for maildir and mh. */
 GMimeMessage *
-libbalsa_mailbox_local_get_mime_message(LibBalsaMailbox *mailbox,
-                                        const gchar     *name1,
-                                        const gchar     *name2)
+libbalsa_mailbox_local_get_mime_message(LibBalsaMailbox * mailbox,
+                                        const gchar * name1,
+                                        const gchar * name2)
 {
     GMimeStream *mime_stream;
     GMimeParser *mime_parser;
     GMimeMessage *mime_message;
 
     mime_stream =
-        libbalsa_mailbox_local_get_message_stream(mailbox, name1, name2);
-    if (!mime_stream) {
-        return NULL;
-    }
+       libbalsa_mailbox_local_get_message_stream(mailbox, name1, name2);
+    if (!mime_stream)
+       return NULL;
 
     mime_parser = g_mime_parser_new_with_stream(mime_stream);
     g_mime_parser_set_scan_from(mime_parser, FALSE);
@@ -2283,11 +2095,10 @@ libbalsa_mailbox_local_get_mime_message(LibBalsaMailbox *mailbox,
     return mime_message;
 }
 
-
 GMimeStream *
-libbalsa_mailbox_local_get_message_stream(LibBalsaMailbox *mailbox,
-                                          const gchar     *name1,
-                                          const gchar     *name2)
+libbalsa_mailbox_local_get_message_stream(LibBalsaMailbox * mailbox,
+                                          const gchar * name1,
+                                          const gchar * name2)
 {
     const gchar *path;
     gchar *filename;
@@ -2299,71 +2110,65 @@ libbalsa_mailbox_local_get_message_stream(LibBalsaMailbox *mailbox,
 
     fd = open(filename, O_RDONLY);
     if (fd != -1) {
-        stream = g_mime_stream_fs_new(fd);
-        if (!stream) {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _("Open of %s failed. Errno = %d, "),
-                                 filename, errno);
-        }
+       stream = g_mime_stream_fs_new(fd);
+       if (!stream)
+           libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                                _("Open of %s failed. Errno = %d, "),
+                                filename, errno);
     }
     g_free(filename);
 
     return stream;
 }
 
-
 /* Queued sync. */
 
 static void
-lbm_local_sync_real(LibBalsaMailboxLocal *local)
+lbm_local_sync_real(LibBalsaMailboxLocal * local)
 {
-    LibBalsaMailbox *mailbox = (LibBalsaMailbox *)local;
+    LibBalsaMailbox *mailbox = (LibBalsaMailbox*)local;
     time_t tstart;
 
     time(&tstart);
     libbalsa_lock_mailbox(mailbox);
     if (local->sync_id &&                       /* request still pending */
         MAILBOX_OPEN(mailbox) &&                   /* mailbox still open */
-        !libbalsa_mailbox_sync_storage(mailbox, FALSE)) { /* cannot sync */
-        libbalsa_information(LIBBALSA_INFORMATION_WARNING,
-                             _("Failed to sync mailbox “%s”"),
-                             mailbox->name);
-    }
+        !libbalsa_mailbox_sync_storage(mailbox, FALSE))   /* cannot sync */
+       libbalsa_information(LIBBALSA_INFORMATION_WARNING,
+                            _("Failed to sync mailbox “%s”"),
+                            mailbox->name);
     local->sync_id = 0;
-    local->sync_time += time(NULL) - tstart;
+    local->sync_time += time(NULL)-tstart;
     local->sync_cnt++;
     libbalsa_unlock_mailbox(mailbox);
     g_object_unref(local);
 }
 
-
 static gboolean
-lbm_local_sync_idle(LibBalsaMailboxLocal *local)
+lbm_local_sync_idle(LibBalsaMailboxLocal * local)
 {
     GThread *sync_thread;
 
     sync_thread =
-        g_thread_new("lbm_local_sync_real", (GThreadFunc) lbm_local_sync_real, local);
+       g_thread_new("lbm_local_sync_real", (GThreadFunc) lbm_local_sync_real, local);
     g_thread_unref(sync_thread);
 
     return FALSE;
 }
 
-
 static void
-lbm_local_sync_queue(LibBalsaMailboxLocal *local)
+lbm_local_sync_queue(LibBalsaMailboxLocal * local)
 {
     guint schedule_delay;
 
     /* The optimal behavior here would be to keep rescheduling
-     * requests.  But think of following: the idle handler started and
-     * triggered lbm_local_sync_real thread. While it waits for the lock,
-     * another queue request is filed but it is too late for removal of
-     * the sync thread. And we get two sync threads executing one after
-     * another, etc. So it is better to do sync bit too often... */
-    if (local->sync_id) {
+    * requests.  But think of following: the idle handler started and
+    * triggered lbm_local_sync_real thread. While it waits for the lock,
+    * another queue request is filed but it is too late for removal of
+    * the sync thread. And we get two sync threads executing one after
+    * another, etc. So it is better to do sync bit too often... */
+    if (local->sync_id) 
         return;
-    }
     g_object_ref(local);
     /* queue sync job so that the delay is at least five times longer
      * than the syncing time. Otherwise large mailbox owners will be
@@ -2375,10 +2180,8 @@ lbm_local_sync_queue(LibBalsaMailboxLocal *local)
                                         local, NULL);
 }
 
-
 static void
-lbm_local_sort(LibBalsaMailbox *mailbox,
-               GArray          *sort_array)
+lbm_local_sort(LibBalsaMailbox * mailbox, GArray *sort_array)
 {
     g_assert(LIBBALSA_MAILBOX_CLASS(parent_class) != NULL);
 
@@ -2386,12 +2189,11 @@ lbm_local_sort(LibBalsaMailbox *mailbox,
     lbm_local_queue_save_tree(LIBBALSA_MAILBOX_LOCAL(mailbox));
 }
 
-
 static guint
-libbalsa_mailbox_local_add_messages(LibBalsaMailbox           *mailbox,
+libbalsa_mailbox_local_add_messages(LibBalsaMailbox          * mailbox,
                                     LibBalsaAddMessageIterator msg_iterator,
                                     gpointer                   iter_data,
-                                    GError                   **err)
+                                    GError                  ** err)
 {
     LibBalsaMessageFlag flag;
     GMimeStream *stream;
@@ -2409,28 +2211,25 @@ libbalsa_mailbox_local_add_messages(LibBalsaMailbox           *mailbox,
 
         success = (*add_message)(local, stream, flag, err);
         g_object_unref(stream);
-        if (!success) {
+        if (!success)
             break;
-        }
         cnt++;
     }
 
     return cnt;
 }
 
-
 #define FLAGS_REALLY_DIFFER(flags0, flags1) \
-    (((flags0 ^ flags1) & LIBBALSA_MESSAGE_FLAGS_REAL) != 0)
+        (((flags0 ^ flags1) & LIBBALSA_MESSAGE_FLAGS_REAL) != 0)
 
 static gboolean
-libbalsa_mailbox_local_messages_change_flags(LibBalsaMailbox    *mailbox,
-                                             GArray             *msgnos,
+libbalsa_mailbox_local_messages_change_flags(LibBalsaMailbox * mailbox,
+                                             GArray * msgnos,
                                              LibBalsaMessageFlag set,
                                              LibBalsaMessageFlag clear)
 {
     LibBalsaMailboxLocal *local = LIBBALSA_MAILBOX_LOCAL(mailbox);
-    LibBalsaMailboxLocalMessageInfo *(*get_info) (LibBalsaMailboxLocal *,
-                                                  guint);
+    LibBalsaMailboxLocalMessageInfo *(*get_info) (LibBalsaMailboxLocal *, guint);
     guint i;
     guint changed = 0;
 
@@ -2443,8 +2242,8 @@ libbalsa_mailbox_local_messages_change_flags(LibBalsaMailbox    *mailbox,
         LibBalsaMailboxLocalMessageInfo *msg_info;
         LibBalsaMessageFlag old_flags;
 
-        if (!((msgno > 0)
-              && (msgno <= libbalsa_mailbox_total_messages(mailbox)))) {
+        if (!(msgno > 0
+              && msgno <= libbalsa_mailbox_total_messages(mailbox))) {
             g_warning("msgno %u out of range", msgno);
             continue;
         }
@@ -2453,15 +2252,13 @@ libbalsa_mailbox_local_messages_change_flags(LibBalsaMailbox    *mailbox,
         old_flags = msg_info->flags;
         msg_info->flags |= set;
         msg_info->flags &= ~clear;
-        if (!FLAGS_REALLY_DIFFER(msg_info->flags, old_flags)) {
+        if (!FLAGS_REALLY_DIFFER(msg_info->flags, old_flags))
             /* No real flags changed. */
             continue;
-        }
         ++changed;
 
-        if (msg_info->message) {
+        if (msg_info->message)
             msg_info->message->flags = msg_info->flags;
-        }
 
         libbalsa_mailbox_index_set_flags(mailbox, msgno, msg_info->flags);
 
@@ -2490,10 +2287,9 @@ libbalsa_mailbox_local_messages_change_flags(LibBalsaMailbox    *mailbox,
     return TRUE;
 }
 
-
 static gboolean
-libbalsa_mailbox_local_msgno_has_flags(LibBalsaMailbox    *mailbox,
-                                       guint               msgno,
+libbalsa_mailbox_local_msgno_has_flags(LibBalsaMailbox * mailbox,
+                                       guint msgno,
                                        LibBalsaMessageFlag set,
                                        LibBalsaMessageFlag unset)
 {
@@ -2506,23 +2302,20 @@ libbalsa_mailbox_local_msgno_has_flags(LibBalsaMailbox    *mailbox,
     return (msg_info->flags & set) == set && (msg_info->flags & unset) == 0;
 }
 
-
 static GArray *
-libbalsa_mailbox_local_duplicate_msgnos(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_local_duplicate_msgnos(LibBalsaMailbox * mailbox)
 {
     LibBalsaMailboxLocal *local = (LibBalsaMailboxLocal *) mailbox;
     GHashTable *table;
     guint i;
     GArray *msgnos;
 
-    if (!local->threading_info) {
+    if (!local->threading_info)
         return NULL;
-    }
 
     /* We need all the message-ids. */
-    if (!libbalsa_mailbox_prepare_threading(mailbox, 0)) {
+    if (!libbalsa_mailbox_prepare_threading(mailbox, 0))
         return NULL;
-    }
 
     table = g_hash_table_new(g_str_hash, g_str_equal);
     msgnos = g_array_new(FALSE, FALSE, sizeof(guint));
@@ -2533,14 +2326,12 @@ libbalsa_mailbox_local_duplicate_msgnos(LibBalsaMailbox *mailbox)
         guint master, msgno = i + 1;
 
         if (libbalsa_mailbox_msgno_has_flags
-                (mailbox, msgno, LIBBALSA_MESSAGE_FLAG_DELETED, 0)) {
+            (mailbox, msgno, LIBBALSA_MESSAGE_FLAG_DELETED, 0))
             continue;
-        }
 
         info = g_ptr_array_index(local->threading_info, i);
-        if (!info || !info->message_id) {
+        if (!info || !info->message_id)
             continue;
-        }
 
         tmp = g_hash_table_lookup(table, info->message_id);
         master = tmp ? GPOINTER_TO_UINT(tmp) : 0;
@@ -2553,28 +2344,25 @@ libbalsa_mailbox_local_duplicate_msgnos(LibBalsaMailbox *mailbox)
             msgno = master;
         }
 
-        if (msgno) {
+        if (msgno)
             g_array_append_val(msgnos, msgno);
-        }
     }
     g_hash_table_destroy(table);
 
     return msgnos;
 }
 
-
 static void
-libbalsa_mailbox_local_test_can_reach(LibBalsaMailbox          *mailbox,
-                                      LibBalsaCanReachCallback *cb,
-                                      gpointer                  cb_data)
+libbalsa_mailbox_local_test_can_reach(LibBalsaMailbox          * mailbox,
+                                      LibBalsaCanReachCallback * cb,
+                                      gpointer                   cb_data)
 {
     cb((GObject *) mailbox, TRUE, cb_data);
 }
 
-
 /* LibBalsaMailboxLocal class method: */
 static void
-lbm_local_real_remove_files(LibBalsaMailboxLocal *local)
+lbm_local_real_remove_files(LibBalsaMailboxLocal * local)
 {
     gchar *filename = lbm_local_get_cache_filename(local);
     unlink(filename);
diff --git a/libbalsa/mailbox_local.h b/libbalsa/mailbox_local.h
index 7efd56a..89d9988 100644
--- a/libbalsa/mailbox_local.h
+++ b/libbalsa/mailbox_local.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -37,7 +37,7 @@
     (G_TYPE_CHECK_CLASS_TYPE ((klass), LIBBALSA_TYPE_MAILBOX_LOCAL))
 #define LIBBALSA_MAILBOX_LOCAL_GET_CLASS(mailbox) \
     (G_TYPE_INSTANCE_GET_CLASS ((mailbox), LIBBALSA_TYPE_MAILBOX_LOCAL, \
-                                LibBalsaMailboxLocalClass))
+                               LibBalsaMailboxLocalClass))
 
 GType libbalsa_mailbox_local_get_type(void);
 
@@ -45,7 +45,7 @@ typedef struct _LibBalsaMailboxLocal LibBalsaMailboxLocal;
 typedef struct _LibBalsaMailboxLocalClass LibBalsaMailboxLocalClass;
 
 struct _LibBalsaMailboxLocalPool {
-    LibBalsaMessage *message;
+    LibBalsaMessage * message;
     guint pool_seqno;
 };
 typedef struct _LibBalsaMailboxLocalPool LibBalsaMailboxLocalPool;
@@ -76,55 +76,51 @@ struct _LibBalsaMailboxLocal {
     guint pool_seqno;
 };
 
-typedef gboolean LibBalsaMailboxLocalAddMessageFunc (LibBalsaMailboxLocal *
-                                                     local,
-                                                     GMimeStream *stream,
-                                                     LibBalsaMessageFlag
-                                                     flags, GError **err);
+typedef gboolean LibBalsaMailboxLocalAddMessageFunc(LibBalsaMailboxLocal *
+                                                    local,
+                                                    GMimeStream * stream,
+                                                    LibBalsaMessageFlag
+                                                    flags, GError ** err);
 
 struct _LibBalsaMailboxLocalClass {
     LibBalsaMailboxClass klass;
 
-    gint (*check_files)(const gchar *path,
-                        gboolean     create);
-    void (*set_path)(LibBalsaMailboxLocal *local,
-                     const gchar          *path);
-    void (*remove_files)(LibBalsaMailboxLocal *local);
-    guint (*fileno)(LibBalsaMailboxLocal *local,
-                    guint                 msgno);
-    LibBalsaMailboxLocalMessageInfo *(*get_info)(LibBalsaMailboxLocal *local,
-                                                 guint                 msgno);
+    gint (*check_files)(const gchar * path, gboolean create);
+    void (*set_path)(LibBalsaMailboxLocal * local, const gchar * path);
+    void (*remove_files)(LibBalsaMailboxLocal * local);
+    guint (*fileno)(LibBalsaMailboxLocal * local, guint msgno);
+    LibBalsaMailboxLocalMessageInfo *(*get_info)(LibBalsaMailboxLocal * local,
+                                                 guint msgno);
     LibBalsaMailboxLocalAddMessageFunc *add_message;
 };
 
-LibBalsaMailbox *libbalsa_mailbox_local_new(const gchar *path,
-                                            gboolean     create);
-gint libbalsa_mailbox_local_set_path(LibBalsaMailboxLocal *mailbox,
-                                     const gchar          *path,
-                                     gboolean              create);
+LibBalsaMailbox *libbalsa_mailbox_local_new(const gchar * path,
+                                            gboolean      create);
+gint libbalsa_mailbox_local_set_path(LibBalsaMailboxLocal * mailbox,
+                                    const gchar * path, gboolean create);
 void libbalsa_mailbox_local_set_threading_info(LibBalsaMailboxLocal *
                                                local);
 
 #define libbalsa_mailbox_local_get_path(mbox) \
-    ((const gchar *) (LIBBALSA_MAILBOX(mbox))->url + 7)
-
-void libbalsa_mailbox_local_load_messages(LibBalsaMailbox *mailbox,
-                                          guint            last_msgno);
-void libbalsa_mailbox_local_cache_message(LibBalsaMailboxLocal *local,
-                                          guint                 msgno,
-                                          LibBalsaMessage      *message);
-void libbalsa_mailbox_local_msgno_removed(LibBalsaMailbox *mailbox,
-                                          guint            msgno);
+       ((const gchar *) (LIBBALSA_MAILBOX(mbox))->url+7)
+
+void libbalsa_mailbox_local_load_messages(LibBalsaMailbox * mailbox,
+                                         guint last_msgno);
+void libbalsa_mailbox_local_cache_message(LibBalsaMailboxLocal * local,
+                                          guint msgno,
+                                          LibBalsaMessage * message);
+void libbalsa_mailbox_local_msgno_removed(LibBalsaMailbox * mailbox,
+                                         guint msgno);
 void libbalsa_mailbox_local_remove_files(LibBalsaMailboxLocal *mailbox);
 
 /* Helpers for maildir and mh. */
 GMimeMessage *libbalsa_mailbox_local_get_mime_message(LibBalsaMailbox *
-                                                      mailbox,
-                                                      const gchar *name1,
-                                                      const gchar *name2);
+                                                     mailbox,
+                                                     const gchar * name1,
+                                                     const gchar * name2);
 GMimeStream *libbalsa_mailbox_local_get_message_stream(LibBalsaMailbox *
-                                                       mailbox,
-                                                       const gchar *name1,
-                                                       const gchar *name2);
+                                                      mailbox,
+                                                      const gchar * name1,
+                                                      const gchar * name2);
 
-#endif                          /* __LIBBALSA_MAILBOX_LOCAL_H__ */
+#endif                         /* __LIBBALSA_MAILBOX_LOCAL_H__ */
diff --git a/libbalsa/mailbox_maildir.c b/libbalsa/mailbox_maildir.c
index 3fc12af..78e7f43 100644
--- a/libbalsa/mailbox_maildir.c
+++ b/libbalsa/mailbox_maildir.c
@@ -6,20 +6,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 
@@ -54,61 +54,58 @@ struct message_info {
     ((((orig_flags) ^ (flags)) & LIBBALSA_MESSAGE_FLAGS_REAL) != 0)
 #define FLAGS_CHANGED(msg_info) \
     FLAGS_REALLY_DIFFER(msg_info->orig_flags, msg_info->local_info.flags)
-
+  
 
 static LibBalsaMailboxLocalClass *parent_class = NULL;
 
 static void libbalsa_mailbox_maildir_class_init(LibBalsaMailboxMaildirClass *klass);
-static void libbalsa_mailbox_maildir_init(LibBalsaMailboxMaildir *mailbox);
+static void libbalsa_mailbox_maildir_init(LibBalsaMailboxMaildir * mailbox);
 
 /* Object class method */
-static void libbalsa_mailbox_maildir_finalize(GObject *object);
+static void libbalsa_mailbox_maildir_finalize(GObject * object);
 
 /* Mailbox class methods */
-static void libbalsa_mailbox_maildir_load_config(LibBalsaMailbox *mailbox,
-                                                 const gchar     *prefix);
+static void libbalsa_mailbox_maildir_load_config(LibBalsaMailbox * mailbox,
+                                                const gchar * prefix);
 
 static GMimeStream *libbalsa_mailbox_maildir_get_message_stream(LibBalsaMailbox *
-                                                                mailbox,
-                                                                guint    msgno,
-                                                                gboolean peek);
+                                                          mailbox,
+                                                               guint msgno,
+                                                               gboolean peek);
 
-static gboolean libbalsa_mailbox_maildir_open(LibBalsaMailbox *mailbox,
-                                              GError         **err);
+static gboolean libbalsa_mailbox_maildir_open(LibBalsaMailbox * mailbox,
+                                             GError **err);
 static void libbalsa_mailbox_maildir_close_mailbox(LibBalsaMailbox *
                                                    mailbox,
                                                    gboolean expunge);
-static void libbalsa_mailbox_maildir_check(LibBalsaMailbox *mailbox);
-static gboolean libbalsa_mailbox_maildir_sync(LibBalsaMailbox *mailbox,
-                                              gboolean         expunge);
-static gboolean libbalsa_mailbox_maildir_fetch_message_structure(LibBalsaMailbox  *mailbox,
-                                                                 LibBalsaMessage  *message,
-                                                                 LibBalsaFetchFlag flags);
-static guint libbalsa_mailbox_maildir_total_messages(LibBalsaMailbox *mailbox);
+static void libbalsa_mailbox_maildir_check(LibBalsaMailbox * mailbox);
+static gboolean libbalsa_mailbox_maildir_sync(LibBalsaMailbox * mailbox,
+                                              gboolean expunge);
+static gboolean
+libbalsa_mailbox_maildir_fetch_message_structure(LibBalsaMailbox * mailbox,
+                                                LibBalsaMessage * message,
+                                                LibBalsaFetchFlag flags);
+static guint
+libbalsa_mailbox_maildir_total_messages(LibBalsaMailbox * mailbox);
 
 /* LibBalsaMailboxLocal class methods */
-static gint lbm_maildir_check_files(const gchar *path,
-                                    gboolean     create);
-static void lbm_maildir_set_path(LibBalsaMailboxLocal *local,
-                                 const gchar          *path);
-static void lbm_maildir_remove_files(LibBalsaMailboxLocal *local);
-static guint lbm_maildir_fileno(LibBalsaMailboxLocal *local,
-                                guint                 msgno);
+static gint lbm_maildir_check_files(const gchar * path, gboolean create);
+static void lbm_maildir_set_path(LibBalsaMailboxLocal * local,
+                                 const gchar * path);
+static void lbm_maildir_remove_files(LibBalsaMailboxLocal * local);
+static guint lbm_maildir_fileno(LibBalsaMailboxLocal * local, guint msgno);
 static LibBalsaMailboxLocalMessageInfo
-*lbm_maildir_get_info(LibBalsaMailboxLocal *local,
-                      guint                 msgno);
-
+    *lbm_maildir_get_info(LibBalsaMailboxLocal * local, guint msgno);
 static LibBalsaMailboxLocalAddMessageFunc lbm_maildir_add_message;
 
 /* util functions */
 static struct message_info *message_info_from_msgno(LibBalsaMailboxMaildir
-                                                         *mdir,
-                                                    guint msgno);
+                                                    * mdir, guint msgno);
 static LibBalsaMessageFlag parse_filename(const gchar *subdir,
-                                          const gchar *filename);
+                                         const gchar *filename);
 static void free_message_info(struct message_info *msg_info);
-static int libbalsa_mailbox_maildir_open_temp(const gchar *dest_path,
-                                              char       **name_used);
+static int libbalsa_mailbox_maildir_open_temp (const gchar *dest_path,
+                                         char **name_used);
 
 GType
 libbalsa_mailbox_maildir_get_type(void)
@@ -116,30 +113,29 @@ libbalsa_mailbox_maildir_get_type(void)
     static GType mailbox_type = 0;
 
     if (!mailbox_type) {
-        static const GTypeInfo mailbox_info = {
-            sizeof(LibBalsaMailboxMaildirClass),
+       static const GTypeInfo mailbox_info = {
+           sizeof(LibBalsaMailboxMaildirClass),
             NULL,               /* base_init */
             NULL,               /* base_finalize */
-            (GClassInitFunc) libbalsa_mailbox_maildir_class_init,
+           (GClassInitFunc) libbalsa_mailbox_maildir_class_init,
             NULL,               /* class_finalize */
             NULL,               /* class_data */
-            sizeof(LibBalsaMailboxMaildir),
+           sizeof(LibBalsaMailboxMaildir),
             0,                  /* n_preallocs */
-            (GInstanceInitFunc) libbalsa_mailbox_maildir_init
-        };
+           (GInstanceInitFunc) libbalsa_mailbox_maildir_init
+       };
 
-        mailbox_type =
-            g_type_register_static(LIBBALSA_TYPE_MAILBOX_LOCAL,
-                                   "LibBalsaMailboxMaildir",
+       mailbox_type =
+           g_type_register_static(LIBBALSA_TYPE_MAILBOX_LOCAL,
+                                  "LibBalsaMailboxMaildir",
                                    &mailbox_info, 0);
     }
 
     return mailbox_type;
 }
 
-
 static void
-libbalsa_mailbox_maildir_class_init(LibBalsaMailboxMaildirClass *klass)
+libbalsa_mailbox_maildir_class_init(LibBalsaMailboxMaildirClass * klass)
 {
     GObjectClass *object_class;
     LibBalsaMailboxClass *libbalsa_mailbox_class;
@@ -154,39 +150,36 @@ libbalsa_mailbox_maildir_class_init(LibBalsaMailboxMaildirClass *klass)
     object_class->finalize = libbalsa_mailbox_maildir_finalize;
 
     libbalsa_mailbox_class->load_config =
-        libbalsa_mailbox_maildir_load_config;
+               libbalsa_mailbox_maildir_load_config;
     libbalsa_mailbox_class->get_message_stream =
-        libbalsa_mailbox_maildir_get_message_stream;
+       libbalsa_mailbox_maildir_get_message_stream;
 
     libbalsa_mailbox_class->open_mailbox = libbalsa_mailbox_maildir_open;
     libbalsa_mailbox_class->check = libbalsa_mailbox_maildir_check;
 
     libbalsa_mailbox_class->sync = libbalsa_mailbox_maildir_sync;
     libbalsa_mailbox_class->close_mailbox =
-        libbalsa_mailbox_maildir_close_mailbox;
+       libbalsa_mailbox_maildir_close_mailbox;
     libbalsa_mailbox_class->fetch_message_structure =
-        libbalsa_mailbox_maildir_fetch_message_structure;
+       libbalsa_mailbox_maildir_fetch_message_structure;
     libbalsa_mailbox_class->total_messages =
-        libbalsa_mailbox_maildir_total_messages;
+       libbalsa_mailbox_maildir_total_messages;
 
-    libbalsa_mailbox_local_class->check_files = lbm_maildir_check_files;
-    libbalsa_mailbox_local_class->set_path = lbm_maildir_set_path;
+    libbalsa_mailbox_local_class->check_files  = lbm_maildir_check_files;
+    libbalsa_mailbox_local_class->set_path     = lbm_maildir_set_path;
     libbalsa_mailbox_local_class->remove_files = lbm_maildir_remove_files;
-    libbalsa_mailbox_local_class->fileno = lbm_maildir_fileno;
-    libbalsa_mailbox_local_class->get_info = lbm_maildir_get_info;
-    libbalsa_mailbox_local_class->add_message = lbm_maildir_add_message;
+    libbalsa_mailbox_local_class->fileno       = lbm_maildir_fileno;
+    libbalsa_mailbox_local_class->get_info     = lbm_maildir_get_info;
+    libbalsa_mailbox_local_class->add_message  = lbm_maildir_add_message;
 }
 
-
 static void
-libbalsa_mailbox_maildir_init(LibBalsaMailboxMaildir *mdir)
+libbalsa_mailbox_maildir_init(LibBalsaMailboxMaildir * mdir)
 {
 }
 
-
 static gint
-lbm_maildir_check_files(const gchar *path,
-                        gboolean     create)
+lbm_maildir_check_files(const gchar * path, gboolean create)
 {
     g_return_val_if_fail(path != NULL, -1);
 
@@ -241,17 +234,14 @@ lbm_maildir_check_files(const gchar *path,
             rmdir(path);
             return -1;
         }
-    } else {
+    } else
         return -1;
-    }
 
     return 0;
 }
 
-
 static void
-lbm_maildir_set_subdirs(LibBalsaMailboxMaildir *mdir,
-                        const gchar            *path)
+lbm_maildir_set_subdirs(LibBalsaMailboxMaildir * mdir, const gchar * path)
 {
     g_free(mdir->curdir);
     mdir->curdir = g_build_filename(path, "cur", NULL);
@@ -261,18 +251,14 @@ lbm_maildir_set_subdirs(LibBalsaMailboxMaildir *mdir,
     mdir->tmpdir = g_build_filename(path, "tmp", NULL);
 }
 
-
 static void
-lbm_maildir_set_path(LibBalsaMailboxLocal *local,
-                     const gchar          *path)
+lbm_maildir_set_path(LibBalsaMailboxLocal * local, const gchar * path)
 {
     lbm_maildir_set_subdirs(LIBBALSA_MAILBOX_MAILDIR(local), path);
 }
 
-
 LibBalsaMailbox *
-libbalsa_mailbox_maildir_new(const gchar *path,
-                             gboolean     create)
+libbalsa_mailbox_maildir_new(const gchar * path, gboolean create)
 {
     LibBalsaMailbox *mailbox;
 
@@ -289,9 +275,8 @@ libbalsa_mailbox_maildir_new(const gchar *path,
     return mailbox;
 }
 
-
 static void
-libbalsa_mailbox_maildir_finalize(GObject *object)
+libbalsa_mailbox_maildir_finalize(GObject * object)
 {
     LibBalsaMailboxMaildir *mdir = LIBBALSA_MAILBOX_MAILDIR(object);
     g_free(mdir->curdir);
@@ -301,15 +286,13 @@ libbalsa_mailbox_maildir_finalize(GObject *object)
     g_free(mdir->tmpdir);
     mdir->tmpdir = NULL;
 
-    if (G_OBJECT_CLASS(parent_class)->finalize) {
-        G_OBJECT_CLASS(parent_class)->finalize(object);
-    }
+    if (G_OBJECT_CLASS(parent_class)->finalize)
+       G_OBJECT_CLASS(parent_class)->finalize(object);
 }
 
-
 static void
-libbalsa_mailbox_maildir_load_config(LibBalsaMailbox *mailbox,
-                                     const gchar     *prefix)
+libbalsa_mailbox_maildir_load_config(LibBalsaMailbox * mailbox,
+                                    const gchar * prefix)
 {
     LibBalsaMailboxMaildir *mdir = LIBBALSA_MAILBOX_MAILDIR(mailbox);
     gchar *path;
@@ -321,11 +304,9 @@ libbalsa_mailbox_maildir_load_config(LibBalsaMailbox *mailbox,
     LIBBALSA_MAILBOX_CLASS(parent_class)->load_config(mailbox, prefix);
 }
 
-
 static GMimeStream *
-libbalsa_mailbox_maildir_get_message_stream(LibBalsaMailbox *mailbox,
-                                            guint            msgno,
-                                            gboolean         peek)
+libbalsa_mailbox_maildir_get_message_stream(LibBalsaMailbox * mailbox,
+                                           guint msgno, gboolean peek)
 {
     struct message_info *msg_info;
 
@@ -333,82 +314,77 @@ libbalsa_mailbox_maildir_get_message_stream(LibBalsaMailbox *mailbox,
 
     msg_info =
         message_info_from_msgno((LibBalsaMailboxMaildir *) mailbox, msgno);
-    if (!msg_info) {
-        return NULL;
-    }
+    if (!msg_info)
+       return NULL;
 
     return libbalsa_mailbox_local_get_message_stream(mailbox,
-                                                     msg_info->subdir,
-                                                     msg_info->filename);
+                                                    msg_info->subdir,
+                                                    msg_info->filename);
 }
 
-
 static void
 lbm_maildir_remove_files(LibBalsaMailboxLocal *mailbox)
 {
-    const gchar *path;
+    const gchar* path;
     g_return_if_fail(LIBBALSA_IS_MAILBOX_MAILDIR(mailbox));
     path = libbalsa_mailbox_local_get_path(mailbox);
     g_print("DELETE MAILDIR\n");
 
     if (!libbalsa_delete_directory_contents(path)) {
-        libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                             _("Could not remove contents of %s:\n%s"),
-                             path, strerror(errno));
-        return;
+       libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                            _("Could not remove contents of %s:\n%s"),
+                            path, strerror(errno));
+       return;
     }
     if ( rmdir(path) == -1 ) {
-        libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                             _("Could not remove %s:\n%s"),
-                             path, strerror(errno));
+       libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                            _("Could not remove %s:\n%s"),
+                            path, strerror(errno));
     }
     LIBBALSA_MAILBOX_LOCAL_CLASS(parent_class)->remove_files(mailbox);
 }
 
-
-static LibBalsaMessageFlag
-parse_filename(const gchar *subdir,
-               const gchar *filename)
+static LibBalsaMessageFlag parse_filename(const gchar *subdir,
+                                         const gchar *filename)
 {
     const gchar *p;
     LibBalsaMessageFlag flags;
 
     flags = LIBBALSA_MESSAGE_FLAG_NEW;
-    if (strcmp(subdir, "cur") != 0) {
-        flags |= LIBBALSA_MESSAGE_FLAG_RECENT;
-    }
-
-    if (((p = strrchr (filename, ':')) != NULL) && (strncmp (p + 1, "2,", 2) == 0)) {
-        p += 3;
-        while (*p) {
-            switch (*p) {
-            case 'F':
-                flags |= LIBBALSA_MESSAGE_FLAG_FLAGGED;
-                break;
-
-            case 'S':     /* seen */
-                flags &= ~LIBBALSA_MESSAGE_FLAG_NEW;
-                break;
-
-            case 'R':     /* replied */
-                flags |= LIBBALSA_MESSAGE_FLAG_REPLIED;
-                break;
-
-            case 'T':     /* trashed */
-                flags |= LIBBALSA_MESSAGE_FLAG_DELETED;
-                break;
-            }
-            p++;
-        }
+    if (strcmp(subdir, "cur") != 0)
+       flags |= LIBBALSA_MESSAGE_FLAG_RECENT;
+
+    if ((p = strrchr (filename, ':')) != NULL && strncmp (p + 1, "2,", 2) == 0)
+    {
+       p += 3;
+       while (*p)
+       {
+           switch (*p)
+           {
+               case 'F':
+                   flags |= LIBBALSA_MESSAGE_FLAG_FLAGGED;
+                   break;
+       
+               case 'S': /* seen */
+                   flags &= ~LIBBALSA_MESSAGE_FLAG_NEW;
+                   break;
+
+               case 'R': /* replied */
+                   flags |= LIBBALSA_MESSAGE_FLAG_REPLIED;
+                   break;
+
+               case 'T': /* trashed */
+                   flags |= LIBBALSA_MESSAGE_FLAG_DELETED;
+                   break;
+           }
+           p++;
+       }
     }
     return flags;
 }
 
-
-static void
-lbm_maildir_parse(LibBalsaMailboxMaildir *mdir,
-                  const gchar            *subdir,
-                  guint                  *fileno)
+static void lbm_maildir_parse(LibBalsaMailboxMaildir * mdir,
+                              const gchar *subdir, guint * fileno)
 {
     gchar *path;
     GDir *dir;
@@ -421,62 +397,58 @@ lbm_maildir_parse(LibBalsaMailboxMaildir *mdir,
     LibBalsaMailbox *mailbox = (LibBalsaMailbox *) mdir;
 
     path = g_build_filename(libbalsa_mailbox_local_get_path(mailbox),
-                            subdir, NULL);
+                           subdir, NULL);
     dir = g_dir_open(path, 0, NULL);
     g_free(path);
-    if (dir == NULL) {
-        return;
-    }
+    if (dir == NULL)
+       return;
 
     messages_info = mdir->messages_info;
     msgno_2_msg_info = mdir->msgno_2_msg_info;
-    while ((filename = g_dir_read_name(dir)) != NULL) {
-        struct message_info *msg_info;
-        if (filename[0] == '.') {
-            continue;
-        }
-
-        key = g_strdup(filename);
-        /* strip flags of filename */
-        if ((p = strrchr(key, ':')) && !strncmp(p, ":2,", 3)) {
-            *p = '\0';
-        }
-
-        flags = parse_filename(subdir, filename);
-        msg_info = g_hash_table_lookup(messages_info, key);
-        if (msg_info) {
-            g_free(key);
-            g_free(msg_info->filename);
-            msg_info->filename = g_strdup(filename);
-            if (FLAGS_REALLY_DIFFER(msg_info->orig_flags, flags)) {
+    while ((filename = g_dir_read_name(dir)) != NULL)
+    {
+       struct message_info *msg_info;
+       if (filename[0] == '.')
+           continue;
+
+       key = g_strdup(filename);
+       /* strip flags of filename */
+       if ((p = strrchr(key, ':')) && !strncmp(p, ":2,", 3))
+           *p = '\0';
+
+       flags = parse_filename(subdir, filename);
+       msg_info = g_hash_table_lookup(messages_info, key);
+       if (msg_info) {
+           g_free(key);
+           g_free(msg_info->filename);
+           msg_info->filename = g_strdup(filename);
+           if (FLAGS_REALLY_DIFFER(msg_info->orig_flags, flags)) {
 #undef DEBUG /* #define DEBUG TRUE */
 #ifdef DEBUG
-                g_message("Message flags for “%s” changed\n",
+               g_message("Message flags for “%s” changed\n",
                           msg_info->key);
 #endif
-                msg_info->orig_flags = flags;
-            }
-        } else {
-            msg_info = g_new0(struct message_info, 1);
-            g_hash_table_insert(messages_info, key, msg_info);
-            g_ptr_array_add(msgno_2_msg_info, msg_info);
-            msg_info->key = key;
-            msg_info->filename = g_strdup(filename);
-            msg_info->local_info.flags = msg_info->orig_flags = flags;
-            msg_info->fileno = 0;
-        }
-        msg_info->subdir = subdir;
-        if (!msg_info->fileno) {
+               msg_info->orig_flags = flags;
+           }
+       } else {
+           msg_info = g_new0(struct message_info, 1);
+           g_hash_table_insert(messages_info, key, msg_info);
+           g_ptr_array_add(msgno_2_msg_info, msg_info);
+           msg_info->key=key;
+           msg_info->filename=g_strdup(filename);
+           msg_info->local_info.flags = msg_info->orig_flags = flags;
+           msg_info->fileno = 0;
+       }
+       msg_info->subdir = subdir;
+        if (!msg_info->fileno)
             /* First time we saw this key. */
-            msg_info->fileno = ++*fileno;
-        }
+           msg_info->fileno = ++*fileno;
     }
     g_dir_close(dir);
 }
 
-
 static void
-lbm_maildir_parse_subdirs(LibBalsaMailboxMaildir *mdir)
+lbm_maildir_parse_subdirs(LibBalsaMailboxMaildir * mdir)
 {
     guint msgno, fileno = 0;
 
@@ -495,14 +467,12 @@ lbm_maildir_parse_subdirs(LibBalsaMailboxMaildir *mdir)
     lbm_maildir_parse(mdir, "new", &fileno);
 }
 
-
 static gboolean
-libbalsa_mailbox_maildir_open(LibBalsaMailbox *mailbox,
-                              GError         **err)
+libbalsa_mailbox_maildir_open(LibBalsaMailbox * mailbox, GError **err)
 {
     struct stat st;
     LibBalsaMailboxMaildir *mdir;
-    const gchar *path;
+    const gchar* path;
 
     g_return_val_if_fail(LIBBALSA_IS_MAILBOX_MAILDIR(mailbox), FALSE);
 
@@ -510,21 +480,20 @@ libbalsa_mailbox_maildir_open(LibBalsaMailbox *mailbox,
     path = libbalsa_mailbox_local_get_path(mailbox);
 
     if (stat(path, &st) == -1) {
-        g_set_error(err, LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_OPEN_ERROR,
-                    _("Mailbox does not exist."));
-        return FALSE;
+       g_set_error(err, LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_OPEN_ERROR,
+                   _("Mailbox does not exist."));
+       return FALSE;
     }
 
     mdir->messages_info = g_hash_table_new_full(g_str_hash, g_str_equal,
-                                                NULL, (GDestroyNotify)free_message_info);
+                                 NULL, (GDestroyNotify)free_message_info);
     mdir->msgno_2_msg_info = g_ptr_array_new();
 
-    if (stat(mdir->tmpdir, &st) != -1) {
-        libbalsa_mailbox_set_mtime(mailbox, st.st_mtime);
-    }
+    if (stat(mdir->tmpdir, &st) != -1)
+       libbalsa_mailbox_set_mtime(mailbox, st.st_mtime);
 
-    mailbox->readonly =
-        !(access(mdir->curdir, W_OK) == 0 &&
+    mailbox->readonly = 
+       !(access(mdir->curdir, W_OK) == 0 &&
           access(mdir->newdir, W_OK) == 0 &&
           access(mdir->tmpdir, W_OK) == 0);
 
@@ -532,15 +501,14 @@ libbalsa_mailbox_maildir_open(LibBalsaMailbox *mailbox,
     lbm_maildir_parse_subdirs(mdir);
 #ifdef DEBUG
     g_print(_("%s: Opening %s Refcount: %d\n"),
-            "LibBalsaMailboxMaildir", mailbox->name, mailbox->open_ref);
+           "LibBalsaMailboxMaildir", mailbox->name, mailbox->open_ref);
 #endif
     return TRUE;
 }
 
-
 /* Check for a new message in subdir. */
 static gboolean
-lbm_maildir_check(const gchar *subdir)
+lbm_maildir_check(const gchar * subdir)
 {
     GDir *dir;
     const gchar *filename;
@@ -548,25 +516,24 @@ lbm_maildir_check(const gchar *subdir)
     gboolean retval = FALSE;
 
     if ((dir = g_dir_open(subdir, 0, NULL))) {
-        while ((filename = g_dir_read_name(dir))) {
-            if ((*filename != '.') && (!(p = strstr(filename, ":2,"))
-                                       || !(strchr(p + 3, 'S')
-                                            || strchr(p + 3, 'T')))) {
-                /* One new message is enough. */
-                retval = TRUE;
-                break;
-            }
-        }
-        g_dir_close(dir);
+       while ((filename = g_dir_read_name(dir))) {
+           if (*filename != '.' && (!(p = strstr(filename, ":2,"))
+                                    || !(strchr(p + 3, 'S')
+                                         || strchr(p + 3, 'T')))) {
+               /* One new message is enough. */
+               retval = TRUE;
+               break;
+           }
+       }
+       g_dir_close(dir);
     }
 
     return retval;
 }
 
-
 /* Called with mailbox locked. */
 static void
-libbalsa_mailbox_maildir_check(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_maildir_check(LibBalsaMailbox * mailbox)
 {
     struct stat st;
     LibBalsaMailboxMaildir *mdir;
@@ -579,58 +546,54 @@ libbalsa_mailbox_maildir_check(LibBalsaMailbox *mailbox)
 
     mdir = LIBBALSA_MAILBOX_MAILDIR(mailbox);
 
-    if (stat(mdir->tmpdir, &st) == -1) {
-        return;
-    }
+    if (stat(mdir->tmpdir, &st) == -1)
+       return;
 
     if ((mtime = libbalsa_mailbox_get_mtime(mailbox)) == 0) {
-        /* First check--just cache the mtime. */
-        libbalsa_mailbox_set_mtime(mailbox, st.st_mtime);
-        return;
-    }
-    if (st.st_mtime == mtime) {
+       /* First check--just cache the mtime. */
+       libbalsa_mailbox_set_mtime(mailbox, st.st_mtime);
         return;
     }
+    if (st.st_mtime == mtime)
+       return;
 
     libbalsa_mailbox_set_mtime(mailbox, st.st_mtime);
 
     if (!MAILBOX_OPEN(mailbox)) {
-        libbalsa_mailbox_set_unread_messages_flag(mailbox,
-                                                  lbm_maildir_check(mdir->
-                                                                    newdir)
-                                                  ||
-                                                  lbm_maildir_check(mdir->
-                                                                    curdir));
-        return;
+       libbalsa_mailbox_set_unread_messages_flag(mailbox,
+                                                 lbm_maildir_check(mdir->
+                                                                   newdir)
+                                                 ||
+                                                 lbm_maildir_check(mdir->
+                                                                   curdir));
+       return;
     }
 
     /* Was any message removed? */
     path = libbalsa_mailbox_local_get_path(mailbox);
     renumber = mdir->msgno_2_msg_info->len + 1;
     for (msgno = 1; msgno <= mdir->msgno_2_msg_info->len; ) {
-        gchar *filename;
+       gchar *filename;
 
         msg_info = message_info_from_msgno(mdir, msgno);
-        filename = g_build_filename(path, msg_info->subdir,
-                                    msg_info->filename, NULL);
-        if (access(filename, F_OK) == 0) {
-            msgno++;
-        } else {
-            g_ptr_array_remove(mdir->msgno_2_msg_info, msg_info);
-            g_hash_table_remove(mdir->messages_info, msg_info->key);
-            libbalsa_mailbox_local_msgno_removed(mailbox, msgno);
-            if (renumber > msgno) {
-                /* First message that needs renumbering. */
-                renumber = msgno;
-            }
-        }
-        g_free(filename);
+       filename = g_build_filename(path, msg_info->subdir,
+                                   msg_info->filename, NULL);
+       if (access(filename, F_OK) == 0)
+           msgno++;
+       else {
+           g_ptr_array_remove(mdir->msgno_2_msg_info, msg_info);
+           g_hash_table_remove(mdir->messages_info, msg_info->key);
+           libbalsa_mailbox_local_msgno_removed(mailbox, msgno);
+           if (renumber > msgno)
+               /* First message that needs renumbering. */
+               renumber = msgno;
+       }
+       g_free(filename);
     }
     for (msgno = renumber; msgno <= mdir->msgno_2_msg_info->len; msgno++) {
-        msg_info = message_info_from_msgno(mdir, msgno);
-        if (msg_info->local_info.message) {
-            msg_info->local_info.message->msgno = msgno;
-        }
+       msg_info = message_info_from_msgno(mdir, msgno);
+       if (msg_info->local_info.message)
+           msg_info->local_info.message->msgno = msgno;
     }
 
     msgno = mdir->msgno_2_msg_info->len;
@@ -638,42 +601,37 @@ libbalsa_mailbox_maildir_check(LibBalsaMailbox *mailbox)
     libbalsa_mailbox_local_load_messages(mailbox, msgno);
 }
 
-
 static void
 free_message_info(struct message_info *msg_info)
 {
-    if (!msg_info) {
-        return;
-    }
+    if (!msg_info)
+       return;
     g_free(msg_info->key);
     g_free(msg_info->filename);
     if (msg_info->local_info.message) {
-        msg_info->local_info.message->mailbox = NULL;
-        msg_info->local_info.message->msgno = 0;
-        g_object_remove_weak_pointer(G_OBJECT(msg_info->local_info.message),
-                                     (gpointer) & msg_info->local_info.message);
+       msg_info->local_info.message->mailbox = NULL;
+       msg_info->local_info.message->msgno   = 0;
+       g_object_remove_weak_pointer(G_OBJECT(msg_info->local_info.message),
+                                    (gpointer) & msg_info->local_info.message);
     }
     g_free(msg_info);
 }
 
-
 static void
-libbalsa_mailbox_maildir_close_mailbox(LibBalsaMailbox *mailbox,
-                                       gboolean         expunge)
+libbalsa_mailbox_maildir_close_mailbox(LibBalsaMailbox * mailbox,
+                                       gboolean expunge)
 {
     LibBalsaMailboxMaildir *mdir = LIBBALSA_MAILBOX_MAILDIR(mailbox);
     guint len;
 
     len = mdir->msgno_2_msg_info->len;
     libbalsa_mailbox_maildir_sync(mailbox, expunge);
-    if (mdir->msgno_2_msg_info->len != len) {
+    if (mdir->msgno_2_msg_info->len != len)
         libbalsa_mailbox_changed(mailbox);
-    }
 
-    if (LIBBALSA_MAILBOX_CLASS(parent_class)->close_mailbox) {
+    if (LIBBALSA_MAILBOX_CLASS(parent_class)->close_mailbox)
         LIBBALSA_MAILBOX_CLASS(parent_class)->close_mailbox(mailbox,
                                                             expunge);
-    }
 
     /* Now it's safe to free the message info. */
     g_hash_table_destroy(mdir->messages_info);
@@ -683,7 +641,6 @@ libbalsa_mailbox_maildir_close_mailbox(LibBalsaMailbox *mailbox,
     mdir->msgno_2_msg_info = NULL;
 }
 
-
 static gchar *
 lbm_mdir_get_key(void)
 {
@@ -693,35 +650,32 @@ lbm_mdir_get_key(void)
                            counter++);
 }
 
-
 static int
 libbalsa_mailbox_maildir_open_temp(const gchar *dest_path,
-                                   char       **name_used)
+                                   char **name_used)
 {
     int fd;
     gchar *filename;
 
     do {
-        gchar *key = lbm_mdir_get_key();
-        filename = g_build_filename(dest_path, "tmp", key, NULL);
-        g_free(key);
-        fd = open (filename, O_WRONLY | O_EXCL | O_CREAT, 0600);
-        if (fd == -1) {
-            g_free(filename);
-            if (errno != EEXIST) {
-                return -1;
-            }
-        }
+       gchar *key = lbm_mdir_get_key();
+       filename = g_build_filename(dest_path, "tmp", key, NULL);
+       g_free(key);
+       fd = open (filename, O_WRONLY | O_EXCL | O_CREAT, 0600);
+       if (fd == -1)
+       {
+           g_free(filename);
+           if (errno != EEXIST)
+               return -1;
+       }
     } while (fd == -1);
     *name_used = filename;
     return fd;
 }
 
-
 /* Sync: flush flags and expunge. */
 static gboolean
-maildir_sync_add(struct message_info *msg_info,
-                 const gchar         *path)
+maildir_sync_add(struct message_info *msg_info, const gchar * path)
 {
     gchar new_flags[10];
     int len;
@@ -733,18 +687,14 @@ maildir_sync_add(struct message_info *msg_info,
 
     len = 0;
 
-    if ((msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_FLAGGED) != 0) {
-        new_flags[len++] = 'F';
-    }
-    if ((msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_NEW) == 0) {
-        new_flags[len++] = 'S';
-    }
-    if ((msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_REPLIED) != 0) {
-        new_flags[len++] = 'R';
-    }
-    if ((msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_DELETED) != 0) {
-        new_flags[len++] = 'T';
-    }
+    if ((msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_FLAGGED) != 0)
+       new_flags[len++] = 'F';
+    if ((msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_NEW) == 0)
+       new_flags[len++] = 'S';
+    if ((msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_REPLIED) != 0)
+       new_flags[len++] = 'R';
+    if ((msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_DELETED) != 0)
+       new_flags[len++] = 'T';
 
     new_flags[len] = '\0';
 
@@ -757,7 +707,7 @@ maildir_sync_add(struct message_info *msg_info,
     if (strcmp(orig, new)) {
         while (g_file_test(new, G_FILE_TEST_EXISTS)) {
 #ifdef DEBUG
-            g_message("File “%s” exists, requesting new key.\n", new);
+           g_message("File “%s” exists, requesting new key.\n", new);
 #endif
             g_free(msg_info->key);
             msg_info->key = lbm_mdir_get_key();
@@ -768,15 +718,15 @@ maildir_sync_add(struct message_info *msg_info,
             g_free(new);
             new = g_build_filename(path, subdir, filename, NULL);
         }
-        if (rename(orig, new) >= 0) { /* FIXME: change to safe_rename??? */
-            msg_info->subdir = subdir;
-        } else {
+       if (rename(orig, new) >= 0) /* FIXME: change to safe_rename??? */
+           msg_info->subdir = subdir;
+       else {
 #ifdef DEBUG
             g_message("Rename “%s” “%s”: %s\n", orig, new,
                       g_strerror(errno));
 #endif
-            retval = FALSE;
-        }
+           retval = FALSE;
+       }
     }
     g_free(orig);
     g_free(new);
@@ -787,10 +737,8 @@ maildir_sync_add(struct message_info *msg_info,
     return retval;
 }
 
-
 static gboolean
-libbalsa_mailbox_maildir_sync(LibBalsaMailbox *mailbox,
-                              gboolean         expunge)
+libbalsa_mailbox_maildir_sync(LibBalsaMailbox * mailbox, gboolean expunge)
 {
     /*
      * foreach message_info
@@ -809,59 +757,55 @@ libbalsa_mailbox_maildir_sync(LibBalsaMailbox *mailbox,
     guint changes = 0;
 
     for (msgno = 1; msgno <= mdir->msgno_2_msg_info->len; msgno++) {
-        msg_info = message_info_from_msgno(mdir, msgno);
+       msg_info = message_info_from_msgno(mdir, msgno);
 
-        if (expunge && (msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_DELETED)) {
-            /* skip this block if the message should only be renamed */
-            gchar *orig = g_build_filename(path, msg_info->subdir,
+       if (expunge && (msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_DELETED)) {
+           /* skip this block if the message should only be renamed */
+           gchar *orig = g_build_filename(path, msg_info->subdir,
                                            msg_info->filename, NULL);
-            unlink (orig);
-            g_free(orig);
-            removed_list =
-                g_slist_prepend(removed_list, GUINT_TO_POINTER(msgno));
-            ++changes;
-            continue;
-        }
-
-        if (mailbox->state == LB_MAILBOX_STATE_CLOSING) {
-            msg_info->local_info.flags &= ~LIBBALSA_MESSAGE_FLAG_RECENT;
-        }
-        if (((msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_RECENT)
-             && (strcmp(msg_info->subdir, "new") != 0))
+           unlink (orig);
+           g_free(orig);
+           removed_list =
+               g_slist_prepend(removed_list, GUINT_TO_POINTER(msgno));
+           ++changes;
+           continue;
+       }
+
+       if (mailbox->state == LB_MAILBOX_STATE_CLOSING)
+           msg_info->local_info.flags &= ~LIBBALSA_MESSAGE_FLAG_RECENT;
+       if (((msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_RECENT)
+             && strcmp(msg_info->subdir, "new") != 0)
             || (!(msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_RECENT)
-                && (strcmp(msg_info->subdir, "cur") != 0))
+                && strcmp(msg_info->subdir, "cur") != 0)
             || FLAGS_CHANGED(msg_info)) {
-            if (!maildir_sync_add(msg_info, path)) {
-                ok = FALSE;
-            }
-            ++changes;
-        }
+           if (!maildir_sync_add(msg_info, path))
+               ok = FALSE;
+           ++changes;
+       }
     }
 
     if (!ok) {
-        g_slist_free(removed_list);
-        return FALSE;
+       g_slist_free(removed_list);
+       return FALSE;
     }
 
     renumber = mdir->msgno_2_msg_info->len + 1;
     for (l = removed_list; l; l = l->next) {
-        msgno = GPOINTER_TO_UINT(l->data);
-        if (renumber > msgno) {
-            renumber = msgno;
-        }
-        msg_info = message_info_from_msgno(mdir, msgno);
+       msgno = GPOINTER_TO_UINT(l->data);
+       if (renumber > msgno)
+           renumber = msgno;
+       msg_info = message_info_from_msgno(mdir, msgno);
 
-        g_ptr_array_remove(mdir->msgno_2_msg_info, msg_info);
-        libbalsa_mailbox_local_msgno_removed(mailbox, msgno);
-        /* This will free removed: */
-        g_hash_table_remove(mdir->messages_info, msg_info->key);
+       g_ptr_array_remove(mdir->msgno_2_msg_info, msg_info);
+       libbalsa_mailbox_local_msgno_removed(mailbox, msgno);
+       /* This will free removed: */
+       g_hash_table_remove(mdir->messages_info, msg_info->key);
     }
     g_slist_free(removed_list);
     for (msgno = renumber; msgno <= mdir->msgno_2_msg_info->len; msgno++) {
-        msg_info = message_info_from_msgno(mdir, msgno);
-        if (msg_info->local_info.message) {
-            msg_info->local_info.message->msgno = msgno;
-        }
+       msg_info = message_info_from_msgno(mdir, msgno);
+       if (msg_info->local_info.message)
+           msg_info->local_info.message->msgno = msgno;
     }
 
     if (changes) {              /* Record mtime of dir. */
@@ -871,18 +815,15 @@ libbalsa_mailbox_maildir_sync(LibBalsaMailbox *mailbox,
         lbm_maildir_parse_subdirs(mdir);
         mailbox->msg_tree_changed = TRUE;
 
-        if (stat(mdir->tmpdir, &st) == 0) {
+        if (stat(mdir->tmpdir, &st) == 0)
             libbalsa_mailbox_set_mtime(mailbox, st.st_mtime);
-        }
     }
 
     return TRUE;
 }
 
-
 static struct message_info *
-message_info_from_msgno(LibBalsaMailboxMaildir *mdir,
-                        guint                   msgno)
+message_info_from_msgno(LibBalsaMailboxMaildir * mdir, guint msgno)
 {
     g_assert(msgno > 0 && msgno <= mdir->msgno_2_msg_info->len);
 
@@ -893,34 +834,31 @@ message_info_from_msgno(LibBalsaMailboxMaildir *mdir,
 
 
 static gboolean
-libbalsa_mailbox_maildir_fetch_message_structure(LibBalsaMailbox  *mailbox,
-                                                 LibBalsaMessage  *message,
-                                                 LibBalsaFetchFlag flags)
+libbalsa_mailbox_maildir_fetch_message_structure(LibBalsaMailbox * mailbox,
+                                                LibBalsaMessage * message,
+                                                LibBalsaFetchFlag flags)
 {
     if (!message->mime_msg) {
-        struct message_info *msg_info =
+       struct message_info *msg_info =
             message_info_from_msgno((LibBalsaMailboxMaildir *) mailbox,
                                     message->msgno);
-        message->mime_msg =
-            libbalsa_mailbox_local_get_mime_message(mailbox,
-                                                    msg_info->subdir,
-                                                    msg_info->filename);
+       message->mime_msg =
+           libbalsa_mailbox_local_get_mime_message(mailbox,
+                                                   msg_info->subdir,
+                                                   msg_info->filename);
     }
 
     return LIBBALSA_MAILBOX_CLASS(parent_class)->
-           fetch_message_structure(mailbox, message, flags);
+        fetch_message_structure(mailbox, message, flags);
 }
 
-
 static guint
-lbm_maildir_fileno(LibBalsaMailboxLocal *local,
-                   guint                 msgno)
+lbm_maildir_fileno(LibBalsaMailboxLocal * local, guint msgno)
 {
     struct message_info *msg_info;
 
-    if (!msgno) {
+    if (!msgno)
         return 0;
-    }
 
     msg_info =
         message_info_from_msgno((LibBalsaMailboxMaildir *) local, msgno);
@@ -928,10 +866,8 @@ lbm_maildir_fileno(LibBalsaMailboxLocal *local,
     return msg_info->fileno;
 }
 
-
 static LibBalsaMailboxLocalMessageInfo *
-lbm_maildir_get_info(LibBalsaMailboxLocal *local,
-                     guint                 msgno)
+lbm_maildir_get_info(LibBalsaMailboxLocal * local, guint msgno)
 {
     struct message_info *msg_info;
 
@@ -941,13 +877,12 @@ lbm_maildir_get_info(LibBalsaMailboxLocal *local,
     return &msg_info->local_info;
 }
 
-
 /* Called with mailbox locked. */
 static gboolean
-lbm_maildir_add_message(LibBalsaMailboxLocal *local,
-                        GMimeStream          *stream,
-                        LibBalsaMessageFlag   flags,
-                        GError              **err)
+lbm_maildir_add_message(LibBalsaMailboxLocal * local,
+                        GMimeStream          * stream,
+                        LibBalsaMessageFlag    flags,
+                        GError              ** err)
 {
     LibBalsaMailbox *mailbox = (LibBalsaMailbox *) local;
     const char *path;
@@ -964,9 +899,8 @@ lbm_maildir_add_message(LibBalsaMailboxLocal *local,
     /* open tempfile */
     path = libbalsa_mailbox_local_get_path(local);
     fd = libbalsa_mailbox_maildir_open_temp(path, &tmp);
-    if (fd == -1) {
-        return FALSE;
-    }
+    if (fd == -1)
+       return FALSE;
     out_stream = g_mime_stream_fs_new(fd);
 
     in_stream = g_mime_stream_filter_new(stream);
@@ -975,7 +909,7 @@ lbm_maildir_add_message(LibBalsaMailboxLocal *local,
                                FALSE);
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(in_stream), crlffilter);
     g_object_unref(crlffilter);
-
+ 
     libbalsa_mime_stream_shared_lock(stream);
     retval = g_mime_stream_write_to_stream(in_stream, out_stream);
     libbalsa_mime_stream_shared_unlock(stream);
@@ -983,20 +917,19 @@ lbm_maildir_add_message(LibBalsaMailboxLocal *local,
     g_object_unref(out_stream);
 
     if (retval < 0) {
-        unlink (tmp);
-        g_free(tmp);
+       unlink (tmp);
+       g_free(tmp);
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_COPY_ERROR,
                     _("Data copy error"));
-        return FALSE;
+       return FALSE;
     }
 
     new_filename = strrchr(tmp, '/');
-    if (new_filename) {
-        new_filename++;
-    } else {
-        new_filename = tmp;
-    }
+    if (new_filename)
+       new_filename++;
+    else
+       new_filename = tmp;
     msg_info = g_new0(struct message_info, 1);
     msg_info->subdir = "tmp";
     msg_info->key = g_strdup(new_filename);
@@ -1006,19 +939,17 @@ lbm_maildir_add_message(LibBalsaMailboxLocal *local,
     free_message_info(msg_info);
     g_free(tmp);
 
-    if ((mtime = libbalsa_mailbox_get_mtime(mailbox)) != 0) {
-        /* If we checked or synced the mailbox less than 1 second ago,
-         * the cached modification time could be the same as the new
-         * modification time, so we'll invalidate the cached time. */
-        libbalsa_mailbox_set_mtime(mailbox, --mtime);
-    }
+    if ((mtime = libbalsa_mailbox_get_mtime(mailbox)) != 0)
+       /* If we checked or synced the mailbox less than 1 second ago,
+        * the cached modification time could be the same as the new
+        * modification time, so we'll invalidate the cached time. */
+       libbalsa_mailbox_set_mtime(mailbox, --mtime);
 
     return retval;
 }
 
-
 static guint
-libbalsa_mailbox_maildir_total_messages(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_maildir_total_messages(LibBalsaMailbox * mailbox)
 {
     LibBalsaMailboxMaildir *mdir = (LibBalsaMailboxMaildir *) mailbox;
 
diff --git a/libbalsa/mailbox_maildir.h b/libbalsa/mailbox_maildir.h
index 5eb19b8..675cf9c 100644
--- a/libbalsa/mailbox_maildir.h
+++ b/libbalsa/mailbox_maildir.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -40,8 +40,8 @@ typedef struct _LibBalsaMailboxMaildirClass LibBalsaMailboxMaildirClass;
 struct _LibBalsaMailboxMaildir {
     LibBalsaMailboxLocal parent;
 
-    GHashTable *messages_info;
-    GPtrArray *msgno_2_msg_info;
+    GHashTable* messages_info;
+    GPtrArray* msgno_2_msg_info;
     gchar *curdir;
     gchar *newdir;
     gchar *tmpdir;
@@ -52,7 +52,8 @@ struct _LibBalsaMailboxMaildirClass {
 };
 
 GType libbalsa_mailbox_maildir_get_type(void);
-LibBalsaMailbox *libbalsa_mailbox_maildir_new(const gchar *path,
-                                              gboolean     create);
+LibBalsaMailbox *libbalsa_mailbox_maildir_new(const gchar * path,
+                                              gboolean      create);
 
 #endif
+
diff --git a/libbalsa/mailbox_mbox.c b/libbalsa/mailbox_mbox.c
index ccc433e..315a085 100644
--- a/libbalsa/mailbox_mbox.c
+++ b/libbalsa/mailbox_mbox.c
@@ -6,20 +6,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 
@@ -50,9 +50,9 @@ struct message_info {
     LibBalsaMailboxLocalMessageInfo local_info;
     LibBalsaMessageFlag orig_flags;     /* Has only real flags */
     off_t start;
-    off_t status;               /* Offset of the "Status:" header. */
-    off_t x_status;             /* Offset of the "X-Status:" header. */
-    off_t mime_version;         /* Offset of the "MIME-Version:" header. */
+    off_t status;              /* Offset of the "Status:" header. */
+    off_t x_status;            /* Offset of the "X-Status:" header. */
+    off_t mime_version;                /* Offset of the "MIME-Version:" header. */
     off_t end;
     size_t from_len;
 };
@@ -64,38 +64,37 @@ struct message_info {
 static LibBalsaMailboxLocalClass *parent_class = NULL;
 
 static void libbalsa_mailbox_mbox_class_init(LibBalsaMailboxMboxClass *klass);
-static void libbalsa_mailbox_mbox_init(LibBalsaMailboxMbox *mailbox);
-static void libbalsa_mailbox_mbox_dispose(GObject *object);
+static void libbalsa_mailbox_mbox_init(LibBalsaMailboxMbox * mailbox);
+static void libbalsa_mailbox_mbox_dispose(GObject * object);
 
 static GMimeStream *libbalsa_mailbox_mbox_get_message_stream(LibBalsaMailbox *
-                                                             mailbox,
-                                                             guint    msgno,
-                                                             gboolean peek);
-static gint lbm_mbox_check_files(const gchar *path,
-                                 gboolean     create);
+                                                            mailbox,
+                                                            guint msgno,
+                                                            gboolean peek);
+static gint lbm_mbox_check_files(const gchar * path, gboolean create);
 static void libbalsa_mailbox_mbox_remove_files(LibBalsaMailboxLocal *mailbox);
 
-static gboolean libbalsa_mailbox_mbox_open(LibBalsaMailbox *mailbox,
-                                           GError         **err);
-static void libbalsa_mailbox_mbox_close_mailbox(LibBalsaMailbox *mailbox,
-                                                gboolean         expunge);
-static void libbalsa_mailbox_mbox_check(LibBalsaMailbox *mailbox);
-static gboolean libbalsa_mailbox_mbox_sync(LibBalsaMailbox *mailbox,
-                                           gboolean         expunge);
+static gboolean libbalsa_mailbox_mbox_open(LibBalsaMailbox * mailbox,
+                                          GError **err);
+static void libbalsa_mailbox_mbox_close_mailbox(LibBalsaMailbox * mailbox,
+                                                gboolean expunge);
+static void libbalsa_mailbox_mbox_check(LibBalsaMailbox * mailbox);
+static gboolean libbalsa_mailbox_mbox_sync(LibBalsaMailbox * mailbox,
+                                           gboolean expunge);
 
 /* LibBalsaMailboxLocal class methods */
 static LibBalsaMailboxLocalMessageInfo
-*lbm_mbox_get_info(LibBalsaMailboxLocal *local,
-                   guint                 msgno);
-
+    *lbm_mbox_get_info(LibBalsaMailboxLocal * local, guint msgno);
 static LibBalsaMailboxLocalAddMessageFunc lbm_mbox_add_message;
 
-static gboolean libbalsa_mailbox_mbox_fetch_message_structure(LibBalsaMailbox  *mailbox,
-                                                              LibBalsaMessage  *message,
-                                                              LibBalsaFetchFlag flags);
-static guint libbalsa_mailbox_mbox_total_messages(LibBalsaMailbox *mailbox);
-static void libbalsa_mailbox_mbox_lock_store(LibBalsaMailbox *mailbox,
-                                             gboolean         lock);
+static gboolean
+libbalsa_mailbox_mbox_fetch_message_structure(LibBalsaMailbox * mailbox,
+                                              LibBalsaMessage * message,
+                                              LibBalsaFetchFlag flags);
+static guint
+libbalsa_mailbox_mbox_total_messages(LibBalsaMailbox * mailbox);
+static void libbalsa_mailbox_mbox_lock_store(LibBalsaMailbox * mailbox,
+                                             gboolean lock);
 
 struct _LibBalsaMailboxMboxClass {
     LibBalsaMailboxLocalClass klass;
@@ -110,36 +109,34 @@ struct _LibBalsaMailboxMbox {
     gboolean messages_info_changed;
 };
 
-GType
-libbalsa_mailbox_mbox_get_type(void)
+GType libbalsa_mailbox_mbox_get_type(void)
 {
     static GType mailbox_type = 0;
 
     if (!mailbox_type) {
-        static const GTypeInfo mailbox_info = {
-            sizeof(LibBalsaMailboxMboxClass),
+       static const GTypeInfo mailbox_info = {
+           sizeof(LibBalsaMailboxMboxClass),
             NULL,               /* base_init */
             NULL,               /* base_finalize */
-            (GClassInitFunc) libbalsa_mailbox_mbox_class_init,
+           (GClassInitFunc) libbalsa_mailbox_mbox_class_init,
             NULL,               /* class_finalize */
             NULL,               /* class_data */
-            sizeof(LibBalsaMailboxMbox),
+           sizeof(LibBalsaMailboxMbox),
             0,                  /* n_preallocs */
-            (GInstanceInitFunc) libbalsa_mailbox_mbox_init
-        };
+           (GInstanceInitFunc) libbalsa_mailbox_mbox_init
+       };
 
-        mailbox_type =
-            g_type_register_static(LIBBALSA_TYPE_MAILBOX_LOCAL,
-                                   "LibBalsaMailboxMbox",
+       mailbox_type =
+           g_type_register_static(LIBBALSA_TYPE_MAILBOX_LOCAL,
+                                  "LibBalsaMailboxMbox",
                                    &mailbox_info, 0);
     }
 
     return mailbox_type;
 }
 
-
 static void
-libbalsa_mailbox_mbox_class_init(LibBalsaMailboxMboxClass *klass)
+libbalsa_mailbox_mbox_class_init(LibBalsaMailboxMboxClass * klass)
 {
     GObjectClass *object_class;
     LibBalsaMailboxClass *libbalsa_mailbox_class;
@@ -152,23 +149,23 @@ libbalsa_mailbox_mbox_class_init(LibBalsaMailboxMboxClass *klass)
     parent_class = g_type_class_peek_parent(klass);
 
     libbalsa_mailbox_class->get_message_stream =
-        libbalsa_mailbox_mbox_get_message_stream;
+       libbalsa_mailbox_mbox_get_message_stream;
 
     libbalsa_mailbox_class->open_mailbox = libbalsa_mailbox_mbox_open;
     libbalsa_mailbox_class->check = libbalsa_mailbox_mbox_check;
 
     libbalsa_mailbox_class->sync = libbalsa_mailbox_mbox_sync;
     libbalsa_mailbox_class->close_mailbox =
-        libbalsa_mailbox_mbox_close_mailbox;
+       libbalsa_mailbox_mbox_close_mailbox;
     libbalsa_mailbox_class->fetch_message_structure =
-        libbalsa_mailbox_mbox_fetch_message_structure;
+       libbalsa_mailbox_mbox_fetch_message_structure;
     libbalsa_mailbox_class->total_messages =
-        libbalsa_mailbox_mbox_total_messages;
+       libbalsa_mailbox_mbox_total_messages;
     libbalsa_mailbox_class->lock_store = libbalsa_mailbox_mbox_lock_store;
 
-    libbalsa_mailbox_local_class->check_files = lbm_mbox_check_files;
-    libbalsa_mailbox_local_class->remove_files =
-        libbalsa_mailbox_mbox_remove_files;
+    libbalsa_mailbox_local_class->check_files  = lbm_mbox_check_files;
+    libbalsa_mailbox_local_class->remove_files = 
+       libbalsa_mailbox_mbox_remove_files;
 
     libbalsa_mailbox_local_class->get_info = lbm_mbox_get_info;
     libbalsa_mailbox_local_class->add_message = lbm_mbox_add_message;
@@ -176,26 +173,23 @@ libbalsa_mailbox_mbox_class_init(LibBalsaMailboxMboxClass *klass)
 }
 
 
+
 static void
-libbalsa_mailbox_mbox_init(LibBalsaMailboxMbox *mbox)
+libbalsa_mailbox_mbox_init(LibBalsaMailboxMbox * mbox)
 {
 }
 
-
 static void
-libbalsa_mailbox_mbox_dispose(GObject *object)
+libbalsa_mailbox_mbox_dispose(GObject * object)
 {
-    if (MAILBOX_OPEN(LIBBALSA_MAILBOX(object))) {
-        libbalsa_mailbox_mbox_close_mailbox(LIBBALSA_MAILBOX(object), FALSE);
-    }
+    if(MAILBOX_OPEN(LIBBALSA_MAILBOX(object)))
+       libbalsa_mailbox_mbox_close_mailbox(LIBBALSA_MAILBOX(object), FALSE);
 
     G_OBJECT_CLASS(parent_class)->dispose(object);
 }
 
-
 static gint
-lbm_mbox_check_files(const gchar *path,
-                     gboolean     create)
+lbm_mbox_check_files(const gchar * path, gboolean create)
 {
     g_return_val_if_fail(path != NULL, -1);
 
@@ -216,20 +210,16 @@ lbm_mbox_check_files(const gchar *path,
                       "create the mailbox “%s”\n",
                       strerror(errno), path);
             return -1;
-        } else {
+        } else
             close(fd);
-        }
-    } else {
+    } else
         return -1;
-    }
 
     return 0;
 }
 
-
 LibBalsaMailbox *
-libbalsa_mailbox_mbox_new(const gchar *path,
-                          gboolean     create)
+libbalsa_mailbox_mbox_new(const gchar * path, gboolean create)
 {
     LibBalsaMailbox *mailbox;
 
@@ -239,19 +229,17 @@ libbalsa_mailbox_mbox_new(const gchar *path,
 
     if (libbalsa_mailbox_local_set_path(LIBBALSA_MAILBOX_LOCAL(mailbox),
                                         path, create) != 0) {
-        g_object_unref(mailbox);
-        return NULL;
+       g_object_unref(mailbox);
+       return NULL;
     }
 
     return mailbox;
 }
 
-
 /* Helper: seek to offset, and return TRUE if the seek succeeds and a
  * message begins there. */
 static gboolean
-lbm_mbox_stream_seek_to_message(GMimeStream *stream,
-                                off_t        offset)
+lbm_mbox_stream_seek_to_message(GMimeStream * stream, off_t offset)
 {
     char buffer[5];
     ssize_t nread = 0;
@@ -262,9 +250,8 @@ lbm_mbox_stream_seek_to_message(GMimeStream *stream,
         == sizeof buffer
         && strncmp("From ", buffer, 5) == 0;
     if (!retval) {
-        if (nread == sizeof buffer) {
+        if (nread == sizeof buffer)
             --nread;
-        }
         buffer[nread] = 0;
 #if DEBUG_SEEK
         g_print("%s at %ld failed: read %ld chars, saw “%s”\n", __func__,
@@ -277,13 +264,11 @@ lbm_mbox_stream_seek_to_message(GMimeStream *stream,
     return retval;
 }
 
-
 static gboolean
-lbm_mbox_seek_to_message(LibBalsaMailboxMbox *mbox,
-                         off_t                offset)
+lbm_mbox_seek_to_message(LibBalsaMailboxMbox * mbox, off_t offset)
 {
     gboolean retval;
-
+    
     libbalsa_mime_stream_shared_lock(mbox->gmime_stream);
     retval = lbm_mbox_stream_seek_to_message(mbox->gmime_stream, offset);
     libbalsa_mime_stream_shared_unlock(mbox->gmime_stream);
@@ -291,10 +276,8 @@ lbm_mbox_seek_to_message(LibBalsaMailboxMbox *mbox,
     return retval;
 }
 
-
 static struct message_info *
-message_info_from_msgno(LibBalsaMailboxMbox *mbox,
-                        guint                msgno)
+message_info_from_msgno(LibBalsaMailboxMbox * mbox, guint msgno)
 {
     g_assert(msgno > 0 && msgno <= mbox->msgno_2_msg_info->len);
 
@@ -303,11 +286,9 @@ message_info_from_msgno(LibBalsaMailboxMbox *mbox,
                                                      msgno - 1);
 }
 
-
 static GMimeStream *
-libbalsa_mailbox_mbox_get_message_stream(LibBalsaMailbox *mailbox,
-                                         guint            msgno,
-                                         gboolean         peek)
+libbalsa_mailbox_mbox_get_message_stream(LibBalsaMailbox * mailbox,
+                                         guint msgno, gboolean peek)
 {
     LibBalsaMailboxMbox *mbox;
     struct message_info *msg_info;
@@ -317,85 +298,71 @@ libbalsa_mailbox_mbox_get_message_stream(LibBalsaMailbox *mailbox,
     mbox = LIBBALSA_MAILBOX_MBOX(mailbox);
     msg_info = message_info_from_msgno(mbox, msgno);
 
-    if (!msg_info || !lbm_mbox_seek_to_message(mbox, msg_info->start)) {
+    if (!msg_info || !lbm_mbox_seek_to_message(mbox, msg_info->start))
         return NULL;
-    }
 
     return g_mime_stream_substream(mbox->gmime_stream,
                                    msg_info->start + msg_info->from_len,
                                    msg_info->end);
 }
 
-
 static void
 libbalsa_mailbox_mbox_remove_files(LibBalsaMailboxLocal *mailbox)
 {
     g_return_if_fail (LIBBALSA_IS_MAILBOX_MBOX(mailbox));
 
-    if ( unlink(libbalsa_mailbox_local_get_path(mailbox)) == -1 ) {
-        libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                             _("Could not remove %s:\n%s"),
-                             libbalsa_mailbox_local_get_path(mailbox),
-                             strerror(errno));
-    }
+    if ( unlink(libbalsa_mailbox_local_get_path(mailbox)) == -1 )
+       libbalsa_information(LIBBALSA_INFORMATION_ERROR, 
+                            _("Could not remove %s:\n%s"), 
+                            libbalsa_mailbox_local_get_path(mailbox), 
+                            strerror(errno));
     LIBBALSA_MAILBOX_LOCAL_CLASS(parent_class)->remove_files(mailbox);
 }
 
-
-static int
-mbox_lock(LibBalsaMailbox *mailbox,
-          GMimeStream     *stream)
+static int mbox_lock(LibBalsaMailbox * mailbox, GMimeStream *stream)
 {
     const gchar *path = libbalsa_mailbox_local_get_path(mailbox);
     int fd = GMIME_STREAM_FS(stream)->fd;
     return libbalsa_lock_file(path, fd, FALSE, TRUE, 1);
 }
 
-
-static void
-mbox_unlock(LibBalsaMailbox *mailbox,
-            GMimeStream     *stream)
+static void mbox_unlock(LibBalsaMailbox * mailbox, GMimeStream *stream)
 {
     const gchar *path = libbalsa_mailbox_local_get_path(mailbox);
     int fd = GMIME_STREAM_FS(stream)->fd;
     libbalsa_unlock_file(path, fd, 1);
 }
 
-
 /* GMimeParserHeaderRegexFunc callback; save the header's offset if it's
  * "Status", "X-Status", or "MIME-Version".  Save only the first one, to
  * avoid headers in encapsulated messages.
- *
+ * 
  * If a message has no status headers but an encapsulated message does,
  * we may save the offset of the encapsulated header; we check for that
  * later.
- *
+ * 
  * We use the offset of the "MIME-Version" header as the location to
  * insert status headers, if necessary.
  */
 static void
-lbm_mbox_header_cb(GMimeParser *parser,
-                   const char  *header,
-                   const char  *value,
-                   gint64       offset,
-                   gpointer     user_data)
+lbm_mbox_header_cb(GMimeParser * parser, const char *header,
+                   const char *value, gint64 offset,
+                   gpointer user_data)
 {
     struct message_info *msg_info = *(struct message_info **) user_data;
 
-    if ((g_ascii_strcasecmp(header, "Status") == 0) && (msg_info->status < 0)) {
+    if (g_ascii_strcasecmp(header, "Status") == 0 && msg_info->status < 0)
         msg_info->status = offset;
-    } else if ((g_ascii_strcasecmp(header, "X-Status") == 0)
-               && (msg_info->x_status < 0)) {
+    else if (g_ascii_strcasecmp(header, "X-Status") == 0
+             && msg_info->x_status < 0)
         msg_info->x_status = offset;
-    } else if ((g_ascii_strcasecmp(header, "MIME-Version") == 0)
-               && (msg_info->mime_version < 0)) {
+    else if (g_ascii_strcasecmp(header, "MIME-Version") == 0
+             && msg_info->mime_version < 0)
         msg_info->mime_version = offset;
-    }
 }
 
-
 static gchar *
-lbm_mbox_get_cache_filename(LibBalsaMailboxMbox *mbox)
+lbm_mbox_get_cache_filename(LibBalsaMailboxMbox * mbox)
 {
     gchar *encoded_path;
     gchar *filename;
@@ -403,7 +370,7 @@ lbm_mbox_get_cache_filename(LibBalsaMailboxMbox *mbox)
 
     encoded_path =
         libbalsa_urlencode(libbalsa_mailbox_local_get_path
-                               (LIBBALSA_MAILBOX_LOCAL(mbox)));
+                           (LIBBALSA_MAILBOX_LOCAL(mbox)));
     basename = g_strconcat("mbox", encoded_path, NULL);
     g_free(encoded_path);
     filename =
@@ -413,18 +380,16 @@ lbm_mbox_get_cache_filename(LibBalsaMailboxMbox *mbox)
     return filename;
 }
 
-
 static void
-lbm_mbox_save(LibBalsaMailboxMbox *mbox)
+lbm_mbox_save(LibBalsaMailboxMbox * mbox)
 {
     gchar *filename;
 #if !defined(__APPLE__)
     GError *err = NULL;
 #endif                          /* !defined(__APPLE__) */
 
-    if (!mbox->messages_info_changed) {
+    if (!mbox->messages_info_changed)
         return;
-    }
 
     mbox->messages_info_changed = FALSE;
 
@@ -432,7 +397,7 @@ lbm_mbox_save(LibBalsaMailboxMbox *mbox)
 
     if (mbox->msgno_2_msg_info->len > 0) {
         GArray *messages_info =
-            g_array_sized_new(FALSE, FALSE, sizeof(struct message_info),
+            g_array_sized_new(FALSE, FALSE, sizeof(struct message_info), 
                               mbox->msgno_2_msg_info->len);
         guint msgno;
 #if defined(__APPLE__)
@@ -458,10 +423,10 @@ lbm_mbox_save(LibBalsaMailboxMbox *mbox)
 #else                           /* !defined(__APPLE__) */
         template = g_strconcat(filename, ":XXXXXX", NULL);
         fd = g_mkstemp(template);
-        if ((fd < 0) || (write(fd, messages_info->data,
-                               messages_info->len *
-                               sizeof(struct message_info)) <
-                         (ssize_t) messages_info->len)) {
+        if (fd < 0 || write(fd, messages_info->data,
+                            messages_info->len *
+                            sizeof(struct message_info)) <
+            (ssize_t) messages_info->len) {
             libbalsa_information(LIBBALSA_INFORMATION_WARNING,
                                  _("Failed to create temporary file "
                                    "“%s”: %s"), template,
@@ -471,43 +436,39 @@ lbm_mbox_save(LibBalsaMailboxMbox *mbox)
             g_array_free(messages_info, TRUE);
             return;
         }
-        if ((close(fd) != 0)
-            || ((unlink(filename) != 0) && (errno != ENOENT))
-            || (libbalsa_safe_rename(template, filename) != 0)) {
+        if (close(fd) != 0
+            || (unlink(filename) != 0 && errno != ENOENT)
+            || libbalsa_safe_rename(template, filename) != 0)
             libbalsa_information(LIBBALSA_INFORMATION_WARNING,
                                  _("Failed to save cache file “%s”: %s. "
                                    "New version saved as “%s”"),
                                  filename, strerror(errno), template);
-        }
         g_free(template);
 #endif                          /* !defined(__APPLE__) */
         g_array_free(messages_info, TRUE);
-    } else if (unlink(filename) < 0) {
+    } else if (unlink(filename) < 0)
         libbalsa_information(LIBBALSA_INFORMATION_WARNING,
                              _("Could not unlink file %s: %s"),
                              filename, strerror(errno));
-    }
 
     g_free(filename);
 #ifdef DEBUG
-    g_print("%s:    %s    saved %d messages\n", __func__,
+    g_print("%s:    %s    saved %d messages\n", __func__, 
             LIBBALSA_MAILBOX(mbox)->name,
             mbox->msgno_2_msg_info->len);
 #endif
 }
 
-
-static LibBalsaMessage *lbm_mbox_message_new(GMimeMessage *mime_message,
-                                             struct message_info
-                                                          *msg_info);
-
+static LibBalsaMessage *lbm_mbox_message_new(GMimeMessage * mime_message,
+                                            struct message_info
+                                            *msg_info);
 static void
-parse_mailbox(LibBalsaMailboxMbox *mbox)
+parse_mailbox(LibBalsaMailboxMbox * mbox)
 {
     LibBalsaMailboxLocal *local = LIBBALSA_MAILBOX_LOCAL(mbox);
     GMimeParser *gmime_parser;
     struct message_info msg_info;
-    struct message_info *msg_info_p = &msg_info;
+    struct message_info * msg_info_p = &msg_info;
     unsigned msgno = mbox->msgno_2_msg_info->len;
 
     gmime_parser = g_mime_parser_new_with_stream(mbox->gmime_stream);
@@ -515,19 +476,19 @@ parse_mailbox(LibBalsaMailboxMbox *mbox)
     g_mime_parser_set_respect_content_length(gmime_parser, TRUE);
     g_mime_parser_set_header_regex(gmime_parser,
                                    "^Status|^X-Status|^MIME-Version",
-                                   lbm_mbox_header_cb, &msg_info_p);
+                                  lbm_mbox_header_cb, &msg_info_p);
 
     libbalsa_mailbox_local_set_threading_info(local);
     msg_info.local_info.message = NULL;
-    msg_info.local_info.loaded = FALSE;
+    msg_info.local_info.loaded  = FALSE;
     while (!g_mime_parser_eos(gmime_parser)) {
-        GMimeMessage *mime_message;
+       GMimeMessage *mime_message;
         LibBalsaMessage *msg;
         gchar *from;
         off_t offset;
 
         msg_info.status = msg_info.x_status = msg_info.mime_version = -1;
-        mime_message = g_mime_parser_construct_message(gmime_parser);
+        mime_message   = g_mime_parser_construct_message(gmime_parser);
         if (mime_message == NULL) {
             /* Skip to the next message, if any */
             GMimeStream *mbox_stream;
@@ -536,49 +497,42 @@ parse_mailbox(LibBalsaMailboxMbox *mbox)
             while (!g_mime_stream_eos(mbox_stream)) {
                 gchar c;
 
-                while (g_mime_stream_read(mbox_stream, &c, 1) == 1) {
-                    if (c == '\n') {
+                while (g_mime_stream_read(mbox_stream, &c, 1) == 1)
+                    if (c == '\n')
                         break;
-                    }
-                }
 
                 if (lbm_mbox_stream_seek_to_message(mbox_stream,
-                                                    g_mime_stream_tell(mbox_stream))) {
+                                                    g_mime_stream_tell(mbox_stream)))
                     break;
-                }
             }
             g_mime_parser_init_with_stream(gmime_parser, mbox_stream);
             continue;
         }
         msg_info.start = g_mime_parser_get_from_offset(gmime_parser);
-        msg_info.end = g_mime_parser_tell(gmime_parser);
-        if ((msg_info.end <= msg_info.start)
+        msg_info.end   = g_mime_parser_tell(gmime_parser);
+        if (msg_info.end <= msg_info.start
             || !(from = g_mime_parser_get_from(gmime_parser))) {
-            g_object_unref(mime_message);
+           g_object_unref(mime_message);
             continue;
-        }
+       }
         msg_info.from_len = strlen(from) + 1;
         g_free(from);
 
-        /* Make sure we don't have offsets for any encapsulated headers. */
-        if (!g_mime_object_get_header(GMIME_OBJECT(mime_message),
-                                      "Status")) {
-            msg_info.status = -1;
-        }
-        if (!g_mime_object_get_header(GMIME_OBJECT(mime_message),
-                                      "X-Status")) {
-            msg_info.x_status = -1;
-        }
-        if (!g_mime_object_get_header(GMIME_OBJECT(mime_message),
-                                      "MIME-Version")) {
-            msg_info.mime_version = -1;
-        }
+       /* Make sure we don't have offsets for any encapsulated headers. */
+       if (!g_mime_object_get_header(GMIME_OBJECT(mime_message),
+                                      "Status"))
+           msg_info.status = -1;
+       if (!g_mime_object_get_header(GMIME_OBJECT(mime_message),
+                                      "X-Status"))
+           msg_info.x_status = -1;
+       if (!g_mime_object_get_header(GMIME_OBJECT(mime_message),
+                                      "MIME-Version"))
+           msg_info.mime_version = -1;
 
         msg = lbm_mbox_message_new(mime_message, &msg_info);
         g_object_unref(mime_message);
-        if (!msg) {
+        if (!msg)
             continue;
-        }
 
         msg_info.local_info.flags = msg_info.orig_flags;
         g_ptr_array_add(mbox->msgno_2_msg_info,
@@ -589,12 +543,12 @@ parse_mailbox(LibBalsaMailboxMbox *mbox)
         msg->length = msg_info.end - (msg_info.start + msg_info.from_len);
         msg->mailbox = LIBBALSA_MAILBOX(mbox);
         msg->msgno = ++msgno;
-        /* We must drop the mime-stream lock to call
+       /* We must drop the mime-stream lock to call
          * libbalsa_mailbox_local_cache_message, which calls
-         * libbalsa_mailbox_cache_message(), as it may grab the
-         * gdk lock to emit gtk signals; we save and restore the current
-         * stream position, in case someone changes it while we're not
-         * holding the lock. */
+        * libbalsa_mailbox_cache_message(), as it may grab the
+        * gdk lock to emit gtk signals; we save and restore the current
+        * stream position, in case someone changes it while we're not
+        * holding the lock. */
         offset = g_mime_stream_tell(mbox->gmime_stream);
         libbalsa_mime_stream_shared_unlock(mbox->gmime_stream);
         libbalsa_mailbox_local_cache_message(local, msgno, msg);
@@ -608,23 +562,21 @@ parse_mailbox(LibBalsaMailboxMbox *mbox)
     lbm_mbox_save(mbox);
 }
 
-
 static void
 free_message_info(struct message_info *msg_info)
 {
     if (msg_info->local_info.message) {
-        msg_info->local_info.message->mailbox = NULL;
-        msg_info->local_info.message->msgno = 0;
+       msg_info->local_info.message->mailbox = NULL;
+       msg_info->local_info.message->msgno   = 0;
         g_object_remove_weak_pointer(G_OBJECT(msg_info->local_info.message),
                                      (gpointer) & msg_info->local_info.message);
-        msg_info->local_info.message = NULL;
+       msg_info->local_info.message = NULL;
     }
     g_free(msg_info);
 }
 
-
 static void
-free_messages_info(GPtrArray *msgno_2_msg_info)
+free_messages_info(GPtrArray * msgno_2_msg_info)
 {
     guint i;
 
@@ -636,9 +588,8 @@ free_messages_info(GPtrArray *msgno_2_msg_info)
     g_ptr_array_free(msgno_2_msg_info, TRUE);
 }
 
-
 static void
-lbm_mbox_restore(LibBalsaMailboxMbox *mbox)
+lbm_mbox_restore(LibBalsaMailboxMbox * mbox)
 {
     gchar *filename;
     struct stat st;
@@ -649,8 +600,8 @@ lbm_mbox_restore(LibBalsaMailboxMbox *mbox)
     GMimeStream *mbox_stream;
 
     filename = lbm_mbox_get_cache_filename(mbox);
-    if ((stat(filename, &st) < 0)
-        || (st.st_mtime < libbalsa_mailbox_get_mtime(LIBBALSA_MAILBOX(mbox)))
+    if (stat(filename, &st) < 0 
+        || st.st_mtime < libbalsa_mailbox_get_mtime(LIBBALSA_MAILBOX(mbox))
         || !g_file_get_contents(filename, &contents, &length, NULL)) {
         /* No cache file, stale cache, or read error. */
         g_free(filename);
@@ -682,24 +633,21 @@ lbm_mbox_restore(LibBalsaMailboxMbox *mbox)
     end = 0;
     do {
         msg_info->local_info.message = NULL;
-        msg_info->local_info.loaded = FALSE;
-        if (msg_info->start != end) {
+        msg_info->local_info.loaded  = FALSE;
+        if (msg_info->start != end)
             /* Error: this message doesn't start at the end of the
              * previous one. */
             break;
-        }
         end = msg_info->end;
-        if ((msg_info->from_len < 6)
-            || ((off_t) (msg_info->start + msg_info->from_len) >= end)
-            || (end > mbox->size)) {
+        if (msg_info->from_len < 6
+            || (off_t) (msg_info->start + msg_info->from_len) >= end
+            || end > mbox->size)
             /* Error: various. */
             break;
-        }
-        if ((end < mbox->size)
-            && !lbm_mbox_seek_to_message(mbox, msg_info->end)) {
+        if (end < mbox->size
+            && !lbm_mbox_seek_to_message(mbox, msg_info->end))
             /* Error: no message following this one. */
             break;
-        }
         g_ptr_array_add(mbox->msgno_2_msg_info,
                         g_memdup(msg_info, sizeof *msg_info));
     } while (++msg_info < (struct message_info *) (contents + length));
@@ -726,29 +674,24 @@ lbm_mbox_restore(LibBalsaMailboxMbox *mbox)
         gchar c;
 
         if (lbm_mbox_stream_seek_to_message(mbox_stream,
-                                            g_mime_stream_tell(mbox_stream))) {
+                                            g_mime_stream_tell(mbox_stream)))
             break;
-        }
 
-        while (g_mime_stream_read(mbox_stream, &c, 1) == 1) {
-            if (c == '\n') {
+        while (g_mime_stream_read(mbox_stream, &c, 1) == 1)
+            if (c == '\n')
                 break;
-            }
-        }
     }
     libbalsa_mime_stream_shared_unlock(mbox_stream);
 
     g_free(contents);
 }
 
-
 static gboolean
-libbalsa_mailbox_mbox_open(LibBalsaMailbox *mailbox,
-                           GError         **err)
+libbalsa_mailbox_mbox_open(LibBalsaMailbox * mailbox, GError **err)
 {
     LibBalsaMailboxMbox *mbox = LIBBALSA_MAILBOX_MBOX(mailbox);
     struct stat st;
-    const gchar *path;
+    const gchar* path;
     int fd;
     GMimeStream *gmime_stream;
     time_t t0;
@@ -756,22 +699,22 @@ libbalsa_mailbox_mbox_open(LibBalsaMailbox *mailbox,
     path = libbalsa_mailbox_local_get_path(mailbox);
 
     if (stat(path, &st) == -1) {
-        g_set_error(err, LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_OPEN_ERROR,
-                    _("Mailbox does not exist."));
-        return FALSE;
+       g_set_error(err, LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_OPEN_ERROR,
+                   _("Mailbox does not exist."));
+       return FALSE;
     }
 
     mailbox->readonly = access (path, W_OK);
     fd = open(path, mailbox->readonly ? O_RDONLY : O_RDWR);
     if (fd == -1) {
-        g_set_error(err, LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_OPEN_ERROR,
-                    _("Cannot open mailbox."));
-        return FALSE;
+       g_set_error(err, LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_OPEN_ERROR,
+                   _("Cannot open mailbox."));
+       return FALSE;
     }
     gmime_stream = libbalsa_mime_stream_shared_new(fd);
 
     libbalsa_mime_stream_shared_lock(gmime_stream);
-    if ((st.st_size > 0)
+    if (st.st_size > 0
         && !lbm_mbox_stream_seek_to_message(gmime_stream, 0)) {
         libbalsa_mime_stream_shared_unlock(gmime_stream);
         g_object_unref(gmime_stream);
@@ -783,10 +726,10 @@ libbalsa_mailbox_mbox_open(LibBalsaMailbox *mailbox,
 
     if (mbox_lock(mailbox, gmime_stream)) {
         libbalsa_mime_stream_shared_unlock(gmime_stream);
-        g_object_unref(gmime_stream);
-        g_set_error(err, LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_OPEN_ERROR,
-                    _("Cannot lock mailbox."));
-        return FALSE;
+       g_object_unref(gmime_stream);
+       g_set_error(err, LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_OPEN_ERROR,
+                   _("Cannot lock mailbox."));
+       return FALSE;
     }
 
     mbox->size = st.st_size;
@@ -811,12 +754,11 @@ libbalsa_mailbox_mbox_open(LibBalsaMailbox *mailbox,
     libbalsa_mime_stream_shared_unlock(gmime_stream);
 #ifdef DEBUG
     g_print(_("%s: Opening %s Refcount: %d\n"),
-            "LibBalsaMailboxMbox", mailbox->name, mailbox->open_ref);
+           "LibBalsaMailboxMbox", mailbox->name, mailbox->open_ref);
 #endif
     return TRUE;
 }
 
-
 /* Check for new mail in a closed mbox, using a crude parser. */
 /*
  * Lightweight replacement for GMimeStreamBuffer
@@ -829,14 +771,13 @@ typedef struct {
 } LbmMboxStreamBuffer;
 
 static off_t
-lbm_mbox_seek(LbmMboxStreamBuffer *buffer,
-              off_t                offset)
+lbm_mbox_seek(LbmMboxStreamBuffer * buffer, off_t offset)
 {
     if (offset >= 0) {
         buffer->start =
             buffer->end - (g_mime_stream_tell(buffer->stream) - offset);
 
-        if ((buffer->start < 0) || (buffer->start > buffer->end)) {
+        if (buffer->start < 0 || buffer->start > buffer->end) {
             offset =
                 g_mime_stream_seek(buffer->stream, offset,
                                    GMIME_STREAM_SEEK_SET);
@@ -847,10 +788,8 @@ lbm_mbox_seek(LbmMboxStreamBuffer *buffer,
     return offset;
 }
 
-
 static guint
-lbm_mbox_readln(LbmMboxStreamBuffer *buffer,
-                GByteArray          *line)
+lbm_mbox_readln(LbmMboxStreamBuffer * buffer, GByteArray * line)
 {
     gchar *p, *q, *r;
 
@@ -865,16 +804,14 @@ lbm_mbox_readln(LbmMboxStreamBuffer *buffer,
                 g_warning("%s: Read error", __func__);
                 break;
             }
-            if (buffer->end == 0) {
+            if (buffer->end == 0)
                 break;
-            }
         }
 
         p = q = buffer->buf + buffer->start;
         r = buffer->buf + buffer->end;
-        while (p < r && *p++ != '\n') {
-            /* Nothing */
-        }
+        while (p < r && *p++ != '\n')
+            /* Nothing */;
 
         g_byte_array_append(line, (guint8 *) q, p - q);
         buffer->start += p - q;
@@ -883,14 +820,12 @@ lbm_mbox_readln(LbmMboxStreamBuffer *buffer,
     return line->len;
 }
 
-
 /*
  * Look for an unread, undeleted message using the cache file.
  */
 static gboolean
-lbm_mbox_check_cache(LibBalsaMailboxMbox *mbox,
-                     LbmMboxStreamBuffer *buffer,
-                     GByteArray          *line)
+lbm_mbox_check_cache(LibBalsaMailboxMbox * mbox,
+                     LbmMboxStreamBuffer * buffer, GByteArray * line)
 {
     gchar *filename;
     gboolean tmp;
@@ -902,61 +837,53 @@ lbm_mbox_check_cache(LibBalsaMailboxMbox *mbox,
     filename = lbm_mbox_get_cache_filename(mbox);
     tmp = g_file_get_contents(filename, &contents, &length, NULL);
     g_free(filename);
-    if (!tmp) {
+    if (!tmp)
         return retval;
-    }
 
     for (msg_info = (struct message_info *) contents;
          msg_info < (struct message_info *) (contents + length);
          msg_info++) {
-        if ((lbm_mbox_seek(buffer, msg_info->status) >= 0)
+        if (lbm_mbox_seek(buffer, msg_info->status) >= 0
             && lbm_mbox_readln(buffer, line)) {
             if (g_ascii_strncasecmp((gchar *) line->data,
-                                    "Status: ", 8) != 0) {
+                                    "Status: ", 8) != 0)
                 /* Bad cache. */
                 break;
-            }
-            if (strchr((gchar *) line->data + 8, 'R')) {
+            if (strchr((gchar *) line->data + 8, 'R'))
                 /* Message has been read. */
                 continue;
-            }
         }
-        if ((lbm_mbox_seek(buffer, msg_info->x_status) >= 0)
+        if (lbm_mbox_seek(buffer, msg_info->x_status) >= 0
             && lbm_mbox_readln(buffer, line)) {
             if (g_ascii_strncasecmp((gchar *) line->data,
-                                    "X-Status: ", 10) != 0) {
+                                    "X-Status: ", 10) != 0)
                 /* Bad cache. */
                 break;
-            }
-            if (strchr((gchar *) line->data + 10, 'D')) {
+            if (strchr((gchar *) line->data + 10, 'D'))
                 /* Message has been read. */
                 continue;
-            }
         }
         /* Message is unread and undeleted. */
         retval = TRUE;
         break;
     }
-    if (!retval) {
+    if (!retval)
         /* Seek to the end of the last message we checked. */
         lbm_mbox_seek(buffer, msg_info > (struct message_info *) contents ?
-                      (msg_info - 1)->end : 0);
-    }
+                      (msg_info-1)->end : 0);
     g_free(contents); /* msg_info points to contents, cannot free too early */
 
 
     return retval;
 }
 
-
 /*
  * Look for an unread, undeleted message in the mbox file, beyond the
  * messages we found in the cache file.
  */
 static gboolean
-lbm_mbox_check_file(LibBalsaMailboxMbox *mbox,
-                    LbmMboxStreamBuffer *buffer,
-                    GByteArray          *line)
+lbm_mbox_check_file(LibBalsaMailboxMbox * mbox,
+                    LbmMboxStreamBuffer * buffer, GByteArray * line)
 {
     gboolean retval = FALSE;
 
@@ -968,36 +895,30 @@ lbm_mbox_check_file(LibBalsaMailboxMbox *mbox,
          * by an embedded Content-Length header, we may be misled, but a
          * full GMime parse takes too long. */
         while (lbm_mbox_readln(buffer, line)
-               && strncmp((gchar *) line->data, "From ", 5) != 0) {
-            /* Nothing. */
-        }
-        if (line->len == 0) {
+               && strncmp((gchar *) line->data, "From ", 5) != 0)
+            /* Nothing. */ ;
+        if (line->len == 0)
             break;
-        }
 
         /* Scan headers. */
         do {
             /* Blank line ends headers. */
             if (!lbm_mbox_readln(buffer, line)
-                || (line->data[0] == '\n')) {
+                || line->data[0] == '\n')
                 break;
-            }
 
             line->data[line->len - 1] = '\0';
             if (g_ascii_strncasecmp((gchar *) line->data,
                                     "Status: ", 8) == 0) {
-                if (strchr((gchar *) line->data + 8, 'R')) {
+                if (strchr((gchar *) line->data + 8, 'R'))
                     ++old_or_deleted;
-                }
             } else if (g_ascii_strncasecmp((gchar *) line->data,
                                            "X-Status: ", 10) == 0) {
-                if (strchr((gchar *) line->data + 10, 'D')) {
+                if (strchr((gchar *) line->data + 10, 'D'))
                     ++old_or_deleted;
-                }
             } else if (g_ascii_strncasecmp((gchar *) line->data,
-                                           "Content-Length: ", 16) == 0) {
+                                           "Content-Length: ", 16) == 0)
                 content_length = atoi((gchar *) line->data + 16);
-            }
         } while (!(old_or_deleted && content_length));
 
         if (!old_or_deleted) {
@@ -1023,22 +944,17 @@ lbm_mbox_check_file(LibBalsaMailboxMbox *mbox,
     return retval;
 }
 
-
 static gboolean
-lbm_mbox_check(LibBalsaMailbox *mailbox,
-               const gchar     *path)
+lbm_mbox_check(LibBalsaMailbox * mailbox, const gchar * path)
 {
     LibBalsaMailboxMbox *mbox = LIBBALSA_MAILBOX_MBOX(mailbox);
     int fd;
     gboolean retval = FALSE;
-    LbmMboxStreamBuffer buffer = {
-        0, 0
-    };
+    LbmMboxStreamBuffer buffer = { 0, 0 };
     GByteArray *line;
 
-    if (!(fd = open(path, O_RDONLY))) {
+    if (!(fd = open(path, O_RDONLY)))
         return retval;
-    }
 
     buffer.stream = g_mime_stream_fs_new(fd);
 
@@ -1050,9 +966,8 @@ lbm_mbox_check(LibBalsaMailbox *mailbox,
     line = g_byte_array_sized_new(80);
 
     retval = lbm_mbox_check_cache(mbox, &buffer, line);
-    if (!retval) {
+    if (!retval)
         retval = lbm_mbox_check_file(mbox, &buffer, line);
-    }
 
     g_byte_array_free(line, TRUE);
     mbox_unlock(mailbox, buffer.stream);
@@ -1061,10 +976,9 @@ lbm_mbox_check(LibBalsaMailbox *mailbox,
     return retval;
 }
 
-
 /* Called with mailbox locked. */
 static void
-libbalsa_mailbox_mbox_check(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_mbox_check(LibBalsaMailbox * mailbox)
 {
     struct stat st;
     const gchar *path;
@@ -1081,48 +995,46 @@ libbalsa_mailbox_mbox_check(LibBalsaMailbox *mailbox)
     if (mbox->gmime_stream ?
         fstat(GMIME_STREAM_FS(mbox->gmime_stream)->fd, &st) :
         stat(path, &st)) {
-        perror(path);
-        return;
+       perror(path);
+       return;
     }
 
     mtime = libbalsa_mailbox_get_mtime(mailbox);
     if (mtime == 0) {
-        /* First check--just cache the mtime and size. */
+       /* First check--just cache the mtime and size. */
         libbalsa_mailbox_set_mtime(mailbox, st.st_mtime);
-        mbox->size = st.st_size;
+       mbox->size = st.st_size;
 #if DEBUG_SEEK
         g_print("%s %s set size from stat %d\n", __func__, mailbox->name,
                 mbox->size);
 #endif
-        return;
-    }
-    if ((st.st_mtime == mtime) && (st.st_size == mbox->size)) {
-        return;
+       return;
     }
+    if (st.st_mtime == mtime && st.st_size == mbox->size)
+       return;
 
     libbalsa_mailbox_set_mtime(mailbox, st.st_mtime);
 
     if (!MAILBOX_OPEN(mailbox)) {
-        libbalsa_mailbox_set_unread_messages_flag(mailbox,
-                                                  lbm_mbox_check(mailbox,
-                                                                 path));
-        /* Cache the file size, so we don't check the next time. */
-        mbox->size = st.st_size;
+       libbalsa_mailbox_set_unread_messages_flag(mailbox,
+                                                 lbm_mbox_check(mailbox,
+                                                                path));
+       /* Cache the file size, so we don't check the next time. */
+       mbox->size = st.st_size;
 #if DEBUG_SEEK
         g_print("%s %s set size from stat %d\n", __func__, mailbox->name,
                 mbox->size);
 #endif
-        return;
+       return;
     }
 
     mbox_stream = mbox->gmime_stream;
-    if (mbox_lock(mailbox, mbox_stream) != 0) {
-        /* we couldn't lock the mailbox, but nothing serious happened:
-         * probably the new mail arrived: no reason to wait till we can
-         * parse it: we'll get it on the next pass
-         */
-        return;
-    }
+    if (mbox_lock(mailbox, mbox_stream) != 0)
+       /* we couldn't lock the mailbox, but nothing serious happened:
+        * probably the new mail arrived: no reason to wait till we can
+        * parse it: we'll get it on the next pass
+        */
+       return;
 
     /* Find a good place to start parsing the mailbox.  If the only
      * change is that message(s) were appended to this file, we should
@@ -1142,52 +1054,47 @@ libbalsa_mailbox_mbox_check(LibBalsaMailbox *mailbox)
     start = mbox->size + 1;
 #if DEBUG_SEEK
     g_print("%s %s looking where to start parsing.\n",
-            __func__, mailbox->name);
+              __func__, mailbox->name);
     if (!lbm_mbox_stream_seek_to_message(mbox_stream, start)) {
         g_print(" did not find a message at offset %ld\n", (long) start);
         --start;
-        if (lbm_mbox_stream_seek_to_message(mbox_stream, start)) {
+        if (lbm_mbox_stream_seek_to_message(mbox_stream, start))
             g_print(" found a message at offset %ld\n", (long) start);
-        } else {
+        else
             g_print(" did not find a message at offset %ld\n", (long) start);
-        }
-    } else {
+    } else
         g_print(" found a message at offset %ld\n", (long) start);
-    }
 #else
-    if (!lbm_mbox_stream_seek_to_message(mbox_stream, start)) {
+    if (!lbm_mbox_stream_seek_to_message(mbox_stream, start))
         /* Sometimes we seem to be off by 1: */
         --start;
-    }
 #endif
 
     while ((msgno = mbox->msgno_2_msg_info->len) > 0) {
-        off_t offset;
+       off_t offset;
         struct message_info *msg_info;
 
-        if (lbm_mbox_stream_seek_to_message(mbox_stream, start)) {
-            /* A message begins here, so it must(?) be
-             * the first new message--start parsing here. */
+        if (lbm_mbox_stream_seek_to_message(mbox_stream, start))
+           /* A message begins here, so it must(?) be
+            * the first new message--start parsing here. */
             break;
-        }
 
 #if DEBUG_SEEK
         g_print(" backing up over message %d\n", msgno);
 #endif
-        /* Back up over this message and try again. */
+       /* Back up over this message and try again. */
         msg_info = message_info_from_msgno(mbox, msgno);
         start = msg_info->start;
 
         if ((msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_NEW)
-            && !(msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_DELETED)) {
+            && !(msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_DELETED))
             --mailbox->unread_messages;
-        }
 
-        /* We must drop the mime-stream lock to call
-         * libbalsa_mailbox_local_msgno_removed(), as it will grab the
-         * gdk lock to emit gtk signals; we save and restore the current
-         * stream position, in case someone changes it while we're not
-         * holding the lock. */
+       /* We must drop the mime-stream lock to call
+        * libbalsa_mailbox_local_msgno_removed(), as it will grab the
+        * gdk lock to emit gtk signals; we save and restore the current
+        * stream position, in case someone changes it while we're not
+        * holding the lock. */
         offset = g_mime_stream_tell(mbox_stream);
         libbalsa_mime_stream_shared_unlock(mbox_stream);
         libbalsa_mailbox_local_msgno_removed(mailbox, msgno);
@@ -1198,9 +1105,8 @@ libbalsa_mailbox_mbox_check(LibBalsaMailbox *mailbox)
         g_ptr_array_remove_index(mbox->msgno_2_msg_info, msgno - 1);
         mbox->messages_info_changed = TRUE;
     }
-    if (msgno == 0) {
+    if(msgno == 0)
         g_mime_stream_seek(mbox_stream, 0, GMIME_STREAM_SEEK_SET);
-    }
 #ifdef DEBUG
     g_print("%s: start parsing at msgno %d of %d\n", __func__, msgno,
             mbox->msgno_2_msg_info->len);
@@ -1216,24 +1122,21 @@ libbalsa_mailbox_mbox_check(LibBalsaMailbox *mailbox)
     libbalsa_mailbox_local_load_messages(mailbox, msgno);
 }
 
-
 static void
-libbalsa_mailbox_mbox_close_mailbox(LibBalsaMailbox *mailbox,
-                                    gboolean         expunge)
+libbalsa_mailbox_mbox_close_mailbox(LibBalsaMailbox * mailbox,
+                                    gboolean expunge)
 {
     LibBalsaMailboxMbox *mbox = LIBBALSA_MAILBOX_MBOX(mailbox);
     guint len;
 
     len = mbox->msgno_2_msg_info->len;
     libbalsa_mailbox_mbox_sync(mailbox, expunge);
-    if (mbox->msgno_2_msg_info->len != len) {
+    if (mbox->msgno_2_msg_info->len != len)
         libbalsa_mailbox_changed(mailbox);
-    }
 
-    if (LIBBALSA_MAILBOX_CLASS(parent_class)->close_mailbox) {
+    if (LIBBALSA_MAILBOX_CLASS(parent_class)->close_mailbox)
         LIBBALSA_MAILBOX_CLASS(parent_class)->close_mailbox(mailbox,
                                                             expunge);
-    }
 
     /* Now it's safe to close the stream and free the message info. */
     if (mbox->gmime_stream) {
@@ -1245,19 +1148,17 @@ libbalsa_mailbox_mbox_close_mailbox(LibBalsaMailbox *mailbox,
     mbox->msgno_2_msg_info = NULL;
 }
 
-
 static GMimeMessage *
-lbm_mbox_get_mime_message(LibBalsaMailbox *mailbox,
-                          guint            msgno)
+lbm_mbox_get_mime_message(LibBalsaMailbox * mailbox,
+                         guint msgno)
 {
     GMimeStream *stream;
     GMimeParser *parser;
     GMimeMessage *mime_message;
 
     stream = libbalsa_mailbox_mbox_get_message_stream(mailbox, msgno, TRUE);
-    if (!stream) {
-        return NULL;
-    }
+    if (!stream)
+       return NULL;
     libbalsa_mime_stream_shared_lock(stream);
     parser = g_mime_parser_new_with_stream(stream);
 
@@ -1269,151 +1170,128 @@ lbm_mbox_get_mime_message(LibBalsaMailbox *mailbox,
     return mime_message;
 }
 
-
 /* Write one or two newlines to stream. */
 static gint
-lbm_mbox_newline(GMimeStream *stream)
+lbm_mbox_newline(GMimeStream * stream)
 {
     gint retval;
     static const gchar newlines[] = "\n\n";
 
     if (g_mime_stream_seek(stream, -1, GMIME_STREAM_SEEK_CUR) < 0) {
-        retval = -1;
+       retval = -1;
     } else {
         gchar buf;
 
-        retval = g_mime_stream_read(stream, &buf, 1);
-        if (retval == 1) {
-            retval =
-                g_mime_stream_write(stream, newlines, buf == '\n' ? 1 : 2);
-        }
+       retval = g_mime_stream_read(stream, &buf, 1);
+       if (retval == 1) {
+               retval =
+                       g_mime_stream_write(stream, newlines, buf == '\n' ? 1 : 2);
+       }
     }
 
     return retval;
 }
 
-
 /* Store the message status flags in str, padded with spaces to a minimum
  * length of len.
  */
 static void
-lbm_mbox_status_hdr(LibBalsaMessageFlag flags,
-                    guint               len,
-                    GString            *str)
+lbm_mbox_status_hdr(LibBalsaMessageFlag flags, guint len, GString * str)
 {
-    if ((flags & LIBBALSA_MESSAGE_FLAG_NEW) == 0) {
-        g_string_append_c(str, 'R');
-    }
-    if ((flags & LIBBALSA_MESSAGE_FLAG_RECENT) == 0) {
-        g_string_append_c(str, 'O');
-    }
-    while (str->len < len) {
-        g_string_append_c(str, ' ');
-    }
+    if ((flags & LIBBALSA_MESSAGE_FLAG_NEW) == 0)
+       g_string_append_c(str, 'R');
+    if ((flags & LIBBALSA_MESSAGE_FLAG_RECENT) == 0)
+       g_string_append_c(str, 'O');
+    while (str->len < len)
+       g_string_append_c(str, ' ');
 }
 
-
 /* Store the message x-status flags in str, padded with spaces to a
  * minimum length of len.
  */
 static void
-lbm_mbox_x_status_hdr(LibBalsaMessageFlag flags,
-                      guint               len,
-                      GString            *str)
+lbm_mbox_x_status_hdr(LibBalsaMessageFlag flags, guint len, GString * str)
 {
-    if ((flags & LIBBALSA_MESSAGE_FLAG_REPLIED) != 0) {
-        g_string_append_c(str, 'A');
-    }
-    if ((flags & LIBBALSA_MESSAGE_FLAG_FLAGGED) != 0) {
-        g_string_append_c(str, 'F');
-    }
-    if ((flags & LIBBALSA_MESSAGE_FLAG_DELETED) != 0) {
-        g_string_append_c(str, 'D');
-    }
-    while (str->len < len) {
-        g_string_append_c(str, ' ');
-    }
+    if ((flags & LIBBALSA_MESSAGE_FLAG_REPLIED) != 0)
+       g_string_append_c(str, 'A');
+    if ((flags & LIBBALSA_MESSAGE_FLAG_FLAGGED) != 0)
+       g_string_append_c(str, 'F');
+    if ((flags & LIBBALSA_MESSAGE_FLAG_DELETED) != 0)
+       g_string_append_c(str, 'D');
+    while (str->len < len)
+       g_string_append_c(str, ' ');
 }
 
-
 /* Helper for lbm_mbox_rewrite_in_place.
  *
  * offset:     the offset of a header in the mbox file;
  * stream:     mbox stream;
  * header:     a GString containing flags to be stored as the value of
- *              the header;
+ *             the header;
  * buf:                buffer to hold the whole text of the header;
  * len:                buffer length;
  * start:      offset into buf for storing the flags.
  *
  * Returns TRUE if the rewrite can be carried out in place,
- *         FALSE otherwise.
+ *        FALSE otherwise.
  *
  * If TRUE, on return, buf contains the new header text.
  */
 static gboolean
-lbm_mbox_rewrite_helper(off_t        offset,
-                        GMimeStream *stream,
-                        GString     *header,
-                        gchar       *buf,
-                        guint        len,
-                        const gchar *name)
+lbm_mbox_rewrite_helper(off_t offset, GMimeStream * stream,
+                       GString * header, gchar * buf, guint len,
+                       const gchar * name)
 {
     guint name_len = strlen(name);
     guint i;
 
     g_assert(name_len < len);
 
-    if (offset < 0) {
-        /* No existing header, so we can rewrite in place only if no
-         * flags need to be set. */
-        return header->len == 0;
-    }
+    if (offset < 0)
+       /* No existing header, so we can rewrite in place only if no
+        * flags need to be set. */
+       return header->len == 0;
 
-    if ((g_mime_stream_seek(stream, offset, GMIME_STREAM_SEEK_SET) < 0)
-        || (g_mime_stream_read(stream, buf, len) < (gint) len)
-        || (g_ascii_strncasecmp(buf, name, name_len) != 0)) {
-        return FALSE;
-    }
+    if (g_mime_stream_seek(stream, offset, GMIME_STREAM_SEEK_SET) < 0
+       || g_mime_stream_read(stream, buf, len) < (gint) len
+       || g_ascii_strncasecmp(buf, name, name_len) != 0)
+       return FALSE;
 
     /* Copy the flags into the buffer. */
     for (i = 0; i < header->len; i++) {
-        if (buf[name_len + i] == '\n') {
-            /* The original header is too short to hold all the flags. */
-            return FALSE;
-        }
-        buf[name_len + i] = header->str[i];
+       if (buf[name_len + i] == '\n')
+           /* The original header is too short to hold all the flags. */
+           return FALSE;
+       buf[name_len + i] = header->str[i];
     }
 
     /* Fill with spaces to the end of the original header line. */
     while (buf[name_len + i] != '\n') {
-        if (name_len + i >= len - 1) {
-            /* Hit the end of the buffer before finding the end of the
-             * line--the header must have some extra garbage. */
-            return FALSE;
-        }
-        buf[name_len + i++] = ' ';
+       if (name_len + i >= len - 1)
+           /* Hit the end of the buffer before finding the end of the
+            * line--the header must have some extra garbage. */
+           return FALSE;
+       buf[name_len + i++] = ' ';
     }
 
     return TRUE;
 }
 
-
 /* Rewrite message status headers in place, if possible.
  *
  * msg_info:   struct message_info for the message;
  * stream:     mbox stream--must be locked by caller.
  *
  * Returns TRUE if it was possible to rewrite in place,
- *         FALSE otherwise.
+ *        FALSE otherwise.
  */
 static gboolean
 lbm_mbox_rewrite_in_place(struct message_info *msg_info,
-                          GMimeStream         *stream)
+                         GMimeStream * stream)
 {
     GString *header;
-    gchar status_buf[12];       /* "Status: XXX\n" */
-    gchar x_status_buf[14];     /* "X-Status: XXX\n" */
+    gchar status_buf[12];      /* "Status: XXX\n" */
+    gchar x_status_buf[14];    /* "X-Status: XXX\n" */
 
     /* Get the flags for the "Status" header. */
     header = g_string_new(NULL);
@@ -1421,10 +1299,10 @@ lbm_mbox_rewrite_in_place(struct message_info *msg_info,
     g_assert(header->len <= 3);
 
     if (!lbm_mbox_rewrite_helper(msg_info->status, stream, header,
-                                 status_buf, sizeof(status_buf),
-                                 "Status: ")) {
-        g_string_free(header, TRUE);
-        return FALSE;
+                                status_buf, sizeof(status_buf),
+                                "Status: ")) {
+       g_string_free(header, TRUE);
+       return FALSE;
     }
 
     /* Get the flags for the "X-Status" header. */
@@ -1433,33 +1311,31 @@ lbm_mbox_rewrite_in_place(struct message_info *msg_info,
     g_assert(header->len <= 3);
 
     if (!lbm_mbox_rewrite_helper(msg_info->x_status, stream, header,
-                                 x_status_buf, sizeof(x_status_buf),
-                                 "X-Status: ")) {
-        g_string_free(header, TRUE);
-        return FALSE;
+                                x_status_buf, sizeof(x_status_buf),
+                                "X-Status: ")) {
+       g_string_free(header, TRUE);
+       return FALSE;
     }
 
     g_string_free(header, TRUE);
 
     /* Both headers are OK to rewrite, if they exist. */
     if (msg_info->status >= 0) {
-        g_mime_stream_seek(stream, msg_info->status, GMIME_STREAM_SEEK_SET);
-        g_mime_stream_write(stream, status_buf, sizeof(status_buf));
+       g_mime_stream_seek(stream, msg_info->status, GMIME_STREAM_SEEK_SET);
+       g_mime_stream_write(stream, status_buf, sizeof(status_buf));
     }
     if (msg_info->x_status >= 0) {
-        g_mime_stream_seek(stream, msg_info->x_status, GMIME_STREAM_SEEK_SET);
-        g_mime_stream_write(stream, x_status_buf, sizeof(x_status_buf));
+       g_mime_stream_seek(stream, msg_info->x_status, GMIME_STREAM_SEEK_SET);
+       g_mime_stream_write(stream, x_status_buf, sizeof(x_status_buf));
     }
     msg_info->orig_flags = REAL_FLAGS(msg_info->local_info.flags);
     return TRUE;
 }
 
-
 /* Length of the line beginning at offset, including trailing '\n'.
  * Returns -1 if no '\n' found, or if seek to offset fails. */
 static gint
-lbm_mbox_line_len(LibBalsaMailboxMbox *mbox,
-                  off_t                offset)
+lbm_mbox_line_len(LibBalsaMailboxMbox * mbox, off_t offset)
 {
     GMimeStream *stream = mbox->gmime_stream;
     gint retval = -1;
@@ -1472,17 +1348,16 @@ lbm_mbox_line_len(LibBalsaMailboxMbox *mbox,
             gchar buf[80];
 
             len = g_mime_stream_read(stream, buf, sizeof buf);
-            if (len <= 0) {
+            if (len <= 0)
                 break;
-            }
 
             i = 0;
-            do {
+            do
                 if (buf[i++] == '\n') {
                     retval = old + i;
                     break;
                 }
-            } while (i < len);
+            while (i < len);
             old += len;
         }
     }
@@ -1491,19 +1366,15 @@ lbm_mbox_line_len(LibBalsaMailboxMbox *mbox,
     return retval;
 }
 
-
 static gboolean
-lbm_mbox_copy_stream(LibBalsaMailboxMbox *mbox,
-                     off_t                start,
-                     off_t                end,
-                     GMimeStream         *dest)
+lbm_mbox_copy_stream(LibBalsaMailboxMbox * mbox, off_t start, off_t end,
+                    GMimeStream * dest)
 {
     GMimeStream *substream;
     gboolean retval;
 
-    if (start >= end) {
-        return TRUE;
-    }
+    if (start >= end)
+       return TRUE;
 
     substream = g_mime_stream_substream(mbox->gmime_stream, start, end);
     libbalsa_mime_stream_shared_lock(substream);
@@ -1514,44 +1385,37 @@ lbm_mbox_copy_stream(LibBalsaMailboxMbox *mbox,
     return retval;
 }
 
-
 /* Write a (X-)Status header to the stream. */
 static gboolean
-lbm_mbox_write_status_hdr(GMimeStream        *stream,
-                          LibBalsaMessageFlag flags)
+lbm_mbox_write_status_hdr(GMimeStream * stream, LibBalsaMessageFlag flags)
 {
     gboolean retval;
     GString *header = g_string_new("Status: ");
     lbm_mbox_status_hdr(flags, header->len + 2, header);
     g_string_append_c(header, '\n');
     retval = g_mime_stream_write(stream, header->str,
-                                 header->len) == (gint) header->len;
+                                header->len) == (gint) header->len;
     g_string_free(header, TRUE);
     return retval;
 }
 
-
 static gboolean
-lbm_mbox_write_x_status_hdr(GMimeStream        *stream,
-                            LibBalsaMessageFlag flags)
+lbm_mbox_write_x_status_hdr(GMimeStream * stream, LibBalsaMessageFlag flags)
 {
     gboolean retval;
     GString *header = g_string_new("X-Status: ");
     lbm_mbox_x_status_hdr(flags, header->len + 3, header);
     g_string_append_c(header, '\n');
     retval = g_mime_stream_write(stream, header->str,
-                                 header->len) == (gint) header->len;
+                                header->len) == (gint) header->len;
     g_string_free(header, TRUE);
     return retval;
 }
 
-
-static void update_message_status_headers(GMimeMessage       *message,
-                                          LibBalsaMessageFlag flags);
-
+static void update_message_status_headers(GMimeMessage *message,
+                                         LibBalsaMessageFlag flags);
 static gboolean
-libbalsa_mailbox_mbox_sync(LibBalsaMailbox *mailbox,
-                           gboolean         expunge)
+libbalsa_mailbox_mbox_sync(LibBalsaMailbox * mailbox, gboolean expunge)
 {
     const gchar *path;
     struct stat st;
@@ -1577,23 +1441,21 @@ libbalsa_mailbox_mbox_sync(LibBalsaMailbox *mailbox,
      */
     libbalsa_mailbox_mbox_check(mailbox);
     mbox = LIBBALSA_MAILBOX_MBOX(mailbox);
-    if (mbox->msgno_2_msg_info->len == 0) {
-        return TRUE;
-    }
+    if (mbox->msgno_2_msg_info->len == 0)
+       return TRUE;
     mbox_stream = mbox->gmime_stream;
 
     path = libbalsa_mailbox_local_get_path(mailbox);
 
     /* lock mailbox file */
-    if (mbox_lock(mailbox, mbox_stream) != 0) {
-        return FALSE;
-    }
+    if (mbox_lock(mailbox, mbox_stream) != 0)
+       return FALSE;
 
     /* Check to make sure that the file hasn't changed on disk */
-    if ((fstat(GMIME_STREAM_FS(mbox_stream)->fd, &st) != 0)
-        || (st.st_size != mbox->size)) {
-        mbox_unlock(mailbox, mbox_stream);
-        return FALSE;
+    if (fstat(GMIME_STREAM_FS(mbox_stream)->fd, &st) != 0
+        || st.st_size != mbox->size) {
+       mbox_unlock(mailbox, mbox_stream);
+       return FALSE;
     }
 
     /* Find where we need to start rewriting the mailbox.  We save a lot
@@ -1605,283 +1467,266 @@ libbalsa_mailbox_mbox_sync(LibBalsaMailbox *mailbox,
      */
     messages = mbox->msgno_2_msg_info->len;
     first = -1;
-    for (i = j = 0; i < messages; i++) {
-        msg_info = message_info_from_msgno(mbox, i + 1);
-        if (mailbox->state == LB_MAILBOX_STATE_CLOSING) {
-            msg_info->local_info.flags &= ~LIBBALSA_MESSAGE_FLAG_RECENT;
-        }
-        if (expunge && (msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_DELETED)) {
-            break;
-        }
-        if ((first < 0) && ((msg_info->status < 0) || (msg_info->x_status < 0))) {
-            first = i;
-        }
+    for (i = j = 0; i < messages; i++)
+    {
+       msg_info = message_info_from_msgno(mbox, i + 1);
+       if (mailbox->state == LB_MAILBOX_STATE_CLOSING)
+           msg_info->local_info.flags &= ~LIBBALSA_MESSAGE_FLAG_RECENT;
+       if (expunge && (msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_DELETED))
+           break;
+       if (first < 0 && (msg_info->status < 0 || msg_info->x_status < 0))
+           first = i;
         if (FLAGS_REALLY_DIFFER(msg_info->orig_flags,
                                 msg_info->local_info.flags)) {
-            gboolean can_rewrite_in_place;
-
-            libbalsa_mime_stream_shared_lock(mbox_stream);
-            can_rewrite_in_place =
-                lbm_mbox_rewrite_in_place(msg_info, mbox_stream);
-            libbalsa_mime_stream_shared_unlock(mbox_stream);
-            if (!can_rewrite_in_place) {
-                break;
-            }
+           gboolean can_rewrite_in_place;
+
+           libbalsa_mime_stream_shared_lock(mbox_stream);
+           can_rewrite_in_place =
+               lbm_mbox_rewrite_in_place(msg_info, mbox_stream);
+           libbalsa_mime_stream_shared_unlock(mbox_stream);
+           if (!can_rewrite_in_place)
+               break;
             mbox->messages_info_changed = TRUE;
-            ++j;
-        }
+           ++j;
+       }
     }
     if (i >= messages) {
-        if (j > 0) {
-            struct utimbuf utimebuf;
-            /* Restore the previous access/modification times */
-            utimebuf.actime = st.st_atime;
-            utimebuf.modtime = st.st_mtime;
-            utime(path, &utimebuf);
-        }
-        if (g_mime_stream_flush(mbox_stream) < 0) {
-            g_warning("can't flush mailbox stream\n");
-        }
-        if (fstat(GMIME_STREAM_FS(mbox_stream)->fd, &st)) {
-            g_warning("can't stat “%s”", path);
-        } else {
+       if (j > 0) {
+           struct utimbuf utimebuf;
+           /* Restore the previous access/modification times */
+           utimebuf.actime = st.st_atime;
+           utimebuf.modtime = st.st_mtime;
+           utime(path, &utimebuf);
+       }
+       if (g_mime_stream_flush(mbox_stream) < 0)
+           g_warning("can't flush mailbox stream\n");
+       if (fstat(GMIME_STREAM_FS(mbox_stream)->fd, &st))
+           g_warning("can't stat “%s”", path);
+       else
             libbalsa_mailbox_set_mtime(mailbox, st.st_mtime);
-        }
         lbm_mbox_save(mbox);
-        mbox_unlock(mailbox, mbox_stream);
-        return TRUE;
+       mbox_unlock(mailbox, mbox_stream);
+       return TRUE;
     }
 
     /* save the index of the first changed/deleted message */
-    if (first < 0) {
-        first = i;
-    }
+    if (first < 0)
+       first = i; 
     /* where to start overwriting */
     offset = message_info_from_msgno(mbox, first + 1)->start;
 
     /* Create a temporary file to write the new version of the mailbox in. */
     i = g_file_open_tmp("balsa-tmp-mbox-XXXXXX", &tempfile, &error);
-    if (i == -1) {
-        g_warning("Could not create temporary file: %s", error->message);
-        g_error_free (error);
-        mbox_unlock(mailbox, mbox_stream);
-        return FALSE;
+    if (i == -1)
+    {
+       g_warning("Could not create temporary file: %s", error->message);
+       g_error_free (error);
+       mbox_unlock(mailbox, mbox_stream);
+       return FALSE;
     }
     temp_stream = g_mime_stream_fs_new(i);
 
     for (i = first; i < messages; i++) {
-        gint status_len, x_status_len;
+       gint status_len, x_status_len;
 
-        msg_info = message_info_from_msgno(mbox, i + 1);
-        if (expunge && (msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_DELETED)) {
-            continue;
-        }
+       msg_info = message_info_from_msgno(mbox, i + 1);
+       if (expunge && (msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_DELETED))
+           continue;
 
-        if (msg_info->status >= 0) {
-            status_len = lbm_mbox_line_len(mbox, msg_info->status);
-            if (status_len < 0) {
-                break;
-            }
-        } else {
+       if (msg_info->status >= 0) {
+           status_len = lbm_mbox_line_len(mbox, msg_info->status);
+           if (status_len < 0)
+               break;
+       } else {
             msg_info->status = msg_info->mime_version >= 0 ?
-                msg_info->mime_version :
+               msg_info->mime_version :
                 (off_t) (msg_info->start + msg_info->from_len);
-
-            status_len = 0;
-        }
-
-        if (msg_info->x_status >= 0) {
-            x_status_len = lbm_mbox_line_len(mbox, msg_info->x_status);
-            if (x_status_len < 0) {
-                break;
-            }
-        } else {
-            msg_info->x_status = msg_info->status;
-            x_status_len = 0;
-        }
-
-        if (msg_info->status <= msg_info->x_status) {
-            if (!lbm_mbox_copy_stream(mbox, msg_info->start,
-                                      msg_info->status, temp_stream)
-                || !lbm_mbox_write_status_hdr(temp_stream, msg_info->local_info.flags)
-                || !lbm_mbox_copy_stream(mbox,
-                                         msg_info->status + status_len,
-                                         msg_info->x_status, temp_stream)
-                || !lbm_mbox_write_x_status_hdr(temp_stream,
-                                                msg_info->local_info.flags)
-                || !lbm_mbox_copy_stream(mbox,
-                                         msg_info->x_status +
-                                         x_status_len, msg_info->end,
-                                         temp_stream)) {
-                break;
-            }
-        } else {
-            if (!lbm_mbox_copy_stream(mbox, msg_info->start,
-                                      msg_info->x_status, temp_stream)
-                || !lbm_mbox_write_x_status_hdr(temp_stream,
-                                                msg_info->local_info.flags)
-                || !lbm_mbox_copy_stream(mbox,
-                                         msg_info->x_status +
-                                         x_status_len,
-                                         msg_info->status, temp_stream)
-                || !lbm_mbox_write_status_hdr(temp_stream, msg_info->local_info.flags)
-                || !lbm_mbox_copy_stream(mbox,
-                                         msg_info->status + status_len,
-                                         msg_info->end, temp_stream)) {
-                break;
-            }
-        }
+           
+           status_len = 0;
+       }
+
+       if (msg_info->x_status >= 0) {
+           x_status_len = lbm_mbox_line_len(mbox, msg_info->x_status);
+           if (x_status_len < 0)
+               break;
+       } else {
+           msg_info->x_status = msg_info->status;
+           x_status_len = 0;
+       }
+
+       if (msg_info->status <= msg_info->x_status) {
+           if (!lbm_mbox_copy_stream(mbox, msg_info->start,
+                                     msg_info->status, temp_stream)
+               || !lbm_mbox_write_status_hdr(temp_stream, msg_info->local_info.flags)
+               || !lbm_mbox_copy_stream(mbox,
+                                        msg_info->status + status_len,
+                                        msg_info->x_status, temp_stream)
+               || !lbm_mbox_write_x_status_hdr(temp_stream,
+                                               msg_info->local_info.flags)
+               || !lbm_mbox_copy_stream(mbox,
+                                        msg_info->x_status +
+                                        x_status_len, msg_info->end,
+                                        temp_stream))
+               break;
+       } else {
+           if (!lbm_mbox_copy_stream(mbox, msg_info->start,
+                                     msg_info->x_status, temp_stream)
+               || !lbm_mbox_write_x_status_hdr(temp_stream,
+                                               msg_info->local_info.flags)
+               || !lbm_mbox_copy_stream(mbox,
+                                        msg_info->x_status +
+                                        x_status_len,
+                                        msg_info->status, temp_stream)
+               || !lbm_mbox_write_status_hdr(temp_stream, msg_info->local_info.flags)
+               || !lbm_mbox_copy_stream(mbox,
+                                        msg_info->status + status_len,
+                                        msg_info->end, temp_stream))
+               break;
+       }
     }
 
     if (i < messages) {
-        /* We broke on an error. */
-        g_warning("error making temporary copy\n");
-        g_object_unref(temp_stream);
-        unlink(tempfile);
-        g_free(tempfile);
-        mbox_unlock(mailbox, mbox_stream);
-        return FALSE;
+       /* We broke on an error. */
+       g_warning("error making temporary copy\n");
+       g_object_unref(temp_stream);
+       unlink(tempfile);
+       g_free(tempfile);
+       mbox_unlock(mailbox, mbox_stream);
+       return FALSE;
     }
 
     g_mime_stream_set_bounds(mbox_stream, 0, -1);
-    if (g_mime_stream_flush(temp_stream) == -1) {
-        g_warning("can't flush temporary copy\n");
-        g_object_unref(temp_stream);
-        unlink(tempfile);
-        g_free(tempfile);
-        mbox_unlock(mailbox, mbox_stream);
-        return FALSE;
+    if (g_mime_stream_flush(temp_stream) == -1)
+    {
+       g_warning("can't flush temporary copy\n");
+       g_object_unref(temp_stream);
+       unlink(tempfile);
+       g_free(tempfile);
+       mbox_unlock(mailbox, mbox_stream);
+       return FALSE;
     }
 
     save_failed = TRUE;
     libbalsa_mime_stream_shared_lock(mbox_stream);
     if (g_mime_stream_reset(temp_stream) == -1) {
         g_warning("mbox_sync: can't rewind temporary copy.\n");
-    } else if (!lbm_mbox_stream_seek_to_message(mbox_stream, offset)) {
+    } else if (!lbm_mbox_stream_seek_to_message(mbox_stream, offset))
         g_warning("mbox_sync: message not in expected position.\n");
-    } else if (g_mime_stream_write_to_stream(temp_stream, mbox_stream) != -1) {
+    else if (g_mime_stream_write_to_stream(temp_stream, mbox_stream) != -1) {
         mbox->size = g_mime_stream_tell(mbox_stream);
 #if DEBUG_SEEK
         g_print("%s %s set size from tell %d\n", __func__, mailbox->name,
                 mbox->size);
 #endif
-        if (ftruncate(GMIME_STREAM_FS(mbox_stream)->fd, mbox->size) == 0) {
+        if (ftruncate(GMIME_STREAM_FS(mbox_stream)->fd, mbox->size) == 0)
             save_failed = FALSE;
-        }
     }
     g_object_unref(temp_stream);
     mbox_unlock(mailbox, mbox_stream);
-    if (g_mime_stream_flush(mbox_stream) == -1) {
+    if (g_mime_stream_flush(mbox_stream) == -1)
         save_failed = TRUE;
-    }
     libbalsa_mime_stream_shared_unlock(mbox_stream);
     if (save_failed) {
-        /*
-         * error occurred while writing the mailbox back,
-         * so keep the temp copy around
-         */
-        char *savefile;
-        {
-            gchar *foo = g_path_get_basename(path);
-            savefile = g_strdup_printf ("%s/saved-mbox.%s-%s-%d", g_get_tmp_dir(),
-                                        g_get_user_name(), foo, getpid ());
-            g_free(foo);
-        }
-        rename (tempfile, savefile);
-        g_warning("Write failed!  Saved partial mailbox to %s", savefile);
-        g_free(savefile);
-        g_free(tempfile);
-        return FALSE;
+       /*
+        * error occurred while writing the mailbox back,
+        * so keep the temp copy around
+        */
+       char *savefile;
+       {
+           gchar *foo = g_path_get_basename(path);
+           savefile = g_strdup_printf ("%s/saved-mbox.%s-%s-%d", g_get_tmp_dir(),
+                        g_get_user_name(), foo, getpid ());
+           g_free(foo);
+       }
+       rename (tempfile, savefile);
+       g_warning("Write failed!  Saved partial mailbox to %s", savefile);
+       g_free(savefile);
+       g_free(tempfile);
+       return FALSE;
     }
 
     {
-        struct utimbuf utimebuf;
-        /* Restore the previous access/modification times */
-        utimebuf.actime = st.st_atime;
-        utimebuf.modtime = st.st_mtime;
-        utime (path, &utimebuf);
+       struct utimbuf utimebuf;
+       /* Restore the previous access/modification times */
+       utimebuf.actime = st.st_atime;
+       utimebuf.modtime = st.st_mtime;
+       utime (path, &utimebuf);
     }
 
     unlink(tempfile); /* remove partial copy of the mailbox */
     g_free(tempfile);
 
     if (mailbox->state == LB_MAILBOX_STATE_CLOSING) {
-        /* Just shorten the msg_info array. */
-        for (j = first; j < mbox->msgno_2_msg_info->len; ) {
-            msg_info = message_info_from_msgno(mbox, j + 1);
-            if (expunge &&
-                (msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_DELETED)) {
-                libbalsa_mailbox_local_msgno_removed(mailbox, j + 1);
-                free_message_info(msg_info);
-                g_ptr_array_remove_index(mbox->msgno_2_msg_info, j);
+       /* Just shorten the msg_info array. */
+       for (j = first; j < mbox->msgno_2_msg_info->len; ) {
+           msg_info = message_info_from_msgno(mbox, j + 1);
+           if (expunge &&
+               (msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_DELETED)) {
+               libbalsa_mailbox_local_msgno_removed(mailbox, j + 1);
+               free_message_info(msg_info);
+               g_ptr_array_remove_index(mbox->msgno_2_msg_info, j);
                 mbox->messages_info_changed = TRUE;
-            } else {
-                j++;
-            }
-        }
+           } else
+               j++;
+       }
         lbm_mbox_save(mbox);
-        return TRUE;
+       return TRUE;
     }
 
     /* update the rewritten messages */
     libbalsa_mime_stream_shared_lock(mbox_stream);
     if (g_mime_stream_seek(mbox_stream, offset, GMIME_STREAM_SEEK_SET)
-        == -1) {
-        g_warning("Can't update message info");
-        libbalsa_mime_stream_shared_unlock(mbox_stream);
-        return FALSE;
+       == -1) {
+       g_warning("Can't update message info");
+       libbalsa_mime_stream_shared_unlock(mbox_stream);
+       return FALSE;
     }
     gmime_parser = g_mime_parser_new_with_stream(mbox_stream);
     g_mime_parser_set_scan_from(gmime_parser, TRUE);
     g_mime_parser_set_respect_content_length(gmime_parser, TRUE);
     g_mime_parser_set_header_regex(gmime_parser,
                                    "^Status|^X-Status|^MIME-Version",
-                                   lbm_mbox_header_cb, &msg_info);
+                                  lbm_mbox_header_cb, &msg_info);
     for (j = first; j < mbox->msgno_2_msg_info->len; ) {
-        GMimeMessage *mime_msg;
+       GMimeMessage *mime_msg;
         gchar *from;
 
-        msg_info = message_info_from_msgno(mbox, j + 1);
-        if (expunge && (msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_DELETED)) {
-            /* We must drop the mime-stream lock to call
-             * libbalsa_mailbox_local_msgno_removed(), as it will grab
-             * the gdk lock to emit gtk signals; we save and restore the
-             * current file position, in case someone changes it while
-             * we're not holding the lock. */
-            offset = g_mime_stream_tell(mbox_stream);
-            libbalsa_mime_stream_shared_unlock(mbox_stream);
-            libbalsa_mailbox_local_msgno_removed(mailbox, j + 1);
-            libbalsa_mime_stream_shared_lock(mbox_stream);
-            g_mime_stream_seek(mbox_stream, offset, GMIME_STREAM_SEEK_SET);
-            free_message_info(msg_info);
-            g_ptr_array_remove_index(mbox->msgno_2_msg_info, j);
+       msg_info = message_info_from_msgno(mbox, j + 1);
+       if (expunge && (msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_DELETED)) {
+           /* We must drop the mime-stream lock to call
+            * libbalsa_mailbox_local_msgno_removed(), as it will grab
+            * the gdk lock to emit gtk signals; we save and restore the
+            * current file position, in case someone changes it while
+            * we're not holding the lock. */
+           offset = g_mime_stream_tell(mbox_stream);
+           libbalsa_mime_stream_shared_unlock(mbox_stream);
+           libbalsa_mailbox_local_msgno_removed(mailbox, j + 1);
+           libbalsa_mime_stream_shared_lock(mbox_stream);
+           g_mime_stream_seek(mbox_stream, offset, GMIME_STREAM_SEEK_SET);
+           free_message_info(msg_info);
+           g_ptr_array_remove_index(mbox->msgno_2_msg_info, j);
             mbox->messages_info_changed = TRUE;
-            continue;
-        }
-        if (msg_info->local_info.message) {
-            msg_info->local_info.message->msgno = j + 1;
-        }
-
-        msg_info->status = msg_info->x_status = msg_info->mime_version = -1;
-        mime_msg = g_mime_parser_construct_message(gmime_parser);
-        if (!mime_msg) {
+           continue;
+       }
+       if (msg_info->local_info.message)
+           msg_info->local_info.message->msgno = j + 1;
+
+       msg_info->status = msg_info->x_status = msg_info->mime_version = -1;
+       mime_msg = g_mime_parser_construct_message(gmime_parser);
+        if (!mime_msg)
             /* Try to recover */
             continue;
-        }
         msg_info->start = g_mime_parser_get_from_offset(gmime_parser);
 
-        /* Make sure we don't have offsets for any encapsulated headers. */
-        if (!g_mime_object_get_header(GMIME_OBJECT(mime_msg), "Status")) {
-            msg_info->status = -1;
-        }
-        if (!g_mime_object_get_header(GMIME_OBJECT(mime_msg), "X-Status")) {
-            msg_info->x_status = -1;
-        }
-        if (!g_mime_object_get_header(GMIME_OBJECT(mime_msg), "MIME-Version")) {
-            msg_info->mime_version = -1;
-        }
+       /* Make sure we don't have offsets for any encapsulated headers. */
+       if (!g_mime_object_get_header(GMIME_OBJECT(mime_msg), "Status"))
+           msg_info->status = -1;
+       if (!g_mime_object_get_header(GMIME_OBJECT(mime_msg), "X-Status"))
+           msg_info->x_status = -1;
+       if (!g_mime_object_get_header(GMIME_OBJECT(mime_msg), "MIME-Version"))
+           msg_info->mime_version = -1;
 
-        from = g_mime_parser_get_from(gmime_parser);
+       from = g_mime_parser_get_from(gmime_parser);
         if (!from) {
             /* Try to recover */
             g_object_unref(mime_msg);
@@ -1890,22 +1735,22 @@ libbalsa_mailbox_mbox_sync(LibBalsaMailbox *mailbox,
 
         msg_info->from_len = strlen(from) + 1;
         g_free(from);
-        msg_info->end = g_mime_parser_tell(gmime_parser);
-        msg_info->orig_flags = REAL_FLAGS(msg_info->local_info.flags);
-        g_assert(mime_msg->mime_part != NULL);
-        if (!msg_info->local_info.message || !msg_info->local_info.message->mime_msg) {
-            g_object_unref(mime_msg);
-        } else {
-            g_object_unref(msg_info->local_info.message->mime_msg);
-            msg_info->local_info.message->mime_msg = mime_msg;
-            /*
-             * reinit the message parts info
-             */
-            libbalsa_message_body_set_mime_body(msg_info->local_info.message->body_list,
-                                                mime_msg->mime_part);
-        }
-
-        j++;
+       msg_info->end = g_mime_parser_tell(gmime_parser);
+       msg_info->orig_flags = REAL_FLAGS(msg_info->local_info.flags);
+       g_assert(mime_msg->mime_part != NULL);
+       if (!msg_info->local_info.message || !msg_info->local_info.message->mime_msg)
+           g_object_unref(mime_msg);
+       else {
+           g_object_unref(msg_info->local_info.message->mime_msg);
+           msg_info->local_info.message->mime_msg = mime_msg;
+           /*
+            * reinit the message parts info
+            */
+           libbalsa_message_body_set_mime_body(msg_info->local_info.message->body_list,
+                                               mime_msg->mime_part);
+       }
+
+       j++;
     }
     libbalsa_mime_stream_shared_unlock(mbox_stream);
     mbox->msgno_2_msg_info->len = j;
@@ -1915,10 +1760,8 @@ libbalsa_mailbox_mbox_sync(LibBalsaMailbox *mailbox,
     return TRUE;
 }
 
-
 static LibBalsaMailboxLocalMessageInfo *
-lbm_mbox_get_info(LibBalsaMailboxLocal *local,
-                  guint                 msgno)
+lbm_mbox_get_info(LibBalsaMailboxLocal * local, guint msgno)
 {
     LibBalsaMailboxMbox *mbox = LIBBALSA_MAILBOX_MBOX(local);
     struct message_info *msg_info = message_info_from_msgno(mbox, msgno);
@@ -1926,21 +1769,18 @@ lbm_mbox_get_info(LibBalsaMailboxLocal *local,
     return &msg_info->local_info;
 }
 
-
 static gboolean
-libbalsa_mailbox_mbox_fetch_message_structure(LibBalsaMailbox  *mailbox,
-                                              LibBalsaMessage  *message,
-                                              LibBalsaFetchFlag flags)
+libbalsa_mailbox_mbox_fetch_message_structure(LibBalsaMailbox * mailbox,
+                                             LibBalsaMessage * message,
+                                             LibBalsaFetchFlag flags)
 {
-    if (!message->mime_msg) {
-        message->mime_msg = lbm_mbox_get_mime_message(mailbox, message->msgno);
-    }
+    if (!message->mime_msg)
+       message->mime_msg = lbm_mbox_get_mime_message(mailbox, message->msgno);
 
     return LIBBALSA_MAILBOX_CLASS(parent_class)->
-           fetch_message_structure(mailbox, message, flags);
+        fetch_message_structure(mailbox, message, flags);
 }
 
-
 /* Create the LibBalsaMessage and call libbalsa_message_init_from_gmime
  * to populate the headers we need for the display:
  *   headers->from
@@ -1955,8 +1795,8 @@ libbalsa_mailbox_mbox_fetch_message_structure(LibBalsaMailbox  *mailbox,
  *   in_reply_to
  */
 static LibBalsaMessage *
-lbm_mbox_message_new(GMimeMessage        *mime_message,
-                     struct message_info *msg_info)
+lbm_mbox_message_new(GMimeMessage * mime_message,
+                    struct message_info *msg_info)
 {
     LibBalsaMessage *message;
     const char *header;
@@ -1964,9 +1804,9 @@ lbm_mbox_message_new(GMimeMessage        *mime_message,
 
 #if defined(THIS_HAS_BEEN_TESTED)
     if (mime_message->subject &&
-        !strcmp(mime_message->subject,
-                "DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA")) {
-        return NULL;
+       !strcmp(mime_message->subject,
+               "DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA")) {
+       return NULL;
     }
 #endif
 
@@ -1974,29 +1814,22 @@ lbm_mbox_message_new(GMimeMessage        *mime_message,
 
     header = g_mime_object_get_header (GMIME_OBJECT(mime_message), "Status");
     if (header) {
-        if (strchr(header, 'R') == NULL) { /* not found == not READ */
-            flags |= LIBBALSA_MESSAGE_FLAG_NEW;
-        }
-        if (strchr(header, 'r') != NULL) { /* found == REPLIED */
-            flags |= LIBBALSA_MESSAGE_FLAG_REPLIED;
-        }
-        if (strchr(header, 'O') == NULL) { /* not found == RECENT */
-            flags |= LIBBALSA_MESSAGE_FLAG_RECENT;
-        }
-    } else {
-        flags |= LIBBALSA_MESSAGE_FLAG_NEW | LIBBALSA_MESSAGE_FLAG_RECENT;
-    }
+       if (strchr(header, 'R') == NULL) /* not found == not READ */
+           flags |= LIBBALSA_MESSAGE_FLAG_NEW;
+       if (strchr(header, 'r') != NULL) /* found == REPLIED */
+           flags |= LIBBALSA_MESSAGE_FLAG_REPLIED;
+       if (strchr(header, 'O') == NULL) /* not found == RECENT */
+           flags |= LIBBALSA_MESSAGE_FLAG_RECENT;
+    } else
+           flags |= LIBBALSA_MESSAGE_FLAG_NEW |  LIBBALSA_MESSAGE_FLAG_RECENT;
     header = g_mime_object_get_header (GMIME_OBJECT(mime_message), "X-Status");
     if (header) {
-        if (strchr(header, 'D') != NULL) { /* found == DELETED */
-            flags |= LIBBALSA_MESSAGE_FLAG_DELETED;
-        }
-        if (strchr(header, 'F') != NULL) { /* found == FLAGGED */
-            flags |= LIBBALSA_MESSAGE_FLAG_FLAGGED;
-        }
-        if (strchr(header, 'A') != NULL) { /* found == REPLIED */
-            flags |= LIBBALSA_MESSAGE_FLAG_REPLIED;
-        }
+       if (strchr(header, 'D') != NULL) /* found == DELETED */
+           flags |= LIBBALSA_MESSAGE_FLAG_DELETED;
+       if (strchr(header, 'F') != NULL) /* found == FLAGGED */
+           flags |= LIBBALSA_MESSAGE_FLAG_FLAGGED;
+       if (strchr(header, 'A') != NULL) /* found == REPLIED */
+           flags |= LIBBALSA_MESSAGE_FLAG_REPLIED;
     }
     msg_info->orig_flags = flags;
 
@@ -2005,10 +1838,8 @@ lbm_mbox_message_new(GMimeMessage        *mime_message,
     return message;
 }
 
-
-static void
-update_message_status_headers(GMimeMessage       *message,
-                              LibBalsaMessageFlag flags)
+static void update_message_status_headers(GMimeMessage *message,
+                                         LibBalsaMessageFlag flags)
 {
     GString *new_header = g_string_new(NULL);
 
@@ -2024,7 +1855,7 @@ update_message_status_headers(GMimeMessage       *message,
 
 
 static GMimeObject *
-lbm_mbox_armored_object(GMimeStream *stream)
+lbm_mbox_armored_object(GMimeStream * stream)
 {
     GMimeParser *parser;
     GMimeObject *object;
@@ -2037,17 +1868,16 @@ lbm_mbox_armored_object(GMimeStream *stream)
     return object;
 }
 
-
 static GMimeStream *
-lbm_mbox_armored_stream(GMimeStream *stream)
+lbm_mbox_armored_stream(GMimeStream * stream)
 {
     GMimeStream *fstream;
     GMimeFilter *filter;
-
+    
     fstream = g_mime_stream_filter_new(stream);
 
     filter = g_mime_filter_crlf_new(FALSE,
-                                    FALSE);
+                                   FALSE);
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(fstream), filter);
     g_object_unref(filter);
 
@@ -2058,13 +1888,12 @@ lbm_mbox_armored_stream(GMimeStream *stream)
     return fstream;
 }
 
-
 /* Called with mailbox locked. */
 static gboolean
-lbm_mbox_add_message(LibBalsaMailboxLocal *local,
-                     GMimeStream          *stream,
-                     LibBalsaMessageFlag   flags,
-                     GError              **err)
+lbm_mbox_add_message(LibBalsaMailboxLocal * local,
+                     GMimeStream          * stream,
+                     LibBalsaMessageFlag    flags,
+                     GError              ** err)
 {
     LibBalsaMailbox *mailbox = (LibBalsaMailbox *) local;
     LibBalsaMessage *message;
@@ -2087,25 +1916,24 @@ lbm_mbox_add_message(LibBalsaMailboxLocal *local,
     ctime_r(&(message->headers->date), date_string);
 
     sender = message->headers->from ?
-        internet_address_list_to_string(message->headers->from, FALSE) :
-        g_strdup("none");
+       internet_address_list_to_string(message->headers->from, FALSE) :
+       g_strdup("none");
 
     g_object_unref(message);
 
-    if ((brack = strrchr( sender, '<' ))) {
-        gchar *a = strrchr ( brack, '>' );
-        if (a) {
+    if ( (brack = strrchr( sender, '<' )) ) {
+        gchar * a = strrchr ( brack , '>' );
+        if (a)
             address = g_strndup(brack + 1, a - brack - 1);
-        } else {
+        else
             address = g_strdup("none");
-        }
-        g_free(sender);
+       g_free(sender);
     } else {
         address = sender;
     }
     from = g_strdup_printf ("From %s %s", address, date_string );
     g_free(address);
-
+    
     path = libbalsa_mailbox_local_get_path(local);
     /* open in read-write mode */
     fd = open(path, O_RDWR);
@@ -2116,26 +1944,26 @@ lbm_mbox_add_message(LibBalsaMailboxLocal *local,
         g_free(from);
         return FALSE;
     }
-
+    
     orig_length = lseek (fd, 0, SEEK_END);
     lseek (fd, 0, SEEK_SET);
     dest = g_mime_stream_fs_new (fd);
     if (!dest) {
-        g_free(from);
+       g_free(from);
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_APPEND_ERROR,
                     _("%s: could not get new MIME stream."),
                     "MBOX");
-        return FALSE;
+       return FALSE;
     }
-    if ((orig_length > 0) && !lbm_mbox_stream_seek_to_message(dest, 0)) {
-        g_object_unref(dest);
+    if (orig_length > 0 && !lbm_mbox_stream_seek_to_message(dest, 0)) {
+       g_object_unref(dest);
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_APPEND_ERROR,
                     _("%s: %s is not in mbox format."),
                     "MBOX", path);
-        g_free(from);
-        return FALSE;
+       g_free(from);
+       return FALSE;
     }
     mbox_lock ( mailbox, dest );
 
@@ -2150,50 +1978,44 @@ lbm_mbox_add_message(LibBalsaMailboxLocal *local,
     armored_dest = lbm_mbox_armored_stream(dest);
 
     retval = g_mime_stream_seek(dest, 0, GMIME_STREAM_SEEK_END);
-    if (retval > 0) {
+    if (retval > 0)
         retval = lbm_mbox_newline(dest);
-    }
-    if ((retval < 0)
-        || (g_mime_stream_write_string(dest, from) < (gint) strlen(from))
-        || (g_mime_object_write_to_stream(armored_object, armored_dest) < 0)) {
+    if (retval < 0
+        || g_mime_stream_write_string(dest, from) < (gint) strlen(from)
+       || g_mime_object_write_to_stream(armored_object, armored_dest) < 0) {
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_APPEND_ERROR, _("Data copy error"));
-        retval = -1;
+       retval = -1;
     }
     g_free(from);
     g_object_unref(armored_object);
     libbalsa_mime_stream_shared_unlock(stream);
     g_object_unref(armored_dest);
 
-    if ((retval < 0) && (truncate(path, orig_length) < 0)) {
+    if (retval < 0 && truncate(path, orig_length) < 0)
         retval = -2;
-    }
     mbox_unlock (mailbox, dest);
     g_object_unref(dest);
 
     return retval >= 0;
 }
 
-
 static guint
-libbalsa_mailbox_mbox_total_messages(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_mbox_total_messages(LibBalsaMailbox * mailbox)
 {
     LibBalsaMailboxMbox *mbox = (LibBalsaMailboxMbox *) mailbox;
 
     return mbox->msgno_2_msg_info ? mbox->msgno_2_msg_info->len : 0;
 }
 
-
 static void
-libbalsa_mailbox_mbox_lock_store(LibBalsaMailbox *mailbox,
-                                 gboolean         lock)
+libbalsa_mailbox_mbox_lock_store(LibBalsaMailbox * mailbox, gboolean lock)
 {
     LibBalsaMailboxMbox *mbox = (LibBalsaMailboxMbox *) mailbox;
     GMimeStream *stream = mbox->gmime_stream;
 
-    if (lock) {
+    if (lock)
         libbalsa_mime_stream_shared_lock(stream);
-    } else {
+    else
         libbalsa_mime_stream_shared_unlock(stream);
-    }
 }
diff --git a/libbalsa/mailbox_mbox.h b/libbalsa/mailbox_mbox.h
index 04fcd38..1aaaaa0 100644
--- a/libbalsa/mailbox_mbox.h
+++ b/libbalsa/mailbox_mbox.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -38,7 +38,6 @@ typedef struct _LibBalsaMailboxMbox LibBalsaMailboxMbox;
 typedef struct _LibBalsaMailboxMboxClass LibBalsaMailboxMboxClass;
 
 GType libbalsa_mailbox_mbox_get_type(void);
-LibBalsaMailbox *libbalsa_mailbox_mbox_new(const gchar *path,
-                                           gboolean     create);
-
+LibBalsaMailbox *libbalsa_mailbox_mbox_new(const gchar * path,
+                                           gboolean      create);
 #endif
diff --git a/libbalsa/mailbox_mh.c b/libbalsa/mailbox_mh.c
index 5fa3c32..4ed62f1 100644
--- a/libbalsa/mailbox_mh.c
+++ b/libbalsa/mailbox_mh.c
@@ -6,20 +6,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 /* to compile this on BSD/Darwin */
@@ -51,43 +51,40 @@ struct message_info {
 static LibBalsaMailboxLocalClass *parent_class = NULL;
 
 static void libbalsa_mailbox_mh_class_init(LibBalsaMailboxMhClass *klass);
-static void libbalsa_mailbox_mh_init(LibBalsaMailboxMh *mailbox);
-static void libbalsa_mailbox_mh_finalize(GObject *object);
-static void libbalsa_mailbox_mh_load_config(LibBalsaMailbox *mailbox,
-                                            const gchar     *prefix);
+static void libbalsa_mailbox_mh_init(LibBalsaMailboxMh * mailbox);
+static void libbalsa_mailbox_mh_finalize(GObject * object);
+static void libbalsa_mailbox_mh_load_config(LibBalsaMailbox * mailbox,
+                                            const gchar * prefix);
 
 static GMimeStream *libbalsa_mailbox_mh_get_message_stream(LibBalsaMailbox *
-                                                           mailbox,
-                                                           guint    msgno,
-                                                           gboolean peek);
-static gint lbm_mh_check_files(const gchar *path,
-                               gboolean     create);
-static void lbm_mh_set_path(LibBalsaMailboxLocal *mailbox,
-                            const gchar          *path);
+                                                          mailbox,
+                                                          guint msgno,
+                                                          gboolean peek);
+static gint lbm_mh_check_files(const gchar * path, gboolean create);
+static void lbm_mh_set_path(LibBalsaMailboxLocal * mailbox,
+                            const gchar * path);
 static void lbm_mh_remove_files(LibBalsaMailboxLocal *mailbox);
 static LibBalsaMailboxLocalMessageInfo
-*lbm_mh_get_info(LibBalsaMailboxLocal *local,
-                 guint                 msgno);
-
+    *lbm_mh_get_info(LibBalsaMailboxLocal * local, guint msgno);
 static LibBalsaMailboxLocalAddMessageFunc lbm_mh_add_message;
 
-static gboolean libbalsa_mailbox_mh_open(LibBalsaMailbox *mailbox,
-                                         GError         **err);
-static void libbalsa_mailbox_mh_close_mailbox(LibBalsaMailbox *mailbox,
-                                              gboolean         expunge);
-static void libbalsa_mailbox_mh_check(LibBalsaMailbox *mailbox);
-static gboolean libbalsa_mailbox_mh_sync(LibBalsaMailbox *mailbox,
-                                         gboolean         expunge);
+static gboolean libbalsa_mailbox_mh_open(LibBalsaMailbox * mailbox,
+                                        GError **err);
+static void libbalsa_mailbox_mh_close_mailbox(LibBalsaMailbox * mailbox,
+                                              gboolean expunge);
+static void libbalsa_mailbox_mh_check(LibBalsaMailbox * mailbox);
+static gboolean libbalsa_mailbox_mh_sync(LibBalsaMailbox * mailbox,
+                                         gboolean expunge);
 static struct message_info *lbm_mh_message_info_from_msgno(
-    LibBalsaMailboxMh *mailbox,
-    guint              msgno);
+                                                 LibBalsaMailboxMh * mailbox,
+                                                 guint msgno);
 static gboolean libbalsa_mailbox_mh_fetch_message_structure(LibBalsaMailbox
-                                                            *mailbox,
+                                                            * mailbox,
                                                             LibBalsaMessage
-                                                            *message,
+                                                            * message,
                                                             LibBalsaFetchFlag
                                                             flags);
-static guint libbalsa_mailbox_mh_total_messages(LibBalsaMailbox *mailbox);
+static guint libbalsa_mailbox_mh_total_messages(LibBalsaMailbox * mailbox);
 
 
 GType
@@ -96,30 +93,29 @@ libbalsa_mailbox_mh_get_type(void)
     static GType mailbox_type = 0;
 
     if (!mailbox_type) {
-        static const GTypeInfo mailbox_info = {
-            sizeof(LibBalsaMailboxMhClass),
+       static const GTypeInfo mailbox_info = {
+           sizeof(LibBalsaMailboxMhClass),
             NULL,               /* base_init */
             NULL,               /* base_finalize */
-            (GClassInitFunc) libbalsa_mailbox_mh_class_init,
+           (GClassInitFunc) libbalsa_mailbox_mh_class_init,
             NULL,               /* class_finalize */
             NULL,               /* class_data */
-            sizeof(LibBalsaMailboxMh),
+           sizeof(LibBalsaMailboxMh),
             0,                  /* n_preallocs */
-            (GInstanceInitFunc) libbalsa_mailbox_mh_init
-        };
+           (GInstanceInitFunc) libbalsa_mailbox_mh_init
+       };
 
-        mailbox_type =
-            g_type_register_static(LIBBALSA_TYPE_MAILBOX_LOCAL,
-                                   "LibBalsaMailboxMh",
+       mailbox_type =
+           g_type_register_static(LIBBALSA_TYPE_MAILBOX_LOCAL,
+                                  "LibBalsaMailboxMh",
                                    &mailbox_info, 0);
     }
 
     return mailbox_type;
 }
 
-
 static void
-libbalsa_mailbox_mh_class_init(LibBalsaMailboxMhClass *klass)
+libbalsa_mailbox_mh_class_init(LibBalsaMailboxMhClass * klass)
 {
     GObjectClass *object_class;
     LibBalsaMailboxClass *libbalsa_mailbox_class;
@@ -135,37 +131,34 @@ libbalsa_mailbox_mh_class_init(LibBalsaMailboxMhClass *klass)
 
     libbalsa_mailbox_class->load_config = libbalsa_mailbox_mh_load_config;
     libbalsa_mailbox_class->get_message_stream =
-        libbalsa_mailbox_mh_get_message_stream;
+       libbalsa_mailbox_mh_get_message_stream;
 
     libbalsa_mailbox_class->open_mailbox = libbalsa_mailbox_mh_open;
     libbalsa_mailbox_class->check = libbalsa_mailbox_mh_check;
 
     libbalsa_mailbox_class->sync = libbalsa_mailbox_mh_sync;
     libbalsa_mailbox_class->close_mailbox =
-        libbalsa_mailbox_mh_close_mailbox;
+       libbalsa_mailbox_mh_close_mailbox;
     libbalsa_mailbox_class->fetch_message_structure =
-        libbalsa_mailbox_mh_fetch_message_structure;
+       libbalsa_mailbox_mh_fetch_message_structure;
     libbalsa_mailbox_class->total_messages =
-        libbalsa_mailbox_mh_total_messages;
+       libbalsa_mailbox_mh_total_messages;
 
-    libbalsa_mailbox_local_class->check_files = lbm_mh_check_files;
-    libbalsa_mailbox_local_class->set_path = lbm_mh_set_path;
+    libbalsa_mailbox_local_class->check_files  = lbm_mh_check_files;
+    libbalsa_mailbox_local_class->set_path     = lbm_mh_set_path;
     libbalsa_mailbox_local_class->remove_files = lbm_mh_remove_files;
-    libbalsa_mailbox_local_class->get_info = lbm_mh_get_info;
-    libbalsa_mailbox_local_class->add_message = lbm_mh_add_message;
+    libbalsa_mailbox_local_class->get_info     = lbm_mh_get_info;
+    libbalsa_mailbox_local_class->add_message  = lbm_mh_add_message;
 }
 
-
 static void
-libbalsa_mailbox_mh_init(LibBalsaMailboxMh *mailbox)
+libbalsa_mailbox_mh_init(LibBalsaMailboxMh * mailbox)
 {
     /* mh->sequences_file = NULL; */
 }
 
-
 static gint
-lbm_mh_check_files(const gchar *path,
-                   gboolean     create)
+lbm_mh_check_files(const gchar * path, gboolean create)
 {
     g_return_val_if_fail(path != NULL, -1);
 
@@ -196,41 +189,33 @@ lbm_mh_check_files(const gchar *path,
         if (fd == -1) {
             libbalsa_information
                 (LIBBALSA_INFORMATION_WARNING,
-                _("Could not create MH structure at %s (%s)"),
-                path, strerror(errno));
+                 _("Could not create MH structure at %s (%s)"),
+                 path, strerror(errno));
             rmdir(path);
             return -1;
-        } else {
+        } else
             close(fd);
-        }
-    } else {
+    } else
         return -1;
-    }
 
     return 0;
 }
 
-
 static void
-lbm_mh_set_sequences_filename(LibBalsaMailboxMh *mh,
-                              const gchar       *path)
+lbm_mh_set_sequences_filename(LibBalsaMailboxMh * mh, const gchar * path)
 {
     g_free(mh->sequences_filename);
     mh->sequences_filename = g_build_filename(path, ".mh_sequences", NULL);
 }
 
-
 static void
-lbm_mh_set_path(LibBalsaMailboxLocal *local,
-                const gchar          *path)
+lbm_mh_set_path(LibBalsaMailboxLocal * local, const gchar * path)
 {
     lbm_mh_set_sequences_filename(LIBBALSA_MAILBOX_MH(local), path);
 }
 
-
 LibBalsaMailbox *
-libbalsa_mailbox_mh_new(const gchar *path,
-                        gboolean     create)
+libbalsa_mailbox_mh_new(const gchar * path, gboolean create)
 {
     LibBalsaMailbox *mailbox;
 
@@ -240,26 +225,24 @@ libbalsa_mailbox_mh_new(const gchar *path,
 
     if (libbalsa_mailbox_local_set_path(LIBBALSA_MAILBOX_LOCAL(mailbox),
                                         path, create) != 0) {
-        g_object_unref(mailbox);
-        return NULL;
+       g_object_unref(mailbox);
+       return NULL;
     }
 
     return mailbox;
 }
 
-
 static void
-libbalsa_mailbox_mh_finalize(GObject *object)
+libbalsa_mailbox_mh_finalize(GObject * object)
 {
     LibBalsaMailboxMh *mh = LIBBALSA_MAILBOX_MH(object);
     g_free(mh->sequences_filename);
     G_OBJECT_CLASS(parent_class)->finalize(object);
 }
 
-
 static void
-libbalsa_mailbox_mh_load_config(LibBalsaMailbox *mailbox,
-                                const gchar     *prefix)
+libbalsa_mailbox_mh_load_config(LibBalsaMailbox * mailbox,
+                                const gchar * prefix)
 {
     LibBalsaMailboxMh *mh = LIBBALSA_MAILBOX_MH(mailbox);
     gchar *path;
@@ -271,15 +254,13 @@ libbalsa_mailbox_mh_load_config(LibBalsaMailbox *mailbox,
     LIBBALSA_MAILBOX_CLASS(parent_class)->load_config(mailbox, prefix);
 }
 
-
 #define MH_BASENAME(msg_info) \
     g_strdup_printf((msg_info->orig_flags & LIBBALSA_MESSAGE_FLAG_DELETED) ? \
-                    ",%d" : "%d", msg_info->fileno)
+                   ",%d" : "%d", msg_info->fileno)
 
 static GMimeStream *
-libbalsa_mailbox_mh_get_message_stream(LibBalsaMailbox *mailbox,
-                                       guint            msgno,
-                                       gboolean         peek)
+libbalsa_mailbox_mh_get_message_stream(LibBalsaMailbox * mailbox,
+                                      guint msgno, gboolean peek)
 {
     GMimeStream *stream;
     struct message_info *msg_info;
@@ -288,7 +269,7 @@ libbalsa_mailbox_mh_get_message_stream(LibBalsaMailbox *mailbox,
     g_return_val_if_fail(MAILBOX_OPEN(mailbox), NULL);
 
     msg_info = lbm_mh_message_info_from_msgno(LIBBALSA_MAILBOX_MH(mailbox),
-                                              msgno);
+                                             msgno);
     base_name = MH_BASENAME(msg_info);
     stream = libbalsa_mailbox_local_get_message_stream(mailbox, base_name, NULL);
     g_free(base_name);
@@ -296,72 +277,64 @@ libbalsa_mailbox_mh_get_message_stream(LibBalsaMailbox *mailbox,
     return stream;
 }
 
-
 static void
 lbm_mh_remove_files(LibBalsaMailboxLocal *mailbox)
 {
-    const gchar *path;
+    const gchar* path;
     g_return_if_fail(LIBBALSA_IS_MAILBOX_MH(mailbox));
     path = libbalsa_mailbox_local_get_path(mailbox);
 
     if (!libbalsa_delete_directory_contents(path)) {
-        libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                             _("Could not remove contents of %s:\n%s"),
-                             path, strerror(errno));
-        return;
+       libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                            _("Could not remove contents of %s:\n%s"),
+                            path, strerror(errno));
+       return;
     }
     if ( rmdir(path) == -1 ) {
-        libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                             _("Could not remove %s:\n%s"),
-                             path, strerror(errno));
+       libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                            _("Could not remove %s:\n%s"),
+                            path, strerror(errno));
     }
     LIBBALSA_MAILBOX_LOCAL_CLASS(parent_class)->remove_files(mailbox);
 }
 
 
 static LibBalsaMailboxLocalMessageInfo *
-lbm_mh_get_info(LibBalsaMailboxLocal *local,
-                guint                 msgno)
+lbm_mh_get_info(LibBalsaMailboxLocal * local, guint msgno)
 {
     struct message_info *msg_info;
 
     msg_info = lbm_mh_message_info_from_msgno(LIBBALSA_MAILBOX_MH(local),
-                                              msgno);
-    if (msg_info->local_info.flags == LIBBALSA_MESSAGE_FLAG_INVALID) {
+                                             msgno);
+    if (msg_info->local_info.flags == LIBBALSA_MESSAGE_FLAG_INVALID)
         msg_info->local_info.flags = msg_info->orig_flags;
-    }
 
     return &msg_info->local_info;
 }
 
-
 /* Ignore the garbage files.  A valid MH message consists of only
  * digits.  Deleted message get moved to a filename with a comma before
  * it.
  */
 static gboolean
-lbm_mh_check_filename(const gchar *s)
+lbm_mh_check_filename(const gchar * s)
 {
     for (; *s; s++) {
-        if (!g_ascii_isdigit(*s)) {
-            return FALSE;
-        }
+       if (!g_ascii_isdigit(*s))
+           return FALSE;
     }
     return TRUE;
 }
 
-
 static gint
-lbm_mh_compare_fileno(const struct message_info **a,
-                      const struct message_info **b)
+lbm_mh_compare_fileno(const struct message_info ** a,
+                     const struct message_info ** b)
 {
     return (*a)->fileno - (*b)->fileno;
 }
 
-
 static void
-lbm_mh_parse_mailbox(LibBalsaMailboxMh *mh,
-                     gboolean           add_msg_info)
+lbm_mh_parse_mailbox(LibBalsaMailboxMh * mh, gboolean add_msg_info)
 {
     const gchar *path;
     GDir *dir;
@@ -369,134 +342,118 @@ lbm_mh_parse_mailbox(LibBalsaMailboxMh *mh,
 
     path = libbalsa_mailbox_local_get_path(mh);
 
-    if ((dir = g_dir_open(path, 0, NULL)) == NULL) {
-        return;
-    }
+    if ((dir = g_dir_open(path, 0, NULL)) == NULL)
+       return;
 
     while ((filename = g_dir_read_name(dir)) != NULL) {
-        LibBalsaMessageFlag delete_flag = 0;
-        guint fileno;
+       LibBalsaMessageFlag delete_flag = 0;
+       guint fileno;
 
-        if (filename[0] == ',') {
-            filename++;
-            delete_flag = LIBBALSA_MESSAGE_FLAG_DELETED;
-        }
-        if (lbm_mh_check_filename(filename) == FALSE) {
-            continue;
-        }
+       if (filename[0] == ',') {
+           filename++;
+           delete_flag = LIBBALSA_MESSAGE_FLAG_DELETED;
+       }
+       if (lbm_mh_check_filename(filename) == FALSE)
+           continue;
 
-        if (sscanf(filename, "%10d", &fileno) != 1) {
+       if (sscanf(filename, "%10d", &fileno) != 1)
             break;     /* FIXME report error? */
-        }
-        if (fileno > mh->last_fileno) {
-            mh->last_fileno = fileno;
-        }
-
-        if (add_msg_info && mh->messages_info) {
-            struct message_info *msg_info =
-                g_hash_table_lookup(mh->messages_info,
-                                    GINT_TO_POINTER(fileno));
-            if (!msg_info) {
-                msg_info = g_new0(struct message_info, 1);
-                msg_info->local_info.flags = LIBBALSA_MESSAGE_FLAG_INVALID;
-                g_hash_table_insert(mh->messages_info,
-                                    GINT_TO_POINTER(fileno), msg_info);
-                g_ptr_array_add(mh->msgno_2_msg_info, msg_info);
-                msg_info->fileno = fileno;
-            }
-            msg_info->orig_flags = delete_flag;
-        }
+       if (fileno > mh->last_fileno)
+           mh->last_fileno = fileno;
+
+       if (add_msg_info && mh->messages_info) {
+           struct message_info *msg_info =
+               g_hash_table_lookup(mh->messages_info,
+                                   GINT_TO_POINTER(fileno));
+           if (!msg_info) {
+               msg_info = g_new0(struct message_info, 1);
+               msg_info->local_info.flags = LIBBALSA_MESSAGE_FLAG_INVALID;
+               g_hash_table_insert(mh->messages_info,
+                                   GINT_TO_POINTER(fileno), msg_info);
+               g_ptr_array_add(mh->msgno_2_msg_info, msg_info);
+               msg_info->fileno = fileno;
+           }
+           msg_info->orig_flags = delete_flag;
+       }
     }
     g_dir_close(dir);
 
-    if (mh->msgno_2_msg_info) {
-        g_ptr_array_sort(mh->msgno_2_msg_info,
-                         (GCompareFunc) lbm_mh_compare_fileno);
-    }
+    if (mh->msgno_2_msg_info)
+       g_ptr_array_sort(mh->msgno_2_msg_info,
+                        (GCompareFunc) lbm_mh_compare_fileno);
 }
 
-
 static const gchar *LibBalsaMailboxMhUnseen = "unseen:";
 static const gchar *LibBalsaMailboxMhFlagged = "flagged:";
 static const gchar *LibBalsaMailboxMhReplied = "replied:";
 static const gchar *LibBalsaMailboxMhRecent = "recent:";
 
 static void
-lbm_mh_set_flag(LibBalsaMailboxMh  *mh,
-                guint               fileno,
-                LibBalsaMessageFlag flag)
+lbm_mh_set_flag(LibBalsaMailboxMh * mh, guint fileno, LibBalsaMessageFlag flag)
 {
     struct message_info *msg_info;
 
-    if (!fileno) {
-        return;
-    }
+    if (!fileno)
+       return;
 
     msg_info = g_hash_table_lookup(mh->messages_info, GINT_TO_POINTER(fileno));
 
     if (!msg_info) {
-        g_print("MH sequence info for nonexistent message %d\n", fileno);
-        return;
+       g_print("MH sequence info for nonexistent message %d\n", fileno);
+       return;
     }
 
     msg_info->orig_flags |= flag;
 }
 
-
 static void
-lbm_mh_handle_seq_line(LibBalsaMailboxMh *mh,
-                       gchar             *line)
+lbm_mh_handle_seq_line(LibBalsaMailboxMh * mh, gchar * line)
 {
     LibBalsaMessageFlag flag;
     gchar **sequences, **seq;
 
-    if (libbalsa_str_has_prefix(line, LibBalsaMailboxMhUnseen)) {
-        flag = LIBBALSA_MESSAGE_FLAG_NEW;
-    } else if (libbalsa_str_has_prefix(line, LibBalsaMailboxMhFlagged)) {
-        flag = LIBBALSA_MESSAGE_FLAG_FLAGGED;
-    } else if (libbalsa_str_has_prefix(line, LibBalsaMailboxMhReplied)) {
-        flag = LIBBALSA_MESSAGE_FLAG_REPLIED;
-    } else if (libbalsa_str_has_prefix(line, LibBalsaMailboxMhRecent)) {
-        flag = LIBBALSA_MESSAGE_FLAG_RECENT;
-    } else {                    /* unknown sequence */
-        return;
-    }
+    if (libbalsa_str_has_prefix(line, LibBalsaMailboxMhUnseen))
+       flag = LIBBALSA_MESSAGE_FLAG_NEW;
+    else if (libbalsa_str_has_prefix(line, LibBalsaMailboxMhFlagged))
+       flag = LIBBALSA_MESSAGE_FLAG_FLAGGED;
+    else if (libbalsa_str_has_prefix(line, LibBalsaMailboxMhReplied))
+       flag = LIBBALSA_MESSAGE_FLAG_REPLIED;
+    else if (libbalsa_str_has_prefix(line, LibBalsaMailboxMhRecent))
+       flag = LIBBALSA_MESSAGE_FLAG_RECENT;
+    else                       /* unknown sequence */
+       return;
 
     line = strchr(line, ':') + 1;
     sequences = g_strsplit(line, " ", 0);
 
     for (seq = sequences; *seq; seq++) {
-        guint end = 0;
-        guint fileno;
+       guint end = 0;
+       guint fileno;
 
-        if (!**seq) {
-            continue;
-        }
+       if (!**seq)
+           continue;
 
-        line = strchr(*seq, '-');
-        if (line) {
-            *line++ = '\0';
-            if (sscanf(line, "%10d", &end) != 1) {
+       line = strchr(*seq, '-');
+       if (line) {
+           *line++ = '\0';
+           if (sscanf(line, "%10d", &end) != 1)
                 break; /* FIXME report error? */
-            }
-        }
-        if (sscanf(*seq, "%10d", &fileno) != 1) {
+       }
+       if (sscanf(*seq, "%10d", &fileno) != 1)
             break;     /* FIXME report error? */
-        }
-        do {
-            lbm_mh_set_flag(mh, fileno, flag);
-        } while (++fileno <= end);
+       do
+           lbm_mh_set_flag(mh, fileno, flag);
+       while (++fileno <= end);
     }
 
     g_strfreev(sequences);
 }
 
-
 static void
-lbm_mh_parse_sequences(LibBalsaMailboxMh *mailbox)
+lbm_mh_parse_sequences(LibBalsaMailboxMh * mailbox)
 {
     struct stat st;
-    const gchar *sequences_filename;
+    const gchar* sequences_filename;
     int fd;
     GMimeStream *gmime_stream;
     GMimeStream *gmime_stream_buffer;
@@ -504,98 +461,89 @@ lbm_mh_parse_sequences(LibBalsaMailboxMh *mailbox)
 
     sequences_filename = mailbox->sequences_filename;
     if (stat(sequences_filename, &st) == -1) {
-        return;
+       return;
     }
     mailbox->mtime_sequences = st.st_mtime;
 
     fd = open(sequences_filename, O_RDONLY);
-    if (fd < 0) {
-        return;
-    }
+    if (fd < 0)
+       return;
     gmime_stream = g_mime_stream_fs_new(fd);
     gmime_stream_buffer = g_mime_stream_buffer_new(gmime_stream,
-                                                   GMIME_STREAM_BUFFER_BLOCK_READ);
+                                       GMIME_STREAM_BUFFER_BLOCK_READ);
     g_object_unref(gmime_stream);
     line = g_byte_array_new();
     do {
-        guint8 zero = 0;
+       guint8 zero = 0;
 
-        g_mime_stream_buffer_readln(gmime_stream_buffer, line);
-        g_byte_array_append(line, &zero, 1);
+       g_mime_stream_buffer_readln(gmime_stream_buffer, line);
+       g_byte_array_append(line, &zero, 1);
 
-        lbm_mh_handle_seq_line(mailbox, (gchar *) line->data);
-        line->len = 0;
+       lbm_mh_handle_seq_line(mailbox, (gchar *) line->data);
+       line->len = 0;
     } while (!g_mime_stream_eos(gmime_stream_buffer));
     g_object_unref(gmime_stream_buffer);
     g_byte_array_free(line, TRUE);
 }
 
-
 static void
-lbm_mh_parse_both(LibBalsaMailboxMh *mh)
+lbm_mh_parse_both(LibBalsaMailboxMh * mh)
 {
     lbm_mh_parse_mailbox(mh, TRUE);
-    if (mh->msgno_2_msg_info) {
-        lbm_mh_parse_sequences(mh);
-    }
+    if (mh->msgno_2_msg_info)
+       lbm_mh_parse_sequences(mh);
 }
 
-
 static void
 lbm_mh_free_message_info(struct message_info *msg_info)
 {
-    if (!msg_info) {
-        return;
-    }
+    if (!msg_info)
+       return;
     if (msg_info->local_info.message) {
-        msg_info->local_info.message->mailbox = NULL;
-        msg_info->local_info.message->msgno = 0;
-        g_object_remove_weak_pointer(G_OBJECT(msg_info->local_info.message),
-                                     (gpointer) & msg_info->local_info.message);
+       msg_info->local_info.message->mailbox = NULL;
+       msg_info->local_info.message->msgno   = 0;
+       g_object_remove_weak_pointer(G_OBJECT(msg_info->local_info.message),
+                                    (gpointer) &msg_info->local_info.message);
     }
     g_free(msg_info);
 }
 
-
 static gboolean
-libbalsa_mailbox_mh_open(LibBalsaMailbox *mailbox,
-                         GError         **err)
+libbalsa_mailbox_mh_open(LibBalsaMailbox * mailbox, GError **err)
 {
     LibBalsaMailboxMh *mh = LIBBALSA_MAILBOX_MH(mailbox);
     struct stat st;
-    const gchar *path;
-
+    const gchar* path;
+   
     path = libbalsa_mailbox_local_get_path(mailbox);
 
     if (stat(path, &st) == -1) {
-        g_set_error(err, LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_OPEN_ERROR,
-                    _("Mailbox does not exist."));
-        return FALSE;
+       g_set_error(err, LIBBALSA_MAILBOX_ERROR, LIBBALSA_MAILBOX_OPEN_ERROR,
+                   _("Mailbox does not exist."));
+       return FALSE;
     }
 
     libbalsa_mailbox_set_mtime(mailbox, st.st_mtime);
 
     mh->messages_info =
-        g_hash_table_new_full(NULL, NULL, NULL,
-                              (GDestroyNotify)lbm_mh_free_message_info);
+       g_hash_table_new_full(NULL, NULL, NULL,
+                             (GDestroyNotify)lbm_mh_free_message_info);
     mh->msgno_2_msg_info = g_ptr_array_new();
     mh->last_fileno = 0;
-
+    
     mailbox->readonly = access (path, W_OK);
     mailbox->unread_messages = 0;
     lbm_mh_parse_both(mh);
 
 #ifdef DEBUG
     g_print(_("%s: Opening %s Refcount: %d\n"),
-            "LibBalsaMailboxMh", mailbox->name, mailbox->open_ref);
+           "LibBalsaMailboxMh", mailbox->name, mailbox->open_ref);
 #endif
     return TRUE;
 }
 
-
 static gboolean
-lbm_mh_check(LibBalsaMailboxMh *mh,
-             const gchar       *path)
+lbm_mh_check(LibBalsaMailboxMh * mh, const gchar * path)
 {
     int fd;
     GMimeStream *gmime_stream;
@@ -603,57 +551,52 @@ lbm_mh_check(LibBalsaMailboxMh *mh,
     GByteArray *line;
     gboolean retval = FALSE;
 
-    if ((fd = open(mh->sequences_filename, O_RDONLY)) < 0) {
-        return retval;
-    }
+    if ((fd = open(mh->sequences_filename, O_RDONLY)) < 0)
+       return retval;
 
     gmime_stream = g_mime_stream_fs_new(fd);
     gmime_stream_buffer = g_mime_stream_buffer_new(gmime_stream,
-                                                   GMIME_STREAM_BUFFER_BLOCK_READ);
+                                       GMIME_STREAM_BUFFER_BLOCK_READ);
     g_object_unref(gmime_stream);
 
     line = (GByteArray *) g_array_new(TRUE, FALSE, 1);
     do {
-        line->len = 0;
-        g_mime_stream_buffer_readln(gmime_stream_buffer, line);
-
-        if (libbalsa_str_has_prefix((gchar *) line->data,
-                                    LibBalsaMailboxMhUnseen)) {
-            /* Found the "unseen: " line... */
-            gchar *p = (gchar *) line->data + strlen(LibBalsaMailboxMhUnseen);
-            gchar **sequences, **seq;
-
-            sequences = g_strsplit(p, " ", 0);
-            for (seq = sequences; *seq; seq++) {
-                guint end = 0;
-                guint fileno;
-
-                if (!**seq) {
-                    continue;
-                }
-
-                p = strchr(*seq, '-');
-                if (p) {
-                    *p++ = '\0';
-                    if (sscanf(p, "%10d", &end) != 1) {
+       line->len = 0;
+       g_mime_stream_buffer_readln(gmime_stream_buffer, line);
+
+       if (libbalsa_str_has_prefix((gchar *) line->data,
+                                   LibBalsaMailboxMhUnseen)) {
+           /* Found the "unseen: " line... */
+           gchar *p = (gchar *) line->data + strlen(LibBalsaMailboxMhUnseen);
+           gchar **sequences, **seq;
+           
+           sequences = g_strsplit(p, " ", 0);
+           for (seq = sequences; *seq; seq++) {
+               guint end = 0;
+               guint fileno;
+
+               if (!**seq)
+                   continue;
+
+               p = strchr(*seq, '-');
+               if (p) {
+                   *p++ = '\0';
+                   if (sscanf(p, "%10d", &end) != 1)
                         break; /* FIXME report error? */
-                    }
-                }
-                if (sscanf(*seq, "%10d", &fileno) != 1) {
+               }
+               if (sscanf(*seq, "%10d", &fileno) != 1)
                     break; /* FIXME report error? */
-                }
-                do {
-                    p = g_strdup_printf("%s/%d", path, fileno);
-                    if (access(p, F_OK) == 0) {
-                        retval = TRUE;
-                    }
-                    g_free(p);
-                    /* One undeleted unread message is enough. */
-                } while (!retval && ++fileno <= end);
-            }
-            g_strfreev(sequences);
-            break;
-        }
+               do {
+                   p = g_strdup_printf("%s/%d", path, fileno);
+                   if (access(p, F_OK) == 0)
+                       retval = TRUE;
+                   g_free(p);
+                   /* One undeleted unread message is enough. */
+               } while (!retval && ++fileno <= end);
+           }
+           g_strfreev(sequences);
+           break;
+       }
     } while (!g_mime_stream_eos(gmime_stream_buffer));
 
     g_object_unref(gmime_stream_buffer);
@@ -662,13 +605,11 @@ lbm_mh_check(LibBalsaMailboxMh *mh,
     return retval;
 }
 
-
-static int libbalsa_mailbox_mh_open_temp(const gchar *dest_path,
-                                         char       **name_used);
-
+static int libbalsa_mailbox_mh_open_temp (const gchar *dest_path,
+                                         char **name_used);
 /* Called with mailbox locked. */
 static void
-libbalsa_mailbox_mh_check(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_mh_check(LibBalsaMailbox * mailbox)
 {
     struct stat st, st_sequences;
     LibBalsaMailboxMh *mh = LIBBALSA_MAILBOX_MH(mailbox);
@@ -678,87 +619,78 @@ libbalsa_mailbox_mh_check(LibBalsaMailbox *mailbox)
     struct message_info *msg_info;
     time_t mtime;
 
-    if (stat(path, &st) == -1) {
-        return;
-    }
+    if (stat(path, &st) == -1)
+       return;
 
     /* create .mh_sequences when there isn't one. */
     if (stat(mh->sequences_filename, &st_sequences) == -1) {
-        if (errno == ENOENT) {
-            gchar *name_used;
-            int fd = libbalsa_mailbox_mh_open_temp(path, &name_used);
-            if (fd != -1) {
-                close(fd);
-                if (libbalsa_safe_rename(name_used,
-                                         mh->sequences_filename) == -1) {
-                    unlink(name_used);
-                }
-                g_free(name_used);
-            }
-            if (stat(mh->sequences_filename, &st_sequences) == -1) {
-                modified = 1;
-            }
-        } else {
-            modified = 1;
-        }
+       if (errno == ENOENT) {
+           gchar *name_used;
+           int fd = libbalsa_mailbox_mh_open_temp(path, &name_used);
+           if (fd != -1) {
+               close(fd);
+               if (libbalsa_safe_rename(name_used,
+                                        mh->sequences_filename) == -1)
+                   unlink(name_used);
+               g_free(name_used);
+           }
+           if (stat(mh->sequences_filename, &st_sequences) == -1)
+               modified = 1;
+       } else
+           modified = 1;
     }
 
     mtime = libbalsa_mailbox_get_mtime(mailbox);
-    if (mtime == 0) {
-        /* First check--just cache the mtime. */
+    if (mtime == 0)
+       /* First check--just cache the mtime. */
         libbalsa_mailbox_set_mtime(mailbox, st.st_mtime);
-    } else if (st.st_mtime > mtime) {
-        modified = 1;
-    }
+    else if (st.st_mtime > mtime)
+       modified = 1;
 
-    if (mh->mtime_sequences == 0) {
-        /* First check--just cache the mtime. */
-        mh->mtime_sequences = st_sequences.st_mtime;
-    } else if (st_sequences.st_mtime > mh->mtime_sequences) {
-        modified = 1;
-    }
+    if (mh->mtime_sequences == 0)
+       /* First check--just cache the mtime. */
+       mh->mtime_sequences = st_sequences.st_mtime;
+    else if (st_sequences.st_mtime > mh->mtime_sequences)
+       modified = 1;
 
-    if (!modified) {
-        return;
-    }
+    if (!modified)
+       return;
 
     libbalsa_mailbox_set_mtime(mailbox, st.st_mtime);
     mh->mtime_sequences = st_sequences.st_mtime;
 
     if (!MAILBOX_OPEN(mailbox)) {
-        libbalsa_mailbox_set_unread_messages_flag(mailbox,
-                                                  lbm_mh_check(mh, path));
-        return;
+       libbalsa_mailbox_set_unread_messages_flag(mailbox,
+                                                 lbm_mh_check(mh, path));
+       return;
     }
 
     /* Was any message removed? */
     renumber = mh->msgno_2_msg_info->len + 1;
     for (msgno = 1; msgno <= mh->msgno_2_msg_info->len; ) {
-        gchar *base_name, *filename;
-
-        msg_info = lbm_mh_message_info_from_msgno(mh, msgno);
-        base_name = MH_BASENAME(msg_info);
-        filename = g_build_filename(path, base_name, NULL);
-        g_free(base_name);
-        if (access(filename, F_OK) == 0) {
-            msgno++;
-        } else {
-            g_ptr_array_remove(mh->msgno_2_msg_info, msg_info);
-            g_hash_table_remove(mh->messages_info,
-                                GINT_TO_POINTER(msg_info->fileno));
-            libbalsa_mailbox_local_msgno_removed(mailbox, msgno);
-            if (renumber > msgno) {
-                /* First message that needs renumbering. */
-                renumber = msgno;
-            }
-        }
-        g_free(filename);
+       gchar *base_name, *filename;
+
+       msg_info = lbm_mh_message_info_from_msgno(mh, msgno);
+       base_name = MH_BASENAME(msg_info);
+       filename = g_build_filename(path, base_name, NULL);
+       g_free(base_name);
+       if (access(filename, F_OK) == 0)
+           msgno++;
+       else {
+           g_ptr_array_remove(mh->msgno_2_msg_info, msg_info);
+           g_hash_table_remove(mh->messages_info, 
+                               GINT_TO_POINTER(msg_info->fileno));
+           libbalsa_mailbox_local_msgno_removed(mailbox, msgno);
+           if (renumber > msgno)
+               /* First message that needs renumbering. */
+               renumber = msgno;
+       }
+       g_free(filename);
     }
     for (msgno = renumber; msgno <= mh->msgno_2_msg_info->len; msgno++) {
-        msg_info = lbm_mh_message_info_from_msgno(mh, msgno);
-        if (msg_info->local_info.message) {
-            msg_info->local_info.message->msgno = msgno;
-        }
+       msg_info = lbm_mh_message_info_from_msgno(mh, msgno);
+       if (msg_info->local_info.message)
+           msg_info->local_info.message->msgno = msgno;
     }
 
     msgno = mh->msgno_2_msg_info->len;
@@ -766,105 +698,88 @@ libbalsa_mailbox_mh_check(LibBalsaMailbox *mailbox)
     libbalsa_mailbox_local_load_messages(mailbox, msgno);
 }
 
-
 static void
-libbalsa_mailbox_mh_close_mailbox(LibBalsaMailbox *mailbox,
-                                  gboolean         expunge)
+libbalsa_mailbox_mh_close_mailbox(LibBalsaMailbox * mailbox,
+                                  gboolean expunge)
 {
     LibBalsaMailboxMh *mh = LIBBALSA_MAILBOX_MH(mailbox);
     guint len;
 
     len = mh->msgno_2_msg_info->len;
     libbalsa_mailbox_mh_sync(mailbox, expunge);
-    if (mh->msgno_2_msg_info->len != len) {
+    if (mh->msgno_2_msg_info->len != len)
         libbalsa_mailbox_changed(mailbox);
-    }
 
     g_hash_table_destroy(mh->messages_info);
     mh->messages_info = NULL;
 
-    if (LIBBALSA_MAILBOX_CLASS(parent_class)->close_mailbox) {
+    if (LIBBALSA_MAILBOX_CLASS(parent_class)->close_mailbox)
         LIBBALSA_MAILBOX_CLASS(parent_class)->close_mailbox(mailbox,
                                                             expunge);
-    }
 
     /* Now it's safe to free the message info. */
     g_ptr_array_free(mh->msgno_2_msg_info, TRUE);
     mh->msgno_2_msg_info = NULL;
 }
 
-
 static int
-libbalsa_mailbox_mh_open_temp(const gchar *dest_path,
-                              char       **name_used)
+libbalsa_mailbox_mh_open_temp (const gchar *dest_path, char **name_used)
 {
     *name_used = g_build_filename(dest_path, "mh-XXXXXX", NULL);
     return g_mkstemp(*name_used);
 }
 
-
 struct line_info {
     gint first, last;
     GMimeStream *line;
 };
 
 static void
-lbm_mh_print_line(struct line_info *li)
+lbm_mh_print_line(struct line_info * li)
 {
-    if (li->last == -1) {
-        return;
-    }
-    if (li->first != li->last) {
-        /* interval */
-        g_mime_stream_printf(li->line, " %d-%d", li->first, li->last);
-    } else {
-        /* single message */
-        g_mime_stream_printf(li->line, " %d", li->last);
-    }
+    if (li->last == -1)
+       return;
+    if (li->first != li->last)
+       /* interval */
+       g_mime_stream_printf(li->line, " %d-%d", li->first, li->last);
+    else
+       /* single message */
+       g_mime_stream_printf(li->line, " %d", li->last);
 }
 
-
 static void
-lbm_mh_flag_line(struct message_info *msg_info,
-                 LibBalsaMessageFlag  flag,
-                 struct line_info    *li)
+lbm_mh_flag_line(struct message_info *msg_info, LibBalsaMessageFlag flag,
+                struct line_info *li)
 {
-    if (msg_info->local_info.flags == LIBBALSA_MESSAGE_FLAG_INVALID) {
-        msg_info->local_info.flags = msg_info->orig_flags;
-    }
-    if (!(msg_info->local_info.flags & flag)) {
-        return;
-    }
+    if (msg_info->local_info.flags == LIBBALSA_MESSAGE_FLAG_INVALID)
+       msg_info->local_info.flags = msg_info->orig_flags;
+    if (!(msg_info->local_info.flags & flag))
+       return;
 
     if (li->last < msg_info->fileno - 1) {
-        lbm_mh_print_line(li);
-        li->first = msg_info->fileno;
+       lbm_mh_print_line(li);
+       li->first = msg_info->fileno;
     }
     li->last = msg_info->fileno;
 }
 
-
 static gboolean
-lbm_mh_finish_line(struct line_info *li,
-                   GMimeStream      *temp_stream,
-                   const gchar      *flag_string)
+lbm_mh_finish_line(struct line_info *li, GMimeStream * temp_stream,
+                  const gchar * flag_string)
 {
     if (g_mime_stream_length(li->line) > 0) {
-        if ((g_mime_stream_write_string(temp_stream, flag_string) == -1)
-            || (g_mime_stream_reset(li->line) == -1)
-            || (g_mime_stream_write_to_stream(li->line, temp_stream) == -1)
-            || (g_mime_stream_write_string(temp_stream, "\n") == -1)) {
-            return FALSE;
-        }
+       if (g_mime_stream_write_string(temp_stream, flag_string) == -1
+           || g_mime_stream_reset(li->line) == -1
+           || g_mime_stream_write_to_stream(li->line, temp_stream) == -1
+           || g_mime_stream_write_string(temp_stream, "\n") == -1)
+           return FALSE;
     }
 
     return TRUE;
 }
 
-
 static gboolean
-libbalsa_mailbox_mh_sync(LibBalsaMailbox *mailbox,
-                         gboolean         expunge)
+libbalsa_mailbox_mh_sync(LibBalsaMailbox * mailbox, gboolean expunge)
 {
     LibBalsaMailboxMh *mh;
     struct line_info unseen, flagged, replied, recent;
@@ -876,7 +791,7 @@ libbalsa_mailbox_mh_sync(LibBalsaMailbox *mailbox,
     int fd;
     int sequences_fd;
     GMimeStream *temp_stream;
-    const gchar *sequences_filename;
+    const gchar* sequences_filename;
     GMimeStream *gmime_stream;
     GMimeStream *gmime_stream_buffer;
     GByteArray *line;
@@ -888,84 +803,80 @@ libbalsa_mailbox_mh_sync(LibBalsaMailbox *mailbox,
 
     sequences_filename = mh->sequences_filename;
     sequences_fd = open(sequences_filename, O_RDONLY);
-    if (sequences_fd >= 0) {
+    if (sequences_fd >= 0)
         libbalsa_lock_file(sequences_filename, sequences_fd, FALSE, TRUE, 1);
-    }
 
     /* Check for new mail before flushing any changes out to disk. */
     libbalsa_mailbox_mh_check(mailbox);
 
     /* build new sequence file lines */
-    unseen.first = unseen.last = -1;
-    unseen.line = g_mime_stream_mem_new();
+    unseen.first  = unseen.last = -1;
+    unseen.line   = g_mime_stream_mem_new();
     flagged.first = flagged.last = -1;
-    flagged.line = g_mime_stream_mem_new();
+    flagged.line  = g_mime_stream_mem_new();
     replied.first = replied.last = -1;
-    replied.line = g_mime_stream_mem_new();
-    recent.first = recent.last = -1;
-    recent.line = g_mime_stream_mem_new();
+    replied.line  = g_mime_stream_mem_new();
+    recent.first  = recent.last = -1;
+    recent.line   = g_mime_stream_mem_new();
 
     path = libbalsa_mailbox_local_get_path(mailbox);
 
     msgno = 1;
     while (msgno <= mh->msgno_2_msg_info->len) {
-        msg_info = lbm_mh_message_info_from_msgno(mh, msgno);
-        if (msg_info->local_info.flags == LIBBALSA_MESSAGE_FLAG_INVALID) {
-            msg_info->local_info.flags = msg_info->orig_flags;
-        }
-        if (mailbox->state == LB_MAILBOX_STATE_CLOSING) {
-            msg_info->local_info.flags &= ~LIBBALSA_MESSAGE_FLAG_RECENT;
-        }
+       msg_info = lbm_mh_message_info_from_msgno(mh, msgno);
+       if (msg_info->local_info.flags == LIBBALSA_MESSAGE_FLAG_INVALID)
+           msg_info->local_info.flags = msg_info->orig_flags;
+       if (mailbox->state == LB_MAILBOX_STATE_CLOSING)
+           msg_info->local_info.flags &= ~LIBBALSA_MESSAGE_FLAG_RECENT;
 
-        if (expunge && (msg_info->local_info.flags
+       if (expunge && (msg_info->local_info.flags
                         & LIBBALSA_MESSAGE_FLAG_DELETED)) {
-            /* MH just moves files out of the way when you delete them */
-            /* chbm: not quite, however this is probably a good move for
-               flag deleted */
-            char *base_name = MH_BASENAME(msg_info);
-            char *orig = g_build_filename(path, base_name, NULL);
-            g_free(base_name);
-            unlink(orig);
-            g_free(orig);
-            /* free old information */
-            g_ptr_array_remove(mh->msgno_2_msg_info, msg_info);
-            g_hash_table_remove(mh->messages_info,
-                                GINT_TO_POINTER(msg_info->fileno));
-            libbalsa_mailbox_local_msgno_removed(mailbox, msgno);
-        } else {
-            lbm_mh_flag_line(msg_info, LIBBALSA_MESSAGE_FLAG_NEW, &unseen);
-            lbm_mh_flag_line(msg_info, LIBBALSA_MESSAGE_FLAG_FLAGGED, &flagged);
-            lbm_mh_flag_line(msg_info, LIBBALSA_MESSAGE_FLAG_REPLIED, &replied);
-            lbm_mh_flag_line(msg_info, LIBBALSA_MESSAGE_FLAG_RECENT, &recent);
-            if ((msg_info->local_info.flags ^ msg_info->orig_flags) &
-                LIBBALSA_MESSAGE_FLAG_DELETED) {
-                gchar *base_name;
-                gchar *old_file;
-                gchar *new_file;
-
-                base_name = MH_BASENAME(msg_info);
-                old_file = g_build_filename(path, base_name, NULL);
-                g_free(base_name);
+           /* MH just moves files out of the way when you delete them */
+           /* chbm: not quite, however this is probably a good move for
+              flag deleted */
+           char *base_name = MH_BASENAME(msg_info);
+           char *orig = g_build_filename(path, base_name, NULL);
+           g_free(base_name);
+           unlink(orig);
+           g_free(orig);
+           /* free old information */
+           g_ptr_array_remove(mh->msgno_2_msg_info, msg_info);
+           g_hash_table_remove(mh->messages_info, 
+                               GINT_TO_POINTER(msg_info->fileno));
+           libbalsa_mailbox_local_msgno_removed(mailbox, msgno);
+       } else {
+           lbm_mh_flag_line(msg_info, LIBBALSA_MESSAGE_FLAG_NEW, &unseen);
+           lbm_mh_flag_line(msg_info, LIBBALSA_MESSAGE_FLAG_FLAGGED, &flagged);
+           lbm_mh_flag_line(msg_info, LIBBALSA_MESSAGE_FLAG_REPLIED, &replied);
+           lbm_mh_flag_line(msg_info, LIBBALSA_MESSAGE_FLAG_RECENT, &recent);
+           if ((msg_info->local_info.flags ^ msg_info->orig_flags) &
+               LIBBALSA_MESSAGE_FLAG_DELETED) {
+               gchar *base_name;
+               gchar *old_file;
+               gchar *new_file;
+
+               base_name = MH_BASENAME(msg_info);
+               old_file = g_build_filename(path, base_name, NULL);
+               g_free(base_name);
 
                 msg_info->orig_flags =
                     REAL_FLAGS(msg_info->local_info.flags);
 
-                base_name = MH_BASENAME(msg_info);
-                new_file = g_build_filename(path, base_name, NULL);
-                g_free(base_name);
+               base_name = MH_BASENAME(msg_info);
+               new_file = g_build_filename(path, base_name, NULL);
+               g_free(base_name);
 
-                if (libbalsa_safe_rename(old_file, new_file) == -1) {
-                    /* FIXME: report error ... */
-                }
+               if (libbalsa_safe_rename(old_file, new_file) == -1) {
+                   /* FIXME: report error ... */
+               }
 
-                g_free(old_file);
-                g_free(new_file);
-            } else {
+               g_free(old_file);
+               g_free(new_file);
+           } else
                 msg_info->orig_flags =
                     REAL_FLAGS(msg_info->local_info.flags);
-            }
-            msgno++;
-        }
+           msgno++;
+       }
     }
     lbm_mh_print_line(&unseen);
     lbm_mh_print_line(&flagged);
@@ -974,28 +885,27 @@ libbalsa_mailbox_mh_sync(LibBalsaMailbox *mailbox,
 
     /* Renumber */
     for (msgno = 1; msgno <= mh->msgno_2_msg_info->len; msgno++) {
-        msg_info = lbm_mh_message_info_from_msgno(mh, msgno);
-        if (msg_info->local_info.message) {
-            msg_info->local_info.message->msgno = msgno;
-        }
+       msg_info = lbm_mh_message_info_from_msgno(mh, msgno);
+       if (msg_info->local_info.message)
+           msg_info->local_info.message->msgno = msgno;
     }
 
     /* open tempfile */
     path = libbalsa_mailbox_local_get_path(mailbox);
     fd = libbalsa_mailbox_mh_open_temp(path, &name_used);
-    if (fd == -1) {
+    if (fd == -1)
+    {
         g_free(name_used);
-        g_object_unref(unseen.line);
-        g_object_unref(flagged.line);
-        g_object_unref(replied.line);
-        g_object_unref(recent.line);
-        if (sequences_fd >= 0) {
+       g_object_unref(unseen.line);
+       g_object_unref(flagged.line);
+       g_object_unref(replied.line);
+       g_object_unref(recent.line);
+        if (sequences_fd >= 0)
             libbalsa_unlock_file(sequences_filename, sequences_fd, 1);
-        }
 #ifdef DEBUG
         g_print("MH sync “%s”: cannot open temp file.\n", path);
 #endif
-        return retval;
+       return retval;
     }
     temp_stream = g_mime_stream_fs_new(fd);
 
@@ -1028,23 +938,22 @@ libbalsa_mailbox_mh_sync(LibBalsaMailbox *mailbox,
 
     /* write sequences */
     if (!lbm_mh_finish_line(&unseen, temp_stream, LibBalsaMailboxMhUnseen) ||
-        !lbm_mh_finish_line(&flagged, temp_stream, LibBalsaMailboxMhFlagged) ||
-        !lbm_mh_finish_line(&replied, temp_stream, LibBalsaMailboxMhReplied) ||
-        !lbm_mh_finish_line(&recent, temp_stream, LibBalsaMailboxMhRecent)) {
-        g_object_unref(temp_stream);
-        unlink(name_used);
-        g_free(name_used);
-        g_object_unref(unseen.line);
-        g_object_unref(flagged.line);
-        g_object_unref(replied.line);
-        g_object_unref(recent.line);
-        if (sequences_fd >= 0) {
+       !lbm_mh_finish_line(&flagged, temp_stream, LibBalsaMailboxMhFlagged) ||
+       !lbm_mh_finish_line(&replied, temp_stream, LibBalsaMailboxMhReplied) ||
+       !lbm_mh_finish_line(&recent, temp_stream, LibBalsaMailboxMhRecent)) {
+       g_object_unref(temp_stream);
+       unlink(name_used);
+       g_free(name_used);
+       g_object_unref(unseen.line);
+       g_object_unref(flagged.line);
+       g_object_unref(replied.line);
+       g_object_unref(recent.line);
+        if (sequences_fd >= 0)
             libbalsa_unlock_file(sequences_filename, sequences_fd, 1);
-        }
 #ifdef DEBUG
         g_print("MH sync “%s”: error finishing sequences line.\n", path);
 #endif
-        return retval;
+       return retval;
     }
 
     /* close tempfile */
@@ -1056,13 +965,11 @@ libbalsa_mailbox_mh_sync(LibBalsaMailbox *mailbox,
     /* rename tempfile to '.mh_sequences' */
     retval = (libbalsa_safe_rename(name_used, sequences_filename) != -1);
 #ifdef DEBUG
-    if (!retval) {
+    if (!retval)
         g_print("MH sync “%s”: error renaming sequences file.\n", path);
-    }
 #endif
-    if (!retval) {
-        unlink (name_used);
-    }
+    if (!retval)
+       unlink (name_used);
 
     /* Record the mtimes; we'll just use the current time--someone else
      * might have changed something since we did, despite the file
@@ -1074,16 +981,13 @@ libbalsa_mailbox_mh_sync(LibBalsaMailbox *mailbox,
     g_object_unref(flagged.line);
     g_object_unref(replied.line);
     g_object_unref(recent.line);
-    if (sequences_fd >= 0) {
+    if (sequences_fd >= 0)
         libbalsa_unlock_file(sequences_filename, sequences_fd, 1);
-    }
     return retval;
 }
 
-
 static struct message_info *
-lbm_mh_message_info_from_msgno(LibBalsaMailboxMh *mh,
-                               guint              msgno)
+lbm_mh_message_info_from_msgno(LibBalsaMailboxMh * mh, guint msgno)
 {
     struct message_info *msg_info = NULL;
 
@@ -1093,76 +997,67 @@ lbm_mh_message_info_from_msgno(LibBalsaMailboxMh *mh,
     return msg_info;
 }
 
-
 static gboolean
-libbalsa_mailbox_mh_fetch_message_structure(LibBalsaMailbox  *mailbox,
-                                            LibBalsaMessage  *message,
-                                            LibBalsaFetchFlag flags)
+libbalsa_mailbox_mh_fetch_message_structure(LibBalsaMailbox * mailbox,
+                                           LibBalsaMessage * message,
+                                           LibBalsaFetchFlag flags)
 {
     if (!message->mime_msg) {
-        struct message_info *msg_info;
-        gchar *base_name;
-
-        msg_info =
-            lbm_mh_message_info_from_msgno(LIBBALSA_MAILBOX_MH(mailbox),
-                                           message->msgno);
-
-        base_name = MH_BASENAME(msg_info);
-        message->mime_msg =
-            libbalsa_mailbox_local_get_mime_message(mailbox, base_name, NULL);
-        g_free(base_name);
-
-        if (message->mime_msg) {
-            g_mime_object_remove_header(GMIME_OBJECT(message->mime_msg),
-                                        "Status");
-            g_mime_object_remove_header(GMIME_OBJECT(message->mime_msg),
-                                        "X-Status");
-        }
+       struct message_info *msg_info;
+       gchar *base_name;
+
+       msg_info =
+           lbm_mh_message_info_from_msgno(LIBBALSA_MAILBOX_MH(mailbox),
+                                          message->msgno);
+
+       base_name = MH_BASENAME(msg_info);
+       message->mime_msg =
+           libbalsa_mailbox_local_get_mime_message(mailbox, base_name, NULL);
+       g_free(base_name);
+
+       if (message->mime_msg) {
+           g_mime_object_remove_header(GMIME_OBJECT(message->mime_msg),
+                                       "Status");
+           g_mime_object_remove_header(GMIME_OBJECT(message->mime_msg),
+                                       "X-Status");
+       }
     }
 
     return LIBBALSA_MAILBOX_CLASS(parent_class)->
-           fetch_message_structure(mailbox, message, flags);
+        fetch_message_structure(mailbox, message, flags);
 }
 
-
 /* Update .mh_sequences when a new message is added to the mailbox;
  * we'll just add new lines and let the next sync merge them with any
  * existing lines. */
 static void
-lbm_mh_update_sequences(LibBalsaMailboxMh  *mh,
-                        gint                fileno,
-                        LibBalsaMessageFlag flags)
+lbm_mh_update_sequences(LibBalsaMailboxMh * mh, gint fileno,
+                       LibBalsaMessageFlag flags)
 {
     FILE *fp;
 
     fp = fopen(mh->sequences_filename, "a");
 
-    if (!fp) {
-        return;
-    }
-
-    if (flags & LIBBALSA_MESSAGE_FLAG_NEW) {
-        fprintf(fp, "unseen: %d\n", fileno);
-    }
-    if (flags & LIBBALSA_MESSAGE_FLAG_FLAGGED) {
-        fprintf(fp, "flagged: %d\n", fileno);
-    }
-    if (flags & LIBBALSA_MESSAGE_FLAG_REPLIED) {
-        fprintf(fp, "replied: %d\n", fileno);
-    }
-    if (flags & LIBBALSA_MESSAGE_FLAG_RECENT) {
-        fprintf(fp, "recent: %d\n", fileno);
-    }
+    if (!fp)
+       return;
+
+    if (flags & LIBBALSA_MESSAGE_FLAG_NEW)
+       fprintf(fp, "unseen: %d\n", fileno);
+    if (flags & LIBBALSA_MESSAGE_FLAG_FLAGGED)
+       fprintf(fp, "flagged: %d\n", fileno);
+    if (flags & LIBBALSA_MESSAGE_FLAG_REPLIED)
+       fprintf(fp, "replied: %d\n", fileno);
+    if (flags & LIBBALSA_MESSAGE_FLAG_RECENT)
+       fprintf(fp, "recent: %d\n", fileno);
     fclose(fp);
 }
 
-
 /* Called with mailbox locked. */
 static gboolean
-lbm_mh_add_message(LibBalsaMailboxLocal *local,
-                   GMimeStream          *stream,
-                   LibBalsaMessageFlag   flags,
-                   GError              **err)
+lbm_mh_add_message(LibBalsaMailboxLocal * local,
+                   GMimeStream          * stream,
+                   LibBalsaMessageFlag    flags,
+                   GError              ** err)
 {
     LibBalsaMailboxMh *mh;
     const char *path;
@@ -1186,8 +1081,8 @@ lbm_mh_add_message(LibBalsaMailboxLocal *local,
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_APPEND_ERROR,
                     _("Cannot create message"));
-        g_free(name_used);
-        return FALSE;
+       g_free(name_used);
+       return FALSE;
     }
     out_stream = g_mime_stream_fs_new(fd);
 
@@ -1201,40 +1096,39 @@ lbm_mh_add_message(LibBalsaMailboxLocal *local,
     if (g_mime_stream_write_to_stream(in_stream, out_stream) == -1) {
         libbalsa_mime_stream_shared_unlock(stream);
         g_object_unref(in_stream);
-        g_object_unref(out_stream);
+       g_object_unref(out_stream);
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_APPEND_ERROR,
                     _("Data copy error"));
-        unlink(name_used);
-        g_free(name_used);
-        return FALSE;
+       unlink(name_used);
+       g_free(name_used);
+       return FALSE;
     }
     g_object_unref(out_stream);
     libbalsa_mime_stream_shared_unlock(stream);
     g_object_unref(in_stream);
 
-    fileno = mh->last_fileno;
+    fileno = mh->last_fileno; 
     retries = 10;
     do {
-        /* rename tempfile to message-number-name */
-        char *new_filename;
-        gint rename_status;
-
-        new_filename = g_strdup_printf("%s/%d", path, ++fileno);
-        rename_status = libbalsa_safe_rename(name_used, new_filename);
-        g_free(new_filename);
-        if (rename_status != -1) {
-            break;
-        }
-
-        if (errno != EEXIST) {
+       /* rename tempfile to message-number-name */
+       char *new_filename;
+       gint rename_status;
+
+       new_filename = g_strdup_printf("%s/%d", path, ++fileno);
+       rename_status = libbalsa_safe_rename(name_used, new_filename);
+       g_free(new_filename);
+       if (rename_status != -1)
+           break;
+       
+       if (errno != EEXIST) {
             g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                         LIBBALSA_MAILBOX_APPEND_ERROR,
                         _("Message rename error"));
-            unlink (name_used);
-            g_free(name_used);
-            return FALSE;
-        }
+           unlink (name_used);
+           g_free(name_used);
+           return FALSE;
+       }
     } while (--retries > 0);
     g_free(name_used);
 
@@ -1242,7 +1136,7 @@ lbm_mh_add_message(LibBalsaMailboxLocal *local,
         g_set_error(err, LIBBALSA_MAILBOX_ERROR,
                     LIBBALSA_MAILBOX_APPEND_ERROR,
                     "Too high activity?");
-        return FALSE;
+       return FALSE;
     }
     mh->last_fileno = fileno;
 
@@ -1252,9 +1146,8 @@ lbm_mh_add_message(LibBalsaMailboxLocal *local,
     return TRUE;
 }
 
-
 static guint
-libbalsa_mailbox_mh_total_messages(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_mh_total_messages(LibBalsaMailbox * mailbox)
 {
     LibBalsaMailboxMh *mh = (LibBalsaMailboxMh *) mailbox;
 
diff --git a/libbalsa/mailbox_mh.h b/libbalsa/mailbox_mh.h
index fa674f7..7d34977 100644
--- a/libbalsa/mailbox_mh.h
+++ b/libbalsa/mailbox_mh.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -40,9 +40,9 @@ typedef struct _LibBalsaMailboxMhClass LibBalsaMailboxMhClass;
 struct _LibBalsaMailboxMh {
     LibBalsaMailboxLocal parent;
 
-    GHashTable *messages_info;
-    GPtrArray *msgno_2_msg_info;
-    gchar *sequences_filename;
+    GHashTable* messages_info;
+    GPtrArray* msgno_2_msg_info;
+    gchar* sequences_filename;
     time_t mtime_sequences;
     guint last_fileno;
 };
@@ -52,7 +52,7 @@ struct _LibBalsaMailboxMhClass {
 };
 
 GType libbalsa_mailbox_mh_get_type(void);
-LibBalsaMailbox *libbalsa_mailbox_mh_new(const gchar *path,
-                                         gboolean     create);
-
+LibBalsaMailbox *libbalsa_mailbox_mh_new(const gchar * path,
+                                         gboolean      create);
 #endif
+
diff --git a/libbalsa/mailbox_pop3.c b/libbalsa/mailbox_pop3.c
index f127a0d..6459404 100644
--- a/libbalsa/mailbox_pop3.c
+++ b/libbalsa/mailbox_pop3.c
@@ -6,20 +6,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 
@@ -45,25 +45,25 @@ static LibBalsaMailboxClass *parent_class = NULL;
 struct _LibBalsaMailboxPop3Class {
     LibBalsaMailboxRemoteClass klass;
 
-    void (*config_changed) (LibBalsaMailboxPop3 *mailbox);
+    void (*config_changed) (LibBalsaMailboxPop3* mailbox);
 };
 
-static void libbalsa_mailbox_pop3_dispose(GObject *object);
+static void libbalsa_mailbox_pop3_dispose(GObject * object);
 static void libbalsa_mailbox_pop3_class_init(LibBalsaMailboxPop3Class *
-                                             klass);
-static void libbalsa_mailbox_pop3_init(LibBalsaMailboxPop3 *mailbox);
+                                            klass);
+static void libbalsa_mailbox_pop3_init(LibBalsaMailboxPop3 * mailbox);
 
-static gboolean libbalsa_mailbox_pop3_open(LibBalsaMailbox *mailbox,
-                                           GError         **err);
-static void libbalsa_mailbox_pop3_check(LibBalsaMailbox *mailbox);
+static gboolean libbalsa_mailbox_pop3_open(LibBalsaMailbox * mailbox,
+                                          GError **err);
+static void libbalsa_mailbox_pop3_check(LibBalsaMailbox * mailbox);
 
-static void libbalsa_mailbox_pop3_save_config(LibBalsaMailbox *mailbox,
-                                              const gchar     *prefix);
-static void libbalsa_mailbox_pop3_load_config(LibBalsaMailbox *mailbox,
-                                              const gchar     *prefix);
+static void libbalsa_mailbox_pop3_save_config(LibBalsaMailbox * mailbox,
+                                             const gchar * prefix);
+static void libbalsa_mailbox_pop3_load_config(LibBalsaMailbox * mailbox,
+                                             const gchar * prefix);
 
 
-#define MBOX_POP3_ERROR         (g_quark_from_static_string("mailbox-pop3"))
+#define MBOX_POP3_ERROR        (g_quark_from_static_string("mailbox-pop3"))
 
 
 GType
@@ -72,30 +72,29 @@ libbalsa_mailbox_pop3_get_type(void)
     static GType mailbox_type = 0;
 
     if (!mailbox_type) {
-        static const GTypeInfo mailbox_info = {
-            sizeof(LibBalsaMailboxPop3Class),
+       static const GTypeInfo mailbox_info = {
+           sizeof(LibBalsaMailboxPop3Class),
             NULL,               /* base_init */
             NULL,               /* base_finalize */
-            (GClassInitFunc) libbalsa_mailbox_pop3_class_init,
+           (GClassInitFunc) libbalsa_mailbox_pop3_class_init,
             NULL,               /* class_finalize */
             NULL,               /* class_data */
-            sizeof(LibBalsaMailboxPop3),
+           sizeof(LibBalsaMailboxPop3),
             0,                  /* n_preallocs */
-            (GInstanceInitFunc) libbalsa_mailbox_pop3_init
-        };
+           (GInstanceInitFunc) libbalsa_mailbox_pop3_init
+       };
 
-        mailbox_type =
-            g_type_register_static(LIBBALSA_TYPE_MAILBOX_REMOTE,
+       mailbox_type =
+           g_type_register_static(LIBBALSA_TYPE_MAILBOX_REMOTE,
                                    "LibBalsaMailboxPOP3",
-                                   &mailbox_info, 0);
+                                  &mailbox_info, 0);
     }
 
     return mailbox_type;
 }
 
-
 static void
-libbalsa_mailbox_pop3_class_init(LibBalsaMailboxPop3Class *klass)
+libbalsa_mailbox_pop3_class_init(LibBalsaMailboxPop3Class * klass)
 {
     GObjectClass *object_class;
     LibBalsaMailboxClass *libbalsa_mailbox_class;
@@ -111,15 +110,14 @@ libbalsa_mailbox_pop3_class_init(LibBalsaMailboxPop3Class *klass)
     libbalsa_mailbox_class->check = libbalsa_mailbox_pop3_check;
 
     libbalsa_mailbox_class->save_config =
-        libbalsa_mailbox_pop3_save_config;
+       libbalsa_mailbox_pop3_save_config;
     libbalsa_mailbox_class->load_config =
-        libbalsa_mailbox_pop3_load_config;
+       libbalsa_mailbox_pop3_load_config;
 
 }
 
-
 static void
-libbalsa_mailbox_pop3_init(LibBalsaMailboxPop3 *mailbox)
+libbalsa_mailbox_pop3_init(LibBalsaMailboxPop3 * mailbox)
 {
     LibBalsaMailboxRemote *remote;
     mailbox->check = FALSE;
@@ -133,9 +131,8 @@ libbalsa_mailbox_pop3_init(LibBalsaMailboxPop3 *mailbox)
     remote->server = libbalsa_server_new();
 }
 
-
 static void
-libbalsa_mailbox_pop3_dispose(GObject *object)
+libbalsa_mailbox_pop3_dispose(GObject * object)
 {
     LibBalsaMailboxRemote *remote = LIBBALSA_MAILBOX_REMOTE(object);
 
@@ -144,8 +141,7 @@ libbalsa_mailbox_pop3_dispose(GObject *object)
     G_OBJECT_CLASS(parent_class)->dispose(object);
 }
 
-
-LibBalsaMailboxPop3 *
+LibBalsaMailboxPop3*
 libbalsa_mailbox_pop3_new(void)
 {
     LibBalsaMailboxPop3 *mailbox;
@@ -157,8 +153,7 @@ libbalsa_mailbox_pop3_new(void)
 
 
 static gboolean
-libbalsa_mailbox_pop3_open(LibBalsaMailbox *mailbox,
-                           GError         **err)
+libbalsa_mailbox_pop3_open(LibBalsaMailbox * mailbox, GError **err)
 {
     g_return_val_if_fail(LIBBALSA_IS_MAILBOX_POP3(mailbox), FALSE);
 
@@ -170,217 +165,202 @@ libbalsa_mailbox_pop3_open(LibBalsaMailbox *mailbox,
 }
 
 
-#define POP_UID_FILE    "/.balsa/pop-uids"
+#define POP_UID_FILE   "/.balsa/pop-uids"
 static GMutex uid_mutex;
 
 
 static GHashTable *
 mp_load_uids(const gchar *prefix)
 {
-    GHashTable *res;
-    gboolean read_res;
-    gchar *fname;
-    gchar *contents;
-
-    res = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
-
-    fname = g_strconcat(g_get_home_dir(), POP_UID_FILE, NULL);
-    g_mutex_lock(&uid_mutex);
-    read_res = g_file_get_contents(fname, &contents, NULL, NULL);
-    g_mutex_unlock(&uid_mutex);
-    g_free(fname);
-
-    if (read_res) {
-        gchar **lines;
-        size_t prefix_len;
-        guint n;
-
-        lines = g_strsplit(contents, "\n", -1);
-        g_free(contents);
-        prefix_len = strlen(prefix);
-        for (n = 0; lines[n] != NULL; n++) {
-            if (strncmp(lines[n], prefix, prefix_len) == 0) {
-                g_hash_table_insert(res, g_strdup(lines[n]), GINT_TO_POINTER(1));
-            }
-        }
-
-        g_strfreev(lines);
-    }
-
-    return res;
+       GHashTable *res;
+       gboolean read_res;
+       gchar *fname;
+       gchar *contents;
+
+       res = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
+
+       fname = g_strconcat(g_get_home_dir(), POP_UID_FILE, NULL);
+       g_mutex_lock(&uid_mutex);
+       read_res = g_file_get_contents(fname, &contents, NULL, NULL);
+       g_mutex_unlock(&uid_mutex);
+       g_free(fname);
+
+       if (read_res) {
+               gchar **lines;
+               size_t prefix_len;
+               guint n;
+
+               lines = g_strsplit(contents, "\n", -1);
+               g_free(contents);
+               prefix_len = strlen(prefix);
+               for (n = 0; lines[n] != NULL; n++) {
+                       if (strncmp(lines[n], prefix, prefix_len) == 0) {
+                               g_hash_table_insert(res, g_strdup(lines[n]), GINT_TO_POINTER(1));
+                       }
+               }
+
+               g_strfreev(lines);
+       }
+
+       return res;
 }
 
 
 static void
-mp_save_uid(gpointer               key,
-            gpointer G_GNUC_UNUSED value,
-            gpointer               user_data)
+mp_save_uid(gpointer key, gpointer G_GNUC_UNUSED value, gpointer user_data)
 {
-    FILE *out = (FILE *) user_data;
+       FILE *out = (FILE *) user_data;
 
-    fputs((const gchar *) key, out);
-    fputc('\n', out);
+       fputs((const gchar *) key, out);
+       fputc('\n', out);
 }
 
 
 static gboolean
-mp_save_uids(GHashTable  *uids,
-             const gchar *prefix,
-             GError     **error)
+mp_save_uids(GHashTable *uids, const gchar *prefix, GError **error)
 {
-    gchar *fname;
-    gboolean read_res;
-    gchar *contents = NULL;
-    FILE *out;
-    gboolean result;
-
-    fname = g_strconcat(g_get_home_dir(), POP_UID_FILE, NULL);
-
-    g_mutex_lock(&uid_mutex);
-    read_res = g_file_get_contents(fname, &contents, NULL, NULL);
-    out = fopen(fname, "w");
-    g_free(fname);
-    if (out != NULL) {
-        if (read_res) {
-            gchar **lines;
-            size_t prefix_len;
-            guint n;
-
-            lines = g_strsplit(contents, "\n", -1);
-            g_free(contents);
-            prefix_len = strlen(prefix);
-            for (n = 0; lines[n] != NULL; n++) {
-                if ((lines[n][0] != '\0') && (strncmp(lines[n], prefix, prefix_len) != 0)) {
-                    fputs(lines[n], out);
-                    fputc('\n', out);
-                }
-            }
-
-            g_strfreev(lines);
-        }
-
-        if (uids != NULL) {
-            g_hash_table_foreach(uids, mp_save_uid, out);
-        }
-        fclose(out);
-        result = TRUE;
-    } else {
-        g_set_error(error, MBOX_POP3_ERROR, errno,
-                    _("Saving the POP3 message UID list failed: %s"), g_strerror(errno));
-        result = FALSE;
-    }
-
-    g_mutex_unlock(&uid_mutex);
-    return result;
+       gchar *fname;
+       gboolean read_res;
+       gchar *contents = NULL;
+       FILE *out;
+       gboolean result;
+
+       fname = g_strconcat(g_get_home_dir(), POP_UID_FILE, NULL);
+
+       g_mutex_lock(&uid_mutex);
+       read_res = g_file_get_contents(fname, &contents, NULL, NULL);
+       out = fopen(fname, "w");
+       g_free(fname);
+       if (out != NULL) {
+               if (read_res) {
+                       gchar **lines;
+                       size_t prefix_len;
+                       guint n;
+
+                       lines = g_strsplit(contents, "\n", -1);
+                       g_free(contents);
+                       prefix_len = strlen(prefix);
+                       for (n = 0; lines[n] != NULL; n++) {
+                               if ((lines[n][0] != '\0') && (strncmp(lines[n], prefix, prefix_len) != 0)) {
+                                       fputs(lines[n], out);
+                                       fputc('\n', out);
+                               }
+                       }
+
+                       g_strfreev(lines);
+               }
+
+               if (uids != NULL) {
+                       g_hash_table_foreach(uids, mp_save_uid, out);
+               }
+               fclose(out);
+               result = TRUE;
+       } else {
+               g_set_error(error, MBOX_POP3_ERROR, errno, _("Saving the POP3 message UID list failed: %s"), 
g_strerror(errno));
+               result = FALSE;
+       }
+
+       g_mutex_unlock(&uid_mutex);
+       return result;
 }
 
 
 #ifdef POP_SYNC
 static int
-dump_cb(unsigned len,
-        char    *buf,
-        void    *arg)
+dump_cb(unsigned len, char *buf, void *arg)
 {
     /* FIXME: Bad things happen in the mh driver when messages are empty. */
-    return fwrite(buf, 1, len, (FILE *)arg) == len;
+    return fwrite(buf, 1, len, (FILE*)arg) == len;
 }
-
-
 #endif /* POP_SYNC */
 
 
 typedef struct {
-    gboolean filter;
-    GMimeStream *mbx_stream;            /* used if we store directly to a mailbox only */
-    FILE *filter_pipe;                          /* used of we write to a filter pipe only */
-    gchar *path;                                /* needed for error reporting only */
+       gboolean filter;
+       GMimeStream *mbx_stream;        /* used if we store directly to a mailbox only */
+       FILE *filter_pipe;                      /* used of we write to a filter pipe only */
+       gchar *path;                            /* needed for error reporting only */
 } pop_handler_t;
 
 
 static pop_handler_t *
 pop_handler_new(const gchar *filter_path,
-                GError     **error)
+                               GError     **error)
 {
-    pop_handler_t *res;
-
-    res = g_new0(pop_handler_t, 1U);
-    if (filter_path != NULL) {
-        res->filter = TRUE;
-        res->filter_pipe = popen(filter_path, "w");
-        if (res->filter_pipe == NULL) {
-            g_set_error(error, MBOX_POP3_ERROR, errno, _(
-                            "Passing POP message to %s failed: %s"), filter_path,
-                        g_strerror(errno));
-            g_free(res);
-            res = NULL;
-        } else {
-            res->path = g_strdup(filter_path);
-        }
-    } else {
-        res->mbx_stream = g_mime_stream_mem_new();
-    }
-
-    return res;
+       pop_handler_t *res;
+
+       res = g_new0(pop_handler_t, 1U);
+       if (filter_path != NULL) {
+               res->filter = TRUE;
+               res->filter_pipe = popen(filter_path, "w");
+               if (res->filter_pipe == NULL) {
+                       g_set_error(error, MBOX_POP3_ERROR, errno, _("Passing POP message to %s failed: %s"), 
filter_path, g_strerror(errno));
+                       g_free(res);
+                       res = NULL;
+               } else {
+                       res->path = g_strdup(filter_path);
+               }
+       } else {
+               res->mbx_stream = g_mime_stream_mem_new();
+       }
+
+       return res;
 }
 
 
 static gboolean
 pop_handler_write(pop_handler_t *handler,
-                  const gchar   *buffer,
-                  gsize          count,
-                  GError       **error)
+                                 const gchar   *buffer,
+                                 gsize          count,
+                                 GError       **error)
 {
-    gboolean result = TRUE;
-
-    if (handler->filter) {
-        if (fwrite(buffer, 1U, count, handler->filter_pipe) != count) {
-            g_set_error(error, MBOX_POP3_ERROR, errno, _(
-                            "Passing POP message to %s failed: %s"), handler->path,
-                        g_strerror(errno));
-            result = FALSE;
-        }
-    } else {
-        if (g_mime_stream_write(handler->mbx_stream, buffer, count) != (ssize_t) count) {
-            g_set_error(error, MBOX_POP3_ERROR, -1, _("Saving POP message failed"));
-            result = FALSE;
-        }
-    }
-    return result;
+       gboolean result = TRUE;
+
+       if (handler->filter) {
+               if (fwrite(buffer, 1U, count, handler->filter_pipe) != count) {
+                       g_set_error(error, MBOX_POP3_ERROR, errno, _("Passing POP message to %s failed: %s"), 
handler->path, g_strerror(errno));
+                       result = FALSE;
+               }
+       } else {
+               if (g_mime_stream_write(handler->mbx_stream, buffer, count) != (ssize_t) count) {
+                       g_set_error(error, MBOX_POP3_ERROR, -1, _("Saving POP message failed"));
+                       result = FALSE;
+               }
+       }
+       return result;
 }
 
 
 static gboolean
 pop_handler_close(pop_handler_t *handler,
-                  GError       **error)
+                                 GError       **error)
 {
-    gboolean result = TRUE;
-
-    if (handler->filter) {
-        int res;
-
-        res = pclose(handler->filter_pipe);
-        if (res != 0) {
-            g_set_error(error, MBOX_POP3_ERROR, errno,
-                        _("Transferring POP message to %s failed: %s"), handler->path,
-                        g_strerror(errno));
-            result = FALSE;
-        }
-    } else {
-        g_object_unref(G_OBJECT(handler->mbx_stream));
-    }
-    g_free(handler->path);
-    g_free(handler);
-    return result;
+       gboolean result = TRUE;
+
+       if (handler->filter) {
+               int res;
+
+               res = pclose(handler->filter_pipe);
+               if (res != 0) {
+                       g_set_error(error, MBOX_POP3_ERROR, errno, _("Transferring POP message to %s failed: 
%s"), handler->path,
+                               g_strerror(errno));
+                       result = FALSE;
+               }
+       } else {
+               g_object_unref(G_OBJECT(handler->mbx_stream));
+       }
+       g_free(handler->path);
+       g_free(handler);
+       return result;
 }
 
 
 /* ===================================================================
    Functions supporting asynchronous retrieval of messages.
- */
+*/
 struct fetch_data {
     LibBalsaMailbox *mailbox;
-    const gchar *filter_path;                           /* filter path, NULL for storing the
-                                                           message without filtering */
+    const gchar *filter_path;                          /* filter path, NULL for storing the message without 
filtering */
     gsize total_messages;
     gsize total_size;
     gchar *total_size_msg;
@@ -394,367 +374,334 @@ static void
 notify_progress(const struct fetch_data *fd)
 {
     gdouble fraction;
-    gchar *recvbuf;
-
-    fraction = (gdouble) fd->received / (gdouble) fd->total_size;
-    recvbuf = libbalsa_size_to_gchar(fd->received);
-    libbalsa_mailbox_progress_notify(fd->mailbox, LIBBALSA_NTFY_UPDATE, fraction,
-                                     _(
-                                         "Message %lu of %lu (%s of %s)"),
-                                     (unsigned long) fd->msgno, (unsigned long) fd->total_messages, recvbuf,
-                                     fd->total_size_msg);
-    g_free(recvbuf);
-}
+       gchar *recvbuf;
 
+       fraction = (gdouble) fd->received / (gdouble) fd->total_size;
+       recvbuf = libbalsa_size_to_gchar(fd->received);
+       libbalsa_mailbox_progress_notify(fd->mailbox, LIBBALSA_NTFY_UPDATE, fraction, _("Message %lu of %lu 
(%s of %s)"),
+               (unsigned long) fd->msgno, (unsigned long) fd->total_messages, recvbuf, fd->total_size_msg);
+       g_free(recvbuf);
+}
 
 static gboolean
-message_cb(const gchar                   *buffer,
-           gssize                         count,
-           gsize                          lines,
-           const NetClientPopMessageInfo *info,
-           gpointer                       user_data,
-           GError                       **error)
+message_cb(const gchar                    *buffer,
+                  gssize                          count,
+                  gsize                           lines,
+                  const NetClientPopMessageInfo  *info,
+                  gpointer                        user_data,
+                  GError                        **error)
 {
-    struct fetch_data *fd = (struct fetch_data *) user_data;
-    gboolean result = TRUE;
-
-    if (count > 0) {
-        /* message data chunk - initialise for a new message if the output does not exist */
-        if (fd->handler == NULL) {
-            fd->handler = pop_handler_new(fd->filter_path, error);
-
-            if (fd->handler == NULL) {
-                result = FALSE;
-            } else {
-                fd->msgno++;
-                fd->next_notify = g_get_monotonic_time();                               /* force
-                                                                                           immediate
-                                                                                           update
-                                                                                           of
-                                                                                           the
-                                                                                           progress
-                                                                                           dialogue
-                                                                                         */
-            }
-        }
-
-        /* add data if we were successful so far */
-        if (result) {
-            result = pop_handler_write(fd->handler, buffer, count, error);
-            if (result) {
-                gint64 current_time;
-
-                current_time = g_get_monotonic_time();
-                /* as the cr is removed from line endings, we have to compensate for it - see
-                   RFC 1939, sect. 11 */
-                fd->received += (gsize) count + lines;
-                if (current_time >= fd->next_notify) {
-                    notify_progress(fd);
-                    fd->next_notify = current_time + 500000;
-                }
-            }
-        }
-    } else if (count == 0) {
-        gboolean close_res;
-
-        notify_progress(fd);
-        if (fd->filter_path == NULL) {
-            GError *add_err = NULL;
-
-            g_mime_stream_reset(fd->handler->mbx_stream);
-            result = libbalsa_mailbox_add_message(LIBBALSA_MAILBOX_POP3(
-                                                      fd->mailbox)->inbox, fd->handler->mbx_stream,
-                                                  LIBBALSA_MESSAGE_FLAG_NEW | LIBBALSA_MESSAGE_FLAG_RECENT,
-                                                  &add_err);
-            if (!result) {
-                libbalsa_information(LIBBALSA_INFORMATION_WARNING,
-                                     _("Error appending message %d from %s to %s: %s"),
-                                     info->id, fd->mailbox->name,
-                                     LIBBALSA_MAILBOX_POP3(fd->mailbox)->inbox->name,
-                                     (add_err != NULL) ? add_err->message : "?");
-                g_error_free(add_err);
-            }
-        }
-
-        /* current message done */
-        close_res = pop_handler_close(fd->handler, error);
-        fd->handler = NULL;
-        result = close_res & result;
-    } else {
-        /* count < 0: error; note that the handler may already be NULL if the error occurred for
-           count == 0 */
-        if (fd->handler != NULL) {
-            (void) pop_handler_close(fd->handler, NULL);
-            fd->handler = NULL;
-        }
-        result = FALSE;
-    }
-
-    return result;
+       struct fetch_data *fd = (struct fetch_data *) user_data;
+       gboolean result = TRUE;
+
+       if (count > 0) {
+               /* message data chunk - initialise for a new message if the output does not exist */
+               if (fd->handler == NULL) {
+                       fd->handler = pop_handler_new(fd->filter_path, error);
+
+                       if (fd->handler == NULL) {
+                               result = FALSE;
+                       } else {
+                               fd->msgno++;
+                               fd->next_notify = g_get_monotonic_time();               /* force immediate 
update of the progress dialogue */
+                       }
+               }
+
+               /* add data if we were successful so far */
+               if (result) {
+                       result = pop_handler_write(fd->handler, buffer, count, error);
+                       if (result) {
+                               gint64 current_time;
+
+                               current_time = g_get_monotonic_time();
+                               /* as the cr is removed from line endings, we have to compensate for it - see 
RFC 1939, sect. 11 */
+                               fd->received += (gsize) count + lines;
+                               if (current_time >= fd->next_notify) {
+                                       notify_progress(fd);
+                                       fd->next_notify = current_time + 500000;
+                               }
+                       }
+               }
+       } else if (count == 0) {
+               gboolean close_res;
+
+               notify_progress(fd);
+               if (fd->filter_path == NULL) {
+                       GError *add_err = NULL;
+
+                   g_mime_stream_reset(fd->handler->mbx_stream);
+                   result = libbalsa_mailbox_add_message(LIBBALSA_MAILBOX_POP3(fd->mailbox)->inbox, 
fd->handler->mbx_stream,
+                       LIBBALSA_MESSAGE_FLAG_NEW | LIBBALSA_MESSAGE_FLAG_RECENT, &add_err);
+                   if (!result) {
+                       libbalsa_information(LIBBALSA_INFORMATION_WARNING, _("Error appending message %d from 
%s to %s: %s"),
+                               info->id, fd->mailbox->name, LIBBALSA_MAILBOX_POP3(fd->mailbox)->inbox->name,
+                                       (add_err != NULL) ? add_err->message : "?");
+                       g_error_free(add_err);
+                   }
+               }
+
+               /* current message done */
+               close_res = pop_handler_close(fd->handler, error);
+               fd->handler = NULL;
+               result = close_res & result;
+       } else {
+               /* count < 0: error; note that the handler may already be NULL if the error occurred for 
count == 0 */
+               if (fd->handler != NULL) {
+                       (void) pop_handler_close(fd->handler, NULL);
+                       fd->handler = NULL;
+               }
+               result = FALSE;
+       }
+
+       return result;
 }
 
 
 static NetClientPop *
 libbalsa_mailbox_pop3_startup(LibBalsaServer            *server,
-                              const LibBalsaMailboxPop3 *mbox,
-                              const gchar               *name,
-                              GList                    **msg_list)
+                                                         const LibBalsaMailboxPop3 *mbox,
+                                                         const gchar               *name,
+                                                         GList                    **msg_list)
 {
-    NetClientPop *pop;
-    GError *error = NULL;
-    guint allow_auth;
-
-    /* create the mailbox connection */
-    if (server->security == NET_CLIENT_CRYPT_ENCRYPTED) {
-        pop = net_client_pop_new(server->host, 995U, server->security, mbox->enable_pipe);
-    } else {
-        pop = net_client_pop_new(server->host, 110U, server->security, mbox->enable_pipe);
-    }
-    if (pop == NULL) {
-        return NULL;
-    }
-
-    /* configure the mailbox connection; allow all (including plain text) auth methods even for
-       unencrypted connections so using
-     * e.g. popfile on localhost is possible, i.e. the user is responsible for choosing a proper
-     * security mode */
-    allow_auth = NET_CLIENT_POP_AUTH_ALL;
-    if (mbox->disable_apop) {
-        allow_auth &= ~NET_CLIENT_POP_AUTH_APOP;
-    }
-    net_client_pop_allow_auth(pop, TRUE, allow_auth);
-    net_client_pop_allow_auth(pop, FALSE, allow_auth);
-    net_client_set_timeout(NET_CLIENT(pop), 60U);
-
-    /* load client certificate if configured */
-    if (server->client_cert) {
-        g_signal_connect(G_OBJECT(pop), "cert-pass", G_CALLBACK(
-                             libbalsa_server_get_cert_pass), server);
-        if (!net_client_set_cert_from_file(NET_CLIENT(pop), server->cert_file, &error)) {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _("Cannot load certificate file %s: %s"), server->cert_file,
-                                 error->message);
-            g_error_free(error);
-            g_object_unref(G_OBJECT(pop));
-            return NULL;
-        }
-    }
-
-    /* connect signals */
-    g_signal_connect(G_OBJECT(pop), "cert-check", G_CALLBACK(libbalsa_server_check_cert), pop);
-    g_signal_connect(G_OBJECT(pop), "auth", G_CALLBACK(libbalsa_server_get_auth), server);
-
-    /* connect server */
-    libbalsa_mailbox_progress_notify(LIBBALSA_MAILBOX(mbox), LIBBALSA_NTFY_INIT, INFINITY,
-                                     _("Connecting %s…"), server->host);
-    if (!net_client_pop_connect(pop, NULL, &error)) {
-        libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                             _("POP3 mailbox %s: cannot connect %s: %s"), name, server->host,
-                             error->message);
-        g_error_free(error);
-        net_client_shutdown(NET_CLIENT(pop));
-        g_object_unref(G_OBJECT(pop));
-        return NULL;
-    }
-
-    /* load message list */
-    libbalsa_mailbox_progress_notify(LIBBALSA_MAILBOX(mbox), LIBBALSA_NTFY_UPDATE, INFINITY,
-                                     _("List messages…"));
-    if (!net_client_pop_list(pop, msg_list, !mbox->delete_from_server, &error)) {
-        libbalsa_information(LIBBALSA_INFORMATION_ERROR, _(
-                                 "POP3 mailbox %s error: %s"), name, error->message);
-        g_error_free(error);
-        net_client_shutdown(NET_CLIENT(pop));
-        g_object_unref(G_OBJECT(pop));
-        pop = NULL;
-    }
-
-    return pop;
+       NetClientPop *pop;
+       GError *error = NULL;
+       guint allow_auth;
+
+       /* create the mailbox connection */
+       if (server->security == NET_CLIENT_CRYPT_ENCRYPTED) {
+               pop = net_client_pop_new(server->host, 995U, server->security, mbox->enable_pipe);
+       } else {
+               pop = net_client_pop_new(server->host, 110U, server->security, mbox->enable_pipe);
+       }
+       if (pop == NULL) {
+               return NULL;
+       }
+
+       /* configure the mailbox connection; allow all (including plain text) auth methods even for 
unencrypted connections so using
+        * e.g. popfile on localhost is possible, i.e. the user is responsible for choosing a proper security 
mode */
+       allow_auth = NET_CLIENT_POP_AUTH_ALL;
+       if (mbox->disable_apop) {
+               allow_auth &= ~NET_CLIENT_POP_AUTH_APOP;
+       }
+       net_client_pop_allow_auth(pop, TRUE, allow_auth);
+       net_client_pop_allow_auth(pop, FALSE, allow_auth);
+       net_client_set_timeout(NET_CLIENT(pop), 60U);
+
+       /* load client certificate if configured */
+       if (server->client_cert) {
+               g_signal_connect(G_OBJECT(pop), "cert-pass", G_CALLBACK(libbalsa_server_get_cert_pass), 
server);
+               if (!net_client_set_cert_from_file(NET_CLIENT(pop), server->cert_file, &error)) {
+                       libbalsa_information(LIBBALSA_INFORMATION_ERROR, _("Cannot load certificate file %s: 
%s"), server->cert_file,
+                               error->message);
+                       g_error_free(error);
+                       g_object_unref(G_OBJECT(pop));
+                       return NULL;
+               }
+       }
+
+       /* connect signals */
+       g_signal_connect(G_OBJECT(pop), "cert-check", G_CALLBACK(libbalsa_server_check_cert), pop);
+       g_signal_connect(G_OBJECT(pop), "auth", G_CALLBACK(libbalsa_server_get_auth), server);
+
+       /* connect server */
+       libbalsa_mailbox_progress_notify(LIBBALSA_MAILBOX(mbox), LIBBALSA_NTFY_INIT, INFINITY, _("Connecting 
%s…"), server->host);
+       if (!net_client_pop_connect(pop, NULL, &error)) {
+               libbalsa_information(LIBBALSA_INFORMATION_ERROR, _("POP3 mailbox %s: cannot connect %s: %s"), 
name, server->host,
+                       error->message);
+               g_error_free(error);
+               net_client_shutdown(NET_CLIENT(pop));
+               g_object_unref(G_OBJECT(pop));
+               return NULL;
+       }
+
+       /* load message list */
+       libbalsa_mailbox_progress_notify(LIBBALSA_MAILBOX(mbox), LIBBALSA_NTFY_UPDATE, INFINITY, _("List 
messages…"));
+       if (!net_client_pop_list(pop, msg_list, !mbox->delete_from_server, &error)) {
+               libbalsa_information(LIBBALSA_INFORMATION_ERROR, _("POP3 mailbox %s error: %s"), name, 
error->message);
+               g_error_free(error);
+               net_client_shutdown(NET_CLIENT(pop));
+               g_object_unref(G_OBJECT(pop));
+               pop = NULL;
+       }
+
+       return pop;
 }
 
 
 static GList *
 update_msg_list(struct fetch_data         *fd,
-                const LibBalsaMailboxPop3 *mbox,
-                GHashTable               **current_uids,
-                LibBalsaServer            *server,
-                GList                     *msg_list)
+                               const LibBalsaMailboxPop3 *mbox,
+                               GHashTable               **current_uids,
+                               LibBalsaServer            *server,
+                               GList                     *msg_list)
 {
-    GHashTable *uids = NULL;
-    gchar *uid_prefix = NULL;
-    size_t prefix_len = 0U;
-    GList *p;
-
-    /* load uid's if messages shall be left on the server */
-    if (!mbox->delete_from_server) {
-        uid_prefix = g_strconcat(server->user, "@", server->host, NULL);
-        prefix_len = strlen(uid_prefix);
-        uids = mp_load_uids(uid_prefix);
-        *current_uids = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
-    }
-
-    /* calculate totals, remove oversized messages, remember in the hash if required */
-    fd->total_messages = 0U;
-    fd->total_size = 0U;
-    p = msg_list;
-    while (p != NULL) {
-        NetClientPopMessageInfo *msg_info = (NetClientPopMessageInfo *) p->data;
-        gboolean skip = FALSE;
-        GList *next = p->next;
-
-        /* check for oversized message */
-        if ((mbox->msg_size_limit > 0) && (msg_info->size >= (gsize) mbox->msg_size_limit)) {
-            gchar *size_str;
-
-            size_str = libbalsa_size_to_gchar(msg_info->size);
-            libbalsa_information(LIBBALSA_INFORMATION_WARNING,
-                                 _("POP3 message %d oversized: %s — skipped."), msg_info->id,
-                                 size_str);
-            g_free(size_str);
-            skip = TRUE;
-        }
-
-        /* check if we already know this message */
-        if (!skip && !mbox->delete_from_server) {
-            gchar *full_uid = g_strconcat(uid_prefix, " ", msg_info->uid, NULL);
-
-            g_hash_table_insert(*current_uids, full_uid, GINT_TO_POINTER(1));
-            if (g_hash_table_lookup(uids, full_uid) != NULL) {
-                skip = TRUE;
-            }
-        }
-
-        /* delete from list if we want to skip the message, update totals otherwise */
-        if (skip) {
-            net_client_pop_msg_info_free(msg_info);
-            msg_list = g_list_delete_link(msg_list, p);
-        } else {
-            fd->total_messages++;
-            fd->total_size += msg_info->size;
-        }
-        p = next;
-    }
-
-    /* copy all keys /not/ starting with the prefix from the old to the current hash table, and
-       drop the old table */
-    if (!mbox->delete_from_server && (msg_list != NULL)) {
-        GHashTableIter iter;
-        gpointer key;
-
-        g_hash_table_iter_init(&iter, uids);
-        while (g_hash_table_iter_next(&iter, &key, NULL)) {
-            if (strncmp((const char *) key, uid_prefix, prefix_len) != 0) {
-                g_hash_table_insert(*current_uids, key, GINT_TO_POINTER(1));
-            }
-        }
-    }
-
-    g_free(uid_prefix);
-    if (uids != NULL) {
-        g_hash_table_destroy(uids);
-    }
-
-    return msg_list;
+       GHashTable *uids = NULL;
+       gchar *uid_prefix = NULL;
+       size_t prefix_len = 0U;
+       GList *p;
+
+       /* load uid's if messages shall be left on the server */
+       if (!mbox->delete_from_server) {
+               uid_prefix = g_strconcat(server->user, "@", server->host, NULL);
+               prefix_len = strlen(uid_prefix);
+               uids = mp_load_uids(uid_prefix);
+               *current_uids = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
+       }
+
+       /* calculate totals, remove oversized messages, remember in the hash if required */
+       fd->total_messages = 0U;
+       fd->total_size = 0U;
+       p = msg_list;
+       while (p != NULL) {
+               NetClientPopMessageInfo *msg_info = (NetClientPopMessageInfo*) p->data;
+               gboolean skip = FALSE;
+               GList* next = p->next;
+
+               /* check for oversized message */
+               if ((mbox->msg_size_limit > 0) && (msg_info->size >= (gsize) mbox->msg_size_limit)) {
+                       gchar *size_str;
+
+                       size_str = libbalsa_size_to_gchar(msg_info->size);
+                       libbalsa_information(LIBBALSA_INFORMATION_WARNING, _("POP3 message %d oversized: %s — 
skipped."), msg_info->id,
+                               size_str);
+                       g_free(size_str);
+                       skip = TRUE;
+               }
+
+               /* check if we already know this message */
+               if (!skip && !mbox->delete_from_server) {
+                       gchar *full_uid = g_strconcat(uid_prefix, " ", msg_info->uid, NULL);
+
+                       g_hash_table_insert(*current_uids, full_uid, GINT_TO_POINTER(1));
+                       if (g_hash_table_lookup(uids, full_uid) != NULL) {
+                               skip = TRUE;
+                       }
+               }
+
+               /* delete from list if we want to skip the message, update totals otherwise */
+               if (skip) {
+                       net_client_pop_msg_info_free(msg_info);
+                       msg_list = g_list_delete_link(msg_list, p);
+               } else {
+                       fd->total_messages++;
+                       fd->total_size += msg_info->size;
+               }
+               p = next;
+       }
+
+       /* copy all keys /not/ starting with the prefix from the old to the current hash table, and drop the 
old table */
+       if (!mbox->delete_from_server && (msg_list != NULL)) {
+               GHashTableIter iter;
+               gpointer key;
+
+               g_hash_table_iter_init(&iter, uids);
+               while (g_hash_table_iter_next(&iter, &key, NULL)) {
+                       if (strncmp((const char *) key, uid_prefix, prefix_len) != 0) {
+                               g_hash_table_insert(*current_uids, key, GINT_TO_POINTER(1));
+                       }
+               }
+       }
+
+       g_free(uid_prefix);
+       if (uids != NULL) {
+               g_hash_table_destroy(uids);
+       }
+
+       return msg_list;
 }
 
 
 static void
-libbalsa_mailbox_pop3_check(LibBalsaMailbox *mailbox)
+libbalsa_mailbox_pop3_check(LibBalsaMailbox * mailbox)
 {
-    LibBalsaMailboxPop3 *mbox = LIBBALSA_MAILBOX_POP3(mailbox);
-    LibBalsaServer *server;
-    NetClientPop *pop;
-    GList *msg_list;
-
-    if (!mbox->check || (mbox->inbox == NULL)) {
-        return;
-    }
-
-    server = LIBBALSA_MAILBOX_REMOTE_SERVER(mbox);
-
-    /* open the mailbox connection and get the messages list (note: initiates the progress
-       dialogue) */
-    pop = libbalsa_mailbox_pop3_startup(server, mbox, mailbox->name, &msg_list);
-
-    /* proceed on success only */
-    if (pop != NULL) {
-        struct fetch_data fd;
-        GHashTable *current_uids = NULL;
-        gboolean result = TRUE;
-        GError *err = NULL;
-
-        libbalsa_mailbox_progress_notify(mailbox, LIBBALSA_NTFY_UPDATE, INFINITY,
-                                         _("Connected to %s"),
-                                         net_client_get_host(NET_CLIENT(pop)));
-        memset(&fd, 0, sizeof(fd));
-
-        /* nothing to do if no messages are on the server */
-        if (msg_list != NULL) {
-            /* load uid's if messages shall be left on the server */
-            msg_list = update_msg_list(&fd, mbox, &current_uids, server, msg_list);
-        }
-
-        /* download messages unless the list is empty */
-        if (fd.total_messages > 0U) {
-            fd.mailbox = mailbox;
-            fd.total_size_msg = libbalsa_size_to_gchar(fd.total_size);
-
-            libbalsa_mailbox_progress_notify(mailbox, LIBBALSA_NTFY_UPDATE, 0.0,
-                                             ngettext("%lu new message (%s)",
-                                                      "%lu new messages (%s)",
-                                                      fd.total_messages),
-                                             (unsigned long) fd.total_messages,
-                                             fd.total_size_msg);
-
-            if (mbox->filter) {
-                fd.filter_path = mbox->filter_cmd;
-            }
-
-            if (result) {
-                result = net_client_pop_retr(pop, msg_list, message_cb, &fd, &err);
-                if (result && mbox->delete_from_server) {
-                    libbalsa_mailbox_progress_notify(mailbox, LIBBALSA_NTFY_UPDATE, INFINITY,
-                                                     _("Deleting messages on server…"));
-                    result = net_client_pop_dele(pop, msg_list, &err);
-                }
-            }
-
-            /* clean up */
-            g_free(fd.total_size_msg);
-            g_list_free_full(msg_list, (GDestroyNotify) net_client_pop_msg_info_free);
-        }
-
-        /* store uid list */
-        if (result && !mbox->delete_from_server) {
-            gchar *uid_prefix = g_strconcat(server->user, "@", server->host, NULL);
-
-            mp_save_uids(current_uids, uid_prefix, &err);
-            g_free(uid_prefix);
-            if (current_uids != NULL) {
-                g_hash_table_destroy(current_uids);
-            }
-        }
-
-        if (!result) {
-            net_client_shutdown(NET_CLIENT(pop));
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR, _("POP3 error: %s"),
-                                 err != NULL ? err->message : "?");
-            if (err != NULL) {
-                g_error_free(err);
-            }
-        }
-
-        /* done - clean up */
-        g_object_unref(G_OBJECT(pop));
-    }
-
-    libbalsa_mailbox_progress_notify(mailbox, LIBBALSA_NTFY_FINISHED, 1.0, _("Finished"));
+       LibBalsaMailboxPop3 *mbox = LIBBALSA_MAILBOX_POP3(mailbox);
+       LibBalsaServer *server;
+       NetClientPop *pop;
+       GList *msg_list;
+
+       if (!mbox->check || (mbox->inbox == NULL)) {
+               return;
+       }
+
+       server = LIBBALSA_MAILBOX_REMOTE_SERVER(mbox);
+
+       /* open the mailbox connection and get the messages list (note: initiates the progress dialogue) */
+       pop = libbalsa_mailbox_pop3_startup(server, mbox, mailbox->name, &msg_list);
+
+       /* proceed on success only */
+       if (pop != NULL) {
+               struct fetch_data fd;
+               GHashTable *current_uids = NULL;
+               gboolean result = TRUE;
+               GError *err = NULL;
+
+               libbalsa_mailbox_progress_notify(mailbox, LIBBALSA_NTFY_UPDATE, INFINITY,
+                       _("Connected to %s"), net_client_get_host(NET_CLIENT(pop)));
+               memset(&fd, 0, sizeof(fd));
+
+               /* nothing to do if no messages are on the server */
+               if (msg_list != NULL) {
+                       /* load uid's if messages shall be left on the server */
+                       msg_list = update_msg_list(&fd, mbox, &current_uids, server, msg_list);
+               }
+
+               /* download messages unless the list is empty */
+               if (fd.total_messages > 0U) {
+                       fd.mailbox = mailbox;
+                       fd.total_size_msg = libbalsa_size_to_gchar(fd.total_size);
+
+                       libbalsa_mailbox_progress_notify(mailbox, LIBBALSA_NTFY_UPDATE, 0.0,
+                               ngettext("%lu new message (%s)", "%lu new messages (%s)", fd.total_messages),
+                               (unsigned long) fd.total_messages, fd.total_size_msg);
+
+                       if (mbox->filter) {
+                               fd.filter_path = mbox->filter_cmd;
+                       }
+
+                       if (result) {
+                               result = net_client_pop_retr(pop, msg_list, message_cb, &fd, &err);
+                               if (result && mbox->delete_from_server) {
+                                       libbalsa_mailbox_progress_notify(mailbox, LIBBALSA_NTFY_UPDATE, 
INFINITY,
+                                               _("Deleting messages on server…"));
+                                       result = net_client_pop_dele(pop, msg_list, &err);
+                               }
+                       }
+
+                       /* clean up */
+                       g_free(fd.total_size_msg);
+                       g_list_free_full(msg_list, (GDestroyNotify) net_client_pop_msg_info_free);
+               }
+
+               /* store uid list */
+               if (result && !mbox->delete_from_server) {
+                       gchar *uid_prefix = g_strconcat(server->user, "@", server->host, NULL);
+
+                       mp_save_uids(current_uids, uid_prefix, &err);
+                       g_free(uid_prefix);
+                       if (current_uids != NULL) {
+                               g_hash_table_destroy(current_uids);
+                       }
+               }
+
+               if (!result) {
+                       net_client_shutdown(NET_CLIENT(pop));
+                       libbalsa_information(LIBBALSA_INFORMATION_ERROR, _("POP3 error: %s"),
+                                             err != NULL ? err->message : "?");
+                       if (err != NULL)
+                               g_error_free(err);
+               }
+
+               /* done - clean up */
+               g_object_unref(G_OBJECT(pop));
+       }
+
+       libbalsa_mailbox_progress_notify(mailbox, LIBBALSA_NTFY_FINISHED, 1.0, _("Finished"));
 }
 
 
 static void
-libbalsa_mailbox_pop3_save_config(LibBalsaMailbox *mailbox,
-                                  const gchar     *prefix)
+libbalsa_mailbox_pop3_save_config(LibBalsaMailbox * mailbox,
+                                 const gchar * prefix)
 {
     LibBalsaMailboxPop3 *pop;
 
@@ -769,20 +716,17 @@ libbalsa_mailbox_pop3_save_config(LibBalsaMailbox *mailbox,
     libbalsa_conf_set_bool("DisableApop", pop->disable_apop);
     libbalsa_conf_set_bool("EnablePipe", pop->enable_pipe);
     libbalsa_conf_set_bool("Filter", pop->filter);
-    if (pop->filter_cmd) {
+    if(pop->filter_cmd)
         libbalsa_conf_set_string("FilterCmd", pop->filter_cmd);
-    }
 
-    if (LIBBALSA_MAILBOX_CLASS(parent_class)->save_config) {
-        LIBBALSA_MAILBOX_CLASS(parent_class)->save_config(mailbox, prefix);
-    }
+    if (LIBBALSA_MAILBOX_CLASS(parent_class)->save_config)
+       LIBBALSA_MAILBOX_CLASS(parent_class)->save_config(mailbox, prefix);
 
 }
 
-
 static void
-libbalsa_mailbox_pop3_load_config(LibBalsaMailbox *mailbox,
-                                  const gchar     *prefix)
+libbalsa_mailbox_pop3_load_config(LibBalsaMailbox * mailbox,
+                                 const gchar * prefix)
 {
     LibBalsaMailboxPop3 *pop;
 
@@ -798,18 +742,14 @@ libbalsa_mailbox_pop3_load_config(LibBalsaMailbox *mailbox,
     pop->enable_pipe = libbalsa_conf_get_bool("EnablePipe=false");
     pop->filter = libbalsa_conf_get_bool("Filter=false");
     pop->filter_cmd = libbalsa_conf_get_string("FilterCmd");
-    if (pop->filter_cmd && (*pop->filter_cmd == '\0')) {
-        g_free(pop->filter_cmd);
-        pop->filter_cmd = NULL;
+    if(pop->filter_cmd && *pop->filter_cmd == '\0') {
+       g_free(pop->filter_cmd); pop->filter_cmd = NULL;
     }
 
-    if (LIBBALSA_MAILBOX_CLASS(parent_class)->load_config) {
-        LIBBALSA_MAILBOX_CLASS(parent_class)->load_config(mailbox, prefix);
-    }
+    if (LIBBALSA_MAILBOX_CLASS(parent_class)->load_config)
+       LIBBALSA_MAILBOX_CLASS(parent_class)->load_config(mailbox, prefix);
 
 }
-
-
 void
 libbalsa_mailbox_pop3_set_inbox(LibBalsaMailbox *mailbox,
                                 LibBalsaMailbox *inbox)
@@ -820,13 +760,12 @@ libbalsa_mailbox_pop3_set_inbox(LibBalsaMailbox *mailbox,
 
     pop = LIBBALSA_MAILBOX_POP3(mailbox);
 
-    pop->inbox = inbox;
+       pop->inbox=inbox;
 }
 
-
 void
 libbalsa_mailbox_pop3_set_msg_size_limit(LibBalsaMailboxPop3 *pop,
-                                         gint                 sz_limit)
+                                         gint sz_limit)
 {
     pop->msg_size_limit = sz_limit;
 }
diff --git a/libbalsa/mailbox_pop3.h b/libbalsa/mailbox_pop3.h
index ce94dff..1e345a2 100644
--- a/libbalsa/mailbox_pop3.h
+++ b/libbalsa/mailbox_pop3.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -49,7 +49,7 @@ struct _LibBalsaMailboxPop3 {
     gint msg_size_limit;
     gboolean filter; /* filter through procmail/filter_cmd? */
     gboolean disable_apop; /* Some servers claim to support it but
-                            * they do not. */
+                              * they do not. */
     gboolean enable_pipe;  /* ditto */
 };
 
@@ -57,6 +57,6 @@ LibBalsaMailboxPop3 *libbalsa_mailbox_pop3_new(void);
 void libbalsa_mailbox_pop3_set_inbox(LibBalsaMailbox *mailbox,
                                      LibBalsaMailbox *inbox);
 void libbalsa_mailbox_pop3_set_msg_size_limit(LibBalsaMailboxPop3 *mailbox,
-                                              gint                 sz_limit);
+                                              gint sz_limit);
 
-#endif                          /* __LIBBALSA_MAILBOX_POP3_H__ */
+#endif                         /* __LIBBALSA_MAILBOX_POP3_H__ */
diff --git a/libbalsa/mailbox_remote.c b/libbalsa/mailbox_remote.c
index 6e3cd44..815c003 100644
--- a/libbalsa/mailbox_remote.c
+++ b/libbalsa/mailbox_remote.c
@@ -6,31 +6,31 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include "libbalsa.h"
 #include "server.h"
 
 static void libbalsa_mailbox_remote_class_init(LibBalsaMailboxRemoteClass *
-                                               klass);
-static void libbalsa_mailbox_remote_init(LibBalsaMailboxRemote *mailbox);
-static void libbalsa_mailbox_remote_test_can_reach(LibBalsaMailbox          *mailbox,
-                                                   LibBalsaCanReachCallback *cb,
-                                                   gpointer                  cb_data);
+                                              klass);
+static void libbalsa_mailbox_remote_init(LibBalsaMailboxRemote * mailbox);
+static void libbalsa_mailbox_remote_test_can_reach(LibBalsaMailbox          * mailbox,
+                                                   LibBalsaCanReachCallback * cb,
+                                                   gpointer                   cb_data);
 
 GType
 libbalsa_mailbox_remote_get_type(void)
@@ -38,30 +38,29 @@ libbalsa_mailbox_remote_get_type(void)
     static GType mailbox_type = 0;
 
     if (!mailbox_type) {
-        static const GTypeInfo mailbox_info = {
-            sizeof(LibBalsaMailboxClass),
+       static const GTypeInfo mailbox_info = {
+           sizeof(LibBalsaMailboxClass),
             NULL,               /* base_init */
             NULL,               /* base_finalize */
-            (GClassInitFunc) libbalsa_mailbox_remote_class_init,
+           (GClassInitFunc) libbalsa_mailbox_remote_class_init,
             NULL,               /* class_finalize */
             NULL,               /* class_data */
-            sizeof(LibBalsaMailbox),
+           sizeof(LibBalsaMailbox),
             0,                  /* n_preallocs */
-            (GInstanceInitFunc) libbalsa_mailbox_remote_init
-        };
+           (GInstanceInitFunc) libbalsa_mailbox_remote_init
+       };
 
-        mailbox_type =
-            g_type_register_static(LIBBALSA_TYPE_MAILBOX,
-                                   "LibBalsaMailboxRemote",
+       mailbox_type =
+           g_type_register_static(LIBBALSA_TYPE_MAILBOX,
+                                  "LibBalsaMailboxRemote",
                                    &mailbox_info, 0);
     }
 
     return mailbox_type;
 }
 
-
 static void
-libbalsa_mailbox_remote_class_init(LibBalsaMailboxRemoteClass *klass)
+libbalsa_mailbox_remote_class_init(LibBalsaMailboxRemoteClass * klass)
 {
     LibBalsaMailboxClass *libbalsa_mailbox_class;
 
@@ -71,31 +70,27 @@ libbalsa_mailbox_remote_class_init(LibBalsaMailboxRemoteClass *klass)
         libbalsa_mailbox_remote_test_can_reach;
 }
 
-
 static void
-libbalsa_mailbox_remote_init(LibBalsaMailboxRemote *mailbox)
+libbalsa_mailbox_remote_init(LibBalsaMailboxRemote * mailbox)
 {
     mailbox->server = NULL;
 }
 
-
 /* Test whether a mailbox is reachable */
 
 static void
-libbalsa_mailbox_remote_test_can_reach(LibBalsaMailbox          *mailbox,
-                                       LibBalsaCanReachCallback *cb,
-                                       gpointer                  cb_data)
+libbalsa_mailbox_remote_test_can_reach(LibBalsaMailbox          * mailbox,
+                                       LibBalsaCanReachCallback * cb,
+                                       gpointer                   cb_data)
 {
     libbalsa_server_test_can_reach_full(LIBBALSA_MAILBOX_REMOTE(mailbox)->server,
                                         cb, cb_data, (GObject *) mailbox);
 }
 
-
 /* Public method */
 
-void
-libbalsa_mailbox_remote_set_server(LibBalsaMailboxRemote *m,
-                                   LibBalsaServer        *s)
+void 
+libbalsa_mailbox_remote_set_server(LibBalsaMailboxRemote *m, LibBalsaServer *s)
 {
     g_set_object(&m->server, s);
 }
diff --git a/libbalsa/mailbox_remote.h b/libbalsa/mailbox_remote.h
index 9a95fc6..1e9594f 100644
--- a/libbalsa/mailbox_remote.h
+++ b/libbalsa/mailbox_remote.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -24,8 +24,8 @@
 
 #include "libbalsa.h"
 
-/* Imap and Pop3 are remote mailboxes
-
+/* Imap and Pop3 are remote mailboxes 
+   
    this object doesn't do any real work.  it is abstract
 
      this mini-struct greatly helps in getting the server
@@ -63,7 +63,7 @@ struct _LibBalsaMailboxRemoteClass {
 
 GType libbalsa_mailbox_remote_get_type(void);
 
-void libbalsa_mailbox_remote_set_server(LibBalsaMailboxRemote *m,
-                                        LibBalsaServer        *s);
+void libbalsa_mailbox_remote_set_server(LibBalsaMailboxRemote* m, 
+                                       LibBalsaServer* s);
 
-#endif                          /* __LIBBALSA_MAILBOX_REMOTE_H__ */
+#endif                         /* __LIBBALSA_MAILBOX_REMOTE_H__ */
diff --git a/libbalsa/message.c b/libbalsa/message.c
index b10b490..949eaf6 100644
--- a/libbalsa/message.c
+++ b/libbalsa/message.c
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -26,10 +26,10 @@
    - Lack of inline functions in C increases program complexity. This cost
    can be accepted.
    - thorough analysis of memory usage is needed.
- */
-
+*/
+   
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <ctype.h>
@@ -49,11 +49,11 @@
 
 #include <gmime/gmime.h>
 
-static void libbalsa_message_class_init(LibBalsaMessageClass *klass);
-static void libbalsa_message_init(LibBalsaMessage *message);
+static void libbalsa_message_class_init(LibBalsaMessageClass * klass);
+static void libbalsa_message_init(LibBalsaMessage * message);
 
-static void libbalsa_message_dispose(GObject *object);
-static void libbalsa_message_finalize(GObject *object);
+static void libbalsa_message_dispose(GObject * object);
+static void libbalsa_message_finalize(GObject * object);
 
 
 static GObjectClass *parent_class = NULL;
@@ -64,29 +64,28 @@ libbalsa_message_get_type()
     static GType libbalsa_message_type = 0;
 
     if (!libbalsa_message_type) {
-        static const GTypeInfo libbalsa_message_info = {
-            sizeof(LibBalsaMessageClass),
+       static const GTypeInfo libbalsa_message_info = {
+           sizeof(LibBalsaMessageClass),
             NULL,               /* base_init */
             NULL,               /* base_finalize */
-            (GClassInitFunc) libbalsa_message_class_init,
+           (GClassInitFunc) libbalsa_message_class_init,
             NULL,               /* class_finalize */
             NULL,               /* class_data */
-            sizeof(LibBalsaMessage),
+           sizeof(LibBalsaMessage),
             0,                  /* n_preallocs */
-            (GInstanceInitFunc) libbalsa_message_init
-        };
+           (GInstanceInitFunc) libbalsa_message_init
+       };
 
-        libbalsa_message_type =
-            g_type_register_static(G_TYPE_OBJECT, "LibBalsaMessage",
+       libbalsa_message_type =
+           g_type_register_static(G_TYPE_OBJECT, "LibBalsaMessage",
                                    &libbalsa_message_info, 0);
     }
 
     return libbalsa_message_type;
 }
 
-
 static void
-libbalsa_message_init(LibBalsaMessage *message)
+libbalsa_message_init(LibBalsaMessage * message)
 {
     message->headers = g_new0(LibBalsaMessageHeaders, 1);
     message->flags = 0;
@@ -109,7 +108,7 @@ libbalsa_message_init(LibBalsaMessage *message)
 
 
 static void
-libbalsa_message_class_init(LibBalsaMessageClass *klass)
+libbalsa_message_class_init(LibBalsaMessageClass * klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS(klass);
 
@@ -119,7 +118,6 @@ libbalsa_message_class_init(LibBalsaMessageClass *klass)
     object_class->finalize = libbalsa_message_finalize;
 }
 
-
 LibBalsaMessage *
 libbalsa_message_new(void)
 {
@@ -130,12 +128,11 @@ libbalsa_message_new(void)
     return message;
 }
 
-
 /*
  * libbalsa_message_dispose: must leave object in a sane state
  */
 static void
-libbalsa_message_dispose(GObject *object)
+libbalsa_message_dispose(GObject * object)
 {
     LibBalsaMessage *message;
 
@@ -152,9 +149,9 @@ libbalsa_message_dispose(GObject *object)
 
 
 /* libbalsa_message_finalize:
- */
+*/
 static void
-libbalsa_message_finalize(GObject *object)
+libbalsa_message_finalize(GObject * object)
 {
     LibBalsaMessage *message;
 
@@ -174,18 +171,16 @@ libbalsa_message_finalize(GObject *object)
     libbalsa_message_body_free(message->body_list);
 
     if (message->tempdir) {
-        if (rmdir(message->tempdir) != 0) {
+        if (rmdir(message->tempdir) != 0)
             g_warning("Could not remove %s", message->tempdir);
-        }
         g_free(message->tempdir);
     }
 
     G_OBJECT_CLASS(parent_class)->finalize(object);
 }
 
-
 static void
-lb_message_headers_extra_destroy(LibBalsaMessageHeaders *headers)
+lb_message_headers_extra_destroy(LibBalsaMessageHeaders * headers)
 {
     if (headers != NULL) {
         libbalsa_clear_list(&headers->user_hdrs, (GDestroyNotify) g_strfreev);
@@ -193,13 +188,11 @@ lb_message_headers_extra_destroy(LibBalsaMessageHeaders *headers)
     }
 }
 
-
-void
-libbalsa_message_headers_destroy(LibBalsaMessageHeaders *headers)
+void 
+libbalsa_message_headers_destroy(LibBalsaMessageHeaders * headers)
 {
-    if (!headers) {
-        return;
-    }
+    if (!headers)
+       return;
 
     g_free(headers->subject);
     headers->subject = NULL;
@@ -217,21 +210,17 @@ libbalsa_message_headers_destroy(LibBalsaMessageHeaders *headers)
     g_free(headers);
 }
 
-
 const gchar *
-libbalsa_message_body_charset(LibBalsaMessageBody *body)
+libbalsa_message_body_charset(LibBalsaMessageBody * body)
 {
     const gchar *charset;
 
-    if (!body) {
-        return NULL;
-    }
+    if (!body)
+       return NULL;
 
-    if (body->charset) {
-        /* This overrides all! Important for non
-         * us-ascii messages over IMAP. */
+    if (body->charset) /* This overrides all! Important for non
+                        * us-ascii messages over IMAP. */
         return body->charset;
-    }
 
     if (GMIME_IS_PART(body->mime_part)) {
         GMimeContentType *type;
@@ -241,14 +230,12 @@ libbalsa_message_body_charset(LibBalsaMessageBody *body)
     }
 
     charset = libbalsa_message_body_charset(body->parts);
-    if (charset) {
+    if (charset)
         return charset;
-    }
 
     return libbalsa_message_body_charset(body->next);
 }
 
-
 /* UTF-8-aware header cleaning by Albrecht */
 static void
 canonize_header_value(gchar *value)
@@ -273,16 +260,14 @@ canonize_header_value(gchar *value)
     *dptr = '\0';
 }
 
-
 /* message_user_hdrs:
    returns allocated GList containing (header=>value) ALL headers pairs
    as generated by g_strsplit.
    The list has to be freed by the following chunk of code:
    g_list_free_full(list, (GDestroyNotify) g_strfreev)
- */
+*/
 static gchar **
-libbalsa_create_hdr_pair(const gchar *name,
-                         gchar       *value)
+libbalsa_create_hdr_pair(const gchar * name, gchar * value)
 {
     gchar **item = g_new(gchar *, 3);
 
@@ -293,103 +278,89 @@ libbalsa_create_hdr_pair(const gchar *name,
     return item;
 }
 
-
-static GList *
-libbalsa_message_header_get_helper(LibBalsaMessageHeaders *headers,
-                                   const gchar            *find)
+static GList*
+libbalsa_message_header_get_helper(LibBalsaMessageHeaders* headers,
+                                   const gchar *find)
 {
     GList *list;
     for (list = headers->user_hdrs; list; list = list->next) {
-        const gchar *const *tmp = list->data;
-
-        if (g_ascii_strcasecmp(tmp[0], find) == 0) {
+        const gchar * const *tmp = list->data;
+        
+        if (g_ascii_strcasecmp(tmp[0], find) == 0) 
             return list;
-        }
     }
     return NULL;
 }
 
-
 /** libbalsa_message_find_user_hdr:
     returns.... list element matching given header.
- */
+*/
 static GList *
-libbalsa_message_find_user_hdr(LibBalsaMessage *message,
-                               const gchar     *find)
+libbalsa_message_find_user_hdr(LibBalsaMessage * message, const gchar * find)
 {
     LibBalsaMessageHeaders *headers = message->headers;
-
+    
     g_return_val_if_fail(headers, NULL);
-    if (!headers->user_hdrs && message->mailbox) {
+    if (!headers->user_hdrs && message->mailbox) 
         libbalsa_mailbox_set_msg_headers(message->mailbox, message);
-    }
 
     return libbalsa_message_header_get_helper(headers, find);
 }
 
-
-/*
+/* 
  * Public user header methods
  */
-const gchar *
-libbalsa_message_header_get_one(LibBalsaMessageHeaders *headers,
-                                const gchar            *find)
+const gchar*
+libbalsa_message_header_get_one(LibBalsaMessageHeaders* headers,
+                                const gchar *find)
 {
     GList *header;
     const gchar *const *pair;
-
-    if (!(header = libbalsa_message_header_get_helper(headers, find))) {
+    
+    if (!(header = libbalsa_message_header_get_helper(headers, find)))
         return NULL;
-    }
 
     pair = header->data;
     return pair[1];
 }
 
-
-GList *
-libbalsa_message_header_get_all(LibBalsaMessageHeaders *headers,
-                                const gchar            *find)
+GList*
+libbalsa_message_header_get_all(LibBalsaMessageHeaders* headers,
+                                const gchar *find)
 {
     GList *header;
     const gchar *const *pair;
     GList *res = NULL;
-
-    if (!(header = libbalsa_message_header_get_helper(headers, find))) {
+    
+    if (!(header = libbalsa_message_header_get_helper(headers, find)))
         return NULL;
-    }
     pair = header->data;
-    for (pair++; *pair; pair++) {
+    for(pair++; *pair; pair++)
         res = g_list_append(res, g_strdup(*pair));
-    }
-
+    
     return res;
 }
 
-
 const gchar *
-libbalsa_message_get_user_header(LibBalsaMessage *message,
-                                 const gchar     *name)
+libbalsa_message_get_user_header(LibBalsaMessage * message,
+                                 const gchar * name)
 {
     GList *header;
     const gchar *const *pair;
-
+    
     g_return_val_if_fail(LIBBALSA_IS_MESSAGE(message), NULL);
     g_return_val_if_fail(name != NULL, NULL);
 
-    if (!(header = libbalsa_message_find_user_hdr(message, name))) {
+    if (!(header = libbalsa_message_find_user_hdr(message, name)))
         return NULL;
-    }
 
     pair = header->data;
     return pair[1];
 }
 
-
 void
-libbalsa_message_set_user_header(LibBalsaMessage *message,
-                                 const gchar     *name,
-                                 const gchar     *value)
+libbalsa_message_set_user_header(LibBalsaMessage * message,
+                                 const gchar * name, const gchar * value)
 {
     LibBalsaMessageHeaders *headers;
     GList *header;
@@ -406,15 +377,13 @@ libbalsa_message_set_user_header(LibBalsaMessage *message,
         g_list_free_full(header, (GDestroyNotify) g_strfreev);
     }
 
-    if (value && *value) {
+    if (value && *value)
         headers->user_hdrs =
             g_list_prepend(headers->user_hdrs,
                            libbalsa_create_hdr_pair(name,
                                                     g_strdup(value)));
-    }
 }
 
-
 static GList *
 prepend_header_misc(GList      *res,
                     const char *name,
@@ -427,20 +396,18 @@ prepend_header_misc(GList      *res,
         "disposition-notification-to";
     unsigned i;
 
-    if (value[0] == '\0') {
-        /* Empty header */
-        return res;
-    }
+    if (value[0] == '\0')
+       /* Empty header */
+       return res;
 
     /* Standard Headers*/
-    for (i = 0; i < sizeof(lcname) - 1 && name[i] != '\0'; i++) {
+    for(i = 0; i < sizeof(lcname) - 1 && name[i] != '\0'; i++) {
         lcname[i] = tolower(name[i]);
     }
     lcname[i] = '\0';
 
-    if (strstr(ignored_headers, lcname) != NULL) {
+    if(strstr(ignored_headers, lcname) != NULL)
         return res;
-    }
 
     return
         g_list_prepend(res,
@@ -448,19 +415,18 @@ prepend_header_misc(GList      *res,
                                                 g_mime_utils_header_decode_text(value)));
 }
 
-
-/*
+/* 
  * libbalsa_message_user_hdrs_from_gmime:
- *
+ * 
  * returns allocated GList containing (header=>value) ALL headers
  * pairs as generated by g_strsplit. The list has to be freed by the
  * following chunk of code (or something functionally similar):
  * g_list_free_full(list, (GDestroyNotify) g_strfreev)
- */
+*/
 
 
 GList *
-libbalsa_message_user_hdrs_from_gmime(GMimeMessage *message)
+libbalsa_message_user_hdrs_from_gmime(GMimeMessage * message)
 {
     GMimeHeaderList *hdrlist;
     GMimeHeaderIter iter;
@@ -470,31 +436,30 @@ libbalsa_message_user_hdrs_from_gmime(GMimeMessage *message)
     g_return_val_if_fail(message != NULL, NULL);
 
     value = g_mime_message_get_message_id(message);
-    if (value) {
-        res = g_list_prepend(res, libbalsa_create_hdr_pair("Message-ID",
-                                                           g_strdup_printf("<%s>", value)));
-    }
+    if (value)
+       res = g_list_prepend(res, libbalsa_create_hdr_pair("Message-ID",
+                                         g_strdup_printf("<%s>", value)));
 
     /* FIXME: This duplicates References headers since they are
        already present in LibBalsaMessage::references field.  FWIW,
        mailbox driver does not copy references to user_headers.
-     */
+    */
     value = g_mime_object_get_header(GMIME_OBJECT(message), "References");
     if (value) {
 #if BALSA_NEEDS_SEPARATE_USER_HEADERS
-        GMimeReferences *references, *reference;
-        reference = references = g_mime_references_decode(value);
-        while (reference) {
-            res =
-                g_list_prepend(res,
-                               libbalsa_create_hdr_pair("References",
-                                                        g_strdup_printf
-                                                            ("<%s>",
-                                                            reference->
-                                                            msgid)));
-            reference = reference->next;
-        }
-        g_mime_references_clear(&references);
+       GMimeReferences *references, *reference;
+       reference = references = g_mime_references_decode(value);
+       while (reference) {
+           res =
+               g_list_prepend(res,
+                              libbalsa_create_hdr_pair("References",
+                                                       g_strdup_printf
+                                                       ("<%s>",
+                                                        reference->
+                                                        msgid)));
+           reference = reference->next;
+       }
+       g_mime_references_clear(&references);
 #else
         res = g_list_prepend(res,
                              libbalsa_create_hdr_pair("References",
@@ -507,41 +472,37 @@ libbalsa_message_user_hdrs_from_gmime(GMimeMessage *message)
         res =
             g_list_prepend(res,
                            libbalsa_create_hdr_pair
-                               ("In-Reply-To",
-                               g_mime_utils_header_decode_text(value)));
+                           ("In-Reply-To",
+                            g_mime_utils_header_decode_text(value)));
     }
 
     hdrlist = g_mime_object_get_header_list (GMIME_OBJECT(message));
     if (g_mime_header_list_get_iter (hdrlist, &iter)) {
-        do {
+       do {
             res = prepend_header_misc(res,
                                       g_mime_header_iter_get_name (&iter),
                                       g_mime_header_iter_get_value (&iter));
-        } while (g_mime_header_iter_next (&iter));
+       } while (g_mime_header_iter_next (&iter));
     }
-
+    
     return g_list_reverse(res);
 }
 
-
 /* libbalsa_message_get_part_by_id:
    return a message part identified by Content-ID=id
    message must be referenced. (FIXME?)
- */
+*/
 LibBalsaMessageBody *
-libbalsa_message_get_part_by_id(LibBalsaMessage *msg,
-                                const gchar     *id)
+libbalsa_message_get_part_by_id(LibBalsaMessage* msg, const gchar* id)
 {
     return libbalsa_message_body_get_by_id(msg->body_list, id);
 }
 
-
 /* libbalsa_message_save:
    return TRUE on success and FALSE on failure.
- */
+*/
 gboolean
-libbalsa_message_save(LibBalsaMessage *message,
-                      const gchar     *filename)
+libbalsa_message_save(LibBalsaMessage * message, const gchar *filename)
 {
     FILE *outfile;
     int res;
@@ -550,15 +511,12 @@ libbalsa_message_save(LibBalsaMessage *message,
 
     g_return_val_if_fail(message->mailbox, FALSE);
 
-    if ((outfile = fopen(filename, "w")) == NULL) {
-        return FALSE;
-    }
+    if( (outfile = fopen(filename, "w")) == NULL) return FALSE;
     g_return_val_if_fail(outfile, FALSE);
 
     msg_stream = libbalsa_message_stream(message);
-    if (msg_stream == NULL) {
-        return FALSE;
-    }
+    if (msg_stream == NULL)
+       return FALSE;
     out_stream = g_mime_stream_file_new(outfile);
     libbalsa_mailbox_lock_store(message->mailbox);
     res = g_mime_stream_write_to_stream(msg_stream, out_stream);
@@ -570,44 +528,37 @@ libbalsa_message_save(LibBalsaMessage *message,
     return res >= 0;
 }
 
-
 LibBalsaMessageAttach
-libbalsa_message_get_attach_icon(LibBalsaMessage *message)
+libbalsa_message_get_attach_icon(LibBalsaMessage * message)
 {
 #ifdef HAVE_GPGME
-    if (libbalsa_message_is_pgp_encrypted(message)) {
-        return LIBBALSA_MESSAGE_ATTACH_ENCR;
-    } else if ((message->prot_state != LIBBALSA_MSG_PROTECT_NONE) ||
-               libbalsa_message_is_pgp_signed(message)) {
-        switch (message->prot_state) {
-        case LIBBALSA_MSG_PROTECT_SIGN_GOOD:
-            return LIBBALSA_MESSAGE_ATTACH_GOOD;
-
-        case LIBBALSA_MSG_PROTECT_SIGN_NOTRUST:
-            return LIBBALSA_MESSAGE_ATTACH_NOTRUST;
-
-        case LIBBALSA_MSG_PROTECT_SIGN_BAD:
-            return LIBBALSA_MESSAGE_ATTACH_BAD;
-
-        case LIBBALSA_MSG_PROTECT_CRYPT:
-            return LIBBALSA_MESSAGE_ATTACH_ENCR;
-
-        default:
-            return LIBBALSA_MESSAGE_ATTACH_SIGN;
-        }
+    if (libbalsa_message_is_pgp_encrypted(message))
+       return LIBBALSA_MESSAGE_ATTACH_ENCR;
+    else if (message->prot_state != LIBBALSA_MSG_PROTECT_NONE ||
+       libbalsa_message_is_pgp_signed(message)) {
+       switch (message->prot_state) {
+       case LIBBALSA_MSG_PROTECT_SIGN_GOOD:
+           return LIBBALSA_MESSAGE_ATTACH_GOOD;
+       case LIBBALSA_MSG_PROTECT_SIGN_NOTRUST:
+           return LIBBALSA_MESSAGE_ATTACH_NOTRUST;
+       case LIBBALSA_MSG_PROTECT_SIGN_BAD:
+           return LIBBALSA_MESSAGE_ATTACH_BAD;
+       case LIBBALSA_MSG_PROTECT_CRYPT:
+           return LIBBALSA_MESSAGE_ATTACH_ENCR;
+       default:
+           return LIBBALSA_MESSAGE_ATTACH_SIGN;
+       }
     } else
 #endif
-    if (libbalsa_message_has_attachment(message)) {
-        return LIBBALSA_MESSAGE_ATTACH_ATTACH;
-    } else {
-        return LIBBALSA_MESSAGE_ATTACH_ICONS_NUM;
-    }
+    if (libbalsa_message_has_attachment(message))
+       return LIBBALSA_MESSAGE_ATTACH_ATTACH;
+    else
+       return LIBBALSA_MESSAGE_ATTACH_ICONS_NUM;
 }
 
-
 /* Tell the mailbox driver to change flags. */
 void
-libbalsa_message_change_flags(LibBalsaMessage    *message,
+libbalsa_message_change_flags(LibBalsaMessage * message,
                               LibBalsaMessageFlag set,
                               LibBalsaMessageFlag clear)
 {
@@ -627,9 +578,8 @@ libbalsa_message_change_flags(LibBalsaMessage    *message,
                                         set, clear);
 }
 
-
 void
-libbalsa_message_reply(LibBalsaMessage *message)
+libbalsa_message_reply(LibBalsaMessage * message)
 {
     g_return_if_fail(message->mailbox);
     libbalsa_lock_mailbox(message->mailbox);
@@ -640,91 +590,75 @@ libbalsa_message_reply(LibBalsaMessage *message)
 
 /* libbalsa_message_body_ref:
    references the structure of given message possibly fetching also all
-   headers.
+   headers. 
    message parts can be fetched later on.
- */
+*/
 gboolean
-libbalsa_message_body_ref(LibBalsaMessage *message,
-                          gboolean         read,
-                          gboolean         fetch_all_headers)
+libbalsa_message_body_ref(LibBalsaMessage * message, gboolean read,
+                          gboolean fetch_all_headers)
 {
     LibBalsaFetchFlag flags = 0;
     gboolean retval = TRUE;
 
     g_return_val_if_fail(message, FALSE);
-    if (!message->mailbox) {
-        return FALSE;
-    }
+    if (!message->mailbox) return FALSE;
     g_return_val_if_fail(MAILBOX_OPEN(message->mailbox), FALSE);
 
     libbalsa_lock_mailbox(message->mailbox);
 
-    if (fetch_all_headers && !message->has_all_headers) {
-        flags |= LB_FETCH_RFC822_HEADERS;
-    }
+    if(fetch_all_headers && !message->has_all_headers)
+        flags |=  LB_FETCH_RFC822_HEADERS;
 
-    if ((message->body_ref == 0) && !message->body_list) {
+    if (message->body_ref == 0 && !message->body_list)
         /* not fetched yet */
         flags |= LB_FETCH_STRUCTURE;
-    }
 
-    if (flags) {
+    if (flags)
         retval =
             libbalsa_mailbox_fetch_message_structure(message->mailbox,
                                                      message, flags);
-    }
-    if (retval) {
-        message->body_ref++;
-    }
+    if (retval)
+       message->body_ref++;
     libbalsa_unlock_mailbox(message->mailbox);
-
+    
     return retval;
 }
 
 
 void
-libbalsa_message_body_unref(LibBalsaMessage *message)
+libbalsa_message_body_unref(LibBalsaMessage * message)
 {
     g_return_if_fail(LIBBALSA_IS_MESSAGE(message));
 
-    if (message->body_ref == 0) {
-        return;
-    }
-
-    if (message->mailbox) {
-        libbalsa_lock_mailbox(message->mailbox);
-    }
-    if (--message->body_ref == 0) {
-        libbalsa_message_body_free(message->body_list);
-        message->body_list = NULL;
-        if (message->mailbox) {
-            libbalsa_mailbox_release_message(message->mailbox, message);
-        }
-
-        /* Free headers that we no longer need. */
-        lb_message_headers_extra_destroy(message->headers);
-        message->has_all_headers = 0;
-    }
-    if (message->mailbox) {
-        libbalsa_unlock_mailbox(message->mailbox);
-    }
+    if (message->body_ref == 0)
+       return;
+
+   if(message->mailbox) { libbalsa_lock_mailbox(message->mailbox); }
+   if (--message->body_ref == 0) {
+       libbalsa_message_body_free(message->body_list);
+       message->body_list = NULL;
+       if (message->mailbox)
+           libbalsa_mailbox_release_message(message->mailbox, message);
+
+       /* Free headers that we no longer need. */
+       lb_message_headers_extra_destroy(message->headers);
+       message->has_all_headers = 0;
+   }
+   if(message->mailbox) { libbalsa_unlock_mailbox(message->mailbox); }
 }
 
-
 gboolean
-libbalsa_message_is_multipart(LibBalsaMessage *message)
+libbalsa_message_is_multipart(LibBalsaMessage * message)
 {
     g_return_val_if_fail(LIBBALSA_IS_MESSAGE(message), FALSE);
 
     return message->headers->content_type ?
-           g_mime_content_type_is_type(message->headers->content_type,
-                                       "multipart", "*") : FALSE;
+       g_mime_content_type_is_type(message->headers->content_type,
+                                   "multipart", "*") : FALSE;
 }
 
-
 gboolean
-libbalsa_message_is_partial(LibBalsaMessage *message,
-                            gchar          **id)
+libbalsa_message_is_partial(LibBalsaMessage * message, gchar ** id)
 {
     GMimeContentType *content_type;
 
@@ -732,20 +666,17 @@ libbalsa_message_is_partial(LibBalsaMessage *message,
 
     content_type = message->headers->content_type;
     if (!content_type
-        || !g_mime_content_type_is_type(content_type,
-                                        "message", "partial")) {
-        return FALSE;
-    }
+       || !g_mime_content_type_is_type(content_type,
+                                       "message", "partial"))
+       return FALSE;
 
-    if (id) {
-        *id = g_strdup(g_mime_content_type_get_parameter(content_type,
-                                                         "id"));
-    }
+    if (id)
+       *id = g_strdup(g_mime_content_type_get_parameter(content_type,
+                                                        "id"));
 
     return TRUE;
 }
 
-
 /* Go through all parts and try to figure out whether it is a message
    with attachments or not. It still yields insatsfactory
    results... */
@@ -754,25 +685,23 @@ has_attached_part(LibBalsaMessageBody *body)
 {
     LibBalsaMessageBody *lbbody;
     /* the condition matches the one used in add_multipart_mixed() */
-    for (lbbody = body; lbbody; lbbody = lbbody->next) {
+    for(lbbody=body; lbbody; lbbody = lbbody->next) {
         /* printf("part %s has disposition %s\n",
                lbbody->content_type, lbbody->content_dsp); */
-        if (!libbalsa_message_body_is_multipart(lbbody) &&
-            !libbalsa_message_body_is_inline(lbbody)) {
+        if(!libbalsa_message_body_is_multipart(lbbody) &&
+           !libbalsa_message_body_is_inline(lbbody) ) {
             /* puts("Attachment found!"); */
             return TRUE;
         }
-        if (lbbody->parts && has_attached_part(lbbody->parts)) {
+        if(lbbody->parts && has_attached_part(lbbody->parts))
             return TRUE;
-        }
     }
     /* no part was an  attachment */
     return FALSE;
 }
 
-
 gboolean
-libbalsa_message_has_attachment(LibBalsaMessage *message)
+libbalsa_message_has_attachment(LibBalsaMessage * message)
 {
     g_return_val_if_fail(LIBBALSA_IS_MESSAGE(message), FALSE);
 
@@ -780,46 +709,42 @@ libbalsa_message_has_attachment(LibBalsaMessage *message)
        has Content-type: multipart/mixed AND members with
        Content-disposition: attachment. Unfortunately, part list may
        not be available at this stage. */
-    if (!message->body_list) {
+    if(!message->body_list) {
         return message->headers->content_type &&
-               g_mime_content_type_is_type(message->headers->content_type,
-                                           "multipart", "mixed");
+            g_mime_content_type_is_type(message->headers->content_type,
+                                        "multipart", "mixed");
     } else {
         /* use "exact" algorithm */
         return (has_attached_part(message->body_list->next) ||
-                has_attached_part(message->body_list->parts));
+               has_attached_part(message->body_list->parts));
     }
-}
-
+ }
 
 #ifdef HAVE_GPGME
 gboolean
-libbalsa_message_is_pgp_signed(LibBalsaMessage *message)
+libbalsa_message_is_pgp_signed(LibBalsaMessage * message)
 {
     g_return_val_if_fail(LIBBALSA_IS_MESSAGE(message), FALSE);
 
     return message->headers->content_type ?
-           g_mime_content_type_is_type(message->headers->content_type,
-                                       "multipart", "signed") : FALSE;
+       g_mime_content_type_is_type(message->headers->content_type,
+                                   "multipart", "signed") : FALSE;
 }
 
-
 gboolean
-libbalsa_message_is_pgp_encrypted(LibBalsaMessage *message)
+libbalsa_message_is_pgp_encrypted(LibBalsaMessage * message)
 {
     g_return_val_if_fail(LIBBALSA_IS_MESSAGE(message), FALSE);
 
     return message->headers->content_type ?
-           g_mime_content_type_is_type(message->headers->content_type,
-                                       "multipart", "encrypted") : FALSE;
+       g_mime_content_type_is_type(message->headers->content_type,
+                                   "multipart", "encrypted") : FALSE;
 }
-
-
 #endif
 
 void
-libbalsa_message_append_part(LibBalsaMessage     *message,
-                             LibBalsaMessageBody *body)
+libbalsa_message_append_part(LibBalsaMessage * message,
+                            LibBalsaMessageBody * body)
 {
     LibBalsaMessageBody *part;
 
@@ -827,92 +752,81 @@ libbalsa_message_append_part(LibBalsaMessage     *message,
     g_return_if_fail(LIBBALSA_IS_MESSAGE(message));
 
     if (message->body_list == NULL) {
-        message->body_list = body;
+       message->body_list = body;
     } else {
-        part = message->body_list;
-        while (part->next != NULL) {
-            part = part->next;
-        }
-        part->next = body;
+       part = message->body_list;
+       while (part->next != NULL)
+           part = part->next;
+       part->next = body;
     }
 }
 
-
 /* libbalsa_message_set_dispnotify:
    sets a disposition notify to a given address
    address can be NULL.
- */
+*/
 void
-libbalsa_message_set_dispnotify(LibBalsaMessage *message,
-                                InternetAddress *ia)
+libbalsa_message_set_dispnotify(LibBalsaMessage * message,
+                                InternetAddress * ia)
 {
     g_return_if_fail(message);
 
     g_object_unref(message->headers->dispnotify_to);
     if (ia) {
-        message->headers->dispnotify_to = internet_address_list_new ();
-        internet_address_list_add (message->headers->dispnotify_to, ia);
+       message->headers->dispnotify_to = internet_address_list_new ();
+       internet_address_list_add (message->headers->dispnotify_to, ia);
     } else {
-        message->headers->dispnotify_to = NULL;
+       message->headers->dispnotify_to = NULL;
     }
 }
 
-
 #ifndef MESSAGE_COPY_CONTENT
 /* libbalsa_message_get_subject:
-   get constant pointer to the subject of the message;
- */
+   get constant pointer to the subject of the message; 
+*/
 const gchar *
-libbalsa_message_get_subject(LibBalsaMessage *msg)
+libbalsa_message_get_subject(LibBalsaMessage* msg)
 {
     const gchar *ret;
-    if (!msg->subj &&
-        msg->mime_msg && msg->mailbox) { /* a message in a mailbox... */
+    if(!msg->subj &&
+       msg->mime_msg && msg->mailbox) { /* a message in a mailbox... */
         g_return_val_if_fail(MAILBOX_OPEN(msg->mailbox), NULL);
         ret = g_mime_message_get_subject(msg->mime_msg);
         libbalsa_message_set_subject_from_header(msg, ret);
-    } else {
-        ret = msg->subj;
-    }
+    } else
+       ret = msg->subj;
 
     return ret ? ret : _("(No subject)");
 }
 
 
 guint
-libbalsa_message_get_lines(LibBalsaMessage *msg)
+libbalsa_message_get_lines(LibBalsaMessage* msg)
 {
     /* set the line count */
     const char *value;
-    if (!msg->mime_msg) {
-        return 0;
-    }
+    if (!msg->mime_msg)
+       return 0;
     value = g_mime_object_get_header(msg->mime_msg, "Lines");
-    if (!value) {
-        return 0;
-    }
+    if (!value)
+       return 0;
     return atoi(value);
 }
-
-
 glong
-libbalsa_message_get_length(LibBalsaMessage *msg)
+libbalsa_message_get_length(LibBalsaMessage* msg)
 {
     /* set the length */
     const char *value;
-    if (!msg->mime_msg) {
-        return 0;
-    }
+    if (!msg->mime_msg)
+       return 0;
     value = g_mime_object_get_header(msg->mime_msg, "Content-Length");
-    if (!value) {
-        return 0;
-    }
+    if (!value)
+       return 0;
     return atoi(value);
 }
 
-
 glong
-libbalsa_message_get_no(LibBalsaMessage *msg)
+libbalsa_message_get_no(LibBalsaMessage* msg)
 {
     return msg->msgno;
 }
@@ -923,112 +837,99 @@ libbalsa_message_get_no(LibBalsaMessage *msg)
 /* Populate headers from mime_msg, but only the members that are needed
  * all the time. */
 static InternetAddressList *
-lb_message_recipients(GMimeMessage      *message,
-                      GMimeRecipientType type)
+lb_message_recipients(GMimeMessage * message, GMimeRecipientType type)
 {
     const InternetAddressList *list;
     InternetAddressList *copy = NULL;
 
     if ((list = g_mime_message_get_recipients (message, type))) {
-        copy = internet_address_list_new ();
-        internet_address_list_append (copy, (InternetAddressList *) list);
+       copy = internet_address_list_new ();
+       internet_address_list_append (copy, (InternetAddressList *) list);
     }
-
+    
     return copy;
 }
 
-
 static void
 lb_message_headers_basic_from_gmime(LibBalsaMessageHeaders *headers,
-                                    GMimeMessage           *mime_msg)
+                                   GMimeMessage *mime_msg)
 {
     g_return_if_fail(headers);
     g_return_if_fail(mime_msg != NULL);
 
-    if (!headers->from) {
+    if (!headers->from)
         headers->from = internet_address_list_parse_string(mime_msg->from);
-    }
 
-    if (!headers->date) {
-        g_mime_message_get_date(mime_msg, &headers->date, NULL);
-    }
+    if (!headers->date)
+       g_mime_message_get_date(mime_msg, &headers->date, NULL);
 
-    if (!headers->to_list) {
+    if (!headers->to_list)
         headers->to_list =
             lb_message_recipients(mime_msg, GMIME_RECIPIENT_TYPE_TO);
-    }
 
     if (!headers->content_type) {
-        /* If we could:
-         * headers->content_type =
-         *     g_mime_content_type_copy
-         *         (g_mime_object_get_content_type(mime_msg->mime_part));
-         */
-        GMimeContentType *content_type;
-        gchar *str;
-        g_return_if_fail(headers->content_type == NULL);
-        content_type = g_mime_object_get_content_type(mime_msg->mime_part);
-        str = g_mime_content_type_to_string(content_type);
-        headers->content_type = g_mime_content_type_new_from_string(str);
-        g_free(str);
+       /* If we could:
+        * headers->content_type =
+        *     g_mime_content_type_copy
+        *         (g_mime_object_get_content_type(mime_msg->mime_part));
+        */
+       GMimeContentType *content_type;
+       gchar *str;
+       g_return_if_fail(headers->content_type == NULL);
+       content_type = g_mime_object_get_content_type(mime_msg->mime_part);
+       str = g_mime_content_type_to_string(content_type);
+       headers->content_type = g_mime_content_type_new_from_string(str);
+       g_free(str);
     }
 }
 
-
 /* Populate headers from mime_msg, but only the members not handled in
  * lb_message_headers_basic_from_gmime. */
 static void
 lb_message_headers_extra_from_gmime(LibBalsaMessageHeaders *headers,
-                                    GMimeMessage           *mime_msg)
+                                   GMimeMessage *mime_msg)
 {
     g_return_if_fail(headers);
     g_return_if_fail(mime_msg != NULL);
 
-    if (!headers->reply_to) {
+    if (!headers->reply_to)
         headers->reply_to =
-            internet_address_list_parse_string(mime_msg->reply_to);
-    }
+           internet_address_list_parse_string(mime_msg->reply_to);
 
-    if (!headers->dispnotify_to) {
+    if (!headers->dispnotify_to)
         headers->dispnotify_to =
             internet_address_list_parse_string(g_mime_object_get_header
-                                                   (GMIME_OBJECT(mime_msg),
-                                                   "Disposition-Notification-To"));
-    }
+                                          (GMIME_OBJECT(mime_msg),
+                                           "Disposition-Notification-To"));
 
-    if (!headers->cc_list) {
+    if (!headers->cc_list)
         headers->cc_list =
             lb_message_recipients(mime_msg, GMIME_RECIPIENT_TYPE_CC);
-    }
 
-    if (!headers->bcc_list) {
+    if (!headers->bcc_list)
         headers->bcc_list =
             lb_message_recipients(mime_msg, GMIME_RECIPIENT_TYPE_BCC);
-    }
 
     /* Get fcc from message */
-    if (!headers->fcc_url) {
-        headers->fcc_url =
-            g_strdup(g_mime_object_get_header(GMIME_OBJECT(mime_msg), "X-Balsa-Fcc"));
-    }
+    if (!headers->fcc_url)
+       headers->fcc_url =
+           g_strdup(g_mime_object_get_header(GMIME_OBJECT(mime_msg), "X-Balsa-Fcc"));
 }
 
-
 /* Populate headers from the info in mime_msg. */
 void
 libbalsa_message_headers_from_gmime(LibBalsaMessageHeaders *headers,
-                                    GMimeMessage           *mime_msg)
+                                   GMimeMessage *mime_msg)
 {
     lb_message_headers_basic_from_gmime(headers, mime_msg);
     lb_message_headers_extra_from_gmime(headers, mime_msg);
 }
 
-
 /* Populate message and message->headers from the info in mime_msg,
  * but only the members that are needed all the time. */
 void
-libbalsa_message_init_from_gmime(LibBalsaMessage *message,
-                                 GMimeMessage    *mime_msg)
+libbalsa_message_init_from_gmime(LibBalsaMessage * message,
+                                GMimeMessage *mime_msg)
 {
     const gchar *header;
 
@@ -1040,113 +941,101 @@ libbalsa_message_init_from_gmime(LibBalsaMessage *message,
     libbalsa_message_set_subject_from_header(message, header);
 
     header = g_mime_object_get_header(GMIME_OBJECT(mime_msg), "Content-Length");
-    if (header) {
-        message->length = atoi(header);
-    }
+    if (header)
+       message->length = atoi(header);
 #endif
     header = g_mime_message_get_message_id(mime_msg);
-    if (header) {
-        message->message_id = g_strdup(header);
-    }
+    if (header)
+       message->message_id = g_strdup(header);
 
     header = g_mime_object_get_header(GMIME_OBJECT(mime_msg), "References");
-    if (header) {
-        libbalsa_message_set_references_from_string(message, header);
-    }
+    if (header)
+       libbalsa_message_set_references_from_string(message, header);
 
     header = g_mime_object_get_header(GMIME_OBJECT(mime_msg), "In-Reply-To");
-    if (header) {
-        libbalsa_message_set_in_reply_to_from_string(message, header);
-    }
+    if (header)
+       libbalsa_message_set_in_reply_to_from_string(message, header);
 
     lb_message_headers_basic_from_gmime(message->headers, mime_msg);
 }
 
-
 /* Create a newly allocated list of references for threading.
  * This is a deep copy, with its own strings: deallocate with
  * g_free and g_list_free. */
 GList *
-libbalsa_message_refs_for_threading(LibBalsaMessage *message)
+libbalsa_message_refs_for_threading(LibBalsaMessage * message)
 {
     GList *tmp;
     GList *foo;
 
     g_return_val_if_fail(message != NULL, NULL);
 
-    if (message->in_reply_to && message->in_reply_to->next) {
-        return NULL;
-    }
+    if (message->in_reply_to && message->in_reply_to->next)
+       return NULL;
 
     tmp = g_list_copy(message->references);
 
     if (message->in_reply_to) {
-        /* some mailers provide in_reply_to but no references, and
-         * some apparently provide both but with the references in
-         * the wrong order; we'll just make sure it's the last item
-         * of this list */
-        foo = g_list_find_custom(tmp, message->in_reply_to->data,
-                                 (GCompareFunc) strcmp);
-
-        if (foo) {
-            tmp = g_list_remove_link(tmp, foo);
-            g_list_free_1(foo);
-        }
-        tmp = g_list_append(tmp, message->in_reply_to->data);
-    }
+       /* some mailers provide in_reply_to but no references, and
+        * some apparently provide both but with the references in
+        * the wrong order; we'll just make sure it's the last item
+        * of this list */
+       foo = g_list_find_custom(tmp, message->in_reply_to->data,
+                                (GCompareFunc) strcmp);
 
-    for (foo = tmp; foo; foo = foo->next) {
-        foo->data = g_strdup((gchar *) foo->data);
+       if (foo) {
+           tmp = g_list_remove_link(tmp, foo);
+           g_list_free_1(foo);
+       }
+       tmp = g_list_append(tmp, message->in_reply_to->data);
     }
 
+    for (foo = tmp; foo; foo = foo->next)
+       foo->data = g_strdup((gchar *) foo->data);
+
     return tmp;
 }
 
-
 static GList *
-references_decode(const gchar *str)
+references_decode(const gchar * str)
 {
     GMimeReferences *references, *reference;
     GList *list = NULL;
 
     reference = references = g_mime_references_decode(str);
     while (reference) {
-        list = g_list_prepend(list, g_strdup(reference->msgid));
-        reference = reference->next;
+       list = g_list_prepend(list, g_strdup(reference->msgid));
+       reference = reference->next;
     }
     g_mime_references_clear(&references);
 
     return g_list_reverse(list);
 }
 
-
 void
-libbalsa_message_set_references_from_string(LibBalsaMessage *message,
-                                            const gchar     *str)
+libbalsa_message_set_references_from_string(LibBalsaMessage * message,
+                                           const gchar *str)
 {
-    /* Empty references are acceptable but require no action. Similarly,
-       if references were set already, there is not reason to set them
-       again - they are immutable anyway. */
-    if (!message->references && str) {
+ /* Empty references are acceptable but require no action. Similarly,
+    if references were set already, there is not reason to set them
+    again - they are immutable anyway. */
+    if(!message->references && str)
         message->references = references_decode(str);
-    }
 }
 
-
 void
-libbalsa_message_set_in_reply_to_from_string(LibBalsaMessage *message,
-                                             const gchar     *str)
+libbalsa_message_set_in_reply_to_from_string(LibBalsaMessage * message,
+                                            const gchar * str)
 {
     if (!message->in_reply_to && str) {
-        /* FIXME for Balsa's old non-compliant header */
-        gchar *p = strrchr(str, ';');
-        p = p ? g_strndup(str, p - str) : g_strdup(str);
-        message->in_reply_to = references_decode(p);
-        g_free(p);
+       /* FIXME for Balsa's old non-compliant header */
+       gchar *p = strrchr(str, ';');
+       p = p ? g_strndup(str, p - str) : g_strdup(str);
+       message->in_reply_to = references_decode(p);
+       g_free(p);
     }
 }
 
-
 /* set a header, if (all) or if it's needed all the time:
  *   headers->from
  *   headers->date
@@ -1161,10 +1050,8 @@ libbalsa_message_set_in_reply_to_from_string(LibBalsaMessage *message,
  *   in_reply_to
  */
 static gboolean
-lbmsg_set_header(LibBalsaMessage *message,
-                 const gchar     *name,
-                 const gchar     *value,
-                 gboolean         all)
+lbmsg_set_header(LibBalsaMessage *message, const gchar *name,
+                 const gchar* value, gboolean all)
 {
     gchar *val = NULL;
 
@@ -1184,103 +1071,99 @@ lbmsg_set_header(LibBalsaMessage *message,
     }
 
     if (g_ascii_strcasecmp(name, "Subject") == 0) {
-        if (!strcmp(value,
+       if (!strcmp(value,
                     "DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA")) {
             g_free(val);
-            return FALSE;
+           return FALSE;
         }
 #if MESSAGE_COPY_CONTENT
         libbalsa_message_set_subject_from_header(message, value);
 #endif
-    } else if (g_ascii_strcasecmp(name, "Date") == 0) {
-        message->headers->date = g_mime_utils_header_decode_date(value, NULL);
-    } else if ((message->headers->from == NULL) &&
-               (g_ascii_strcasecmp(name, "From") == 0)) {
+    } else
+    if (g_ascii_strcasecmp(name, "Date") == 0) {
+       message->headers->date = g_mime_utils_header_decode_date(value, NULL);
+    } else
+    if (message->headers->from == NULL &&
+       g_ascii_strcasecmp(name, "From") == 0) {
         message->headers->from = internet_address_list_parse_string(value);
-    } else if ((message->headers->to_list == NULL) &&
-               (g_ascii_strcasecmp(name, "To") == 0)) {
-        message->headers->to_list = internet_address_list_parse_string(value);
-    } else if (g_ascii_strcasecmp(name, "In-Reply-To") == 0) {
-        libbalsa_message_set_in_reply_to_from_string(message, value);
-    } else if ((message->message_id == NULL) &&
-               (g_ascii_strcasecmp(name, "Message-ID") == 0)) {
-        message->message_id = g_mime_utils_decode_message_id(value);
-    } else if (g_ascii_strcasecmp(name, "References") == 0) {
-        libbalsa_message_set_references_from_string(message, value);
-    } else if ((message->headers->content_type == NULL) &&
-               (g_ascii_strcasecmp(name, "Content-Type") == 0)) {
-        message->headers->content_type =
-            g_mime_content_type_new_from_string(value);
-    } else if ((message->headers->dispnotify_to == NULL) &&
-               (g_ascii_strcasecmp(name, "Disposition-Notification-To") == 0)) {
-        message->headers->dispnotify_to =
-            internet_address_list_parse_string(value);
+    } else
+    if (message->headers->to_list == NULL &&
+        g_ascii_strcasecmp(name, "To") == 0) {
+       message->headers->to_list = internet_address_list_parse_string(value);
+    } else
+    if (g_ascii_strcasecmp(name, "In-Reply-To") == 0) {
+       libbalsa_message_set_in_reply_to_from_string(message, value);
+    } else
+    if (message->message_id == NULL &&
+        g_ascii_strcasecmp(name, "Message-ID") == 0) {
+       message->message_id = g_mime_utils_decode_message_id(value);
+    } else
+    if (g_ascii_strcasecmp(name, "References") == 0) {
+       libbalsa_message_set_references_from_string(message, value);
+    } else
+    if (message->headers->content_type == NULL &&
+       g_ascii_strcasecmp(name, "Content-Type") == 0) {
+       message->headers->content_type =
+           g_mime_content_type_new_from_string(value);
+    } else
+    if (message->headers->dispnotify_to == NULL &&
+       g_ascii_strcasecmp(name, "Disposition-Notification-To") == 0) {
+       message->headers->dispnotify_to =
+           internet_address_list_parse_string(value);
     } else
 #ifdef MESSAGE_COPY_CONTENT
     if (g_ascii_strcasecmp(name, "Content-Length") == 0) {
-        message->length = atoi(value);
+           message->length = atoi(value);
     } else
 #endif
-    if (all) {
+    if (all)
         message->headers->user_hdrs =
             g_list_prepend(message->headers->user_hdrs,
                            libbalsa_create_hdr_pair(name,
                                                     g_strdup(value)));
-    }
 
     g_free(val);
 
     return TRUE;
 }
 
-
 static gboolean
 lb_message_set_headers_from_string(LibBalsaMessage *message,
-                                   const gchar     *lines,
-                                   gboolean         all)
+                                  const gchar *lines, gboolean all)
 {
     gchar *header, *value;
     const gchar *val, *eoh;
     do {
-        for (val = lines; *val && *val > 32 && *val < 127 && *val != ':'; val++) {
-        }
-        if (*val != ':') { /* parsing error */
+        for(val = lines; *val && *val >32 && *val<127 && *val != ':'; val++)
+            ;
+        if(*val != ':') /* parsing error */
             return FALSE;
-        }
-        for (eoh = val + 1; *eoh && (eoh[0] != '\n' || isspace(eoh[1])); eoh++) {
-        }
-        header = g_strndup(lines, val - lines);
+        for(eoh = val+1; *eoh && (eoh[0] != '\n' || isspace(eoh[1])); eoh++)
+            ;
+        header = g_strndup(lines, val-lines);
         lines = eoh;
-        for (val = val + 1; *val && isspace(*val); val++) {
-            /* strip spaces at front... */
-        }
-        while (eoh > val && isspace(*eoh)) {
-            eoh--;                             /* .. and at the end */
-        }
-        value = g_strndup(val, eoh - val + 1);
-
+        for(val=val+1; *val && isspace(*val); val++)
+            ;                           /* strip spaces at front... */
+        while(eoh>val && isspace(*eoh)) eoh--; /* .. and at the end */
+        value  = g_strndup(val, eoh-val+1);
+        
         lbmsg_set_header(message, header, value, all);
-        g_free(header);
-        g_free(value);
-        if (!*lines || !*++lines) {
-            break;
-        }
-    } while (1);
+        g_free(header); g_free(value);
+        if(!*lines || !*++lines) break;
+    } while(1);
     return TRUE;
 }
 
-
 gboolean
 libbalsa_message_set_headers_from_string(LibBalsaMessage *message,
-                                         const gchar     *lines)
+                                         const gchar *lines)
 {
     return lb_message_set_headers_from_string(message, lines, TRUE);
 }
 
-
 void
-libbalsa_message_load_envelope_from_stream(LibBalsaMessage *message,
-                                           GMimeStream     *gmime_stream)
+libbalsa_message_load_envelope_from_stream(LibBalsaMessage * message,
+                                           GMimeStream *gmime_stream)
 {
     GMimeStream *gmime_stream_filter;
     GMimeFilter *gmime_filter_crlf;
@@ -1300,7 +1183,7 @@ libbalsa_message_load_envelope_from_stream(LibBalsaMessage *message,
         g_mime_filter_crlf_new(FALSE,
                                FALSE);
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(gmime_stream_filter),
-                             gmime_filter_crlf);
+                                                 gmime_filter_crlf);
     g_object_unref(gmime_filter_crlf);
 
     /* Buffer the message stream, so we can read it line by line. */
@@ -1315,30 +1198,30 @@ libbalsa_message_load_envelope_from_stream(LibBalsaMessage *message,
      */
     line = g_byte_array_new();
     do {
-        g_mime_stream_buffer_readln(gmime_stream_buffer, line);
-        while (g_mime_stream_read(gmime_stream_buffer,
-                                  (char *) &lookahead, 1) == 1
+       g_mime_stream_buffer_readln(gmime_stream_buffer, line);
+       while (g_mime_stream_read(gmime_stream_buffer,
+                                 (char *) &lookahead, 1) == 1 
                && (lookahead == ' ' || lookahead == '\t')) {
             g_byte_array_append(line, &lookahead, 1);
             g_mime_stream_buffer_readln(gmime_stream_buffer, line);
-        }
-        if ((line->len == 0) || (line->data[line->len - 1] != '\n')) {
-            /* EOF or read error; in either case, message has no body. */
-            break;
-        }
-        line->data[line->len - 1] = '\0'; /* terminate line by overwriting '\n' */
-        if (!lb_message_set_headers_from_string(message,
-                                                (gchar *) line->data,
-                                                FALSE)) {
-            /* Ignore error return caused by malformed header. */
-        }
-        if (lookahead == '\n') {/* end of header */
+       }
+       if (line->len == 0 || line->data[line->len-1]!='\n') {
+           /* EOF or read error; in either case, message has no body. */
+           break;
+       }
+       line->data[line->len-1]='\0'; /* terminate line by overwriting '\n' */
+       if (!lb_message_set_headers_from_string(message,
+                                               (gchar *) line->data,
+                                               FALSE)) {
+           /* Ignore error return caused by malformed header. */
+       }
+       if (lookahead == '\n') {/* end of header */
             /* Message looks valid--set its length. */
             message->length = g_mime_stream_length(gmime_stream);
-            break;
-        }
-        line->len = 0;
-        g_byte_array_append(line, &lookahead, 1);
+           break;
+       }
+       line->len = 0;
+       g_byte_array_append(line, &lookahead, 1);
     } while (TRUE);
     g_byte_array_free(line, TRUE);
 
@@ -1347,24 +1230,21 @@ libbalsa_message_load_envelope_from_stream(LibBalsaMessage *message,
     libbalsa_mime_stream_shared_unlock(gmime_stream);
 }
 
-
 void
 libbalsa_message_load_envelope(LibBalsaMessage *message)
 {
     GMimeStream *gmime_stream;
 
     gmime_stream = libbalsa_message_stream(message);
-    if (!gmime_stream) {
-        return;
-    }
+    if (!gmime_stream)
+       return;
 
     libbalsa_message_load_envelope_from_stream(message, gmime_stream);
     g_object_unref(gmime_stream);
 }
 
-
 GMimeStream *
-libbalsa_message_stream(LibBalsaMessage *message)
+libbalsa_message_stream(LibBalsaMessage * message)
 {
     LibBalsaMailbox *mailbox;
     GMimeStream *mime_stream;
@@ -1374,10 +1254,9 @@ libbalsa_message_stream(LibBalsaMessage *message)
     g_return_val_if_fail(mailbox != NULL || message->mime_msg != NULL,
                          NULL);
 
-    if (mailbox) {
+    if (mailbox)
         return libbalsa_mailbox_get_message_stream(mailbox,
                                                    message->msgno, FALSE);
-    }
 
     mime_stream = g_mime_stream_mem_new();
     g_mime_object_write_to_stream(GMIME_OBJECT(message->mime_msg),
@@ -1387,11 +1266,9 @@ libbalsa_message_stream(LibBalsaMessage *message)
     return mime_stream;
 }
 
-
 gboolean
-libbalsa_message_copy(LibBalsaMessage *message,
-                      LibBalsaMailbox *dest,
-                      GError         **err)
+libbalsa_message_copy(LibBalsaMessage * message, LibBalsaMailbox * dest,
+                      GError ** err)
 {
     LibBalsaMailbox *mailbox;
     gboolean retval;
@@ -1418,10 +1295,9 @@ libbalsa_message_copy(LibBalsaMessage *message,
     return retval;
 }
 
-
 void
-libbalsa_message_set_subject(LibBalsaMessage *message,
-                             const gchar     *subject)
+libbalsa_message_set_subject(LibBalsaMessage * message,
+                             const gchar * subject)
 {
     g_free(message->subj);
     message->subj = g_strdup(subject);
@@ -1429,10 +1305,9 @@ libbalsa_message_set_subject(LibBalsaMessage *message,
     canonize_header_value(message->subj);
 }
 
-
 void
-libbalsa_message_set_subject_from_header(LibBalsaMessage *message,
-                                         const gchar     *header)
+libbalsa_message_set_subject_from_header(LibBalsaMessage * message,
+                                         const gchar * header)
 {
     if (header) {
         gchar *subject =
@@ -1442,14 +1317,12 @@ libbalsa_message_set_subject_from_header(LibBalsaMessage *message,
     }
 }
 
-
 const gchar *
-libbalsa_message_get_tempdir(LibBalsaMessage *message)
+libbalsa_message_get_tempdir(LibBalsaMessage * message)
 {
     if (!message->tempdir) {
-        if (!libbalsa_mktempdir(&message->tempdir)) {
+        if (!libbalsa_mktempdir(&message->tempdir))
             g_warning("Could not make tempdir");
-        }
     }
 
     return message->tempdir;
diff --git a/libbalsa/message.h b/libbalsa/message.h
index c9a717e..02f3a72 100644
--- a/libbalsa/message.h
+++ b/libbalsa/message.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -21,7 +21,7 @@
 #define __LIBBALSA_MESSAGE_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include <glib.h>
@@ -32,7 +32,7 @@
 #include <gmime/gmime.h>
 
 #ifdef HAVE_GPGME
-#   include "rfc3156.h"
+#include "rfc3156.h"
 #endif
 
 #define MESSAGE_COPY_CONTENT 1
@@ -57,16 +57,16 @@ enum _LibBalsaMessageFlag {
     LIBBALSA_MESSAGE_FLAG_REPLIED = 1 << 2,
     LIBBALSA_MESSAGE_FLAG_FLAGGED = 1 << 3,
     LIBBALSA_MESSAGE_FLAG_RECENT  = 1 << 4,
-    LIBBALSA_MESSAGE_FLAG_SELECTED= 1 << 5,     /* pseudo flag */
-    LIBBALSA_MESSAGE_FLAG_INVALID = 1 << 6      /* pseudo flag */
+    LIBBALSA_MESSAGE_FLAG_SELECTED= 1 << 5,    /* pseudo flag */
+    LIBBALSA_MESSAGE_FLAG_INVALID = 1 << 6     /* pseudo flag */
 };
 
 #define LIBBALSA_MESSAGE_FLAGS_REAL \
-    (LIBBALSA_MESSAGE_FLAG_NEW | \
-     LIBBALSA_MESSAGE_FLAG_DELETED | \
-     LIBBALSA_MESSAGE_FLAG_REPLIED | \
-     LIBBALSA_MESSAGE_FLAG_FLAGGED | \
-     LIBBALSA_MESSAGE_FLAG_RECENT)
+   (LIBBALSA_MESSAGE_FLAG_NEW       | \
+    LIBBALSA_MESSAGE_FLAG_DELETED   | \
+    LIBBALSA_MESSAGE_FLAG_REPLIED   | \
+    LIBBALSA_MESSAGE_FLAG_FLAGGED   | \
+    LIBBALSA_MESSAGE_FLAG_RECENT)
 
 typedef enum _LibBalsaMessageStatus LibBalsaMessageStatus;
 enum _LibBalsaMessageStatus {
@@ -175,15 +175,15 @@ struct _LibBalsaMessage {
     InternetAddressList *sender;
 
     /* subject line; we still need it here for sending;
-     * although _SET_SUBJECT might resolve it(?)
+     * although _SET_SUBJECT might resolve it(?) 
      * but we can set to to NULL unless there is no mailbox, like
      * on sending. */
     gchar *subj;
 #ifdef MESSAGE_COPY_CONTENT
-#   define LIBBALSA_MESSAGE_GET_SUBJECT(m) \
+#define LIBBALSA_MESSAGE_GET_SUBJECT(m) \
     ((m)->subj ? (m)->subj : _("(No subject)"))
 #else
-#   define LIBBALSA_MESSAGE_GET_SUBJECT(m) libbalsa_message_get_subject(m)
+#define LIBBALSA_MESSAGE_GET_SUBJECT(m) libbalsa_message_get_subject(m)
 #endif
 
     /* replied message ID's */
@@ -225,19 +225,19 @@ struct _LibBalsaMessage {
     /*  GList *body_list; */
 
     glong msgno;     /* message no; always copy for faster sorting;
-                      * counting starts at 1. */
+                     * counting starts at 1. */
 #if MESSAGE_COPY_CONTENT
-#   define LIBBALSA_MESSAGE_GET_NO(m)      ((m)->msgno)
+#define LIBBALSA_MESSAGE_GET_NO(m)      ((m)->msgno)
     glong length;   /* byte len */
-#   define LIBBALSA_MESSAGE_GET_LENGTH(m)  ((m)->length)
+#define LIBBALSA_MESSAGE_GET_LENGTH(m)  ((m)->length)
 #else
-#   define LIBBALSA_MESSAGE_GET_LENGTH(m) libbalsa_message_get_length(m)
-#   define LIBBALSA_MESSAGE_GET_NO(m)  libbalsa_message_get_no(m)
+#define LIBBALSA_MESSAGE_GET_LENGTH(m) libbalsa_message_get_length(m)
+#define LIBBALSA_MESSAGE_GET_NO(m)  libbalsa_message_get_no(m)
 #endif
 
     gchar *tempdir;     /* to hold named parts */
 
-    unsigned has_all_headers : 1;
+    unsigned has_all_headers:1;
 };
 
 #define LIBBALSA_MESSAGE_HAS_FLAG(message, mask) \
@@ -258,9 +258,8 @@ struct _LibBalsaMessageClass {
 
     /* deal with flags being set/unset */
     /* Signal: */
-    void (*status_changed) (LibBalsaMessage    *message,
-                            LibBalsaMessageFlag flag,
-                            gboolean);
+    void (*status_changed) (LibBalsaMessage * message,
+                           LibBalsaMessageFlag flag, gboolean);
 };
 
 
@@ -269,11 +268,11 @@ GType libbalsa_message_get_type(void);
 /*
  * message headers
  */
-void libbalsa_message_headers_destroy(LibBalsaMessageHeaders *headers);
+void libbalsa_message_headers_destroy(LibBalsaMessageHeaders * headers);
 void libbalsa_message_headers_from_gmime(LibBalsaMessageHeaders *headers,
-                                         GMimeMessage           *msg);
-void libbalsa_message_init_from_gmime(LibBalsaMessage *message,
-                                      GMimeMessage    *msg);
+                                        GMimeMessage *msg);
+void libbalsa_message_init_from_gmime(LibBalsaMessage * message,
+                                     GMimeMessage * msg);
 GList *libbalsa_message_user_hdrs_from_gmime(GMimeMessage *msg);
 
 
@@ -282,92 +281,84 @@ GList *libbalsa_message_user_hdrs_from_gmime(GMimeMessage *msg);
  */
 LibBalsaMessage *libbalsa_message_new(void);
 
-gboolean libbalsa_message_save(LibBalsaMessage *message,
-                               const gchar     *filename);
+gboolean libbalsa_message_save(LibBalsaMessage * message,
+                              const gchar *filename);
 
-void libbalsa_message_reply(LibBalsaMessage *message);
+void libbalsa_message_reply(LibBalsaMessage * message);
 
-void libbalsa_message_append_part(LibBalsaMessage     *message,
-                                  LibBalsaMessageBody *body);
+void libbalsa_message_append_part(LibBalsaMessage * message,
+                                 LibBalsaMessageBody * body);
 
-gboolean libbalsa_message_body_ref(LibBalsaMessage *message,
-                                   gboolean         read,
-                                   gboolean         fetch_all_headers);
-void libbalsa_message_body_unref(LibBalsaMessage *message);
+gboolean libbalsa_message_body_ref(LibBalsaMessage * message, gboolean read,
+                                   gboolean fetch_all_headers);
+void libbalsa_message_body_unref(LibBalsaMessage * message);
 
 /*
  * misc message releated functions
  */
-const gchar *libbalsa_message_pathname(LibBalsaMessage *message);
-const gchar *libbalsa_message_body_charset(LibBalsaMessageBody *body);
-gboolean libbalsa_message_is_multipart(LibBalsaMessage *message);
-gboolean libbalsa_message_is_partial(LibBalsaMessage *message,
-                                     gchar          **id);
-gboolean libbalsa_message_has_attachment(LibBalsaMessage *message);
-
+const gchar *libbalsa_message_pathname(LibBalsaMessage * message);
+const gchar *libbalsa_message_body_charset(LibBalsaMessageBody * body);
+gboolean libbalsa_message_is_multipart(LibBalsaMessage * message);
+gboolean libbalsa_message_is_partial(LibBalsaMessage * message,
+                                    gchar ** id);
+gboolean libbalsa_message_has_attachment(LibBalsaMessage * message);
 #ifdef HAVE_GPGME
-gboolean libbalsa_message_is_pgp_signed(LibBalsaMessage *message);
-gboolean libbalsa_message_is_pgp_encrypted(LibBalsaMessage *message);
-
+gboolean libbalsa_message_is_pgp_signed(LibBalsaMessage * message);
+gboolean libbalsa_message_is_pgp_encrypted(LibBalsaMessage * message);
 #endif
 
-const gchar *libbalsa_message_header_get_one(LibBalsaMessageHeaders *headers,
-                                             const gchar            *find);
-GList *libbalsa_message_header_get_all(LibBalsaMessageHeaders *headers,
-                                       const gchar            *find);
-const gchar *libbalsa_message_get_user_header(LibBalsaMessage *message,
-                                              const gchar     *name);
-void libbalsa_message_set_user_header(LibBalsaMessage *message,
-                                      const gchar     *name,
-                                      const gchar     *value);
+const gchar* libbalsa_message_header_get_one(LibBalsaMessageHeaders* headers,
+                                             const gchar *find);
+GList* libbalsa_message_header_get_all(LibBalsaMessageHeaders* headers,
+                                       const gchar *find);
+const gchar *libbalsa_message_get_user_header(LibBalsaMessage * message,
+                                              const gchar * name);
+void libbalsa_message_set_user_header(LibBalsaMessage * message,
+                                      const gchar * name,
+                                      const gchar * value);
 
 LibBalsaMessageBody *libbalsa_message_get_part_by_id(LibBalsaMessage *
                                                      message,
-                                                     const gchar *id);
-
-void libbalsa_message_set_dispnotify(LibBalsaMessage *message,
-                                     InternetAddress *ia);
+                                                     const gchar * id);
 
-void libbalsa_message_set_subject(LibBalsaMessage *message,
-                                  const gchar     *subject);
-void libbalsa_message_set_subject_from_header(LibBalsaMessage *message,
-                                              const gchar     *header);
+void libbalsa_message_set_dispnotify(LibBalsaMessage *message, 
+                                    InternetAddress *ia);
 
+void libbalsa_message_set_subject(LibBalsaMessage * message,
+                                  const gchar * subject);
+void libbalsa_message_set_subject_from_header(LibBalsaMessage * message,
+                                              const gchar * header);
 /* use LIBBALSA_MESSAGE_GET_SUBJECT() macro, we may optimize this
    function out if we find a way.
- */
+*/
 #ifndef MESSAGE_COPY_CONTENT
-const gchar *libbalsa_message_get_subject(LibBalsaMessage *message);
-guint libbalsa_message_get_lines(LibBalsaMessage *msg);
-glong libbalsa_message_get_length(LibBalsaMessage *msg);
-
+const gchar* libbalsa_message_get_subject(LibBalsaMessage* message);
+guint libbalsa_message_get_lines(LibBalsaMessage* msg);
+glong libbalsa_message_get_length(LibBalsaMessage* msg);
 #endif
-glong libbalsa_message_get_no(LibBalsaMessage *msg);
+glong libbalsa_message_get_no(LibBalsaMessage* msg);
 LibBalsaMessageAttach libbalsa_message_get_attach_icon(LibBalsaMessage *
-                                                       message);
-
+                                                      message);
 #define libbalsa_message_date_to_utf8(m, f) libbalsa_date_to_utf8((m)->headers->date, (f))
 #define libbalsa_message_headers_date_to_utf8(h, f) libbalsa_date_to_utf8((h)->date, (f))
 
-GList *libbalsa_message_refs_for_threading(LibBalsaMessage *msg);
+GList *libbalsa_message_refs_for_threading(LibBalsaMessage* msg);
 
-void libbalsa_message_load_envelope_from_stream(LibBalsaMessage *message,
-                                                GMimeStream     *stream);
+void libbalsa_message_load_envelope_from_stream(LibBalsaMessage * message,
+                                                GMimeStream * stream);
 void libbalsa_message_load_envelope(LibBalsaMessage *message);
 gboolean libbalsa_message_set_headers_from_string(LibBalsaMessage *message,
-                                                  const gchar     *str);
-void libbalsa_message_set_references_from_string(LibBalsaMessage *message,
-                                                 const gchar     *str);
-void libbalsa_message_set_in_reply_to_from_string(LibBalsaMessage *message,
-                                                  const gchar     *str);
-GMimeStream *libbalsa_message_stream(LibBalsaMessage *message);
-gboolean libbalsa_message_copy(LibBalsaMessage *message,
-                               LibBalsaMailbox *dest,
-                               GError         **err);
-void libbalsa_message_change_flags(LibBalsaMessage    *message,
+                                                  const gchar *str);
+void libbalsa_message_set_references_from_string(LibBalsaMessage * message,
+                                                const gchar *str);
+void libbalsa_message_set_in_reply_to_from_string(LibBalsaMessage * message,
+                                                 const gchar *str);
+GMimeStream *libbalsa_message_stream(LibBalsaMessage * message);
+gboolean libbalsa_message_copy(LibBalsaMessage * message,
+                               LibBalsaMailbox * dest, GError ** err);
+void libbalsa_message_change_flags(LibBalsaMessage * message,
                                    LibBalsaMessageFlag set,
                                    LibBalsaMessageFlag clear);
 
-const gchar *libbalsa_message_get_tempdir(LibBalsaMessage *message);
-
-#endif                          /* __LIBBALSA_MESSAGE_H__ */
+const gchar *libbalsa_message_get_tempdir(LibBalsaMessage * message);
+#endif                         /* __LIBBALSA_MESSAGE_H__ */
diff --git a/libbalsa/mime-stream-shared.c b/libbalsa/mime-stream-shared.c
index 561fb8b..f173082 100644
--- a/libbalsa/mime-stream-shared.c
+++ b/libbalsa/mime-stream-shared.c
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -30,7 +30,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include "mime-stream-shared.h"
@@ -52,23 +52,19 @@ struct _LibBalsaMimeStreamSharedClass {
     GMimeStreamClass parent_class;
 };
 
-static void lbmss_stream_class_init(LibBalsaMimeStreamSharedClass *klass);
+static void lbmss_stream_class_init(LibBalsaMimeStreamSharedClass * klass);
 
 static void lbmss_finalize(GObject *object);
 
-static ssize_t lbmss_stream_read(GMimeStream *stream,
-                                 char        *buf,
-                                 size_t       len);
-static ssize_t lbmss_stream_write(GMimeStream *stream,
-                                  const char  *buf,
-                                  size_t       len);
-static int lbmss_stream_reset(GMimeStream *stream);
-static gint64 lbmss_stream_seek(GMimeStream    *stream,
-                                gint64          offset,
-                                GMimeSeekWhence whence);
-static GMimeStream *lbmss_stream_substream(GMimeStream *stream,
-                                           gint64       start,
-                                           gint64       end);
+static ssize_t lbmss_stream_read(GMimeStream * stream, char *buf,
+                                 size_t len);
+static ssize_t lbmss_stream_write(GMimeStream * stream, const char *buf,
+                                  size_t len);
+static int lbmss_stream_reset(GMimeStream * stream);
+static gint64 lbmss_stream_seek(GMimeStream * stream, gint64 offset,
+                               GMimeSeekWhence whence);
+static GMimeStream *lbmss_stream_substream(GMimeStream * stream,
+                                           gint64 start, gint64 end);
 
 static GMimeStreamFsClass *parent_class = NULL;
 static GMutex lbmss_mutex;
@@ -100,25 +96,23 @@ libbalsa_mime_stream_shared_get_type(void)
     return type;
 }
 
-
 static void
-lbmss_stream_class_init(LibBalsaMimeStreamSharedClass *klass)
+lbmss_stream_class_init(LibBalsaMimeStreamSharedClass * klass)
 {
     GMimeStreamClass *stream_class = GMIME_STREAM_CLASS(klass);
     GObjectClass *object_class = G_OBJECT_CLASS(klass);
 
     parent_class = g_type_class_ref(GMIME_TYPE_STREAM_FS);
 
-    object_class->finalize = lbmss_finalize;
+    object_class->finalize  = lbmss_finalize;
 
-    stream_class->read = lbmss_stream_read;
-    stream_class->write = lbmss_stream_write;
-    stream_class->reset = lbmss_stream_reset;
-    stream_class->seek = lbmss_stream_seek;
+    stream_class->read      = lbmss_stream_read;
+    stream_class->write     = lbmss_stream_write;
+    stream_class->reset     = lbmss_stream_reset;
+    stream_class->seek      = lbmss_stream_seek;
     stream_class->substream = lbmss_stream_substream;
 }
 
-
 /* The shared lock. */
 
 struct _LibBalsaMimeStreamSharedLock {
@@ -140,27 +134,23 @@ lbmss_lock_new(void)
     return lock;
 }
 
-
 static LibBalsaMimeStreamSharedLock *
-lbmss_lock_ref(LibBalsaMimeStreamSharedLock *lock)
+lbmss_lock_ref(LibBalsaMimeStreamSharedLock * lock)
 {
     ++lock->ref_count;
 
     return lock;
 }
 
-
 static void
-lbmss_lock_unref(LibBalsaMimeStreamSharedLock *lock)
+lbmss_lock_unref(LibBalsaMimeStreamSharedLock * lock)
 {
     g_assert(lock->ref_count > 0);
 
-    if (--lock->ref_count == 0) {
+    if (--lock->ref_count == 0)
         g_free(lock);
-    }
 }
 
-
 /* Object class method. */
 
 static void
@@ -174,7 +164,6 @@ lbmss_finalize(GObject *object)
     G_OBJECT_CLASS(parent_class)->finalize(object);
 }
 
-
 /* Stream class methods. */
 
 #define lbmss_thread_has_lock(stream)                     \
@@ -182,47 +171,36 @@ lbmss_finalize(GObject *object)
      && LIBBALSA_MIME_STREAM_SHARED(stream)->lock->thread == g_thread_self())
 
 static ssize_t
-lbmss_stream_read(GMimeStream *stream,
-                  char        *buf,
-                  size_t       len)
+lbmss_stream_read(GMimeStream * stream, char *buf, size_t len)
 {
     g_return_val_if_fail(lbmss_thread_has_lock(stream), -1);
     return GMIME_STREAM_CLASS(parent_class)->read(stream, buf, len);
 }
 
-
 static ssize_t
-lbmss_stream_write(GMimeStream *stream,
-                   const char  *buf,
-                   size_t       len)
+lbmss_stream_write(GMimeStream * stream, const char *buf, size_t len)
 {
     g_return_val_if_fail(lbmss_thread_has_lock(stream), -1);
     return GMIME_STREAM_CLASS(parent_class)->write(stream, buf, len);
 }
 
-
 static int
-lbmss_stream_reset(GMimeStream *stream)
+lbmss_stream_reset(GMimeStream * stream)
 {
     g_return_val_if_fail(lbmss_thread_has_lock(stream), -1);
     return GMIME_STREAM_CLASS(parent_class)->reset(stream);
 }
 
-
 static gint64
-lbmss_stream_seek(GMimeStream    *stream,
-                  gint64          offset,
+lbmss_stream_seek(GMimeStream * stream, gint64 offset,
                   GMimeSeekWhence whence)
 {
     g_return_val_if_fail(lbmss_thread_has_lock(stream), -1);
     return GMIME_STREAM_CLASS(parent_class)->seek(stream, offset, whence);
 }
 
-
 static GMimeStream *
-lbmss_stream_substream(GMimeStream *stream,
-                       gint64       start,
-                       gint64       end)
+lbmss_stream_substream(GMimeStream * stream, gint64 start, gint64 end)
 {
     LibBalsaMimeStreamShared *stream_shared;
     GMimeStreamFs *fstream;
@@ -240,7 +218,6 @@ lbmss_stream_substream(GMimeStream *stream,
     return GMIME_STREAM(fstream);
 }
 
-
 /* Public methods. */
 
 /**
@@ -274,7 +251,6 @@ libbalsa_mime_stream_shared_new(int fd)
     return GMIME_STREAM(fstream);
 }
 
-
 /**
  * libbalsa_mime_stream_shared_lock:
  * @stream: shared stream
@@ -282,7 +258,7 @@ libbalsa_mime_stream_shared_new(int fd)
  * Lock the shared stream
  **/
 void
-libbalsa_mime_stream_shared_lock(GMimeStream *stream)
+libbalsa_mime_stream_shared_lock(GMimeStream * stream)
 {
     LibBalsaMimeStreamShared *stream_shared;
     LibBalsaMimeStreamSharedLock *lock;
@@ -290,28 +266,24 @@ libbalsa_mime_stream_shared_lock(GMimeStream *stream)
 
     g_return_if_fail(GMIME_IS_STREAM(stream));
 
-    if (GMIME_IS_STREAM_FILTER(stream)) {
+    if (GMIME_IS_STREAM_FILTER(stream))
         stream = ((GMimeStreamFilter *) stream)->source;
-    }
 
-    if (!LIBBALSA_IS_MIME_STREAM_SHARED(stream)) {
+    if (!LIBBALSA_IS_MIME_STREAM_SHARED(stream))
         return;
-    }
 
     stream_shared = (LibBalsaMimeStreamShared *) stream;
     lock = stream_shared->lock;
     thread_self = g_thread_self();
 
     g_mutex_lock(&lbmss_mutex);
-    while (lock->count > 0 && lock->thread != thread_self) {
+    while (lock->count > 0 && lock->thread != thread_self)
         g_cond_wait(&lbmss_cond, &lbmss_mutex);
-    }
     ++lock->count;
     lock->thread = thread_self;
     g_mutex_unlock(&lbmss_mutex);
 }
 
-
 /**
  * libbalsa_mime_stream_shared_unlock:
  * @stream: shared stream
@@ -319,28 +291,25 @@ libbalsa_mime_stream_shared_lock(GMimeStream *stream)
  * Unlock the shared stream
  **/
 void
-libbalsa_mime_stream_shared_unlock(GMimeStream *stream)
+libbalsa_mime_stream_shared_unlock(GMimeStream * stream)
 {
     LibBalsaMimeStreamShared *stream_shared;
     LibBalsaMimeStreamSharedLock *lock;
 
     g_return_if_fail(GMIME_IS_STREAM(stream));
 
-    if (GMIME_IS_STREAM_FILTER(stream)) {
+    if (GMIME_IS_STREAM_FILTER(stream))
         stream = ((GMimeStreamFilter *) stream)->source;
-    }
 
-    if (!LIBBALSA_IS_MIME_STREAM_SHARED(stream)) {
+    if (!LIBBALSA_IS_MIME_STREAM_SHARED(stream))
         return;
-    }
 
     stream_shared = (LibBalsaMimeStreamShared *) stream;
     lock = stream_shared->lock;
     g_return_if_fail(lock->count > 0);
 
     g_mutex_lock(&lbmss_mutex);
-    if (--lock->count == 0) {
+    if (--lock->count == 0)
         g_cond_signal(&lbmss_cond);
-    }
     g_mutex_unlock(&lbmss_mutex);
 }
diff --git a/libbalsa/mime-stream-shared.h b/libbalsa/mime-stream-shared.h
index 41a33c0..0db62a2 100644
--- a/libbalsa/mime-stream-shared.h
+++ b/libbalsa/mime-stream-shared.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -22,7 +22,7 @@
 #define __LIBBALSA_MIME_STREAM_SHARED_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include <gmime/gmime-stream-fs.h>
@@ -48,14 +48,14 @@
                                LIBBALSA_TYPE_MIME_STREAM_SHARED,   \
                                LibBalsaMimeStreamSharedClass))
 
-typedef struct _LibBalsaMimeStreamShared LibBalsaMimeStreamShared;
+typedef struct _LibBalsaMimeStreamShared      LibBalsaMimeStreamShared;
 typedef struct _LibBalsaMimeStreamSharedClass LibBalsaMimeStreamSharedClass;
 
 GType libbalsa_mime_stream_shared_get_type(void);
 
 GMimeStream *libbalsa_mime_stream_shared_new(int fd);
 
-void libbalsa_mime_stream_shared_lock(GMimeStream *stream);
-void libbalsa_mime_stream_shared_unlock(GMimeStream *stream);
+void libbalsa_mime_stream_shared_lock  (GMimeStream * stream);
+void libbalsa_mime_stream_shared_unlock(GMimeStream * stream);
 
 #endif                          /* __LIBBALSA_MIME_STREAM_SHARED_H__ */
diff --git a/libbalsa/mime.c b/libbalsa/mime.c
index a830d8a..b090933 100644
--- a/libbalsa/mime.c
+++ b/libbalsa/mime.c
@@ -6,20 +6,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <string.h>
@@ -32,25 +32,21 @@
 
 /* FIXME: The content of this file could go to message.c */
 
-static GString *process_mime_multipart(LibBalsaMessage     *message,
-                                       LibBalsaMessageBody *body,
-                                       gchar               *reply_prefix_str,
-                                       gint                 llen,
-                                       gboolean             ignore_html,
-                                       gboolean             flow);
+static GString *process_mime_multipart(LibBalsaMessage * message,
+                                       LibBalsaMessageBody * body,
+                                      gchar * reply_prefix_str,
+                                      gint llen, gboolean ignore_html,
+                                       gboolean flow);
 
 /* process_mime_part:
    returns string representation of given message part.
    NOTE: may return NULL(!).
- */
+*/
 
 GString *
-process_mime_part(LibBalsaMessage     *message,
-                  LibBalsaMessageBody *body,
-                  gchar               *reply_prefix_str,
-                  gint                 llen,
-                  gboolean             ignore_html,
-                  gboolean             flow)
+process_mime_part(LibBalsaMessage * message, LibBalsaMessageBody * body,
+                 gchar * reply_prefix_str, gint llen, gboolean ignore_html,
+                  gboolean flow)
 {
     gchar *res = NULL;
 #ifdef HAVE_HTML_WIDGET
@@ -68,38 +64,33 @@ process_mime_part(LibBalsaMessage     *message,
     case LIBBALSA_MESSAGE_BODY_TYPE_MODEL:
     case LIBBALSA_MESSAGE_BODY_TYPE_MESSAGE:
     case LIBBALSA_MESSAGE_BODY_TYPE_VIDEO:
-        break;
-
+       break;
     case LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART:
         reply = process_mime_multipart(message, body, reply_prefix_str,
                                        llen, ignore_html, flow);
-        break;
-
+       break;
     case LIBBALSA_MESSAGE_BODY_TYPE_TEXT:
-        /* don't return text/html stuff... */
-        mime_type = libbalsa_message_body_get_mime_type(body);
-        html_type = libbalsa_html_type(mime_type);
-        g_free(mime_type);
+       /* don't return text/html stuff... */
+       mime_type = libbalsa_message_body_get_mime_type(body);
+       html_type = libbalsa_html_type(mime_type);
+       g_free(mime_type);
 
-        if (ignore_html && html_type) {
-            break;
-        }
+       if (ignore_html && html_type)
+           break;
 
 #ifdef HAVE_HTML_WIDGET
-        allocated = libbalsa_message_body_get_content(body, &res, NULL);
-        if (!res) {
-            return NULL;
-        }
-
-        if (html_type) {
-            allocated = libbalsa_html_filter(html_type, &res, allocated);
-            libbalsa_html_to_string(&res, allocated);
-        }
+       allocated = libbalsa_message_body_get_content(body, &res, NULL);
+       if (!res)
+           return NULL;
+
+       if (html_type) {
+           allocated = libbalsa_html_filter(html_type, &res, allocated);
+           libbalsa_html_to_string(&res, allocated);
+       }
 #else  /* HAVE_HTML_WIDGET */
-        libbalsa_message_body_get_content(body, &res, NULL);
-        if (!res) {
-            return NULL;
-        }
+       libbalsa_message_body_get_content(body, &res, NULL);
+       if (!res)
+           return NULL;
 #endif /* HAVE_HTML_WIDGET */
 
         if (flow && libbalsa_message_body_is_flowed(body)) {
@@ -118,59 +109,50 @@ process_mime_part(LibBalsaMessage     *message,
         }
 
         if (llen > 0) {
-            if (reply_prefix_str) {
-                llen -= strlen(reply_prefix_str);
-            }
-            libbalsa_wrap_string(res, llen);
-        }
+           if (reply_prefix_str)
+               llen -= strlen(reply_prefix_str);
+           libbalsa_wrap_string(res, llen);
+       }
 
         if (reply_prefix_str || flow) {
-            gchar *str, *ptr;
-            /* prepend the prefix to all the lines */
-
-            reply = g_string_new("");
-            str = res;
-            do {
-                ptr = strchr(str, '\n');
-                if (ptr) {
-                    *ptr = '\0';
-                }
-                if (reply_prefix_str) {
-                    reply = g_string_append(reply, reply_prefix_str);
-                }
+           gchar *str, *ptr;
+           /* prepend the prefix to all the lines */
+
+           reply = g_string_new("");
+           str = res;
+           do {
+               ptr = strchr(str, '\n');
+               if (ptr)
+                   *ptr = '\0';
+                if (reply_prefix_str)
+               reply = g_string_append(reply, reply_prefix_str);
                 if (flow) {
                     gchar *p;
                     /* we're making a `format=flowed' message, but the
                      * message we're quoting was `format=fixed', so we
                      * must make sure all lines are `fixed'--that is,
                      * trim any trailing ' ' characters */
-                    for (p = str; *p; ++p) {
-                    }
-                    while (*--p == ' ') {
-                    }
+                    for (p = str; *p; ++p);
+                    while (*--p == ' ');
                     *++p = '\0';
                 }
-                reply = g_string_append(reply, str);
-                reply = g_string_append_c(reply, '\n');
-                str = ptr;
-            } while (str++);
-        } else {
-            reply = g_string_new(res);
-        }
-        g_free(res);
-        break;
+               reply = g_string_append(reply, str);
+               reply = g_string_append_c(reply, '\n');
+               str = ptr;
+           } while (str++);
+       } else
+           reply = g_string_new(res);
+       g_free(res);
+       break;
     }
     return reply;
 }
 
-
 static GString *
-process_mime_multipart(LibBalsaMessage     *message,
-                       LibBalsaMessageBody *body,
-                       gchar               *reply_prefix_str,
-                       gint                 llen,
-                       gboolean             ignore_html,
-                       gboolean             flow)
+process_mime_multipart(LibBalsaMessage * message,
+                       LibBalsaMessageBody * body,
+                      gchar * reply_prefix_str, gint llen,
+                      gboolean ignore_html, gboolean flow)
 {
     LibBalsaMessageBody *part;
     GString *res = NULL, *s;
@@ -178,30 +160,23 @@ process_mime_multipart(LibBalsaMessage     *message,
     for (part = body->parts; part; part = part->next) {
         s = process_mime_part(message, part, reply_prefix_str, llen,
                               ignore_html, flow);
-        if (!s) {
-            continue;
-        }
-        if (res) {
-            if (res->str[res->len - 1] != '\n') {
-                g_string_append_c(res, '\n');
-            }
-            g_string_append_c(res, '\n');
-            g_string_append(res, s->str);
-            g_string_free(s, TRUE);
-        } else {
-            res = s;
-        }
+       if (!s)
+           continue;
+       if (res) {
+           if (res->str[res->len - 1] != '\n')
+               g_string_append_c(res, '\n');
+           g_string_append_c(res, '\n');
+           g_string_append(res, s->str);
+           g_string_free(s, TRUE);
+       } else
+           res = s;
     }
     return res;
 }
 
-
 GString *
-content2reply(LibBalsaMessageBody *root,
-              gchar               *reply_prefix_str,
-              gint                 llen,
-              gboolean             ignore_html,
-              gboolean             flow)
+content2reply(LibBalsaMessageBody * root, gchar * reply_prefix_str,
+             gint llen, gboolean ignore_html, gboolean flow)
 {
     LibBalsaMessage *message = root->message;
     LibBalsaMessageBody *body;
@@ -209,26 +184,23 @@ content2reply(LibBalsaMessageBody *root,
 
     libbalsa_message_body_ref(message, FALSE, FALSE);
     for (body = root; body; body = body->next) {
-        res = process_mime_part(message, body, reply_prefix_str, llen,
+       res = process_mime_part(message, body, reply_prefix_str, llen,
                                 ignore_html, flow);
-        if (!res) {
-            continue;
-        }
-        if (reply) {
-            reply = g_string_append(reply, res->str);
-            g_string_free(res, TRUE);
-        } else {
-            reply = res;
-        }
+       if (!res)
+           continue;
+       if (reply) {
+           reply = g_string_append(reply, res->str);
+           g_string_free(res, TRUE);
+       } else
+           reply = res;
     }
     libbalsa_message_body_unref(message);
 
     return reply;
 }
 
-
 /*
- * implement RFC2646 `text=flowed'
+ * implement RFC2646 `text=flowed' 
  * first version by Emmanuel <e allaud wanadoo fr>
  * this version by Peter <PeterBloomfield mindspring com>
  *
@@ -254,8 +226,8 @@ content2reply(LibBalsaMessageBody *root,
  * http://www.faqs.org/rfcs/rfc3676.html
  */
 
-#define MAX_WIDTH       997     /* enshrined somewhere */
-#define QUOTE_CHAR      '>'
+#define MAX_WIDTH      997     /* enshrined somewhere */
+#define QUOTE_CHAR     '>'
 
 /*
  * we'll use one routine to parse text into paragraphs
@@ -270,9 +242,7 @@ typedef struct {
 } rfc2646text;
 
 static GList *
-unwrap_rfc2646(gchar   *str,
-               gboolean from_screen,
-               gboolean delsp)
+unwrap_rfc2646(gchar * str, gboolean from_screen, gboolean delsp)
 {
     GList *list = NULL;
 
@@ -290,59 +260,50 @@ unwrap_rfc2646(gchar   *str,
             gchar *p;
             gint len;
 
-            for (p = str; *p == QUOTE_CHAR; p++) {
-                /* nothing */
-            }
+            for (p = str; *p == QUOTE_CHAR; p++)
+                /* nothing */;
             len = p - str;
             sig_sep = (p[0] == '-' && p[1] == '-' && p[2] == ' '
                        && (p[3] == '\n'
                            || (p[3] == '\r' && p[4] == '\n')));
-            if (text->quote_depth < 0) {
+            if (text->quote_depth < 0)
                 text->quote_depth = len;
-            } else if ((len != text->quote_depth) || sig_sep) {
+            else if (len != text->quote_depth || sig_sep)
                 /* broken! a flowed line was followed by either a line
                  * with different quote depth, or a sig separator
                  *
                  * we'll break before updating str, so we pick up this
                  * line again on the next pass through this loop */
                 break;
-            }
 
-            if ((*p == ' ') && (!from_screen || (len > 0))) {
+            if (*p == ' ' && (!from_screen || len > 0))
                 /* space stuffed */
                 p++;
-            }
 
             /* move str to the start of the next line, if any */
-            for (str = p; *str && *str != '\n'; str++) {
-                /* nothing */
-            }
+            for (str = p; *str && *str != '\n'; str++)
+                /* nothing */;
             len = str - p;
-            if (*str) {
+            if (*str)
                 str++;
-            }
 
-            if ((len > 0) && (p[len - 1] == '\r')) {
+            if(len>0 && p[len-1] == '\r')
                 len--;  /* take care of '\r\n' line endings */
-            }
-            flowed = (len > 0 && p[len - 1] == ' ' && !sig_sep);
-            if (flowed && delsp) {
-                /* Don't include the last space. */
-                --len;
-            }
+           flowed = (len > 0 && p[len - 1] == ' ' && !sig_sep);
+           if (flowed && delsp)
+               /* Don't include the last space. */
+               --len;
 
             g_string_append_len(string, p, len);
         }
         text->str = g_string_free(string, FALSE);
         if (flowed) {
-            /* Broken: remove trailing spaces. */
+           /* Broken: remove trailing spaces. */
             gchar *p = text->str;
-            while (*p) {
+            while (*p)
                 p++;
-            }
-            while (--p >= text->str && *p == ' ') {
-                /* nothing */
-            }
+            while (--p >= text->str && *p == ' ')
+                /* nothing */ ;
             *++p = '\0';
         }
         list = g_list_append(list, text);
@@ -351,7 +312,6 @@ unwrap_rfc2646(gchar   *str,
     return list;
 }
 
-
 /*
  * we'll use one routine to wrap the paragraphs
  *
@@ -359,11 +319,8 @@ unwrap_rfc2646(gchar   *str,
  * if it's going to the screen, don't space-stuff unquoted lines
  * */
 static void
-dowrap_rfc2646(GList   *list,
-               gint     width,
-               gboolean to_screen,
-               gboolean quote,
-               GString *result)
+dowrap_rfc2646(GList * list, gint width, gboolean to_screen,
+               gboolean quote, GString * result)
 {
     const gint max_width = to_screen ? G_MAXINT : MAX_WIDTH - 4;
 
@@ -375,9 +332,8 @@ dowrap_rfc2646(GList   *list,
 
         str = text->str;
         qd = text->quote_depth;
-        if (quote) {
+        if (quote)
             qd++;
-        }
         /* one output line per middle loop */
         do {                    /* ... while (*str); */
             gboolean first_word = TRUE;
@@ -387,9 +343,8 @@ dowrap_rfc2646(GList   *list,
             gint i;
 
             /* start of line: emit quote string */
-            for (i = 0; i < qd; i++) {
+            for (i = 0; i < qd; i++)
                 g_string_append_c(result, QUOTE_CHAR);
-            }
             /* space-stuffing:
              * - for the wire, stuffing is required for lines beginning
              *   with ` ', `>', or `From '
@@ -398,13 +353,13 @@ dowrap_rfc2646(GList   *list,
              *   of quoting string and text
              * - ...but we mustn't stuff `-- ' */
             if (((!to_screen
-                  && ((*str == ' ') || (*str == QUOTE_CHAR)
-                      || !strncmp(str, "From ", 5))) || (len > 0))
+                  && (*str == ' ' || *str == QUOTE_CHAR
+                      || !strncmp(str, "From ", 5))) || len > 0)
                 && strcmp(str, "-- ")) {
                 g_string_append_c(result, ' ');
                 ++len;
             }
-            /*
+            /* 
              * wrapping strategy:
              * break line into words, each with its trailing whitespace;
              * emit words while they don't break the width;
@@ -421,12 +376,11 @@ dowrap_rfc2646(GList   *list,
                     str = g_utf8_next_char(str);
                 }
                 while ((str - start) < max_width && isspace((int)*str)) {
-                    if (*str == '\t') {
+                    if (*str == '\t')
                         len += 8 - len % 8;
-                    } else {
+                    else
                         len++;
-                    }
-                    str = g_utf8_next_char(str);
+                    str = g_utf8_next_char(str);;
                 }
                 /*
                  * to avoid some unnecessary space-stuffing,
@@ -434,18 +388,16 @@ dowrap_rfc2646(GList   *list,
                  * (we already passed any spaces, so just check for '>'
                  * and "From ")
                  * */
-                if (((str - start) < max_width) && *str
-                    && ((*str == QUOTE_CHAR)
-                        || !strncmp(str, "From ", 5))) {
+                if ((str - start) < max_width && *str
+                    && (*str == QUOTE_CHAR
+                        || !strncmp(str, "From ", 5)))
                     continue;
-                }
 
-                if (!*str || (len > width) || ((str - start) >= max_width)) {
+                if (!*str || len > width || (str - start) >= max_width) {
                     /* allow an overlong first word, otherwise back up
                      * str */
-                    if ((len > width) && !first_word) {
+                    if (len > width && !first_word)
                         str = line_break;
-                    }
                     g_string_append_len(result, start, str - start);
                     break;
                 }
@@ -454,45 +406,40 @@ dowrap_rfc2646(GList   *list,
             }                   /* end of loop over words */
 
             if (*str) {         /* line separator */
-                if (to_screen || (str == start)) {
-                    g_string_append_c(result, '\n');
-                } else {        /* DelSP = Yes */
-                    g_string_append(result, " \n");
-                }
-            }
+                if (to_screen || str == start)
+                   g_string_append_c(result, '\n');
+               else            /* DelSP = Yes */
+                   g_string_append(result, " \n");
+           }
         } while (*str);         /* end of loop over output lines */
 
         g_free(text->str);
         g_free(text);
         list = list->next;
-        if (list != NULL) {     /* paragraph separator */
+        if (list != NULL)       /* paragraph separator */
             g_string_append_c(result, '\n');
-        }
     }                           /* end of paragraph */
 }
 
-
 /* GString *libbalsa_process_text_rfc2646:
-   re-wrap given flowed string to required width.
+   re-wrap given flowed string to required width. 
    Parameters:
    gchar * par:          string to be wrapped
    gint width:           maximum length of wrapped line
    gboolean from_screen: is par from the text input area of
                          a sendmsg-window?
    gboolean to_screen:   is the wrapped text going to be
-                         displayed in the text area of a sendmsg-window
+                         displayed in the text area of a sendmsg-window 
                          or of a received message window?
-   gboolean quote:       should the wrapped lines be prefixed
+   gboolean quote:       should the wrapped lines be prefixed 
                          with the RFC 2646 quote character '>'?
    gboolean delsp:      was the message formatted with DelSp=Yes?
- */
+*/
 GString *
-libbalsa_process_text_rfc2646(gchar   *par,
-                              gint     width,
+libbalsa_process_text_rfc2646(gchar * par, gint width,
                               gboolean from_screen,
-                              gboolean to_screen,
-                              gboolean quote,
-                              gboolean delsp)
+                              gboolean to_screen, gboolean quote,
+                             gboolean delsp)
 {
     gint len = strlen(par);
     GString *result = g_string_sized_new(len);
@@ -505,18 +452,14 @@ libbalsa_process_text_rfc2646(gchar   *par,
     return result;
 }
 
-
 /* libbalsa_wrap_rfc2646:
    wraps given string using soft breaks according to rfc2646
    convenience function, uses libbalsa_process_text_rfc2646 to do all
    the work, but returns a gchar * and g_free's the string passed in
- */
+*/
 gchar *
-libbalsa_wrap_rfc2646(gchar   *par,
-                      gint     width,
-                      gboolean from_screen,
-                      gboolean to_screen,
-                      gboolean delsp)
+libbalsa_wrap_rfc2646(gchar * par, gint width, gboolean from_screen,
+                      gboolean to_screen, gboolean delsp)
 {
     GString *result;
 
@@ -527,7 +470,6 @@ libbalsa_wrap_rfc2646(gchar   *par,
     return g_string_free(result, FALSE);
 }
 
-
 /*
  * libbalsa_wrap_view(GtkTextView * view, gint length)
  *
@@ -535,18 +477,14 @@ libbalsa_wrap_rfc2646(gchar   *par,
  */
 
 /* Forward references: */
-static GtkTextTag *get_quote_tag(GtkTextIter *iter);
-static gint get_quote_depth(GtkTextIter *iter,
-                            gchar      **quote_string);
-static gchar *get_line(GtkTextBuffer *buffer,
-                       GtkTextIter   *iter);
-static gboolean is_in_url(GtkTextIter *iter,
-                          gint         offset,
-                          GtkTextTag  *url_tag);
+static GtkTextTag *get_quote_tag(GtkTextIter * iter);
+static gint get_quote_depth(GtkTextIter * iter, gchar ** quote_string);
+static gchar *get_line(GtkTextBuffer * buffer, GtkTextIter * iter);
+static gboolean is_in_url(GtkTextIter * iter, gint offset,
+                          GtkTextTag * url_tag);
 
 void
-libbalsa_wrap_view(GtkTextView *view,
-                   gint         length)
+libbalsa_wrap_view(GtkTextView * view, gint length)
 {
     GtkTextBuffer *buffer = gtk_text_view_get_buffer(view);
     GtkTextTagTable *table = gtk_text_buffer_get_tag_table(buffer);
@@ -560,104 +498,96 @@ libbalsa_wrap_view(GtkTextView *view,
 
     /* Loop over original lines. */
     while (!gtk_text_iter_is_end(&iter)) {
-        GtkTextTag *quote_tag;
-        gchar *quote_string;
-        gint quote_len;
-
-        quote_tag = get_quote_tag(&iter);
-        quote_len = get_quote_depth(&iter, &quote_string);
-        if (quote_string) {
-            if (quote_string[quote_len]) {
-                quote_len++;
-            } else {
-                gchar *tmp = g_strconcat(quote_string, " ", NULL);
-                g_free(quote_string);
-                quote_string = tmp;
-            }
-        }
-
-        /* Loop over breaks within the original line. */
-        while (!gtk_text_iter_ends_line(&iter)) {
-            gchar *line;
-            gint num_chars;
-            gint attrs_len;
-            gint offset;
-            gint len;
-            gint brk_offset = 0;
-            gunichar c = 0;
-            gboolean in_space = FALSE;
-
-            line = get_line(buffer, &iter);
-            num_chars = g_utf8_strlen(line, -1);
-            attrs_len = num_chars + 1;
-            log_attrs = g_renew(PangoLogAttr, log_attrs, attrs_len);
-            pango_get_log_attrs(line, -1, -1, language, log_attrs, attrs_len);
-            g_free(line);
-
-            for (len = offset = quote_len;
-                 len < length && offset < num_chars; offset++) {
-                gtk_text_iter_set_line_offset(&iter, offset);
-                c = gtk_text_iter_get_char(&iter);
-                if (c == '\t') {
-                    len = ((len + 8) / 8) * 8;
-                } else if (g_unichar_isprint(c)) {
-                    len++;
-                }
-
-                if (log_attrs[offset].is_line_break
-                    && !is_in_url(&iter, offset, url_tag)) {
-                    brk_offset = offset;
-                }
-            }
-
-            if (len < length) {
-                break;
-            }
-
-            in_space = g_unichar_isspace(c);
-            if ((brk_offset > quote_len) && !in_space) {
-                /* Break at the last break we saw. */
-                gtk_text_iter_set_line_offset(&iter, brk_offset);
-            } else {
+       GtkTextTag *quote_tag;
+       gchar *quote_string;
+       gint quote_len;
+
+       quote_tag = get_quote_tag(&iter);
+       quote_len = get_quote_depth(&iter, &quote_string);
+       if (quote_string) {
+           if (quote_string[quote_len])
+               quote_len++;
+           else {
+               gchar *tmp = g_strconcat(quote_string, " ", NULL);
+               g_free(quote_string);
+               quote_string = tmp;
+           }
+       }
+
+       /* Loop over breaks within the original line. */
+       while (!gtk_text_iter_ends_line(&iter)) {
+           gchar *line;
+           gint num_chars;
+           gint attrs_len;
+           gint offset;
+           gint len;
+           gint brk_offset = 0;
+           gunichar c = 0;
+           gboolean in_space = FALSE;
+
+           line = get_line(buffer, &iter);
+           num_chars = g_utf8_strlen(line, -1);
+           attrs_len = num_chars + 1;
+           log_attrs = g_renew(PangoLogAttr, log_attrs, attrs_len);
+           pango_get_log_attrs(line, -1, -1, language, log_attrs, attrs_len);
+           g_free(line);
+
+           for (len = offset = quote_len;
+                len < length && offset < num_chars; offset++) {
+               gtk_text_iter_set_line_offset(&iter, offset);
+               c = gtk_text_iter_get_char(&iter);
+               if (c == '\t')
+                   len = ((len + 8) / 8) * 8;
+               else if (g_unichar_isprint(c))
+                   len++;
+
+               if (log_attrs[offset].is_line_break
+                   && !is_in_url(&iter, offset, url_tag))
+                   brk_offset = offset;
+           }
+
+           if (len < length)
+               break;
+
+           in_space = g_unichar_isspace(c);
+           if (brk_offset > quote_len && !in_space)
+               /* Break at the last break we saw. */
+               gtk_text_iter_set_line_offset(&iter, brk_offset);
+           else {
                 GtkTextIter start = iter;
-                /* Break at the next line break. */
-                if (offset <= quote_len) {
-                    offset = quote_len + 1;
-                }
-                while (offset < num_chars
-                       && (is_in_url(&iter, offset, url_tag)
-                           || !log_attrs[offset].is_line_break)) {
-                    offset++;
-                }
-
-                if (offset >= num_chars) {
-                    /* No next line break. */
-                    break;
-                }
+               /* Break at the next line break. */
+               if (offset <= quote_len)
+                   offset = quote_len + 1;
+               while (offset < num_chars
+                      && (is_in_url(&iter, offset, url_tag)
+                          || !log_attrs[offset].is_line_break))
+                   offset++;
+
+               if (offset >= num_chars)
+                   /* No next line break. */
+                   break;
 
                 /* Trim extra trailing whitespace */
                 gtk_text_iter_forward_char(&start);
                 gtk_text_buffer_delete(buffer, &start, &iter);
-            }
-
-            gtk_text_buffer_insert(buffer, &iter, "\n", 1);
-            if (quote_string) {
-                gtk_text_buffer_insert_with_tags(buffer, &iter,
-                                                 quote_string, -1,
-                                                 quote_tag, NULL);
-            }
-        }
-        g_free(quote_string);
-        gtk_text_iter_forward_line(&iter);
+           }
+
+           gtk_text_buffer_insert(buffer, &iter, "\n", 1);
+           if (quote_string)
+               gtk_text_buffer_insert_with_tags(buffer, &iter,
+                                                quote_string, -1,
+                                                quote_tag, NULL);
+       }
+       g_free(quote_string);
+       gtk_text_iter_forward_line(&iter);
     }
     g_free(log_attrs);
 }
 
-
 /* Find the quote tag, if any, at iter; doesn't move iter; returns tag
  * or NULL. */
 static GtkTextTag *
-get_quote_tag(GtkTextIter *iter)
+get_quote_tag(GtkTextIter * iter)
 {
     GtkTextTag *quote_tag = NULL;
     GSList *list;
@@ -668,9 +598,8 @@ get_quote_tag(GtkTextIter *iter)
         gchar *name;
         g_object_get(G_OBJECT(tag), "name", &name, NULL);
         if (name) {
-            if (!strncmp(name, "quote-", 6)) {
+            if (!strncmp(name, "quote-", 6))
                 quote_tag = tag_list->data;
-            }
             g_free(name);
         }
     }
@@ -679,15 +608,13 @@ get_quote_tag(GtkTextIter *iter)
     return quote_tag;
 }
 
-
 /* Move the iter over a string of consecutive '>' characters, and an
  * optional ' ' character; returns the number of '>'s, and, if
  * quote_string is not NULL, stores an allocated copy of the string
  * (including the trailing ' ') at quote_string (or NULL, if there were
  * no '>'s). */
 static gint
-get_quote_depth(GtkTextIter *iter,
-                gchar      **quote_string)
+get_quote_depth(GtkTextIter * iter, gchar ** quote_string)
 {
     gint quote_depth = 0;
     GtkTextIter start = *iter;
@@ -696,71 +623,58 @@ get_quote_depth(GtkTextIter *iter,
         quote_depth++;
         gtk_text_iter_forward_char(iter);
     }
-    if ((quote_depth > 0) && (gtk_text_iter_get_char(iter) == ' ')) {
+    if (quote_depth > 0 && gtk_text_iter_get_char(iter) == ' ')
         gtk_text_iter_forward_char(iter);
-    }
 
     if (quote_string) {
-        if (quote_depth > 0) {
+        if (quote_depth > 0)
             *quote_string = gtk_text_iter_get_text(&start, iter);
-        } else {
+        else
             *quote_string = NULL;
-        }
     }
 
     return quote_depth;
 }
 
-
 /* Move the iter to the start of the line it's on; returns an allocated
  * copy of the line (utf-8, including invisible characters and image
  * markers). */
 static gchar *
-get_line(GtkTextBuffer *buffer,
-         GtkTextIter   *iter)
+get_line(GtkTextBuffer * buffer, GtkTextIter * iter)
 {
     GtkTextIter end;
 
     gtk_text_iter_set_line_offset(iter, 0);
     end = *iter;
-    if (!gtk_text_iter_ends_line(&end)) {
+    if (!gtk_text_iter_ends_line(&end))
         gtk_text_iter_forward_to_line_end(&end);
-    }
 
     return gtk_text_buffer_get_slice(buffer, iter, &end, TRUE);
 }
 
-
 /* Move the iter to position offset in the current line, and test
  * whether it's in an URL. */
 static gboolean
-is_in_url(GtkTextIter *iter,
-          gint         offset,
-          GtkTextTag  *url_tag)
+is_in_url(GtkTextIter * iter, gint offset, GtkTextTag * url_tag)
 {
     gtk_text_iter_set_line_offset(iter, offset);
     return url_tag ? (gtk_text_iter_has_tag(iter, url_tag)
                       && !gtk_text_iter_starts_tag(iter, url_tag)) : FALSE;
 }
 
-
 /* Remove soft newlines and associated quote strings from num_paras
  * paragraphs in the buffer, starting at the line before iter; if
  * num_paras < 0, process the whole buffer. */
 
 /* Forward references: */
-static gboolean prescanner(const gchar *p,
-                           guint        len);
-static void mark_urls(GtkTextBuffer *buffer,
-                      GtkTextIter   *iter,
-                      GtkTextTag    *tag,
-                      const gchar   *p);
+static gboolean prescanner(const gchar * p, guint len);
+static void mark_urls(GtkTextBuffer * buffer, GtkTextIter * iter,
+                      GtkTextTag * tag, const gchar * p);
 static GRegex *get_url_reg(void);
 
 void
-libbalsa_unwrap_buffer(GtkTextBuffer *buffer,
-                       GtkTextIter   *iter,
-                       gint           num_paras)
+libbalsa_unwrap_buffer(GtkTextBuffer * buffer, GtkTextIter * iter,
+                      gint num_paras)
 {
     GtkTextTagTable *table = gtk_text_buffer_get_tag_table(buffer);
     GtkTextTag *url_tag = gtk_text_tag_table_lookup(table, "url");
@@ -769,74 +683,67 @@ libbalsa_unwrap_buffer(GtkTextBuffer *buffer,
     gtk_text_iter_set_line_offset(iter, 0);
 
     for (; num_paras; num_paras--) {
-        gint quote_depth;
-        GtkTextIter start;
-        gchar *line;
-
-        gtk_text_iter_set_line_offset(iter, 0);
-        quote_depth = get_quote_depth(iter, NULL);
-
-        /* Move to the end of the line, if not there already. */
-        if (!gtk_text_iter_ends_line(iter)
-            && !gtk_text_iter_forward_to_line_end(iter)) {
-            return;
-        }
-        /* Save this iter as the start of a possible deletion. */
-        start = *iter;
-        /* Move to the start of the next line. */
-        if (!gtk_text_iter_forward_line(iter)) {
-            return;
-        }
-
-        if (num_paras < 0) {
-            /* This is a wrap_body call, not a continuous wrap, so we'll
-             * remove spaces before a hard newline. */
-            GtkTextIter tmp_iter;
-
-            /* Make sure it's not a usenet sig separator: */
-            tmp_iter = start;
-            if (!(gtk_text_iter_backward_char(&tmp_iter)
-                  && (gtk_text_iter_get_char(&tmp_iter) == ' ')
-                  && gtk_text_iter_backward_char(&tmp_iter)
-                  && (gtk_text_iter_get_char(&tmp_iter) == '-')
-                  && gtk_text_iter_backward_char(&tmp_iter)
-                  && (gtk_text_iter_get_char(&tmp_iter) == '-')
-                  && (gtk_text_iter_get_line_offset(&tmp_iter) ==
-                      quote_depth))) {
-                *iter = start;
-                while (gtk_text_iter_get_line_offset(&start) >
-                       (quote_depth ? quote_depth + 1 : 0)) {
-                    gtk_text_iter_backward_char(&start);
-                    if (gtk_text_iter_get_char(&start) != ' ') {
-                        gtk_text_iter_forward_char(&start);
-                        break;
-                    }
-                }
-                gtk_text_buffer_delete(buffer, &start, iter);
-            }
-            if (!gtk_text_iter_forward_line(iter)) {
-                return;
-            }
-        }
-
-        line = get_line(buffer, &start);
-        if (prescanner(line, strlen(line))) {
-            mark_urls(buffer, &start, url_tag, line);
-        }
-        g_free(line);
+       gint quote_depth;
+       GtkTextIter start;
+       gchar *line;
+
+       gtk_text_iter_set_line_offset(iter, 0);
+       quote_depth = get_quote_depth(iter, NULL);
+
+       /* Move to the end of the line, if not there already. */
+       if (!gtk_text_iter_ends_line(iter)
+           && !gtk_text_iter_forward_to_line_end(iter))
+           return;
+       /* Save this iter as the start of a possible deletion. */
+       start = *iter;
+       /* Move to the start of the next line. */
+       if (!gtk_text_iter_forward_line(iter))
+           return;
+
+       if (num_paras < 0) {
+           /* This is a wrap_body call, not a continuous wrap, so we'll
+            * remove spaces before a hard newline. */
+           GtkTextIter tmp_iter;
+
+           /* Make sure it's not a usenet sig separator: */
+           tmp_iter = start;
+           if (!(gtk_text_iter_backward_char(&tmp_iter)
+                 && gtk_text_iter_get_char(&tmp_iter) == ' '
+                 && gtk_text_iter_backward_char(&tmp_iter)
+                 && gtk_text_iter_get_char(&tmp_iter) == '-'
+                 && gtk_text_iter_backward_char(&tmp_iter)
+                 && gtk_text_iter_get_char(&tmp_iter) == '-'
+                 && gtk_text_iter_get_line_offset(&tmp_iter) ==
+                 quote_depth)) {
+               *iter = start;
+               while (gtk_text_iter_get_line_offset(&start) >
+                      (quote_depth ? quote_depth + 1 : 0)) {
+                   gtk_text_iter_backward_char(&start);
+                   if (gtk_text_iter_get_char(&start) != ' ') {
+                       gtk_text_iter_forward_char(&start);
+                       break;
+                   }
+               }
+               gtk_text_buffer_delete(buffer, &start, iter);
+           }
+           if (!gtk_text_iter_forward_line(iter))
+               return;
+       }
+
+       line = get_line(buffer, &start);
+       if (prescanner(line, strlen(line)))
+           mark_urls(buffer, &start, url_tag, line);
+       g_free(line);
     }
 }
 
-
 /* Mark URLs in one line of the buffer */
 static void
-mark_urls(GtkTextBuffer *buffer,
-          GtkTextIter   *iter,
-          GtkTextTag    *tag,
-          const gchar   *line)
+mark_urls(GtkTextBuffer * buffer, GtkTextIter * iter, GtkTextTag * tag,
+          const gchar * line)
 {
     const gchar *p = line;
-    const gchar *const line_end = line + strlen(line);
+    const gchar * const line_end = line + strlen(line);
     GRegex *url_reg = get_url_reg();
     GMatchInfo *url_match;
     GtkTextIter start = *iter;
@@ -854,15 +761,13 @@ mark_urls(GtkTextBuffer *buffer,
 
             p += end_pos;
         }
-        if (!prescanner(p, line_end - p)) {
+        if (!prescanner(p, line_end - p))
             break;
-        }
         g_match_info_free(url_match);
     }
     g_match_info_free(url_match);
 }
 
-
 /*
  * End of wrap/unwrap view.
  */
@@ -871,54 +776,46 @@ mark_urls(GtkTextBuffer *buffer,
 /* libbalsa_insert_with_url:
  * do a gtk_text_buffer_insert, but mark URL's with balsa_app.url_color
  *
- * prescanner:
+ * prescanner: 
  * used to find candidates for lines containing URL's.
  * Empirially, this approach is faster (by factor of 8) than scanning
  * entire message with regexec. YMMV.
- * s - is the line to scan.
+ * s - is the line to scan. 
  * returns TRUE if the line may contain an URL.
  */
 static gboolean
-prescanner(const gchar *s,
-           guint        len)
+prescanner(const gchar * s, guint len)
 {
     gint left = len - 5;
 
     while (--left > 0) {
         switch (tolower(*s++)) {
         case 'f':              /* ftp:/, ftps: */
-            if ((tolower(*s) == 't') &&
-                (tolower(*(s + 1)) == 'p') &&
-                ((*(s + 2) == ':') || (tolower(*(s + 2)) == 's')) &&
-                ((*(s + 3) == ':') || (*(s + 3) == '/'))) {
+            if (tolower(*s) == 't' &&
+                tolower(*(s + 1)) == 'p' &&
+                (*(s + 2) == ':' || tolower(*(s + 2)) == 's') &&
+                (*(s + 3) == ':' || *(s + 3) == '/'))
                 return TRUE;
-            }
             break;
-
         case 'h':              /* http:, https */
-            if ((tolower(*s) == 't') &&
-                (tolower(*(s + 1)) == 't') &&
-                (tolower(*(s + 2)) == 'p') &&
-                ((*(s + 3) == ':') || (tolower(*(s + 3)) == 's'))) {
+            if (tolower(*s) == 't' &&
+                tolower(*(s + 1)) == 't' &&
+                tolower(*(s + 2)) == 'p' &&
+                (*(s + 3) == ':' || tolower(*(s + 3)) == 's'))
                 return TRUE;
-            }
             break;
-
         case 'm':              /* mailt */
-            if ((tolower(*s) == 'a') &&
-                (tolower(*(s + 1)) == 'i') &&
-                (tolower(*(s + 2)) == 'l') && (tolower(*(s + 3)) == 't')) {
+            if (tolower(*s) == 'a' &&
+                tolower(*(s + 1)) == 'i' &&
+                tolower(*(s + 2)) == 'l' && tolower(*(s + 3)) == 't')
                 return TRUE;
-            }
             break;
-
         case 'n':              /* news:, nntp: */
-            if (((tolower(*s) == 'e') || (tolower(*s) == 'n')) &&
-                ((tolower(*(s + 1)) == 'w') || (tolower(*(s + 1)) == 't')) &&
-                ((tolower(*(s + 2)) == 's') || (tolower(*(s + 2)) == 'p')) &&
-                (*(s + 3) == ':')) {
+            if ((tolower(*s) == 'e' || tolower(*s) == 'n') &&
+                (tolower(*(s + 1)) == 'w' || tolower(*(s + 1)) == 't') &&
+                (tolower(*(s + 2)) == 's' || tolower(*(s + 2)) == 'p') &&
+                *(s + 3) == ':')
                 return TRUE;
-            }
             break;
         }
     }
@@ -926,7 +823,6 @@ prescanner(const gchar *s,
     return FALSE;
 }
 
-
 struct url_regex_info {
     GRegex *url_reg;
     const gchar *str;
@@ -950,14 +846,13 @@ get_url_helper(struct url_regex_info *info)
     return info->url_reg;
 }
 
-
 static GRegex *
 get_url_reg(void)
 {
     static struct url_regex_info info = {
         NULL,
         "(((https?|ftps?|nntp)://)|(mailto:|news:))"
-        "(%[0-9A-F]{2}|[-_.!~*';/?:@&=+$,#[:alnum:]])+",
+            "(%[0-9A-F]{2}|[-_.!~*';/?:@&=+$,#[:alnum:]])+",
         __func__,
         "url regex compilation failed"
     };
@@ -965,7 +860,6 @@ get_url_reg(void)
     return get_url_helper(&info);
 }
 
-
 static GRegex *
 get_ml_url_reg(void)
 {
@@ -982,7 +876,6 @@ get_ml_url_reg(void)
     return get_url_helper(&info);
 }
 
-
 static GRegex *
 get_ml_flowed_url_reg(void)
 {
@@ -996,12 +889,11 @@ get_ml_flowed_url_reg(void)
     return get_url_helper(&info);
 }
 
-
 gboolean
-libbalsa_insert_with_url(GtkTextBuffer         *buffer,
-                         const char            *chars,
-                         guint                  len,
-                         GtkTextTag            *tag,
+libbalsa_insert_with_url(GtkTextBuffer * buffer,
+                         const char *chars,
+                         guint len,
+                         GtkTextTag * tag,
                          LibBalsaUrlInsertInfo *url_info)
 {
     GtkTextIter iter;
@@ -1011,7 +903,7 @@ libbalsa_insert_with_url(GtkTextBuffer         *buffer,
     gint start_pos, end_pos;
     GRegex *url_reg;
     GMatchInfo *url_match;
-    const gchar *const line_end = chars + len;
+    const gchar * const line_end = chars + len;
 
     gtk_text_buffer_get_iter_at_mark(buffer, &iter,
                                      gtk_text_buffer_get_insert(buffer));
@@ -1020,7 +912,7 @@ libbalsa_insert_with_url(GtkTextBuffer         *buffer,
         const gchar *url_end;
         gchar *url, *q, *r;
 
-        if (!(url_end = strchr(chars, '>')) || (url_end >= line_end)) {
+        if (!(url_end = strchr(chars, '>')) || url_end >= line_end) {
             g_string_append_len(url_info->ml_url_buffer, chars,
                                 line_end - chars);
             g_string_append_c(url_info->ml_url_buffer, '\n');
@@ -1034,11 +926,9 @@ libbalsa_insert_with_url(GtkTextBuffer         *buffer,
                                          url_info->ml_url_buffer->len,
                                          url_tag, tag, NULL);
         q = url = g_new(gchar, url_info->ml_url_buffer->len);
-        for (r = url_info->ml_url_buffer->str; *r; r++) {
-            if (*r > ' ') {
+        for (r = url_info->ml_url_buffer->str; *r; r++)
+            if (*r > ' ')
                 *q++ = *r;
-            }
-        }
         url_info->callback(buffer, &iter, url, q - url,
                            url_info->callback_data);
         g_free(url);
@@ -1065,8 +955,8 @@ libbalsa_insert_with_url(GtkTextBuffer         *buffer,
                                          start_pos, tag, NULL);
 
         /* check if we hit a multi-line URL... (see RFC 1738) */
-        if (((start_pos > 0) && (chars[start_pos - 1] == '<')) ||
-            ((start_pos > 4) &&
+        if ((start_pos > 0 && (chars[start_pos - 1] == '<')) ||
+            (start_pos > 4 &&
              !g_ascii_strncasecmp(chars + start_pos - 5, "<URL:", 5))) {
             GMatchInfo *ml_url_match;
             gint ml_start_pos, ml_end_pos;
@@ -1074,35 +964,33 @@ libbalsa_insert_with_url(GtkTextBuffer         *buffer,
             /* if the input is flowed, we may see a space at
              * url_match.rm_eo - in this case the complete remainder
              * of the ml uri should be in the passed buffer... */
-            if (url_info->buffer_is_flowed && (chars[end_pos] == ' ')) {
+            if (url_info->buffer_is_flowed && chars[end_pos] == ' ') {
                 if (g_regex_match(get_ml_flowed_url_reg(), chars + end_pos,
                                   0, &ml_url_match)
                     && g_match_info_fetch_pos(ml_url_match, 0,
                                               &ml_start_pos, &ml_end_pos)
-                    && (ml_start_pos == 0)) {
+                    && ml_start_pos == 0)
                     end_pos += ml_end_pos - 1;
-                }
                 g_match_info_free(ml_url_match);
             } else if (chars[end_pos] != '>') {
                 if (g_regex_match(get_ml_url_reg(), chars + end_pos,
                                   0, &ml_url_match)
                     && g_match_info_fetch_pos(ml_url_match, 0,
                                               &ml_start_pos, NULL)
-                    && (ml_start_pos == 0)) {
+                    && ml_start_pos == 0) {
                     chars += start_pos;
                     url_info->ml_url_buffer =
                         g_string_new_len(chars, line_end - chars);
                     g_string_append_c(url_info->ml_url_buffer, '\n');
                 }
                 g_match_info_free(ml_url_match);
-                if (url_info->ml_url_buffer) {
+                if (url_info->ml_url_buffer)
                     return TRUE;
-                }
             }
         }
 
         /* add the url - it /may/ contain spaces if the text is flowed */
-        if ((spc = strchr(chars + start_pos, ' ')) && (spc < chars + end_pos)) {
+        if ((spc = strchr(chars + start_pos, ' ')) && spc < chars + end_pos) {
             GString *uri_real = g_string_new("");
             gchar *q, *buf;
 
@@ -1140,9 +1028,8 @@ libbalsa_insert_with_url(GtkTextBuffer         *buffer,
                 && g_match_info_fetch_pos(url_match, 0, &start_pos,
                                           &end_pos)
                 && chars + start_pos < line_end;
-        } else {
+        } else
             match = FALSE;
-        }
     }
     g_match_info_free(url_match);
 
@@ -1152,10 +1039,8 @@ libbalsa_insert_with_url(GtkTextBuffer         *buffer,
     return FALSE;
 }
 
-
 void
-libbalsa_unwrap_selection(GtkTextBuffer *buffer,
-                          GRegex        *rex)
+libbalsa_unwrap_selection(GtkTextBuffer * buffer, GRegex * rex)
 {
     GtkTextIter start, end;
     gchar *line;
@@ -1171,73 +1056,64 @@ libbalsa_unwrap_selection(GtkTextBuffer *buffer,
     /* Find quote depth and index of first non-quoted character. */
     line = get_line(buffer, &start);
     if (libbalsa_match_regex(line, rex, &quote_depth, &index)) {
-        /* skip one regular space following the quote characters */
-        if (line[index] == ' ') {
-            index++;
-        }
-        /* Replace quote string with standard form. */
-        end = start;
-        gtk_text_iter_set_line_index(&end, index);
-        gtk_text_buffer_delete(buffer, &start, &end);
-        do {
-            gtk_text_buffer_insert(buffer, &start, ">", 1);
-        } while (--quote_depth);
-        gtk_text_buffer_insert(buffer, &start, " ", 1);
+       /* skip one regular space following the quote characters */
+       if (line[index] == ' ')
+           index++;
+       /* Replace quote string with standard form. */
+       end = start;
+       gtk_text_iter_set_line_index(&end, index);
+       gtk_text_buffer_delete(buffer, &start, &end);
+       do
+           gtk_text_buffer_insert(buffer, &start, ">", 1);
+       while (--quote_depth);
+       gtk_text_buffer_insert(buffer, &start, " ", 1);
     }
     g_free(line);
 
     /* Unwrap remaining lines. */
     ins_quote = FALSE;
     while (gtk_text_iter_ends_line(&start)
-           || gtk_text_iter_forward_to_line_end(&start)) {
-        gtk_text_buffer_get_iter_at_mark(buffer, &end, selection_end);
-        if (gtk_text_iter_compare(&start, &end) >= 0) {
-            break;
-        }
-        end = start;
-        if (!gtk_text_iter_forward_line(&end)) {
-            break;
-        }
-        line = get_line(buffer, &end);
-        if (libbalsa_match_regex(line, rex, &quote_depth, &index) &&
-            (line[index] == ' ')) {
-            index++;
-        }
-        gtk_text_iter_set_line_index(&end, index);
-        gtk_text_buffer_delete(buffer, &start, &end);
-        /* empty lines separate paragraphs */
-        if (line[index] == '\0') {
-            gtk_text_buffer_insert(buffer, &start, "\n", 1);
-            while (quote_depth--) {
-                gtk_text_buffer_insert(buffer, &start, ">", 1);
-            }
-            gtk_text_buffer_insert(buffer, &start, "\n", 1);
-            ins_quote = TRUE;
-        } else if (ins_quote) {
-            while (quote_depth--) {
-                gtk_text_buffer_insert(buffer, &start, ">", 1);
-            }
-            gtk_text_buffer_insert(buffer, &start, " ", 1);
-            ins_quote = FALSE;
-        }
-        g_free(line);
-        /* Insert a space, if the line didn't end with one. */
-        if (!gtk_text_iter_starts_line(&start)) {
-            gtk_text_iter_backward_char(&start);
-            if (gtk_text_iter_get_char(&start) != ' ') {
-                start = end;
-                gtk_text_buffer_insert(buffer, &start, " ", 1);
-            }
-        }
+          || gtk_text_iter_forward_to_line_end(&start)) {
+       gtk_text_buffer_get_iter_at_mark(buffer, &end, selection_end);
+       if (gtk_text_iter_compare(&start, &end) >= 0)
+           break;
+       end = start;
+       if (!gtk_text_iter_forward_line(&end))
+           break;
+       line = get_line(buffer, &end);
+       if (libbalsa_match_regex(line, rex, &quote_depth, &index) &&
+           line[index] == ' ')
+           index++;
+       gtk_text_iter_set_line_index(&end, index);
+       gtk_text_buffer_delete(buffer, &start, &end);
+       /* empty lines separate paragraphs */
+       if (line[index] == '\0') {
+           gtk_text_buffer_insert(buffer, &start, "\n", 1);
+           while (quote_depth--)
+               gtk_text_buffer_insert(buffer, &start, ">", 1);
+           gtk_text_buffer_insert(buffer, &start, "\n", 1);
+           ins_quote = TRUE;
+       } else if (ins_quote) {
+           while (quote_depth--)
+               gtk_text_buffer_insert(buffer, &start, ">", 1);
+           gtk_text_buffer_insert(buffer, &start, " ", 1);
+           ins_quote = FALSE;
+       }
+       g_free(line);
+       /* Insert a space, if the line didn't end with one. */
+       if (!gtk_text_iter_starts_line(&start)) {
+           gtk_text_iter_backward_char(&start);
+           if (gtk_text_iter_get_char(&start) != ' ') {
+               start = end;
+               gtk_text_buffer_insert(buffer, &start, " ", 1);
+           }
+       }
     }
 }
 
-
 gboolean
-libbalsa_match_regex(const gchar *line,
-                     GRegex      *rex,
-                     guint       *count,
-                     guint       *index)
+libbalsa_match_regex(const gchar * line, GRegex * rex, guint * count,
+                     guint * index)
 {
     GMatchInfo *rm;
     gint c;
@@ -1255,25 +1131,23 @@ libbalsa_match_regex(const gchar *line,
     }
     g_match_info_free(rm);
 
-    if (count) {
+    if (count)
         *count = c;
-    }
-    if (index) {
+    if (index)
         *index = p - line;
-    }
     return c > 0;
 }
 
 
 GString *
-libbalsa_html_encode_hyperlinks(GString *paragraph)
+libbalsa_html_encode_hyperlinks(GString * paragraph)
 {
-    GString *retval;
-    gchar *p;
+    GString * retval;
+    gchar * p;
     GRegex *url_reg = get_url_reg();
     GMatchInfo *url_match;
     gboolean match;
-    gchar *markup;
+    gchar * markup;
 
     /* check for any url */
     if (!prescanner(paragraph->str, paragraph->len)) {
@@ -1292,9 +1166,8 @@ libbalsa_html_encode_hyperlinks(GString *paragraph)
     while (match) {
         gint start_pos, end_pos;
 
-        if (!g_match_info_fetch_pos(url_match, 0, &start_pos, &end_pos)) {
+        if (!g_match_info_fetch_pos(url_match, 0, &start_pos, &end_pos))
             break;
-        }
 
         /* add the url to the result */
         if (start_pos > 0) {
@@ -1313,9 +1186,8 @@ libbalsa_html_encode_hyperlinks(GString *paragraph)
         if (prescanner(p, paragraph->len - (p - paragraph->str))) {
             g_match_info_free(url_match);
             match = g_regex_match(url_reg, p, 0, &url_match);
-        } else {
+        } else
             match = FALSE;
-        }
     }
     g_match_info_free(url_match);
 
@@ -1333,52 +1205,45 @@ libbalsa_html_encode_hyperlinks(GString *paragraph)
 
 
 gchar *
-libbalsa_text_to_html(const gchar *title,
-                      const gchar *body,
-                      const gchar *lang)
+libbalsa_text_to_html(const gchar * title, const gchar * body, const gchar * lang)
 {
-    GString *html_body =
+    GString * html_body =
         g_string_new("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n");
-    gchar *html_subject;
-    const gchar *start = body;
-    gchar *html_lang;
+    gchar * html_subject;
+    const gchar * start = body;
+    gchar * html_lang;
 
     /* set the html header, including the primary language and the title */
     if (lang) {
-        gchar *p;
+        gchar * p;
 
         html_lang = g_strdup(lang);
-        if ((p = strchr(html_lang, '_'))) {
+        if ((p = strchr(html_lang, '_')))
             *p = '-';
-        }
-    } else {
+    } else
         html_lang = g_strdup("x-unknown");
-    }
     html_subject = g_markup_escape_text(title, -1);
-    g_string_append_printf(html_body,
+    g_string_append_printf(html_body, 
                            "<html lang=\"%s\"><head>\n"
                            "<title>%s</title>\n"
                            "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"
                            "<style type=\"text/css\">\n"
                            "  p { margin-top: 0px; margin-bottom: 0px; }\n"
                            "</style></head>\n"
-                           "<body>\n",
-                           html_lang,
-                           html_subject);
+                           "<body>\n", html_lang, html_subject);
     g_free(html_subject);
     g_free(html_lang);
 
     /* add the lines of the message body */
     while (*start) {
-        const gchar *eol = strchr(start, '\n');
-        const gchar *p = start;
+        const gchar * eol = strchr(start, '\n');
+        const gchar * p = start;
         PangoDirection direction = PANGO_DIRECTION_NEUTRAL;
-        GString *html;
+        GString * html;
         gsize idx;
 
-        if (!eol) {
+        if (!eol)
             eol = start + strlen(start);
-        }
 
         /* find the first real char to determine the paragraph direction */
         while (p < eol && direction == PANGO_DIRECTION_NEUTRAL) {
@@ -1395,13 +1260,12 @@ libbalsa_text_to_html(const gchar *title,
         /* replace a series of n spaces by (n - 1) &nbsp; and one space */
         idx = 0;
         while (idx < html->len) {
-            if ((html->str[idx] == ' ') && ((idx == 0) || (html->str[idx + 1] == ' '))) {
+            if (html->str[idx] == ' ' && (idx == 0 || html->str[idx + 1] == ' ')) {
                 html->str[idx++] = '&';
                 html = g_string_insert(html, idx, "nbsp;");
                 idx += 5;
-            } else {
+            } else
                 idx = g_utf8_next_char(html->str + idx) - html->str;
-            }
         }
 
         /* append the paragraph, always stating the proper direction */
@@ -1412,14 +1276,13 @@ libbalsa_text_to_html(const gchar *title,
 
         /* next line */
         start = eol;
-        if (*start) {
+        if (*start)
             start++;
-        }
     }
 
     /* close the html context */
     html_body = g_string_append(html_body, "</body></html>\n");
-
+    
     /* return the utf-8 encoded text/html */
     return g_string_free(html_body, FALSE);
 }
diff --git a/libbalsa/mime.h b/libbalsa/mime.h
index 6b38f24..b3b1dad 100644
--- a/libbalsa/mime.h
+++ b/libbalsa/mime.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -25,19 +25,14 @@
 
 #include "libbalsa.h"
 
-typedef void (*LibBalsaCharsetFunc) (const gchar *charset,
-                                     gpointer     data);
+typedef void (*LibBalsaCharsetFunc) (const gchar * charset, gpointer data);
 
-GString *process_mime_part(LibBalsaMessage     *message,
-                           LibBalsaMessageBody *body,
-                           gchar               *reply_prefix_str,
-                           gint                 llen,
-                           gboolean             ignore_html,
-                           gboolean             flow);
+GString *process_mime_part(LibBalsaMessage * message,
+                          LibBalsaMessageBody * body,
+                          gchar * reply_prefix_str, gint llen,
+                          gboolean ignore_html, gboolean flow);
 GString *content2reply(LibBalsaMessageBody *root,
-                       gchar               *reply_prefix_str,
-                       gint                 llen,
-                       gboolean             ignore_html,
-                       gboolean             flow);
+                      gchar * reply_prefix_str, gint llen,
+                      gboolean ignore_html, gboolean flow);
 
-#endif                          /* __LIBBALSA_MIME_H__ */
+#endif                         /* __LIBBALSA_MIME_H__ */
diff --git a/libbalsa/misc.c b/libbalsa/misc.c
index 2556964..b3252b5 100644
--- a/libbalsa/misc.c
+++ b/libbalsa/misc.c
@@ -23,7 +23,7 @@
    without introducing extra dependencies. External library
    dependencies should go to libbalsa.c */
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "misc.h"
 
@@ -44,65 +44,56 @@
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
 
-static const gchar *libbalsa_get_codeset_name(const gchar    *txt,
-                                              LibBalsaCodeset Codeset);
-
+static const gchar *libbalsa_get_codeset_name(const gchar *txt, 
+                                             LibBalsaCodeset Codeset);
 #ifndef HAVE_STRUCT_UTSNAME_DOMAINNAME
 static int
-getdnsdomainname(char  *s,
-                 size_t l)
+getdnsdomainname (char *s, size_t l)
 {
-    FILE *f;
-    char tmp[1024];
-    char *p = NULL;
-    char *q;
-
-    if ((f = fopen ("/etc/resolv.conf", "r")) == NULL) {
-        return (-1);
-    }
-
-    tmp[sizeof (tmp) - 1] = 0;
-
-    l--; /* save room for the terminal \0 */
-
-    while (fgets (tmp, sizeof (tmp) - 1, f) != NULL) {
-        p = tmp;
-        while ( g_ascii_isspace (*p)) {
-            p++;
-        }
-        if ((strncmp ("domain", p, 6) == 0) || (strncmp ("search", p, 6) == 0)) {
-            p += 6;
-
-            for (q = strtok (p, " \t\n"); q; q = strtok (NULL, " \t\n")) {
-                if (strcmp (q, ".")) {
-                    break;
-                }
-            }
-
-            if (q) {
-                char *a = q;
-
-                for (; *q; q++) {
-                    a = q;
-                }
-
-                if (*a == '.') {
-                    *a = '\0';
-                }
-
-                g_stpcpy (s, q);
-                fclose (f);
-                return 0;
-            }
-
-        }
-    }
-
-    fclose (f);
-    return (-1);
+  FILE *f;
+  char tmp[1024];
+  char *p = NULL;
+  char *q;
+
+  if ((f = fopen ("/etc/resolv.conf", "r")) == NULL) return (-1);
+
+  tmp[sizeof (tmp) - 1] = 0;
+
+  l--; /* save room for the terminal \0 */
+
+  while (fgets (tmp, sizeof (tmp) - 1, f) != NULL)
+  {
+    p = tmp;
+    while ( g_ascii_isspace (*p)) p++;
+    if (strncmp ("domain", p, 6) == 0 || strncmp ("search", p, 6) == 0)
+    {
+      p += 6;
+      
+      for (q = strtok (p, " \t\n"); q; q = strtok (NULL, " \t\n"))
+       if (strcmp (q, "."))
+         break;
+
+      if (q)
+      {
+         char *a = q;
+         
+         for (; *q; q++)
+             a = q;
+         
+         if (*a == '.')
+             *a = '\0';
+         
+         g_stpcpy (s, q);
+         fclose (f);
+         return 0;
+      }
+      
+    }
+  }
+
+  fclose (f);
+  return (-1);
 }
-
-
 #endif                          /* !HAVE_STRUCT_UTSNAME_DOMAINNAME */
 
 gchar *
@@ -114,62 +105,52 @@ libbalsa_get_domainname(void)
     uname(&utsname);
 
     return g_strdup(utsname.domainname);
-
 #else                           /* HAVE_STRUCT_UTSNAME_DOMAINNAME */
     char domainname[256]; /* arbitrary length */
     gchar *d;
-
+ 
     uname(&utsname);
     d = strchr( utsname.nodename, '.' );
-    if (d) {
-        return g_strdup( d + 1 );
+    if(d) {
+        return g_strdup( d+1 );
     }
-
+ 
     if ( getdnsdomainname(domainname, sizeof(domainname)) == 0 ) {
-        return g_strdup(domainname);
+       return g_strdup(domainname);
     }
     return NULL;
-
 #endif                          /* HAVE_STRUCT_UTSNAME_DOMAINNAME */
 }
 
-
 /* libbalsa_find_word:
    searches given word delimited by blanks or string boundaries in given
    string. IS NOT case-sensitive.
    Returns TRUE if the word is found.
- */
-gboolean
-libbalsa_find_word(const gchar *word,
-                   const gchar *str)
+*/
+gboolean libbalsa_find_word(const gchar * word, const gchar * str)
 {
     const gchar *ptr = str;
     int len = strlen(word);
 
     while (*ptr) {
-        if (g_ascii_strncasecmp(word, ptr, len) == 0) {
-            return TRUE;
-        }
-        /* skip one word */
-        while (*ptr && !isspace((int)*ptr)) {
-            ptr++;
-        }
-        while (*ptr && isspace((int) *ptr)) {
-            ptr++;
-        }
+       if (g_ascii_strncasecmp(word, ptr, len) == 0)
+           return TRUE;
+       /* skip one word */
+       while (*ptr && !isspace((int)*ptr))
+           ptr++;
+       while (*ptr && isspace((int) *ptr))
+           ptr++;
     }
     return FALSE;
 }
 
-
 /* libbalsa_wrap_string
    wraps given string replacing spaces with '\n'.  do changes in place.
-   lnbeg - line beginning position, sppos - space position,
+   lnbeg - line beginning position, sppos - space position, 
    te - tab's extra space.
- */
+*/
 void
-libbalsa_wrap_string(gchar *str,
-                     int    width)
+libbalsa_wrap_string(gchar * str, int width)
 {
     const int minl = width / 2;
 
@@ -185,29 +166,27 @@ libbalsa_wrap_string(gchar *str,
     space_pos = ptr = str;
 
     while (*ptr) {
-        switch (*ptr) {
-        case '\t':
-            te += 7;
-            break;
-
-        case '\n':
-            line_begin_offset = ptr_offset + 1;
-            te = 0;
-            break;
-
-        case ' ':
-            space_pos = ptr;
-            space_pos_offset = ptr_offset;
-            break;
-        }
-        if ((ptr_offset - line_begin_offset >= width - te)
-            && (space_pos_offset >= line_begin_offset + minl)) {
-            *space_pos = '\n';
-            line_begin_offset = space_pos_offset + 1;
-            te = 0;
-        }
-        ptr = g_utf8_next_char(ptr);
-        ptr_offset++;
+       switch (*ptr) {
+       case '\t':
+           te += 7;
+           break;
+       case '\n':
+           line_begin_offset = ptr_offset + 1;
+           te = 0;
+           break;
+       case ' ':
+           space_pos = ptr;
+           space_pos_offset = ptr_offset;
+           break;
+       }
+       if (ptr_offset - line_begin_offset >= width - te 
+            && space_pos_offset >= line_begin_offset + minl) {
+           *space_pos = '\n';
+           line_begin_offset = space_pos_offset + 1;
+           te = 0;
+       }
+       ptr=g_utf8_next_char(ptr);
+       ptr_offset++;
     }
 }
 
@@ -215,76 +194,74 @@ libbalsa_wrap_string(gchar *str,
 /* Delete the contents of a directory (not the directory itself).
    Return TRUE if everything was OK.
    If FALSE is returned then errno will be set to some useful value.
- */
+*/
 gboolean
 libbalsa_delete_directory_contents(const gchar *path)
 {
-    GDir *dir;
-    gboolean result;
+       GDir *dir;
+       gboolean result;
 
     g_return_val_if_fail(path != NULL, FALSE);
     dir = g_dir_open(path, 0, NULL);
     if (dir == NULL) {
-        result = FALSE;
+       result = FALSE;
     } else {
-        const gchar *item;
-
-        result = TRUE;
-        item = g_dir_read_name(dir);
-        while (result && (item != NULL)) {
-            gchar *full_path;
-
-            full_path = g_build_filename(path, item, NULL);
-            if (g_file_test(full_path, G_FILE_TEST_IS_DIR)) {
-                result = libbalsa_delete_directory_contents(full_path);
-                if (g_rmdir(full_path) != 0) {
-                    result = FALSE;
-                }
-            } else {
-                if (g_unlink(full_path) != 0) {
-                    result = FALSE;
-                }
-            }
-            g_free(full_path);
-            item = g_dir_read_name(dir);
-        }
-        g_dir_close(dir);
+       const gchar *item;
+
+       result = TRUE;
+       item = g_dir_read_name(dir);
+       while (result && (item != NULL)) {
+               gchar *full_path;
+
+               full_path = g_build_filename(path, item, NULL);
+               if (g_file_test(full_path, G_FILE_TEST_IS_DIR)) {
+                       result = libbalsa_delete_directory_contents(full_path);
+                       if (g_rmdir(full_path) != 0) {
+                               result = FALSE;
+                       }
+               } else {
+                       if (g_unlink(full_path) != 0) {
+                               result = FALSE;
+                       }
+               }
+               g_free(full_path);
+               item = g_dir_read_name(dir);
+       }
+       g_dir_close(dir);
     }
 
     return result;
 }
 
-
 /* libbalsa_expand_path:
    We handle only references to ~/.
- */
-gchar *
-libbalsa_expand_path(const gchar *path)
+*/
+gchar*
+libbalsa_expand_path(const gchar * path)
 {
     const gchar *home = g_get_home_dir();
-
-    if (path[0] == '~') {
-        if (path[1] == '/') {
-            return g_strconcat(home, path + 1, NULL);
-        } else if (path[1] == '\0') {
+   
+    if(path[0] == '~') {
+        if(path[1] == '/')
+            return g_strconcat(home, path+1, NULL);
+        else if(path[1] == '\0')
             return g_strdup(home);
-        }
         /* else: unrecognized combination */
     }
     return g_strdup(path);
 }
 
 
+
 /* create a uniq directory, resulting name should be freed with g_free */
-gboolean
-libbalsa_mktempdir(char **s)
+gboolean 
+libbalsa_mktempdir (char **s)
 {
     g_return_val_if_fail(s != NULL, FALSE);
     *s = g_build_filename(g_get_tmp_dir(), "balsa-tmpdir-XXXXXX", NULL);
     return g_mkdtemp_full(*s, 0700) != NULL;
 }
 
-
 /* libbalsa_set_fallback_codeset: sets the codeset for incorrectly
  * encoded characters. */
 static LibBalsaCodeset sanitize_fallback_codeset = WEST_EUROPE;
@@ -303,8 +280,7 @@ libbalsa_set_fallback_codeset(LibBalsaCodeset codeset)
     sanitize_fallback_codeset = codeset;
     return ret;
 }
-
-
+    
 /* libbalsa_utf8_sanitize
  *
  * Validate utf-8 text, and if validation fails, replace each offending
@@ -323,149 +299,132 @@ libbalsa_set_fallback_codeset(LibBalsaCodeset codeset)
  * NOTE:    The text is either modified in place or replaced and freed.
  */
 gboolean
-libbalsa_utf8_sanitize(gchar       **text,
-                       gboolean      fallback,
-                       gchar const **target)
+libbalsa_utf8_sanitize(gchar **text, gboolean fallback,
+                      gchar const **target)
 {
     gchar *p;
 
-    if (target) {
-        *target = NULL;
-    }
-    if (!*text || g_utf8_validate(*text, -1, NULL)) {
-        return TRUE;
-    }
+    if (target)
+       *target = NULL;
+    if (!*text || g_utf8_validate(*text, -1, NULL))
+       return TRUE;
 
     if (fallback) {
-        gsize b_written;
-        GError *conv_error = NULL;
-        const gchar *use_enc =
+       gsize b_written;
+       GError *conv_error = NULL;
+       const gchar *use_enc =
             libbalsa_get_codeset_name(*text, sanitize_fallback_codeset);
-        p = g_convert(*text, strlen(*text), "utf-8", use_enc, NULL,
+       p = g_convert(*text, strlen(*text), "utf-8", use_enc, NULL,
                       &b_written, &conv_error);
 
-        if (p) {
-            g_free(*text);
-            *text = p;
-            if (target) {
-                *target = use_enc;
-            }
-            return FALSE;
-        }
-        g_message("conversion %s -> utf8 failed: %s", use_enc,
+       if (p) {
+           g_free(*text);
+           *text = p;
+           if (target)
+               *target = use_enc;
+           return FALSE;
+       }
+       g_message("conversion %s -> utf8 failed: %s", use_enc,
                   conv_error->message);
-        g_error_free(conv_error);
+       g_error_free(conv_error);
     }
     p = *text;
-    while (!g_utf8_validate(p, -1, (const gchar **) &p)) {
-        *p++ = '?';
-    }
+    while (!g_utf8_validate(p, -1, (const gchar **) &p))
+       *p++ = '?';
 
     return FALSE;
 }
 
-
 /* libbalsa_utf8_strstr() returns TRUE if s2 is a substring of s1.
  * libbalsa_utf8_strstr is case insensitive
  * this functions understands utf8 strings (as you might have guessed ;-)
  */
 gboolean
-libbalsa_utf8_strstr(const gchar *s1,
-                     const gchar *s2)
+libbalsa_utf8_strstr(const gchar *s1, const gchar *s2)
 {
-    const gchar *p, *q;
+    const gchar * p,* q;
 
     /* convention : NULL string is contained in anything */
-    if (!s2) {
-        return TRUE;
-    }
+    if (!s2) return TRUE;
     /* s2 is non-NULL, so if s1==NULL we return FALSE :)*/
-    if (!s1) {
-        return FALSE;
-    }
+    if (!s1) return FALSE;
     /* OK both are non-NULL now*/
     /* If s2 is the empty string return TRUE */
-    if (!*s2) {
-        return TRUE;
-    }
+    if (!*s2) return TRUE;
     while (*s1) {
-        /* We look for the first char of s2*/
-        for (; *s1 &&
-             g_unichar_toupper(g_utf8_get_char(s2)) != g_unichar_toupper(g_utf8_get_char(s1));
-             s1 = g_utf8_next_char(s1)) {
-        }
-        if (*s1) {
-            /* We found the first char let see if this potential match is an actual one */
-            s1 = g_utf8_next_char(s1);
-            q = s1;
-            p = g_utf8_next_char(s2);
-            while (*q && *p &&
-                   g_unichar_toupper(g_utf8_get_char(p))
-                   == g_unichar_toupper(g_utf8_get_char(q))) {
-                p = g_utf8_next_char(p);
-                q = g_utf8_next_char(q);
-            }
-            /* We have a match if p has reached the end of s2, ie *p==0 */
-            if (!*p) {
-                return TRUE;
-            }
-        }
+       /* We look for the first char of s2*/
+       for (;*s1 &&
+                g_unichar_toupper(g_utf8_get_char(s2))!=g_unichar_toupper(g_utf8_get_char(s1));
+            s1 = g_utf8_next_char(s1));
+       if (*s1) {
+           /* We found the first char let see if this potential match is an actual one */
+           s1 = g_utf8_next_char(s1);
+           q = s1;
+           p = g_utf8_next_char(s2);
+           while (*q && *p && 
+                  g_unichar_toupper(g_utf8_get_char(p))
+                  ==g_unichar_toupper(g_utf8_get_char(q))) {
+               p = g_utf8_next_char(p);
+               q = g_utf8_next_char(q);
+           }
+           /* We have a match if p has reached the end of s2, ie *p==0 */
+           if (!*p) return TRUE;
+       }
     }
     return FALSE;
 }
 
-
 /* The LibBalsaCodeset enum is not used for anything currently, but this
  * list must be the same length, and should probably be kept consistent: */
 LibBalsaCodesetInfo libbalsa_codeset_info[LIBBALSA_NUM_CODESETS] = {
     {N_("West European"),       /* WEST_EUROPE          */
-     "iso-8859-1", "windows-1252"},
+     "iso-8859-1", "windows-1252"} ,
     {N_("East European"),       /* EAST_EUROPE          */
-     "iso-8859-2", "windows-1250"},
+     "iso-8859-2", "windows-1250"} ,
     {N_("South European"),      /* SOUTH_EUROPE         */
-     "iso-8859-3"},
+     "iso-8859-3"} ,
     {N_("North European"),      /* NORTH_EUROPE         */
-     "iso-8859-4"},
+     "iso-8859-4"} ,
     {N_("Cyrillic"),            /* CYRILLIC             */
-     "iso-8859-5", "windows-1251"},
+     "iso-8859-5", "windows-1251"} ,
     {N_("Arabic"),              /* ARABIC               */
-     "iso-8859-6", "windows-1256"},
+     "iso-8859-6", "windows-1256"} ,
     {N_("Greek"),               /* GREEK                */
-     "iso-8859-7", "windows-1253"},
+     "iso-8859-7", "windows-1253"} ,
     {N_("Hebrew"),              /* HEBREW               */
-     "iso-8859-8", "windows-1255"},
+     "iso-8859-8", "windows-1255"} ,
     {N_("Turkish"),             /* TURKISH              */
-     "iso-8859-9", "windows-1254"},
+     "iso-8859-9", "windows-1254"} ,
     {N_("Nordic"),              /* NORDIC               */
-     "iso-8859-10"},
+     "iso-8859-10"} ,
     {N_("Thai"),                /* THAI                 */
-     "iso-8859-11"},
+     "iso-8859-11"} ,
     {N_("Baltic"),              /* BALTIC               */
-     "iso-8859-13", "windows-1257"},
+     "iso-8859-13", "windows-1257"} ,
     {N_("Celtic"),              /* CELTIC               */
-     "iso-8859-14"},
+     "iso-8859-14"} ,
     {N_("West European (euro)"),  /* WEST_EUROPE_EURO     */
-     "iso-8859-15"},
+     "iso-8859-15"} ,
     {N_("Russian"),             /* RUSSIAN              */
-     "koi-8r"},
+     "koi-8r"} ,
     {N_("Ukrainian"),           /* UKRAINE              */
-     "koi-8u"},
+     "koi-8u"} ,
     {N_("Japanese"),            /* JAPAN                */
-     "iso-2022-jp"},
+     "iso-2022-jp"} ,
     {N_("Korean"),              /* KOREA                */
-     "euc-kr"},
+     "euc-kr"} ,
     {N_("East European"),       /* EAST_EUROPE_WIN      */
-     "windows-1250"},
+     "windows-1250"} ,
     {N_("Cyrillic"),            /* CYRILLIC_WIN         */
-     "windows-1251"},
+     "windows-1251"} ,
     {N_("Greek"),               /* GREEK_WIN            */
-     "windows-1253"},
+     "windows-1253"} ,
     {N_("Hebrew"),              /* HEBREW_WIN           */
-     "windows-1255"},
+     "windows-1255"} ,
     {N_("Arabic"),              /* ARABIC_WIN           */
-     "windows-1256"},
+     "windows-1256"} ,
     {N_("Baltic"),              /* BALTIC_WIN           */
-     "windows-1257"},
+     "windows-1257"} ,
 };
 
 /*
@@ -474,21 +433,18 @@ LibBalsaCodesetInfo libbalsa_codeset_info[LIBBALSA_NUM_CODESETS] = {
  * usually means that txt contains windows (not iso) characters.
  */
 static const gchar *
-libbalsa_get_codeset_name(const gchar    *txt,
-                          LibBalsaCodeset Codeset)
+libbalsa_get_codeset_name(const gchar * txt, LibBalsaCodeset Codeset)
 {
     LibBalsaCodesetInfo *info = &libbalsa_codeset_info[Codeset];
 
     if (txt && info->win) {
         LibBalsaTextAttribute attr = libbalsa_text_attr_string(txt);
-        if (attr & LIBBALSA_TEXT_HI_CTRL) {
+        if (attr & LIBBALSA_TEXT_HI_CTRL)
             return info->win;
-        }
     }
     return info->std;
 }
 
-
 /* Create a GtkComboBox with the national charsets as options;
  * called when some text is found to be neither US-ASCII nor UTF-8, so
  * the list includes neither of these. */
@@ -508,9 +464,8 @@ libbalsa_charset_button_new(void)
         gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), tmp);
         g_free(tmp);
 
-        if (!g_ascii_strcasecmp(info->std, locale_charset)) {
-            active = n;
-        }
+       if (!g_ascii_strcasecmp(info->std, locale_charset))
+           active = n;
     }
 
     /* locale_charset may be UTF-8, in which case it was not found,
@@ -520,37 +475,29 @@ libbalsa_charset_button_new(void)
     return combo_box;
 }
 
-
 /* Helper */
 static void
-lb_text_attr(const gchar *text,
-             gssize       len,
-             gboolean    *has_esc,
-             gboolean    *has_hi_bit,
-             gboolean    *has_hi_ctrl)
+lb_text_attr(const gchar * text, gssize len, gboolean * has_esc,
+             gboolean * has_hi_bit, gboolean * has_hi_ctrl)
 {
-    if (len < 0) {
+    if (len < 0)
         len = strlen(text);
-    }
 
     for (; --len >= 0; text++) {
-        guchar c = *text;
-        if (c == 0x1b) {
+       guchar c = *text;
+        if (c == 0x1b)
             *has_esc = TRUE;
-        }
         if (c >= 0x80) {
             *has_hi_bit = TRUE;
-            if (c <= 0x9f) {
+            if (c <= 0x9f)
                 *has_hi_ctrl = TRUE;
-            }
         }
     }
 }
 
-
 /* Return text attributes of a string. */
 LibBalsaTextAttribute
-libbalsa_text_attr_string(const gchar *string)
+libbalsa_text_attr_string(const gchar * string)
 {
     LibBalsaTextAttribute attr;
     gboolean has_esc = FALSE;
@@ -562,28 +509,23 @@ libbalsa_text_attr_string(const gchar *string)
     is_utf8 = g_utf8_validate(string, -1, NULL);
 
     attr = 0;
-    if (has_esc) {
+    if (has_esc)
         attr |= LIBBALSA_TEXT_ESC;
-    }
-    if (has_hi_bit) {
+    if (has_hi_bit)
         attr |= LIBBALSA_TEXT_HI_BIT;
-    }
-    if (has_hi_ctrl) {
+    if (has_hi_ctrl)
         attr |= LIBBALSA_TEXT_HI_CTRL;
-    }
-    if (is_utf8 && has_hi_bit) {
+    if (is_utf8 && has_hi_bit)
         attr |= LIBBALSA_TEXT_HI_UTF8;
-    }
 
     return attr;
 }
 
-
 /* Return text attributes of the contents of a file;
  * filename is in URI form;
  * returns -1 on error. */
 LibBalsaTextAttribute
-libbalsa_text_attr_file(const gchar *filename)
+libbalsa_text_attr_file(const gchar * filename)
 {
     GFile *file;
     GFileInputStream *stream;
@@ -599,24 +541,21 @@ libbalsa_text_attr_file(const gchar *filename)
     file = g_file_new_for_uri(filename);
     stream = g_file_read(file, NULL, NULL);
     g_object_unref(file);
-    if (!stream) {
+    if (!stream)
         return -1;
-    }
 
     while ((bytes = g_input_stream_read(G_INPUT_STREAM(stream), new_chars,
-                                        (sizeof buf) - (new_chars - buf), NULL,
-                                        NULL)) > 0) {
-        gboolean test_bits;
+                               (sizeof buf) - (new_chars - buf), NULL,
+                               NULL)) > 0) {
+       gboolean test_bits;
 
-        test_bits = !has_esc || !has_hi_bit || !has_hi_ctrl;
-        if (!test_bits && !is_utf8) {
-            break;
-        }
+       test_bits = !has_esc || !has_hi_bit || !has_hi_ctrl;
+       if (!test_bits && !is_utf8)
+           break;
 
-        if (test_bits) {
+        if (test_bits)
             lb_text_attr(new_chars, bytes, &has_esc, &has_hi_bit,
                          &has_hi_ctrl);
-        }
 
         if (is_utf8) {
             const gchar *end;
@@ -639,127 +578,116 @@ libbalsa_text_attr_file(const gchar *filename)
 
     g_object_unref(stream);
 
-    if (bytes < 0) {
+    if (bytes < 0)
         return -1;
-    }
 
     attr = 0;
-    if (has_esc) {
+    if (has_esc)
         attr |= LIBBALSA_TEXT_ESC;
-    }
-    if (has_hi_bit) {
+    if (has_hi_bit)
         attr |= LIBBALSA_TEXT_HI_BIT;
-    }
-    if (has_hi_ctrl) {
+    if (has_hi_ctrl)
         attr |= LIBBALSA_TEXT_HI_CTRL;
-    }
-    if (is_utf8 && has_hi_bit) {
+    if (is_utf8 && has_hi_bit)
         attr |= LIBBALSA_TEXT_HI_UTF8;
-    }
 
     return attr;
 }
 
+#define compare_stat(osb, nsb)  ( (osb.st_dev != nsb.st_dev || osb.st_ino != nsb.st_ino || osb.st_rdev != 
nsb.st_rdev) ? -1 : 0 )
 
-#define compare_stat(osb, \
-                     nsb)  ((osb.st_dev != nsb.st_dev || osb.st_ino != nsb.st_ino || \
-                             osb.st_rdev != nsb.st_rdev) ? -1 : 0)
-
-int
-libbalsa_safe_open(const char *path,
-                   int         flags,
-                   mode_t      mode,
-                   GError    **err)
+int 
+libbalsa_safe_open (const char *path, int flags, mode_t mode, GError **err)
 {
-    struct stat osb, nsb;
-    int fd;
-
-    if ((fd = open (path, flags, mode)) < 0) {
-        g_set_error(err, LIBBALSA_ERROR_QUARK, errno,
-                    _("Cannot open %s: %s"), path, g_strerror(errno));
-        return fd;
-    }
-
-    /* make sure the file is not symlink */
-    if ((lstat (path, &osb) < 0) || (fstat (fd, &nsb) < 0) ||
-        (compare_stat(osb, nsb) == -1)) {
-        close (fd);
-        g_set_error(err, LIBBALSA_ERROR_QUARK, errno,
-                    _("Cannot open %s: is a symbolic link"), path);
-        return (-1);
-    }
-
-    return (fd);
+  struct stat osb, nsb;
+  int fd;
+ 
+  if ((fd = open (path, flags, mode)) < 0) {
+      g_set_error(err, LIBBALSA_ERROR_QUARK, errno,
+                  _("Cannot open %s: %s"), path, g_strerror(errno));
+      return fd;
+  }
+ 
+  /* make sure the file is not symlink */
+  if (lstat (path, &osb) < 0 || fstat (fd, &nsb) < 0 ||
+      compare_stat(osb, nsb) == -1) {
+      close (fd);
+      g_set_error(err, LIBBALSA_ERROR_QUARK, errno,
+                  _("Cannot open %s: is a symbolic link"), path);
+      return (-1);
+  }
+ 
+  return (fd);
 }
 
-
-/*
+/* 
  * This function is supposed to do nfs-safe renaming of files.
- *
+ * 
  * Warning: We don't check whether src and target are equal.
  */
 
-int
-libbalsa_safe_rename(const char *src,
-                     const char *target)
+int 
+libbalsa_safe_rename (const char *src, const char *target)
 {
-    struct stat ssb, tsb;
+  struct stat ssb, tsb;
 
-    if (!src || !target) {
-        return -1;
-    }
-
-    if (link (src, target) != 0) {
-
-        /*
-         * Coda does not allow cross-directory links, but tells
-         * us it's a cross-filesystem linking attempt.
-         *
-         * However, the Coda rename call is allegedly safe to use.
-         *
-         * With other file systems, rename should just fail when
-         * the files reside on different file systems, so it's safe
-         * to try it here.
-         *
-         */
-
-        if (errno == EXDEV) {
-            return rename (src, target);
-        }
+  if (!src || !target)
+    return -1;
 
-        return -1;
-    }
+  if (link (src, target) != 0)
+  {
 
     /*
-     * Stat both links and check if they are equal.
+     * Coda does not allow cross-directory links, but tells
+     * us it's a cross-filesystem linking attempt.
+     * 
+     * However, the Coda rename call is allegedly safe to use.
+     * 
+     * With other file systems, rename should just fail when 
+     * the files reside on different file systems, so it's safe
+     * to try it here.
+     *
      */
 
-    if (stat (src, &ssb) == -1) {
-        return -1;
-    }
-
-    if (stat (target, &tsb) == -1) {
-        return -1;
-    }
-
-    /*
-     * pretend that the link failed because the target file
-     * did already exist.
-     */
-
-    if (compare_stat (ssb, tsb) == -1) {
-        errno = EEXIST;
-        return -1;
-    }
-
-    /*
-     * Unlink the original link.  Should we really ignore the return
-     * value here? XXX
-     */
-
-    unlink (src);
-
-    return 0;
+    if (errno == EXDEV)
+      return rename (src, target);
+    
+    return -1;
+  }
+
+  /*
+   * Stat both links and check if they are equal.
+   */
+  
+  if (stat (src, &ssb) == -1)
+  {
+    return -1;
+  }
+  
+  if (stat (target, &tsb) == -1)
+  {
+    return -1;
+  }
+
+  /* 
+   * pretend that the link failed because the target file
+   * did already exist.
+   */
+
+  if (compare_stat (ssb, tsb) == -1)
+  {
+    errno = EEXIST;
+    return -1;
+  }
+
+  /*
+   * Unlink the original link.  Should we really ignore the return
+   * value here? XXX
+   */
+
+  unlink (src);
+
+  return 0;
 }
 
 
@@ -770,19 +698,13 @@ libbalsa_safe_rename(const char *src,
  *      dot             if dot != 0, try to dotlock the file
  *      timeout         should retry locking?
  */
-int
-libbalsa_lock_file(const char *path,
-                   int         fd,
-                   int         excl,
-                   int         dot,
-                   int         timeout)
+int 
+libbalsa_lock_file (const char *path, int fd, int excl, int dot, int timeout)
 {
 #if defined (USE_FCNTL) || defined (USE_FLOCK)
     int count;
     int attempt;
-    struct stat prev_sb = {
-        0
-    };
+    struct stat prev_sb = { 0 };
 #endif
     int r = 0;
 
@@ -795,110 +717,105 @@ libbalsa_lock_file(const char *path,
 
     count = 0;
     attempt = 0;
-    while (fcntl (fd, F_SETLK, &lck) == -1) {
-        struct stat sb;
-        g_print("%s(): fcntl errno %d.\n", __FUNCTION__, errno);
-        if ((errno != EAGAIN) && (errno != EACCES)) {
-            libbalsa_information
-                (LIBBALSA_INFORMATION_DEBUG, "fcntl failed, errno=%d.", errno);
-            return -1;
-        }
-
-        if (fstat (fd, &sb) != 0) {
-            sb.st_size = 0;
-        }
-
-        if (count == 0) {
-            prev_sb = sb;
-        }
-
-        /* only unlock file if it is unchanged */
-        if ((prev_sb.st_size == sb.st_size) && (++count >= (timeout ? MAXLOCKATTEMPT : 0))) {
-            if (timeout) {
-                libbalsa_information
-                    (LIBBALSA_INFORMATION_WARNING,
-                    _("Timeout exceeded while attempting fcntl lock!"));
-            }
-            return (-1);
-        }
-
-        prev_sb = sb;
-
-        libbalsa_information(LIBBALSA_INFORMATION_MESSAGE,
-                             _("Waiting for fcntl lock… %d"), ++attempt);
-        sleep (1);
-    }
+    while (fcntl (fd, F_SETLK, &lck) == -1)
+       {
+           struct stat sb;
+           g_print("%s(): fcntl errno %d.\n", __FUNCTION__, errno);
+    if (errno != EAGAIN && errno != EACCES)
+       {
+           libbalsa_information
+               (LIBBALSA_INFORMATION_DEBUG, "fcntl failed, errno=%d.", errno);
+           return -1;
+       }
+ 
+    if (fstat (fd, &sb) != 0)
+       sb.st_size = 0;
+     
+    if (count == 0)
+       prev_sb = sb;
+ 
+    /* only unlock file if it is unchanged */
+    if (prev_sb.st_size == sb.st_size && ++count >= (timeout?MAXLOCKATTEMPT:0))
+       {
+           if (timeout)
+               libbalsa_information
+                   (LIBBALSA_INFORMATION_WARNING,
+                    _("Timeout exceeded while attempting fcntl lock!"));
+           return (-1);
+       }
+ 
+    prev_sb = sb;
+ 
+    libbalsa_information(LIBBALSA_INFORMATION_MESSAGE,
+                        _("Waiting for fcntl lock… %d"), ++attempt);
+    sleep (1);
+}
 #endif /* USE_FCNTL */
-
+ 
 #ifdef USE_FLOCK
-    count = 0;
-    attempt = 0;
-    while (flock (fd, (excl ? LOCK_EX : LOCK_SH) | LOCK_NB) == -1) {
-        struct stat sb;
-        if (errno != EWOULDBLOCK) {
-            libbalsa_message ("flock: %s", strerror(errno));
-            r = -1;
-            break;
-        }
-
-        if (fstat(fd, &sb) != 0 ) {
-            sb.st_size = 0;
-        }
-
-        if (count == 0) {
-            prev_sb = sb;
-        }
-
-        /* only unlock file if it is unchanged */
-        if ((prev_sb.st_size == sb.st_size) && (++count >= (timeout ? MAXLOCKATTEMPT : 0))) {
-            if (timeout) {
-                libbalsa_message (_("Timeout exceeded while attempting flock lock!"));
-            }
-            r = -1;
-            break;
-        }
-
-        prev_sb = sb;
-
-        libbalsa_message (_("Waiting for flock attempt… %d"), ++attempt);
-        sleep (1);
-    }
+count = 0;
+attempt = 0;
+while (flock (fd, (excl ? LOCK_EX : LOCK_SH) | LOCK_NB) == -1)
+{
+    struct stat sb;
+    if (errno != EWOULDBLOCK)
+       {
+           libbalsa_message ("flock: %s", strerror(errno));
+           r = -1;
+           break;
+       }
+ 
+    if (fstat(fd,&sb) != 0 )
+       sb.st_size=0;
+     
+    if (count == 0)
+       prev_sb=sb;
+ 
+    /* only unlock file if it is unchanged */
+    if (prev_sb.st_size == sb.st_size && ++count >= (timeout?MAXLOCKATTEMPT:0))
+       {
+           if (timeout)
+               libbalsa_message (_("Timeout exceeded while attempting flock lock!"));
+           r = -1;
+           break;
+       }
+ 
+    prev_sb = sb;
+ 
+    libbalsa_message (_("Waiting for flock attempt… %d"), ++attempt);
+    sleep (1);
+}
 #endif /* USE_FLOCK */
-
+ 
 #ifdef USE_DOTLOCK
-    if ((r == 0) && dot) {
-        r = dotlock_file (path, fd, timeout);
-    }
+if (r == 0 && dot)
+     r = dotlock_file (path, fd, timeout);
 #endif /* USE_DOTLOCK */
-
-    if (r == -1) {
-        /* release any other locks obtained in this routine */
-
+ 
+     if (r == -1)
+{
+    /* release any other locks obtained in this routine */
+ 
 #ifdef USE_FCNTL
-        lck.l_type = F_UNLCK;
-        fcntl (fd, F_SETLK, &lck);
+    lck.l_type = F_UNLCK;
+    fcntl (fd, F_SETLK, &lck);
 #endif /* USE_FCNTL */
-
+ 
 #ifdef USE_FLOCK
-        flock (fd, LOCK_UN);
+    flock (fd, LOCK_UN);
 #endif /* USE_FLOCK */
-
-        return (-1);
-    }
-
-    return 0;
+ 
+    return (-1);
+}
+ 
+return 0;
 }
 
-
-int
-libbalsa_unlock_file(const char *path,
-                     int         fd,
-                     int         dot)
+int 
+libbalsa_unlock_file (const char *path, int fd, int dot)
 {
 #ifdef USE_FCNTL
-    struct flock unlockit = {
-        F_UNLCK, 0, 0, 0
-    };
+    struct flock unlockit = { F_UNLCK, 0, 0, 0 };
 
     memset (&unlockit, 0, sizeof (struct flock));
     unlockit.l_type = F_UNLCK;
@@ -911,9 +828,8 @@ libbalsa_unlock_file(const char *path,
 #endif
 
 #ifdef USE_DOTLOCK
-    if (dot) {
-        undotlock_file (path, fd);
-    }
+    if (dot)
+       undotlock_file (path, fd);
 #endif
 
     return 0;
@@ -923,41 +839,37 @@ libbalsa_unlock_file(const char *path,
 /* libbalsa_ia_rfc2821_equal
    compares two addresses according to rfc2821: local-part@domain is equal,
    if the local-parts are case sensitive equal, but the domain case-insensitive
- */
+*/
 gboolean
-libbalsa_ia_rfc2821_equal(const InternetAddress *a,
-                          const InternetAddress *b)
+libbalsa_ia_rfc2821_equal(const InternetAddress * a,
+                         const InternetAddress * b)
 {
     const gchar *a_atptr, *b_atptr;
     const gchar *a_addr, *b_addr;
     gint a_atpos, b_atpos;
 
-    if (!INTERNET_ADDRESS_IS_MAILBOX(a) || !INTERNET_ADDRESS_IS_MAILBOX(b)) {
+    if (!INTERNET_ADDRESS_IS_MAILBOX(a) || !INTERNET_ADDRESS_IS_MAILBOX(b))
         return FALSE;
-    }
 
     /* first find the "@" in the two addresses */
     a_addr = INTERNET_ADDRESS_MAILBOX(a)->addr;
     b_addr = INTERNET_ADDRESS_MAILBOX(b)->addr;
     a_atptr = strchr(a_addr, '@');
     b_atptr = strchr(b_addr, '@');
-    if (!a_atptr || !b_atptr) {
+    if (!a_atptr || !b_atptr)
         return FALSE;
-    }
     a_atpos = a_atptr - a_addr;
     b_atpos = b_atptr - b_addr;
 
     /* now compare the strings */
-    if (!a_atpos || !b_atpos || (a_atpos != b_atpos) ||
+    if (!a_atpos || !b_atpos || a_atpos != b_atpos || 
         strncmp(a_addr, b_addr, a_atpos) ||
-        g_ascii_strcasecmp(a_atptr, b_atptr)) {
+        g_ascii_strcasecmp(a_atptr, b_atptr))
         return FALSE;
-    } else {
+    else
         return TRUE;
-    }
 }
 
-
 /*
  * Utilities for making consistent dialogs.
  */
@@ -977,16 +889,13 @@ libbalsa_create_grid(void)
     return grid;
 }
 
-
 /* create_label:
    Create a label and add it to a table in the first column of given row,
-   setting the keyval to found accelerator value, that can be later used
+   setting the keyval to found accelerator value, that can be later used 
    in create_entry.
- */
+*/
 GtkWidget *
-libbalsa_create_grid_label(const gchar *text,
-                           GtkWidget   *grid,
-                           gint         row)
+libbalsa_create_grid_label(const gchar * text, GtkWidget * grid, gint row)
 {
     GtkWidget *label;
 
@@ -999,15 +908,12 @@ libbalsa_create_grid_label(const gchar *text,
     return label;
 }
 
-
 /* create_check:
    creates a checkbox with a given label and places them in given array.
- */
+*/
 GtkWidget *
-libbalsa_create_grid_check(const gchar *text,
-                           GtkWidget   *grid,
-                           gint         row,
-                           gboolean     initval)
+libbalsa_create_grid_check(const gchar * text, GtkWidget * grid, gint row,
+                           gboolean initval)
 {
     GtkWidget *check_button;
     GtkWidget *label;
@@ -1021,23 +927,18 @@ libbalsa_create_grid_check(const gchar *text,
 
     gtk_grid_attach(GTK_GRID(grid), check_button, 0, row, 2, 1);
 
-    if (initval) {
+    if (initval)
         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button),
                                      TRUE);
-    }
 
     return check_button;
 }
 
-
 /* Create a text entry and add it to the table */
 GtkWidget *
-libbalsa_create_grid_entry(GtkWidget   *grid,
-                           GCallback    changed_func,
-                           gpointer     data,
-                           gint         row,
-                           const gchar *initval,
-                           GtkWidget   *hotlabel)
+libbalsa_create_grid_entry(GtkWidget * grid, GCallback changed_func,
+                           gpointer data, gint row, const gchar * initval,
+                           GtkWidget * hotlabel)
 {
     GtkWidget *entry;
 
@@ -1046,40 +947,34 @@ libbalsa_create_grid_entry(GtkWidget   *grid,
 
     gtk_grid_attach(GTK_GRID(grid), entry, 1, row, 1, 1);
 
-    if (initval) {
+    if (initval)
         gtk_entry_set_text(GTK_ENTRY(entry), initval);
-    }
 
     gtk_label_set_mnemonic_widget(GTK_LABEL(hotlabel), entry);
 
     /* Watch for changes... */
-    if (changed_func) {
+    if (changed_func)
         g_signal_connect(entry, "changed", changed_func, data);
-    }
 
     return entry;
 }
 
-
 /* Create a GtkSizeGroup and add to it any GtkLabel packed in a GtkGrid
  * inside the chooser widget; size_group will be unreffed when the
  * chooser widget is finalized. */
 static void
-lb_create_size_group_func(GtkWidget *widget,
-                          gpointer   data)
+lb_create_size_group_func(GtkWidget * widget, gpointer data)
 {
     if (GTK_IS_LABEL(widget) &&
-        GTK_IS_GRID(gtk_widget_get_parent(widget))) {
+        GTK_IS_GRID(gtk_widget_get_parent(widget)))
         gtk_size_group_add_widget(GTK_SIZE_GROUP(data), widget);
-    } else if (GTK_IS_CONTAINER(widget)) {
+    else if (GTK_IS_CONTAINER(widget))
         gtk_container_foreach(GTK_CONTAINER(widget),
                               lb_create_size_group_func, data);
-    }
 }
 
-
 GtkSizeGroup *
-libbalsa_create_size_group(GtkWidget *chooser)
+libbalsa_create_size_group(GtkWidget * chooser)
 {
     GtkSizeGroup *size_group;
 
@@ -1091,125 +986,109 @@ libbalsa_create_size_group(GtkWidget *chooser)
     return size_group;
 }
 
-
 void
 libbalsa_assure_balsa_dir(void)
 {
-    gchar *dir = g_strconcat(g_get_home_dir(), "/.balsa", NULL);
-    mkdir(dir, S_IRUSR | S_IWUSR | S_IXUSR);
+    gchar* dir = g_strconcat(g_get_home_dir(), "/.balsa", NULL);
+    mkdir(dir, S_IRUSR|S_IWUSR|S_IXUSR);
     g_free(dir);
 }
 
-
 /* Some more "guess" functions symmetric to libbalsa_guess_mail_spool()... */
 
 #define POP_SERVER "pop"
 #define IMAP_SERVER "mx"
 #define LDAP_SERVER "ldap"
 
-static gchar *
+static gchar*
 qualified_hostname(const char *name)
 {
-    gchar *domain = libbalsa_get_domainname();
-
-    if (domain) {
-        gchar *host = g_strdup_printf("%s.%s", name, domain);
+    gchar *domain=libbalsa_get_domainname();
 
-        g_free(domain);
+    if(domain) {
+       gchar *host=g_strdup_printf("%s.%s", name, domain);
+       
+       g_free(domain);
 
-        return host;
-    } else {
-        return g_strdup(name);
-    }
+       return host;
+    } else
+       return g_strdup(name);
 }
 
 
-gchar *
-libbalsa_guess_imap_server()
+gchar *libbalsa_guess_imap_server()
 {
     return qualified_hostname(IMAP_SERVER);
 }
 
-
-gchar *
-libbalsa_guess_ldap_server()
+gchar *libbalsa_guess_ldap_server()
 {
     return qualified_hostname(LDAP_SERVER);
 }
 
-
-gchar *
-libbalsa_guess_imap_inbox()
+gchar *libbalsa_guess_imap_inbox()
 {
     gchar *server = libbalsa_guess_imap_server();
 
-    if (server) {
-        gchar *url = g_strdup_printf("imap://%s/INBOX", server);
-
-        g_free(server);
+    if(server) {
+       gchar *url = g_strdup_printf("imap://%s/INBOX", server);
+       
+       g_free(server);
 
-        return url;
+       return url;
     }
 
     return NULL;
 }
 
-
-gchar *
-libbalsa_guess_ldap_base()
+gchar *libbalsa_guess_ldap_base()
 {
     gchar *server = libbalsa_guess_ldap_server();
 
     /* Note: Assumes base dn is "o=<domain name>". Somewhat speculative... */
-    if (server) {
-        gchar *base = NULL, *domain;
-
-        if ((domain = strchr(server, '.'))) {
-            base = g_strdup_printf("o=%s", domain + 1);
-        }
+    if(server) {
+       gchar *base=NULL, *domain;
 
-        g_free(server);
+       if((domain=strchr(server, '.')))
+          base = g_strdup_printf("o=%s", domain+1);
+       
+       g_free(server);
 
-        return base;
+       return base;
     }
     return NULL;
 }
 
-
-gchar *
-libbalsa_guess_ldap_name()
+gchar *libbalsa_guess_ldap_name()
 {
     gchar *base = libbalsa_guess_ldap_base();
 
-    if (base) {
-        gchar *name = strchr(base, '=');
-        gchar *dir_name = g_strdup_printf(_("LDAP Directory for %s"),
-                                          (name ? name + 1 : base));
-        g_free(base);
+    if(base) {
+       gchar *name = strchr(base, '=');
+       gchar *dir_name = g_strdup_printf(_("LDAP Directory for %s"), 
+                                         (name?name+1:base));
+       g_free(base);
 
-        return dir_name;
-    }
+       return dir_name;
+    } 
 
     return NULL;
 }
 
 
 gboolean
-libbalsa_path_is_below_dir(const gchar *path,
-                           const gchar *dir)
+libbalsa_path_is_below_dir(const gchar * path, const gchar * dir)
 {
     gsize len;
 
-    if (!path || !dir || !g_str_has_prefix(path, dir)) {
+    if (!path || !dir || !g_str_has_prefix(path, dir))
         return FALSE;
-    }
 
     len = strlen(dir);
 
     return dir[len - 1] == G_DIR_SEPARATOR || path[len] == G_DIR_SEPARATOR;
 }
 
-
 #define LIBBALSA_RADIX 1024.0
 #define MAX_WITHOUT_SUFFIX 9999
 
@@ -1222,24 +1101,20 @@ libbalsa_size_to_gchar(guint64 size)
 
         for (s = suffix; /* *s != '\0' */; s++) {
             displayed_size /= LIBBALSA_RADIX;
-            if (displayed_size < 9.995) {
+            if (displayed_size < 9.995)
                 return g_strdup_printf("%.2f%c", displayed_size, *s);
-            }
-            if (displayed_size < 99.95) {
+            if (displayed_size < 99.95)
                 return g_strdup_printf("%.1f%c", displayed_size, *s);
-            }
-            if ((displayed_size < LIBBALSA_RADIX - 0.5) || !s[1]) {
+            if (displayed_size < LIBBALSA_RADIX - 0.5 || !s[1])
                 return g_strdup_printf("%" G_GUINT64_FORMAT "%c",
                                        ((guint64) (displayed_size + 0.5)),
                                        *s);
-            }
         }
     }
 
     return g_strdup_printf("%" G_GUINT64_FORMAT, size);
 }
 
-
 /*
  * libbalsa_font_string_to_css: construct CSS text corresponding to a
  * PangoFontDescription string.
@@ -1252,8 +1127,8 @@ libbalsa_size_to_gchar(guint64 size)
  */
 
 gchar *
-libbalsa_font_string_to_css(const gchar *font_string,
-                            const gchar *name)
+libbalsa_font_string_to_css(const gchar * font_string,
+                            const gchar * name)
 {
     PangoFontDescription *desc;
     PangoFontMask mask;
@@ -1334,14 +1209,13 @@ libbalsa_font_string_to_css(const gchar *font_string,
     return g_string_free(string, FALSE);
 }
 
-
 /*
  * Convenience function for removing and clearing a GSource id
  *
  * Returns TRUE if the GSource was removed
  */
 gboolean
-libbalsa_clear_source_id(guint *tag)
+libbalsa_clear_source_id(guint * tag)
 {
     gboolean retval;
 
@@ -1354,7 +1228,6 @@ libbalsa_clear_source_id(guint *tag)
     return retval;
 }
 
-
 /*
  * Convenience functions for freeing list items' data and clearing the
  * list
@@ -1363,17 +1236,14 @@ libbalsa_clear_source_id(guint *tag)
  * g_clear_pointer(&list, (GDestroyNotify) g_list_free);
  */
 void
-libbalsa_clear_list(GList        **list,
-                    GDestroyNotify free_func)
+libbalsa_clear_list(GList ** list, GDestroyNotify free_func)
 {
     g_list_free_full(*list, free_func);
     *list = NULL;
 }
 
-
 void
-libbalsa_clear_slist(GSList       **list,
-                     GDestroyNotify free_func)
+libbalsa_clear_slist(GSList ** list, GDestroyNotify free_func)
 {
     g_slist_free_full(*list, free_func);
     *list = NULL;
diff --git a/libbalsa/misc.h b/libbalsa/misc.h
index bd20470..6ba1880 100644
--- a/libbalsa/misc.h
+++ b/libbalsa/misc.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -22,7 +22,7 @@
 #define __LIBBALSA_MISC_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include <stdio.h>
@@ -74,11 +74,8 @@ struct _LibBalsaCodesetInfo {
     const gchar *win;
 };
 
-typedef void (*libbalsa_url_cb_t) (GtkTextBuffer *,
-                                   GtkTextIter *,
-                                   const gchar *,
-                                   guint,
-                                   gpointer);
+typedef void (*libbalsa_url_cb_t) (GtkTextBuffer *, GtkTextIter *,
+                                  const gchar *, guint, gpointer);
 typedef struct _LibBalsaUrlInsertInfo LibBalsaUrlInsertInfo;
 struct _LibBalsaUrlInsertInfo {
     libbalsa_url_cb_t callback;
@@ -91,91 +88,61 @@ struct _LibBalsaUrlInsertInfo {
 
 extern LibBalsaCodesetInfo libbalsa_codeset_info[];
 GtkWidget *libbalsa_charset_button_new(void);
-LibBalsaTextAttribute libbalsa_text_attr_string(const gchar *string);
-LibBalsaTextAttribute libbalsa_text_attr_file(const gchar *filename);
+LibBalsaTextAttribute libbalsa_text_attr_string(const gchar * string);
+LibBalsaTextAttribute libbalsa_text_attr_file(const gchar * filename);
 
 gchar *libbalsa_get_domainname(void);
-
 #define libbalsa_urlencode(str) (g_uri_escape_string((str), NULL, FALSE))
 #define libbalsa_urldecode(str) (g_uri_unescape_string((str), NULL))
 
-gboolean libbalsa_find_word(const gchar *word,
-                            const gchar *str);
-void libbalsa_wrap_string(gchar *str,
-                          int    width);
-GString *libbalsa_process_text_rfc2646(gchar   *par,
-                                       gint     width,
-                                       gboolean from_screen,
-                                       gboolean to_screen,
-                                       gboolean quote,
-                                       gboolean delsp);
-gchar *libbalsa_wrap_rfc2646(gchar   *par,
-                             gint     width,
-                             gboolean from_screen,
-                             gboolean to_screen,
-                             gboolean delsp);
-void libbalsa_wrap_view(GtkTextView *view,
-                        gint         length);
-void libbalsa_unwrap_buffer(GtkTextBuffer *buffer,
-                            GtkTextIter   *iter,
-                            gint           lines);
+gboolean libbalsa_find_word(const gchar * word, const gchar * str);
+void libbalsa_wrap_string(gchar * str, int width);
+GString *libbalsa_process_text_rfc2646(gchar * par, gint width,
+                                      gboolean from_screen,
+                                      gboolean to_screen, gboolean quote,
+                                      gboolean delsp);
+gchar *libbalsa_wrap_rfc2646(gchar * par, gint width,
+                             gboolean from_screen, gboolean to_screen,
+                            gboolean delsp);
+void libbalsa_wrap_view(GtkTextView * view, gint length);
+void libbalsa_unwrap_buffer(GtkTextBuffer * buffer, GtkTextIter * iter,
+                            gint lines);
 
 gboolean libbalsa_delete_directory_contents(const gchar *path);
 gchar *libbalsa_expand_path(const gchar *path);
-gboolean libbalsa_mktempdir(gchar **name);
+gboolean libbalsa_mktempdir(gchar ** name);
 LibBalsaCodeset libbalsa_set_fallback_codeset(LibBalsaCodeset codeset);
-gboolean libbalsa_utf8_sanitize(gchar       **text,
-                                gboolean      fallback,
+gboolean libbalsa_utf8_sanitize(gchar ** text, gboolean fallback,
                                 gchar const **target);
-gboolean libbalsa_utf8_strstr(const gchar *s1,
-                              const gchar *s2);
-gboolean libbalsa_insert_with_url(GtkTextBuffer         *buffer,
-                                  const char            *chars,
-                                  guint                  len,
-                                  GtkTextTag            *tag,
-                                  LibBalsaUrlInsertInfo *url_info);
-void libbalsa_unwrap_selection(GtkTextBuffer *buffer,
-                               GRegex        *rex);
-gboolean libbalsa_match_regex(const gchar *line,
-                              GRegex      *rex,
-                              guint       *count,
-                              guint       *index);
-
-int libbalsa_safe_open(const char *path,
-                       int         flags,
-                       mode_t      mode,
-                       GError    **err);
-int libbalsa_lock_file(const char *path,
-                       int         fd,
-                       int         excl,
-                       int         dot,
-                       int         timeout);
-int libbalsa_unlock_file(const char *path,
-                         int         fd,
-                         int         dot);
-int libbalsa_safe_rename(const char *src,
-                         const char *target);
-
+gboolean libbalsa_utf8_strstr(const gchar *s1,const gchar *s2);
+gboolean libbalsa_insert_with_url(GtkTextBuffer * buffer,
+                                 const char *chars,
+                                 guint len,
+                                 GtkTextTag * tag,
+                                 LibBalsaUrlInsertInfo *url_info);
+void libbalsa_unwrap_selection(GtkTextBuffer * buffer, GRegex * rex);
+gboolean libbalsa_match_regex(const gchar * line, GRegex * rex,
+                             guint * count, guint * index);
+
+int libbalsa_safe_open (const char *path, int flags, mode_t mode, GError **err);
+int libbalsa_lock_file (const char *path, int fd, int excl, int dot, int timeout);
+int libbalsa_unlock_file (const char *path, int fd, int dot);
+int libbalsa_safe_rename (const char *src, const char *target);
 #define libbalsa_str_has_prefix(str, prefix) g_str_has_prefix((str), (prefix))
 
-gboolean libbalsa_ia_rfc2821_equal(const InternetAddress *a,
-                                   const InternetAddress *b);
+gboolean libbalsa_ia_rfc2821_equal(const InternetAddress * a,
+                                  const InternetAddress * b);
 
 GtkWidget *libbalsa_create_grid(void);
-GtkWidget *libbalsa_create_grid_label(const gchar *label,
-                                      GtkWidget   *grid,
-                                      gint         row);
-GtkWidget *libbalsa_create_grid_entry(GtkWidget   *grid,
-                                      GCallback    func,
-                                      gpointer     data,
-                                      gint         row,
-                                      const gchar *initval,
-                                      GtkWidget   *hotlabel);
-GtkWidget *libbalsa_create_grid_check(const gchar *label,
-                                      GtkWidget   *grid,
-                                      gint         row,
-                                      gboolean     initval);
-GtkSizeGroup *libbalsa_create_size_group(GtkWidget *chooser);
+GtkWidget *libbalsa_create_grid_label(const gchar * label, GtkWidget * grid,
+                                      gint row);
+GtkWidget *libbalsa_create_grid_entry(GtkWidget * grid, GCallback func,
+                                      gpointer data, gint row,
+                                      const gchar * initval,
+                                      GtkWidget * hotlabel);
+GtkWidget *libbalsa_create_grid_check(const gchar * label, GtkWidget * grid,
+                                      gint row, gboolean initval);
+GtkSizeGroup *libbalsa_create_size_group(GtkWidget * chooser);
 
 void libbalsa_assure_balsa_dir(void);
 gchar *libbalsa_guess_ldap_base(void);
@@ -183,22 +150,16 @@ gchar *libbalsa_guess_ldap_name(void);
 
 gboolean libbalsa_ldap_exists(const gchar *server);
 
-gboolean libbalsa_path_is_below_dir(const gchar *path,
-                                    const gchar *dir);
+gboolean libbalsa_path_is_below_dir(const gchar * path, const gchar * dir);
 
 gchar *libbalsa_size_to_gchar(guint64 length);
 
-gchar *libbalsa_text_to_html(const gchar *title,
-                             const gchar *body,
-                             const gchar *lang);
-GString *libbalsa_html_encode_hyperlinks(GString *paragraph);
-gchar *libbalsa_font_string_to_css(const gchar *font_string,
-                                   const gchar *name);
+gchar * libbalsa_text_to_html(const gchar * title, const gchar * body, const gchar * lang);
+GString * libbalsa_html_encode_hyperlinks(GString * paragraph);
+gchar *libbalsa_font_string_to_css(const gchar * font_string, const gchar * name);
 
-gboolean libbalsa_clear_source_id(guint *tag);
-void libbalsa_clear_list(GList        **list,
-                         GDestroyNotify free_func);
-void libbalsa_clear_slist(GSList       **list,
-                          GDestroyNotify free_func);
+gboolean libbalsa_clear_source_id(guint * tag);
+void libbalsa_clear_list(GList ** list, GDestroyNotify free_func);
+void libbalsa_clear_slist(GSList ** list, GDestroyNotify free_func);
 
-#endif                          /* __LIBBALSA_MISC_H__ */
+#endif                         /* __LIBBALSA_MISC_H__ */
diff --git a/libbalsa/missing.h b/libbalsa/missing.h
index acc0392..401047d 100644
--- a/libbalsa/missing.h
+++ b/libbalsa/missing.h
@@ -8,14 +8,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -24,13 +24,12 @@
 #include <time.h>
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #if (HAVE_DECL_CTIME_R == 0)
-char *ctime_r(const time_t *clock,
-              char         *buf);
-
+char * ctime_r(const time_t *clock, char *buf);
 #endif
 
 #endif
+
diff --git a/libbalsa/missing_time.c b/libbalsa/missing_time.c
index 90fccf7..811bb14 100644
--- a/libbalsa/missing_time.c
+++ b/libbalsa/missing_time.c
@@ -6,42 +6,39 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #if !defined(HAVE_CTIME_R)
 
-#   include "missing.h"
+#include "missing.h"
 
-#   include <string.h>
+#include <string.h>
 
-#   ifndef HAVE_CTIME_R
+#ifndef HAVE_CTIME_R
 char *
-ctime_r(const time_t *clock,
-        char         *buf)
+ctime_r(const time_t *clock, char *buf)
 {
-    static GMutex time_lock;
+       static GMutex time_lock;
 
-    g_mutex_lock(&mutex);
+       g_mutex_lock(&mutex);
     strcpy(buf, ctime(clock));
-    g_mutex_unlock(&mutex);
+       g_mutex_unlock(&mutex);
     return buf;
 }
-
-
-#   endif
+#endif
 
 #endif
diff --git a/libbalsa/rfc2445.c b/libbalsa/rfc2445.c
index 9abb7ae..61f99c0 100644
--- a/libbalsa/rfc2445.c
+++ b/libbalsa/rfc2445.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "rfc2445.h"
 
@@ -52,28 +52,28 @@ static GObjectClass *libbalsa_vevent_parent_class = NULL;
 #define RFC2445_RSVP            "RFC2445:RSVP"
 
 
-static void libbalsa_vcal_class_init(LibBalsaVCalClass *klass);
-static void libbalsa_vcal_init(LibBalsaVCal *self);
-static void libbalsa_vcal_finalize(LibBalsaVCal *self);
+static void libbalsa_vcal_class_init(LibBalsaVCalClass * klass);
+static void libbalsa_vcal_init(LibBalsaVCal * self);
+static void libbalsa_vcal_finalize(LibBalsaVCal * self);
 
-static void libbalsa_vevent_class_init(LibBalsaVEventClass *klass);
-static void libbalsa_vevent_init(LibBalsaVEvent *self);
-static void libbalsa_vevent_finalize(LibBalsaVEvent *self);
+static void libbalsa_vevent_class_init(LibBalsaVEventClass * klass);
+static void libbalsa_vevent_init(LibBalsaVEvent * self);
+static void libbalsa_vevent_finalize(LibBalsaVEvent * self);
 
-static LibBalsaAddress *cal_address_2445_to_lbaddress(const gchar *uri,
-                                                      gchar      **attributes,
-                                                      gboolean
-                                                      is_organizer);
+static LibBalsaAddress *cal_address_2445_to_lbaddress(const gchar * uri,
+                                                     gchar ** attributes,
+                                                     gboolean
+                                                     is_organizer);
 
 /* conversion helpers */
-static time_t date_time_2445_to_time_t(const gchar *date_time);
+static time_t date_time_2445_to_time_t(const gchar * date_time);
 static gchar *time_t_to_date_time_2445(time_t ttime);
-static gchar *text_2445_unescape(const gchar *text);
-static gchar *text_2445_escape(const gchar *text);
+static gchar *text_2445_unescape(const gchar * text);
+static gchar *text_2445_escape(const gchar * text);
 static const gchar *vcal_role_to_str(LibBalsaVCalRole role);
-static LibBalsaVCalMethod vcal_str_to_method(const gchar *method);
-static LibBalsaVCalRole vcal_str_to_role(const gchar *role);
-static LibBalsaVCalPartStat vcal_str_to_part_stat(const gchar *pstat);
+static LibBalsaVCalMethod vcal_str_to_method(const gchar * method);
+static LibBalsaVCalRole vcal_str_to_role(const gchar * role);
+static LibBalsaVCalPartStat vcal_str_to_part_stat(const gchar * pstat);
 
 
 #define LB_ROLE2PTR(r)      GINT_TO_POINTER((gint) (r))
@@ -103,22 +103,22 @@ libbalsa_vcal_get_type(void)
     static GType libbalsa_vcal_type = 0;
 
     if (!libbalsa_vcal_type) {
-        static const GTypeInfo libbalsa_vcal_type_info = {
-            sizeof(LibBalsaVCalClass),  /* class_size */
-            NULL,               /* base_init */
-            NULL,               /* base_finalize */
-            (GClassInitFunc) libbalsa_vcal_class_init,  /* class_init */
-            NULL,               /* class_finalize */
-            NULL,               /* class_data */
-            sizeof(LibBalsaVCal),       /* instance_size */
-            0,                  /* n_preallocs */
-            (GInstanceInitFunc) libbalsa_vcal_init,     /* instance_init */
-            /* no value_table */
-        };
-
-        libbalsa_vcal_type =
-            g_type_register_static(G_TYPE_OBJECT, "LibBalsaVCal",
-                                   &libbalsa_vcal_type_info, 0);
+       static const GTypeInfo libbalsa_vcal_type_info = {
+           sizeof(LibBalsaVCalClass),  /* class_size */
+           NULL,               /* base_init */
+           NULL,               /* base_finalize */
+           (GClassInitFunc) libbalsa_vcal_class_init,  /* class_init */
+           NULL,               /* class_finalize */
+           NULL,               /* class_data */
+           sizeof(LibBalsaVCal),       /* instance_size */
+           0,                  /* n_preallocs */
+           (GInstanceInitFunc) libbalsa_vcal_init,     /* instance_init */
+           /* no value_table */
+       };
+
+       libbalsa_vcal_type =
+           g_type_register_static(G_TYPE_OBJECT, "LibBalsaVCal",
+                                  &libbalsa_vcal_type_info, 0);
     }
 
     return libbalsa_vcal_type;
@@ -126,7 +126,7 @@ libbalsa_vcal_get_type(void)
 
 
 static void
-libbalsa_vcal_class_init(LibBalsaVCalClass *klass)
+libbalsa_vcal_class_init(LibBalsaVCalClass * klass)
 {
     GObjectClass *gobject_klass = G_OBJECT_CLASS(klass);
 
@@ -136,7 +136,7 @@ libbalsa_vcal_class_init(LibBalsaVCalClass *klass)
 
 
 static void
-libbalsa_vcal_init(LibBalsaVCal *self)
+libbalsa_vcal_init(LibBalsaVCal * self)
 {
     self->method = ITIP_UNKNOWN;
     self->vevent = NULL;
@@ -144,7 +144,7 @@ libbalsa_vcal_init(LibBalsaVCal *self)
 
 
 static void
-libbalsa_vcal_finalize(LibBalsaVCal *self)
+libbalsa_vcal_finalize(LibBalsaVCal * self)
 {
     g_return_if_fail(self != NULL);
 
@@ -168,22 +168,22 @@ libbalsa_vevent_get_type(void)
     static GType libbalsa_vevent_type = 0;
 
     if (!libbalsa_vevent_type) {
-        static const GTypeInfo libbalsa_vevent_type_info = {
-            sizeof(LibBalsaVEventClass),        /* class_size */
-            NULL,               /* base_init */
-            NULL,               /* base_finalize */
-            (GClassInitFunc) libbalsa_vevent_class_init,        /* class_init */
-            NULL,               /* class_finalize */
-            NULL,               /* class_data */
-            sizeof(LibBalsaVEvent),     /* instance_size */
-            0,                  /* n_preallocs */
-            (GInstanceInitFunc) libbalsa_vevent_init,   /* instance_init */
-            /* no value_table */
-        };
-
-        libbalsa_vevent_type =
-            g_type_register_static(G_TYPE_OBJECT, "LibBalsaVEvent",
-                                   &libbalsa_vevent_type_info, 0);
+       static const GTypeInfo libbalsa_vevent_type_info = {
+           sizeof(LibBalsaVEventClass),        /* class_size */
+           NULL,               /* base_init */
+           NULL,               /* base_finalize */
+           (GClassInitFunc) libbalsa_vevent_class_init,        /* class_init */
+           NULL,               /* class_finalize */
+           NULL,               /* class_data */
+           sizeof(LibBalsaVEvent),     /* instance_size */
+           0,                  /* n_preallocs */
+           (GInstanceInitFunc) libbalsa_vevent_init,   /* instance_init */
+           /* no value_table */
+       };
+
+       libbalsa_vevent_type =
+           g_type_register_static(G_TYPE_OBJECT, "LibBalsaVEvent",
+                                  &libbalsa_vevent_type_info, 0);
     }
 
     return libbalsa_vevent_type;
@@ -191,30 +191,30 @@ libbalsa_vevent_get_type(void)
 
 
 static void
-libbalsa_vevent_class_init(LibBalsaVEventClass *klass)
+libbalsa_vevent_class_init(LibBalsaVEventClass * klass)
 {
     GObjectClass *gobject_klass = G_OBJECT_CLASS(klass);
 
     libbalsa_vevent_parent_class = g_type_class_peek(G_TYPE_OBJECT);
     gobject_klass->finalize =
-        (GObjectFinalizeFunc) libbalsa_vevent_finalize;
+       (GObjectFinalizeFunc) libbalsa_vevent_finalize;
 }
 
 
 static void
-libbalsa_vevent_init(LibBalsaVEvent *self)
+libbalsa_vevent_init(LibBalsaVEvent * self)
 {
-    self->start = self->end = self->stamp = (time_t) -1;
+    self->start = self->end = self->stamp = (time_t) - 1;
 }
 
 
 static void
-libbalsa_vevent_finalize(LibBalsaVEvent *self)
+libbalsa_vevent_finalize(LibBalsaVEvent * self)
 {
     g_return_if_fail(self != NULL);
 
     if (self->organizer) {
-        g_object_unref(self->organizer);
+       g_object_unref(self->organizer);
     }
     g_list_free_full(self->attendee, g_object_unref);
     g_free(self->uid);
@@ -247,24 +247,21 @@ libbalsa_vevent_new(void)
  * the terminating '\0' (c.f. strchr).
  */
 static gchar *
-vcal_strchr(gchar *s,
-            gint   c)
+vcal_strchr(gchar * s, gint c)
 {
     gboolean is_quoted = FALSE;
 
     while (*s) {
-        if (*s == '"') {
+        if (*s == '"')
             is_quoted = !is_quoted;
-        } else if ((*s == c) && !is_quoted) {
+        else if (*s == c && !is_quoted)
             return s;
-        }
         ++s;
     }
 
     return NULL;
 }
 
-
 /*
  * Split the string s at unquoted occurrences of c.
  *
@@ -275,8 +272,7 @@ vcal_strchr(gchar *s,
  * g_strfreev() to free it.
  */
 static gchar **
-vcal_strsplit_at_char(gchar *s,
-                      gint   c)
+vcal_strsplit_at_char(gchar * s, gint c)
 {
     GPtrArray *array = g_ptr_array_new();
     gchar *p;
@@ -291,10 +287,9 @@ vcal_strsplit_at_char(gchar *s,
     return (gchar **) g_ptr_array_free(array, FALSE);
 }
 
-
 /* parse a text/calendar part and convert it into a LibBalsaVCal object */
 LibBalsaVCal *
-libbalsa_vcal_new_from_body(LibBalsaMessageBody *body)
+libbalsa_vcal_new_from_body(LibBalsaMessageBody * body)
 {
     LibBalsaVCal *retval;
     gchar *charset;
@@ -309,27 +304,25 @@ libbalsa_vcal_new_from_body(LibBalsaMessageBody *body)
     g_return_val_if_fail(body != NULL, NULL);
 
     /* get the body buffer */
-    if (libbalsa_message_body_get_content(body, &vcal_buf, NULL) <= 0) {
-        return NULL;
-    }
+    if (libbalsa_message_body_get_content(body, &vcal_buf, NULL) <= 0)
+       return NULL;
 
     /* check if the body has a charset (default is utf-8, see '2445,
      * sect 4.1.4) */
     charset = libbalsa_message_body_get_parameter(body, "charset");
     if (charset && g_ascii_strcasecmp(charset, "utf-8")) {
-        gsize written;
-        gchar *conv_buf;
-
-        conv_buf =
-            g_convert(vcal_buf, -1, "utf-8", charset, NULL, &written,
-                      NULL);
-        g_free(vcal_buf);
-        vcal_buf = conv_buf;
+       gsize written;
+       gchar *conv_buf;
+
+       conv_buf =
+           g_convert(vcal_buf, -1, "utf-8", charset, NULL, &written,
+                     NULL);
+       g_free(vcal_buf);
+       vcal_buf = conv_buf;
     }
     g_free(charset);
-    if (!vcal_buf) {
-        return NULL;
-    }
+    if (!vcal_buf)
+       return NULL;
 
     /* o.k., create a new object */
     retval = libbalsa_vcal_new();
@@ -337,19 +330,17 @@ libbalsa_vcal_new_from_body(LibBalsaMessageBody *body)
     /* replace \r\n by \n */
     p = strchr(vcal_buf, '\r');
     while (p) {
-        if (p[1] == '\n') {
-            memmove(p, p + 1, strlen(p + 1) + 1);
-        }
-        p = strchr(p + 1, '\r');
+        if (p[1] =='\n')
+           memmove(p, p + 1, strlen(p + 1) + 1);
+       p = strchr(p + 1, '\r');
     }
 
     /* unfold the body and split into lines */
     p = strchr(vcal_buf, '\n');
     while (p) {
-        if ((p[1] == '\t') || (p[1] == ' ')) {
-            memmove(p, p + 2, strlen(p + 2) + 1);
-        }
-        p = strchr(p + 1, '\n');
+       if (p[1] == '\t' || p[1] == ' ')
+           memmove(p, p + 2, strlen(p + 2) + 1);
+       p = strchr(p + 1, '\n');
     }
     lines = g_strsplit(vcal_buf, "\n", -1);
     g_free(vcal_buf);
@@ -359,66 +350,60 @@ libbalsa_vcal_new_from_body(LibBalsaMessageBody *body)
     method = NULL;
     in_embedded = FALSE;
     for (k = 0; lines[k]; k++) {
-        if (!event) {
-            if ((method == NULL) && g_str_has_prefix(lines[k], "METHOD:")) {
+       if (!event) {
+            if (method == NULL && g_str_has_prefix(lines[k], "METHOD:"))
                 method = g_strdup(lines[k] + 7);
-            }
-            if (!g_ascii_strcasecmp("BEGIN:VEVENT", lines[k])) {
-                event = libbalsa_vevent_new();
-            }
-        } else if (strlen(lines[k])) {
-            gchar *value = vcal_strchr(lines[k], ':');
-            gchar **entry;
-
-            if (value) {
-                *value++ = '\0';
-            }
-            entry = vcal_strsplit_at_char(lines[k], ';');
-            if (!g_ascii_strcasecmp(entry[0], "END")) {
+           if (!g_ascii_strcasecmp("BEGIN:VEVENT", lines[k]))
+               event = libbalsa_vevent_new();
+       } else if (strlen(lines[k])) {
+           gchar *value = vcal_strchr(lines[k], ':');
+           gchar **entry;
+
+           if (value)
+               *value++ = '\0';
+           entry = vcal_strsplit_at_char(lines[k], ';');
+           if (!g_ascii_strcasecmp(entry[0], "END")) {
                 if (value && !g_ascii_strcasecmp(value, "VEVENT")) {
                     retval->vevent = g_list_append(retval->vevent, event);
                     event = NULL;
                 } else {
                     in_embedded = FALSE;
                 }
-            } else if (!g_ascii_strcasecmp(entry[0], "BEGIN")) {
+            } else if (!g_ascii_strcasecmp(entry[0], "BEGIN"))
                 in_embedded = TRUE;
-            } else if (!in_embedded) {
-                if (!g_ascii_strcasecmp(entry[0], "DTSTART")) {
+            else if (!in_embedded) {
+                if (!g_ascii_strcasecmp(entry[0], "DTSTART"))
                     event->start = date_time_2445_to_time_t(value);
-                } else if (!g_ascii_strcasecmp(entry[0], "DTEND")) {
+                else if (!g_ascii_strcasecmp(entry[0], "DTEND"))
                     event->end = date_time_2445_to_time_t(value);
-                } else if (!g_ascii_strcasecmp(entry[0], "DTSTAMP")) {
+                else if (!g_ascii_strcasecmp(entry[0], "DTSTAMP"))
                     event->stamp = date_time_2445_to_time_t(value);
-                } else if (!g_ascii_strcasecmp(entry[0], "UID")) {
+                else if (!g_ascii_strcasecmp(entry[0], "UID"))
                     STR_REPL_2445_TXT(event->uid, value);
-                } else if (!g_ascii_strcasecmp(entry[0], "SUMMARY")) {
+                else if (!g_ascii_strcasecmp(entry[0], "SUMMARY"))
                     STR_REPL_2445_TXT(event->summary, value);
-                } else if (!g_ascii_strcasecmp(entry[0], "LOCATION")) {
+                else if (!g_ascii_strcasecmp(entry[0], "LOCATION"))
                     STR_REPL_2445_TXT(event->location, value);
-                } else if (!g_ascii_strcasecmp(entry[0], "DESCRIPTION")) {
+                else if (!g_ascii_strcasecmp(entry[0], "DESCRIPTION"))
                     STR_REPL_2445_TXT(event->description, value);
-                } else if (!g_ascii_strcasecmp(entry[0], "ORGANIZER")) {
-                    if (event->organizer) {
+                else if (!g_ascii_strcasecmp(entry[0], "ORGANIZER")) {
+                    if (event->organizer)
                         g_object_unref(event->organizer);
-                    }
                     event->organizer =
                         cal_address_2445_to_lbaddress(value, entry + 1, TRUE);
-                } else if (!g_ascii_strcasecmp(entry[0], "ATTENDEE")) {
+                } else if (!g_ascii_strcasecmp(entry[0], "ATTENDEE"))
                     event->attendee =
                         g_list_prepend(event->attendee,
                                        cal_address_2445_to_lbaddress(value,
                                                                      entry + 1,
                                                                      FALSE));
-                }
             }
-            g_strfreev(entry);
-        }
+           g_strfreev(entry);
+       }
     }
     g_strfreev(lines);
-    if (event) {
-        g_object_unref(event);
-    }
+    if (event)
+       g_object_unref(event);
 
     /* set the method */
     retval->method = vcal_str_to_method(method);
@@ -431,7 +416,7 @@ libbalsa_vcal_new_from_body(LibBalsaMessageBody *body)
 /* return a rfc 2445 attendee (i.e. a LibBalsaAddress w/ extra information)
  * as a human-readable string */
 gchar *
-libbalsa_vcal_attendee_to_str(LibBalsaAddress *person)
+libbalsa_vcal_attendee_to_str(LibBalsaAddress * person)
 {
     GString *retval;
     gchar *str;
@@ -444,9 +429,8 @@ libbalsa_vcal_attendee_to_str(LibBalsaAddress *person)
 
     role = LB_PTR2ROLE(g_object_get_data(G_OBJECT(person),
                                          RFC2445_ROLE));
-    if (role != VCAL_ROLE_UNKNOWN) {
-        g_string_printf(retval, "%s ", vcal_role_to_str(role));
-    }
+    if (role != VCAL_ROLE_UNKNOWN)
+       g_string_printf(retval, "%s ", vcal_role_to_str(role));
 
     str = libbalsa_address_to_gchar(person, -1);
     retval = g_string_append(retval, str);
@@ -454,10 +438,9 @@ libbalsa_vcal_attendee_to_str(LibBalsaAddress *person)
 
     pstat = LB_PTR2PSTAT(g_object_get_data(G_OBJECT(person),
                                            RFC2445_PARTSTAT));
-    if (pstat != VCAL_PSTAT_UNKNOWN) {
-        g_string_append_printf(retval, " (%s)",
-                               libbalsa_vcal_part_stat_to_str(pstat));
-    }
+    if (pstat != VCAL_PSTAT_UNKNOWN)
+       g_string_append_printf(retval, " (%s)",
+                              libbalsa_vcal_part_stat_to_str(pstat));
 
     return g_string_free(retval, FALSE);
 }
@@ -466,20 +449,19 @@ libbalsa_vcal_attendee_to_str(LibBalsaAddress *person)
 /* check if a rfc 2445 attendee (i.e. a LibBalsaAddress w/ extra information)
  * has the RSVP flag ("please reply") set */
 gboolean
-libbalsa_vcal_attendee_rsvp(LibBalsaAddress *person)
+libbalsa_vcal_attendee_rsvp(LibBalsaAddress * person)
 {
     g_return_val_if_fail(LIBBALSA_IS_ADDRESS(person), FALSE);
-    return (gboolean)
-           GPOINTER_TO_INT(g_object_get_data(G_OBJECT(person), RFC2445_RSVP));
+    return (gboolean) 
+       GPOINTER_TO_INT(g_object_get_data(G_OBJECT(person), RFC2445_RSVP));
 }
 
 
 /* return a new buffer containing a proper reply to an event for a new
  * participant status */
 gchar *
-libbalsa_vevent_reply(const LibBalsaVEvent *event,
-                      const gchar          *sender,
-                      LibBalsaVCalPartStat  new_stat)
+libbalsa_vevent_reply(const LibBalsaVEvent * event, const gchar * sender,
+                     LibBalsaVCalPartStat new_stat)
 {
     GString *retval;
     gchar *buf;
@@ -488,48 +470,46 @@ libbalsa_vevent_reply(const LibBalsaVEvent *event,
 
     /* check for allowed new state and sender */
     g_return_val_if_fail((new_stat == VCAL_PSTAT_ACCEPTED ||
-                          new_stat == VCAL_PSTAT_DECLINED ||
-                          new_stat == VCAL_PSTAT_TENTATIVE) &&
-                         sender != NULL, NULL);
+                         new_stat == VCAL_PSTAT_DECLINED ||
+                         new_stat == VCAL_PSTAT_TENTATIVE) &&
+                        sender != NULL, NULL);
 
     /* build the part */
     retval = g_string_new("BEGIN:VCALENDAR\nVERSION:2.0\n"
-                          "PRODID:-//GNOME//Balsa " BALSA_VERSION "//EN\n"
-                          "METHOD:REPLY\nBEGIN:VEVENT\n");
+                         "PRODID:-//GNOME//Balsa " BALSA_VERSION "//EN\n"
+                         "METHOD:REPLY\nBEGIN:VEVENT\n");
     buf = time_t_to_date_time_2445(time(NULL));
     g_string_append_printf(retval, "DTSTAMP:%s\n", buf);
     g_free(buf);
     g_string_append_printf(retval, "ATTENDEE;PARTSTAT=%s:mailto:%s\n";,
-                           pstats[(int) new_stat].str_2445, sender);
-    if (event->uid) {
-        g_string_append_printf(retval, "UID:%s\n", event->uid);
-    }
+                          pstats[(int) new_stat].str_2445, sender);
+    if (event->uid)
+       g_string_append_printf(retval, "UID:%s\n", event->uid);
     if (event->organizer != NULL) {
         const gchar *addr = libbalsa_address_get_addr(event->organizer);
 
-        if (addr != NULL) {
+        if (addr != NULL)
             g_string_append_printf(retval, "ORGANIZER:mailto:%s\n";, addr);
-        }
     }
     if (event->summary) {
-        buf = text_2445_escape(event->summary);
-        g_string_append_printf(retval, "SUMMARY:%s\n", buf);
-        g_free(buf);
+       buf = text_2445_escape(event->summary);
+       g_string_append_printf(retval, "SUMMARY:%s\n", buf);
+       g_free(buf);
     }
     if (event->description) {
-        buf = text_2445_escape(event->description);
-        g_string_append_printf(retval, "DESCRIPTION:%s\n", buf);
-        g_free(buf);
+       buf = text_2445_escape(event->description);
+       g_string_append_printf(retval, "DESCRIPTION:%s\n", buf);
+       g_free(buf);
     }
-    if (event->start != (time_t) -1) {
-        buf = time_t_to_date_time_2445(event->start);
-        g_string_append_printf(retval, "DTSTART:%s\n", buf);
-        g_free(buf);
+    if (event->start != (time_t) - 1) {
+       buf = time_t_to_date_time_2445(event->start);
+       g_string_append_printf(retval, "DTSTART:%s\n", buf);
+       g_free(buf);
     }
-    if (event->end != (time_t) -1) {
-        buf = time_t_to_date_time_2445(event->end);
-        g_string_append_printf(retval, "DTEND:%s\n", buf);
-        g_free(buf);
+    if (event->end != (time_t) - 1) {
+       buf = time_t_to_date_time_2445(event->end);
+       g_string_append_printf(retval, "DTEND:%s\n", buf);
+       g_free(buf);
     }
     retval = g_string_append(retval, "END:VEVENT\nEND:VCALENDAR");
 
@@ -537,13 +517,12 @@ libbalsa_vevent_reply(const LibBalsaVEvent *event,
     p = 0;
     eol = strchr(retval->str, '\n');
     while (eol) {
-        if (eol - (retval->str + p) > 74) {
-            retval = g_string_insert(retval, p + 74, "\n ");
-            p += 76;
-        } else {
-            p = eol - retval->str + 1;
-        }
-        eol = strchr(retval->str + p, '\n');
+       if (eol - (retval->str + p) > 74) {
+           retval = g_string_insert(retval, p + 74, "\n ");
+           p += 76;
+       } else
+           p = eol - retval->str + 1;
+       eol = strchr(retval->str + p, '\n');
     }
 
     /* done */
@@ -559,19 +538,19 @@ static time_t
 date_time_2445_to_time_t(const gchar *date_time)
 {
     gint len;
-    time_t the_time = (time_t) (-1);
+    time_t the_time = (time_t) (-1);;
 
     g_return_val_if_fail(date_time != NULL, (time_t) (-1));
     len = strlen(date_time);
 
     /* must be yyyymmddThhmmssZ? */
     if (((len == 15) || ((len == 16) && (date_time[15] == 'Z'))) &&
-        (date_time[8] == 'T')) {
+       (date_time[8] == 'T')) {
         GTimeVal timeval;
 
         /* the rfc2445 date-time is a special case of an iso8901 date/time value... */
         if (g_time_val_from_iso8601(date_time, &timeval)) {
-            the_time = timeval.tv_sec;
+               the_time = timeval.tv_sec;
         }
     }
 
@@ -582,21 +561,21 @@ date_time_2445_to_time_t(const gchar *date_time)
 static gchar *
 time_t_to_date_time_2445(time_t ttime)
 {
-    gchar *retval = NULL;
-    GDateTime *date_time;
-
-    date_time = g_date_time_new_from_unix_utc(ttime);
-    if (date_time != NULL) {
-        retval = g_date_time_format(date_time, "%Y%m%dT%H%M%SZ");
-        g_date_time_unref(date_time);
-    }
-    return retval;
+       gchar *retval = NULL;
+       GDateTime *date_time;
+
+       date_time = g_date_time_new_from_unix_utc(ttime);
+       if (date_time != NULL) {
+               retval = g_date_time_format(date_time, "%Y%m%dT%H%M%SZ");
+               g_date_time_unref(date_time);
+       }
+       return retval;
 }
 
 
 /* unescape a text from rfc 2445 format to a plain string */
 static gchar *
-text_2445_unescape(const gchar *text)
+text_2445_unescape(const gchar * text)
 {
     gchar *retval;
     gchar *p;
@@ -605,11 +584,10 @@ text_2445_unescape(const gchar *text)
     retval = g_strdup(text);
     p = strchr(retval, '\\');
     while (p) {
-        if ((p[1] == 'n') || (p[1] == 'N')) {
-            p[1] = '\n';
-        }
-        memmove(p, p + 1, strlen(p + 1) + 1);
-        p = strchr(retval, '\\');
+       if (p[1] == 'n' || p[1] == 'N')
+           p[1] = '\n';
+       memmove(p, p + 1, strlen(p + 1) + 1);
+       p = strchr(retval, '\\');
     }
     return retval;
 }
@@ -617,7 +595,7 @@ text_2445_unescape(const gchar *text)
 
 /* unescape a text from rfc 2445 format to a plain string */
 static gchar *
-text_2445_escape(const gchar *text)
+text_2445_escape(const gchar * text)
 {
     GString *retval;
     static const gchar *do_escape = "\\;,\n";
@@ -626,17 +604,16 @@ text_2445_escape(const gchar *text)
     g_return_val_if_fail(text != NULL, NULL);
     retval = g_string_new(text);
     for (esc_p = do_escape; *esc_p; esc_p++) {
-        gchar *enc_p = strchr(retval->str, *esc_p);
+       gchar *enc_p = strchr(retval->str, *esc_p);
 
-        while (enc_p) {
-            gssize inspos = enc_p - retval->str;
+       while (enc_p) {
+           gssize inspos = enc_p - retval->str;
 
-            if (*enc_p == '\n') {
-                *enc_p = 'n';
-            }
-            retval = g_string_insert_c(retval, inspos, '\\');
-            enc_p = strchr(retval->str + inspos + 2, *esc_p);
-        }
+           if (*enc_p == '\n')
+               *enc_p = 'n';
+           retval = g_string_insert_c(retval, inspos, '\\');
+           enc_p = strchr(retval->str + inspos + 2, *esc_p);
+       }
     }
     return g_string_free(retval, FALSE);
 }
@@ -645,43 +622,39 @@ text_2445_escape(const gchar *text)
 /* extract a rfc 2445 mailto address and into a LibBalsaAddress and add the
  * extra information (rfc 2445 attributes) as data to the returned object. */
 static LibBalsaAddress *
-cal_address_2445_to_lbaddress(const gchar *uri,
-                              gchar      **attributes,
-                              gboolean     is_organizer)
+cal_address_2445_to_lbaddress(const gchar * uri, gchar ** attributes,
+                             gboolean is_organizer)
 {
     LibBalsaAddress *retval;
 
     /* must be a mailto: uri */
-    if (g_ascii_strncasecmp("mailto:";, uri, 7)) {
-        return NULL;
-    }
+    if (g_ascii_strncasecmp("mailto:";, uri, 7))
+       return NULL;
 
     retval = libbalsa_address_new();
     libbalsa_address_add_addr(retval, uri + 7);
-    if (!is_organizer) {
-        g_object_set_data(G_OBJECT(retval), RFC2445_ROLE,
-                          LB_ROLE2PTR(VCAL_ROLE_REQ_PART));
-    }
+    if (!is_organizer)
+       g_object_set_data(G_OBJECT(retval), RFC2445_ROLE,
+                         LB_ROLE2PTR(VCAL_ROLE_REQ_PART));
 
     if (attributes) {
-        int n;
-        gchar *the_attr;
-
-        /* scan attributes for extra information */
-        for (n = 0; (the_attr = attributes[n]); n++) {
-            if (!g_ascii_strncasecmp(the_attr, "CN=", 3)) {
-                libbalsa_address_set_full_name(retval, the_attr + 3);
-            } else if (!g_ascii_strncasecmp(the_attr, "ROLE=", 5)) {
-                g_object_set_data(G_OBJECT(retval), RFC2445_ROLE,
-                                  LB_ROLE2PTR(vcal_str_to_role(the_attr + 5)));
-            } else if (!g_ascii_strncasecmp(the_attr, "PARTSTAT=", 9)) {
-                g_object_set_data(G_OBJECT(retval), RFC2445_PARTSTAT,
-                                  LB_PSTAT2PTR(vcal_str_to_part_stat(the_attr + 9)));
-            } else if (!g_ascii_strncasecmp(the_attr, "RSVP=", 5)) {
-                g_object_set_data(G_OBJECT(retval), RFC2445_RSVP,
-                                  GINT_TO_POINTER(!g_ascii_strcasecmp(the_attr + 5, "TRUE")));
-            }
-        }
+       int n;
+       gchar *the_attr;
+
+       /* scan attributes for extra information */
+       for (n = 0; (the_attr = attributes[n]); n++) {
+           if (!g_ascii_strncasecmp(the_attr, "CN=", 3))
+               libbalsa_address_set_full_name(retval, the_attr + 3);
+           else if (!g_ascii_strncasecmp(the_attr, "ROLE=", 5))
+               g_object_set_data(G_OBJECT(retval), RFC2445_ROLE,
+                                 LB_ROLE2PTR(vcal_str_to_role(the_attr + 5)));
+           else if (!g_ascii_strncasecmp(the_attr, "PARTSTAT=", 9))
+               g_object_set_data(G_OBJECT(retval), RFC2445_PARTSTAT,
+                                 LB_PSTAT2PTR(vcal_str_to_part_stat(the_attr + 9)));
+           else if (!g_ascii_strncasecmp(the_attr, "RSVP=", 5))
+               g_object_set_data(G_OBJECT(retval), RFC2445_RSVP,
+                                 GINT_TO_POINTER(! g_ascii_strcasecmp(the_attr + 5, "TRUE")));
+       }
     }
     return retval;
 }
@@ -691,13 +664,13 @@ cal_address_2445_to_lbaddress(const gchar *uri,
 
 /* convert the passed method string into the enumeration */
 static LibBalsaVCalMethod
-vcal_str_to_method(const gchar *method)
+vcal_str_to_method(const gchar * method)
 {
     static struct {
-        gchar *meth_id;
-        LibBalsaVCalMethod meth;
+       gchar *meth_id;
+       LibBalsaVCalMethod meth;
     } meth_list[] = {
-        { "PUBLISH", ITIP_PUBLISH },
+       { "PUBLISH", ITIP_PUBLISH },
         { "REQUEST", ITIP_REQUEST },
         { "REPLY", ITIP_REPLY },
         { "CANCEL", ITIP_CANCEL },
@@ -705,13 +678,11 @@ vcal_str_to_method(const gchar *method)
     };
     gint n;
 
-    if (!method) {
+    if (!method)
         return ITIP_UNKNOWN;
-    }
     for (n = 0;
-         meth_list[n].meth_id
-         && g_ascii_strcasecmp(method, meth_list[n].meth_id); n++) {
-    }
+        meth_list[n].meth_id
+        && g_ascii_strcasecmp(method, meth_list[n].meth_id); n++);
     return meth_list[n].meth;
 }
 
@@ -722,14 +693,14 @@ libbalsa_vcal_method_to_str(LibBalsaVCalMethod method)
 {
     static gchar *methods[] = {
         N_("unknown"),
-        N_("Event Notification"),
-        N_("Event Request"),
-        N_("Reply to Event Request"),
-        N_("Event Cancellation"),
+       N_("Event Notification"),
+       N_("Event Request"),
+       N_("Reply to Event Request"),
+       N_("Event Cancellation"),
     };
 
     g_return_val_if_fail(method >= ITIP_UNKNOWN && method <= ITIP_CANCEL,
-                         NULL);
+                        NULL);
     return methods[(int) method];
 
 }
@@ -741,27 +712,27 @@ vcal_role_to_str(LibBalsaVCalRole role)
 {
     static gchar *roles[] = {
         N_("unknown"),
-        N_("chair"),
-        N_("required participant"),
-        N_("optional participant"),
-        N_("non-participant, information only")
+       N_("chair"),
+       N_("required participant"),
+       N_("optional participant"),
+       N_("non-participant, information only")
     };
 
     g_return_val_if_fail(role >= VCAL_ROLE_UNKNOWN
-                         && role <= VCAL_ROLE_NON_PART, NULL);
+                        && role <= VCAL_ROLE_NON_PART, NULL);
     return roles[(int) role];
 }
 
 
 /* convert the passed role string into the enumeration */
 static LibBalsaVCalRole
-vcal_str_to_role(const gchar *role)
+vcal_str_to_role(const gchar * role)
 {
     static struct {
-        gchar *role_id;
-        LibBalsaVCalRole role;
+       gchar *role_id;
+       LibBalsaVCalRole role;
     } role_list[] = {
-        { "CHAIR", VCAL_ROLE_CHAIR },
+       { "CHAIR", VCAL_ROLE_CHAIR },
         { "REQ-PARTICIPANT", VCAL_ROLE_REQ_PART },
         { "OPT-PARTICIPANT", VCAL_ROLE_OPT_PART },
         { "NON-PARTICIPANT", VCAL_ROLE_NON_PART },
@@ -769,13 +740,11 @@ vcal_str_to_role(const gchar *role)
     };
     gint n;
 
-    if (!role) {
+    if (!role)
         return VCAL_ROLE_UNKNOWN;
-    }
     for (n = 0;
-         role_list[n].role_id
-         && g_ascii_strcasecmp(role, role_list[n].role_id); n++) {
-    }
+        role_list[n].role_id
+        && g_ascii_strcasecmp(role, role_list[n].role_id); n++);
     return role_list[n].role;
 }
 
@@ -785,7 +754,7 @@ const gchar *
 libbalsa_vcal_part_stat_to_str(LibBalsaVCalPartStat pstat)
 {
     g_return_val_if_fail(pstat >= VCAL_PSTAT_UNKNOWN
-                         && pstat <= VCAL_PSTAT_IN_PROCESS, NULL);
+                        && pstat <= VCAL_PSTAT_IN_PROCESS, NULL);
     return pstats[(int) pstat].hr_text;
 
 }
@@ -793,13 +762,13 @@ libbalsa_vcal_part_stat_to_str(LibBalsaVCalPartStat pstat)
 
 /* convert the passed participant status string into the enumeration */
 static LibBalsaVCalPartStat
-vcal_str_to_part_stat(const gchar *pstat)
+vcal_str_to_part_stat(const gchar * pstat)
 {
     static struct {
-        gchar *pstat_id;
-        LibBalsaVCalPartStat pstat;
+       gchar *pstat_id;
+       LibBalsaVCalPartStat pstat;
     } pstat_list[] = {
-        { "NEEDS-ACTION", VCAL_PSTAT_NEEDS_ACTION },
+       { "NEEDS-ACTION", VCAL_PSTAT_NEEDS_ACTION },
         { "ACCEPTED", VCAL_PSTAT_ACCEPTED},
         { "DECLINED", VCAL_PSTAT_DECLINED },
         { "TENTATIVE", VCAL_PSTAT_TENTATIVE },
@@ -810,12 +779,10 @@ vcal_str_to_part_stat(const gchar *pstat)
     };
     gint n;
 
-    if (!pstat) {
+    if (!pstat)
         return VCAL_PSTAT_UNKNOWN;
-    }
     for (n = 0;
-         pstat_list[n].pstat_id
-         && g_ascii_strcasecmp(pstat, pstat_list[n].pstat_id); n++) {
-    }
+        pstat_list[n].pstat_id
+        && g_ascii_strcasecmp(pstat, pstat_list[n].pstat_id); n++);
     return pstat_list[n].pstat;
 }
diff --git a/libbalsa/rfc2445.h b/libbalsa/rfc2445.h
index f00d345..710c66b 100644
--- a/libbalsa/rfc2445.h
+++ b/libbalsa/rfc2445.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -32,14 +32,11 @@ G_BEGIN_DECLS
 
 /* a VCalendar object description as GObject */
 #define LIBBALSA_TYPE_VCAL            (libbalsa_vcal_get_type())
-#define LIBBALSA_VCAL(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), LIBBALSA_TYPE_VCAL, \
-                                                                  LibBalsaVCal))
-#define LIBBALSA_VCAL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), LIBBALSA_TYPE_VCAL, \
-                                                               LibBalsaVCalClass))
+#define LIBBALSA_VCAL(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), LIBBALSA_TYPE_VCAL, LibBalsaVCal))
+#define LIBBALSA_VCAL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), LIBBALSA_TYPE_VCAL, 
LibBalsaVCalClass))
 #define LIBBALSA_IS_VCAL(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), LIBBALSA_TYPE_VCAL))
 #define LIBBALSA_IS_VCAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), LIBBALSA_TYPE_VCAL))
-#define LIBBALSA_VCAL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), LIBBALSA_TYPE_VCAL, \
-                                                                 LibBalsaVCalClass))
+#define LIBBALSA_VCAL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), LIBBALSA_TYPE_VCAL, 
LibBalsaVCalClass))
 
 typedef struct _LibBalsaVCal LibBalsaVCal;
 typedef struct _LibBalsaVCalClass LibBalsaVCalClass;
@@ -47,15 +44,11 @@ typedef struct _LibBalsaVCalClass LibBalsaVCalClass;
 
 /* a VEvent object description as GObject */
 #define LIBBALSA_TYPE_VEVENT            (libbalsa_vevent_get_type())
-#define LIBBALSA_VEVENT(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), LIBBALSA_TYPE_VEVENT, \
-                                                                    LibBalsaVEvent))
-#define LIBBALSA_VEVENT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), LIBBALSA_TYPE_VEVENT, \
-                                                                 LibBalsaVEventClass))
-#define LIBBALSA_IS_VEVENT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
-                                                                    LIBBALSA_TYPE_VEVENT))
+#define LIBBALSA_VEVENT(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), LIBBALSA_TYPE_VEVENT, 
LibBalsaVEvent))
+#define LIBBALSA_VEVENT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), LIBBALSA_TYPE_VEVENT, 
LibBalsaVEventClass))
+#define LIBBALSA_IS_VEVENT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), LIBBALSA_TYPE_VEVENT))
 #define LIBBALSA_IS_VEVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), LIBBALSA_TYPE_VEVENT))
-#define LIBBALSA_VEVENT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), LIBBALSA_TYPE_VEVENT, \
-                                                                   LibBalsaVEventClass))
+#define LIBBALSA_VEVENT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), LIBBALSA_TYPE_VEVENT, 
LibBalsaVEventClass))
 
 typedef struct _LibBalsaVEvent LibBalsaVEvent;
 typedef struct _LibBalsaVEventClass LibBalsaVEventClass;
@@ -122,19 +115,19 @@ struct _LibBalsaVEventClass {
 
 GType libbalsa_vcal_get_type(void);
 LibBalsaVCal *libbalsa_vcal_new(void);
-LibBalsaVCal *libbalsa_vcal_new_from_body(LibBalsaMessageBody *body);
+LibBalsaVCal *libbalsa_vcal_new_from_body(LibBalsaMessageBody * body);
 
 GType libbalsa_vevent_get_type(void);
 LibBalsaVEvent *libbalsa_vevent_new(void);
-gchar *libbalsa_vevent_reply(const LibBalsaVEvent *event,
-                             const gchar          *sender,
-                             LibBalsaVCalPartStat  new_stat);
+gchar *libbalsa_vevent_reply(const LibBalsaVEvent * event,
+                            const gchar * sender,
+                            LibBalsaVCalPartStat new_stat);
 
-gchar *libbalsa_vcal_attendee_to_str(LibBalsaAddress *person);
-gboolean libbalsa_vcal_attendee_rsvp(LibBalsaAddress *person);
+gchar *libbalsa_vcal_attendee_to_str(LibBalsaAddress * person);
+gboolean libbalsa_vcal_attendee_rsvp(LibBalsaAddress * person);
 const gchar *libbalsa_vcal_method_to_str(LibBalsaVCalMethod method);
 const gchar *libbalsa_vcal_part_stat_to_str(LibBalsaVCalPartStat pstat);
 
 G_END_DECLS
 
-#endif                          /* __RFC2445_H__ */
+#endif                         /* __RFC2445_H__ */
diff --git a/libbalsa/rfc3156.c b/libbalsa/rfc3156.c
index 29aee7a..b84cecb 100644
--- a/libbalsa/rfc3156.c
+++ b/libbalsa/rfc3156.c
@@ -5,75 +5,74 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "rfc3156.h"
 
 #ifdef HAVE_GPGME
 
-#   include <string.h>
-#   include <gpgme.h>
+#include <string.h>
+#include <gpgme.h>
 
-#   include "libbalsa.h"
-#   include "libbalsa_private.h"
-#   include "libbalsa-gpgme-widgets.h"
-#   include "libbalsa-gpgme-keys.h"
-#   include "libbalsa-gpgme.h"
+#include "libbalsa.h"
+#include "libbalsa_private.h"
+#include "libbalsa-gpgme-widgets.h"
+#include "libbalsa-gpgme-keys.h"
+#include "libbalsa-gpgme.h"
 
-#   include "gmime-multipart-crypt.h"
-#   include "gmime-gpgme-signature.h"
-#   include "gmime-part-rfc2440.h"
+#include "gmime-multipart-crypt.h"
+#include "gmime-gpgme-signature.h"
+#include "gmime-part-rfc2440.h"
 
-#   include "gmime-application-pkcs7.h"
+#include "gmime-application-pkcs7.h"
 
-#   if HAVE_MACOSX_DESKTOP
-#      include "macosx-helpers.h"
-#   endif
+#if HAVE_MACOSX_DESKTOP
+#  include "macosx-helpers.h"
+#endif
 
-#   include <glib/gi18n.h>
+#include <glib/gi18n.h>
 
 
-#   ifdef G_LOG_DOMAIN
-#      undef G_LOG_DOMAIN
-#   endif
-#   define G_LOG_DOMAIN "crypto"
+#ifdef G_LOG_DOMAIN
+#  undef G_LOG_DOMAIN
+#endif
+#define G_LOG_DOMAIN "crypto"
 
 
 /* local prototypes */
 static gboolean gpg_updates_trustdb(void);
-static gboolean have_pub_key_for(gpgme_ctx_t          gpgme_ctx,
-                                 InternetAddressList *recipients);
+static gboolean have_pub_key_for(gpgme_ctx_t gpgme_ctx,
+                                InternetAddressList * recipients);
 
 
 /* ==== public functions =================================================== */
 static gboolean
-body_is_type(LibBalsaMessageBody *body,
-             const gchar         *type,
-             const gchar         *sub_type)
+body_is_type(LibBalsaMessageBody * body, const gchar * type,
+            const gchar * sub_type)
 {
     gboolean retval;
 
     if (body->mime_part) {
-        GMimeContentType *content_type =
-            g_mime_object_get_content_type(body->mime_part);
-        retval = g_mime_content_type_is_type(content_type, type, sub_type);
+       GMimeContentType *content_type =
+           g_mime_object_get_content_type(body->mime_part);
+       retval = g_mime_content_type_is_type(content_type, type, sub_type);
     } else {
-        GMimeContentType *content_type =
-            g_mime_content_type_new_from_string(body->content_type);
-        retval = g_mime_content_type_is_type(content_type, type, sub_type);
-        g_object_unref(content_type);
+       GMimeContentType *content_type =
+           g_mime_content_type_new_from_string(body->content_type);
+       retval = g_mime_content_type_is_type(content_type, type, sub_type);
+       g_object_unref(content_type);
     }
 
     return retval;
@@ -83,30 +82,28 @@ body_is_type(LibBalsaMessageBody *body,
 /* return TRUE if we can encrypt for every recipient in the recipients list
  * using protocol */
 gboolean
-libbalsa_can_encrypt_for_all(InternetAddressList *recipients,
-                             gpgme_protocol_t     protocol)
+libbalsa_can_encrypt_for_all(InternetAddressList * recipients,
+                            gpgme_protocol_t protocol)
 {
     gpgme_ctx_t gpgme_ctx;
     gboolean result;
 
     /* silent paranoia checks */
-    if (!recipients) {
-        return TRUE;  /* we can of course encrypt for nobody... */
+    if (!recipients)
+       return TRUE;  /* we can of course encrypt for nobody... */
 
-    }
     /* check if gpg is currently available */
-    if ((protocol == GPGME_PROTOCOL_OpenPGP) && gpg_updates_trustdb()) {
-        return FALSE;
-    }
+    if (protocol == GPGME_PROTOCOL_OpenPGP && gpg_updates_trustdb())
+       return FALSE;
 
     /* create the gpgme context and set the protocol */
     gpgme_ctx = libbalsa_gpgme_new_with_proto(protocol, NULL, NULL, NULL);
     if (gpgme_ctx == NULL) {
-        result = FALSE;
+       result = FALSE;
     } else {
-        /* loop over all recipients and try to find valid keys */
-        result = have_pub_key_for(gpgme_ctx, recipients);
-        gpgme_release(gpgme_ctx);
+       /* loop over all recipients and try to find valid keys */
+       result = have_pub_key_for(gpgme_ctx, recipients);
+       gpgme_release(gpgme_ctx);
     }
 
     return result;
@@ -118,7 +115,7 @@ libbalsa_can_encrypt_for_all(InternetAddressList *recipients,
  * or encrypted.
  */
 gint
-libbalsa_message_body_protection(LibBalsaMessageBody *body)
+libbalsa_message_body_protection(LibBalsaMessageBody * body)
 {
     gint result = 0;
 
@@ -126,68 +123,63 @@ libbalsa_message_body_protection(LibBalsaMessageBody *body)
     g_return_val_if_fail(body->content_type != NULL, 0);
 
     if (body_is_type(body, "multipart", "signed")) {
-        gchar *protocol =
-            libbalsa_message_body_get_parameter(body, "protocol");
-        gchar *micalg =
-            libbalsa_message_body_get_parameter(body, "micalg");
-
-        result = LIBBALSA_PROTECT_SIGN;
-        if (protocol && body->parts && body->parts->next) {
-            if ((!g_ascii_strcasecmp("application/pkcs7-signature",
-                                     protocol)
-                 && body_is_type(body->parts->next, "application",
-                                 "pkcs7-signature")) ||
-                (!g_ascii_strcasecmp("application/x-pkcs7-signature",
-                                     protocol)
-                 && body_is_type(body->parts->next, "application",
-                                 "x-pkcs7-signature"))) {
-                result |= LIBBALSA_PROTECT_SMIMEV3;
-                if (!micalg) {
-                    result |= LIBBALSA_PROTECT_ERROR;
-                }
-            } else if (!g_ascii_strcasecmp
-                           ("application/pgp-signature", protocol)
-                       && body_is_type(body->parts->next, "application",
-                                       "pgp-signature")) {
-                result |= LIBBALSA_PROTECT_RFC3156;
-                if (!micalg || g_ascii_strncasecmp("pgp-", micalg, 4)) {
-                    result |= LIBBALSA_PROTECT_ERROR;
-                }
-            } else {
-                result |= LIBBALSA_PROTECT_ERROR;
-            }
-        } else {
-            result |= LIBBALSA_PROTECT_ERROR;
-        }
-        g_free(micalg);
-        g_free(protocol);
+       gchar *protocol =
+           libbalsa_message_body_get_parameter(body, "protocol");
+       gchar *micalg =
+           libbalsa_message_body_get_parameter(body, "micalg");
+
+       result = LIBBALSA_PROTECT_SIGN;
+       if (protocol && body->parts && body->parts->next) {
+           if ((!g_ascii_strcasecmp("application/pkcs7-signature",
+                                    protocol)
+                && body_is_type(body->parts->next, "application", 
+                                "pkcs7-signature")) ||
+               (!g_ascii_strcasecmp("application/x-pkcs7-signature",
+                                    protocol)
+                && body_is_type(body->parts->next, "application",
+                                "x-pkcs7-signature"))) {
+               result |= LIBBALSA_PROTECT_SMIMEV3;
+               if (!micalg)
+                   result |= LIBBALSA_PROTECT_ERROR;
+           } else
+               if (!g_ascii_strcasecmp
+                   ("application/pgp-signature", protocol)
+                   && body_is_type(body->parts->next, "application",
+                                   "pgp-signature")) {
+               result |= LIBBALSA_PROTECT_RFC3156;
+               if (!micalg || g_ascii_strncasecmp("pgp-", micalg, 4))
+                   result |= LIBBALSA_PROTECT_ERROR;
+           } else
+               result |= LIBBALSA_PROTECT_ERROR;
+       } else
+           result |= LIBBALSA_PROTECT_ERROR;
+       g_free(micalg);
+       g_free(protocol);
     } else if (body_is_type(body, "multipart", "encrypted")) {
-        gchar *protocol =
-            libbalsa_message_body_get_parameter(body, "protocol");
-
-        result = LIBBALSA_PROTECT_ENCRYPT | LIBBALSA_PROTECT_RFC3156;
-        if (!protocol ||
-            g_ascii_strcasecmp("application/pgp-encrypted", protocol) ||
-            !body->parts || !body->parts->next ||
-            !body_is_type(body->parts, "application", "pgp-encrypted") ||
-            !body_is_type(body->parts->next, "application",
-                          "octet-stream")) {
-            result |= LIBBALSA_PROTECT_ERROR;
-        }
-        g_free(protocol);
+       gchar *protocol =
+           libbalsa_message_body_get_parameter(body, "protocol");
+
+       result = LIBBALSA_PROTECT_ENCRYPT | LIBBALSA_PROTECT_RFC3156;
+       if (!protocol ||
+           g_ascii_strcasecmp("application/pgp-encrypted", protocol) ||
+           !body->parts || !body->parts->next ||
+           !body_is_type(body->parts, "application", "pgp-encrypted") ||
+           !body_is_type(body->parts->next, "application",
+                         "octet-stream"))
+           result |= LIBBALSA_PROTECT_ERROR;
+       g_free(protocol);
     } else if (body_is_type(body, "application", "pkcs7-mime") ||
-               body_is_type(body, "application", "x-pkcs7-mime")) {
-        gchar *smime_type =
-            libbalsa_message_body_get_parameter(body, "smime-type");
-
-        result = LIBBALSA_PROTECT_SMIMEV3;
-        if (!g_ascii_strcasecmp("enveloped-data", smime_type) ||
-            !g_ascii_strcasecmp("signed-data", smime_type)) {
-            result |= LIBBALSA_PROTECT_ENCRYPT;
-        } else {
-            result |= LIBBALSA_PROTECT_ERROR;
-        }
-        g_free(smime_type);
+           body_is_type(body, "application", "x-pkcs7-mime")) {
+       gchar *smime_type =
+           libbalsa_message_body_get_parameter(body, "smime-type");
+
+       result = LIBBALSA_PROTECT_SMIMEV3;
+       if (!g_ascii_strcasecmp("enveloped-data", smime_type) ||
+           !g_ascii_strcasecmp("signed-data", smime_type))
+           result |= LIBBALSA_PROTECT_ENCRYPT;
+       else
+           result |= LIBBALSA_PROTECT_ERROR;
+       g_free(smime_type);
     }
 
     return result;
@@ -204,11 +196,9 @@ libbalsa_message_body_protection(LibBalsaMessageBody *body)
  * doesn't contain a cleartext also readable for MUA's without S/MIME support.
  */
 gboolean
-libbalsa_sign_mime_object(GMimeObject    **content,
-                          const gchar     *rfc822_for,
-                          gpgme_protocol_t protocol,
-                          GtkWindow       *parent,
-                          GError         **error)
+libbalsa_sign_mime_object(GMimeObject ** content, const gchar * rfc822_for,
+                         gpgme_protocol_t protocol, GtkWindow * parent,
+                         GError ** error)
 {
     GMimeMultipartSigned *mps;
 
@@ -217,18 +207,17 @@ libbalsa_sign_mime_object(GMimeObject    **content,
     g_return_val_if_fail(content != NULL, FALSE);
 
     /* check if gpg is currently available */
-    if ((protocol == GPGME_PROTOCOL_OpenPGP) && gpg_updates_trustdb()) {
-        return FALSE;
-    }
+    if (protocol == GPGME_PROTOCOL_OpenPGP && gpg_updates_trustdb())
+       return FALSE;
 
     /* call gpgme to create the signature */
     if (!(mps = g_mime_multipart_signed_new())) {
-        return FALSE;
+       return FALSE;
     }
 
     if (!g_mime_gpgme_mps_sign(mps, *content, rfc822_for, protocol, parent, error)) {
-        g_object_unref(mps);
-        return FALSE;
+       g_object_unref(mps);
+       return FALSE;
     }
 
     g_object_unref(G_OBJECT(*content));
@@ -243,12 +232,9 @@ libbalsa_sign_mime_object(GMimeObject    **content,
  * MIME object.
  */
 gboolean
-libbalsa_encrypt_mime_object(GMimeObject    **content,
-                             GList           *rfc822_for,
-                             gpgme_protocol_t protocol,
-                             gboolean         always_trust,
-                             GtkWindow       *parent,
-                             GError         **error)
+libbalsa_encrypt_mime_object(GMimeObject ** content, GList * rfc822_for,
+                            gpgme_protocol_t protocol, gboolean always_trust,
+                            GtkWindow * parent, GError ** error)
 {
     GMimeObject *encrypted_obj = NULL;
     GPtrArray *recipients;
@@ -259,44 +245,37 @@ libbalsa_encrypt_mime_object(GMimeObject    **content,
     g_return_val_if_fail(content != NULL, FALSE);
 
     /* check if gpg is currently available */
-    if ((protocol == GPGME_PROTOCOL_OpenPGP) && gpg_updates_trustdb()) {
-        return FALSE;
-    }
+    if (protocol == GPGME_PROTOCOL_OpenPGP && gpg_updates_trustdb())
+       return FALSE;
 
     /* convert the key list to a GPtrArray */
     recipients = g_ptr_array_new();
     while (rfc822_for) {
-        g_ptr_array_add(recipients, rfc822_for->data);
-        rfc822_for = rfc822_for->next;
+       g_ptr_array_add(recipients, rfc822_for->data);
+       rfc822_for = rfc822_for->next;
     }
 
     /* encrypt: multipart/encrypted for RFC 3156, application/pkcs7-mime for
        RFC 2633 */
     if (protocol == GPGME_PROTOCOL_OpenPGP) {
-        GMimeMultipartEncrypted *mpe = g_mime_multipart_encrypted_new();
+       GMimeMultipartEncrypted *mpe = g_mime_multipart_encrypted_new();
 
-        encrypted_obj = GMIME_OBJECT(mpe);
-        result =
-            g_mime_gpgme_mpe_encrypt(mpe, *content, recipients, always_trust, parent, error);
+       encrypted_obj = GMIME_OBJECT(mpe);
+       result = g_mime_gpgme_mpe_encrypt(mpe, *content, recipients, always_trust, parent, error);
     } else {
-        GMimePart *pkcs7 = g_mime_part_new_with_type("application", "pkcs7-mime");
-        encrypted_obj = GMIME_OBJECT(pkcs7);
-
-        result = g_mime_application_pkcs7_encrypt(pkcs7,
-                                                  *content,
-                                                  recipients,
-                                                  always_trust,
-                                                  parent,
-                                                  error);
+       GMimePart *pkcs7 = g_mime_part_new_with_type("application", "pkcs7-mime");
+       encrypted_obj = GMIME_OBJECT(pkcs7);
+
+       result = g_mime_application_pkcs7_encrypt(pkcs7, *content, recipients, always_trust, parent, error);
     }
     g_ptr_array_unref(recipients);
 
     /* error checking */
     if (!result) {
-        g_object_unref(encrypted_obj);
+       g_object_unref(encrypted_obj);
     } else {
-        g_object_unref(G_OBJECT(*content));
-        *content = GMIME_OBJECT(encrypted_obj);
+    g_object_unref(G_OBJECT(*content));
+    *content = GMIME_OBJECT(encrypted_obj);
     }
     return result;
 }
@@ -309,13 +288,13 @@ libbalsa_encrypt_mime_object(GMimeObject    **content,
  * MIME object).
  */
 gboolean
-libbalsa_sign_encrypt_mime_object(GMimeObject    **content,
-                                  const gchar     *rfc822_signer,
-                                  GList           *rfc822_for,
-                                  gpgme_protocol_t protocol,
-                                  gboolean         always_trust,
-                                  GtkWindow       *parent,
-                                  GError         **error)
+libbalsa_sign_encrypt_mime_object(GMimeObject ** content,
+                                 const gchar * rfc822_signer,
+                                 GList * rfc822_for,
+                                 gpgme_protocol_t protocol,
+                                 gboolean always_trust,
+                                 GtkWindow * parent,
+                                 GError ** error)
 {
     GMimeObject *signed_object;
 
@@ -325,23 +304,21 @@ libbalsa_sign_encrypt_mime_object(GMimeObject    **content,
     g_return_val_if_fail(content != NULL, FALSE);
 
     /* check if gpg is currently available */
-    if ((protocol == GPGME_PROTOCOL_OpenPGP) && gpg_updates_trustdb()) {
-        return FALSE;
-    }
+    if (protocol == GPGME_PROTOCOL_OpenPGP && gpg_updates_trustdb())
+       return FALSE;
 
     /* we want to be able to restore */
     signed_object = *content;
     g_object_ref(G_OBJECT(signed_object));
 
     if (!libbalsa_sign_mime_object(&signed_object, rfc822_signer, protocol,
-                                   parent, error)) {
-        return FALSE;
-    }
+                                  parent, error))
+       return FALSE;
 
     if (!libbalsa_encrypt_mime_object(&signed_object, rfc822_for, protocol,
-                                      always_trust, parent, error)) {
-        g_object_unref(G_OBJECT(signed_object));
-        return FALSE;
+                                     always_trust, parent, error)) {
+       g_object_unref(G_OBJECT(signed_object));
+       return FALSE;
     }
     g_object_unref(G_OBJECT(*content));
     *content = signed_object;
@@ -360,8 +337,8 @@ libbalsa_sign_encrypt_mime_object(GMimeObject    **content,
  * passed through LibBalsaBody::sig_info.
  */
 gboolean
-libbalsa_body_check_signature(LibBalsaMessageBody *body,
-                              gpgme_protocol_t     protocol)
+libbalsa_body_check_signature(LibBalsaMessageBody * body,
+                             gpgme_protocol_t protocol)
 {
     GError *error = NULL;
     GMimeGpgmeSigstat *result;
@@ -372,33 +349,29 @@ libbalsa_body_check_signature(LibBalsaMessageBody *body,
     g_return_val_if_fail(body->message, FALSE);
 
     /* check if gpg is currently available */
-    if ((protocol == GPGME_PROTOCOL_OpenPGP) && gpg_updates_trustdb()) {
-        return FALSE;
-    }
+    if (protocol == GPGME_PROTOCOL_OpenPGP && gpg_updates_trustdb())
+       return FALSE;
 
     /* check if the body is really a multipart/signed */
     if (!GMIME_IS_MULTIPART_SIGNED(body->mime_part)
         || (g_mime_multipart_get_count
-                (GMIME_MULTIPART(body->mime_part)) < 2)) {
+            (GMIME_MULTIPART(body->mime_part)) < 2))
         return FALSE;
-    }
-    if (body->parts->next->sig_info) {
-        g_object_unref(G_OBJECT(body->parts->next->sig_info));
-    }
+    if (body->parts->next->sig_info)
+       g_object_unref(G_OBJECT(body->parts->next->sig_info));
 
     /* verify the signature */
     libbalsa_mailbox_lock_store(body->message->mailbox);
     result = g_mime_gpgme_mps_verify(GMIME_MULTIPART_SIGNED(body->mime_part), &error);
     if (!result) {
-        if (error) {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR, "%s: %s",
-                                 _("signature verification failed"),
-                                 error->message);
-            g_error_free(error);
-        } else {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _("signature verification failed"));
-        }
+       if (error) {
+           libbalsa_information(LIBBALSA_INFORMATION_ERROR, "%s: %s",
+                                _("signature verification failed"),
+                                error->message);
+           g_error_free(error);
+       } else
+           libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                                _("signature verification failed"));
     }
 
     body->parts->next->sig_info = result;
@@ -413,9 +386,7 @@ libbalsa_body_check_signature(LibBalsaMessageBody *body,
  * decrypted bodies. Otherwise, the original body is returned.
  */
 LibBalsaMessageBody *
-libbalsa_body_decrypt(LibBalsaMessageBody *body,
-                      gpgme_protocol_t     protocol,
-                      GtkWindow           *parent)
+libbalsa_body_decrypt(LibBalsaMessageBody *body, gpgme_protocol_t protocol, GtkWindow *parent)
 {
     GMimeObject *mime_obj = NULL;
     GError *error = NULL;
@@ -429,56 +400,50 @@ libbalsa_body_decrypt(LibBalsaMessageBody *body,
     g_return_val_if_fail(body->message != NULL, body);
 
     /* check if gpg is currently available */
-    if ((protocol == GPGME_PROTOCOL_OpenPGP) && gpg_updates_trustdb()) {
-        return body;
-    }
+    if (protocol == GPGME_PROTOCOL_OpenPGP && gpg_updates_trustdb())
+       return body;
 
     /* sanity checks... */
     if (protocol == GPGME_PROTOCOL_OpenPGP) {
-        if (!GMIME_IS_MULTIPART_ENCRYPTED(body->mime_part)) {
-            return body;
-        }
+       if (!GMIME_IS_MULTIPART_ENCRYPTED(body->mime_part))
+           return body;
     } else {
-        const char *smime_type =
-            g_mime_object_get_content_type_parameter(body->mime_part,
-                                                     "smime-type");
-
-        if (!smime_type || !GMIME_IS_PART(body->mime_part)) {
-            return body;
-        }
-        if (!g_ascii_strcasecmp(smime_type, "enveloped-data")) {
-            smime_encrypted = TRUE;
-        } else {
-            smime_encrypted = body->was_encrypted;
-        }
+       const char * smime_type =
+               g_mime_object_get_content_type_parameter(body->mime_part,
+                       "smime-type");
+
+       if (!smime_type || !GMIME_IS_PART(body->mime_part))
+               return body;
+       if (!g_ascii_strcasecmp(smime_type, "enveloped-data"))
+               smime_encrypted = TRUE;
+       else
+               smime_encrypted = body->was_encrypted;
     }
 
     libbalsa_mailbox_lock_store(body->message->mailbox);
     if (protocol == GPGME_PROTOCOL_OpenPGP) {
-        mime_obj =
-            g_mime_gpgme_mpe_decrypt(GMIME_MULTIPART_ENCRYPTED(body->mime_part),
-                                     &sig_state, parent, &error);
+       mime_obj =
+               g_mime_gpgme_mpe_decrypt(GMIME_MULTIPART_ENCRYPTED(body->mime_part),
+                       &sig_state, parent, &error);
     } else {
-        mime_obj =
-            g_mime_application_pkcs7_decrypt_verify(GMIME_PART(body->mime_part),
-                                                    &sig_state, parent, &error);
+       mime_obj =
+               g_mime_application_pkcs7_decrypt_verify(GMIME_PART(body->mime_part),
+                       &sig_state, parent, &error);
     }
     libbalsa_mailbox_unlock_store(body->message->mailbox);
 
     /* check the result */
     if (mime_obj == NULL) {
-        if (error) {
-            if (error->code != GPG_ERR_CANCELED) {
-                libbalsa_information(LIBBALSA_INFORMATION_ERROR, "%s: %s",
-                                     _("decryption failed"),
-                                     error->message);
-            }
-            g_error_free(error);
-        } else {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _("decryption failed"));
-        }
-        return body;
+       if (error) {
+           if (error->code != GPG_ERR_CANCELED)
+               libbalsa_information(LIBBALSA_INFORMATION_ERROR, "%s: %s",
+                                    _("decryption failed"),
+                                    error->message);
+           g_error_free(error);
+       } else
+           libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                                _("decryption failed"));
+       return body;
     }
     message = body->message;
     libbalsa_message_body_free(body);
@@ -486,35 +451,31 @@ libbalsa_body_decrypt(LibBalsaMessageBody *body,
 
     /* remember that is was encrypted */
     if (protocol == GPGME_PROTOCOL_OpenPGP) {
-        body->was_encrypted = TRUE;
+       body->was_encrypted = TRUE;
     } else {
-        body->was_encrypted = smime_encrypted;
+       body->was_encrypted = smime_encrypted;
     }
-    if (body->was_encrypted) {
+    if (body->was_encrypted)
         body->message->prot_state = LIBBALSA_MSG_PROTECT_CRYPT;
-    }
 
     libbalsa_message_body_set_mime_body(body, mime_obj);
     if (sig_state) {
-        if (sig_state->status != GPG_ERR_NOT_SIGNED) {
-            body->sig_info = sig_state;
-        } else {
-            g_object_unref(G_OBJECT(sig_state));
-        }
+       if (sig_state->status != GPG_ERR_NOT_SIGNED)
+           body->sig_info = sig_state;
+       else
+           g_object_unref(G_OBJECT(sig_state));
     }
 
     return body;
 }
 
 
+
 /* routines dealing with RFC2440 */
 gboolean
-libbalsa_rfc2440_sign_encrypt(GMimePart   *part,
-                              const gchar *sign_for,
-                              GList       *encrypt_for,
-                              gboolean     always_trust,
-                              GtkWindow   *parent,
-                              GError     **error)
+libbalsa_rfc2440_sign_encrypt(GMimePart *part, const gchar *sign_for,
+                             GList *encrypt_for, gboolean always_trust,
+                             GtkWindow *parent, GError **error)
 {
     GPtrArray *recipients;
     gboolean result;
@@ -524,28 +485,25 @@ libbalsa_rfc2440_sign_encrypt(GMimePart   *part,
     g_return_val_if_fail(sign_for != NULL || encrypt_for != NULL, FALSE);
 
     /* check if gpg is currently available */
-    if (gpg_updates_trustdb()) {
-        return FALSE;
-    }
+    if (gpg_updates_trustdb())
+       return FALSE;
 
     /* convert the key list to a GPtrArray */
     if (encrypt_for) {
-        recipients = g_ptr_array_new();
-        while (encrypt_for) {
-            g_ptr_array_add(recipients, encrypt_for->data);
-            encrypt_for = encrypt_for->next;
-        }
-    } else {
-        recipients = NULL;
-    }
+       recipients = g_ptr_array_new();
+       while (encrypt_for) {
+           g_ptr_array_add(recipients, encrypt_for->data);
+           encrypt_for = encrypt_for->next;
+       }
+    } else
+       recipients = NULL;
 
     /* sign and/or encrypt */
     result = g_mime_part_rfc2440_sign_encrypt(part, sign_for, recipients,
-                                              always_trust, parent, error);
+                                             always_trust, parent, error);
     /* clean up */
-    if (recipients) {
-        g_ptr_array_unref(recipients);
-    }
+    if (recipients)
+       g_ptr_array_unref(recipients);
     return result;
 }
 
@@ -555,8 +513,7 @@ libbalsa_rfc2440_sign_encrypt(GMimePart   *part,
  * sig_info is not NULL, return the signature info object there.
  */
 gpgme_error_t
-libbalsa_rfc2440_verify(GMimePart          *part,
-                        GMimeGpgmeSigstat **sig_info)
+libbalsa_rfc2440_verify(GMimePart * part, GMimeGpgmeSigstat ** sig_info)
 {
     GMimeGpgmeSigstat *result;
     GError *error = NULL;
@@ -566,27 +523,25 @@ libbalsa_rfc2440_verify(GMimePart          *part,
     g_return_val_if_fail(part != NULL, FALSE);
 
     /* check if gpg is currently available */
-    if (gpg_updates_trustdb()) {
-        return GPG_ERR_TRY_AGAIN;
-    }
+    if (gpg_updates_trustdb())
+       return GPG_ERR_TRY_AGAIN;
 
     /* verify */
     result = g_mime_part_rfc2440_verify(part, &error);
     if (!result) {
-        if (error) {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR, "%s: %s",
-                                 _("signature verification failed"),
-                                 error->message);
-            retval = error->code;
-            g_error_free(error);
-        } else {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _("signature verification failed"));
-            retval = GPG_ERR_GENERAL;
-        }
-    } else {
-        retval = result->status;
-    }
+       if (error) {
+           libbalsa_information(LIBBALSA_INFORMATION_ERROR, "%s: %s",
+                                _("signature verification failed"),
+                                error->message);
+           retval = error->code;
+           g_error_free(error);
+       } else {
+           libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                                _("signature verification failed"));
+           retval = GPG_ERR_GENERAL;
+       }
+    } else
+       retval = result->status;
 
     /* return the signature info if requested */
     if (sig_info != NULL) {
@@ -606,9 +561,8 @@ libbalsa_rfc2440_verify(GMimePart          *part,
  * signature info object there.
  */
 gpgme_error_t
-libbalsa_rfc2440_decrypt(GMimePart          *part,
-                         GMimeGpgmeSigstat **sig_info,
-                         GtkWindow          *parent)
+libbalsa_rfc2440_decrypt(GMimePart * part, GMimeGpgmeSigstat ** sig_info,
+                        GtkWindow * parent)
 {
     GError *error = NULL;
     GMimeGpgmeSigstat *result;
@@ -623,40 +577,36 @@ libbalsa_rfc2440_decrypt(GMimePart          *part,
     }
 
     /* check if gpg is currently available */
-    if (gpg_updates_trustdb()) {
-        return GPG_ERR_TRY_AGAIN;
-    }
+    if (gpg_updates_trustdb())
+       return GPG_ERR_TRY_AGAIN;
 
     /* decrypt */
     result = g_mime_part_rfc2440_decrypt(part, parent, &error);
     if (result == NULL) {
-        if (error) {
-            if (error->code != GPG_ERR_CANCELED) {
-                libbalsa_information(LIBBALSA_INFORMATION_ERROR, "%s: %s",
-                                     _("decryption and signature verification failed"),
-                                     error->message);
-            }
-            retval = error->code;
-            g_error_free(error);
-        } else {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _
-                                     ("decryption and signature verification failed"));
-            retval = GPG_ERR_GENERAL;
-        }
+       if (error) {
+           if (error->code != GPG_ERR_CANCELED)
+               libbalsa_information(LIBBALSA_INFORMATION_ERROR, "%s: %s",
+                                    _("decryption and signature verification failed"),
+                                    error->message);
+           retval = error->code;
+           g_error_free(error);
+       } else {
+           libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                                _
+                                ("decryption and signature verification failed"));
+           retval = GPG_ERR_GENERAL;
+       }
     } else {
-        if (result->status == GPG_ERR_NOT_SIGNED) {
-            retval = GPG_ERR_NO_ERROR;
-        } else {
-            retval = result->status;
-        }
-
-        /* return the signature info if requested */
-        if (sig_info && (result->status != GPG_ERR_NOT_SIGNED)) {
-            *sig_info = result;
-        } else {
-            g_object_unref(G_OBJECT(result));
-        }
+       if (result->status == GPG_ERR_NOT_SIGNED)
+           retval = GPG_ERR_NO_ERROR;
+       else
+           retval = result->status;
+
+       /* return the signature info if requested */
+       if (sig_info && result->status != GPG_ERR_NOT_SIGNED)
+           *sig_info = result;
+       else
+           g_object_unref(G_OBJECT(result));
     }
 
     return retval;
@@ -669,46 +619,35 @@ libbalsa_gpgme_sig_stat_to_gchar(gpgme_error_t stat)
 {
     switch (stat) {
     case GPG_ERR_NO_ERROR:
-        return _("The signature is valid.");
-
+       return _("The signature is valid.");
     case GPG_ERR_SIG_EXPIRED:
-        return _("The signature is valid but expired.");
-
+       return _("The signature is valid but expired.");
     case GPG_ERR_KEY_EXPIRED:
-        return _
-               (
-            "The signature is valid but the key used to verify the signature has expired.");
-
+       return _
+           ("The signature is valid but the key used to verify the signature has expired.");
     case GPG_ERR_CERT_REVOKED:
-        return _
-               (
-            "The signature is valid but the key used to verify the signature has been revoked.");
-
+       return _
+           ("The signature is valid but the key used to verify the signature has been revoked.");
     case GPG_ERR_BAD_SIGNATURE:
-        return _
-                   ("The signature is invalid.");
-
+       return _
+           ("The signature is invalid.");
     case GPG_ERR_NO_PUBKEY:
-        return
-            _("The signature could not be verified due to a missing key.");
-
+       return
+           _("The signature could not be verified due to a missing key.");
     case GPG_ERR_NO_DATA:
-        return _("This part is not a real PGP signature.");
-
+       return _("This part is not a real PGP signature.");
     case GPG_ERR_INV_ENGINE:
-        return _
-                   ("The signature could not be verified due to an invalid crypto engine.");
-
+       return _
+           ("The signature could not be verified due to an invalid crypto engine.");
     case GPG_ERR_TRY_AGAIN:
-        return _
-                   ("GnuPG is rebuilding the trust database and is currently unavailable.");
-
+       return _
+           ("GnuPG is rebuilding the trust database and is currently unavailable.");
     default: {
-        gchar errbuf[4096];             /* should be large enough... */
+       gchar errbuf[4096];             /* should be large enough... */
 
-        gpgme_strerror_r(stat, errbuf, sizeof(errbuf));
-        g_debug("%s: stat %d: %s %s", __func__, stat, gpgme_strsource(stat), errbuf);
-        return _("An error prevented the signature verification.");
+       gpgme_strerror_r(stat, errbuf, sizeof(errbuf));
+       g_debug("%s: stat %d: %s %s", __func__, stat, gpgme_strsource(stat), errbuf);
+       return _("An error prevented the signature verification.");
     }
     }
 }
@@ -719,25 +658,19 @@ libbalsa_gpgme_validity_to_gchar(gpgme_validity_t validity)
 {
     switch (validity) {
     case GPGME_VALIDITY_UNKNOWN:
-        return _("The user ID is of unknown validity.");
-
+       return _("The user ID is of unknown validity.");
     case GPGME_VALIDITY_UNDEFINED:
-        return _("The validity of the user ID is undefined.");
-
+       return _("The validity of the user ID is undefined.");
     case GPGME_VALIDITY_NEVER:
-        return _("The user ID is never valid.");
-
+       return _("The user ID is never valid.");
     case GPGME_VALIDITY_MARGINAL:
-        return _("The user ID is marginally valid.");
-
+       return _("The user ID is marginally valid.");
     case GPGME_VALIDITY_FULL:
-        return _("The user ID is fully valid.");
-
+       return _("The user ID is fully valid.");
     case GPGME_VALIDITY_ULTIMATE:
-        return _("The user ID is ultimately valid.");
-
+       return _("The user ID is ultimately valid.");
     default:
-        return _("bad validity");
+       return _("bad validity");
     }
 }
 
@@ -747,25 +680,19 @@ libbalsa_gpgme_validity_to_gchar_short(gpgme_validity_t validity)
 {
     switch (validity) {
     case GPGME_VALIDITY_UNKNOWN:
-        return _("unknown");
-
+       return _("unknown");
     case GPGME_VALIDITY_UNDEFINED:
-        return _("undefined");
-
+       return _("undefined");
     case GPGME_VALIDITY_NEVER:
-        return _("never");
-
+       return _("never");
     case GPGME_VALIDITY_MARGINAL:
-        return _("marginal");
-
+       return _("marginal");
     case GPGME_VALIDITY_FULL:
-        return _("full");
-
+       return _("full");
     case GPGME_VALIDITY_ULTIMATE:
-        return _("ultimate");
-
+       return _("ultimate");
     default:
-        return _("bad validity");
+       return _("bad validity");
     }
 }
 
@@ -780,60 +707,57 @@ libbalsa_gpgme_validity_to_gchar_short(gpgme_validity_t validity)
 static gboolean
 gpg_updates_trustdb(void)
 {
-    static gchar *lockname = NULL;
-    gboolean result;
-
-    if (lockname == NULL) {
-        lockname = g_build_filename(g_get_home_dir(), ".gnupg", "trustdb.gpg.lock", NULL);
-    }
-
-    if (g_file_test(lockname, G_FILE_TEST_EXISTS)) {
-        libbalsa_information(LIBBALSA_INFORMATION_ERROR, "%s %s",
-                             _(
-                                 "GnuPG is rebuilding the trust database and is currently unavailable."),
-                             _("Try again later."));
-        result = TRUE;
-    } else {
-        result = FALSE;
-    }
-    return result;
+       static gchar *lockname = NULL;
+       gboolean result;
+
+       if (lockname == NULL) {
+               lockname = g_build_filename(g_get_home_dir(), ".gnupg", "trustdb.gpg.lock", NULL);
+       }
+
+       if (g_file_test(lockname, G_FILE_TEST_EXISTS)) {
+               libbalsa_information(LIBBALSA_INFORMATION_ERROR, "%s %s",
+                       _("GnuPG is rebuilding the trust database and is currently unavailable."),
+                       _("Try again later."));
+               result = TRUE;
+       } else {
+               result = FALSE;
+       }
+       return result;
 }
 
 
 /* check if the local key ring contains a public key for the passed recipients */
 static gboolean
 have_pub_key_for(gpgme_ctx_t          gpgme_ctx,
-                 InternetAddressList *recipients)
+                                InternetAddressList *recipients)
 {
     gboolean result = TRUE;
     gint i;
 
     for (i = 0; result && (i < internet_address_list_length(recipients)); i++) {
-        InternetAddress *ia = internet_address_list_get_address(recipients, i);
-
-        /* check all entries in the list, handle groups recursively */
-        if (INTERNET_ADDRESS_IS_GROUP(ia)) {
-            result = have_pub_key_for(gpgme_ctx, INTERNET_ADDRESS_GROUP(ia)->members);
-        } else {
-            gchar *mail_name;
-            GList *keys = NULL;
-
-            result = FALSE;
-            /* enclose the mail address into "<...>" to perform an exact search */
-            mail_name = g_strconcat("<", INTERNET_ADDRESS_MAILBOX(ia)->addr, ">", NULL);
-            if (libbalsa_gpgme_list_keys(gpgme_ctx, &keys, NULL, mail_name, FALSE, FALSE,
-                                         NULL)) {
-                if (keys != NULL) {
-                    result = TRUE;
-                    g_list_free_full(keys, (GDestroyNotify) gpgme_key_unref);
-                }
-            }
-            g_free(mail_name);
-        }
+       InternetAddress *ia = internet_address_list_get_address(recipients, i);
+
+       /* check all entries in the list, handle groups recursively */
+       if (INTERNET_ADDRESS_IS_GROUP(ia)) {
+               result = have_pub_key_for(gpgme_ctx, INTERNET_ADDRESS_GROUP(ia)->members);
+       } else {
+               gchar *mail_name;
+               GList *keys = NULL;
+
+               result = FALSE;
+               /* enclose the mail address into "<...>" to perform an exact search */
+               mail_name = g_strconcat("<", INTERNET_ADDRESS_MAILBOX(ia)->addr, ">", NULL);
+               if (libbalsa_gpgme_list_keys(gpgme_ctx, &keys, NULL, mail_name, FALSE, FALSE, NULL)) {
+                       if (keys != NULL) {
+                               result = TRUE;
+                               g_list_free_full(keys, (GDestroyNotify) gpgme_key_unref);
+                       }
+               }
+               g_free(mail_name);
+       }
     }
 
     return result;
 }
 
-
-#endif                          /* HAVE_GPGME */
+#endif                         /* HAVE_GPGME */
diff --git a/libbalsa/rfc3156.h b/libbalsa/rfc3156.h
index 256e052..6a34d20 100644
--- a/libbalsa/rfc3156.h
+++ b/libbalsa/rfc3156.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -21,89 +21,89 @@
 #define __RFC3156_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 /* bits to define the protection method; needed even when we don't
  * HAVE_GPGME */
-#define LIBBALSA_PROTECT_OPENPGP       (1 << 2) /* RFC 2440 (OpenPGP) */
-#define LIBBALSA_PROTECT_SMIMEV3       (1 << 3) /* RFC 2633 (S/MIME v3) */
-#define LIBBALSA_PROTECT_RFC3156       (1 << 4) /* RFC 3156 (PGP/MIME) */
+#define LIBBALSA_PROTECT_OPENPGP       (1 << 2)        /* RFC 2440 (OpenPGP) */
+#define LIBBALSA_PROTECT_SMIMEV3       (1 << 3)        /* RFC 2633 (S/MIME v3) */
+#define LIBBALSA_PROTECT_RFC3156       (1 << 4)        /* RFC 3156 (PGP/MIME) */
 
 #ifdef HAVE_GPGME
 
-#   include <gpgme.h>
-#   include "libbalsa.h"
-#   include "misc.h"
-#   include "gmime-gpgme-signature.h"
+#include <gpgme.h>
+#include "libbalsa.h"
+#include "misc.h"
+#include "gmime-gpgme-signature.h"
 
 
 /* bits to define the protection mode: signed or encrypted */
-#   define LIBBALSA_PROTECT_SIGN          (1 << 0)
-#   define LIBBALSA_PROTECT_ENCRYPT       (1 << 1)
-#   define LIBBALSA_PROTECT_MODE          (3 << 0)
+#define LIBBALSA_PROTECT_SIGN          (1 << 0)
+#define LIBBALSA_PROTECT_ENCRYPT       (1 << 1)
+#define LIBBALSA_PROTECT_MODE          (3 << 0)
 
 /* bits to define the protection method */
-#   define LIBBALSA_PROTECT_PROTOCOL      (7 << 2)
+#define LIBBALSA_PROTECT_PROTOCOL      (7 << 2)
 
 /* indicate broken structure */
-#   define LIBBALSA_PROTECT_ERROR         (1 << 5)
+#define LIBBALSA_PROTECT_ERROR         (1 << 5)
 
 /* indicate that uid's should always be trusted */
-#   define LIBBALSA_PROTECT_ALWAYS_TRUST  (1 << 6)
+#define LIBBALSA_PROTECT_ALWAYS_TRUST  (1 << 6)
 
 
 /* some custom error messages */
-#   define GPG_ERR_TRY_AGAIN          GPG_ERR_USER_15
-#   define GPG_ERR_NOT_SIGNED         GPG_ERR_USER_16
+#define GPG_ERR_TRY_AGAIN          GPG_ERR_USER_15
+#define GPG_ERR_NOT_SIGNED         GPG_ERR_USER_16
 
 
-gint libbalsa_message_body_protection(LibBalsaMessageBody *body);
-gboolean libbalsa_can_encrypt_for_all(InternetAddressList *recipients,
-                                      gpgme_protocol_t     protocol);
+gint libbalsa_message_body_protection(LibBalsaMessageBody * body);
+gboolean libbalsa_can_encrypt_for_all(InternetAddressList * recipients,
+                                     gpgme_protocol_t protocol);
 
 /* routines dealing with RFC 2633 and RFC 3156 stuff */
-gboolean libbalsa_sign_mime_object(GMimeObject    **content,
-                                   const gchar     *rfc822_for,
-                                   gpgme_protocol_t protocol,
-                                   GtkWindow       *parent,
-                                   GError         **error);
-gboolean libbalsa_encrypt_mime_object(GMimeObject    **content,
-                                      GList           *rfc822_for,
-                                      gpgme_protocol_t protocol,
-                                      gboolean         always_trust,
-                                      GtkWindow       *parent,
-                                      GError         **error);
-gboolean libbalsa_sign_encrypt_mime_object(GMimeObject    **content,
-                                           const gchar     *rfc822_signer,
-                                           GList           *rfc822_for,
-                                           gpgme_protocol_t protocol,
-                                           gboolean         always_trust,
-                                           GtkWindow       *parent,
-                                           GError         **error);
-gboolean libbalsa_body_check_signature(LibBalsaMessageBody *body,
-                                       gpgme_protocol_t     protocol);
-LibBalsaMessageBody *libbalsa_body_decrypt(LibBalsaMessageBody *body,
-                                           gpgme_protocol_t     protocol,
-                                           GtkWindow           *parent);
+gboolean libbalsa_sign_mime_object(GMimeObject ** content,
+                                  const gchar * rfc822_for,
+                                  gpgme_protocol_t protocol,
+                                  GtkWindow * parent,
+                                  GError ** error);
+gboolean libbalsa_encrypt_mime_object(GMimeObject ** content,
+                                     GList * rfc822_for,
+                                     gpgme_protocol_t protocol,
+                                     gboolean always_trust,
+                                     GtkWindow * parent,
+                                     GError ** error);
+gboolean libbalsa_sign_encrypt_mime_object(GMimeObject ** content,
+                                          const gchar * rfc822_signer,
+                                          GList * rfc822_for,
+                                          gpgme_protocol_t protocol,
+                                          gboolean always_trust,
+                                          GtkWindow * parent,
+                                          GError ** error);
+gboolean libbalsa_body_check_signature(LibBalsaMessageBody * body,
+                                      gpgme_protocol_t protocol);
+LibBalsaMessageBody *libbalsa_body_decrypt(LibBalsaMessageBody * body,
+                                          gpgme_protocol_t protocol,
+                                          GtkWindow * parent);
 
 /* routines dealing with RFC 2440 stuff */
-gboolean libbalsa_rfc2440_sign_encrypt(GMimePart   *part,
-                                       const gchar *sign_for,
-                                       GList       *encrypt_for,
-                                       gboolean     always_trust,
-                                       GtkWindow   *parent,
-                                       GError     **error);
-gpgme_error_t libbalsa_rfc2440_verify(GMimePart          *part,
-                                      GMimeGpgmeSigstat **sig_info);
-gpgme_error_t libbalsa_rfc2440_decrypt(GMimePart          *part,
-                                       GMimeGpgmeSigstat **sig_info,
-                                       GtkWindow          *parent);
+gboolean libbalsa_rfc2440_sign_encrypt(GMimePart * part,
+                                      const gchar * sign_for,
+                                      GList * encrypt_for,
+                                      gboolean always_trust,
+                                      GtkWindow * parent,
+                                      GError ** error);
+gpgme_error_t libbalsa_rfc2440_verify(GMimePart * part,
+                                     GMimeGpgmeSigstat ** sig_info);
+gpgme_error_t libbalsa_rfc2440_decrypt(GMimePart * part,
+                                      GMimeGpgmeSigstat ** sig_info,
+                                      GtkWindow * parent);
 
 /* helper functions to convert states to human-readable form */
 const gchar *libbalsa_gpgme_sig_stat_to_gchar(gpgme_error_t stat);
 const gchar *libbalsa_gpgme_validity_to_gchar(gpgme_validity_t validity);
 const gchar *libbalsa_gpgme_validity_to_gchar_short(gpgme_validity_t validity);
 
-#endif                          /* HAVE_GPGME */
-#endif                          /* __RFC3156_H__ */
+#endif                         /* HAVE_GPGME */
+#endif                         /* __RFC3156_H__ */
diff --git a/libbalsa/rfc6350.c b/libbalsa/rfc6350.c
index d9b2d7d..c6652e5 100644
--- a/libbalsa/rfc6350.c
+++ b/libbalsa/rfc6350.c
@@ -2,51 +2,44 @@
  *
  * Copyright (C) 1997-2016 Stuart Parmenter and others, see the file AUTHORS for a list.
  *
- * This module provides a simple RFC 6350 (aka VCard 4.0, see
- * https://tools.ietf.org/html/rfc6350) parser which extracts a single
+ * This module provides a simple RFC 6350 (aka VCard 4.0, see https://tools.ietf.org/html/rfc6350) parser 
which extracts a single
  * VCard from a GDataInputStream and returns it as LibBalsaAddress.
  *
  * Written by Copyright (C) 2016 Albrecht Dreß <albrecht dress arcor de>.
  *
- * This program is free software; you can redistribute it and/or modify it under the terms of
- * the GNU General Public License as
- * published by the Free Software Foundation; either version 2, or (at your option) any later
- * version.
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU 
General Public License as
+ * published by the Free Software Foundation; either version 2, or (at your option) any later version.
  *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 
the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License along with this program; if
- * not, see
+ * You should have received a copy of the GNU General Public License along with this program; if not, see
  * <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #if defined(HAVE_OSMO)
 
-#   include <glib/gi18n.h>
-#   include "rfc6350.h"
+#include <glib/gi18n.h>
+#include "rfc6350.h"
 
 
 /* define GError stuff for the RFC 6350/VCard parser */
-#   define RFC6350_ERROR_QUARK                             (g_quark_from_static_string( \
-                                                                "rfc6350-parser"))
-#   define RFC6350_ERROR_NO_COLON                  1
-#   define RFC6350_ERROR_EMPTY                             2
-#   define RFC6350_ERROR_BEGIN                             3
-#   define RFC6350_ERROR_END                               4
+#define RFC6350_ERROR_QUARK                            (g_quark_from_static_string("rfc6350-parser"))
+#define RFC6350_ERROR_NO_COLON                 1
+#define RFC6350_ERROR_EMPTY                            2
+#define RFC6350_ERROR_BEGIN                            3
+#define RFC6350_ERROR_END                              4
 
 
-static gboolean rfc6350_eval_line(gchar           *line,
-                                  LibBalsaAddress *address,
-                                  GError         **error);
+static gboolean rfc6350_eval_line(gchar                          *line,
+                                                                 LibBalsaAddress *address,
+                                                                 GError                  **error);
 static gchar **rfc6350_strsplit(const gchar *item,
-                                guint        count);
+                                                               guint       count);
 static gchar *rfc6350_get_name(gchar *name);
 static void rfc6350_unescape(gchar *item);
 static gchar *rfc6350_fn_from_n(gchar **n_items);
@@ -54,72 +47,70 @@ static gchar *rfc6350_fn_from_n(gchar **n_items);
 
 LibBalsaAddress *
 rfc6350_parse_from_stream(GDataInputStream *stream,
-                          gboolean         *eos,
-                          GError          **error)
+                                                 gboolean                 *eos,
+                                                 GError                   **error)
 {
-    gchar *line;
-    LibBalsaAddress *result = NULL;
-
-    line = g_data_input_stream_read_line_utf8(stream, NULL, NULL, error);
-    if (line == NULL) {
-        if (*error == NULL) {
-            *eos = TRUE;
-        }
-    } else if (g_ascii_strcasecmp(line, "BEGIN:VCARD") != 0) {
-        g_set_error(error, RFC6350_ERROR_QUARK, RFC6350_ERROR_BEGIN,
-                    _("malformed card, BEGIN:VCARD expected"));
-        g_free(line);
-    } else {
-        gboolean parse_done = FALSE;
-
-        result = libbalsa_address_new();
-        while (result && (line != NULL) && !parse_done) {
-            if (g_ascii_strcasecmp(line, "END:VCARD") == 0) {
-                parse_done = TRUE;
-                g_free(line);
-            } else {
-                gchar *nextline;
-
-                /* perform unfolding (RFC 6350, sect. 3.2. "Line Delimiting and Folding") */
-                nextline = g_data_input_stream_read_line_utf8(stream, NULL, NULL, error);
-                while ((nextline) != NULL && ((nextline[0] == ' ') || (nextline[0] == '\t'))) {
-                    gchar *unfold;
-
-                    unfold = g_strconcat(line, &nextline[1], NULL);
-                    g_free(line);
-                    g_free(nextline);
-                    line = unfold;
-                    nextline = g_data_input_stream_read_line_utf8(stream, NULL, NULL, error);
-                }
-
-                /* evaluate unfolded line, drop address on error */
-                if (!rfc6350_eval_line(line, result, error)) {
-                    g_clear_object(&result);
-                }
-
-                /* process next line */
-                g_free(line);
-                line = nextline;
-            }
-        }
-
-        if (!parse_done) {
-            g_set_error(error, RFC6350_ERROR_QUARK, RFC6350_ERROR_END,
-                        _("malformed card, END:VCARD missing"));
-            g_clear_object(&result);
-        }
-    }
-
-    /* ignore items without an Email address, fill empty full name if necessary */
-    if (result != NULL) {
-        if (libbalsa_address_get_addr_list(result) == NULL) {
-            g_clear_object(&result);
-        } else if (libbalsa_address_get_full_name(result) == NULL) {
-            libbalsa_address_set_full_name(result, _("No-Name"));
-        }
-    }
-
-    return result;
+       gchar *line;
+       LibBalsaAddress *result = NULL;
+
+       line = g_data_input_stream_read_line_utf8(stream, NULL, NULL, error);
+       if (line == NULL) {
+               if (*error == NULL) {
+                       *eos = TRUE;
+               }
+       } else if (g_ascii_strcasecmp(line, "BEGIN:VCARD") != 0) {
+               g_set_error(error, RFC6350_ERROR_QUARK, RFC6350_ERROR_BEGIN, _("malformed card, BEGIN:VCARD 
expected"));
+               g_free(line);
+       } else {
+               gboolean parse_done = FALSE;
+
+               result = libbalsa_address_new();
+               while (result && (line != NULL) && !parse_done) {
+                       if (g_ascii_strcasecmp(line, "END:VCARD") == 0) {
+                               parse_done = TRUE;
+                               g_free(line);
+                       } else {
+                               gchar *nextline;
+
+                               /* perform unfolding (RFC 6350, sect. 3.2. "Line Delimiting and Folding") */
+                               nextline = g_data_input_stream_read_line_utf8(stream, NULL, NULL, error);
+                               while ((nextline) != NULL && ((nextline[0] == ' ') || (nextline[0] == '\t'))) 
{
+                                       gchar *unfold;
+
+                                       unfold = g_strconcat(line, &nextline[1], NULL);
+                                       g_free(line);
+                                       g_free(nextline);
+                                       line = unfold;
+                                       nextline = g_data_input_stream_read_line_utf8(stream, NULL, NULL, 
error);
+                               }
+
+                               /* evaluate unfolded line, drop address on error */
+                               if (!rfc6350_eval_line(line, result, error)) {
+                                       g_clear_object(&result);
+                               }
+
+                               /* process next line */
+                               g_free(line);
+                               line = nextline;
+                       }
+               }
+
+               if (!parse_done) {
+                       g_set_error(error, RFC6350_ERROR_QUARK, RFC6350_ERROR_END, _("malformed card, 
END:VCARD missing"));
+                        g_clear_object(&result);
+               }
+       }
+
+       /* ignore items without an Email address, fill empty full name if necessary */
+       if (result != NULL) {
+               if (libbalsa_address_get_addr_list(result) == NULL) {
+                        g_clear_object(&result);
+               } else if (libbalsa_address_get_full_name(result) == NULL) {
+                        libbalsa_address_set_full_name(result, _("No-Name"));
+               }
+       }
+
+       return result;
 }
 
 
@@ -128,32 +119,31 @@ rfc6350_parse_from_stream(GDataInputStream *stream,
  * \param name input name field, modified in place
  * \return the name field, with group and parameters stripped
  *
- * Remove the \em group and \em param parts of the VCard \em name field (see RFC 6350, sect.
- * 3.3. "ABNF Format Definition").
+ * Remove the \em group and \em param parts of the VCard \em name field (see RFC 6350, sect. 3.3. "ABNF 
Format Definition").
  *
  * \note Do \em not free the returned value.
  */
 static gchar *
 rfc6350_get_name(gchar *name)
 {
-    gchar *result;
-    gchar *semicolon;
-
-    /* skip group */
-    result = strchr(name, '.');
-    if (result == NULL) {
-        result = name;
-    } else {
-        result = &result[1];
-    }
-
-    /* drop any name parameters */
-    semicolon = strchr(result, ';');
-    if (semicolon != NULL) {
-        semicolon[0] = '\0';
-    }
-
-    return result;
+       gchar *result;
+       gchar *semicolon;
+
+       /* skip group */
+       result = strchr(name, '.');
+       if (result == NULL) {
+               result = name;
+       } else {
+               result = &result[1];
+       }
+
+       /* drop any name parameters */
+       semicolon = strchr(result, ';');
+       if (semicolon != NULL) {
+               semicolon[0] = '\0';
+       }
+
+       return result;
 }
 
 
@@ -161,8 +151,7 @@ rfc6350_get_name(gchar *name)
  *
  * \param item VCard item, modified in place
  *
- * Unescape a string according to RFC 6350, sect. 3.4. "Property Value Escaping".  Note that all
- * other escaped characters than those
+ * Unescape a string according to RFC 6350, sect. 3.4. "Property Value Escaping".  Note that all other 
escaped characters than those
  * defined in RFC 6350 are simply ignored, although they \em should be regarded as errors.
  *
  * \note Do \em not free the returned value.
@@ -170,26 +159,26 @@ rfc6350_get_name(gchar *name)
 static void
 rfc6350_unescape(gchar *item)
 {
-    gchar *p;
-    gchar *bslash;
-
-    g_assert(item != NULL);
-
-    p = item;
-    do {
-        bslash = strchr(p, '\\');
-        if (bslash != NULL) {
-            if (strchr(",;\\nN", bslash[1]) != NULL) {
-                if (g_ascii_tolower(bslash[1]) == 'n') {
-                    bslash[1] = '\n';
-                }
-                memmove(bslash, &bslash[1], strlen(bslash));
-            }
-            p = &bslash[1];
-        } else {
-            p = NULL;
-        }
-    } while (p != NULL);
+       gchar *p;
+       gchar *bslash;
+
+       g_assert(item != NULL);
+
+       p = item;
+       do {
+               bslash = strchr(p, '\\');
+               if (bslash != NULL) {
+                       if (strchr(",;\\nN", bslash[1]) != NULL) {
+                               if (g_ascii_tolower(bslash[1]) == 'n') {
+                                       bslash[1] = '\n';
+                               }
+                               memmove(bslash, &bslash[1], strlen(bslash));
+                       }
+                       p = &bslash[1];
+               } else {
+                       p = NULL;
+               }
+       } while (p != NULL);
 }
 
 
@@ -199,48 +188,47 @@ rfc6350_unescape(gchar *item)
  * \param count maximum number of fields to split into
  * \return a newly allocated NULL-terminated array of unescaped fields
  *
- * Split the passed value string into fields, and unescape the resulting values.  If the \em
- * item contains more than \em count
+ * Split the passed value string into fields, and unescape the resulting values.  If the \em item contains 
more than \em count
  * fields, the extra delimiters are ignored.
  *
  * \note Free the returned value by calling g_strfreev() on it.
  */
 static gchar **
 rfc6350_strsplit(const gchar *item,
-                 guint        count)
+                                guint           count)
 {
-    gchar **result;
-    const gchar *start;
-    guint index;
-
-    result = g_new0(gchar *, count + 1U);
-    start = item;
-    index = 0U;
-
-    while ((start != NULL) && (index < count)) {
-        if (start[0] == ';') {
-            result[index] = g_strdup("");
-            start = &start[1];
-        } else {
-            const gchar *delim;
-
-            delim = strchr(start, ';');
-            while ((delim != NULL) && (delim[-1] == '\\')) {
-                delim = strchr(&delim[1], ';');
-            }
-            if (delim != NULL) {
-                result[index] = g_strndup(start, delim - start);
-                start = &delim[1];
-            } else {
-                result[index] = g_strdup(start);
-                start = NULL;
-            }
-            rfc6350_unescape(result[index]);
-        }
-        index++;
-    }
-
-    return result;
+       gchar **result;
+       const gchar *start;
+       guint index;
+
+       result = g_new0(gchar *, count + 1U);
+       start = item;
+       index = 0U;
+
+       while ((start != NULL) && (index < count)) {
+               if (start[0] == ';') {
+                       result[index] = g_strdup("");
+                       start = &start[1];
+               } else {
+                       const gchar *delim;
+
+                       delim = strchr(start, ';');
+                       while ((delim != NULL) && (delim[-1] == '\\')) {
+                               delim = strchr(&delim[1], ';');
+                       }
+                       if (delim != NULL) {
+                               result[index] = g_strndup(start, delim - start);
+                               start = &delim[1];
+                       } else {
+                               result[index] = g_strdup(start);
+                               start = NULL;
+                       }
+                       rfc6350_unescape(result[index]);
+               }
+               index++;
+       }
+
+       return result;
 }
 
 
@@ -251,72 +239,69 @@ rfc6350_strsplit(const gchar *item,
  * \param error filled with error information on error
  * \return TRUE on success, or FALSE is the VCard line is malformed
  *
- * Evaluate the VCard line, extract a N, FN, NICKNAME, ORG or EMAIL item and assign it to the
- * appropriate fields in the target
+ * Evaluate the VCard line, extract a N, FN, NICKNAME, ORG or EMAIL item and assign it to the appropriate 
fields in the target
  * address item.
  */
 static gboolean
-rfc6350_eval_line(gchar           *line,
-                  LibBalsaAddress *address,
-                  GError         **error)
+rfc6350_eval_line(gchar                          *line,
+                                 LibBalsaAddress *address,
+                                 GError                  **error)
 {
-    gchar *value;
-    gboolean result;
-
-    /* split into name and value */
-    value = strchr(line, ':');
-    if (value == NULL) {
-        g_set_error(error, RFC6350_ERROR_QUARK, RFC6350_ERROR_NO_COLON,
-                    _("malformed line “%s”, missing “:”"), line);
-        result = FALSE;
-    } else {
-        gchar *namepart;
-        gchar *name;
-
-        /* get the name and make sure that neither name nor value are empty */
-        namepart = g_strndup(line, value - line);
-        name = rfc6350_get_name(namepart);
-        value = &value[1];
-        if ((name[0] == '\0') || (value[0] == '\0')) {
-            g_set_error(error, RFC6350_ERROR_QUARK, RFC6350_ERROR_EMPTY,
-                        _("malformed line “%s”, empty name or value"), line);
-        } else {
-            g_debug("%s: line='%s' name='%s', value='%s'", __func__, line, name, value);
-            if (g_ascii_strcasecmp(name, "FN") == 0) {
-                rfc6350_unescape(value);
-                libbalsa_address_set_full_name(address, value);
-            } else if (g_ascii_strcasecmp(name, "N") == 0) {
-                gchar **n_items;
-
-                n_items = rfc6350_strsplit(value, 5U);
-                libbalsa_address_set_first_name(address, n_items[1]);
-                libbalsa_address_set_last_name(address, n_items[0]);
-                if (libbalsa_address_get_full_name(address) == NULL) {
-                    libbalsa_address_set_full_name
-                        (address, rfc6350_fn_from_n(n_items));
-                }
-                g_strfreev(n_items);
-            } else if (g_ascii_strcasecmp(name, "NICKNAME") == 0) {
-                rfc6350_unescape(value);
-                libbalsa_address_set_nick_name(address, value);
-            } else if (g_ascii_strcasecmp(name, "ORG") == 0) {
-                gchar **n_items;
-
-                n_items = rfc6350_strsplit(value, 2U);
-                libbalsa_address_set_organization(address, n_items[0]);
-                g_strfreev(n_items);
-            } else if (g_ascii_strcasecmp(name, "EMAIL") == 0) {
-                rfc6350_unescape(value);
-                libbalsa_address_add_addr(address, value);
-            } else {
-                /* ignore any other items */
-            }
-        }
-        g_free(namepart);
-        result = TRUE;
-    }
-
-    return result;
+       gchar *value;
+       gboolean result;
+
+       /* split into name and value */
+       value = strchr(line, ':');
+       if (value == NULL) {
+               g_set_error(error, RFC6350_ERROR_QUARK, RFC6350_ERROR_NO_COLON, _("malformed line “%s”, 
missing “:”"), line);
+               result = FALSE;
+       } else {
+               gchar *namepart;
+               gchar *name;
+
+               /* get the name and make sure that neither name nor value are empty */
+               namepart = g_strndup(line, value - line);
+               name = rfc6350_get_name(namepart);
+               value = &value[1];
+               if ((name[0] == '\0') || (value[0] == '\0')) {
+                       g_set_error(error, RFC6350_ERROR_QUARK, RFC6350_ERROR_EMPTY, _("malformed line “%s”, 
empty name or value"), line);
+               } else {
+                       g_debug("%s: line='%s' name='%s', value='%s'", __func__, line, name, value);
+                       if (g_ascii_strcasecmp(name, "FN") == 0) {
+                               rfc6350_unescape(value);
+                                libbalsa_address_set_full_name(address, value);
+                       } else if (g_ascii_strcasecmp(name, "N") == 0) {
+                               gchar **n_items;
+
+                               n_items = rfc6350_strsplit(value, 5U);
+                                libbalsa_address_set_first_name(address, n_items[1]);
+                                libbalsa_address_set_last_name(address, n_items[0]);
+                               if (libbalsa_address_get_full_name(address) == NULL) {
+                                        libbalsa_address_set_full_name
+                                            (address, rfc6350_fn_from_n(n_items));
+                               }
+                               g_strfreev(n_items);
+                       } else if (g_ascii_strcasecmp(name, "NICKNAME") == 0) {
+                               rfc6350_unescape(value);
+                                libbalsa_address_set_nick_name(address, value);
+                       } else if (g_ascii_strcasecmp(name, "ORG") == 0) {
+                               gchar **n_items;
+
+                               n_items = rfc6350_strsplit(value, 2U);
+                                libbalsa_address_set_organization(address, n_items[0]);
+                               g_strfreev(n_items);
+                       } else if (g_ascii_strcasecmp(name, "EMAIL") == 0) {
+                               rfc6350_unescape(value);
+                                libbalsa_address_add_addr(address, value);
+                       } else {
+                               /* ignore any other items */
+                       }
+               }
+               g_free(namepart);
+               result = TRUE;
+       }
+
+       return result;
 }
 
 
@@ -325,32 +310,28 @@ rfc6350_eval_line(gchar           *line,
  * \param n_items extracted VCard N items
  * \return the full name
  *
- * Construct a full name by concatenating -in this order- the VCard "N" elements Honorific
- * Prefixes, Given Names, Additional Names,
+ * Construct a full name by concatenating -in this order- the VCard "N" elements Honorific Prefixes, Given 
Names, Additional Names,
  * Family Names and Honorific Suffixes, separated by a single space each.
  */
 static gchar *
 rfc6350_fn_from_n(gchar **n_items)
 {
-    GString *fn;
-    static const guint add_idx[5] = {
-        3U, 1U, 2U, 0U, 4U
-    };
-    guint n;
-
-    fn = g_string_new(NULL);
-
-    for (n = 0; n < 5U; n++) {
-        if ((n_items[add_idx[n]] != NULL) && (n_items[add_idx[n]][0] != '\0')) {
-            if (fn->len > 0U) {
-                fn = g_string_append_c(fn, ' ');
-            }
-            fn = g_string_append(fn, n_items[add_idx[n]]);
-        }
-    }
-
-    return g_string_free(fn, FALSE);
+       GString *fn;
+       static const guint add_idx[5] = { 3U, 1U, 2U, 0U, 4U };
+       guint n;
+
+       fn = g_string_new(NULL);
+
+       for (n = 0; n < 5U; n++) {
+               if ((n_items[add_idx[n]] != NULL) && (n_items[add_idx[n]][0] != '\0')) {
+                       if (fn->len > 0U) {
+                               fn = g_string_append_c(fn, ' ');
+                       }
+                       fn = g_string_append(fn, n_items[add_idx[n]]);
+               }
+       }
+
+       return g_string_free(fn, FALSE);
 }
 
-
 #endif /* HAVE_OSMO */
diff --git a/libbalsa/rfc6350.h b/libbalsa/rfc6350.h
index 4b06cdc..4904ef1 100644
--- a/libbalsa/rfc6350.h
+++ b/libbalsa/rfc6350.h
@@ -2,24 +2,18 @@
  *
  * Copyright (C) 1997-2016 Stuart Parmenter and others, see the file AUTHORS for a list.
  *
- * This module provides a simple RFC 6350 (aka VCard 4.0, see
- * https://tools.ietf.org/html/rfc6350) parser which extracts a single
+ * This module provides a simple RFC 6350 (aka VCard 4.0, see https://tools.ietf.org/html/rfc6350) parser 
which extracts a single
  * VCard from a GDataInputStream and returns it as LibBalsaAddress.
  *
  * Written by Copyright (C) 2016 Albrecht Dreß <albrecht dress arcor de>.
  *
- * This program is free software; you can redistribute it and/or modify it under the terms of
- * the GNU General Public License as
- * published by the Free Software Foundation; either version 2, or (at your option) any later
- * version.
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU 
General Public License as
+ * published by the Free Software Foundation; either version 2, or (at your option) any later version.
  *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 
the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License along with this program; if
- * not, see
+ * You should have received a copy of the GNU General Public License along with this program; if not, see
  * <http://www.gnu.org/licenses/>.
  */
 
@@ -37,17 +31,15 @@
  * \param error filled with error information on error
  * \return a new address object on success
  *
- * Read a VCard from the input stream and extract all relevant fields into a LibBalsaAddress.  A
- * LibBalsaAddress is returned only if
- * it contains any email address.  The caller shall distinguish this case from an error by
- * checking if the error argument is filled.
+ * Read a VCard from the input stream and extract all relevant fields into a LibBalsaAddress.  A 
LibBalsaAddress is returned only if
+ * it contains any email address.  The caller shall distinguish this case from an error by checking if the 
error argument is filled.
  * The input stream is positioned immediately after the card read.
  *
  * \note The caller shall unref the returned address object.
  */
 LibBalsaAddress *rfc6350_parse_from_stream(GDataInputStream *stream,
-                                           gboolean         *eos,
-                                           GError          **error);
+                                                                                  gboolean                   
  *eos,
+                                                                                  GError                     
  **error);
 
 
 #endif /* LIBBALSA_RFC6350_H_ */
diff --git a/libbalsa/send.c b/libbalsa/send.c
index 94efa9b..eb48202 100644
--- a/libbalsa/send.c
+++ b/libbalsa/send.c
@@ -46,7 +46,7 @@
 #include "libbalsa-progress.h"
 
 #ifdef HAVE_GPGME
-#   include "libbalsa-gpgme.h"
+#include "libbalsa-gpgme.h"
 #endif
 
 #include <glib/gi18n.h>
@@ -55,14 +55,14 @@ typedef struct _MessageQueueItem MessageQueueItem;
 typedef struct _SendMessageInfo SendMessageInfo;
 
 struct _MessageQueueItem {
-    SendMessageInfo *smsg_info;
+       SendMessageInfo *smsg_info;
     LibBalsaMessage *orig;
     GMimeStream *stream;
     NetClientSmtpMessage *smtp_msg;
 };
 
 struct _SendMessageInfo {
-    LibBalsaSmtpServer *smtp_server;
+       LibBalsaSmtpServer *smtp_server;
     LibBalsaMailbox *outbox;
     NetClientSmtp *session;
     LibBalsaFccboxFinder finder;
@@ -80,33 +80,28 @@ struct _SendMessageInfo {
 typedef struct _SendQueueInfo SendQueueInfo;
 
 struct _SendQueueInfo {
-    LibBalsaMailbox *outbox;
-    LibBalsaFccboxFinder finder;
-    GtkWindow *parent;
+       LibBalsaMailbox      *outbox;
+       LibBalsaFccboxFinder  finder;
+       GtkWindow            *parent;
 };
 
 
 static GMutex send_messages_lock;
-static gint sending_threads = 0; /* how many sending threads are active, access via g_atomic_*
-                                  */
+static gint sending_threads = 0; /* how many sending threads are active, access via g_atomic_* */
 static GSourceFunc auto_send_cb = NULL;
 static gboolean send_mail_auto = FALSE;
 static guint send_mail_time = 0U;
 static guint send_mail_timer_id = 0U;
-static gint retrigger_send = 0;         /* # of messages added to outbox while the smtp server
-                                           was locked, access via g_atomic_* */
+static gint retrigger_send = 0;                /* # of messages added to outbox while the smtp server was 
locked, access via g_atomic_* */
 
 static ProgressDialog send_progress_dialog;
 
 
 /* end of state variables section */
 
-/* Stop the the auto-send timer, and start it if start and send_mail_auto are TRUE, and a
-   callback is defined.  In order to catch
- * weird cases (e.g. user unflags or undeletes a message in the outbox) we ignore if the outbox
- * is actually empty or does not
- * contain any ready-to-send messages, and start the timer anyway.  The overhead of the callback
- * just doing nothing should be
+/* Stop the the auto-send timer, and start it if start and send_mail_auto are TRUE, and a callback is 
defined.  In order to catch
+ * weird cases (e.g. user unflags or undeletes a message in the outbox) we ignore if the outbox is actually 
empty or does not
+ * contain any ready-to-send messages, and start the timer anyway.  The overhead of the callback just doing 
nothing should be
  * insignificant. */
 static void
 update_send_timer(gboolean start)
@@ -114,26 +109,24 @@ update_send_timer(gboolean start)
     libbalsa_clear_source_id(&send_mail_timer_id);
 
     if (start && send_mail_auto && (auto_send_cb != NULL)) {
-        send_mail_timer_id = g_timeout_add_seconds(send_mail_time, auto_send_cb, NULL);
+       send_mail_timer_id = g_timeout_add_seconds(send_mail_time, auto_send_cb, NULL);
     }
 }
 
-
 void
 libbalsa_auto_send_init(GSourceFunc auto_send_handler)
 {
-    auto_send_cb = auto_send_handler;
-    update_send_timer(FALSE);
+       auto_send_cb = auto_send_handler;
+       update_send_timer(FALSE);
 }
 
-
 void
 libbalsa_auto_send_config(gboolean enable,
-                          guint    timeout_minutes)
+                                                 guint    timeout_minutes)
 {
-    send_mail_auto = enable;
-    send_mail_time = timeout_minutes * 60U;
-    update_send_timer(enable);
+       send_mail_auto = enable;
+       send_mail_time = timeout_minutes * 60U;
+       update_send_timer(enable);
 }
 
 
@@ -200,10 +193,10 @@ msg_queue_item_destroy(MessageQueueItem *mqi)
 
 
 static SendMessageInfo *
-send_message_info_new(LibBalsaSmtpServer  *smtp_server,
-                      LibBalsaMailbox     *outbox,
-                      LibBalsaFccboxFinder finder,
-                      NetClientSmtp       *session)
+send_message_info_new(LibBalsaSmtpServer   *smtp_server,
+                                         LibBalsaMailbox      *outbox,
+                                         LibBalsaFccboxFinder  finder,
+                      NetClientSmtp        *session)
 {
     SendMessageInfo *smi;
 
@@ -212,8 +205,7 @@ send_message_info_new(LibBalsaSmtpServer  *smtp_server,
     smi->outbox = g_object_ref(outbox);
     smi->finder = finder;
     smi->smtp_server = g_object_ref(smtp_server);
-    smi->progress_id =
-        g_strdup_printf(_("SMTP server %s"), libbalsa_smtp_server_get_name(smtp_server));
+    smi->progress_id = g_strdup_printf(_("SMTP server %s"), libbalsa_smtp_server_get_name(smtp_server));
     return smi;
 }
 
@@ -245,10 +237,9 @@ static LibBalsaMsgCreateResult do_multipart_crypto(LibBalsaMessage *message,
                                                    GtkWindow       *parent,
                                                    GError         **error);
 
-static GMimePart *lb_create_pubkey_part(LibBalsaMessage *message,
-                                        GtkWindow       *parent,
-                                        GError         **error);
-
+static GMimePart *lb_create_pubkey_part(LibBalsaMessage  *message,
+                                                                       GtkWindow        *parent,
+                                                                               GError          **error);
 #endif
 
 static gpointer balsa_send_message_real(SendMessageInfo *info);
@@ -509,17 +500,17 @@ libbalsa_message_queue(LibBalsaMessage    *message,
                        gboolean            flow,
                        GError            **error)
 {
-    LibBalsaMsgCreateResult result;
+       LibBalsaMsgCreateResult result;
 
     update_send_timer(FALSE);
 
-    result = lbs_message_queue_real(message, outbox, fccbox, smtp_server, flow, error);
+       result = lbs_message_queue_real(message, outbox, fccbox, smtp_server, flow, error);
 
     if (g_atomic_int_get(&sending_threads) == 0) {
-        update_send_timer(TRUE);
+       update_send_timer(TRUE);
     }
 
-    return result;
+       return result;
 }
 
 
@@ -528,11 +519,11 @@ libbalsa_message_queue(LibBalsaMessage    *message,
    in given outbox.
  */
 static void lbs_process_queue(LibBalsaMailbox     *outbox,
-                              LibBalsaFccboxFinder finder,
-                              LibBalsaSmtpServer  *smtp_server,
-                              GtkWindow           *parent);
+                                                         LibBalsaFccboxFinder finder,
+                                                         LibBalsaSmtpServer  *smtp_server,
+                                                         GtkWindow           *parent);
 static gboolean lbs_process_queue_real(LibBalsaSmtpServer *smtp_server,
-                                       SendQueueInfo      *send_info);
+                                                                          SendQueueInfo      *send_info);
 
 
 LibBalsaMsgCreateResult
@@ -541,7 +532,7 @@ libbalsa_message_send(LibBalsaMessage     *message,
                       LibBalsaMailbox     *fccbox,
                       LibBalsaFccboxFinder finder,
                       LibBalsaSmtpServer  *smtp_server,
-                      gboolean             show_progress,
+                                         gboolean                         show_progress,
                       GtkWindow           *parent,
                       gboolean             flow,
                       GError             **error)
@@ -558,15 +549,15 @@ libbalsa_message_send(LibBalsaMessage     *message,
                                         smtp_server, flow, error);
 
         if (result == LIBBALSA_MESSAGE_CREATE_OK) {
-            if (libbalsa_smtp_server_trylock(smtp_server)) {
-                lbs_process_queue(outbox, finder, smtp_server, show_progress ? parent : NULL);
-            } else {
-                g_atomic_int_inc(&retrigger_send);
-            }
+               if (libbalsa_smtp_server_trylock(smtp_server)) {
+                       lbs_process_queue(outbox, finder, smtp_server, show_progress ? parent : NULL);
+               } else {
+                       g_atomic_int_inc(&retrigger_send);
+               }
         } else if (g_atomic_int_get(&sending_threads) == 0) {
-            update_send_timer(TRUE);
+               update_send_timer(TRUE);
         } else {
-            /* nothing to do */
+               /* nothing to do */
         }
     }
 
@@ -616,33 +607,24 @@ send_message_data_cb(gchar   *buffer,
 {
     ssize_t read_res;
     MessageQueueItem *mqi = (MessageQueueItem *) user_data;
-    SendMessageInfo *smi = mqi->smsg_info;
+       SendMessageInfo *smi = mqi->smsg_info;
 
     read_res = g_mime_stream_read(mqi->stream, buffer, count);
     if (!smi->no_dialog && (smi->total_size > 0) && (read_res > 0)) {
         gdouble fraction;
         gint ipercent;
 
-        smi->total_sent += read_res;
-        fraction = (gdouble) smi->total_sent / (gdouble) smi->total_size;
-        g_debug("%s: s=%lu t=%lu %g",
-                __func__,
-                (unsigned long) smi->total_sent,
-                (unsigned long) smi->total_size,
-                fraction);
-        if (fraction > 1.0) {
+       smi->total_sent += read_res;
+       fraction = (gdouble) smi->total_sent / (gdouble) smi->total_size;
+       g_debug("%s: s=%lu t=%lu %g", __func__, (unsigned long) smi->total_sent, (unsigned long) 
smi->total_size, fraction);
+       if (fraction > 1.0) {
             fraction = 1.0;
         }
-        ipercent = (gint) (100.0 * (fraction + 0.5));
-        if (!smi->no_dialog && (ipercent > smi->last_report)) {
-            libbalsa_progress_dialog_update(&send_progress_dialog,
-                                            smi->progress_id,
-                                            FALSE,
-                                            fraction,
-                                            _("Message %u of %u"),
-                                            smi->curr_msg,
-                                            smi->msg_count);
-            smi->last_report = ipercent;
+       ipercent = (gint) (100.0 * (fraction + 0.5));
+       if (!smi->no_dialog && (ipercent > smi->last_report)) {
+               libbalsa_progress_dialog_update(&send_progress_dialog, smi->progress_id, FALSE, fraction,
+                       _("Message %u of %u"), smi->curr_msg, smi->msg_count);
+               smi->last_report = ipercent;
         }
     }
     return read_res;
@@ -650,181 +632,171 @@ send_message_data_cb(gchar   *buffer,
 
 
 static void
-lbs_check_reachable_cb(GObject *object,
-                       gboolean can_reach,
-                       gpointer cb_data)
+lbs_check_reachable_cb(GObject  *object,
+                                          gboolean  can_reach,
+                                          gpointer  cb_data)
 {
     LibBalsaSmtpServer *smtp_server = LIBBALSA_SMTP_SERVER(object);
-    SendQueueInfo *send_info = (SendQueueInfo *) cb_data;
-    gboolean thread_started = FALSE;
+       SendQueueInfo *send_info = (SendQueueInfo *) cb_data;
+       gboolean thread_started = FALSE;
 
-    if (can_reach) {
-        thread_started = lbs_process_queue_real(smtp_server, send_info);
-    } else {
+       if (can_reach) {
+               thread_started = lbs_process_queue_real(smtp_server, send_info);
+       } else {
         libbalsa_information(LIBBALSA_INFORMATION_WARNING,
-                             _(
-                                 "Cannot reach SMTP server %s (%s), any queued message will remain in %s."),
-                             libbalsa_smtp_server_get_name(smtp_server),
-                             LIBBALSA_SERVER(smtp_server)->host,
-                             send_info->outbox->name);
-    }
-
-    if (!thread_started) {
-        /* if the thread has been started, it will take care of unlocking the server and
-           re-starting the timer */
-        libbalsa_smtp_server_unlock(smtp_server);
-        update_send_timer(TRUE);
-    }
-
-    g_object_unref(send_info->outbox);
-    if (send_info->parent != NULL) {
-        g_object_unref(send_info->parent);
-    }
-    g_free(send_info);
+                             _("Cannot reach SMTP server %s (%s), any queued message will remain in %s."),
+                                                        libbalsa_smtp_server_get_name(smtp_server),
+                                                        LIBBALSA_SERVER(smtp_server)->host,
+                                                        send_info->outbox->name);
+       }
+
+       if (!thread_started) {
+               /* if the thread has been started, it will take care of unlocking the server and re-starting 
the timer */
+               libbalsa_smtp_server_unlock(smtp_server);
+               update_send_timer(TRUE);
+       }
+
+       g_object_unref(send_info->outbox);
+       if (send_info->parent != NULL) {
+               g_object_unref(send_info->parent);
+       }
+       g_free(send_info);
 }
 
 
 /* note: the following function is called with the passed smtp server being locked
  * parent != NULL indicates that the progress dialogue shall be shown */
 static void
-lbs_process_queue(LibBalsaMailbox     *outbox,
-                  LibBalsaFccboxFinder finder,
-                  LibBalsaSmtpServer  *smtp_server,
-                  GtkWindow           *parent)
+lbs_process_queue(LibBalsaMailbox      *outbox,
+                         LibBalsaFccboxFinder  finder,
+                                 LibBalsaSmtpServer   *smtp_server,
+                                 GtkWindow            *parent)
 {
-    SendQueueInfo *send_info;
-
-    send_info = g_new(SendQueueInfo, 1U);
-    send_info->outbox = g_object_ref(outbox);
-    send_info->finder = finder;
-    if (parent != NULL) {
-        send_info->parent = g_object_ref(parent);
-    } else {
-        send_info->parent = NULL;
-    }
-    libbalsa_server_test_can_reach(LIBBALSA_SERVER(
-                                       smtp_server), lbs_check_reachable_cb, send_info);
+       SendQueueInfo *send_info;
+
+       send_info = g_new(SendQueueInfo, 1U);
+       send_info->outbox = g_object_ref(outbox);
+       send_info->finder = finder;
+       if (parent != NULL) {
+               send_info->parent = g_object_ref(parent);
+       } else {
+               send_info->parent = NULL;
+       }
+       libbalsa_server_test_can_reach(LIBBALSA_SERVER(smtp_server), lbs_check_reachable_cb, send_info);
 }
 
 
 static void
-lbs_process_queue_msg(guint            msgno,
-                      SendMessageInfo *send_message_info)
+lbs_process_queue_msg(guint               msgno,
+                                         SendMessageInfo *send_message_info)
 {
-    MessageQueueItem *new_message;
-    LibBalsaMessage *msg;
-    const gchar *smtp_server_name;
-    LibBalsaMsgCreateResult created;
-    const gchar *dsn_header;
-
-    /* Skip this message if it either FLAGGED or DELETED: */
-    if (!libbalsa_mailbox_msgno_has_flags(send_message_info->outbox, msgno, 0,
-                                          (LIBBALSA_MESSAGE_FLAG_FLAGGED |
-                                           LIBBALSA_MESSAGE_FLAG_DELETED))) {
-        return;
-    }
-
-    msg = libbalsa_mailbox_get_message(send_message_info->outbox, msgno);
-    if (!msg) {
-        /* error? */
-        return;
-    }
-
-    /* check the smtp server */
-    libbalsa_message_body_ref(msg, TRUE, TRUE);
-    smtp_server_name = libbalsa_message_get_user_header(msg, "X-Balsa-SmtpServer");
-    if (!smtp_server_name) {
-        smtp_server_name = libbalsa_smtp_server_get_name(NULL);
-    }
-    if (strcmp(smtp_server_name,
-               libbalsa_smtp_server_get_name(send_message_info->smtp_server)) != 0) {
-        libbalsa_message_body_unref(msg);
-        g_object_unref(msg);
-        return;
-    }
-
-    dsn_header = libbalsa_message_get_user_header(msg, "X-Balsa-DSN");
-    msg->request_dsn = dsn_header != NULL ? atoi(dsn_header) != 0 : FALSE;
-    new_message = msg_queue_item_new(send_message_info);
-    created = libbalsa_fill_msg_queue_item_from_queu(msg, new_message);
-    libbalsa_message_body_unref(msg);
-
-    if (created != LIBBALSA_MESSAGE_CREATE_OK) {
-        msg_queue_item_destroy(new_message);
-    } else {
-        const InternetAddress *ia;
-        const gchar *mailbox;
-
-        libbalsa_message_change_flags(msg, LIBBALSA_MESSAGE_FLAG_FLAGGED, 0);
-        send_message_info->items = g_list_prepend(send_message_info->items, new_message);
-        new_message->smtp_msg = net_client_smtp_msg_new(send_message_data_cb, new_message);
-        if (msg->request_dsn) {
-            net_client_smtp_msg_set_dsn_opts(new_message->smtp_msg, msg->message_id, FALSE);
-        }
-
-        /* Add the sender info */
-        if (msg->headers->from &&
-            (ia = internet_address_list_get_address(msg->headers->from, 0))) {
-            while (ia != NULL && INTERNET_ADDRESS_IS_GROUP(ia)) {
-                ia = internet_address_list_get_address(INTERNET_ADDRESS_GROUP(
-                                                           ia)->members, 0);
-            }
-            mailbox = ia ? INTERNET_ADDRESS_MAILBOX(ia)->addr : "";
-        } else {
-            mailbox = "";
-        }
-
-        net_client_smtp_msg_set_sender(new_message->smtp_msg, mailbox);
-
-        /* Now need to add the recipients to the message. */
-        add_recipients(new_message->smtp_msg, msg->headers->to_list, msg->request_dsn);
-        add_recipients(new_message->smtp_msg, msg->headers->cc_list, msg->request_dsn);
-        add_recipients(new_message->smtp_msg, msg->headers->bcc_list, msg->request_dsn);
-
-        /* Estimate the size of the message.  This need not be exact but it's better to err
-         * on the large side since some message headers may be altered during the transfer. */
-        send_message_info->total_size += g_mime_stream_length(new_message->stream);
-        send_message_info->msg_count++;
-    }
-    g_object_unref(msg);
+       MessageQueueItem* new_message;
+       LibBalsaMessage* msg;
+       const gchar* smtp_server_name;
+       LibBalsaMsgCreateResult created;
+        const gchar *dsn_header;
+
+       /* Skip this message if it either FLAGGED or DELETED: */
+       if (!libbalsa_mailbox_msgno_has_flags(send_message_info->outbox, msgno, 0,
+               (LIBBALSA_MESSAGE_FLAG_FLAGGED | LIBBALSA_MESSAGE_FLAG_DELETED))) {
+               return;
+       }
+
+       msg = libbalsa_mailbox_get_message(send_message_info->outbox, msgno);
+       if (!msg) {
+               /* error? */
+               return;
+       }
+
+       /* check the smtp server */
+       libbalsa_message_body_ref(msg, TRUE, TRUE);
+       smtp_server_name = libbalsa_message_get_user_header(msg, "X-Balsa-SmtpServer");
+       if (!smtp_server_name) {
+               smtp_server_name = libbalsa_smtp_server_get_name(NULL);
+       }
+       if (strcmp(smtp_server_name, libbalsa_smtp_server_get_name(send_message_info->smtp_server)) != 0) {
+               libbalsa_message_body_unref(msg);
+               g_object_unref(msg);
+               return;
+       }
+
+        dsn_header = libbalsa_message_get_user_header(msg, "X-Balsa-DSN");
+        msg->request_dsn = dsn_header != NULL ? atoi(dsn_header) != 0 : FALSE;
+       new_message = msg_queue_item_new(send_message_info);
+       created = libbalsa_fill_msg_queue_item_from_queu(msg, new_message);
+       libbalsa_message_body_unref(msg);
+
+       if (created != LIBBALSA_MESSAGE_CREATE_OK) {
+               msg_queue_item_destroy(new_message);
+       } else {
+               const InternetAddress* ia;
+               const gchar* mailbox;
+
+               libbalsa_message_change_flags(msg, LIBBALSA_MESSAGE_FLAG_FLAGGED, 0);
+               send_message_info->items = g_list_prepend(send_message_info->items, new_message);
+               new_message->smtp_msg = net_client_smtp_msg_new(send_message_data_cb, new_message);
+               if (msg->request_dsn) {
+                       net_client_smtp_msg_set_dsn_opts(new_message->smtp_msg, msg->message_id, FALSE);
+               }
+
+               /* Add the sender info */
+               if (msg->headers->from && (ia = internet_address_list_get_address(msg->headers->from, 0))) {
+                       while (ia != NULL && INTERNET_ADDRESS_IS_GROUP(ia)) {
+                               ia = internet_address_list_get_address(INTERNET_ADDRESS_GROUP(
+                                       ia)->members, 0);
+                       }
+                       mailbox = ia ? INTERNET_ADDRESS_MAILBOX(ia)->addr : "";
+               } else {
+                       mailbox = "";
+               }
+
+               net_client_smtp_msg_set_sender(new_message->smtp_msg, mailbox);
+
+               /* Now need to add the recipients to the message. */
+               add_recipients(new_message->smtp_msg, msg->headers->to_list, msg->request_dsn);
+               add_recipients(new_message->smtp_msg, msg->headers->cc_list, msg->request_dsn);
+               add_recipients(new_message->smtp_msg, msg->headers->bcc_list, msg->request_dsn);
+
+               /* Estimate the size of the message.  This need not be exact but it's better to err
+                * on the large side since some message headers may be altered during the transfer. */
+               send_message_info->total_size += g_mime_stream_length(new_message->stream);
+               send_message_info->msg_count++;
+       }
+       g_object_unref(msg);
 }
 
 
 static NetClientSmtp *
-lbs_process_queue_init_session(LibBalsaServer *server)
+lbs_process_queue_init_session(LibBalsaServer* server)
 {
-    NetClientSmtp *session;
-
-    if (server->security == NET_CLIENT_CRYPT_ENCRYPTED) {
-        session = net_client_smtp_new(server->host, 465U, server->security);
-    } else {
-        // FIXME - submission (587) is the standard, but most isp's use 25...
-        session = net_client_smtp_new(server->host, 587U, server->security);
-    }
-
-    /* load client certificate if configured */
-    if (server->client_cert) {
-        GError *error = NULL;
-
-        g_signal_connect(G_OBJECT(session), "cert-pass",
-                         G_CALLBACK(libbalsa_server_get_cert_pass), server);
-        if (!net_client_set_cert_from_file(NET_CLIENT(session), server->cert_file, &error)) {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _("Cannot load certificate file %s: %s"), server->cert_file,
-                                 error->message);
-            g_error_free(error);
-            g_object_unref(session);
-            session = NULL;
-        }
-    } else {
-        /* connect signals */
-        g_signal_connect(G_OBJECT(session), "cert-check", G_CALLBACK(
-                             libbalsa_server_check_cert), session);
-        g_signal_connect(G_OBJECT(session), "auth", G_CALLBACK(libbalsa_server_get_auth),
-                         server);
-    }
-
-    return session;
+       NetClientSmtp* session;
+
+       if (server->security == NET_CLIENT_CRYPT_ENCRYPTED) {
+               session = net_client_smtp_new(server->host, 465U, server->security);
+       } else {
+               // FIXME - submission (587) is the standard, but most isp's use 25...
+               session = net_client_smtp_new(server->host, 587U, server->security);
+       }
+
+       /* load client certificate if configured */
+       if (server->client_cert) {
+               GError* error = NULL;
+
+               g_signal_connect(G_OBJECT(session), "cert-pass", G_CALLBACK(libbalsa_server_get_cert_pass), 
server);
+               if (!net_client_set_cert_from_file(NET_CLIENT(session), server->cert_file, &error)) {
+                       libbalsa_information(LIBBALSA_INFORMATION_ERROR, _("Cannot load certificate file %s: 
%s"), server->cert_file,
+                               error->message);
+                       g_error_free(error);
+                       g_object_unref(session);
+                       session = NULL;
+               }
+       } else {
+               /* connect signals */
+               g_signal_connect(G_OBJECT(session), "cert-check", G_CALLBACK(libbalsa_server_check_cert), 
session);
+               g_signal_connect(G_OBJECT(session), "auth", G_CALLBACK(libbalsa_server_get_auth), server);
+       }
+
+       return session;
 }
 
 
@@ -835,63 +807,53 @@ lbs_process_queue_init_session(LibBalsaServer *server)
    handler does that.
    Returns if the thread has been launched
 
-   Note: the function is always called with the respective SMTP server being locked, so unlock
-      if we don't start the sending
+   Note: the function is always called with the respective SMTP server being locked, so unlock if we don't 
start the sending
          thread
  */
 static gboolean
-lbs_process_queue_real(LibBalsaSmtpServer *smtp_server,
-                       SendQueueInfo      *send_info)
+lbs_process_queue_real(LibBalsaSmtpServer *smtp_server, SendQueueInfo *send_info)
 {
-    gboolean thread_started = FALSE;
+       gboolean thread_started = FALSE;
 
     g_mutex_lock(&send_messages_lock);
 
     if (libbalsa_mailbox_open(send_info->outbox, NULL)) {
-        NetClientSmtp *session;
-
-        /* create the SMTP session */
-        session = lbs_process_queue_init_session(LIBBALSA_SERVER(smtp_server));
-        if (session != NULL) {
-            SendMessageInfo *send_message_info;
-            guint msgno;
-
-            send_message_info = send_message_info_new(smtp_server,
-                                                      send_info->outbox,
-                                                      send_info->finder,
-                                                      session);
-
-            for (msgno = libbalsa_mailbox_total_messages(send_info->outbox);
-                 msgno > 0U;
-                 msgno--) {
-                lbs_process_queue_msg(msgno, send_message_info);
-            }
-
-            /* launch the thread for sending the messages only if we collected any */
-            if (send_message_info->items != NULL) {
-                GThread *send_mail;
-
-                if (send_info->parent != NULL) {
-                    libbalsa_progress_dialog_ensure(&send_progress_dialog, _(
-                                                        "Sending Mail"), send_info->parent,
-                                                    send_message_info->progress_id);
-                    send_message_info->no_dialog = FALSE;
-                } else {
-                    send_message_info->no_dialog = TRUE;
-                }
-                g_atomic_int_inc(&sending_threads);
-                send_mail = g_thread_new("balsa_send_message_real",
-                                         (GThreadFunc) balsa_send_message_real,
-                                         send_message_info);
-                g_thread_unref(send_mail);
-                thread_started = TRUE;
-            } else {
-                send_message_info_destroy(send_message_info);
-            }
-        }
+       NetClientSmtp *session;
+
+       /* create the SMTP session */
+       session = lbs_process_queue_init_session(LIBBALSA_SERVER(smtp_server));
+       if (session != NULL) {
+               SendMessageInfo *send_message_info;
+               guint msgno;
+
+               send_message_info = send_message_info_new(smtp_server, send_info->outbox, send_info->finder, 
session);
+
+               for (msgno = libbalsa_mailbox_total_messages(send_info->outbox); msgno > 0U; msgno--) {
+                       lbs_process_queue_msg(msgno, send_message_info);
+               }
+
+               /* launch the thread for sending the messages only if we collected any */
+               if (send_message_info->items != NULL) {
+                       GThread *send_mail;
+
+                       if (send_info->parent != NULL) {
+                               libbalsa_progress_dialog_ensure(&send_progress_dialog, _("Sending Mail"), 
send_info->parent,
+                                       send_message_info->progress_id);
+                               send_message_info->no_dialog = FALSE;
+                       } else {
+                               send_message_info->no_dialog = TRUE;
+                       }
+                       g_atomic_int_inc(&sending_threads);
+                       send_mail = g_thread_new("balsa_send_message_real", (GThreadFunc) 
balsa_send_message_real, send_message_info);
+                       g_thread_unref(send_mail);
+                       thread_started = TRUE;
+               } else {
+                       send_message_info_destroy(send_message_info);
+               }
+       }
 
         if (!thread_started) {
-            libbalsa_mailbox_close(send_info->outbox, TRUE);
+                       libbalsa_mailbox_close(send_info->outbox, TRUE);
         }
     }
 
@@ -905,39 +867,37 @@ void
 libbalsa_process_queue(LibBalsaMailbox     *outbox,
                        LibBalsaFccboxFinder finder,
                        GSList              *smtp_servers,
-                       gboolean             show_progress,
+                                          gboolean                             show_progress,
                        GtkWindow           *parent)
 {
-    if (libbalsa_mailbox_open(outbox, NULL)) {
-        guint msgno;
-        guint pending = 0U;
-
-        update_send_timer(FALSE);
-
-        for (msgno = libbalsa_mailbox_total_messages(outbox); msgno > 0U; msgno--) {
-            if (libbalsa_mailbox_msgno_has_flags(outbox, msgno, 0,
-                                                 (LIBBALSA_MESSAGE_FLAG_FLAGGED |
-                                                  LIBBALSA_MESSAGE_FLAG_DELETED))) {
-                pending++;
-            }
-        }
-
-        if (pending > 0U) {
-            for (; smtp_servers; smtp_servers = smtp_servers->next) {
-                LibBalsaSmtpServer *smtp_server = LIBBALSA_SMTP_SERVER(smtp_servers->data);
-
-                if (libbalsa_smtp_server_trylock(smtp_server)) {
-                    lbs_process_queue(outbox, finder, smtp_server,
-                                      show_progress ? parent : NULL);
-                }
-            }
-        } else {
-            update_send_timer(TRUE);
-            g_message("%s: no messages pending", __func__);
-        }
-
-        libbalsa_mailbox_close(outbox, FALSE);
-    }
+       if (libbalsa_mailbox_open(outbox, NULL)) {
+               guint msgno;
+               guint pending = 0U;
+
+               update_send_timer(FALSE);
+
+               for (msgno = libbalsa_mailbox_total_messages(outbox); msgno > 0U; msgno--) {
+                       if (libbalsa_mailbox_msgno_has_flags(outbox, msgno, 0,
+                               (LIBBALSA_MESSAGE_FLAG_FLAGGED | LIBBALSA_MESSAGE_FLAG_DELETED))) {
+                               pending++;
+                       }
+               }
+
+               if (pending > 0U) {
+                       for (; smtp_servers; smtp_servers = smtp_servers->next) {
+                               LibBalsaSmtpServer *smtp_server = LIBBALSA_SMTP_SERVER(smtp_servers->data);
+
+                               if (libbalsa_smtp_server_trylock(smtp_server)) {
+                                       lbs_process_queue(outbox, finder, smtp_server, show_progress ? parent 
: NULL);
+                               }
+                       }
+               } else {
+                       update_send_timer(TRUE);
+                       g_message("%s: no messages pending", __func__);
+               }
+
+               libbalsa_mailbox_close(outbox, FALSE);
+       }
 }
 
 
@@ -950,11 +910,11 @@ libbalsa_process_queue(LibBalsaMailbox     *outbox,
 static gboolean
 balsa_send_message_real_idle_cb(LibBalsaMailbox *outbox)
 {
-    if (g_atomic_int_and(&retrigger_send, 0U) != 0U) {
-        g_idle_add(auto_send_cb, GINT_TO_POINTER(1));
-    } else {
-        update_send_timer(TRUE);
-    }
+       if (g_atomic_int_and(&retrigger_send, 0U) != 0U) {
+               g_idle_add(auto_send_cb, GINT_TO_POINTER(1));
+       } else {
+           update_send_timer(TRUE);
+       }
 
     libbalsa_mailbox_close(outbox, TRUE);
     g_object_unref(outbox);
@@ -962,7 +922,6 @@ balsa_send_message_real_idle_cb(LibBalsaMailbox *outbox)
     return FALSE;
 }
 
-
 #define ERROR_IS_TRANSIENT(error) \
     (g_error_matches((error), NET_CLIENT_ERROR_QUARK, NET_CLIENT_ERROR_CONNECTION_LOST) || \
      g_error_matches((error), NET_CLIENT_SMTP_ERROR_QUARK, NET_CLIENT_ERROR_SMTP_TRANSIENT))
@@ -970,79 +929,61 @@ balsa_send_message_real_idle_cb(LibBalsaMailbox *outbox)
 
 static inline void
 balsa_send_message_success(MessageQueueItem *mqi,
-                           SendMessageInfo  *info)
+                                                  SendMessageInfo  *info)
 {
-    /* sending message successful */
-    if ((mqi->orig != NULL) && (mqi->orig->mailbox != NULL)) {
-        gboolean remove = TRUE;
-        const gchar *fccurl = libbalsa_message_get_user_header(mqi->orig, "X-Balsa-Fcc");
-
-        if (fccurl != NULL) {
-            LibBalsaMailbox *fccbox = info->finder(fccurl);
-            GError *err = NULL;
-
-            if (!info->no_dialog) {
-                libbalsa_progress_dialog_update(&send_progress_dialog,
-                                                info->progress_id,
-                                                FALSE,
-                                                NAN,
-                                                _("Save message in %s…"),
-                                                fccbox->name);
-            }
-
-            libbalsa_message_change_flags(mqi->orig,
-                                          0,
-                                          LIBBALSA_MESSAGE_FLAG_NEW |
-                                          LIBBALSA_MESSAGE_FLAG_FLAGGED);
-            libbalsa_mailbox_sync_storage(mqi->orig->mailbox, FALSE);
-            remove = libbalsa_message_copy(mqi->orig, fccbox, &err);
-            if (!remove) {
-                libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                     _("Saving sent message to %s failed: %s"), fccbox->name,
-                                     err ? err->message : "?");
-                g_clear_error(&err);
-            }
-        }
-
-        /* If copy failed, mark the message again as flagged - otherwise it will get
-         * resent again. And again, and again... */
-        libbalsa_message_change_flags(mqi->orig,
-                                      remove ? LIBBALSA_MESSAGE_FLAG_DELETED : LIBBALSA_MESSAGE_FLAG_FLAGGED,
-                                      0);
-    }
+       /* sending message successful */
+       if ((mqi->orig != NULL) && (mqi->orig->mailbox != NULL)) {
+               gboolean remove = TRUE;
+               const gchar *fccurl = libbalsa_message_get_user_header(mqi->orig, "X-Balsa-Fcc");
+
+               if (fccurl != NULL) {
+                       LibBalsaMailbox *fccbox = info->finder(fccurl);
+                       GError *err = NULL;
+
+                       if (!info->no_dialog) {
+                               libbalsa_progress_dialog_update(&send_progress_dialog, info->progress_id, 
FALSE, NAN,
+                                       _("Save message in %s…"), fccbox->name);
+                       }
+
+                       libbalsa_message_change_flags(mqi->orig, 0, LIBBALSA_MESSAGE_FLAG_NEW | 
LIBBALSA_MESSAGE_FLAG_FLAGGED);
+                       libbalsa_mailbox_sync_storage(mqi->orig->mailbox, FALSE);
+                       remove = libbalsa_message_copy(mqi->orig, fccbox, &err);
+                       if (!remove) {
+                               libbalsa_information(LIBBALSA_INFORMATION_ERROR, _("Saving sent message to %s 
failed: %s"), fccbox->name,
+                                       err ? err->message : "?");
+                               g_clear_error(&err);
+                       }
+               }
+
+               /* If copy failed, mark the message again as flagged - otherwise it will get
+                * resent again. And again, and again... */
+               libbalsa_message_change_flags(mqi->orig, remove ? LIBBALSA_MESSAGE_FLAG_DELETED : 
LIBBALSA_MESSAGE_FLAG_FLAGGED, 0);
+       }
 }
 
-
 static inline void
 balsa_send_message_error(MessageQueueItem *mqi,
-                         GError           *error)
+                                                GError           *error)
 {
-    /* sending message failed */
-    if ((mqi->orig != NULL) && (mqi->orig->mailbox != NULL)) {
-        if (ERROR_IS_TRANSIENT(error)) {
-            /* Mark it as:
-             * - neither flagged nor deleted, so it can be resent later
-             *   without changing flags. */
-            libbalsa_message_change_flags(mqi->orig,
-                                          0,
-                                          LIBBALSA_MESSAGE_FLAG_FLAGGED |
-                                          LIBBALSA_MESSAGE_FLAG_DELETED);
-        } else {
-            /* Mark it as:
-             * - flagged, so it will not be sent again until the error is fixed
-             *   and the user manually clears the flag;
-             * - undeleted, in case it was already deleted. */
-            libbalsa_message_change_flags(mqi->orig,
-                                          LIBBALSA_MESSAGE_FLAG_FLAGGED,
-                                          LIBBALSA_MESSAGE_FLAG_DELETED);
-        }
-    }
-    libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                         _("Sending message failed: %s\nMessage left in your outbox."),
-                         error->message);
+       /* sending message failed */
+       if ((mqi->orig != NULL) && (mqi->orig->mailbox != NULL)) {
+               if (ERROR_IS_TRANSIENT(error)) {
+                       /* Mark it as:
+                        * - neither flagged nor deleted, so it can be resent later
+                        *   without changing flags. */
+                       libbalsa_message_change_flags(mqi->orig, 0, LIBBALSA_MESSAGE_FLAG_FLAGGED | 
LIBBALSA_MESSAGE_FLAG_DELETED);
+               } else {
+                       /* Mark it as:
+                        * - flagged, so it will not be sent again until the error is fixed
+                        *   and the user manually clears the flag;
+                        * - undeleted, in case it was already deleted. */
+                       libbalsa_message_change_flags(mqi->orig, LIBBALSA_MESSAGE_FLAG_FLAGGED, 
LIBBALSA_MESSAGE_FLAG_DELETED);
+               }
+       }
+       libbalsa_information(LIBBALSA_INFORMATION_ERROR, _("Sending message failed: %s\nMessage left in your 
outbox."),
+               error->message);
 }
 
-
 static gpointer
 balsa_send_message_real(SendMessageInfo *info)
 {
@@ -1054,12 +995,8 @@ balsa_send_message_real(SendMessageInfo *info)
 
     /* connect the SMTP server */
     if (!info->no_dialog) {
-        libbalsa_progress_dialog_update(&send_progress_dialog,
-                                        info->progress_id,
-                                        FALSE,
-                                        INFINITY,
-                                        _("Connecting %s…"),
-                                        net_client_get_host(NET_CLIENT(info->session)));
+               libbalsa_progress_dialog_update(&send_progress_dialog, info->progress_id, FALSE, INFINITY,
+                       _("Connecting %s…"), net_client_get_host(NET_CLIENT(info->session)));
     }
     result = net_client_smtp_connect(info->session, &greeting, &error);
     g_debug("%s: connect = %d [%p]: '%s'", __func__, result, info->items, greeting);
@@ -1068,12 +1005,8 @@ balsa_send_message_real(SendMessageInfo *info)
         GList *this_msg;
 
         if (!info->no_dialog) {
-            libbalsa_progress_dialog_update(&send_progress_dialog,
-                                            info->progress_id,
-                                            FALSE,
-                                            0.0,
-                                            _("Connected to %s"),
-                                            net_client_get_host(NET_CLIENT(info->session)));
+               libbalsa_progress_dialog_update(&send_progress_dialog, info->progress_id, FALSE, 0.0,
+                       _("Connected to %s"), net_client_get_host(NET_CLIENT(info->session)));
         }
 
         for (this_msg = info->items; this_msg != NULL; this_msg = this_msg->next) {
@@ -1097,10 +1030,10 @@ balsa_send_message_real(SendMessageInfo *info)
 
             if (send_res) {
                 /* sending message successful */
-                balsa_send_message_success(mqi, info);
+                               balsa_send_message_success(mqi, info);
             } else {
                 /* sending message failed */
-                balsa_send_message_error(mqi, error);
+                               balsa_send_message_error(mqi, error);
                 g_clear_error(&error);
                 result = FALSE;
             }
@@ -1142,17 +1075,15 @@ balsa_send_message_real(SendMessageInfo *info)
 
     /* clean up */
     if (!info->no_dialog) {
-        libbalsa_progress_dialog_update(&send_progress_dialog, info->progress_id, TRUE, 1.0,
-                                        _("Finished"));
+               libbalsa_progress_dialog_update(&send_progress_dialog, info->progress_id, TRUE, 1.0, 
_("Finished"));
     } else if (result) {
-        libbalsa_information(LIBBALSA_INFORMATION_MESSAGE,
-                             ngettext("Transmitted %u message to %s",
-                                      "Transmitted %u messages to %s", info->msg_count),
-                             info->msg_count, libbalsa_smtp_server_get_name(info->smtp_server));
+       libbalsa_information(LIBBALSA_INFORMATION_MESSAGE,
+               ngettext("Transmitted %u message to %s", "Transmitted %u messages to %s", info->msg_count),
+                       info->msg_count, libbalsa_smtp_server_get_name(info->smtp_server));
     } else {
-        /* no dialogue and error: information already displayed, nothing to do */
+       /* no dialogue and error: information already displayed, nothing to do */
     }
-    libbalsa_smtp_server_unlock(info->smtp_server);
+       libbalsa_smtp_server_unlock(info->smtp_server);
     send_message_info_destroy(info);
 
     (void) g_atomic_int_dec_and_test(&sending_threads);
@@ -1271,9 +1202,8 @@ libbalsa_message_create_mime_message(LibBalsaMessage *message,
 
 #ifdef HAVE_GPGME
     /* attach the public key only if we send the message, not if we just postpone it */
-    if (!postponing && message->att_pubkey &&
-        ((message->gpg_mode & LIBBALSA_PROTECT_PROTOCOL) != 0)) {
-        attach_pubkey = TRUE;
+    if (!postponing && message->att_pubkey && ((message->gpg_mode & LIBBALSA_PROTECT_PROTOCOL) != 0)) {
+       attach_pubkey = TRUE;
     }
 #endif
 
@@ -1453,15 +1383,15 @@ libbalsa_message_create_mime_message(LibBalsaMessage *message,
 
 #ifdef HAVE_GPGME
     if (attach_pubkey) {
-        GMimePart *pubkey_part;
+       GMimePart *pubkey_part;
 
-        pubkey_part = lb_create_pubkey_part(message, parent, error);
-        if (pubkey_part == NULL) {
+       pubkey_part = lb_create_pubkey_part(message, parent, error);
+       if (pubkey_part == NULL) {
             if (mime_root != NULL) {
                 g_object_unref(G_OBJECT(mime_root));
             }
             return LIBBALSA_MESSAGE_CREATE_ERROR;
-        }
+       }
         if (mime_root != NULL) {
             g_mime_multipart_add(GMIME_MULTIPART(mime_root), GMIME_OBJECT(pubkey_part));
             g_object_unref(G_OBJECT(pubkey_part));
@@ -1761,72 +1691,70 @@ libbalsa_fill_msg_queue_item_from_queu(LibBalsaMessage  *message,
 
 #ifdef HAVE_GPGME
 /*
- * If the identity contains a forced key ID for the passed protocol, return the key ID.
- * Otherwise, return the email address of the
+ * If the identity contains a forced key ID for the passed protocol, return the key ID.  Otherwise, return 
the email address of the
  * "From:" address list to let GpeME automagically select the proper key.
  */
 static const gchar *
-lb_send_from(LibBalsaMessage *message,
-             gpgme_protocol_t protocol)
+lb_send_from(LibBalsaMessage  *message,
+                        gpgme_protocol_t  protocol)
 {
-    const gchar *from_id;
-
-    if ((protocol == GPGME_PROTOCOL_OpenPGP) &&
-        (message->ident->force_gpg_key_id != NULL) &&
-        (message->ident->force_gpg_key_id[0] != '\0')) {
-        from_id = message->ident->force_gpg_key_id;
-    } else if ((protocol == GPGME_PROTOCOL_CMS) &&
-               (message->ident->force_smime_key_id != NULL) &&
-               (message->ident->force_smime_key_id[0] != '\0')) {
-        from_id = message->ident->force_smime_key_id;
-    } else {
-        InternetAddress *ia = internet_address_list_get_address(message->headers->from, 0);
-
-        while (INTERNET_ADDRESS_IS_GROUP(ia)) {
-            ia = internet_address_list_get_address(((InternetAddressGroup *) ia)->members, 0);
-        }
-        from_id = ((InternetAddressMailbox *) ia)->addr;
-    }
+       const gchar *from_id;
+
+       if ((protocol == GPGME_PROTOCOL_OpenPGP) &&
+               (message->ident->force_gpg_key_id != NULL) &&
+               (message->ident->force_gpg_key_id[0] != '\0')) {
+               from_id = message->ident->force_gpg_key_id;
+       } else if ((protocol == GPGME_PROTOCOL_CMS) &&
+               (message->ident->force_smime_key_id != NULL) &&
+               (message->ident->force_smime_key_id[0] != '\0')) {
+               from_id = message->ident->force_smime_key_id;
+       } else {
+               InternetAddress *ia = internet_address_list_get_address(message->headers->from, 0);
+
+               while (INTERNET_ADDRESS_IS_GROUP(ia)) {
+                       ia = internet_address_list_get_address(((InternetAddressGroup *) ia)->members, 0);
+               }
+               from_id = ((InternetAddressMailbox *) ia)->addr;
+       }
 
     return from_id;
 }
 
 
 static GMimePart *
-lb_create_pubkey_part(LibBalsaMessage *message,
-                      GtkWindow       *parent,
-                      GError         **error)
+lb_create_pubkey_part(LibBalsaMessage  *message,
+                                     GtkWindow        *parent,
+                                     GError          **error)
 {
-    const gchar *key_id;
-    gchar *keybuf;
-    GMimePart *mime_part = NULL;
-
-    key_id = lb_send_from(message, GPGME_PROTOCOL_OpenPGP);
-    keybuf = libbalsa_gpgme_get_pubkey(GPGME_PROTOCOL_OpenPGP, key_id, parent, error);
-    if (keybuf != NULL) {
-        GMimeStream *stream;
-        GMimeDataWrapper *wrapper;
-        gchar *filename;
-
-        mime_part = g_mime_part_new_with_type("application", "pgp-keys");
-        filename = g_strconcat(key_id, ".asc", NULL);
-        g_mime_object_set_content_type_parameter(GMIME_OBJECT(mime_part), "name", filename);
-        g_mime_object_set_disposition(GMIME_OBJECT(mime_part), GMIME_DISPOSITION_ATTACHMENT);
-        g_mime_object_set_content_disposition_parameter(GMIME_OBJECT(
-                                                            mime_part), "filename", filename);
-        g_free(filename);
-        g_mime_part_set_content_encoding(mime_part, GMIME_CONTENT_ENCODING_7BIT);
-        stream = g_mime_stream_mem_new();
-        g_mime_stream_write(stream, keybuf, strlen(keybuf));
-        g_free(keybuf);
-        wrapper = g_mime_data_wrapper_new();
-        g_mime_data_wrapper_set_stream(wrapper, stream);
-        g_object_unref(stream);
-        g_mime_part_set_content_object(mime_part, wrapper);
-        g_object_unref(wrapper);
-    }
-
-    return mime_part;
+       const gchar *key_id;
+       gchar *keybuf;
+       GMimePart *mime_part = NULL;
+
+       key_id = lb_send_from(message, GPGME_PROTOCOL_OpenPGP);
+       keybuf = libbalsa_gpgme_get_pubkey(GPGME_PROTOCOL_OpenPGP, key_id, parent, error);
+       if (keybuf != NULL) {
+           GMimeStream *stream;
+           GMimeDataWrapper *wrapper;
+           gchar *filename;
+
+           mime_part = g_mime_part_new_with_type("application", "pgp-keys");
+           filename = g_strconcat(key_id, ".asc", NULL);
+               g_mime_object_set_content_type_parameter(GMIME_OBJECT(mime_part), "name", filename);
+               g_mime_object_set_disposition(GMIME_OBJECT(mime_part), GMIME_DISPOSITION_ATTACHMENT);
+           g_mime_object_set_content_disposition_parameter(GMIME_OBJECT(mime_part), "filename", filename);
+               g_free(filename);
+           g_mime_part_set_content_encoding(mime_part, GMIME_CONTENT_ENCODING_7BIT);
+           stream = g_mime_stream_mem_new();
+           g_mime_stream_write(stream, keybuf, strlen(keybuf));
+           g_free(keybuf);
+           wrapper = g_mime_data_wrapper_new();
+           g_mime_data_wrapper_set_stream(wrapper, stream);
+           g_object_unref(stream);
+           g_mime_part_set_content_object(mime_part, wrapper);
+           g_object_unref(wrapper);
+       }
+
+       return mime_part;
 }
 
 
diff --git a/libbalsa/send.h b/libbalsa/send.h
index 20e83d5..93381e9 100644
--- a/libbalsa/send.h
+++ b/libbalsa/send.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -23,12 +23,12 @@
 #define __SEND_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include "libbalsa.h"
 
-typedef LibBalsaMailbox * (*LibBalsaFccboxFinder)(const gchar *url);
+typedef LibBalsaMailbox* (*LibBalsaFccboxFinder)(const gchar *url);
 typedef enum _LibBalsaMsgCreateResult LibBalsaMsgCreateResult;
 enum _LibBalsaMsgCreateResult {
     LIBBALSA_MESSAGE_CREATE_OK,
@@ -43,37 +43,37 @@ enum _LibBalsaMsgCreateResult {
     LIBBALSA_MESSAGE_SERVER_ERROR
 };
 
-gboolean libbalsa_message_postpone(LibBalsaMessage *message,
-                                   LibBalsaMailbox *draftbox,
-                                   LibBalsaMessage *reply_message,
-                                   gchar          **extra_headers,
-                                   gboolean         flow,
-                                   GError         **error);
+gboolean libbalsa_message_postpone(LibBalsaMessage * message,
+                                  LibBalsaMailbox * draftbox,
+                                  LibBalsaMessage * reply_message,
+                                  gchar ** extra_headers,
+                                  gboolean flow, 
+                                  GError **error);
 
-LibBalsaMsgCreateResult libbalsa_message_queue(LibBalsaMessage *message,
-                                               LibBalsaMailbox *outbox,
-                                               LibBalsaMailbox *fccbox,
+LibBalsaMsgCreateResult libbalsa_message_queue(LibBalsaMessage* message, 
+                                              LibBalsaMailbox* outbox,
+                                               LibBalsaMailbox* fccbox,
                                                LibBalsaSmtpServer *
                                                smtp_server,
-                                               gboolean         flow,
-                                               GError         **error);
+                                              gboolean flow,
+                                              GError ** error);
 LibBalsaMsgCreateResult libbalsa_message_send(LibBalsaMessage     *message,
                                               LibBalsaMailbox     *outbox,
                                               LibBalsaMailbox     *fccbox,
                                               LibBalsaFccboxFinder finder,
                                               LibBalsaSmtpServer  *smtp_server,
-                                              gboolean             show_progress,
+                                                                                         gboolean            
             show_progress,
                                               GtkWindow           *parent,
                                               gboolean             flow,
-                                              GError             **error);
+                                                                 GError             **error);
 void libbalsa_process_queue(LibBalsaMailbox     *outbox,
                             LibBalsaFccboxFinder finder,
-                            GSList              *smtp_servers,
-                            gboolean             show_progress,
-                            GtkWindow           *parent);
+                                                       GSList              *smtp_servers,
+                                                       gboolean                         show_progress,
+                                                       GtkWindow           *parent);
 
 void libbalsa_auto_send_init(GSourceFunc auto_send_cb);
 void libbalsa_auto_send_config(gboolean enable,
-                               guint    timeout_minutes);
+                                                  guint    timeout_minutes);
 
 #endif /* __SEND_H__ */
diff --git a/libbalsa/server.c b/libbalsa/server.c
index 945829b..acea0dd 100644
--- a/libbalsa/server.c
+++ b/libbalsa/server.c
@@ -6,20 +6,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "server.h"
 
@@ -27,7 +27,7 @@
 #include <stdlib.h>
 
 #if defined(HAVE_LIBSECRET)
-#   include <libsecret/secret.h>
+#include <libsecret/secret.h>
 #endif                          /* defined(HAVE_LIBSECRET) */
 
 #include <openssl/err.h>
@@ -42,26 +42,25 @@
 static const SecretSchema server_schema = {
     "org.gnome.Balsa.NetworkPassword", SECRET_SCHEMA_NONE,
     {
-        { "protocol", SECRET_SCHEMA_ATTRIBUTE_STRING },
-        { "server", SECRET_SCHEMA_ATTRIBUTE_STRING },
-        { "user", SECRET_SCHEMA_ATTRIBUTE_STRING },
-        { NULL, 0 }
+       { "protocol", SECRET_SCHEMA_ATTRIBUTE_STRING },
+       { "server",   SECRET_SCHEMA_ATTRIBUTE_STRING },
+       { "user",     SECRET_SCHEMA_ATTRIBUTE_STRING },
+       { NULL, 0 }
     }
 };
 const SecretSchema *LIBBALSA_SERVER_SECRET_SCHEMA = &server_schema;
 #endif                          /* defined(HAVE_LIBSECRET) */
 
 static GObjectClass *parent_class = NULL;
-static void libbalsa_server_class_init(LibBalsaServerClass *klass);
-static void libbalsa_server_init(LibBalsaServer *server);
-static void libbalsa_server_finalize(GObject *object);
-
-static void libbalsa_server_real_set_username(LibBalsaServer *server,
-                                              const gchar    *username);
-static void libbalsa_server_real_set_host(LibBalsaServer *server,
-                                          const gchar    *host,
-                                          gboolean        use_ssl);
-
+static void libbalsa_server_class_init(LibBalsaServerClass * klass);
+static void libbalsa_server_init(LibBalsaServer * server);
+static void libbalsa_server_finalize(GObject * object);
+
+static void libbalsa_server_real_set_username(LibBalsaServer * server,
+                                             const gchar * username);
+static void libbalsa_server_real_set_host(LibBalsaServer * server,
+                                         const gchar * host,
+                                          gboolean use_ssl);
 /* static gchar* libbalsa_server_real_get_password(LibBalsaServer *server); */
 
 enum {
@@ -100,9 +99,8 @@ libbalsa_server_get_type(void)
     return server_type;
 }
 
-
 static void
-libbalsa_server_class_init(LibBalsaServerClass *klass)
+libbalsa_server_class_init(LibBalsaServerClass * klass)
 {
     GObjectClass *object_class;
 
@@ -113,70 +111,68 @@ libbalsa_server_class_init(LibBalsaServerClass *klass)
     object_class->finalize = libbalsa_server_finalize;
 
     libbalsa_server_signals[SET_USERNAME] =
-        g_signal_new("set-username",
+       g_signal_new("set-username",
                      G_TYPE_FROM_CLASS(object_class),
                      G_SIGNAL_RUN_FIRST,
-                     G_STRUCT_OFFSET(LibBalsaServerClass,
-                                     set_username),
+                    G_STRUCT_OFFSET(LibBalsaServerClass,
+                                    set_username),
                      NULL, NULL,
                      g_cclosure_marshal_VOID__STRING,
                      G_TYPE_NONE, 1,
-                     G_TYPE_STRING);
+                    G_TYPE_STRING);
     libbalsa_server_signals[SET_HOST] =
-        g_signal_new("set-host",
+       g_signal_new("set-host",
                      G_TYPE_FROM_CLASS(object_class),
                      G_SIGNAL_RUN_FIRST,
-                     G_STRUCT_OFFSET(LibBalsaServerClass,
+                    G_STRUCT_OFFSET(LibBalsaServerClass,
                                      set_host),
                      NULL, NULL,
                      libbalsa_VOID__POINTER_INT,
                      G_TYPE_NONE, 2,
                      G_TYPE_POINTER, G_TYPE_INT
-                     );
+                    );
     libbalsa_server_signals[CONFIG_CHANGED] =
-        g_signal_new("config-changed",
+       g_signal_new("config-changed",
                      G_TYPE_FROM_CLASS(object_class),
                      G_SIGNAL_RUN_FIRST,
-                     G_STRUCT_OFFSET(LibBalsaServerClass,
-                                     config_changed),
+                    G_STRUCT_OFFSET(LibBalsaServerClass,
+                                    config_changed),
                      NULL, NULL,
                      g_cclosure_marshal_VOID__VOID,
                      G_TYPE_NONE, 0);
 
 
     libbalsa_server_signals[GET_PASSWORD] =
-        g_signal_new("get-password",
+       g_signal_new("get-password",
                      G_TYPE_FROM_CLASS(object_class),
                      G_SIGNAL_RUN_LAST,
-                     G_STRUCT_OFFSET(LibBalsaServerClass,
-                                     get_password),
+                    G_STRUCT_OFFSET(LibBalsaServerClass,
+                                    get_password),
                      NULL, NULL,
-                     libbalsa_POINTER__OBJECT,
+                    libbalsa_POINTER__OBJECT,
                      G_TYPE_POINTER, 1,
                      LIBBALSA_TYPE_MAILBOX);
 
     klass->set_username = libbalsa_server_real_set_username;
     klass->set_host = libbalsa_server_real_set_host;
-    klass->get_password = NULL; /* libbalsa_server_real_get_password; */
+    klass->get_password = NULL;        /* libbalsa_server_real_get_password; */
 }
 
-
 static void
-libbalsa_server_init(LibBalsaServer *server)
+libbalsa_server_init(LibBalsaServer * server)
 {
     server->protocol = "pop3"; /* Is this a sane default value? */
     server->host = NULL;
     server->user = NULL;
     server->passwd = NULL;
     server->remember_passwd = TRUE;
-    server->use_ssl = FALSE;
-    server->tls_mode = LIBBALSA_TLS_ENABLED;
-    server->security = NET_CLIENT_CRYPT_STARTTLS;
+    server->use_ssl         = FALSE;
+    server->tls_mode        = LIBBALSA_TLS_ENABLED;
+    server->security           = NET_CLIENT_CRYPT_STARTTLS;
 }
 
-
 static void
-libbalsa_server_finalize(GObject *object)
+libbalsa_server_finalize(GObject * object)
 {
     LibBalsaServer *server;
 
@@ -189,19 +185,18 @@ libbalsa_server_finalize(GObject *object)
     g_free(server->cert_file);
 
     if (server->passwd != NULL) {
-        memset(server->passwd, 0, strlen(server->passwd));
+       memset(server->passwd, 0, strlen(server->passwd));
     }
     libbalsa_free_password(server->passwd);
 
     if (server->cert_passphrase != NULL) {
-        memset(server->cert_passphrase, 0, strlen(server->cert_passphrase));
+       memset(server->cert_passphrase, 0, strlen(server->cert_passphrase));
     }
     g_free(server->cert_passphrase);
 
     G_OBJECT_CLASS(parent_class)->finalize(object);
 }
 
-
 LibBalsaServer *
 libbalsa_server_new(void)
 {
@@ -212,22 +207,20 @@ libbalsa_server_new(void)
     return server;
 }
 
-
 void
-libbalsa_server_set_username(LibBalsaServer *server,
-                             const gchar    *username)
+libbalsa_server_set_username(LibBalsaServer * server,
+                            const gchar * username)
 {
     g_return_if_fail(server != NULL);
     g_return_if_fail(LIBBALSA_IS_SERVER(server));
 
     g_signal_emit(G_OBJECT(server),
-                  libbalsa_server_signals[SET_USERNAME], 0, username);
+                 libbalsa_server_signals[SET_USERNAME], 0, username);
 }
 
-
 void
-libbalsa_server_set_password(LibBalsaServer *server,
-                             const gchar    *passwd)
+libbalsa_server_set_password(LibBalsaServer * server,
+                             const gchar * passwd)
 {
     g_return_if_fail(LIBBALSA_IS_SERVER(server));
 
@@ -235,23 +228,20 @@ libbalsa_server_set_password(LibBalsaServer *server,
     server->passwd = g_strdup(passwd);
 }
 
-
 void
-libbalsa_server_set_host(LibBalsaServer *server,
-                         const gchar    *host,
-                         gboolean        use_ssl)
+libbalsa_server_set_host(LibBalsaServer * server, const gchar * host,
+                         gboolean use_ssl)
 {
     g_return_if_fail(server != NULL);
     g_return_if_fail(LIBBALSA_IS_SERVER(server));
 
     g_signal_emit(G_OBJECT(server), libbalsa_server_signals[SET_HOST],
-                  0, host, use_ssl);
+                 0, host, use_ssl);
 
 }
 
-
 void
-libbalsa_server_config_changed(LibBalsaServer *server)
+libbalsa_server_config_changed(LibBalsaServer * server)
 {
     g_return_if_fail(server != NULL);
     g_return_if_fail(LIBBALSA_IS_SERVER(server));
@@ -260,10 +250,9 @@ libbalsa_server_config_changed(LibBalsaServer *server)
                   0);
 }
 
-
 gchar *
-libbalsa_server_get_password(LibBalsaServer  *server,
-                             LibBalsaMailbox *mbox)
+libbalsa_server_get_password(LibBalsaServer * server,
+                            LibBalsaMailbox * mbox)
 {
     gchar *retval = NULL;
 
@@ -275,10 +264,9 @@ libbalsa_server_get_password(LibBalsaServer  *server,
     return retval;
 }
 
-
 static void
-libbalsa_server_real_set_username(LibBalsaServer *server,
-                                  const gchar    *username)
+libbalsa_server_real_set_username(LibBalsaServer * server,
+                                 const gchar * username)
 {
     g_return_if_fail(LIBBALSA_IS_SERVER(server));
 
@@ -286,11 +274,9 @@ libbalsa_server_real_set_username(LibBalsaServer *server,
     server->user = g_strdup(username);
 }
 
-
 static void
-libbalsa_server_real_set_host(LibBalsaServer *server,
-                              const gchar    *host,
-                              gboolean        use_ssl)
+libbalsa_server_real_set_host(LibBalsaServer * server, const gchar * host,
+                              gboolean use_ssl)
 {
     g_return_if_fail(LIBBALSA_IS_SERVER(server));
 
@@ -302,29 +288,27 @@ libbalsa_server_real_set_host(LibBalsaServer *server,
 
 #if 0
 static gchar *
-libbalsa_server_real_get_password(LibBalsaServer *server)
+libbalsa_server_real_get_password(LibBalsaServer * server)
 {
     g_return_val_if_fail(LIBBALSA_IS_SERVER(server), NULL);
 
     return g_strdup(server->passwd);
 }
-
-
 #endif
 
 
 /* libbalsa_server_load_config:
    load the server configuration using gnome-config.
-   Try to use sensible defaults.
+   Try to use sensible defaults. 
    FIXME: Port field is kept here only for compatibility, drop after 1.4.x
    release.
- */
+*/
 void
-libbalsa_server_load_config(LibBalsaServer *server)
+libbalsa_server_load_config(LibBalsaServer * server)
 {
     gboolean d;
     server->host = libbalsa_conf_get_string("Server");
-    if (server->host && (strrchr(server->host, ':') == NULL)) {
+    if(server->host && strrchr(server->host, ':') == NULL) {
         gint port;
         port = libbalsa_conf_get_int_with_default("Port", &d);
         if (!d) {
@@ -332,27 +316,24 @@ libbalsa_server_load_config(LibBalsaServer *server)
             g_free(server->host);
             server->host = newhost;
         }
-    }
+    }       
     server->use_ssl = libbalsa_conf_get_bool("SSL=false");
     d = FALSE;
     server->tls_mode = libbalsa_conf_get_int_with_default("TLSMode", &d);
-    if (d) {
-        server->tls_mode = LIBBALSA_TLS_ENABLED;
-    }
+    if(d) server->tls_mode = LIBBALSA_TLS_ENABLED;
     d = FALSE;
     server->security = libbalsa_conf_get_int_with_default("Security", &d);
     if (d) {
-        server->security = NET_CLIENT_CRYPT_STARTTLS;
+       server->security = NET_CLIENT_CRYPT_STARTTLS;
     }
     server->user = libbalsa_conf_private_get_string("Username");
-    if (!server->user) {
-        server->user = g_strdup(getenv("USER"));
-    }
+    if (!server->user)
+       server->user = g_strdup(getenv("USER"));
 
     server->try_anonymous = libbalsa_conf_get_bool("Anonymous=false");
     server->remember_passwd = libbalsa_conf_get_bool("RememberPasswd=false");
 
-    if (server->remember_passwd) {
+    if(server->remember_passwd) {
 #if defined(HAVE_LIBSECRET)
         GError *err = NULL;
 
@@ -360,8 +341,8 @@ libbalsa_server_load_config(LibBalsaServer *server)
             secret_password_lookup_sync(LIBBALSA_SERVER_SECRET_SCHEMA,
                                         NULL, &err,
                                         "protocol", server->protocol,
-                                        "server", server->host,
-                                        "user", server->user,
+                                        "server",   server->host,
+                                        "user",     server->user,
                                         NULL);
         if (err) {
             libbalsa_free_password(server->passwd);
@@ -377,11 +358,11 @@ libbalsa_server_load_config(LibBalsaServer *server)
                 server->passwd = buff;
                 secret_password_store_sync
                     (LIBBALSA_SERVER_SECRET_SCHEMA, NULL,
-                    _("Balsa passwords"), server->passwd, NULL, &err,
-                    "protocol", server->protocol,
-                    "server", server->host,
-                    "user", server->user,
-                    NULL);
+                     _("Balsa passwords"), server->passwd, NULL, &err,
+                     "protocol", server->protocol,
+                     "server",   server->host,
+                     "user",     server->user,
+                     NULL);
                 /* We could in principle clear the password in the
                  * config file here but we do not for the backward
                  * compatibility. */
@@ -393,17 +374,17 @@ libbalsa_server_load_config(LibBalsaServer *server)
             }
         }
 #else
-        server->passwd = libbalsa_conf_private_get_string("Password");
-        if (server->passwd != NULL) {
-            gchar *buff = libbalsa_rot(server->passwd);
-            libbalsa_free_password(server->passwd);
-            server->passwd = buff;
-        }
+       server->passwd = libbalsa_conf_private_get_string("Password");
+       if (server->passwd != NULL) {
+           gchar *buff = libbalsa_rot(server->passwd);
+           libbalsa_free_password(server->passwd);
+           server->passwd = buff;
+       }
 #endif
     }
-    if (server->passwd && (server->passwd[0] == '\0')) {
-        libbalsa_free_password(server->passwd);
-        server->passwd = NULL;
+    if(server->passwd && server->passwd[0] == '\0') {
+       libbalsa_free_password(server->passwd);
+       server->passwd = NULL;
     }
 
     server->client_cert = libbalsa_conf_get_bool("NeedClientCert=false");
@@ -415,28 +396,27 @@ libbalsa_server_load_config(LibBalsaServer *server)
         g_free(server->cert_passphrase);
         server->cert_passphrase = tmp;
     } else {
-        g_free(server->cert_passphrase);
-        server->cert_passphrase = NULL;
+       g_free(server->cert_passphrase);
+       server->cert_passphrase = NULL;
     }
 }
 
-
 /* libbalsa_server_save_config:
    save config.
    It is bit tricky to decide the value of the remember_passwd field.
-   Should empty values be remembered? Even if they are, balsa will
+   Should empty values be remembered? Even if they are, balsa will 
    still ask for the password if it is empty.
- */
+*/
 void
-libbalsa_server_save_config(LibBalsaServer *server)
+libbalsa_server_save_config(LibBalsaServer * server)
 {
     libbalsa_conf_set_string("Server", server->host);
     libbalsa_conf_private_set_string("Username", server->user);
-    libbalsa_conf_set_bool("Anonymous", server->try_anonymous);
-    libbalsa_conf_set_bool("RememberPasswd",
-                           server->remember_passwd && server->passwd != NULL);
+    libbalsa_conf_set_bool("Anonymous",          server->try_anonymous);
+    libbalsa_conf_set_bool("RememberPasswd", 
+                          server->remember_passwd && server->passwd != NULL);
 
-    if (server->remember_passwd && (server->passwd != NULL)) {
+    if (server->remember_passwd && server->passwd != NULL) {
 #if defined(HAVE_LIBSECRET)
         GError *err = NULL;
 
@@ -444,8 +424,8 @@ libbalsa_server_save_config(LibBalsaServer *server)
                                    _("Balsa passwords"), server->passwd,
                                    NULL, &err,
                                    "protocol", server->protocol,
-                                   "server", server->host,
-                                   "user", server->user,
+                                   "server",   server->host,
+                                   "user",     server->user,
                                    NULL);
         if (err) {
             printf(_("Error storing password for %s@%s: %s\n"),
@@ -453,15 +433,15 @@ libbalsa_server_save_config(LibBalsaServer *server)
             g_error_free(err);
         }
 #else
-        gchar *buff = libbalsa_rot(server->passwd);
-        libbalsa_conf_private_set_string("Password", buff);
-        g_free(buff);
+       gchar *buff = libbalsa_rot(server->passwd);
+       libbalsa_conf_private_set_string("Password", buff);
+       g_free(buff);
 #endif                          /* defined(HAVE_LIBSECRET) */
     }
 
     libbalsa_conf_set_bool("NeedClientCert", server->client_cert);
     if (server->cert_file != NULL) {
-        libbalsa_conf_set_string("UserCertificateFile", server->cert_file);
+       libbalsa_conf_set_string("UserCertificateFile", server->cert_file);
     }
     if (server->cert_passphrase != NULL) {
         gchar *tmp = libbalsa_rot(server->cert_passphrase);
@@ -475,121 +455,102 @@ libbalsa_server_save_config(LibBalsaServer *server)
     libbalsa_conf_set_int("Security", server->security);
 }
 
-
 void
-libbalsa_server_user_cb(ImapUserEventType ue,
-                        void             *arg,
-                        ...)
+libbalsa_server_user_cb(ImapUserEventType ue, void *arg, ...)
 {
     va_list alist;
     int *ok;
     LibBalsaServer *is = LIBBALSA_SERVER(arg);
 
     va_start(alist, arg);
-    switch (ue) {
+    switch(ue) {
     case IME_GET_USER_PASS: {
-        gchar *method = va_arg(alist, gchar *);
-        gchar **user = va_arg(alist, gchar **);
-        gchar **pass = va_arg(alist, gchar **);
-        ok = va_arg(alist, int *);
-        if (!is->passwd) {
+        gchar *method = va_arg(alist, gchar*);
+        gchar **user = va_arg(alist, gchar**);
+        gchar **pass = va_arg(alist, gchar**);
+        ok = va_arg(alist, int*);
+        if(!is->passwd) {
             is->passwd = libbalsa_server_get_password(is, NULL);
         }
         *ok = is->passwd != NULL;
-        if (*ok) {
-            g_free(*user);
-            *user = g_strdup(is->user);
-            g_free(*pass);
-            *pass = g_strdup(is->passwd);
+        if(*ok) {
+            g_free(*user); *user = g_strdup(is->user);
+            g_free(*pass); *pass = g_strdup(is->passwd);
             libbalsa_information(LIBBALSA_INFORMATION_DEBUG,
                                  /* host, authentication method */
-                                 _("Logging in to %s using %s"),
-                                 is->host, method);
+                                 _("Logging in to %s using %s"), 
+                                   is->host, method);
         }
         break;
     }
-
     case IME_GET_USER:  { /* for eg kerberos */
         gchar **user;
-        va_arg(alist, gchar *); /* Ignore the method */
-        user = va_arg(alist, gchar **);
-        ok = va_arg(alist, int *);
+        va_arg(alist, gchar*); /* Ignore the method */
+        user = va_arg(alist, gchar**);
+        ok = va_arg(alist, int*);
         *ok = 1; /* consider popping up a dialog window here */
-        g_free(*user);
-        *user = g_strdup(is->user);
+        g_free(*user); *user = g_strdup(is->user);
         break;
     }
-
     case IME_TLS_VERIFY_ERROR:  {
         long vfy_result;
         SSL *ssl;
         X509 *cert;
-        ok = va_arg(alist, int *);
+        ok = va_arg(alist, int*);
         vfy_result = va_arg(alist, long);
         X509_verify_cert_error_string(vfy_result);
 #if 0
         printf("IMAP:TLS: failed cert verification: %ld : %s.\n",
                vfy_result, reason);
 #endif
-        ssl = va_arg(alist, SSL *);
+        ssl = va_arg(alist, SSL*);
         cert = SSL_get_peer_certificate(ssl);
-        if (cert) {
-            *ok = libbalsa_is_cert_known(cert, vfy_result);
-            X509_free(cert);
-        }
+       if(cert) {
+           *ok = libbalsa_is_cert_known(cert, vfy_result);
+           X509_free(cert);
+       }
         break;
     }
-
     case IME_TLS_NO_PEER_CERT: {
-        ok = va_arg(alist, int *);
-        *ok = 0;
+        ok = va_arg(alist, int*); *ok = 0;
         printf("IMAP:TLS: Server presented no cert!\n");
         break;
     }
-
     case IME_TLS_WEAK_CIPHER: {
-        ok = va_arg(alist, int *);
-        *ok = 1;
+        ok = va_arg(alist, int*); *ok = 1;
         printf("IMAP:TLS: Weak cipher accepted.\n");
         break;
     }
-
     case IME_TIMEOUT: {
-        ok = va_arg(alist, int *);
-        *ok = 1;
+        ok = va_arg(alist, int*); *ok = 1;
         /* *ok = libbalsa_abort_on_timeout(is->host); */
         /* For now, always timeout. The UI needs some work. */
         break;
     }
-
-    default: g_warning("unhandled imap event type! Fix the code.");
-        break;
+    default: g_warning("unhandled imap event type! Fix the code."); break;
     }
     va_end(alist);
 }
 
-
 /* Connect the server's "get-password" signal to the callback; if the
  * ask-password callback is connected more than once, the dialog is
  * popped up the corresponding number of times, so we'll ignore the
  * request if a callback is already connected. */
 void
-libbalsa_server_connect_signals(LibBalsaServer *server,
-                                GCallback       cb,
-                                gpointer        cb_data)
+libbalsa_server_connect_signals(LibBalsaServer * server, GCallback cb,
+                                gpointer cb_data)
 {
     if (!g_signal_has_handler_pending(server,
                                       libbalsa_server_signals
-                                      [GET_PASSWORD], 0, TRUE)) {
+                                      [GET_PASSWORD], 0, TRUE))
         g_signal_connect(server, "get-password", cb, cb_data);
-    }
 }
 
 
 gchar **
 libbalsa_server_get_auth(NetClient *client,
-                         gboolean   need_passwd,
-                         gpointer   user_data)
+                                                gboolean   need_passwd,
+                                        gpointer   user_data)
 {
     LibBalsaServer *server = LIBBALSA_SERVER(user_data);
     gchar **result = NULL;
@@ -600,11 +561,11 @@ libbalsa_server_get_auth(NetClient *client,
         result = g_new0(gchar *, 3U);
         result[0] = g_strdup(server->user);
         if (need_passwd) {
-            if ((server->passwd != NULL) && (server->passwd[0] != '\0')) {
-                result[1] = g_strdup(server->passwd);
-            } else {
-                result[1] = libbalsa_server_get_password(server, NULL);
-            }
+               if ((server->passwd != NULL) && (server->passwd[0] != '\0')) {
+                       result[1] = g_strdup(server->passwd);
+               } else {
+                       result[1] = libbalsa_server_get_password(server, NULL);
+               }
         }
     }
     return result;
@@ -613,9 +574,9 @@ libbalsa_server_get_auth(NetClient *client,
 
 gboolean
 libbalsa_server_check_cert(NetClient           *client,
-                           GTlsCertificate     *peer_cert,
-                           GTlsCertificateFlags errors,
-                           gpointer             user_data)
+                                          GTlsCertificate     *peer_cert,
+                                                  GTlsCertificateFlags errors,
+                                                  gpointer             user_data)
 {
     GByteArray *cert_der = NULL;
     gboolean result = FALSE;
@@ -666,27 +627,25 @@ libbalsa_server_check_cert(NetClient           *client,
 
 gchar *
 libbalsa_server_get_cert_pass(NetClient        *client,
-                              const GByteArray *cert_der,
-                              gpointer          user_data)
+                                                         const GByteArray *cert_der,
+                                                         gpointer          user_data)
 {
-    /* FIXME - we just return the passphrase from the config, but we may also want to show a
-       dialogue here... */
-    return g_strdup(LIBBALSA_SERVER(user_data)->cert_passphrase);
+       /* FIXME - we just return the passphrase from the config, but we may also want to show a dialogue 
here... */
+       return g_strdup(LIBBALSA_SERVER(user_data)->cert_passphrase);
 }
 
-
 /* Test whether a server is reachable */
 
 typedef struct {
-    LibBalsaCanReachCallback *cb;
-    gpointer cb_data;
-    GObject *source_object;
+    LibBalsaCanReachCallback * cb;
+    gpointer                   cb_data;
+    GObject                  * source_object;
 } CanReachInfo;
 
 static void
-libbalsa_server_can_reach_cb(GObject      *monitor,
-                             GAsyncResult *res,
-                             gpointer      user_data)
+libbalsa_server_can_reach_cb(GObject      * monitor,
+                             GAsyncResult * res,
+                             gpointer       user_data)
 {
     CanReachInfo *info = user_data;
     gboolean can_reach;
@@ -698,12 +657,11 @@ libbalsa_server_can_reach_cb(GObject      *monitor,
     g_free(info);
 }
 
-
 void
-libbalsa_server_test_can_reach_full(LibBalsaServer           *server,
-                                    LibBalsaCanReachCallback *cb,
-                                    gpointer                  cb_data,
-                                    GObject                  *source_object)
+libbalsa_server_test_can_reach_full(LibBalsaServer           * server,
+                                    LibBalsaCanReachCallback * cb,
+                                    gpointer                   cb_data,
+                                    GObject                  * source_object)
 {
     CanReachInfo *info;
     gchar *host;
@@ -712,8 +670,8 @@ libbalsa_server_test_can_reach_full(LibBalsaServer           *server,
     GSocketConnectable *address;
 
     info = g_new(CanReachInfo, 1);
-    info->cb = cb;
-    info->cb_data = cb_data;
+    info->cb              = cb;
+    info->cb_data         = cb_data;
     info->source_object = g_object_ref(source_object);
 
     monitor = g_network_monitor_get_default();
@@ -721,7 +679,7 @@ libbalsa_server_test_can_reach_full(LibBalsaServer           *server,
     host = g_strdup(server->host);
     colon = strchr(host, ':');
     if (colon != NULL) {
-        colon[0] = '\0';
+       colon[0] = '\0';
     }
     address = g_network_address_new(host, 0);
     g_free(host);
@@ -730,11 +688,10 @@ libbalsa_server_test_can_reach_full(LibBalsaServer           *server,
     g_object_unref(address);
 }
 
-
 void
-libbalsa_server_test_can_reach(LibBalsaServer           *server,
-                               LibBalsaCanReachCallback *cb,
-                               gpointer                  cb_data)
+libbalsa_server_test_can_reach(LibBalsaServer           * server,
+                               LibBalsaCanReachCallback * cb,
+                               gpointer                   cb_data)
 {
     libbalsa_server_test_can_reach_full(server, cb, cb_data, (GObject *) server);
 }
diff --git a/libbalsa/server.h b/libbalsa/server.h
index d084436..2f47088 100644
--- a/libbalsa/server.h
+++ b/libbalsa/server.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -22,7 +22,7 @@
 #define __LIBBALSA_SERVER_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include "imap/libimap.h"
@@ -30,11 +30,11 @@
 #include "net-client.h"
 
 #if defined(HAVE_LIBSECRET)
-#   include <libsecret/secret.h>
+#include <libsecret/secret.h>
 extern const SecretSchema *LIBBALSA_SERVER_SECRET_SCHEMA;
-#   define libbalsa_free_password secret_password_free
+#define libbalsa_free_password secret_password_free
 #else
-#   define libbalsa_free_password g_free
+#define libbalsa_free_password g_free
 #endif                          /* defined(HAVE_LIBSECRET) */
 
 #define LIBBALSA_TYPE_SERVER \
@@ -74,70 +74,64 @@ struct _LibBalsaServer {
      * between SSL and non-SSL builds. We just fail if SSL is requested
      * in non-SSL build. */
     LibBalsaTlsMode tls_mode;
-    unsigned use_ssl : 1;
-    unsigned remember_passwd : 1;
-    unsigned try_anonymous : 1; /* user wants anonymous access */
+    unsigned use_ssl:1;
+    unsigned remember_passwd:1;
+    unsigned try_anonymous:1; /* user wants anonymous access */
 };
 
 struct _LibBalsaServerClass {
     GObjectClass parent_class;
 
-    void (*set_username) (LibBalsaServer *server,
-                          const gchar    *name);
-    void (*set_host) (LibBalsaServer *server,
-                      const gchar    *host,
-                      gboolean        use_ssl);
-    void (*config_changed) (LibBalsaServer *server);
-    gchar *(*get_password) (LibBalsaServer *server);
+    void (*set_username) (LibBalsaServer * server, const gchar * name);
+    void (*set_host) (LibBalsaServer * server,
+                     const gchar * host, gboolean use_ssl);
+    void (*config_changed) (LibBalsaServer * server);
+    gchar *(*get_password) (LibBalsaServer * server);
 };
 
 LibBalsaServer *libbalsa_server_new(void);
 
-void libbalsa_server_set_username(LibBalsaServer *server,
-                                  const gchar    *username);
-void libbalsa_server_set_password(LibBalsaServer *server,
-                                  const gchar    *passwd);
-void libbalsa_server_set_host(LibBalsaServer *server,
-                              const gchar    *host,
-                              gboolean        use_ssl);
-gchar *libbalsa_server_get_password(LibBalsaServer  *server,
-                                    LibBalsaMailbox *mbox);
+void libbalsa_server_set_username(LibBalsaServer * server,
+                                 const gchar * username);
+void libbalsa_server_set_password(LibBalsaServer * server,
+                                 const gchar * passwd);
+void libbalsa_server_set_host(LibBalsaServer * server, const gchar * host,
+                              gboolean use_ssl);
+gchar *libbalsa_server_get_password(LibBalsaServer * server,
+                                   LibBalsaMailbox * mbox);
 
-void libbalsa_server_config_changed(LibBalsaServer *server);
-void libbalsa_server_load_config(LibBalsaServer *server);
-void libbalsa_server_save_config(LibBalsaServer *server);
+void libbalsa_server_config_changed(LibBalsaServer * server);
+void libbalsa_server_load_config(LibBalsaServer * server);
+void libbalsa_server_save_config(LibBalsaServer * server);
 
 
-void libbalsa_server_user_cb(ImapUserEventType ue,
-                             void             *arg,
-                             ...);
+void libbalsa_server_user_cb(ImapUserEventType ue, void *arg, ...);
 
 /* NetClient related signal handlers */
 gchar **libbalsa_server_get_auth(NetClient *client,
-                                 gboolean   need_passwd,
-                                 gpointer   user_data);
+                                                                gboolean   need_passwd,
+                                                                gpointer   user_data);
 gboolean libbalsa_server_check_cert(NetClient           *client,
-                                    GTlsCertificate     *peer_cert,
-                                    GTlsCertificateFlags errors,
-                                    gpointer             user_data);
+                                                           GTlsCertificate     *peer_cert,
+                                                                       GTlsCertificateFlags errors,
+                                                                       gpointer             user_data);
 gchar *libbalsa_server_get_cert_pass(NetClient        *client,
-                                     const GByteArray *cert_der,
-                                     gpointer          user_data);
+                                                                        const GByteArray *cert_der,
+                                                                        gpointer          user_data);
 
-void libbalsa_server_connect_signals(LibBalsaServer *server,
-                                     GCallback       cb,
-                                     gpointer        cb_data);
+void libbalsa_server_connect_signals(LibBalsaServer * server, GCallback cb,
+                                     gpointer cb_data);
 
 /* Check whether a server can be reached */
 
-void libbalsa_server_test_can_reach(LibBalsaServer           *server,
-                                    LibBalsaCanReachCallback *cb,
-                                    gpointer                  cb_data);
+void libbalsa_server_test_can_reach(LibBalsaServer           * server,
+                                    LibBalsaCanReachCallback * cb,
+                                    gpointer                   cb_data);
 
 /* Private: used only by LibBalsaMailboxRemote */
-void libbalsa_server_test_can_reach_full(LibBalsaServer           *server,
-                                         LibBalsaCanReachCallback *cb,
-                                         gpointer                  cb_data,
-                                         GObject                  *source_object);
+void libbalsa_server_test_can_reach_full(LibBalsaServer           * server,
+                                         LibBalsaCanReachCallback * cb,
+                                         gpointer                   cb_data,
+                                         GObject                  * source_object);
 
-#endif                          /* __LIBBALSA_SERVER_H__ */
+#endif                         /* __LIBBALSA_SERVER_H__ */
diff --git a/libbalsa/smtp-server.c b/libbalsa/smtp-server.c
index fc4f63a..7020018 100644
--- a/libbalsa/smtp-server.c
+++ b/libbalsa/smtp-server.c
@@ -6,19 +6,19 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 /*
@@ -36,7 +36,7 @@
 #include "net-client.h"
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#  include "macosx-helpers.h"
 #endif
 
 static LibBalsaServerClass *parent_class = NULL;
@@ -46,7 +46,7 @@ struct _LibBalsaSmtpServer {
 
     gchar *name;
     guint big_message; /* size of partial messages; in kB; 0 disables splitting */
-    gint lock_state;    /* 0 means unlocked; access via atomic operations */
+    gint lock_state;   /* 0 means unlocked; access via atomic operations */
 };
 
 typedef struct _LibBalsaSmtpServerClass {
@@ -58,7 +58,7 @@ typedef struct _LibBalsaSmtpServerClass {
 /* Object class method */
 
 static void
-libbalsa_smtp_server_finalize(GObject *object)
+libbalsa_smtp_server_finalize(GObject * object)
 {
     LibBalsaSmtpServer *smtp_server;
 
@@ -71,9 +71,8 @@ libbalsa_smtp_server_finalize(GObject *object)
     G_OBJECT_CLASS(parent_class)->finalize(object);
 }
 
-
 static void
-libbalsa_smtp_server_class_init(LibBalsaSmtpServerClass *klass)
+libbalsa_smtp_server_class_init(LibBalsaSmtpServerClass * klass)
 {
     GObjectClass *object_class;
 
@@ -84,14 +83,12 @@ libbalsa_smtp_server_class_init(LibBalsaSmtpServerClass *klass)
     object_class->finalize = libbalsa_smtp_server_finalize;
 }
 
-
 static void
-libbalsa_smtp_server_init(LibBalsaSmtpServer *smtp_server)
+libbalsa_smtp_server_init(LibBalsaSmtpServer * smtp_server)
 {
     LIBBALSA_SERVER(smtp_server)->protocol = "smtp";
 }
 
-
 /* Class boilerplate */
 
 GType
@@ -120,7 +117,6 @@ libbalsa_smtp_server_get_type(void)
     return server_type;
 }
 
-
 /* Public methods */
 
 /**
@@ -145,9 +141,8 @@ libbalsa_smtp_server_new(void)
     return smtp_server;
 }
 
-
 LibBalsaSmtpServer *
-libbalsa_smtp_server_new_from_config(const gchar *name)
+libbalsa_smtp_server_new_from_config(const gchar * name)
 {
     LibBalsaSmtpServer *smtp_server;
 
@@ -161,43 +156,37 @@ libbalsa_smtp_server_new_from_config(const gchar *name)
     return smtp_server;
 }
 
-
 void
-libbalsa_smtp_server_save_config(LibBalsaSmtpServer *smtp_server)
+libbalsa_smtp_server_save_config(LibBalsaSmtpServer * smtp_server)
 {
     libbalsa_server_save_config(LIBBALSA_SERVER(smtp_server));
 
     libbalsa_conf_set_int("BigMessage", smtp_server->big_message);
 }
 
-
 void
-libbalsa_smtp_server_set_name(LibBalsaSmtpServer *smtp_server,
-                              const gchar        *name)
+libbalsa_smtp_server_set_name(LibBalsaSmtpServer * smtp_server,
+                              const gchar * name)
 {
     g_free(smtp_server->name);
     smtp_server->name = g_strdup(name);
 }
 
-
 const gchar *
-libbalsa_smtp_server_get_name(LibBalsaSmtpServer *smtp_server)
+libbalsa_smtp_server_get_name(LibBalsaSmtpServer * smtp_server)
 {
     return smtp_server ? smtp_server->name : _("Default");
 }
 
-
 guint
-libbalsa_smtp_server_get_big_message(LibBalsaSmtpServer *smtp_server)
+libbalsa_smtp_server_get_big_message(LibBalsaSmtpServer * smtp_server)
 {
     /* big_message is stored in kB, but we want the value in bytes. */
     return smtp_server->big_message * 1024;
 }
 
-
 static gint
-smtp_server_compare(gconstpointer a,
-                    gconstpointer b)
+smtp_server_compare(gconstpointer a, gconstpointer b)
 {
     const LibBalsaSmtpServer *smtp_server_a = a;
     const LibBalsaSmtpServer *smtp_server_b = b;
@@ -205,16 +194,15 @@ smtp_server_compare(gconstpointer a,
     return g_strcmp0(smtp_server_a->name, smtp_server_b->name);
 }
 
-
 void
-libbalsa_smtp_server_add_to_list(LibBalsaSmtpServer *smtp_server,
-                                 GSList            **server_list)
+libbalsa_smtp_server_add_to_list(LibBalsaSmtpServer * smtp_server,
+                                 GSList ** server_list)
 {
     GSList *list;
 
     if ((list =
-             g_slist_find_custom(*server_list, smtp_server,
-                                 smtp_server_compare)) != NULL) {
+         g_slist_find_custom(*server_list, smtp_server,
+                             smtp_server_compare)) != NULL) {
         g_object_unref(list->data);
         *server_list = g_slist_delete_link(*server_list, list);
     }
@@ -222,33 +210,30 @@ libbalsa_smtp_server_add_to_list(LibBalsaSmtpServer *smtp_server,
     *server_list = g_slist_prepend(*server_list, smtp_server);
 }
 
-
 gboolean
 libbalsa_smtp_server_trylock(LibBalsaSmtpServer *smtp_server)
 {
-    gint prev_state;
-    gboolean result;
-
-    prev_state = g_atomic_int_add(&smtp_server->lock_state, 1);
-    if (prev_state == 0) {
-        result = TRUE;
-    } else {
-        result = FALSE;
-        (void) g_atomic_int_dec_and_test(&smtp_server->lock_state);
-    }
-    g_debug("%s: lock %s: %d", __func__, libbalsa_smtp_server_get_name(smtp_server), result);
-    return result;
+       gint prev_state;
+       gboolean result;
+
+       prev_state = g_atomic_int_add(&smtp_server->lock_state, 1);
+       if (prev_state == 0) {
+               result = TRUE;
+       } else {
+               result = FALSE;
+               (void) g_atomic_int_dec_and_test(&smtp_server->lock_state);
+       }
+       g_debug("%s: lock %s: %d", __func__, libbalsa_smtp_server_get_name(smtp_server), result);
+       return result;
 }
 
-
 void
 libbalsa_smtp_server_unlock(LibBalsaSmtpServer *smtp_server)
 {
-    (void) g_atomic_int_dec_and_test(&smtp_server->lock_state);
-    g_debug("%s: unlock %s", __func__, libbalsa_smtp_server_get_name(smtp_server));
+       (void) g_atomic_int_dec_and_test(&smtp_server->lock_state);
+       g_debug("%s: unlock %s", __func__, libbalsa_smtp_server_get_name(smtp_server));
 }
 
-
 /* SMTP server dialog */
 
 #define LIBBALSA_SMTP_SERVER_DIALOG_KEY "libbalsa-smtp-server-dialog"
@@ -276,47 +261,39 @@ static void
 smtp_server_destroy_notify(struct smtp_server_dialog_info *sdi)
 {
     g_free(sdi->old_name);
-    if (sdi->dialog) {
+    if (sdi->dialog)
         gtk_widget_destroy(sdi->dialog);
-    }
     g_free(sdi);
 }
 
-
 /* GWeakNotify for dialog. */
-static void
-smtp_server_weak_notify(struct smtp_server_dialog_info *sdi,
-                        GObject                        *dialog)
+static void 
+smtp_server_weak_notify(struct smtp_server_dialog_info *sdi, GObject *dialog)
 {
     sdi->dialog = NULL;
     g_object_set_data(G_OBJECT(sdi->smtp_server),
                       LIBBALSA_SMTP_SERVER_DIALOG_KEY, NULL);
 }
 
-
 static void
-smtp_server_add_widget(GtkWidget   *grid,
-                       gint         row,
-                       const gchar *text,
-                       GtkWidget   *widget)
+smtp_server_add_widget(GtkWidget * grid, gint row, const gchar * text,
+                       GtkWidget * widget)
 {
     GtkWidget *label = libbalsa_create_grid_label(text, grid, row);
     gtk_grid_attach(GTK_GRID(grid), widget, 1, row, 1, 1);
     gtk_label_set_mnemonic_widget(GTK_LABEL(label), widget);
 }
 
-
 static
 GtkWidget *
-smtp_server_tls_widget(LibBalsaSmtpServer *smtp_server)
+smtp_server_tls_widget(LibBalsaSmtpServer * smtp_server)
 {
     LibBalsaServer *server = LIBBALSA_SERVER(smtp_server);
     GtkWidget *combo_box = gtk_combo_box_text_new();
 
     gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), _("SMTP over SSL (SMTPS)"));
     gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), _("TLS required"));
-    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box),
-                                   _("TLS if possible (not recommended)"));
+    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), _("TLS if possible (not recommended)"));
     gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), _("None (not recommended)"));
 
     gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), (gint) server->security - 1);
@@ -324,10 +301,8 @@ smtp_server_tls_widget(LibBalsaSmtpServer *smtp_server)
     return combo_box;
 }
 
-
 static void
-smtp_server_response(GtkDialog                      *dialog,
-                     gint                            response,
+smtp_server_response(GtkDialog * dialog, gint response,
                      struct smtp_server_dialog_info *sdi)
 {
     LibBalsaServer *server = LIBBALSA_SERVER(sdi->smtp_server);
@@ -345,24 +320,21 @@ smtp_server_response(GtkDialog                      *dialog,
             g_error_free(error);
         }
         return;
-
     case GTK_RESPONSE_OK:
         libbalsa_smtp_server_set_name(sdi->smtp_server,
                                       gtk_entry_get_text(GTK_ENTRY
-                                                             (sdi->name)));
+                                                         (sdi->name)));
         libbalsa_server_set_host(server,
                                  gtk_entry_get_text(GTK_ENTRY(sdi->host)),
                                  FALSE);
-        server->try_anonymous =
-            gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sdi->auth_button)) ? 0U : 1U;
+        server->try_anonymous = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sdi->auth_button)) ? 0U : 1U;
         libbalsa_server_set_username(server,
                                      gtk_entry_get_text(GTK_ENTRY
-                                                            (sdi->user)));
+                                                        (sdi->user)));
         libbalsa_server_set_password(server,
                                      gtk_entry_get_text(GTK_ENTRY
-                                                            (sdi->pass)));
-        server->security =
-            (NetClientCryptMode) (gtk_combo_box_get_active(GTK_COMBO_BOX(sdi->tlsm)) + 1);
+                                                        (sdi->pass)));
+        server->security = (NetClientCryptMode) (gtk_combo_box_get_active(GTK_COMBO_BOX(sdi->tlsm)) + 1);
         server->client_cert = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sdi->cert_button));
         g_free(server->cert_file);
         server->cert_file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(sdi->cert_file));
@@ -371,13 +343,12 @@ smtp_server_response(GtkDialog                      *dialog,
             gtk_editable_get_chars(GTK_EDITABLE(sdi->cert_pass), 0, -1);
         if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sdi->split_button))) {
             /* big_message is stored in kB, but the widget is in MB. */
-            sdi->smtp_server->big_message =
+               sdi->smtp_server->big_message =
                 gtk_spin_button_get_value(GTK_SPIN_BUTTON(sdi->big_message)) * 1024.0;
         } else {
-            sdi->smtp_server->big_message = 0U;
+               sdi->smtp_server->big_message = 0U;
         }
         break;
-
     default:
         break;
     }
@@ -392,73 +363,67 @@ smtp_server_response(GtkDialog                      *dialog,
     gtk_widget_destroy(GTK_WIDGET(dialog));
 }
 
-
 static void
-smtp_server_changed(GtkWidget G_GNUC_UNUSED        *widget,
+smtp_server_changed(GtkWidget G_GNUC_UNUSED *widget,
                     struct smtp_server_dialog_info *sdi)
 {
-    gboolean sensitive;
-    gboolean enable_ok = FALSE;
+       gboolean sensitive;
+       gboolean enable_ok = FALSE;
 
-    /* enable ok button only if a name and a host have been given */
+       /* enable ok button only if a name and a host have been given */
     if ((sdi->name != NULL) && (sdi->host != NULL)) {
-        enable_ok = (*gtk_entry_get_text(GTK_ENTRY(sdi->name)) != '\0')
-            && (*gtk_entry_get_text(GTK_ENTRY(sdi->host)) != '\0');
-    }
-
-    /* user name/password only if authentication is required */
-    if ((sdi->auth_button != NULL) && (sdi->user != NULL) && (sdi->pass != NULL)) {
-        sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sdi->auth_button));
-        gtk_widget_set_sensitive(sdi->user, sensitive);
-        gtk_widget_set_sensitive(sdi->pass, sensitive);
-
-        /* disable ok if authentication is required, but no user name given */
-        if (sensitive && (*gtk_entry_get_text(GTK_ENTRY(sdi->user)) == '\0')) {
-            enable_ok = FALSE;
-        }
-    }
-
-    /* client certificate and passphrase stuff only if TLS/SSL is enabled */
-    if ((sdi->tlsm != NULL) && (sdi->cert_button != NULL) && (sdi->cert_file != NULL) &&
-        (sdi->cert_pass != NULL)) {
-        sensitive =
-            (NetClientCryptMode) (gtk_combo_box_get_active(GTK_COMBO_BOX(sdi->tlsm)) + 1) !=
-            NET_CLIENT_CRYPT_NONE;
-        gtk_widget_set_sensitive(sdi->cert_button, sensitive);
-        if (sensitive) {
-            sensitive = sensitive &&
-                gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sdi->cert_button));
-        }
-
-        gtk_widget_set_sensitive(sdi->cert_file, sensitive);
-        gtk_widget_set_sensitive(sdi->cert_pass, sensitive);
-
-        /* disable ok if a certificate is required, but no file name given */
-        if (sensitive) {
-            gchar *cert_file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(sdi->cert_file));
-
-            if ((cert_file == NULL) || (cert_file[0] == '\0')) {
-                enable_ok = FALSE;
-            }
-            g_free(cert_file);
-        }
+       enable_ok = (*gtk_entry_get_text(GTK_ENTRY(sdi->name)) != '\0')
+               && (*gtk_entry_get_text(GTK_ENTRY(sdi->host)) != '\0');
     }
 
-    /* split big messages */
-    if ((sdi->big_message != NULL) && (sdi->split_button != NULL)) {
-        sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sdi->split_button));
-        gtk_widget_set_sensitive(sdi->big_message, sensitive);
-    }
+       /* user name/password only if authentication is required */
+       if ((sdi->auth_button != NULL) && (sdi->user != NULL) && (sdi->pass != NULL)) {
+               sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sdi->auth_button));
+               gtk_widget_set_sensitive(sdi->user, sensitive);
+               gtk_widget_set_sensitive(sdi->pass, sensitive);
+
+               /* disable ok if authentication is required, but no user name given */
+               if (sensitive && (*gtk_entry_get_text(GTK_ENTRY(sdi->user)) == '\0')) {
+                       enable_ok = FALSE;
+               }
+       }
+
+       /* client certificate and passphrase stuff only if TLS/SSL is enabled */
+       if ((sdi->tlsm != NULL) && (sdi->cert_button != NULL) && (sdi->cert_file != NULL) && (sdi->cert_pass 
!= NULL)) {
+               sensitive = (NetClientCryptMode) (gtk_combo_box_get_active(GTK_COMBO_BOX(sdi->tlsm)) + 1) != 
NET_CLIENT_CRYPT_NONE;
+               gtk_widget_set_sensitive(sdi->cert_button, sensitive);
+               if (sensitive) {
+                       sensitive = sensitive && 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sdi->cert_button));
+               }
+
+               gtk_widget_set_sensitive(sdi->cert_file, sensitive);
+               gtk_widget_set_sensitive(sdi->cert_pass, sensitive);
+
+               /* disable ok if a certificate is required, but no file name given */
+               if (sensitive) {
+                       gchar *cert_file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(sdi->cert_file));
+
+                       if ((cert_file == NULL) || (cert_file[0] == '\0')) {
+                               enable_ok = FALSE;
+                       }
+                       g_free(cert_file);
+               }
+       }
+
+       /* split big messages */
+       if ((sdi->big_message != NULL) && (sdi->split_button != NULL)) {
+               sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sdi->split_button));
+           gtk_widget_set_sensitive(sdi->big_message, sensitive);
+       }
 
     gtk_dialog_set_response_sensitive(GTK_DIALOG(sdi->dialog), GTK_RESPONSE_OK, enable_ok);
     gtk_dialog_set_default_response(GTK_DIALOG(sdi->dialog),
-                                    enable_ok ? GTK_RESPONSE_OK : GTK_RESPONSE_CANCEL);
+       enable_ok ? GTK_RESPONSE_OK : GTK_RESPONSE_CANCEL);
 }
 
-
 void
-libbalsa_smtp_server_dialog(LibBalsaSmtpServer      *smtp_server,
-                            GtkWindow               *parent,
+libbalsa_smtp_server_dialog(LibBalsaSmtpServer * smtp_server,
+                            GtkWindow * parent,
                             LibBalsaSmtpServerUpdate update)
 {
     LibBalsaServer *server = LIBBALSA_SERVER(smtp_server);
@@ -486,19 +451,19 @@ libbalsa_smtp_server_dialog(LibBalsaSmtpServer      *smtp_server,
     sdi->old_name = g_strdup(libbalsa_smtp_server_get_name(smtp_server));
     sdi->update = update;
     sdi->dialog = dialog =
-            gtk_dialog_new_with_buttons(_("SMTP Server"),
-                                        parent,
-                                        GTK_DIALOG_DESTROY_WITH_PARENT |
-                                        libbalsa_dialog_flags(),
-                                        _("_OK"), GTK_RESPONSE_OK,
-                                        _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                        _("_Help"), GTK_RESPONSE_HELP,
-                                        NULL);
+        gtk_dialog_new_with_buttons(_("SMTP Server"),
+                                    parent,
+                                    GTK_DIALOG_DESTROY_WITH_PARENT |
+                                    libbalsa_dialog_flags(),
+                                    _("_OK"),     GTK_RESPONSE_OK,
+                                    _("_Cancel"), GTK_RESPONSE_CANCEL,
+                                    _("_Help"),   GTK_RESPONSE_HELP,
+                                    NULL);
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(dialog, parent);
 #endif
     g_object_weak_ref(G_OBJECT(dialog),
-                      (GWeakNotify) smtp_server_weak_notify, sdi);
+                   (GWeakNotify) smtp_server_weak_notify, sdi);
     g_signal_connect(G_OBJECT(dialog), "response",
                      G_CALLBACK(smtp_server_response), sdi);
     gtk_dialog_set_default_response(GTK_DIALOG(dialog),
@@ -545,8 +510,7 @@ libbalsa_smtp_server_dialog(LibBalsaSmtpServer      *smtp_server,
     sdi->auth_button = gtk_check_button_new_with_mnemonic(_("Server requires authentication"));
     smtp_server_add_widget(grid, ++row, _("_Authentication:"), sdi->auth_button);
     g_signal_connect(sdi->auth_button, "toggled", G_CALLBACK(smtp_server_changed), sdi);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
-                                     sdi->auth_button), server->try_anonymous == 0U);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sdi->auth_button), server->try_anonymous == 0U);
 
     /* user name and password */
     sdi->user = gtk_entry_new();
@@ -573,23 +537,20 @@ libbalsa_smtp_server_dialog(LibBalsaSmtpServer      *smtp_server,
                              gtk_label_new_with_mnemonic(_("_Advanced")));
 
     /* client certificate and passphrase */
-    sdi->cert_button = gtk_check_button_new_with_mnemonic(_(
-                                                              "Server requires client certificate"));
+    sdi->cert_button = gtk_check_button_new_with_mnemonic(_("Server requires client certificate"));
     smtp_server_add_widget(grid, row, _("_Client Certificate:"), sdi->cert_button);
     g_signal_connect(sdi->cert_button, "toggled", G_CALLBACK(smtp_server_changed), sdi);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sdi->cert_button), server->client_cert);
 
-    sdi->cert_file = gtk_file_chooser_button_new(_(
-                                                     "Choose Client Certificate"),
-                                                 GTK_FILE_CHOOSER_ACTION_OPEN);
+    sdi->cert_file = gtk_file_chooser_button_new(_("Choose Client Certificate"), 
GTK_FILE_CHOOSER_ACTION_OPEN);
     gtk_widget_set_hexpand(sdi->cert_file, TRUE);
     smtp_server_add_widget(grid, ++row, _("Certificate _File:"), sdi->cert_file);
     if (server->cert_file != NULL) {
-        gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(sdi->cert_file), server->cert_file);
+       gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(sdi->cert_file), server->cert_file);
     }
     g_signal_connect(sdi->cert_file, "file-set", G_CALLBACK(smtp_server_changed), sdi);
 
-    sdi->cert_pass = gtk_entry_new();
+       sdi->cert_pass = gtk_entry_new();
     smtp_server_add_widget(grid, ++row, _("Certificate _Pass Phrase:"), sdi->cert_pass);
     g_object_set(G_OBJECT(sdi->cert_pass), "input-purpose", GTK_INPUT_PURPOSE_PASSWORD, NULL);
     gtk_entry_set_visibility(GTK_ENTRY(sdi->cert_pass), FALSE);
diff --git a/libbalsa/smtp-server.h b/libbalsa/smtp-server.h
index 20f5af9..f037d11 100644
--- a/libbalsa/smtp-server.h
+++ b/libbalsa/smtp-server.h
@@ -6,14 +6,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -23,17 +23,17 @@
 #include <gtk/gtk.h>
 #include "libbalsa.h"
 
-#define LIBBALSA_TYPE_SMTP_SERVER                               \
+#define LIBBALSA_TYPE_SMTP_SERVER                              \
     (libbalsa_smtp_server_get_type())
-#define LIBBALSA_SMTP_SERVER(obj)                               \
-    (G_TYPE_CHECK_INSTANCE_CAST(obj, LIBBALSA_TYPE_SMTP_SERVER, \
+#define LIBBALSA_SMTP_SERVER(obj)                              \
+    (G_TYPE_CHECK_INSTANCE_CAST(obj, LIBBALSA_TYPE_SMTP_SERVER,        \
                                 LibBalsaSmtpServer))
-#define LIBBALSA_SMTP_SERVER_CLASS(klass)                       \
-    (G_TYPE_CHECK_CLASS_CAST(klass, LIBBALSA_TYPE_SMTP_SERVER,  \
+#define LIBBALSA_SMTP_SERVER_CLASS(klass)                      \
+    (G_TYPE_CHECK_CLASS_CAST(klass, LIBBALSA_TYPE_SMTP_SERVER, \
                              LibBalsaSmtpServerClass))
-#define LIBBALSA_IS_SMTP_SERVER(obj)                            \
+#define LIBBALSA_IS_SMTP_SERVER(obj)                           \
     (G_TYPE_CHECK_INSTANCE_TYPE(obj, LIBBALSA_TYPE_SMTP_SERVER))
-#define LIBBALSA_IS_SMTP_SERVER_CLASS(klass)                    \
+#define LIBBALSA_IS_SMTP_SERVER_CLASS(klass)                   \
     (G_TYPE_CHECK_CLASS_TYPE(klass, LIBBALSA_TYPE_SMTP_SERVER))
 
 GType libbalsa_smtp_server_get_type(void);
@@ -41,21 +41,21 @@ GType libbalsa_smtp_server_get_type(void);
 LibBalsaSmtpServer *libbalsa_smtp_server_new(void);
 LibBalsaSmtpServer *libbalsa_smtp_server_new_from_config(const gchar *
                                                          name);
-void libbalsa_smtp_server_save_config(LibBalsaSmtpServer *server);
-void libbalsa_smtp_server_set_name(LibBalsaSmtpServer *smtp_server,
-                                   const gchar        *name);
+void libbalsa_smtp_server_save_config(LibBalsaSmtpServer * server);
+void libbalsa_smtp_server_set_name(LibBalsaSmtpServer * smtp_server,
+                                   const gchar * name);
 const gchar *libbalsa_smtp_server_get_name(LibBalsaSmtpServer *
                                            smtp_server);
 guint libbalsa_smtp_server_get_big_message(LibBalsaSmtpServer *
                                            smtp_server);
-void libbalsa_smtp_server_add_to_list(LibBalsaSmtpServer *smtp_server,
-                                      GSList            **server_list);
+void libbalsa_smtp_server_add_to_list(LibBalsaSmtpServer * smtp_server,
+                                      GSList ** server_list);
 
-typedef void (*LibBalsaSmtpServerUpdate) (LibBalsaSmtpServer *smtp_server,
-                                          GtkResponseType     response,
-                                          const gchar        *old_name);
-void libbalsa_smtp_server_dialog(LibBalsaSmtpServer      *smtp_server,
-                                 GtkWindow               *parent,
+typedef void (*LibBalsaSmtpServerUpdate) (LibBalsaSmtpServer * smtp_server,
+                                          GtkResponseType response,
+                                          const gchar * old_name);
+void libbalsa_smtp_server_dialog(LibBalsaSmtpServer * smtp_server,
+                                 GtkWindow * parent,
                                  LibBalsaSmtpServerUpdate update);
 
 gboolean libbalsa_smtp_server_trylock(LibBalsaSmtpServer *smtp_server);
diff --git a/libbalsa/source-viewer.c b/libbalsa/source-viewer.c
index 913c4d0..132509a 100644
--- a/libbalsa/source-viewer.c
+++ b/libbalsa/source-viewer.c
@@ -4,24 +4,24 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-/* this is simple window that reads text from given file and shows
+/* this is simple window that reads text from given file and shows 
    in in a GtkText widget.
- */
+*/
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <stdio.h>
@@ -44,18 +44,17 @@ typedef struct {
 } LibBalsaSourceViewerInfo;
 
 static void
-lsv_close_activated(GSimpleAction *action,
-                    GVariant      *parameter,
-                    gpointer       user_data)
+lsv_close_activated(GSimpleAction * action,
+                    GVariant      * parameter,
+                    gpointer        user_data)
 {
     gtk_widget_destroy(GTK_WIDGET(user_data));
 }
 
-
 static void
-lsv_copy_activated(GSimpleAction *action,
-                   GVariant      *parameter,
-                   gpointer       user_data)
+lsv_copy_activated(GSimpleAction * action,
+                   GVariant      * parameter,
+                   gpointer        user_data)
 {
     LibBalsaSourceViewerInfo *lsvi =
         g_object_get_data(G_OBJECT(user_data), "lsvi");
@@ -68,11 +67,10 @@ lsv_copy_activated(GSimpleAction *action,
     gtk_text_buffer_copy_clipboard(buffer, clipboard);
 }
 
-
 static void
-lsv_select_activated(GSimpleAction *action,
-                     GVariant      *parameter,
-                     gpointer       user_data)
+lsv_select_activated(GSimpleAction * action,
+                     GVariant      * parameter,
+                     gpointer        user_data)
 {
     LibBalsaSourceViewerInfo *lsvi =
         g_object_get_data(G_OBJECT(user_data), "lsvi");
@@ -85,11 +83,9 @@ lsv_select_activated(GSimpleAction *action,
     gtk_text_buffer_move_mark_by_name(buffer, "selection_bound", &end);
 }
 
-
 static void
-lsv_show_message(const char               *message,
-                 LibBalsaSourceViewerInfo *lsvi,
-                 gboolean                  escape)
+lsv_show_message(const char *message, LibBalsaSourceViewerInfo * lsvi,
+                 gboolean escape)
 {
     GtkTextBuffer *buffer;
     GtkTextIter start;
@@ -98,26 +94,25 @@ lsv_show_message(const char               *message,
     buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(lsvi->text));
     gtk_text_buffer_set_text(buffer, "", 0);
 
-    if (escape) {
-        tmp = g_strescape(message, "\n“");
-    } else {
-        tmp = g_strdup(message);
-        libbalsa_utf8_sanitize(&tmp, FALSE, NULL);
+    if (escape)
+       tmp = g_strescape(message, "\n“");
+    else {
+       tmp = g_strdup(message);
+       libbalsa_utf8_sanitize(&tmp, FALSE, NULL);
     }
     if (tmp) {
-        gtk_text_buffer_insert_at_cursor(buffer, tmp, -1);
-        g_free(tmp);
+       gtk_text_buffer_insert_at_cursor(buffer, tmp, -1);
+       g_free(tmp);
     }
 
     gtk_text_buffer_get_start_iter(buffer, &start);
     gtk_text_buffer_place_cursor(buffer, &start);
 }
 
-
 static void
-lsv_escape_change_state(GSimpleAction *action,
-                        GVariant      *state,
-                        gpointer       user_data)
+lsv_escape_change_state(GSimpleAction * action,
+                        GVariant      * state,
+                        gpointer        user_data)
 {
     LibBalsaSourceViewerInfo *lsvi =
         g_object_get_data(G_OBJECT(user_data), "lsvi");
@@ -127,15 +122,14 @@ lsv_escape_change_state(GSimpleAction *action,
     char *raw_message;
 
     if (!msg->mailbox) {
-        libbalsa_information(LIBBALSA_INFORMATION_WARNING,
-                             _("Mailbox closed"));
-        return;
+       libbalsa_information(LIBBALSA_INFORMATION_WARNING,
+                            _("Mailbox closed"));
+       return;
     }
     msg_stream = libbalsa_mailbox_get_message_stream(msg->mailbox, msg->msgno,
-                                                     TRUE);
-    if (msg_stream == NULL) {
-        return;
-    }
+                                                    TRUE);
+    if (msg_stream == NULL)
+       return;
 
     mem_stream = g_mime_stream_mem_new();
     libbalsa_mailbox_lock_store(msg->mailbox);
@@ -153,61 +147,54 @@ lsv_escape_change_state(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 static GActionEntry win_entries[] = {
-    {"lsv-close", lsv_close_activated},
-    {"lsv-copy", lsv_copy_activated},
+    {"lsv-close",  lsv_close_activated},
+    {"lsv-copy",   lsv_copy_activated},
     {"lsv-select", lsv_select_activated},
     {"lsv-escape", libbalsa_toggle_activated, NULL, "false",
-     lsv_escape_change_state}
+        lsv_escape_change_state}
 };
 
 static void
-lsv_window_destroy_notify(LibBalsaSourceViewerInfo *lsvi)
+lsv_window_destroy_notify(LibBalsaSourceViewerInfo * lsvi)
 {
     g_object_unref(lsvi->msg);
     g_free(lsvi);
 }
 
-
 /* libbalsa_show_message_source:
    pops up a window containing the source of the message msg.
- */
+*/
 
 static void
-lsv_size_allocate_cb(GtkWidget                *window,
-                     GtkAllocation            *alloc,
-                     gint                      baseline,
-                     GtkAllocation            *clip,
-                     LibBalsaSourceViewerInfo *lsvi)
+lsv_size_allocate_cb(GtkWidget * window, GtkAllocation * alloc,
+                     gint baseline, GtkAllocation * clip,
+                     LibBalsaSourceViewerInfo * lsvi)
 {
     GdkWindow *gdk_window;
     gboolean maximized;
 
     gdk_window = gtk_widget_get_window(window);
-    if (gdk_window == NULL) {
+    if (gdk_window == NULL)
         return;
-    }
 
     maximized =
         (gdk_window_get_state(gdk_window) &
          (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN)) != 0;
 
-    if (!maximized) {
+    if (!maximized)
         gtk_window_get_size(GTK_WINDOW(window), lsvi->width, lsvi->height);
-    }
 }
 
-
 #define BALSA_SOURCE_VIEWER "balsa-source-viewer"
 
 void
-libbalsa_show_message_source(GtkApplication  *application,
-                             LibBalsaMessage *msg,
-                             const gchar     *font,
-                             gboolean        *escape_specials,
-                             gint            *width,
-                             gint            *height)
+libbalsa_show_message_source(GtkApplication  * application,
+                             LibBalsaMessage * msg,
+                             const gchar     * font,
+                            gboolean        * escape_specials,
+                             gint            * width,
+                             gint            * height)
 {
     GtkWidget *text;
     gchar *css;
@@ -232,7 +219,7 @@ libbalsa_show_message_source(GtkApplication  *application,
     gtk_css_provider_load_from_data(css_provider, css, -1);
     g_free(css);
 
-    gtk_style_context_add_provider(gtk_widget_get_style_context(text),
+    gtk_style_context_add_provider(gtk_widget_get_style_context(text) ,
                                    GTK_STYLE_PROVIDER(css_provider),
                                    GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
     g_object_unref(css_provider);
diff --git a/libbalsa/url.c b/libbalsa/url.c
index 8aa74b9..fa2f179 100644
--- a/libbalsa/url.c
+++ b/libbalsa/url.c
@@ -1,25 +1,25 @@
 /*
  * Copyright (C) 2000 Thomas Roessler <roessler guug de>
- *
+ * 
  *     This program is free software; you can redistribute it and/or modify
  *     it under the terms of the GNU General Public License as published by
  *     the Free Software Foundation; either version 2 of the License, or
  *     (at your option) any later version.
- *
+ * 
  *     This program is distributed in the hope that it will be useful,
  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *     GNU General Public License for more details.
- *
+ * 
  *     You should have received a copy of the GNU General Public License
  *     along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
+ */ 
 
 /*
  * A simple URL parser.
  */
 
-#define _DEFAULT_SOURCE 1
+#define _DEFAULT_SOURCE 1 
 
 #include <stdio.h>
 #include <ctype.h>
@@ -33,248 +33,217 @@
 
 
 int Index_hex[128] = {
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
-    -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
+    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
+    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
+     0, 1, 2, 3,  4, 5, 6, 7,  8, 9,-1,-1, -1,-1,-1,-1,
+    -1,10,11,12, 13,14,15,-1, -1,-1,-1,-1, -1,-1,-1,-1,
+    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
+    -1,10,11,12, 13,14,15,-1, -1,-1,-1,-1, -1,-1,-1,-1,
+    -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1
 };
 #define hexval(c) Index_hex[(unsigned int)(c)]
 
-struct mapping_t {
-    char *name;
-    int value;
+struct mapping_t
+{
+  char *name;
+  int value;
 };
 
 static struct mapping_t UrlMap[] =
 {
-    { "file", U_FILE },
-    { "imap", U_IMAP },
-    { "imaps", U_IMAPS },
-    { "pop", U_POP  },
-    { "pops", U_POPS  },
-    { "mailto", U_MAILTO },
-    { NULL, U_UNKNOWN}
+  { "file",    U_FILE },
+  { "imap",    U_IMAP },
+  { "imaps",   U_IMAPS },
+  { "pop",     U_POP  },
+  { "pops",    U_POPS  },
+  { "mailto",  U_MAILTO },
+  { NULL,      U_UNKNOWN}
 };
 
-#define STRING          256
+# define STRING          256
 
 
-static int mutt_getvaluebyname(const char             *name,
-                               const struct mapping_t *map);
-static char *mutt_getnamebyvalue(int,
-                                 const struct mapping_t *);
+static int mutt_getvaluebyname (const char *name, const struct mapping_t *map);
+static char *mutt_getnamebyvalue (int, const struct mapping_t *);
 
 
-static int
-mutt_getvaluebyname(const char             *name,
-                    const struct mapping_t *map)
+static int 
+mutt_getvaluebyname (const char *name, const struct mapping_t *map)
 {
-    int i;
-
-    for (i = 0; map[i].name; i++) {
-        if (g_ascii_strcasecmp (map[i].name, name) == 0) {
-            return (map[i].value);
-        }
-    }
-    return (-1);
+  int i;
+ 
+  for (i = 0; map[i].name; i++)
+    if (g_ascii_strcasecmp (map[i].name, name) == 0)
+      return (map[i].value);
+  return (-1);
 }
 
-
 static char *
-mutt_getnamebyvalue(int                     val,
-                    const struct mapping_t *map)
+mutt_getnamebyvalue (int val, const struct mapping_t *map)
 {
-    int i;
-
-    for (i = 0; map[i].name; i++) {
-        if (map[i].value == val) {
-            return (map[i].name);
-        }
-    }
-    return NULL;
+  int i;
+                                                                                
+  for (i=0; map[i].name; i++)
+    if (map[i].value == val)
+      return (map[i].name);
+  return NULL;
 }
 
 
-static void
-url_pct_decode(char *s)
+static void url_pct_decode (char *s)
 {
-    char *d;
-
-    if (!s) {
-        return;
-    }
-
-    for (d = s; *s; s++) {
-        if ((*s == '%') && s[1] && s[2] &&
-            (hexval (s[1]) >= 0) && (hexval(s[2]) >= 0)) {
-            *d++ = (hexval (s[1]) << 4) | (hexval (s[2]));
-            s += 2;
-        } else {
-            *d++ = *s;
-        }
-    }
-    *d = '\0';
+  char *d;
+
+  if (!s)
+    return;
+  
+  for (d = s; *s; s++)
+  {
+    if (*s == '%' && s[1] && s[2] &&
+       hexval (s[1]) >= 0 && hexval(s[2]) >= 0)
+    {
+      *d++ = (hexval (s[1]) << 4) | (hexval (s[2]));
+      s += 2;
+    }
+    else
+      *d++ = *s;
+  }
+  *d ='\0';
 }
 
-
-url_scheme_t
-url_check_scheme(const char *s)
+url_scheme_t url_check_scheme (const char *s)
 {
-    char sbuf[STRING];
-    char *t;
-    int i;
-
-    if (!s || !(t = strchr (s, ':'))) {
-        return U_UNKNOWN;
-    }
-    if ((t - s) + 1 >= (glong) sizeof (sbuf)) {
-        return U_UNKNOWN;
-    }
-
-    g_stpcpy (sbuf, s);
-    for (t = sbuf; *t; t++) {
-        *t = tolower (*t);
-    }
-
-    if ((i = mutt_getvaluebyname (sbuf, UrlMap)) == -1) {
-        return U_UNKNOWN;
-    } else {
-        return (url_scheme_t) i;
-    }
+  char sbuf[STRING];
+  char *t;
+  int i;
+  
+  if (!s || !(t = strchr (s, ':')))
+    return U_UNKNOWN;
+  if ((t - s) + 1 >= (glong) sizeof (sbuf))
+    return U_UNKNOWN;
+  
+  g_stpcpy (sbuf, s);
+  for (t = sbuf; *t; t++)
+    *t = tolower (*t);
+
+  if ((i = mutt_getvaluebyname (sbuf, UrlMap)) == -1)
+    return U_UNKNOWN;
+  else
+    return (url_scheme_t) i;
 }
 
-
-int
-url_parse_file(char       *d,
-               const char *src,
-               size_t      dl)
+int url_parse_file (char *d, const char *src, size_t dl)
 {
-    if (strncasecmp (src, "file:", 5)) {
-        return -1;
-    } else if (!g_ascii_strncasecmp (src, "file://", 7)) {
-        /* we don't support remote files */
-        return -1;
-    } else {
-        g_stpcpy (d, src + 5);
-    }
-
-    url_pct_decode (d);
-    return 0;
+  if (strncasecmp (src, "file:", 5))
+    return -1;
+  else if (!g_ascii_strncasecmp (src, "file://", 7))
+    /* we don't support remote files */
+    return -1;
+  else
+    g_stpcpy (d, src + 5);
+  
+  url_pct_decode (d);
+  return 0;
 }
 
-
 /* ciss_parse_userhost: fill in components of ciss with info from src. Note
  *   these are pointers into src, which is altered with '\0's. Port of 0
  *   means no port given. */
-static char *
-ciss_parse_userhost(ciss_url_t *ciss,
-                    char       *src)
+static char *ciss_parse_userhost (ciss_url_t *ciss, char *src)
 {
-    char *t;
-    char *p;
-    char *path;
-
-    ciss->user = NULL;
-    ciss->pass = NULL;
-    ciss->host = NULL;
+  char *t;
+  char *p;
+  char *path;
+
+  ciss->user = NULL;
+  ciss->pass = NULL;
+  ciss->host = NULL;
+  ciss->port = 0;
+
+  if (strncmp (src, "//", 2))
+    return src;
+  
+  src += 2;
+
+  if ((path = strchr (src, '/')))
+    *path++ = '\0';
+  
+  if ((t = strchr (src, '@')))
+  {
+    *t = '\0';
+    if ((p = strchr (src, ':')))
+    {
+      *p = '\0';
+      ciss->pass = p + 1;
+      url_pct_decode (ciss->pass);
+    }
+    ciss->user = src;
+    url_pct_decode (ciss->user);
+    t++;
+  }
+  else
+    t = src;
+  
+  if ((p = strchr (t, ':')))
+  {
+    *p++ = '\0';
+    ciss->port = atoi (p);
+  }
+  else
     ciss->port = 0;
-
-    if (strncmp (src, "//", 2)) {
-        return src;
-    }
-
-    src += 2;
-
-    if ((path = strchr (src, '/'))) {
-        *path++ = '\0';
-    }
-
-    if ((t = strchr (src, '@'))) {
-        *t = '\0';
-        if ((p = strchr (src, ':'))) {
-            *p = '\0';
-            ciss->pass = p + 1;
-            url_pct_decode (ciss->pass);
-        }
-        ciss->user = src;
-        url_pct_decode (ciss->user);
-        t++;
-    } else {
-        t = src;
-    }
-
-    if ((p = strchr (t, ':'))) {
-        *p++ = '\0';
-        ciss->port = atoi (p);
-    } else {
-        ciss->port = 0;
-    }
-
-    ciss->host = t;
-    url_pct_decode (ciss->host);
-    return path;
+  
+  ciss->host = t;
+  url_pct_decode (ciss->host);
+  return path;
 }
 
-
-int
-url_parse_ciss(ciss_url_t *ciss,
-               char       *src)
+int url_parse_ciss (ciss_url_t *ciss, char *src)
 {
-    char *tmp;
-
-    if ((ciss->scheme = url_check_scheme (src)) == U_UNKNOWN) {
-        return -1;
-    }
+  char *tmp;
 
-    tmp = strchr (src, ':') + 1;
+  if ((ciss->scheme = url_check_scheme (src)) == U_UNKNOWN)
+    return -1;
 
-    ciss->path = ciss_parse_userhost (ciss, tmp);
-    url_pct_decode (ciss->path);
+  tmp = strchr (src, ':') + 1;
 
-    return 0;
+  ciss->path = ciss_parse_userhost (ciss, tmp);
+  url_pct_decode (ciss->path);
+  
+  return 0;
 }
 
-
 /* url_ciss_tostring: output the URL string for a given CISS object. */
-int
-url_ciss_tostring(ciss_url_t *ciss,
-                  char       *dest,
-                  size_t      len,
-                  int         flags)
+int url_ciss_tostring (ciss_url_t* ciss, char* dest, size_t len, int flags)
 {
-    if (ciss->scheme == U_UNKNOWN) {
-        return -1;
-    }
+  if (ciss->scheme == U_UNKNOWN)
+    return -1;
+
+  snprintf (dest, len, "%s:", mutt_getnamebyvalue (ciss->scheme, UrlMap));
+
+  if (ciss->host)
+  {
+    strncat (dest, "//", len - strlen (dest));
+    if (ciss->user) {
+      if (flags & U_DECODE_PASSWD && ciss->pass)
+       snprintf (dest + strlen (dest), len - strlen (dest), "%s:%s@",
+                 ciss->user, ciss->pass);
+      else
+       snprintf (dest + strlen (dest), len - strlen (dest), "%s@",
+                 ciss->user);
+    }
+
+    if (ciss->port)
+      snprintf (dest + strlen (dest), len - strlen (dest), "%s:%hu/",
+               ciss->host, ciss->port);
+    else
+      snprintf (dest + strlen (dest), len - strlen (dest), "%s/", ciss->host);
+  }
+
+  if (ciss->path)
+    strncat (dest, ciss->path, len - strlen (dest));
+
+  return 0;
+}
 
-    snprintf (dest, len, "%s:", mutt_getnamebyvalue (ciss->scheme, UrlMap));
-
-    if (ciss->host) {
-        strncat (dest, "//", len - strlen (dest));
-        if (ciss->user) {
-            if (flags & U_DECODE_PASSWD && ciss->pass) {
-                snprintf (dest + strlen (dest), len - strlen (dest), "%s:%s@",
-                          ciss->user, ciss->pass);
-            } else {
-                snprintf (dest + strlen (dest), len - strlen (dest), "%s@",
-                          ciss->user);
-            }
-        }
-
-        if (ciss->port) {
-            snprintf (dest + strlen (dest), len - strlen (dest), "%s:%hu/",
-                      ciss->host, ciss->port);
-        } else {
-            snprintf (dest + strlen (dest), len - strlen (dest), "%s/", ciss->host);
-        }
-    }
 
-    if (ciss->path) {
-        strncat (dest, ciss->path, len - strlen (dest));
-    }
-
-    return 0;
-}
diff --git a/libbalsa/url.h b/libbalsa/url.h
index a9d19b4..4650db0 100644
--- a/libbalsa/url.h
+++ b/libbalsa/url.h
@@ -1,38 +1,34 @@
 #ifndef _URL_H
-#define _URL_H
+# define _URL_H
 
-typedef enum url_scheme {
-    U_FILE,
-    U_POP,
-    U_POPS,
-    U_IMAP,
-    U_IMAPS,
-    U_MAILTO,
-    U_UNKNOWN
+typedef enum url_scheme
+{
+  U_FILE,
+  U_POP,
+  U_POPS,
+  U_IMAP,
+  U_IMAPS,
+  U_MAILTO,
+  U_UNKNOWN
 }
 url_scheme_t;
 
 #define U_DECODE_PASSWD (1)
 
-typedef struct ciss_url {
-    url_scheme_t scheme;
-    char *user;
-    char *pass;
-    char *host;
-    unsigned short port;
-    char *path;
-}
+typedef struct ciss_url
+{
+  url_scheme_t scheme;
+  char *user;
+  char *pass;
+  char *host;
+  unsigned short port;
+  char *path;
+} 
 ciss_url_t;
 
-url_scheme_t url_check_scheme(const char *s);
-int url_parse_file(char       *d,
-                   const char *src,
-                   size_t      dl);
-int url_parse_ciss(ciss_url_t *ciss,
-                   char       *src);
-int url_ciss_tostring(ciss_url_t *ciss,
-                      char       *dest,
-                      size_t      len,
-                      int         flags);
+url_scheme_t url_check_scheme (const char *s);
+int url_parse_file (char *d, const char *src, size_t dl);
+int url_parse_ciss (ciss_url_t *ciss, char *src);
+int url_ciss_tostring (ciss_url_t* ciss, char* dest, size_t len, int flags);
 
 #endif
diff --git a/libinit_balsa/assistant_helper.c b/libinit_balsa/assistant_helper.c
index 2dc98e1..281259f 100644
--- a/libinit_balsa/assistant_helper.c
+++ b/libinit_balsa/assistant_helper.c
@@ -18,7 +18,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "assistant_helper.h"
 
@@ -37,27 +37,21 @@
 /*
  * #ifdef BALSA_LOCAL_INSTALL
  * #define gnome_pixmap_file(s) g_strconcat(BALSA_RESOURCE_PREFIX, "/pixmaps/", s, NULL)
- * #define gnome_unconditional_pixmap_file(s) g_strconcat(BALSA_RESOURCE_PREFIX, "/pixmaps", s,
- * NULL)
+ * #define gnome_unconditional_pixmap_file(s) g_strconcat(BALSA_RESOURCE_PREFIX, "/pixmaps", s, NULL)
  * #endif
  */
 
 /* ************************************************************************** */
 
-static void entry_changed_cb(GtkEntry  *entry,
-                             EntryData *ed);
+static void entry_changed_cb(GtkEntry * entry, EntryData * ed);
 
 /* ************************************************************************** */
 
 GtkWidget *
-balsa_init_add_grid_entry(GtkGrid      *grid,
-                          guint         num,
-                          const gchar  *ltext,
-                          const gchar  *etext,
-                          EntryData    *ed,
-                          GtkAssistant *druid,
-                          GtkWidget    *page,
-                          GtkWidget   **dest)
+balsa_init_add_grid_entry(GtkGrid * grid, guint num, const gchar * ltext,
+                          const gchar * etext, EntryData * ed,
+                          GtkAssistant * druid, GtkWidget *page,
+                          GtkWidget ** dest)
 {
     GtkWidget *l, *e;
 
@@ -72,15 +66,14 @@ balsa_init_add_grid_entry(GtkGrid      *grid,
     gtk_widget_set_vexpand(e, TRUE);
     gtk_grid_attach(grid, e, 1, num + 1, 1, 1);
     (*dest) = e;
-    if (ed) {
+    if(ed) {
         g_signal_connect(G_OBJECT(e), "changed",
                          G_CALLBACK(entry_changed_cb), ed);
         ed->num = ed->master->numentries++;
         ed->druid = druid;
         ed->page = page;
-        if (etext && (etext[0] != '\0')) {
+        if (etext && etext[0] != '\0')
             ed->master->setbits |= (1 << num);
-        }
 
         ed->master->donemask = (ed->master->donemask << 1) | 1;
     }
@@ -88,10 +81,8 @@ balsa_init_add_grid_entry(GtkGrid      *grid,
     return e;
 }
 
-
 static void
-entry_changed_cb(GtkEntry  *entry,
-                 EntryData *ed)
+entry_changed_cb(GtkEntry * entry, EntryData * ed)
 {
     g_assert(ed != NULL);
 
@@ -104,9 +95,8 @@ entry_changed_cb(GtkEntry  *entry,
     /* The stuff below is only when we are displayed... which is not
      * always the case.
      */
-    if (!gtk_widget_get_visible(GTK_WIDGET(entry))) {
+    if (!gtk_widget_get_visible(GTK_WIDGET(entry)))
         return;
-    }
 
     if (GTK_IS_ASSISTANT(ed->druid)) {
         /* Don't let them continue unless all entries have something. */
@@ -120,12 +110,9 @@ entry_changed_cb(GtkEntry  *entry,
 
 
 void
-balsa_init_add_grid_option(GtkGrid      *grid,
-                           guint         num,
-                           const gchar  *ltext,
-                           const gchar **optns,
-                           GtkAssistant *druid,
-                           GtkWidget   **dest)
+balsa_init_add_grid_option(GtkGrid *grid, guint num,
+                            const gchar *ltext, const gchar **optns,
+                            GtkAssistant *druid, GtkWidget **dest)
 {
     GtkWidget *l, *om;
     int i;
@@ -135,9 +122,8 @@ balsa_init_add_grid_option(GtkGrid      *grid,
     gtk_grid_attach(grid, l, 0, num + 1, 1, 1);
 
     *dest = om = gtk_combo_box_text_new();
-    for (i = 0; optns[i]; i++) {
+    for(i=0; optns[i]; i++)
         gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(om), _(optns[i]));
-    }
     gtk_label_set_mnemonic_widget(GTK_LABEL(l), om);
     gtk_combo_box_set_active(GTK_COMBO_BOX(om), 0);
     gtk_widget_set_hexpand(om, TRUE);
@@ -145,21 +131,16 @@ balsa_init_add_grid_option(GtkGrid      *grid,
     gtk_grid_attach(grid, om, 1, num + 1, 1, 1);
 }
 
-
 gint
 balsa_option_get_active(GtkWidget *option_widget)
 {
     return gtk_combo_box_get_active(GTK_COMBO_BOX(option_widget));
 }
 
-
 void
-balsa_init_add_grid_checkbox(GtkGrid      *grid,
-                             guint         num,
-                             const gchar  *ltext,
-                             gboolean      defval,
-                             GtkAssistant *druid,
-                             GtkWidget   **dest)
+balsa_init_add_grid_checkbox(GtkGrid *grid, guint num,
+                             const gchar *ltext, gboolean defval,
+                             GtkAssistant *druid, GtkWidget **dest)
 {
     GtkWidget *l;
 
@@ -170,16 +151,13 @@ balsa_init_add_grid_checkbox(GtkGrid      *grid,
 
     *dest = gtk_check_button_new();
     gtk_grid_attach(grid, *dest, 1, num + 1, 1, 1);
-    if (defval) {
+    if(defval)
         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(*dest), TRUE);
-    }
     gtk_label_set_mnemonic_widget(GTK_LABEL(l), *dest);
 }
 
-
 gboolean
-balsa_init_create_to_directory(const gchar *dir,
-                               gchar      **complaint)
+balsa_init_create_to_directory(const gchar * dir, gchar ** complaint)
 {
     /* Security. Well, we could create some weird directories, but
        a) that's not very destructive and b) unless we have root
@@ -190,15 +168,13 @@ balsa_init_create_to_directory(const gchar *dir,
     guint32 i;
     url_scheme_t scheme = url_check_scheme(dir);
 
-    if ((scheme == U_IMAP) || (scheme == U_POP)) {
+    if (scheme == U_IMAP || scheme == U_POP)
         return FALSE;           /* *** For now */
 
-    }
     if (dir[0] != '/') {
         (*complaint) =
             g_strdup_printf(_
-                            (
-                                "The path %s must be relative to the filesystem root (start with /)."),
+                            ("The path %s must be relative to the filesystem root (start with /)."),
                             dir);
         return TRUE;
     }
@@ -222,7 +198,7 @@ balsa_init_create_to_directory(const gchar *dir,
             if (!S_ISDIR(sb.st_mode)) {
                 (*complaint) =
                     g_strdup_printf(_
-                                        ("The file with pathname “%s” is not a directory."),
+                                    ("The file with pathname “%s” is not a directory."),
                                     sofar);
                 g_free(sofar);
                 return TRUE;
@@ -236,8 +212,7 @@ balsa_init_create_to_directory(const gchar *dir,
         if (mkdir(dir, S_IRUSR | S_IWUSR | S_IXUSR) < 0) {
             (*complaint) =
                 g_strdup_printf(_
-                                (
-                                    "Couldn’t create a directory: mkdir() failed on pathname “%s”."),
+                                ("Couldn’t create a directory: mkdir() failed on pathname “%s”."),
                                 dir);
             return TRUE;
         }
@@ -246,7 +221,7 @@ balsa_init_create_to_directory(const gchar *dir,
     if (!S_ISDIR(sb.st_mode)) {
         (*complaint) =
             g_strdup_printf(_
-                                ("The file with pathname “%s” is not a directory."),
+                            ("The file with pathname “%s” is not a directory."),
                             dir);
         return TRUE;
     }
diff --git a/libinit_balsa/assistant_helper.h b/libinit_balsa/assistant_helper.h
index 316f01c..3f66db4 100644
--- a/libinit_balsa/assistant_helper.h
+++ b/libinit_balsa/assistant_helper.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -27,7 +27,7 @@ typedef struct EntryMaster_s EntryMaster;
 
 struct EntryData_s {
     GtkAssistant *druid;
-    GtkWidget *page;
+    GtkWidget    *page;
     guint num;
     EntryMaster *master;
 };
@@ -41,32 +41,23 @@ struct EntryMaster_s {
 };
 
 #define ENTRY_MASTER_INIT { 0, 0, 0 }
-#define ENTRY_MASTER_P_DONE( ep ) (((ep)->setbits & (ep)->donemask) == (ep)->donemask)
-#define ENTRY_MASTER_DONE( e ) (((e).setbits & (e).donemask) == (e).donemask)
-
-GtkWidget *balsa_init_add_grid_entry(GtkGrid      *grid,
-                                     guint         num,
-                                     const gchar  *ltext,
-                                     const gchar  *etext,
-                                     EntryData    *ed,
-                                     GtkAssistant *druid,
-                                     GtkWidget    *page,
-                                     GtkWidget   **dest);
-void balsa_init_add_grid_option(GtkGrid      *grid,
-                                guint         num,
-                                const gchar  *ltext,
-                                const gchar **optns,
-                                GtkAssistant *druid,
-                                GtkWidget   **dest);
-void balsa_init_add_grid_checkbox(GtkGrid      *grid,
-                                  guint         num,
-                                  const gchar  *ltext,
-                                  gboolean      defval,
-                                  GtkAssistant *druid,
-                                  GtkWidget   **dest);
+#define ENTRY_MASTER_P_DONE( ep ) ( ((ep)->setbits & (ep)->donemask) == (ep)->donemask )
+#define ENTRY_MASTER_DONE( e ) ( ((e).setbits & (e).donemask) == (e).donemask )
+
+GtkWidget *balsa_init_add_grid_entry(GtkGrid * grid, guint num,
+                                     const gchar * ltext,
+                                     const gchar * etext, EntryData * ed,
+                                     GtkAssistant * druid,
+                                     GtkWidget * page, GtkWidget ** dest);
+void balsa_init_add_grid_option(GtkGrid *grid, guint num,
+                                const gchar *ltext, const gchar **optns,
+                                GtkAssistant *druid, GtkWidget **dest);
+void balsa_init_add_grid_checkbox(GtkGrid *grid, guint num,
+                                  const gchar *ltext, gboolean defval,
+                                  GtkAssistant *druid, GtkWidget **dest);
 gint balsa_option_get_active(GtkWidget *option_widget);
 
-gboolean balsa_init_create_to_directory(const gchar *dir,
-                                        gchar      **complaint);
+gboolean balsa_init_create_to_directory(const gchar * dir,
+                                        gchar ** complaint);
 
 #endif
diff --git a/libinit_balsa/assistant_init.c b/libinit_balsa/assistant_init.c
index d6ae5e9..6e0f8e0 100644
--- a/libinit_balsa/assistant_init.c
+++ b/libinit_balsa/assistant_init.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "assistant_init.h"
 
@@ -37,18 +37,18 @@
 #include "assistant_page_finish.h"
 
 static void
-balsa_initdruid_cancel(GtkAssistant *druid)
+balsa_initdruid_cancel(GtkAssistant * druid)
 {
     GtkWidget *dialog =
         gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_ancestor
-                                              (GTK_WIDGET(druid),
-                                              GTK_TYPE_WINDOW)),
+                                          (GTK_WIDGET(druid), 
+                                           GTK_TYPE_WINDOW)),
                                GTK_DIALOG_MODAL,
                                GTK_MESSAGE_QUESTION,
                                GTK_BUTTONS_YES_NO,
                                _("This will exit Balsa.\n"
                                  "Do you really want to do this?"));
-    GtkResponseType reply =
+    GtkResponseType reply = 
         gtk_dialog_run(GTK_DIALOG(dialog));
     gtk_widget_destroy(dialog);
 
@@ -58,37 +58,34 @@ balsa_initdruid_cancel(GtkAssistant *druid)
     }
 }
 
-
 static void
-balsa_initdruid_apply(GtkAssistant *druid)
+balsa_initdruid_apply(GtkAssistant * druid)
 {
     gchar *address_book;
     LibBalsaAddressBook *ab = NULL;
 
     address_book = g_build_filename(g_get_home_dir(), "GnomeCard.gcrd", NULL);
-    if (g_file_test(address_book, G_FILE_TEST_EXISTS)) {
+    if (g_file_test(address_book, G_FILE_TEST_EXISTS))
         ab = libbalsa_address_book_vcard_new(_("GnomeCard Address Book"),
                                              address_book);
-    }
     g_free(address_book);
-    if (!ab) {
-        address_book = g_build_filename(g_get_home_dir(),
-                                        ".addressbook.ldif", NULL);
-        if (g_file_test(address_book, G_FILE_TEST_EXISTS)) {
+    if(!ab) {
+        address_book = g_build_filename(g_get_home_dir(), 
+                                   ".addressbook.ldif", NULL);
+        if (g_file_test(address_book, G_FILE_TEST_EXISTS))
             ab = libbalsa_address_book_ldif_new(_("Address Book"),
                                                 address_book);
-        }
         g_free(address_book);
     }
-    if (!ab) {
+    if(!ab) {
         /* This will be the default address book and its location */
-        address_book = g_build_filename(g_get_home_dir(),
+        address_book = g_build_filename(g_get_home_dir(), 
                                         ".balsa", "addressbook.ldif", NULL);
         ab = libbalsa_address_book_ldif_new(_("Address Book"),
-                                            address_book);
+                                            address_book); 
         g_free(address_book);
         libbalsa_assure_balsa_dir();
-    }
+   }
 
     balsa_app.address_book_list =
         g_list_prepend(balsa_app.address_book_list, ab);
@@ -104,9 +101,8 @@ balsa_initdruid_apply(GtkAssistant *druid)
     gtk_main_quit();
 }
 
-
 void
-balsa_initdruid(GtkAssistant *assistant)
+balsa_initdruid(GtkAssistant * assistant)
 {
     g_return_if_fail(assistant != NULL);
     g_return_if_fail(GTK_IS_ASSISTANT(assistant));
@@ -132,7 +128,6 @@ dismiss_the_wizard(GtkWidget *wizard)
     return FALSE;
 }
 
-
 void
 balsa_init_begin(void)
 {
diff --git a/libinit_balsa/assistant_init.h b/libinit_balsa/assistant_init.h
index e83439f..4d506c9 100644
--- a/libinit_balsa/assistant_init.h
+++ b/libinit_balsa/assistant_init.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -30,7 +30,7 @@ G_BEGIN_DECLS
 /*
  * Public methods
  */
-void balsa_initdruid(GtkAssistant *assistant);
+    void balsa_initdruid(GtkAssistant * assistant);
 
 void balsa_init_begin( void );
 
diff --git a/libinit_balsa/assistant_page_defclient.c b/libinit_balsa/assistant_page_defclient.c
index 3aea052..adc6e56 100644
--- a/libinit_balsa/assistant_page_defclient.c
+++ b/libinit_balsa/assistant_page_defclient.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "assistant_page_defclient.h"
 
@@ -33,15 +33,15 @@
 /* here are local prototypes */
 
 static void balsa_druid_page_defclient_init(BalsaDruidPageDefclient *defclient,
-                                            GtkWidget               *page,
-                                            GtkAssistant            *druid);
-static void balsa_druid_page_defclient_toggle(GtkWidget               *page,
-                                              BalsaDruidPageDefclient *defclient);
+                                            GtkWidget *page,
+                                            GtkAssistant *druid);
+static void balsa_druid_page_defclient_toggle(GtkWidget * page,
+                                          BalsaDruidPageDefclient * defclient);
 
 static void
-balsa_druid_page_defclient_init(BalsaDruidPageDefclient *defclient,
-                                GtkWidget               *page,
-                                GtkAssistant            *druid)
+balsa_druid_page_defclient_init(BalsaDruidPageDefclient * defclient,
+                                GtkWidget * page,
+                                GtkAssistant * druid)
 {
     GtkWidget *label;
     GtkWidget *yes, *no;
@@ -54,8 +54,8 @@ balsa_druid_page_defclient_init(BalsaDruidPageDefclient *defclient,
     gtk_label_set_line_wrap((GtkLabel *) label, TRUE);
 
     yes = gtk_radio_button_new_with_mnemonic(NULL, _("_Yes"));
-    no = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(yes),
-                                                        _("_No"));
+    no  = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(yes),
+                                                         _("_No"));
 
     g_signal_connect(yes, "toggled",
                      G_CALLBACK(balsa_druid_page_defclient_toggle),
@@ -76,7 +76,6 @@ balsa_druid_page_defclient_init(BalsaDruidPageDefclient *defclient,
     return;
 }
 
-
 void
 balsa_druid_page_defclient(GtkAssistant *druid)
 {
@@ -91,9 +90,8 @@ balsa_druid_page_defclient(GtkAssistant *druid)
         set_to_balsa_already = !strcmp(g_app_info_get_name(info), "Balsa");
         g_object_unref(info);
 
-        if (set_to_balsa_already) {
+        if(set_to_balsa_already)
             return;
-        }
     }
 
     defclient = g_new0(BalsaDruidPageDefclient, 1);
@@ -106,11 +104,10 @@ balsa_druid_page_defclient(GtkAssistant *druid)
     g_object_weak_ref(G_OBJECT(druid), (GWeakNotify)g_free, defclient);
 }
 
-
 static void
-balsa_druid_page_defclient_toggle(GtkWidget               *page,
-                                  BalsaDruidPageDefclient *defclient)
+balsa_druid_page_defclient_toggle(GtkWidget * page,
+                                  BalsaDruidPageDefclient * defclient)
 {
-    defclient->default_client = !(defclient->default_client);
+    defclient->default_client = ! (defclient->default_client);
     balsa_app.default_client = defclient->default_client;
 }
diff --git a/libinit_balsa/assistant_page_defclient.h b/libinit_balsa/assistant_page_defclient.h
index 6c3a381..250879e 100644
--- a/libinit_balsa/assistant_page_defclient.h
+++ b/libinit_balsa/assistant_page_defclient.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -20,34 +20,34 @@
 #include <gtk/gtk.h>
 
 #ifndef __BALSA_DRUID_PAGE_DEFCLIENT_H__
-#   define __BALSA_DRUID_PAGE_DEFCLIENT_H__
+#define __BALSA_DRUID_PAGE_DEFCLIENT_H__
 
-#   ifndef BALSA_VERSION
-#      error "Include config.h before this file."
-#   endif
+#ifndef BALSA_VERSION
+# error "Include config.h before this file."
+#endif
 
-#   include "assistant_helper.h"
-#   include "assistant_init.h"
+#include "assistant_helper.h"
+#include "assistant_init.h"
 
 G_BEGIN_DECLS
 
 /*
  * Main object structure
  */
-#   ifndef __TYPEDEF_BALSA_DRUID_PAGE_DEFCLIENT__
-#      define __TYPEDEF_BALSA_DRUID_PAGE_DEFCLIENT__
-typedef struct _BalsaDruidPageDefclient BalsaDruidPageDefclient;
-#   endif
-#   define BALSA_DRUID_PAGE_DEFCLIENT(obj) ((BalsaDruidPageDefclient *) obj)
-struct _BalsaDruidPageDefclient {
-    int default_client;
-};
+#ifndef __TYPEDEF_BALSA_DRUID_PAGE_DEFCLIENT__
+#define __TYPEDEF_BALSA_DRUID_PAGE_DEFCLIENT__
+    typedef struct _BalsaDruidPageDefclient BalsaDruidPageDefclient;
+#endif
+#define BALSA_DRUID_PAGE_DEFCLIENT(obj) ((BalsaDruidPageDefclient *) obj)
+    struct _BalsaDruidPageDefclient {
+        int default_client;
+    };
 
 /*
  * Public methods
  */
-void balsa_druid_page_defclient(GtkAssistant *druid);
-void balsa_druid_page_defclient_save(BalsaDruidPageDefclient *defclient);
+    void balsa_druid_page_defclient(GtkAssistant * druid);
+    void balsa_druid_page_defclient_save(BalsaDruidPageDefclient * defclient);
 
 G_END_DECLS
 
diff --git a/libinit_balsa/assistant_page_directory.c b/libinit_balsa/assistant_page_directory.c
index 411906d..4606ab7 100644
--- a/libinit_balsa/assistant_page_directory.c
+++ b/libinit_balsa/assistant_page_directory.c
@@ -5,21 +5,21 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "assistant_page_directory.h"
 
@@ -44,39 +44,35 @@
 #define DRAFTBOX_NAME "Draftbox"
 #define TRASH_NAME    "Trash"
 
-static const gchar *const init_mbnames[NUM_EDs] = {
+static const gchar * const init_mbnames[NUM_EDs] = {
     N_("_Inbox:"), N_("_Outbox:"), N_("_Sentbox:"), N_("_Draftbox:"),
     N_("_Trash:")
 };
 
-static void balsa_druid_page_directory_prepare(GtkAssistant            *druid,
-                                               GtkWidget               *page,
-                                               BalsaDruidPageDirectory *dir);
-static void balsa_druid_page_directory_back(GtkAssistant            *druid,
-                                            GtkWidget               *page,
-                                            BalsaDruidPageDirectory *dir);
-static void balsa_druid_page_directory_next(GtkAssistant            *druid,
-                                            GtkWidget               *page,
-                                            BalsaDruidPageDirectory *dir);
-static void unconditional_mailbox(const gchar      *path,
-                                  const gchar      *prettyname,
-                                  LibBalsaMailbox **box,
-                                  gchar           **error);
+static void balsa_druid_page_directory_prepare(GtkAssistant * druid,
+                                               GtkWidget * page,
+                                               BalsaDruidPageDirectory * dir);
+static void balsa_druid_page_directory_back(GtkAssistant * druid,
+                                            GtkWidget * page,
+                                            BalsaDruidPageDirectory * dir);
+static void balsa_druid_page_directory_next(GtkAssistant * druid,
+                                            GtkWidget * page,
+                                            BalsaDruidPageDirectory * dir);
+static void unconditional_mailbox(const gchar * path,
+                                  const gchar * prettyname,
+                                  LibBalsaMailbox ** box, gchar ** error);
 
 static void
-unconditional_mailbox(const gchar      *path,
-                      const gchar      *prettyname,
-                      LibBalsaMailbox **box,
-                      gchar           **error)
+unconditional_mailbox(const gchar * path, const gchar * prettyname,
+                      LibBalsaMailbox ** box, gchar ** error)
 {
     gchar *dup;
     gchar *index;
     ciss_url_t url;
     gboolean ssl = FALSE, is_remote = FALSE;
 
-    if ((*error) != NULL) {
+    if ((*error) != NULL)
         return;
-    }
 
     dup = g_strdup(path);
     index = strrchr(dup, G_DIR_SEPARATOR);
@@ -84,8 +80,8 @@ unconditional_mailbox(const gchar      *path,
     if (index == NULL) {
         (*error) =
             g_strdup_printf(_
-                                ("The pathname “%s” must be specified"
-                                " canonically — it must start with a “/”."),
+                            ("The pathname “%s” must be specified"
+                             " canonically — it must start with a “/”."),
                             dup);
         g_free(dup);
         return;
@@ -106,26 +102,21 @@ unconditional_mailbox(const gchar      *path,
     switch (url.scheme) {
     case U_IMAPS:
         ssl = TRUE;
-
     case U_IMAP:
         *box = libbalsa_mailbox_imap_new();
-        libbalsa_mailbox_imap_set_path((LibBalsaMailboxImap *) *box,
+        libbalsa_mailbox_imap_set_path((LibBalsaMailboxImap *) * box,
                                        url.path);
         is_remote = TRUE;
         break;
-
     case U_POPS:
         ssl = TRUE;
-
     case U_POP:
         *box = (LibBalsaMailbox *) libbalsa_mailbox_pop3_new();
         is_remote = TRUE;
         break;
-
     case U_FILE:
         *box = libbalsa_mailbox_local_new(url.path, TRUE);
         break;
-
     default:
         *box = libbalsa_mailbox_local_new(path, TRUE);
         if (!*box) {
@@ -148,45 +139,40 @@ unconditional_mailbox(const gchar      *path,
     if (*box == NULL) {
         if (strcmp("/var/spool/mail/", path)) {
             char tmp[32] = "/tmp/balsa.XXXXXX";
-            /* Don't fail if you can't create the spool mailbox. */
-            close(mkstemp(tmp));
-            *box = libbalsa_mailbox_local_new(tmp, FALSE);
-            if (*box) {
-                free((*box)->url);
-                (*box)->url = g_strdup_printf("file://%s", path);
-            }
-            unlink(tmp);
-        }
+           /* Don't fail if you can't create the spool mailbox. */
+           close(mkstemp(tmp));
+               *box = libbalsa_mailbox_local_new(tmp, FALSE);
+               if (*box) {
+                       free((*box)->url);
+                       (*box)->url = g_strdup_printf("file://%s",path);
+               }
+               unlink(tmp);
+       }
     }
     if ( *box == NULL) {
-        (*error) =
-            g_strdup_printf(_
+            (*error) =
+                g_strdup_printf(_
                                 ("The mailbox “%s” does not appear to be valid."),
-                            path);
+                                path);
         return;
     }
 
     (*box)->name = g_strdup(gettext(prettyname));
 
     config_mailbox_add(*box, (char *) prettyname);
-    if (box == &balsa_app.outbox) {
+    if (box == &balsa_app.outbox)
         (*box)->no_reassemble = TRUE;
-    }
 }
 
-
 static void
-verify_mailbox_entry(GtkWidget        *entry,
-                     const gchar      *name,
-                     LibBalsaMailbox **mailbox,
-                     gboolean         *verify)
+verify_mailbox_entry(GtkWidget * entry, const gchar * name,
+                     LibBalsaMailbox ** mailbox, gboolean * verify)
 {
     const gchar *text;
     gchar *error;
 
-    if (!*verify) {
+    if (!*verify)
         return;
-    }
 
     text = gtk_entry_get_text(GTK_ENTRY(entry));
     error = NULL;
@@ -195,8 +181,8 @@ verify_mailbox_entry(GtkWidget        *entry,
     if (error) {
         GtkWidget *dlg =
             gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_ancestor
-                                                  (GTK_WIDGET(entry),
-                                                  GTK_TYPE_WINDOW)),
+                                              (GTK_WIDGET(entry),
+                                               GTK_TYPE_WINDOW)),
                                    GTK_DIALOG_MODAL,
                                    GTK_MESSAGE_ERROR,
                                    GTK_BUTTONS_OK,
@@ -209,10 +195,8 @@ verify_mailbox_entry(GtkWidget        *entry,
     }
 }
 
-
 static void
-verify_button_clicked_cb(GtkWidget *button,
-                         gpointer   data)
+verify_button_clicked_cb(GtkWidget * button, gpointer data)
 {
     BalsaDruidPageDirectory *dir = data;
     gboolean verify = TRUE;
@@ -230,9 +214,8 @@ verify_button_clicked_cb(GtkWidget *button,
     gtk_assistant_set_page_complete(dir->druid, dir->page, verify);
 }
 
-
 static GtkWidget *
-verify_button(BalsaDruidPageDirectory *dir)
+verify_button(BalsaDruidPageDirectory * dir)
 {
     GtkWidget *button;
 
@@ -243,21 +226,18 @@ verify_button(BalsaDruidPageDirectory *dir)
     return button;
 }
 
-
 static void
-entry_changed_cb(GtkEditable *editable,
-                 gpointer     data)
+entry_changed_cb(GtkEditable * editable, gpointer data)
 {
     BalsaDruidPageDirectory *dir = data;
 
     gtk_assistant_set_page_complete(dir->druid, dir->page, FALSE);
 }
 
-
 static void
-balsa_druid_page_directory_init(BalsaDruidPageDirectory *dir,
-                                GtkWidget               *page,
-                                GtkAssistant            *druid)
+balsa_druid_page_directory_init(BalsaDruidPageDirectory * dir,
+                                GtkWidget * page,
+                                GtkAssistant * druid)
 {
     GtkGrid *grid;
     GtkWidget *label_widget;
@@ -265,9 +245,7 @@ balsa_druid_page_directory_init(BalsaDruidPageDirectory *dir,
     int i;
     GtkWidget **init_widgets[NUM_EDs];
     gchar *imap_inbox = libbalsa_guess_imap_inbox();
-    gchar *init_presets[NUM_EDs] = {
-        NULL, NULL, NULL, NULL, NULL
-    };
+    gchar *init_presets[NUM_EDs] = { NULL, NULL, NULL, NULL, NULL };
 
     dir->druid = druid;
     dir->paths_locked = FALSE;
@@ -286,9 +264,9 @@ balsa_druid_page_directory_init(BalsaDruidPageDirectory *dir,
 
     gtk_grid_attach(grid, GTK_WIDGET(label), 0, 0, 2, 1);
 
-    if (0 /* FIXME: libbalsa_mailbox_exists(imap_inbox) */ ) {
+    if (0 /* FIXME: libbalsa_mailbox_exists(imap_inbox) */ )
         init_presets[INBOX] = imap_inbox;
-    } else {
+    else {
         g_free(imap_inbox);
         init_presets[INBOX] = libbalsa_guess_mail_spool();
     }
@@ -303,11 +281,10 @@ balsa_druid_page_directory_init(BalsaDruidPageDirectory *dir,
         gchar *preset;
         GtkWidget *entry;
 
-        if (init_presets[i]) {
+        if (init_presets[i])
             preset = init_presets[i];
-        } else {
+        else
             preset = g_strdup("[Dummy value]");
-        }
 
         entry = balsa_init_add_grid_entry(grid, i, _(init_mbnames[i]),
                                           preset, NULL, NULL, NULL,
@@ -331,7 +308,7 @@ balsa_druid_page_directory_init(BalsaDruidPageDirectory *dir,
 
 
 void
-balsa_druid_page_directory(GtkAssistant *druid)
+balsa_druid_page_directory(GtkAssistant * druid)
 {
     BalsaDruidPageDirectory *dir;
 
@@ -343,22 +320,20 @@ balsa_druid_page_directory(GtkAssistant *druid)
     g_object_weak_ref(G_OBJECT(druid), (GWeakNotify)g_free, dir);
 }
 
-
 static void
-balsa_druid_page_directory_prepare(GtkAssistant            *druid,
-                                   GtkWidget               *page,
-                                   BalsaDruidPageDirectory *dir)
+balsa_druid_page_directory_prepare(GtkAssistant * druid,
+                                   GtkWidget * page,
+                                   BalsaDruidPageDirectory * dir)
 {
     gchar *buf;
     gint current_page_no = gtk_assistant_get_current_page(druid);
 
-    if (page != dir->page) { /* This is not the page to be prepared. */
-        if (dir->need_set) {
-            if (current_page_no > dir->my_num) {
+    if(page != dir->page) { /* This is not the page to be prepared. */
+        if(dir->need_set) {
+            if(current_page_no > dir->my_num)
                 balsa_druid_page_directory_next(druid, page, dir);
-            } else {
+            else
                 balsa_druid_page_directory_back(druid, page, dir);
-            }
             dir->need_set = FALSE;
         }
         return;
@@ -403,18 +378,15 @@ balsa_druid_page_directory_prepare(GtkAssistant            *druid,
 
 
 static void
-balsa_druid_page_directory_back(GtkAssistant            *druid,
-                                GtkWidget               *page,
-                                BalsaDruidPageDirectory *dir)
+balsa_druid_page_directory_back(GtkAssistant *druid, GtkWidget *page,
+                                BalsaDruidPageDirectory * dir)
 {
     dir->paths_locked = FALSE;
 }
 
-
 static void
-balsa_druid_page_directory_next(GtkAssistant            *page,
-                                GtkWidget               *druid,
-                                BalsaDruidPageDirectory *dir)
+balsa_druid_page_directory_next(GtkAssistant * page, GtkWidget * druid,
+                                BalsaDruidPageDirectory * dir)
 {
     dir->paths_locked = TRUE;
 }
diff --git a/libinit_balsa/assistant_page_directory.h b/libinit_balsa/assistant_page_directory.h
index f20d96d..2c109e6 100644
--- a/libinit_balsa/assistant_page_directory.h
+++ b/libinit_balsa/assistant_page_directory.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -31,36 +31,36 @@ G_BEGIN_DECLS
  * Main object structure
  */
 #ifndef __TYPEDEF_BALSA_DRUID_PAGE_DIRECTORY__
-#   define __TYPEDEF_BALSA_DRUID_PAGE_DIRECTORY__
-typedef struct _BalsaDruidPageDirectory BalsaDruidPageDirectory;
+#define __TYPEDEF_BALSA_DRUID_PAGE_DIRECTORY__
+    typedef struct _BalsaDruidPageDirectory BalsaDruidPageDirectory;
 #endif
-#define BALSA_DRUID_PAGE_DIRECTORY(obj) ((BalsaDruidPageDirectory *) obj)
-
-enum __ed_types {
-    INBOX,
-    OUTBOX,
-    SENTBOX,
-    DRAFTBOX,
-    TRASH,
-    NUM_EDs
-};
+#define BALSA_DRUID_PAGE_DIRECTORY(obj)        ((BalsaDruidPageDirectory *) obj)
+    
+    enum __ed_types {
+        INBOX,
+        OUTBOX,
+        SENTBOX,
+        DRAFTBOX,
+        TRASH,
+        NUM_EDs
+    };
 
-struct _BalsaDruidPageDirectory {
-    GtkWidget *page;
-    GtkWidget *inbox;
-    GtkWidget *outbox;
-    GtkWidget *sentbox;
-    GtkWidget *draftbox;
-    GtkWidget *trash;
-    gint my_num;
-    gboolean paths_locked, need_set;
-    GtkAssistant *druid;
-};
+    struct _BalsaDruidPageDirectory {
+        GtkWidget *page;
+        GtkWidget *inbox;
+        GtkWidget *outbox;
+        GtkWidget *sentbox;
+        GtkWidget *draftbox;
+        GtkWidget *trash;
+        gint my_num;
+        gboolean paths_locked, need_set;
+        GtkAssistant *druid;
+    };
 
 /*
  * Public methods
  */
-void balsa_druid_page_directory(GtkAssistant *druid);
+    void balsa_druid_page_directory(GtkAssistant * druid);
 
 
 G_END_DECLS
diff --git a/libinit_balsa/assistant_page_finish.c b/libinit_balsa/assistant_page_finish.c
index 96923b6..b98c63f 100644
--- a/libinit_balsa/assistant_page_finish.c
+++ b/libinit_balsa/assistant_page_finish.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "assistant_page_finish.h"
 
@@ -29,15 +29,14 @@
 
 #if 0
 /* here are local prototypes */
-static void balsa_druid_page_finish_prepare(GtkWidget    *page,
-                                            GtkAssistant *druid);
-static void balsa_druid_page_finish_finish(GtkWidget    *page,
-                                           GtkAssistant *druid);
-
+static void balsa_druid_page_finish_prepare(GtkWidget * page,
+                                            GtkAssistant * druid);
+static void balsa_druid_page_finish_finish(GtkWidget * page,
+                                           GtkAssistant * druid);
 #endif
 
 void
-balsa_druid_page_finish(GtkAssistant *druid)
+balsa_druid_page_finish(GtkAssistant * druid)
 {
     static const gchar bye[] =
         N_("You’ve successfully set up Balsa. Have fun!\n"
@@ -49,15 +48,12 @@ balsa_druid_page_finish(GtkAssistant *druid)
     gtk_assistant_set_page_type(druid, page, GTK_ASSISTANT_PAGE_SUMMARY);
 }
 
-
 #if 0
 static void
-balsa_druid_page_finish_prepare(GnomeDruidPage *page,
-                                GnomeDruid     *druid)
+balsa_druid_page_finish_prepare(GnomeDruidPage * page, GnomeDruid * druid)
 {
     gnome_druid_set_buttons_sensitive(druid, TRUE, FALSE, TRUE, FALSE);
     gnome_druid_set_show_finish(druid, TRUE);
 }
 
-
 #endif
diff --git a/libinit_balsa/assistant_page_finish.h b/libinit_balsa/assistant_page_finish.h
index 03d7a86..2efa843 100644
--- a/libinit_balsa/assistant_page_finish.h
+++ b/libinit_balsa/assistant_page_finish.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -31,7 +31,7 @@ G_BEGIN_DECLS
 /*
  * Public methods
  */
-void balsa_druid_page_finish(GtkAssistant *druid);
+    void balsa_druid_page_finish(GtkAssistant * druid);
 
 G_END_DECLS
 
diff --git a/libinit_balsa/assistant_page_user.c b/libinit_balsa/assistant_page_user.c
index 481d2bf..e363330 100644
--- a/libinit_balsa/assistant_page_user.c
+++ b/libinit_balsa/assistant_page_user.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "assistant_page_user.h"
 
@@ -35,21 +35,21 @@
 
 /* here are local prototypes */
 
-static void balsa_druid_page_user_init(BalsaDruidPageUser *user,
-                                       GtkWidget          *page,
-                                       GtkAssistant       *druid);
-static void balsa_druid_page_user_prepare(GtkAssistant       *druid,
-                                          GtkWidget          *page,
-                                          BalsaDruidPageUser *user);
-static void balsa_druid_page_user_next(GtkAssistant       *druid,
-                                       GtkWidget          *page,
-                                       BalsaDruidPageUser *user);
+static void balsa_druid_page_user_init(BalsaDruidPageUser * user,
+                                       GtkWidget * page,
+                                       GtkAssistant * druid);
+static void balsa_druid_page_user_prepare(GtkAssistant * druid,
+                                          GtkWidget * page,
+                                          BalsaDruidPageUser * user);
+static void balsa_druid_page_user_next(GtkAssistant * druid,
+                                       GtkWidget * page,
+                                       BalsaDruidPageUser * user);
 
 
 static void
-balsa_druid_page_user_init(BalsaDruidPageUser *user,
-                           GtkWidget          *page,
-                           GtkAssistant       *druid)
+balsa_druid_page_user_init(BalsaDruidPageUser * user,
+                           GtkWidget * page,
+                           GtkAssistant * druid)
 {
     static const char *header2 =
         N_("The following settings are also needed "
@@ -63,19 +63,15 @@ balsa_druid_page_user_init(BalsaDruidPageUser *user,
            "a Network Administrator, they may already have set "
            "this up for you):");
 #endif
-    static const char *server_types[] = {
-        "POP3", "IMAP", NULL
-    };
+    static const char* server_types[] = { "POP3", "IMAP", NULL };
     static const gchar *security_modes[] = {
-        N_("SSL"),
-        N_("TLS required"),
-        N_("TLS if possible (not recommended)"),
-        N_("None (not recommended)"),
-        NULL
-    };
-    static const char *remember_passwd[] = {
-        N_("Yes, remember it"), N_("No, type it in every time"), NULL
-    };
+       N_("SSL"),
+               N_("TLS required"),
+               N_("TLS if possible (not recommended)"),
+               N_("None (not recommended)"),
+               NULL };
+    static const char* remember_passwd[] = {
+        N_("Yes, remember it"), N_("No, type it in every time"), NULL };
     GtkGrid *grid;
     GtkLabel *label;
     gchar *preset;
@@ -102,57 +98,57 @@ balsa_druid_page_user_init(BalsaDruidPageUser *user,
     gtk_label_set_justify(label, GTK_JUSTIFY_CENTER);
     gtk_label_set_line_wrap(label, TRUE);
     gtk_grid_attach(grid, GTK_WIDGET(label), 0, 2, 0, 1,
-                    GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 8, 4);
+                     GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 8, 4);
 #endif
     /* 2.1 */
     balsa_init_add_grid_entry(grid, row++,
-                              _("Name of mail server for incoming _mail:"),
-                              "",  /* no guessing here */
-                              NULL, druid, page, &(user->incoming_srv));
+                               _("Name of mail server for incoming _mail:"),
+                               "", /* no guessing here */
+                               NULL, druid, page, &(user->incoming_srv));
 
     balsa_init_add_grid_option(grid, row++,
-                               _("_Type of mail server:"),
+                                _("_Type of mail server:"),
                                server_types, druid, &(user->incoming_type));
 
     balsa_init_add_grid_option(grid, row++,
-                               _("Connection _Security:"),
-                               security_modes, druid, &(user->security));
+                                                  _("Connection _Security:"),
+                                                          security_modes, druid, &(user->security));
     gtk_combo_box_set_active(GTK_COMBO_BOX(user->security), NET_CLIENT_CRYPT_STARTTLS - 1);
 
     balsa_init_add_grid_entry(grid, row++, _("Your email _login name:"),
-                              g_get_user_name(),
-                              NULL, druid, page, &(user->login));
+                               g_get_user_name(),
+                               NULL, druid, page, &(user->login));
     balsa_init_add_grid_entry(grid, row++, _("Your _password:"),
-                              "",
-                              NULL, druid, page, &(user->passwd));
+                               "",
+                               NULL, druid, page, &(user->passwd));
     gtk_entry_set_visibility(GTK_ENTRY(user->passwd), FALSE);
     /* separator line here */
 
     preset = "localhost:25";
     balsa_init_add_grid_entry(grid, row++, _("_SMTP Server:"), preset,
-                              &(user->ed2), druid, page, &(user->smtp));
+                               &(user->ed2), druid, page, &(user->smtp));
 
     /* 2.1 */
     balsa_init_add_grid_entry(grid, row++, _("Your real _name:"),
-                              g_get_real_name(),
-                              &(user->ed0), druid, page, &(user->name));
+                               g_get_real_name(),
+                               &(user->ed0), druid, page, &(user->name));
 
     preset = libbalsa_guess_email_address();
     balsa_init_add_grid_entry
         (grid, row++, _("Your _email address for this email account:"),
-        preset, &(user->ed1), druid, page, &(user->email));
+         preset, &(user->ed1), druid, page, &(user->email));
     g_free(preset);
 
     balsa_init_add_grid_option(grid, row++,
-                               _("_Remember your password:"),
-                               remember_passwd, druid,
-                               &(user->remember_passwd));
+                                _("_Remember your password:"),
+                                remember_passwd, druid,
+                                &(user->remember_passwd));
 
     preset = g_strconcat(g_get_home_dir(), "/mail", NULL);
     balsa_init_add_grid_entry(grid, row++, _("_Local mail directory:"),
-                              preset,
-                              &(user->ed4), druid, page,
-                              &(user->localmaildir));
+                               preset,
+                               &(user->ed4), druid, page,
+                               &(user->localmaildir));
     g_free(preset);
     gtk_widget_set_margin_top(GTK_WIDGET(grid), 3);
     gtk_box_pack_start(GTK_BOX(page), GTK_WIDGET(grid));
@@ -160,9 +156,8 @@ balsa_druid_page_user_init(BalsaDruidPageUser *user,
     user->need_set = FALSE;
 }
 
-
 void
-balsa_druid_page_user(GtkAssistant *druid)
+balsa_druid_page_user(GtkAssistant * druid)
 {
     BalsaDruidPageUser *user;
 
@@ -178,14 +173,12 @@ balsa_druid_page_user(GtkAssistant *druid)
     g_object_weak_ref(G_OBJECT(druid), (GWeakNotify)g_free, user);
 }
 
-
 static void
-balsa_druid_page_user_prepare(GtkAssistant       *druid,
-                              GtkWidget          *page,
-                              BalsaDruidPageUser *user)
+balsa_druid_page_user_prepare(GtkAssistant * druid, GtkWidget * page,
+                              BalsaDruidPageUser * user)
 {
-    if (page != user->page) {
-        if (user->need_set) {
+    if(page != user->page) {
+        if(user->need_set) {
             balsa_druid_page_user_next(druid, page, user);
             user->need_set = FALSE;
         }
@@ -200,42 +193,34 @@ balsa_druid_page_user_prepare(GtkAssistant       *druid,
     user->need_set = TRUE;
 }
 
-
-static LibBalsaMailbox *
-create_pop3_mbx(const gchar *name,
-                const gchar *host,
-                gint         security,
-                const gchar *login,
-                const gchar *passwd,
-                gboolean     remember)
+static LibBalsaMailbox*
+create_pop3_mbx(const gchar *name, const gchar* host, gint security,
+                const gchar *login, const gchar *passwd,
+                gboolean remember)
 {
     LibBalsaMailboxPop3 *pop = libbalsa_mailbox_pop3_new();
-    LibBalsaMailbox *mbx = LIBBALSA_MAILBOX(pop);
+    LibBalsaMailbox *mbx   = LIBBALSA_MAILBOX(pop);
     LibBalsaServer *server = LIBBALSA_MAILBOX_REMOTE_SERVER(pop);
 
     libbalsa_server_set_username(server, login);
     libbalsa_server_set_password(server, passwd);
     libbalsa_server_set_host(server, host, FALSE);
-    server->security = security;
+    server->security        = security;
     server->remember_passwd = remember;
-    mbx->name = g_strdup(name && *name ? name : host);
-    pop->check = TRUE;
-    pop->disable_apop = FALSE;
+    mbx->name               = g_strdup(name && *name ? name : host);
+    pop->check              = TRUE;
+    pop->disable_apop       = FALSE;
     pop->delete_from_server = TRUE;
-    pop->filter = FALSE;
-    pop->filter_cmd = g_strdup("procmail -f -");
-
+    pop->filter             = FALSE;
+    pop->filter_cmd         = g_strdup("procmail -f -");
+    
     return mbx;
 }
 
-
 static void
-create_imap_mbx(const gchar *name,
-                const gchar *host,
-                gint         security,
-                const gchar *login,
-                const gchar *passwd,
-                gboolean     remember)
+create_imap_mbx(const gchar *name, const gchar* host, gint security,
+                const gchar *login, const gchar *passwd,
+                gboolean remember)
 {
     BalsaMailboxNode *mbnode;
     LibBalsaServer *server =
@@ -245,15 +230,13 @@ create_imap_mbx(const gchar *name,
     libbalsa_server_set_host(server, host, security == NET_CLIENT_CRYPT_ENCRYPTED);
     switch (security) {
     case NET_CLIENT_CRYPT_STARTTLS:
-        server->tls_mode = LIBBALSA_TLS_REQUIRED;
-        break;
-
+       server->tls_mode   = LIBBALSA_TLS_REQUIRED;
+       break;
     case NET_CLIENT_CRYPT_STARTTLS_OPT:
-        server->tls_mode = LIBBALSA_TLS_ENABLED;
-        break;
-
+       server->tls_mode   = LIBBALSA_TLS_ENABLED;
+       break;
     default:
-        server->tls_mode = LIBBALSA_TLS_DISABLED;
+       server->tls_mode   = LIBBALSA_TLS_DISABLED;
     }
     server->remember_passwd = remember;
     mbnode = balsa_mailbox_node_new_imap_folder(server, NULL);
@@ -264,46 +247,40 @@ create_imap_mbx(const gchar *name,
     g_object_unref(mbnode);
 }
 
-
 static void
-balsa_druid_page_user_next(GtkAssistant       *druid,
-                           GtkWidget          *page,
-                           BalsaDruidPageUser *user)
+balsa_druid_page_user_next(GtkAssistant * druid, GtkWidget * page,
+                           BalsaDruidPageUser * user)
 {
     const gchar *host, *mailbox;
     gchar *uhoh;
     LibBalsaIdentity *ident;
     InternetAddress *ia;
     LibBalsaSmtpServer *smtp_server;
-
+    
 #if 0
     printf("USER next ENTER %p %p\n", page, user->page);
-    if (page != user->page) {
+    if(page != user->page)
         return;
-    }
 #endif
 
     /* incoming mail */
     host = gtk_entry_get_text(GTK_ENTRY(user->incoming_srv));
-    if (host && *host) {
+    if(host && *host) {
         LibBalsaMailbox *mbx = NULL;
         const gchar *login = gtk_entry_get_text(GTK_ENTRY(user->login));
         const gchar *passwd = gtk_entry_get_text(GTK_ENTRY(user->passwd));
         gint security = balsa_option_get_active(user->security) + NET_CLIENT_CRYPT_ENCRYPTED;
-        gboolean remember =
+        gboolean remember = 
             balsa_option_get_active(user->remember_passwd) == 0;
-        switch (balsa_option_get_active(user->incoming_type)) {
+        switch(balsa_option_get_active(user->incoming_type)) {
         case 0: /* POP */
             mbx = create_pop3_mbx(host, host, security, login, passwd, remember);
-            if (mbx) {
+            if(mbx)
                 config_mailbox_add(mbx, NULL);
-            }
             break;
-
         case 1: /* IMAP */
             create_imap_mbx(host, host, security, login, passwd, remember);
-            break;
-
+            break; 
         default: /* hm */;
         }
     }
@@ -312,30 +289,29 @@ balsa_druid_page_user_next(GtkAssistant       *druid,
 
     mailbox = gtk_entry_get_text(GTK_ENTRY(user->name));
     if (balsa_app.identities == NULL) {
-        gchar *domain = strrchr(mailbox, '@');
+       gchar *domain = strrchr(mailbox, '@');
         ident = LIBBALSA_IDENTITY(libbalsa_identity_new_with_name
-                                      (_("Default Identity")));
+                                 (_("Default Identity")));
         balsa_app.identities = g_list_append(NULL, ident);
         balsa_app.current_ident = ident;
-        if (domain) {
-            libbalsa_identity_set_domain(ident, domain + 1);
-        }
+       if(domain)
+           libbalsa_identity_set_domain(ident, domain+1);
     } else {
         ident = balsa_app.current_ident;
     }
-
+    
     ia = internet_address_mailbox_new (mailbox, gtk_entry_get_text(GTK_ENTRY(user->email)));
     libbalsa_identity_set_address (ident, ia);
     g_object_unref(ia);
 
     /* outgoing mail */
     if (balsa_app.smtp_servers == NULL) {
-        smtp_server = libbalsa_smtp_server_new();
+       smtp_server = libbalsa_smtp_server_new();
         libbalsa_smtp_server_set_name(smtp_server,
                                       libbalsa_smtp_server_get_name(NULL));
-        balsa_app.smtp_servers = g_slist_prepend(NULL, smtp_server);
+       balsa_app.smtp_servers = g_slist_prepend(NULL, smtp_server);
     } else {
-        smtp_server = balsa_app.smtp_servers->data;
+       smtp_server = balsa_app.smtp_servers->data;
     }
     libbalsa_server_set_host(LIBBALSA_SERVER(smtp_server),
                              gtk_entry_get_text(GTK_ENTRY(user->smtp)),
@@ -346,11 +322,11 @@ balsa_druid_page_user_next(GtkAssistant       *druid,
         gtk_editable_get_chars(GTK_EDITABLE(user->localmaildir), 0, -1);
 
     if (balsa_init_create_to_directory
-            (balsa_app.local_mail_directory, &uhoh)) {
-        GtkWidget *err =
+        (balsa_app.local_mail_directory, &uhoh)) {
+        GtkWidget* err = 
             gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_ancestor
-                                                  (GTK_WIDGET(druid),
-                                                  GTK_TYPE_WINDOW)),
+                                          (GTK_WIDGET(druid), 
+                                           GTK_TYPE_WINDOW)),
                                    GTK_DIALOG_MODAL,
                                    GTK_MESSAGE_ERROR,
                                    GTK_BUTTONS_OK,
diff --git a/libinit_balsa/assistant_page_user.h b/libinit_balsa/assistant_page_user.h
index 8a33bad..0a2b416 100644
--- a/libinit_balsa/assistant_page_user.h
+++ b/libinit_balsa/assistant_page_user.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -30,38 +30,38 @@ G_BEGIN_DECLS
  * Main object structure
  */
 #ifndef __TYPEDEF_BALSA_DRUID_PAGE_USER__
-#   define __TYPEDEF_BALSA_DRUID_PAGE_USER__
-typedef struct _BalsaDruidPageUser BalsaDruidPageUser;
+#define __TYPEDEF_BALSA_DRUID_PAGE_USER__
+    typedef struct _BalsaDruidPageUser BalsaDruidPageUser;
 #endif
 #define BALSA_DRUID_PAGE_USER(obj) ((BalsaDruidPageUser *) obj)
-struct _BalsaDruidPageUser {
-    GtkWidget *page;
-    GtkWidget *incoming_srv;
-    GtkWidget *incoming_type;
-    GtkWidget *security;
-    GtkWidget *login;
-    GtkWidget *passwd;
-    GtkWidget *remember_passwd;
-    GtkWidget *smtp;
-    GtkWidget *name;
-    GtkWidget *email;
-    GtkWidget *localmaildir;
-    EntryMaster emaster;
-    EntryData ed0;
-    EntryData ed1;
-    EntryData ed2;
-    EntryData ed3;
-    EntryData ed4;
-    EntryData ed5;
-    EntryData ed6;
-    EntryData ed7;
-    gboolean need_set;
-};
+    struct _BalsaDruidPageUser {
+        GtkWidget *page;
+        GtkWidget *incoming_srv;
+        GtkWidget *incoming_type;
+        GtkWidget *security;
+        GtkWidget *login;
+        GtkWidget *passwd;
+        GtkWidget *remember_passwd;
+        GtkWidget *smtp;
+        GtkWidget *name;
+        GtkWidget *email;
+        GtkWidget *localmaildir;
+        EntryMaster emaster;
+        EntryData ed0;
+        EntryData ed1;
+        EntryData ed2;
+        EntryData ed3;
+        EntryData ed4;
+        EntryData ed5;
+        EntryData ed6;
+        EntryData ed7;
+        gboolean need_set;
+    };
 
 /*
  * Public methods
  */
-void balsa_druid_page_user(GtkAssistant *druid);
+    void balsa_druid_page_user(GtkAssistant * druid);
 
 G_END_DECLS
 
diff --git a/libinit_balsa/assistant_page_welcome.c b/libinit_balsa/assistant_page_welcome.c
index b42b42a..fc750a0 100644
--- a/libinit_balsa/assistant_page_welcome.c
+++ b/libinit_balsa/assistant_page_welcome.c
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -21,24 +21,24 @@
 #include <glib/gi18n.h>
 
 void
-balsa_druid_page_welcome(GtkAssistant *druid)
+balsa_druid_page_welcome(GtkAssistant * druid)
 {
     GtkWidget *page;
     static const gchar title[] = N_("Welcome to Balsa!");
     static const gchar text[] =
         N_
-            ("Before you can send or receive email:\n\n"
-            "• either you should already have Internet access and an "
-            "email account, provided by an Internet Service Provider, "
-            "and you should have made that Internet connection on your "
-            "computer\n\n"
-            "• or your network administrator at your place of "
-            "work/study/similar may have set up your computer to "
-            "connect to the network.");
+        ("Before you can send or receive email:\n\n"
+         "• either you should already have Internet access and an "
+         "email account, provided by an Internet Service Provider, "
+         "and you should have made that Internet connection on your "
+         "computer\n\n"
+         "• or your network administrator at your place of "
+         "work/study/similar may have set up your computer to "
+         "connect to the network.");
 
     page = gtk_label_new(_(text));
     gtk_label_set_line_wrap(GTK_LABEL(page), TRUE);
-
+    
     gtk_assistant_append_page(druid, page);
     gtk_assistant_set_page_title(druid, page, _(title));
     gtk_assistant_set_page_type(druid, page, GTK_ASSISTANT_PAGE_INTRO);
diff --git a/libinit_balsa/assistant_page_welcome.h b/libinit_balsa/assistant_page_welcome.h
index 0cec3b1..b610bd5 100644
--- a/libinit_balsa/assistant_page_welcome.h
+++ b/libinit_balsa/assistant_page_welcome.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -29,7 +29,7 @@ G_BEGIN_DECLS
 /*
  * Public methods
  */
-void balsa_druid_page_welcome(GtkAssistant *druid);
+    void balsa_druid_page_welcome(GtkAssistant * druid);
 
 G_END_DECLS
 
diff --git a/libnetclient/net-client-pop.c b/libnetclient/net-client-pop.c
index c2d6b35..09287d7 100644
--- a/libnetclient/net-client-pop.c
+++ b/libnetclient/net-client-pop.c
@@ -2,18 +2,13 @@
  *
  * Copyright (C) Albrecht Dreß <mailto:albrecht dress arcor de> 2017
  *
- * This library is free software; you can redistribute it and/or modify it under the terms of
- * the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 
General Public License
+ * as published by the Free Software Foundation; either version 3 of the License, or (at your option) any 
later version.
  *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
- * License for more details.
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 
the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
details.
  *
- * You should have received a copy of the GNU Lesser General Public License along with this
- * library. If not, see
+ * You should have received a copy of the GNU Lesser General Public License along with this library. If not, 
see
  * <http://www.gnu.org/licenses/>.
  */
 
@@ -25,31 +20,27 @@
 
 
 struct _NetClientPopPrivate {
-    NetClientCryptMode crypt_mode;
-    gchar *apop_banner;
-    guint auth_allowed[2];                      /** 0: encrypted, 1: unencrypted */
-    gboolean can_pipelining;
-    gboolean can_uidl;
-    gboolean use_pipelining;
+       NetClientCryptMode crypt_mode;
+       gchar *apop_banner;
+       guint auth_allowed[2];                  /** 0: encrypted, 1: unencrypted */
+       gboolean can_pipelining;
+       gboolean can_uidl;
+       gboolean use_pipelining;
 };
 
 
-/* Note: the maximum line length of a message body downloaded from the POP3 server may be up to
-   998 chars, excluding the terminating
- * CRLF, see RFC 5322, Sect. 2.1.1.  However, it also states that "Receiving implementations
- * would do well to handle an arbitrarily
- * large number of characters in a line for robustness sake", so we actually accept lines from
- * POP3 of unlimited length. */
-#define MAX_POP_LINE_LEN                        0U
-#define POP_DATA_BUF_SIZE                       4096U
+/* Note: the maximum line length of a message body downloaded from the POP3 server may be up to 998 chars, 
excluding the terminating
+ * CRLF, see RFC 5322, Sect. 2.1.1.  However, it also states that "Receiving implementations would do well 
to handle an arbitrarily
+ * large number of characters in a line for robustness sake", so we actually accept lines from POP3 of 
unlimited length. */
+#define MAX_POP_LINE_LEN                       0U
+#define POP_DATA_BUF_SIZE                      4096U
 
 
 /*lint -save -e9026            allow function-like macros, see MISRA C:2012, Directive 4.9 */
-#define IS_ML_TERM(str)                         ((str[0] == '.') && (str[1] == '\0'))
+#define IS_ML_TERM(str)                                ((str[0] == '.') && (str[1] == '\0'))
 /*lint -emacro(9079,POP_MSG_INFO) -emacro(9087,POP_MSG_INFO)
  * allow conversion of GList data pointer, MISRA C:2012, Rules 11.3, 11.5 */
-#define POP_MSG_INFO(list)                              ((NetClientPopMessageInfo *) ((list)-> \
-                                                                                      data))
+#define POP_MSG_INFO(list)                             ((NetClientPopMessageInfo *) ((list)->data))
 /*lint -restore */
 
 
@@ -58,387 +49,311 @@ G_DEFINE_TYPE(NetClientPop, net_client_pop, NET_CLIENT_TYPE)
 
 static void net_client_pop_dispose(GObject *object);
 static void net_client_pop_finalise(GObject *object);
-static void net_client_pop_get_capa(NetClientPop *client,
-                                    guint        *auth_supported);
-static gboolean net_client_pop_read_reply(NetClientPop *client,
-                                          gchar       **reply,
-                                          GError      **error);
-static gboolean net_client_pop_uidl(NetClientPop *client,
-                                    GList *const *msg_list,
-                                    GError      **error);
-static gboolean net_client_pop_starttls(NetClientPop *client,
-                                        GError      **error);
-static gboolean net_client_pop_execute(NetClientPop *client,
-                                       const gchar  *request_fmt,
-                                       gchar       **last_reply,
-                                       GError      **error,
-                                       ...)
-G_GNUC_PRINTF(2, 5);
-static gboolean net_client_pop_execute_sasl(NetClientPop *client,
-                                            const gchar  *request_fmt,
-                                            gchar       **challenge,
-                                            GError      **error,
-                                            ...);
-static gboolean net_client_pop_auth(NetClientPop *client,
-                                    const gchar  *user,
-                                    const gchar  *passwd,
-                                    guint         auth_supported,
-                                    GError      **error);
-static gboolean net_client_pop_auth_plain(NetClientPop *client,
-                                          const gchar  *user,
-                                          const gchar  *passwd,
-                                          GError      **error);
-static gboolean net_client_pop_auth_login(NetClientPop *client,
-                                          const gchar  *user,
-                                          const gchar  *passwd,
-                                          GError      **error);
-static gboolean net_client_pop_auth_user_pass(NetClientPop *client,
-                                              const gchar  *user,
-                                              const gchar  *passwd,
-                                              GError      **error);
-static gboolean net_client_pop_auth_apop(NetClientPop *client,
-                                         const gchar  *user,
-                                         const gchar  *passwd,
-                                         GError      **error);
-static gboolean net_client_pop_auth_cram(NetClientPop *client,
-                                         GChecksumType chksum_type,
-                                         const gchar  *user,
-                                         const gchar  *passwd,
-                                         GError      **error);
-static gboolean net_client_pop_auth_gssapi(NetClientPop *client,
-                                           const gchar  *user,
-                                           GError      **error);
-static gboolean net_client_pop_retr_msg(NetClientPop                  *client,
-                                        const NetClientPopMessageInfo *info,
-                                        NetClientPopMsgCb              callback,
-                                        gpointer                       user_data,
-                                        GError                       **error);
+static void net_client_pop_get_capa(NetClientPop *client, guint *auth_supported);
+static gboolean net_client_pop_read_reply(NetClientPop *client, gchar **reply, GError **error);
+static gboolean net_client_pop_uidl(NetClientPop *client, GList * const *msg_list, GError **error);
+static gboolean net_client_pop_starttls(NetClientPop *client, GError **error);
+static gboolean net_client_pop_execute(NetClientPop *client, const gchar *request_fmt, gchar **last_reply, 
GError **error, ...)
+       G_GNUC_PRINTF(2, 5);
+static gboolean net_client_pop_execute_sasl(NetClientPop *client, const gchar *request_fmt, gchar 
**challenge, GError **error, ...);
+static gboolean net_client_pop_auth(NetClientPop *client, const gchar *user, const gchar *passwd, guint 
auth_supported,
+                                                                       GError **error);
+static gboolean net_client_pop_auth_plain(NetClientPop *client, const gchar* user, const gchar* passwd, 
GError** error);
+static gboolean net_client_pop_auth_login(NetClientPop *client, const gchar *user, const gchar *passwd, 
GError **error);
+static gboolean net_client_pop_auth_user_pass(NetClientPop *client, const gchar* user, const gchar* passwd, 
GError** error);
+static gboolean net_client_pop_auth_apop(NetClientPop *client, const gchar* user, const gchar* passwd, 
GError** error);
+static gboolean net_client_pop_auth_cram(NetClientPop *client, GChecksumType chksum_type, const gchar *user, 
const gchar *passwd,
+                                                                                 GError **error);
+static gboolean net_client_pop_auth_gssapi(NetClientPop *client, const gchar *user, GError **error);
+static gboolean net_client_pop_retr_msg(NetClientPop *client, const NetClientPopMessageInfo *info, 
NetClientPopMsgCb callback,
+                                                                               gpointer user_data, GError 
**error);
 
 
 NetClientPop *
-net_client_pop_new(const gchar       *host,
-                   guint16            port,
-                   NetClientCryptMode crypt_mode,
-                   gboolean           use_pipelining)
+net_client_pop_new(const gchar *host, guint16 port, NetClientCryptMode crypt_mode, gboolean use_pipelining)
 {
-    NetClientPop *client;
-
-    g_return_val_if_fail((host != NULL) && (crypt_mode >= NET_CLIENT_CRYPT_ENCRYPTED) &&
-                         (crypt_mode <= NET_CLIENT_CRYPT_NONE),
-                         NULL);
-
-    client = NET_CLIENT_POP(g_object_new(NET_CLIENT_POP_TYPE, NULL));
-    if (client != NULL) {
-        if (!net_client_configure(NET_CLIENT(client), host, port, MAX_POP_LINE_LEN, NULL)) {
-            g_clear_object(&client);
-        } else {
-            client->priv->crypt_mode = crypt_mode;
-            client->priv->use_pipelining = use_pipelining;
-        }
-    }
-
-    return client;
+       NetClientPop *client;
+
+       g_return_val_if_fail((host != NULL) && (crypt_mode >= NET_CLIENT_CRYPT_ENCRYPTED) && (crypt_mode <= 
NET_CLIENT_CRYPT_NONE),
+               NULL);
+
+       client = NET_CLIENT_POP(g_object_new(NET_CLIENT_POP_TYPE, NULL));
+       if (client != NULL) {
+               if (!net_client_configure(NET_CLIENT(client), host, port, MAX_POP_LINE_LEN, NULL)) {
+                       g_clear_object(&client);
+               } else {
+                       client->priv->crypt_mode = crypt_mode;
+                       client->priv->use_pipelining = use_pipelining;
+               }
+       }
+
+       return client;
 }
 
 
 gboolean
-net_client_pop_allow_auth(NetClientPop *client,
-                          gboolean      encrypted,
-                          guint         allow_auth)
+net_client_pop_allow_auth(NetClientPop *client, gboolean encrypted, guint allow_auth)
 {
-    /* paranoia check */
-    g_return_val_if_fail(NET_IS_CLIENT_POP(client), FALSE);
-    if (encrypted) {
-        client->priv->auth_allowed[0] = allow_auth;
-    } else {
-        client->priv->auth_allowed[1] = allow_auth;
-    }
-    return TRUE;
+       /* paranoia check */
+       g_return_val_if_fail(NET_IS_CLIENT_POP(client), FALSE);
+       if (encrypted) {
+               client->priv->auth_allowed[0] = allow_auth;
+       } else {
+               client->priv->auth_allowed[1] = allow_auth;
+       }
+       return TRUE;
 }
 
 
 gboolean
-net_client_pop_connect(NetClientPop *client,
-                       gchar       **greeting,
-                       GError      **error)
+net_client_pop_connect(NetClientPop *client, gchar **greeting, GError **error)
 {
-    gchar *server_msg = NULL;
-    guint auth_supported = 0U;
-    gboolean result;
-
-    /* paranoia checks */
-    g_return_val_if_fail(NET_IS_CLIENT_POP(client), FALSE);
-
-    /* establish connection, and immediately switch to TLS if required */
-    result = net_client_connect(NET_CLIENT(client), error);
-    if (result && (client->priv->crypt_mode == NET_CLIENT_CRYPT_ENCRYPTED)) {
-        result = net_client_start_tls(NET_CLIENT(client), error);
-    }
-
-    /* get the greeting */
-    if (result) {
-        result = net_client_pop_read_reply(client, &server_msg, error);
-    }
-
-    /* extract the APOP banner */
-    if (result) {
-        const gchar *ang_open;
-
-        ang_open = strchr(server_msg, '<');                     /*lint !e668 !e9034            server_msg
-                                                                   cannot be NULL; accept char
-                                                                   literal as int */
-        if (ang_open != NULL) {
-            const gchar *ang_close;
-
-            ang_close = strchr(ang_open, '>');                  /*lint !e9034  accept char
-                                                                   literal as int */
-            if (ang_close != NULL) {
-                /*lint -e{737,946,947,9029}    allowed exception according to MISRA Rules 18.2
-                   and 18.3 */
-                client->priv->apop_banner = g_strndup(ang_open, (ang_close - ang_open) + 1U);
-                auth_supported = NET_CLIENT_POP_AUTH_APOP;
-            }
-        }
-        if (greeting != NULL) {
-            *greeting = g_strdup(server_msg);
-        }
-        g_free(server_msg);
-    }
-
-    /* perform STLS if required- note that some servers support STLS, but do not announce it.
-        So just try... */
-    if (result &&
-        ((client->priv->crypt_mode == NET_CLIENT_CRYPT_STARTTLS) ||
-         (client->priv->crypt_mode == NET_CLIENT_CRYPT_STARTTLS_OPT))) {
-        result = net_client_pop_starttls(client, error);
-        if (!result) {
-            if (client->priv->crypt_mode == NET_CLIENT_CRYPT_STARTTLS_OPT) {
-                result = TRUE;
-                g_clear_error(error);
-            }
-        }
-    }
-
-    /* read the capabilities (which may be unsupported, so ignore any negative result) */
-    if (result) {
-        net_client_pop_get_capa(client, &auth_supported);
-    }
-
-    /* authenticate if we were successful so far */
-    if (result) {
-        gchar **auth_data;
-        gboolean need_pwd;
-
-        auth_data = NULL;
-        need_pwd = (auth_supported & NET_CLIENT_POP_AUTH_NO_PWD) == 0U;
-        g_debug("emit 'auth' signal for client %p", client);
-        g_signal_emit_by_name(client, "auth", need_pwd, &auth_data);
-        if ((auth_data != NULL) && (auth_data[0] != NULL)) {
-            result = net_client_pop_auth(client,
-                                         auth_data[0],
-                                         auth_data[1],
-                                         auth_supported,
-                                         error);
-            memset(auth_data[0], 0, strlen(auth_data[0]));
-            if (auth_data[1] != NULL) {
-                memset(auth_data[1], 0, strlen(auth_data[1]));
-            }
-        }
-        g_strfreev(auth_data);
-    }
-
-    return result;
+       gchar *server_msg = NULL;
+       guint auth_supported = 0U;
+       gboolean result;
+
+       /* paranoia checks */
+       g_return_val_if_fail(NET_IS_CLIENT_POP(client), FALSE);
+
+       /* establish connection, and immediately switch to TLS if required */
+       result = net_client_connect(NET_CLIENT(client), error);
+       if (result && (client->priv->crypt_mode == NET_CLIENT_CRYPT_ENCRYPTED)) {
+               result = net_client_start_tls(NET_CLIENT(client), error);
+       }
+
+       /* get the greeting */
+       if (result) {
+               result = net_client_pop_read_reply(client, &server_msg, error);
+       }
+
+       /* extract the APOP banner */
+       if (result) {
+               const gchar *ang_open;
+
+               ang_open = strchr(server_msg, '<');             /*lint !e668 !e9034             server_msg 
cannot be NULL; accept char literal as int */
+               if (ang_open != NULL) {
+                       const gchar *ang_close;
+
+                       ang_close = strchr(ang_open, '>');      /*lint !e9034   accept char literal as int */
+                       if (ang_close != NULL) {
+                               /*lint -e{737,946,947,9029}     allowed exception according to MISRA Rules 
18.2 and 18.3 */
+                               client->priv->apop_banner = g_strndup(ang_open, (ang_close - ang_open) + 1U);
+                               auth_supported = NET_CLIENT_POP_AUTH_APOP;
+                       }
+               }
+               if (greeting != NULL) {
+                       *greeting = g_strdup(server_msg);
+               }
+               g_free(server_msg);
+       }
+
+       /* perform STLS if required- note that some servers support STLS, but do not announce it.  So just 
try... */
+       if (result &&
+               ((client->priv->crypt_mode == NET_CLIENT_CRYPT_STARTTLS) || (client->priv->crypt_mode == 
NET_CLIENT_CRYPT_STARTTLS_OPT))) {
+               result = net_client_pop_starttls(client, error);
+               if (!result) {
+                       if (client->priv->crypt_mode == NET_CLIENT_CRYPT_STARTTLS_OPT) {
+                               result = TRUE;
+                               g_clear_error(error);
+                       }
+               }
+       }
+
+       /* read the capabilities (which may be unsupported, so ignore any negative result) */
+       if (result) {
+               net_client_pop_get_capa(client, &auth_supported);
+       }
+
+       /* authenticate if we were successful so far */
+       if (result) {
+               gchar **auth_data;
+               gboolean need_pwd;
+
+               auth_data = NULL;
+               need_pwd = (auth_supported & NET_CLIENT_POP_AUTH_NO_PWD) == 0U;
+               g_debug("emit 'auth' signal for client %p", client);
+               g_signal_emit_by_name(client, "auth", need_pwd, &auth_data);
+               if ((auth_data != NULL) && (auth_data[0] != NULL)) {
+                       result = net_client_pop_auth(client, auth_data[0], auth_data[1], auth_supported, 
error);
+                       memset(auth_data[0], 0, strlen(auth_data[0]));
+                       if (auth_data[1] != NULL) {
+                               memset(auth_data[1], 0, strlen(auth_data[1]));
+                       }
+               }
+               g_strfreev(auth_data);
+       }
+
+       return result;
 }
 
 
 gboolean
-net_client_pop_stat(NetClientPop *client,
-                    gsize        *msg_count,
-                    gsize        *mbox_size,
-                    GError      **error)
+net_client_pop_stat(NetClientPop *client, gsize *msg_count, gsize *mbox_size, GError **error)
 {
-    gboolean result;
-    gchar *stat_buf;
-
-    /* paranoia checks */
-    g_return_val_if_fail(NET_IS_CLIENT_POP(client), FALSE);
-
-    /* run the STAT command */
-    result = net_client_pop_execute(client, "STAT", &stat_buf, error);
-    if (result) {
-        unsigned long count;
-        unsigned long total_size;
-
-        if (sscanf(stat_buf, "%lu %lu", &count, &total_size) == 2) {
-            if (msg_count != NULL) {
-                *msg_count = count;
-            }
-            if (mbox_size != NULL) {
-                *mbox_size = total_size;
-            }
-        } else {
-            result = FALSE;
-            g_set_error(error,
-                        NET_CLIENT_POP_ERROR_QUARK,
-                        (gint) NET_CLIENT_ERROR_POP_PROTOCOL,
-                        _("bad server reply: %s"),
-                        stat_buf);
-        }
-
-        g_free(stat_buf);
-    }
-
-    return result;
+       gboolean result;
+       gchar *stat_buf;
+
+       /* paranoia checks */
+       g_return_val_if_fail(NET_IS_CLIENT_POP(client), FALSE);
+
+       /* run the STAT command */
+       result = net_client_pop_execute(client, "STAT", &stat_buf, error);
+       if (result) {
+               unsigned long count;
+               unsigned long total_size;
+
+               if (sscanf(stat_buf, "%lu %lu", &count, &total_size) == 2) {
+                       if (msg_count != NULL) {
+                               *msg_count = count;
+                       }
+                       if (mbox_size != NULL) {
+                               *mbox_size = total_size;
+                       }
+               } else {
+                       result = FALSE;
+                       g_set_error(error, NET_CLIENT_POP_ERROR_QUARK, (gint) NET_CLIENT_ERROR_POP_PROTOCOL, 
_("bad server reply: %s"),
+                               stat_buf);
+               }
+
+               g_free(stat_buf);
+       }
+
+       return result;
 }
 
 
 gboolean
-net_client_pop_list(NetClientPop *client,
-                    GList       **msg_list,
-                    gboolean      with_uid,
-                    GError      **error)
+net_client_pop_list(NetClientPop *client, GList **msg_list, gboolean with_uid, GError **error)
 {
-    gboolean result;
-    gboolean done;
-
-    /* paranoia checks */
-    g_return_val_if_fail(NET_IS_CLIENT_POP(client) && (msg_list != NULL), FALSE);
-
-    *msg_list = NULL;
-
-    /* run the LIST command */
-    result = net_client_pop_execute(client, "LIST", NULL, error);
-    done = FALSE;
-    while (result && !done) {
-        gchar *reply;
-
-        result = net_client_read_line(NET_CLIENT(client), &reply, error);
-        if (result) {
-            if (IS_ML_TERM(reply)) {
-                done = TRUE;
-            } else {
-                NetClientPopMessageInfo *info;
-
-                info = g_new0(NetClientPopMessageInfo, 1U);
-                *msg_list = g_list_prepend(*msg_list, info);
-                if (sscanf(reply, "%u %" G_GSIZE_FORMAT, &info->id, &info->size) != 2) {
-                    result = FALSE;
-                    g_set_error(error,
-                                NET_CLIENT_POP_ERROR_QUARK,
-                                (gint) NET_CLIENT_ERROR_POP_PROTOCOL,
-                                _("bad server reply"));
-                }
-            }
-            g_free(reply);
-        }
-    }
-
-    /* on success, turn the list into the order reported by the remote server */
-    if (result) {
-        *msg_list = g_list_reverse(*msg_list);
-    }
-
-    /* get all uid's if requested */
-    if (result && with_uid && client->priv->can_uidl && (*msg_list != NULL)) {
-        result = net_client_pop_uidl(client, msg_list, error);
-    }
-
-    if (!result) {
-        /*lint -e{9074,9087}   accept sane pointer conversion */
-        g_list_free_full(*msg_list, (GDestroyNotify) net_client_pop_msg_info_free);
-    }
-
-    return result;
+       gboolean result;
+       gboolean done;
+
+       /* paranoia checks */
+       g_return_val_if_fail(NET_IS_CLIENT_POP(client) && (msg_list != NULL), FALSE);
+
+       *msg_list = NULL;
+
+       /* run the LIST command */
+       result = net_client_pop_execute(client, "LIST", NULL, error);
+       done = FALSE;
+       while (result && !done) {
+               gchar *reply;
+
+               result = net_client_read_line(NET_CLIENT(client), &reply, error);
+               if (result) {
+                       if (IS_ML_TERM(reply)) {
+                               done = TRUE;
+                       } else {
+                               NetClientPopMessageInfo *info;
+
+                               info = g_new0(NetClientPopMessageInfo, 1U);
+                               *msg_list = g_list_prepend(*msg_list, info);
+                               if (sscanf(reply, "%u %" G_GSIZE_FORMAT, &info->id, &info->size) != 2) {
+                                       result = FALSE;
+                                       g_set_error(error, NET_CLIENT_POP_ERROR_QUARK, (gint) 
NET_CLIENT_ERROR_POP_PROTOCOL, _("bad server reply"));
+                               }
+                       }
+                       g_free(reply);
+               }
+       }
+
+       /* on success, turn the list into the order reported by the remote server */
+       if (result) {
+               *msg_list = g_list_reverse(*msg_list);
+       }
+
+       /* get all uid's if requested */
+       if (result && with_uid && client->priv->can_uidl && (*msg_list != NULL)) {
+               result = net_client_pop_uidl(client, msg_list, error);
+       }
+
+       if (!result) {
+               /*lint -e{9074,9087}    accept sane pointer conversion */
+               g_list_free_full(*msg_list, (GDestroyNotify) net_client_pop_msg_info_free);
+       }
+
+       return result;
 }
 
 
 gboolean
-net_client_pop_retr(NetClientPop     *client,
-                    GList            *msg_list,
-                    NetClientPopMsgCb callback,
-                    gpointer          user_data,
-                    GError          **error)
+net_client_pop_retr(NetClientPop *client, GList *msg_list, NetClientPopMsgCb callback, gpointer user_data, 
GError **error)
 {
-    gboolean result;
-    gboolean pipelining;
-    const GList *p;
-
-    /* paranoia checks */
-    g_return_val_if_fail(NET_IS_CLIENT_POP(
-                             client) && (msg_list != NULL) && (callback != NULL), FALSE);
-
-    /* pipelining: send all RETR commands */
-    pipelining = client->priv->can_pipelining && client->priv->use_pipelining;
-    if (pipelining) {
-        GString *retr_buf;
-
-        retr_buf = g_string_sized_new(10U * g_list_length(msg_list));
-        for (p = msg_list; p != NULL; p = p->next) {
-            g_string_append_printf(retr_buf, "RETR %u\r\n", POP_MSG_INFO(p)->id);
-        }
-        result =
-            net_client_write_buffer(NET_CLIENT(client), retr_buf->str, retr_buf->len, error);
-        (void) g_string_free(retr_buf, TRUE);
-    } else {
-        result = TRUE;
-    }
-
-    for (p = msg_list; result && (p != NULL); p = p->next) {
-        const NetClientPopMessageInfo *info = POP_MSG_INFO(p);
-
-        if (pipelining) {
-            result = net_client_pop_read_reply(client, NULL, error);
-        } else {
-            result = net_client_pop_execute(client, "RETR %u", NULL, error, info->id);
-        }
-        if (result) {
-            result = net_client_pop_retr_msg(client, info, callback, user_data, error);
-        }
-    }
-
-    return result;
+       gboolean result;
+       gboolean pipelining;
+       const GList *p;
+
+       /* paranoia checks */
+       g_return_val_if_fail(NET_IS_CLIENT_POP(client) && (msg_list != NULL) && (callback != NULL), FALSE);
+
+       /* pipelining: send all RETR commands */
+       pipelining = client->priv->can_pipelining && client->priv->use_pipelining;
+       if (pipelining) {
+               GString *retr_buf;
+
+               retr_buf = g_string_sized_new(10U * g_list_length(msg_list));
+               for (p = msg_list; p != NULL; p = p->next) {
+                       g_string_append_printf(retr_buf, "RETR %u\r\n", POP_MSG_INFO(p)->id);
+               }
+               result = net_client_write_buffer(NET_CLIENT(client), retr_buf->str, retr_buf->len, error);
+               (void) g_string_free(retr_buf, TRUE);
+       } else {
+               result = TRUE;
+       }
+
+       for (p = msg_list; result && (p != NULL); p = p->next) {
+               const NetClientPopMessageInfo *info = POP_MSG_INFO(p);
+
+               if (pipelining) {
+                       result = net_client_pop_read_reply(client, NULL, error);
+               } else {
+                       result = net_client_pop_execute(client, "RETR %u", NULL, error, info->id);
+               }
+               if (result) {
+                       result = net_client_pop_retr_msg(client, info, callback, user_data, error);
+               }
+       }
+
+       return result;
 }
 
 
 gboolean
-net_client_pop_dele(NetClientPop *client,
-                    GList        *msg_list,
-                    GError      **error)
+net_client_pop_dele(NetClientPop *client, GList *msg_list, GError **error)
 {
-    gboolean result;
-    gboolean pipelining;
-    const GList *p;
-
-    /* paranoia checks */
-    g_return_val_if_fail(NET_IS_CLIENT_POP(client) && (msg_list != NULL), FALSE);
-
-    /* pipelining: send all DELE commands */
-    pipelining = client->priv->can_pipelining && client->priv->use_pipelining;
-    if (pipelining) {
-        GString *dele_buf;
-
-        dele_buf = g_string_sized_new(10U * g_list_length(msg_list));
-        for (p = msg_list; p != NULL; p = p->next) {
-            g_string_append_printf(dele_buf, "DELE %u\r\n", POP_MSG_INFO(p)->id);
-        }
-        result =
-            net_client_write_buffer(NET_CLIENT(client), dele_buf->str, dele_buf->len, error);
-        (void) g_string_free(dele_buf, TRUE);
-    } else {
-        result = TRUE;
-    }
-
-    for (p = msg_list; result && (p != NULL); p = p->next) {
-        const NetClientPopMessageInfo *info = POP_MSG_INFO(p);
-
-        if (pipelining) {
-            result = net_client_pop_read_reply(client, NULL, error);
-        } else {
-            result = net_client_pop_execute(client, "DELE %u", NULL, error, info->id);
-        }
-    }
-
-    return result;
+       gboolean result;
+       gboolean pipelining;
+       const GList *p;
+
+       /* paranoia checks */
+       g_return_val_if_fail(NET_IS_CLIENT_POP(client) && (msg_list != NULL), FALSE);
+
+       /* pipelining: send all DELE commands */
+       pipelining = client->priv->can_pipelining && client->priv->use_pipelining;
+       if (pipelining) {
+               GString *dele_buf;
+
+               dele_buf = g_string_sized_new(10U * g_list_length(msg_list));
+               for (p = msg_list; p != NULL; p = p->next) {
+                       g_string_append_printf(dele_buf, "DELE %u\r\n", POP_MSG_INFO(p)->id);
+               }
+               result = net_client_write_buffer(NET_CLIENT(client), dele_buf->str, dele_buf->len, error);
+               (void) g_string_free(dele_buf, TRUE);
+       } else {
+               result = TRUE;
+       }
+
+       for (p = msg_list; result && (p != NULL); p = p->next) {
+               const NetClientPopMessageInfo *info = POP_MSG_INFO(p);
+
+               if (pipelining) {
+                       result = net_client_pop_read_reply(client, NULL, error);
+               } else {
+                       result = net_client_pop_execute(client, "DELE %u", NULL, error, info->id);
+               }
+       }
+
+       return result;
 
 }
 
@@ -446,617 +361,535 @@ net_client_pop_dele(NetClientPop *client,
 void
 net_client_pop_msg_info_free(NetClientPopMessageInfo *info)
 {
-    if (info != NULL) {
-        g_free(info->uid);
-        g_free(info);
-    }
+       if (info != NULL) {
+               g_free(info->uid);
+               g_free(info);
+       }
 }
 
 
-/* == local functions
-   
===========================================================================================================
- */
+/* == local functions 
=========================================================================================================== */
 
 static void
 net_client_pop_class_init(NetClientPopClass *klass)
 {
-    GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+       GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
 
-    gobject_class->dispose = net_client_pop_dispose;
-    gobject_class->finalize = net_client_pop_finalise;
+       gobject_class->dispose = net_client_pop_dispose;
+       gobject_class->finalize = net_client_pop_finalise;
 }
 
 
 static void
 net_client_pop_init(NetClientPop *self)
 {
-    self->priv = g_new0(NetClientPopPrivate, 1U);
-    self->priv->auth_allowed[0] = NET_CLIENT_POP_AUTH_ALL;
-    self->priv->auth_allowed[1] = NET_CLIENT_POP_AUTH_SAFE;
+       self->priv = g_new0(NetClientPopPrivate, 1U);
+       self->priv->auth_allowed[0] = NET_CLIENT_POP_AUTH_ALL;
+       self->priv->auth_allowed[1] = NET_CLIENT_POP_AUTH_SAFE;
 }
 
 
 static void
 net_client_pop_dispose(GObject *object)
 {
-    const NetClientPop *client = NET_CLIENT_POP(object);
-    const GObjectClass *parent_class = G_OBJECT_CLASS(net_client_pop_parent_class);
+       const NetClientPop *client = NET_CLIENT_POP(object);
+       const GObjectClass *parent_class = G_OBJECT_CLASS(net_client_pop_parent_class);
 
-    /* send the 'QUIT' command - no need to evaluate the reply or check for errors */
-    if (net_client_is_connected(NET_CLIENT(client))) {
-        (void) net_client_execute(NET_CLIENT(client), NULL, "QUIT", NULL);
-    }
+       /* send the 'QUIT' command - no need to evaluate the reply or check for errors */
+       if (net_client_is_connected(NET_CLIENT(client))) {
+               (void) net_client_execute(NET_CLIENT(client), NULL, "QUIT", NULL);
+       }
 
-    (*parent_class->dispose)(object);
+       (*parent_class->dispose)(object);
 }
 
 
 static void
 net_client_pop_finalise(GObject *object)
 {
-    const NetClientPop *client = NET_CLIENT_POP(object);
-    const GObjectClass *parent_class = G_OBJECT_CLASS(net_client_pop_parent_class);
+       const NetClientPop *client = NET_CLIENT_POP(object);
+       const GObjectClass *parent_class = G_OBJECT_CLASS(net_client_pop_parent_class);
 
-    g_free(client->priv->apop_banner);
-    g_free(client->priv);
+       g_free(client->priv->apop_banner);
+       g_free(client->priv);
 
-    (*parent_class->finalize)(object);
+       (*parent_class->finalize)(object);
 }
 
 
 /* Note: if supplied, reply is never NULL on success */
 static gboolean
-net_client_pop_read_reply(NetClientPop *client,
-                          gchar       **reply,
-                          GError      **error)
+net_client_pop_read_reply(NetClientPop *client, gchar **reply, GError **error)
 {
-    gboolean result;
-    gchar *reply_buf;
-
-    result = net_client_read_line(NET_CLIENT(client), &reply_buf, error);
-    if (result) {
-        if (strncmp(reply_buf, "+OK", 3U) == 0) {
-            if ((strlen(reply_buf) > 3U) && (reply != NULL)) {
-                *reply = g_strdup(&reply_buf[4]);
-            }
-        } else if (strncmp(reply_buf, "-ERR", 4U) == 0) {
-            if (strlen(reply_buf) > 4U) {
-                g_set_error(error,
-                            NET_CLIENT_POP_ERROR_QUARK,
-                            (gint) NET_CLIENT_ERROR_POP_SERVER_ERR,
-                            _("error: %s"),
-                            &reply_buf[5]);
-            } else {
-                g_set_error(error,
-                            NET_CLIENT_POP_ERROR_QUARK,
-                            (gint) NET_CLIENT_ERROR_POP_SERVER_ERR,
-                            _("error"));
-            }
-            result = FALSE;
-        } else {
-            /* unexpected server reply */
-            g_set_error(error,
-                        NET_CLIENT_POP_ERROR_QUARK,
-                        (gint) NET_CLIENT_ERROR_POP_PROTOCOL,
-                        _("bad server reply: %s"),
-                        reply_buf);
-            result = FALSE;
-        }
-
-        g_free(reply_buf);
-    }
-
-    return result;
+       gboolean result;
+       gchar *reply_buf;
+
+       result = net_client_read_line(NET_CLIENT(client), &reply_buf, error);
+       if (result) {
+               if (strncmp(reply_buf, "+OK", 3U) == 0) {
+                       if ((strlen(reply_buf) > 3U) && (reply != NULL)) {
+                               *reply = g_strdup(&reply_buf[4]);
+                       }
+               } else if (strncmp(reply_buf, "-ERR", 4U) == 0) {
+                       if (strlen(reply_buf) > 4U) {
+                               g_set_error(error, NET_CLIENT_POP_ERROR_QUARK, (gint) 
NET_CLIENT_ERROR_POP_SERVER_ERR, _("error: %s"),
+                                       &reply_buf[5]);
+                       } else {
+                               g_set_error(error, NET_CLIENT_POP_ERROR_QUARK, (gint) 
NET_CLIENT_ERROR_POP_SERVER_ERR, _("error"));
+                       }
+                       result = FALSE;
+               } else {
+                       /* unexpected server reply */
+                       g_set_error(error, NET_CLIENT_POP_ERROR_QUARK, (gint) NET_CLIENT_ERROR_POP_PROTOCOL, 
_("bad server reply: %s"),
+                               reply_buf);
+                       result = FALSE;
+               }
+
+               g_free(reply_buf);
+       }
+
+       return result;
 }
 
 
 /* note: if supplied, last_reply is never NULL on success */
 static gboolean
-net_client_pop_execute(NetClientPop *client,
-                       const gchar  *request_fmt,
-                       gchar       **last_reply,
-                       GError      **error,
-                       ...)
+net_client_pop_execute(NetClientPop *client, const gchar *request_fmt, gchar **last_reply, GError **error, 
...)
 {
-    va_list args;
-    gboolean result;
+       va_list args;
+       gboolean result;
 
-    va_start(args, error);              /*lint !e413   a NULL error argument is irrelevant here
-                                         */
-    result = net_client_vwrite_line(NET_CLIENT(client), request_fmt, args, error);
-    va_end(args);
+       va_start(args, error);          /*lint !e413    a NULL error argument is irrelevant here */
+       result = net_client_vwrite_line(NET_CLIENT(client), request_fmt, args, error);
+       va_end(args);
 
-    if (result) {
-        result = net_client_pop_read_reply(client, last_reply, error);
-    }
+       if (result) {
+               result = net_client_pop_read_reply(client, last_reply, error);
+       }
 
-    return result;
+       return result;
 }
 
 
 static gboolean
-net_client_pop_starttls(NetClientPop *client,
-                        GError      **error)
+net_client_pop_starttls(NetClientPop *client, GError **error)
 {
-    gboolean result;
+       gboolean result;
 
-    result = net_client_pop_execute(client, "STLS", NULL, error);
-    if (result) {
-        result = net_client_start_tls(NET_CLIENT(client), error);
-    }
+       result = net_client_pop_execute(client, "STLS", NULL, error);
+       if (result) {
+               result = net_client_start_tls(NET_CLIENT(client), error);
+       }
 
-    return result;
+       return result;
 }
 
 
 static gboolean
-net_client_pop_auth(NetClientPop *client,
-                    const gchar  *user,
-                    const gchar  *passwd,
-                    guint         auth_supported,
-                    GError      **error)
+net_client_pop_auth(NetClientPop *client, const gchar *user, const gchar *passwd, guint auth_supported, 
GError **error)
 {
-    gboolean result = FALSE;
-    guint auth_mask;
-
-    if (net_client_is_encrypted(NET_CLIENT(client))) {
-        auth_mask = client->priv->auth_allowed[0] & auth_supported;
-    } else {
-        auth_mask = client->priv->auth_allowed[1] & auth_supported;
-    }
-
-    if (((auth_mask & NET_CLIENT_POP_AUTH_NO_PWD) == 0U) && (passwd == NULL)) {
-        g_set_error(error, NET_CLIENT_POP_ERROR_QUARK, (gint) NET_CLIENT_ERROR_POP_NO_AUTH,
-                    _("password required"));
-    } else {
-        /* first try authentication methods w/o password, then safe ones, and finally the
-           plain-text methods */
-        if ((auth_mask & NET_CLIENT_POP_AUTH_GSSAPI) != 0U) {
-            result = net_client_pop_auth_gssapi(client, user, error);
-        } else if ((auth_mask & NET_CLIENT_POP_AUTH_CRAM_SHA1) != 0U) {
-            result = net_client_pop_auth_cram(client, G_CHECKSUM_SHA1, user, passwd, error);
-        } else if ((auth_mask & NET_CLIENT_POP_AUTH_CRAM_MD5) != 0U) {
-            result = net_client_pop_auth_cram(client, G_CHECKSUM_MD5, user, passwd, error);
-        } else if ((auth_mask & NET_CLIENT_POP_AUTH_APOP) != 0U) {
-            result = net_client_pop_auth_apop(client, user, passwd, error);
-        } else if ((auth_mask & NET_CLIENT_POP_AUTH_PLAIN) != 0U) {
-            result = net_client_pop_auth_plain(client, user, passwd, error);
-        } else if ((auth_mask & NET_CLIENT_POP_AUTH_USER_PASS) != 0U) {
-            result = net_client_pop_auth_user_pass(client, user, passwd, error);
-        } else if ((auth_mask & NET_CLIENT_POP_AUTH_LOGIN) != 0U) {
-            result = net_client_pop_auth_login(client, user, passwd, error);
-        } else {
-            g_set_error(error, NET_CLIENT_POP_ERROR_QUARK, (gint) NET_CLIENT_ERROR_POP_NO_AUTH,
-                        _("no suitable authentication mechanism"));
-        }
-    }
-
-    return result;
+       gboolean result = FALSE;
+       guint auth_mask;
+
+       if (net_client_is_encrypted(NET_CLIENT(client))) {
+               auth_mask = client->priv->auth_allowed[0] & auth_supported;
+       } else {
+               auth_mask = client->priv->auth_allowed[1] & auth_supported;
+       }
+
+       if (((auth_mask & NET_CLIENT_POP_AUTH_NO_PWD) == 0U) && (passwd == NULL)) {
+               g_set_error(error, NET_CLIENT_POP_ERROR_QUARK, (gint) NET_CLIENT_ERROR_POP_NO_AUTH, 
_("password required"));
+       } else {
+               /* first try authentication methods w/o password, then safe ones, and finally the plain-text 
methods */
+               if ((auth_mask & NET_CLIENT_POP_AUTH_GSSAPI) != 0U) {
+                       result = net_client_pop_auth_gssapi(client, user, error);
+               } else if ((auth_mask & NET_CLIENT_POP_AUTH_CRAM_SHA1) != 0U) {
+                       result = net_client_pop_auth_cram(client, G_CHECKSUM_SHA1, user, passwd, error);
+               } else if ((auth_mask & NET_CLIENT_POP_AUTH_CRAM_MD5) != 0U) {
+                       result = net_client_pop_auth_cram(client, G_CHECKSUM_MD5, user, passwd, error);
+               } else if ((auth_mask & NET_CLIENT_POP_AUTH_APOP) != 0U) {
+                       result = net_client_pop_auth_apop(client, user, passwd, error);
+               } else if ((auth_mask & NET_CLIENT_POP_AUTH_PLAIN) != 0U) {
+                       result = net_client_pop_auth_plain(client, user, passwd, error);
+               } else if ((auth_mask & NET_CLIENT_POP_AUTH_USER_PASS) != 0U) {
+                       result = net_client_pop_auth_user_pass(client, user, passwd, error);
+               } else if ((auth_mask & NET_CLIENT_POP_AUTH_LOGIN) != 0U) {
+                       result = net_client_pop_auth_login(client, user, passwd, error);
+               } else {
+                       g_set_error(error, NET_CLIENT_POP_ERROR_QUARK, (gint) NET_CLIENT_ERROR_POP_NO_AUTH,
+                               _("no suitable authentication mechanism"));
+               }
+       }
+
+       return result;
 }
 
 
 static gboolean
-net_client_pop_auth_plain(NetClientPop *client,
-                          const gchar  *user,
-                          const gchar  *passwd,
-                          GError      **error)
+net_client_pop_auth_plain(NetClientPop *client, const gchar *user, const gchar *passwd, GError **error)
 {
-    gboolean result;
-    gchar *base64_buf;
-
-    base64_buf = net_client_auth_plain_calc(user, passwd);
-    if (base64_buf != NULL) {
-        result = net_client_pop_execute_sasl(client, "AUTH PLAIN", NULL, error);
-        if (result) {
-            result = net_client_pop_execute(client, "%s", NULL, error, base64_buf);
-        }
-        memset(base64_buf, 0, strlen(base64_buf));
-        g_free(base64_buf);
-    } else {
-        result = FALSE;
-    }
-
-    return result;
+       gboolean result ;
+       gchar *base64_buf;
+
+       base64_buf = net_client_auth_plain_calc(user, passwd);
+       if (base64_buf != NULL) {
+               result = net_client_pop_execute_sasl(client, "AUTH PLAIN", NULL, error);
+               if (result) {
+                       result = net_client_pop_execute(client, "%s", NULL, error, base64_buf);
+               }
+               memset(base64_buf, 0, strlen(base64_buf));
+               g_free(base64_buf);
+       } else {
+               result = FALSE;
+       }
+
+       return result;
 }
 
 
 static gboolean
-net_client_pop_auth_login(NetClientPop *client,
-                          const gchar  *user,
-                          const gchar  *passwd,
-                          GError      **error)
+net_client_pop_auth_login(NetClientPop *client, const gchar *user, const gchar *passwd, GError **error)
 {
-    gboolean result;
-
-    result = net_client_pop_execute_sasl(client, "AUTH LOGIN", NULL, error);
-    if (result) {
-        gchar *base64_buf;
-
-        base64_buf = g_base64_encode((const guchar *) user, strlen(user));
-        result = net_client_pop_execute_sasl(client, "%s", NULL, error, base64_buf);
-        memset(base64_buf, 0, strlen(base64_buf));
-        g_free(base64_buf);
-        if (result) {
-            base64_buf = g_base64_encode((const guchar *) passwd, strlen(passwd));
-            result = net_client_pop_execute(client, "%s", NULL, error, base64_buf);
-            memset(base64_buf, 0, strlen(base64_buf));
-            g_free(base64_buf);
-        }
-    }
-
-    return result;
+       gboolean result;
+
+       result = net_client_pop_execute_sasl(client, "AUTH LOGIN", NULL, error);
+       if (result) {
+               gchar *base64_buf;
+
+               base64_buf = g_base64_encode((const guchar *) user, strlen(user));
+               result = net_client_pop_execute_sasl(client, "%s", NULL, error, base64_buf);
+               memset(base64_buf, 0, strlen(base64_buf));
+               g_free(base64_buf);
+               if (result) {
+                       base64_buf = g_base64_encode((const guchar *) passwd, strlen(passwd));
+                       result = net_client_pop_execute(client, "%s", NULL, error, base64_buf);
+                       memset(base64_buf, 0, strlen(base64_buf));
+                       g_free(base64_buf);
+               }
+       }
+
+       return result;
 }
 
 
 static gboolean
-net_client_pop_auth_user_pass(NetClientPop *client,
-                              const gchar  *user,
-                              const gchar  *passwd,
-                              GError      **error)
+net_client_pop_auth_user_pass(NetClientPop *client, const gchar *user, const gchar *passwd, GError **error)
 {
-    gboolean result;
+       gboolean result;
 
-    result = net_client_pop_execute(client, "USER %s", NULL, error, user);
-    if (result) {
-        result = net_client_pop_execute(client, "PASS %s", NULL, error, passwd);
-    }
+       result = net_client_pop_execute(client, "USER %s", NULL, error, user);
+       if (result) {
+               result = net_client_pop_execute(client, "PASS %s", NULL, error, passwd);
+       }
 
-    return result;
+       return result;
 }
 
 
 static gboolean
-net_client_pop_auth_apop(NetClientPop *client,
-                         const gchar  *user,
-                         const gchar  *passwd,
-                         GError      **error)
+net_client_pop_auth_apop(NetClientPop *client, const gchar *user, const gchar *passwd, GError **error)
 {
-    gboolean result;
-    gchar *auth_buf;
-    gchar *md5_buf;
-
-    auth_buf = g_strconcat(client->priv->apop_banner, passwd, NULL);
-    md5_buf = g_compute_checksum_for_string(G_CHECKSUM_MD5, auth_buf, -1);
-    memset(auth_buf, 0, strlen(auth_buf));
-    g_free(auth_buf);
-    result = net_client_pop_execute(client, "APOP %s %s", NULL, error, user, md5_buf);
-    memset(md5_buf, 0, strlen(md5_buf));
-    g_free(md5_buf);
-
-    return result;
+       gboolean result;
+       gchar *auth_buf;
+       gchar *md5_buf;
+
+       auth_buf = g_strconcat(client->priv->apop_banner, passwd, NULL);
+       md5_buf = g_compute_checksum_for_string(G_CHECKSUM_MD5, auth_buf, -1);
+       memset(auth_buf, 0, strlen(auth_buf));
+       g_free(auth_buf);
+       result = net_client_pop_execute(client, "APOP %s %s", NULL, error, user, md5_buf);
+       memset(md5_buf, 0, strlen(md5_buf));
+       g_free(md5_buf);
+
+       return result;
 }
 
 
 static gboolean
-net_client_pop_auth_cram(NetClientPop *client,
-                         GChecksumType chksum_type,
-                         const gchar  *user,
-                         const gchar  *passwd,
-                         GError      **error)
+net_client_pop_auth_cram(NetClientPop *client, GChecksumType chksum_type, const gchar *user, const gchar 
*passwd, GError **error)
 {
-    gboolean result;
-    gchar *challenge = NULL;
-
-    result = net_client_pop_execute_sasl(client,
-                                         "AUTH CRAM-%s",
-                                         &challenge,
-                                         error,
-                                         net_client_chksum_to_str(chksum_type));
-    if (result) {
-        gchar *auth_buf;
-        auth_buf = net_client_cram_calc(challenge, chksum_type, user, passwd);
-        if (auth_buf != NULL) {
-            result = net_client_pop_execute(client, "%s", NULL, error, auth_buf);
-            memset(auth_buf, 0, strlen(auth_buf));
-            g_free(auth_buf);
-        } else {
-            result = FALSE;
-        }
-    }
-    g_free(challenge);
-
-    return result;
+       gboolean result;
+       gchar *challenge = NULL;
+
+       result = net_client_pop_execute_sasl(client, "AUTH CRAM-%s", &challenge, error, 
net_client_chksum_to_str(chksum_type));
+       if (result) {
+               gchar *auth_buf;
+               auth_buf = net_client_cram_calc(challenge, chksum_type, user, passwd);
+               if (auth_buf != NULL) {
+                       result = net_client_pop_execute(client, "%s", NULL, error, auth_buf);
+                       memset(auth_buf, 0, strlen(auth_buf));
+                       g_free(auth_buf);
+               } else {
+                       result = FALSE;
+               }
+       }
+       g_free(challenge);
+
+       return result;
 }
 
 
 #if defined(HAVE_GSSAPI)
 
 static gboolean
-net_client_pop_auth_gssapi(NetClientPop *client,
-                           const gchar  *user,
-                           GError      **error)
+net_client_pop_auth_gssapi(NetClientPop *client, const gchar *user, GError **error)
 {
-    NetClientGssCtx *gss_ctx;
-    gboolean result = FALSE;
-
-    gss_ctx =
-        net_client_gss_ctx_new("pop", net_client_get_host(NET_CLIENT(client)), user, error);
-    if (gss_ctx != NULL) {
-        gint state;
-        gboolean initial = TRUE;
-        gchar *input_token = NULL;
-        gchar *output_token = NULL;
-
-        do {
-            state = net_client_gss_auth_step(gss_ctx, input_token, &output_token, error);
-            g_free(input_token);
-            input_token = NULL;
-            if (state >= 0) {
-                if (initial) {
-                    /* split the initial auth command as the initial-response argument will
-                       typically exceed the 255-octet limit on
-                     * the length of a single command, see RFC 5034, Sect. 4 */
-                    initial = FALSE;
-                    result = net_client_pop_execute_sasl(client, "AUTH GSSAPI =", NULL, error);
-                }
-                if (result) {
-                    result = net_client_pop_execute_sasl(client,
-                                                         "%s",
-                                                         &input_token,
-                                                         error,
-                                                         output_token);
-                }
-            }
-            g_free(output_token);
-        } while (result && (state == 0));
-
-        if (state == 1) {
-            output_token = net_client_gss_auth_finish(gss_ctx, input_token, error);
-            if (output_token != NULL) {
-                result = net_client_pop_execute(client, "%s", NULL, error, output_token);
-                g_free(output_token);
-            }
-        }
-        g_free(input_token);
-        net_client_gss_ctx_free(gss_ctx);
-    }
-
-    return result;
+       NetClientGssCtx *gss_ctx;
+       gboolean result = FALSE;
+
+       gss_ctx = net_client_gss_ctx_new("pop", net_client_get_host(NET_CLIENT(client)), user, error);
+       if (gss_ctx != NULL) {
+               gint state;
+               gboolean initial = TRUE;
+               gchar *input_token = NULL;
+               gchar *output_token = NULL;
+
+               do {
+                       state = net_client_gss_auth_step(gss_ctx, input_token, &output_token, error);
+                       g_free(input_token);
+                       input_token = NULL;
+                       if (state >= 0) {
+                               if (initial) {
+                                       /* split the initial auth command as the initial-response argument 
will typically exceed the 255-octet limit on
+                                        * the length of a single command, see RFC 5034, Sect. 4 */
+                                       initial = FALSE;
+                                       result = net_client_pop_execute_sasl(client, "AUTH GSSAPI =", NULL, 
error);
+                               }
+                               if (result) {
+                                       result = net_client_pop_execute_sasl(client, "%s", &input_token, 
error, output_token);
+                               }
+                       }
+                       g_free(output_token);
+               } while (result && (state == 0));
+
+               if (state == 1) {
+                       output_token = net_client_gss_auth_finish(gss_ctx, input_token, error);
+                       if (output_token != NULL) {
+                           result = net_client_pop_execute(client, "%s", NULL, error, output_token);
+                           g_free(output_token);
+                       }
+               }
+               g_free(input_token);
+               net_client_gss_ctx_free(gss_ctx);
+       }
+
+       return result;
 }
 
-
 #else
 
 /*lint -e{715} -e{818} */
 static gboolean
-net_client_pop_auth_gssapi(NetClientPop G_GNUC_UNUSED *client,
-                           const gchar G_GNUC_UNUSED  *user,
-                           GError G_GNUC_UNUSED      **error)
+net_client_pop_auth_gssapi(NetClientPop G_GNUC_UNUSED *client, const gchar G_GNUC_UNUSED *user, GError 
G_GNUC_UNUSED **error)
 {
-    g_assert_not_reached();                     /* this should never happen! */
-    return FALSE;                                       /* never reached, make gcc happy */
+       g_assert_not_reached();                 /* this should never happen! */
+       return FALSE;                                   /* never reached, make gcc happy */
 }
 
-
 #endif  /* HAVE_GSSAPI */
 
 
 /* Note: if supplied, challenge is never NULL on success */
 static gboolean
-net_client_pop_execute_sasl(NetClientPop *client,
-                            const gchar  *request_fmt,
-                            gchar       **challenge,
-                            GError      **error,
-                            ...)
+net_client_pop_execute_sasl(NetClientPop *client, const gchar *request_fmt, gchar **challenge, GError 
**error, ...)
 {
-    va_list args;
-    gboolean result;
-
-    va_start(args, error);              /*lint !e413   a NULL error argument is irrelevant here
-                                         */
-    result = net_client_vwrite_line(NET_CLIENT(client), request_fmt, args, error);
-    va_end(args);
-
-    if (result) {
-        gchar *reply_buf;
-
-        result = net_client_read_line(NET_CLIENT(client), &reply_buf, error);
-        if (result) {
-            if (strncmp(reply_buf, "+ ", 2U) == 0) {
-                if (challenge != NULL) {
-                    *challenge = g_strdup(&reply_buf[2]);
-                }
-            } else {
-                result = FALSE;
-                g_set_error(error,
-                            NET_CLIENT_POP_ERROR_QUARK,
-                            (gint) NET_CLIENT_ERROR_POP_SERVER_ERR,
-                            _("error: %s"),
-                            reply_buf);
-            }
-            g_free(reply_buf);
-        }
-    }
-
-    return result;
+       va_list args;
+       gboolean result;
+
+       va_start(args, error);          /*lint !e413    a NULL error argument is irrelevant here */
+       result = net_client_vwrite_line(NET_CLIENT(client), request_fmt, args, error);
+       va_end(args);
+
+       if (result) {
+               gchar *reply_buf;
+
+               result = net_client_read_line(NET_CLIENT(client), &reply_buf, error);
+               if (result) {
+                       if (strncmp(reply_buf, "+ ", 2U) == 0) {
+                               if (challenge != NULL) {
+                                       *challenge = g_strdup(&reply_buf[2]);
+                               }
+                       } else {
+                               result = FALSE;
+                               g_set_error(error, NET_CLIENT_POP_ERROR_QUARK, (gint) 
NET_CLIENT_ERROR_POP_SERVER_ERR, _("error: %s"), reply_buf);
+                       }
+                       g_free(reply_buf);
+               }
+       }
+
+       return result;
 }
 
 
 static void
-net_client_pop_get_capa(NetClientPop *client,
-                        guint        *auth_supported)
+net_client_pop_get_capa(NetClientPop *client, guint *auth_supported)
 {
-    gboolean result;
-    gboolean done;
-
-    /* clear all capability flags except APOP and send the CAPA command */
-    *auth_supported = *auth_supported & NET_CLIENT_POP_AUTH_APOP;
-    client->priv->can_pipelining = FALSE;
-    result = net_client_pop_execute(client, "CAPA", NULL, NULL);
-
-    /* evaluate the response */
-    done = FALSE;
-    while (result && !done) {
-        gchar *reply;
-
-        result = net_client_read_line(NET_CLIENT(client), &reply, NULL);
-        if (result) {
-            if (IS_ML_TERM(reply)) {
-                done = TRUE;
-            } else if (strcmp(reply, "USER") == 0) {
-                *auth_supported |= NET_CLIENT_POP_AUTH_USER_PASS;
-            } else if (strncmp(reply, "SASL ", 5U) == 0) {
-                gchar **auth;
-                guint n;
-
-                auth = g_strsplit(&reply[5], " ", -1);
-                for (n = 0U; auth[n] != NULL; n++) {
-                    if (strcmp(auth[n], "PLAIN") == 0) {
-                        *auth_supported |= NET_CLIENT_POP_AUTH_PLAIN;
-                    } else if (strcmp(auth[n], "LOGIN") == 0) {
-                        *auth_supported |= NET_CLIENT_POP_AUTH_LOGIN;
-                    } else if (strcmp(auth[n], "CRAM-MD5") == 0) {
-                        *auth_supported |= NET_CLIENT_POP_AUTH_CRAM_MD5;
-                    } else if (strcmp(auth[n], "CRAM-SHA1") == 0) {
-                        *auth_supported |= NET_CLIENT_POP_AUTH_CRAM_SHA1;
+       gboolean result;
+       gboolean done;
+
+       /* clear all capability flags except APOP and send the CAPA command */
+       *auth_supported = *auth_supported & NET_CLIENT_POP_AUTH_APOP;
+       client->priv->can_pipelining = FALSE;
+       result = net_client_pop_execute(client, "CAPA", NULL, NULL);
+
+       /* evaluate the response */
+       done = FALSE;
+       while (result && !done) {
+               gchar *reply;
+
+               result = net_client_read_line(NET_CLIENT(client), &reply, NULL);
+               if (result) {
+                       if (IS_ML_TERM(reply)) {
+                               done = TRUE;
+                       } else if (strcmp(reply, "USER") == 0) {
+                               *auth_supported |= NET_CLIENT_POP_AUTH_USER_PASS;
+                       } else if (strncmp(reply, "SASL ", 5U) == 0) {
+                               gchar **auth;
+                               guint n;
+
+                               auth = g_strsplit(&reply[5], " ", -1);
+                               for (n = 0U; auth[n] != NULL; n++) {
+                                       if (strcmp(auth[n], "PLAIN") == 0) {
+                                               *auth_supported |= NET_CLIENT_POP_AUTH_PLAIN;
+                                       } else if (strcmp(auth[n], "LOGIN") == 0) {
+                                               *auth_supported |= NET_CLIENT_POP_AUTH_LOGIN;
+                                       } else if (strcmp(auth[n], "CRAM-MD5") == 0) {
+                                               *auth_supported |= NET_CLIENT_POP_AUTH_CRAM_MD5;
+                                       } else if (strcmp(auth[n], "CRAM-SHA1") == 0) {
+                                               *auth_supported |= NET_CLIENT_POP_AUTH_CRAM_SHA1;
 #if defined(HAVE_GSSAPI)
-                    } else if (strcmp(auth[n], "GSSAPI") == 0) {
-                        *auth_supported |= NET_CLIENT_POP_AUTH_GSSAPI;
+                                       } else if (strcmp(auth[n], "GSSAPI") == 0) {
+                                               *auth_supported |= NET_CLIENT_POP_AUTH_GSSAPI;
 #endif
-                    } else {
-                        /* other auth methods are ignored for the time being */
-                    }
-                }
-                g_strfreev(auth);
-            } else if (strcmp(reply, "PIPELINING") == 0) {
-                client->priv->can_pipelining = TRUE;
-            } else if (strcmp(reply, "UIDL") == 0) {
-                client->priv->can_uidl = TRUE;
-            } else {
-                /* ignore this capability (see MISRA C:2012, Rule 15.7) */
-            }
-
-            g_free(reply);
-        }
-    }
-
-    /* see RFC 1939, Sect. 4: if no other authentication method is supported explicitly (in
-       particular no APOP), the server *must*
-     * at least support USER/PASS... */
-    if (*auth_supported == 0U) {
-        *auth_supported = NET_CLIENT_POP_AUTH_USER_PASS;
-    }
-    client->priv->can_pipelining = TRUE;
+                                       } else {
+                                               /* other auth methods are ignored for the time being */
+                                       }
+                               }
+                               g_strfreev(auth);
+                       } else if (strcmp(reply, "PIPELINING") == 0) {
+                               client->priv->can_pipelining = TRUE;
+                       } else if (strcmp(reply, "UIDL") == 0) {
+                               client->priv->can_uidl = TRUE;
+                       } else {
+                               /* ignore this capability (see MISRA C:2012, Rule 15.7) */
+                       }
+
+                       g_free(reply);
+               }
+       }
+
+       /* see RFC 1939, Sect. 4: if no other authentication method is supported explicitly (in particular no 
APOP), the server *must*
+        * at least support USER/PASS... */
+       if (*auth_supported == 0U) {
+               *auth_supported = NET_CLIENT_POP_AUTH_USER_PASS;
+       }
+       client->priv->can_pipelining = TRUE;
 }
 
 
 static gboolean
-net_client_pop_uidl(NetClientPop *client,
-                    GList *const *msg_list,
-                    GError      **error)
+net_client_pop_uidl(NetClientPop *client, GList * const *msg_list, GError **error)
 {
-    gboolean result;
-    gboolean done;
-    const GList *p;
-
-    result = net_client_pop_execute(client, "UIDL", NULL, error);
-    done = FALSE;
-    p = *msg_list;
-    while (result && !done) {
-        gchar *reply;
-
-        result = net_client_read_line(NET_CLIENT(client), &reply, error);
-        if (result) {
-            if (IS_ML_TERM(reply)) {
-                done = TRUE;
-            } else {
-                guint msg_id;
-                gchar *endptr;
-
-                msg_id = strtoul(reply, &endptr, 10);
-                if (endptr[0] != ' ') {
-                    result = FALSE;
-                } else {
-                    /* we assume the passed list is already in the proper order, re-scan it if
-                       not */
-                    if ((p == NULL) || (POP_MSG_INFO(p)->id != msg_id)) {
-                        for (p = *msg_list;
-                             (p != NULL) && (POP_MSG_INFO(p)->id != msg_id);
-                             p = p->next) {
-                            /* nothing to do (see MISRA C:2012, Rule 15.7) */
-                        }
-                    }
-                    /* FIXME - error if we get a UID for a message which is not in the list? */
-                    if (p != NULL) {
-                        NetClientPopMessageInfo *info = POP_MSG_INFO(p);
-
-                        g_free(info->uid);
-                        info->uid = g_strdup(&endptr[1]);
-                        p = p->next;
-                    }
-                }
-            }
-            g_free(reply);
-        }
-    }
-
-    return result;
+       gboolean result;
+       gboolean done;
+       const GList *p;
+
+       result = net_client_pop_execute(client, "UIDL", NULL, error);
+       done = FALSE;
+       p = *msg_list;
+       while (result && !done) {
+               gchar *reply;
+
+               result = net_client_read_line(NET_CLIENT(client), &reply, error);
+               if (result) {
+                       if (IS_ML_TERM(reply)) {
+                               done = TRUE;
+                       } else {
+                               guint msg_id;
+                               gchar *endptr;
+
+                               msg_id = strtoul(reply, &endptr, 10);
+                               if (endptr[0] != ' ') {
+                                       result = FALSE;
+                               } else {
+                                       /* we assume the passed list is already in the proper order, re-scan 
it if not */
+                                       if ((p == NULL) || (POP_MSG_INFO(p)->id != msg_id)) {
+                                               for (p = *msg_list; (p != NULL) && (POP_MSG_INFO(p)->id != 
msg_id); p = p->next) {
+                                                       /* nothing to do (see MISRA C:2012, Rule 15.7) */
+                                               }
+                                       }
+                                       /* FIXME - error if we get a UID for a message which is not in the 
list? */
+                                       if (p != NULL) {
+                                               NetClientPopMessageInfo* info = POP_MSG_INFO(p);
+
+                                               g_free(info->uid);
+                                               info->uid = g_strdup(&endptr[1]);
+                                               p = p->next;
+                                       }
+                               }
+                       }
+                       g_free(reply);
+               }
+       }
+
+       return result;
 }
 
 
 static gboolean
-net_client_pop_retr_msg(NetClientPop                  *client,
-                        const NetClientPopMessageInfo *info,
-                        NetClientPopMsgCb              callback,
-                        gpointer                       user_data,
-                        GError                       **error)
+net_client_pop_retr_msg(NetClientPop *client, const NetClientPopMessageInfo *info, NetClientPopMsgCb 
callback, gpointer user_data,
+                                               GError **error)
 {
-    gboolean result;
-    gboolean done;
-    GString *msg_buf;
-    gsize lines;
-
-    result = TRUE;
-    done = FALSE;
-    msg_buf = g_string_sized_new(POP_DATA_BUF_SIZE);
-    lines = 0U;
-    while (!done && result) {
-        gchar *linebuf;
-
-        result = net_client_read_line(NET_CLIENT(client), &linebuf, error);
-        if (result) {
-            if (IS_ML_TERM(linebuf)) {
-                done = TRUE;
-            } else {
-                if (linebuf[0] == '.') {
-                    msg_buf = g_string_append(msg_buf, &linebuf[1]);
-                } else {
-                    msg_buf = g_string_append(msg_buf, linebuf);
-                }
-                msg_buf = g_string_append_c(msg_buf, '\n');
-                lines++;
-
-                /* pass an almost full buffer to the callback */
-                if (msg_buf->len > (POP_DATA_BUF_SIZE - 100U)) {
-                    result = callback(msg_buf->str,
-                                      (gssize) msg_buf->len,
-                                      lines,
-                                      info,
-                                      user_data,
-                                      error);
-                    msg_buf = g_string_truncate(msg_buf, 0U);
-                    lines = 0U;
-                }
-            }
-            g_free(linebuf);
-        }
-    }
-
-    if (result) {
-        if (msg_buf->len > 0U) {
-            result =
-                callback(msg_buf->str, (gssize) msg_buf->len, lines, info, user_data, error);
-        }
-        if (result) {
-            result = callback(NULL, 0, 0U, info, user_data, error);
-        }
-    }
-
-    if (!result) {
-        (void) callback(NULL, -1, 0U, info, user_data, NULL);
-    }
-    (void) g_string_free(msg_buf, TRUE);
-
-    return result;
+       gboolean result;
+       gboolean done;
+       GString *msg_buf;
+       gsize lines;
+
+       result = TRUE;
+       done = FALSE;
+       msg_buf = g_string_sized_new(POP_DATA_BUF_SIZE);
+       lines = 0U;
+       while (!done && result) {
+               gchar *linebuf;
+
+               result = net_client_read_line(NET_CLIENT(client), &linebuf, error);
+               if (result) {
+                       if (IS_ML_TERM(linebuf)) {
+                               done = TRUE;
+                       } else {
+                               if (linebuf[0] == '.') {
+                                       msg_buf = g_string_append(msg_buf, &linebuf[1]);
+                               } else {
+                                       msg_buf = g_string_append(msg_buf, linebuf);
+                               }
+                               msg_buf = g_string_append_c(msg_buf, '\n');
+                               lines++;
+
+                               /* pass an almost full buffer to the callback */
+                               if (msg_buf->len > (POP_DATA_BUF_SIZE - 100U)) {
+                                       result = callback(msg_buf->str, (gssize) msg_buf->len, lines, info, 
user_data, error);
+                                       msg_buf = g_string_truncate(msg_buf, 0U);
+                                       lines = 0U;
+                               }
+                       }
+                       g_free(linebuf);
+               }
+       }
+
+       if (result) {
+               if (msg_buf->len > 0U) {
+                       result = callback(msg_buf->str, (gssize) msg_buf->len, lines, info, user_data, error);
+               }
+               if (result) {
+                       result = callback(NULL, 0, 0U, info, user_data, error);
+               }
+       }
+
+       if (!result) {
+               (void) callback(NULL, -1, 0U, info, user_data, NULL);
+       }
+       (void) g_string_free(msg_buf, TRUE);
+
+       return result;
 
 }
diff --git a/libnetclient/net-client-pop.h b/libnetclient/net-client-pop.h
index 313ad12..c999a31 100644
--- a/libnetclient/net-client-pop.h
+++ b/libnetclient/net-client-pop.h
@@ -2,18 +2,13 @@
  *
  * Copyright (C) Albrecht Dreß <mailto:albrecht dress arcor de> 2017
  *
- * This library is free software; you can redistribute it and/or modify it under the terms of
- * the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along with this
- * library. If not, see
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 
General Public License
+ * as published by the Free Software Foundation; either version 3 of the License, or (at your option) any 
later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 
the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this library. If not, 
see
  * <http://www.gnu.org/licenses/>.
  */
 
@@ -27,23 +22,14 @@
 G_BEGIN_DECLS
 
 
-#define NET_CLIENT_POP_TYPE                                     (net_client_pop_get_type())
-#define NET_CLIENT_POP(obj)                                     (G_TYPE_CHECK_INSTANCE_CAST((obj), \
-                                                                                            
NET_CLIENT_POP_TYPE, \
-                                                                                            NetClientPop))
-#define NET_IS_CLIENT_POP(obj)                          (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
-                                                                                    NET_CLIENT_POP_TYPE))
-#define NET_CLIENT_POP_CLASS(klass)                     (G_TYPE_CHECK_CLASS_CAST((klass), \
-                                                                                 NET_CLIENT_POP_TYPE, \
-                                                                                 NetClientPopClass))
-#define NET_IS_CLIENT_POP_CLASS(klass)          (G_TYPE_CHECK_CLASS_TYPE((klass), \
-                                                                         NET_CLIENT_POP_TYPE))
-#define NET_CLIENT_POP_GET_CLASS(obj)           (G_TYPE_INSTANCE_GET_CLASS((obj), \
-                                                                           NET_CLIENT_POP_TYPE, \
-                                                                           NetClientPopClass))
+#define NET_CLIENT_POP_TYPE                                    (net_client_pop_get_type())
+#define NET_CLIENT_POP(obj)                                    (G_TYPE_CHECK_INSTANCE_CAST((obj), 
NET_CLIENT_POP_TYPE, NetClientPop))
+#define NET_IS_CLIENT_POP(obj)                         (G_TYPE_CHECK_INSTANCE_TYPE((obj), 
NET_CLIENT_POP_TYPE))
+#define NET_CLIENT_POP_CLASS(klass)                    (G_TYPE_CHECK_CLASS_CAST((klass), 
NET_CLIENT_POP_TYPE, NetClientPopClass))
+#define NET_IS_CLIENT_POP_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE((klass), NET_CLIENT_POP_TYPE))
+#define NET_CLIENT_POP_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS((obj), NET_CLIENT_POP_TYPE, 
NetClientPopClass))
 
-#define NET_CLIENT_POP_ERROR_QUARK                      (g_quark_from_static_string( \
-                                                             "net-client-pop"))
+#define NET_CLIENT_POP_ERROR_QUARK                     (g_quark_from_static_string("net-client-pop"))
 
 
 typedef struct _NetClientPop NetClientPop;
@@ -55,49 +41,41 @@ typedef struct _NetClientPopMessageInfo NetClientPopMessageInfo;
 
 /** @brief POP-specific error codes */
 enum _NetClientPopError {
-    NET_CLIENT_ERROR_POP_PROTOCOL = 1,                  /**< A bad server reply has been
-                                                           received. */
-    NET_CLIENT_ERROR_POP_SERVER_ERR,                    /**< The server replied with an error.
-                                                         */
-    NET_CLIENT_ERROR_POP_NO_AUTH,                       /**< The server offers no suitable
-                                                           authentication mechanism. */
-    NET_CLIENT_ERROR_POP_NO_STARTTLS                    /**< The server does not support
-                                                           STARTTLS. */
+       NET_CLIENT_ERROR_POP_PROTOCOL = 1,              /**< A bad server reply has been received. */
+       NET_CLIENT_ERROR_POP_SERVER_ERR,                /**< The server replied with an error. */
+       NET_CLIENT_ERROR_POP_NO_AUTH,                   /**< The server offers no suitable authentication 
mechanism. */
+       NET_CLIENT_ERROR_POP_NO_STARTTLS                /**< The server does not support STARTTLS. */
 };
 
 
 /** @name POP authentication methods
  *
- * Note that the availability of these authentication methods depends upon the result of the
- * CAPABILITY list.  According to RFC
+ * Note that the availability of these authentication methods depends upon the result of the CAPABILITY 
list.  According to RFC
  * 1939, Section 4, at least either APOP or USER/PASS @em must be supported.
  * @{
  */
 /** RFC 1939 "USER" and "PASS" authentication method. */
-#define NET_CLIENT_POP_AUTH_USER_PASS           0x01U
+#define NET_CLIENT_POP_AUTH_USER_PASS          0x01U
 /** RFC 1939 "APOP" authentication method. */
-#define NET_CLIENT_POP_AUTH_APOP                        0x02U
+#define NET_CLIENT_POP_AUTH_APOP                       0x02U
 /** RFC 5034 SASL "LOGIN" authentication method. */
-#define NET_CLIENT_POP_AUTH_LOGIN                       0x04U
+#define NET_CLIENT_POP_AUTH_LOGIN                      0x04U
 /** RFC 5034 SASL "PLAIN" authentication method. */
-#define NET_CLIENT_POP_AUTH_PLAIN                       0x08U
+#define NET_CLIENT_POP_AUTH_PLAIN                      0x08U
 /** RFC 5034 SASL "CRAM-MD5" authentication method. */
-#define NET_CLIENT_POP_AUTH_CRAM_MD5            0x10U
+#define NET_CLIENT_POP_AUTH_CRAM_MD5           0x10U
 /** RFC 5034 SASL "CRAM-SHA1" authentication method. */
-#define NET_CLIENT_POP_AUTH_CRAM_SHA1           0x20U
+#define NET_CLIENT_POP_AUTH_CRAM_SHA1          0x20U
 /** RFC 4752 "GSSAPI" authentication method. */
-#define NET_CLIENT_POP_AUTH_GSSAPI                      0x40U
-/** Mask of all safe authentication methods, i.e. all methods which do not send the cleartext
-   password. */
-#define NET_CLIENT_POP_AUTH_SAFE                        \
-    (NET_CLIENT_POP_AUTH_APOP + NET_CLIENT_POP_AUTH_CRAM_MD5 + NET_CLIENT_POP_AUTH_CRAM_SHA1 + \
-     NET_CLIENT_POP_AUTH_GSSAPI)
+#define NET_CLIENT_POP_AUTH_GSSAPI                     0x40U
+/** Mask of all safe authentication methods, i.e. all methods which do not send the cleartext password. */
+#define NET_CLIENT_POP_AUTH_SAFE                       \
+       (NET_CLIENT_POP_AUTH_APOP + NET_CLIENT_POP_AUTH_CRAM_MD5 + NET_CLIENT_POP_AUTH_CRAM_SHA1 + 
NET_CLIENT_POP_AUTH_GSSAPI)
 /** Mask of all authentication methods. */
-#define NET_CLIENT_POP_AUTH_ALL                         \
-    (NET_CLIENT_POP_AUTH_USER_PASS + NET_CLIENT_POP_AUTH_PLAIN + NET_CLIENT_POP_AUTH_LOGIN + \
-     NET_CLIENT_POP_AUTH_SAFE)
+#define NET_CLIENT_POP_AUTH_ALL                                \
+       (NET_CLIENT_POP_AUTH_USER_PASS + NET_CLIENT_POP_AUTH_PLAIN + NET_CLIENT_POP_AUTH_LOGIN + 
NET_CLIENT_POP_AUTH_SAFE)
 /** Mask of all authentication methods which do not require a password. */
-#define NET_CLIENT_POP_AUTH_NO_PWD                      NET_CLIENT_POP_AUTH_GSSAPI
+#define NET_CLIENT_POP_AUTH_NO_PWD                     NET_CLIENT_POP_AUTH_GSSAPI
 /** @} */
 
 
@@ -108,71 +86,53 @@ struct _NetClientPop {
 
 
 struct _NetClientPopClass {
-    NetClientClass parent;
+       NetClientClass parent;
 };
 
 
 /** @brief Message information
  *
- * This structure is returned in a GList by net_client_pop_list() and contains information about
- * on message in the remote mailbox.
+ * This structure is returned in a GList by net_client_pop_list() and contains information about on message 
in the remote mailbox.
  */
 struct _NetClientPopMessageInfo {
-    guint id;                                           /**< Message ID in the remote mailbox.
-                                                         */
-    gsize size;                                         /**< Size of the message in bytes. */
-    gchar *uid;                                         /**< Message UID, or NULL if it was not
-                                                           requested or the remote server does
-                                                           not support the UIDL
-                                                         * command. */
+       guint id;                                       /**< Message ID in the remote mailbox. */
+       gsize size;                                     /**< Size of the message in bytes. */
+       gchar *uid;                                     /**< Message UID, or NULL if it was not requested or 
the remote server does not support the UIDL
+                                                                * command. */
 };
 
 
 /** @brief POP3 Message Read Callback Function
  *
  * The user-provided callback function to receive a message from the remote POP3 server:
- * - @em buffer - the next NUL-terminated chunk of data, always guaranteed to consist of
- * complete, LF terminated lines, or NULL
+ * - @em buffer - the next NUL-terminated chunk of data, always guaranteed to consist of complete, LF 
terminated lines, or NULL
  *   when the @em count is <= 0 (see below)
- * - @em count - indicates the number of bytes in the buffer (> 0), the end of the message (==
- * 0), or that the download is
+ * - @em count - indicates the number of bytes in the buffer (> 0), the end of the message (== 0), or that 
the download is
  *   terminated due to an error condition (-1)
  * - @em lines - number of lines in the buffer, valid only if @em count > 0
  * - @em info - information for the current message
  * - @em user_data - user data pointer
- * - @em error - shall be filled with error information if an error occurs in the callback; this
- * location is actually the @em error
- *   parameter passed to net_client_pop_retr() with the exception of a call when the @em count
- * is -1 when this parameter is always
+ * - @em error - shall be filled with error information if an error occurs in the callback; this location is 
actually the @em error
+ *   parameter passed to net_client_pop_retr() with the exception of a call when the @em count is -1 when 
this parameter is always
  *   NULL
- * - return value: TRUE if the message download shall proceed, or FALSE to terminate it because
- * an error occurred in the callback.
+ * - return value: TRUE if the message download shall proceed, or FALSE to terminate it because an error 
occurred in the callback.
  *   In the latter case, the callback function should set @em error appropriately.
  *
- * The message retrieved from the remote POP3 server is passed as "raw" data.  The line endings
- * are always LF (i.e. @em not CRLF),
- * and byte-stuffed termination '.' characters have been unstuffed.  If the data passed to the
- * callback function shall be fed into
- * <a href="http://spruce.sourceforge.net/gmime/";>GMime</a>, it is thus @em not necessary to run
- * it through a GMimeFilterCRLF
+ * The message retrieved from the remote POP3 server is passed as "raw" data.  The line endings are always 
LF (i.e. @em not CRLF),
+ * and byte-stuffed termination '.' characters have been unstuffed.  If the data passed to the callback 
function shall be fed into
+ * <a href="http://spruce.sourceforge.net/gmime/";>GMime</a>, it is thus @em not necessary to run it through 
a GMimeFilterCRLF
  * filter.
  *
- * The download of every message is terminated by calling the callback with a @em count of 0.
- * If the callback returns FALSE for a
- * count >= 0, it is called again for the same message with count == -1 before the download is
- * terminated.  The return value of the
+ * The download of every message is terminated by calling the callback with a @em count of 0.  If the 
callback returns FALSE for a
+ * count >= 0, it is called again for the same message with count == -1 before the download is terminated.  
The return value of the
  * callback called with count == -1 is ignored.
  */
-typedef gboolean (*NetClientPopMsgCb)(const gchar                   *buffer,
-                                      gssize                         count,
-                                      gsize                          lines,
-                                      const NetClientPopMessageInfo *info,
-                                      gpointer                       user_data,
-                                      GError                       **error);
+typedef gboolean (*NetClientPopMsgCb)(const gchar *buffer, gssize count, gsize lines, const 
NetClientPopMessageInfo *info,
+                                                                         gpointer user_data, GError **error);
 
 
 GType net_client_pop_get_type(void)
-G_GNUC_CONST;
+       G_GNUC_CONST;
 
 
 /** @brief Create a new POP network client
@@ -183,10 +143,7 @@ G_GNUC_CONST;
  * @param use_pipelining whether POP3 PIPELINING shall be used if supported by the remote server
  * @return the POP network client object
  */
-NetClientPop *net_client_pop_new(const gchar       *host,
-                                 guint16            port,
-                                 NetClientCryptMode crypt_mode,
-                                 gboolean           use_pipelining);
+NetClientPop *net_client_pop_new(const gchar *host, guint16 port, NetClientCryptMode crypt_mode, gboolean 
use_pipelining);
 
 
 /** @brief Set allowed POP AUTH methods
@@ -196,15 +153,12 @@ NetClientPop *net_client_pop_new(const gchar       *host,
  * @param allow_auth mask of allowed authentication methods
  * @return TRUE on success or FALSE on error
  *
- * Set the allowed authentication methods for the passed connection.  The default is @ref
- * NET_CLIENT_POP_AUTH_ALL for both encrypted
+ * Set the allowed authentication methods for the passed connection.  The default is @ref 
NET_CLIENT_POP_AUTH_ALL for both encrypted
  * and unencrypted connections.
  *
  * @note Call this function @em before calling net_client_pop_connect().
  */
-gboolean net_client_pop_allow_auth(NetClientPop *client,
-                                   gboolean      encrypted,
-                                   guint         allow_auth);
+gboolean net_client_pop_allow_auth(NetClientPop *client, gboolean encrypted, guint allow_auth);
 
 
 /** @brief Connect a POP network client
@@ -214,42 +168,32 @@ gboolean net_client_pop_allow_auth(NetClientPop *client,
  * @param error filled with error information if the connection fails
  * @return TRUE on success or FALSE if the connection failed
  *
- * Connect the remote POP server, initialise the encryption if requested, and emit the @ref auth
- * signal to request authentication
+ * Connect the remote POP server, initialise the encryption if requested, and emit the @ref auth signal to 
request authentication
  * information.  Simply ignore the signal for an unauthenticated connection.
  *
- * The function will try only @em one authentication method supported by the server and enabled
- * for the current encryption state
- * (see net_client_pop_allow_auth() and \ref NET_CLIENT_POP_AUTH_ALL etc.).  The priority is,
- * from highest to lowest, GSSAPI (if
+ * The function will try only @em one authentication method supported by the server and enabled for the 
current encryption state
+ * (see net_client_pop_allow_auth() and \ref NET_CLIENT_POP_AUTH_ALL etc.).  The priority is, from highest 
to lowest, GSSAPI (if
  * configured), CRAM-SHA1, CRAM-MD5, APOP, PLAIN, USER/PASS or LOGIN.
  *
- * In order to shut down a successfully established connection, just call
- *<tt>g_object_unref()</tt> on the POP network client
+ * In order to shut down a successfully established connection, just call <tt>g_object_unref()</tt> on the 
POP network client
  * object.
  *
  * @note The caller must free the returned greeting when it is not needed any more.
  */
-gboolean net_client_pop_connect(NetClientPop *client,
-                                gchar       **greeting,
-                                GError      **error);
+gboolean net_client_pop_connect(NetClientPop *client, gchar **greeting, GError **error);
 
 
 /** @brief Get the status of a POP3 mailbox
  *
  * @param client POP network client object
- * @param msg_count filled with the number of messages available in the mailbox, may be NULL to
- * ignore the value
+ * @param msg_count filled with the number of messages available in the mailbox, may be NULL to ignore the 
value
  * @param mbox_size filled with the total mailbox size in bytes, may be NULL to ignore the value
  * @param error filled with error information if the connection fails
  * @return TRUE on success or FALSE if the command failed
  *
  * Run the POP3 STAT command to retrieve the mailbox status.
  */
-gboolean net_client_pop_stat(NetClientPop *client,
-                             gsize        *msg_count,
-                             gsize        *mbox_size,
-                             GError      **error);
+gboolean net_client_pop_stat(NetClientPop *client, gsize *msg_count, gsize *mbox_size, GError **error);
 
 
 /** @brief List the messages in the POP3 mailbox
@@ -260,61 +204,43 @@ gboolean net_client_pop_stat(NetClientPop *client,
  * @param error filled with error information if the connection fails
  * @return TRUE on success or FALSE if the command failed
  *
- * Run the LIST command and fill the passed list with the message identifier and message size
- * for all messages available in the
- * mailbox.  If the parameter @em with_uid is TRUE, also run the UIDL command and include the
- * UID's reported by the remote server in
+ * Run the LIST command and fill the passed list with the message identifier and message size for all 
messages available in the
+ * mailbox.  If the parameter @em with_uid is TRUE, also run the UIDL command and include the UID's reported 
by the remote server in
  * the returned list.
  *
- * The caller shall free the items in the returned list by calling
- * net_client_pop_msg_info_free() on them.
+ * The caller shall free the items in the returned list by calling net_client_pop_msg_info_free() on them.
  *
- * @note The UID's can be added only if the remote server reports in its @em CAPABILITY list
- * that the @em UIDL command is supported.
+ * @note The UID's can be added only if the remote server reports in its @em CAPABILITY list that the @em 
UIDL command is supported.
  */
-gboolean net_client_pop_list(NetClientPop *client,
-                             GList       **msg_list,
-                             gboolean      with_uid,
-                             GError      **error);
+gboolean net_client_pop_list(NetClientPop *client, GList **msg_list, gboolean with_uid, GError **error);
 
 
 /** @brief Load messages from the POP3 mailbox
  *
  * @param client POP network client object
- * @param msg_list list of @ref NetClientPopMessageInfo items which shall be read from the
- * server
- * @param callback callback function which shall be called to process the downloaded message
- * data
+ * @param msg_list list of @ref NetClientPopMessageInfo items which shall be read from the server
+ * @param callback callback function which shall be called to process the downloaded message data
  * @param user_data user data pointer passed to the callback function
  * @param error filled with error information if the connection fails
  * @return TRUE on success or FALSE if the command failed
  *
- * Load all messages in the passed list from the remote server, passing them through the
- * specified callback function.  The function
+ * Load all messages in the passed list from the remote server, passing them through the specified callback 
function.  The function
  * takes advantage of the RFC 2449 @em PIPELINING capability if supported by the remote server.
  */
-gboolean net_client_pop_retr(NetClientPop     *client,
-                             GList            *msg_list,
-                             NetClientPopMsgCb callback,
-                             gpointer          user_data,
-                             GError          **error);
+gboolean net_client_pop_retr(NetClientPop *client, GList *msg_list, NetClientPopMsgCb callback, gpointer 
user_data, GError **error);
 
 
 /** @brief Delete messages from the POP3 mailbox
  *
  * @param client POP network client object
- * @param msg_list list of @ref NetClientPopMessageInfo items which shall be deleted from the
- * server
+ * @param msg_list list of @ref NetClientPopMessageInfo items which shall be deleted from the server
  * @param error filled with error information if the connection fails
  * @return TRUE on success or FALSE if the command failed
  *
- * Delete all messages in the passed list from the remote server.  The function takes advantage
- * of the RFC 2449 @em PIPELINING
+ * Delete all messages in the passed list from the remote server.  The function takes advantage of the RFC 
2449 @em PIPELINING
  * capability if supported by the remote server.
  */
-gboolean net_client_pop_dele(NetClientPop *client,
-                             GList        *msg_list,
-                             GError      **error);
+gboolean net_client_pop_dele(NetClientPop *client, GList *msg_list, GError **error);
 
 
 /** @brief Free POP3 message item information
@@ -328,21 +254,15 @@ void net_client_pop_msg_info_free(NetClientPopMessageInfo *info);
 
 /** @file
  *
- * This module implements a POP3 client class conforming with <a
- * href="https://tools.ietf.org/html/rfc1939";>RFC 1939</a>.
+ * This module implements a POP3 client class conforming with <a 
href="https://tools.ietf.org/html/rfc1939";>RFC 1939</a>.
  *
  * The following features are supported:
  * - the <i>STAT</i>, <i>LIST</i>, <i>RETR</i> and <i>DELE</i> commands as defined in RFC 1939;
- * - support for <i>PIPELINING</i> and <i>UIDL</i> as defined by <a
- * href="https://tools.ietf.org/html/rfc2449";>RFC 2449</a>;
- * - <i>STLS</i> encryption as defined by <a href="https://tools.ietf.org/html/rfc2595";>RFC
- * 2595</a>;
- * - authentication using <i>APOP</i>, <i>USER/PASS</i> (both RFC 1939) or the SASL methods
- *<i>PLAIN</i>, <i>LOGIN</i>,
- *   <i>CRAM-MD5</i>, <i>CRAM-SHA1</i> or <i>GSSAPI</i> (see <a
- * href="https://tools.ietf.org/html/rfc4752";>RFC 4752</a> and
- *   <a href="https://tools.ietf.org/html/rfc5034";>RFC 5034</a>), depending upon the
- * capabilities reported by the server.  Note the
+ * - support for <i>PIPELINING</i> and <i>UIDL</i> as defined by <a 
href="https://tools.ietf.org/html/rfc2449";>RFC 2449</a>;
+ * - <i>STLS</i> encryption as defined by <a href="https://tools.ietf.org/html/rfc2595";>RFC 2595</a>;
+ * - authentication using <i>APOP</i>, <i>USER/PASS</i> (both RFC 1939) or the SASL methods <i>PLAIN</i>, 
<i>LOGIN</i>,
+ *   <i>CRAM-MD5</i>, <i>CRAM-SHA1</i> or <i>GSSAPI</i> (see <a 
href="https://tools.ietf.org/html/rfc4752";>RFC 4752</a> and
+ *   <a href="https://tools.ietf.org/html/rfc5034";>RFC 5034</a>), depending upon the capabilities reported 
by the server.  Note the
  *   <i>GSSAPI</i> is available only if configured with gssapi support.
  */
 
diff --git a/libnetclient/net-client-smtp.c b/libnetclient/net-client-smtp.c
index 6be5729..975492a 100644
--- a/libnetclient/net-client-smtp.c
+++ b/libnetclient/net-client-smtp.c
@@ -2,18 +2,13 @@
  *
  * Copyright (C) Albrecht Dreß <mailto:albrecht dress arcor de> 2017
  *
- * This library is free software; you can redistribute it and/or modify it under the terms of
- * the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 
General Public License
+ * as published by the Free Software Foundation; either version 3 of the License, or (at your option) any 
later version.
  *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
- * License for more details.
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 
the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
details.
  *
- * You should have received a copy of the GNU Lesser General Public License along with this
- * library. If not, see
+ * You should have received a copy of the GNU Lesser General Public License along with this library. If not, 
see
  * <http://www.gnu.org/licenses/>.
  */
 
@@ -24,35 +19,34 @@
 
 
 struct _NetClientSmtpPrivate {
-    NetClientCryptMode crypt_mode;
-    guint auth_allowed[2];                      /** 0: encrypted, 1: unencrypted */
-    gboolean can_dsn;
-    gboolean data_state;
+       NetClientCryptMode crypt_mode;
+       guint auth_allowed[2];                  /** 0: encrypted, 1: unencrypted */
+       gboolean can_dsn;
+       gboolean data_state;
 };
 
 
 struct _NetClientSmtpMessage {
-    gchar *sender;
-    GList *recipients;
-    gchar *dsn_envid;
-    gboolean dsn_ret_full;
-    gboolean have_dsn_rcpt;
-    NetClientSmtpSendCb data_callback;
-    gpointer user_data;
+       gchar *sender;
+       GList *recipients;
+       gchar *dsn_envid;
+       gboolean dsn_ret_full;
+       gboolean have_dsn_rcpt;
+       NetClientSmtpSendCb data_callback;
+       gpointer user_data;
 };
 
 
 typedef struct {
-    gchar *rfc5321_addr;
-    NetClientSmtpDsnMode dsn_mode;
+       gchar *rfc5321_addr;
+       NetClientSmtpDsnMode dsn_mode;
 } smtp_rcpt_t;
 
 
-/* Note: RFC 5321 defines a maximum line length of 512 octets, including the terminating CRLF.
-    However, RFC 4954, Sect. 4. defines
+/* Note: RFC 5321 defines a maximum line length of 512 octets, including the terminating CRLF.  However, RFC 
4954, Sect. 4. defines
  * 12288 octets as safe maximum length for SASL authentication. */
-#define MAX_SMTP_LINE_LEN                       12288U
-#define SMTP_DATA_BUF_SIZE                      8192U
+#define MAX_SMTP_LINE_LEN                      12288U
+#define SMTP_DATA_BUF_SIZE                     8192U
 
 
 G_DEFINE_TYPE(NetClientSmtp, net_client_smtp, NET_CLIENT_TYPE)
@@ -60,870 +54,714 @@ G_DEFINE_TYPE(NetClientSmtp, net_client_smtp, NET_CLIENT_TYPE)
 
 static void net_client_smtp_dispose(GObject *object);
 static void net_client_smtp_finalise(GObject *object);
-static gboolean net_client_smtp_ehlo(NetClientSmtp *client,
-                                     guint         *auth_supported,
-                                     gboolean      *can_starttls,
-                                     GError       **error);
-static gboolean net_client_smtp_starttls(NetClientSmtp *client,
-                                         GError       **error);
-static gboolean net_client_smtp_execute(NetClientSmtp *client,
-                                        const gchar   *request_fmt,
-                                        gchar        **last_reply,
-                                        GError       **error,
-                                        ...)
-G_GNUC_PRINTF(2, 5);
-static gboolean net_client_smtp_auth(NetClientSmtp *client,
-                                     const gchar   *user,
-                                     const gchar   *passwd,
-                                     guint          auth_supported,
-                                     GError       **error);
-static gboolean net_client_smtp_auth_plain(NetClientSmtp *client,
-                                           const gchar   *user,
-                                           const gchar   *passwd,
-                                           GError       **error);
-static gboolean net_client_smtp_auth_login(NetClientSmtp *client,
-                                           const gchar   *user,
-                                           const gchar   *passwd,
-                                           GError       **error);
-static gboolean net_client_smtp_auth_cram(NetClientSmtp *client,
-                                          GChecksumType  chksum_type,
-                                          const gchar   *user,
-                                          const gchar   *passwd,
-                                          GError       **error);
-static gboolean net_client_smtp_auth_gssapi(NetClientSmtp *client,
-                                            const gchar   *user,
-                                            GError       **error);
-static gboolean net_client_smtp_read_reply(NetClientSmtp *client,
-                                           gint           expect_code,
-                                           gchar        **last_reply,
-                                           GError       **error);
-static gboolean net_client_smtp_eval_rescode(gint         res_code,
-                                             const gchar *reply,
-                                             GError     **error);
-static gchar *net_client_smtp_dsn_to_string(const NetClientSmtp *client,
-                                            NetClientSmtpDsnMode dsn_mode);
+static gboolean net_client_smtp_ehlo(NetClientSmtp *client, guint *auth_supported, gboolean *can_starttls, 
GError **error);
+static gboolean net_client_smtp_starttls(NetClientSmtp *client, GError **error);
+static gboolean net_client_smtp_execute(NetClientSmtp *client, const gchar *request_fmt, gchar **last_reply, 
GError **error, ...)
+       G_GNUC_PRINTF(2, 5);
+static gboolean net_client_smtp_auth(NetClientSmtp *client, const gchar *user, const gchar *passwd, guint 
auth_supported,
+                                                                        GError **error);
+static gboolean net_client_smtp_auth_plain(NetClientSmtp *client, const gchar *user, const gchar *passwd, 
GError **error);
+static gboolean net_client_smtp_auth_login(NetClientSmtp *client, const gchar *user, const gchar *passwd, 
GError **error);
+static gboolean net_client_smtp_auth_cram(NetClientSmtp *client, GChecksumType chksum_type, const gchar 
*user, const gchar *passwd,
+                                                                                 GError **error);
+static gboolean net_client_smtp_auth_gssapi(NetClientSmtp *client, const gchar *user, GError **error);
+static gboolean net_client_smtp_read_reply(NetClientSmtp *client, gint expect_code, gchar **last_reply, 
GError **error);
+static gboolean net_client_smtp_eval_rescode(gint res_code, const gchar *reply, GError **error);
+static gchar *net_client_smtp_dsn_to_string(const NetClientSmtp *client, NetClientSmtpDsnMode dsn_mode);
 static void smtp_rcpt_free(smtp_rcpt_t *rcpt);
 
 
 NetClientSmtp *
-net_client_smtp_new(const gchar       *host,
-                    guint16            port,
-                    NetClientCryptMode crypt_mode)
+net_client_smtp_new(const gchar *host, guint16 port, NetClientCryptMode crypt_mode)
 {
-    NetClientSmtp *client;
-
-    g_return_val_if_fail((host != NULL) && (crypt_mode >= NET_CLIENT_CRYPT_ENCRYPTED) &&
-                         (crypt_mode <= NET_CLIENT_CRYPT_NONE),
-                         NULL);
-
-    client = NET_CLIENT_SMTP(g_object_new(NET_CLIENT_SMTP_TYPE, NULL));
-    if (client != NULL) {
-        if (!net_client_configure(NET_CLIENT(client), host, port, MAX_SMTP_LINE_LEN, NULL)) {
-            g_object_unref(G_OBJECT(client));
-            client = NULL;
-        } else {
-            client->priv->crypt_mode = crypt_mode;
-        }
-    }
-
-    return client;
+       NetClientSmtp *client;
+
+       g_return_val_if_fail((host != NULL) && (crypt_mode >= NET_CLIENT_CRYPT_ENCRYPTED) && (crypt_mode <= 
NET_CLIENT_CRYPT_NONE),
+               NULL);
+
+       client = NET_CLIENT_SMTP(g_object_new(NET_CLIENT_SMTP_TYPE, NULL));
+       if (client != NULL) {
+               if (!net_client_configure(NET_CLIENT(client), host, port, MAX_SMTP_LINE_LEN, NULL)) {
+                       g_object_unref(G_OBJECT(client));
+                       client = NULL;
+               } else {
+                       client->priv->crypt_mode = crypt_mode;
+               }
+       }
+
+       return client;
 }
 
 
 gboolean
-net_client_smtp_allow_auth(NetClientSmtp *client,
-                           gboolean       encrypted,
-                           guint          allow_auth)
+net_client_smtp_allow_auth(NetClientSmtp *client, gboolean encrypted, guint allow_auth)
 {
-    /* paranoia check */
-    g_return_val_if_fail(NET_IS_CLIENT_SMTP(client), FALSE);
-    if (encrypted) {
-        client->priv->auth_allowed[0] = allow_auth;
-    } else {
-        client->priv->auth_allowed[1] = allow_auth;
-    }
-    return TRUE;
+       /* paranoia check */
+       g_return_val_if_fail(NET_IS_CLIENT_SMTP(client), FALSE);
+       if (encrypted) {
+               client->priv->auth_allowed[0] = allow_auth;
+       } else {
+               client->priv->auth_allowed[1] = allow_auth;
+       }
+       return TRUE;
 }
 
 
 gboolean
-net_client_smtp_connect(NetClientSmtp *client,
-                        gchar        **greeting,
-                        GError       **error)
+net_client_smtp_connect(NetClientSmtp *client, gchar **greeting, GError **error)
 {
-    gboolean result;
-    gboolean can_starttls = FALSE;
-    guint auth_supported = 0U;
-
-    /* paranoia checks */
-    g_return_val_if_fail(NET_IS_CLIENT_SMTP(client), FALSE);
-
-    /* establish connection, and immediately switch to TLS if required */
-    result = net_client_connect(NET_CLIENT(client), error);
-    if (result && (client->priv->crypt_mode == NET_CLIENT_CRYPT_ENCRYPTED)) {
-        result = net_client_start_tls(NET_CLIENT(client), error);
-    }
-
-    /* get the greeting */
-    if (result) {
-        (void) net_client_set_timeout(NET_CLIENT(client), 5U * 60U);            /* RFC 5321,
-                                                                                   Sect.
-                                                                                   4.5.3.2.1.: 5
-                                                                                   minutes
-                                                                                   timeout */
-        result = net_client_smtp_read_reply(client, 220, greeting, error);
-    }
-
-    /* send EHLO and read the capabilities of the server */
-    if (result) {
-        result = net_client_smtp_ehlo(client, &auth_supported, &can_starttls, error);
-    }
-
-    /* perform STARTTLS if required, and send EHLO again */
-    if (result &&
-        ((client->priv->crypt_mode == NET_CLIENT_CRYPT_STARTTLS) ||
-         (client->priv->crypt_mode == NET_CLIENT_CRYPT_STARTTLS_OPT))) {
-        if (!can_starttls) {
-            if (client->priv->crypt_mode == NET_CLIENT_CRYPT_STARTTLS) {
-                g_set_error(error,
-                            NET_CLIENT_SMTP_ERROR_QUARK,
-                            (gint) NET_CLIENT_ERROR_SMTP_NO_STARTTLS,
-                            _("remote server does not support STARTTLS"));
-                result = FALSE;
-            }
-        } else {
-            result = net_client_smtp_starttls(client, error);
-            if (result) {
-                result = net_client_smtp_ehlo(client, &auth_supported, &can_starttls, error);
-            }
-        }
-    }
-
-    /* authenticate if we were successful so far */
-    if (result) {
-        gchar **auth_data;
-        gboolean need_pwd;
-
-        auth_data = NULL;
-        need_pwd = (auth_supported & NET_CLIENT_SMTP_AUTH_NO_PWD) == 0U;
-        g_debug("emit 'auth' signal for client %p", client);
-        g_signal_emit_by_name(client, "auth", need_pwd, &auth_data);
-        if ((auth_data != NULL) && (auth_data[0] != NULL)) {
-            result = net_client_smtp_auth(client,
-                                          auth_data[0],
-                                          auth_data[1],
-                                          auth_supported,
-                                          error);
-            memset(auth_data[0], 0, strlen(auth_data[0]));
-            if (auth_data[1] != NULL) {
-                memset(auth_data[1], 0, strlen(auth_data[1]));
-            }
-        }
-        g_strfreev(auth_data);
-    }
-
-    return result;
+       gboolean result;
+       gboolean can_starttls = FALSE;
+       guint auth_supported = 0U;
+
+       /* paranoia checks */
+       g_return_val_if_fail(NET_IS_CLIENT_SMTP(client), FALSE);
+
+       /* establish connection, and immediately switch to TLS if required */
+       result = net_client_connect(NET_CLIENT(client), error);
+       if (result && (client->priv->crypt_mode == NET_CLIENT_CRYPT_ENCRYPTED)) {
+               result = net_client_start_tls(NET_CLIENT(client), error);
+       }
+
+       /* get the greeting */
+       if (result) {
+               (void) net_client_set_timeout(NET_CLIENT(client), 5U * 60U);    /* RFC 5321, Sect. 
4.5.3.2.1.: 5 minutes timeout */
+               result = net_client_smtp_read_reply(client, 220, greeting, error);
+       }
+
+       /* send EHLO and read the capabilities of the server */
+       if (result) {
+               result = net_client_smtp_ehlo(client, &auth_supported, &can_starttls, error);
+       }
+
+       /* perform STARTTLS if required, and send EHLO again */
+       if (result &&
+               ((client->priv->crypt_mode == NET_CLIENT_CRYPT_STARTTLS) || (client->priv->crypt_mode == 
NET_CLIENT_CRYPT_STARTTLS_OPT))) {
+               if (!can_starttls) {
+                       if (client->priv->crypt_mode == NET_CLIENT_CRYPT_STARTTLS) {
+                               g_set_error(error, NET_CLIENT_SMTP_ERROR_QUARK, (gint) 
NET_CLIENT_ERROR_SMTP_NO_STARTTLS,
+                                       _("remote server does not support STARTTLS"));
+                               result = FALSE;
+                       }
+               } else {
+                       result = net_client_smtp_starttls(client, error);
+                       if (result) {
+                               result = net_client_smtp_ehlo(client, &auth_supported, &can_starttls, error);
+                       }
+               }
+       }
+
+       /* authenticate if we were successful so far */
+       if (result) {
+               gchar **auth_data;
+               gboolean need_pwd;
+
+               auth_data = NULL;
+               need_pwd = (auth_supported & NET_CLIENT_SMTP_AUTH_NO_PWD) == 0U;
+               g_debug("emit 'auth' signal for client %p", client);
+               g_signal_emit_by_name(client, "auth", need_pwd, &auth_data);
+               if ((auth_data != NULL) && (auth_data[0] != NULL)) {
+                       result = net_client_smtp_auth(client, auth_data[0], auth_data[1], auth_supported, 
error);
+                       memset(auth_data[0], 0, strlen(auth_data[0]));
+                       if (auth_data[1] != NULL) {
+                               memset(auth_data[1], 0, strlen(auth_data[1]));
+                       }
+               }
+               g_strfreev(auth_data);
+       }
+
+       return result;
 }
 
 
 gboolean
 net_client_smtp_can_dsn(NetClientSmtp *client)
 {
-    return NET_IS_CLIENT_SMTP(client) ? client->priv->can_dsn : FALSE;
+       return NET_IS_CLIENT_SMTP(client) ? client->priv->can_dsn : FALSE;
 }
 
 
 gboolean
-net_client_smtp_send_msg(NetClientSmtp              *client,
-                         const NetClientSmtpMessage *message,
-                         GError                    **error)
+net_client_smtp_send_msg(NetClientSmtp *client, const NetClientSmtpMessage *message, GError **error)
 {
-    NetClient *netclient;
-    gboolean result;
-    const GList *rcpt;
-
-    /* paranoia checks */
-    g_return_val_if_fail(NET_IS_CLIENT_SMTP(
-                             client) && (message != NULL) &&
-                         (message->sender != NULL) &&
-                         (message->recipients != NULL) && (message->data_callback != NULL),
-                         FALSE);
-
-    /* set the RFC 5321 sender and recipient(s) */
-    netclient = NET_CLIENT(client);             /* convenience pointer */
-    (void) net_client_set_timeout(netclient, 5U * 60U);         /* RFC 5321, Sect. 4.5.3.2.2.,
-                                                                   4.5.3.2.3.: 5 minutes timeout
-                                                                 */
-    if (client->priv->can_dsn && message->have_dsn_rcpt) {
-        if (message->dsn_envid != NULL) {
-            result = net_client_smtp_execute(client,
-                                             "MAIL FROM:<%s> RET=%s ENVID=%s",
-                                             NULL,
-                                             error,
-                                             message->sender,
-                                             (message->dsn_ret_full) ? "FULL" : "HDRS",
-                                             message->dsn_envid);
-        } else {
-            result = net_client_smtp_execute(client,
-                                             "MAIL FROM:<%s> RET=%s",
-                                             NULL,
-                                             error,
-                                             message->sender,
-                                             (message->dsn_ret_full) ? "FULL" : "HDRS");
-        }
-    } else {
-        result =
-            net_client_smtp_execute(client, "MAIL FROM:<%s>", NULL, error, message->sender);
-    }
-    rcpt = message->recipients;
-    while (result && (rcpt != NULL)) {
-        const smtp_rcpt_t *this_rcpt = (const smtp_rcpt_t *) rcpt->data;                /*lint
-                                                                                           !e9079
-                                                                                           !e9087
-                                                                                           (MISRA
-                                                                                           C:2012
-                                                                                           Rules
-                                                                                           11.3,
-                                                                                           11.5)
-                                                                                         */
-        gchar *dsn_opts;
-
-        /* create the RFC 3461 DSN string */
-        dsn_opts = net_client_smtp_dsn_to_string(client, this_rcpt->dsn_mode);
-        result = net_client_smtp_execute(client,
-                                         "RCPT TO:<%s>%s",
-                                         NULL,
-                                         error,
-                                         this_rcpt->rfc5321_addr,
-                                         dsn_opts);
-        g_free(dsn_opts);
-        rcpt = rcpt->next;
-    }
-
-    /* initialise sending the message data */
-    if (result) {
-        (void) net_client_set_timeout(netclient, 2U * 60U);             /* RFC 5321, Sect.
-                                                                           4.5.3.2.4.: 2 minutes
-                                                                           timeout */
-        result = net_client_smtp_execute(client, "DATA", NULL, error);
-    }
-
-    /* call the data callback until all data has been transmitted or an error occurs */
-    if (result) {
-        gchar buffer[SMTP_DATA_BUF_SIZE];
-        gssize count;
-        gchar last_char = '\0';
-
-        (void) net_client_set_timeout(netclient, 3U * 60U);             /* RFC 5321, Sect.
-                                                                           4.5.3.2.5.: 3 minutes
-                                                                           timeout */
-        client->priv->data_state = TRUE;
-        do {
-            count =
-                message->data_callback(buffer, SMTP_DATA_BUF_SIZE, message->user_data, error);
-            if (count < 0) {
-                result = FALSE;
-            } else if (count > 0) {
-                result = net_client_write_buffer(netclient, buffer, (gsize) count, error);
-                last_char = buffer[count - 1];
-            } else {
-                /* write termination */
-                if (last_char == '\n') {
-                    result = net_client_write_buffer(netclient, ".\r\n", 3U, error);
-                } else {
-                    result = net_client_write_buffer(netclient, "\r\n.\r\n", 5U, error);
-                }
-            }
-        } while (result && (count > 0));
-    }
-
-    if (result) {
-        (void) net_client_set_timeout(netclient, 10U * 60U);            /* RFC 5321, Sect
-                                                                           4.5.3.2.6.: 10
-                                                                           minutes timeout */
-        result = net_client_smtp_read_reply(client, -1, NULL, error);
-        client->priv->data_state = FALSE;
-    }
-
-    return result;
+       NetClient *netclient;
+       gboolean result;
+       const GList *rcpt;
+
+       /* paranoia checks */
+       g_return_val_if_fail(NET_IS_CLIENT_SMTP(client) && (message != NULL) && (message->sender != NULL) &&
+               (message->recipients != NULL) && (message->data_callback != NULL), FALSE);
+
+       /* set the RFC 5321 sender and recipient(s) */
+       netclient = NET_CLIENT(client);         /* convenience pointer */
+       (void) net_client_set_timeout(netclient, 5U * 60U);     /* RFC 5321, Sect. 4.5.3.2.2., 4.5.3.2.3.: 5 
minutes timeout */
+       if (client->priv->can_dsn && message->have_dsn_rcpt) {
+               if (message->dsn_envid != NULL) {
+                       result = net_client_smtp_execute(client, "MAIL FROM:<%s> RET=%s ENVID=%s", NULL, 
error, message->sender,
+                                                                                        
(message->dsn_ret_full) ? "FULL" : "HDRS", message->dsn_envid);
+               } else {
+                       result = net_client_smtp_execute(client, "MAIL FROM:<%s> RET=%s", NULL, error, 
message->sender,
+                                                                                        
(message->dsn_ret_full) ? "FULL" : "HDRS");
+               }
+       } else {
+               result = net_client_smtp_execute(client, "MAIL FROM:<%s>", NULL, error, message->sender);
+       }
+       rcpt = message->recipients;
+       while (result && (rcpt != NULL)) {
+               const smtp_rcpt_t *this_rcpt = (const smtp_rcpt_t *) rcpt->data;        /*lint !e9079 !e9087 
(MISRA C:2012 Rules 11.3, 11.5) */
+               gchar *dsn_opts;
+
+               /* create the RFC 3461 DSN string */
+               dsn_opts = net_client_smtp_dsn_to_string(client, this_rcpt->dsn_mode);
+               result = net_client_smtp_execute(client, "RCPT TO:<%s>%s", NULL, error, 
this_rcpt->rfc5321_addr, dsn_opts);
+               g_free(dsn_opts);
+               rcpt = rcpt->next;
+       }
+
+       /* initialise sending the message data */
+       if (result) {
+               (void) net_client_set_timeout(netclient, 2U * 60U);     /* RFC 5321, Sect. 4.5.3.2.4.: 2 
minutes timeout */
+               result = net_client_smtp_execute(client, "DATA", NULL, error);
+       }
+
+       /* call the data callback until all data has been transmitted or an error occurs */
+       if (result) {
+               gchar buffer[SMTP_DATA_BUF_SIZE];
+               gssize count;
+               gchar last_char = '\0';
+
+               (void) net_client_set_timeout(netclient, 3U * 60U);     /* RFC 5321, Sect. 4.5.3.2.5.: 3 
minutes timeout */
+               client->priv->data_state = TRUE;
+               do {
+                       count = message->data_callback(buffer, SMTP_DATA_BUF_SIZE, message->user_data, error);
+                       if (count < 0) {
+                               result = FALSE;
+                       } else if (count > 0) {
+                               result = net_client_write_buffer(netclient, buffer, (gsize) count, error);
+                               last_char = buffer[count - 1];
+                       } else {
+                               /* write termination */
+                               if (last_char == '\n') {
+                                       result = net_client_write_buffer(netclient, ".\r\n", 3U, error);
+                               } else {
+                                       result = net_client_write_buffer(netclient, "\r\n.\r\n", 5U, error);
+                               }
+                       }
+               } while (result && (count > 0));
+       }
+
+       if (result) {
+               (void) net_client_set_timeout(netclient, 10U * 60U);    /* RFC 5321, Sect 4.5.3.2.6.: 10 
minutes timeout */
+               result = net_client_smtp_read_reply(client, -1, NULL, error);
+               client->priv->data_state = FALSE;
+       }
+
+       return result;
 }
 
 
 NetClientSmtpMessage *
-net_client_smtp_msg_new(NetClientSmtpSendCb data_callback,
-                        gpointer            user_data)
+net_client_smtp_msg_new(NetClientSmtpSendCb data_callback, gpointer user_data)
 {
-    NetClientSmtpMessage *smtp_msg;
+       NetClientSmtpMessage *smtp_msg;
 
-    g_return_val_if_fail(data_callback != NULL, NULL);
+       g_return_val_if_fail(data_callback != NULL, NULL);
 
-    smtp_msg = g_new0(NetClientSmtpMessage, 1U);
-    smtp_msg->data_callback = data_callback;
-    smtp_msg->user_data = user_data;
-    return smtp_msg;
+       smtp_msg = g_new0(NetClientSmtpMessage, 1U);
+       smtp_msg->data_callback = data_callback;
+       smtp_msg->user_data = user_data;
+       return smtp_msg;
 }
 
 
 gboolean
-net_client_smtp_msg_set_dsn_opts(NetClientSmtpMessage *smtp_msg,
-                                 const gchar          *envid,
-                                 gboolean              ret_full)
+net_client_smtp_msg_set_dsn_opts(NetClientSmtpMessage *smtp_msg, const gchar *envid, gboolean ret_full)
 {
-    g_return_val_if_fail(smtp_msg != NULL, FALSE);
-
-    g_free(smtp_msg->dsn_envid);
-    if (envid != NULL) {
-        smtp_msg->dsn_envid = g_strdup(envid);
-    } else {
-        smtp_msg->dsn_envid = NULL;
-    }
-    smtp_msg->dsn_ret_full = ret_full;
-    return TRUE;
+       g_return_val_if_fail(smtp_msg != NULL, FALSE);
+
+       g_free(smtp_msg->dsn_envid);
+       if (envid != NULL) {
+               smtp_msg->dsn_envid = g_strdup(envid);
+       } else {
+               smtp_msg->dsn_envid = NULL;
+       }
+       smtp_msg->dsn_ret_full = ret_full;
+       return TRUE;
 }
 
 
 gboolean
-net_client_smtp_msg_set_sender(NetClientSmtpMessage *smtp_msg,
-                               const gchar          *rfc5321_sender)
+net_client_smtp_msg_set_sender(NetClientSmtpMessage *smtp_msg, const gchar *rfc5321_sender)
 {
-    g_return_val_if_fail((smtp_msg != NULL) && (rfc5321_sender != NULL), FALSE);
+       g_return_val_if_fail((smtp_msg != NULL) && (rfc5321_sender != NULL), FALSE);
 
-    g_free(smtp_msg->sender);
-    smtp_msg->sender = g_strdup(rfc5321_sender);
-    return TRUE;
+       g_free(smtp_msg->sender);
+       smtp_msg->sender = g_strdup(rfc5321_sender);
+       return TRUE;
 }
 
 
 gboolean
-net_client_smtp_msg_add_recipient(NetClientSmtpMessage *smtp_msg,
-                                  const gchar          *rfc5321_rcpt,
-                                  NetClientSmtpDsnMode  dsn_mode)
+net_client_smtp_msg_add_recipient(NetClientSmtpMessage *smtp_msg, const gchar *rfc5321_rcpt, 
NetClientSmtpDsnMode dsn_mode)
 {
-    smtp_rcpt_t *new_rcpt;
-
-    g_return_val_if_fail((smtp_msg != NULL) && (rfc5321_rcpt != NULL), FALSE);
-    new_rcpt = g_new0(smtp_rcpt_t, 1U);
-    new_rcpt->rfc5321_addr = g_strdup(rfc5321_rcpt);
-    new_rcpt->dsn_mode = dsn_mode;
-    smtp_msg->recipients = g_list_append(smtp_msg->recipients, new_rcpt);
-    if (dsn_mode != NET_CLIENT_SMTP_DSN_NEVER) {
-        smtp_msg->have_dsn_rcpt = TRUE;
-    }
-    return TRUE;
+       smtp_rcpt_t *new_rcpt;
+
+       g_return_val_if_fail((smtp_msg != NULL) && (rfc5321_rcpt != NULL), FALSE);
+       new_rcpt = g_new0(smtp_rcpt_t, 1U);
+       new_rcpt->rfc5321_addr = g_strdup(rfc5321_rcpt);
+       new_rcpt->dsn_mode = dsn_mode;
+       smtp_msg->recipients = g_list_append(smtp_msg->recipients, new_rcpt);
+       if (dsn_mode != NET_CLIENT_SMTP_DSN_NEVER) {
+               smtp_msg->have_dsn_rcpt = TRUE;
+       }
+       return TRUE;
 }
 
 
 void
 net_client_smtp_msg_free(NetClientSmtpMessage *smtp_msg)
 {
-    if (smtp_msg != NULL) {
-        g_free(smtp_msg->sender);
-        g_free(smtp_msg->dsn_envid);
-        /*lint -e{9074} -e{9087}       accept safe (and required) pointer conversion */
-        g_list_free_full(smtp_msg->recipients, (GDestroyNotify) smtp_rcpt_free);
-        g_free(smtp_msg);
-    }
+       if (smtp_msg != NULL) {
+               g_free(smtp_msg->sender);
+               g_free(smtp_msg->dsn_envid);
+               /*lint -e{9074} -e{9087}        accept safe (and required) pointer conversion */
+               g_list_free_full(smtp_msg->recipients, (GDestroyNotify) smtp_rcpt_free);
+               g_free(smtp_msg);
+       }
 }
 
 
-/* == local functions
-   
===========================================================================================================
- */
+/* == local functions 
=========================================================================================================== */
 
 static void
 net_client_smtp_class_init(NetClientSmtpClass *klass)
 {
-    GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+       GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
 
-    gobject_class->dispose = net_client_smtp_dispose;
-    gobject_class->finalize = net_client_smtp_finalise;
+       gobject_class->dispose  = net_client_smtp_dispose;
+       gobject_class->finalize = net_client_smtp_finalise;
 }
 
 
 static void
 net_client_smtp_init(NetClientSmtp *self)
 {
-    self->priv = g_new0(NetClientSmtpPrivate, 1U);
-    self->priv->auth_allowed[0] = NET_CLIENT_SMTP_AUTH_ALL;
-    self->priv->auth_allowed[1] = NET_CLIENT_SMTP_AUTH_SAFE;
+       self->priv = g_new0(NetClientSmtpPrivate, 1U);
+       self->priv->auth_allowed[0] = NET_CLIENT_SMTP_AUTH_ALL;
+       self->priv->auth_allowed[1] = NET_CLIENT_SMTP_AUTH_SAFE;
 }
 
 
 static void
 net_client_smtp_dispose(GObject *object)
 {
-    const NetClientSmtp *client = NET_CLIENT_SMTP(object);
-    const GObjectClass *parent_class = G_OBJECT_CLASS(net_client_smtp_parent_class);
-
-    /* send the 'QUIT' command unless we are in 'DATA' state where the server will probably fail
-       to reply - no need to evaluate the
-     * reply or check for errors */
-    if (net_client_is_connected(NET_CLIENT(client)) && !client->priv->data_state) {
-        (void) net_client_execute(NET_CLIENT(client), NULL, "QUIT", NULL);
-        client->priv->data_state = TRUE;
-    }
-
-    (*parent_class->dispose)(object);
+       const NetClientSmtp *client = NET_CLIENT_SMTP(object);
+       const GObjectClass *parent_class = G_OBJECT_CLASS(net_client_smtp_parent_class);
+
+       /* send the 'QUIT' command unless we are in 'DATA' state where the server will probably fail to reply 
- no need to evaluate the
+        * reply or check for errors */
+       if (net_client_is_connected(NET_CLIENT(client)) && !client->priv->data_state) {
+               (void) net_client_execute(NET_CLIENT(client), NULL, "QUIT", NULL);
+                client->priv->data_state = TRUE;
+       }
+
+       (*parent_class->dispose)(object);
 }
 
 
 static void
 net_client_smtp_finalise(GObject *object)
 {
-    const NetClientSmtp *client = NET_CLIENT_SMTP(object);
-    const GObjectClass *parent_class = G_OBJECT_CLASS(net_client_smtp_parent_class);
+       const NetClientSmtp *client = NET_CLIENT_SMTP(object);
+       const GObjectClass *parent_class = G_OBJECT_CLASS(net_client_smtp_parent_class);
 
-    g_free(client->priv);
+       g_free(client->priv);
 
-    (*parent_class->finalize)(object);
+       (*parent_class->finalize)(object);
 }
 
 
 static gboolean
-net_client_smtp_starttls(NetClientSmtp *client,
-                         GError       **error)
+net_client_smtp_starttls(NetClientSmtp *client, GError **error)
 {
-    gboolean result;
+       gboolean result;
 
-    result = net_client_smtp_execute(client, "STARTTLS", NULL, error);
-    if (result) {
-        result = net_client_start_tls(NET_CLIENT(client), error);
-    }
+       result = net_client_smtp_execute(client, "STARTTLS", NULL, error);
+       if (result) {
+               result = net_client_start_tls(NET_CLIENT(client), error);
+       }
 
-    return result;
+       return result;
 }
 
 
 static gboolean
-net_client_smtp_auth(NetClientSmtp *client,
-                     const gchar   *user,
-                     const gchar   *passwd,
-                     guint          auth_supported,
-                     GError       **error)
+net_client_smtp_auth(NetClientSmtp *client, const gchar *user, const gchar *passwd, guint auth_supported, 
GError **error)
 {
-    gboolean result = FALSE;
-    guint auth_mask;
-
-    /* calculate the possible authentication methods */
-    if (net_client_is_encrypted(NET_CLIENT(client))) {
-        auth_mask = client->priv->auth_allowed[0] & auth_supported;
-    } else {
-        auth_mask = client->priv->auth_allowed[1] & auth_supported;
-    }
-
-    if (((auth_mask & NET_CLIENT_SMTP_AUTH_NO_PWD) == 0U) && (passwd == NULL)) {
-        g_set_error(error, NET_CLIENT_SMTP_ERROR_QUARK, (gint) NET_CLIENT_ERROR_SMTP_NO_AUTH,
-                    _("password required"));
-    } else {
-        /* first try authentication methods w/o password, then safe ones, and finally the
-           plain-text methods */
-        if ((auth_mask & NET_CLIENT_SMTP_AUTH_GSSAPI) != 0U) {
-            result = net_client_smtp_auth_gssapi(client, user, error);
-        } else if ((auth_mask & NET_CLIENT_SMTP_AUTH_CRAM_SHA1) != 0U) {
-            result = net_client_smtp_auth_cram(client, G_CHECKSUM_SHA1, user, passwd, error);
-        } else if ((auth_mask & NET_CLIENT_SMTP_AUTH_CRAM_MD5) != 0U) {
-            result = net_client_smtp_auth_cram(client, G_CHECKSUM_MD5, user, passwd, error);
-        } else if ((auth_mask & NET_CLIENT_SMTP_AUTH_PLAIN) != 0U) {
-            result = net_client_smtp_auth_plain(client, user, passwd, error);
-        } else if ((auth_mask & NET_CLIENT_SMTP_AUTH_LOGIN) != 0U) {
-            result = net_client_smtp_auth_login(client, user, passwd, error);
-        } else {
-            g_set_error(error,
-                        NET_CLIENT_SMTP_ERROR_QUARK,
-                        (gint) NET_CLIENT_ERROR_SMTP_NO_AUTH,
-                        _("no suitable authentication mechanism"));
-        }
-    }
-
-    return result;
+       gboolean result = FALSE;
+       guint auth_mask;
+
+       /* calculate the possible authentication methods */
+       if (net_client_is_encrypted(NET_CLIENT(client))) {
+               auth_mask = client->priv->auth_allowed[0] & auth_supported;
+       } else {
+               auth_mask = client->priv->auth_allowed[1] & auth_supported;
+       }
+
+       if (((auth_mask & NET_CLIENT_SMTP_AUTH_NO_PWD) == 0U) && (passwd == NULL)) {
+               g_set_error(error, NET_CLIENT_SMTP_ERROR_QUARK, (gint) NET_CLIENT_ERROR_SMTP_NO_AUTH, 
_("password required"));
+       } else {
+               /* first try authentication methods w/o password, then safe ones, and finally the plain-text 
methods */
+               if ((auth_mask & NET_CLIENT_SMTP_AUTH_GSSAPI) != 0U) {
+                       result = net_client_smtp_auth_gssapi(client, user, error);
+               } else if ((auth_mask & NET_CLIENT_SMTP_AUTH_CRAM_SHA1) != 0U) {
+                       result = net_client_smtp_auth_cram(client, G_CHECKSUM_SHA1, user, passwd, error);
+               } else if ((auth_mask & NET_CLIENT_SMTP_AUTH_CRAM_MD5) != 0U) {
+                       result = net_client_smtp_auth_cram(client, G_CHECKSUM_MD5, user, passwd, error);
+               } else if ((auth_mask & NET_CLIENT_SMTP_AUTH_PLAIN) != 0U) {
+                       result = net_client_smtp_auth_plain(client, user, passwd, error);
+               } else if ((auth_mask & NET_CLIENT_SMTP_AUTH_LOGIN) != 0U) {
+                       result = net_client_smtp_auth_login(client, user, passwd, error);
+               } else {
+                       g_set_error(error, NET_CLIENT_SMTP_ERROR_QUARK, (gint) NET_CLIENT_ERROR_SMTP_NO_AUTH,
+                               _("no suitable authentication mechanism"));
+               }
+       }
+
+       return result;
 }
 
 
 static gboolean
-net_client_smtp_auth_plain(NetClientSmtp *client,
-                           const gchar   *user,
-                           const gchar   *passwd,
-                           GError       **error)
+net_client_smtp_auth_plain(NetClientSmtp *client, const gchar *user, const gchar *passwd, GError **error)
 {
-    gboolean result;
-    gchar *base64_buf;
-
-    base64_buf = net_client_auth_plain_calc(user, passwd);
-    if (base64_buf != NULL) {
-        result = net_client_smtp_execute(client, "AUTH PLAIN %s", NULL, error, base64_buf);
-        memset(base64_buf, 0, strlen(base64_buf));
-        g_free(base64_buf);
-    } else {
-        result = FALSE;
-    }
-
-    return result;
+       gboolean result ;
+       gchar *base64_buf;
+
+       base64_buf = net_client_auth_plain_calc(user, passwd);
+       if (base64_buf != NULL) {
+               result = net_client_smtp_execute(client, "AUTH PLAIN %s", NULL, error, base64_buf);
+               memset(base64_buf, 0, strlen(base64_buf));
+               g_free(base64_buf);
+       } else {
+               result = FALSE;
+       }
+
+       return result;
 }
 
 
 static gboolean
-net_client_smtp_auth_login(NetClientSmtp *client,
-                           const gchar   *user,
-                           const gchar   *passwd,
-                           GError       **error)
+net_client_smtp_auth_login(NetClientSmtp *client, const gchar *user, const gchar *passwd, GError **error)
 {
-    gboolean result;
-    gchar *base64_buf;
-
-    base64_buf = g_base64_encode((const guchar *) user, strlen(user));
-    result = net_client_smtp_execute(client, "AUTH LOGIN %s", NULL, error, base64_buf);
-    memset(base64_buf, 0, strlen(base64_buf));
-    g_free(base64_buf);
-    if (result) {
-        base64_buf = g_base64_encode((const guchar *) passwd, strlen(passwd));
-        result = net_client_smtp_execute(client, "%s", NULL, error, base64_buf);
-        memset(base64_buf, 0, strlen(base64_buf));
-        g_free(base64_buf);
-    }
-
-    return result;
+       gboolean result;
+       gchar *base64_buf;
+
+       base64_buf = g_base64_encode((const guchar *) user, strlen(user));
+       result = net_client_smtp_execute(client, "AUTH LOGIN %s", NULL, error, base64_buf);
+       memset(base64_buf, 0, strlen(base64_buf));
+       g_free(base64_buf);
+       if (result) {
+               base64_buf = g_base64_encode((const guchar *) passwd, strlen(passwd));
+               result = net_client_smtp_execute(client, "%s", NULL, error, base64_buf);
+               memset(base64_buf, 0, strlen(base64_buf));
+               g_free(base64_buf);
+       }
+
+       return result;
 }
 
 
 static gboolean
-net_client_smtp_auth_cram(NetClientSmtp *client,
-                          GChecksumType  chksum_type,
-                          const gchar   *user,
-                          const gchar   *passwd,
-                          GError       **error)
+net_client_smtp_auth_cram(NetClientSmtp *client, GChecksumType chksum_type, const gchar *user, const gchar 
*passwd, GError **error)
 {
-    gboolean result;
-    gchar *challenge = NULL;
-
-    result = net_client_smtp_execute(client,
-                                     "AUTH CRAM-%s",
-                                     &challenge,
-                                     error,
-                                     net_client_chksum_to_str(chksum_type));
-    if (result) {
-        gchar *auth_buf;
-
-        auth_buf = net_client_cram_calc(challenge, chksum_type, user, passwd);
-        if (auth_buf != NULL) {
-            result = net_client_smtp_execute(client, "%s", NULL, error, auth_buf);
-            memset(auth_buf, 0, strlen(auth_buf));
-            g_free(auth_buf);
-        } else {
-            result = FALSE;
-        }
-    }
-    g_free(challenge);
-
-    return result;
+       gboolean result;
+       gchar *challenge = NULL;
+
+       result = net_client_smtp_execute(client, "AUTH CRAM-%s", &challenge, error, 
net_client_chksum_to_str(chksum_type));
+       if (result) {
+               gchar *auth_buf;
+
+               auth_buf = net_client_cram_calc(challenge, chksum_type, user, passwd);
+               if (auth_buf != NULL) {
+                       result = net_client_smtp_execute(client, "%s", NULL, error, auth_buf);
+                       memset(auth_buf, 0, strlen(auth_buf));
+                       g_free(auth_buf);
+               } else {
+                       result = FALSE;
+               }
+       }
+       g_free(challenge);
+
+       return result;
 }
 
 
 #if defined(HAVE_GSSAPI)
 
 static gboolean
-net_client_smtp_auth_gssapi(NetClientSmtp *client,
-                            const gchar   *user,
-                            GError       **error)
+net_client_smtp_auth_gssapi(NetClientSmtp *client, const gchar *user, GError **error)
 {
-    NetClientGssCtx *gss_ctx;
-    gboolean result = FALSE;
-
-    gss_ctx = net_client_gss_ctx_new("smtp", net_client_get_host(NET_CLIENT(
-                                                                     client)), user, error);
-    if (gss_ctx != NULL) {
-        gint state;
-        gboolean initial = TRUE;
-        gchar *input_token = NULL;
-        gchar *output_token = NULL;
-
-        do {
-            state = net_client_gss_auth_step(gss_ctx, input_token, &output_token, error);
-            g_free(input_token);
-            input_token = NULL;
-            if (state >= 0) {
-                if (initial) {
-                    result = net_client_smtp_execute(client,
-                                                     "AUTH GSSAPI %s",
-                                                     &input_token,
-                                                     error,
-                                                     output_token);
-                    initial = FALSE;
-                } else {
-                    result = net_client_smtp_execute(client,
-                                                     "%s",
-                                                     &input_token,
-                                                     error,
-                                                     output_token);
-                }
-            }
-            g_free(output_token);
-        } while (result && (state == 0));
-
-        if (state == 1) {
-            output_token = net_client_gss_auth_finish(gss_ctx, input_token, error);
-            if (output_token != NULL) {
-                result = net_client_smtp_execute(client, "%s", NULL, error, output_token);
-                g_free(output_token);
-            }
-        }
-        g_free(input_token);
-        net_client_gss_ctx_free(gss_ctx);
-    }
-
-    return result;
+       NetClientGssCtx *gss_ctx;
+       gboolean result = FALSE;
+
+       gss_ctx = net_client_gss_ctx_new("smtp", net_client_get_host(NET_CLIENT(client)), user, error);
+       if (gss_ctx != NULL) {
+               gint state;
+               gboolean initial = TRUE;
+               gchar *input_token = NULL;
+               gchar *output_token = NULL;
+
+               do {
+                       state = net_client_gss_auth_step(gss_ctx, input_token, &output_token, error);
+                       g_free(input_token);
+                       input_token = NULL;
+                       if (state >= 0) {
+                               if (initial) {
+                                       result = net_client_smtp_execute(client, "AUTH GSSAPI %s", 
&input_token, error, output_token);
+                                       initial = FALSE;
+                               } else {
+                                       result = net_client_smtp_execute(client, "%s", &input_token, error, 
output_token);
+                               }
+                       }
+                       g_free(output_token);
+               } while (result && (state == 0));
+
+               if (state == 1) {
+                       output_token = net_client_gss_auth_finish(gss_ctx, input_token, error);
+                       if (output_token != NULL) {
+                           result = net_client_smtp_execute(client, "%s", NULL, error, output_token);
+                           g_free(output_token);
+                       }
+               }
+               g_free(input_token);
+               net_client_gss_ctx_free(gss_ctx);
+       }
+
+       return result;
 }
 
-
 #else
 
 /*lint -e{715} -e{818} */
 static gboolean
-net_client_smtp_auth_gssapi(NetClientSmtp G_GNUC_UNUSED *client,
-                            const gchar G_GNUC_UNUSED   *user,
-                            GError G_GNUC_UNUSED       **error)
+net_client_smtp_auth_gssapi(NetClientSmtp G_GNUC_UNUSED *client, const gchar G_GNUC_UNUSED *user, GError 
G_GNUC_UNUSED **error)
 {
-    g_assert_not_reached();                     /* this should never happen! */
-    return FALSE;                                       /* never reached, make gcc happy */
+       g_assert_not_reached();                 /* this should never happen! */
+       return FALSE;                                   /* never reached, make gcc happy */
 }
 
-
 #endif  /* HAVE_GSSAPI */
 
 
 /* note: if supplied, last_reply is never NULL on success */
 static gboolean
-net_client_smtp_execute(NetClientSmtp *client,
-                        const gchar   *request_fmt,
-                        gchar        **last_reply,
-                        GError       **error,
-                        ...)
+net_client_smtp_execute(NetClientSmtp *client, const gchar *request_fmt, gchar **last_reply, GError **error, 
...)
 {
-    va_list args;
-    gboolean result;
+       va_list args;
+       gboolean result;
 
-    va_start(args, error);              /*lint !e413   a NULL error argument is irrelevant here
-                                         */
-    result = net_client_vwrite_line(NET_CLIENT(client), request_fmt, args, error);
-    va_end(args);
+       va_start(args, error);          /*lint !e413    a NULL error argument is irrelevant here */
+       result = net_client_vwrite_line(NET_CLIENT(client), request_fmt, args, error);
+       va_end(args);
 
-    if (result) {
-        result = net_client_smtp_read_reply(client, -1, last_reply, error);
-    }
+       if (result) {
+               result = net_client_smtp_read_reply(client, -1, last_reply, error);
+       }
 
-    return result;
+       return result;
 }
 
 
 static gboolean
-net_client_smtp_ehlo(NetClientSmtp *client,
-                     guint         *auth_supported,
-                     gboolean      *can_starttls,
-                     GError       **error)
+net_client_smtp_ehlo(NetClientSmtp *client, guint *auth_supported, gboolean *can_starttls, GError **error)
 {
-    gboolean result;
-    gboolean done;
-
-    result = net_client_write_line(NET_CLIENT(client), "EHLO %s", error, g_get_host_name());
-
-    /* clear all capability flags */
-    *auth_supported = 0U;
-    client->priv->can_dsn = FALSE;
-    *can_starttls = FALSE;
-
-    /* evaluate the response */
-    done = FALSE;
-    while (result && !done) {
-        gchar *reply;
-
-        result = net_client_read_line(NET_CLIENT(client), &reply, error);
-        if (result) {
-            gint reply_code;
-            gchar *endptr;
-
-            reply_code = strtol(reply, &endptr, 10);
-            if (reply_code != 250) {
-                g_set_error(error,
-                            NET_CLIENT_SMTP_ERROR_QUARK,
-                            (gint) NET_CLIENT_ERROR_SMTP_PROTOCOL,
-                            _("bad server reply: %s"),
-                            reply);
-                result = FALSE;
-            } else {
-                if (strcmp(&endptr[1], "DSN") == 0) {
-                    client->priv->can_dsn = TRUE;
-                } else if (strcmp(&endptr[1], "STARTTLS") == 0) {
-                    *can_starttls = TRUE;
-                } else if ((strncmp(&endptr[1], "AUTH ",
-                                    5U) == 0) || (strncmp(&endptr[1], "AUTH=", 5U) == 0)) {
-                    gchar **auth;
-                    guint n;
-
-                    auth = g_strsplit(&endptr[6], " ", -1);
-                    for (n = 0U; auth[n] != NULL; n++) {
-                        if (strcmp(auth[n], "PLAIN") == 0) {
-                            *auth_supported |= NET_CLIENT_SMTP_AUTH_PLAIN;
-                        } else if (strcmp(auth[n], "LOGIN") == 0) {
-                            *auth_supported |= NET_CLIENT_SMTP_AUTH_LOGIN;
-                        } else if (strcmp(auth[n], "CRAM-MD5") == 0) {
-                            *auth_supported |= NET_CLIENT_SMTP_AUTH_CRAM_MD5;
-                        } else if (strcmp(auth[n], "CRAM-SHA1") == 0) {
-                            *auth_supported |= NET_CLIENT_SMTP_AUTH_CRAM_SHA1;
+       gboolean result;
+       gboolean done;
+
+       result = net_client_write_line(NET_CLIENT(client), "EHLO %s", error, g_get_host_name());
+
+       /* clear all capability flags */
+       *auth_supported = 0U;
+       client->priv->can_dsn = FALSE;
+       *can_starttls = FALSE;
+
+       /* evaluate the response */
+       done = FALSE;
+       while (result && !done) {
+               gchar *reply;
+
+               result = net_client_read_line(NET_CLIENT(client), &reply, error);
+               if (result) {
+                       gint reply_code;
+                       gchar *endptr;
+
+                       reply_code = strtol(reply, &endptr, 10);
+                       if (reply_code != 250) {
+                               g_set_error(error, NET_CLIENT_SMTP_ERROR_QUARK, (gint) 
NET_CLIENT_ERROR_SMTP_PROTOCOL,
+                                       _("bad server reply: %s"), reply);
+                               result = FALSE;
+                       } else {
+                               if (strcmp(&endptr[1], "DSN") == 0) {
+                                       client->priv->can_dsn = TRUE;
+                               } else if (strcmp(&endptr[1], "STARTTLS") == 0) {
+                                       *can_starttls = TRUE;
+                               } else if ((strncmp(&endptr[1], "AUTH ", 5U) == 0) || (strncmp(&endptr[1], 
"AUTH=", 5U) == 0)) {
+                                       gchar **auth;
+                                       guint n;
+
+                                       auth = g_strsplit(&endptr[6], " ", -1);
+                                       for (n = 0U; auth[n] != NULL; n++) {
+                                               if (strcmp(auth[n], "PLAIN") == 0) {
+                                                       *auth_supported |= NET_CLIENT_SMTP_AUTH_PLAIN;
+                                               } else if (strcmp(auth[n], "LOGIN") == 0) {
+                                                       *auth_supported |= NET_CLIENT_SMTP_AUTH_LOGIN;
+                                               } else if (strcmp(auth[n], "CRAM-MD5") == 0) {
+                                                       *auth_supported |= NET_CLIENT_SMTP_AUTH_CRAM_MD5;
+                                               } else if (strcmp(auth[n], "CRAM-SHA1") == 0) {
+                                                       *auth_supported |= NET_CLIENT_SMTP_AUTH_CRAM_SHA1;
 #if defined(HAVE_GSSAPI)
-                        } else if (strcmp(auth[n], "GSSAPI") == 0) {
-                            *auth_supported |= NET_CLIENT_SMTP_AUTH_GSSAPI;
+                                               } else if (strcmp(auth[n], "GSSAPI") == 0) {
+                                                       *auth_supported |= NET_CLIENT_SMTP_AUTH_GSSAPI;
 #endif
-                        } else {
-                            /* other auth methods are ignored for the time being */
-                        }
-                    }
-                    g_strfreev(auth);
-                } else {
-                    /* ignored (see MISRA C:2012, Rule 15.7) */
-                }
-
-                if (*endptr == ' ') {
-                    done = TRUE;
-                }
-            }
-
-            g_free(reply);
-        }
-    }
-
-    return result;
+                                               } else {
+                                                       /* other auth methods are ignored for the time being 
*/
+                                               }
+                                       }
+                                       g_strfreev(auth);
+                               } else {
+                                       /* ignored (see MISRA C:2012, Rule 15.7) */
+                               }
+
+                               if (*endptr == ' ') {
+                                       done = TRUE;
+                               }
+                       }
+
+                       g_free(reply);
+               }
+       }
+
+       return result;
 }
 
 
-/* Note: according to RFC 5321, sect. 4.2, \em any reply may be multiline.  If supplied,
-   last_reply is never NULL on success */
+/* Note: according to RFC 5321, sect. 4.2, \em any reply may be multiline.  If supplied, last_reply is never 
NULL on success */
 static gboolean
-net_client_smtp_read_reply(NetClientSmtp *client,
-                           gint           expect_code,
-                           gchar        **last_reply,
-                           GError       **error)
+net_client_smtp_read_reply(NetClientSmtp *client, gint expect_code, gchar **last_reply, GError **error)
 {
-    gint rescode;
-    gboolean done;
-    gboolean result;
-
-    done = FALSE;
-    rescode = expect_code;
-    do {
-        gchar *reply;
-
-        result = net_client_read_line(NET_CLIENT(client), &reply, error);
-        if (result) {
-            gint this_rescode;
-            gchar *endptr;
-
-            this_rescode = strtol(reply, &endptr, 10);
-            if (rescode == -1) {
-                rescode = this_rescode;
-                result = net_client_smtp_eval_rescode(rescode, reply, error);
-            } else if (rescode != this_rescode) {
-                g_set_error(error,
-                            NET_CLIENT_SMTP_ERROR_QUARK,
-                            (gint) NET_CLIENT_ERROR_SMTP_PROTOCOL,
-                            _("bad server reply: %s"),
-                            reply);
-                result = FALSE;
-            } else {
-                /* nothing to do (see MISRA C:2012, Rule 15.7) */
-            }
-            if (reply[3] == ' ') {
-                done = TRUE;
-                if (last_reply != NULL) {
-                    *last_reply = g_strdup(&reply[4]);
-                }
-            }
-
-            g_free(reply);
-        }
-    } while (result && !done);
-
-    return result;
+       gint rescode;
+       gboolean done;
+       gboolean result;
+
+       done = FALSE;
+       rescode = expect_code;
+       do {
+               gchar *reply;
+
+               result = net_client_read_line(NET_CLIENT(client), &reply, error);
+               if (result) {
+                       gint this_rescode;
+                       gchar *endptr;
+
+                       this_rescode = strtol(reply, &endptr, 10);
+                       if (rescode == -1) {
+                               rescode = this_rescode;
+                               result = net_client_smtp_eval_rescode(rescode, reply, error);
+                       } else if (rescode != this_rescode) {
+                               g_set_error(error, NET_CLIENT_SMTP_ERROR_QUARK, (gint) 
NET_CLIENT_ERROR_SMTP_PROTOCOL,
+                                       _("bad server reply: %s"), reply);
+                               result = FALSE;
+                       } else {
+                               /* nothing to do (see MISRA C:2012, Rule 15.7) */
+                       }
+                       if (reply[3] == ' ') {
+                               done = TRUE;
+                               if (last_reply != NULL) {
+                                       *last_reply = g_strdup(&reply[4]);
+                               }
+                       }
+
+                       g_free(reply);
+               }
+       } while (result && !done);
+
+       return result;
 }
 
 
 static gboolean
-net_client_smtp_eval_rescode(gint         res_code,
-                             const gchar *reply,
-                             GError     **error)
+net_client_smtp_eval_rescode(gint res_code, const gchar *reply, GError **error)
 {
-    gboolean result;
-
-    switch (res_code / 100) {
-    case 2:
-    case 3:
-        result = TRUE;
-        break;
-
-    case 4:
-        g_set_error(error, NET_CLIENT_SMTP_ERROR_QUARK, (gint) NET_CLIENT_ERROR_SMTP_TRANSIENT,
-                    _("transient error %d: %s"), res_code, reply);
-        result = FALSE;
-        break;
-
-    case 5:
-        g_set_error(error, NET_CLIENT_SMTP_ERROR_QUARK, (gint) NET_CLIENT_ERROR_SMTP_PERMANENT,
-                    _("permanent error %d: %s"), res_code, reply);
-        result = FALSE;
-        break;
-
-    default:
-        g_set_error(error, NET_CLIENT_SMTP_ERROR_QUARK, (gint) NET_CLIENT_ERROR_SMTP_PROTOCOL,
-                    _("bad server reply: %s"), reply);
-        result = FALSE;
-        break;
-    }
-
-    return result;
+       gboolean result;
+
+       switch (res_code / 100) {
+       case 2:
+       case 3:
+               result = TRUE;
+               break;
+       case 4:
+               g_set_error(error, NET_CLIENT_SMTP_ERROR_QUARK, (gint) NET_CLIENT_ERROR_SMTP_TRANSIENT,
+                       _("transient error %d: %s"), res_code, reply);
+               result = FALSE;
+               break;
+       case 5:
+               g_set_error(error, NET_CLIENT_SMTP_ERROR_QUARK, (gint) NET_CLIENT_ERROR_SMTP_PERMANENT,
+                       _("permanent error %d: %s"), res_code, reply);
+               result = FALSE;
+               break;
+       default:
+               g_set_error(error, NET_CLIENT_SMTP_ERROR_QUARK, (gint) NET_CLIENT_ERROR_SMTP_PROTOCOL,
+                       _("bad server reply: %s"), reply);
+               result = FALSE;
+               break;
+       }
+
+       return result;
 }
 
 
 static gchar *
-net_client_smtp_dsn_to_string(const NetClientSmtp *client,
-                              NetClientSmtpDsnMode dsn_mode)
+net_client_smtp_dsn_to_string(const NetClientSmtp *client, NetClientSmtpDsnMode dsn_mode)
 {
-    gchar *result;
-
-    /* create the RFC 3461 DSN string */
-    if (client->priv->can_dsn && (dsn_mode != NET_CLIENT_SMTP_DSN_NEVER)) {
-        GString *dsn_buf;
-        gsize start_len;
-
-        dsn_buf = g_string_new(" NOTIFY=");
-        start_len = dsn_buf->len;
-        /*lint -save -e655 -e9027 -e9029       accept logical AND for enum, MISRA C:2012 Rules
-           10.1, 10.4 */
-        if ((dsn_mode & NET_CLIENT_SMTP_DSN_DELAY) == NET_CLIENT_SMTP_DSN_DELAY) {
-            dsn_buf = g_string_append(dsn_buf, "DELAY");
-        }
-        if ((dsn_mode & NET_CLIENT_SMTP_DSN_FAILURE) == NET_CLIENT_SMTP_DSN_FAILURE) {
-            if (start_len != dsn_buf->len) {
-                dsn_buf = g_string_append_c(dsn_buf, ',');
-            }
-            dsn_buf = g_string_append(dsn_buf, "FAILURE");
-        }
-        if ((dsn_mode & NET_CLIENT_SMTP_DSN_SUCCESS) == NET_CLIENT_SMTP_DSN_SUCCESS) {
-            if (start_len != dsn_buf->len) {
-                dsn_buf = g_string_append_c(dsn_buf, ',');
-            }
-            dsn_buf = g_string_append(dsn_buf, "SUCCESS");
-        }
-        /*lint -restore */
-        result = g_string_free(dsn_buf, FALSE);
-    } else {
-        result = g_strdup("");
-    }
-
-    return result;
+       gchar *result;
+
+       /* create the RFC 3461 DSN string */
+       if (client->priv->can_dsn && (dsn_mode != NET_CLIENT_SMTP_DSN_NEVER)) {
+               GString *dsn_buf;
+               gsize start_len;
+
+               dsn_buf = g_string_new(" NOTIFY=");
+               start_len = dsn_buf->len;
+               /*lint -save -e655 -e9027 -e9029        accept logical AND for enum, MISRA C:2012 Rules 10.1, 
10.4 */
+               if ((dsn_mode & NET_CLIENT_SMTP_DSN_DELAY) == NET_CLIENT_SMTP_DSN_DELAY) {
+                       dsn_buf = g_string_append(dsn_buf, "DELAY");
+               }
+               if ((dsn_mode & NET_CLIENT_SMTP_DSN_FAILURE) == NET_CLIENT_SMTP_DSN_FAILURE) {
+                       if (start_len != dsn_buf->len) {
+                               dsn_buf = g_string_append_c(dsn_buf, ',');
+                       }
+                       dsn_buf = g_string_append(dsn_buf, "FAILURE");
+               }
+               if ((dsn_mode & NET_CLIENT_SMTP_DSN_SUCCESS) == NET_CLIENT_SMTP_DSN_SUCCESS) {
+                       if (start_len != dsn_buf->len) {
+                               dsn_buf = g_string_append_c(dsn_buf, ',');
+                       }
+                       dsn_buf = g_string_append(dsn_buf, "SUCCESS");
+               }
+               /*lint -restore */
+               result = g_string_free(dsn_buf, FALSE);
+       } else {
+               result = g_strdup("");
+       }
+
+       return result;
 }
 
 
 static void
 smtp_rcpt_free(smtp_rcpt_t *rcpt)
 {
-    g_free(rcpt->rfc5321_addr);
-    g_free(rcpt);
+       g_free(rcpt->rfc5321_addr);
+       g_free(rcpt);
 }
diff --git a/libnetclient/net-client-smtp.h b/libnetclient/net-client-smtp.h
index 918d5ed..5634c81 100644
--- a/libnetclient/net-client-smtp.h
+++ b/libnetclient/net-client-smtp.h
@@ -2,18 +2,13 @@
  *
  * Copyright (C) Albrecht Dreß <mailto:albrecht dress arcor de> 2017
  *
- * This library is free software; you can redistribute it and/or modify it under the terms of
- * the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along with this
- * library. If not, see
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 
General Public License
+ * as published by the Free Software Foundation; either version 3 of the License, or (at your option) any 
later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 
the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this library. If not, 
see
  * <http://www.gnu.org/licenses/>.
  */
 
@@ -27,23 +22,14 @@
 G_BEGIN_DECLS
 
 
-#define NET_CLIENT_SMTP_TYPE                            (net_client_smtp_get_type())
-#define NET_CLIENT_SMTP(obj)                            (G_TYPE_CHECK_INSTANCE_CAST((obj), \
-                                                                                    NET_CLIENT_SMTP_TYPE, \
-                                                                                    NetClientSmtp))
-#define NET_IS_CLIENT_SMTP(obj)                         (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
-                                                                                    NET_CLIENT_SMTP_TYPE))
-#define NET_CLIENT_SMTP_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST((klass), \
-                                                                         NET_CLIENT_SMTP_TYPE, \
-                                                                         NetClientSmtpClass))
-#define NET_IS_CLIENT_SMTP_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE((klass), \
-                                                                         NET_CLIENT_SMTP_TYPE))
-#define NET_CLIENT_SMTP_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS((obj), \
-                                                                           NET_CLIENT_SMTP_TYPE, \
-                                                                           NetClientSmtpClass))
+#define NET_CLIENT_SMTP_TYPE                           (net_client_smtp_get_type())
+#define NET_CLIENT_SMTP(obj)                           (G_TYPE_CHECK_INSTANCE_CAST((obj), 
NET_CLIENT_SMTP_TYPE, NetClientSmtp))
+#define NET_IS_CLIENT_SMTP(obj)                                (G_TYPE_CHECK_INSTANCE_TYPE((obj), 
NET_CLIENT_SMTP_TYPE))
+#define NET_CLIENT_SMTP_CLASS(klass)           (G_TYPE_CHECK_CLASS_CAST((klass), NET_CLIENT_SMTP_TYPE, 
NetClientSmtpClass))
+#define NET_IS_CLIENT_SMTP_CLASS(klass)                (G_TYPE_CHECK_CLASS_TYPE((klass), 
NET_CLIENT_SMTP_TYPE))
+#define NET_CLIENT_SMTP_GET_CLASS(obj)         (G_TYPE_INSTANCE_GET_CLASS((obj), NET_CLIENT_SMTP_TYPE, 
NetClientSmtpClass))
 
-#define NET_CLIENT_SMTP_ERROR_QUARK                     (g_quark_from_static_string( \
-                                                             "net-client-smtp"))
+#define NET_CLIENT_SMTP_ERROR_QUARK                    (g_quark_from_static_string("net-client-smtp"))
 
 
 typedef struct _NetClientSmtp NetClientSmtp;
@@ -55,16 +41,11 @@ typedef enum _NetClientSmtpDsnMode NetClientSmtpDsnMode;
 
 /** @brief SMTP-specific error codes */
 enum _NetClientSmtpError {
-    NET_CLIENT_ERROR_SMTP_PROTOCOL = 1,                 /**< A bad server reply has been
-                                                           received. */
-    NET_CLIENT_ERROR_SMTP_TRANSIENT,                    /**< The server replied with a transient
-                                                           error code (code 4yz). */
-    NET_CLIENT_ERROR_SMTP_PERMANENT,                    /**< The server replied with a permanent
-                                                           error code (code 5yz). */
-    NET_CLIENT_ERROR_SMTP_NO_AUTH,              /**< The server offers no suitable
-                                                   authentication mechanism. */
-    NET_CLIENT_ERROR_SMTP_NO_STARTTLS                   /**< The server does not support
-                                                           STARTTLS. */
+       NET_CLIENT_ERROR_SMTP_PROTOCOL = 1,             /**< A bad server reply has been received. */
+       NET_CLIENT_ERROR_SMTP_TRANSIENT,                /**< The server replied with a transient error code 
(code 4yz). */
+       NET_CLIENT_ERROR_SMTP_PERMANENT,                /**< The server replied with a permanent error code 
(code 5yz). */
+       NET_CLIENT_ERROR_SMTP_NO_AUTH,          /**< The server offers no suitable authentication mechanism. 
*/
+       NET_CLIENT_ERROR_SMTP_NO_STARTTLS               /**< The server does not support STARTTLS. */
 };
 
 
@@ -72,25 +53,23 @@ enum _NetClientSmtpError {
  * @{
  */
 /** RFC 4616 "PLAIN" authentication method. */
-#define NET_CLIENT_SMTP_AUTH_PLAIN                      0x01U
+#define NET_CLIENT_SMTP_AUTH_PLAIN                     0x01U
 /** "LOGIN" authentication method. */
-#define NET_CLIENT_SMTP_AUTH_LOGIN                      0x02U
+#define NET_CLIENT_SMTP_AUTH_LOGIN                     0x02U
 /** RFC 2195 "CRAM-MD5" authentication method. */
-#define NET_CLIENT_SMTP_AUTH_CRAM_MD5           0x04U
+#define NET_CLIENT_SMTP_AUTH_CRAM_MD5          0x04U
 /** RFC xxxx "CRAM-SHA1" authentication method. */
-#define NET_CLIENT_SMTP_AUTH_CRAM_SHA1          0x08U
+#define NET_CLIENT_SMTP_AUTH_CRAM_SHA1         0x08U
 /** RFC 4752 "GSSAPI" authentication method. */
-#define NET_CLIENT_SMTP_AUTH_GSSAPI                     0x10U
-/** Mask of all safe authentication methods, i.e. all methods which do not send the cleartext
-   password. */
-#define NET_CLIENT_SMTP_AUTH_SAFE                       \
-    (NET_CLIENT_SMTP_AUTH_CRAM_MD5 + NET_CLIENT_SMTP_AUTH_CRAM_SHA1 + \
-     NET_CLIENT_SMTP_AUTH_GSSAPI)
+#define NET_CLIENT_SMTP_AUTH_GSSAPI                    0x10U
+/** Mask of all safe authentication methods, i.e. all methods which do not send the cleartext password. */
+#define NET_CLIENT_SMTP_AUTH_SAFE                      \
+       (NET_CLIENT_SMTP_AUTH_CRAM_MD5 + NET_CLIENT_SMTP_AUTH_CRAM_SHA1 + NET_CLIENT_SMTP_AUTH_GSSAPI)
 /** Mask of all authentication methods. */
-#define NET_CLIENT_SMTP_AUTH_ALL                        \
-    (NET_CLIENT_SMTP_AUTH_PLAIN + NET_CLIENT_SMTP_AUTH_LOGIN + NET_CLIENT_SMTP_AUTH_SAFE)
+#define NET_CLIENT_SMTP_AUTH_ALL                       \
+       (NET_CLIENT_SMTP_AUTH_PLAIN + NET_CLIENT_SMTP_AUTH_LOGIN + NET_CLIENT_SMTP_AUTH_SAFE)
 /** Mask of all authentication methods which do not require a password. */
-#define NET_CLIENT_SMTP_AUTH_NO_PWD                     NET_CLIENT_SMTP_AUTH_GSSAPI
+#define NET_CLIENT_SMTP_AUTH_NO_PWD                    NET_CLIENT_SMTP_AUTH_GSSAPI
 /** @} */
 
 
@@ -101,25 +80,20 @@ struct _NetClientSmtp {
 
 
 struct _NetClientSmtpClass {
-    NetClientClass parent;
+       NetClientClass parent;
 };
 
 
 /** @brief Delivery Status Notification mode
  *
- * See <a href="https://tools.ietf.org/html/rfc3461";>RFC 3461</a> for a description of Delivery
- * Status Notifications (DSNs).  The
+ * See <a href="https://tools.ietf.org/html/rfc3461";>RFC 3461</a> for a description of Delivery Status 
Notifications (DSNs).  The
  * DSN mode is the logical OR of these options.
  */
 enum _NetClientSmtpDsnMode {
-    NET_CLIENT_SMTP_DSN_NEVER = 0,                      /**< Never request a DSN (do not combine
-                                                           with other options). */
-    NET_CLIENT_SMTP_DSN_SUCCESS = 1,                    /**< Request a DSN on successful
-                                                           delivery. */
-    NET_CLIENT_SMTP_DSN_FAILURE = 2,                    /**< Request a DSN on delivery failure.
-                                                         */
-    NET_CLIENT_SMTP_DSN_DELAY = 4                       /**< Request a DSN if delivery of a
-                                                           message has been delayed. */
+       NET_CLIENT_SMTP_DSN_NEVER = 0,                  /**< Never request a DSN (do not combine with other 
options). */
+       NET_CLIENT_SMTP_DSN_SUCCESS = 1,                /**< Request a DSN on successful delivery. */
+       NET_CLIENT_SMTP_DSN_FAILURE = 2,                /**< Request a DSN on delivery failure. */
+       NET_CLIENT_SMTP_DSN_DELAY = 4                   /**< Request a DSN if delivery of a message has been 
delayed. */
 };
 
 
@@ -130,25 +104,18 @@ enum _NetClientSmtpDsnMode {
  * - @em count - maximum number of bytes which may be written to @em buffer
  * - @em user_data - user data pointer (_NetClientSmtpMessage::user_data)
  * - @em error - shall be filled with error information if an error occurs in the callback
- * - return value: a value > 0 indicating the number of bytes written to @em buffer, or 0 to
- * indicate that all data has been
+ * - return value: a value > 0 indicating the number of bytes written to @em buffer, or 0 to indicate that 
all data has been
  *   transferred, or a value < 0 to indicate an error in the callback function.
  *
- * @note The callback function is responsible for properly formatting the message body according
- * to
- *       <a href="https://tools.ietf.org/html/rfc5321";>RFC 5321</a>, <a
- * href="https://tools.ietf.org/html/rfc5322";>RFC 5322</a> and
- *       further relevant standards, e.g. by using <a
- * href="http://spruce.sourceforge.net/gmime/";>GMime</a>.
+ * @note The callback function is responsible for properly formatting the message body according to
+ *       <a href="https://tools.ietf.org/html/rfc5321";>RFC 5321</a>, <a 
href="https://tools.ietf.org/html/rfc5322";>RFC 5322</a> and
+ *       further relevant standards, e.g. by using <a href="http://spruce.sourceforge.net/gmime/";>GMime</a>.
  */
-typedef gssize (*NetClientSmtpSendCb)(gchar   *buffer,
-                                      gsize    count,
-                                      gpointer user_data,
-                                      GError **error);
+typedef gssize (*NetClientSmtpSendCb)(gchar *buffer, gsize count, gpointer user_data, GError **error);
 
 
 GType net_client_smtp_get_type(void)
-G_GNUC_CONST;
+       G_GNUC_CONST;
 
 
 /** @brief Create a new SMTP network client
@@ -158,9 +125,7 @@ G_GNUC_CONST;
  * @param crypt_mode encryption mode
  * @return the SMTP network client object
  */
-NetClientSmtp *net_client_smtp_new(const gchar       *host,
-                                   guint16            port,
-                                   NetClientCryptMode crypt_mode);
+NetClientSmtp *net_client_smtp_new(const gchar *host, guint16 port, NetClientCryptMode crypt_mode);
 
 
 /** @brief Set allowed SMTP AUTH methods
@@ -170,15 +135,12 @@ NetClientSmtp *net_client_smtp_new(const gchar       *host,
  * @param allow_auth mask of allowed authentication methods
  * @return TRUE on success or FALSE on error
  *
- * Set the allowed authentication methods for the passed connection.  The default is @ref
- * NET_CLIENT_SMTP_AUTH_ALL for encrypted and
+ * Set the allowed authentication methods for the passed connection.  The default is @ref 
NET_CLIENT_SMTP_AUTH_ALL for encrypted and
  * @ref NET_CLIENT_SMTP_AUTH_SAFE for unencrypted connections, respectively.
  *
  * @note Call this function @em before calling net_client_smtp_connect().
  */
-gboolean net_client_smtp_allow_auth(NetClientSmtp *client,
-                                    gboolean       encrypted,
-                                    guint          allow_auth);
+gboolean net_client_smtp_allow_auth(NetClientSmtp *client, gboolean encrypted, guint allow_auth);
 
 
 /** @brief Connect a SMTP network client
@@ -188,25 +150,19 @@ gboolean net_client_smtp_allow_auth(NetClientSmtp *client,
  * @param error filled with error information if the connection fails
  * @return TRUE on success or FALSE if the connection failed
  *
- * Connect the remote SMTP server, initialise the encryption if requested, and emit the @ref
- * auth signal to request authentication
+ * Connect the remote SMTP server, initialise the encryption if requested, and emit the @ref auth signal to 
request authentication
  * information.  Simply ignore the signal for an unauthenticated connection.
  *
- * The function will try only @em one authentication method supported by the server and enabled
- * for the current encryption state
- * (see net_client_smtp_allow_auth() and \ref NET_CLIENT_SMTP_AUTH_ALL etc.).  The priority is,
- * from highest to lowest, GSSAPI (if
+ * The function will try only @em one authentication method supported by the server and enabled for the 
current encryption state
+ * (see net_client_smtp_allow_auth() and \ref NET_CLIENT_SMTP_AUTH_ALL etc.).  The priority is, from highest 
to lowest, GSSAPI (if
  * configured), CRAM-SHA1, CRAM-MD5, PLAIN or LOGIN.
  *
- * In order to shut down a successfully established connection, just call
- *<tt>g_object_unref()</tt> on the SMTP network client
+ * In order to shut down a successfully established connection, just call <tt>g_object_unref()</tt> on the 
SMTP network client
  * object.
  *
  * @note The caller must free the returned greeting when it is not needed any more.
  */
-gboolean net_client_smtp_connect(NetClientSmtp *client,
-                                 gchar        **greeting,
-                                 GError       **error);
+gboolean net_client_smtp_connect(NetClientSmtp *client, gchar **greeting, GError **error);
 
 
 /** @brief Check if the SMTP network client supports Delivery Status Notifications
@@ -214,8 +170,7 @@ gboolean net_client_smtp_connect(NetClientSmtp *client,
  * @param client connected SMTP network client object
  * @return TRUE is DSN's are supported, FALSE if not
  *
- * Return if the connected SMTP server announced support for Delivery Status Notifications
- *(DSNs) according to
+ * Return if the connected SMTP server announced support for Delivery Status Notifications (DSNs) according 
to
  * <a href="https://tools.ietf.org/html/rfc3461";>RFC 3461</a>.
  */
 gboolean net_client_smtp_can_dsn(NetClientSmtp *client);
@@ -230,9 +185,7 @@ gboolean net_client_smtp_can_dsn(NetClientSmtp *client);
  *
  * Send the passed SMTP message to the connected SMTP server.
  */
-gboolean net_client_smtp_send_msg(NetClientSmtp              *client,
-                                  const NetClientSmtpMessage *message,
-                                  GError                    **error);
+gboolean net_client_smtp_send_msg(NetClientSmtp *client, const NetClientSmtpMessage *message, GError 
**error);
 
 
 /** @brief Create a SMTP message
@@ -241,15 +194,12 @@ gboolean net_client_smtp_send_msg(NetClientSmtp              *client,
  * @param user_data additional user data passed to the callback function
  * @return a newly create SMTP message
  *
- * Create a message suitable for transmission by calling net_client_smtp_send_msg().  At least
- * one sender and at least one recipient
- * must be added by calling net_client_smtp_msg_set_sender() and
- * net_client_smtp_msg_add_recipient(), respectively.  When the SMTP
+ * Create a message suitable for transmission by calling net_client_smtp_send_msg().  At least one sender 
and at least one recipient
+ * must be added by calling net_client_smtp_msg_set_sender() and net_client_smtp_msg_add_recipient(), 
respectively.  When the SMTP
  * message is not needed any more, call net_client_smtp_msg_free() to free it.
  */
-NetClientSmtpMessage *net_client_smtp_msg_new(NetClientSmtpSendCb data_callback,
-                                              gpointer            user_data)
-G_GNUC_MALLOC;
+NetClientSmtpMessage *net_client_smtp_msg_new(NetClientSmtpSendCb data_callback, gpointer user_data)
+       G_GNUC_MALLOC;
 
 
 /** @brief Set the sender of a SMTP message
@@ -258,12 +208,10 @@ G_GNUC_MALLOC;
  * @param rfc5321_sender RFC 5321-compliant sender address
  * @return TRUE on success or FALSE on error
  *
- * Set the sender address ("MAIL FROM" reverse-path, see <a
- * href="https://tools.ietf.org/html/rfc5321";>RFC 5321</a>) of the SMTP
+ * Set the sender address ("MAIL FROM" reverse-path, see <a href="https://tools.ietf.org/html/rfc5321";>RFC 
5321</a>) of the SMTP
  * message.
  */
-gboolean net_client_smtp_msg_set_sender(NetClientSmtpMessage *smtp_msg,
-                                        const gchar          *rfc5321_sender);
+gboolean net_client_smtp_msg_set_sender(NetClientSmtpMessage *smtp_msg, const gchar *rfc5321_sender);
 
 
 /** @brief Set options for Delivery Status Notifications
@@ -273,13 +221,10 @@ gboolean net_client_smtp_msg_set_sender(NetClientSmtpMessage *smtp_msg,
  * @param ret_full return the full message on failure instead of the headers only
  * @return TRUE on success or FALSE on error
  *
- * Set the @em ENVID and @em RET parameters for Delivery Status Notifications (DSN's).  The
- * default is to omit the ENVID and to
+ * Set the @em ENVID and @em RET parameters for Delivery Status Notifications (DSN's).  The default is to 
omit the ENVID and to
  * request headers only.
  */
-gboolean net_client_smtp_msg_set_dsn_opts(NetClientSmtpMessage *smtp_msg,
-                                          const gchar          *envid,
-                                          gboolean              ret_full);
+gboolean net_client_smtp_msg_set_dsn_opts(NetClientSmtpMessage *smtp_msg, const gchar *envid, gboolean 
ret_full);
 
 
 /** @brief Add a recipient to a SMTP message
@@ -289,13 +234,11 @@ gboolean net_client_smtp_msg_set_dsn_opts(NetClientSmtpMessage *smtp_msg,
  * @param dsn_mode Delivery Status Notification mode for the recipient
  * @return TRUE on success or FALSE on error
  *
- * Add a recipient address ("RCPT TO" forward-path, see <a
- * href="https://tools.ietf.org/html/rfc5321";>RFC 5321</a>) to the SMTP
+ * Add a recipient address ("RCPT TO" forward-path, see <a href="https://tools.ietf.org/html/rfc5321";>RFC 
5321</a>) to the SMTP
  * message.
  */
-gboolean net_client_smtp_msg_add_recipient(NetClientSmtpMessage *smtp_msg,
-                                           const gchar          *rfc5321_rcpt,
-                                           NetClientSmtpDsnMode  dsn_mode);
+gboolean net_client_smtp_msg_add_recipient(NetClientSmtpMessage *smtp_msg, const gchar *rfc5321_rcpt,
+                                                                                  NetClientSmtpDsnMode 
dsn_mode);
 
 
 /** @brief Free a SMTP message
@@ -309,21 +252,17 @@ void net_client_smtp_msg_free(NetClientSmtpMessage *smtp_msg);
 
 /** @file
  *
- * This module implements a SMTP client class conforming with <a
- * href="https://tools.ietf.org/html/rfc5321";>RFC 5321</a>.
+ * This module implements a SMTP client class conforming with <a 
href="https://tools.ietf.org/html/rfc5321";>RFC 5321</a>.
  *
  * The following additional features are supported:
- * - Authentication according to <a href="https://tools.ietf.org/html/rfc4954";>RFC 4954</a>,
- * using the methods
+ * - Authentication according to <a href="https://tools.ietf.org/html/rfc4954";>RFC 4954</a>, using the 
methods
  *   - CRAM-MD5 according to <a href="https://tools.ietf.org/html/rfc2195";>RFC 2195</a>
  *   - CRAM-SHA1 according to <a href="https://tools.ietf.org/html/rfc_TBD";>TBD</a>
  *   - PLAIN according to <a href="https://tools.ietf.org/html/rfc4616";>RFC 4616</a>
  *   - LOGIN
- *   - GSSAPI according to <a href="https://tools.ietf.org/html/rfc4752";>RFC 4752</a> (if
- * configured with gssapi support)
+ *   - GSSAPI according to <a href="https://tools.ietf.org/html/rfc4752";>RFC 4752</a> (if configured with 
gssapi support)
  * - STARTTLS encryption according to <a href="https://tools.ietf.org/html/rfc3207";>RFC 3207</a>
- * - Delivery Status Notifications (DSNs) according to <a
- * href="https://tools.ietf.org/html/rfc3461";>RFC 3461</a>
+ * - Delivery Status Notifications (DSNs) according to <a href="https://tools.ietf.org/html/rfc3461";>RFC 
3461</a>
  */
 
 
diff --git a/libnetclient/net-client-utils.c b/libnetclient/net-client-utils.c
index f132205..bcc4e80 100644
--- a/libnetclient/net-client-utils.c
+++ b/libnetclient/net-client-utils.c
@@ -2,18 +2,13 @@
  *
  * Copyright (C) Albrecht Dreß <mailto:albrecht dress arcor de> 2017
  *
- * This library is free software; you can redistribute it and/or modify it under the terms of
- * the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 
General Public License
+ * as published by the Free Software Foundation; either version 3 of the License, or (at your option) any 
later version.
  *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
- * License for more details.
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 
the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
details.
  *
- * You should have received a copy of the GNU Lesser General Public License along with this
- * library. If not, see
+ * You should have received a copy of the GNU Lesser General Public License along with this library. If not, 
see
  * <http://www.gnu.org/licenses/>.
  */
 
@@ -24,332 +19,269 @@
 #include "net-client-utils.h"
 
 #if defined(HAVE_GSSAPI)
-#   if defined(HAVE_HEIMDAL)
-#      include <gssapi.h>
-#   else
-#      include <gssapi/gssapi.h>
-#   endif
-#endif          /* HAVE_GSSAPI */
+# if defined(HAVE_HEIMDAL)
+#  include <gssapi.h>
+# else
+#  include <gssapi/gssapi.h>
+# endif
+#endif         /* HAVE_GSSAPI */
 
 
 #if defined(HAVE_GSSAPI)
 
 struct _NetClientGssCtx {
-    gchar *user;
-    gss_ctx_id_t context;
+       gchar *user;
+       gss_ctx_id_t context;
     gss_name_t target_name;
     OM_uint32 req_flags;
 };
 
 
-static gchar *gss_error_string(OM_uint32 err_maj,
-                               OM_uint32 err_min)
-G_GNUC_WARN_UNUSED_RESULT;
+static gchar *gss_error_string(OM_uint32 err_maj, OM_uint32 err_min)
+       G_GNUC_WARN_UNUSED_RESULT;
 
-#endif          /* HAVE_GSSAPI */
+#endif         /* HAVE_GSSAPI */
 
 
 gchar *
-net_client_cram_calc(const gchar  *base64_challenge,
-                     GChecksumType chksum_type,
-                     const gchar  *user,
-                     const gchar  *passwd)
+net_client_cram_calc(const gchar *base64_challenge, GChecksumType chksum_type, const gchar *user, const 
gchar *passwd)
 {
-    guchar *chal_plain;
-    gsize plain_len;
-    gchar *digest;
-    gchar *auth_buf;
-    gchar *base64_buf;
-
-    g_return_val_if_fail((base64_challenge != NULL) && (user != NULL) && (passwd != NULL),
-                         NULL);
-
-    chal_plain = g_base64_decode(base64_challenge, &plain_len);
-    digest = g_compute_hmac_for_data(chksum_type, (const guchar *) passwd, strlen(
-                                         passwd), chal_plain, plain_len);
-    memset(chal_plain, 0, plain_len);
-    g_free(chal_plain);
-
-    auth_buf = g_strdup_printf("%s %s", user, digest);
-    memset(digest, 0, strlen(digest));
-    g_free(digest);
-
-    base64_buf = g_base64_encode((const guchar *) auth_buf, strlen(auth_buf));
-    memset(auth_buf, 0, strlen(auth_buf));
-    g_free(auth_buf);
-
-    return base64_buf;
-}
+       guchar *chal_plain;
+       gsize plain_len;
+       gchar *digest;
+       gchar *auth_buf;
+       gchar *base64_buf;
 
+       g_return_val_if_fail((base64_challenge != NULL) && (user != NULL) && (passwd != NULL), NULL);
 
-const gchar *
-net_client_chksum_to_str(GChecksumType chksum_type)
-{
-    /*lint -e{904} -e{9077} -e{9090}   (MISRA C:2012 Rules 15.5, 16.1, 16.3) */
-    switch (chksum_type) {
-    case G_CHECKSUM_MD5:
-        return "MD5";
+       chal_plain = g_base64_decode(base64_challenge, &plain_len);
+       digest = g_compute_hmac_for_data(chksum_type, (const guchar *) passwd, strlen(passwd), chal_plain, 
plain_len);
+       memset(chal_plain, 0, plain_len);
+       g_free(chal_plain);
 
-    case G_CHECKSUM_SHA1:
-        return "SHA1";
+       auth_buf = g_strdup_printf("%s %s", user, digest);
+       memset(digest, 0, strlen(digest));
+       g_free(digest);
 
-    case G_CHECKSUM_SHA256:
-        return "SHA256";
+       base64_buf = g_base64_encode((const guchar *) auth_buf, strlen(auth_buf));
+       memset(auth_buf, 0, strlen(auth_buf));
+       g_free(auth_buf);
 
-    case G_CHECKSUM_SHA512:
-        return "SHA512";
+       return base64_buf;
+}
 
-    default:
-        return "_UNKNOWN_";
-    }
+
+const gchar *
+net_client_chksum_to_str(GChecksumType chksum_type)
+{
+       /*lint -e{904} -e{9077} -e{9090}        (MISRA C:2012 Rules 15.5, 16.1, 16.3) */
+       switch (chksum_type) {
+       case G_CHECKSUM_MD5:
+               return "MD5";
+       case G_CHECKSUM_SHA1:
+               return "SHA1";
+       case G_CHECKSUM_SHA256:
+               return "SHA256";
+       case G_CHECKSUM_SHA512:
+               return "SHA512";
+       default:
+               return "_UNKNOWN_";
+       }
 }
 
 
 gchar *
-net_client_auth_plain_calc(const gchar *user,
-                           const gchar *passwd)
+net_client_auth_plain_calc(const gchar *user, const gchar *passwd)
 {
-    gchar *base64_buf;
-    gchar *plain_buf;
-    size_t user_len;
-    size_t passwd_len;
-
-    g_return_val_if_fail((user != NULL) && (passwd != NULL), NULL);
-
-    user_len = strlen(user);
-    passwd_len = strlen(passwd);
-    plain_buf = g_malloc0((2U * user_len) + passwd_len + 3U);                   /*lint !e9079
-                                                                                   (MISRA C:2012
-                                                                                   Rule 11.5) */
-    strcpy(plain_buf, user);
-    strcpy(&plain_buf[user_len + 1U], user);
-    strcpy(&plain_buf[(2U * user_len) + 2U], passwd);
-    base64_buf = g_base64_encode((const guchar *) plain_buf, (2U * user_len) + passwd_len + 2U);
-    memset(plain_buf, 0, (2U * user_len) + passwd_len + 2U);
-    g_free(plain_buf);
-
-    return base64_buf;
+       gchar *base64_buf;
+       gchar *plain_buf;
+       size_t user_len;
+       size_t passwd_len;
+
+       g_return_val_if_fail((user != NULL) && (passwd != NULL), NULL);
+
+       user_len = strlen(user);
+       passwd_len = strlen(passwd);
+       plain_buf = g_malloc0((2U * user_len) + passwd_len + 3U);               /*lint !e9079 (MISRA C:2012 
Rule 11.5) */
+       strcpy(plain_buf, user);
+       strcpy(&plain_buf[user_len + 1U], user);
+       strcpy(&plain_buf[(2U * user_len) + 2U], passwd);
+       base64_buf = g_base64_encode((const guchar *) plain_buf, (2U * user_len) + passwd_len + 2U);
+       memset(plain_buf, 0, (2U * user_len) + passwd_len + 2U);
+       g_free(plain_buf);
+
+       return base64_buf;
 }
 
 
 #if defined(HAVE_GSSAPI)
 
 NetClientGssCtx *
-net_client_gss_ctx_new(const gchar *service,
-                       const gchar *host,
-                       const gchar *user,
-                       GError     **error)
+net_client_gss_ctx_new(const gchar *service, const gchar *host, const gchar *user, GError **error)
 {
-    NetClientGssCtx *gss_ctx;
-    gchar *service_str;
-    gchar *colon;
+       NetClientGssCtx *gss_ctx;
+       gchar *service_str;
+       gchar *colon;
     gss_buffer_desc request;
     OM_uint32 maj_stat;
     OM_uint32 min_stat;
 
     g_return_val_if_fail((service != NULL) && (host != NULL), NULL);
 
-    gss_ctx = g_new0(NetClientGssCtx, 1U);
-    service_str = g_strconcat(service, "@", host, NULL);
-    colon = strchr(service_str, ':');                   /*lint !e9034   accept char literal as
-                                                           int */
-    if (colon != NULL) {
-        colon[0] = '\0';                        /* strip off any port specification */
-    }
-    request.value = service_str;
-    request.length = strlen(service_str) + 1U;
-    maj_stat = gss_import_name(&min_stat,
-                               &request,
-                               GSS_C_NT_HOSTBASED_SERVICE,
-                               &gss_ctx->target_name);
+       gss_ctx = g_new0(NetClientGssCtx, 1U);
+       service_str = g_strconcat(service, "@", host, NULL);
+       colon = strchr(service_str, ':');               /*lint !e9034   accept char literal as int */
+       if (colon != NULL) {
+               colon[0] = '\0';                /* strip off any port specification */
+       }
+       request.value = service_str;
+       request.length = strlen(service_str) + 1U;
+       maj_stat = gss_import_name(&min_stat, &request, GSS_C_NT_HOSTBASED_SERVICE, &gss_ctx->target_name);
     if (GSS_ERROR(maj_stat) != 0U) {
-        gchar *gss_err = gss_error_string(maj_stat, min_stat);
-
-        g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_GSSAPI,
-                    _("importing GSS service name %s failed: %s"),
-                    service_str, gss_err);
-        g_free(gss_err);
-        g_free(gss_ctx);
-        gss_ctx = NULL;
+       gchar *gss_err = gss_error_string(maj_stat, min_stat);
+
+       g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_GSSAPI, _("importing GSS service 
name %s failed: %s"),
+               service_str, gss_err);
+       g_free(gss_err);
+       g_free(gss_ctx);
+       gss_ctx = NULL;
     } else {
-        /* configure the context according to RFC 4752, Sect. 3.1 */
-        gss_ctx->req_flags = GSS_C_INTEG_FLAG + GSS_C_MUTUAL_FLAG + GSS_C_SEQUENCE_FLAG +
-            GSS_C_CONF_FLAG;
-        gss_ctx->user = g_strdup(user);
+       /* configure the context according to RFC 4752, Sect. 3.1 */
+       gss_ctx->req_flags = GSS_C_INTEG_FLAG + GSS_C_MUTUAL_FLAG + GSS_C_SEQUENCE_FLAG + GSS_C_CONF_FLAG;
+       gss_ctx->user = g_strdup(user);
     }
 
-    g_free(service_str);
+       g_free(service_str);
     return gss_ctx;
 }
 
 
 gint
-net_client_gss_auth_step(NetClientGssCtx *gss_ctx,
-                         const gchar     *in_token,
-                         gchar          **out_token,
-                         GError         **error)
+net_client_gss_auth_step(NetClientGssCtx *gss_ctx, const gchar *in_token, gchar **out_token, GError **error)
 {
     OM_uint32 maj_stat;
     OM_uint32 min_stat;
     gss_buffer_desc input_token;
-    gss_buffer_desc output_token;
-    gint result;
-
-    g_return_val_if_fail((gss_ctx != NULL) && (out_token != NULL), -1);
-
-    if (in_token != NULL) {
-        gsize out_len;
-
-        input_token.value = g_base64_decode(in_token, &out_len);
-        input_token.length = out_len;
-    } else {
-        input_token.value = NULL;
-        input_token.length = 0U;
-    }
-
-    maj_stat = gss_init_sec_context(&min_stat,
-                                    GSS_C_NO_CREDENTIAL,
-                                    &gss_ctx->context,
-                                    gss_ctx->target_name,
-                                    GSS_C_NO_OID,
-                                    gss_ctx->req_flags,
-                                    0U,
-                                    GSS_C_NO_CHANNEL_BINDINGS,
-                                    &input_token,
-                                    NULL,
-                                    &output_token,
-                                    NULL,
-                                    NULL);
-
-    if ((maj_stat != GSS_S_COMPLETE) && (maj_stat != GSS_S_CONTINUE_NEEDED)) {
-        gchar *gss_err = gss_error_string(maj_stat, min_stat);
-
-        g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_GSSAPI,
-                    _("cannot initialize GSS security context: %s"),
-                    gss_err);
-        g_free(gss_err);
-        result = -1;
-    } else {
-        if (output_token.length > 0U) {
-            *out_token = g_base64_encode(output_token.value, output_token.length);                      
/*lint
-                                                                                                           
!e9079
-                                                                                                           
(MISRA
-                                                                                                           
C:2012
-                                                                                                           
Rule
-                                                                                                           
11.5)
-                                                                                                         */
-        } else {
-            *out_token = g_strdup("");
-        }
-        (void) gss_release_buffer(&min_stat, &output_token);
-        if (maj_stat == GSS_S_COMPLETE) {
-            result = 1;
-        } else {
-            result = 0;
-        }
-    }
-    (void) gss_release_buffer(&min_stat, &input_token);
-
-    return result;
+       gss_buffer_desc output_token;
+       gint result;
+
+       g_return_val_if_fail((gss_ctx != NULL) && (out_token != NULL), -1);
+
+       if (in_token != NULL) {
+               gsize out_len;
+
+               input_token.value = g_base64_decode(in_token, &out_len);
+               input_token.length = out_len;
+       } else {
+               input_token.value = NULL;
+               input_token.length = 0U;
+       }
+
+       maj_stat = gss_init_sec_context(&min_stat, GSS_C_NO_CREDENTIAL, &gss_ctx->context, 
gss_ctx->target_name, GSS_C_NO_OID,
+               gss_ctx->req_flags, 0U, GSS_C_NO_CHANNEL_BINDINGS, &input_token, NULL, &output_token, NULL, 
NULL);
+
+       if ((maj_stat != GSS_S_COMPLETE) && (maj_stat != GSS_S_CONTINUE_NEEDED)) {
+       gchar *gss_err = gss_error_string(maj_stat, min_stat);
+
+       g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_GSSAPI, _("cannot initialize GSS 
security context: %s"),
+               gss_err);
+       g_free(gss_err);
+       result = -1;
+       } else {
+               if (output_token.length > 0U) {
+                       *out_token = g_base64_encode(output_token.value, output_token.length);          
/*lint !e9079 (MISRA C:2012 Rule 11.5) */
+               } else {
+                       *out_token = g_strdup("");
+               }
+               (void) gss_release_buffer(&min_stat, &output_token);
+               if (maj_stat == GSS_S_COMPLETE) {
+                       result = 1;
+               } else {
+                       result = 0;
+               }
+       }
+       (void) gss_release_buffer(&min_stat, &input_token);
+
+       return result;
 }
 
 
 gchar *
-net_client_gss_auth_finish(const NetClientGssCtx *gss_ctx,
-                           const gchar           *in_token,
-                           GError               **error)
+net_client_gss_auth_finish(const NetClientGssCtx *gss_ctx, const gchar *in_token, GError **error)
 {
-    OM_uint32 maj_stat;
-    OM_uint32 min_stat;
-    gsize out_len;
+       OM_uint32 maj_stat;
+       OM_uint32 min_stat;
+       gsize out_len;
     gss_buffer_desc input_token;
-    gss_buffer_desc output_token;
-    gchar *result = NULL;
-
-    input_token.value = g_base64_decode(in_token, &out_len);
-    input_token.length = out_len;
-    maj_stat = gss_unwrap(&min_stat, gss_ctx->context, &input_token, &output_token, NULL, NULL);
-    if (maj_stat != GSS_S_COMPLETE) {
-        gchar *gss_err = gss_error_string(maj_stat, min_stat);
-
-        g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_GSSAPI,
-                    _("malformed GSS security token: %s"), gss_err);
-        g_free(gss_err);
-    } else {
-        const guchar *src;
-
-        /* RFC 4752 requires a token length of 4, and a first octet == 0x01 */
-        src = (unsigned char *) output_token.value;                     /*lint !e9079  (MISRA
-                                                                           C:2012 Rule 11.5) */
-        if ((output_token.length != 4U) || (src[0] != 0x01U)) {
-            (void) gss_release_buffer(&min_stat, &output_token);
-            g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_GSSAPI,
-                        _("malformed GSS security token"));
-        } else {
-            guchar *dst;
-
-            (void) gss_release_buffer(&min_stat, &input_token);
-            input_token.length = strlen(gss_ctx->user) + 4U;
-            input_token.value = g_malloc(input_token.length);
-            dst = input_token.value;                            /*lint !e9079  (MISRA C:2012
-                                                                   Rule 11.5) */
-            memcpy(input_token.value, output_token.value, 4U);
-            (void) gss_release_buffer(&min_stat, &output_token);
-            memcpy(&dst[4], gss_ctx->user, input_token.length - 4U);
-
-            maj_stat = gss_wrap(&min_stat,
-                                gss_ctx->context,
-                                0,
-                                GSS_C_QOP_DEFAULT,
-                                &input_token,
-                                NULL,
-                                &output_token);
-            if (maj_stat != GSS_S_COMPLETE) {
-                gchar *gss_err = gss_error_string(maj_stat, min_stat);
-
-                g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_GSSAPI,
-                            _("cannot create GSS login request: %s"),
-                            gss_err);
-                g_free(gss_err);
-            } else {
-                result = g_base64_encode(output_token.value, output_token.length);                           
   /*lint
-                                                                                                             
      !e9079
-                                                                                                             
      (MISRA
-                                                                                                             
      C:2012
-                                                                                                             
      Rule
-                                                                                                             
      11.5)
-                                                                                                             
    */
-                (void) gss_release_buffer(&min_stat, &output_token);
-            }
-        }
-    }
-
-    (void) gss_release_buffer(&min_stat, &input_token);
-    return result;
+       gss_buffer_desc output_token;
+       gchar *result = NULL;
+
+       input_token.value = g_base64_decode(in_token, &out_len);
+       input_token.length = out_len;
+       maj_stat = gss_unwrap(&min_stat, gss_ctx->context, &input_token, &output_token, NULL, NULL);
+       if (maj_stat != GSS_S_COMPLETE) {
+       gchar *gss_err = gss_error_string(maj_stat, min_stat);
+
+       g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_GSSAPI, _("malformed GSS security 
token: %s"), gss_err);
+       g_free(gss_err);
+       } else {
+               const guchar *src;
+
+               /* RFC 4752 requires a token length of 4, and a first octet == 0x01 */
+               src = (unsigned char *) output_token.value;             /*lint !e9079   (MISRA C:2012 Rule 
11.5) */
+               if ((output_token.length != 4U) || (src[0] != 0x01U)) {
+                       (void) gss_release_buffer(&min_stat, &output_token);
+               g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_GSSAPI, _("malformed GSS 
security token"));
+               } else {
+                       guchar *dst;
+
+                       (void) gss_release_buffer(&min_stat, &input_token);
+                       input_token.length = strlen(gss_ctx->user) + 4U;
+                       input_token.value = g_malloc(input_token.length);
+                       dst = input_token.value;                /*lint !e9079   (MISRA C:2012 Rule 11.5) */
+                       memcpy(input_token.value, output_token.value, 4U);
+                       (void) gss_release_buffer(&min_stat, &output_token);
+                       memcpy(&dst[4], gss_ctx->user, input_token.length - 4U);
+
+                       maj_stat = gss_wrap(&min_stat, gss_ctx->context, 0, GSS_C_QOP_DEFAULT, &input_token, 
NULL, &output_token);
+                       if (maj_stat != GSS_S_COMPLETE) {
+                               gchar *gss_err = gss_error_string(maj_stat, min_stat);
+
+                               g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_GSSAPI, 
_("cannot create GSS login request: %s"),
+                                       gss_err);
+                               g_free(gss_err);
+                       } else {
+                               result = g_base64_encode(output_token.value, output_token.length);            
  /*lint !e9079 (MISRA C:2012 Rule 11.5) */
+                               (void) gss_release_buffer(&min_stat, &output_token);
+                       }
+               }
+       }
+
+       (void) gss_release_buffer(&min_stat, &input_token);
+       return result;
 }
 
 
 void
 net_client_gss_ctx_free(NetClientGssCtx *gss_ctx)
 {
-    if (gss_ctx != NULL) {
-        OM_uint32 min_stat;
-
-        if (gss_ctx->context != NULL) {
-            (void) gss_delete_sec_context(&min_stat, &gss_ctx->context, GSS_C_NO_BUFFER);
-        }
-        if (gss_ctx->target_name != NULL) {
-            (void) gss_release_name(&min_stat, &gss_ctx->target_name);
-        }
-        g_free(gss_ctx->user);
-        g_free(gss_ctx);
-    }
+       if (gss_ctx != NULL) {
+               OM_uint32 min_stat;
+
+               if (gss_ctx->context != NULL) {
+                       (void) gss_delete_sec_context(&min_stat, &gss_ctx->context, GSS_C_NO_BUFFER);
+               }
+           if (gss_ctx->target_name != NULL) {
+               (void) gss_release_name(&min_stat, &gss_ctx->target_name);
+           }
+           g_free(gss_ctx->user);
+               g_free(gss_ctx);
+       }
 }
 
 
 static gchar *
-gss_error_string(OM_uint32 err_maj,
-                 OM_uint32 err_min)
+gss_error_string(OM_uint32 err_maj, OM_uint32 err_min)
 {
     OM_uint32 maj_stat;
     OM_uint32 min_stat;
@@ -359,55 +291,30 @@ gss_error_string(OM_uint32 err_maj,
     gchar *result;
 
     do {
-        maj_stat = gss_display_status(&min_stat,
-                                      err_maj,
-                                      GSS_C_GSS_CODE,
-                                      GSS_C_NO_OID,
-                                      &msg_ctx,
-                                      &status_string);
-        if (GSS_ERROR(maj_stat) == 0U) {
-            if (message->len > 0U) {
-                message = g_string_append(message, "; ");
-            }
-            message = g_string_append(message, (const gchar *) status_string.value);            /*lint
-                                                                                                   !e9079
-                                                                                                   (MISRA
-                                                                                                   C:2012
-                                                                                                   Rule
-                                                                                                   11.5)
-                                                                                                 */
-            (void) gss_release_buffer(&min_stat, &status_string);
-
-            maj_stat = gss_display_status(&min_stat,
-                                          err_min,
-                                          GSS_C_MECH_CODE,
-                                          GSS_C_NULL_OID,
-                                          &msg_ctx,
-                                          &status_string);
-            if (GSS_ERROR(maj_stat) == 0U) {
-                message = g_string_append(message, ": ");
-                message = g_string_append(message, (const gchar *) status_string.value);           /*lint
-                                                                                                      !e9079
-                                                                                                      (MISRA
-                                                                                                      C:2012
-                                                                                                      Rule
-                                                                                                      11.5)
-                                                                                                    */
-                (void) gss_release_buffer(&min_stat, &status_string);
-            }
-        }
+       maj_stat = gss_display_status(&min_stat, err_maj, GSS_C_GSS_CODE, GSS_C_NO_OID, &msg_ctx, 
&status_string);
+       if (GSS_ERROR(maj_stat) == 0U) {
+               if (message->len > 0U) {
+                       message = g_string_append(message, "; ");
+               }
+               message = g_string_append(message, (const gchar *) status_string.value);        /*lint !e9079 
(MISRA C:2012 Rule 11.5) */
+               (void) gss_release_buffer(&min_stat, &status_string);
+
+               maj_stat = gss_display_status(&min_stat, err_min, GSS_C_MECH_CODE, GSS_C_NULL_OID, &msg_ctx, 
&status_string);
+               if (GSS_ERROR(maj_stat) == 0U) {
+                       message = g_string_append(message, ": ");
+                       message = g_string_append(message, (const gchar *) status_string.value);   /*lint 
!e9079 (MISRA C:2012 Rule 11.5) */
+                       (void) gss_release_buffer(&min_stat, &status_string);
+               }
+       }
     } while ((GSS_ERROR(maj_stat) == 0U) && (msg_ctx != 0U));
 
     if (message->len > 0U) {
-        result = g_string_free(message, FALSE);
+       result = g_string_free(message, FALSE);
     } else {
-        (void) g_string_free(message, TRUE);
-        result = g_strdup_printf(_(
-                                     "unknown error code %u:%u"), (unsigned) err_maj,
-                                 (unsigned) err_min);
+       (void) g_string_free(message, TRUE);
+       result = g_strdup_printf(_("unknown error code %u:%u"), (unsigned) err_maj, (unsigned) err_min);
     }
-    return result;
+       return result;
 }
 
-
-#endif          /* HAVE_GSSAPI */
+#endif         /* HAVE_GSSAPI */
diff --git a/libnetclient/net-client-utils.h b/libnetclient/net-client-utils.h
index 9445a12..f4c0a8f 100644
--- a/libnetclient/net-client-utils.h
+++ b/libnetclient/net-client-utils.h
@@ -2,18 +2,13 @@
  *
  * Copyright (C) Albrecht Dreß <mailto:albrecht dress arcor de> 2017
  *
- * This library is free software; you can redistribute it and/or modify it under the terms of
- * the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along with this
- * library. If not, see
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 
General Public License
+ * as published by the Free Software Foundation; either version 3 of the License, or (at your option) any 
later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 
the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this library. If not, 
see
  * <http://www.gnu.org/licenses/>.
  */
 
@@ -32,7 +27,7 @@ G_BEGIN_DECLS
 
 typedef struct _NetClientGssCtx NetClientGssCtx;
 
-#endif          /* HAVE_GSSAPI */
+#endif         /* HAVE_GSSAPI */
 
 
 /** @brief Calculate a CRAM authentication string
@@ -43,21 +38,15 @@ typedef struct _NetClientGssCtx NetClientGssCtx;
  * @param passwd password
  * @return a newly allocated string containing the base64-encoded authentication
  *
- * This helper function calculates the the base64-encoded authentication string from the server
- * challenge, the user name and the
- * password according to the standards <a href="https://tools.ietf.org/html/rfc2104";>RFC 2104
- *(MD5, SHA1)</a> and
- * <a href="https://tools.ietf.org/html/rfc4868";>RFC 4868 (SHA256, SHA512)</a>.  The caller
- * shall free the returned string when it
+ * This helper function calculates the the base64-encoded authentication string from the server challenge, 
the user name and the
+ * password according to the standards <a href="https://tools.ietf.org/html/rfc2104";>RFC 2104 (MD5, 
SHA1)</a> and
+ * <a href="https://tools.ietf.org/html/rfc4868";>RFC 4868 (SHA256, SHA512)</a>.  The caller shall free the 
returned string when it
  * is not needed any more.
  *
  * \sa <a href="https://tools.ietf.org/html/rfc2195";>RFC 2195</a>.
  */
-gchar *net_client_cram_calc(const gchar  *base64_challenge,
-                            GChecksumType chksum_type,
-                            const gchar  *user,
-                            const gchar  *passwd)
-G_GNUC_MALLOC;
+gchar *net_client_cram_calc(const gchar *base64_challenge, GChecksumType chksum_type, const gchar *user, 
const gchar *passwd)
+       G_GNUC_MALLOC;
 
 
 /** @brief Get the checksum type as string
@@ -74,15 +63,12 @@ const gchar *net_client_chksum_to_str(GChecksumType chksum_type);
  * @param passwd password
  * @return a newly allocated string containing the base64-encoded authentication
  *
- * This helper function calculates the the base64-encoded SASL AUTH PLAIN authentication string
- * from the user name and the password
- * according to <a href="https://tools.ietf.org/html/rfc4616";>RFC 4616</a>.  The caller shall
- * free the returned string when it is
+ * This helper function calculates the the base64-encoded SASL AUTH PLAIN authentication string from the 
user name and the password
+ * according to <a href="https://tools.ietf.org/html/rfc4616";>RFC 4616</a>.  The caller shall free the 
returned string when it is
  * not needed any more.
  */
-gchar *net_client_auth_plain_calc(const gchar *user,
-                                  const gchar *passwd)
-G_GNUC_MALLOC;
+gchar *net_client_auth_plain_calc(const gchar *user, const gchar *passwd)
+       G_GNUC_MALLOC;
 
 
 #if defined(HAVE_GSSAPI)
@@ -95,21 +81,15 @@ G_GNUC_MALLOC;
  * @param error filled with error information on error
  * @return a newly allocated and initialised GSSAPI context on success, or NULL on error
  *
- * Create a new authentication context for Kerberos v5 SASL AUTH GSSAPI based authentication for
- * the passed service and host
- * according to <a href="https://tools.ietf.org/html/rfc4752";>RFC 4752</a>.  The returned
- * context shall be used for the
+ * Create a new authentication context for Kerberos v5 SASL AUTH GSSAPI based authentication for the passed 
service and host
+ * according to <a href="https://tools.ietf.org/html/rfc4752";>RFC 4752</a>.  The returned context shall be 
used for the
  * authentication process and must be freed by calling net_client_gss_ctx_free().
  *
- * @note The host may optionally contain a port definition (e.g. <tt>smtp.mydom.org:25</tt>)
- * which will be omitted.
+ * @note The host may optionally contain a port definition (e.g. <tt>smtp.mydom.org:25</tt>) which will be 
omitted.
  * @sa net_client_gss_auth_step(), net_client_gss_auth_finish()
  */
-NetClientGssCtx *net_client_gss_ctx_new(const gchar *service,
-                                        const gchar *host,
-                                        const gchar *user,
-                                        GError     **error)
-G_GNUC_WARN_UNUSED_RESULT;
+NetClientGssCtx *net_client_gss_ctx_new(const gchar *service, const gchar *host, const gchar *user, GError 
**error)
+       G_GNUC_WARN_UNUSED_RESULT;
 
 
 /** @brief Perform a GSSAPI authentication step
@@ -118,20 +98,14 @@ G_GNUC_WARN_UNUSED_RESULT;
  * @param in_token base64-encoded input token, or NULL for the initial authentication step
  * @param out_token filled with the base64-encoded output token on success
  * @param error filled with error information on error
- * @return 0 if an additional step has to be performed, 1 if net_client_gss_auth_finish() shall
- * be called, or -1 on error
+ * @return 0 if an additional step has to be performed, 1 if net_client_gss_auth_finish() shall be called, 
or -1 on error
  *
- * Initially, the function shall be called with a NULL input token.  The resulting output token
- * shall be sent to the remote server
- * to obtain a new input token until the function returns 1.  Then, net_client_gss_auth_finish()
- * shall be called to finish the
+ * Initially, the function shall be called with a NULL input token.  The resulting output token shall be 
sent to the remote server
+ * to obtain a new input token until the function returns 1.  Then, net_client_gss_auth_finish() shall be 
called to finish the
  * authentication process.
  */
-gint net_client_gss_auth_step(NetClientGssCtx *gss_ctx,
-                              const gchar     *in_token,
-                              gchar          **out_token,
-                              GError         **error)
-G_GNUC_WARN_UNUSED_RESULT;
+gint net_client_gss_auth_step(NetClientGssCtx *gss_ctx, const gchar *in_token, gchar **out_token, GError 
**error)
+       G_GNUC_WARN_UNUSED_RESULT;
 
 
 /** @brief Finish the GSSAPI authentication
@@ -141,31 +115,26 @@ G_GNUC_WARN_UNUSED_RESULT;
  * @param error filled with error information on error
  * @return the base64-encoded final authentication token on success, or NULL on error
  *
- * Create the final token which has to be sent to the remote server to finalise the GSSAPI
- * authentication process.
+ * Create the final token which has to be sent to the remote server to finalise the GSSAPI authentication 
process.
  */
-gchar *net_client_gss_auth_finish(const NetClientGssCtx *gss_ctx,
-                                  const gchar           *in_token,
-                                  GError               **error)
-G_GNUC_WARN_UNUSED_RESULT;
+gchar *net_client_gss_auth_finish(const NetClientGssCtx *gss_ctx, const gchar *in_token, GError **error)
+       G_GNUC_WARN_UNUSED_RESULT;
 
 
 /** @brief Free a GSSAPI authentication context
  *
  * @param gss_ctx GSSAPI authentication context
  *
- * Free all resources in the passed GSSAPI authentication context by net_client_gss_ctx_new()
- * and the context itself.
+ * Free all resources in the passed GSSAPI authentication context by net_client_gss_ctx_new() and the 
context itself.
  */
 void net_client_gss_ctx_free(NetClientGssCtx *gss_ctx);
 
-#endif          /* HAVE_GSSAPI */
+#endif         /* HAVE_GSSAPI */
 
 
 /** @file
  *
- * This module implements authentication-related helper functions for the network client
- * library.
+ * This module implements authentication-related helper functions for the network client library.
  */
 
 
diff --git a/libnetclient/net-client.c b/libnetclient/net-client.c
index bcf17c8..8a12c01 100644
--- a/libnetclient/net-client.c
+++ b/libnetclient/net-client.c
@@ -2,18 +2,13 @@
  *
  * Copyright (C) Albrecht Dreß <mailto:albrecht dress arcor de> 2017
  *
- * This library is free software; you can redistribute it and/or modify it under the terms of
- * the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 
General Public License
+ * as published by the Free Software Foundation; either version 3 of the License, or (at your option) any 
later version.
  *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
- * License for more details.
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 
the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
details.
  *
- * You should have received a copy of the GNU Lesser General Public License along with this
- * library. If not, see
+ * You should have received a copy of the GNU Lesser General Public License along with this library. If not, 
see
  * <http://www.gnu.org/licenses/>.
  */
 
@@ -25,16 +20,16 @@
 
 
 struct _NetClientPrivate {
-    gchar *host_and_port;
-    guint16 default_port;
-    gsize max_line_len;
-
-    GSocketClient *sock;
-    GSocketConnection *plain_conn;
-    GIOStream *tls_conn;
-    GDataInputStream *istream;
-    GOutputStream *ostream;
-    GTlsCertificate *certificate;
+       gchar *host_and_port;
+       guint16 default_port;
+       gsize max_line_len;
+
+       GSocketClient *sock;
+       GSocketConnection *plain_conn;
+       GIOStream *tls_conn;
+       GDataInputStream *istream;
+       GOutputStream *ostream;
+       GTlsCertificate *certificate;
 };
 
 
@@ -46,661 +41,519 @@ G_DEFINE_TYPE(NetClient, net_client, G_TYPE_OBJECT)
 
 static void net_client_dispose(GObject *object);
 static void net_client_finalise(GObject *object);
-static gboolean cert_accept_cb(GTlsConnection      *conn,
-                               GTlsCertificate     *peer_cert,
-                               GTlsCertificateFlags errors,
-                               gpointer             user_data);
+static gboolean cert_accept_cb(GTlsConnection *conn, GTlsCertificate *peer_cert, GTlsCertificateFlags 
errors, gpointer user_data);
 
 
 NetClient *
-net_client_new(const gchar *host_and_port,
-               guint16      default_port,
-               gsize        max_line_len)
+net_client_new(const gchar *host_and_port, guint16 default_port, gsize max_line_len)
 {
-    NetClient *client;
+       NetClient *client;
 
-    g_return_val_if_fail(host_and_port != NULL, NULL);
+       g_return_val_if_fail(host_and_port != NULL, NULL);
 
-    client = NET_CLIENT(g_object_new(NET_CLIENT_TYPE, NULL));
+       client = NET_CLIENT(g_object_new(NET_CLIENT_TYPE, NULL));
 
-    if (client->priv->sock == NULL) {
-        g_object_unref(G_OBJECT(client));
-        client = NULL;
-    } else {
-        client->priv->host_and_port = g_strdup(host_and_port);
-        client->priv->default_port = default_port;
-        client->priv->max_line_len = max_line_len;
-    }
+       if (client->priv->sock == NULL) {
+               g_object_unref(G_OBJECT(client));
+               client = NULL;
+       } else {
+               client->priv->host_and_port = g_strdup(host_and_port);
+               client->priv->default_port = default_port;
+               client->priv->max_line_len = max_line_len;
+       }
 
-    return client;
+       return client;
 }
 
 
 gboolean
-net_client_configure(NetClient   *client,
-                     const gchar *host_and_port,
-                     guint16      default_port,
-                     gsize        max_line_len,
-                     GError     **error)
+net_client_configure(NetClient *client, const gchar *host_and_port, guint16 default_port, gsize 
max_line_len, GError **error)
 {
-    NetClientPrivate *priv;
-    gboolean result;
-
-    g_return_val_if_fail(NET_IS_CLIENT(client) && (host_and_port != NULL), FALSE);
-
-    priv = client->priv;
-    if (priv->plain_conn != NULL) {
-        g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_CONNECTED,
-                    _("network client is already connected"));
-        result = FALSE;
-    } else {
-        g_free(priv->host_and_port);
-        priv->host_and_port = g_strdup(host_and_port);
-        priv->default_port = default_port;
-        priv->max_line_len = max_line_len;
-        result = TRUE;
-    }
-    return result;
+       NetClientPrivate *priv;
+       gboolean result;
+
+       g_return_val_if_fail(NET_IS_CLIENT(client) && (host_and_port != NULL), FALSE);
+
+       priv = client->priv;
+       if (priv->plain_conn != NULL) {
+               g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_CONNECTED, _("network 
client is already connected"));
+               result = FALSE;
+       } else {
+               g_free(priv->host_and_port);
+               priv->host_and_port = g_strdup(host_and_port);
+               priv->default_port = default_port;
+               priv->max_line_len = max_line_len;
+               result = TRUE;
+       }
+       return result;
 }
 
 
 const gchar *
 net_client_get_host(const NetClient *client)
 {
-    const gchar *result;
-
-    /*lint -e{9005}            cast'ing away const in the next statement is fine */
-    if (NET_IS_CLIENT(client)) {
-        result = client->priv->host_and_port;
-    } else {
-        result = NULL;
-    }
-    return result;
+       const gchar *result;
+
+       /*lint -e{9005}         cast'ing away const in the next statement is fine */
+       if (NET_IS_CLIENT(client)) {
+               result = client->priv->host_and_port;
+       } else {
+               result = NULL;
+       }
+       return result;
 }
 
 
 gboolean
-net_client_connect(NetClient *client,
-                   GError   **error)
+net_client_connect(NetClient *client, GError **error)
 {
-    gboolean result = FALSE;
-    NetClientPrivate *priv;
-
-    g_return_val_if_fail(NET_IS_CLIENT(client), FALSE);
-
-    priv = client->priv;
-    if (priv->plain_conn != NULL) {
-        g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_CONNECTED,
-                    _("network client is already connected"));
-    } else {
-        priv->plain_conn = g_socket_client_connect_to_host(priv->sock,
-                                                           priv->host_and_port,
-                                                           priv->default_port,
-                                                           NULL,
-                                                           error);
-        if (priv->plain_conn != NULL) {
-            g_debug("connected to %s", priv->host_and_port);
-            priv->istream =
-                g_data_input_stream_new(g_io_stream_get_input_stream(G_IO_STREAM(priv->
-                                                                                 plain_conn)));
-            g_data_input_stream_set_newline_type(priv->istream,
-                                                 G_DATA_STREAM_NEWLINE_TYPE_CR_LF);
-            priv->ostream = g_io_stream_get_output_stream(G_IO_STREAM(priv->plain_conn));
-            result = TRUE;
-        }
-    }
-
-    return result;
+       gboolean result = FALSE;
+       NetClientPrivate *priv;
+
+       g_return_val_if_fail(NET_IS_CLIENT(client), FALSE);
+
+       priv = client->priv;
+       if (priv->plain_conn != NULL) {
+               g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_CONNECTED, _("network 
client is already connected"));
+       } else {
+               priv->plain_conn = g_socket_client_connect_to_host(priv->sock, priv->host_and_port, 
priv->default_port, NULL, error);
+               if (priv->plain_conn != NULL) {
+                       g_debug("connected to %s", priv->host_and_port);
+                       priv->istream = 
g_data_input_stream_new(g_io_stream_get_input_stream(G_IO_STREAM(priv->plain_conn)));
+                       g_data_input_stream_set_newline_type(priv->istream, G_DATA_STREAM_NEWLINE_TYPE_CR_LF);
+                       priv->ostream = g_io_stream_get_output_stream(G_IO_STREAM(priv->plain_conn));
+                       result = TRUE;
+               }
+       }
+
+       return result;
 }
 
 
 void
 net_client_shutdown(const NetClient *client)
 {
-    if (NET_IS_CLIENT(client)) {
-        /* note: we must unref the GDataInputStream, but *not* the GOutputStream! */
-        if (client->priv->istream != NULL) {
-            g_object_unref(G_OBJECT(client->priv->istream));
-            client->priv->istream = NULL;
-        }
-        if (client->priv->tls_conn != NULL) {
-            g_object_unref(G_OBJECT(client->priv->tls_conn));
-            client->priv->tls_conn = NULL;
-        }
-        if (client->priv->plain_conn != NULL) {
-            g_object_unref(G_OBJECT(client->priv->plain_conn));
-            client->priv->plain_conn = NULL;
-        }
-    }
+       if (NET_IS_CLIENT(client)) {
+               /* note: we must unref the GDataInputStream, but *not* the GOutputStream! */
+               if (client->priv->istream != NULL) {
+                       g_object_unref(G_OBJECT(client->priv->istream));
+                       client->priv->istream = NULL;
+               }
+               if (client->priv->tls_conn != NULL) {
+                       g_object_unref(G_OBJECT(client->priv->tls_conn));
+                       client->priv->tls_conn = NULL;
+               }
+               if (client->priv->plain_conn != NULL) {
+                       g_object_unref(G_OBJECT(client->priv->plain_conn));
+                       client->priv->plain_conn = NULL;
+               }
+       }
 }
 
 
 gboolean
 net_client_is_connected(NetClient *client)
 {
-    gboolean result;
+       gboolean result;
 
-    if (NET_IS_CLIENT(client) && (client->priv->plain_conn != NULL)) {
-        result = TRUE;
-    } else {
-        result = FALSE;
-    }
+       if (NET_IS_CLIENT(client) && (client->priv->plain_conn != NULL)) {
+               result = TRUE;
+       } else {
+               result = FALSE;
+       }
 
-    return result;
+       return result;
 }
 
 
 gboolean
 net_client_is_encrypted(NetClient *client)
 {
-    gboolean result;
+       gboolean result;
 
-    if (net_client_is_connected(client) && (client->priv->tls_conn != NULL)) {
-        result = TRUE;
-    } else {
-        result = FALSE;
-    }
+       if (net_client_is_connected(client) && (client->priv->tls_conn != NULL)) {
+               result = TRUE;
+       } else {
+               result = FALSE;
+       }
 
-    return result;
+       return result;
 }
 
 
 gboolean
-net_client_read_line(NetClient *client,
-                     gchar    **recv_line,
-                     GError   **error)
+net_client_read_line(NetClient *client, gchar **recv_line, GError **error)
 {
-    gboolean result = FALSE;
-
-    g_return_val_if_fail(NET_IS_CLIENT(client), FALSE);
-
-    if (client->priv->istream == NULL) {
-        g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_NOT_CONNECTED,
-                    _("network client is not connected"));
-    } else {
-        gchar *line_buf;
-        gsize length;
-        GError *read_err = NULL;
-
-        line_buf =
-            g_data_input_stream_read_line(client->priv->istream, &length, NULL, &read_err);
-        if (line_buf != NULL) {
-            /* check that the protocol-specific maximum line length is not exceeded */
-            if ((client->priv->max_line_len > 0U) && (length > client->priv->max_line_len)) {
-                g_set_error(error,
-                            NET_CLIENT_ERROR_QUARK,
-                            (gint) NET_CLIENT_ERROR_LINE_TOO_LONG,
-                            _("reply length %lu exceeds the maximum allowed length %lu"),
-                            (unsigned long) length,
-                            (unsigned long) client->priv->max_line_len);
-                g_free(line_buf);
-            } else {
-                g_debug("R '%s'", line_buf);
-                result = TRUE;
-                if (recv_line != NULL) {
-                    *recv_line = line_buf;
-                } else {
-                    g_free(line_buf);
-                }
-            }
-        } else {
-            if (read_err != NULL) {
-                g_propagate_error(error, read_err);
-            } else {
-                g_set_error(error,
-                            NET_CLIENT_ERROR_QUARK,
-                            (gint) NET_CLIENT_ERROR_CONNECTION_LOST,
-                            _("connection lost"));
-            }
-        }
-    }
-
-    return result;
+       gboolean result = FALSE;
+
+       g_return_val_if_fail(NET_IS_CLIENT(client), FALSE);
+
+       if (client->priv->istream == NULL) {
+               g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_NOT_CONNECTED, _("network 
client is not connected"));
+       } else {
+               gchar *line_buf;
+               gsize length;
+               GError *read_err = NULL;
+
+               line_buf = g_data_input_stream_read_line(client->priv->istream, &length, NULL, &read_err);
+               if (line_buf != NULL) {
+                       /* check that the protocol-specific maximum line length is not exceeded */
+                       if ((client->priv->max_line_len > 0U) && (length > client->priv->max_line_len)) {
+                               g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) 
NET_CLIENT_ERROR_LINE_TOO_LONG,
+                                       _("reply length %lu exceeds the maximum allowed length %lu"),
+                                       (unsigned long) length, (unsigned long) client->priv->max_line_len);
+                               g_free(line_buf);
+                       } else {
+                               g_debug("R '%s'", line_buf);
+                               result = TRUE;
+                               if (recv_line != NULL) {
+                                       *recv_line = line_buf;
+                               } else {
+                                       g_free(line_buf);
+                               }
+                       }
+               } else {
+                       if (read_err != NULL) {
+                               g_propagate_error(error, read_err);
+                       } else {
+                               g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) 
NET_CLIENT_ERROR_CONNECTION_LOST, _("connection lost"));
+                       }
+               }
+       }
+
+       return result;
 }
 
 
 gboolean
-net_client_write_buffer(NetClient   *client,
-                        const gchar *buffer,
-                        gsize        count,
-                        GError     **error)
+net_client_write_buffer(NetClient *client, const gchar *buffer, gsize count, GError **error)
 {
-    gboolean result;
-
-    g_return_val_if_fail(NET_IS_CLIENT(client) && (buffer != NULL) && (count > 0UL), FALSE);
-
-    if (client->priv->ostream == NULL) {
-        g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_NOT_CONNECTED,
-                    _("network client is not connected"));
-        result = FALSE;
-    } else {
-        gsize bytes_written;
-
-        if ((count >= 2U) && (buffer[count - 1U] == '\n')) {
-            g_debug("W '%.*s'", (int) count - 2, buffer);
-        } else {
-            g_debug("W '%.*s'", (int) count, buffer);
-        }
-        result = g_output_stream_write_all(client->priv->ostream,
-                                           buffer,
-                                           count,
-                                           &bytes_written,
-                                           NULL,
-                                           error);
-        if (result) {
-            result = g_output_stream_flush(client->priv->ostream, NULL, error);
-        }
-    }
-
-    return result;
+       gboolean result;
+
+       g_return_val_if_fail(NET_IS_CLIENT(client) && (buffer != NULL) && (count > 0UL), FALSE);
+
+       if (client->priv->ostream == NULL) {
+               g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_NOT_CONNECTED, _("network 
client is not connected"));
+               result = FALSE;
+       } else {
+               gsize bytes_written;
+
+               if ((count >= 2U) && (buffer[count - 1U] == '\n')) {
+                       g_debug("W '%.*s'", (int) count - 2, buffer);
+               } else {
+                       g_debug("W '%.*s'", (int) count, buffer);
+               }
+               result = g_output_stream_write_all(client->priv->ostream, buffer, count, &bytes_written, 
NULL, error);
+               if (result) {
+                       result = g_output_stream_flush(client->priv->ostream, NULL, error);
+               }
+       }
+
+       return result;
 }
 
 
 gboolean
-net_client_vwrite_line(NetClient   *client,
-                       const gchar *format,
-                       va_list      args,
-                       GError     **error)
+net_client_vwrite_line(NetClient *client, const gchar *format, va_list args, GError **error)
 {
-    gboolean result;
-    GString *buffer;
-
-    g_return_val_if_fail(NET_IS_CLIENT(client) && (format != NULL), FALSE);
-
-    buffer = g_string_new(NULL);
-    g_string_vprintf(buffer, format, args);
-    if ((client->priv->max_line_len > 0U) && (buffer->len > client->priv->max_line_len)) {
-        g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_LINE_TOO_LONG,
-                    _("line too long"));
-        result = FALSE;
-    } else {
-        buffer = g_string_append(buffer, "\r\n");
-        result = net_client_write_buffer(client, buffer->str, buffer->len, error);
-    }
-    (void) g_string_free(buffer, TRUE);
-
-    return result;
+       gboolean result;
+       GString *buffer;
+
+       g_return_val_if_fail(NET_IS_CLIENT(client) && (format != NULL), FALSE);
+
+       buffer = g_string_new(NULL);
+       g_string_vprintf(buffer, format, args);
+       if ((client->priv->max_line_len > 0U) && (buffer->len > client->priv->max_line_len)) {
+               g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_LINE_TOO_LONG, _("line too 
long"));
+               result = FALSE;
+       } else {
+               buffer = g_string_append(buffer, "\r\n");
+               result = net_client_write_buffer(client, buffer->str, buffer->len, error);
+       }
+       (void) g_string_free(buffer, TRUE);
+
+       return result;
 }
 
 
 gboolean
-net_client_write_line(NetClient   *client,
-                      const gchar *format,
-                      GError     **error,
-                      ...)
+net_client_write_line(NetClient *client, const gchar *format, GError **error, ...)
 {
-    va_list args;
-    gboolean result;
+       va_list args;
+       gboolean result;
 
-    va_start(args, error);
-    result = net_client_vwrite_line(client, format, args, error);
-    va_end(args);
+       va_start(args, error);
+       result = net_client_vwrite_line(client, format, args, error);
+       va_end(args);
 
-    return result;
+       return result;
 }
 
 
 gboolean
-net_client_execute(NetClient   *client,
-                   gchar      **response,
-                   const gchar *request_fmt,
-                   GError     **error,
-                   ...)
+net_client_execute(NetClient *client, gchar **response, const gchar *request_fmt, GError **error, ...)
 {
-    va_list args;
-    gboolean result;
+       va_list args;
+       gboolean result;
 
-    va_start(args, error);
-    result = net_client_vwrite_line(client, request_fmt, args, error);
-    va_end(args);
-    if (result) {
-        result = net_client_read_line(client, response, error);
-    }
+       va_start(args, error);
+       result = net_client_vwrite_line(client, request_fmt, args, error);
+       va_end(args);
+       if (result) {
+               result = net_client_read_line(client, response, error);
+       }
 
-    return result;
+       return result;
 }
 
 
-/* Note: I have no idea how I can load a PEM with an encrypted key into a GTlsCertificate using
-   g_tls_certificate_new_from_file()
- * or g_tls_certificate_new_from_pem(), as this will always fail with a GnuTLS error "ASN1
- * parser: Error in DER parsing".  There
- * /might/ be a solution with GTlsInteraction and GTlsPassword, though.  Please enlighten me if
- * you know more...
+/* Note: I have no idea how I can load a PEM with an encrypted key into a GTlsCertificate using 
g_tls_certificate_new_from_file()
+ * or g_tls_certificate_new_from_pem(), as this will always fail with a GnuTLS error "ASN1 parser: Error in 
DER parsing".  There
+ * /might/ be a solution with GTlsInteraction and GTlsPassword, though.  Please enlighten me if you know 
more...
  *
  * This function uses "raw" GnuTLS calls and will emit the cert-pass signal if necessary.
  *
  * See also <https://mail.gnome.org/archives/gtk-list/2016-May/msg00027.html>.
  */
 gboolean
-net_client_set_cert_from_pem(NetClient   *client,
-                             const gchar *pem_data,
-                             GError     **error)
+net_client_set_cert_from_pem(NetClient *client, const gchar *pem_data, GError **error)
 {
-    gboolean result = FALSE;
-    gnutls_x509_crt_t cert;
-    int res;
-
-    g_return_val_if_fail(NET_IS_CLIENT(client) && (pem_data != NULL), FALSE);
-
-    /* always free any existing certificate */
-    if (client->priv->certificate != NULL) {
-        g_object_unref(G_OBJECT(client->priv->certificate));
-        client->priv->certificate = NULL;
-    }
-
-    /* load the certificate */
-    res = gnutls_x509_crt_init(&cert);
-    if (res != GNUTLS_E_SUCCESS) {
-        g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_GNUTLS,
-                    _("error initializing certificate: %s"),
-                    gnutls_strerror(res));
-    } else {
-        gnutls_datum_t data;
-
-        /*lint -e9005  cast'ing away the const is safe as gnutls treats data as const */
-        data.data = (unsigned char *) pem_data;
-        data.size = strlen(pem_data);
-        res = gnutls_x509_crt_import(cert, &data, GNUTLS_X509_FMT_PEM);
-        if (res != GNUTLS_E_SUCCESS) {
-            g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_GNUTLS,
-                        _("error loading certificate: %s"),
-                        gnutls_strerror(res));
-        } else {
-            gnutls_x509_privkey_t key;
-
-            /* try to load the key, emit cert-pass signal if gnutls says the key is encrypted */
-            res = gnutls_x509_privkey_init(&key);
-            if (res != GNUTLS_E_SUCCESS) {
-                g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_GNUTLS,
-                            _("error initializing key: %s"),
-                            gnutls_strerror(res));
-            } else {
-                res = gnutls_x509_privkey_import2(key, &data, GNUTLS_X509_FMT_PEM, NULL, 0);
-                if (res == GNUTLS_E_DECRYPTION_FAILED) {
-                    size_t der_size;
-                    guint8 *der_data;
-
-                    /* determine cert buffer size requirements */
-                    der_size = 0U;
-                    (void) gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_DER, NULL, &der_size);
-                    der_data = g_malloc(der_size);                              /*lint !e9079
-                                                                                   (MISRA C:2012
-                                                                                   Rule 11.5) */
-
-                    res =
-                        gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_DER, der_data, &der_size);
-                    if (res == GNUTLS_E_SUCCESS) {
-                        GByteArray *cert_der;
-                        gchar *key_pass = NULL;
-
-                        cert_der = g_byte_array_new_take(der_data, der_size);
-                        g_debug("emit 'cert-pass' signal for client %p", client);
-                        g_signal_emit(client, signals[2], 0, cert_der, &key_pass);
-                        g_byte_array_unref(cert_der);
-                        if (key_pass != NULL) {
-                            res = gnutls_x509_privkey_import2(key,
-                                                              &data,
-                                                              GNUTLS_X509_FMT_PEM,
-                                                              key_pass,
-                                                              0);
-                            memset(key_pass, 0, strlen(key_pass));
-                            g_free(key_pass);
-                        }
-                    }
-                }
-
-                /* on success, set the certificate using the unencrypted key */
-                if (res == GNUTLS_E_SUCCESS) {
-                    gchar *pem_buf;
-                    size_t key_buf_size = 0;
-                    size_t crt_buf_size = 0;
-
-                    /* determine buffer size requirements */
-                    (void) gnutls_x509_privkey_export(key,
-                                                      GNUTLS_X509_FMT_PEM,
-                                                      NULL,
-                                                      &key_buf_size);
-                    (void) gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_PEM, NULL,
-                                                  &crt_buf_size);
-                    pem_buf = g_malloc(key_buf_size + crt_buf_size);                                    
/*lint
-                                                                                                           
!e9079
-                                                                                                           
(MISRA
-                                                                                                           
C:2012
-                                                                                                           
Rule
-                                                                                                           
11.5)
-                                                                                                         */
-                    res = gnutls_x509_privkey_export(key,
-                                                     GNUTLS_X509_FMT_PEM,
-                                                     pem_buf,
-                                                     &key_buf_size);
-                    if (res == GNUTLS_E_SUCCESS) {
-                        res =
-                            gnutls_x509_crt_export(cert,
-                                                   GNUTLS_X509_FMT_PEM,
-                                                   &pem_buf[key_buf_size],
-                                                   &crt_buf_size);
-                    }
-
-                    if (res == GNUTLS_E_SUCCESS) {
-                        client->priv->certificate = g_tls_certificate_new_from_pem(pem_buf,
-                                                                                   -1,
-                                                                                   error);
-                        if (client->priv->certificate != NULL) {
-                            result = TRUE;
-                        }
-                    }
-                    g_free(pem_buf);
-                }
-                gnutls_x509_privkey_deinit(key);
-
-                if (res != GNUTLS_E_SUCCESS) {
-                    g_set_error(error,
-                                NET_CLIENT_ERROR_QUARK,
-                                (gint) NET_CLIENT_ERROR_GNUTLS,
-                                _("error loading key: %s"),
-                                gnutls_strerror(res));
-                }
-            }
-        }
-        gnutls_x509_crt_deinit(cert);
-    }
-
-    return result;
+       gboolean result = FALSE;
+       gnutls_x509_crt_t cert;
+       int res;
+
+       g_return_val_if_fail(NET_IS_CLIENT(client) && (pem_data != NULL), FALSE);
+
+       /* always free any existing certificate */
+       if (client->priv->certificate != NULL) {
+               g_object_unref(G_OBJECT(client->priv->certificate));
+               client->priv->certificate = NULL;
+       }
+
+       /* load the certificate */
+       res = gnutls_x509_crt_init(&cert);
+       if (res != GNUTLS_E_SUCCESS) {
+               g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_GNUTLS, _("error 
initializing certificate: %s"),
+                       gnutls_strerror(res));
+       } else {
+               gnutls_datum_t data;
+
+               /*lint -e9005   cast'ing away the const is safe as gnutls treats data as const */
+               data.data = (unsigned char *) pem_data;
+               data.size = strlen(pem_data);
+               res = gnutls_x509_crt_import(cert, &data, GNUTLS_X509_FMT_PEM);
+               if (res != GNUTLS_E_SUCCESS) {
+                       g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_GNUTLS, _("error 
loading certificate: %s"),
+                               gnutls_strerror(res));
+               } else {
+                       gnutls_x509_privkey_t key;
+
+                       /* try to load the key, emit cert-pass signal if gnutls says the key is encrypted */
+                       res = gnutls_x509_privkey_init(&key);
+                       if (res != GNUTLS_E_SUCCESS) {
+                               g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_GNUTLS, 
_("error initializing key: %s"),
+                                       gnutls_strerror(res));
+                       } else {
+                               res = gnutls_x509_privkey_import2(key, &data, GNUTLS_X509_FMT_PEM, NULL, 0);
+                               if (res == GNUTLS_E_DECRYPTION_FAILED) {
+                                       size_t der_size;
+                                       guint8 *der_data;
+
+                                       /* determine cert buffer size requirements */
+                                       der_size = 0U;
+                                       (void) gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_DER, NULL, 
&der_size);
+                                       der_data = g_malloc(der_size);          /*lint !e9079 (MISRA C:2012 
Rule 11.5) */
+
+                                       res = gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_DER, der_data, 
&der_size);
+                                       if (res == GNUTLS_E_SUCCESS) {
+                                               GByteArray *cert_der;
+                                               gchar *key_pass = NULL;
+
+                                               cert_der = g_byte_array_new_take(der_data, der_size);
+                                               g_debug("emit 'cert-pass' signal for client %p", client);
+                                               g_signal_emit(client, signals[2], 0, cert_der, &key_pass);
+                                               g_byte_array_unref(cert_der);
+                                               if (key_pass != NULL) {
+                                                       res = gnutls_x509_privkey_import2(key, &data, 
GNUTLS_X509_FMT_PEM, key_pass, 0);
+                                                       memset(key_pass, 0, strlen(key_pass));
+                                                       g_free(key_pass);
+                                               }
+                                       }
+                               }
+
+                               /* on success, set the certificate using the unencrypted key */
+                               if (res == GNUTLS_E_SUCCESS) {
+                                       gchar *pem_buf;
+                                       size_t key_buf_size = 0;
+                                       size_t crt_buf_size = 0;
+
+                                       /* determine buffer size requirements */
+                                       (void) gnutls_x509_privkey_export(key, GNUTLS_X509_FMT_PEM, NULL, 
&key_buf_size);
+                                       (void) gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_PEM, NULL, 
&crt_buf_size);
+                                       pem_buf = g_malloc(key_buf_size + crt_buf_size);                
/*lint !e9079 (MISRA C:2012 Rule 11.5) */
+                                       res = gnutls_x509_privkey_export(key, GNUTLS_X509_FMT_PEM, pem_buf, 
&key_buf_size);
+                                       if (res == GNUTLS_E_SUCCESS) {
+                                               res = gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_PEM, 
&pem_buf[key_buf_size], &crt_buf_size);
+                                       }
+
+                                       if (res == GNUTLS_E_SUCCESS) {
+                                               client->priv->certificate = 
g_tls_certificate_new_from_pem(pem_buf, -1, error);
+                                               if (client->priv->certificate != NULL) {
+                                                       result = TRUE;
+                                               }
+                                       }
+                                       g_free(pem_buf);
+                               }
+                               gnutls_x509_privkey_deinit(key);
+
+                               if (res != GNUTLS_E_SUCCESS) {
+                                       g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) 
NET_CLIENT_ERROR_GNUTLS, _("error loading key: %s"),
+                                               gnutls_strerror(res));
+                               }
+                       }
+               }
+               gnutls_x509_crt_deinit(cert);
+       }
+
+       return result;
 }
 
 
 gboolean
-net_client_set_cert_from_file(NetClient   *client,
-                              const gchar *pem_path,
-                              GError     **error)
+net_client_set_cert_from_file(NetClient *client, const gchar *pem_path, GError **error)
 {
-    gboolean result;
-    GFile *pem_file;
-    gchar *pem_buf;
-
-    g_return_val_if_fail(pem_path != NULL, FALSE);
-
-    pem_file = g_file_new_for_path(pem_path);
-    result = g_file_load_contents(pem_file, NULL, &pem_buf, NULL, NULL, error);
-    if (result) {
-        result = net_client_set_cert_from_pem(client, pem_buf, error);
-        g_free(pem_buf);
-    }
-    g_object_unref(G_OBJECT(pem_file));
-    return result;
+       gboolean result;
+       GFile *pem_file;
+       gchar *pem_buf;
+
+       g_return_val_if_fail(pem_path != NULL, FALSE);
+
+       pem_file = g_file_new_for_path(pem_path);
+       result = g_file_load_contents(pem_file, NULL, &pem_buf, NULL, NULL, error);
+       if (result) {
+               result = net_client_set_cert_from_pem(client, pem_buf, error);
+               g_free(pem_buf);
+       }
+       g_object_unref(G_OBJECT(pem_file));
+       return result;
 }
 
 
 gboolean
-net_client_start_tls(NetClient *client,
-                     GError   **error)
+net_client_start_tls(NetClient *client, GError **error)
 {
-    gboolean result = FALSE;
-
-    g_return_val_if_fail(NET_IS_CLIENT(client), FALSE);
-
-    if (client->priv->plain_conn == NULL) {
-        g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_NOT_CONNECTED,
-                    _("not connected"));
-    } else if (client->priv->tls_conn != NULL) {
-        g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_TLS_ACTIVE,
-                    _("connection is already encrypted"));
-    } else {
-        client->priv->tls_conn =
-            g_tls_client_connection_new(G_IO_STREAM(client->priv->plain_conn), NULL, error);
-        if (client->priv->tls_conn != NULL) {
-            if (client->priv->certificate != NULL) {
-                g_tls_connection_set_certificate(G_TLS_CONNECTION(
-                                                     client->priv->tls_conn),
-                                                 client->priv->certificate);
-            }
-            (void) g_signal_connect(G_OBJECT(
-                                        client->priv->tls_conn), "accept-certificate", G_CALLBACK(
-                                        cert_accept_cb), client);
-            result = g_tls_connection_handshake(G_TLS_CONNECTION(
-                                                    client->priv->tls_conn), NULL, error);
-            if (result) {
-                g_filter_input_stream_set_close_base_stream(G_FILTER_INPUT_STREAM(client->priv->
-                                                                                  istream),
-                                                            FALSE);
-                g_object_unref(G_OBJECT(client->priv->istream));                                /*
-                                                                                                   unref
-                                                                                                   the
-                                                                                                   plain
-                                                                                                   
connection's
-                                                                                                   stream
-                                                                                                 */
-                client->priv->istream =
-                    g_data_input_stream_new(g_io_stream_get_input_stream(G_IO_STREAM(client->
-                                                                                     priv->
-                                                                                     tls_conn)));
-                g_data_input_stream_set_newline_type(client->priv->istream,
-                                                     G_DATA_STREAM_NEWLINE_TYPE_CR_LF);
-                client->priv->ostream =
-                    g_io_stream_get_output_stream(G_IO_STREAM(client->priv->tls_conn));
-                g_debug("connection is encrypted");
-            } else {
-                g_object_unref(G_OBJECT(client->priv->tls_conn));
-                client->priv->tls_conn = NULL;
-            }
-        }
-    }
-
-    return result;
+       gboolean result = FALSE;
+
+       g_return_val_if_fail(NET_IS_CLIENT(client), FALSE);
+
+       if (client->priv->plain_conn == NULL) {
+               g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_NOT_CONNECTED, _("not 
connected"));
+       } else if (client->priv->tls_conn != NULL) {
+               g_set_error(error, NET_CLIENT_ERROR_QUARK, (gint) NET_CLIENT_ERROR_TLS_ACTIVE, _("connection 
is already encrypted"));
+       } else {
+               client->priv->tls_conn = g_tls_client_connection_new(G_IO_STREAM(client->priv->plain_conn), 
NULL, error);
+               if (client->priv->tls_conn != NULL) {
+                       if (client->priv->certificate != NULL) {
+                               g_tls_connection_set_certificate(G_TLS_CONNECTION(client->priv->tls_conn), 
client->priv->certificate);
+                       }
+                       (void) g_signal_connect(G_OBJECT(client->priv->tls_conn), "accept-certificate", 
G_CALLBACK(cert_accept_cb), client);
+                       result = g_tls_connection_handshake(G_TLS_CONNECTION(client->priv->tls_conn), NULL, 
error);
+                       if (result) {
+                               
g_filter_input_stream_set_close_base_stream(G_FILTER_INPUT_STREAM(client->priv->istream), FALSE);
+                               g_object_unref(G_OBJECT(client->priv->istream));                /* unref the 
plain connection's stream */
+                               client->priv->istream = 
g_data_input_stream_new(g_io_stream_get_input_stream(G_IO_STREAM(client->priv->tls_conn)));
+                               g_data_input_stream_set_newline_type(client->priv->istream, 
G_DATA_STREAM_NEWLINE_TYPE_CR_LF);
+                               client->priv->ostream = 
g_io_stream_get_output_stream(G_IO_STREAM(client->priv->tls_conn));
+                               g_debug("connection is encrypted");
+                       } else {
+                               g_object_unref(G_OBJECT(client->priv->tls_conn));
+                               client->priv->tls_conn = NULL;
+                       }
+               }
+       }
+
+       return result;
 }
 
 
 gboolean
-net_client_set_timeout(NetClient *client,
-                       guint      timeout_secs)
+net_client_set_timeout(NetClient *client, guint timeout_secs)
 {
-    g_return_val_if_fail(NET_IS_CLIENT(client), FALSE);
+       g_return_val_if_fail(NET_IS_CLIENT(client), FALSE);
 
-    g_socket_client_set_timeout(client->priv->sock, timeout_secs);
-    return TRUE;
+       g_socket_client_set_timeout(client->priv->sock, timeout_secs);
+       return TRUE;
 }
 
 
-/* == local functions
-   
===========================================================================================================
- */
+/* == local functions 
=========================================================================================================== */
 
 static void
 net_client_class_init(NetClientClass *klass)
 {
-    GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
-
-    g_type_class_add_private(klass, sizeof(NetClientPrivate));
-    gobject_class->dispose = net_client_dispose;
-    gobject_class->finalize = net_client_finalise;
-    signals[0] = g_signal_new("cert-check",
-                              NET_CLIENT_TYPE,
-                              G_SIGNAL_RUN_LAST,
-                              0U,
-                              NULL,
-                              NULL,
-                              NULL,
-                              G_TYPE_BOOLEAN,
-                              2U,
-                              G_TYPE_TLS_CERTIFICATE,
-                              G_TYPE_TLS_CERTIFICATE_FLAGS);
-    signals[1] = g_signal_new("auth",
-                              NET_CLIENT_TYPE,
-                              G_SIGNAL_RUN_LAST,
-                              0U,
-                              NULL,
-                              NULL,
-                              NULL,
-                              G_TYPE_STRV,
-                              1U,
-                              G_TYPE_BOOLEAN);
-    signals[2] = g_signal_new("cert-pass",
-                              NET_CLIENT_TYPE,
-                              G_SIGNAL_RUN_LAST,
-                              0U,
-                              NULL,
-                              NULL,
-                              NULL,
-                              G_TYPE_STRING,
-                              1U,
-                              G_TYPE_BYTE_ARRAY);
+       GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+
+       g_type_class_add_private(klass, sizeof(NetClientPrivate));
+       gobject_class->dispose = net_client_dispose;
+       gobject_class->finalize = net_client_finalise;
+       signals[0] = g_signal_new("cert-check", NET_CLIENT_TYPE, G_SIGNAL_RUN_LAST, 0U, NULL, NULL, NULL, 
G_TYPE_BOOLEAN, 2U,
+               G_TYPE_TLS_CERTIFICATE, G_TYPE_TLS_CERTIFICATE_FLAGS);
+       signals[1] = g_signal_new("auth", NET_CLIENT_TYPE, G_SIGNAL_RUN_LAST, 0U, NULL, NULL, NULL, 
G_TYPE_STRV, 1U, G_TYPE_BOOLEAN);
+       signals[2] = g_signal_new("cert-pass", NET_CLIENT_TYPE, G_SIGNAL_RUN_LAST, 0U, NULL, NULL, NULL, 
G_TYPE_STRING, 1U,
+               G_TYPE_BYTE_ARRAY);
 }
 
 
 static void
 net_client_init(NetClient *self)
 {
-    NetClientPrivate *priv;
+        NetClientPrivate *priv;
 
-    self->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE(self, NET_CLIENT_TYPE, NetClientPrivate);
-    priv->sock = g_socket_client_new();
-    if (priv->sock != NULL) {
-        g_socket_client_set_timeout(priv->sock, 180U);
-    }
+       self->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE(self, NET_CLIENT_TYPE, NetClientPrivate);
+       priv->sock = g_socket_client_new();
+       if (priv->sock != NULL) {
+               g_socket_client_set_timeout(priv->sock, 180U);
+       }
 }
 
 
 static void
 net_client_dispose(GObject *object)
 {
-    const NetClient *client = NET_CLIENT(object);
-    NetClientPrivate *priv = client->priv;
-    const GObjectClass *parent_class = G_OBJECT_CLASS(net_client_parent_class);
+       const NetClient *client = NET_CLIENT(object);
+        NetClientPrivate *priv = client->priv;
+       const GObjectClass *parent_class = G_OBJECT_CLASS(net_client_parent_class);
 
-    net_client_shutdown(client);
-    g_clear_object(&priv->sock);
-    g_clear_object(&priv->certificate);
-    g_debug("disposed connection to %s", priv->host_and_port);
+       net_client_shutdown(client);
+       g_clear_object(&priv->sock);
+       g_clear_object(&priv->certificate);
+       g_debug("disposed connection to %s", priv->host_and_port);
 
-    (*parent_class->dispose)(object);
+       (*parent_class->dispose)(object);
 }
 
 
 static void
 net_client_finalise(GObject *object)
 {
-    const NetClient *client = NET_CLIENT(object);
-    NetClientPrivate *priv = client->priv;
-    const GObjectClass *parent_class = G_OBJECT_CLASS(net_client_parent_class);
+       const NetClient *client = NET_CLIENT(object);
+        NetClientPrivate *priv = client->priv;
+       const GObjectClass *parent_class = G_OBJECT_CLASS(net_client_parent_class);
 
-    g_debug("finalised connection to %s", priv->host_and_port);
-    g_free(priv->host_and_port);
+       g_debug("finalised connection to %s", priv->host_and_port);
+       g_free(priv->host_and_port);
 
-    (*parent_class->finalize)(object);
+       (*parent_class->finalize)(object);
 }
 
 
 static gboolean
-cert_accept_cb(G_GNUC_UNUSED GTlsConnection *conn,
-               GTlsCertificate              *peer_cert,
-               GTlsCertificateFlags          errors,
-               gpointer                      user_data)
+cert_accept_cb(G_GNUC_UNUSED GTlsConnection *conn, GTlsCertificate *peer_cert, GTlsCertificateFlags errors, 
gpointer user_data)
 {
-    NetClient *client = NET_CLIENT(user_data);
-    gboolean result;
+       NetClient *client = NET_CLIENT(user_data);
+       gboolean result;
 
-    g_debug("emit 'cert-check' signal for client %p", client);
-    g_signal_emit(client, signals[0], 0, peer_cert, errors, &result);
-    return result;
+       g_debug("emit 'cert-check' signal for client %p", client);
+       g_signal_emit(client, signals[0], 0, peer_cert, errors, &result);
+       return result;
 }
diff --git a/libnetclient/net-client.h b/libnetclient/net-client.h
index bd08289..e92f9b8 100644
--- a/libnetclient/net-client.h
+++ b/libnetclient/net-client.h
@@ -2,18 +2,13 @@
  *
  * Copyright (C) Albrecht Dreß <mailto:albrecht dress arcor de> 2017
  *
- * This library is free software; you can redistribute it and/or modify it under the terms of
- * the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along with this
- * library. If not, see
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 
General Public License
+ * as published by the Free Software Foundation; either version 3 of the License, or (at your option) any 
later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 
the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this library. If not, 
see
  * <http://www.gnu.org/licenses/>.
  */
 
@@ -29,22 +24,14 @@
 G_BEGIN_DECLS
 
 
-#define NET_CLIENT_TYPE                                         (net_client_get_type())
-#define NET_CLIENT(obj)                                         (G_TYPE_CHECK_INSTANCE_CAST((obj), \
-                                                                                            NET_CLIENT_TYPE, 
\
-                                                                                            NetClient))
-#define NET_IS_CLIENT(obj)                                      (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
-                                                                                            NET_CLIENT_TYPE))
-#define NET_CLIENT_CLASS(klass)                         (G_TYPE_CHECK_CLASS_CAST((klass), \
-                                                                                 NET_CLIENT_TYPE, \
-                                                                                 NetClientClass))
-#define NET_IS_CLIENT_CLASS(klass)                      (G_TYPE_CHECK_CLASS_TYPE((klass), \
-                                                                                 NET_CLIENT_TYPE))
-#define NET_CLIENT_GET_CLASS(obj)                       (G_TYPE_INSTANCE_GET_CLASS((obj), \
-                                                                                   NET_CLIENT_TYPE, \
-                                                                                   NetClientClass))
+#define NET_CLIENT_TYPE                                                (net_client_get_type())
+#define NET_CLIENT(obj)                                                (G_TYPE_CHECK_INSTANCE_CAST((obj), 
NET_CLIENT_TYPE, NetClient))
+#define NET_IS_CLIENT(obj)                                     (G_TYPE_CHECK_INSTANCE_TYPE((obj), 
NET_CLIENT_TYPE))
+#define NET_CLIENT_CLASS(klass)                                (G_TYPE_CHECK_CLASS_CAST((klass), 
NET_CLIENT_TYPE, NetClientClass))
+#define NET_IS_CLIENT_CLASS(klass)                     (G_TYPE_CHECK_CLASS_TYPE((klass), NET_CLIENT_TYPE))
+#define NET_CLIENT_GET_CLASS(obj)                      (G_TYPE_INSTANCE_GET_CLASS((obj), NET_CLIENT_TYPE, 
NetClientClass))
 
-#define NET_CLIENT_ERROR_QUARK                          (g_quark_from_static_string("net-client"))
+#define NET_CLIENT_ERROR_QUARK                         (g_quark_from_static_string("net-client"))
 
 
 typedef struct _NetClient NetClient;
@@ -67,71 +54,56 @@ struct _NetClientClass {
 
 /** @brief Encryption mode */
 enum _NetClientCryptMode {
-    NET_CLIENT_CRYPT_ENCRYPTED = 1,                     /**< TLS encryption @em before starting
-                                                           the protocol required (e.g. SMTPS).
-                                                         */
-    NET_CLIENT_CRYPT_STARTTLS,                                  /**< Protocol-specific STARTTLS
-                                                                   encryption required. */
-    NET_CLIENT_CRYPT_STARTTLS_OPT,                      /**< Optional protocol-specific STARTTLS
-                                                           encryption, proceed unencrypted on
-                                                           fail. */
-    NET_CLIENT_CRYPT_NONE                                       /**< Unencrypted connection. */
+       NET_CLIENT_CRYPT_ENCRYPTED = 1,                 /**< TLS encryption @em before starting the protocol 
required (e.g. SMTPS). */
+       NET_CLIENT_CRYPT_STARTTLS,                              /**< Protocol-specific STARTTLS encryption 
required. */
+       NET_CLIENT_CRYPT_STARTTLS_OPT,                  /**< Optional protocol-specific STARTTLS encryption, 
proceed unencrypted on fail. */
+       NET_CLIENT_CRYPT_NONE                                   /**< Unencrypted connection. */
 };
 
 
 /** @brief Error codes */
 enum _NetClientError {
-    NET_CLIENT_ERROR_CONNECTED = 1,                     /**< The client is already connected. */
-    NET_CLIENT_ERROR_NOT_CONNECTED,                     /**< The client is not connected. */
-    NET_CLIENT_ERROR_CONNECTION_LOST,                   /**< The connection is lost. */
-    NET_CLIENT_ERROR_TLS_ACTIVE,                        /**< TLS is already active for the
-                                                           connection. */
-    NET_CLIENT_ERROR_LINE_TOO_LONG,                     /**< The line is too long. */
-    NET_CLIENT_ERROR_GNUTLS,                                    /**< A GnuTLS error occurred. */
-    NET_CLIENT_ERROR_GSSAPI                                     /**< A GSSAPI error occurred. */
+       NET_CLIENT_ERROR_CONNECTED = 1,                 /**< The client is already connected. */
+       NET_CLIENT_ERROR_NOT_CONNECTED,                 /**< The client is not connected. */
+       NET_CLIENT_ERROR_CONNECTION_LOST,               /**< The connection is lost. */
+       NET_CLIENT_ERROR_TLS_ACTIVE,                    /**< TLS is already active for the connection. */
+       NET_CLIENT_ERROR_LINE_TOO_LONG,                 /**< The line is too long. */
+       NET_CLIENT_ERROR_GNUTLS,                                /**< A GnuTLS error occurred. */
+       NET_CLIENT_ERROR_GSSAPI                                 /**< A GSSAPI error occurred. */
 };
 
 
 GType net_client_get_type(void)
-G_GNUC_CONST;
+       G_GNUC_CONST;
 
 
 /** @brief Create a new network client
  *
- * @param host_and_port remote host and port or service, separated by a colon, which shall be
- * connected
+ * @param host_and_port remote host and port or service, separated by a colon, which shall be connected
  * @param default_port default remote port if host_and_port does not contain a port
  * @param max_line_len maximum line length supported by the underlying protocol, 0 for no limit
  * @return the net network client object
  *
- * Create a new network client object with the passed parameters.  Call
- *<tt>g_object_unref()</tt> on it to shut down the connection
+ * Create a new network client object with the passed parameters.  Call <tt>g_object_unref()</tt> on it to 
shut down the connection
  * and to free all resources of it.
  */
-NetClient *net_client_new(const gchar *host_and_port,
-                          guint16      default_port,
-                          gsize        max_line_len);
+NetClient *net_client_new(const gchar *host_and_port, guint16 default_port, gsize max_line_len);
 
 
 /** @brief Configure a network client
  *
  * @param client network client
- * @param host_and_port remote host and port or service, separated by a colon, which shall be
- * connected
+ * @param host_and_port remote host and port or service, separated by a colon, which shall be connected
  * @param default_port default remote port if host_and_port does not contain a port
  * @param max_line_len maximum line length supported by the underlying protocol, 0 for no limit
  * @param error filled with error information on error
  * @return TRUE is the connection was successful, FALSE on error
  *
- * Set the remote host and port and the maximum line length to the passed parameters, replacing
- * the previous values set by calling
+ * Set the remote host and port and the maximum line length to the passed parameters, replacing the previous 
values set by calling
  * net_client_new().
  */
-gboolean net_client_configure(NetClient   *client,
-                              const gchar *host_and_port,
-                              guint16      default_port,
-                              gsize        max_line_len,
-                              GError     **error);
+gboolean net_client_configure(NetClient *client, const gchar *host_and_port, guint16 default_port, gsize 
max_line_len,
+                                                         GError **error);
 
 
 /** @brief Get the target host of a network client
@@ -139,8 +111,7 @@ gboolean net_client_configure(NetClient   *client,
  * @param client network client
  * @return the currently set host on success, or NULL on error
  *
- * @note The function returns the value of @em host_and_port set by net_client_new() or
- * net_client_configure().
+ * @note The function returns the value of @em host_and_port set by net_client_new() or 
net_client_configure().
  */
 const gchar *net_client_get_host(const NetClient *client);
 
@@ -153,16 +124,14 @@ const gchar *net_client_get_host(const NetClient *client);
  *
  * Try to connect the remote host and TCP port.
  */
-gboolean net_client_connect(NetClient *client,
-                            GError   **error);
+gboolean net_client_connect(NetClient *client, GError **error);
 
 
 /** @brief Shut down the connection to a network client
  *
  * @param client network client
  *
- * Shut down the connection.  Note that it is usually not necessary to call this function, as
- * the connection will be shut down when
+ * Shut down the connection.  Note that it is usually not necessary to call this function, as the connection 
will be shut down when
  * the client is destroyed by calling <tt>g_object_unref()</tt>.
  */
 void net_client_shutdown(const NetClient *client);
@@ -191,16 +160,12 @@ gboolean net_client_is_encrypted(NetClient *client);
  * @param error filled with error information on error
  * @return TRUE is the certificate and private key were loaded, FALSE on error
  *
- * Load a client certificate and private key form the passed PEM data.  If the private key is
- * encrypted, the signal @ref cert-pass
+ * Load a client certificate and private key form the passed PEM data.  If the private key is encrypted, the 
signal @ref cert-pass
  * is emitted.
  *
- * Use this function (or net_client_set_cert_from_file()) if the remote server requires a client
- * certificate.
+ * Use this function (or net_client_set_cert_from_file()) if the remote server requires a client certificate.
  */
-gboolean net_client_set_cert_from_pem(NetClient   *client,
-                                      const gchar *pem_data,
-                                      GError     **error);
+gboolean net_client_set_cert_from_pem(NetClient *client, const gchar *pem_data, GError **error);
 
 
 /** @brief Load a certificate and private key from a PEM file
@@ -210,16 +175,12 @@ gboolean net_client_set_cert_from_pem(NetClient   *client,
  * @param error filled with error information on error
  * @return TRUE is the certificate and private key were loaded, FALSE on error
  *
- * Load a client certificate and private key form the passed PEM file.  If the private key is
- * encrypted, the signal @ref cert-pass
+ * Load a client certificate and private key form the passed PEM file.  If the private key is encrypted, the 
signal @ref cert-pass
  * is emitted.
  *
- * Use this function (or net_client_set_cert_from_pem()) if the remote server requires a client
- * certificate.
+ * Use this function (or net_client_set_cert_from_pem()) if the remote server requires a client certificate.
  */
-gboolean net_client_set_cert_from_file(NetClient   *client,
-                                       const gchar *pem_path,
-                                       GError     **error);
+gboolean net_client_set_cert_from_file(NetClient *client, const gchar *pem_path, GError **error);
 
 
 /** @brief Start encryption
@@ -228,31 +189,24 @@ gboolean net_client_set_cert_from_file(NetClient   *client,
  * @param error filled with error information on error
  * @return TRUE if the connection is now TLS encrypted, FALSE on error
  *
- * Try to negotiate TLS encryption.  If the remote server presents an untrusted certificate, the
- * signal @ref cert-check is emitted.
+ * Try to negotiate TLS encryption.  If the remote server presents an untrusted certificate, the signal @ref 
cert-check is emitted.
  */
-gboolean net_client_start_tls(NetClient *client,
-                              GError   **error);
+gboolean net_client_start_tls(NetClient *client, GError **error);
 
 
 /** @brief Read a CRLF-terminated line from a network client
  *
  * @param client network client
- * @param recv_line filled with the response buffer on success, may be NULL to discard the line
- * read
+ * @param recv_line filled with the response buffer on success, may be NULL to discard the line read
  * @param error filled with error information on error
  * @return TRUE is the read operation was successful, FALSE on error
  *
- * Read a CRLF-terminated line from the remote server and return it in the passed buffer.  The
- * terminating CRLF is always stripped.
+ * Read a CRLF-terminated line from the remote server and return it in the passed buffer.  The terminating 
CRLF is always stripped.
  *
- * @note If supplied, the response buffer is never NULL on success.  The caller must free the
- * returned buffer when it is not needed
+ * @note If supplied, the response buffer is never NULL on success.  The caller must free the returned 
buffer when it is not needed
  *       any more.
  */
-gboolean net_client_read_line(NetClient *client,
-                              gchar    **recv_line,
-                              GError   **error);
+gboolean net_client_read_line(NetClient *client, gchar **recv_line, GError **error);
 
 
 /** @brief Write data to a network client
@@ -263,14 +217,10 @@ gboolean net_client_read_line(NetClient *client,
  * @param error filled with error information on error
  * @return TRUE is the send operation was successful, FALSE on error
  *
- * Send the complete data buffer to the remote server.  The caller must ensure that the allowed
- * line length is not exceeded, and
+ * Send the complete data buffer to the remote server.  The caller must ensure that the allowed line length 
is not exceeded, and
  * that the lines are CRLF-terminated.
  */
-gboolean net_client_write_buffer(NetClient   *client,
-                                 const gchar *buffer,
-                                 gsize        count,
-                                 GError     **error);
+gboolean net_client_write_buffer(NetClient *client, const gchar *buffer, gsize count, GError **error);
 
 
 /** @brief Write a line to a network client
@@ -281,13 +231,9 @@ gboolean net_client_write_buffer(NetClient   *client,
  * @param error filled with error information on error
  * @return TRUE is the send operation was successful, FALSE on error
  *
- * Format a line according to the passed arguments, append CRLF, and send it to the remote
- * server.
+ * Format a line according to the passed arguments, append CRLF, and send it to the remote server.
  */
-gboolean net_client_vwrite_line(NetClient   *client,
-                                const gchar *format,
-                                va_list      args,
-                                GError     **error);
+gboolean net_client_vwrite_line(NetClient *client, const gchar *format, va_list args, GError **error);
 
 
 /** @brief Write a line with a variable argument list to a network client
@@ -298,39 +244,28 @@ gboolean net_client_vwrite_line(NetClient   *client,
  * @param ... additional arguments according to the format string
  * @return TRUE is the send operation was successful, FALSE on error
  *
- * Format a line according to the passed arguments, append CRLF, and send it to the remote
- * server.
+ * Format a line according to the passed arguments, append CRLF, and send it to the remote server.
  */
-gboolean net_client_write_line(NetClient   *client,
-                               const gchar *format,
-                               GError     **error,
-                               ...)
-G_GNUC_PRINTF(2, 4);
+gboolean net_client_write_line(NetClient *client, const gchar *format, GError **error, ...)
+       G_GNUC_PRINTF(2, 4);
 
 
 /** @brief Execute a command-response sequence with a network client
  *
  * @param client network client
- * @param response filled with the response buffer on success, may be NULL to discard the
- * response
+ * @param response filled with the response buffer on success, may be NULL to discard the response
  * @param request_fmt printf-like request format string
  * @param error filled with error information on error
  * @param ... additional arguments according to the format string
  * @return TRUE is the operation was successful, FALSE on error
  *
- * This convenience function calls net_client_vwrite_line() to write a one-line command to the
- * remote server, and then
- * net_client_read_line() to read the response.  The terminating CRLF of the response is always
- * stripped.
+ * This convenience function calls net_client_vwrite_line() to write a one-line command to the remote 
server, and then
+ * net_client_read_line() to read the response.  The terminating CRLF of the response is always stripped.
  *
  * @note The caller must free the returned buffer when it is not needed any more.
  */
-gboolean net_client_execute(NetClient   *client,
-                            gchar      **response,
-                            const gchar *request_fmt,
-                            GError     **error,
-                            ...)
-G_GNUC_PRINTF(3, 5);
+gboolean net_client_execute(NetClient *client, gchar **response, const gchar *request_fmt, GError **error, 
...)
+       G_GNUC_PRINTF(3, 5);
 
 
 /** @brief Set the connection time-out
@@ -341,69 +276,48 @@ G_GNUC_PRINTF(3, 5);
  *
  * @note The default timeout is 180 seconds (3 minutes).
  */
-gboolean net_client_set_timeout(NetClient *client,
-                                guint      timeout_secs);
+gboolean net_client_set_timeout(NetClient *client, guint timeout_secs);
 
 
-/**
+/** 
  * @mainpage
  *
- * This library provides an implementation of CRLF-terminated line-based client protocols built
- * on top of GIO.  It provides a base
- * module (see file net-client.h), containing the line-based IO methods, and on top of that SMTP
- *(RFC 5321) and POP3 (RFC 1939)
- * client classes (see files net-client-smtp.h and net-client-pop.h, respectively).  The file
- * net-client-utils.h contains some
+ * This library provides an implementation of CRLF-terminated line-based client protocols built on top of 
GIO.  It provides a base
+ * module (see file net-client.h), containing the line-based IO methods, and on top of that SMTP (RFC 5321) 
and POP3 (RFC 1939)
+ * client classes (see files net-client-smtp.h and net-client-pop.h, respectively).  The file 
net-client-utils.h contains some
  * helper functions for authentication.
  *
  * \author Written by Albrecht Dreß mailto:albrecht dress arcor de
  * \copyright Copyright &copy; Albrecht Dreß 2017<br/>
- * This library is free software: you can redistribute it and/or modify it under the terms of
- * the GNU General Public License as
- * published bythe Free Software Foundation, either version 3 of the License, or (at your
- * option) any later version.<br/>
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.<br/>
- * You should have received a copy of the GNU General Public License along with this library.
- * If not, see
+ * This library is free software: you can redistribute it and/or modify it under the terms of the GNU 
General Public License as
+ * published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later 
version.<br/>
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 
the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
details.<br/>
+ * You should have received a copy of the GNU General Public License along with this library.  If not, see
  * http://www.gnu.org/licenses/.
  *
  * @file
  *
- * This module implements the base class for a simple network client communication on the basis
- * of CRLF-terminated lines.
+ * This module implements the base class for a simple network client communication on the basis of 
CRLF-terminated lines.
  *
  * @section signals Signals
  *
  * The following signals are implemented:
  *
  * - @anchor cert-pass cert-pass
- *   @code gchar *cert_pass(NetClient *client, GByteArray *peer_cert_der, gpointer user_data)
- *@endcode The client certificate used
- *   for the connection has a password-protected key.  The certificate in DER format is passed
- * to the signal handler, and shall
- *   return a newly allocated string containing the password.  The string is wiped and freed
- * when it is not needed any more.
+ *   @code gchar *cert_pass(NetClient *client, GByteArray *peer_cert_der, gpointer user_data) @endcode The 
client certificate used
+ *   for the connection has a password-protected key.  The certificate in DER format is passed to the signal 
handler, and shall
+ *   return a newly allocated string containing the password.  The string is wiped and freed when it is not 
needed any more.
  * - @anchor cert-check cert-check
- *   @code gboolean check_cert(NetClient *client, GTlsCertificate *peer_cert,
- * GTlsCertificateFlags errors, gpointer user_data)
- *   @endcode The server certificate is not trusted.  The received certificate and the errors
- * which occurred during the check are
- *   passed to the signal handler.  The handler shall return TRUE to accept the certificate, or
- * FALSE to reject it.
+ *   @code gboolean check_cert(NetClient *client, GTlsCertificate *peer_cert, GTlsCertificateFlags errors, 
gpointer user_data)
+ *   @endcode The server certificate is not trusted.  The received certificate and the errors which occurred 
during the check are
+ *   passed to the signal handler.  The handler shall return TRUE to accept the certificate, or FALSE to 
reject it.
  * - @anchor auth auth
- *   @code gchar **get_auth(NetClient *client, gboolean need_passwd, gpointer user_data)
- *@endcode Authentication is required by the
- *   remote server.  The signal handler shall return a NULL-terminated array of strings,
- * containing the user name in the first and
- *   the password in the second element.  If the parameter @em need_passwd is FALSE, no password
- * is required (e.g. for kerberos
- *   ticket-based authentication).  In this case, the password element must be present in the
- * reply, but it is ignored an may be
- *   NULL.  The strings are wiped and freed when they are not needed any more.  Return NULL if
- * no authentication is required.
+ *   @code gchar **get_auth(NetClient *client, gboolean need_passwd, gpointer user_data) @endcode 
Authentication is required by the
+ *   remote server.  The signal handler shall return a NULL-terminated array of strings, containing the user 
name in the first and
+ *   the password in the second element.  If the parameter @em need_passwd is FALSE, no password is required 
(e.g. for kerberos
+ *   ticket-based authentication).  In this case, the password element must be present in the reply, but it 
is ignored an may be
+ *   NULL.  The strings are wiped and freed when they are not needed any more.  Return NULL if no 
authentication is required.
  */
 
 
diff --git a/src/ab-main.c b/src/ab-main.c
index b4002ad..1e04bc4 100644
--- a/src/ab-main.c
+++ b/src/ab-main.c
@@ -18,7 +18,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <stdlib.h>
@@ -27,11 +27,11 @@
 #include <gtk/gtk.h>
 
 #ifdef HAVE_LOCALE_H
-#   include <locale.h>
+#include <locale.h>
 #endif
 
 #if HAVE_MACOSX_DESKTOP
-#   include <ige-mac-integration.h>
+#  include <ige-mac-integration.h>
 #endif
 
 #include "address-book.h"
@@ -39,13 +39,13 @@
 #include "address-book-extern.h"
 #include "address-book-ldif.h"
 #if ENABLE_LDAP
-#   include "address-book-ldap.h"
+#include "address-book-ldap.h"
 #endif /* ENABLE_LDAP */
 #if HAVE_SQLITE
-#   include "address-book-gpe.h"
+#include "address-book-gpe.h"
 #endif /* HAVE_SQLITE */
 #if HAVE_RUBRICA
-#   include "address-book-rubrica.h"
+#include "address-book-rubrica.h"
 #endif /* HAVE_RUBRICA */
 #include "address-book-config.h"
 #include "application-helpers.h"
@@ -64,7 +64,7 @@ struct ABMainWindow {
     GList *address_book_list;
     gchar *default_address_book_prefix;
     LibBalsaAddressBook *default_address_book;
-    LibBalsaAddressBook *address_book;
+    LibBalsaAddressBook* address_book;
     LibBalsaAddress *displayed_address;
 
     GMenu *file_menu;
@@ -77,16 +77,13 @@ bab_cleanup(void)
     gtk_main_quit();
 }
 
-
-static void ab_set_edit_widget(LibBalsaAddress *address,
-                               gboolean         can_remove);
+static void ab_set_edit_widget(LibBalsaAddress * address,
+                               gboolean can_remove);
 static void ab_clear_edit_widget(void);
 
 #define ADDRESS_BOOK_SECTION_PREFIX "address-book-"
 static gboolean
-bab_config_init(const gchar *group,
-                const gchar *value,
-                gpointer     data)
+bab_config_init(const gchar * group, const gchar * value, gpointer data)
 {
     LibBalsaAddressBook *address_book;
 
@@ -96,18 +93,15 @@ bab_config_init(const gchar *group,
             g_list_append(contacts_app.address_book_list, address_book);
 
         if (g_strcmp0(group,
-                      contacts_app.default_address_book_prefix) == 0) {
+                      contacts_app.default_address_book_prefix) == 0)
             contacts_app.default_address_book = address_book;
-        }
     }
 
     return FALSE;
 }
 
-
-static void ab_warning(const char *fmt,
-                       ...)
-G_GNUC_PRINTF(1, 2);
+static void ab_warning(const char *fmt, ...)
+       G_GNUC_PRINTF(1, 2);
 
 enum {
     LIST_COLUMN_NAME,
@@ -118,28 +112,26 @@ enum {
 
 
 /*
-   The address load callback. Adds a single address to the address list.
+  The address load callback. Adds a single address to the address list.
 
-   If the current address book is in dist list mode then create a
-   single entry, or else create an entry for each address in the book.
+  If the current address book is in dist list mode then create a
+  single entry, or else create an entry for each address in the book.
  */
 static void
 bab_load_cb(LibBalsaAddressBook *libbalsa_ab,
-            LibBalsaAddress     *address,
-            GtkTreeModel        *model)
+            LibBalsaAddress *address, GtkTreeModel *model)
 {
     GtkTreeIter iter;
     GList *addr_list;
 
     g_return_if_fail(LIBBALSA_IS_ADDRESS_BOOK(libbalsa_ab));
 
-    if (address == NULL) {
-        return;
-    }
+    if (address == NULL)
+       return;
 
     addr_list = libbalsa_address_get_addr_list(address);
     if (libbalsa_address_book_get_dist_list_mode(libbalsa_ab)
-        && (addr_list != NULL) && (addr_list->next != NULL)) {
+        && addr_list != NULL && addr_list->next != NULL) {
         gchar *address_string = libbalsa_address_to_gchar(address, -1);
 
         gtk_list_store_prepend(GTK_LIST_STORE(model), &iter);
@@ -151,11 +143,11 @@ bab_load_cb(LibBalsaAddressBook *libbalsa_ab,
                            LIST_COLUMN_ADDRESS, address,
                            -1);
 
-        g_free(address_string);
+       g_free(address_string);
     } else {
         GList *l;
 
-        for (l = addr_list; l != NULL; l = l->next) {
+       for (l = addr_list; l != NULL; l = l->next) {
             gtk_list_store_prepend(GTK_LIST_STORE(model), &iter);
             /* GtkListStore refs address once for each address in
              * the list, and unrefs it the same number of times when
@@ -166,15 +158,14 @@ bab_load_cb(LibBalsaAddressBook *libbalsa_ab,
                                LIST_COLUMN_ADDRSPEC, l->data,
                                LIST_COLUMN_ADDRESS, address,
                                -1);
-        }
+       }
     }
 }
 
-
 static gboolean
-bab_set_address_book(LibBalsaAddressBook *ab,
-                     GtkWidget           *list,
-                     const gchar         *filter)
+bab_set_address_book(LibBalsaAddressBook * ab,
+                     GtkWidget           * list,
+                     const gchar         * filter)
 {
     GtkTreeModel *model;
     LibBalsaABErr ab_err;
@@ -186,9 +177,9 @@ bab_set_address_book(LibBalsaAddressBook *ab,
     model = gtk_tree_view_get_model(GTK_TREE_VIEW(list));
     gtk_list_store_clear(GTK_LIST_STORE(model));
     if ((ab_err =
-             libbalsa_address_book_load(ab, filter,
-                                        (LibBalsaAddressBookLoadFunc)
-                                        bab_load_cb, model)) != LBABERR_OK) {
+         libbalsa_address_book_load(ab, filter,
+                                    (LibBalsaAddressBookLoadFunc)
+                                    bab_load_cb, model)) != LBABERR_OK) {
         const gchar *name = libbalsa_address_book_get_name(ab);
         const gchar *desc = libbalsa_address_book_strerror(ab, ab_err);
 
@@ -198,35 +189,30 @@ bab_set_address_book(LibBalsaAddressBook *ab,
     return TRUE;
 }
 
-
 static void
-bab_window_set_title(LibBalsaAddressBook *address_book)
+bab_window_set_title(LibBalsaAddressBook * address_book)
 {
     const gchar *type = "";
     const gchar *name;
     gchar *title;
 
-    if (LIBBALSA_IS_ADDRESS_BOOK_VCARD(address_book)) {
+    if (LIBBALSA_IS_ADDRESS_BOOK_VCARD(address_book))
         type = "vCard";
-    } else if (LIBBALSA_IS_ADDRESS_BOOK_EXTERN(address_book)) {
+    else if (LIBBALSA_IS_ADDRESS_BOOK_EXTERN(address_book))
         type = "External query";
-    } else if (LIBBALSA_IS_ADDRESS_BOOK_LDIF(address_book)) {
+    else if (LIBBALSA_IS_ADDRESS_BOOK_LDIF(address_book))
         type = "LDIF";
-    }
 #if ENABLE_LDAP
-    else if (LIBBALSA_IS_ADDRESS_BOOK_LDAP(address_book)) {
+    else if (LIBBALSA_IS_ADDRESS_BOOK_LDAP(address_book))
         type = "LDAP";
-    }
 #endif
 #if HAVE_SQLITE
-    else if (LIBBALSA_IS_ADDRESS_BOOK_GPE(address_book)) {
+    else if (LIBBALSA_IS_ADDRESS_BOOK_GPE(address_book))
         type = "GPE";
-    }
 #endif
 #if HAVE_RUBRICA
-    else if (LIBBALSA_IS_ADDRESS_BOOK_RUBRICA(address_book)) {
+    else if (LIBBALSA_IS_ADDRESS_BOOK_RUBRICA(address_book))
         type = "Rubrica";
-    }
 #endif /* HAVE_RUBRICA */
 
     name = libbalsa_address_book_get_name(address_book);
@@ -235,11 +221,10 @@ bab_window_set_title(LibBalsaAddressBook *address_book)
     g_free(title);
 }
 
-
 static void
-address_book_change_state(GSimpleAction *action,
-                          GVariant      *state,
-                          gpointer       user_data)
+address_book_change_state(GSimpleAction * action,
+                          GVariant      * state,
+                          gpointer        user_data)
 {
     const gchar *value;
     GList *l;
@@ -248,16 +233,14 @@ address_book_change_state(GSimpleAction *action,
     value = g_variant_get_string(state, NULL);
     for (l = contacts_app.address_book_list; l != NULL; l = l->next) {
         address_book = l->data;
-        if ((address_book != NULL)
-            && (strcmp(value,
-                       libbalsa_address_book_get_name(address_book)) == 0)) {
+        if (address_book != NULL
+            && strcmp(value,
+                      libbalsa_address_book_get_name(address_book)) == 0)
             break;
-        }
     }
 
-    if (address_book == NULL) {
+    if (address_book == NULL)
         return;
-    }
 
     ab_clear_edit_widget();
     bab_set_address_book(address_book, contacts_app.entry_list, NULL);
@@ -266,7 +249,6 @@ address_book_change_state(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 static void
 address_changed_cb(struct ABMainWindow *aw)
 {
@@ -274,7 +256,6 @@ address_changed_cb(struct ABMainWindow *aw)
     gtk_widget_set_sensitive(aw->cancel_button, TRUE);
 }
 
-
 /* File menu callback helpers */
 
 static void
@@ -299,9 +280,8 @@ set_address_book_menu_items(void)
         LibBalsaAddressBook *address_book = l->data;
         const gchar *name;
 
-        if (!address_book) {
+        if (!address_book)
             continue;
-        }
         name = libbalsa_address_book_get_name(address_book);
 
         g_string_append(string, "<item>");
@@ -341,25 +321,20 @@ set_address_book_menu_items(void)
     g_object_unref(builder);
 }
 
-
 static gboolean
-get_used_group(const gchar *key,
-               const gchar *value,
-               gpointer     data)
+get_used_group(const gchar * key, const gchar * value, gpointer data)
 {
     gint *max = data;
     gint curr;
 
-    if (*value && ((curr = atoi(value)) > *max)) {
+    if (*value && (curr = atoi(value)) > *max)
         *max = curr;
-    }
 
     return FALSE;
 }
 
-
 static gchar *
-get_unused_group(const gchar *prefix)
+get_unused_group(const gchar * prefix)
 {
     gint max = 0;
 
@@ -368,20 +343,17 @@ get_unused_group(const gchar *prefix)
     return g_strdup_printf("%s%d", prefix, ++max);
 }
 
-
 #define BAB_PREFIX_LEN 3        /* strlen("_1:") */
 
 static void
-address_book_change(LibBalsaAddressBook *address_book,
-                    gboolean             append)
+address_book_change(LibBalsaAddressBook * address_book, gboolean append)
 {
     const gchar *config_prefix;
     gchar *group;
 
-    if (append) {
+    if (append)
         contacts_app.address_book_list =
             g_list_append(contacts_app.address_book_list, address_book);
-    }
 
     set_address_book_menu_items();
     bab_window_set_title(address_book);
@@ -396,111 +368,98 @@ address_book_change(LibBalsaAddressBook *address_book,
     libbalsa_conf_queue_sync();
 }
 
-
 static void
-file_new_vcard_activated(GSimpleAction *action,
-                         GVariant      *state,
-                         gpointer       user_data)
+file_new_vcard_activated(GSimpleAction * action,
+                         GVariant      * state,
+                         gpointer        user_data)
 {
     balsa_address_book_config_new_from_type
         (LIBBALSA_TYPE_ADDRESS_BOOK_VCARD, address_book_change,
-        contacts_app.window);
+         contacts_app.window);
 }
 
-
 static void
-file_new_extern_activated(GSimpleAction *action,
-                          GVariant      *state,
-                          gpointer       user_data)
+file_new_extern_activated(GSimpleAction * action,
+                          GVariant      * state,
+                          gpointer        user_data)
 {
     balsa_address_book_config_new_from_type
         (LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN, address_book_change,
-        contacts_app.window);
+         contacts_app.window);
 }
 
-
 static void
-file_new_ldif_activated(GSimpleAction *action,
-                        GVariant      *state,
-                        gpointer       user_data)
+file_new_ldif_activated(GSimpleAction * action,
+                        GVariant      * state,
+                        gpointer        user_data)
 {
     balsa_address_book_config_new_from_type
         (LIBBALSA_TYPE_ADDRESS_BOOK_LDIF, address_book_change,
-        contacts_app.window);
+         contacts_app.window);
 }
 
-
 #if ENABLE_LDAP
 static void
-file_new_ldap_activated(GSimpleAction *action,
-                        GVariant      *state,
-                        gpointer       user_data)
+file_new_ldap_activated(GSimpleAction * action,
+                        GVariant      * state,
+                        gpointer        user_data)
 {
     balsa_address_book_config_new_from_type
         (LIBBALSA_TYPE_ADDRESS_BOOK_LDAP, address_book_change,
-        contacts_app.window);
+         contacts_app.window);
 }
-
-
 #endif /* ENABLE_LDAP */
 
 #if HAVE_SQLITE
 static void
-file_new_gpe_activated(GSimpleAction *action,
-                       GVariant      *state,
-                       gpointer       user_data)
+file_new_gpe_activated(GSimpleAction * action,
+                       GVariant      * state,
+                       gpointer        user_data)
 {
     balsa_address_book_config_new_from_type
         (LIBBALSA_TYPE_ADDRESS_BOOK_GPE, address_book_change,
-        contacts_app.window);
+         contacts_app.window);
 }
-
-
 #endif /* HAVE_SQLITE */
 
 #if HAVE_RUBRICA
 static void
-file_new_rubrica_activated(GSimpleAction *action,
-                           GVariant      *state,
-                           gpointer       user_data)
+file_new_rubrica_activated(GSimpleAction * action,
+                           GVariant      * state,
+                           gpointer        user_data)
 {
     balsa_address_book_config_new_from_type
         (LIBBALSA_TYPE_ADDRESS_BOOK_RUBRICA, address_book_change,
-        contacts_app.window);
+         contacts_app.window);
 }
-
-
 #endif /* HAVE_RUBRICA */
 
 static void
-file_properties_activated(GSimpleAction *action,
-                          GVariant      *state,
-                          gpointer       user_data)
+file_properties_activated(GSimpleAction * action,
+                          GVariant      * state,
+                          gpointer        user_data)
 {
     LibBalsaAddressBook *address_book;
 
-    if (!(address_book = contacts_app.address_book)) {
+    if (!(address_book = contacts_app.address_book))
         return;
-    }
 
     balsa_address_book_config_new(address_book, address_book_change,
                                   contacts_app.window);
 }
 
-
 static void
-file_delete_activated(GSimpleAction *action,
-                      GVariant      *state,
-                      gpointer       user_data)
+file_delete_activated(GSimpleAction * action,
+                      GVariant      * state,
+                      gpointer        user_data)
 {
     LibBalsaAddressBook *address_book;
     const gchar *config_prefix;
     GList *list;
 
-    if (((address_book = contacts_app.address_book) == NULL)
-        || (contacts_app.address_book_list->next == NULL)) {
+    if ((address_book = contacts_app.address_book) == NULL
+        || contacts_app.address_book_list->next == NULL)
         return;
-    }
 
     config_prefix = libbalsa_address_book_get_config_prefix(address_book);
     if (config_prefix != NULL) {
@@ -515,34 +474,29 @@ file_delete_activated(GSimpleAction *action,
     list->data = NULL;
     g_object_unref(address_book);
 
-    for (list = contacts_app.address_book_list; list; list = list->next) {
-        if ((address_book = list->data) != NULL) {
+    for (list = contacts_app.address_book_list; list; list = list->next)
+        if ((address_book = list->data) != NULL)
             break;
-        }
-    }
 
-    if (!list) {
+    if (!list)
         return;
-    }
 
     contacts_app.address_book = list->data;
     set_address_book_menu_items();
 }
 
-
 static void
-file_quit_activated(GSimpleAction *action,
-                    GVariant      *state,
-                    gpointer       user_data)
+file_quit_activated(GSimpleAction * action,
+                    GVariant      * state,
+                    gpointer        user_data)
 {
     gtk_main_quit();
 }
 
-
 static void
-entry_new_activated(GSimpleAction *action,
-                    GVariant      *state,
-                    gpointer       user_data)
+entry_new_activated(GSimpleAction * action,
+                    GVariant      * state,
+                    gpointer        user_data)
 {
     GtkTreeSelection *selection;
 
@@ -551,14 +505,13 @@ entry_new_activated(GSimpleAction *action,
     ab_set_edit_widget(NULL, FALSE);
     gtk_widget_set_sensitive(contacts_app.remove_button, FALSE);
     selection = gtk_tree_view_get_selection(GTK_TREE_VIEW
-                                                (contacts_app.entry_list));
+                                            (contacts_app.entry_list));
     gtk_tree_selection_unselect_all(selection);
     gtk_widget_grab_focus(contacts_app.edit_widget);
 }
 
-
 static LibBalsaABErr
-ab_remove_address(LibBalsaAddress *address)
+ab_remove_address(LibBalsaAddress* address)
 {
     LibBalsaABErr err = LBABERR_OK;
 
@@ -566,86 +519,78 @@ ab_remove_address(LibBalsaAddress *address)
 
     libbalsa_address_book_remove_address(contacts_app.address_book, address);
 
-    if (err == LBABERR_OK) {
-        GtkTreeIter iter;
+    if(err == LBABERR_OK) {
+        GtkTreeIter       iter;
         GtkTreeSelection *selection;
-        GtkTreeView *v = GTK_TREE_VIEW(contacts_app.entry_list);
+        GtkTreeView  *v = GTK_TREE_VIEW(contacts_app.entry_list);
         GtkTreeModel *m;
-        selection = gtk_tree_view_get_selection(v);
-        if (gtk_tree_selection_get_selected(selection, &m, &iter)) {
+        selection       = gtk_tree_view_get_selection(v);
+        if(gtk_tree_selection_get_selected(selection, &m, &iter))
             gtk_list_store_remove(GTK_LIST_STORE(m), &iter);
-        }
-        if (address == contacts_app.displayed_address) {
-            ab_clear_edit_widget();
-            contacts_app.displayed_address = NULL;
-        }
-    } else {
+       if(address == contacts_app.displayed_address) {
+           ab_clear_edit_widget();
+           contacts_app.displayed_address = NULL;
+       }
+    } else
         ab_warning("Cannot remove: %s\n",
                    libbalsa_address_book_strerror(contacts_app.address_book,
                                                   err));
-    }
     return err;
 }
 
-
 static void
-entry_delete_activated(GSimpleAction *action,
-                       GVariant      *state,
-                       gpointer       user_data)
+entry_delete_activated(GSimpleAction * action,
+                       GVariant      * state,
+                       gpointer        user_data)
 {
-    GtkTreeView *v = GTK_TREE_VIEW(contacts_app.entry_list);
+    GtkTreeView  *v = GTK_TREE_VIEW(contacts_app.entry_list);
     GtkTreeSelection *selection = gtk_tree_view_get_selection(v);
     GtkTreeModel *model;
-    GtkTreeIter iter;
+    GtkTreeIter   iter;
 
-    if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
-        GValue gv = {
-            0,
-        };
-        LibBalsaAddress *address;
+    if(gtk_tree_selection_get_selected(selection, &model, &iter)) {
+       GValue gv = {0,};
+       LibBalsaAddress *address;
 
-        gtk_tree_model_get_value(model, &iter, LIST_COLUMN_ADDRESS, &gv);
-        address = LIBBALSA_ADDRESS(g_value_get_object(&gv));
-        if (address) {
-            ab_remove_address(address);
-        }
+       gtk_tree_model_get_value(model, &iter, LIST_COLUMN_ADDRESS, &gv);
+       address = LIBBALSA_ADDRESS(g_value_get_object(&gv));
+       if (address)
+           ab_remove_address(address);
     }
 }
 
-
 static void
-help_about_activated(GSimpleAction *action,
-                     GVariant      *state,
-                     gpointer       user_data)
+help_about_activated(GSimpleAction * action,
+                     GVariant      * state,
+                     gpointer        user_data)
 {
     /* Help? */
 }
 
-
 static void
-get_main_menu(GtkApplication *application)
+get_main_menu(GtkApplication * application)
 {
     static GActionEntry win_entries[] = {
-        {"file-new-vcard", file_new_vcard_activated},
-        {"file-new-external", file_new_extern_activated},
-        {"file-new-ldif", file_new_ldif_activated},
+        {"file-new-vcard",      file_new_vcard_activated},
+        {"file-new-external",   file_new_extern_activated},
+        {"file-new-ldif",       file_new_ldif_activated},
 #if ENABLE_LDAP
-        {"file-new-ldap", file_new_ldap_activated},
+        {"file-new-ldap",       file_new_ldap_activated},
 #endif /* ENABLE_LDAP */
 #if HAVE_SQLITE
-        {"file-new-gpe", file_new_gpe_activated},
+        {"file-new-gpe",        file_new_gpe_activated},
 #endif /* HAVE_SQLITE */
 #if HAVE_RUBRICA
-        {"file-new-rubrica", file_new_rubrica_activated},
+        {"file-new-rubrica",    file_new_rubrica_activated},
 #endif /* HAVE_RUBRICA */
-        {"file-properties", file_properties_activated},
-        {"file-delete", file_delete_activated},
-        {"file-quit", file_quit_activated},
-        {"entry-new", entry_new_activated},
-        {"entry-delete", entry_delete_activated},
-        {"help-about", help_about_activated},
-        {"address-book", libbalsa_radio_activated, "s", "''",
-         address_book_change_state},
+        {"file-properties",     file_properties_activated},
+        {"file-delete",         file_delete_activated},
+        {"file-quit",           file_quit_activated},
+        {"entry-new",           entry_new_activated},
+        {"entry-delete",        entry_delete_activated},
+        {"help-about",          help_about_activated},
+        {"address-book",        libbalsa_radio_activated, "s", "''",
+            address_book_change_state},
     };
     GtkBuilder *builder;
     gchar *ui_file;
@@ -657,7 +602,7 @@ get_main_menu(GtkApplication *application)
     if (gtk_builder_add_from_file(builder, ui_file, &err)) {
         gtk_application_set_menubar(application,
                                     G_MENU_MODEL(gtk_builder_get_object
-                                                     (builder, "menubar")));
+                                                 (builder, "menubar")));
         contacts_app.file_menu =
             G_MENU(gtk_builder_get_object(builder, "file-menu"));
     } else {
@@ -674,13 +619,11 @@ get_main_menu(GtkApplication *application)
     set_address_book_menu_items();
 }
 
-
-static void list_row_activated_cb(GtkTreeView *tview,
-                                  gpointer     data);
+static void
+list_row_activated_cb(GtkTreeView *tview, gpointer data);
 
 static void
-ab_set_edit_widget(LibBalsaAddress *address,
-                   gboolean         can_remove)
+ab_set_edit_widget(LibBalsaAddress * address, gboolean can_remove)
 {
     libbalsa_address_set_edit_entries(address, contacts_app.entries);
     gtk_widget_show(contacts_app.edit_widget);
@@ -689,81 +632,67 @@ ab_set_edit_widget(LibBalsaAddress *address,
     gtk_widget_set_sensitive(contacts_app.cancel_button, TRUE);
 }
 
-
 static void
 ab_clear_edit_widget(void)
 {
     gtk_widget_hide(contacts_app.edit_widget);
-    gtk_widget_set_sensitive(contacts_app.apply_button, FALSE);
+    gtk_widget_set_sensitive(contacts_app.apply_button,  FALSE);
     gtk_widget_set_sensitive(contacts_app.remove_button, FALSE);
     gtk_widget_set_sensitive(contacts_app.cancel_button, FALSE);
     contacts_app.displayed_address = NULL;
     gtk_notebook_set_current_page(GTK_NOTEBOOK(contacts_app.notebook), 0);
 }
 
-
 static void
-list_selection_changed_cb(GtkTreeSelection *selection,
-                          gpointer          data)
+list_selection_changed_cb(GtkTreeSelection *selection, gpointer data)
 {
     GtkTreeIter iter;
     GtkTreeModel *model;
-    GValue gv = {
-        0,
-    };
+    GValue gv = {0,};
     LibBalsaAddress *address;
 
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
+    if(!gtk_tree_selection_get_selected(selection, &model, &iter))
         return;
-    }
     gtk_tree_model_get_value(model, &iter, LIST_COLUMN_ADDRESS, &gv);
     address = LIBBALSA_ADDRESS(g_value_get_object(&gv));
-    if (address) {
+    if (address)
         ab_set_edit_widget(address, TRUE);
-    } else {
+    else
         ab_clear_edit_widget();
-    }
     g_value_unset(&gv);
     contacts_app.displayed_address = address;
 }
 
-
 static void
-list_row_activated_cb(GtkTreeView *tree,
-                      gpointer     data)
+list_row_activated_cb(GtkTreeView *tree, gpointer data)
 {
     GtkTreeIter iter;
     GtkTreeModel *model;
     GtkTreeSelection *selection;
-    GValue gv = {
-        0,
-    };
+    GValue gv = {0,};
     LibBalsaAddress *address;
 
     selection = gtk_tree_view_get_selection(tree);
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
+    if(!gtk_tree_selection_get_selected(selection, &model, &iter))
         return;
-    }
     gtk_tree_model_get_value(model, &iter, LIST_COLUMN_ADDRESS, &gv);
     address = LIBBALSA_ADDRESS(g_value_get_object(&gv));
     if (address) {
         ab_set_edit_widget(address, TRUE);
-        printf("Switch page..\n");
-        gtk_notebook_set_current_page(GTK_NOTEBOOK(contacts_app.notebook), 1);
-    } else {
+       printf("Switch page..\n");
+       gtk_notebook_set_current_page(GTK_NOTEBOOK(contacts_app.notebook), 1);
+    } else
         ab_clear_edit_widget();
-    }
     g_value_unset(&gv);
     contacts_app.displayed_address = address;
 }
 
-
 static void
-addrlist_drag_get_cb(GtkWidget        *widget,
-                     GdkDragContext   *drag_context,
-                     GtkSelectionData *sel_data,
-                     guint             time,
-                     gpointer          user_data)
+addrlist_drag_get_cb(GtkWidget        * widget,
+                     GdkDragContext   * drag_context,
+                     GtkSelectionData * sel_data,
+                     guint              time,
+                     gpointer           user_data)
 {
     const gchar *target;
 
@@ -774,31 +703,27 @@ addrlist_drag_get_cb(GtkWidget        *widget,
         GtkTreeSelection *selection;
         GtkTreeModel *model;
         GtkTreeIter iter;
-        GValue gv = {
-            0,
-        };
+        GValue gv = {0,};
         LibBalsaAddress *address;
 
         addrlist = GTK_TREE_VIEW(widget);
         selection = gtk_tree_view_get_selection(addrlist);
-        if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
+        if(!gtk_tree_selection_get_selected(selection, &model, &iter))
             return;
-        }
         gtk_tree_model_get_value(model, &iter, LIST_COLUMN_ADDRESS, &gv);
         address = LIBBALSA_ADDRESS(g_value_get_object(&gv));
         gtk_selection_data_set(sel_data,
                                target,
                                8, (const guchar *) &address,
-                               sizeof(LibBalsaAddress *));
-    } else if ((target == g_intern_static_string("text/plain")) ||
-               (target == g_intern_static_string("STRING"))) {
+                               sizeof(LibBalsaAddress*));
+    } else if (target == g_intern_static_string("text/plain") ||
+               target == g_intern_static_string("STRING")) {
         g_print("Text/plain cannot be sent.\n");
     } else {
         g_print("Do not know what to do!\n");
     }
 }
 
-
 static GtkWidget *
 bab_window_list_new(void)
 {
@@ -815,10 +740,10 @@ bab_window_list_new(void)
                            G_TYPE_STRING,   /* LIST_COLUMN_ADDRSPEC       */
                            G_TYPE_OBJECT);  /* LIST_COLUMN_ADDRESS        */
     /*
-       gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store), 0,
+    gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store), 0,
                                     balsa_ab_window_compare_entries,
                                     GINT_TO_POINTER(0), NULL);
-     */
+    */
     gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), 0,
                                          GTK_SORT_ASCENDING);
 
@@ -862,10 +787,8 @@ bab_window_list_new(void)
     return tree;
 }
 
-
 static void
-apply_button_cb(GtkWidget *w,
-                gpointer   data)
+apply_button_cb(GtkWidget * w, gpointer data)
 {
     LibBalsaAddress *newval;
     LibBalsaABErr err;
@@ -876,7 +799,7 @@ apply_button_cb(GtkWidget *w,
         ab_warning(contacts_app.displayed_address ?
                    "Cannot modify: %s\n" : "Cannot add: %s\n",
                    "no displayed name");
-        gtk_widget_set_sensitive(contacts_app.apply_button, FALSE);
+        gtk_widget_set_sensitive(contacts_app.apply_button,  FALSE);
         return;
     }
 
@@ -887,13 +810,13 @@ apply_button_cb(GtkWidget *w,
         libbalsa_address_book_add_address(contacts_app.address_book,
                                           newval);
 
-    if (err == LBABERR_OK) {
+    if(err == LBABERR_OK) {
         GtkTreeSelection *selection;
         GtkTreeModel *model;
         GtkTreeIter iter;
         GtkTreePath *path = NULL;
 
-        gtk_widget_set_sensitive(contacts_app.apply_button, FALSE);
+        gtk_widget_set_sensitive(contacts_app.apply_button,  FALSE);
         gtk_widget_set_sensitive(contacts_app.remove_button, TRUE);
         gtk_widget_set_sensitive(contacts_app.cancel_button, TRUE);
 
@@ -902,48 +825,40 @@ apply_button_cb(GtkWidget *w,
          * we have no method for that. */
         selection =
             gtk_tree_view_get_selection(GTK_TREE_VIEW
-                                            (contacts_app.entry_list));
-        if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
+                                        (contacts_app.entry_list));
+        if (gtk_tree_selection_get_selected(selection, &model, &iter))
             path = gtk_tree_model_get_path(model, &iter);
-        }
         bab_set_address_book(contacts_app.address_book,
                              contacts_app.entry_list, NULL);
         if (path) {
             gtk_tree_selection_select_path(selection, path);
             gtk_tree_path_free(path);
         }
-        if (!gtk_tree_selection_get_selected(selection, NULL, NULL)) {
+        if (!gtk_tree_selection_get_selected(selection, NULL, NULL))
             ab_clear_edit_widget();
-        }
-        gtk_notebook_set_current_page(GTK_NOTEBOOK(contacts_app.notebook), 0);
+       gtk_notebook_set_current_page(GTK_NOTEBOOK(contacts_app.notebook), 0);
 
-    } else {
+    } else
         ab_warning(contacts_app.displayed_address ?
                    "Cannot modify: %s\n" : "Cannot add: %s\n",
                    libbalsa_address_book_strerror(contacts_app.address_book,
                                                   err));
-    }
     g_object_unref(newval);
 }
 
-
 static void
-remove_button_cb(GtkWidget *w,
-                 gpointer   data)
+remove_button_cb(GtkWidget *w, gpointer data)
 {
     ab_remove_address(contacts_app.displayed_address);
 }
 
-
 static void
-cancel_button_cb(GtkWidget *w,
-                 gpointer   data)
+cancel_button_cb(GtkWidget * w, gpointer data)
 {
     ab_clear_edit_widget();
 }
 
-
-static GtkWidget *
+static GtkWidget*
 bab_get_edit_button_box(struct ABMainWindow *abmw)
 {
     GtkWidget *box_widget;
@@ -970,10 +885,8 @@ bab_get_edit_button_box(struct ABMainWindow *abmw)
     return box_widget;
 }
 
-
 static void
-bab_filter_entry_activate(GtkWidget *entry,
-                          GtkWidget *button)
+bab_filter_entry_activate(GtkWidget *entry, GtkWidget *button)
 {
     const gchar *filter = gtk_entry_get_text(GTK_ENTRY(entry));
     bab_set_address_book(contacts_app.address_book, contacts_app.entry_list,
@@ -981,16 +894,13 @@ bab_filter_entry_activate(GtkWidget *entry,
     gtk_widget_set_sensitive(button, FALSE);
 }
 
-
 static void
-bab_filter_entry_changed(GtkWidget *entry,
-                         GtkWidget *button)
+bab_filter_entry_changed(GtkWidget *entry, GtkWidget *button)
 {
     gtk_widget_set_sensitive(button, TRUE);
 }
 
-
-static GtkWidget *
+static GtkWidget*
 bab_get_filter_box(void)
 {
     GtkWidget *search_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
@@ -1012,31 +922,25 @@ bab_get_filter_box(void)
                              G_CALLBACK(bab_filter_entry_activate),
                              find_entry);
     g_signal_connect(G_OBJECT(find_entry), "changed",
-                     G_CALLBACK(bab_filter_entry_changed),
-                     button);
+                             G_CALLBACK(bab_filter_entry_changed),
+                             button);
     return search_hbox;
 }
-
-
 static gboolean
-ew_key_pressed(GtkEntry            *entry,
-               GdkEvent            *event,
-               struct ABMainWindow *abmw)
+ew_key_pressed(GtkEntry * entry, GdkEvent * event, struct ABMainWindow *abmw)
 {
     guint keyval;
 
-    if (!(gdk_event_get_keyval(event, &keyval) && (keyval == GDK_KEY_Escape))) {
-        return FALSE;
-    }
+    if (!(gdk_event_get_keyval(event, &keyval) && keyval == GDK_KEY_Escape))
+       return FALSE;
 
     gtk_button_clicked(GTK_BUTTON(abmw->cancel_button));
 
     return TRUE;
 }
 
-
-static GtkWidget *
-bab_window_new(GtkApplication *application)
+static GtkWidget*
+bab_window_new(GtkApplication * application)
 {
     GtkWidget *wnd;
     GtkWidget *main_vbox;
@@ -1065,7 +969,7 @@ bab_window_new(GtkApplication *application)
 
     scroll = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
-                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
     gtk_widget_set_hexpand(scroll, TRUE);
     gtk_box_pack_start(GTK_BOX(browse_widget), scroll);
 
@@ -1073,7 +977,7 @@ bab_window_new(GtkApplication *application)
     gtk_container_add(GTK_CONTAINER(scroll), contacts_app.entry_list);
 
     gtk_notebook_append_page(GTK_NOTEBOOK(contacts_app.notebook), browse_widget,
-                             gtk_label_new(_("Browse")));
+                            gtk_label_new(_("Browse")));
 
     edit_widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 1);
     contacts_app.edit_widget =
@@ -1084,31 +988,29 @@ bab_window_new(GtkApplication *application)
     gtk_box_pack_start(GTK_BOX(edit_widget), bab_get_edit_button_box(&contacts_app));
 
     gtk_notebook_append_page(GTK_NOTEBOOK(contacts_app.notebook), edit_widget,
-                             gtk_label_new(_("Edit")));
+                            gtk_label_new(_("Edit")));
 
     /*
-       g_signal_connect(G_OBJECT(find_entry), "changed",
-                     G_CALLBACK(balsa_ab_window_find), ab);
-     */
+    g_signal_connect(G_OBJECT(find_entry), "changed",
+                    G_CALLBACK(balsa_ab_window_find), ab);
+    */
     g_signal_connect(wnd, "key-press-event",
-                     G_CALLBACK(ew_key_pressed), &contacts_app);
+                    G_CALLBACK(ew_key_pressed), &contacts_app);
     gtk_window_set_default_size(GTK_WINDOW(wnd), 500, 400);
 
     gtk_widget_show(wnd);
     return wnd;
 }
 
-
 /* -------------------------- main --------------------------------- */
 static void
-ab_warning(const char *fmt,
-           ...)
+ab_warning(const char *fmt, ...)
 {
     GtkWidget *d;
     va_list va_args;
     char *msg;
     va_start(va_args, fmt);
-    msg = g_strdup_vprintf(fmt, va_args);
+    msg =  g_strdup_vprintf(fmt, va_args);
     va_end(va_args);
     d = gtk_message_dialog_new(contacts_app.window,
                                GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -1118,7 +1020,6 @@ ab_warning(const char *fmt,
     gtk_widget_destroy(d);
 }
 
-
 static void
 bab_init(void)
 {
@@ -1137,17 +1038,15 @@ bab_init(void)
     memset(&contacts_app, 0, sizeof(contacts_app));
 }
 
-
 static void
 information_real(void)
 {
     /* FIXME */
 }
 
-
 static void
-bab_set_intial_address_book(LibBalsaAddressBook *ab,
-                            GtkWidget           *window)
+bab_set_intial_address_book(LibBalsaAddressBook * ab,
+                            GtkWidget           * window)
 {
     GAction *action;
     const gchar *name;
@@ -1158,29 +1057,26 @@ bab_set_intial_address_book(LibBalsaAddressBook *ab,
     g_action_change_state(action, g_variant_new_string(name));
 }
 
-
 GtkDialogFlags
 libbalsa_dialog_flags(void)
 {
-    static GtkDialogFlags dialog_flags = GTK_DIALOG_USE_HEADER_BAR;
-    static gint check_done = 0;
-
-    if (g_atomic_int_get(&check_done) == 0) {
-        const gchar *dialog_env;
-
-        dialog_env = g_getenv("BALSA_DIALOG_HEADERBAR");
-        if ((dialog_env != NULL) && (atoi(dialog_env) == 0)) {
-            dialog_flags = (GtkDialogFlags) 0;
-        }
-        g_atomic_int_set(&check_done, 1);
-    }
-    return dialog_flags;
+       static GtkDialogFlags dialog_flags = GTK_DIALOG_USE_HEADER_BAR;
+       static gint check_done = 0;
+
+       if (g_atomic_int_get(&check_done) == 0) {
+               const gchar *dialog_env;
+
+               dialog_env = g_getenv("BALSA_DIALOG_HEADERBAR");
+               if ((dialog_env != NULL) && (atoi(dialog_env) == 0)) {
+                       dialog_flags = (GtkDialogFlags) 0;
+               }
+               g_atomic_int_set(&check_done, 1);
+       }
+       return dialog_flags;
 }
 
-
 int
-main(int   argc,
-     char *argv[])
+main(int argc, char *argv[])
 {
     GtkApplication *application;
     LibBalsaAddressBook *ab;
@@ -1189,9 +1085,8 @@ main(int   argc,
 
     application =
         gtk_application_new("org.desktop.BalsaAb", G_APPLICATION_FLAGS_NONE);
-    if (!g_application_register(G_APPLICATION(application), NULL, NULL)) {
+    if (!g_application_register(G_APPLICATION(application), NULL, NULL))
         g_message("Could not register address book editor");
-    }
     if (g_application_get_is_remote(G_APPLICATION(application))) {
         g_object_unref(application);
         return 1;
@@ -1234,11 +1129,9 @@ main(int   argc,
     gtk_main();
 
     /* Proper shutdown here */
-    for (l = contacts_app.address_book_list; l; l = l->next) {
-        if (l->data) {
+    for (l = contacts_app.address_book_list; l; l = l->next)
+        if (l->data)
             g_object_unref(l->data);
-        }
-    }
     g_list_free(contacts_app.address_book_list);
 
     return 0;
diff --git a/src/ab-window.c b/src/ab-window.c
index 6b4d3b7..071e143 100644
--- a/src/ab-window.c
+++ b/src/ab-window.c
@@ -18,7 +18,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "ab-window.h"
 
@@ -43,47 +43,45 @@ static void balsa_ab_window_class_init(BalsaAbWindowClass *klass);
 
 /* Loading ... */
 static void balsa_ab_window_load_cb(LibBalsaAddressBook *libbalsa_ab,
-                                    LibBalsaAddress     *address,
-                                    BalsaAbWindow       *ab);
+                                      LibBalsaAddress *address,
+                                      BalsaAbWindow *ab);
 static void balsa_ab_window_load(BalsaAbWindow *ab);
-static void balsa_ab_window_reload(GtkWidget     *w,
-                                   BalsaAbWindow *av);
+static void balsa_ab_window_reload(GtkWidget *w, BalsaAbWindow *av);
 
 /* Callbacks ... */
-static void balsa_ab_window_dist_mode_toggled(GtkWidget     *w,
-                                              BalsaAbWindow *ab);
-static void balsa_ab_window_menu_changed(GtkWidget     *widget,
-                                         BalsaAbWindow *ab);
-static void balsa_ab_window_run_editor(GtkWidget *widget,
-                                       gpointer   data);
-static void balsa_ab_window_response_cb(BalsaAbWindow *ab,
-                                        gint           resp);
-static void balsa_ab_window_find(GtkWidget     *group_entry,
-                                 BalsaAbWindow *ab);
+static void balsa_ab_window_dist_mode_toggled(GtkWidget * w,
+                                                BalsaAbWindow *ab);
+static void balsa_ab_window_menu_changed(GtkWidget * widget,
+                                           BalsaAbWindow *ab);
+static void balsa_ab_window_run_editor(GtkWidget * widget, gpointer data);
+static void balsa_ab_window_response_cb(BalsaAbWindow *ab, gint resp);
+static void balsa_ab_window_find(GtkWidget * group_entry,
+                                    BalsaAbWindow *ab);
 
 /* address and recipient list management ... */
-static void balsa_ab_window_swap_list_entry(GtkTreeView *src,
-                                            GtkTreeView *dst);
-static void balsa_ab_window_activate_address(GtkTreeView       *view,
-                                             GtkTreePath       *path,
-                                             GtkTreeViewColumn *column,
-                                             gpointer           data);
-static void balsa_ab_window_select_recipient(GtkTreeView       *view,
-                                             GtkTreePath       *path,
-                                             GtkTreeViewColumn *column,
-                                             gpointer           data);
-static void balsa_ab_window_move_to_recipient_list(GtkWidget     *widget,
-                                                   BalsaAbWindow *ab);
-static void balsa_ab_window_remove_from_recipient_list(GtkWidget     *widget,
-                                                       BalsaAbWindow *ab);
+static void balsa_ab_window_swap_list_entry(GtkTreeView * src,
+                                               GtkTreeView * dst);
+static void balsa_ab_window_activate_address(GtkTreeView * view,
+                                                GtkTreePath * path,
+                                                GtkTreeViewColumn * column,
+                                                gpointer data);
+static void balsa_ab_window_select_recipient(GtkTreeView * view,
+                                                GtkTreePath * path,
+                                                GtkTreeViewColumn * column,
+                                                gpointer data);
+static void balsa_ab_window_move_to_recipient_list(GtkWidget *widget,
+                                                     BalsaAbWindow *ab);
+static void balsa_ab_window_remove_from_recipient_list(GtkWidget *widget,
+                                                         BalsaAbWindow *ab);
 
 /* Utility ... */
-static gint balsa_ab_window_compare_entries(GtkTreeModel *model,
-                                            GtkTreeIter  *iter1,
-                                            GtkTreeIter  *iter2,
-                                            gpointer      data);
+static gint balsa_ab_window_compare_entries(GtkTreeModel * model,
+                                               GtkTreeIter * iter1,
+                                               GtkTreeIter * iter2,
+                                               gpointer data);
 
-struct _BalsaAbWindowClass {
+struct _BalsaAbWindowClass
+{
     GtkDialogClass parent_class;
 };
 
@@ -93,17 +91,17 @@ balsa_ab_window_get_type(void)
     static GType ab_type = 0;
 
     if ( !ab_type ) {
-        static const GTypeInfo ab_info = {
-            sizeof(BalsaAbWindowClass),
+       static const GTypeInfo ab_info = {
+           sizeof(BalsaAbWindowClass),
             NULL,               /* base_init */
             NULL,               /* base_finalize */
-            (GClassInitFunc) balsa_ab_window_class_init,
+           (GClassInitFunc) balsa_ab_window_class_init,
             NULL,               /* class_finalize */
             NULL,               /* class_data */
-            sizeof(BalsaAbWindow),
+           sizeof(BalsaAbWindow),
             0,                  /* n_preallocs */
-            (GInstanceInitFunc) balsa_ab_window_init
-        };
+           (GInstanceInitFunc) balsa_ab_window_init
+       };
         ab_type =
             g_type_register_static(GTK_TYPE_DIALOG, "BalsaAbWindow",
                                    &ab_info, 0);
@@ -113,19 +111,18 @@ balsa_ab_window_get_type(void)
 
 
 GtkWidget *
-balsa_ab_window_new(gboolean   composing,
-                    GtkWindow *parent)
+balsa_ab_window_new(gboolean composing, GtkWindow* parent)
 {
     GtkWidget *ret;
     BalsaAbWindow *ab;
     gint use_headerbar = 1;
-    const gchar *dialog_env;
+       const gchar *dialog_env;
 
     /* header bar configuration */
-    dialog_env = g_getenv("BALSA_DIALOG_HEADERBAR");
-    if ((dialog_env != NULL) && (atoi(dialog_env) == 0)) {
-        use_headerbar = 0;
-    }
+       dialog_env = g_getenv("BALSA_DIALOG_HEADERBAR");
+       if ((dialog_env != NULL) && (atoi(dialog_env) == 0)) {
+               use_headerbar = 0;
+       }
 
     ret = g_object_new(BALSA_TYPE_AB_WINDOW,
                        "use-header-bar", use_headerbar,
@@ -137,29 +134,27 @@ balsa_ab_window_new(gboolean   composing,
     ab->composing = composing;
 
     if ( composing ) {
-        gtk_dialog_add_buttons(GTK_DIALOG(ret),
-                               _("_OK"), GTK_RESPONSE_OK,
+       gtk_dialog_add_buttons(GTK_DIALOG(ret),
+                               _("_OK"),     GTK_RESPONSE_OK,
                                _("_Cancel"), GTK_RESPONSE_CANCEL,
                                NULL);
-        gtk_widget_show(ab->send_to_label);
-        gtk_widget_show(ab->send_to_list);
-        gtk_widget_show(ab->arrow_box);
+       gtk_widget_show(ab->send_to_label);
+       gtk_widget_show(ab->send_to_list);
+       gtk_widget_show(ab->arrow_box);
     } else {
-        gtk_dialog_add_buttons(GTK_DIALOG(ret),
+       gtk_dialog_add_buttons(GTK_DIALOG(ret),
                                _("_Close"), GTK_RESPONSE_CLOSE,
                                NULL);
-        gtk_widget_hide(ab->send_to_label);
-        gtk_widget_hide(ab->send_to_list);
-        gtk_widget_hide(ab->arrow_box);
+       gtk_widget_hide(ab->send_to_label);
+       gtk_widget_hide(ab->send_to_list);
+       gtk_widget_hide(ab->arrow_box);
     }
 
     return ret;
 }
 
-
 static GtkWidget *
-balsa_ab_window_list(BalsaAbWindow *ab,
-                     GCallback      row_activated_cb)
+balsa_ab_window_list(BalsaAbWindow * ab, GCallback row_activated_cb)
 {
     GtkListStore *store;
     GtkWidget *tree;
@@ -207,9 +202,8 @@ balsa_ab_window_list(BalsaAbWindow *ab,
     return tree;
 }
 
-
 static void
-balsa_ab_window_load_books(BalsaAbWindow *ab)
+balsa_ab_window_load_books(BalsaAbWindow * ab)
 {
     GList *ab_list;
     guint offset;
@@ -219,28 +213,25 @@ balsa_ab_window_load_books(BalsaAbWindow *ab)
         LibBalsaAddressBook *address_book = ab_list->data;
 
         gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ab->combo_box),
-                                       libbalsa_address_book_get_name(address_book));
+                                  libbalsa_address_book_get_name(address_book));
 
-        if (ab->current_address_book == NULL) {
+        if (ab->current_address_book == NULL)
             ab->current_address_book = address_book;
-        }
-        if (address_book == ab->current_address_book) {
+        if (address_book == ab->current_address_book)
             gtk_combo_box_set_active(GTK_COMBO_BOX(ab->combo_box), offset);
-        }
     }
 }
 
-
 static void
 balsa_ab_window_init(BalsaAbWindow *ab)
 {
     GtkWidget *find_label,
-              *w,
-              *grid,
-              *hbox,
-              *box2,
-              *scrolled_window,
-              *frame;
+       *w,
+       *grid,
+       *hbox,
+       *box2,
+       *scrolled_window,
+       *frame;
     GtkBox *vbox;
     GtkWidget *label;
 
@@ -250,7 +241,7 @@ balsa_ab_window_init(BalsaAbWindow *ab)
     gtk_window_set_title(GTK_WINDOW(ab), _("Address Book"));
 
     g_signal_connect(G_OBJECT(ab), "response",
-                     G_CALLBACK(balsa_ab_window_response_cb), NULL);
+                    G_CALLBACK(balsa_ab_window_response_cb), NULL);
 
     vbox = (GtkBox *) gtk_dialog_get_content_area(GTK_DIALOG(ab));
 
@@ -264,14 +255,14 @@ balsa_ab_window_init(BalsaAbWindow *ab)
     /* The main address list */
     ab->address_list =
         balsa_ab_window_list(ab,
-                             G_CALLBACK
-                                 (balsa_ab_window_activate_address));
+                                G_CALLBACK
+                                (balsa_ab_window_activate_address));
 
     /* The clist for selected addresses in compose mode */
     ab->recipient_list =
         balsa_ab_window_list(ab,
-                             G_CALLBACK
-                                 (balsa_ab_window_select_recipient));
+                                G_CALLBACK
+                                (balsa_ab_window_select_recipient));
 
     /* The address book selection menu */
     ab->combo_box = gtk_combo_box_text_new();
@@ -282,10 +273,9 @@ balsa_ab_window_init(BalsaAbWindow *ab)
 
     g_signal_connect(ab->combo_box, "changed",
                      G_CALLBACK(balsa_ab_window_menu_changed), ab);
-    if (balsa_app.address_book_list->next) {
-        /* More than one address book. */
-        gtk_widget_show(ab->combo_box);
-    }
+    if (balsa_app.address_book_list->next)
+       /* More than one address book. */
+       gtk_widget_show(ab->combo_box);
 
     gtk_box_pack_start(vbox, ab->combo_box);
 
@@ -303,7 +293,7 @@ balsa_ab_window_init(BalsaAbWindow *ab)
     ab->filter_entry = gtk_entry_new();
     gtk_label_set_mnemonic_widget(GTK_LABEL(find_label), ab->filter_entry);
     g_signal_connect(G_OBJECT(ab->filter_entry), "changed",
-                     G_CALLBACK(balsa_ab_window_find), ab);
+                    G_CALLBACK(balsa_ab_window_find), ab);
 
     /* Pack the find stuff into the grid */
     box2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
@@ -318,8 +308,8 @@ balsa_ab_window_init(BalsaAbWindow *ab)
     gtk_widget_set_vexpand(scrolled_window, TRUE);
     gtk_widget_set_hexpand(scrolled_window, TRUE);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
-                                   GTK_POLICY_AUTOMATIC,
-                                   GTK_POLICY_AUTOMATIC);
+                                  GTK_POLICY_AUTOMATIC,
+                                  GTK_POLICY_AUTOMATIC);
     gtk_widget_set_vexpand(scrolled_window, TRUE);
     gtk_grid_attach(GTK_GRID(grid), scrolled_window, 0, 1, 1, 1);
     gtk_container_add(GTK_CONTAINER(scrolled_window), ab->address_list);
@@ -339,7 +329,7 @@ balsa_ab_window_init(BalsaAbWindow *ab)
     w = gtk_button_new_with_mnemonic(_("_Re-import"));
     g_signal_connect(G_OBJECT(w), "clicked",
                      G_CALLBACK(balsa_ab_window_reload),
-                     ab);
+                      ab);
     gtk_box_pack_start(GTK_BOX(hbox), w);
 
     balsa_ab_window_load(ab);
@@ -355,15 +345,15 @@ balsa_ab_window_init(BalsaAbWindow *ab)
     gtk_widget_set_hexpand(w, TRUE);
     gtk_box_pack_start(GTK_BOX(ab->arrow_box), w);
     g_signal_connect(G_OBJECT(w), "clicked",
-                     G_CALLBACK(balsa_ab_window_move_to_recipient_list),
-                     ab);
+                    G_CALLBACK(balsa_ab_window_move_to_recipient_list),
+                      ab);
 
     w = gtk_button_new_from_icon_name("go-previous-symbolic");
     gtk_widget_set_hexpand(w, TRUE);
     gtk_box_pack_start(GTK_BOX(ab->arrow_box), w);
     g_signal_connect(G_OBJECT(w), "clicked",
-                     G_CALLBACK(balsa_ab_window_remove_from_recipient_list),
-                     ab);
+                    G_CALLBACK(balsa_ab_window_remove_from_recipient_list),
+                      ab);
 
     /* -- grid column 3 -- */
     /* label for selected addresses in compose mode */
@@ -375,7 +365,7 @@ balsa_ab_window_init(BalsaAbWindow *ab)
     gtk_widget_set_vexpand(ab->send_to_list, TRUE);
     gtk_widget_set_hexpand(ab->send_to_list, TRUE);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ab->send_to_list),
-                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
     gtk_grid_attach(GTK_GRID(grid), ab->send_to_list, 2, 1, 1, 1);
     gtk_container_add(GTK_CONTAINER(ab->send_to_list), ab->recipient_list);
     gtk_widget_set_size_request(ab->send_to_list, 300, 250);
@@ -384,13 +374,13 @@ balsa_ab_window_init(BalsaAbWindow *ab)
     frame = gtk_frame_new(_("Treat multiple addresses as:"));
 
     ab->single_address_mode_radio = gtk_radio_button_new_with_label
-            (NULL, _("alternative addresses for the same person"));
+       (NULL, _("alternative addresses for the same person"));
     label = gtk_bin_get_child(GTK_BIN(ab->single_address_mode_radio));
     gtk_label_set_xalign((GtkLabel *) label, 0.0);
 
     ab->dist_address_mode_radio = gtk_radio_button_new_with_label_from_widget
-            (GTK_RADIO_BUTTON(ab->single_address_mode_radio),
-            _("a distribution list"));
+       (GTK_RADIO_BUTTON(ab->single_address_mode_radio),
+        _("a distribution list"));
     label = gtk_bin_get_child(GTK_BIN(ab->dist_address_mode_radio));
     gtk_label_set_xalign((GtkLabel *) label, 0.0);
     ab->toggle_handler_id =
@@ -399,11 +389,10 @@ balsa_ab_window_init(BalsaAbWindow *ab)
                          G_CALLBACK(balsa_ab_window_dist_mode_toggled),
                          ab);
 
-    if (ab->current_address_book) {
-        gtk_toggle_button_set_active(
-            GTK_TOGGLE_BUTTON(ab->dist_address_mode_radio),
-            libbalsa_address_book_get_dist_list_mode(ab->current_address_book));
-    }
+    if(ab->current_address_book)
+       gtk_toggle_button_set_active(
+           GTK_TOGGLE_BUTTON(ab->dist_address_mode_radio),
+           libbalsa_address_book_get_dist_list_mode(ab->current_address_book));
 
     /* Pack them into a box  */
     box2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
@@ -416,40 +405,33 @@ balsa_ab_window_init(BalsaAbWindow *ab)
     gtk_widget_grab_focus(ab->filter_entry);
 }
 
-
 static void
 balsa_ab_window_class_init(BalsaAbWindowClass *klass)
 {
 }
 
-
 /*
-   Runs gnome card
- */
+  Runs gnome card
+*/
 static void
-balsa_ab_window_run_editor(GtkWidget *widget,
-                           gpointer   data)
+balsa_ab_window_run_editor(GtkWidget * widget, gpointer data)
 {
-    char *argv[] = {
-        "balsa-ab", NULL
-    };
-    GError *err = NULL;
+    char *argv[] = { "balsa-ab", NULL };
+    GError * err = NULL;
 
     if (!g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH,
-                       NULL, NULL, NULL, &err)) {
+                       NULL, NULL, NULL, &err))
         balsa_information(LIBBALSA_INFORMATION_WARNING,
                           _("Could not launch %s: %s"), argv[0],
                           err ? err->message : "Unknown error");
-    }
     g_clear_error(&err);
 }
 
-
 /*
-   Returns a string of all the selected recipients.
+  Returns a string of all the selected recipients.
  */
 gchar *
-balsa_ab_window_get_recipients(BalsaAbWindow *ab)
+balsa_ab_window_get_recipients(BalsaAbWindow * ab)
 {
     GtkTreeModel *model;
     GtkTreeIter iter;
@@ -469,11 +451,10 @@ balsa_ab_window_get_recipients(BalsaAbWindow *ab)
                            LIST_COLUMN_ADDRESS, &address,
                            LIST_COLUMN_WHICH, &which_multiple, -1);
         text = libbalsa_address_to_gchar(address, which_multiple);
-        g_object_unref(G_OBJECT(address));
+       g_object_unref(G_OBJECT(address));
         if (text) {
-            if (str->len > 0) {
+            if (str->len > 0)
                 g_string_append(str, ", ");
-            }
             g_string_append(str, text);
             g_free(text);
         }
@@ -484,13 +465,12 @@ balsa_ab_window_get_recipients(BalsaAbWindow *ab)
     return text;
 }
 
-
 /*
-   Moves an entry between two CLists.
- */
+  Moves an entry between two CLists.
+*/
 /*
-   FIXME: Need to only move it back if it belongs in current address book??
- */
+  FIXME: Need to only move it back if it belongs in current address book??
+*/
 /*
  * balsa_ab_window_swap_list_entry is the method.
  *
@@ -499,10 +479,10 @@ balsa_ab_window_get_recipients(BalsaAbWindow *ab)
  */
 
 static void
-balsa_ab_window_swap_make_gslist(GtkTreeModel *model,
-                                 GtkTreePath  *path,
-                                 GtkTreeIter  *iter,
-                                 gpointer      data)
+balsa_ab_window_swap_make_gslist(GtkTreeModel * model,
+                                    GtkTreePath * path,
+                                    GtkTreeIter * iter,
+                                    gpointer data)
 {
     GtkTreeRowReference *reference =
         gtk_tree_row_reference_new(model, path);
@@ -511,11 +491,9 @@ balsa_ab_window_swap_make_gslist(GtkTreeModel *model,
     *selected = g_slist_prepend(*selected, reference);
 }
 
-
 static void
-balsa_ab_window_swap_real(GtkTreeModel *model,
-                          GtkTreePath  *path,
-                          GtkTreeModel *dst_model)
+balsa_ab_window_swap_real(GtkTreeModel * model, GtkTreePath * path,
+                             GtkTreeModel * dst_model)
 {
     GtkTreeIter iter;
     GtkTreeIter dst_iter;
@@ -547,11 +525,9 @@ balsa_ab_window_swap_real(GtkTreeModel *model,
     g_free(address_string);
 }
 
-
 #define BALSA_TREE_VIEW "balsa-tree-view"
 static void
-balsa_ab_window_swap_do_swap(gpointer data,
-                             gpointer user_data)
+balsa_ab_window_swap_do_swap(gpointer data, gpointer user_data)
 {
     GtkTreeRowReference *reference = data;
     GtkTreePath *path = gtk_tree_row_reference_get_path(reference);
@@ -569,10 +545,8 @@ balsa_ab_window_swap_do_swap(gpointer data,
     gtk_tree_row_reference_free(reference);
 }
 
-
 static void
-balsa_ab_window_swap_list_entry(GtkTreeView *src,
-                                GtkTreeView *dst)
+balsa_ab_window_swap_list_entry(GtkTreeView * src, GtkTreeView * dst)
 {
     GtkTreeSelection *selection;
     GSList *selected;
@@ -589,19 +563,18 @@ balsa_ab_window_swap_list_entry(GtkTreeView *src,
     g_slist_foreach(selected, balsa_ab_window_swap_do_swap, dst);
 }
 
-
 /*
-   Handle a click on the main address list
+  Handle a click on the main address list
 
-   If composing then move the address to the other clist, otherwise
-   open a compose window.
+  If composing then move the address to the other clist, otherwise
+  open a compose window.
 
- */
+*/
 static void
-balsa_ab_window_activate_address(GtkTreeView       *view,
-                                 GtkTreePath       *path,
-                                 GtkTreeViewColumn *column,
-                                 gpointer           data)
+balsa_ab_window_activate_address(GtkTreeView * view,
+                                    GtkTreePath * path,
+                                    GtkTreeViewColumn * column,
+                                    gpointer data)
 {
     BalsaAbWindow *ab = data;
 
@@ -609,8 +582,8 @@ balsa_ab_window_activate_address(GtkTreeView       *view,
 
     if (ab->composing) {
         balsa_ab_window_swap_list_entry(GTK_TREE_VIEW(ab->address_list),
-                                        GTK_TREE_VIEW(ab->
-                                                      recipient_list));
+                                           GTK_TREE_VIEW(ab->
+                                                         recipient_list));
     } else {
         BalsaSendmsg *snd;
         GtkTreeModel *model =
@@ -625,7 +598,7 @@ balsa_ab_window_activate_address(GtkTreeView       *view,
                            LIST_COLUMN_ADDRESS, &address,
                            LIST_COLUMN_WHICH, &which_multiple, -1);
         addr = libbalsa_address_to_gchar(address, which_multiple);
-        g_object_unref(G_OBJECT(address));
+       g_object_unref(G_OBJECT(address));
         snd = sendmsg_window_compose_with_address(addr);
         g_free(addr);
 
@@ -633,69 +606,61 @@ balsa_ab_window_activate_address(GtkTreeView       *view,
     }
 }
 
-
 /*
-   Handle a click on the recipient list.
+  Handle a click on the recipient list.
 
-   Only sane if composing. Move to address list.
+  Only sane if composing. Move to address list.
  */
 static void
-balsa_ab_window_select_recipient(GtkTreeView       *view,
-                                 GtkTreePath       *path,
-                                 GtkTreeViewColumn *column,
-                                 gpointer           data)
+balsa_ab_window_select_recipient(GtkTreeView * view,
+                                    GtkTreePath * path,
+                                    GtkTreeViewColumn * column,
+                                    gpointer data)
 {
     BalsaAbWindow *ab = data;
 
-    g_return_if_fail( BALSA_IS_AB_WINDOW(ab));
+    g_return_if_fail( BALSA_IS_AB_WINDOW(ab) );
     g_return_if_fail( ab->composing );
 
     balsa_ab_window_swap_list_entry(GTK_TREE_VIEW(ab->recipient_list),
-                                    GTK_TREE_VIEW(ab->address_list));
+                                       GTK_TREE_VIEW(ab->address_list));
 }
 
-
 /*
-   Handle a click on forward button
- */
+  Handle a click on forward button
+*/
 static void
-balsa_ab_window_move_to_recipient_list(GtkWidget     *widget,
-                                       BalsaAbWindow *ab)
+balsa_ab_window_move_to_recipient_list(GtkWidget *widget, BalsaAbWindow *ab)
 {
-    g_return_if_fail( BALSA_IS_AB_WINDOW(ab));
+    g_return_if_fail( BALSA_IS_AB_WINDOW(ab) );
     g_return_if_fail( ab->composing );
 
     balsa_ab_window_swap_list_entry(GTK_TREE_VIEW(ab->address_list),
-                                    GTK_TREE_VIEW(ab->recipient_list));
+                                      GTK_TREE_VIEW(ab->recipient_list));
 }
 
-
 /*
-   Handle a click on the back button
+  Handle a click on the back button
  */
 static void
-balsa_ab_window_remove_from_recipient_list(GtkWidget     *widget,
-                                           BalsaAbWindow *ab)
+balsa_ab_window_remove_from_recipient_list(GtkWidget *widget, BalsaAbWindow *ab)
 {
-    g_return_if_fail( BALSA_IS_AB_WINDOW(ab));
+    g_return_if_fail( BALSA_IS_AB_WINDOW(ab) );
     g_return_if_fail( ab->composing );
 
     balsa_ab_window_swap_list_entry(GTK_TREE_VIEW(ab->recipient_list),
-                                    GTK_TREE_VIEW(ab->address_list));
+                                      GTK_TREE_VIEW(ab->address_list));
 }
 
-
 /*
-   Handle a click on the reload button.
+  Handle a click on the reload button.
  */
 static void
-balsa_ab_window_reload(GtkWidget     *w,
-                       BalsaAbWindow *ab)
+balsa_ab_window_reload(GtkWidget *w, BalsaAbWindow *ab)
 {
     balsa_ab_window_load(ab);
 }
 
-
 /*
  * Load the current addressbook.
  */
@@ -706,27 +671,23 @@ balsa_ab_window_set_title(BalsaAbWindow *ab)
     const gchar *type = "";
     gchar *title;
 
-    if (LIBBALSA_IS_ADDRESS_BOOK_VCARD(address_book)) {
+    if (LIBBALSA_IS_ADDRESS_BOOK_VCARD(address_book))
         type = "vCard";
-    } else if (LIBBALSA_IS_ADDRESS_BOOK_EXTERN(address_book)) {
+    else if (LIBBALSA_IS_ADDRESS_BOOK_EXTERN(address_book))
         type = "External query";
-    } else if (LIBBALSA_IS_ADDRESS_BOOK_LDIF(address_book)) {
+    else if (LIBBALSA_IS_ADDRESS_BOOK_LDIF(address_book))
         type = "LDIF";
-    }
 #if ENABLE_LDAP
-    else if (LIBBALSA_IS_ADDRESS_BOOK_LDAP(address_book)) {
+    else if (LIBBALSA_IS_ADDRESS_BOOK_LDAP(address_book))
         type = "LDAP";
-    }
 #endif
 #if HAVE_SQLITE
-    else if (LIBBALSA_IS_ADDRESS_BOOK_GPE(address_book)) {
+    else if (LIBBALSA_IS_ADDRESS_BOOK_GPE(address_book))
         type = "GPE";
-    }
 #endif
 #if HAVE_RUBRICA
-    else if (LIBBALSA_IS_ADDRESS_BOOK_RUBRICA(address_book)) {
+    else if (LIBBALSA_IS_ADDRESS_BOOK_RUBRICA(address_book))
         type = "Rubrica";
-    }
 #endif
 
     title =
@@ -736,7 +697,6 @@ balsa_ab_window_set_title(BalsaAbWindow *ab)
     g_free(title);
 }
 
-
 static void
 balsa_ab_window_load(BalsaAbWindow *ab)
 {
@@ -748,38 +708,35 @@ balsa_ab_window_load(BalsaAbWindow *ab)
     model = gtk_tree_view_get_model(GTK_TREE_VIEW(ab->address_list));
     gtk_list_store_clear(GTK_LIST_STORE(model));
 
-    if (ab->current_address_book == NULL) {
-        return;
-    }
+    if (ab->current_address_book == NULL)
+       return;
 
     filter = gtk_entry_get_text(GTK_ENTRY(ab->filter_entry));
     err = libbalsa_address_book_load(ab->current_address_book, filter,
                                      (LibBalsaAddressBookLoadFunc)
                                      balsa_ab_window_load_cb, ab);
-    if ((err != LBABERR_OK) && (err != LBABERR_CANNOT_READ)) {
-        const gchar *name =
+    if (err != LBABERR_OK && err != LBABERR_CANNOT_READ) {
+       const gchar *name =
             libbalsa_address_book_get_name(ab->current_address_book);
-        const gchar *desc =
-            libbalsa_address_book_strerror(ab->current_address_book, err);
+       const gchar *desc =
+           libbalsa_address_book_strerror(ab->current_address_book, err);
         balsa_information_parented(GTK_WINDOW(ab),
-                                   LIBBALSA_INFORMATION_ERROR,
-                                   _("Error opening address book “%s”:\n%s"),
-                                   name, desc);
+                                  LIBBALSA_INFORMATION_ERROR,
+                                  _("Error opening address book “%s”:\n%s"),
+                                  name, desc);
     }
     balsa_ab_window_set_title(ab);
 }
 
-
 /*
-   The address load callback. Adds a single address to the address list.
+  The address load callback. Adds a single address to the address list.
 
-   If the current address book is in dist list mode then create a
-   single entry, or else create an entry for each address in the book.
+  If the current address book is in dist list mode then create a
+  single entry, or else create an entry for each address in the book.
  */
 static void
 balsa_ab_window_load_cb(LibBalsaAddressBook *libbalsa_ab,
-                        LibBalsaAddress     *address,
-                        BalsaAbWindow       *ab)
+                        LibBalsaAddress *address, BalsaAbWindow *ab)
 {
     GtkTreeModel *model;
     GtkTreeIter iter;
@@ -788,18 +745,17 @@ balsa_ab_window_load_cb(LibBalsaAddressBook *libbalsa_ab,
     const gchar *full_name;
 
     g_return_if_fail ( BALSA_IS_AB_WINDOW(ab));
-    g_return_if_fail ( LIBBALSA_IS_ADDRESS_BOOK(libbalsa_ab));
+    g_return_if_fail ( LIBBALSA_IS_ADDRESS_BOOK(libbalsa_ab) );
 
-    if ( address == NULL ) {
-        return;
-    }
+    if ( address == NULL )
+       return;
 
     full_name = libbalsa_address_get_full_name(address);
     model = gtk_tree_view_get_model(GTK_TREE_VIEW(ab->address_list));
 
     addr_list = libbalsa_address_get_addr_list(address);
     if (libbalsa_address_book_get_dist_list_mode(libbalsa_ab)
-        && (addr_list != NULL) && (addr_list->next != NULL)) {
+        && addr_list != NULL && addr_list->next != NULL) {
         gchar *address_string = libbalsa_address_to_gchar(address, -1);
 
         gtk_list_store_prepend(GTK_LIST_STORE(model), &iter);
@@ -811,10 +767,10 @@ balsa_ab_window_load_cb(LibBalsaAddressBook *libbalsa_ab,
                            LIST_COLUMN_WHICH, -1,
                            -1);
 
-        g_free(address_string);
+       g_free(address_string);
     } else {
-        count = 0;
-        while (addr_list) {
+       count = 0;
+       while (addr_list) {
             gtk_list_store_prepend(GTK_LIST_STORE(model), &iter);
             /* GtkListStore refs address once for each address in
              * the list, and unrefs it the same number of times when
@@ -827,20 +783,18 @@ balsa_ab_window_load_cb(LibBalsaAddressBook *libbalsa_ab,
                                LIST_COLUMN_WHICH, count,
                                -1);
 
-            addr_list = addr_list->next;
-            count++;
-        }
+           addr_list = addr_list->next;
+           count++;
+       }
     }
 }
 
-
 /*
-   Search for an address in the address list.
-   Attached to the changed signal of the find entry.
- */
+  Search for an address in the address list.
+  Attached to the changed signal of the find entry.
+*/
 static void
-balsa_ab_window_find(GtkWidget     *group_entry,
-                     BalsaAbWindow *ab)
+balsa_ab_window_find(GtkWidget * group_entry, BalsaAbWindow * ab)
 {
     const gchar *entry_text;
     GtkTreeSelection *selection;
@@ -854,9 +808,8 @@ balsa_ab_window_find(GtkWidget     *group_entry,
 
     entry_text = gtk_entry_get_text(GTK_ENTRY(group_entry));
 
-    if (*entry_text == '\0') {
+    if (*entry_text == '\0')
         return;
-    }
 
     tree_view = GTK_TREE_VIEW(ab->address_list);
     selection = gtk_tree_view_get_selection(tree_view);
@@ -888,69 +841,61 @@ balsa_ab_window_find(GtkWidget     *group_entry,
     }
 }
 
-
 /*
-   Handle a change in the dist mode
- */
+  Handle a change in the dist mode
+*/
 static void
-balsa_ab_window_dist_mode_toggled(GtkWidget     *w,
-                                  BalsaAbWindow *ab)
+balsa_ab_window_dist_mode_toggled(GtkWidget * w, BalsaAbWindow *ab)
 {
     gboolean active;
 
     g_return_if_fail(BALSA_IS_AB_WINDOW(ab));
-    if (ab->current_address_book == NULL) {
-        return;
-    }
+    if(ab->current_address_book == NULL) return;
 
     active = gtk_toggle_button_get_active
-            (GTK_TOGGLE_BUTTON(ab->single_address_mode_radio));
+       (GTK_TOGGLE_BUTTON(ab->single_address_mode_radio));
 
     libbalsa_address_book_set_dist_list_mode(ab->current_address_book, !active);
 
     balsa_ab_window_load(ab);
 }
 
-
 /*
-   Handle a change in the current address book.
- */
+  Handle a change in the current address book.
+*/
 static void
-balsa_ab_window_menu_changed(GtkWidget     *widget,
-                             BalsaAbWindow *ab)
+balsa_ab_window_menu_changed(GtkWidget * widget, BalsaAbWindow *ab)
 {
     LibBalsaAddressBook *addr;
     int active = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
     addr = LIBBALSA_ADDRESS_BOOK(g_list_nth_data
-                                     (balsa_app.address_book_list, active));
+                                 (balsa_app.address_book_list, active));
     g_assert(addr != NULL);
 
     ab->current_address_book = addr;
 
     g_signal_handler_block(G_OBJECT(ab->single_address_mode_radio),
-                           ab->toggle_handler_id);
-    if (libbalsa_address_book_get_dist_list_mode(ab->current_address_book)) {
-        gtk_toggle_button_set_active(
-            GTK_TOGGLE_BUTTON(ab->dist_address_mode_radio), TRUE);
-    } else {
-        gtk_toggle_button_set_active(
-            GTK_TOGGLE_BUTTON(ab->single_address_mode_radio), TRUE);
-    }
+                          ab->toggle_handler_id);
+    if (libbalsa_address_book_get_dist_list_mode(ab->current_address_book))
+       gtk_toggle_button_set_active(
+           GTK_TOGGLE_BUTTON(ab->dist_address_mode_radio), TRUE);
+    else
+       gtk_toggle_button_set_active(
+           GTK_TOGGLE_BUTTON(ab->single_address_mode_radio), TRUE);
     g_signal_handler_unblock(G_OBJECT(ab->single_address_mode_radio),
-                             ab->toggle_handler_id);
+                            ab->toggle_handler_id);
 
     balsa_ab_window_load(ab);
 }
 
-
 /*
-   Compare two rows in a clist.
- */
+  Compare two rows in a clist.
+*/
 static gint
-balsa_ab_window_compare_entries(GtkTreeModel *model,
-                                GtkTreeIter  *iter1,
-                                GtkTreeIter  *iter2,
-                                gpointer      data)
+balsa_ab_window_compare_entries(GtkTreeModel * model,
+                                   GtkTreeIter * iter1,
+                                   GtkTreeIter * iter2,
+                                   gpointer data)
 {
     gchar *c1 = NULL;
     gchar *c2 = NULL;
@@ -958,31 +903,27 @@ balsa_ab_window_compare_entries(GtkTreeModel *model,
     gtk_tree_model_get(model, iter1, LIST_COLUMN_NAME, &c1, -1);
     gtk_tree_model_get(model, iter2, LIST_COLUMN_NAME, &c2, -1);
 
-    if ((c1 == NULL) || (c2 == NULL)) {
-        return 0;
-    }
+    if (c1 == NULL || c2 == NULL)
+       return 0;
 
     return g_ascii_strcasecmp(c1, c2);
 }
 
-
 /* balsa_ab_window_response_cb:
    Normally, we should not destroy the window in the response callback.
    This time, we can make an exception - nobody is waiting for the result
    anyway.
- */
+*/
 static void
-balsa_ab_window_response_cb(BalsaAbWindow *ab,
-                            gint           response)
+balsa_ab_window_response_cb(BalsaAbWindow *ab, gint response)
 {
-    switch (response) {
+    switch(response) {
     case GTK_RESPONSE_CLOSE:
-        if ( !ab->composing ) {
+        if ( !ab->composing )
             gtk_widget_destroy(GTK_WIDGET(ab));
-        }
         break;
-
     default: /* nothing */
-        break;
+       break;
     }
 }
+
diff --git a/src/ab-window.h b/src/ab-window.h
index c14a9f7..a9ec989 100644
--- a/src/ab-window.h
+++ b/src/ab-window.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -24,21 +24,17 @@
 #include <libbalsa.h>
 
 #define BALSA_TYPE_AB_WINDOW            (balsa_ab_window_get_type ())
-#define BALSA_AB_WINDOW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                                                                     BALSA_TYPE_AB_WINDOW, \
-                                                                     BalsaAbWindow))
-#define BALSA_AB_WINDOW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), BALSA_TYPE_AB_WINDOW, \
-                                                                  BalsaAbWindowClass))
-#define BALSA_IS_AB_WINDOW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                                                                     BALSA_TYPE_AB_WINDOW))
-#define BALSA_IS_AB_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-                                                                  BALSA_TYPE_AB_WINDOW))
+#define BALSA_AB_WINDOW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), BALSA_TYPE_AB_WINDOW, 
BalsaAbWindow))
+#define BALSA_AB_WINDOW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), BALSA_TYPE_AB_WINDOW, 
BalsaAbWindowClass))
+#define BALSA_IS_AB_WINDOW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BALSA_TYPE_AB_WINDOW))
+#define BALSA_IS_AB_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BALSA_TYPE_AB_WINDOW))
 
 
 typedef struct _BalsaAbWindow BalsaAbWindow;
 typedef struct _BalsaAbWindowClass BalsaAbWindowClass;
 
-struct _BalsaAbWindow {
+struct _BalsaAbWindow 
+{
     GtkDialog parent;
 
     /* Are we composing? */
@@ -59,7 +55,7 @@ struct _BalsaAbWindow {
     /* Radio buttons for dist list mode */
     GtkWidget *single_address_mode_radio;
     GtkWidget *dist_address_mode_radio;
-    guint toggle_handler_id;
+    guint      toggle_handler_id;
 
     /* Stuff to hide when not in compose mode */
     GtkWidget *send_to_label;
@@ -71,10 +67,9 @@ struct _BalsaAbWindow {
 };
 
 GType balsa_ab_window_get_type(void);
-GtkWidget *balsa_ab_window_new(gboolean   composing,
-                               GtkWindow *parent);
+GtkWidget *balsa_ab_window_new(gboolean composing, GtkWindow* parent);
 
 gchar *balsa_ab_window_get_recipients(BalsaAbWindow *ab);
 
 
-#endif                          /* __ADDRESS_BOOK_H__ */
+#endif                         /* __ADDRESS_BOOK_H__ */
diff --git a/src/address-book-config.c b/src/address-book-config.c
index 127f283..e771c2f 100644
--- a/src/address-book-config.c
+++ b/src/address-book-config.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "address-book-config.h"
 
@@ -28,7 +28,7 @@
 #include <glib/gi18n.h>
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#  include "macosx-helpers.h"
 #endif
 
 typedef struct _AddressBookConfig AddressBookConfig;
@@ -43,75 +43,68 @@ struct _AddressBookConfig {
     GType type;
 
     union {
-        struct {
-            GtkWidget *load;
-            GtkWidget *save;
-        } externq;
-
+       struct {
+               GtkWidget *load;
+               GtkWidget *save;
+       } externq;
+       
 #ifdef ENABLE_LDAP
-        struct {
-            GtkWidget *host;
-            GtkWidget *base_dn;
-            GtkWidget *bind_dn;
-            GtkWidget *book_dn;
-            GtkWidget *passwd;
-            GtkWidget *enable_tls;
-        } ldap;
+       struct {
+           GtkWidget *host;
+           GtkWidget *base_dn;
+           GtkWidget *bind_dn;
+           GtkWidget *book_dn;
+           GtkWidget *passwd;
+           GtkWidget *enable_tls;
+       } ldap;
 #endif
     } ab_specific;
 
     LibBalsaAddressBook *address_book;
     BalsaAddressBookCallback *callback;
-    GtkWindow *parent;
+    GtkWindow* parent;
 };
 
-static GtkWidget *create_dialog_from_type(AddressBookConfig *abc);
-static GtkWidget *create_local_dialog(AddressBookConfig *abc,
-                                      const gchar       *type);
-static GtkWidget *create_externq_dialog(AddressBookConfig *abc);
-
+static GtkWidget *create_dialog_from_type(AddressBookConfig * abc);
+static GtkWidget *create_local_dialog(AddressBookConfig * abc,
+                                      const gchar * type);
+static GtkWidget *create_externq_dialog(AddressBookConfig * abc);
 #ifdef ENABLE_LDAP
-static GtkWidget *create_ldap_dialog(AddressBookConfig *abc);
-
+static GtkWidget *create_ldap_dialog(AddressBookConfig * abc);
 #endif
 #ifdef HAVE_SQLITE
-static GtkWidget *create_gpe_dialog(AddressBookConfig *abc);
-
+static GtkWidget *create_gpe_dialog(AddressBookConfig * abc);
 #endif
 #ifdef HAVE_RUBRICA
-static GtkWidget *create_rubrica_dialog(AddressBookConfig *abc);
-
+static GtkWidget *create_rubrica_dialog(AddressBookConfig * abc);
 #endif
 #ifdef HAVE_OSMO
 static GtkWidget *create_osmo_dialog(AddressBookConfig *abc);
-
 #endif
 
-static void help_button_cb(AddressBookConfig *abc);
-static gboolean handle_close(AddressBookConfig *abc);
-static gboolean bad_path(gchar     *path,
-                         GtkWindow *window,
-                         gint       type);
-static gboolean create_book(AddressBookConfig *abc);
-static void modify_book(AddressBookConfig *abc);
+static void help_button_cb(AddressBookConfig * abc);
+static gboolean handle_close(AddressBookConfig * abc);
+static gboolean bad_path(gchar * path, GtkWindow * window, gint type);
+static gboolean create_book(AddressBookConfig * abc);
+static void modify_book(AddressBookConfig * abc);
 
 /*
  * Create and run the address book configuration window.
  *
- * address_book is the address book to configure. If it is
+ * address_book is the address book to configure. If it is 
  * NULL then a new address book is created, the user is prompted
  * for the kind of address book to create.
  *
  * Returns the configured/new mailbox if the user presses Update/Add
  * or NULL if the user cancels.
- *
+ * 
  * The address book returned will have been setup.
  *
  */
 void
-balsa_address_book_config_new(LibBalsaAddressBook     *address_book,
+balsa_address_book_config_new(LibBalsaAddressBook * address_book,
                               BalsaAddressBookCallback callback,
-                              GtkWindow               *parent)
+                              GtkWindow* parent)
 {
     AddressBookConfig *abc;
 
@@ -129,18 +122,16 @@ balsa_address_book_config_new(LibBalsaAddressBook     *address_book,
     abc->type = G_TYPE_FROM_INSTANCE(address_book);
     abc->window = create_dialog_from_type(abc);
 
-    if (address_book) {
-        gtk_widget_grab_focus(abc->name_entry);
-    }
+    if (address_book)
+       gtk_widget_grab_focus(abc->name_entry);
 
     gtk_widget_show(GTK_WIDGET(abc->window));
 }
 
-
 void
-balsa_address_book_config_new_from_type(GType                    type,
+balsa_address_book_config_new_from_type(GType type,
                                         BalsaAddressBookCallback callback,
-                                        GtkWindow               *parent)
+                                        GtkWindow* parent)
 {
     AddressBookConfig *abc;
 
@@ -153,40 +144,31 @@ balsa_address_book_config_new_from_type(GType                    type,
     gtk_widget_show(GTK_WIDGET(abc->window));
 }
 
-
 static void
-edit_book_response(GtkWidget         *dialog,
-                   gint               response,
-                   AddressBookConfig *abc)
+edit_book_response(GtkWidget * dialog, gint response,
+                   AddressBookConfig * abc)
 {
     switch (response) {
     case GTK_RESPONSE_HELP:
         help_button_cb(abc);
         return;
-
     case GTK_RESPONSE_APPLY:
-        if (handle_close(abc)) {
+        if (handle_close(abc))
             break;
-        } else {
+        else
             return;
-        }
-
     default:
         break;
     }
 
     gtk_widget_destroy(dialog);
-    if (abc->address_book) {
+    if (abc->address_book)
         g_object_set_data(G_OBJECT(abc->address_book), "balsa-abc", NULL);
-    }
 }
 
-
 /* Radio buttons */
 static void
-add_radio_buttons(GtkWidget         *grid,
-                  gint               row,
-                  AddressBookConfig *abc)
+add_radio_buttons(GtkWidget * grid, gint row, AddressBookConfig * abc)
 {
     GtkWidget *label;
     GSList *radio_group;
@@ -218,19 +200,16 @@ add_radio_buttons(GtkWidget         *grid,
 
     button = abc->as_i_type;
     if (abc->address_book) {
-        if (!libbalsa_address_book_get_expand_aliases(abc->address_book)) {
+        if (!libbalsa_address_book_get_expand_aliases(abc->address_book))
             button = abc->never;
-        } else if (libbalsa_address_book_get_is_expensive(abc->address_book)) {
+        else if (libbalsa_address_book_get_is_expensive(abc->address_book))
             button = abc->on_request;
-        }
     }
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
 }
 
-
 static GtkWidget *
-create_local_dialog(AddressBookConfig *abc,
-                    const gchar       *type)
+create_local_dialog(AddressBookConfig * abc, const gchar * type)
 {
     GtkWidget *dialog;
     gchar *title;
@@ -256,8 +235,8 @@ create_local_dialog(AddressBookConfig *abc,
         gtk_file_chooser_dialog_new(title, abc->parent,
                                     GTK_FILE_CHOOSER_ACTION_SAVE,
                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                    _("_Help"), GTK_RESPONSE_HELP,
-                                    action, GTK_RESPONSE_APPLY,
+                                    _("_Help"),   GTK_RESPONSE_HELP,
+                                    action,       GTK_RESPONSE_APPLY,
                                     NULL);
     g_free(title);
 #if HAVE_MACOSX_DESKTOP
@@ -295,23 +274,20 @@ create_local_dialog(AddressBookConfig *abc,
     return dialog;
 }
 
-
 static GtkWidget *
-create_vcard_dialog(AddressBookConfig *abc)
+create_vcard_dialog(AddressBookConfig * abc)
 {
     return create_local_dialog(abc, "VCARD");
 }
 
-
 static GtkWidget *
-create_ldif_dialog(AddressBookConfig *abc)
+create_ldif_dialog(AddressBookConfig * abc)
 {
     return create_local_dialog(abc, "LDIF");
 }
 
-
 static GtkWidget *
-create_dialog_from_type(AddressBookConfig *abc)
+create_dialog_from_type(AddressBookConfig * abc)
 {
     if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_VCARD) {
         return create_vcard_dialog(abc);
@@ -319,26 +295,21 @@ create_dialog_from_type(AddressBookConfig *abc)
         return create_externq_dialog(abc);
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_LDIF) {
         return create_ldif_dialog(abc);
-
 #ifdef ENABLE_LDAP
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_LDAP) {
         return create_ldap_dialog(abc);
-
 #endif
 #ifdef HAVE_SQLITE
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_GPE) {
         return create_gpe_dialog(abc);
-
 #endif
 #ifdef HAVE_RUBRICA
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_RUBRICA) {
         return create_rubrica_dialog(abc);
-
 #endif
 #ifdef HAVE_OSMO
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_OSMO) {
-        return create_osmo_dialog(abc);
-
+       return create_osmo_dialog(abc);
 #endif
     } else {
         g_assert_not_reached();
@@ -347,10 +318,8 @@ create_dialog_from_type(AddressBookConfig *abc)
     return NULL;
 }
 
-
 static GtkWidget *
-create_generic_dialog(AddressBookConfig *abc,
-                      const gchar       *type)
+create_generic_dialog(AddressBookConfig * abc, const gchar * type)
 {
     GtkWidget *dialog;
     gchar *title;
@@ -385,7 +354,6 @@ create_generic_dialog(AddressBookConfig *abc,
     return dialog;
 }
 
-
 #ifdef HAVE_OSMO
 static GtkWidget *
 create_osmo_dialog(AddressBookConfig *abc)
@@ -419,9 +387,9 @@ create_osmo_dialog(AddressBookConfig *abc)
                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
                                     NULL);
     g_free(title);
-#   if HAVE_MACOSX_DESKTOP
+#if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(dialog, abc->parent);
-#   endif
+#endif
     size_group = libbalsa_create_size_group(dialog);
 
     grid = libbalsa_create_grid();
@@ -438,19 +406,17 @@ create_osmo_dialog(AddressBookConfig *abc)
 
     return dialog;
 }
-
-
 #endif /* HAVE_OSMO */
 
 static GtkWidget *
-create_externq_dialog(AddressBookConfig *abc)
+create_externq_dialog(AddressBookConfig * abc)
 {
     GtkWidget *dialog;
     GtkWidget *grid;
     GtkWidget *label;
-    LibBalsaAddressBookExtern *ab;
+    LibBalsaAddressBookExtern* ab;
 
-    ab = (LibBalsaAddressBookExtern *)abc->address_book; /* may be NULL */
+    ab = (LibBalsaAddressBookExtern*)abc->address_book; /* may be NULL */
     grid = libbalsa_create_grid();
     g_object_set(G_OBJECT(grid), "margin", 5, NULL);
 
@@ -458,19 +424,18 @@ create_externq_dialog(AddressBookConfig *abc)
 
     label = libbalsa_create_grid_label(_("A_ddress Book Name:"), grid, 0);
     abc->name_entry = libbalsa_create_grid_entry(grid, NULL, NULL, 0,
-                                                 ab != NULL
-                                                 ? libbalsa_address_book_get_name(abc->
-                                                                                  address_book)
-                                                 : NULL,
-                                                 label);
+                                  ab != NULL
+                                   ? libbalsa_address_book_get_name(abc->address_book)
+                                   : NULL,
+                                  label);
 
     label = gtk_label_new(_("Load program location:"));
     gtk_widget_set_halign(label, GTK_ALIGN_END);
     gtk_grid_attach(GTK_GRID(grid), label, 0, 1, 1, 1);
     abc->ab_specific.externq.load =
         gtk_file_chooser_button_new
-            (_("Select load program for address book"),
-            GTK_FILE_CHOOSER_ACTION_OPEN);
+        (_("Select load program for address book"),
+         GTK_FILE_CHOOSER_ACTION_OPEN);
     gtk_widget_set_hexpand(abc->ab_specific.externq.load, TRUE);
     gtk_grid_attach(GTK_GRID(grid), abc->ab_specific.externq.load,
                     1, 1, 1, 1);
@@ -482,8 +447,8 @@ create_externq_dialog(AddressBookConfig *abc)
     gtk_grid_attach(GTK_GRID(grid), label, 0, 2, 1, 1);
     abc->ab_specific.externq.save =
         gtk_file_chooser_button_new
-            (_("Select save program for address book"),
-            GTK_FILE_CHOOSER_ACTION_OPEN);
+        (_("Select save program for address book"),
+         GTK_FILE_CHOOSER_ACTION_OPEN);
     gtk_widget_set_hexpand(abc->ab_specific.externq.save, TRUE);
     gtk_grid_attach(GTK_GRID(grid), abc->ab_specific.externq.save,
                     1, 2, 1, 1);
@@ -494,10 +459,10 @@ create_externq_dialog(AddressBookConfig *abc)
 
     if (ab) {
         gtk_file_chooser_set_filename(GTK_FILE_CHOOSER
-                                          (abc->ab_specific.externq.load),
+                                      (abc->ab_specific.externq.load),
                                       libbalsa_address_book_extern_get_load(ab));
         gtk_file_chooser_set_filename(GTK_FILE_CHOOSER
-                                          (abc->ab_specific.externq.save),
+                                      (abc->ab_specific.externq.save),
                                       libbalsa_address_book_extern_get_save(ab));
     }
 
@@ -507,91 +472,86 @@ create_externq_dialog(AddressBookConfig *abc)
     return dialog;
 }
 
-
 #ifdef ENABLE_LDAP
 static GtkWidget *
-create_ldap_dialog(AddressBookConfig *abc)
+create_ldap_dialog(AddressBookConfig * abc)
 {
     GtkWidget *dialog;
     GtkWidget *grid = libbalsa_create_grid();
 
-    LibBalsaAddressBookLdap *ab;
-    GtkWidget *label;
+    LibBalsaAddressBookLdap* ab;
+    GtkWidget* label;
     gchar *host = g_strdup_printf("ldap://%s";, libbalsa_guess_ldap_server());
     gchar *base = libbalsa_guess_ldap_base();
     gchar *name = libbalsa_guess_ldap_name();
 
-    ab = (LibBalsaAddressBookLdap *)abc->address_book; /* may be NULL */
+    ab = (LibBalsaAddressBookLdap*)abc->address_book; /* may be NULL */
 
     /* mailbox name */
 
     label = libbalsa_create_grid_label(_("A_ddress Book Name:"), grid, 0);
     abc->name_entry = libbalsa_create_grid_entry(grid, NULL, NULL, 0,
-                                                 ab != NULL
-                                                 ? libbalsa_address_book_get_name(abc->
-                                                                                  address_book)
-                                                 : NULL,
-                                                 label);
+                                  ab != NULL
+                                   ? libbalsa_address_book_get_name(abc->address_book)
+                                   : NULL,
+                                  label);
 
     label = libbalsa_create_grid_label(_("_Host Name"), grid, 1);
-    abc->ab_specific.ldap.host =
-        libbalsa_create_grid_entry(grid, NULL, NULL, 1,
-                                   ab ? libbalsa_address_book_ldap_get_host(ab) : host, label);
+    abc->ab_specific.ldap.host = 
+       libbalsa_create_grid_entry(grid, NULL, NULL, 1, 
+                    ab ? libbalsa_address_book_ldap_get_host(ab) : host, label);
 
     label = libbalsa_create_grid_label(_("Base Domain _Name"), grid, 2);
-    abc->ab_specific.ldap.base_dn =
-        libbalsa_create_grid_entry(grid, NULL, NULL, 2,
-                                   ab ? libbalsa_address_book_ldap_get_base_dn(ab) : base,
-                                   label);
+    abc->ab_specific.ldap.base_dn = 
+       libbalsa_create_grid_entry(grid, NULL, NULL, 2, 
+                    ab ? libbalsa_address_book_ldap_get_base_dn(ab) : base, label);
 
     label = libbalsa_create_grid_label(_("_User Name (Bind DN)"), grid, 3);
-    abc->ab_specific.ldap.bind_dn =
-        libbalsa_create_grid_entry(grid, NULL, NULL, 3,
-                                   ab ? libbalsa_address_book_ldap_get_bind_dn(ab) : "", label);
+    abc->ab_specific.ldap.bind_dn = 
+       libbalsa_create_grid_entry(grid, NULL, NULL, 3, 
+                    ab ? libbalsa_address_book_ldap_get_bind_dn(ab) : "", label);
 
     label = libbalsa_create_grid_label(_("_Password"), grid, 4);
-    abc->ab_specific.ldap.passwd =
-        libbalsa_create_grid_entry(grid, NULL, NULL, 4,
-                                   ab ? libbalsa_address_book_ldap_get_passwd(ab) : "", label);
+    abc->ab_specific.ldap.passwd = 
+       libbalsa_create_grid_entry(grid, NULL, NULL, 4, 
+                    ab ? libbalsa_address_book_ldap_get_passwd(ab) : "", label);
     gtk_entry_set_visibility(GTK_ENTRY(abc->ab_specific.ldap.passwd), FALSE);
 
     label = libbalsa_create_grid_label(_("_User Address Book DN"), grid, 5);
-    abc->ab_specific.ldap.book_dn =
-        libbalsa_create_grid_entry(grid, NULL, NULL, 5,
-                                   ab ? libbalsa_address_book_ldap_get_book_dn(ab) : "", label);
+    abc->ab_specific.ldap.book_dn = 
+       libbalsa_create_grid_entry(grid, NULL, NULL, 5,
+                    ab ? libbalsa_address_book_ldap_get_book_dn(ab) : "", label);
 
     abc->ab_specific.ldap.enable_tls =
-        libbalsa_create_grid_check(_("Enable _TLS"), grid, 6,
-                                   ab ? libbalsa_address_book_ldap_get_enable_tls(ab) : FALSE);
+       libbalsa_create_grid_check(_("Enable _TLS"), grid, 6,
+                    ab ? libbalsa_address_book_ldap_get_enable_tls(ab) : FALSE);
 
     add_radio_buttons(grid, 7, abc);
 
     g_free(base);
     g_free(name);
     g_free(host);
-
+    
     dialog = create_generic_dialog(abc, "LDAP");
     g_object_set(G_OBJECT(grid), "margin", 12, NULL);
     gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), grid);
     return dialog;
 }
-
-
 #endif
 
 #ifdef HAVE_SQLITE
 static GtkWidget *
-create_gpe_dialog(AddressBookConfig *abc)
+create_gpe_dialog(AddressBookConfig * abc)
 {
     GtkWidget *dialog;
     GtkWidget *grid = libbalsa_create_grid();
 
-    LibBalsaAddressBook *ab;
-    GtkWidget *label;
+    LibBalsaAddressBook* ab;
+    GtkWidget* label;
 
     g_object_set(G_OBJECT(grid), "margin", 5, NULL);
 
-    ab = (LibBalsaAddressBook *)abc->address_book; /* may be NULL */
+    ab = (LibBalsaAddressBook*)abc->address_book; /* may be NULL */
 
     /* mailbox name */
 
@@ -610,22 +570,18 @@ create_gpe_dialog(AddressBookConfig *abc)
     gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), grid);
     return dialog;
 }
-
-
 #endif
 
 #if HAVE_RUBRICA
 static GtkWidget *
-create_rubrica_dialog(AddressBookConfig *abc)
+create_rubrica_dialog(AddressBookConfig * abc)
 {
     return create_local_dialog(abc, "Rubrica");
 }
-
-
 #endif
 
 static void
-help_button_cb(AddressBookConfig *abc)
+help_button_cb(AddressBookConfig * abc)
 {
     GError *err = NULL;
 
@@ -657,60 +613,49 @@ enum {
  *                      correct it.
  */
 static gboolean
-chooser_bad_path(GtkFileChooser *chooser,
-                 GtkWindow      *window,
-                 gint            type)
+chooser_bad_path(GtkFileChooser * chooser, GtkWindow * window, gint type)
 {
     return bad_path(gtk_file_chooser_get_filename(chooser), window, type);
 }
 
-
 static gboolean
-handle_close(AddressBookConfig *abc)
+handle_close(AddressBookConfig * abc)
 {
     if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_VCARD) {
         if (chooser_bad_path(GTK_FILE_CHOOSER(abc->window),
-                             GTK_WINDOW(abc->window),
-                             ADDRESS_BOOK_CONFIG_PATH_FILE)) {
+                     GTK_WINDOW(abc->window),
+                     ADDRESS_BOOK_CONFIG_PATH_FILE))
             return FALSE;
-        }
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_LDIF) {
         if (chooser_bad_path(GTK_FILE_CHOOSER(abc->window),
-                             GTK_WINDOW(abc->window),
-                             ADDRESS_BOOK_CONFIG_PATH_FILE)) {
+                     GTK_WINDOW(abc->window),
+                     ADDRESS_BOOK_CONFIG_PATH_FILE))
             return FALSE;
-        }
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN) {
         if (chooser_bad_path(GTK_FILE_CHOOSER(abc->ab_specific.externq.load),
-                             GTK_WINDOW(abc->window),
-                             ADDRESS_BOOK_CONFIG_PATH_LOAD)) {
+                     GTK_WINDOW(abc->window),
+                     ADDRESS_BOOK_CONFIG_PATH_LOAD))
             return FALSE;
-        }
         if (chooser_bad_path(GTK_FILE_CHOOSER(abc->ab_specific.externq.save),
-                             GTK_WINDOW(abc->window),
-                             ADDRESS_BOOK_CONFIG_PATH_SAVE)) {
+                     GTK_WINDOW(abc->window),
+                     ADDRESS_BOOK_CONFIG_PATH_SAVE))
             return FALSE;
-        }
     }
 
-    if (abc->address_book == NULL) {
+    if (abc->address_book == NULL)
         return create_book(abc);
-    } else {
+    else
         modify_book(abc);
-    }
 
     return TRUE;
 }
 
-
 /* bad_path:
  *
  * Returns TRUE if the path is bad and the user wants to correct it
  */
 static gboolean
-bad_path(gchar     *path,
-         GtkWindow *window,
-         gint       type)
+bad_path(gchar * path, GtkWindow * window, gint type)
 {
     GtkWidget *ask;
     gint clicked_button;
@@ -720,11 +665,11 @@ bad_path(gchar     *path,
         return FALSE;
     }
     ask = gtk_message_dialog_new(window,
-                                 GTK_DIALOG_MODAL |
-                                 GTK_DIALOG_DESTROY_WITH_PARENT,
+                                GTK_DIALOG_MODAL|
+                                GTK_DIALOG_DESTROY_WITH_PARENT,
                                  GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
                                  _("No path found. "
-                                   "Do you want to give one?"));
+                                  "Do you want to give one?"));
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(ask, window);
 #endif
@@ -734,9 +679,8 @@ bad_path(gchar     *path,
     return clicked_button == GTK_RESPONSE_YES;
 }
 
-
 static gboolean
-create_book(AddressBookConfig *abc)
+create_book(AddressBookConfig * abc)
 {
     LibBalsaAddressBook *address_book = NULL;
     const gchar *name = gtk_entry_get_text(GTK_ENTRY(abc->name_entry));
@@ -744,27 +688,24 @@ create_book(AddressBookConfig *abc)
     if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_VCARD) {
         gchar *path =
             gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(abc->window));
-        if (path != NULL) {
+        if (path != NULL)
             address_book = libbalsa_address_book_vcard_new(name, path);
-        }
         g_free(path);
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN) {
 #define GET_FILENAME(chooser) \
-    gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser))
+  gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser))
         gchar *load = GET_FILENAME(abc->ab_specific.externq.load);
         gchar *save = GET_FILENAME(abc->ab_specific.externq.save);
-        if ((load != NULL) && (save != NULL)) {
+        if (load != NULL && save != NULL)
             address_book =
                 libbalsa_address_book_externq_new(name, load, save);
-        }
         g_free(load);
         g_free(save);
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_LDIF) {
         gchar *path =
             gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(abc->window));
-        if (path != NULL) {
+        if (path != NULL)
             address_book = libbalsa_address_book_ldif_new(name, path);
-        }
         g_free(path);
 #ifdef ENABLE_LDAP
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_LDAP) {
@@ -780,7 +721,7 @@ create_book(AddressBookConfig *abc)
             gtk_entry_get_text(GTK_ENTRY(abc->ab_specific.ldap.book_dn));
         gboolean enable_tls =
             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                             (abc->ab_specific.ldap.enable_tls));
+                                         (abc->ab_specific.ldap.enable_tls));
         address_book =
             libbalsa_address_book_ldap_new(name, host, base_dn,
                                            bind_dn, passwd, book_dn,
@@ -795,18 +736,16 @@ create_book(AddressBookConfig *abc)
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_RUBRICA) {
         gchar *path =
             gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(abc->window));
-        if (path != NULL) {
+        if (path != NULL)
             address_book = libbalsa_address_book_rubrica_new(name, path);
-        }
         g_free(path);
 #endif
 #ifdef HAVE_OSMO
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_OSMO) {
-        address_book = libbalsa_address_book_osmo_new(name);
+       address_book = libbalsa_address_book_osmo_new(name);
 #endif
-    } else {
+    } else
         g_assert_not_reached();
-    }
 
     if (address_book != NULL) {
         gboolean active;
@@ -823,9 +762,8 @@ create_book(AddressBookConfig *abc)
     return address_book != NULL;
 }
 
-
 static void
-modify_book(AddressBookConfig *abc)
+modify_book(AddressBookConfig * abc)
 {
     LibBalsaAddressBook *address_book = abc->address_book;
     gboolean active;
@@ -833,7 +771,7 @@ modify_book(AddressBookConfig *abc)
     libbalsa_address_book_set_name(address_book,
                                    gtk_entry_get_text(GTK_ENTRY(abc->name_entry)));
 
-    if ((abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_VCARD)
+    if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_VCARD
         || abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_LDIF
 #ifdef HAVE_RUBRICA
         || abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_RUBRICA
@@ -844,17 +782,16 @@ modify_book(AddressBookConfig *abc)
         gchar *path =
             gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(abc->window));
 
-        if (path != NULL) {
+        if (path != NULL)
             libbalsa_address_book_text_set_path(ab_text, path);
-        }
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN) {
         LibBalsaAddressBookExtern *externq;
         gchar *load =
             gtk_file_chooser_get_filename(GTK_FILE_CHOOSER
-                                              (abc->ab_specific.externq.load));
+                                           (abc->ab_specific.externq.load));
         gchar *save =
             gtk_file_chooser_get_filename(GTK_FILE_CHOOSER
-                                              (abc->ab_specific.externq.save));
+                                           (abc->ab_specific.externq.save));
 
         externq = LIBBALSA_ADDRESS_BOOK_EXTERN(address_book);
         if (load) {
@@ -880,7 +817,7 @@ modify_book(AddressBookConfig *abc)
             gtk_entry_get_text(GTK_ENTRY(abc->ab_specific.ldap.book_dn));
         gboolean enable_tls =
             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                             (abc->ab_specific.ldap.enable_tls));
+                                         (abc->ab_specific.ldap.enable_tls));
 
         ldap = LIBBALSA_ADDRESS_BOOK_LDAP(address_book);
 
@@ -898,11 +835,10 @@ modify_book(AddressBookConfig *abc)
 #endif /* HAVE_SQLITE */
 #if HAVE_OSMO
     } else if (abc->type == LIBBALSA_TYPE_ADDRESS_BOOK_OSMO) {
-        /* nothing to do here */
+       /* nothing to do here */
 #endif
-    } else {
+    } else
         g_assert_not_reached();
-    }
 
     active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(abc->never));
     libbalsa_address_book_set_expand_aliases(address_book, !active);
@@ -912,94 +848,75 @@ modify_book(AddressBookConfig *abc)
     abc->callback(address_book, FALSE);
 }
 
-
 /* Pref manager callbacks */
 
 static void
-add_vcard_cb(GtkWidget         *widget,
-             AddressBookConfig *abc)
+add_vcard_cb(GtkWidget * widget, AddressBookConfig * abc)
 {
     abc->type = LIBBALSA_TYPE_ADDRESS_BOOK_VCARD;
     abc->window = create_vcard_dialog(abc);
     gtk_widget_show(abc->window);
 }
 
-
 static void
-add_externq_cb(GtkWidget         *widget,
-               AddressBookConfig *abc)
+add_externq_cb(GtkWidget * widget, AddressBookConfig * abc)
 {
     abc->type = LIBBALSA_TYPE_ADDRESS_BOOK_EXTERN;
     abc->window = create_externq_dialog(abc);
     gtk_widget_show(abc->window);
 }
 
-
 static void
-add_ldif_cb(GtkWidget         *widget,
-            AddressBookConfig *abc)
+add_ldif_cb(GtkWidget * widget, AddressBookConfig * abc)
 {
     abc->type = LIBBALSA_TYPE_ADDRESS_BOOK_LDIF;
     abc->window = create_ldif_dialog(abc);
     gtk_widget_show(abc->window);
 }
 
-
 #ifdef ENABLE_LDAP
 static void
-add_ldap_cb(GtkWidget         *widget,
-            AddressBookConfig *abc)
+add_ldap_cb(GtkWidget * widget, AddressBookConfig * abc)
 {
     abc->type = LIBBALSA_TYPE_ADDRESS_BOOK_LDAP;
     abc->window = create_ldap_dialog(abc);
     gtk_widget_show(abc->window);
 }
-
-
 #endif /* ENABLE_LDAP */
 
 #ifdef HAVE_SQLITE
 static void
-add_gpe_cb(GtkWidget         *widget,
-           AddressBookConfig *abc)
+add_gpe_cb(GtkWidget * widget, AddressBookConfig * abc)
 {
     abc->type = LIBBALSA_TYPE_ADDRESS_BOOK_GPE;
     abc->window = create_gpe_dialog(abc);
     gtk_widget_show(abc->window);
 }
-
-
 #endif /* HAVE_SQLITE */
 
 #ifdef HAVE_RUBRICA
 static void
-add_rubrica_cb(GtkWidget         *widget,
-               AddressBookConfig *abc)
+add_rubrica_cb(GtkWidget * widget, AddressBookConfig * abc)
 {
     abc->type = LIBBALSA_TYPE_ADDRESS_BOOK_RUBRICA;
     abc->window = create_rubrica_dialog(abc);
     gtk_widget_show(abc->window);
 }
-
-
 #endif /* HAVE_SQLITE */
 
 #ifdef HAVE_OSMO
 static void
-add_osmo_cb(GtkWidget         *widget,
-            AddressBookConfig *abc)
+add_osmo_cb(GtkWidget * widget, AddressBookConfig * abc)
 {
     abc->type = LIBBALSA_TYPE_ADDRESS_BOOK_OSMO;
     abc->window = create_osmo_dialog(abc);
     gtk_widget_show(abc->window);
 }
-
-
 #endif /* HAVE_OSMO */
 
 GtkWidget *
 balsa_address_book_add_menu(BalsaAddressBookCallback callback,
-                            GtkWindow               *parent)
+                            GtkWindow * parent)
 {
     GtkWidget *menu;
     GtkWidget *menuitem;
diff --git a/src/address-book-config.h b/src/address-book-config.h
index 1a1bbfb..5ed4876 100644
--- a/src/address-book-config.h
+++ b/src/address-book-config.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -21,16 +21,15 @@
 
 #include "libbalsa.h"
 
-typedef void BalsaAddressBookCallback (LibBalsaAddressBook *address_book,
-                                       gboolean             append);
-void balsa_address_book_config_new(LibBalsaAddressBook     *address_book,
-                                   BalsaAddressBookCallback callback,
-                                   GtkWindow               *parent);
-void balsa_address_book_config_new_from_type(GType      type,
+typedef void BalsaAddressBookCallback(LibBalsaAddressBook * address_book,
+                                      gboolean append);
+void balsa_address_book_config_new(LibBalsaAddressBook * address_book,
+                                  BalsaAddressBookCallback callback,
+                                   GtkWindow * parent);
+void balsa_address_book_config_new_from_type(GType type,
                                              BalsaAddressBookCallback
-                                             callback,
-                                             GtkWindow *parent);
+                                             callback, GtkWindow * parent);
 GtkWidget *balsa_address_book_add_menu(BalsaAddressBookCallback callback,
-                                       GtkWindow               *parent);
+                                       GtkWindow * parent);
 
-#endif                          /* __ADDRESS_BOOK_CONFIG_H__ */
+#endif                         /* __ADDRESS_BOOK_CONFIG_H__ */
diff --git a/src/balsa-app.c b/src/balsa-app.c
index 483d58c..5df0232 100644
--- a/src/balsa-app.c
+++ b/src/balsa-app.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-app.h"
 #include "balsa-icons.h"
@@ -40,10 +40,10 @@
 #include "save-restore.h"
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#  include "macosx-helpers.h"
 #endif
 
-#include <glib/gi18n.h> /* Must come after balsa-app.h. */
+#include <glib/gi18n.h>        /* Must come after balsa-app.h. */
 
 /* Global application structure */
 struct BalsaApplication balsa_app;
@@ -52,10 +52,9 @@ struct BalsaApplication balsa_app;
 
 /* ask_password:
    asks the user for the password to the mailbox on given remote server.
- */
+*/
 static gchar *
-ask_password_real(LibBalsaServer  *server,
-                  LibBalsaMailbox *mbox)
+ask_password_real(LibBalsaServer * server, LibBalsaMailbox * mbox)
 {
     GtkWidget *dialog, *entry, *rememb;
     GtkWidget *content_area;
@@ -69,16 +68,15 @@ ask_password_real(LibBalsaServer  *server,
 #endif                          /* defined(HAVE_LIBSECRET) */
 
     g_return_val_if_fail(server != NULL, NULL);
-    if (mbox) {
-        prompt =
-            g_strdup_printf(_("Opening remote mailbox %s.\n"
+    if (mbox)
+       prompt =
+           g_strdup_printf(_("Opening remote mailbox %s.\n"
                               "The _password for %s@%s:"),
-                            mbox->name, server->user, server->host);
-    } else {
-        prompt =
-            g_strdup_printf(_("_Password for %s@%s (%s):"), server->user,
-                            server->host, server->protocol);
-    }
+                           mbox->name, server->user, server->host);
+    else
+       prompt =
+           g_strdup_printf(_("_Password for %s@%s (%s):"), server->user,
+                           server->host, server->protocol);
 
     dialog = gtk_dialog_new_with_buttons(_("Password needed"),
                                          GTK_WINDOW(balsa_app.main_window),
@@ -86,7 +84,7 @@ ask_password_real(LibBalsaServer  *server,
                                          libbalsa_dialog_flags(),
                                          _("_OK"), GTK_RESPONSE_OK,
                                          _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                         NULL);
+                                         NULL); 
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(dialog, GTK_WINDOW(balsa_app.main_window));
 #endif
@@ -101,36 +99,33 @@ ask_password_real(LibBalsaServer  *server,
     gtk_entry_set_width_chars(GTK_ENTRY(entry), 20);
     gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
 
-    rememb = gtk_check_button_new_with_mnemonic(_(remember_password_message));
+    rememb =  gtk_check_button_new_with_mnemonic(_(remember_password_message));
     gtk_box_pack_start(GTK_BOX(content_area), rememb);
-    if (server->remember_passwd) {
+    if(server->remember_passwd)
         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rememb), TRUE);
-    }
 
     gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
     gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
     gtk_widget_grab_focus (entry);
 
-    if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
+    if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
         unsigned old_rem = server->remember_passwd;
         passwd = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
         server->remember_passwd =
             !!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(rememb));
         libbalsa_server_set_password(server, passwd);
-        if ( server->remember_passwd || old_rem ) {
+        if( server->remember_passwd || old_rem )
             libbalsa_server_config_changed(server);
-        }
     }
     gtk_widget_destroy(dialog);
     return passwd;
 }
 
-
 typedef struct {
     GCond cond;
-    LibBalsaServer *server;
-    LibBalsaMailbox *mbox;
-    gchar *res;
+    LibBalsaServer* server;
+    LibBalsaMailbox* mbox;
+    gchar* res;
     gboolean done;
 } AskPasswdData;
 
@@ -140,20 +135,18 @@ typedef struct {
 static gboolean
 ask_passwd_idle(gpointer data)
 {
-    AskPasswdData *apd = (AskPasswdData *)data;
+    AskPasswdData* apd = (AskPasswdData*)data;
     apd->res = ask_password_real(apd->server, apd->mbox);
     apd->done = TRUE;
     g_cond_signal(&apd->cond);
     return FALSE;
 }
 
-
 /* ask_password_mt:
    GDK lock must not be held.
- */
+*/
 static gchar *
-ask_password_mt(LibBalsaServer  *server,
-                LibBalsaMailbox *mbox)
+ask_password_mt(LibBalsaServer * server, LibBalsaMailbox * mbox)
 {
     static GMutex ask_passwd_lock;
     AskPasswdData apd;
@@ -161,24 +154,23 @@ ask_password_mt(LibBalsaServer  *server,
     g_mutex_lock(&ask_passwd_lock);
     g_cond_init(&apd.cond);
     apd.server = server;
-    apd.mbox = mbox;
-    apd.done = FALSE;
+    apd.mbox   = mbox;
+    apd.done   = FALSE;
     g_idle_add(ask_passwd_idle, &apd);
     while (!apd.done) {
-        g_cond_wait(&apd.cond, &ask_passwd_lock);
+       g_cond_wait(&apd.cond, &ask_passwd_lock);
     }
-
+    
     g_cond_clear(&apd.cond);
     g_mutex_unlock(&ask_passwd_lock);
     return apd.res;
 }
 
-
 static gboolean
 set_passwd_from_matching_server(GtkTreeModel *model,
-                                GtkTreePath  *path,
-                                GtkTreeIter  *iter,
-                                gpointer      data)
+                               GtkTreePath *path,
+                               GtkTreeIter *iter,
+                               gpointer data)
 {
     LibBalsaServer *server;
     LibBalsaServer *master;
@@ -187,82 +179,72 @@ set_passwd_from_matching_server(GtkTreeModel *model,
 
     gtk_tree_model_get(model, iter, 0, &node, -1);
     g_return_val_if_fail(node != NULL, FALSE);
-    if (node->server) {
+    if(node->server) {
         server = node->server;
-        g_object_unref(node);
+       g_object_unref(node);
     } else {
         mbox = node->mailbox;
-        g_object_unref(node);
-        if (!mbox) { /* eg. a collection of mboxes */
+       g_object_unref(node);
+        if(!mbox) /* eg. a collection of mboxes */
             return FALSE;
-        }
         g_return_val_if_fail(LIBBALSA_IS_MAILBOX(mbox), FALSE);
 
-        if (!LIBBALSA_IS_MAILBOX_REMOTE(mbox)) {
-            return FALSE;
-        }
+        if (!LIBBALSA_IS_MAILBOX_REMOTE(mbox)) return FALSE;
         server = LIBBALSA_MAILBOX_REMOTE_SERVER(mbox);
         g_return_val_if_fail(server != NULL, FALSE);
     }
     g_return_val_if_fail(server->host != NULL, FALSE);
     g_return_val_if_fail(server->user != NULL, FALSE);
-    if (server->passwd == NULL) {
-        return FALSE;
-    }
+    if (server->passwd == NULL) return FALSE;
 
     master = (LibBalsaServer *)data;
     g_return_val_if_fail(LIBBALSA_IS_SERVER(master), FALSE);
-    if (master == server) {
-        return FALSE;
-    }
+    if (master == server) return FALSE;
 
     g_return_val_if_fail(server->host != NULL, FALSE);
     g_return_val_if_fail(server->user != NULL, FALSE);
 
     if ((strcmp(server->host, master->host) == 0) &&
-        (strcmp(server->user, master->user) == 0)) {
-        g_free(master->passwd);
-        master->passwd = g_strdup(server->passwd);
-        return TRUE;
-    }
-
+       (strcmp(server->user, master->user) == 0)) {
+       g_free(master->passwd);
+       master->passwd = g_strdup(server->passwd);
+       return TRUE;
+    };
+    
     return FALSE;
 }
-
-
 /* ask_password:
    when called from thread, gdk lock must not be held.
- */
+*/
 gchar *
-ask_password(LibBalsaServer  *server,
-             LibBalsaMailbox *mbox)
+ask_password(LibBalsaServer *server, LibBalsaMailbox *mbox)
 {
     gchar *password;
 
     g_return_val_if_fail(server != NULL, NULL);
-
+    
     password = NULL;
     if (mbox) {
-        gtk_tree_model_foreach(GTK_TREE_MODEL(balsa_app.mblist_tree_store),
-                               (GtkTreeModelForeachFunc)
-                               set_passwd_from_matching_server, server);
+       gtk_tree_model_foreach(GTK_TREE_MODEL(balsa_app.mblist_tree_store),
+                              (GtkTreeModelForeachFunc)
+                              set_passwd_from_matching_server, server);
 
-        if (server->passwd != NULL) {
-            password = server->passwd;
-            server->passwd = NULL;
-        }
+       if (server->passwd != NULL) {
+           password = server->passwd;
+           server->passwd = NULL;
+       }
     }
 
     if (!password) {
         G_LOCK_DEFINE_STATIC(ask_password);
 
         G_LOCK(ask_password);
-        password = !libbalsa_am_i_subthread() ?
+       password = !libbalsa_am_i_subthread() ?
             ask_password_real(server, mbox) : ask_password_mt(server, mbox);
         G_UNLOCK(ask_password);
-        return password;
+       return password;
     }
-    return password;
+       return password;
 }
 
 
@@ -270,12 +252,8 @@ ask_password(LibBalsaServer  *server,
 static gboolean
 send_queued_messages_auto_cb(gpointer data)
 {
-    g_debug("%s: %p", __func__, data);
-    libbalsa_process_queue(balsa_app.outbox,
-                           balsa_find_sentbox_by_url,
-                           balsa_app.smtp_servers,
-                           FALSE,
-                           NULL);
+       g_debug("%s: %p", __func__, data);
+       libbalsa_process_queue(balsa_app.outbox, balsa_find_sentbox_by_url, balsa_app.smtp_servers, FALSE, 
NULL);
     return (data == NULL);
 }
 
@@ -283,8 +261,8 @@ send_queued_messages_auto_cb(gpointer data)
 void
 balsa_app_init(void)
 {
-    /*
-     * initalize application structure before ALL ELSE
+    /* 
+     * initalize application structure before ALL ELSE 
      * to some reasonable defaults
      */
     balsa_app.identities = NULL;
@@ -380,7 +358,7 @@ balsa_app_init(void)
 
     balsa_app.print_header_font = g_strdup(DEFAULT_PRINT_HEADER_FONT);
     balsa_app.print_footer_font = g_strdup(DEFAULT_PRINT_FOOTER_FONT);
-    balsa_app.print_body_font = g_strdup(DEFAULT_PRINT_BODY_FONT);
+    balsa_app.print_body_font   = g_strdup(DEFAULT_PRINT_BODY_FONT);
     balsa_app.print_highlight_cited = FALSE;
     balsa_app.print_highlight_phrases = FALSE;
 
@@ -389,7 +367,7 @@ balsa_app_init(void)
     balsa_app.default_address_book = NULL;
 
     /* Filters */
-    balsa_app.filters = NULL;
+    balsa_app.filters=NULL;
 
     /* spell check */
 #if HAVE_GSPELL || HAVE_GTKSPELL
@@ -423,13 +401,12 @@ balsa_app_init(void)
 #endif
 
     /* Message filing */
-    balsa_app.folder_mru = NULL;
-    balsa_app.fcc_mru = NULL;
+    balsa_app.folder_mru=NULL;
+    balsa_app.fcc_mru=NULL;
 
     libbalsa_auto_send_init(send_queued_messages_auto_cb);
 }
 
-
 void
 balsa_app_destroy(void)
 {
@@ -439,27 +416,23 @@ balsa_app_destroy(void)
 
     /* now free filters */
     g_slist_foreach(balsa_app.filters, (GFunc)libbalsa_filter_free,
-                    GINT_TO_POINTER(TRUE));
+                   GINT_TO_POINTER(TRUE));
     g_clear_pointer(&balsa_app.filters, (GDestroyNotify) g_slist_free);
 
     libbalsa_clear_list(&balsa_app.identities, g_object_unref);
     libbalsa_clear_list(&balsa_app.folder_mru, g_free);
     libbalsa_clear_list(&balsa_app.fcc_mru, g_free);
 
-    if (balsa_app.debug) {
-        g_print("balsa_app: Finished cleaning up.\n");
-    }
+    if(balsa_app.debug) g_print("balsa_app: Finished cleaning up.\n");
 }
 
-
 static gboolean
 check_new_messages_auto_cb(gpointer data)
 {
     check_new_messages_real(balsa_app.main_window, TRUE);
 
-    if (balsa_app.debug) {
+    if (balsa_app.debug)
         fprintf(stderr, "Auto-checked for new messages…\n");
-    }
 
     /*  preserver timer */
     return TRUE;
@@ -467,8 +440,7 @@ check_new_messages_auto_cb(gpointer data)
 
 
 void
-update_timer(gboolean update,
-             guint    minutes)
+update_timer(gboolean update, guint minutes)
 {
     libbalsa_clear_source_id(&balsa_app.check_mail_timer_id);
 
@@ -488,41 +460,35 @@ update_timer(gboolean update,
  */
 
 static gboolean
-append_url_if_open(const gchar *group,
-                   const gchar *encoded_url,
-                   GPtrArray   *array)
+append_url_if_open(const gchar * group, const gchar * encoded_url,
+                   GPtrArray * array)
 {
     gchar *url;
 
     url = libbalsa_urldecode(encoded_url);
 
-    if (config_mailbox_was_open(url)) {
+    if (config_mailbox_was_open(url))
         g_ptr_array_add(array, url);
-    } else {
+    else
         g_free(url);
-    }
 
     return FALSE;
 }
 
-
 static void
-open_mailbox_by_url(const gchar *url,
-                    gboolean     hidden)
+open_mailbox_by_url(const gchar * url, gboolean hidden)
 {
     LibBalsaMailbox *mailbox;
 
     mailbox = balsa_find_mailbox_by_url(url);
-    if (balsa_app.debug) {
+    if (balsa_app.debug)
         fprintf(stderr, "balsa_open_mailbox_list: opening %s => %p..\n",
                 url, mailbox);
-    }
     if (mailbox) {
-        if (hidden) {
+        if (hidden)
             balsa_mblist_open_mailbox_hidden(mailbox);
-        } else {
+        else
             balsa_mblist_open_mailbox(mailbox);
-        }
     } else {
         /* Do not try to open it next time. */
         LibBalsaMailboxView *view = config_load_mailbox_view(url);
@@ -541,9 +507,8 @@ open_mailbox_by_url(const gchar *url,
     }
 }
 
-
 void
-balsa_open_mailbox_list(gchar **urls)
+balsa_open_mailbox_list(gchar ** urls)
 {
     gboolean hidden = FALSE;
     gchar **tmp;
@@ -554,11 +519,9 @@ balsa_open_mailbox_list(gchar **urls)
         gchar **p;
 
         /* Have we already seen this URL? */
-        for (p = urls; p < tmp; ++p) {
-            if (!strcmp(*p, *tmp)) {
+        for (p = urls; p < tmp; ++p)
+            if (!strcmp(*p, *tmp))
                 break;
-            }
-        }
         if (p == tmp) {
             open_mailbox_by_url(*tmp, hidden);
             hidden = TRUE;
@@ -568,95 +531,84 @@ balsa_open_mailbox_list(gchar **urls)
     g_strfreev(urls);
 }
 
-
 void
-balsa_add_open_mailbox_urls(GPtrArray *url_array)
+balsa_add_open_mailbox_urls(GPtrArray * url_array)
 {
     libbalsa_conf_foreach_group(VIEW_BY_URL_SECTION_PREFIX,
                                 (LibBalsaConfForeachFunc)
                                 append_url_if_open, url_array);
 }
 
-
-/*
+/* 
  * Utilities for searching a GNode tree of BalsaMailboxNodes
  *
  * First a structure for the search info
  */
 struct _BalsaFind {
     gconstpointer data;
-    LibBalsaServer *server;
+    LibBalsaServer   *server;
     BalsaMailboxNode *mbnode;
 };
 typedef struct _BalsaFind BalsaFind;
 
 static gint
-find_mailbox(GtkTreeModel *model,
-             GtkTreePath  *path,
-             GtkTreeIter  *iter,
-             gpointer      user_data)
+find_mailbox(GtkTreeModel * model, GtkTreePath * path, GtkTreeIter * iter,
+            gpointer user_data)
 {
     BalsaFind *bf = user_data;
     BalsaMailboxNode *mbnode;
 
     gtk_tree_model_get(model, iter, 0, &mbnode, -1);
     if (mbnode->mailbox == bf->data) {
-        bf->mbnode = mbnode;
-        return TRUE;
+       bf->mbnode = mbnode;
+       return TRUE;
     }
     g_object_unref(mbnode);
 
     return FALSE;
 }
 
-
 /* balsa_find_mailbox:
    looks for given mailbox in the GNode tree, usually but not limited to
    balsa_app.mailbox_nodes; caller must unref mbnode if non-NULL.
- */
+*/
 BalsaMailboxNode *
-balsa_find_mailbox(LibBalsaMailbox *mailbox)
+balsa_find_mailbox(LibBalsaMailbox * mailbox)
 {
     BalsaFind bf;
 
     bf.data = mailbox;
     bf.mbnode = NULL;
-    if (balsa_app.mblist_tree_store) {
+    if (balsa_app.mblist_tree_store)
         gtk_tree_model_foreach(GTK_TREE_MODEL(balsa_app.mblist_tree_store),
                                find_mailbox, &bf);
-    }
 
     return bf.mbnode;
 }
 
-
 /* balsa_find_dir:
    looks for a mailbox node with dir equal to path.
    returns NULL on failure; caller must unref mbnode when non-NULL.
- */
+*/
 static gint
-find_path(GtkTreeModel *model,
-          GtkTreePath  *path,
-          GtkTreeIter  *iter,
-          BalsaFind    *bf)
+find_path(GtkTreeModel * model, GtkTreePath * path, GtkTreeIter * iter,
+         BalsaFind * bf)
 {
     BalsaMailboxNode *mbnode;
 
     gtk_tree_model_get(model, iter, 0, &mbnode, -1);
-    if ((mbnode->server == bf->server) &&
-        (g_strcmp0(mbnode->dir, (const gchar *) bf->data) == 0)) {
-        bf->mbnode = mbnode;
-        return TRUE;
+    if (mbnode->server == bf->server &&
+        g_strcmp0(mbnode->dir, (const gchar *) bf->data) == 0) {
+       bf->mbnode = mbnode;
+       return TRUE;
     }
     g_object_unref(mbnode);
 
     return FALSE;
 }
 
-
 BalsaMailboxNode *
-balsa_find_dir(LibBalsaServer *server,
-               const gchar    *path)
+balsa_find_dir(LibBalsaServer *server, const gchar * path)
 {
     BalsaFind bf;
 
@@ -664,17 +616,14 @@ balsa_find_dir(LibBalsaServer *server,
     bf.server = server;
     bf.mbnode = NULL;
     gtk_tree_model_foreach(GTK_TREE_MODEL(balsa_app.mblist_tree_store),
-                           (GtkTreeModelForeachFunc) find_path, &bf);
+                          (GtkTreeModelForeachFunc) find_path, &bf);
 
     return bf.mbnode;
 }
 
-
 static gint
-find_url(GtkTreeModel *model,
-         GtkTreePath  *path,
-         GtkTreeIter  *iter,
-         BalsaFind    *bf)
+find_url(GtkTreeModel * model, GtkTreePath * path, GtkTreeIter * iter,
+        BalsaFind * bf)
 {
     BalsaMailboxNode *mbnode;
     LibBalsaMailbox *mailbox;
@@ -689,23 +638,21 @@ find_url(GtkTreeModel *model,
     return FALSE;
 }
 
-
 /* balsa_find_url:
  * looks for a mailbox node with the given url.
  * returns NULL on failure; caller must unref mbnode when non-NULL.
  */
 
 BalsaMailboxNode *
-balsa_find_url(const gchar *url)
+balsa_find_url(const gchar * url)
 {
     BalsaFind bf;
 
     bf.data = url;
     bf.mbnode = NULL;
 
-    if (balsa_app.mblist_tree_store) {
+    if (balsa_app.mblist_tree_store)
         g_object_ref(balsa_app.mblist_tree_store);
-    }
     /*
      * Check again, in case the main thread managed to finalize
      * balsa_app.mblist_tree_store between the check and the object-ref.
@@ -720,34 +667,31 @@ balsa_find_url(const gchar *url)
     return bf.mbnode;
 }
 
-
 /* balsa_find_mailbox_by_url:
  * looks for a mailbox with the given url.
  * returns NULL on failure
  */
 LibBalsaMailbox *
-balsa_find_mailbox_by_url(const gchar *url)
+balsa_find_mailbox_by_url(const gchar * url)
 {
     BalsaMailboxNode *mbnode;
     LibBalsaMailbox *mailbox = NULL;
 
     if ((mbnode = balsa_find_url(url))) {
-        mailbox = mbnode->mailbox;
-        g_object_unref(mbnode);
+       mailbox = mbnode->mailbox;
+       g_object_unref(mbnode);
     }
     return mailbox;
 }
 
-
-LibBalsaMailbox *
+LibBalsaMailbox*
 balsa_find_sentbox_by_url(const gchar *url)
 {
     LibBalsaMailbox *res = balsa_find_mailbox_by_url(url);
     return res ? res : balsa_app.sentbox;
 }
 
-
-gchar *
+gchar*
 balsa_get_short_mailbox_name(const gchar *url)
 {
     BalsaMailboxNode *mbnode;
@@ -763,7 +707,6 @@ balsa_get_short_mailbox_name(const gchar *url)
     return g_strdup(url);
 }
 
-
 struct balsa_find_iter_by_data_info {
     GtkTreeIter *iter;
     gpointer data;
@@ -771,40 +714,34 @@ struct balsa_find_iter_by_data_info {
 };
 
 static gboolean
-balsa_find_iter_by_data_func(GtkTreeModel *model,
-                             GtkTreePath  *path,
-                             GtkTreeIter  *iter,
-                             gpointer      user_data)
+balsa_find_iter_by_data_func(GtkTreeModel * model, GtkTreePath * path,
+                              GtkTreeIter * iter, gpointer user_data)
 {
     struct balsa_find_iter_by_data_info *bf = user_data;
     BalsaMailboxNode *mbnode = NULL;
 
     gtk_tree_model_get(model, iter, 0, &mbnode, -1);
-    if (!mbnode) {
+    if(!mbnode)
         return FALSE;
-    }
-    if ((mbnode == bf->data) || (mbnode->mailbox == bf->data)) {
-        *bf->iter = *iter;
-        bf->found = TRUE;
+    if (mbnode == bf->data || mbnode->mailbox == bf->data) {
+       *bf->iter = *iter;
+       bf->found = TRUE;
     }
     g_object_unref(mbnode);
 
     return bf->found;
 }
 
-
 gboolean
-balsa_find_iter_by_data(GtkTreeIter *iter,
-                        gpointer     data)
+balsa_find_iter_by_data(GtkTreeIter * iter , gpointer data)
 {
     struct balsa_find_iter_by_data_info bf;
     GtkTreeModel *model;
 
     /* We may call it from initial config, it's ok for
        mblist_tree_store not to exist. */
-    if (!balsa_app.mblist_tree_store) {
+    if(!balsa_app.mblist_tree_store)
         return FALSE;
-    }
 
     model = GTK_TREE_MODEL(balsa_app.mblist_tree_store);
 
@@ -816,85 +753,77 @@ balsa_find_iter_by_data(GtkTreeIter *iter,
     return bf.found;
 }
 
-
 /* End of search utilities. */
 
 /* balsa_remove_children_mailbox_nodes:
    remove all children of given node leaving the node itself intact.
  */
 static void
-ba_remove_children_mailbox_nodes(GtkTreeModel *model,
-                                 GtkTreeIter  *parent,
-                                 GSList      **specials)
+ba_remove_children_mailbox_nodes(GtkTreeModel * model, GtkTreeIter * parent,
+                                GSList ** specials)
 {
     GtkTreeIter iter;
     BalsaMailboxNode *mbnode;
     gboolean valid;
 
-    if (!gtk_tree_model_iter_children(model, &iter, parent)) {
-        return;
-    }
+    if (!gtk_tree_model_iter_children(model, &iter, parent))
+       return;
 
     do {
-        gtk_tree_model_get(model, &iter, 0, &mbnode, -1);
-        if (mbnode->parent) {
-            LibBalsaMailbox *mailbox = mbnode->mailbox;
-            if ((mailbox == balsa_app.inbox)
-                || (mailbox == balsa_app.outbox)
-                || (mailbox == balsa_app.sentbox)
-                || (mailbox == balsa_app.draftbox)
-                || (mailbox == balsa_app.trash)) {
-                g_object_ref(mailbox);
-                *specials = g_slist_prepend(*specials, mailbox);
-            }
-            ba_remove_children_mailbox_nodes(model, &iter, specials);
-            valid =
-                gtk_tree_store_remove(balsa_app.mblist_tree_store, &iter);
-        } else {
-            printf("sparing %s %s\n",
-                   mbnode->mailbox ? "mailbox" : "folder ",
-                   mbnode->mailbox ? mbnode->mailbox->name : mbnode->name);
-            valid = gtk_tree_model_iter_next(model, &iter);
-        }
-        g_object_unref(mbnode);
+       gtk_tree_model_get(model, &iter, 0, &mbnode, -1);
+       if (mbnode->parent) {
+           LibBalsaMailbox *mailbox = mbnode->mailbox;
+           if (mailbox == balsa_app.inbox
+               || mailbox == balsa_app.outbox
+               || mailbox == balsa_app.sentbox
+               || mailbox == balsa_app.draftbox
+               || mailbox == balsa_app.trash) {
+               g_object_ref(mailbox);
+               *specials = g_slist_prepend(*specials, mailbox);
+           }
+           ba_remove_children_mailbox_nodes(model, &iter, specials);
+           valid =
+               gtk_tree_store_remove(balsa_app.mblist_tree_store, &iter);
+       } else {
+           printf("sparing %s %s\n",
+                  mbnode->mailbox ? "mailbox" : "folder ",
+                  mbnode->mailbox ? mbnode->mailbox->name : mbnode->name);
+           valid = gtk_tree_model_iter_next(model, &iter);
+       }
+       g_object_unref(mbnode); 
     } while (valid);
 }
 
-
 void
-balsa_remove_children_mailbox_nodes(BalsaMailboxNode *mbnode)
+balsa_remove_children_mailbox_nodes(BalsaMailboxNode * mbnode)
 {
     GtkTreeModel *model = GTK_TREE_MODEL(balsa_app.mblist_tree_store);
     GtkTreeIter parent;
     GtkTreeIter *iter = NULL;
     GSList *specials = NULL, *l;
 
-    if (balsa_app.debug) {
-        printf("Destroying children of %p %s\n",
-               mbnode, mbnode && mbnode->name ? mbnode->name : "");
-    }
+    if (balsa_app.debug)
+       printf("Destroying children of %p %s\n",
+              mbnode, mbnode && mbnode->name ? mbnode->name : "");
 
-    if (mbnode && balsa_find_iter_by_data(&parent, mbnode)) {
-        iter = &parent;
-    }
+    if (mbnode && balsa_find_iter_by_data(&parent, mbnode))
+       iter = &parent;
 
     ba_remove_children_mailbox_nodes(model, iter, &specials);
 
-    for (l = specials; l; l = l->next) {
+    for (l = specials; l; l = l->next)
         balsa_mblist_mailbox_node_append(NULL,
                                          balsa_mailbox_node_new_from_mailbox
-                                             (l->data));
-    }
+                                         (l->data));
     g_slist_free(specials);
 }
 
-
 /* balsa_find_index_by_mailbox:
-   returns BalsaIndex displaying passed mailbox, or NULL, if mailbox is
+   returns BalsaIndex displaying passed mailbox, or NULL, if mailbox is 
    not displayed.
- */
-BalsaIndex *
-balsa_find_index_by_mailbox(LibBalsaMailbox *mailbox)
+*/
+BalsaIndex*
+balsa_find_index_by_mailbox(LibBalsaMailbox * mailbox)
 {
     GtkWidget *page;
     GtkWidget *index;
@@ -902,32 +831,30 @@ balsa_find_index_by_mailbox(LibBalsaMailbox *mailbox)
     g_return_val_if_fail(balsa_app.notebook, NULL);
 
     for (i = 0;
-         (page =
-              gtk_notebook_get_nth_page(GTK_NOTEBOOK(balsa_app.notebook), i));
-         i++) {
+        (page =
+         gtk_notebook_get_nth_page(GTK_NOTEBOOK(balsa_app.notebook), i));
+        i++) {
         index = gtk_bin_get_child(GTK_BIN(page));
-        if (index && BALSA_INDEX(index)->mailbox_node
-            && (BALSA_INDEX(index)->mailbox_node->mailbox == mailbox)) {
-            return BALSA_INDEX(index);
-        }
+       if (index && BALSA_INDEX(index)->mailbox_node
+            && BALSA_INDEX(index)->mailbox_node->mailbox == mailbox)
+           return BALSA_INDEX(index);
     }
 
     /* didn't find a matching mailbox */
     return NULL;
 }
 
-
 GRegex *
 balsa_quote_regex_new(void)
 {
-    static GRegex *regex = NULL;
-    static gchar *string = NULL;
+    static GRegex *regex  = NULL;
+    static gchar  *string = NULL;
 
     if (g_strcmp0(string, balsa_app.quote_regex) != 0) {
         /* We have not initialized the GRegex, or balsa_app.quote_regex
          * has changed. */
         g_clear_pointer(&string, (GDestroyNotify) g_free);
-        g_clear_pointer(&regex, (GDestroyNotify) g_regex_unref);
+        g_clear_pointer(&regex,  (GDestroyNotify) g_regex_unref);
     }
 
     if (regex == NULL) {
diff --git a/src/balsa-app.h b/src/balsa-app.h
index 7cc6e60..985a905 100644
--- a/src/balsa-app.h
+++ b/src/balsa-app.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -21,7 +21,7 @@
 #define __BALSA_APP_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include "libbalsa.h"
@@ -36,11 +36,8 @@
 
 /* Work around nonprivileged installs so we can find icons */
 #ifdef BALSA_LOCAL_INSTALL
-#   define gnome_pixmap_file( s ) g_strconcat( BALSA_RESOURCE_PREFIX, "/pixmaps/", s, NULL )
-#   define gnome_unconditional_pixmap_file( s ) g_strconcat( BALSA_RESOURCE_PREFIX, \
-                                                             "/pixmaps", \
-                                                             s, \
-                                                             NULL )
+#define gnome_pixmap_file( s ) g_strconcat( BALSA_RESOURCE_PREFIX, "/pixmaps/", s, NULL ) 
+#define gnome_unconditional_pixmap_file( s ) g_strconcat( BALSA_RESOURCE_PREFIX, "/pixmaps", s, NULL ) 
 #endif
 
 /* global definitions */
@@ -135,10 +132,10 @@ extern struct BalsaApplication {
     GtkApplication *application;
 
     /* personal information */
-    GList *identities;
-    LibBalsaIdentity *current_ident;
+    GList* identities;
+    LibBalsaIdentity* current_ident;
 
-    GSList *filters;
+    GSList* filters;
 
     gchar *local_mail_directory;
 
@@ -153,8 +150,7 @@ extern struct BalsaApplication {
     GtkTreeStore *mblist_tree_store;
 
     LibBalsaMailbox *inbox;
-    GList *inbox_input;         /* mailboxes such as POP3, etc that will be appending into inbox
-                                 */
+    GList *inbox_input;                /* mailboxes such as POP3, etc that will be appending into inbox */
     LibBalsaMailbox *sentbox;
     LibBalsaMailbox *draftbox;
     LibBalsaMailbox *outbox;
@@ -176,7 +172,7 @@ extern struct BalsaApplication {
     /* system wide sound event and you want Balsa to behave differently */
     /* There is no prefs setting for this item */
     gint notify_new_mail_sound;
-
+    
     gint notify_new_mail_dialog;
     gint notify_new_mail_icon;
 
@@ -186,7 +182,7 @@ extern struct BalsaApplication {
 
     /* automatically expunge mailboxes after XX hours */
     gboolean expunge_auto;
-    gint expunge_timeout;       /* seconds */
+    gint expunge_timeout;      /* seconds */
 
     gint check_imap;
     gint check_imap_inbox;
@@ -225,7 +221,7 @@ extern struct BalsaApplication {
     gint index_size_width;
 
     /*gint mblist_height; PKGW: unused */
-    gint notebook_height;       /* PKGW: used :-) */
+    gint notebook_height;      /* PKGW: used :-) */
 
     /* Column width settings for mailbox list window, not fully implemented yet */
     gint mblist_name_width;
@@ -253,9 +249,7 @@ extern struct BalsaApplication {
     gboolean expand_tree;
     gboolean show_mblist;
     gboolean show_notebook_tabs;
-    enum {
-        LAYOUT_DEFAULT, LAYOUT_WIDE_MSG, LAYOUT_WIDE_SCREEN
-    } layout_type;
+    enum { LAYOUT_DEFAULT, LAYOUT_WIDE_MSG, LAYOUT_WIDE_SCREEN } layout_type;
     gboolean view_message_on_open;
     gboolean ask_before_select;
     gboolean pgdownmod;
@@ -308,7 +302,7 @@ extern struct BalsaApplication {
     /* list of currently open mailboxes */
     GList *open_mailbox_list;  /* data is a pointer to the mailbox */
     gchar *current_mailbox_url;/* remember for next session */
-
+    
     /* fonts */
     gboolean use_system_fonts;
     gchar *message_font;
@@ -324,9 +318,9 @@ extern struct BalsaApplication {
     gdouble margin_top;
     gdouble margin_right;
     gdouble margin_bottom;
-    gchar *print_header_font;  /* font for printing headers */
-    gchar *print_body_font;    /* font for printing text parts */
-    gchar *print_footer_font;  /* font for printing footers */
+    gchar* print_header_font;  /* font for printing headers */
+    gchar* print_body_font;    /* font for printing text parts */
+    gchar* print_footer_font;  /* font for printing footers */
     gboolean print_highlight_cited;
     gboolean print_highlight_phrases;
 
@@ -347,7 +341,7 @@ extern struct BalsaApplication {
     LibBalsaAddressBook *default_address_book;
 
     /* spell checking */
-    gchar *spell_check_lang;
+    gchar   *spell_check_lang;
 #if HAVE_GSPELL || HAVE_GTKSPELL
     gboolean spell_check_active;
 #else                           /* HAVE_GSPELL */
@@ -377,7 +371,7 @@ extern struct BalsaApplication {
     /* gpgme stuff */
     gboolean has_openpgp;
     gboolean has_smime;
-#endif
+#endif 
 
     /* Most recently used lists */
     GList *folder_mru;
@@ -390,38 +384,32 @@ extern struct BalsaApplication {
     int default_client;
 } balsa_app;
 
-#define BALSA_IS_MAILBOX_SPECIAL(a) ((a) == balsa_app.inbox || (a) == balsa_app.trash || \
-                                     (a) == balsa_app.outbox || (a) == balsa_app.draftbox || \
-                                     (a) == balsa_app.sentbox)
+#define BALSA_IS_MAILBOX_SPECIAL(a) ((a)==balsa_app.inbox || (a)==balsa_app.trash || 
(a)==balsa_app.outbox||(a)==balsa_app.draftbox || (a)==balsa_app.sentbox)
 
 void balsa_app_init(void);
 void balsa_app_destroy(void);
-void update_timer(gboolean update,
-                  guint    minutes);
+void update_timer(gboolean update, guint minutes);
 
-gchar *ask_password(LibBalsaServer  *server,
-                    LibBalsaMailbox *mbox);
-void balsa_open_mailbox_list(gchar **urls);
+gchar *ask_password(LibBalsaServer * server, LibBalsaMailbox * mbox);
+void balsa_open_mailbox_list(gchar ** urls);
 
 /* Search functions */
-BalsaMailboxNode *balsa_find_mailbox(LibBalsaMailbox *mailbox);
-BalsaMailboxNode *balsa_find_dir(LibBalsaServer *server,
-                                 const gchar    *path);
-BalsaMailboxNode *balsa_find_url(const gchar *url);
-LibBalsaMailbox *balsa_find_mailbox_by_url(const gchar *url);
-LibBalsaMailbox *balsa_find_sentbox_by_url(const gchar *url);
-void balsa_add_open_mailbox_urls(GPtrArray *url_array);
+BalsaMailboxNode *balsa_find_mailbox(LibBalsaMailbox * mailbox);
+BalsaMailboxNode *balsa_find_dir(LibBalsaServer *server, const gchar * path);
+BalsaMailboxNode *balsa_find_url(const gchar * url);
+LibBalsaMailbox *balsa_find_mailbox_by_url(const gchar * url);
+LibBalsaMailbox *balsa_find_sentbox_by_url(const gchar * url);
+void balsa_add_open_mailbox_urls(GPtrArray * url_array);
 
 /** Returns a short mailbox name that identifies the host. This is
     longer than LibBalsaMailbox::name which contains only filename
     without information about mailbox's location in the hierarchy. */
-gchar *balsa_get_short_mailbox_name(const gchar *url);
-gboolean balsa_find_iter_by_data(GtkTreeIter *iter,
-                                 gpointer     data);
-BalsaIndex *balsa_find_index_by_mailbox(LibBalsaMailbox *mailbox);
+gchar *balsa_get_short_mailbox_name(const gchar * url);
+gboolean balsa_find_iter_by_data(GtkTreeIter * iter, gpointer data);
+BalsaIndex* balsa_find_index_by_mailbox(LibBalsaMailbox* mailbox);
 
-void  balsa_remove_children_mailbox_nodes(BalsaMailboxNode *mbnode);
+void  balsa_remove_children_mailbox_nodes(BalsaMailboxNode * mbnode);
 
 GRegex *balsa_quote_regex_new(void);
 
-#endif                          /* __BALSA_APP_H__ */
+#endif                         /* __BALSA_APP_H__ */
diff --git a/src/balsa-cite-bar.c b/src/balsa-cite-bar.c
index 56bc60c..1bece82 100644
--- a/src/balsa-cite-bar.c
+++ b/src/balsa-cite-bar.c
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -35,22 +35,22 @@ struct _BalsaCiteBarClass {
     GtkWidgetClass parent_class;
 };
 
-static void balsa_cite_bar_measure(GtkWidget     *widget,
-                                   GtkOrientation orientation,
-                                   gint           for_size,
-                                   gint          *minimum,
-                                   gint          *natural,
-                                   gint          *minimum_baseline,
-                                   gint          *natural_baseline);
-static void balsa_cite_bar_snapshot(GtkWidget   *widget,
-                                    GtkSnapshot *snapshot);
+static void balsa_cite_bar_measure  (GtkWidget    * widget,
+                                     GtkOrientation orientation,
+                                     gint           for_size,
+                                     gint         * minimum,
+                                     gint         * natural,
+                                     gint         * minimum_baseline,
+                                     gint         * natural_baseline);
+static void balsa_cite_bar_snapshot (GtkWidget * widget,
+                                     GtkSnapshot * snapshot);
 
 G_DEFINE_TYPE(BalsaCiteBar, balsa_cite_bar, GTK_TYPE_WIDGET)
 
-static GtkWidgetClass * parent_class = NULL;
+static GtkWidgetClass *parent_class = NULL;
 
 static void
-balsa_cite_bar_class_init(BalsaCiteBarClass *class)
+balsa_cite_bar_class_init(BalsaCiteBarClass * class)
 {
     GtkWidgetClass *widget_class;
 
@@ -58,22 +58,18 @@ balsa_cite_bar_class_init(BalsaCiteBarClass *class)
 
     parent_class = g_type_class_peek_parent(class);
 
-    widget_class->measure = balsa_cite_bar_measure;
+    widget_class->measure  = balsa_cite_bar_measure;
     widget_class->snapshot = balsa_cite_bar_snapshot;
 }
 
-
 static void
-balsa_cite_bar_init(BalsaCiteBar *cite_bar)
+balsa_cite_bar_init(BalsaCiteBar * cite_bar)
 {
     gtk_widget_set_has_window(GTK_WIDGET(cite_bar), FALSE);
 }
 
-
 GtkWidget *
-balsa_cite_bar_new(gint height,
-                   gint bars,
-                   gint dimension)
+balsa_cite_bar_new(gint height, gint bars, gint dimension)
 {
     BalsaCiteBar *cite_bar;
 
@@ -87,18 +83,15 @@ balsa_cite_bar_new(gint height,
     /* the width is 1/4 of the dimension, the spaceing 3/4, but both
      * at least 1 pixel */
     cite_bar->width = dimension / 4;
-    if (cite_bar->width == 0) {
+    if (cite_bar->width == 0)
         cite_bar->width = 1;
-    }
     cite_bar->space = dimension - cite_bar->width;
 
     return GTK_WIDGET(cite_bar);
 }
 
-
 void
-balsa_cite_bar_resize(BalsaCiteBar *cite_bar,
-                      gint          height)
+balsa_cite_bar_resize(BalsaCiteBar * cite_bar, gint height)
 {
     g_return_if_fail(BALSA_IS_CITE_BAR(cite_bar));
 
@@ -106,15 +99,14 @@ balsa_cite_bar_resize(BalsaCiteBar *cite_bar,
     gtk_widget_queue_resize(GTK_WIDGET(cite_bar));
 }
 
-
 static void
-balsa_cite_bar_measure(GtkWidget     *widget,
+balsa_cite_bar_measure(GtkWidget    * widget,
                        GtkOrientation orientation,
                        gint           for_size,
-                       gint          *minimum,
-                       gint          *natural,
-                       gint          *minimum_baseline,
-                       gint          *natural_baseline)
+                       gint         * minimum,
+                       gint         * natural,
+                       gint         * minimum_baseline,
+                       gint         * natural_baseline)
 {
     BalsaCiteBar *cite_bar;
 
@@ -122,18 +114,16 @@ balsa_cite_bar_measure(GtkWidget     *widget,
 
     if (orientation == GTK_ORIENTATION_HORIZONTAL) {
         *minimum = *natural =
-                cite_bar->bars * (cite_bar->width + cite_bar->space) -
-                cite_bar->space;
+            cite_bar->bars * (cite_bar->width + cite_bar->space) -
+            cite_bar->space;
     } else {
         *minimum = *natural = cite_bar->height;
         *minimum_baseline = *natural_baseline = 0;
     }
 }
 
-
 static void
-balsa_cite_bar_snapshot(GtkWidget   *widget,
-                        GtkSnapshot *snapshot)
+balsa_cite_bar_snapshot(GtkWidget * widget, GtkSnapshot * snapshot)
 {
     GtkStyleContext *context;
     GdkRGBA rgba;
diff --git a/src/balsa-cite-bar.h b/src/balsa-cite-bar.h
index fe73f10..838fe87 100644
--- a/src/balsa-cite-bar.h
+++ b/src/balsa-cite-bar.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -27,28 +27,23 @@ G_BEGIN_DECLS
 
 
 #define BALSA_TYPE_CITE_BAR            (balsa_cite_bar_get_type())
-#define BALSA_CITE_BAR(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), BALSA_TYPE_CITE_BAR, \
-                                                                   BalsaCiteBar))
-#define BALSA_CITE_BAR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), BALSA_TYPE_CITE_BAR, \
-                                                                BalsaCiteBarClass))
+#define BALSA_CITE_BAR(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), BALSA_TYPE_CITE_BAR, BalsaCiteBar))
+#define BALSA_CITE_BAR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), BALSA_TYPE_CITE_BAR, 
BalsaCiteBarClass))
 #define BALSA_IS_CITE_BAR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), BALSA_TYPE_CITE_BAR))
 #define BALSA_IS_CITE_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), BALSA_TYPE_CITE_BAR))
-#define BALSA_CITE_BAR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), BALSA_TYPE_CITE_BAR, \
-                                                                  BalsaCiteBarClass))
+#define BALSA_CITE_BAR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), BALSA_TYPE_CITE_BAR, 
BalsaCiteBarClass))
 
 
-typedef struct _BalsaCiteBar BalsaCiteBar;
-typedef struct _BalsaCiteBarClass BalsaCiteBarClass;
+typedef struct _BalsaCiteBar        BalsaCiteBar;
+typedef struct _BalsaCiteBarClass   BalsaCiteBarClass;
 
-GType      balsa_cite_bar_get_type(void) G_GNUC_CONST;
-GtkWidget *balsa_cite_bar_new(gint height,
-                              gint bars,
-                              gint dimension);
-void       balsa_cite_bar_resize(BalsaCiteBar *cite_bar,
-                                 gint          height);
+GType      balsa_cite_bar_get_type   (void) G_GNUC_CONST;
+GtkWidget* balsa_cite_bar_new        (gint height, gint bars, gint dimension);
+void       balsa_cite_bar_resize     (BalsaCiteBar *cite_bar, gint height);
 
 
 G_END_DECLS
 
 
 #endif /* __BALSA_CITE_BAR_H__ */
+
diff --git a/src/balsa-icons.c b/src/balsa-icons.c
index a0eb3ed..018a290 100644
--- a/src/balsa-icons.c
+++ b/src/balsa-icons.c
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -20,7 +20,7 @@
 #include <string.h>
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-icons.h"
 
@@ -30,67 +30,64 @@
 
 /* comment out the next line to suppress info about loading images */
 #if 0
-#   define BICONS_VERBOSE
+#define BICONS_VERBOSE
 #endif
 
 #ifdef BICONS_VERBOSE
-#   define BICONS_LOG(...)   g_message(__VA_ARGS__)
-#   define BICONS_ERR(...)   g_warning(__VA_ARGS__)
+#  define BICONS_LOG(...)   g_message(__VA_ARGS__)
+#  define BICONS_ERR(...)   g_warning(__VA_ARGS__)
 #else
-#   define BICONS_LOG(...)
-#   define BICONS_ERR(...)
+#  define BICONS_LOG(...)
+#  define BICONS_ERR(...)
 #endif
 
 
 #define BALSA_PIXMAP_SIZES     2
 typedef struct {
-    const gchar *name;
-    const gchar *stock_id;
+    const gchar * name;
+    const gchar * stock_id;
 } balsa_pixmap_t;
 
 typedef struct {
-    const gchar *def_id;
-    const gchar *fb_id;
+    const gchar * def_id;
+    const gchar * fb_id;
 } pixmap_fallback_t;
 
 static GHashTable *balsa_icon_table;
 
 static void
-load_balsa_pixmap(GtkIconTheme         *icon_theme,
-                  const balsa_pixmap_t *bpixmap)
+load_balsa_pixmap(GtkIconTheme *icon_theme, const balsa_pixmap_t *bpixmap)
 {
-    const gchar *use_id;
+    const gchar * use_id;
     static pixmap_fallback_t fallback_id[] = {
-        { "user-trash", "edit-delete" },
-        { "user-trash-full", "edit-delete" },
-        { "emblem-important", "stock_mail-flag-for-followup"},
+       { "user-trash", "edit-delete" },
+       { "user-trash-full", "edit-delete" },
+       { "emblem-important", "stock_mail-flag-for-followup"},
         { "mail-reply-sender", "mail-replied"},
         { "stock_mail-reply-to-all", "mail-replied"},
         { "mail-forward", "mail-replied"},
         { "folder-drag-accept", "document-open"},
-        { NULL, NULL }
-    };
+       { NULL, NULL } };
 
     BICONS_LOG("loading icon %s (stock id %s)", bpixmap->name,
-               bpixmap->stock_id);
+              bpixmap->stock_id);
 
     /* check if the icon theme knows the icon and try to fall back to an
      * alternative name if not */
     if (!gtk_icon_theme_has_icon(icon_theme, bpixmap->stock_id)) {
-        pixmap_fallback_t *fb = fallback_id;
-        while (fb->def_id && strcmp(fb->def_id, bpixmap->stock_id)) {
-            fb++;
-        }
-        if (fb->def_id) {
-            use_id = fb->fb_id;
+       pixmap_fallback_t *fb = fallback_id;
+       while (fb->def_id && strcmp(fb->def_id, bpixmap->stock_id))
+           fb++;
+       if (fb->def_id) {
+           use_id = fb->fb_id;
             BICONS_LOG("\t(%s not found, fall back to %s)",
                        bpixmap->stock_id, use_id);
         } else {
-            BICONS_ERR("icon %s unknown, no fallback", bpixmap->stock_id);
-            use_id = "image-missing";
-        }
+           BICONS_ERR("icon %s unknown, no fallback", bpixmap->stock_id);
+           use_id = "image-missing";
+       }
     } else {
-        use_id = bpixmap->stock_id;
+       use_id = bpixmap->stock_id;
     }
 
     BICONS_LOG("\tuse_id %s", use_id);
@@ -98,85 +95,84 @@ load_balsa_pixmap(GtkIconTheme         *icon_theme,
                         g_strdup(use_id));
 }
 
-
 void
 balsa_register_pixmaps(void)
 {
     const balsa_pixmap_t balsa_icons[] = {
-        /* icons for buttons and menus (24x24 and 16x16) */
-        { BALSA_PIXMAP_COMPOSE, "mail-message-new" },
-        { BALSA_PIXMAP_REPLY, "mail-reply-sender" },
-        { BALSA_PIXMAP_REPLY_GROUP, "stock_mail-reply-to-all" },
-        { BALSA_PIXMAP_REQUEST_MDN, "mail-reply-sender" },
-        { BALSA_PIXMAP_SEND, "mail-send" },
-        { BALSA_PIXMAP_RECEIVE, "stock_mail-receive" },
-        { BALSA_PIXMAP_SEND_RECEIVE, "mail-send-receive" },
-        { BALSA_PIXMAP_QUEUE, "mail-queue" },
-        { BALSA_PIXMAP_SEND_QUEUED, "balsa-send-queued" },
-        { BALSA_PIXMAP_FORWARD, "mail-forward" },
-        { BALSA_PIXMAP_IDENTITY, "stock_contact" },
-        { BALSA_PIXMAP_CONTINUE, "stock_mail" },
-        { BALSA_PIXMAP_POSTPONE, "balsa-postpone" },
-        { BALSA_PIXMAP_REPLY_ALL, "balsa-reply-all" },
-        { BALSA_PIXMAP_NEXT_PART, "balsa-next-part" },
-        { BALSA_PIXMAP_PREVIOUS_PART, "balsa-previous-part" },
-        { BALSA_PIXMAP_MARK_ALL, "balsa-mark-all" },
-        { BALSA_PIXMAP_ATTACHMENT, "mail-attachment" },
-        { BALSA_PIXMAP_NEXT, "balsa-next" },
-        { BALSA_PIXMAP_PREVIOUS, "balsa-previous" },
-        { BALSA_PIXMAP_NEXT_UNREAD, "balsa-next-unread" },
-        { BALSA_PIXMAP_NEXT_FLAGGED, "balsa-next-flagged" },
+       /* icons for buttons and menus (24x24 and 16x16) */
+       { BALSA_PIXMAP_COMPOSE,         "mail-message-new" },
+       { BALSA_PIXMAP_REPLY,           "mail-reply-sender" },
+       { BALSA_PIXMAP_REPLY_GROUP,     "stock_mail-reply-to-all" },
+       { BALSA_PIXMAP_REQUEST_MDN,     "mail-reply-sender" },
+       { BALSA_PIXMAP_SEND,            "mail-send" },
+       { BALSA_PIXMAP_RECEIVE,         "stock_mail-receive" },
+       { BALSA_PIXMAP_SEND_RECEIVE,    "mail-send-receive" },
+       { BALSA_PIXMAP_QUEUE,           "mail-queue" },
+       { BALSA_PIXMAP_SEND_QUEUED,             "balsa-send-queued" },
+       { BALSA_PIXMAP_FORWARD,         "mail-forward" },
+       { BALSA_PIXMAP_IDENTITY,        "stock_contact" },
+       { BALSA_PIXMAP_CONTINUE,        "stock_mail" },
+       { BALSA_PIXMAP_POSTPONE,        "balsa-postpone" },
+       { BALSA_PIXMAP_REPLY_ALL,       "balsa-reply-all" },
+       { BALSA_PIXMAP_NEXT_PART,       "balsa-next-part" },
+       { BALSA_PIXMAP_PREVIOUS_PART,   "balsa-previous-part" },
+       { BALSA_PIXMAP_MARK_ALL,        "balsa-mark-all" },
+       { BALSA_PIXMAP_ATTACHMENT,      "mail-attachment" },
+       { BALSA_PIXMAP_NEXT,            "balsa-next" },
+       { BALSA_PIXMAP_PREVIOUS,        "balsa-previous" },
+       { BALSA_PIXMAP_NEXT_UNREAD,     "balsa-next-unread" },
+       { BALSA_PIXMAP_NEXT_FLAGGED,    "balsa-next-flagged" },
 
 #ifdef HAVE_GPGME
-        /* crypto status icons, for both the structure view tree (24x24)
-         * and the index (16x16) */
-        { BALSA_PIXMAP_SIGN, "balsa-signature-unknown" },
-        { BALSA_PIXMAP_SIGN_GOOD, "balsa-signature-good" },
-        { BALSA_PIXMAP_SIGN_NOTRUST, "balsa-signature-notrust" },
-        { BALSA_PIXMAP_SIGN_BAD, "balsa-signature-bad" },
-        { BALSA_PIXMAP_ENCR, "balsa-encrypted" },
+       /* crypto status icons, for both the structure view tree (24x24)
+        * and the index (16x16) */
+        { BALSA_PIXMAP_SIGN,            "balsa-signature-unknown" },
+        { BALSA_PIXMAP_SIGN_GOOD,       "balsa-signature-good" },
+       { BALSA_PIXMAP_SIGN_NOTRUST,    "balsa-signature-notrust" },
+        { BALSA_PIXMAP_SIGN_BAD,        "balsa-signature-bad" },
+        { BALSA_PIXMAP_ENCR,            "balsa-encrypted" },
 #endif
 
-        /* the following book icons aren't strictly necessary as Gnome provides
-           them. However, this simplifies porting balsa if the Gnome libs
-           aren't present... */
-        { BALSA_PIXMAP_BOOK_RED, "stock_book_red" },
-        { BALSA_PIXMAP_BOOK_YELLOW, "stock_book_yellow" },
-        { BALSA_PIXMAP_BOOK_GREEN, "stock_book_green" },
-        { BALSA_PIXMAP_BOOK_BLUE, "stock_book_blue" },
-        { BALSA_PIXMAP_BOOK_OPEN, "stock_book_open" },
-
-        /* button-only icons */
-        { BALSA_PIXMAP_SHOW_HEADERS, "stock_view-fields" },
-        { BALSA_PIXMAP_SHOW_PREVIEW, "balsa-preview" },
-        { BALSA_PIXMAP_MARKED_NEW, "balsa-marked-new" },
-        { BALSA_PIXMAP_TRASH_EMPTY, "balsa-trash-empty" },
+       /* the following book icons aren't strictly necessary as Gnome provides
+          them. However, this simplifies porting balsa if the Gnome libs
+          aren't present... */
+        { BALSA_PIXMAP_BOOK_RED,        "stock_book_red" },
+        { BALSA_PIXMAP_BOOK_YELLOW,     "stock_book_yellow" },
+        { BALSA_PIXMAP_BOOK_GREEN,      "stock_book_green" },
+        { BALSA_PIXMAP_BOOK_BLUE,       "stock_book_blue" },
+        { BALSA_PIXMAP_BOOK_OPEN,       "stock_book_open" },
+
+       /* button-only icons */
+       { BALSA_PIXMAP_SHOW_HEADERS,    "stock_view-fields" },
+       { BALSA_PIXMAP_SHOW_PREVIEW,    "balsa-preview" },
+       { BALSA_PIXMAP_MARKED_NEW,      "balsa-marked-new" },
+       { BALSA_PIXMAP_TRASH_EMPTY,     "balsa-trash-empty" },
 #ifdef HAVE_GPGME
-        { BALSA_PIXMAP_GPG_SIGN, "balsa-sign" },
-        { BALSA_PIXMAP_GPG_ENCRYPT, "balsa-encrypt" },
-        { BALSA_PIXMAP_GPG_RECHECK, "balsa-crypt-check" },
+       { BALSA_PIXMAP_GPG_SIGN,        "balsa-sign" },
+       { BALSA_PIXMAP_GPG_ENCRYPT,     "balsa-encrypt" },
+       { BALSA_PIXMAP_GPG_RECHECK,     "balsa-crypt-check" },
 #endif
 
-        /* mailbox icons (16x16) */
-        { BALSA_PIXMAP_MBOX_IN, "mail-inbox" },
-        { BALSA_PIXMAP_MBOX_OUT, "mail-outbox" },
-        { BALSA_PIXMAP_MBOX_DRAFT, "balsa-mbox-draft" },
-        { BALSA_PIXMAP_MBOX_SENT, "balsa-mbox-sent" },
-        { BALSA_PIXMAP_MBOX_TRASH, "user-trash" },
+       /* mailbox icons (16x16) */
+        { BALSA_PIXMAP_MBOX_IN,         "mail-inbox" },
+        { BALSA_PIXMAP_MBOX_OUT,        "mail-outbox" },
+        { BALSA_PIXMAP_MBOX_DRAFT,      "balsa-mbox-draft" },
+        { BALSA_PIXMAP_MBOX_SENT,       "balsa-mbox-sent" },
+        { BALSA_PIXMAP_MBOX_TRASH,      "user-trash" },
         { BALSA_PIXMAP_MBOX_TRASH_FULL, "user-trash-full" },
-        { BALSA_PIXMAP_MBOX_TRAY_FULL, "balsa-mbox-tray-full" },
+        { BALSA_PIXMAP_MBOX_TRAY_FULL,  "balsa-mbox-tray-full" },
         { BALSA_PIXMAP_MBOX_TRAY_EMPTY, "balsa-mbox-tray-empty" },
-        { BALSA_PIXMAP_MBOX_DIR_OPEN, "folder-drag-accept" },
+        { BALSA_PIXMAP_MBOX_DIR_OPEN,   "folder-drag-accept" },
         { BALSA_PIXMAP_MBOX_DIR_CLOSED, "folder" },
 
-        /* index icons (16x16) */
-        { BALSA_PIXMAP_INFO_REPLIED, "mail-replied" },
-        { BALSA_PIXMAP_INFO_NEW, "mail-unread" },
-        { BALSA_PIXMAP_INFO_FLAGGED, "emblem-important" },
+       /* index icons (16x16) */
+        { BALSA_PIXMAP_INFO_REPLIED,    "mail-replied" },
+        { BALSA_PIXMAP_INFO_NEW,        "mail-unread" },
+       { BALSA_PIXMAP_INFO_FLAGGED,    "emblem-important" },
 
         /* drop-down icon for the address-view (16x16) */
-        { BALSA_PIXMAP_DROP_DOWN, "pan-down-symbolic" },
-    };
+       { BALSA_PIXMAP_DROP_DOWN,       "pan-down-symbolic" },
+       };
 
     unsigned i;
     GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
@@ -185,12 +181,10 @@ balsa_register_pixmaps(void)
         g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
     gtk_icon_theme_append_search_path(icon_theme, BALSA_DATA_PREFIX);
 
-    for (i = 0; i < G_N_ELEMENTS(balsa_icons); i++) {
-        load_balsa_pixmap(icon_theme, balsa_icons + i);
-    }
+    for (i = 0; i < G_N_ELEMENTS(balsa_icons); i++)
+       load_balsa_pixmap(icon_theme, balsa_icons + i);
 }
 
-
 void
 balsa_unregister_pixmaps(void)
 {
@@ -200,45 +194,31 @@ balsa_unregister_pixmaps(void)
     }
 }
 
-
 void
-balsa_register_pixbufs(GtkWidget *widget)
+balsa_register_pixbufs(GtkWidget * widget)
 {
     static struct {
-        void (*set_icon) (GdkPixbuf *);
-        const gchar *icon;
+       void (*set_icon) (GdkPixbuf *);
+       const gchar *icon;
     } icons[] = {
-        {
-            libbalsa_mailbox_set_unread_icon, BALSA_PIXMAP_INFO_NEW
-        }, {
-            libbalsa_mailbox_set_trash_icon, BALSA_PIXMAP_INFO_DELETED
-        }, {
-            libbalsa_mailbox_set_flagged_icon, BALSA_PIXMAP_INFO_FLAGGED
-        }, {
-            libbalsa_mailbox_set_replied_icon, BALSA_PIXMAP_INFO_REPLIED
-        }, {
-            libbalsa_mailbox_set_attach_icon, BALSA_PIXMAP_INFO_ATTACHMENT
-        },
+       {
+       libbalsa_mailbox_set_unread_icon,  BALSA_PIXMAP_INFO_NEW}, {
+       libbalsa_mailbox_set_trash_icon,   BALSA_PIXMAP_INFO_DELETED}, {
+       libbalsa_mailbox_set_flagged_icon, BALSA_PIXMAP_INFO_FLAGGED}, {
+       libbalsa_mailbox_set_replied_icon, BALSA_PIXMAP_INFO_REPLIED}, {
+       libbalsa_mailbox_set_attach_icon, BALSA_PIXMAP_INFO_ATTACHMENT},
 #ifdef HAVE_GPGME
-        {
-            libbalsa_mailbox_set_good_icon, BALSA_PIXMAP_SIGN_GOOD
-        }, {
-            libbalsa_mailbox_set_notrust_icon, BALSA_PIXMAP_SIGN_NOTRUST
-        }, {
-            libbalsa_mailbox_set_bad_icon, BALSA_PIXMAP_SIGN_BAD
-        }, {
-            libbalsa_mailbox_set_sign_icon, BALSA_PIXMAP_SIGN
-        }, {
-            libbalsa_mailbox_set_encr_icon, BALSA_PIXMAP_ENCR
-        },
+       {
+       libbalsa_mailbox_set_good_icon, BALSA_PIXMAP_SIGN_GOOD}, {
+       libbalsa_mailbox_set_notrust_icon, BALSA_PIXMAP_SIGN_NOTRUST}, {
+       libbalsa_mailbox_set_bad_icon, BALSA_PIXMAP_SIGN_BAD}, {
+       libbalsa_mailbox_set_sign_icon, BALSA_PIXMAP_SIGN}, {
+       libbalsa_mailbox_set_encr_icon, BALSA_PIXMAP_ENCR},
 #endif
         {
-            libbalsa_address_view_set_book_icon, BALSA_PIXMAP_BOOK_RED
-        }, {
-            libbalsa_address_view_set_close_icon, "window-close-symbolic"
-        }, {
-            libbalsa_address_view_set_drop_down_icon, BALSA_PIXMAP_DROP_DOWN
-        },
+        libbalsa_address_view_set_book_icon,  BALSA_PIXMAP_BOOK_RED}, {
+        libbalsa_address_view_set_close_icon, "window-close-symbolic"}, {
+        libbalsa_address_view_set_drop_down_icon, BALSA_PIXMAP_DROP_DOWN},
     };
     guint i;
     GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
@@ -263,9 +243,8 @@ balsa_register_pixbufs(GtkWidget *widget)
     }
 }
 
-
 const gchar *
-balsa_icon_id(const gchar *name)
+balsa_icon_id(const gchar * name)
 {
     const gchar *retval = g_hash_table_lookup(balsa_icon_table, name);
 
diff --git a/src/balsa-icons.h b/src/balsa-icons.h
index d81b6ac..90cfb43 100644
--- a/src/balsa-icons.h
+++ b/src/balsa-icons.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -21,42 +21,42 @@
 #define __BALSA_ICONS_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include <gtk/gtk.h>
 
-#define BALSA_PIXMAP_ATTACHMENT                 "balsa_attachment"
-#define BALSA_PIXMAP_COMPOSE                    "balsa_compose"
-#define BALSA_PIXMAP_CONTINUE                   "balsa_continue"
-#define BALSA_PIXMAP_RECEIVE                    "balsa_receive"
-#define BALSA_PIXMAP_REPLY                      "balsa_reply"
-#define BALSA_PIXMAP_REPLY_ALL                  "balsa_reply_all"
-#define BALSA_PIXMAP_REPLY_GROUP                "balsa_reply_group"
-#define BALSA_PIXMAP_FORWARD                    "balsa_forward"
-#define BALSA_PIXMAP_NEXT                       "balsa_next"
-#define BALSA_PIXMAP_NEXT_PART                  "balsa_next_part"
-#define BALSA_PIXMAP_PREVIOUS                   "balsa_previous"
-#define BALSA_PIXMAP_PREVIOUS_PART              "balsa_previous_part"
-#define BALSA_PIXMAP_POSTPONE                   "balsa_postpone"
+#define BALSA_PIXMAP_ATTACHMENT                        "balsa_attachment"
+#define BALSA_PIXMAP_COMPOSE                   "balsa_compose"
+#define BALSA_PIXMAP_CONTINUE                  "balsa_continue"
+#define BALSA_PIXMAP_RECEIVE                   "balsa_receive"
+#define BALSA_PIXMAP_REPLY                     "balsa_reply"
+#define BALSA_PIXMAP_REPLY_ALL                 "balsa_reply_all"
+#define BALSA_PIXMAP_REPLY_GROUP               "balsa_reply_group"
+#define BALSA_PIXMAP_FORWARD                   "balsa_forward"
+#define BALSA_PIXMAP_NEXT                      "balsa_next"
+#define BALSA_PIXMAP_NEXT_PART                 "balsa_next_part"
+#define BALSA_PIXMAP_PREVIOUS                  "balsa_previous"
+#define BALSA_PIXMAP_PREVIOUS_PART             "balsa_previous_part"
+#define BALSA_PIXMAP_POSTPONE                  "balsa_postpone"
 #define BALSA_PIXMAP_REQUEST_MDN                "balsa_request_mdn"
-#define BALSA_PIXMAP_SEND                       "balsa_send"
-#define BALSA_PIXMAP_SEND_RECEIVE               "balsa_send_receive"
-#define BALSA_PIXMAP_QUEUE                              "balsa_queue"
-#define BALSA_PIXMAP_SEND_QUEUED                "balsa_send_queued"
-#define BALSA_PIXMAP_TRASH_EMPTY                "balsa_trash_empty"
-#define BALSA_PIXMAP_NEXT_UNREAD                "balsa_next_unread"
-#define BALSA_PIXMAP_NEXT_FLAGGED               "balsa_next_flagged"
-#define BALSA_PIXMAP_SHOW_HEADERS               "balsa_show_headers"
-#define BALSA_PIXMAP_SHOW_PREVIEW               "balsa_show_preview"
-#define BALSA_PIXMAP_MARKED_NEW                 "balsa_marked_new"
-#define BALSA_PIXMAP_MARK_ALL                   "balsa_marked_all"
-#define BALSA_PIXMAP_IDENTITY                   "balsa_identity"
+#define BALSA_PIXMAP_SEND                      "balsa_send"
+#define BALSA_PIXMAP_SEND_RECEIVE              "balsa_send_receive"
+#define BALSA_PIXMAP_QUEUE                             "balsa_queue"
+#define BALSA_PIXMAP_SEND_QUEUED               "balsa_send_queued"
+#define BALSA_PIXMAP_TRASH_EMPTY               "balsa_trash_empty"
+#define BALSA_PIXMAP_NEXT_UNREAD               "balsa_next_unread"
+#define BALSA_PIXMAP_NEXT_FLAGGED              "balsa_next_flagged"
+#define BALSA_PIXMAP_SHOW_HEADERS              "balsa_show_headers"
+#define BALSA_PIXMAP_SHOW_PREVIEW              "balsa_show_preview"
+#define BALSA_PIXMAP_MARKED_NEW                        "balsa_marked_new"
+#define BALSA_PIXMAP_MARK_ALL                  "balsa_marked_all"
+#define BALSA_PIXMAP_IDENTITY                  "balsa_identity"
 
-#define BALSA_OLD_PIXMAP_PRINT                  "balsa_print"
-#define BALSA_OLD_PIXMAP_SAVE                   "balsa_save"
-#define BALSA_OLD_PIXMAP_TRASH                  "balsa_trash"
-#define BALSA_OLD_PIXMAP_CLOSE_MBOX             "balsa_close_mbox"
+#define BALSA_OLD_PIXMAP_PRINT                 "balsa_print"
+#define BALSA_OLD_PIXMAP_SAVE                  "balsa_save"
+#define BALSA_OLD_PIXMAP_TRASH                 "balsa_trash"
+#define BALSA_OLD_PIXMAP_CLOSE_MBOX            "balsa_close_mbox"
 
 #define BALSA_PIXMAP_MBOX_DRAFT                 "balsa_mbox_draft"
 #define BALSA_PIXMAP_MBOX_IN                    "balsa_mbox_in"
@@ -75,14 +75,14 @@
 #define BALSA_PIXMAP_INFO_ATTACHMENT            BALSA_PIXMAP_ATTACHMENT
 #define BALSA_PIXMAP_INFO_DELETED               "edit-delete"
 #ifdef HAVE_GPGME
-#   define BALSA_PIXMAP_GPG_SIGN                 "balsa_gpg_sign"
-#   define BALSA_PIXMAP_GPG_ENCRYPT              "balsa_gpg_encrypt"
-#   define BALSA_PIXMAP_GPG_RECHECK              "balsa_gpg_recheck"
-#   define BALSA_PIXMAP_SIGN                     "balsa_sign"
-#   define BALSA_PIXMAP_SIGN_GOOD                "balsa_sign_good"
-#   define BALSA_PIXMAP_SIGN_NOTRUST             "balsa_sign_trust"
-#   define BALSA_PIXMAP_SIGN_BAD                 "balsa_sign_bad"
-#   define BALSA_PIXMAP_ENCR                     "balsa_encr"
+#  define BALSA_PIXMAP_GPG_SIGN                 "balsa_gpg_sign"
+#  define BALSA_PIXMAP_GPG_ENCRYPT              "balsa_gpg_encrypt"
+#  define BALSA_PIXMAP_GPG_RECHECK              "balsa_gpg_recheck"
+#  define BALSA_PIXMAP_SIGN                     "balsa_sign"
+#  define BALSA_PIXMAP_SIGN_GOOD                "balsa_sign_good"
+#  define BALSA_PIXMAP_SIGN_NOTRUST             "balsa_sign_trust"
+#  define BALSA_PIXMAP_SIGN_BAD                 "balsa_sign_bad"
+#  define BALSA_PIXMAP_ENCR                     "balsa_encr"
 #endif
 
 #define BALSA_PIXMAP_BOOK_RED                   "balsa_book_red"
@@ -95,7 +95,6 @@
 
 void balsa_register_pixmaps(void);
 void balsa_unregister_pixmaps(void);
-void balsa_register_pixbufs(GtkWidget *widget);
-const gchar *balsa_icon_id(const gchar *name);
-
+void balsa_register_pixbufs(GtkWidget * widget);
+const gchar * balsa_icon_id(const gchar * name);
 #endif
diff --git a/src/balsa-index.c b/src/balsa-index.c
index 4c1da35..6c06709 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -26,10 +26,10 @@
 
    The alternative is to create a hidden column containing the sorting
    key and replace the key on every change of the sort method.
- */
+*/
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-index.h"
 
@@ -51,7 +51,7 @@
 #include <glib/gi18n.h>
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#  include "macosx-helpers.h"
 #endif
 
 /* TREE_VIEW_FIXED_HEIGHT enables hight-performance mode of GtkTreeView
@@ -60,80 +60,75 @@
 
 
 /* gtk widget */
-static void bndx_class_init(BalsaIndexClass *klass);
-static void bndx_instance_init(BalsaIndex *index);
-static void bndx_destroy(GObject *obj);
-static gboolean bndx_popup_menu(GtkWidget *widget);
+static void bndx_class_init(BalsaIndexClass * klass);
+static void bndx_instance_init(BalsaIndex * index);
+static void bndx_destroy(GObject * obj);
+static gboolean bndx_popup_menu(GtkWidget * widget);
 
 /* statics */
 
 /* Manage the tree view */
-static gboolean bndx_row_is_viewable(BalsaIndex  *index,
-                                     GtkTreePath *path);
-static void bndx_expand_to_row_and_select(BalsaIndex  *index,
-                                          GtkTreeIter *iter);
-static void bndx_changed_find_row(BalsaIndex *index);
+static gboolean bndx_row_is_viewable(BalsaIndex * index,
+                                     GtkTreePath * path);
+static void bndx_expand_to_row_and_select(BalsaIndex * index,
+                                          GtkTreeIter * iter);
+static void bndx_changed_find_row(BalsaIndex * index);
 
 /* mailbox callbacks */
-static void bndx_mailbox_changed_cb(LibBalsaMailbox *mailbox,
-                                    BalsaIndex      *bindex);
+static void bndx_mailbox_changed_cb(LibBalsaMailbox * mailbox,
+                                    BalsaIndex      * bindex);
 
 /* GtkTree* callbacks */
-static void bndx_selection_changed(GtkTreeSelection *selection,
-                                   BalsaIndex       *index);
+static void bndx_selection_changed(GtkTreeSelection * selection,
+                                   BalsaIndex * index);
 static void bndx_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
                                     gint                  n_press,
                                     gdouble               x,
                                     gdouble               y,
                                     gpointer              user_data);
-static void bndx_row_activated(GtkTreeView       *tree_view,
-                               GtkTreePath       *path,
-                               GtkTreeViewColumn *column,
-                               gpointer           user_data);
-static void bndx_column_resize(GtkWidget     *widget,
-                               GtkAllocation *allocation,
-                               gint           baseline,
-                               GtkAllocation *clip,
-                               gpointer       user_data);
-static void bndx_tree_expand_cb(GtkTreeView *tree_view,
-                                GtkTreeIter *iter,
-                                GtkTreePath *path,
-                                gpointer     user_data);
-static gboolean bndx_test_collapse_row_cb(GtkTreeView *tree_view,
-                                          GtkTreeIter *iter,
-                                          GtkTreePath *path,
-                                          gpointer     user_data);
-static void bndx_tree_collapse_cb(GtkTreeView *tree_view,
-                                  GtkTreeIter *iter,
-                                  GtkTreePath *path,
-                                  gpointer     user_data);
+static void bndx_row_activated(GtkTreeView * tree_view, GtkTreePath * path,
+                               GtkTreeViewColumn * column,
+                               gpointer user_data);
+static void bndx_column_resize(GtkWidget     * widget,
+                               GtkAllocation * allocation,
+                               gint            baseline,
+                               GtkAllocation * clip,
+                               gpointer        user_data);
+static void bndx_tree_expand_cb(GtkTreeView * tree_view,
+                                GtkTreeIter * iter, GtkTreePath * path,
+                                gpointer user_data);
+static gboolean bndx_test_collapse_row_cb(GtkTreeView * tree_view,
+                                          GtkTreeIter * iter,
+                                          GtkTreePath * path,
+                                          gpointer user_data);
+static void bndx_tree_collapse_cb(GtkTreeView * tree_view,
+                                  GtkTreeIter * iter, GtkTreePath * path,
+                                  gpointer user_data);
 
 /* formerly balsa-index-page stuff */
 enum {
     TARGET_MESSAGES
 };
 
-static const gchar *index_drag_types[] = {
+static const gchar * index_drag_types[] = {
     "x-application/x-message-list"
 };
 
-static void bndx_drag_cb(GtkWidget        *widget,
-                         GdkDragContext   *drag_context,
-                         GtkSelectionData *data,
-                         guint             time,
-                         gpointer          user_data);
+static void bndx_drag_cb(GtkWidget* widget,
+                         GdkDragContext* drag_context,
+                         GtkSelectionData* data,
+                         guint time,
+                         gpointer user_data);
 
 /* Popup menu */
-static GtkWidget *bndx_popup_menu_create(BalsaIndex *index);
-static void bndx_do_popup(BalsaIndex     *index,
-                          const GdkEvent *event);
-static GtkWidget *create_stock_menu_item(GtkWidget   *menu,
-                                         const gchar *label,
-                                         GCallback    cb,
-                                         gpointer     data);
+static GtkWidget* bndx_popup_menu_create(BalsaIndex * index);
+static void bndx_do_popup(BalsaIndex     * index,
+                          const GdkEvent * event);
+static GtkWidget *create_stock_menu_item(GtkWidget * menu,
+                                         const gchar * label,
+                                         GCallback cb, gpointer data);
 
-static void sendmsg_window_destroy_cb(GtkWidget *widget,
-                                      gpointer   data);
+static void sendmsg_window_destroy_cb(GtkWidget * widget, gpointer data);
 
 /* signals */
 enum {
@@ -146,10 +141,8 @@ static gint balsa_index_signals[LAST_SIGNAL] = {
 };
 
 /* General helpers. */
-static void bndx_expand_to_row(BalsaIndex  *index,
-                               GtkTreePath *path);
-static void bndx_select_row(BalsaIndex  *index,
-                            GtkTreePath *path);
+static void bndx_expand_to_row(BalsaIndex * index, GtkTreePath * path);
+static void bndx_select_row(BalsaIndex * index, GtkTreePath * path);
 
 /* Other callbacks. */
 static void bndx_store_address(gpointer data);
@@ -183,10 +176,9 @@ balsa_index_get_type(void)
     return balsa_index_type;
 }
 
-
 /* BalsaIndex class init method. */
 static void
-bndx_class_init(BalsaIndexClass *klass)
+bndx_class_init(BalsaIndexClass * klass)
 {
     GObjectClass *object_class;
     GtkWidgetClass *widget_class;
@@ -199,11 +191,11 @@ bndx_class_init(BalsaIndexClass *klass)
     balsa_index_signals[INDEX_CHANGED] =
         g_signal_new("index-changed",
                      G_TYPE_FROM_CLASS(object_class),
-                     G_SIGNAL_RUN_FIRST,
+                    G_SIGNAL_RUN_FIRST,
                      G_STRUCT_OFFSET(BalsaIndexClass,
                                      index_changed),
                      NULL, NULL,
-                     g_cclosure_marshal_VOID__VOID,
+                    g_cclosure_marshal_VOID__VOID,
                      G_TYPE_NONE, 0);
 
     object_class->dispose = bndx_destroy;
@@ -211,20 +203,17 @@ bndx_class_init(BalsaIndexClass *klass)
     klass->index_changed = NULL;
 }
 
-
 /* Object class destroy method. */
 static void
-bndx_mbnode_weak_notify(gpointer data,
-                        GObject *where_the_object_was)
+bndx_mbnode_weak_notify(gpointer data, GObject *where_the_object_was)
 {
     BalsaIndex *bindex = data;
     bindex->mailbox_node = NULL;
     gtk_widget_destroy(GTK_WIDGET(bindex));
 }
 
-
 static void
-bndx_destroy(GObject *obj)
+bndx_destroy(GObject * obj)
 {
     BalsaIndex *index;
 
@@ -232,17 +221,17 @@ bndx_destroy(GObject *obj)
     index = BALSA_INDEX(obj);
 
     if (index->mailbox_node) {
-        LibBalsaMailbox *mailbox;
-
-        if ((mailbox = index->mailbox_node->mailbox)) {
-            g_signal_handlers_disconnect_matched(mailbox,
-                                                 G_SIGNAL_MATCH_DATA,
-                                                 0, 0, NULL, NULL, index);
-            gtk_tree_view_set_model(GTK_TREE_VIEW(index), NULL);
-            libbalsa_mailbox_close(mailbox, balsa_app.expunge_on_close);
-        }
+       LibBalsaMailbox* mailbox;
+
+       if ((mailbox = index->mailbox_node->mailbox)) {
+           g_signal_handlers_disconnect_matched(mailbox,
+                                                G_SIGNAL_MATCH_DATA,
+                                                0, 0, NULL, NULL, index);
+           gtk_tree_view_set_model(GTK_TREE_VIEW(index), NULL);
+           libbalsa_mailbox_close(mailbox, balsa_app.expunge_on_close);
+       }
 
-        if (index->mailbox_node) {
+       if (index->mailbox_node) {
             g_object_weak_unref(G_OBJECT(index->mailbox_node),
                                 (GWeakNotify) bndx_mbnode_weak_notify,
                                 index);
@@ -257,32 +246,26 @@ bndx_destroy(GObject *obj)
 
     g_clear_object(&index->popup_menu);
 
-    g_free(index->filter_string);
-    index->filter_string = NULL;
+    g_free(index->filter_string); index->filter_string = NULL;
 
-    if (G_OBJECT_CLASS(parent_class)->dispose) {
-        (*G_OBJECT_CLASS(parent_class)->dispose)(obj);
-    }
+    if (G_OBJECT_CLASS(parent_class)->dispose)
+        (*G_OBJECT_CLASS(parent_class)->dispose) (obj);
 }
 
-
 /* Widget class popup menu method. */
 static gboolean
-bndx_popup_menu(GtkWidget *widget)
+bndx_popup_menu(GtkWidget * widget)
 {
     bndx_do_popup(BALSA_INDEX(widget), NULL);
     return TRUE;
 }
 
-
 static void
 bi_apply_other_column_settings(GtkTreeViewColumn *column,
-                               gboolean           sortable,
-                               gint typeid )
+                               gboolean sortable, gint typeid)
 {
-    if (sortable) {
-        gtk_tree_view_column_set_sort_column_id(column, typeid );
-    }
+    if(sortable)
+        gtk_tree_view_column_set_sort_column_id(column, typeid);
 
     gtk_tree_view_column_set_alignment(column, 0.5);
 
@@ -291,10 +274,9 @@ bi_apply_other_column_settings(GtkTreeViewColumn *column,
 #endif
 }
 
-
 /* Width of a string in pixels for the default font. */
 static gint
-bndx_string_width(const gchar *text)
+bndx_string_width(const gchar * text)
 {
     GtkWidget *label;
     gint natural_width;
@@ -309,11 +291,10 @@ bndx_string_width(const gchar *text)
     return natural_width;
 }
 
-
 /* BalsaIndex instance init method; no tree store is set on the tree
  * view--that's handled later, when the view is populated. */
 static void
-bndx_instance_init(BalsaIndex *index)
+bndx_instance_init(BalsaIndex * index)
 {
     GtkTreeView *tree_view = GTK_TREE_VIEW(index);
     GtkTreeSelection *selection = gtk_tree_view_get_selection(tree_view);
@@ -329,13 +310,13 @@ bndx_instance_init(BalsaIndex *index)
     /* Index column */
     renderer = gtk_cell_renderer_text_new();
     column = gtk_tree_view_column_new_with_attributes
-            ("#", renderer,
-            "text", LB_MBOX_MSGNO_COL,
-            "foreground", LB_MBOX_FOREGROUND_COL,
-            "foreground-set", LB_MBOX_FOREGROUND_SET_COL,
-            "background", LB_MBOX_BACKGROUND_COL,
-            "background-set", LB_MBOX_BACKGROUND_SET_COL,
-            NULL);
+        ("#", renderer,
+         "text",           LB_MBOX_MSGNO_COL,
+         "foreground",     LB_MBOX_FOREGROUND_COL,
+         "foreground-set", LB_MBOX_FOREGROUND_SET_COL,
+         "background",     LB_MBOX_BACKGROUND_COL,
+         "background-set", LB_MBOX_BACKGROUND_SET_COL,
+         NULL);
     g_object_set(renderer, "xalign", 1.0, NULL);
     bi_apply_other_column_settings(column, TRUE, LB_MBOX_MSGNO_COL);
     gtk_tree_view_append_column(tree_view, column);
@@ -343,37 +324,37 @@ bndx_instance_init(BalsaIndex *index)
     /* Status icon column */
     renderer = gtk_cell_renderer_pixbuf_new();
     column = gtk_tree_view_column_new_with_attributes
-            ("S", renderer,
-            "pixbuf", LB_MBOX_MARKED_COL,
-            "cell-background", LB_MBOX_BACKGROUND_COL,
-            "cell-background-set", LB_MBOX_BACKGROUND_SET_COL,
-            NULL);
+        ("S", renderer,
+         "pixbuf",              LB_MBOX_MARKED_COL,
+         "cell-background",     LB_MBOX_BACKGROUND_COL,
+         "cell-background-set", LB_MBOX_BACKGROUND_SET_COL,
+         NULL);
     bi_apply_other_column_settings(column, FALSE, 0);
     gtk_tree_view_append_column(tree_view, column);
 
     /* Attachment icon column */
     renderer = gtk_cell_renderer_pixbuf_new();
     column = gtk_tree_view_column_new_with_attributes
-            ("A", renderer,
-            "pixbuf", LB_MBOX_ATTACH_COL,
-            "cell-background", LB_MBOX_BACKGROUND_COL,
-            "cell-background-set", LB_MBOX_BACKGROUND_SET_COL,
-            NULL);
+        ("A", renderer,
+         "pixbuf",              LB_MBOX_ATTACH_COL,
+         "cell-background",     LB_MBOX_BACKGROUND_COL,
+         "cell-background-set", LB_MBOX_BACKGROUND_SET_COL,
+         NULL);
     bi_apply_other_column_settings(column, FALSE, 0);
     gtk_tree_view_append_column(tree_view, column);
 
     /* From/To column */
     renderer = gtk_cell_renderer_text_new();
     column = gtk_tree_view_column_new_with_attributes
-            (_("From"), renderer,
-            "text", LB_MBOX_FROM_COL,
-            "weight", LB_MBOX_WEIGHT_COL,
-            "style", LB_MBOX_STYLE_COL,
-            "foreground", LB_MBOX_FOREGROUND_COL,
-            "foreground-set", LB_MBOX_FOREGROUND_SET_COL,
-            "background", LB_MBOX_BACKGROUND_COL,
-            "background-set", LB_MBOX_BACKGROUND_SET_COL,
-            NULL);
+        (_("From"), renderer,
+         "text",           LB_MBOX_FROM_COL,
+         "weight",         LB_MBOX_WEIGHT_COL,
+         "style",          LB_MBOX_STYLE_COL,
+         "foreground",     LB_MBOX_FOREGROUND_COL,
+         "foreground-set", LB_MBOX_FOREGROUND_SET_COL,
+         "background",     LB_MBOX_BACKGROUND_COL,
+         "background-set", LB_MBOX_BACKGROUND_SET_COL,
+         NULL);
     gtk_tree_view_column_set_resizable(column, TRUE);
     bi_apply_other_column_settings(column, TRUE, LB_MBOX_FROM_COL);
     gtk_tree_view_append_column(tree_view, column);
@@ -381,15 +362,15 @@ bndx_instance_init(BalsaIndex *index)
     /* Subject column--contains tree expanders */
     renderer = gtk_cell_renderer_text_new();
     column = gtk_tree_view_column_new_with_attributes
-            (_("Subject"), renderer,
-            "text", LB_MBOX_SUBJECT_COL,
-            "weight", LB_MBOX_WEIGHT_COL,
-            "style", LB_MBOX_STYLE_COL,
-            "foreground", LB_MBOX_FOREGROUND_COL,
-            "foreground-set", LB_MBOX_FOREGROUND_SET_COL,
-            "background", LB_MBOX_BACKGROUND_COL,
-            "background-set", LB_MBOX_BACKGROUND_SET_COL,
-            NULL);
+        (_("Subject"), renderer,
+         "text",           LB_MBOX_SUBJECT_COL,
+         "weight",         LB_MBOX_WEIGHT_COL,
+         "style",          LB_MBOX_STYLE_COL,
+         "foreground",     LB_MBOX_FOREGROUND_COL,
+         "foreground-set", LB_MBOX_FOREGROUND_SET_COL,
+         "background",     LB_MBOX_BACKGROUND_COL,
+         "background-set", LB_MBOX_BACKGROUND_SET_COL,
+         NULL);
     gtk_tree_view_column_set_resizable(column, TRUE);
     bi_apply_other_column_settings(column, TRUE, LB_MBOX_SUBJECT_COL);
     gtk_tree_view_append_column(tree_view, column);
@@ -398,15 +379,15 @@ bndx_instance_init(BalsaIndex *index)
     /* Date column */
     renderer = gtk_cell_renderer_text_new();
     column = gtk_tree_view_column_new_with_attributes
-            (_("Date"), renderer,
-            "text", LB_MBOX_DATE_COL,
-            "weight", LB_MBOX_WEIGHT_COL,
-            "style", LB_MBOX_STYLE_COL,
-            "foreground", LB_MBOX_FOREGROUND_COL,
-            "foreground-set", LB_MBOX_FOREGROUND_SET_COL,
-            "background", LB_MBOX_BACKGROUND_COL,
-            "background-set", LB_MBOX_BACKGROUND_SET_COL,
-            NULL);
+        (_("Date"), renderer,
+         "text",           LB_MBOX_DATE_COL,
+         "weight",         LB_MBOX_WEIGHT_COL,
+         "style",          LB_MBOX_STYLE_COL,
+         "foreground",     LB_MBOX_FOREGROUND_COL,
+         "foreground-set", LB_MBOX_FOREGROUND_SET_COL,
+         "background",     LB_MBOX_BACKGROUND_COL,
+         "background-set", LB_MBOX_BACKGROUND_SET_COL,
+         NULL);
     gtk_tree_view_column_set_resizable(column, TRUE);
     bi_apply_other_column_settings(column, TRUE, LB_MBOX_DATE_COL);
     gtk_tree_view_append_column(tree_view, column);
@@ -423,14 +404,14 @@ bndx_instance_init(BalsaIndex *index)
     gtk_tree_view_column_pack_start(column, renderer, FALSE);
     gtk_tree_view_column_set_attributes
         (column, renderer,
-        "text", LB_MBOX_SIZE_COL,
-        "weight", LB_MBOX_WEIGHT_COL,
-        "style", LB_MBOX_STYLE_COL,
-        "foreground", LB_MBOX_FOREGROUND_COL,
-        "foreground-set", LB_MBOX_FOREGROUND_SET_COL,
-        "background", LB_MBOX_BACKGROUND_COL,
-        "background-set", LB_MBOX_BACKGROUND_SET_COL,
-        NULL);
+         "text",           LB_MBOX_SIZE_COL,
+         "weight",         LB_MBOX_WEIGHT_COL,
+         "style",          LB_MBOX_STYLE_COL,
+         "foreground",     LB_MBOX_FOREGROUND_COL,
+         "foreground-set", LB_MBOX_FOREGROUND_SET_COL,
+         "background",     LB_MBOX_BACKGROUND_COL,
+         "background-set", LB_MBOX_BACKGROUND_SET_COL,
+         NULL);
     bi_apply_other_column_settings(column, TRUE, LB_MBOX_SIZE_COL);
     gtk_tree_view_append_column(tree_view, column);
 
@@ -453,10 +434,10 @@ bndx_instance_init(BalsaIndex *index)
     gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(gesture), 0);
     g_object_set_data_full(G_OBJECT(index), "balsa-gesture", gesture, g_object_unref);
     g_signal_connect(gesture, "pressed",
-                     G_CALLBACK(bndx_gesture_pressed_cb), NULL);
+                    G_CALLBACK(bndx_gesture_pressed_cb), NULL);
 
     g_signal_connect(tree_view, "row-activated",
-                     G_CALLBACK(bndx_row_activated), NULL);
+                    G_CALLBACK(bndx_row_activated), NULL);
 
     /* catch thread expand events */
     index->row_expanded_id =
@@ -489,7 +470,6 @@ bndx_instance_init(BalsaIndex *index)
     gtk_widget_show (GTK_WIDGET(index));
 }
 
-
 /*
  * Remove a GObject reference; if it was the last reference (and the
  * GObject has now been finalized), clear the location and return TRUE.
@@ -508,7 +488,6 @@ bndx_clear_if_last_ref(gpointer data)
     return TRUE;
 }
 
-
 /* Callbacks used by bndx_instance_init. */
 
 /*
@@ -522,20 +501,18 @@ bndx_clear_if_last_ref(gpointer data)
 
 /* idle callback: */
 static gboolean
-bndx_selection_changed_idle(BalsaIndex *index)
+bndx_selection_changed_idle(BalsaIndex * index)
 {
     LibBalsaMailbox *mailbox;
     guint msgno;
     GtkTreeSelection *selection;
 
-    if (bndx_clear_if_last_ref(&index)) {
+    if (bndx_clear_if_last_ref(&index))
         return FALSE;
-    }
     index->has_selection_changed_idle = FALSE;
 
-    if (!index->mailbox_node) {
+    if (!index->mailbox_node)
         return FALSE;
-    }
     mailbox = index->mailbox_node->mailbox;
     selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(index));
 
@@ -553,9 +530,9 @@ bndx_selection_changed_idle(BalsaIndex *index)
     if (msgno) {
         GtkTreePath *path;
 
-        if (!libbalsa_mailbox_msgno_find(mailbox, msgno, &path, NULL)) {
+        if (!libbalsa_mailbox_msgno_find(mailbox, msgno, &path, NULL))
             msgno = 0;
-        } else {
+        else {
             if (!gtk_tree_selection_path_is_selected(selection, path)) {
                 bndx_expand_to_row(index, path);
                 bndx_select_row(index, path);
@@ -578,24 +555,18 @@ bndx_selection_changed_idle(BalsaIndex *index)
     return FALSE;
 }
 
-
 /* GtkTreeSelectionForeachFunc: */
 static void
-bndx_selection_changed_func(GtkTreeModel *model,
-                            GtkTreePath  *path,
-                            GtkTreeIter  *iter,
-                            guint        *msgno)
+bndx_selection_changed_func(GtkTreeModel * model, GtkTreePath * path,
+                            GtkTreeIter * iter, guint * msgno)
 {
-    if (!*msgno) {
+    if (!*msgno)
         gtk_tree_model_get(model, iter, LB_MBOX_MSGNO_COL, msgno, -1);
-    }
 }
 
-
 /* the signal handler: */
 static void
-bndx_selection_changed(GtkTreeSelection *selection,
-                       BalsaIndex       *index)
+bndx_selection_changed(GtkTreeSelection * selection, BalsaIndex * index)
 {
     index->next_msgno = 0;
     gtk_tree_selection_selected_foreach(selection,
@@ -629,9 +600,8 @@ bndx_selection_changed(GtkTreeSelection *selection,
             }
             gtk_tree_path_free(path);
 
-            if (!update_preview) {
+            if (!update_preview)
                 return;
-            }
         }
     }
 
@@ -642,7 +612,6 @@ bndx_selection_changed(GtkTreeSelection *selection,
     }
 }
 
-
 static void
 bndx_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
                         gint                  n_press,
@@ -659,9 +628,8 @@ bndx_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
     gesture = GTK_GESTURE(multi_press);
     event = gtk_gesture_get_last_event(gesture, gtk_gesture_get_last_updated_sequence(gesture));
     g_return_if_fail(event != NULL);
-    if (!gdk_event_triggers_context_menu(event)) {
+    if (!gdk_event_triggers_context_menu(event))
         return;
-    }
 
     index = BALSA_INDEX(gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture)));
     tree_view = GTK_TREE_VIEW(index);
@@ -676,21 +644,17 @@ bndx_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
         GtkTreeSelection *selection =
             gtk_tree_view_get_selection(tree_view);
 
-        if (!gtk_tree_selection_path_is_selected(selection, path)) {
+        if (!gtk_tree_selection_path_is_selected(selection, path))
             bndx_select_row(index, path);
-        }
         gtk_tree_path_free(path);
     }
 
     bndx_do_popup(index, event);
 }
 
-
 static void
-bndx_row_activated(GtkTreeView       *tree_view,
-                   GtkTreePath       *path,
-                   GtkTreeViewColumn *column,
-                   gpointer           user_data)
+bndx_row_activated(GtkTreeView * tree_view, GtkTreePath * path,
+                   GtkTreeViewColumn * column, gpointer user_data)
 {
     GtkTreeModel *model = gtk_tree_view_get_model(tree_view);
     GtkTreeIter iter;
@@ -713,36 +677,29 @@ bndx_row_activated(GtkTreeView       *tree_view,
          * balsa_message_continue: */
         BalsaSendmsg *sm =
             sendmsg_window_continue(mailbox, msgno);
-        if (sm) {
+        if (sm)
             g_signal_connect(G_OBJECT(sm->window), "destroy",
                              G_CALLBACK(sendmsg_window_destroy_cb), NULL);
-        }
-    } else {
+    } else
         message_window_new(mailbox, msgno);
-    }
 }
 
-
 static gboolean
-bndx_find_current_msgno(BalsaIndex   *bindex,
-                        GtkTreePath **path,
-                        GtkTreeIter  *iter)
+bndx_find_current_msgno(BalsaIndex * bindex,
+                        GtkTreePath ** path , GtkTreeIter * iter)
 {
     return bindex->current_msgno > 0
-           && libbalsa_mailbox_msgno_find(bindex->mailbox_node->mailbox,
-                                          bindex->current_msgno, path, iter);
+        && libbalsa_mailbox_msgno_find(bindex->mailbox_node->mailbox,
+                                       bindex->current_msgno, path, iter);
 }
 
-
 /* bndx_tree_expand_cb:
  * callback on expand events
  * set/reset unread style, as appropriate
  */
 static void
-bndx_tree_expand_cb(GtkTreeView *tree_view,
-                    GtkTreeIter *iter,
-                    GtkTreePath *path,
-                    gpointer     user_data)
+bndx_tree_expand_cb(GtkTreeView * tree_view, GtkTreeIter * iter,
+                    GtkTreePath * path, gpointer user_data)
 {
     BalsaIndex *index = BALSA_INDEX(tree_view);
     GtkTreeSelection *selection = gtk_tree_view_get_selection(tree_view);
@@ -762,84 +719,74 @@ bndx_tree_expand_cb(GtkTreeView *tree_view,
     bndx_changed_find_row(index);
 }
 
-
 /* bndx_test_collapse_row_cb:
  * callback on "test-collapse-row" events
  * just set collapsing, and return FALSE to allow the row (thread) to be
  * collapsed. */
 static gboolean
-bndx_test_collapse_row_cb(GtkTreeView *tree_view,
-                          GtkTreeIter *iter,
-                          GtkTreePath *path,
-                          gpointer     user_data)
+bndx_test_collapse_row_cb(GtkTreeView * tree_view, GtkTreeIter * iter,
+                          GtkTreePath * path, gpointer user_data)
 {
     BalsaIndex *index = BALSA_INDEX(tree_view);
     index->collapsing = TRUE;
     return FALSE;
 }
 
-
 /* callback on collapse events;
  * clear collapsing;
  * the next message may have become invisible, so we must check whether
  * a next message still exists. */
 static void
-bndx_tree_collapse_cb(GtkTreeView *tree_view,
-                      GtkTreeIter *iter,
-                      GtkTreePath *path,
-                      gpointer     user_data)
+bndx_tree_collapse_cb(GtkTreeView * tree_view, GtkTreeIter * iter,
+                      GtkTreePath * path, gpointer user_data)
 {
     BalsaIndex *index = BALSA_INDEX(tree_view);
     index->collapsing = FALSE;
     bndx_changed_find_row(index);
 }
 
-
 /* When a column is resized, store the new size for later use */
 static void
-bndx_column_resize(GtkWidget     *widget,
-                   GtkAllocation *allocation,
-                   gint           baseline,
-                   GtkAllocation *clip,
-                   gpointer       user_data)
+bndx_column_resize(GtkWidget * widget, GtkAllocation * allocation,
+                   gint baseline, GtkAllocation * clip,
+                   gpointer user_data)
 {
     GtkTreeView *tree_view = GTK_TREE_VIEW(widget);
 
     balsa_app.index_num_width =
         gtk_tree_view_column_get_width(gtk_tree_view_get_column
-                                           (tree_view, LB_MBOX_MSGNO_COL));
+                                       (tree_view, LB_MBOX_MSGNO_COL));
     balsa_app.index_status_width =
         gtk_tree_view_column_get_width(gtk_tree_view_get_column
-                                           (tree_view, LB_MBOX_MARKED_COL));
+                                       (tree_view, LB_MBOX_MARKED_COL));
     balsa_app.index_attachment_width =
         gtk_tree_view_column_get_width(gtk_tree_view_get_column
-                                           (tree_view, LB_MBOX_ATTACH_COL));
+                                       (tree_view, LB_MBOX_ATTACH_COL));
     balsa_app.index_from_width =
         gtk_tree_view_column_get_width(gtk_tree_view_get_column
-                                           (tree_view, LB_MBOX_FROM_COL));
+                                       (tree_view, LB_MBOX_FROM_COL));
     balsa_app.index_subject_width =
         gtk_tree_view_column_get_width(gtk_tree_view_get_column
-                                           (tree_view, LB_MBOX_SUBJECT_COL));
+                                       (tree_view, LB_MBOX_SUBJECT_COL));
     balsa_app.index_date_width =
         gtk_tree_view_column_get_width(gtk_tree_view_get_column
-                                           (tree_view, LB_MBOX_DATE_COL));
+                                       (tree_view, LB_MBOX_DATE_COL));
     balsa_app.index_size_width =
         gtk_tree_view_column_get_width(gtk_tree_view_get_column
-                                           (tree_view, LB_MBOX_SIZE_COL));
+                                       (tree_view, LB_MBOX_SIZE_COL));
 }
 
-
 /* bndx_drag_cb
  *
  * This is the drag_data_get callback for the index widgets.
  * Currently supports DND only within the application.
  */
 static void
-bndx_drag_cb(GtkWidget        *widget,
-             GdkDragContext   *drag_context,
-             GtkSelectionData *data,
-             guint             time,
-             gpointer          user_data)
+bndx_drag_cb(GtkWidget        * widget,
+             GdkDragContext   * drag_context,
+             GtkSelectionData * data,
+             guint              time,
+             gpointer           user_data)
 {
     BalsaIndex *index;
 
@@ -848,24 +795,21 @@ bndx_drag_cb(GtkWidget        *widget,
     index = BALSA_INDEX(widget);
 
     if (gtk_tree_selection_count_selected_rows
-            (gtk_tree_view_get_selection(GTK_TREE_VIEW(index))) > 0) {
+        (gtk_tree_view_get_selection(GTK_TREE_VIEW(index))) > 0)
         gtk_selection_data_set(data, gtk_selection_data_get_target(data),
                                8, (const guchar *) &index,
                                sizeof(BalsaIndex *));
-    }
 }
 
-
 /* Public methods */
 GtkWidget *
 balsa_index_new(void)
 {
-    BalsaIndex *index = g_object_new(BALSA_TYPE_INDEX, NULL);
+    BalsaIndex* index = g_object_new(BALSA_TYPE_INDEX, NULL);
 
     return GTK_WIDGET(index);
 }
 
-
 /**
  * balsa_index_scroll_on_open() moves to the first unread message in
  * the index, or the last message if none is unread, and selects
@@ -883,28 +827,25 @@ bndx_scroll_on_open_idle(BalsaIndex *index)
     GtkTreePath *path;
     gpointer view_on_open;
 
-    if (bndx_clear_if_last_ref(&index)) {
+    if (bndx_clear_if_last_ref(&index))
         return FALSE;
-    }
 
     balsa_index_update_tree(index, balsa_app.expand_tree);
     mailbox = index->mailbox_node->mailbox;
     if (mailbox->first_unread) {
-        unsigned msgno = mailbox->first_unread;
-        mailbox->first_unread = 0;
-        if (!libbalsa_mailbox_msgno_find(mailbox, msgno, &path, NULL)) {
+       unsigned msgno = mailbox->first_unread;
+       mailbox->first_unread = 0;
+        if(!libbalsa_mailbox_msgno_find(mailbox, msgno, &path, NULL))
             return FALSE; /* Oops! */
-        }
     } else {
         /* we want to scroll to the last one in current order. The
            alternative which is to scroll to the most recently
            delivered does not feel natural when other sorting order is
            used */
         int total = gtk_tree_model_iter_n_children
-                (GTK_TREE_MODEL(mailbox), NULL);
-        if (total == 0) {
+            (GTK_TREE_MODEL(mailbox), NULL);
+        if(total == 0)
             return FALSE;
-        }
         path = gtk_tree_path_new_from_indices(total - 1, -1);
     }
 
@@ -917,9 +858,9 @@ bndx_scroll_on_open_idle(BalsaIndex *index)
 
     if (gtk_tree_view_get_model(tree_view)) {
         if ((view_on_open && GPOINTER_TO_INT(view_on_open))
-            || balsa_app.view_message_on_open) {
+            || balsa_app.view_message_on_open)
             bndx_select_row(index, path);
-        } else {
+        else {
             GtkTreeSelection *selection;
             gulong changed_id = index->selection_changed_id;
 
@@ -935,9 +876,8 @@ bndx_scroll_on_open_idle(BalsaIndex *index)
     return FALSE;
 }
 
-
 void
-balsa_index_scroll_on_open(BalsaIndex *bindex)
+balsa_index_scroll_on_open(BalsaIndex * bindex)
 {
     /* Scroll in an idle handler, because the mailbox is perhaps being
      * opened in its own idle handler. */
@@ -945,7 +885,6 @@ balsa_index_scroll_on_open(BalsaIndex *bindex)
                g_object_ref(bindex));
 }
 
-
 static LibBalsaCondition *cond_undeleted;
 
 /* Callback for the mailbox's "row-inserted" signal; queue an idle
@@ -971,18 +910,14 @@ bndx_mailbox_row_inserted_idle(struct bndx_mailbox_row_inserted_info *info)
     return FALSE;
 }
 
-
 static void
-bndx_mailbox_row_inserted_cb(LibBalsaMailbox *mailbox,
-                             GtkTreePath     *path,
-                             GtkTreeIter     *iter,
-                             BalsaIndex      *index)
+bndx_mailbox_row_inserted_cb(LibBalsaMailbox * mailbox, GtkTreePath * path,
+                             GtkTreeIter * iter, BalsaIndex * index)
 {
     guint msgno;
 
-    if (mailbox->state != LB_MAILBOX_STATE_OPEN) {
+    if (mailbox->state != LB_MAILBOX_STATE_OPEN)
         return;
-    }
 
     gtk_tree_model_get(GTK_TREE_MODEL(mailbox), iter,
                        LB_MBOX_MSGNO_COL, &msgno, -1);
@@ -994,48 +929,44 @@ bndx_mailbox_row_inserted_cb(LibBalsaMailbox *mailbox,
                                                 LIBBALSA_MESSAGE_FLAG_UNREAD,
                                                 0))
 #endif /* BALSA_EXPAND_TO_NEW_UNREAD_MESSAGE */
-        ) {
-        struct bndx_mailbox_row_inserted_info *info =
-            g_new(struct bndx_mailbox_row_inserted_info, 1);
-        info->mailbox = mailbox;
-        g_object_ref(mailbox);
-        info->index = index;
-        g_object_ref(index);
-        info->msgno = msgno;
-        g_idle_add_full(G_PRIORITY_LOW, /* to run after threading */
-                        (GSourceFunc) bndx_mailbox_row_inserted_idle,
-                        info, NULL);
+        )
+    {
+       struct bndx_mailbox_row_inserted_info *info =
+           g_new(struct bndx_mailbox_row_inserted_info, 1);
+       info->mailbox = mailbox;
+       g_object_ref(mailbox);
+       info->index = index;
+       g_object_ref(index);
+       info->msgno = msgno;
+       g_idle_add_full(G_PRIORITY_LOW, /* to run after threading */
+                       (GSourceFunc) bndx_mailbox_row_inserted_idle,
+                       info, NULL);
     }
 }
 
-
 static void
-bndx_mailbox_message_expunged_cb(LibBalsaMailbox *mailbox,
-                                 guint            msgno,
-                                 BalsaIndex      *bindex)
+bndx_mailbox_message_expunged_cb(LibBalsaMailbox * mailbox, guint msgno,
+                                 BalsaIndex * bindex)
 {
-    if (bindex->current_msgno == msgno) {
+    if (bindex->current_msgno == msgno)
         bindex->current_msgno = 0;
-    } else if (bindex->current_msgno > msgno) {
+    else if (bindex->current_msgno > msgno)
         --bindex->current_msgno;
-    }
 
-    if (bindex->next_msgno == msgno) {
+    if (bindex->next_msgno == msgno)
         bindex->next_msgno = 0;
-    } else if (bindex->next_msgno > msgno) {
+    else if (bindex->next_msgno > msgno)
         --bindex->next_msgno;
-    }
 }
 
-
 /* balsa_index_load_mailbox_node:
  *
  * mbnode->mailbox is already open
  */
 
 gboolean
-balsa_index_load_mailbox_node(BalsaIndex       *index,
-                              BalsaMailboxNode *mbnode)
+balsa_index_load_mailbox_node(BalsaIndex * index,
+                              BalsaMailboxNode* mbnode)
 {
     GtkTreeView *tree_view;
     LibBalsaMailbox *mailbox;
@@ -1059,7 +990,7 @@ balsa_index_load_mailbox_node(BalsaIndex       *index,
     tree_view = GTK_TREE_VIEW(index);
     if (libbalsa_mailbox_get_show(mailbox) == LB_MAILBOX_SHOW_TO) {
         GtkTreeViewColumn *column =
-            gtk_tree_view_get_column(tree_view, LB_MBOX_FROM_COL);
+           gtk_tree_view_get_column(tree_view, LB_MBOX_FROM_COL);
         index->filter_no = 1; /* FIXME: this is hack! */
         gtk_tree_view_column_set_title(column, _("To"));
     }
@@ -1078,11 +1009,10 @@ balsa_index_load_mailbox_node(BalsaIndex       *index,
     gtk_tree_view_set_model(tree_view, GTK_TREE_MODEL(mailbox));
 
     /* Create a search-iter for SEARCH UNDELETED. */
-    if (!cond_undeleted) {
+    if (!cond_undeleted)
         cond_undeleted =
             libbalsa_condition_new_flag_enum(TRUE,
                                              LIBBALSA_MESSAGE_FLAG_DELETED);
-    }
     index->search_iter = libbalsa_mailbox_search_iter_new(cond_undeleted);
     /* Note when this mailbox was opened, for use in auto-closing. */
     time(&index->mailbox_node->last_use);
@@ -1090,26 +1020,21 @@ balsa_index_load_mailbox_node(BalsaIndex       *index,
     return FALSE;
 }
 
-
 void
-balsa_index_set_width_preference(BalsaIndex               *bindex,
+balsa_index_set_width_preference(BalsaIndex *bindex,
                                  BalsaIndexWidthPreference pref)
 {
     GtkTreeView *tree_view;
     gboolean visible;
 
-    if (pref == bindex->width_preference) {
+    if (pref == bindex->width_preference)
         return;
-    }
 
     bindex->width_preference = pref;
     switch (pref) {
-    case BALSA_INDEX_NARROW: visible = FALSE;
-        break;
-
+    case BALSA_INDEX_NARROW: visible = FALSE; break;
     default:
-    case BALSA_INDEX_WIDE:   visible = TRUE;
-        break;
+    case BALSA_INDEX_WIDE:   visible = TRUE;  break;
     }
 
     tree_view = GTK_TREE_VIEW(bindex);
@@ -1121,7 +1046,6 @@ balsa_index_set_width_preference(BalsaIndex               *bindex,
         (gtk_tree_view_get_column(tree_view, LB_MBOX_SIZE_COL), visible);
 }
 
-
 /*
  * select message interfaces
  *
@@ -1180,106 +1104,95 @@ typedef enum {
 } BndxSearchWrap;
 
 static gboolean
-bndx_find_root(BalsaIndex  *index,
-               GtkTreeIter *iter)
+bndx_find_root(BalsaIndex * index, GtkTreeIter * iter)
 {
     GtkTreeView *tree_view = GTK_TREE_VIEW(index);
     GtkTreeModel *model = gtk_tree_view_get_model(tree_view);
 
-    if (!model || !gtk_tree_model_get_iter_first(model, iter)) {
-        return FALSE;
-    }
+    if (!model || !gtk_tree_model_get_iter_first(model, iter))
+       return FALSE;
 
     iter->user_data = NULL;
     return TRUE;
 }
 
-
 static gboolean
-bndx_search_iter(BalsaIndex                *index,
-                 LibBalsaMailboxSearchIter *search_iter,
-                 GtkTreeIter               *iter,
-                 BndxSearchDirection        direction,
-                 BndxSearchViewable         viewable,
-                 guint                      stop_msgno)
+bndx_search_iter(BalsaIndex * index,
+                LibBalsaMailboxSearchIter * search_iter,
+                GtkTreeIter * iter,
+                BndxSearchDirection direction,
+                BndxSearchViewable viewable,
+                guint stop_msgno)
 {
     gboolean found;
 
     do {
-        GtkTreePath *path;
-
-        found =
-            libbalsa_mailbox_search_iter_step(index->mailbox_node->mailbox,
-                                              search_iter, iter,
-                                              direction ==
-                                              BNDX_SEARCH_DIRECTION_NEXT,
-                                              stop_msgno);
-        if (!found) {
-            break;
-        }
-        if (viewable == BNDX_SEARCH_VIEWABLE_ANY) {
-            break;
-        }
-
-        path = gtk_tree_model_get_path(GTK_TREE_MODEL
-                                           (index->mailbox_node->mailbox),
-                                       iter);
-        found = bndx_row_is_viewable(index, path);
-        gtk_tree_path_free(path);
+       GtkTreePath *path;
+
+       found =
+           libbalsa_mailbox_search_iter_step(index->mailbox_node->mailbox,
+                                             search_iter, iter,
+                                             direction ==
+                                             BNDX_SEARCH_DIRECTION_NEXT,
+                                             stop_msgno);
+       if (!found)
+           break;
+       if (viewable == BNDX_SEARCH_VIEWABLE_ANY)
+           break;
+
+       path = gtk_tree_model_get_path(GTK_TREE_MODEL
+                                      (index->mailbox_node->mailbox),
+                                      iter);
+       found = bndx_row_is_viewable(index, path);
+       gtk_tree_path_free(path);
     } while (!found);
 
     return found;
 }
 
-
 static gboolean
-bndx_search_iter_and_select(BalsaIndex                *index,
-                            LibBalsaMailboxSearchIter *search_iter,
-                            BndxSearchDirection        direction,
-                            BndxSearchViewable         viewable,
-                            BndxSearchStart            start,
-                            BndxSearchWrap             wrap)
+bndx_search_iter_and_select(BalsaIndex * index,
+                            LibBalsaMailboxSearchIter * search_iter,
+                            BndxSearchDirection direction,
+                            BndxSearchViewable viewable,
+                            BndxSearchStart start,
+                            BndxSearchWrap wrap)
 {
     GtkTreeIter iter;
     guint stop_msgno;
 
-    if (!(((index->next_msgno > 0)
+    if (!((index->next_msgno > 0
            && libbalsa_mailbox_msgno_find(index->mailbox_node->mailbox,
                                           index->next_msgno, NULL, &iter))
-          || ((start == BNDX_SEARCH_START_ANY)
-              && bndx_find_root(index, &iter)))) {
+          || (start == BNDX_SEARCH_START_ANY
+              && bndx_find_root(index, &iter))))
         return FALSE;
-    }
 
     stop_msgno = 0;
-    if ((wrap == BNDX_SEARCH_WRAP_YES) && index->next_msgno) {
+    if (wrap == BNDX_SEARCH_WRAP_YES && index->next_msgno)
         stop_msgno = index->next_msgno;
-    }
     if (!bndx_search_iter(index, search_iter, &iter, direction, viewable,
-                          stop_msgno)) {
+                          stop_msgno))
         return FALSE;
-    }
 
     bndx_expand_to_row_and_select(index, &iter);
     return TRUE;
 }
 
-
 void
-balsa_index_select_next(BalsaIndex *index)
+balsa_index_select_next(BalsaIndex * index)
 {
     g_return_if_fail(BALSA_IS_INDEX(index));
 
     bndx_search_iter_and_select(index, index->search_iter,
-                                BNDX_SEARCH_DIRECTION_NEXT,
-                                BNDX_SEARCH_VIEWABLE_ONLY,
-                                BNDX_SEARCH_START_CURRENT,
-                                BNDX_SEARCH_WRAP_NO);
+                               BNDX_SEARCH_DIRECTION_NEXT,
+                               BNDX_SEARCH_VIEWABLE_ONLY,
+                               BNDX_SEARCH_START_CURRENT,
+                               BNDX_SEARCH_WRAP_NO);
 }
 
-
 static void
-bndx_select_next_threaded(BalsaIndex *index)
+bndx_select_next_threaded(BalsaIndex * index)
 {
     /* Make sure we start at the current message: */
     index->next_msgno = index->current_msgno;
@@ -1293,51 +1206,45 @@ bndx_select_next_threaded(BalsaIndex *index)
                                         BNDX_SEARCH_DIRECTION_PREV,
                                         BNDX_SEARCH_VIEWABLE_ONLY,
                                         BNDX_SEARCH_START_CURRENT,
-                                        BNDX_SEARCH_WRAP_NO)) {
-        /* Nowhere to go--unselect current, so it can be filtered out of
-         * the view. */
+                                        BNDX_SEARCH_WRAP_NO))
+       /* Nowhere to go--unselect current, so it can be filtered out of
+        * the view. */
         gtk_tree_selection_unselect_all(gtk_tree_view_get_selection
-                                            (GTK_TREE_VIEW(index)));
-    }
+                                        (GTK_TREE_VIEW(index)));
 }
 
-
 void
-balsa_index_select_previous(BalsaIndex *index)
+balsa_index_select_previous(BalsaIndex * index)
 {
     g_return_if_fail(BALSA_IS_INDEX(index));
 
     bndx_search_iter_and_select(index, index->search_iter,
-                                BNDX_SEARCH_DIRECTION_PREV,
-                                BNDX_SEARCH_VIEWABLE_ONLY,
-                                BNDX_SEARCH_START_CURRENT,
-                                BNDX_SEARCH_WRAP_NO);
+                               BNDX_SEARCH_DIRECTION_PREV,
+                               BNDX_SEARCH_VIEWABLE_ONLY,
+                               BNDX_SEARCH_START_CURRENT,
+                               BNDX_SEARCH_WRAP_NO);
 }
 
-
 void
-balsa_index_find(BalsaIndex                *index,
-                 LibBalsaMailboxSearchIter *search_iter,
-                 gboolean                   previous,
-                 gboolean                   wrap)
+balsa_index_find(BalsaIndex * index,
+                LibBalsaMailboxSearchIter * search_iter,
+                gboolean previous, gboolean wrap)
 {
     g_return_if_fail(BALSA_IS_INDEX(index));
 
     bndx_search_iter_and_select(index, search_iter,
-                                (previous ?
-                                 BNDX_SEARCH_DIRECTION_PREV :
-                                 BNDX_SEARCH_DIRECTION_NEXT),
-                                BNDX_SEARCH_VIEWABLE_ANY,
-                                BNDX_SEARCH_START_ANY,
-                                (wrap ?
-                                 BNDX_SEARCH_WRAP_YES :
-                                 BNDX_SEARCH_WRAP_NO));
+                               (previous ?
+                                BNDX_SEARCH_DIRECTION_PREV :
+                                BNDX_SEARCH_DIRECTION_NEXT),
+                               BNDX_SEARCH_VIEWABLE_ANY,
+                               BNDX_SEARCH_START_ANY,
+                               (wrap ?
+                                BNDX_SEARCH_WRAP_YES :
+                                BNDX_SEARCH_WRAP_NO));
 }
 
-
 static gboolean
-bndx_select_next_with_flag(BalsaIndex         *index,
-                           LibBalsaMessageFlag flag)
+bndx_select_next_with_flag(BalsaIndex * index, LibBalsaMessageFlag flag)
 {
     LibBalsaCondition *cond_flag, *cond_and;
     LibBalsaMailboxSearchIter *search_iter;
@@ -1365,40 +1272,34 @@ bndx_select_next_with_flag(BalsaIndex         *index,
     return retval;
 }
 
-
 gboolean
-balsa_index_select_next_unread(BalsaIndex *index)
+balsa_index_select_next_unread(BalsaIndex * index)
 {
     g_return_val_if_fail(BALSA_IS_INDEX(index), FALSE);
 
     return bndx_select_next_with_flag(index, LIBBALSA_MESSAGE_FLAG_NEW);
 }
 
-
 void
-balsa_index_select_next_flagged(BalsaIndex *index)
+balsa_index_select_next_flagged(BalsaIndex * index)
 {
     g_return_if_fail(BALSA_IS_INDEX(index));
 
     bndx_select_next_with_flag(index, LIBBALSA_MESSAGE_FLAG_FLAGGED);
 }
 
-
 void
-balsa_index_set_next_msgno(BalsaIndex *bindex,
-                           guint       msgno)
+balsa_index_set_next_msgno(BalsaIndex * bindex, guint msgno)
 {
     bindex->next_msgno = msgno;
 }
 
-
 guint
-balsa_index_get_next_msgno(BalsaIndex *bindex)
+balsa_index_get_next_msgno(BalsaIndex * bindex)
 {
     return bindex->next_msgno;
 }
 
-
 /* bndx_expand_to_row_and_select:
  * make sure it's viewable, then pass it to bndx_select_row
  * no-op if it's NULL
@@ -1406,8 +1307,7 @@ balsa_index_get_next_msgno(BalsaIndex *bindex)
  * Note: iter must be valid; it isn't checked here.
  */
 static void
-bndx_expand_to_row_and_select(BalsaIndex  *index,
-                              GtkTreeIter *iter)
+bndx_expand_to_row_and_select(BalsaIndex * index, GtkTreeIter * iter)
 {
     GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(index));
     GtkTreePath *path;
@@ -1418,11 +1318,10 @@ bndx_expand_to_row_and_select(BalsaIndex  *index,
     gtk_tree_path_free(path);
 }
 
-
 /* End of select message interfaces. */
 
 void
-balsa_index_set_column_widths(BalsaIndex *index)
+balsa_index_set_column_widths(BalsaIndex * index)
 {
     GtkTreeView *tree_view = GTK_TREE_VIEW(index);
     gint icon_w = 16;
@@ -1430,60 +1329,56 @@ balsa_index_set_column_widths(BalsaIndex *index)
 #if defined(TREE_VIEW_FIXED_HEIGHT)
     /* so that fixed width works properly */
     gtk_tree_view_column_set_fixed_width(gtk_tree_view_get_column
-                                             (tree_view, LB_MBOX_MSGNO_COL),
+                                         (tree_view, LB_MBOX_MSGNO_COL),
                                          bndx_string_width("00000"));
 #endif
     /* I have no idea why we must add 5 pixels to the icon width - otherwise,
        the icon will be clipped... */
     gtk_tree_view_column_set_fixed_width(gtk_tree_view_get_column
-                                             (tree_view, LB_MBOX_MARKED_COL),
+                                         (tree_view, LB_MBOX_MARKED_COL),
                                          icon_w + 5);
     gtk_tree_view_column_set_fixed_width(gtk_tree_view_get_column
-                                             (tree_view, LB_MBOX_ATTACH_COL),
+                                         (tree_view, LB_MBOX_ATTACH_COL),
                                          icon_w + 5);
     gtk_tree_view_column_set_fixed_width(gtk_tree_view_get_column
-                                             (tree_view, LB_MBOX_FROM_COL),
+                                         (tree_view, LB_MBOX_FROM_COL),
                                          balsa_app.index_from_width);
     gtk_tree_view_column_set_fixed_width(gtk_tree_view_get_column
-                                             (tree_view, LB_MBOX_SUBJECT_COL),
+                                         (tree_view, LB_MBOX_SUBJECT_COL),
                                          balsa_app.index_subject_width);
     gtk_tree_view_column_set_fixed_width(gtk_tree_view_get_column
-                                             (tree_view, LB_MBOX_DATE_COL),
+                                         (tree_view, LB_MBOX_DATE_COL),
                                          balsa_app.index_date_width);
 }
 
-
 /* Mailbox Callbacks... */
 
 /* bndx_mailbox_changed_cb : callback for sync with backend; the signal
    is emitted by the mailbox when new messages has been retrieved (either
    after opening the mailbox, or after "check new messages").
- */
+*/
 
 /* bndx_mailbox_changed_cb:
    may be called from a thread. Use idle callback to update the view.
- */
+*/
 
 static gboolean
 bndx_queue_draw_idle_cb(gpointer bindex)
 {
-    if (!bndx_clear_if_last_ref(&bindex)) {
+    if (!bndx_clear_if_last_ref(&bindex))
         gtk_widget_queue_draw(bindex);
-    }
 
     return FALSE;
 }
 
-
 static gboolean
-bndx_mailbox_changed_idle(BalsaIndex *bindex)
+bndx_mailbox_changed_idle(BalsaIndex * bindex)
 {
     LibBalsaMailbox *mailbox;
     GtkTreePath *path;
 
-    if (bndx_clear_if_last_ref(&bindex)) {
+    if (bndx_clear_if_last_ref(&bindex))
         return FALSE;
-    }
 
     bindex->has_mailbox_changed_idle = FALSE;
 
@@ -1511,42 +1406,34 @@ bndx_mailbox_changed_idle(BalsaIndex *bindex)
     return FALSE;
 }
 
-
 static void
-bndx_mailbox_changed_cb(LibBalsaMailbox *mailbox,
-                        BalsaIndex      *bindex)
+bndx_mailbox_changed_cb(LibBalsaMailbox * mailbox, BalsaIndex * bindex)
 {
-    if (!gtk_widget_get_window(GTK_WIDGET(bindex))) {
+    if (!gtk_widget_get_window(GTK_WIDGET(bindex)))
         return;
-    }
 
     /* Find the next message to be shown now, not later in the idle
      * callback. */
     if (bindex->current_msgno) {
         if (libbalsa_mailbox_msgno_has_flags(mailbox,
                                              bindex->current_msgno, 0,
-                                             LIBBALSA_MESSAGE_FLAG_DELETED)) {
+                                             LIBBALSA_MESSAGE_FLAG_DELETED))
             bindex->current_message_is_deleted = FALSE;
-        } else if (!bindex->current_message_is_deleted) {
+        else if (!bindex->current_message_is_deleted)
             bndx_select_next_threaded(bindex);
-        }
     }
 
-    if (bindex->has_mailbox_changed_idle) {
+    if (bindex->has_mailbox_changed_idle)
         return;
-    }
 
     bindex->has_mailbox_changed_idle = TRUE;
     g_idle_add((GSourceFunc) bndx_mailbox_changed_idle,
                g_object_ref(bindex));
 }
 
-
 static void
-bndx_selected_msgnos_func(GtkTreeModel *model,
-                          GtkTreePath  *path,
-                          GtkTreeIter  *iter,
-                          GArray       *msgnos)
+bndx_selected_msgnos_func(GtkTreeModel * model, GtkTreePath * path,
+                          GtkTreeIter * iter, GArray * msgnos)
 {
     guint msgno;
 
@@ -1554,9 +1441,8 @@ bndx_selected_msgnos_func(GtkTreeModel *model,
     g_array_append_val(msgnos, msgno);
 }
 
-
 GArray *
-balsa_index_selected_msgnos_new(BalsaIndex *index)
+balsa_index_selected_msgnos_new(BalsaIndex * index)
 {
     GArray *msgnos = g_array_new(FALSE, FALSE, sizeof(guint));
     GtkTreeView *tree_view = GTK_TREE_VIEW(index);
@@ -1569,17 +1455,14 @@ balsa_index_selected_msgnos_new(BalsaIndex *index)
     return msgnos;
 }
 
-
 void
-balsa_index_selected_msgnos_free(BalsaIndex *index,
-                                 GArray     *msgnos)
+balsa_index_selected_msgnos_free(BalsaIndex * index, GArray * msgnos)
 {
     libbalsa_mailbox_unregister_msgnos(index->mailbox_node->mailbox,
                                        msgnos);
     g_array_free(msgnos, TRUE);
 }
 
-
 static void
 bndx_view_source(gpointer data)
 {
@@ -1593,12 +1476,11 @@ bndx_view_source(gpointer data)
         LibBalsaMessage *message =
             libbalsa_mailbox_get_message(mailbox, msgno);
 
-        if (!message) {
+        if (!message)
             continue;
-        }
-        libbalsa_show_message_source(balsa_app.application,
+       libbalsa_show_message_source(balsa_app.application,
                                      message, balsa_app.message_font,
-                                     &balsa_app.source_escape_specials,
+                                    &balsa_app.source_escape_specials,
                                      &balsa_app.source_width,
                                      &balsa_app.source_height);
         g_object_unref(message);
@@ -1606,7 +1488,6 @@ bndx_view_source(gpointer data)
     balsa_index_selected_msgnos_free(index, selected);
 }
 
-
 static void
 bndx_store_address(gpointer data)
 {
@@ -1616,12 +1497,9 @@ bndx_store_address(gpointer data)
     g_list_free_full(messages, g_object_unref);
 }
 
-
 static void
-balsa_index_selected_list_func(GtkTreeModel *model,
-                               GtkTreePath  *path,
-                               GtkTreeIter  *iter,
-                               gpointer      data)
+balsa_index_selected_list_func(GtkTreeModel * model, GtkTreePath * path,
+                        GtkTreeIter * iter, gpointer data)
 {
     GList **list = data;
     guint msgno;
@@ -1629,20 +1507,18 @@ balsa_index_selected_list_func(GtkTreeModel *model,
 
     gtk_tree_model_get(model, iter, LB_MBOX_MSGNO_COL, &msgno, -1);
     message = libbalsa_mailbox_get_message(LIBBALSA_MAILBOX(model), msgno);
-    if (!message) {
+    if (!message)
         return;
-    }
     *list = g_list_prepend(*list, message);
 }
 
-
 /*
  * balsa_index_selected_list: create a GList of selected messages
  *
  * Free with g_list_foreach(l,g_object_unref)/g_list_free.
  */
 GList *
-balsa_index_selected_list(BalsaIndex *index)
+balsa_index_selected_list(BalsaIndex * index)
 {
     GtkTreeSelection *selection =
         gtk_tree_view_get_selection(GTK_TREE_VIEW(index));
@@ -1655,14 +1531,12 @@ balsa_index_selected_list(BalsaIndex *index)
     return list;
 }
 
-
 /*
  * bndx_compose_foreach: create a compose window for each selected
  * message
  */
 static void
-bndx_compose_foreach(BalsaIndex *index,
-                     SendType    send_type)
+bndx_compose_foreach(BalsaIndex * index, SendType send_type)
 {
     LibBalsaMailbox *mailbox = index->mailbox_node->mailbox;
     GArray *selected = balsa_index_selected_msgnos_new(index);
@@ -1671,30 +1545,26 @@ bndx_compose_foreach(BalsaIndex *index,
     for (i = 0; i < selected->len; i++) {
         guint msgno = g_array_index(selected, guint, i);
         BalsaSendmsg *sm;
-        switch (send_type) {
+        switch(send_type) {
         case SEND_REPLY:
         case SEND_REPLY_ALL:
         case SEND_REPLY_GROUP:
             sm = sendmsg_window_reply(mailbox, msgno, send_type);
             break;
-
         case SEND_CONTINUE:
             sm = sendmsg_window_continue(mailbox, msgno);
             break;
-
         default:
             g_assert_not_reached();
             sm = NULL; /** silence invalid warnings */
         }
-        if (sm) {
+        if (sm)
             g_signal_connect(G_OBJECT(sm->window), "destroy",
                              G_CALLBACK(sendmsg_window_destroy_cb), NULL);
-        }
     }
     balsa_index_selected_msgnos_free(index, selected);
 }
 
-
 /*
  * Public `reply' methods
  */
@@ -1704,35 +1574,30 @@ balsa_message_reply(gpointer user_data)
     bndx_compose_foreach(BALSA_INDEX (user_data), SEND_REPLY);
 }
 
-
 void
 balsa_message_replytoall(gpointer user_data)
 {
     bndx_compose_foreach(BALSA_INDEX (user_data), SEND_REPLY_ALL);
 }
 
-
 void
 balsa_message_replytogroup(gpointer user_data)
 {
     bndx_compose_foreach(BALSA_INDEX (user_data), SEND_REPLY_GROUP);
 }
 
-
 void
 balsa_message_continue(gpointer user_data)
 {
     bndx_compose_foreach(BALSA_INDEX (user_data), SEND_CONTINUE);
 }
 
-
 /*
  * bndx_compose_from_list: create a single compose window for the
  * selected messages
  */
 static void
-bndx_compose_from_list(BalsaIndex *index,
-                       SendType    send_type)
+bndx_compose_from_list(BalsaIndex * index, SendType send_type)
 {
     GArray *selected = balsa_index_selected_msgnos_new(index);
     BalsaSendmsg *sm =
@@ -1744,7 +1609,6 @@ bndx_compose_from_list(BalsaIndex *index,
                      G_CALLBACK(sendmsg_window_destroy_cb), NULL);
 }
 
-
 /*
  * Public forwarding methods
  */
@@ -1754,14 +1618,12 @@ balsa_message_forward_attached(gpointer user_data)
     bndx_compose_from_list(BALSA_INDEX(user_data), SEND_FORWARD_ATTACH);
 }
 
-
 void
 balsa_message_forward_inline(gpointer user_data)
 {
     bndx_compose_from_list(BALSA_INDEX(user_data), SEND_FORWARD_INLINE);
 }
 
-
 void
 balsa_message_forward_default(gpointer user_data)
 {
@@ -1770,13 +1632,11 @@ balsa_message_forward_default(gpointer user_data)
                            SEND_FORWARD_ATTACH : SEND_FORWARD_INLINE);
 }
 
-
 /*
  * bndx_do_delete: helper for message delete methods
  */
 static void
-bndx_do_delete(BalsaIndex *index,
-               gboolean    move_to_trash)
+bndx_do_delete(BalsaIndex* index, gboolean move_to_trash)
 {
     BalsaIndex *trash = balsa_find_index_by_mailbox(balsa_app.trash);
     GArray *selected = balsa_index_selected_msgnos_new(index);
@@ -1787,38 +1647,35 @@ bndx_do_delete(BalsaIndex *index,
     messages = g_array_new(FALSE, FALSE, sizeof(guint));
     for (i = 0; i < selected->len; i++) {
         guint msgno = g_array_index(selected, guint, i);
-        if (libbalsa_mailbox_msgno_has_flags(mailbox, msgno, 0,
-                                             LIBBALSA_MESSAGE_FLAG_DELETED)) {
+       if (libbalsa_mailbox_msgno_has_flags(mailbox, msgno, 0,
+                                             LIBBALSA_MESSAGE_FLAG_DELETED))
             g_array_append_val(messages, msgno);
-        }
     }
 
     if (messages->len) {
-        if (move_to_trash && (index != trash)) {
+       if (move_to_trash && (index != trash)) {
             GError *err = NULL;
-            if (!libbalsa_mailbox_messages_move(mailbox, messages,
-                                                balsa_app.trash, &err)) {
+            if(!libbalsa_mailbox_messages_move(mailbox, messages,
+                                               balsa_app.trash, &err)) {
                 balsa_information_parented(GTK_WINDOW(balsa_app.main_window),
                                            LIBBALSA_INFORMATION_ERROR,
                                            _("Move to Trash failed: %s"),
                                            err ? err->message : "?");
                 g_clear_error(&err);
             }
-            enable_empty_trash(balsa_app.main_window, TRASH_FULL);
-        } else {
+           enable_empty_trash(balsa_app.main_window, TRASH_FULL);
+       } else {
             libbalsa_mailbox_messages_change_flags
-                (mailbox, messages, LIBBALSA_MESSAGE_FLAG_DELETED,
-                (LibBalsaMessageFlag) 0);
-            if (index == trash) {
-                enable_empty_trash(balsa_app.main_window, TRASH_CHECK);
-            }
-        }
+               (mailbox, messages, LIBBALSA_MESSAGE_FLAG_DELETED,
+                (LibBalsaMessageFlag) 0);
+           if (index == trash)
+               enable_empty_trash(balsa_app.main_window, TRASH_CHECK);
+       }
     }
     g_array_free(messages, TRUE);
     balsa_index_selected_msgnos_free(index, selected);
 }
 
-
 /*
  * Public message delete methods
  */
@@ -1835,40 +1692,35 @@ balsa_message_move_to_trash(gpointer user_data)
     time(&index->mailbox_node->last_use);
 }
 
-
 gint
-balsa_find_notebook_page_num(LibBalsaMailbox *mailbox)
+balsa_find_notebook_page_num(LibBalsaMailbox * mailbox)
 {
     GtkWidget *page;
     gint i;
 
-    if (!balsa_app.notebook) {
+    if (!balsa_app.notebook)
         return -1;
-    }
 
     for (i = 0;
          (page =
-              gtk_notebook_get_nth_page(GTK_NOTEBOOK(balsa_app.notebook), i));
+          gtk_notebook_get_nth_page(GTK_NOTEBOOK(balsa_app.notebook), i));
          i++) {
         GtkWidget *index = gtk_bin_get_child(GTK_BIN(page));
 
         if (index && BALSA_INDEX(index)->mailbox_node
-            && (BALSA_INDEX(index)->mailbox_node->mailbox == mailbox)) {
+            && BALSA_INDEX(index)->mailbox_node->mailbox == mailbox)
             return i;
-        }
     }
 
     /* didn't find a matching mailbox */
     return -1;
 }
 
-
 /* This function toggles the given attribute of a list of messages,
    using given callback.
  */
 void
-balsa_index_toggle_flag(BalsaIndex         *index,
-                        LibBalsaMessageFlag flag)
+balsa_index_toggle_flag(BalsaIndex* index, LibBalsaMessageFlag flag)
 {
     LibBalsaMailbox *mailbox = index->mailbox_node->mailbox;
     int is_all_flagged = TRUE;
@@ -1879,9 +1731,9 @@ balsa_index_toggle_flag(BalsaIndex         *index,
     for (i = 0; i < selected->len; i++) {
         guint msgno = g_array_index(selected, guint, i);
         if (libbalsa_mailbox_msgno_has_flags(mailbox, msgno, 0, flag)) {
-            is_all_flagged = FALSE;
-            break;
-        }
+           is_all_flagged = FALSE;
+           break;
+       }
     }
 
     libbalsa_mailbox_messages_change_flags(mailbox, selected,
@@ -1889,17 +1741,14 @@ balsa_index_toggle_flag(BalsaIndex         *index,
                                            is_all_flagged ? flag : 0);
     balsa_index_selected_msgnos_free(index, selected);
 
-    if (flag == LIBBALSA_MESSAGE_FLAG_DELETED) {
-        /* Note when deleted flag was changed, for use in
-         * auto-expunge. */
-        time(&index->mailbox_node->last_use);
-    }
+    if (flag == LIBBALSA_MESSAGE_FLAG_DELETED)
+       /* Note when deleted flag was changed, for use in
+        * auto-expunge. */
+       time(&index->mailbox_node->last_use);
 }
 
-
 static void
-bi_toggle_deleted_cb(gpointer   user_data,
-                     GtkWidget *widget)
+bi_toggle_deleted_cb(gpointer user_data, GtkWidget * widget)
 {
     BalsaIndex *index;
     GArray *selected;
@@ -1910,20 +1759,18 @@ bi_toggle_deleted_cb(gpointer   user_data,
     balsa_index_toggle_flag(index, LIBBALSA_MESSAGE_FLAG_DELETED);
 
     selected = balsa_index_selected_msgnos_new(index);
-    if ((widget == index->undelete_item) && (selected->len > 0)) {
-        LibBalsaMailbox *mailbox = index->mailbox_node->mailbox;
+    if (widget == index->undelete_item && selected->len > 0) {
+       LibBalsaMailbox *mailbox = index->mailbox_node->mailbox;
         guint msgno = g_array_index(selected, guint, 0);
         if (libbalsa_mailbox_msgno_has_flags(mailbox, msgno,
                                              LIBBALSA_MESSAGE_FLAG_DELETED,
-                                             0)) {
-            /* Oops! */
-            balsa_index_toggle_flag(index, LIBBALSA_MESSAGE_FLAG_DELETED);
-        }
+                                            0))
+           /* Oops! */
+           balsa_index_toggle_flag(index, LIBBALSA_MESSAGE_FLAG_DELETED);
     }
     balsa_index_selected_msgnos_free(index, selected);
 }
 
-
 /* This function toggles the FLAGGED attribute of a list of messages
  */
 static void
@@ -1935,7 +1782,6 @@ bi_toggle_flagged_cb(gpointer user_data)
                             LIBBALSA_MESSAGE_FLAG_FLAGGED);
 }
 
-
 static void
 bi_toggle_new_cb(gpointer user_data)
 {
@@ -1947,8 +1793,7 @@ bi_toggle_new_cb(gpointer user_data)
 
 
 static void
-mru_menu_cb(const gchar *url,
-            BalsaIndex  *index)
+mru_menu_cb(const gchar * url, BalsaIndex * index)
 {
     LibBalsaMailbox *mailbox = balsa_find_mailbox_by_url(url);
 
@@ -1961,49 +1806,39 @@ mru_menu_cb(const gchar *url,
     }
 }
 
-
 /*
  * bndx_popup_menu_create: create the popup menu at init time
  */
 static GtkWidget *
-bndx_popup_menu_create(BalsaIndex *index)
+bndx_popup_menu_create(BalsaIndex * index)
 {
     static const struct {       /* this is a invariable part of */
         const char *icon, *label;       /* the context message menu.    */
         GCallback func;
     } entries[] = {
         {
-            BALSA_PIXMAP_REPLY, N_("_Reply…"),
-            G_CALLBACK(balsa_message_reply)
-        }, {
-            BALSA_PIXMAP_REPLY_ALL, N_("Reply To _All…"),
-            G_CALLBACK(balsa_message_replytoall)
-        }, {
-            BALSA_PIXMAP_REPLY_GROUP, N_("Reply To _Group…"),
-            G_CALLBACK(balsa_message_replytogroup)
-        }, {
-            BALSA_PIXMAP_FORWARD, N_("_Forward Attached…"),
-            G_CALLBACK(balsa_message_forward_attached)
-        }, {
-            BALSA_PIXMAP_FORWARD, N_("Forward _Inline…"),
-            G_CALLBACK(balsa_message_forward_inline)
-        }, {
-            NULL, N_("_Pipe through…"),
-            G_CALLBACK(balsa_index_pipe)
-        }, {
-            BALSA_PIXMAP_BOOK_RED, N_("_Store Address…"),
-            G_CALLBACK(bndx_store_address)
-        }
-    };
+        BALSA_PIXMAP_REPLY, N_("_Reply…"),
+                G_CALLBACK(balsa_message_reply)}, {
+        BALSA_PIXMAP_REPLY_ALL, N_("Reply To _All…"),
+                G_CALLBACK(balsa_message_replytoall)}, {
+        BALSA_PIXMAP_REPLY_GROUP, N_("Reply To _Group…"),
+                G_CALLBACK(balsa_message_replytogroup)}, {
+        BALSA_PIXMAP_FORWARD, N_("_Forward Attached…"),
+                G_CALLBACK(balsa_message_forward_attached)}, {
+        BALSA_PIXMAP_FORWARD, N_("Forward _Inline…"),
+                G_CALLBACK(balsa_message_forward_inline)}, {
+        NULL,                 N_("_Pipe through…"),
+                G_CALLBACK(balsa_index_pipe)}, {
+        BALSA_PIXMAP_BOOK_RED, N_("_Store Address…"),
+                G_CALLBACK(bndx_store_address)}};
     GtkWidget *menu, *menuitem, *submenu;
     unsigned i;
 
     menu = gtk_menu_new();
 
-    for (i = 0; i < G_N_ELEMENTS(entries); i++) {
+    for (i = 0; i < G_N_ELEMENTS(entries); i++)
         create_stock_menu_item(menu, _(entries[i].label),
                                entries[i].func, index);
-    }
 
     gtk_menu_shell_append(GTK_MENU_SHELL(menu),
                           gtk_separator_menu_item_new());
@@ -2018,7 +1853,7 @@ bndx_popup_menu_create(BalsaIndex *index)
     index->move_to_trash_item =
         create_stock_menu_item(menu, _("Move To _Trash"),
                                G_CALLBACK
-                                   (balsa_message_move_to_trash), index);
+                               (balsa_message_move_to_trash), index);
 
     menuitem = gtk_menu_item_new_with_mnemonic(_("T_oggle"));
     index->toggle_item = menuitem;
@@ -2048,7 +1883,6 @@ bndx_popup_menu_create(BalsaIndex *index)
     return menu;
 }
 
-
 /* bndx_do_popup: common code for the popup menu;
  * set sensitivity of menuitems on the popup
  * menu, and populate the mru submenu
@@ -2059,20 +1893,17 @@ bndx_popup_menu_create(BalsaIndex *index)
  */
 
 static void
-bndx_set_sensitive_func(GtkWidget *item,
-                        gpointer   sensitive)
+bndx_set_sensitive_func(GtkWidget * item, gpointer sensitive)
 {
     gtk_widget_set_sensitive(item, GPOINTER_TO_INT(sensitive));
 }
 
-
 static void
-bndx_do_popup(BalsaIndex     *index,
-              const GdkEvent *event)
+bndx_do_popup(BalsaIndex * index, const GdkEvent * event)
 {
     GtkWidget *menu = index->popup_menu;
     GtkWidget *submenu;
-    LibBalsaMailbox *mailbox;
+    LibBalsaMailbox* mailbox;
     gboolean any;
     gboolean any_deleted = FALSE;
     gboolean any_not_deleted = FALSE;
@@ -2086,11 +1917,10 @@ bndx_do_popup(BalsaIndex     *index,
         guint msgno = g_array_index(selected, guint, i);
         if (libbalsa_mailbox_msgno_has_flags(mailbox, msgno,
                                              LIBBALSA_MESSAGE_FLAG_DELETED,
-                                             0)) {
+                                            0))
             any_deleted = TRUE;
-        } else {
+        else
             any_not_deleted = TRUE;
-        }
     }
     any = selected->len > 0;
     balsa_index_selected_msgnos_free(index, selected);
@@ -2113,7 +1943,7 @@ bndx_do_popup(BalsaIndex     *index,
 
     submenu =
         balsa_mblist_mru_menu(GTK_WINDOW
-                                  (gtk_widget_get_toplevel(GTK_WIDGET(index))),
+                              (gtk_widget_get_toplevel(GTK_WIDGET(index))),
                               &balsa_app.folder_mru,
                               G_CALLBACK(mru_menu_cb), index);
     gtk_menu_item_set_submenu(GTK_MENU_ITEM(index->move_to_item),
@@ -2128,12 +1958,9 @@ bndx_do_popup(BalsaIndex     *index,
     }
 }
 
-
 static GtkWidget *
-create_stock_menu_item(GtkWidget   *menu,
-                       const gchar *label,
-                       GCallback    cb,
-                       gpointer     data)
+create_stock_menu_item(GtkWidget * menu, const gchar * label, GCallback cb,
+                      gpointer data)
 {
     GtkWidget *menuitem = gtk_menu_item_new_with_mnemonic(label);
 
@@ -2145,21 +1972,17 @@ create_stock_menu_item(GtkWidget   *menu,
     return menuitem;
 }
 
-
 static void
-sendmsg_window_destroy_cb(GtkWidget *widget,
-                          gpointer   data)
+sendmsg_window_destroy_cb(GtkWidget * widget, gpointer data)
 {
     balsa_window_enable_continue(balsa_app.main_window);
 }
 
-
 void
-balsa_index_update_tree(BalsaIndex *index,
-                        gboolean    expand)
+balsa_index_update_tree(BalsaIndex * index, gboolean expand)
 /* Remarks: In the "collapse" case, we still expand current thread to the
-            extent where viewed message is visible. An alternative
-            approach would be to change preview, e.g. to top of thread. */
+           extent where viewed message is visible. An alternative
+           approach would be to change preview, e.g. to top of thread. */
 {
     GtkTreeView *tree_view = GTK_TREE_VIEW(index);
     GtkTreeIter iter;
@@ -2179,20 +2002,17 @@ balsa_index_update_tree(BalsaIndex *index,
      * overhead is slight
      * select is needed in both cases, as a previous collapse could have
      * deselected the current message */
-    if (bndx_find_current_msgno(index, NULL, &iter)) {
+    if (bndx_find_current_msgno(index, NULL, &iter))
         bndx_expand_to_row_and_select(index, &iter);
-    } else {
+    else
         balsa_index_ensure_visible(index);
-    }
 
     bndx_changed_find_row(index);
 }
 
-
 /* balsa_index_set_threading_type: public method. */
 void
-balsa_index_set_threading_type(BalsaIndex *index,
-                               int         thtype)
+balsa_index_set_threading_type(BalsaIndex * index, int thtype)
 {
     LibBalsaMailbox *mailbox;
 
@@ -2201,22 +2021,19 @@ balsa_index_set_threading_type(BalsaIndex *index,
     mailbox = index->mailbox_node->mailbox;
     g_return_if_fail(mailbox != NULL);
 
-    if ((thtype != LB_MAILBOX_THREADING_FLAT)
-        && !libbalsa_mailbox_prepare_threading(mailbox, 0)) {
+    if (thtype != LB_MAILBOX_THREADING_FLAT
+        && !libbalsa_mailbox_prepare_threading(mailbox, 0))
         return;
-    }
     libbalsa_mailbox_set_threading_type(mailbox, thtype);
 
     libbalsa_mailbox_set_threading(mailbox, thtype);
     balsa_index_update_tree(index, balsa_app.expand_tree);
 }
 
-
 void
-balsa_index_set_view_filter(BalsaIndex        *bindex,
-                            int                filter_no,
-                            const gchar       *filter_string,
-                            LibBalsaCondition *filter)
+balsa_index_set_view_filter(BalsaIndex * bindex, int filter_no,
+                            const gchar * filter_string,
+                            LibBalsaCondition * filter)
 {
     LibBalsaMailbox *mailbox;
 
@@ -2226,40 +2043,34 @@ balsa_index_set_view_filter(BalsaIndex        *bindex,
     g_free(bindex->filter_string);
     bindex->filter_no = filter_no;
     bindex->filter_string = g_strdup(filter_string);
-    if (libbalsa_mailbox_set_view_filter(mailbox, filter, TRUE)) {
+    if (libbalsa_mailbox_set_view_filter(mailbox, filter, TRUE))
         balsa_index_ensure_visible(bindex);
-    }
 }
 
-
 /* Public method. */
 void
-balsa_index_refresh_size(BalsaIndex *index)
+balsa_index_refresh_size(BalsaIndex * index)
 {
 }
 
 
 /* Public method. */
 void
-balsa_index_refresh_date(BalsaIndex *index)
+balsa_index_refresh_date(BalsaIndex * index)
 {
 }
 
-
 /* Transfer messages. */
 void
-balsa_index_transfer(BalsaIndex      *index,
-                     GArray          *msgnos,
-                     LibBalsaMailbox *to_mailbox,
-                     gboolean         copy)
+balsa_index_transfer(BalsaIndex *index, GArray * msgnos,
+                     LibBalsaMailbox * to_mailbox, gboolean copy)
 {
     gboolean success;
     LibBalsaMailbox *from_mailbox;
     GError *e = NULL;
 
-    if (msgnos->len == 0) {
+    if (msgnos->len == 0)
         return;
-    }
 
     from_mailbox = index->mailbox_node->mailbox;
     success = copy ?
@@ -2267,64 +2078,57 @@ balsa_index_transfer(BalsaIndex      *index,
         libbalsa_mailbox_messages_move(from_mailbox, msgnos, to_mailbox, &e);
 
     if (!success) {
-        balsa_information
+       balsa_information
             (LIBBALSA_INFORMATION_WARNING,
-            ngettext("Failed to copy %d message to mailbox “%s”: %s",
-                     "Failed to copy %d messages to mailbox “%s”: %s",
-                     msgnos->len),
-            msgnos->len, to_mailbox->name, e ? e->message : "?");
-        return;
+             ngettext("Failed to copy %d message to mailbox “%s”: %s",
+                      "Failed to copy %d messages to mailbox “%s”: %s",
+                      msgnos->len),
+             msgnos->len, to_mailbox->name, e ? e->message : "?");
+       return;
     }
 
-    if ((from_mailbox == balsa_app.trash) && !copy) {
+    if (from_mailbox == balsa_app.trash && !copy)
         enable_empty_trash(balsa_app.main_window, TRASH_CHECK);
-    } else if (to_mailbox == balsa_app.trash) {
+    else if (to_mailbox == balsa_app.trash)
         enable_empty_trash(balsa_app.main_window, TRASH_FULL);
-    }
     balsa_information(LIBBALSA_INFORMATION_MESSAGE,
                       copy ? _("Copied to “%s”.")
                       : _("Moved to “%s”."), to_mailbox->name);
-    if (!copy) {
-        /* Note when message was flagged as deleted, for use in
-         * auto-expunge. */
-        time(&index->mailbox_node->last_use);
-    }
+    if (!copy)
+       /* Note when message was flagged as deleted, for use in
+        * auto-expunge. */
+       time(&index->mailbox_node->last_use);
 }
 
-
 /* General helpers. */
 static void
-bndx_expand_to_row(BalsaIndex  *index,
-                   GtkTreePath *path)
+bndx_expand_to_row(BalsaIndex * index, GtkTreePath * path)
 {
     GtkTreePath *tmp;
     gint i, j;
 
-    if (!gtk_widget_get_window(GTK_WIDGET(index))) {
+    if (!gtk_widget_get_window(GTK_WIDGET(index)))
         return;
-    }
 
     tmp = gtk_tree_path_copy(path);
     while (gtk_tree_path_up(tmp) && gtk_tree_path_get_depth(tmp) > 0
-           && !gtk_tree_view_row_expanded(GTK_TREE_VIEW(index), tmp)) {
-    }
+          && !gtk_tree_view_row_expanded(GTK_TREE_VIEW(index), tmp));
     /* Now we go from the deepest unexpanded ancestor up to full path */
 
     if ((i = gtk_tree_path_get_depth(tmp))
-        < (j = gtk_tree_path_get_depth(path) - 1)) {
-        gint *indices = gtk_tree_path_get_indices(path);
+       < (j = gtk_tree_path_get_depth(path) - 1)) {
+       gint *indices = gtk_tree_path_get_indices(path);
 
-        do {
-            gtk_tree_path_append_index(tmp, indices[i]);
-            gtk_tree_view_expand_row(GTK_TREE_VIEW(index), tmp, FALSE);
-        } while (++i < j);
+       do {
+           gtk_tree_path_append_index(tmp, indices[i]);
+           gtk_tree_view_expand_row(GTK_TREE_VIEW(index), tmp, FALSE);
+       } while (++i < j);
     }
     gtk_tree_path_free(tmp);
 }
 
-
 static void
-bndx_changed_find_row(BalsaIndex *index)
+bndx_changed_find_row(BalsaIndex * index)
 {
     GtkTreeIter iter;
 
@@ -2347,13 +2151,11 @@ bndx_changed_find_row(BalsaIndex *index)
     g_signal_emit(G_OBJECT(index), balsa_index_signals[INDEX_CHANGED], 0);
 }
 
-
 /* Make the actual selection,
  * making sure the selected row is within bounds and made visible.
  */
 static void
-bndx_select_row(BalsaIndex  *index,
-                GtkTreePath *path)
+bndx_select_row(BalsaIndex * index, GtkTreePath * path)
 {
     GtkTreeView *tree_view = GTK_TREE_VIEW(index);
 
@@ -2361,29 +2163,25 @@ bndx_select_row(BalsaIndex  *index,
     gtk_tree_view_scroll_to_cell(tree_view, path, NULL, FALSE, 0, 0);
 }
 
-
 /* Check that all parents are expanded. */
 static gboolean
-bndx_row_is_viewable(BalsaIndex  *index,
-                     GtkTreePath *path)
+bndx_row_is_viewable(BalsaIndex * index, GtkTreePath * path)
 {
     GtkTreePath *tmp_path = gtk_tree_path_copy(path);
     gboolean ret_val = TRUE;
 
     while (ret_val && gtk_tree_path_up(tmp_path)
-           && gtk_tree_path_get_depth(tmp_path) > 0) {
+           && gtk_tree_path_get_depth(tmp_path) > 0)
         ret_val =
             gtk_tree_view_row_expanded(GTK_TREE_VIEW(index), tmp_path);
-    }
 
     gtk_tree_path_free(tmp_path);
     return ret_val;
 }
 
-
 /* Expunge deleted messages. */
 void
-balsa_index_expunge(BalsaIndex *index)
+balsa_index_expunge(BalsaIndex * index)
 {
     LibBalsaMailbox *mailbox;
     gboolean rc;
@@ -2391,64 +2189,53 @@ balsa_index_expunge(BalsaIndex *index)
     g_return_if_fail(index != NULL);
 
     mailbox = index->mailbox_node->mailbox;
-    if (mailbox->readonly) {
-        return;
-    }
+    if (mailbox->readonly)
+       return;
 
     rc = libbalsa_mailbox_sync_storage(mailbox, TRUE);
-    if (!rc) {
-        balsa_information(LIBBALSA_INFORMATION_WARNING,
-                          _("Committing mailbox %s failed."),
-                          mailbox->name);
-    }
+    if (!rc)
+       balsa_information(LIBBALSA_INFORMATION_WARNING,
+                         _("Committing mailbox %s failed."),
+                         mailbox->name);
 }
 
-
 /* Message window */
 static guint
-bndx_next_msgno(BalsaIndex                *index,
-                guint                      current_msgno,
-                LibBalsaMailboxSearchIter *search_iter,
-                BndxSearchDirection        direction)
+bndx_next_msgno(BalsaIndex * index, guint current_msgno,
+                LibBalsaMailboxSearchIter * search_iter,
+                BndxSearchDirection direction)
 {
     LibBalsaMailbox *mailbox = index->mailbox_node->mailbox;
     GtkTreeModel *model = GTK_TREE_MODEL(mailbox);
     GtkTreeIter iter;
     guint msgno = 0;
 
-    if (!((current_msgno > 0)
+    if (!(current_msgno > 0
           && libbalsa_mailbox_msgno_find(mailbox, current_msgno, NULL,
-                                         &iter))) {
+                                         &iter)))
         return 0;
-    }
 
     if (bndx_search_iter(index, search_iter, &iter, direction,
-                         BNDX_SEARCH_VIEWABLE_ONLY, 0)) {
+                         BNDX_SEARCH_VIEWABLE_ONLY, 0))
         gtk_tree_model_get(model, &iter, LB_MBOX_MSGNO_COL, &msgno, -1);
-    }
 
     return msgno;
 }
 
-
 guint
-balsa_index_next_msgno(BalsaIndex *index,
-                       guint       current_msgno)
+balsa_index_next_msgno(BalsaIndex * index, guint current_msgno)
 {
     return bndx_next_msgno(index, current_msgno, index->search_iter,
                            BNDX_SEARCH_DIRECTION_NEXT);
 }
 
-
 guint
-balsa_index_previous_msgno(BalsaIndex *index,
-                           guint       current_msgno)
+balsa_index_previous_msgno(BalsaIndex * index, guint current_msgno)
 {
     return bndx_next_msgno(index, current_msgno, index->search_iter,
                            BNDX_SEARCH_DIRECTION_PREV);
 }
 
-
 /* Functions and data structures for asynchronous message piping via
    external commands. */
 /** PipeData stores the context of a message currently sent via a pipe
@@ -2465,37 +2252,31 @@ struct PipeData {
     guint in_source;
     guint out_source;
     guint err_source;
-    int out_closed : 1;
-    int err_closed : 1;
+    int out_closed:1;
+    int err_closed:1;
 };
 
 static void
-pipe_data_destroy(struct PipeData *pipe)
+pipe_data_destroy(struct PipeData* pipe)
 {
-    if (pipe->destroy_notify) {
-        pipe->destroy_notify(pipe->notify_arg);
-    }
+    if(pipe->destroy_notify)
+       pipe->destroy_notify(pipe->notify_arg);
     g_free(pipe->message);
-    if (pipe->in_channel) {
-        g_io_channel_unref(pipe->in_channel);
-    }
+    if(pipe->in_channel)
+       g_io_channel_unref(pipe->in_channel);
     g_io_channel_unref(pipe->out_channel);
     g_io_channel_unref(pipe->err_channel);
-    if (pipe->in_source) {
-        g_source_remove(pipe->in_source);
-    }
+    if(pipe->in_source)
+       g_source_remove(pipe->in_source);
     g_source_remove(pipe->out_source);
     g_source_remove(pipe->err_source);
     g_free(pipe);
 }
 
-
 static gboolean
-pipe_in_watch(GIOChannel  *channel,
-              GIOCondition condition,
-              gpointer     data)
+pipe_in_watch(GIOChannel *channel, GIOCondition condition, gpointer data)
 {
-    struct PipeData *pipe = (struct PipeData *)data;
+    struct PipeData *pipe = (struct PipeData*)data;
     GIOStatus status;
     GError *error = NULL;
     gsize chars_written;
@@ -2508,117 +2289,103 @@ pipe_in_watch(GIOChannel  *channel,
         if ((condition & G_IO_ERR) != 0) {
             fprintf(stderr, "pipe_in_watch encountered error. Aborts writing.\n");
         }
-        pipe_data_destroy(pipe);
+       pipe_data_destroy(pipe);
         return FALSE;
     }
 
-    if ((condition & G_IO_OUT) == G_IO_OUT) {
-        status =
-            g_io_channel_write_chars(channel,
-                                     pipe->message + pipe->chars_written,
-                                     pipe->message_length - pipe->chars_written,
-                                     &chars_written,
-                                     &error);
-
-        switch (status) {
-        case G_IO_STATUS_ERROR:
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _("Cannot process the message: %s"),
-                                 error->message);
-            g_clear_error(&error);
-            pipe_data_destroy(pipe);
-            return FALSE;
-
-        case G_IO_STATUS_NORMAL:
-            pipe->chars_written += chars_written;
-            break;
-
-        case G_IO_STATUS_EOF:
-            printf("pipe_in::write_chars receieved premature EOF %s\n",
-                   error ? error->message : "unknown");
-            pipe_data_destroy(pipe);
-            return FALSE;
-
-        case G_IO_STATUS_AGAIN:
-            printf("pipe_in::write_chars again?\n");
-            break;
-        }
+    if( (condition & G_IO_OUT) == G_IO_OUT) {
+       status =
+           g_io_channel_write_chars(channel,
+                                    pipe->message + pipe->chars_written,
+                                    pipe->message_length-pipe->chars_written,
+                                    &chars_written,
+                                    &error);
+
+       switch(status) {
+       case G_IO_STATUS_ERROR:
+           libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                                _("Cannot process the message: %s"),
+                                error->message);
+           g_clear_error(&error);
+           pipe_data_destroy(pipe);
+           return FALSE;
+       case G_IO_STATUS_NORMAL:
+           pipe->chars_written += chars_written;
+           break;
+       case G_IO_STATUS_EOF:
+           printf("pipe_in::write_chars receieved premature EOF %s\n",
+                  error ? error->message : "unknown");
+           pipe_data_destroy(pipe);
+           return FALSE;
+       case G_IO_STATUS_AGAIN:
+           printf("pipe_in::write_chars again?\n");
+           break;
+       }
     }
 
     rc = pipe->message_length > pipe->chars_written;
-    if (!rc) {
-        g_io_channel_unref(pipe->in_channel);
-        pipe->in_channel = NULL;
-        g_source_remove(pipe->in_source);
-        pipe->in_source = 0;
+    if(!rc) {
+       g_io_channel_unref(pipe->in_channel); pipe->in_channel = NULL;
+       g_source_remove(pipe->in_source);     pipe->in_source = 0;
     }
     return rc;
 }
 
-
 static gboolean
-pipe_out_watch(GIOChannel  *channel,
-               GIOCondition condition,
-               gpointer     data)
+pipe_out_watch(GIOChannel *channel, GIOCondition condition, gpointer data)
 {
-    struct PipeData *pipe = (struct PipeData *)data;
+    struct PipeData *pipe = (struct PipeData*)data;
     gsize bytes_read;
     GIOStatus status;
     GError *error = NULL;
     gchar *s;
 
-    if ((condition & G_IO_IN) == G_IO_IN) {
+    if ( (condition & G_IO_IN) == G_IO_IN) {
         char buf[2048];
 
-        status =
-            g_io_channel_read_chars(channel, buf, sizeof(buf), &bytes_read,
-                                    &error);
-        switch (status) {
-        case G_IO_STATUS_ERROR:
-            pipe_data_destroy(pipe);
-            fprintf(stderr, "Reading characters from pipe failed: %s\n",
-                    error ? error->message : "unknown");
-            g_clear_error(&error);
-            return FALSE;
-
-        case G_IO_STATUS_NORMAL:
-            s = g_strndup(buf, bytes_read > 128 ? 128 : bytes_read);
-            libbalsa_information(LIBBALSA_INFORMATION_MESSAGE, "%s", s);
-            g_free(s);
-            /* if(fwrite(buf, 1, bytes_read, stdout) != bytes_read); */
-            break;
-
-        case G_IO_STATUS_EOF:
-            printf("pipe_out got EOF\n");
-            pipe_data_destroy(pipe);
-            g_clear_error(&error);
-            return FALSE;
-
-        case G_IO_STATUS_AGAIN: break;
-        }
+       status =
+           g_io_channel_read_chars(channel, buf, sizeof(buf), &bytes_read,
+                                   &error);
+       switch(status) {
+       case G_IO_STATUS_ERROR:
+           pipe_data_destroy(pipe);
+           fprintf(stderr, "Reading characters from pipe failed: %s\n",
+                   error ? error->message : "unknown");
+           g_clear_error(&error);
+           return FALSE;
+       case G_IO_STATUS_NORMAL:
+           s = g_strndup(buf, bytes_read > 128 ? 128 : bytes_read);
+           libbalsa_information(LIBBALSA_INFORMATION_MESSAGE, "%s", s);
+           g_free(s);
+           /* if(fwrite(buf, 1, bytes_read, stdout) != bytes_read); */
+           break;
+       case G_IO_STATUS_EOF:
+           printf("pipe_out got EOF\n");
+           pipe_data_destroy(pipe);
+           g_clear_error(&error);
+           return FALSE;
+       case G_IO_STATUS_AGAIN: break;
+       }
     }
 
     if ( condition == G_IO_HUP) {
-        if (channel == pipe->out_channel) {
-            pipe->out_closed = 1;
-        } else {
-            pipe->err_closed = 1;
-        }
-        if (pipe->out_closed && pipe->err_closed) {
-            pipe_data_destroy((struct PipeData *)data);
-        }
+       if(channel == pipe->out_channel)
+           pipe->out_closed = 1;
+       else
+           pipe->err_closed = 1;
+       if(pipe->out_closed && pipe->err_closed)
+           pipe_data_destroy((struct PipeData*)data);
     }
 
-    if ((condition & G_IO_ERR) == G_IO_ERR) {
-        fprintf(stderr,
-                "pipe_out_watch encountered error…\n");
-        pipe_data_destroy(pipe);
-        return FALSE;
+    if ( (condition & G_IO_ERR) == G_IO_ERR) {
+       fprintf(stderr,
+               "pipe_out_watch encountered error…\n");
+       pipe_data_destroy(pipe);
+       return FALSE;
     }
     return TRUE;
 }
 
-
 /** BndxPipeQueue represents the context of message pipe
     processing. Several messages from specified mailbox can be sent
     via the pipe. For each message, a separate context as stored in
@@ -2644,29 +2411,28 @@ bndx_pipe_queue_last(struct BndxPipeQueue *queue)
     int std_error;
     guint msgno = 0;
 
-    while (queue->msgnos->len > 0) {
-        msgno = g_array_index(queue->msgnos, guint, queue->msgnos->len - 1);
-        stream =
-            libbalsa_mailbox_get_message_stream(queue->mailbox, msgno, TRUE);
-        g_array_remove_index(queue->msgnos, queue->msgnos->len - 1);
-        if (stream) {
-            break;
-        }
-        if (!stream) {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _("Cannot access message %u to pass to %s"),
-                                 msgno, queue->pipe_cmd);
-        }
-    }
-
-    if ((queue->msgnos->len == 0) && !stream) {
-        printf("Piping finished. Destroying the context.\n");
-        libbalsa_mailbox_unregister_msgnos(queue->mailbox, queue->msgnos);
-        libbalsa_mailbox_close(queue->mailbox, FALSE);
-        g_array_free(queue->msgnos, TRUE);
-        g_free(queue->pipe_cmd);
-        g_free(queue);
-        return;
+    while(queue->msgnos->len>0){
+       msgno = g_array_index(queue->msgnos, guint, queue->msgnos->len-1);
+       stream =
+           libbalsa_mailbox_get_message_stream(queue->mailbox, msgno, TRUE);
+       g_array_remove_index(queue->msgnos, queue->msgnos->len-1);
+       if(stream)
+           break;
+       if(!stream) {
+           libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                                _("Cannot access message %u to pass to %s"),
+                                msgno, queue->pipe_cmd);
+       }
+    }
+
+    if(queue->msgnos->len == 0 && !stream) {
+       printf("Piping finished. Destroying the context.\n");
+       libbalsa_mailbox_unregister_msgnos(queue->mailbox, queue->msgnos);
+       libbalsa_mailbox_close(queue->mailbox, FALSE);
+       g_array_free(queue->msgnos, TRUE);
+       g_free(queue->pipe_cmd);
+       g_free(queue);
+       return;
     }
 
     pipe = g_new0(struct PipeData, 1);
@@ -2677,15 +2443,15 @@ bndx_pipe_queue_last(struct BndxPipeQueue *queue)
     pipe->message = g_malloc(pipe->message_length);
     libbalsa_mailbox_lock_store(queue->mailbox);
     chars_read = g_mime_stream_read(stream, pipe->message,
-                                    pipe->message_length);
+                                   pipe->message_length);
     libbalsa_mailbox_unlock_store(queue->mailbox);
-    if (chars_read != pipe->message_length) {
-        libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                             _("Cannot read message %u to pass to %s"),
-                             msgno, queue->pipe_cmd);
-        bndx_pipe_queue_last(queue);
-        g_free(pipe);
-        return;
+    if(chars_read != pipe->message_length) {
+           libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                                _("Cannot read message %u to pass to %s"),
+                                msgno, queue->pipe_cmd);
+       bndx_pipe_queue_last(queue);
+       g_free(pipe);
+       return;
     }
 
     argv = g_new(gchar *, 4);
@@ -2694,71 +2460,67 @@ bndx_pipe_queue_last(struct BndxPipeQueue *queue)
     argv[2] = g_strdup(queue->pipe_cmd);
     argv[3] = NULL;
     spawned =
-        g_spawn_async_with_pipes(NULL, argv, NULL,
-                                 0, NULL, NULL,
-                                 NULL,
-                                 &std_input, &std_output,
-                                 &std_error,
-                                 &error);
+       g_spawn_async_with_pipes(NULL, argv, NULL,
+                                0, NULL, NULL,
+                                NULL,
+                                &std_input, &std_output,
+                                &std_error,
+                                &error);
     g_strfreev(argv);
-    if (spawned) {
-        pipe->in_channel = g_io_channel_unix_new(std_input);
-        g_io_channel_set_flags(pipe->in_channel, G_IO_FLAG_NONBLOCK, NULL);
-        pipe->in_source = g_io_add_watch(pipe->in_channel, G_IO_OUT | G_IO_HUP,
-                                         pipe_in_watch, pipe);
-        pipe->out_channel = g_io_channel_unix_new(std_output);
-        g_io_channel_set_flags(pipe->out_channel, G_IO_FLAG_NONBLOCK, NULL);
-        pipe->out_source = g_io_add_watch(pipe->out_channel, G_IO_IN | G_IO_HUP,
-                                          pipe_out_watch, pipe);
-        pipe->err_channel = g_io_channel_unix_new(std_error);
-        g_io_channel_set_flags(pipe->err_channel, G_IO_FLAG_NONBLOCK, NULL);
-        pipe->err_source = g_io_add_watch(pipe->err_channel, G_IO_IN | G_IO_HUP,
-                                          pipe_out_watch, pipe);
-
-        g_io_channel_set_encoding(pipe->in_channel, NULL, NULL);
-        g_io_channel_set_encoding(pipe->out_channel, NULL, NULL);
-        g_io_channel_set_encoding(pipe->err_channel, NULL, NULL);
-        g_io_channel_set_close_on_unref(pipe->in_channel, TRUE);
-        g_io_channel_set_close_on_unref(pipe->out_channel, TRUE);
-        g_io_channel_set_close_on_unref(pipe->err_channel, TRUE);
+    if(spawned) {
+       pipe->in_channel = g_io_channel_unix_new(std_input);
+       g_io_channel_set_flags(pipe->in_channel, G_IO_FLAG_NONBLOCK, NULL);
+       pipe->in_source = g_io_add_watch(pipe->in_channel, G_IO_OUT | G_IO_HUP,
+                                        pipe_in_watch, pipe);
+       pipe->out_channel = g_io_channel_unix_new(std_output);
+       g_io_channel_set_flags(pipe->out_channel, G_IO_FLAG_NONBLOCK, NULL);
+       pipe->out_source = g_io_add_watch(pipe->out_channel, G_IO_IN|G_IO_HUP,
+                                         pipe_out_watch, pipe);
+       pipe->err_channel = g_io_channel_unix_new(std_error);
+       g_io_channel_set_flags(pipe->err_channel, G_IO_FLAG_NONBLOCK, NULL);
+       pipe->err_source = g_io_add_watch(pipe->err_channel, G_IO_IN | G_IO_HUP,
+                                         pipe_out_watch, pipe);
+
+       g_io_channel_set_encoding(pipe->in_channel, NULL, NULL);
+       g_io_channel_set_encoding(pipe->out_channel, NULL, NULL);
+       g_io_channel_set_encoding(pipe->err_channel, NULL, NULL);
+       g_io_channel_set_close_on_unref(pipe->in_channel, TRUE);
+       g_io_channel_set_close_on_unref(pipe->out_channel, TRUE);
+       g_io_channel_set_close_on_unref(pipe->err_channel, TRUE);
     } else {
-        printf("Could not spawn pipe %s : %s\n", queue->pipe_cmd,
-               error ? error->message : "unknown");
-        g_clear_error(&error);
-        g_free(pipe);
+       printf("Could not spawn pipe %s : %s\n", queue->pipe_cmd,
+              error ? error->message : "unknown");
+       g_clear_error(&error);
+       g_free(pipe);
     }
 }
 
-
 /** Initiates the asynchronous process of sending specified messages
     from given mailbox via the provided command. */
 static gboolean
 bndx_start_pipe_messages_array(LibBalsaMailbox *mailbox,
-                               GArray          *msgnos,
-                               const char      *pipe_cmd)
+                              GArray *msgnos,
+                              const char *pipe_cmd)
 {
     guint i;
     struct BndxPipeQueue *queue;
 
-    if (!libbalsa_mailbox_open(mailbox, NULL)) {
-        return FALSE;
-    }
+    if(!libbalsa_mailbox_open(mailbox, NULL))
+       return FALSE;
 
     queue = g_new(struct BndxPipeQueue, 1);
     queue->mailbox = mailbox;
     queue->msgnos = g_array_sized_new(FALSE, FALSE, sizeof(guint), msgnos->len);
     queue->pipe_cmd = g_strdup(pipe_cmd);
-    for (i = 0; i < msgnos->len; i++) {
-        g_array_append_val(queue->msgnos,
-                           g_array_index(msgnos, guint, msgnos->len - i - 1));
-    }
+    for(i=0; i<msgnos->len; i++)
+       g_array_append_val(queue->msgnos,
+                          g_array_index(msgnos, guint, msgnos->len-i-1));
     libbalsa_mailbox_register_msgnos(mailbox, queue->msgnos);
 
     bndx_pipe_queue_last(queue);
     return TRUE;
 }
 
-
 struct bndx_mailbox_info {
     GtkWidget *dialog;
     GtkWidget *entry;
@@ -2777,12 +2539,10 @@ bndx_mailbox_notify(gpointer data)
     g_free(info);
 }
 
-
 #define BALSA_INDEX_PIPE_INFO "balsa-index-pipe-info"
 
 static void
-bndx_pipe_response(GtkWidget                *dialog,
-                   gint                      response,
+bndx_pipe_response(GtkWidget * dialog, gint response,
                    struct bndx_mailbox_info *info)
 {
     LibBalsaMailbox *mailbox = info->mailbox;
@@ -2795,38 +2555,36 @@ bndx_pipe_response(GtkWidget                *dialog,
 
         pipe_cmd =
             gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT
-                                                   (info->entry));
+                                               (info->entry));
         active_cmd =
             g_list_find_custom(balsa_app.pipe_cmds, pipe_cmd,
                                (GCompareFunc) strcmp);
-        if (!active_cmd) {
+        if (!active_cmd)
             balsa_app.pipe_cmds =
                 g_list_prepend(balsa_app.pipe_cmds, g_strdup(pipe_cmd));
-        } else if (active_cmd != balsa_app.pipe_cmds) {
+        else if (active_cmd != balsa_app.pipe_cmds) {
             balsa_app.pipe_cmds =
                 g_list_remove_link(balsa_app.pipe_cmds, active_cmd);
             balsa_app.pipe_cmds =
                 g_list_concat(active_cmd, balsa_app.pipe_cmds);
         }
 
-        bndx_start_pipe_messages_array(mailbox, info->msgnos, pipe_cmd);
+       bndx_start_pipe_messages_array(mailbox, info->msgnos, pipe_cmd);
         g_free(pipe_cmd);
     }
 
-    if (!mailbox) {
+    if (!mailbox)
         return;
-    }
     g_object_remove_weak_pointer(G_OBJECT(mailbox), (gpointer) & mailbox);
 
     libbalsa_mailbox_close(mailbox, balsa_app.expunge_on_close);
     g_object_set_data(G_OBJECT(mailbox), BALSA_INDEX_PIPE_INFO, NULL);
 }
 
-
 #define HIG_PADDING 12
 
 void
-balsa_index_pipe(BalsaIndex *index)
+balsa_index_pipe(BalsaIndex * index)
 {
     struct bndx_mailbox_info *info;
     GtkWidget *label, *entry;
@@ -2846,9 +2604,8 @@ balsa_index_pipe(BalsaIndex *index)
         return;
     }
 
-    if (!libbalsa_mailbox_open(index->mailbox_node->mailbox, NULL)) {
-        return;
-    }
+    if(!libbalsa_mailbox_open(index->mailbox_node->mailbox, NULL))
+       return;
     info = g_new(struct bndx_mailbox_info, 1);
     info->bindex = index;
     info->mailbox = index->mailbox_node->mailbox;
@@ -2858,13 +2615,13 @@ balsa_index_pipe(BalsaIndex *index)
     info->msgnos = balsa_index_selected_msgnos_new(index);
 
     info->dialog = dialog =
-            gtk_dialog_new_with_buttons(_("Pipe message through a program"),
-                                        GTK_WINDOW(balsa_app.main_window),
-                                        GTK_DIALOG_DESTROY_WITH_PARENT |
-                                        libbalsa_dialog_flags(),
-                                        _("_Run"), GTK_RESPONSE_OK,
-                                        _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                        NULL);
+        gtk_dialog_new_with_buttons(_("Pipe message through a program"),
+                                    GTK_WINDOW(balsa_app.main_window),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT |
+                                    libbalsa_dialog_flags(),
+                                    _("_Run"), GTK_RESPONSE_OK,
+                                    _("_Cancel"), GTK_RESPONSE_CANCEL,
+                                    NULL);
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(dialog, GTK_WINDOW(balsa_app.main_window));
 #endif
@@ -2878,10 +2635,9 @@ balsa_index_pipe(BalsaIndex *index)
     gtk_box_pack_start(GTK_BOX(vbox), label);
 
     info->entry = entry = gtk_combo_box_text_new_with_entry();
-    for (list = balsa_app.pipe_cmds; list; list = list->next) {
+    for (list = balsa_app.pipe_cmds; list; list = list->next)
         gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(entry),
                                        list->data);
-    }
     gtk_combo_box_set_active(GTK_COMBO_BOX(entry), 0);
     gtk_box_pack_start(GTK_BOX(vbox), entry);
 
@@ -2893,21 +2649,19 @@ balsa_index_pipe(BalsaIndex *index)
     gtk_widget_show(dialog);
 }
 
-
 /** GtkTreeView can leave no messages showing after changing the view
  * filter, even though the view does contain messages.  We prefer to
  * scroll to either the current message. If this one is unavailable -
  * to the last message in the view, if any. */
 void
-balsa_index_ensure_visible(BalsaIndex *index)
+balsa_index_ensure_visible(BalsaIndex * index)
 {
     GtkTreeView *tree_view = GTK_TREE_VIEW(index);
     GdkRectangle rect;
     GtkTreePath *path = NULL;
 
-    if (!gtk_widget_get_window(GTK_WIDGET(tree_view))) {
+    if (!gtk_widget_get_window(GTK_WIDGET(tree_view)))
         return;
-    }
 
     if (!bndx_find_current_msgno(index, &path, NULL)) {
         /* Current message not displayed, make sure that something
@@ -2945,9 +2699,8 @@ balsa_index_ensure_visible(BalsaIndex *index)
     }
 }
 
-
 void
-balsa_index_select_all(BalsaIndex *bindex)
+balsa_index_select_all(BalsaIndex * bindex)
 {
     GtkTreeView *tree_view = GTK_TREE_VIEW(bindex);
     GtkTreeSelection *selection = gtk_tree_view_get_selection(tree_view);
@@ -2959,21 +2712,19 @@ balsa_index_select_all(BalsaIndex *bindex)
     g_signal_emit(bindex, balsa_index_signals[INDEX_CHANGED], 0);
 }
 
-
 gint
-balsa_index_count_selected_messages(BalsaIndex *bindex)
+balsa_index_count_selected_messages(BalsaIndex * bindex)
 {
     g_return_val_if_fail(BALSA_IS_INDEX(bindex), -1);
 
     return
         gtk_tree_selection_count_selected_rows(gtk_tree_view_get_selection
-                                                   (GTK_TREE_VIEW(bindex)));
+                                               (GTK_TREE_VIEW(bindex)));
 }
 
-
 /* Select all messages in current thread */
 void
-balsa_index_select_thread(BalsaIndex *bindex)
+balsa_index_select_thread(BalsaIndex * bindex)
 {
     GtkTreeIter iter;
     GtkTreeModel *model = GTK_TREE_MODEL(bindex->mailbox_node->mailbox);
@@ -2986,13 +2737,11 @@ balsa_index_select_thread(BalsaIndex *bindex)
     if (!bindex->current_msgno
         || !libbalsa_mailbox_msgno_find(bindex->mailbox_node->mailbox,
                                         bindex->current_msgno, NULL,
-                                        &iter)) {
+                                        &iter))
         return;
-    }
 
-    while (gtk_tree_model_iter_parent(model, &next_iter, &iter)) {
+    while (gtk_tree_model_iter_parent(model, &next_iter, &iter))
         iter = next_iter;
-    }
 
     path = gtk_tree_model_get_path(model, &iter);
     gtk_tree_view_expand_row(GTK_TREE_VIEW(bindex), path, TRUE);
@@ -3002,16 +2751,15 @@ balsa_index_select_thread(BalsaIndex *bindex)
         gtk_tree_selection_select_iter(selection, &iter);
 
         valid = gtk_tree_model_iter_children(model, &next_iter, &iter);
-        if (valid) {
+        if (valid)
             iter = next_iter;
-        } else {
+        else {
             do {
                 GtkTreeIter save_iter = iter;
 
                 valid = gtk_tree_model_iter_next(model, &iter);
-                if (valid) {
+                if (valid)
                     break;
-                }
                 valid = gtk_tree_model_iter_parent(model, &iter,
                                                    &save_iter);
             } while (valid);
diff --git a/src/balsa-index.h b/src/balsa-index.h
index a24759b..f5404f9 100644
--- a/src/balsa-index.h
+++ b/src/balsa-index.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -26,176 +26,164 @@
 
 G_BEGIN_DECLS
 
-GType balsa_index_get_type(void);
+    GType balsa_index_get_type(void);
 
 #define BALSA_TYPE_INDEX          (balsa_index_get_type ())
-#define BALSA_INDEX(obj)          (G_TYPE_CHECK_INSTANCE_CAST (obj, BALSA_TYPE_INDEX, \
-                                                               BalsaIndex))
-#define BALSA_INDEX_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST (klass, BALSA_TYPE_INDEX, \
-                                                            BalsaIndexClass))
+#define BALSA_INDEX(obj)          (G_TYPE_CHECK_INSTANCE_CAST (obj, BALSA_TYPE_INDEX, BalsaIndex))
+#define BALSA_INDEX_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST (klass, BALSA_TYPE_INDEX, BalsaIndexClass))
 #define BALSA_IS_INDEX(obj)       (G_TYPE_CHECK_INSTANCE_TYPE (obj, BALSA_TYPE_INDEX))
 #define BALSA_IS_INDEX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE (klass, BALSA_TYPE_INDEX))
 
 
-typedef enum {
-    BALSA_INDEX_WIDE, BALSA_INDEX_NARROW
-}
-BalsaIndexWidthPreference;
-
-typedef struct _BalsaIndex BalsaIndex;
-typedef struct _BalsaIndexClass BalsaIndexClass;
-
-struct _BalsaIndex {
-    GtkTreeView tree_view;
-
-    /* the popup menu and some items we need to refer to */
-    GtkWidget *popup_menu;
-    GtkWidget *delete_item;
-    GtkWidget *undelete_item;
-    GtkWidget *move_to_trash_item;
-    GtkWidget *toggle_item;
-    GtkWidget *move_to_item;
-
-    BalsaMailboxNode *mailbox_node;
-    guint current_msgno;
-    guint next_msgno;
-    gboolean current_message_is_deleted : 1;
-    gboolean prev_message : 1;
-    gboolean next_message : 1;
-    gboolean has_selection_changed_idle : 1;
-    gboolean has_mailbox_changed_idle : 1;
-    gboolean collapsing : 1;
-    int filter_no;
-    gchar *filter_string;     /* Quick view filter string, if any */
-
-    /* signal handler ids */
-    gulong row_expanded_id;
-    gulong row_collapsed_id;
-    gulong selection_changed_id;
-
-    LibBalsaMailboxSearchIter *search_iter;
-    BalsaIndexWidthPreference width_preference;
-};
-
-struct _BalsaIndexClass {
-    GtkTreeViewClass parent_class;
-
-    void (*index_changed) (BalsaIndex *bindex);
-};
+    typedef enum { BALSA_INDEX_WIDE, BALSA_INDEX_NARROW }
+        BalsaIndexWidthPreference;
+
+    typedef struct _BalsaIndex BalsaIndex;
+    typedef struct _BalsaIndexClass BalsaIndexClass;
+
+    struct _BalsaIndex {
+        GtkTreeView tree_view;
+        
+        /* the popup menu and some items we need to refer to */
+        GtkWidget *popup_menu;
+        GtkWidget *delete_item;
+        GtkWidget *undelete_item;
+        GtkWidget *move_to_trash_item;
+        GtkWidget *toggle_item;
+        GtkWidget *move_to_item;
+
+        BalsaMailboxNode* mailbox_node;
+        guint current_msgno;
+        guint next_msgno;
+       gboolean current_message_is_deleted:1;
+        gboolean prev_message:1;
+        gboolean next_message:1;
+        gboolean has_selection_changed_idle:1;
+        gboolean has_mailbox_changed_idle:1;
+        gboolean collapsing:1;
+        int    filter_no;
+        gchar *filter_string; /* Quick view filter string, if any */
+
+        /* signal handler ids */
+        gulong row_expanded_id;
+        gulong row_collapsed_id;
+        gulong selection_changed_id;
+
+       LibBalsaMailboxSearchIter *search_iter;
+        BalsaIndexWidthPreference width_preference;
+    };
+
+    struct _BalsaIndexClass {
+       GtkTreeViewClass parent_class;
+
+        void (*index_changed) (BalsaIndex* bindex);
+    };
 
 /* tree model columns */
-enum {
-    BNDX_MESSAGE_COLUMN,
-    BNDX_INDEX_COLUMN,
-    BNDX_STATUS_COLUMN,
-    BNDX_ATTACH_COLUMN,
-    BNDX_FROM_COLUMN,
-    BNDX_SUBJECT_COLUMN,
-    BNDX_DATE_COLUMN,
-    BNDX_SIZE_COLUMN,
-    BNDX_COLOR_COLUMN,
-    BNDX_WEIGHT_COLUMN,
-    BNDX_N_COLUMNS
-};
+    enum {
+        BNDX_MESSAGE_COLUMN,
+        BNDX_INDEX_COLUMN,
+        BNDX_STATUS_COLUMN,
+        BNDX_ATTACH_COLUMN,
+        BNDX_FROM_COLUMN,
+        BNDX_SUBJECT_COLUMN,
+        BNDX_DATE_COLUMN,
+        BNDX_SIZE_COLUMN,
+        BNDX_COLOR_COLUMN,
+        BNDX_WEIGHT_COLUMN,
+        BNDX_N_COLUMNS
+    };
 
 /* function prototypes */
+    
+    GtkWidget *balsa_index_new(void);
 
-GtkWidget *balsa_index_new(void);
 
-
-/* sets the mail stream; if it's a new stream, then it's
+/* sets the mail stream; if it's a new stream, then it's 
  * contents is loaded into the index */
-gboolean balsa_index_load_mailbox_node(BalsaIndex       *bindex,
-                                       BalsaMailboxNode *mbnode);
-void balsa_index_set_width_preference(BalsaIndex               *bindex,
-                                      BalsaIndexWidthPreference pref);
-void balsa_index_scroll_on_open(BalsaIndex *index);
-void balsa_index_update_tree(BalsaIndex *bindex,
-                             gboolean    expand);
-void balsa_index_set_threading_type(BalsaIndex *bindex,
-                                    int         thtype);
-void balsa_index_set_view_filter(BalsaIndex        *bindex,
-                                 int                filter_no,
-                                 const gchar       *filter_string,
-                                 LibBalsaCondition *filter);
+    gboolean balsa_index_load_mailbox_node(BalsaIndex * bindex,
+                                           BalsaMailboxNode * mbnode);
+    void balsa_index_set_width_preference(BalsaIndex *bindex,
+                                          BalsaIndexWidthPreference pref);
+    void balsa_index_scroll_on_open(BalsaIndex *index);
+    void balsa_index_update_tree(BalsaIndex *bindex, gboolean expand);
+    void balsa_index_set_threading_type(BalsaIndex * bindex, int thtype);
+    void balsa_index_set_view_filter(BalsaIndex *bindex,
+                                     int filter_no,
+                                     const gchar *filter_string,
+                                     LibBalsaCondition *filter);
 
 /* move or copy a list of messages */
-void balsa_index_transfer(BalsaIndex      *index,
-                          GArray          *msgnos,
-                          LibBalsaMailbox *to_mailbox,
-                          gboolean         copy);
+    void balsa_index_transfer(BalsaIndex * index, GArray * msgnos,
+                              LibBalsaMailbox * to_mailbox, gboolean copy);
 
 /* select up/down the index */
-void balsa_index_select_next(BalsaIndex *);
-gboolean balsa_index_select_next_unread(BalsaIndex *index);
-void balsa_index_select_next_flagged(BalsaIndex *bindex);
-void balsa_index_select_previous(BalsaIndex *);
-void balsa_index_set_next_msgno(BalsaIndex *bindex,
-                                guint       msgno);
-guint balsa_index_get_next_msgno(BalsaIndex *bindex);
-
-void balsa_index_find(BalsaIndex                *bindex,
-                      LibBalsaMailboxSearchIter *search_iter,
-                      gboolean                   previous,
-                      gboolean                   wrap);
-
-/* balsa index page stuff */
-void balsa_message_reply(gpointer user_data);
-void balsa_message_replytoall(gpointer user_data);
-void balsa_message_replytogroup(gpointer user_data);
-
-void balsa_message_forward_attached(gpointer data);
-void balsa_message_forward_inline(gpointer data);
-void balsa_message_forward_quoted(gpointer data);
-void balsa_message_forward_default(gpointer data);
-void balsa_message_continue(gpointer data);
-
-void balsa_message_move_to_trash(gpointer user_data);
-
-void balsa_index_toggle_flag(BalsaIndex         *index,
-                             LibBalsaMessageFlag flag);
+    void balsa_index_select_next(BalsaIndex *);
+    gboolean balsa_index_select_next_unread(BalsaIndex * index);
+    void balsa_index_select_next_flagged(BalsaIndex * bindex);
+    void balsa_index_select_previous(BalsaIndex *);
+    void balsa_index_set_next_msgno(BalsaIndex * bindex, guint msgno);
+    guint balsa_index_get_next_msgno(BalsaIndex * bindex);
 
-void balsa_index_reset(BalsaIndex *index);
-gint balsa_find_notebook_page_num(LibBalsaMailbox *mailbox);
-void balsa_index_set_column_widths(BalsaIndex *index);
-GList *balsa_index_selected_list(BalsaIndex *index);
-GArray *balsa_index_selected_msgnos_new(BalsaIndex *index);
-void balsa_index_selected_msgnos_free(BalsaIndex *index,
-                                      GArray     *msgnos);
-void balsa_index_move_subtree(BalsaIndex  *index,
-                              GtkTreePath *root,
-                              GtkTreePath *new_parent);
+    void balsa_index_find(BalsaIndex * bindex,
+                         LibBalsaMailboxSearchIter * search_iter,
+                          gboolean previous, gboolean wrap);
 
-/* Updating index columns when preferences change */
-void balsa_index_refresh_date(BalsaIndex *index);
-void balsa_index_refresh_size(BalsaIndex *index);
-
-/* Expunge deleted messages. */
-void balsa_index_expunge(BalsaIndex *index);
-
-/* Message window */
-guint balsa_index_next_msgno(BalsaIndex *index,
-                             guint       current_msgno);
-guint balsa_index_previous_msgno(BalsaIndex *index,
-                                 guint       current_msgno);
-
-/* Pipe messages */
-void balsa_index_pipe(BalsaIndex *index);
-
-/* Make sure messages are visible. */
-void balsa_index_ensure_visible(BalsaIndex *index);
-
-/* Select all without previewing any. */
-void balsa_index_select_all(BalsaIndex *bindex);
-
-/* Select thread containing current message. */
-void balsa_index_select_thread(BalsaIndex *bindex);
-
-/* Count of selected messages. */
-gint balsa_index_count_selected_messages(BalsaIndex *bindex);
+/* balsa index page stuff */
+    void balsa_message_reply(gpointer user_data);
+    void balsa_message_replytoall(gpointer user_data);
+    void balsa_message_replytogroup(gpointer user_data);
+
+    void balsa_message_forward_attached(gpointer data);
+    void balsa_message_forward_inline(gpointer data);
+    void balsa_message_forward_quoted(gpointer data);
+    void balsa_message_forward_default(gpointer data);
+    void balsa_message_continue(gpointer data);
+
+    void balsa_message_move_to_trash(gpointer user_data);
+
+    void balsa_index_toggle_flag(BalsaIndex *index,
+                                 LibBalsaMessageFlag flag);
+
+    void balsa_index_reset(BalsaIndex * index);
+    gint balsa_find_notebook_page_num(LibBalsaMailbox * mailbox);
+    void balsa_index_set_column_widths(BalsaIndex * index);
+    GList * balsa_index_selected_list(BalsaIndex * index);
+    GArray * balsa_index_selected_msgnos_new(BalsaIndex * index);
+    void balsa_index_selected_msgnos_free(BalsaIndex * index, GArray * msgnos);
+    void balsa_index_move_subtree(BalsaIndex * index,
+                                  GtkTreePath * root,
+                                  GtkTreePath * new_parent);
+
+    /* Updating index columns when preferences change */
+    void balsa_index_refresh_date (BalsaIndex * index);
+    void balsa_index_refresh_size (BalsaIndex * index);
+
+    /* Expunge deleted messages. */
+    void balsa_index_expunge(BalsaIndex * index);
+ 
+    /* Message window */        
+    guint balsa_index_next_msgno(BalsaIndex * index, guint current_msgno);
+    guint balsa_index_previous_msgno(BalsaIndex * index,
+                                     guint current_msgno);
+
+    /* Pipe messages */
+    void balsa_index_pipe(BalsaIndex * index);
+
+    /* Make sure messages are visible. */
+    void balsa_index_ensure_visible(BalsaIndex * index);
+
+    /* Select all without previewing any. */
+    void balsa_index_select_all(BalsaIndex * bindex);
+
+    /* Select thread containing current message. */
+    void balsa_index_select_thread(BalsaIndex * bindex);
+
+    /* Count of selected messages. */
+    gint balsa_index_count_selected_messages(BalsaIndex * bindex);
 
 #define BALSA_INDEX_VIEW_ON_OPEN "balsa-index-view-on-open"
 
 G_END_DECLS
 
-#endif                          /* __BALSA_INDEX_H__ */
+#endif                         /* __BALSA_INDEX_H__ */
diff --git a/src/balsa-mblist.c b/src/balsa-mblist.c
index 1e1039a..58c0692 100644
--- a/src/balsa-mblist.c
+++ b/src/balsa-mblist.c
@@ -18,7 +18,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-mblist.h"
 
@@ -34,7 +34,7 @@
 #include "main-window.h"
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#  include "macosx-helpers.h"
 #endif
 
 /* Column numbers (used for sort_column_id): */
@@ -73,89 +73,69 @@ enum {
     HAS_UNREAD_MAILBOX,
     LAST_SIGNAL
 };
-static gint balsa_mblist_signals[LAST_SIGNAL] = {
-    0
-};
+static gint balsa_mblist_signals[LAST_SIGNAL] = { 0 };
 
-static const gchar *bmbl_drop_types[] = {
+static const gchar * bmbl_drop_types[] = {
     "x-application/x-message-list"
 };
 
 static GtkTreeViewClass *parent_class = NULL;
 
 /* class methods */
-static void bmbl_class_init(BalsaMBListClass *klass);
-static void bmbl_set_property(GObject      *object,
-                              guint         prop_id,
-                              const GValue *value,
-                              GParamSpec   *pspec);
-static void bmbl_get_property(GObject    *object,
-                              guint       prop_id,
-                              GValue     *value,
-                              GParamSpec *pspec);
-static gboolean bmbl_drag_motion(GtkWidget      *mblist,
-                                 GdkDragContext *context,
-                                 gint            x,
-                                 gint            y,
-                                 guint           time);
-static gboolean bmbl_popup_menu(GtkWidget *widget);
-static void bmbl_init(BalsaMBList *mblist);
-static gboolean bmbl_selection_func(GtkTreeSelection *selection,
-                                    GtkTreeModel     *model,
-                                    GtkTreePath      *path,
-                                    gboolean          path_currently_selected,
-                                    gpointer          data);
+static void bmbl_class_init(BalsaMBListClass * klass);
+static void bmbl_set_property(GObject * object, guint prop_id,
+                              const GValue * value, GParamSpec * pspec);
+static void bmbl_get_property(GObject * object, guint prop_id,
+                              GValue * value, GParamSpec * pspec);
+static gboolean bmbl_drag_motion(GtkWidget * mblist,
+                                 GdkDragContext * context, gint x, gint y,
+                                 guint time);
+static gboolean bmbl_popup_menu(GtkWidget * widget);
+static void bmbl_init(BalsaMBList * mblist);
+static gboolean bmbl_selection_func(GtkTreeSelection * selection,
+                                    GtkTreeModel * model,
+                                    GtkTreePath * path,
+                                    gboolean path_currently_selected,
+                                    gpointer data);
 
 /* callbacks */
-static void bmbl_tree_expand(GtkTreeView *tree_view,
-                             GtkTreeIter *iter,
-                             GtkTreePath *path,
-                             gpointer     data);
-static void bmbl_tree_collapse(GtkTreeView *tree_view,
-                               GtkTreeIter *iter,
-                               GtkTreePath *path,
-                               gpointer     data);
-static gint bmbl_row_compare(GtkTreeModel *model,
-                             GtkTreeIter  *iter1,
-                             GtkTreeIter  *iter2,
-                             gpointer      data);
-static void bmbl_column_resize(GtkWidget     *widget,
-                               GtkAllocation *allocation,
-                               gint           baseline,
-                               GtkAllocation *clip,
-                               gpointer       data);
-static void bmbl_drag_cb(GtkWidget        *widget,
-                         GdkDragContext   *context,
-                         gint              x,
-                         gint              y,
-                         GtkSelectionData *selection_data,
-                         guint32           time,
-                         gpointer          data);
-static void bmbl_row_activated_cb(GtkTreeView       *tree_view,
-                                  GtkTreePath       *path,
-                                  GtkTreeViewColumn *column,
-                                  gpointer           data);
-static void bmbl_mailbox_changed_cb(LibBalsaMailbox *mailbox,
-                                    gpointer         data);
-
+static void bmbl_tree_expand(GtkTreeView * tree_view, GtkTreeIter * iter,
+                             GtkTreePath * path, gpointer data);
+static void bmbl_tree_collapse(GtkTreeView * tree_view, GtkTreeIter * iter,
+                               GtkTreePath * path, gpointer data);
+static gint bmbl_row_compare(GtkTreeModel * model,
+                             GtkTreeIter * iter1,
+                             GtkTreeIter * iter2, gpointer data);
+static void bmbl_column_resize(GtkWidget * widget, GtkAllocation * allocation,
+                               gint baseline, GtkAllocation * clip,
+                               gpointer data);
+static void bmbl_drag_cb(GtkWidget        * widget,
+                         GdkDragContext   * context,
+                         gint               x,
+                         gint               y,
+                         GtkSelectionData * selection_data,
+                         guint32            time,
+                         gpointer           data);
+static void bmbl_row_activated_cb(GtkTreeView * tree_view,
+                                  GtkTreePath * path,
+                                  GtkTreeViewColumn * column,
+                                  gpointer data);
+static void bmbl_mailbox_changed_cb(LibBalsaMailbox * mailbox,
+                                   gpointer data);
 /* helpers */
-static gboolean bmbl_find_all_unread_mboxes_func(GtkTreeModel *model,
-                                                 GtkTreePath  *path,
-                                                 GtkTreeIter  *iter,
-                                                 gpointer      data);
-static void bmbl_real_disconnect_mbnode_signals(BalsaMailboxNode *mbnode,
-                                                GtkTreeModel     *model);
-static gboolean bmbl_store_redraw_mbnode(GtkTreeIter      *iter,
-                                         BalsaMailboxNode *mbnode);
-static void bmbl_node_style(GtkTreeModel *model,
-                            GtkTreeIter  *iter);
-static gint bmbl_core_mailbox(LibBalsaMailbox *mailbox);
-static void bmbl_do_popup(GtkTreeView    *tree_view,
-                          GtkTreePath    *path,
-                          const GdkEvent *event);
-static void bmbl_expand_to_row(BalsaMBList *mblist,
-                               GtkTreePath *path);
-
+static gboolean bmbl_find_all_unread_mboxes_func(GtkTreeModel * model,
+                                                 GtkTreePath * path,
+                                                 GtkTreeIter * iter,
+                                                 gpointer data);
+static void bmbl_real_disconnect_mbnode_signals(BalsaMailboxNode * mbnode,
+                                             GtkTreeModel * model);
+static gboolean bmbl_store_redraw_mbnode(GtkTreeIter * iter,
+                                        BalsaMailboxNode * mbnode);
+static void bmbl_node_style(GtkTreeModel * model, GtkTreeIter * iter);
+static gint bmbl_core_mailbox(LibBalsaMailbox * mailbox);
+static void bmbl_do_popup(GtkTreeView * tree_view, GtkTreePath * path,
+                          const GdkEvent * event);
+static void bmbl_expand_to_row(BalsaMBList * mblist, GtkTreePath * path);
 /* end of prototypes */
 
 /* class methods */
@@ -166,21 +146,21 @@ balsa_mblist_get_type(void)
     static GType mblist_type = 0;
 
     if (!mblist_type) {
-        static const GTypeInfo mblist_info = {
-            sizeof(BalsaMBListClass),
+       static const GTypeInfo mblist_info = {
+           sizeof(BalsaMBListClass),
             NULL,               /* base_init */
             NULL,               /* base_finalize */
-            (GClassInitFunc) bmbl_class_init,
+           (GClassInitFunc) bmbl_class_init,
             NULL,               /* class_finalize */
             NULL,               /* class_data */
-            sizeof(BalsaMBList),
+           sizeof(BalsaMBList),
             0,                  /* n_preallocs */
-            (GInstanceInitFunc) bmbl_init
-        };
+           (GInstanceInitFunc) bmbl_init
+       };
 
-        mblist_type =
+       mblist_type =
             g_type_register_static(GTK_TYPE_TREE_VIEW,
-                                   "BalsaMBList",
+                                  "BalsaMBList",
                                    &mblist_info, 0);
     }
 
@@ -189,7 +169,7 @@ balsa_mblist_get_type(void)
 
 
 static void
-bmbl_class_init(BalsaMBListClass *klass)
+bmbl_class_init(BalsaMBListClass * klass)
 {
     GObjectClass *object_class;
     GtkWidgetClass *widget_class;
@@ -225,13 +205,12 @@ bmbl_class_init(BalsaMBListClass *klass)
     /* Properties */
     g_object_class_install_property(object_class, PROP_SHOW_CONTENT_INFO,
                                     g_param_spec_boolean
-                                        ("show_content_info", NULL, NULL,
-                                        FALSE, G_PARAM_READWRITE));
+                                    ("show_content_info", NULL, NULL,
+                                     FALSE, G_PARAM_READWRITE));
 }
 
-
 static void
-bmbl_set_property_node_style(GSList *list)
+bmbl_set_property_node_style(GSList * list)
 {
     GSList *l;
     GtkTreePath *path;
@@ -244,9 +223,8 @@ bmbl_set_property_node_style(GSList *list)
             GtkTreeIter iter;
 
             model = gtk_tree_row_reference_get_model(reference);
-            if (gtk_tree_model_get_iter(model, &iter, path)) {
+            if (gtk_tree_model_get_iter(model, &iter, path))
                 bmbl_node_style(model, &iter);
-            }
             gtk_tree_path_free(path);
         }
         gtk_tree_row_reference_free(reference);
@@ -255,12 +233,9 @@ bmbl_set_property_node_style(GSList *list)
     g_slist_free(list);
 }
 
-
 static gboolean
-bmbl_set_property_foreach_func(GtkTreeModel *model,
-                               GtkTreePath  *path,
-                               GtkTreeIter  *iter,
-                               gpointer      data)
+bmbl_set_property_foreach_func(GtkTreeModel * model, GtkTreePath * path,
+                               GtkTreeIter * iter, gpointer data)
 {
     GSList **list = data;
     *list =
@@ -268,13 +243,10 @@ bmbl_set_property_foreach_func(GtkTreeModel *model,
     return FALSE;
 }
 
-
 #define BALSA_MBLIST_DISPLAY_INFO "balsa-mblist-display-info"
 static void
-bmbl_set_property(GObject      *object,
-                  guint         prop_id,
-                  const GValue *value,
-                  GParamSpec   *pspec)
+bmbl_set_property(GObject * object, guint prop_id,
+                          const GValue * value, GParamSpec * pspec)
 {
     BalsaMBList *mblist = BALSA_MBLIST(object);
     GtkTreeView *tree_view = GTK_TREE_VIEW(object);
@@ -310,12 +282,9 @@ bmbl_set_property(GObject      *object,
     }
 }
 
-
 static void
-bmbl_get_property(GObject    *object,
-                  guint       prop_id,
-                  GValue     *value,
-                  GParamSpec *pspec)
+bmbl_get_property(GObject * object, guint prop_id, GValue * value,
+                          GParamSpec * pspec)
 {
     BalsaMBList *mblist = BALSA_MBLIST(object);
 
@@ -323,19 +292,14 @@ bmbl_get_property(GObject    *object,
     case PROP_SHOW_CONTENT_INFO:
         g_value_set_boolean(value, mblist->display_info);
         break;
-
     default:
         break;
     }
 }
 
-
 static gboolean
-bmbl_drag_motion(GtkWidget      *mblist,
-                 GdkDragContext *context,
-                 gint            x,
-                 gint            y,
-                 guint           time)
+bmbl_drag_motion(GtkWidget * mblist, GdkDragContext * context, gint x,
+                 gint y, guint time)
 {
     GtkTreeView *tree_view = GTK_TREE_VIEW(mblist);
     GtkTreePath *path;
@@ -349,9 +313,8 @@ bmbl_drag_motion(GtkWidget      *mblist,
                                                     time);
 
     gtk_tree_view_get_drag_dest_row(tree_view, &path, NULL);
-    if (!path) {
+    if (!path)
         return FALSE;
-    }
 
     can_drop = bmbl_selection_func(selection, model, path, FALSE, NULL);
     gtk_tree_view_set_drag_dest_row(tree_view, can_drop ? path : NULL,
@@ -366,13 +329,12 @@ bmbl_drag_motion(GtkWidget      *mblist,
     return (ret_val && can_drop);
 }
 
-
 /*
  * Set up the mail box list, including the tree's appearance and the
  * callbacks
  */
 static void
-bmbl_init(BalsaMBList *mblist)
+bmbl_init(BalsaMBList * mblist)
 {
     GtkTreeStore *store = balsa_mblist_get_store();
     GtkTreeView *tree_view = GTK_TREE_VIEW(mblist);
@@ -405,7 +367,7 @@ bmbl_init(BalsaMBList *mblist)
     gtk_tree_view_append_column(tree_view, column);
     gtk_tree_view_column_set_sort_column_id(column,
                                             BMBL_TREE_COLUMN_NAME);
-    /* set sort column id will make the column clickable - disable that! */
+     /* set sort column id will make the column clickable - disable that! */
     gtk_tree_view_column_set_clickable(column, FALSE);
 
     /* Message counts are right-justified, each in a column centered
@@ -459,7 +421,7 @@ bmbl_init(BalsaMBList *mblist)
 #endif
     /* arrange for non-mailbox nodes to be non-selectable */
     gtk_tree_selection_set_select_function(gtk_tree_view_get_selection
-                                               (tree_view),
+                                           (tree_view),
                                            bmbl_selection_func, NULL,
                                            NULL);
 
@@ -493,11 +455,10 @@ bmbl_init(BalsaMBList *mblist)
 #endif
     /* Default is ascending sort by name */
     gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store),
-                                         BMBL_TREE_COLUMN_NAME,
-                                         GTK_SORT_ASCENDING);
+                                        BMBL_TREE_COLUMN_NAME,
+                                        GTK_SORT_ASCENDING);
 }
 
-
 /*
  * balsa_mblist_get_store
  *
@@ -507,9 +468,9 @@ bmbl_init(BalsaMBList *mblist)
 GtkTreeStore *
 balsa_mblist_get_store(void)
 {
-    if (balsa_app.mblist_tree_store) {
-        g_object_ref(balsa_app.mblist_tree_store);
-    } else {
+    if (balsa_app.mblist_tree_store)
+       g_object_ref(balsa_app.mblist_tree_store);
+    else {
         balsa_app.mblist_tree_store =
             gtk_tree_store_new(N_COLUMNS,
                                G_TYPE_OBJECT,     /* MBNODE_COLUMN */
@@ -519,7 +480,7 @@ balsa_mblist_get_store(void)
                                PANGO_TYPE_STYLE,  /* STYLE_COLUMN */
                                G_TYPE_STRING,     /* UNREAD_COLUMN */
                                G_TYPE_STRING      /* TOTAL_COLUMN  */
-                               );
+            );
         g_object_add_weak_pointer(G_OBJECT(balsa_app.mblist_tree_store),
                                   (gpointer) & balsa_app.
                                   mblist_tree_store);
@@ -528,18 +489,15 @@ balsa_mblist_get_store(void)
     return balsa_app.mblist_tree_store;
 }
 
-
 /*
  * bmbl_selection_func
  *
  * Used to filter whether or not a row may be selected.
  */
 static gboolean
-bmbl_selection_func(GtkTreeSelection *selection,
-                    GtkTreeModel     *model,
-                    GtkTreePath      *path,
-                    gboolean          path_currently_selected,
-                    gpointer          data)
+bmbl_selection_func(GtkTreeSelection * selection, GtkTreeModel * model,
+                      GtkTreePath * path, gboolean path_currently_selected,
+                      gpointer data)
 {
     GtkTreeIter iter;
     BalsaMailboxNode *mbnode;
@@ -556,7 +514,6 @@ bmbl_selection_func(GtkTreeSelection *selection,
     return retval;
 }
 
-
 GtkWidget *
 balsa_mblist_new()
 {
@@ -567,16 +524,13 @@ balsa_mblist_new()
     return GTK_WIDGET(new);
 }
 
-
 /* callbacks */
 
 /* "row-expanded" */
 
 static void
-bmbl_tree_expand(GtkTreeView *tree_view,
-                 GtkTreeIter *iter,
-                 GtkTreePath *path,
-                 gpointer     data)
+bmbl_tree_expand(GtkTreeView * tree_view, GtkTreeIter * iter,
+                    GtkTreePath * path, gpointer data)
 {
     GtkTreeModel *model = gtk_tree_view_get_model(tree_view);
     BalsaMailboxNode *mbnode;
@@ -585,50 +539,46 @@ bmbl_tree_expand(GtkTreeView *tree_view,
     gtk_tree_model_get(model, iter, MBNODE_COLUMN, &mbnode, -1);
     balsa_mailbox_node_scan_children(mbnode);
 
-    if (!mbnode->mailbox) {
+    if (!mbnode->mailbox)
         gtk_tree_store_set(GTK_TREE_STORE(model), iter,
                            ICON_COLUMN,
                            balsa_icon_id(BALSA_PIXMAP_MBOX_DIR_OPEN),
                            -1);
-    }
     g_object_unref(mbnode);
 
     if (gtk_tree_model_iter_children(model, &child_iter, iter)) {
-        GtkWidget *current_index =
-            balsa_window_find_current_index(balsa_app.main_window);
-        LibBalsaMailbox *current_mailbox =
-            current_index ?
-            BALSA_INDEX(current_index)->mailbox_node->mailbox :
-            NULL;
-        gboolean first_mailbox = TRUE;
+       GtkWidget *current_index =
+           balsa_window_find_current_index(balsa_app.main_window);
+       LibBalsaMailbox *current_mailbox =
+           current_index ?
+           BALSA_INDEX(current_index)->mailbox_node->mailbox :
+           NULL;
+       gboolean first_mailbox = TRUE;
 
         do {
             gtk_tree_model_get(model, &child_iter,
                                MBNODE_COLUMN, &mbnode, -1);
             if (mbnode && mbnode->mailbox) {
-                /* Mark only one mailbox as exposed. */
-                if (first_mailbox) {
-                    libbalsa_mailbox_set_exposed(mbnode->mailbox, TRUE);
-                    first_mailbox = FALSE;
-                } else {
-                    libbalsa_mailbox_set_exposed(mbnode->mailbox, FALSE);
-                }
-                if (mbnode->mailbox == current_mailbox) {
-                    GtkTreeSelection *selection =
-                        gtk_tree_view_get_selection(tree_view);
-                    gtk_tree_selection_select_iter(selection, &child_iter);
-                }
-            }
-            g_object_unref(mbnode);
+               /* Mark only one mailbox as exposed. */
+               if (first_mailbox) {
+                   libbalsa_mailbox_set_exposed(mbnode->mailbox, TRUE);
+                   first_mailbox = FALSE;
+               } else
+                   libbalsa_mailbox_set_exposed(mbnode->mailbox, FALSE);
+               if (mbnode->mailbox == current_mailbox) {
+                   GtkTreeSelection *selection =
+                       gtk_tree_view_get_selection(tree_view);
+                   gtk_tree_selection_select_iter(selection, &child_iter);
+               }
+           }
+           g_object_unref(mbnode);
         } while (gtk_tree_model_iter_next(model, &child_iter));
     }
 }
 
-
 /* "row-collapsed" */
 static void
-bmbl_tree_collapse_helper(GtkTreeModel *model,
-                          GtkTreeIter  *iter)
+bmbl_tree_collapse_helper(GtkTreeModel * model, GtkTreeIter * iter)
 {
     GtkTreeIter child_iter;
 
@@ -638,39 +588,33 @@ bmbl_tree_collapse_helper(GtkTreeModel *model,
 
             gtk_tree_model_get(model, &child_iter,
                                MBNODE_COLUMN, &mbnode, -1);
-            if (mbnode->mailbox) {
-                libbalsa_mailbox_set_exposed(mbnode->mailbox, FALSE);
-            }
-            g_object_unref(mbnode);
+            if (mbnode->mailbox)
+               libbalsa_mailbox_set_exposed(mbnode->mailbox, FALSE);
+           g_object_unref(mbnode);
             bmbl_tree_collapse_helper(model, &child_iter);
         } while (gtk_tree_model_iter_next(model, &child_iter));
     }
 }
 
-
 static void
-bmbl_tree_collapse(GtkTreeView *tree_view,
-                   GtkTreeIter *iter,
-                   GtkTreePath *path,
-                   gpointer     data)
+bmbl_tree_collapse(GtkTreeView * tree_view, GtkTreeIter * iter,
+                      GtkTreePath * path, gpointer data)
 {
     GtkTreeModel *model = gtk_tree_view_get_model(tree_view);
     BalsaMailboxNode *mbnode;
 
     gtk_tree_model_get(model, iter, MBNODE_COLUMN, &mbnode, -1);
 
-    if (!mbnode->mailbox) {
+    if (!mbnode->mailbox)
         gtk_tree_store_set(GTK_TREE_STORE(model), iter,
                            ICON_COLUMN,
                            balsa_icon_id(BALSA_PIXMAP_MBOX_DIR_CLOSED),
                            -1);
-    }
     g_object_unref(mbnode);
 
     bmbl_tree_collapse_helper(model, iter);
 }
 
-
 /* bmbl_row_compare
  *
  * This function determines the sorting order of the list, depending
@@ -680,10 +624,8 @@ bmbl_tree_collapse(GtkTreeView *tree_view,
  * messages, and the third by total number of messages.
  * */
 static gint
-bmbl_row_compare(GtkTreeModel *model,
-                 GtkTreeIter  *iter1,
-                 GtkTreeIter  *iter2,
-                 gpointer      data)
+bmbl_row_compare(GtkTreeModel * model, GtkTreeIter * iter1,
+                 GtkTreeIter * iter2, gpointer data)
 {
     BmblTreeColumnId sort_column = GPOINTER_TO_INT(data);
     BalsaMailboxNode *mbnode;
@@ -729,11 +671,10 @@ bmbl_row_compare(GtkTreeModel *model,
     return ret_val;
 }
 
-
 /* bmbl_gesture_pressed_cb:
    handle mouse button press events that occur on mailboxes
    (clicking on folders is passed to GtkTreeView and may trigger expand events
- */
+*/
 static void
 bmbl_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
                         gint                  n_press,
@@ -749,27 +690,24 @@ bmbl_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
     gesture = GTK_GESTURE(multi_press);
     event = gtk_gesture_get_last_event(gesture, gtk_gesture_get_last_updated_sequence(gesture));
     g_return_if_fail(event != NULL);
-    if (!gdk_event_triggers_context_menu(event)) {
+    if (!gdk_event_triggers_context_menu(event))
         return;
-    }
 
     tree_view = GTK_TREE_VIEW(gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture)));
 
     if (!gtk_tree_view_get_path_at_pos(tree_view, (gint) x, (gint) y,
-                                       &path, NULL, NULL, NULL)) {
+                                       &path, NULL, NULL, NULL))
         path = NULL;
-    }
     bmbl_do_popup(tree_view, path, event);
     /* bmbl_do_popup frees path */
 }
 
-
 /* bmbl_popup_menu:
  * default handler for the "popup-menu" signal, which is issued when the
  * user hits shift-F10
  */
 static gboolean
-bmbl_popup_menu(GtkWidget *widget)
+bmbl_popup_menu(GtkWidget * widget)
 {
     GtkTreeView *tree_view = GTK_TREE_VIEW(widget);
     GtkTreePath *path;
@@ -780,14 +718,12 @@ bmbl_popup_menu(GtkWidget *widget)
     return TRUE;
 }
 
-
 /* bmbl_do_popup:
  * do the popup, and free the path
  */
 static void
-bmbl_do_popup(GtkTreeView    *tree_view,
-              GtkTreePath    *path,
-              const GdkEvent *event)
+bmbl_do_popup(GtkTreeView * tree_view, GtkTreePath * path,
+              const GdkEvent * event)
 {
     BalsaMailboxNode *mbnode = NULL;
     GtkWidget *menu;
@@ -796,9 +732,8 @@ bmbl_do_popup(GtkTreeView    *tree_view,
         GtkTreeModel *model = gtk_tree_view_get_model(tree_view);
         GtkTreeIter iter;
 
-        if (gtk_tree_model_get_iter(model, &iter, path)) {
+        if (gtk_tree_model_get_iter(model, &iter, path))
             gtk_tree_model_get(model, &iter, MBNODE_COLUMN, &mbnode, -1);
-        }
         gtk_tree_path_free(path);
     }
 
@@ -806,21 +741,18 @@ bmbl_do_popup(GtkTreeView    *tree_view,
     menu = balsa_mailbox_node_get_context_menu(mbnode);
     g_object_ref(menu);
     g_object_ref_sink(menu);
-    if (event) {
+    if (event)
         gtk_menu_popup_at_pointer(GTK_MENU(menu), event);
-    } else {
+    else
         gtk_menu_popup_at_widget(GTK_MENU(menu), GTK_WIDGET(tree_view),
                                  GDK_GRAVITY_CENTER, GDK_GRAVITY_CENTER,
                                  NULL);
-    }
     g_object_unref(menu);
 
-    if (mbnode) {
-        g_object_unref(mbnode);
-    }
+    if (mbnode)
+       g_object_unref(mbnode);
 }
 
-
 /* bmbl_column_resize [MBG]
  *
  * clist: The clist (in this case ctree), that is having it's columns resized.
@@ -832,31 +764,28 @@ bmbl_do_popup(GtkTreeView    *tree_view,
  * so they can be saved and restored between sessions.
  * */
 static void
-bmbl_column_resize(GtkWidget     *widget,
-                   GtkAllocation *allocation,
-                   gint           baseline,
-                   GtkAllocation *clip,
-                   gpointer       data)
+bmbl_column_resize(GtkWidget * widget, GtkAllocation * allocation,
+                   gint baseline, GtkAllocation * clip,
+                   gpointer data)
 {
     GtkTreeView *tree_view = GTK_TREE_VIEW(widget);
     gint name_width =
         gtk_tree_view_column_get_width(gtk_tree_view_get_column
-                                           (tree_view, 0));
+                                       (tree_view, 0));
     gint newmsg_width =
         gtk_tree_view_column_get_width(gtk_tree_view_get_column
-                                           (tree_view, 1));
+                                       (tree_view, 1));
     gint totalmsg_width =
         gtk_tree_view_column_get_width(gtk_tree_view_get_column
-                                           (tree_view, 2));
+                                       (tree_view, 2));
 
-    if ((name_width > 0) && (newmsg_width > 0) && (totalmsg_width > 0)) {
+    if (name_width > 0 && newmsg_width > 0 && totalmsg_width > 0) {
         balsa_app.mblist_name_width = name_width;
         balsa_app.mblist_newmsg_width = newmsg_width;
         balsa_app.mblist_totalmsg_width = totalmsg_width;
     }
 }
 
-
 /* bmbl_drag_cb
  *
  * Description: This is the drag_data_recieved signal handler for the
@@ -867,13 +796,13 @@ bmbl_column_resize(GtkWidget     *widget,
  * to copy.
  * */
 static void
-bmbl_drag_cb(GtkWidget        *widget,
-             GdkDragContext   *context,
-             gint              x,
-             gint              y,
-             GtkSelectionData *selection_data,
-             guint32           time,
-             gpointer          data)
+bmbl_drag_cb(GtkWidget        * widget,
+             GdkDragContext   * context,
+             gint               x,
+             gint               y,
+             GtkSelectionData * selection_data,
+             guint32            time,
+             gpointer           data)
 {
     GtkTreeView *tree_view = GTK_TREE_VIEW(widget);
     GtkTreeModel *model = gtk_tree_view_get_model(tree_view);
@@ -885,17 +814,16 @@ bmbl_drag_cb(GtkWidget        *widget,
     BalsaIndex *orig_index;
     GArray *selected;
 
-    if ((selection_data == NULL) || (gtk_selection_data_get_data(selection_data) == NULL)) {
-        /* Drag'n'drop is weird... */
-        return;
-    }
+    if (selection_data == NULL || gtk_selection_data_get_data(selection_data) == NULL)
+       /* Drag'n'drop is weird... */
+       return;
 
     orig_index =
         *(BalsaIndex **) gtk_selection_data_get_data(selection_data);
     selected = balsa_index_selected_msgnos_new(orig_index);
     if (selected->len == 0) {
-        /* it is actually possible to drag from GtkTreeView when no rows
-         * are selected: Disable preview for that. */
+       /* it is actually possible to drag from GtkTreeView when no rows
+        * are selected: Disable preview for that. */
         balsa_index_selected_msgnos_free(orig_index, selected);
         return;
     }
@@ -910,29 +838,26 @@ bmbl_drag_cb(GtkWidget        *widget,
      * lower level. */
     if (gtk_tree_view_get_dest_row_at_pos(tree_view,
                                           x, y, &path, NULL)) {
-        BalsaMailboxNode *mbnode;
+       BalsaMailboxNode *mbnode;
 
         gtk_tree_model_get_iter(model, &iter, path);
         gtk_tree_model_get(model, &iter, MBNODE_COLUMN, &mbnode, -1);
         mailbox = mbnode->mailbox;
-        g_object_unref(mbnode);
+       g_object_unref(mbnode);
 
         /* cannot transfer to the originating mailbox */
-        if ((mailbox != NULL) && (mailbox != orig_mailbox)) {
+        if (mailbox != NULL && mailbox != orig_mailbox)
             balsa_index_transfer(orig_index, selected, mailbox,
                                  gdk_drag_context_get_selected_action
-                                     (context) != GDK_ACTION_MOVE);
-        }
+                                 (context) != GDK_ACTION_MOVE);
         gtk_tree_path_free(path);
     }
     balsa_index_selected_msgnos_free(orig_index, selected);
 
-    if (balsa_find_iter_by_data(&iter, orig_mailbox)) {
+    if (balsa_find_iter_by_data(&iter, orig_mailbox))
         gtk_tree_selection_select_iter(selection, &iter);
-    }
 }
 
-
 /*
  * bmbl_row_activated_cb: callback for the "row-activated" signal
  *
@@ -942,10 +867,8 @@ bmbl_drag_cb(GtkWidget        *widget,
  * by looking at gtk_current_event, but we don't want the extra code.
  */
 static void
-bmbl_row_activated_cb(GtkTreeView       *tree_view,
-                      GtkTreePath       *path,
-                      GtkTreeViewColumn *column,
-                      gpointer           data)
+bmbl_row_activated_cb(GtkTreeView * tree_view, GtkTreePath * path,
+                      GtkTreeViewColumn * column, gpointer data)
 {
     GtkTreeModel *model = gtk_tree_view_get_model(tree_view);
     GtkTreeIter iter;
@@ -955,13 +878,11 @@ bmbl_row_activated_cb(GtkTreeView       *tree_view,
     gtk_tree_model_get(model, &iter, MBNODE_COLUMN, &mbnode, -1);
     g_return_if_fail(mbnode != NULL);
 
-    if (mbnode->mailbox) {
+    if (mbnode->mailbox)
         balsa_mblist_open_mailbox(mbnode->mailbox);
-    }
     g_object_unref(mbnode);
 }
 
-
 /* Mailbox status changed callbacks: update the UI in an idle handler.
  */
 
@@ -969,8 +890,8 @@ struct update_mbox_data {
     LibBalsaMailbox *mailbox;
     gboolean notify;
 };
-static void bmbl_update_mailbox(GtkTreeStore    *store,
-                                LibBalsaMailbox *mailbox);
+static void bmbl_update_mailbox(GtkTreeStore * store,
+                                LibBalsaMailbox * mailbox);
 
 G_LOCK_DEFINE_STATIC(mblist_update);
 
@@ -993,20 +914,19 @@ update_mailbox_idle(struct update_mbox_data *umd)
                                      && subscribed);
 
             if (subscribed) {
-                if (libbalsa_mailbox_get_unread(umd->mailbox) > 0) {
+                if (libbalsa_mailbox_get_unread(umd->mailbox) > 0)
                     g_signal_emit(balsa_app.mblist,
                                   balsa_mblist_signals[HAS_UNREAD_MAILBOX],
                                   0, TRUE);
-                } else {
+                else {
                     GList *unread_mailboxes =
                         balsa_mblist_find_all_unread_mboxes(NULL);
-                    if (unread_mailboxes) {
+                    if (unread_mailboxes)
                         g_list_free(unread_mailboxes);
-                    } else {
+                    else
                         g_signal_emit(balsa_app.mblist,
                                       balsa_mblist_signals
                                       [HAS_UNREAD_MAILBOX], 0, FALSE);
-                    }
                 }
             }
         }
@@ -1018,10 +938,8 @@ update_mailbox_idle(struct update_mbox_data *umd)
     return FALSE;
 }
 
-
 static void
-bmbl_mailbox_changed_cb(LibBalsaMailbox *mailbox,
-                        gpointer         data)
+bmbl_mailbox_changed_cb(LibBalsaMailbox * mailbox, gpointer data)
 {
     struct update_mbox_data *umd;
 
@@ -1046,12 +964,11 @@ bmbl_mailbox_changed_cb(LibBalsaMailbox *mailbox,
     G_UNLOCK(mblist_update);
 }
 
-
 /* public methods */
 
 /* Caller must unref mbnode. */
 BalsaMailboxNode *
-balsa_mblist_get_selected_node(BalsaMBList *mbl)
+balsa_mblist_get_selected_node(BalsaMBList * mbl)
 {
     GtkTreeSelection *select =
         gtk_tree_view_get_selection(GTK_TREE_VIEW(mbl));
@@ -1059,14 +976,12 @@ balsa_mblist_get_selected_node(BalsaMBList *mbl)
     GtkTreeModel *model;
     GtkTreeIter iter;
 
-    if (gtk_tree_selection_get_selected(select, &model, &iter)) {
+    if (gtk_tree_selection_get_selected(select, &model, &iter))
         gtk_tree_model_get(model, &iter, MBNODE_COLUMN, &mbnode, -1);
-    }
 
     return mbnode;
 }
 
-
 /* mblist_find_all_unread_mboxes:
  * If mailbox == NULL, returns a list of all mailboxes with unread mail.
  * If mailbox != NULL, returns a similar list, but including a NULL
@@ -1079,49 +994,42 @@ struct bmbl_find_all_unread_mboxes_info {
 };
 
 static gboolean
-bmbl_find_all_unread_mboxes_func(GtkTreeModel *model,
-                                 GtkTreePath  *path,
-                                 GtkTreeIter  *iter,
-                                 gpointer      data)
+bmbl_find_all_unread_mboxes_func(GtkTreeModel * model, GtkTreePath * path,
+                                 GtkTreeIter * iter, gpointer data)
 {
     struct bmbl_find_all_unread_mboxes_info *info = data;
     BalsaMailboxNode *mbnode = NULL;
     LibBalsaMailbox *mailbox;
 
     gtk_tree_model_get(model, iter, MBNODE_COLUMN, &mbnode, -1);
-    if (!mbnode) { /* this node has no MBNODE associated at this time */
+    if(!mbnode) /* this node has no MBNODE associated at this time */
         return FALSE;
-    }
     mailbox = mbnode->mailbox;
     g_object_unref(mbnode);
 
     if (mailbox
         && (libbalsa_mailbox_get_subscribe(mailbox) !=
             LB_MAILBOX_SUBSCRIBE_NO)) {
-        if (mailbox == info->mailbox) {
+        if (mailbox == info->mailbox)
             info->list = g_list_prepend(info->list, NULL);
-        } else if (libbalsa_mailbox_get_unread(mailbox) > 0) {
+        else if (libbalsa_mailbox_get_unread(mailbox) > 0)
             info->list = g_list_prepend(info->list, mailbox);
-        }
     }
 
     return FALSE;
 }
 
-
 GList *
-balsa_mblist_find_all_unread_mboxes(LibBalsaMailbox *mailbox)
+balsa_mblist_find_all_unread_mboxes(LibBalsaMailbox * mailbox)
 {
     struct bmbl_find_all_unread_mboxes_info info;
 
     info.mailbox = mailbox;
     info.list = NULL;
 
-    if (!balsa_app.mblist_tree_store) {
-        /* We have no mailboxes, maybe
-           we are about to quit? */
-        return NULL;
-    }
+    if (!balsa_app.mblist_tree_store) /* We have no mailboxes, maybe
+                                        we are about to quit? */
+       return NULL;
 
     gtk_tree_model_foreach(GTK_TREE_MODEL(balsa_app.mblist_tree_store),
                            bmbl_find_all_unread_mboxes_func, &info);
@@ -1129,7 +1037,6 @@ balsa_mblist_find_all_unread_mboxes(LibBalsaMailbox *mailbox)
     return g_list_reverse(info.list);
 }
 
-
 /* mblist_open_mailbox
  *
  * Description: This checks to see if the mailbox is already on a different
@@ -1137,8 +1044,7 @@ balsa_mblist_find_all_unread_mboxes(LibBalsaMailbox *mailbox)
  * parsed.
  */
 static void
-bmbl_open_mailbox(LibBalsaMailbox *mailbox,
-                  gboolean         set_current)
+bmbl_open_mailbox(LibBalsaMailbox * mailbox, gboolean set_current)
 {
     int i;
     GtkWidget *index;
@@ -1154,7 +1060,7 @@ bmbl_open_mailbox(LibBalsaMailbox *mailbox,
 
     /* If we currently have a page open, update the time last visited */
     if (index) {
-        time(&BALSA_INDEX(index)->mailbox_node->last_use);
+       time(&BALSA_INDEX(index)->mailbox_node->last_use);
     }
 
     i = balsa_find_notebook_page_num(mailbox);
@@ -1170,36 +1076,32 @@ bmbl_open_mailbox(LibBalsaMailbox *mailbox,
         balsa_window_open_mbnode(balsa_app.main_window, mbnode,
                                  set_current);
 
-        if (balsa_app.mblist->display_info) {
-            balsa_mblist_update_mailbox(balsa_app.mblist_tree_store,
+       if (balsa_app.mblist->display_info)
+           balsa_mblist_update_mailbox(balsa_app.mblist_tree_store,
                                         mailbox);
-        }
     }
     g_object_unref(mbnode);
 }
 
-
 void
-balsa_mblist_open_mailbox(LibBalsaMailbox *mailbox)
+balsa_mblist_open_mailbox(LibBalsaMailbox * mailbox)
 {
     bmbl_open_mailbox(mailbox, TRUE);
 }
 
-
 void
-balsa_mblist_open_mailbox_hidden(LibBalsaMailbox *mailbox)
+balsa_mblist_open_mailbox_hidden(LibBalsaMailbox * mailbox)
 {
     bmbl_open_mailbox(mailbox, FALSE);
 }
 
-
 void
-balsa_mblist_close_mailbox(LibBalsaMailbox *mailbox)
+balsa_mblist_close_mailbox(LibBalsaMailbox * mailbox)
 {
     BalsaMailboxNode *mbnode;
 
     mbnode = balsa_find_mailbox(mailbox);
-    if (!mbnode) {
+    if (!mbnode)  {
         g_warning(_("Failed to find mailbox"));
         return;
     }
@@ -1208,76 +1110,68 @@ balsa_mblist_close_mailbox(LibBalsaMailbox *mailbox)
     g_object_unref(mbnode);
 }
 
-
 /* balsa_mblist_close_lru_peer_mbx closes least recently used mailbox
  * on the same server as the one given as the argument: some IMAP
  * servers limit the number of simultaneously open connections. */
 struct lru_data {
-    GtkTreePath *ancestor_path;
+    GtkTreePath     *ancestor_path;
     BalsaMailboxNode *mbnode;
 };
 
 static gboolean
-get_lru_descendant(GtkTreeModel *model,
-                   GtkTreePath  *path,
-                   GtkTreeIter  *iter,
-                   gpointer      data)
+get_lru_descendant(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
+                   gpointer data)
 {
-    struct lru_data *dt = (struct lru_data *)data;
+    struct lru_data *dt  = (struct lru_data*)data;
     BalsaMailboxNode *mbnode;
 
-    if (!gtk_tree_path_is_descendant(path, dt->ancestor_path)) {
+    if(!gtk_tree_path_is_descendant(path, dt->ancestor_path))
         return FALSE;
-    }
     gtk_tree_model_get(model, iter, MBNODE_COLUMN, &mbnode, -1);
-    if (mbnode->mailbox && libbalsa_mailbox_is_open(mbnode->mailbox) &&
-        (!dt->mbnode || (mbnode->last_use < dt->mbnode->last_use))) {
-        if (dt->mbnode) {
+    if(mbnode->mailbox && libbalsa_mailbox_is_open(mbnode->mailbox) &&
+       (!dt->mbnode || (mbnode->last_use < dt->mbnode->last_use)) )
+    {
+        if (dt->mbnode)
             g_object_unref(dt->mbnode);
-        }
         dt->mbnode = mbnode;
-    } else {
-        g_object_unref(mbnode);
     }
+
+    else g_object_unref(mbnode);
     return FALSE;
 }
 
-
 gboolean
-balsa_mblist_close_lru_peer_mbx(BalsaMBList     *mblist,
+balsa_mblist_close_lru_peer_mbx(BalsaMBList * mblist,
                                 LibBalsaMailbox *mailbox)
 {
     GtkTreeModel *model;
-    GtkTreeIter iter;
+    GtkTreeIter   iter;
     struct lru_data dt;
     g_return_val_if_fail(mailbox, FALSE);
 
     model = gtk_tree_view_get_model(GTK_TREE_VIEW(mblist));
 
-    if (!balsa_find_iter_by_data(&iter, mailbox)) {
+    if(!balsa_find_iter_by_data(&iter, mailbox))
         return FALSE;
-    }
     dt.ancestor_path = gtk_tree_model_get_path(model, &iter);
-    while (gtk_tree_path_get_depth(dt.ancestor_path) > 1) {
+    while(gtk_tree_path_get_depth(dt.ancestor_path)>1)
         gtk_tree_path_up(dt.ancestor_path);
-    }
 
     dt.mbnode = NULL;
     gtk_tree_model_foreach(model, get_lru_descendant, &dt);
-    if (dt.mbnode) {
+    if(dt.mbnode) {
         balsa_window_close_mbnode(balsa_app.main_window, dt.mbnode);
         g_object_unref(dt.mbnode);
     }
     return dt.mbnode != NULL;
 }
 
-
 /* balsa_mblist_default_signal_bindings:
    connect signals useful for the left-hand side mailbox tree
    but useless for the transfer menu.
- */
+*/
 void
-balsa_mblist_default_signal_bindings(BalsaMBList *mblist)
+balsa_mblist_default_signal_bindings(BalsaMBList * mblist)
 {
     GtkGesture *gesture;
     GdkContentFormats *formats;
@@ -1306,32 +1200,28 @@ balsa_mblist_default_signal_bindings(BalsaMBList *mblist)
                      G_CALLBACK(bmbl_row_activated_cb), NULL);
 }
 
-
 /* bmbl_disconnect_mailbox_signals
  *
  * Remove the signals we attached to the mailboxes.
  */
 static void
-bmbl_real_disconnect_mbnode_signals(BalsaMailboxNode *mbnode,
-                                    GtkTreeModel     *model)
+bmbl_real_disconnect_mbnode_signals(BalsaMailboxNode * mbnode,
+                                   GtkTreeModel * model)
 {
-    if (mbnode->mailbox) {
+    if (mbnode->mailbox)
         g_signal_handlers_disconnect_by_func(mbnode->mailbox,
                                              G_CALLBACK
-                                                 (bmbl_mailbox_changed_cb),
+                                             (bmbl_mailbox_changed_cb),
                                              NULL);
-    }
 }
 
-
 /* bmbl_store_redraw_mbnode
  *
  * adds BalsaMailboxNodes to the mailbox list, choosing proper icon for them.
  * returns FALSE on failure (wrong parameters passed).
  * */
 static gboolean
-bmbl_store_redraw_mbnode(GtkTreeIter      *iter,
-                         BalsaMailboxNode *mbnode)
+bmbl_store_redraw_mbnode(GtkTreeIter * iter, BalsaMailboxNode * mbnode)
 {
     const gchar *icon;
     const gchar *name;
@@ -1342,104 +1232,98 @@ bmbl_store_redraw_mbnode(GtkTreeIter      *iter,
 
     if (mbnode->mailbox) {
         LibBalsaMailbox *mailbox = mbnode->mailbox;
-        static guint mailbox_changed_signal = 0;
+       static guint mailbox_changed_signal = 0;
 
-        if (LIBBALSA_IS_MAILBOX_POP3(mailbox)) {
-            g_assert_not_reached();
+       if (LIBBALSA_IS_MAILBOX_POP3(mailbox)) {
+           g_assert_not_reached();
             icon = NULL;
             name = NULL;
         } else {
-            if (mailbox == balsa_app.draftbox) {
-                icon = BALSA_PIXMAP_MBOX_DRAFT;
-            } else if (mailbox == balsa_app.inbox) {
-                icon = BALSA_PIXMAP_MBOX_IN;
-            } else if (mailbox == balsa_app.outbox) {
-                icon = BALSA_PIXMAP_MBOX_OUT;
-            } else if (mailbox == balsa_app.sentbox) {
-                icon = BALSA_PIXMAP_MBOX_SENT;
-            } else if (mailbox == balsa_app.trash) {
-                icon = BALSA_PIXMAP_MBOX_TRASH;
-            } else {
-                icon = (libbalsa_mailbox_total_messages(mailbox) > 0)
-                    ? BALSA_PIXMAP_MBOX_TRAY_FULL
-                    : BALSA_PIXMAP_MBOX_TRAY_EMPTY;
-            }
+           if(mailbox == balsa_app.draftbox)
+               icon = BALSA_PIXMAP_MBOX_DRAFT;
+           else if(mailbox == balsa_app.inbox)
+               icon = BALSA_PIXMAP_MBOX_IN;
+           else if(mailbox == balsa_app.outbox)
+               icon = BALSA_PIXMAP_MBOX_OUT;
+           else if(mailbox == balsa_app.sentbox)
+               icon = BALSA_PIXMAP_MBOX_SENT;
+           else if(mailbox == balsa_app.trash)
+               icon = BALSA_PIXMAP_MBOX_TRASH;
+           else
+               icon = (libbalsa_mailbox_total_messages(mailbox) > 0)
+               ? BALSA_PIXMAP_MBOX_TRAY_FULL
+                : BALSA_PIXMAP_MBOX_TRAY_EMPTY;
 
             name = mailbox->name;
 
             /* Make sure the show column is set before showing the
              * mailbox in the list. */
-            if (libbalsa_mailbox_get_show(mailbox) == LB_MAILBOX_SHOW_UNSET) {
-                libbalsa_mailbox_set_show(mailbox,
-                                          (mailbox == balsa_app.sentbox
-                                           || mailbox == balsa_app.draftbox
-                                           || mailbox == balsa_app.outbox) ?
+           if (libbalsa_mailbox_get_show(mailbox) == LB_MAILBOX_SHOW_UNSET)
+               libbalsa_mailbox_set_show(mailbox,
+                                         (mailbox == balsa_app.sentbox
+                                          || mailbox == balsa_app.draftbox
+                                          || mailbox == balsa_app.outbox) ?
                                           LB_MAILBOX_SHOW_TO :
                                           LB_MAILBOX_SHOW_FROM);
-            }
             /* ...and whether to jump to new mail in this mailbox. */
             if (libbalsa_mailbox_get_subscribe(mailbox) ==
-                LB_MAILBOX_SUBSCRIBE_UNSET) {
+                LB_MAILBOX_SUBSCRIBE_UNSET)
                 libbalsa_mailbox_set_subscribe(mailbox,
                                                mailbox ==
                                                balsa_app.trash ?
                                                LB_MAILBOX_SUBSCRIBE_NO :
                                                LB_MAILBOX_SUBSCRIBE_YES);
-            }
-        }
+       }
 
-        if (!mailbox_changed_signal) {
-            mailbox_changed_signal =
-                g_signal_lookup("changed", LIBBALSA_TYPE_MAILBOX);
-        }
-        if (!g_signal_has_handler_pending(G_OBJECT(mbnode->mailbox),
+       if (!mailbox_changed_signal)
+           mailbox_changed_signal =
+               g_signal_lookup("changed", LIBBALSA_TYPE_MAILBOX);
+       if (!g_signal_has_handler_pending(G_OBJECT(mbnode->mailbox),
                                           mailbox_changed_signal, 0, TRUE)) {
-            /* Now we have a mailbox: */
-            g_signal_connect(mbnode->mailbox, "changed",
-                             G_CALLBACK(bmbl_mailbox_changed_cb),
-                             NULL);
-            if ((libbalsa_mailbox_get_unread(mailbox) > 0)
+           /* Now we have a mailbox: */
+           g_signal_connect(mbnode->mailbox, "changed",
+                            G_CALLBACK(bmbl_mailbox_changed_cb),
+                            NULL);
+            if (libbalsa_mailbox_get_unread(mailbox) > 0
                 && (libbalsa_mailbox_get_subscribe(mailbox) !=
-                    LB_MAILBOX_SUBSCRIBE_NO)) {
+                    LB_MAILBOX_SUBSCRIBE_NO))
                 g_signal_emit(balsa_app.mblist,
                               balsa_mblist_signals[HAS_UNREAD_MAILBOX],
                               0, TRUE);
-            }
-            /* If necessary, expand rows to expose this mailbox after
-             * setting its mbnode in the tree-store. */
-            expose = libbalsa_mailbox_get_exposed(mbnode->mailbox);
-        }
+           /* If necessary, expand rows to expose this mailbox after
+            * setting its mbnode in the tree-store. */
+           expose = libbalsa_mailbox_get_exposed(mbnode->mailbox);
+       }
     } else {
-        /* new directory, but not a mailbox */
-        icon = BALSA_PIXMAP_MBOX_DIR_CLOSED;
+       /* new directory, but not a mailbox */
+       icon = BALSA_PIXMAP_MBOX_DIR_CLOSED;
         name = tmp = g_path_get_basename(mbnode->name);
     }
 
     gtk_tree_store_set(balsa_app.mblist_tree_store, iter,
                        MBNODE_COLUMN, mbnode,
                        ICON_COLUMN, balsa_icon_id(icon),
-                       NAME_COLUMN, name,
+                       NAME_COLUMN,   name,
                        WEIGHT_COLUMN, PANGO_WEIGHT_NORMAL,
                        STYLE_COLUMN, PANGO_STYLE_NORMAL,
                        UNREAD_COLUMN, "",
-                       TOTAL_COLUMN, "",
+                       TOTAL_COLUMN,  "",
                        -1);
     g_free(tmp);
 
     if (mbnode->mailbox) {
-        GtkTreeModel *model = GTK_TREE_MODEL(balsa_app.mblist_tree_store);
-        if (expose) {
-            GtkTreePath *path = gtk_tree_model_get_path(model, iter);
-            bmbl_expand_to_row(balsa_app.mblist, path);
-            gtk_tree_path_free(path);
-        }
-        bmbl_node_style(model, iter);
+       GtkTreeModel *model = GTK_TREE_MODEL(balsa_app.mblist_tree_store);
+       if (expose) {
+           GtkTreePath *path = gtk_tree_model_get_path(model, iter);
+           bmbl_expand_to_row(balsa_app.mblist, path);
+           gtk_tree_path_free(path);
+       }
+       bmbl_node_style(model, iter);
     }
 
     return TRUE;
 }
 
-
 /* balsa_mblist_update_mailbox [MBG]
  *
  * mblist: the mailbox list that contains the mailbox
@@ -1452,37 +1336,32 @@ bmbl_store_redraw_mbnode(GtkTreeIter      *iter,
  * was closed).
  * */
 static void
-bmbl_update_mailbox(GtkTreeStore    *store,
-                    LibBalsaMailbox *mailbox)
+bmbl_update_mailbox(GtkTreeStore * store, LibBalsaMailbox * mailbox)
 {
     GtkTreeModel *model = GTK_TREE_MODEL(store);
     GtkTreeIter iter;
     GtkWidget *bindex;
 
     /* try and find the mailbox */
-    if (!balsa_find_iter_by_data(&iter, mailbox)) {
+    if (!balsa_find_iter_by_data(&iter, mailbox))
         return;
-    }
 
     bmbl_node_style(model, &iter);
 
     bindex = balsa_window_find_current_index(balsa_app.main_window);
-    if (!bindex || (mailbox != BALSA_INDEX(bindex)->mailbox_node->mailbox)) {
+    if (!bindex || mailbox != BALSA_INDEX(bindex)->mailbox_node->mailbox)
         return;
-    }
 
     balsa_window_set_statusbar(balsa_app.main_window, mailbox);
 }
 
-
 void
-balsa_mblist_update_mailbox(GtkTreeStore    *store,
-                            LibBalsaMailbox *mailbox)
+balsa_mblist_update_mailbox(GtkTreeStore * store,
+                           LibBalsaMailbox * mailbox)
 {
     bmbl_update_mailbox(store, mailbox);
 }
 
-
 /* bmbl_node_style [MBG]
  *
  * model:  The model containing the mailbox
@@ -1494,10 +1373,9 @@ balsa_mblist_update_mailbox(GtkTreeStore    *store,
  * NOTES: ignore special mailboxes.
  * */
 static void
-bmbl_node_style(GtkTreeModel *model,
-                GtkTreeIter  *iter)
+bmbl_node_style(GtkTreeModel * model, GtkTreeIter * iter)
 {
-    BalsaMailboxNode *mbnode;
+    BalsaMailboxNode * mbnode;
     LibBalsaMailbox *mailbox;
     gint unread_messages;
     gint total_messages;
@@ -1507,17 +1385,16 @@ bmbl_node_style(GtkTreeModel *model,
     gchar *text_total = NULL;
 
     gtk_tree_model_get(model, iter, MBNODE_COLUMN, &mbnode, -1);
-    if (!mbnode || !mbnode->mailbox) {
+    if (!mbnode || !mbnode->mailbox)
         return;
-    }
 
     mailbox = mbnode->mailbox;
     unread_messages = libbalsa_mailbox_get_unread(mailbox);
     total_messages = libbalsa_mailbox_get_total(mailbox);
 
     /* SHOW UNREAD for special mailboxes? */
-    if (!((mailbox == balsa_app.sentbox) || (mailbox == balsa_app.outbox) ||
-          (mailbox == balsa_app.draftbox) || (mailbox == balsa_app.trash))) {
+    if (!(mailbox == balsa_app.sentbox || mailbox == balsa_app.outbox ||
+          mailbox == balsa_app.draftbox || mailbox == balsa_app.trash)) {
         const gchar *icon;
         const gchar *name;
         gchar *tmp = NULL;
@@ -1532,11 +1409,11 @@ bmbl_node_style(GtkTreeModel *model,
             icon = BALSA_PIXMAP_MBOX_TRAY_FULL;
 
             display_info = GPOINTER_TO_INT(g_object_get_data
-                                               (G_OBJECT(model),
-                                               BALSA_MBLIST_DISPLAY_INFO));
+                                           (G_OBJECT(model),
+                                            BALSA_MBLIST_DISPLAY_INFO));
             name = (!display_info && total_messages >= 0) ?
                 (tmp = g_strdup_printf("%s (%d)", mailbox->name,
-                                       unread_messages))
+                                      unread_messages))
                 : mailbox->name;
 
             weight = PANGO_WEIGHT_BOLD;
@@ -1562,11 +1439,10 @@ bmbl_node_style(GtkTreeModel *model,
     if (total_messages >= 0) {
         /* Both counts are valid. */
         text_unread = g_strdup_printf("%d", unread_messages);
-        text_total = g_strdup_printf("%d", total_messages);
-    } else if (unread_messages == 0) {
+        text_total  = g_strdup_printf("%d", total_messages);
+    } else if (unread_messages == 0)
         /* Total is unknown, and unread is unknown unless it's 0. */
         text_unread = g_strdup("0");
-    }
     gtk_tree_store_set(GTK_TREE_STORE(model), iter,
                        UNREAD_COLUMN, text_unread,
                        TOTAL_COLUMN, text_total,
@@ -1577,37 +1453,35 @@ bmbl_node_style(GtkTreeModel *model,
     /* Do the folder styles as well */
     has_unread_child = libbalsa_mailbox_get_unread(mailbox) > 0;
     while (gtk_tree_model_iter_parent(model, &parent, iter)) {
-        *iter = parent;
-        gtk_tree_model_get(model, &parent, MBNODE_COLUMN, &mbnode, -1);
-        if (!has_unread_child) {
-            /* Check all the children of this parent. */
-            GtkTreeIter child;
-            /* We know it has at least one child. */
-            gtk_tree_model_iter_children(model, &child, &parent);
-            do {
-                BalsaMailboxNode *mn;
-                gtk_tree_model_get(model, &child, MBNODE_COLUMN, &mn, -1);
-                if (mn->style & (MBNODE_STYLE_NEW_MAIL |
-                                 MBNODE_STYLE_UNREAD_CHILD)) {
-                    has_unread_child = TRUE;
-                }
-                g_object_unref(mn);
-            } while (!has_unread_child && gtk_tree_model_iter_next(model, &child));
-        }
-        if (has_unread_child) {
-            mbnode->style |= MBNODE_STYLE_UNREAD_CHILD;
-            gtk_tree_store_set(GTK_TREE_STORE(model), &parent,
-                               STYLE_COLUMN, PANGO_STYLE_OBLIQUE, -1);
-        } else {
-            mbnode->style &= ~MBNODE_STYLE_UNREAD_CHILD;
-            gtk_tree_store_set(GTK_TREE_STORE(model), &parent,
-                               STYLE_COLUMN, PANGO_STYLE_NORMAL, -1);
-        }
-        g_object_unref(mbnode);
+       *iter = parent;
+       gtk_tree_model_get(model, &parent, MBNODE_COLUMN, &mbnode, -1);
+       if (!has_unread_child) {
+           /* Check all the children of this parent. */
+           GtkTreeIter child;
+           /* We know it has at least one child. */
+           gtk_tree_model_iter_children(model, &child, &parent);
+           do {
+               BalsaMailboxNode *mn;
+               gtk_tree_model_get(model, &child, MBNODE_COLUMN, &mn, -1);
+               if (mn->style & (MBNODE_STYLE_NEW_MAIL |
+                                MBNODE_STYLE_UNREAD_CHILD))
+                   has_unread_child = TRUE;
+               g_object_unref(mn);
+           } while (!has_unread_child && gtk_tree_model_iter_next(model, &child));
+       }
+       if (has_unread_child) {
+           mbnode->style |= MBNODE_STYLE_UNREAD_CHILD;
+           gtk_tree_store_set(GTK_TREE_STORE(model), &parent,
+                              STYLE_COLUMN, PANGO_STYLE_OBLIQUE, -1);
+       } else {
+           mbnode->style &= ~MBNODE_STYLE_UNREAD_CHILD;
+           gtk_tree_store_set(GTK_TREE_STORE(model), &parent,
+                              STYLE_COLUMN, PANGO_STYLE_NORMAL, -1);
+       }
+       g_object_unref(mbnode);
     }
 }
 
-
 /* bmbl_core_mailbox
  *
  * Simple function, if the mailbox is one of the five "core" mailboxes
@@ -1616,10 +1490,10 @@ bmbl_node_style(GtkTreeModel *model,
  * not a core mailbox it returns zero.
  * */
 static gint
-bmbl_core_mailbox(LibBalsaMailbox *mailbox)
+bmbl_core_mailbox(LibBalsaMailbox* mailbox)
 {
     static const int num_core_mailboxes = 5;
-    LibBalsaMailbox *core_mailbox[] = {
+    LibBalsaMailbox* core_mailbox[] = {
         balsa_app.inbox,
         balsa_app.sentbox,
         balsa_app.draftbox,
@@ -1639,10 +1513,8 @@ bmbl_core_mailbox(LibBalsaMailbox *mailbox)
     return 0;
 }
 
-
 gboolean
-balsa_mblist_focus_mailbox(BalsaMBList     *mblist,
-                           LibBalsaMailbox *mailbox)
+balsa_mblist_focus_mailbox(BalsaMBList * mblist, LibBalsaMailbox * mailbox)
 {
     GtkTreeModel *model;
     GtkTreeIter iter;
@@ -1676,23 +1548,22 @@ balsa_mblist_focus_mailbox(BalsaMBList     *mblist,
     }
 }
 
-
 /* mblist_remove_mailbox_node:
    remove give mailbox node from the mailbox tree.
    Return TRUE (or equivalent) on success, FALSE on failure.
- */
+*/
 
 gboolean
-balsa_mblist_mailbox_node_remove(BalsaMailboxNode *mbnode)
+balsa_mblist_mailbox_node_remove(BalsaMailboxNode* mbnode)
 {
     GtkTreeIter iter;
 
     g_return_val_if_fail(mbnode, FALSE);
 
     if (balsa_find_iter_by_data(&iter, mbnode)) {
-        bmbl_real_disconnect_mbnode_signals(mbnode,
-                                            GTK_TREE_MODEL
-                                                (balsa_app.mblist_tree_store));
+       bmbl_real_disconnect_mbnode_signals(mbnode,
+                                           GTK_TREE_MODEL
+                                           (balsa_app.mblist_tree_store));
         gtk_tree_store_remove(balsa_app.mblist_tree_store, &iter);
 
         return TRUE;
@@ -1701,7 +1572,6 @@ balsa_mblist_mailbox_node_remove(BalsaMailboxNode *mbnode)
     return FALSE;
 }
 
-
 /* balsa_mblist_mru_menu:
  * a menu showing a list of recently used mailboxes, with an option for
  * selecting one from the whole mailbox tree
@@ -1720,32 +1590,26 @@ typedef struct _BalsaMBListMRUEntry BalsaMBListMRUEntry;
 
 /* The callback that's passed in must fit this prototype, although it's
  * cast as a GCallback */
-typedef void (*MRUCallback) (gchar   *url,
-                             gpointer user_data);
+typedef void (*MRUCallback) (gchar * url, gpointer user_data);
 /* Callback used internally for letting the option menu know that the
  * option menu needs to be set up */
 typedef void (*MRUSetup) (gpointer user_data);
 
 /* Forward references */
-static GtkWidget *bmbl_mru_menu(GtkWindow *window,
-                                GList    **url_list,
-                                GCallback  user_func,
-                                gpointer   user_data,
-                                gboolean   allow_empty,
-                                GCallback  setup_cb);
-static BalsaMBListMRUEntry *bmbl_mru_new(GList   **url_list,
+static GtkWidget *bmbl_mru_menu(GtkWindow * window, GList ** url_list,
+                                GCallback user_func, gpointer user_data,
+                                gboolean allow_empty, GCallback setup_cb);
+static BalsaMBListMRUEntry *bmbl_mru_new(GList ** url_list,
                                          GCallback user_func,
-                                         gpointer  user_data,
-                                         gchar    *url);
-static void bmbl_mru_free(BalsaMBListMRUEntry *mru);
-static void bmbl_mru_activate_cb(GtkWidget *widget,
-                                 gpointer   data);
-static void bmbl_mru_show_tree(GtkWidget *widget,
-                               gpointer   data);
-static void bmbl_mru_activated_cb(GtkTreeView       *tree_view,
-                                  GtkTreePath       *path,
-                                  GtkTreeViewColumn *column,
-                                  gpointer           data);
+                                         gpointer user_data,
+                                         gchar * url);
+static void bmbl_mru_free(BalsaMBListMRUEntry * mru);
+static void bmbl_mru_activate_cb(GtkWidget * widget, gpointer data);
+static void bmbl_mru_show_tree(GtkWidget * widget, gpointer data);
+static void bmbl_mru_activated_cb(GtkTreeView * tree_view,
+                                  GtkTreePath * path,
+                                  GtkTreeViewColumn * column,
+                                  gpointer data);
 
 /*
  * balsa_mblist_mru_menu:
@@ -1765,17 +1629,14 @@ static void bmbl_mru_activated_cb(GtkTreeView       *tree_view,
  * arguments, and the url_list is updated.
  */
 GtkWidget *
-balsa_mblist_mru_menu(GtkWindow *window,
-                      GList    **url_list,
-                      GCallback  user_func,
-                      gpointer   user_data)
+balsa_mblist_mru_menu(GtkWindow * window, GList ** url_list,
+                      GCallback user_func, gpointer user_data)
 {
     g_return_val_if_fail(url_list != NULL, NULL);
     return bmbl_mru_menu(window, url_list, user_func, user_data, FALSE,
                          NULL);
 }
 
-
 /*
  * bmbl_mru_menu:
  *
@@ -1789,12 +1650,9 @@ balsa_mblist_mru_menu(GtkWindow *window,
  * Returns the GtkMenu.
  */
 static GtkWidget *
-bmbl_mru_menu(GtkWindow *window,
-              GList    **url_list,
-              GCallback  user_func,
-              gpointer   user_data,
-              gboolean   allow_empty,
-              GCallback  setup_cb)
+bmbl_mru_menu(GtkWindow * window, GList ** url_list,
+              GCallback user_func, gpointer user_data,
+              gboolean allow_empty, GCallback setup_cb)
 {
     GtkWidget *menu = gtk_menu_new();
     GtkWidget *item;
@@ -1832,7 +1690,6 @@ bmbl_mru_menu(GtkWindow *window,
     return menu;
 }
 
-
 /*
  * bmbl_mru_new:
  *
@@ -1844,10 +1701,8 @@ bmbl_mru_menu(GtkWindow *window,
  * with the data.
  */
 static BalsaMBListMRUEntry *
-bmbl_mru_new(GList   **url_list,
-             GCallback user_func,
-             gpointer  user_data,
-             gchar    *url)
+bmbl_mru_new(GList ** url_list, GCallback user_func, gpointer user_data,
+             gchar * url)
 {
     BalsaMBListMRUEntry *mru = g_new(BalsaMBListMRUEntry, 1);
 
@@ -1859,33 +1714,28 @@ bmbl_mru_new(GList   **url_list,
     return mru;
 }
 
-
 static void
-bmbl_mru_free(BalsaMBListMRUEntry *mru)
+bmbl_mru_free(BalsaMBListMRUEntry * mru)
 {
     g_free(mru->url);
     g_free(mru);
 }
 
-
 /*
  * bmbl_mru_activate_cb:
  *
  * Callback for the "activate" signal of a menu item.
  */
 static void
-bmbl_mru_activate_cb(GtkWidget *item,
-                     gpointer   data)
+bmbl_mru_activate_cb(GtkWidget * item, gpointer data)
 {
     BalsaMBListMRUEntry *mru = (BalsaMBListMRUEntry *) data;
 
     balsa_mblist_mru_add(mru->url_list, mru->url);
-    if (mru->user_func) {
-        ((MRUCallback) mru->user_func)(mru->url, mru->user_data);
-    }
+    if (mru->user_func)
+        ((MRUCallback) mru->user_func) (mru->url, mru->user_data);
 }
 
-
 /*
  * bmbl_mru_show_tree:
  *
@@ -1900,36 +1750,30 @@ bmbl_mru_activate_cb(GtkWidget *item,
  * Remember the width and height.
  */
 static void
-bmbl_mru_size_allocate_cb(GtkWidget     *widget,
-                          GdkRectangle  *allocation,
-                          gint           baseline,
-                          GtkAllocation *clip,
-                          gpointer       user_data)
+bmbl_mru_size_allocate_cb(GtkWidget * widget, GdkRectangle * allocation,
+                          gint baseline, GtkAllocation * clip,
+                          gpointer user_data)
 {
     GdkWindow *gdk_window;
     gboolean maximized;
 
     gdk_window = gtk_widget_get_window(widget);
-    if (gdk_window == NULL) {
+    if (gdk_window == NULL)
         return;
-    }
 
     /* Maximizing a GtkDialog may not be possible, but we check anyway. */
     maximized =
         (gdk_window_get_state(gdk_window) &
          (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN)) != 0;
 
-    if (!maximized) {
+    if (!maximized)
         gtk_window_get_size(GTK_WINDOW(widget),
-                            &balsa_app.mru_tree_width,
-                            &balsa_app.mru_tree_height);
-    }
+                            & balsa_app.mru_tree_width,
+                            & balsa_app.mru_tree_height);
 }
 
-
 static void
-bmbl_mru_show_tree(GtkWidget *widget,
-                   gpointer   data)
+bmbl_mru_show_tree(GtkWidget * widget, gpointer data)
 {
     BalsaMBListMRUEntry *mru = data;
     GtkWidget *dialog;
@@ -1967,12 +1811,10 @@ bmbl_mru_show_tree(GtkWidget *widget,
 
     gtk_dialog_run(GTK_DIALOG(dialog));
     gtk_widget_destroy(dialog);
-    if (mru->setup_cb) {
-        ((MRUSetup) mru->setup_cb)(mru->user_data);
-    }
+    if (mru->setup_cb)
+        ((MRUSetup) mru->setup_cb) (mru->user_data);
 }
 
-
 /*
  * bmbl_mru_activated_cb:
  *
@@ -1980,10 +1822,8 @@ bmbl_mru_show_tree(GtkWidget *widget,
  * BalsaMBList object. This permits keyboard selection of a mailbox.
  */
 static void
-bmbl_mru_activated_cb(GtkTreeView       *tree_view,
-                      GtkTreePath       *path,
-                      GtkTreeViewColumn *column,
-                      gpointer           data)
+bmbl_mru_activated_cb(GtkTreeView * tree_view, GtkTreePath * path,
+                      GtkTreeViewColumn * column, gpointer data)
 {
     GtkTreeModel *model = gtk_tree_view_get_model(tree_view);
     GtkTreeIter iter;
@@ -1999,22 +1839,20 @@ bmbl_mru_activated_cb(GtkTreeView       *tree_view,
         bmbl_mru_activate_cb(NULL, data);
 
         gtk_dialog_response(GTK_DIALOG
-                                (gtk_widget_get_ancestor
-                                    (GTK_WIDGET(tree_view), GTK_TYPE_DIALOG)),
+                            (gtk_widget_get_ancestor
+                             (GTK_WIDGET(tree_view), GTK_TYPE_DIALOG)),
                             GTK_RESPONSE_OK);
     }
     g_object_unref(mbnode);
 }
 
-
 /* balsa_mblist_mru_add/drop:
    Add given folder's url to mailbox-recently-used list.
    Drop it first, so that if it's already there, it moves to the top.
- */
+*/
 #define FOLDER_MRU_LENGTH 10
 void
-balsa_mblist_mru_add(GList      **list,
-                     const gchar *url)
+balsa_mblist_mru_add(GList ** list, const gchar * url)
 {
     balsa_mblist_mru_drop(list, url);
     while (g_list_length(*list) >= FOLDER_MRU_LENGTH) {
@@ -2031,10 +1869,8 @@ balsa_mblist_mru_add(GList      **list,
     }
 }
 
-
 void
-balsa_mblist_mru_drop(GList      **list,
-                      const gchar *url)
+balsa_mblist_mru_drop(GList ** list, const gchar * url)
 {
     GList *tmp;
 
@@ -2047,7 +1883,6 @@ balsa_mblist_mru_drop(GList      **list,
     }
 }
 
-
 /* balsa_mblist_mru_option_menu: create a GtkComboBox to manage an MRU
  * list */
 
@@ -2060,11 +1895,10 @@ struct _BalsaMBListMRUOption {
 typedef struct _BalsaMBListMRUOption BalsaMBListMRUOption;
 
 /* Helper. */
-static void bmbl_mru_combo_box_changed(GtkComboBox          *combo_box,
-                                       BalsaMBListMRUOption *mro);
-
+static void bmbl_mru_combo_box_changed(GtkComboBox * combo_box,
+                                       BalsaMBListMRUOption * mro);
 static void
-bmbl_mru_combo_box_setup(GtkComboBox *combo_box)
+bmbl_mru_combo_box_setup(GtkComboBox * combo_box)
 {
     BalsaMBListMRUOption *mro =
         g_object_get_data(G_OBJECT(combo_box), "mro");
@@ -2079,8 +1913,8 @@ bmbl_mru_combo_box_setup(GtkComboBox *combo_box)
 
     for (list = *mro->url_list; list; list = list->next) {
         const gchar *url = list->data;
-
-        gchar *short_name = balsa_get_short_mailbox_name(url);
+        
+        gchar * short_name = balsa_get_short_mailbox_name(url);
         gtk_list_store_append(store, &iter);
         gtk_list_store_set(store, &iter,
                            0, short_name,
@@ -2095,26 +1929,24 @@ bmbl_mru_combo_box_setup(GtkComboBox *combo_box)
     gtk_list_store_append(store, &iter);
     gtk_list_store_set(store, &iter,
                        0, _("Other…"),
-                       1, FALSE, -1);
+                      1, FALSE, -1);
     gtk_combo_box_set_active(combo_box, 0);
 }
 
-
 /* Callbacks */
 static void
-bmbl_mru_combo_box_changed(GtkComboBox          *combo_box,
-                           BalsaMBListMRUOption *mro)
+bmbl_mru_combo_box_changed(GtkComboBox * combo_box,
+                           BalsaMBListMRUOption * mro)
 {
     BalsaMBListMRUEntry mru;
     const gchar *url;
     gint active = gtk_combo_box_get_active(combo_box);
 
-    if (active < 0) {
-        return;
-    }
+    if (active < 0)
+       return;
     if ((url = g_slist_nth_data(mro->real_urls, active))) {
-        /* Move this url to the top. */
-        balsa_mblist_mru_add(mro->url_list, url);
+       /* Move this url to the top. */
+       balsa_mblist_mru_add(mro->url_list, url);
         return;
     }
 
@@ -2130,15 +1962,13 @@ bmbl_mru_combo_box_changed(GtkComboBox          *combo_box,
     bmbl_mru_combo_box_setup(combo_box);
 }
 
-
 static void
-bmbl_mru_combo_box_destroy_cb(BalsaMBListMRUOption *mro)
+bmbl_mru_combo_box_destroy_cb(BalsaMBListMRUOption * mro)
 {
     g_slist_free_full(mro->real_urls, g_free);
     g_free(mro);
 }
 
-
 /*
  * balsa_mblist_mru_option_menu:
  *
@@ -2154,9 +1984,7 @@ bmbl_mru_combo_box_destroy_cb(BalsaMBListMRUOption *mro)
  * is clicked, the url_list is updated.
  */
 static gboolean
-bmbl_mru_separator_func(GtkTreeModel *model,
-                        GtkTreeIter  *iter,
-                        gpointer      data)
+bmbl_mru_separator_func(GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
 {
     gboolean is_sep;
 
@@ -2165,10 +1993,8 @@ bmbl_mru_separator_func(GtkTreeModel *model,
     return is_sep;
 }
 
-
 GtkWidget *
-balsa_mblist_mru_option_menu(GtkWindow *window,
-                             GList    **url_list)
+balsa_mblist_mru_option_menu(GtkWindow * window, GList ** url_list)
 {
     GtkWidget *combo_box;
     BalsaMBListMRUOption *mro;
@@ -2201,7 +2027,6 @@ balsa_mblist_mru_option_menu(GtkWindow *window,
     return combo_box;
 }
 
-
 /*
  * balsa_mblist_mru_option_menu_set
  *
@@ -2213,8 +2038,7 @@ balsa_mblist_mru_option_menu(GtkWindow *window,
  * structure.
  */
 void
-balsa_mblist_mru_option_menu_set(GtkWidget   *combo_box,
-                                 const gchar *url)
+balsa_mblist_mru_option_menu_set(GtkWidget * combo_box, const gchar * url)
 {
     BalsaMBListMRUOption *mro =
         g_object_get_data(G_OBJECT(combo_box), "mro");
@@ -2223,7 +2047,6 @@ balsa_mblist_mru_option_menu_set(GtkWidget   *combo_box,
     bmbl_mru_combo_box_setup(GTK_COMBO_BOX(combo_box));
 }
 
-
 /*
  * balsa_mblist_mru_option_menu_get
  *
@@ -2236,7 +2059,7 @@ balsa_mblist_mru_option_menu_set(GtkWidget   *combo_box,
  * string if it is needed more than temporarily.
  */
 const gchar *
-balsa_mblist_mru_option_menu_get(GtkWidget *combo_box)
+balsa_mblist_mru_option_menu_get(GtkWidget * combo_box)
 {
     gint active;
     BalsaMBListMRUOption *mro =
@@ -2247,22 +2070,19 @@ balsa_mblist_mru_option_menu_get(GtkWidget *combo_box)
     return g_slist_nth_data(mro->real_urls, active);
 }
 
-
 static void
-bmbl_expand_to_row(BalsaMBList *mblist,
-                   GtkTreePath *path)
+bmbl_expand_to_row(BalsaMBList * mblist, GtkTreePath * path)
 {
     GtkTreePath *tmp = gtk_tree_path_copy(path);
 
-    if (gtk_tree_path_up(tmp) && (gtk_tree_path_get_depth(tmp) > 0)
+    if (gtk_tree_path_up(tmp) && gtk_tree_path_get_depth(tmp) > 0
         && !gtk_tree_view_row_expanded(GTK_TREE_VIEW(mblist), tmp)) {
-        gtk_tree_view_expand_to_path(GTK_TREE_VIEW(mblist), tmp);
+       gtk_tree_view_expand_to_path(GTK_TREE_VIEW(mblist), tmp);
     }
 
     gtk_tree_path_free(tmp);
 }
 
-
 /* Make a new row for mbnode in balsa_app.mblist_tree_store; the row
  * will be a child to the row for root, if we find it, and a top-level
  * row otherwise. */
@@ -2280,10 +2100,9 @@ bmbl_sort_idle(gpointer data)
     return FALSE;
 }
 
-
 void
-balsa_mblist_mailbox_node_append(BalsaMailboxNode *root,
-                                 BalsaMailboxNode *mbnode)
+balsa_mblist_mailbox_node_append(BalsaMailboxNode * root,
+                                BalsaMailboxNode * mbnode)
 {
     GtkTreeModel *model;
     GtkTreeIter parent;
@@ -2298,14 +2117,13 @@ balsa_mblist_mailbox_node_append(BalsaMailboxNode *root,
             (sortable, &balsa_app.mblist->sort_column_id, NULL);
         gtk_tree_sortable_set_sort_column_id
             (sortable, GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID,
-            GTK_SORT_ASCENDING);
+                       GTK_SORT_ASCENDING);
         balsa_app.mblist->sort_idle_id =
             g_idle_add(bmbl_sort_idle, g_object_ref(sortable));
     }
 
-    if (root && balsa_find_iter_by_data(&parent, root)) {
-        parent_iter = &parent;
-    }
+    if (root && balsa_find_iter_by_data(&parent, root))
+       parent_iter = &parent;
     gtk_tree_store_prepend(balsa_app.mblist_tree_store, &iter, parent_iter);
     bmbl_store_redraw_mbnode(&iter, mbnode);
 
@@ -2327,14 +2145,12 @@ balsa_mblist_mailbox_node_append(BalsaMailboxNode *root,
     g_object_unref(mbnode);
 }
 
-
 /* Rerender a row after its properties have changed. */
 void
-balsa_mblist_mailbox_node_redraw(BalsaMailboxNode *mbnode)
+balsa_mblist_mailbox_node_redraw(BalsaMailboxNode * mbnode)
 {
     GtkTreeIter iter;
-    if (balsa_find_iter_by_data(&iter, mbnode)) {
-        bmbl_store_redraw_mbnode(&iter, mbnode);
-    }
+    if (balsa_find_iter_by_data(&iter, mbnode))
+       bmbl_store_redraw_mbnode(&iter, mbnode);
     balsa_window_update_tab(mbnode);
 }
diff --git a/src/balsa-mblist.h b/src/balsa-mblist.h
index c216f03..79d94d0 100644
--- a/src/balsa-mblist.h
+++ b/src/balsa-mblist.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -24,12 +24,8 @@
 #include "mailbox-node.h"
 
 #define BALSA_TYPE_MBLIST          (balsa_mblist_get_type ())
-#define BALSA_MBLIST(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, \
-                                                               BALSA_TYPE_MBLIST, \
-                                                               BalsaMBList)
-#define BALSA_MBLIST_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, \
-                                                            BALSA_TYPE_MBLIST, \
-                                                            BalsaMBListClass)
+#define BALSA_MBLIST(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, BALSA_TYPE_MBLIST, BalsaMBList)
+#define BALSA_MBLIST_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, BALSA_TYPE_MBLIST, BalsaMBListClass)
 #define BALSA_IS_MBLIST(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, BALSA_TYPE_MBLIST)
 
 typedef struct _BalsaMBList BalsaMBList;
@@ -44,15 +40,15 @@ struct _BalsaMBList {
     gulong toggled_handler_id;
 
     /* to set sort order in an idle callback */
-    gint sort_column_id;
+    gint  sort_column_id;
     guint sort_idle_id;
 };
 
 struct _BalsaMBListClass {
     GtkTreeViewClass parent_class;
 
-    void (*has_unread_mailbox)(BalsaMBList *mblist,
-                               gboolean     has_unread_mailbox);
+    void (*has_unread_mailbox)(BalsaMBList * mblist,
+                               gboolean has_unread_mailbox);
 };
 
 GType balsa_mblist_get_type(void);
@@ -60,45 +56,40 @@ GType balsa_mblist_get_type(void);
 GtkWidget *balsa_mblist_new(void);
 
 GtkTreeStore *balsa_mblist_get_store(void);
-void balsa_mblist_default_signal_bindings(BalsaMBList *tree);
-
-void balsa_mblist_update_mailbox(GtkTreeStore    *store,
-                                 LibBalsaMailbox *mailbox);
-gboolean balsa_mblist_focus_mailbox(BalsaMBList     *mblist,
-                                    LibBalsaMailbox *mailbox);
+void balsa_mblist_default_signal_bindings(BalsaMBList * tree);
 
-GList *balsa_mblist_find_all_unread_mboxes(LibBalsaMailbox *mailbox);
-void balsa_mblist_open_mailbox(LibBalsaMailbox *mailbox);
-void balsa_mblist_open_mailbox_hidden(LibBalsaMailbox *mailbox);
-void balsa_mblist_close_mailbox(LibBalsaMailbox *mailbox);
+void balsa_mblist_update_mailbox(GtkTreeStore * store,
+                                 LibBalsaMailbox * mailbox);
+gboolean balsa_mblist_focus_mailbox(BalsaMBList * mblist,
+                                    LibBalsaMailbox * mailbox);
 
+GList *balsa_mblist_find_all_unread_mboxes(LibBalsaMailbox * mailbox);
+void balsa_mblist_open_mailbox(LibBalsaMailbox * mailbox);
+void balsa_mblist_open_mailbox_hidden(LibBalsaMailbox * mailbox);
+void balsa_mblist_close_mailbox(LibBalsaMailbox * mailbox);
 /* balsa_mblist_close_lru_peer_mbx closes least recently used mailbox
  * on the same server as the one given as the argument */
-gboolean balsa_mblist_close_lru_peer_mbx(BalsaMBList     *mblist,
+gboolean balsa_mblist_close_lru_peer_mbx(BalsaMBList * mblist,
                                          LibBalsaMailbox *mailbox);
 
-BalsaMailboxNode *balsa_mblist_get_selected_node(BalsaMBList *mblist);
-BalsaMailboxNode *balsa_mblist_get_node_by_mailbox(BalsaMBList *mblist,
+BalsaMailboxNode *balsa_mblist_get_selected_node(BalsaMBList * mblist);
+BalsaMailboxNode *balsa_mblist_get_node_by_mailbox(BalsaMBList * mblist,
                                                    LibBalsaMailbox *
                                                    mailbox);
-GtkWidget *balsa_mblist_mru_menu(GtkWindow *window,
-                                 GList    **url_list,
-                                 GCallback  user_func,
-                                 gpointer   user_data);
-void balsa_mblist_mru_add(GList      **url_list,
-                          const gchar *url);
-void balsa_mblist_mru_drop(GList      **url_list,
-                           const gchar *url);
-GtkWidget *balsa_mblist_mru_option_menu(GtkWindow *window,
-                                        GList    **url_list);
-void balsa_mblist_mru_option_menu_set(GtkWidget   *option_menu,
-                                      const gchar *url);
-const gchar *balsa_mblist_mru_option_menu_get(GtkWidget *option_menu);
+GtkWidget *balsa_mblist_mru_menu(GtkWindow * window, GList ** url_list,
+                                 GCallback user_func, gpointer user_data);
+void balsa_mblist_mru_add(GList ** url_list, const gchar * url);
+void balsa_mblist_mru_drop(GList ** url_list, const gchar * url);
+GtkWidget *balsa_mblist_mru_option_menu(GtkWindow * window, 
+                                        GList ** url_list);
+void balsa_mblist_mru_option_menu_set(GtkWidget * option_menu,
+                                      const gchar * url);
+const gchar *balsa_mblist_mru_option_menu_get(GtkWidget * option_menu);
 
 /* BalsaMailboxNode methods */
-void balsa_mblist_mailbox_node_append(BalsaMailboxNode *root,
-                                      BalsaMailboxNode *mbnode);
-void balsa_mblist_mailbox_node_redraw(BalsaMailboxNode *mbnode);
-gboolean balsa_mblist_mailbox_node_remove(BalsaMailboxNode *mbnode);
+void balsa_mblist_mailbox_node_append(BalsaMailboxNode * root,
+                                     BalsaMailboxNode * mbnode);
+void balsa_mblist_mailbox_node_redraw(BalsaMailboxNode * mbnode);
+gboolean balsa_mblist_mailbox_node_remove(BalsaMailboxNode * mbnode);
 
 #endif
diff --git a/src/balsa-message.c b/src/balsa-message.c
index 1128095..4da666d 100644
--- a/src/balsa-message.c
+++ b/src/balsa-message.c
@@ -18,7 +18,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-message.h"
 
@@ -49,27 +49,19 @@
 #include "libbalsa-vfs.h"
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#  include "macosx-helpers.h"
 #endif
 
 #ifdef HAVE_GPGME
-#   include "gmime-part-rfc2440.h"
+#  include "gmime-part-rfc2440.h"
 #endif
 
-#define FORWARD_SEARCH(iter, text, match_begin, match_end)            \
-    gtk_text_iter_forward_search((iter), \
-                                 (text),                        \
-                                 GTK_TEXT_SEARCH_CASE_INSENSITIVE, \
-                                 (match_begin), \
-                                 (match_end), \
-                                 NULL)
-#define BACKWARD_SEARCH(iter, text, match_begin, match_end)           \
-    gtk_text_iter_backward_search((iter), \
-                                  (text),                       \
-                                  GTK_TEXT_SEARCH_CASE_INSENSITIVE, \
-                                  (match_begin), \
-                                  (match_end), \
-                                  NULL)
+#  define FORWARD_SEARCH(iter, text, match_begin, match_end)            \
+    gtk_text_iter_forward_search((iter), (text),                        \
+    GTK_TEXT_SEARCH_CASE_INSENSITIVE, (match_begin), (match_end), NULL)
+#  define BACKWARD_SEARCH(iter, text, match_begin, match_end)           \
+    gtk_text_iter_backward_search((iter), (text),                       \
+    GTK_TEXT_SEARCH_CASE_INSENSITIVE, (match_begin), (match_end), NULL)
 
 enum {
     SELECT_PART,
@@ -108,84 +100,70 @@ struct _BalsaPartInfoClass {
 static GType balsa_part_info_get_type();
 
 #define TYPE_BALSA_PART_INFO          \
-    (balsa_part_info_get_type ())
+        (balsa_part_info_get_type ())
 #define BALSA_PART_INFO(obj)          \
-    (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BALSA_PART_INFO, BalsaPartInfo))
+        (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BALSA_PART_INFO, BalsaPartInfo))
 #define IS_BALSA_PART_INFO(obj)       \
-    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BALSA_PART_INFO))
+        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BALSA_PART_INFO))
 
 static gint balsa_message_signals[LAST_SIGNAL];
 
 /* widget */
-static void balsa_message_class_init(BalsaMessageClass *klass);
-static void balsa_message_init(BalsaMessage *bm);
-
-static void balsa_message_destroy(GObject *object);
-
-static void display_headers(BalsaMessage *bm);
-static void display_content(BalsaMessage *bm);
-
-static LibBalsaMessageBody *add_part(BalsaMessage  *bm,
-                                     BalsaPartInfo *info,
-                                     GtkWidget     *container);
-static LibBalsaMessageBody *add_multipart(BalsaMessage        *bm,
-                                          LibBalsaMessageBody *parent,
-                                          GtkWidget           *container);
-static void select_part(BalsaMessage  *bm,
-                        BalsaPartInfo *info);
-static void tree_activate_row_cb(GtkTreeView       *treeview,
-                                 GtkTreePath       *arg1,
-                                 GtkTreeViewColumn *arg2,
-                                 gpointer           user_data);
-static gboolean tree_menu_popup_key_cb(GtkWidget *widget,
-                                       gpointer   user_data);
+static void balsa_message_class_init(BalsaMessageClass * klass);
+static void balsa_message_init(BalsaMessage * bm);
+
+static void balsa_message_destroy(GObject * object);
+
+static void display_headers(BalsaMessage * bm);
+static void display_content(BalsaMessage * bm);
+
+static LibBalsaMessageBody *add_part(BalsaMessage *bm, BalsaPartInfo *info,
+                                     GtkWidget * container);
+static LibBalsaMessageBody *add_multipart(BalsaMessage * bm,
+                                          LibBalsaMessageBody * parent,
+                                          GtkWidget * container);
+static void select_part(BalsaMessage * bm, BalsaPartInfo *info);
+static void tree_activate_row_cb(GtkTreeView *treeview, GtkTreePath *arg1,
+                                 GtkTreeViewColumn *arg2, gpointer user_data);
+static gboolean tree_menu_popup_key_cb(GtkWidget *widget, gpointer user_data);
 static void bm_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
                                   gint                  n_press,
                                   gdouble               x,
                                   gdouble               y,
                                   gpointer              user_data);
 
-static void part_info_init(BalsaMessage  *bm,
-                           BalsaPartInfo *info);
-static void part_context_save_all_cb(GtkWidget *menu_item,
-                                     GList     *info_list);
-static void part_context_dump_all_cb(GtkWidget *menu_item,
-                                     GList     *info_list);
-static void part_create_menu(BalsaPartInfo *info);
+static void part_info_init(BalsaMessage * bm, BalsaPartInfo * info);
+static void part_context_save_all_cb(GtkWidget * menu_item, GList * info_list);
+static void part_context_dump_all_cb(GtkWidget * menu_item, GList * info_list);
+static void part_create_menu (BalsaPartInfo* info);
 
 static GtkNotebookClass *parent_class = NULL;
 
 /* stuff needed for sending Message Disposition Notifications */
-static void handle_mdn_request(GtkWindow       *parent,
-                               LibBalsaMessage *message);
-static LibBalsaMessage *create_mdn_reply(const LibBalsaIdentity *mdn_ident,
-                                         LibBalsaMessage        *for_msg,
-                                         gboolean                manual);
-static GtkWidget *create_mdn_dialog(GtkWindow        *parent,
-                                    gchar            *sender,
-                                    gchar            *mdn_to_address,
-                                    LibBalsaMessage  *send_msg,
-                                    LibBalsaIdentity *mdn_ident);
-static void mdn_dialog_response(GtkWidget *dialog,
-                                gint       response,
-                                gpointer   user_data);
-
-static void balsa_part_info_init(GObject *object,
-                                 gpointer data);
-static BalsaPartInfo *balsa_part_info_new(LibBalsaMessageBody *body);
-static void balsa_part_info_dispose(GObject *object);
-static void balsa_part_info_finalize(GObject *object);
+static void handle_mdn_request(GtkWindow *parent, LibBalsaMessage *message);
+static LibBalsaMessage *create_mdn_reply (const LibBalsaIdentity *mdn_ident,
+                                          LibBalsaMessage *for_msg,
+                                          gboolean manual);
+static GtkWidget* create_mdn_dialog (GtkWindow *parent, gchar *sender,
+                                    gchar *mdn_to_address,
+                                     LibBalsaMessage *send_msg,
+                                     LibBalsaIdentity *mdn_ident);
+static void mdn_dialog_response(GtkWidget * dialog, gint response,
+                                gpointer user_data);
+
+static void balsa_part_info_init(GObject *object, gpointer data);
+static BalsaPartInfo* balsa_part_info_new(LibBalsaMessageBody* body);
+static void balsa_part_info_dispose(GObject * object);
+static void balsa_part_info_finalize(GObject * object);
 
 
 #ifdef HAVE_GPGME
 static LibBalsaMsgProtectState balsa_message_scan_signatures(LibBalsaMessageBody *body,
-                                                             LibBalsaMessage     *message);
-static GdkPixbuf *get_crypto_content_icon(LibBalsaMessageBody *body,
-                                          const gchar         *content_type,
-                                          gchar              **icon_title);
-static void message_recheck_crypto_cb(GtkWidget    *button,
-                                      BalsaMessage *bm);
-
+                                                            LibBalsaMessage * message);
+static GdkPixbuf * get_crypto_content_icon(LibBalsaMessageBody * body,
+                                          const gchar * content_type,
+                                          gchar ** icon_title);
+static void message_recheck_crypto_cb(GtkWidget * button, BalsaMessage * bm);
 #endif /* HAVE_GPGME */
 
 static GObjectClass *part_info_parent_class;
@@ -197,37 +175,35 @@ balsa_part_info_class_init(BalsaPartInfoClass *klass)
 
     part_info_parent_class = g_type_class_peek_parent(object_class);
 
-    object_class->dispose = balsa_part_info_dispose;
+    object_class->dispose  = balsa_part_info_dispose;
     object_class->finalize = balsa_part_info_finalize;
 }
 
-
 static GType
 balsa_part_info_get_type()
 {
-    static GType balsa_part_info_type = 0;
+    static GType balsa_part_info_type = 0 ;
 
     if (!balsa_part_info_type) {
         static const GTypeInfo balsa_part_info_info =
-        {
-            sizeof (BalsaPartInfoClass),
-            (GBaseInitFunc) NULL,
-            (GBaseFinalizeFunc) NULL,
-            (GClassInitFunc) balsa_part_info_class_init,
-            (GClassFinalizeFunc) NULL,
-            NULL,
-            sizeof(BalsaPartInfo),
-            0,
-            (GInstanceInitFunc) balsa_part_info_init
-        };
+            {
+                sizeof (BalsaPartInfoClass),
+                (GBaseInitFunc) NULL,
+                (GBaseFinalizeFunc) NULL,
+                (GClassInitFunc) balsa_part_info_class_init,
+                (GClassFinalizeFunc) NULL,
+                NULL,
+                sizeof(BalsaPartInfo),
+                0,
+                (GInstanceInitFunc) balsa_part_info_init
+            };
         balsa_part_info_type =
-            g_type_register_static (G_TYPE_OBJECT, "BalsaPartInfo",
-                                    &balsa_part_info_info, 0);
+           g_type_register_static (G_TYPE_OBJECT, "BalsaPartInfo",
+                                   &balsa_part_info_info, 0);
     }
     return balsa_part_info_type;
 }
 
-
 GType
 balsa_message_get_type()
 {
@@ -247,15 +223,14 @@ balsa_message_get_type()
         };
 
         balsa_message_type =
-            g_type_register_static(GTK_TYPE_BOX, "BalsaMessage", &balsa_message_info, 0);
+               g_type_register_static(GTK_TYPE_BOX, "BalsaMessage", &balsa_message_info, 0);
     }
 
     return balsa_message_type;
 }
 
-
 static void
-balsa_message_class_init(BalsaMessageClass *klass)
+balsa_message_class_init(BalsaMessageClass * klass)
 {
     GObjectClass *object_class;
 
@@ -278,15 +253,13 @@ balsa_message_class_init(BalsaMessageClass *klass)
 
 }
 
-
 /* Helpers for balsa_message_init. */
 #define BALSA_MESSAGE_ATTACH_BTN "balsa-message-attach-btn"
 #define bm_header_widget_att_button(balsa_message) \
     g_object_get_data(G_OBJECT(balsa_message), BALSA_MESSAGE_ATTACH_BTN)
 
 static void
-balsa_headers_attachments_popup(GtkButton    *button,
-                                BalsaMessage *bm)
+balsa_headers_attachments_popup(GtkButton * button, BalsaMessage * bm)
 {
     if (bm->parts_popup) {
         gtk_menu_popup_at_widget(GTK_MENU(bm->parts_popup),
@@ -298,7 +271,7 @@ balsa_headers_attachments_popup(GtkButton    *button,
 
 
 static GtkWidget **
-bm_header_tl_buttons(BalsaMessage *bm)
+bm_header_tl_buttons(BalsaMessage * bm)
 {
     GPtrArray *array;
     GtkWidget *button;
@@ -308,27 +281,27 @@ bm_header_tl_buttons(BalsaMessage *bm)
 #ifdef HAVE_GPGME
     button = gtk_button_new_from_icon_name(balsa_icon_id(BALSA_PIXMAP_GPG_RECHECK));
     gtk_widget_set_tooltip_text(button,
-                                _("Check cryptographic signature"));
+                               _("Check cryptographic signature"));
     g_signal_connect(G_OBJECT(button), "notify::has-focus",
-                     G_CALLBACK(balsa_mime_widget_check_focus),
-                     (gpointer) bm);
+                    G_CALLBACK(balsa_mime_widget_check_focus),
+                    (gpointer) bm);
     gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
     g_signal_connect(button, "clicked",
-                     G_CALLBACK(message_recheck_crypto_cb), bm);
+                    G_CALLBACK(message_recheck_crypto_cb), bm);
     g_ptr_array_add(array, button);
 #endif
 
     button = gtk_button_new_from_icon_name(balsa_icon_id(BALSA_PIXMAP_ATTACHMENT));
     gtk_widget_set_tooltip_text(button,
-                                _("Select message part to display"));
+                               _("Select message part to display"));
     g_signal_connect(G_OBJECT(button), "notify::has-focus",
-                     G_CALLBACK(balsa_mime_widget_check_focus),
-                     (gpointer) bm);
+                    G_CALLBACK(balsa_mime_widget_check_focus),
+                    (gpointer) bm);
     gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
     g_signal_connect(button, "clicked",
-                     G_CALLBACK(balsa_headers_attachments_popup), bm);
+                    G_CALLBACK(balsa_headers_attachments_popup), bm);
     g_signal_connect(button, "key_press_event",
-                     G_CALLBACK(balsa_mime_widget_key_press_event), bm);
+                    G_CALLBACK(balsa_mime_widget_key_press_event), bm);
     g_object_set_data(G_OBJECT(bm), BALSA_MESSAGE_ATTACH_BTN, button);
     g_ptr_array_add(array, button);
 
@@ -337,7 +310,6 @@ bm_header_tl_buttons(BalsaMessage *bm)
     return (GtkWidget **) g_ptr_array_free(array, FALSE);
 }
 
-
 /*
  * Callbacks and helpers for the find bar.
  */
@@ -350,48 +322,42 @@ typedef enum {
 } BalsaMessageFindStatus;
 
 static void
-bm_find_set_status(BalsaMessage          *bm,
-                   BalsaMessageFindStatus status)
+bm_find_set_status(BalsaMessage * bm, BalsaMessageFindStatus status)
 {
     const gchar *text = "";
     gboolean sensitive = FALSE;
 
     switch (status) {
-    default:
-    case BM_FIND_STATUS_INIT:
-        break;
-
-    case BM_FIND_STATUS_FOUND:
-        /* The widget returned "found"; if it really found a string,
-         * we sensitize the "next" and "previous" buttons, but if
-         * the find-entry was empty, we desensitize them. */
-        if (gtk_entry_get_text(GTK_ENTRY(bm->find_entry))[0]) {
+        default:
+        case BM_FIND_STATUS_INIT:
+            break;
+        case BM_FIND_STATUS_FOUND:
+            /* The widget returned "found"; if it really found a string,
+             * we sensitize the "next" and "previous" buttons, but if
+             * the find-entry was empty, we desensitize them. */
+            if (gtk_entry_get_text(GTK_ENTRY(bm->find_entry))[0])
+                sensitive = TRUE;
+            break;
+        case BM_FIND_STATUS_WRAPPED:
+            text = _("Wrapped");
             sensitive = TRUE;
-        }
-        break;
-
-    case BM_FIND_STATUS_WRAPPED:
-        text = _("Wrapped");
-        sensitive = TRUE;
-        break;
-
-    case BM_FIND_STATUS_NOT_FOUND:
-        text = _("Not found");
-        break;
+            break;
+        case BM_FIND_STATUS_NOT_FOUND:
+            text = _("Not found");
+            break;
     }
 
     gtk_label_set_text(GTK_LABEL(bm->find_label), text);
     gtk_separator_tool_item_set_draw(GTK_SEPARATOR_TOOL_ITEM
-                                         (bm->find_sep), text[0] != '\0');
+                                     (bm->find_sep), text[0] != '\0');
     gtk_widget_set_sensitive(bm->find_prev, sensitive);
     gtk_widget_set_sensitive(bm->find_next, sensitive);
 }
 
-
 static void
-bm_find_scroll_to_rectangle(BalsaMessage *bm,
-                            GtkWidget    *widget,
-                            GdkRectangle *rectangle)
+bm_find_scroll_to_rectangle(BalsaMessage * bm,
+                            GtkWidget    * widget,
+                            GdkRectangle * rectangle)
 {
     gint x, y;
     GtkAdjustment *hadj, *vadj;
@@ -402,17 +368,16 @@ bm_find_scroll_to_rectangle(BalsaMessage *bm,
                                      &x, &y);
 
     g_object_get(G_OBJECT(bm->scroll), "hadjustment", &hadj,
-                 "vadjustment", &vadj, NULL);
+                                       "vadjustment", &vadj, NULL);
     gtk_adjustment_clamp_page(hadj, x, x + rectangle->width);
     gtk_adjustment_clamp_page(vadj, y, y + rectangle->height);
 }
 
-
 static void
-bm_find_scroll_to_selection(BalsaMessage *bm,
-                            GtkTextView  *text_view,
-                            GtkTextIter  *begin_iter,
-                            GtkTextIter  *end_iter)
+bm_find_scroll_to_selection(BalsaMessage * bm,
+                            GtkTextView  * text_view,
+                            GtkTextIter  * begin_iter,
+                            GtkTextIter  * end_iter)
 {
     GdkRectangle begin_location, end_location;
 
@@ -432,20 +397,17 @@ bm_find_scroll_to_selection(BalsaMessage *bm,
     bm_find_scroll_to_rectangle(bm, GTK_WIDGET(text_view), &begin_location);
 }
 
-
 #ifdef HAVE_HTML_WIDGET
 typedef struct {
     BalsaMessage *bm;
-    GtkWidget *widget;
-    gboolean continuing;
-    gboolean wrapping;
+    GtkWidget    *widget;
+    gboolean      continuing;
+    gboolean      wrapping;
 } BalsaMessageFindInfo;
-#   define BALSA_MESSAGE_FIND_INFO "BalsaMessageFindInfo"
+#define BALSA_MESSAGE_FIND_INFO "BalsaMessageFindInfo"
 
 static void
-bm_find_cb(const gchar *text,
-           gboolean     found,
-           gpointer     data)
+bm_find_cb(const gchar * text, gboolean found, gpointer data)
 {
     BalsaMessageFindInfo *info = data;
 
@@ -459,27 +421,22 @@ bm_find_cb(const gchar *text,
     if (found && *text) {
         GdkRectangle selection_bounds;
         if (libbalsa_html_get_selection_bounds(info->widget,
-                                               &selection_bounds)) {
+                                               &selection_bounds))
             bm_find_scroll_to_rectangle(info->bm, info->widget,
                                         &selection_bounds);
-        }
     }
 
     if (info->wrapping) {
         info->wrapping = FALSE;
         bm_find_set_status(info->bm, BM_FIND_STATUS_WRAPPED);
-    } else {
+    } else
         bm_find_set_status(info->bm, found ? BM_FIND_STATUS_FOUND :
-                           BM_FIND_STATUS_NOT_FOUND);
-    }
+                                             BM_FIND_STATUS_NOT_FOUND);
 }
-
-
 #endif                          /* HAVE_HTML_WIDGET */
 
 static void
-bm_find_entry_changed_cb(GtkEditable *editable,
-                         gpointer     data)
+bm_find_entry_changed_cb(GtkEditable * editable, gpointer data)
 {
     const gchar *text = gtk_entry_get_text(GTK_ENTRY(editable));
     BalsaMessage *bm = data;
@@ -519,7 +476,7 @@ bm_find_entry_changed_cb(GtkEditable *editable,
         }
 
         bm_find_set_status(bm, found ? BM_FIND_STATUS_FOUND :
-                           BM_FIND_STATUS_NOT_FOUND);
+                                       BM_FIND_STATUS_NOT_FOUND);
 #ifdef HAVE_HTML_WIDGET
     } else if (libbalsa_html_can_search(widget)) {
         BalsaMessageFindInfo *info;
@@ -535,15 +492,12 @@ bm_find_entry_changed_cb(GtkEditable *editable,
         libbalsa_html_search(widget, text, bm->find_forward, TRUE,
                              bm_find_cb, info);
 #endif                          /* HAVE_HTML_WIDGET */
-    } else {
+    } else
         g_assert_not_reached();
-    }
 }
 
-
 static void
-bm_find_again(BalsaMessage *bm,
-              gboolean      find_forward)
+bm_find_again(BalsaMessage * bm, gboolean find_forward)
 {
     const gchar *text = gtk_entry_get_text(GTK_ENTRY(bm->find_entry));
     GtkWidget *widget = balsa_mime_widget_get_widget(bm->current_part->mime_widget);
@@ -591,30 +545,24 @@ bm_find_again(BalsaMessage *bm,
         libbalsa_html_search(widget, text, find_forward, FALSE,
                              bm_find_cb, info);
 #endif                          /* HAVE_HTML_WIDGET */
-    } else {
+    } else
         g_assert_not_reached();
-    }
 }
 
-
 static void
-bm_find_prev_cb(GtkToolButton *prev_button,
-                gpointer       data)
+bm_find_prev_cb(GtkToolButton * prev_button, gpointer data)
 {
     bm_find_again((BalsaMessage *) data, FALSE);
 }
 
-
 static void
-bm_find_next_cb(GtkToolButton *prev_button,
-                gpointer       data)
+bm_find_next_cb(GtkToolButton * prev_button, gpointer data)
 {
     bm_find_again((BalsaMessage *) data, TRUE);
 }
 
-
 static GtkWidget *
-bm_find_bar_new(BalsaMessage *bm)
+bm_find_bar_new(BalsaMessage * bm)
 {
     GtkWidget *toolbar;
     GtkWidget *hbox;
@@ -660,21 +608,18 @@ bm_find_bar_new(BalsaMessage *bm)
     return toolbar;
 }
 
-
-static void bm_disable_find_entry(BalsaMessage *bm);
+static void bm_disable_find_entry(BalsaMessage * bm);
 
 static gboolean
-bm_find_pass_to_entry(BalsaMessage *bm,
-                      GdkEvent     *event)
+bm_find_pass_to_entry(BalsaMessage * bm, GdkEvent * event)
 {
     gboolean res = TRUE;
     guint keyval;
     GdkModifierType state;
 
     if (!gdk_event_get_keyval(event, &keyval) ||
-        !gdk_event_get_state(event, &state)) {
+        !gdk_event_get_state(event, &state))
         return FALSE;
-    }
 
     switch (keyval) {
     case GDK_KEY_Escape:
@@ -682,46 +627,41 @@ bm_find_pass_to_entry(BalsaMessage *bm,
     case GDK_KEY_KP_Enter:
         bm_disable_find_entry(bm);
         return res;
-
     case GDK_KEY_g:
-        if (((state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) == GDK_CONTROL_MASK) &&
+        if ((state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) == GDK_CONTROL_MASK &&
             gtk_widget_get_sensitive(bm->find_next)) {
             bm_find_again(bm, bm->find_forward);
             return res;
         }
-
     default:
         break;
     }
 
     res = FALSE;
-    if (gtk_widget_has_focus(bm->find_entry)) {
+    if (gtk_widget_has_focus(bm->find_entry))
         g_signal_emit_by_name(bm->find_entry, "key-press-event", event,
                               &res, NULL);
-    }
 
     return res;
 }
 
-
 static void
-bm_disable_find_entry(BalsaMessage *bm)
+bm_disable_find_entry(BalsaMessage * bm)
 {
     g_signal_handlers_disconnect_by_func
         (gtk_widget_get_toplevel(GTK_WIDGET(bm)),
-        G_CALLBACK(bm_find_pass_to_entry), bm);
+         G_CALLBACK(bm_find_pass_to_entry), bm);
     gtk_widget_hide(bm->find_bar);
 }
 
-
 /*
  * End of callbacks and helpers for the find bar.
  */
 
 static void
-balsa_message_init(BalsaMessage *bm)
+balsa_message_init(BalsaMessage * bm)
 {
-    GtkStack *stack;
+    GtkStack  *stack;
     GtkWidget *vbox;
     GtkWidget *scroll;
     GtkWidget **buttons;
@@ -752,7 +692,7 @@ balsa_message_init(BalsaMessage *bm)
                                    GTK_POLICY_AUTOMATIC,
                                    GTK_POLICY_AUTOMATIC);
     g_signal_connect(scroll, "key_press_event",
-                     G_CALLBACK(balsa_mime_widget_key_press_event), bm);
+                    G_CALLBACK(balsa_mime_widget_key_press_event), bm);
     gtk_widget_set_vexpand(scroll, TRUE);
     gtk_box_pack_start(GTK_BOX(vbox), scroll);
 
@@ -770,7 +710,7 @@ balsa_message_init(BalsaMessage *bm)
     /* structure view */
     model = gtk_tree_store_new (NUM_COLUMNS,
                                 TYPE_BALSA_PART_INFO,
-                                G_TYPE_STRING,
+                               G_TYPE_STRING,
                                 GDK_TYPE_PIXBUF,
                                 G_TYPE_STRING);
     bm->treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL(model));
@@ -824,8 +764,8 @@ balsa_message_init(BalsaMessage *bm)
                                    GTK_POLICY_AUTOMATIC);
 
     gtk_tree_view_set_expander_column
-        (GTK_TREE_VIEW (bm->treeview), gtk_tree_view_get_column
-            (GTK_TREE_VIEW (bm->treeview), MIME_ICON_COLUMN - 1));
+       (GTK_TREE_VIEW (bm->treeview), gtk_tree_view_get_column
+        (GTK_TREE_VIEW (bm->treeview), MIME_ICON_COLUMN - 1));
 
     gtk_stack_add_titled(stack, scroll, "parts", _("Message parts"));
     gtk_container_add(GTK_CONTAINER(scroll), bm->treeview);
@@ -846,11 +786,10 @@ balsa_message_init(BalsaMessage *bm)
     gtk_box_pack_start(GTK_BOX(vbox), bm->find_bar);
 }
 
-
 static void
-balsa_message_destroy(GObject *object)
+balsa_message_destroy(GObject * object)
 {
-    BalsaMessage *bm = BALSA_MESSAGE(object);
+    BalsaMessage* bm = BALSA_MESSAGE(object);
 
     if (bm->treeview) {
         balsa_message_set(bm, NULL, 0);
@@ -867,12 +806,10 @@ balsa_message_destroy(GObject *object)
     g_clear_object(&bm->html_find_info);
 #endif                          /* HAVE_HTML_WIDGET */
 
-    if (G_OBJECT_CLASS(parent_class)->dispose) {
-        (*G_OBJECT_CLASS(parent_class)->dispose)(object);
-    }
+    if (G_OBJECT_CLASS(parent_class)->dispose)
+        (*G_OBJECT_CLASS(parent_class)->dispose) (object);
 }
 
-
 GtkWidget *
 balsa_message_new(void)
 {
@@ -885,11 +822,9 @@ balsa_message_new(void)
     return GTK_WIDGET(bm);
 }
 
-
 /* Returns a BalsaPartInfo with a reference (g_object_unref when done). */
 static BalsaPartInfo *
-tree_next_valid_part_info(GtkTreeModel *model,
-                          GtkTreeIter  *iter)
+tree_next_valid_part_info(GtkTreeModel * model, GtkTreeIter * iter)
 {
     BalsaPartInfo *info = NULL;
 
@@ -898,44 +833,36 @@ tree_next_valid_part_info(GtkTreeModel *model,
 
         /* check if there is a valid info */
         gtk_tree_model_get(model, iter, PART_INFO_COLUMN, &info, -1);
-        if (info) {
+        if (info)
             return info;
-        }
 
         /* if there are children, check the childs */
-        if (gtk_tree_model_iter_children (model, &child, iter)) {
-            if ((info = tree_next_valid_part_info(model, &child))) {
+        if (gtk_tree_model_iter_children (model, &child, iter))
+            if ((info = tree_next_valid_part_info(model, &child)))
                 return info;
-            }
-        }
 
         /* switch to the next iter on the same level */
-        if (!gtk_tree_model_iter_next(model, iter)) {
+        if (!gtk_tree_model_iter_next(model, iter))
             return NULL;
-        }
     } while (1);
     /* never reached */
     return NULL;
 }
 
-
 static void
-tree_activate_row_cb(GtkTreeView       *treeview,
-                     GtkTreePath       *arg1,
-                     GtkTreeViewColumn *arg2,
-                     gpointer           user_data)
+tree_activate_row_cb(GtkTreeView *treeview, GtkTreePath *arg1,
+                     GtkTreeViewColumn *arg2, gpointer user_data)
 {
-    BalsaMessage *bm = (BalsaMessage *)user_data;
-    GtkTreeModel *model = gtk_tree_view_get_model(treeview);
+    BalsaMessage * bm = (BalsaMessage *)user_data;
+    GtkTreeModel * model = gtk_tree_view_get_model(treeview);
     GtkTreeIter sel_iter;
     BalsaPartInfo *info = NULL;
 
     g_return_if_fail(bm);
 
     /* get the info of the activated part */
-    if (!gtk_tree_model_get_iter(model, &sel_iter, arg1)) {
+    if (!gtk_tree_model_get_iter(model, &sel_iter, arg1))
         return;
-    }
     gtk_tree_model_get(model, &sel_iter, PART_INFO_COLUMN, &info, -1);
 
     /* if it's not displayable (== no info), get the next one... */
@@ -945,25 +872,20 @@ tree_activate_row_cb(GtkTreeView       *treeview,
         if (!info) {
             gtk_tree_model_get_iter_first(model, &sel_iter);
             gtk_tree_model_get(model, &sel_iter, PART_INFO_COLUMN, &info, -1);
-            if (!info) {
+            if (!info)
                 info = tree_next_valid_part_info(model, &sel_iter);
-            }
         }
     }
 
     gtk_stack_set_visible_child_name(GTK_STACK(bm->stack), "content");
     select_part(bm, info);
-    if (info) {
+    if (info)
         g_object_unref(info);
-    }
 }
 
-
 static void
-collect_selected_info(GtkTreeModel *model,
-                      GtkTreePath  *path,
-                      GtkTreeIter  *iter,
-                      gpointer      data)
+collect_selected_info(GtkTreeModel * model, GtkTreePath * path,
+                      GtkTreeIter * iter, gpointer data)
 {
     GList **info_list = (GList **)data;
     BalsaPartInfo *info;
@@ -975,11 +897,9 @@ collect_selected_info(GtkTreeModel *model,
     }
 }
 
-
 static void
-tree_mult_selection_popup(BalsaMessage     *bm,
-                          const GdkEvent   *event,
-                          GtkTreeSelection *selection)
+tree_mult_selection_popup(BalsaMessage * bm, const GdkEvent * event,
+                          GtkTreeSelection * selection)
 {
     gint selected;
 
@@ -1025,24 +945,21 @@ tree_mult_selection_popup(BalsaMessage     *bm,
                           G_CALLBACK (part_context_dump_all_cb),
                           (gpointer) bm->save_all_list);
         gtk_menu_shell_append (GTK_MENU_SHELL (bm->save_all_popup), menu_item);
-        if (event) {
+        if (event)
             gtk_menu_popup_at_pointer(GTK_MENU(bm->save_all_popup),
                                       (GdkEvent *) event);
-        } else {
+        else
             gtk_menu_popup_at_widget(GTK_MENU(bm->save_all_popup),
                                      GTK_WIDGET(bm),
                                      GDK_GRAVITY_CENTER, GDK_GRAVITY_CENTER,
                                      NULL);
-        }
     }
 }
 
-
 static gboolean
-tree_menu_popup_key_cb(GtkWidget *widget,
-                       gpointer   user_data)
+tree_menu_popup_key_cb(GtkWidget *widget, gpointer user_data)
 {
-    BalsaMessage *bm = (BalsaMessage *)user_data;
+    BalsaMessage * bm = (BalsaMessage *)user_data;
 
     g_return_val_if_fail(bm, FALSE);
     tree_mult_selection_popup(bm, NULL,
@@ -1050,7 +967,6 @@ tree_menu_popup_key_cb(GtkWidget *widget,
     return TRUE;
 }
 
-
 static void
 bm_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
                       gint                  n_press,
@@ -1061,15 +977,14 @@ bm_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
     GtkGesture *gesture;
     const GdkEvent *event;
     GtkTreeView *tree_view;
-    BalsaMessage *bm = (BalsaMessage *) user_data;
+    BalsaMessage * bm = (BalsaMessage *) user_data;
     GtkTreePath *path;
 
     gesture = GTK_GESTURE(multi_press);
     event = gtk_gesture_get_last_event(gesture, gtk_gesture_get_last_updated_sequence(gesture));
     g_return_if_fail(event != NULL);
-    if (!gdk_event_triggers_context_menu(event)) {
+    if (!gdk_event_triggers_context_menu(event))
         return;
-    }
 
     tree_view = GTK_TREE_VIEW(gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture)));
 
@@ -1082,9 +997,9 @@ bm_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
     if (gtk_tree_view_get_path_at_pos(tree_view, (gint) x, (gint) y,
                                       &path, NULL, NULL, NULL)) {
         GtkTreeIter iter;
-        GtkTreeSelection *selection =
+        GtkTreeSelection * selection =
             gtk_tree_view_get_selection(tree_view);
-        GtkTreeModel *model = gtk_tree_view_get_model(tree_view);
+        GtkTreeModel * model = gtk_tree_view_get_model(tree_view);
 
         if (!gtk_tree_selection_path_is_selected(selection, path)) {
             BalsaPartInfo *info = NULL;
@@ -1102,43 +1017,37 @@ bm_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
                     g_object_unref(info);
                 }
             }
-        } else {
+        } else
             tree_mult_selection_popup(bm, event, selection);
-        }
         gtk_tree_path_free(path);
     }
 }
 
-
 /* balsa_message_set:
    returns TRUE on success, FALSE on failure (message content could not be
    accessed).
 
    if msgno == 0, clears the display and returns TRUE
- */
+*/
 
 /* Helpers:
  */
 
 gchar *
-balsa_message_sender_to_gchar(InternetAddressList *list,
-                              gint                 which)
+balsa_message_sender_to_gchar(InternetAddressList * list, gint which)
 {
     InternetAddress *ia;
 
-    if (!list) {
-        return g_strdup(_("(No sender)"));
-    }
-    if (which < 0) {
-        return internet_address_list_to_string(list, FALSE);
-    }
+    if (!list)
+       return g_strdup(_("(No sender)"));
+    if (which < 0)
+       return internet_address_list_to_string(list, FALSE);
     ia = internet_address_list_get_address (list, which);
     return internet_address_to_string(ia, FALSE);
 }
 
-
 static void
-balsa_message_clear_tree(BalsaMessage *bm)
+balsa_message_clear_tree(BalsaMessage * bm)
 {
     GtkTreeModel *model;
 
@@ -1149,11 +1058,8 @@ balsa_message_clear_tree(BalsaMessage *bm)
     bm->info_count = 0;
 }
 
-
 gboolean
-balsa_message_set(BalsaMessage    *bm,
-                  LibBalsaMailbox *mailbox,
-                  guint            msgno)
+balsa_message_set(BalsaMessage * bm, LibBalsaMailbox * mailbox, guint msgno)
 {
     gboolean is_new;
     GtkTreeIter iter;
@@ -1172,7 +1078,7 @@ balsa_message_set(BalsaMessage    *bm,
         bm->message = NULL;
     }
 
-    if ((mailbox == NULL) || (msgno == 0)) {
+    if (mailbox == NULL || msgno == 0) {
         gtk_widget_hide(bm->switcher);
         gtk_stack_set_visible_child_name(GTK_STACK(bm->stack), "content");
         return TRUE;
@@ -1185,37 +1091,36 @@ balsa_message_set(BalsaMessage    *bm,
        expunges will update the LibBalsaMailbox::message data but no
        message numbers stored in random integer variables. */
     if (!message) {
-        balsa_information(LIBBALSA_INFORMATION_WARNING,
+       balsa_information(LIBBALSA_INFORMATION_WARNING,
                           _("Could not access message %u "
                             "in mailbox “%s”."),
-                          msgno, mailbox->name);
+                         msgno, mailbox->name);
         return FALSE;
     }
 
     is_new = LIBBALSA_MESSAGE_IS_UNREAD(message);
-    if (!libbalsa_message_body_ref(message, TRUE, TRUE)) {
-        libbalsa_mailbox_check(mailbox);
+    if(!libbalsa_message_body_ref(message, TRUE, TRUE)) {
+       libbalsa_mailbox_check(mailbox);
         g_object_unref(bm->message);
         bm->message = NULL;
-        balsa_information(LIBBALSA_INFORMATION_WARNING,
+       balsa_information(LIBBALSA_INFORMATION_WARNING,
                           _("Could not access message %u "
                             "in mailbox “%s”."),
-                          (unsigned int) message->msgno, mailbox->name);
+                         (unsigned int) message->msgno, mailbox->name);
         return FALSE;
     }
 
 #ifdef HAVE_GPGME
     balsa_message_perform_crypto(message,
-                                 libbalsa_mailbox_get_crypto_mode(mailbox),
-                                 FALSE, 1);
+                                libbalsa_mailbox_get_crypto_mode(mailbox),
+                                FALSE, 1);
     /* calculate the signature summary state if not set earlier */
-    if (message->prot_state == LIBBALSA_MSG_PROTECT_NONE) {
+    if(message->prot_state == LIBBALSA_MSG_PROTECT_NONE) {
         LibBalsaMsgProtectState prot_state =
             balsa_message_scan_signatures(message->body_list, message);
         /* update the icon if necessary */
-        if (message->prot_state != prot_state) {
+        if (message->prot_state != prot_state)
             message->prot_state = prot_state;
-        }
     }
 #endif
 
@@ -1226,11 +1131,10 @@ balsa_message_set(BalsaMessage    *bm,
     display_content(bm);
     gtk_widget_show(GTK_WIDGET(bm));
 
-    if (bm->info_count > 1) {
+    if (bm->info_count > 1)
         gtk_widget_show(bm->switcher);
-    } else {
+    else
         gtk_widget_hide(bm->switcher);
-    }
     gtk_stack_set_visible_child_name(GTK_STACK(bm->stack), "content");
 
     /*
@@ -1239,113 +1143,96 @@ balsa_message_set(BalsaMessage    *bm,
      * present.
      *
      */
-    if (is_new && message->headers->dispnotify_to) {
+    if (is_new && message->headers->dispnotify_to)
         handle_mdn_request (balsa_get_parent_window(GTK_WIDGET(bm)), message);
-    }
 
     if (!gtk_tree_model_get_iter_first (gtk_tree_view_get_model(GTK_TREE_VIEW(bm->treeview)),
-                                        &iter)) {
+                                        &iter))
         /* Not possible? */
         return TRUE;
-    }
 
     info =
         tree_next_valid_part_info(gtk_tree_view_get_model(GTK_TREE_VIEW(bm->treeview)),
                                   &iter);
     select_part(bm, info);
-    if (info) {
+    if (info)
         g_object_unref(info);
-    }
     /*
      * emit read message
      */
-    if (is_new && !mailbox->readonly) {
+    if (is_new && !mailbox->readonly)
         libbalsa_mailbox_msgno_change_flags(mailbox, message->msgno, 0,
                                             LIBBALSA_MESSAGE_FLAG_NEW);
-    }
 
     /* restore keyboard focus to the content, if it was there before */
-    if (has_focus) {
+    if (has_focus)
         balsa_message_grab_focus(bm);
-    }
 
     return TRUE;
 }
 
-
 void
-balsa_message_save_current_part(BalsaMessage *bm)
+balsa_message_save_current_part(BalsaMessage * bm)
 {
     g_return_if_fail(bm != NULL);
 
-    if (bm->current_part) {
-        balsa_mime_widget_ctx_menu_save(GTK_WIDGET(bm), bm->current_part->body);
-    }
+    if (bm->current_part)
+       balsa_mime_widget_ctx_menu_save(GTK_WIDGET(bm), bm->current_part->body);
 }
 
-
 static gboolean
-balsa_message_set_embedded_hdr(GtkTreeModel *model,
-                               GtkTreePath  *path,
-                               GtkTreeIter  *iter,
-                               gpointer      data)
+balsa_message_set_embedded_hdr(GtkTreeModel * model, GtkTreePath * path,
+                               GtkTreeIter *iter, gpointer data)
 {
     BalsaPartInfo *info = NULL;
-    BalsaMessage *bm = BALSA_MESSAGE(data);
+    BalsaMessage * bm = BALSA_MESSAGE(data);
 
     gtk_tree_model_get(model, iter, PART_INFO_COLUMN, &info, -1);
     if (info) {
-        if (info->body && info->body->embhdrs && info->mime_widget) {
-            balsa_mime_widget_message_set_headers_d(bm, info->mime_widget,
+       if (info->body && info->body->embhdrs && info->mime_widget)
+           balsa_mime_widget_message_set_headers_d(bm, info->mime_widget,
                                                     info->body->embhdrs,
                                                     info->body->parts,
                                                     info->body->embhdrs->subject);
-        }
-        g_object_unref(G_OBJECT(info));
+       g_object_unref(G_OBJECT(info));
     }
 
     return FALSE;
 }
 
-
 void
-balsa_message_set_displayed_headers(BalsaMessage *bmessage,
-                                    ShownHeaders  sh)
+balsa_message_set_displayed_headers(BalsaMessage * bmessage,
+                                    ShownHeaders sh)
 {
     g_return_if_fail(bmessage != NULL);
     g_return_if_fail(sh >= HEADERS_NONE && sh <= HEADERS_ALL);
 
-    if (bmessage->shown_headers == sh) {
+    if (bmessage->shown_headers == sh)
         return;
-    }
 
     bmessage->shown_headers = sh;
 
     if (bmessage->message) {
-        if (sh == HEADERS_ALL) {
+        if(sh == HEADERS_ALL)
             libbalsa_mailbox_set_msg_headers(bmessage->message->mailbox,
                                              bmessage->message);
-        }
         display_headers(bmessage);
         gtk_tree_model_foreach
             (gtk_tree_view_get_model(GTK_TREE_VIEW(bmessage->treeview)),
-            balsa_message_set_embedded_hdr, bmessage);
-        if (bm_header_widget_att_button(bmessage)) {
-            if (bmessage->info_count > 1) {
-                gtk_widget_show
-                    (GTK_WIDGET(bm_header_widget_att_button(bmessage)));
-            } else {
-                gtk_widget_hide
-                    (GTK_WIDGET(bm_header_widget_att_button(bmessage)));
-            }
-        }
+             balsa_message_set_embedded_hdr, bmessage);
+       if (bm_header_widget_att_button(bmessage)) {
+           if (bmessage->info_count > 1)
+               gtk_widget_show
+                   (GTK_WIDGET(bm_header_widget_att_button(bmessage)));
+           else
+               gtk_widget_hide
+                   (GTK_WIDGET(bm_header_widget_att_button(bmessage)));
+       }
     }
 }
 
-
 void
-balsa_message_set_wrap(BalsaMessage *bm,
-                       gboolean      wrap)
+balsa_message_set_wrap(BalsaMessage * bm, gboolean wrap)
 {
     g_return_if_fail(bm != NULL);
 
@@ -1360,7 +1247,7 @@ balsa_message_set_wrap(BalsaMessage *bm,
 
 
 static void
-display_headers(BalsaMessage *bm)
+display_headers(BalsaMessage * bm)
 {
     balsa_mime_widget_message_set_headers_d(bm, bm->bm_widget,
                                             bm->message->headers,
@@ -1370,8 +1257,7 @@ display_headers(BalsaMessage *bm)
 
 
 static void
-part_info_init(BalsaMessage  *bm,
-               BalsaPartInfo *info)
+part_info_init(BalsaMessage * bm, BalsaPartInfo * info)
 {
     g_return_if_fail(bm != NULL);
     g_return_if_fail(info != NULL);
@@ -1384,28 +1270,25 @@ part_info_init(BalsaMessage  *bm,
 static inline gchar *
 mpart_content_name(const gchar *content_type)
 {
-    if (g_ascii_strcasecmp(content_type, "multipart/mixed") == 0) {
+    if (g_ascii_strcasecmp(content_type, "multipart/mixed") == 0)
         return g_strdup(_("mixed parts"));
-    } else if (g_ascii_strcasecmp(content_type, "multipart/alternative") == 0) {
+    else if (g_ascii_strcasecmp(content_type, "multipart/alternative") == 0)
         return g_strdup(_("alternative parts"));
-    } else if (g_ascii_strcasecmp(content_type, "multipart/signed") == 0) {
+    else if (g_ascii_strcasecmp(content_type, "multipart/signed") == 0)
         return g_strdup(_("signed parts"));
-    } else if (g_ascii_strcasecmp(content_type, "multipart/encrypted") == 0) {
+    else if (g_ascii_strcasecmp(content_type, "multipart/encrypted") == 0)
         return g_strdup(_("encrypted parts"));
-    } else if (g_ascii_strcasecmp(content_type, "message/rfc822") == 0) {
+    else if (g_ascii_strcasecmp(content_type, "message/rfc822") == 0)
         return g_strdup(_("RFC822 message"));
-    } else {
+    else
         return g_strdup_printf(_("“%s” parts"),
                                strchr(content_type, '/') + 1);
-    }
 }
 
-
 static void
-atattchments_menu_cb(GtkWidget     *widget,
-                     BalsaPartInfo *info)
+atattchments_menu_cb(GtkWidget * widget, BalsaPartInfo *info)
 {
-    BalsaMessage *bm = g_object_get_data(G_OBJECT(widget), "balsa-message");
+    BalsaMessage * bm = g_object_get_data(G_OBJECT(widget), "balsa-message");
 
     g_return_if_fail(bm);
     g_return_if_fail(info);
@@ -1414,28 +1297,23 @@ atattchments_menu_cb(GtkWidget     *widget,
     select_part(bm, info);
 }
 
-
 static void
-add_to_attachments_popup(GtkMenuShell  *menu,
-                         const gchar   *item,
-                         BalsaMessage  *bm,
-                         BalsaPartInfo *info)
+add_to_attachments_popup(GtkMenuShell * menu, const gchar * item,
+                        BalsaMessage * bm, BalsaPartInfo *info)
 {
-    GtkWidget *menuitem = gtk_menu_item_new_with_label (item);
+    GtkWidget * menuitem = gtk_menu_item_new_with_label (item);
 
     g_object_set_data(G_OBJECT(menuitem), "balsa-message", bm);
     g_signal_connect(G_OBJECT (menuitem), "activate",
-                     G_CALLBACK (atattchments_menu_cb),
-                     (gpointer) info);
+                    G_CALLBACK (atattchments_menu_cb),
+                    (gpointer) info);
     gtk_menu_shell_append(menu, menuitem);
 }
 
-
 static void
-toggle_all_inline_cb(GtkCheckMenuItem *item,
-                     BalsaPartInfo    *info)
+toggle_all_inline_cb(GtkCheckMenuItem * item, BalsaPartInfo *info)
 {
-    BalsaMessage *bm = g_object_get_data(G_OBJECT(item), "balsa-message");
+    BalsaMessage * bm = g_object_get_data(G_OBJECT(item), "balsa-message");
 
     g_return_if_fail(bm);
     g_return_if_fail(info);
@@ -1446,19 +1324,17 @@ toggle_all_inline_cb(GtkCheckMenuItem *item,
     select_part(bm, info);
 }
 
-
 static void
-add_toggle_inline_menu_item(GtkMenuShell  *menu,
-                            BalsaMessage  *bm,
-                            BalsaPartInfo *info)
+add_toggle_inline_menu_item(GtkMenuShell * menu, BalsaMessage * bm,
+                           BalsaPartInfo *info)
 {
-    GtkWidget *menuitem =
-        gtk_check_menu_item_new_with_label (_("force inline for all parts"));
+    GtkWidget * menuitem =
+       gtk_check_menu_item_new_with_label (_("force inline for all parts"));
 
     g_object_set_data(G_OBJECT(menuitem), "balsa-message", bm);
     g_signal_connect(G_OBJECT (menuitem), "activate",
-                     G_CALLBACK (toggle_all_inline_cb),
-                     (gpointer) info);
+                    G_CALLBACK (toggle_all_inline_cb),
+                    (gpointer) info);
     gtk_menu_shell_append(menu, menuitem);
 
     /* Clear force-inline to be consistent with initial FALSE state of
@@ -1466,34 +1342,30 @@ add_toggle_inline_menu_item(GtkMenuShell  *menu,
     bm->force_inline = FALSE;
 }
 
-
 static void
-display_part(BalsaMessage        *bm,
-             LibBalsaMessageBody *body,
-             GtkTreeModel        *model,
-             GtkTreeIter         *iter,
-             gchar               *part_id)
+display_part(BalsaMessage * bm, LibBalsaMessageBody * body,
+             GtkTreeModel * model, GtkTreeIter * iter, gchar * part_id)
 {
     BalsaPartInfo *info = NULL;
     gchar *content_type = libbalsa_message_body_get_mime_type(body);
     gchar *icon_title = NULL;
-    gboolean is_multipart = libbalsa_message_body_is_multipart(body);
+    gboolean is_multipart=libbalsa_message_body_is_multipart(body);
     GdkPixbuf *content_icon;
     gchar *content_desc;
 
     content_desc = libbalsa_vfs_content_description(content_type);
 
-    if (!is_multipart ||
-        (g_ascii_strcasecmp(content_type, "message/rfc822") == 0) ||
-        (g_ascii_strcasecmp(content_type, "multipart/signed") == 0) ||
-        (g_ascii_strcasecmp(content_type, "multipart/encrypted") == 0) ||
-        (g_ascii_strcasecmp(content_type, "multipart/mixed") == 0) ||
-        (g_ascii_strcasecmp(content_type, "multipart/alternative") == 0)) {
+    if(!is_multipart ||
+       g_ascii_strcasecmp(content_type, "message/rfc822")==0 ||
+       g_ascii_strcasecmp(content_type, "multipart/signed")==0 ||
+       g_ascii_strcasecmp(content_type, "multipart/encrypted")==0 ||
+       g_ascii_strcasecmp(content_type, "multipart/mixed")==0 ||
+       g_ascii_strcasecmp(content_type, "multipart/alternative")==0) {
 
         info = balsa_part_info_new(body);
         bm->info_count++;
 
-        if ((g_ascii_strcasecmp(content_type, "message/rfc822") == 0) &&
+        if (g_ascii_strcasecmp(content_type, "message/rfc822") == 0 &&
             body->embhdrs) {
             gchar *from = balsa_message_sender_to_gchar(body->embhdrs->from, 0);
             gchar *subj = g_strdup(body->embhdrs->subject);
@@ -1506,45 +1378,45 @@ display_part(BalsaMessage        *bm,
             g_free(subj);
         } else if (is_multipart) {
             icon_title = mpart_content_name(content_type);
-            if (!strcmp(part_id, "1")) {
-                add_toggle_inline_menu_item(GTK_MENU_SHELL(bm->parts_popup),
-                                            bm, info);
-                gtk_menu_shell_append(GTK_MENU_SHELL(bm->parts_popup),
-                                      gtk_separator_menu_item_new ());
-                add_to_attachments_popup(GTK_MENU_SHELL(bm->parts_popup),
-                                         _("complete message"),
-                                         bm, info);
-                gtk_menu_shell_append(GTK_MENU_SHELL(bm->parts_popup),
-                                      gtk_separator_menu_item_new ());
-            }
+           if (!strcmp(part_id, "1")) {
+               add_toggle_inline_menu_item(GTK_MENU_SHELL(bm->parts_popup),
+                                           bm, info);
+               gtk_menu_shell_append(GTK_MENU_SHELL(bm->parts_popup),
+                                     gtk_separator_menu_item_new ());
+               add_to_attachments_popup(GTK_MENU_SHELL(bm->parts_popup),
+                                        _("complete message"),
+                                        bm, info);
+               gtk_menu_shell_append(GTK_MENU_SHELL(bm->parts_popup),
+                                     gtk_separator_menu_item_new ());
+           }
         } else if (body->filename) {
-            gchar *filename = g_strdup(body->filename);
-            gchar *menu_label;
+            gchar * filename = g_strdup(body->filename);
+           gchar * menu_label;
 
             libbalsa_utf8_sanitize(&filename, balsa_app.convert_unknown_8bit,
                                    NULL);
             icon_title =
                 g_strdup_printf("%s (%s)", filename, content_desc);
 
-            /* this should neither be a message nor multipart, so add it to the
-               attachments popup */
-            menu_label =
-                g_strdup_printf(_("part %s: %s (file %s)"), part_id,
-                                content_desc, filename);
-            add_to_attachments_popup(GTK_MENU_SHELL(bm->parts_popup),
-                                     menu_label, bm, info);
-            g_free(menu_label);
+           /* this should neither be a message nor multipart, so add it to the
+              attachments popup */
+           menu_label =
+               g_strdup_printf(_("part %s: %s (file %s)"), part_id,
+                               content_desc, filename);
+           add_to_attachments_popup(GTK_MENU_SHELL(bm->parts_popup),
+                                    menu_label, bm, info);
+           g_free(menu_label);
             g_free(filename);
         } else {
-            gchar *menu_label;
+           gchar * menu_label;
 
             icon_title = g_strdup_printf("%s", content_desc);
-            menu_label =
-                g_strdup_printf(_("part %s: %s"), part_id, content_desc);
-            add_to_attachments_popup(GTK_MENU_SHELL(bm->parts_popup),
-                                     menu_label, bm, info);
-            g_free(menu_label);
-        }
+           menu_label =
+               g_strdup_printf(_("part %s: %s"), part_id, content_desc);
+           add_to_attachments_popup(GTK_MENU_SHELL(bm->parts_popup),
+                                    menu_label, bm, info);
+           g_free(menu_label);
+       }
 
         part_create_menu (info);
         info->path = gtk_tree_model_get_path(model, iter);
@@ -1552,51 +1424,46 @@ display_part(BalsaMessage        *bm,
         /* add to the tree view */
 #ifdef HAVE_GPGME
         content_icon =
-            get_crypto_content_icon(body, content_type, &icon_title);
-        if (info->body->was_encrypted) {
-            gchar *new_title =
-                g_strconcat(_("encrypted: "), icon_title, NULL);
-            g_free(icon_title);
-            icon_title = new_title;
-        }
+           get_crypto_content_icon(body, content_type, &icon_title);
+       if (info->body->was_encrypted) {
+           gchar * new_title =
+               g_strconcat(_("encrypted: "), icon_title, NULL);
+           g_free(icon_title);
+           icon_title = new_title;
+       }
 #else
-        content_icon = NULL;
+       content_icon = NULL;
 #endif
-        if (!content_icon) {
-            content_icon =
-                libbalsa_icon_finder(GTK_WIDGET(bm), content_type, NULL, NULL, 24);
-        }
+        if (!content_icon)
+           content_icon =
+               libbalsa_icon_finder(GTK_WIDGET(bm), content_type, NULL, NULL, 24);
         gtk_tree_store_set (GTK_TREE_STORE(model), iter,
                             PART_INFO_COLUMN, info,
-                            PART_NUM_COLUMN, part_id,
+                           PART_NUM_COLUMN, part_id,
                             MIME_ICON_COLUMN, content_icon,
                             MIME_TYPE_COLUMN, icon_title, -1);
 
         g_object_unref(info);
         g_free(icon_title);
     } else {
-        content_icon =
-            libbalsa_icon_finder(GTK_WIDGET(bm), content_type, NULL, NULL, 24);
+       content_icon =
+           libbalsa_icon_finder(GTK_WIDGET(bm), content_type, NULL, NULL, 24);
         gtk_tree_store_set (GTK_TREE_STORE(model), iter,
                             PART_INFO_COLUMN, NULL,
-                            PART_NUM_COLUMN, part_id,
+                           PART_NUM_COLUMN, part_id,
                             MIME_ICON_COLUMN, content_icon,
                             MIME_TYPE_COLUMN, content_desc, -1);
     }
 
-    if (content_icon) {
-        g_object_unref(G_OBJECT(content_icon));
-    }
+    if (content_icon)
+       g_object_unref(G_OBJECT(content_icon));
     g_free(content_desc);
     g_free(content_type);
 }
 
-
 static void
-display_parts(BalsaMessage        *bm,
-              LibBalsaMessageBody *body,
-              GtkTreeIter         *parent,
-              gchar               *prefix)
+display_parts(BalsaMessage * bm, LibBalsaMessageBody * body,
+              GtkTreeIter * parent, gchar * prefix)
 {
     GtkTreeModel *model =
         gtk_tree_view_get_model(GTK_TREE_VIEW(bm->treeview));
@@ -1604,26 +1471,24 @@ display_parts(BalsaMessage        *bm,
     gint part_in_level = 1;
 
     while (body) {
-        gchar *part_id;
+       gchar * part_id;
 
-        if (prefix) {
-            part_id = g_strdup_printf("%s.%d", prefix, part_in_level);
-        } else {
-            part_id = g_strdup_printf("%d", part_in_level);
-        }
+       if (prefix)
+           part_id = g_strdup_printf("%s.%d", prefix, part_in_level);
+       else
+           part_id = g_strdup_printf("%d", part_in_level);
         gtk_tree_store_append(GTK_TREE_STORE(model), &iter, parent);
         display_part(bm, body, model, &iter, part_id);
         display_parts(bm, body->parts, &iter, part_id);
         body = body->next;
-        part_in_level++;
-        g_free(part_id);
+       part_in_level++;
+       g_free(part_id);
     }
 }
 
-
 /* Display the image in a "Face:" header, if any. */
 static void
-display_face(BalsaMessage *bm)
+display_face(BalsaMessage * bm)
 {
     GtkWidget *face_box;
     const gchar *face, *x_face = NULL;
@@ -1638,24 +1503,23 @@ display_face(BalsaMessage *bm)
     if (!bm->message
         || !((face = libbalsa_message_get_user_header(bm->message, "Face"))
              || (x_face =
-                     libbalsa_message_get_user_header(bm->message,
-                                                      "X-Face")))) {
+                 libbalsa_message_get_user_header(bm->message,
+                                                  "X-Face")))) {
         return;
     }
 
-    if (face) {
+    if (face)
         image = libbalsa_get_image_from_face_header(face, &err);
-    } else {
+    else {
 #if HAVE_COMPFACE
         image = libbalsa_get_image_from_x_face_header(x_face, &err);
 #else                           /* HAVE_COMPFACE */
         return;
-
 #endif                          /* HAVE_COMPFACE */
     }
     if (err) {
         balsa_information(LIBBALSA_INFORMATION_WARNING,
-                          /* Translators: please do not translate Face. */
+                /* Translators: please do not translate Face. */
                           _("Error loading Face: %s"), err->message);
         g_error_free(err);
         return;
@@ -1664,34 +1528,29 @@ display_face(BalsaMessage *bm)
     gtk_box_pack_start(GTK_BOX(face_box), image);
 }
 
-
 static void
-display_content(BalsaMessage *bm)
+display_content(BalsaMessage * bm)
 {
     balsa_message_clear_tree(bm);
-    if (bm->parts_popup) {
-        g_object_unref(bm->parts_popup);
-    }
+    if (bm->parts_popup)
+       g_object_unref(bm->parts_popup);
     bm->parts_popup = gtk_menu_new();
     g_object_ref_sink(bm->parts_popup);
     display_parts(bm, bm->message->body_list, NULL, NULL);
     if (bm->info_count > 1) {
-        gtk_widget_show(bm->parts_popup);
-        gtk_widget_show
-            (GTK_WIDGET(bm_header_widget_att_button(bm)));
-    } else {
-        gtk_widget_hide
-            (GTK_WIDGET(bm_header_widget_att_button(bm)));
-    }
+       gtk_widget_show(bm->parts_popup);
+       gtk_widget_show
+           (GTK_WIDGET(bm_header_widget_att_button(bm)));
+    } else
+       gtk_widget_hide
+           (GTK_WIDGET(bm_header_widget_att_button(bm)));
     display_face(bm);
     gtk_tree_view_columns_autosize(GTK_TREE_VIEW(bm->treeview));
     gtk_tree_view_expand_all(GTK_TREE_VIEW(bm->treeview));
 }
 
-
 void
-balsa_message_copy_part(const gchar         *url,
-                        LibBalsaMessageBody *part)
+balsa_message_copy_part(const gchar *url, LibBalsaMessageBody *part)
 {
     GError *err = NULL;
     LibBalsaMailbox *mailbox = balsa_find_mailbox_by_url(url);
@@ -1702,26 +1561,25 @@ balsa_message_copy_part(const gchar         *url,
     stream = libbalsa_message_body_get_stream(part, &err);
 
     if (!stream) {
-        libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                             _("Reading embedded message failed: %s"),
-                             err ? err->message : "?");
-        g_clear_error(&err);
-        return;
+       libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                            _("Reading embedded message failed: %s"),
+                            err ? err->message : "?");
+       g_clear_error(&err);
+       return;
     }
 
     if (!libbalsa_mailbox_add_message(mailbox, stream, 0, &err)) {
-        libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                             _("Appending message to %s failed: %s"),
-                             mailbox->name,
-                             err ? err->message : "?");
-        g_clear_error(&err);
+       libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                            _("Appending message to %s failed: %s"),
+                            mailbox->name,
+                            err ? err->message : "?");
+       g_clear_error(&err);
     }
     g_object_unref(stream);
 }
 
-
 static void
-part_create_menu(BalsaPartInfo *info)
+part_create_menu (BalsaPartInfo* info)
 /* Remarks: Will add items in the following order:
             1) Default application according to GnomeVFS.
             2) GNOME MIME/GnomeVFS key values that don't match default
@@ -1729,17 +1587,17 @@ part_create_menu(BalsaPartInfo *info)
             3) GnomeVFS shortlist applications, with the default one (sometimes
                included on shortlist, sometimes not) excluded. */
 {
-    GtkWidget *menu_item;
-    gchar *content_type;
+    GtkWidget* menu_item;
+    gchar* content_type;
 
     info->popup_menu = gtk_menu_new ();
     g_object_ref_sink(info->popup_menu);
 
     content_type = libbalsa_message_body_get_mime_type (info->body);
     libbalsa_vfs_fill_menu_by_content_type(GTK_MENU(info->popup_menu),
-                                           content_type,
-                                           G_CALLBACK (balsa_mime_widget_ctx_menu_cb),
-                                           (gpointer)info->body);
+                                          content_type,
+                                          G_CALLBACK (balsa_mime_widget_ctx_menu_cb),
+                                          (gpointer)info->body);
 
     menu_item = gtk_menu_item_new_with_mnemonic (_("_Save…"));
     g_signal_connect (G_OBJECT (menu_item), "activate",
@@ -1766,10 +1624,9 @@ part_create_menu(BalsaPartInfo *info)
 
 
 static void
-balsa_part_info_init(GObject *object,
-                     gpointer data)
+balsa_part_info_init(GObject *object, gpointer data)
 {
-    BalsaPartInfo *info = BALSA_PART_INFO(object);
+    BalsaPartInfo * info = BALSA_PART_INFO(object);
 
     info->body = NULL;
     info->mime_widget = NULL;
@@ -1777,20 +1634,18 @@ balsa_part_info_init(GObject *object,
     info->path = NULL;
 }
 
-
-static BalsaPartInfo *
-balsa_part_info_new(LibBalsaMessageBody *body)
+static BalsaPartInfo*
+balsa_part_info_new(LibBalsaMessageBody* body)
 {
-    BalsaPartInfo *info = g_object_new(TYPE_BALSA_PART_INFO, NULL);
+    BalsaPartInfo * info = g_object_new(TYPE_BALSA_PART_INFO, NULL);
     info->body = body;
     return info;
 }
 
-
 static void
-balsa_part_info_dispose(GObject *object)
+balsa_part_info_dispose(GObject * object)
 {
-    BalsaPartInfo *info;
+    BalsaPartInfo * info;
 
     info = BALSA_PART_INFO(object);
     g_clear_object(&info->mime_widget);
@@ -1799,11 +1654,10 @@ balsa_part_info_dispose(GObject *object)
     part_info_parent_class->dispose(object);
 }
 
-
 static void
-balsa_part_info_finalize(GObject *object)
+balsa_part_info_finalize(GObject * object)
 {
-    BalsaPartInfo *info;
+    BalsaPartInfo * info;
 
     g_return_if_fail(object != NULL);
     g_return_if_fail(IS_BALSA_PART_INFO(object));
@@ -1814,19 +1668,16 @@ balsa_part_info_finalize(GObject *object)
     part_info_parent_class->finalize(object);
 }
 
-
 static void
-part_context_save_all_cb(GtkWidget *menu_item,
-                         GList     *info_list)
+part_context_save_all_cb(GtkWidget * menu_item, GList * info_list)
 {
     while (info_list) {
-        balsa_mime_widget_ctx_menu_save(menu_item,
+       balsa_mime_widget_ctx_menu_save(menu_item,
                                         BALSA_PART_INFO(info_list->data)->body);
         info_list = info_list->next;
     }
 }
 
-
 /*
  * Let the user select a folder and save all message parts form info_list in
  * this folder, either with their name (if defined) or as localised "content-
@@ -1835,8 +1686,7 @@ part_context_save_all_cb(GtkWidget *menu_item,
  * Sets balsa_app::save_dir to the selected folder.
  */
 static void
-part_context_dump_all_cb(GtkWidget *menu_item,
-                         GList     *info_list)
+part_context_dump_all_cb(GtkWidget * menu_item, GList * info_list)
 {
     GtkWidget *dump_dialog;
 
@@ -1847,7 +1697,7 @@ part_context_dump_all_cb(GtkWidget *menu_item,
                                     balsa_get_parent_window(menu_item),
                                     GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                    _("_OK"), GTK_RESPONSE_OK,
+                                    _("_OK"),     GTK_RESPONSE_OK,
                                     NULL);
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(dump_dialog, balsa_get_parent_window(menu_item));
@@ -1856,89 +1706,85 @@ part_context_dump_all_cb(GtkWidget *menu_item,
                                     GTK_RESPONSE_CANCEL);
     gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dump_dialog),
                                     libbalsa_vfs_local_only());
-    if (balsa_app.save_dir) {
+    if (balsa_app.save_dir)
         gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(dump_dialog),
                                                 balsa_app.save_dir);
-    }
 
     if (gtk_dialog_run(GTK_DIALOG(dump_dialog)) == GTK_RESPONSE_OK) {
-        gchar *dir_name =
+       gchar *dir_name =
             gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dump_dialog));
-        LibbalsaVfs *dir_uri;
+        LibbalsaVfs * dir_uri;
 
         g_message("store to URI: %s", dir_name);
-        if (!(dir_uri = libbalsa_vfs_new_from_uri(dir_name))) {
+        if (!(dir_uri = libbalsa_vfs_new_from_uri(dir_name)))
             balsa_information(LIBBALSA_INFORMATION_ERROR,
                               _("Could not create URI for %s"),
                               dir_name);
-        }
 
-        /* remember the folder */
-        g_free(balsa_app.save_dir);
-        balsa_app.save_dir = dir_name;
+       /* remember the folder */
+       g_free(balsa_app.save_dir);
+       balsa_app.save_dir = dir_name;
 
-        /* save all parts without further user interaction */
-        info_list = g_list_first(info_list);
-        while (dir_uri && info_list) {
-            BalsaPartInfo *info = BALSA_PART_INFO(info_list->data);
-            LibbalsaVfs *save_uri;
-            gboolean result;
+       /* save all parts without further user interaction */
+       info_list = g_list_first(info_list);
+       while (dir_uri && info_list) {
+           BalsaPartInfo *info = BALSA_PART_INFO(info_list->data);
+            LibbalsaVfs * save_uri;
+           gboolean result;
             GError *err = NULL;
 
-            if (info->body->filename) {
-                save_uri =
-                    libbalsa_vfs_dir_append(dir_uri, info->body->filename);
-            } else {
-                gchar *cont_type =
-                    libbalsa_message_body_get_mime_type(info->body);
-                gchar *p;
-
-                /* be sure to have no '/' in the file name */
-                g_strdelimit(cont_type, G_DIR_SEPARATOR_S, '-');
-                p = g_strdup_printf(_("%s message part"), cont_type);
-                g_free(cont_type);
-                save_uri = libbalsa_vfs_dir_append(dir_uri, p);
-                g_free(p);
-            }
+           if (info->body->filename)
+               save_uri =
+                   libbalsa_vfs_dir_append(dir_uri, info->body->filename);
+           else {
+               gchar *cont_type =
+                   libbalsa_message_body_get_mime_type(info->body);
+               gchar *p;
+
+               /* be sure to have no '/' in the file name */
+               g_strdelimit(cont_type, G_DIR_SEPARATOR_S, '-');
+               p = g_strdup_printf(_("%s message part"), cont_type);
+               g_free(cont_type);
+               save_uri = libbalsa_vfs_dir_append(dir_uri, p);
+               g_free(p);
+           }
             g_message("store to file: %s", libbalsa_vfs_get_uri_utf8(save_uri));
 
-            /* don't overwrite existing files, append (1), (2), ... instead */
-            if (libbalsa_vfs_file_exists(save_uri)) {
-                gint n = 1;
-                LibbalsaVfs *base_uri = save_uri;
+           /* don't overwrite existing files, append (1), (2), ... instead */
+           if (libbalsa_vfs_file_exists(save_uri)) {
+               gint n = 1;
+               LibbalsaVfs * base_uri = save_uri;
 
-                save_uri = NULL;
-                do {
-                    gchar *ext = g_strdup_printf(" (%d)", n++);
-                    if (save_uri) {
+               save_uri = NULL;
+               do {
+                    gchar * ext = g_strdup_printf(" (%d)", n++);
+                   if (save_uri)
                         g_object_unref(save_uri);
-                    }
                     save_uri = libbalsa_vfs_append(base_uri, ext);
                     g_free(ext);
-                } while (libbalsa_vfs_file_exists(save_uri));
-                g_object_unref(base_uri);
-            }
+               } while (libbalsa_vfs_file_exists(save_uri));
+               g_object_unref(base_uri);
+           }
             g_message("store to file: %s", libbalsa_vfs_get_uri_utf8(save_uri));
 
-            /* try to save the file */
+           /* try to save the file */
             result =
                 libbalsa_message_body_save_vfs(info->body, save_uri,
                                                LIBBALSA_MESSAGE_BODY_UNSAFE,
                                                info->body->body_type ==
                                                LIBBALSA_MESSAGE_BODY_TYPE_TEXT,
                                                &err);
-            if (!result) {
-                balsa_information(LIBBALSA_INFORMATION_ERROR,
-                                  _("Could not save %s: %s"),
-                                  libbalsa_vfs_get_uri_utf8(save_uri),
+           if (!result)
+               balsa_information(LIBBALSA_INFORMATION_ERROR,
+                                 _("Could not save %s: %s"),
+                                 libbalsa_vfs_get_uri_utf8(save_uri),
                                   err && err->message ?
                                   err->message : "Unknown error");
-            }
             g_clear_error(&err);
-            g_object_unref(save_uri);
-            info_list = info_list->next;
-        }
-        g_object_unref(dir_uri);
+           g_object_unref(save_uri);
+           info_list = info_list->next;
+       }
+       g_object_unref(dir_uri);
     }
     gtk_widget_destroy(dump_dialog);
 }
@@ -1950,10 +1796,8 @@ typedef struct _selFirst_T {
 } selFirst_T;
 
 static void
-tree_selection_get_first(GtkTreeModel *model,
-                         GtkTreePath  *path,
-                         GtkTreeIter  *iter,
-                         gpointer      data)
+tree_selection_get_first(GtkTreeModel * model, GtkTreePath * path,
+                         GtkTreeIter * iter, gpointer data)
 {
     selFirst_T *sel = (selFirst_T *)data;
 
@@ -1963,9 +1807,8 @@ tree_selection_get_first(GtkTreeModel *model,
     }
 }
 
-
 static BalsaPartInfo *
-bm_next_part_info(BalsaMessage *bmessage)
+bm_next_part_info(BalsaMessage * bmessage)
 {
     selFirst_T sel;
     GtkTreeView *gtv;
@@ -1983,9 +1826,8 @@ bm_next_part_info(BalsaMessage *bmessage)
                                         tree_selection_get_first, &sel);
     if (!sel.found) {
         /* return the first part if nothing is selected */
-        if (!gtk_tree_model_get_iter_first(model, &sel.sel_iter)) {
+        if (!gtk_tree_model_get_iter_first(model, &sel.sel_iter))
             return NULL;
-        }
     } else {
         GtkTreeIter iter;
 
@@ -1997,10 +1839,9 @@ bm_next_part_info(BalsaMessage *bmessage)
 
             tmp_iter = iter = sel.sel_iter;
             while (!gtk_tree_model_iter_next (model, &iter)) {
-                if (!gtk_tree_model_iter_parent(model, &iter, &tmp_iter)) {
+                if (!gtk_tree_model_iter_parent(model, &iter, &tmp_iter))
                     return NULL;
-                }
-                tmp_iter = iter;
+               tmp_iter = iter;
             }
         }
         sel.sel_iter = iter;
@@ -2009,16 +1850,14 @@ bm_next_part_info(BalsaMessage *bmessage)
     return tree_next_valid_part_info(model, &sel.sel_iter);
 }
 
-
 void
-balsa_message_next_part(BalsaMessage *bmessage)
+balsa_message_next_part(BalsaMessage * bmessage)
 {
     BalsaPartInfo *info;
     GtkTreeView *gtv;
 
-    if (!(info = bm_next_part_info(bmessage))) {
-        return;
-    }
+    if (!(info = bm_next_part_info(bmessage)))
+       return;
 
     gtv = GTK_TREE_VIEW(bmessage->treeview);
     gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(gtv));
@@ -2026,9 +1865,8 @@ balsa_message_next_part(BalsaMessage *bmessage)
     g_object_unref(info);
 }
 
-
 gboolean
-balsa_message_has_next_part(BalsaMessage *bmessage)
+balsa_message_has_next_part(BalsaMessage * bmessage)
 {
     BalsaPartInfo *info;
 
@@ -2041,9 +1879,8 @@ balsa_message_has_next_part(BalsaMessage *bmessage)
     return FALSE;
 }
 
-
 static BalsaPartInfo *
-bm_previous_part_info(BalsaMessage *bmessage)
+bm_previous_part_info(BalsaMessage * bmessage)
 {
     selFirst_T sel;
     GtkTreeView *gtv;
@@ -2062,12 +1899,11 @@ bm_previous_part_info(BalsaMessage *bmessage)
                                         tree_selection_get_first, &sel);
     if (!sel.found) {
         /* return the first part if nothing is selected */
-        if (!gtk_tree_model_get_iter_first(model, &sel.sel_iter)) {
+        if (!gtk_tree_model_get_iter_first(model, &sel.sel_iter))
             return NULL;
-        }
         gtk_tree_model_get(model, &sel.sel_iter, PART_INFO_COLUMN, &info, -1);
     } else {
-        GtkTreePath *path = gtk_tree_model_get_path(model, &sel.sel_iter);
+        GtkTreePath * path = gtk_tree_model_get_path(model, &sel.sel_iter);
 
         /* find the previous element with a valid info block */
         do {
@@ -2088,16 +1924,14 @@ bm_previous_part_info(BalsaMessage *bmessage)
     return info;
 }
 
-
 void
-balsa_message_previous_part(BalsaMessage *bmessage)
+balsa_message_previous_part(BalsaMessage * bmessage)
 {
     BalsaPartInfo *info;
     GtkTreeView *gtv;
 
-    if (!(info = bm_previous_part_info(bmessage))) {
-        return;
-    }
+    if (!(info = bm_previous_part_info(bmessage)))
+       return;
 
     gtv = GTK_TREE_VIEW(bmessage->treeview);
     gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(gtv));
@@ -2105,9 +1939,8 @@ balsa_message_previous_part(BalsaMessage *bmessage)
     g_object_unref(info);
 }
 
-
 gboolean
-balsa_message_has_previous_part(BalsaMessage *bmessage)
+balsa_message_has_previous_part(BalsaMessage * bmessage)
 {
     BalsaPartInfo *info;
 
@@ -2120,7 +1953,6 @@ balsa_message_has_previous_part(BalsaMessage *bmessage)
     return FALSE;
 }
 
-
 #ifdef HAVE_HTML_WIDGET
 static gboolean
 libbalsa_can_display(LibBalsaMessageBody *part)
@@ -2128,17 +1960,14 @@ libbalsa_can_display(LibBalsaMessageBody *part)
     gchar *content_type = libbalsa_message_body_get_mime_type(part);
     gboolean res = FALSE;
     if (!balsa_app.display_alt_plain &&
-        libbalsa_html_type(content_type)) {
-        res = TRUE;
-    } else if ((g_ascii_strcasecmp(content_type, "multipart/related") == 0) &&
-               part->parts) {
-        res = libbalsa_can_display(part->parts);
-    }
+       libbalsa_html_type(content_type))
+       res = TRUE;
+    else if(g_ascii_strcasecmp(content_type, "multipart/related") == 0 &&
+           part->parts)
+       res = libbalsa_can_display(part->parts);
     g_free(content_type);
     return res;
 }
-
-
 #endif                          /* HAVE_HTML_WIDGET */
 
 /** Determines whether given part can be displayed. We display plain
@@ -2153,8 +1982,8 @@ libbalsa_can_display(LibBalsaMessageBody *part)
        image/jpeg "C"
 
    In the case as above, B & C should be displayed.
- */
-static LibBalsaMessageBody *
+*/
+static LibBalsaMessageBody*
 preferred_part(LibBalsaMessageBody *parts)
 {
     LibBalsaMessageBody *body, *preferred = parts;
@@ -2164,14 +1993,12 @@ preferred_part(LibBalsaMessageBody *parts)
 
         content_type = libbalsa_message_body_get_mime_type(body);
 
-        if ((g_ascii_strcasecmp(content_type, "text/plain") == 0) ||
-            (g_ascii_strcasecmp(content_type, "text/calendar") == 0)) {
+        if (g_ascii_strcasecmp(content_type, "text/plain") == 0 ||
+            g_ascii_strcasecmp(content_type, "text/calendar") == 0)
             preferred = body;
-        }
 #ifdef HAVE_HTML_WIDGET
-        else if (libbalsa_can_display(body)) {
+        else if (libbalsa_can_display(body))
             preferred = body;
-        }
 #endif                          /* HAVE_HTML_WIDGET */
 
         g_free(content_type);
@@ -2180,17 +2007,14 @@ preferred_part(LibBalsaMessageBody *parts)
     return preferred;
 }
 
-
 typedef struct _treeSearchT {
     const LibBalsaMessageBody *body;
     BalsaPartInfo *info;
 } treeSearchT;
 
 static gboolean
-treeSearch_Func(GtkTreeModel *model,
-                GtkTreePath  *path,
-                GtkTreeIter  *iter,
-                gpointer      data)
+treeSearch_Func(GtkTreeModel * model, GtkTreePath *path,
+                GtkTreeIter * iter, gpointer data)
 {
     treeSearchT *search = (treeSearchT *)data;
     BalsaPartInfo *info = NULL;
@@ -2200,18 +2024,15 @@ treeSearch_Func(GtkTreeModel *model,
         if (info->body == search->body) {
             search->info = info;
             return TRUE;
-        } else {
+        } else
             g_object_unref(info);
-        }
     }
 
     return FALSE;
 }
 
-
 static BalsaPartInfo *
-part_info_from_body(BalsaMessage              *bm,
-                    const LibBalsaMessageBody *body)
+part_info_from_body(BalsaMessage *bm, const LibBalsaMessageBody *body)
 {
     treeSearchT search;
 
@@ -2220,78 +2041,69 @@ part_info_from_body(BalsaMessage              *bm,
 
     gtk_tree_model_foreach
         (gtk_tree_view_get_model(GTK_TREE_VIEW(bm->treeview)),
-        treeSearch_Func, &search);
+         treeSearch_Func, &search);
     return search.info;
 }
 
 
 static LibBalsaMessageBody *
-add_body(BalsaMessage        *bm,
-         LibBalsaMessageBody *body,
-         GtkWidget           *container)
+add_body(BalsaMessage * bm, LibBalsaMessageBody * body,
+         GtkWidget * container)
 {
-    if (body) {
+    if(body) {
         BalsaPartInfo *info = part_info_from_body(bm, body);
 
         if (info) {
-            body = add_part(bm, info, container);
+           body = add_part(bm, info, container);
             g_object_unref(info);
-        } else {
-            body = add_multipart(bm, body, container);
-        }
+        } else
+           body = add_multipart(bm, body, container);
     }
 
     return body;
 }
 
-
 static LibBalsaMessageBody *
-add_multipart_digest(BalsaMessage        *bm,
-                     LibBalsaMessageBody *body,
-                     GtkWidget           *container)
+add_multipart_digest(BalsaMessage * bm, LibBalsaMessageBody * body,
+                     GtkWidget * container)
 {
     LibBalsaMessageBody *retval = NULL;
     /* Add all parts */
     retval = add_body(bm, body, container);
-    for (body = body->next; body; body = body->next) {
+    for (body = body->next; body; body = body->next)
         add_body(bm, body, container);
-    }
 
     return retval;
 }
 
-
 static LibBalsaMessageBody *
-add_multipart_mixed(BalsaMessage        *bm,
-                    LibBalsaMessageBody *body,
-                    GtkWidget           *container)
+add_multipart_mixed(BalsaMessage * bm, LibBalsaMessageBody * body,
+                    GtkWidget * container)
 {
-    LibBalsaMessageBody *retval = NULL;
+    LibBalsaMessageBody * retval = NULL;
     /* Add first (main) part + anything else with
        Content-Disposition: inline */
     if (body) {
         retval = add_body(bm, body, container);
         for (body = body->next; body; body = body->next) {
 #ifdef HAVE_GPGME
-            GMimeContentType *type =
-                g_mime_content_type_new_from_string(body->content_type);
+           GMimeContentType *type =
+               g_mime_content_type_new_from_string(body->content_type);
 
             if (libbalsa_message_body_is_inline(body) ||
-                bm->force_inline ||
+               bm->force_inline ||
                 libbalsa_message_body_is_multipart(body) ||
-                g_mime_content_type_is_type(type, "application", "pgp-signature") ||
-                (balsa_app.has_smime &&
-                 (g_mime_content_type_is_type(type, "application", "pkcs7-signature") ||
-                  g_mime_content_type_is_type(type, "application", "x-pkcs7-signature")))) {
+               g_mime_content_type_is_type(type, "application", "pgp-signature") ||
+               (balsa_app.has_smime &&
+                (g_mime_content_type_is_type(type, "application", "pkcs7-signature") ||
+                 g_mime_content_type_is_type(type, "application", "x-pkcs7-signature"))))
                 add_body(bm, body, container);
-            }
-            g_object_unref(type);
+           g_object_unref(type);
 #else
             if (libbalsa_message_body_is_inline(body) ||
-                bm->force_inline ||
-                libbalsa_message_body_is_multipart(body)) {
+               bm->force_inline ||
+               libbalsa_message_body_is_multipart(body))
                 add_body(bm, body, container);
-            }
 #endif
         }
     }
@@ -2299,64 +2111,55 @@ add_multipart_mixed(BalsaMessage        *bm,
     return retval;
 }
 
-
 static LibBalsaMessageBody *
-add_multipart(BalsaMessage        *bm,
-              LibBalsaMessageBody *body,
-              GtkWidget           *container)
+add_multipart(BalsaMessage *bm, LibBalsaMessageBody *body,
+              GtkWidget * container)
 /* This function handles multiparts as specified by RFC2046 5.1 and
  * message/rfc822 types. */
 {
     GMimeContentType *type;
 
-    if (!body->parts) {
-        return body;
-    }
+    if (!body->parts)
+       return body;
 
-    type = g_mime_content_type_new_from_string(body->content_type);
+    type=g_mime_content_type_new_from_string(body->content_type);
 
     if (g_mime_content_type_is_type(type, "multipart", "related")) {
         /* FIXME: more processing required see RFC1872 */
         /* Add the first part */
         body = add_body(bm, body->parts, container);
     } else if (g_mime_content_type_is_type(type, "multipart", "alternative")) {
-        /* Add the most suitable part. */
+            /* Add the most suitable part. */
         body = add_body(bm, preferred_part(body->parts), container);
     } else if (g_mime_content_type_is_type(type, "multipart", "digest")) {
-        body = add_multipart_digest(bm, body->parts, container);
+       body = add_multipart_digest(bm, body->parts, container);
     } else { /* default to multipart/mixed */
-        body = add_multipart_mixed(bm, body->parts, container);
+       body = add_multipart_mixed(bm, body->parts, container);
     }
     g_object_unref(type);
 
     return body;
 }
 
-
 static LibBalsaMessageBody *
-add_part(BalsaMessage  *bm,
-         BalsaPartInfo *info,
-         GtkWidget     *container)
+add_part(BalsaMessage * bm, BalsaPartInfo * info, GtkWidget * container)
 {
     GtkTreeSelection *selection;
     GtkWidget *widget;
     LibBalsaMessageBody *body;
     GtkWidget *bm_container;
 
-    if (!info) {
-        return NULL;
-    }
+    if (!info)
+       return NULL;
 
     selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(bm->treeview));
 
     if (info->path &&
-        !gtk_tree_selection_path_is_selected(selection, info->path)) {
-        gtk_tree_selection_select_path(selection, info->path);
-    }
+       !gtk_tree_selection_path_is_selected(selection, info->path))
+       gtk_tree_selection_select_path(selection, info->path);
 
-    if (info->mime_widget == NULL) {
-        part_info_init(bm, info);
-    }
+    if (info->mime_widget == NULL)
+       part_info_init(bm, info);
 
     if ((widget = balsa_mime_widget_get_widget(info->mime_widget)) != NULL) {
         gtk_widget_set_vexpand(widget, TRUE);
@@ -2372,10 +2175,8 @@ add_part(BalsaMessage  *bm,
 
 
 static gboolean
-gtk_tree_hide_func(GtkTreeModel *model,
-                   GtkTreePath  *path,
-                   GtkTreeIter  *iter,
-                   gpointer      data)
+gtk_tree_hide_func(GtkTreeModel * model, GtkTreePath * path,
+                   GtkTreeIter * iter, gpointer data)
 {
     BalsaPartInfo *info;
 
@@ -2383,9 +2184,9 @@ gtk_tree_hide_func(GtkTreeModel *model,
     if (info) {
         GtkWidget *widget, *parent;
 
-        if ((info->mime_widget != NULL)
-            && ((widget = balsa_mime_widget_get_widget(info->mime_widget)) != NULL)
-            && ((parent = gtk_widget_get_parent(widget)) != NULL)) {
+        if (info->mime_widget != NULL
+            && (widget = balsa_mime_widget_get_widget(info->mime_widget)) != NULL
+            && (parent = gtk_widget_get_parent(widget)) != NULL) {
             gtk_container_remove(GTK_CONTAINER(parent), widget);
         }
         g_object_unref(info);
@@ -2394,32 +2195,29 @@ gtk_tree_hide_func(GtkTreeModel *model,
     return FALSE;
 }
 
-
 static void
-hide_all_parts(BalsaMessage *bm)
+hide_all_parts(BalsaMessage * bm)
 {
     if (bm->current_part) {
-        gtk_tree_model_foreach(gtk_tree_view_get_model
-                                   (GTK_TREE_VIEW(bm->treeview)),
-                               gtk_tree_hide_func, bm);
-        gtk_tree_selection_unselect_all(gtk_tree_view_get_selection
-                                            (GTK_TREE_VIEW(bm->treeview)));
+       gtk_tree_model_foreach(gtk_tree_view_get_model
+                              (GTK_TREE_VIEW(bm->treeview)),
+                              gtk_tree_hide_func, bm);
+       gtk_tree_selection_unselect_all(gtk_tree_view_get_selection
+                                       (GTK_TREE_VIEW(bm->treeview)));
         g_object_unref(bm->current_part);
-        bm->current_part = NULL;
+       bm->current_part = NULL;
     }
 
     gtk_container_foreach(GTK_CONTAINER(balsa_mime_widget_get_container(bm->bm_widget)),
                           (GtkCallback) gtk_widget_destroy, NULL);
 }
 
-
 /*
  * If part == -1 then change to no part
  * must release selection before hiding a text widget.
  */
 static void
-select_part(BalsaMessage  *bm,
-            BalsaPartInfo *info)
+select_part(BalsaMessage * bm, BalsaPartInfo *info)
 {
     LibBalsaMessageBody *body;
 
@@ -2435,34 +2233,30 @@ select_part(BalsaMessage  *bm,
         GtkAdjustment *hadj, *vadj;
 
         g_object_get(G_OBJECT(bm->scroll), "hadjustment", &hadj,
-                     "vadjustment", &vadj, NULL);
+                                           "vadjustment", &vadj, NULL);
         gtk_adjustment_set_value(hadj, 0);
         gtk_adjustment_set_value(vadj, 0);
     }
 }
 
-
 GtkWidget *
-balsa_message_current_part_widget(BalsaMessage *bmessage)
+balsa_message_current_part_widget(BalsaMessage * bmessage)
 {
     if (bmessage && bmessage->current_part &&
-        bmessage->current_part->mime_widget) {
-        return balsa_mime_widget_get_widget(bmessage->current_part->mime_widget);
-    } else {
-        return NULL;
-    }
+       bmessage->current_part->mime_widget)
+       return balsa_mime_widget_get_widget(bmessage->current_part->mime_widget);
+    else
+       return NULL;
 }
 
-
 GtkWindow *
-balsa_get_parent_window(GtkWidget *widget)
+balsa_get_parent_window(GtkWidget * widget)
 {
     if (widget) {
         GtkWidget *toplevel = gtk_widget_get_toplevel(widget);
 
-        if (gtk_widget_is_toplevel(toplevel) && GTK_IS_WINDOW(toplevel)) {
+        if (gtk_widget_is_toplevel(toplevel) && GTK_IS_WINDOW(toplevel))
             return GTK_WINDOW(toplevel);
-        }
     }
 
     return GTK_WINDOW(balsa_app.main_window);
@@ -2474,7 +2268,7 @@ balsa_get_parent_window(GtkWidget *widget)
  * supports selection/copying etc.
  */
 gboolean
-balsa_message_can_select(BalsaMessage *bmessage)
+balsa_message_can_select(BalsaMessage * bmessage)
 {
     GtkWidget *widget;
 
@@ -2491,14 +2285,13 @@ balsa_message_can_select(BalsaMessage *bmessage)
 
     return GTK_IS_EDITABLE(widget) || GTK_IS_TEXT_VIEW(widget)
 #ifdef    HAVE_HTML_WIDGET
-           || libbalsa_html_can_select(widget)
+        || libbalsa_html_can_select(widget)
 #endif /* HAVE_HTML_WIDGET */
-    ;
+        ;
 }
 
-
 gboolean
-balsa_message_grab_focus(BalsaMessage *bmessage)
+balsa_message_grab_focus(BalsaMessage * bmessage)
 {
     GtkWidget *widget;
 
@@ -2514,35 +2307,28 @@ balsa_message_grab_focus(BalsaMessage *bmessage)
     return TRUE;
 }
 
-
 static InternetAddress *
-bm_get_mailbox(InternetAddressList *list)
+bm_get_mailbox(InternetAddressList * list)
 {
     InternetAddress *ia;
 
-    if (!list) {
-        return NULL;
-    }
+    if (!list)
+       return NULL;
 
     ia = internet_address_list_get_address (list, 0);
-    if (!ia) {
-        return NULL;
-    }
+    if (!ia)
+       return NULL;
 
-    while (ia && INTERNET_ADDRESS_IS_GROUP (ia)) {
-        ia = internet_address_list_get_address (INTERNET_ADDRESS_GROUP (ia)->members, 0);
-    }
-    if (!ia) {
-        return NULL;
-    }
+    while (ia && INTERNET_ADDRESS_IS_GROUP (ia))
+       ia = internet_address_list_get_address (INTERNET_ADDRESS_GROUP (ia)->members, 0);
+    if (!ia)
+       return NULL;
 
     return ia;
 }
 
-
 static void
-handle_mdn_request(GtkWindow       *parent,
-                   LibBalsaMessage *message)
+handle_mdn_request(GtkWindow *parent, LibBalsaMessage *message)
 {
     gboolean suspicious;
     InternetAddressList *use_from;
@@ -2555,15 +2341,14 @@ handle_mdn_request(GtkWindow       *parent,
 
     /* Check if the dispnotify_to address is equal to the (in this order,
        if present) reply_to, from or sender address. */
-    if (message->headers->reply_to) {
+    if (message->headers->reply_to)
         use_from = message->headers->reply_to;
-    } else if (message->headers->from) {
+    else if (message->headers->from)
         use_from = message->headers->from;
-    } else if (message->sender) {
+    else if (message->sender)
         use_from = message->sender;
-    } else {
+    else
         use_from = NULL;
-    }
     /* note: neither Disposition-Notification-To: nor Reply-To:, From: or
        Sender: may be address groups */
     from = use_from ? internet_address_list_get_address (use_from, 0) : NULL;
@@ -2574,49 +2359,44 @@ handle_mdn_request(GtkWindow       *parent,
     list = message->headers->to_list;
     len = list ? internet_address_list_length(list) : 0;
     for (i = 0; i < len && !mdn_ident; i++) {
-        GList *id_list;
+        GList * id_list;
 
         for (id_list = balsa_app.identities; !mdn_ident && id_list;
              id_list = id_list->next) {
             LibBalsaIdentity *ident = LIBBALSA_IDENTITY(id_list->data);
 
-            if (libbalsa_ia_rfc2821_equal(ident->ia, bm_get_mailbox(list))) {
+            if (libbalsa_ia_rfc2821_equal(ident->ia, bm_get_mailbox(list)))
                 mdn_ident = ident;
-            }
         }
     }
 
     list = message->headers->cc_list;
     for (i = 0; i < len && !mdn_ident; i++) {
-        GList *id_list;
+        GList * id_list;
 
         for (id_list = balsa_app.identities; !mdn_ident && id_list;
              id_list = id_list->next) {
             LibBalsaIdentity *ident = LIBBALSA_IDENTITY(id_list->data);
 
-            if (libbalsa_ia_rfc2821_equal(ident->ia, bm_get_mailbox(list))) {
+            if (libbalsa_ia_rfc2821_equal(ident->ia, bm_get_mailbox(list)))
                 mdn_ident = ident;
-            }
         }
     }
 
 
     /* Now we decide from the settings of balsa_app.mdn_reply_[not]clean what
        to do...
-     */
-    if (suspicious || !mdn_ident) {
+    */
+    if (suspicious || !mdn_ident)
         action = balsa_app.mdn_reply_notclean;
-    } else {
+    else
         action = balsa_app.mdn_reply_clean;
-    }
-    if (action == BALSA_MDN_REPLY_NEVER) {
+    if (action == BALSA_MDN_REPLY_NEVER)
         return;
-    }
 
     /* fall back to the current identity if the requested one is empty */
-    if (!mdn_ident) {
+    if (!mdn_ident)
         mdn_ident = balsa_app.current_ident;
-    }
 
     /* We *may* send a reply, so let's create a message for that... */
     mdn = create_mdn_reply (mdn_ident, message, action == BALSA_MDN_REPLY_ASKME);
@@ -2628,36 +2408,33 @@ handle_mdn_request(GtkWindow       *parent,
         sender = from ? internet_address_to_string (from, FALSE) : NULL;
         reply_to =
             internet_address_list_to_string (message->headers->dispnotify_to,
-                                             FALSE);
+                                            FALSE);
         gtk_widget_show (create_mdn_dialog (parent, sender, reply_to, mdn,
-                                            mdn_ident));
+                                                mdn_ident));
         g_free (reply_to);
         g_free (sender);
     } else {
-        GError *error = NULL;
-        LibBalsaMsgCreateResult result;
+       GError * error = NULL;
+       LibBalsaMsgCreateResult result;
 
         result = libbalsa_message_send(mdn, balsa_app.outbox, NULL,
-                                       balsa_find_sentbox_by_url,
-                                       mdn_ident->smtp_server,
-                                       balsa_app.send_progress_dialog,
+                                      balsa_find_sentbox_by_url,
+                                      mdn_ident->smtp_server,
+                                          balsa_app.send_progress_dialog,
                                        parent,
-                                       TRUE, &error);
-        if (result != LIBBALSA_MESSAGE_CREATE_OK) {
-            libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _("Sending the disposition notification failed: %s"),
-                                 error ? error->message : "?");
-        }
-        g_error_free(error);
+                                      TRUE, &error);
+       if (result != LIBBALSA_MESSAGE_CREATE_OK)
+           libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                                _("Sending the disposition notification failed: %s"),
+                                error ? error->message : "?");
+       g_error_free(error);
         g_object_unref(G_OBJECT(mdn));
     }
 }
 
-
-static LibBalsaMessage *
-create_mdn_reply(const LibBalsaIdentity *mdn_ident,
-                 LibBalsaMessage        *for_msg,
-                 gboolean                manual)
+static LibBalsaMessage *create_mdn_reply (const LibBalsaIdentity *mdn_ident,
+                                          LibBalsaMessage *for_msg,
+                                          gboolean manual)
 {
     LibBalsaMessage *message;
     LibBalsaMessageBody *body;
@@ -2691,15 +2468,14 @@ create_mdn_reply(const LibBalsaIdentity *mdn_ident,
     date = libbalsa_message_date_to_utf8(for_msg, balsa_app.date_string);
     dummy = internet_address_list_to_string(for_msg->headers->to_list, FALSE);
     body->buffer = g_strdup_printf(
-            "The message sent on %s to %s with subject “%s” has been displayed.\n"
-            "There is no guarantee that the message has been read or understood.\n\n",
-            date, dummy, LIBBALSA_MESSAGE_GET_SUBJECT(for_msg));
+        "The message sent on %s to %s with subject “%s” has been displayed.\n"
+        "There is no guarantee that the message has been read or understood.\n\n",
+        date, dummy, LIBBALSA_MESSAGE_GET_SUBJECT(for_msg));
     g_free (date);
     g_free (dummy);
     libbalsa_utf8_sanitize(&body->buffer, balsa_app.convert_unknown_8bit, NULL);
-    if (balsa_app.wordwrap) {
+    if (balsa_app.wordwrap)
         libbalsa_wrap_string(body->buffer, balsa_app.wraplength);
-    }
     dummy = (gchar *)g_mime_charset_best(body->buffer, strlen(body->buffer));
     body->charset = g_strdup(dummy ? dummy : "us-ascii");
     libbalsa_message_append_part(message, body);
@@ -2710,25 +2486,23 @@ create_mdn_reply(const LibBalsaIdentity *mdn_ident,
     report = g_string_new("");
     uname(&uts_name);
     g_string_printf(report, "Reporting-UA: %s; " PACKAGE " " VERSION "\n",
-                    uts_name.nodename);
+                   uts_name.nodename);
     /* see rfc 3798, sections 2.3 and 3.2.3 */
     if ((original_rcpt =
-             libbalsa_message_get_user_header(for_msg, "original-recipient"))) {
-        g_string_append_printf(report, "Original-Recipient: %s\n",
-                               original_rcpt);
-    }
+        libbalsa_message_get_user_header(for_msg, "original-recipient")))
+       g_string_append_printf(report, "Original-Recipient: %s\n",
+                              original_rcpt);
     g_string_append_printf(report, "Final-Recipient: rfc822; %s\n",
                            INTERNET_ADDRESS_MAILBOX(balsa_app.
                                                     current_ident->ia)->
                            addr);
-    if (for_msg->message_id) {
+    if (for_msg->message_id)
         g_string_append_printf(report, "Original-Message-ID: <%s>\n",
                                for_msg->message_id);
-    }
     g_string_append_printf(report,
-                           "Disposition: %s-action/MDN-sent-%sly; displayed",
-                           manual ? "manual" : "automatic",
-                           manual ? "manual" : "automatical");
+                          "Disposition: %s-action/MDN-sent-%sly; displayed",
+                          manual ? "manual" : "automatic",
+                          manual ? "manual" : "automatical");
     body->buffer = report->str;
     g_string_free(report, FALSE);
     body->content_type = g_strdup("message/disposition-notification");
@@ -2737,13 +2511,9 @@ create_mdn_reply(const LibBalsaIdentity *mdn_ident,
     return message;
 }
 
-
 static GtkWidget *
-create_mdn_dialog(GtkWindow        *parent,
-                  gchar            *sender,
-                  gchar            *mdn_to_address,
-                  LibBalsaMessage  *send_msg,
-                  LibBalsaIdentity *mdn_ident)
+create_mdn_dialog(GtkWindow *parent, gchar * sender, gchar * mdn_to_address,
+                  LibBalsaMessage * send_msg, LibBalsaIdentity *mdn_ident)
 {
     GtkWidget *mdn_dialog;
 
@@ -2772,18 +2542,15 @@ create_mdn_dialog(GtkWindow        *parent,
     return mdn_dialog;
 }
 
-
 static void
-mdn_dialog_response(GtkWidget *dialog,
-                    gint       response,
-                    gpointer   user_data)
+mdn_dialog_response(GtkWidget * dialog, gint response, gpointer user_data)
 {
     LibBalsaMessage *send_msg =
         LIBBALSA_MESSAGE(g_object_get_data(G_OBJECT(dialog),
                                            "balsa-send-msg"));
     LibBalsaIdentity *mdn_ident =
         LIBBALSA_IDENTITY(g_object_get_data(G_OBJECT(dialog), "mdn-ident"));
-    GError *error = NULL;
+    GError * error = NULL;
     LibBalsaMsgCreateResult result;
 
     g_return_if_fail(send_msg != NULL);
@@ -2794,62 +2561,53 @@ mdn_dialog_response(GtkWidget *dialog,
             libbalsa_message_send(send_msg, balsa_app.outbox, NULL,
                                   balsa_find_sentbox_by_url,
                                   mdn_ident->smtp_server,
-                                  balsa_app.send_progress_dialog,
+                                                                 balsa_app.send_progress_dialog,
                                   gtk_window_get_transient_for
-                                      ((GtkWindow *) dialog),
+                                  ((GtkWindow *) dialog),
                                   TRUE, &error);
-        if (result != LIBBALSA_MESSAGE_CREATE_OK) {
+        if (result != LIBBALSA_MESSAGE_CREATE_OK)
             libbalsa_information(LIBBALSA_INFORMATION_ERROR,
                                  _("Sending the disposition notification failed: %s"),
                                  error ? error->message : "?");
-        }
-        if (error) {
+        if (error)
             g_error_free(error);
-        }
     }
     g_object_unref(G_OBJECT(send_msg));
     g_object_unref(G_OBJECT(mdn_ident));
     gtk_widget_destroy(dialog);
 }
 
-
 #ifdef HAVE_HTML_WIDGET
 /* Does the current part support zoom? */
 gboolean
-balsa_message_can_zoom(BalsaMessage *bm)
+balsa_message_can_zoom(BalsaMessage * bm)
 {
     return bm->current_part
-           && libbalsa_html_can_zoom(bm->current_part->mime_widget->widget);
+        && libbalsa_html_can_zoom(bm->current_part->mime_widget->widget);
 }
 
-
 /* Zoom an html item. */
 void
-balsa_message_zoom(BalsaMessage *bm,
-                   gint          in_out)
+balsa_message_zoom(BalsaMessage * bm, gint in_out)
 {
     gint zoom;
 
-    if (!balsa_message_can_zoom(bm)) {
+    if (!balsa_message_can_zoom(bm))
         return;
-    }
 
     zoom =
-        GPOINTER_TO_INT(g_object_get_data
-                            (G_OBJECT(bm->message), BALSA_MESSAGE_ZOOM_KEY));
-    if (in_out) {
-        zoom += in_out;
-    } else {
-        zoom = 0;
-    }
-    g_object_set_data(G_OBJECT(bm->message), BALSA_MESSAGE_ZOOM_KEY,
-                      GINT_TO_POINTER(zoom));
+       GPOINTER_TO_INT(g_object_get_data
+                       (G_OBJECT(bm->message), BALSA_MESSAGE_ZOOM_KEY));
+     if (in_out)
+       zoom += in_out;
+     else
+       zoom = 0;
+     g_object_set_data(G_OBJECT(bm->message), BALSA_MESSAGE_ZOOM_KEY,
+                     GINT_TO_POINTER(zoom));
 
-    libbalsa_html_zoom(bm->current_part->mime_widget->widget, in_out);
+     libbalsa_html_zoom(bm->current_part->mime_widget->widget, in_out);
 
 }
-
-
 #endif /* HAVE_HTML_WIDGET */
 
 
@@ -2865,32 +2623,30 @@ balsa_message_zoom(BalsaMessage *bm,
  */
 static LibBalsaMsgProtectState
 balsa_message_scan_signatures(LibBalsaMessageBody *body,
-                              LibBalsaMessage     *message)
+                              LibBalsaMessage * message)
 {
     LibBalsaMsgProtectState result = LIBBALSA_MSG_PROTECT_NONE;
 
     g_return_val_if_fail(message->headers != NULL, result);
 
     while (body) {
-        LibBalsaMsgProtectState this_part_state =
-            libbalsa_message_body_protect_state(body);
+       LibBalsaMsgProtectState this_part_state =
+           libbalsa_message_body_protect_state(body);
 
-        /* remember: greater means worse... */
-        if (this_part_state > result) {
-            result = this_part_state;
-        }
+       /* remember: greater means worse... */
+       if (this_part_state > result)
+           result = this_part_state;
 
         /* scan embedded messages */
         if (body->parts) {
             LibBalsaMsgProtectState sub_result =
                 balsa_message_scan_signatures(body->parts, message);
 
-            if (sub_result >= result) {
+            if (sub_result >= result)
                 result = sub_result;
-            }
         }
 
-        body = body->next;
+       body = body->next;
     }
 
     return result;
@@ -2903,48 +2659,41 @@ balsa_message_scan_signatures(LibBalsaMessageBody *body,
  * replace *icon-title by the signature status.
  */
 static GdkPixbuf *
-get_crypto_content_icon(LibBalsaMessageBody *body,
-                        const gchar         *content_type,
-                        gchar              **icon_title)
+get_crypto_content_icon(LibBalsaMessageBody * body, const gchar * content_type,
+                       gchar ** icon_title)
 {
     GdkPixbuf *icon;
-    gchar *new_title;
-    const gchar *icon_name;
+    gchar * new_title;
+    const gchar * icon_name;
 
     if ((libbalsa_message_body_protection(body) &
          (LIBBALSA_PROTECT_ENCRYPT | LIBBALSA_PROTECT_ERROR)) ==
-        LIBBALSA_PROTECT_ENCRYPT) {
+        LIBBALSA_PROTECT_ENCRYPT)
         return NULL;
-    }
 
-    icon_name =
-        balsa_mime_widget_signature_icon_name(libbalsa_message_body_protect_state(body));
-    if (!icon_name) {
+    icon_name = balsa_mime_widget_signature_icon_name(libbalsa_message_body_protect_state(body));
+    if (!icon_name)
         return NULL;
-    }
     icon =
         gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), icon_name, 24, 0, NULL);
-    if (!icon_title) {
+    if (!icon_title)
         return icon;
-    }
 
     if (*icon_title &&
-        g_ascii_strcasecmp(content_type, "application/pgp-signature") &&
-        g_ascii_strcasecmp(content_type, "application/pkcs7-signature") &&
-        g_ascii_strcasecmp(content_type, "application/x-pkcs7-signature")) {
-        new_title = g_strconcat(*icon_title, "; ",
-                                g_mime_gpgme_sigstat_protocol_name(body->sig_info),
-                                libbalsa_gpgme_sig_stat_to_gchar(body->sig_info->status),
-                                NULL);
-    } else {
-        new_title = g_strconcat(g_mime_gpgme_sigstat_protocol_name(body->sig_info),
-                                libbalsa_gpgme_sig_stat_to_gchar(body->sig_info->status),
-                                NULL);
-    }
-
-    if (*icon_title) {
-        g_free(*icon_title);
-    }
+       g_ascii_strcasecmp(content_type, "application/pgp-signature") &&
+       g_ascii_strcasecmp(content_type, "application/pkcs7-signature") &&
+       g_ascii_strcasecmp(content_type, "application/x-pkcs7-signature"))
+       new_title = g_strconcat(*icon_title, "; ",
+               g_mime_gpgme_sigstat_protocol_name(body->sig_info),
+                               libbalsa_gpgme_sig_stat_to_gchar(body->sig_info->status),
+                               NULL);
+    else
+       new_title = g_strconcat(g_mime_gpgme_sigstat_protocol_name(body->sig_info),
+                               libbalsa_gpgme_sig_stat_to_gchar(body->sig_info->status),
+                               NULL);
+
+    if (*icon_title)
+       g_free(*icon_title);
     *icon_title = new_title;
 
     return icon;
@@ -2958,8 +2707,8 @@ typedef struct {
     LibBalsaChkCryptoMode chk_mode;      /* current check mode */
     gboolean no_mp_signed;               /* don't check multipart/signed */
     guint max_ref;                       /* maximum allowed ref count */
-    gchar *sender;                       /* shortcut to sender */
-    gchar *subject;                      /* shortcut to subject */
+    gchar * sender;                      /* shortcut to sender */
+    gchar * subject;                     /* shortcut to subject */
 } chk_crypto_t;
 
 
@@ -2969,12 +2718,11 @@ typedef struct {
  * chain.
  */
 static LibBalsaMessageBody *
-libbalsa_msg_try_decrypt(LibBalsaMessage     *message,
-                         LibBalsaMessageBody *body,
-                         chk_crypto_t        *chk_crypto)
+libbalsa_msg_try_decrypt(LibBalsaMessage * message, LibBalsaMessageBody * body,
+                        chk_crypto_t * chk_crypto)
 {
-    gchar *mime_type;
-    LibBalsaMessageBody *this_body;
+    gchar * mime_type;
+    LibBalsaMessageBody * this_body;
 
     /* Check for multipart/encrypted or application/pkcs7-mime parts and
        replace this_body by it's decrypted content. Remember that there may be
@@ -2982,97 +2730,93 @@ libbalsa_msg_try_decrypt(LibBalsaMessage     *message,
     this_body = body;
     mime_type = libbalsa_message_body_get_mime_type(this_body);
     while (!g_ascii_strcasecmp(mime_type, "multipart/encrypted") ||
-           !g_ascii_strcasecmp(mime_type, "application/pkcs7-mime") ||
-           !g_ascii_strcasecmp(mime_type, "application/x-pkcs7-mime")) {
-        gint encrres;
-
-        /* FIXME: not checking for body_ref > 1 (or > 2 when re-checking, which
-         * adds an extra ref) leads to a crash if we have both the encrypted and
-         * the unencrypted version open as the body chain of the first one will be
-         * unref'd. */
-        if (message->body_ref > chk_crypto->max_ref) {
-            if (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS) {
-                libbalsa_information
-                    (LIBBALSA_INFORMATION_ERROR,
-                    _("The decryption cannot be performed because this message "
-                      "is displayed more than once.\n"
-                      "Please close the other instances of this message and try "
-                      "again."));
-                /* downgrade the check mode to avoid multiple errors popping up */
-                chk_crypto->chk_mode = LB_MAILBOX_CHK_CRYPT_MAYBE;
-            }
-            return body;
-        }
-
-        /* check if the gmime part is present and force loading it if we are
-           in "always" mode */
-        if (!this_body->mime_part) {
+          !g_ascii_strcasecmp(mime_type, "application/pkcs7-mime") ||
+          !g_ascii_strcasecmp(mime_type, "application/x-pkcs7-mime")) {
+       gint encrres;
+
+       /* FIXME: not checking for body_ref > 1 (or > 2 when re-checking, which
+        * adds an extra ref) leads to a crash if we have both the encrypted and
+        * the unencrypted version open as the body chain of the first one will be
+        * unref'd. */
+       if (message->body_ref > chk_crypto->max_ref) {
+           if (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS) {
+               libbalsa_information
+                   (LIBBALSA_INFORMATION_ERROR,
+                    _("The decryption cannot be performed because this message "
+                      "is displayed more than once.\n"
+                      "Please close the other instances of this message and try "
+                      "again."));
+               /* downgrade the check mode to avoid multiple errors popping up */
+               chk_crypto->chk_mode = LB_MAILBOX_CHK_CRYPT_MAYBE;
+           }
+           return body;
+       }
+
+       /* check if the gmime part is present and force loading it if we are
+          in "always" mode */
+       if (!this_body->mime_part) {
             GError *err = NULL;
-            if (chk_crypto->chk_mode != LB_MAILBOX_CHK_CRYPT_ALWAYS) {
-                return this_body;
-            }
-
-            /* force loading the missing part */
-            if (!libbalsa_mailbox_get_message_part(message, this_body, &err)) {
-                libbalsa_information
-                    (LIBBALSA_INFORMATION_ERROR,
-                    _("Parsing a message part failed: %s"),
-                    err ? err->message : _("Possible disk space problem."));
+           if (chk_crypto->chk_mode != LB_MAILBOX_CHK_CRYPT_ALWAYS)
+               return this_body;
+
+           /* force loading the missing part */
+           if(!libbalsa_mailbox_get_message_part(message, this_body, &err)) {
+               libbalsa_information
+                   (LIBBALSA_INFORMATION_ERROR,
+                     _("Parsing a message part failed: %s"),
+                     err ? err->message : _("Possible disk space problem."));
                 g_clear_error(&err);
                 /* There is nothing more we can do... */
                 return body;
             }
-        }
-
-        encrres = libbalsa_message_body_protection(this_body);
-
-        if (encrres & LIBBALSA_PROTECT_ENCRYPT) {
-            if (encrres & LIBBALSA_PROTECT_ERROR) {
-                libbalsa_information
-                    (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS ?
-                    LIBBALSA_INFORMATION_ERROR : LIBBALSA_INFORMATION_MESSAGE,
-                    _("The message sent by %s with subject “%s” contains "
-                      "an encrypted part, but its structure is invalid."),
-                    chk_crypto->sender, chk_crypto->subject);
+       }
+
+       encrres = libbalsa_message_body_protection(this_body);
+
+       if (encrres & LIBBALSA_PROTECT_ENCRYPT) {
+           if (encrres & LIBBALSA_PROTECT_ERROR) {
+               libbalsa_information
+                   (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS ?
+                    LIBBALSA_INFORMATION_ERROR : LIBBALSA_INFORMATION_MESSAGE,
+                     _("The message sent by %s with subject “%s” contains "
+                       "an encrypted part, but its structure is invalid."),
+                    chk_crypto->sender, chk_crypto->subject);
             } else if (encrres & LIBBALSA_PROTECT_RFC3156) {
-                if (!balsa_app.has_openpgp) {
+                if (!balsa_app.has_openpgp)
                     libbalsa_information
                         (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS ?
-                        LIBBALSA_INFORMATION_WARNING : LIBBALSA_INFORMATION_MESSAGE,
-                        _("The message sent by %s with subject “%s” "
-                          "contains a PGP encrypted part, but this "
-                          "crypto protocol is not available."),
-                        chk_crypto->sender, chk_crypto->subject);
-                } else {
+                        LIBBALSA_INFORMATION_WARNING : LIBBALSA_INFORMATION_MESSAGE,
+                         _("The message sent by %s with subject “%s” "
+                           "contains a PGP encrypted part, but this "
+                           "crypto protocol is not available."),
+                         chk_crypto->sender, chk_crypto->subject);
+                else
                     this_body =
                         libbalsa_body_decrypt(this_body,
                                               GPGME_PROTOCOL_OpenPGP, NULL);
-                }
             } else if (encrres & LIBBALSA_PROTECT_SMIMEV3) {
-                if (!balsa_app.has_smime) {
+                if (!balsa_app.has_smime)
                     libbalsa_information
                         (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS ?
-                        LIBBALSA_INFORMATION_WARNING : LIBBALSA_INFORMATION_MESSAGE,
-                        _("The message sent by %s with subject “%s” "
-                          "contains a S/MIME encrypted part, but this "
-                          "crypto protocol is not available."),
-                        chk_crypto->sender, chk_crypto->subject);
-                } else {
+                        LIBBALSA_INFORMATION_WARNING : LIBBALSA_INFORMATION_MESSAGE,
+                         _("The message sent by %s with subject “%s” "
+                           "contains a S/MIME encrypted part, but this "
+                           "crypto protocol is not available."),
+                         chk_crypto->sender, chk_crypto->subject);
+                else
                     this_body =
                         libbalsa_body_decrypt(this_body, GPGME_PROTOCOL_CMS,
-                                              NULL);
-                }
+                                             NULL);
             }
         }
 
-        /* has been decrypted? - eject if not, otherwise... */
-        if (!this_body->was_encrypted) {
-            return this_body;
-        }
+       /* has been decrypted? - eject if not, otherwise... */
+       if (!this_body->was_encrypted)
+           return this_body;
 
-        /* ...check decrypted content again... */
-        g_free(mime_type);
-        mime_type = libbalsa_message_body_get_mime_type(this_body);
+       /* ...check decrypted content again... */
+       g_free(mime_type);
+       mime_type = libbalsa_message_body_get_mime_type(this_body);
     }
     g_free(mime_type);
 
@@ -3083,32 +2827,29 @@ libbalsa_msg_try_decrypt(LibBalsaMessage     *message,
 /*
  * Treatment of a multipart/signed body with protocol protocol.
  */
-#   define BALSA_MESSAGE_SIGNED_NOTIFIED "balsa-message-signed-notified"
+#define BALSA_MESSAGE_SIGNED_NOTIFIED "balsa-message-signed-notified"
 static void
-libbalsa_msg_try_mp_signed(LibBalsaMessage     *message,
-                           LibBalsaMessageBody *body,
-                           chk_crypto_t        *chk_crypto)
+libbalsa_msg_try_mp_signed(LibBalsaMessage * message, LibBalsaMessageBody *body,
+                          chk_crypto_t * chk_crypto)
 {
     gint signres;
 
-    if (chk_crypto->no_mp_signed) {
-        return;
-    }
+    if (chk_crypto->no_mp_signed)
+       return;
 
     /* check if the gmime part is present and force loading it if we are in
        "always" mode */
     if (!body->mime_part) {
         GError *err = NULL;
-        if (chk_crypto->chk_mode != LB_MAILBOX_CHK_CRYPT_ALWAYS) {
-            return;
-        }
+       if (chk_crypto->chk_mode != LB_MAILBOX_CHK_CRYPT_ALWAYS)
+           return;
 
-        /* force loading the missing part */
-        if (!libbalsa_mailbox_get_message_part(message, body, &err)) {
+       /* force loading the missing part */
+        if(!libbalsa_mailbox_get_message_part(message, body, &err)) {
             libbalsa_information
                 (LIBBALSA_INFORMATION_ERROR,
-                _("Parsing a message part failed: %s"),
-                err ? err->message : _("Possible disk space problem."));
+                 _("Parsing a message part failed: %s"),
+                 err ? err->message : _("Possible disk space problem."));
             g_clear_error(&err);
             /* There is nothing more we can do... */
             return;
@@ -3117,92 +2858,84 @@ libbalsa_msg_try_mp_signed(LibBalsaMessage     *message,
 
     /* check which type of protection we've got */
     signres = libbalsa_message_body_protection(body);
-    if (!(signres & LIBBALSA_PROTECT_SIGN)) {
-        return;
-    }
+    if (!(signres & LIBBALSA_PROTECT_SIGN))
+       return;
 
     /* eject if the structure is broken */
     if (signres & LIBBALSA_PROTECT_ERROR) {
-        libbalsa_information
-            (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS ?
-            LIBBALSA_INFORMATION_ERROR : LIBBALSA_INFORMATION_MESSAGE,
-            _("The message sent by %s with subject “%s” contains a signed "
-              "part, but its structure is invalid. The signature, if there "
-              "is any, cannot be checked."),
-            chk_crypto->sender, chk_crypto->subject);
-        return;
+       libbalsa_information
+           (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS ?
+            LIBBALSA_INFORMATION_ERROR : LIBBALSA_INFORMATION_MESSAGE,
+            _("The message sent by %s with subject “%s” contains a signed "
+              "part, but its structure is invalid. The signature, if there "
+              "is any, cannot be checked."),
+            chk_crypto->sender, chk_crypto->subject);
+       return;
     }
 
     /* check for an unsupported protocol */
     if (((signres & LIBBALSA_PROTECT_RFC3156) && !balsa_app.has_openpgp) ||
-        ((signres & LIBBALSA_PROTECT_SMIMEV3) && !balsa_app.has_smime)) {
-        libbalsa_information
-            (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS ?
-            LIBBALSA_INFORMATION_WARNING : LIBBALSA_INFORMATION_MESSAGE,
-            _("The message sent by %s with subject “%s” contains a %s "
-              "signed part, but this crypto protocol is not available."),
-            chk_crypto->sender, chk_crypto->subject,
-            signres & LIBBALSA_PROTECT_RFC3156 ? _("PGP") : _("S/MIME"));
-        return;
+       ((signres & LIBBALSA_PROTECT_SMIMEV3) && !balsa_app.has_smime)) {
+       libbalsa_information
+           (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS ?
+            LIBBALSA_INFORMATION_WARNING : LIBBALSA_INFORMATION_MESSAGE,
+            _("The message sent by %s with subject “%s” contains a %s "
+              "signed part, but this crypto protocol is not available."),
+            chk_crypto->sender, chk_crypto->subject,
+            signres & LIBBALSA_PROTECT_RFC3156 ? _("PGP") : _("S/MIME"));
+       return;
     }
 
     /* force creating the protection info */
     g_clear_object(&body->parts->next->sig_info);
     if (!libbalsa_body_check_signature(body,
-                                       signres & LIBBALSA_PROTECT_RFC3156 ?
-                                       GPGME_PROTOCOL_OpenPGP : GPGME_PROTOCOL_CMS)) {
-        return;
-    }
+                                      signres & LIBBALSA_PROTECT_RFC3156 ?
+                                      GPGME_PROTOCOL_OpenPGP : GPGME_PROTOCOL_CMS))
+       return;
 
     /* evaluate the result */
-    if (g_object_get_data(G_OBJECT(message), BALSA_MESSAGE_SIGNED_NOTIFIED)) {
+    if (g_object_get_data(G_OBJECT(message), BALSA_MESSAGE_SIGNED_NOTIFIED))
         return;
-    }
     g_object_set_data(G_OBJECT(message), BALSA_MESSAGE_SIGNED_NOTIFIED,
                       GUINT_TO_POINTER(TRUE));
 
     if (body->parts->next->sig_info) {
-        switch (libbalsa_message_body_protect_state(body->parts->next)) {
-        case LIBBALSA_MSG_PROTECT_SIGN_GOOD:
-            libbalsa_information(LIBBALSA_INFORMATION_DEBUG,
-                                 _("Detected a good signature"));
-            break;
-
-        case LIBBALSA_MSG_PROTECT_SIGN_NOTRUST:
-            if (body->parts->next->sig_info->protocol == GPGME_PROTOCOL_CMS) {
-                libbalsa_information
-                    (LIBBALSA_INFORMATION_MESSAGE,
-                    _("Detected a good signature with insufficient "
-                      "validity"));
-            } else {
-                libbalsa_information
-                    (LIBBALSA_INFORMATION_MESSAGE,
-                    _("Detected a good signature with insufficient "
-                      "validity/trust"));
-            }
-            break;
-
-        case LIBBALSA_MSG_PROTECT_SIGN_BAD:
+       switch (libbalsa_message_body_protect_state(body->parts->next)) {
+       case LIBBALSA_MSG_PROTECT_SIGN_GOOD:
+           libbalsa_information(LIBBALSA_INFORMATION_DEBUG,
+                                _("Detected a good signature"));
+           break;
+       case LIBBALSA_MSG_PROTECT_SIGN_NOTRUST:
+           if (body->parts->next->sig_info->protocol == GPGME_PROTOCOL_CMS)
+               libbalsa_information
+                   (LIBBALSA_INFORMATION_MESSAGE,
+                    _("Detected a good signature with insufficient "
+                      "validity"));
+           else
+               libbalsa_information
+                   (LIBBALSA_INFORMATION_MESSAGE,
+                    _("Detected a good signature with insufficient "
+                      "validity/trust"));
+           break;
+       case LIBBALSA_MSG_PROTECT_SIGN_BAD:
             libbalsa_information
-                (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS ?
-                LIBBALSA_INFORMATION_ERROR : LIBBALSA_INFORMATION_MESSAGE,
-                _("Checking the signature of the message sent by %s with "
-                  "subject “%s” returned:\n%s"),
-                chk_crypto->sender, chk_crypto->subject,
-                libbalsa_gpgme_sig_stat_to_gchar(body->parts->next->sig_info->status));
-            break;
-
-        default:
-            break;
+               (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS ?
+                LIBBALSA_INFORMATION_ERROR : LIBBALSA_INFORMATION_MESSAGE,
+                _("Checking the signature of the message sent by %s with "
+                  "subject “%s” returned:\n%s"),
+                chk_crypto->sender, chk_crypto->subject,
+                libbalsa_gpgme_sig_stat_to_gchar(body->parts->next->sig_info->status));
+           break;
+       default:
+           break;
         }
-    } else {
-        libbalsa_information
-            (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS ?
-            LIBBALSA_INFORMATION_ERROR : LIBBALSA_INFORMATION_MESSAGE,
-            _("Checking the signature of the message sent by %s with subject "
-              "“%s” failed with an error!"),
-            chk_crypto->sender, chk_crypto->subject);
-    }
+    } else
+       libbalsa_information
+           (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS ?
+            LIBBALSA_INFORMATION_ERROR : LIBBALSA_INFORMATION_MESSAGE,
+            _("Checking the signature of the message sent by %s with subject "
+              "“%s” failed with an error!"),
+            chk_crypto->sender, chk_crypto->subject);
 }
 
 
@@ -3211,43 +2944,39 @@ libbalsa_msg_try_mp_signed(LibBalsaMessage     *message,
  * verify it.
  */
 static void
-libbalsa_msg_part_2440(LibBalsaMessage     *message,
-                       LibBalsaMessageBody *body,
-                       chk_crypto_t        *chk_crypto)
+libbalsa_msg_part_2440(LibBalsaMessage * message, LibBalsaMessageBody * body,
+                      chk_crypto_t * chk_crypto)
 {
     gpgme_error_t sig_res;
     GMimePartRfc2440Mode rfc2440mode;
 
     /* multiparts or complete messages can not be RFC 2440 protected */
-    if ((body->body_type == LIBBALSA_MESSAGE_BODY_TYPE_MESSAGE) ||
-        (body->body_type == LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART)) {
-        return;
-    }
+    if (body->body_type == LIBBALSA_MESSAGE_BODY_TYPE_MESSAGE ||
+       body->body_type == LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART)
+       return;
 
     if (!body->mime_part) {
         GError *err = NULL;
-        /* if the user requested to always check everything or if the part is
-           text (and therefore likely to be displayed anyway) force loading
-           the missing part */
-        if ((chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_MAYBE) &&
-            (body->body_type != LIBBALSA_MESSAGE_BODY_TYPE_TEXT)) {
-            return;
-        }
-
-        if (!libbalsa_mailbox_get_message_part(message, body, &err)) {
+       /* if the user requested to always check everything or if the part is
+          text (and therefore likely to be displayed anyway) force loading
+          the missing part */
+       if (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_MAYBE &&
+           body->body_type != LIBBALSA_MESSAGE_BODY_TYPE_TEXT)
+           return;
+
+        if(!libbalsa_mailbox_get_message_part(message, body, &err)) {
             libbalsa_information
                 (LIBBALSA_INFORMATION_ERROR,
-                _("Parsing a message part failed: %s"),
-                err ? err->message : _("Possible disk space problem."));
+                 _("Parsing a message part failed: %s"),
+                 err ? err->message : _("Possible disk space problem."));
             g_clear_error(&err);
             return;
         }
     }
 
     /* check if this is a RFC2440 part */
-    if (!GMIME_IS_PART(body->mime_part)) {
-        return;
-    }
+    if (!GMIME_IS_PART(body->mime_part))
+       return;
     libbalsa_mailbox_lock_store(body->message->mailbox);
     rfc2440mode = g_mime_part_check_rfc2440(GMIME_PART(body->mime_part));
     libbalsa_mailbox_unlock_store(body->message->mailbox);
@@ -3256,66 +2985,64 @@ libbalsa_msg_part_2440(LibBalsaMessage     *message,
        (see remark for libbalsa_msg_try_decrypt above) - remember that
        libbalsa_rfc2440_verify would also replace the stream by the "decrypted"
        (i.e. RFC2440 stuff removed) one! */
-    if (rfc2440mode == GMIME_PART_RFC2440_NONE) {
-        return;
-    }
+    if (rfc2440mode == GMIME_PART_RFC2440_NONE)
+       return;
     if (message->body_ref > chk_crypto->max_ref) {
-        if (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS) {
+       if (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS) {
             libbalsa_information
                 (LIBBALSA_INFORMATION_ERROR, "%s\n%s",
-                rfc2440mode == GMIME_PART_RFC2440_ENCRYPTED ?
-                _("The decryption cannot be performed because "
-                  "this message is displayed more than once.") :
-                _("The signature check and removal of the OpenPGP armor "
-                  "cannot be performed because "
-                  "this message is displayed more than once."),
-                _("Please close the other instances of this message "
-                  "and try again."));
-            /* downgrade the check mode to avoid multiple errors popping up */
-            chk_crypto->chk_mode = LB_MAILBOX_CHK_CRYPT_MAYBE;
-        }
+                rfc2440mode == GMIME_PART_RFC2440_ENCRYPTED ?
+                 _("The decryption cannot be performed because "
+                  "this message is displayed more than once.") :
+                 _("The signature check and removal of the OpenPGP armor "
+                  "cannot be performed because "
+                  "this message is displayed more than once."),
+                 _("Please close the other instances of this message "
+                  "and try again."));
+           /* downgrade the check mode to avoid multiple errors popping up */
+           chk_crypto->chk_mode = LB_MAILBOX_CHK_CRYPT_MAYBE;
+       }
         return;
     }
 
     /* do the rfc2440 stuff */
     libbalsa_mailbox_lock_store(body->message->mailbox);
-    if (rfc2440mode == GMIME_PART_RFC2440_SIGNED) {
+    if (rfc2440mode == GMIME_PART_RFC2440_SIGNED)
         sig_res =
             libbalsa_rfc2440_verify(GMIME_PART(body->mime_part),
-                                    &body->sig_info);
-    } else {
+                                   &body->sig_info);
+    else {
         sig_res =
             libbalsa_rfc2440_decrypt(GMIME_PART(body->mime_part),
-                                     &body->sig_info,
-                                     NULL);
-        body->was_encrypted = (body->sig_info || sig_res == GPG_ERR_NO_ERROR);
-        if (sig_res == GPG_ERR_NO_ERROR) {
-            /* decrypting may change the charset, so be sure to use the one
-               GMimePart reports */
-            g_free(body->charset);
-            body->charset = NULL;
-        }
+                                    &body->sig_info,
+                                    NULL);
+       body->was_encrypted = (body->sig_info || sig_res == GPG_ERR_NO_ERROR);
+       if (sig_res == GPG_ERR_NO_ERROR) {
+           /* decrypting may change the charset, so be sure to use the one
+              GMimePart reports */
+           g_free(body->charset);
+           body->charset = NULL;
+       }
     }
     libbalsa_mailbox_unlock_store(body->message->mailbox);
 
-    if (body->sig_info && (sig_res == GPG_ERR_NO_ERROR)) {
+    if (body->sig_info && sig_res == GPG_ERR_NO_ERROR) {
         if ((body->sig_info->summary & GPGME_SIGSUM_VALID) == GPGME_SIGSUM_VALID) {
-            g_debug("%s: detected a good signature", __func__);
+               g_debug("%s: detected a good signature", __func__);
         } else {
             libbalsa_information
-                (LIBBALSA_INFORMATION_MESSAGE,
-                _("Detected a good signature with insufficient "
-                  "validity/trust"));
+               (LIBBALSA_INFORMATION_MESSAGE,
+                _("Detected a good signature with insufficient "
+                  "validity/trust"));
         }
-    } else if ((sig_res != GPG_ERR_NO_ERROR) && (sig_res != GPG_ERR_CANCELED)) {
-        libbalsa_information
-            (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS ?
-            LIBBALSA_INFORMATION_ERROR : LIBBALSA_INFORMATION_MESSAGE,
-            _("Checking the signature of the message sent by %s with "
-              "subject “%s” returned:\n%s"),
-            chk_crypto->sender, chk_crypto->subject,
-            libbalsa_gpgme_sig_stat_to_gchar(sig_res));
-    }
+    } else if (sig_res != GPG_ERR_NO_ERROR && sig_res != GPG_ERR_CANCELED)
+       libbalsa_information
+           (chk_crypto->chk_mode == LB_MAILBOX_CHK_CRYPT_ALWAYS ?
+            LIBBALSA_INFORMATION_ERROR : LIBBALSA_INFORMATION_MESSAGE,
+            _("Checking the signature of the message sent by %s with "
+              "subject “%s” returned:\n%s"),
+            chk_crypto->sender, chk_crypto->subject,
+            libbalsa_gpgme_sig_stat_to_gchar(sig_res));
 }
 
 
@@ -3324,12 +3051,12 @@ libbalsa_msg_part_2440(LibBalsaMessage     *message,
  * signed parts. The function is called recursively for nested stuff.
  */
 static LibBalsaMessageBody *
-libbalsa_msg_perform_crypto_real(LibBalsaMessage     *message,
-                                 LibBalsaMessageBody *body,
-                                 chk_crypto_t        *chk_crypto)
+libbalsa_msg_perform_crypto_real(LibBalsaMessage * message,
+                                LibBalsaMessageBody * body,
+                                chk_crypto_t * chk_crypto)
 {
-    gchar *mime_type;
-    LibBalsaMessageBody *chk_body;
+    gchar * mime_type;
+    LibBalsaMessageBody * chk_body;
 
     /* First try do decrypt RFC 3156 multipart/encrypted or any RFC 2633
        application/pkcs7-mime stuff. */
@@ -3337,9 +3064,8 @@ libbalsa_msg_perform_crypto_real(LibBalsaMessage     *message,
 
     /* Check for multipart/signed and check the signature. */
     mime_type = libbalsa_message_body_get_mime_type(body);
-    if (!g_ascii_strcasecmp(mime_type, "multipart/signed")) {
-        libbalsa_msg_try_mp_signed(message, body, chk_crypto);
-    }
+    if (!g_ascii_strcasecmp(mime_type, "multipart/signed"))
+       libbalsa_msg_try_mp_signed(message, body, chk_crypto);
     g_free(mime_type);
 
     /* loop over the parts, checking for RFC 2440 stuff, but ignore
@@ -3347,24 +3073,22 @@ libbalsa_msg_perform_crypto_real(LibBalsaMessage     *message,
        as well as all detached signatures */
     chk_body = body;
     while (chk_body) {
-        mime_type = libbalsa_message_body_get_mime_type(chk_body);
+       mime_type = libbalsa_message_body_get_mime_type(chk_body);
 
-        if (g_ascii_strcasecmp(mime_type, "application/octet-stream") &&
-            g_ascii_strcasecmp(mime_type, "application/pkcs7-signature") &&
-            g_ascii_strcasecmp(mime_type, "application/x-pkcs7-signature") &&
-            g_ascii_strcasecmp(mime_type, "application/pgp-signature")) {
-            libbalsa_msg_part_2440(message, chk_body, chk_crypto);
-        }
-        g_free(mime_type);
+       if (g_ascii_strcasecmp(mime_type, "application/octet-stream") &&
+           g_ascii_strcasecmp(mime_type, "application/pkcs7-signature") &&
+           g_ascii_strcasecmp(mime_type, "application/x-pkcs7-signature") &&
+           g_ascii_strcasecmp(mime_type, "application/pgp-signature"))
+           libbalsa_msg_part_2440(message, chk_body, chk_crypto);
+       g_free(mime_type);
 
-        /* check nested stuff */
-        if (chk_body->parts) {
-            chk_body->parts =
-                libbalsa_msg_perform_crypto_real(message, chk_body->parts,
-                                                 chk_crypto);
-        }
+       /* check nested stuff */
+       if (chk_body->parts)
+           chk_body->parts =
+               libbalsa_msg_perform_crypto_real(message, chk_body->parts,
+                                                chk_crypto);
 
-        chk_body = chk_body->next;
+       chk_body = chk_body->next;
     }
 
     return body;
@@ -3378,21 +3102,18 @@ libbalsa_msg_perform_crypto_real(LibBalsaMessage     *message,
  * useful e.g. for replying.
  */
 void
-balsa_message_perform_crypto(LibBalsaMessage      *message,
-                             LibBalsaChkCryptoMode chk_mode,
-                             gboolean              no_mp_signed,
-                             guint                 max_ref)
+balsa_message_perform_crypto(LibBalsaMessage * message,
+                            LibBalsaChkCryptoMode chk_mode,
+                            gboolean no_mp_signed, guint max_ref)
 {
     chk_crypto_t chk_crypto;
 
-    if (!message->body_list) {
-        return;
-    }
+    if (!message->body_list)
+       return;
 
     /* check if the user requested to ignore any crypto stuff */
-    if (chk_mode == LB_MAILBOX_CHK_CRYPT_NEVER) {
-        return;
-    }
+    if (chk_mode == LB_MAILBOX_CHK_CRYPT_NEVER)
+       return;
 
     /* set up... */
     chk_crypto.chk_mode = chk_mode;
@@ -3401,12 +3122,12 @@ balsa_message_perform_crypto(LibBalsaMessage      *message,
     chk_crypto.sender = balsa_message_sender_to_gchar(message->headers->from, -1);
     chk_crypto.subject = g_strdup(LIBBALSA_MESSAGE_GET_SUBJECT(message));
     libbalsa_utf8_sanitize(&chk_crypto.subject, balsa_app.convert_unknown_8bit,
-                           NULL);
+                          NULL);
 
     /* do the real work */
     message->body_list =
-        libbalsa_msg_perform_crypto_real(message, message->body_list,
-                                         &chk_crypto);
+       libbalsa_msg_perform_crypto_real(message, message->body_list,
+                                        &chk_crypto);
 
     /* clean up */
     g_free(chk_crypto.subject);
@@ -3421,13 +3142,12 @@ balsa_message_perform_crypto(LibBalsaMessage      *message,
  * the message.
  */
 static void
-message_recheck_crypto_cb(GtkWidget    *button,
-                          BalsaMessage *bm)
+message_recheck_crypto_cb(GtkWidget * button, BalsaMessage * bm)
 {
     LibBalsaMsgProtectState prot_state;
-    LibBalsaMessage *message;
+    LibBalsaMessage * message;
     GtkTreeIter iter;
-    BalsaPartInfo *info;
+    BalsaPartInfo * info;
     gboolean has_focus = bm->focus_state != BALSA_MESSAGE_FOCUS_STATE_NO;
 
     g_return_if_fail(bm != NULL);
@@ -3440,7 +3160,7 @@ message_recheck_crypto_cb(GtkWidget    *button,
 
     g_object_ref(G_OBJECT(message));
     if (!libbalsa_message_body_ref(message, TRUE, TRUE)) {
-        g_object_unref(G_OBJECT(message));
+       g_object_unref(G_OBJECT(message));
         return;
     }
 
@@ -3452,28 +3172,26 @@ message_recheck_crypto_cb(GtkWidget    *button,
         balsa_message_scan_signatures(message->body_list, message);
 
     /* update the icon if necessary */
-    if (message->prot_state != prot_state) {
+    if (message->prot_state != prot_state)
         message->prot_state = prot_state;
-    }
 
     /* may update the icon */
     libbalsa_mailbox_msgno_update_attach(bm->message->mailbox,
-                                         bm->message->msgno, bm->message);
+                                        bm->message->msgno, bm->message);
 
     display_headers(bm);
     display_content(bm);
 
-    if (bm->info_count > 1) {
+    if (bm->info_count > 1)
         gtk_widget_show(bm->switcher);
-    } else {
+    else
         gtk_widget_hide(bm->switcher);
-    }
     gtk_stack_set_visible_child_name(GTK_STACK(bm->stack), "content");
 
     if (!gtk_tree_model_get_iter_first (gtk_tree_view_get_model(GTK_TREE_VIEW(bm->treeview)),
                                         &iter)) {
-        libbalsa_message_body_unref(message);
-        g_object_unref(G_OBJECT(message));
+       libbalsa_message_body_unref(message);
+       g_object_unref(G_OBJECT(message));
         return;
     }
 
@@ -3481,20 +3199,17 @@ message_recheck_crypto_cb(GtkWidget    *button,
         tree_next_valid_part_info(gtk_tree_view_get_model(GTK_TREE_VIEW(bm->treeview)),
                                   &iter);
     select_part(bm, info);
-    if (info) {
+    if (info)
         g_object_unref(info);
-    }
 
     /* restore keyboard focus to the content, if it was there before */
-    if (has_focus) {
+    if (has_focus)
         balsa_message_grab_focus(bm);
-    }
 
     libbalsa_message_body_unref(message);
     g_object_unref(G_OBJECT(message));
 }
 
-
 #endif  /* HAVE_GPGME */
 
 /*
@@ -3502,12 +3217,12 @@ message_recheck_crypto_cb(GtkWidget    *button,
  */
 
 void
-balsa_message_find_in_message(BalsaMessage *bm)
+balsa_message_find_in_message(BalsaMessage * bm)
 {
     GtkWidget *widget;
 
-    if ((bm->current_part != NULL)
-        && ((widget = balsa_mime_widget_get_widget(bm->current_part->mime_widget)) != NULL)
+    if (bm->current_part != NULL
+        && (widget = balsa_mime_widget_get_widget(bm->current_part->mime_widget)) != NULL
         && (GTK_IS_TEXT_VIEW(widget)
 #ifdef HAVE_HTML_WIDGET
             || libbalsa_html_can_search(widget)
@@ -3529,8 +3244,7 @@ balsa_message_find_in_message(BalsaMessage *bm)
         bm_find_set_status(bm, BM_FIND_STATUS_INIT);
 
         gtk_widget_show(bm->find_bar);
-        if (gtk_widget_get_window(bm->find_entry)) {
+        if (gtk_widget_get_window(bm->find_entry))
             gtk_widget_grab_focus(bm->find_entry);
-        }
     }
 }
diff --git a/src/balsa-message.h b/src/balsa-message.h
index dd80cbe..20a9942 100644
--- a/src/balsa-message.h
+++ b/src/balsa-message.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -21,7 +21,7 @@
 #define __BALSA_MESSAGE_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include "libbalsa.h"
@@ -31,12 +31,8 @@ G_BEGIN_DECLS
 
 
 #define BALSA_TYPE_MESSAGE          (balsa_message_get_type ())
-#define BALSA_MESSAGE(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, \
-                                                                BALSA_TYPE_MESSAGE, \
-                                                                BalsaMessage)
-#define BALSA_MESSAGE_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, \
-                                                             BALSA_TYPE_MESSAGE, \
-                                                             BalsaMessageClass)
+#define BALSA_MESSAGE(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, BALSA_TYPE_MESSAGE, BalsaMessage)
+#define BALSA_MESSAGE_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, BALSA_TYPE_MESSAGE, BalsaMessageClass)
 #define BALSA_IS_MESSAGE(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, BALSA_TYPE_MESSAGE)
 
 
@@ -54,108 +50,101 @@ typedef enum {
 } BalsaMessageFocusState;
 
 struct _BalsaMessage {
-    GtkBox parent;
+        GtkBox parent;
 
-    GtkWidget *stack;
-    GtkWidget *switcher;
+        GtkWidget *stack;
+        GtkWidget *switcher;
 
-    /* Top-level MIME widget */
-    BalsaMimeWidget *bm_widget;
+        /* Top-level MIME widget */
+        BalsaMimeWidget *bm_widget;
 
-    /* header-related information */
-    ShownHeaders shown_headers;
+       /* header-related information */
+       ShownHeaders shown_headers;
 
-    /* Widgets to hold content */
-    GtkWidget *scroll;
+       /* Widgets to hold content */
+       GtkWidget *scroll;
 
-    /* Widget to hold structure tree */
-    GtkWidget *treeview;
-    gint info_count;
-    GList *save_all_list;
-    GtkWidget *save_all_popup;
+        /* Widget to hold structure tree */
+        GtkWidget *treeview;
+        gint info_count;
+        GList *save_all_list;
+        GtkWidget *save_all_popup;
+    
+       gboolean wrap_text;
 
-    gboolean wrap_text;
+        BalsaPartInfo *current_part;
+        GtkWidget *parts_popup;
+        gboolean force_inline;
 
-    BalsaPartInfo *current_part;
-    GtkWidget *parts_popup;
-    gboolean force_inline;
+       LibBalsaMessage *message;
 
-    LibBalsaMessage *message;
+        BalsaMessageFocusState focus_state;
 
-    BalsaMessageFocusState focus_state;
+        /* Find-in-message stuff */
+        GtkWidget  *find_bar;
+        GtkWidget  *find_entry;
+        GtkWidget  *find_next;
+        GtkWidget  *find_prev;
+        GtkWidget  *find_sep;
+        GtkWidget  *find_label;
+        GtkTextIter find_iter;
+        gboolean    find_forward;
 
-    /* Find-in-message stuff */
-    GtkWidget *find_bar;
-    GtkWidget *find_entry;
-    GtkWidget *find_next;
-    GtkWidget *find_prev;
-    GtkWidget *find_sep;
-    GtkWidget *find_label;
-    GtkTextIter find_iter;
-    gboolean find_forward;
+        /* Tab position for headers */
+        gint tab_position;
 
-    /* Tab position for headers */
-    gint tab_position;
-
-    /* Widget to hold Faces */
-    GtkWidget *face_box;
+        /* Widget to hold Faces */
+        GtkWidget *face_box;
 
 #ifdef HAVE_HTML_WIDGET
-    gpointer html_find_info;
-#endif                          /* HAVE_HTML_WIDGET */
+        gpointer html_find_info;
+#endif                         /* HAVE_HTML_WIDGET */
 };
 
 struct _BalsaMessageClass {
-    GtkNotebookClass parent_class;
+       GtkNotebookClass parent_class;
 
-    void (*select_part) (BalsaMessage *message);
+       void (*select_part) (BalsaMessage * message);
 };
 
 GType balsa_message_get_type(void);
 GtkWidget *balsa_message_new(void);
 
-gboolean balsa_message_set(BalsaMessage    *bmessage,
-                           LibBalsaMailbox *mailbox,
-                           guint            msgno);
-
-void balsa_message_next_part(BalsaMessage *bmessage);
-gboolean balsa_message_has_next_part(BalsaMessage *bmessage);
-void balsa_message_previous_part(BalsaMessage *bmessage);
-gboolean balsa_message_has_previous_part(BalsaMessage *bmessage);
-void balsa_message_save_current_part(BalsaMessage *bmessage);
-void balsa_message_copy_part(const gchar         *url,
-                             LibBalsaMessageBody *part);
-
-void balsa_message_set_displayed_headers(BalsaMessage *bmessage,
-                                         ShownHeaders  sh);
-void balsa_message_set_wrap(BalsaMessage *bmessage,
-                            gboolean      wrap);
-
-gboolean balsa_message_can_select(BalsaMessage *bmessage);
-gboolean balsa_message_grab_focus(BalsaMessage *bmessage);
-gchar *balsa_message_sender_to_gchar(InternetAddressList *list,
-                                     gint                 which);
-GtkWidget *balsa_message_current_part_widget(BalsaMessage *bmessage);
+gboolean balsa_message_set(BalsaMessage * bmessage,
+                          LibBalsaMailbox * mailbox, guint msgno);
+
+void balsa_message_next_part(BalsaMessage * bmessage);
+gboolean balsa_message_has_next_part(BalsaMessage * bmessage);
+void balsa_message_previous_part(BalsaMessage * bmessage);
+gboolean balsa_message_has_previous_part(BalsaMessage * bmessage);
+void balsa_message_save_current_part(BalsaMessage * bmessage);
+void balsa_message_copy_part(const gchar *url, LibBalsaMessageBody *part);
+
+void balsa_message_set_displayed_headers(BalsaMessage * bmessage,
+                                            ShownHeaders sh);
+void balsa_message_set_wrap(BalsaMessage * bmessage, gboolean wrap);
+
+gboolean balsa_message_can_select(BalsaMessage * bmessage);
+gboolean balsa_message_grab_focus(BalsaMessage * bmessage);
+gchar * balsa_message_sender_to_gchar(InternetAddressList * list, gint which);
+GtkWidget *balsa_message_current_part_widget(BalsaMessage * bmessage);
 GtkWindow *balsa_get_parent_window(GtkWidget *widget);
 
 #ifdef HAVE_HTML_WIDGET
-#   define BALSA_MESSAGE_ZOOM_KEY "balsa-message-zoom"
-gboolean balsa_message_can_zoom(BalsaMessage *bm);
-void balsa_message_zoom(BalsaMessage *bm,
-                        gint          in_out);
-
-#endif                          /* HAVE_HTML_WIDGET */
+#define BALSA_MESSAGE_ZOOM_KEY "balsa-message-zoom"
+gboolean balsa_message_can_zoom(BalsaMessage * bm);
+void balsa_message_zoom(BalsaMessage * bm, gint in_out);
+#endif                         /* HAVE_HTML_WIDGET */
 
 #ifdef HAVE_GPGME
-void balsa_message_perform_crypto(LibBalsaMessage      *message,
-                                  LibBalsaChkCryptoMode chk_mode,
-                                  gboolean              no_mp_signed,
-                                  guint                 max_ref);
-
+void balsa_message_perform_crypto(LibBalsaMessage * message,
+                                 LibBalsaChkCryptoMode chk_mode,
+                                 gboolean no_mp_signed,
+                                 guint max_ref);
 #endif
 
-void balsa_message_find_in_message(BalsaMessage *bm);
+void balsa_message_find_in_message (BalsaMessage * bm);
 
 G_END_DECLS
 
-#endif                          /* __BALSA_MESSAGE_H__ */
+#endif                         /* __BALSA_MESSAGE_H__ */
diff --git a/src/balsa-mime-widget-callbacks.c b/src/balsa-mime-widget-callbacks.c
index 6585a63..39d8ccd 100644
--- a/src/balsa-mime-widget-callbacks.c
+++ b/src/balsa-mime-widget-callbacks.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-mime-widget-callbacks.h"
 
@@ -32,13 +32,13 @@
 #include <gdk/gdkkeysyms.h>
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#  include "macosx-helpers.h"
 #endif
 
 
 void
-balsa_mime_widget_ctx_menu_cb(GtkWidget           *menu_item,
-                              LibBalsaMessageBody *mime_body)
+balsa_mime_widget_ctx_menu_cb(GtkWidget * menu_item,
+                             LibBalsaMessageBody * mime_body)
 {
     GError *err = NULL;
     gboolean result;
@@ -47,11 +47,10 @@ balsa_mime_widget_ctx_menu_cb(GtkWidget           *menu_item,
     result = libbalsa_vfs_launch_app_for_body(mime_body,
                                               G_OBJECT(menu_item),
                                               &err);
-    if (!result) {
+    if (!result)
         balsa_information(LIBBALSA_INFORMATION_WARNING,
                           _("Could not launch application: %s"),
                           err ? err->message : "Unknown error");
-    }
     g_clear_error(&err);
 }
 
@@ -62,10 +61,10 @@ balsa_mime_widget_ctx_menu_cb(GtkWidget           *menu_item,
     became a parent for the dialog box.
 
     @param mime_body message part to be saved.
- */
+*/
 void
-balsa_mime_widget_ctx_menu_save(GtkWidget           *parent_widget,
-                                LibBalsaMessageBody *mime_body)
+balsa_mime_widget_ctx_menu_save(GtkWidget * parent_widget,
+                               LibBalsaMessageBody * mime_body)
 {
     gchar *cont_type, *title;
     GtkWidget *save_dialog;
@@ -80,40 +79,39 @@ balsa_mime_widget_ctx_menu_save(GtkWidget           *parent_widget,
     title = g_strdup_printf(_("Save %s MIME Part"), cont_type);
 
     save_dialog =
-        gtk_file_chooser_dialog_new(title,
+       gtk_file_chooser_dialog_new(title,
                                     balsa_get_parent_window(parent_widget),
-                                    GTK_FILE_CHOOSER_ACTION_SAVE,
+                                   GTK_FILE_CHOOSER_ACTION_SAVE,
                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                    _("_OK"), GTK_RESPONSE_OK,
+                                    _("_OK"),     GTK_RESPONSE_OK,
                                     NULL);
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(save_dialog, balsa_get_parent_window(parent_widget));
 #endif
     gtk_dialog_set_default_response(GTK_DIALOG(save_dialog),
-                                    GTK_RESPONSE_OK);
+                                   GTK_RESPONSE_OK);
     g_free(title);
     g_free(cont_type);
 
     gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(save_dialog),
                                     libbalsa_vfs_local_only());
-    if (balsa_app.save_dir) {
+    if (balsa_app.save_dir)
         gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(save_dialog),
                                                 balsa_app.save_dir);
-    }
 
     if (mime_body->filename) {
-        gchar *filename = g_path_get_basename(mime_body->filename);
-        libbalsa_utf8_sanitize(&filename, balsa_app.convert_unknown_8bit,
-                               NULL);
-        gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(save_dialog),
-                                          filename);
-        g_free(filename);
+        gchar * filename = g_path_get_basename(mime_body->filename);
+       libbalsa_utf8_sanitize(&filename, balsa_app.convert_unknown_8bit,
+                              NULL);
+       gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(save_dialog),
+                                         filename);
+       g_free(filename);
     }
 
     gtk_window_set_modal(GTK_WINDOW(save_dialog), TRUE);
     if (gtk_dialog_run(GTK_DIALOG(save_dialog)) != GTK_RESPONSE_OK) {
-        gtk_widget_destroy(save_dialog);
-        return;
+       gtk_widget_destroy(save_dialog);
+       return;
     }
 
     /* get the file name */
@@ -124,7 +122,7 @@ balsa_mime_widget_ctx_menu_save(GtkWidget           *parent_widget,
                           _("Could not construct URI from %s"),
                           file_uri);
         g_free(file_uri);
-        return;
+       return;
     }
 
     /* remember the folder uri */
@@ -133,41 +131,38 @@ balsa_mime_widget_ctx_menu_save(GtkWidget           *parent_widget,
 
     /* get a confirmation to overwrite if the file exists */
     if (libbalsa_vfs_file_exists(save_file)) {
-        GtkWidget *confirm;
-
-        /* File exists. check if they really want to overwrite */
-        confirm = gtk_message_dialog_new(GTK_WINDOW(balsa_app.main_window),
-                                         GTK_DIALOG_MODAL,
-                                         GTK_MESSAGE_QUESTION,
-                                         GTK_BUTTONS_YES_NO,
-                                         _("File already exists. Overwrite?"));
+       GtkWidget *confirm;
+
+       /* File exists. check if they really want to overwrite */
+       confirm = gtk_message_dialog_new(GTK_WINDOW(balsa_app.main_window),
+                                        GTK_DIALOG_MODAL,
+                                        GTK_MESSAGE_QUESTION,
+                                        GTK_BUTTONS_YES_NO,
+                                        _("File already exists. Overwrite?"));
 #if HAVE_MACOSX_DESKTOP
-        libbalsa_macosx_menu_for_parent(confirm, GTK_WINDOW(balsa_app.main_window));
+       libbalsa_macosx_menu_for_parent(confirm, GTK_WINDOW(balsa_app.main_window));
 #endif
-        do_save =
-            (gtk_dialog_run(GTK_DIALOG(confirm)) == GTK_RESPONSE_YES);
-        gtk_widget_destroy(confirm);
-        if (do_save) {
-            if (libbalsa_vfs_file_unlink(save_file, &err) != 0) {
+       do_save =
+           (gtk_dialog_run(GTK_DIALOG(confirm)) == GTK_RESPONSE_YES);
+       gtk_widget_destroy(confirm);
+       if (do_save)
+           if (libbalsa_vfs_file_unlink(save_file, &err) != 0)
                 balsa_information(LIBBALSA_INFORMATION_ERROR,
                                   _("Unlink %s: %s"),
                                   file_uri, err ? err->message : "Unknown error");
-            }
-        }
-    } else {
-        do_save = TRUE;
-    }
+    } else
+       do_save = TRUE;
 
     /* save the file */
     if (do_save) {
-        if (!libbalsa_message_body_save_vfs(mime_body, save_file,
+       if (!libbalsa_message_body_save_vfs(mime_body, save_file,
                                             LIBBALSA_MESSAGE_BODY_UNSAFE,
-                                            (mime_body->body_type ==
-                                             LIBBALSA_MESSAGE_BODY_TYPE_TEXT),
+                                            mime_body->body_type ==
+                                            LIBBALSA_MESSAGE_BODY_TYPE_TEXT,
                                             &err)) {
-            balsa_information(LIBBALSA_INFORMATION_ERROR,
-                              _("Could not save %s: %s"),
-                              file_uri, err ? err->message : "Unknown error");
+           balsa_information(LIBBALSA_INFORMATION_ERROR,
+                             _("Could not save %s: %s"),
+                             file_uri, err ? err->message : "Unknown error");
             g_clear_error(&err);
         }
     }
@@ -176,23 +171,19 @@ balsa_mime_widget_ctx_menu_save(GtkWidget           *parent_widget,
     g_free(file_uri);
 }
 
-
 static void
-scroll_change(GtkAdjustment *adj,
-              gint           diff,
-              BalsaMessage  *bm)
+scroll_change(GtkAdjustment * adj, gint diff, BalsaMessage * bm)
 {
     gdouble upper =
         gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj);
     gdouble value;
 
-    if (bm && (gtk_adjustment_get_value(adj) >= upper) && (diff > 0)) {
-        if (balsa_window_next_unread(balsa_app.main_window)) {
+    if (bm && gtk_adjustment_get_value(adj) >= upper && diff > 0) {
+        if (balsa_window_next_unread(balsa_app.main_window))
             /* We're changing mailboxes, and GtkNotebook will grab the
              * focus, so we want to grab it back the next time we lose
              * it. */
             bm->focus_state = BALSA_MESSAGE_FOCUS_STATE_HOLD;
-        }
         return;
     }
 
@@ -202,11 +193,9 @@ scroll_change(GtkAdjustment *adj,
     gtk_adjustment_set_value(adj, MIN(value, upper));
 }
 
-
 gboolean
-balsa_mime_widget_key_press_event(GtkWidget    *widget,
-                                  GdkEvent     *event,
-                                  BalsaMessage *bm)
+balsa_mime_widget_key_press_event(GtkWidget * widget, GdkEvent * event,
+                                 BalsaMessage * bm)
 {
     GtkAdjustment *adj;
     int page_adjust;
@@ -219,7 +208,7 @@ balsa_mime_widget_key_press_event(GtkWidget    *widget,
     }
 
     adj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW
-                                                  (bm->scroll));
+                                              (bm->scroll));
 
     page_adjust = balsa_app.pgdownmod ?
         (gtk_adjustment_get_page_size(adj) * balsa_app.pgdown_percent) /
@@ -229,53 +218,42 @@ balsa_mime_widget_key_press_event(GtkWidget    *widget,
     case GDK_KEY_Up:
         scroll_change(adj, -gtk_adjustment_get_step_increment(adj), NULL);
         break;
-
     case GDK_KEY_Down:
         scroll_change(adj, gtk_adjustment_get_step_increment(adj), NULL);
         break;
-
     case GDK_KEY_Page_Up:
         scroll_change(adj, -page_adjust, NULL);
         break;
-
     case GDK_KEY_Page_Down:
         scroll_change(adj, page_adjust, NULL);
         break;
-
     case GDK_KEY_Home:
-        if (state & GDK_CONTROL_MASK) {
+        if (state & GDK_CONTROL_MASK)
             scroll_change(adj, -gtk_adjustment_get_value(adj), NULL);
-        } else {
+        else
             return FALSE;
-        }
         break;
-
     case GDK_KEY_End:
-        if (state & GDK_CONTROL_MASK) {
+        if (state & GDK_CONTROL_MASK)
             scroll_change(adj, gtk_adjustment_get_upper(adj), NULL);
-        } else {
+        else
             return FALSE;
-        }
         break;
-
     case GDK_KEY_F10:
         if (state & GDK_SHIFT_MASK) {
-            GtkWidget *current_widget = balsa_message_current_part_widget(bm);
+           GtkWidget *current_widget = balsa_message_current_part_widget(bm);
 
-            if (current_widget) {
+           if (current_widget) {
                 gboolean retval;
 
                 g_signal_emit_by_name(current_widget, "popup-menu", &retval);
 
                 return retval;
-            } else {
-                return FALSE;
-            }
-        } else {
+            } else
+               return FALSE;
+        } else
             return FALSE;
-        }
         break;
-
     case GDK_KEY_space:
         scroll_change(adj, page_adjust, bm);
         break;
@@ -288,9 +266,7 @@ balsa_mime_widget_key_press_event(GtkWidget    *widget,
 
 
 void
-balsa_mime_widget_check_focus(GtkWidget    *widget,
-                              GParamSpec   *pspec,
-                              BalsaMessage *bm)
+balsa_mime_widget_check_focus(GtkWidget * widget, GParamSpec * pspec, BalsaMessage * bm)
 {
     GtkContainer *container =
         GTK_CONTAINER(balsa_mime_widget_get_container(bm->bm_widget));
@@ -304,9 +280,8 @@ balsa_mime_widget_check_focus(GtkWidget    *widget,
         gtk_container_set_focus_chain(container, list);
         g_list_free(list);
 
-        if (bm->focus_state == BALSA_MESSAGE_FOCUS_STATE_NO) {
+        if (bm->focus_state == BALSA_MESSAGE_FOCUS_STATE_NO)
             bm->focus_state = BALSA_MESSAGE_FOCUS_STATE_YES;
-        }
     } else {
         gtk_container_unset_focus_chain(container);
 
@@ -314,9 +289,8 @@ balsa_mime_widget_check_focus(GtkWidget    *widget,
             if (bm->focus_state == BALSA_MESSAGE_FOCUS_STATE_HOLD) {
                 balsa_message_grab_focus(bm);
                 bm->focus_state = BALSA_MESSAGE_FOCUS_STATE_YES;
-            } else {
+            } else
                 bm->focus_state = BALSA_MESSAGE_FOCUS_STATE_NO;
-            }
         }
     }
 }
diff --git a/src/balsa-mime-widget-callbacks.h b/src/balsa-mime-widget-callbacks.h
index e179abb..134f585 100644
--- a/src/balsa-mime-widget-callbacks.h
+++ b/src/balsa-mime-widget-callbacks.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -27,18 +27,16 @@
 G_BEGIN_DECLS
 
 
-void balsa_mime_widget_ctx_menu_cb(GtkWidget           *menu_item,
-                                   LibBalsaMessageBody *mime_body);
-void balsa_mime_widget_ctx_menu_save(GtkWidget           *parent_widget,
-                                     LibBalsaMessageBody *mime_body);
-gboolean balsa_mime_widget_key_press_event(GtkWidget    *widget,
-                                           GdkEvent     *event,
-                                           BalsaMessage *bm);
-void balsa_mime_widget_check_focus(GtkWidget    *widget,
-                                   GParamSpec   *pspec,
-                                   BalsaMessage *bm);
+void balsa_mime_widget_ctx_menu_cb(GtkWidget * menu_item, LibBalsaMessageBody * mime_body);
+void balsa_mime_widget_ctx_menu_save(GtkWidget * parent_widget,
+                                     LibBalsaMessageBody * mime_body);
+gboolean balsa_mime_widget_key_press_event(GtkWidget * widget, GdkEvent * event,
+                                           BalsaMessage * bm);
+void balsa_mime_widget_check_focus(GtkWidget    * widget,
+                                   GParamSpec   * pspec,
+                                   BalsaMessage * bm);
 
 
 G_END_DECLS
 
-#endif                          /* __BALSA_MIME_WIDGET_CALLBACKS_H__ */
+#endif                         /* __BALSA_MIME_WIDGET_CALLBACKS_H__ */
diff --git a/src/balsa-mime-widget-crypto.c b/src/balsa-mime-widget-crypto.c
index 941a6be..06c8f8e 100644
--- a/src/balsa-mime-widget-crypto.c
+++ b/src/balsa-mime-widget-crypto.c
@@ -7,77 +7,69 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-mime-widget-crypto.h"
 
 #ifdef HAVE_GPGME
-#   include "balsa-app.h"
-#   include "balsa-icons.h"
-#   include <glib/gi18n.h>
-#   include <glib/gstdio.h>
-#   include "libbalsa-gpgme.h"
-#   include "libbalsa-gpgme-widgets.h"
-#   include "libbalsa-gpgme-keys.h"
-#   include "balsa-mime-widget.h"
-
-
-static void on_gpg_key_button(GtkWidget   *button,
-                              const gchar *fingerprint);
-static void on_key_import_button(GtkButton *button,
-                                 gpointer   user_data);
-static gboolean create_import_keys_widget(GtkBox      *box,
-                                          const gchar *key_buf,
-                                          GError     **error);
-static void show_public_key_data(GtkExpander *expander,
-                                 gpointer     user_data);
+#include "balsa-app.h"
+#include "balsa-icons.h"
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include "libbalsa-gpgme.h"
+#include "libbalsa-gpgme-widgets.h"
+#include "libbalsa-gpgme-keys.h"
+#include "balsa-mime-widget.h"
+
+
+static void on_gpg_key_button(GtkWidget *button, const gchar *fingerprint);
+static void on_key_import_button(GtkButton *button, gpointer user_data);
+static gboolean create_import_keys_widget(GtkBox *box, const gchar *key_buf, GError **error);
+static void show_public_key_data(GtkExpander *expander, gpointer user_data);
 
 
 BalsaMimeWidget *
-balsa_mime_widget_new_signature(BalsaMessage        *bm,
-                                LibBalsaMessageBody *mime_body,
-                                const gchar         *content_type,
-                                gpointer             data)
+balsa_mime_widget_new_signature(BalsaMessage * bm,
+                               LibBalsaMessageBody * mime_body,
+                               const gchar * content_type, gpointer data)
 {
     BalsaMimeWidget *mw;
 
     g_return_val_if_fail(mime_body != NULL, NULL);
     g_return_val_if_fail(content_type != NULL, NULL);
-
-    if (!mime_body->sig_info) {
-        return NULL;
-    }
+    
+    if (!mime_body->sig_info)
+       return NULL;
 
     mw = g_object_new(BALSA_TYPE_MIME_WIDGET, NULL);
     balsa_mime_widget_set_widget(mw,
                                  balsa_mime_widget_signature_widget(mime_body,
                                                                     content_type));
-
+    
     return mw;
 }
 
-
 BalsaMimeWidget *
 balsa_mime_widget_new_pgpkey(BalsaMessage        *bm,
-                             LibBalsaMessageBody *mime_body,
-                             const gchar         *content_type,
-                             gpointer             data)
+                                                        LibBalsaMessageBody *mime_body,
+                                                        const gchar             *content_type,
+                                                        gpointer                         data)
 {
     gssize body_size;
     gchar *body_buf = NULL;
     GError *err = NULL;
-    BalsaMimeWidget *mw = NULL;
+       BalsaMimeWidget *mw = NULL;
 
     g_return_val_if_fail(mime_body != NULL, NULL);
     g_return_val_if_fail(content_type != NULL, NULL);
@@ -104,16 +96,15 @@ balsa_mime_widget_new_pgpkey(BalsaMessage        *bm,
             g_object_unref(mw);
             mw = NULL;
         }
-        g_free(body_buf);
+       g_free(body_buf);
     }
 
     return mw;
 }
 
-
 GtkWidget *
-balsa_mime_widget_signature_widget(LibBalsaMessageBody *mime_body,
-                                   const gchar         *content_type)
+balsa_mime_widget_signature_widget(LibBalsaMessageBody * mime_body,
+                                  const gchar * content_type)
 {
     gchar *infostr;
     GtkWidget *expander;
@@ -122,9 +113,8 @@ balsa_mime_widget_signature_widget(LibBalsaMessageBody *mime_body,
     gchar **lines;
 
     if (!mime_body->sig_info ||
-        (mime_body->sig_info->status == GPG_ERR_NOT_SIGNED)) {
-        return NULL;
-    }
+       mime_body->sig_info->status == GPG_ERR_NOT_SIGNED)
+       return NULL;
 
     infostr = g_mime_gpgme_sigstat_to_gchar(mime_body->sig_info, FALSE, balsa_app.date_string);
     if (infostr == NULL) {
@@ -144,8 +134,7 @@ balsa_mime_widget_signature_widget(LibBalsaMessageBody *mime_body,
         if (mime_body->sig_info->status == GPG_ERR_NO_PUBKEY) {
             button = gtk_button_new_with_mnemonic(_("_Search key server for this key"));
         } else {
-            button = gtk_button_new_with_mnemonic(_(
-                                                      "_Search key server for updates of this key"));
+            button = gtk_button_new_with_mnemonic(_("_Search key server for updates of this key"));
         }
         g_signal_connect(G_OBJECT(button), "clicked",
                          G_CALLBACK(on_gpg_key_button),
@@ -163,13 +152,12 @@ balsa_mime_widget_signature_widget(LibBalsaMessageBody *mime_body,
     gtk_container_add(GTK_CONTAINER(expander), vbox);
 
     /* add a callback to load the key when the user wants to show the details
-     * Note: do *not* pass mime_body->sig_info to the callback, as it will be replaced when the
-     * user re-checks the signature or
+     * Note: do *not* pass mime_body->sig_info to the callback, as it will be replaced when the user 
re-checks the signature or
      * opens the message again in a separate window */
     if (((mime_body->sig_info->summary & GPGME_SIGSUM_KEY_MISSING) == 0) &&
-        (mime_body->sig_info->key == NULL)) {
-        g_signal_connect(expander, "activate", (GCallback) show_public_key_data, mime_body);
-        g_object_set_data(G_OBJECT(expander), "vbox", vbox);
+       (mime_body->sig_info->key == NULL)) {
+       g_signal_connect(expander, "activate", (GCallback) show_public_key_data, mime_body);
+       g_object_set_data(G_OBJECT(expander), "vbox", vbox);
     }
     g_object_set(G_OBJECT(signature_widget), "margin", BMW_CONTAINER_BORDER, NULL);
 
@@ -180,34 +168,30 @@ balsa_mime_widget_signature_widget(LibBalsaMessageBody *mime_body,
 
 
 GtkWidget *
-balsa_mime_widget_crypto_frame(LibBalsaMessageBody *mime_body,
-                               GtkWidget           *child,
-                               gboolean             was_encrypted,
-                               gboolean             no_signature,
-                               GtkWidget           *signature)
+balsa_mime_widget_crypto_frame(LibBalsaMessageBody * mime_body, GtkWidget * child,
+                              gboolean was_encrypted, gboolean no_signature,
+                              GtkWidget * signature)
 {
-    GtkWidget *frame;
-    GtkWidget *vbox;
-    GtkWidget *icon_box;
+    GtkWidget * frame;
+    GtkWidget * vbox;
+    GtkWidget * icon_box;
 
     frame = gtk_frame_new(NULL);
     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, BMW_VBOX_SPACE);
     gtk_container_add(GTK_CONTAINER(frame), vbox);
     icon_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, BMW_VBOX_SPACE);
-    if (was_encrypted) {
+    if (was_encrypted)
         gtk_box_pack_start(GTK_BOX(icon_box),
                            gtk_image_new_from_icon_name
-                               (balsa_icon_id(BALSA_PIXMAP_ENCR)));
-    }
+                           (balsa_icon_id(BALSA_PIXMAP_ENCR)));
     if (!no_signature) {
-        const gchar *icon_name =
-            balsa_mime_widget_signature_icon_name(libbalsa_message_body_protect_state(mime_body));
-        if (!icon_name) {
-            icon_name = BALSA_PIXMAP_SIGN;
-        }
+       const gchar * icon_name =
+           balsa_mime_widget_signature_icon_name(libbalsa_message_body_protect_state(mime_body));
+       if (!icon_name)
+           icon_name = BALSA_PIXMAP_SIGN;
         gtk_box_pack_start(GTK_BOX(icon_box),
                            gtk_image_new_from_icon_name
-                               (balsa_icon_id(icon_name)));
+                           (balsa_icon_id(icon_name)));
     }
     gtk_frame_set_label_widget(GTK_FRAME(frame), icon_box);
     g_object_set(G_OBJECT(vbox), "margin", BMW_MESSAGE_PADDING, NULL);
@@ -215,7 +199,7 @@ balsa_mime_widget_crypto_frame(LibBalsaMessageBody *mime_body,
     gtk_box_pack_start(GTK_BOX(vbox), child);
 
     if (signature) {
-        gtk_box_pack_end(GTK_BOX(vbox), signature);
+       gtk_box_pack_end(GTK_BOX(vbox), signature);
     }
 
     return frame;
@@ -231,13 +215,10 @@ balsa_mime_widget_signature_icon_name(LibBalsaMsgProtectState protect_state)
     switch (protect_state) {
     case LIBBALSA_MSG_PROTECT_SIGN_GOOD:
         return BALSA_PIXMAP_SIGN_GOOD;
-
     case LIBBALSA_MSG_PROTECT_SIGN_NOTRUST:
         return BALSA_PIXMAP_SIGN_NOTRUST;
-
     case LIBBALSA_MSG_PROTECT_SIGN_BAD:
         return BALSA_PIXMAP_SIGN_BAD;
-
     default:
         return NULL;
     }
@@ -247,15 +228,15 @@ balsa_mime_widget_signature_icon_name(LibBalsaMsgProtectState protect_state)
 /* Callback: try to import a public key */
 static void
 on_gpg_key_button(GtkWidget   *button,
-                  const gchar *fingerprint)
+                                 const gchar *fingerprint)
 {
-    GError *error = NULL;
+       GError *error = NULL;
 
     if (!libbalsa_gpgme_keyserver_op(fingerprint, balsa_get_parent_window(button), &error)) {
-        libbalsa_information(LIBBALSA_INFORMATION_ERROR, "%s", error->message);
-        g_error_free(error);
+       libbalsa_information(LIBBALSA_INFORMATION_ERROR, "%s", error->message);
+       g_error_free(error);
     } else {
-        gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
+               gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
     }
 }
 
@@ -263,148 +244,129 @@ on_gpg_key_button(GtkWidget   *button,
 /* Callback: import an attached key */
 static void
 on_key_import_button(GtkButton *button,
-                     gpointer   user_data)
+                                        gpointer   user_data)
 {
-    gpgme_ctx_t ctx;
-    gboolean success;
-    GError *error = NULL;
-    gchar *import_info = NULL;
-    GtkWidget *dialog;
-
-    ctx = libbalsa_gpgme_new_with_proto(GPGME_PROTOCOL_OpenPGP, NULL, NULL, &error);
-    if (ctx != NULL) {
-        success =
-            libbalsa_gpgme_import_ascii_key(ctx, g_object_get_data(G_OBJECT(
-                                                                       button), "keydata"), &import_info,
-                                            &error);
-        gpgme_release(ctx);
-    } else {
-        success = FALSE;
-    }
-
-    if (success) {
-        dialog = gtk_message_dialog_new(GTK_WINDOW(balsa_app.main_window),
-                                        GTK_DIALOG_DESTROY_WITH_PARENT | libbalsa_dialog_flags(),
-                                        GTK_MESSAGE_INFO,
-                                        GTK_BUTTONS_CLOSE,
-                                        _("Import GnuPG key:\n%s"), import_info);
-        gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
-    } else {
-        dialog = gtk_message_dialog_new(GTK_WINDOW(balsa_app.main_window),
-                                        GTK_DIALOG_DESTROY_WITH_PARENT | libbalsa_dialog_flags(),
-                                        GTK_MESSAGE_ERROR,
-                                        GTK_BUTTONS_CLOSE,
-                                        _("Error importing key data: %s"), error->message);
-        g_clear_error(&error);
-    }
-    g_free(import_info);
-    (void) gtk_dialog_run(GTK_DIALOG(dialog));
-    gtk_widget_destroy(dialog);
+       gpgme_ctx_t ctx;
+       gboolean success;
+       GError *error = NULL;
+       gchar *import_info = NULL;
+       GtkWidget *dialog;
+
+       ctx = libbalsa_gpgme_new_with_proto(GPGME_PROTOCOL_OpenPGP, NULL, NULL, &error);
+       if (ctx != NULL) {
+               success = libbalsa_gpgme_import_ascii_key(ctx, g_object_get_data(G_OBJECT(button), 
"keydata"), &import_info, &error);
+               gpgme_release(ctx);
+       } else {
+               success = FALSE;
+       }
+
+       if (success) {
+               dialog = gtk_message_dialog_new(GTK_WINDOW(balsa_app.main_window),
+                       GTK_DIALOG_DESTROY_WITH_PARENT | libbalsa_dialog_flags(),
+                       GTK_MESSAGE_INFO,
+                       GTK_BUTTONS_CLOSE,
+                       _("Import GnuPG key:\n%s"), import_info);
+               gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
+       } else {
+               dialog = gtk_message_dialog_new(GTK_WINDOW(balsa_app.main_window),
+                       GTK_DIALOG_DESTROY_WITH_PARENT | libbalsa_dialog_flags(),
+                       GTK_MESSAGE_ERROR,
+                       GTK_BUTTONS_CLOSE,
+                       _("Error importing key data: %s"), error->message);
+               g_clear_error(&error);
+       }
+       g_free(import_info);
+       (void) gtk_dialog_run(GTK_DIALOG(dialog));
+       gtk_widget_destroy(dialog);
 }
 
 
 static gboolean
-create_import_keys_widget(GtkBox      *box,
-                          const gchar *key_buf,
-                          GError     **error)
+create_import_keys_widget(GtkBox *box, const gchar *key_buf, GError **error)
 {
-    gboolean success = FALSE;
-    gpgme_ctx_t ctx;
+       gboolean success = FALSE;
+       gpgme_ctx_t ctx;
 
-    ctx = libbalsa_gpgme_new_with_proto(GPGME_PROTOCOL_OpenPGP, NULL, NULL, error);
-    if (ctx != NULL) {
-        gchar *temp_dir = NULL;
+       ctx = libbalsa_gpgme_new_with_proto(GPGME_PROTOCOL_OpenPGP, NULL, NULL, error);
+       if (ctx != NULL) {
+               gchar *temp_dir = NULL;
 
-        if (!libbalsa_mktempdir(&temp_dir)) {
-            g_warning("Failed to create a temporary folder");
-        } else {
-            GList *keys = NULL;
-
-            success = libbalsa_gpgme_ctx_set_home(ctx, temp_dir, error) &&
-                libbalsa_gpgme_import_ascii_key(ctx, key_buf, NULL, error) &&
-                libbalsa_gpgme_list_keys(ctx, &keys, NULL, NULL, FALSE, FALSE, error);
-
-            if (success && (keys != NULL)) {
-                GList *item;
-
-                for (item = keys; success && (item != NULL); item = item->next) {
-                    gpgme_key_t this_key = (gpgme_key_t) item->data;
-                    gchar *key_ascii;
-                    GtkWidget *key_widget;
-                    GtkWidget *import_btn;
-
-                    key_ascii =
-                        libbalsa_gpgme_export_key(ctx, this_key, _("(imported)"), error);
-
-                    if (key_ascii == NULL) {
-                        success = FALSE;
-                    } else {
-                        key_widget = libbalsa_gpgme_key(this_key,
-                                                        NULL,
-                                                        GPG_SUBKEY_CAP_ALL,
-                                                        FALSE);
-                        gtk_box_pack_start(box, key_widget);
-
-                        import_btn =
-                            gtk_button_new_with_label(_("Import key into the local key ring"));
-                        g_object_set_data_full(G_OBJECT(import_btn), "keydata", key_ascii,
-                                               (GDestroyNotify) g_free);
-                        g_signal_connect(G_OBJECT(
-                                             import_btn), "clicked", (GCallback) on_key_import_button,
-                                         NULL);
-                        gtk_box_pack_start(box, import_btn);
-
-                        if (item->next != NULL) {
-                            GtkWidget *separator;
-
-                            separator = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
-                            gtk_widget_set_margin_top(separator, BMW_VBOX_SPACE);
-                            gtk_box_pack_start(box, separator);
-                        }
-                    }
-                }
-
-                g_list_free_full(keys, (GDestroyNotify) gpgme_key_release);
-            }
-
-            libbalsa_delete_directory_contents(temp_dir);
-            g_rmdir(temp_dir);
-        }
+               if (!libbalsa_mktempdir(&temp_dir)) {
+                       g_warning("Failed to create a temporary folder");
+               } else {
+                       GList *keys = NULL;
 
-        gpgme_release(ctx);
-    }
+                       success = libbalsa_gpgme_ctx_set_home(ctx, temp_dir, error) &&
+                               libbalsa_gpgme_import_ascii_key(ctx, key_buf, NULL, error) &&
+                               libbalsa_gpgme_list_keys(ctx, &keys, NULL, NULL, FALSE, FALSE, error);
 
-    return success;
-}
+                       if (success && (keys != NULL)) {
+                               GList *item;
+
+                               for (item = keys; success && (item != NULL); item = item->next) {
+                                       gpgme_key_t this_key = (gpgme_key_t) item->data;
+                                       gchar *key_ascii;
+                                       GtkWidget *key_widget;
+                                       GtkWidget *import_btn;
+
+                                       key_ascii = libbalsa_gpgme_export_key(ctx, this_key, _("(imported)"), 
error);
+
+                                       if (key_ascii == NULL) {
+                                               success = FALSE;
+                                       } else {
+                                               key_widget = libbalsa_gpgme_key(this_key, NULL, 
GPG_SUBKEY_CAP_ALL, FALSE);
+                                               gtk_box_pack_start(box, key_widget);
+
+                                               import_btn = gtk_button_new_with_label(_("Import key into the 
local key ring"));
+                                               g_object_set_data_full(G_OBJECT(import_btn), "keydata", 
key_ascii, (GDestroyNotify) g_free);
+                                               g_signal_connect(G_OBJECT(import_btn), "clicked", (GCallback) 
on_key_import_button, NULL);
+                                               gtk_box_pack_start(box, import_btn);
+
+                                               if (item->next != NULL) {
+                                                    GtkWidget *separator;
+
+                                                       separator = 
gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
+                                                        gtk_widget_set_margin_top(separator, BMW_VBOX_SPACE);
+                                                       gtk_box_pack_start(box, separator);
+                                               }
+                                       }
+                               }
 
+                               g_list_free_full(keys, (GDestroyNotify) gpgme_key_release);
+                       }
+
+                       libbalsa_delete_directory_contents(temp_dir);
+                       g_rmdir(temp_dir);
+               }
+
+               gpgme_release(ctx);
+       }
+
+       return success;
+}
 
 static void
 show_public_key_data(GtkExpander *expander,
                      gpointer     user_data)
 {
-    LibBalsaMessageBody *body = (LibBalsaMessageBody *) user_data;
-
-    g_message("%s: %p %p %p", __func__, expander, body, body->sig_info);
-    if (body->sig_info != NULL) {
-        if (body->sig_info->key == NULL) {
-            g_mime_gpgme_sigstat_load_key(body->sig_info);
-        }
-
-        if ((g_object_get_data(G_OBJECT(expander),
-                               "vbox") != NULL) && (body->sig_info->key != NULL)) {
-            GtkWidget *key_widget;
-            GtkBox *vbox;
-
-            vbox = GTK_BOX(g_object_steal_data(G_OBJECT(expander), "vbox"));
-            key_widget = libbalsa_gpgme_key(body->sig_info->key,
-                                            body->sig_info->fingerprint,
-                                            0U,
-                                            FALSE);
-            gtk_box_pack_start(vbox, key_widget);
-            gtk_box_reorder_child(vbox, key_widget, 1U);
-        }
-    }
+       LibBalsaMessageBody *body = (LibBalsaMessageBody *) user_data;
+
+       g_message("%s: %p %p %p", __func__, expander, body, body->sig_info);
+       if (body->sig_info != NULL) {
+               if (body->sig_info->key == NULL) {
+                       g_mime_gpgme_sigstat_load_key(body->sig_info);
+               }
+
+               if ((g_object_get_data(G_OBJECT(expander), "vbox") != NULL) && (body->sig_info->key != NULL)) 
{
+                       GtkWidget *key_widget;
+                       GtkBox *vbox;
+
+                       vbox = GTK_BOX(g_object_steal_data(G_OBJECT(expander), "vbox"));
+                       key_widget = libbalsa_gpgme_key(body->sig_info->key, body->sig_info->fingerprint, 0U, 
FALSE);
+                       gtk_box_pack_start(vbox, key_widget);
+                       gtk_box_reorder_child(vbox, key_widget, 1U);
+               }
+       }
 }
 
-
 #endif  /* HAVE_GPGME */
diff --git a/src/balsa-mime-widget-crypto.h b/src/balsa-mime-widget-crypto.h
index f69686f..3e72fe9 100644
--- a/src/balsa-mime-widget-crypto.h
+++ b/src/balsa-mime-widget-crypto.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -21,37 +21,34 @@
 #define __BALSA_MIME_WIDGET_CRYPTO_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #ifdef HAVE_GPGME
 
-#   include "balsa-app.h"
-#   include "balsa-message.h"
-#   include "balsa-mime-widget.h"
+#include "balsa-app.h"
+#include "balsa-message.h"
+#include "balsa-mime-widget.h"
 
 G_BEGIN_DECLS
 
 
-BalsaMimeWidget *balsa_mime_widget_new_signature(BalsaMessage        *bm,
-                                                 LibBalsaMessageBody *mime_body,
-                                                 const gchar         *content_type,
-                                                 gpointer             data);
+BalsaMimeWidget *balsa_mime_widget_new_signature(BalsaMessage * bm,
+                                                LibBalsaMessageBody * mime_body,
+                                                const gchar * content_type, gpointer data);
 BalsaMimeWidget *balsa_mime_widget_new_pgpkey(BalsaMessage        *bm,
-                                              LibBalsaMessageBody *mime_body,
-                                              const gchar         *content_type,
-                                              gpointer             data);
-GtkWidget *balsa_mime_widget_signature_widget(LibBalsaMessageBody *mime_body,
-                                              const gchar         *content_type);
-GtkWidget *balsa_mime_widget_crypto_frame(LibBalsaMessageBody *mime_body,
-                                          GtkWidget           *child,
-                                          gboolean             was_encrypted,
-                                          gboolean             no_signature,
-                                          GtkWidget           *signature);
+                                                                                         LibBalsaMessageBody 
*mime_body,
+                                                                                         const gchar         
    *content_type,
+                                                                                         gpointer            
             data);
+GtkWidget * balsa_mime_widget_signature_widget(LibBalsaMessageBody * mime_body,
+                                              const gchar * content_type);
+GtkWidget * balsa_mime_widget_crypto_frame(LibBalsaMessageBody * mime_body, GtkWidget * child,
+                                          gboolean was_encrypted, gboolean no_signature,
+                                          GtkWidget * signature);
 const gchar *balsa_mime_widget_signature_icon_name(LibBalsaMsgProtectState protect_state);
 
 
 G_END_DECLS
 
 #endif                          /* HAVE_GPGME */
-#endif                          /* __BALSA_MIME_WIDGET_IMAGE_H__ */
+#endif                         /* __BALSA_MIME_WIDGET_IMAGE_H__ */
diff --git a/src/balsa-mime-widget-image.c b/src/balsa-mime-widget-image.c
index 3a8ec53..bd358ba 100644
--- a/src/balsa-mime-widget-image.c
+++ b/src/balsa-mime-widget-image.c
@@ -18,7 +18,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include "balsa-mime-widget-image.h"
@@ -32,7 +32,7 @@
  * GObject class definitions
  */
 struct _BalsaMimeWidgetImage {
-    BalsaMimeWidget parent;
+    BalsaMimeWidget  parent;
 
     guint img_check_size_id;
     GdkPixbuf *pixbuf;
@@ -48,16 +48,15 @@ G_DEFINE_TYPE(BalsaMimeWidgetImage,
               BALSA_TYPE_MIME_WIDGET);
 
 static void
-balsa_mime_widget_image_init(BalsaMimeWidgetImage *mwi)
+balsa_mime_widget_image_init(BalsaMimeWidgetImage * mwi)
 {
     mwi->img_check_size_id = 0;
     mwi->pixbuf = NULL;
     mwi->gesture = NULL;
 }
 
-
 static void
-balsa_mime_widget_image_dispose(GObject *object)
+balsa_mime_widget_image_dispose(GObject * object)
 {
     BalsaMimeWidgetImage *mwi = (BalsaMimeWidgetImage *) object;
 
@@ -68,16 +67,13 @@ balsa_mime_widget_image_dispose(GObject *object)
     G_OBJECT_CLASS(balsa_mime_widget_image_parent_class)->dispose(object);
 }
 
-
 static void
-balsa_mime_widget_image_class_init(BalsaMimeWidgetImageClass *klass)
+balsa_mime_widget_image_class_init(BalsaMimeWidgetImageClass * klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS(klass);
 
     object_class->dispose = balsa_mime_widget_image_dispose;
 }
-
-
 /*
  * End of GObject class definitions
  */
@@ -102,9 +98,8 @@ balsa_mime_widget_image_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
     }
 }
 
-
 static gboolean
-img_check_size(BalsaMimeWidgetImage *mwi)
+img_check_size(BalsaMimeWidgetImage * mwi)
 {
     GtkWidget *widget;
     GtkImage *image;
@@ -134,16 +129,14 @@ img_check_size(BalsaMimeWidgetImage *mwi)
 
     image = GTK_IMAGE(widget);
     switch (gtk_image_get_storage_type(image)) {
-    case GTK_IMAGE_SURFACE:
-        curr_w = cairo_image_surface_get_width(gtk_image_get_surface(image));
-        break;
-
-    case GTK_IMAGE_TEXTURE:
-        curr_w = gdk_texture_get_width(gtk_image_get_texture(image));
-        break;
-
-    default:
-        curr_w = 0;
+        case GTK_IMAGE_SURFACE:
+            curr_w = cairo_image_surface_get_width(gtk_image_get_surface(image));
+            break;
+        case GTK_IMAGE_TEXTURE:
+            curr_w = gdk_texture_get_width(gtk_image_get_texture(image));
+            break;
+        default:
+            curr_w = 0;
     }
 
     gtk_widget_get_allocation(viewport, &allocation);
@@ -158,41 +151,38 @@ img_check_size(BalsaMimeWidgetImage *mwi)
     dst_w = CLAMP(dst_w, 32, orig_width);
 
     if (dst_w != curr_w) {
-        GdkPixbuf *scaled_pixbuf;
-        gint dst_h;
-
-        dst_h = (gfloat)dst_w / (gfloat)orig_width * gdk_pixbuf_get_height(pixbuf);
-        scaled_pixbuf = gdk_pixbuf_scale_simple(pixbuf, dst_w, dst_h,
-                                                GDK_INTERP_BILINEAR);
-        gtk_image_set_from_pixbuf(image, scaled_pixbuf);
-        g_object_unref(scaled_pixbuf);
+       GdkPixbuf *scaled_pixbuf;
+       gint dst_h;
+
+       dst_h = (gfloat)dst_w / (gfloat)orig_width * gdk_pixbuf_get_height(pixbuf);
+       scaled_pixbuf = gdk_pixbuf_scale_simple(pixbuf, dst_w, dst_h,
+                                               GDK_INTERP_BILINEAR);
+       gtk_image_set_from_pixbuf(image, scaled_pixbuf);
+       g_object_unref(scaled_pixbuf);
     }
 
     return G_SOURCE_REMOVE;
 }
 
-
 static void
 img_size_allocate_cb(BalsaMimeWidgetImage *mwi)
 {
-    if ((mwi->pixbuf != NULL) && (mwi->img_check_size_id == 0)) {
+    if (mwi->pixbuf != NULL && mwi->img_check_size_id == 0) {
         mwi->img_check_size_id = g_idle_add((GSourceFunc) img_check_size, mwi);
     }
 }
 
-
 /*
  * Public method
  */
 
 BalsaMimeWidget *
-balsa_mime_widget_new_image(BalsaMessage        *bm,
-                            LibBalsaMessageBody *mime_body,
-                            const gchar         *content_type,
-                            gpointer             data)
+balsa_mime_widget_new_image(BalsaMessage * bm,
+                            LibBalsaMessageBody * mime_body,
+                           const gchar * content_type, gpointer data)
 {
     GtkWidget *image;
-    GError *load_err = NULL;
+    GError * load_err = NULL;
     BalsaMimeWidgetImage *mwi;
     BalsaMimeWidget *mw;
 
@@ -203,14 +193,14 @@ balsa_mime_widget_new_image(BalsaMessage        *bm,
 
     mwi->pixbuf = libbalsa_message_body_get_pixbuf(mime_body, &load_err);
     if (mwi->pixbuf == NULL) {
-        if (load_err != NULL) {
+       if (load_err != NULL) {
             balsa_information(LIBBALSA_INFORMATION_ERROR,
-                              _("Error loading attached image: %s\n"),
-                              load_err->message);
-            g_error_free(load_err);
-        }
+                             _("Error loading attached image: %s\n"),
+                             load_err->message);
+           g_error_free(load_err);
+       }
         g_object_unref(mwi);
-        return NULL;
+       return NULL;
     }
 
     image = gtk_image_new_from_icon_name("image-missing");
diff --git a/src/balsa-mime-widget-image.h b/src/balsa-mime-widget-image.h
index 6af6dc2..4f6feb3 100644
--- a/src/balsa-mime-widget-image.h
+++ b/src/balsa-mime-widget-image.h
@@ -39,11 +39,11 @@ G_DECLARE_FINAL_TYPE(BalsaMimeWidgetImage, balsa_mime_widget_image,
  * End of GObject class definitions
  */
 
-BalsaMimeWidget * balsa_mime_widget_new_image(BalsaMessage * bm,
-                                              LibBalsaMessageBody * mime_body,
-                                              const gchar * content_type, gpointer data);
+BalsaMimeWidget *balsa_mime_widget_new_image(BalsaMessage * bm,
+                                            LibBalsaMessageBody * mime_body,
+                                            const gchar * content_type, gpointer data);
 
 
 G_END_DECLS
 
-#endif                          /* __BALSA_MIME_WIDGET_IMAGE_H__ */
+#endif                         /* __BALSA_MIME_WIDGET_IMAGE_H__ */
diff --git a/src/balsa-mime-widget-message.c b/src/balsa-mime-widget-message.c
index f60526d..a8d36f8 100644
--- a/src/balsa-mime-widget-message.c
+++ b/src/balsa-mime-widget-message.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-mime-widget-message.h"
 
@@ -64,35 +64,31 @@ static rfc_extbody_id rfc_extbodys[] = {
 
 /* message/external-body related stuff */
 static BalsaMimeWidget *bmw_message_extbody_url(LibBalsaMessageBody *
-                                                mime_body,
-                                                rfc_extbody_t url_type);
+                                               mime_body,
+                                               rfc_extbody_t url_type);
 static BalsaMimeWidget *bmw_message_extbody_mail(LibBalsaMessageBody *
-                                                 mime_body);
-static void extbody_call_url(GtkWidget *button,
-                             gpointer   data);
-static void extbody_send_mail(GtkWidget           *button,
-                              LibBalsaMessageBody *mime_body);
+                                                mime_body);
+static void extbody_call_url(GtkWidget * button, gpointer data);
+static void extbody_send_mail(GtkWidget * button,
+                             LibBalsaMessageBody * mime_body);
 
 /* message/rfc822 related stuff */
-static GtkWidget *bm_header_widget_new(BalsaMessage     *bm,
-                                       GtkWidget *const *buttons);
-
+static GtkWidget *bm_header_widget_new(BalsaMessage * bm,
+                                      GtkWidget * const * buttons);
 #ifdef HAVE_GPGME
-static void add_header_sigstate(GtkGrid           *grid,
-                                GMimeGpgmeSigstat *siginfo);
-
+static void add_header_sigstate(GtkGrid * grid,
+                               GMimeGpgmeSigstat * siginfo);
 #endif
 
-static void bmw_message_set_headers(BalsaMessage        *bm,
-                                    BalsaMimeWidget     *mw,
-                                    LibBalsaMessageBody *part,
-                                    gboolean             show_all_headers);
+static void bmw_message_set_headers(BalsaMessage        * bm,
+                                    BalsaMimeWidget     * mw,
+                                    LibBalsaMessageBody * part,
+                                    gboolean              show_all_headers);
 
 BalsaMimeWidget *
-balsa_mime_widget_new_message(BalsaMessage        *bm,
-                              LibBalsaMessageBody *mime_body,
-                              const gchar         *content_type,
-                              gpointer             data)
+balsa_mime_widget_new_message(BalsaMessage * bm,
+                             LibBalsaMessageBody * mime_body,
+                             const gchar * content_type, gpointer data)
 {
     BalsaMimeWidget *mw = NULL;
 
@@ -100,74 +96,70 @@ balsa_mime_widget_new_message(BalsaMessage        *bm,
     g_return_val_if_fail(content_type != NULL, NULL);
 
     if (!g_ascii_strcasecmp("message/external-body", content_type)) {
-        gchar *access_type;
-        rfc_extbody_id *extbody_type = rfc_extbodys;
-
-        access_type =
-            libbalsa_message_body_get_parameter(mime_body, "access-type");
-        while (extbody_type->id_string &&
-               g_ascii_strcasecmp(extbody_type->id_string, access_type)) {
-            extbody_type++;
-        }
-        switch (extbody_type->action) {
-        case RFC2046_EXTBODY_FTP:
-        case RFC2046_EXTBODY_ANONFTP:
-        case RFC2046_EXTBODY_TFTP:
-        case RFC2046_EXTBODY_LOCALFILE:
-        case RFC2017_EXTBODY_URL:
-            mw = bmw_message_extbody_url(mime_body, extbody_type->action);
-            break;
-
-        case RFC2046_EXTBODY_MAILSERVER:
-            mw = bmw_message_extbody_mail(mime_body);
-            break;
-
-        case RFC2046_EXTBODY_UNKNOWN:
-            break;
-
-        default:
-            g_error("Undefined external body action %d!", extbody_type->action);
-            break;
-        }
-        g_free(access_type);
+       gchar *access_type;
+       rfc_extbody_id *extbody_type = rfc_extbodys;
+
+       access_type =
+           libbalsa_message_body_get_parameter(mime_body, "access-type");
+       while (extbody_type->id_string &&
+              g_ascii_strcasecmp(extbody_type->id_string, access_type))
+           extbody_type++;
+       switch (extbody_type->action) {
+       case RFC2046_EXTBODY_FTP:
+       case RFC2046_EXTBODY_ANONFTP:
+       case RFC2046_EXTBODY_TFTP:
+       case RFC2046_EXTBODY_LOCALFILE:
+       case RFC2017_EXTBODY_URL:
+           mw = bmw_message_extbody_url(mime_body, extbody_type->action);
+           break;
+       case RFC2046_EXTBODY_MAILSERVER:
+           mw = bmw_message_extbody_mail(mime_body);
+           break;
+       case RFC2046_EXTBODY_UNKNOWN:
+           break;
+       default:
+           g_error("Undefined external body action %d!", extbody_type->action);
+           break;
+       }
+       g_free(access_type);
     } else if (!g_ascii_strcasecmp("message/rfc822", content_type)) {
-        GtkWidget *widget;
-        GtkWidget *container;
-        GtkWidget *header_widget;
+       GtkWidget *widget;
+       GtkWidget *container;
+       GtkWidget *header_widget;
 
-        mw = g_object_new(BALSA_TYPE_MIME_WIDGET, NULL);
+       mw = g_object_new(BALSA_TYPE_MIME_WIDGET, NULL);
 
-        widget = gtk_frame_new(NULL);
+       widget = gtk_frame_new(NULL);
         balsa_mime_widget_set_widget(mw, widget);
 
-        container = gtk_box_new(GTK_ORIENTATION_VERTICAL, BMW_MESSAGE_PADDING);
-        g_object_set(G_OBJECT(container), "margin", BMW_MESSAGE_PADDING, NULL);
-        gtk_container_add(GTK_CONTAINER(widget), container);
+       container = gtk_box_new(GTK_ORIENTATION_VERTICAL, BMW_MESSAGE_PADDING);
+       g_object_set(G_OBJECT(container), "margin", BMW_MESSAGE_PADDING, NULL);
+       gtk_container_add(GTK_CONTAINER(widget), container);
         balsa_mime_widget_set_container(mw, container);
 
         header_widget = bm_header_widget_new(bm, NULL);
-        gtk_box_pack_start(GTK_BOX(container), header_widget);
+       gtk_box_pack_start(GTK_BOX(container), header_widget);
         balsa_mime_widget_set_header_widget(mw, header_widget);
 
         bmw_message_set_headers(bm, mw, mime_body,
                                 bm->shown_headers == HEADERS_ALL);
     } else if (!g_ascii_strcasecmp("text/rfc822-headers", content_type)) {
-        GtkWidget *widget;
-        GtkWidget *header_widget;
+       GtkWidget *widget;
+       GtkWidget *header_widget;
 
-        mw = g_object_new(BALSA_TYPE_MIME_WIDGET, NULL);
+       mw = g_object_new(BALSA_TYPE_MIME_WIDGET, NULL);
 
-        widget = gtk_frame_new(_("message headers"));
+       widget = gtk_frame_new(_("message headers"));
         balsa_mime_widget_set_widget(mw, widget);
 
-        header_widget = bm_header_widget_new(bm, NULL);
+       header_widget = bm_header_widget_new(bm, NULL);
         gtk_widget_set_valign(header_widget, GTK_ALIGN_START);
         gtk_widget_set_vexpand(header_widget, FALSE);
         g_object_set(G_OBJECT(header_widget), "margin", 5, NULL);
-        gtk_container_add(GTK_CONTAINER(widget), header_widget);
+       gtk_container_add(GTK_CONTAINER(widget), header_widget);
         balsa_mime_widget_set_header_widget(mw, header_widget);
 
-        bmw_message_set_headers(bm, mw, mime_body, TRUE);
+       bmw_message_set_headers(bm, mw, mime_body, TRUE);
     }
 
     /* return the created widget (may be NULL) */
@@ -177,8 +169,8 @@ balsa_mime_widget_new_message(BalsaMessage        *bm,
 
 /* ----- message/external-body related stuff ----- */
 static BalsaMimeWidget *
-bmw_message_extbody_url(LibBalsaMessageBody *mime_body,
-                        rfc_extbody_t        url_type)
+bmw_message_extbody_url(LibBalsaMessageBody * mime_body,
+                       rfc_extbody_t url_type)
 {
     GtkWidget *button;
     GString *msg = NULL;
@@ -187,67 +179,63 @@ bmw_message_extbody_url(LibBalsaMessageBody *mime_body,
     GtkWidget *widget;
 
     if (url_type == RFC2046_EXTBODY_LOCALFILE) {
-        url = libbalsa_message_body_get_parameter(mime_body, "name");
+       url = libbalsa_message_body_get_parameter(mime_body, "name");
 
-        if (!url) {
-            return NULL;
-        }
+       if (!url)
+           return NULL;
 
-        msg = g_string_new(_("Content Type: external-body\n"));
-        g_string_append_printf(msg, _("Access type: local-file\n"));
-        g_string_append_printf(msg, _("File name: %s"), url);
+       msg = g_string_new(_("Content Type: external-body\n"));
+       g_string_append_printf(msg, _("Access type: local-file\n"));
+       g_string_append_printf(msg, _("File name: %s"), url);
     } else if (url_type == RFC2017_EXTBODY_URL) {
-        gchar *local_name;
-
-        local_name = libbalsa_message_body_get_parameter(mime_body, "URL");
-
-        if (!local_name) {
-            return NULL;
-        }
-
-        url = g_strdup(local_name);
-        msg = g_string_new(_("Content Type: external-body\n"));
-        g_string_append_printf(msg, _("Access type: URL\n"));
-        g_string_append_printf(msg, _("URL: %s"), url);
-        g_free(local_name);
-    } else {                    /* *FTP* */
-        gchar *ftp_dir, *ftp_name, *ftp_site;
-
-        ftp_dir =
-            libbalsa_message_body_get_parameter(mime_body, "directory");
-        ftp_name = libbalsa_message_body_get_parameter(mime_body, "name");
-        ftp_site = libbalsa_message_body_get_parameter(mime_body, "site");
-
-        if (!ftp_name || !ftp_site) {
-            g_free(ftp_dir);
-            g_free(ftp_name);
-            g_free(ftp_site);
-            return NULL;
-        }
-
-        if (ftp_dir) {
-            url = g_strdup_printf("%s://%s/%s/%s",
-                                  url_type == RFC2046_EXTBODY_TFTP
-                                  ? "tftp" : "ftp",
-                                  ftp_site, ftp_dir, ftp_name);
-        } else {
-            url = g_strdup_printf("%s://%s/%s",
-                                  url_type == RFC2046_EXTBODY_TFTP
-                                  ? "tftp" : "ftp", ftp_site, ftp_name);
-        }
-        msg = g_string_new(_("Content Type: external-body\n"));
-        g_string_append_printf(msg, _("Access type: %s\n"),
-                               url_type == RFC2046_EXTBODY_TFTP ? "tftp" :
-                               url_type ==
-                               RFC2046_EXTBODY_FTP ? "ftp" : "anon-ftp");
-        g_string_append_printf(msg, _("FTP site: %s\n"), ftp_site);
-        if (ftp_dir) {
-            g_string_append_printf(msg, _("Directory: %s\n"), ftp_dir);
-        }
-        g_string_append_printf(msg, _("File name: %s"), ftp_name);
-        g_free(ftp_dir);
-        g_free(ftp_name);
-        g_free(ftp_site);
+       gchar *local_name;
+
+       local_name = libbalsa_message_body_get_parameter(mime_body, "URL");
+
+       if (!local_name)
+           return NULL;
+
+       url = g_strdup(local_name);
+       msg = g_string_new(_("Content Type: external-body\n"));
+       g_string_append_printf(msg, _("Access type: URL\n"));
+       g_string_append_printf(msg, _("URL: %s"), url);
+       g_free(local_name);
+    } else {                   /* *FTP* */
+       gchar *ftp_dir, *ftp_name, *ftp_site;
+
+       ftp_dir =
+           libbalsa_message_body_get_parameter(mime_body, "directory");
+       ftp_name = libbalsa_message_body_get_parameter(mime_body, "name");
+       ftp_site = libbalsa_message_body_get_parameter(mime_body, "site");
+
+       if (!ftp_name || !ftp_site) {
+           g_free(ftp_dir);
+           g_free(ftp_name);
+           g_free(ftp_site);
+           return NULL;
+       }
+
+       if (ftp_dir)
+           url = g_strdup_printf("%s://%s/%s/%s",
+                                 url_type == RFC2046_EXTBODY_TFTP
+                                 ? "tftp" : "ftp",
+                                 ftp_site, ftp_dir, ftp_name);
+       else
+           url = g_strdup_printf("%s://%s/%s",
+                                 url_type == RFC2046_EXTBODY_TFTP
+                                 ? "tftp" : "ftp", ftp_site, ftp_name);
+       msg = g_string_new(_("Content Type: external-body\n"));
+       g_string_append_printf(msg, _("Access type: %s\n"),
+                              url_type == RFC2046_EXTBODY_TFTP ? "tftp" :
+                              url_type ==
+                              RFC2046_EXTBODY_FTP ? "ftp" : "anon-ftp");
+       g_string_append_printf(msg, _("FTP site: %s\n"), ftp_site);
+       if (ftp_dir)
+           g_string_append_printf(msg, _("Directory: %s\n"), ftp_dir);
+       g_string_append_printf(msg, _("File name: %s"), ftp_name);
+       g_free(ftp_dir);
+       g_free(ftp_name);
+       g_free(ftp_site);
     }
 
     /* now create & return the widget... */
@@ -263,9 +251,9 @@ bmw_message_extbody_url(LibBalsaMessageBody *mime_body,
     gtk_widget_set_margin_top(button, BMW_BUTTON_PACK_SPACE);
     gtk_box_pack_start(GTK_BOX(widget), button);
     g_object_set_data_full(G_OBJECT(button), "call_url", url,
-                           (GDestroyNotify) g_free);
+                          (GDestroyNotify) g_free);
     g_signal_connect(G_OBJECT(button), "clicked",
-                     G_CALLBACK(extbody_call_url), NULL);
+                    G_CALLBACK(extbody_call_url), NULL);
 
     balsa_mime_widget_set_widget(mw, widget);
 
@@ -274,7 +262,7 @@ bmw_message_extbody_url(LibBalsaMessageBody *mime_body,
 
 
 static BalsaMimeWidget *
-bmw_message_extbody_mail(LibBalsaMessageBody *mime_body)
+bmw_message_extbody_mail(LibBalsaMessageBody * mime_body)
 {
     GtkWidget *button;
     GString *msg = NULL;
@@ -284,25 +272,23 @@ bmw_message_extbody_mail(LibBalsaMessageBody *mime_body)
 
     mail_site = libbalsa_message_body_get_parameter(mime_body, "server");
 
-    if (!mail_site) {
-        return NULL;
-    }
+    if (!mail_site)
+       return NULL;
 
     mail_subject =
-        libbalsa_message_body_get_parameter(mime_body, "subject");
+       libbalsa_message_body_get_parameter(mime_body, "subject");
 
     msg = g_string_new(_("Content Type: external-body\n"));
     g_string_append(msg, _("Access type: mail-server\n"));
     g_string_append_printf(msg, _("Mail server: %s\n"), mail_site);
-    if (mail_subject) {
-        g_string_append_printf(msg, _("Subject: %s\n"), mail_subject);
-    }
+    if (mail_subject)
+       g_string_append_printf(msg, _("Subject: %s\n"), mail_subject);
     g_free(mail_subject);
     g_free(mail_site);
 
     /* now create & return the widget... */
     mw = g_object_new(BALSA_TYPE_MIME_WIDGET, NULL);
-
+    
     widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, BMW_VBOX_SPACE);
     g_object_set(G_OBJECT(widget), "margin", BMW_CONTAINER_BORDER, NULL);
 
@@ -310,12 +296,12 @@ bmw_message_extbody_mail(LibBalsaMessageBody *mime_body)
     g_string_free(msg, TRUE);
 
     button =
-        gtk_button_new_with_mnemonic(_
-                                         ("Se_nd message to obtain this part"));
+       gtk_button_new_with_mnemonic(_
+                                    ("Se_nd message to obtain this part"));
     gtk_widget_set_margin_top(button, BMW_BUTTON_PACK_SPACE);
     gtk_box_pack_start(GTK_BOX(widget), button);
     g_signal_connect(G_OBJECT(button), "clicked",
-                     G_CALLBACK(extbody_send_mail), (gpointer) mime_body);
+                    G_CALLBACK(extbody_send_mail), (gpointer) mime_body);
 
     balsa_mime_widget_set_widget(mw, widget);
 
@@ -324,8 +310,7 @@ bmw_message_extbody_mail(LibBalsaMessageBody *mime_body)
 
 
 static void
-extbody_call_url(GtkWidget *button,
-                 gpointer   data)
+extbody_call_url(GtkWidget * button, gpointer data)
 {
     gchar *url = g_object_get_data(G_OBJECT(button), "call_url");
     GtkWidget *toplevel;
@@ -339,16 +324,14 @@ extbody_call_url(GtkWidget *button,
     }
 
     if (err) {
-        balsa_information(LIBBALSA_INFORMATION_WARNING,
-                          _("Error showing %s: %s\n"), url, err->message);
-        g_error_free(err);
+       balsa_information(LIBBALSA_INFORMATION_WARNING,
+                         _("Error showing %s: %s\n"), url, err->message);
+       g_error_free(err);
     }
 }
 
-
 static void
-extbody_send_mail(GtkWidget           *button,
-                  LibBalsaMessageBody *mime_body)
+extbody_send_mail(GtkWidget * button, LibBalsaMessageBody * mime_body)
 {
     LibBalsaMessage *message;
     LibBalsaMessageBody *body;
@@ -364,7 +347,7 @@ extbody_send_mail(GtkWidget           *button,
 
     data = libbalsa_message_body_get_parameter(mime_body, "subject");
     if (data) {
-        libbalsa_message_set_subject(message, data);
+       libbalsa_message_set_subject(message, data);
         g_free(data);
     }
 
@@ -375,7 +358,7 @@ extbody_send_mail(GtkWidget           *button,
     /* the original body my have some data to be returned as commands... */
     body = libbalsa_message_body_new(message);
 
-    if (libbalsa_message_body_get_content(mime_body, &data, &err) < 0) {
+    if(libbalsa_message_body_get_content(mime_body, &data, &err)<0) {
         balsa_information(LIBBALSA_INFORMATION_ERROR,
                           _("Could not get a part: %s"),
                           err ? err->message : "Unknown error");
@@ -383,34 +366,31 @@ extbody_send_mail(GtkWidget           *button,
     }
 
     if (data) {
-        gchar *p;
-
-        /* ignore everything before the first two newlines */
-        if ((p = strstr(data, "\n\n"))) {
-            body->buffer = g_strdup(p + 2);
-        } else {
-            body->buffer = g_strdup(data);
-        }
-        g_free(data);
-    }
-    if (mime_body->charset) {
-        body->charset = g_strdup(mime_body->charset);
-    } else {
-        body->charset = g_strdup("US-ASCII");
+       gchar *p;
+
+       /* ignore everything before the first two newlines */
+       if ((p = strstr(data, "\n\n")))
+           body->buffer = g_strdup(p + 2);
+       else
+           body->buffer = g_strdup(data);
+       g_free(data);
     }
+    if (mime_body->charset)
+       body->charset = g_strdup(mime_body->charset);
+    else
+       body->charset = g_strdup("US-ASCII");
     libbalsa_message_append_part(message, body);
     result = libbalsa_message_send(message, balsa_app.outbox, NULL,
-                                   balsa_find_sentbox_by_url,
-                                   balsa_app.current_ident->smtp_server,
-                                   balsa_app.send_progress_dialog,
+                                  balsa_find_sentbox_by_url,
+                                  balsa_app.current_ident->smtp_server,
+                                  balsa_app.send_progress_dialog,
                                    GTK_WINDOW(gtk_widget_get_toplevel
-                                                  (button)),
-                                   FALSE, &err);
-    if (result != LIBBALSA_MESSAGE_CREATE_OK) {
-        libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                             _("Sending the external body request failed: %s"),
-                             err ? err->message : "?");
-    }
+                                              (button)),
+                                  FALSE, &err);
+    if (result != LIBBALSA_MESSAGE_CREATE_OK)
+       libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                            _("Sending the external body request failed: %s"),
+                            err ? err->message : "?");
     g_error_free(err);
     g_object_unref(G_OBJECT(message));
 }
@@ -419,8 +399,8 @@ extbody_send_mail(GtkWidget           *button,
 /* ----- message/rfc822 related stuff ----- */
 
 BalsaMimeWidget *
-balsa_mime_widget_new_message_tl(BalsaMessage     *bm,
-                                 GtkWidget *const *tl_buttons)
+balsa_mime_widget_new_message_tl(BalsaMessage * bm,
+                                 GtkWidget * const * tl_buttons)
 {
     GtkWidget *headers;
     BalsaMimeWidget *mw;
@@ -453,17 +433,14 @@ balsa_mime_widget_new_message_tl(BalsaMessage     *bm,
     g_object_get_data(G_OBJECT(header_widget), BALSA_MESSAGE_GRID)
 
 static void
-bm_header_ctx_menu_reply(GtkWidget           *menu_item,
+bm_header_ctx_menu_reply(GtkWidget * menu_item,
                          LibBalsaMessageBody *part)
 {
     sendmsg_window_reply_embedded(part, SEND_REPLY);
 }
 
-
 static void
-bm_header_extend_popup(GtkWidget *widget,
-                       GtkMenu   *menu,
-                       gpointer   arg)
+bm_header_extend_popup(GtkWidget * widget, GtkMenu * menu, gpointer arg)
 {
     GtkWidget *menu_item, *submenu;
     GtkWidget *separator = gtk_separator_menu_item_new();
@@ -481,17 +458,15 @@ bm_header_extend_popup(GtkWidget *widget,
 
     submenu =
         balsa_mblist_mru_menu(GTK_WINDOW
-                                  (gtk_widget_get_toplevel(widget)),
+                              (gtk_widget_get_toplevel(widget)),
                               &balsa_app.folder_mru,
                               G_CALLBACK(balsa_message_copy_part), arg);
     gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item),
                               submenu);
 }
 
-
 static GtkWidget *
-bm_header_widget_new(BalsaMessage     *bm,
-                     GtkWidget *const *buttons)
+bm_header_widget_new(BalsaMessage * bm, GtkWidget * const * buttons)
 {
     GtkWidget *grid;
 #ifdef GTK_INFO_BAR_WRAPPING_IS_BROKEN
@@ -508,9 +483,9 @@ bm_header_widget_new(BalsaMessage     *bm,
     gtk_grid_set_column_spacing(GTK_GRID(grid), 12);
 
     g_signal_connect(grid, "notify::has-focus",
-                     G_CALLBACK(balsa_mime_widget_check_focus), bm);
+                    G_CALLBACK(balsa_mime_widget_check_focus), bm);
     g_signal_connect(grid, "key_press_event",
-                     G_CALLBACK(balsa_mime_widget_key_press_event), bm);
+                    G_CALLBACK(balsa_mime_widget_key_press_event), bm);
 
 #ifdef GTK_INFO_BAR_WRAPPING_IS_BROKEN
     hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
@@ -560,65 +535,52 @@ bm_header_widget_new(BalsaMessage     *bm,
     return widget;
 }
 
-
 static gboolean
-label_size_allocate_cb(GtkLabel     *label,
-                       GdkRectangle *rectangle,
-                       gint          baseline,
-                       GdkRectangle *clip,
-                       GtkWidget    *expander)
+label_size_allocate_cb(GtkLabel * label, GdkRectangle * rectangle,
+                       gint baseline, GdkRectangle * clip,
+                       GtkWidget * expander)
 {
     PangoLayout *layout;
 
     layout = gtk_label_get_layout(label);
 
     if (pango_layout_is_wrapped(layout)
-        || pango_layout_is_ellipsized(layout)) {
+        || pango_layout_is_ellipsized(layout))
         gtk_widget_show(expander);
-    } else {
+    else
         gtk_widget_hide(expander);
-    }
 
     return FALSE;
 }
 
-
 static void
-expanded_cb(GtkExpander *expander,
-            GParamSpec  *arg1,
-            GtkLabel    *label)
+expanded_cb(GtkExpander * expander, GParamSpec * arg1, GtkLabel * label)
 {
     gtk_label_set_ellipsize(label,
                             gtk_expander_get_expanded(expander) ?
                             PANGO_ELLIPSIZE_NONE : PANGO_ELLIPSIZE_END);
 }
 
-
 #define BALSA_MESSAGE_HEADER "balsa-message-header"
 
 static void
-add_header_gchar(GtkGrid     *grid,
-                 const gchar *header,
-                 const gchar *label,
-                 const gchar *value,
-                 gboolean     show_all_headers)
+add_header_gchar(GtkGrid * grid, const gchar * header, const gchar * label,
+                const gchar * value, gboolean show_all_headers)
 {
     gchar *css;
     GtkCssProvider *css_provider;
     GtkWidget *lab;
 
     if (!(show_all_headers ||
-          libbalsa_find_word(header, balsa_app.selected_headers))) {
-        return;
-    }
+         libbalsa_find_word(header, balsa_app.selected_headers)))
+       return;
 
     if (balsa_app.use_system_fonts) {
-        if (strcmp(header, "subject") == 0) {
+        if (strcmp(header, "subject") == 0)
             /* Use bold for the subject line */
             css = g_strdup("#" BALSA_MESSAGE_HEADER " {font-weight:bold}");
-        } else {
+        else
             css = g_strdup("");
-        }
     } else {
         css = libbalsa_font_string_to_css(strcmp(header, "subject")
                                           ? balsa_app.message_font
@@ -632,7 +594,7 @@ add_header_gchar(GtkGrid     *grid,
 
     lab = gtk_label_new(label);
     gtk_widget_set_name(lab, BALSA_MESSAGE_HEADER);
-    gtk_style_context_add_provider(gtk_widget_get_style_context(lab),
+    gtk_style_context_add_provider(gtk_widget_get_style_context(lab) ,
                                    GTK_STYLE_PROVIDER(css_provider),
                                    GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
 
@@ -641,7 +603,7 @@ add_header_gchar(GtkGrid     *grid,
     gtk_widget_set_halign(lab, GTK_ALIGN_START);
     gtk_widget_set_valign(lab, GTK_ALIGN_START);
 
-    if (value && (*value != '\0')) {
+    if (value && *value != '\0') {
         gchar *sanitized;
         GtkWidget *value_label;
         GtkWidget *expander;
@@ -655,7 +617,7 @@ add_header_gchar(GtkGrid     *grid,
         g_free(sanitized);
 
         gtk_widget_set_name(value_label, BALSA_MESSAGE_HEADER);
-        gtk_style_context_add_provider(gtk_widget_get_style_context(value_label),
+        gtk_style_context_add_provider(gtk_widget_get_style_context(value_label) ,
                                        GTK_STYLE_PROVIDER(css_provider),
                                        GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
 
@@ -692,25 +654,20 @@ add_header_gchar(GtkGrid     *grid,
     g_object_unref(css_provider);
 }
 
-
 static void
-add_header_address_list(BalsaMessage        *bm,
-                        GtkGrid             *grid,
-                        gchar               *header,
-                        gchar               *label,
-                        InternetAddressList *list,
-                        gboolean             show_all_headers)
+add_header_address_list(BalsaMessage * bm, GtkGrid * grid,
+                       gchar * header, gchar * label,
+                       InternetAddressList * list,
+                        gboolean show_all_headers)
 {
     gchar *value;
 
-    if ((list == NULL) || (internet_address_list_length(list) == 0)) {
-        return;
-    }
+    if (list == NULL || internet_address_list_length(list) == 0)
+       return;
 
-    if (!((bm->shown_headers == HEADERS_ALL) ||
-          libbalsa_find_word(header, balsa_app.selected_headers))) {
-        return;
-    }
+    if (!(bm->shown_headers == HEADERS_ALL ||
+         libbalsa_find_word(header, balsa_app.selected_headers)))
+       return;
 
     value = internet_address_list_to_string(list, FALSE);
 
@@ -719,39 +676,34 @@ add_header_address_list(BalsaMessage        *bm,
     g_free(value);
 }
 
-
 static void
-foreach_label(GtkWidget           *widget,
-              LibBalsaMessageBody *part)
+foreach_label(GtkWidget * widget, LibBalsaMessageBody * part)
 {
     g_assert(widget != NULL);
 
-    if (GTK_IS_CONTAINER(widget)) {
+    if (GTK_IS_CONTAINER(widget))
         gtk_container_foreach((GtkContainer *) widget,
                               (GtkCallback) foreach_label, part);
-    } else if (GTK_IS_LABEL(widget)) {
+    else if (GTK_IS_LABEL(widget))
         g_signal_connect(widget, "populate-popup",
                          G_CALLBACK(bm_header_extend_popup), part);
-    }
 }
 
-
 static void
-bmw_message_set_headers_d(BalsaMessage           *bm,
-                          BalsaMimeWidget        *mw,
-                          LibBalsaMessageHeaders *headers,
-                          LibBalsaMessageBody    *part,
-                          const gchar            *subject,
-                          gboolean                show_all_headers)
+bmw_message_set_headers_d(BalsaMessage           * bm,
+                          BalsaMimeWidget        * mw,
+                          LibBalsaMessageHeaders * headers,
+                          LibBalsaMessageBody    * part,
+                          const gchar            * subject,
+                          gboolean                 show_all_headers)
 {
     GtkGrid *grid;
     GList *p;
     gchar *date;
-    GtkWidget *widget;
+    GtkWidget * widget;
 
-    if ((widget = balsa_mime_widget_get_header_widget(mw)) == NULL) {
-        return;
-    }
+    if ((widget = balsa_mime_widget_get_header_widget(mw)) == NULL)
+       return;
 
     grid = bm_header_widget_get_grid(widget);
     gtk_container_foreach(GTK_CONTAINER(grid),
@@ -768,7 +720,7 @@ bmw_message_set_headers_d(BalsaMessage           *bm,
     if (bm->shown_headers == HEADERS_NONE) {
         g_signal_connect(G_OBJECT(widget), "realize",
                          G_CALLBACK(gtk_widget_hide), NULL);
-        return;
+       return;
     }
 
     bm->tab_position = 0;
@@ -777,23 +729,23 @@ bmw_message_set_headers_d(BalsaMessage           *bm,
                      show_all_headers);
 
     date = libbalsa_message_headers_date_to_utf8(headers,
-                                                 balsa_app.date_string);
+                                                balsa_app.date_string);
     add_header_gchar(grid, "date", _("Date:"), date, show_all_headers);
     g_free(date);
 
     if (headers->from) {
-        gchar *from =
-            internet_address_list_to_string(headers->from, FALSE);
-        add_header_gchar(grid, "from", _("From:"), from, show_all_headers);
-        g_free(from);
+       gchar *from =
+           internet_address_list_to_string(headers->from, FALSE);
+       add_header_gchar(grid, "from", _("From:"), from, show_all_headers);
+       g_free(from);
     }
 
     if (headers->reply_to) {
-        gchar *reply_to =
-            internet_address_list_to_string(headers->reply_to, FALSE);
-        add_header_gchar(grid, "reply-to", _("Reply-To:"), reply_to,
+       gchar *reply_to =
+           internet_address_list_to_string(headers->reply_to, FALSE);
+       add_header_gchar(grid, "reply-to", _("Reply-To:"), reply_to,
                          show_all_headers);
-        g_free(reply_to);
+       g_free(reply_to);
     }
     add_header_address_list(bm, grid, "to", _("To:"), headers->to_list,
                             show_all_headers);
@@ -803,55 +755,52 @@ bmw_message_set_headers_d(BalsaMessage           *bm,
                             show_all_headers);
 
 #if BALSA_SHOW_FCC_AS_WELL_AS_X_BALSA_FCC
-    if (headers->fcc_url) {
-        add_header_gchar(grid, "fcc", _("FCC:"), headers->fcc_url,
+    if (headers->fcc_url)
+       add_header_gchar(grid, "fcc", _("FCC:"), headers->fcc_url,
                          show_all_headers);
-    }
 #endif
 
     if (headers->dispnotify_to) {
-        gchar *mdn_to =
-            internet_address_list_to_string(headers->dispnotify_to, FALSE);
-        add_header_gchar(grid, "disposition-notification-to",
-                         _("Disposition-Notification-To:"), mdn_to,
+       gchar *mdn_to =
+           internet_address_list_to_string(headers->dispnotify_to, FALSE);
+       add_header_gchar(grid, "disposition-notification-to",
+                        _("Disposition-Notification-To:"), mdn_to,
                          show_all_headers);
-        g_free(mdn_to);
+       g_free(mdn_to);
     }
 
     /* remaining headers */
     for (p = headers->user_hdrs; p != NULL; p = p->next) {
-        gchar **pair = p->data;
-        gchar *hdr;
+       gchar **pair = p->data;
+       gchar *hdr;
 
-        hdr = g_strconcat(pair[0], ":", NULL);
-        add_header_gchar(grid, pair[0], hdr, pair[1], show_all_headers);
-        g_free(hdr);
+       hdr = g_strconcat(pair[0], ":", NULL);
+       add_header_gchar(grid, pair[0], hdr, pair[1], show_all_headers);
+       g_free(hdr);
     }
 
 #ifdef HAVE_GPGME
     if (part) {
-        if (part->parts
-            && part->parts->next
-            && part->parts->next->sig_info
-            && (part->parts->next->sig_info->status !=
-                GPG_ERR_NOT_SIGNED)) {
-            /* top-level part is RFC 3156 or RFC 2633 signed */
-            add_header_sigstate(grid, part->parts->next->sig_info);
-        } else if (part->sig_info
-                   && (part->sig_info->status != GPG_ERR_NOT_SIGNED)) {
-            /* top-level is OpenPGP (RFC 2440) signed */
-            add_header_sigstate(grid, part->sig_info);
-        }
+       if (part->parts
+           && part->parts->next
+           && part->parts->next->sig_info
+           && part->parts->next->sig_info->status !=
+           GPG_ERR_NOT_SIGNED)
+           /* top-level part is RFC 3156 or RFC 2633 signed */
+           add_header_sigstate(grid, part->parts->next->sig_info);
+       else if (part->sig_info
+                && part->sig_info->status != GPG_ERR_NOT_SIGNED)
+           /* top-level is OpenPGP (RFC 2440) signed */
+           add_header_sigstate(grid, part->sig_info);
     }
 #endif
 }
 
-
 static void
-bmw_message_set_headers(BalsaMessage        *bm,
-                        BalsaMimeWidget     *mw,
-                        LibBalsaMessageBody *part,
-                        gboolean             show_all_headers)
+bmw_message_set_headers(BalsaMessage        * bm,
+                        BalsaMimeWidget     * mw,
+                        LibBalsaMessageBody * part,
+                        gboolean              show_all_headers)
 {
     GtkWidget *widget;
     GtkGrid *grid;
@@ -860,46 +809,41 @@ bmw_message_set_headers(BalsaMessage        *bm,
                               part->embhdrs ? part->embhdrs->subject : NULL,
                               show_all_headers);
 
-    if ((widget = balsa_mime_widget_get_header_widget(mw)) == NULL) {
-        return;
-    }
+    if ((widget = balsa_mime_widget_get_header_widget(mw)) == NULL)
+       return;
 
     grid = bm_header_widget_get_grid(widget);
     gtk_container_foreach(GTK_CONTAINER(grid), (GtkCallback) foreach_label,
                           part);
 }
 
-
 void
-balsa_mime_widget_message_set_headers(BalsaMessage        *bm,
-                                      BalsaMimeWidget     *mw,
-                                      LibBalsaMessageBody *part)
+balsa_mime_widget_message_set_headers(BalsaMessage        * bm,
+                                      BalsaMimeWidget     * mw,
+                                      LibBalsaMessageBody * part)
 {
     bmw_message_set_headers(bm, mw, part,
                             bm->shown_headers == HEADERS_ALL);
 }
 
-
 void
-balsa_mime_widget_message_set_headers_d(BalsaMessage           *bm,
-                                        BalsaMimeWidget        *mw,
-                                        LibBalsaMessageHeaders *headers,
-                                        LibBalsaMessageBody    *part,
-                                        const gchar            *subject)
+balsa_mime_widget_message_set_headers_d(BalsaMessage           * bm,
+                                        BalsaMimeWidget        * mw,
+                                        LibBalsaMessageHeaders * headers,
+                                        LibBalsaMessageBody    * part,
+                                        const gchar            * subject)
 {
     bmw_message_set_headers_d(bm, mw, headers, part, subject,
                               bm->shown_headers == HEADERS_ALL);
 }
 
-
 #ifdef HAVE_GPGME
 /*
  * Add the short status of a signature info siginfo to the message headers in
  * view
  */
 static void
-add_header_sigstate(GtkGrid           *grid,
-                    GMimeGpgmeSigstat *siginfo)
+add_header_sigstate(GtkGrid * grid, GMimeGpgmeSigstat * siginfo)
 {
     gchar *format;
     gchar *msg;
@@ -908,9 +852,9 @@ add_header_sigstate(GtkGrid           *grid,
     format = siginfo->status ==
         GPG_ERR_NO_ERROR ? "<i>%s%s</i>" : "<b><i>%s%s</i></b>";
     msg = g_markup_printf_escaped
-            (format,
-            g_mime_gpgme_sigstat_protocol_name(siginfo),
-            libbalsa_gpgme_sig_stat_to_gchar(siginfo->status));
+        (format,
+               g_mime_gpgme_sigstat_protocol_name(siginfo),
+         libbalsa_gpgme_sig_stat_to_gchar(siginfo->status));
 
     label = gtk_label_new(NULL);
     gtk_label_set_markup(GTK_LABEL(label), msg);
@@ -919,6 +863,4 @@ add_header_sigstate(GtkGrid           *grid,
 
     gtk_grid_attach_next_to(grid, label, NULL, GTK_POS_BOTTOM, 2, 1);
 }
-
-
 #endif
diff --git a/src/balsa-mime-widget-message.h b/src/balsa-mime-widget-message.h
index a30f6ee..da803f3 100644
--- a/src/balsa-mime-widget-message.h
+++ b/src/balsa-mime-widget-message.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -27,28 +27,26 @@
 G_BEGIN_DECLS
 
 
-BalsaMimeWidget *balsa_mime_widget_new_message(BalsaMessage        *bm,
-                                               LibBalsaMessageBody *mime_body,
-                                               const gchar         *content_type,
-                                               gpointer             data);
-BalsaMimeWidget *balsa_mime_widget_new_message_tl(BalsaMessage *bm,
+BalsaMimeWidget *balsa_mime_widget_new_message(BalsaMessage * bm,
+                                              LibBalsaMessageBody * mime_body,
+                                              const gchar * content_type, gpointer data);
+BalsaMimeWidget *balsa_mime_widget_new_message_tl(BalsaMessage * bm,
                                                   GtkWidget *
-                                                  const        *tl_buttons);
-void balsa_mime_widget_message_set_headers(BalsaMessage        *bm,
-                                           BalsaMimeWidget     *mw,
-                                           LibBalsaMessageBody *part);
-
-/* balsa_mime_widget_message_set_headers_d is called for
-   LibBalsaMessage only and is deprecated. Instead, the object
-   hierarchy should be fixed so that LibBalsaMessage is derived
-   from LibBalsaMessagePart or similar. */
-void balsa_mime_widget_message_set_headers_d(BalsaMessage           *bm,
-                                             BalsaMimeWidget        *mw,
+                                                  const *tl_buttons);
+void balsa_mime_widget_message_set_headers(BalsaMessage * bm,
+                                           BalsaMimeWidget *mw,
+                                          LibBalsaMessageBody *part);
+    /* balsa_mime_widget_message_set_headers_d is called for
+       LibBalsaMessage only and is deprecated. Instead, the object
+       hierarchy should be fixed so that LibBalsaMessage is derived
+       from LibBalsaMessagePart or similar. */
+void balsa_mime_widget_message_set_headers_d(BalsaMessage * bm,
+                                             BalsaMimeWidget *mw,
                                              LibBalsaMessageHeaders *h,
-                                             LibBalsaMessageBody    *parts,
-                                             const gchar            *subject);
+                                             LibBalsaMessageBody *parts,
+                                             const gchar *subject);
 
 
 G_END_DECLS
 
-#endif                          /* __BALSA_MIME_WIDGET_MESSAGE_H__ */
+#endif                         /* __BALSA_MIME_WIDGET_MESSAGE_H__ */
diff --git a/src/balsa-mime-widget-multipart.c b/src/balsa-mime-widget-multipart.c
index 1152228..a5ece75 100644
--- a/src/balsa-mime-widget-multipart.c
+++ b/src/balsa-mime-widget-multipart.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-mime-widget-multipart.h"
 
@@ -29,10 +29,9 @@
 
 
 BalsaMimeWidget *
-balsa_mime_widget_new_multipart(BalsaMessage        *bm,
-                                LibBalsaMessageBody *mime_body,
-                                const gchar         *content_type,
-                                gpointer             data)
+balsa_mime_widget_new_multipart(BalsaMessage * bm,
+                               LibBalsaMessageBody * mime_body,
+                               const gchar * content_type, gpointer data)
 {
     BalsaMimeWidget *mw;
     GtkWidget *widget;
@@ -47,13 +46,13 @@ balsa_mime_widget_new_multipart(BalsaMessage        *bm,
 
 #ifdef HAVE_GPGME
     if (!g_ascii_strcasecmp("multipart/signed", content_type) &&
-        mime_body->parts && mime_body->parts->next &&
-        mime_body->parts->next->sig_info) {
-        GtkWidget *crypto_frame;
+       mime_body->parts && mime_body->parts->next &&
+       mime_body->parts->next->sig_info) {
+        GtkWidget * crypto_frame;
 
-        crypto_frame =
-            balsa_mime_widget_crypto_frame(mime_body->parts->next, widget,
-                                           mime_body->was_encrypted, FALSE, NULL);
+       crypto_frame =
+           balsa_mime_widget_crypto_frame(mime_body->parts->next, widget,
+                                          mime_body->was_encrypted, FALSE, NULL);
         balsa_mime_widget_set_widget(mw, crypto_frame);
     }
 #endif
diff --git a/src/balsa-mime-widget-multipart.h b/src/balsa-mime-widget-multipart.h
index 1d7df4c..2a92cde 100644
--- a/src/balsa-mime-widget-multipart.h
+++ b/src/balsa-mime-widget-multipart.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -27,12 +27,11 @@
 G_BEGIN_DECLS
 
 
-BalsaMimeWidget *balsa_mime_widget_new_multipart(BalsaMessage        *bm,
-                                                 LibBalsaMessageBody *mime_body,
-                                                 const gchar         *content_type,
-                                                 gpointer             data);
+BalsaMimeWidget *balsa_mime_widget_new_multipart(BalsaMessage * bm,
+                                                LibBalsaMessageBody * mime_body,
+                                                const gchar * content_type, gpointer data);
 
 
 G_END_DECLS
 
-#endif                          /* __BALSA_MIME_WIDGET_IMAGE_H__ */
+#endif                         /* __BALSA_MIME_WIDGET_IMAGE_H__ */
diff --git a/src/balsa-mime-widget-text.c b/src/balsa-mime-widget-text.c
index 9df3707..f5a294b 100644
--- a/src/balsa-mime-widget-text.c
+++ b/src/balsa-mime-widget-text.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-mime-widget-text.h"
 
@@ -35,32 +35,25 @@
 #include "balsa-cite-bar.h"
 
 #if HAVE_GTKSOURCEVIEW
-#   include <gtksourceview/gtksource.h>
+#include <gtksourceview/gtksource.h>
 #endif
 
 
-static GtkWidget *create_text_widget(const char *content_type);
-static void bm_modify_font_from_string(GtkWidget  *widget,
-                                       const char *font);
-static GtkTextTag *quote_tag(GtkTextBuffer *buffer,
-                             gint           level,
-                             gint           margin);
-static gboolean fix_text_widget(GtkWidget *widget,
-                                gpointer   data);
-static void text_view_populate_popup(GtkWidget *widget,
-                                     GtkMenu   *menu,
-                                     gpointer   user_data);
+static GtkWidget * create_text_widget(const char * content_type);
+static void bm_modify_font_from_string(GtkWidget * widget, const char *font);
+static GtkTextTag * quote_tag(GtkTextBuffer * buffer, gint level, gint margin);
+static gboolean fix_text_widget(GtkWidget *widget, gpointer data);
+static void text_view_populate_popup(GtkWidget *widget, GtkMenu *menu,
+                                     gpointer user_data);
 
 #ifdef HAVE_HTML_WIDGET
-static BalsaMimeWidget *bm_widget_new_html(BalsaMessage *bm,
+static BalsaMimeWidget *bm_widget_new_html(BalsaMessage * bm,
                                            LibBalsaMessageBody *
                                            mime_body);
-
 #endif
-static BalsaMimeWidget *bm_widget_new_vcard(BalsaMessage        *bm,
-                                            LibBalsaMessageBody *mime_body,
-                                            gchar               *ptr,
-                                            size_t               len);
+static BalsaMimeWidget * bm_widget_new_vcard(BalsaMessage * bm,
+                                             LibBalsaMessageBody * mime_body,
+                                             gchar * ptr, size_t len);
 
 /* URL related stuff */
 typedef struct _message_url_t {
@@ -79,19 +72,19 @@ typedef struct {
     gint y_pos;
     gint height;
     guint depth;
-    GtkWidget *bar;
+    GtkWidget * bar;
 } cite_bar_t;
 
 /* store the coordinates at which the button was pressed */
 static gint stored_x = -1, stored_y = -1;
 static GdkModifierType stored_mask = -1;
-#define STORED_MASK_BITS (GDK_SHIFT_MASK   \
+#define STORED_MASK_BITS (  GDK_SHIFT_MASK   \
                           | GDK_CONTROL_MASK \
                           | GDK_MOD1_MASK    \
                           | GDK_MOD2_MASK    \
                           | GDK_MOD3_MASK    \
                           | GDK_MOD4_MASK    \
-                          | GDK_MOD5_MASK)
+                          | GDK_MOD5_MASK    )
 
 /* the cursors which are displayed over URL's and normal message text */
 static GdkCursor *url_cursor_normal = NULL;
@@ -103,39 +96,30 @@ static void store_button_coords(GtkGestureMultiPress *multi_press,
                                 gdouble               x,
                                 gdouble               y,
                                 gpointer              user_data);
-static void check_over_url(BalsaMimeWidgetText *mwt,
-                           message_url_t       *url);
-static void pointer_over_url(GtkWidget     *widget,
-                             message_url_t *url,
-                             gboolean       set);
-static void prepare_url_offsets(GtkTextBuffer *buffer,
-                                GList         *url_list);
-static void url_found_cb(GtkTextBuffer *buffer,
-                         GtkTextIter   *iter,
-                         const gchar   *buf,
-                         guint          len,
-                         gpointer       data);
+static void check_over_url(BalsaMimeWidgetText * mwt,
+                           message_url_t       * url);
+static void pointer_over_url(GtkWidget * widget, message_url_t * url, gboolean set);
+static void prepare_url_offsets(GtkTextBuffer * buffer, GList * url_list);
+static void url_found_cb(GtkTextBuffer * buffer, GtkTextIter * iter,
+                         const gchar * buf, guint len, gpointer data);
 static void check_call_url(GtkGestureMultiPress *multi_press,
                            gint                  n_press,
                            gdouble               x,
                            gdouble               y,
                            gpointer              user_data);
-static message_url_t *find_url(BalsaMimeWidgetText *mwt,
-                               gint                 x,
-                               gint                 y);
-static void handle_url(const gchar *url);
-static void free_url(message_url_t *url);
+static message_url_t * find_url(BalsaMimeWidgetText *mwt,
+                                gint                 x,
+                                gint                 y);
+static void handle_url(const gchar* url);
+static void free_url(message_url_t * url);
 static void bm_widget_on_url(const gchar *url);
-static void phrase_highlight(GtkTextBuffer *buffer,
-                             const gchar   *id,
-                             gunichar       tag_char,
-                             const gchar   *property,
-                             gint           value);
-static gboolean draw_cite_bars(GtkWidget *widget,
-                               cairo_t   *cr,
-                               gpointer   user_data);
-static gchar *check_text_encoding(BalsaMessage *bm,
-                                  gchar        *text_buf);
+static void phrase_highlight(GtkTextBuffer * buffer, const gchar * id,
+                            gunichar tag_char, const gchar * property,
+                            gint value);
+static gboolean draw_cite_bars(GtkWidget * widget,
+                               cairo_t   * cr,
+                               gpointer    user_data);
+static gchar *check_text_encoding(BalsaMessage * bm, gchar *text_buf);
 static void fill_text_buf_cited(BalsaMimeWidgetText *mwt,
                                 GtkWidget           *widget,
                                 const gchar         *text_body,
@@ -161,24 +145,23 @@ struct _BalsaMimeWidgetTextClass {
 };
 
 struct _BalsaMimeWidgetText {
-    BalsaMimeWidget parent_instance;
+    BalsaMimeWidget      parent_instance;
 
-    GtkWidget *text_widget;
-    GList *url_list;
-    message_url_t *current_url;
+    GtkWidget           *text_widget;
+    GList               *url_list;
+    message_url_t       *current_url;
     LibBalsaMessageBody *mime_body;
-    GtkGesture *gesture;
-    GtkEventController *controller;
-    GList *cite_bar_list;
-    gint cite_bar_dimension;
-    gint phrase_hl;
+    GtkGesture          *gesture;
+    GtkEventController  *controller;
+    GList               *cite_bar_list;
+    gint                 cite_bar_dimension;
+    gint                 phrase_hl;
 };
 
 G_DEFINE_TYPE(BalsaMimeWidgetText, balsa_mime_widget_text, BALSA_TYPE_MIME_WIDGET)
 
 static void
-balsa_mime_widget_text_dispose(GObject *object)
-{
+balsa_mime_widget_text_dispose(GObject * object) {
     BalsaMimeWidgetText *mwt;
 
     mwt = BALSA_MIME_WIDGET_TEXT(object);
@@ -189,10 +172,8 @@ balsa_mime_widget_text_dispose(GObject *object)
     G_OBJECT_CLASS(balsa_mime_widget_text_parent_class)->dispose(object);
 }
 
-
 static void
-balsa_mime_widget_text_finalize(GObject *object)
-{
+balsa_mime_widget_text_finalize(GObject * object) {
     BalsaMimeWidgetText *mwt;
 
     mwt = BALSA_MIME_WIDGET_TEXT(object);
@@ -202,23 +183,20 @@ balsa_mime_widget_text_finalize(GObject *object)
     G_OBJECT_CLASS(balsa_mime_widget_text_parent_class)->finalize(object);
 }
 
-
 static void
-balsa_mime_widget_text_class_init(BalsaMimeWidgetTextClass *klass)
+balsa_mime_widget_text_class_init(BalsaMimeWidgetTextClass * klass)
 {
     GObjectClass *object_class = (GObjectClass *) klass;
 
-    object_class->dispose = balsa_mime_widget_text_dispose;
+    object_class->dispose  = balsa_mime_widget_text_dispose;
     object_class->finalize = balsa_mime_widget_text_finalize;
 }
 
-
 static void
-balsa_mime_widget_text_init(BalsaMimeWidgetText *self)
+balsa_mime_widget_text_init(BalsaMimeWidgetText * self)
 {
 }
 
-
 /*
  * End of class definition
  */
@@ -228,10 +206,10 @@ balsa_mime_widget_text_init(BalsaMimeWidgetText *self)
  */
 
 static void
-mwt_controller_motion_cb(GtkEventControllerMotion *motion,
-                         gdouble                   x,
-                         gdouble                   y,
-                         gpointer                  user_data)
+mwt_controller_motion_cb(GtkEventControllerMotion * motion,
+                         gdouble                    x,
+                         gdouble                    y,
+                         gpointer                   user_data)
 {
     BalsaMimeWidgetText *mwt = user_data;
     message_url_t *url;
@@ -240,24 +218,20 @@ mwt_controller_motion_cb(GtkEventControllerMotion *motion,
     check_over_url(mwt, url);
 }
 
-
 static void
-mwt_controller_leave_cb(GtkEventControllerMotion *motion,
-                        gdouble                   x,
-                        gdouble                   y,
-                        gpointer                  user_data)
+mwt_controller_leave_cb(GtkEventControllerMotion * motion,
+                        gdouble                    x,
+                        gdouble                    y,
+                        gpointer                   user_data)
 {
     BalsaMimeWidgetText *mwt = user_data;
 
     check_over_url(mwt, NULL);
 }
 
-
 BalsaMimeWidget *
-balsa_mime_widget_new_text(BalsaMessage        *bm,
-                           LibBalsaMessageBody *mime_body,
-                           const gchar         *content_type,
-                           gpointer             data)
+balsa_mime_widget_new_text(BalsaMessage * bm, LibBalsaMessageBody * mime_body,
+                          const gchar * content_type, gpointer data)
 {
     LibBalsaHTMLType html_type;
     gchar *ptr = NULL;
@@ -294,8 +268,8 @@ balsa_mime_widget_new_text(BalsaMessage        *bm,
         return NULL;
     }
 
-    if ((g_ascii_strcasecmp(content_type, "text/x-vcard") == 0) ||
-        (g_ascii_strcasecmp(content_type, "text/directory") == 0)) {
+    if(g_ascii_strcasecmp(content_type, "text/x-vcard") == 0 ||
+       g_ascii_strcasecmp(content_type, "text/directory") == 0) {
         mw = bm_widget_new_vcard(bm, mime_body, ptr, alloced);
         if (mw) {
             g_free(ptr);
@@ -314,34 +288,32 @@ balsa_mime_widget_new_text(BalsaMessage        *bm,
 
     /* configure text or source view */
     gtk_text_view_set_editable(GTK_TEXT_VIEW(widget), FALSE);
-    gtk_text_view_set_left_margin(GTK_TEXT_VIEW(widget), BALSA_LEFT_MARGIN);
+    gtk_text_view_set_left_margin(GTK_TEXT_VIEW(widget),  BALSA_LEFT_MARGIN);
     gtk_text_view_set_right_margin(GTK_TEXT_VIEW(widget), BALSA_RIGHT_MARGIN);
     gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(widget), GTK_WRAP_WORD_CHAR);
 
     /* set the message font */
-    if (!balsa_app.use_system_fonts) {
+    if (!balsa_app.use_system_fonts)
         bm_modify_font_from_string(widget, balsa_app.message_font);
-    }
 
     if (libbalsa_message_body_is_flowed(mime_body)) {
-        /* Parse, but don't wrap. */
-        gboolean delsp = libbalsa_message_body_is_delsp(mime_body);
-        ptr = libbalsa_wrap_rfc2646(ptr, G_MAXINT, FALSE, TRUE, delsp);
+       /* Parse, but don't wrap. */
+       gboolean delsp = libbalsa_message_body_is_delsp(mime_body);
+       ptr = libbalsa_wrap_rfc2646(ptr, G_MAXINT, FALSE, TRUE, delsp);
     } else if (bm->wrap_text
 #if HAVE_GTKSOURCEVIEW
-               && !GTK_SOURCE_IS_VIEW(widget)
+              && !GTK_SOURCE_IS_VIEW(widget)
 #endif
-               ) {
-        libbalsa_wrap_string(ptr, balsa_app.browse_wrap_length);
-    }
+              )
+       libbalsa_wrap_string(ptr, balsa_app.browse_wrap_length);
 
     g_signal_connect(G_OBJECT(widget), "key_press_event",
-                     G_CALLBACK(balsa_mime_widget_key_press_event),
-                     (gpointer) bm);
+                    G_CALLBACK(balsa_mime_widget_key_press_event),
+                    (gpointer) bm);
 
     mwt->mime_body = mime_body;
     g_signal_connect(G_OBJECT(widget), "populate-popup",
-                     G_CALLBACK(text_view_populate_popup), mwt);
+                    G_CALLBACK(text_view_populate_popup), mwt);
 
     buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
 
@@ -351,13 +323,13 @@ balsa_mime_widget_new_text(BalsaMessage        *bm,
 
     prepare_url_offsets(buffer, mwt->url_list);
     g_signal_connect_after(G_OBJECT(widget), "realize",
-                           G_CALLBACK(fix_text_widget), mwt->url_list);
+                          G_CALLBACK(fix_text_widget), mwt->url_list);
     if (mwt->url_list != NULL) {
         mwt->gesture = gtk_gesture_multi_press_new(widget);
         g_signal_connect(mwt->gesture, "pressed",
                          G_CALLBACK(store_button_coords), NULL);
-        g_signal_connect(mwt->gesture, "released",
-                         G_CALLBACK(check_call_url), mwt);
+       g_signal_connect(mwt->gesture, "released",
+                        G_CALLBACK(check_call_url), mwt);
 
         mwt->controller = gtk_event_controller_motion_new(widget);
         g_signal_connect(mwt->controller, "motion",
@@ -367,11 +339,11 @@ balsa_mime_widget_new_text(BalsaMessage        *bm,
     }
 
     if (is_text_plain) {
-        /* plain-text highlighting */
+       /* plain-text highlighting */
         mwt->phrase_hl = PHRASE_HIGHLIGHT_ON;
-        phrase_highlight(buffer, "hp-bold", '*', "weight", PANGO_WEIGHT_BOLD);
-        phrase_highlight(buffer, "hp-underline", '_', "underline", PANGO_UNDERLINE_SINGLE);
-        phrase_highlight(buffer, "hp-italic", '/', "style", PANGO_STYLE_ITALIC);
+       phrase_highlight(buffer, "hp-bold", '*', "weight", PANGO_WEIGHT_BOLD);
+       phrase_highlight(buffer, "hp-underline", '_', "underline", PANGO_UNDERLINE_SINGLE);
+       phrase_highlight(buffer, "hp-italic", '/', "style", PANGO_STYLE_ITALIC);
     }
 
     g_free(ptr);
@@ -385,72 +357,63 @@ balsa_mime_widget_new_text(BalsaMessage        *bm,
 
 /* -- local functions -- */
 static GtkWidget *
-create_text_widget(const char *content_type)
+create_text_widget(const char * content_type)
 {
 #if HAVE_GTKSOURCEVIEW
-    static GtkSourceLanguageManager *lm = NULL;
-    static const gchar *const *lm_ids = NULL;
-    GtkWidget *widget = NULL;
+    static GtkSourceLanguageManager * lm = NULL;
+    static const gchar * const * lm_ids = NULL;
+    GtkWidget * widget = NULL;
     gint n;
 
     /* we use or own highlighting for text/plain */
-    if (!g_ascii_strcasecmp(content_type, "text/plain")) {
-        return gtk_text_view_new();
-    }
-
+    if (!g_ascii_strcasecmp(content_type, "text/plain"))
+       return gtk_text_view_new();
+    
     /* try to initialise the source language manager and return a "simple"
      * text view if this fails */
-    if (!lm) {
-        lm = gtk_source_language_manager_get_default();
-    }
-    if (lm && !lm_ids) {
-        lm_ids = gtk_source_language_manager_get_language_ids(lm);
-    }
-    if (!lm_ids) {
-        return gtk_text_view_new();
-    }
-
+    if (!lm)
+       lm = gtk_source_language_manager_get_default();
+    if (lm && !lm_ids)
+       lm_ids = gtk_source_language_manager_get_language_ids(lm);
+    if (!lm_ids)
+       return gtk_text_view_new();
+    
     /* search for a language supporting our mime type */
     for (n = 0; !widget && lm_ids[n]; n++) {
-        GtkSourceLanguage *src_lang =
-            gtk_source_language_manager_get_language(lm, lm_ids[n]);
-        gchar **mime_types;
-
-        if (src_lang &&
-            (mime_types = gtk_source_language_get_mime_types(src_lang))) {
-            gint k;
-
-            for (k = 0;
-                 mime_types[k] && g_ascii_strcasecmp(mime_types[k], content_type);
-                 k++) {
-            }
-            if (mime_types[k]) {
-                GtkSourceBuffer *buffer =
-                    gtk_source_buffer_new_with_language(src_lang);
-
-                gtk_source_buffer_set_highlight_syntax(buffer, TRUE);
-                widget = gtk_source_view_new_with_buffer(buffer);
-                g_object_unref(buffer);
-            }
-            g_strfreev(mime_types);
-        }
+       GtkSourceLanguage * src_lang =
+           gtk_source_language_manager_get_language(lm, lm_ids[n]);
+       gchar ** mime_types;
+
+       if (src_lang &&
+           (mime_types = gtk_source_language_get_mime_types(src_lang))) {
+           gint k;
+
+           for (k = 0;
+                mime_types[k] && g_ascii_strcasecmp(mime_types[k], content_type);
+                k++);
+           if (mime_types[k]) {
+               GtkSourceBuffer * buffer =
+                   gtk_source_buffer_new_with_language(src_lang);
+               
+               gtk_source_buffer_set_highlight_syntax(buffer, TRUE);
+               widget = gtk_source_view_new_with_buffer(buffer);
+               g_object_unref(buffer);
+           }
+           g_strfreev(mime_types);
+       }
     }
-
+    
     /* fall back to the simple text view if the mime type is not supported */
     return widget ? widget : gtk_text_view_new();
-
 #else /* no GtkSourceview */
     return gtk_text_view_new();
-
 #endif
 }
 
-
 #define BALSA_MESSAGE_TEXT_HEADER "balsa-message-text-header"
 
 static void
-bm_modify_font_from_string(GtkWidget  *widget,
-                           const char *font)
+bm_modify_font_from_string(GtkWidget * widget, const char *font)
 {
     gchar *css;
     GtkCssProvider *css_provider;
@@ -462,13 +425,12 @@ bm_modify_font_from_string(GtkWidget  *widget,
     gtk_css_provider_load_from_data(css_provider, css, -1);
     g_free(css);
 
-    gtk_style_context_add_provider(gtk_widget_get_style_context(widget),
+    gtk_style_context_add_provider(gtk_widget_get_style_context(widget) ,
                                    GTK_STYLE_PROVIDER(css_provider),
                                    GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
     g_object_unref(css_provider);
 }
 
-
 /* quote_tag:
  * lookup the GtkTextTag for coloring quoted lines of a given level;
  * create the tag if it isn't found.
@@ -476,16 +438,14 @@ bm_modify_font_from_string(GtkWidget  *widget,
  * returns NULL if the level is 0 (unquoted)
  */
 static GtkTextTag *
-quote_tag(GtkTextBuffer *buffer,
-          gint           level,
-          gint           margin)
+quote_tag(GtkTextBuffer * buffer, gint level, gint margin)
 {
     GtkTextTag *tag = NULL;
 
     if (level > 0) {
         GtkTextTagTable *table = gtk_text_buffer_get_tag_table(buffer);
         gchar *name;
-        gint q_level;
+       gint q_level;
 
         /* Modulus the quote level by the max,
          * ie, always have "1 <= quote level <= MAX"
@@ -503,7 +463,7 @@ quote_tag(GtkTextBuffer *buffer,
             tag =
                 gtk_text_buffer_create_tag(buffer, name,
                                            "foreground-rgba", rgba,
-                                           "left-margin", BALSA_LEFT_MARGIN
+                                          "left-margin", BALSA_LEFT_MARGIN
                                            + margin * level,
                                            NULL);
             /* Set a low priority, so we can set both quote color and
@@ -516,12 +476,10 @@ quote_tag(GtkTextBuffer *buffer,
     return tag;
 }
 
-
 /* set the gtk_text widget's cursor to a vertical bar
    fix event mask so that pointer motions are reported (if necessary) */
 static gboolean
-fix_text_widget(GtkWidget *widget,
-                gpointer   data)
+fix_text_widget(GtkWidget *widget, gpointer data)
 {
     if (data != NULL) {
         GdkWindow *window = gtk_widget_get_window(widget);
@@ -543,59 +501,50 @@ fix_text_widget(GtkWidget *widget,
     return FALSE;
 }
 
-
 static void
-gtk_widget_destroy_insensitive(GtkWidget *widget)
+gtk_widget_destroy_insensitive(GtkWidget * widget)
 {
     if (!gtk_widget_get_sensitive(widget) ||
-        GTK_IS_SEPARATOR_MENU_ITEM(widget)) {
-        gtk_widget_destroy(widget);
-    }
+       GTK_IS_SEPARATOR_MENU_ITEM(widget))
+       gtk_widget_destroy(widget);
 }
 
-
 static void
 structured_phrases_toggle(GtkCheckMenuItem *checkmenuitem,
-                          gpointer          user_data)
+                         gpointer          user_data)
 {
     BalsaMimeWidgetText *mwt = user_data;
-    GtkTextView *text_view;
-    GtkTextTagTable *table;
-    GtkTextTag *tag;
+    GtkTextView * text_view;
+    GtkTextTagTable * table;
+    GtkTextTag * tag;
     gboolean new_hl;
 
     text_view = GTK_TEXT_VIEW(mwt->text_widget);
     table = gtk_text_buffer_get_tag_table(gtk_text_view_get_buffer(text_view));
     new_hl = gtk_check_menu_item_get_active(checkmenuitem);
-    if (!table || (mwt->phrase_hl == 0) ||
-        ((mwt->phrase_hl == PHRASE_HIGHLIGHT_ON) && new_hl) ||
-        ((mwt->phrase_hl == PHRASE_HIGHLIGHT_OFF) && !new_hl)) {
-        return;
-    }
-
-    if ((tag = gtk_text_tag_table_lookup(table, "hp-bold"))) {
-        g_object_set(G_OBJECT(tag), "weight",
-                     new_hl ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
-                     NULL);
-    }
-    if ((tag = gtk_text_tag_table_lookup(table, "hp-underline"))) {
-        g_object_set(G_OBJECT(tag), "underline",
-                     new_hl ? PANGO_UNDERLINE_SINGLE : PANGO_UNDERLINE_NONE,
-                     NULL);
-    }
-    if ((tag = gtk_text_tag_table_lookup(table, "hp-italic"))) {
-        g_object_set(G_OBJECT(tag), "style",
-                     new_hl ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL,
-                     NULL);
-    }
+    if (!table || mwt->phrase_hl == 0 ||
+       (mwt->phrase_hl == PHRASE_HIGHLIGHT_ON && new_hl) ||
+       (mwt->phrase_hl == PHRASE_HIGHLIGHT_OFF && !new_hl))
+       return;
+
+    if ((tag = gtk_text_tag_table_lookup(table, "hp-bold")))
+       g_object_set(G_OBJECT(tag), "weight",
+                    new_hl ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
+                    NULL);
+    if ((tag = gtk_text_tag_table_lookup(table, "hp-underline")))
+       g_object_set(G_OBJECT(tag), "underline",
+                    new_hl ? PANGO_UNDERLINE_SINGLE : PANGO_UNDERLINE_NONE,
+                    NULL);
+    if ((tag = gtk_text_tag_table_lookup(table, "hp-italic")))
+       g_object_set(G_OBJECT(tag), "style",
+                    new_hl ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL,
+                    NULL);
 
     mwt->phrase_hl = new_hl ? PHRASE_HIGHLIGHT_ON : PHRASE_HIGHLIGHT_OFF;
 }
 
-
 static void
-url_copy_cb(GtkWidget     *menu_item,
-            message_url_t *uri)
+url_copy_cb(GtkWidget * menu_item, message_url_t * uri)
 {
     GdkClipboard *clipboard;
 
@@ -603,37 +552,29 @@ url_copy_cb(GtkWidget     *menu_item,
     gdk_clipboard_set_text(clipboard, uri->url);
 }
 
-
 static void
-url_open_cb(GtkWidget     *menu_item,
-            message_url_t *uri)
+url_open_cb(GtkWidget * menu_item, message_url_t * uri)
 {
     handle_url(uri->url);
 }
 
-
 static void
-url_send_cb(GtkWidget     *menu_item,
-            message_url_t *uri)
+url_send_cb(GtkWidget * menu_item, message_url_t * uri)
 {
-    BalsaSendmsg *newmsg;
+    BalsaSendmsg * newmsg;
 
     newmsg = sendmsg_window_compose();
     sendmsg_window_set_field(newmsg, "body", uri->url);
 }
 
-
 static gboolean
-text_view_url_popup(GtkWidget     *widget,
-                    GtkMenu       *menu,
-                    message_url_t *url)
+text_view_url_popup(GtkWidget *widget, GtkMenu *menu, message_url_t *url)
 {
     GtkWidget *menu_item;
 
     /* check if we are over an url */
-    if (url == NULL) {
-        return FALSE;
-    }
+    if (url == NULL)
+       return FALSE;
 
     /* build a popup to copy or open the URL */
     gtk_container_foreach(GTK_CONTAINER(menu),
@@ -657,11 +598,9 @@ text_view_url_popup(GtkWidget     *widget,
     return TRUE;
 }
 
-
 static void
-text_view_populate_popup(GtkWidget *widget,
-                         GtkMenu   *menu,
-                         gpointer   user_data)
+text_view_populate_popup(GtkWidget *widget, GtkMenu *menu,
+                         gpointer user_data)
 {
     BalsaMimeWidgetText *mwt = user_data;
     GtkWidget *menu_item;
@@ -669,17 +608,16 @@ text_view_populate_popup(GtkWidget *widget,
     gtk_widget_hide(GTK_WIDGET(menu));
     gtk_container_foreach(GTK_CONTAINER(menu),
                           (GtkCallback) gtk_widget_hide, NULL);
-    if (text_view_url_popup(widget, menu, mwt->current_url)) {
-        return;
-    }
+    if (text_view_url_popup(widget, menu, mwt->current_url))
+       return;
 
     gtk_container_foreach(GTK_CONTAINER(menu),
                           (GtkCallback)gtk_widget_destroy_insensitive, NULL);
     gtk_menu_shell_append(GTK_MENU_SHELL(menu),
-                          gtk_separator_menu_item_new ());
+                         gtk_separator_menu_item_new ());
     libbalsa_vfs_fill_menu_by_content_type(menu, "text/plain",
-                                           G_CALLBACK (balsa_mime_widget_ctx_menu_cb),
-                                           (gpointer)mwt->mime_body);
+                                          G_CALLBACK (balsa_mime_widget_ctx_menu_cb),
+                                          (gpointer)mwt->mime_body);
 
     menu_item = gtk_menu_item_new_with_label (_("Save…"));
     g_signal_connect (G_OBJECT (menu_item), "activate",
@@ -687,14 +625,14 @@ text_view_populate_popup(GtkWidget *widget,
     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
 
     if (mwt->phrase_hl != 0) {
-        gtk_menu_shell_append(GTK_MENU_SHELL(menu),
-                              gtk_separator_menu_item_new ());
-        menu_item = gtk_check_menu_item_new_with_label (_("Highlight structured phrases"));
-        gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item),
+       gtk_menu_shell_append(GTK_MENU_SHELL(menu),
+                             gtk_separator_menu_item_new ());
+       menu_item = gtk_check_menu_item_new_with_label (_("Highlight structured phrases"));
+       gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item),
                                         mwt->phrase_hl == PHRASE_HIGHLIGHT_ON);
-        g_signal_connect (G_OBJECT (menu_item), "toggled",
-                          G_CALLBACK (structured_phrases_toggle), mwt);
-        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
+       g_signal_connect (G_OBJECT (menu_item), "toggled",
+                         G_CALLBACK (structured_phrases_toggle), mwt);
+       gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
     }
 }
 
@@ -726,11 +664,10 @@ store_button_coords(GtkGestureMultiPress *multi_press,
     }
 }
 
-
 /* check if we are over an url and change the cursor in this case */
 static void
-check_over_url(BalsaMimeWidgetText *mwt,
-               message_url_t       *url)
+check_over_url(BalsaMimeWidgetText * mwt,
+               message_url_t       * url)
 {
     static gboolean was_over_url = FALSE;
 
@@ -763,18 +700,15 @@ check_over_url(BalsaMimeWidgetText *mwt,
  * change style of a url and set/clear the status bar.
  */
 static void
-pointer_over_url(GtkWidget     *widget,
-                 message_url_t *url,
-                 gboolean       set)
+pointer_over_url(GtkWidget * widget, message_url_t * url, gboolean set)
 {
     GtkTextBuffer *buffer;
     GtkTextTagTable *table;
     GtkTextTag *tag;
     GtkTextIter start, end;
 
-    if (!url) {
+    if (!url)
         return;
-    }
 
     buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
     table = gtk_text_buffer_get_tag_table(buffer);
@@ -782,7 +716,7 @@ pointer_over_url(GtkWidget     *widget,
 
     gtk_text_buffer_get_iter_at_offset(buffer, &start, url->start);
     gtk_text_buffer_get_iter_at_offset(buffer, &end, url->end);
-
+    
     if (set) {
         gtk_text_buffer_apply_tag(buffer, tag, &start, &end);
         bm_widget_on_url(url->url);
@@ -792,12 +726,10 @@ pointer_over_url(GtkWidget     *widget,
     }
 }
 
-
 /* After wrapping the buffer, populate the start and end offsets for
  * each url. */
 static void
-prepare_url_offsets(GtkTextBuffer *buffer,
-                    GList         *url_list)
+prepare_url_offsets(GtkTextBuffer * buffer, GList * url_list)
 {
     GtkTextTagTable *table = gtk_text_buffer_get_tag_table(buffer);
     GtkTextTag *url_tag = gtk_text_tag_table_lookup(table, "url");
@@ -812,22 +744,17 @@ prepare_url_offsets(GtkTextBuffer *buffer,
         gtk_text_iter_backward_to_tag_toggle(&iter, url_tag);
 #else
         while (gtk_text_iter_backward_char(&iter)) {
-            if (gtk_text_iter_starts_tag(&iter, url_tag)) {
+            if (gtk_text_iter_starts_tag(&iter, url_tag))
                 break;
-            }
         }
 #endif                          /* BUG_102711_FIXED */
         url->start = gtk_text_iter_get_offset(&iter);
     }
 }
 
-
 static void
-url_found_cb(GtkTextBuffer *buffer,
-             GtkTextIter   *iter,
-             const gchar   *buf,
-             guint          len,
-             gpointer       data)
+url_found_cb(GtkTextBuffer * buffer, GtkTextIter * iter,
+             const gchar * buf, guint len, gpointer data)
 {
     GList **url_list = data;
     message_url_t *url_found;
@@ -839,7 +766,6 @@ url_found_cb(GtkTextBuffer *buffer,
     *url_list = g_list_prepend(*url_list, url_found);
 }
 
-
 /* if the mouse button was released over an URL, and the mouse hasn't
  * moved since the button was pressed, try to call the URL */
 static void
@@ -863,25 +789,21 @@ check_call_url(GtkGestureMultiPress *multi_press,
     }
 
     /* 2-pixel motion tolerance */
-    if ((abs(((gint) x) - stored_x) <= 2) && (abs(((gint) y) - stored_y) <= 2)
-        && ((state & STORED_MASK_BITS) == stored_mask)) {
+    if (abs(((gint) x) - stored_x) <= 2 && abs(((gint) y) - stored_y) <= 2
+        && (state & STORED_MASK_BITS) == stored_mask) {
         message_url_t *url;
 
         url = find_url(mwt, (gint) x, (gint) y);
-        if (url != NULL) {
+        if (url != NULL)
             handle_url(url->url);
-        }
     }
 }
 
-
 /* find_url:
  * look in widget at coordinates x, y for a URL in url_list.
  */
 static message_url_t *
-find_url(BalsaMimeWidgetText *mwt,
-         gint                 x,
-         gint                 y)
+find_url(BalsaMimeWidgetText * mwt, gint x, gint y)
 {
     GtkTextIter iter;
     gint offset;
@@ -896,15 +818,13 @@ find_url(BalsaMimeWidgetText *mwt,
     for (url_list = mwt->url_list; url_list != NULL; url_list = url_list->next) {
         message_url_t *url = (message_url_t *) url_list->data;
 
-        if ((url->start <= offset) && (offset < url->end)) {
+        if (url->start <= offset && offset < url->end)
             return url;
-        }
     }
 
     return NULL;
 }
 
-
 static gboolean
 statusbar_pop(gpointer data)
 {
@@ -921,12 +841,11 @@ statusbar_pop(gpointer data)
     return FALSE;
 }
 
-
 #define SCHEDULE_BAR_REFRESH() \
     g_timeout_add_seconds(5, statusbar_pop, NULL);
 
 static void
-handle_url(const gchar *url)
+handle_url(const gchar * url)
 {
     if (!g_ascii_strncasecmp(url, "mailto:";, 7)) {
         BalsaSendmsg *snd = sendmsg_window_compose();
@@ -956,28 +875,23 @@ handle_url(const gchar *url)
     }
 }
 
-
 static void
-free_url(message_url_t *url)
+free_url(message_url_t * url)
 {
     g_free(url->url);
     g_free(url);
 }
 
-
 /* --- Hacker's Jargon highlighting --- */
 #define UNICHAR_PREV(p)  g_utf8_get_char(g_utf8_prev_char(p))
 
 static void
-phrase_highlight(GtkTextBuffer *buffer,
-                 const gchar   *id,
-                 gunichar       tag_char,
-                 const gchar   *property,
-                 gint           value)
+phrase_highlight(GtkTextBuffer * buffer, const gchar * id, gunichar tag_char,
+                const gchar * property, gint value)
 {
     GtkTextTag *tag = NULL;
-    gchar *buf_chars;
-    gchar *utf_start;
+    gchar * buf_chars;
+    gchar * utf_start;
     GtkTextIter iter_start;
     GtkTextIter iter_end;
 
@@ -992,66 +906,60 @@ phrase_highlight(GtkTextBuffer *buffer,
        <whitespace, punctuation or buffer end> */
     utf_start = g_utf8_strchr(buf_chars, -1, tag_char);
     while (utf_start) {
-        gchar *s_next = g_utf8_next_char(utf_start);
+       gchar * s_next = g_utf8_next_char(utf_start);
 
-        if (((utf_start == buf_chars) || g_unichar_isspace(UNICHAR_PREV(utf_start))) &&
-            (*s_next != '\0') && g_unichar_isalnum(g_utf8_get_char(s_next))) {
-            gchar *utf_end;
-            gchar *line_end;
-            gchar *e_next;
+       if ((utf_start == buf_chars || g_unichar_isspace(UNICHAR_PREV(utf_start))) &&
+           *s_next != '\0' && g_unichar_isalnum(g_utf8_get_char(s_next))) {
+           gchar * utf_end;
+           gchar * line_end;
+           gchar * e_next;
 
-            /* found a proper start sequence - find the end or eject */
-            if (!(utf_end = g_utf8_strchr(s_next, -1, tag_char))) {
+           /* found a proper start sequence - find the end or eject */
+           if (!(utf_end = g_utf8_strchr(s_next, -1, tag_char))) {
                 g_free(buf_chars);
-                return;
+               return;
             }
-            line_end = g_utf8_strchr(s_next, -1, '\n');
-            e_next = g_utf8_next_char(utf_end);
-            while (!g_unichar_isalnum(UNICHAR_PREV(utf_end)) ||
-                   !(*e_next == '\0' ||
-                     g_unichar_isspace(g_utf8_get_char(e_next)) ||
-                     g_unichar_ispunct(g_utf8_get_char(e_next)))) {
-                if (!(utf_end = g_utf8_strchr(e_next, -1, tag_char))) {
+           line_end = g_utf8_strchr(s_next, -1, '\n');
+           e_next = g_utf8_next_char(utf_end);
+           while (!g_unichar_isalnum(UNICHAR_PREV(utf_end)) ||
+                  !(*e_next == '\0' || 
+                    g_unichar_isspace(g_utf8_get_char(e_next)) ||
+                    g_unichar_ispunct(g_utf8_get_char(e_next)))) {
+               if (!(utf_end = g_utf8_strchr(e_next, -1, tag_char))) {
                     g_free(buf_chars);
-                    return;
-                }
-                e_next = g_utf8_next_char(utf_end);
-            }
-
-            /* insert the tag if there is no line break */
-            if (!line_end || (line_end >= e_next)) {
-                if (!tag) {
-                    tag = gtk_text_buffer_create_tag(buffer, id, property, value, NULL);
+                   return;
                 }
-                gtk_text_buffer_get_iter_at_offset(buffer, &iter_start,
-                                                   g_utf8_pointer_to_offset(buf_chars,
-                                                                            utf_start));
-                gtk_text_buffer_get_iter_at_offset(buffer, &iter_end,
-                                                   g_utf8_pointer_to_offset(buf_chars, e_next));
-                gtk_text_buffer_apply_tag(buffer, tag, &iter_start, &iter_end);
-
-                /* set the next start properly */
-                utf_start = *e_next ? g_utf8_strchr(e_next, -1, tag_char) : NULL;
-            } else {
-                utf_start = *s_next ? g_utf8_strchr(s_next, -1, tag_char) : NULL;
-            }
-        } else {
-            /* no start sequence, find the next start tag char */
-            utf_start = *s_next ? g_utf8_strchr(s_next, -1, tag_char) : NULL;
-        }
+               e_next = g_utf8_next_char(utf_end);
+           }
+           
+           /* insert the tag if there is no line break */
+           if (!line_end || line_end >= e_next) {
+               if (!tag)
+                   tag = gtk_text_buffer_create_tag(buffer, id, property, value, NULL);
+               gtk_text_buffer_get_iter_at_offset(buffer, &iter_start,
+                                                  g_utf8_pointer_to_offset(buf_chars, utf_start));
+               gtk_text_buffer_get_iter_at_offset(buffer, &iter_end,
+                                                  g_utf8_pointer_to_offset(buf_chars, e_next));
+               gtk_text_buffer_apply_tag(buffer, tag, &iter_start, &iter_end);
+               
+               /* set the next start properly */
+               utf_start = *e_next ? g_utf8_strchr(e_next, -1, tag_char) : NULL;
+           } else
+               utf_start = *s_next ? g_utf8_strchr(s_next, -1, tag_char) : NULL;
+       } else
+           /* no start sequence, find the next start tag char */
+           utf_start = *s_next ? g_utf8_strchr(s_next, -1, tag_char) : NULL;
     }
     g_free(buf_chars);
 }
 
-
 /* --- citation bar stuff --- */
 
 static void
-draw_cite_bar_real(cite_bar_t          *bar,
-                   BalsaMimeWidgetText *mwt)
+draw_cite_bar_real(cite_bar_t * bar, BalsaMimeWidgetText * mwt)
 {
-    GtkTextView *view;
-    GtkTextBuffer *buffer;
+    GtkTextView * view;
+    GtkTextBuffer * buffer;
     gint dimension;
     GdkRectangle location;
     gint x_pos;
@@ -1103,14 +1011,14 @@ draw_cite_bar_real(cite_bar_t          *bar,
         gtk_css_provider_load_from_data(css_provider, css, -1);
         g_free(css);
 
-        gtk_style_context_add_provider(gtk_widget_get_style_context(bar->bar),
+        gtk_style_context_add_provider(gtk_widget_get_style_context(bar->bar) ,
                                        GTK_STYLE_PROVIDER(css_provider),
                                        GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
         g_object_unref(css_provider);
 
         gtk_text_view_add_child_in_window(view, bar->bar,
                                           GTK_TEXT_WINDOW_TEXT, 0, y_pos);
-    } else if ((bar->y_pos != y_pos) || (bar->height != height)) {
+    } else if (bar->y_pos != y_pos || bar->height != height) {
         /* shift/resize existing widget */
         balsa_cite_bar_resize(BALSA_CITE_BAR(bar->bar), height);
         gtk_text_view_move_child(view, bar->bar, 0, y_pos);
@@ -1123,9 +1031,9 @@ draw_cite_bar_real(cite_bar_t          *bar,
 
 
 static gboolean
-draw_cite_bars(GtkWidget *widget,
-               cairo_t   *cr,
-               gpointer   user_data)
+draw_cite_bars(GtkWidget * widget,
+               cairo_t   * cr,
+               gpointer    user_data)
 {
     BalsaMimeWidgetText *mwt = user_data;
 
@@ -1145,48 +1053,42 @@ bm_widget_on_url(const gchar *url)
     statusbar = GTK_STATUSBAR(balsa_app.main_window->statusbar);
     context_id = gtk_statusbar_get_context_id(statusbar, "BalsaMimeWidget URL");
 
-    if ( url ) {
+    if( url ) {
         gtk_statusbar_push(statusbar, context_id, url);
         SCHEDULE_BAR_REFRESH();
-    } else {
+    } else 
         gtk_statusbar_pop(statusbar, context_id);
-    }
 }
 
-
 #ifdef HAVE_HTML_WIDGET
 static void
-bm_zoom_in(BalsaMessage *bm)
+bm_zoom_in(BalsaMessage * bm)
 {
     balsa_message_zoom(bm, 1);
 }
 
-
 static void
-bm_zoom_out(BalsaMessage *bm)
+bm_zoom_out(BalsaMessage * bm)
 {
     balsa_message_zoom(bm, -1);
 }
 
-
 static void
-bm_zoom_reset(BalsaMessage *bm)
+bm_zoom_reset(BalsaMessage * bm)
 {
     balsa_message_zoom(bm, 0);
 }
 
-
 static void
-bm_select_all_cb(GtkWidget *html)
+bm_select_all_cb(GtkWidget * html)
 {
     libbalsa_html_select_all(html);
 }
 
-
 static void
-bmwt_populate_popup_menu(BalsaMessage *bm,
-                         GtkWidget    *html,
-                         GtkMenu      *menu)
+bmwt_populate_popup_menu(BalsaMessage * bm,
+                         GtkWidget    * html,
+                         GtkMenu      * menu)
 {
     GtkWidget *menuitem;
     gpointer mime_body = g_object_get_data(G_OBJECT(html), "mime-body");
@@ -1221,7 +1123,7 @@ bmwt_populate_popup_menu(BalsaMessage *bm,
 
     libbalsa_vfs_fill_menu_by_content_type(GTK_MENU(menu), "text/html",
                                            G_CALLBACK
-                                               (balsa_mime_widget_ctx_menu_cb),
+                                           (balsa_mime_widget_ctx_menu_cb),
                                            mime_body);
 
     menuitem = gtk_menu_item_new_with_label(_("Save…"));
@@ -1240,10 +1142,8 @@ bmwt_populate_popup_menu(BalsaMessage *bm,
     gtk_widget_set_sensitive(menuitem, libbalsa_html_can_print(html));
 }
 
-
 static gboolean
-balsa_gtk_html_popup(GtkWidget    *html,
-                     BalsaMessage *bm)
+balsa_gtk_html_popup(GtkWidget * html, BalsaMessage * bm)
 {
     GtkWidget *menu;
     const GdkEvent *event;
@@ -1256,26 +1156,22 @@ balsa_gtk_html_popup(GtkWidget    *html,
      * GdkEvent is no longer current; instead it is preserved and passed
      * to us: */
     event = g_object_get_data(G_OBJECT(html), LIBBALSA_HTML_POPUP_EVENT);
-    if (!event) {
+    if (!event)
         event = current_event = gtk_get_current_event();
-    }
-    if (event) {
+    if (event)
         gtk_menu_popup_at_pointer(GTK_MENU(menu),
                                   (GdkEvent *) event);
-    } else {
+    else
         gtk_menu_popup_at_widget(GTK_MENU(menu),
                                  GTK_WIDGET(bm),
                                  GDK_GRAVITY_CENTER, GDK_GRAVITY_CENTER,
                                  NULL);
-    }
-    if (current_event) {
+    if (current_event)
         gdk_event_free(current_event);
-    }
 
     return TRUE;
 }
 
-
 static void
 mwt_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
                        gint                  n_press,
@@ -1293,16 +1189,12 @@ mwt_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
     g_return_if_fail(event != NULL);
     html = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture));
 
-    if (gdk_event_triggers_context_menu(event)) {
+    if (gdk_event_triggers_context_menu(event))
         balsa_gtk_html_popup(html, bm);
-    }
 }
 
-
 static void
-bmwt_populate_popup_cb(GtkWidget *widget,
-                       GtkMenu   *menu,
-                       gpointer   data)
+bmwt_populate_popup_cb(GtkWidget * widget, GtkMenu * menu, gpointer data)
 {
     BalsaMessage *bm =
         g_object_get_data(G_OBJECT(widget), "balsa-message");
@@ -1314,10 +1206,8 @@ bmwt_populate_popup_cb(GtkWidget *widget,
     bmwt_populate_popup_menu(bm, html, menu);
 }
 
-
 static BalsaMimeWidget *
-bm_widget_new_html(BalsaMessage        *bm,
-                   LibBalsaMessageBody *mime_body)
+bm_widget_new_html(BalsaMessage * bm, LibBalsaMessageBody * mime_body)
 {
     BalsaMimeWidget *mw = g_object_new(BALSA_TYPE_MIME_WIDGET, NULL);
     GtkWidget *widget;
@@ -1347,27 +1237,23 @@ bm_widget_new_html(BalsaMessage        *bm,
 
     return mw;
 }
-
-
 #endif /* defined HAVE_HTML_WIDGET */
 
-#define GRID_ATTACH(g, str, label)                                  \
-    if (str) { GtkWidget *lbl;                                     \
-               lbl = gtk_label_new(label);                               \
-               gtk_widget_set_halign(lbl, GTK_ALIGN_START);                \
-               gtk_grid_attach(g, lbl, 0, row, 1, 1);                    \
-               lbl = gtk_label_new(str);                                 \
-               gtk_label_set_line_wrap(GTK_LABEL(lbl), TRUE);            \
-               gtk_widget_set_halign(lbl, GTK_ALIGN_START);              \
-               gtk_grid_attach(g, lbl, 1, row, 1, 1);                    \
-               row ++;                                                    \
+#define GRID_ATTACH(g,str,label)                                  \
+    if(str) { GtkWidget *lbl;                                     \
+        lbl = gtk_label_new(label);                               \
+        gtk_widget_set_halign(lbl, GTK_ALIGN_START);                \
+        gtk_grid_attach(g, lbl, 0, row, 1, 1);                    \
+        lbl = gtk_label_new(str);                                 \
+        gtk_label_set_line_wrap(GTK_LABEL(lbl), TRUE);            \
+        gtk_widget_set_halign(lbl, GTK_ALIGN_START);              \
+        gtk_grid_attach(g, lbl, 1, row, 1, 1);                    \
+        row++;                                                    \
     }
 
 static BalsaMimeWidget *
-bm_widget_new_vcard(BalsaMessage        *bm,
-                    LibBalsaMessageBody *mime_body,
-                    gchar               *ptr,
-                    size_t               len)
+bm_widget_new_vcard(BalsaMessage *bm, LibBalsaMessageBody *mime_body,
+                    gchar *ptr, size_t len)
 {
     BalsaMimeWidget *mw;
     LibBalsaAddress *address;
@@ -1378,10 +1264,9 @@ bm_widget_new_vcard(BalsaMessage        *bm,
 
     address =
         libbalsa_address_new_from_vcard(ptr, mime_body->charset ?
-                                        mime_body->charset : "us-ascii");
-    if (address == NULL) {
+                                        mime_body-> charset : "us-ascii");
+    if (address == NULL)
         return NULL;
-    }
 
     mw = g_object_new(BALSA_TYPE_MIME_WIDGET, NULL);
     widget = gtk_grid_new();
@@ -1398,21 +1283,19 @@ bm_widget_new_vcard(BalsaMessage        *bm,
                              G_CALLBACK(balsa_store_address), address);
     g_object_weak_ref(G_OBJECT(mw), (GWeakNotify)g_object_unref, address);
 
-    GRID_ATTACH(grid, libbalsa_address_get_full_name(address), _("Full Name:"));
-    GRID_ATTACH(grid, libbalsa_address_get_nick_name(address), _("Nick Name:"));
-    GRID_ATTACH(grid, libbalsa_address_get_first_name(address), _("First Name:"));
-    GRID_ATTACH(grid, libbalsa_address_get_last_name(address), _("Last Name:"));
+    GRID_ATTACH(grid, libbalsa_address_get_full_name(address),    _("Full Name:"));
+    GRID_ATTACH(grid, libbalsa_address_get_nick_name(address),    _("Nick Name:"));
+    GRID_ATTACH(grid, libbalsa_address_get_first_name(address),   _("First Name:"));
+    GRID_ATTACH(grid, libbalsa_address_get_last_name(address),    _("Last Name:"));
     GRID_ATTACH(grid, libbalsa_address_get_organization(address), _("Organization:"));
-    GRID_ATTACH(grid, libbalsa_address_get_addr(address), _("Email Address:"));
+    GRID_ATTACH(grid, libbalsa_address_get_addr(address),         _("Email Address:"));
 
     return mw;
 }
 
-
 /* check for a proper text encoding, fix and notify the user if necessary */
 static gchar *
-check_text_encoding(BalsaMessage *bm,
-                    gchar        *text_buf)
+check_text_encoding(BalsaMessage * bm, gchar *text_buf)
 {
     const gchar *target_cs;
 
@@ -1425,17 +1308,17 @@ check_text_encoding(BalsaMessage *bm,
         gchar *subject =
             g_strdup(LIBBALSA_MESSAGE_GET_SUBJECT(bm->message));
 
-        libbalsa_utf8_sanitize(&from, balsa_app.convert_unknown_8bit,
+        libbalsa_utf8_sanitize(&from,    balsa_app.convert_unknown_8bit,
                                NULL);
         libbalsa_utf8_sanitize(&subject, balsa_app.convert_unknown_8bit,
                                NULL);
         libbalsa_information
             (LIBBALSA_INFORMATION_MESSAGE,
-            _("The message sent by %s with subject “%s” contains 8-bit "
-              "characters, but no header describing the used codeset "
-              "(converted to %s)"),
-            from, subject,
-            target_cs ? target_cs : "“?”");
+             _("The message sent by %s with subject “%s” contains 8-bit "
+               "characters, but no header describing the used codeset "
+               "(converted to %s)"),
+             from, subject,
+             target_cs ? target_cs : "“?”");
         g_free(subject);
         g_free(from);
         /* Avoid multiple notifications: */
@@ -1507,9 +1390,8 @@ fill_text_buf_cited(BalsaMimeWidgetText *mwt,
         GtkTextTag *tag = NULL;
         int len;
 
-        if (!(line_end = strchr(text_body, '\n'))) {
+        if (!(line_end = strchr(text_body, '\n')))
             line_end = text_body + strlen(text_body);
-        }
 
         if (rex != NULL) {
             guint quote_level;
@@ -1522,7 +1404,7 @@ fill_text_buf_cited(BalsaMimeWidgetText *mwt,
             /* check if the citation level changed */
             if (cite_level != quote_level) {
                 if (cite_level > 0) {
-                    cite_bar_t *cite_bar = g_new0(cite_bar_t, 1);
+                    cite_bar_t * cite_bar = g_new0(cite_bar_t, 1);
 
                     cite_bar->start_offs = cite_start;
                     cite_bar->end_offs = gtk_text_buffer_get_char_count(buffer);
@@ -1530,9 +1412,8 @@ fill_text_buf_cited(BalsaMimeWidgetText *mwt,
                     mwt->cite_bar_list =
                         g_list_append(mwt->cite_bar_list, cite_bar);
                 }
-                if (quote_level > 0) {
+                if (quote_level > 0)
                     cite_start = gtk_text_buffer_get_char_count(buffer);
-                }
                 cite_level = quote_level;
             }
 
@@ -1552,29 +1433,26 @@ fill_text_buf_cited(BalsaMimeWidgetText *mwt,
                 /* append a zero-width space if the remainder of the line is
                  * empty, as otherwise the line is not visible (i.e.
                  * completely 0.01 pts high)... */
-                if ((text_body == line_end) || (*text_body == '\r')) {
+                if (text_body == line_end || *text_body == '\r')
                     gtk_text_buffer_insert_at_cursor(buffer, "\xE2\x80\x8B", 3);
-                }
             }
         }
 
         len = line_end - text_body;
-        if ((len > 0) && (text_body[len - 1] == '\r')) {
+        if (len > 0 && text_body[len - 1] == '\r')
             --len;
-        }
         /* tag is NULL if the line isn't quoted, but it causes
          * no harm */
         if (!libbalsa_insert_with_url(buffer, text_body, len,
-                                      tag, &url_info)) {
+                                      tag, &url_info))
             gtk_text_buffer_insert_at_cursor(buffer, "\n", 1);
-        }
 
         text_body = *line_end ? line_end + 1 : line_end;
     }
 
     /* add any pending cited part */
     if (cite_level > 0) {
-        cite_bar_t *cite_bar = g_new0(cite_bar_t, 1);
+        cite_bar_t * cite_bar = g_new0(cite_bar_t, 1);
 
         cite_bar->start_offs = cite_start;
         cite_bar->end_offs = gtk_text_buffer_get_char_count(buffer);
@@ -1587,7 +1465,6 @@ fill_text_buf_cited(BalsaMimeWidgetText *mwt,
         g_signal_connect_after(widget, "draw", G_CALLBACK(draw_cite_bars), mwt);
     }
 
-    if (rex != NULL) {
+    if (rex != NULL)
         g_regex_unref(rex);
-    }
 }
diff --git a/src/balsa-mime-widget-text.h b/src/balsa-mime-widget-text.h
index ebded30..32f1c49 100644
--- a/src/balsa-mime-widget-text.h
+++ b/src/balsa-mime-widget-text.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -39,11 +39,11 @@ G_DECLARE_FINAL_TYPE(BalsaMimeWidgetText, balsa_mime_widget_text,
  * Method definitions.
  */
 
-BalsaMimeWidget * balsa_mime_widget_new_text(BalsaMessage * bm,
-                                             LibBalsaMessageBody * mime_body,
-                                             const gchar * content_type, gpointer data);
+BalsaMimeWidget *balsa_mime_widget_new_text(BalsaMessage * bm,
+                                           LibBalsaMessageBody * mime_body,
+                                           const gchar * content_type, gpointer data);
 
 
 G_END_DECLS
 
-#endif                          /* __BALSA_MIME_WIDGET_TEXT_H__ */
+#endif                         /* __BALSA_MIME_WIDGET_TEXT_H__ */
diff --git a/src/balsa-mime-widget-vcalendar.c b/src/balsa-mime-widget-vcalendar.c
index a2ea0f1..80cc2b2 100644
--- a/src/balsa-mime-widget-vcalendar.c
+++ b/src/balsa-mime-widget-vcalendar.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-mime-widget-vcalendar.h"
 
@@ -31,18 +31,16 @@
 #include "balsa-mime-widget-callbacks.h"
 
 
-static GtkWidget *balsa_vevent_widget(LibBalsaVEvent  *event,
-                                      gboolean         may_reply,
-                                      InternetAddress *sender);
-static void vevent_reply(GObject   *button,
-                         GtkWidget *box);
+static GtkWidget *balsa_vevent_widget(LibBalsaVEvent * event,
+                                     gboolean may_reply,
+                                     InternetAddress * sender);
+static void vevent_reply(GObject * button, GtkWidget * box);
 
 
 BalsaMimeWidget *
-balsa_mime_widget_new_vcalendar(BalsaMessage        *bm,
-                                LibBalsaMessageBody *mime_body,
-                                const gchar         *content_type,
-                                gpointer             data)
+balsa_mime_widget_new_vcalendar(BalsaMessage * bm,
+                               LibBalsaMessageBody * mime_body,
+                               const gchar * content_type, gpointer data)
 {
     LibBalsaVCal *vcal_obj;
     BalsaMimeWidget *mw;
@@ -52,23 +50,22 @@ balsa_mime_widget_new_vcalendar(BalsaMessage        *bm,
     GList *l;
     LibBalsaMessage *lbm = bm->message;
     gboolean may_reply = FALSE;
-    InternetAddress *sender = NULL;
+    InternetAddress *sender = NULL;;
 
     g_return_val_if_fail(mime_body != NULL, NULL);
     g_return_val_if_fail(content_type != NULL, NULL);
     g_return_val_if_fail(lbm != NULL, NULL);
 
     vcal_obj = libbalsa_vcal_new_from_body(mime_body);
-    if (!vcal_obj) {
-        return NULL;
-    }
+    if (!vcal_obj)
+       return NULL;
 
     mw = g_object_new(BALSA_TYPE_MIME_WIDGET, NULL);
     widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
     balsa_mime_widget_set_widget(mw, widget);
 
     text = g_strdup_printf(_("This is an iTIP calendar “%s” message."),
-                           libbalsa_vcal_method_to_str(vcal_obj->method));
+                          libbalsa_vcal_method_to_str(vcal_obj->method));
     label = gtk_label_new(text);
     g_free(text);
     gtk_widget_set_halign(label, GTK_ALIGN_START);
@@ -77,29 +74,27 @@ balsa_mime_widget_new_vcalendar(BalsaMessage        *bm,
 
     /* a reply may be created only for unread requests */
     if ((vcal_obj->method == ITIP_REQUEST) &&
-        LIBBALSA_MESSAGE_IS_UNREAD(lbm)) {
-        may_reply = TRUE;
-        if (lbm->headers) {
-            if (lbm->headers->reply_to) {
+       LIBBALSA_MESSAGE_IS_UNREAD(lbm)) {
+       may_reply = TRUE;
+       if (lbm->headers) {
+           if (lbm->headers->reply_to)
                 sender =
                     internet_address_list_get_address(lbm->headers->
                                                       reply_to, 0);
-            } else if (lbm->headers && lbm->headers->from) {
+           else if (lbm->headers && lbm->headers->from)
                 sender =
                     internet_address_list_get_address(lbm->headers->from,
                                                       0);
-            }
-        } else if (lbm->sender) {
-            sender = internet_address_list_get_address(lbm->sender, 0);
-        }
+       } else if (lbm->sender)
+           sender = internet_address_list_get_address(lbm->sender, 0);
     }
 
     /* add events */
     for (l = vcal_obj->vevent; l != NULL; l = l->next) {
-        GtkWidget *event =
-            balsa_vevent_widget((LibBalsaVEvent *) l->data, may_reply,
-                                sender);
-        gtk_box_pack_start(GTK_BOX(widget), event);
+       GtkWidget *event =
+           balsa_vevent_widget((LibBalsaVEvent *) l->data, may_reply,
+                               sender);
+       gtk_box_pack_start(GTK_BOX(widget), event);
     }
 
     g_object_unref(vcal_obj);
@@ -107,8 +102,7 @@ balsa_mime_widget_new_vcalendar(BalsaMessage        *bm,
     return mw;
 }
 
-
-#define GRID_ATTACH(g, str, label)                                        \
+#define GRID_ATTACH(g,str,label)                                        \
     do {                                                                \
         if (str) {                                                      \
             GtkWidget *lbl = gtk_label_new(label);                      \
@@ -122,30 +116,30 @@ balsa_mime_widget_new_vcalendar(BalsaMessage        *bm,
             gtk_widget_set_hexpand(lbl, TRUE);                          \
             gtk_widget_set_vexpand(lbl, TRUE);                          \
             gtk_grid_attach(g, lbl, 1, row, 1, 1);                      \
-            row ++;                                                      \
+            row++;                                                      \
         }                                                               \
     } while (0)
 
-#define GRID_ATTACH_DATE(g, date, label)                                  \
+#define GRID_ATTACH_DATE(g,date,label)                                  \
     do {                                                                \
         if (date != (time_t) -1) {                                      \
-            gchar *_dstr =                                             \
+            gchar * _dstr =                                             \
                 libbalsa_date_to_utf8(date, balsa_app.date_string);     \
             GRID_ATTACH(g, _dstr, label);                               \
             g_free(_dstr);                                              \
         }                                                               \
     } while (0)
 
-#define GRID_ATTACH_ADDRESS(g, addr, label)                               \
+#define GRID_ATTACH_ADDRESS(g,addr,label)                               \
     do {                                                                \
         if (addr) {                                                     \
-            gchar *_astr = libbalsa_vcal_attendee_to_str(addr);        \
+            gchar * _astr = libbalsa_vcal_attendee_to_str(addr);        \
             GRID_ATTACH(g, _astr, label);                               \
             g_free(_astr);                                              \
         }                                                               \
     } while (0)
 
-#define GRID_ATTACH_TEXT(g, text, label)                                  \
+#define GRID_ATTACH_TEXT(g,text,label)                                  \
     do {                                                                \
         if (text) {                                                     \
             GtkWidget *lbl = gtk_label_new(label);                      \
@@ -161,14 +155,13 @@ balsa_mime_widget_new_vcalendar(BalsaMessage        *bm,
             gtk_widget_set_hexpand(tview, TRUE);                        \
             gtk_widget_set_vexpand(tview, TRUE);                        \
             gtk_grid_attach(g, tview, 1, row, 1, 1);                    \
-            row ++;                                                      \
+            row++;                                                      \
         }                                                               \
     } while (0)
 
 static GtkWidget *
-balsa_vevent_widget(LibBalsaVEvent  *event,
-                    gboolean         may_reply,
-                    InternetAddress *sender)
+balsa_vevent_widget(LibBalsaVEvent * event, gboolean may_reply,
+                   InternetAddress * sender)
 {
     GtkGrid *grid;
     int row = 0;
@@ -183,23 +176,22 @@ balsa_vevent_widget(LibBalsaVEvent  *event,
     GRID_ATTACH_DATE(grid, event->end, _("End:"));
     GRID_ATTACH(grid, event->location, _("Location:"));
     if (event->attendee) {
-        GList *att;
-        GString *all_atts = NULL;
+       GList *att;
+       GString *all_atts = NULL;
 
-        for (att = event->attendee; att; att = att->next) {
-            LibBalsaAddress *lba = LIBBALSA_ADDRESS(att->data);
-            gchar *this_att = libbalsa_vcal_attendee_to_str(lba);
+       for (att = event->attendee; att; att = att->next) {
+           LibBalsaAddress *lba = LIBBALSA_ADDRESS(att->data);
+           gchar *this_att = libbalsa_vcal_attendee_to_str(lba);
 
-            if (all_atts) {
-                g_string_append_printf(all_atts, "\n%s", this_att);
-            } else {
-                all_atts = g_string_new(this_att);
-            }
-            g_free(this_att);
+           if (all_atts)
+               g_string_append_printf(all_atts, "\n%s", this_att);
+           else
+               all_atts = g_string_new(this_att);
+           g_free(this_att);
 
-            if (may_reply && libbalsa_vcal_attendee_rsvp(lba)) {
+           if (may_reply && libbalsa_vcal_attendee_rsvp(lba)) {
                 const gchar *addr = libbalsa_address_get_addr(lba);
-                InternetAddress *ia = internet_address_mailbox_new(NULL, addr);
+               InternetAddress *ia = internet_address_mailbox_new(NULL, addr);
                 GList *list;
 
                 for (list = balsa_app.identities; list; list = list->next) {
@@ -209,82 +201,79 @@ balsa_vevent_widget(LibBalsaVEvent  *event,
                         break;
                     }
                 }
-                g_object_unref(ia);
-            }
-        }
-        GRID_ATTACH(grid, all_atts->str,
+               g_object_unref(ia);
+           }
+       }
+       GRID_ATTACH(grid, all_atts->str,
                     ngettext("Attendee:", "Attendees:",
                              g_list_length(event->attendee)));
-        g_string_free(all_atts, TRUE);
+       g_string_free(all_atts, TRUE);
     }
     GRID_ATTACH_TEXT(grid, event->description, _("Description:"));
 
     if (sender && vevent_ident) {
-        GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
-        GtkWidget *label;
-        GtkWidget *bbox;
-        GtkWidget *button;
-
-        /* add the callback data to the event object */
-        g_object_ref(event);
-        g_object_ref(sender);
-        g_object_set_data_full(G_OBJECT(event), "ev:sender",
-                               internet_address_to_string(sender, FALSE),
-                               (GDestroyNotify) g_free);
+       GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
+       GtkWidget *label;
+       GtkWidget *bbox;
+       GtkWidget *button;
+
+       /* add the callback data to the event object */
+       g_object_ref(event);
+       g_object_ref(sender);
+       g_object_set_data_full(G_OBJECT(event), "ev:sender",
+                              internet_address_to_string(sender, FALSE),
+                              (GDestroyNotify) g_free);
         g_object_set_data_full(G_OBJECT(event), "ev:ident",
                                g_object_ref(vevent_ident),
+                              (GDestroyNotify) g_object_unref);
+
+       /* pack everything into a box */
+       gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(grid));
+       label =
+           gtk_label_new(_("The sender asks you for a reply to this request:"));
+       gtk_box_pack_start(GTK_BOX(box), label);
+       bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
+       gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox),
+                                 GTK_BUTTONBOX_SPREAD);
+       gtk_box_pack_start(GTK_BOX(box), bbox);
+
+       button = gtk_button_new_with_label(_("Accept"));
+       g_object_set_data_full(G_OBJECT(button), "event", event,
                                (GDestroyNotify) g_object_unref);
-
-        /* pack everything into a box */
-        gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(grid));
-        label =
-            gtk_label_new(_("The sender asks you for a reply to this request:"));
-        gtk_box_pack_start(GTK_BOX(box), label);
-        bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
-        gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox),
-                                  GTK_BUTTONBOX_SPREAD);
-        gtk_box_pack_start(GTK_BOX(box), bbox);
-
-        button = gtk_button_new_with_label(_("Accept"));
-        g_object_set_data_full(G_OBJECT(button), "event", event,
-                               (GDestroyNotify) g_object_unref);
-        g_object_set_data(G_OBJECT(button), "mode",
-                          GINT_TO_POINTER(VCAL_PSTAT_ACCEPTED));
-        g_signal_connect(G_OBJECT(button), "clicked",
-                         G_CALLBACK(vevent_reply), bbox);
-        gtk_box_pack_start(GTK_BOX(bbox), button);
-
-        button = gtk_button_new_with_label(_("Accept tentatively"));
-        g_object_set_data(G_OBJECT(button), "event", event);
-        g_object_set_data(G_OBJECT(button), "mode",
-                          GINT_TO_POINTER(VCAL_PSTAT_TENTATIVE));
-        g_signal_connect(G_OBJECT(button), "clicked",
-                         G_CALLBACK(vevent_reply), bbox);
-        gtk_box_pack_start(GTK_BOX(bbox), button);
-
-        button = gtk_button_new_with_label(_("Decline"));
-        g_object_set_data(G_OBJECT(button), "event", event);
-        g_object_set_data(G_OBJECT(button), "mode",
-                          GINT_TO_POINTER(VCAL_PSTAT_DECLINED));
-        g_signal_connect(G_OBJECT(button), "clicked",
-                         G_CALLBACK(vevent_reply), bbox);
-        gtk_box_pack_start(GTK_BOX(bbox), button);
-
-        return box;
-    } else {
-        return GTK_WIDGET(grid);
-    }
+       g_object_set_data(G_OBJECT(button), "mode",
+                         GINT_TO_POINTER(VCAL_PSTAT_ACCEPTED));
+       g_signal_connect(G_OBJECT(button), "clicked",
+                        G_CALLBACK(vevent_reply), bbox);
+       gtk_box_pack_start(GTK_BOX(bbox), button);
+
+       button = gtk_button_new_with_label(_("Accept tentatively"));
+       g_object_set_data(G_OBJECT(button), "event", event);
+       g_object_set_data(G_OBJECT(button), "mode",
+                         GINT_TO_POINTER(VCAL_PSTAT_TENTATIVE));
+       g_signal_connect(G_OBJECT(button), "clicked",
+                        G_CALLBACK(vevent_reply), bbox);
+       gtk_box_pack_start(GTK_BOX(bbox), button);
+
+       button = gtk_button_new_with_label(_("Decline"));
+       g_object_set_data(G_OBJECT(button), "event", event);
+       g_object_set_data(G_OBJECT(button), "mode",
+                         GINT_TO_POINTER(VCAL_PSTAT_DECLINED));
+       g_signal_connect(G_OBJECT(button), "clicked",
+                        G_CALLBACK(vevent_reply), bbox);
+       gtk_box_pack_start(GTK_BOX(bbox), button);
+
+       return box;
+    } else
+       return GTK_WIDGET(grid);
 }
 
-
 static void
-vevent_reply(GObject   *button,
-             GtkWidget *box)
+vevent_reply(GObject * button, GtkWidget * box)
 {
     LibBalsaVEvent *event =
-        LIBBALSA_VEVENT(g_object_get_data(button, "event"));
+       LIBBALSA_VEVENT(g_object_get_data(button, "event"));
     LibBalsaVCalPartStat pstat =
-        GPOINTER_TO_INT(g_object_get_data(button, "mode"));
+       GPOINTER_TO_INT(g_object_get_data(button, "mode"));
     gchar *rcpt;
     LibBalsaMessage *message;
     LibBalsaMessageBody *body;
@@ -312,17 +301,17 @@ vevent_reply(GObject   *button,
 
     /* create the message subject */
     dummy = g_strdup_printf("%s: %s",
-                            event->summary ? event->summary : _("iTIP Calendar Request"),
-                            libbalsa_vcal_part_stat_to_str(pstat));
+                           event->summary ? event->summary : _("iTIP Calendar Request"),
+                           libbalsa_vcal_part_stat_to_str(pstat));
     libbalsa_message_set_subject(message, dummy);
     g_free(dummy);
 
     /* the only message part is the calendar object */
     body = libbalsa_message_body_new(message);
     body->buffer =
-        libbalsa_vevent_reply(event,
-                              INTERNET_ADDRESS_MAILBOX(ident->ia)->addr,
-                              pstat);
+       libbalsa_vevent_reply(event,
+                             INTERNET_ADDRESS_MAILBOX(ident->ia)->addr,
+                             pstat);
     body->charset = g_strdup("utf-8");
     body->content_type = g_strdup("text/calendar");
     libbalsa_message_append_part(message, body);
@@ -335,19 +324,17 @@ vevent_reply(GObject   *button,
     message->parameters = g_list_prepend(message->parameters, params);
 
     result = libbalsa_message_send(message, balsa_app.outbox, NULL,
-                                   balsa_find_sentbox_by_url,
-                                   ident->smtp_server,
-                                   balsa_app.send_progress_dialog,
+                                  balsa_find_sentbox_by_url,
+                                  ident->smtp_server,
+                                  balsa_app.send_progress_dialog,
                                    GTK_WINDOW(gtk_widget_get_toplevel
-                                                  ((GtkWidget *) button)),
-                                   FALSE, &error);
-    if (result != LIBBALSA_MESSAGE_CREATE_OK) {
-        libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                             _("Sending the iTIP calendar reply failed: %s"),
-                             error ? error->message : "?");
-    }
-    if (error) {
-        g_error_free(error);
-    }
+                                              ((GtkWidget *) button)),
+                                  FALSE, &error);
+    if (result != LIBBALSA_MESSAGE_CREATE_OK)
+       libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                            _("Sending the iTIP calendar reply failed: %s"),
+                            error ? error->message : "?");
+    if (error)
+       g_error_free(error);
     g_object_unref(G_OBJECT(message));
 }
diff --git a/src/balsa-mime-widget-vcalendar.h b/src/balsa-mime-widget-vcalendar.h
index 525845e..70d449b 100644
--- a/src/balsa-mime-widget-vcalendar.h
+++ b/src/balsa-mime-widget-vcalendar.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -26,11 +26,11 @@
 
 G_BEGIN_DECLS
 
-BalsaMimeWidget *balsa_mime_widget_new_vcalendar(BalsaMessage        *bm,
-                                                 LibBalsaMessageBody *mime_body,
-                                                 const gchar         *content_type,
-                                                 gpointer             data);
+BalsaMimeWidget * balsa_mime_widget_new_vcalendar(BalsaMessage * bm,
+                                                  LibBalsaMessageBody * mime_body,
+                                                  const gchar * content_type,
+                                                  gpointer data);
 
 G_END_DECLS
 
-#endif                          /* __BALSA_MIME_WIDGET_VCALENDAR_H__ */
+#endif                         /* __BALSA_MIME_WIDGET_VCALENDAR_H__ */
diff --git a/src/balsa-mime-widget.c b/src/balsa-mime-widget.c
index ccc802e..ff98c99 100644
--- a/src/balsa-mime-widget.c
+++ b/src/balsa-mime-widget.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-mime-widget-image.h"
 
@@ -37,11 +37,11 @@
 
 
 /* fall-back widget (unknown/unsupported mime type) */
-static BalsaMimeWidget *balsa_mime_widget_new_unknown(BalsaMessage *bm,
-                                                      LibBalsaMessageBody *
-                                                      mime_body,
-                                                      const gchar *
-                                                      content_type);
+static BalsaMimeWidget *balsa_mime_widget_new_unknown(BalsaMessage * bm,
+                                                     LibBalsaMessageBody *
+                                                     mime_body,
+                                                     const gchar *
+                                                     content_type);
 
 typedef struct {
     /* display widget */
@@ -57,13 +57,12 @@ typedef struct {
 G_DEFINE_TYPE_WITH_PRIVATE(BalsaMimeWidget, balsa_mime_widget, G_TYPE_OBJECT)
 
 static void
-balsa_mime_widget_class_init(BalsaMimeWidgetClass *klass)
+balsa_mime_widget_class_init(BalsaMimeWidgetClass * klass)
 {
 }
 
-
 static void
-balsa_mime_widget_init(BalsaMimeWidget *self)
+balsa_mime_widget_init(BalsaMimeWidget * self)
 {
     BalsaMimeWidgetPrivate *priv = balsa_mime_widget_get_instance_private(self);
 
@@ -77,33 +76,32 @@ balsa_mime_widget_init(BalsaMimeWidget *self)
 typedef struct _mime_delegate_t {
     gboolean wildcard;
     const gchar *mime_type;
-    BalsaMimeWidget *(*handler)(BalsaMessage * bm,
-                                LibBalsaMessageBody * mime_body,
-                                const gchar * content_type,
-                                gpointer data);
+    BalsaMimeWidget *(*handler) (BalsaMessage * bm,
+                                LibBalsaMessageBody * mime_body,
+                                const gchar * content_type,
+                                gpointer data);
 } mime_delegate_t;
 
 static mime_delegate_t mime_delegate[] =
-{ {FALSE, "message/delivery-status", balsa_mime_widget_new_text},
-  {TRUE, "message/", balsa_mime_widget_new_message},
-  {FALSE, "text/calendar", balsa_mime_widget_new_vcalendar},
-  {FALSE, "text/rfc822-headers", balsa_mime_widget_new_message},
-  {TRUE, "text/", balsa_mime_widget_new_text},
-  {TRUE, "multipart/", balsa_mime_widget_new_multipart},
-  {TRUE, "image/", balsa_mime_widget_new_image},
+    { {FALSE, "message/delivery-status",       balsa_mime_widget_new_text},
+      {TRUE,  "message/",                      balsa_mime_widget_new_message},
+      {FALSE, "text/calendar",                 balsa_mime_widget_new_vcalendar},
+      {FALSE, "text/rfc822-headers",           balsa_mime_widget_new_message},
+      {TRUE,  "text/",                         balsa_mime_widget_new_text},
+      {TRUE,  "multipart/",                    balsa_mime_widget_new_multipart},
+      {TRUE,  "image/",                        balsa_mime_widget_new_image},
 #ifdef HAVE_GPGME
-  {FALSE, "application/pgp-signature", balsa_mime_widget_new_signature},
-  {FALSE, "application/pkcs7-signature", balsa_mime_widget_new_signature},
-  {FALSE, "application/x-pkcs7-signature", balsa_mime_widget_new_signature},
-  {FALSE, "application/pgp-keys", balsa_mime_widget_new_pgpkey},
+      {FALSE, "application/pgp-signature",     balsa_mime_widget_new_signature},
+      {FALSE, "application/pkcs7-signature",   balsa_mime_widget_new_signature},
+      {FALSE, "application/x-pkcs7-signature", balsa_mime_widget_new_signature},
+         {FALSE, "application/pgp-keys",                  balsa_mime_widget_new_pgpkey},
 #endif
-  {FALSE, NULL, NULL}};
+      {FALSE, NULL,         NULL}
+    };
 
 
 BalsaMimeWidget *
-balsa_mime_widget_new(BalsaMessage        *bm,
-                      LibBalsaMessageBody *mime_body,
-                      gpointer             data)
+balsa_mime_widget_new(BalsaMessage * bm, LibBalsaMessageBody * mime_body, gpointer data)
 {
     BalsaMimeWidget *mw = NULL;
     gchar *content_type;
@@ -116,46 +114,43 @@ balsa_mime_widget_new(BalsaMessage        *bm,
     content_type = libbalsa_message_body_get_mime_type(mime_body);
     delegate = mime_delegate;
     while (delegate->handler &&
-           ((delegate->wildcard &&
-             g_ascii_strncasecmp(delegate->mime_type, content_type,
-                                 strlen(delegate->mime_type))) ||
-            (!delegate->wildcard &&
-             g_ascii_strcasecmp(delegate->mime_type, content_type)))) {
-        delegate++;
-    }
-
-    if (delegate->handler) {
-        mw = (delegate->handler)(bm, mime_body, content_type, data);
-    }
+          ((delegate->wildcard &&
+            g_ascii_strncasecmp(delegate->mime_type, content_type,
+                                strlen(delegate->mime_type))) ||
+           (!delegate->wildcard &&
+            g_ascii_strcasecmp(delegate->mime_type, content_type))))
+       delegate++;
+
+    if (delegate->handler)
+       mw = (delegate->handler) (bm, mime_body, content_type, data);
     /* fall back to default if no handler is present */
-    if (!mw) {
-        mw = balsa_mime_widget_new_unknown(bm, mime_body, content_type);
-    }
+    if (!mw)
+       mw = balsa_mime_widget_new_unknown(bm, mime_body, content_type);
 
     if (mw != NULL) {
         BalsaMimeWidgetPrivate *priv = balsa_mime_widget_get_instance_private(mw);
 
-        if (priv->widget != NULL) {
-            g_signal_connect(priv->widget, "notify::has-focus",
-                             G_CALLBACK(balsa_mime_widget_check_focus), bm);
+       if (priv->widget != NULL) {
+           g_signal_connect(priv->widget, "notify::has-focus",
+                            G_CALLBACK(balsa_mime_widget_check_focus), bm);
 #ifdef HAVE_GPGME
-            if (mime_body->sig_info &&
-                g_ascii_strcasecmp("application/pgp-signature", content_type) &&
-                g_ascii_strcasecmp("application/pkcs7-signature", content_type) &&
-                g_ascii_strcasecmp("application/x-pkcs7-signature", content_type)) {
-                GtkWidget *signature =
-                    balsa_mime_widget_signature_widget(mime_body, content_type);
-                priv->widget = balsa_mime_widget_crypto_frame(mime_body, priv->widget,
-                                                              mime_body->was_encrypted,
-                                                              FALSE, signature);
-            } else if (mime_body->was_encrypted &&
-                       g_ascii_strcasecmp("multipart/signed", content_type)) {
-                priv->widget = balsa_mime_widget_crypto_frame(mime_body, priv->widget,
-                                                              TRUE, TRUE, NULL);
-            }
+           if (mime_body->sig_info &&
+               g_ascii_strcasecmp("application/pgp-signature", content_type) &&
+               g_ascii_strcasecmp("application/pkcs7-signature", content_type) &&
+               g_ascii_strcasecmp("application/x-pkcs7-signature", content_type)) {
+               GtkWidget * signature =
+                   balsa_mime_widget_signature_widget(mime_body, content_type);
+               priv->widget = balsa_mime_widget_crypto_frame(mime_body, priv->widget,
+                                                           mime_body->was_encrypted,
+                                                           FALSE, signature);
+           } else if (mime_body->was_encrypted &&
+                      g_ascii_strcasecmp("multipart/signed", content_type)) {
+               priv->widget = balsa_mime_widget_crypto_frame(mime_body, priv->widget,
+                                                           TRUE, TRUE, NULL);
+           }
 #endif
             g_object_ref_sink(priv->widget);
-        }
+       }
     }
     g_free(content_type);
 
@@ -164,9 +159,9 @@ balsa_mime_widget_new(BalsaMessage        *bm,
 
 
 static BalsaMimeWidget *
-balsa_mime_widget_new_unknown(BalsaMessage        *bm,
-                              LibBalsaMessageBody *mime_body,
-                              const gchar         *content_type)
+balsa_mime_widget_new_unknown(BalsaMessage * bm,
+                             LibBalsaMessageBody * mime_body,
+                             const gchar * content_type)
 {
     BalsaMimeWidgetPrivate *priv;
     GtkWidget *hbox;
@@ -185,28 +180,28 @@ balsa_mime_widget_new_unknown(BalsaMessage        *bm,
     g_object_set(G_OBJECT(priv->widget), "margin", BMW_CONTAINER_BORDER, NULL);
 
     if (mime_body->filename) {
-        msg = g_strdup_printf(_("File name: %s"), mime_body->filename);
-        gtk_box_pack_start(GTK_BOX(priv->widget), gtk_label_new(msg));
-        g_free(msg);
+       msg = g_strdup_printf(_("File name: %s"), mime_body->filename);
+       gtk_box_pack_start(GTK_BOX(priv->widget), gtk_label_new(msg));
+       g_free(msg);
     }
 
     /* guess content_type if not specified or if generic app/octet-stream */
     /* on local mailboxes only, to avoid possibly long downloads */
-    if (((content_type == NULL) ||
-         (g_ascii_strcasecmp(content_type, "application/octet-stream") == 0))
-        && LIBBALSA_IS_MAILBOX_LOCAL(mime_body->message->mailbox)) {
+    if ((content_type == NULL ||
+        g_ascii_strcasecmp(content_type, "application/octet-stream") == 0)
+       && LIBBALSA_IS_MAILBOX_LOCAL(mime_body->message->mailbox)) {
         GError *err = NULL;
-        GMimeStream *stream =
+       GMimeStream *stream = 
             libbalsa_message_body_get_stream(mime_body, &err);
-        if (!stream) {
+        if(!stream) {
             libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                                 _("Error reading message part: %s"),
-                                 err ? err->message : "Unknown error");
+                             _("Error reading message part: %s"),
+                             err ? err->message : "Unknown error");
             g_clear_error(&err);
             use_content_type = g_strdup(content_type);
         } else {
-            gpointer buffer;
-            ssize_t length = 1024 /* g_mime_stream_length(stream) */;
+               gpointer buffer;
+            ssize_t length = 1024 /* g_mime_stream_length(stream) */ ;
             ssize_t size;
 
             buffer = g_malloc0(length + 1);
@@ -215,30 +210,28 @@ balsa_mime_widget_new_unknown(BalsaMessage        *bm,
             libbalsa_mime_stream_shared_unlock(stream);
             g_object_unref(stream);
             if (size != -1) {
-                use_content_type = libbalsa_vfs_content_type_of_buffer(buffer, size);
-                if ((g_ascii_strncasecmp(use_content_type, "text", 4) == 0)
+               use_content_type = libbalsa_vfs_content_type_of_buffer(buffer, size);
+                if (g_ascii_strncasecmp(use_content_type, "text", 4) == 0
                     && (libbalsa_text_attr_string(buffer) & LIBBALSA_TEXT_HI_BIT)) {
                     /* Hmmm...better stick with application/octet-stream. */
                     g_free(use_content_type);
                     use_content_type = g_strdup("application/octet-stream");
                 }
             } else {
-                use_content_type = g_strdup("application/octet-stream");
+               use_content_type = g_strdup("application/octet-stream");
             }
             g_free(buffer);
         }
-    } else {
-        use_content_type = g_strdup(content_type);
-    }
+    } else
+       use_content_type = g_strdup(content_type);
 
     content_desc = libbalsa_vfs_content_description(use_content_type);
     if (content_desc) {
-        msg = g_strdup_printf(_("Type: %s (%s)"), content_desc,
-                              use_content_type);
+       msg = g_strdup_printf(_("Type: %s (%s)"), content_desc,
+                             use_content_type);
         g_free(content_desc);
-    } else {
-        msg = g_strdup_printf(_("Content Type: %s"), use_content_type);
-    }
+    } else
+       msg = g_strdup_printf(_("Content Type: %s"), use_content_type);
     msg_label = gtk_label_new(msg);
     g_free(msg);
     gtk_label_set_ellipsize(GTK_LABEL(msg_label), PANGO_ELLIPSIZE_END);
@@ -250,11 +243,11 @@ balsa_mime_widget_new_unknown(BalsaMessage        *bm,
                                            G_CALLBACK(balsa_mime_widget_ctx_menu_cb),
                                            (gpointer) mime_body))) {
         gtk_widget_set_hexpand(button, TRUE);
-        gtk_box_pack_start(GTK_BOX(hbox), button);
+       gtk_box_pack_start(GTK_BOX(hbox), button);
     } else {
-        gtk_box_pack_start(GTK_BOX(priv->widget),
-                           gtk_label_new(_("No open or view action "
-                                           "defined for this content type")));
+       gtk_box_pack_start(GTK_BOX(priv->widget),
+                          gtk_label_new(_("No open or view action "
+                                          "defined for this content type")));
     }
     g_free(use_content_type);
 
@@ -262,73 +255,64 @@ balsa_mime_widget_new_unknown(BalsaMessage        *bm,
     gtk_widget_set_hexpand(button, TRUE);
     gtk_box_pack_start(GTK_BOX(hbox), button);
     g_signal_connect(G_OBJECT(button), "clicked",
-                     G_CALLBACK(balsa_mime_widget_ctx_menu_save),
-                     (gpointer) mime_body);
+                    G_CALLBACK(balsa_mime_widget_ctx_menu_save),
+                    (gpointer) mime_body);
 
     gtk_box_pack_start(GTK_BOX(priv->widget), hbox);
 
     return mw;
 }
 
-
 /*
  * Getters
  */
 
 GtkWidget *
-balsa_mime_widget_get_widget(BalsaMimeWidget *mw)
+balsa_mime_widget_get_widget(BalsaMimeWidget * mw)
 {
     BalsaMimeWidgetPrivate *priv = balsa_mime_widget_get_instance_private(mw);
 
     return priv->widget;
 }
 
-
 GtkWidget *
-balsa_mime_widget_get_container(BalsaMimeWidget *mw)
+balsa_mime_widget_get_container(BalsaMimeWidget * mw)
 {
     BalsaMimeWidgetPrivate *priv = balsa_mime_widget_get_instance_private(mw);
 
     return priv->container;
 }
 
-
 GtkWidget *
-balsa_mime_widget_get_header_widget(BalsaMimeWidget *mw)
+balsa_mime_widget_get_header_widget(BalsaMimeWidget * mw)
 {
     BalsaMimeWidgetPrivate *priv = balsa_mime_widget_get_instance_private(mw);
 
     return priv->header_widget;
 }
 
-
 /*
  * Setters
  */
 
 void
-balsa_mime_widget_set_widget(BalsaMimeWidget *mw,
-                             GtkWidget       *widget)
+balsa_mime_widget_set_widget(BalsaMimeWidget * mw, GtkWidget * widget)
 {
     BalsaMimeWidgetPrivate *priv = balsa_mime_widget_get_instance_private(mw);
 
     priv->widget = widget;
 }
 
-
 void
-balsa_mime_widget_set_container(BalsaMimeWidget *mw,
-                                GtkWidget       *widget)
+balsa_mime_widget_set_container(BalsaMimeWidget * mw, GtkWidget * widget)
 {
     BalsaMimeWidgetPrivate *priv = balsa_mime_widget_get_instance_private(mw);
 
     priv->container = widget;
 }
 
-
 void
-balsa_mime_widget_set_header_widget(BalsaMimeWidget *mw,
-                                    GtkWidget       *widget)
+balsa_mime_widget_set_header_widget(BalsaMimeWidget * mw, GtkWidget * widget)
 {
     BalsaMimeWidgetPrivate *priv = balsa_mime_widget_get_instance_private(mw);
 
diff --git a/src/balsa-mime-widget.h b/src/balsa-mime-widget.h
index fb93961..43375a2 100644
--- a/src/balsa-mime-widget.h
+++ b/src/balsa-mime-widget.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -51,29 +51,26 @@ G_DECLARE_DERIVABLE_TYPE(BalsaMimeWidget, balsa_mime_widget, BALSA, MIME_WIDGET,
  * Method definitions.
  */
 
-BalsaMimeWidget * balsa_mime_widget_new(BalsaMessage * bm,
-                                        LibBalsaMessageBody * mime_body,
-                                        gpointer data);
+BalsaMimeWidget *balsa_mime_widget_new(BalsaMessage * bm,
+                                      LibBalsaMessageBody * mime_body,
+                                      gpointer data);
 
 /*
  * Getters
  */
 
-GtkWidget *balsa_mime_widget_get_widget(BalsaMimeWidget *mw);
-GtkWidget *balsa_mime_widget_get_container(BalsaMimeWidget *mw);
-GtkWidget *balsa_mime_widget_get_header_widget(BalsaMimeWidget *mw);
+GtkWidget *balsa_mime_widget_get_widget       (BalsaMimeWidget * mw);
+GtkWidget *balsa_mime_widget_get_container    (BalsaMimeWidget * mw);
+GtkWidget *balsa_mime_widget_get_header_widget(BalsaMimeWidget * mw);
 
 /*
  * Setters
  */
 
-void balsa_mime_widget_set_widget(BalsaMimeWidget *mw,
-                                  GtkWidget       *widget);
-void balsa_mime_widget_set_container(BalsaMimeWidget *mw,
-                                     GtkWidget       *widget);
-void balsa_mime_widget_set_header_widget(BalsaMimeWidget *mw,
-                                         GtkWidget       *widget);
+void balsa_mime_widget_set_widget       (BalsaMimeWidget * mw, GtkWidget * widget);
+void balsa_mime_widget_set_container    (BalsaMimeWidget * mw, GtkWidget * widget);
+void balsa_mime_widget_set_header_widget(BalsaMimeWidget * mw, GtkWidget * widget);
 
 G_END_DECLS
 
-#endif                          /* __BALSA_MIME_WIDGET_H__ */
+#endif                         /* __BALSA_MIME_WIDGET_H__ */
diff --git a/src/balsa-print-object-decor.c b/src/balsa-print-object-decor.c
index 181499c..741ec8d 100644
--- a/src/balsa-print-object-decor.c
+++ b/src/balsa-print-object-decor.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-print-object-decor.h"
 
@@ -26,14 +26,14 @@
 
 
 /* object related functions */
-static void balsa_print_object_decor_class_init(BalsaPrintObjectDecorClass *klass);
-static void balsa_print_object_decor_init(GTypeInstance *instance,
-                                          gpointer       g_class);
-static void balsa_print_object_decor_finalize(GObject *self);
+static void
+balsa_print_object_decor_class_init(BalsaPrintObjectDecorClass *klass);
+static void balsa_print_object_decor_init (GTypeInstance *instance, gpointer g_class);
+static void balsa_print_object_decor_finalize(GObject * self);
 
-static void balsa_print_object_decor_draw(BalsaPrintObject *self,
-                                          GtkPrintContext  *context,
-                                          cairo_t          *cairo_ctx);
+static void balsa_print_object_decor_draw(BalsaPrintObject * self,
+                                         GtkPrintContext * context,
+                                         cairo_t * cairo_ctx);
 
 
 static BalsaPrintObjectClass *parent_class = NULL;
@@ -45,22 +45,22 @@ balsa_print_object_decor_get_type()
     static GType balsa_print_object_decor_type = 0;
 
     if (!balsa_print_object_decor_type) {
-        static const GTypeInfo balsa_print_object_decor_info = {
-            sizeof(BalsaPrintObjectDecorClass),
-            NULL,               /* base_init */
-            NULL,               /* base_finalize */
-            (GClassInitFunc) balsa_print_object_decor_class_init,
-            NULL,               /* class_finalize */
-            NULL,               /* class_data */
-            sizeof(BalsaPrintObjectDecor),
-            0,                  /* n_preallocs */
-            (GInstanceInitFunc) balsa_print_object_decor_init
-        };
-
-        balsa_print_object_decor_type =
-            g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
-                                   "BalsaPrintObjectDecor",
-                                   &balsa_print_object_decor_info, 0);
+       static const GTypeInfo balsa_print_object_decor_info = {
+           sizeof(BalsaPrintObjectDecorClass),
+           NULL,               /* base_init */
+           NULL,               /* base_finalize */
+           (GClassInitFunc) balsa_print_object_decor_class_init,
+           NULL,               /* class_finalize */
+           NULL,               /* class_data */
+           sizeof(BalsaPrintObjectDecor),
+           0,                  /* n_preallocs */
+           (GInstanceInitFunc) balsa_print_object_decor_init
+       };
+
+       balsa_print_object_decor_type =
+           g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
+                                  "BalsaPrintObjectDecor",
+                                  &balsa_print_object_decor_info, 0);
     }
 
     return balsa_print_object_decor_type;
@@ -72,14 +72,14 @@ balsa_print_object_decor_class_init(BalsaPrintObjectDecorClass *klass)
 {
     parent_class = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
     BALSA_PRINT_OBJECT_CLASS(klass)->draw =
-        balsa_print_object_decor_draw;
+       balsa_print_object_decor_draw;
     G_OBJECT_CLASS(klass)->finalize = balsa_print_object_decor_finalize;
 }
 
 
 static void
-balsa_print_object_decor_init(GTypeInstance *instance,
-                              gpointer       g_class)
+balsa_print_object_decor_init(GTypeInstance * instance,
+                             gpointer g_class)
 {
     BalsaPrintObjectDecor *po = BALSA_PRINT_OBJECT_DECOR(instance);
 
@@ -88,7 +88,7 @@ balsa_print_object_decor_init(GTypeInstance *instance,
 
 
 static void
-balsa_print_object_decor_finalize(GObject *self)
+balsa_print_object_decor_finalize(GObject * self)
 {
     BalsaPrintObjectDecor *po = BALSA_PRINT_OBJECT_DECOR(self);
 
@@ -99,8 +99,7 @@ balsa_print_object_decor_finalize(GObject *self)
 
 
 static BalsaPrintObject *
-decor_new_real(BalsaPrintSetup    *psetup,
-               BalsaPrintDecorType mode)
+decor_new_real(BalsaPrintSetup * psetup, BalsaPrintDecorType mode)
 {
     BalsaPrintObjectDecor *pod;
     BalsaPrintObject *po;
@@ -115,8 +114,8 @@ decor_new_real(BalsaPrintSetup    *psetup,
 
     /* check if it should start on a new page */
     if (psetup->c_y_pos + C_SEPARATOR > psetup->c_height) {
-        psetup->page_count++;
-        psetup->c_y_pos = 0;
+       psetup->page_count++;
+       psetup->c_y_pos = 0;
     }
 
     /* remember the extent */
@@ -134,17 +133,14 @@ decor_new_real(BalsaPrintSetup    *psetup,
 
 
 GList *
-balsa_print_object_separator(GList           *list,
-                             BalsaPrintSetup *psetup)
+balsa_print_object_separator(GList * list, BalsaPrintSetup * psetup)
 {
     return g_list_append(list, decor_new_real(psetup, BALSA_PRINT_DECOR_SEPARATOR));
 }
 
 
 GList *
-balsa_print_object_frame_begin(GList           *list,
-                               const gchar     *label,
-                               BalsaPrintSetup *psetup)
+balsa_print_object_frame_begin(GList * list, const gchar * label, BalsaPrintSetup * psetup)
 {
     BalsaPrintObjectDecor *pod;
     BalsaPrintObject *po;
@@ -157,18 +153,17 @@ balsa_print_object_frame_begin(GList           *list,
     po->depth = psetup->curr_depth++;
     pod->mode = BALSA_PRINT_DECOR_FRAME_BEGIN;
     if (label) {
-        pod->label = g_strdup(label);
-        po->c_height = MAX(P_TO_C(psetup->p_hdr_font_height), C_SEPARATOR) +
-            C_SEPARATOR * 0.5;
-    } else {
-        po->c_height = C_SEPARATOR;
-    }
+       pod->label = g_strdup(label);
+       po->c_height = MAX(P_TO_C(psetup->p_hdr_font_height), C_SEPARATOR) +
+           C_SEPARATOR * 0.5;
+    } else
+       po->c_height = C_SEPARATOR;
 
     /* check if it should start on a new page */
     if (psetup->c_y_pos + po->c_height +
-        3 * P_TO_C(psetup->p_body_font_height) > psetup->c_height) {
-        psetup->page_count++;
-        psetup->c_y_pos = 0;
+       3 * P_TO_C(psetup->p_body_font_height) > psetup->c_height) {
+       psetup->page_count++;
+       psetup->c_y_pos = 0;
     }
 
     /* remember the extent */
@@ -185,8 +180,7 @@ balsa_print_object_frame_begin(GList           *list,
 
 
 GList *
-balsa_print_object_frame_end(GList           *list,
-                             BalsaPrintSetup *psetup)
+balsa_print_object_frame_end(GList * list, BalsaPrintSetup * psetup)
 {
     g_return_val_if_fail(psetup->curr_depth > 0, list);
     psetup->curr_depth--;
@@ -195,9 +189,9 @@ balsa_print_object_frame_end(GList           *list,
 
 
 static void
-balsa_print_object_decor_draw(BalsaPrintObject *self,
-                              GtkPrintContext  *context,
-                              cairo_t          *cairo_ctx)
+balsa_print_object_decor_draw(BalsaPrintObject * self,
+                             GtkPrintContext * context,
+                             cairo_t * cairo_ctx)
 {
     BalsaPrintObjectDecor *pod;
 
@@ -210,58 +204,58 @@ balsa_print_object_decor_draw(BalsaPrintObject *self,
 
     switch (pod->mode) {
     case BALSA_PRINT_DECOR_SEPARATOR:
-        cairo_set_line_width(cairo_ctx, 1.0);
-        cairo_move_to(cairo_ctx, self->c_at_x, self->c_at_y + 0.5 * C_SEPARATOR);
-        cairo_line_to(cairo_ctx, self->c_at_x + self->c_width,
-                      self->c_at_y + 0.5 * C_SEPARATOR);
-        break;
+       cairo_set_line_width(cairo_ctx, 1.0);
+       cairo_move_to(cairo_ctx, self->c_at_x, self->c_at_y + 0.5 * C_SEPARATOR);
+       cairo_line_to(cairo_ctx, self->c_at_x + self->c_width,
+                     self->c_at_y + 0.5 * C_SEPARATOR);
+       break;
 
     case BALSA_PRINT_DECOR_FRAME_END:
-        cairo_set_line_width(cairo_ctx, 0.25);
-        cairo_move_to(cairo_ctx, self->c_at_x, self->c_at_y);
-        cairo_line_to(cairo_ctx, self->c_at_x, self->c_at_y + 0.5 * C_SEPARATOR);
-        cairo_line_to(cairo_ctx, self->c_at_x + self->c_width,
-                      self->c_at_y + 0.5 * C_SEPARATOR);
-        cairo_line_to(cairo_ctx, self->c_at_x + self->c_width, self->c_at_y);
-        break;
+       cairo_set_line_width(cairo_ctx, 0.25);
+       cairo_move_to(cairo_ctx, self->c_at_x, self->c_at_y);
+       cairo_line_to(cairo_ctx, self->c_at_x, self->c_at_y + 0.5 * C_SEPARATOR);
+       cairo_line_to(cairo_ctx, self->c_at_x + self->c_width,
+                     self->c_at_y + 0.5 * C_SEPARATOR);
+       cairo_line_to(cairo_ctx, self->c_at_x + self->c_width, self->c_at_y);
+       break;
 
     case BALSA_PRINT_DECOR_FRAME_BEGIN:
-        cairo_set_line_width(cairo_ctx, 0.25);
-        cairo_move_to(cairo_ctx, self->c_at_x, self->c_at_y + self->c_height);
-        if (pod->label) {
-            PangoLayout *layout;
-            PangoFontDescription *font;
-            gint p_label_width;
-            gint p_label_height;
-            gdouble c_y_hor_line;
-
-            /* print the label */
-            font = pango_font_description_from_string(balsa_app.print_header_font);
-            layout = gtk_print_context_create_pango_layout(context);
-            pango_layout_set_font_description(layout, font);
-            pango_font_description_free(font);
-            pango_layout_set_text(layout, pod->label, -1);
-            pango_layout_get_size(layout, &p_label_width, &p_label_height);
-            c_y_hor_line = self->c_at_y + self->c_height -
-                MAX(P_TO_C(p_label_height), C_SEPARATOR) * 0.5;
-            cairo_line_to(cairo_ctx, self->c_at_x, c_y_hor_line);
-            cairo_line_to(cairo_ctx, self->c_at_x + C_LABEL_SEP, c_y_hor_line);
-            cairo_move_to(cairo_ctx, self->c_at_x + 1.5 * C_LABEL_SEP,
-                          c_y_hor_line - 0.5 * P_TO_C(p_label_height));
-            pango_cairo_show_layout(cairo_ctx, layout);
-            g_object_unref(G_OBJECT(layout));
-            cairo_move_to(cairo_ctx, self->c_at_x + 2.0 * C_LABEL_SEP + P_TO_C(p_label_width),
-                          c_y_hor_line);
-            cairo_line_to(cairo_ctx, self->c_at_x + self->c_width, c_y_hor_line);
-        } else {
-            cairo_line_to(cairo_ctx, self->c_at_x,
-                          self->c_at_y + self->c_height - 0.5 * C_SEPARATOR);
-            cairo_line_to(cairo_ctx, self->c_at_x + self->c_width,
-                          self->c_at_y + self->c_height - 0.5 * C_SEPARATOR);
-        }
-        cairo_line_to(cairo_ctx, self->c_at_x + self->c_width,
-                      self->c_at_y + self->c_height);
-        break;
+       cairo_set_line_width(cairo_ctx, 0.25);
+       cairo_move_to(cairo_ctx, self->c_at_x, self->c_at_y + self->c_height);
+       if (pod->label) {
+           PangoLayout *layout;
+           PangoFontDescription *font;
+           gint p_label_width;
+           gint p_label_height;
+           gdouble c_y_hor_line;
+
+           /* print the label */
+           font = pango_font_description_from_string(balsa_app.print_header_font);
+           layout = gtk_print_context_create_pango_layout(context);
+           pango_layout_set_font_description(layout, font);
+           pango_font_description_free(font);
+           pango_layout_set_text(layout, pod->label, -1);
+           pango_layout_get_size(layout, &p_label_width, &p_label_height);
+           c_y_hor_line = self->c_at_y + self->c_height -
+               MAX(P_TO_C(p_label_height), C_SEPARATOR) * 0.5;
+           cairo_line_to(cairo_ctx, self->c_at_x, c_y_hor_line);
+           cairo_line_to(cairo_ctx, self->c_at_x + C_LABEL_SEP, c_y_hor_line);
+           cairo_move_to(cairo_ctx, self->c_at_x + 1.5 * C_LABEL_SEP,
+                         c_y_hor_line - 0.5 * P_TO_C(p_label_height));
+           pango_cairo_show_layout(cairo_ctx, layout);
+           g_object_unref(G_OBJECT(layout));
+           cairo_move_to(cairo_ctx, self->c_at_x + 2.0 * C_LABEL_SEP + P_TO_C(p_label_width),
+                         c_y_hor_line);
+           cairo_line_to(cairo_ctx, self->c_at_x + self->c_width, c_y_hor_line);
+       } else {
+           cairo_line_to(cairo_ctx, self->c_at_x,
+                         self->c_at_y + self->c_height - 0.5 * C_SEPARATOR);
+           cairo_line_to(cairo_ctx, self->c_at_x + self->c_width,
+                         self->c_at_y + self->c_height - 0.5 * C_SEPARATOR);
+       }
+       cairo_line_to(cairo_ctx, self->c_at_x + self->c_width,
+                     self->c_at_y + self->c_height);
+       break;
     }
 
     cairo_stroke(cairo_ctx);
diff --git a/src/balsa-print-object-decor.h b/src/balsa-print-object-decor.h
index a1e90c0..90a2cac 100644
--- a/src/balsa-print-object-decor.h
+++ b/src/balsa-print-object-decor.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -24,13 +24,13 @@
 
 G_BEGIN_DECLS
 
-#define BALSA_TYPE_PRINT_OBJECT_DECOR   \
+#define BALSA_TYPE_PRINT_OBJECT_DECOR  \
     (balsa_print_object_decor_get_type())
-#define BALSA_PRINT_OBJECT_DECOR(obj)                           \
+#define BALSA_PRINT_OBJECT_DECOR(obj)                          \
     G_TYPE_CHECK_INSTANCE_CAST(obj, BALSA_TYPE_PRINT_OBJECT_DECOR, BalsaPrintObjectDecor)
-#define BALSA_PRINT_OBJECT_DECOR_CLASS(klass)                   \
+#define BALSA_PRINT_OBJECT_DECOR_CLASS(klass)                  \
     G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_PRINT_OBJECT_DECOR, BalsaPrintObjectDecorClass)
-#define BALSA_IS_PRINT_OBJECT_DECOR(obj)                        \
+#define BALSA_IS_PRINT_OBJECT_DECOR(obj)                       \
     G_TYPE_CHECK_INSTANCE_TYPE(obj, BALSA_TYPE_PRINT_OBJECT_DECOR)
 
 typedef struct _BalsaPrintObjectDecorClass BalsaPrintObjectDecorClass;
@@ -46,7 +46,7 @@ struct _BalsaPrintObjectDecor {
     BalsaPrintObject parent;
 
     BalsaPrintDecorType mode;
-    gchar *label;
+    gchar * label;
 };
 
 
@@ -56,15 +56,12 @@ struct _BalsaPrintObjectDecorClass {
 
 
 GType balsa_print_object_decor_get_type(void);
-GList *balsa_print_object_separator(GList           *list,
-                                    BalsaPrintSetup *psetup);
-GList *balsa_print_object_frame_begin(GList           *list,
-                                      const gchar     *label,
-                                      BalsaPrintSetup *psetup);
-GList *balsa_print_object_frame_end(GList           *list,
-                                    BalsaPrintSetup *psetup);
+GList *balsa_print_object_separator(GList * list, BalsaPrintSetup * psetup);
+GList *balsa_print_object_frame_begin(GList * list, const gchar * label,
+                                     BalsaPrintSetup * psetup);
+GList *balsa_print_object_frame_end(GList * list, BalsaPrintSetup * psetup);
 
 
 G_END_DECLS
 
-#endif                          /* __BALSA_PRINT_OBJECT_SEPARATOR_H__ */
+#endif                         /* __BALSA_PRINT_OBJECT_SEPARATOR_H__ */
diff --git a/src/balsa-print-object-default.c b/src/balsa-print-object-default.c
index 313c650..db9e14f 100644
--- a/src/balsa-print-object-default.c
+++ b/src/balsa-print-object-default.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-print-object-default.h"
 
@@ -29,16 +29,17 @@
 
 
 /* object related functions */
-static void balsa_print_object_default_class_init(BalsaPrintObjectDefaultClass *
-                                                  klass);
-static void balsa_print_object_default_init(GTypeInstance *instance,
-                                            gpointer       g_class);
-static void balsa_print_object_default_dispose(GObject *self);
-static void balsa_print_object_default_finalize(GObject *self);
+static void
+balsa_print_object_default_class_init(BalsaPrintObjectDefaultClass *
+                                     klass);
+static void balsa_print_object_default_init(GTypeInstance * instance,
+                                           gpointer g_class);
+static void balsa_print_object_default_dispose(GObject * self);
+static void balsa_print_object_default_finalize(GObject * self);
 
-static void balsa_print_object_default_draw(BalsaPrintObject *self,
-                                            GtkPrintContext  *context,
-                                            cairo_t          *cairo_ctx);
+static void balsa_print_object_default_draw(BalsaPrintObject * self,
+                                           GtkPrintContext * context,
+                                           cairo_t * cairo_ctx);
 
 
 static BalsaPrintObjectClass *parent_class = NULL;
@@ -50,22 +51,22 @@ balsa_print_object_default_get_type()
     static GType balsa_print_object_default_type = 0;
 
     if (!balsa_print_object_default_type) {
-        static const GTypeInfo balsa_print_object_default_info = {
-            sizeof(BalsaPrintObjectDefaultClass),
-            NULL,               /* base_init */
-            NULL,               /* base_finalize */
-            (GClassInitFunc) balsa_print_object_default_class_init,
-            NULL,               /* class_finalize */
-            NULL,               /* class_data */
-            sizeof(BalsaPrintObjectDefault),
-            0,                  /* n_preallocs */
-            (GInstanceInitFunc) balsa_print_object_default_init
-        };
-
-        balsa_print_object_default_type =
-            g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
-                                   "BalsaPrintObjectDefault",
-                                   &balsa_print_object_default_info, 0);
+       static const GTypeInfo balsa_print_object_default_info = {
+           sizeof(BalsaPrintObjectDefaultClass),
+           NULL,               /* base_init */
+           NULL,               /* base_finalize */
+           (GClassInitFunc) balsa_print_object_default_class_init,
+           NULL,               /* class_finalize */
+           NULL,               /* class_data */
+           sizeof(BalsaPrintObjectDefault),
+           0,                  /* n_preallocs */
+           (GInstanceInitFunc) balsa_print_object_default_init
+       };
+
+       balsa_print_object_default_type =
+           g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
+                                  "BalsaPrintObjectDefault",
+                                  &balsa_print_object_default_info, 0);
     }
 
     return balsa_print_object_default_type;
@@ -73,19 +74,18 @@ balsa_print_object_default_get_type()
 
 
 static void
-balsa_print_object_default_class_init(BalsaPrintObjectDefaultClass *klass)
+balsa_print_object_default_class_init(BalsaPrintObjectDefaultClass * klass)
 {
     parent_class = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
     BALSA_PRINT_OBJECT_CLASS(klass)->draw =
-        balsa_print_object_default_draw;
+       balsa_print_object_default_draw;
     G_OBJECT_CLASS(klass)->dispose = balsa_print_object_default_dispose;
     G_OBJECT_CLASS(klass)->finalize = balsa_print_object_default_finalize;
 }
 
 
 static void
-balsa_print_object_default_init(GTypeInstance *instance,
-                                gpointer       g_class)
+balsa_print_object_default_init(GTypeInstance * instance, gpointer g_class)
 {
     BalsaPrintObjectDefault *po = BALSA_PRINT_OBJECT_DEFAULT(instance);
 
@@ -95,7 +95,7 @@ balsa_print_object_default_init(GTypeInstance *instance,
 
 
 static void
-balsa_print_object_default_dispose(GObject *self)
+balsa_print_object_default_dispose(GObject * self)
 {
     BalsaPrintObjectDefault *po = BALSA_PRINT_OBJECT_DEFAULT(self);
 
@@ -106,7 +106,7 @@ balsa_print_object_default_dispose(GObject *self)
 
 
 static void
-balsa_print_object_default_finalize(GObject *self)
+balsa_print_object_default_finalize(GObject * self)
 {
     BalsaPrintObjectDefault *po = BALSA_PRINT_OBJECT_DEFAULT(self);
 
@@ -117,10 +117,10 @@ balsa_print_object_default_finalize(GObject *self)
 
 
 GList *
-balsa_print_object_default(GList               *list,
-                           GtkPrintContext     *context,
-                           LibBalsaMessageBody *body,
-                           BalsaPrintSetup     *psetup)
+balsa_print_object_default(GList * list,
+                          GtkPrintContext * context,
+                          LibBalsaMessageBody * body,
+                          BalsaPrintSetup * psetup)
 {
     BalsaPrintObjectDefault *pod;
     BalsaPrintObject *po;
@@ -139,7 +139,7 @@ balsa_print_object_default(GList               *list,
     /* create the part */
     po->depth = psetup->curr_depth;
     po->c_width =
-        psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
+       psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
 
     /* get a pixbuf according to the mime type */
     conttype = libbalsa_message_body_get_mime_type(body);
@@ -150,7 +150,7 @@ balsa_print_object_default(GList               *list,
 
     /* create a layout for calculating the maximum label width */
     header_font =
-        pango_font_description_from_string(balsa_app.print_header_font);
+       pango_font_description_from_string(balsa_app.print_header_font);
     test_layout = gtk_print_context_create_pango_layout(context);
     pango_layout_set_font_description(test_layout, header_font);
     pango_font_description_free(header_font);
@@ -158,24 +158,22 @@ balsa_print_object_default(GList               *list,
 
     /* add type and filename (if available) */
     pod->p_label_width =
-        p_string_width_from_layout(test_layout, _("Type:"));
-    if ((part_desc = libbalsa_vfs_content_description(conttype))) {
-        g_string_append_printf(desc_buf, "%s\t%s (%s)", _("Type:"),
-                               part_desc, conttype);
-    } else {
-        g_string_append_printf(desc_buf, "%s\t%s", _("Type:"), conttype);
-    }
+       p_string_width_from_layout(test_layout, _("Type:"));
+    if ((part_desc = libbalsa_vfs_content_description(conttype)))
+       g_string_append_printf(desc_buf, "%s\t%s (%s)", _("Type:"),
+                              part_desc, conttype);
+    else
+       g_string_append_printf(desc_buf, "%s\t%s", _("Type:"), conttype);
     g_free(part_desc);
     g_free(conttype);
     if (body->filename) {
-        gint p_fnwidth =
-            p_string_width_from_layout(test_layout, _("File name:"));
-
-        if (p_fnwidth > pod->p_label_width) {
-            pod->p_label_width = p_fnwidth;
-        }
-        g_string_append_printf(desc_buf, "\n%s\t%s", _("File name:"),
-                               body->filename);
+       gint p_fnwidth =
+           p_string_width_from_layout(test_layout, _("File name:"));
+
+       if (p_fnwidth > pod->p_label_width)
+           pod->p_label_width = p_fnwidth;
+       g_string_append_printf(desc_buf, "\n%s\t%s", _("File name:"),
+                              body->filename);
     }
 
     /* add a small space between label and value */
@@ -184,23 +182,23 @@ balsa_print_object_default(GList               *list,
     /* configure the layout so we can calculate the text height */
     pango_layout_set_indent(test_layout, -pod->p_label_width);
     tabs =
-        pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
-                                           pod->p_label_width);
+       pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
+                                          pod->p_label_width);
     pango_layout_set_tabs(test_layout, tabs);
     pango_tab_array_free(tabs);
     pango_layout_set_width(test_layout,
-                           C_TO_P(po->c_width -
-                                  4 * C_LABEL_SEP - pod->c_image_width));
+                          C_TO_P(po->c_width -
+                                 4 * C_LABEL_SEP - pod->c_image_width));
     pango_layout_set_alignment(test_layout, PANGO_ALIGN_LEFT);
     pod->c_text_height =
-        P_TO_C(p_string_height_from_layout(test_layout, desc_buf->str));
+       P_TO_C(p_string_height_from_layout(test_layout, desc_buf->str));
     pod->description = g_string_free(desc_buf, FALSE);
 
     /* check if we should move to the next page */
     c_max_height = MAX(pod->c_text_height, pod->c_image_height);
     if (psetup->c_y_pos + c_max_height > psetup->c_height) {
-        psetup->c_y_pos = 0;
-        psetup->page_count++;
+       psetup->c_y_pos = 0;
+       psetup->page_count++;
     }
 
     /* remember the extent */
@@ -218,9 +216,9 @@ balsa_print_object_default(GList               *list,
 
 
 static void
-balsa_print_object_default_draw(BalsaPrintObject *self,
-                                GtkPrintContext  *context,
-                                cairo_t          *cairo_ctx)
+balsa_print_object_default_draw(BalsaPrintObject * self,
+                               GtkPrintContext * context,
+                               cairo_t * cairo_ctx)
 {
     BalsaPrintObjectDefault *pod;
     gdouble c_max_height;
@@ -236,10 +234,9 @@ balsa_print_object_default_draw(BalsaPrintObject *self,
     c_offset = pod->c_image_width + 4 * C_LABEL_SEP;
 
     /* print the icon */
-    if (pod->pixbuf) {
+    if (pod->pixbuf)
         cairo_print_pixbuf(cairo_ctx, pod->pixbuf, self->c_at_x,
                            self->c_at_y, 1.0);
-    }
 
     /* print the description */
     font = pango_font_description_from_string(balsa_app.print_header_font);
@@ -248,16 +245,16 @@ balsa_print_object_default_draw(BalsaPrintObject *self,
     pango_font_description_free(font);
     pango_layout_set_indent(layout, -pod->p_label_width);
     tabs =
-        pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
-                                           pod->p_label_width);
+       pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
+                                          pod->p_label_width);
     pango_layout_set_tabs(layout, tabs);
     pango_tab_array_free(tabs);
     pango_layout_set_width(layout, C_TO_P(self->c_width - c_offset));
     pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
     pango_layout_set_text(layout, pod->description, -1);
     cairo_move_to(cairo_ctx, self->c_at_x + c_offset,
-                  self->c_at_y + (c_max_height -
-                                  pod->c_text_height) * 0.5);
+                 self->c_at_y + (c_max_height -
+                                 pod->c_text_height) * 0.5);
     pango_cairo_show_layout(cairo_ctx, layout);
     g_object_unref(G_OBJECT(layout));
 }
diff --git a/src/balsa-print-object-default.h b/src/balsa-print-object-default.h
index 907a89e..7375612 100644
--- a/src/balsa-print-object-default.h
+++ b/src/balsa-print-object-default.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -24,14 +24,13 @@
 
 G_BEGIN_DECLS
 
-#define BALSA_TYPE_PRINT_OBJECT_DEFAULT \
+#define BALSA_TYPE_PRINT_OBJECT_DEFAULT        \
     (balsa_print_object_default_get_type())
-#define BALSA_PRINT_OBJECT_DEFAULT(obj)                         \
+#define BALSA_PRINT_OBJECT_DEFAULT(obj)                                \
     G_TYPE_CHECK_INSTANCE_CAST(obj, BALSA_TYPE_PRINT_OBJECT_DEFAULT, BalsaPrintObjectDefault)
-#define BALSA_PRINT_OBJECT_DEFAULT_CLASS(klass)                 \
-    G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_PRINT_OBJECT_DEFAULT, \
-                            BalsaPrintObjectDefaultClass)
-#define BALSA_IS_PRINT_OBJECT_DEFAULT(obj)                      \
+#define BALSA_PRINT_OBJECT_DEFAULT_CLASS(klass)                        \
+    G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_PRINT_OBJECT_DEFAULT, BalsaPrintObjectDefaultClass)
+#define BALSA_IS_PRINT_OBJECT_DEFAULT(obj)                     \
     G_TYPE_CHECK_INSTANCE_TYPE(obj, BALSA_TYPE_PRINT_OBJECT_DEFAULT)
 
 
@@ -57,12 +56,12 @@ struct _BalsaPrintObjectDefaultClass {
 
 
 GType balsa_print_object_default_get_type(void);
-GList *balsa_print_object_default(GList               *list,
-                                  GtkPrintContext     *context,
-                                  LibBalsaMessageBody *body,
-                                  BalsaPrintSetup     *psetup);
+GList *balsa_print_object_default(GList * list,
+                                 GtkPrintContext *context,
+                                 LibBalsaMessageBody *body,
+                                 BalsaPrintSetup *psetup);
 
 
 G_END_DECLS
 
-#endif                          /* __BALSA_PRINT_OBJECT_DEFAULT_H__ */
+#endif                         /* __BALSA_PRINT_OBJECT_DEFAULT_H__ */
diff --git a/src/balsa-print-object-header.c b/src/balsa-print-object-header.c
index d2619d9..86deb18 100644
--- a/src/balsa-print-object-header.c
+++ b/src/balsa-print-object-header.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-print-object-header.h"
 
@@ -30,29 +30,24 @@
 
 
 /* object related functions */
-static void balsa_print_object_header_class_init(BalsaPrintObjectHeaderClass *klass);
-static void balsa_print_object_header_init(GTypeInstance *instance,
-                                           gpointer       g_class);
-static void balsa_print_object_header_finalize(GObject *self);
-
-static void balsa_print_object_header_draw(BalsaPrintObject *self,
-                                           GtkPrintContext  *context,
-                                           cairo_t          *cairo_ctx);
-
-static void header_add_string(PangoLayout *layout,
-                              GString     *header_buf,
-                              const gchar *field_id,
-                              const gchar *label,
-                              const gchar *value,
-                              gint        *p_label_width,
-                              gboolean     print_all_headers);
-static void header_add_list(PangoLayout         *layout,
-                            GString             *header_buf,
-                            const gchar         *field_id,
-                            const gchar         *label,
-                            InternetAddressList *values,
-                            gint                *p_label_width,
-                            gboolean             print_all_headers);
+static void balsa_print_object_header_class_init(BalsaPrintObjectHeaderClass * klass);
+static void balsa_print_object_header_init(GTypeInstance * instance,
+                                           gpointer g_class);
+static void balsa_print_object_header_finalize(GObject * self);
+
+static void balsa_print_object_header_draw(BalsaPrintObject * self,
+                                           GtkPrintContext * context,
+                                           cairo_t * cairo_ctx);
+
+static void header_add_string(PangoLayout * layout, GString * header_buf,
+                             const gchar * field_id, const gchar * label,
+                             const gchar * value, gint * p_label_width,
+                             gboolean print_all_headers);
+static void header_add_list(PangoLayout * layout, GString * header_buf,
+                           const gchar * field_id, const gchar * label,
+                           InternetAddressList * values,
+                           gint * p_label_width,
+                           gboolean print_all_headers);
 
 
 static BalsaPrintObjectClass *parent_class = NULL;
@@ -64,22 +59,22 @@ balsa_print_object_header_get_type()
     static GType balsa_print_object_header_type = 0;
 
     if (!balsa_print_object_header_type) {
-        static const GTypeInfo balsa_print_object_header_info = {
-            sizeof(BalsaPrintObjectHeaderClass),
-            NULL,               /* base_init */
-            NULL,               /* base_finalize */
-            (GClassInitFunc) balsa_print_object_header_class_init,
-            NULL,               /* class_finalize */
-            NULL,               /* class_data */
-            sizeof(BalsaPrintObjectHeader),
-            0,                  /* n_preallocs */
-            (GInstanceInitFunc) balsa_print_object_header_init
-        };
-
-        balsa_print_object_header_type =
-            g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
-                                   "BalsaPrintObjectHeader",
-                                   &balsa_print_object_header_info, 0);
+       static const GTypeInfo balsa_print_object_header_info = {
+           sizeof(BalsaPrintObjectHeaderClass),
+           NULL,               /* base_init */
+           NULL,               /* base_finalize */
+           (GClassInitFunc) balsa_print_object_header_class_init,
+           NULL,               /* class_finalize */
+           NULL,               /* class_data */
+           sizeof(BalsaPrintObjectHeader),
+           0,                  /* n_preallocs */
+           (GInstanceInitFunc) balsa_print_object_header_init
+       };
+
+       balsa_print_object_header_type =
+           g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
+                                  "BalsaPrintObjectHeader",
+                                  &balsa_print_object_header_info, 0);
     }
 
     return balsa_print_object_header_type;
@@ -87,18 +82,17 @@ balsa_print_object_header_get_type()
 
 
 static void
-balsa_print_object_header_class_init(BalsaPrintObjectHeaderClass *klass)
+balsa_print_object_header_class_init(BalsaPrintObjectHeaderClass * klass)
 {
     parent_class = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
     BALSA_PRINT_OBJECT_CLASS(klass)->draw =
-        balsa_print_object_header_draw;
+       balsa_print_object_header_draw;
     G_OBJECT_CLASS(klass)->finalize = balsa_print_object_header_finalize;
 }
 
 
 static void
-balsa_print_object_header_init(GTypeInstance *instance,
-                               gpointer       g_class)
+balsa_print_object_header_init(GTypeInstance * instance, gpointer g_class)
 {
     BalsaPrintObjectHeader *po = BALSA_PRINT_OBJECT_HEADER(instance);
 
@@ -107,27 +101,26 @@ balsa_print_object_header_init(GTypeInstance *instance,
 
 
 static void
-balsa_print_object_header_finalize(GObject *self)
+balsa_print_object_header_finalize(GObject * self)
 {
     BalsaPrintObjectHeader *po = BALSA_PRINT_OBJECT_HEADER(self);
 
     g_free(po->headers);
     if (po->face) {
-        g_clear_pointer(&po->face, (GDestroyNotify) cairo_surface_destroy);
+       g_clear_pointer(&po->face, (GDestroyNotify) cairo_surface_destroy);
     }
 
     G_OBJECT_CLASS(parent_class)->finalize(self);
 }
 
-
 static GList *
-balsa_print_object_header_new_real(GList                  *list,
-                                   GtkPrintContext        *context,
-                                   LibBalsaMessageBody    *sig_body,
-                                   LibBalsaMessageHeaders *headers,
-                                   const gchar            *the_subject,
-                                   BalsaPrintSetup        *psetup,
-                                   gboolean                print_all_headers)
+balsa_print_object_header_new_real(GList * list,
+                                  GtkPrintContext * context,
+                                  LibBalsaMessageBody * sig_body,
+                                  LibBalsaMessageHeaders * headers,
+                                  const gchar * the_subject,
+                                  BalsaPrintSetup * psetup,
+                                  gboolean print_all_headers)
 {
     gchar *subject;
     gchar *date;
@@ -151,7 +144,7 @@ balsa_print_object_header_new_real(GList                  *list,
 
     /* create a layout for calculating the maximum label width */
     header_font =
-        pango_font_description_from_string(balsa_app.print_header_font);
+       pango_font_description_from_string(balsa_app.print_header_font);
     test_layout = gtk_print_context_create_pango_layout(context);
     pango_layout_set_font_description(test_layout, header_font);
     pango_font_description_free(header_font);
@@ -162,70 +155,67 @@ balsa_print_object_header_new_real(GList                  *list,
     subject = g_strdup(the_subject);
     libbalsa_utf8_sanitize(&subject, balsa_app.convert_unknown_8bit, NULL);
     header_add_string(test_layout, header_buf, "subject", _("Subject:"),
-                      subject, &p_label_width, print_all_headers);
+                     subject, &p_label_width, print_all_headers);
     g_free(subject);
 
     /* date */
     date =
-        libbalsa_message_headers_date_to_utf8(headers,
-                                              balsa_app.date_string);
+       libbalsa_message_headers_date_to_utf8(headers,
+                                             balsa_app.date_string);
     header_add_string(test_layout, header_buf, "date", _("Date:"), date,
-                      &p_label_width, print_all_headers);
+                     &p_label_width, print_all_headers);
     g_free(date);
 
     /* addresses */
     header_add_list(test_layout, header_buf, "from", _("From:"),
-                    headers->from, &p_label_width, print_all_headers);
+                   headers->from, &p_label_width, print_all_headers);
     header_add_list(test_layout, header_buf, "to", _("To:"),
-                    headers->to_list, &p_label_width, print_all_headers);
+                   headers->to_list, &p_label_width, print_all_headers);
     header_add_list(test_layout, header_buf, "cc", _("CC:"),
-                    headers->cc_list, &p_label_width, print_all_headers);
+                   headers->cc_list, &p_label_width, print_all_headers);
     header_add_list(test_layout, header_buf, "bcc", _("BCC:"),
-                    headers->bcc_list, &p_label_width, print_all_headers);
+                   headers->bcc_list, &p_label_width, print_all_headers);
     header_add_string(test_layout, header_buf, "fcc", _("FCC:"),
-                      headers->fcc_url, &p_label_width, print_all_headers);
+                     headers->fcc_url, &p_label_width, print_all_headers);
     header_add_list(test_layout, header_buf, "disposition-notification-to",
-                    _("Disposition-Notification-To:"),
-                    headers->dispnotify_to, &p_label_width, print_all_headers);
+                   _("Disposition-Notification-To:"),
+                   headers->dispnotify_to, &p_label_width, print_all_headers);
 
     /* user headers */
     p = headers->user_hdrs;
     face = NULL;
     while (p) {
-        gchar **pair, *curr_hdr;
-
-        pair = p->data;
-        curr_hdr = g_strconcat(pair[0], ":", NULL);
-        header_add_string(test_layout, header_buf, pair[0], curr_hdr,
-                          pair[1], &p_label_width, print_all_headers);
-        g_free(curr_hdr);
-
-        /* check for face and x-face */
-        if (!face) {
-            GError *err = NULL;
-            GtkWidget *f_widget = NULL;
-
-            if (!g_ascii_strcasecmp("Face", pair[0])) {
-                f_widget = libbalsa_get_image_from_face_header(pair[1], &err);
-            }
+       gchar **pair, *curr_hdr;
+
+       pair = p->data;
+       curr_hdr = g_strconcat(pair[0], ":", NULL);
+       header_add_string(test_layout, header_buf, pair[0], curr_hdr,
+                         pair[1], &p_label_width, print_all_headers);
+       g_free(curr_hdr);
+
+       /* check for face and x-face */
+       if (!face) {
+           GError *err = NULL;
+           GtkWidget * f_widget = NULL;
+
+           if (!g_ascii_strcasecmp("Face", pair[0]))
+               f_widget = libbalsa_get_image_from_face_header(pair[1], &err);
 #if HAVE_COMPFACE
-            else if (!g_ascii_strcasecmp("X-Face", pair[0])) {
-                f_widget = libbalsa_get_image_from_x_face_header(pair[1], &err);
-            }
+           else if (!g_ascii_strcasecmp("X-Face", pair[0]))
+               f_widget = libbalsa_get_image_from_x_face_header(pair[1], &err);
 #endif                          /* HAVE_COMPFACE */
-            if (err) {
-                g_error_free(err);
-            }
-
-            if (f_widget) {
-                face = gtk_image_get_surface(GTK_IMAGE(f_widget));
-                cairo_surface_reference(face);
-                gtk_widget_destroy(f_widget);
-            }
-        }
-
-        /* next */
-        p = p->next;
+           if (err)
+               g_error_free(err);
+
+           if (f_widget) {
+               face = gtk_image_get_surface(GTK_IMAGE(f_widget));
+               cairo_surface_reference(face);
+               gtk_widget_destroy(f_widget);
+           }
+       }
+
+       /* next */
+       p = p->next;
     }
 
     /* add a small space between label and value */
@@ -233,21 +223,21 @@ balsa_print_object_header_new_real(GList                  *list,
 
 #ifdef HAVE_GPGME
     /* add a signature status to the string */
-    if ((balsa_app.shown_headers != HEADERS_NONE) && sig_body &&
-        sig_body->parts && sig_body->parts->next &&
-        sig_body->parts->next->sig_info) {
-        gint prot = libbalsa_message_body_protection(sig_body);
+    if (balsa_app.shown_headers != HEADERS_NONE && sig_body &&
+       sig_body->parts && sig_body->parts->next &&
+       sig_body->parts->next->sig_info) {
+       gint prot = libbalsa_message_body_protection(sig_body);
 
-        if ((prot & LIBBALSA_PROTECT_SIGN) &&
-            (prot & (LIBBALSA_PROTECT_RFC3156 | LIBBALSA_PROTECT_SMIMEV3))) {
-            GMimeGpgmeSigstat *siginfo = sig_body->parts->next->sig_info;
+       if ((prot & LIBBALSA_PROTECT_SIGN) &&
+           (prot & (LIBBALSA_PROTECT_RFC3156 | LIBBALSA_PROTECT_SMIMEV3))) {
+           GMimeGpgmeSigstat *siginfo = sig_body->parts->next->sig_info;
 
-            g_string_append_printf(header_buf, "%s%s\n",
-                                   g_mime_gpgme_sigstat_protocol_name(siginfo),
+           g_string_append_printf(header_buf, "%s%s\n",
+               g_mime_gpgme_sigstat_protocol_name(siginfo),
                                    libbalsa_gpgme_sig_stat_to_gchar(siginfo->status));
-        }
+       }
     }
-#endif                          /* HAVE_GPGME */
+#endif                         /* HAVE_GPGME */
 
     /* strip the trailing '\n' */
     header_buf = g_string_truncate(header_buf, header_buf->len - 1);
@@ -255,20 +245,19 @@ balsa_print_object_header_new_real(GList                  *list,
     /* check if we have a face */
     c_use_width = psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
     if (face) {
-        p_layout_width =
-            C_TO_P(c_use_width - cairo_image_surface_get_width(face) - C_LABEL_SEP);
-        c_face_height = cairo_image_surface_get_height(face);
+       p_layout_width = C_TO_P(c_use_width - cairo_image_surface_get_width(face) - C_LABEL_SEP);
+       c_face_height = cairo_image_surface_get_height(face);
     } else {
-        p_layout_width = C_TO_P(c_use_width);
-        c_face_height = 0;
+       p_layout_width = C_TO_P(c_use_width);
+       c_face_height = 0;
     }
 
     /* start on new page if less than 2 header lines can be printed or if
      * the face doesn't fit */
-    if ((psetup->c_y_pos + 2 * P_TO_C(psetup->p_hdr_font_height) > psetup->c_height) ||
-        (psetup->c_y_pos + c_face_height > psetup->c_height)) {
-        psetup->c_y_pos = 0;
-        psetup->page_count++;
+    if (psetup->c_y_pos + 2 * P_TO_C(psetup->p_hdr_font_height) > psetup->c_height ||
+       psetup->c_y_pos + c_face_height > psetup->c_height) {
+       psetup->c_y_pos = 0;
+       psetup->page_count++;
     }
     first_page = psetup->page_count - 1;
     c_at_y = psetup->c_y_pos;
@@ -276,8 +265,8 @@ balsa_print_object_header_new_real(GList                  *list,
     /* configure the layout so we can use Pango to split the text into pages */
     pango_layout_set_indent(test_layout, -p_label_width);
     tabs =
-        pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
-                                           p_label_width);
+       pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
+                                          p_label_width);
     pango_layout_set_tabs(test_layout, tabs);
     pango_tab_array_free(tabs);
     pango_layout_set_width(test_layout, p_layout_width);
@@ -286,47 +275,46 @@ balsa_print_object_header_new_real(GList                  *list,
 
     /* split the headers into a list fitting on one or more pages */
     chunks =
-        split_for_layout(test_layout, header_buf->str, NULL, psetup, TRUE,
-                         NULL);
+       split_for_layout(test_layout, header_buf->str, NULL, psetup, TRUE,
+                        NULL);
     g_string_free(header_buf, TRUE);
 
     /* create a list of objects */
     this_chunk = chunks;
     c_at_x = psetup->c_x0 + psetup->curr_depth * C_LABEL_SEP;
     while (this_chunk) {
-        BalsaPrintObjectHeader *po;
-
-        po = g_object_new(BALSA_TYPE_PRINT_OBJECT_HEADER, NULL);
-        g_assert(po != NULL);
-        BALSA_PRINT_OBJECT(po)->on_page = first_page++;
-        BALSA_PRINT_OBJECT(po)->c_at_x = c_at_x;
-        BALSA_PRINT_OBJECT(po)->c_at_y = psetup->c_y0 + c_at_y;
-        BALSA_PRINT_OBJECT(po)->depth = psetup->curr_depth;
-        c_at_y = 0.0;
-        BALSA_PRINT_OBJECT(po)->c_width = c_use_width;
-        /* note: height is calculated when the object is drawn */
-        po->headers = (gchar *) this_chunk->data;
-        po->p_label_width = p_label_width;
-        po->p_layout_width = p_layout_width;
-        if (face) {
-            po->face = face;
-            if (!this_chunk->next) {
-                gint p_height;
-
-                /* verify that the image is not higher than the headers
-                 * if there is a next part, we checked before that the
-                 * image fits */
-                pango_layout_set_text(test_layout, po->headers, -1);
-                pango_layout_get_size(test_layout, NULL, &p_height);
-                if (c_face_height > P_TO_C(p_height)) {
-                    psetup->c_y_pos += c_face_height - P_TO_C(p_height);
-                }
-            }
-            face = NULL;
-        }
-        list = g_list_append(list, po);
-
-        this_chunk = this_chunk->next;
+       BalsaPrintObjectHeader *po;
+
+       po = g_object_new(BALSA_TYPE_PRINT_OBJECT_HEADER, NULL);
+       g_assert(po != NULL);
+       BALSA_PRINT_OBJECT(po)->on_page = first_page++;
+       BALSA_PRINT_OBJECT(po)->c_at_x = c_at_x;
+       BALSA_PRINT_OBJECT(po)->c_at_y = psetup->c_y0 + c_at_y;
+       BALSA_PRINT_OBJECT(po)->depth = psetup->curr_depth;
+       c_at_y = 0.0;
+       BALSA_PRINT_OBJECT(po)->c_width = c_use_width;
+       /* note: height is calculated when the object is drawn */
+       po->headers = (gchar *) this_chunk->data;
+       po->p_label_width = p_label_width;
+       po->p_layout_width = p_layout_width;
+       if (face) {
+           po->face = face;
+           if (!this_chunk->next) {
+               gint p_height;
+
+               /* verify that the image is not higher than the headers
+                * if there is a next part, we checked before that the
+                * image fits */
+               pango_layout_set_text(test_layout, po->headers, -1);
+               pango_layout_get_size(test_layout, NULL, &p_height);
+               if (c_face_height > P_TO_C(p_height))
+                   psetup->c_y_pos += c_face_height - P_TO_C(p_height);
+           }
+           face = NULL;
+       }
+       list = g_list_append(list, po);
+
+       this_chunk = this_chunk->next;
     }
     g_list_free(chunks);
     g_object_unref(G_OBJECT(test_layout));
@@ -336,41 +324,38 @@ balsa_print_object_header_new_real(GList                  *list,
 
 
 GList *
-balsa_print_object_header_from_message(GList           *list,
-                                       GtkPrintContext *context,
-                                       LibBalsaMessage *message,
-                                       const gchar     *subject,
-                                       BalsaPrintSetup *psetup)
+balsa_print_object_header_from_message(GList *list,
+                                      GtkPrintContext * context,
+                                      LibBalsaMessage * message,
+                                      const gchar * subject,
+                                      BalsaPrintSetup * psetup)
 {
     return balsa_print_object_header_new_real(list, context,
-                                              message->body_list,
-                                              message->headers, subject,
-                                              psetup, FALSE);
+                                             message->body_list,
+                                             message->headers, subject,
+                                             psetup, FALSE);
 }
 
 
 GList *
-balsa_print_object_header_from_body(GList               *list,
-                                    GtkPrintContext     *context,
-                                    LibBalsaMessageBody *body,
-                                    BalsaPrintSetup     *psetup)
+balsa_print_object_header_from_body(GList *list,
+                                   GtkPrintContext * context,
+                                   LibBalsaMessageBody * body,
+                                   BalsaPrintSetup * psetup)
 {
     return balsa_print_object_header_new_real(list, context, body->parts,
-                                              body->embhdrs,
-                                              body->embhdrs->subject,
-                                              psetup,
-                                              body->body_type ==
-                                              LIBBALSA_MESSAGE_BODY_TYPE_TEXT);
+                                             body->embhdrs,
+                                             body->embhdrs->subject,
+                                             psetup,
+                                             body->body_type == LIBBALSA_MESSAGE_BODY_TYPE_TEXT);
 }
 
 
 #ifdef HAVE_GPGME
 GList *
-balsa_print_object_header_crypto(GList               *list,
-                                 GtkPrintContext     *context,
-                                 LibBalsaMessageBody *body,
-                                 const gchar         *label,
-                                 BalsaPrintSetup     *psetup)
+balsa_print_object_header_crypto(GList *list, GtkPrintContext * context,
+                                LibBalsaMessageBody * body, const gchar * label,
+                                BalsaPrintSetup * psetup)
 {
     gint first_page;
     gdouble c_at_x;
@@ -383,15 +368,14 @@ balsa_print_object_header_crypto(GList               *list,
     GList *this_chunk;
 
     /* only if the body has an attached signature info */
-    if (!body->sig_info) {
-        return balsa_print_object_default(list, context, body, psetup);
-    }
-
+    if (!body->sig_info)
+       return balsa_print_object_default(list, context, body, psetup);
+    
     /* start on new page if less than 2 header lines can be printed */
     if (psetup->c_y_pos + 2 * P_TO_C(psetup->p_hdr_font_height) >
-        psetup->c_height) {
-        psetup->c_y_pos = 0;
-        psetup->page_count++;
+       psetup->c_height) {
+       psetup->c_y_pos = 0;
+       psetup->page_count++;
     }
     first_page = psetup->page_count - 1;
     c_at_y = psetup->c_y_pos;
@@ -399,24 +383,24 @@ balsa_print_object_header_crypto(GList               *list,
 
     /* create a layout for wrapping */
     header_font =
-        pango_font_description_from_string(balsa_app.print_header_font);
+       pango_font_description_from_string(balsa_app.print_header_font);
     test_layout = gtk_print_context_create_pango_layout(context);
     pango_layout_set_font_description(test_layout, header_font);
     pango_font_description_free(header_font);
 
     /* check if the key needs to be loaded */
     if (((body->sig_info->summary & GPGME_SIGSUM_KEY_MISSING) == 0) &&
-        (body->sig_info->key == NULL)) {
-        g_mime_gpgme_sigstat_load_key(body->sig_info);
+       (body->sig_info->key == NULL)) {
+       g_mime_gpgme_sigstat_load_key(body->sig_info);
     }
 
     /* create a buffer with the signature info */
     textbuf = g_mime_gpgme_sigstat_to_gchar(body->sig_info, TRUE, balsa_app.date_string);
     if (label) {
-        gchar *newbuf = g_strconcat(label, "\n", textbuf, NULL);
+       gchar *newbuf = g_strconcat(label, "\n", textbuf, NULL);
 
-        g_free(textbuf);
-        textbuf = newbuf;
+       g_free(textbuf);
+       textbuf = newbuf;
     }
 
     /* configure the layout so we can use Pango to split the text into pages */
@@ -433,37 +417,35 @@ balsa_print_object_header_crypto(GList               *list,
     this_chunk = chunks;
     c_at_x = psetup->c_x0 + psetup->curr_depth * C_LABEL_SEP;
     while (this_chunk) {
-        BalsaPrintObjectHeader *po;
-
-        po = g_object_new(BALSA_TYPE_PRINT_OBJECT_HEADER, NULL);
-        g_assert(po != NULL);
-        BALSA_PRINT_OBJECT(po)->on_page = first_page++;
-        BALSA_PRINT_OBJECT(po)->c_at_x = c_at_x;
-        BALSA_PRINT_OBJECT(po)->c_at_y = psetup->c_y0 + c_at_y;
-        BALSA_PRINT_OBJECT(po)->depth = psetup->curr_depth;
-        c_at_y = 0.0;
-        BALSA_PRINT_OBJECT(po)->c_width = c_use_width;
-        /* note: height is calculated when the object is drawn */
-        po->headers = (gchar *) this_chunk->data;
-        po->p_label_width = 0;
-        po->p_layout_width = C_TO_P(c_use_width);
-        list = g_list_append(list, po);
-
-        this_chunk = this_chunk->next;
+       BalsaPrintObjectHeader *po;
+
+       po = g_object_new(BALSA_TYPE_PRINT_OBJECT_HEADER, NULL);
+       g_assert(po != NULL);
+       BALSA_PRINT_OBJECT(po)->on_page = first_page++;
+       BALSA_PRINT_OBJECT(po)->c_at_x = c_at_x;
+       BALSA_PRINT_OBJECT(po)->c_at_y = psetup->c_y0 + c_at_y;
+       BALSA_PRINT_OBJECT(po)->depth = psetup->curr_depth;
+       c_at_y = 0.0;
+       BALSA_PRINT_OBJECT(po)->c_width = c_use_width;
+       /* note: height is calculated when the object is drawn */
+       po->headers = (gchar *) this_chunk->data;
+       po->p_label_width = 0;
+       po->p_layout_width = C_TO_P(c_use_width);
+       list = g_list_append(list, po);
+
+       this_chunk = this_chunk->next;
     }
     g_list_free(chunks);
 
     return list;
 }
-
-
 #endif
 
 
 static void
-balsa_print_object_header_draw(BalsaPrintObject *self,
-                               GtkPrintContext  *context,
-                               cairo_t          *cairo_ctx)
+balsa_print_object_header_draw(BalsaPrintObject * self,
+                               GtkPrintContext * context,
+                               cairo_t * cairo_ctx)
 {
     BalsaPrintObjectHeader *po;
     PangoLayout *layout;
@@ -478,66 +460,60 @@ balsa_print_object_header_draw(BalsaPrintObject *self,
     pango_layout_set_font_description(layout, font);
     pango_font_description_free(font);
     if (po->p_label_width) {
-        PangoTabArray *tabs;
-
-        pango_layout_set_indent(layout, -po->p_label_width);
-        tabs = pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
-                                                  po->p_label_width);
-        pango_layout_set_tabs(layout, tabs);
-        pango_tab_array_free(tabs);
+       PangoTabArray *tabs;
+       
+       pango_layout_set_indent(layout, -po->p_label_width);
+       tabs = pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
+                                                 po->p_label_width);
+       pango_layout_set_tabs(layout, tabs);
+       pango_tab_array_free(tabs);
     }
     pango_layout_set_width(layout, po->p_layout_width);
     pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
     pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
     pango_layout_set_text(layout, po->headers, -1);
     pango_layout_get_size(layout, NULL, &p_height);
-    self->c_height = P_TO_C(p_height);  /* needed to properly print borders */
+    self->c_height = P_TO_C(p_height); /* needed to properly print borders */
     cairo_move_to(cairo_ctx, self->c_at_x, self->c_at_y);
     pango_cairo_show_layout(cairo_ctx, layout);
     g_object_unref(G_OBJECT(layout));
 
     /* print a face image */
     if (po->face) {
-        gdouble c_face_h;
-        gdouble c_face_w;
-
-        c_face_h = cairo_image_surface_get_height(po->face);
-        c_face_w = cairo_image_surface_get_width(po->face);
-
-        cairo_print_surface(cairo_ctx, po->face,
-                            self->c_at_x + self->c_width - c_face_w,
-                            self->c_at_y, 1.0);
-        if (c_face_h > self->c_height) {
-            self->c_height = c_face_h;
-        }
+       gdouble c_face_h;
+       gdouble c_face_w;
+
+       c_face_h = cairo_image_surface_get_height(po->face);
+       c_face_w = cairo_image_surface_get_width(po->face);
+
+       cairo_print_surface(cairo_ctx, po->face,
+                           self->c_at_x + self->c_width - c_face_w,
+                           self->c_at_y, 1.0);
+       if (c_face_h > self->c_height)
+           self->c_height = c_face_h;
     }
 }
 
 
 static void
-header_add_string(PangoLayout *layout,
-                  GString     *header_buf,
-                  const gchar *field_id,
-                  const gchar *label,
-                  const gchar *value,
-                  gint        *p_label_width,
-                  gboolean     print_all_headers)
+header_add_string(PangoLayout * layout, GString * header_buf,
+                 const gchar * field_id, const gchar * label,
+                 const gchar * value, gint * p_label_width,
+                 gboolean print_all_headers)
 {
     gchar *_value;
     gint p_width;
 
-    if (!value || (balsa_app.shown_headers == HEADERS_NONE) ||
-        !(print_all_headers ||
-          balsa_app.show_all_headers ||
-          (balsa_app.shown_headers == HEADERS_ALL) ||
-          libbalsa_find_word(field_id, balsa_app.selected_headers))) {
-        return;
-    }
+    if (!value || balsa_app.shown_headers == HEADERS_NONE ||
+       !(print_all_headers ||
+         balsa_app.show_all_headers ||
+         balsa_app.shown_headers == HEADERS_ALL ||
+         libbalsa_find_word(field_id, balsa_app.selected_headers)))
+       return;
 
     p_width = p_string_width_from_layout(layout, label);
-    if (p_width > *p_label_width) {
-        *p_label_width = p_width;
-    }
+    if (p_width > *p_label_width)
+       *p_label_width = p_width;
     _value = g_strdup(value);
     libbalsa_utf8_sanitize(&_value, balsa_app.convert_unknown_8bit, NULL);
     g_string_append_printf(header_buf, "%s\t%s\n", label, _value);
@@ -546,31 +522,26 @@ header_add_string(PangoLayout *layout,
 
 
 static void
-header_add_list(PangoLayout         *layout,
-                GString             *header_buf,
-                const gchar         *field_id,
-                const gchar         *label,
-                InternetAddressList *values,
-                gint                *p_label_width,
-                gboolean             print_all_headers)
+header_add_list(PangoLayout * layout, GString * header_buf,
+               const gchar * field_id, const gchar * label,
+               InternetAddressList * values, gint * p_label_width,
+               gboolean print_all_headers)
 {
     gchar *_value;
     gint p_width;
 
-    if ((balsa_app.shown_headers == HEADERS_NONE) ||
-        !(print_all_headers ||
-          balsa_app.show_all_headers ||
-          (balsa_app.shown_headers == HEADERS_ALL) ||
-          libbalsa_find_word(field_id, balsa_app.selected_headers)) ||
+    if (balsa_app.shown_headers == HEADERS_NONE ||
+       !(print_all_headers ||
+         balsa_app.show_all_headers ||
+         balsa_app.shown_headers == HEADERS_ALL ||
+         libbalsa_find_word(field_id, balsa_app.selected_headers)) ||
         !values ||
-        !(_value = internet_address_list_to_string(values, FALSE))) {
-        return;
-    }
+        !(_value = internet_address_list_to_string(values, FALSE)))
+       return;
 
     p_width = p_string_width_from_layout(layout, label);
-    if (p_width > *p_label_width) {
-        *p_label_width = p_width;
-    }
+    if (p_width > *p_label_width)
+       *p_label_width = p_width;
     libbalsa_utf8_sanitize(&_value, balsa_app.convert_unknown_8bit, NULL);
     g_string_append_printf(header_buf, "%s\t%s\n", label, _value);
     g_free(_value);
diff --git a/src/balsa-print-object-header.h b/src/balsa-print-object-header.h
index 9ae946a..669fb3e 100644
--- a/src/balsa-print-object-header.h
+++ b/src/balsa-print-object-header.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -21,20 +21,20 @@
 #define __BALSA_PRINT_OBJECT_HEADER_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include "balsa-print-object.h"
 
 G_BEGIN_DECLS
 
-#define BALSA_TYPE_PRINT_OBJECT_HEADER  \
+#define BALSA_TYPE_PRINT_OBJECT_HEADER \
     (balsa_print_object_header_get_type())
-#define BALSA_PRINT_OBJECT_HEADER(obj)                          \
+#define BALSA_PRINT_OBJECT_HEADER(obj)                         \
     G_TYPE_CHECK_INSTANCE_CAST(obj, BALSA_TYPE_PRINT_OBJECT_HEADER, BalsaPrintObjectHeader)
-#define BALSA_PRINT_OBJECT_HEADER_CLASS(klass)                  \
+#define BALSA_PRINT_OBJECT_HEADER_CLASS(klass)                 \
     G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_PRINT_OBJECT_HEADER, BalsaPrintObjectHeaderClass)
-#define BALSA_IS_PRINT_OBJECT_HEADER(obj)                       \
+#define BALSA_IS_PRINT_OBJECT_HEADER(obj)                      \
     G_TYPE_CHECK_INSTANCE_TYPE(obj, BALSA_TYPE_PRINT_OBJECT_HEADER)
 
 
@@ -58,26 +58,24 @@ struct _BalsaPrintObjectHeaderClass {
 
 
 GType balsa_print_object_header_get_type(void);
-GList *balsa_print_object_header_from_message(GList           *list,
-                                              GtkPrintContext *context,
-                                              LibBalsaMessage *message,
-                                              const gchar     *subject,
-                                              BalsaPrintSetup *psetup);
-GList *balsa_print_object_header_from_body(GList               *list,
-                                           GtkPrintContext     *context,
-                                           LibBalsaMessageBody *body,
-                                           BalsaPrintSetup     *psetup);
-
+GList *balsa_print_object_header_from_message(GList *list,
+                                             GtkPrintContext * context,
+                                             LibBalsaMessage * message,
+                                             const gchar * subject,
+                                              BalsaPrintSetup * psetup);
+GList *balsa_print_object_header_from_body(GList *list,
+                                          GtkPrintContext * context,
+                                          LibBalsaMessageBody * body,
+                                          BalsaPrintSetup * psetup);
 #ifdef HAVE_GPGME
-GList *balsa_print_object_header_crypto(GList               *list,
-                                        GtkPrintContext     *context,
-                                        LibBalsaMessageBody *body,
-                                        const gchar         *label,
-                                        BalsaPrintSetup     *psetup);
-
+GList *balsa_print_object_header_crypto(GList *list,
+                                       GtkPrintContext * context,
+                                       LibBalsaMessageBody * body,
+                                       const gchar * label,
+                                       BalsaPrintSetup * psetup);
 #endif
 
 
 G_END_DECLS
 
-#endif                          /* __BALSA_PRINT_OBJECT_HEADER_H__ */
+#endif                         /* __BALSA_PRINT_OBJECT_HEADER_H__ */
diff --git a/src/balsa-print-object-image.c b/src/balsa-print-object-image.c
index d15c545..ad7ccfb 100644
--- a/src/balsa-print-object-image.c
+++ b/src/balsa-print-object-image.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-print-object-image.h"
 #include "balsa-print-object-default.h"
@@ -26,14 +26,15 @@
 #include <gtk/gtk.h>
 
 /* object related functions */
-static void balsa_print_object_image_class_init(BalsaPrintObjectImageClass *klass);
-static void balsa_print_object_image_init(GTypeInstance *instance,
-                                          gpointer       g_class);
-static void balsa_print_object_image_dispose(GObject *self);
+static void
+balsa_print_object_image_class_init(BalsaPrintObjectImageClass * klass);
+static void balsa_print_object_image_init (GTypeInstance *instance,
+                                          gpointer g_class);
+static void balsa_print_object_image_dispose(GObject * self);
 
-static void balsa_print_object_image_draw(BalsaPrintObject *self,
-                                          GtkPrintContext  *context,
-                                          cairo_t          *cairo_ctx);
+static void balsa_print_object_image_draw(BalsaPrintObject * self,
+                                         GtkPrintContext * context,
+                                         cairo_t * cairo_ctx);
 
 
 static BalsaPrintObjectClass *parent_class = NULL;
@@ -45,22 +46,22 @@ balsa_print_object_image_get_type()
     static GType balsa_print_object_image_type = 0;
 
     if (!balsa_print_object_image_type) {
-        static const GTypeInfo balsa_print_object_image_info = {
-            sizeof(BalsaPrintObjectImageClass),
-            NULL,               /* base_init */
-            NULL,               /* base_finalize */
-            (GClassInitFunc) balsa_print_object_image_class_init,
-            NULL,               /* class_finalize */
-            NULL,               /* class_data */
-            sizeof(BalsaPrintObjectImage),
-            0,                  /* n_preallocs */
-            (GInstanceInitFunc) balsa_print_object_image_init
-        };
-
-        balsa_print_object_image_type =
-            g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
-                                   "BalsaPrintObjectImage",
-                                   &balsa_print_object_image_info, 0);
+       static const GTypeInfo balsa_print_object_image_info = {
+           sizeof(BalsaPrintObjectImageClass),
+           NULL,               /* base_init */
+           NULL,               /* base_finalize */
+           (GClassInitFunc) balsa_print_object_image_class_init,
+           NULL,               /* class_finalize */
+           NULL,               /* class_data */
+           sizeof(BalsaPrintObjectImage),
+           0,                  /* n_preallocs */
+           (GInstanceInitFunc) balsa_print_object_image_init
+       };
+
+       balsa_print_object_image_type =
+           g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
+                                  "BalsaPrintObjectImage",
+                                  &balsa_print_object_image_info, 0);
     }
 
     return balsa_print_object_image_type;
@@ -68,18 +69,17 @@ balsa_print_object_image_get_type()
 
 
 static void
-balsa_print_object_image_class_init(BalsaPrintObjectImageClass *klass)
+balsa_print_object_image_class_init(BalsaPrintObjectImageClass * klass)
 {
     parent_class = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
     BALSA_PRINT_OBJECT_CLASS(klass)->draw =
-        balsa_print_object_image_draw;
+       balsa_print_object_image_draw;
     G_OBJECT_CLASS(klass)->dispose = balsa_print_object_image_dispose;
 }
 
 
 static void
-balsa_print_object_image_init(GTypeInstance *instance,
-                              gpointer       g_class)
+balsa_print_object_image_init(GTypeInstance * instance, gpointer g_class)
 {
     BalsaPrintObjectImage *po = BALSA_PRINT_OBJECT_IMAGE(instance);
 
@@ -89,7 +89,7 @@ balsa_print_object_image_init(GTypeInstance *instance,
 
 
 static void
-balsa_print_object_image_dispose(GObject *self)
+balsa_print_object_image_dispose(GObject * self)
 {
     BalsaPrintObjectImage *po = BALSA_PRINT_OBJECT_IMAGE(self);
 
@@ -100,10 +100,8 @@ balsa_print_object_image_dispose(GObject *self)
 
 
 GList *
-balsa_print_object_image(GList               *list,
-                         GtkPrintContext     *context,
-                         LibBalsaMessageBody *body,
-                         BalsaPrintSetup     *psetup)
+balsa_print_object_image(GList * list, GtkPrintContext *context,
+                        LibBalsaMessageBody *body, BalsaPrintSetup * psetup)
 {
     BalsaPrintObjectImage *poi;
     BalsaPrintObject *po;
@@ -116,14 +114,13 @@ balsa_print_object_image(GList               *list,
     /* check if we can handle the image */
     pixbuf = libbalsa_message_body_get_pixbuf(body, &err);
     if (err) {
-        g_message("Error loading image from file: %s", err->message);
-        g_error_free(err);
+       g_message("Error loading image from file: %s", err->message);
+       g_error_free(err);
     }
 
     /* fall back to default if the pixbuf could no be loaded */
-    if (!pixbuf) {
-        return balsa_print_object_default(list, context, body, psetup);
-    }
+    if (!pixbuf)
+      return balsa_print_object_default(list, context, body, psetup);
 
     /* create the part */
     poi = g_object_new(BALSA_TYPE_PRINT_OBJECT_IMAGE, NULL);
@@ -138,23 +135,23 @@ balsa_print_object_image(GList               *list,
 
     /* check if we should scale the width */
     if (c_img_width > c_use_width) {
-        poi->scale = c_use_width / c_img_width;
-        c_img_height *= poi->scale;
-        c_img_width = c_use_width;
+       poi->scale = c_use_width / c_img_width;
+       c_img_height *= poi->scale;
+       c_img_width = c_use_width;
     }
 
     /* check if the image is too high for one full page */
     if (c_img_height > psetup->c_height) {
-        gdouble hscale = psetup->c_height / c_img_height;
-        poi->scale *= hscale;
-        c_img_width *= hscale;
-        c_img_height = psetup->c_height;
+       gdouble hscale = psetup->c_height / c_img_height;
+       poi->scale *= hscale;
+       c_img_width *= hscale;
+       c_img_height = psetup->c_height;
     }
 
     /* check if we should move to the next page */
     if (psetup->c_y_pos + c_img_height > psetup->c_height) {
-        psetup->c_y_pos = 0;
-        psetup->page_count++;
+       psetup->c_y_pos = 0;
+       psetup->page_count++;
     }
 
     /* remember the extent */
@@ -173,9 +170,9 @@ balsa_print_object_image(GList               *list,
 
 
 static void
-balsa_print_object_image_draw(BalsaPrintObject *self,
-                              GtkPrintContext  *context,
-                              cairo_t          *cairo_ctx)
+balsa_print_object_image_draw(BalsaPrintObject * self,
+                             GtkPrintContext * context,
+                             cairo_t * cairo_ctx)
 {
     BalsaPrintObjectImage *poi;
 
@@ -185,5 +182,5 @@ balsa_print_object_image_draw(BalsaPrintObject *self,
 
     /* print the image */
     cairo_print_pixbuf(cairo_ctx, poi->pixbuf, self->c_at_x + poi->c_img_offs,
-                       self->c_at_y, poi->scale);
+                      self->c_at_y, poi->scale);
 }
diff --git a/src/balsa-print-object-image.h b/src/balsa-print-object-image.h
index 2374b87..e52fa77 100644
--- a/src/balsa-print-object-image.h
+++ b/src/balsa-print-object-image.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -24,13 +24,13 @@
 
 G_BEGIN_DECLS
 
-#define BALSA_TYPE_PRINT_OBJECT_IMAGE   \
+#define BALSA_TYPE_PRINT_OBJECT_IMAGE  \
     (balsa_print_object_image_get_type())
-#define BALSA_PRINT_OBJECT_IMAGE(obj)                           \
+#define BALSA_PRINT_OBJECT_IMAGE(obj)                          \
     G_TYPE_CHECK_INSTANCE_CAST(obj, BALSA_TYPE_PRINT_OBJECT_IMAGE, BalsaPrintObjectImage)
-#define BALSA_PRINT_OBJECT_IMAGE_CLASS(klass)                   \
+#define BALSA_PRINT_OBJECT_IMAGE_CLASS(klass)                  \
     G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_PRINT_OBJECT_IMAGE, BalsaPrintObjectImageClass)
-#define BALSA_IS_PRINT_OBJECT_IMAGE(obj)                        \
+#define BALSA_IS_PRINT_OBJECT_IMAGE(obj)                       \
     G_TYPE_CHECK_INSTANCE_TYPE(obj, BALSA_TYPE_PRINT_OBJECT_IMAGE)
 
 
@@ -53,12 +53,12 @@ struct _BalsaPrintObjectImageClass {
 
 
 GType balsa_print_object_image_get_type(void);
-GList *balsa_print_object_image(GList               *list,
-                                GtkPrintContext     *context,
-                                LibBalsaMessageBody *body,
-                                BalsaPrintSetup     *psetup);
+GList *balsa_print_object_image(GList *list,
+                               GtkPrintContext *context,
+                               LibBalsaMessageBody *body,
+                               BalsaPrintSetup *psetup);
 
 
 G_END_DECLS
 
-#endif                          /* __BALSA_PRINT_OBJECT_IMAGE_H__ */
+#endif                         /* __BALSA_PRINT_OBJECT_IMAGE_H__ */
diff --git a/src/balsa-print-object-text.c b/src/balsa-print-object-text.c
index 9079a6c..06b8f3e 100644
--- a/src/balsa-print-object-text.c
+++ b/src/balsa-print-object-text.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-print-object-text.h"
 
@@ -48,23 +48,19 @@ typedef struct {
 
 
 /* object related functions */
-static void balsa_print_object_text_class_init(BalsaPrintObjectTextClass *klass);
-static void balsa_print_object_text_init(GTypeInstance *instance,
-                                         gpointer       g_class);
-static void balsa_print_object_text_finalize(GObject *self);
+static void balsa_print_object_text_class_init(BalsaPrintObjectTextClass * klass);
+static void balsa_print_object_text_init(GTypeInstance * instance,
+                                        gpointer g_class);
+static void balsa_print_object_text_finalize(GObject * self);
 
-static void balsa_print_object_text_draw(BalsaPrintObject *self,
-                                         GtkPrintContext  *context,
-                                         cairo_t          *cairo_ctx);
+static void balsa_print_object_text_draw(BalsaPrintObject * self,
+                                        GtkPrintContext * context,
+                                        cairo_t * cairo_ctx);
 
-static GList *collect_attrs(GList *all_attr,
-                            guint  offset,
-                            guint  len);
-static PangoAttrList *phrase_list_to_pango(GList *phrase_list);
-static GList *phrase_highlight(const gchar *buffer,
-                               gunichar     tag_char,
-                               PhraseType   tag_type,
-                               GList       *phrase_list);
+static GList * collect_attrs(GList * all_attr, guint offset, guint len);
+static PangoAttrList * phrase_list_to_pango(GList * phrase_list);
+static GList * phrase_highlight(const gchar * buffer, gunichar tag_char,
+                               PhraseType tag_type, GList * phrase_list);
 
 
 static BalsaPrintObjectClass *parent_class = NULL;
@@ -76,22 +72,22 @@ balsa_print_object_text_get_type()
     static GType balsa_print_object_text_type = 0;
 
     if (!balsa_print_object_text_type) {
-        static const GTypeInfo balsa_print_object_text_info = {
-            sizeof(BalsaPrintObjectTextClass),
-            NULL,               /* base_init */
-            NULL,               /* base_finalize */
-            (GClassInitFunc) balsa_print_object_text_class_init,
-            NULL,               /* class_finalize */
-            NULL,               /* class_data */
-            sizeof(BalsaPrintObjectText),
-            0,                  /* n_preallocs */
-            (GInstanceInitFunc) balsa_print_object_text_init
-        };
-
-        balsa_print_object_text_type =
-            g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
-                                   "BalsaPrintObjectText",
-                                   &balsa_print_object_text_info, 0);
+       static const GTypeInfo balsa_print_object_text_info = {
+           sizeof(BalsaPrintObjectTextClass),
+           NULL,               /* base_init */
+           NULL,               /* base_finalize */
+           (GClassInitFunc) balsa_print_object_text_class_init,
+           NULL,               /* class_finalize */
+           NULL,               /* class_data */
+           sizeof(BalsaPrintObjectText),
+           0,                  /* n_preallocs */
+           (GInstanceInitFunc) balsa_print_object_text_init
+       };
+
+       balsa_print_object_text_type =
+           g_type_register_static(BALSA_TYPE_PRINT_OBJECT,
+                                  "BalsaPrintObjectText",
+                                  &balsa_print_object_text_info, 0);
     }
 
     return balsa_print_object_text_type;
@@ -99,18 +95,17 @@ balsa_print_object_text_get_type()
 
 
 static void
-balsa_print_object_text_class_init(BalsaPrintObjectTextClass *klass)
+balsa_print_object_text_class_init(BalsaPrintObjectTextClass * klass)
 {
     parent_class = g_type_class_ref(BALSA_TYPE_PRINT_OBJECT);
     BALSA_PRINT_OBJECT_CLASS(klass)->draw =
-        balsa_print_object_text_draw;
+       balsa_print_object_text_draw;
     G_OBJECT_CLASS(klass)->finalize = balsa_print_object_text_finalize;
 }
 
 
 static void
-balsa_print_object_text_init(GTypeInstance *instance,
-                             gpointer       g_class)
+balsa_print_object_text_init(GTypeInstance * instance, gpointer g_class)
 {
     BalsaPrintObjectText *po = BALSA_PRINT_OBJECT_TEXT(instance);
 
@@ -120,7 +115,7 @@ balsa_print_object_text_init(GTypeInstance *instance,
 
 
 static void
-balsa_print_object_text_finalize(GObject *self)
+balsa_print_object_text_finalize(GObject * self)
 {
     BalsaPrintObjectText *po = BALSA_PRINT_OBJECT_TEXT(self);
 
@@ -130,16 +125,14 @@ balsa_print_object_text_finalize(GObject *self)
     G_OBJECT_CLASS(parent_class)->finalize(self);
 }
 
-
 /* prepare a text/plain part, which gets
  * - citation bars and colourisation of cited text (prefs dependant)
  * - syntax highlighting (prefs dependant)
  * - RFC 3676 "flowed" processing */
 GList *
-balsa_print_object_text_plain(GList               *list,
-                              GtkPrintContext     *context,
-                              LibBalsaMessageBody *body,
-                              BalsaPrintSetup     *psetup)
+balsa_print_object_text_plain(GList *list, GtkPrintContext * context,
+                             LibBalsaMessageBody * body,
+                             BalsaPrintSetup * psetup)
 {
     GRegex *rex;
     gchar *textbuf;
@@ -147,51 +140,48 @@ balsa_print_object_text_plain(GList               *list,
     gdouble c_at_x;
     gdouble c_use_width;
     guint first_page;
-    gchar *par_start;
-    gchar *eol;
+    gchar * par_start;
+    gchar * eol;
     gint par_len;
 
     /* set up the regular expression for qouted text */
-    if (!(rex = balsa_quote_regex_new())) {
-        return balsa_print_object_default(list, context, body, psetup);
-    }
+    if (!(rex = balsa_quote_regex_new()))
+       return balsa_print_object_default(list, context, body, psetup);
 
     /* start on new page if less than 2 lines can be printed */
     if (psetup->c_y_pos + 2 * P_TO_C(psetup->p_body_font_height) >
-        psetup->c_height) {
-        psetup->c_y_pos = 0;
-        psetup->page_count++;
+       psetup->c_height) {
+       psetup->c_y_pos = 0;
+       psetup->page_count++;
     }
     c_at_x = psetup->c_x0 + psetup->curr_depth * C_LABEL_SEP;
     c_use_width = psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
 
     /* copy the text body to a buffer */
-    if (body->buffer) {
-        textbuf = g_strdup(body->buffer);
-    } else {
-        libbalsa_message_body_get_content(body, &textbuf, NULL);
-    }
+    if (body->buffer)
+       textbuf = g_strdup(body->buffer);
+    else
+       libbalsa_message_body_get_content(body, &textbuf, NULL);
 
     /* fake an empty buffer if textbuf is NULL */
-    if (!textbuf) {
-        textbuf = g_strdup("");
-    }
+    if (!textbuf)
+       textbuf = g_strdup("");
 
     /* be sure the we have correct utf-8 stuff here... */
     libbalsa_utf8_sanitize(&textbuf, balsa_app.convert_unknown_8bit, NULL);
 
     /* apply flowed if requested */
     if (libbalsa_message_body_is_flowed(body)) {
-        GString *flowed;
-
-        flowed =
-            libbalsa_process_text_rfc2646(textbuf, G_MAXINT, FALSE, FALSE,
-                                          FALSE,
-                                          libbalsa_message_body_is_delsp
-                                              (body));
-        g_free(textbuf);
-        textbuf = flowed->str;
-        g_string_free(flowed, FALSE);
+       GString *flowed;
+
+       flowed =
+           libbalsa_process_text_rfc2646(textbuf, G_MAXINT, FALSE, FALSE,
+                                         FALSE,
+                                         libbalsa_message_body_is_delsp
+                                         (body));
+       g_free(textbuf);
+       textbuf = flowed->str;
+       g_string_free(flowed, FALSE);
     }
 
     /* get the font */
@@ -202,126 +192,124 @@ balsa_print_object_text_plain(GList               *list,
     eol = strchr(par_start, '\n');
     par_len = eol ? eol - par_start : (gint) strlen(par_start);
     while (*par_start) {
-        GString *level_buf;
-        guint curr_level;
-        guint cite_level;
-        GList *par_parts;
-        GList *this_par_part;
-        GList *attr_list;
-        PangoLayout *layout;
-        PangoAttrList *pango_attr_list;
-        GArray *attr_offs;
-        gdouble c_at_y;
-
-        level_buf = NULL;
-        curr_level = 0;         /* just to make the compiler happy */
-        do {
-            gchar *thispar;
-            guint cite_idx;
-
-            thispar = g_strndup(par_start, par_len);
-
-            /* get the cite level and strip off the prefix */
-            if (libbalsa_match_regex(thispar, rex, &cite_level, &cite_idx)) {
-                gchar *new;
-
-                new = thispar + cite_idx;
-                if (g_unichar_isspace(g_utf8_get_char(new))) {
-                    new = g_utf8_next_char(new);
-                }
-                new = g_strdup(new);
-                g_free(thispar);
-                thispar = new;
-            }
-
-            /* glue paragraphs with the same cite level together */
-            if (!level_buf || (curr_level == cite_level)) {
-                if (!level_buf) {
-                    level_buf = g_string_new(thispar);
-                    curr_level = cite_level;
-                } else {
-                    level_buf = g_string_append_c(level_buf, '\n');
-                    level_buf = g_string_append(level_buf, thispar);
-                }
-
-                par_start = eol ? eol + 1 : par_start + par_len;
-                eol = strchr(par_start, '\n');
-                par_len = eol ? eol - par_start : (gint) strlen(par_start);
-            }
-
-            g_free(thispar);
-        } while (*par_start && (curr_level == cite_level));
-
-        /* configure the layout so we can use Pango to split the text into pages */
-        layout = gtk_print_context_create_pango_layout(context);
-        pango_layout_set_font_description(layout, font);
-        pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
-        pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
-
-        /* leave place for the citation bars */
-        pango_layout_set_width(layout,
-                               C_TO_P(c_use_width - curr_level * C_LABEL_SEP));
-
-        /* highlight structured phrases if requested */
-        if (balsa_app.print_highlight_phrases) {
-            attr_list =
-                phrase_highlight(level_buf->str, '*', PHRASE_BF, NULL);
-            attr_list =
-                phrase_highlight(level_buf->str, '/', PHRASE_EM, attr_list);
-            attr_list =
-                phrase_highlight(level_buf->str, '_', PHRASE_UL, attr_list);
-        } else {
-            attr_list = NULL;
-        }
-
-        /* start on new page if less than one line can be printed */
-        if (psetup->c_y_pos + P_TO_C(psetup->p_body_font_height) >
-            psetup->c_height) {
-            psetup->c_y_pos = 0;
-            psetup->page_count++;
-        }
-
-        /* split paragraph if necessary */
-        pango_attr_list = phrase_list_to_pango(attr_list);
-        first_page = psetup->page_count - 1;
-        c_at_y = psetup->c_y_pos;
-        par_parts =
-            split_for_layout(layout, level_buf->str, pango_attr_list,
-                             psetup, FALSE, &attr_offs);
-        if (pango_attr_list) {
-            pango_attr_list_unref(pango_attr_list);
-        }
-        g_object_unref(G_OBJECT(layout));
-        g_string_free(level_buf, TRUE);
-
-        /* each part is a new text object */
-        this_par_part = par_parts;
-        while (this_par_part) {
-            BalsaPrintObjectText *pot;
-
-            pot = g_object_new(BALSA_TYPE_PRINT_OBJECT_TEXT, NULL);
-            g_assert(pot != NULL);
-            BALSA_PRINT_OBJECT(pot)->on_page = first_page++;
-            BALSA_PRINT_OBJECT(pot)->c_at_x = c_at_x;
-            BALSA_PRINT_OBJECT(pot)->c_at_y = psetup->c_y0 + c_at_y;
-            BALSA_PRINT_OBJECT(pot)->depth = psetup->curr_depth;
-            c_at_y = 0.0;
-            BALSA_PRINT_OBJECT(pot)->c_width = c_use_width;
-            /* note: height is calculated when the object is drawn */
-            pot->text = (gchar *) this_par_part->data;
-            pot->cite_level = curr_level;
-            pot->attributes =
-                collect_attrs(attr_list,
-                              g_array_index(attr_offs, guint, 0),
-                              strlen(pot->text));
-
-            list = g_list_append(list, pot);
-            g_array_remove_index(attr_offs, 0);
-            this_par_part = this_par_part->next;
-        }
-        g_list_free_full(attr_list, g_free);
-        g_list_free(par_parts);
-        g_array_free(attr_offs, TRUE);
+       GString *level_buf;
+       guint curr_level;
+       guint cite_level;
+       GList *par_parts;
+       GList *this_par_part;
+       GList *attr_list;
+       PangoLayout *layout;
+       PangoAttrList *pango_attr_list;
+       GArray *attr_offs;
+       gdouble c_at_y;
+
+       level_buf = NULL;
+       curr_level = 0;         /* just to make the compiler happy */
+       do {
+           gchar *thispar;
+           guint cite_idx;
+
+           thispar = g_strndup(par_start, par_len);
+
+           /* get the cite level and strip off the prefix */
+           if (libbalsa_match_regex(thispar, rex, &cite_level, &cite_idx))
+            {
+               gchar *new;
+
+               new = thispar + cite_idx;
+               if (g_unichar_isspace(g_utf8_get_char(new)))
+                   new = g_utf8_next_char(new);
+               new = g_strdup(new);
+               g_free(thispar);
+               thispar = new;
+           }
+
+           /* glue paragraphs with the same cite level together */
+           if (!level_buf || (curr_level == cite_level)) {
+               if (!level_buf) {
+                   level_buf = g_string_new(thispar);
+                   curr_level = cite_level;
+               } else {
+                   level_buf = g_string_append_c(level_buf, '\n');
+                   level_buf = g_string_append(level_buf, thispar);
+               }
+
+               par_start = eol ? eol + 1 : par_start + par_len;
+               eol = strchr(par_start, '\n');
+               par_len = eol ? eol - par_start : (gint) strlen(par_start);
+           }
+
+           g_free(thispar);
+       } while (*par_start && (curr_level == cite_level));
+       
+       /* configure the layout so we can use Pango to split the text into pages */
+       layout = gtk_print_context_create_pango_layout(context);
+       pango_layout_set_font_description(layout, font);
+       pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
+       pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
+
+       /* leave place for the citation bars */
+       pango_layout_set_width(layout,
+                              C_TO_P(c_use_width - curr_level * C_LABEL_SEP));
+
+       /* highlight structured phrases if requested */
+       if (balsa_app.print_highlight_phrases) {
+           attr_list =
+               phrase_highlight(level_buf->str, '*', PHRASE_BF, NULL);
+           attr_list =
+               phrase_highlight(level_buf->str, '/', PHRASE_EM, attr_list);
+           attr_list =
+               phrase_highlight(level_buf->str, '_', PHRASE_UL, attr_list);
+       } else
+           attr_list = NULL;
+
+       /* start on new page if less than one line can be printed */
+       if (psetup->c_y_pos + P_TO_C(psetup->p_body_font_height) >
+           psetup->c_height) {
+           psetup->c_y_pos = 0;
+           psetup->page_count++;
+       }
+
+       /* split paragraph if necessary */
+       pango_attr_list = phrase_list_to_pango(attr_list);
+       first_page = psetup->page_count - 1;
+       c_at_y = psetup->c_y_pos;
+       par_parts =
+           split_for_layout(layout, level_buf->str, pango_attr_list,
+                            psetup, FALSE, &attr_offs);
+       if (pango_attr_list)
+           pango_attr_list_unref(pango_attr_list);
+       g_object_unref(G_OBJECT(layout));
+       g_string_free(level_buf, TRUE);
+
+       /* each part is a new text object */
+       this_par_part = par_parts;
+       while (this_par_part) {
+           BalsaPrintObjectText *pot;
+
+           pot = g_object_new(BALSA_TYPE_PRINT_OBJECT_TEXT, NULL);
+           g_assert(pot != NULL);
+           BALSA_PRINT_OBJECT(pot)->on_page = first_page++;
+           BALSA_PRINT_OBJECT(pot)->c_at_x = c_at_x;
+           BALSA_PRINT_OBJECT(pot)->c_at_y = psetup->c_y0 + c_at_y;
+           BALSA_PRINT_OBJECT(pot)->depth = psetup->curr_depth;
+           c_at_y = 0.0;
+           BALSA_PRINT_OBJECT(pot)->c_width = c_use_width;
+           /* note: height is calculated when the object is drawn */
+           pot->text = (gchar *) this_par_part->data;
+           pot->cite_level = curr_level;
+           pot->attributes =
+               collect_attrs(attr_list,
+                             g_array_index(attr_offs, guint, 0),
+                             strlen(pot->text));
+
+           list = g_list_append(list, pot);
+           g_array_remove_index(attr_offs, 0);
+           this_par_part = this_par_part->next;
+       }
+       g_list_free_full(attr_list, g_free);
+       g_list_free(par_parts);
+       g_array_free(attr_offs, TRUE);
     }
 
     /* clean up */
@@ -335,10 +323,9 @@ balsa_print_object_text_plain(GList               *list,
 /* prepare a text part which is simply printed "as is" without all the bells
  * and whistles of text/plain (see above) */
 GList *
-balsa_print_object_text(GList               *list,
-                        GtkPrintContext     *context,
-                        LibBalsaMessageBody *body,
-                        BalsaPrintSetup     *psetup)
+balsa_print_object_text(GList *list, GtkPrintContext * context,
+                       LibBalsaMessageBody * body,
+                       BalsaPrintSetup * psetup)
 {
     gchar *textbuf;
     PangoFontDescription *font;
@@ -352,24 +339,22 @@ balsa_print_object_text(GList               *list,
 
     /* start on new page if less than 2 lines can be printed */
     if (psetup->c_y_pos + 2 * P_TO_C(psetup->p_body_font_height) >
-        psetup->c_height) {
-        psetup->c_y_pos = 0;
-        psetup->page_count++;
+       psetup->c_height) {
+       psetup->c_y_pos = 0;
+       psetup->page_count++;
     }
     c_at_x = psetup->c_x0 + psetup->curr_depth * C_LABEL_SEP;
     c_use_width = psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
 
     /* copy the text body to a buffer */
-    if (body->buffer) {
-        textbuf = g_strdup(body->buffer);
-    } else {
-        libbalsa_message_body_get_content(body, &textbuf, NULL);
-    }
+    if (body->buffer)
+       textbuf = g_strdup(body->buffer);
+    else
+       libbalsa_message_body_get_content(body, &textbuf, NULL);
 
     /* fake an empty buffer if textbuf is NULL */
-    if (!textbuf) {
-        textbuf = g_strdup("");
-    }
+    if (!textbuf)
+       textbuf = g_strdup("");
 
     /* be sure the we have correct utf-8 stuff here... */
     libbalsa_utf8_sanitize(&textbuf, balsa_app.convert_unknown_8bit, NULL);
@@ -395,23 +380,23 @@ balsa_print_object_text(GList               *list,
     /* each part is a new text object */
     this_par_part = par_parts;
     while (this_par_part) {
-        BalsaPrintObjectText *pot;
-
-        pot = g_object_new(BALSA_TYPE_PRINT_OBJECT_TEXT, NULL);
-        g_assert(pot != NULL);
-        BALSA_PRINT_OBJECT(pot)->on_page = first_page++;
-        BALSA_PRINT_OBJECT(pot)->c_at_x = c_at_x;
-        BALSA_PRINT_OBJECT(pot)->c_at_y = psetup->c_y0 + c_at_y;
-        BALSA_PRINT_OBJECT(pot)->depth = psetup->curr_depth;
-        c_at_y = 0.0;
-        BALSA_PRINT_OBJECT(pot)->c_width = c_use_width;
-        /* note: height is calculated when the object is drawn */
-        pot->text = (gchar *) this_par_part->data;
-        pot->cite_level = 0;
-        pot->attributes = NULL;
-
-        list = g_list_append(list, pot);
-        this_par_part = this_par_part->next;
+       BalsaPrintObjectText *pot;
+
+       pot = g_object_new(BALSA_TYPE_PRINT_OBJECT_TEXT, NULL);
+       g_assert(pot != NULL);
+       BALSA_PRINT_OBJECT(pot)->on_page = first_page++;
+       BALSA_PRINT_OBJECT(pot)->c_at_x = c_at_x;
+       BALSA_PRINT_OBJECT(pot)->c_at_y = psetup->c_y0 + c_at_y;
+       BALSA_PRINT_OBJECT(pot)->depth = psetup->curr_depth;
+       c_at_y = 0.0;
+       BALSA_PRINT_OBJECT(pot)->c_width = c_use_width;
+       /* note: height is calculated when the object is drawn */
+       pot->text = (gchar *) this_par_part->data;
+       pot->cite_level = 0;
+       pot->attributes = NULL;
+
+       list = g_list_append(list, pot);
+       this_par_part = this_par_part->next;
     }
     g_list_free(par_parts);
 
@@ -422,23 +407,23 @@ balsa_print_object_text(GList               *list,
 /* note: a vcard is an icon plus a series of labels/text, so this function actually
  * returns a BalsaPrintObjectDefault... */
 
-#define ADD_VCARD_FIELD(buf, labwidth, layout, field, descr)            \
-    do {                                                                \
-        if (field) {                                                    \
-            gint label_width = p_string_width_from_layout(layout, descr); \
-            if (label_width > labwidth) {                                 \
-                labwidth = label_width;}                                 \
-            if ((buf)->len > 0) {                                         \
-                g_string_append_c(buf, '\n');}                           \
-            g_string_append_printf(buf, "%s\t%s", descr, field);        \
-        }                                                               \
-    } while (0)
+#define ADD_VCARD_FIELD(buf, labwidth, layout, field, descr)           \
+    do {                                                               \
+       if (field) {                                                    \
+           gint label_width = p_string_width_from_layout(layout, descr); \
+           if (label_width > labwidth)                                 \
+               labwidth = label_width;                                 \
+           if ((buf)->len > 0)                                         \
+               g_string_append_c(buf, '\n');                           \
+           g_string_append_printf(buf, "%s\t%s", descr, field);        \
+       }                                                               \
+    } while(0)
 
 GList *
-balsa_print_object_text_vcard(GList               *list,
-                              GtkPrintContext     *context,
-                              LibBalsaMessageBody *body,
-                              BalsaPrintSetup     *psetup)
+balsa_print_object_text_vcard(GList * list,
+                             GtkPrintContext * context,
+                             LibBalsaMessageBody * body,
+                             BalsaPrintSetup * psetup)
 {
     BalsaPrintObjectDefault *pod;
     BalsaPrintObject *po;
@@ -450,19 +435,17 @@ balsa_print_object_text_vcard(GList               *list,
     LibBalsaAddress *address = NULL;
     gchar *textbuf;
 
-    /* check if we can create an address from the body and fall back to default if
-     * this fails */
-    if (body->buffer) {
-        textbuf = g_strdup(body->buffer);
-    } else {
-        libbalsa_message_body_get_content(body, &textbuf, NULL);
-    }
-    if (textbuf) {
+    /* check if we can create an address from the body and fall back to default if 
+    * this fails */
+    if (body->buffer)
+       textbuf = g_strdup(body->buffer);
+    else
+       libbalsa_message_body_get_content(body, &textbuf, NULL);
+    if (textbuf)
         address = libbalsa_address_new_from_vcard(textbuf, body->charset);
-    }
     if (address == NULL) {
-        g_free(textbuf);
-        return balsa_print_object_text(list, context, body, psetup);
+       g_free(textbuf);
+       return balsa_print_object_text(list, context, body, psetup);
     }
 
     /* proceed with the address information */
@@ -473,17 +456,17 @@ balsa_print_object_text_vcard(GList               *list,
     /* create the part */
     po->depth = psetup->curr_depth;
     po->c_width =
-        psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
+       psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
 
     /* get the stock contacts icon or the mime type icon on fail */
     pod->pixbuf =
-        gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
-                                 BALSA_PIXMAP_IDENTITY, 48,
-                                 GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+       gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
+                                BALSA_PIXMAP_IDENTITY, 48,
+                                GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
     if (!pod->pixbuf) {
-        gchar *conttype = libbalsa_message_body_get_mime_type(body);
+       gchar *conttype = libbalsa_message_body_get_mime_type(body);
 
-        pod->pixbuf = libbalsa_icon_finder(NULL, conttype, NULL, NULL, 48);
+       pod->pixbuf = libbalsa_icon_finder(NULL, conttype, NULL, NULL, 48);
     }
     pod->c_image_width = gdk_pixbuf_get_width(pod->pixbuf);
     pod->c_image_height = gdk_pixbuf_get_height(pod->pixbuf);
@@ -491,7 +474,7 @@ balsa_print_object_text_vcard(GList               *list,
 
     /* create a layout for calculating the maximum label width */
     header_font =
-        pango_font_description_from_string(balsa_app.print_header_font);
+       pango_font_description_from_string(balsa_app.print_header_font);
     test_layout = gtk_print_context_create_pango_layout(context);
     pango_layout_set_font_description(test_layout, header_font);
     pango_font_description_free(header_font);
@@ -500,17 +483,17 @@ balsa_print_object_text_vcard(GList               *list,
     desc_buf = g_string_new("");
     pod->p_label_width = 0;
     ADD_VCARD_FIELD(desc_buf, pod->p_label_width, test_layout,
-                    libbalsa_address_get_full_name(address), _("Full Name"));
+                   libbalsa_address_get_full_name(address),    _("Full Name"));
     ADD_VCARD_FIELD(desc_buf, pod->p_label_width, test_layout,
-                    libbalsa_address_get_nick_name(address), _("Nick Name"));
+                   libbalsa_address_get_nick_name(address),    _("Nick Name"));
     ADD_VCARD_FIELD(desc_buf, pod->p_label_width, test_layout,
-                    libbalsa_address_get_first_name(address), _("First Name"));
+                   libbalsa_address_get_first_name(address),   _("First Name"));
     ADD_VCARD_FIELD(desc_buf, pod->p_label_width, test_layout,
-                    libbalsa_address_get_last_name(address), _("Last Name"));
+                   libbalsa_address_get_last_name(address),    _("Last Name"));
     ADD_VCARD_FIELD(desc_buf, pod->p_label_width, test_layout,
-                    libbalsa_address_get_organization(address), _("Organization"));
+                   libbalsa_address_get_organization(address), _("Organization"));
     ADD_VCARD_FIELD(desc_buf, pod->p_label_width, test_layout,
-                    libbalsa_address_get_addr(address), _("Email Address"));
+                    libbalsa_address_get_addr(address),         _("Email Address"));
 
     g_object_unref(address);
 
@@ -520,23 +503,23 @@ balsa_print_object_text_vcard(GList               *list,
     /* configure the layout so we can calculate the text height */
     pango_layout_set_indent(test_layout, -pod->p_label_width);
     tabs =
-        pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
-                                           pod->p_label_width);
+       pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
+                                          pod->p_label_width);
     pango_layout_set_tabs(test_layout, tabs);
     pango_tab_array_free(tabs);
     pango_layout_set_width(test_layout,
-                           C_TO_P(po->c_width -
-                                  4 * C_LABEL_SEP - pod->c_image_width));
+                          C_TO_P(po->c_width -
+                                 4 * C_LABEL_SEP - pod->c_image_width));
     pango_layout_set_alignment(test_layout, PANGO_ALIGN_LEFT);
     pod->c_text_height =
-        P_TO_C(p_string_height_from_layout(test_layout, desc_buf->str));
+       P_TO_C(p_string_height_from_layout(test_layout, desc_buf->str));
     pod->description = g_string_free(desc_buf, FALSE);
 
     /* check if we should move to the next page */
     c_max_height = MAX(pod->c_text_height, pod->c_image_height);
     if (psetup->c_y_pos + c_max_height > psetup->c_height) {
-        psetup->c_y_pos = 0;
-        psetup->page_count++;
+       psetup->c_y_pos = 0;
+       psetup->page_count++;
     }
 
     /* remember the extent */
@@ -555,22 +538,22 @@ balsa_print_object_text_vcard(GList               *list,
 
 /* add a text/calendar object */
 
-#define ADD_VCAL_FIELD(buf, labwidth, layout, field, descr)             \
-    do {                                                                \
-        if (field) {                                                    \
-            gint label_width = p_string_width_from_layout(layout, descr); \
-            if (label_width > labwidth) {                                 \
-                labwidth = label_width;}                                 \
-            if ((buf)->len > 0) {                                         \
-                g_string_append_c(buf, '\n');}                           \
-            g_string_append_printf(buf, "%s\t%s", descr, field);        \
-        }                                                               \
-    } while (0)
+#define ADD_VCAL_FIELD(buf, labwidth, layout, field, descr)            \
+    do {                                                               \
+       if (field) {                                                    \
+           gint label_width = p_string_width_from_layout(layout, descr); \
+           if (label_width > labwidth)                                 \
+               labwidth = label_width;                                 \
+           if ((buf)->len > 0)                                         \
+               g_string_append_c(buf, '\n');                           \
+           g_string_append_printf(buf, "%s\t%s", descr, field);        \
+       }                                                               \
+    } while(0)
 
 #define ADD_VCAL_DATE(buf, labwidth, layout, date, descr)               \
     do {                                                                \
         if (date != (time_t) -1) {                                      \
-            gchar *_dstr =                                             \
+            gchar * _dstr =                                             \
                 libbalsa_date_to_utf8(date, balsa_app.date_string);     \
             ADD_VCAL_FIELD(buf, labwidth, layout, _dstr, descr);        \
             g_free(_dstr);                                              \
@@ -580,7 +563,7 @@ balsa_print_object_text_vcard(GList               *list,
 #define ADD_VCAL_ADDRESS(buf, labwidth, layout, addr, descr)            \
     do {                                                                \
         if (addr) {                                                     \
-            gchar *_astr = libbalsa_vcal_attendee_to_str(addr);        \
+            gchar * _astr = libbalsa_vcal_attendee_to_str(addr);        \
             ADD_VCAL_FIELD(buf, labwidth, layout, _astr, descr);        \
             g_free(_astr);                                              \
         }                                                               \
@@ -588,10 +571,10 @@ balsa_print_object_text_vcard(GList               *list,
 
 
 GList *
-balsa_print_object_text_calendar(GList               *list,
-                                 GtkPrintContext     *context,
-                                 LibBalsaMessageBody *body,
-                                 BalsaPrintSetup     *psetup)
+balsa_print_object_text_calendar(GList * list,
+                                 GtkPrintContext * context,
+                                 LibBalsaMessageBody * body,
+                                 BalsaPrintSetup * psetup)
 {
     BalsaPrintObjectDefault *pod;
     BalsaPrintObject *po;
@@ -599,8 +582,8 @@ balsa_print_object_text_calendar(GList               *list,
     PangoLayout *test_layout;
     PangoTabArray *tabs;
     GString *desc_buf;
-    LibBalsaVCal *vcal_obj;
-    GList *this_ev;
+    LibBalsaVCal * vcal_obj;
+    GList * this_ev;
     guint first_page;
     GList *par_parts;
     GList *this_par_part;
@@ -608,9 +591,8 @@ balsa_print_object_text_calendar(GList               *list,
 
     /* check if we can evaluate the body as calendar object and fall back
      * to text if not */
-    if (!(vcal_obj = libbalsa_vcal_new_from_body(body))) {
-        return balsa_print_object_text(list, context, body, psetup);
-    }
+    if (!(vcal_obj = libbalsa_vcal_new_from_body(body)))
+       return balsa_print_object_text(list, context, body, psetup);
 
     /* proceed with the address information */
     pod = g_object_new(BALSA_TYPE_PRINT_OBJECT_DEFAULT, NULL);
@@ -620,31 +602,31 @@ balsa_print_object_text_calendar(GList               *list,
     /* create the part */
     po->depth = psetup->curr_depth;
     po->c_width =
-        psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
+       psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
 
     /* get the stock calendar icon or the mime type icon on fail */
     pod->pixbuf =
-        gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
-                                 "x-office-calendar", 48,
-                                 GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+       gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
+                                "x-office-calendar", 48,
+                                GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
     if (!pod->pixbuf) {
-        gchar *conttype = libbalsa_message_body_get_mime_type(body);
+       gchar *conttype = libbalsa_message_body_get_mime_type(body);
 
-        pod->pixbuf = libbalsa_icon_finder(NULL, conttype, NULL, NULL, 48);
+       pod->pixbuf = libbalsa_icon_finder(NULL, conttype, NULL, NULL, 48);
     }
     pod->c_image_width = gdk_pixbuf_get_width(pod->pixbuf);
     pod->c_image_height = gdk_pixbuf_get_height(pod->pixbuf);
 
     /* move to the next page if the icon doesn't fit */
     if (psetup->c_y_pos + pod->c_image_height > psetup->c_height) {
-        psetup->c_y_pos = 0;
-        psetup->page_count++;
+       psetup->c_y_pos = 0;
+       psetup->page_count++;
     }
 
     /* create a layout for calculating the maximum label width and for splitting
      * the body (if necessary) */
     header_font =
-        pango_font_description_from_string(balsa_app.print_header_font);
+       pango_font_description_from_string(balsa_app.print_header_font);
     test_layout = gtk_print_context_create_pango_layout(context);
     pango_layout_set_font_description(test_layout, header_font);
     pango_font_description_free(header_font);
@@ -653,11 +635,10 @@ balsa_print_object_text_calendar(GList               *list,
     desc_buf = g_string_new("");
     pod->p_label_width = 0;
     for (this_ev = vcal_obj->vevent; this_ev != NULL; this_ev = this_ev->next) {
-        LibBalsaVEvent *event = (LibBalsaVEvent *) this_ev->data;
+        LibBalsaVEvent * event = (LibBalsaVEvent *) this_ev->data;
 
-        if (desc_buf->len > 0) {
+        if (desc_buf->len > 0)
             g_string_append_c(desc_buf, '\n');
-        }
         ADD_VCAL_FIELD(desc_buf, pod->p_label_width, test_layout,
                        event->summary, _("Summary"));
         ADD_VCAL_ADDRESS(desc_buf, pod->p_label_width, test_layout,
@@ -669,8 +650,8 @@ balsa_print_object_text_calendar(GList               *list,
         ADD_VCAL_FIELD(desc_buf, pod->p_label_width, test_layout,
                        event->location, _("Location"));
         if (event->attendee) {
-            GList *att = event->attendee;
-            gchar *this_att;
+            GList * att = event->attendee;
+            gchar * this_att;
 
             this_att =
                 libbalsa_vcal_attendee_to_str(LIBBALSA_ADDRESS(att->data));
@@ -686,14 +667,13 @@ balsa_print_object_text_calendar(GList               *list,
             }
         }
         if (event->description) {
-            gchar **desc_lines = g_strsplit(event->description, "\n", -1);
+            gchar ** desc_lines = g_strsplit(event->description, "\n", -1);
             gint i;
 
             ADD_VCAL_FIELD(desc_buf, pod->p_label_width, test_layout,
                            desc_lines[0], _("Description"));
-            for (i = 1; desc_lines[i]; i++) {
+            for (i = 1; desc_lines[i]; i++)
                 g_string_append_printf(desc_buf, "\n\t%s", desc_lines[i]);
-            }
             g_strfreev(desc_lines);
         }
     }
@@ -705,13 +685,13 @@ balsa_print_object_text_calendar(GList               *list,
     /* configure the layout so we can split the text */
     pango_layout_set_indent(test_layout, -pod->p_label_width);
     tabs =
-        pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
-                                           pod->p_label_width);
+       pango_tab_array_new_with_positions(1, FALSE, PANGO_TAB_LEFT,
+                                          pod->p_label_width);
     pango_layout_set_tabs(test_layout, tabs);
     pango_tab_array_free(tabs);
     pango_layout_set_width(test_layout,
-                           C_TO_P(po->c_width -
-                                  4 * C_LABEL_SEP - pod->c_image_width));
+                          C_TO_P(po->c_width -
+                                 4 * C_LABEL_SEP - pod->c_image_width));
     pango_layout_set_alignment(test_layout, PANGO_ALIGN_LEFT);
 
     /* split paragraph if necessary */
@@ -724,7 +704,7 @@ balsa_print_object_text_calendar(GList               *list,
     /* set the parameters of the first part */
     pod->description = (gchar *) par_parts->data;
     pod->c_text_height =
-        P_TO_C(p_string_height_from_layout(test_layout, pod->description));
+       P_TO_C(p_string_height_from_layout(test_layout, pod->description));
     po->on_page = first_page++;
     po->c_at_x = psetup->c_x0 + po->depth * C_LABEL_SEP;
     po->c_at_y = psetup->c_y0 + c_at_y;
@@ -734,9 +714,9 @@ balsa_print_object_text_calendar(GList               *list,
     /* add more parts */
     for (this_par_part = par_parts->next; this_par_part != NULL;
          this_par_part = this_par_part->next) {
-        BalsaPrintObjectDefault *new_pod;
+        BalsaPrintObjectDefault * new_pod;
         BalsaPrintObject *new_po;
-
+        
         /* create a new object */
         new_pod = g_object_new(BALSA_TYPE_PRINT_OBJECT_DEFAULT, NULL);
         g_assert(new_pod != NULL);
@@ -755,7 +735,7 @@ balsa_print_object_text_calendar(GList               *list,
         new_po->depth = psetup->curr_depth;
         new_po->c_width =
             psetup->c_width - 2 * psetup->curr_depth * C_LABEL_SEP;
-
+        
         /* append */
         list = g_list_append(list, new_pod);
     }
@@ -767,9 +747,9 @@ balsa_print_object_text_calendar(GList               *list,
 
 
 static void
-balsa_print_object_text_draw(BalsaPrintObject *self,
-                             GtkPrintContext  *context,
-                             cairo_t          *cairo_ctx)
+balsa_print_object_text_draw(BalsaPrintObject * self,
+                            GtkPrintContext * context,
+                            cairo_t * cairo_ctx)
 {
     BalsaPrintObjectText *po;
     PangoFontDescription *font;
@@ -786,56 +766,54 @@ balsa_print_object_text_draw(BalsaPrintObject *self,
     pango_layout_set_font_description(layout, font);
     pango_font_description_free(font);
     pango_layout_set_width(layout,
-                           C_TO_P(self->c_width - po->cite_level * C_LABEL_SEP));
+                          C_TO_P(self->c_width - po->cite_level * C_LABEL_SEP));
     pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
     pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
     pango_layout_set_text(layout, po->text, -1);
     if ((attr_list = phrase_list_to_pango(po->attributes))) {
-        pango_layout_set_attributes(layout, attr_list);
-        pango_attr_list_unref(attr_list);
+       pango_layout_set_attributes(layout, attr_list);
+       pango_attr_list_unref(attr_list);
     }
     pango_layout_get_size(layout, NULL, &p_height);
     if (po->cite_level > 0) {
-        cairo_save(cairo_ctx);
-        if (balsa_app.print_highlight_cited) {
-            gint k = (po->cite_level - 1) % MAX_QUOTED_COLOR;
-
-            cairo_set_source_rgb(cairo_ctx,
-                                 balsa_app.quoted_color[k].red,
-                                 balsa_app.quoted_color[k].green,
-                                 balsa_app.quoted_color[k].blue);
-        }
+       cairo_save(cairo_ctx);
+       if (balsa_app.print_highlight_cited) {
+           gint k = (po->cite_level - 1) % MAX_QUOTED_COLOR;
+
+           cairo_set_source_rgb(cairo_ctx,
+                                balsa_app.quoted_color[k].red,
+                                balsa_app.quoted_color[k].green,
+                                balsa_app.quoted_color[k].blue);
+       }
     }
     cairo_move_to(cairo_ctx, self->c_at_x + po->cite_level * C_LABEL_SEP,
-                  self->c_at_y);
+                 self->c_at_y);
     pango_cairo_show_layout(cairo_ctx, layout);
     g_object_unref(G_OBJECT(layout));
     if (po->cite_level > 0) {
-        guint n;
-
-        cairo_new_path(cairo_ctx);
-        cairo_set_line_width(cairo_ctx, 1.0);
-        for (n = 0; n < po->cite_level; n++) {
-            gdouble c_xpos = self->c_at_x + 0.5 + n * C_LABEL_SEP;
-
-            cairo_move_to(cairo_ctx, c_xpos, self->c_at_y);
-            cairo_line_to(cairo_ctx, c_xpos, self->c_at_y + P_TO_C(p_height));
-        }
-        cairo_stroke(cairo_ctx);
-        cairo_restore(cairo_ctx);
+       guint n;
+
+       cairo_new_path(cairo_ctx);
+       cairo_set_line_width(cairo_ctx, 1.0);
+       for (n = 0; n < po->cite_level; n++) {
+           gdouble c_xpos = self->c_at_x + 0.5 + n * C_LABEL_SEP;
+
+           cairo_move_to(cairo_ctx, c_xpos, self->c_at_y);
+           cairo_line_to(cairo_ctx, c_xpos, self->c_at_y + P_TO_C(p_height));
+       }
+       cairo_stroke(cairo_ctx);
+       cairo_restore(cairo_ctx);
     }
 
-    self->c_height = P_TO_C(p_height);  /* needed to properly print borders */
+    self->c_height = P_TO_C(p_height); /* needed to properly print borders */
 }
 
 
 #define UNICHAR_PREV(p)  g_utf8_get_char(g_utf8_prev_char(p))
 
 static GList *
-phrase_highlight(const gchar *buffer,
-                 gunichar     tag_char,
-                 PhraseType   tag_type,
-                 GList       *phrase_list)
+phrase_highlight(const gchar * buffer, gunichar tag_char,
+                PhraseType tag_type, GList * phrase_list)
 {
     gchar *utf_start;
 
@@ -844,53 +822,49 @@ phrase_highlight(const gchar *buffer,
        <whitespace, punctuation or buffer end> */
     utf_start = g_utf8_strchr(buffer, -1, tag_char);
     while (utf_start) {
-        gchar *s_next = g_utf8_next_char(utf_start);
-
-        if (((utf_start == buffer)
-             || g_unichar_isspace(UNICHAR_PREV(utf_start)))
-            && (*s_next != '\0')
-            && g_unichar_isalnum(g_utf8_get_char(s_next))) {
-            gchar *utf_end;
-            gchar *line_end;
-            gchar *e_next;
-
-            /* found a proper start sequence - find the end or eject */
-            if (!(utf_end = g_utf8_strchr(s_next, -1, tag_char))) {
-                return phrase_list;
-            }
-            line_end = g_utf8_strchr(s_next, -1, '\n');
-            e_next = g_utf8_next_char(utf_end);
-            while (!g_unichar_isalnum(UNICHAR_PREV(utf_end)) ||
-                   !(*e_next == '\0' ||
-                     g_unichar_isspace(g_utf8_get_char(e_next)) ||
-                     g_unichar_ispunct(g_utf8_get_char(e_next)))) {
-                if (!(utf_end = g_utf8_strchr(e_next, -1, tag_char))) {
-                    return phrase_list;
-                }
-                e_next = g_utf8_next_char(utf_end);
-            }
-
-            /* append the attribute if there is no line break */
-            if (!line_end || (line_end >= e_next)) {
-                PhraseRegion *new_region = g_new0(PhraseRegion, 1);
-
-                new_region->phrase_type = tag_type;
-                new_region->start_index = utf_start - buffer;
-                new_region->end_index = e_next - buffer;
-                phrase_list = g_list_prepend(phrase_list, new_region);
-
-                /* set the next start properly */
-                utf_start =
-                    *e_next ? g_utf8_strchr(e_next, -1, tag_char) : NULL;
-            } else {
-                utf_start =
-                    *s_next ? g_utf8_strchr(s_next, -1, tag_char) : NULL;
-            }
-        } else {
-            /* no start sequence, find the next start tag char */
-            utf_start =
-                *s_next ? g_utf8_strchr(s_next, -1, tag_char) : NULL;
-        }
+       gchar *s_next = g_utf8_next_char(utf_start);
+
+       if ((utf_start == buffer
+            || g_unichar_isspace(UNICHAR_PREV(utf_start)))
+           && *s_next != '\0'
+           && g_unichar_isalnum(g_utf8_get_char(s_next))) {
+           gchar *utf_end;
+           gchar *line_end;
+           gchar *e_next;
+
+           /* found a proper start sequence - find the end or eject */
+           if (!(utf_end = g_utf8_strchr(s_next, -1, tag_char)))
+               return phrase_list;
+           line_end = g_utf8_strchr(s_next, -1, '\n');
+           e_next = g_utf8_next_char(utf_end);
+           while (!g_unichar_isalnum(UNICHAR_PREV(utf_end)) ||
+                  !(*e_next == '\0' ||
+                    g_unichar_isspace(g_utf8_get_char(e_next)) ||
+                    g_unichar_ispunct(g_utf8_get_char(e_next)))) {
+               if (!(utf_end = g_utf8_strchr(e_next, -1, tag_char)))
+                   return phrase_list;
+               e_next = g_utf8_next_char(utf_end);
+           }
+
+           /* append the attribute if there is no line break */
+           if (!line_end || line_end >= e_next) {
+               PhraseRegion *new_region = g_new0(PhraseRegion, 1);
+
+               new_region->phrase_type = tag_type;
+               new_region->start_index = utf_start - buffer;
+               new_region->end_index = e_next - buffer;
+               phrase_list = g_list_prepend(phrase_list, new_region);
+
+               /* set the next start properly */
+               utf_start =
+                   *e_next ? g_utf8_strchr(e_next, -1, tag_char) : NULL;
+           } else
+               utf_start =
+                   *s_next ? g_utf8_strchr(s_next, -1, tag_char) : NULL;
+       } else
+           /* no start sequence, find the next start tag char */
+           utf_start =
+               *s_next ? g_utf8_strchr(s_next, -1, tag_char) : NULL;
     }
 
     return phrase_list;
@@ -898,15 +872,14 @@ phrase_highlight(const gchar *buffer,
 
 
 static PangoAttrList *
-phrase_list_to_pango(GList *phrase_list)
+phrase_list_to_pango(GList * phrase_list)
 {
     PangoAttrList *attr_list;
     PangoAttribute *ph_attr[PHRASE_TYPE_COUNT];
     gint n;
 
-    if (!phrase_list) {
-        return NULL;
-    }
+    if (!phrase_list)
+       return NULL;
 
     attr_list = pango_attr_list_new();
     ph_attr[PHRASE_BF] = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
@@ -914,54 +887,51 @@ phrase_list_to_pango(GList *phrase_list)
     ph_attr[PHRASE_UL] = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
 
     while (phrase_list) {
-        PhraseRegion *region = (PhraseRegion *) phrase_list->data;
-        PangoAttribute *new_attr;
+       PhraseRegion *region = (PhraseRegion *) phrase_list->data;
+       PangoAttribute *new_attr;
 
-        new_attr = pango_attribute_copy(ph_attr[region->phrase_type]);
-        new_attr->start_index = region->start_index;
-        new_attr->end_index = region->end_index;
-        pango_attr_list_insert(attr_list, new_attr);
+       new_attr = pango_attribute_copy(ph_attr[region->phrase_type]);
+       new_attr->start_index = region->start_index;
+       new_attr->end_index = region->end_index;
+       pango_attr_list_insert(attr_list, new_attr);
 
-        phrase_list = phrase_list->next;
+       phrase_list = phrase_list->next;
     }
 
-    for (n = 0; n < PHRASE_TYPE_COUNT; n++) {
-        pango_attribute_destroy(ph_attr[n]);
-    }
+    for (n = 0; n < PHRASE_TYPE_COUNT; n++)
+       pango_attribute_destroy(ph_attr[n]);
 
     return attr_list;
 }
 
 
 static GList *
-collect_attrs(GList *all_attr,
-              guint  offset,
-              guint  len)
+collect_attrs(GList * all_attr, guint offset, guint len)
 {
     GList *attr = NULL;
 
     while (all_attr) {
-        PhraseRegion *region = (PhraseRegion *) all_attr->data;
+       PhraseRegion *region = (PhraseRegion *) all_attr->data;
 
-        if (((region->start_index >= offset)
-             && (region->start_index <= offset + len))
-            || ((region->end_index >= offset)
-                && (region->end_index <= offset + len))) {
+       if ((region->start_index >= offset
+            && region->start_index <= offset + len)
+           || (region->end_index >= offset
+               && region->end_index <= offset + len)) {
             /* scan-build does not see this as initializing this_reg:
-               PhraseRegion *this_reg =
-                g_memdup(region, sizeof(PhraseRegion));
+           PhraseRegion *this_reg =
+               g_memdup(region, sizeof(PhraseRegion));
              */
             PhraseRegion *this_reg;
 
             this_reg = g_new(PhraseRegion, 1);
             *this_reg = *region;
 
-            this_reg->start_index = MAX(0, this_reg->start_index - offset);
-            this_reg->end_index = MIN(len, this_reg->end_index - offset);
+            this_reg->start_index = MAX(0,   this_reg->start_index - offset);
+            this_reg->end_index   = MIN(len, this_reg->end_index   - offset);
 
-            attr = g_list_prepend(attr, this_reg);
-        }
-        all_attr = all_attr->next;
+           attr = g_list_prepend(attr, this_reg);
+       }
+       all_attr = all_attr->next;
     }
 
     return attr;
diff --git a/src/balsa-print-object-text.h b/src/balsa-print-object-text.h
index 288db9e..7847402 100644
--- a/src/balsa-print-object-text.h
+++ b/src/balsa-print-object-text.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -24,13 +24,13 @@
 
 G_BEGIN_DECLS
 
-#define BALSA_TYPE_PRINT_OBJECT_TEXT    \
+#define BALSA_TYPE_PRINT_OBJECT_TEXT   \
     (balsa_print_object_text_get_type())
-#define BALSA_PRINT_OBJECT_TEXT(obj)                            \
+#define BALSA_PRINT_OBJECT_TEXT(obj)                           \
     G_TYPE_CHECK_INSTANCE_CAST(obj, BALSA_TYPE_PRINT_OBJECT_TEXT, BalsaPrintObjectText)
-#define BALSA_PRINT_OBJECT_TEXT_CLASS(klass)                    \
+#define BALSA_PRINT_OBJECT_TEXT_CLASS(klass)                   \
     G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_PRINT_OBJECT_TEXT, BalsaPrintObjectTextClass)
-#define BALSA_IS_PRINT_OBJECT_TEXT(obj)                 \
+#define BALSA_IS_PRINT_OBJECT_TEXT(obj)                        \
     G_TYPE_CHECK_INSTANCE_TYPE(obj, BALSA_TYPE_PRINT_OBJECT_TEXT)
 
 
@@ -54,24 +54,24 @@ struct _BalsaPrintObjectTextClass {
 
 
 GType balsa_print_object_text_get_type(void);
-GList *balsa_print_object_text_plain(GList               *list,
-                                     GtkPrintContext     *context,
-                                     LibBalsaMessageBody *body,
-                                     BalsaPrintSetup     *psetup);
-GList *balsa_print_object_text(GList               *list,
-                               GtkPrintContext     *context,
-                               LibBalsaMessageBody *body,
-                               BalsaPrintSetup     *psetup);
-GList *balsa_print_object_text_vcard(GList               *list,
-                                     GtkPrintContext     *context,
-                                     LibBalsaMessageBody *body,
-                                     BalsaPrintSetup     *psetup);
-GList *balsa_print_object_text_calendar(GList               *list,
-                                        GtkPrintContext     *context,
-                                        LibBalsaMessageBody *body,
-                                        BalsaPrintSetup     *psetup);
+GList *balsa_print_object_text_plain(GList *list,
+                                    GtkPrintContext * context,
+                                    LibBalsaMessageBody * body,
+                                    BalsaPrintSetup * psetup);
+GList *balsa_print_object_text(GList *list,
+                              GtkPrintContext * context,
+                              LibBalsaMessageBody * body,
+                              BalsaPrintSetup * psetup);
+GList *balsa_print_object_text_vcard(GList *list,
+                                    GtkPrintContext * context,
+                                    LibBalsaMessageBody * body,
+                                    BalsaPrintSetup * psetup);
+GList *balsa_print_object_text_calendar(GList *list,
+                                        GtkPrintContext * context,
+                                        LibBalsaMessageBody * body,
+                                        BalsaPrintSetup * psetup);
 
 
 G_END_DECLS
 
-#endif                          /* __BALSA_PRINT_OBJECT_TEXT_H__ */
+#endif                         /* __BALSA_PRINT_OBJECT_TEXT_H__ */
diff --git a/src/balsa-print-object.c b/src/balsa-print-object.c
index 35edd69..4c2a535 100644
--- a/src/balsa-print-object.c
+++ b/src/balsa-print-object.c
@@ -7,18 +7,18 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "balsa-print-object.h"
 
@@ -35,9 +35,9 @@
 
 
 /* object related functions */
-static void balsa_print_object_init(GTypeInstance *instance,
-                                    gpointer       g_class);
-static void balsa_print_object_class_init(BalsaPrintObjectClass *klass);
+static void balsa_print_object_init(GTypeInstance * instance,
+                                   gpointer g_class);
+static void balsa_print_object_class_init(BalsaPrintObjectClass * klass);
 
 
 static GObjectClass *parent_class = NULL;
@@ -49,21 +49,21 @@ balsa_print_object_get_type()
     static GType balsa_print_object_type = 0;
 
     if (!balsa_print_object_type) {
-        static const GTypeInfo balsa_print_object_info = {
-            sizeof(BalsaPrintObjectClass),
-            NULL,               /* base_init */
-            NULL,               /* base_finalize */
-            (GClassInitFunc) balsa_print_object_class_init,
-            NULL,               /* class_finalize */
-            NULL,               /* class_data */
-            sizeof(BalsaPrintObject),
-            0,                  /* n_preallocs */
-            (GInstanceInitFunc) balsa_print_object_init
-        };
-
-        balsa_print_object_type =
-            g_type_register_static(G_TYPE_OBJECT, "BalsaPrintObject",
-                                   &balsa_print_object_info, 0);
+       static const GTypeInfo balsa_print_object_info = {
+           sizeof(BalsaPrintObjectClass),
+           NULL,               /* base_init */
+           NULL,               /* base_finalize */
+           (GClassInitFunc) balsa_print_object_class_init,
+           NULL,               /* class_finalize */
+           NULL,               /* class_data */
+           sizeof(BalsaPrintObject),
+           0,                  /* n_preallocs */
+           (GInstanceInitFunc) balsa_print_object_init
+       };
+
+       balsa_print_object_type =
+           g_type_register_static(G_TYPE_OBJECT, "BalsaPrintObject",
+                                  &balsa_print_object_info, 0);
     }
 
     return balsa_print_object_type;
@@ -71,8 +71,7 @@ balsa_print_object_get_type()
 
 
 static void
-balsa_print_object_init(GTypeInstance *instance,
-                        gpointer       g_class)
+balsa_print_object_init(GTypeInstance * instance, gpointer g_class)
 {
     BalsaPrintObject *self = (BalsaPrintObject *) instance;
 
@@ -86,7 +85,7 @@ balsa_print_object_init(GTypeInstance *instance,
 
 
 static void
-balsa_print_object_class_init(BalsaPrintObjectClass *klass)
+balsa_print_object_class_init(BalsaPrintObjectClass * klass)
 {
     parent_class = g_type_class_ref(G_TYPE_OBJECT);
     klass->draw = balsa_print_object_draw;
@@ -94,73 +93,64 @@ balsa_print_object_class_init(BalsaPrintObjectClass *klass)
 
 
 static GList *
-balsa_print_object_emb_message(GList               *list,
-                               GtkPrintContext     *context,
-                               LibBalsaMessageBody *mime_body,
-                               BalsaPrintSetup     *psetup)
+balsa_print_object_emb_message(GList * list, GtkPrintContext * context,
+                                    LibBalsaMessageBody * mime_body,
+                                    BalsaPrintSetup * psetup)
 {
     list = balsa_print_object_frame_begin(list, NULL, psetup);
     return balsa_print_object_header_from_body(list, context, mime_body, psetup);
 }
 
-
 static GList *
-balsa_print_object_emb_headers(GList               *list,
-                               GtkPrintContext     *context,
-                               LibBalsaMessageBody *mime_body,
-                               BalsaPrintSetup     *psetup)
+balsa_print_object_emb_headers(GList * list, GtkPrintContext * context,
+            LibBalsaMessageBody * mime_body,
+            BalsaPrintSetup * psetup)
 {
     list = balsa_print_object_frame_begin(list, _("message headers"), psetup);
     list = balsa_print_object_header_from_body(list, context, mime_body, psetup);
     return balsa_print_object_frame_end(list, psetup);
 }
 
-
 #ifdef HAVE_GPGME
 static GList *
-balsa_print_object_mp_crypto(GList               *list,
-                             GtkPrintContext     *context,
-                             LibBalsaMessageBody *mime_body,
-                             BalsaPrintSetup     *psetup)
+balsa_print_object_mp_crypto(GList * list, GtkPrintContext * context,
+                               LibBalsaMessageBody * mime_body,
+                               BalsaPrintSetup * psetup)
 {
     return balsa_print_object_header_crypto(list, context, mime_body, NULL, psetup);
 }
-
-
 #endif                          /* HAVE_GPGME */
 
 
 GList *
-balsa_print_objects_append_from_body(GList               *list,
-                                     GtkPrintContext     *context,
-                                     LibBalsaMessageBody *mime_body,
-                                     BalsaPrintSetup     *psetup)
+balsa_print_objects_append_from_body(GList * list,
+                                    GtkPrintContext * context,
+                                    LibBalsaMessageBody * mime_body,
+                                    BalsaPrintSetup * psetup)
 {
     static const struct {
-        char *type;   /* MIME type */
+        char * type;  /* MIME type */
         int use_len;  /* length for strncasecmp or -1 for strcasecmp */
-        GList * (*handler)(GList *,
-                           GtkPrintContext *,
-                           LibBalsaMessageBody *,
+        GList * (*handler)(GList *, GtkPrintContext *, LibBalsaMessageBody *,
                            BalsaPrintSetup *);
     } pr_handlers[] = {
-        { "text/html", -1, balsa_print_object_default },
-        { "text/enriched", -1, balsa_print_object_default },
-        { "text/richtext", -1, balsa_print_object_default },
-        { "text/x-vcard", -1, balsa_print_object_text_vcard },
-        { "text/directory", -1, balsa_print_object_text_vcard },
-        { "text/calendar", -1, balsa_print_object_text_calendar },
-        { "text/plain", -1, balsa_print_object_text_plain },
-        { "text/rfc822-headers", -1, balsa_print_object_emb_headers },
-        { "text/", 5, balsa_print_object_text },
-        { "image/", 6, balsa_print_object_image },
-        { "message/rfc822", -1, balsa_print_object_emb_message },
+        { "text/html",                     -1, balsa_print_object_default },
+        { "text/enriched",                 -1, balsa_print_object_default },
+        { "text/richtext",                 -1, balsa_print_object_default },
+        { "text/x-vcard",                  -1, balsa_print_object_text_vcard },
+        { "text/directory",                -1, balsa_print_object_text_vcard },
+        { "text/calendar",                 -1, balsa_print_object_text_calendar },
+        { "text/plain",                    -1, balsa_print_object_text_plain },
+        { "text/rfc822-headers",          -1, balsa_print_object_emb_headers },
+        { "text/",                          5, balsa_print_object_text },
+        { "image/",                         6, balsa_print_object_image },
+        { "message/rfc822",                -1, balsa_print_object_emb_message },
 #ifdef HAVE_GPGME
-        { "application/pgp-signature", -1, balsa_print_object_mp_crypto },
-        { "application/pkcs7-signature", -1, balsa_print_object_mp_crypto },
+        { "application/pgp-signature",     -1, balsa_print_object_mp_crypto },
+        { "application/pkcs7-signature",   -1, balsa_print_object_mp_crypto },
         { "application/x-pkcs7-signature", -1, balsa_print_object_mp_crypto },
-#endif                          /* HAVE_GPGME */
-        { NULL, -1, balsa_print_object_default }
+#endif                         /* HAVE_GPGME */
+        { NULL,                            -1, balsa_print_object_default }
     };
     gchar *conttype;
     GList *result;
@@ -169,12 +159,11 @@ balsa_print_objects_append_from_body(GList               *list,
     conttype = libbalsa_message_body_get_mime_type(mime_body);
     for (n = 0;
          pr_handlers[n].type &&
-         ((pr_handlers[n].use_len == -1 &&
-           g_ascii_strcasecmp(pr_handlers[n].type, conttype)) ||
-          (pr_handlers[n].use_len > 0 &&
-           g_ascii_strncasecmp(pr_handlers[n].type, conttype, pr_handlers[n].use_len)));
-         n++) {
-    }
+             ((pr_handlers[n].use_len == -1 &&
+               g_ascii_strcasecmp(pr_handlers[n].type, conttype)) ||
+              (pr_handlers[n].use_len > 0 &&
+               g_ascii_strncasecmp(pr_handlers[n].type, conttype, pr_handlers[n].use_len)));
+         n++);
     result = pr_handlers[n].handler(list, context, mime_body, psetup);
     g_free(conttype);
     return result;
@@ -182,33 +171,31 @@ balsa_print_objects_append_from_body(GList               *list,
 
 
 void
-balsa_print_object_draw(BalsaPrintObject *self,
-                        GtkPrintContext  *context,
-                        cairo_t          *cairo_ctx)
+balsa_print_object_draw(BalsaPrintObject * self, GtkPrintContext * context,
+                       cairo_t * cairo_ctx)
 {
     guint level;
 
     BALSA_PRINT_OBJECT_CLASS(G_OBJECT_GET_CLASS(self))->draw(self, context, cairo_ctx);
 
     /* print borders if the depth is > 0 */
-    if (self->depth == 0) {
-        return;
-    }
+    if (self->depth == 0)
+       return;
 
     /* print the requested number of border lines */
     cairo_save(cairo_ctx);
     cairo_set_line_width(cairo_ctx, 0.25);
     cairo_new_path(cairo_ctx);
     for (level = self->depth; level; level--) {
-        gdouble level_sep = level * C_LABEL_SEP;
-
-        cairo_move_to(cairo_ctx, self->c_at_x - level_sep, self->c_at_y);
-        cairo_line_to(cairo_ctx, self->c_at_x - level_sep,
-                      self->c_at_y + self->c_height);
-        cairo_move_to(cairo_ctx, self->c_at_x + self->c_width + level_sep,
-                      self->c_at_y);
-        cairo_line_to(cairo_ctx, self->c_at_x + self->c_width + level_sep,
-                      self->c_at_y + self->c_height);
+       gdouble level_sep = level * C_LABEL_SEP;
+
+       cairo_move_to(cairo_ctx, self->c_at_x - level_sep, self->c_at_y);
+       cairo_line_to(cairo_ctx, self->c_at_x - level_sep,
+                     self->c_at_y + self->c_height);
+       cairo_move_to(cairo_ctx, self->c_at_x + self->c_width + level_sep,
+                     self->c_at_y);
+       cairo_line_to(cairo_ctx, self->c_at_x + self->c_width + level_sep,
+                     self->c_at_y + self->c_height);
     }
     cairo_stroke(cairo_ctx);
     cairo_restore(cairo_ctx);
@@ -219,8 +206,7 @@ balsa_print_object_draw(BalsaPrintObject *self,
 
 /* return the width of the passed string in Pango units */
 gint
-p_string_width_from_layout(PangoLayout *layout,
-                           const gchar *text)
+p_string_width_from_layout(PangoLayout * layout, const gchar * text)
 {
     gint width;
 
@@ -232,8 +218,7 @@ p_string_width_from_layout(PangoLayout *layout,
 
 /* return the height of the passed string in Pango units */
 gint
-p_string_height_from_layout(PangoLayout *layout,
-                            const gchar *text)
+p_string_height_from_layout(PangoLayout * layout, const gchar * text)
 {
     gint height;
 
@@ -246,11 +231,8 @@ p_string_height_from_layout(PangoLayout *layout,
 /* print a cairo_surface_t to cairo at the specified position and with the
  * specified scale */
 gboolean
-cairo_print_surface(cairo_t         *cairo_ctx,
-                    cairo_surface_t *surface,
-                    gdouble          c_at_x,
-                    gdouble          c_at_y,
-                    gdouble          scale)
+cairo_print_surface(cairo_t * cairo_ctx, cairo_surface_t * surface,
+                   gdouble c_at_x, gdouble c_at_y, gdouble scale)
 {
     gint width;
     gint height;
@@ -260,7 +242,7 @@ cairo_print_surface(cairo_t         *cairo_ctx,
 
     /* paranoia checks */
     g_return_val_if_fail(cairo_ctx != NULL, FALSE);
-    g_return_val_if_fail(surface != NULL, FALSE);
+    g_return_val_if_fail(surface   != NULL, FALSE);
 
     /* must have 3 (no alpha) or 4 (with alpha) channels */
     format = cairo_image_surface_get_format(surface);
@@ -268,7 +250,7 @@ cairo_print_surface(cairo_t         *cairo_ctx,
                          format == CAIRO_FORMAT_RGB24,
                          FALSE);
 
-    width = cairo_image_surface_get_width(surface);
+    width  = cairo_image_surface_get_width(surface);
     height = cairo_image_surface_get_height(surface);
 
     /* save current state */
@@ -291,7 +273,7 @@ cairo_print_surface(cairo_t         *cairo_ctx,
     cairo_move_to(cairo_ctx, c_at_x, c_at_y);
     cairo_line_to(cairo_ctx, c_at_x + width * scale, c_at_y);
     cairo_line_to(cairo_ctx, c_at_x + width * scale,
-                  c_at_y + height * scale);
+                 c_at_y + height * scale);
     cairo_line_to(cairo_ctx, c_at_x, c_at_y + height * scale);
     cairo_close_path(cairo_ctx);
     cairo_clip(cairo_ctx);
@@ -307,11 +289,8 @@ cairo_print_surface(cairo_t         *cairo_ctx,
 /* print a GdkPixbuf to cairo at the specified position and with the
  * specified scale */
 gboolean
-cairo_print_pixbuf(cairo_t         *cairo_ctx,
-                   const GdkPixbuf *pixbuf,
-                   gdouble          c_at_x,
-                   gdouble          c_at_y,
-                   gdouble          scale)
+cairo_print_pixbuf(cairo_t * cairo_ctx, const GdkPixbuf * pixbuf,
+                  gdouble c_at_x, gdouble c_at_y, gdouble scale)
 {
     gint n_chans;
     cairo_surface_t *surface;
@@ -321,7 +300,7 @@ cairo_print_pixbuf(cairo_t         *cairo_ctx,
 
     /* must have 8 bpp */
     g_return_val_if_fail(gdk_pixbuf_get_bits_per_sample(pixbuf) == 8,
-                         FALSE);
+                        FALSE);
 
     /* must have 3 (no alpha) or 4 (with alpha) channels */
     n_chans = gdk_pixbuf_get_n_channels(pixbuf);
@@ -337,12 +316,9 @@ cairo_print_pixbuf(cairo_t         *cairo_ctx,
 
 /* split a text buffer into chunks using the passed Pango layout */
 GList *
-split_for_layout(PangoLayout     *layout,
-                 const gchar     *text,
-                 PangoAttrList   *attributes,
-                 BalsaPrintSetup *psetup,
-                 gboolean         is_header,
-                 GArray         **offsets)
+split_for_layout(PangoLayout * layout, const gchar * text,
+                PangoAttrList * attributes, BalsaPrintSetup * psetup,
+                gboolean is_header, GArray ** offsets)
 {
     GList *split_list = NULL;
     PangoLayoutIter *iter;
@@ -356,12 +332,10 @@ split_for_layout(PangoLayout     *layout,
 
     /* set the text and its attributes, then get an iter */
     pango_layout_set_text(layout, text, -1);
-    if (attributes) {
-        pango_layout_set_attributes(layout, attributes);
-    }
-    if (offsets) {
-        *offsets = g_array_new(FALSE, FALSE, sizeof(guint));
-    }
+    if (attributes)
+       pango_layout_set_attributes(layout, attributes);
+    if (offsets)
+       *offsets = g_array_new(FALSE, FALSE, sizeof(guint));
     iter = pango_layout_get_iter(layout);
 
     /* loop over lines */
@@ -371,62 +345,58 @@ split_for_layout(PangoLayout     *layout,
     p_y_pos = C_TO_P(psetup->c_y_pos);
     p_height = C_TO_P(psetup->c_height);
     do {
-        pango_layout_iter_get_line_yrange(iter, &p_y0, &p_y1);
-        if (p_y_pos + p_y1 - p_offset > p_height) {
-            gint index;
-            gint tr;
-            gchar *chunk;
-            gboolean ends_with_nl;
-
-            if (offsets) {
-                guint offs = start - text;
-
-                *offsets = g_array_append_val(*offsets, offs);
-            }
-            pango_layout_xy_to_index(layout, 0, p_y0, &index, &tr);
-            ends_with_nl = text[index - 1] == '\n';
-            if (ends_with_nl) {
-                index--;
-            }
-            chunk = g_strndup(start, text + index - start);
-            if (add_tab) {
-                split_list =
-                    g_list_append(split_list,
-                                  g_strconcat("\t", chunk, NULL));
-            } else {
-                split_list = g_list_append(split_list, g_strdup(chunk));
-            }
-            add_tab = is_header && !ends_with_nl;
-            g_free(chunk);
-            start = text + index;
-            if (ends_with_nl) {
-                start++;
-            }
-            if (*start == '\0') {
-                p_y_pos = p_height;
-            } else {
-                p_y_pos = 0;
-                psetup->page_count++;
-            }
-            p_offset = p_y0;
-        }
+       pango_layout_iter_get_line_yrange(iter, &p_y0, &p_y1);
+       if (p_y_pos + p_y1 - p_offset > p_height) {
+           gint index;
+           gint tr;
+           gchar *chunk;
+           gboolean ends_with_nl;
+
+           if (offsets) {
+               guint offs = start - text;
+
+               *offsets = g_array_append_val(*offsets, offs);
+           }
+           pango_layout_xy_to_index(layout, 0, p_y0, &index, &tr);
+           ends_with_nl = text[index - 1] == '\n';
+           if (ends_with_nl)
+               index--;
+           chunk = g_strndup(start, text + index - start);
+           if (add_tab)
+               split_list =
+                   g_list_append(split_list,
+                                 g_strconcat("\t", chunk, NULL));
+           else
+               split_list = g_list_append(split_list, g_strdup(chunk));
+           add_tab = is_header && !ends_with_nl;
+           g_free(chunk);
+           start = text + index;
+           if (ends_with_nl)
+               start++;
+           if (*start == '\0')
+               p_y_pos = p_height;
+           else {
+               p_y_pos = 0;
+               psetup->page_count++;
+           }
+           p_offset = p_y0;
+       }
     } while (pango_layout_iter_next_line(iter));
     pango_layout_iter_free(iter);
 
     /* append any remaining stuff */
     if (*start != '\0') {
-        p_y_pos += p_y1 - p_offset;
-        if (offsets) {
-            guint offs = start - text;
-
-            *offsets = g_array_append_val(*offsets, offs);
-        }
-        if (add_tab) {
-            split_list =
-                g_list_append(split_list, g_strconcat("\t", start, NULL));
-        } else {
-            split_list = g_list_append(split_list, g_strdup(start));
-        }
+       p_y_pos += p_y1 - p_offset;
+       if (offsets) {
+           guint offs = start - text;
+
+           *offsets = g_array_append_val(*offsets, offs);
+       }
+       if (add_tab)
+           split_list =
+               g_list_append(split_list, g_strconcat("\t", start, NULL));
+       else
+           split_list = g_list_append(split_list, g_strdup(start));
     }
 
     /* remember the new y position in cairo units */
diff --git a/src/balsa-print-object.h b/src/balsa-print-object.h
index 1e89e4c..524d0fb 100644
--- a/src/balsa-print-object.h
+++ b/src/balsa-print-object.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -56,37 +56,27 @@ typedef struct {
 #define C_HEADER_SEP            12
 
 
-gint p_string_width_from_layout(PangoLayout *layout,
-                                const gchar *text);
-gint p_string_height_from_layout(PangoLayout *layout,
-                                 const gchar *text);
-gboolean cairo_print_pixbuf(cairo_t         *cairo_ctx,
-                            const GdkPixbuf *pixbuf,
-                            gdouble          c_at_x,
-                            gdouble          c_at_y,
-                            gdouble          scale);
-gboolean cairo_print_surface(cairo_t         *cairo_ctx,
-                             cairo_surface_t *surface,
-                             gdouble          c_at_x,
-                             gdouble          c_at_y,
-                             gdouble          scale);
-GList *split_for_layout(PangoLayout     *layout,
-                        const gchar     *text,
-                        PangoAttrList   *attributes,
-                        BalsaPrintSetup *psetup,
-                        gboolean         is_header,
-                        GArray         **offsets);
+gint p_string_width_from_layout(PangoLayout * layout, const gchar * text);
+gint p_string_height_from_layout(PangoLayout * layout, const gchar * text);
+gboolean cairo_print_pixbuf(cairo_t * cairo_ctx, const GdkPixbuf * pixbuf,
+                           gdouble c_at_x, gdouble c_at_y, gdouble scale);
+gboolean cairo_print_surface(cairo_t * cairo_ctx, cairo_surface_t * surface,
+                            gdouble c_at_x, gdouble c_at_y, gdouble scale);
+GList *split_for_layout(PangoLayout * layout, const gchar * text,
+                       PangoAttrList * attributes,
+                       BalsaPrintSetup * psetup, gboolean is_header,
+                       GArray ** offsets);
 
 
 /*  == print object base class stuff ==  */
 
-#define BALSA_TYPE_PRINT_OBJECT                 \
+#define BALSA_TYPE_PRINT_OBJECT                        \
     (balsa_print_object_get_type())
-#define BALSA_PRINT_OBJECT(obj)                                         \
+#define BALSA_PRINT_OBJECT(obj)                                                \
     G_TYPE_CHECK_INSTANCE_CAST(obj, BALSA_TYPE_PRINT_OBJECT, BalsaPrintObject)
-#define BALSA_PRINT_OBJECT_CLASS(klass)                                 \
+#define BALSA_PRINT_OBJECT_CLASS(klass)                                        \
     G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_PRINT_OBJECT, BalsaPrintObjectClass)
-#define BALSA_IS_PRINT_OBJECT(obj)                      \
+#define BALSA_IS_PRINT_OBJECT(obj)                     \
     G_TYPE_CHECK_INSTANCE_TYPE(obj, BALSA_TYPE_PRINT_OBJECT)
 
 
@@ -110,24 +100,23 @@ struct _BalsaPrintObject {
 struct _BalsaPrintObjectClass {
     GObjectClass parent;
 
-    void (*draw) (BalsaPrintObject *self,
-                  GtkPrintContext  *context,
-                  cairo_t          *cairo_ctx);
+    void (*draw) (BalsaPrintObject * self, GtkPrintContext * context,
+                 cairo_t * cairo_ctx);
 };
 
 
 GType balsa_print_object_get_type(void);
-GList *balsa_print_objects_append_from_body(GList           *list,
-                                            GtkPrintContext *context,
-                                            LibBalsaMessageBody *
-                                            mime_body,
-                                            BalsaPrintSetup *psetup);
-void balsa_print_object_draw(BalsaPrintObject *self,
-                             GtkPrintContext  *context,
-                             cairo_t          *cairo_ctx);
+GList *balsa_print_objects_append_from_body(GList * list,
+                                           GtkPrintContext * context,
+                                           LibBalsaMessageBody *
+                                           mime_body,
+                                           BalsaPrintSetup * psetup);
+void balsa_print_object_draw(BalsaPrintObject * self,
+                            GtkPrintContext * context,
+                            cairo_t * cairo_ctx);
 
 
 G_END_DECLS
 
 
-#endif                          /* __BALSA_PRINT_OBJECT_H__ */
+#endif                         /* __BALSA_PRINT_OBJECT_H__ */
diff --git a/src/filter-edit-callbacks.c b/src/filter-edit-callbacks.c
index a0a778e..8893bf2 100644
--- a/src/filter-edit-callbacks.c
+++ b/src/filter-edit-callbacks.c
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -22,7 +22,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <time.h>
@@ -40,21 +40,18 @@
 #include "missing.h"
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#  include "macosx-helpers.h"
 #endif
 
 /* Defined in filter-edit-dialog.c*/
 extern option_list fe_search_type[4];
-extern GList *fe_user_headers_list;
+extern GList * fe_user_headers_list;
 
 #if REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED
-static void fe_add_pressed(GtkWidget *widget,
-                           gpointer   throwaway);
-static void fe_remove_pressed(GtkWidget *widget,
-                              gpointer   throwaway);
-static void fe_regexs_selection_changed(GtkTreeSelection *selection,
-                                        gpointer          user_data);
-
+static void fe_add_pressed(GtkWidget * widget, gpointer throwaway);
+static void fe_remove_pressed(GtkWidget * widget, gpointer throwaway);
+static void fe_regexs_selection_changed(GtkTreeSelection * selection,
+                                        gpointer user_data);
 #endif                  /* REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED */
 static void fe_free_associated_filters(void);
 static void fe_free_associated_conditions(void);
@@ -62,22 +59,22 @@ static GtkWidget *fe_date_sample(void);
 
 /* The dialog widget (we need it to be able to close dialog on error) */
 
-extern GtkWidget *fe_window;
-
+extern GtkWidget * fe_window;
+    
 extern GtkTreeView *fe_filters_list;
-
+    
 extern gboolean fe_already_open;
-
+    
 /* The type notebook */
 GtkWidget *fe_type_notebook;
-
+    
 /* containers for radiobuttons */
 GtkWidget *fe_search_option_menu;
 extern GtkWidget *fe_op_codes_option_menu;
-
+    
 /* Name field */
 extern GtkWidget *fe_name_entry;
-
+    
 /* widgets for the matching fields */
 GtkWidget *fe_matching_fields_body;
 GtkWidget *fe_matching_fields_to;
@@ -85,19 +82,19 @@ GtkWidget *fe_matching_fields_from;
 GtkWidget *fe_matching_fields_subject;
 GtkWidget *fe_matching_fields_cc;
 /* Combo list for user headers and check button*/
-GtkWidget *fe_user_header;
-GtkWidget *fe_matching_fields_us_head;
+GtkWidget * fe_user_header;
+GtkWidget * fe_matching_fields_us_head;
 
 /* widget for the conditions */
 extern GtkTreeView *fe_conditions_list;
-
+    
 /* widgets for the type notebook simple page */
 GtkWidget *fe_type_simple_label;
 GtkWidget *fe_type_simple_entry;
 
 /* widgets for the type notebook date page */
 GtkWidget *fe_type_date_label;
-GtkWidget *fe_type_date_low_entry, *fe_type_date_high_entry;
+GtkWidget *fe_type_date_low_entry,*fe_type_date_high_entry;
 
 /* widgets for the type notebook regex page */
 GtkTreeView *fe_type_regex_list;
@@ -125,23 +122,23 @@ extern GtkWidget *fe_action_option_menu;
 extern option_list fe_actions[];
 
 /* Mailboxes option menu */
-extern GtkWidget *fe_mailboxes;
+extern GtkWidget * fe_mailboxes;
 
 /* Colorize widgets */
-extern GtkWidget *fe_color_buttons;
-extern GtkWidget *fe_foreground_set;
-extern GtkWidget *fe_foreground;
-extern GtkWidget *fe_background_set;
-extern GtkWidget *fe_background;
+extern GtkWidget * fe_color_buttons;
+extern GtkWidget * fe_foreground_set;
+extern GtkWidget * fe_foreground;
+extern GtkWidget * fe_background_set;
+extern GtkWidget * fe_background;
 
 /* Different buttons that need to be greyed or ungreyed */
-extern GtkWidget *fe_new_button;
-extern GtkWidget *fe_delete_button;
-extern GtkWidget *fe_apply_button;
-extern GtkWidget *fe_revert_button;
-extern GtkWidget *fe_condition_delete_button;
-extern GtkWidget *fe_condition_edit_button;
-GtkWidget *fe_regex_remove_button;
+extern GtkWidget * fe_new_button;
+extern GtkWidget * fe_delete_button;
+extern GtkWidget * fe_apply_button;
+extern GtkWidget * fe_revert_button;
+extern GtkWidget * fe_condition_delete_button;
+extern GtkWidget * fe_condition_edit_button;
+GtkWidget * fe_regex_remove_button;
 
 /* condition_has_changed allows us to be smart enough not to make the
  * whole process of building a new condition when editing condition
@@ -162,21 +159,21 @@ static gboolean is_new_condition;
  */
 
 typedef struct _filters_names_rec {
-    gchar *old_name;
-    gchar *new_name;
+    gchar * old_name;
+    gchar * new_name;
 } filters_names_rec;
 
 /*
  * List containing all filters names changes
  */
 
-static GList *filters_names_changes = NULL;
+static GList * filters_names_changes=NULL;
 
 /*
  * List containing current names of new filters
  * This is necessary to have coherency in filters_names_changes
  */
-static GList *new_filters_names = NULL;
+static GList * new_filters_names=NULL;
 
 /* Free filters associated with list row */
 static void
@@ -196,12 +193,11 @@ fe_free_associated_filters(void)
     }
 }
 
-
 static void
 fe_free_associated_conditions(void)
 {
     gboolean valid;
-    GtkTreeModel *model =
+    GtkTreeModel *model = 
         gtk_tree_view_get_model(fe_conditions_list);
     GtkTreeIter iter;
 
@@ -210,11 +206,10 @@ fe_free_associated_conditions(void)
         LibBalsaCondition *cond;
 
         gtk_tree_model_get(model, &iter, 1, &cond, -1);
-        libbalsa_condition_unref(cond);
+       libbalsa_condition_unref(cond);
     }
 }
 
-
 /*
  * unique_filter_name()
  *
@@ -229,7 +224,7 @@ fe_free_associated_conditions(void)
  */
 
 static gboolean
-unique_filter_name(const gchar *name)
+unique_filter_name(const gchar * name)
 {
     GtkTreeModel *model;
     GtkTreeSelection *selection;
@@ -237,29 +232,26 @@ unique_filter_name(const gchar *name)
     gchar *row_text;
     gboolean valid;
 
-    if (!name || (name[0] == '\0')) {
+    if (!name || name[0] == '\0')
         return FALSE;
-    }
 
     model = gtk_tree_view_get_model(fe_filters_list);
     selection = gtk_tree_view_get_selection(fe_filters_list);
     for (valid = gtk_tree_model_get_iter_first(model, &iter); valid;
          valid = gtk_tree_model_iter_next(model, &iter)) {
-        gboolean matches;
+       gboolean matches;
 
         gtk_tree_model_get(model, &iter, 0, &row_text, -1);
-        matches = strcmp(name, row_text) == 0;
-        g_free(row_text);
+       matches = strcmp(name, row_text) == 0;
+       g_free(row_text);
         if (matches
-            && !gtk_tree_selection_iter_is_selected(selection, &iter)) {
+            && !gtk_tree_selection_iter_is_selected(selection, &iter))
             return FALSE;
-        }
     }
 
     return TRUE;
 }                               /* end unique_filter_name() */
 
-
 /**************** Conditions *************************/
 
 #if REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED
@@ -267,7 +259,7 @@ unique_filter_name(const gchar *name)
 
 static void
 fe_regexs_selection_changed(GtkTreeSelection *selection,
-                            gpointer          user_data)
+                            gpointer user_data)
 {
     gboolean selected;
     GtkTreeModel *model;
@@ -277,20 +269,17 @@ fe_regexs_selection_changed(GtkTreeSelection *selection,
     selected = gtk_tree_selection_get_selected(selection, &model, &iter);
     if (selected) {
         gtk_tree_model_get(model, &iter, 0, &str, -1);
-        gtk_entry_set_text(GTK_ENTRY(fe_type_regex_entry), str);
+        gtk_entry_set_text(GTK_ENTRY(fe_type_regex_entry),str);
         g_free(str);
-    } else {
-        gtk_entry_set_text(GTK_ENTRY(fe_type_regex_entry), "");
     }
+    else gtk_entry_set_text(GTK_ENTRY(fe_type_regex_entry),"");
     gtk_widget_set_sensitive(fe_regex_remove_button, selected);
 }
-
-
 #endif                  /* REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED */
 
 /* Helper. */
 static gint
-fe_combo_box_get_value(GtkWidget *combo_box)
+fe_combo_box_get_value(GtkWidget * combo_box)
 {
     struct fe_combo_box_info *info =
         g_object_get_data(G_OBJECT(combo_box), BALSA_FE_COMBO_BOX_INFO);
@@ -300,7 +289,6 @@ fe_combo_box_get_value(GtkWidget *combo_box)
     return GPOINTER_TO_INT(g_slist_nth_data(info->values, active));
 }
 
-
 /*
  * fe_typesmenu_cb()
  *
@@ -308,8 +296,7 @@ fe_combo_box_get_value(GtkWidget *combo_box)
  * When they are toggled, the notebook page must change
  */
 static void
-fe_typesmenu_cb(GtkWidget *widget,
-                GtkWidget *field_frame)
+fe_typesmenu_cb(GtkWidget * widget, GtkWidget * field_frame)
 {
     ConditionMatchType type =
         (ConditionMatchType) fe_combo_box_get_value(widget);
@@ -325,54 +312,41 @@ fe_typesmenu_cb(GtkWidget *widget,
 #endif                  /* REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED */
         gtk_widget_show(field_frame);
         break;
-
     case CONDITION_DATE:
     case CONDITION_FLAG:
 #if !REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED
     case CONDITION_REGEX:
 #endif                  /* REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED */
         gtk_widget_hide(field_frame);
-
     default:
         break;
     }
 }                               /* end fe_typesmenu_cb() */
 
-
 typedef struct {
-    const gchar *normal_str, *negate_str;
+    const gchar * normal_str, *negate_str;
 } LabelDescs;
-static const LabelDescs simple_label =
-{
-    N_("One of the specified fields contains:"),
-    N_("None of the specified fields contains:")
-};
+static const LabelDescs simple_label = 
+{ N_("One of the specified fields contains:"),
+  N_("None of the specified fields contains:") };
 static const LabelDescs regex_label =
-{
-    N_("One of the regular expressions matches"),
-    N_("None of the regular expressions matches")
-};
-static const LabelDescs date_label =
-{
-    N_("Match when date is in the interval:"),
-    N_("Match when date is outside the interval:")
-};
-static const LabelDescs flags_label =
-{
-    N_("Match when one of these flags is set:"),
-    N_("Match when none of these flags is set:")
-};
-
-static void
-fe_update_label(GtkWidget        *label,
-                const LabelDescs *labels)
-{
+{ N_("One of the regular expressions matches"),
+  N_("None of the regular expressions matches") };
+static const LabelDescs date_label = 
+{ N_("Match when date is in the interval:"),
+  N_("Match when date is outside the interval:") };
+static const LabelDescs flags_label = 
+{ N_("Match when one of these flags is set:"),
+  N_("Match when none of these flags is set:") };
+
+static void 
+fe_update_label(GtkWidget* label, const LabelDescs* labels)
+{    
     gtk_label_set_text(GTK_LABEL(label),
-                       condition_not ?
+                       condition_not ? 
                        _(labels->negate_str) : _(labels->normal_str));
 }                      /* end fe_update_label */
 
-
 static void
 update_condition_list_label(void)
 {
@@ -383,9 +357,8 @@ update_condition_list_label(void)
     LibBalsaCondition *cond;
     gchar *filter_description;
 
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
         return;
-    }
 
     gtk_tree_model_get(model, &iter, 1, &cond, -1);
 
@@ -395,81 +368,66 @@ update_condition_list_label(void)
     g_free(filter_description);
 }                      /* end fe_update_condition_list_label */
 
-
 static ConditionMatchType
 get_condition_type(void)
 {
     /* Set the type associated with the selected item */
     return (ConditionMatchType)
-           fe_combo_box_get_value(fe_search_option_menu);
+        fe_combo_box_get_value(fe_search_option_menu);
 }
 
-
 /* fe_negate_condition :handle pressing on the "Contain/Does not
    Contain"... buttons */
 static void
-fe_negate_condition(GtkWidget *widget,
-                    gpointer   data)
+fe_negate_condition(GtkWidget * widget, gpointer data)
 {
     condition_not = !condition_not;
     switch (get_condition_type()) {
-    case CONDITION_STRING:
-        fe_update_label(fe_type_simple_label, &simple_label);
-        break;
-
-    case CONDITION_REGEX:
-        fe_update_label(fe_type_regex_label, &regex_label);
-        break;
-
-    case CONDITION_DATE:
-        fe_update_label(fe_type_date_label, &date_label);
-        break;
-
-    case CONDITION_FLAG:
-        fe_update_label(fe_type_flag_label, &flags_label);
-
+    case CONDITION_STRING: 
+        fe_update_label(fe_type_simple_label, &simple_label); break;
+    case CONDITION_REGEX:  
+        fe_update_label(fe_type_regex_label,  &regex_label);  break;
+    case CONDITION_DATE:   
+        fe_update_label(fe_type_date_label,   &date_label);   break;
+    case CONDITION_FLAG:   
+        fe_update_label(fe_type_flag_label,   &flags_label);
     case CONDITION_NONE:
     case CONDITION_AND:
     case CONDITION_OR:
         /* to avoid warnings */
-        break;
+       break;
     }
-    condition_has_changed = TRUE;
+    condition_has_changed=TRUE;
 }                      /* end fe_negate_condition */
 
-
 /* Callback to say that the condition is changing
  */
 static void
-fe_condition_changed_cb(GtkWidget *widget,
-                        gpointer   throwaway)
+fe_condition_changed_cb(GtkWidget * widget,gpointer throwaway)
 {
-    condition_has_changed = TRUE;
+    condition_has_changed=TRUE;
 }
 
-
 /*
  *  void fe_match_fields_buttons_cb(GtkWidget * widget, gpointer data)
  *
  * Callback for the "All"/"All headers" buttons for match fields selection
  */
 static void
-fe_match_fields_buttons_cb(GtkWidget *widget,
-                           gpointer   data)
+fe_match_fields_buttons_cb(GtkWidget * widget, gpointer data)
 {
-    gboolean active = GPOINTER_TO_INT(data) != 3;  /* 3== uncheck all buttons */
-
-    condition_has_changed = TRUE;
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_matching_fields_body), active);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_matching_fields_to), active);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_matching_fields_from), active);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_matching_fields_subject), active);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_matching_fields_cc), active);
+    gboolean active=GPOINTER_TO_INT(data)!=3;  /* 3== uncheck all buttons */
+
+    condition_has_changed=TRUE;
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_matching_fields_body),active);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_matching_fields_to),active);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_matching_fields_from),active);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_matching_fields_subject),active);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_matching_fields_cc),active);
 }                       /* end fe_match_fields_buttons_cb */
 
-
 static void
-fe_match_field_user_header_cb(GtkWidget *widget)
+fe_match_field_user_header_cb(GtkWidget * widget)
 {
     GtkToggleButton *button =
         GTK_TOGGLE_BUTTON(fe_matching_fields_us_head);
@@ -478,17 +436,14 @@ fe_match_field_user_header_cb(GtkWidget *widget)
     condition_has_changed = TRUE;
 }
 
-
 void
-fe_add_new_user_header(const gchar *str)
+fe_add_new_user_header(const gchar * str)
 {
     GList *lst;
 
-    for (lst = fe_user_headers_list; lst != NULL; lst = lst->next) {
-        if (g_ascii_strcasecmp(str, (gchar *) lst->data) == 0) {
+    for (lst = fe_user_headers_list; lst != NULL; lst = lst->next)
+        if (g_ascii_strcasecmp(str, (gchar *) lst->data) == 0)
             return;
-        }
-    }
 
     /* It's a new string, add it */
     fe_user_headers_list =
@@ -496,12 +451,11 @@ fe_add_new_user_header(const gchar *str)
                              (GCompareFunc) g_ascii_strcasecmp);
 }
 
-
 static void
-fe_user_header_set_active(const gchar *user_header)
+fe_user_header_set_active(const gchar * user_header)
 {
     if (user_header && *user_header) {
-        GList *lst;
+       GList *lst;
         gint i;
 
         for (lst = fe_user_headers_list, i = 0; lst; lst = lst->next, i++) {
@@ -513,44 +467,40 @@ fe_user_header_set_active(const gchar *user_header)
     }
 }
 
-
 static void
-fe_user_header_add(const gchar *user_header)
+fe_user_header_add(const gchar * user_header)
 {
     if (user_header && *user_header) {
         GList *lst;
 
         /* First clear the combo box... */
-        for (lst = fe_user_headers_list; lst; lst = lst->next) {
+        for (lst = fe_user_headers_list; lst; lst = lst->next)
             gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(fe_user_header),
                                       0);
-        }
 
         fe_add_new_user_header(user_header);
 
         /* ...then remake it with the new string... */
-        for (lst = fe_user_headers_list; lst; lst = lst->next) {
+        for (lst = fe_user_headers_list; lst; lst = lst->next)
             gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT
-                                               (fe_user_header), lst->data);
-        }
+                                           (fe_user_header), lst->data);
 
         fe_user_header_set_active(user_header);
     }
 }
 
-
 /* conditon_validate is responsible of validating
  * the changes to the current condition, according to the widgets
- * Performs sanity check on the widgets
+ * Performs sanity check on the widgets 
  * holding datas of the condition being edited
  * eg : you must provide at least one regex for regex condition,
  * a non empty match string for simple condition...
  * returns FALSE if condition is not valid, else returns TRUE
  */
 static gboolean
-condition_validate(LibBalsaCondition *new_cnd)
+condition_validate(LibBalsaCondition* new_cnd)
 {
-    gchar *str, *p;
+    gchar * str,* p;
     const gchar *c_str;
     gint row, col;
     struct tm date;
@@ -563,43 +513,38 @@ condition_validate(LibBalsaCondition *new_cnd)
 
     /* Sanity checks, prevent "empty" condition */
 
-    new_cnd->type = get_condition_type();
-    /* Retrieve matching fields only if they are meaningful
+    new_cnd->type=get_condition_type();
+    /* Retrieve matching fields only if they are meaningful 
        for the condition type */
-    if ((new_cnd->type != CONDITION_DATE) && (new_cnd->type != CONDITION_FLAG)) {
-        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fe_matching_fields_body))) {
-            CONDITION_SETMATCH(new_cnd, CONDITION_MATCH_BODY);
-        }
-        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fe_matching_fields_to))) {
-            CONDITION_SETMATCH(new_cnd, CONDITION_MATCH_TO);
-        }
-        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fe_matching_fields_subject))) {
-            CONDITION_SETMATCH(new_cnd, CONDITION_MATCH_SUBJECT);
-        }
-        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fe_matching_fields_from))) {
-            CONDITION_SETMATCH(new_cnd, CONDITION_MATCH_FROM);
-        }
-        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fe_matching_fields_cc))) {
-            CONDITION_SETMATCH(new_cnd, CONDITION_MATCH_CC);
-        }
+    if (new_cnd->type!=CONDITION_DATE && new_cnd->type!=CONDITION_FLAG) {
+        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fe_matching_fields_body)))
+            CONDITION_SETMATCH(new_cnd,CONDITION_MATCH_BODY);
+        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fe_matching_fields_to)))
+            CONDITION_SETMATCH(new_cnd,CONDITION_MATCH_TO);
+        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fe_matching_fields_subject)))
+            CONDITION_SETMATCH(new_cnd,CONDITION_MATCH_SUBJECT);
+        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fe_matching_fields_from)))
+            CONDITION_SETMATCH(new_cnd,CONDITION_MATCH_FROM);
+        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fe_matching_fields_cc)))
+            CONDITION_SETMATCH(new_cnd,CONDITION_MATCH_CC);
         if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fe_matching_fields_us_head))) {
-            CONDITION_SETMATCH(new_cnd, CONDITION_MATCH_US_HEAD);
+           CONDITION_SETMATCH(new_cnd,CONDITION_MATCH_US_HEAD);
             str =
                 gtk_editable_get_chars(GTK_EDITABLE
-                                           (gtk_bin_get_child
-                                               (GTK_BIN(fe_user_header))), 0, -1);
-            if (!str[0]) {
+                                       (gtk_bin_get_child
+                                        (GTK_BIN(fe_user_header))), 0, -1);
+           if (!str[0]) {
                 balsa_information(LIBBALSA_INFORMATION_ERROR,
                                   _("You must specify the name of the "
                                     "user header to match on"));
-                return FALSE;
-            }
-            if (gtk_combo_box_get_active(GTK_COMBO_BOX(fe_user_header)) < 0) {
-                /* User has changed the entry. */
-                fe_user_header_add(str);
-            }
-            g_free(str);
-        } else if (new_cnd->match.string.fields == CONDITION_EMPTY) {
+               return FALSE;
+           }
+            if (gtk_combo_box_get_active(GTK_COMBO_BOX(fe_user_header)) < 0)
+               /* User has changed the entry. */
+               fe_user_header_add(str);
+           g_free(str);
+       }
+        else if (new_cnd->match.string.fields==CONDITION_EMPTY) {
             balsa_information(LIBBALSA_INFORMATION_ERROR,
                               _("You must specify at least one "
                                 "field for matching"));
@@ -609,13 +554,12 @@ condition_validate(LibBalsaCondition *new_cnd)
     switch (new_cnd->type) {
     case CONDITION_STRING:
         c_str = gtk_entry_get_text(GTK_ENTRY(fe_type_simple_entry));
-        if (!c_str || (c_str[0] == '\0')) {
+        if (!c_str || c_str[0]=='\0') {
             balsa_information(LIBBALSA_INFORMATION_ERROR,
                               _("You must provide a string"));
             return FALSE;
         }
         break;
-
     case CONDITION_REGEX:
 #if REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED
         if (!gtk_tree_model_get_iter_first(model, &iter)) {
@@ -626,29 +570,28 @@ condition_validate(LibBalsaCondition *new_cnd)
         }
 #endif                  /* REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED */
         break;
-
     case CONDITION_DATE:
         c_str = gtk_entry_get_text(GTK_ENTRY(fe_type_date_low_entry));
-        if (c_str && (c_str[0] != '\0')) {
-            (void) strptime("00:00:00", "%T", &date);
-            p = (gchar *)strptime(c_str, "%x", &date);
-            if (!p || (*p != '\0')) {
+        if (c_str && c_str[0]!='\0') {
+            (void) strptime("00:00:00","%T",&date);
+            p=(gchar *)strptime(c_str,"%x",&date);
+            if (!p || *p!='\0') {
                 balsa_information(LIBBALSA_INFORMATION_ERROR,
                                   _("Low date is incorrect"));
                 return FALSE;
             }
-            new_cnd->match.date.date_low = mktime(&date);
+            new_cnd->match.date.date_low=mktime(&date);
         }
         c_str = gtk_entry_get_text(GTK_ENTRY(fe_type_date_high_entry));
-        if (c_str && (c_str[0] != '\0')) {
-            (void) strptime("23:59:59", "%T", &date);
-            p = (gchar *)strptime(c_str, "%x", &date);
-            if (!p || (*p != '\0')) {
+        if (c_str && c_str[0]!='\0') {
+            (void) strptime("23:59:59","%T",&date);
+            p=(gchar *)strptime(c_str,"%x",&date);
+            if (!p || *p!='\0') {
                 balsa_information(LIBBALSA_INFORMATION_ERROR,
                                   _("High date is incorrect"));
                 return FALSE;
             }
-            new_cnd->match.date.date_high = mktime(&date);
+            new_cnd->match.date.date_high=mktime(&date);
         }
         if (new_cnd->match.date.date_low >
             new_cnd->match.date.date_high) {
@@ -657,24 +600,22 @@ condition_validate(LibBalsaCondition *new_cnd)
             return FALSE;
         }
         break;
-
     case CONDITION_FLAG:
     case CONDITION_NONE:
     case CONDITION_AND:
     case CONDITION_OR:
         /* to avoid warnings */
-        break;
+       break;
     }
 
     /* Sanity checks OK, retrieve datas from widgets */
 
     new_cnd->negate = condition_not;
-    if (CONDITION_CHKMATCH(new_cnd, CONDITION_MATCH_US_HEAD)) {
+    if (CONDITION_CHKMATCH(new_cnd,CONDITION_MATCH_US_HEAD))
         new_cnd->match.string.user_header =
             gtk_editable_get_chars(GTK_EDITABLE
-                                       (gtk_bin_get_child
-                                           (GTK_BIN(fe_user_header))), 0, -1);
-    }
+                                   (gtk_bin_get_child
+                                    (GTK_BIN(fe_user_header))), 0, -1);
     /* Set the type specific fields of the condition */
     switch (new_cnd->type) {
     case CONDITION_STRING:
@@ -686,7 +627,7 @@ condition_validate(LibBalsaCondition *new_cnd)
 #if 0
         FIXME;
         do {
-            gchar *str;
+            gchar* str;
             gtk_tree_model_get(model, &iter, 0, &str, -1);
             new_reg = libbalsa_condition_regex_new();
             libbalsa_condition_regex_set(new_reg, str);
@@ -694,32 +635,25 @@ condition_validate(LibBalsaCondition *new_cnd)
         } while (gtk_tree_model_iter_next(model, &iter));
 #endif
         break;
-
     case CONDITION_DATE:
         break;
 
     case CONDITION_FLAG:
-        new_cnd->match.flags = 0;
-        for (row = 0; row < 2; row++) {
-            for (col = 0; col < 2; col++) {
-                new_cnd->match.flags |=
-                    gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fe_type_flag_buttons[row *
-                                                                                        2 +
-                                                                                        col])) ?
-                    1 << (row * 2 + col) : 0;
-            }
-        }
+        new_cnd->match.flags=0;
+        for (row=0;row<2;row++)
+            for (col=0;col<2;col++)
+                new_cnd->match.flags|=
+                    gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fe_type_flag_buttons[row*2+col])) ? 1 << 
(row*2+col): 0;
 
     case CONDITION_NONE:
     case CONDITION_AND: /*FIXME: verify this! */
     case CONDITION_OR:
         /* To avoid warnings :) */
-        break;
+       break;
     }
     return TRUE;
 }                        /* condition_validate*/
 
-
 static void
 clear_condition_widgets()
 {
@@ -728,16 +662,15 @@ clear_condition_widgets()
         gtk_tree_view_get_model(fe_type_regex_list);
 #endif                  /* REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED */
 
-    gtk_entry_set_text(GTK_ENTRY(fe_type_simple_entry), "");
+    gtk_entry_set_text(GTK_ENTRY(fe_type_simple_entry),"");
 #if REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED
-    gtk_entry_set_text(GTK_ENTRY(fe_type_regex_entry), "");
+    gtk_entry_set_text(GTK_ENTRY(fe_type_regex_entry),"");          
     gtk_list_store_clear(GTK_LIST_STORE(model));
 #endif                  /* REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED */
-    gtk_entry_set_text(GTK_ENTRY(fe_type_date_low_entry), "");
-    gtk_entry_set_text(GTK_ENTRY(fe_type_date_high_entry), "");
+    gtk_entry_set_text(GTK_ENTRY(fe_type_date_low_entry),"");
+    gtk_entry_set_text(GTK_ENTRY(fe_type_date_high_entry),"");
 }
 
-
 /* set_button_sensitivities:
  *
  * We want the `apply' and `revert' buttons to be sensitive only when
@@ -774,13 +707,12 @@ set_button_sensitivities(gboolean sensitive)
     gtk_widget_set_sensitive(fe_op_codes_option_menu, n_conditions > 1);
 }
 
-
 /* fill_condition_widget : Fill all widget according to condition data
    fields
- */
+*/
 
 static void
-fill_condition_widgets(LibBalsaCondition *cnd)
+fill_condition_widgets(LibBalsaCondition* cnd)
 {
 #if REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED
     GtkTreeModel *model =
@@ -788,20 +720,18 @@ fill_condition_widgets(LibBalsaCondition *cnd)
 #endif                  /* REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED */
     gchar *str;
     GDateTime *date;
-    gint row, col;
+    gint row,col;
     gboolean andmask;
     static gchar xformat[] = "%x"; /* to suppress error in strftime */
-
-    condition_not = cnd->negate;
+    
+    condition_not=cnd->negate;
     /* Clear all widgets */
-    if (cnd->type != CONDITION_STRING) {
-        gtk_entry_set_text(GTK_ENTRY(fe_type_simple_entry), "");
-    }
+    if (cnd->type!=CONDITION_STRING)
+        gtk_entry_set_text(GTK_ENTRY(fe_type_simple_entry),"");
 
 #if REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED
-    if (cnd->type != CONDITION_REGEX) {
-        gtk_entry_set_text(GTK_ENTRY(fe_type_regex_entry), "");
-    }
+    if (cnd->type!=CONDITION_REGEX)
+        gtk_entry_set_text(GTK_ENTRY(fe_type_regex_entry),"");      
 
     gtk_list_store_clear(GTK_LIST_STORE(model));
 #endif                  /* REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED */
@@ -814,37 +744,37 @@ fill_condition_widgets(LibBalsaCondition *cnd)
 
     /* First update matching fields
      * but if type is date or flag, these are meaning less so we disable them */
-    andmask = (cnd->type != CONDITION_FLAG && cnd->type != CONDITION_DATE);
+    andmask = (cnd->type!=CONDITION_FLAG && cnd->type!=CONDITION_DATE);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_matching_fields_body),
-                                 CONDITION_CHKMATCH(cnd, CONDITION_MATCH_BODY) && andmask);
+                                 CONDITION_CHKMATCH(cnd,CONDITION_MATCH_BODY) && andmask);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_matching_fields_to),
-                                 CONDITION_CHKMATCH(cnd, CONDITION_MATCH_TO) && andmask);
+                                 CONDITION_CHKMATCH(cnd,CONDITION_MATCH_TO) && andmask);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_matching_fields_from),
-                                 CONDITION_CHKMATCH(cnd, CONDITION_MATCH_FROM) && andmask);
+                                 CONDITION_CHKMATCH(cnd,CONDITION_MATCH_FROM) && andmask);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_matching_fields_subject),
-                                 CONDITION_CHKMATCH(cnd, CONDITION_MATCH_SUBJECT) && andmask);
+                                 CONDITION_CHKMATCH(cnd,CONDITION_MATCH_SUBJECT) && andmask);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_matching_fields_cc),
-                                 CONDITION_CHKMATCH(cnd, CONDITION_MATCH_CC) && andmask);
+                                 CONDITION_CHKMATCH(cnd,CONDITION_MATCH_CC) && andmask);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_matching_fields_us_head),
-                                 CONDITION_CHKMATCH(cnd, CONDITION_MATCH_US_HEAD) && andmask);
-    if (CONDITION_CHKMATCH(cnd, CONDITION_MATCH_US_HEAD) && andmask) {
-        gtk_widget_set_sensitive(fe_user_header, TRUE);
-        fe_user_header_set_active(cnd->match.string.user_header);
-    } else {
-        gtk_widget_set_sensitive(fe_user_header, FALSE);
+                                 CONDITION_CHKMATCH(cnd,CONDITION_MATCH_US_HEAD) && andmask);
+    if (CONDITION_CHKMATCH(cnd,CONDITION_MATCH_US_HEAD) && andmask) {
+       gtk_widget_set_sensitive(fe_user_header, TRUE);
+       fe_user_header_set_active(cnd->match.string.user_header);
+    }
+    else {
+       gtk_widget_set_sensitive(fe_user_header,FALSE);
         gtk_entry_set_text(GTK_ENTRY
-                               (gtk_bin_get_child(GTK_BIN(fe_user_header))),
+                           (gtk_bin_get_child(GTK_BIN(fe_user_header))),
                            "");
-    }
+    }  
     /* Next update type specific fields */
     switch (cnd->type) {
     case CONDITION_STRING:
         gtk_entry_set_text(GTK_ENTRY(fe_type_simple_entry),
-                           cnd->match.string.string
+                           cnd->match.string.string 
                            ? cnd->match.string.string : "");
         fe_update_label(fe_type_simple_label, &simple_label);
         break;
-
     case CONDITION_REGEX:
 #if 0
         FIXME;
@@ -852,67 +782,56 @@ fill_condition_widgets(LibBalsaCondition *cnd)
             gtk_list_store_prepend(GTK_LIST_STORE(model), &iter);
             gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0,
                                libbalsa_condition_regex_get
-                                   ((LibBalsaConditionRegex *) regex->data),
+                               ((LibBalsaConditionRegex *) regex->data),
                                -1);
         }
         if (cnd->match.regexs) {
             /* initially, select first regex */
             gtk_tree_selection_select_iter(selection, &iter);
-        } else {
+        } else
             gtk_widget_set_sensitive(fe_regex_remove_button, FALSE);
-        }
         fe_update_label(fe_type_regex_label, &regex_label);
 #endif
         break;
-
     case CONDITION_DATE:
-        if (cnd->match.date.date_low == 0) {
-            str = g_strdup("");
-        } else {
-            date = g_date_time_new_from_unix_local(cnd->match.date.date_low);
+        if (cnd->match.date.date_low==0) str = g_strdup("");
+        else {
+               date = g_date_time_new_from_unix_local(cnd->match.date.date_low);
             str = g_date_time_format(date, xformat);
             g_date_time_unref(date);
         }
-        gtk_entry_set_text(GTK_ENTRY(fe_type_date_low_entry), str);
+        gtk_entry_set_text(GTK_ENTRY(fe_type_date_low_entry),str);
         g_free(str);
-        if (cnd->match.date.date_high == 0) {
-            str = g_strdup("");
-        } else {
-            date = g_date_time_new_from_unix_local(cnd->match.date.date_low);
+        if (cnd->match.date.date_high==0) str = g_strdup("");
+        else {
+               date = g_date_time_new_from_unix_local(cnd->match.date.date_low);
             str = g_date_time_format(date, xformat);
             g_date_time_unref(date);
         }
-        gtk_entry_set_text(GTK_ENTRY(fe_type_date_high_entry), str);
+        gtk_entry_set_text(GTK_ENTRY(fe_type_date_high_entry),str);
         g_free(str);
         fe_update_label(fe_type_date_label, &date_label);
         break;
-
     case CONDITION_FLAG:
-        for (row = 0; row < 2; row++) {
-            for (col = 0; col < 2; col++) {
-                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_type_flag_buttons[row * 2 +
-                                                                                    col]),
-                                             cnd->match.flags & (1 << (row * 2 + col)));
-            }
-        }
-        fe_update_label(fe_type_flag_label, &flags_label);
+        for (row=0;row<2;row++)
+            for (col=0;col<2;col++)
+                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_type_flag_buttons[row*2+col]),
+                                             cnd->match.flags & (1 << (row*2+col)));
+        fe_update_label(fe_type_flag_label,   &flags_label);
         break;
-
     case CONDITION_NONE:
     case CONDITION_AND:
     case CONDITION_OR:
         /* To avoid warnings :), we should never get there */
-        break;
+       break;
     }
     gtk_combo_box_set_active(GTK_COMBO_BOX(fe_search_option_menu),
                              cnd->type - 1);
 }            /* end fill_condition_widget */
 
-
 static void
-condition_dialog_response(GtkWidget *dialog,
-                          gint       response,
-                          gpointer   throwaway)
+condition_dialog_response(GtkWidget * dialog, gint response,
+                          gpointer throwaway)
 {
     LibBalsaCondition *new_cnd;
     GError *err = NULL;
@@ -954,7 +873,7 @@ condition_dialog_response(GtkWidget *dialog,
                 gtk_widget_set_sensitive(fe_condition_edit_button, TRUE);
                 gtk_widget_set_sensitive(fe_op_codes_option_menu,
                                          gtk_tree_model_iter_n_children
-                                             (model, NULL) > 1);
+                                         (model, NULL) > 1);
             }
             /* Associate the new condition to the row in the list */
             gtk_list_store_set(GTK_LIST_STORE(model), &iter, 1, new_cnd,
@@ -964,57 +883,46 @@ condition_dialog_response(GtkWidget *dialog,
 
             set_button_sensitivities(TRUE);
         }
-
     case GTK_RESPONSE_CANCEL:   /* Cancel button */
     case GTK_RESPONSE_NONE:     /* Window close */
         /* we only hide it because it is too expensive to destroy and
            rebuild each time */
         gtk_widget_hide(dialog);
         break;
-
     case GTK_RESPONSE_HELP:     /* Help button */
         gtk_show_uri_on_window(GTK_WINDOW(dialog),
                                "help:balsa/win-filters#win-condition",
                                gtk_get_current_event_time(), &err);
-        if (err) {
-            balsa_information_parented(GTK_WINDOW(dialog),
-                                       LIBBALSA_INFORMATION_WARNING,
-                                       _("Error displaying condition help: %s\n"),
-                                       err->message);
-            g_error_free(err);
-        }
-        break;
+       if (err) {
+           balsa_information_parented(GTK_WINDOW(dialog),
+                   LIBBALSA_INFORMATION_WARNING,
+                   _("Error displaying condition help: %s\n"),
+                   err->message);
+           g_error_free(err);
+       }
+       break;
     }
     gtk_widget_set_sensitive(fe_window, TRUE);
 }
 
-
 /* build_type_notebook() builds the notebook containing one page for each
  * condition type (simple, regex, date, flag)
  */
 static void
-add_button(GtkWidget  *grid,
-           const char *label,
-           int         col,
-           GCallback   action,
-           int         p)
+add_button(GtkWidget *grid, const char *label, int col,
+           GCallback action, int p)
 {
-    GtkWidget *button = gtk_button_new_with_mnemonic(label);
+    GtkWidget* button = gtk_button_new_with_mnemonic(label);
     gtk_widget_set_hexpand(button, TRUE);
     gtk_grid_attach(GTK_GRID(grid), button, col, 4, 1, 1);
     g_signal_connect(G_OBJECT(button), "clicked",
                      action,
                      GINT_TO_POINTER(p));
 }
-
-
-static GtkWidget *
-add_check(GtkWidget  *grid,
-          const char *label,
-          int         col,
-          int         row)
+static GtkWidget*
+add_check(GtkWidget *grid, const char *label, int col, int row)
 {
-    GtkWidget *res = gtk_check_button_new_with_mnemonic(label);
+    GtkWidget* res = gtk_check_button_new_with_mnemonic(label);
     gtk_widget_set_hexpand(res, TRUE);
     gtk_grid_attach(GTK_GRID(grid), res, col, row, 1, 1);
     g_signal_connect(G_OBJECT(res), "toggled",
@@ -1022,8 +930,7 @@ add_check(GtkWidget  *grid,
     return res;
 }
 
-
-static GtkWidget *
+static GtkWidget*
 get_field_frame(void)
 {
     GtkWidget *grid;
@@ -1041,14 +948,14 @@ get_field_frame(void)
 
     gtk_container_add(GTK_CONTAINER(frame), grid);
 
-    add_button(grid, _("_All"), 0, G_CALLBACK(fe_match_fields_buttons_cb), 1);
-    add_button(grid, _("C_lear"), 1, G_CALLBACK(fe_match_fields_buttons_cb), 3);
+    add_button(grid, _("_All"),  0,G_CALLBACK(fe_match_fields_buttons_cb),1);
+    add_button(grid, _("C_lear"),1,G_CALLBACK(fe_match_fields_buttons_cb),3);
 
-    fe_matching_fields_body = add_check(grid, _("_Body"), 0, 0);
-    fe_matching_fields_to = add_check(grid, _("_To:"), 0, 1);
-    fe_matching_fields_from = add_check(grid, _("_From:"), 1, 1);
-    fe_matching_fields_subject = add_check(grid, _("_Subject"), 0, 2);
-    fe_matching_fields_cc = add_check(grid, _("_CC:"), 1, 2);
+    fe_matching_fields_body    = add_check(grid, _("_Body"),    0,0);
+    fe_matching_fields_to      = add_check(grid, _("_To:"),     0,1);
+    fe_matching_fields_from    = add_check(grid, _("_From:"),   1,1);
+    fe_matching_fields_subject = add_check(grid, _("_Subject"), 0,2);
+    fe_matching_fields_cc      = add_check(grid, _("_CC:"),     1,2);
     fe_matching_fields_us_head =
         gtk_check_button_new_with_mnemonic(_("_User header:"));
     gtk_widget_set_hexpand(fe_matching_fields_us_head, TRUE);
@@ -1057,10 +964,9 @@ get_field_frame(void)
                      G_CALLBACK(fe_match_field_user_header_cb), NULL);
 
     fe_user_header = gtk_combo_box_text_new_with_entry();
-    for (list = fe_user_headers_list; list; list = list->next) {
+    for (list = fe_user_headers_list; list; list = list->next)
         gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(fe_user_header),
                                        list->data);
-    }
     g_signal_connect(G_OBJECT(fe_user_header), "changed",
                      G_CALLBACK(fe_condition_changed_cb), NULL);
     gtk_widget_set_hexpand(fe_user_header, TRUE);
@@ -1068,11 +974,10 @@ get_field_frame(void)
     return frame;
 }
 
-
 static void
 build_type_notebook()
 {
-    GtkWidget *page, *frame;
+    GtkWidget *page,*frame;
 #if REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED
     GtkWidget *scroll;
 #else                   /* REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED */
@@ -1081,11 +986,9 @@ build_type_notebook()
 #endif                  /* REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED */
     GtkWidget *box;
     GtkWidget *button, *grid;
-    gint row, col;
-    static gchar *flag_names[] =
-    {
-        N_("Unread"), N_("Deleted"), N_("Replied"), N_("Flagged")
-    };
+    gint row,col;
+    static gchar * flag_names[]=
+        {N_("Unread"), N_("Deleted"), N_("Replied"), N_("Flagged")};
 
     /* The notebook */
 
@@ -1104,8 +1007,8 @@ build_type_notebook()
     gtk_widget_set_vexpand(grid, TRUE);
     gtk_box_pack_start(GTK_BOX(box), grid);
 
-    fe_type_simple_label =
-        gtk_label_new_with_mnemonic(_("One of the specified f_ields contains"));
+    fe_type_simple_label = 
+       gtk_label_new_with_mnemonic(_("One of the specified f_ields contains"));
     gtk_widget_set_hexpand(fe_type_simple_label, TRUE);
     gtk_grid_attach(GTK_GRID(grid), fe_type_simple_label, 0, 0, 1, 1);
     fe_type_simple_entry = gtk_entry_new();
@@ -1114,7 +1017,7 @@ build_type_notebook()
     gtk_widget_set_hexpand(fe_type_simple_entry, TRUE);
     gtk_grid_attach(GTK_GRID(grid), fe_type_simple_entry, 0, 1, 1, 1);
     gtk_label_set_mnemonic_widget(GTK_LABEL(fe_type_simple_label),
-                                  fe_type_simple_entry);
+                                 fe_type_simple_entry);
 
     button = gtk_button_new_with_mnemonic(_("Contain/Does _Not Contain"));
     g_signal_connect(G_OBJECT(button), "clicked",
@@ -1123,7 +1026,7 @@ build_type_notebook()
     gtk_grid_attach(GTK_GRID(grid), button, 0, 2, 1, 1);
 
     gtk_notebook_append_page(GTK_NOTEBOOK(fe_type_notebook), box, NULL);
-
+    
     /* The regex page of the type notebook */
     box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
     g_object_set(box, "margin", 5, NULL);
@@ -1135,7 +1038,7 @@ build_type_notebook()
     gtk_widget_set_vexpand(page, TRUE);
     gtk_box_pack_start(GTK_BOX(box), page);
 
-    fe_type_regex_label =
+    fe_type_regex_label = 
         gtk_label_new_with_mnemonic(_("_One of the regular expressions matches"));
     gtk_table_attach(GTK_TABLE(page),
                      fe_type_regex_label,
@@ -1246,32 +1149,29 @@ build_type_notebook()
 
     gtk_container_add(GTK_CONTAINER(frame), page);
 
-    for (row = 0; row < 2; row++) {
-        for (col = 0; col < 2; col++) {
+    for (row=0;row<2;row++)
+        for (col=0;col<2;col++) {
             button =
-                gtk_check_button_new_with_label(_(flag_names[row * 2 + col]));
-            fe_type_flag_buttons[row * 2 + col] = button;
+                gtk_check_button_new_with_label(_(flag_names[row*2+col]));
+            fe_type_flag_buttons[row*2+col] = button;
             gtk_widget_set_hexpand(button, TRUE);
             g_signal_connect(button, "toggled",
                              G_CALLBACK(fe_condition_changed_cb), NULL);
             gtk_grid_attach(GTK_GRID(page), button, col, row, 1, 1);
         }
-    }
     button = gtk_button_new_with_label(_("Match when one flag is set/when no flag is set"));
     gtk_widget_set_hexpand(button, TRUE);
     g_signal_connect(G_OBJECT(button), "clicked",
                      G_CALLBACK(fe_negate_condition), NULL);
     gtk_grid_attach(GTK_GRID(page),
-                    button,
-                    0, 2, 2, 1);
+                     button,
+                     0, 2, 2, 1);
 }                               /* end build_type_notebook() */
 
-
 static
-void
-build_condition_dialog(GtkWidget *condition_dialog)
+void build_condition_dialog(GtkWidget * condition_dialog)
 {
-    GtkWidget *label, *box;
+    GtkWidget *label,* box;
     GtkWidget *field_frame = get_field_frame();
     GtkBox *content_box;
 
@@ -1298,7 +1198,6 @@ build_condition_dialog(GtkWidget *condition_dialog)
     gtk_box_pack_start(content_box, fe_type_notebook);
 }
 
-
 /*
  * fe_edit_condition is the callback to edit command for conditions
  * this is done popping a dialog
@@ -1306,21 +1205,20 @@ build_condition_dialog(GtkWidget *condition_dialog)
  */
 
 void
-fe_edit_condition(GtkWidget *throwaway,
-                  gpointer   is_new_cnd)
+fe_edit_condition(GtkWidget * throwaway,gpointer is_new_cnd)
 {
-    static GtkWidget *condition_dialog;
+    static GtkWidget * condition_dialog;
     GtkTreeModel *model;
     GtkTreeIter iter;
     GtkTreeSelection *selection =
         gtk_tree_view_get_selection(fe_filters_list);
     gboolean filter_selected =
         gtk_tree_selection_get_selected(selection, &model, &iter);
-    gchar *title;
+    gchar * title;
     LibBalsaCondition *cnd = NULL;
     LibBalsaFilter *fil;
 
-    is_new_condition = GPOINTER_TO_INT(is_new_cnd);
+    is_new_condition=GPOINTER_TO_INT(is_new_cnd);
 
     if (!is_new_condition) {
         GtkTreeSelection *cond_selection =
@@ -1330,20 +1228,17 @@ fe_edit_condition(GtkWidget *throwaway,
 
         if (!filter_selected
             || !gtk_tree_selection_get_selected(cond_selection,
-                                                &cond_model, &cond_iter)) {
+                                                &cond_model, &cond_iter))
             return;
-        }
 
         gtk_tree_model_get(cond_model, &cond_iter, 1, &cnd, -1);
         condition_has_changed = FALSE;
-    } else {
-        /* This a new condition, we set condition_has_changed to TRUE to force validation and
-           replacement*/
+    } else
+    /* This a new condition, we set condition_has_changed to TRUE to force validation and replacement*/
         condition_has_changed = TRUE;
-    }
     /* We construct the dialog box if it wasn't done before */
     if (!condition_dialog) {
-        condition_dialog =
+        condition_dialog=
             gtk_dialog_new_with_buttons("",
                                         GTK_WINDOW(fe_window),
                                         GTK_DIALOG_DESTROY_WITH_PARENT |
@@ -1353,10 +1248,10 @@ fe_edit_condition(GtkWidget *throwaway,
                                         _("_Help"), GTK_RESPONSE_HELP,
                                         NULL);
 #if HAVE_MACOSX_DESKTOP
-        libbalsa_macosx_menu_for_parent(condition_dialog, GTK_WINDOW(fe_window));
+       libbalsa_macosx_menu_for_parent(condition_dialog, GTK_WINDOW(fe_window));
 #endif
         g_object_add_weak_pointer(G_OBJECT(condition_dialog),
-                                  (gpointer) & condition_dialog);
+                                  (gpointer) &condition_dialog);
 
         g_signal_connect(G_OBJECT(condition_dialog), "response",
                          G_CALLBACK(condition_dialog_response), NULL);
@@ -1365,35 +1260,28 @@ fe_edit_condition(GtkWidget *throwaway,
     }
     gtk_tree_model_get(model, &iter, 1, &fil, -1);
     title = g_strconcat(_("Edit condition for filter: "), fil->name, NULL);
-    gtk_window_set_title(GTK_WINDOW(condition_dialog), title);
+    gtk_window_set_title(GTK_WINDOW(condition_dialog),title);
     g_free(title);
     /* We fire the dialog box */
     gtk_widget_set_sensitive(fe_window, FALSE);
     gtk_widget_show(condition_dialog);
-    if (cnd) {
-        fill_condition_widgets(cnd);
-    } else {
-        clear_condition_widgets();
-    }
+    if (cnd) fill_condition_widgets(cnd);
+    else clear_condition_widgets();
 }
 
-
 /* fe_conditions_row_activated : update all widget when a condition
  * is activated
  */
 void
-fe_conditions_row_activated(GtkTreeView       *treeview,
-                            GtkTreePath       *path,
-                            GtkTreeViewColumn *column,
-                            gpointer           data)
+fe_conditions_row_activated(GtkTreeView * treeview, GtkTreePath * path,
+                            GtkTreeViewColumn * column, gpointer data)
+
 {
-    fe_edit_condition(NULL, GINT_TO_POINTER(0));
+    fe_edit_condition(NULL,GINT_TO_POINTER(0));
 }
 
-
 void
-fe_condition_remove_pressed(GtkWidget *widget,
-                            gpointer   data)
+fe_condition_remove_pressed(GtkWidget * widget, gpointer data)
 {
     GtkTreeSelection *selection =
         gtk_tree_view_get_selection(fe_conditions_list);
@@ -1401,10 +1289,9 @@ fe_condition_remove_pressed(GtkWidget *widget,
     GtkTreeIter iter;
     LibBalsaCondition *cond;
     GtkTreePath *path;
-
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
+    
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
         return;
-    }
 
     gtk_tree_model_get(model, &iter, 1, &cond, -1);
     libbalsa_condition_unref(cond);
@@ -1416,19 +1303,17 @@ fe_condition_remove_pressed(GtkWidget *widget,
     if (gtk_tree_model_get_iter(model, &iter, path)
         || gtk_tree_path_prev(path)) {
         gtk_tree_selection_select_path(selection, path);
-        if (gtk_tree_model_iter_n_children(model, NULL) == 1) {
+        if (gtk_tree_model_iter_n_children(model, NULL) == 1)
             gtk_widget_set_sensitive(fe_op_codes_option_menu, FALSE);
-        }
     } else {
         /* ...or reset the buttons if the list is empty. */
-        gtk_widget_set_sensitive(fe_condition_delete_button, FALSE);
-        gtk_widget_set_sensitive(fe_condition_edit_button, FALSE);
+        gtk_widget_set_sensitive(fe_condition_delete_button,FALSE);
+        gtk_widget_set_sensitive(fe_condition_edit_button,FALSE);
     }
     gtk_tree_path_free(path);
     set_button_sensitivities(TRUE);
 }
 
-
 /**************** Filters ****************************/
 
 /*
@@ -1437,10 +1322,8 @@ fe_condition_remove_pressed(GtkWidget *widget,
  * and to invalidate previously constructed list of filters, to force reloading
  */
 static gboolean
-update_filters_mailbox(GtkTreeModel *model,
-                       GtkTreePath  *path,
-                       GtkTreeIter  *iter,
-                       gpointer      data)
+update_filters_mailbox(GtkTreeModel * model, GtkTreePath * path,
+                      GtkTreeIter * iter, gpointer data)
 {
     BalsaMailboxNode *mbnode;
     LibBalsaMailbox *mailbox;
@@ -1449,102 +1332,93 @@ update_filters_mailbox(GtkTreeModel *model,
     gtk_tree_model_get(model, iter, 0, &mbnode, -1);
     mailbox = mbnode->mailbox;
     g_object_unref(mbnode);
-    if (!mailbox) {
-        return FALSE;
-    }
+    if (!mailbox)
+       return FALSE;
 
     /* First we free the filters list (which is now obsolete) */
     libbalsa_clear_slist(&mailbox->filters, g_free);
     /* Second we replace old filters name by the new ones
      * Note : deleted filters are also removed */
-    if (!filters_names_changes) {
-        return FALSE;
-    }
+    if (!filters_names_changes)
+       return FALSE;
     tmp = mailbox_filters_section_lookup(mailbox->url ?
-                                         mailbox->url : mailbox->name);
+                                        mailbox->url : mailbox->name);
     if (tmp) {
-        gchar **filters_names = NULL;
-        gboolean def;
-        gint nb_filters;
-
-        libbalsa_conf_push_group(tmp);
-        libbalsa_conf_get_vector_with_default(MAILBOX_FILTERS_KEY,
-                                              &nb_filters, &filters_names,
-                                              &def);
-        if (!def) {
-            gint i;
-            GList *lst;
-
-            for (i = 0; i < nb_filters; ) {
-                for (lst = filters_names_changes;
-                     lst &&
-                     strcmp(((filters_names_rec *) lst->data)->old_name,
-                            filters_names[i]) != 0;
-                     lst = lst->next) {
-                }
-
-                if (lst) {
-                    g_free(filters_names[i]);
-                    if (((filters_names_rec *) lst->data)->new_name) {
-                        /* Name changing */
-                        filters_names[i++] =
-                            g_strdup(((filters_names_rec *) lst->data)->
-                                     new_name);
-                    } else {
-                        /* Name removing */
-                        gint j;
-
-                        for (j = i; j < nb_filters - 1; j++) {
-                            filters_names[j] = filters_names[j + 1];
-                        }
-                        /* We put NULL to be sure that
-                         * g_strfreev does not free already
-                         * freed memory. */
-                        filters_names[--nb_filters] = NULL;
-                    }
-                } else {
-                    i++;
-                }
-            }
-        }
-
-        if (nb_filters) {
-            libbalsa_conf_set_vector(MAILBOX_FILTERS_KEY, nb_filters,
-                                     (const gchar **) filters_names);
-            libbalsa_conf_pop_group();
-        } else {
-            libbalsa_conf_pop_group();
-            libbalsa_conf_remove_group(tmp);
-        }
-        g_strfreev(filters_names);
-        g_free(tmp);
+       gchar **filters_names = NULL;
+       gboolean def;
+       gint nb_filters;
+
+       libbalsa_conf_push_group(tmp);
+       libbalsa_conf_get_vector_with_default(MAILBOX_FILTERS_KEY,
+                                            &nb_filters, &filters_names,
+                                            &def);
+       if (!def) {
+           gint i;
+           GList *lst;
+
+           for (i = 0; i < nb_filters;) {
+               for (lst = filters_names_changes;
+                    lst &&
+                    strcmp(((filters_names_rec *) lst->data)->old_name,
+                           filters_names[i]) != 0;
+                    lst = lst->next);
+
+               if (lst) {
+                   g_free(filters_names[i]);
+                   if (((filters_names_rec *) lst->data)->new_name) {
+                       /* Name changing */
+                       filters_names[i++] =
+                           g_strdup(((filters_names_rec *) lst->data)->
+                                    new_name);
+                   } else {
+                       /* Name removing */
+                       gint j;
+
+                       for (j = i; j < nb_filters - 1; j++)
+                           filters_names[j] = filters_names[j + 1];
+                       /* We put NULL to be sure that
+                        * g_strfreev does not free already
+                        * freed memory. */
+                       filters_names[--nb_filters] = NULL;
+                   }
+               } else
+                   i++;
+           }
+       }
+
+       if (nb_filters) {
+           libbalsa_conf_set_vector(MAILBOX_FILTERS_KEY, nb_filters,
+                                   (const gchar **) filters_names);
+           libbalsa_conf_pop_group();
+       } else {
+           libbalsa_conf_pop_group();
+           libbalsa_conf_remove_group(tmp);
+       }
+       g_strfreev(filters_names);
+       g_free(tmp);
     }
 
     return FALSE;
 }
 
-
 /* Destroy callback : do all needed clean-ups
  * FIXME : be sure no more destruction is needed
  */
 
-void
-fe_destroy_window_cb(GtkWidget *widget,
-                     gpointer   throwaway)
+void fe_destroy_window_cb(GtkWidget * widget,gpointer throwaway)
 {
-    GList *lst;
-
+    GList * lst;
+    
     /* We clear the current edited conditions list */
     fe_free_associated_conditions();
 
     /* On OK button press we have set "balsa-ok-button"
      * thus we don't free filters in this case */
-    if (g_object_get_data(G_OBJECT(fe_filters_list), "balsa-ok-button")) {
+    if (g_object_get_data(G_OBJECT(fe_filters_list), "balsa-ok-button"))
         g_object_set_data(G_OBJECT(fe_filters_list), "balsa-ok-button",
                           NULL);
-    } else {
+    else
         fe_free_associated_filters();
-    }
 
     for (lst = filters_names_changes; lst != NULL; lst = lst->next) {
         g_free(((filters_names_rec *)lst->data)->old_name);
@@ -1558,10 +1432,9 @@ fe_destroy_window_cb(GtkWidget *widget,
     /* free all strings in fe_user_headers_list */
     libbalsa_clear_list(&fe_user_headers_list, g_free);
 
-    fe_already_open = FALSE;
+    fe_already_open=FALSE;
 }
 
-
 /*
  * fe_dialog_response()
  *
@@ -1569,9 +1442,7 @@ fe_destroy_window_cb(GtkWidget *widget,
  * bottom of the dialog.  wooo.
  */
 void
-fe_dialog_response(GtkWidget *dialog,
-                   gint       response,
-                   gpointer   data)
+fe_dialog_response(GtkWidget * dialog, gint response, gpointer data)
 {
     GtkTreeModel *model =
         gtk_tree_view_get_model(fe_filters_list);
@@ -1582,21 +1453,20 @@ fe_dialog_response(GtkWidget *dialog,
     switch (response) {
     case GTK_RESPONSE_OK:       /* OK button */
         /* We clear the old filters */
-        libbalsa_filter_clear_filters(balsa_app.filters, TRUE);
-        balsa_app.filters = NULL;
+        libbalsa_filter_clear_filters(balsa_app.filters,TRUE);
+        balsa_app.filters=NULL;
 
         /* We put the modified filters */
-        for (valid = gtk_tree_model_get_iter_first(model, &iter); valid;
-             valid = gtk_tree_model_iter_next(model, &iter)) {
+    for (valid = gtk_tree_model_get_iter_first(model, &iter); valid;
+         valid = gtk_tree_model_iter_next(model, &iter)) {
             LibBalsaFilter *fil;
 
             gtk_tree_model_get(model, &iter, 1, &fil, -1);
-            if (fil->condition) {
+            if (fil->condition)
                 balsa_app.filters = g_slist_prepend(balsa_app.filters, fil);
-            } else {
+            else
                 libbalsa_information(LIBBALSA_INFORMATION_WARNING,
                                      _("Filter with no condition was omitted"));
-            }
         }
 
         /* Tell the clean-up functions not to free
@@ -1605,9 +1475,9 @@ fe_dialog_response(GtkWidget *dialog,
                           GINT_TO_POINTER(TRUE));
 
         /* Update mailboxes filters */
-        gtk_tree_model_foreach(GTK_TREE_MODEL(balsa_app.mblist_tree_store),
-                               (GtkTreeModelForeachFunc)
-                               update_filters_mailbox, NULL);
+       gtk_tree_model_foreach(GTK_TREE_MODEL(balsa_app.mblist_tree_store),
+                              (GtkTreeModelForeachFunc)
+                              update_filters_mailbox, NULL);
 
         config_filters_save();
 
@@ -1618,16 +1488,16 @@ fe_dialog_response(GtkWidget *dialog,
 
     case GTK_RESPONSE_HELP:     /* Help button */
         gtk_show_uri_on_window(GTK_WINDOW(dialog), "help:balsa/win-filters",
-                               gtk_get_current_event_time(), &err);
+                                   gtk_get_current_event_time(), &err);
 
-        if (err) {
-            balsa_information_parented(GTK_WINDOW(dialog),
-                                       LIBBALSA_INFORMATION_WARNING,
-                                       _("Error displaying filter help: %s\n"),
-                                       err->message);
-            g_error_free(err);
-        }
-        break;
+       if (err) {
+           balsa_information_parented(GTK_WINDOW(dialog),
+                   LIBBALSA_INFORMATION_WARNING,
+                   _("Error displaying filter help: %s\n"),
+                   err->message);
+           g_error_free(err);
+       }
+       break;
 
     default:
         /* we should NEVER get here */
@@ -1635,15 +1505,13 @@ fe_dialog_response(GtkWidget *dialog,
     }
 }                       /* end fe_dialog_response */
 
-
 /*
  * fe_action_selected()
  *
  * Callback for the "Action" option menu
- */
+ */ 
 void
-fe_action_selected(GtkWidget *widget,
-                   gpointer   data)
+fe_action_selected(GtkWidget * widget, gpointer data)
 {
     FilterActionType type =
         (FilterActionType) fe_combo_box_get_value(widget);
@@ -1659,23 +1527,19 @@ fe_action_selected(GtkWidget *widget,
     set_button_sensitivities(TRUE);
 }                       /* end fe_action_selected() */
 
-
 /*
  * fe_button_toggled()
  *
  * Callback for the "toggled" signal of the action buttons.
  */
 static void
-fe_button_toggled_func(GtkWidget *child,
-                       gpointer   active)
+fe_button_toggled_func(GtkWidget * child, gpointer active)
 {
     gtk_widget_set_sensitive(child, GPOINTER_TO_INT(active));
 }
 
-
 void
-fe_button_toggled(GtkWidget *widget,
-                  gpointer   data)
+fe_button_toggled(GtkWidget * widget, gpointer data)
 {
     GtkToggleButton *button = GTK_TOGGLE_BUTTON(widget);
     gboolean active = gtk_toggle_button_get_active(button);
@@ -1684,26 +1548,22 @@ fe_button_toggled(GtkWidget *widget,
         gtk_container_foreach(GTK_CONTAINER(data),
                               fe_button_toggled_func,
                               GINT_TO_POINTER(active));
-    } else {
+    } else
         gtk_widget_set_sensitive(GTK_WIDGET(data), active);
-    }
     set_button_sensitivities(TRUE);
 }
 
-
 /*
- * fe_action_changed()
+ * fe_action_changed() 
  *
  * Callback for various signals of the other action items.
  */
 void
-fe_action_changed(GtkWidget *widget,
-                  gpointer   data)
+fe_action_changed(GtkWidget * widget, gpointer data)
 {
     set_button_sensitivities(TRUE);
 }
 
-
 #if REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED
 /*
  * fe_add_pressed()
@@ -1711,8 +1571,7 @@ fe_action_changed(GtkWidget *widget,
  * Callback for the "Add" button for the regex type
  */
 static void
-fe_add_pressed(GtkWidget *widget,
-               gpointer   throwaway)
+fe_add_pressed(GtkWidget * widget, gpointer throwaway)
 {
     const gchar *text;
     GtkTreeModel *model;
@@ -1720,52 +1579,45 @@ fe_add_pressed(GtkWidget *widget,
     GtkTreeSelection *selection;
 
     text = gtk_entry_get_text(GTK_ENTRY(fe_type_regex_entry));
-
-    if (!text || (text[0] == '\0')) {
+    
+    if (!text || text[0] == '\0')
         return;
-    }
-
+    
     model = gtk_tree_view_get_model(fe_type_regex_list);
     selection = gtk_tree_view_get_selection(fe_type_regex_list);
     gtk_list_store_append(GTK_LIST_STORE(model), &iter);
     gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, text, -1);
     gtk_tree_selection_select_iter(selection, &iter);
-    condition_has_changed = TRUE;
+    condition_has_changed=TRUE;
 }                       /* end fe_add_pressed() */
 
-
 /*
  * fe_remove_pressed()
- *
+ * 
  * Callback for the "remove" button of the regex type
  */
 static void
-fe_remove_pressed(GtkWidget *widget,
-                  gpointer   throwaway)
+fe_remove_pressed(GtkWidget * widget, gpointer throwaway)
 {
     GtkTreeSelection *selection =
         gtk_tree_view_get_selection(fe_type_regex_list);
     GtkTreeModel *model;
     GtkTreeIter iter;
     GtkTreePath *path;
-
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
+    
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
         return;
-    }
-
+    
     path = gtk_tree_model_get_path(model, &iter);
     gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
     /* select the next regex if there is one, or the previous regex if
      * there isn't. */
     if (gtk_tree_model_get_iter(model, &iter, path)
-        || gtk_tree_path_prev(path)) {
+        || gtk_tree_path_prev(path))
         gtk_tree_selection_select_path(selection, path);
-    }
     gtk_tree_path_free(path);
-    condition_has_changed = TRUE;
+    condition_has_changed=TRUE;
 }                       /* end fe_remove_pressed() */
-
-
 #endif                  /* REGULAR_EXPRESSION_FILTERING_IS_IMPLEMENTED */
 
 /************************************************************/
@@ -1777,12 +1629,11 @@ fe_remove_pressed(GtkWidget *widget,
  * if new_name==NULL, it's a deletion
  */
 static void
-change_filter_name(gchar *old_name,
-                   gchar *new_name)
+change_filter_name(gchar * old_name,gchar * new_name)
 {
     if (g_strcmp0(old_name, new_name) != 0) {
-        GList *lst;
-        filters_names_rec *p = NULL;
+        GList * lst;
+        filters_names_rec * p=NULL;
 
         /* First we check if the filter that changes has been created
          * in this session (looking new_filters_names list) if yes we
@@ -1791,57 +1642,51 @@ change_filter_name(gchar *old_name,
          */
 
         for (lst = new_filters_names;
-             lst != NULL && strcmp(old_name, (gchar *)lst->data) != 0;
-             lst = lst->next) {
-        }
-        if (lst) {
+             lst != NULL && strcmp(old_name,(gchar*)lst->data) != 0;
+             lst = lst->next);
+        if (lst) {          
             /* Found it ! Update new_filters_names */
             g_free(lst->data);
-            if (new_name) {
-                lst->data = g_strdup(new_name);
-            } else {
-                new_filters_names = g_list_delete_link(new_filters_names, lst);
-            }
+            if (new_name)
+                lst->data=g_strdup(new_name);
+            else
+                new_filters_names=g_list_delete_link(new_filters_names,lst);
             return;
         }
-
-        /* Now we check if there already exists a change : any name -> old_name
-           if yes we must change it to : any name -> new_name
-           else we create a new record
-         */
-        for (lst = filters_names_changes; lst != NULL; lst = lst->next) {
+       
+       /* Now we check if there already exists a change : any name -> old_name
+          if yes we must change it to : any name -> new_name
+          else we create a new record
+       */
+       for (lst = filters_names_changes; lst != NULL; lst = lst->next)
             if (g_strcmp0(((filters_names_rec *) lst->data)->new_name, old_name) == 0) {
-                p = (filters_names_rec *)lst->data;
+                p=(filters_names_rec *)lst->data;
                 g_free(p->new_name);
                 break;
             }
-        }
         if (!lst) {
             /* New name change, create record */
-            p = g_new(filters_names_rec, 1);
-            p->old_name = g_strdup(old_name);
-            filters_names_changes = g_list_prepend(filters_names_changes, p);
+            p=g_new(filters_names_rec,1);
+            p->old_name=g_strdup(old_name);
+            filters_names_changes=g_list_prepend(filters_names_changes,p);
         }
         /* Record exists yet, test if we can collapse it (in case his
          * old_name==new_name) It's only a small optimization
          */
         else if (g_strcmp0(p->old_name, new_name) == 0) {
-            g_free(p->old_name);
-            g_free(p);
-            filters_names_changes =
-                g_list_delete_link(filters_names_changes, lst);
+           g_free(p->old_name);
+           g_free(p);
+            filters_names_changes=
+                g_list_delete_link(filters_names_changes,lst);
             return;
         }
 
-        if (new_name) {
-            p->new_name = g_strdup(new_name);
-        } else {
-            p->new_name = NULL;
-        }
+        if (new_name)
+            p->new_name=g_strdup(new_name);
+        else p->new_name=NULL;
     }
 }
 
-
 /*
  * fe_new_pressed()
  *
@@ -1849,14 +1694,13 @@ change_filter_name(gchar *old_name,
  */
 
 void
-fe_new_pressed(GtkWidget *widget,
-               gpointer   data)
+fe_new_pressed(GtkWidget * widget, gpointer data)
 {
     static const char FLT_NAME_TEMPLATE[] = N_("New filter");
     gint filter_number;
-    LibBalsaFilter *fil;
-    guint len = strlen(_(FLT_NAME_TEMPLATE)) + 4;
-    gchar *new_item = g_new(gchar, len);
+    LibBalsaFilter* fil;
+    guint len = strlen(_(FLT_NAME_TEMPLATE))+4;
+    gchar *new_item = g_new(gchar,len);
     GtkTreeModel *model =
         gtk_tree_view_get_model(fe_filters_list);
     GtkTreeIter iter;
@@ -1865,22 +1709,19 @@ fe_new_pressed(GtkWidget *widget,
 
     /* Put a number behind 'New filter' */
     gtk_tree_selection_unselect_all(selection);
-    for (filter_number = 0; filter_number < 1000; filter_number++) {
-        if (filter_number == 0) {
+    for(filter_number=0; filter_number<1000; filter_number++){
+        if(filter_number == 0)
             strcpy(new_item, _(FLT_NAME_TEMPLATE));
-        } else {
-            g_snprintf(new_item,
+        else
+            g_snprintf(new_item, 
                        len, "%s%d",
                        _(FLT_NAME_TEMPLATE), filter_number);
-        }
-        if (unique_filter_name(new_item)) {
-            break;
-        }
+        if (unique_filter_name(new_item)) break;
     }
 
     fil = libbalsa_filter_new();
 
-    if (filter_errno != FILTER_NOERR) {
+    if (filter_errno!=FILTER_NOERR) {
         filter_perror(filter_strerror(filter_errno));
         g_free(new_item);
         return;
@@ -1892,29 +1733,27 @@ fe_new_pressed(GtkWidget *widget,
 
     /* Fill the filter with default values */
 
-    fil->name = g_strdup(new_item);
+    fil->name=g_strdup(new_item);
 
-    FILTER_SETFLAG(fil, FILTER_COMPILED);
-    fil->action = FILTER_MOVE;
+    FILTER_SETFLAG(fil,FILTER_COMPILED);
+    fil->action=FILTER_MOVE;
 
     /* Selecting the row will also display the new filter */
     gtk_tree_selection_select_iter(selection, &iter);
 
     /* Adds "New Filter" to the list of actual new filters names */
     /* new_filters_names takes ownership of new_item */
-    new_filters_names = g_list_prepend(new_filters_names, new_item);
+    new_filters_names=g_list_prepend(new_filters_names, new_item);
     gtk_widget_grab_focus(fe_name_entry);
 }                       /* end fe_new_pressed() */
 
-
 /*
  * fe_delete_pressed()
  *
  * Callback for the "Delete" button
  */
 void
-fe_delete_pressed(GtkWidget *widget,
-                  gpointer   data)
+fe_delete_pressed(GtkWidget * widget, gpointer data)
 {
     GtkTreeSelection *selection =
         gtk_tree_view_get_selection(fe_filters_list);
@@ -1923,36 +1762,35 @@ fe_delete_pressed(GtkWidget *widget,
     GtkTreePath *path;
     LibBalsaFilter *fil;
 
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
         return;
-    }
-
+    
     gtk_tree_model_get(model, &iter, 1, &fil, -1);
-
+    
     g_assert(fil);
-    change_filter_name(fil->name, NULL);
+    change_filter_name(fil->name,NULL);
     libbalsa_filter_free(fil, NULL);
-
+    
     path = gtk_tree_model_get_path(model, &iter);
     gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
     /* select the next filter if there is one, or the previous filter if
      * there isn't, or... */
     if (gtk_tree_model_get_iter(model, &iter, path)
-        || gtk_tree_path_prev(path)) {
+        || gtk_tree_path_prev(path))
         gtk_tree_selection_select_path(selection, path);
-    } else {
+    else {
         /* ...the store is empty: */
         /* We clear all widgets */
-        gtk_entry_set_text(GTK_ENTRY(fe_name_entry), "");
-        gtk_entry_set_text(GTK_ENTRY(fe_popup_entry), "");
+        gtk_entry_set_text(GTK_ENTRY(fe_name_entry),"");
+        gtk_entry_set_text(GTK_ENTRY(fe_popup_entry),"");
         /*gtk_option_menu_set_history(GTK_OPTION_MENU(fe_mailboxes), 0); */
         gtk_list_store_clear(GTK_LIST_STORE
-                                 (gtk_tree_view_get_model
-                                     (fe_conditions_list)));
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_sound_button), FALSE);
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_popup_button), FALSE);
+                             (gtk_tree_view_get_model
+                              (fe_conditions_list)));
+        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_sound_button),FALSE);
+        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_popup_button),FALSE);
         /* We make the filters delete,revert,apply buttons unsensitive */
-        gtk_widget_set_sensitive(fe_delete_button, FALSE);
+        gtk_widget_set_sensitive(fe_delete_button,FALSE);
         set_button_sensitivities(FALSE);
     }
     gtk_tree_path_free(path);
@@ -1960,7 +1798,6 @@ fe_delete_pressed(GtkWidget *widget,
                                       GTK_RESPONSE_OK, TRUE);
 }                       /* end fe_delete_pressed() */
 
-
 /*
  * fe_apply_pressed()
  *
@@ -1969,8 +1806,7 @@ fe_delete_pressed(GtkWidget *widget,
  * we can have a filter with unvalid conditions
  */
 void
-fe_apply_pressed(GtkWidget *widget,
-                 gpointer   data)
+fe_apply_pressed(GtkWidget * widget, gpointer data)
 {
     GtkTreeSelection *selection =
         gtk_tree_view_get_selection(fe_filters_list);
@@ -1979,32 +1815,31 @@ fe_apply_pressed(GtkWidget *widget,
     GtkTreeModel *cond_model =
         gtk_tree_view_get_model(fe_conditions_list);
     GtkTreeIter cond_iter;
-    LibBalsaFilter *fil, *old;
+    LibBalsaFilter *fil,*old;
     const gchar *temp;
     FilterActionType action;
     ConditionMatchType condition_op;
 
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
         return;
-    }
 
     /* quick check before we malloc */
     temp = gtk_entry_get_text(GTK_ENTRY(fe_name_entry));
-    if (!temp || (temp[0] == '\0')) {
+    if (!temp || temp[0] == '\0') {
         balsa_information(LIBBALSA_INFORMATION_ERROR,
                           _("No filter name specified."));
         return;
-    }
-    if (!unique_filter_name(temp)) {
+    } 
+    if(!unique_filter_name(temp)) {
         balsa_information(LIBBALSA_INFORMATION_ERROR,
                           _("Filter “%s” already exists."), temp);
         return;
     }
-
+    
     /* Set the type associated with the selected item */
     action =
         (FilterActionType) fe_combo_box_get_value(fe_action_option_menu);
-
+    
     if (!gtk_tree_model_get_iter_first(cond_model, &cond_iter)) {
         balsa_information(LIBBALSA_INFORMATION_ERROR,
                           _("Filter must have conditions."));
@@ -2013,15 +1848,15 @@ fe_apply_pressed(GtkWidget *widget,
     /* Construct the new filter according with the data fields */
 
     fil = libbalsa_filter_new();
-    if (filter_errno != FILTER_NOERR) {
+    if (filter_errno!=FILTER_NOERR) {
         filter_perror(filter_strerror(filter_errno));
         gtk_widget_destroy(fe_window);
         return;
     }
 
-    /* Set name of the filter */
+   /* Set name of the filter */
 
-    fil->name = g_strdup(temp);
+    fil->name=g_strdup(temp);
 
     /* Retrieve the selected item in the op codes menu */
 
@@ -2032,7 +1867,7 @@ fe_apply_pressed(GtkWidget *widget,
 
     /* Retrieve all conditions for that filter */
 
-    FILTER_SETFLAG(fil, FILTER_VALID);
+    FILTER_SETFLAG(fil,FILTER_VALID);
 
     /* Here I set back FILTER_COMPILED, that way, modified filters
      * with no Regex condition won't have to recalculate regex (that
@@ -2040,7 +1875,7 @@ fe_apply_pressed(GtkWidget *widget,
      * condition will have their compiled flag unset by
      * filter_append_condition, So that's OK
      */
-    FILTER_SETFLAG(fil, FILTER_COMPILED);
+    FILTER_SETFLAG(fil,FILTER_COMPILED);
     gtk_tree_model_get_iter_first(cond_model, &cond_iter);
     do {
         LibBalsaCondition *cond;
@@ -2051,7 +1886,7 @@ fe_apply_pressed(GtkWidget *widget,
                                           condition_op);
     } while (gtk_tree_model_iter_next(cond_model, &cond_iter));
 
-    if (filter_errno != FILTER_NOERR) {
+    if (filter_errno!=FILTER_NOERR) {
         filter_perror(filter_strerror(filter_errno));
         gtk_widget_destroy(fe_window);
         return;
@@ -2059,7 +1894,7 @@ fe_apply_pressed(GtkWidget *widget,
 
     /* Set action fields according to dialog data */
 
-    fil->action = action;
+    fil->action=action;
 
     if (fil->action == FILTER_COLOR) {
         GdkRGBA rgba;
@@ -2082,40 +1917,38 @@ fe_apply_pressed(GtkWidget *widget,
             gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(fe_background),
                                        &rgba);
             color_string = gdk_rgba_to_string(&rgba);
-            if (string->len > 0) {
+            if (string->len > 0)
                 g_string_append_c(string, ';');
-            }
             g_string_append_printf(string, "background:%s", color_string);
             g_free(color_string);
             gtk_toggle_button_set_active(toggle_button, FALSE);
         }
 
         fil->action_string = g_string_free(string, FALSE);
-    } else if (fil->action != FILTER_TRASH) {
-        fil->action_string = g_strdup(balsa_mblist_mru_option_menu_get(fe_mailboxes));
-    }
+    } else if (fil->action!=FILTER_TRASH)
+        fil->action_string=g_strdup(balsa_mblist_mru_option_menu_get(fe_mailboxes));
     if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fe_popup_button))) {
         static gchar defstring[] = N_("Filter has matched");
         const gchar *tmpstr;
-
+        
         tmpstr = gtk_entry_get_text(GTK_ENTRY(fe_popup_entry));
-
-        fil->popup_text = g_strdup(((!tmpstr)
-                                    || (tmpstr[0] ==
-                                        '\0')) ? _(defstring) : tmpstr);
+        
+        fil->popup_text=g_strdup(((!tmpstr)
+                                  || (tmpstr[0] ==
+                                      '\0')) ? _(defstring) : tmpstr);
     }
 
 /* FIXME never defined?? #ifdef HAVE_LIBESD */
     if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fe_sound_button))) {
         gchar *tmpstr;
-
+        
         tmpstr = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER
-                                                   (fe_sound_entry));
+                                               (fe_sound_entry));
         if ((!tmpstr) || (tmpstr[0] == '\0')) {
             g_free(tmpstr);
             libbalsa_filter_free(fil, GINT_TO_POINTER(TRUE));
-            balsa_information(LIBBALSA_INFORMATION_ERROR,
-                              _("You must provide a sound to play"));
+           balsa_information(LIBBALSA_INFORMATION_ERROR,
+                             _("You must provide a sound to play"));
             return;
         }
         fil->sound = tmpstr;
@@ -2124,7 +1957,7 @@ fe_apply_pressed(GtkWidget *widget,
     /* New filter is OK, we replace the old one */
     gtk_tree_model_get(model, &iter, 1, &old, -1);
     change_filter_name(old->name, fil->name);
-    libbalsa_filter_free(old, GINT_TO_POINTER(TRUE));
+    libbalsa_filter_free(old,GINT_TO_POINTER(TRUE));
     gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
     gtk_list_store_append(GTK_LIST_STORE(model), &iter);
     gtk_list_store_set(GTK_LIST_STORE(model), &iter,
@@ -2143,48 +1976,42 @@ fe_apply_pressed(GtkWidget *widget,
  * things
  */
 void
-fe_revert_pressed(GtkWidget *widget,
-                  gpointer   data)
+fe_revert_pressed(GtkWidget * widget, gpointer data)
 {
     GtkTreeSelection *selection =
         gtk_tree_view_get_selection(fe_filters_list);
     GtkTreeIter iter;
 
-    if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) {
+    if (!gtk_tree_selection_get_selected(selection, NULL, &iter))
         return;
-    }
 
     gtk_tree_selection_unselect_all(selection);
     gtk_tree_selection_select_iter(selection, &iter);
 }                       /* end fe_revert_pressed() */
 
-
 /*
  * Callback function handling the selection of a row in the filter list
  * so that we can refresh the notebook page
  */
 static void
-fill_condition_list(GtkTreeModel      *model,
-                    LibBalsaCondition *condition,
-                    ConditionMatchType type)
+fill_condition_list(GtkTreeModel *model, LibBalsaCondition *condition,
+                   ConditionMatchType type)
 {
     gchar *filter_description;
     GtkTreeIter iter;
 
-    if (!condition) {
-        return;
-    }
-    if ((condition->type == CONDITION_OR)
-        || (condition->type == CONDITION_AND)) {
-        /* A nested boolean operator must be the same as the top level
-         * operator. */
-        if (condition->type != type) {
-            /* We'll silently ignore a mismatch. */
-            return;
-        }
-        fill_condition_list(model, condition->match.andor.left, type);
-        fill_condition_list(model, condition->match.andor.right, type);
-        return;
+    if (!condition)
+       return;
+    if (condition->type == CONDITION_OR
+       || condition->type == CONDITION_AND)  {
+       /* A nested boolean operator must be the same as the top level
+        * operator. */
+       if (condition->type != type)
+           /* We'll silently ignore a mismatch. */
+           return;
+       fill_condition_list(model, condition->match.andor.left, type);
+       fill_condition_list(model, condition->match.andor.right, type);
+       return;
     }
 
     gtk_list_store_prepend(GTK_LIST_STORE(model), &iter);
@@ -2196,45 +2023,40 @@ fill_condition_list(GtkTreeModel      *model,
     g_free(filter_description);
 }
 
-
 void
-fe_filters_list_selection_changed(GtkTreeSelection *selection,
-                                  gpointer          data)
+fe_filters_list_selection_changed(GtkTreeSelection * selection,
+                                  gpointer data)
 {
     GtkTreeModel *model;
     GtkTreeIter iter;
-    LibBalsaFilter *fil;
+    LibBalsaFilter* fil;
     int pos, i;
 
     if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
-        if (gtk_tree_model_iter_n_children(model, NULL) == 0) {
+        if (gtk_tree_model_iter_n_children(model, NULL) == 0)
             fe_enable_right_page(FALSE);
-        }
         return;
     }
 
     gtk_tree_model_get(model, &iter, 1, &fil, -1);
-
+    
     /* Populate all fields with filter data */
-    gtk_entry_set_text(GTK_ENTRY(fe_name_entry), fil->name);
+    gtk_entry_set_text(GTK_ENTRY(fe_name_entry),fil->name);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_popup_button),
-                                 fil->popup_text != NULL);
+                                 fil->popup_text!=NULL);
     gtk_entry_set_text(GTK_ENTRY(fe_popup_entry),
-                       fil->popup_text != NULL
+                       fil->popup_text!=NULL
                        ? fil->popup_text : "");
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fe_sound_button),
-                                 fil->sound != NULL);
-    if (fil->sound) {
+                                 fil->sound!=NULL);
+    if (fil->sound)
         gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(fe_sound_entry),
                                       fil->sound);
-    }
-
-    for (i = 0; i < FILTER_N_TYPES - 1; i++) {
-        if (((FilterActionType) fe_actions[i].value) == fil->action) {
+    
+    for (i = 0; i < FILTER_N_TYPES - 1; i++)
+        if (((FilterActionType) fe_actions[i].value) == fil->action)
             gtk_combo_box_set_active(GTK_COMBO_BOX(fe_action_option_menu),
                                      i);
-        }
-    }
     pos = (fil->condition
            && fil->condition->type == CONDITION_AND) ? 1 : 0;
     gtk_combo_box_set_active(GTK_COMBO_BOX(fe_op_codes_option_menu), pos);
@@ -2249,21 +2071,20 @@ fe_filters_list_selection_changed(GtkTreeSelection *selection,
                 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(fe_foreground),
                                            &rgba);
                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                                 (fe_foreground_set), TRUE);
+                                             (fe_foreground_set), TRUE);
             }
             if (g_str_has_prefix(*p, "background:")) {
                 gdk_rgba_parse(&rgba, (*p) + 11);
                 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(fe_background),
                                            &rgba);
                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                                 (fe_background_set), TRUE);
+                                             (fe_background_set), TRUE);
             }
         }
         g_strfreev(parts);
-    } else if ((fil->action != FILTER_TRASH) && fil->action_string) {
+    } else if (fil->action!=FILTER_TRASH && fil->action_string)
         balsa_mblist_mru_option_menu_set(fe_mailboxes,
                                          fil->action_string);
-    }
     /* We free the conditions */
     fe_free_associated_conditions();
 
@@ -2272,13 +2093,12 @@ fe_filters_list_selection_changed(GtkTreeSelection *selection,
     gtk_list_store_clear(GTK_LIST_STORE(model));
 
     /* Populate the conditions list */
-    filter_errno = FILTER_NOERR;
+    filter_errno=FILTER_NOERR;
     fill_condition_list(model, fil->condition,
-                        fil->condition ?
-                        fil->condition->type : CONDITION_OR);
-    if (filter_errno != FILTER_NOERR) {
+                       fil->condition ?
+                       fil->condition->type : CONDITION_OR);
+    if (filter_errno!=FILTER_NOERR)
         gtk_widget_destroy(fe_window);
-    }
 
     if (gtk_tree_model_get_iter_first(model, &iter)) {
         selection = gtk_tree_view_get_selection(fe_conditions_list);
@@ -2299,7 +2119,6 @@ fe_filters_list_selection_changed(GtkTreeSelection *selection,
     fe_enable_right_page(TRUE);
 }                      /* end fe_filters_list_selection_changed */
 
-
 static GtkWidget *
 fe_date_sample(void)
 {
@@ -2319,22 +2138,17 @@ fe_date_sample(void)
     return label;
 }                               /* end fe_date_sample */
 
-
 /* Callback for the sound file-chooser-button's dialog. */
 void
-fe_sound_response(GtkDialog *dialog,
-                  gint       response)
+fe_sound_response(GtkDialog * dialog, gint response)
 {
-    if (response == GTK_RESPONSE_ACCEPT) {
+    if (response == GTK_RESPONSE_ACCEPT)
         set_button_sensitivities(TRUE);
-    }
 }
 
-
 /* Callback for color check-buttons' "toggled" signal */
 void
-fe_color_check_toggled(GtkToggleButton *check_button,
-                       gpointer         data)
+fe_color_check_toggled(GtkToggleButton * check_button, gpointer data)
 {
     GtkWidget *color_button = GTK_WIDGET(data);
     gtk_widget_set_sensitive(color_button,
@@ -2342,11 +2156,9 @@ fe_color_check_toggled(GtkToggleButton *check_button,
     set_button_sensitivities(TRUE);
 }
 
-
 /* Callback for color buttons' "color-set" signal */
 void
-fe_color_set(GtkColorButton *color_button,
-             gpointer        data)
+fe_color_set(GtkColorButton * color_button, gpointer data)
 {
     set_button_sensitivities(TRUE);
 }
diff --git a/src/filter-edit-dialog.c b/src/filter-edit-dialog.c
index 2cc183a..17441f2 100644
--- a/src/filter-edit-dialog.c
+++ b/src/filter-edit-dialog.c
@@ -18,7 +18,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include "balsa-app.h"
@@ -40,15 +40,15 @@
  * Defined in filter-run.dialog.c
  */
 
-extern GList *fr_dialogs_opened;
+extern GList * fr_dialogs_opened;
 
 /* The dialog widget (we need it to be able to close dialog on error) */
 
-GtkWidget *fe_window;
+GtkWidget * fe_window;
 
-GtkTreeView *fe_filters_list;
+GtkTreeView * fe_filters_list;
 
-gboolean fe_already_open = FALSE;
+gboolean fe_already_open=FALSE;
 
 /* containers for radiobuttons */
 GtkWidget *fe_op_codes_option_menu;
@@ -61,7 +61,7 @@ GtkWidget *fe_name_entry;
 GtkTreeView *fe_conditions_list;
 
 /* List of strings in the combo of user headers name */
-GList *fe_user_headers_list;
+GList * fe_user_headers_list;
 
 /* notification field */
 GtkWidget *fe_sound_button;
@@ -73,21 +73,21 @@ GtkWidget *fe_popup_entry;
 GtkWidget *fe_action_option_menu;
 
 /* Mailboxes option menu */
-GtkWidget *fe_mailboxes;
+GtkWidget * fe_mailboxes;
 
 /* Select colors */
-GtkWidget *fe_color_buttons;
-GtkWidget *fe_foreground_set;
-GtkWidget *fe_foreground;
-GtkWidget *fe_background_set;
-GtkWidget *fe_background;
+GtkWidget * fe_color_buttons;
+GtkWidget * fe_foreground_set;
+GtkWidget * fe_foreground;
+GtkWidget * fe_background_set;
+GtkWidget * fe_background;
 
-GtkWidget *fe_right_page;
+GtkWidget* fe_right_page;
 
 /* Different buttons that need to be greyed or ungreyed */
 GtkWidget *fe_new_button, *fe_delete_button;
 GtkWidget *fe_apply_button, *fe_revert_button;
-GtkWidget *fe_condition_delete_button, *fe_condition_edit_button;
+GtkWidget * fe_condition_delete_button,* fe_condition_edit_button;
 
 /* ******************************** */
 
@@ -119,7 +119,6 @@ fe_enable_right_page(gboolean enabled)
     gtk_widget_set_sensitive(fe_right_page, enabled);
 }
 
-
 /*
  * fe_build_option_menu()
  *
@@ -136,47 +135,41 @@ fe_enable_right_page(gboolean enabled)
  */
 
 static void
-fe_combo_box_info_free(struct fe_combo_box_info *info)
+fe_combo_box_info_free(struct fe_combo_box_info * info)
 {
     g_slist_free(info->values);
     g_free(info);
 }
 
-
 GtkWidget *
-fe_build_option_menu(option_list options[],
-                     gint        num,
-                     GCallback   func,
-                     gpointer    cb_data)
+fe_build_option_menu(option_list options[], gint num, GCallback func,
+                     gpointer cb_data)
 {
     GtkWidget *combo_box;
     struct fe_combo_box_info *info;
     int i;
 
-    if (num < 1) {
-        return (NULL);
-    }
+    if (num < 1)
+       return (NULL);
 
     combo_box = gtk_combo_box_text_new();
     info = g_new(struct fe_combo_box_info, 1);
     info->values = NULL;
 
     for (i = 0; i < num; i++) {
-        gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box),
+       gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box),
                                        _(options[i].text));
-        info->values =
-            g_slist_append(info->values, GINT_TO_POINTER(options[i].value));
+       info->values =
+           g_slist_append(info->values, GINT_TO_POINTER(options[i].value));
     }
     gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), 0);
-    if (func) {
-        g_signal_connect(G_OBJECT(combo_box), "changed", func, cb_data);
-    }
+    if (func)
+       g_signal_connect(G_OBJECT(combo_box), "changed", func, cb_data);
     g_object_set_data_full(G_OBJECT(combo_box), BALSA_FE_COMBO_BOX_INFO,
                            info, (GDestroyNotify) fe_combo_box_info_free);
 
     return combo_box;
-}                               /* end fe_build_option_menu */
-
+}                              /* end fe_build_option_menu */
 
 /*
  * build_left_side()
@@ -192,28 +185,28 @@ build_left_side(void)
 
     /*
        /--------\
-     | /---\  |
-     | |   |  |
-     | |   |  |
-     | |   |  |
-     | \---/  |
-     |        |
-     | -- --  |
-     | -- --  |
-     \--------/
+       | /---\  |
+       | |   |  |
+       | |   |  |
+       | |   |  |
+       | \---/  |
+       |        |
+       | -- --  |
+       | -- --  |
+       \--------/
      */
     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
 
     /* the list */
     sw = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
-                                   GTK_POLICY_AUTOMATIC,
-                                   GTK_POLICY_AUTOMATIC);
+                                  GTK_POLICY_AUTOMATIC,
+                                  GTK_POLICY_AUTOMATIC);
 
     fe_filters_list =
         libbalsa_filter_list_new(TRUE, _("Name"), GTK_SELECTION_BROWSE,
                                  G_CALLBACK
-                                     (fe_filters_list_selection_changed),
+                                 (fe_filters_list_selection_changed),
                                  TRUE);
 
     gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(fe_filters_list));
@@ -232,18 +225,17 @@ build_left_side(void)
     /* Translators: button "New" filter */
     fe_new_button = gtk_button_new_with_mnemonic(C_("filter", "_New"));
     g_signal_connect(G_OBJECT(fe_new_button), "clicked",
-                     G_CALLBACK(fe_new_pressed), NULL);
+                    G_CALLBACK(fe_new_pressed), NULL);
     gtk_box_pack_start(GTK_BOX(bbox), fe_new_button);
     /* delete button */
     fe_delete_button = gtk_button_new_with_mnemonic(("_Delete"));
     g_signal_connect(G_OBJECT(fe_delete_button), "clicked",
-                     G_CALLBACK(fe_delete_pressed), NULL);
+                    G_CALLBACK(fe_delete_pressed), NULL);
     gtk_box_pack_start(GTK_BOX(bbox), fe_delete_button);
     gtk_widget_set_sensitive(fe_delete_button, FALSE);
 
     return vbox;
-}                               /* end build_left_side() */
-
+}                              /* end build_left_side() */
 
 /*
  * build_match_page()
@@ -288,8 +280,8 @@ build_match_page()
     gtk_grid_attach(GTK_GRID(page), box, 1, 1, 1, 1);
 
     fe_op_codes_option_menu = fe_build_option_menu(fe_op_codes,
-                                                   G_N_ELEMENTS(fe_op_codes),
-                                                   NULL, NULL);
+                                               G_N_ELEMENTS(fe_op_codes),
+                                               NULL, NULL);
     g_signal_connect(fe_op_codes_option_menu, "changed",
                      G_CALLBACK(fe_action_changed), NULL);
     gtk_box_pack_start(GTK_BOX(box), fe_op_codes_option_menu);
@@ -300,8 +292,8 @@ build_match_page()
     gtk_widget_set_hexpand(scroll, TRUE);
     gtk_widget_set_vexpand(scroll, TRUE);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
-                                   GTK_POLICY_AUTOMATIC,
-                                   GTK_POLICY_AUTOMATIC);
+                                  GTK_POLICY_AUTOMATIC,
+                                  GTK_POLICY_AUTOMATIC);
     gtk_grid_attach(GTK_GRID(page), scroll, 0, 2, 2, 1);
 
     fe_conditions_list =
@@ -316,7 +308,7 @@ build_match_page()
     gtk_widget_set_hexpand(box, TRUE);
     gtk_grid_attach(GTK_GRID(page), box, 0, 3, 2, 1);
     fe_condition_edit_button = gtk_button_new_with_mnemonic(_("_Edit"));
-    gtk_widget_set_sensitive(fe_condition_edit_button, FALSE);
+    gtk_widget_set_sensitive(fe_condition_edit_button,FALSE);
     gtk_box_pack_start(GTK_BOX(box), fe_condition_edit_button);
     g_signal_connect(G_OBJECT(fe_condition_edit_button), "clicked",
                      G_CALLBACK(fe_edit_condition), GINT_TO_POINTER(0));
@@ -326,13 +318,13 @@ build_match_page()
     g_signal_connect(G_OBJECT(button), "clicked",
                      G_CALLBACK(fe_edit_condition), GINT_TO_POINTER(1));
     fe_condition_delete_button = gtk_button_new_with_mnemonic(_("_Remove"));
-    gtk_widget_set_sensitive(fe_condition_delete_button, FALSE);
+    gtk_widget_set_sensitive(fe_condition_delete_button,FALSE);
     gtk_box_pack_start(GTK_BOX(box), fe_condition_delete_button);
     g_signal_connect(G_OBJECT(fe_condition_delete_button), "clicked",
-                     G_CALLBACK(fe_condition_remove_pressed), NULL);
+                    G_CALLBACK(fe_condition_remove_pressed), NULL);
 
     return page;
-}                               /* end build_match_page() */
+}                              /* end build_match_page() */
 
 
 /*
@@ -378,9 +370,8 @@ fe_make_color_buttons(void)
     return grid_widget;
 }
 
-
 static GtkWidget *
-build_action_page(GtkWindow *window)
+build_action_page(GtkWindow * window)
 {
     GtkWidget *page, *frame, *grid;
     GtkWidget *box;
@@ -411,7 +402,7 @@ build_action_page(GtkWindow *window)
         gtk_file_chooser_dialog_new(_("Use Sound…"), NULL,
                                     GTK_FILE_CHOOSER_ACTION_OPEN,
                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                    _("_Open"), GTK_RESPONSE_ACCEPT,
+                                    _("_Open"),   GTK_RESPONSE_ACCEPT,
                                     NULL);
     gtk_dialog_set_default_response(GTK_DIALOG(dialog),
                                     GTK_RESPONSE_ACCEPT);
@@ -463,9 +454,9 @@ build_action_page(GtkWindow *window)
        our own. We'll see this later, for now let's make something usable
        the old way was way too ugly and even unusable for users with zillions
        of mailboxes. Yes there are ;-)!
-     */
+    */
     fe_mailboxes = balsa_mblist_mru_option_menu(window,
-                                                &balsa_app.folder_mru);
+                                               &balsa_app.folder_mru);
     g_signal_connect(G_OBJECT(fe_mailboxes), "changed",
                      G_CALLBACK(fe_action_changed), NULL);
     gtk_widget_set_vexpand(fe_mailboxes, TRUE);
@@ -475,7 +466,7 @@ build_action_page(GtkWindow *window)
     gtk_widget_set_vexpand(fe_color_buttons, TRUE);
     gtk_box_pack_start(GTK_BOX(box), fe_color_buttons);
     return page;
-}                               /* end build_action_page() */
+}                              /* end build_action_page() */
 
 
 /*
@@ -484,7 +475,7 @@ build_action_page(GtkWindow *window)
  * Builds the right side of the dialog
  */
 static GtkWidget *
-build_right_side(GtkWindow *window)
+build_right_side(GtkWindow * window)
 {
     GtkWidget *rightside;
     GtkWidget *notebook, *page;
@@ -500,10 +491,10 @@ build_right_side(GtkWindow *window)
 
     page = build_match_page();
     gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
-                             page, gtk_label_new(_("Match")));
+                            page, gtk_label_new(_("Match")));
     page = build_action_page(window);
     gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
-                             page, gtk_label_new(_("Action")));
+                            page, gtk_label_new(_("Action")));
 
     /* button box */
     bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
@@ -511,47 +502,42 @@ build_right_side(GtkWindow *window)
 
     fe_apply_button = gtk_button_new_with_mnemonic(_("_Apply"));
     g_signal_connect(G_OBJECT(fe_apply_button), "clicked",
-                     G_CALLBACK(fe_apply_pressed), NULL);
+                    G_CALLBACK(fe_apply_pressed), NULL);
     gtk_box_pack_start(GTK_BOX(bbox), fe_apply_button);
 
     fe_revert_button = gtk_button_new_with_mnemonic(_("Re_vert"));
     g_signal_connect(G_OBJECT(fe_revert_button), "clicked",
-                     G_CALLBACK(fe_revert_pressed), NULL);
+                    G_CALLBACK(fe_revert_pressed), NULL);
     gtk_box_pack_start(GTK_BOX(bbox), fe_revert_button);
     gtk_widget_set_sensitive(fe_apply_button, FALSE);
     gtk_widget_set_sensitive(fe_revert_button, FALSE);
 
     return rightside;
-}                               /* end build_right_side() */
-
+}                              /* end build_right_side() */
 
 /* Helper */
 static void
-fe_collect_user_headers(LibBalsaCondition *condition)
+fe_collect_user_headers(LibBalsaCondition * condition)
 {
     g_return_if_fail(condition != NULL);
 
     switch (condition->type) {
     case CONDITION_STRING:
         if (CONDITION_CHKMATCH(condition, CONDITION_MATCH_US_HEAD)) {
-            gchar *user_header = condition->match.string.user_header;
-            if (user_header && *user_header) {
-                fe_add_new_user_header(user_header);
-            }
-        }
+           gchar *user_header = condition->match.string.user_header;
+           if (user_header && *user_header)
+               fe_add_new_user_header(user_header);
+       }
         break;
-
     case CONDITION_AND:
     case CONDITION_OR:
         fe_collect_user_headers(condition->match.andor.left);
         fe_collect_user_headers(condition->match.andor.right);
-
     default:
         break;
     }
 }
 
-
 /*
  * filters_edit_dialog()
  *
@@ -559,27 +545,27 @@ fe_collect_user_headers(LibBalsaCondition *condition)
  */
 #define BALSA_FILTER_PADDING 6
 void
-filters_edit_dialog(GtkWindow *parent)
+filters_edit_dialog(GtkWindow * parent)
 {
     GtkWidget *hbox;
     GtkWidget *piece;
-    LibBalsaFilter *cpfil, *fil;
-    GSList *filter_list;
+    LibBalsaFilter * cpfil,* fil;
+    GSList * filter_list;
     GtkTreeModel *model;
     GtkTreeIter iter;
 
     if (fr_dialogs_opened) {
-        balsa_information(LIBBALSA_INFORMATION_ERROR,
+       balsa_information(LIBBALSA_INFORMATION_ERROR,
                           _("A filter run dialog is open. "
                             "Close it before you can modify filters."));
-        return;
+       return;
     }
     if (fe_already_open) {
-        gtk_window_present(GTK_WINDOW(fe_window));
-        return;
+       gtk_window_present(GTK_WINDOW(fe_window));
+       return;
     }
 
-    fe_already_open = TRUE;
+    fe_already_open=TRUE;
 
     piece = build_left_side();
 
@@ -589,12 +575,12 @@ filters_edit_dialog(GtkWindow *parent)
                                             _("_OK"), GTK_RESPONSE_OK,
                                             _("_Cancel"), GTK_RESPONSE_CANCEL,
                                             _("_Help"), GTK_RESPONSE_HELP,
-                                            NULL);
+                                           NULL);
 
     g_signal_connect(G_OBJECT(fe_window), "response",
                      G_CALLBACK(fe_dialog_response), NULL);
     g_signal_connect(G_OBJECT(fe_window), "destroy",
-                     G_CALLBACK(fe_destroy_window_cb), NULL);
+                    G_CALLBACK(fe_destroy_window_cb), NULL);
 
     gtk_window_set_role(GTK_WINDOW (fe_window), "filter-edit");
     gtk_dialog_set_response_sensitive(GTK_DIALOG(fe_window),
@@ -620,54 +606,53 @@ filters_edit_dialog(GtkWindow *parent)
 
     /* Populate the list of filters */
     model = gtk_tree_view_get_model(fe_filters_list);
-    for (filter_list = balsa_app.filters;
-         filter_list != NULL; filter_list = filter_list->next) {
-
-        fil = (LibBalsaFilter *)filter_list->data;
-        /* Make a copy of the current filter */
-        cpfil = libbalsa_filter_new();
-
-        cpfil->name = g_strdup(fil->name);
-        cpfil->flags = fil->flags;
-        cpfil->sound = g_strdup(fil->sound);
-        cpfil->popup_text = g_strdup(fil->popup_text);
-        /* FIXME: cpfil->conditions_op=fil->conditions_op; */
-        cpfil->flags = fil->flags;
-
-        /* We have to unset the "compiled" flag, because we don't copy
-         * the regex_t struc with copy condition (because I have no
-         * idea how to copy that mess) so that if user doesn't modify
-         * a filter with regex conditions they would be marked as
-         * compiled with regex_t struct being unallocated Drawback :
-         * even if user doesn't modify any regex, but press OK button,
-         * we'll recalculate all regex I guess we could be a bit
-         * smarter without too much gymnastic. */
-
-        FILTER_CLRFLAG(cpfil, FILTER_COMPILED);
-        /* Copy conditions */
-        if (fil->condition) {
+    for(filter_list = balsa_app.filters;
+        filter_list != NULL; filter_list = filter_list->next) {
+
+       fil=(LibBalsaFilter*)filter_list->data;
+       /* Make a copy of the current filter */
+       cpfil=libbalsa_filter_new();
+       
+       cpfil->name=g_strdup(fil->name);
+       cpfil->flags=fil->flags;
+       cpfil->sound=g_strdup(fil->sound);
+       cpfil->popup_text=g_strdup(fil->popup_text);
+       /* FIXME: cpfil->conditions_op=fil->conditions_op; */
+       cpfil->flags=fil->flags;
+
+       /* We have to unset the "compiled" flag, because we don't copy
+        * the regex_t struc with copy condition (because I have no
+        * idea how to copy that mess) so that if user doesn't modify
+        * a filter with regex conditions they would be marked as
+        * compiled with regex_t struct being unallocated Drawback :
+        * even if user doesn't modify any regex, but press OK button,
+        * we'll recalculate all regex I guess we could be a bit
+        * smarter without too much gymnastic. */
+
+       FILTER_CLRFLAG(cpfil,FILTER_COMPILED);
+       /* Copy conditions */
+        if (fil->condition)
             /* Copy conditions */
             cpfil->condition = libbalsa_condition_ref(fil->condition);
-        } else {
+        else
             balsa_information(LIBBALSA_INFORMATION_WARNING,
                               _("Filter “%s” has no condition."),
                               fil->name);
-        }
 
-        fe_collect_user_headers(fil->condition);
+       fe_collect_user_headers(fil->condition);
 
-        cpfil->action = fil->action;
-        cpfil->action_string = g_strdup(fil->action_string);
+       cpfil->action=fil->action;
+        cpfil->action_string=g_strdup(fil->action_string);
 
         gtk_list_store_append(GTK_LIST_STORE(model), &iter);
         gtk_list_store_set(GTK_LIST_STORE(model), &iter,
                            0, cpfil->name, 1, cpfil, -1);
     }
 
-    if (filter_errno != FILTER_NOERR) {
-        filter_perror(filter_strerror(filter_errno));
-        gtk_widget_destroy(GTK_WIDGET(fe_window));
-        return;
+    if (filter_errno!=FILTER_NOERR) {
+       filter_perror(filter_strerror(filter_errno));
+       gtk_widget_destroy(GTK_WIDGET(fe_window));
+       return;
     }
 
     gtk_widget_show(GTK_WIDGET(fe_window));
diff --git a/src/filter-edit.h b/src/filter-edit.h
index b01b55b..3e5db02 100644
--- a/src/filter-edit.h
+++ b/src/filter-edit.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -48,73 +48,57 @@ struct fe_combo_box_info {
 #define BALSA_FE_COMBO_BOX_INFO "balsa-fe-combo-box-info"
 
 /* destroy calback */
-void fe_destroy_window_cb(GtkWidget *, gpointer);
+void fe_destroy_window_cb(GtkWidget *,gpointer);
 
 /* button callbacks */
-void fe_dialog_response(GtkWidget *widget,
-                        gint       response,
-                        gpointer   data);
+void fe_dialog_response(GtkWidget * widget, gint response,
+                             gpointer data);
 
 /* helper */
-GtkWidget *fe_build_option_menu(option_list options[],
-                                gint        num,
-                                GCallback   func,
-                                gpointer    cb_data);
+GtkWidget *fe_build_option_menu(option_list options[], gint num,
+                                GCallback func, gpointer cb_data);
 
 /*---------------- Left side of hbox ----------------*/
 
 /* list callbacks */
-void fe_filters_list_selection_changed(GtkTreeSelection *selection,
-                                       gpointer          data);
+void fe_filters_list_selection_changed(GtkTreeSelection * selection,
+                                       gpointer data);
 
 /* button callbacks */
-void fe_new_pressed(GtkWidget *widget,
-                    gpointer   data);
-void fe_delete_pressed(GtkWidget *widget,
-                       gpointer   data);
+void fe_new_pressed(GtkWidget * widget, gpointer data);
+void fe_delete_pressed(GtkWidget * widget, gpointer data);
 
 /*---------------- Right side of hbox ----------------*/
 
 
 /* apply and revert callbacks */
-void fe_apply_pressed(GtkWidget *widget,
-                      gpointer   data);
-void fe_revert_pressed(GtkWidget *widget,
-                       gpointer   data);
+void fe_apply_pressed(GtkWidget * widget, gpointer data);
+void fe_revert_pressed(GtkWidget * widget, gpointer data);
 
 /*op codes callback */
-void fe_op_codes_toggled(GtkWidget *widget,
-                         gpointer   data);
+void fe_op_codes_toggled(GtkWidget * widget, gpointer data);
 
 /* Conditions callbacks */
-void fe_conditions_row_activated(GtkTreeView       *treeview,
-                                 GtkTreePath       *path,
-                                 GtkTreeViewColumn *column,
-                                 gpointer           data);
-void fe_edit_condition(GtkWidget *widget,
-                       gpointer   data);
-void fe_condition_remove_pressed(GtkWidget *widget,
-                                 gpointer   data);
+void fe_conditions_row_activated(GtkTreeView * treeview,
+                                 GtkTreePath * path,
+                                 GtkTreeViewColumn * column,
+                                gpointer data);
+void fe_edit_condition(GtkWidget * widget, gpointer data);
+void fe_condition_remove_pressed(GtkWidget * widget, gpointer data);
 
 /* action callback */
-void fe_action_selected(GtkWidget *widget,
-                        gpointer   data);
-void fe_button_toggled(GtkWidget *widget,
-                       gpointer   data);
-void fe_action_changed(GtkWidget *widget,
-                       gpointer   data);
+void fe_action_selected(GtkWidget * widget, gpointer data);
+void fe_button_toggled(GtkWidget * widget, gpointer data);
+void fe_action_changed(GtkWidget * widget, gpointer data);
 void fe_enable_right_page(gboolean enabled);
 
 /* Callback for the sound file-chooser-button's dialog. */
-void fe_sound_response(GtkDialog *dialog,
-                       gint       response);
+void fe_sound_response(GtkDialog * dialog, gint response);
 
 void fe_add_new_user_header(const gchar *);
 
 /* Callbacks for color button signals */
-void fe_color_check_toggled(GtkToggleButton *check_button,
-                            gpointer         data);
-void fe_color_set(GtkColorButton *color_button,
-                  gpointer        data);
+void fe_color_check_toggled(GtkToggleButton * check_button, gpointer data);
+void fe_color_set(GtkColorButton * color_button, gpointer data);
 
 #endif /*__FILTER_EDIT_H__ */
diff --git a/src/filter-export-callbacks.c b/src/filter-export-callbacks.c
index 611459f..d8acfdc 100644
--- a/src/filter-export-callbacks.c
+++ b/src/filter-export-callbacks.c
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -26,49 +26,41 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include "balsa-app.h"
 #include "filter-export.h"
 
-#include <glib/gi18n.h> /* Must come after balsa-app.h. */
+#include <glib/gi18n.h>        /* Must come after balsa-app.h. */
 
 /* To prevent user from silmultaneously edit/export filters */
 extern gboolean fex_already_open;
 
-void
-fex_destroy_window_cb(GtkWidget *widget,
-                      gpointer   throwaway)
+void 
+fex_destroy_window_cb(GtkWidget * widget,gpointer throwaway)
 {
-    fex_already_open = FALSE;
+    fex_already_open=FALSE;
 }
 
-
 static void
-fex_dialog_response_func(GtkTreeModel *model,
-                         GtkTreePath  *path,
-                         GtkTreeIter  *iter,
-                         gpointer      data)
+fex_dialog_response_func(GtkTreeModel * model, GtkTreePath * path,
+                         GtkTreeIter * iter, gpointer data)
 {
     LibBalsaFilter *fil;
     gchar *str;
 
     gtk_tree_model_get(model, iter, 1, &fil, -1);
     str = g_strdup_printf("%s.siv", fil->name);
-    if (!libbalsa_filter_export_sieve(fil, str)) {
+    if (!libbalsa_filter_export_sieve(fil, str))
         balsa_information(LIBBALSA_INFORMATION_ERROR,
                           _("Unable to export filter %s, "
                             "an error occurred."), fil->name);
-    }
     g_free(str);
 }
 
-
 void
-fex_dialog_response(GtkWidget *dialog,
-                    gint       response,
-                    gpointer   data)
+fex_dialog_response(GtkWidget * dialog, gint response, gpointer data)
 {
     if (response == GTK_RESPONSE_OK) {  /* OK Button */
         GtkTreeSelection *selection =
diff --git a/src/filter-export-dialog.c b/src/filter-export-dialog.c
index 184fc7d..d8eb270 100644
--- a/src/filter-export-dialog.c
+++ b/src/filter-export-dialog.c
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -26,22 +26,22 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "filter-export.h"
 
 #include "balsa-app.h"
 
-#include <glib/gi18n.h> /* Must come after balsa-app.h. */
+#include <glib/gi18n.h>        /* Must come after balsa-app.h. */
 
 /* To prevent user from silmultaneously edit/export filters */
 
 extern gboolean fe_already_open;
-extern GList *fr_dialogs_opened;
+extern GList * fr_dialogs_opened;
 
-gboolean fex_already_open = FALSE;
+gboolean fex_already_open=FALSE;
 
-GtkWidget *fex_window;
+GtkWidget * fex_window;
 
 /*
  * filters_export_dialog()
@@ -49,7 +49,7 @@ GtkWidget *fex_window;
  * Returns immediately, but fires off the filter export dialog.
  */
 void
-filters_export_dialog(GtkWindow *parent)
+filters_export_dialog(GtkWindow * parent)
 {
     GtkTreeView *list;
     GtkTreeModel *model;
@@ -59,14 +59,14 @@ filters_export_dialog(GtkWindow *parent)
     GSList *filter_list;
 
     if (fr_dialogs_opened) {
-        balsa_information(LIBBALSA_INFORMATION_ERROR,
+       balsa_information(LIBBALSA_INFORMATION_ERROR,
                           _("There are opened filter run dialogs, "
                             "close them before you can modify filters."));
-        return;
+       return;
     }
     if (fex_already_open) {
-        gtk_window_present(GTK_WINDOW(fex_window));
-        return;
+       gtk_window_present(GTK_WINDOW(fex_window));
+       return;
     }
 
     fex_already_open = TRUE;
@@ -83,8 +83,8 @@ filters_export_dialog(GtkWindow *parent)
 
     sw = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
-                                   GTK_POLICY_AUTOMATIC,
-                                   GTK_POLICY_AUTOMATIC);
+                                  GTK_POLICY_AUTOMATIC,
+                                  GTK_POLICY_AUTOMATIC);
 
     list =
         libbalsa_filter_list_new(TRUE, _("Name"), GTK_SELECTION_MULTIPLE,
@@ -114,7 +114,7 @@ filters_export_dialog(GtkWindow *parent)
     g_signal_connect(G_OBJECT(fex_window), "response",
                      G_CALLBACK(fex_dialog_response), list);
     g_signal_connect(G_OBJECT(fex_window), "destroy",
-                     G_CALLBACK(fex_destroy_window_cb), NULL);
+                    G_CALLBACK(fex_destroy_window_cb), NULL);
 
     gtk_widget_show(GTK_WIDGET(fex_window));
 }
diff --git a/src/filter-export.h b/src/filter-export.h
index 86fed9e..b974e40 100644
--- a/src/filter-export.h
+++ b/src/filter-export.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -33,12 +33,9 @@
  * fex = filter export
  */
 
-void fex_destroy_window_cb(GtkWidget *widget,
-                           gpointer   throwaway);
+void fex_destroy_window_cb(GtkWidget * widget,gpointer throwaway);
 
 /* button callbacks */
-void fex_dialog_response(GtkWidget *widget,
-                         gint       response,
-                         gpointer   data);
+void fex_dialog_response(GtkWidget * widget, gint response, gpointer data);
 
 #endif /*__FILTER_EXPORT_H__ */
diff --git a/src/filter-run-callbacks.c b/src/filter-run-callbacks.c
index 432ad83..8b355f0 100644
--- a/src/filter-run-callbacks.c
+++ b/src/filter-run-callbacks.c
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -22,7 +22,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <string.h>
@@ -33,17 +33,17 @@
 #include "balsa-app.h"
 #include "save-restore.h"
 
-#include <glib/gi18n.h> /* Must come after balsa-app.h. */
+#include <glib/gi18n.h>        /* Must come after balsa-app.h. */
 
 /* Global vars */
 
-extern GList *fr_dialogs_opened;
+extern GList * fr_dialogs_opened;
 
 /* FIXME : we should single out invalid filters in the list (eg with colors) */
 /* FIXME : implement error reporting */
 
 void
-fr_clean_associated_mailbox_filters(GtkTreeView *filter_list)
+fr_clean_associated_mailbox_filters(GtkTreeView * filter_list)
 {
     GtkTreeModel *model = gtk_tree_view_get_model(filter_list);
     GtkTreeIter iter;
@@ -58,10 +58,8 @@ fr_clean_associated_mailbox_filters(GtkTreeView *filter_list)
     }
 }
 
-
 static GSList *
-build_selected_filters_list(GtkTreeView *filter_list,
-                            gboolean     to_run)
+build_selected_filters_list(GtkTreeView * filter_list, gboolean to_run)
 {
     GtkTreeModel *model = gtk_tree_view_get_model(filter_list);
     GtkTreeIter iter;
@@ -77,166 +75,146 @@ build_selected_filters_list(GtkTreeView *filter_list,
         filters =
             g_slist_prepend(filters,
                             to_run ? (gpointer) fil->actual_filter
-                            : (gpointer) fil);
+                                   : (gpointer) fil);
     }
 
     return g_slist_reverse(filters);
 }
 
-
 /*
  * Run the selected filters on the mailbox
  * Returns TRUE if OK, or FALSE if errors occurred
  */
 static gboolean
-run_filters_on_mailbox(GSList          *filters,
-                       LibBalsaMailbox *mbox)
+run_filters_on_mailbox(GSList * filters, LibBalsaMailbox * mbox)
 {
     guint sent_to_trash;
 
-    if (!filters_prepare_to_run(filters)) {
-        return FALSE;
-    }
+    if (!filters_prepare_to_run(filters))
+       return FALSE;
 
     sent_to_trash = 0;
     for (; filters; filters = filters->next) {
-        LibBalsaFilter *filter = filters->data;
-        LibBalsaMailboxSearchIter *search_iter;
-        guint msgno;
-        GArray *messages;
-
-        if (!filter->condition) {
-            continue;
-        }
-        search_iter = libbalsa_mailbox_search_iter_new(filter->condition);
-
-        /* Build a list of matching messages;
-         * - to use the existing search_iter methods, we go repeatedly
-         *   to the mailbox;
-         * - for the local mailboxes, that may be reasonable;
-         * - for imap, it can surely be improved--the backend caches the
-         * search results (in the search-iter), so we don't go
-         * repeatedly to the server, but each test is a hash-table
-         * lookup; the question is how to design an api that handles
-         * cleanly both this search and mailbox searching.
-         */
-        messages = g_array_new(FALSE, FALSE, sizeof(guint));
-        for (msgno = 1; msgno <= libbalsa_mailbox_total_messages(mbox);
-             msgno++) {
-            if (libbalsa_mailbox_message_match(mbox, msgno, search_iter)) {
-                g_array_append_val(messages, msgno);
-            }
-        }
-        libbalsa_mailbox_search_iter_unref(search_iter);
-
-        libbalsa_mailbox_register_msgnos(mbox, messages);
-        sent_to_trash +=
-            libbalsa_filter_mailbox_messages(filter, mbox, messages);
-        libbalsa_mailbox_unregister_msgnos(mbox, messages);
-        g_array_free(messages, TRUE);
+       LibBalsaFilter *filter = filters->data;
+       LibBalsaMailboxSearchIter *search_iter;
+       guint msgno;
+       GArray *messages;
+
+       if (!filter->condition)
+           continue;
+       search_iter = libbalsa_mailbox_search_iter_new(filter->condition);
+
+       /* Build a list of matching messages;
+        * - to use the existing search_iter methods, we go repeatedly
+        *   to the mailbox;
+        * - for the local mailboxes, that may be reasonable;
+        * - for imap, it can surely be improved--the backend caches the
+        * search results (in the search-iter), so we don't go
+        * repeatedly to the server, but each test is a hash-table
+        * lookup; the question is how to design an api that handles
+        * cleanly both this search and mailbox searching.
+        */
+       messages = g_array_new(FALSE, FALSE, sizeof(guint));
+       for (msgno = 1; msgno <= libbalsa_mailbox_total_messages(mbox);
+            msgno++)
+           if (libbalsa_mailbox_message_match(mbox, msgno, search_iter))
+               g_array_append_val(messages, msgno);
+       libbalsa_mailbox_search_iter_unref(search_iter);
+
+       libbalsa_mailbox_register_msgnos(mbox, messages);
+       sent_to_trash +=
+           libbalsa_filter_mailbox_messages(filter, mbox, messages);
+       libbalsa_mailbox_unregister_msgnos(mbox, messages);
+       g_array_free(messages, TRUE);
     }
 
-    if (sent_to_trash) {
-        enable_empty_trash(balsa_app.main_window, TRASH_FULL);
-    }
+    if (sent_to_trash)
+       enable_empty_trash(balsa_app.main_window, TRASH_FULL);
 
     return TRUE;
 }
 
-
 /* "destroy" callback */
 
-void
-fr_destroy_window_cb(GtkWidget *widget,
-                     gpointer   throwaway)
+void fr_destroy_window_cb(GtkWidget * widget,gpointer throwaway)
 {
     /* We pull out the destructed dialog from the list of opened dialogs */
-    fr_dialogs_opened = g_list_remove(fr_dialogs_opened, widget);
+    fr_dialogs_opened=g_list_remove(fr_dialogs_opened,widget);
 }
 
-
 static
-void
-save_filters(BalsaFilterRunDialog *p)
+void save_filters(BalsaFilterRunDialog * p)
 {
     if (p->filters_modified) {
-        g_slist_free_full(p->mbox->filters, g_free);
-        p->mbox->filters = build_selected_filters_list(p->selected_filters, FALSE);
-        config_mailbox_filters_save(p->mbox);
-        p->filters_modified = FALSE;
+       g_slist_free_full(p->mbox->filters, g_free);
+       p->mbox->filters = build_selected_filters_list(p->selected_filters,FALSE);
+       config_mailbox_filters_save(p->mbox);
+       p->filters_modified=FALSE;
     }
 }
 
-
 /* Dialog box button callbacks */
-void
-fr_dialog_response(GtkWidget *widget,
-                   gint       response,
-                   gpointer   throwaway)
+void fr_dialog_response(GtkWidget * widget, gint response,
+                       gpointer throwaway)
 {
-    BalsaFilterRunDialog *p;
+    BalsaFilterRunDialog * p;
     GError *err = NULL;
 
-    p = BALSA_FILTER_RUN_DIALOG(widget);
+    p=BALSA_FILTER_RUN_DIALOG(widget);
     switch (response) {
     case GTK_RESPONSE_OK:       /* OK button */
-        save_filters(p);
-        break;
+       save_filters(p);
+       break;
 
     case GTK_RESPONSE_CANCEL:   /* Cancel button */
     case GTK_RESPONSE_NONE:     /* Close window */
-        /* We free the mailbox_filter datas, they are useless now */
-        fr_clean_associated_mailbox_filters(p->selected_filters);
-
-        break;
+       /* We free the mailbox_filter datas, they are useless now */
+       fr_clean_associated_mailbox_filters(p->selected_filters);
 
+       break;
     case GTK_RESPONSE_HELP:     /* Help button */
         gtk_show_uri_on_window(GTK_WINDOW(widget),
                                "help:balsa/win-run-filters",
                                gtk_get_current_event_time(), &err);
-        if (err) {
-            balsa_information_parented(GTK_WINDOW(widget),
-                                       LIBBALSA_INFORMATION_WARNING,
-                                       _("Error displaying run filters help: %s\n"),
-                                       err->message);
-            g_error_free(err);
-        }
-        return;
+       if (err) {
+           balsa_information_parented(GTK_WINDOW(widget),
+                   LIBBALSA_INFORMATION_WARNING,
+                   _("Error displaying run filters help: %s\n"),
+                   err->message);
+           g_error_free(err);
+       }
+       return;
 
     default:
-        /* we should NEVER get here */
-        break;
+       /* we should NEVER get here */
+       break;
     }
     gtk_widget_destroy(GTK_WIDGET(p));
 }
 
 
 /*
- * Callbacks for apply/left/right buttons
+ *Callbacks for apply/left/right buttons
  */
 
 static void
-fr_apply_selected_pressed_func(GtkTreeModel *model,
-                               GtkTreePath  *path,
-                               GtkTreeIter  *iter,
-                               gpointer      data)
+fr_apply_selected_pressed_func(GtkTreeModel * model, GtkTreePath * path,
+                               GtkTreeIter * iter, gpointer data)
 {
     LibBalsaFilter *fil;
     BalsaFilterRunDialog *p = data;
 
     gtk_tree_model_get(model, iter, DATA_COLUMN, &fil, -1);
     /* Check for move to self: */
-    if ((fil->action == FILTER_RUN)
-        || (fil->action == FILTER_TRASH)
-        || ((fil->action == FILTER_COLOR) && fil->action_string[0])
-        || (strcmp(fil->action_string, p->mbox->url) != 0)) {
+    if (fil->action == FILTER_RUN
+        || fil->action == FILTER_TRASH
+        || (fil->action == FILTER_COLOR && fil->action_string[0])
+        || strcmp(fil->action_string, p->mbox->url) != 0)
         p->filters = g_slist_append(p->filters, fil);
-    }
 }
 
-
 void
-fr_apply_selected_pressed(BalsaFilterRunDialog *p)
+fr_apply_selected_pressed(BalsaFilterRunDialog * p)
 {
     GtkTreeSelection *selection =
         gtk_tree_view_get_selection(p->available_filters);
@@ -245,61 +223,53 @@ fr_apply_selected_pressed(BalsaFilterRunDialog *p)
     gtk_tree_selection_selected_foreach(selection,
                                         fr_apply_selected_pressed_func, p);
 
-    if (!p->filters) {
+    if (!p->filters)
         return;
-    }
 
-    if (!run_filters_on_mailbox(p->filters, p->mbox)) {
+    if (!run_filters_on_mailbox(p->filters, p->mbox))
         balsa_information_parented(GTK_WINDOW(p),
                                    LIBBALSA_INFORMATION_ERROR,
                                    _("Error when applying filters"));
-    } else {
+    else
         balsa_information(LIBBALSA_INFORMATION_MESSAGE,
                           _("Filter applied to “%s”."),
                           p->mbox->name);
-    }
 
     g_slist_free(p->filters);
 }
 
-
 void
-fr_apply_now_pressed(BalsaFilterRunDialog *p)
+fr_apply_now_pressed(BalsaFilterRunDialog* p)
 {
     GSList *filters;
 
     filters = build_selected_filters_list(p->selected_filters, TRUE);
 
-    if (!filters) {
+    if (!filters)
         return;
-    }
 
-    if (!run_filters_on_mailbox(filters, p->mbox)) {
+    if (!run_filters_on_mailbox(filters, p->mbox))
         balsa_information_parented(GTK_WINDOW(p),
                                    LIBBALSA_INFORMATION_ERROR,
                                    _("Error when applying filters"));
-    } else {
+    else
         balsa_information(LIBBALSA_INFORMATION_MESSAGE,
                           _("Filter applied to “%s”."),
                           p->mbox->name);
-    }
 }
 
-
 static void
-fr_add_pressed_func(GtkTreeModel *model,
-                    GtkTreePath  *path,
-                    GtkTreeIter  *iter,
-                    gpointer      data)
+fr_add_pressed_func(GtkTreeModel * model, GtkTreePath * path,
+                    GtkTreeIter * iter, gpointer data)
 {
     BalsaFilterRunDialog *p = data;
     LibBalsaFilter *fil;
 
     gtk_tree_model_get(model, iter, DATA_COLUMN, &fil, -1);
-    if ((fil->action == FILTER_RUN)
-        || (fil->action == FILTER_TRASH)
-        || ((fil->action == FILTER_COLOR) && fil->action_string[0])
-        || (strcmp(fil->action_string, p->mbox->url) != 0)) {
+    if (fil->action == FILTER_RUN
+        || fil->action == FILTER_TRASH
+        || (fil->action == FILTER_COLOR && fil->action_string[0])
+        || strcmp(fil->action_string, p->mbox->url) != 0) {
         /* Ok we can add the filter to this mailbox, there is no recursion problem */
         LibBalsaMailboxFilter *mf = g_new(LibBalsaMailboxFilter, 1);
         GtkTreeModel *sel_model =
@@ -321,30 +291,27 @@ fr_add_pressed_func(GtkTreeModel *model,
         /* Mark for later deletion */
         gtk_list_store_set(GTK_LIST_STORE(model), iter,
                            DATA_COLUMN, NULL, -1);
-    } else {
+    } else
         balsa_information(LIBBALSA_INFORMATION_ERROR,
                           _("The destination mailbox of "
                             "the filter “%s” is “%s”.\n"
                             "You can’t associate it with the same "
                             "mailbox (that causes recursion)."),
                           fil->name, p->mbox->name);
-    }
 
-    if (!libbalsa_mailbox_can_match(p->mbox, fil->condition)) {
-        balsa_information(LIBBALSA_INFORMATION_WARNING,
-                          _("The filter “%s” is not compatible with "
-                            "the mailbox type of “%s”.\n"
-                            "This happens for example when you use"
-                            " regular expressions match with IMAP mailboxes,"
-                            " it is done by a very slow method; if possible, use substring match"
-                            " instead."),
-                          fil->name, p->mbox->name);
-    }
+    if (!libbalsa_mailbox_can_match(p->mbox, fil->condition))
+       balsa_information(LIBBALSA_INFORMATION_WARNING,
+                         _("The filter “%s” is not compatible with "
+                           "the mailbox type of “%s”.\n"
+                           "This happens for example when you use"
+                           " regular expressions match with IMAP mailboxes,"
+                           " it is done by a very slow method; if possible, use substring match"
+                           " instead."),
+                         fil->name, p->mbox->name);
 }
 
-
 void
-fr_add_pressed(BalsaFilterRunDialog *p)
+fr_add_pressed(BalsaFilterRunDialog* p)
 {
     GtkTreeSelection *selection =
         gtk_tree_view_get_selection(p->available_filters);
@@ -354,9 +321,9 @@ fr_add_pressed(BalsaFilterRunDialog *p)
     gboolean valid;
     gboolean modified = FALSE;
 
-    /* We check possibility of recursion here: we do not allow a filter
+    /* We check possibility of recursion here: we do not allow a filter 
        to be applied on a mailbox if its action rule modify this mailbox
-     */
+    */
     gtk_tree_selection_selected_foreach(selection, fr_add_pressed_func, p);
 
     valid = gtk_tree_model_get_iter_first(model, &iter);
@@ -370,26 +337,21 @@ fr_add_pressed(BalsaFilterRunDialog *p)
             gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
             modified = TRUE;
             valid = gtk_tree_model_get_iter(model, &iter, path);
-            if (valid) {
+            if (valid)
                 gtk_tree_selection_select_path(selection, path);
-            } else if (gtk_tree_path_prev(path)) {
+            else if (gtk_tree_path_prev(path))
                 gtk_tree_selection_select_path(selection, path);
-            }
             gtk_tree_path_free(path);
-        } else {
+        } else
             valid = gtk_tree_model_iter_next(model, &iter);
-        }
     }
 
     p->filters_modified = modified;
 }
 
-
 static void
-fr_remove_pressed_func(GtkTreeModel *model,
-                       GtkTreePath  *path,
-                       GtkTreeIter  *iter,
-                       gpointer      data)
+fr_remove_pressed_func(GtkTreeModel * model, GtkTreePath * path, 
+                       GtkTreeIter * iter, gpointer data)
 {
     BalsaFilterRunDialog *p = data;
     LibBalsaMailboxFilter *fil;
@@ -413,9 +375,8 @@ fr_remove_pressed_func(GtkTreeModel *model,
     g_free(fil);
 }
 
-
 void
-fr_remove_pressed(BalsaFilterRunDialog *p)
+fr_remove_pressed(BalsaFilterRunDialog * p)
 {
     GtkTreeSelection *selection =
         gtk_tree_view_get_selection(p->selected_filters);
@@ -436,35 +397,28 @@ fr_remove_pressed(BalsaFilterRunDialog *p)
 
             gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
             valid = gtk_tree_model_get_iter(model, &iter, path);
-            if (valid) {
+            if (valid)
                 gtk_tree_selection_select_path(selection, path);
-            } else if (gtk_tree_path_prev(path)) {
+            else if (gtk_tree_path_prev(path))
                 gtk_tree_selection_select_path(selection, path);
-            }
             gtk_tree_path_free(path);
-        } else {
+        } else
             valid = gtk_tree_model_iter_next(model, &iter);
-        }
     }
 }
 
-
 /* Callbacks for filter lists */
 
 void
-available_list_activated(GtkTreeView       *treeview,
-                         GtkTreePath       *path,
-                         GtkTreeViewColumn *column,
-                         gpointer           data)
+available_list_activated(GtkTreeView * treeview, GtkTreePath * path,
+                         GtkTreeViewColumn * column, gpointer data)
 {
     fr_add_pressed(BALSA_FILTER_RUN_DIALOG(data));
 }
 
-
 void
-selected_list_toggled(GtkCellRendererToggle *renderer,
-                      const gchar           *path_string,
-                      gpointer               data)
+selected_list_toggled(GtkCellRendererToggle * renderer,
+                      const gchar * path_string, gpointer data)
 {
     gint column = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(renderer),
                                                     BALSA_FILTER_KEY));
@@ -481,52 +435,42 @@ selected_list_toggled(GtkCellRendererToggle *renderer,
     gtk_list_store_set(GTK_LIST_STORE(model), &iter, column, !active, -1);
 
     switch (column) {
-    case INCOMING_COLUMN:
-        mask = FILTER_WHEN_INCOMING;
-        break;
-
-    case CLOSING_COLUMN:
-        mask = FILTER_WHEN_CLOSING;
-        break;
-
-    default:
-        mask = FILTER_WHEN_NEVER;
-        break;
+        case INCOMING_COLUMN:
+            mask = FILTER_WHEN_INCOMING;
+            break;
+        case CLOSING_COLUMN:
+            mask = FILTER_WHEN_CLOSING;
+            break;
+        default:
+            mask = FILTER_WHEN_NEVER;
+            break;
     }
-    if (active) {
+    if (active)
         FILTER_WHEN_CLRFLAG(fil, mask);
-    } else {
+    else
         FILTER_WHEN_SETFLAG(fil, mask);
-    }
 
     p->filters_modified = TRUE;
 }
 
-
 void
-selected_list_activated(GtkTreeView       *treeview,
-                        GtkTreePath       *path,
-                        GtkTreeViewColumn *column,
-                        gpointer           data)
+selected_list_activated(GtkTreeView * treeview, GtkTreePath * path,
+                        GtkTreeViewColumn * column, gpointer data)
 {
     fr_remove_pressed(BALSA_FILTER_RUN_DIALOG(data));
 }
 
-
-/*
- * Callbacks for up/down buttons
+/* 
+ *Callbacks for up/down buttons
  */
 
 /*
  * helper
  */
 static void
-fr_swap(GtkTreeModel         *model,
-        GtkTreeIter          *iter1,
-        GtkTreeIter          *iter2,
-        GtkTreeSelection     *selection,
-        GtkTreePath          *path,
-        BalsaFilterRunDialog *p)
+fr_swap(GtkTreeModel * model, GtkTreeIter * iter1, GtkTreeIter * iter2,
+        GtkTreeSelection * selection, GtkTreePath * path,
+        BalsaFilterRunDialog * p)
 {
     LibBalsaMailboxFilter *fil1, *fil2;
     gboolean incoming1, closing1;
@@ -557,15 +501,13 @@ fr_swap(GtkTreeModel         *model,
     p->filters_modified = TRUE;
 }
 
-
 /*
  * fr_down_pressed()
  *
  * Callback for the "Down" button
  */
 void
-fr_down_pressed(GtkWidget *widget,
-                gpointer   data)
+fr_down_pressed(GtkWidget * widget, gpointer data)
 {
     BalsaFilterRunDialog *p = data;
     GtkTreeModel *model;
@@ -583,15 +525,13 @@ fr_down_pressed(GtkWidget *widget,
     }
 }                               /* end fe_down_pressed */
 
-
 /*
  * fr_up_pressed()
  *
  * Callback for the "Up" button
  */
 void
-fr_up_pressed(GtkWidget *widget,
-              gpointer   data)
+fr_up_pressed(GtkWidget * widget, gpointer data)
 {
     BalsaFilterRunDialog *p = data;
     GtkTreeModel *model;
diff --git a/src/filter-run-dialog.c b/src/filter-run-dialog.c
index 5dcea8d..eafda90 100644
--- a/src/filter-run-dialog.c
+++ b/src/filter-run-dialog.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <string.h>
@@ -53,42 +53,40 @@ enum {
 static GObjectClass *parent_class = NULL;
 static gint balsa_filter_run_dialog_signals[LAST_SIGNAL];
 
-GList *fr_dialogs_opened = NULL;
+GList * fr_dialogs_opened=NULL;
 
 /* BalsaFilterRunDialog methods */
 
 static void balsa_filter_run_dialog_class_init(BalsaFilterRunDialogClass *
                                                klass);
-static void balsa_filter_run_dialog_init(BalsaFilterRunDialog *p);
-static void balsa_filter_run_dispose(GObject *object);
+static void balsa_filter_run_dialog_init(BalsaFilterRunDialog * p);
+static void balsa_filter_run_dispose(GObject * object);
 
-static void fr_refresh(BalsaFilterRunDialog *dialog,
-                       GSList               *names_changing,
-                       gpointer              throwaway);
+static void fr_refresh(BalsaFilterRunDialog * dialog,
+                       GSList * names_changing, gpointer throwaway);
 
-static void
-populate_available_filters_list(GtkTreeView *filter_list,
-                                GSList      *mailbox_filters)
+static void 
+populate_available_filters_list(GtkTreeView * filter_list,
+                                GSList * mailbox_filters)
 {
     LibBalsaFilter *fil;
     GSList *source, *lst;
     GtkTreeModel *model = gtk_tree_view_get_model(filter_list);
     GtkTreeIter iter;
 
-    for (source = balsa_app.filters; source; source = source->next) {
-        fil = (LibBalsaFilter *)source->data;
-        /* We look for each filter in the mailbox list */
-        for (lst = mailbox_filters;
-             lst && fil != ((LibBalsaMailboxFilter *)lst->data)->actual_filter;
-             lst = lst->next) {
-        }
-        /* If it's not in mailbox list we can add it to available filters */
-        if (!lst) {
+    for (source=balsa_app.filters;source;source=source->next) {
+       fil=(LibBalsaFilter *)source->data;
+       /* We look for each filter in the mailbox list */
+       for (lst=mailbox_filters;
+             lst && fil!=((LibBalsaMailboxFilter*)lst->data)->actual_filter;
+             lst=lst->next);
+       /* If it's not in mailbox list we can add it to available filters */
+       if (!lst) {
             gtk_list_store_prepend(GTK_LIST_STORE(model), &iter);
             gtk_list_store_set(GTK_LIST_STORE(model), &iter,
                                NAME_COLUMN, fil->name,
                                DATA_COLUMN, fil, -1);
-        }
+       }
     }
     if (gtk_tree_model_get_iter_first(model, &iter)) {
         GtkTreeSelection *selection =
@@ -97,12 +95,11 @@ populate_available_filters_list(GtkTreeView *filter_list,
     }
 }
 
-
 /* Set the toggle button corresponding to the when type */
 
 static void
-populate_selected_filters_list(GtkTreeView *filter_list,
-                               GSList      *filters_list)
+populate_selected_filters_list(GtkTreeView * filter_list,
+                               GSList * filters_list)
 {
     LibBalsaMailboxFilter *fil, *mf;
     GtkTreeModel *model = gtk_tree_view_get_model(filter_list);
@@ -113,8 +110,8 @@ populate_selected_filters_list(GtkTreeView *filter_list,
         fil = (LibBalsaMailboxFilter *) filters_list->data;
         *mf = *fil;
         gtk_list_store_append(GTK_LIST_STORE(model), &iter);
-        gtk_list_store_set(GTK_LIST_STORE(model), &iter,
-                           NAME_COLUMN, fil->actual_filter->name,
+        gtk_list_store_set(GTK_LIST_STORE(model), &iter, 
+                           NAME_COLUMN, fil->actual_filter->name, 
                            DATA_COLUMN, mf,
                            INCOMING_COLUMN,
                            FILTER_WHEN_CHKFLAG(fil, FILTER_WHEN_INCOMING),
@@ -129,28 +126,27 @@ populate_selected_filters_list(GtkTreeView *filter_list,
     }
 }
 
-
 GType
 balsa_filter_run_dialog_get_type(void)
 {
     static GType balsa_filter_run_dialog_type = 0;
 
     if (!balsa_filter_run_dialog_type) {
-        GTypeInfo balsa_filter_run_dialog_info = {
-            sizeof(BalsaFilterRunDialogClass),
+       GTypeInfo balsa_filter_run_dialog_info = {
+           sizeof(BalsaFilterRunDialogClass),
             NULL,               /* base_init */
             NULL,               /* base_finalize */
-            (GClassInitFunc) balsa_filter_run_dialog_class_init,
+           (GClassInitFunc) balsa_filter_run_dialog_class_init,
             NULL,               /* class_finalize */
             NULL,               /* class_data */
-            sizeof(BalsaFilterRunDialog),
+           sizeof(BalsaFilterRunDialog),
             0,                  /* n_preallocs */
-            (GInstanceInitFunc) balsa_filter_run_dialog_init
-        };
+           (GInstanceInitFunc) balsa_filter_run_dialog_init
+       };
 
-        balsa_filter_run_dialog_type =
-            g_type_register_static(GTK_TYPE_DIALOG,
-                                   "BalsaFilterRunDialog",
+       balsa_filter_run_dialog_type =
+           g_type_register_static(GTK_TYPE_DIALOG,
+                                  "BalsaFilterRunDialog",
                                    &balsa_filter_run_dialog_info, 0);
     }
 
@@ -159,18 +155,18 @@ balsa_filter_run_dialog_get_type(void)
 
 
 static void
-balsa_filter_run_dialog_class_init(BalsaFilterRunDialogClass *klass)
+balsa_filter_run_dialog_class_init(BalsaFilterRunDialogClass * klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS(klass);
     parent_class = g_type_class_peek_parent(klass);
 
     balsa_filter_run_dialog_signals[REFRESH] =
-        g_signal_new("refresh",
+       g_signal_new("refresh",
                      G_TYPE_FROM_CLASS(object_class),
                      G_SIGNAL_RUN_FIRST,
-                     G_STRUCT_OFFSET(BalsaFilterRunDialogClass, refresh),
+                    G_STRUCT_OFFSET(BalsaFilterRunDialogClass, refresh),
                      NULL, NULL,
-                     g_cclosure_marshal_VOID__OBJECT,
+                    g_cclosure_marshal_VOID__OBJECT,
                      G_TYPE_NONE, 1, G_TYPE_OBJECT);
 
     object_class->dispose = balsa_filter_run_dispose;
@@ -178,13 +174,11 @@ balsa_filter_run_dialog_class_init(BalsaFilterRunDialogClass *klass)
     klass->refresh = fr_refresh;
 }
 
-
 static GtkWidget *
-balsa_filter_run_dialog_new(LibBalsaMailbox *mbox,
-                            GtkWindow       *parent)
+balsa_filter_run_dialog_new(LibBalsaMailbox * mbox, GtkWindow * parent)
 {
     BalsaFilterRunDialog *p;
-    gchar *dialog_title;
+    gchar * dialog_title;
     gboolean use_headerbar = TRUE;
 
     g_return_val_if_fail(mbox, NULL);
@@ -197,29 +191,27 @@ balsa_filter_run_dialog_new(LibBalsaMailbox *mbox,
                      NULL);
 
     /* We set the dialog title */
-    p->mbox = mbox;
-    libbalsa_mailbox_open(p->mbox, NULL);
-    dialog_title = g_strconcat(_("Filters of Mailbox: "),
-                               p->mbox->name, NULL);
-    gtk_window_set_title(GTK_WINDOW(p), dialog_title);
+    p->mbox=mbox;
+    libbalsa_mailbox_open(p->mbox, NULL); 
+    dialog_title=g_strconcat(_("Filters of Mailbox: "),
+                             p->mbox->name,NULL);
+    gtk_window_set_title(GTK_WINDOW(p),dialog_title);
     gtk_window_set_role(GTK_WINDOW(p), "filter-run");
     g_free(dialog_title);
 
     /* Load associated filters if needed */
-    if (!p->mbox->filters) {
-        config_mailbox_filters_load(p->mbox);
-    }
+    if (!p->mbox->filters)
+       config_mailbox_filters_load(p->mbox);
 
     /* Populate the lists */
-    populate_available_filters_list(p->available_filters, mbox->filters);
-    populate_selected_filters_list(p->selected_filters, mbox->filters);
+    populate_available_filters_list(p->available_filters,mbox->filters);
+    populate_selected_filters_list(p->selected_filters,mbox->filters);
 
     return GTK_WIDGET(p);
 }
 
-
 static GtkTreeView *
-selected_filters_new(BalsaFilterRunDialog *p)
+selected_filters_new(BalsaFilterRunDialog * p)
 {
     GtkListStore *list_store;
     GtkTreeView *view;
@@ -238,25 +230,25 @@ selected_filters_new(BalsaFilterRunDialog *p)
     gtk_tree_view_append_column(view, column);
 
     renderer = gtk_cell_renderer_toggle_new();
-    g_object_set_data(G_OBJECT(renderer), BALSA_FILTER_KEY,
+    g_object_set_data(G_OBJECT(renderer), BALSA_FILTER_KEY, 
                       GINT_TO_POINTER(INCOMING_COLUMN));
     g_signal_connect(G_OBJECT(renderer), "toggled",
                      G_CALLBACK(selected_list_toggled), p);
     column = gtk_tree_view_column_new_with_attributes(_("On reception"),
                                                       renderer,
-                                                      "active",
+                                                      "active", 
                                                       INCOMING_COLUMN,
                                                       NULL);
     gtk_tree_view_append_column(view, column);
 
     renderer = gtk_cell_renderer_toggle_new();
-    g_object_set_data(G_OBJECT(renderer), BALSA_FILTER_KEY,
+    g_object_set_data(G_OBJECT(renderer), BALSA_FILTER_KEY, 
                       GINT_TO_POINTER(CLOSING_COLUMN));
     g_signal_connect(G_OBJECT(renderer), "toggled",
                      G_CALLBACK(selected_list_toggled), p);
     column = gtk_tree_view_column_new_with_attributes(_("On exit"),
                                                       renderer,
-                                                      "active",
+                                                      "active", 
                                                       CLOSING_COLUMN,
                                                       NULL);
     gtk_tree_view_append_column(view, column);
@@ -264,14 +256,13 @@ selected_filters_new(BalsaFilterRunDialog *p)
     return view;
 }
 
-
 /*
  * Callbacks for the selection "changed" signal of the available and
  * selected lists
  */
 static void
-available_list_selection_changed(GtkTreeSelection *selection,
-                                 gpointer          user_data)
+available_list_selection_changed(GtkTreeSelection * selection,
+                                 gpointer           user_data)
 {
     BalsaFilterRunDialog *p = user_data;
     gboolean selected;
@@ -281,10 +272,9 @@ available_list_selection_changed(GtkTreeSelection *selection,
     gtk_widget_set_sensitive(p->add_button, selected);
 }
 
-
 static void
-selected_list_selection_changed(GtkTreeSelection *selection,
-                                gpointer          user_data)
+selected_list_selection_changed(GtkTreeSelection * selection,
+                                gpointer           user_data)
 {
     BalsaFilterRunDialog *p = user_data;
     gboolean selected;
@@ -296,12 +286,10 @@ selected_list_selection_changed(GtkTreeSelection *selection,
     gtk_widget_set_sensitive(p->move_down_button, selected);
 }
 
-
-static
-void
-balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
+static 
+void balsa_filter_run_dialog_init(BalsaFilterRunDialog * p)
 {
-    GtkWidget *bbox, *hbox, *vbox;
+    GtkWidget * bbox, * hbox,* vbox;
     GtkTreeSelection *selection;
     GtkWidget *button;
     GtkWidget *sw;
@@ -314,18 +302,18 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
 
     /*
        /-----------------\
-     | /---\  | /---\  |
-     | |   | -> |   |  |
-     | |   |  | |   |  |
-     | |   | <- |   |  |
-     | \---/  | \---/  |
-     \-----------------/
+       | /---\  | /---\  |
+       | |   | -> |   |  |
+       | |   |  | |   |  |
+       | |   | <- |   |  |
+       | \---/  | \---/  |
+       \-----------------/
      */
 
     gtk_dialog_add_buttons(GTK_DIALOG(p),
-                           _("_OK"), GTK_RESPONSE_OK,
+                           _("_OK"),     GTK_RESPONSE_OK,
                            _("_Cancel"), GTK_RESPONSE_CANCEL,
-                           _("_Help"), GTK_RESPONSE_HELP,
+                           _("_Help"),   GTK_RESPONSE_HELP,
                            NULL);
 
     g_signal_connect(G_OBJECT(p), "response",
@@ -333,7 +321,7 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
     g_signal_connect(G_OBJECT(p), "destroy",
                      G_CALLBACK(fr_destroy_window_cb), NULL);
 
-    hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
+    hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2);
 
     gtk_widget_set_vexpand(hbox, TRUE);
     gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(p))), hbox);
@@ -354,8 +342,8 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
 
     sw = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
-                                   GTK_POLICY_AUTOMATIC,
-                                   GTK_POLICY_AUTOMATIC);
+                                  GTK_POLICY_AUTOMATIC,
+                                  GTK_POLICY_AUTOMATIC);
 
     gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(p->available_filters));
     gtk_widget_set_vexpand(sw, TRUE);
@@ -369,7 +357,7 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
 
     /* "Apply selected" button */
     p->apply_selected_button = button =
-            gtk_button_new_with_mnemonic(_("_Apply Selected"));
+        gtk_button_new_with_mnemonic(_("_Apply Selected"));
     gtk_widget_set_sensitive(button, FALSE);
     g_signal_connect_swapped(G_OBJECT(button), "clicked",
                              G_CALLBACK(fr_apply_selected_pressed), p);
@@ -382,7 +370,7 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
 
     /* Right/Add button */
     p->add_button = button =
-            gtk_button_new_from_icon_name("go-next-symbolic");
+        gtk_button_new_from_icon_name("go-next-symbolic");
     gtk_widget_set_tooltip_text(button,
                                 _("Add selected filter to mailbox"));
     gtk_widget_set_sensitive(button, FALSE);
@@ -391,7 +379,7 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
     gtk_box_pack_start(GTK_BOX(bbox), button);
     /* Left/Remove button */
     p->remove_button = button =
-            gtk_button_new_from_icon_name("go-previous-symbolic");
+        gtk_button_new_from_icon_name("go-previous-symbolic");
     gtk_widget_set_tooltip_text(button,
                                 _("Remove selected filter from mailbox"));
     gtk_widget_set_sensitive(button, FALSE);
@@ -409,8 +397,8 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
 
     sw = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
-                                   GTK_POLICY_AUTOMATIC,
-                                   GTK_POLICY_AUTOMATIC);
+                                  GTK_POLICY_AUTOMATIC,
+                                  GTK_POLICY_AUTOMATIC);
 
     p->selected_filters = selected_filters_new(p);
     g_signal_connect(G_OBJECT(p->selected_filters), "row-activated",
@@ -434,40 +422,39 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
 
     /* up button */
     p->move_up_button = button =
-            gtk_button_new_from_icon_name("go-up-symbolic");
+        gtk_button_new_from_icon_name("go-up-symbolic");
     gtk_widget_set_sensitive(button, FALSE);
     gtk_widget_set_tooltip_text(button,
                                 _("Move selected filter up"));
     g_signal_connect(G_OBJECT(button), "clicked",
-                     G_CALLBACK(fr_up_pressed), p);
+                    G_CALLBACK(fr_up_pressed), p);
     gtk_box_pack_start(GTK_BOX(bbox), button);
     /* down button */
     p->move_down_button = button =
-            gtk_button_new_from_icon_name("go-down-symbolic");
+        gtk_button_new_from_icon_name("go-down-symbolic");
     gtk_widget_set_sensitive(button, FALSE);
     gtk_widget_set_tooltip_text(button,
                                 _("Move selected filter down"));
     g_signal_connect(G_OBJECT(button), "clicked",
-                     G_CALLBACK(fr_down_pressed), p);
+                    G_CALLBACK(fr_down_pressed), p);
     gtk_box_pack_start(GTK_BOX(bbox), button);
 
     p->apply_now_button = button =
-            gtk_button_new_with_mnemonic(_("A_pply Now!"));
+        gtk_button_new_with_mnemonic(_("A_pply Now!"));
     gtk_widget_set_sensitive(button, FALSE);
     g_signal_connect_swapped(G_OBJECT(button), "clicked",
                              G_CALLBACK(fr_apply_now_pressed), G_OBJECT(p));
     gtk_box_pack_start(GTK_BOX(bbox), button);
 
-    p->filters_modified = FALSE;
+    p->filters_modified=FALSE;
 }
 
-
 /* balsa_filter_run_dispose:
- */
+*/
 static void
-balsa_filter_run_dispose(GObject *object)
+balsa_filter_run_dispose(GObject * object)
 {
-    BalsaFilterRunDialog *bfrd = BALSA_FILTER_RUN_DIALOG(object);
+    BalsaFilterRunDialog* bfrd = BALSA_FILTER_RUN_DIALOG(object);
 
     if (bfrd->mbox != NULL) {
         libbalsa_mailbox_close(bfrd->mbox, balsa_app.expunge_on_close);
@@ -477,58 +464,51 @@ balsa_filter_run_dispose(GObject *object)
     G_OBJECT_CLASS(parent_class)->dispose(object);
 }
 
-
 static void
-fr_refresh(BalsaFilterRunDialog *fr_dialog,
-           GSList               *names_changing,
-           gpointer              throwaway)
+fr_refresh(BalsaFilterRunDialog * fr_dialog,GSList * names_changing,
+           gpointer throwaway)
 {
-    /* FIXME : this is the future implementation of a signal that will be able to tell each
-       filter-run dialog box
+    /* FIXME : this is the future implementation of a signal that will be able to tell each filter-run 
dialog box
      * that filters have changed and that they have to refresh their content
      * We'll see that later if it's worth the pain
      */
 }
 
-
 /* filter_run_dialog(LibBalsaMailbox *mbox)
  * params:
  *   mbox - the mailbox concerned by edition/running filters
  */
 
 void
-filters_run_dialog(LibBalsaMailbox *mbox,
-                   GtkWindow       *parent)
+filters_run_dialog(LibBalsaMailbox * mbox,
+                   GtkWindow       * parent)
 {
-    GList *lst;
-    GtkWidget *p;
+    GList * lst;
+    GtkWidget * p;
 
     if (fe_already_open) {
-        balsa_information(LIBBALSA_INFORMATION_ERROR,
+       balsa_information(LIBBALSA_INFORMATION_ERROR,
                           _("The filters dialog is opened, close it "
                             "before you can run filters on any mailbox"));
-        return;
+       return;
     }
     /* We look for an existing dialog box for this mailbox */
     for (lst = fr_dialogs_opened; lst != NULL; lst = lst->next) {
         BalsaFilterRunDialog *dialog = lst->data;
-        if (strcmp(dialog->mbox->url, mbox->url) == 0) {
+        if (strcmp(dialog->mbox->url, mbox->url) == 0)
             break;
-        }
     }
     if (lst) {
-        /* If there was yet a dialog box for this mailbox, we raise it */
-        gtk_window_present(GTK_WINDOW(lst->data));
-        return;
+       /* If there was yet a dialog box for this mailbox, we raise it */
+       gtk_window_present(GTK_WINDOW(lst->data));
+       return;
     }
 
     p = balsa_filter_run_dialog_new(mbox, parent);
-    if (!p) {
-        return;
-    }
+    if (!p) return;
 
-    gtk_window_set_default_size(GTK_WINDOW(p), 500, 250);
-    fr_dialogs_opened = g_list_prepend(fr_dialogs_opened, p);
+    gtk_window_set_default_size(GTK_WINDOW(p),500,250);
+    fr_dialogs_opened=g_list_prepend(fr_dialogs_opened,p);
 
     gtk_widget_show(p);
 }
diff --git a/src/filter-run.h b/src/filter-run.h
index 2099ce8..b983ee0 100644
--- a/src/filter-run.h
+++ b/src/filter-run.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -33,7 +33,7 @@
  * We define a new gtk type BalsaFilterRunDialog, inheriting from
  * GtkDialog each object contains the whole set of data needed for
  * managing the dialog box.
- * In that way there is no global variables (but the list of
+ * In that way there is no global variables (but the list of 
  * fr = filter run
  */
 
@@ -41,13 +41,13 @@ G_BEGIN_DECLS
 
 
 #define BALSA_TYPE_FILTER_RUN_DIALOG     \
-    (balsa_filter_run_dialog_get_type())
+     (balsa_filter_run_dialog_get_type())
 #define BALSA_FILTER_RUN_DIALOG(obj)     \
-    G_TYPE_CHECK_INSTANCE_CAST((obj), BALSA_TYPE_FILTER_RUN_DIALOG, BalsaFilterRunDialog)
+     G_TYPE_CHECK_INSTANCE_CAST((obj), BALSA_TYPE_FILTER_RUN_DIALOG, BalsaFilterRunDialog)
 #define BALSA_FILTER_RUN_DIALOG_CLASS(klass) \
-    G_TYPE_CHECK_CLASS_CAST((klass), BALSA_TYPE_FILTER_RUN_DIALOG, BalsaFilterRunDialogClass)
+     G_TYPE_CHECK_CLASS_CAST((klass), BALSA_TYPE_FILTER_RUN_DIALOG, BalsaFilterRunDialogClass)
 #define BALSA_IS_FILTER_RUN_DIALOG(obj)      \
-    G_TYPE_CHECK_INSTANCE_TYPE((obj), BALSA_TYPE_FILTER_RUN_DIALOG)
+     G_TYPE_CHECK_INSTANCE_TYPE((obj), BALSA_TYPE_FILTER_RUN_DIALOG)
 
 enum {
     NAME_COLUMN,
@@ -70,7 +70,7 @@ struct _BalsaFilterRunDialog {
     gboolean filters_modified;
 
     /* Mailbox the filters of which are edited */
-    LibBalsaMailbox *mbox;
+    LibBalsaMailbox * mbox;
 
     /* Temporary list variable */
     GSList *filters;
@@ -85,55 +85,43 @@ struct _BalsaFilterRunDialog {
 };
 
 struct _BalsaFilterRunDialogClass {
-    GtkDialogClass parent_class;
+       GtkDialogClass parent_class;
 
-    void (*refresh) (BalsaFilterRunDialog *fr,
-                     GSList               *filters_changing,
-                     gpointer              throwaway);
+       void (*refresh) (BalsaFilterRunDialog * fr,
+                         GSList * filters_changing, gpointer throwaway);
 };
 
 GType balsa_filter_run_dialog_get_type(void) G_GNUC_CONST;
 
-void fr_clean_associated_mailbox_filters(GtkTreeView *filter_list);
+void fr_clean_associated_mailbox_filters(GtkTreeView * filter_list);
 
-void fr_destroy_window_cb(GtkWidget *widget,
-                          gpointer   throwaway);
+void fr_destroy_window_cb(GtkWidget * widget,gpointer throwaway);
 
 /* Dialog box button callbacks */
-void fr_dialog_response(GtkWidget *widget,
-                        gint       response,
-                        gpointer   data);
-
-/*
- * Callbacks for apply/left/right buttons
+void fr_dialog_response(GtkWidget * widget, gint response, gpointer data);
+/* 
+ *Callbacks for apply/left/right buttons
  */
-void fr_apply_selected_pressed(BalsaFilterRunDialog *dialog);
-void fr_apply_now_pressed(BalsaFilterRunDialog *dialog);
-void fr_add_pressed(BalsaFilterRunDialog *dialog);
-void fr_remove_pressed(BalsaFilterRunDialog *dialog);
+void fr_apply_selected_pressed(BalsaFilterRunDialog* dialog);
+void fr_apply_now_pressed(BalsaFilterRunDialog* dialog);
+void fr_add_pressed(BalsaFilterRunDialog* dialog);
+void fr_remove_pressed(BalsaFilterRunDialog* dialog);
 
-/*
- * Callbacks for up/down buttons
+/* 
+ *Callbacks for up/down buttons
  */
-void fr_up_pressed(GtkWidget *widget,
-                   gpointer   data);
-void fr_down_pressed(GtkWidget *widget,
-                     gpointer   data);
+void fr_up_pressed(GtkWidget * widget, gpointer data);
+void fr_down_pressed(GtkWidget * widget, gpointer data);
 
 /*
  * Callback for filter lists
  */
-void available_list_activated(GtkTreeView       *treeview,
-                              GtkTreePath       *path,
-                              GtkTreeViewColumn *column,
-                              gpointer           data);
-void selected_list_toggled(GtkCellRendererToggle *cellrenderertoggle,
-                           const gchar           *path_string,
-                           gpointer               data);
-void selected_list_activated(GtkTreeView       *treeview,
-                             GtkTreePath       *path,
-                             GtkTreeViewColumn *column,
-                             gpointer           data);
+void available_list_activated(GtkTreeView * treeview, GtkTreePath * path,
+                              GtkTreeViewColumn * column, gpointer data);
+void selected_list_toggled(GtkCellRendererToggle * cellrenderertoggle,
+                           const gchar * path_string, gpointer data);
+void selected_list_activated(GtkTreeView * treeview, GtkTreePath * path,
+                             GtkTreeViewColumn * column, gpointer data);
 
 G_END_DECLS
 
diff --git a/src/folder-conf.c b/src/folder-conf.c
index a919384..3c04206 100644
--- a/src/folder-conf.c
+++ b/src/folder-conf.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "folder-conf.h"
 
@@ -33,17 +33,17 @@
 #include <glib/gi18n.h>
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#  include "macosx-helpers.h"
 #endif
 
 typedef struct _CommonDialogData CommonDialogData;
 typedef struct _FolderDialogData FolderDialogData;
 typedef struct _SubfolderDialogData SubfolderDialogData;
 
-typedef gboolean (*CommonDialogFunc)(CommonDialogData *cdd);
+typedef gboolean (*CommonDialogFunc)(CommonDialogData * cdd);
 
 #define FOLDER_CONF_COMMON \
-    GtkDialog * dialog; \
+    GtkDialog *dialog; \
     BalsaMailboxNode *mbnode; \
     CommonDialogFunc ok
 
@@ -57,10 +57,10 @@ struct _FolderDialogData {
     FOLDER_CONF_COMMON;
     BalsaServerConf bsc;
     GtkWidget *folder_name, *port, *username, *anonymous, *remember,
-              *password, *subscribed, *list_inbox, *prefix;
+        *password, *subscribed, *list_inbox, *prefix;
     GtkWidget *use_ssl, *tls_mode;
     GtkWidget *connection_limit, *enable_persistent,
-              *use_idle, *has_bugs, *use_status;
+        *use_idle, *has_bugs, *use_status;
 };
 
 /* FIXME: identity_name will leak on cancelled folder edition */
@@ -76,23 +76,20 @@ struct _SubfolderDialogData {
 
 /* Destroy notification */
 static void
-folder_conf_destroy_cdd(CommonDialogData *cdd)
+folder_conf_destroy_cdd(CommonDialogData * cdd)
 {
     if (cdd->dialog) {
         /* The mailbox node was destroyed. Close the dialog, but don't
          * trigger further calls to folder_conf_destroy_cdd. */
         cdd->mbnode = NULL;
         gtk_dialog_response(cdd->dialog, GTK_RESPONSE_NONE);
-    } else {
+    } else
         g_free(cdd);
-    }
 }
 
-
 static void
-folder_conf_response(GtkDialog        *dialog,
-                     int               response,
-                     CommonDialogData *cdd)
+folder_conf_response(GtkDialog * dialog, int response,
+                     CommonDialogData * cdd)
 {
     GError *err = NULL;
 
@@ -100,9 +97,8 @@ folder_conf_response(GtkDialog        *dialog,
      * which triggers folder_conf_destroy_cdd, and recursively calls
      * folder_conf_response, which results in cdd being freed before
      * we're done with it; we ref mbnode to avoid that. */
-    if (cdd->mbnode) {
-        g_object_ref(cdd->mbnode);
-    }
+    if (cdd->mbnode)
+       g_object_ref(cdd->mbnode);
     switch (response) {
     case GTK_RESPONSE_HELP:
         gtk_show_uri_on_window(GTK_WINDOW(dialog), "help:balsa/folder-config",
@@ -113,17 +109,13 @@ folder_conf_response(GtkDialog        *dialog,
                               err->message);
             g_error_free(err);
         }
-        if (cdd->mbnode) {
-            g_object_unref(cdd->mbnode);
-        }
+       if (cdd->mbnode)
+           g_object_unref(cdd->mbnode);
         return;
-
     case GTK_RESPONSE_OK:
-        if (!cdd->ok(cdd)) {
+        if(!cdd->ok(cdd))
             break;
-        }
-
-    /* ...or fall over */
+        /* ...or fall over */
     default:
         gtk_widget_destroy(GTK_WIDGET(cdd->dialog));
         cdd->dialog = NULL;
@@ -132,60 +124,51 @@ folder_conf_response(GtkDialog        *dialog,
              * destroyed. It also triggers a call to
              * folder_conf_destroy_cdd, which will free cdd, so we cache
              * cdd->mbnode. */
-            BalsaMailboxNode *mbnode = cdd->mbnode;
+           BalsaMailboxNode *mbnode = cdd->mbnode;
             g_object_set_data(G_OBJECT(mbnode),
                               BALSA_FOLDER_CONF_IMAP_KEY, NULL);
-            g_object_unref(mbnode);
-        } else {
+           g_object_unref(mbnode);
+       } else
             /* Cancelling, without creating a mailbox node. Nobody owns
              * the xDialogData, so we'll free it here. */
             g_free(cdd);
-        }
         break;
     }
 }
 
-
 /* folder_conf_imap_node:
-   show configuration widget for given mailbox node, allow user to
+   show configuration widget for given mailbox node, allow user to 
    modify it and update mailbox node accordingly.
    Creates the node when mn == NULL.
- */
-static void
-validate_folder(GtkWidget        *w,
-                FolderDialogData *fcw)
+*/
+static void 
+validate_folder(GtkWidget *w, FolderDialogData * fcw)
 {
     gboolean sensitive = TRUE;
-    if (!*gtk_entry_get_text(GTK_ENTRY(fcw->folder_name))) {
-        sensitive = FALSE;
-    } else if (!*gtk_entry_get_text(GTK_ENTRY(fcw->bsc.server))) {
-        sensitive = FALSE;
-    }
+    if (!*gtk_entry_get_text(GTK_ENTRY(fcw->folder_name)))
+       sensitive = FALSE;
+    else if (!*gtk_entry_get_text(GTK_ENTRY(fcw->bsc.server)))
+       sensitive = FALSE;
 
     gtk_dialog_set_response_sensitive(fcw->dialog, GTK_RESPONSE_OK, sensitive);
 }
 
-
 static void
-anonymous_cb(GtkToggleButton  *button,
-             FolderDialogData *fcw)
+anonymous_cb(GtkToggleButton * button, FolderDialogData * fcw)
 {
     gtk_widget_set_sensitive(fcw->anonymous,
                              gtk_toggle_button_get_active(button));
 }
 
-
 static void
-remember_cb(GtkToggleButton  *button,
-            FolderDialogData *fcw)
+remember_cb(GtkToggleButton * button, FolderDialogData * fcw)
 {
     gtk_widget_set_sensitive(fcw->password,
                              gtk_toggle_button_get_active(button));
 }
 
-
 static gboolean
-folder_conf_clicked_ok(FolderDialogData *fcw)
+folder_conf_clicked_ok(FolderDialogData * fcw)
 {
     gboolean insert;
     LibBalsaServer *s;
@@ -200,7 +183,7 @@ folder_conf_clicked_ok(FolderDialogData *fcw)
         s = fcw->mbnode->server;
     } else {
         insert = TRUE;
-        s = LIBBALSA_SERVER(libbalsa_imap_server_new(username, host));
+       s = LIBBALSA_SERVER(libbalsa_imap_server_new(username, host));
         g_signal_connect(G_OBJECT(s), "get-password",
                          G_CALLBACK(ask_password), NULL);
     }
@@ -208,20 +191,20 @@ folder_conf_clicked_ok(FolderDialogData *fcw)
     s->tls_mode = balsa_server_conf_get_tls_mode(&fcw->bsc);
     libbalsa_imap_server_set_max_connections
         (LIBBALSA_IMAP_SERVER(s),
-        gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
-                                             (fcw->connection_limit)));
+         gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
+                                          (fcw->connection_limit)));
     libbalsa_imap_server_enable_persistent_cache
         (LIBBALSA_IMAP_SERVER(s),
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fcw->enable_persistent)));
+         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fcw->enable_persistent)));
     libbalsa_imap_server_set_use_idle
-        (LIBBALSA_IMAP_SERVER(s),
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fcw->use_idle)));
+        (LIBBALSA_IMAP_SERVER(s), 
+         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fcw->use_idle)));
     libbalsa_imap_server_set_bug
         (LIBBALSA_IMAP_SERVER(s), ISBUG_FETCH,
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fcw->has_bugs)));
+         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fcw->has_bugs)));
     libbalsa_imap_server_set_use_status
         (LIBBALSA_IMAP_SERVER(s),
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fcw->use_status)));
+         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fcw->use_status)));
     libbalsa_server_set_username(s, username);
     s->try_anonymous =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fcw->anonymous));
@@ -229,11 +212,11 @@ folder_conf_clicked_ok(FolderDialogData *fcw)
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fcw->remember));
     libbalsa_server_set_password(s,
                                  gtk_entry_get_text(GTK_ENTRY
-                                                        (fcw->password)));
+                                                    (fcw->password)));
     if (!fcw->mbnode) {
         fcw->mbnode = balsa_mailbox_node_new_imap_folder(s, NULL);
-        /* mbnode will be unrefed in folder_conf_response. */
-        g_object_ref(fcw->mbnode);
+       /* mbnode will be unrefed in folder_conf_response. */
+       g_object_ref(fcw->mbnode);
         /* The mailbox node takes over ownership of the
          * FolderDialogData. */
         g_object_set_data_full(G_OBJECT(fcw->mbnode),
@@ -251,30 +234,29 @@ folder_conf_clicked_ok(FolderDialogData *fcw)
     fcw->mbnode->list_inbox =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fcw->list_inbox));
 
-    libbalsa_server_set_host(s, host,
+    libbalsa_server_set_host(s, host, 
                              balsa_server_conf_get_use_ssl(&fcw->bsc));
     libbalsa_server_config_changed(s); /* trigger config save */
 
     if (insert) {
-        balsa_mblist_mailbox_node_append(NULL, fcw->mbnode);
+       balsa_mblist_mailbox_node_append(NULL, fcw->mbnode);
         balsa_mailbox_node_append_subtree(fcw->mbnode);
         config_folder_add(fcw->mbnode, NULL);
-        g_signal_connect_swapped(s, "config-changed",
-                                 G_CALLBACK(config_folder_update),
-                                 fcw->mbnode);
+       g_signal_connect_swapped(s, "config-changed",
+                                G_CALLBACK(config_folder_update),
+                                fcw->mbnode);
         update_mail_servers();
     } else {
         balsa_mailbox_node_rescan(fcw->mbnode);
-        balsa_mblist_mailbox_node_redraw(fcw->mbnode);
+       balsa_mblist_mailbox_node_redraw(fcw->mbnode);
     }
     return TRUE;
 }
 
-
 /* folder_conf_imap_node:
    show the IMAP Folder configuration dialog for given mailbox node.
    If mn is NULL, setup it with default values for folder creation.
- */
+*/
 void
 folder_conf_imap_node(BalsaMailboxNode *mn)
 {
@@ -296,7 +278,7 @@ folder_conf_imap_node(BalsaMailboxNode *mn)
     /* Allow only one dialog per mailbox node, and one with mn == NULL
      * for creating a new folder. */
     fcw = mn ? g_object_get_data(G_OBJECT(mn), BALSA_FOLDER_CONF_IMAP_KEY)
-        : fcw_new;
+             : fcw_new;
     if (fcw) {
         gtk_window_present(GTK_WINDOW(fcw->dialog));
         return;
@@ -309,28 +291,28 @@ folder_conf_imap_node(BalsaMailboxNode *mn)
     fcw->mbnode = mn;
     fcw->dialog =
         GTK_DIALOG(gtk_dialog_new_with_buttons
-                       (_("Remote IMAP folder"),
-                       GTK_WINDOW(balsa_app.main_window),
-                       GTK_DIALOG_DESTROY_WITH_PARENT |
-                       libbalsa_dialog_flags(),
-                       mn ? _("_Update") : _("C_reate"), GTK_RESPONSE_OK,
-                       _("_Cancel"), GTK_RESPONSE_CANCEL,
-                       _("_Help"), GTK_RESPONSE_HELP,
-                       NULL));
+                   (_("Remote IMAP folder"),
+                    GTK_WINDOW(balsa_app.main_window),
+                    GTK_DIALOG_DESTROY_WITH_PARENT |
+                    libbalsa_dialog_flags(),
+                    mn ? _("_Update") : _("C_reate"), GTK_RESPONSE_OK,
+                    _("_Cancel"), GTK_RESPONSE_CANCEL,
+                    _("_Help"), GTK_RESPONSE_HELP,
+                    NULL));
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(GTK_WIDGET(fcw->dialog), GTK_WINDOW(balsa_app.main_window));
 #endif
     g_object_add_weak_pointer(G_OBJECT(fcw->dialog),
-                              (gpointer) & fcw->dialog);
+                              (gpointer) &fcw->dialog);
     gtk_window_set_role(GTK_WINDOW(fcw->dialog), "folder_config_dialog");
     if (mn) {
         g_object_set_data_full(G_OBJECT(mn),
-                               BALSA_FOLDER_CONF_IMAP_KEY, fcw,
+                               BALSA_FOLDER_CONF_IMAP_KEY, fcw, 
                                (GDestroyNotify) folder_conf_destroy_cdd);
     } else {
         fcw_new = fcw;
         g_object_add_weak_pointer(G_OBJECT(fcw->dialog),
-                                  (gpointer) & fcw_new);
+                                  (gpointer) &fcw_new);
     }
 
     notebook = gtk_notebook_new();
@@ -342,44 +324,40 @@ folder_conf_imap_node(BalsaMailboxNode *mn)
                              gtk_label_new_with_mnemonic(_("_Basic")));
     advanced = balsa_server_conf_get_advanced_widget(&fcw->bsc, s, 3);
     /* Limit number of connections */
-    fcw->connection_limit =
+    fcw->connection_limit = 
         balsa_server_conf_add_spinner
-            (&fcw->bsc, _("_Max number of connections:"), 1, 40, 1,
-            s
-            ? libbalsa_imap_server_get_max_connections(LIBBALSA_IMAP_SERVER(s))
-            : 20);
-    fcw->enable_persistent =
+        (&fcw->bsc, _("_Max number of connections:"), 1, 40, 1,
+         s 
+         ? libbalsa_imap_server_get_max_connections(LIBBALSA_IMAP_SERVER(s))
+         : 20);
+    fcw->enable_persistent = 
         balsa_server_conf_add_checkbox(&fcw->bsc,
                                        _("Enable _persistent cache"));
-    if (!s ||
-        libbalsa_imap_server_has_persistent_cache(LIBBALSA_IMAP_SERVER(s))) {
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fcw->enable_persistent),
+    if(!s || 
+       libbalsa_imap_server_has_persistent_cache(LIBBALSA_IMAP_SERVER(s)))
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fcw->enable_persistent),
                                      TRUE);
-    }
-    fcw->use_idle =
+    fcw->use_idle = 
         balsa_server_conf_add_checkbox(&fcw->bsc,
                                        _("Use IDLE command"));
-    if (s &&
-        libbalsa_imap_server_get_use_idle(LIBBALSA_IMAP_SERVER(s))) {
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fcw->use_idle),
+    if(s &&
+       libbalsa_imap_server_get_use_idle(LIBBALSA_IMAP_SERVER(s)))
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fcw->use_idle),
                                      TRUE);
-    }
-    fcw->has_bugs =
+    fcw->has_bugs = 
         balsa_server_conf_add_checkbox(&fcw->bsc,
                                        _("Enable _bug workarounds"));
-    if (s &&
-        libbalsa_imap_server_has_bug(LIBBALSA_IMAP_SERVER(s), ISBUG_FETCH)) {
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fcw->has_bugs),
+    if(s &&
+       libbalsa_imap_server_has_bug(LIBBALSA_IMAP_SERVER(s), ISBUG_FETCH))
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fcw->has_bugs),
                                      TRUE);
-    }
-    fcw->use_status =
+    fcw->use_status = 
         balsa_server_conf_add_checkbox(&fcw->bsc,
                                        _("Use STATUS for mailbox checking"));
-    if (s &&
-        libbalsa_imap_server_get_use_status(LIBBALSA_IMAP_SERVER(s))) {
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fcw->use_status),
+    if(s &&
+       libbalsa_imap_server_get_use_status(LIBBALSA_IMAP_SERVER(s)))
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fcw->use_status),
                                      TRUE);
-    }
     gtk_notebook_append_page(GTK_NOTEBOOK(notebook), advanced,
                              gtk_label_new_with_mnemonic(_("_Advanced")));
 
@@ -388,7 +366,7 @@ folder_conf_imap_node(BalsaMailboxNode *mn)
     fcw->folder_name =
         libbalsa_create_grid_entry(grid, G_CALLBACK(validate_folder),
                                    fcw, r++, mn ? mn->name : NULL,
-                                   label);
+                                  label);
 
     default_server = libbalsa_guess_imap_server();
     label = libbalsa_create_grid_label(_("_Server:"), grid, 1);
@@ -399,7 +377,7 @@ folder_conf_imap_node(BalsaMailboxNode *mn)
     fcw->bsc.default_ports = IMAP_DEFAULT_PORTS;
     g_free(default_server);
 
-    label = libbalsa_create_grid_label(_("Use_r name:"), grid, r);
+    label= libbalsa_create_grid_label(_("Use_r name:"), grid, r);
     fcw->username =
         libbalsa_create_grid_entry(grid, G_CALLBACK(validate_folder),
                                    fcw, r++, s ? s->user : g_get_user_name(),
@@ -439,8 +417,8 @@ folder_conf_imap_node(BalsaMailboxNode *mn)
     validate_folder(NULL, fcw);
     gtk_widget_grab_focus(fcw->folder_name);
 
-    gtk_dialog_set_default_response(fcw->dialog,
-                                    mn ? GTK_RESPONSE_OK
+    gtk_dialog_set_default_response(fcw->dialog, 
+                                    mn ? GTK_RESPONSE_OK 
                                     : GTK_RESPONSE_CANCEL);
     gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 0);
 
@@ -449,15 +427,13 @@ folder_conf_imap_node(BalsaMailboxNode *mn)
     gtk_widget_show(GTK_WIDGET(fcw->dialog));
 }
 
-
 /* folder_conf_imap_sub_node:
    Show name and path for an existing subfolder,
    or create a new one.
- */
+*/
 
 static void
-validate_sub_folder(GtkWidget           *w,
-                    SubfolderDialogData *sdd)
+validate_sub_folder(GtkWidget * w, SubfolderDialogData * sdd)
 {
     BalsaMailboxNode *mn = sdd->parent;
     /*
@@ -466,18 +442,17 @@ validate_sub_folder(GtkWidget           *w,
      */
     gboolean have_server = (mn && LIBBALSA_IS_IMAP_SERVER(mn->server));
     gtk_editable_set_editable(GTK_EDITABLE(sdd->parent_folder),
-                              have_server);
+                             have_server);
     /*
      * We'll allow a null parent name, although some IMAP servers
      * will deny permission:
      */
-    gtk_dialog_set_response_sensitive(sdd->dialog, GTK_RESPONSE_OK,
+    gtk_dialog_set_response_sensitive(sdd->dialog, GTK_RESPONSE_OK, 
                                       have_server &&
                                       *gtk_entry_get_text(GTK_ENTRY
-                                                              (sdd->folder_name)));
+                                                          (sdd->folder_name)));
 }
 
-
 /* callbacks for a `Browse...' button: */
 
 typedef struct _BrowseButtonData BrowseButtonData;
@@ -489,8 +464,8 @@ struct _BrowseButtonData {
 };
 
 static void
-browse_button_select_row_cb(GtkTreeSelection *selection,
-                            BrowseButtonData *bbd)
+browse_button_select_row_cb(GtkTreeSelection * selection,
+                            BrowseButtonData * bbd)
 {
     GtkTreeModel *model;
     GtkTreeIter iter;
@@ -499,56 +474,45 @@ browse_button_select_row_cb(GtkTreeSelection *selection,
 
     gtk_dialog_set_response_sensitive(bbd->dialog,
                                       GTK_RESPONSE_OK, selected);
-    if (selected) {
+    if (selected)
         gtk_tree_model_get(model, &iter, 0, &bbd->mbnode, -1);
-    }
     /* bbd->mbnode is unreffed when bbd is freed. */
 }
 
-
 static void
-browse_button_row_activated(GtkTreeView       *tree_view,
-                            GtkTreePath       *path,
-                            GtkTreeViewColumn *column,
-                            BrowseButtonData  *bbd)
+browse_button_row_activated(GtkTreeView * tree_view, GtkTreePath * path,
+                            GtkTreeViewColumn * column,
+                            BrowseButtonData * bbd)
 {
     gtk_dialog_response(bbd->dialog, GTK_RESPONSE_OK);
 }
 
-
 static void
-browse_button_response(GtkDialog        *dialog,
-                       gint              response,
-                       BrowseButtonData *bbd)
+browse_button_response(GtkDialog * dialog, gint response,
+                       BrowseButtonData * bbd)
 {
     if (response == GTK_RESPONSE_OK) {
         BalsaMailboxNode *mbnode = bbd->mbnode;
-        if (!mbnode) {
+        if (!mbnode)
             return;
-        }
 
         bbd->sdd->parent = mbnode;
-        if (mbnode->dir) {
+        if (mbnode->dir)
             gtk_entry_set_text(GTK_ENTRY(bbd->sdd->parent_folder),
                                mbnode->dir);
-        }
-        if (mbnode->server) {
+        if(mbnode->server)
             gtk_label_set_label(GTK_LABEL(bbd->sdd->host_label),
                                 mbnode->server->host);
-        }
     }
     validate_sub_folder(NULL, bbd->sdd);
     gtk_widget_set_sensitive(bbd->button, TRUE);
     gtk_widget_destroy(GTK_WIDGET(dialog));
 }
 
-
 static gboolean
-folder_selection_func(GtkTreeSelection    *selection,
-                      GtkTreeModel        *model,
-                      GtkTreePath         *path,
-                      gboolean             path_currently_selected,
-                      SubfolderDialogData *sdd)
+folder_selection_func(GtkTreeSelection * selection, GtkTreeModel * model,
+                     GtkTreePath * path, gboolean path_currently_selected,
+                     SubfolderDialogData * sdd)
 {
     GtkTreeIter iter;
     BalsaMailboxNode *mbnode;
@@ -557,27 +521,23 @@ folder_selection_func(GtkTreeSelection    *selection,
     gtk_tree_model_get_iter(model, &iter, path);
     gtk_tree_model_get(model, &iter, 0, &mbnode, -1);
     retval = (LIBBALSA_IS_IMAP_SERVER(mbnode->server)
-              && (sdd->mbnode == NULL
-                  || sdd->mbnode->server == mbnode->server));
+             && (sdd->mbnode == NULL
+                 || sdd->mbnode->server == mbnode->server));
     g_object_unref(mbnode);
 
     return retval;
 }
 
-
 static void
 browse_button_data_free(BrowseButtonData *bbd)
 {
-    if (bbd->mbnode) {
-        g_object_unref(bbd->mbnode);
-    }
+    if (bbd->mbnode)
+       g_object_unref(bbd->mbnode);
     g_free(bbd);
 }
 
-
 static void
-browse_button_cb(GtkWidget           *widget,
-                 SubfolderDialogData *sdd)
+browse_button_cb(GtkWidget * widget, SubfolderDialogData * sdd)
 {
     GtkWidget *scroll, *dialog;
     GtkRequisition req;
@@ -589,7 +549,7 @@ browse_button_cb(GtkWidget           *widget,
      * Make only IMAP nodes selectable:
      */
     gtk_tree_selection_set_select_function(selection,
-                                           (GtkTreeSelectionFunc)
+                                           (GtkTreeSelectionFunc) 
                                            folder_selection_func, sdd,
                                            NULL);
 
@@ -604,7 +564,7 @@ browse_button_cb(GtkWidget           *widget,
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(dialog, GTK_WINDOW(sdd->dialog));
 #endif
-
+    
     scroll = gtk_scrolled_window_new(NULL, NULL);
     gtk_widget_set_vexpand(scroll, TRUE);
     gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), scroll);
@@ -620,7 +580,7 @@ browse_button_cb(GtkWidget           *widget,
     bbd->button = widget;
     bbd->mbnode = NULL;
     g_object_weak_ref(G_OBJECT(dialog),
-                      (GWeakNotify) browse_button_data_free, bbd);
+                     (GWeakNotify) browse_button_data_free, bbd);
     g_signal_connect(G_OBJECT(selection), "changed",
                      G_CALLBACK(browse_button_select_row_cb), bbd);
     g_signal_connect(G_OBJECT(tree_view), "row-activated",
@@ -629,11 +589,10 @@ browse_button_cb(GtkWidget           *widget,
     /* Force the mailbox list to be a reasonable size. */
     gtk_widget_get_preferred_size(tree_view, NULL, &req);
     /* don't mess with the width, it gets saved! */
-    if (req.height > balsa_app.mw_height) {
+    if (req.height > balsa_app.mw_height)
         req.height = balsa_app.mw_height;
-    } else if (req.height < balsa_app.mw_height / 2) {
+    else if (req.height < balsa_app.mw_height / 2)
         req.height = balsa_app.mw_height / 2;
-    }
     gtk_window_set_default_size(GTK_WINDOW(dialog), req.width, req.height);
 
     /* To prevent multiple dialogs, desensitize the browse button. */
@@ -647,9 +606,8 @@ browse_button_cb(GtkWidget           *widget,
     gtk_widget_show(GTK_WIDGET(dialog));
 }
 
-
 static gboolean
-subfolder_conf_clicked_ok(SubfolderDialogData *sdd)
+subfolder_conf_clicked_ok(SubfolderDialogData * sdd)
 {
     gchar *parent, *folder;
     gboolean ret = TRUE;
@@ -657,31 +615,29 @@ subfolder_conf_clicked_ok(SubfolderDialogData *sdd)
     parent =
         gtk_editable_get_chars(GTK_EDITABLE(sdd->parent_folder), 0, -1);
     folder = gtk_editable_get_chars(GTK_EDITABLE(sdd->folder_name), 0, -1);
-    if (balsa_app.debug) {
-        g_print("sdd->old_parent=%s\nsdd->old_folder=%s\n",
-                sdd->old_parent, sdd->old_folder);
-    }
+    if(balsa_app.debug)
+       g_print("sdd->old_parent=%s\nsdd->old_folder=%s\n",
+               sdd->old_parent, sdd->old_folder);
 
     if (sdd->mbnode) {
         /* Views stuff. */
-        if (sdd->mbnode->mailbox) {
+        if (sdd->mbnode->mailbox)
             mailbox_conf_view_check(sdd->mcv, sdd->mbnode->mailbox);
-        }
-
+        
         /* rename */
         if ((g_strcmp0(parent, sdd->old_parent) != 0) ||
             (g_strcmp0(folder, sdd->old_folder) != 0)) {
             gint button = GTK_RESPONSE_OK;
-            if ((g_strcmp0(sdd->old_folder, "INBOX") == 0) &&
+            if (g_strcmp0(sdd->old_folder, "INBOX") == 0 &&
                 (!sdd->old_parent || !*sdd->old_parent)) {
                 gchar *msg =
                     g_strdup_printf(_
-                                        ("Renaming Inbox is special!\n"
-                                        "You will create a subfolder %s in %s\n"
-                                        "containing the messages from Inbox.\n"
-                                        "Inbox and its subfolders will remain.\n"
-                                        "What would you like to do?"),
-                                    folder, parent);
+                                    ("Renaming Inbox is special!\n"
+                                     "You will create a subfolder %s in %s\n"
+                                     "containing the messages from Inbox.\n"
+                                     "Inbox and its subfolders will remain.\n"
+                                     "What would you like to do?"),
+folder, parent);
                 GtkWidget *ask =
                     gtk_dialog_new_with_buttons(_("Question"),
                                                 GTK_WINDOW(sdd->dialog),
@@ -693,26 +649,26 @@ subfolder_conf_clicked_ok(SubfolderDialogData *sdd)
                                                 GTK_RESPONSE_CANCEL,
                                                 NULL);
 #if HAVE_MACOSX_DESKTOP
-                libbalsa_macosx_menu_for_parent(ask, GTK_WINDOW(sdd->dialog));
+               libbalsa_macosx_menu_for_parent(ask, GTK_WINDOW(sdd->dialog));
 #endif
                 gtk_box_pack_start(GTK_BOX
-                                       (gtk_dialog_get_content_area
-                                           (GTK_DIALOG(ask))), gtk_label_new(msg));
+                                  (gtk_dialog_get_content_area
+                                   (GTK_DIALOG(ask))), gtk_label_new(msg));
                 g_free(msg);
                 button = gtk_dialog_run(GTK_DIALOG(ask));
                 gtk_widget_destroy(ask);
             }
             if (button == GTK_RESPONSE_OK) {
-                GError *err = NULL;
+                GError* err = NULL;
                 /* Close the mailbox before renaming,
                  * otherwise the rescan will try to close it
                  * under its old name.
                  */
                 balsa_window_close_mbnode(balsa_app.main_window,
                                           sdd->mbnode);
-                if (!libbalsa_imap_rename_subfolder
-                        (LIBBALSA_MAILBOX_IMAP(sdd->mbnode->mailbox),
-                        parent, folder, sdd->mbnode->subscribed, &err)) {
+                if(!libbalsa_imap_rename_subfolder
+                   (LIBBALSA_MAILBOX_IMAP(sdd->mbnode->mailbox),
+                    parent, folder, sdd->mbnode->subscribed, &err)) {
                     balsa_information(LIBBALSA_INFORMATION_ERROR,
                                       _("Folder rename failed. Reason: %s"),
                                       err ? err->message : "unknown");
@@ -727,32 +683,30 @@ subfolder_conf_clicked_ok(SubfolderDialogData *sdd)
                 if (sdd->old_parent
                     && !strncmp(parent, sdd->old_parent, strlen(parent))) {
                     /* moved it up the tree */
-                    BalsaMailboxNode *mbnode =
+                   BalsaMailboxNode *mbnode =
                         balsa_find_dir(sdd->parent->server, parent);
                     if (mbnode) {
                         balsa_mailbox_node_rescan(mbnode);
-                        g_object_unref(mbnode);
-                    } else {
+                       g_object_unref(mbnode);
+                   } else
                         printf("Parent not found!?\n");
-                    }
                 } else if (sdd->old_parent
                            && !strncmp(parent, sdd->old_parent,
                                        strlen(sdd->old_parent))) {
                     /* moved it down the tree */
-                    BalsaMailboxNode *mbnode =
-                        balsa_find_dir(sdd->parent->server, sdd->old_parent);
+                   BalsaMailboxNode *mbnode =
+                       balsa_find_dir(sdd->parent->server, sdd->old_parent);
                     if (mbnode) {
                         balsa_mailbox_node_rescan(mbnode);
-                        g_object_unref(mbnode);
-                    }
+                       g_object_unref(mbnode);
+                   }
                 } else {
                     /* moved it sideways: a chain of folders might
                      * go away, so we'd better rescan from higher up
                      */
                     BalsaMailboxNode *mb = sdd->mbnode->parent;
-                    while (!mb->mailbox && mb->parent) {
+                    while (!mb->mailbox && mb->parent)
                         mb = mb->parent;
-                    }
                     balsa_mailbox_node_rescan(mb);
                     balsa_mailbox_node_rescan(sdd->mbnode);
                 }
@@ -761,9 +715,9 @@ subfolder_conf_clicked_ok(SubfolderDialogData *sdd)
     } else {
         GError *err = NULL;
         /* create and subscribe, if parent was. */
-        if (libbalsa_imap_new_subfolder(parent, folder,
-                                        sdd->parent->subscribed,
-                                        sdd->parent->server, &err)) {
+        if(libbalsa_imap_new_subfolder(parent, folder,
+                                       sdd->parent->subscribed,
+                                       sdd->parent->server, &err)) {
             /* see it as server sees it: */
             balsa_mailbox_node_rescan(sdd->parent);
         } else {
@@ -774,27 +728,25 @@ subfolder_conf_clicked_ok(SubfolderDialogData *sdd)
             ret = FALSE;
         }
     }
-error:
+ error:
     g_free(parent);
     g_free(folder);
     return ret;
 }
 
-
 /* folder_conf_imap_sub_node:
    show the IMAP Folder configuration dialog for given mailbox node
    representing a sub-folder.
    If mn is NULL, setup it with default values for folder creation.
- */
+*/
 static void
-set_ok_sensitive(GtkDialog *dialog)
+set_ok_sensitive(GtkDialog * dialog)
 {
     gtk_dialog_set_response_sensitive(dialog, GTK_RESPONSE_OK, TRUE);
 }
 
-
 void
-folder_conf_imap_sub_node(BalsaMailboxNode *mn)
+folder_conf_imap_sub_node(BalsaMailboxNode * mn)
 {
     GtkWidget *content, *grid, *button, *label, *hbox;
     SubfolderDialogData *sdd;
@@ -804,7 +756,7 @@ folder_conf_imap_sub_node(BalsaMailboxNode *mn)
     /* Allow only one dialog per mailbox node, and one with mn == NULL
      * for creating a new subfolder. */
     sdd = mn ? g_object_get_data(G_OBJECT(mn), BALSA_FOLDER_CONF_IMAP_KEY)
-        : sdd_new;
+             : sdd_new;
     if (sdd) {
         gtk_window_present(GTK_WINDOW(sdd->dialog));
         return;
@@ -814,68 +766,68 @@ folder_conf_imap_sub_node(BalsaMailboxNode *mn)
     sdd->ok = (CommonDialogFunc) subfolder_conf_clicked_ok;
 
     if ((sdd->mbnode = mn)) {
-        /* update */
-        if (!mn->mailbox) {
+       /* update */
+       if (!mn->mailbox) {
             balsa_information(LIBBALSA_INFORMATION_ERROR,
                               _("An IMAP folder that is not a mailbox\n"
                                 "has no properties that can be changed."));
             g_free(sdd);
-            return;
-        }
-        sdd->parent = mn->parent;
-        sdd->old_folder = mn->mailbox->name;
+           return;
+       }
+       sdd->parent = mn->parent;
+       sdd->old_folder = mn->mailbox->name;
     } else {
-        /* create */
+       /* create */
         sdd->old_folder = NULL;
         sdd->parent = NULL;
     }
     sdd->old_parent = sdd->mbnode ? sdd->mbnode->parent->dir : NULL;
 
-    sdd->dialog =
+    sdd->dialog = 
         GTK_DIALOG(gtk_dialog_new_with_buttons
-                       (_("Remote IMAP subfolder"),
-                       GTK_WINDOW(balsa_app.main_window),
-                       GTK_DIALOG_DESTROY_WITH_PARENT | /* must NOT be modal */
-                       libbalsa_dialog_flags(),
-                       mn ? _("_Update") : _("_Create"), GTK_RESPONSE_OK,
-                       _("_Cancel"), GTK_RESPONSE_CANCEL,
-                       _("_Help"), GTK_RESPONSE_HELP,
-                       NULL));
+                   (_("Remote IMAP subfolder"), 
+                    GTK_WINDOW(balsa_app.main_window),
+                    GTK_DIALOG_DESTROY_WITH_PARENT | /* must NOT be modal */
+                    libbalsa_dialog_flags(),
+                    mn ? _("_Update") : _("_Create"), GTK_RESPONSE_OK,
+                    _("_Cancel"), GTK_RESPONSE_CANCEL,
+                    _("_Help"), GTK_RESPONSE_HELP,
+                    NULL));
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(GTK_WIDGET(sdd->dialog), GTK_WINDOW(balsa_app.main_window));
 #endif
     g_object_add_weak_pointer(G_OBJECT(sdd->dialog),
-                              (gpointer) & sdd->dialog);
+                              (gpointer) &sdd->dialog);
     /* `Enter' key => Create: */
     gtk_dialog_set_default_response(GTK_DIALOG(sdd->dialog), GTK_RESPONSE_OK);
     gtk_window_set_role(GTK_WINDOW(sdd->dialog), "subfolder_config_dialog");
 
     if (sdd->mbnode) {
         g_object_set_data_full(G_OBJECT(sdd->mbnode),
-                               BALSA_FOLDER_CONF_IMAP_KEY, sdd,
+                               BALSA_FOLDER_CONF_IMAP_KEY, sdd, 
                                (GDestroyNotify) folder_conf_destroy_cdd);
     } else {
         sdd_new = sdd;
         g_object_add_weak_pointer(G_OBJECT(sdd->dialog),
-                                  (gpointer) & sdd_new);
+                                  (gpointer) &sdd_new);
     }
 
     grid = libbalsa_create_grid();
     gtk_grid_set_row_spacing(GTK_GRID(grid), 6);
     gtk_grid_set_column_spacing(GTK_GRID(grid), 12);
     g_object_set(G_OBJECT(grid), "margin", 12, NULL);
-    if (mn) {
+    if (mn)
         content = grid;
-    } else {
+    else {
         content = gtk_frame_new(_("Create subfolder"));
         gtk_container_add(GTK_CONTAINER(content), grid);
     }
     gtk_widget_set_vexpand(content, TRUE);
     gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(sdd->dialog)), content);
-
+ 
     row = 0;
     /* INPUT FIELD CREATION */
-    label = libbalsa_create_grid_label(_("_Folder name:"), grid, row);
+    label= libbalsa_create_grid_label(_("_Folder name:"), grid, row);
     sdd->folder_name =
         libbalsa_create_grid_entry(grid, G_CALLBACK(validate_sub_folder),
                                    sdd, row, sdd->old_folder, label);
@@ -897,7 +849,7 @@ folder_conf_imap_sub_node(BalsaMailboxNode *mn)
 
     button = gtk_button_new_with_mnemonic(_("_Browse…"));
     g_signal_connect(G_OBJECT(button), "clicked",
-                     G_CALLBACK(browse_button_cb), (gpointer) sdd);
+                    G_CALLBACK(browse_button_cb), (gpointer) sdd);
 
     hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
     gtk_widget_set_hexpand(sdd->parent_folder, TRUE);
@@ -906,9 +858,9 @@ folder_conf_imap_sub_node(BalsaMailboxNode *mn)
     gtk_widget_set_hexpand(hbox, TRUE);
     gtk_grid_attach(GTK_GRID(grid), hbox, 1, row, 1, 1);
 
-    if (!mn) {
+    if (!mn)
         validate_sub_folder(NULL, sdd);
-    } else {
+    else {
         static const char *std_acls[] = {
             "lrs", N_("read-only"),
             "lrswipkxte", N_("read-write"),
@@ -916,11 +868,10 @@ folder_conf_imap_sub_node(BalsaMailboxNode *mn)
             "lrsp", N_("post"),
             "lrsip", N_("append"),
             "lrxte", N_("delete"),
-            NULL, N_("special")
-        };
+            NULL, N_("special") };
         GString *rights_str;
-        gchar *rights;
-        gchar *quotas;
+        gchar * rights;
+        gchar * quotas;
 
         ++row;
         (void) libbalsa_create_grid_label(_("Permissions:"), grid, row);
@@ -945,36 +896,32 @@ folder_conf_imap_sub_node(BalsaMailboxNode *mn)
                 /* my rights */
                 for (n = 0;
                      std_acls[n] && strcmp(std_acls[n], rights) != 0;
-                     n += 2) {
-                }
+                     n += 2);
                 rights_str = g_string_new(_("mine: "));
-                if (std_acls[n]) {
+                if (std_acls[n])
                     rights_str = g_string_append(rights_str, std_acls[n + 1]);
-                } else {
+                else
                     g_string_append_printf(rights_str, "%s (%s)",
                                            std_acls[n + 1], rights);
-                }
 
                 /* acl's - only available if I have admin privileges */
                 if ((acls =
-                         libbalsa_imap_get_acls(LIBBALSA_MAILBOX_IMAP(mn->mailbox)))) {
+                     libbalsa_imap_get_acls(LIBBALSA_MAILBOX_IMAP(mn->mailbox)))) {
                     int uid;
 
                     for (uid = 0; acls[uid]; uid += 2) {
                         for (n = 0;
                              std_acls[n] && strcmp(std_acls[n], acls[uid + 1]);
-                             n += 2) {
-                        }
-                        if (std_acls[n]) {
+                             n += 2);
+                        if (std_acls[n])
                             g_string_append_printf(rights_str,
                                                    "\nuid '%s': %s",
                                                    acls[uid], std_acls[n + 1]);
-                        } else {
+                        else
                             g_string_append_printf(rights_str,
                                                    "\nuid '%s': %s (%s)",
                                                    acls[uid], std_acls[n + 1],
                                                    acls[uid + 1]);
-                        }
                     }
                     g_strfreev(acls);
                 }
@@ -991,16 +938,16 @@ folder_conf_imap_sub_node(BalsaMailboxNode *mn)
         (void) libbalsa_create_grid_label(_("Quota:"), grid, row);
 
         /* mailbox closed: no quota available */
-        if (!libbalsa_mailbox_imap_is_connected(LIBBALSA_MAILBOX_IMAP(mn->mailbox))) {
+        if (!libbalsa_mailbox_imap_is_connected(LIBBALSA_MAILBOX_IMAP(mn->mailbox)))
             quotas = g_strdup(_("quota information available only for open folders"));
-        } else {
+        else {
             gulong max, used;
 
-            if (!libbalsa_imap_get_quota(LIBBALSA_MAILBOX_IMAP(mn->mailbox), &max, &used)) {
+            if (!libbalsa_imap_get_quota(LIBBALSA_MAILBOX_IMAP(mn->mailbox), &max, &used))
                 quotas = g_strdup(_("the server does not support quotas"));
-            } else if ((max == 0) && (used == 0)) {
+            else if (max == 0 && used == 0)
                 quotas = g_strdup(_("no limits"));
-            } else {
+            else {
                 gchar *use_str = libbalsa_size_to_gchar(used * G_GUINT64_CONSTANT(1024));
                 gchar *max_str = libbalsa_size_to_gchar(max * G_GUINT64_CONSTANT(1024));
 
@@ -1033,21 +980,20 @@ folder_conf_imap_sub_node(BalsaMailboxNode *mn)
     gtk_widget_show(GTK_WIDGET(sdd->dialog));
 }
 
-
 void
-folder_conf_delete(BalsaMailboxNode *mbnode)
+folder_conf_delete(BalsaMailboxNode* mbnode)
 {
-    GtkWidget *ask;
+    GtkWidget* ask;
     gint response;
 
-    if (!mbnode->config_prefix) {
+    if(!mbnode->config_prefix) {
         balsa_information(LIBBALSA_INFORMATION_ERROR,
-                          _("This folder is not stored in configuration. "
-                            "I do not yet know how to remove it "
+                         _("This folder is not stored in configuration. "
+                           "I do not yet know how to remove it "
                             "from remote server."));
-        return;
+       return;
     }
-
+       
     ask = gtk_message_dialog_new(GTK_WINDOW(balsa_app.main_window), 0,
                                  GTK_MESSAGE_QUESTION,
                                  GTK_BUTTONS_OK_CANCEL,
@@ -1063,9 +1009,8 @@ folder_conf_delete(BalsaMailboxNode *mbnode)
 
     response = gtk_dialog_run(GTK_DIALOG(ask));
     gtk_widget_destroy(ask);
-    if (response != GTK_RESPONSE_OK) {
-        return;
-    }
+    if(response != GTK_RESPONSE_OK)
+       return;
 
     /* Delete it from the config file and internal nodes */
     config_folder_delete(mbnode);
@@ -1075,34 +1020,26 @@ folder_conf_delete(BalsaMailboxNode *mbnode)
     update_mail_servers();
 }
 
-
 void
-folder_conf_add_imap_cb(GtkWidget *widget,
-                        gpointer   data)
+folder_conf_add_imap_cb(GtkWidget * widget, gpointer data)
 {
     folder_conf_imap_node(NULL);
 }
 
-
 void
-folder_conf_add_imap_sub_cb(GtkWidget *widget,
-                            gpointer   data)
+folder_conf_add_imap_sub_cb(GtkWidget * widget, gpointer data)
 {
     folder_conf_imap_sub_node(NULL);
 }
 
-
 void
-folder_conf_edit_imap_cb(GtkWidget *widget,
-                         gpointer   data)
+folder_conf_edit_imap_cb(GtkWidget * widget, gpointer data)
 {
     folder_conf_imap_node(BALSA_MAILBOX_NODE(data));
 }
 
-
 void
-folder_conf_delete_cb(GtkWidget *widget,
-                      gpointer   data)
+folder_conf_delete_cb(GtkWidget * widget, gpointer data)
 {
     folder_conf_delete(BALSA_MAILBOX_NODE(data));
 }
diff --git a/src/folder-conf.h b/src/folder-conf.h
index 53a94f8..673b497 100644
--- a/src/folder-conf.h
+++ b/src/folder-conf.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -24,16 +24,10 @@
 
 void folder_conf_imap_node(BalsaMailboxNode *mn);
 void folder_conf_imap_sub_node(BalsaMailboxNode *mn);
-
 /* callbacks used also by the main window menu */
-void folder_conf_add_imap_cb(GtkWidget *widget,
-                             gpointer   data);
-void folder_conf_add_imap_sub_cb(GtkWidget *widget,
-                                 gpointer   data);
-void folder_conf_edit_imap_cb(GtkWidget *widget,
-                              gpointer   data);
-void folder_conf_delete(BalsaMailboxNode *mbnode);
-void folder_conf_delete_cb(GtkWidget *widget,
-                           gpointer   data);
-
-#endif                          /* __FOLDER_CONF_H__ */
+void folder_conf_add_imap_cb(GtkWidget * widget, gpointer data);
+void folder_conf_add_imap_sub_cb(GtkWidget * widget, gpointer data);
+void folder_conf_edit_imap_cb(GtkWidget * widget, gpointer data);
+void folder_conf_delete(BalsaMailboxNode* mbnode);
+void folder_conf_delete_cb(GtkWidget * widget, gpointer data);
+#endif                         /* __FOLDER_CONF_H__ */
diff --git a/src/information-dialog.c b/src/information-dialog.c
index 8ceb80b..8b30950 100644
--- a/src/information-dialog.c
+++ b/src/information-dialog.c
@@ -5,25 +5,25 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
- * This file contains functions to display inormational messages
+ * This file contains functions to display inormational messages 
  * received from libbalsa
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "information-dialog.h"
 
@@ -33,108 +33,91 @@
 #include "balsa-app.h"
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#  include "macosx-helpers.h"
 #endif
 
-static void balsa_information_bar(GtkWindow              *parent,
+static void balsa_information_bar(GtkWindow *parent,
                                   LibBalsaInformationType type,
-                                  const char             *msg);
-static void balsa_information_list(GtkWindow              *parent,
+                                  const char *msg);
+static void balsa_information_list(GtkWindow *parent,
                                    LibBalsaInformationType type,
-                                   const char             *msg);
-static void balsa_information_dialog(GtkWindow              *parent,
+                                  const char *msg);
+static void balsa_information_dialog(GtkWindow *parent,
                                      LibBalsaInformationType type,
-                                     const char             *msg);
+                                    const char *msg);
 static void balsa_information_stderr(LibBalsaInformationType type,
-                                     const char             *msg);
+                                    const char *msg);
 
 /* Handle button clicks in the warning window */
 static void
-balsa_information_list_response_cb(GtkWidget   *dialog,
-                                   gint         response,
-                                   GtkTextView *view)
+balsa_information_list_response_cb(GtkWidget * dialog, gint response,
+                                   GtkTextView * view)
 {
     switch (response) {
     case GTK_RESPONSE_APPLY:
         gtk_text_buffer_set_text(gtk_text_view_get_buffer(view), "", 0);
-        break;
-
+       break;
     default:
-        gtk_widget_destroy(dialog);
-        break;
+       gtk_widget_destroy(dialog);
+       break;
     }
 }
 
-
 void
-balsa_information_real(GtkWindow              *parent,
-                       LibBalsaInformationType type,
-                       const char             *msg)
+balsa_information_real(GtkWindow *parent, LibBalsaInformationType type,
+                       const char *msg)
 {
     BalsaInformationShow show;
     gchar *show_msg;
 
-    if (!balsa_app.main_window) {
+    if (!balsa_app.main_window)
         return;
-    }
 
     show_msg = g_strdup(msg);
     libbalsa_utf8_sanitize(&show_msg, balsa_app.convert_unknown_8bit, NULL);
     switch (type) {
     case LIBBALSA_INFORMATION_MESSAGE:
-        show = balsa_app.information_message;
-        break;
-
+       show = balsa_app.information_message;
+       break;
     case LIBBALSA_INFORMATION_WARNING:
-        show = balsa_app.warning_message;
-        break;
-
+       show = balsa_app.warning_message;
+       break;
     case LIBBALSA_INFORMATION_ERROR:
-        show = balsa_app.error_message;
-        break;
-
+       show = balsa_app.error_message;
+       break;
     case LIBBALSA_INFORMATION_DEBUG:
-        show = balsa_app.debug_message;
-        break;
-
+       show = balsa_app.debug_message;
+       break;
     case LIBBALSA_INFORMATION_FATAL:
     default:
-        show = balsa_app.fatal_message;
-        break;
+       show = balsa_app.fatal_message;
+       break;
     }
 
     switch (show) {
     case BALSA_INFORMATION_SHOW_NONE:
-        break;
-
+       break;
     case BALSA_INFORMATION_SHOW_DIALOG:
-        balsa_information_dialog(parent, type, show_msg);
-        break;
-
+       balsa_information_dialog(parent, type, show_msg);
+       break;
     case BALSA_INFORMATION_SHOW_LIST:
-        balsa_information_list(parent, type, show_msg);
-        break;
-
+       balsa_information_list(parent, type, show_msg);
+       break;
     case BALSA_INFORMATION_SHOW_BAR:
-        balsa_information_bar(parent, type, show_msg);
-        break;
-
+       balsa_information_bar(parent, type, show_msg);
+       break;
     case BALSA_INFORMATION_SHOW_STDERR:
-        balsa_information_stderr(type, show_msg);
-        break;
+       balsa_information_stderr(type, show_msg);
+       break;
     }
     g_free(show_msg);
 
-    if (type == LIBBALSA_INFORMATION_FATAL) {
-        gtk_main_quit();
-    }
+    if (type == LIBBALSA_INFORMATION_FATAL)
+       gtk_main_quit();
 }
 
-
 void
-balsa_information(LibBalsaInformationType type,
-                  const char             *fmt,
-                  ...)
+balsa_information(LibBalsaInformationType type, const char *fmt, ...)
 {
     gchar *msg;
     va_list ap;
@@ -146,19 +129,15 @@ balsa_information(LibBalsaInformationType type,
     g_free(msg);
 }
 
-
 void
-balsa_information_parented(GtkWindow              *parent,
-                           LibBalsaInformationType type,
-                           const char             *fmt,
-                           ...)
+balsa_information_parented(GtkWindow *parent, LibBalsaInformationType type,
+                           const char *fmt, ...)
 {
     gchar *msg;
     va_list ap;
 
-    if (!parent) {
+    if(!parent)
         parent = GTK_WINDOW(balsa_app.main_window);
-    }
     va_start(ap, fmt);
     msg = g_strdup_vprintf(fmt, ap);
     va_end(ap);
@@ -166,14 +145,12 @@ balsa_information_parented(GtkWindow              *parent,
     g_free(msg);
 }
 
-
 /*
  * Pops up an error dialog
  */
 static void
-balsa_information_dialog(GtkWindow              *parent,
-                         LibBalsaInformationType type,
-                         const char             *msg)
+balsa_information_dialog(GtkWindow *parent, LibBalsaInformationType type,
+                         const char *msg)
 {
     GtkMessageType message_type;
     GtkWidget *messagebox;
@@ -182,23 +159,18 @@ balsa_information_dialog(GtkWindow              *parent,
     case LIBBALSA_INFORMATION_MESSAGE:
         message_type = GTK_MESSAGE_INFO;
         break;
-
     case LIBBALSA_INFORMATION_WARNING:
         message_type = GTK_MESSAGE_WARNING;
         break;
-
     case LIBBALSA_INFORMATION_ERROR:
         message_type = GTK_MESSAGE_ERROR;
         break;
-
     case LIBBALSA_INFORMATION_DEBUG:
         message_type = GTK_MESSAGE_INFO;
         break;
-
     case LIBBALSA_INFORMATION_FATAL:
         message_type = GTK_MESSAGE_ERROR;
         break;
-
     default:
         message_type = GTK_MESSAGE_INFO;
         break;
@@ -209,7 +181,7 @@ balsa_information_dialog(GtkWindow              *parent,
     messagebox =
         gtk_message_dialog_new(GTK_WINDOW(parent),
                                GTK_DIALOG_DESTROY_WITH_PARENT | libbalsa_dialog_flags(),
-                               message_type, GTK_BUTTONS_CLOSE,
+                                                          message_type, GTK_BUTTONS_CLOSE,
                                "%s", msg);
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(messagebox, GTK_WINDOW(parent));
@@ -219,8 +191,7 @@ balsa_information_dialog(GtkWindow              *parent,
     gtk_widget_destroy(messagebox);
 }
 
-
-/*
+/* 
  * make the list widget
  */
 static GtkWidget *
@@ -238,28 +209,26 @@ balsa_information_list_new(void)
     return GTK_WIDGET(view);
 }
 
-
 /*
  * Pops up a dialog containing a list of warnings.
  *
- * This is because their can be many warnings (eg while you are away) and popping up
+ * This is because their can be many warnings (eg while you are away) and popping up 
  * hundreds of windows is ugly.
  */
 static void
-balsa_information_list(GtkWindow              *parent,
-                       LibBalsaInformationType type,
-                       const char             *msg)
+balsa_information_list(GtkWindow *parent, LibBalsaInformationType type,
+                       const char *msg)
 {
     static GtkWidget *information_list = NULL;
     GtkTextBuffer *buffer;
     GtkTextIter iter;
 
     if (information_list == NULL) {
-        GtkWidget *information_dialog;
-        GtkWidget *scrolled_window;
+       GtkWidget *information_dialog;
+       GtkWidget *scrolled_window;
 
-        information_dialog =
-            gtk_dialog_new_with_buttons(_("Information — Balsa"),
+       information_dialog =
+           gtk_dialog_new_with_buttons(_("Information — Balsa"), 
                                         parent,
                                         GTK_DIALOG_DESTROY_WITH_PARENT |
                                         libbalsa_dialog_flags(),
@@ -267,51 +236,50 @@ balsa_information_list(GtkWindow              *parent,
                                         _("Cl_ose"), GTK_RESPONSE_CANCEL,
                                         NULL);
 #if HAVE_MACOSX_DESKTOP
-        libbalsa_macosx_menu_for_parent(information_dialog, parent);
+       libbalsa_macosx_menu_for_parent(information_dialog, parent);
 #endif
-        /* Default is to close */
-        gtk_dialog_set_default_response(GTK_DIALOG(information_dialog),
+       /* Default is to close */
+       gtk_dialog_set_default_response(GTK_DIALOG(information_dialog), 
                                         GTK_RESPONSE_CANCEL);
 
-        /* Reset the policy gtk_dialog_new makes itself non-resizable */
-        gtk_window_set_resizable(GTK_WINDOW(information_dialog), TRUE);
-        gtk_window_set_default_size(GTK_WINDOW(information_dialog), 350, 200);
-        gtk_window_set_role(GTK_WINDOW(information_dialog), "Information");
+       /* Reset the policy gtk_dialog_new makes itself non-resizable */
+       gtk_window_set_resizable(GTK_WINDOW(information_dialog), TRUE);
+       gtk_window_set_default_size(GTK_WINDOW(information_dialog), 350, 200);
+       gtk_window_set_role(GTK_WINDOW(information_dialog), "Information");
 
         g_object_add_weak_pointer(G_OBJECT(information_dialog),
-                                  (gpointer) & information_list);
-
-        /* A scrolled window for the list. */
-        scrolled_window = gtk_scrolled_window_new(NULL, NULL);
-        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
-                                           (scrolled_window),
-                                       GTK_POLICY_AUTOMATIC,
-                                       GTK_POLICY_AUTOMATIC);
+                                  (gpointer) &information_list);
+
+       /* A scrolled window for the list. */
+       scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+       gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
+                                      (scrolled_window),
+                                      GTK_POLICY_AUTOMATIC,
+                                      GTK_POLICY_AUTOMATIC);
         gtk_widget_set_vexpand(scrolled_window, TRUE);
         gtk_widget_set_margin_top(scrolled_window, 1); /* Seriously? */
         gtk_box_pack_start(GTK_BOX
-                               (gtk_dialog_get_content_area
-                                   (GTK_DIALOG(information_dialog))),
+                           (gtk_dialog_get_content_area
+                            (GTK_DIALOG(information_dialog))),
                            scrolled_window);
-        g_object_set(G_OBJECT(scrolled_window), "margin", 6, NULL);
+       g_object_set(G_OBJECT(scrolled_window), "margin", 6, NULL);
 
-        /* The list itself */
-        information_list = balsa_information_list_new();
-        gtk_container_add(GTK_CONTAINER(scrolled_window),
-                          information_list);
+       /* The list itself */
+       information_list = balsa_information_list_new();
+       gtk_container_add(GTK_CONTAINER(scrolled_window),
+                         information_list);
         g_signal_connect(G_OBJECT(information_dialog), "response",
                          G_CALLBACK(balsa_information_list_response_cb),
                          information_list);
 
-        gtk_widget_show(information_dialog);
+       gtk_widget_show(information_dialog);
     }
 
     buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(information_list));
     gtk_text_buffer_get_end_iter(buffer, &iter);
     gtk_text_buffer_place_cursor(buffer, &iter);
-    if (gtk_text_buffer_get_char_count(buffer)) {
+    if (gtk_text_buffer_get_char_count(buffer))
         gtk_text_buffer_insert_at_cursor(buffer, "\n", 1);
-    }
     gtk_text_buffer_insert_at_cursor(buffer, msg, -1);
     gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(information_list),
                                  gtk_text_buffer_get_insert(buffer),
@@ -333,7 +301,6 @@ balsa_information_list(GtkWindow              *parent,
     }
 }
 
-
 static guint bar_timeout_id = 0U;
 static gboolean
 status_bar_refresh(gpointer data)
@@ -352,19 +319,16 @@ status_bar_refresh(gpointer data)
     return FALSE;
 }
 
-
 static void
-balsa_information_bar(GtkWindow              *parent,
-                      LibBalsaInformationType type,
-                      const char             *msg)
+balsa_information_bar(GtkWindow *parent, LibBalsaInformationType type,
+                      const char *msg)
 {
     gchar *line;
     GtkStatusbar *statusbar;
     guint context_id;
 
-    if (!balsa_app.main_window) {
+    if (!balsa_app.main_window)
         return;
-    }
 
     statusbar = GTK_STATUSBAR(balsa_app.main_window->statusbar);
     context_id = gtk_statusbar_get_context_id(statusbar, "Information bar");
@@ -382,26 +346,21 @@ balsa_information_bar(GtkWindow              *parent,
     bar_timeout_id = g_timeout_add_seconds(4, status_bar_refresh, NULL);
 }
 
-
-static void
-balsa_information_stderr(LibBalsaInformationType type,
-                         const char             *msg)
+static void 
+balsa_information_stderr(LibBalsaInformationType type, const char *msg)
 {
     switch (type) {
     case LIBBALSA_INFORMATION_WARNING:
-        fprintf(stderr, _("WARNING: "));
-        break;
-
+       fprintf(stderr, _("WARNING: "));
+       break;
     case LIBBALSA_INFORMATION_ERROR:
-        fprintf(stderr, _("ERROR: "));
-        break;
-
+       fprintf(stderr, _("ERROR: "));
+       break;
     case LIBBALSA_INFORMATION_FATAL:
-        fprintf(stderr, _("FATAL: "));
-        break;
-
+       fprintf(stderr, _("FATAL: "));
+       break;
     default:
-        break;
+       break;
     }
     fprintf(stderr, "%s\n", msg);
 }
diff --git a/src/information-dialog.h b/src/information-dialog.h
index 1e719c6..6323238 100644
--- a/src/information-dialog.h
+++ b/src/information-dialog.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -31,19 +31,15 @@ enum _BalsaInformationShow {
     BALSA_INFORMATION_SHOW_STDERR,
 };
 
-void balsa_information(LibBalsaInformationType type,
-                       const char             *fmt,
-                       ...)
-G_GNUC_PRINTF(2, 3);
+void balsa_information(LibBalsaInformationType type, const char *fmt, ...)
+       G_GNUC_PRINTF(2, 3);
 
-void balsa_information_parented(GtkWindow              *widget,
-                                LibBalsaInformationType type,
-                                const char             *fmt,
-                                ...)
-G_GNUC_PRINTF(3, 4);
+void balsa_information_parented(GtkWindow *widget,
+                                LibBalsaInformationType type, 
+                                const char *fmt, ...)
+       G_GNUC_PRINTF(3, 4);
 
-void balsa_information_real(GtkWindow              *parent,
-                            LibBalsaInformationType type,
-                            const char             *msg);
+void balsa_information_real(GtkWindow *parent, LibBalsaInformationType type,
+                            const char *msg);
 
 #endif
diff --git a/src/mailbox-conf.c b/src/mailbox-conf.c
index cca309a..a517706 100644
--- a/src/mailbox-conf.c
+++ b/src/mailbox-conf.c
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -36,9 +36,9 @@
 
    The mailbox_name field is displayed only for special mailboxes
    and POP3 mailboxes.
- */
+*/
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "mailbox-conf.h"
 
@@ -59,7 +59,7 @@
 #include <glib/gi18n.h>
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#  include "macosx-helpers.h"
 #endif
 
 struct _BalsaMailboxConfView {
@@ -77,7 +77,7 @@ struct _MailboxConfWindow {
 
     GtkDialog *window;
 
-    void (*ok_handler)(MailboxConfWindow *);
+    void (*ok_handler)(MailboxConfWindow*);
     const gchar *ok_button_name;
     GtkWidget *mailbox_name;
     GType mailbox_type;
@@ -85,31 +85,31 @@ struct _MailboxConfWindow {
     gboolean ok_sensitive;
 
     union {
-        /* for imap mailboxes & directories */
-        struct {
-            GtkWidget *port;
-            GtkWidget *username;
+       /* for imap mailboxes & directories */
+       struct {
+           GtkWidget *port;
+           GtkWidget *username;
             GtkWidget *anonymous;
             GtkWidget *remember;
-            GtkWidget *password;
-            GtkWidget *folderpath;
+           GtkWidget *password;
+           GtkWidget *folderpath;
             GtkWidget *enable_persistent, *has_bugs;
             BalsaServerConf bsc;
-        } imap;
-
-        /* for pop3 mailboxes */
-        struct {
-            GtkWidget *security;
-            GtkWidget *username;
-            GtkWidget *password;
-            GtkWidget *check;
-            GtkWidget *delete_from_server;
+       } imap;
+
+       /* for pop3 mailboxes */
+       struct {
+               GtkWidget *security;
+           GtkWidget *username;
+           GtkWidget *password;
+           GtkWidget *check;
+           GtkWidget *delete_from_server;
             BalsaServerConf bsc;
             GtkWidget *disable_apop;
             GtkWidget *enable_pipe;
-            GtkWidget *filter;
-            GtkWidget *filter_cmd;
-        } pop3;
+           GtkWidget *filter;
+           GtkWidget *filter_cmd;
+       } pop3;
     } mb_data;
 };
 
@@ -119,19 +119,18 @@ static void mailbox_conf_add(MailboxConfWindow *conf_window);
 /* misc functions */
 static void mailbox_conf_set_values(MailboxConfWindow *mcw);
 
-static void fill_in_imap_data(MailboxConfWindow *mcw,
-                              gchar            **name,
-                              gchar            **path);
+static void fill_in_imap_data(MailboxConfWindow *mcw, gchar ** name, 
+                              gchar ** path);
 static void update_imap_mailbox(MailboxConfWindow *mcw);
 
 static void update_pop_mailbox(MailboxConfWindow *mcw);
-static BalsaMailboxConfView *mailbox_conf_view_new_full(LibBalsaMailbox   *mailbox,
-                                                        GtkWindow         *window,
-                                                        GtkWidget         *grid,
-                                                        gint               row,
-                                                        GtkSizeGroup      *size_group,
-                                                        MailboxConfWindow *mcw,
-                                                        GCallback          callback);
+static BalsaMailboxConfView *
+    mailbox_conf_view_new_full(LibBalsaMailbox * mailbox,
+                               GtkWindow * window,
+                               GtkWidget * grid, gint row,
+                               GtkSizeGroup * size_group,
+                               MailboxConfWindow * mcw,
+                               GCallback callback);
 
 /* pages */
 static GtkWidget *create_dialog(MailboxConfWindow *mcw);
@@ -139,8 +138,7 @@ static GtkWidget *create_local_mailbox_dialog(MailboxConfWindow *mcw);
 static GtkWidget *create_pop_mailbox_dialog(MailboxConfWindow *mcw);
 static GtkWidget *create_imap_mailbox_dialog(MailboxConfWindow *mcw);
 
-static void check_for_blank_fields(GtkWidget         *widget,
-                                   MailboxConfWindow *mcw);
+static void check_for_blank_fields(GtkWidget *widget, MailboxConfWindow *mcw);
 
 /* ========================================================= */
 /* BEGIN BalsaServerConf =================================== */
@@ -160,10 +158,8 @@ mailbox_conf_combo_box_info_free(struct mailbox_conf_combo_box_info *info)
     g_free(info);
 }
 
-
 static void
-mailbox_conf_combo_box_make(GtkComboBoxText        *combo_box,
-                            unsigned                cnt,
+mailbox_conf_combo_box_make(GtkComboBoxText * combo_box, unsigned cnt,
                             const struct menu_data *data)
 {
     struct mailbox_conf_combo_box_info *info =
@@ -171,7 +167,7 @@ mailbox_conf_combo_box_make(GtkComboBoxText        *combo_box,
     gint i;
 
     info->tags = NULL;
-    for (i = cnt; --i >= 0; ) {
+    for (i = cnt; --i >= 0;) {
         gtk_combo_box_text_prepend_text(combo_box, _(data[i].label));
         info->tags =
             g_slist_prepend(info->tags, GINT_TO_POINTER(data[i].tag));
@@ -184,8 +180,7 @@ mailbox_conf_combo_box_make(GtkComboBoxText        *combo_box,
 
 
 static void
-bsc_ssl_toggled_cb(GtkWidget       *widget,
-                   BalsaServerConf *bsc)
+bsc_ssl_toggled_cb(GtkWidget * widget, BalsaServerConf * bsc)
 {
     const gchar *host, *colon;
     gboolean newstate =
@@ -195,27 +190,24 @@ bsc_ssl_toggled_cb(GtkWidget       *widget,
 
     host = gtk_entry_get_text(GTK_ENTRY(bsc->server));
     if ((colon = strchr(host, ':')) != NULL) {
-        /* A port was specified... */
-        gchar *port = g_ascii_strdown(colon + 1, -1);
-        if (strstr(bsc->default_ports, port) != NULL) {
-            /* and it is one of the default ports, so strip it. */
-            gtk_editable_delete_text(GTK_EDITABLE(bsc->server),
+       /* A port was specified... */
+       gchar *port = g_ascii_strdown(colon + 1, -1);
+        if (strstr(bsc->default_ports, port) != NULL)
+           /* and it is one of the default ports, so strip it. */
+           gtk_editable_delete_text(GTK_EDITABLE(bsc->server),
                                      colon - host, -1);
-        }
-        g_free(port);
+       g_free(port);
     }
 }
 
-
-GtkWidget *
-balsa_server_conf_get_advanced_widget(BalsaServerConf *bsc,
-                                      LibBalsaServer  *s,
-                                      int              extra_rows)
+GtkWidget*
+balsa_server_conf_get_advanced_widget(BalsaServerConf *bsc, LibBalsaServer *s,
+                                      int extra_rows)
 {
     static const struct menu_data tls_menu[] = {
-        { N_("Never"), LIBBALSA_TLS_DISABLED },
+        { N_("Never"),       LIBBALSA_TLS_DISABLED },
         { N_("If Possible"), LIBBALSA_TLS_ENABLED  },
-        { N_("Required"), LIBBALSA_TLS_REQUIRED }
+        { N_("Required"),    LIBBALSA_TLS_REQUIRED }
     };
     GtkWidget *label;
     GtkWidget *box;
@@ -230,9 +222,8 @@ balsa_server_conf_get_advanced_widget(BalsaServerConf *bsc,
     bsc->used_rows = 0;
 
     bsc->use_ssl = balsa_server_conf_add_checkbox(bsc, _("Use _SSL"));
-    if (use_ssl) {
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bsc->use_ssl), TRUE);
-    }
+    if(use_ssl)
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bsc->use_ssl), TRUE);
 
     label =
         libbalsa_create_grid_label(_("Use _TLS:"), GTK_WIDGET(bsc->grid), 1);
@@ -254,8 +245,7 @@ balsa_server_conf_get_advanced_widget(BalsaServerConf *bsc,
     return box;
 }
 
-
-static GtkWidget *
+static GtkWidget*
 balsa_server_conf_get_advanced_widget_new(BalsaServerConf *bsc)
 {
     GtkWidget *box;
@@ -270,48 +260,34 @@ balsa_server_conf_get_advanced_widget_new(BalsaServerConf *bsc)
     bsc->used_rows = 0U;
 
     /* client certificate configuration */
-    bsc->need_client_cert =
-        balsa_server_conf_add_checkbox(bsc, _("Server requires client certificate"));
-
-    label = libbalsa_create_grid_label(_("Certificate _File:"), GTK_WIDGET(
-                                           bsc->grid), bsc->used_rows);
-    bsc->client_cert_file = gtk_file_chooser_button_new(_(
-                                                            "Choose Client Certificate"),
-                                                        GTK_FILE_CHOOSER_ACTION_OPEN);
+    bsc->need_client_cert = balsa_server_conf_add_checkbox(bsc, _("Server requires client certificate"));
+
+    label = libbalsa_create_grid_label(_("Certificate _File:"), GTK_WIDGET(bsc->grid), bsc->used_rows);
+    bsc->client_cert_file = gtk_file_chooser_button_new(_("Choose Client Certificate"), 
GTK_FILE_CHOOSER_ACTION_OPEN);
     gtk_widget_set_hexpand(bsc->client_cert_file, TRUE);
     gtk_grid_attach(bsc->grid, bsc->client_cert_file, 1, bsc->used_rows++, 1, 1);
     gtk_label_set_mnemonic_widget(GTK_LABEL(label), bsc->client_cert_file);
 
-    label = libbalsa_create_grid_label(_("Certificate _Pass Phrase:"), GTK_WIDGET(
-                                           bsc->grid), bsc->used_rows);
-    bsc->client_cert_passwd = libbalsa_create_grid_entry(GTK_WIDGET(
-                                                             bsc->grid), NULL, NULL, bsc->used_rows++, NULL,
-                                                         label);
-    g_object_set(G_OBJECT(
-                     bsc->client_cert_passwd), "input-purpose", GTK_INPUT_PURPOSE_PASSWORD,
-                 NULL);
+    label = libbalsa_create_grid_label(_("Certificate _Pass Phrase:"), GTK_WIDGET(bsc->grid), 
bsc->used_rows);
+    bsc->client_cert_passwd = libbalsa_create_grid_entry(GTK_WIDGET(bsc->grid), NULL, NULL, 
bsc->used_rows++, NULL, label);
+    g_object_set(G_OBJECT(bsc->client_cert_passwd), "input-purpose", GTK_INPUT_PURPOSE_PASSWORD, NULL);
     gtk_entry_set_visibility(GTK_ENTRY(bsc->client_cert_passwd), FALSE);
 
     return box;
 }
 
-
-GtkWidget *
+GtkWidget*
 balsa_server_conf_add_checkbox(BalsaServerConf *bsc,
-                               const char      *label)
+                               const char *label)
 {
     return libbalsa_create_grid_check(label, GTK_WIDGET(bsc->grid),
                                       bsc->used_rows++, FALSE);
 }
 
-
-GtkWidget *
+GtkWidget*
 balsa_server_conf_add_spinner(BalsaServerConf *bsc,
-                              const char      *label,
-                              gint             lo,
-                              gint             hi,
-                              gint             step,
-                              gint             initial_value)
+                              const char *label, gint lo, gint hi, gint step,
+                              gint initial_value)
 {
     GtkWidget *spin_button;
     GtkWidget *lbl = libbalsa_create_grid_label(label, GTK_WIDGET(bsc->grid),
@@ -319,7 +295,7 @@ balsa_server_conf_add_spinner(BalsaServerConf *bsc,
     spin_button = gtk_spin_button_new_with_range(lo, hi, step);
     gtk_widget_set_hexpand(spin_button, TRUE);
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_button),
-                              (float) initial_value);
+                             (float) initial_value);
 
     gtk_grid_attach(bsc->grid, spin_button, 1, bsc->used_rows, 1, 1);
     gtk_label_set_mnemonic_widget(GTK_LABEL(lbl), spin_button);
@@ -327,14 +303,12 @@ balsa_server_conf_add_spinner(BalsaServerConf *bsc,
     return spin_button;
 }
 
-
 void
-balsa_server_conf_set_values(BalsaServerConf *bsc,
-                             LibBalsaServer  *server)
+balsa_server_conf_set_values(BalsaServerConf *bsc, LibBalsaServer *server)
 {
     g_return_if_fail(server);
 
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bsc->use_ssl),
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bsc->use_ssl), 
                                  server->use_ssl);
     gtk_combo_box_set_active(GTK_COMBO_BOX(bsc->tls_option),
                              server->tls_mode);
@@ -348,7 +322,6 @@ balsa_server_conf_get_use_ssl(BalsaServerConf *bsc)
     return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bsc->use_ssl));
 }
 
-
 LibBalsaTlsMode
 balsa_server_conf_get_tls_mode(BalsaServerConf *bsc)
 {
@@ -358,16 +331,14 @@ balsa_server_conf_get_tls_mode(BalsaServerConf *bsc)
     gint active = gtk_combo_box_get_active(GTK_COMBO_BOX(bsc->tls_option));
 
     return (LibBalsaTlsMode)
-           GPOINTER_TO_INT(g_slist_nth_data(info->tags, active));
+        GPOINTER_TO_INT(g_slist_nth_data(info->tags, active));
 }
 
-
 /* END BalsaServerConf ===================================== */
 /* ========================================================= */
 
 static void
-pop3_enable_filter_cb(GtkWidget         *w,
-                      MailboxConfWindow *mcw)
+pop3_enable_filter_cb(GtkWidget * w, MailboxConfWindow * mcw)
 {
     GtkToggleButton *button = GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.filter);
     gtk_widget_set_sensitive(mcw->mb_data.pop3.filter_cmd,
@@ -375,93 +346,75 @@ pop3_enable_filter_cb(GtkWidget         *w,
     check_for_blank_fields(NULL, mcw);
 }
 
-
 static void
-client_cert_changed(GtkToggleButton   *button,
-                    MailboxConfWindow *mcw)
+client_cert_changed(GtkToggleButton *button, MailboxConfWindow *mcw)
 {
-    gboolean sensitive;
+       gboolean sensitive;
 
-    sensitive = gtk_toggle_button_get_active(button);
-    gtk_widget_set_sensitive(mcw->mb_data.pop3.bsc.client_cert_file, sensitive);
-    gtk_widget_set_sensitive(mcw->mb_data.pop3.bsc.client_cert_passwd, sensitive);
+       sensitive = gtk_toggle_button_get_active(button);
+       gtk_widget_set_sensitive(mcw->mb_data.pop3.bsc.client_cert_file, sensitive);
+       gtk_widget_set_sensitive(mcw->mb_data.pop3.bsc.client_cert_passwd, sensitive);
     check_for_blank_fields(NULL, mcw);
 }
 
-
 static void
-security_changed(GtkComboBox       *combo,
-                 MailboxConfWindow *mcw)
+security_changed(GtkComboBox *combo, MailboxConfWindow *mcw)
 {
-    gboolean sensitive;
+       gboolean sensitive;
 
-    sensitive = (gtk_combo_box_get_active(combo) + 1) != NET_CLIENT_CRYPT_NONE;
-    gtk_widget_set_sensitive(mcw->mb_data.pop3.bsc.need_client_cert, sensitive);
-    sensitive = sensitive &
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.bsc.need_client_cert));
-    gtk_widget_set_sensitive(mcw->mb_data.pop3.bsc.client_cert_file, sensitive);
-    gtk_widget_set_sensitive(mcw->mb_data.pop3.bsc.client_cert_passwd, sensitive);
+       sensitive = (gtk_combo_box_get_active(combo) + 1) != NET_CLIENT_CRYPT_NONE;
+       gtk_widget_set_sensitive(mcw->mb_data.pop3.bsc.need_client_cert, sensitive);
+       sensitive = sensitive & 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.bsc.need_client_cert));
+       gtk_widget_set_sensitive(mcw->mb_data.pop3.bsc.client_cert_file, sensitive);
+       gtk_widget_set_sensitive(mcw->mb_data.pop3.bsc.client_cert_passwd, sensitive);
     check_for_blank_fields(NULL, mcw);
 }
 
-
 /* BEGIN OF COMMONLY USED CALLBACKS SECTION ---------------------- */
 
 void
-mailbox_conf_add_mbox_cb(GtkWidget *widget,
-                         gpointer   data)
+mailbox_conf_add_mbox_cb(GtkWidget * widget, gpointer data)
 {
     mailbox_conf_new(LIBBALSA_TYPE_MAILBOX_MBOX);
 }
 
-
 void
-mailbox_conf_add_maildir_cb(GtkWidget *widget,
-                            gpointer   data)
+mailbox_conf_add_maildir_cb(GtkWidget * widget, gpointer data)
 {
     mailbox_conf_new(LIBBALSA_TYPE_MAILBOX_MAILDIR);
 }
 
-
 void
-mailbox_conf_add_mh_cb(GtkWidget *widget,
-                       gpointer   data)
+mailbox_conf_add_mh_cb(GtkWidget * widget, gpointer data)
 {
     mailbox_conf_new(LIBBALSA_TYPE_MAILBOX_MH);
 }
 
-
 void
-mailbox_conf_add_imap_cb(GtkWidget *widget,
-                         gpointer   data)
+mailbox_conf_add_imap_cb(GtkWidget * widget, gpointer data)
 {
     mailbox_conf_new(LIBBALSA_TYPE_MAILBOX_IMAP);
 }
 
-
 void
-mailbox_conf_delete_cb(GtkWidget *widget,
-                       gpointer   data)
+mailbox_conf_delete_cb(GtkWidget * widget, gpointer data)
 {
     BalsaMailboxNode *mbnode =
         balsa_mblist_get_selected_node(balsa_app.mblist);
 
-    if (mbnode->mailbox == NULL) {
+    if (mbnode->mailbox == NULL)
         balsa_information(LIBBALSA_INFORMATION_ERROR,
-                          _("No mailbox selected."));
-    } else {
-        mailbox_conf_delete(mbnode);
-    }
+                           _("No mailbox selected."));
+    else
+       mailbox_conf_delete(mbnode);
     g_object_unref(mbnode);
 }
 
-
 /* This can be used  for both mailbox and folder edition */
 void
-mailbox_conf_edit_cb(GtkWidget *widget,
-                     gpointer   data)
+mailbox_conf_edit_cb(GtkWidget * widget, gpointer data)
 {
-    BalsaMailboxNode *mbnode =
+    BalsaMailboxNode *mbnode = 
         balsa_mblist_get_selected_node(balsa_app.mblist);
     if (mbnode) {
         balsa_mailbox_node_show_prop_dialog(mbnode);
@@ -469,23 +422,22 @@ mailbox_conf_edit_cb(GtkWidget *widget,
     }
 }
 
-
 /* END OF COMMONLY USED CALLBACKS SECTION ------------------------ */
 void
-mailbox_conf_delete(BalsaMailboxNode *mbnode)
+mailbox_conf_delete(BalsaMailboxNode * mbnode)
 {
     gint button;
     GtkWidget *ask;
-    LibBalsaMailbox *mailbox = mbnode->mailbox;
+    LibBalsaMailbox* mailbox = mbnode->mailbox;
     gchar *url, *group;
 
-    if (BALSA_IS_MAILBOX_SPECIAL(mailbox)) {
-        balsa_information(
-            LIBBALSA_INFORMATION_ERROR,
-            _("Mailbox “%s” is used by Balsa and I cannot remove it.\n"
-              "If you really want to remove it, assign its function\n"
-              "to some other mailbox."), mailbox->name);
-        return;
+    if(BALSA_IS_MAILBOX_SPECIAL(mailbox)) {
+       balsa_information(
+           LIBBALSA_INFORMATION_ERROR,
+           _("Mailbox “%s” is used by Balsa and I cannot remove it.\n"
+             "If you really want to remove it, assign its function\n"
+             "to some other mailbox."), mailbox->name);
+       return;
     }
 
     if (LIBBALSA_IS_MAILBOX_LOCAL(mailbox)) {
@@ -509,22 +461,22 @@ mailbox_conf_delete(BalsaMailboxNode *mbnode)
                                _("_Cancel"), GTK_RESPONSE_CANCEL,
                                NULL);
     } else if (LIBBALSA_IS_MAILBOX_IMAP(mailbox) && !mailbox->config_prefix) {
-        /* deleting remote IMAP mailbox in a folder set */
+       /* deleting remote IMAP mailbox in a folder set */
         ask = gtk_message_dialog_new(GTK_WINDOW(balsa_app.main_window), 0,
                                      GTK_MESSAGE_QUESTION,
                                      GTK_BUTTONS_NONE,
-                                     _("This will remove the mailbox "
+                                    _("This will remove the mailbox "
                                        "“%s” and all its messages "
                                        "from your IMAP server. "
-                                       "If %s has subfolders, it will "
+                                      "If %s has subfolders, it will "
                                        "still appear as a node in the "
                                        "folder tree.\n"
-                                       "You may use "
+                                      "You may use "
                                        "“New IMAP subfolder” "
                                        "later to add a mailbox "
                                        "with this name.\n"
-                                       "What would you like to do?"),
-                                     mailbox->name, mailbox->name);
+                                      "What would you like to do?"),
+                                    mailbox->name, mailbox->name);
         gtk_dialog_add_buttons(GTK_DIALOG(ask),
                                _("_Remove from server"), 0,
                                _("_Cancel"), GTK_RESPONSE_CANCEL,
@@ -533,20 +485,20 @@ mailbox_conf_delete(BalsaMailboxNode *mbnode)
         ask = gtk_message_dialog_new(GTK_WINDOW(balsa_app.main_window), 0,
                                      GTK_MESSAGE_QUESTION,
                                      GTK_BUTTONS_NONE,
-                                     _("This will remove the mailbox "
+                                    _("This will remove the mailbox "
                                        "“%s” from the list "
                                        "of mailboxes.\n"
-                                       "You may use “Add Mailbox” "
+                                      "You may use “Add Mailbox” "
                                        "later to access "
                                        "this mailbox again.\n"
-                                       "What would you like to do?"),
-                                     mailbox->name);
+                                      "What would you like to do?"),
+                                    mailbox->name);
         gtk_dialog_add_buttons(GTK_DIALOG(ask),
                                _("_Remove from list"), 0,
                                _("_Cancel"), GTK_RESPONSE_CANCEL,
                                NULL);
     }
-
+    
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(ask, GTK_WINDOW(balsa_app.main_window));
 #endif
@@ -555,10 +507,9 @@ mailbox_conf_delete(BalsaMailboxNode *mbnode)
 
     /* button < 0 means that the dialog window was closed without pressing
        any button other than CANCEL.
-     */
-    if ( button < 0) {
-        return;
-    }
+    */
+    if ( button < 0)
+       return;
 
     /* Save the mailbox URL */
     url = g_strdup(mailbox->url ? mailbox->url : mailbox->name);
@@ -567,16 +518,15 @@ mailbox_conf_delete(BalsaMailboxNode *mbnode)
     config_mailbox_delete(mailbox);
 
     /* Close the mailbox, in case it was open */
-    if (!LIBBALSA_IS_MAILBOX_POP3(mailbox)) {
-        balsa_mblist_close_mailbox(mailbox);
-    }
+    if (!LIBBALSA_IS_MAILBOX_POP3(mailbox))
+       balsa_mblist_close_mailbox(mailbox);
 
     /* Remove mailbox on IMAP server */
     if (LIBBALSA_IS_MAILBOX_IMAP(mailbox) && !mailbox->config_prefix) {
         GError *err = NULL;
-        BalsaMailboxNode *parent = mbnode->parent;
-        if (libbalsa_imap_delete_folder(LIBBALSA_MAILBOX_IMAP(mailbox),
-                                        &err)) {
+       BalsaMailboxNode *parent = mbnode->parent;
+        if(libbalsa_imap_delete_folder(LIBBALSA_MAILBOX_IMAP(mailbox),
+                                       &err)) {
             /* a chain of folders might go away, so we'd better rescan from
              * higher up
              */
@@ -593,22 +543,20 @@ mailbox_conf_delete(BalsaMailboxNode *mbnode)
             g_clear_error(&err);
             g_free(url);
         }
-        return;
+       return;
     }
 
     /* Delete local files */
-    if (LIBBALSA_IS_MAILBOX_LOCAL(mailbox) && (button == 1)) {
-        libbalsa_mailbox_local_remove_files(LIBBALSA_MAILBOX_LOCAL(
-                                                mailbox));
-    }
+    if (LIBBALSA_IS_MAILBOX_LOCAL(mailbox) && button == 1)
+       libbalsa_mailbox_local_remove_files(LIBBALSA_MAILBOX_LOCAL(
+             mailbox));
 
     /* Remove the node from balsa's mailbox list */
     if (LIBBALSA_IS_MAILBOX_POP3(mailbox)) {
-        balsa_app.inbox_input = g_list_remove(balsa_app.inbox_input,
-                                              mbnode);
-    } else {
-        balsa_mblist_mailbox_node_remove(mbnode);
-    }
+       balsa_app.inbox_input = g_list_remove(balsa_app.inbox_input, 
+                                             mbnode);
+    } else
+       balsa_mblist_mailbox_node_remove(mbnode);
     update_mail_servers();
 
     /* Clean up filters */
@@ -624,38 +572,30 @@ mailbox_conf_delete(BalsaMailboxNode *mbnode)
     g_free(url);
 }
 
-
 #define MCW_RESPONSE 1
 #define BALSA_MAILBOX_CONF_DIALOG "balsa-mailbox-conf-dialog"
 static void
-conf_response_cb(GtkDialog         *dialog,
-                 gint               response,
-                 MailboxConfWindow *mcw)
+conf_response_cb(GtkDialog* dialog, gint response, MailboxConfWindow * mcw)
 {
-    switch (response) {
-    case MCW_RESPONSE: mcw->ok_handler(mcw);
-
-    /* fall through */
+    switch(response) {
+    case MCW_RESPONSE: mcw->ok_handler(mcw); 
+        /* fall through */
     default:
-        if (mcw->mailbox) {
+        if (mcw->mailbox)
             g_object_set_data(G_OBJECT(mcw->mailbox),
                               BALSA_MAILBOX_CONF_DIALOG, NULL);
-        }
         gtk_widget_destroy(GTK_WIDGET(dialog));
-
-    /* fall through */
+        /* fall through */
     case 0:
         break;
     }
 }
 
-
 static GtkWidget *
-run_mailbox_conf(BalsaMailboxNode *mbnode,
-                 GType             mailbox_type,
-                 gboolean          update)
+run_mailbox_conf(BalsaMailboxNode* mbnode, GType mailbox_type, 
+                gboolean update)
 {
-    MailboxConfWindow *mcw;
+    MailboxConfWindow* mcw;
 
     g_return_val_if_fail(g_type_is_a(mailbox_type, LIBBALSA_TYPE_MAILBOX),
                          NULL);
@@ -674,25 +614,22 @@ run_mailbox_conf(BalsaMailboxNode *mbnode,
 
     mcw->window = GTK_DIALOG(create_dialog(mcw));
     g_object_weak_ref(G_OBJECT(mcw->window), (GWeakNotify) g_free, mcw);
-
+    
     gtk_dialog_set_response_sensitive(mcw->window, MCW_RESPONSE, FALSE);
     mcw->ok_sensitive = FALSE;
     gtk_dialog_set_default_response(mcw->window,
                                     update ? GTK_RESPONSE_CANCEL :
                                     MCW_RESPONSE);
 
-    if (mbnode) {
+    if(mbnode)
         mailbox_conf_set_values(mcw);
-    }
 
-    g_signal_connect(G_OBJECT(mcw->window), "response",
+    g_signal_connect(G_OBJECT(mcw->window), "response", 
                      G_CALLBACK(conf_response_cb), mcw);
     gtk_widget_show(GTK_WIDGET(mcw->window));
 
     return GTK_WIDGET(mcw->window);
 }
-
-
 /*
  * Brings up dialog to configure a new mailbox of type mailbox_type.
  * If the used clicks save add the new mailbox to the tree.
@@ -708,15 +645,14 @@ mailbox_conf_new(GType mailbox_type)
     }
 
     dialog = run_mailbox_conf(NULL, mailbox_type, FALSE);
-    g_object_add_weak_pointer(G_OBJECT(dialog), (gpointer) & dialog);
+    g_object_add_weak_pointer(G_OBJECT(dialog), (gpointer) &dialog);
 }
 
-
 /*
  * Edit an existing mailboxes properties
  */
 void
-mailbox_conf_edit(BalsaMailboxNode *mbnode)
+mailbox_conf_edit(BalsaMailboxNode * mbnode)
 {
     GtkWidget *dialog;
 
@@ -736,67 +672,56 @@ mailbox_conf_edit(BalsaMailboxNode *mbnode)
                       dialog);
 }
 
-
 static void
 mailbox_conf_set_values_pop3(LibBalsaMailbox   *mailbox,
-                             MailboxConfWindow *mcw)
+                                                        MailboxConfWindow *mcw)
 {
-    LibBalsaMailboxPop3 *pop3;
-    LibBalsaServer *server;
-    gboolean sensitive;
-
-    pop3 = LIBBALSA_MAILBOX_POP3(mailbox);
-    server = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
-
-    /* basic settings */
-    if (server->host != NULL) {
-        gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.pop3.bsc.server), server->host);
-    }
-    gtk_combo_box_set_active(GTK_COMBO_BOX(mcw->mb_data.pop3.security), server->security - 1);
-
-    if (server->user != NULL) {
-        gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.pop3.username), server->user);
-    }
-
-    if (server->passwd != NULL) {
-        gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.pop3.password), server->passwd);
-    }
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
-                                     mcw->mb_data.pop3.delete_from_server),
-                                 pop3->delete_from_server);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.check), pop3->check);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.filter), pop3->filter);
-    if (pop3->filter_cmd != NULL) {
-        gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.pop3.filter_cmd), pop3->filter_cmd);
-    }
-    gtk_widget_set_sensitive(mcw->mb_data.pop3.filter_cmd, pop3->filter);
-
-    /* advanced settings */
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
-                                     mcw->mb_data.pop3.bsc.need_client_cert),
-                                 server->client_cert);
-    sensitive = (server->security != NET_CLIENT_CRYPT_NONE);
-    gtk_widget_set_sensitive(mcw->mb_data.pop3.bsc.need_client_cert, sensitive);
-    sensitive = sensitive & server->client_cert;
+       LibBalsaMailboxPop3 *pop3;
+       LibBalsaServer *server;
+       gboolean sensitive;
+
+       pop3 = LIBBALSA_MAILBOX_POP3(mailbox);
+       server = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
+
+       /* basic settings */
+       if (server->host != NULL) {
+               gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.pop3.bsc.server), server->host);
+       }
+       gtk_combo_box_set_active(GTK_COMBO_BOX(mcw->mb_data.pop3.security), server->security - 1);
+
+       if (server->user != NULL) {
+               gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.pop3.username), server->user);
+       }
+
+       if (server->passwd != NULL) {
+               gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.pop3.password), server->passwd);
+       }
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.delete_from_server), 
pop3->delete_from_server);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.check), pop3->check);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.filter), pop3->filter);
+       if (pop3->filter_cmd != NULL) {
+               gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.pop3.filter_cmd), pop3->filter_cmd);
+       }
+       gtk_widget_set_sensitive(mcw->mb_data.pop3.filter_cmd, pop3->filter);
+
+       /* advanced settings */
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.bsc.need_client_cert), 
server->client_cert);
+       sensitive = (server->security != NET_CLIENT_CRYPT_NONE);
+       gtk_widget_set_sensitive(mcw->mb_data.pop3.bsc.need_client_cert, sensitive);
+       sensitive = sensitive & server->client_cert;
 
     if (server->cert_file != NULL) {
-        gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(
-                                          mcw->mb_data.pop3.bsc.client_cert_file),
-                                      server->cert_file);
+       gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(mcw->mb_data.pop3.bsc.client_cert_file), 
server->cert_file);
     }
     gtk_widget_set_sensitive(mcw->mb_data.pop3.bsc.client_cert_file, sensitive);
 
-    if (server->cert_passphrase != NULL) {
-        gtk_entry_set_text(GTK_ENTRY(
-                               mcw->mb_data.pop3.bsc.client_cert_passwd),
-                           server->cert_passphrase);
-    }
-    gtk_widget_set_sensitive(mcw->mb_data.pop3.bsc.client_cert_passwd, sensitive);
+       if (server->cert_passphrase != NULL) {
+               gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.pop3.bsc.client_cert_passwd), 
server->cert_passphrase);
+       }
+       gtk_widget_set_sensitive(mcw->mb_data.pop3.bsc.client_cert_passwd, sensitive);
 
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
-                                     mcw->mb_data.pop3.disable_apop), pop3->disable_apop);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
-                                     mcw->mb_data.pop3.enable_pipe), pop3->enable_pipe);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.disable_apop), pop3->disable_apop);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.enable_pipe), pop3->enable_pipe);
 }
 
 
@@ -806,233 +731,199 @@ mailbox_conf_set_values_pop3(LibBalsaMailbox   *mailbox,
 static void
 mailbox_conf_set_values(MailboxConfWindow *mcw)
 {
-    LibBalsaMailbox *mailbox;
-
-    mailbox = mcw->mailbox;
-
-    g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
-
-    if (mcw->mailbox_name && mailbox->name) {
-        gtk_entry_set_text(GTK_ENTRY(mcw->mailbox_name), mailbox->name);
-    }
-
-    if (LIBBALSA_IS_MAILBOX_LOCAL(mailbox)) {
-        if (mailbox->url) {
-            GtkFileChooser *chooser = GTK_FILE_CHOOSER(mcw->window);
-            LibBalsaMailboxLocal *local = LIBBALSA_MAILBOX_LOCAL(mailbox);
-            const gchar *path = libbalsa_mailbox_local_get_path(local);
-            gchar *basename = g_path_get_basename(path);
-            gtk_file_chooser_set_filename(chooser, path);
-            gtk_file_chooser_set_current_name(chooser, basename);
-            g_free(basename);
-        }
-    } else if (LIBBALSA_IS_MAILBOX_POP3(mailbox)) {
-        mailbox_conf_set_values_pop3(mailbox, mcw);
-    } else if (LIBBALSA_IS_MAILBOX_IMAP(mailbox)) {
-        LibBalsaMailboxImap *imap;
-        LibBalsaServer *server;
-        const gchar *path;
-        imap = LIBBALSA_MAILBOX_IMAP(mailbox);
-        server = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
-
-        if (server->host) {
-            gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.imap.bsc.server),
-                               server->host);
-        }
-        if (server->user) {
-            gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.imap.username),
-                               server->user);
-        }
-        gtk_toggle_button_set_active
-            (GTK_TOGGLE_BUTTON(mcw->mb_data.imap.anonymous),
-            server->try_anonymous);
-        gtk_toggle_button_set_active
-            (GTK_TOGGLE_BUTTON(mcw->mb_data.imap.remember),
-            server->remember_passwd);
-        if (server->passwd) {
-            gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.imap.password),
-                               server->passwd);
-        }
-        path = libbalsa_mailbox_imap_get_path(imap);
-        if (path) {
-            gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.imap.folderpath),
-                               path);
-        }
-        balsa_server_conf_set_values(&mcw->mb_data.imap.bsc, server);
-        if (libbalsa_imap_server_has_persistent_cache
-                (LIBBALSA_IMAP_SERVER(server))) {
-            gtk_toggle_button_set_active
-                (GTK_TOGGLE_BUTTON(mcw->mb_data.imap.enable_persistent),
-                TRUE);
-        }
-        if (libbalsa_imap_server_has_bug(LIBBALSA_IMAP_SERVER(server),
-                                         ISBUG_FETCH)) {
-            gtk_toggle_button_set_active
-                (GTK_TOGGLE_BUTTON(mcw->mb_data.imap.has_bugs),
-                TRUE);
-        }
-        if (!server->try_anonymous) {
-            gtk_widget_set_sensitive(GTK_WIDGET(mcw->mb_data.imap.anonymous),
-                                     FALSE);
-        }
-        if (!server->remember_passwd) {
-            gtk_widget_set_sensitive(GTK_WIDGET(mcw->mb_data.imap.password),
-                                     FALSE);
-        }
-    }
+       LibBalsaMailbox * mailbox;
+
+       mailbox = mcw->mailbox;
+
+       g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
+
+       if (mcw->mailbox_name && mailbox->name)
+               gtk_entry_set_text(GTK_ENTRY(mcw->mailbox_name), mailbox->name);
+
+       if (LIBBALSA_IS_MAILBOX_LOCAL(mailbox)) {
+               if (mailbox->url) {
+                       GtkFileChooser *chooser = GTK_FILE_CHOOSER(mcw->window);
+                       LibBalsaMailboxLocal *local = LIBBALSA_MAILBOX_LOCAL(mailbox);
+                       const gchar *path = libbalsa_mailbox_local_get_path(local);
+                       gchar *basename = g_path_get_basename(path);
+                       gtk_file_chooser_set_filename(chooser, path);
+                       gtk_file_chooser_set_current_name(chooser, basename);
+                       g_free(basename);
+               }
+       } else if (LIBBALSA_IS_MAILBOX_POP3(mailbox)) {
+               mailbox_conf_set_values_pop3(mailbox, mcw);
+       } else if (LIBBALSA_IS_MAILBOX_IMAP(mailbox)) {
+               LibBalsaMailboxImap *imap;
+               LibBalsaServer *server;
+               const gchar *path;
+               imap = LIBBALSA_MAILBOX_IMAP(mailbox);
+               server = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
+
+               if (server->host)
+                       gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.imap.bsc.server),
+                               server->host);
+               if (server->user)
+                       gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.imap.username),
+                               server->user);
+               gtk_toggle_button_set_active
+               (GTK_TOGGLE_BUTTON(mcw->mb_data.imap.anonymous),
+                       server->try_anonymous);
+               gtk_toggle_button_set_active
+               (GTK_TOGGLE_BUTTON(mcw->mb_data.imap.remember),
+                       server->remember_passwd);
+               if (server->passwd)
+                       gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.imap.password),
+                               server->passwd);
+               path = libbalsa_mailbox_imap_get_path(imap);
+               if (path)
+                       gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.imap.folderpath),
+                               path);
+               balsa_server_conf_set_values(&mcw->mb_data.imap.bsc, server);
+               if(libbalsa_imap_server_has_persistent_cache
+                       (LIBBALSA_IMAP_SERVER(server)))
+                       gtk_toggle_button_set_active
+                       (GTK_TOGGLE_BUTTON(mcw->mb_data.imap.enable_persistent),
+                               TRUE);
+               if(libbalsa_imap_server_has_bug(LIBBALSA_IMAP_SERVER(server),
+                       ISBUG_FETCH))
+                       gtk_toggle_button_set_active
+                       (GTK_TOGGLE_BUTTON(mcw->mb_data.imap.has_bugs),
+                               TRUE);
+               if(!server->try_anonymous)
+                       gtk_widget_set_sensitive(GTK_WIDGET(mcw->mb_data.imap.anonymous),
+                               FALSE);
+               if(!server->remember_passwd)
+                       gtk_widget_set_sensitive(GTK_WIDGET(mcw->mb_data.imap.password),
+                               FALSE);
+       }
 }
 
 
 /*
  * Checks for blank fields in the dialog.
  * Sets the sensitivity of the Update/Add button accordingly.
- * This function should be attached to a change event signal
+ * This function should be attached to a change event signal 
  * on any widget which can affect the validity of the input.
  */
 static void
-check_for_blank_fields(GtkWidget G_GNUC_UNUSED *widget,
-                       MailboxConfWindow       *mcw)
+check_for_blank_fields(GtkWidget G_GNUC_UNUSED *widget, MailboxConfWindow *mcw)
 {
     gboolean sensitive;
 
-    if ((mcw == NULL) || (mcw->window == NULL)) {
+    if (mcw == NULL || mcw->window == NULL)
         return;
-    }
 
     sensitive = TRUE;
 
-    if (mcw->mailbox_name && !*gtk_entry_get_text(GTK_ENTRY(mcw->mailbox_name))) {
-        sensitive = FALSE;
-    } else if (g_type_is_a(mcw->mailbox_type, LIBBALSA_TYPE_MAILBOX_LOCAL)) {
+    if (mcw->mailbox_name &&!*gtk_entry_get_text(GTK_ENTRY(mcw->mailbox_name)))
+       sensitive = FALSE;
+    else if (g_type_is_a(mcw->mailbox_type, LIBBALSA_TYPE_MAILBOX_LOCAL) ) {
         gchar *filename =
             gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(mcw->window));
-        if (filename) {
-            g_free(filename);
-        } else {
-            sensitive = FALSE;
-        }
-    } else if (g_type_is_a(mcw->mailbox_type, LIBBALSA_TYPE_MAILBOX_IMAP )) {
-        if (!*gtk_entry_get_text(GTK_ENTRY(mcw->mb_data.imap.folderpath))
+       if (filename)
+           g_free(filename);
+       else
+           sensitive = FALSE;
+    } else if (g_type_is_a(mcw->mailbox_type, LIBBALSA_TYPE_MAILBOX_IMAP ) ) {
+       if (!*gtk_entry_get_text(GTK_ENTRY(mcw->mb_data.imap.folderpath))
             || !*gtk_entry_get_text(GTK_ENTRY(mcw->mb_data.imap.bsc.server))
-            || !*gtk_entry_get_text(GTK_ENTRY(mcw->mb_data.imap.username))) {
-            sensitive = FALSE;
-        }
-    } else if (g_type_is_a(mcw->mailbox_type, LIBBALSA_TYPE_MAILBOX_POP3)) {
-        /* POP3: require user name and server */
-        if ((gtk_entry_get_text(GTK_ENTRY(mcw->mb_data.pop3.username))[0] == '\0') ||
+            || !*gtk_entry_get_text(GTK_ENTRY(mcw->mb_data.imap.username)))
+           sensitive = FALSE;
+    } else if (g_type_is_a(mcw->mailbox_type, LIBBALSA_TYPE_MAILBOX_POP3) ) {
+       /* POP3: require user name and server */
+       if ((gtk_entry_get_text(GTK_ENTRY(mcw->mb_data.pop3.username))[0] == '\0') ||
             (gtk_entry_get_text(GTK_ENTRY(mcw->mb_data.pop3.bsc.server))[0] == '\0')) {
-            sensitive = FALSE;
-        }
-        /* procmail filtering requires command */
-        if (sensitive &&
-            gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.filter)) &&
-            (gtk_entry_get_text(GTK_ENTRY(mcw->mb_data.pop3.filter_cmd))[0] == '\0')) {
-            sensitive = FALSE;
-        }
-        /* encryption w/ client cert requires cert file */
-        if (sensitive &&
-            ((gtk_combo_box_get_active(GTK_COMBO_BOX(mcw->mb_data.pop3.security)) + 1) !=
-             NET_CLIENT_CRYPT_NONE) &&
-            gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.bsc.
-                                                           need_client_cert))) {
-            gchar *cert_file;
-
-            cert_file =
-                gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(
-                                                  mcw->mb_data.pop3.bsc.client_cert_file));
-            if ((cert_file == NULL) || (cert_file[0] == '\0')) {
-                sensitive = FALSE;
-            }
-            g_free(cert_file);
-        }
+               sensitive = FALSE;
+       }
+       /* procmail filtering requires command */
+       if (sensitive &&
+               gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.filter)) &&
+               (gtk_entry_get_text(GTK_ENTRY(mcw->mb_data.pop3.filter_cmd))[0] == '\0')) {
+               sensitive = FALSE;
+       }
+       /* encryption w/ client cert requires cert file */
+       if (sensitive &&
+               ((gtk_combo_box_get_active(GTK_COMBO_BOX(mcw->mb_data.pop3.security)) + 1) != 
NET_CLIENT_CRYPT_NONE) &&
+               gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.bsc.need_client_cert))) {
+               gchar *cert_file;
+
+               cert_file = 
gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(mcw->mb_data.pop3.bsc.client_cert_file));
+               if ((cert_file == NULL) || (cert_file[0] == '\0')) {
+                       sensitive = FALSE;
+               }
+               g_free(cert_file);
+       }
     }
 
     gtk_dialog_set_response_sensitive(mcw->window, MCW_RESPONSE, sensitive);
     mcw->ok_sensitive = sensitive;
 }
 
-
 /*
  * Update an IMAP mailbox with details from the dialog
  */
 static void
-fill_in_imap_data(MailboxConfWindow *mcw,
-                  gchar            **name,
-                  gchar            **path)
+fill_in_imap_data(MailboxConfWindow *mcw, gchar ** name, gchar ** path)
 {
     *path =
-        gtk_editable_get_chars(GTK_EDITABLE(mcw->mb_data.imap.folderpath),
+       gtk_editable_get_chars(GTK_EDITABLE(mcw->mb_data.imap.folderpath),
                                0, -1);
 
     if (mcw->mailbox_name && (!(*name =
-                                    gtk_editable_get_chars(GTK_EDITABLE(mcw->mailbox_name), 0,
-                                                           -1))
-                              || (*(g_strstrip(*name)) == '\0'))) {
-        if (*name) {
-            g_free(*name);
-        }
-
-        *name = g_strdup_printf(_("%s on %s"), *path,
-                                gtk_entry_get_text(GTK_ENTRY
-                                                       (mcw->mb_data.imap.bsc.server)));
+         gtk_editable_get_chars(GTK_EDITABLE(mcw->mailbox_name), 0, -1))
+       || *(g_strstrip(*name)) == '\0')) {
+       if (*name)
+           g_free(*name);
+
+       *name = g_strdup_printf(_("%s on %s"), *path,
+                               gtk_entry_get_text(GTK_ENTRY
+                                                  (mcw->mb_data.imap.bsc.server)));
     }
 }
 
-
 /*
  * Update a pop3 mailbox with details from the dialog
  */
 static void
 update_pop_mailbox(MailboxConfWindow *mcw)
 {
-    LibBalsaMailboxPop3 *mailbox;
-    LibBalsaServer *server;
-    BalsaServerConf *bsc;
-
-    mailbox = LIBBALSA_MAILBOX_POP3(mcw->mailbox);
-    server = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
-    bsc = &mcw->mb_data.pop3.bsc;
-
-    /* basic data */
-    g_free(LIBBALSA_MAILBOX(mailbox)->name);
-    LIBBALSA_MAILBOX(mailbox)->name =
-        gtk_editable_get_chars(GTK_EDITABLE(mcw->mailbox_name), 0, -1);
-
-    libbalsa_server_set_host(server, gtk_entry_get_text(GTK_ENTRY(
-                                                            mcw->mb_data.pop3.bsc.server)),
-                             FALSE);
-    server->security = gtk_combo_box_get_active(GTK_COMBO_BOX(mcw->mb_data.pop3.security)) + 1;
-
-    libbalsa_server_set_username(server,
-                                 gtk_entry_get_text(GTK_ENTRY(mcw->mb_data.pop3.username)));
-    libbalsa_server_set_password(server,
-                                 gtk_entry_get_text(GTK_ENTRY(mcw->mb_data.pop3.password)));
-    libbalsa_server_config_changed(server);
-
-    mailbox->check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.check));
-    mailbox->delete_from_server =
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (mcw->mb_data.pop3.delete_from_server));
-    mailbox->filter = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.filter));
-    g_free(mailbox->filter_cmd);
-    mailbox->filter_cmd =
-        gtk_editable_get_chars(GTK_EDITABLE(mcw->mb_data.pop3.filter_cmd), 0, -1);
-
-    /* advanced settings */
-    server->client_cert =
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bsc->need_client_cert));
-    g_free(server->cert_file);
-    server->cert_file =
-        g_strdup(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(bsc->client_cert_file)));
-    g_free(server->cert_passphrase);
-    server->cert_passphrase = gtk_editable_get_chars(GTK_EDITABLE(
-                                                         bsc->client_cert_passwd), 0, -1);
-    mailbox->disable_apop =
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.disable_apop));
-    mailbox->enable_pipe =
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.enable_pipe));
+       LibBalsaMailboxPop3 *mailbox;
+       LibBalsaServer *server;
+       BalsaServerConf *bsc;
+
+       mailbox = LIBBALSA_MAILBOX_POP3(mcw->mailbox);
+       server = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
+       bsc = &mcw->mb_data.pop3.bsc;
+
+       /* basic data */
+       g_free(LIBBALSA_MAILBOX(mailbox)->name);
+       LIBBALSA_MAILBOX(mailbox)->name =
+            gtk_editable_get_chars(GTK_EDITABLE(mcw->mailbox_name), 0, -1);
+
+       libbalsa_server_set_host(server, gtk_entry_get_text(GTK_ENTRY(mcw->mb_data.pop3.bsc.server)), FALSE);
+       server->security = gtk_combo_box_get_active(GTK_COMBO_BOX(mcw->mb_data.pop3.security)) + 1;
+
+       libbalsa_server_set_username(server, gtk_entry_get_text(GTK_ENTRY(mcw->mb_data.pop3.username)));
+       libbalsa_server_set_password(server, gtk_entry_get_text(GTK_ENTRY(mcw->mb_data.pop3.password)));
+       libbalsa_server_config_changed(server);
+
+       mailbox->check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.check));
+       mailbox->delete_from_server = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON 
(mcw->mb_data.pop3.delete_from_server));
+       mailbox->filter = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.filter));
+       g_free(mailbox->filter_cmd);
+       mailbox->filter_cmd =
+            gtk_editable_get_chars(GTK_EDITABLE(mcw->mb_data.pop3.filter_cmd), 0, -1);
+
+       /* advanced settings */
+       server->client_cert = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bsc->need_client_cert));
+       g_free(server->cert_file);
+       server->cert_file = g_strdup(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(bsc->client_cert_file)));;
+       g_free(server->cert_passphrase);
+       server->cert_passphrase = gtk_editable_get_chars(GTK_EDITABLE(bsc->client_cert_passwd), 0, -1);
+       mailbox->disable_apop = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.disable_apop));
+       mailbox->enable_pipe = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mcw->mb_data.pop3.enable_pipe));
 }
 
-
 /*
  * Update an imap mcw->mailbox with details from the dialog
  */
@@ -1041,64 +932,63 @@ update_imap_mailbox(MailboxConfWindow *mcw)
 {
     gchar *path;
     LibBalsaMailboxImap *mailbox;
-    LibBalsaServer *server;
+    LibBalsaServer* server;
 
     mailbox = LIBBALSA_MAILBOX_IMAP(mcw->mailbox);
-    server = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
+    server  = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
     if (!server) {
-        server = LIBBALSA_SERVER(libbalsa_imap_server_new("", ""));
-        libbalsa_mailbox_remote_set_server(LIBBALSA_MAILBOX_REMOTE(mailbox),
-                                           server);
-        g_signal_connect_swapped(server, "config-changed",
+       server = LIBBALSA_SERVER(libbalsa_imap_server_new("",""));
+       libbalsa_mailbox_remote_set_server(LIBBALSA_MAILBOX_REMOTE(mailbox),
+                                          server);
+       g_signal_connect_swapped(server, "config-changed",
                                  G_CALLBACK(config_mailbox_update),
-                                 mailbox);
+                                mailbox);
     }
     g_free(LIBBALSA_MAILBOX(mailbox)->name);
     fill_in_imap_data(mcw, &LIBBALSA_MAILBOX(mailbox)->name, &path);
     libbalsa_server_set_username(server,
-                                 gtk_entry_get_text(GTK_ENTRY
-                                                        (mcw->mb_data.imap.username)));
-    server->try_anonymous =
+                                gtk_entry_get_text(GTK_ENTRY
+                                                   (mcw->mb_data.imap.username)));
+    server->try_anonymous = 
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mcw->
                                                        mb_data.imap.anonymous));
-    server->remember_passwd =
+    server->remember_passwd = 
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mcw->
                                                        mb_data.imap.remember));
     server->tls_mode = balsa_server_conf_get_tls_mode(&mcw->mb_data.imap.bsc);
     libbalsa_server_set_password(server,
-                                 gtk_entry_get_text(GTK_ENTRY
-                                                        (mcw->mb_data.imap.password)));
+                                gtk_entry_get_text(GTK_ENTRY
+                                                   (mcw->mb_data.imap.password)));
     libbalsa_imap_server_enable_persistent_cache
         (LIBBALSA_IMAP_SERVER(server),
-        gtk_toggle_button_get_active
-        GTK_TOGGLE_BUTTON(mcw->mb_data.imap.enable_persistent));
+         gtk_toggle_button_get_active
+         GTK_TOGGLE_BUTTON(mcw->mb_data.imap.enable_persistent));
     libbalsa_imap_server_set_bug
         (LIBBALSA_IMAP_SERVER(server), ISBUG_FETCH,
-        gtk_toggle_button_get_active
-        GTK_TOGGLE_BUTTON(mcw->mb_data.imap.has_bugs));
+         gtk_toggle_button_get_active
+         GTK_TOGGLE_BUTTON(mcw->mb_data.imap.has_bugs));
     /* Set host after all other server changes, as it triggers
      * save-to-config for any folder or mailbox using this server. */
     libbalsa_server_set_host(server,
-                             gtk_entry_get_text(GTK_ENTRY
-                                                    (mcw->mb_data.imap.bsc.server)),
+                            gtk_entry_get_text(GTK_ENTRY
+                                               (mcw->mb_data.imap.bsc.server)),
                              balsa_server_conf_get_use_ssl
-                                 (&mcw->mb_data.imap.bsc));
+                             (&mcw->mb_data.imap.bsc));
     libbalsa_server_config_changed(server);
     g_signal_connect(G_OBJECT(server), "get-password",
                      G_CALLBACK(ask_password), mailbox);
 
     libbalsa_mailbox_imap_set_path(mailbox,
-                                   (path == NULL || path[0] == '\0')
-                                   ? "INBOX" : path);
+                                  (path == NULL || path[0] == '\0') 
+                                  ? "INBOX" : path);
     g_free(path);
 }
 
-
 /* conf_update_mailbox:
-   if changing path of the local mailbox in the local mail directory, just
+   if changing path of the local mailbox in the local mail directory, just 
    rename the file, don't insert it to the configuration.
-   FIXME: make sure that the rename breaks nothing.
- */
+   FIXME: make sure that the rename breaks nothing. 
+*/
 static void
 mailbox_conf_update(MailboxConfWindow *mcw)
 {
@@ -1107,88 +997,84 @@ mailbox_conf_update(MailboxConfWindow *mcw)
     mailbox_conf_view_check(mcw->view_info, mailbox);
 
     if (LIBBALSA_IS_MAILBOX_LOCAL(mailbox)) {
-        BalsaMailboxNode *mbnode;
-        gchar *filename;
-        gchar *path;
-        gchar *name;
+       BalsaMailboxNode *mbnode;
+       gchar *filename;
+       gchar *path;
+       gchar *name;
 
-        mbnode = balsa_find_mailbox(mailbox);
+       mbnode = balsa_find_mailbox(mailbox);
         filename =
             gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(mcw->window));
-        path = g_strdup(libbalsa_mailbox_local_get_path(mailbox));
+       path = g_strdup(libbalsa_mailbox_local_get_path(mailbox));
         if (strcmp(filename, path)) {
             /* rename */
             int i;
-            gchar *file_dir, *path_dir;
+           gchar *file_dir, *path_dir;
 
             i = libbalsa_mailbox_local_set_path(LIBBALSA_MAILBOX_LOCAL
-                                                    (mailbox), filename, FALSE);
+                                                (mailbox), filename, FALSE);
             if (i != 0) {
                 balsa_information(LIBBALSA_INFORMATION_WARNING,
                                   _("Rename of %s to %s failed:\n%s"),
                                   path, filename, strerror(i));
                 g_free(filename);
-                g_free(path);
+               g_free(path);
                 return;
             }
 
-            file_dir = g_path_get_dirname(filename);
-            path_dir = g_path_get_dirname(path);
+           file_dir = g_path_get_dirname(filename);
+           path_dir = g_path_get_dirname(path);
             if (strcmp(file_dir, path_dir)) {
-                /* Actual move. */
-                balsa_mblist_mailbox_node_remove(mbnode);
-                g_object_ref(mailbox);
-                g_object_unref(mbnode);
-                balsa_mailbox_local_append(mailbox);
-
-                /* We might have moved a subtree. */
-                mbnode = balsa_find_mailbox(mailbox);
-                balsa_mailbox_node_rescan(mbnode);
-            }
+               /* Actual move. */
+               balsa_mblist_mailbox_node_remove(mbnode);
+               g_object_ref(mailbox);
+               g_object_unref(mbnode);
+               balsa_mailbox_local_append(mailbox);
+
+               /* We might have moved a subtree. */
+               mbnode = balsa_find_mailbox(mailbox);
+               balsa_mailbox_node_rescan(mbnode);
+            } 
 
             g_free(file_dir);
             g_free(path_dir);
-        }
+       }
 
         name = mcw->mailbox_name ?
             gtk_editable_get_chars(GTK_EDITABLE(mcw->mailbox_name), 0, -1)
             : g_path_get_basename(filename);
-        if (strcmp(name, mailbox->name)) {
-            /* Change name. */
+       if (strcmp(name, mailbox->name)) {
+           /* Change name. */
             g_free(mailbox->name);
-            mailbox->name = name;
-            balsa_mblist_mailbox_node_redraw(mbnode);
-        } else {
-            g_free(name);
-        }
+           mailbox->name = name;
+           balsa_mblist_mailbox_node_redraw(mbnode);
+       } else
+           g_free(name);
 
-        g_object_unref(mbnode);
+       g_object_unref(mbnode);
         g_free(filename);
-        g_free(path);
+       g_free(path);
     } else if (LIBBALSA_IS_MAILBOX_POP3(mailbox)) {
-        update_pop_mailbox(mcw);
+       update_pop_mailbox(mcw);
     } else if (LIBBALSA_IS_MAILBOX_IMAP(mailbox)) {
-        update_imap_mailbox(mcw);
+       update_imap_mailbox(mcw);
         /* update_imap_mailbox saved the config so we do not need to here: */
-        return;
+       return;
     }
 
-    if (mailbox->config_prefix) {
-        config_mailbox_update(mailbox);
-    }
+    if (mailbox->config_prefix)
+       config_mailbox_update(mailbox);
 
-    if (LIBBALSA_IS_MAILBOX_POP3(mcw->mailbox)) {
-        /* redraw the pop3 server list */
-        update_mail_servers();
-    }
+    if (LIBBALSA_IS_MAILBOX_POP3(mcw->mailbox))
+       /* redraw the pop3 server list */
+       update_mail_servers();
 }
 
-
 /*
  * Add a new mailbox, based on the contents of the dialog.
  */
 static void
-mailbox_conf_add(MailboxConfWindow *mcw)
+mailbox_conf_add(MailboxConfWindow * mcw)
 {
     BalsaMailboxNode *mbnode;
     gboolean save_to_config = TRUE;
@@ -1196,9 +1082,9 @@ mailbox_conf_add(MailboxConfWindow *mcw)
     mcw->mailbox = g_object_new(mcw->mailbox_type, NULL);
     mailbox_conf_view_check(mcw->view_info, mcw->mailbox);
 
-    if ( LIBBALSA_IS_MAILBOX_LOCAL(mcw->mailbox)) {
-        LibBalsaMailboxLocal *ml = LIBBALSA_MAILBOX_LOCAL(mcw->mailbox);
-        gchar *path;
+    if ( LIBBALSA_IS_MAILBOX_LOCAL(mcw->mailbox) ) {
+       LibBalsaMailboxLocal *ml  = LIBBALSA_MAILBOX_LOCAL(mcw->mailbox);
+       gchar *path;
 
         path =
             gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(mcw->window));
@@ -1206,74 +1092,67 @@ mailbox_conf_add(MailboxConfWindow *mcw)
         if (libbalsa_mailbox_local_set_path(ml, path, TRUE) != 0) {
             g_free(path);
             g_clear_object(&mcw->mailbox);
-            return;
-        }
+           return;
+       }
 
-        save_to_config =
+       save_to_config =
             !libbalsa_path_is_below_dir(path,
                                         balsa_app.local_mail_directory);
         printf("Save to config: %d\n", save_to_config);
-        mcw->mailbox->name = g_path_get_basename(path);
+       mcw->mailbox->name = g_path_get_basename(path);
         g_free(path);
 
-        balsa_mailbox_local_append(mcw->mailbox);
+       balsa_mailbox_local_append(mcw->mailbox);
     }
     mbnode = balsa_mailbox_node_new_from_mailbox(mcw->mailbox);
-    if ( LIBBALSA_IS_MAILBOX_POP3(mcw->mailbox)) {
-        /* POP3 Mailboxes */
-        update_pop_mailbox(mcw);
-        balsa_app.inbox_input =
-            g_list_append(balsa_app.inbox_input, mbnode);
-    } else if ( LIBBALSA_IS_MAILBOX_IMAP(mcw->mailbox)) {
-        update_imap_mailbox(mcw);
-        balsa_mblist_mailbox_node_append(NULL, mbnode);
-        update_mail_servers();
-    } else if ( !LIBBALSA_IS_MAILBOX_LOCAL(mcw->mailbox)) {
-        g_assert_not_reached();
+    if ( LIBBALSA_IS_MAILBOX_POP3(mcw->mailbox) ) {
+       /* POP3 Mailboxes */
+       update_pop_mailbox(mcw);
+       balsa_app.inbox_input =
+           g_list_append(balsa_app.inbox_input, mbnode);
+    } else if ( LIBBALSA_IS_MAILBOX_IMAP(mcw->mailbox) ) {
+       update_imap_mailbox(mcw);
+       balsa_mblist_mailbox_node_append(NULL, mbnode);
+       update_mail_servers();
+    } else if ( !LIBBALSA_IS_MAILBOX_LOCAL(mcw->mailbox) ) {
+       g_assert_not_reached();
     }
 
-    if (save_to_config) {
-        config_mailbox_add(mcw->mailbox, NULL);
-    }
+    if(save_to_config)
+       config_mailbox_add(mcw->mailbox, NULL);
 
-    if (LIBBALSA_IS_MAILBOX_POP3(mcw->mailbox)) {
-        /* redraw the pop3 server list */
-        update_mail_servers();
-    }
+    if (LIBBALSA_IS_MAILBOX_POP3(mcw->mailbox))
+       /* redraw the pop3 server list */
+       update_mail_servers();
 }
 
-
 /* Create a page for the type of mailbox... */
 static GtkWidget *
 create_dialog(MailboxConfWindow *mcw)
 {
-    if (g_type_is_a(mcw->mailbox_type, LIBBALSA_TYPE_MAILBOX_LOCAL)) {
-        return create_local_mailbox_dialog(mcw);
-    } else if (g_type_is_a(mcw->mailbox_type, LIBBALSA_TYPE_MAILBOX_POP3)) {
-        return create_pop_mailbox_dialog(mcw);
-    } else if (g_type_is_a(mcw->mailbox_type, LIBBALSA_TYPE_MAILBOX_IMAP)) {
-        return create_imap_mailbox_dialog(mcw);
+    if (g_type_is_a(mcw->mailbox_type, LIBBALSA_TYPE_MAILBOX_LOCAL) ) {
+       return create_local_mailbox_dialog(mcw);
+    } else if (g_type_is_a(mcw->mailbox_type, LIBBALSA_TYPE_MAILBOX_POP3) ) {
+       return create_pop_mailbox_dialog(mcw);
+    } else if (g_type_is_a(mcw->mailbox_type, LIBBALSA_TYPE_MAILBOX_IMAP) ) {
+       return create_imap_mailbox_dialog(mcw);
     } else {
-        g_warning("Unknown mailbox type: %s\n",
+       g_warning("Unknown mailbox type: %s\n",
                   g_type_name(mcw->mailbox_type));
-        return NULL;
+       return NULL;
     }
 }
 
-
 static void
-balsa_get_entry(GtkWidget  *widget,
-                GtkWidget **entry)
+balsa_get_entry(GtkWidget * widget, GtkWidget ** entry)
 {
-    if (GTK_IS_ENTRY(widget)) {
+    if (GTK_IS_ENTRY(widget))
         *entry = widget;
-    } else if (GTK_IS_CONTAINER(widget)) {
+    else if (GTK_IS_CONTAINER(widget))
         gtk_container_foreach((GtkContainer *) widget,
                               (GtkCallback) balsa_get_entry, entry);
-    }
 }
 
-
 /*
  * Callback for the file chooser's "selection-changed" signal and its
  * entry's "changed" signal
@@ -1284,8 +1163,7 @@ balsa_get_entry(GtkWidget  *widget,
  * so we don't change button sensitivity.
  */
 static void
-local_mailbox_dialog_cb(GtkWidget         *widget,
-                        MailboxConfWindow *mcw)
+local_mailbox_dialog_cb(GtkWidget * widget, MailboxConfWindow * mcw)
 {
     gchar *filename =
         gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(mcw->window));
@@ -1299,13 +1177,11 @@ local_mailbox_dialog_cb(GtkWidget         *widget,
             changed = strcmp(filename, path);
         }
         g_free(filename);
-        if (changed) {
+        if (changed)
             check_for_blank_fields(widget, mcw);
-        }
     }
 }
 
-
 static GtkWidget *
 create_local_mailbox_dialog(MailboxConfWindow *mcw)
 {
@@ -1322,15 +1198,13 @@ create_local_mailbox_dialog(MailboxConfWindow *mcw)
     grid = libbalsa_create_grid();
 
     /* mailbox name */
-    if (mcw->mailbox && mcw->mailbox->config_prefix) {
+    if(mcw->mailbox && mcw->mailbox->config_prefix) {
         label = libbalsa_create_grid_label(_("_Mailbox Name:"), grid, ++row);
         mcw->mailbox_name =
             libbalsa_create_grid_entry(grid,
                                        G_CALLBACK(check_for_blank_fields),
                                        mcw, row, NULL, label);
-    } else {
-        mcw->mailbox_name = NULL;
-    }
+    } else mcw->mailbox_name = NULL;
 
     type = g_type_name(mcw->mailbox_type) + 15;
     title = g_strdup_printf(mcw->mailbox ?
@@ -1353,20 +1227,18 @@ create_local_mailbox_dialog(MailboxConfWindow *mcw)
 #endif
 
     size_group = libbalsa_create_size_group(dialog);
-    if (label) {
+    if (label)
         gtk_size_group_add_widget(size_group, label);
-    }
 
     gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog), grid);
     gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
-                                        balsa_app.local_mail_directory);
+                                       balsa_app.local_mail_directory);
     g_signal_connect(G_OBJECT(dialog), "selection-changed",
                      G_CALLBACK(local_mailbox_dialog_cb), mcw);
     balsa_get_entry(dialog, &entry);
-    if (entry) {
-        g_signal_connect(G_OBJECT(entry), "changed",
+    if (entry)
+       g_signal_connect(G_OBJECT(entry), "changed",
                          G_CALLBACK(local_mailbox_dialog_cb), mcw);
-    }
 
     mcw->view_info =
         mailbox_conf_view_new_full(mcw->mailbox, GTK_WINDOW(dialog), grid,
@@ -1375,9 +1247,8 @@ create_local_mailbox_dialog(MailboxConfWindow *mcw)
     return dialog;
 }
 
-
 static GtkWidget *
-create_generic_dialog(MailboxConfWindow *mcw)
+create_generic_dialog(MailboxConfWindow * mcw)
 {
     GtkWidget *dialog =
         gtk_dialog_new_with_buttons(_("Remote Mailbox Configurator"),
@@ -1393,7 +1264,6 @@ create_generic_dialog(MailboxConfWindow *mcw)
     return dialog;
 }
 
-
 static GtkWidget *
 create_pop_mailbox_dialog(MailboxConfWindow *mcw)
 {
@@ -1410,80 +1280,60 @@ create_pop_mailbox_dialog(MailboxConfWindow *mcw)
 
     /* mailbox name */
     label = libbalsa_create_grid_label(_("Mailbox _name:"), grid, row);
-    mcw->mailbox_name = libbalsa_create_grid_entry(grid, G_CALLBACK(
-                                                       check_for_blank_fields), mcw, row++, NULL,
-                                                   label);
+    mcw->mailbox_name = libbalsa_create_grid_entry(grid, G_CALLBACK(check_for_blank_fields), mcw, row++, 
NULL, label);
     /* pop server */
     label = libbalsa_create_grid_label(_("_Server:"), grid, row);
     mcw->mb_data.pop3.bsc.server =
-        libbalsa_create_grid_entry(grid, G_CALLBACK(
-                                       check_for_blank_fields), mcw, row++, "localhost", label);
+       libbalsa_create_grid_entry(grid, G_CALLBACK(check_for_blank_fields), mcw, row++, "localhost", label);
 
     /* security */
     label = libbalsa_create_grid_label(_("Se_curity:"), grid, row);
     mcw->mb_data.pop3.security = gtk_combo_box_text_new();
     gtk_widget_set_hexpand(mcw->mb_data.pop3.security, TRUE);
     mcw->mb_data.pop3.security = gtk_combo_box_text_new();
-    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mcw->mb_data.pop3.security),
-                                   _("POP3 over SSL (POP3S)"));
-    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mcw->mb_data.pop3.security),
-                                   _("TLS required"));
-    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mcw->mb_data.pop3.security),
-                                   _("TLS if possible (not recommended)"));
-    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mcw->mb_data.pop3.security),
-                                   _("None (not recommended)"));
+    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mcw->mb_data.pop3.security), _("POP3 over SSL 
(POP3S)"));
+    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mcw->mb_data.pop3.security), _("TLS required"));
+    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mcw->mb_data.pop3.security), _("TLS if possible (not 
recommended)"));
+    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mcw->mb_data.pop3.security), _("None (not 
recommended)"));
     gtk_grid_attach(GTK_GRID(grid), mcw->mb_data.pop3.security, 1, row++, 1, 1);
     g_signal_connect(mcw->mb_data.pop3.security, "changed", G_CALLBACK(security_changed), mcw);
     gtk_label_set_mnemonic_widget(GTK_LABEL(label), mcw->mb_data.pop3.security);
 
     /* username  */
-    label = libbalsa_create_grid_label(_("Use_r name:"), grid, row);
+    label= libbalsa_create_grid_label(_("Use_r name:"), grid, row);
     mcw->mb_data.pop3.username =
-        libbalsa_create_grid_entry(grid, G_CALLBACK(
-                                       check_for_blank_fields), mcw, row++,
-                                   g_get_user_name(), label);
+       libbalsa_create_grid_entry(grid, G_CALLBACK(check_for_blank_fields), mcw, row++, g_get_user_name(), 
label);
 
     /* password field */
     label = libbalsa_create_grid_label(_("Pass_word:"), grid, row);
-    mcw->mb_data.pop3.password =
-        libbalsa_create_grid_entry(grid, NULL, NULL, row++, NULL, label);
+    mcw->mb_data.pop3.password = libbalsa_create_grid_entry(grid, NULL, NULL, row++, NULL, label);
     gtk_entry_set_visibility(GTK_ENTRY(mcw->mb_data.pop3.password), FALSE);
 
     /* toggle for deletion from server */
     mcw->mb_data.pop3.delete_from_server =
-        libbalsa_create_grid_check(_(
-                                       "_Delete messages from server after download"), grid, row++,
-                                   TRUE);
+       libbalsa_create_grid_check(_("_Delete messages from server after download"), grid, row++, TRUE);
 
     /* toggle for check */
     mcw->mb_data.pop3.check =
-        libbalsa_create_grid_check(_("_Enable check for new mail"), grid, row++, TRUE);
+       libbalsa_create_grid_check(_("_Enable check for new mail"), grid, row++, TRUE);
 
     /* Procmail */
     mcw->mb_data.pop3.filter =
-        libbalsa_create_grid_check(_("_Filter messages through procmail"), grid, row++, FALSE);
-    g_signal_connect(G_OBJECT(mcw->mb_data.pop3.filter), "toggled",
-                     G_CALLBACK(pop3_enable_filter_cb), mcw);
+       libbalsa_create_grid_check(_("_Filter messages through procmail"), grid, row++, FALSE);
+    g_signal_connect(G_OBJECT(mcw->mb_data.pop3.filter), "toggled", G_CALLBACK(pop3_enable_filter_cb), mcw);
     label = libbalsa_create_grid_label(_("Fi_lter Command:"), grid, row);
     mcw->mb_data.pop3.filter_cmd =
-        libbalsa_create_grid_entry(grid, G_CALLBACK(
-                                       check_for_blank_fields), mcw, row++, "procmail -f -",
-                                   label);
+       libbalsa_create_grid_entry(grid, G_CALLBACK(check_for_blank_fields), mcw, row++, "procmail -f -", 
label);
 
     advanced = balsa_server_conf_get_advanced_widget_new(&mcw->mb_data.pop3.bsc);
-    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), advanced,
-                             gtk_label_new_with_mnemonic(_("_Advanced")));
-    g_signal_connect(mcw->mb_data.pop3.bsc.need_client_cert, "toggled",
-                     G_CALLBACK(client_cert_changed), mcw);
-    g_signal_connect(mcw->mb_data.pop3.bsc.client_cert_file, "file-set",
-                     G_CALLBACK(check_for_blank_fields), mcw);
+    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), advanced, gtk_label_new_with_mnemonic(_("_Advanced")));
+       g_signal_connect(mcw->mb_data.pop3.bsc.need_client_cert, "toggled", G_CALLBACK(client_cert_changed), 
mcw);
+       g_signal_connect(mcw->mb_data.pop3.bsc.client_cert_file, "file-set", 
G_CALLBACK(check_for_blank_fields), mcw);
 
     /* toggle for apop */
-    mcw->mb_data.pop3.disable_apop =
-        balsa_server_conf_add_checkbox(&mcw->mb_data.pop3.bsc, _("Disable _APOP"));
+    mcw->mb_data.pop3.disable_apop = balsa_server_conf_add_checkbox(&mcw->mb_data.pop3.bsc, _("Disable 
_APOP"));
     /* toggle for enabling pipeling */
-    mcw->mb_data.pop3.enable_pipe =
-        balsa_server_conf_add_checkbox(&mcw->mb_data.pop3.bsc, _("Overlap commands"));
+    mcw->mb_data.pop3.enable_pipe = balsa_server_conf_add_checkbox(&mcw->mb_data.pop3.bsc, _("Overlap 
commands"));
 
     gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 0);
     gtk_widget_grab_focus(mcw->mailbox_name);
@@ -1494,35 +1344,26 @@ create_pop_mailbox_dialog(MailboxConfWindow *mcw)
     return dialog;
 }
 
-
 static void
-anon_toggle_cb(GtkToggleButton   *anon_button,
-               MailboxConfWindow *mcw)
+anon_toggle_cb(GtkToggleButton *anon_button, MailboxConfWindow *mcw)
 {
     gtk_widget_set_sensitive(GTK_WIDGET(mcw->mb_data.imap.anonymous),
                              gtk_toggle_button_get_active(anon_button));
 }
-
-
 static void
-remember_toggle_cb(GtkToggleButton   *remember_button,
-                   MailboxConfWindow *mcw)
+remember_toggle_cb(GtkToggleButton *remember_button, MailboxConfWindow *mcw)
 {
     gtk_widget_set_sensitive(GTK_WIDGET(mcw->mb_data.imap.password),
                              gtk_toggle_button_get_active(remember_button));
 }
 
-
 static void
-entry_activated(GtkEntry          *entry,
-                MailboxConfWindow *mcw)
+entry_activated(GtkEntry * entry, MailboxConfWindow * mcw)
 {
-    if (mcw->ok_sensitive) {
+    if (mcw->ok_sensitive)
         gtk_dialog_response(GTK_DIALOG(mcw->window), MCW_RESPONSE);
-    }
 }
 
-
 static GtkWidget *
 create_imap_mailbox_dialog(MailboxConfWindow *mcw)
 {
@@ -1555,33 +1396,33 @@ create_imap_mailbox_dialog(MailboxConfWindow *mcw)
     /* imap server */
     label = libbalsa_create_grid_label(_("_Server:"), grid, ++row);
     mcw->mb_data.imap.bsc.server =
-        libbalsa_create_grid_entry(grid, G_CALLBACK(check_for_blank_fields),
+       libbalsa_create_grid_entry(grid, G_CALLBACK(check_for_blank_fields),
                                    mcw, row, "localhost", label);
     mcw->mb_data.imap.bsc.default_ports = IMAP_DEFAULT_PORTS;
 
     /* username  */
     label = libbalsa_create_grid_label(_("_Username:"), grid, ++row);
     mcw->mb_data.imap.username =
-        libbalsa_create_grid_entry(grid, G_CALLBACK(check_for_blank_fields),
+       libbalsa_create_grid_entry(grid, G_CALLBACK(check_for_blank_fields),
                                    mcw, row, g_get_user_name(), label);
 
     /* toggle for anonymous password */
     mcw->mb_data.imap.anonymous =
-        libbalsa_create_grid_check(_("_Anonymous access"), grid,
+       libbalsa_create_grid_check(_("_Anonymous access"), grid,
                                    ++row, FALSE);
     g_signal_connect(G_OBJECT(mcw->mb_data.imap.anonymous), "toggled",
                      G_CALLBACK(anon_toggle_cb), mcw);
     /* toggle for remember password */
     mcw->mb_data.imap.remember =
-        libbalsa_create_grid_check(_(remember_password_message), grid,
+       libbalsa_create_grid_check(_(remember_password_message), grid,
                                    ++row, FALSE);
     g_signal_connect(G_OBJECT(mcw->mb_data.imap.remember), "toggled",
                      G_CALLBACK(remember_toggle_cb), mcw);
 
-    /* password field */
+   /* password field */
     label = libbalsa_create_grid_label(_("Pass_word:"), grid, ++row);
     mcw->mb_data.imap.password =
-        libbalsa_create_grid_entry(grid, NULL, NULL, row, NULL, label);
+       libbalsa_create_grid_entry(grid, NULL, NULL, row, NULL, label);
     gtk_entry_set_visibility(GTK_ENTRY(mcw->mb_data.imap.password), FALSE);
 
     label = libbalsa_create_grid_label(_("F_older path:"), grid, ++row);
@@ -1590,7 +1431,7 @@ create_imap_mailbox_dialog(MailboxConfWindow *mcw)
     gtk_widget_set_hexpand(entry, TRUE);
     gtk_entry_set_text(GTK_ENTRY(mcw->mb_data.imap.folderpath), "INBOX");
 
-    gtk_label_set_mnemonic_widget(GTK_LABEL(label),
+    gtk_label_set_mnemonic_widget(GTK_LABEL(label), 
                                   mcw->mb_data.imap.folderpath);
     g_signal_connect(G_OBJECT(mcw->mb_data.imap.folderpath), "activate",
                      G_CALLBACK(entry_activated), mcw);
@@ -1602,17 +1443,17 @@ create_imap_mailbox_dialog(MailboxConfWindow *mcw)
     advanced =
         balsa_server_conf_get_advanced_widget(&mcw->mb_data.imap.bsc,
                                               NULL, 1);
-    mcw->mb_data.imap.enable_persistent =
+    mcw->mb_data.imap.enable_persistent = 
         balsa_server_conf_add_checkbox(&mcw->mb_data.imap.bsc,
                                        _("Enable _persistent cache"));
-    mcw->mb_data.imap.has_bugs =
+    mcw->mb_data.imap.has_bugs = 
         balsa_server_conf_add_checkbox(&mcw->mb_data.imap.bsc,
                                        _("Enable _bug workarounds"));
     gtk_notebook_append_page(GTK_NOTEBOOK(notebook), advanced,
                              gtk_label_new_with_mnemonic(_("_Advanced")));
 
     gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 0);
-    gtk_widget_grab_focus(mcw->mailbox_name ?
+    gtk_widget_grab_focus(mcw->mailbox_name? 
                           mcw->mailbox_name : mcw->mb_data.imap.bsc.server);
 
     dialog = create_generic_dialog(mcw);
@@ -1626,7 +1467,6 @@ create_imap_mailbox_dialog(MailboxConfWindow *mcw)
     return dialog;
 }
 
-
 /* Manage the widgets that control aspects of the view, not the config.
  * Currently the mailbox default identity and whether the address column
  * shows the sender or the recipient can be controlled in this way.
@@ -1635,7 +1475,7 @@ create_imap_mailbox_dialog(MailboxConfWindow *mcw)
 
 /* Create the dialog items in the dialog's grid, and allocate and
  * populate a BalsaMailboxConfView with the info that needs to be passed
- * around. The memory is deallocated when the window is finalized.
+ * around. The memory is deallocated when the window is finalized. 
  *
  * mailbox:     the mailbox whose properties are being displayed;
  * window:      the dialog, which will be the transient parent of the
@@ -1651,13 +1491,12 @@ enum {
 };
 
 static BalsaMailboxConfView *
-mailbox_conf_view_new_full(LibBalsaMailbox   *mailbox,
-                           GtkWindow         *window,
-                           GtkWidget         *grid,
-                           gint               row,
-                           GtkSizeGroup      *size_group,
-                           MailboxConfWindow *mcw,
-                           GCallback          callback)
+mailbox_conf_view_new_full(LibBalsaMailbox * mailbox,
+                           GtkWindow * window,
+                           GtkWidget * grid, gint row,
+                           GtkSizeGroup * size_group,
+                           MailboxConfWindow * mcw,
+                           GCallback callback)
 {
     GtkWidget *label;
     BalsaMailboxConfView *view_info;
@@ -1669,40 +1508,37 @@ mailbox_conf_view_new_full(LibBalsaMailbox   *mailbox,
     view_info->window = window;
 
     label = libbalsa_create_grid_label(_("_Identity:"), grid, row);
-    if (size_group) {
+    if (size_group)
         gtk_size_group_add_widget(size_group, label);
-    }
 
     identity_name = libbalsa_mailbox_get_identity_name(mailbox);
     view_info->identity_combo_box = widget =
-            libbalsa_identity_combo_box(balsa_app.identities, identity_name,
-                                        G_CALLBACK(check_for_blank_fields), mcw);
+        libbalsa_identity_combo_box(balsa_app.identities, identity_name,
+                                    G_CALLBACK(check_for_blank_fields), mcw);
 
     gtk_label_set_mnemonic_widget(GTK_LABEL(label), widget);
 
     gtk_widget_set_hexpand(widget, TRUE);
     gtk_grid_attach(GTK_GRID(grid), widget, 1, row, 1, 1);
 
-    if (callback) {
+    if (callback)
         g_signal_connect_swapped(widget, "changed", callback, window);
-    }
 
 #ifdef HAVE_GPGME
     {
-        /* scope */
-        static const struct menu_data chk_crypt_menu[] = {
-            { N_("Never"), LB_MAILBOX_CHK_CRYPT_NEVER  },
-            { N_("If Possible"), LB_MAILBOX_CHK_CRYPT_MAYBE  },
-            { N_("Always"), LB_MAILBOX_CHK_CRYPT_ALWAYS }
-        };
+       /* scope */
+       static const struct menu_data chk_crypt_menu[] = {
+           { N_("Never"),       LB_MAILBOX_CHK_CRYPT_NEVER  },
+           { N_("If Possible"), LB_MAILBOX_CHK_CRYPT_MAYBE  },
+           { N_("Always"),      LB_MAILBOX_CHK_CRYPT_ALWAYS }
+       };
 
         label =
             libbalsa_create_grid_label(_("_Decrypt and check\n"
                                          "signatures automatically:"),
                                        grid, ++row);
-        if (size_group) {
+        if (size_group)
             gtk_size_group_add_widget(size_group, label);
-        }
 
         view_info->chk_crypt = gtk_combo_box_text_new();
         gtk_label_set_mnemonic_widget(GTK_LABEL(label), view_info->chk_crypt);
@@ -1711,17 +1547,15 @@ mailbox_conf_view_new_full(LibBalsaMailbox   *mailbox,
                                     chk_crypt_menu);
         gtk_combo_box_set_active(GTK_COMBO_BOX(view_info->chk_crypt),
                                  libbalsa_mailbox_get_crypto_mode
-                                     (mailbox));
-        if (mcw) {
+                                 (mailbox));
+        if (mcw)
             g_signal_connect(view_info->chk_crypt, "changed",
                              G_CALLBACK(check_for_blank_fields), mcw);
-        }
-        if (callback) {
+        if (callback)
             g_signal_connect_swapped(view_info->chk_crypt, "changed",
                                      callback, window);
-        }
         gtk_widget_set_hexpand(view_info->chk_crypt, TRUE);
-        gtk_grid_attach(GTK_GRID(grid), view_info->chk_crypt, 1, row, 1, 1);
+       gtk_grid_attach(GTK_GRID(grid), view_info->chk_crypt, 1, row, 1, 1);
     }
 #endif
 
@@ -1732,14 +1566,12 @@ mailbox_conf_view_new_full(LibBalsaMailbox   *mailbox,
                                    grid, ++row,
                                    libbalsa_mailbox_get_show(mailbox) ==
                                    LB_MAILBOX_SHOW_TO);
-    if (mcw) {
+    if (mcw)
         g_signal_connect(view_info->show_to, "toggled",
                          G_CALLBACK(check_for_blank_fields), mcw);
-    }
-    if (callback) {
+    if (callback)
         g_signal_connect_swapped(view_info->show_to, "toggled",
                                  callback, window);
-    }
 
     /* Subscribe check button */
     view_info->subscribe =
@@ -1747,31 +1579,25 @@ mailbox_conf_view_new_full(LibBalsaMailbox   *mailbox,
                                    grid, ++row,
                                    libbalsa_mailbox_get_subscribe(mailbox)
                                    != LB_MAILBOX_SUBSCRIBE_NO);
-    if (mcw) {
+    if (mcw)
         g_signal_connect(view_info->subscribe, "toggled",
                          G_CALLBACK(check_for_blank_fields), mcw);
-    }
-    if (callback) {
+    if (callback)
         g_signal_connect_swapped(view_info->subscribe, "toggled",
                                  callback, window);
-    }
 
     return view_info;
 }
 
-
 BalsaMailboxConfView *
-mailbox_conf_view_new(LibBalsaMailbox *mailbox,
-                      GtkWindow       *window,
-                      GtkWidget       *grid,
-                      gint             row,
-                      GCallback        callback)
+mailbox_conf_view_new(LibBalsaMailbox * mailbox,
+                      GtkWindow * window, GtkWidget * grid, gint row,
+                      GCallback callback)
 {
     return mailbox_conf_view_new_full(mailbox, window, grid, row,
                                       NULL, NULL, callback);
 }
 
-
 #ifdef HAVE_GPGME
 static LibBalsaChkCryptoMode
 balsa_mailbox_conf_get_crypto_mode(BalsaMailboxConfView *view_info)
@@ -1783,10 +1609,8 @@ balsa_mailbox_conf_get_crypto_mode(BalsaMailboxConfView *view_info)
         gtk_combo_box_get_active(GTK_COMBO_BOX(view_info->chk_crypt));
 
     return (LibBalsaChkCryptoMode)
-           GPOINTER_TO_INT(g_slist_nth_data(info->tags, active));
+        GPOINTER_TO_INT(g_slist_nth_data(info->tags, active));
 }
-
-
 #endif
 
 /* When closing the dialog, check whether any view items were changed,
@@ -1796,8 +1620,8 @@ balsa_mailbox_conf_get_crypto_mode(BalsaMailboxConfView *view_info)
  * mailbox:     the mailbox whose properties we're changing.
  */
 void
-mailbox_conf_view_check(BalsaMailboxConfView *view_info,
-                        LibBalsaMailbox      *mailbox)
+mailbox_conf_view_check(BalsaMailboxConfView * view_info,
+                       LibBalsaMailbox * mailbox)
 {
     gboolean changed;
     GtkComboBox *combo_box;
@@ -1805,9 +1629,8 @@ mailbox_conf_view_check(BalsaMailboxConfView *view_info,
     gint active;
 
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mailbox));
-    if (view_info == NULL) {    /* POP3 mailboxes do not have view_info */
-        return;
-    }
+    if (view_info == NULL)     /* POP3 mailboxes do not have view_info */
+       return;
 
     changed = FALSE;
 
@@ -1815,8 +1638,8 @@ mailbox_conf_view_check(BalsaMailboxConfView *view_info,
     g_print("%s set view on %s\n", __func__, mailbox->name);
     mailbox->view = config_load_mailbox_view(mailbox->url);
     if (!mailbox->view) {
-        /* The mailbox may not have its URL yet */
-        mailbox->view = libbalsa_mailbox_view_new();
+       /* The mailbox may not have its URL yet */
+       mailbox->view = libbalsa_mailbox_view_new();
     }
 
     combo_box = GTK_COMBO_BOX(view_info->identity_combo_box);
@@ -1832,31 +1655,27 @@ mailbox_conf_view_check(BalsaMailboxConfView *view_info,
     }
 
     active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                              (view_info->show_to));
+                                          (view_info->show_to));
     if (libbalsa_mailbox_set_show(mailbox, active ?
                                   LB_MAILBOX_SHOW_TO :
-                                  LB_MAILBOX_SHOW_FROM)) {
+                                  LB_MAILBOX_SHOW_FROM))
         changed = TRUE;
-    }
 
     active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                              (view_info->subscribe));
+                                          (view_info->subscribe));
     if (libbalsa_mailbox_set_subscribe(mailbox, active ?
-                                       LB_MAILBOX_SUBSCRIBE_YES :
-                                       LB_MAILBOX_SUBSCRIBE_NO)) {
-        changed = TRUE;
-    }
+                                      LB_MAILBOX_SUBSCRIBE_YES :
+                                      LB_MAILBOX_SUBSCRIBE_NO))
+       changed = TRUE;
 
 #ifdef HAVE_GPGME
     if (libbalsa_mailbox_set_crypto_mode(mailbox,
-                                         balsa_mailbox_conf_get_crypto_mode(view_info))) {
-        changed = TRUE;
-    }
+                                        balsa_mailbox_conf_get_crypto_mode(view_info)))
+       changed = TRUE;
 #endif
 
-    if (!changed || !libbalsa_mailbox_get_open(mailbox)) {
-        return;
-    }
+    if (!changed || !libbalsa_mailbox_get_open(mailbox))
+       return;
 
     /* Redraw the mailbox if it is open already - we MUST NOT attempt
      * opening closed mailboxes for both performance and security
@@ -1866,7 +1685,7 @@ mailbox_conf_view_check(BalsaMailboxConfView *view_info,
      * open the connection with old settings requesting unencrypted
      * connection. We temporarily increase its open_ref to keep the
      * backend open. */
-    if (MAILBOX_OPEN(mailbox)) {
+    if(MAILBOX_OPEN(mailbox)) {
         libbalsa_mailbox_open(mailbox, NULL);
         balsa_mblist_close_mailbox(mailbox);
         balsa_mblist_open_mailbox(mailbox);
diff --git a/src/mailbox-conf.h b/src/mailbox-conf.h
index d90341a..8a32d1f 100644
--- a/src/mailbox-conf.h
+++ b/src/mailbox-conf.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -27,61 +27,52 @@
 typedef struct _BalsaMailboxConfView BalsaMailboxConfView;
 
 void mailbox_conf_new(GType mailbox_type);
-void mailbox_conf_edit(BalsaMailboxNode *mbnode);
-void mailbox_conf_delete(BalsaMailboxNode *mbnode);
+void mailbox_conf_edit(BalsaMailboxNode * mbnode);
+void mailbox_conf_delete(BalsaMailboxNode * mbnode);
 
 /* callbacks used also by the main window menu */
-void mailbox_conf_add_mbox_cb(GtkWidget *widget,
-                              gpointer   data);
-void mailbox_conf_add_maildir_cb(GtkWidget *widget,
-                                 gpointer   data);
-void mailbox_conf_add_mh_cb(GtkWidget *widget,
-                            gpointer   data);
-void mailbox_conf_add_imap_cb(GtkWidget *widget,
-                              gpointer   data);
-void mailbox_conf_delete_cb(GtkWidget *widget,
-                            gpointer   data);
-void mailbox_conf_edit_cb(GtkWidget *widget,
-                          gpointer   data);
+void mailbox_conf_add_mbox_cb(GtkWidget * widget, gpointer data);
+void mailbox_conf_add_maildir_cb(GtkWidget * widget, gpointer data);
+void mailbox_conf_add_mh_cb(GtkWidget * widget, gpointer data);
+void mailbox_conf_add_imap_cb(GtkWidget * widget, gpointer data);
+void mailbox_conf_delete_cb(GtkWidget * widget, gpointer data);
+void mailbox_conf_edit_cb(GtkWidget * widget, gpointer data);
 
 /* Helpers for dialogs. */
-BalsaMailboxConfView *mailbox_conf_view_new(LibBalsaMailbox *mailbox,
-                                            GtkWindow       *window,
-                                            GtkWidget       *grid,
-                                            gint             row,
-                                            GCallback        callback);
-void mailbox_conf_view_check(BalsaMailboxConfView *mcc,
-                             LibBalsaMailbox      *mailbox);
+BalsaMailboxConfView *mailbox_conf_view_new(LibBalsaMailbox * mailbox,
+                                            GtkWindow * window,
+                                            GtkWidget * grid, gint row,
+                                            GCallback callback);
+void mailbox_conf_view_check(BalsaMailboxConfView * mcc,
+                             LibBalsaMailbox * mailbox);
 
 
 typedef struct {
     GtkWidget *use_ssl;
     GtkWidget *tls_mode;
-    GtkGrid *grid;         /* internal */
+    GtkGrid   *grid;       /* internal */
     GtkWidget *tls_option; /* internal */
     GtkWidget *server;     /* internal */
     GtkWidget *need_client_cert;
     GtkWidget *client_cert_file;
     GtkWidget *client_cert_passwd;
     const gchar *default_ports;
-    unsigned used_rows;    /* internal */
+    unsigned   used_rows;  /* internal */
 } BalsaServerConf;
 #define IMAP_DEFAULT_PORTS "143 993 imap imaps"
 
-GtkWidget *balsa_server_conf_get_advanced_widget(BalsaServerConf *bsc,
-                                                 LibBalsaServer  *s,
-                                                 int              extra_rows);
-GtkWidget *balsa_server_conf_add_checkbox(BalsaServerConf *bsc,
-                                          const char      *label);
-GtkWidget *balsa_server_conf_add_spinner(BalsaServerConf *bsc,
-                                         const char      *label,
-                                         gint             lo,
-                                         gint             hi,
-                                         gint             step,
-                                         gint             initial_value);
+GtkWidget* balsa_server_conf_get_advanced_widget(BalsaServerConf *bsc,
+                                                 LibBalsaServer *s,
+                                                 int extra_rows);
+GtkWidget*      balsa_server_conf_add_checkbox(BalsaServerConf *bsc,
+                                               const char *label);
+GtkWidget*      balsa_server_conf_add_spinner(BalsaServerConf *bsc,
+                                              const char *label,
+                                              gint lo, gint hi, gint step,
+                                              gint initial_value);
 void            balsa_server_conf_set_values(BalsaServerConf *bsc,
-                                             LibBalsaServer  *server);
+                                             LibBalsaServer *server);
 gboolean        balsa_server_conf_get_use_ssl(BalsaServerConf *bsc);
 LibBalsaTlsMode balsa_server_conf_get_tls_mode(BalsaServerConf *bsc);
 
-#endif                          /* __MAILBOX_CONF_H__ */
+#endif                         /* __MAILBOX_CONF_H__ */
diff --git a/src/mailbox-node.c b/src/mailbox-node.c
index c60d2a3..e4e90d1 100644
--- a/src/mailbox-node.c
+++ b/src/mailbox-node.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "mailbox-node.h"
 
@@ -35,59 +35,53 @@
 #include <glib/gi18n.h>
 #include "libbalsa-conf.h"
 
-/* MailboxNode object is a GUI representation of a mailbox, or entire
+/* MailboxNode object is a GUI representation of a mailbox, or entire 
    set of them. It can read itself from the configuration, save its data,
    and provide a dialog box for the properties edition.
    Folders can additionally scan associated directory or IMAP server to
    retrieve their tree of mailboxes.
- */
+*/
 static GObjectClass *parent_class = NULL;
 
 typedef struct imap_scan_item_ imap_scan_item;
 struct imap_scan_item_ {
     gchar *fn;
     LibBalsaMailbox **special;
-    unsigned scanned : 1, selectable : 1, marked : 1;
+    unsigned scanned:1, selectable:1, marked:1;
 };
 
 static void balsa_mailbox_node_class_init(BalsaMailboxNodeClass *
-                                          klass);
-static void balsa_mailbox_node_init(BalsaMailboxNode *mn);
-static void balsa_mailbox_node_dispose(GObject *object);
-static void balsa_mailbox_node_finalize(GObject *object);
-
-static void balsa_mailbox_node_real_save_config(BalsaMailboxNode *mn,
-                                                const gchar      *group);
-static void balsa_mailbox_node_real_load_config(BalsaMailboxNode *mn,
-                                                const gchar      *group);
-
-static BalsaMailboxNode *imap_scan_create_mbnode(BalsaMailboxNode *root,
-                                                 imap_scan_item   *isi,
-                                                 int               delim);
-static gboolean imap_scan_attach_mailbox(BalsaMailboxNode *mbnode,
-                                         imap_scan_item   *isi);
-static gboolean bmbn_scan_children_idle(BalsaMailboxNode **mn);
+                                            klass);
+static void balsa_mailbox_node_init(BalsaMailboxNode * mn);
+static void balsa_mailbox_node_dispose(GObject * object);
+static void balsa_mailbox_node_finalize(GObject * object);
+
+static void balsa_mailbox_node_real_save_config(BalsaMailboxNode* mn,
+                                               const gchar * group);
+static void balsa_mailbox_node_real_load_config(BalsaMailboxNode* mn,
+                                               const gchar * group);
+
+static BalsaMailboxNode *imap_scan_create_mbnode(BalsaMailboxNode * root,
+                                                imap_scan_item * isi,
+                                                int delim);
+static gboolean imap_scan_attach_mailbox(BalsaMailboxNode * mbnode,
+                                         imap_scan_item * isi);
+static gboolean bmbn_scan_children_idle(BalsaMailboxNode ** mn);
 static gboolean restore_children_from_cache(BalsaMailboxNode *mn);
 
-static BalsaMailboxNode *add_local_mailbox(BalsaMailboxNode *root,
-                                           const gchar      *name,
-                                           const gchar      *path,
-                                           GType             type);
-static BalsaMailboxNode *add_local_folder(BalsaMailboxNode *root,
-                                          const char       *d_name,
-                                          const char       *fn);
-
-static void handle_imap_path(const char *fn,
-                             char        delim,
-                             int         noselect,
-                             int         noscan,
-                             int         marked,
-                             void       *data);
-static gint check_imap_path(const char     *fn,
-                            LibBalsaServer *server,
-                            guint           depth);
-static void mark_imap_path(const gchar *fn,
-                           gpointer     data);
+static BalsaMailboxNode *add_local_mailbox(BalsaMailboxNode * root,
+                                          const gchar * name,
+                                          const gchar * path,
+                                          GType type);
+static BalsaMailboxNode *add_local_folder(BalsaMailboxNode * root,
+                                         const char *d_name,
+                                         const char *fn);
+
+static void handle_imap_path(const char *fn, char delim, int noselect,
+                            int noscan, int marked, void *data);
+static gint check_imap_path(const char *fn, LibBalsaServer * server,
+                           guint depth);
+static void mark_imap_path(const gchar * fn, gpointer data);
 
 enum {
     SAVE_CONFIG,
@@ -105,29 +99,28 @@ balsa_mailbox_node_get_type(void)
     static GType mailbox_node_type = 0;
 
     if (!mailbox_node_type) {
-        static const GTypeInfo mailbox_node_info = {
-            sizeof(BalsaMailboxNodeClass),
+       static const GTypeInfo mailbox_node_info = {
+           sizeof(BalsaMailboxNodeClass),
             NULL,               /* base_init */
             NULL,               /* base_finalize */
-            (GClassInitFunc)  balsa_mailbox_node_class_init,
+           (GClassInitFunc)  balsa_mailbox_node_class_init,
             NULL,               /* class_finalize */
             NULL,               /* class_data */
-            sizeof(BalsaMailboxNode),
+           sizeof(BalsaMailboxNode),
             0,                  /* n_preallocs */
-            (GInstanceInitFunc) balsa_mailbox_node_init
-        };
+           (GInstanceInitFunc) balsa_mailbox_node_init
+       };
 
-        mailbox_node_type =
-            g_type_register_static(G_TYPE_OBJECT, "BalsaMailboxNode",
+       mailbox_node_type =
+           g_type_register_static(G_TYPE_OBJECT, "BalsaMailboxNode",
                                    &mailbox_node_info, 0);
     }
-
+    
     return mailbox_node_type;
 }
 
-
 static void
-balsa_mailbox_node_class_init(BalsaMailboxNodeClass *klass)
+balsa_mailbox_node_class_init(BalsaMailboxNodeClass * klass)
 {
     GObjectClass *object_class;
 
@@ -136,53 +129,52 @@ balsa_mailbox_node_class_init(BalsaMailboxNodeClass *klass)
     object_class = G_OBJECT_CLASS(klass);
 
     balsa_mailbox_node_signals[SAVE_CONFIG] =
-        g_signal_new("save-config",
+       g_signal_new("save-config",
                      G_TYPE_FROM_CLASS(object_class),
                      G_SIGNAL_RUN_FIRST,
                      G_STRUCT_OFFSET(BalsaMailboxNodeClass, save_config),
                      NULL, NULL,
                      g_cclosure_marshal_VOID__POINTER,
-                     G_TYPE_NONE, 1,
-                     G_TYPE_POINTER);
+                    G_TYPE_NONE, 1,
+                    G_TYPE_POINTER);
     balsa_mailbox_node_signals[LOAD_CONFIG] =
-        g_signal_new("load-config",
+       g_signal_new("load-config",
                      G_TYPE_FROM_CLASS(object_class),
                      G_SIGNAL_RUN_FIRST,
                      G_STRUCT_OFFSET(BalsaMailboxNodeClass, load_config),
                      NULL, NULL,
                      g_cclosure_marshal_VOID__POINTER,
-                     G_TYPE_NONE, 1,
-                     G_TYPE_POINTER);
+                    G_TYPE_NONE, 1,
+                    G_TYPE_POINTER);
     balsa_mailbox_node_signals[SHOW_PROP_DIALOG] =
-        g_signal_new("show-prop-dialog",
+       g_signal_new("show-prop-dialog",
                      G_TYPE_FROM_CLASS(object_class),
                      G_SIGNAL_RUN_LAST,
                      G_STRUCT_OFFSET(BalsaMailboxNodeClass,
                                      show_prop_dialog),
                      NULL, NULL,
                      g_cclosure_marshal_VOID__VOID,
-                     G_TYPE_NONE, 0);
+                    G_TYPE_NONE, 0);
     balsa_mailbox_node_signals[APPEND_SUBTREE] =
-        g_signal_new("append-subtree",
+       g_signal_new("append-subtree",
                      G_TYPE_FROM_CLASS(object_class),
                      G_SIGNAL_RUN_FIRST,
                      G_STRUCT_OFFSET(BalsaMailboxNodeClass, append_subtree),
                      NULL, NULL,
                      g_cclosure_marshal_VOID__VOID,
-                     G_TYPE_NONE, 0);
+                    G_TYPE_NONE, 0);
 
     klass->save_config = balsa_mailbox_node_real_save_config;
     klass->load_config = balsa_mailbox_node_real_load_config;
     klass->show_prop_dialog = NULL;
-    klass->append_subtree = NULL;
+    klass->append_subtree   = NULL;
 
     object_class->dispose = balsa_mailbox_node_dispose;
     object_class->finalize = balsa_mailbox_node_finalize;
 }
 
-
 static void
-balsa_mailbox_node_init(BalsaMailboxNode *mn)
+balsa_mailbox_node_init(BalsaMailboxNode * mn)
 {
     mn->parent = NULL;
     mn->mailbox = NULL;
@@ -194,9 +186,8 @@ balsa_mailbox_node_init(BalsaMailboxNode *mn)
     mn->scanned = FALSE;
 }
 
-
 static void
-balsa_mailbox_node_dispose(GObject *object)
+balsa_mailbox_node_dispose(GObject * object)
 {
     BalsaMailboxNode *mn = BALSA_MAILBOX_NODE(object);
     LibBalsaMailbox *mailbox = mn->mailbox;
@@ -205,8 +196,8 @@ balsa_mailbox_node_dispose(GObject *object)
         libbalsa_mailbox_set_open(mailbox,
                                   libbalsa_mailbox_is_open(mailbox));
         config_save_mailbox_view(mailbox->url, mailbox->view);
-        if (balsa_app.main_window != NULL) {
-            balsa_window_close_mbnode(balsa_app.main_window, mn);
+       if (balsa_app.main_window != NULL) {
+           balsa_window_close_mbnode(balsa_app.main_window, mn);
         }
         g_clear_object(&mn->mailbox);
     }
@@ -214,50 +205,46 @@ balsa_mailbox_node_dispose(GObject *object)
     G_OBJECT_CLASS(parent_class)->dispose(object);
 }
 
-
 static void
-balsa_mailbox_node_finalize(GObject *object)
+balsa_mailbox_node_finalize(GObject * object)
 {
     BalsaMailboxNode *mn;
 
     mn = BALSA_MAILBOX_NODE(object);
 
     balsa_mailbox_node_clear_children_cache(mn);
-    mn->parent = NULL;
+    mn->parent  = NULL;
     g_free(mn->name);
     g_free(mn->dir);
     g_free(mn->config_prefix);
 
     if (mn->server != NULL) {
-        g_signal_handlers_disconnect_matched(mn->server,
+       g_signal_handlers_disconnect_matched(mn->server,
                                              G_SIGNAL_MATCH_DATA, 0,
-                                             (GQuark) 0, NULL, NULL, mn);
+                                            (GQuark) 0, NULL, NULL, mn);
     }
 
     G_OBJECT_CLASS(parent_class)->finalize(object);
 }
 
-
 static void
-balsa_mailboxes_append_children(GtkTreeModel *model,
-                                GtkTreeIter  *parent,
-                                GPtrArray    *children_names)
+balsa_mailboxes_append_children(GtkTreeModel *model, GtkTreeIter *parent,
+                                GPtrArray *children_names)
 {
     GtkTreeIter child;
 
-    if (!gtk_tree_model_iter_children(model, &child, parent)) {
-        return;
-    }
+    if (!gtk_tree_model_iter_children(model, &child, parent))
+       return;
     do {
         BalsaMailboxNode *mbnode;
         gchar *str;
 
         gtk_tree_model_get(model, &child, 0, &mbnode, -1);
         g_return_if_fail(mbnode->server);
-        if (mbnode->mailbox) {
-            const char *path =
+        if(mbnode->mailbox) {
+            const char *path = 
                 libbalsa_mailbox_imap_get_path
-                    (LIBBALSA_MAILBOX_IMAP(mbnode->mailbox));
+                (LIBBALSA_MAILBOX_IMAP(mbnode->mailbox));
 
             str = g_strconcat("PXS", path, NULL);
         } else {
@@ -269,28 +256,25 @@ balsa_mailboxes_append_children(GtkTreeModel *model,
         g_object_unref(mbnode);
 
         balsa_mailboxes_append_children(model, &child, children_names);
-    } while (gtk_tree_model_iter_next(model, &child));
+    } while(gtk_tree_model_iter_next(model, &child));
 }
 
-
 static void
-balsa_mailbox_node_real_save_config(BalsaMailboxNode *mn,
-                                    const gchar      *group)
+balsa_mailbox_node_real_save_config(BalsaMailboxNode* mn, const gchar * group)
 {
     GPtrArray *children_names;
     GtkTreeIter iter;
-
+    
     g_return_if_fail(!mn->parent);
 
-    if (mn->name) {
-        printf("Saving mailbox node %s with group %s\n", mn->name, group);
-    }
+    if(mn->name)
+       printf("Saving mailbox node %s with group %s\n", mn->name, group);
     libbalsa_imap_server_save_config(LIBBALSA_IMAP_SERVER(mn->server));
-    libbalsa_conf_set_string("Name", mn->name);
+    libbalsa_conf_set_string("Name",      mn->name);
     libbalsa_conf_set_string("Directory", mn->dir);
-    libbalsa_conf_set_bool("Subscribed", mn->subscribed);
-    libbalsa_conf_set_bool("ListInbox", mn->list_inbox);
-
+    libbalsa_conf_set_bool("Subscribed",  mn->subscribed);
+    libbalsa_conf_set_bool("ListInbox",   mn->list_inbox);
+    
     if (balsa_find_iter_by_data(&iter, mn)) {
         GtkTreeModel *model = GTK_TREE_MODEL(balsa_app.mblist_tree_store);
 
@@ -299,7 +283,7 @@ balsa_mailbox_node_real_save_config(BalsaMailboxNode *mn,
                                         children_names);
         printf("Saving %d children\n", children_names->len);
         libbalsa_conf_set_vector("Children", children_names->len,
-                                 (const char *const *)(children_names->pdata));
+                                 (const char*const*)(children_names->pdata));
         g_ptr_array_foreach(children_names, (GFunc)g_free, NULL);
         g_ptr_array_free(children_names, TRUE);
     }
@@ -308,10 +292,8 @@ balsa_mailbox_node_real_save_config(BalsaMailboxNode *mn,
     mn->config_prefix = g_strdup(group);
 }
 
-
 static void
-balsa_mailbox_node_real_load_config(BalsaMailboxNode *mn,
-                                    const gchar      *group)
+balsa_mailbox_node_real_load_config(BalsaMailboxNode* mn, const gchar * group)
 {
     g_free(mn->config_prefix);
     mn->config_prefix = g_strdup(group);
@@ -319,7 +301,6 @@ balsa_mailbox_node_real_load_config(BalsaMailboxNode *mn,
     mn->name = libbalsa_conf_get_string("Name");
 }
 
-
 BalsaMailboxNode *
 balsa_mailbox_node_new(void)
 {
@@ -328,15 +309,13 @@ balsa_mailbox_node_new(void)
     return mn;
 }
 
-
 static void
-dir_conf_edit(BalsaMailboxNode *mb)
+dir_conf_edit(BalsaMailboxNode* mb)
 {
     balsa_information(LIBBALSA_INFORMATION_ERROR,
                       _("The folder edition to be written."));
 }
 
-
 /* read_dir_cb and helpers */
 
 typedef struct _CheckPathInfo CheckPathInfo;
@@ -346,9 +325,8 @@ struct _CheckPathInfo {
 };
 
 static gboolean
-check_url_func(const gchar   *group,
-               const gchar   *encoded_url,
-               CheckPathInfo *cpi)
+check_url_func(const gchar * group, const gchar * encoded_url,
+               CheckPathInfo * cpi)
 {
     gchar *url;
 
@@ -358,9 +336,8 @@ check_url_func(const gchar   *group,
         && (config_mailbox_was_exposed(url)
             || (balsa_app.remember_open_mboxes
                 && config_mailbox_was_open(url)))
-        ) {
+        )
         cpi->must_scan = TRUE;
-    }
 
     g_free(url);
 
@@ -368,81 +345,69 @@ check_url_func(const gchar   *group,
     return cpi->must_scan;
 }
 
-
 static gboolean
-check_local_path(const gchar *path,
-                 guint        depth)
+check_local_path(const gchar * path, guint depth)
 {
     size_t len;
     CheckPathInfo cpi;
 
-    if (depth < balsa_app.local_scan_depth) {
+    if (depth < balsa_app.local_scan_depth)
         return TRUE;
-    }
 
     len = strlen(balsa_app.local_mail_directory);
     if (libbalsa_path_is_below_dir(path, balsa_app.local_mail_directory)
-        && !strchr(&path[++len], G_DIR_SEPARATOR)) {
-        /* Top level folder. */
-        return TRUE;
-    }
+       && !strchr(&path[++len], G_DIR_SEPARATOR))
+       /* Top level folder. */
+       return TRUE;
 
     cpi.url = g_strconcat("file://", path, NULL);
     cpi.must_scan = FALSE;
     libbalsa_conf_foreach_group(VIEW_BY_URL_SECTION_PREFIX,
                                 (LibBalsaConfForeachFunc) check_url_func,
                                 &cpi);
-    if (balsa_app.debug) {
-        printf("check_local_path: path “%s” must_scan %d.\n",
+    if(balsa_app.debug) 
+       printf("check_local_path: path “%s” must_scan %d.\n",
                cpi.url, cpi.must_scan);
-    }
     g_free(cpi.url);
 
     return cpi.must_scan;
 }
 
-
 static gboolean
 mark_local_path(BalsaMailboxNode *mbnode)
 {
-    if (mbnode->scanned) {
+    if (mbnode->scanned)
         return FALSE;
-    }
     mbnode->scanned = TRUE;
     return TRUE;
 }
 
-
 /** Read local directory in search for mailboxes. Never does any
     caching - it is not worth it. */
 static void
-read_dir_cb(BalsaMailboxNode *mb)
+read_dir_cb(BalsaMailboxNode* mb)
 {
-    libbalsa_scanner_local_dir(mb, mb->name,
-                               (LocalCheck *) check_local_path,
-                               (LocalMark *) mark_local_path,
-                               (LocalHandler *) add_local_folder,
-                               (LocalHandler *) add_local_mailbox,
+    libbalsa_scanner_local_dir(mb, mb->name, 
+                              (LocalCheck *) check_local_path,
+                              (LocalMark *) mark_local_path,
+                              (LocalHandler *) add_local_folder,
+                              (LocalHandler *) add_local_mailbox,
                                (mb->mailbox ?
                                 G_TYPE_FROM_INSTANCE(mb->mailbox) :
                                 (GType) 0));
 }
 
-
 static void
-load_mailbox_view(BalsaMailboxNode *mbnode)
+load_mailbox_view(BalsaMailboxNode * mbnode)
 {
     LibBalsaMailbox *mailbox = mbnode->mailbox;
 
-    if (!mailbox->view) {
+    if (!mailbox->view)
         mailbox->view = config_load_mailbox_view(mailbox->url);
-    }
 }
 
-
 static gboolean
-imap_scan_attach_mailbox(BalsaMailboxNode *mbnode,
-                         imap_scan_item   *isi)
+imap_scan_attach_mailbox(BalsaMailboxNode * mbnode, imap_scan_item * isi)
 {
     LibBalsaMailbox *mailbox;
     LibBalsaMailboxImap *m;
@@ -451,45 +416,39 @@ imap_scan_attach_mailbox(BalsaMailboxNode *mbnode,
      * connected to "show-prop-dialog". */
     if (!g_signal_has_handler_pending(G_OBJECT(mbnode),
                                       balsa_mailbox_node_signals
-                                      [SHOW_PROP_DIALOG], 0, FALSE)) {
-        g_signal_connect(G_OBJECT(mbnode), "show-prop-dialog",
+                                      [SHOW_PROP_DIALOG], 0, FALSE))
+       g_signal_connect(G_OBJECT(mbnode), "show-prop-dialog",
                          G_CALLBACK(folder_conf_imap_sub_node), NULL);
-    }
-    if (LIBBALSA_IS_MAILBOX_IMAP(mbnode->mailbox)) {
+    if (LIBBALSA_IS_MAILBOX_IMAP(mbnode->mailbox))
         /* it already has a mailbox */
         return FALSE;
-    }
 
     mailbox = libbalsa_mailbox_imap_new();
     m = LIBBALSA_MAILBOX_IMAP(mailbox);
     libbalsa_mailbox_remote_set_server(LIBBALSA_MAILBOX_REMOTE(m),
-                                       mbnode->server);
+                                      mbnode->server);
     libbalsa_mailbox_imap_set_path(m, isi->fn);
-    if (balsa_app.debug) {
+    if(balsa_app.debug)
         printf("imap_scan_attach_mailbox: add mbox of name %s "
-               "(full path %s)\n", isi->fn, mailbox->url);
-    }
+              "(full path %s)\n", isi->fn, mailbox->url);
     /* avoid allocating the name again: */
     mailbox->name = mbnode->name;
     mbnode->name = NULL;
     mbnode->mailbox = mailbox;
     load_mailbox_view(mbnode);
     if (isi->special) {
-        if (*isi->special) {
-            g_object_remove_weak_pointer(G_OBJECT(*isi->special),
-                                         (gpointer) isi->special);
-        }
+       if (*isi->special)
+           g_object_remove_weak_pointer(G_OBJECT(*isi->special),
+                                        (gpointer) isi->special);
         *isi->special = mailbox;
-        g_object_add_weak_pointer(G_OBJECT(m), (gpointer) isi->special);
-        if (isi->special == &balsa_app.outbox) {
+       g_object_add_weak_pointer(G_OBJECT(m), (gpointer) isi->special);
+        if (isi->special == &balsa_app.outbox)
             mailbox->no_reassemble = TRUE;
-        }
     }
 
     return TRUE;
 }
 
-
 /* imap_dir_cb:
    handles append-subtree signal for IMAP folder sets.
    Scanning imap folders may be a time consuming operation and this
@@ -501,7 +460,7 @@ imap_scan_attach_mailbox(BalsaMailboxNode *mbnode,
    mailbox tree is deleted after a is started and before b.
    We do it by remembering url of the root and
    by finding the root again when phase b. is about to start.
- */
+*/
 
 typedef struct imap_scan_tree_ imap_scan_tree;
 struct imap_scan_tree_ {
@@ -509,50 +468,45 @@ struct imap_scan_tree_ {
     char delim;
 };
 
-static void imap_scan_destroy_tree(imap_scan_tree *tree);
+static void imap_scan_destroy_tree(imap_scan_tree * tree);
 
 static void
-imap_dir_cb(BalsaMailboxNode *mb)
+imap_dir_cb(BalsaMailboxNode* mb)
 {
-    gchar *msg;
-    BalsaMailboxNode *mroot = mb;
+    gchar* msg;
+    BalsaMailboxNode* mroot=mb;
     BalsaMailboxNode *n;
     GSList *list;
     GError *error = NULL;
-    imap_scan_tree imap_tree = {
-        NULL, '.'
-    };
+    imap_scan_tree imap_tree = { NULL, '.' };
     GtkStatusbar *statusbar;
     guint context_id;
 
-    if (!balsa_app.main_window) {
+    if (!balsa_app.main_window)
         return;
-    }
 
     statusbar = GTK_STATUSBAR(balsa_app.main_window->statusbar);
     context_id = gtk_statusbar_get_context_id(statusbar, "MailboxNode imap");
 
-    if (restore_children_from_cache(mb)) {
+    if(restore_children_from_cache(mb))
         return;
-    }
 
-    while (mroot->parent) {
-        mroot = mroot->parent;
-    }
+    while(mroot->parent)
+       mroot = mroot->parent;
     msg = g_strdup_printf(_("Scanning %s. Please wait…"), mroot->name);
     gtk_statusbar_push(statusbar, context_id, msg);
     g_free(msg);
 
     g_return_if_fail(mb->server);
     libbalsa_scanner_imap_dir(mb, mb->server, mb->dir, mb->delim,
-                              mb->subscribed, mb->list_inbox,
+                             mb->subscribed, mb->list_inbox, 
                               check_imap_path,
                               mark_imap_path,
                               handle_imap_path,
                               &imap_tree,
                               &error);
-
-    if (error) {
+    
+    if(error) {
         libbalsa_information(LIBBALSA_INFORMATION_WARNING,
                              error->code == LIBBALSA_MAILBOX_NETWORK_ERROR
                              ? _("Scanning of %s failed: %s\n"
@@ -577,110 +531,101 @@ imap_dir_cb(BalsaMailboxNode *mb)
     imap_tree.list = g_slist_reverse(imap_tree.list);
     for (list = imap_tree.list; list != NULL; list = list->next) {
         imap_scan_item *item = list->data;
-
-        n = imap_scan_create_mbnode(mb, item, imap_tree.delim);
-        if (item->selectable && imap_scan_attach_mailbox(n, item)) {
-            balsa_mblist_mailbox_node_redraw(n);
-        }
-        if (item->marked) {
+       
+       n = imap_scan_create_mbnode(mb, item, imap_tree.delim);
+       if (item->selectable && imap_scan_attach_mailbox(n, item))
+           balsa_mblist_mailbox_node_redraw(n);
+        if(item->marked)
             libbalsa_mailbox_set_unread_messages_flag(n->mailbox, TRUE);
-        }
     }
     imap_scan_destroy_tree(&imap_tree);
 
-    if (balsa_app.debug && mb->name) {
-        printf("imap_dir_cb:  main mailbox node %s mailbox is %p\n",
+    if(balsa_app.debug && mb->name)
+        printf("imap_dir_cb:  main mailbox node %s mailbox is %p\n", 
                mb->name, mb->mailbox);
-    }
-    if (balsa_app.debug) {
-        printf("%d: Scanning done.\n", (int)time(NULL));
-    }
+    if(balsa_app.debug) printf("%d: Scanning done.\n", (int)time(NULL));
     gtk_statusbar_pop(statusbar, context_id);
 
     /* We can save the cache now... */
     config_folder_update(mroot);
 }
 
-
 BalsaMailboxNode *
-balsa_mailbox_node_new_from_mailbox(LibBalsaMailbox *mb)
+balsa_mailbox_node_new_from_mailbox(LibBalsaMailbox * mb)
 {
     BalsaMailboxNode *mbn;
     mbn = BALSA_MAILBOX_NODE(balsa_mailbox_node_new());
     mbn->mailbox = mb;
     load_mailbox_view(mbn);
-    g_signal_connect(G_OBJECT(mbn), "show-prop-dialog",
-                     G_CALLBACK(mailbox_conf_edit), NULL);
+    g_signal_connect(G_OBJECT(mbn), "show-prop-dialog", 
+                    G_CALLBACK(mailbox_conf_edit), NULL);
     if (LIBBALSA_IS_MAILBOX_MH(mb) || LIBBALSA_IS_MAILBOX_MAILDIR(mb)) {
-        /* Mh and Maildir mailboxes are directories, and may be nested,
-         * so we need to be able to append a subtree. */
-        mbn->name = g_strdup(libbalsa_mailbox_local_get_path(mb));
-        mbn->dir = g_strdup(mbn->name);
-        g_signal_connect(G_OBJECT(mbn), "append-subtree",
+       /* Mh and Maildir mailboxes are directories, and may be nested,
+        * so we need to be able to append a subtree. */
+       mbn->name = g_strdup(libbalsa_mailbox_local_get_path(mb));
+       mbn->dir = g_strdup(mbn->name);
+       g_signal_connect(G_OBJECT(mbn), "append-subtree", 
                          G_CALLBACK(read_dir_cb), NULL);
     }
     return mbn;
 }
 
-
 BalsaMailboxNode *
-balsa_mailbox_node_new_from_dir(const gchar *dir)
+balsa_mailbox_node_new_from_dir(const gchar* dir)
 {
     BalsaMailboxNode *mbn;
 
     mbn = BALSA_MAILBOX_NODE(balsa_mailbox_node_new());
 
     mbn->name = g_strdup(dir);
-    mbn->dir = g_strdup(dir);
-    g_signal_connect(G_OBJECT(mbn), "show-prop-dialog",
-                     G_CALLBACK(dir_conf_edit), NULL);
-    g_signal_connect(G_OBJECT(mbn), "append-subtree",
-                     G_CALLBACK(read_dir_cb), NULL);
+    mbn->dir  = g_strdup(dir);
+    g_signal_connect(G_OBJECT(mbn), "show-prop-dialog", 
+                    G_CALLBACK(dir_conf_edit), NULL);
+    g_signal_connect(G_OBJECT(mbn), "append-subtree", 
+                    G_CALLBACK(read_dir_cb), NULL);
     return mbn;
 }
 
-
 /* balsa_mailbox_node_new_from_config:
    creates the mailbox node from given configuration data.
    Because local folders are not very useful, we assume that folders created
-   in this way are IMAP folders. Otherwise, we should follow a procedure
+   in this way are IMAP folders. Otherwise, we should follow a procedure 
    similiar to mailbox creation from configuration data.
- */
-BalsaMailboxNode *
-balsa_mailbox_node_new_from_config(const gchar *group)
+*/
+BalsaMailboxNode*
+balsa_mailbox_node_new_from_config(const gchar* group)
 {
     gboolean def;
     gint n_children;
     gchar **children;
-    BalsaMailboxNode *folder = balsa_mailbox_node_new();
+    BalsaMailboxNode * folder = balsa_mailbox_node_new();
 
     libbalsa_conf_push_group(group);
 
     folder->server = LIBBALSA_SERVER(libbalsa_imap_server_new_from_config());
 
-    if (balsa_app.debug) {
-        printf("Server loaded, host: %s, %s.\n", folder->server->host,
-               folder->server->use_ssl ? "SSL" : "no SSL");
-    }
-    g_signal_connect_swapped(G_OBJECT(folder->server), "config-changed",
+    if(balsa_app.debug)
+       printf("Server loaded, host: %s, %s.\n", folder->server->host,
+              folder->server->use_ssl ? "SSL" : "no SSL");
+    g_signal_connect_swapped(G_OBJECT(folder->server), "config-changed", 
                              G_CALLBACK(config_folder_update), folder);
-    g_signal_connect(G_OBJECT(folder), "show-prop-dialog",
-                     G_CALLBACK(folder_conf_imap_node), NULL);
-    g_signal_connect(G_OBJECT(folder), "append-subtree",
-                     G_CALLBACK(imap_dir_cb), NULL);
+    g_signal_connect(G_OBJECT(folder), "show-prop-dialog", 
+                    G_CALLBACK(folder_conf_imap_node), NULL);
+    g_signal_connect(G_OBJECT(folder), "append-subtree", 
+                    G_CALLBACK(imap_dir_cb), NULL);
     libbalsa_server_connect_signals(folder->server,
                                     G_CALLBACK(ask_password), NULL);
     balsa_mailbox_node_load_config(folder, group);
 
     folder->dir = libbalsa_conf_get_string("Directory");
     folder->subscribed =
-        libbalsa_conf_get_bool("Subscribed");
+       libbalsa_conf_get_bool("Subscribed"); 
     folder->list_inbox =
-        libbalsa_conf_get_bool("ListInbox=true");
+       libbalsa_conf_get_bool("ListInbox=true"); 
 
-    libbalsa_conf_get_vector_with_default("Children", &n_children,
-                                          &children, &def);
-    if (!def) {
+    libbalsa_conf_get_vector_with_default("Children",&n_children,
+                                          &children,&def);
+    if(!def) {
         g_object_set_data(G_OBJECT(folder), "children-cache", children);
     }
 
@@ -689,117 +634,99 @@ balsa_mailbox_node_new_from_config(const gchar *group)
     return folder;
 }
 
-
-static BalsaMailboxNode *
-balsa_mailbox_node_new_imap_node(LibBalsaServer *s,
-                                 const char     *p)
+static BalsaMailboxNode*
+balsa_mailbox_node_new_imap_node(LibBalsaServer* s, const char*p)
 {
-    BalsaMailboxNode *folder = balsa_mailbox_node_new();
+    BalsaMailboxNode * folder = balsa_mailbox_node_new();
     g_assert(s);
 
     folder->server = s;
     folder->dir = g_strdup(p);
-    g_signal_connect(G_OBJECT(folder), "append-subtree",
-                     G_CALLBACK(imap_dir_cb), NULL);
+    g_signal_connect(G_OBJECT(folder), "append-subtree", 
+                    G_CALLBACK(imap_dir_cb), NULL);
 
     return folder;
 }
 
-
-BalsaMailboxNode *
-balsa_mailbox_node_new_imap(LibBalsaServer *s,
-                            const char     *p)
+BalsaMailboxNode*
+balsa_mailbox_node_new_imap(LibBalsaServer* s, const char*p)
 {
-    BalsaMailboxNode *folder = balsa_mailbox_node_new_imap_node(s, p);
+    BalsaMailboxNode * folder = balsa_mailbox_node_new_imap_node(s, p);
     g_assert(s);
 
     folder->mailbox = libbalsa_mailbox_imap_new();
     g_object_ref(G_OBJECT(folder->mailbox));
     libbalsa_mailbox_remote_set_server(
-        LIBBALSA_MAILBOX_REMOTE(folder->mailbox), s);
+       LIBBALSA_MAILBOX_REMOTE(folder->mailbox), s);
     libbalsa_mailbox_imap_set_path(LIBBALSA_MAILBOX_IMAP(folder->mailbox), p);
     load_mailbox_view(folder);
 
     return folder;
 }
 
-
-BalsaMailboxNode *
-balsa_mailbox_node_new_imap_folder(LibBalsaServer *s,
-                                   const char     *p)
+BalsaMailboxNode*
+balsa_mailbox_node_new_imap_folder(LibBalsaServer* s, const char*p)
 {
-    BalsaMailboxNode *folder = balsa_mailbox_node_new_imap_node(s, p);
+    BalsaMailboxNode * folder = balsa_mailbox_node_new_imap_node(s, p);
     g_assert(s);
 
-    g_signal_connect(G_OBJECT(folder), "show-prop-dialog",
-                     G_CALLBACK(folder_conf_imap_node), NULL);
+    g_signal_connect(G_OBJECT(folder), "show-prop-dialog", 
+                    G_CALLBACK(folder_conf_imap_node), NULL);
     return folder;
 }
 
-
 void
-balsa_mailbox_node_show_prop_dialog(BalsaMailboxNode *mn)
+balsa_mailbox_node_show_prop_dialog(BalsaMailboxNode* mn)
 {
-    if (mn) {
+    if (mn)
         g_signal_emit(G_OBJECT(mn),
                       balsa_mailbox_node_signals[SHOW_PROP_DIALOG], 0);
-    }
 }
 
-
 void
-balsa_mailbox_node_append_subtree(BalsaMailboxNode *mn)
+balsa_mailbox_node_append_subtree(BalsaMailboxNode * mn)
 {
     g_signal_emit(G_OBJECT(mn),
-                  balsa_mailbox_node_signals[APPEND_SUBTREE], 0);
+                 balsa_mailbox_node_signals[APPEND_SUBTREE], 0);
 }
 
-
-void
-balsa_mailbox_node_show_prop_dialog_cb(GtkWidget *widget,
-                                       gpointer   data)
+void 
+balsa_mailbox_node_show_prop_dialog_cb(GtkWidget * widget, gpointer data)
 {
-    balsa_mailbox_node_show_prop_dialog((BalsaMailboxNode *)data);
+    balsa_mailbox_node_show_prop_dialog((BalsaMailboxNode*)data);
 }
 
-
 /* balsa_mailbox_node_load_config:
    load general configurtion: name ordering, threading option etc
    with some sane defaults.
- */
+*/
 void
-balsa_mailbox_node_load_config(BalsaMailboxNode *mn,
-                               const gchar      *group)
+balsa_mailbox_node_load_config(BalsaMailboxNode* mn, const gchar* group)
 {
     g_signal_emit(G_OBJECT(mn),
-                  balsa_mailbox_node_signals[LOAD_CONFIG], 0, group);
+                 balsa_mailbox_node_signals[LOAD_CONFIG], 0, group);
 }
 
-
 void
-balsa_mailbox_node_save_config(BalsaMailboxNode *mn,
-                               const gchar      *group)
+balsa_mailbox_node_save_config(BalsaMailboxNode* mn, const gchar* group)
 {
     g_signal_emit(G_OBJECT(mn),
-                  balsa_mailbox_node_signals[SAVE_CONFIG], 0, group);
+                 balsa_mailbox_node_signals[SAVE_CONFIG], 0, group);
 }
 
-
 /* ---------------------------------------------------------------------
  * Rescanning.
  * --------------------------------------------------------------------- */
 static BalsaMailboxNode *
-find_dir(const gchar *dir)
+find_dir(const gchar * dir)
 {
-    if (strcmp(dir, balsa_app.local_mail_directory) == 0) {
+    if (strcmp(dir, balsa_app.local_mail_directory) == 0)
         return g_object_ref(balsa_app.root_node);
-    }
     return balsa_find_dir(NULL, dir);
 }
 
-
 void
-balsa_mailbox_local_append(LibBalsaMailbox *mbx)
+balsa_mailbox_local_append(LibBalsaMailbox* mbx)
 {
     gchar *dir;
     BalsaMailboxNode *mbnode;
@@ -810,35 +737,32 @@ balsa_mailbox_local_append(LibBalsaMailbox *mbx)
     dir = g_strdup(libbalsa_mailbox_local_get_path(mbx));
     while (dir[1] /* i.e. dir != "/" */
            && !(parent = find_dir(dir))) {
-        gchar *tmp = g_path_get_dirname(dir);
+        gchar* tmp =  g_path_get_dirname(dir);
         g_free(dir);
         dir = tmp;
     }
     mbnode = balsa_mailbox_node_new_from_mailbox(mbx);
     mbnode->parent = parent;
     balsa_mblist_mailbox_node_append(parent, mbnode);
-    if (parent) {
-        g_object_unref(parent);
-    }
+    if(parent)
+       g_object_unref(parent);
     g_free(dir);
 }
 
-
 /* balsa_mailbox_node_rescan:
    rescans given folders. It can be called on configuration update or just
-   to discover mailboxes that did not exist when balsa was initially
+   to discover mailboxes that did not exist when balsa was initially 
    started.
    NOTE: applicable only to folders (mailbox collections).
    the expansion state preservation is not perfect, only top level is
    preserved.
- */
+*/
 
 void
-balsa_mailbox_node_rescan(BalsaMailboxNode *mn)
+balsa_mailbox_node_rescan(BalsaMailboxNode * mn)
 {
-    if (!balsa_app.mblist_tree_store) {
+    if (!balsa_app.mblist_tree_store)
         return;
-    }
 
     if (mn) {
         balsa_mailbox_node_clear_children_cache(mn);
@@ -851,19 +775,17 @@ balsa_mailbox_node_rescan(BalsaMailboxNode *mn)
     balsa_mailbox_node_append_subtree(mn);
 }
 
-
 void
 balsa_mailbox_node_clear_children_cache(BalsaMailboxNode *mn)
 {
     gchar **children_cache = g_object_get_data(G_OBJECT(mn), "children-cache");
 
-    if (children_cache) {
+    if(children_cache) {
         g_strfreev(children_cache);
         g_object_set_data(G_OBJECT(mn), "children-cache", NULL);
     }
 }
 
-
 static gboolean
 restore_children_from_cache(BalsaMailboxNode *mn)
 {
@@ -871,63 +793,60 @@ restore_children_from_cache(BalsaMailboxNode *mn)
     gchar **children = g_object_get_data(G_OBJECT(mn), "children-cache");
     imap_scan_item isi;
 
-    if (!children) {
-        if (mn->name) {
+    if(!children) {
+        if(mn->name)
             printf("No cache for %s - quitting.\n", mn->name);
-        }
         return FALSE;
     }
 
-    for (i = 0; children[i]; i++) {
-        if ((children[i][0] == 'P') && (strlen(children[i]) > 3)) {
+    for(i=0; children[i]; i++) {
+        if(children[i][0] == 'P' && strlen(children[i])>3) {
             BalsaMailboxNode *n;
-            isi.fn = children[i] + 3;
+            isi.fn = children[i]+3;
             isi.special = NULL;
             isi.scanned = TRUE;
             isi.selectable = children[i][2] == 'S';
             isi.marked = FALSE;
             n = imap_scan_create_mbnode(mn, &isi, children[i][1]);
-            if (isi.selectable && imap_scan_attach_mailbox(n, &isi)) {
+            if (isi.selectable && imap_scan_attach_mailbox(n, &isi))
                 balsa_mblist_mailbox_node_redraw(n);
-            }
         }
     }
-
+    
     return TRUE;
 }
 
-
+    
 /* balsa_mailbox_node_scan_children:
- * checks whether a mailbox node's children need scanning.
+ * checks whether a mailbox node's children need scanning. 
  * Note that rescanning local_mail_directory will *not* trigger rescanning
  * eventual IMAP servers.
  */
 #define BALSA_MAILBOX_NODE_LIST_KEY "balsa-mailbox-node-list"
 
 void
-balsa_mailbox_node_scan_children(BalsaMailboxNode *mbnode)
+balsa_mailbox_node_scan_children(BalsaMailboxNode * mbnode)
 {
     GtkTreeIter parent;
     GtkTreeModel *model = GTK_TREE_MODEL(balsa_app.mblist_tree_store);
     GSList *list = NULL;
 
     if (balsa_find_iter_by_data(&parent, mbnode)) {
-        gboolean valid;
-        GtkTreeIter iter;
+       gboolean valid;
+       GtkTreeIter iter;
 
-        for (valid = gtk_tree_model_iter_children(model, &iter, &parent);
-             valid; valid = gtk_tree_model_iter_next(model, &iter)) {
+       for (valid = gtk_tree_model_iter_children(model, &iter, &parent);
+            valid; valid = gtk_tree_model_iter_next(model, &iter)) {
             BalsaMailboxNode *mn;
-            gtk_tree_model_get(model, &iter, 0, &mn, -1);
-            if (!mn->scanned) {
+           gtk_tree_model_get(model, &iter, 0, &mn, -1);
+           if (!mn->scanned) {
                 list = g_slist_prepend(list, mn);
-                g_object_add_weak_pointer(G_OBJECT(mn), &list->data);
+                g_object_add_weak_pointer(G_OBJECT(mn), & list->data);
             }
-            g_object_unref(mn);
+           g_object_unref(mn);
         }
-    } else {
+    } else
         g_print("balsa_mailbox_node_scan_children: didn't find mbnode.\n");
-    }
 
     if (list && !g_object_get_data(G_OBJECT(mbnode),
                                    BALSA_MAILBOX_NODE_LIST_KEY)) {
@@ -940,9 +859,8 @@ balsa_mailbox_node_scan_children(BalsaMailboxNode *mbnode)
     }
 }
 
-
 static gboolean
-bmbn_scan_children_idle(BalsaMailboxNode **mbnode)
+bmbn_scan_children_idle(BalsaMailboxNode ** mbnode)
 {
     GSList *list;
     GSList *l;
@@ -956,30 +874,25 @@ bmbn_scan_children_idle(BalsaMailboxNode **mbnode)
     for (l = list; l != NULL; l = l->next) {
         BalsaMailboxNode *mn;
 
-        if (!l->data) {
+        if (!l->data)
             continue;
-        }
         mn = l->data;
         if (!mn->scanned) {
             gboolean has_unread_messages = FALSE;
 
-            if (mn->mailbox) {
+            if (mn->mailbox)
                 has_unread_messages = mn->mailbox->has_unread_messages;
-            }
             balsa_mailbox_node_rescan(mn);
-            if (!l->data) {
+            if (!l->data)
                 continue;
-            }
-            if (mn->mailbox) {
+            if (mn->mailbox)
                 mn->mailbox->has_unread_messages = has_unread_messages;
-            }
             mn->scanned = TRUE;
-        } else if (balsa_app.debug) {
+        } else if (balsa_app.debug)
             g_print("%s: %s “%s” was already scanned\n", __func__,
                     mn->mailbox ? "mailbox" : "folder",
                     mn->mailbox ? mn->mailbox->name : mn->name);
-        }
-        g_object_remove_weak_pointer(G_OBJECT(mn), &l->data);
+        g_object_remove_weak_pointer(G_OBJECT(mn), & l->data);
     }
     g_slist_free(list);
 
@@ -993,127 +906,99 @@ bmbn_scan_children_idle(BalsaMailboxNode **mbnode)
     return FALSE;
 }
 
-
 /* ---------------------------------------------------------------------
  * Context menu, helpers, and callbacks.
  * --------------------------------------------------------------------- */
 static void
-add_menu_entry(GtkWidget        *menu,
-               const gchar      *label,
-               GCallback         cb,
-               BalsaMailboxNode *mbnode)
+add_menu_entry(GtkWidget * menu, const gchar * label, GCallback cb,
+              BalsaMailboxNode * mbnode)
 {
     GtkWidget *menuitem;
 
     menuitem = label ? gtk_menu_item_new_with_mnemonic(label)
-        : gtk_menu_item_new();
+       : gtk_menu_item_new();
 
-    if (cb) {
-        g_signal_connect(G_OBJECT(menuitem), "activate",
-                         G_CALLBACK(cb), mbnode);
-    }
+    if (cb)
+       g_signal_connect(G_OBJECT(menuitem), "activate",
+                        G_CALLBACK(cb), mbnode);
 
     gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
 }
 
-
 static void
-mb_open_cb(GtkWidget        *widget,
-           BalsaMailboxNode *mbnode)
+mb_open_cb(GtkWidget * widget, BalsaMailboxNode * mbnode)
 {
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mbnode->mailbox));
     balsa_mblist_open_mailbox(mbnode->mailbox);
 }
 
-
 static void
-mb_close_cb(GtkWidget        *widget,
-            BalsaMailboxNode *mbnode)
+mb_close_cb(GtkWidget * widget, BalsaMailboxNode * mbnode)
 {
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mbnode->mailbox));
     balsa_window_close_mbnode(balsa_app.main_window, mbnode);
 }
 
-
 static void
-mb_conf_cb(GtkWidget        *widget,
-           BalsaMailboxNode *mbnode)
+mb_conf_cb(GtkWidget * widget, BalsaMailboxNode * mbnode)
 {
     balsa_mailbox_node_show_prop_dialog(mbnode);
 }
 
-
 static void
-mb_del_cb(GtkWidget        *widget,
-          BalsaMailboxNode *mbnode)
+mb_del_cb(GtkWidget * widget, BalsaMailboxNode * mbnode)
 {
-    if (mbnode->mailbox) {
-        mailbox_conf_delete(mbnode);
-    } else {
-        folder_conf_delete(mbnode);
-    }
+    if(mbnode->mailbox)
+       mailbox_conf_delete(mbnode);
+    else folder_conf_delete(mbnode);
 }
 
-
 static void
-mb_inbox_cb(GtkWidget        *widget,
-            BalsaMailboxNode *mbnode)
+mb_inbox_cb(GtkWidget * widget, BalsaMailboxNode * mbnode)
 {
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mbnode->mailbox));
     config_mailbox_set_as_special(mbnode->mailbox, SPECIAL_INBOX);
 }
 
-
 static void
-mb_sentbox_cb(GtkWidget        *widget,
-              BalsaMailboxNode *mbnode)
+mb_sentbox_cb(GtkWidget * widget, BalsaMailboxNode * mbnode)
 {
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mbnode->mailbox));
     config_mailbox_set_as_special(mbnode->mailbox, SPECIAL_SENT);
 }
 
-
 static void
-mb_trash_cb(GtkWidget        *widget,
-            BalsaMailboxNode *mbnode)
+mb_trash_cb(GtkWidget * widget, BalsaMailboxNode * mbnode)
 {
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mbnode->mailbox));
     config_mailbox_set_as_special(mbnode->mailbox, SPECIAL_TRASH);
 }
 
-
 static void
-mb_draftbox_cb(GtkWidget        *widget,
-               BalsaMailboxNode *mbnode)
+mb_draftbox_cb(GtkWidget * widget, BalsaMailboxNode * mbnode)
 {
     g_return_if_fail(LIBBALSA_IS_MAILBOX(mbnode->mailbox));
     config_mailbox_set_as_special(mbnode->mailbox, SPECIAL_DRAFT);
 }
 
-
 static void
-mb_subscribe_cb(GtkWidget        *widget,
-                BalsaMailboxNode *mbnode)
+mb_subscribe_cb(GtkWidget * widget, BalsaMailboxNode * mbnode)
 {
     g_return_if_fail(LIBBALSA_IS_MAILBOX_IMAP(mbnode->mailbox));
-    libbalsa_mailbox_imap_subscribe(LIBBALSA_MAILBOX_IMAP(mbnode->mailbox),
-                                    TRUE);
+    libbalsa_mailbox_imap_subscribe(LIBBALSA_MAILBOX_IMAP(mbnode->mailbox), 
+                                   TRUE);
 }
 
-
 static void
-mb_unsubscribe_cb(GtkWidget        *widget,
-                  BalsaMailboxNode *mbnode)
+mb_unsubscribe_cb(GtkWidget * widget, BalsaMailboxNode * mbnode)
 {
     g_return_if_fail(LIBBALSA_IS_MAILBOX_IMAP(mbnode->mailbox));
     libbalsa_mailbox_imap_subscribe(LIBBALSA_MAILBOX_IMAP(mbnode->mailbox),
-                                    FALSE);
+                                    FALSE);
 }
 
-
 static void
-mb_rescan_cb(GtkWidget        *widget,
-             BalsaMailboxNode *mbnode)
+mb_rescan_cb(GtkWidget * widget, BalsaMailboxNode * mbnode)
 {
     gchar *current_mailbox_url;
     GPtrArray *url_array;
@@ -1123,43 +1008,36 @@ mb_rescan_cb(GtkWidget        *widget,
 
     /* Reopen mailboxes */
     url_array = g_ptr_array_new();
-    if (current_mailbox_url) {
+    if (current_mailbox_url)
         g_ptr_array_add(url_array, current_mailbox_url);
-    }
     balsa_add_open_mailbox_urls(url_array);
     g_ptr_array_add(url_array, NULL);
     balsa_open_mailbox_list((gchar **) g_ptr_array_free(url_array, FALSE));
 }
 
-
 static void
-mb_filter_cb(GtkWidget        *widget,
-             BalsaMailboxNode *mbnode)
+mb_filter_cb(GtkWidget * widget, BalsaMailboxNode * mbnode)
 {
-    if (mbnode->mailbox) {
+    if (mbnode->mailbox)
         filters_run_dialog(mbnode->mailbox,
                            GTK_WINDOW(balsa_app.main_window));
-    } else {
-        /* FIXME : Perhaps should we be able to apply filters on
-           folders (ie recurse on all mailboxes in it), but there are
-           problems of infinite recursion (when one mailbox being
-           filtered is also the destination of the filter action (eg a
-           copy)). So let's see that later :) */
-        g_print("You can apply filters only on mailbox\n");
-    }
+    else
+       /* FIXME : Perhaps should we be able to apply filters on
+          folders (ie recurse on all mailboxes in it), but there are
+          problems of infinite recursion (when one mailbox being
+          filtered is also the destination of the filter action (eg a
+          copy)). So let's see that later :) */
+       g_print("You can apply filters only on mailbox\n");
 }
 
-
 static void
-mb_empty_trash_cb(GtkWidget        *widget,
-                  BalsaMailboxNode *mbnode)
+mb_empty_trash_cb(GtkWidget * widget, BalsaMailboxNode * mbnode)
 {
     empty_trash(balsa_app.main_window);
 }
 
-
 GtkWidget *
-balsa_mailbox_node_get_context_menu(BalsaMailboxNode *mbnode)
+balsa_mailbox_node_get_context_menu(BalsaMailboxNode * mbnode)
 {
     GtkWidget *menu;
     GtkWidget *submenu;
@@ -1175,215 +1053,195 @@ balsa_mailbox_node_get_context_menu(BalsaMailboxNode *mbnode)
                      G_CALLBACK(gtk_widget_destroy), NULL);
 
     submenu = gtk_menu_new();
-    add_menu_entry(submenu, _("Local _mbox mailbox…"),
-                   G_CALLBACK(mailbox_conf_add_mbox_cb), NULL);
-    add_menu_entry(submenu, _("Local Mail_dir mailbox…"),
-                   G_CALLBACK(mailbox_conf_add_maildir_cb), NULL);
+    add_menu_entry(submenu, _("Local _mbox mailbox…"),  
+                  G_CALLBACK(mailbox_conf_add_mbox_cb), NULL);
+    add_menu_entry(submenu, _("Local Mail_dir mailbox…"), 
+                  G_CALLBACK(mailbox_conf_add_maildir_cb), NULL);
     add_menu_entry(submenu, _("Local M_H mailbox…"),
-                   G_CALLBACK(mailbox_conf_add_mh_cb), NULL);
-    add_menu_entry(submenu, _("Remote _IMAP mailbox…"),
-                   G_CALLBACK(mailbox_conf_add_imap_cb), NULL);
+                  G_CALLBACK(mailbox_conf_add_mh_cb), NULL);
+    add_menu_entry(submenu, _("Remote _IMAP mailbox…"), 
+                  G_CALLBACK(mailbox_conf_add_imap_cb), NULL);
     add_menu_entry(submenu, NULL, NULL, mbnode);
-    add_menu_entry(submenu, _("Remote IMAP _folder…"),
-                   G_CALLBACK(folder_conf_add_imap_cb), NULL);
-    add_menu_entry(submenu, _("Remote IMAP _subfolder…"),
-                   G_CALLBACK(folder_conf_add_imap_sub_cb), NULL);
-
+    add_menu_entry(submenu, _("Remote IMAP _folder…"), 
+                  G_CALLBACK(folder_conf_add_imap_cb), NULL);
+    add_menu_entry(submenu, _("Remote IMAP _subfolder…"), 
+                  G_CALLBACK(folder_conf_add_imap_sub_cb), NULL);
+    
     /* Translators: popup menu item "New" mailbox or folder */
     menuitem = gtk_menu_item_new_with_mnemonic(C_("mailbox", "_New"));
     gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
-
+    
     gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
-
-    if (mbnode == NULL) {/* clicked on the empty space */
-        add_menu_entry(menu, _("_Rescan"), G_CALLBACK(mb_rescan_cb),
+    
+    if(mbnode == NULL) {/* clicked on the empty space */
+        add_menu_entry(menu, _("_Rescan"), G_CALLBACK(mb_rescan_cb), 
                        NULL);
-        return menu;
+       return menu;
     }
     /* If we didn't click on a mailbox node then there is only one option. */
     add_menu_entry(menu, NULL, NULL, NULL);
 
     if (g_signal_has_handler_pending(G_OBJECT(mbnode),
                                      balsa_mailbox_node_signals
-                                     [SHOW_PROP_DIALOG], 0, FALSE)) {
+                                     [SHOW_PROP_DIALOG], 0, FALSE))
         add_menu_entry(menu, _("_Properties…"),
                        G_CALLBACK(mb_conf_cb), mbnode);
-    }
 
     if (g_signal_has_handler_pending(G_OBJECT(mbnode),
-                                     balsa_mailbox_node_signals
-                                     [APPEND_SUBTREE], 0, FALSE)) {
-        add_menu_entry(menu, _("_Rescan"),
-                       G_CALLBACK(mb_rescan_cb), mbnode);
-    }
+                                    balsa_mailbox_node_signals
+                                    [APPEND_SUBTREE], 0, FALSE))
+       add_menu_entry(menu, _("_Rescan"),
+                      G_CALLBACK(mb_rescan_cb), mbnode);
 
-    if (mbnode->config_prefix) {
-        add_menu_entry(menu, _("_Delete"), G_CALLBACK(mb_del_cb), mbnode);
-    }
+    if (mbnode->config_prefix)
+       add_menu_entry(menu, _("_Delete"), G_CALLBACK(mb_del_cb),  mbnode);
 
-    if (!(mailbox = mbnode->mailbox)) {
+    if (!(mailbox = mbnode->mailbox))
         return menu;
-    }
 
-    if (!MAILBOX_OPEN(mailbox)) {
-        add_menu_entry(menu, _("_Open"), G_CALLBACK(mb_open_cb), mbnode);
-    } else {
+    if (!MAILBOX_OPEN(mailbox))
+        add_menu_entry(menu, _("_Open"),  G_CALLBACK(mb_open_cb),  mbnode);
+    else
         add_menu_entry(menu, _("_Close"), G_CALLBACK(mb_close_cb), mbnode);
-    }
 
-    special = (mailbox == balsa_app.inbox
+    special = (   mailbox == balsa_app.inbox
                || mailbox == balsa_app.sentbox
                || mailbox == balsa_app.draftbox
                || mailbox == balsa_app.outbox
                || mailbox == balsa_app.trash);
-    if (!special && !mbnode->config_prefix) {
-        add_menu_entry(menu, _("_Delete"), G_CALLBACK(mb_del_cb), mbnode);
-    }
+    if (!special && !mbnode->config_prefix)
+       add_menu_entry(menu, _("_Delete"), G_CALLBACK(mb_del_cb),  mbnode);
 
-    if (LIBBALSA_IS_MAILBOX_IMAP(mailbox)) {
+    if(LIBBALSA_IS_MAILBOX_IMAP(mailbox)) {
         add_menu_entry(menu, NULL, NULL, NULL);
-        add_menu_entry(menu, _("_Subscribe"),
-                       G_CALLBACK(mb_subscribe_cb), mbnode);
-        add_menu_entry(menu, _("_Unsubscribe"),
+        add_menu_entry(menu, _("_Subscribe"),   
+                       G_CALLBACK(mb_subscribe_cb),   mbnode);
+        add_menu_entry(menu, _("_Unsubscribe"), 
                        G_CALLBACK(mb_unsubscribe_cb), mbnode);
     }
 
     if (!special) {
         add_menu_entry(menu, NULL, NULL, NULL);
-        add_menu_entry(menu, _("Mark as _Inbox"),
-                       G_CALLBACK(mb_inbox_cb), mbnode);
-        add_menu_entry(menu, _("_Mark as Sentbox"),
-                       G_CALLBACK(mb_sentbox_cb), mbnode);
-        add_menu_entry(menu, _("Mark as _Trash"),
-                       G_CALLBACK(mb_trash_cb), mbnode);
+        add_menu_entry(menu, _("Mark as _Inbox"),    
+                       G_CALLBACK(mb_inbox_cb),    mbnode);
+        add_menu_entry(menu, _("_Mark as Sentbox"), 
+                       G_CALLBACK(mb_sentbox_cb),  mbnode);
+        add_menu_entry(menu, _("Mark as _Trash"),    
+                       G_CALLBACK(mb_trash_cb),    mbnode);
         add_menu_entry(menu, _("Mark as D_raftbox"),
                        G_CALLBACK(mb_draftbox_cb), mbnode);
-    } else if (mailbox == balsa_app.trash) {
-        add_menu_entry(menu, _("_Empty trash"),
+    } else if (mailbox == balsa_app.trash)
+        add_menu_entry(menu, _("_Empty trash"),    
                        G_CALLBACK(mb_empty_trash_cb), mbnode);
-    }
 
     /* FIXME : No test on mailbox type is made yet, should we ? */
     add_menu_entry(menu, NULL, NULL, NULL);
-    add_menu_entry(menu, _("_Edit/Apply filters"),
+    add_menu_entry(menu, _("_Edit/Apply filters"), 
                    G_CALLBACK(mb_filter_cb), mbnode);
 
     return menu;
 }
 
-
 /* ---------------------------------------------------------------------
- * folder scanner related functions
+ * folder scanner related functions 
  * --------------------------------------------------------------------- */
 
 /* add_local_mailbox
-   the function scans the local mail directory (LMD) and adds them to the
+   the function scans the local mail directory (LMD) and adds them to the 
    list of mailboxes. Takes care not to duplicate any of the "standard"
-   mailboxes (inbox, outbox etc). Avoids also problems with aliasing
-   (someone added a local mailbox - possibly aliased - located in LMD
+   mailboxes (inbox, outbox etc). Avoids also problems with aliasing 
+   (someone added a local mailbox - possibly aliased - located in LMD 
    to the configuration).
- */
+*/
 
 /* remove_mailbox_from_nodes:
- */
+*/
 static BalsaMailboxNode *
-remove_mailbox_from_nodes(LibBalsaMailbox *mailbox)
+remove_mailbox_from_nodes(LibBalsaMailbox* mailbox)
 {
     BalsaMailboxNode *mbnode;
 
     mbnode = balsa_find_mailbox(mailbox);
-    if (mbnode) {
-        balsa_mblist_mailbox_node_remove(mbnode);
-    } else {
-        mbnode = balsa_mailbox_node_new_from_mailbox(mailbox);
-    }
+    if (mbnode)
+       balsa_mblist_mailbox_node_remove(mbnode);
+    else
+       mbnode = balsa_mailbox_node_new_from_mailbox(mailbox);
     return mbnode;
 }
-
-
-static BalsaMailboxNode *
-remove_special_mailbox_by_url(const gchar       *url,
-                              LibBalsaMailbox ***special)
+    
+static BalsaMailboxNode * 
+remove_special_mailbox_by_url(const gchar* url, LibBalsaMailbox *** special)
 {
     LibBalsaMailbox **mailbox;
 
-    if (balsa_app.trash && (strcmp(url, balsa_app.trash->url) == 0)) {
-        mailbox = &balsa_app.trash;
-    } else if (balsa_app.inbox && (strcmp(url, balsa_app.inbox->url) == 0)) {
-        mailbox = &balsa_app.inbox;
-    } else if (balsa_app.outbox && (strcmp(url, balsa_app.outbox->url) == 0)) {
-        mailbox = &balsa_app.outbox;
-    } else if (balsa_app.sentbox && (strcmp(url, balsa_app.sentbox->url) == 0)) {
-        mailbox = &balsa_app.sentbox;
-    } else if (balsa_app.draftbox && (strcmp(url, balsa_app.draftbox->url) == 0)) {
-        mailbox = &balsa_app.draftbox;
-    } else {
+    if (balsa_app.trash && strcmp(url, balsa_app.trash->url) == 0)
+       mailbox = &balsa_app.trash;
+    else if (balsa_app.inbox && strcmp(url, balsa_app.inbox->url) == 0)
+       mailbox = &balsa_app.inbox;
+    else if (balsa_app.outbox && strcmp(url, balsa_app.outbox->url) == 0)
+       mailbox = &balsa_app.outbox;
+    else if (balsa_app.sentbox && strcmp(url, balsa_app.sentbox->url) == 0)
+       mailbox = &balsa_app.sentbox;
+    else if (balsa_app.draftbox && strcmp(url, balsa_app.draftbox->url) == 0)
+       mailbox = &balsa_app.draftbox;
+    else
         mailbox = NULL;
-    }
 
-    if (special) {
+    if (special)
         *special = mailbox;
-    }
-
+       
     return mailbox ? remove_mailbox_from_nodes(*mailbox) : NULL;
 }
 
-
 static gboolean
-mailbox_check_idle(LibBalsaMailbox *mailbox)
+mailbox_check_idle(LibBalsaMailbox * mailbox)
 {
     libbalsa_mailbox_check(mailbox);
     g_object_unref(mailbox);
     return FALSE;
 }
 
-
 static BalsaMailboxNode *
-add_local_mailbox(BalsaMailboxNode *root,
-                  const gchar      *name,
-                  const gchar      *path,
-                  GType             type)
+add_local_mailbox(BalsaMailboxNode *root, const gchar * name,
+                 const gchar * path, GType type)
 {
     BalsaMailboxNode *mbnode;
     LibBalsaMailbox *mailbox;
-    gchar *url;
+    gchar* url;
 
-    if (root == NULL) {
-        return NULL;
-    }
+    if(root == NULL) return NULL;
     url = g_strconcat("file://", path, NULL);
-
+    
     mbnode = remove_special_mailbox_by_url(url, NULL);
     if (!mbnode) {
-        if ( type == LIBBALSA_TYPE_MAILBOX_MH ) {
-            mailbox = libbalsa_mailbox_mh_new(path, FALSE);
-        } else if ( type == LIBBALSA_TYPE_MAILBOX_MBOX ) {
-            mailbox = libbalsa_mailbox_mbox_new(path, FALSE);
-        } else if ( type == LIBBALSA_TYPE_MAILBOX_MAILDIR ) {
-            mailbox = libbalsa_mailbox_maildir_new(path, FALSE);
-        } else {
-            /* type is not a valid local mailbox type. */
-            balsa_information(LIBBALSA_INFORMATION_DEBUG,
-                              _("The path “%s” does not lead to a mailbox."),
-                              path);
-            mailbox = NULL;
-        }
-        if (!mailbox) {/* local mailbox could not be created; privileges? */
-            printf("Not accessible mailbox %s\n", path);
-            return NULL;
-        }
-        mailbox->name = g_strdup(name);
-
-        mbnode = balsa_mailbox_node_new_from_mailbox(mailbox);
-
-        if (balsa_app.debug) {
-            g_print(_("Local mailbox %s loaded as: %s\n"),
-                    mailbox->name,
-                    g_type_name(G_OBJECT_TYPE(mailbox)));
-        }
+       if ( type == LIBBALSA_TYPE_MAILBOX_MH ) {
+           mailbox = libbalsa_mailbox_mh_new(path, FALSE);
+       } else if ( type == LIBBALSA_TYPE_MAILBOX_MBOX ) {
+           mailbox = libbalsa_mailbox_mbox_new(path, FALSE);
+       } else if ( type == LIBBALSA_TYPE_MAILBOX_MAILDIR ) {
+           mailbox = libbalsa_mailbox_maildir_new(path, FALSE);
+       } else {
+           /* type is not a valid local mailbox type. */
+           balsa_information(LIBBALSA_INFORMATION_DEBUG,
+                             _("The path “%s” does not lead to a mailbox."),
+                             path);
+           mailbox = NULL;
+       }
+       if(!mailbox) {/* local mailbox could not be created; privileges? */
+           printf("Not accessible mailbox %s\n", path);
+           return NULL;
+       }
+       mailbox->name = g_strdup(name);
+       
+       mbnode = balsa_mailbox_node_new_from_mailbox(mailbox);
+       
+       if (balsa_app.debug)
+           g_print(_("Local mailbox %s loaded as: %s\n"),
+                   mailbox->name,
+                   g_type_name(G_OBJECT_TYPE(mailbox)));
         if (balsa_app.check_mail_upon_startup
-            && (libbalsa_mailbox_get_subscribe(mailbox) !=
-                LB_MAILBOX_SUBSCRIBE_NO)) {
+            && libbalsa_mailbox_get_subscribe(mailbox) !=
+            LB_MAILBOX_SUBSCRIBE_NO) {
             g_object_ref(mailbox);
             g_idle_add((GSourceFunc) mailbox_check_idle, mailbox);
         }
@@ -1396,42 +1254,36 @@ add_local_mailbox(BalsaMailboxNode *root,
     return mbnode;
 }
 
-
 static BalsaMailboxNode *
-add_local_folder(BalsaMailboxNode *root,
-                 const char       *d_name,
-                 const char       *path)
+add_local_folder(BalsaMailboxNode * root, const char *d_name,
+                const char *path)
 {
     BalsaMailboxNode *mbnode;
 
-    if (!root) {
-        return NULL;
-    }
+    if (!root)
+       return NULL;
 
     mbnode = balsa_mailbox_node_new_from_dir(path);
     mbnode->parent = root;
     balsa_mblist_mailbox_node_append(root, mbnode);
-    if (balsa_app.debug) {
-        g_print(_("Local folder %s\n"), path);
-    }
+    if (balsa_app.debug)
+       g_print(_("Local folder %s\n"), path);
 
     return mbnode;
 }
 
 
 /* ---------------------------------------------------------------------
- * IMAP folder scanner functions
+ * IMAP folder scanner functions 
  * --------------------------------------------------------------------- */
-static gchar *
-get_parent_folder_name(const gchar *path,
-                       char         delim)
+static gchar*
+get_parent_folder_name(const gchar* path, char delim)
 {
-    const gchar *last_delim = strrchr(path, delim);
-    return last_delim ? g_strndup(path, last_delim - path)
-           : g_strdup("");
+    const gchar* last_delim = strrchr(path, delim);
+    return last_delim ? g_strndup(path, last_delim-path)
+       : g_strdup("");
 }
 
-
 /* imap_scan_create_mbnode:
  * Returns a node for the path isi->fn.
  * Finds the node if it exists, and creates one if it doesn't.
@@ -1440,9 +1292,8 @@ get_parent_folder_name(const gchar *path,
  * Caller must unref mbnode.
  */
 static BalsaMailboxNode *
-imap_scan_create_mbnode(BalsaMailboxNode *root,
-                        imap_scan_item   *isi,
-                        int               delim)
+imap_scan_create_mbnode(BalsaMailboxNode * root, imap_scan_item * isi,
+                       int delim)
 {
     gchar *parent_name;
     BalsaMailboxNode *mbnode;
@@ -1453,15 +1304,15 @@ imap_scan_create_mbnode(BalsaMailboxNode *root,
 
     mbnode = balsa_find_url(url);
     if (mbnode) {
-        /* A mailbox with this url is already in the tree... */
-        LibBalsaMailboxView *view;
-        BalsaMailboxNode *special =
-            remove_special_mailbox_by_url(url, &isi->special);
-        if (special) {
+       /* A mailbox with this url is already in the tree... */
+       LibBalsaMailboxView *view;
+       BalsaMailboxNode *special =
+           remove_special_mailbox_by_url(url, &isi->special);
+       if (special) {
             mailbox = special->mailbox;
             g_object_ref(mailbox);
             g_object_unref(special);
-        } else {
+       } else {
             balsa_mblist_mailbox_node_remove(mbnode);
         }
         /* Unreffing mbnode may finalize it, which would push the
@@ -1469,7 +1320,7 @@ imap_scan_create_mbnode(BalsaMailboxNode *root,
          * retrieve the view from the config, and restore it after
          * unreffing. */
         view = config_load_mailbox_view(url);
-        g_object_unref(mbnode);
+       g_object_unref(mbnode);
         config_save_mailbox_view(url, view);
         libbalsa_mailbox_view_free(view);
     }
@@ -1479,18 +1330,17 @@ imap_scan_create_mbnode(BalsaMailboxNode *root,
     parent = balsa_find_dir(root->server, parent_name);
     if (parent == NULL) {
         parent = root;
-        g_object_ref(parent);
+       g_object_ref(parent);
     }
     g_free(parent_name);
 
     mbnode = balsa_mailbox_node_new_imap_node(root->server, isi->fn);
     mbnode->mailbox = mailbox;
     basename = strrchr(isi->fn, delim);
-    if (!basename) {
+    if (!basename)
         basename = isi->fn;
-    } else {
+    else
         basename++;
-    }
     mbnode->name = g_strdup(basename);
     mbnode->delim = delim;
     mbnode->parent = parent;
@@ -1499,21 +1349,16 @@ imap_scan_create_mbnode(BalsaMailboxNode *root,
 
     balsa_mblist_mailbox_node_append(mbnode->parent, mbnode);
     g_object_unref(parent);
-
+    
     return mbnode;
 }
 
-
 /* handle_imap_path:
    add given mailbox unless its base name begins on dot.
- */
+*/
 static void
-add_imap_entry(const char *fn,
-               char        delim,
-               gboolean    noscan,
-               gboolean    selectable,
-               gboolean    marked,
-               void       *data)
+add_imap_entry(const char *fn, char delim, gboolean noscan,
+              gboolean selectable, gboolean marked, void *data)
 {
     imap_scan_tree *tree = (imap_scan_tree *) data;
     imap_scan_item *item = g_new0(imap_scan_item, 1);
@@ -1523,14 +1368,12 @@ add_imap_entry(const char *fn,
     item->marked = marked;
 
     tree->list = g_slist_prepend(tree->list, item);
-    if (delim) { /* some servers may set delim to NIL for some mailboxes */
+    if(delim)  /* some servers may set delim to NIL for some mailboxes */
         tree->delim = delim;
-    }
 }
 
-
 static void
-imap_scan_destroy_tree(imap_scan_tree *tree)
+imap_scan_destroy_tree(imap_scan_tree * tree)
 {
     GSList *list;
 
@@ -1544,34 +1387,26 @@ imap_scan_destroy_tree(imap_scan_tree *tree)
     g_slist_free(tree->list);
 }
 
-
 static void
-handle_imap_path(const char *fn,
-                 char        delim,
-                 int         noselect,
-                 int         noscan,
-                 int         marked,
-                 void       *data)
+handle_imap_path(const char *fn, char delim, int noselect, int noscan,
+                int marked, void *data)
 {
     if (!noselect) {
-        const gchar *basename = strrchr(fn, delim);
-        if (basename && (*++basename == '.') && (delim != '.')) {
-            /* ignore mailboxes that begin with a dot */
-            return;
-        }
-    }
-    if (balsa_app.debug) {
-        printf("handle_imap_path: Adding mailbox of path “%s” "
-               "delim `%c' noselect %d noscan %d\n",
-               fn, delim, noselect, noscan);
-    }
+       const gchar *basename = strrchr(fn, delim);
+       if (basename && *++basename == '.' && delim != '.')
+           /* ignore mailboxes that begin with a dot */
+           return;
+    }
+    if (balsa_app.debug)
+       printf("handle_imap_path: Adding mailbox of path “%s” "
+              "delim `%c' noselect %d noscan %d\n",
+              fn, delim, noselect, noscan);
     add_imap_entry(fn, delim, noscan, !noselect, marked, data);
 }
 
-
 /*
  * check_imap_path: Check an imap path to see whether we need to scan it.
- *
+ * 
  * server:      LibBalsaServer for the folders;
  * fn:          folder name;
  * depth:       depth of the current scan;
@@ -1580,45 +1415,38 @@ handle_imap_path(const char *fn,
  */
 
 static gint
-check_imap_path(const gchar    *fn,
-                LibBalsaServer *server,
-                guint           depth)
+check_imap_path(const gchar *fn, LibBalsaServer * server, guint depth)
 {
     CheckPathInfo cpi;
 
-    if (depth < balsa_app.imap_scan_depth) {
+    if (depth < balsa_app.imap_scan_depth)
         return TRUE;
-    }
 
     cpi.url = libbalsa_imap_url(server, fn);
     cpi.must_scan = FALSE;
     libbalsa_conf_foreach_group(VIEW_BY_URL_SECTION_PREFIX,
                                 (LibBalsaConfForeachFunc) check_url_func,
                                 &cpi);
-    if (balsa_app.debug) {
-        printf("check_imap_path: path “%s” must_scan %d.\n",
+    if(balsa_app.debug) 
+       printf("check_imap_path: path “%s” must_scan %d.\n",
                cpi.url, cpi.must_scan);
-    }
     g_free(cpi.url);
 
     return cpi.must_scan;
 }
 
-
 /* mark_imap_path:
  *
  * find the imap_scan_item for fn and set scanned.
  */
 static void
-mark_imap_path(const gchar *fn,
-               gpointer     data)
+mark_imap_path(const gchar * fn, gpointer data)
 {
     imap_scan_tree *tree = data;
     GSList *list;
 
-    if (balsa_app.debug) {
-        printf("mark_imap_path: find path “%s”.\n", fn);
-    }
+    if(balsa_app.debug) 
+       printf("mark_imap_path: find path “%s”.\n", fn);
     for (list = tree->list; list; list = list->next) {
         imap_scan_item *item = list->data;
         if (!strcmp(item->fn, fn)) {
@@ -1626,7 +1454,6 @@ mark_imap_path(const gchar *fn,
             break;
         }
     }
-    if (!list && balsa_app.debug) {
-        printf(" not found.\n");
-    }
+    if (!list && balsa_app.debug)
+       printf(" not found.\n");
 }
diff --git a/src/mailbox-node.h b/src/mailbox-node.h
index 0a2fb77..20e8b2b 100644
--- a/src/mailbox-node.h
+++ b/src/mailbox-node.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -26,36 +26,36 @@
 #define BALSA_TYPE_MAILBOX_NODE          (balsa_mailbox_node_get_type ())
 #define BALSA_MAILBOX_NODE(obj) \
     G_TYPE_CHECK_INSTANCE_CAST(obj, BALSA_TYPE_MAILBOX_NODE, \
-                               BalsaMailboxNode)
+                                BalsaMailboxNode)
 #define BALSA_MAILBOX_NODE_CLASS(klass) \
     G_TYPE_CHECK_CLASS_CAST(klass, BALSA_TYPE_MAILBOX_NODE, \
-                            BalsaMailboxNodeClass)
+                             BalsaMailboxNodeClass)
 #define BALSA_IS_MAILBOX_NODE(obj) \
     G_TYPE_CHECK_INSTANCE_TYPE(obj, BALSA_TYPE_MAILBOX_NODE)
 #define BALSA_IS_MAILBOX_NODE_CLASS(klass) \
     G_TYPE_CHECK_CLASS_TYPE(klass, BALSA_TYPE_MAILBOX_NODE)
-
+    
 typedef struct _BalsaMailboxNode BalsaMailboxNode;
 typedef struct _BalsaMailboxNodeClass BalsaMailboxNodeClass;
 
-/* BalsaMailboxNodeStyle
+/* BalsaMailboxNodeStyle 
  * used to store the style of mailbox entry in the mailbox tree.
  * Currently only MBNODE_STYLE_NEW_MAIL is really used, but
  * the others may be used later for more efficient style handling.
- *
+ * 
  * MBNODE_STYLE_NEW_MAIL: Whether the full mailbox icon is displayed
  *      (also when font is bolded)
- * MBNODE_STYLE_UNREAD_MESSAGES: Whether the number of unread messages
+ * MBNODE_STYLE_UNREAD_MESSAGES: Whether the number of unread messages 
  *      is being displayed in the maibox list
- * MBNODE_STYLE_TOTAL_MESSAGES: Whether the number of total messages
+ * MBNODE_STYLE_TOTAL_MESSAGES: Whether the number of total messages 
  *      is being displayed in the mailbox list
- *
+ * 
  * */
 typedef enum {
     MBNODE_STYLE_NEW_MAIL = 1 << 1,
-        MBNODE_STYLE_UNREAD_MESSAGES = 1 << 2,
-        MBNODE_STYLE_TOTAL_MESSAGES = 1 << 3,
-        MBNODE_STYLE_UNREAD_CHILD = 1 << 4
+    MBNODE_STYLE_UNREAD_MESSAGES = 1 << 2,
+    MBNODE_STYLE_TOTAL_MESSAGES = 1 << 3,
+    MBNODE_STYLE_UNREAD_CHILD = 1 << 4
 } BalsaMailboxNodeStyle;
 
 struct _BalsaMailboxNode {
@@ -66,56 +66,49 @@ struct _BalsaMailboxNode {
     time_t last_use;   /* for closing least recently used mailboxes */
     BalsaMailboxNodeStyle style;
     /* folder data */
-    gchar *config_prefix;
-    gchar *dir;
-    LibBalsaServer *server;  /* Used only by remote; is referenced */
+    gchar* config_prefix;
+    gchar* dir;      
+    LibBalsaServer * server; /* Used only by remote; is referenced */
     char delim; /* IMAP delimiter so that we do not need to check it
-                 * too often. */
+                * too often. */
 
-    unsigned subscribed : 1;     /* Used only by remote */
-    unsigned list_inbox : 1;     /* Used only by remote */
-    unsigned scanned : 1;        /* IMAP flag */
+    unsigned subscribed:1;     /* Used only by remote */
+    unsigned list_inbox:1;     /* Used only by remote */
+    unsigned scanned:1;        /* IMAP flag */
 };
 
 struct _BalsaMailboxNodeClass {
     GObjectClass parent_class;
-    void (*save_config) (BalsaMailboxNode *mn,
-                         const gchar      *prefix);
-    void (*load_config) (BalsaMailboxNode *mn,
-                         const gchar      *prefix);
-    GtkWidget * (*show_prop_dialog) (BalsaMailboxNode *mn);
-    void (*append_subtree) (BalsaMailboxNode *mn);
+    void (*save_config) (BalsaMailboxNode * mn, const gchar * prefix);
+    void (*load_config) (BalsaMailboxNode * mn, const gchar * prefix);
+    GtkWidget* (*show_prop_dialog) (BalsaMailboxNode * mn);
+    void (*append_subtree) (BalsaMailboxNode * mn);
 };
 
 GType balsa_mailbox_node_get_type(void);
 
 BalsaMailboxNode *balsa_mailbox_node_new(void);
 BalsaMailboxNode *balsa_mailbox_node_new_from_mailbox(LibBalsaMailbox *m);
-BalsaMailboxNode *balsa_mailbox_node_new_from_dir(const gchar *dir);
-BalsaMailboxNode *balsa_mailbox_node_new_imap(LibBalsaServer *s,
-                                              const char     *p);
-BalsaMailboxNode *balsa_mailbox_node_new_imap_folder(LibBalsaServer *s,
-                                                     const char     *p);
-BalsaMailboxNode *balsa_mailbox_node_new_from_config(const gchar *prefix);
+BalsaMailboxNode *balsa_mailbox_node_new_from_dir(const gchar* dir);
+BalsaMailboxNode *balsa_mailbox_node_new_imap(LibBalsaServer* s, const char*p);
+BalsaMailboxNode *balsa_mailbox_node_new_imap_folder(LibBalsaServer* s, 
+                                                    const char*p);
+BalsaMailboxNode *balsa_mailbox_node_new_from_config(const gchar* prefix);
 
-GtkWidget *balsa_mailbox_node_get_context_menu(BalsaMailboxNode *mbnode);
-void balsa_mailbox_node_show_prop_dialog(BalsaMailboxNode *mbnode);
-void balsa_mailbox_node_append_subtree(BalsaMailboxNode *mbnode);
-void balsa_mailbox_node_load_config(BalsaMailboxNode *mn,
-                                    const gchar      *prefix);
-void balsa_mailbox_node_save_config(BalsaMailboxNode *mn,
-                                    const gchar      *prefix);
-void balsa_mailbox_node_show_prop_dialog_cb(GtkWidget *widget,
-                                            gpointer   data);
+GtkWidget *balsa_mailbox_node_get_context_menu(BalsaMailboxNode * mbnode);
+void balsa_mailbox_node_show_prop_dialog(BalsaMailboxNode * mbnode);
+void balsa_mailbox_node_append_subtree(BalsaMailboxNode * mbnode);
+void balsa_mailbox_node_load_config(BalsaMailboxNode* mn, const gchar* prefix);
+void balsa_mailbox_node_save_config(BalsaMailboxNode* mn, const gchar* prefix);
+void balsa_mailbox_node_show_prop_dialog_cb(GtkWidget * widget, gpointer data);
 
 /* applicable only to local mailboxes (mailbox collections) */
-void balsa_mailbox_local_append(LibBalsaMailbox *mbx);
-
+void balsa_mailbox_local_append(LibBalsaMailbox* mbx);
 /* applicable only to folders (mailbox collections) */
-void balsa_mailbox_node_rescan(BalsaMailboxNode *mn);
-void balsa_mailbox_node_clear_children_cache(BalsaMailboxNode *mbnode);
+void balsa_mailbox_node_rescan(BalsaMailboxNode* mn);
+void balsa_mailbox_node_clear_children_cache(BalsaMailboxNode * mbnode);
 
 /* applicable to any mailbox node */
-void balsa_mailbox_node_scan_children(BalsaMailboxNode *mbnode);
+void balsa_mailbox_node_scan_children(BalsaMailboxNode * mbnode);
 
 #endif
diff --git a/src/main-window.c b/src/main-window.c
index b1b1737..6c0ef62 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -26,7 +26,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "main-window.h"
 
@@ -44,8 +44,8 @@
 #include <glib/gi18n.h>
 
 #if HAVE_MACOSX_DESKTOP
-#   include <ige-mac-integration.h>
-#   include "macosx-helpers.h"
+#  include <ige-mac-integration.h>
+#  include "macosx-helpers.h"
 #endif
 
 #include <gio/gio.h>
@@ -84,7 +84,7 @@ enum {
 };
 
 #define NUM_DROP_TYPES 1
-static const gchar *notebook_drop_types[NUM_DROP_TYPES] = {
+static const gchar * notebook_drop_types[NUM_DROP_TYPES] = {
     "x-application/x-message-list"
 };
 
@@ -100,100 +100,84 @@ struct check_messages_thread_info {
 static void bw_check_messages_thread(struct check_messages_thread_info
                                      *info);
 
-static void bw_display_new_mail_notification(int num_new,
-                                             int has_new);
+static void bw_display_new_mail_notification(int num_new, int has_new);
 
-static void balsa_window_class_init(BalsaWindowClass *klass);
-static void balsa_window_init(BalsaWindow *window);
-static void balsa_window_real_open_mbnode(BalsaWindow      *window,
+static void balsa_window_class_init(BalsaWindowClass * klass);
+static void balsa_window_init(BalsaWindow * window);
+static void balsa_window_real_open_mbnode(BalsaWindow *window,
                                           BalsaMailboxNode *mbnode,
-                                          gboolean          set_current);
-static void balsa_window_real_close_mbnode(BalsaWindow      *window,
-                                           BalsaMailboxNode *mbnode);
-static void balsa_window_dispose(GObject *object);
-
-static gboolean bw_close_mailbox_on_timer(BalsaWindow *window);
-
-static void bw_index_changed_cb(GtkWidget *widget,
-                                gpointer   data);
-static void bw_idle_replace(BalsaWindow *window,
-                            BalsaIndex  *bindex);
-static void bw_idle_remove(BalsaWindow *window);
-static gboolean bw_idle_cb(BalsaWindow *window);
-
-
-static void bw_check_mailbox_list(struct check_messages_thread_info *info,
-                                  GList                             *list);
-static gboolean bw_add_mbox_to_checklist(GtkTreeModel *model,
-                                         GtkTreePath  *path,
-                                         GtkTreeIter  *iter,
-                                         GSList      **list);
-static gboolean bw_imap_check_test(const gchar *path);
-
-static void bw_enable_mailbox_menus(BalsaWindow *window,
-                                    BalsaIndex  *index);
-static void bw_enable_message_menus(BalsaWindow *window,
-                                    guint        msgno);
-static void bw_enable_expand_collapse(BalsaWindow     *window,
-                                      LibBalsaMailbox *mailbox);
-
+                                          gboolean set_current);
+static void balsa_window_real_close_mbnode(BalsaWindow *window,
+                                          BalsaMailboxNode *mbnode);
+static void balsa_window_dispose(GObject * object);
+
+static gboolean bw_close_mailbox_on_timer(BalsaWindow * window);
+
+static void bw_index_changed_cb(GtkWidget * widget, gpointer data);
+static void bw_idle_replace(BalsaWindow * window, BalsaIndex * bindex);
+static void bw_idle_remove(BalsaWindow * window);
+static gboolean bw_idle_cb(BalsaWindow * window);
+
+
+static void bw_check_mailbox_list(struct check_messages_thread_info *info, GList * list);
+static gboolean bw_add_mbox_to_checklist(GtkTreeModel * model,
+                                         GtkTreePath * path,
+                                         GtkTreeIter * iter,
+                                         GSList ** list);
+static gboolean bw_imap_check_test(const gchar * path);
+
+static void bw_enable_mailbox_menus(BalsaWindow * window, BalsaIndex * index);
+static void bw_enable_message_menus(BalsaWindow * window, guint msgno);
+static void bw_enable_expand_collapse(BalsaWindow * window,
+                                      LibBalsaMailbox * mailbox);
 #ifdef HAVE_HTML_WIDGET
-static void bw_enable_view_menus(BalsaWindow  *window,
-                                 BalsaMessage *bm);
-
-#endif                          /* HAVE_HTML_WIDGET */
+static void bw_enable_view_menus(BalsaWindow * window, BalsaMessage * bm);
+#endif                         /* HAVE_HTML_WIDGET */
 static void bw_register_open_mailbox(LibBalsaMailbox *m);
 static void bw_unregister_open_mailbox(LibBalsaMailbox *m);
 static gboolean bw_is_open_mailbox(LibBalsaMailbox *m);
 
-static void bw_mailbox_tab_close_cb(GtkWidget *widget,
-                                    gpointer   data);
-
-static void bw_set_threading_menu(BalsaWindow *window,
-                                  int          option);
-static void bw_show_mbtree(BalsaWindow *window);
-static void bw_set_filter_menu(BalsaWindow *window,
-                               int          gui_filter);
-static LibBalsaCondition *bw_get_view_filter(BalsaWindow *window);
-
-static void bw_select_part_cb(BalsaMessage *bm,
-                              gpointer      data);
-
-static void bw_find_real(BalsaWindow *window,
-                         BalsaIndex  *bindex,
-                         gboolean     again);
-
-static void bw_slave_position_cb(GtkPaned   *paned_slave,
-                                 GParamSpec *pspec,
-                                 gpointer    user_data);
-static void bw_size_allocate_cb(GtkWidget *window);
-
-static void bw_notebook_switch_page_cb(GtkWidget *notebook,
-                                       void      *page,
-                                       guint      page_num,
-                                       gpointer   data);
-static void bw_send_msg_window_destroy_cb(GtkWidget *widget,
-                                          gpointer   data);
-static BalsaIndex *bw_notebook_find_page(GtkNotebook *notebook,
-                                         gint         x,
-                                         gint         y);
-static void bw_notebook_drag_received_cb(GtkWidget        *widget,
-                                         GdkDragContext   *context,
-                                         gint              x,
-                                         gint              y,
-                                         GtkSelectionData *selection_data,
-                                         guint32           time,
-                                         gpointer          data);
-static gboolean bw_notebook_drag_motion_cb(GtkWidget      *widget,
-                                           GdkDragContext *context,
-                                           gint            x,
-                                           gint            y,
-                                           guint           time,
-                                           gpointer        user_data);
-
-
-static GtkWidget *bw_notebook_label_new(BalsaMailboxNode *mbnode);
-static void bw_reset_filter(BalsaWindow *bw);
+static void bw_mailbox_tab_close_cb(GtkWidget * widget, gpointer data);
+
+static void bw_set_threading_menu(BalsaWindow * window, int option);
+static void bw_show_mbtree(BalsaWindow * window);
+static void bw_set_filter_menu(BalsaWindow * window, int gui_filter);
+static LibBalsaCondition *bw_get_view_filter(BalsaWindow * window);
+
+static void bw_select_part_cb(BalsaMessage * bm, gpointer data);
+
+static void bw_find_real(BalsaWindow * window, BalsaIndex * bindex,
+                         gboolean again);
+
+static void bw_slave_position_cb(GtkPaned   * paned_slave,
+                                 GParamSpec * pspec,
+                                 gpointer     user_data);
+static void bw_size_allocate_cb(GtkWidget * window);
+
+static void bw_notebook_switch_page_cb(GtkWidget * notebook,
+                                       void * page,
+                                       guint page_num,
+                                       gpointer data);
+static void bw_send_msg_window_destroy_cb(GtkWidget * widget, gpointer data);
+static BalsaIndex *bw_notebook_find_page(GtkNotebook * notebook,
+                                         gint x, gint y);
+static void bw_notebook_drag_received_cb(GtkWidget        * widget,
+                                         GdkDragContext   * context,
+                                         gint               x,
+                                         gint               y,
+                                         GtkSelectionData * selection_data,
+                                         guint32            time,
+                                         gpointer           data);
+static gboolean bw_notebook_drag_motion_cb(GtkWidget      * widget,
+                                           GdkDragContext * context,
+                                           gint             x,
+                                           gint             y,
+                                           guint            time,
+                                           gpointer         user_data);
+
+
+static GtkWidget *bw_notebook_label_new (BalsaMailboxNode* mbnode);
+static void bw_reset_filter(BalsaWindow * bw);
 
 
 /* ===================================================================
@@ -201,19 +185,17 @@ static void bw_reset_filter(BalsaWindow *bw);
    overlap very much with the default balsa menus. They are here
    because they represent an alternative probably appealing to the all
    proponents of GNOME2 dumbify approach (OK, I am bit unfair here).
- */
+*/
 
 G_DEFINE_TYPE (BalsaWindow, balsa_window, GTK_TYPE_APPLICATION_WINDOW)
 
-static guint window_signals[LAST_SIGNAL] = {
-    0
-};
+static guint window_signals[LAST_SIGNAL] = { 0 };
 
 /* note: access with g_atomic_* functions, not checking mail when 1 */
 static gint checking_mail = 1;
 
 static void
-balsa_window_class_init(BalsaWindowClass *klass)
+balsa_window_class_init(BalsaWindowClass * klass)
 {
     GObjectClass *object_class = (GObjectClass *) klass;
 
@@ -227,16 +209,14 @@ balsa_window_class_init(BalsaWindowClass *klass)
 
     object_class->dispose = balsa_window_dispose;
 
-    klass->open_mbnode = balsa_window_real_open_mbnode;
+    klass->open_mbnode  = balsa_window_real_open_mbnode;
     klass->close_mbnode = balsa_window_real_close_mbnode;
 
     /* Signals */
     klass->identities_changed = NULL;
 }
 
-
 static gboolean bw_change_connection_status_idle(gpointer data);
-
 static void
 print_network_status(gboolean available)
 {
@@ -253,11 +233,10 @@ print_network_status(gboolean available)
     g_free(datetime_string);
 }
 
-
 static void
-bw_network_changed_cb(GNetworkMonitor *monitor,
-                      gboolean         available,
-                      gpointer         user_data)
+bw_network_changed_cb(GNetworkMonitor * monitor,
+                      gboolean          available,
+                      gpointer          user_data)
 {
     BalsaWindow *window = user_data;
 
@@ -273,9 +252,8 @@ bw_network_changed_cb(GNetworkMonitor *monitor,
     }
 }
 
-
 static void
-balsa_window_init(BalsaWindow *window)
+balsa_window_init(BalsaWindow * window)
 {
     GNetworkMonitor *monitor;
 
@@ -288,15 +266,14 @@ balsa_window_init(BalsaWindow *window)
     window->last_check_time = 0;
 }
 
-
 static gboolean
-bw_close_request_cb(GtkWidget *main_window)
+bw_close_request_cb(GtkWidget * main_window)
 {
     /* we cannot leave main window disabled because compose windows
      * (for example) could refuse to get deleted and we would be left
      * with disabled main window. */
-    if (libbalsa_is_sending_mail()) {
-        GtkWidget *d =
+    if(libbalsa_is_sending_mail()) {
+        GtkWidget* d =
             gtk_message_dialog_new(GTK_WINDOW(main_window),
                                    GTK_DIALOG_MODAL,
                                    GTK_MESSAGE_QUESTION,
@@ -312,48 +289,38 @@ bw_close_request_cb(GtkWidget *main_window)
     return FALSE; /* allow delete */
 }
 
-
 static void
-bw_master_position_cb(GtkPaned   *paned_master,
-                      GParamSpec *pspec,
-                      gpointer    user_data)
+bw_master_position_cb(GtkPaned   * paned_master,
+                      GParamSpec * pspec,
+                      gpointer     user_data)
 {
-    if (balsa_app.show_mblist) {
+    if (balsa_app.show_mblist)
         balsa_app.mblist_width = /* FIXME: this makes some assumptions... */
             gtk_paned_get_position(paned_master);
-    }
 }
 
-
 static GtkWidget *
-bw_frame(GtkWidget *widget)
+bw_frame(GtkWidget * widget)
 {
     GtkWidget *frame = gtk_frame_new(NULL);
     gtk_container_add(GTK_CONTAINER(frame), widget);
     return frame;
 }
-
-
 /* Filter entry widget creation code. We must carefully pass the typed
    characters FIRST to the entry widget and only if the widget did not
    process them, pass them further to main window, menu etc.
    Otherwise, typing eg. 'c' would open the draftbox instead of
    actually insert the 'c' character in the entry. */
 static gboolean
-bw_pass_to_filter(BalsaWindow *bw,
-                  GdkEventKey *event,
-                  gpointer     data)
+bw_pass_to_filter(BalsaWindow *bw, GdkEventKey *event, gpointer data)
 {
     gboolean res = FALSE;
     g_signal_emit_by_name(bw->sos_entry, "key_press_event", event, &res, data);
     return res;
 }
 
-
 static void
-bw_check_filter(GtkWidget  *widget,
-                GParamSpec *pspec,
-                gpointer    data)
+bw_check_filter(GtkWidget *widget, GParamSpec *pspec, gpointer data)
 {
     BalsaWindow *window = data;
 
@@ -367,18 +334,14 @@ bw_check_filter(GtkWidget  *widget,
     }
 }
 
-
 static void
-bw_set_view_filter(BalsaWindow *bw,
-                   gint         filter_no,
-                   GtkWidget   *entry)
+bw_set_view_filter(BalsaWindow * bw, gint filter_no, GtkWidget * entry)
 {
     GtkWidget *index = balsa_window_find_current_index(bw);
     LibBalsaCondition *view_filter;
 
-    if (!index) {
+    if (!index)
         return;
-    }
 
     view_filter = bw_get_view_filter(bw);
     balsa_index_set_view_filter(BALSA_INDEX(index), filter_no,
@@ -387,10 +350,8 @@ bw_set_view_filter(BalsaWindow *bw,
     libbalsa_condition_unref(view_filter);
 }
 
-
 static void
-bw_filter_entry_activate(GtkWidget *entry,
-                         GtkWidget *button)
+bw_filter_entry_activate(GtkWidget * entry, GtkWidget * button)
 {
     BalsaWindow *bw = balsa_app.main_window;
     int filter_no =
@@ -400,27 +361,22 @@ bw_filter_entry_activate(GtkWidget *entry,
     gtk_widget_set_sensitive(button, FALSE);
 }
 
-
 static void
-bw_filter_entry_changed(GtkWidget *entry,
-                        GtkWidget *button)
+bw_filter_entry_changed(GtkWidget *entry, GtkWidget *button)
 {
     gtk_widget_set_sensitive(button, TRUE);
 }
 
-
 /* FIXME: there should be a more compact way of creating condition
    trees than via calling special routines... */
 
 static LibBalsaCondition *
-bw_filter_sos_or_sor(const char        *str,
-                     ConditionMatchType field)
+bw_filter_sos_or_sor(const char *str, ConditionMatchType field)
 {
     LibBalsaCondition *subject, *address, *retval;
 
-    if (!(str && *str)) {
+    if (!(str && *str))
         return NULL;
-    }
 
     subject =
         libbalsa_condition_new_string(FALSE, CONDITION_MATCH_SUBJECT,
@@ -436,93 +392,80 @@ bw_filter_sos_or_sor(const char        *str,
     return retval;
 }
 
-
 static LibBalsaCondition *
 bw_filter_sos(const char *str)
 {
-    return bw_filter_sos_or_sor(str, CONDITION_MATCH_FROM);
+    return  bw_filter_sos_or_sor(str, CONDITION_MATCH_FROM);
 }
 
-
 static LibBalsaCondition *
 bw_filter_sor(const char *str)
 {
-    return bw_filter_sos_or_sor(str, CONDITION_MATCH_TO);
+    return  bw_filter_sos_or_sor(str, CONDITION_MATCH_TO);
 }
 
-
 static LibBalsaCondition *
 bw_filter_s(const char *str)
 {
     return (str && *str) ?
-           libbalsa_condition_new_string
-               (FALSE, CONDITION_MATCH_SUBJECT, g_strdup(str), NULL)
-           : NULL;
+        libbalsa_condition_new_string
+        (FALSE, CONDITION_MATCH_SUBJECT, g_strdup(str), NULL)
+        : NULL;
 }
-
-
 static LibBalsaCondition *
 bw_filter_body(const char *str)
 {
     return (str && *str) ?
-           libbalsa_condition_new_string
-               (FALSE, CONDITION_MATCH_BODY, g_strdup(str), NULL)
-           : NULL;
+        libbalsa_condition_new_string
+        (FALSE, CONDITION_MATCH_BODY, g_strdup(str), NULL)
+        : NULL;
 }
 
-
 static LibBalsaCondition *
 bw_filter_old(const char *str)
 {
     int days;
-    if (str && (sscanf(str, "%10d", &days) == 1)) {
-        time_t upperbound = time(NULL) - (days - 1) * 24 * 3600;
+    if(str && sscanf(str, "%10d", &days) == 1) {
+        time_t upperbound = time(NULL)-(days-1)*24*3600;
         return libbalsa_condition_new_date(FALSE, NULL, &upperbound);
-    } else {
-        return NULL;
-    }
+    } else return NULL;
 }
 
-
 static LibBalsaCondition *
 bw_filter_recent(const char *str)
 {
     int days;
-    if (str && (sscanf(str, "%10d", &days) == 1)) {
-        time_t lowerbound = time(NULL) - (days - 1) * 24 * 3600;
+    if(str && sscanf(str, "%10d", &days) == 1) {
+        time_t lowerbound = time(NULL)-(days-1)*24*3600;
         return libbalsa_condition_new_date(FALSE, &lowerbound, NULL);
-    } else {
-        return NULL;
-    }
+    } else return NULL;
 }
 
-
 /* Subject or sender must match FILTER_SENDER, and Subject or
    Recipient must match FILTER_RECIPIENT constant. */
 static struct {
     char *str;
     LibBalsaCondition *(*filter)(const char *str);
 } view_filters[] = {
-    { N_("Subject or Sender Contains:"), bw_filter_sos  },
+    { N_("Subject or Sender Contains:"),    bw_filter_sos  },
     { N_("Subject or Recipient Contains:"), bw_filter_sor  },
-    { N_("Subject Contains:"), bw_filter_s    },
-    { N_("Body Contains:"), bw_filter_body },
-    { N_("Older than (days):"), bw_filter_old  },
-    { N_("Old at most (days):"), bw_filter_recent }
+    { N_("Subject Contains:"),              bw_filter_s    },
+    { N_("Body Contains:"),                 bw_filter_body },
+    { N_("Older than (days):"),             bw_filter_old  },
+    { N_("Old at most (days):"),            bw_filter_recent }
 };
 static gboolean view_filters_translated = FALSE;
 
-static GtkWidget *
+static GtkWidget*
 bw_create_index_widget(BalsaWindow *bw)
 {
     GtkWidget *vbox, *button;
     unsigned i;
     GList *focusable_widgets;
 
-    if (!view_filters_translated) {
-        for (i = 0; i < G_N_ELEMENTS(view_filters); i++) {
+    if(!view_filters_translated) {
+        for(i=0; i<G_N_ELEMENTS(view_filters); i++)
             view_filters[i].str = _(view_filters[i].str);
-        }
         view_filters_translated = TRUE;
     }
 
@@ -530,10 +473,9 @@ bw_create_index_widget(BalsaWindow *bw)
 
     bw->filter_choice = gtk_combo_box_text_new();
     gtk_box_pack_start(GTK_BOX(bw->sos_bar), bw->filter_choice);
-    for (i = 0; i < G_N_ELEMENTS(view_filters); i++) {
+    for(i=0; i<G_N_ELEMENTS(view_filters); i++)
         gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(bw->filter_choice),
                                        i, view_filters[i].str);
-    }
     gtk_combo_box_set_active(GTK_COMBO_BOX(bw->filter_choice), 0);
     bw->sos_entry = gtk_entry_new();
     /* gtk_label_set_mnemonic_widget(GTK_LABEL(bw->filter_choice),
@@ -551,8 +493,8 @@ bw_create_index_widget(BalsaWindow *bw)
                              G_CALLBACK(bw_filter_entry_activate),
                              bw->sos_entry);
     g_signal_connect(G_OBJECT(bw->sos_entry), "changed",
-                     G_CALLBACK(bw_filter_entry_changed),
-                     button);
+                             G_CALLBACK(bw_filter_entry_changed),
+                             button);
     g_signal_connect(G_OBJECT(bw->filter_choice), "changed",
                      G_CALLBACK(bw_filter_entry_changed), button);
     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
@@ -569,9 +511,8 @@ bw_create_index_widget(BalsaWindow *bw)
     return vbox;
 }
 
-
 static void
-bw_set_panes(BalsaWindow *window)
+bw_set_panes(BalsaWindow * window)
 {
     GtkWidget *index_widget = bw_create_index_widget(window);
     GtkWidget *bindex;
@@ -579,113 +520,106 @@ bw_set_panes(BalsaWindow *window)
 
     switch (balsa_app.layout_type) {
     case LAYOUT_WIDE_MSG:
-        window->paned_master = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
-        window->paned_slave = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
-        if (window->content) {
+       window->paned_master = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
+       window->paned_slave  = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
+        if (window->content)
             gtk_container_remove(GTK_CONTAINER(window->vbox),
                                  window->content);
-        }
         window->content = window->paned_master;
         gtk_widget_set_vexpand(window->content, TRUE);
         gtk_box_pack_start(GTK_BOX(window->vbox), window->content);
-        gtk_paned_pack1(GTK_PANED(window->paned_slave),
-                        bw_frame(window->mblist), TRUE, TRUE);
+       gtk_paned_pack1(GTK_PANED(window->paned_slave),
+                       bw_frame(window->mblist), TRUE, TRUE);
         gtk_paned_pack2(GTK_PANED(window->paned_slave),
-                        bw_frame(index_widget), TRUE, TRUE);
+                       bw_frame(index_widget), TRUE, TRUE);
         gtk_paned_pack1(GTK_PANED(window->paned_master),
-                        window->paned_slave, TRUE, TRUE);
-        gtk_paned_pack2(GTK_PANED(window->paned_master),
-                        bw_frame(window->preview), TRUE, TRUE);
+                       window->paned_slave, TRUE, TRUE);
+       gtk_paned_pack2(GTK_PANED(window->paned_master),
+                       bw_frame(window->preview), TRUE, TRUE);
         width_preference = BALSA_INDEX_WIDE;
-        break;
-
+       break;
     case LAYOUT_WIDE_SCREEN:
-        window->paned_master = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
-        window->paned_slave = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
-        if (window->content) {
+       window->paned_master = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
+       window->paned_slave  = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
+        if (window->content)
             gtk_container_remove(GTK_CONTAINER(window->vbox),
                                  window->content);
-        }
         window->content = window->paned_master;
         gtk_widget_set_vexpand(window->content, TRUE);
         gtk_box_pack_start(GTK_BOX(window->vbox), window->content);
-        gtk_paned_pack1(GTK_PANED(window->paned_master),
+       gtk_paned_pack1(GTK_PANED(window->paned_master),
                         bw_frame(window->mblist), TRUE, TRUE);
         gtk_paned_pack2(GTK_PANED(window->paned_master), window->paned_slave,
                         TRUE, TRUE);
         gtk_paned_pack1(GTK_PANED(window->paned_slave),
                         bw_frame(index_widget), TRUE, FALSE);
-        gtk_paned_pack2(GTK_PANED(window->paned_slave),
+       gtk_paned_pack2(GTK_PANED(window->paned_slave),
                         bw_frame(window->preview), TRUE, TRUE);
         width_preference = BALSA_INDEX_NARROW;
-        break;
-
+       break;
     case LAYOUT_DEFAULT:
     default:
-        window->paned_master = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
-        window->paned_slave = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
-        if (window->content) {
+       window->paned_master = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
+       window->paned_slave  = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
+        if (window->content)
             gtk_container_remove(GTK_CONTAINER(window->vbox),
                                  window->content);
-        }
         window->content = window->paned_master;
         gtk_widget_set_vexpand(window->content, TRUE);
         gtk_box_pack_start(GTK_BOX(window->vbox), window->content);
-        gtk_paned_pack1(GTK_PANED(window->paned_master),
+       gtk_paned_pack1(GTK_PANED(window->paned_master),
                         bw_frame(window->mblist), TRUE, TRUE);
         gtk_paned_pack2(GTK_PANED(window->paned_master), window->paned_slave,
                         TRUE, TRUE);
         gtk_paned_pack1(GTK_PANED(window->paned_slave),
                         bw_frame(index_widget), TRUE, TRUE);
-        gtk_paned_pack2(GTK_PANED(window->paned_slave),
+       gtk_paned_pack2(GTK_PANED(window->paned_slave),
                         bw_frame(window->preview), TRUE, TRUE);
         width_preference = BALSA_INDEX_WIDE;
     }
-    if ((bindex = balsa_window_find_current_index(window)) != NULL) {
+    if ( (bindex=balsa_window_find_current_index(window)) != NULL)
         balsa_index_set_width_preference(BALSA_INDEX(bindex), width_preference);
-    }
 }
 
-
 /* Create the toolbar model for the main window's toolbar.
  */
 /* Standard buttons; "" means a separator. */
 static const BalsaToolbarEntry main_toolbar[] = {
-    { "get-new-mail", BALSA_PIXMAP_RECEIVE     },
+    { "get-new-mail",     BALSA_PIXMAP_RECEIVE     },
     { "", ""                                       },
-    { "move-to-trash", "edit-delete"             },
+    { "move-to-trash",   "edit-delete"             },
     { "", ""                                       },
-    { "new-message", BALSA_PIXMAP_COMPOSE     },
-    { "continue", BALSA_PIXMAP_CONTINUE    },
-    { "reply", BALSA_PIXMAP_REPLY       },
-    { "reply-all", BALSA_PIXMAP_REPLY_ALL   },
+    { "new-message",      BALSA_PIXMAP_COMPOSE     },
+    { "continue",         BALSA_PIXMAP_CONTINUE    },
+    { "reply",            BALSA_PIXMAP_REPLY       },
+    { "reply-all",        BALSA_PIXMAP_REPLY_ALL   },
     { "forward-attached", BALSA_PIXMAP_FORWARD     },
     { "", ""                                       },
-    { "next-unread", BALSA_PIXMAP_NEXT_UNREAD },
+    { "next-unread",      BALSA_PIXMAP_NEXT_UNREAD },
     { "", ""                                       },
-    { "print", "document-print"          }
+    { "print",           "document-print"          }
 };
 
 /* Optional extra buttons */
 static const BalsaToolbarEntry main_toolbar_extras[] = {
-    { "quit", "application-exit"          },
-    { "reply-group", BALSA_PIXMAP_REPLY_GROUP   },
-    { "previous-message", BALSA_PIXMAP_PREVIOUS      },
-    { "next-message", BALSA_PIXMAP_NEXT          },
-    { "next-flagged", BALSA_PIXMAP_NEXT_FLAGGED  },
-    { "previous-part", BALSA_PIXMAP_PREVIOUS_PART },
-    { "next-part", BALSA_PIXMAP_NEXT_PART     },
-    { "send-queued-mail", BALSA_PIXMAP_SEND_QUEUED   },
+    { "quit",              "application-exit"          },
+    { "reply-group",        BALSA_PIXMAP_REPLY_GROUP   },
+    { "previous-message",   BALSA_PIXMAP_PREVIOUS      },
+    { "next-message",       BALSA_PIXMAP_NEXT          },
+    { "next-flagged",       BALSA_PIXMAP_NEXT_FLAGGED  },
+    { "previous-part",      BALSA_PIXMAP_PREVIOUS_PART },
+    { "next-part",          BALSA_PIXMAP_NEXT_PART     },
+    { "send-queued-mail",   BALSA_PIXMAP_SEND_QUEUED   },
     { "send-and-receive-mail", BALSA_PIXMAP_SEND_RECEIVE  },
-    { "save-part", "document-save"             },
-    { "identities", BALSA_PIXMAP_IDENTITY      },
-    { "mailbox-close", "window-close-symbolic"     },
+    { "save-part",         "document-save"             },
+    { "identities",         BALSA_PIXMAP_IDENTITY      },
+    { "mailbox-close",     "window-close-symbolic"     },
     { "mailbox-select-all", BALSA_PIXMAP_MARK_ALL      },
-    { "show-all-headers", BALSA_PIXMAP_SHOW_HEADERS  },
-    { "reset-filter", "gtk-cancel"                },
-    { "show-preview-pane", BALSA_PIXMAP_SHOW_PREVIEW  },
-    { "mailbox-expunge", "edit-clear"                },
-    { "empty-trash", "list-remove"               }
+    { "show-all-headers",   BALSA_PIXMAP_SHOW_HEADERS  },
+    { "reset-filter",      "gtk-cancel"                },
+    { "show-preview-pane",  BALSA_PIXMAP_SHOW_PREVIEW  },
+    { "mailbox-expunge",   "edit-clear"                },
+    { "empty-trash",       "list-remove"               }
 };
 
 BalsaToolbarModel *
@@ -693,9 +627,8 @@ balsa_window_get_toolbar_model(void)
 {
     static BalsaToolbarModel *model = NULL;
 
-    if (model) {
+    if (model)
         return model;
-    }
 
     model =
         balsa_toolbar_model_new(BALSA_TOOLBAR_TYPE_MAIN_WINDOW,
@@ -707,25 +640,22 @@ balsa_window_get_toolbar_model(void)
     return model;
 }
 
-
 /*
  * "notify::is-maximized" signal handler
  */
 static void
-bw_notify_is_maximized_cb(GtkWindow  *window,
-                          GParamSpec *pspec,
-                          gpointer    user_data)
+bw_notify_is_maximized_cb(GtkWindow  * window,
+                          GParamSpec * pspec,
+                          gpointer     user_data)
 {
     /* Note when we are either maximized or fullscreen, to avoid saving
      * nonsensical geometry. */
     balsa_app.mw_maximized = gtk_window_is_maximized(window);
 }
 
-
 static void
-bw_is_active_notify(GObject    *gobject,
-                    GParamSpec *pspec,
-                    gpointer    user_data)
+bw_is_active_notify(GObject * gobject, GParamSpec * pspec,
+                    gpointer user_data)
 {
     GtkWindow *gtk_window = GTK_WINDOW(gobject);
 
@@ -733,15 +663,13 @@ bw_is_active_notify(GObject    *gobject,
 #ifdef HAVE_NOTIFY
         BalsaWindow *window = BALSA_WINDOW(gobject);
 
-        if (window->new_mail_note) {
+        if (window->new_mail_note)
             notify_notification_close(window->new_mail_note, NULL);
-        }
 #endif                          /* HAVE_NOTIFY */
         gtk_window_set_urgency_hint(gtk_window, FALSE);
     }
 }
 
-
 /*
  * GMenu stuff
  */
@@ -751,8 +679,8 @@ bw_is_active_notify(GObject    *gobject,
  */
 
 static GAction *
-bw_get_action(BalsaWindow *window,
-              const gchar *action_name)
+bw_get_action(BalsaWindow * window,
+              const gchar * action_name)
 {
     GActionMap *action_map;
     GAction *action;
@@ -764,34 +692,30 @@ bw_get_action(BalsaWindow *window,
             G_ACTION_MAP(gtk_window_get_application(GTK_WINDOW(window)));
         action = g_action_map_lookup_action(action_map, action_name);
     }
-    if (!action) {
+    if (!action)
         g_print("%s action “%s” not found\n", __func__, action_name);
-    }
 
     return action;
 }
 
-
 /*
  * Set and get the state of a toggle action
  */
 static void
-bw_action_set_boolean(BalsaWindow *window,
-                      const gchar *action_name,
-                      gboolean     state)
+bw_action_set_boolean(BalsaWindow * window,
+                      const gchar * action_name,
+                      gboolean      state)
 {
     GAction *action;
 
     action = bw_get_action(window, action_name);
-    if (action) {
+    if (action)
         g_action_change_state(action, g_variant_new_boolean(state));
-    }
 }
 
-
 static gboolean
-bw_action_get_boolean(BalsaWindow *window,
-                      const gchar *action_name)
+bw_action_get_boolean(BalsaWindow * window,
+                      const gchar * action_name)
 {
     GAction *action;
     gboolean retval = FALSE;
@@ -808,69 +732,61 @@ bw_action_get_boolean(BalsaWindow *window,
     return retval;
 }
 
-
 /*
  * Set the state of a radio action
  */
 
 static void
-bw_action_set_string(BalsaWindow *window,
-                     const gchar *action_name,
-                     const gchar *state)
+bw_action_set_string(BalsaWindow * window,
+                     const gchar * action_name,
+                     const gchar * state)
 {
     GAction *action;
 
     action = bw_get_action(window, action_name);
-    if (action) {
+    if (action)
         g_simple_action_set_state(G_SIMPLE_ACTION(action),
                                   g_variant_new_string(state));
-    }
 }
 
-
 /*
  * Enable or disable an action
  */
 
 static void
-bw_action_set_enabled(BalsaWindow *window,
-                      const gchar *action_name,
-                      gboolean     enabled)
+bw_action_set_enabled(BalsaWindow * window,
+                      const gchar * action_name,
+                      gboolean      enabled)
 {
     GAction *action;
 
     g_assert(window != NULL);
 
     /* Is the window being destroyed? */
-    if (window->preview == NULL) {
+    if (window->preview == NULL)
         return;
-    }
 
     action = bw_get_action(window, action_name);
-    if (action) {
+    if (action)
         g_simple_action_set_enabled(G_SIMPLE_ACTION(action), enabled);
-    }
 }
 
-
 /*
  * Enable or disable a group of actions
  */
 
 static void
-bw_actions_set_enabled(BalsaWindow        *window,
-                       const gchar *const *actions,
-                       guint               n_actions,
-                       gboolean            enabled)
+bw_actions_set_enabled(BalsaWindow         * window,
+                       const gchar * const * actions,
+                       guint                 n_actions,
+                       gboolean              enabled)
 {
     guint i;
 
-    for (i = 0; i < n_actions; i++) {
+    for (i = 0; i < n_actions; i++)
         bw_action_set_enabled(window, *actions++, enabled);
-    }
 }
 
-
 /*
  * End of GAction helpers
  */
@@ -880,29 +796,27 @@ bw_actions_set_enabled(BalsaWindow        *window,
  */
 
 static void
-bw_show_or_hide_widget(GSimpleAction *action,
-                       GVariant      *state,
-                       gboolean      *active,
-                       GtkWidget     *widget)
+bw_show_or_hide_widget(GSimpleAction * action,
+                       GVariant      * state,
+                       gboolean      * active,
+                       GtkWidget     * widget)
 {
     *active = g_variant_get_boolean(state);
-    if (*active) {
+    if (*active)
         gtk_widget_show(widget);
-    } else {
+    else
         gtk_widget_hide(widget);
-    }
     g_simple_action_set_state(action, state);
 }
 
-
 /*
  * Callbacks for various actions' "activated" signals
  */
 
 static void
-new_message_activated(GSimpleAction *action,
-                      GVariant      *parameter,
-                      gpointer       user_data)
+new_message_activated(GSimpleAction * action,
+                      GVariant      * parameter,
+                      gpointer        user_data)
 {
     BalsaSendmsg *smwindow;
 
@@ -912,74 +826,66 @@ new_message_activated(GSimpleAction *action,
                      G_CALLBACK(bw_send_msg_window_destroy_cb), user_data);
 }
 
-
 static void
-new_mbox_activated(GSimpleAction *action,
-                   GVariant      *parameter,
-                   gpointer       user_data)
+new_mbox_activated(GSimpleAction * action,
+                   GVariant      * parameter,
+                   gpointer        user_data)
 {
     mailbox_conf_new(LIBBALSA_TYPE_MAILBOX_MBOX);
 }
 
-
 static void
-new_maildir_activated(GSimpleAction *action,
-                      GVariant      *parameter,
-                      gpointer       user_data)
+new_maildir_activated(GSimpleAction * action,
+                      GVariant      * parameter,
+                      gpointer        user_data)
 {
     mailbox_conf_new(LIBBALSA_TYPE_MAILBOX_MAILDIR);
 }
 
-
 static void
-new_mh_activated(GSimpleAction *action,
-                 GVariant      *parameter,
-                 gpointer       user_data)
+new_mh_activated(GSimpleAction * action,
+                 GVariant      * parameter,
+                 gpointer        user_data)
 {
     mailbox_conf_new(LIBBALSA_TYPE_MAILBOX_MH);
 }
 
-
 static void
-new_imap_box_activated(GSimpleAction *action,
-                       GVariant      *parameter,
-                       gpointer       user_data)
+new_imap_box_activated(GSimpleAction * action,
+                       GVariant      * parameter,
+                       gpointer        user_data)
 {
     mailbox_conf_new(LIBBALSA_TYPE_MAILBOX_IMAP);
 }
 
-
 static void
-new_imap_folder_activated(GSimpleAction *action,
-                          GVariant      *parameter,
-                          gpointer       user_data)
+new_imap_folder_activated(GSimpleAction * action,
+                          GVariant      * parameter,
+                          gpointer        user_data)
 {
     folder_conf_imap_node(NULL);
 }
 
-
 static void
-new_imap_subfolder_activated(GSimpleAction *action,
-                             GVariant      *parameter,
-                             gpointer       user_data)
+new_imap_subfolder_activated(GSimpleAction * action,
+                             GVariant      * parameter,
+                             gpointer        user_data)
 {
     folder_conf_imap_sub_node(NULL);
 }
 
-
 static void
-toolbars_activated(GSimpleAction *action,
-                   GVariant      *parameter,
-                   gpointer       user_data)
+toolbars_activated(GSimpleAction * action,
+                   GVariant      * parameter,
+                   gpointer        user_data)
 {
     customize_dialog_cb(user_data, user_data);
 }
 
-
 static void
-identities_activated(GSimpleAction *action,
-                     GVariant      *parameter,
-                     gpointer       user_data)
+identities_activated(GSimpleAction * action,
+                     GVariant      * parameter,
+                     gpointer        user_data)
 {
     GtkWindow *window = GTK_WINDOW(user_data);
 
@@ -987,15 +893,14 @@ identities_activated(GSimpleAction *action,
                                     &balsa_app.identities,
                                     &balsa_app.current_ident,
                                     balsa_app.smtp_servers,
-                                    (void (*)(gpointer))
+                                    (void(*)(gpointer))
                                     balsa_identities_changed);
 }
 
-
 static void
-address_book_activated(GSimpleAction *action,
-                       GVariant      *parameter,
-                       gpointer       user_data)
+address_book_activated(GSimpleAction * action,
+                       GVariant      * parameter,
+                       gpointer        user_data)
 {
     GtkWindow *window = GTK_WINDOW(user_data);
     GtkWidget *ab;
@@ -1004,20 +909,18 @@ address_book_activated(GSimpleAction *action,
     gtk_widget_show(GTK_WIDGET(ab));
 }
 
-
 static void
-prefs_activated(GSimpleAction *action,
-                GVariant      *parameter,
-                gpointer       user_data)
+prefs_activated(GSimpleAction * action,
+                GVariant      * parameter,
+                gpointer        user_data)
 {
     open_preferences_manager(NULL, user_data);
 }
 
-
 static void
-help_activated(GSimpleAction *action,
-               GVariant      *parameter,
-               gpointer       user_data)
+help_activated(GSimpleAction * action,
+               GVariant      * parameter,
+               gpointer        user_data)
 {
     GtkWindow *window = GTK_WINDOW(user_data);
     GError *err = NULL;
@@ -1031,17 +934,16 @@ help_activated(GSimpleAction *action,
     }
 }
 
-
 static void
-about_activated(GSimpleAction *action,
-                GVariant      *parameter,
-                gpointer       user_data)
+about_activated(GSimpleAction * action,
+                GVariant      * parameter,
+                gpointer        user_data)
 {
     GtkWindow *window = GTK_WINDOW(user_data);
     const gchar *authors[] = {
         "Balsa Maintainers <balsa-maintainer theochem kth se>:",
         "Peter Bloomfield <PeterBloomfield bellsouth net>",
-        "Bart Visscher <magick linux-fan com>",
+       "Bart Visscher <magick linux-fan com>",
         "Emmanuel Allaud <e allaud wanadoo fr>",
         "Carlos Morgado <chbm gnome org>",
         "Pawel Salek <pawsa theochem kth se>",
@@ -1084,19 +986,18 @@ about_activated(GSimpleAction *action,
                           "title", _("About Balsa"),
                           "translator-credits",
                           strcmp(translator_credits, "translator-credits") ?
-                          translator_credits : NULL,
-                          "logo", balsa_logo,
+                         translator_credits : NULL,
+                         "logo", balsa_logo,
                           "website", "http://balsa.gnome.org";,
                           "wrap-license", TRUE,
                           NULL);
     g_object_unref(balsa_logo);
 }
 
-
 static void
-quit_activated(GSimpleAction *action,
-               GVariant      *parameter,
-               gpointer       user_data)
+quit_activated(GSimpleAction * action,
+               GVariant      * parameter,
+               gpointer        user_data)
 {
     GtkWindow *window = user_data;
 
@@ -1104,18 +1005,16 @@ quit_activated(GSimpleAction *action,
                                   LIBBALSA_INFORMATION_MESSAGE,
                                   _("Balsa closes files and connections."
                                     " Please wait…"));
-    while (gtk_events_pending()) {
+    while(gtk_events_pending())
         gtk_main_iteration_do(FALSE);
-    }
 
     gtk_widget_destroy((GtkWidget *) window);
 }
 
-
 static void
-continue_activated(GSimpleAction *action,
-                   GVariant      *parameter,
-                   gpointer       user_data)
+continue_activated(GSimpleAction * action,
+                   GVariant      * parameter,
+                   gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *index;
@@ -1123,18 +1022,16 @@ continue_activated(GSimpleAction *action,
     index = balsa_window_find_current_index(window);
 
     if (index
-        && (BALSA_INDEX(index)->mailbox_node->mailbox == balsa_app.draftbox)) {
+        && BALSA_INDEX(index)->mailbox_node->mailbox == balsa_app.draftbox)
         balsa_message_continue(BALSA_INDEX(index));
-    } else {
+    else
         balsa_mblist_open_mailbox(balsa_app.draftbox);
-    }
 }
 
-
 static void
-get_new_mail_activated(GSimpleAction *action,
-                       GVariant      *parameter,
-                       gpointer       user_data)
+get_new_mail_activated(GSimpleAction * action,
+                       GVariant      * parameter,
+                       gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
@@ -1146,182 +1043,160 @@ get_new_mail_activated(GSimpleAction *action,
     }
 }
 
-
 static void
-send_queued_mail_activated(GSimpleAction *action,
-                           GVariant      *parameter,
-                           gpointer       user_data)
+send_queued_mail_activated(GSimpleAction * action,
+                           GVariant      * parameter,
+                           gpointer        user_data)
 {
     libbalsa_process_queue(balsa_app.outbox, balsa_find_sentbox_by_url,
                            balsa_app.smtp_servers,
-                           balsa_app.send_progress_dialog,
+                                                  balsa_app.send_progress_dialog,
                            (GtkWindow *) balsa_app.main_window);
 }
 
-
 static void
-send_and_receive_mail_activated(GSimpleAction *action,
-                                GVariant      *parameter,
-                                gpointer       user_data)
+send_and_receive_mail_activated(GSimpleAction * action,
+                                GVariant      * parameter,
+                                gpointer        user_data)
 {
     get_new_mail_activated(action, parameter, user_data);
     send_queued_mail_activated(action, parameter, user_data);
 }
 
-
 static void
-page_setup_activated(GSimpleAction *action,
-                     GVariant      *parameter,
-                     gpointer       user_data)
+page_setup_activated(GSimpleAction * action,
+                     GVariant      * parameter,
+                     gpointer        user_data)
 {
     GtkWindow *window = GTK_WINDOW(user_data);
 
     message_print_page_setup(window);
 }
 
-
 static void
-print_activated(GSimpleAction *action,
-                GVariant      *parameter,
-                gpointer       user_data)
+print_activated(GSimpleAction * action,
+                GVariant      * parameter,
+                gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *index;
     BalsaIndex *bindex;
 
     index = balsa_window_find_current_index(window);
-    if (!index) {
+    if (!index)
         return;
-    }
 
     bindex = BALSA_INDEX(index);
     if (bindex->current_msgno) {
         LibBalsaMessage *message =
             libbalsa_mailbox_get_message(bindex->mailbox_node->mailbox,
                                          bindex->current_msgno);
-        if (!message) {
+        if (!message)
             return;
-        }
         message_print(message, GTK_WINDOW(window));
         g_object_unref(message);
     }
 }
 
-
 static void
-copy_activated(GSimpleAction *action,
-               GVariant      *parameter,
-               gpointer       user_data)
+copy_activated(GSimpleAction * action,
+               GVariant      * parameter,
+               gpointer        user_data)
 {
     GtkWindow *window = GTK_WINDOW(user_data);
     guint signal_id;
     GtkWidget *focus_widget = gtk_window_get_focus(window);
 
-    if (!focus_widget) {
-        return;
-    }
+    if (!focus_widget)
+       return;
 
     signal_id = g_signal_lookup("copy-clipboard",
                                 G_TYPE_FROM_INSTANCE(focus_widget));
-    if (signal_id) {
+    if (signal_id)
         g_signal_emit(focus_widget, signal_id, (GQuark) 0);
-    }
 #ifdef HAVE_HTML_WIDGET
-    else if (libbalsa_html_can_select(focus_widget)) {
-        libbalsa_html_copy(focus_widget);
-    }
+    else if (libbalsa_html_can_select(focus_widget))
+       libbalsa_html_copy(focus_widget);
 #endif /* HAVE_HTML_WIDGET */
 }
 
-
 static void
-select_all_activated(GSimpleAction *action,
-                     GVariant      *parameter,
-                     gpointer       user_data)
+select_all_activated(GSimpleAction * action,
+                     GVariant      * parameter,
+                     gpointer        user_data)
 {
     GtkWindow *window = GTK_WINDOW(user_data);
 
     balsa_window_select_all(window);
 }
 
-
 static void
-select_thread_activated(GSimpleAction *action,
-                        GVariant      *parameter,
-                        gpointer       user_data)
+select_thread_activated(GSimpleAction * action,
+                        GVariant      * parameter,
+                        gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *bindex;
 
-    if ((bindex = balsa_window_find_current_index(window))) {
+    if ((bindex = balsa_window_find_current_index(window)))
         balsa_index_select_thread(BALSA_INDEX(bindex));
-    }
 }
 
-
 static void
-find_activated(GSimpleAction *action,
-               GVariant      *parameter,
-               gpointer       user_data)
+find_activated(GSimpleAction * action,
+               GVariant      * parameter,
+               gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *bindex;
 
-    if ((bindex = balsa_window_find_current_index(window))) {
+    if ((bindex = balsa_window_find_current_index(window)))
         bw_find_real(window, BALSA_INDEX(bindex), FALSE);
-    }
 }
 
-
 static void
-find_next_activated(GSimpleAction *action,
-                    GVariant      *parameter,
-                    gpointer       user_data)
+find_next_activated(GSimpleAction * action,
+                    GVariant      * parameter,
+                    gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
-    GtkWidget *bindex;
+    GtkWidget * bindex;
 
-    if ((bindex = balsa_window_find_current_index(window))) {
-        bw_find_real(window, BALSA_INDEX(bindex), TRUE);
-    }
+    if ((bindex = balsa_window_find_current_index(window)))
+       bw_find_real(window, BALSA_INDEX(bindex), TRUE);
 }
 
-
 static void
-find_in_message_activated(GSimpleAction *action,
-                          GVariant      *parameter,
-                          gpointer       user_data)
+find_in_message_activated(GSimpleAction * action,
+                          GVariant      * parameter,
+                          gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
-    if (balsa_app.previewpane) {
+    if (balsa_app.previewpane)
         balsa_message_find_in_message(BALSA_MESSAGE(window->preview));
-    }
 }
 
-
 static void
-filters_activated(GSimpleAction *action,
-                  GVariant      *parameter,
-                  gpointer       user_data)
+filters_activated(GSimpleAction * action,
+                  GVariant      * parameter,
+                  gpointer        user_data)
 {
     filters_edit_dialog(GTK_WINDOW(user_data));
 }
 
-
 static void
-export_filters_activated(GSimpleAction *action,
-                         GVariant      *parameter,
-                         gpointer       user_data)
+export_filters_activated(GSimpleAction * action,
+                         GVariant      * parameter,
+                         gpointer        user_data)
 {
     filters_export_dialog(GTK_WINDOW(user_data));
 }
 
-
 static void
-expand_all_activated(GSimpleAction *action,
-                     GVariant      *parameter,
-                     gpointer       user_data)
+expand_all_activated(GSimpleAction * action,
+                     GVariant      * parameter,
+                     gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *index;
@@ -1330,11 +1205,10 @@ expand_all_activated(GSimpleAction *action,
     balsa_index_update_tree(BALSA_INDEX(index), TRUE);
 }
 
-
 static void
-collapse_all_activated(GSimpleAction *action,
-                       GVariant      *parameter,
-                       gpointer       user_data)
+collapse_all_activated(GSimpleAction * action,
+                       GVariant      * parameter,
+                       gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *index;
@@ -1343,12 +1217,11 @@ collapse_all_activated(GSimpleAction *action,
     balsa_index_update_tree(BALSA_INDEX(index), FALSE);
 }
 
-
 #ifdef HAVE_HTML_WIDGET
 static void
-zoom_in_activated(GSimpleAction *action,
-                  GVariant      *parameter,
-                  gpointer       user_data)
+zoom_in_activated(GSimpleAction * action,
+                  GVariant      * parameter,
+                  gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *bm = window->preview;
@@ -1356,11 +1229,10 @@ zoom_in_activated(GSimpleAction *action,
     balsa_message_zoom(BALSA_MESSAGE(bm), 1);
 }
 
-
 static void
-zoom_out_activated(GSimpleAction *action,
-                   GVariant      *parameter,
-                   gpointer       user_data)
+zoom_out_activated(GSimpleAction * action,
+                   GVariant      * parameter,
+                   gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *bm = window->preview;
@@ -1368,25 +1240,22 @@ zoom_out_activated(GSimpleAction *action,
     balsa_message_zoom(BALSA_MESSAGE(bm), -1);
 }
 
-
 static void
-zoom_normal_activated(GSimpleAction *action,
-                      GVariant      *parameter,
-                      gpointer       user_data)
+zoom_normal_activated(GSimpleAction * action,
+                      GVariant      * parameter,
+                      gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *bm = window->preview;
 
     balsa_message_zoom(BALSA_MESSAGE(bm), 0);
 }
-
-
-#endif                          /* HAVE_HTML_WIDGET */
+#endif                         /* HAVE_HTML_WIDGET */
 
 static void
-next_message_activated(GSimpleAction *action,
-                       GVariant      *parameter,
-                       gpointer       user_data)
+next_message_activated(GSimpleAction * action,
+                       GVariant      * parameter,
+                       gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *index;
@@ -1395,11 +1264,10 @@ next_message_activated(GSimpleAction *action,
     balsa_index_select_next(BALSA_INDEX(index));
 }
 
-
 static void
-previous_message_activated(GSimpleAction *action,
-                           GVariant      *parameter,
-                           gpointer       user_data)
+previous_message_activated(GSimpleAction * action,
+                           GVariant      * parameter,
+                           gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *index;
@@ -1408,22 +1276,20 @@ previous_message_activated(GSimpleAction *action,
     balsa_index_select_previous(BALSA_INDEX(index));
 }
 
-
 static void
-next_unread_activated(GSimpleAction *action,
-                      GVariant      *parameter,
-                      gpointer       user_data)
+next_unread_activated(GSimpleAction * action,
+                      GVariant      * parameter,
+                      gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
     balsa_window_next_unread(window);
 }
 
-
 static void
-next_flagged_activated(GSimpleAction *action,
-                       GVariant      *parameter,
-                       gpointer       user_data)
+next_flagged_activated(GSimpleAction * action,
+                       GVariant      * parameter,
+                       gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *index;
@@ -1432,11 +1298,10 @@ next_flagged_activated(GSimpleAction *action,
     balsa_index_select_next_flagged(BALSA_INDEX(index));
 }
 
-
 static void
-reset_filter_activated(GSimpleAction *action,
-                       GVariant      *parameter,
-                       gpointer       user_data)
+reset_filter_activated(GSimpleAction * action,
+                       GVariant      * parameter,
+                       gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *index;
@@ -1448,11 +1313,10 @@ reset_filter_activated(GSimpleAction *action,
                        window->sos_entry);
 }
 
-
 static void
-mailbox_select_all_activated(GSimpleAction *action,
-                             GVariant      *parameter,
-                             gpointer       user_data)
+mailbox_select_all_activated(GSimpleAction * action,
+                             GVariant      * parameter,
+                             gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *index;
@@ -1462,29 +1326,26 @@ mailbox_select_all_activated(GSimpleAction *action,
     balsa_window_select_all(GTK_WINDOW(window));
 }
 
-
 static void
-mailbox_edit_activated(GSimpleAction *action,
-                       GVariant      *parameter,
-                       gpointer       user_data)
+mailbox_edit_activated(GSimpleAction * action,
+                       GVariant      * parameter,
+                       gpointer        user_data)
 {
     mailbox_conf_edit_cb(NULL, NULL);
 }
 
-
 static void
-mailbox_delete_activated(GSimpleAction *action,
-                         GVariant      *parameter,
-                         gpointer       user_data)
+mailbox_delete_activated(GSimpleAction * action,
+                         GVariant      * parameter,
+                         gpointer        user_data)
 {
     mailbox_conf_delete_cb(NULL, NULL);
 }
 
-
 static void
-mailbox_expunge_activated(GSimpleAction *action,
-                          GVariant      *parameter,
-                          gpointer       user_data)
+mailbox_expunge_activated(GSimpleAction * action,
+                          GVariant      * parameter,
+                          gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *index;
@@ -1493,62 +1354,54 @@ mailbox_expunge_activated(GSimpleAction *action,
     balsa_index_expunge(BALSA_INDEX(index));
 }
 
-
 static void
-mailbox_close_activated(GSimpleAction *action,
-                        GVariant      *parameter,
-                        gpointer       user_data)
+mailbox_close_activated(GSimpleAction * action,
+                        GVariant      * parameter,
+                        gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *index;
 
     index = balsa_window_find_current_index(window);
-    if (index) {
+    if (index)
         balsa_mblist_close_mailbox(BALSA_INDEX(index)->mailbox_node->
                                    mailbox);
-    }
 }
 
-
 static void
-empty_trash_activated(GSimpleAction *action,
-                      GVariant      *parameter,
-                      gpointer       user_data)
+empty_trash_activated(GSimpleAction * action,
+                      GVariant      * parameter,
+                      gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
     empty_trash(window);
 }
 
-
 static void
-select_filters_activated(GSimpleAction *action,
-                         GVariant      *parameter,
-                         gpointer       user_data)
+select_filters_activated(GSimpleAction * action,
+                      GVariant      * parameter,
+                      gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *index;
 
     index = balsa_window_find_current_index(window);
-    if (index) {
+    if (index)
         filters_run_dialog(BALSA_INDEX(index)->mailbox_node->mailbox,
                            GTK_WINDOW(balsa_app.main_window));
-    } else {
-        /* FIXME : Perhaps should we be able to apply filters on folders (ie recurse on all
-           mailboxes in it),
-           but there are problems of infinite recursion (when one mailbox being filtered is also
-              the destination
-           of the filter action (eg a copy)). So let's see that later :) */
-        balsa_information(LIBBALSA_INFORMATION_WARNING,
+    else
+       /* FIXME : Perhaps should we be able to apply filters on folders (ie recurse on all mailboxes in it),
+          but there are problems of infinite recursion (when one mailbox being filtered is also the 
destination
+          of the filter action (eg a copy)). So let's see that later :) */
+       balsa_information(LIBBALSA_INFORMATION_WARNING,
                           _("You can apply filters only on mailbox\n"));
-    }
 }
 
-
 static void
-remove_duplicates_activated(GSimpleAction *action,
-                            GVariant      *parameter,
-                            gpointer       user_data)
+remove_duplicates_activated(GSimpleAction * action,
+                            GVariant      * parameter,
+                            gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *index;
@@ -1566,125 +1419,114 @@ remove_duplicates_activated(GSimpleAction *action,
                               err->message);
             g_error_free(err);
         } else {
-            if (dup_count) {
+           if(dup_count)
                 balsa_information(LIBBALSA_INFORMATION_MESSAGE,
                                   ngettext("Removed %d duplicate",
                                            "Removed %d duplicates",
                                            dup_count), dup_count);
-            } else {
-                balsa_information(LIBBALSA_INFORMATION_MESSAGE,
-                                  _("No duplicates found"));
-            }
-        }
+           else
+               balsa_information(LIBBALSA_INFORMATION_MESSAGE,
+                                 _("No duplicates found"));
+       }
 
     }
 }
 
-
 static void
-reply_activated(GSimpleAction *action,
-                GVariant      *parameter,
-                gpointer       user_data)
+reply_activated(GSimpleAction * action,
+                GVariant      * parameter,
+                gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
     balsa_message_reply(balsa_window_find_current_index(window));
 }
 
-
 static void
-reply_all_activated(GSimpleAction *action,
-                    GVariant      *parameter,
-                    gpointer       user_data)
+reply_all_activated(GSimpleAction * action,
+                    GVariant      * parameter,
+                    gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
     balsa_message_replytoall(balsa_window_find_current_index(window));
 }
 
-
 static void
-reply_group_activated(GSimpleAction *action,
-                      GVariant      *parameter,
-                      gpointer       user_data)
+reply_group_activated(GSimpleAction * action,
+                      GVariant      * parameter,
+                      gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
     balsa_message_replytogroup(balsa_window_find_current_index(window));
 }
 
-
 static void
-forward_attached_activated(GSimpleAction *action,
-                           GVariant      *parameter,
-                           gpointer       user_data)
+forward_attached_activated(GSimpleAction * action,
+                           GVariant      * parameter,
+                           gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
     balsa_message_forward_attached(balsa_window_find_current_index(window));
 }
 
-
 static void
-forward_inline_activated(GSimpleAction *action,
-                         GVariant      *parameter,
-                         gpointer       user_data)
+forward_inline_activated(GSimpleAction * action,
+                         GVariant      * parameter,
+                         gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
     balsa_message_forward_inline(balsa_window_find_current_index(window));
 }
 
-
 static void
-pipe_activated(GSimpleAction *action,
-               GVariant      *parameter,
-               gpointer       user_data)
+pipe_activated(GSimpleAction * action,
+               GVariant      * parameter,
+               gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
     balsa_index_pipe(BALSA_INDEX
-                         (balsa_window_find_current_index(window)));
+                     (balsa_window_find_current_index(window)));
 }
 
-
 static void
-next_part_activated(GSimpleAction *action,
-                    GVariant      *parameter,
-                    gpointer       user_data)
+next_part_activated(GSimpleAction * action,
+                    GVariant      * parameter,
+                    gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
     balsa_message_next_part(BALSA_MESSAGE(window->preview));
 }
 
-
 static void
-previous_part_activated(GSimpleAction *action,
-                        GVariant      *parameter,
-                        gpointer       user_data)
+previous_part_activated(GSimpleAction * action,
+                        GVariant      * parameter,
+                        gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
     balsa_message_previous_part(BALSA_MESSAGE(window->preview));
 }
 
-
 static void
-save_part_activated(GSimpleAction *action,
-                    GVariant      *parameter,
-                    gpointer       user_data)
+save_part_activated(GSimpleAction * action,
+                    GVariant      * parameter,
+                    gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
     balsa_message_save_current_part(BALSA_MESSAGE(window->preview));
 }
 
-
 static void
-view_source_activated(GSimpleAction *action,
-                      GVariant      *parameter,
-                      gpointer       user_data)
+view_source_activated(GSimpleAction * action,
+                      GVariant      * parameter,
+                      gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *bindex;
@@ -1695,11 +1537,11 @@ view_source_activated(GSimpleAction *action,
 
     messages = balsa_index_selected_list(BALSA_INDEX(bindex));
     for (list = messages; list; list = list->next) {
-        LibBalsaMessage *message = list->data;
+       LibBalsaMessage *message = list->data;
 
-        libbalsa_show_message_source(balsa_app.application,
+       libbalsa_show_message_source(balsa_app.application,
                                      message, balsa_app.message_font,
-                                     &balsa_app.source_escape_specials,
+                                    &balsa_app.source_escape_specials,
                                      &balsa_app.source_width,
                                      &balsa_app.source_height);
     }
@@ -1707,50 +1549,43 @@ view_source_activated(GSimpleAction *action,
     g_list_free_full(messages, g_object_unref);
 }
 
-
 static void
-copy_message_activated(GSimpleAction *action,
-                       GVariant      *parameter,
-                       gpointer       user_data)
+copy_message_activated(GSimpleAction * action,
+                       GVariant      * parameter,
+                       gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
-    if (balsa_message_grab_focus(BALSA_MESSAGE(window->preview))) {
+    if (balsa_message_grab_focus(BALSA_MESSAGE(window->preview)))
         copy_activated(action, parameter, user_data);
-    }
 }
 
-
 static void
-select_text_activated(GSimpleAction *action,
-                      GVariant      *parameter,
-                      gpointer       user_data)
+select_text_activated(GSimpleAction * action,
+                       GVariant      * parameter,
+                       gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
-    if (balsa_message_grab_focus(BALSA_MESSAGE(window->preview))) {
-        balsa_window_select_all(user_data);
-    }
+    if (balsa_message_grab_focus(BALSA_MESSAGE(window->preview)))
+       balsa_window_select_all(user_data);
 }
 
-
 static void
-move_to_trash_activated(GSimpleAction *action,
-                        GVariant      *parameter,
-                        gpointer       user_data)
+move_to_trash_activated(GSimpleAction * action,
+                       GVariant      * parameter,
+                       gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
     balsa_message_move_to_trash(balsa_window_find_current_index(window));
 }
 
-
 /*
  * Helper for toggling flags
  */
 static void
-toggle_flag(LibBalsaMessageFlag flag,
-            gpointer            user_data)
+toggle_flag(LibBalsaMessageFlag flag, gpointer user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *bindex;
@@ -1759,47 +1594,42 @@ toggle_flag(LibBalsaMessageFlag flag,
     balsa_index_toggle_flag(BALSA_INDEX(bindex), flag);
 }
 
-
 static void
-toggle_flagged_activated(GSimpleAction *action,
-                         GVariant      *parameter,
-                         gpointer       user_data)
+toggle_flagged_activated(GSimpleAction * action,
+                         GVariant      * parameter,
+                         gpointer        user_data)
 {
     toggle_flag(LIBBALSA_MESSAGE_FLAG_FLAGGED, user_data);
 }
 
-
 static void
-toggle_deleted_activated(GSimpleAction *action,
-                         GVariant      *parameter,
-                         gpointer       user_data)
+toggle_deleted_activated(GSimpleAction * action,
+                         GVariant      * parameter,
+                         gpointer        user_data)
 {
     toggle_flag(LIBBALSA_MESSAGE_FLAG_DELETED, user_data);
 }
 
-
 static void
-toggle_new_activated(GSimpleAction *action,
-                     GVariant      *parameter,
-                     gpointer       user_data)
+toggle_new_activated(GSimpleAction * action,
+                     GVariant      * parameter,
+                     gpointer        user_data)
 {
     toggle_flag(LIBBALSA_MESSAGE_FLAG_NEW, user_data);
 }
 
-
 static void
-toggle_answered_activated(GSimpleAction *action,
-                          GVariant      *parameter,
-                          gpointer       user_data)
+toggle_answered_activated(GSimpleAction * action,
+                          GVariant      * parameter,
+                          gpointer        user_data)
 {
     toggle_flag(LIBBALSA_MESSAGE_FLAG_REPLIED, user_data);
 }
 
-
 static void
-store_address_activated(GSimpleAction *action,
-                        GVariant      *parameter,
-                        gpointer       user_data)
+store_address_activated(GSimpleAction * action,
+                          GVariant      * parameter,
+                          gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *index = balsa_window_find_current_index(window);
@@ -1812,15 +1642,14 @@ store_address_activated(GSimpleAction *action,
     g_list_free_full(messages, g_object_unref);
 }
 
-
 /*
  * Callbacks for various toggle actions' "change-state" signals
  */
 
 static void
-show_mailbox_tree_change_state(GSimpleAction *action,
-                               GVariant      *state,
-                               gpointer       user_data)
+show_mailbox_tree_change_state(GSimpleAction * action,
+                               GVariant      * state,
+                               gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
@@ -1829,11 +1658,10 @@ show_mailbox_tree_change_state(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 static void
-show_mailbox_tabs_change_state(GSimpleAction *action,
-                               GVariant      *state,
-                               gpointer       user_data)
+show_mailbox_tabs_change_state(GSimpleAction * action,
+                               GVariant      * state,
+                               gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
@@ -1843,11 +1671,10 @@ show_mailbox_tabs_change_state(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 static void
-show_toolbar_change_state(GSimpleAction *action,
-                          GVariant      *state,
-                          gpointer       user_data)
+show_toolbar_change_state(GSimpleAction * action,
+                          GVariant      * state,
+                          gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
@@ -1855,11 +1682,10 @@ show_toolbar_change_state(GSimpleAction *action,
                            window->toolbar);
 }
 
-
 static void
-show_statusbar_change_state(GSimpleAction *action,
-                            GVariant      *state,
-                            gpointer       user_data)
+show_statusbar_change_state(GSimpleAction * action,
+                            GVariant      * state,
+                            gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
@@ -1867,11 +1693,10 @@ show_statusbar_change_state(GSimpleAction *action,
                            window->bottom_bar);
 }
 
-
 static void
-show_sos_bar_change_state(GSimpleAction *action,
-                          GVariant      *state,
-                          gpointer       user_data)
+show_sos_bar_change_state(GSimpleAction * action,
+                          GVariant      * state,
+                          gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
@@ -1879,11 +1704,10 @@ show_sos_bar_change_state(GSimpleAction *action,
                            window->sos_bar);
 }
 
-
 static void
-wrap_change_state(GSimpleAction *action,
-                  GVariant      *state,
-                  gpointer       user_data)
+wrap_change_state(GSimpleAction * action,
+                  GVariant      * state,
+                  gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
@@ -1896,15 +1720,14 @@ wrap_change_state(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 /*
  * Toggle actions that are used only in the toolbar
  */
 
 static void
-show_all_headers_change_state(GSimpleAction *action,
-                              GVariant      *state,
-                              gpointer       user_data)
+show_all_headers_change_state(GSimpleAction * action,
+                              GVariant      * state,
+                              gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
@@ -1918,11 +1741,10 @@ show_all_headers_change_state(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 static void
-show_preview_pane_change_state(GSimpleAction *action,
-                               GVariant      *state,
-                               gpointer       user_data)
+show_preview_pane_change_state(GSimpleAction * action,
+                               GVariant      * state,
+                               gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
@@ -1933,32 +1755,31 @@ show_preview_pane_change_state(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 /* Really, entire mailbox_hide_menu should be build dynamically from
  * the hide_states array since different mailboxes support different
  * set of flags/keywords. */
 static const struct {
     LibBalsaMessageFlag flag;
-    unsigned set : 1;
+    unsigned set:1;
     gint states_index;
     const gchar *action_name;
 } hide_states[] = {
     { LIBBALSA_MESSAGE_FLAG_DELETED, 1, 0, "hide-deleted"   },
     { LIBBALSA_MESSAGE_FLAG_DELETED, 0, 1, "hide-undeleted" },
-    { LIBBALSA_MESSAGE_FLAG_NEW, 0, 2, "hide-read"      },
-    { LIBBALSA_MESSAGE_FLAG_NEW, 1, 3, "hide-unread"    },
+    { LIBBALSA_MESSAGE_FLAG_NEW,     0, 2, "hide-read"      },
+    { LIBBALSA_MESSAGE_FLAG_NEW,     1, 3, "hide-unread"    },
     { LIBBALSA_MESSAGE_FLAG_FLAGGED, 1, 4, "hide-flagged"   },
     { LIBBALSA_MESSAGE_FLAG_FLAGGED, 0, 5, "hide-unflagged" },
     { LIBBALSA_MESSAGE_FLAG_REPLIED, 1, 6, "hide-answered"  },
     { LIBBALSA_MESSAGE_FLAG_REPLIED, 0, 7, "hide-unanswered" }
 };
 
-static void bw_hide_changed_set_view_filter(BalsaWindow *window);
+static void bw_hide_changed_set_view_filter(BalsaWindow * window);
 
 static void
-hide_change_state(GSimpleAction *action,
-                  GVariant      *state,
-                  gpointer       user_data)
+hide_change_state(GSimpleAction * action,
+                  GVariant      * state,
+                  gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
 
@@ -1968,11 +1789,9 @@ hide_change_state(GSimpleAction *action,
         const gchar *action_name = g_action_get_name(G_ACTION(action));
         unsigned curr_idx, i;
 
-        for (i = 0; i < G_N_ELEMENTS(hide_states); i++) {
-            if (strcmp(action_name, hide_states[i].action_name) == 0) {
+        for (i = 0; i < G_N_ELEMENTS(hide_states); i++)
+            if (strcmp(action_name, hide_states[i].action_name) == 0)
                 break;
-            }
-        }
         g_assert(i < G_N_ELEMENTS(hide_states));
         curr_idx = hide_states[i].states_index;
 
@@ -1980,13 +1799,12 @@ hide_change_state(GSimpleAction *action,
             int states_idx = hide_states[i].states_index;
 
             if (!bw_action_get_boolean(window,
-                                       hide_states[i].action_name)) {
+                                       hide_states[i].action_name))
                 continue;
-            }
 
-            if ((hide_states[states_idx].flag == hide_states[curr_idx].flag)
-                && (hide_states[states_idx].set !=
-                    hide_states[curr_idx].set)) {
+            if (hide_states[states_idx].flag == hide_states[curr_idx].flag
+                && hide_states[states_idx].set !=
+                hide_states[curr_idx].set) {
                 GAction *coupled_action;
 
                 coupled_action =
@@ -2003,12 +1821,11 @@ hide_change_state(GSimpleAction *action,
     bw_hide_changed_set_view_filter(window);
 }
 
-
 /*
  * Callbacks for various radio actions' "change-state" signals
  */
 static void
-bw_reset_show_all_headers(BalsaWindow *window)
+bw_reset_show_all_headers(BalsaWindow * window)
 {
     if (balsa_app.show_all_headers) {
         bw_action_set_boolean(window, "show-all-headers", FALSE);
@@ -2016,11 +1833,10 @@ bw_reset_show_all_headers(BalsaWindow *window)
     }
 }
 
-
 static void
-header_change_state(GSimpleAction *action,
-                    GVariant      *state,
-                    gpointer       user_data)
+header_change_state(GSimpleAction * action,
+                    GVariant      * state,
+                    gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     const gchar *value;
@@ -2028,13 +1844,13 @@ header_change_state(GSimpleAction *action,
 
     value = g_variant_get_string(state, NULL);
 
-    if (strcmp(value, "none") == 0) {
+    if (strcmp(value, "none") == 0)
         sh = HEADERS_NONE;
-    } else if (strcmp(value, "selected") == 0) {
+    else if (strcmp(value, "selected") == 0)
         sh = HEADERS_SELECTED;
-    } else if (strcmp(value, "all") == 0) {
+    else if (strcmp(value, "all") == 0)
         sh = HEADERS_ALL;
-    } else {
+    else {
         g_print("%s unknown value “%s”\n", __func__, value);
         return;
     }
@@ -2047,11 +1863,10 @@ header_change_state(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 static void
-threading_change_state(GSimpleAction *action,
-                       GVariant      *state,
-                       gpointer       user_data)
+threading_change_state(GSimpleAction * action,
+                       GVariant      * state,
+                       gpointer        user_data)
 {
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *index;
@@ -2062,13 +1877,13 @@ threading_change_state(GSimpleAction *action,
 
     value = g_variant_get_string(state, NULL);
 
-    if (strcmp(value, "flat") == 0) {
+    if (strcmp(value, "flat") == 0)
         type = LB_MAILBOX_THREADING_FLAT;
-    } else if (strcmp(value, "simple") == 0) {
+    else if (strcmp(value, "simple") == 0)
         type = LB_MAILBOX_THREADING_SIMPLE;
-    } else if (strcmp(value, "jwz") == 0) {
+    else if (strcmp(value, "jwz") == 0)
         type = LB_MAILBOX_THREADING_JWZ;
-    } else {
+    else {
         g_print("%s unknown value “%s”\n", __func__, value);
         return;
     }
@@ -2080,157 +1895,151 @@ threading_change_state(GSimpleAction *action,
      * set-threading: */
     index = balsa_window_find_current_index(window);
     if (index && (mbnode = BALSA_INDEX(index)->mailbox_node)
-        && (mailbox = mbnode->mailbox)) {
+        && (mailbox = mbnode->mailbox))
         bw_enable_expand_collapse(window, mailbox);
-    }
 
     g_simple_action_set_state(action, state);
 }
 
-
 /*
  * End of callbacks
  */
 
 static void
-bw_add_app_action_entries(GActionMap *action_map,
-                          gpointer    user_data)
+bw_add_app_action_entries(GActionMap * action_map, gpointer user_data)
 {
     static GActionEntry app_entries[] = {
-        {"new-message", new_message_activated},
-        {"new-mbox", new_mbox_activated},
-        {"new-maildir", new_maildir_activated},
-        {"new-mh", new_mh_activated},
-        {"new-imap-box", new_imap_box_activated},
-        {"new-imap-folder", new_imap_folder_activated},
-        {"new-imap-subfolder", new_imap_subfolder_activated},
-        {"toolbars", toolbars_activated},
-        {"identities", identities_activated},
-        {"address-book", address_book_activated},
-        {"prefs", prefs_activated},
-        {"help", help_activated},
-        {"about", about_activated},
-        {"quit", quit_activated}
+        {"new-message",           new_message_activated},
+        {"new-mbox",              new_mbox_activated},
+        {"new-maildir",           new_maildir_activated},
+        {"new-mh",                new_mh_activated},
+        {"new-imap-box",          new_imap_box_activated},
+        {"new-imap-folder",       new_imap_folder_activated},
+        {"new-imap-subfolder",    new_imap_subfolder_activated},
+        {"toolbars",              toolbars_activated},
+        {"identities",            identities_activated},
+        {"address-book",          address_book_activated},
+        {"prefs",                 prefs_activated},
+        {"help",                  help_activated},
+        {"about",                 about_activated},
+        {"quit",                  quit_activated}
     };
 
     g_action_map_add_action_entries(action_map, app_entries,
                                     G_N_ELEMENTS(app_entries), user_data);
 }
 
-
-static GActionEntry win_entries[] = {
-    {"new-message", new_message_activated},
-    {"continue", continue_activated},
-    {"get-new-mail", get_new_mail_activated},
-    {"send-queued-mail", send_queued_mail_activated},
-    {"send-and-receive-mail", send_and_receive_mail_activated},
-    {"page-setup", page_setup_activated},
-    {"print", print_activated},
-    {"address-book", address_book_activated},
-    {"quit", quit_activated},
-    {"copy", copy_activated},
-    {"select-all", select_all_activated},
-    {"select-thread", select_thread_activated},
-    {"find", find_activated},
-    {"find-next", find_next_activated},
-    {"find-in-message", find_in_message_activated},
-    {"filters", filters_activated},
-    {"export-filters", export_filters_activated},
-    {"show-mailbox-tree", libbalsa_toggle_activated, NULL, "false",
-     show_mailbox_tree_change_state},
-    {"show-mailbox-tabs", libbalsa_toggle_activated, NULL, "false",
-     show_mailbox_tabs_change_state},
-    {"show-toolbar", libbalsa_toggle_activated, NULL, "false",
-     show_toolbar_change_state},
-    {"show-statusbar", libbalsa_toggle_activated, NULL, "false",
-     show_statusbar_change_state},
-    {"show-sos-bar", libbalsa_toggle_activated, NULL, "false",
-     show_sos_bar_change_state},
-    {"wrap", libbalsa_toggle_activated, NULL, "false",
-     wrap_change_state},
-    {"headers", libbalsa_radio_activated, "s", "'none'",
-     header_change_state},
-    {"threading", libbalsa_radio_activated, "s", "'flat'",
-     threading_change_state},
-    {"expand-all", expand_all_activated},
-    {"collapse-all", collapse_all_activated},
+    static GActionEntry win_entries[] = {
+        {"new-message",           new_message_activated},
+        {"continue",              continue_activated},
+        {"get-new-mail",          get_new_mail_activated},
+        {"send-queued-mail",      send_queued_mail_activated},
+        {"send-and-receive-mail", send_and_receive_mail_activated},
+        {"page-setup",            page_setup_activated},
+        {"print",                 print_activated},
+        {"address-book",          address_book_activated},
+        {"quit",                  quit_activated},
+        {"copy",                  copy_activated},
+        {"select-all",            select_all_activated},
+        {"select-thread",         select_thread_activated},
+        {"find",                  find_activated},
+        {"find-next",             find_next_activated},
+        {"find-in-message",       find_in_message_activated},
+        {"filters",               filters_activated},
+        {"export-filters",        export_filters_activated},
+        {"show-mailbox-tree",     libbalsa_toggle_activated, NULL, "false",
+                                  show_mailbox_tree_change_state},
+        {"show-mailbox-tabs",     libbalsa_toggle_activated, NULL, "false",
+                                  show_mailbox_tabs_change_state},
+        {"show-toolbar",          libbalsa_toggle_activated, NULL, "false",
+                                  show_toolbar_change_state},
+        {"show-statusbar",        libbalsa_toggle_activated, NULL, "false",
+                                  show_statusbar_change_state},
+        {"show-sos-bar",          libbalsa_toggle_activated, NULL, "false",
+                                  show_sos_bar_change_state},
+        {"wrap",                  libbalsa_toggle_activated, NULL, "false",
+                                  wrap_change_state},
+        {"headers",               libbalsa_radio_activated, "s", "'none'",
+                                  header_change_state},
+        {"threading",             libbalsa_radio_activated, "s", "'flat'",
+                                  threading_change_state},
+        {"expand-all",            expand_all_activated},
+        {"collapse-all",          collapse_all_activated},
 #ifdef HAVE_HTML_WIDGET
-    {"zoom-in", zoom_in_activated},
-    {"zoom-out", zoom_out_activated},
-    {"zoom-normal", zoom_normal_activated},
-#endif                          /* HAVE_HTML_WIDGET */
-    {"next-message", next_message_activated},
-    {"previous-message", previous_message_activated},
-    {"next-unread", next_unread_activated},
-    {"next-flagged", next_flagged_activated},
-    {"hide-deleted", libbalsa_toggle_activated, NULL, "false",
-     hide_change_state},
-    {"hide-undeleted", libbalsa_toggle_activated, NULL, "false",
-     hide_change_state},
-    {"hide-read", libbalsa_toggle_activated, NULL, "false",
-     hide_change_state},
-    {"hide-unread", libbalsa_toggle_activated, NULL, "false",
-     hide_change_state},
-    {"hide-flagged", libbalsa_toggle_activated, NULL, "false",
-     hide_change_state},
-    {"hide-unflagged", libbalsa_toggle_activated, NULL, "false",
-     hide_change_state},
-    {"hide-answered", libbalsa_toggle_activated, NULL, "false",
-     hide_change_state},
-    {"hide-unanswered", libbalsa_toggle_activated, NULL, "false",
-     hide_change_state},
-    {"reset-filter", reset_filter_activated},
-    {"mailbox-select-all", mailbox_select_all_activated},
-    {"mailbox-edit", mailbox_edit_activated},
-    {"mailbox-delete", mailbox_delete_activated},
-    {"mailbox-expunge", mailbox_expunge_activated},
-    {"mailbox-close", mailbox_close_activated},
-    {"empty-trash", empty_trash_activated},
-    {"select-filters", select_filters_activated},
-    {"remove-duplicates", remove_duplicates_activated},
-    {"reply", reply_activated},
-    {"reply-all", reply_all_activated},
-    {"reply-group", reply_group_activated},
-    {"forward-attached", forward_attached_activated},
-    {"forward-inline", forward_inline_activated},
-    {"pipe", pipe_activated},
-    {"next-part", next_part_activated},
-    {"previous-part", previous_part_activated},
-    {"save-part", save_part_activated},
-    {"view-source", view_source_activated},
-    {"copy-message", copy_message_activated},
-    {"select-text", select_text_activated},
-    {"move-to-trash", move_to_trash_activated},
-    {"toggle-flagged", toggle_flagged_activated},
-    {"toggle-deleted", toggle_deleted_activated},
-    {"toggle-new", toggle_new_activated},
-    {"toggle-answered", toggle_answered_activated},
-    {"store-address", store_address_activated},
-    /* toolbar actions that are not in any menu: */
-    {"show-all-headers", libbalsa_toggle_activated, NULL, "false",
-     show_all_headers_change_state},
-    {"show-preview-pane", libbalsa_toggle_activated, NULL, "true",
-     show_preview_pane_change_state},
-};
+        {"zoom-in",               zoom_in_activated},
+        {"zoom-out",              zoom_out_activated},
+        {"zoom-normal",           zoom_normal_activated},
+#endif                         /* HAVE_HTML_WIDGET */
+        {"next-message",          next_message_activated},
+        {"previous-message",      previous_message_activated},
+        {"next-unread",           next_unread_activated},
+        {"next-flagged",          next_flagged_activated},
+        {"hide-deleted",          libbalsa_toggle_activated, NULL, "false",
+                                  hide_change_state},
+        {"hide-undeleted",        libbalsa_toggle_activated, NULL, "false",
+                                  hide_change_state},
+        {"hide-read",             libbalsa_toggle_activated, NULL, "false",
+                                  hide_change_state},
+        {"hide-unread",           libbalsa_toggle_activated, NULL, "false",
+                                  hide_change_state},
+        {"hide-flagged",          libbalsa_toggle_activated, NULL, "false",
+                                  hide_change_state},
+        {"hide-unflagged",        libbalsa_toggle_activated, NULL, "false",
+                                  hide_change_state},
+        {"hide-answered",         libbalsa_toggle_activated, NULL, "false",
+                                  hide_change_state},
+        {"hide-unanswered",       libbalsa_toggle_activated, NULL, "false",
+                                  hide_change_state},
+        {"reset-filter",          reset_filter_activated},
+        {"mailbox-select-all",    mailbox_select_all_activated},
+        {"mailbox-edit",          mailbox_edit_activated},
+        {"mailbox-delete",        mailbox_delete_activated},
+        {"mailbox-expunge",       mailbox_expunge_activated},
+        {"mailbox-close",         mailbox_close_activated},
+        {"empty-trash",           empty_trash_activated},
+        {"select-filters",        select_filters_activated},
+        {"remove-duplicates",     remove_duplicates_activated},
+        {"reply",                 reply_activated},
+        {"reply-all",             reply_all_activated},
+        {"reply-group",           reply_group_activated},
+        {"forward-attached",      forward_attached_activated},
+        {"forward-inline",        forward_inline_activated},
+        {"pipe",                  pipe_activated},
+        {"next-part",             next_part_activated},
+        {"previous-part",         previous_part_activated},
+        {"save-part",             save_part_activated},
+        {"view-source",           view_source_activated},
+        {"copy-message",          copy_message_activated},
+        {"select-text",           select_text_activated},
+        {"move-to-trash",         move_to_trash_activated},
+        {"toggle-flagged",        toggle_flagged_activated},
+        {"toggle-deleted",        toggle_deleted_activated},
+        {"toggle-new",            toggle_new_activated},
+        {"toggle-answered",       toggle_answered_activated},
+        {"store-address",         store_address_activated},
+        /* toolbar actions that are not in any menu: */
+        {"show-all-headers",      libbalsa_toggle_activated, NULL, "false",
+                                  show_all_headers_change_state},
+        {"show-preview-pane",     libbalsa_toggle_activated, NULL, "true",
+                                  show_preview_pane_change_state},
+    };
 
 static void
-bw_add_win_action_entries(GActionMap *action_map)
+bw_add_win_action_entries(GActionMap * action_map)
 {
     g_action_map_add_action_entries(action_map, win_entries,
                                     G_N_ELEMENTS(win_entries), action_map);
 }
 
-
 void
-balsa_window_add_action_entries(GActionMap *action_map)
+balsa_window_add_action_entries(GActionMap * action_map)
 {
     bw_add_app_action_entries(action_map, NULL);
     bw_add_win_action_entries(action_map);
 }
 
-
 static void
-bw_set_menus(BalsaWindow *window)
+bw_set_menus(BalsaWindow * window)
 {
     GtkBuilder *builder;
     gchar *ui_file;
@@ -2248,11 +2057,11 @@ bw_set_menus(BalsaWindow *window)
 #endif /* SET_MENUBAR_SETS_A_VISIBLE_MENUBAR */
         gtk_application_set_app_menu(balsa_app.application,
                                      G_MENU_MODEL(gtk_builder_get_object
-                                                      (builder, "app-menu")));
+                                                  (builder, "app-menu")));
 #ifdef SET_MENUBAR_SETS_A_VISIBLE_MENUBAR
         gtk_application_set_menubar(balsa_app.application,
                                     G_MENU_MODEL(gtk_builder_get_object
-                                                     (builder, "menubar")));
+                                                 (builder, "menubar")));
 #else /* SET_MENUBAR_SETS_A_VISIBLE_MENUBAR */
         menubar = libbalsa_window_get_menu_bar(GTK_APPLICATION_WINDOW(window),
                                                win_entries,
@@ -2262,11 +2071,11 @@ bw_set_menus(BalsaWindow *window)
             g_print("%s %s\n", __func__, err->message);
             g_error_free(err);
         } else {
-#   if HAVE_MACOSX_DESKTOP
+#if HAVE_MACOSX_DESKTOP
             libbalsa_macosx_menu(window, GTK_MENU_SHELL(menubar));
-#   else
+#else
             gtk_box_pack_start(GTK_BOX(window->vbox), menubar);
-#   endif
+#endif
         }
 #endif /* SET_MENUBAR_SETS_A_VISIBLE_MENUBAR */
 
@@ -2282,7 +2091,6 @@ bw_set_menus(BalsaWindow *window)
     g_object_unref(builder);
 }
 
-
 /*
  * Implement <alt>n to switch to the n'th mailbox tab
  * (n = 1, 2, ..., 9);
@@ -2295,8 +2103,8 @@ bw_set_menus(BalsaWindow *window)
  */
 
 static void
-bw_alt_n_cb(GtkAccelGroup  *accel_group,
-            GObject        *acceleratable,
+bw_alt_n_cb(GtkAccelGroup * accel_group,
+            GObject       * acceleratable,
             guint           keyval,
             GdkModifierType modifier,
             gpointer        user_data)
@@ -2307,9 +2115,8 @@ bw_alt_n_cb(GtkAccelGroup  *accel_group,
                                   keyval - GDK_KEY_1);
 }
 
-
 static void
-bw_set_alt_bindings(BalsaWindow *window)
+bw_set_alt_bindings(BalsaWindow * window)
 {
     GtkAccelGroup *accel_group;
     gint i;
@@ -2332,7 +2139,6 @@ bw_set_alt_bindings(BalsaWindow *window)
     gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
 }
 
-
 /*
  * lists of actions that are enabled or disabled as groups
  */
@@ -2384,13 +2190,11 @@ static const gchar *const current_message_actions[] = {
  * Callback for the mblist's "has-unread-mailbox" signal
  */
 static void
-bw_enable_next_unread(BalsaWindow *window,
-                      gboolean     has_unread_mailbox)
+bw_enable_next_unread(BalsaWindow * window, gboolean has_unread_mailbox)
 {
     bw_action_set_enabled(window, "next-unread", has_unread_mailbox);
 }
 
-
 GtkWidget *
 balsa_window_new()
 {
@@ -2398,9 +2202,7 @@ balsa_window_new()
     BalsaToolbarModel *model;
     GtkWidget *hbox;
     static const gchar *const header_targets[] =
-    {
-        "none", "selected", "all"
-    };
+        { "none", "selected", "all" };
 #if HAVE_MACOSX_DESKTOP
     IgeMacMenuGroup *group;
 #endif
@@ -2453,9 +2255,8 @@ balsa_window_new()
     gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
     gtk_window_set_default_size(GTK_WINDOW(window), balsa_app.mw_width,
                                 balsa_app.mw_height);
-    if (balsa_app.mw_maximized) {
+    if (balsa_app.mw_maximized)
         gtk_window_maximize(GTK_WINDOW(window));
-    }
 
     window->notebook = gtk_notebook_new();
     gtk_notebook_set_show_tabs(GTK_NOTEBOOK(window->notebook),
@@ -2477,7 +2278,7 @@ balsa_window_new()
                      G_CALLBACK (bw_notebook_drag_motion_cb), NULL);
     balsa_app.notebook = window->notebook;
     g_object_add_weak_pointer(G_OBJECT(window->notebook),
-                              (gpointer) & balsa_app.notebook);
+                             (gpointer) &balsa_app.notebook);
 
     window->preview = balsa_message_new();
     gtk_widget_hide(window->preview);
@@ -2486,7 +2287,7 @@ balsa_window_new()
                      G_CALLBACK(bw_select_part_cb), window);
 
     /* XXX */
-    balsa_app.mblist = BALSA_MBLIST(balsa_mblist_new());
+    balsa_app.mblist =  BALSA_MBLIST(balsa_mblist_new());
 
     g_object_get(G_OBJECT(balsa_app.mblist), "hadjustment", &hadj,
                  "vadjustment", &vadj, NULL);
@@ -2497,7 +2298,7 @@ balsa_window_new()
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(window->mblist),
                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
     g_signal_connect_swapped(balsa_app.mblist, "has-unread-mailbox",
-                             G_CALLBACK(bw_enable_next_unread), window);
+                            G_CALLBACK(bw_enable_next_unread), window);
     balsa_mblist_default_signal_bindings(balsa_app.mblist);
 
     bw_set_panes(window);
@@ -2514,13 +2315,12 @@ balsa_window_new()
     }
 
     /*PKGW: do it this way, without the usizes. */
-    if (balsa_app.previewpane) {
+    if (balsa_app.previewpane)
         gtk_paned_set_position(GTK_PANED(window->paned_slave),
                                balsa_app.notebook_height);
-    } else {
+    else
         /* Set it to something really high */
         gtk_paned_set_position(GTK_PANED(window->paned_slave), G_MAXINT);
-    }
 
     /* set the toolbar style */
     balsa_window_refresh(window);
@@ -2550,7 +2350,7 @@ balsa_window_new()
     bw_enable_message_menus(window, 0);
 #ifdef HAVE_HTML_WIDGET
     bw_enable_view_menus(window, NULL);
-#endif                          /* HAVE_HTML_WIDGET */
+#endif                         /* HAVE_HTML_WIDGET */
     balsa_window_enable_continue(window);
 
     /* set initial state of toggle preview pane button */
@@ -2578,7 +2378,6 @@ balsa_window_new()
     return GTK_WIDGET(window);
 }
 
-
 gboolean
 balsa_window_fix_paned(BalsaWindow *window)
 {
@@ -2599,14 +2398,12 @@ balsa_window_fix_paned(BalsaWindow *window)
     return FALSE;
 }
 
-
 /*
  * Enable or disable menu items/toolbar buttons which depend
  * on whether there is a mailbox open.
  */
 static void
-bw_enable_expand_collapse(BalsaWindow     *window,
-                          LibBalsaMailbox *mailbox)
+bw_enable_expand_collapse(BalsaWindow * window, LibBalsaMailbox * mailbox)
 {
     gboolean enable;
 
@@ -2617,7 +2414,6 @@ bw_enable_expand_collapse(BalsaWindow     *window,
     bw_action_set_enabled(window, "collapse-all", enable);
 }
 
-
 /*
  * bw_next_unread_mailbox: look for the next mailbox with unread mail,
  * starting at current_mailbox; if no later mailbox has unread messages
@@ -2626,15 +2422,14 @@ bw_enable_expand_collapse(BalsaWindow     *window,
  */
 
 static LibBalsaMailbox *
-bw_next_unread_mailbox(LibBalsaMailbox *current_mailbox)
+bw_next_unread_mailbox(LibBalsaMailbox * current_mailbox)
 {
     GList *unread, *list;
     LibBalsaMailbox *next_mailbox;
 
     unread = balsa_mblist_find_all_unread_mboxes(current_mailbox);
-    if (!unread) {
+    if (!unread)
         return NULL;
-    }
 
     list = g_list_find(unread, NULL);
     next_mailbox = list && list->next ? list->next->data : unread->data;
@@ -2644,10 +2439,8 @@ bw_next_unread_mailbox(LibBalsaMailbox *current_mailbox)
     return next_mailbox;
 }
 
-
 static void
-bw_enable_mailbox_menus(BalsaWindow *window,
-                        BalsaIndex  *index)
+bw_enable_mailbox_menus(BalsaWindow * window, BalsaIndex * index)
 {
     LibBalsaMailbox *mailbox = NULL;
     BalsaMailboxNode *mbnode = NULL;
@@ -2659,7 +2452,7 @@ bw_enable_mailbox_menus(BalsaWindow *window,
         mailbox = mbnode->mailbox;
     }
     bw_action_set_enabled(window, "mailbox-expunge",
-                          /* cppcheck-suppress nullPointer */
+    /* cppcheck-suppress nullPointer */
                           mailbox && !mailbox->readonly);
 
     bw_actions_set_enabled(window, mailbox_actions,
@@ -2673,11 +2466,11 @@ bw_enable_mailbox_menus(BalsaWindow *window,
                           libbalsa_mailbox_can_move_duplicates(mailbox));
 
     if (mailbox) {
-        bw_set_threading_menu(window,
-                              libbalsa_mailbox_get_threading_type
-                                  (mailbox));
-        bw_set_filter_menu(window,
-                           libbalsa_mailbox_get_filter(mailbox));
+       bw_set_threading_menu(window,
+                                       libbalsa_mailbox_get_threading_type
+                                       (mailbox));
+       bw_set_filter_menu(window,
+                                    libbalsa_mailbox_get_filter(mailbox));
     }
 
     bw_enable_next_unread(window, libbalsa_mailbox_get_unread(mailbox) > 0
@@ -2686,26 +2479,23 @@ bw_enable_mailbox_menus(BalsaWindow *window,
     bw_enable_expand_collapse(window, mailbox);
 }
 
-
 void
-balsa_window_update_book_menus(BalsaWindow *window)
+balsa_window_update_book_menus(BalsaWindow * window)
 {
     gboolean has_books = balsa_app.address_book_list != NULL;
 
-    bw_action_set_enabled(window, "address-book", has_books);
+    bw_action_set_enabled(window, "address-book",  has_books);
     bw_action_set_enabled(window, "store-address", has_books &&
                           window->current_index &&
                           BALSA_INDEX(window->current_index)->current_msgno);
 }
 
-
 /*
  * Enable or disable menu items/toolbar buttons which depend
  * on if there is a message selected.
  */
 static void
-bw_enable_message_menus(BalsaWindow *window,
-                        guint        msgno)
+bw_enable_message_menus(BalsaWindow * window, guint msgno)
 {
     gboolean enable, enable_mod, enable_store;
     BalsaIndex *bindex = BALSA_INDEX(window->current_index);
@@ -2730,16 +2520,14 @@ bw_enable_message_menus(BalsaWindow *window,
     balsa_window_enable_continue(window);
 }
 
-
 /*
  * Called when the current part has changed: Enable/disable the copy
  * and select all buttons
  */
 static void
-bw_enable_edit_menus(BalsaWindow  *window,
-                     BalsaMessage *bm)
+bw_enable_edit_menus(BalsaWindow * window, BalsaMessage * bm)
 {
-    static const gchar *const edit_actions[] = {
+    static const gchar * const edit_actions[] = {
         "copy", "copy-message", "select-text"
     };
     gboolean enable = (bm && balsa_message_can_select(bm));
@@ -2748,19 +2536,17 @@ bw_enable_edit_menus(BalsaWindow  *window,
                            G_N_ELEMENTS(edit_actions), enable);
 #ifdef HAVE_HTML_WIDGET
     bw_enable_view_menus(window, bm);
-#endif                          /* HAVE_HTML_WIDGET */
+#endif                         /* HAVE_HTML_WIDGET */
 }
 
-
 #ifdef HAVE_HTML_WIDGET
 /*
  * Enable/disable the Zoom menu items on the View menu.
  */
 static void
-bw_enable_view_menus(BalsaWindow  *window,
-                     BalsaMessage *bm)
+bw_enable_view_menus(BalsaWindow * window, BalsaMessage * bm)
 {
-    static const gchar *const zoom_actions[] = {
+    static const gchar * const zoom_actions[] = {
         "zoom-in", "zoom-out", "zoom-normal"
     };
     gboolean enable = bm && balsa_message_can_zoom(bm);
@@ -2768,9 +2554,7 @@ bw_enable_view_menus(BalsaWindow  *window,
     bw_actions_set_enabled(window, zoom_actions,
                            G_N_ELEMENTS(zoom_actions), enable);
 }
-
-
-#endif                          /* HAVE_HTML_WIDGET */
+#endif                         /* HAVE_HTML_WIDGET */
 
 /*
  * Enable/disable menu items/toolbar buttons which depend
@@ -2782,34 +2566,29 @@ bw_enable_view_menus(BalsaWindow  *window,
  * items, or to open the trash folder and get the message count.
  */
 void
-enable_empty_trash(BalsaWindow *window,
-                   TrashState   status)
+enable_empty_trash(BalsaWindow * window, TrashState status)
 {
     gboolean set = TRUE;
     if (MAILBOX_OPEN(balsa_app.trash)) {
         set = libbalsa_mailbox_total_messages(balsa_app.trash) > 0;
     } else {
-        switch (status) {
+        switch(status) {
         case TRASH_CHECK:
             /* Check msg count in trash; this may be expensive...
              * lets just enable empty trash to be on the safe side */
 #if CAN_DO_MAILBOX_OPENING_VERY_VERY_FAST
             if (balsa_app.trash) {
                 libbalsa_mailbox_open(balsa_app.trash);
-                set = libbalsa_mailbox_total_messages(balsa_app.trash) > 0;
+               set = libbalsa_mailbox_total_messages(balsa_app.trash) > 0;
                 libbalsa_mailbox_close(balsa_app.trash);
-            } else {
-                set = TRUE;
-            }
+            } else set = TRUE;
 #else
             set = TRUE;
 #endif
             break;
-
         case TRASH_FULL:
             set = TRUE;
             break;
-
         case TRASH_EMPTY:
             set = FALSE;
             break;
@@ -2818,16 +2597,14 @@ enable_empty_trash(BalsaWindow *window,
     bw_action_set_enabled(window, "empty-trash", set);
 }
 
-
 /*
  * Enable/disable the continue buttons
  */
 void
-balsa_window_enable_continue(BalsaWindow *window)
+balsa_window_enable_continue(BalsaWindow * window)
 {
-    if (!window) {
-        return;
-    }
+    if (!window)
+       return;
 
     /* Check msg count in draftbox */
     if (balsa_app.draftbox) {
@@ -2848,9 +2625,8 @@ balsa_window_enable_continue(BalsaWindow *window)
     }
 }
 
-
 static void
-bw_enable_part_menu_items(BalsaWindow *window)
+bw_enable_part_menu_items(BalsaWindow * window)
 {
     BalsaMessage *msg = window ? BALSA_MESSAGE(window->preview) : NULL;
 
@@ -2860,31 +2636,24 @@ bw_enable_part_menu_items(BalsaWindow *window)
                           balsa_message_has_previous_part(msg));
 }
 
-
 static void
-bw_set_threading_menu(BalsaWindow *window,
-                      int          option)
+bw_set_threading_menu(BalsaWindow * window, int option)
 {
     GtkWidget *index;
     BalsaMailboxNode *mbnode;
     LibBalsaMailbox *mailbox;
-    const gchar *const threading_types[] = {
-        "flat", "simple", "jwz"
-    };
+    const gchar *const threading_types[] = { "flat", "simple", "jwz" };
 
     bw_action_set_string(window, "threading", threading_types[option]);
 
     if ((index = balsa_window_find_current_index(window))
-        && (mbnode = BALSA_INDEX(index)->mailbox_node)
-        && (mailbox = mbnode->mailbox)) {
-        bw_enable_expand_collapse(window, mailbox);
-    }
+       && (mbnode = BALSA_INDEX(index)->mailbox_node)
+       && (mailbox = mbnode->mailbox))
+       bw_enable_expand_collapse(window, mailbox);
 }
 
-
 static void
-bw_set_filter_menu(BalsaWindow *window,
-                   int          mask)
+bw_set_filter_menu(BalsaWindow * window, int mask)
 {
     unsigned i;
 
@@ -2899,25 +2668,21 @@ bw_set_filter_menu(BalsaWindow *window,
     }
 }
 
-
 /*
  * bw_filter_to_int() returns an integer mask representing the view
  * filter, as determined by the check-box widgets.
  */
 static int
-bw_filter_to_int(BalsaWindow *window)
+bw_filter_to_int(BalsaWindow * window)
 {
     unsigned i;
     int res = 0;
-    for (i = 0; i < G_N_ELEMENTS(hide_states); i++) {
-        if (bw_action_get_boolean(window, hide_states[i].action_name)) {
+    for (i = 0; i < G_N_ELEMENTS(hide_states); i++)
+        if (bw_action_get_boolean(window, hide_states[i].action_name))
             res |= 1 << hide_states[i].states_index;
-        }
-    }
     return res;
 }
 
-
 /*
  * bw_get_condition_from_int() returns the LibBalsaCondition corresponding
  * to the filter mask.
@@ -2945,28 +2710,24 @@ bw_get_condition_from_int(gint mask)
     return filter;
 }
 
-
 /* balsa_window_open_mbnode:
    opens mailbox, creates message index. mblist_open_mailbox() is what
    you want most of the time because it can switch between pages if a
    mailbox is already on one of them.
- */
+*/
 void
-balsa_window_open_mbnode(BalsaWindow      *window,
-                         BalsaMailboxNode *mbnode,
-                         gboolean          set_current)
+balsa_window_open_mbnode(BalsaWindow * window, BalsaMailboxNode * mbnode,
+                         gboolean set_current)
 {
     g_return_if_fail(BALSA_IS_WINDOW(window));
     g_assert(BALSA_WINDOW_GET_CLASS(window) != NULL);
 
     BALSA_WINDOW_GET_CLASS(window)->open_mbnode(window, mbnode,
-                                                set_current);
+                                                      set_current);
 }
 
-
 void
-balsa_window_close_mbnode(BalsaWindow      *window,
-                          BalsaMailboxNode *mbnode)
+balsa_window_close_mbnode(BalsaWindow * window, BalsaMailboxNode * mbnode)
 {
     g_return_if_fail(BALSA_IS_WINDOW(window));
     g_assert(BALSA_WINDOW_GET_CLASS(window) != NULL);
@@ -2974,29 +2735,24 @@ balsa_window_close_mbnode(BalsaWindow      *window,
     BALSA_WINDOW_GET_CLASS(window)->close_mbnode(window, mbnode);
 }
 
-
 static void
-bw_notebook_label_style(GtkLabel *lab,
-                        gboolean  has_unread_messages)
+bw_notebook_label_style(GtkLabel * lab, gboolean has_unread_messages)
 {
     gchar *str = has_unread_messages ?
-        g_strconcat("<b>", gtk_label_get_text(lab), "</b>", NULL) :
-        g_strdup(gtk_label_get_text(lab));
+       g_strconcat("<b>", gtk_label_get_text(lab), "</b>", NULL) :
+       g_strdup(gtk_label_get_text(lab));
     gtk_label_set_markup(lab, str);
     g_free(str);
 }
 
-
 static void
-bw_mailbox_changed(LibBalsaMailbox *mailbox,
-                   GtkLabel        *lab)
+bw_mailbox_changed(LibBalsaMailbox * mailbox, GtkLabel * lab)
 {
     bw_notebook_label_style(lab, libbalsa_mailbox_get_unread(mailbox) > 0);
 }
 
-
 static GtkWidget *
-bw_notebook_label_new(BalsaMailboxNode *mbnode)
+bw_notebook_label_new(BalsaMailboxNode * mbnode)
 {
     GtkWidget *lab;
     GtkWidget *box;
@@ -3013,11 +2769,11 @@ bw_notebook_label_new(BalsaMailboxNode *mbnode)
     gtk_css_provider_load_from_data(css_provider,
                                     "#balsa-notebook-tab-label"
                                     "{"
-                                    "font-weight:normal;"
+                                      "font-weight:normal;"
                                     "}",
                                     -1);
 
-    gtk_style_context_add_provider(gtk_widget_get_style_context(lab),
+    gtk_style_context_add_provider(gtk_widget_get_style_context(lab) ,
                                    GTK_STYLE_PROVIDER(css_provider),
                                    GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
     g_object_unref(css_provider);
@@ -3040,29 +2796,28 @@ bw_notebook_label_new(BalsaMailboxNode *mbnode)
     return box;
 }
 
-
 /*
  * balsa_window_real_open_mbnode
  */
 
 typedef struct {
-    BalsaIndex *index;
+    BalsaIndex       *index;
     BalsaMailboxNode *mbnode;
-    BalsaWindow *window;
-    gchar *message;
-    gboolean set_current;
+    BalsaWindow      *window;
+    gchar            *message;
+    gboolean          set_current;
 } BalsaWindowRealOpenMbnodeInfo;
 
 static gboolean
-bw_real_open_mbnode_idle_cb(BalsaWindowRealOpenMbnodeInfo *info)
-{
-    BalsaIndex *index = info->index;
-    BalsaMailboxNode *mbnode = info->mbnode;
-    BalsaWindow *window = info->window;
-    LibBalsaMailbox *mailbox = mbnode->mailbox;
-    GtkWidget *label;
-    GtkWidget *scroll;
-    gint page_num;
+bw_real_open_mbnode_idle_cb(BalsaWindowRealOpenMbnodeInfo * info)
+{
+    BalsaIndex       *index   = info->index;
+    BalsaMailboxNode *mbnode  = info->mbnode;
+    BalsaWindow      *window  = info->window;
+    LibBalsaMailbox  *mailbox = mbnode->mailbox;
+    GtkWidget        *label;
+    GtkWidget        *scroll;
+    gint              page_num;
     LibBalsaCondition *filter;
 
     if (!window) {
@@ -3075,7 +2830,7 @@ bw_real_open_mbnode_idle_cb(BalsaWindowRealOpenMbnodeInfo *info)
 
     balsa_window_decrease_activity(window, info->message);
     g_object_remove_weak_pointer(G_OBJECT(window),
-                                 (gpointer) & info->window);
+                                 (gpointer) &info->window);
     g_free(info->message);
 
     if (balsa_find_notebook_page_num(mailbox) >= 0) {
@@ -3104,16 +2859,15 @@ bw_real_open_mbnode_idle_cb(BalsaWindowRealOpenMbnodeInfo *info)
     gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(window->notebook),
                                      scroll, TRUE);
 
-    if (info->set_current) {
+    if (info->set_current)
         /* change the page to the newly selected notebook item */
         gtk_notebook_set_current_page(GTK_NOTEBOOK(window->notebook),
                                       page_num);
-    }
 
     bw_register_open_mailbox(mailbox);
     libbalsa_mailbox_set_threading(mailbox,
                                    libbalsa_mailbox_get_threading_type
-                                       (mailbox));
+                                   (mailbox));
 
     filter =
         bw_get_condition_from_int(libbalsa_mailbox_get_filter(mailbox));
@@ -3129,9 +2883,8 @@ bw_real_open_mbnode_idle_cb(BalsaWindowRealOpenMbnodeInfo *info)
     return FALSE;
 }
 
-
 static void
-bw_real_open_mbnode_thread(BalsaWindowRealOpenMbnodeInfo *info)
+bw_real_open_mbnode_thread(BalsaWindowRealOpenMbnodeInfo * info)
 {
     static GMutex open_lock;
     gint try_cnt;
@@ -3146,18 +2899,14 @@ bw_real_open_mbnode_thread(BalsaWindowRealOpenMbnodeInfo *info)
     do {
         g_clear_error(&err);
         successp = libbalsa_mailbox_open(mailbox, &err);
-        if (!balsa_app.main_window) {
+        if (!balsa_app.main_window)
             return;
-        }
 
-        if (successp) {
+        if(successp) break;
+        if(err && err->code != LIBBALSA_MAILBOX_TOOMANYOPEN_ERROR)
             break;
-        }
-        if (err && (err->code != LIBBALSA_MAILBOX_TOOMANYOPEN_ERROR)) {
-            break;
-        }
         balsa_mblist_close_lru_peer_mbx(balsa_app.mblist, mailbox);
-    } while (try_cnt++ < 3);
+    } while(try_cnt++<3);
 
     if (successp) {
         g_idle_add((GSourceFunc) bw_real_open_mbnode_idle_cb, info);
@@ -3165,11 +2914,11 @@ bw_real_open_mbnode_thread(BalsaWindowRealOpenMbnodeInfo *info)
         libbalsa_information(
             LIBBALSA_INFORMATION_ERROR,
             _("Unable to Open Mailbox!\n%s."),
-            err ? err->message : _("Unknown error"));
+           err ? err->message : _("Unknown error"));
         if (info->window) {
             balsa_window_decrease_activity(info->window, info->message);
             g_object_remove_weak_pointer(G_OBJECT(info->window),
-                                         (gpointer) & info->window);
+                                         (gpointer) &info->window);
         }
         g_free(info->message);
         g_object_unref(g_object_ref_sink(info->index));
@@ -3179,68 +2928,62 @@ bw_real_open_mbnode_thread(BalsaWindowRealOpenMbnodeInfo *info)
     g_mutex_unlock(&open_lock);
 }
 
-
 static void
-balsa_window_real_open_mbnode(BalsaWindow      *window,
-                              BalsaMailboxNode *mbnode,
-                              gboolean          set_current)
+balsa_window_real_open_mbnode(BalsaWindow * window,
+                              BalsaMailboxNode * mbnode,
+                              gboolean set_current)
 {
-    BalsaIndex *index;
+    BalsaIndex * index;
     gchar *message;
     LibBalsaMailbox *mailbox;
     GThread *open_thread;
     BalsaWindowRealOpenMbnodeInfo *info;
 
-    if (bw_is_open_mailbox(mailbox = mbnode->mailbox)) {
+    if (bw_is_open_mailbox(mailbox = mbnode->mailbox))
         return;
-    }
 
     index = BALSA_INDEX(balsa_index_new());
     balsa_index_set_width_preference
         (index,
-        (balsa_app.layout_type == LAYOUT_WIDE_SCREEN)
-        ? BALSA_INDEX_NARROW : BALSA_INDEX_WIDE);
+         (balsa_app.layout_type == LAYOUT_WIDE_SCREEN)
+         ? BALSA_INDEX_NARROW : BALSA_INDEX_WIDE);
 
     message = g_strdup_printf(_("Opening %s"), mailbox->name);
     balsa_window_increase_activity(window, message);
 
     info = g_new(BalsaWindowRealOpenMbnodeInfo, 1);
     info->window = window;
-    g_object_add_weak_pointer(G_OBJECT(window), (gpointer) & info->window);
+    g_object_add_weak_pointer(G_OBJECT(window), (gpointer) &info->window);
     info->mbnode = g_object_ref(mbnode);
     info->set_current = set_current;
     info->index = index;
     info->message = message;
     open_thread =
-        g_thread_new("bw_real_open_mbnode_thread",
-                     (GThreadFunc) bw_real_open_mbnode_thread,
-                     info);
+       g_thread_new("bw_real_open_mbnode_thread",
+                                (GThreadFunc) bw_real_open_mbnode_thread,
+                                        info);
     g_thread_unref(open_thread);
 }
 
-
 /* balsa_window_real_close_mbnode:
    this function overloads libbalsa_mailbox_close_mailbox.
 
- */
+*/
 static gboolean
-bw_focus_idle(LibBalsaMailbox **mailbox)
+bw_focus_idle(LibBalsaMailbox ** mailbox)
 {
-    if (*mailbox) {
-        g_object_remove_weak_pointer(G_OBJECT(*mailbox), (gpointer) mailbox);
-    }
-    if (balsa_app.mblist_tree_store) {
+    if (*mailbox)
+       g_object_remove_weak_pointer(G_OBJECT(*mailbox), (gpointer) mailbox);
+    if (balsa_app.mblist_tree_store)
         balsa_mblist_focus_mailbox(balsa_app.mblist, *mailbox);
-    }
     g_free(mailbox);
     return FALSE;
 }
 
-
 #define BALSA_INDEX_GRAB_FOCUS "balsa-index-grab-focus"
 static void
-balsa_window_real_close_mbnode(BalsaWindow      *window,
-                               BalsaMailboxNode *mbnode)
+balsa_window_real_close_mbnode(BalsaWindow * window,
+                               BalsaMailboxNode * mbnode)
 {
     GtkWidget *index = NULL;
     gint i;
@@ -3257,8 +3000,8 @@ balsa_window_real_close_mbnode(BalsaWindow      *window,
         /* If this is the last notebook page clear the message preview
            and the status bar */
         if (balsa_app.notebook
-            && (gtk_notebook_get_nth_page(GTK_NOTEBOOK(balsa_app.notebook),
-                                          0) == NULL)) {
+            && gtk_notebook_get_nth_page(GTK_NOTEBOOK(balsa_app.notebook),
+                                         0) == NULL) {
             GtkStatusbar *statusbar;
             guint context_id;
 
@@ -3273,11 +3016,10 @@ balsa_window_real_close_mbnode(BalsaWindow      *window,
             /* Disable menus */
             bw_enable_mailbox_menus(window, NULL);
             bw_enable_message_menus(window, 0);
-            if (window->current_index) {
-                g_object_remove_weak_pointer(G_OBJECT(window->current_index),
-                                             (gpointer)
-                                             & window->current_index);
-            }
+           if (window->current_index)
+               g_object_remove_weak_pointer(G_OBJECT(window->current_index),
+                                            (gpointer)
+                                            &window->current_index);
             window->current_index = NULL;
 
             /* Just in case... */
@@ -3288,15 +3030,13 @@ balsa_window_real_close_mbnode(BalsaWindow      *window,
     index = balsa_window_find_current_index(window);
     mailbox = g_new(LibBalsaMailbox *, 1);
     if (index) {
-        *mailbox = BALSA_INDEX(index)->mailbox_node->mailbox;
-        g_object_add_weak_pointer(G_OBJECT(*mailbox), (gpointer) mailbox);
-    } else {
-        *mailbox = NULL;
-    }
+       *mailbox = BALSA_INDEX(index)->mailbox_node-> mailbox;
+       g_object_add_weak_pointer(G_OBJECT(*mailbox), (gpointer) mailbox);
+    } else
+       *mailbox = NULL;
     g_idle_add((GSourceFunc) bw_focus_idle, mailbox);
 }
 
-
 /* balsa_identities_changed is used to notify the listener list that
    the identities list has changed. */
 void
@@ -3307,20 +3047,17 @@ balsa_identities_changed(BalsaWindow *bw)
     g_signal_emit(bw, window_signals[IDENTITIES_CHANGED], (GQuark) 0);
 }
 
-
 static gboolean
-bw_close_mailbox_on_timer(BalsaWindow *window)
+bw_close_mailbox_on_timer(BalsaWindow * window)
 {
     time_t current_time;
     GtkWidget *page;
     int i, c, delta_time;
 
-    if (!balsa_app.notebook) {
+    if (!balsa_app.notebook)
         return FALSE;
-    }
-    if (!balsa_app.close_mailbox_auto) {
+    if (!balsa_app.close_mailbox_auto)
         return TRUE;
-    }
 
     time(&current_time);
 
@@ -3328,34 +3065,30 @@ bw_close_mailbox_on_timer(BalsaWindow *window)
 
     for (i = 0;
          (page =
-              gtk_notebook_get_nth_page(GTK_NOTEBOOK(balsa_app.notebook), i));
+          gtk_notebook_get_nth_page(GTK_NOTEBOOK(balsa_app.notebook), i));
          i++) {
         BalsaIndex *index = BALSA_INDEX(gtk_bin_get_child(GTK_BIN(page)));
 
-        if (i == c) {
+        if (i == c)
             continue;
-        }
 
         if (balsa_app.close_mailbox_auto &&
-            ((delta_time = current_time - index->mailbox_node->last_use) >
-             balsa_app.close_mailbox_timeout)) {
-            if (balsa_app.debug) {
+            (delta_time = current_time - index->mailbox_node->last_use) >
+            balsa_app.close_mailbox_timeout) {
+            if (balsa_app.debug)
                 fprintf(stderr, "Closing Page %d unused for %d s\n",
                         i, delta_time);
-            }
             balsa_window_real_close_mbnode(window, index->mailbox_node);
-            if (i < c) {
+            if (i < c)
                 c--;
-            }
             i--;
         }
     }
     return TRUE;
 }
 
-
 static void
-balsa_window_dispose(GObject *object)
+balsa_window_dispose(GObject * object)
 {
     BalsaWindow *window;
 
@@ -3377,7 +3110,7 @@ balsa_window_dispose(GObject *object)
  * refresh data in the main window
  */
 void
-balsa_window_refresh(BalsaWindow *window)
+balsa_window_refresh(BalsaWindow * window)
 {
     GtkWidget *index;
     BalsaIndex *bindex;
@@ -3395,119 +3128,100 @@ balsa_window_refresh(BalsaWindow *window)
     }
     if (balsa_app.previewpane) {
         bw_idle_replace(window, bindex);
-        gtk_paned_set_position(GTK_PANED(window->paned_slave),
-                               balsa_app.notebook_height);
+       gtk_paned_set_position(GTK_PANED(window->paned_slave),
+                                balsa_app.notebook_height);
     } else {
-        /* Set the height to something really big (those new hi-res
-           screens and all :) */
-        gtk_paned_set_position(GTK_PANED(window->paned_slave), G_MAXINT);
+       /* Set the height to something really big (those new hi-res
+          screens and all :) */
+       gtk_paned_set_position(GTK_PANED(window->paned_slave), G_MAXINT);
     }
 }
 
-
 /* monitored functions for MT-safe manipulation of the open mailbox list
    QUESTION: could they migrate to balsa-app.c?
- */
+*/
 static GMutex open_list_lock;
 
 static void
 bw_register_open_mailbox(LibBalsaMailbox *m)
 {
-    g_mutex_lock(&open_list_lock);
+       g_mutex_lock(&open_list_lock);
     balsa_app.open_mailbox_list =
         g_list_prepend(balsa_app.open_mailbox_list, m);
     g_mutex_unlock(&open_list_lock);
     libbalsa_mailbox_set_open(m, TRUE);
 }
-
-
 static void
 bw_unregister_open_mailbox(LibBalsaMailbox *m)
 {
-    g_mutex_lock(&open_list_lock);
+       g_mutex_lock(&open_list_lock);
     balsa_app.open_mailbox_list =
         g_list_remove(balsa_app.open_mailbox_list, m);
     g_mutex_unlock(&open_list_lock);
     libbalsa_mailbox_set_open(m, FALSE);
 }
-
-
 static gboolean
 bw_is_open_mailbox(LibBalsaMailbox *m)
 {
     GList *res;
     g_mutex_lock(&open_list_lock);
-    res = g_list_find(balsa_app.open_mailbox_list, m);
+    res= g_list_find(balsa_app.open_mailbox_list, m);
     g_mutex_unlock(&open_list_lock);
     return (res != NULL);
 }
 
-
 /* Check all mailboxes in a list
  *
  */
 static void
-bw_check_mailbox_progress_cb(LibBalsaMailbox *mailbox,
-                             gint             action,
-                             gdouble          fraction,
-                             const gchar     *message)
+bw_check_mailbox_progress_cb(LibBalsaMailbox* mailbox, gint action, gdouble fraction, const gchar *message)
 {
-    gchar *progress_id;
+       gchar *progress_id;
 
-    progress_id = g_strdup_printf("POP3: %s", mailbox->name);
-    if (action == LIBBALSA_NTFY_INIT) {
-        libbalsa_progress_dialog_ensure(&progress_dialog, _("Checking Mail…"),
-                                        GTK_WINDOW(balsa_app.main_window), progress_id);
-    }
-    libbalsa_progress_dialog_update(&progress_dialog,
-                                    progress_id,
-                                    action == LIBBALSA_NTFY_FINISHED,
-                                    fraction,
-                                    "%s",
-                                    message);
-    g_free(progress_id);
+       progress_id = g_strdup_printf("POP3: %s", mailbox->name);
+       if (action == LIBBALSA_NTFY_INIT) {
+               libbalsa_progress_dialog_ensure(&progress_dialog, _("Checking Mail…"), 
GTK_WINDOW(balsa_app.main_window), progress_id);
+       }
+       libbalsa_progress_dialog_update(&progress_dialog, progress_id, action == LIBBALSA_NTFY_FINISHED, 
fraction, "%s", message);
+       g_free(progress_id);
 }
 
-
 static void
 bw_check_mailbox(LibBalsaMailbox *mailbox)
 {
-    libbalsa_mailbox_check(mailbox);
-    g_thread_exit(NULL);
+       libbalsa_mailbox_check(mailbox);
+       g_thread_exit(NULL);
 }
 
-
 typedef struct {
-    LibBalsaMailbox *mailbox;
-    GThread *thread;
-    gulong notify;
+       LibBalsaMailbox *mailbox;
+       GThread *thread;
+       gulong notify;
 } bw_pop_mbox_t;
 
 static void
 bw_check_mailbox_done(bw_pop_mbox_t *bw_pop_mbox)
 {
-    if (bw_pop_mbox->thread != NULL) {
-        g_thread_join(bw_pop_mbox->thread);
-        g_debug("joined thread %p", bw_pop_mbox->thread);
-    }
-    if (bw_pop_mbox->notify > 0U) {
-        g_signal_handler_disconnect(bw_pop_mbox->mailbox, bw_pop_mbox->notify);
-    }
-    g_object_unref(bw_pop_mbox->mailbox);
+       if (bw_pop_mbox->thread != NULL) {
+               g_thread_join(bw_pop_mbox->thread);
+               g_debug("joined thread %p", bw_pop_mbox->thread);
+       }
+       if (bw_pop_mbox->notify > 0U) {
+               g_signal_handler_disconnect(bw_pop_mbox->mailbox, bw_pop_mbox->notify);
+       }
+       g_object_unref(bw_pop_mbox->mailbox);
 }
 
-
 static void
-bw_check_mailbox_list(struct check_messages_thread_info *info,
-                      GList                             *mailbox_list)
+bw_check_mailbox_list(struct check_messages_thread_info *info, GList *mailbox_list)
 {
-    GList *check_mbx = NULL;
+       GList *check_mbx = NULL;
 
     if ((info->window != NULL) && !info->window->network_available) {
         return;
     }
 
-    for (; mailbox_list; mailbox_list = mailbox_list->next) {
+    for ( ; mailbox_list; mailbox_list = mailbox_list->next) {
         LibBalsaMailbox *mailbox = BALSA_MAILBOX_NODE(mailbox_list->data)->mailbox;
         LibBalsaMailboxPop3 *pop3 = LIBBALSA_MAILBOX_POP3(mailbox);
         bw_pop_mbox_t *bw_pop_mbox;
@@ -3517,31 +3231,24 @@ bw_check_mailbox_list(struct check_messages_thread_info *info,
         libbalsa_mailbox_pop3_set_inbox(mailbox, balsa_app.inbox);
         libbalsa_mailbox_pop3_set_msg_size_limit(pop3, balsa_app.msg_size_limit * 1024);
         if (info->with_progress_dialog) {
-            bw_pop_mbox->notify =
-                g_signal_connect(G_OBJECT(mailbox), "progress-notify",
-                                 G_CALLBACK(bw_check_mailbox_progress_cb), mailbox);
+               bw_pop_mbox->notify =
+                       g_signal_connect(G_OBJECT(mailbox), "progress-notify", 
G_CALLBACK(bw_check_mailbox_progress_cb), mailbox);
         }
         bw_pop_mbox->thread = g_thread_new(NULL, (GThreadFunc) bw_check_mailbox, mailbox);
-        g_debug("launched thread %p for checking POP3 mailbox %s",
-                bw_pop_mbox->thread,
-                mailbox->name);
+        g_debug("launched thread %p for checking POP3 mailbox %s", bw_pop_mbox->thread, mailbox->name);
         check_mbx = g_list_prepend(check_mbx, bw_pop_mbox);
     }
 
-    /* join all threads, i.e. proceed only after all threads have finished, and disconnect
-       progress notify handlers */
+    /* join all threads, i.e. proceed only after all threads have finished, and disconnect progress notify 
handlers */
     g_list_foreach(check_mbx, (GFunc) bw_check_mailbox_done, NULL);
     g_debug("all POP3 mailbox threads done");
     g_list_free_full(check_mbx, (GDestroyNotify) g_free);
 }
 
-
 /*Callback to check a mailbox in a balsa-mblist */
 static gboolean
-bw_add_mbox_to_checklist(GtkTreeModel *model,
-                         GtkTreePath  *path,
-                         GtkTreeIter  *iter,
-                         GSList      **list)
+bw_add_mbox_to_checklist(GtkTreeModel * model, GtkTreePath * path,
+                         GtkTreeIter * iter, GSList ** list)
 {
     BalsaMailboxNode *mbnode;
     LibBalsaMailbox *mailbox;
@@ -3549,29 +3256,27 @@ bw_add_mbox_to_checklist(GtkTreeModel *model,
     gtk_tree_model_get(model, iter, 0, &mbnode, -1);
     g_return_val_if_fail(mbnode, FALSE);
 
-    if ((mailbox = mbnode->mailbox)) {  /* mailbox, not a folder */
-        if (!LIBBALSA_IS_MAILBOX_IMAP(mailbox) ||
-            bw_imap_check_test(mbnode->dir ? mbnode->dir :
-                               libbalsa_mailbox_imap_get_path
-                                   (LIBBALSA_MAILBOX_IMAP(mailbox)))) {
-            *list = g_slist_prepend(*list, g_object_ref(mailbox));
-        }
+    if ((mailbox = mbnode->mailbox)) { /* mailbox, not a folder */
+       if (!LIBBALSA_IS_MAILBOX_IMAP(mailbox) ||
+           bw_imap_check_test(mbnode->dir ? mbnode->dir :
+                           libbalsa_mailbox_imap_get_path
+                           (LIBBALSA_MAILBOX_IMAP(mailbox))))
+           *list = g_slist_prepend(*list, g_object_ref(mailbox));
     }
     g_object_unref(mbnode);
 
     return FALSE;
 }
 
-
 /*
  * Callback for testing whether to check an IMAP mailbox
  */
 static gboolean
-bw_imap_check_test(const gchar *path)
+bw_imap_check_test(const gchar * path)
 {
     /* path has been parsed, so it's just the folder path */
     return balsa_app.check_imap && balsa_app.check_imap_inbox ?
-           strcmp(path, "INBOX") == 0 : balsa_app.check_imap;
+        strcmp(path, "INBOX") == 0 : balsa_app.check_imap;
 }
 
 
@@ -3582,55 +3287,51 @@ bw_imap_check_test(const gchar *path)
 /* bw_check_new_messages:
    check new messages the data argument is the BalsaWindow pointer
    or NULL.
- */
+*/
 void
-check_new_messages_real(BalsaWindow *window,
-                        gboolean     background_check)
+check_new_messages_real(BalsaWindow * window, gboolean background_check)
 {
     GSList *list;
     struct check_messages_thread_info *info;
     GThread *get_mail_thread;
 
-    if (window && !BALSA_IS_WINDOW(window)) {
+    if (window && !BALSA_IS_WINDOW(window))
         return;
-    }
 
     list = NULL;
     /*  Only Run once -- If already checking mail, return.  */
     if (!g_atomic_int_dec_and_test(&checking_mail)) {
-        g_atomic_int_inc(&checking_mail);
+       g_atomic_int_inc(&checking_mail);
         g_debug("Already Checking Mail!");
         g_mutex_lock(&progress_dialog.mutex);
         if (progress_dialog.dialog != NULL) {
-            gtk_window_present(GTK_WINDOW(progress_dialog.dialog));
+               gtk_window_present(GTK_WINDOW(progress_dialog.dialog));
         }
         g_mutex_unlock(&progress_dialog.mutex);
         return;
     }
 
-    if (window) {
+    if (window)
         bw_action_set_enabled(window, "get-new-mail", FALSE);
-    }
 
     gtk_tree_model_foreach(GTK_TREE_MODEL(balsa_app.mblist_tree_store),
-                           (GtkTreeModelForeachFunc) bw_add_mbox_to_checklist,
-                           &list);
+                          (GtkTreeModelForeachFunc) bw_add_mbox_to_checklist,
+                          &list);
 
     /* initiate thread */
     info = g_new(struct check_messages_thread_info, 1);
     info->list = list;
     info->with_progress_dialog = !background_check && balsa_app.recv_progress_dialog;
     info->window = window ? g_object_ref(window) : window;
-    info->with_activity_bar = background_check && !balsa_app.quiet_background_check &&
-        (info->window != NULL);
-    if (info->with_activity_bar) {
-        balsa_window_increase_activity(info->window, _("Checking Mail…"));
-    }
+    info->with_activity_bar = background_check && !balsa_app.quiet_background_check && (info->window != 
NULL);
+       if (info->with_activity_bar) {
+               balsa_window_increase_activity(info->window, _("Checking Mail…"));
+       }
 
     get_mail_thread =
-        g_thread_new("bw_check_messages_thread",
-                     (GThreadFunc) bw_check_messages_thread,
-                     info);
+       g_thread_new("bw_check_messages_thread",
+                                (GThreadFunc) bw_check_messages_thread,
+                                        info);
 
     /* Detach so we don't need to g_thread_join
      * This means that all resources will be
@@ -3639,7 +3340,6 @@ check_new_messages_real(BalsaWindow *window,
     g_thread_unref(get_mail_thread);
 }
 
-
 static void
 bw_check_new_messages(gpointer data)
 {
@@ -3651,13 +3351,11 @@ bw_check_new_messages(gpointer data)
     }
 }
 
-
 /** Saves the number of messages as the most recent one the user is
     aware of. If the number has changed since last checking and
     notification was requested, do notify the user as well.  */
 void
-check_new_messages_count(LibBalsaMailbox *mailbox,
-                         gboolean         notify)
+check_new_messages_count(LibBalsaMailbox * mailbox, gboolean notify)
 {
     struct count_info {
         gint unread_messages;
@@ -3676,58 +3374,51 @@ check_new_messages_count(LibBalsaMailbox *mailbox,
         gint num_new, has_new;
 
         num_new = mailbox->unread_messages - info->unread_messages;
-        if (num_new < 0) {
+        if (num_new < 0)
             num_new = 0;
-        }
         has_new = mailbox->has_unread_messages - info->has_unread_messages;
-        if (has_new < 0) {
+        if (has_new < 0)
             has_new = 0;
-        }
 
-        if (num_new || has_new) {
-            bw_display_new_mail_notification(num_new, has_new);
-        }
+        if (num_new || has_new)
+           bw_display_new_mail_notification(num_new, has_new);
     }
 
     info->unread_messages = mailbox->unread_messages;
     info->has_unread_messages = mailbox->has_unread_messages;
 }
 
-
 /* this one is called only in the threaded code */
 static void
-bw_mailbox_check(LibBalsaMailbox                   *mailbox,
-                 struct check_messages_thread_info *info)
+bw_mailbox_check(LibBalsaMailbox * mailbox, struct check_messages_thread_info *info)
 {
-    if (libbalsa_mailbox_get_subscribe(mailbox) == LB_MAILBOX_SUBSCRIBE_NO) {
+    if (libbalsa_mailbox_get_subscribe(mailbox) == LB_MAILBOX_SUBSCRIBE_NO)
         return;
-    }
 
     g_debug("checking mailbox %s", mailbox->name);
     if (LIBBALSA_IS_MAILBOX_IMAP(mailbox)) {
-        if ((info->window != NULL) && !info->window->network_available) {
-            return;
-        }
-
-        if (info->with_progress_dialog) {
-            libbalsa_progress_dialog_update(&progress_dialog, _("Mailboxes"), FALSE, INFINITY,
-                                            _("IMAP mailbox: %s"), mailbox->url);
-        }
+       if ((info->window != NULL) && !info->window->network_available) {
+               return;
+       }
+
+       if (info->with_progress_dialog) {
+               libbalsa_progress_dialog_update(&progress_dialog, _("Mailboxes"), FALSE, INFINITY,
+                       _("IMAP mailbox: %s"), mailbox->url);
+       }
     } else if (LIBBALSA_IS_MAILBOX_LOCAL(mailbox)) {
-        if (info->with_progress_dialog) {
-            libbalsa_progress_dialog_update(&progress_dialog, _("Mailboxes"), FALSE, INFINITY,
-                                            _("Local mailbox: %s"), mailbox->name);
-        }
+       if (info->with_progress_dialog) {
+               libbalsa_progress_dialog_update(&progress_dialog, _("Mailboxes"), FALSE, INFINITY,
+                       _("Local mailbox: %s"), mailbox->name);
+       }
     } else {
-        g_assert_not_reached();
+       g_assert_not_reached();
     }
 
     libbalsa_mailbox_check(mailbox);
 }
 
-
 static gboolean
-bw_check_messages_thread_idle_cb(BalsaWindow *window)
+bw_check_messages_thread_idle_cb(BalsaWindow * window)
 {
     bw_action_set_enabled(window, "get-new-mail", TRUE);
     g_object_unref(window);
@@ -3735,7 +3426,6 @@ bw_check_messages_thread_idle_cb(BalsaWindow *window)
     return FALSE;
 }
 
-
 static void
 bw_check_messages_thread(struct check_messages_thread_info *info)
 {
@@ -3746,32 +3436,30 @@ bw_check_messages_thread(struct check_messages_thread_info *info)
      */
     bw_check_mailbox_list(info, balsa_app.inbox_input);
 
-    if (info->list != NULL) {
+    if (info->list!= NULL) {
         GSList *list = info->list;
 
-        if (info->with_progress_dialog) {
-            libbalsa_progress_dialog_ensure(&progress_dialog, _("Checking Mail…"),
-                                            GTK_WINDOW(info->window), _("Mailboxes"));
-        }
-        g_slist_foreach(list, (GFunc) bw_mailbox_check, info);
-        g_slist_free_full(list, g_object_unref);
-        if (info->with_progress_dialog) {
-            libbalsa_progress_dialog_update(&progress_dialog, _("Mailboxes"), TRUE, 1.0, NULL);
-        }
+       if (info->with_progress_dialog) {
+               libbalsa_progress_dialog_ensure(&progress_dialog, _("Checking Mail…"), 
GTK_WINDOW(info->window), _("Mailboxes"));
+       }
+       g_slist_foreach(list, (GFunc) bw_mailbox_check, info);
+       g_slist_free_full(list, g_object_unref);
+       if (info->with_progress_dialog) {
+               libbalsa_progress_dialog_update(&progress_dialog, _("Mailboxes"), TRUE, 1.0, NULL);
+       }
     }
 
-    if (info->with_activity_bar) {
-        balsa_window_decrease_activity(info->window, _("Checking Mail…"));
-    }
+       if (info->with_activity_bar) {
+               balsa_window_decrease_activity(info->window, _("Checking Mail…"));
+       }
 
     g_atomic_int_inc(&checking_mail);
 
     if (info->window) {
         g_idle_add((GSourceFunc) bw_check_messages_thread_idle_cb,
                    g_object_ref(info->window));
-        if (info->window->network_available) {
+        if (info->window->network_available)
             time(&info->window->last_check_time);
-        }
         g_object_unref(info->window);
     }
 
@@ -3786,42 +3474,36 @@ bw_check_messages_thread(struct check_messages_thread_info *info)
     of messages is known and trusted.
     @param num_total says how many actually new messages are in the
     mailbox.
- */
-static gchar *
-bw_get_new_message_notification_string(int num_new,
-                                       int num_total)
+*/
+static gchar*
+bw_get_new_message_notification_string(int num_new, int num_total)
 {
     return num_new > 0 ?
-           g_strdup_printf(ngettext("You have received %d new message.",
-                                    "You have received %d new messages.",
-                                    num_total), num_total) :
-           g_strdup(_("You have new mail."));
+       g_strdup_printf(ngettext("You have received %d new message.",
+                                "You have received %d new messages.",
+                                num_total), num_total) :
+       g_strdup(_("You have new mail."));
 }
 
-
 /** Informs the user that new mail arrived. num_new is the number of
     the recently arrived messsages.
- */
+*/
 static void
-bw_display_new_mail_notification(int num_new,
-                                 int has_new)
+bw_display_new_mail_notification(int num_new, int has_new)
 {
     GtkWindow *window = GTK_WINDOW(balsa_app.main_window);
     static GtkWidget *dlg = NULL;
     static gint num_total = 0;
     gchar *msg = NULL;
 
-    if ((num_new <= 0) && (has_new <= 0)) {
+    if (num_new <= 0 && has_new <= 0)
         return;
-    }
 
-    if (!gtk_window_is_active(window)) {
+    if (!gtk_window_is_active(window))
         gtk_window_set_urgency_hint(window, TRUE);
-    }
 
-    if (!balsa_app.notify_new_mail_dialog) {
+    if (!balsa_app.notify_new_mail_dialog)
         return;
-    }
 
 #ifdef HAVE_NOTIFY
     /* Before attemtping to use the notifications check whether they
@@ -3829,9 +3511,8 @@ bw_display_new_mail_notification(int num_new,
        dbus could not be created? In any case, we must not continue or
        ugly things will happen, at least with libnotify-0.4.2. */
     if (notify_is_initted()) {
-        if (gtk_window_is_active(window)) {
+        if (gtk_window_is_active(window))
             return;
-        }
 
         if (balsa_app.main_window->new_mail_note) {
             /* the user didn't acknowledge the last info, so we'll
@@ -3839,16 +3520,16 @@ bw_display_new_mail_notification(int num_new,
             num_total += num_new;
         } else {
             num_total = num_new;
-#   if HAVE_NOTIFY >= 7
+#if HAVE_NOTIFY >=7
             balsa_app.main_window->new_mail_note =
                 notify_notification_new("Balsa", NULL, NULL);
             notify_notification_set_hint(balsa_app.main_window->
                                          new_mail_note, "desktop-entry",
                                          g_variant_new_string("balsa"));
-#   else
+#else
             balsa_app.main_window->new_mail_note =
                 notify_notification_new("Balsa", NULL, NULL, NULL);
-#   endif
+#endif
             g_object_add_weak_pointer(G_OBJECT(balsa_app.main_window->
                                                new_mail_note),
                                       (gpointer) & balsa_app.main_window->
@@ -3866,15 +3547,15 @@ bw_display_new_mail_notification(int num_new,
             num_total = num_new;
             dlg = gtk_message_dialog_new(NULL, /* NOT transient for
                                                 * Balsa's main window */
-                                         (GtkDialogFlags) 0,
-                                         GTK_MESSAGE_INFO,
-                                         GTK_BUTTONS_OK, "%s", msg);
+                    (GtkDialogFlags) 0,
+                    GTK_MESSAGE_INFO,
+                    GTK_BUTTONS_OK, "%s", msg);
             gtk_window_set_title(GTK_WINDOW(dlg), _("Balsa: New mail"));
             gtk_window_set_role(GTK_WINDOW(dlg), "new_mail_dialog");
             gtk_window_set_type_hint(GTK_WINDOW(dlg),
-                                     GDK_WINDOW_TYPE_HINT_NORMAL);
+                    GDK_WINDOW_TYPE_HINT_NORMAL);
             g_signal_connect(G_OBJECT(dlg), "response",
-                             G_CALLBACK(gtk_widget_destroy), NULL);
+                    G_CALLBACK(gtk_widget_destroy), NULL);
             g_object_add_weak_pointer(G_OBJECT(dlg), (gpointer) & dlg);
             gtk_widget_show(GTK_WIDGET(dlg));
         }
@@ -3889,9 +3570,8 @@ bw_display_new_mail_notification(int num_new,
                                         new_mail_note, 30000);
         notify_notification_show(balsa_app.main_window->new_mail_note,
                                  NULL);
-    } else {
+    } else
         gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dlg), msg);
-    }
 #else
     if (dlg) {
         /* the user didn't acknowledge the last info, so we'll
@@ -3921,13 +3601,12 @@ bw_display_new_mail_notification(int num_new,
     g_free(msg);
 }
 
-
 /*Callback to create or disconnect an IMAP mbox. */
 
 static void
-mw_mbox_can_reach_cb(GObject *object,
-                     gboolean can_reach,
-                     gpointer user_data)
+mw_mbox_can_reach_cb(GObject * object,
+                     gboolean  can_reach,
+                     gpointer  user_data)
 {
     LibBalsaMailboxImap *mailbox = (LibBalsaMailboxImap *) object;
 
@@ -3940,12 +3619,9 @@ mw_mbox_can_reach_cb(GObject *object,
     g_object_unref(mailbox);
 }
 
-
 static gboolean
-mw_mbox_change_connection_status(GtkTreeModel *model,
-                                 GtkTreePath  *path,
-                                 GtkTreeIter  *iter,
-                                 gpointer      arg)
+mw_mbox_change_connection_status(GtkTreeModel * model, GtkTreePath * path,
+                                 GtkTreeIter * iter, gpointer arg)
 {
     BalsaMailboxNode *mbnode;
     LibBalsaMailbox *mailbox;
@@ -3956,8 +3632,7 @@ mw_mbox_change_connection_status(GtkTreeModel *model,
     if ((mailbox = mbnode->mailbox)) {  /* mailbox, not a folder */
         if (LIBBALSA_IS_MAILBOX_IMAP(mailbox) &&
             bw_imap_check_test(mbnode->dir ? mbnode->dir :
-                               libbalsa_mailbox_imap_get_path(LIBBALSA_MAILBOX_IMAP(mailbox))))
-        {
+                               libbalsa_mailbox_imap_get_path(LIBBALSA_MAILBOX_IMAP(mailbox)))) {
             libbalsa_mailbox_test_can_reach(g_object_ref(mailbox),
                                             mw_mbox_can_reach_cb, NULL);
         }
@@ -3968,17 +3643,16 @@ mw_mbox_change_connection_status(GtkTreeModel *model,
     return FALSE;
 }
 
-
 static void
-bw_change_connection_status_can_reach_cb(GObject *object,
-                                         gboolean can_reach,
-                                         gpointer user_data)
+bw_change_connection_status_can_reach_cb(GObject * object,
+                                         gboolean  can_reach,
+                                         gpointer  user_data)
 {
     BalsaWindow *window = user_data;
 
     if (can_reach &&
-        (difftime(time(NULL), window->last_check_time) >
-         balsa_app.check_mail_timer * 60)) {
+        difftime(time(NULL), window->last_check_time) >
+        balsa_app.check_mail_timer * 60) {
         /* Check the mail now, and reset the timer */
         bw_check_new_messages(window);
     }
@@ -3986,7 +3660,6 @@ bw_change_connection_status_can_reach_cb(GObject *object,
     g_object_unref(window);
 }
 
-
 static gboolean
 bw_change_connection_status_idle(gpointer user_data)
 {
@@ -4000,24 +3673,20 @@ bw_change_connection_status_idle(gpointer user_data)
                            (GtkTreeModelForeachFunc)
                            mw_mbox_change_connection_status, NULL);
 
-    if (!window->network_available) {
+    if (!window->network_available)
         return FALSE;
-    }
 
     /* GLib timeouts are now triggered by g_get_monotonic_time(),
      * which doesn't increment while we're suspended, so we must
      * check for ourselves whether a scheduled mail check was
      * missed. */
     /* Test whether the first POP3 mailbox can be reached */
-    if (balsa_app.inbox_input == NULL) {
+    if (balsa_app.inbox_input == NULL)
         return FALSE;
-    }
-    if ((mbnode = balsa_app.inbox_input->data) == NULL) {
+    if ((mbnode = balsa_app.inbox_input->data) == NULL)
         return FALSE;
-    }
-    if ((mailbox = mbnode->mailbox) == NULL) {
+    if ((mailbox = mbnode->mailbox) == NULL)
         return FALSE;
-    }
 
     libbalsa_mailbox_test_can_reach(mailbox, bw_change_connection_status_can_reach_cb,
                                     g_object_ref(window));
@@ -4025,278 +3694,257 @@ bw_change_connection_status_idle(gpointer user_data)
     return FALSE;
 }
 
-
 GtkWidget *
-balsa_window_find_current_index(BalsaWindow *window)
+balsa_window_find_current_index(BalsaWindow * window)
 {
     g_return_val_if_fail(window != NULL, NULL);
 
     return window->current_index;
 }
 
-
-static GtkToggleButton *
-bw_add_check_button(GtkWidget   *grid,
-                    const gchar *label,
-                    gint         x,
-                    gint         y)
+static GtkToggleButton*
+bw_add_check_button(GtkWidget* grid, const gchar* label, gint x, gint y)
 {
-    GtkWidget *res = gtk_check_button_new_with_mnemonic(label);
+    GtkWidget* res = gtk_check_button_new_with_mnemonic(label);
     gtk_widget_set_hexpand(res, TRUE);
     gtk_grid_attach(GTK_GRID(grid), res, x, y, 1, 1);
     return GTK_TOGGLE_BUTTON(res);
 }
 
-
 enum {
     FIND_RESPONSE_FILTER,
     FIND_RESPONSE_RESET
 };
 
 static void
-bw_find_button_clicked(GtkWidget *widget,
-                       gpointer   data)
+bw_find_button_clicked(GtkWidget * widget, gpointer data)
 {
     GtkWidget *dialog = gtk_widget_get_toplevel(widget);
     gtk_dialog_response(GTK_DIALOG(dialog), GPOINTER_TO_INT(data));
 }
 
-
 static void
-bw_find_real(BalsaWindow *window,
-             BalsaIndex  *bindex,
-             gboolean     again)
+bw_find_real(BalsaWindow * window, BalsaIndex * bindex, gboolean again)
 {
     /* Condition set up for the search, it will be of type
        CONDITION_NONE if nothing has been set up */
-    static LibBalsaCondition *cnd = NULL;
+    static LibBalsaCondition * cnd = NULL;
     static gboolean reverse = FALSE;
-    static gboolean wrap = FALSE;
+    static gboolean wrap    = FALSE;
     static LibBalsaMailboxSearchIter *search_iter = NULL;
 
     if (!cnd) {
-        cnd = libbalsa_condition_new();
-        CONDITION_SETMATCH(cnd, CONDITION_MATCH_FROM);
-        CONDITION_SETMATCH(cnd, CONDITION_MATCH_SUBJECT);
+       cnd = libbalsa_condition_new();
+        CONDITION_SETMATCH(cnd,CONDITION_MATCH_FROM);
+        CONDITION_SETMATCH(cnd,CONDITION_MATCH_SUBJECT);
     }
 
 
     /* first search, so set up the match rule(s) */
-    if (!again || (cnd->type == CONDITION_NONE)) {
-        GtkWidget *vbox, *dia =
+    if (!again || cnd->type==CONDITION_NONE) {
+       GtkWidget* vbox, *dia =
             gtk_dialog_new_with_buttons(_("Search mailbox"),
                                         GTK_WINDOW(window),
                                         GTK_DIALOG_DESTROY_WITH_PARENT |
                                         libbalsa_dialog_flags(),
-                                        _("_Help"), GTK_RESPONSE_HELP,
+                                       _("_Help"),   GTK_RESPONSE_HELP,
                                         _("_Close"), GTK_RESPONSE_CLOSE,
                                         NULL);
-        GtkWidget *reverse_button, *wrap_button;
-        GtkWidget *search_entry, *w, *page, *grid;
-        GtkWidget *frame, *box, *button;
-        GtkToggleButton *matching_body, *matching_from;
+       GtkWidget *reverse_button, *wrap_button;
+       GtkWidget *search_entry, *w, *page, *grid;
+       GtkWidget *frame, *box, *button;
+       GtkToggleButton *matching_body, *matching_from;
         GtkToggleButton *matching_to, *matching_cc, *matching_subject;
-        gint ok;
+       gint ok;
 
 #if HAVE_MACOSX_DESKTOP
-        libbalsa_macosx_menu_for_parent(dia, GTK_WINDOW(window));
+       libbalsa_macosx_menu_for_parent(dia, GTK_WINDOW(window));
 #endif
         vbox = gtk_dialog_get_content_area(GTK_DIALOG(dia));
 
-        page = gtk_grid_new();
+       page=gtk_grid_new();
         gtk_grid_set_row_spacing(GTK_GRID(page), 2);
         gtk_grid_set_column_spacing(GTK_GRID(page), 2);
-        g_object_set(G_OBJECT(page), "margin", 6, NULL);
-        w = gtk_label_new_with_mnemonic(_("_Search for:"));
+       g_object_set(G_OBJECT(page), "margin", 6, NULL);
+       w = gtk_label_new_with_mnemonic(_("_Search for:"));
         gtk_widget_set_hexpand(w, TRUE);
-        gtk_grid_attach(GTK_GRID(page), w, 0, 0, 1, 1);
-        search_entry = gtk_entry_new();
+       gtk_grid_attach(GTK_GRID(page), w, 0, 0, 1, 1);
+       search_entry = gtk_entry_new();
         gtk_entry_set_max_length(GTK_ENTRY(search_entry), 30);
         gtk_widget_set_hexpand(search_entry, TRUE);
-        gtk_grid_attach(GTK_GRID(page), search_entry, 1, 0, 1, 1);
-        gtk_label_set_mnemonic_widget(GTK_LABEL(w), search_entry);
+       gtk_grid_attach(GTK_GRID(page),search_entry,1, 0, 1, 1);
+       gtk_label_set_mnemonic_widget(GTK_LABEL(w), search_entry);
         gtk_widget_set_margin_top(page, 2);
-        gtk_box_pack_start(GTK_BOX(vbox), page);
+       gtk_box_pack_start(GTK_BOX(vbox), page);
 
-        /* builds the toggle buttons to specify fields concerned by
+       /* builds the toggle buttons to specify fields concerned by
          * the search. */
 
-        frame = gtk_frame_new(_("In:"));
-        gtk_frame_set_label_align(GTK_FRAME(frame),
-                                  GTK_POS_LEFT, GTK_POS_TOP);
-        gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
+       frame = gtk_frame_new(_("In:"));
+       gtk_frame_set_label_align(GTK_FRAME(frame),
+                                 GTK_POS_LEFT, GTK_POS_TOP);
+       gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
         gtk_widget_set_margin_top(frame, 2);
-        gtk_box_pack_start(GTK_BOX(vbox), frame);
+       gtk_box_pack_start(GTK_BOX(vbox), frame);
 
-        grid = gtk_grid_new();
+       grid = gtk_grid_new();
         gtk_grid_set_column_homogeneous(GTK_GRID(grid), TRUE);
-        matching_body = bw_add_check_button(grid, _("_Body"), 0, 0);
-        matching_to = bw_add_check_button(grid, _("_To:"), 1, 0);
-        matching_from = bw_add_check_button(grid, _("_From:"), 1, 1);
+       matching_body    = bw_add_check_button(grid, _("_Body"),    0, 0);
+       matching_to      = bw_add_check_button(grid, _("_To:"),     1, 0);
+       matching_from    = bw_add_check_button(grid, _("_From:"),   1, 1);
         matching_subject = bw_add_check_button(grid, _("S_ubject"), 2, 0);
-        matching_cc = bw_add_check_button(grid, _("_CC:"), 2, 1);
-        g_object_set(G_OBJECT(grid), "margin", 6, NULL);
-        gtk_container_add(GTK_CONTAINER(frame), grid);
+       matching_cc      = bw_add_check_button(grid, _("_CC:"),     2, 1);
+       g_object_set(G_OBJECT(grid), "margin", 6, NULL);
+       gtk_container_add(GTK_CONTAINER(frame), grid);
 
-        /* Frame with Apply and Clear buttons */
-        frame = gtk_frame_new(_("Show only matching messages"));
-        gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
+       /* Frame with Apply and Clear buttons */
+       frame = gtk_frame_new(_("Show only matching messages"));
+       gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
         gtk_widget_set_margin_top(frame, 2);
-        gtk_box_pack_start(GTK_BOX(vbox), frame);
-
-        /* Button box */
-        box = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
-
-        button = gtk_button_new_with_mnemonic(_("_Apply"));
-        g_signal_connect(G_OBJECT(button), "clicked",
-                         G_CALLBACK(bw_find_button_clicked),
-                         GINT_TO_POINTER(FIND_RESPONSE_FILTER));
-        g_object_set(G_OBJECT(button), "margin", 6, NULL);
-        gtk_box_pack_start(GTK_BOX(box), button);
-
-        button = gtk_button_new_with_mnemonic(_("_Clear"));
-        g_signal_connect(G_OBJECT(button), "clicked",
-                         G_CALLBACK(bw_find_button_clicked),
-                         GINT_TO_POINTER(FIND_RESPONSE_RESET));
-        g_object_set(G_OBJECT(button), "margin", 6, NULL);
-        gtk_box_pack_start(GTK_BOX(box), button);
-
-        g_object_set(G_OBJECT(box), "margin", 6, NULL);
-        gtk_container_add(GTK_CONTAINER(frame), box);
-
-        /* Frame with OK button */
-        frame = gtk_frame_new(_("Open next matching message"));
-        gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
+       gtk_box_pack_start(GTK_BOX(vbox), frame);
+
+       /* Button box */
+       box = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
+
+       button = gtk_button_new_with_mnemonic(_("_Apply"));
+       g_signal_connect(G_OBJECT(button), "clicked",
+                        G_CALLBACK(bw_find_button_clicked),
+                        GINT_TO_POINTER(FIND_RESPONSE_FILTER));
+       g_object_set(G_OBJECT(button), "margin", 6, NULL);
+       gtk_box_pack_start(GTK_BOX(box), button);
+
+       button = gtk_button_new_with_mnemonic(_("_Clear"));
+       g_signal_connect(G_OBJECT(button), "clicked",
+                        G_CALLBACK(bw_find_button_clicked),
+                        GINT_TO_POINTER(FIND_RESPONSE_RESET));
+       g_object_set(G_OBJECT(button), "margin", 6, NULL);
+       gtk_box_pack_start(GTK_BOX(box), button);
+
+       g_object_set(G_OBJECT(box), "margin", 6, NULL);
+       gtk_container_add(GTK_CONTAINER(frame), box);
+
+       /* Frame with OK button */
+       frame = gtk_frame_new(_("Open next matching message"));
+       gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
         gtk_widget_set_margin_top(frame, 2);
-        gtk_box_pack_start(GTK_BOX(vbox), frame);
+       gtk_box_pack_start(GTK_BOX(vbox), frame);
 
-        /* Reverse and Wrap checkboxes */
-        box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
-        g_object_set(G_OBJECT(box), "margin", 6, NULL);
-        gtk_container_add(GTK_CONTAINER(frame), box);
+       /* Reverse and Wrap checkboxes */
+       box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
+       g_object_set(G_OBJECT(box), "margin", 6, NULL);
+       gtk_container_add(GTK_CONTAINER(frame), box);
 
-        w = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
+       w = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
         gtk_box_set_homogeneous(GTK_BOX(w), TRUE);
-        reverse_button =
+       reverse_button =
             gtk_check_button_new_with_mnemonic(_("_Reverse search"));
-        g_object_set(G_OBJECT(reverse_button), "margin", 6, NULL);
+       g_object_set(G_OBJECT(reverse_button), "margin", 6, NULL);
         gtk_widget_set_vexpand(reverse_button, TRUE);
-        gtk_box_pack_start(GTK_BOX(w), reverse_button);
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(reverse_button),
+       gtk_box_pack_start(GTK_BOX(w), reverse_button);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(reverse_button),
                                      reverse);
-        wrap_button =
+       wrap_button =
             gtk_check_button_new_with_mnemonic(_("_Wrap around"));
-        g_object_set(G_OBJECT(wrap_button), "margin", 6, NULL);
+       g_object_set(G_OBJECT(wrap_button), "margin", 6, NULL);
         gtk_widget_set_vexpand(wrap_button, TRUE);
-        gtk_box_pack_start(GTK_BOX(w), wrap_button);
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wrap_button),
+       gtk_box_pack_start(GTK_BOX(w), wrap_button);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wrap_button),
                                      wrap);
         gtk_widget_set_hexpand(w, TRUE);
-        gtk_box_pack_start(GTK_BOX(box), w);
+       gtk_box_pack_start(GTK_BOX(box), w);
 
-        button = gtk_button_new_with_mnemonic(_("_OK"));
-        g_signal_connect(G_OBJECT(button), "clicked",
-                         G_CALLBACK(bw_find_button_clicked),
-                         GINT_TO_POINTER(GTK_RESPONSE_OK));
+       button = gtk_button_new_with_mnemonic(_("_OK"));
+       g_signal_connect(G_OBJECT(button), "clicked",
+                        G_CALLBACK(bw_find_button_clicked),
+                        GINT_TO_POINTER(GTK_RESPONSE_OK));
         gtk_widget_set_valign(button, GTK_ALIGN_CENTER);
         gtk_widget_set_hexpand(button, TRUE);
-        gtk_box_pack_start(GTK_BOX(box), button);
+       gtk_box_pack_start(GTK_BOX(box), button);
 
-        if (cnd->match.string.string) {
-            gtk_entry_set_text(GTK_ENTRY(search_entry),
+       if (cnd->match.string.string)
+           gtk_entry_set_text(GTK_ENTRY(search_entry),
                                cnd->match.string.string);
-        }
-        gtk_toggle_button_set_active(matching_body,
-                                     CONDITION_CHKMATCH(cnd,
-                                                        CONDITION_MATCH_BODY));
-        gtk_toggle_button_set_active(matching_to,
-                                     CONDITION_CHKMATCH(cnd,
+       gtk_toggle_button_set_active(matching_body,
+                                    CONDITION_CHKMATCH(cnd,
+                                                       CONDITION_MATCH_BODY));
+       gtk_toggle_button_set_active(matching_to,
+                                    CONDITION_CHKMATCH(cnd,
                                                         CONDITION_MATCH_TO));
-        gtk_toggle_button_set_active(matching_from,
-                                     CONDITION_CHKMATCH(cnd, CONDITION_MATCH_FROM));
-        gtk_toggle_button_set_active(matching_subject,
-                                     CONDITION_CHKMATCH(cnd, CONDITION_MATCH_SUBJECT));
-        gtk_toggle_button_set_active(matching_cc,
-                                     CONDITION_CHKMATCH(cnd, CONDITION_MATCH_CC));
+       gtk_toggle_button_set_active(matching_from,
+                                    CONDITION_CHKMATCH(cnd,CONDITION_MATCH_FROM));
+       gtk_toggle_button_set_active(matching_subject,
+                                    CONDITION_CHKMATCH(cnd,CONDITION_MATCH_SUBJECT));
+       gtk_toggle_button_set_active(matching_cc,
+                                    CONDITION_CHKMATCH(cnd,CONDITION_MATCH_CC));
 
         gtk_widget_grab_focus(search_entry);
-        gtk_entry_set_activates_default(GTK_ENTRY(search_entry), TRUE);
+       gtk_entry_set_activates_default(GTK_ENTRY(search_entry), TRUE);
         gtk_dialog_set_default_response(GTK_DIALOG(dia), GTK_RESPONSE_OK);
-        do {
-            GError *err = NULL;
+       do {
+           GError *err = NULL;
 
-            ok = gtk_dialog_run(GTK_DIALOG(dia));
-            switch (ok) {
+           ok=gtk_dialog_run(GTK_DIALOG(dia));
+            switch(ok) {
             case GTK_RESPONSE_OK:
             case FIND_RESPONSE_FILTER:
                 reverse = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                                           (reverse_button));
-                wrap = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                                        (wrap_button));
-                g_free(cnd->match.string.string);
-                cnd->match.string.string =
+                                                       (reverse_button));
+                wrap    = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
+                                                       (wrap_button));
+               g_free(cnd->match.string.string);
+               cnd->match.string.string =
                     gtk_editable_get_chars(GTK_EDITABLE(search_entry), 0, -1);
-                cnd->match.string.fields = CONDITION_EMPTY;
-
-                if (gtk_toggle_button_get_active(matching_body)) {
-                    CONDITION_SETMATCH(cnd, CONDITION_MATCH_BODY);
-                }
-                if (gtk_toggle_button_get_active(matching_to)) {
-                    CONDITION_SETMATCH(cnd, CONDITION_MATCH_TO);
-                }
-                if (gtk_toggle_button_get_active(matching_subject)) {
-                    CONDITION_SETMATCH(cnd, CONDITION_MATCH_SUBJECT);
-                }
-                if (gtk_toggle_button_get_active(matching_from)) {
-                    CONDITION_SETMATCH(cnd, CONDITION_MATCH_FROM);
-                }
-                if (gtk_toggle_button_get_active(matching_cc)) {
-                    CONDITION_SETMATCH(cnd, CONDITION_MATCH_CC);
-                }
-                if (!((cnd->match.string.fields != CONDITION_EMPTY) &&
-                      cnd->match.string.string[0])) {
-
-                    /* FIXME : We should print error messages, but for
-                     * that we should first make find dialog non-modal
-                     * balsa_information(LIBBALSA_INFORMATION_ERROR,_("You
-                     * must specify at least one field to look in"));
-                     * *balsa_information(LIBBALSA_INFORMATION_ERROR,_("You
-                     * must provide a non-empty string")); */
+               cnd->match.string.fields=CONDITION_EMPTY;
+
+               if (gtk_toggle_button_get_active(matching_body))
+                   CONDITION_SETMATCH(cnd,CONDITION_MATCH_BODY);
+               if (gtk_toggle_button_get_active(matching_to))
+                   CONDITION_SETMATCH(cnd,CONDITION_MATCH_TO);
+               if (gtk_toggle_button_get_active(matching_subject))
+                   CONDITION_SETMATCH(cnd,CONDITION_MATCH_SUBJECT);
+               if (gtk_toggle_button_get_active(matching_from))
+                   CONDITION_SETMATCH(cnd,CONDITION_MATCH_FROM);
+               if (gtk_toggle_button_get_active(matching_cc))
+                   CONDITION_SETMATCH(cnd,CONDITION_MATCH_CC);
+               if (!(cnd->match.string.fields!=CONDITION_EMPTY &&
+                    cnd->match.string.string[0]))
+
+                   /* FIXME : We should print error messages, but for
+                    * that we should first make find dialog non-modal
+                    * balsa_information(LIBBALSA_INFORMATION_ERROR,_("You
+                    * must specify at least one field to look in"));
+                    * *balsa_information(LIBBALSA_INFORMATION_ERROR,_("You
+                    * must provide a non-empty string")); */
                     ok = GTK_RESPONSE_CANCEL;
-                }
                 break;
-
-            case GTK_RESPONSE_HELP:
+           case GTK_RESPONSE_HELP:
                 gtk_show_uri_on_window(GTK_WINDOW(window),
                                        "help:balsa/win-search",
                                        gtk_get_current_event_time(), &err);
-                if (err) {
-                    balsa_information(LIBBALSA_INFORMATION_WARNING,
-                                      _("Error displaying help: %s\n"),
-                                      err->message);
-                    g_error_free(err);
-                }
-                break;
-
+               if (err) {
+                   balsa_information(LIBBALSA_INFORMATION_WARNING,
+                                     _("Error displaying help: %s\n"),
+                                     err->message);
+                   g_error_free(err);
+               }
+               break;
             case FIND_RESPONSE_RESET:
-                bw_reset_filter(window);
-
-            /* fall through */
+               bw_reset_filter(window);
+               /* fall through */
             default:
-                ok = GTK_RESPONSE_CANCEL;
-                break;/* cancel or just close */
+               ok = GTK_RESPONSE_CANCEL;
+               break;/* cancel or just close */
             } /* end of switch */
-        } while (ok == GTK_RESPONSE_HELP);
-        gtk_widget_destroy(dia);
-        if (ok == GTK_RESPONSE_CANCEL) {
-            return;
-        }
-        cnd->type = CONDITION_STRING;
+       } while (ok==GTK_RESPONSE_HELP);
+       gtk_widget_destroy(dia);
+       if (ok == GTK_RESPONSE_CANCEL)
+           return;
+       cnd->type = CONDITION_STRING;
 
-        libbalsa_mailbox_search_iter_unref(search_iter);
-        search_iter = NULL;
+       libbalsa_mailbox_search_iter_unref(search_iter);
+       search_iter = NULL;
 
-        if (ok == FIND_RESPONSE_FILTER) {
+        if(ok == FIND_RESPONSE_FILTER) {
             LibBalsaMailbox *mailbox =
                 BALSA_INDEX(bindex)->mailbox_node->mailbox;
             LibBalsaCondition *filter, *res;
@@ -4307,32 +3955,27 @@ bw_find_real(BalsaWindow *window,
             libbalsa_condition_unref(cnd);
             cnd = NULL;
 
-            if (libbalsa_mailbox_set_view_filter(mailbox, res, TRUE)) {
+            if (libbalsa_mailbox_set_view_filter(mailbox, res, TRUE))
                 balsa_index_ensure_visible(BALSA_INDEX(bindex));
-            }
             libbalsa_condition_unref(res);
             return;
         }
     }
 
-    if (!search_iter) {
-        search_iter = libbalsa_mailbox_search_iter_new(cnd);
-    }
+    if (!search_iter)
+       search_iter = libbalsa_mailbox_search_iter_new(cnd);
     balsa_index_find(bindex, search_iter, reverse, wrap);
 }
 
-
 static void
-bw_mailbox_tab_close_cb(GtkWidget *widget,
-                        gpointer   data)
+bw_mailbox_tab_close_cb(GtkWidget * widget, gpointer data)
 {
-    GtkWidget *window = gtk_widget_get_toplevel(widget);
+    GtkWidget * window = gtk_widget_get_toplevel(widget);
     balsa_window_real_close_mbnode(BALSA_WINDOW(window),
-                                   BALSA_MAILBOX_NODE(data));
+                                  BALSA_MAILBOX_NODE(data));
 }
 
-
-static LibBalsaCondition *
+static LibBalsaCondition*
 bw_get_view_filter(BalsaWindow *window)
 {
     LibBalsaCondition *filter, *flag_filter;
@@ -4347,11 +3990,9 @@ bw_get_view_filter(BalsaWindow *window)
         const gchar *str = gtk_entry_get_text(GTK_ENTRY(window->sos_entry));
         g_assert(((guint) i) < G_N_ELEMENTS(view_filters));
         filter = view_filters[i].filter(str);
-    } else {
-        filter = NULL;
-    }
+    } else filter = NULL;
     /* and merge ... */
-    if (flag_filter) {
+    if(flag_filter) {
         LibBalsaCondition *res;
         res = libbalsa_condition_new_bool_ptr(FALSE, CONDITION_AND,
                                               flag_filter, filter);
@@ -4363,9 +4004,8 @@ bw_get_view_filter(BalsaWindow *window)
     return filter;
 }
 
-
 static void
-bw_hide_changed_set_view_filter(BalsaWindow *window)
+bw_hide_changed_set_view_filter(BalsaWindow * window)
 {
     GtkWidget *index;
     LibBalsaMailbox *mailbox;
@@ -4373,9 +4013,8 @@ bw_hide_changed_set_view_filter(BalsaWindow *window)
     LibBalsaCondition *filter;
 
     index = balsa_window_find_current_index(window);
-    if (!index) {
+    if(!index)
         return;
-    }
 
     mailbox = BALSA_INDEX(index)->mailbox_node->mailbox;
     /* Store the new filter mask in the mailbox view before we set the
@@ -4395,15 +4034,13 @@ bw_hide_changed_set_view_filter(BalsaWindow *window)
     /* libbalsa_mailbox_set_view_filter() will ref the
      * filter.  We need also to rethread to take into account that
      * some messages might have been removed or added to the view. */
-    if (libbalsa_mailbox_set_view_filter(mailbox, filter, TRUE)) {
+    if (libbalsa_mailbox_set_view_filter(mailbox, filter, TRUE))
         balsa_index_ensure_visible(BALSA_INDEX(index));
-    }
     libbalsa_condition_unref(filter);
 }
 
-
 static void
-bw_reset_filter(BalsaWindow *bw)
+bw_reset_filter(BalsaWindow * bw)
 {
     BalsaIndex *bindex = BALSA_INDEX(balsa_window_find_current_index(bw));
 
@@ -4412,37 +4049,34 @@ bw_reset_filter(BalsaWindow *bw)
     bw_set_view_filter(bw, bindex->filter_no, bw->sos_entry);
 }
 
-
 /* empty_trash:
    empty the trash mailbox.
- */
+*/
 void
-empty_trash(BalsaWindow *window)
+empty_trash(BalsaWindow * window)
 {
     guint msgno, total;
     GArray *messages;
     GError *err = NULL;
 
     g_object_ref(balsa_app.trash);
-    if (!libbalsa_mailbox_open(balsa_app.trash, &err)) {
-        if (window) {
+    if(!libbalsa_mailbox_open(balsa_app.trash, &err)) {
+        if (window)
             balsa_information_parented(GTK_WINDOW(window),
                                        LIBBALSA_INFORMATION_WARNING,
                                        _("Could not open trash: %s"),
                                        err ?
                                        err->message : _("Unknown error"));
-        }
 
-        g_error_free(err);
+       g_error_free(err);
         g_object_unref(balsa_app.trash);
-        return;
+       return;
     }
 
     messages = g_array_new(FALSE, FALSE, sizeof(guint));
     total = libbalsa_mailbox_total_messages(balsa_app.trash);
-    for (msgno = 1; msgno <= total; msgno++) {
+    for (msgno = 1; msgno <= total; msgno++)
         g_array_append_val(messages, msgno);
-    }
     libbalsa_mailbox_messages_change_flags(balsa_app.trash, messages,
                                            LIBBALSA_MESSAGE_FLAG_DELETED,
                                            0);
@@ -4451,14 +4085,12 @@ empty_trash(BalsaWindow *window)
     /* We want to expunge deleted messages: */
     libbalsa_mailbox_close(balsa_app.trash, TRUE);
     g_object_unref(balsa_app.trash);
-    if (window) {
+    if (window)
         enable_empty_trash(window, TRASH_EMPTY);
-    }
 }
 
-
 static void
-bw_show_mbtree(BalsaWindow *bw)
+bw_show_mbtree(BalsaWindow * bw)
 {
     GtkWidget *parent;
 
@@ -4477,7 +4109,6 @@ bw_show_mbtree(BalsaWindow *bw)
     }
 }
 
-
 void
 balsa_change_window_layout(BalsaWindow *window)
 {
@@ -4487,13 +4118,13 @@ balsa_change_window_layout(BalsaWindow *window)
     g_object_ref(window->preview);
 
     gtk_container_remove(GTK_CONTAINER
-                             (gtk_widget_get_parent(window->notebook)),
+                         (gtk_widget_get_parent(window->notebook)),
                          window->notebook);
     gtk_container_remove(GTK_CONTAINER
-                             (gtk_widget_get_parent(window->mblist)),
+                         (gtk_widget_get_parent(window->mblist)),
                          window->mblist);
     gtk_container_remove(GTK_CONTAINER
-                             (gtk_widget_get_parent(window->preview)),
+                         (gtk_widget_get_parent(window->preview)),
                          window->preview);
 
     bw_set_panes(window);
@@ -4507,37 +4138,32 @@ balsa_change_window_layout(BalsaWindow *window)
                            balsa_app.mblist_width : 0);
 }
 
-
 /* PKGW: remember when they change the position of the vpaned. */
 static void
-bw_slave_position_cb(GtkPaned   *paned_slave,
-                     GParamSpec *pspec,
-                     gpointer    user_data)
+bw_slave_position_cb(GtkPaned   * paned_slave,
+                     GParamSpec * pspec,
+                     gpointer     user_data)
 {
-    if (balsa_app.previewpane) {
+    if (balsa_app.previewpane)
         balsa_app.notebook_height =
             gtk_paned_get_position(paned_slave);
-    }
 }
 
-
-static void
-bw_size_allocate_cb(GtkWidget *window)
+    static void
+bw_size_allocate_cb(GtkWidget * window)
 {
     gtk_window_get_size(GTK_WINDOW(window),
-                        &balsa_app.mw_width,
-                        &balsa_app.mw_height);
+                        & balsa_app.mw_width,
+                        & balsa_app.mw_height);
 }
 
-
 /* When page is switched we change the preview window and the selected
    mailbox in the mailbox tree.
  */
 static void
-bw_notebook_switch_page_cb(GtkWidget *notebook,
-                           void      *notebookpage,
-                           guint      page_num,
-                           gpointer   data)
+bw_notebook_switch_page_cb(GtkWidget * notebook,
+                        void * notebookpage, guint page_num,
+                        gpointer data)
 {
     BalsaWindow *window = BALSA_WINDOW(data);
     GtkWidget *page;
@@ -4546,24 +4172,23 @@ bw_notebook_switch_page_cb(GtkWidget *notebook,
     gchar *title;
 
     if (window->current_index) {
-        g_object_remove_weak_pointer(G_OBJECT(window->current_index),
-                                     (gpointer) & window->current_index);
-        /* Note when this mailbox was hidden, for use in auto-closing. */
-        time(&BALSA_INDEX(window->current_index)->mailbox_node->last_use);
+       g_object_remove_weak_pointer(G_OBJECT(window->current_index),
+                                    (gpointer) &window->current_index);
+       /* Note when this mailbox was hidden, for use in auto-closing. */
+       time(&BALSA_INDEX(window->current_index)->mailbox_node->last_use);
         window->current_index = NULL;
     }
 
-    if (!balsa_app.mblist_tree_store) {
+    if (!balsa_app.mblist_tree_store)
         /* Quitt'n time! */
         return;
-    }
 
     page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), page_num);
     index = BALSA_INDEX(gtk_bin_get_child(GTK_BIN(page)));
 
     window->current_index = GTK_WIDGET(index);
     g_object_add_weak_pointer(G_OBJECT(index),
-                              (gpointer) & window->current_index);
+                             (gpointer) &window->current_index);
     /* Note when this mailbox was exposed, for use in auto-expunge. */
     time(&index->mailbox_node->last_use);
 
@@ -4602,18 +4227,15 @@ bw_notebook_switch_page_cb(GtkWidget *notebook,
     balsa_app.current_mailbox_url = g_strdup(mailbox->url);
 }
 
-
 static void
-bw_index_changed_cb(GtkWidget *widget,
-                    gpointer   data)
+bw_index_changed_cb(GtkWidget * widget, gpointer data)
 {
     BalsaWindow *window = data;
     BalsaIndex *index;
     guint current_msgno;
 
-    if (widget != window->current_index) {
+    if (widget != window->current_index)
         return;
-    }
 
     index = BALSA_INDEX(widget);
     bw_enable_message_menus(window, index->current_msgno);
@@ -4622,31 +4244,26 @@ bw_index_changed_cb(GtkWidget *widget,
     current_msgno = BALSA_MESSAGE(window->preview)->message ?
         BALSA_MESSAGE(window->preview)->message->msgno : 0;
 
-    if (current_msgno != index->current_msgno) {
+    if (current_msgno != index->current_msgno)
         bw_idle_replace(window, index);
-    }
 }
 
-
 static void
-bw_idle_replace(BalsaWindow *window,
-                BalsaIndex  *bindex)
+bw_idle_replace(BalsaWindow * window, BalsaIndex * bindex)
 {
     if (balsa_app.previewpane) {
         bw_idle_remove(window);
         /* Skip if the window is being destroyed: */
         if (window->preview != NULL) {
             window->set_message_id = g_idle_add((GSourceFunc) bw_idle_cb, window);
-            if (BALSA_MESSAGE(window->preview)->message != NULL) {
+            if (BALSA_MESSAGE(window->preview)->message != NULL)
                 gtk_widget_hide(window->preview);
-            }
         }
     }
 }
 
-
 static void
-bw_idle_remove(BalsaWindow *window)
+bw_idle_remove(BalsaWindow * window)
 {
     libbalsa_clear_source_id(&window->set_message_id);
 }
@@ -4655,7 +4272,7 @@ bw_idle_remove(BalsaWindow *window)
 static volatile gboolean bw_idle_cb_active = FALSE;
 
 static gboolean
-bw_idle_cb(BalsaWindow *window)
+bw_idle_cb(BalsaWindow * window)
 {
     BalsaIndex *index;
 
@@ -4663,20 +4280,19 @@ bw_idle_cb(BalsaWindow *window)
         return FALSE;
     }
     if (bw_idle_cb_active) {
-        return TRUE;
+       return TRUE;
     }
     bw_idle_cb_active = TRUE;
 
     window->set_message_id = 0;
 
     index = (BalsaIndex *) window->current_index;
-    if (index) {
+    if (index)
         balsa_message_set(BALSA_MESSAGE(window->preview),
                           index->mailbox_node->mailbox,
                           index->current_msgno);
-    } else {
+    else
         balsa_message_set(BALSA_MESSAGE(window->preview), NULL, 0);
-    }
 
     index = g_object_get_data(G_OBJECT(window), BALSA_INDEX_GRAB_FOCUS);
     if (index) {
@@ -4689,23 +4305,18 @@ bw_idle_cb(BalsaWindow *window)
     return FALSE;
 }
 
-
 static void
-bw_select_part_cb(BalsaMessage *bm,
-                  gpointer      data)
+bw_select_part_cb(BalsaMessage * bm, gpointer data)
 {
     bw_enable_edit_menus(BALSA_WINDOW(data), bm);
     bw_enable_part_menu_items(BALSA_WINDOW(data));
 }
 
-
 static void
-bw_send_msg_window_destroy_cb(GtkWidget *widget,
-                              gpointer   data)
+bw_send_msg_window_destroy_cb(GtkWidget * widget, gpointer data)
 {
-    if (balsa_app.main_window) {
+    if (balsa_app.main_window)
         balsa_window_enable_continue(BALSA_WINDOW(data));
-    }
 }
 
 
@@ -4714,13 +4325,11 @@ bw_send_msg_window_destroy_cb(GtkWidget *widget,
  * Description: Finds the page from which notebook page tab the
  * coordinates are over.
  **/
-static BalsaIndex *
-bw_notebook_find_page(GtkNotebook *notebook,
-                      gint         x,
-                      gint         y)
+static BalsaIndex*
+bw_notebook_find_page (GtkNotebook* notebook, gint x, gint y)
 {
-    GtkWidget *page;
-    GtkWidget *label;
+    GtkWidget* page;
+    GtkWidget* label;
     gint page_num = 0;
     gint label_x;
     gint label_y;
@@ -4738,14 +4347,14 @@ bw_notebook_find_page(GtkNotebook *notebook,
         label = gtk_notebook_get_tab_label (notebook, page);
 
         gtk_widget_get_allocation(label, &allocation);
-        label_x = allocation.x;
+        label_x     = allocation.x;
         label_width = allocation.width;
 
-        if ((x > label_x) && (x < label_x + label_width)) {
-            label_y = allocation.y;
+        if (x > label_x && x < label_x + label_width) {
+            label_y      = allocation.y;
             label_height = allocation.height;
 
-            if ((y > label_y) && (y < label_y + label_height)) {
+            if (y > label_y && y < label_y + label_height) {
                 return BALSA_INDEX(gtk_bin_get_child(GTK_BIN(page)));
             }
         }
@@ -4763,24 +4372,23 @@ bw_notebook_find_page(GtkNotebook *notebook,
  * over, then transfers them.
  **/
 static void
-bw_notebook_drag_received_cb(GtkWidget        *widget,
-                             GdkDragContext   *context,
-                             gint              x,
-                             gint              y,
-                             GtkSelectionData *selection_data,
-                             guint32           time,
-                             gpointer          data)
+bw_notebook_drag_received_cb(GtkWidget        * widget,
+                             GdkDragContext   * context,
+                             gint               x,
+                             gint               y,
+                             GtkSelectionData * selection_data,
+                             guint32            time,
+                             gpointer           data)
 {
-    BalsaIndex *index;
-    LibBalsaMailbox *mailbox;
+    BalsaIndex* index;
+    LibBalsaMailbox* mailbox;
     BalsaIndex *orig_index;
     GArray *selected;
-    LibBalsaMailbox *orig_mailbox;
+    LibBalsaMailbox* orig_mailbox;
 
-    if (!selection_data) {
-        /* Drag'n'drop is weird... */
-        return;
-    }
+    if (!selection_data)
+       /* Drag'n'drop is weird... */
+       return;
 
     orig_index =
         *(BalsaIndex **) gtk_selection_data_get_data(selection_data);
@@ -4796,27 +4404,21 @@ bw_notebook_drag_received_cb(GtkWidget        *widget,
 
     index = bw_notebook_find_page (GTK_NOTEBOOK(widget), x, y);
 
-    if (index == NULL) {
+    if (index == NULL)
         return;
-    }
 
     mailbox = index->mailbox_node->mailbox;
 
-    if ((mailbox != NULL) && (mailbox != orig_mailbox)) {
+    if (mailbox != NULL && mailbox != orig_mailbox)
         balsa_index_transfer(orig_index, selected, mailbox,
                              gdk_drag_context_get_selected_action(context) != GDK_ACTION_MOVE);
-    }
     balsa_index_selected_msgnos_free(orig_index, selected);
 }
 
-
-static gboolean
-bw_notebook_drag_motion_cb(GtkWidget      *widget,
-                           GdkDragContext *context,
-                           gint            x,
-                           gint            y,
-                           guint           time,
-                           gpointer        user_data)
+static gboolean bw_notebook_drag_motion_cb(GtkWidget * widget,
+                                           GdkDragContext * context,
+                                           gint x, gint y, guint time,
+                                           gpointer user_data)
 {
     gdk_drag_status(context,
                     (gdk_drag_context_get_actions(context) ==
@@ -4826,7 +4428,6 @@ bw_notebook_drag_motion_cb(GtkWidget      *widget,
     return FALSE;
 }
 
-
 /* bw_progress_timeout
  *
  * This function is called at a preset interval to cause the progress
@@ -4835,12 +4436,11 @@ bw_notebook_drag_motion_cb(GtkWidget      *widget,
  * Use of the progress bar to show a fraction of a task takes priority.
  **/
 static gint
-bw_progress_timeout(BalsaWindow **window)
+bw_progress_timeout(BalsaWindow ** window)
 {
     if (balsa_app.show_statusbar
-        && *window && ((*window)->progress_type == BALSA_PROGRESS_ACTIVITY)) {
+        && *window && (*window)->progress_type == BALSA_PROGRESS_ACTIVITY)
         gtk_progress_bar_pulse(GTK_PROGRESS_BAR((*window)->progress_bar));
-    }
 
     /* return true so it continues to be called */
     return *window != NULL;
@@ -4855,34 +4455,30 @@ bw_progress_timeout(BalsaWindow **window)
  * indicate activity simultaneously).
  **/
 void
-balsa_window_increase_activity(BalsaWindow *window,
-                               const gchar *message)
+balsa_window_increase_activity(BalsaWindow * window, const gchar * message)
 {
     static BalsaWindow *window_save = NULL;
 
     if (!window_save) {
         window_save = window;
         g_object_add_weak_pointer(G_OBJECT(window_save),
-                                  (gpointer) & window_save);
+                                  (gpointer) &window_save);
     }
 
-    if (!window->activity_handler) {
+    if (!window->activity_handler)
         /* add a timeout to make the activity bar move */
         window->activity_handler =
             g_timeout_add(50, (GSourceFunc) bw_progress_timeout,
                           &window_save);
-    }
 
     /* increment the reference counter */
     ++window->activity_counter;
-    if (window->progress_type == BALSA_PROGRESS_NONE) {
+    if (window->progress_type == BALSA_PROGRESS_NONE)
         window->progress_type = BALSA_PROGRESS_ACTIVITY;
-    }
 
-    if (window->progress_type == BALSA_PROGRESS_ACTIVITY) {
+    if (window->progress_type == BALSA_PROGRESS_ACTIVITY)
         gtk_progress_bar_set_text(GTK_PROGRESS_BAR(window->progress_bar),
                                   message);
-    }
     window->activity_messages =
         g_slist_prepend(window->activity_messages, g_strdup(message));
 }
@@ -4895,8 +4491,7 @@ balsa_window_increase_activity(BalsaWindow *window,
  * cleared.
  **/
 void
-balsa_window_decrease_activity(BalsaWindow *window,
-                               const gchar *message)
+balsa_window_decrease_activity(BalsaWindow * window, const gchar * message)
 {
     GSList *link;
     GtkProgressBar *progress_bar;
@@ -4908,14 +4503,13 @@ balsa_window_decrease_activity(BalsaWindow *window,
         g_slist_delete_link(window->activity_messages, link);
 
     progress_bar = GTK_PROGRESS_BAR(window->progress_bar);
-    if (window->progress_type == BALSA_PROGRESS_ACTIVITY) {
+    if (window->progress_type == BALSA_PROGRESS_ACTIVITY)
         gtk_progress_bar_set_text(progress_bar,
                                   window->activity_messages ?
                                   window->activity_messages->data : NULL);
-    }
 
     /* decrement the counter if positive */
-    if ((window->activity_counter > 0) && (--window->activity_counter == 0)) {
+    if (window->activity_counter > 0 && --window->activity_counter == 0) {
         /* clear the bar and make it available for others to use */
         libbalsa_clear_source_id(&window->activity_handler);
         if (window->progress_type == BALSA_PROGRESS_ACTIVITY) {
@@ -4942,11 +4536,11 @@ balsa_window_decrease_activity(BalsaWindow *window,
 
 typedef struct {
     GtkProgressBar *progress_bar;
-    gchar *text;
+    gchar          *text;
 } BalsaWindowSetupProgressInfo;
 
 static gboolean
-bw_setup_progress_idle_cb(BalsaWindowSetupProgressInfo *info)
+bw_setup_progress_idle_cb(BalsaWindowSetupProgressInfo * info)
 {
     gtk_progress_bar_set_text(info->progress_bar, info->text);
     gtk_progress_bar_set_fraction(info->progress_bar, 0);
@@ -4958,22 +4552,18 @@ bw_setup_progress_idle_cb(BalsaWindowSetupProgressInfo *info)
     return FALSE;
 }
 
-
 gboolean
-balsa_window_setup_progress(BalsaWindow *window,
-                            const gchar *text)
+balsa_window_setup_progress(BalsaWindow * window, const gchar * text)
 {
     BalsaWindowSetupProgressInfo *info;
 
     if (text) {
         /* make sure the progress bar is currently unused */
-        if (window->progress_type == BALSA_PROGRESS_INCREMENT) {
+        if (window->progress_type == BALSA_PROGRESS_INCREMENT)
             return FALSE;
-        }
         window->progress_type = BALSA_PROGRESS_INCREMENT;
-    } else {
+    } else
         window->progress_type = BALSA_PROGRESS_NONE;
-    }
 
     /* Update the display in an idle callback, in case we were called in
      * a sub-thread.*/
@@ -4985,7 +4575,6 @@ balsa_window_setup_progress(BalsaWindow *window,
     return TRUE;
 }
 
-
 /* balsa_window_increment_progress
  *
  * If the progress bar has been initialized using
@@ -4998,26 +4587,21 @@ balsa_window_setup_progress(BalsaWindow *window,
  * main thread from processing events.
  **/
 void
-balsa_window_increment_progress(BalsaWindow *window,
-                                gdouble      fraction,
-                                gboolean     flush)
+balsa_window_increment_progress(BalsaWindow * window, gdouble fraction,
+                                gboolean flush)
 {
     /* make sure the progress bar is being incremented */
-    if (window->progress_type != BALSA_PROGRESS_INCREMENT) {
+    if (window->progress_type != BALSA_PROGRESS_INCREMENT)
         return;
-    }
 
     gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(window->progress_bar),
                                   fraction);
 
-    if (flush) {
-        while (gtk_events_pending()) {
+    if (flush)
+        while (gtk_events_pending())
             gtk_main_iteration_do(FALSE);
-        }
-    }
 }
 
-
 /*
  * End of progress bar functions.
  */
@@ -5027,26 +4611,24 @@ balsa_window_increment_progress(BalsaWindow *window,
  * update_view_menu is called to synchronize the view menu check item
  * */
 void
-update_view_menu(BalsaWindow *window)
+update_view_menu(BalsaWindow * window)
 {
     bw_action_set_boolean(window, "wrap", balsa_app.browse_wrap);
 }
 
-
 /* Update the notebook tab label when the mailbox name is changed. */
 void
-balsa_window_update_tab(BalsaMailboxNode *mbnode)
+balsa_window_update_tab(BalsaMailboxNode * mbnode)
 {
     gint i = balsa_find_notebook_page_num(mbnode->mailbox);
     if (i != -1) {
-        GtkWidget *page =
-            gtk_notebook_get_nth_page(GTK_NOTEBOOK(balsa_app.notebook), i);
-        gtk_notebook_set_tab_label(GTK_NOTEBOOK(balsa_app.notebook), page,
-                                   bw_notebook_label_new(mbnode));
+       GtkWidget *page =
+           gtk_notebook_get_nth_page(GTK_NOTEBOOK(balsa_app.notebook), i);
+       gtk_notebook_set_tab_label(GTK_NOTEBOOK(balsa_app.notebook), page,
+                                  bw_notebook_label_new(mbnode));
     }
 }
 
-
 /* Helper for "Select All" callbacks: if the currently focused widget
  * supports any concept of "select-all", do it.
  *
@@ -5056,13 +4638,12 @@ balsa_window_update_tab(BalsaMailboxNode *mbnode)
  * mode, bad stuff happens.
  */
 void
-balsa_window_select_all(GtkWindow *window)
+balsa_window_select_all(GtkWindow * window)
 {
     GtkWidget *focus_widget = gtk_window_get_focus(window);
 
-    if (!focus_widget) {
-        return;
-    }
+    if (!focus_widget)
+       return;
 
     if (GTK_IS_TEXT_VIEW(focus_widget)) {
         GtkTextBuffer *buffer =
@@ -5079,24 +4660,22 @@ balsa_window_select_all(GtkWindow *window)
             gtk_tree_view_get_selection((GtkTreeView *) focus_widget);
         if (gtk_tree_selection_get_mode(selection) ==
             GTK_SELECTION_MULTIPLE) {
-            if (BALSA_IS_INDEX(focus_widget)) {
-                balsa_index_select_all((BalsaIndex *) focus_widget);
-            } else {
-                gtk_tree_view_expand_all((GtkTreeView *) focus_widget);
+           if (BALSA_IS_INDEX(focus_widget))
+               balsa_index_select_all((BalsaIndex *) focus_widget);
+           else {
+               gtk_tree_view_expand_all((GtkTreeView *) focus_widget);
                 gtk_tree_selection_select_all(selection);
             }
-        }
+       }
 #ifdef    HAVE_HTML_WIDGET
     } else if (libbalsa_html_can_select(focus_widget)) {
-        libbalsa_html_select_all(focus_widget);
+       libbalsa_html_select_all(focus_widget);
 #endif /* HAVE_HTML_WIDGET */
     }
 }
 
-
 void
-balsa_window_set_statusbar(BalsaWindow     *window,
-                           LibBalsaMailbox *mailbox)
+balsa_window_set_statusbar(BalsaWindow * window, LibBalsaMailbox * mailbox)
 {
     gint total_messages = libbalsa_mailbox_total_messages(mailbox);
     gint unread_messages = mailbox->unread_messages;
@@ -5119,22 +4698,20 @@ balsa_window_set_statusbar(BalsaWindow     *window,
                                ngettext("with %d message",
                                         "with %d messages",
                                         total_messages), total_messages);
-        if (unread_messages > 0) {
+        if (unread_messages > 0)
             /* xgettext: this is the third part of the message
              * "Shown mailbox: %s with %d messages, %d new, %d hidden". */
             g_string_append_printf(desc,
                                    ngettext(", %d new", ", %d new",
                                             unread_messages),
                                    unread_messages);
-        }
-        if (hidden_messages > 0) {
+        if (hidden_messages > 0)
             /* xgettext: this is the fourth part of the message
              * "Shown mailbox: %s with %d messages, %d new, %d hidden". */
             g_string_append_printf(desc,
                                    ngettext(", %d hidden", ", %d hidden",
                                             hidden_messages),
                                    hidden_messages);
-        }
     }
 
     statusbar = GTK_STATUSBAR(window->statusbar);
@@ -5146,11 +4723,10 @@ balsa_window_set_statusbar(BalsaWindow     *window,
     g_string_free(desc, TRUE);
 }
 
-
 /* Select next unread message, changing mailboxes if necessary;
  * returns TRUE if mailbox was changed. */
 gboolean
-balsa_window_next_unread(BalsaWindow *window)
+balsa_window_next_unread(BalsaWindow * window)
 {
     BalsaIndex *index =
         BALSA_INDEX(balsa_window_find_current_index(window));
@@ -5167,9 +4743,8 @@ balsa_window_next_unread(BalsaWindow *window)
     }
 
     mailbox = bw_next_unread_mailbox(mailbox);
-    if (!mailbox || (libbalsa_mailbox_get_unread(mailbox) == 0)) {
+    if (!mailbox || libbalsa_mailbox_get_unread(mailbox) == 0)
         return FALSE;
-    }
 
     if (balsa_app.ask_before_select) {
         GtkWidget *dialog;
@@ -5186,23 +4761,21 @@ balsa_window_next_unread(BalsaWindow *window)
 #endif
         gtk_message_dialog_format_secondary_text
             (GTK_MESSAGE_DIALOG(dialog),
-            _("Do you want to select %s?"), mailbox->name);
+             _("Do you want to select %s?"), mailbox->name);
         gtk_dialog_set_default_response(GTK_DIALOG(dialog),
                                         GTK_RESPONSE_YES);
         response = gtk_dialog_run(GTK_DIALOG(dialog));
         gtk_widget_destroy(dialog);
-        if (response != GTK_RESPONSE_YES) {
+        if (response != GTK_RESPONSE_YES)
             return FALSE;
-        }
     }
 
     balsa_mblist_open_mailbox(mailbox);
     index = balsa_find_index_by_mailbox(mailbox);
-    if (index) {
+    if (index)
         balsa_index_select_next_unread(index);
-    } else {
+    else
         g_object_set_data(G_OBJECT(mailbox),
                           BALSA_INDEX_VIEW_ON_OPEN, GINT_TO_POINTER(TRUE));
-    }
     return TRUE;
 }
diff --git a/src/main-window.h b/src/main-window.h
index dbab505..0b5fd0d 100644
--- a/src/main-window.h
+++ b/src/main-window.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
@@ -21,11 +21,11 @@
 #define __MAIN_WINDOW_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #ifdef HAVE_NOTIFY
-#   include <libnotify/notify.h>
+#include <libnotify/notify.h>
 #endif
 
 #include <gio/gio.h>
@@ -33,20 +33,14 @@
 #include "mailbox-node.h"
 #include "toolbar-factory.h"
 
-#define BALSA_TYPE_WINDOW                      (balsa_window_get_type ())
-#define BALSA_WINDOW(obj)                      (G_TYPE_CHECK_INSTANCE_CAST (obj, \
-                                                                            BALSA_TYPE_WINDOW, \
-                                                                            BalsaWindow))
-#define BALSA_WINDOW_CLASS(klass)              (G_TYPE_CHECK_CLASS_CAST (klass, \
-                                                                         BALSA_TYPE_WINDOW, \
-                                                                         BalsaWindowClass))
-#define BALSA_IS_WINDOW(obj)                   (G_TYPE_CHECK_INSTANCE_TYPE (obj, \
-                                                                            BALSA_TYPE_WINDOW))
-#define BALSA_IS_WINDOW_CLASS(klass)           (G_TYPE_CHECK_CLASS_TYPE (klass, \
-                                                                         BALSA_TYPE_WINDOW))
+#define BALSA_TYPE_WINDOW                     (balsa_window_get_type ())
+#define BALSA_WINDOW(obj)                     (G_TYPE_CHECK_INSTANCE_CAST (obj, BALSA_TYPE_WINDOW, 
BalsaWindow))
+#define BALSA_WINDOW_CLASS(klass)             (G_TYPE_CHECK_CLASS_CAST (klass, BALSA_TYPE_WINDOW, 
BalsaWindowClass))
+#define BALSA_IS_WINDOW(obj)                  (G_TYPE_CHECK_INSTANCE_TYPE (obj, BALSA_TYPE_WINDOW))
+#define BALSA_IS_WINDOW_CLASS(klass)          (G_TYPE_CHECK_CLASS_TYPE (klass, BALSA_TYPE_WINDOW))
 #define BALSA_WINDOW_GET_CLASS(window)                       \
     (G_TYPE_INSTANCE_GET_CLASS ((window), BALSA_TYPE_WINDOW, \
-                                BalsaWindowClass))
+                               BalsaWindowClass))
 
 typedef struct _BalsaWindow BalsaWindow;
 typedef struct _BalsaWindowClass BalsaWindowClass;
@@ -68,7 +62,7 @@ struct _BalsaWindow {
     GtkWidget *mblist;
     GtkWidget *sos_entry;       /* SenderOrSubject filter entry */
     GtkWidget *notebook;
-    GtkWidget *preview;         /* message is child */
+    GtkWidget *preview;                /* message is child */
     GtkWidget *paned_master;
     GtkWidget *paned_slave;
     GtkWidget *current_index;
@@ -97,12 +91,11 @@ struct _BalsaWindow {
 struct _BalsaWindowClass {
     GtkApplicationWindowClass parent_class;
 
-    void (*open_mbnode)  (BalsaWindow      *window,
-                          BalsaMailboxNode *mbnode,
-                          gboolean          set_current);
-    void (*close_mbnode) (BalsaWindow      *window,
-                          BalsaMailboxNode *mbnode);
-    void (*identities_changed) (BalsaWindow *window);
+    void (*open_mbnode)  (BalsaWindow * window,
+                          BalsaMailboxNode * mbnode,
+                          gboolean set_current);
+    void (*close_mbnode) (BalsaWindow * window, BalsaMailboxNode * mbnode);
+    void (*identities_changed) (BalsaWindow * window);
 };
 
 /*
@@ -122,76 +115,55 @@ enum {
 GType balsa_window_get_type(void);
 GtkWidget *balsa_window_new(void);
 gboolean balsa_window_fix_paned(BalsaWindow *window);
-GtkWidget *balsa_window_find_current_index(BalsaWindow *window);
+GtkWidget *balsa_window_find_current_index(BalsaWindow * window);
 void balsa_window_update_book_menus(BalsaWindow *window);
-void balsa_window_refresh(BalsaWindow *window);
-void balsa_window_open_mbnode(BalsaWindow      *window,
-                              BalsaMailboxNode *mbnode,
-                              gboolean          set_current);
-void balsa_window_close_mbnode(BalsaWindow      *window,
-                               BalsaMailboxNode *mbnode);
+void balsa_window_refresh(BalsaWindow * window);
+void balsa_window_open_mbnode(BalsaWindow * window,
+                              BalsaMailboxNode*mbnode,
+                              gboolean set_current);
+void balsa_window_close_mbnode(BalsaWindow * window, BalsaMailboxNode*mbnode);
 void balsa_identities_changed(BalsaWindow *bw);
 
-void balsa_window_update_tab(BalsaMailboxNode *mbnode);
-void enable_empty_trash(BalsaWindow *window,
-                        TrashState   status);
-void balsa_window_enable_continue(BalsaWindow *window);
+void balsa_window_update_tab(BalsaMailboxNode * mbnode);
+void enable_empty_trash(BalsaWindow * window, TrashState status);
+void balsa_window_enable_continue(BalsaWindow * window);
 void balsa_change_window_layout(BalsaWindow *window);
-gboolean mail_progress_notify_cb(GIOChannel   *source,
-                                 GIOCondition  condition,
-                                 BalsaWindow **window);
-gboolean send_progress_notify_cb(GIOChannel   *source,
-                                 GIOCondition  condition,
-                                 BalsaWindow **window);
-void check_new_messages_real(BalsaWindow *window,
-                             gboolean     background_check);
-void check_new_messages_count(LibBalsaMailbox *mailbox,
-                              gboolean         notify);
-void empty_trash(BalsaWindow *window);
-void update_view_menu(BalsaWindow *window);
+gboolean mail_progress_notify_cb(GIOChannel * source,
+                                 GIOCondition condition,
+                                 BalsaWindow ** window);
+gboolean send_progress_notify_cb(GIOChannel * source,
+                                 GIOCondition condition,
+                                 BalsaWindow ** window);
+void check_new_messages_real(BalsaWindow * window, gboolean background_check);
+void check_new_messages_count(LibBalsaMailbox * mailbox, gboolean notify);
+void empty_trash(BalsaWindow * window);
+void update_view_menu(BalsaWindow * window);
 BalsaToolbarModel *balsa_window_get_toolbar_model(void);
-void balsa_window_add_action_entries(GActionMap *action_map);
-void balsa_window_select_all(GtkWindow *window);
-gboolean balsa_window_next_unread(BalsaWindow *window);
+void balsa_window_add_action_entries(GActionMap * action_map);
+void balsa_window_select_all(GtkWindow * window);
+gboolean balsa_window_next_unread(BalsaWindow * window);
 
 /* functions to manipulate the progress bars of the window */
-gboolean balsa_window_setup_progress(BalsaWindow *window,
-                                     const gchar *text);
-void balsa_window_clear_progress(BalsaWindow *window);
-void balsa_window_increment_progress(BalsaWindow *window,
-                                     gdouble      fraction,
-                                     gboolean     flush);
-void balsa_window_increase_activity(BalsaWindow *window,
-                                    const gchar *message);
-void balsa_window_decrease_activity(BalsaWindow *window,
-                                    const gchar *message);
-void balsa_window_set_statusbar(BalsaWindow     *window,
-                                LibBalsaMailbox *mailbox);
+gboolean balsa_window_setup_progress(BalsaWindow * window,
+                                     const gchar * text);
+void balsa_window_clear_progress(BalsaWindow* window);
+void balsa_window_increment_progress(BalsaWindow * window,
+                                     gdouble fraction, gboolean flush);
+void balsa_window_increase_activity(BalsaWindow * window,
+                                    const gchar * message);
+void balsa_window_decrease_activity(BalsaWindow * window,
+                                    const gchar * message);
+void balsa_window_set_statusbar(BalsaWindow     * window,
+                                LibBalsaMailbox * mailbox);
 
 #if defined(__FILE__) && defined(__LINE__)
-#   ifdef __FUNCTION__
-#      define BALSA_DEBUG_MSG(message)  if (balsa_app.debug) fprintf(stderr, \
-                                                                     "[%lu] %12s | %4d | %30s: %s\n", \
-                                                                     (unsigned long) time(NULL), \
-                                                                     __FILE__, \
-                                                                     __LINE__, \
-                                                                     __FUNCTION__, \
-                                                                     message)
-#      define BALSA_DEBUG() if (balsa_app.debug) fprintf (stderr, "[%lu] %12s | %4d | %30s\n", \
-                                                          (unsigned long) time( \
-                                                              NULL), __FILE__, __LINE__, \
-                                                          __FUNCTION__)
-#   else
-#      define BALSA_DEBUG_MSG(message)  if (balsa_app.debug) fprintf(stderr, \
-                                                                     "[%lu] %12s | %4d: %s\n", \
-                                                                     (unsigned long) time(NULL), \
-                                                                     __FILE__, \
-                                                                     __LINE__, \
-                                                                     message)
-#      define BALSA_DEBUG() if (balsa_app.debug) fprintf(stderr, "[%lu] %12s | %4d\n", \
-                                                         (unsigned long) time( \
-                                                             NULL), __FILE__, __LINE__)
-#   endif
+# ifdef __FUNCTION__
+#  define BALSA_DEBUG_MSG(message)  if (balsa_app.debug)  fprintf(stderr, "[%lu] %12s | %4d | %30s: %s\n", 
(unsigned long) time(NULL), __FILE__, __LINE__, __FUNCTION__, message)
+#  define BALSA_DEBUG() if (balsa_app.debug) fprintf (stderr, "[%lu] %12s | %4d | %30s\n", (unsigned long) 
time(NULL), __FILE__, __LINE__, __FUNCTION__)
+# else
+#  define BALSA_DEBUG_MSG(message)  if (balsa_app.debug)  fprintf(stderr, "[%lu] %12s | %4d: %s\n", 
(unsigned long) time(NULL), __FILE__, __LINE__, message)
+#  define BALSA_DEBUG() if (balsa_app.debug)  fprintf(stderr, "[%lu] %12s | %4d\n", (unsigned long) 
time(NULL), __FILE__, __LINE__)
+# endif
 #endif
 
-#endif                          /* __MAIN_WINDOW_H__ */
+#endif                         /* __MAIN_WINDOW_H__ */
diff --git a/src/main.c b/src/main.c
index 19da362..77746dd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -18,7 +18,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <signal.h>
@@ -26,11 +26,11 @@
 #include <unistd.h>
 
 #ifdef HAVE_LOCALE_H
-#   include <locale.h>
+#include <locale.h>
 #endif
 
 #ifdef HAVE_RUBRICA
-#   include <libxml/xmlversion.h>
+#include <libxml/xmlversion.h>
 #endif
 
 #include <glib/gi18n.h>
@@ -51,8 +51,8 @@
 #include "libinit_balsa/assistant_init.h"
 
 #ifdef HAVE_GPGME
-#   include "libbalsa-gpgme.h"
-#   include "libbalsa-gpgme-cb.h"
+#include "libbalsa-gpgme.h"
+#include "libbalsa-gpgme-cb.h"
 #endif
 
 static void config_init(gboolean check_only);
@@ -62,10 +62,10 @@ static void balsa_cleanup(void);
 /* We need separate variable for storing command line requests to check the
    mail because such selection cannot be stored in balsa_app and later
    saved to the configuration file.
- */
+*/
 static gchar **cmd_line_open_mailboxes;
 static gboolean cmd_check_mail_on_startup,
-                cmd_open_unread_mailbox, cmd_open_inbox, cmd_get_stats;
+    cmd_open_unread_mailbox, cmd_open_inbox, cmd_get_stats;
 
 /* opt_attach_list: list of attachments */
 static gchar **opt_attach_list = NULL;
@@ -81,7 +81,6 @@ accel_map_load(void)
     g_free(accel_map_filename);
 }
 
-
 static void
 accel_map_save(void)
 {
@@ -91,7 +90,6 @@ accel_map_save(void)
     g_free(accel_map_filename);
 }
 
-
 static gboolean
 balsa_main_check_new_messages(gpointer data)
 {
@@ -99,67 +97,64 @@ balsa_main_check_new_messages(gpointer data)
     return FALSE;
 }
 
-
 /* check_special_mailboxes:
    check for special mailboxes. Cannot use GUI because main window is not
    initialized yet.
- */
+*/
 static gboolean
 check_special_mailboxes(void)
 {
     gboolean bomb = FALSE;
 
     if (balsa_app.inbox == NULL) {
-        g_warning(_("Balsa cannot open your “%s” mailbox."), _("Inbox"));
-        bomb = TRUE;
+       g_warning(_("Balsa cannot open your “%s” mailbox."), _("Inbox"));
+       bomb = TRUE;
     }
 
     if (balsa_app.outbox == NULL) {
-        g_warning(_("Balsa cannot open your “%s” mailbox."),
-                  _("Outbox"));
-        bomb = TRUE;
+       g_warning(_("Balsa cannot open your “%s” mailbox."),
+                 _("Outbox"));
+       bomb = TRUE;
     }
 
     if (balsa_app.sentbox == NULL) {
-        g_warning(_("Balsa cannot open your “%s” mailbox."),
-                  _("Sentbox"));
-        bomb = TRUE;
+       g_warning(_("Balsa cannot open your “%s” mailbox."),
+                 _("Sentbox"));
+       bomb = TRUE;
     }
 
     if (balsa_app.draftbox == NULL) {
-        g_warning(_("Balsa cannot open your “%s” mailbox."),
-                  _("Draftbox"));
-        bomb = TRUE;
+       g_warning(_("Balsa cannot open your “%s” mailbox."),
+                 _("Draftbox"));
+       bomb = TRUE;
     }
 
     if (balsa_app.trash == NULL) {
-        g_warning(_("Balsa cannot open your “%s” mailbox."), _("Trash"));
-        bomb = TRUE;
+       g_warning(_("Balsa cannot open your “%s” mailbox."), _("Trash"));
+       bomb = TRUE;
     }
 
     return bomb;
 }
 
-
 static void
 config_init(gboolean check_only)
 {
-    while (!config_load() && !check_only) {
-        balsa_init_begin();
+    while(!config_load() && !check_only) {
+       balsa_init_begin();
         config_defclient_save();
     }
 }
 
-
 static void
 mailboxes_init(gboolean check_only)
 {
     check_special_mailboxes();
     if (!balsa_app.inbox && !check_only) {
-        g_warning("*** error loading mailboxes\n");
-        balsa_init_begin();
+       g_warning("*** error loading mailboxes\n");
+       balsa_init_begin();
         config_defclient_save();
-        return;
+       return;
     }
 }
 
@@ -190,9 +185,8 @@ initial_open_unread_mailboxes()
 static gboolean
 initial_open_inbox()
 {
-    if (!balsa_app.inbox) {
-        return FALSE;
-    }
+    if (!balsa_app.inbox)
+       return FALSE;
 
     printf("opening %s..\n", balsa_app.inbox->name);
     balsa_mblist_open_mailbox_hidden(balsa_app.inbox);
@@ -200,38 +194,30 @@ initial_open_inbox()
     return FALSE;
 }
 
-
 static void
-balsa_get_stats(long *unread,
-                long *unsent)
+balsa_get_stats(long *unread, long *unsent)
 {
 
-    if (balsa_app.inbox && libbalsa_mailbox_open(balsa_app.inbox, NULL)) {
+    if(balsa_app.inbox && libbalsa_mailbox_open(balsa_app.inbox, NULL) ) {
         /* set threading type to load messages */
         libbalsa_mailbox_set_threading(balsa_app.inbox,
                                        balsa_app.inbox->view->threading_type);
         *unread = balsa_app.inbox->unread_messages;
         libbalsa_mailbox_close(balsa_app.inbox, FALSE);
-    } else {
-        *unread = -1;
-    }
-    if (balsa_app.draftbox && libbalsa_mailbox_open(balsa_app.outbox, NULL)) {
+    } else *unread = -1;
+    if(balsa_app.draftbox && libbalsa_mailbox_open(balsa_app.outbox, NULL)){
         *unsent = libbalsa_mailbox_total_messages(balsa_app.outbox);
         libbalsa_mailbox_close(balsa_app.outbox, FALSE);
-    } else {
-        *unsent = -1;
-    }
+    } else *unsent = -1;
 }
 
-
 static gboolean
-open_mailboxes_idle_cb(gchar **urls)
+open_mailboxes_idle_cb(gchar ** urls)
 {
     balsa_open_mailbox_list(urls);
     return FALSE;
 }
 
-
 static void
 balsa_check_open_mailboxes(void)
 {
@@ -247,10 +233,9 @@ balsa_check_open_mailboxes(void)
     g_idle_add((GSourceFunc) open_mailboxes_idle_cb, urls);
 }
 
-
 /* scan_mailboxes:
    this is an idle handler. Expands subtrees.
- */
+*/
 static gboolean
 scan_mailboxes_idle_cb()
 {
@@ -262,19 +247,19 @@ scan_mailboxes_idle_cb()
     model = GTK_TREE_MODEL(balsa_app.mblist_tree_store);
     /* The model contains only nodes from config. */
     for (valid = gtk_tree_model_get_iter_first(model, &iter); valid;
-         valid = gtk_tree_model_iter_next(model, &iter)) {
-        BalsaMailboxNode *mbnode;
+        valid = gtk_tree_model_iter_next(model, &iter)) {
+       BalsaMailboxNode *mbnode;
 
-        gtk_tree_model_get(model, &iter, 0, &mbnode, -1);
-        balsa_mailbox_node_append_subtree(mbnode);
-        g_object_unref(mbnode);
+       gtk_tree_model_get(model, &iter, 0, &mbnode, -1);
+       balsa_mailbox_node_append_subtree(mbnode);
+       g_object_unref(mbnode);
     }
     /* The root-node (typically ~/mail) isn't in the model, so its
      * children will be appended to the top level. */
     balsa_mailbox_node_append_subtree(balsa_app.root_node);
 
     url_array = g_ptr_array_new();
-    if (cmd_open_unread_mailbox || balsa_app.open_unread_mailbox) {
+    if (cmd_open_unread_mailbox || balsa_app.open_unread_mailbox){
         GList *l, *gl;
 
         gl = balsa_mblist_find_all_unread_mboxes(NULL);
@@ -297,17 +282,15 @@ scan_mailboxes_idle_cb()
         urls = g_strsplit(join, ";", 20);
         g_free(join);
 
-        for (p = urls; *p; p++) {
+        for (p = urls; *p; p++)
             g_ptr_array_add(url_array, *p);
-        }
         g_free(urls); /* not g_strfreev */
     }
 
     if (balsa_app.remember_open_mboxes) {
-        if (balsa_app.current_mailbox_url) {
+        if (balsa_app.current_mailbox_url)
             g_ptr_array_add(url_array,
                             g_strdup(balsa_app.current_mailbox_url));
-        }
         balsa_add_open_mailbox_urls(url_array);
     }
 
@@ -321,7 +304,7 @@ scan_mailboxes_idle_cb()
                                                             FALSE));
     }
 
-    if (cmd_get_stats) {
+    if(cmd_get_stats) {
         long unread, unsent;
         balsa_get_stats(&unread, &unsent);
         printf("Unread: %ld Unsent: %ld\n", unread, unsent);
@@ -330,16 +313,13 @@ scan_mailboxes_idle_cb()
     return FALSE;
 }
 
-
 /* periodic_expunge_func makes sure that even the open mailboxes get
  * expunged now and than, even if they are opened longer than
  * balsa_app.expunge_timeout. If we did not do it, the mailboxes would in
  * principle grow indefinetely. */
 static gboolean
-mbnode_expunge_func(GtkTreeModel *model,
-                    GtkTreePath  *path,
-                    GtkTreeIter  *iter,
-                    GSList      **list)
+mbnode_expunge_func(GtkTreeModel *model, GtkTreePath *path,
+                    GtkTreeIter *iter, GSList ** list)
 {
     BalsaMailboxNode *mbnode;
 
@@ -351,43 +331,38 @@ mbnode_expunge_func(GtkTreeModel *model,
     return FALSE;
 }
 
-
 static gboolean
 periodic_expunge_cb(void)
 {
     GSList *list = NULL, *l;
 
     /* should we enforce expunging now and then? Perhaps not... */
-    if (!balsa_app.expunge_auto) {
-        return TRUE;
-    }
+    if(!balsa_app.expunge_auto) return TRUE;
 
     libbalsa_information(LIBBALSA_INFORMATION_DEBUG,
                          _("Compressing mail folders…"));
     gtk_tree_model_foreach(GTK_TREE_MODEL(balsa_app.mblist_tree_store),
-                           (GtkTreeModelForeachFunc)mbnode_expunge_func,
-                           &list);
+                          (GtkTreeModelForeachFunc)mbnode_expunge_func,
+                          &list);
 
     for (l = list; l; l = l->next) {
         BalsaMailboxNode *mbnode = l->data;
         if (mbnode->mailbox && libbalsa_mailbox_is_open(mbnode->mailbox)
             && !mbnode->mailbox->readonly) {
             time_t tm = time(NULL);
-            if (tm - mbnode->last_use > balsa_app.expunge_timeout) {
+            if (tm-mbnode->last_use > balsa_app.expunge_timeout)
                 libbalsa_mailbox_sync_storage(mbnode->mailbox, TRUE);
-            }
         }
         g_object_unref(mbnode);
     }
     g_slist_free(list);
 
     /* purge imap cache? leave 15MB */
-    libbalsa_imap_purge_temp_dir(15 * 1024 * 1024);
+    libbalsa_imap_purge_temp_dir(15*1024*1024);
 
     return TRUE; /* do it later as well */
 }
 
-
 /*
  * Wrappers for libbalsa access to the progress bar.
  */
@@ -396,11 +371,10 @@ periodic_expunge_cb(void)
  * Initialize the progress bar and set text.
  */
 static GTimeVal prev_time_val;
-static gdouble min_fraction;
+static gdouble  min_fraction;
 static void
-balsa_progress_set_text(LibBalsaProgress *progress,
-                        const gchar      *text,
-                        guint             total)
+balsa_progress_set_text(LibBalsaProgress * progress, const gchar * text,
+                        guint total)
 {
     gboolean rc = FALSE;
 
@@ -410,9 +384,8 @@ balsa_progress_set_text(LibBalsaProgress *progress,
 
     /* balsa_window_setup_progress is thread-safe, so we do not check
      * for a subthread */
-    if (!text || (total >= LIBBALSA_PROGRESS_MIN_COUNT)) {
+    if (!text || total >= LIBBALSA_PROGRESS_MIN_COUNT)
         rc = balsa_window_setup_progress(balsa_app.main_window, text);
-    }
     g_get_current_time(&prev_time_val);
     min_fraction = LIBBALSA_PROGRESS_MIN_UPDATE_STEP;
 
@@ -420,58 +393,48 @@ balsa_progress_set_text(LibBalsaProgress *progress,
         LIBBALSA_PROGRESS_YES : LIBBALSA_PROGRESS_NO;
 }
 
-
 /*
  * Set the fraction in the progress bar.
  */
 
 static void
-balsa_progress_set_fraction(LibBalsaProgress *progress,
-                            gdouble           fraction)
+balsa_progress_set_fraction(LibBalsaProgress * progress, gdouble fraction)
 {
     GTimeVal time_val;
     guint elapsed;
 
-    if (*progress == LIBBALSA_PROGRESS_NO) {
+    if (*progress == LIBBALSA_PROGRESS_NO)
         return;
-    }
 
-    if ((fraction > 0.0) && (fraction < min_fraction)) {
+    if (fraction > 0.0 && fraction < min_fraction)
         return;
-    }
 
     g_get_current_time(&time_val);
     elapsed = time_val.tv_sec - prev_time_val.tv_sec;
     elapsed *= G_USEC_PER_SEC;
     elapsed += time_val.tv_usec - prev_time_val.tv_usec;
-    if (elapsed < LIBBALSA_PROGRESS_MIN_UPDATE_USECS) {
+    if (elapsed < LIBBALSA_PROGRESS_MIN_UPDATE_USECS)
         return;
-    }
 
     g_time_val_add(&time_val, LIBBALSA_PROGRESS_MIN_UPDATE_USECS);
     min_fraction += LIBBALSA_PROGRESS_MIN_UPDATE_STEP;
 
-    if (balsa_app.main_window) {
+    if (balsa_app.main_window)
         balsa_window_increment_progress(balsa_app.main_window, fraction,
                                         !libbalsa_am_i_subthread());
-    }
 }
 
-
 static void
-balsa_progress_set_activity(gboolean     set,
-                            const gchar *text)
+balsa_progress_set_activity(gboolean set, const gchar * text)
 {
     if (balsa_app.main_window) {
-        if (set) {
+        if (set)
             balsa_window_increase_activity(balsa_app.main_window, text);
-        } else {
+        else
             balsa_window_decrease_activity(balsa_app.main_window, text);
-        }
     }
 }
 
-
 static gboolean
 balsa_check_open_compose_window(void)
 {
@@ -483,20 +446,18 @@ balsa_check_open_compose_window(void)
         snd->quit_on_close = FALSE;
 
         if (opt_compose_email) {
-            if (g_ascii_strncasecmp(opt_compose_email, "mailto:";, 7) == 0) {
+            if (g_ascii_strncasecmp(opt_compose_email, "mailto:";, 7) == 0)
                 sendmsg_window_process_url(opt_compose_email + 7,
                                            sendmsg_window_set_field, snd);
-            } else {
+            else
                 sendmsg_window_set_field(snd, "to", opt_compose_email);
-            }
             g_free(opt_compose_email);
             opt_compose_email = NULL;
         }
 
         if (opt_attach_list) {
-            for (attach = opt_attach_list; *attach; ++attach) {
+            for (attach = opt_attach_list; *attach; ++attach)
                 add_attachment(snd, *attach, FALSE, NULL);
-            }
             g_strfreev(opt_attach_list);
             opt_attach_list = NULL;
         }
@@ -507,11 +468,9 @@ balsa_check_open_compose_window(void)
     return FALSE;
 }
 
-
 /* -------------------------- main --------------------------------- */
 static int
-real_main(int   argc,
-          char *argv[])
+real_main(int argc, char *argv[])
 {
     GtkWidget *window;
     gchar *default_icon;
@@ -531,10 +490,8 @@ real_main(int   argc,
 
 #ifdef HAVE_GPGME
     /* initialise the gpgme library and set the callback funcs */
-    libbalsa_gpgme_init(lb_gpgme_passphrase,
-                        lb_gpgme_select_key,
-                        lb_gpgme_accept_low_trust_key);
-
+    libbalsa_gpgme_init(lb_gpgme_passphrase, lb_gpgme_select_key,
+                       lb_gpgme_accept_low_trust_key);
 #endif
 
     balsa_app_init();
@@ -544,7 +501,7 @@ real_main(int   argc,
     libbalsa_filters_set_url_mapper(balsa_find_mailbox_by_url);
     libbalsa_filters_set_filter_list(&balsa_app.filters);
 
-    libbalsa_progress_set_text = balsa_progress_set_text;
+    libbalsa_progress_set_text     = balsa_progress_set_text;
     libbalsa_progress_set_fraction = balsa_progress_set_fraction;
     libbalsa_progress_set_activity = balsa_progress_set_activity;
 
@@ -554,7 +511,7 @@ real_main(int   argc,
     config_init(cmd_get_stats);
 
     default_icon = balsa_pixmap_finder("balsa_icon.png");
-    if (default_icon) { /* may be NULL for developer installations */
+    if(default_icon) { /* may be NULL for developer installations */
         gtk_window_set_default_icon_from_file(default_icon, NULL);
         g_free(default_icon);
     }
@@ -564,7 +521,7 @@ real_main(int   argc,
     window = balsa_window_new();
     balsa_app.main_window = BALSA_WINDOW(window);
     g_object_add_weak_pointer(G_OBJECT(window),
-                              (gpointer) & balsa_app.main_window);
+                             (gpointer) &balsa_app.main_window);
 
     /* load mailboxes */
     config_load_sections();
@@ -601,10 +558,9 @@ real_main(int   argc,
     }
     g_timeout_add_seconds(1801, (GSourceFunc) periodic_expunge_cb, NULL);
 
-    if (cmd_check_mail_on_startup || balsa_app.check_mail_upon_startup) {
+    if (cmd_check_mail_on_startup || balsa_app.check_mail_upon_startup)
         g_idle_add((GSourceFunc) balsa_main_check_new_messages,
                    balsa_app.main_window);
-    }
 
     accel_map_load();
     gtk_main();
@@ -616,7 +572,6 @@ real_main(int   argc,
     return 0;
 }
 
-
 static void
 balsa_cleanup(void)
 {
@@ -625,14 +580,13 @@ balsa_cleanup(void)
     libbalsa_conf_drop_all();
 }
 
-
 /*
  * Parse command line options
  */
 static gint
-parse_options(int                      argc,
-              char                   **argv,
-              GApplicationCommandLine *command_line)
+parse_options(int                       argc,
+              char                   ** argv,
+              GApplicationCommandLine * command_line)
 {
     static gboolean help;
     static gboolean version;
@@ -694,7 +648,7 @@ parse_options(int                      argc,
      * also support the legacy "-?".
      * If we got an error, we check to see if it was caused by -?,
      * and if so, honor it: */
-    if (!rc && (strcmp(*++argv, "-?") == 0)) {
+    if (!rc && strcmp(*++argv, "-?") == 0) {
         rc = help = TRUE;
         g_error_free(error);
     }
@@ -736,11 +690,9 @@ parse_options(int                      argc,
     return status;
 }
 
-
 static void
-handle_remote(int                      argc,
-              char                   **argv,
-              GApplicationCommandLine *command_line)
+handle_remote(int argc, char **argv,
+              GApplicationCommandLine * command_line)
 {
     if (cmd_get_stats) {
         glong unread, unsent;
@@ -750,21 +702,17 @@ handle_remote(int                      argc,
                                          "Unread: %ld Unsent: %ld\n",
                                          unread, unsent);
     } else {
-        if (cmd_check_mail_on_startup) {
+        if (cmd_check_mail_on_startup)
             balsa_main_check_new_messages(balsa_app.main_window);
-        }
 
-        if (cmd_open_unread_mailbox) {
+        if (cmd_open_unread_mailbox)
             initial_open_unread_mailboxes();
-        }
 
-        if (cmd_open_inbox) {
+        if (cmd_open_inbox)
             initial_open_inbox();
-        }
 
-        if (cmd_line_open_mailboxes) {
+        if (cmd_line_open_mailboxes)
             balsa_check_open_mailboxes();
-        }
 
         if (!balsa_check_open_compose_window()) {
             /* Move the main window to the request's screen */
@@ -773,11 +721,10 @@ handle_remote(int                      argc,
     }
 }
 
-
 static int
-command_line_cb(GApplication            *application,
-                GApplicationCommandLine *command_line,
-                gpointer                 user_data)
+command_line_cb(GApplication            * application,
+                GApplicationCommandLine * command_line,
+                gpointer                  user_data)
 {
     gchar **args, **argv;
     gint argc;
@@ -801,9 +748,8 @@ command_line_cb(GApplication            *application,
             /* This is the primary instance; start up as usual. */
             status = real_main(argc, argv);
         }
-    } else if (status == 2) { /* handled a "help" or "version" request */
+    } else if (status == 2) /* handled a "help" or "version" request */
         status = 0;
-    }
 
     g_free(argv);
     g_strfreev(args);
@@ -811,17 +757,15 @@ command_line_cb(GApplication            *application,
     return status;
 }
 
-
 int
-main(int    argc,
-     char **argv)
+main(int argc, char **argv)
 {
     GtkApplication *application;
     int status;
 
     balsa_app.application = application =
-            gtk_application_new("org.desktop.Balsa",
-                                G_APPLICATION_HANDLES_COMMAND_LINE);
+        gtk_application_new("org.desktop.Balsa",
+                            G_APPLICATION_HANDLES_COMMAND_LINE);
     g_signal_connect(application, "command-line",
                      G_CALLBACK(command_line_cb), NULL);
     g_object_set(application, "register-session", TRUE, NULL);
diff --git a/src/message-window.c b/src/message-window.c
index 5d723dd..462ce7a 100644
--- a/src/message-window.c
+++ b/src/message-window.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "message-window.h"
 
@@ -36,7 +36,7 @@
 #include <gdk/gdkkeysyms.h>
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#  include "macosx-helpers.h"
 #endif
 
 struct _MessageWindow {
@@ -62,51 +62,44 @@ struct _MessageWindow {
  */
 
 static void
-mw_set_enabled(MessageWindow *mw,
-               const gchar   *action_name,
-               gboolean       enabled)
+mw_set_enabled(MessageWindow * mw, const gchar * action_name,
+               gboolean enabled)
 {
     GAction *action =
         g_action_map_lookup_action(G_ACTION_MAP(mw->window), action_name);
 
-    if (action) {
+    if (action)
         g_simple_action_set_enabled(G_SIMPLE_ACTION(action), enabled);
-    } else {
+    else
         g_print("%s action “%s” not found\n", __func__, action_name);
-    }
 }
 
-
 /*
  * Set the state of a toggle GAction
  */
 static void
-mw_set_active(MessageWindow *mw,
-              const gchar   *action_name,
-              gboolean       state)
+mw_set_active(MessageWindow * mw,
+              const gchar   * action_name,
+              gboolean        state)
 {
     GAction *action =
         g_action_map_lookup_action(G_ACTION_MAP(mw->window), action_name);
 
-    if (action) {
+    if (action)
         g_action_change_state(action, g_variant_new_boolean(state));
-    } else {
+    else
         g_print("%s action “%s” not found\n", __func__, action_name);
-    }
 }
 
-
 /*
  * end of GAction helpers
  */
 
 static void
-mw_set_part_buttons_sensitive(MessageWindow *mw,
-                              BalsaMessage  *msg)
+mw_set_part_buttons_sensitive(MessageWindow * mw, BalsaMessage * msg)
 {
-    if (!msg || !msg->treeview) {
-        return;
-    }
+    if (!msg || !msg->treeview)
+       return;
 
     mw_set_enabled(mw, "next-part",
                    balsa_message_has_next_part(msg));
@@ -114,9 +107,8 @@ mw_set_part_buttons_sensitive(MessageWindow *mw,
                    balsa_message_has_previous_part(msg));
 }
 
-
 static gboolean
-message_window_idle_handler(MessageWindow *mw)
+message_window_idle_handler(MessageWindow * mw)
 {
     BalsaMessage *msg;
 
@@ -132,39 +124,38 @@ message_window_idle_handler(MessageWindow *mw)
     return FALSE;
 }
 
-
 /* ===================================================================
    Balsa menus. Touchpad has some simplified menus which do not
    overlap very much with the default balsa menus. They are here
    because they represent an alternative probably appealing to the all
    proponents of GNOME2 dumbify approach (OK, I am bit unfair here).
- */
+*/
 
 /* Standard buttons; "" means a separator. */
 static const BalsaToolbarEntry message_toolbar[] = {
-    { "next-unread", BALSA_PIXMAP_NEXT_UNREAD   },
+    { "next-unread",      BALSA_PIXMAP_NEXT_UNREAD   },
     { "", ""                                         },
-    { "reply", BALSA_PIXMAP_REPLY         },
-    { "reply-all", BALSA_PIXMAP_REPLY_ALL     },
-    { "reply-group", BALSA_PIXMAP_REPLY_GROUP   },
+    { "reply",            BALSA_PIXMAP_REPLY         },
+    { "reply-all",        BALSA_PIXMAP_REPLY_ALL     },
+    { "reply-group",      BALSA_PIXMAP_REPLY_GROUP   },
     { "forward-attached", BALSA_PIXMAP_FORWARD       },
     { "", ""                                         },
-    { "previous-part", BALSA_PIXMAP_PREVIOUS_PART },
-    { "next-part", BALSA_PIXMAP_NEXT_PART     },
-    { "save-part", "document-save"             },
+    { "previous-part",    BALSA_PIXMAP_PREVIOUS_PART },
+    { "next-part",        BALSA_PIXMAP_NEXT_PART     },
+    { "save-part",       "document-save"             },
     { "", ""                                         },
-    { "print", "document-print"            },
+    { "print",           "document-print"            },
     { "", ""                                         },
-    { "move-to-trash", "edit-delete"               }
+    { "move-to-trash",   "edit-delete"               }
 };
 
 /* Optional extra buttons */
 static const BalsaToolbarEntry message_toolbar_extras[] = {
     { "previous-message", BALSA_PIXMAP_PREVIOUS      },
-    { "next-message", BALSA_PIXMAP_NEXT          },
-    { "next-flagged", BALSA_PIXMAP_NEXT_FLAGGED  },
-    { "previous-part", BALSA_PIXMAP_PREVIOUS_PART },
-    { "close", "window-close-symbolic"     },
+    { "next-message",     BALSA_PIXMAP_NEXT          },
+    { "next-flagged",     BALSA_PIXMAP_NEXT_FLAGGED  },
+    { "previous-part",    BALSA_PIXMAP_PREVIOUS_PART },
+    { "close",           "window-close-symbolic"     },
     { "show-all-headers", BALSA_PIXMAP_SHOW_HEADERS  }
 };
 
@@ -176,9 +167,8 @@ message_window_get_toolbar_model(void)
 {
     static BalsaToolbarModel *model = NULL;
 
-    if (model) {
+    if (model)
         return model;
-    }
 
     model =
         balsa_toolbar_model_new(BALSA_TOOLBAR_TYPE_MESSAGE_WINDOW,
@@ -190,7 +180,6 @@ message_window_get_toolbar_model(void)
     return model;
 }
 
-
 /*
  * end of UI definitions and functions
  */
@@ -198,60 +187,54 @@ message_window_get_toolbar_model(void)
 #define BALSA_MESSAGE_WINDOW_KEY "balsa-message-window"
 
 static void
-mw_bindex_closed_cb(gpointer data,
-                    GObject *bindex)
+mw_bindex_closed_cb(gpointer data, GObject *bindex)
 {
     MessageWindow *mw = data;
     mw->bindex = NULL;
     gtk_widget_destroy(mw->window);
 }
 
-
 static void
-mw_disable_trash(MessageWindow *mw)
+mw_disable_trash(MessageWindow * mw)
 {
     mw_set_enabled(mw, "move-to-trash", FALSE);
 }
 
-
 /*
  * GAction callbacks for toggle and radio buttons
  */
 
 static void
-mw_show_toolbar_change_state(GSimpleAction *action,
-                             GVariant      *state,
-                             gpointer       data)
+mw_show_toolbar_change_state(GSimpleAction * action,
+                             GVariant      * state,
+                             gpointer        data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
     balsa_app.show_message_toolbar = g_variant_get_boolean(state);
-    if (balsa_app.show_message_toolbar) {
+    if (balsa_app.show_message_toolbar)
         gtk_widget_show(mw->toolbar);
-    } else {
+    else
         gtk_widget_hide(mw->toolbar);
-    }
 
     g_simple_action_set_state(action, state);
 }
 
-
 static void
-mw_wrap_change_state(GSimpleAction *action,
-                     GVariant      *state,
-                     gpointer       data)
+mw_wrap_change_state(GSimpleAction * action,
+                     GVariant      * state,
+                     gpointer        data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
     balsa_message_set_wrap(BALSA_MESSAGE(mw->bmessage),
-                           g_variant_get_boolean(state));
+                          g_variant_get_boolean(state));
 
     g_simple_action_set_state(action, state);
 }
 
-
 static void
-mw_reset_show_all_headers(MessageWindow *mw)
+mw_reset_show_all_headers(MessageWindow * mw)
 {
     if (mw->show_all_headers) {
         mw_set_active(mw, "show-all-headers", FALSE);
@@ -259,11 +242,10 @@ mw_reset_show_all_headers(MessageWindow *mw)
     }
 }
 
-
 static void
-mw_header_change_state(GSimpleAction *action,
-                       GVariant      *state,
-                       gpointer       data)
+mw_header_change_state(GSimpleAction * action,
+                       GVariant      * state,
+                       gpointer        data)
 {
     MessageWindow *mw = (MessageWindow *) data;
     const gchar *value;
@@ -271,13 +253,13 @@ mw_header_change_state(GSimpleAction *action,
 
     value = g_variant_get_string(state, NULL);
 
-    if (strcmp(value, "none") == 0) {
+    if (strcmp(value, "none") == 0)
         sh = HEADERS_NONE;
-    } else if (strcmp(value, "selected") == 0) {
+    else if (strcmp(value, "selected") == 0)
         sh = HEADERS_SELECTED;
-    } else if (strcmp(value, "all") == 0) {
+    else if (strcmp(value, "all") == 0)
         sh = HEADERS_ALL;
-    } else {
+    else {
         g_print("%s unknown value “%s”\n", __func__, value);
         return;
     }
@@ -289,11 +271,10 @@ mw_header_change_state(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 static void
-mw_show_all_headers_change_state(GSimpleAction *action,
-                                 GVariant      *state,
-                                 gpointer       data)
+mw_show_all_headers_change_state(GSimpleAction * action,
+                                 GVariant      * state,
+                                 gpointer        data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
@@ -305,26 +286,22 @@ mw_show_all_headers_change_state(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 /*
  * end of GAction callbacks for toggle and radio buttons
  */
 
 static void
-mw_menubar_foreach(GtkWidget *widget,
-                   gpointer   data)
+mw_menubar_foreach(GtkWidget *widget, gpointer data)
 {
     GtkWidget **move_menu = data;
     GtkMenuItem *item = GTK_MENU_ITEM(widget);
 
-    if (strcmp(gtk_menu_item_get_label(item), _("M_ove")) == 0) {
+    if (strcmp(gtk_menu_item_get_label(item), _("M_ove")) == 0)
         *move_menu = widget;
-    }
 }
 
-
 static void
-mw_set_buttons_sensitive(MessageWindow *mw)
+mw_set_buttons_sensitive(MessageWindow * mw)
 {
     LibBalsaMailbox *mailbox = mw->message->mailbox;
     BalsaIndex *index = mw->bindex;
@@ -351,13 +328,11 @@ mw_set_buttons_sensitive(MessageWindow *mw)
     mw_set_enabled(mw, "next-flagged", enable);
 }
 
-
 static void
-mw_set_message(MessageWindow   *mw,
-               LibBalsaMessage *message)
+mw_set_message(MessageWindow * mw, LibBalsaMessage * message)
 {
     if (message == NULL) {
-        libbalsa_clear_source_id(&mw->idle_handler_id);
+       libbalsa_clear_source_id(&mw->idle_handler_id);
     }
 
     if (mw->message) {
@@ -369,19 +344,16 @@ mw_set_message(MessageWindow   *mw,
 
     if (message) {
         g_object_set_data(G_OBJECT(message), BALSA_MESSAGE_WINDOW_KEY, mw);
-        if (mw->idle_handler_id == 0U) {
+        if (mw->idle_handler_id == 0U)
             mw->idle_handler_id =
                 g_idle_add((GSourceFunc) message_window_idle_handler, mw);
-        }
         mw_set_buttons_sensitive(mw);
     }
 }
 
-
 /* Handler for the "destroy" signal for mw->window. */
 static void
-destroy_message_window(GtkWidget     *widget,
-                       MessageWindow *mw)
+destroy_message_window(GtkWidget * widget, MessageWindow * mw)
 {
     if (mw->bindex) {           /* BalsaIndex still exists */
         g_object_weak_unref(G_OBJECT(mw->bindex), mw_bindex_closed_cb, mw);
@@ -392,41 +364,34 @@ destroy_message_window(GtkWidget     *widget,
     }
 
     if (mw->mailbox) {
-        g_object_remove_weak_pointer(G_OBJECT(mw->mailbox), (gpointer) & mw->mailbox);
+        g_object_remove_weak_pointer(G_OBJECT(mw->mailbox), (gpointer) &mw->mailbox);
         g_signal_handlers_disconnect_matched(G_OBJECT(mw->mailbox),
                                              G_SIGNAL_MATCH_DATA, 0, 0,
                                              NULL, NULL, mw);
         mw->mailbox = NULL;
     }
 
-    if (mw->bmessage) {
+    if (mw->bmessage)
         g_signal_handlers_disconnect_matched(G_OBJECT(mw->bmessage),
                                              G_SIGNAL_MATCH_DATA, 0, 0,
                                              NULL, NULL, mw);
-    }
 
     mw_set_message(mw, NULL);
 
     g_free(mw);
 }
 
-
 /* Handler for the mailbox's "message-expunged" signal */
 static void
-mw_expunged_cb(LibBalsaMailbox *mailbox,
-               guint            msgno,
-               MessageWindow   *mw)
+mw_expunged_cb(LibBalsaMailbox * mailbox, guint msgno, MessageWindow * mw)
 {
-    if (mw->message && ((guint) mw->message->msgno == msgno)) {
+    if (mw->message && (guint) mw->message->msgno == msgno)
         gtk_widget_destroy(mw->window);
-    }
 }
 
-
 static void
-mw_reply_activated(GSimpleAction *action,
-                   GVariant      *parameter,
-                   gpointer       data)
+mw_reply_activated(GSimpleAction * action, GVariant * parameter,
+                   gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
@@ -436,11 +401,9 @@ mw_reply_activated(GSimpleAction *action,
                          SEND_REPLY);
 }
 
-
 static void
-mw_reply_all_activated(GSimpleAction *action,
-                       GVariant      *parameter,
-                       gpointer       data)
+mw_reply_all_activated(GSimpleAction * action, GVariant * parameter,
+                       gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
@@ -450,11 +413,9 @@ mw_reply_all_activated(GSimpleAction *action,
                          SEND_REPLY_ALL);
 }
 
-
 static void
-mw_reply_group_activated(GSimpleAction *action,
-                         GVariant      *parameter,
-                         gpointer       data)
+mw_reply_group_activated(GSimpleAction * action, GVariant * parameter,
+                         gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
@@ -464,11 +425,9 @@ mw_reply_group_activated(GSimpleAction *action,
                          SEND_REPLY_GROUP);
 }
 
-
 static void
-mw_forward_attached_activated(GSimpleAction *action,
-                              GVariant      *parameter,
-                              gpointer       data)
+mw_forward_attached_activated(GSimpleAction * action, GVariant * parameter,
+                              gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
@@ -477,11 +436,9 @@ mw_forward_attached_activated(GSimpleAction *action,
     sendmsg_window_forward(mw->message->mailbox, mw->message->msgno, TRUE);
 }
 
-
 static void
-mw_forward_inline_activated(GSimpleAction *action,
-                            GVariant      *parameter,
-                            gpointer       data)
+mw_forward_inline_activated(GSimpleAction * action, GVariant * parameter,
+                            gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
@@ -491,12 +448,10 @@ mw_forward_inline_activated(GSimpleAction *action,
                            FALSE);
 }
 
-
 #if 0
 static void
-mw_forward_default_activated(GSimpleAction *action,
-                             GVariant      *parameter,
-                             gpointer       data)
+mw_forward_default_activated(GSimpleAction * action, GVariant * parameter,
+                             gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
@@ -505,47 +460,38 @@ mw_forward_default_activated(GSimpleAction *action,
     sendmsg_window_forward(mw->message->mailbox, mw->message->msgno,
                            balsa_app.forward_attached);
 }
-
-
 #endif
 
 static void
-mw_next_part_activated(GSimpleAction *action,
-                       GVariant      *parameter,
-                       gpointer       data)
+mw_next_part_activated(GSimpleAction * action, GVariant * parameter,
+                       gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
     balsa_message_next_part(BALSA_MESSAGE(mw->bmessage));
 }
 
-
 static void
-mw_previous_part_activated(GSimpleAction *action,
-                           GVariant      *parameter,
-                           gpointer       data)
+mw_previous_part_activated(GSimpleAction * action, GVariant * parameter,
+                           gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
     balsa_message_previous_part(BALSA_MESSAGE(mw->bmessage));
 }
 
-
 static void
-mw_save_part_activated(GSimpleAction *action,
-                       GVariant      *parameter,
-                       gpointer       data)
+mw_save_part_activated(GSimpleAction * action, GVariant * parameter,
+                       gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
     balsa_message_save_current_part(BALSA_MESSAGE(mw->bmessage));
 }
 
-
 static void
-mw_view_source_activated(GSimpleAction *action,
-                         GVariant      *parameter,
-                         gpointer       data)
+mw_view_source_activated(GSimpleAction * action, GVariant * parameter,
+                         gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
     libbalsa_show_message_source(balsa_app.application,
@@ -555,43 +501,36 @@ mw_view_source_activated(GSimpleAction *action,
                                  &balsa_app.source_height);
 }
 
-
 static void
-mw_close_activated(GSimpleAction *action,
-                   GVariant      *parameter,
-                   gpointer       data)
+mw_close_activated(GSimpleAction * action, GVariant * parameter,
+                   gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
     gtk_widget_destroy(mw->window);
 }
 
-
 static void
-size_alloc_cb(GtkWidget *window)
+size_alloc_cb(GtkWidget * window)
 {
     GdkWindow *gdk_window;
 
     gdk_window = gtk_widget_get_window(window);
-    if (gdk_window == NULL) {
+    if (gdk_window == NULL)
         return;
-    }
 
     balsa_app.message_window_maximized =
         (gdk_window_get_state(gdk_window) &
          (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN)) != 0;
 
-    if (!balsa_app.message_window_maximized) {
+    if (!balsa_app.message_window_maximized)
         gtk_window_get_size(GTK_WINDOW(window),
-                            &balsa_app.message_window_width,
-                            &balsa_app.message_window_height);
-    }
+                            & balsa_app.message_window_width,
+                            & balsa_app.message_window_height);
 }
 
-
 static void
-mw_copy_activated(GSimpleAction *action,
-                  GVariant      *parameter,
-                  gpointer       data)
+mw_copy_activated(GSimpleAction * action, GVariant * parameter,
+                  gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
     guint signal_id;
@@ -599,37 +538,30 @@ mw_copy_activated(GSimpleAction *action,
 
     signal_id = g_signal_lookup("copy-clipboard",
                                 G_TYPE_FROM_INSTANCE(focus_widget));
-    if (signal_id) {
+    if (signal_id)
         g_signal_emit(focus_widget, signal_id, (GQuark) 0);
-    }
 }
 
-
 static void
-mw_select_text_activated(GSimpleAction *action,
-                         GVariant      *parameter,
-                         gpointer       data)
+mw_select_text_activated(GSimpleAction * action, GVariant * parameter,
+                         gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
     balsa_window_select_all(GTK_WINDOW(mw->window));
 }
 
-
 static void
-mw_find_in_message_activated(GSimpleAction *action,
-                             GVariant      *parameter,
-                             gpointer       data)
+mw_find_in_message_activated(GSimpleAction * action, GVariant * parameter,
+                             gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
     balsa_message_find_in_message(BALSA_MESSAGE(mw->bmessage));
 }
 
-
 static void
-mw_set_selected(MessageWindow *mw,
-                void (        *select_func)(BalsaIndex *))
+mw_set_selected(MessageWindow * mw, void (*select_func) (BalsaIndex *))
 {
     guint msgno;
     LibBalsaMessage *message;
@@ -639,9 +571,8 @@ mw_set_selected(MessageWindow *mw,
     select_func(mw->bindex);
     msgno = balsa_index_get_next_msgno(mw->bindex);
     message = libbalsa_mailbox_get_message(mw->message->mailbox, msgno);
-    if (!message) {
+    if (!message)
         return;
-    }
 
     if ((tmp = g_object_get_data(G_OBJECT(message),
                                  BALSA_MESSAGE_WINDOW_KEY))) {
@@ -657,10 +588,8 @@ mw_set_selected(MessageWindow *mw,
     mw_set_message(mw, message);
 }
 
-
 static void
-message_window_move_message(MessageWindow   *mw,
-                            LibBalsaMailbox *mailbox)
+message_window_move_message(MessageWindow * mw, LibBalsaMailbox * mailbox)
 {
     GArray *messages;
     LibBalsaMessage *original = mw->message;
@@ -668,35 +597,30 @@ message_window_move_message(MessageWindow   *mw,
     g_return_if_fail(mailbox != NULL);
 
     /* Transferring to same mailbox? */
-    if (mw->message->mailbox == mailbox) {
+    if (mw->message->mailbox == mailbox)
         return;
-    }
 
     messages = g_array_new(FALSE, FALSE, sizeof(guint));
     g_array_append_val(messages, mw->message->msgno);
 
-    if (balsa_app.mw_action_after_move == NEXT_UNREAD) {
+    if (balsa_app.mw_action_after_move == NEXT_UNREAD)
         /* Try selecting the next unread message. */
         mw_set_selected(mw, ((void (*)(BalsaIndex *))
                              balsa_index_select_next_unread));
-    } else if (balsa_app.mw_action_after_move == NEXT) {
+    else if (balsa_app.mw_action_after_move == NEXT)
         mw_set_selected(mw, balsa_index_select_next);
-    }
 
     balsa_index_transfer(mw->bindex, messages, mailbox, FALSE);
     g_array_free(messages, TRUE);
 
-    if (mw->message == original) {
+    if (mw->message == original)
         /* Either action-after-move was CLOSE, or we failed to select
          * another message; either way, we close the window. */
         gtk_widget_destroy(mw->window);
-    }
 }
 
-
 static void
-mw_mru_menu_cb(gchar   *url,
-               gpointer data)
+mw_mru_menu_cb(gchar * url, gpointer data)
 {
     LibBalsaMailbox *mailbox = balsa_find_mailbox_by_url(url);
     MessageWindow *mw = data;
@@ -704,33 +628,27 @@ mw_mru_menu_cb(gchar   *url,
     message_window_move_message(mw, mailbox);
 }
 
-
 static void
-mw_next_message_activated(GSimpleAction *action,
-                          GVariant      *parameter,
-                          gpointer       data)
+mw_next_message_activated(GSimpleAction * action, GVariant * parameter,
+                          gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
     mw_set_selected(mw, balsa_index_select_next);
 }
 
-
 static void
-mw_previous_message_activated(GSimpleAction *action,
-                              GVariant      *parameter,
-                              gpointer       data)
+mw_previous_message_activated(GSimpleAction * action, GVariant * parameter,
+                              gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
     mw_set_selected(mw, balsa_index_select_previous);
 }
 
-
 static void
-mw_next_unread_activated(GSimpleAction *action,
-                         GVariant      *parameter,
-                         gpointer       data)
+mw_next_unread_activated(GSimpleAction * action, GVariant * parameter,
+                         gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
@@ -738,11 +656,9 @@ mw_next_unread_activated(GSimpleAction *action,
                          balsa_index_select_next_unread));
 }
 
-
 static void
-mw_next_flagged_activated(GSimpleAction *action,
-                          GVariant      *parameter,
-                          gpointer       data)
+mw_next_flagged_activated(GSimpleAction * action, GVariant * parameter,
+                          gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
@@ -751,9 +667,8 @@ mw_next_flagged_activated(GSimpleAction *action,
 
 
 static void
-mw_page_setup_activated(GSimpleAction *action,
-                        GVariant      *parameter,
-                        gpointer       data)
+mw_page_setup_activated(GSimpleAction * action, GVariant * parameter,
+                        gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
@@ -762,65 +677,53 @@ mw_page_setup_activated(GSimpleAction *action,
 
 
 static void
-mw_print_activated(GSimpleAction *action,
-                   GVariant      *parameter,
-                   gpointer       data)
+mw_print_activated(GSimpleAction * action, GVariant * parameter,
+                   gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
 
     message_print(mw->message, GTK_WINDOW(mw->window));
 }
 
-
 static void
-mw_move_to_trash_activated(GSimpleAction *action,
-                           GVariant      *parameter,
-                           gpointer       data)
+mw_move_to_trash_activated(GSimpleAction * action, GVariant * parameter,
+                           gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
     message_window_move_message(mw, balsa_app.trash);
 }
 
-
 #ifdef HAVE_HTML_WIDGET
 static void
-mw_zoom_in_activated(GSimpleAction *action,
-                     GVariant      *parameter,
-                     gpointer       data)
+mw_zoom_in_activated(GSimpleAction * action, GVariant * parameter,
+                     gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
     GtkWidget *bm = mw->bmessage;
     balsa_message_zoom(BALSA_MESSAGE(bm), 1);
 }
 
-
 static void
-mw_zoom_out_activated(GSimpleAction *action,
-                      GVariant      *parameter,
-                      gpointer       data)
+mw_zoom_out_activated(GSimpleAction * action, GVariant * parameter,
+                      gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
     GtkWidget *bm = mw->bmessage;
     balsa_message_zoom(BALSA_MESSAGE(bm), -1);
 }
 
-
 static void
-mw_zoom_normal_activated(GSimpleAction *action,
-                         GVariant      *parameter,
-                         gpointer       data)
+mw_zoom_normal_activated(GSimpleAction * action, GVariant * parameter,
+                         gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
     GtkWidget *bm = mw->bmessage;
     balsa_message_zoom(BALSA_MESSAGE(bm), 0);
 }
-
-
 #endif                          /* HAVE_HTML_WIDGET */
 
 static void
-mw_select_part_cb(BalsaMessage *bm,
-                  gpointer      data)
+mw_select_part_cb(BalsaMessage * bm, gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
     gchar *title;
@@ -847,56 +750,53 @@ mw_select_part_cb(BalsaMessage *bm,
     mw_set_part_buttons_sensitive(mw, bm);
 }
 
-
 static GActionEntry win_entries[] = {
-    {"page-setup", mw_page_setup_activated},
-    {"print", mw_print_activated},
-    {"copy", mw_copy_activated},
-    {"close", mw_close_activated},
-    {"select-all", mw_select_text_activated},
-    {"find-in-message", mw_find_in_message_activated},
-    {"show-toolbar", libbalsa_toggle_activated, NULL, "false",
-     mw_show_toolbar_change_state},
-    {"wrap", libbalsa_toggle_activated, NULL, "false",
-     mw_wrap_change_state},
-    {"headers", libbalsa_radio_activated, "s", "'none'",
-     mw_header_change_state},
+    {"page-setup",            mw_page_setup_activated},
+    {"print",                 mw_print_activated},
+    {"copy",                  mw_copy_activated},
+    {"close",                 mw_close_activated},
+    {"select-all",            mw_select_text_activated},
+    {"find-in-message",       mw_find_in_message_activated},
+    {"show-toolbar",          libbalsa_toggle_activated, NULL, "false",
+                              mw_show_toolbar_change_state},
+    {"wrap",                  libbalsa_toggle_activated, NULL, "false",
+                              mw_wrap_change_state},
+    {"headers",               libbalsa_radio_activated, "s", "'none'",
+                              mw_header_change_state},
 #ifdef HAVE_HTML_WIDGET
-    {"zoom-in", mw_zoom_in_activated},
-    {"zoom-out", mw_zoom_out_activated},
-    {"zoom-normal", mw_zoom_normal_activated},
-#endif                          /* HAVE_HTML_WIDGET */
-    {"next-message", mw_next_message_activated},
-    {"previous-message", mw_previous_message_activated},
-    {"next-unread", mw_next_unread_activated},
-    {"next-flagged", mw_next_flagged_activated},
-    {"reply", mw_reply_activated},
-    {"reply-all", mw_reply_all_activated},
-    {"reply-group", mw_reply_group_activated},
-    {"forward-attached", mw_forward_attached_activated},
-    {"forward-inline", mw_forward_inline_activated},
-    {"next-part", mw_next_part_activated},
-    {"previous-part", mw_previous_part_activated},
-    {"save-part", mw_save_part_activated},
-    {"view-source", mw_view_source_activated},
-    {"select-text", mw_select_text_activated},
-    {"move-to-trash", mw_move_to_trash_activated},
+    {"zoom-in",               mw_zoom_in_activated},
+    {"zoom-out",              mw_zoom_out_activated},
+    {"zoom-normal",           mw_zoom_normal_activated},
+#endif                         /* HAVE_HTML_WIDGET */
+    {"next-message",          mw_next_message_activated},
+    {"previous-message",      mw_previous_message_activated},
+    {"next-unread",           mw_next_unread_activated},
+    {"next-flagged",          mw_next_flagged_activated},
+    {"reply",                 mw_reply_activated},
+    {"reply-all",             mw_reply_all_activated},
+    {"reply-group",           mw_reply_group_activated},
+    {"forward-attached",      mw_forward_attached_activated},
+    {"forward-inline",        mw_forward_inline_activated},
+    {"next-part",             mw_next_part_activated},
+    {"previous-part",         mw_previous_part_activated},
+    {"save-part",             mw_save_part_activated},
+    {"view-source",           mw_view_source_activated},
+    {"select-text",           mw_select_text_activated},
+    {"move-to-trash",         mw_move_to_trash_activated},
     /* Only a toolbar button: */
-    {"show-all-headers", libbalsa_toggle_activated, NULL, "false",
-     mw_show_all_headers_change_state}
+    {"show-all-headers",      libbalsa_toggle_activated, NULL, "false",
+                              mw_show_all_headers_change_state}
 };
 
 void
-message_window_add_action_entries(GActionMap *action_map)
+message_window_add_action_entries(GActionMap * action_map)
 {
     g_action_map_add_action_entries(action_map, win_entries,
                                     G_N_ELEMENTS(win_entries), action_map);
 }
 
-
 void
-message_window_new(LibBalsaMailbox *mailbox,
-                   guint            msgno)
+message_window_new(LibBalsaMailbox * mailbox, guint msgno)
 {
     LibBalsaMessage *message;
     MessageWindow *mw;
@@ -907,19 +807,16 @@ message_window_new(LibBalsaMailbox *mailbox,
     GtkWidget *move_menu, *submenu;
     GtkWidget *vbox;
     static const gchar *const header_options[] =
-    {
-        "none", "selected", "all"
-    };
+        { "none", "selected", "all" };
     gchar *ui_file;
     GAction *action;
 
-    if (!mailbox || !msgno) {
-        return;
-    }
+    if (!mailbox || !msgno)
+       return;
 
     message = libbalsa_mailbox_get_message(mailbox, msgno);
-    if (message
-        && (mw = g_object_get_data(G_OBJECT(message),
+    if (message 
+        && (mw = g_object_get_data(G_OBJECT(message), 
                                    BALSA_MESSAGE_WINDOW_KEY))) {
         gtk_window_present(GTK_WINDOW(mw->window));
         g_object_unref(message);
@@ -929,7 +826,7 @@ message_window_new(LibBalsaMailbox *mailbox,
     mw = g_malloc0(sizeof(MessageWindow));
 
     mw->window = window =
-            gtk_application_window_new(balsa_app.application);
+        gtk_application_window_new(balsa_app.application);
 
     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
     gtk_container_add(GTK_CONTAINER(window), vbox);
@@ -967,17 +864,17 @@ message_window_new(LibBalsaMailbox *mailbox,
     gtk_window_set_role(GTK_WINDOW(window), "message");
 
     g_signal_connect(G_OBJECT(window), "destroy",
-                     G_CALLBACK(destroy_message_window), mw);
+                    G_CALLBACK(destroy_message_window), mw);
     g_signal_connect(G_OBJECT(window), "size_allocate",
                      G_CALLBACK(size_alloc_cb), NULL);
-
+    
     mw->bindex = balsa_find_index_by_mailbox(mailbox);
     g_object_weak_ref(G_OBJECT(mw->bindex), mw_bindex_closed_cb, mw);
     g_signal_connect_swapped(G_OBJECT(mw->bindex), "index-changed",
-                             G_CALLBACK(mw_set_buttons_sensitive), mw);
+                            G_CALLBACK(mw_set_buttons_sensitive), mw);
 
     mw->mailbox = mailbox;
-    g_object_add_weak_pointer(G_OBJECT(mailbox), (gpointer) & mw->mailbox);
+    g_object_add_weak_pointer(G_OBJECT(mailbox), (gpointer) &mw->mailbox);
     g_signal_connect(mailbox, "message_expunged",
                      G_CALLBACK(mw_expunged_cb), mw);
 
@@ -989,19 +886,18 @@ message_window_new(LibBalsaMailbox *mailbox,
     gtk_menu_item_set_submenu(GTK_MENU_ITEM(move_menu), submenu);
 
     if (mailbox->readonly) {
-        gtk_widget_set_sensitive(move_menu, FALSE);
-        mw_disable_trash(mw);
-    }
-    if (mailbox == balsa_app.trash) {
-        mw_disable_trash(mw);
+       gtk_widget_set_sensitive(move_menu, FALSE);
+       mw_disable_trash(mw);
     }
+    if (mailbox == balsa_app.trash)
+       mw_disable_trash(mw);
     mw->bmessage = balsa_message_new();
-
+    
     gtk_widget_set_vexpand(mw->bmessage, TRUE);
     gtk_box_pack_start(GTK_BOX(vbox), mw->bmessage);
 
     g_signal_connect(mw->bmessage, "select-part",
-                     G_CALLBACK(mw_select_part_cb), mw);
+                    G_CALLBACK(mw_select_part_cb), mw);
 
     action = g_action_map_lookup_action(G_ACTION_MAP(window), "headers");
     g_action_change_state(action,
@@ -1010,16 +906,14 @@ message_window_new(LibBalsaMailbox *mailbox,
 
     mw_set_active(mw, "wrap", balsa_app.browse_wrap);
     mw_set_active(mw, "show-toolbar", balsa_app.show_message_toolbar);
-    if (!balsa_app.show_message_toolbar) {
+    if (!balsa_app.show_message_toolbar)
         gtk_widget_hide(mw->toolbar);
-    }
 
     gtk_window_set_default_size(GTK_WINDOW(window),
-                                balsa_app.message_window_width,
+                                balsa_app.message_window_width, 
                                 balsa_app.message_window_height);
-    if (balsa_app.message_window_maximized) {
+    if (balsa_app.message_window_maximized)
         gtk_window_maximize(GTK_WINDOW(window));
-    }
 
     gtk_widget_show(window);
     mw_set_message(mw, message);
diff --git a/src/message-window.h b/src/message-window.h
index 59e45d2..ce30db4 100644
--- a/src/message-window.h
+++ b/src/message-window.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -26,9 +26,8 @@
 
 typedef struct _MessageWindow MessageWindow;
 
-void message_window_new(LibBalsaMailbox *mailbox,
-                        guint            msgno);
+void message_window_new(LibBalsaMailbox * mailbox, guint msgno);
 BalsaToolbarModel *message_window_get_toolbar_model(void);
-void message_window_add_action_entries(GActionMap *action_map);
+void message_window_add_action_entries(GActionMap * action_map);
 
-#endif                          /* __MESSAGE_WINDOW_H__ */
+#endif                         /* __MESSAGE_WINDOW_H__ */
diff --git a/src/pref-manager.c b/src/pref-manager.c
index f49211b..294a92d 100644
--- a/src/pref-manager.c
+++ b/src/pref-manager.c
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -20,7 +20,7 @@
 /* MAKE SURE YOU USE THE HELPER FUNCTIONS, like create_grid(etc. */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "pref-manager.h"
 
@@ -37,7 +37,7 @@
 #include "imap-server.h"
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#  include "macosx-helpers.h"
 #endif
 
 #include "smtp-server.h"
@@ -191,17 +191,15 @@ static PropertyUI *pui = NULL;
 static GtkWidget *property_box;
 static gboolean already_open;
 
-/* combo boxes */
+    /* combo boxes */
 struct pm_combo_box_info {
     GSList *levels;
 };
 #define PM_COMBO_BOX_INFO "balsa-pref-manager-combo-box-info"
 
-/* callbacks */
-static void properties_modified_cb(GtkWidget *widget,
-                                   GtkWidget *pbox);
-static void address_book_change(LibBalsaAddressBook *address_book,
-                                gboolean             append);
+    /* callbacks */
+static void properties_modified_cb(GtkWidget * widget, GtkWidget * pbox);
+static void address_book_change(LibBalsaAddressBook * address_book, gboolean append);
 
 guint pwindow_type[NUM_PWINDOW_MODES] = {
     WHILERETR,
@@ -215,7 +213,7 @@ gchar *pwindow_type_label[NUM_PWINDOW_MODES] = {
     N_("Never")
 };
 
-/* These labels must match the LibBalsaMailboxSortFields enum. */
+    /* These labels must match the LibBalsaMailboxSortFields enum. */
 const gchar *sort_field_label[] = {
     N_("Message number"),
     N_("Subject"),
@@ -233,13 +231,12 @@ const gchar *threading_type_label[NUM_THREADING_STYLES] = {
 /* combo boxes */
 
 static void
-pm_combo_box_info_free(struct pm_combo_box_info *info)
+pm_combo_box_info_free(struct pm_combo_box_info * info)
 {
     g_slist_free(info->levels);
     g_free(info);
 }
 
-
 static GtkWidget *
 pm_combo_box_new(void)
 {
@@ -256,27 +253,23 @@ pm_combo_box_new(void)
     return combo_box;
 }
 
-
 static void
-pm_combo_box_set_level(GtkWidget *combo_box,
-                       gint       level)
+pm_combo_box_set_level(GtkWidget * combo_box, gint level)
 {
     struct pm_combo_box_info *info =
         g_object_get_data(G_OBJECT(combo_box), PM_COMBO_BOX_INFO);
     GSList *list;
     guint i;
 
-    for (list = info->levels, i = 0; list; list = list->next, ++i) {
-        if (GPOINTER_TO_INT(list->data) == level) {
-            gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), i);
-            break;
-        }
-    }
+    for (list = info->levels, i = 0; list; list = list->next, ++i)
+       if (GPOINTER_TO_INT(list->data) == level) {
+           gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), i);
+           break;
+       }
 }
 
-
 static gint
-pm_combo_box_get_level(GtkWidget *combo_box)
+pm_combo_box_get_level(GtkWidget * combo_box)
 {
     struct pm_combo_box_info *info =
         g_object_get_data(G_OBJECT(combo_box), PM_COMBO_BOX_INFO);
@@ -285,8 +278,7 @@ pm_combo_box_get_level(GtkWidget *combo_box)
     return GPOINTER_TO_INT(g_slist_nth_data(info->levels, active));
 }
 
-
-/* and now the important stuff: */
+    /* and now the important stuff: */
 
 enum {
     PM_TEXT_COL,
@@ -296,17 +288,15 @@ enum {
 };
 
 static void
-pm_selection_changed(GtkTreeSelection *selection,
-                     gpointer          user_data)
+pm_selection_changed(GtkTreeSelection * selection, gpointer user_data)
 {
     GtkStack *stack = user_data;
     GtkTreeModel *model;
     GtkTreeIter iter;
     GtkWidget *child;
 
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
         return;
-    }
 
     gtk_tree_model_get(model, &iter,
                        PM_CHILD_COL, &child,
@@ -319,10 +309,9 @@ pm_selection_changed(GtkTreeSelection *selection,
     }
 }
 
-
-/*
- * update data from the preferences window
- */
+    /*
+     * update data from the preferences window
+     */
 
 static void
 destroy_pref_window_cb(void)
@@ -332,14 +321,12 @@ destroy_pref_window_cb(void)
     already_open = FALSE;
 }
 
-
-/* LibBalsaConfForeachFunc callback;
-* update any view that is using the current default
-* value to the new default value. */
+    /* LibBalsaConfForeachFunc callback;
+     * update any view that is using the current default
+     * value to the new default value. */
 static gboolean
-update_view_defaults(const gchar *group,
-                     const gchar *url,
-                     gpointer     data)
+update_view_defaults(const gchar * group, const gchar * url,
+                     gpointer data)
 {
     LibBalsaMailbox *mailbox;
     LibBalsaMailboxView *view;
@@ -347,19 +334,15 @@ update_view_defaults(const gchar *group,
     mailbox = balsa_find_mailbox_by_url(url);
     view = mailbox ? mailbox->view : config_load_mailbox_view(url);
 
-    if (!view) {
+    if (!view)
         return FALSE;
-    }
 
-    if (view->filter == libbalsa_mailbox_get_filter(NULL)) {
+    if (view->filter == libbalsa_mailbox_get_filter(NULL))
         view->filter = pui->filter;
-    }
-    if (view->sort_field == libbalsa_mailbox_get_sort_field(NULL)) {
+    if (view->sort_field == libbalsa_mailbox_get_sort_field(NULL))
         view->sort_field = pui->sort_field_index;
-    }
-    if (view->threading_type == libbalsa_mailbox_get_threading_type(NULL)) {
+    if (view->threading_type == libbalsa_mailbox_get_threading_type(NULL))
         view->threading_type = pui->threading_type_index;
-    }
 
     if (!mailbox) {
         config_save_mailbox_view(url, view);
@@ -369,16 +352,14 @@ update_view_defaults(const gchar *group,
     return FALSE;
 }
 
-
 static void
-check_font_button(GtkWidget *button,
-                  gchar    **font)
+check_font_button(GtkWidget * button, gchar ** font)
 {
     if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "font-modified"))) {
         g_free(*font);
 
         if (!gtk_toggle_button_get_active
-                (GTK_TOGGLE_BUTTON(pui->use_default_font_size))) {
+            (GTK_TOGGLE_BUTTON(pui->use_default_font_size))) {
             *font = gtk_font_chooser_get_font(GTK_FONT_CHOOSER(button));
         } else {
             PangoFontDescription *desc;
@@ -391,9 +372,8 @@ check_font_button(GtkWidget *button,
     }
 }
 
-
 static void
-apply_prefs(GtkDialog *pbox)
+apply_prefs(GtkDialog * pbox)
 {
     gint i;
     GtkWidget *balsa_window;
@@ -413,15 +393,13 @@ apply_prefs(GtkDialog *pbox)
     g_free(balsa_app.local_mail_directory);
     balsa_app.local_mail_directory =
         gtk_file_chooser_get_filename(GTK_FILE_CHOOSER
-                                          (pui->mail_directory));
+                                      (pui->mail_directory));
 
-    /*
-     * display page
+    /* 
+     * display page 
      */
-    balsa_app.recv_progress_dialog =
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->recv_progress_dlg));
-    balsa_app.send_progress_dialog =
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->send_progress_dlg));
+    balsa_app.recv_progress_dialog = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->recv_progress_dlg));
+    balsa_app.send_progress_dialog = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->send_progress_dlg));
 
     balsa_app.debug =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->debug));
@@ -431,25 +409,24 @@ apply_prefs(GtkDialog *pbox)
     save_enum = balsa_app.layout_type;
     balsa_app.layout_type =
         pm_combo_box_get_level(pui->layout_type);
-    if (balsa_app.layout_type != save_enum) {
+    if (balsa_app.layout_type != save_enum)
         balsa_change_window_layout(balsa_app.main_window);
-    }
 
     balsa_app.view_message_on_open =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->view_message_on_open));
+                                     (pui->view_message_on_open));
     balsa_app.ask_before_select =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->ask_before_select));
+                                     (pui->ask_before_select));
     balsa_app.pgdownmod =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->pgdownmod));
     balsa_app.pgdown_percent =
         gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
-                                             (pui->pgdown_percent));
+                                         (pui->pgdown_percent));
 
     if (balsa_app.mblist_show_mb_content_info !=
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->mblist_show_mb_content_info))) {
+                                     (pui->mblist_show_mb_content_info))) {
         balsa_app.mblist_show_mb_content_info =
             !balsa_app.mblist_show_mb_content_info;
         g_object_set(G_OBJECT(balsa_app.mblist), "show_content_info",
@@ -458,13 +435,13 @@ apply_prefs(GtkDialog *pbox)
 
     balsa_app.check_mail_auto =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->check_mail_auto));
+                                     (pui->check_mail_auto));
     balsa_app.check_mail_timer =
         gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
-                                             (pui->check_mail_minutes));
+                                         (pui->check_mail_minutes));
     balsa_app.quiet_background_check =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->quiet_background_check));
+                                     (pui->quiet_background_check));
     balsa_app.msg_size_limit =
         gtk_spin_button_get_value(GTK_SPIN_BUTTON(pui->msg_size_limit)) *
         1024;
@@ -472,26 +449,25 @@ apply_prefs(GtkDialog *pbox)
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->check_imap));
     balsa_app.check_imap_inbox =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->check_imap_inbox));
+                                     (pui->check_imap_inbox));
     balsa_app.notify_new_mail_dialog =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->notify_new_mail_dialog));
+                                     (pui->notify_new_mail_dialog));
     balsa_app.notify_new_mail_sound =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->notify_new_mail_sound));
+                                     (pui->notify_new_mail_sound));
     balsa_app.notify_new_mail_icon =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->notify_new_mail_icon));
+                                     (pui->notify_new_mail_icon));
     balsa_app.mdn_reply_clean =
         pm_combo_box_get_level(pui->mdn_reply_clean_menu);
     balsa_app.mdn_reply_notclean =
         pm_combo_box_get_level(pui->mdn_reply_notclean_menu);
 
-    if (balsa_app.check_mail_auto) {
+    if (balsa_app.check_mail_auto)
         update_timer(TRUE, balsa_app.check_mail_timer);
-    } else {
+    else
         update_timer(FALSE, 0);
-    }
 
     balsa_app.wordwrap =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->wordwrap));
@@ -501,46 +477,46 @@ apply_prefs(GtkDialog *pbox)
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->autoquote));
     balsa_app.reply_strip_html =
         !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                          (pui->reply_include_html_parts));
+                                      (pui->reply_include_html_parts));
     balsa_app.forward_attached =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->forward_attached));
+                                     (pui->forward_attached));
 
     save_setting = balsa_app.always_queue_sent_mail;
     balsa_app.always_queue_sent_mail =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->always_queue_sent_mail));
+                                     (pui->always_queue_sent_mail));
     if (balsa_app.always_queue_sent_mail != save_setting) {
         balsa_toolbar_model_changed(balsa_window_get_toolbar_model());
     }
 
-    balsa_app.send_mail_auto =
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->send_mail_auto));
-    balsa_app.send_mail_timer =
-        gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(pui->send_mail_minutes));
-    libbalsa_auto_send_config(balsa_app.send_mail_auto, balsa_app.send_mail_timer);
+       balsa_app.send_mail_auto =
+               gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->send_mail_auto));
+       balsa_app.send_mail_timer =
+               gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(pui->send_mail_minutes));
+       libbalsa_auto_send_config(balsa_app.send_mail_auto, balsa_app.send_mail_timer);
 
     balsa_app.copy_to_sentbox =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->copy_to_sentbox));
+                                     (pui->copy_to_sentbox));
 
     balsa_app.close_mailbox_auto =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->close_mailbox_auto));
+                                     (pui->close_mailbox_auto));
     balsa_app.close_mailbox_timeout =
         gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
-                                             (pui->close_mailbox_minutes)) *
+                                         (pui->close_mailbox_minutes)) *
         60;
 
     libbalsa_mailbox_set_filter(NULL, pui->filter);
     balsa_app.expunge_on_close =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->expunge_on_close));
+                                     (pui->expunge_on_close));
     balsa_app.expunge_auto =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->expunge_auto));
     balsa_app.expunge_timeout =
         gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
-                                             (pui->expunge_minutes)) * 60;
+                                         (pui->expunge_minutes)) * 60;
     balsa_app.mw_action_after_move =
         pm_combo_box_get_level(pui->action_after_move_menu);
 
@@ -556,13 +532,13 @@ apply_prefs(GtkDialog *pbox)
     /* fonts */
     balsa_app.use_system_fonts =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->use_system_fonts));
+                                     (pui->use_system_fonts));
     check_font_button(pui->message_font_button, &balsa_app.message_font);
     check_font_button(pui->subject_font_button, &balsa_app.subject_font);
 
     balsa_app.mark_quoted =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->mark_quoted));
+                                     (pui->mark_quoted));
     g_free(balsa_app.quote_regex);
     tmp = gtk_entry_get_text(GTK_ENTRY(pui->quote_pattern));
     balsa_app.quote_regex = g_strcompress(tmp);
@@ -574,27 +550,27 @@ apply_prefs(GtkDialog *pbox)
     update_view_menu(balsa_app.main_window);
     balsa_app.browse_wrap_length =
         gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
-                                             (pui->browse_wrap_length));
+                                         (pui->browse_wrap_length));
 
     balsa_app.display_alt_plain =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->display_alt_plain));
+                                     (pui->display_alt_plain));
 
     balsa_app.open_inbox_upon_startup =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->open_inbox_upon_startup));
+                                     (pui->open_inbox_upon_startup));
     balsa_app.check_mail_upon_startup =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->check_mail_upon_startup));
+                                     (pui->check_mail_upon_startup));
     balsa_app.remember_open_mboxes =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->remember_open_mboxes));
+                                     (pui->remember_open_mboxes));
     balsa_app.local_scan_depth =
         gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
-                                             (pui->local_scan_depth));
+                                         (pui->local_scan_depth));
     balsa_app.imap_scan_depth =
         gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
-                                             (pui->imap_scan_depth));
+                                         (pui->imap_scan_depth));
     balsa_app.empty_trash_on_exit =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->empty_trash));
 
@@ -602,10 +578,10 @@ apply_prefs(GtkDialog *pbox)
     /* spell checking */
     balsa_app.check_sig =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->spell_check_sig));
+                                     (pui->spell_check_sig));
     balsa_app.check_quoted =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->spell_check_quoted));
+                                     (pui->spell_check_quoted));
 #endif                          /* !(HAVE_GSPELL || HAVE_GTKSPELL) */
 
     /* date format */
@@ -617,24 +593,24 @@ apply_prefs(GtkDialog *pbox)
     g_free(balsa_app.selected_headers);
     balsa_app.selected_headers =
         g_ascii_strdown(gtk_entry_get_text
-                            (GTK_ENTRY(pui->selected_headers)), -1);
+                        (GTK_ENTRY(pui->selected_headers)), -1);
 
     /* quoted text color */
     for (i = 0; i < MAX_QUOTED_COLOR; i++) {
         gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(pui->quoted_color[i]),
-                                   &balsa_app.quoted_color[i]);
+                                  &balsa_app.quoted_color[i]);
     }
 
     /* url color */
     gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(pui->url_color),
-                               &balsa_app.url_color);
+                              &balsa_app.url_color);
 
     /* sorting and threading */
     libbalsa_mailbox_set_sort_field(NULL, pui->sort_field_index);
     libbalsa_mailbox_set_threading_type(NULL, pui->threading_type_index);
     balsa_app.expand_tree =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->tree_expand_check));
+                                     (pui->tree_expand_check));
 
     /* Information dialogs */
     balsa_app.information_message =
@@ -651,10 +627,10 @@ apply_prefs(GtkDialog *pbox)
     /* handling of 8-bit message parts without codeset header */
     balsa_app.convert_unknown_8bit =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->convert_unknown_8bit[1]));
+                                     (pui->convert_unknown_8bit[1]));
     balsa_app.convert_unknown_8bit_codeset =
         gtk_combo_box_get_active(GTK_COMBO_BOX
-                                     (pui->convert_unknown_8bit_codeset));
+                                 (pui->convert_unknown_8bit_codeset));
     libbalsa_set_fallback_codeset(balsa_app.convert_unknown_8bit_codeset);
 
     /*
@@ -676,23 +652,21 @@ set_prefs(void)
     unsigned i;
     gchar *tmp;
 
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
-                                     pui->recv_progress_dlg), balsa_app.recv_progress_dialog);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
-                                     pui->send_progress_dlg), balsa_app.send_progress_dialog);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->recv_progress_dlg), balsa_app.recv_progress_dialog);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->send_progress_dlg), balsa_app.send_progress_dialog);
 
     gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER
-                                            (pui->mail_directory),
-                                        balsa_app.local_mail_directory);
+                                        (pui->mail_directory),
+                                  balsa_app.local_mail_directory);
 
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->previewpane),
                                  balsa_app.previewpane);
     pm_combo_box_set_level(pui->layout_type, balsa_app.layout_type);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (pui->view_message_on_open),
+                                 (pui->view_message_on_open),
                                  balsa_app.view_message_on_open);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (pui->ask_before_select),
+                                 (pui->ask_before_select),
                                  balsa_app.ask_before_select);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->pgdownmod),
                                  balsa_app.pgdownmod);
@@ -700,12 +674,12 @@ set_prefs(void)
                               (float) balsa_app.pgdown_percent);
     gtk_widget_set_sensitive(pui->pgdown_percent,
                              gtk_toggle_button_get_active
-                                 (GTK_TOGGLE_BUTTON(pui->pgdownmod)));
+                             (GTK_TOGGLE_BUTTON(pui->pgdownmod)));
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->debug),
                                  balsa_app.debug);
 
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (pui->mblist_show_mb_content_info),
+                                 (pui->mblist_show_mb_content_info),
                                  balsa_app.mblist_show_mb_content_info);
 
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->check_mail_auto),
@@ -713,7 +687,7 @@ set_prefs(void)
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(pui->check_mail_minutes),
                               (float) balsa_app.check_mail_timer);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (pui->quiet_background_check),
+                                 (pui->quiet_background_check),
                                  balsa_app.quiet_background_check);
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(pui->msg_size_limit),
                               ((float) balsa_app.msg_size_limit) / 1024);
@@ -722,17 +696,16 @@ set_prefs(void)
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->check_imap_inbox),
                                  balsa_app.check_imap_inbox);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (pui->notify_new_mail_dialog),
+                                 (pui->notify_new_mail_dialog),
                                  balsa_app.notify_new_mail_dialog);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (pui->notify_new_mail_sound),
+                                 (pui->notify_new_mail_sound),
                                  balsa_app.notify_new_mail_sound);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (pui->notify_new_mail_icon),
+                                 (pui->notify_new_mail_icon),
                                  balsa_app.notify_new_mail_icon);
-    if (!balsa_app.check_imap) {
+    if (!balsa_app.check_imap)
         gtk_widget_set_sensitive(GTK_WIDGET(pui->check_imap_inbox), FALSE);
-    }
 
     pm_combo_box_set_level(pui->mdn_reply_clean_menu,
                            balsa_app.mdn_reply_clean);
@@ -740,14 +713,14 @@ set_prefs(void)
                            balsa_app.mdn_reply_notclean);
 
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (pui->close_mailbox_auto),
+                                 (pui->close_mailbox_auto),
                                  balsa_app.close_mailbox_auto);
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(pui->close_mailbox_minutes),
                               (float) balsa_app.close_mailbox_timeout /
                               60);
     gtk_widget_set_sensitive(pui->close_mailbox_minutes,
                              gtk_toggle_button_get_active
-                                 (GTK_TOGGLE_BUTTON(pui->close_mailbox_auto)));
+                             (GTK_TOGGLE_BUTTON(pui->close_mailbox_auto)));
 
     pui->filter = libbalsa_mailbox_get_filter(NULL);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->hide_deleted),
@@ -760,10 +733,10 @@ set_prefs(void)
                               (float) balsa_app.expunge_timeout / 60);
     gtk_widget_set_sensitive(pui->expunge_minutes,
                              gtk_toggle_button_get_active
-                                 (GTK_TOGGLE_BUTTON(pui->expunge_auto)));
+                             (GTK_TOGGLE_BUTTON(pui->expunge_auto)));
     gtk_widget_set_sensitive(pui->check_mail_minutes,
                              gtk_toggle_button_get_active
-                                 (GTK_TOGGLE_BUTTON(pui->check_mail_auto)));
+                             (GTK_TOGGLE_BUTTON(pui->check_mail_auto)));
     pm_combo_box_set_level(pui->action_after_move_menu,
                            balsa_app.mw_action_after_move);
 
@@ -772,28 +745,27 @@ set_prefs(void)
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(pui->wraplength),
                               (float) balsa_app.wraplength);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (pui->always_queue_sent_mail),
+                                 (pui->always_queue_sent_mail),
                                  balsa_app.always_queue_sent_mail);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->send_mail_auto),
-                                 balsa_app.send_mail_auto);
-    gtk_spin_button_set_value(GTK_SPIN_BUTTON(pui->send_mail_minutes),
-                              (float) balsa_app.send_mail_timer);
-    gtk_widget_set_sensitive(pui->send_mail_minutes,
-                             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
-                                                              pui->send_mail_auto)));
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->send_mail_auto),
+                                                                balsa_app.send_mail_auto);
+       gtk_spin_button_set_value(GTK_SPIN_BUTTON(pui->send_mail_minutes),
+                                                         (float) balsa_app.send_mail_timer);
+       gtk_widget_set_sensitive(pui->send_mail_minutes,
+                                                        
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->send_mail_auto)));
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->copy_to_sentbox),
                                  balsa_app.copy_to_sentbox);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->autoquote),
                                  balsa_app.autoquote);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (pui->reply_include_html_parts),
+                                 (pui->reply_include_html_parts),
                                  !balsa_app.reply_strip_html);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->forward_attached),
                                  balsa_app.forward_attached);
 
     gtk_widget_set_sensitive(pui->wraplength,
                              gtk_toggle_button_get_active
-                                 (GTK_TOGGLE_BUTTON(pui->wordwrap)));
+                             (GTK_TOGGLE_BUTTON(pui->wordwrap)));
 
     /* external editor */
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->edit_headers),
@@ -818,17 +790,17 @@ set_prefs(void)
 
     /* how to treat multipart/alternative */
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (pui->display_alt_plain),
+                                 (pui->display_alt_plain),
                                  balsa_app.display_alt_plain);
 
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (pui->open_inbox_upon_startup),
+                                 (pui->open_inbox_upon_startup),
                                  balsa_app.open_inbox_upon_startup);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (pui->check_mail_upon_startup),
+                                 (pui->check_mail_upon_startup),
                                  balsa_app.check_mail_upon_startup);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (pui->remember_open_mboxes),
+                                 (pui->remember_open_mboxes),
                                  balsa_app.remember_open_mboxes);
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(pui->local_scan_depth),
                               balsa_app.local_scan_depth);
@@ -851,30 +823,27 @@ set_prefs(void)
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->spell_check_sig),
                                  balsa_app.check_sig);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (pui->spell_check_quoted),
+                                 (pui->spell_check_quoted),
                                  balsa_app.check_quoted);
 #endif                          /* !(HAVE_GSPELL || HAVE_GTKSPELL) */
 
 
     /* date format */
-    if (balsa_app.date_string) {
+    if (balsa_app.date_string)
         gtk_entry_set_text(GTK_ENTRY(pui->date_format),
                            balsa_app.date_string);
-    }
 
     /* selected headers */
-    if (balsa_app.selected_headers) {
+    if (balsa_app.selected_headers)
         gtk_entry_set_text(GTK_ENTRY(pui->selected_headers),
                            balsa_app.selected_headers);
-    }
 
     /* Colour */
-    for (i = 0; i < MAX_QUOTED_COLOR; i++) {
+    for (i = 0; i < MAX_QUOTED_COLOR; i++)
         gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pui->quoted_color[i]),
-                                   &balsa_app.quoted_color[i]);
-    }
+                                  &balsa_app.quoted_color[i]);
     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pui->url_color),
-                               &balsa_app.url_color);
+                              &balsa_app.url_color);
 
     /* Information Message */
     pm_combo_box_set_level(pui->information_message_menu,
@@ -890,13 +859,12 @@ set_prefs(void)
 
     /* handling of 8-bit message parts without codeset header */
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (pui->convert_unknown_8bit[1]),
+                                 (pui->convert_unknown_8bit[1]),
                                  balsa_app.convert_unknown_8bit);
     gtk_widget_set_sensitive(pui->convert_unknown_8bit_codeset,
                              balsa_app.convert_unknown_8bit);
 }
 
-
 enum {
     AB_TYPE_COLUMN,
     AB_NAME_COLUMN,
@@ -915,11 +883,10 @@ update_address_books(void)
     GtkTreeModel *model;
     GtkTreeIter iter;
 
-    if (!pui) {
+    if (!pui)
         /* Pref window was closed while the address book dialog was
          * open. */
         return;
-    }
 
     tree_view = GTK_TREE_VIEW(pui->address_books);
     model = gtk_tree_view_get_model(tree_view);
@@ -933,36 +900,30 @@ update_address_books(void)
 
         g_assert(address_book != NULL);
 
-        if (LIBBALSA_IS_ADDRESS_BOOK_VCARD(address_book)) {
+        if (LIBBALSA_IS_ADDRESS_BOOK_VCARD(address_book))
             type = "VCARD";
-        } else if (LIBBALSA_IS_ADDRESS_BOOK_LDIF(address_book)) {
+        else if (LIBBALSA_IS_ADDRESS_BOOK_LDIF(address_book))
             type = "LDIF";
-        } else if (LIBBALSA_IS_ADDRESS_BOOK_EXTERN(address_book)) {
+        else if (LIBBALSA_IS_ADDRESS_BOOK_EXTERN(address_book))
             type = "Extern";
-        }
 #if ENABLE_LDAP
-        else if (LIBBALSA_IS_ADDRESS_BOOK_LDAP(address_book)) {
+        else if (LIBBALSA_IS_ADDRESS_BOOK_LDAP(address_book))
             type = "LDAP";
-        }
 #endif
 #if HAVE_SQLITE
-        else if (LIBBALSA_IS_ADDRESS_BOOK_GPE(address_book)) {
+        else if (LIBBALSA_IS_ADDRESS_BOOK_GPE(address_book))
             type = "GPE";
-        }
 #endif
 #if HAVE_RUBRICA
-        else if (LIBBALSA_IS_ADDRESS_BOOK_RUBRICA(address_book)) {
+        else if (LIBBALSA_IS_ADDRESS_BOOK_RUBRICA(address_book))
             type = "Rubrica";
-        }
 #endif
 #if HAVE_OSMO
-        else if (LIBBALSA_IS_ADDRESS_BOOK_OSMO(address_book)) {
-            type = "Osmo";
-        }
+        else if (LIBBALSA_IS_ADDRESS_BOOK_OSMO(address_book))
+               type = "Osmo";
 #endif
-        else {
+        else
             type = _("Unknown");
-        }
 
         address_book_name = libbalsa_address_book_get_name(address_book);
         if (address_book == balsa_app.default_address_book) {
@@ -984,13 +945,11 @@ update_address_books(void)
         list = list->next;
     }
 
-    if (gtk_tree_model_get_iter_first(model, &iter)) {
+    if (gtk_tree_model_get_iter_first(model, &iter))
         gtk_tree_selection_select_iter(gtk_tree_view_get_selection
-                                           (tree_view), &iter);
-    }
+                                       (tree_view), &iter);
 }
 
-
 enum {
     MS_PROT_COLUMN,
     MS_NAME_COLUMN,
@@ -999,8 +958,7 @@ enum {
 };
 
 static void
-add_other_server(BalsaMailboxNode *mbnode,
-                 GtkTreeModel     *model)
+add_other_server(BalsaMailboxNode * mbnode, GtkTreeModel * model)
 {
     gchar *protocol = NULL;
     gchar *name = NULL;
@@ -1014,7 +972,8 @@ add_other_server(BalsaMailboxNode *mbnode,
                 name = mailbox->name;
                 append = TRUE;
             }
-        } else if (LIBBALSA_IS_IMAP_SERVER(mbnode->server)) {
+        } else
+            if (LIBBALSA_IS_IMAP_SERVER(mbnode->server)) {
             protocol = "IMAP";
             name = mbnode->name;
             append = TRUE;
@@ -1031,14 +990,11 @@ add_other_server(BalsaMailboxNode *mbnode,
     }
 }
 
-
 /* helper functions that simplify often performed actions */
 
 static GtkWidget *
-add_button_to_box(const gchar *label,
-                  GCallback    cb,
-                  gpointer     cb_data,
-                  GtkWidget   *box)
+add_button_to_box(const gchar * label, GCallback cb, gpointer cb_data,
+                  GtkWidget * box)
 {
     GtkWidget *button = gtk_button_new_with_mnemonic(label);
     g_signal_connect_swapped(button, "clicked", cb, cb_data);
@@ -1047,11 +1003,8 @@ add_button_to_box(const gchar *label,
     return button;
 }
 
-
 static void
-add_show_menu(const char *label,
-              gint        level,
-              GtkWidget  *menu)
+add_show_menu(const char* label, gint level, GtkWidget* menu)
 {
     struct pm_combo_box_info *info =
         g_object_get_data(G_OBJECT(menu), PM_COMBO_BOX_INFO);
@@ -1060,14 +1013,12 @@ add_show_menu(const char *label,
     info->levels = g_slist_append(info->levels, GINT_TO_POINTER(level));
 }
 
-
 /*
  * callback for create_pref_option_menu
  */
 
 static void
-option_menu_cb(GtkMenuItem *widget,
-               gpointer     data)
+option_menu_cb(GtkMenuItem * widget, gpointer data)
 {
     /* update the index number */
     gint *index = (gint *) data;
@@ -1075,11 +1026,8 @@ option_menu_cb(GtkMenuItem *widget,
     *index = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
 }
 
-
 static GtkWidget *
-create_pref_option_menu(const gchar *names[],
-                        gint         size,
-                        gint        *index)
+create_pref_option_menu(const gchar * names[], gint size, gint * index)
 {
     GtkWidget *combo_box;
     gint i;
@@ -1088,14 +1036,12 @@ create_pref_option_menu(const gchar *names[],
     g_signal_connect(G_OBJECT(combo_box), "changed",
                      G_CALLBACK(option_menu_cb), index);
 
-    for (i = 0; i < size; i++) {
-        add_show_menu(_(names[i]), i, combo_box);
-    }
+    for (i = 0; i < size; i++)
+       add_show_menu(_(names[i]), i, combo_box);
 
     return combo_box;
 }
 
-
 static GtkWidget *
 create_layout_types_menu(void)
 {
@@ -1106,7 +1052,6 @@ create_layout_types_menu(void)
     return combo_box;
 }
 
-
 static GtkWidget *
 create_action_after_move_menu(void)
 {
@@ -1117,7 +1062,6 @@ create_action_after_move_menu(void)
     return combo_box;
 }
 
-
 static void
 balsa_help_pbox_display(void)
 {
@@ -1132,25 +1076,22 @@ balsa_help_pbox_display(void)
     GString *string;
 
     selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pui->view));
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
         return;
-    }
 
     string = g_string_new("help:balsa/preferences-");
 
     if (gtk_tree_model_iter_parent(model, &parent, &iter)) {
         gtk_tree_model_get(model, &parent, PM_HELP_COL, &text, -1);
-        for (p = text; *p; p++) {
+        for (p = text; *p; p++)
             *p = (*p == ' ') ? '-' : g_ascii_tolower(*p);
-        }
         g_string_append(string, text);
         g_free(text);
         g_string_append_c(string, '#');
     }
     gtk_tree_model_get(model, &iter, PM_HELP_COL, &text, -1);
-    for (p = text; *p; p++) {
+    for (p = text; *p; p++)
         *p = (*p == ' ') ? '-' : g_ascii_tolower(*p);
-    }
     g_string_append(string, text);
     g_free(text);
 
@@ -1162,48 +1103,45 @@ balsa_help_pbox_display(void)
     }
     if (err) {
         balsa_information(LIBBALSA_INFORMATION_WARNING,
-                          _("Error displaying %s: %s\n"),
-                          uri, err->message);
+               _("Error displaying %s: %s\n"),
+               uri, err->message);
         g_error_free(err);
     }
 
     g_free(uri);
 }
 
-
 static GtkWidget *
 create_information_message_menu(void)
 {
     GtkWidget *combo_box = pm_combo_box_new();
 
-    add_show_menu(_("Show nothing"), BALSA_INFORMATION_SHOW_NONE,
+    add_show_menu(_("Show nothing"),       BALSA_INFORMATION_SHOW_NONE,
                   combo_box);
-    add_show_menu(_("Show dialog"), BALSA_INFORMATION_SHOW_DIALOG,
+    add_show_menu(_("Show dialog"),        BALSA_INFORMATION_SHOW_DIALOG,
                   combo_box);
-    add_show_menu(_("Show in list"), BALSA_INFORMATION_SHOW_LIST,
+    add_show_menu(_("Show in list"),       BALSA_INFORMATION_SHOW_LIST,
                   combo_box);
     add_show_menu(_("Show in status bar"), BALSA_INFORMATION_SHOW_BAR,
                   combo_box);
-    add_show_menu(_("Print to console"), BALSA_INFORMATION_SHOW_STDERR,
+    add_show_menu(_("Print to console"),   BALSA_INFORMATION_SHOW_STDERR,
                   combo_box);
 
     return combo_box;
 }
 
-
 static GtkWidget *
 create_mdn_reply_menu(void)
 {
     GtkWidget *combo_box = pm_combo_box_new();
 
-    add_show_menu(_("Never"), BALSA_MDN_REPLY_NEVER, combo_box);
-    add_show_menu(_("Ask me"), BALSA_MDN_REPLY_ASKME, combo_box);
+    add_show_menu(_("Never"),  BALSA_MDN_REPLY_NEVER,  combo_box);
+    add_show_menu(_("Ask me"), BALSA_MDN_REPLY_ASKME,  combo_box);
     add_show_menu(_("Always"), BALSA_MDN_REPLY_ALWAYS, combo_box);
 
     return combo_box;
 }
 
-
 /* Clear and populate the list. */
 static void
 update_smtp_servers(void)
@@ -1215,15 +1153,13 @@ update_smtp_servers(void)
     GtkTreeModel *model;
     GSList *list;
 
-    if (pui == NULL) {
+    if (pui == NULL)
         return;
-    }
 
     tree_view = GTK_TREE_VIEW(pui->smtp_servers);
     selection = gtk_tree_view_get_selection(tree_view);
-    if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
+    if (gtk_tree_selection_get_selected(selection, &model, &iter))
         path = gtk_tree_model_get_path(model, &iter);
-    }
 
     gtk_list_store_clear(GTK_LIST_STORE(model));
 
@@ -1241,7 +1177,6 @@ update_smtp_servers(void)
     }
 }
 
-
 /***************************
  *
  * Helpers for GtkGrid pages
@@ -1269,14 +1204,13 @@ pm_grid_new(void)
     return grid;
 }
 
-
 static void
-pm_grid_attach(GtkGrid   *grid,
-               GtkWidget *child,
-               gint       left,
-               gint       top,
-               gint       width,
-               gint       height)
+pm_grid_attach(GtkGrid   * grid,
+               GtkWidget * child,
+               gint        left,
+               gint        top,
+               gint        width,
+               gint        height)
 {
     if (left == 0) {
         /* Group label */
@@ -1292,20 +1226,18 @@ pm_grid_attach(GtkGrid   *grid,
     if (GTK_IS_LABEL(child)) {
         gtk_label_set_xalign((GtkLabel *) child, 0.0);
     } else if (GTK_IS_BUTTON(child)) {
-        GtkWidget *label;
+        GtkWidget * label;
 
         label = gtk_bin_get_child((GtkBin *) child);
-        if (GTK_IS_LABEL(label)) {
+        if (GTK_IS_LABEL(label))
             gtk_label_set_xalign((GtkLabel *) label, 0.0);
-        }
     }
 
     gtk_grid_attach(grid, child, left, top, width, height);
 }
 
-
 static GtkWidget *
-pm_group_label(const gchar *text)
+pm_group_label(const gchar * text)
 {
     GtkWidget *label;
     gchar *markup;
@@ -1322,14 +1254,13 @@ pm_group_label(const gchar *text)
     return label;
 }
 
-
 static GtkWidget *
-pm_grid_attach_check(GtkGrid     *grid,
-                     gint         left,
-                     gint         top,
-                     gint         width,
-                     gint         height,
-                     const gchar *text)
+pm_grid_attach_check(GtkGrid     * grid,
+                     gint          left,
+                     gint          top,
+                     gint          width,
+                     gint          height,
+                     const gchar * text)
 {
     GtkWidget *res;
 
@@ -1339,14 +1270,13 @@ pm_grid_attach_check(GtkGrid     *grid,
     return res;
 }
 
-
 static GtkWidget *
-pm_grid_attach_label(GtkGrid     *grid,
-                     gint         left,
-                     gint         top,
-                     gint         width,
-                     gint         height,
-                     const gchar *text)
+pm_grid_attach_label(GtkGrid     * grid,
+                     gint          left,
+                     gint          top,
+                     gint          width,
+                     gint          height,
+                     const gchar * text)
 {
     GtkWidget *label;
 
@@ -1367,16 +1297,15 @@ pm_grid_attach_label(GtkGrid     *grid,
     return label;
 }
 
-
-static GtkWidget *
-pm_grid_attach_pref_menu(GtkGrid     *grid,
-                         gint         left,
-                         gint         top,
-                         gint         width,
-                         gint         height,
-                         const gchar *names[],
-                         gint         size,
-                         gint        *index)
+static GtkWidget*
+pm_grid_attach_pref_menu(GtkGrid     * grid,
+                         gint          left,
+                         gint          top,
+                         gint          width,
+                         gint          height,
+                         const gchar * names[],
+                         gint          size,
+                         gint        * index)
 {
     GtkWidget *option_menu;
 
@@ -1387,14 +1316,13 @@ pm_grid_attach_pref_menu(GtkGrid     *grid,
     return option_menu;
 }
 
-
 static GtkWidget *
-pm_grid_attach_entry(GtkGrid     *grid,
-                     gint         left,
-                     gint         top,
-                     gint         width,
-                     gint         height,
-                     const gchar *text)
+pm_grid_attach_entry(GtkGrid     * grid,
+                     gint          left,
+                     gint          top,
+                     gint          width,
+                     gint          height,
+                     const gchar * text)
 {
     GtkWidget *entry;
 
@@ -1407,14 +1335,13 @@ pm_grid_attach_entry(GtkGrid     *grid,
     return entry;
 }
 
-
 static GtkWidget *
-pm_grid_attach_color_box(GtkGrid     *grid,
-                         gint         left,
-                         gint         top,
-                         gint         width,
-                         gint         height,
-                         const gchar *title)
+pm_grid_attach_color_box(GtkGrid     * grid,
+                         gint          left,
+                         gint          top,
+                         gint          width,
+                         gint          height,
+                         const gchar * title)
 {
     GtkWidget *picker;
 
@@ -1428,14 +1355,12 @@ pm_grid_attach_color_box(GtkGrid     *grid,
     return picker;
 }
 
-
 /*
  * If the font button shows zero size, set it to the default size and
  * return TRUE.
  */
 static gboolean
-font_button_check_font_size(GtkWidget *button,
-                            GtkWidget *widget)
+font_button_check_font_size(GtkWidget * button, GtkWidget * widget)
 {
     GtkFontChooser *chooser = GTK_FONT_CHOOSER(button);
     PangoFontDescription *desc;
@@ -1460,21 +1385,20 @@ font_button_check_font_size(GtkWidget *button,
     return retval;
 }
 
-
 /*
  * Create a font button from a font string and attach it; return TRUE if
  * the string does not specify a point size.
  */
 static gboolean
-pm_grid_attach_font_button(GtkGrid     *grid,
-                           gint         left,
-                           gint         top,
-                           gint         width,
-                           gint         height,
-                           const gchar *text,
-                           const gchar *font,
-                           GtkWidget  **label,
-                           GtkWidget  **button)
+pm_grid_attach_font_button(GtkGrid     * grid,
+                           gint          left,
+                           gint          top,
+                           gint          width,
+                           gint          height,
+                           const gchar * text,
+                           const gchar * font,
+                           GtkWidget  ** label,
+                           GtkWidget  ** button)
 {
     *label = pm_grid_attach_label(grid, left, top, width, height, text);
 
@@ -1485,15 +1409,14 @@ pm_grid_attach_font_button(GtkGrid     *grid,
     return font_button_check_font_size(*button, (GtkWidget *) grid);
 }
 
-
 static GtkWidget *
-pm_grid_attach_information_menu(GtkGrid     *grid,
-                                gint         left,
-                                gint         top,
-                                gint         width,
-                                gint         height,
-                                const gchar *text,
-                                gint         defval)
+pm_grid_attach_information_menu(GtkGrid     * grid,
+                                gint          left,
+                                gint          top,
+                                gint          width,
+                                gint          height,
+                                const gchar * text,
+                                gint          defval)
 {
     GtkWidget *label;
     GtkWidget *combo_box;
@@ -1509,7 +1432,6 @@ pm_grid_attach_information_menu(GtkGrid     *grid,
     return combo_box;
 }
 
-
 /*
  * End of helpers for GtkGrid pages
  */
@@ -1518,8 +1440,7 @@ pm_grid_attach_information_menu(GtkGrid     *grid,
  * callbacks
  */
 static void
-properties_modified_cb(GtkWidget *widget,
-                       GtkWidget *pbox)
+properties_modified_cb(GtkWidget * widget, GtkWidget * pbox)
 {
     gtk_dialog_set_response_sensitive(GTK_DIALOG(pbox), GTK_RESPONSE_OK,
                                       TRUE);
@@ -1527,32 +1448,28 @@ properties_modified_cb(GtkWidget *widget,
                                       TRUE);
 }
 
-
 static void
-server_edit_cb(GtkTreeView *tree_view)
+server_edit_cb(GtkTreeView * tree_view)
 {
     GtkTreeSelection *selection = gtk_tree_view_get_selection(tree_view);
     GtkTreeModel *model;
     GtkTreeIter iter;
     BalsaMailboxNode *mbnode;
 
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
-        return;
-    }
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+       return;
 
     gtk_tree_model_get(model, &iter, MS_DATA_COLUMN, &mbnode, -1);
     g_return_if_fail(mbnode);
     balsa_mailbox_node_show_prop_dialog(mbnode);
 }
 
-
 #define SMTP_SERVER_SECTION_PREFIX "smtp-server-"
 
 /* Callback for the server-dialog's response handler. */
 static void
-smtp_server_update(LibBalsaSmtpServer *smtp_server,
-                   GtkResponseType     response,
-                   const gchar        *old_name)
+smtp_server_update(LibBalsaSmtpServer * smtp_server,
+                   GtkResponseType response, const gchar * old_name)
 {
     gchar *group;
     const gchar *new_name;
@@ -1561,9 +1478,9 @@ smtp_server_update(LibBalsaSmtpServer *smtp_server,
 
     if (old_name) {
         /* We were editing an existing server. */
-        if (strcmp(old_name, new_name) == 0) {
-            return;
-        } else {
+        if (strcmp(old_name, new_name) == 0)
+           return;
+       else {
             /* Name was changed. */
             group =
                 g_strconcat(SMTP_SERVER_SECTION_PREFIX, old_name, NULL);
@@ -1572,10 +1489,10 @@ smtp_server_update(LibBalsaSmtpServer *smtp_server,
         }
     } else {
         /* Populating a new server. */
-        if (response == GTK_RESPONSE_OK) {
+        if (response == GTK_RESPONSE_OK)
             libbalsa_smtp_server_add_to_list(smtp_server,
                                              &balsa_app.smtp_servers);
-        } else {
+        else {
             /*  The user killed the dialog. */
             g_object_unref(smtp_server);
             return;
@@ -1591,7 +1508,6 @@ smtp_server_update(LibBalsaSmtpServer *smtp_server,
     libbalsa_conf_pop_group();
 }
 
-
 static void
 smtp_server_add_cb(void)
 {
@@ -1603,18 +1519,16 @@ smtp_server_add_cb(void)
                                 smtp_server_update);
 }
 
-
 static void
-smtp_server_edit_cb(GtkTreeView *tree_view)
+smtp_server_edit_cb(GtkTreeView * tree_view)
 {
     GtkTreeSelection *selection = gtk_tree_view_get_selection(tree_view);
     GtkTreeModel *model;
     GtkTreeIter iter;
     LibBalsaSmtpServer *smtp_server;
 
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
         return;
-    }
 
     gtk_tree_model_get(model, &iter, 1, &smtp_server, -1);
     g_return_if_fail(smtp_server);
@@ -1623,9 +1537,8 @@ smtp_server_edit_cb(GtkTreeView *tree_view)
                                 smtp_server_update);
 }
 
-
 static void
-smtp_server_del_cb(GtkTreeView *tree_view)
+smtp_server_del_cb(GtkTreeView * tree_view)
 {
     GtkTreeSelection *selection = gtk_tree_view_get_selection(tree_view);
     GtkTreeModel *model;
@@ -1635,9 +1548,8 @@ smtp_server_del_cb(GtkTreeView *tree_view)
 
     /* Nothing to do if no server is selected, or if it is the last one. */
     if (!gtk_tree_selection_get_selected(selection, &model, &iter)
-        || (gtk_tree_model_iter_n_children(model, NULL) <= 1)) {
+        || gtk_tree_model_iter_n_children(model, NULL) <= 1)
         return;
-    }
 
     gtk_tree_model_get(model, &iter, 1, &smtp_server, -1);
     g_return_if_fail(smtp_server);
@@ -1653,13 +1565,11 @@ smtp_server_del_cb(GtkTreeView *tree_view)
     update_smtp_servers();
 }
 
-
 /* Set sensitivity of the Modify and Delete buttons; we can edit a server
  * only if one is selected, and we can delete one only if it is selected
  * and it is not the last server. */
 static void
-smtp_server_changed(GtkTreeSelection *selection,
-                    gpointer          user_data)
+smtp_server_changed(GtkTreeSelection * selection, gpointer user_data)
 {
     gboolean selected;
     GtkTreeModel *model;
@@ -1672,34 +1582,30 @@ smtp_server_changed(GtkTreeSelection *selection,
                                                                NULL) > 1);
 }
 
-
 /* Address book callbacks */
 
 static void
-address_book_change(LibBalsaAddressBook *address_book,
-                    gboolean             append)
+address_book_change(LibBalsaAddressBook * address_book, gboolean append)
 {
     if (append) {
         balsa_app.address_book_list =
             g_list_append(balsa_app.address_book_list, address_book);
-        balsa_window_update_book_menus(balsa_app.main_window);
+       balsa_window_update_book_menus(balsa_app.main_window);
     }
     config_address_book_save(address_book);
     update_address_books();
 }
 
-
 static void
-address_book_edit_cb(GtkTreeView *tree_view)
+address_book_edit_cb(GtkTreeView * tree_view)
 {
     LibBalsaAddressBook *address_book;
     GtkTreeSelection *selection = gtk_tree_view_get_selection(tree_view);
     GtkTreeModel *model;
     GtkTreeIter iter;
 
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
-        return;
-    }
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+       return;
 
     gtk_tree_model_get(model, &iter, AB_DATA_COLUMN, &address_book, -1);
 
@@ -1709,9 +1615,8 @@ address_book_edit_cb(GtkTreeView *tree_view)
                                   GTK_WINDOW(property_box));
 }
 
-
 static void
-address_book_set_default_cb(GtkTreeView *tree_view)
+address_book_set_default_cb(GtkTreeView * tree_view)
 {
     LibBalsaAddressBook *address_book;
     GtkTreeSelection *selection = gtk_tree_view_get_selection(tree_view);
@@ -1719,9 +1624,8 @@ address_book_set_default_cb(GtkTreeView *tree_view)
     GtkTreeIter iter;
     GtkTreePath *path;
 
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
-        return;
-    }
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+       return;
 
     gtk_tree_model_get(model, &iter, AB_DATA_COLUMN, &address_book, -1);
 
@@ -1734,28 +1638,24 @@ address_book_set_default_cb(GtkTreeView *tree_view)
     gtk_tree_path_free(path);
 }
 
-
 static void
-add_menu_cb(GtkWidget *menu,
-            GtkWidget *widget)
+add_menu_cb(GtkWidget * menu, GtkWidget * widget)
 {
     gtk_menu_popup_at_widget(GTK_MENU(menu), GTK_WIDGET(widget),
                              GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST,
                              NULL);
 }
 
-
 static void
-address_book_delete_cb(GtkTreeView *tree_view)
+address_book_delete_cb(GtkTreeView * tree_view)
 {
     LibBalsaAddressBook *address_book;
     GtkTreeSelection *selection = gtk_tree_view_get_selection(tree_view);
     GtkTreeModel *model;
     GtkTreeIter iter;
 
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
-        return;
-    }
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+       return;
 
     gtk_tree_model_get(model, &iter, AB_DATA_COLUMN, &address_book, -1);
 
@@ -1763,25 +1663,22 @@ address_book_delete_cb(GtkTreeView *tree_view)
 
     config_address_book_delete(address_book);
     balsa_app.address_book_list =
-        g_list_remove(balsa_app.address_book_list, address_book);
+       g_list_remove(balsa_app.address_book_list, address_book);
     balsa_window_update_book_menus(balsa_app.main_window);
-    if (balsa_app.default_address_book == address_book) {
-        balsa_app.default_address_book = NULL;
-    }
+    if (balsa_app.default_address_book == address_book)
+       balsa_app.default_address_book = NULL;
 
     g_object_unref(address_book);
 
     update_address_books();
 }
 
-
 static void
 pop3_add_cb(void)
 {
     mailbox_conf_new(LIBBALSA_TYPE_MAILBOX_POP3);
 }
 
-
 static GtkWidget *
 server_add_menu_widget(void)
 {
@@ -1795,148 +1692,126 @@ server_add_menu_widget(void)
     gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
     menuitem = gtk_menu_item_new_with_label(_("Remote IMAP mailbox…"));
     g_signal_connect(G_OBJECT(menuitem), "activate",
-                     G_CALLBACK(mailbox_conf_add_imap_cb), NULL);
+                    G_CALLBACK(mailbox_conf_add_imap_cb), NULL);
     gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
     menuitem = gtk_menu_item_new_with_label(_("Remote IMAP folder…"));
     g_signal_connect(G_OBJECT(menuitem), "activate",
-                     G_CALLBACK(folder_conf_add_imap_cb), NULL);
+                    G_CALLBACK(folder_conf_add_imap_cb), NULL);
     gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
 
     return menu;
 }
 
-
 static void
-server_del_cb(GtkTreeView *tree_view)
+server_del_cb(GtkTreeView * tree_view)
 {
     GtkTreeSelection *selection = gtk_tree_view_get_selection(tree_view);
     GtkTreeModel *model;
     GtkTreeIter iter;
     BalsaMailboxNode *mbnode;
 
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
-        return;
-    }
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+       return;
 
     gtk_tree_model_get(model, &iter, MS_DATA_COLUMN, &mbnode, -1);
     g_return_if_fail(mbnode);
 
-    if (mbnode->mailbox) {
-        mailbox_conf_delete(mbnode);
-    } else {
-        folder_conf_delete(mbnode);
-    }
+    if (mbnode->mailbox)
+       mailbox_conf_delete(mbnode);
+    else
+       folder_conf_delete(mbnode);
 }
 
-
 static void
-timer_modified_cb(GtkWidget *widget,
-                  GtkWidget *pbox)
+timer_modified_cb(GtkWidget * widget, GtkWidget * pbox)
 {
-    gboolean newstate =
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->check_mail_auto));
+    gboolean newstate = 
+       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
+                                     (pui->check_mail_auto));
 
     gtk_widget_set_sensitive(GTK_WIDGET(pui->check_mail_minutes), newstate);
     properties_modified_cb(widget, pbox);
 }
 
-
 static void
-send_timer_modified_cb(GtkWidget *widget,
-                       GtkWidget *pbox)
+send_timer_modified_cb(GtkWidget * widget, GtkWidget * pbox)
 {
-    gboolean newstate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->send_mail_auto));
+       gboolean newstate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->send_mail_auto));
 
-    gtk_widget_set_sensitive(GTK_WIDGET(pui->send_mail_minutes), newstate);
-    properties_modified_cb(widget, pbox);
+       gtk_widget_set_sensitive(GTK_WIDGET(pui->send_mail_minutes), newstate);
+       properties_modified_cb(widget, pbox);
 }
 
-
 static void
-browse_modified_cb(GtkWidget *widget,
-                   GtkWidget *pbox)
+browse_modified_cb(GtkWidget * widget, GtkWidget * pbox)
 {
     gboolean newstate =
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->browse_wrap));
+       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->browse_wrap));
 
     gtk_widget_set_sensitive(GTK_WIDGET(pui->browse_wrap_length), newstate);
     properties_modified_cb(widget, pbox);
 }
 
-
 static void
-mark_quoted_modified_cb(GtkWidget *widget,
-                        GtkWidget *pbox)
+mark_quoted_modified_cb(GtkWidget * widget, GtkWidget * pbox)
 {
     gboolean newstate =
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->mark_quoted));
+       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->mark_quoted));
 
     gtk_widget_set_sensitive(GTK_WIDGET(pui->quote_pattern), newstate);
     properties_modified_cb(widget, pbox);
 }
 
-
 static void
-wrap_modified_cb(GtkWidget *widget,
-                 GtkWidget *pbox)
+wrap_modified_cb(GtkWidget * widget, GtkWidget * pbox)
 {
     gboolean newstate =
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->wordwrap));
+       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->wordwrap));
 
     gtk_widget_set_sensitive(GTK_WIDGET(pui->wraplength), newstate);
     properties_modified_cb(widget, pbox);
 }
 
-
 static void
-pgdown_modified_cb(GtkWidget *widget,
-                   GtkWidget *pbox)
+pgdown_modified_cb(GtkWidget * widget, GtkWidget * pbox)
 {
     gboolean newstate =
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->pgdownmod));
+       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->pgdownmod));
 
     gtk_widget_set_sensitive(GTK_WIDGET(pui->pgdown_percent), newstate);
     properties_modified_cb(widget, pbox);
 }
 
-
 static void
-mailbox_close_timer_modified_cb(GtkWidget *widget,
-                                GtkWidget *pbox)
+mailbox_close_timer_modified_cb(GtkWidget * widget, GtkWidget * pbox)
 {
     gboolean newstate =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->close_mailbox_auto));
+                                     (pui->close_mailbox_auto));
 
     gtk_widget_set_sensitive(GTK_WIDGET(pui->close_mailbox_minutes),
-                             newstate);
+                            newstate);
 
     properties_modified_cb(widget, pbox);
 }
 
-
 static void
-filter_modified_cb(GtkWidget *widget,
-                   GtkWidget *pbox)
+filter_modified_cb(GtkWidget * widget, GtkWidget * pbox)
 {
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->hide_deleted))) {
-        pui->filter |= (1 << 0);
-    } else {
-        pui->filter &= ~(1 << 0);
-    }
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->hide_deleted)))
+       pui->filter |= (1 << 0);
+    else
+       pui->filter &= ~(1 << 0);
 
     properties_modified_cb(widget, pbox);
 }
 
-
 static void
-expunge_on_close_cb(GtkWidget *widget,
-                    GtkWidget *pbox)
+expunge_on_close_cb(GtkWidget * widget, GtkWidget * pbox)
 {
     gboolean newstate =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->expunge_on_close));
+                                     (pui->expunge_on_close));
     gtk_widget_set_sensitive(GTK_WIDGET(pui->expunge_auto), newstate);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->expunge_auto),
                                  newstate);
@@ -1944,10 +1819,8 @@ expunge_on_close_cb(GtkWidget *widget,
     properties_modified_cb(widget, pbox);
 }
 
-
 static void
-expunge_auto_cb(GtkWidget *widget,
-                GtkWidget *pbox)
+expunge_auto_cb(GtkWidget * widget, GtkWidget * pbox)
 {
     gboolean newstate =
         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->expunge_auto));
@@ -1956,43 +1829,37 @@ expunge_auto_cb(GtkWidget *widget,
     properties_modified_cb(widget, pbox);
 }
 
-
 static void
-imap_toggled_cb(GtkWidget *widget,
-                GtkWidget *pbox)
+imap_toggled_cb(GtkWidget * widget, GtkWidget * pbox)
 {
     properties_modified_cb(widget, pbox);
 
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->check_imap))) {
-        gtk_widget_set_sensitive(GTK_WIDGET(pui->check_imap_inbox), TRUE);
-    } else {
-        gtk_toggle_button_set_active(
-            GTK_TOGGLE_BUTTON(pui->check_imap_inbox), FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(pui->check_imap_inbox), FALSE);
+    if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->check_imap)))
+       gtk_widget_set_sensitive(GTK_WIDGET(pui->check_imap_inbox), TRUE);
+    else {
+       gtk_toggle_button_set_active(
+           GTK_TOGGLE_BUTTON(pui->check_imap_inbox), FALSE);
+       gtk_widget_set_sensitive(GTK_WIDGET(pui->check_imap_inbox), FALSE);
     }
 }
 
-
 static void
-convert_8bit_cb(GtkWidget *widget,
-                GtkWidget *pbox)
+convert_8bit_cb(GtkWidget * widget, GtkWidget * pbox)
 {
     properties_modified_cb(widget, pbox);
 
     gtk_widget_set_sensitive
         (pui->convert_unknown_8bit_codeset,
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (pui->convert_unknown_8bit[1])));
+         gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
+                                      (pui->convert_unknown_8bit[1])));
 }
 
-
 /*
  * Callbacks for the font group
  */
 
 static void
-use_system_fonts_cb(GtkWidget *widget,
-                    GtkWidget *pbox)
+use_system_fonts_cb(GtkWidget * widget, GtkWidget * pbox)
 {
     gboolean use_custom_fonts =
         !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
@@ -2006,28 +1873,24 @@ use_system_fonts_cb(GtkWidget *widget,
     gtk_widget_set_sensitive(pui->use_default_font_size, use_custom_fonts);
 }
 
-
 static void
-font_modified_cb(GtkWidget *widget,
-                 GtkWidget *pbox)
+font_modified_cb(GtkWidget * widget, GtkWidget * pbox)
 {
     gboolean show_size =
         !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                          (pui->use_default_font_size));
+                                      (pui->use_default_font_size));
 
     properties_modified_cb(widget, pbox);
 
     gtk_font_chooser_set_level(GTK_FONT_CHOOSER(widget),
                                show_size ? GTK_FONT_CHOOSER_LEVEL_FONT
-                               : GTK_FONT_CHOOSER_LEVEL_FACE);
+                                         : GTK_FONT_CHOOSER_LEVEL_FACE);
     g_object_set_data(G_OBJECT(widget), "font-modified",
                       GINT_TO_POINTER(TRUE));
 }
 
-
 static void
-default_font_size_cb(GtkWidget *widget,
-                     GtkWidget *pbox)
+default_font_size_cb(GtkWidget * widget, GtkWidget * pbox)
 {
     if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
         /* Changing from default font size to user-specified font size;
@@ -2040,37 +1903,30 @@ default_font_size_cb(GtkWidget *widget,
     font_modified_cb(pui->subject_font_button, pbox);
 }
 
-
 /*
  * End of callbacks for the font group
  */
 
 
 static void
-response_cb(GtkDialog *dialog,
-            gint       response,
-            gpointer   data)
+response_cb(GtkDialog * dialog, gint response, gpointer data)
 {
     switch (response) {
     case GTK_RESPONSE_APPLY:
         apply_prefs(dialog);
         break;
-
     case GTK_RESPONSE_HELP:
         balsa_help_pbox_display();
         break;
-
     case GTK_RESPONSE_OK:
         apply_prefs(dialog);
-
-    /* and fall through to... */
+        /* and fall through to... */
     default:
         destroy_pref_window_cb();
         gtk_widget_destroy(GTK_WIDGET(dialog));
     }
 }
 
-
 /*
  * End of callbacks
  */
@@ -2089,7 +1945,7 @@ response_cb(GtkDialog *dialog,
  */
 
 static void
-pm_grid_add_remote_mailbox_servers_group(GtkWidget *grid_widget)
+pm_grid_add_remote_mailbox_servers_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2113,7 +1969,7 @@ pm_grid_add_remote_mailbox_servers_group(GtkWidget *grid_widget)
                                G_TYPE_STRING,   /* MS_NAME_COLUMN */
                                G_TYPE_POINTER); /* MS_DATA_COLUMN */
     pui->mail_servers = tree_view =
-            gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
+        gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
     g_object_unref(store);
 
     renderer = gtk_cell_renderer_text_new();
@@ -2160,13 +2016,12 @@ pm_grid_add_remote_mailbox_servers_group(GtkWidget *grid_widget)
     update_mail_servers();
 }
 
-
 /*
  * Local mail directory group
  */
 
 static void
-pm_grid_add_local_mail_group(GtkWidget *grid_widget)
+pm_grid_add_local_mail_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2181,13 +2036,12 @@ pm_grid_add_local_mail_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Outgoing mail servers group
  */
 
 static void
-pm_grid_add_outgoing_mail_group(GtkWidget *grid_widget)
+pm_grid_add_outgoing_mail_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2209,7 +2063,7 @@ pm_grid_add_outgoing_mail_group(GtkWidget *grid_widget)
     store = gtk_list_store_new(2, G_TYPE_STRING,        /* Server name    */
                                G_TYPE_POINTER); /* Object address */
     pui->smtp_servers = tree_view =
-            gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
+        gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
     g_object_unref(store);
 
     selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view));
@@ -2248,13 +2102,12 @@ pm_grid_add_outgoing_mail_group(GtkWidget *grid_widget)
     update_smtp_servers();
 }
 
-
 /*
  * Checking group
  */
 
 static void
-pm_grid_add_checking_group(GtkWidget *grid_widget)
+pm_grid_add_checking_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2265,7 +2118,7 @@ pm_grid_add_checking_group(GtkWidget *grid_widget)
     pm_grid_attach(grid, pm_group_label(_("Checking")), 0, row, 3, 1);
 
     pui->check_mail_auto = gtk_check_button_new_with_mnemonic(
-            _("_Check mail automatically every"));
+       _("_Check mail automatically every"));
     pm_grid_attach(grid, pui->check_mail_auto, 1, ++row, 1, 1);
 
     spinbutton_adj = gtk_adjustment_new(10, 1, 100, 1, 10, 0);
@@ -2276,7 +2129,7 @@ pm_grid_add_checking_group(GtkWidget *grid_widget)
     pm_grid_attach_label(grid, 3, row, 1, 1, _("minutes"));
 
     pui->check_imap = gtk_check_button_new_with_mnemonic(
-            _("Check _IMAP mailboxes"));
+       _("Check _IMAP mailboxes"));
     pm_grid_attach(grid, pui->check_imap, 1, ++row, 1, 1);
 
     pui->check_imap_inbox =
@@ -2304,7 +2157,7 @@ pm_grid_add_checking_group(GtkWidget *grid_widget)
     pm_grid_attach(grid, hbox, 1, ++row, 3, 1);
 
     pui->quiet_background_check = gtk_check_button_new_with_label(
-            _("Do background check quietly (no messages in status bar)"));
+       _("Do background check quietly (no messages in status bar)"));
     pm_grid_attach(grid, pui->quiet_background_check, 1, ++row, 3, 1);
 
     pm_grid_attach_label(grid, 1, ++row, 1, 1, _("_POP message size limit:"));
@@ -2319,13 +2172,12 @@ pm_grid_add_checking_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * MDN request group
  */
 
 static void
-pm_grid_add_mdn_group(GtkWidget *grid_widget)
+pm_grid_add_mdn_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2373,13 +2225,12 @@ pm_grid_add_mdn_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Word wrap group
  */
 
 static void
-pm_grid_add_word_wrap_group(GtkWidget *grid_widget)
+pm_grid_add_word_wrap_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2388,7 +2239,7 @@ pm_grid_add_word_wrap_group(GtkWidget *grid_widget)
     pm_grid_attach(grid, pm_group_label(_("Word wrap")), 0, row, 3, 1);
 
     pui->wordwrap =
-        gtk_check_button_new_with_label(_("Wrap outgoing text at"));
+       gtk_check_button_new_with_label(_("Wrap outgoing text at"));
     pm_grid_attach(grid, pui->wordwrap, 1, ++row, 1, 1);
 
     spinbutton_adj = gtk_adjustment_new(1.0, 40.0, 998.0, 1.0, 5.0, 0.0);
@@ -2402,13 +2253,12 @@ pm_grid_add_word_wrap_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Other options group
  */
 
 static void
-pm_grid_add_other_options_group(GtkWidget *grid_widget)
+pm_grid_add_other_options_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2431,7 +2281,7 @@ pm_grid_add_other_options_group(GtkWidget *grid_widget)
                                                      "outgoing mail in outbox"));
 
     pui->send_mail_auto =
-        pm_grid_attach_check(grid, 1, ++row, 1, 1, _("_Send queued mail automatically every"));
+       pm_grid_attach_check(grid, 1, ++row, 1, 1, _("_Send queued mail automatically every"));
     spinbutton_adj = gtk_adjustment_new(10, 1, 120, 1, 10, 0);
     pui->send_mail_minutes = gtk_spin_button_new(spinbutton_adj, 1, 0);
     gtk_widget_set_hexpand(pui->send_mail_minutes, TRUE);
@@ -2447,13 +2297,12 @@ pm_grid_add_other_options_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Main window group
  */
 
 static void
-pm_grid_add_main_window_group(GtkWidget *grid_widget)
+pm_grid_add_main_window_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2491,13 +2340,12 @@ pm_grid_add_main_window_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Message window group
  */
 
 static void
-pm_grid_add_message_window_group(GtkWidget *grid_widget)
+pm_grid_add_message_window_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2514,13 +2362,12 @@ pm_grid_add_message_window_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Sorting and threading group
  */
 
 static void
-pm_grid_add_threading_group(GtkWidget *grid_widget)
+pm_grid_add_threading_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2548,7 +2395,6 @@ pm_grid_add_threading_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Fonts group
  */
@@ -2563,7 +2409,7 @@ pm_grid_add_threading_group(GtkWidget *grid_widget)
  */
 
 static void
-pm_grid_add_preview_font_group(GtkWidget *grid_widget)
+pm_grid_add_preview_font_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2586,20 +2432,18 @@ pm_grid_add_preview_font_group(GtkWidget *grid_widget)
                    2, row, 1, 1);
 
     if (pm_grid_attach_font_button(grid, 1, ++row, 1, 1,
-                                   _("Message font:"),
-                                   balsa_app.message_font,
-                                   &pui->message_font_label,
-                                   &pui->message_font_button)) {
+                                  _("Message font:"),
+                                  balsa_app.message_font,
+                                  &pui->message_font_label,
+                                  &pui->message_font_button))
         use_default_font_size = TRUE;
-    }
 
     if (pm_grid_attach_font_button(grid, 1, ++row, 1, 1,
                                    _("Subject font:"),
                                    balsa_app.subject_font,
                                    &pui->subject_font_label,
-                                   &pui->subject_font_button)) {
+                                   &pui->subject_font_button))
         use_default_font_size = TRUE;
-    }
 
     if (use_default_font_size) {
         gtk_font_chooser_set_level(GTK_FONT_CHOOSER(pui->message_font_button),
@@ -2607,7 +2451,7 @@ pm_grid_add_preview_font_group(GtkWidget *grid_widget)
         gtk_font_chooser_set_level(GTK_FONT_CHOOSER(pui->subject_font_button),
                                    GTK_FONT_CHOOSER_LEVEL_FACE);
         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                         (pui->use_default_font_size), TRUE);
+                                     (pui->use_default_font_size), TRUE);
     }
 
     if (balsa_app.use_system_fonts) {
@@ -2621,13 +2465,12 @@ pm_grid_add_preview_font_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Quoted and flowed text group
  */
 
 static void
-pm_grid_add_quoted_group(GtkWidget *grid_widget)
+pm_grid_add_quoted_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2656,13 +2499,12 @@ pm_grid_add_quoted_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Multipart group
  */
 
 static void
-pm_grid_add_alternative_group(GtkWidget *grid_widget)
+pm_grid_add_alternative_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2673,18 +2515,17 @@ pm_grid_add_alternative_group(GtkWidget *grid_widget)
                    0, row, 3, 1);
 
     pui->display_alt_plain =
-        pm_grid_attach_check(grid, 1, ++row, 1, 1, _("Prefer text/plain over HTML"));
+       pm_grid_attach_check(grid, 1, ++row, 1, 1, _("Prefer text/plain over HTML"));
 
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Message colors group
  */
 
 static void
-pm_grid_add_message_colors_group(GtkWidget *grid_widget)
+pm_grid_add_message_colors_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2692,10 +2533,10 @@ pm_grid_add_message_colors_group(GtkWidget *grid_widget)
 
     pm_grid_attach(grid, pm_group_label(_("Message colors")), 0, row, 3, 1);
 
-    for (i = 0; i < MAX_QUOTED_COLOR; i++) {
+    for(i = 0; i < MAX_QUOTED_COLOR; i++) {
         gchar *text;
 
-        text = g_strdup_printf(_("Quote level %d color"), i + 1);
+        text = g_strdup_printf(_("Quote level %d color"), i+1);
         pui->quoted_color[i] = pm_grid_attach_color_box(grid, 1, ++row, 1, 1, text);
         g_free(text);
     }
@@ -2703,13 +2544,12 @@ pm_grid_add_message_colors_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Link color group
  */
 
 static void
-pm_grid_add_link_color_group(GtkWidget *grid_widget)
+pm_grid_add_link_color_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2721,13 +2561,12 @@ pm_grid_add_link_color_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Format group
  */
 
 static void
-pm_grid_add_display_formats_group(GtkWidget *grid_widget)
+pm_grid_add_display_formats_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2742,13 +2581,12 @@ pm_grid_add_display_formats_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Broken 8-bit group
  */
 
 static void
-pm_grid_add_broken_8bit_codeset_group(GtkWidget *grid_widget)
+pm_grid_add_broken_8bit_codeset_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2760,22 +2598,22 @@ pm_grid_add_broken_8bit_codeset_group(GtkWidget *grid_widget)
                                           "without codeset header")), 0, row, 3, 1);
 
     pui->convert_unknown_8bit[0] =
-        GTK_RADIO_BUTTON(gtk_radio_button_new_with_label(radio_group,
-                                                         _("display as “?”")));
+       GTK_RADIO_BUTTON(gtk_radio_button_new_with_label(radio_group,
+                                                        _("display as “?”")));
     pm_grid_attach(grid, GTK_WIDGET(pui->convert_unknown_8bit[0]),
                    1, ++row, 2, 1);
     radio_group =
-        gtk_radio_button_get_group(GTK_RADIO_BUTTON(pui->convert_unknown_8bit[0]));
+       gtk_radio_button_get_group(GTK_RADIO_BUTTON(pui->convert_unknown_8bit[0]));
 
     pui->convert_unknown_8bit[1] =
-        GTK_RADIO_BUTTON(gtk_radio_button_new_with_label(radio_group,
-                                                         _("display in codeset")));
+       GTK_RADIO_BUTTON(gtk_radio_button_new_with_label(radio_group,
+                                                        _("display in codeset")));
     pm_grid_attach(grid, GTK_WIDGET(pui->convert_unknown_8bit[1]),
-                   1, ++row, 1, 1);
+                    1, ++row, 1, 1);
 
     pui->convert_unknown_8bit_codeset = libbalsa_charset_button_new();
     gtk_combo_box_set_active(GTK_COMBO_BOX
-                                 (pui->convert_unknown_8bit_codeset),
+                             (pui->convert_unknown_8bit_codeset),
                              balsa_app.convert_unknown_8bit_codeset);
     gtk_widget_set_hexpand(pui->convert_unknown_8bit_codeset, TRUE);
     pm_grid_attach(grid, pui->convert_unknown_8bit_codeset,
@@ -2784,13 +2622,12 @@ pm_grid_add_broken_8bit_codeset_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Information messages group
  */
 
 static void
-pm_grid_add_information_messages_group(GtkWidget *grid_widget)
+pm_grid_add_information_messages_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2798,58 +2635,52 @@ pm_grid_add_information_messages_group(GtkWidget *grid_widget)
     pm_grid_attach(grid, pm_group_label(_("Information messages")), 0, row, 3, 1);
 
     pui->information_message_menu =
-        pm_grid_attach_information_menu(grid, 1, ++row, 1, 1,
+       pm_grid_attach_information_menu(grid, 1, ++row, 1, 1,
                                         _("Information messages:"),
                                         balsa_app.information_message);
     pui->warning_message_menu =
-        pm_grid_attach_information_menu(grid, 1, ++row, 1, 1,
+       pm_grid_attach_information_menu(grid, 1, ++row, 1, 1,
                                         _("Warning messages:"),
                                         balsa_app.warning_message);
     pui->error_message_menu =
-        pm_grid_attach_information_menu(grid, 1, ++row, 1, 1,
+       pm_grid_attach_information_menu(grid, 1, ++row, 1, 1,
                                         _("Error messages:"),
                                         balsa_app.error_message);
     pui->fatal_message_menu =
-        pm_grid_attach_information_menu(grid, 1, ++row, 1, 1,
-                                        _("Fatal error messages:"),
+       pm_grid_attach_information_menu(grid, 1, ++row, 1, 1,
+                                       _("Fatal error messages:"),
                                         balsa_app.fatal_message);
     pui->debug_message_menu =
-        pm_grid_attach_information_menu(grid, 1, ++row, 1, 1,
+       pm_grid_attach_information_menu(grid, 1, ++row, 1, 1,
                                         _("Debug messages:"),
                                         balsa_app.debug_message);
 
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Progress dialog group
  */
 
 static void
-pm_grid_add_progress_group(GtkWidget *grid_widget)
+pm_grid_add_progress_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
 
     pm_grid_attach(grid, pm_group_label(_("Display progress dialog")), 0, row, 3, 1);
-    pui->send_progress_dlg =
-        pm_grid_attach_check(grid, 1, ++row, 2, 1, _(
-                                 "Display progress dialog when sending messages"));
-    pui->recv_progress_dlg =
-        pm_grid_attach_check(grid, 1, ++row, 2, 1, _(
-                                 "Display progress dialog when retrieving messages"));
+    pui->send_progress_dlg = pm_grid_attach_check(grid, 1, ++row, 2, 1, _("Display progress dialog when 
sending messages"));
+    pui->recv_progress_dlg = pm_grid_attach_check(grid, 1, ++row, 2, 1, _("Display progress dialog when 
retrieving messages"));
 
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Address books group
  */
 
 static void
-pm_grid_add_address_books_group(GtkWidget *grid_widget)
+pm_grid_add_address_books_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2867,7 +2698,7 @@ pm_grid_add_address_books_group(GtkWidget *grid_widget)
     gtk_widget_set_vexpand(scrolledwindow, TRUE);
     pm_grid_attach(grid, scrolledwindow, 1, ++row, 1, 1);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow),
-                                   GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+                                  GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
     gtk_widget_set_size_request(scrolledwindow, -1, 150);
 
     store = gtk_list_store_new(AB_N_COLUMNS,
@@ -2876,7 +2707,7 @@ pm_grid_add_address_books_group(GtkWidget *grid_widget)
                                G_TYPE_BOOLEAN,  /* AB_XPND_COLUMN */
                                G_TYPE_POINTER); /* AB_DATA_COLUMN */
     pui->address_books = tree_view =
-            gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
+        gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
     g_object_unref(store);
 
     renderer = gtk_cell_renderer_text_new();
@@ -2904,10 +2735,10 @@ pm_grid_add_address_books_group(GtkWidget *grid_widget)
                                                  NULL);
     gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
     gtk_tree_selection_set_mode(gtk_tree_view_get_selection
-                                    (GTK_TREE_VIEW(tree_view)),
+                                (GTK_TREE_VIEW(tree_view)),
                                 GTK_SELECTION_BROWSE);
 
-    g_signal_connect(tree_view, "row-activated",
+    g_signal_connect(tree_view, "row-activated", 
                      G_CALLBACK(address_book_edit_cb), NULL);
 
     gtk_container_add(GTK_CONTAINER(scrolledwindow), tree_view);
@@ -2930,7 +2761,7 @@ pm_grid_add_address_books_group(GtkWidget *grid_widget)
     add_button_to_box(_("_Delete"),
                       G_CALLBACK(address_book_delete_cb),
                       tree_view, vbox);
-    add_button_to_box(_("_Set as default"),
+    add_button_to_box(_("_Set as default"), 
                       G_CALLBACK(address_book_set_default_cb),
                       tree_view, vbox);
     pm_grid_attach(grid, vbox, 2, row, 1, 1);
@@ -2940,10 +2771,9 @@ pm_grid_add_address_books_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 #if !(HAVE_GSPELL || HAVE_GTKSPELL)
 static void
-pm_grid_add_misc_spelling_group(GtkWidget *grid_widget)
+pm_grid_add_misc_spelling_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2952,14 +2782,12 @@ pm_grid_add_misc_spelling_group(GtkWidget *grid_widget)
                    0, row, 3, 1);
 
     pui->spell_check_sig =
-        pm_grid_attach_check(grid, 1, ++row, 1, 1, _("Check signature"));
+        pm_grid_attach_check(grid, 1, ++row, 1, 1 , _("Check signature"));
     pui->spell_check_quoted =
         pm_grid_attach_check(grid, 1, ++row, 1, 1, _("Check quoted"));
 
     pm_grid_set_next_row(grid, ++row);
 }
-
-
 #endif                          /* !(HAVE_GSPELL || HAVE_GTKSPELL) */
 
 /*
@@ -2967,7 +2795,7 @@ pm_grid_add_misc_spelling_group(GtkWidget *grid_widget)
  */
 
 static void
-pm_grid_add_startup_options_group(GtkWidget *grid_widget)
+pm_grid_add_startup_options_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -2980,18 +2808,17 @@ pm_grid_add_startup_options_group(GtkWidget *grid_widget)
         pm_grid_attach_check(grid, 1, ++row, 3, 1, _("Check mail upon start-up"));
     pui->remember_open_mboxes =
         pm_grid_attach_check(grid, 1, ++row, 3, 1, _("Remember open mailboxes "
-                                                     "between sessions"));
+                                    "between sessions"));
 
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Folder scanning group
  */
 
 static void
-pm_grid_add_folder_scanning_group(GtkWidget *grid_widget)
+pm_grid_add_folder_scanning_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -3001,10 +2828,10 @@ pm_grid_add_folder_scanning_group(GtkWidget *grid_widget)
     pm_grid_attach(grid, pm_group_label(_("Folder scanning")), 0, row, 3, 1);
 
     pm_grid_attach_label(grid, 1, ++row, 3, 1,
-                         _("Choose depth 1 for fast start-up; "
-                           "this defers scanning some folders. "
-                           "To see more of the tree at start-up, "
-                           "choose a greater depth."));
+                        _("Choose depth 1 for fast start-up; "
+                          "this defers scanning some folders. "
+                          "To see more of the tree at start-up, "
+                          "choose a greater depth."));
 
     label =
         pm_grid_attach_label(grid, 1, ++row, 1, 1,
@@ -3028,13 +2855,12 @@ pm_grid_add_folder_scanning_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Miscellaneous group
  */
 
 static void
-pm_grid_add_misc_group(GtkWidget *grid_widget)
+pm_grid_add_misc_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -3054,7 +2880,7 @@ pm_grid_add_misc_group(GtkWidget *grid_widget)
 
     close_spinbutton_adj = gtk_adjustment_new(10, 1, 100, 1, 10, 0);
     pui->close_mailbox_minutes =
-        gtk_spin_button_new(close_spinbutton_adj, 1, 0);
+       gtk_spin_button_new(close_spinbutton_adj, 1, 0);
     gtk_widget_set_hexpand(pui->close_mailbox_minutes, TRUE);
     gtk_widget_set_sensitive(pui->close_mailbox_minutes, FALSE);
     pm_grid_attach(grid, pui->close_mailbox_minutes, 2, row, 1, 1);
@@ -3064,13 +2890,12 @@ pm_grid_add_misc_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /*
  * Message deleting group
  */
 
 static void
-pm_grid_add_deleting_messages_group(GtkWidget *grid_widget)
+pm_grid_add_deleting_messages_group(GtkWidget * grid_widget)
 {
     GtkGrid *grid = (GtkGrid *) grid_widget;
     gint row = pm_grid_get_next_row(grid);
@@ -3083,10 +2908,10 @@ pm_grid_add_deleting_messages_group(GtkWidget *grid_widget)
      * the UTF-8 string for the right-arrow symbol is broken out to
      * avoid msgconv problems. */
     text = g_strdup_printf(_("The following setting is global, "
-                             "but may be overridden "
-                             "for the selected mailbox "
-                             "using Mailbox %s Hide messages:"),
-                           "\342\226\272");
+                            "but may be overridden "
+                            "for the selected mailbox "
+                            "using Mailbox %s Hide messages:"),
+                          "\342\226\272");
     pm_grid_attach_label(grid, 1, ++row, 3, 1, text);
     g_free(text);
     pui->hide_deleted =
@@ -3113,7 +2938,6 @@ pm_grid_add_deleting_messages_group(GtkWidget *grid_widget)
     pm_grid_set_next_row(grid, ++row);
 }
 
-
 /***************************
  *
  * End of preferences groups
@@ -3127,11 +2951,11 @@ pm_grid_add_deleting_messages_group(GtkWidget *grid_widget)
  */
 
 static void
-pm_append_page(GtkWidget    *stack,
-               GtkWidget    *child,
-               const gchar  *text,
-               GtkTreeStore *store,
-               GtkTreeIter  *iter)
+pm_append_page(GtkWidget    * stack,
+               GtkWidget    * child,
+               const gchar  * text,
+               GtkTreeStore * store,
+               GtkTreeIter  * iter)
 {
     gtk_stack_add_named((GtkStack *) stack, child, text);
 
@@ -3142,7 +2966,6 @@ pm_append_page(GtkWidget    *stack,
                        -1);
 }
 
-
 /********************************************************
  *
  * The pages
@@ -3164,7 +2987,6 @@ pm_mailserver_page(void)
     return grid;
 }
 
-
 static GtkWidget *
 pm_incoming_page(void)
 {
@@ -3176,7 +2998,6 @@ pm_incoming_page(void)
     return grid;
 }
 
-
 static GtkWidget *
 pm_outgoing_page(void)
 {
@@ -3188,7 +3009,6 @@ pm_outgoing_page(void)
     return grid;
 }
 
-
 static GtkWidget *
 pm_display_page(void)
 {
@@ -3200,7 +3020,6 @@ pm_display_page(void)
     return grid;
 }
 
-
 static GtkWidget *
 pm_threading_page(void)
 {
@@ -3211,7 +3030,6 @@ pm_threading_page(void)
     return grid;
 }
 
-
 static GtkWidget *
 pm_message_page(void)
 {
@@ -3224,7 +3042,6 @@ pm_message_page(void)
     return grid;
 }
 
-
 static GtkWidget *
 pm_colors_page(void)
 {
@@ -3236,7 +3053,6 @@ pm_colors_page(void)
     return grid;
 }
 
-
 static GtkWidget *
 pm_format_page(void)
 {
@@ -3248,7 +3064,6 @@ pm_format_page(void)
     return grid;
 }
 
-
 static GtkWidget *
 pm_status_messages_page(void)
 {
@@ -3260,7 +3075,6 @@ pm_status_messages_page(void)
     return grid;
 }
 
-
 static GtkWidget *
 create_address_book_page(void)
 {
@@ -3271,7 +3085,6 @@ create_address_book_page(void)
     return grid;
 }
 
-
 #if !(HAVE_GSPELL || HAVE_GTKSPELL)
 static GtkWidget *
 pm_spelling_page(void)
@@ -3282,8 +3095,6 @@ pm_spelling_page(void)
 
     return grid;
 }
-
-
 #endif                          /* !(HAVE_GSPELL || HAVE_GTKSPELL) */
 
 static GtkWidget *
@@ -3297,7 +3108,6 @@ pm_startup_page(void)
     return grid;
 }
 
-
 static GtkWidget *
 pm_misc_page(void)
 {
@@ -3309,7 +3119,6 @@ pm_misc_page(void)
     return grid;
 }
 
-
 /*
  * End of pages
  */
@@ -3325,9 +3134,9 @@ pm_misc_page(void)
  ********************************************************************/
 
 static void
-create_mail_options_section(GtkTreeStore *store,
-                            GtkTreeIter  *parent,
-                            GtkWidget    *stack)
+create_mail_options_section(GtkTreeStore * store,
+                            GtkTreeIter  * parent,
+                            GtkWidget    * stack)
 {
     GtkTreeIter iter;
 
@@ -3343,11 +3152,10 @@ create_mail_options_section(GtkTreeStore *store,
                    store, &iter);
 }
 
-
 static void
-create_display_section(GtkTreeStore *store,
-                       GtkTreeIter  *parent,
-                       GtkWidget    *stack)
+create_display_section(GtkTreeStore * store,
+                       GtkTreeIter  * parent,
+                       GtkWidget    * stack)
 {
     GtkTreeIter iter;
 
@@ -3375,7 +3183,6 @@ create_display_section(GtkTreeStore *store,
                    store, &iter);
 }
 
-
 /*
  * End of sections
  */
@@ -3394,7 +3201,7 @@ open_preferences_manager_idle(void)
     }
 
     name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER
-                                             (pui->mail_directory));
+                                         (pui->mail_directory));
     if (g_strcmp0(name, balsa_app.local_mail_directory) != 0) {
         /* Chooser still hasn't been initialized. */
         g_free(name);
@@ -3408,7 +3215,6 @@ open_preferences_manager_idle(void)
     return G_SOURCE_REMOVE;
 }                               /* open_preferences_manager_idle */
 
-
 /****************
  *
  * Public methods
@@ -3416,14 +3222,13 @@ open_preferences_manager_idle(void)
  ***************/
 
 void
-open_preferences_manager(GtkWidget *widget,
-                         gpointer   data)
+open_preferences_manager(GtkWidget * widget, gpointer data)
 {
     GtkWidget *hbox;
     GtkWidget *content_area;
     GtkTreeStore *store;
     GtkWidget *view;
-    GtkTreeSelection *selection;
+    GtkTreeSelection * selection;
     GtkWidget *stack;
     GtkWidget *active_win = data;
     gint i;
@@ -3453,15 +3258,15 @@ open_preferences_manager(GtkWidget *widget,
     libbalsa_macosx_menu_for_parent(property_box, GTK_WINDOW(active_win));
 #endif
 
-    hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
-    content_area = gtk_dialog_get_content_area(GTK_DIALOG(property_box));
-    gtk_box_pack_start(GTK_BOX(content_area), hbox);
+       hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+       content_area = gtk_dialog_get_content_area(GTK_DIALOG(property_box));
+       gtk_box_pack_start(GTK_BOX(content_area), hbox);
 
     store = gtk_tree_store_new(PM_NUM_COLS,
                                G_TYPE_STRING,   /* PM_TEXT_COL     */
                                G_TYPE_STRING,   /* PM_HELP_COL     */
                                GTK_TYPE_WIDGET  /* PM_CHILD_COL    */
-                               );
+            );
     pui->view = view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
     g_object_set(view, "margin", BORDER_WIDTH, NULL);
     gtk_box_pack_start(GTK_BOX(hbox), view);
@@ -3684,19 +3489,17 @@ open_preferences_manager(GtkWidget *widget,
                      G_CALLBACK(properties_modified_cb), property_box);
 
     /* Colour */
-    for (i = 0; i < MAX_QUOTED_COLOR; i++) {
+    for (i = 0; i < MAX_QUOTED_COLOR; i++)
         g_signal_connect(G_OBJECT(pui->quoted_color[i]), "color-set",
                          G_CALLBACK(properties_modified_cb), property_box);
-    }
 
     g_signal_connect(G_OBJECT(pui->url_color), "color-set",
                      G_CALLBACK(properties_modified_cb), property_box);
 
     /* handling of message parts with 8-bit chars without codeset headers */
-    for (i = 0; i < NUM_CONVERT_8BIT_MODES; i++) {
+    for (i = 0; i < NUM_CONVERT_8BIT_MODES; i++)
         g_signal_connect(G_OBJECT(pui->convert_unknown_8bit[i]), "toggled",
                          G_CALLBACK(convert_8bit_cb), property_box);
-    }
 
     /* Gnome Property Box Signals */
     g_signal_connect(G_OBJECT(property_box), "response",
@@ -3706,20 +3509,17 @@ open_preferences_manager(GtkWidget *widget,
 
 }                               /* open_preferences_manager */
 
-
 /* refresh any data displayed in the preferences manager
  * window in case it has changed */
 void
 refresh_preferences_manager(void)
 {
-    if (pui == NULL) {
+    if (pui == NULL)
         return;
-    }
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->browse_wrap),
                                  balsa_app.browse_wrap);
 }
 
-
 /* update_mail_servers:
    update mail server list in the preferences window.
    NOTE: it can be called even when the preferences window is closed (via
@@ -3737,25 +3537,22 @@ update_mail_servers(void)
     gboolean valid;
     BalsaMailboxNode *mbnode;
 
-    if (pui == NULL) {
+    if (pui == NULL)
         return;
-    }
 
     tree_view = GTK_TREE_VIEW(pui->mail_servers);
     model = gtk_tree_view_get_model(tree_view);
 
     gtk_list_store_clear(GTK_LIST_STORE(model));
     for (list = balsa_app.inbox_input; list; list = list->next) {
-        if (!(mbnode = list->data)) {
+        if (!(mbnode = list->data))
             continue;
-        }
-        if (LIBBALSA_IS_MAILBOX_POP3(mbnode->mailbox)) {
+        if (LIBBALSA_IS_MAILBOX_POP3(mbnode->mailbox))
             protocol = "POP3";
-        } else if (LIBBALSA_IS_MAILBOX_IMAP(mbnode->mailbox)) {
+        else if (LIBBALSA_IS_MAILBOX_IMAP(mbnode->mailbox))
             protocol = "IMAP";
-        } else {
+        else
             protocol = _("Unknown");
-        }
 
         gtk_list_store_append(GTK_LIST_STORE(model), &iter);
         gtk_list_store_set(GTK_LIST_STORE(model), &iter,
@@ -3777,8 +3574,7 @@ update_mail_servers(void)
         g_object_unref(mbnode);
     }
 
-    if (gtk_tree_model_get_iter_first(model, &iter)) {
+    if (gtk_tree_model_get_iter_first(model, &iter))
         gtk_tree_selection_select_iter(gtk_tree_view_get_selection
-                                           (tree_view), &iter);
-    }
+                                       (tree_view), &iter);
 }
diff --git a/src/pref-manager.h b/src/pref-manager.h
index f84f98f..08b33b3 100644
--- a/src/pref-manager.h
+++ b/src/pref-manager.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -23,8 +23,7 @@
 #include <gtk/gtk.h>
 
 /* open the preferences manager window */
-void open_preferences_manager(GtkWidget *widget,
-                              gpointer   data);
+void open_preferences_manager(GtkWidget * widget, gpointer data);
 
 /* refresh any data displayed in the preferences manager
  * window in case it has changed */
diff --git a/src/print-gtk.c b/src/print-gtk.c
index 26e6e80..441a53f 100644
--- a/src/print-gtk.c
+++ b/src/print-gtk.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 
 #include <string.h>
@@ -34,7 +34,7 @@
 #include "balsa-print-object-header.h"
 
 #if HAVE__NL_MEASUREMENT_MEASUREMENT
-#   include <langinfo.h>
+#include <langinfo.h>
 #endif                          /* HAVE__NL_MEASUREMENT_MEASUREMENT */
 
 typedef struct {
@@ -53,13 +53,13 @@ typedef struct {
 typedef struct {
     /* related message */
     LibBalsaMessage *message;
-
+    
     /* print setup */
     BalsaPrintSetup setup;
 
     /* print data */
     GList *print_parts;
-
+ 
     /* header related stuff */
     gdouble c_header_y;
 
@@ -71,10 +71,8 @@ typedef struct {
 
 /* print the page header and footer */
 static void
-print_header_footer(GtkPrintContext *context,
-                    cairo_t         *cairo_ctx,
-                    BalsaPrintData  *pdata,
-                    gint             pageno)
+print_header_footer(GtkPrintContext * context, cairo_t * cairo_ctx,
+                   BalsaPrintData * pdata, gint pageno)
 {
     PangoLayout *layout;
     PangoFontDescription *font;
@@ -88,7 +86,7 @@ print_header_footer(GtkPrintContext *context,
     pango_layout_set_width(layout, C_TO_P(pdata->setup.c_width));
     pango_layout_set_alignment(layout, PANGO_ALIGN_RIGHT);
     pagebuf =
-        g_strdup_printf(_("Page %d of %d"), pageno + 1, pdata->setup.page_count);
+       g_strdup_printf(_("Page %d of %d"), pageno + 1, pdata->setup.page_count);
     pango_layout_set_text(layout, pagebuf, -1);
     g_free(pagebuf);
     cairo_move_to(cairo_ctx, pdata->setup.c_x0, pdata->c_header_y);
@@ -97,18 +95,18 @@ print_header_footer(GtkPrintContext *context,
 
     /* footer (if available) */
     if (pdata->footer) {
-        font =
-            pango_font_description_from_string(balsa_app.
-                                               print_footer_font);
-        layout = gtk_print_context_create_pango_layout(context);
-        pango_layout_set_font_description(layout, font);
-        pango_font_description_free(font);
-        pango_layout_set_width(layout, C_TO_P(pdata->setup.c_width));
-        pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
-        pango_layout_set_text(layout, pdata->footer, -1);
-        cairo_move_to(cairo_ctx, pdata->setup.c_x0, pdata->c_footer_y);
-        pango_cairo_show_layout(cairo_ctx, layout);
-        g_object_unref(G_OBJECT(layout));
+       font =
+           pango_font_description_from_string(balsa_app.
+                                              print_footer_font);
+       layout = gtk_print_context_create_pango_layout(context);
+       pango_layout_set_font_description(layout, font);
+       pango_font_description_free(font);
+       pango_layout_set_width(layout, C_TO_P(pdata->setup.c_width));
+       pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
+       pango_layout_set_text(layout, pdata->footer, -1);
+       cairo_move_to(cairo_ctx, pdata->setup.c_x0, pdata->c_footer_y);
+       pango_cairo_show_layout(cairo_ctx, layout);
+       g_object_unref(G_OBJECT(layout));
     }
 }
 
@@ -117,106 +115,97 @@ print_header_footer(GtkPrintContext *context,
  * scan the body list and prepare print data according to the content type
  */
 static GList *
-scan_body(GList               *bpo_list,
-          GtkPrintContext     *context,
-          BalsaPrintSetup     *psetup,
-          LibBalsaMessageBody *body,
-          gboolean             no_first_sep)
+scan_body(GList *bpo_list, GtkPrintContext * context, BalsaPrintSetup * psetup,
+         LibBalsaMessageBody * body, gboolean no_first_sep)
 {
 #ifdef HAVE_GPGME
     gboolean add_signature;
     gboolean have_crypto_frame;
-#endif                          /* HAVE_GPGME */
+#endif                         /* HAVE_GPGME */
 
     while (body) {
-        gchar *conttype;
+       gchar *conttype;
 
-        conttype = libbalsa_message_body_get_mime_type(body);
+       conttype = libbalsa_message_body_get_mime_type(body);
 #ifdef HAVE_GPGME
-        add_signature = body->sig_info &&
-            g_ascii_strcasecmp(conttype, "application/pgp-signature") &&
-            g_ascii_strcasecmp(conttype, "application/pkcs7-signature") &&
-            g_ascii_strcasecmp(conttype, "application/x-pkcs7-signature");
-        if (!g_ascii_strcasecmp("multipart/signed", conttype) &&
-            body->parts && body->parts->next
-            && body->parts->next->sig_info) {
-            have_crypto_frame = TRUE;
-            bpo_list = balsa_print_object_separator(bpo_list, psetup);
-            no_first_sep = TRUE;
-            if (body->was_encrypted) {
-                bpo_list = balsa_print_object_frame_begin(bpo_list,
-                                                          _("Signed and encrypted matter"),
-                                                          psetup);
-            } else {
-                bpo_list = balsa_print_object_frame_begin(bpo_list,
-                                                          _("Signed matter"),
-                                                          psetup);
-            }
-        } else if (!add_signature && body->was_encrypted) {
-            have_crypto_frame = TRUE;
-            bpo_list = balsa_print_object_separator(bpo_list, psetup);
-            no_first_sep = TRUE;
-            bpo_list = balsa_print_object_frame_begin(bpo_list,
-                                                      _("Encrypted matter"),
-                                                      psetup);
-        } else {
-            have_crypto_frame = FALSE;
-        }
-#endif                          /* HAVE_GPGME */
-
-        if (g_ascii_strncasecmp(conttype, "multipart/", 10)) {
-            if (no_first_sep) {
-                no_first_sep = FALSE;
-            } else {
-                bpo_list = balsa_print_object_separator(bpo_list, psetup);
-            }
+       add_signature = body->sig_info &&
+           g_ascii_strcasecmp(conttype, "application/pgp-signature") &&
+           g_ascii_strcasecmp(conttype, "application/pkcs7-signature") &&
+           g_ascii_strcasecmp(conttype, "application/x-pkcs7-signature");
+       if (!g_ascii_strcasecmp("multipart/signed", conttype) &&
+           body->parts && body->parts->next
+           && body->parts->next->sig_info) {
+           have_crypto_frame = TRUE;
+           bpo_list = balsa_print_object_separator(bpo_list, psetup);
+           no_first_sep = TRUE;
+           if (body->was_encrypted)
+               bpo_list = balsa_print_object_frame_begin(bpo_list,
+                                                         _("Signed and encrypted matter"),
+                                                         psetup);
+           else
+               bpo_list = balsa_print_object_frame_begin(bpo_list,
+                                                         _("Signed matter"),
+                                                         psetup);
+       } else if (!add_signature && body->was_encrypted) {
+           have_crypto_frame = TRUE;
+           bpo_list = balsa_print_object_separator(bpo_list, psetup);
+           no_first_sep = TRUE;
+           bpo_list = balsa_print_object_frame_begin(bpo_list,
+                                                     _("Encrypted matter"),
+                                                     psetup);
+       } else
+           have_crypto_frame = FALSE;
+#endif                         /* HAVE_GPGME */
+
+       if (g_ascii_strncasecmp(conttype, "multipart/", 10)) {
+           if (no_first_sep)
+               no_first_sep = FALSE;
+           else
+               bpo_list = balsa_print_object_separator(bpo_list, psetup);
 #ifdef HAVE_GPGME
-            if (add_signature) {
-                if (body->was_encrypted) {
-                    bpo_list = balsa_print_object_frame_begin(bpo_list,
-                                                              _("Signed and encrypted matter"),
-                                                              psetup);
-                } else {
-                    bpo_list = balsa_print_object_frame_begin(bpo_list,
-                                                              _("Signed matter"),
-                                                              psetup);
-                }
-            }
-#endif                          /* HAVE_GPGME */
-            bpo_list = balsa_print_objects_append_from_body(bpo_list, context,
-                                                            body, psetup);
-        }
-
-        if (body->parts) {
-            bpo_list = scan_body(bpo_list, context, psetup, body->parts, no_first_sep);
-            no_first_sep = FALSE;
-        }
-
-        /* end the frame for an embedded message or encrypted stuff */
-        if (!g_ascii_strcasecmp(conttype, "message/rfc822")
+           if (add_signature) {
+               if (body->was_encrypted)
+                   bpo_list = balsa_print_object_frame_begin(bpo_list,
+                                                             _("Signed and encrypted matter"),
+                                                             psetup);
+               else
+                   bpo_list = balsa_print_object_frame_begin(bpo_list,
+                                                             _("Signed matter"),
+                                                             psetup);
+           }
+#endif                         /* HAVE_GPGME */
+           bpo_list = balsa_print_objects_append_from_body(bpo_list, context,
+                                                           body, psetup);
+       }
+
+       if (body->parts) {
+           bpo_list = scan_body(bpo_list, context, psetup, body->parts, no_first_sep);
+           no_first_sep = FALSE;
+       }
+
+       /* end the frame for an embedded message or encrypted stuff */
+       if (!g_ascii_strcasecmp(conttype, "message/rfc822")
 #ifdef HAVE_GPGME
-            || have_crypto_frame
+           || have_crypto_frame
 #endif
-            ) {
-            bpo_list = balsa_print_object_frame_end(bpo_list, psetup);
-        }
+           )
+           bpo_list = balsa_print_object_frame_end(bpo_list, psetup);
 
 #ifdef HAVE_GPGME
-        if (add_signature) {
-            gchar *header =
-                g_strdup_printf(_("This is an inline %s signed %s message part:"),
-                                body->sig_info->protocol == GPGME_PROTOCOL_OpenPGP ?
-                                _("OpenPGP") : _("S/MIME"), conttype);
-            bpo_list = balsa_print_object_separator(bpo_list, psetup);
-            bpo_list =
-                balsa_print_object_header_crypto(bpo_list, context, body, header, psetup);
-            g_free(header);
-            bpo_list = balsa_print_object_frame_end(bpo_list, psetup);
-        }
-#endif                          /* HAVE_GPGME */
-        g_free(conttype);
-
-        body = body->next;
+       if (add_signature) {
+           gchar *header =
+               g_strdup_printf(_("This is an inline %s signed %s message part:"),
+                               body->sig_info->protocol == GPGME_PROTOCOL_OpenPGP ?
+                               _("OpenPGP") : _("S/MIME"), conttype);
+           bpo_list = balsa_print_object_separator(bpo_list, psetup);
+           bpo_list = balsa_print_object_header_crypto(bpo_list, context, body, header, psetup);
+           g_free(header);
+           bpo_list = balsa_print_object_frame_end(bpo_list, psetup);
+       }
+#endif                         /* HAVE_GPGME */
+       g_free(conttype);
+
+       body = body->next;
     }
 
     return bpo_list;
@@ -224,9 +213,8 @@ scan_body(GList               *bpo_list,
 
 
 static void
-begin_print(GtkPrintOperation *operation,
-            GtkPrintContext   *context,
-            BalsaPrintData    *pdata)
+begin_print(GtkPrintOperation * operation, GtkPrintContext * context,
+           BalsaPrintData * pdata)
 {
     GtkPageSetup *page_setup;
     PangoLayout *layout;
@@ -241,17 +229,17 @@ begin_print(GtkPrintOperation *operation,
 
     /* calculate the "real" margins */
     pdata->setup.c_x0 = balsa_app.margin_left -
-        gtk_page_setup_get_left_margin(page_setup, GTK_UNIT_POINTS);
+       gtk_page_setup_get_left_margin(page_setup, GTK_UNIT_POINTS);
     pdata->setup.c_width =
-        gtk_page_setup_get_page_width(page_setup, GTK_UNIT_POINTS) -
-        pdata->setup.c_x0 - (balsa_app.margin_right -
-                             gtk_page_setup_get_right_margin(page_setup, GTK_UNIT_POINTS));
+       gtk_page_setup_get_page_width(page_setup, GTK_UNIT_POINTS) -
+       pdata->setup.c_x0 -(balsa_app.margin_right -
+                           gtk_page_setup_get_right_margin(page_setup, GTK_UNIT_POINTS));
     pdata->setup.c_y0 = balsa_app.margin_top -
-        gtk_page_setup_get_top_margin(page_setup, GTK_UNIT_POINTS);
+       gtk_page_setup_get_top_margin(page_setup, GTK_UNIT_POINTS);
     pdata->setup.c_height =
-        gtk_page_setup_get_page_height(page_setup, GTK_UNIT_POINTS) -
-        pdata->setup.c_y0 - (balsa_app.margin_bottom -
-                             gtk_page_setup_get_bottom_margin(page_setup, GTK_UNIT_POINTS));
+       gtk_page_setup_get_page_height(page_setup, GTK_UNIT_POINTS) -
+       pdata->setup.c_y0 -(balsa_app.margin_bottom -
+                           gtk_page_setup_get_bottom_margin(page_setup, GTK_UNIT_POINTS));
 
     pdata->setup.page_count = 1;
 
@@ -264,89 +252,87 @@ begin_print(GtkPrintOperation *operation,
     pango_layout_set_font_description(layout, font);
     pango_font_description_free(font);
     pdata->setup.p_body_font_height =
-        p_string_height_from_layout(layout, pagebuf);
+       p_string_height_from_layout(layout, pagebuf);
 
     /* basic header font and header height */
     font = pango_font_description_from_string(balsa_app.print_header_font);
     pango_layout_set_font_description(layout, font);
     pango_font_description_free(font);
     pdata->setup.p_hdr_font_height =
-        p_string_height_from_layout(layout, pagebuf);
+       p_string_height_from_layout(layout, pagebuf);
     g_free(pagebuf);
 
     pdata->c_header_y = pdata->setup.c_y0;
     pdata->setup.c_y0 += P_TO_C(pdata->setup.p_hdr_font_height) + C_HEADER_SEP;
     pdata->setup.c_y_pos = pdata->setup.c_y0;
     pdata->setup.c_height -=
-        P_TO_C(pdata->setup.p_hdr_font_height) + C_HEADER_SEP;
+       P_TO_C(pdata->setup.p_hdr_font_height) + C_HEADER_SEP;
 
     /* now create the footer string so we can reduce the height accordingly */
     subject = g_strdup(LIBBALSA_MESSAGE_GET_SUBJECT(pdata->message));
     libbalsa_utf8_sanitize(&subject, balsa_app.convert_unknown_8bit, NULL);
-    if (subject) {
-        footer_string = g_string_new(subject);
-    } else {
-        footer_string = NULL;
-    }
+    if (subject)
+       footer_string = g_string_new(subject);
+    else
+       footer_string = NULL;
 
     date = libbalsa_message_date_to_utf8(pdata->message, balsa_app.date_string);
     if (footer_string) {
-        footer_string = g_string_append(footer_string, " \342\200\224 ");
-        footer_string = g_string_append(footer_string, date);
-    } else {
-        footer_string = g_string_new(date);
-    }
+       footer_string = g_string_append(footer_string, " \342\200\224 ");
+       footer_string = g_string_append(footer_string, date);
+    } else
+       footer_string = g_string_new(date);
     g_free(date);
 
     if (pdata->message->headers->from) {
-        gchar *from =
-            internet_address_list_to_string(pdata->message->headers->from, FALSE);
-
-        libbalsa_utf8_sanitize(&from, balsa_app.convert_unknown_8bit,
-                               NULL);
-        if (footer_string) {
-            footer_string =
-                g_string_prepend(footer_string, " \342\200\224 ");
-            footer_string = g_string_prepend(footer_string, from);
-        } else {
-            footer_string = g_string_new(from);
-        }
-        g_free(from);
+       gchar *from =
+           internet_address_list_to_string(pdata->message->headers->from, FALSE);
+
+       libbalsa_utf8_sanitize(&from, balsa_app.convert_unknown_8bit,
+                              NULL);
+       if (footer_string) {
+           footer_string =
+               g_string_prepend(footer_string, " \342\200\224 ");
+           footer_string = g_string_prepend(footer_string, from);
+       } else {
+           footer_string = g_string_new(from);
+       }
+       g_free(from);
     }
 
     /* if a footer is available, remember the string and adjust the height */
     if (footer_string) {
-        gint p_height;
-
-        /* create a layout to calculate the height of the footer */
-        font = pango_font_description_from_string(balsa_app.print_footer_font);
-        pango_layout_set_font_description(layout, font);
-        pango_font_description_free(font);
-        pango_layout_set_width(layout, C_TO_P(pdata->setup.c_width));
-        pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
-
-        /* calculate the height and adjust the pringrid region */
-        p_height = p_string_height_from_layout(layout, footer_string->str);
-        pdata->c_footer_y =
-            pdata->setup.c_y0 + pdata->setup.c_height - P_TO_C(p_height);
-        pdata->setup.c_height -= P_TO_C(p_height) + C_HEADER_SEP;
-
-        /* remember in the context */
-        pdata->footer = g_string_free(footer_string, FALSE);
+       gint p_height;
+
+       /* create a layout to calculate the height of the footer */
+       font = pango_font_description_from_string(balsa_app.print_footer_font);
+       pango_layout_set_font_description(layout, font);
+       pango_font_description_free(font);
+       pango_layout_set_width(layout, C_TO_P(pdata->setup.c_width));
+       pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
+
+       /* calculate the height and adjust the pringrid region */
+       p_height = p_string_height_from_layout(layout, footer_string->str);
+       pdata->c_footer_y =
+           pdata->setup.c_y0 + pdata->setup.c_height - P_TO_C(p_height);
+       pdata->setup.c_height -= P_TO_C(p_height) + C_HEADER_SEP;
+
+       /* remember in the context */
+       pdata->footer = g_string_free(footer_string, FALSE);
     }
     g_object_unref(G_OBJECT(layout));
 
     /* add the message headers */
-    pdata->setup.c_y_pos = 0.0; /* to simplify calculating the layout... */
-    pdata->print_parts =
-        balsa_print_object_header_from_message(NULL, context, pdata->message,
-                                               subject, &pdata->setup);
+    pdata->setup.c_y_pos = 0.0;        /* to simplify calculating the layout... */
+    pdata->print_parts = 
+       balsa_print_object_header_from_message(NULL, context, pdata->message,
+                                              subject, &pdata->setup);
     g_free(subject);
 
     /* add the mime bodies */
-    pdata->print_parts =
-        scan_body(pdata->print_parts, context, &pdata->setup,
-                  pdata->message->body_list, FALSE);
+    pdata->print_parts = 
+       scan_body(pdata->print_parts, context, &pdata->setup,
+                 pdata->message->body_list, FALSE);
 
     /* done */
     gtk_print_operation_set_n_pages(operation, pdata->setup.page_count);
@@ -354,24 +340,22 @@ begin_print(GtkPrintOperation *operation,
 
 
 static void
-draw_page(GtkPrintOperation *operation,
-          GtkPrintContext   *context,
-          gint               page_nr,
-          BalsaPrintData    *print_data)
+draw_page(GtkPrintOperation * operation, GtkPrintContext * context,
+         gint page_nr, BalsaPrintData * print_data)
 {
     cairo_t *cairo_ctx;
-    GList *p;
+    GList * p;
 
     /* emit a warning if we try to print a non-existing page */
     if (page_nr >= print_data->setup.page_count) {
-        balsa_information(LIBBALSA_INFORMATION_WARNING,
-                          ngettext("Cannot print page %d because "
+       balsa_information(LIBBALSA_INFORMATION_WARNING,
+                         ngettext("Cannot print page %d because "
                                    "the document has only %d page.",
-                                   "Cannot print page %d because "
+                                  "Cannot print page %d because "
                                    "the document has only %d pages.",
                                    print_data->setup.page_count),
-                          page_nr + 1, print_data->setup.page_count);
-        return;
+                         page_nr + 1, print_data->setup.page_count);
+       return;
     }
 
     /* get the cairo context */
@@ -383,17 +367,15 @@ draw_page(GtkPrintOperation *operation,
     /* print parts */
     p = print_data->print_parts;
     while (p) {
-        BalsaPrintObject *po = BALSA_PRINT_OBJECT(p->data);
+       BalsaPrintObject *po = BALSA_PRINT_OBJECT(p->data);
 
-        if (po->on_page == page_nr) {
-            balsa_print_object_draw(po, context, cairo_ctx);
-        }
+       if (po->on_page == page_nr)
+           balsa_print_object_draw(po, context, cairo_ctx);
 
-        p = p->next;
+       p = p->next;
     }
 }
 
-
 /* setup gui related stuff */
 /* shamelessly stolen from gtk+-2.10.6/gtk/gtkpagesetupunixdialog.c */
 static GtkUnit
@@ -403,36 +385,30 @@ get_default_user_units(void)
      * lengths to the user. Translate to default:inch if you
      * want inches, otherwise translate to default:mm.
      * Do *not* translate it to "predefinito:mm", if it
-     * it isn't default:mm or default:inch it will not work
+     * it isn't default:mm or default:inch it will not work 
      */
     gchar *e = _("default:mm");
-
+  
 #if HAVE__NL_MEASUREMENT_MEASUREMENT
     gchar *imperial = NULL;
-
+  
     imperial = nl_langinfo(_NL_MEASUREMENT_MEASUREMENT);
-    if (imperial && (imperial[0] == 2)) {
-        return GTK_UNIT_INCH;  /* imperial */
-    }
-    if (imperial && (imperial[0] == 1)) {
-        return GTK_UNIT_MM;  /* metric */
-    }
+    if (imperial && imperial[0] == 2 )
+       return GTK_UNIT_INCH;  /* imperial */
+    if (imperial && imperial[0] == 1 )
+       return GTK_UNIT_MM;  /* metric */
 #endif                          /* HAVE__NL_MEASUREMENT_MEASUREMENT */
-
-    if (strcmp(e, "default:inch") == 0) {
-        return GTK_UNIT_INCH;
-    } else if (strcmp(e, "default:mm")) {
-        g_warning("Whoever translated default:mm did so wrongly.\n");
-    }
+  
+    if (strcmp(e, "default:inch")==0)
+       return GTK_UNIT_INCH;
+    else if (strcmp(e, "default:mm"))
+       g_warning("Whoever translated default:mm did so wrongly.\n");
     return GTK_UNIT_MM;
 }
 
-
 static GtkWidget *
-add_font_button(const gchar *text,
-                const gchar *font,
-                GtkGrid     *grid,
-                gint         row)
+add_font_button(const gchar * text, const gchar * font, GtkGrid * grid,
+               gint row)
 {
     GtkWidget *label;
     GtkWidget *font_button;
@@ -451,15 +427,10 @@ add_font_button(const gchar *text,
     return font_button;
 }
 
-
 /* note: min and max are passed in points = 1/72" */
 static GtkWidget *
-add_margin_spinbtn(const gchar *text,
-                   gdouble      min,
-                   gdouble      max,
-                   gdouble      dflt,
-                   GtkGrid     *grid,
-                   gint         row)
+add_margin_spinbtn(const gchar * text, gdouble min, gdouble max, gdouble dflt,
+                  GtkGrid * grid, gint row)
 {
     GtkWidget *label;
     GtkWidget *spinbtn;
@@ -472,19 +443,19 @@ add_margin_spinbtn(const gchar *text,
     gtk_grid_attach(grid, label, 0, row, 1, 1);
 
     if (get_default_user_units() == GTK_UNIT_INCH) {
-        unit = _("inch");
-        spinbtn = gtk_spin_button_new_with_range(min / 72.0,
-                                                 max / 72.0, 0.01);
-        gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn), dflt / 72.0);
-        gtk_spin_button_set_digits(GTK_SPIN_BUTTON(spinbtn), 2);
-        gtk_spin_button_set_increments(GTK_SPIN_BUTTON(spinbtn), 0.1, 1.0);
+       unit = _("inch");
+       spinbtn = gtk_spin_button_new_with_range(min / 72.0,
+                                                max / 72.0, 0.01);
+       gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn), dflt / 72.0);
+       gtk_spin_button_set_digits(GTK_SPIN_BUTTON(spinbtn), 2);
+       gtk_spin_button_set_increments(GTK_SPIN_BUTTON(spinbtn), 0.1, 1.0);
     } else {
-        unit = _("mm");
-        spinbtn = gtk_spin_button_new_with_range(min / 72.0 * 25.4,
-                                                 max / 72.0 * 25.4, 0.1);
-        gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn), dflt / 72.0 * 25.4);
-        gtk_spin_button_set_digits(GTK_SPIN_BUTTON(spinbtn), 1);
-        gtk_spin_button_set_increments(GTK_SPIN_BUTTON(spinbtn), 1.0, 10.0);
+       unit = _("mm");
+       spinbtn = gtk_spin_button_new_with_range(min / 72.0 * 25.4,
+                                                max / 72.0 * 25.4, 0.1);
+       gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn), dflt / 72.0 * 25.4);
+       gtk_spin_button_set_digits(GTK_SPIN_BUTTON(spinbtn), 1);
+       gtk_spin_button_set_increments(GTK_SPIN_BUTTON(spinbtn), 1.0, 10.0);
     }
     gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(spinbtn), TRUE);
     gtk_label_set_mnemonic_widget(GTK_LABEL(label), spinbtn);
@@ -499,24 +470,20 @@ add_margin_spinbtn(const gchar *text,
     return spinbtn;
 }
 
-
 static void
-check_margins(GtkAdjustment *adjustment,
-              GtkAdjustment *other)
+check_margins(GtkAdjustment * adjustment, GtkAdjustment * other)
 {
     if (gtk_adjustment_get_value(adjustment) +
         gtk_adjustment_get_value(other) >
-        gtk_adjustment_get_upper(adjustment)) {
+        gtk_adjustment_get_upper(adjustment))
         gtk_adjustment_set_value(adjustment,
                                  gtk_adjustment_get_upper(adjustment) -
                                  gtk_adjustment_get_value(other));
-    }
 }
 
-
 static GtkWidget *
-message_prefs_widget(GtkPrintOperation *operation,
-                     BalsaPrintPrefs   *print_prefs)
+message_prefs_widget(GtkPrintOperation * operation,
+                    BalsaPrintPrefs * print_prefs)
 {
     GtkWidget *page;
     GtkWidget *group;
@@ -559,14 +526,14 @@ message_prefs_widget(GtkPrintOperation *operation,
     gtk_box_pack_start(GTK_BOX(vbox), grid);
 
     print_prefs->header_font =
-        add_font_button(_("_Header Font:"), balsa_app.print_header_font,
-                        GTK_GRID(grid), 0);
+       add_font_button(_("_Header Font:"), balsa_app.print_header_font,
+                       GTK_GRID(grid), 0);
     print_prefs->body_font =
-        add_font_button(_("B_ody Font:"), balsa_app.print_body_font,
-                        GTK_GRID(grid), 1);
+       add_font_button(_("B_ody Font:"), balsa_app.print_body_font,
+                       GTK_GRID(grid), 1);
     print_prefs->footer_font =
-        add_font_button(_("_Footer Font:"), balsa_app.print_footer_font,
-                        GTK_GRID(grid), 2);
+       add_font_button(_("_Footer Font:"), balsa_app.print_footer_font,
+                       GTK_GRID(grid), 2);
 
     group = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
     gtk_box_pack_start(GTK_BOX(page), group);
@@ -589,18 +556,18 @@ message_prefs_widget(GtkPrintOperation *operation,
     gtk_box_pack_start(GTK_BOX(hbox), vbox);
 
     print_prefs->highlight_cited =
-        gtk_check_button_new_with_mnemonic(_("Highlight _cited text"));
+       gtk_check_button_new_with_mnemonic(_("Highlight _cited text"));
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (print_prefs->highlight_cited),
-                                 balsa_app.print_highlight_cited);
+                                (print_prefs->highlight_cited),
+                                balsa_app.print_highlight_cited);
     gtk_box_pack_start(GTK_BOX(vbox), print_prefs->highlight_cited);
 
     print_prefs->highlight_phrases =
-        gtk_check_button_new_with_mnemonic(_
-                                               ("Highlight _structured phrases"));
+       gtk_check_button_new_with_mnemonic(_
+                                          ("Highlight _structured phrases"));
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                     (print_prefs->highlight_phrases),
-                                 balsa_app.print_highlight_phrases);
+                                (print_prefs->highlight_phrases),
+                                balsa_app.print_highlight_phrases);
     gtk_box_pack_start(GTK_BOX(vbox), print_prefs->highlight_phrases);
 
     group = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
@@ -631,101 +598,95 @@ message_prefs_widget(GtkPrintOperation *operation,
 
     pg_setup = gtk_print_operation_get_default_page_setup(operation);
     print_prefs->margin_top =
-        add_margin_spinbtn(_("_Top"),
-                           gtk_page_setup_get_top_margin(pg_setup, GTK_UNIT_POINTS),
-                           gtk_page_setup_get_page_height(pg_setup, GTK_UNIT_POINTS),
-                           balsa_app.margin_top,
-                           GTK_GRID(grid), 0);
+       add_margin_spinbtn(_("_Top"),
+                          gtk_page_setup_get_top_margin(pg_setup, GTK_UNIT_POINTS),
+                          gtk_page_setup_get_page_height(pg_setup, GTK_UNIT_POINTS),
+                          balsa_app.margin_top,
+                          GTK_GRID(grid), 0);
     print_prefs->margin_bottom =
-        add_margin_spinbtn(_("_Bottom"),
-                           gtk_page_setup_get_bottom_margin(pg_setup, GTK_UNIT_POINTS),
-                           gtk_page_setup_get_page_height(pg_setup, GTK_UNIT_POINTS),
-                           balsa_app.margin_bottom,
-                           GTK_GRID(grid), 1);
-    g_signal_connect(G_OBJECT(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(print_prefs->
-                                                                             margin_top))),
-                     "value-changed", G_CALLBACK(check_margins),
-                     gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(print_prefs->margin_bottom)));
-    g_signal_connect(G_OBJECT(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(print_prefs->
-                                                                             margin_bottom))),
-                     "value-changed", G_CALLBACK(check_margins),
-                     gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(print_prefs->margin_top)));
+       add_margin_spinbtn(_("_Bottom"),
+                          gtk_page_setup_get_bottom_margin(pg_setup, GTK_UNIT_POINTS),
+                          gtk_page_setup_get_page_height(pg_setup, GTK_UNIT_POINTS), 
+                          balsa_app.margin_bottom,
+                          GTK_GRID(grid), 1);
+    g_signal_connect(G_OBJECT(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(print_prefs->margin_top))),
+                    "value-changed", G_CALLBACK(check_margins),
+                    gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(print_prefs->margin_bottom)));
+    g_signal_connect(G_OBJECT(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(print_prefs->margin_bottom))),
+                    "value-changed", G_CALLBACK(check_margins),
+                    gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(print_prefs->margin_top)));
     print_prefs->margin_left =
-        add_margin_spinbtn(_("_Left"),
-                           gtk_page_setup_get_left_margin(pg_setup, GTK_UNIT_POINTS),
-                           gtk_page_setup_get_page_width(pg_setup, GTK_UNIT_POINTS),
-                           balsa_app.margin_left,
-                           GTK_GRID(grid), 2);
+       add_margin_spinbtn(_("_Left"),
+                          gtk_page_setup_get_left_margin(pg_setup, GTK_UNIT_POINTS),
+                          gtk_page_setup_get_page_width(pg_setup, GTK_UNIT_POINTS), 
+                          balsa_app.margin_left,
+                          GTK_GRID(grid), 2);
     print_prefs->margin_right =
-        add_margin_spinbtn(_("_Right"),
-                           gtk_page_setup_get_right_margin(pg_setup, GTK_UNIT_POINTS),
-                           gtk_page_setup_get_page_width(pg_setup, GTK_UNIT_POINTS),
-                           balsa_app.margin_right,
-                           GTK_GRID(grid), 3);
-    g_signal_connect(G_OBJECT(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(print_prefs->
-                                                                             margin_left))),
-                     "value-changed", G_CALLBACK(check_margins),
-                     gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(print_prefs->margin_right)));
-    g_signal_connect(G_OBJECT(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(print_prefs->
-                                                                             margin_right))),
-                     "value-changed", G_CALLBACK(check_margins),
-                     gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(print_prefs->margin_left)));
+       add_margin_spinbtn(_("_Right"),
+                          gtk_page_setup_get_right_margin(pg_setup, GTK_UNIT_POINTS),
+                          gtk_page_setup_get_page_width(pg_setup, GTK_UNIT_POINTS), 
+                          balsa_app.margin_right,
+                          GTK_GRID(grid), 3);
+    g_signal_connect(G_OBJECT(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(print_prefs->margin_left))),
+                    "value-changed", G_CALLBACK(check_margins),
+                    gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(print_prefs->margin_right)));
+    g_signal_connect(G_OBJECT(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(print_prefs->margin_right))),
+                    "value-changed", G_CALLBACK(check_margins),
+                    gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(print_prefs->margin_left)));
 
     return page;
 }
 
 
 static void
-message_prefs_apply(GtkPrintOperation *operation,
-                    GtkWidget         *widget,
-                    BalsaPrintPrefs   *print_prefs)
+message_prefs_apply(GtkPrintOperation * operation, GtkWidget * widget,
+                   BalsaPrintPrefs * print_prefs)
 {
     g_free(balsa_app.print_header_font);
     balsa_app.print_header_font =
-        gtk_font_chooser_get_font(GTK_FONT_CHOOSER(print_prefs->header_font));
+       gtk_font_chooser_get_font(GTK_FONT_CHOOSER(print_prefs->header_font));
     g_free(balsa_app.print_body_font);
     balsa_app.print_body_font =
-        gtk_font_chooser_get_font(GTK_FONT_CHOOSER(print_prefs->body_font));
+       gtk_font_chooser_get_font(GTK_FONT_CHOOSER(print_prefs->body_font));
     g_free(balsa_app.print_footer_font);
     balsa_app.print_footer_font =
-        gtk_font_chooser_get_font(GTK_FONT_CHOOSER(print_prefs->footer_font));
+       gtk_font_chooser_get_font(GTK_FONT_CHOOSER(print_prefs->footer_font));
     balsa_app.print_highlight_cited =
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (print_prefs->highlight_cited));
+       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
+                                     (print_prefs->highlight_cited));
     balsa_app.print_highlight_phrases =
-        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (print_prefs->highlight_phrases));
+       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
+                                     (print_prefs->highlight_phrases));
 
     balsa_app.margin_top =
-        gtk_spin_button_get_value(GTK_SPIN_BUTTON(print_prefs->margin_top)) * 72.0;
+       gtk_spin_button_get_value(GTK_SPIN_BUTTON(print_prefs->margin_top)) * 72.0;
     balsa_app.margin_bottom =
-        gtk_spin_button_get_value(GTK_SPIN_BUTTON(print_prefs->margin_bottom)) * 72.0;
+       gtk_spin_button_get_value(GTK_SPIN_BUTTON(print_prefs->margin_bottom)) * 72.0;
     balsa_app.margin_left =
-        gtk_spin_button_get_value(GTK_SPIN_BUTTON(print_prefs->margin_left)) * 72.0;
+       gtk_spin_button_get_value(GTK_SPIN_BUTTON(print_prefs->margin_left)) * 72.0;
     balsa_app.margin_right =
-        gtk_spin_button_get_value(GTK_SPIN_BUTTON(print_prefs->margin_right)) * 72.0;
+       gtk_spin_button_get_value(GTK_SPIN_BUTTON(print_prefs->margin_right)) * 72.0;
     if (get_default_user_units() != GTK_UNIT_INCH) {
-        /* adjust for mm */
-        balsa_app.margin_top /= 25.4;
-        balsa_app.margin_bottom /= 25.4;
-        balsa_app.margin_left /= 25.4;
-        balsa_app.margin_right /= 25.4;
+       /* adjust for mm */
+       balsa_app.margin_top /= 25.4;
+       balsa_app.margin_bottom /= 25.4;
+       balsa_app.margin_left /= 25.4;
+       balsa_app.margin_right /= 25.4;
     }
 }
 
 
 void
-message_print_page_setup(GtkWindow *parent)
+message_print_page_setup(GtkWindow * parent)
 {
     GtkPageSetup *new_page_setup;
 
-    if (!balsa_app.print_settings) {
-        balsa_app.print_settings = gtk_print_settings_new();
-    }
+    if (!balsa_app.print_settings)
+       balsa_app.print_settings = gtk_print_settings_new();
 
     new_page_setup =
-        gtk_print_run_page_setup_dialog(parent, balsa_app.page_setup,
-                                        balsa_app.print_settings);
+       gtk_print_run_page_setup_dialog(parent, balsa_app.page_setup,
+                                       balsa_app.print_settings);
 
     g_set_object(&balsa_app.page_setup, new_page_setup);
     g_object_unref(new_page_setup);
@@ -733,8 +694,7 @@ message_print_page_setup(GtkWindow *parent)
 
 
 void
-message_print(LibBalsaMessage *msg,
-              GtkWindow       *parent)
+message_print(LibBalsaMessage * msg, GtkWindow * parent)
 {
     GtkPrintOperation *print;
     GtkPrintOperationResult res;
@@ -751,14 +711,12 @@ message_print(LibBalsaMessage *msg,
     gtk_print_operation_set_unit(print, GTK_UNIT_POINTS);
     gtk_print_operation_set_use_full_page(print, FALSE);
 
-    if (balsa_app.print_settings != NULL) {
-        gtk_print_operation_set_print_settings(print,
-                                               balsa_app.print_settings);
-    }
-    if (balsa_app.page_setup != NULL) {
-        gtk_print_operation_set_default_page_setup(print,
-                                                   balsa_app.page_setup);
-    }
+    if (balsa_app.print_settings != NULL)
+       gtk_print_operation_set_print_settings(print,
+                                              balsa_app.print_settings);
+    if (balsa_app.page_setup != NULL)
+       gtk_print_operation_set_default_page_setup(print,
+                                                  balsa_app.page_setup);
 
     /* create a print context */
     print_data = g_new0(BalsaPrintData, 1);
@@ -767,26 +725,24 @@ message_print(LibBalsaMessage *msg,
     g_signal_connect(print, "begin_print", G_CALLBACK(begin_print), print_data);
     g_signal_connect(print, "draw_page", G_CALLBACK(draw_page), print_data);
     g_signal_connect(print, "create-custom-widget",
-                     G_CALLBACK(message_prefs_widget), &print_prefs);
+                    G_CALLBACK(message_prefs_widget), &print_prefs);
     g_signal_connect(print, "custom-widget-apply",
-                     G_CALLBACK(message_prefs_apply), &print_prefs);
+                    G_CALLBACK(message_prefs_apply), &print_prefs);
 
     res =
-        gtk_print_operation_run(print,
-                                GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
-                                parent, &err);
+       gtk_print_operation_run(print,
+                               GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
+                               parent, &err);
 
     if (res == GTK_PRINT_OPERATION_RESULT_APPLY) {
         g_set_object(&balsa_app.print_settings, gtk_print_operation_get_print_settings(print));
-    } else if (res == GTK_PRINT_OPERATION_RESULT_ERROR) {
-        balsa_information(LIBBALSA_INFORMATION_ERROR,
-                          _("Error printing message: %s"), err->message);
-    }
+    } else if (res == GTK_PRINT_OPERATION_RESULT_ERROR)
+       balsa_information(LIBBALSA_INFORMATION_ERROR,
+                         _("Error printing message: %s"), err->message);
 
     /* clean up */
-    if (err) {
-        g_error_free(err);
-    }
+    if (err)
+       g_error_free(err);
     g_list_free_full(print_data->print_parts, g_object_unref);
     g_free(print_data->footer);
     g_free(print_data);
diff --git a/src/print.h b/src/print.h
index b1ea06b..38a55df 100644
--- a/src/print.h
+++ b/src/print.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -21,15 +21,14 @@
 #define __PRINT_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 G_BEGIN_DECLS
 
-void message_print(LibBalsaMessage *msg,
-                   GtkWindow       *parent);
-void message_print_page_setup(GtkWindow *parent);
+    void message_print(LibBalsaMessage * msg, GtkWindow * parent);
+    void message_print_page_setup(GtkWindow * parent);
 
 G_END_DECLS
 
-#endif                          /* __PRINT_H__ */
+#endif                         /* __PRINT_H__ */
diff --git a/src/quote-color.c b/src/quote-color.c
index 3b1c0a4..eb908c5 100644
--- a/src/quote-color.c
+++ b/src/quote-color.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "quote-color.h"
 
@@ -30,25 +30,23 @@
  *
  * Returns how deep a quotation is nested in str.  Uses quoted regex
  * from balsa_app.quote_regex, which can be set by the user.
- *
+ * 
  * Input:
  *   str  - string to match the regexp.
  *   preg - the regular expression that matches the prefix. see regex(7).
- *
+ * 
  * Output:
- *   an integer saying how many levels deep.
+ *   an integer saying how many levels deep.  
  * */
 guint
-is_a_quote(const gchar *str,
-           GRegex      *rex)
+is_a_quote(const gchar * str, GRegex * rex)
 {
     guint cnt;
 
     g_return_val_if_fail(rex != NULL, 0);
 
-    if (str == NULL) {
-        return 0;
-    }
+    if (str == NULL)
+       return 0;
 
     libbalsa_match_regex(str, rex, &cnt, NULL);
 
diff --git a/src/quote-color.h b/src/quote-color.h
index cc526c5..7c13064 100644
--- a/src/quote-color.h
+++ b/src/quote-color.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -21,16 +21,15 @@
 #define __BALSA_QUOTECOLOR_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include <gtk/gtk.h>
 
 G_BEGIN_DECLS
 
-extern guint is_a_quote(const gchar *,
-                        GRegex *rex);
+    extern guint is_a_quote(const gchar *, GRegex * rex);
 
 G_END_DECLS
 
-#endif                          /* __BALSA_QUOTECOLOR_H__ */
+#endif                         /* __BALSA_QUOTECOLOR_H__ */
diff --git a/src/save-restore.c b/src/save-restore.c
index e10b947..d06b9f8 100644
--- a/src/save-restore.c
+++ b/src/save-restore.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "save-restore.h"
 
@@ -49,19 +49,16 @@
 #define SMTP_SERVER_SECTION_PREFIX "smtp-server-"
 
 static gint config_global_load(void);
-static gint config_folder_init(const gchar *group);
-static gint config_mailbox_init(const gchar *group);
-static gchar *config_get_unused_group(const gchar *group);
-
-static void save_color(const gchar *key,
-                       GdkRGBA     *rgba);
-static void load_color(const gchar *name,
-                       const gchar *def_val,
-                       GdkRGBA     *rgba);
-static void save_mru(GList       *mru,
-                     const gchar *group);
-static void load_mru(GList      **mru,
-                     const gchar *group);
+static gint config_folder_init(const gchar * group);
+static gint config_mailbox_init(const gchar * group);
+static gchar *config_get_unused_group(const gchar * group);
+
+static void save_color(const gchar * key, GdkRGBA * rgba);
+static void load_color(const gchar * name,
+                       const gchar * def_val,
+                       GdkRGBA     * rgba);
+static void save_mru(GList  *mru, const gchar * group);
+static void load_mru(GList **mru, const gchar * group);
 
 static void config_address_books_save(void);
 static void config_identities_load(void);
@@ -78,29 +75,24 @@ static void config_filters_load(void);
     g_strdup(LIBBALSA_MAILBOX(mbox)->config_prefix) : \
     config_get_unused_group(MAILBOX_SECTION_PREFIX)
 
-gint
-config_load(void)
+gint config_load(void)
 {
     return config_global_load();
 }
 
-
 /* This function initializes all the mailboxes internally, going through
    the list of all the mailboxes in the configuration file one by one. */
 
 static gboolean
-config_load_section(const gchar *key,
-                    const gchar *value,
-                    gpointer     data)
+config_load_section(const gchar * key, const gchar * value, gpointer data)
 {
-    gint (*cb) (const gchar *) = data;
+    gint(*cb) (const gchar *) = data;
 
     cb(key);                    /* FIXME do something about error?? */
 
     return FALSE;
 }
 
-
 void
 config_load_sections(void)
 {
@@ -113,20 +105,17 @@ config_load_sections(void)
                                 config_folder_init);
 }
 
-
 static gint
-d_get_gint(const gchar *key,
-           gint         def_val)
+d_get_gint(const gchar * key, gint def_val)
 {
     gint def;
     gint res = libbalsa_conf_get_int_with_default(key, &def);
     return def ? def_val : res;
 }
 
-
 /* save/load_toolbars:
    handle customized toolbars for main/message preview and compose windows.
- */
+*/
 
 static void
 save_toolbars(void)
@@ -134,11 +123,10 @@ save_toolbars(void)
     libbalsa_conf_remove_group("Toolbars");
     libbalsa_conf_push_group("Toolbars");
     libbalsa_conf_set_int("WrapButtonText",
-                          balsa_app.toolbar_wrap_button_text);
+                         balsa_app.toolbar_wrap_button_text);
     libbalsa_conf_pop_group();
 }
 
-
 static void
 load_toolbars(void)
 {
@@ -147,14 +135,13 @@ load_toolbars(void)
     libbalsa_conf_pop_group();
 }
 
-
 /* config_mailbox_set_as_special:
    allows to set given mailboxe as one of the special mailboxes
    PS: I am not sure if I should add outbox to the list.
    specialNames must be in sync with the specialType definition.
 
    WARNING: may destroy mailbox.
- */
+*/
 #define INBOX_NAME   "Inbox"
 #define SENTBOX_NAME "Sentbox"
 #define DRAFTS_NAME  "Draftbox"
@@ -162,26 +149,22 @@ load_toolbars(void)
 #define TRASH_NAME   "Trash"
 
 static void
-sr_special_notify(gpointer data,
-                  GObject *mailbox)
+sr_special_notify(gpointer data, GObject * mailbox)
 {
     LibBalsaMailbox **special = data;
 
-    if ((special == &balsa_app.trash) && !balsa_app.mblist_tree_store
-        && balsa_app.empty_trash_on_exit) {
+    if (special == &balsa_app.trash && !balsa_app.mblist_tree_store
+        && balsa_app.empty_trash_on_exit)
         empty_trash(balsa_app.main_window);
-    }
 
     *special = NULL;
 }
 
-
 static gchar *specialNames[] = {
     INBOX_NAME, SENTBOX_NAME, TRASH_NAME, DRAFTS_NAME, OUTBOX_NAME
 };
 void
-config_mailbox_set_as_special(LibBalsaMailbox *mailbox,
-                              specialType      which)
+config_mailbox_set_as_special(LibBalsaMailbox * mailbox, specialType which)
 {
     LibBalsaMailbox **special, *old_mailbox;
     BalsaMailboxNode *mbnode;
@@ -190,23 +173,19 @@ config_mailbox_set_as_special(LibBalsaMailbox *mailbox,
 
     switch (which) {
     case SPECIAL_INBOX:
-        special = &balsa_app.inbox;
-        break;
-
+       special = &balsa_app.inbox;
+       break;
     case SPECIAL_SENT:
-        special = &balsa_app.sentbox;
-        break;
-
+       special = &balsa_app.sentbox;
+       break;
     case SPECIAL_TRASH:
-        special = &balsa_app.trash;
-        break;
-
+       special = &balsa_app.trash;
+       break;
     case SPECIAL_DRAFT:
-        special = &balsa_app.draftbox;
-        break;
-
+       special = &balsa_app.draftbox;
+       break;
     default:
-        return;
+       return;
     }
     if ((old_mailbox = *special)) {
         *special = NULL;
@@ -218,17 +197,16 @@ config_mailbox_set_as_special(LibBalsaMailbox *mailbox,
 
         if (!LIBBALSA_IS_MAILBOX_LOCAL(old_mailbox)
             || !libbalsa_path_is_below_dir(libbalsa_mailbox_local_get_path
-                                               (old_mailbox),
-                                           balsa_app.local_mail_directory)) {
+                                           (old_mailbox),
+                                           balsa_app.local_mail_directory))
             config_mailbox_add(old_mailbox, NULL);
-        }
 
         g_object_weak_unref(G_OBJECT(old_mailbox),
                             (GWeakNotify) sr_special_notify, special);
 
         mbnode = balsa_find_mailbox(old_mailbox);
-        balsa_mblist_mailbox_node_redraw(mbnode);
-        g_object_unref(mbnode);
+       balsa_mblist_mailbox_node_redraw(mbnode);
+       g_object_unref(mbnode);
     }
     config_mailbox_delete(mailbox);
     g_free(mailbox->name);
@@ -243,22 +221,17 @@ config_mailbox_set_as_special(LibBalsaMailbox *mailbox,
     balsa_mblist_mailbox_node_redraw(mbnode);
     g_object_unref(mbnode);
 
-    switch (which) {
-    case SPECIAL_SENT:
-        balsa_mblist_mru_add(&balsa_app.fcc_mru, mailbox->url);
-        break;
-
+    switch(which) {
+    case SPECIAL_SENT: 
+       balsa_mblist_mru_add(&balsa_app.fcc_mru, mailbox->url); break;
     case SPECIAL_TRASH:
-        libbalsa_filters_set_trash(balsa_app.trash);
-        break;
-
+        libbalsa_filters_set_trash(balsa_app.trash); break;
     default: break;
     }
 }
 
-
 void
-config_address_book_save(LibBalsaAddressBook *ab)
+config_address_book_save(LibBalsaAddressBook * ab)
 {
     const gchar *config_prefix;
     gchar *group;
@@ -275,37 +248,32 @@ config_address_book_save(LibBalsaAddressBook *ab)
     libbalsa_conf_queue_sync();
 }
 
-
 void
-config_address_book_delete(LibBalsaAddressBook *ab)
+config_address_book_delete(LibBalsaAddressBook * ab)
 {
     const gchar *config_prefix;
 
     config_prefix = libbalsa_address_book_get_config_prefix(ab);
     if (config_prefix != NULL) {
-        libbalsa_conf_remove_group(config_prefix);
-        libbalsa_conf_private_remove_group(config_prefix);
-        libbalsa_conf_queue_sync();
+       libbalsa_conf_remove_group(config_prefix);
+       libbalsa_conf_private_remove_group(config_prefix);
+       libbalsa_conf_queue_sync();
     }
 }
 
-
 /* config_mailbox_add:
    adds the specifed mailbox to the configuration. If the mailbox does
    not have the unique pkey assigned, find one.
- */
-gint
-config_mailbox_add(LibBalsaMailbox *mailbox,
-                   const char      *key_arg)
+*/
+gint config_mailbox_add(LibBalsaMailbox * mailbox, const char *key_arg)
 {
     gchar *tmp;
     g_return_val_if_fail(mailbox, FALSE);
 
-    if (key_arg == NULL) {
-        tmp = mailbox_section_path(mailbox);
-    } else {
-        tmp = g_strdup_printf(MAILBOX_SECTION_PREFIX "%s", key_arg);
-    }
+    if (key_arg == NULL)
+       tmp = mailbox_section_path(mailbox);
+    else
+       tmp = g_strdup_printf(MAILBOX_SECTION_PREFIX "%s", key_arg);
 
     libbalsa_conf_remove_group(tmp);
     libbalsa_conf_push_group(tmp);
@@ -315,25 +283,21 @@ config_mailbox_add(LibBalsaMailbox *mailbox,
 
     libbalsa_conf_queue_sync();
     return TRUE;
-}                               /* config_mailbox_add */
-
+}                              /* config_mailbox_add */
 
 /* config_folder_add:
    adds the specifed folder to the configuration. If the folder does
    not have the unique pkey assigned, find one.
- */
-gint
-config_folder_add(BalsaMailboxNode *mbnode,
-                  const char       *key_arg)
+*/
+gint config_folder_add(BalsaMailboxNode * mbnode, const char *key_arg)
 {
     gchar *tmp;
     g_return_val_if_fail(mbnode, FALSE);
 
-    if (key_arg == NULL) {
-        tmp = folder_section_path(mbnode);
-    } else {
-        tmp = g_strdup_printf(FOLDER_SECTION_PREFIX "%s", key_arg);
-    }
+    if (key_arg == NULL)
+       tmp = folder_section_path(mbnode);
+    else
+       tmp = g_strdup_printf(FOLDER_SECTION_PREFIX "%s", key_arg);
 
     libbalsa_conf_push_group(tmp);
     balsa_mailbox_node_save_config(mbnode, tmp);
@@ -342,14 +306,12 @@ config_folder_add(BalsaMailboxNode *mbnode,
 
     libbalsa_conf_queue_sync();
     return TRUE;
-}                               /* config_mailbox_add */
-
+}                              /* config_mailbox_add */
 
 /* removes from the configuration only */
-gint
-config_mailbox_delete(const LibBalsaMailbox *mailbox)
+gint config_mailbox_delete(const LibBalsaMailbox * mailbox)
 {
-    gchar *tmp;                 /* the key in the mailbox section name */
+    gchar *tmp;                        /* the key in the mailbox section name */
     gint res;
     tmp = mailbox_section_path(mailbox);
     res = libbalsa_conf_has_group(tmp);
@@ -357,13 +319,12 @@ config_mailbox_delete(const LibBalsaMailbox *mailbox)
     libbalsa_conf_queue_sync();
     g_free(tmp);
     return res;
-}                               /* config_mailbox_delete */
-
+}                              /* config_mailbox_delete */
 
 gint
-config_folder_delete(const BalsaMailboxNode *mbnode)
+config_folder_delete(const BalsaMailboxNode * mbnode)
 {
-    gchar *tmp;                 /* the key in the mailbox section name */
+    gchar *tmp;                        /* the key in the mailbox section name */
     gint res;
     tmp = folder_section_path(mbnode);
     res = libbalsa_conf_has_group(tmp);
@@ -371,14 +332,12 @@ config_folder_delete(const BalsaMailboxNode *mbnode)
     libbalsa_conf_queue_sync();
     g_free(tmp);
     return res;
-}                               /* config_folder_delete */
-
+}                              /* config_folder_delete */
 
 /* Update the configuration information for the specified mailbox. */
-gint
-config_mailbox_update(LibBalsaMailbox *mailbox)
+gint config_mailbox_update(LibBalsaMailbox * mailbox)
 {
-    gchar *key;                 /* the key in the mailbox section name */
+    gchar *key;                        /* the key in the mailbox section name */
     gint res;
 
     key = mailbox_section_path(mailbox);
@@ -391,14 +350,12 @@ config_mailbox_update(LibBalsaMailbox *mailbox)
     libbalsa_conf_pop_group();
     libbalsa_conf_queue_sync();
     return res;
-}                               /* config_mailbox_update */
-
+}                              /* config_mailbox_update */
 
 /* Update the configuration information for the specified folder. */
-gint
-config_folder_update(BalsaMailboxNode *mbnode)
+gint config_folder_update(BalsaMailboxNode * mbnode)
 {
-    gchar *key;                 /* the key in the mailbox section name */
+    gchar *key;                        /* the key in the mailbox section name */
     gint res;
 
     key = folder_section_path(mbnode);
@@ -411,13 +368,13 @@ config_folder_update(BalsaMailboxNode *mbnode)
     libbalsa_conf_pop_group();
     libbalsa_conf_queue_sync();
     return res;
-}                               /* config_folder_update */
+}                              /* config_folder_update */
 
 
 /* Initialize the specified mailbox, creating the internal data
    structures which represent the mailbox. */
 static gint
-config_mailbox_init(const gchar *prefix)
+config_mailbox_init(const gchar * prefix)
 {
     LibBalsaMailbox *mailbox;
     const gchar *key = prefix + strlen(MAILBOX_SECTION_PREFIX);
@@ -425,90 +382,85 @@ config_mailbox_init(const gchar *prefix)
     g_return_val_if_fail(prefix != NULL, FALSE);
 
     mailbox = libbalsa_mailbox_new_from_config(prefix);
-    if (mailbox == NULL) {
-        return FALSE;
-    }
+    if (mailbox == NULL)
+       return FALSE;
     if (LIBBALSA_IS_MAILBOX_REMOTE(mailbox)) {
-        LibBalsaServer *server = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
+       LibBalsaServer *server = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
         libbalsa_server_connect_signals(server,
                                         G_CALLBACK(ask_password), mailbox);
-        g_signal_connect_swapped(server, "config-changed",
+       g_signal_connect_swapped(server, "config-changed",
                                  G_CALLBACK(config_mailbox_update),
-                                 mailbox);
+                                mailbox);
     }
 
     if (LIBBALSA_IS_MAILBOX_POP3(mailbox)) {
-        balsa_app.inbox_input =
+       balsa_app.inbox_input =
             g_list_prepend(balsa_app.inbox_input,
                            balsa_mailbox_node_new_from_mailbox(mailbox));
     } else {
         LibBalsaMailbox **special = NULL;
-        BalsaMailboxNode *mbnode;
+       BalsaMailboxNode *mbnode;
 
-        mbnode = balsa_mailbox_node_new_from_mailbox(mailbox);
-        if (strcmp(INBOX_NAME, key) == 0) {
-            special = &balsa_app.inbox;
-        } else if (strcmp(OUTBOX_NAME, key) == 0) {
-            special = &balsa_app.outbox;
+       mbnode = balsa_mailbox_node_new_from_mailbox(mailbox);
+       if (strcmp(INBOX_NAME, key) == 0)
+           special = &balsa_app.inbox;
+       else if (strcmp(OUTBOX_NAME, key) == 0) {
+           special = &balsa_app.outbox;
             mailbox->no_reassemble = TRUE;
-        } else if (strcmp(SENTBOX_NAME, key) == 0) {
-            special = &balsa_app.sentbox;
-        } else if (strcmp(DRAFTS_NAME, key) == 0) {
-            special = &balsa_app.draftbox;
-        } else if (strcmp(TRASH_NAME, key) == 0) {
-            special = &balsa_app.trash;
+        } else if (strcmp(SENTBOX_NAME, key) == 0)
+           special = &balsa_app.sentbox;
+       else if (strcmp(DRAFTS_NAME, key) == 0)
+           special = &balsa_app.draftbox;
+       else if (strcmp(TRASH_NAME, key) == 0) {
+           special = &balsa_app.trash;
             libbalsa_filters_set_trash(mailbox);
-        }
+       }
 
-        if (special) {
-            /* Designate as special before appending to the mblist, so
-             * that view->show gets set correctly for sentbox, draftbox,
-             * and outbox, and view->subscribe gets set correctly for
+       if (special) {
+           /* Designate as special before appending to the mblist, so
+            * that view->show gets set correctly for sentbox, draftbox,
+            * and outbox, and view->subscribe gets set correctly for
              * trashbox. */
-            *special = mailbox;
+           *special = mailbox;
             g_object_weak_ref(G_OBJECT(mailbox),
                               (GWeakNotify) sr_special_notify, special);
-        }
+       }
 
         balsa_mblist_mailbox_node_append(NULL, mbnode);
     }
     return TRUE;
-}                               /* config_mailbox_init */
+}                              /* config_mailbox_init */
 
 
 /* Initialize the specified folder, creating the internal data
    structures which represent the folder. */
 static gint
-config_folder_init(const gchar *prefix)
+config_folder_init(const gchar * prefix)
 {
     BalsaMailboxNode *folder;
 
     g_return_val_if_fail(prefix != NULL, FALSE);
 
-    if ((folder = balsa_mailbox_node_new_from_config(prefix))) {
-        g_signal_connect_swapped(folder->server, "config-changed",
+    if( (folder = balsa_mailbox_node_new_from_config(prefix)) ) {
+       g_signal_connect_swapped(folder->server, "config-changed",
                                  G_CALLBACK(config_folder_update),
-                                 folder);
-        balsa_mblist_mailbox_node_append(NULL, folder);
+                                folder);
+       balsa_mblist_mailbox_node_append(NULL, folder);
     }
 
     return folder != NULL;
-}                               /* config_folder_init */
-
+}                              /* config_folder_init */
 
 /* Load Balsa's global settings */
 static gboolean
-config_warning_idle(const gchar *text)
+config_warning_idle(const gchar * text)
 {
     balsa_information(LIBBALSA_INFORMATION_WARNING, "%s", text);
     return FALSE;
 }
 
-
 static gboolean
-config_load_smtp_server(const gchar *key,
-                        const gchar *value,
-                        gpointer     data)
+config_load_smtp_server(const gchar * key, const gchar * value, gpointer data)
 {
     GSList **smtp_servers = data;
     LibBalsaSmtpServer *smtp_server;
@@ -516,25 +468,21 @@ config_load_smtp_server(const gchar *key,
     libbalsa_conf_push_group(key);
     smtp_server = libbalsa_smtp_server_new_from_config(value);
     libbalsa_server_connect_signals(LIBBALSA_SERVER(smtp_server),
-                                    G_CALLBACK(ask_password), NULL);
+                                   G_CALLBACK(ask_password), NULL);
     libbalsa_conf_pop_group();
     libbalsa_smtp_server_add_to_list(smtp_server, smtp_servers);
 
     return FALSE;
 }
 
-
 static gboolean
-load_gtk_print_setting(const gchar *key,
-                       const gchar *value,
-                       gpointer     data)
+load_gtk_print_setting(const gchar * key, const gchar * value, gpointer data)
 {
     g_return_val_if_fail(data != NULL, TRUE);
     gtk_print_settings_set((GtkPrintSettings *)data, key, value);
     return FALSE;
 }
 
-
 static GtkPageSetup *
 restore_gtk_page_setup()
 {
@@ -554,48 +502,46 @@ restore_gtk_page_setup()
     display_name = libbalsa_conf_get_string("DisplayName");
     page_setup = gtk_page_setup_new();
 
-    if (ppd_name && *ppd_name) {
-        paper_size = gtk_paper_size_new_from_ppd(ppd_name, display_name,
-                                                 width, height);
-    } else if (name && *name) {
-        paper_size = gtk_paper_size_new_custom(name, display_name,
-                                               width, height, GTK_UNIT_MM);
-    }
+    if (ppd_name && *ppd_name)
+       paper_size = gtk_paper_size_new_from_ppd(ppd_name, display_name,
+                                                width, height);
+    else if (name && *name)
+       paper_size = gtk_paper_size_new_custom(name, display_name,
+                                              width, height, GTK_UNIT_MM);
 
     /* set defaults if no info is available */
     if (!paper_size) {
-        paper_size = gtk_paper_size_new(GTK_PAPER_NAME_A4);
-        gtk_page_setup_set_paper_size_and_default_margins(page_setup,
-                                                          paper_size);
+       paper_size = gtk_paper_size_new(GTK_PAPER_NAME_A4);
+       gtk_page_setup_set_paper_size_and_default_margins(page_setup,
+                                                         paper_size);
     } else {
-        gtk_page_setup_set_paper_size(page_setup, paper_size);
-
-        gtk_page_setup_set_top_margin(page_setup,
-                                      libbalsa_conf_get_double("MarginTop"),
-                                      GTK_UNIT_MM);
-        gtk_page_setup_set_bottom_margin(page_setup,
-                                         libbalsa_conf_get_double("MarginBottom"),
-                                         GTK_UNIT_MM);
-        gtk_page_setup_set_left_margin(page_setup,
-                                       libbalsa_conf_get_double("MarginLeft"),
-                                       GTK_UNIT_MM);
-        gtk_page_setup_set_right_margin(page_setup,
-                                        libbalsa_conf_get_double("MarginRight"),
-                                        GTK_UNIT_MM);
-        gtk_page_setup_set_orientation(page_setup,
-                                       (GtkPageOrientation)
-                                       libbalsa_conf_get_int("Orientation"));
-    }
-
+       gtk_page_setup_set_paper_size(page_setup, paper_size);
+
+       gtk_page_setup_set_top_margin(page_setup,
+                                     libbalsa_conf_get_double("MarginTop"),
+                                     GTK_UNIT_MM);
+       gtk_page_setup_set_bottom_margin(page_setup,
+                                        libbalsa_conf_get_double("MarginBottom"),
+                                        GTK_UNIT_MM);
+       gtk_page_setup_set_left_margin(page_setup,
+                                      libbalsa_conf_get_double("MarginLeft"),
+                                      GTK_UNIT_MM);
+       gtk_page_setup_set_right_margin(page_setup,
+                                       libbalsa_conf_get_double("MarginRight"),
+                                       GTK_UNIT_MM);
+       gtk_page_setup_set_orientation(page_setup,
+                                      (GtkPageOrientation)
+                                      libbalsa_conf_get_int("Orientation"));
+    }
+    
     gtk_paper_size_free(paper_size);
     g_free(ppd_name);
     g_free(name);
     g_free(display_name);
-
+    
     return page_setup;
 }
 
-
 static gint
 config_global_load(void)
 {
@@ -607,32 +553,32 @@ config_global_load(void)
 
     /* Load SMTP servers before identities. */
     libbalsa_conf_foreach_group(SMTP_SERVER_SECTION_PREFIX,
-                                config_load_smtp_server,
-                                &balsa_app.smtp_servers);
+                               config_load_smtp_server,
+                               &balsa_app.smtp_servers);
 
     /* We must load filters before mailboxes, because they refer to the filters list */
     config_filters_load();
-    if (filter_errno != FILTER_NOERR) {
-        filter_perror(_("Error during filters loading: "));
-        libbalsa_information(LIBBALSA_INFORMATION_ERROR,
-                             _("Error during filters loading: %s\n"
-                               "Filters may not be correct."),
-                             filter_strerror(filter_errno));
+    if (filter_errno!=FILTER_NOERR) {
+       filter_perror(_("Error during filters loading: "));
+       libbalsa_information(LIBBALSA_INFORMATION_ERROR,
+                            _("Error during filters loading: %s\n"
+                              "Filters may not be correct."),
+                            filter_strerror(filter_errno));
     }
 
     /* Section for the balsa_information() settings... */
     libbalsa_conf_push_group("InformationMessages");
 
     balsa_app.information_message =
-        d_get_gint("ShowInformationMessages", BALSA_INFORMATION_SHOW_BAR);
+       d_get_gint("ShowInformationMessages", BALSA_INFORMATION_SHOW_BAR);
     balsa_app.warning_message =
-        d_get_gint("ShowWarningMessages", BALSA_INFORMATION_SHOW_LIST);
+       d_get_gint("ShowWarningMessages", BALSA_INFORMATION_SHOW_LIST);
     balsa_app.error_message =
-        d_get_gint("ShowErrorMessages", BALSA_INFORMATION_SHOW_DIALOG);
+       d_get_gint("ShowErrorMessages", BALSA_INFORMATION_SHOW_DIALOG);
     balsa_app.debug_message =
-        d_get_gint("ShowDebugMessages", BALSA_INFORMATION_SHOW_NONE);
-    balsa_app.fatal_message =
-        d_get_gint("ShowFatalMessages", BALSA_INFORMATION_SHOW_DIALOG);
+       d_get_gint("ShowDebugMessages", BALSA_INFORMATION_SHOW_NONE);
+    balsa_app.fatal_message = 
+       d_get_gint("ShowFatalMessages", BALSA_INFORMATION_SHOW_DIALOG);
 
     libbalsa_conf_pop_group();
 
@@ -641,26 +587,26 @@ config_global_load(void)
 
     /* ... column width settings */
     balsa_app.mblist_name_width =
-        d_get_gint("MailboxListNameWidth", MBNAME_DEFAULT_WIDTH);
+       d_get_gint("MailboxListNameWidth", MBNAME_DEFAULT_WIDTH);
     balsa_app.mblist_newmsg_width =
-        d_get_gint("MailboxListNewMsgWidth", NEWMSGCOUNT_DEFAULT_WIDTH);
+       d_get_gint("MailboxListNewMsgWidth", NEWMSGCOUNT_DEFAULT_WIDTH);
     balsa_app.mblist_totalmsg_width =
-        d_get_gint("MailboxListTotalMsgWidth",
-                   TOTALMSGCOUNT_DEFAULT_WIDTH);
+       d_get_gint("MailboxListTotalMsgWidth",
+                  TOTALMSGCOUNT_DEFAULT_WIDTH);
     balsa_app.index_num_width =
-        d_get_gint("IndexNumWidth", NUM_DEFAULT_WIDTH);
+       d_get_gint("IndexNumWidth", NUM_DEFAULT_WIDTH);
     balsa_app.index_status_width =
-        d_get_gint("IndexStatusWidth", STATUS_DEFAULT_WIDTH);
+       d_get_gint("IndexStatusWidth", STATUS_DEFAULT_WIDTH);
     balsa_app.index_attachment_width =
-        d_get_gint("IndexAttachmentWidth", ATTACHMENT_DEFAULT_WIDTH);
+       d_get_gint("IndexAttachmentWidth", ATTACHMENT_DEFAULT_WIDTH);
     balsa_app.index_from_width =
-        d_get_gint("IndexFromWidth", FROM_DEFAULT_WIDTH);
+       d_get_gint("IndexFromWidth", FROM_DEFAULT_WIDTH);
     balsa_app.index_subject_width =
-        d_get_gint("IndexSubjectWidth", SUBJECT_DEFAULT_WIDTH);
+       d_get_gint("IndexSubjectWidth", SUBJECT_DEFAULT_WIDTH);
     balsa_app.index_date_width =
-        d_get_gint("IndexDateWidth", DATE_DEFAULT_WIDTH);
+       d_get_gint("IndexDateWidth", DATE_DEFAULT_WIDTH);
     balsa_app.index_size_width =
-        d_get_gint("IndexSizeWidth", SIZE_DEFAULT_WIDTH);
+       d_get_gint("IndexSizeWidth", SIZE_DEFAULT_WIDTH);
 
     /* ... window sizes */
     balsa_app.mw_width = libbalsa_conf_get_int("MainWindowWidth=640");
@@ -681,15 +627,13 @@ config_global_load(void)
     balsa_app.message_window_maximized =
         libbalsa_conf_get_bool("MessageWindowMaximized=false");
     /* FIXME: PKGW: why comment this out? Breaks my Transfer context menu. */
-    if (balsa_app.mblist_width < 100) {
-        balsa_app.mblist_width = 170;
-    }
+    if (balsa_app.mblist_width < 100)
+       balsa_app.mblist_width = 170;
 
     balsa_app.notebook_height = libbalsa_conf_get_int("NotebookHeight=170");
     /*FIXME: Why is this here?? */
-    if (balsa_app.notebook_height < 100) {
-        balsa_app.notebook_height = 200;
-    }
+    if (balsa_app.notebook_height < 100)
+       balsa_app.notebook_height = 200;
 
     libbalsa_conf_pop_group();
 
@@ -699,7 +643,7 @@ config_global_load(void)
     /* ... How we format dates */
     g_free(balsa_app.date_string);
     balsa_app.date_string =
-        libbalsa_conf_get_string("DateFormat=" DEFAULT_DATE_FORMAT);
+       libbalsa_conf_get_string("DateFormat=" DEFAULT_DATE_FORMAT);
 
     /* ... Headers to show */
     balsa_app.shown_headers = d_get_gint("ShownHeaders", HEADERS_SELECTED);
@@ -718,14 +662,12 @@ config_global_load(void)
     {                             /* scope */
         guint type =
             libbalsa_conf_get_int_with_default("SortField", &def_used);
-        if (!def_used) {
+        if (!def_used)
             libbalsa_mailbox_set_sort_field(NULL, type);
-        }
         type =
             libbalsa_conf_get_int_with_default("ThreadingType", &def_used);
-        if (!def_used) {
+        if (!def_used)
             libbalsa_mailbox_set_threading_type(NULL, type);
-        }
     }
 
     /* ... Quote colouring */
@@ -733,23 +675,20 @@ config_global_load(void)
         libbalsa_conf_get_bool_with_default("MarkQuoted=true", &def_used);
     g_free(balsa_app.quote_regex);
     balsa_app.quote_regex =
-        libbalsa_conf_get_string("QuoteRegex=" DEFAULT_QUOTE_REGEX);
+       libbalsa_conf_get_string("QuoteRegex=" DEFAULT_QUOTE_REGEX);
 
     /* Obsolete. */
     libbalsa_conf_get_bool_with_default("RecognizeRFC2646FormatFlowed=true",
-                                        &def_used);
-    if (!def_used) {
+                                       &def_used);
+    if (!def_used)
         g_idle_add((GSourceFunc) config_warning_idle,
                    _("The option not to recognize “format=flowed” "
                      "text has been removed."));
-    }
 
     {
-        int i;
-        gchar *default_quoted_color[MAX_QUOTED_COLOR] = {
-            "#088", "#800"
-        };
-        for (i = 0; i < MAX_QUOTED_COLOR; i++) {
+       int i;
+       gchar *default_quoted_color[MAX_QUOTED_COLOR] = {"#088", "#800"};
+       for(i=0;i<MAX_QUOTED_COLOR;i++) {
             gchar *key;
             const gchar *def_val;
 
@@ -758,7 +697,7 @@ config_global_load(void)
                 i < 6 ? default_quoted_color[i] : DEFAULT_QUOTED_COLOR;
             load_color(key, def_val, &balsa_app.quoted_color[i]);
             g_free(key);
-        }
+       }
     }
 
     /* URL coloring */
@@ -769,27 +708,26 @@ config_global_load(void)
         libbalsa_conf_get_bool("UseSystemFonts=true");
     g_free(balsa_app.message_font);
     balsa_app.message_font =
-        libbalsa_conf_get_string("MessageFont=" DEFAULT_MESSAGE_FONT);
+       libbalsa_conf_get_string("MessageFont=" DEFAULT_MESSAGE_FONT);
     g_free(balsa_app.subject_font);
     balsa_app.subject_font =
-        libbalsa_conf_get_string("SubjectFont=" DEFAULT_SUBJECT_FONT);
+       libbalsa_conf_get_string("SubjectFont=" DEFAULT_SUBJECT_FONT);
 
     /* ... wrap words */
     balsa_app.browse_wrap = libbalsa_conf_get_bool("WordWrap=false");
     balsa_app.browse_wrap_length = libbalsa_conf_get_int("WordWrapLength=79");
-    if (balsa_app.browse_wrap_length < 40) {
-        balsa_app.browse_wrap_length = 40;
-    }
+    if (balsa_app.browse_wrap_length < 40)
+       balsa_app.browse_wrap_length = 40;
 
     /* ... handling of Multipart/Alternative */
-    balsa_app.display_alt_plain =
-        libbalsa_conf_get_bool("DisplayAlternativeAsPlain=true");
+    balsa_app.display_alt_plain = 
+       libbalsa_conf_get_bool("DisplayAlternativeAsPlain=true");
 
     /* ... handling of broken mails with 8-bit chars */
-    balsa_app.convert_unknown_8bit =
-        libbalsa_conf_get_bool("ConvertUnknown8Bit=false");
+    balsa_app.convert_unknown_8bit = 
+       libbalsa_conf_get_bool("ConvertUnknown8Bit=false");
     balsa_app.convert_unknown_8bit_codeset =
-        libbalsa_conf_get_int("ConvertUnknown8BitCodeset=" DEFAULT_BROKEN_CODESET);
+       libbalsa_conf_get_int("ConvertUnknown8BitCodeset=" DEFAULT_BROKEN_CODESET);
     libbalsa_set_fallback_codeset(balsa_app.convert_unknown_8bit_codeset);
     libbalsa_conf_pop_group();
 
@@ -803,18 +741,16 @@ config_global_load(void)
 
     /* ... alternative layout of main window */
     balsa_app.layout_type = libbalsa_conf_get_int("LayoutType=0");
-    if ((balsa_app.layout_type != LAYOUT_DEFAULT) &&
-        (balsa_app.layout_type != LAYOUT_WIDE_MSG) &&
-        (balsa_app.layout_type != LAYOUT_WIDE_SCREEN)) {
+    if (balsa_app.layout_type != LAYOUT_DEFAULT && 
+        balsa_app.layout_type != LAYOUT_WIDE_MSG &&
+        balsa_app.layout_type != LAYOUT_WIDE_SCREEN)
         balsa_app.layout_type = LAYOUT_DEFAULT;
-    }
     balsa_app.view_message_on_open = libbalsa_conf_get_bool("ViewMessageOnOpen=true");
     balsa_app.ask_before_select = libbalsa_conf_get_bool("AskBeforeSelect=false");
     balsa_app.pgdownmod = libbalsa_conf_get_bool("PageDownMod=false");
     balsa_app.pgdown_percent = libbalsa_conf_get_int("PageDownPercent=50");
-    if (balsa_app.pgdown_percent < 10) {
-        balsa_app.pgdown_percent = 10;
-    }
+    if (balsa_app.pgdown_percent < 10)
+       balsa_app.pgdown_percent = 10;
 
     balsa_app.show_main_toolbar =
         libbalsa_conf_get_bool("ShowMainWindowToolbar=true");
@@ -828,16 +764,15 @@ config_global_load(void)
         libbalsa_conf_get_bool("ShowSOSbar=true");
 
     /* ... Progress Window Dialogs */
-    balsa_app.recv_progress_dialog = libbalsa_conf_get_bool("ShowRecvProgressDlg=true");
+       balsa_app.recv_progress_dialog = libbalsa_conf_get_bool("ShowRecvProgressDlg=true");
     balsa_app.send_progress_dialog = libbalsa_conf_get_bool("ShowSendProgressDlg=true");
 
     /* ... deleting messages: defaults enshrined here */
     filter_mask = libbalsa_mailbox_get_filter(NULL);
-    if (libbalsa_conf_get_bool("HideDeleted=true")) {
-        filter_mask |= (1 << 0);
-    } else {
-        filter_mask &= ~(1 << 0);
-    }
+    if (libbalsa_conf_get_bool("HideDeleted=true"))
+       filter_mask |= (1 << 0);
+    else
+       filter_mask &= ~(1 << 0);
     libbalsa_mailbox_set_filter(NULL, filter_mask);
 
     balsa_app.expunge_on_close =
@@ -846,27 +781,26 @@ config_global_load(void)
     /* timeout in munutes (was hours, so fall back if needed) */
     balsa_app.expunge_timeout =
         libbalsa_conf_get_int("AutoExpungeMinutes") * 60;
-    if (!balsa_app.expunge_timeout) {
-        balsa_app.expunge_timeout =
-            libbalsa_conf_get_int("AutoExpungeHours=2") * 3600;
-    }
+    if (!balsa_app.expunge_timeout)
+       balsa_app.expunge_timeout = 
+           libbalsa_conf_get_int("AutoExpungeHours=2") * 3600;
 
     balsa_app.mw_action_after_move = libbalsa_conf_get_int(
-            "MessageWindowActionAfterMove");
+        "MessageWindowActionAfterMove");
 
     libbalsa_conf_pop_group();
 
     /* Source browsing ... */
     libbalsa_conf_push_group("SourcePreview");
-    balsa_app.source_escape_specials =
+    balsa_app.source_escape_specials = 
         libbalsa_conf_get_bool("EscapeSpecials=true");
-    balsa_app.source_width = libbalsa_conf_get_int("Width=500");
+    balsa_app.source_width  = libbalsa_conf_get_int("Width=500");
     balsa_app.source_height = libbalsa_conf_get_int("Height=400");
     libbalsa_conf_pop_group();
 
     /* MRU mailbox tree ... */
     libbalsa_conf_push_group("MruTree");
-    balsa_app.mru_tree_width = libbalsa_conf_get_int("Width=150");
+    balsa_app.mru_tree_width  = libbalsa_conf_get_int("Width=150");
     balsa_app.mru_tree_height = libbalsa_conf_get_int("Height=300");
     libbalsa_conf_pop_group();
 
@@ -874,9 +808,8 @@ config_global_load(void)
     libbalsa_conf_push_group("Printing");
 
     /* ... Printing */
-    if (balsa_app.page_setup) {
-        g_object_unref(G_OBJECT(balsa_app.page_setup));
-    }
+    if (balsa_app.page_setup)
+       g_object_unref(G_OBJECT(balsa_app.page_setup));
     balsa_app.page_setup = restore_gtk_page_setup();
     balsa_app.margin_left = libbalsa_conf_get_double("LeftMargin");
     balsa_app.margin_top = libbalsa_conf_get_double("TopMargin");
@@ -886,15 +819,15 @@ config_global_load(void)
     g_free(balsa_app.print_header_font);
     balsa_app.print_header_font =
         libbalsa_conf_get_string("PrintHeaderFont="
-                                 DEFAULT_PRINT_HEADER_FONT);
+                                DEFAULT_PRINT_HEADER_FONT);
     g_free(balsa_app.print_footer_font);
     balsa_app.print_footer_font =
         libbalsa_conf_get_string("PrintFooterFont="
-                                 DEFAULT_PRINT_FOOTER_FONT);
+                                DEFAULT_PRINT_FOOTER_FONT);
     g_free(balsa_app.print_body_font);
     balsa_app.print_body_font =
         libbalsa_conf_get_string("PrintBodyFont="
-                                 DEFAULT_PRINT_BODY_FONT);
+                                DEFAULT_PRINT_BODY_FONT);
     balsa_app.print_highlight_cited =
         libbalsa_conf_get_bool("PrintHighlightCited=false");
     balsa_app.print_highlight_phrases =
@@ -904,7 +837,7 @@ config_global_load(void)
     /* GtkPrint printing */
     libbalsa_conf_push_group("GtkPrint");
     libbalsa_conf_foreach_keys("GtkPrint", load_gtk_print_setting,
-                               balsa_app.print_settings);
+                              balsa_app.print_settings);
     libbalsa_conf_pop_group();
 
     /* Spelling options ... */
@@ -915,14 +848,13 @@ config_global_load(void)
 #if HAVE_GSPELL || HAVE_GTKSPELL
     balsa_app.spell_check_active =
         libbalsa_conf_get_bool_with_default("SpellCheckActive", &def_used);
-    if (def_used) {
+    if (def_used)
         balsa_app.spell_check_active = balsa_app.spell_check_lang != NULL;
-    }
 #else                           /* HAVE_GTKSPELL */
     balsa_app.check_sig =
-        d_get_gint("SpellCheckSignature", DEFAULT_CHECK_SIG);
+       d_get_gint("SpellCheckSignature", DEFAULT_CHECK_SIG);
     balsa_app.check_quoted =
-        d_get_gint("SpellCheckQuoted", DEFAULT_CHECK_QUOTED);
+       d_get_gint("SpellCheckQuoted", DEFAULT_CHECK_QUOTED);
 #endif                          /* HAVE_GTKSPELL */
 
     libbalsa_conf_pop_group();
@@ -932,7 +864,7 @@ config_global_load(void)
 
     /* ... show mailbox content info */
     balsa_app.mblist_show_mb_content_info =
-        libbalsa_conf_get_bool("ShowMailboxContentInfo=false");
+       libbalsa_conf_get_bool("ShowMailboxContentInfo=false");
 
     libbalsa_conf_pop_group();
 
@@ -940,25 +872,23 @@ config_global_load(void)
     libbalsa_conf_push_group("MailboxChecking");
 
     balsa_app.notify_new_mail_dialog =
-        d_get_gint("NewMailNotificationDialog", 0);
+       d_get_gint("NewMailNotificationDialog", 0);
     balsa_app.notify_new_mail_sound =
-        d_get_gint("NewMailNotificationSound", 1);
+       d_get_gint("NewMailNotificationSound", 1);
     balsa_app.notify_new_mail_icon =
-        d_get_gint("NewMailNotificationIcon", 1);
+       d_get_gint("NewMailNotificationIcon", 1);
     balsa_app.check_mail_upon_startup =
-        libbalsa_conf_get_bool("OnStartup=false");
+       libbalsa_conf_get_bool("OnStartup=false");
     balsa_app.check_mail_auto = libbalsa_conf_get_bool("Auto=false");
     balsa_app.check_mail_timer = libbalsa_conf_get_int("AutoDelay=10");
-    if (balsa_app.check_mail_timer < 1) {
-        balsa_app.check_mail_timer = 10;
-    }
-    if (balsa_app.check_mail_auto) {
-        update_timer(TRUE, balsa_app.check_mail_timer);
-    }
-    balsa_app.check_imap = d_get_gint("CheckIMAP", 1);
-    balsa_app.check_imap_inbox = d_get_gint("CheckIMAPInbox", 0);
-    balsa_app.quiet_background_check = d_get_gint("QuietBackgroundCheck", 0);
-    balsa_app.msg_size_limit = d_get_gint("POPMsgSizeLimit", 20000);
+    if (balsa_app.check_mail_timer < 1)
+       balsa_app.check_mail_timer = 10;
+    if (balsa_app.check_mail_auto)
+       update_timer(TRUE, balsa_app.check_mail_timer);
+    balsa_app.check_imap=d_get_gint("CheckIMAP", 1);
+    balsa_app.check_imap_inbox=d_get_gint("CheckIMAPInbox", 0);
+    balsa_app.quiet_background_check=d_get_gint("QuietBackgroundCheck", 0);
+    balsa_app.msg_size_limit=d_get_gint("POPMsgSizeLimit", 20000);
     libbalsa_conf_pop_group();
 
     /* folder scanning */
@@ -978,102 +908,99 @@ config_global_load(void)
 
     /* ... SMTP servers */
     if (!balsa_app.smtp_servers) {
-        /* Transition code */
-        LibBalsaSmtpServer *smtp_server;
-        LibBalsaServer *server;
-        gchar *passphrase, *hostname;
-
-        smtp_server = libbalsa_smtp_server_new();
-        libbalsa_smtp_server_set_name(smtp_server,
-                                      libbalsa_smtp_server_get_name(NULL));
-        balsa_app.smtp_servers =
-            g_slist_prepend(NULL, smtp_server);
-        server = LIBBALSA_SERVER(smtp_server);
-
-        hostname =
-            libbalsa_conf_get_string_with_default("ESMTPServer=localhost:25",
+       /* Transition code */
+       LibBalsaSmtpServer *smtp_server;
+       LibBalsaServer *server;
+       gchar *passphrase, *hostname;
+
+       smtp_server = libbalsa_smtp_server_new();
+       libbalsa_smtp_server_set_name(smtp_server,
+               libbalsa_smtp_server_get_name(NULL));
+       balsa_app.smtp_servers =
+           g_slist_prepend(NULL, smtp_server);
+       server = LIBBALSA_SERVER(smtp_server);
+
+        hostname = 
+            libbalsa_conf_get_string_with_default("ESMTPServer=localhost:25", 
                                                   &def_used);
-        libbalsa_server_set_host(server, hostname, FALSE);
+       libbalsa_server_set_host(server, hostname, FALSE);
         g_free(hostname);
-        libbalsa_server_set_username(server,
-                                     libbalsa_conf_get_string("ESMTPUser"));
+       libbalsa_server_set_username(server,
+               libbalsa_conf_get_string("ESMTPUser"));
 
         passphrase = libbalsa_conf_private_get_string("ESMTPPassphrase");
-        if (passphrase) {
-            gchar *passphrase_rot = libbalsa_rot(passphrase);
-            g_free(passphrase);
+       if (passphrase) {
+            gchar* passphrase_rot = libbalsa_rot(passphrase);
+            g_free(passphrase); 
             libbalsa_server_set_password(server, passphrase_rot);
-            g_free(passphrase_rot);
+           g_free(passphrase_rot);
         }
 
         /* default set to "Use TLS if possible" */
-        server->tls_mode = libbalsa_conf_get_int("ESMTPTLSMode=1");
+       server->tls_mode = libbalsa_conf_get_int("ESMTPTLSMode=1");
 
-        passphrase =
-            libbalsa_conf_private_get_string("ESMTPCertificatePassphrase");
-        if (passphrase) {
-            gchar *passphrase_rot = libbalsa_rot(passphrase);
+       passphrase =
+           libbalsa_conf_private_get_string("ESMTPCertificatePassphrase");
+       if (passphrase) {
+            gchar* passphrase_rot = libbalsa_rot(passphrase);
             g_free(passphrase);
-            g_free(server->cert_passphrase);
-            server->cert_passphrase = passphrase_rot;
-        }
+           g_free(server->cert_passphrase);
+           server->cert_passphrase = passphrase_rot;
+       }
     }
 
     /* ... outgoing mail */
     balsa_app.wordwrap = libbalsa_conf_get_bool("WordWrap=false");
     balsa_app.wraplength = libbalsa_conf_get_int("WrapLength=72");
-    if (balsa_app.wraplength < 40) {
-        balsa_app.wraplength = 40;
-    }
+    if (balsa_app.wraplength < 40)
+       balsa_app.wraplength = 40;
 
     /* Obsolete. */
     libbalsa_conf_get_bool_with_default("SendRFC2646FormatFlowed=true",
-                                        &def_used);
-    if (!def_used) {
+                                       &def_used);
+    if (!def_used)
         g_idle_add((GSourceFunc) config_warning_idle,
                    _("The option not to send “format=flowed” text is now "
                      "on the Options menu of the compose window."));
-    }
 
-    balsa_app.autoquote =
-        libbalsa_conf_get_bool("AutoQuote=true");
+    balsa_app.autoquote = 
+       libbalsa_conf_get_bool("AutoQuote=true");
     balsa_app.send_mail_auto = libbalsa_conf_get_bool("AutoSend=true");
     balsa_app.send_mail_timer = libbalsa_conf_get_int("AutoSendDelay=15");
     if ((balsa_app.send_mail_timer < 1U) || (balsa_app.send_mail_timer > 120U)) {
-        balsa_app.send_mail_timer = 15U;
+       balsa_app.send_mail_timer = 15U;
     }
     libbalsa_auto_send_config(balsa_app.send_mail_auto, balsa_app.send_mail_timer);
 
-    balsa_app.reply_strip_html =
-        libbalsa_conf_get_bool("StripHtmlInReply=true");
-    balsa_app.forward_attached =
-        libbalsa_conf_get_bool("ForwardAttached=true");
+    balsa_app.reply_strip_html = 
+       libbalsa_conf_get_bool("StripHtmlInReply=true");
+    balsa_app.forward_attached = 
+       libbalsa_conf_get_bool("ForwardAttached=true");
 
-    balsa_app.always_queue_sent_mail = d_get_gint("AlwaysQueueSentMail", 0);
-    balsa_app.copy_to_sentbox = d_get_gint("CopyToSentbox", 1);
+       balsa_app.always_queue_sent_mail = d_get_gint("AlwaysQueueSentMail", 0);
+       balsa_app.copy_to_sentbox = d_get_gint("CopyToSentbox", 1);
 
     libbalsa_conf_pop_group();
 
     /* Compose window ... */
     libbalsa_conf_push_group("Compose");
 
-    balsa_app.edit_headers =
+    balsa_app.edit_headers = 
         libbalsa_conf_get_bool("ExternEditorEditHeaders=false");
 
     g_free(balsa_app.quote_str);
     balsa_app.quote_str = libbalsa_conf_get_string("QuoteString=> ");
     g_free(balsa_app.compose_headers);
     balsa_app.compose_headers =
-        libbalsa_conf_get_string("ComposeHeaders=Recipients Subject");
+       libbalsa_conf_get_string("ComposeHeaders=Recipients Subject");
 
     /* Obsolete. */
     libbalsa_conf_get_bool_with_default("RequestDispositionNotification=false",
-                                        &def_used);
-    if (!def_used) {
+                                       &def_used);
+    if (!def_used)
         g_idle_add((GSourceFunc) config_warning_idle,
                    _("The option to request a MDN is now on "
                      "the Options menu of the compose window."));
-    }
 
 
     libbalsa_conf_pop_group();
@@ -1085,36 +1012,36 @@ config_global_load(void)
     g_free(balsa_app.local_mail_directory);
     balsa_app.local_mail_directory = libbalsa_conf_get_string("MailDir");
 
-    if (!balsa_app.local_mail_directory) {
-        libbalsa_conf_pop_group();
+    if(!balsa_app.local_mail_directory) {
+       libbalsa_conf_pop_group();
         new_user = TRUE;
-        return FALSE;
+       return FALSE;
     }
     balsa_app.root_node =
         balsa_mailbox_node_new_from_dir(balsa_app.local_mail_directory);
 
-    balsa_app.open_inbox_upon_startup =
-        libbalsa_conf_get_bool("OpenInboxOnStartup=false");
+     balsa_app.open_inbox_upon_startup =
+       libbalsa_conf_get_bool("OpenInboxOnStartup=false");
     /* debugging enabled */
     balsa_app.debug = libbalsa_conf_get_bool("Debug=false");
 
     balsa_app.close_mailbox_auto = libbalsa_conf_get_bool("AutoCloseMailbox=true");
     /* timeouts in minutes in config file for backwards compat */
     balsa_app.close_mailbox_timeout = libbalsa_conf_get_int("AutoCloseMailboxTimeout=10") * 60;
-
+    
     balsa_app.remember_open_mboxes =
-        libbalsa_conf_get_bool("RememberOpenMailboxes=false");
+       libbalsa_conf_get_bool("RememberOpenMailboxes=false");
     balsa_app.current_mailbox_url =
-        libbalsa_conf_get_string("CurrentMailboxURL");
+       libbalsa_conf_get_string("CurrentMailboxURL");
 
     balsa_app.empty_trash_on_exit =
-        libbalsa_conf_get_bool("EmptyTrash=false");
+       libbalsa_conf_get_bool("EmptyTrash=false");
 
     /* This setting is now per address book */
     libbalsa_conf_clean_key("AddressBookDistMode");
 
     libbalsa_conf_pop_group();
-
+    
     /* Toolbars */
     load_toolbars();
 
@@ -1126,18 +1053,17 @@ config_global_load(void)
     balsa_app.save_dir = libbalsa_conf_get_string("SavePartDir");
     libbalsa_conf_pop_group();
 
-    /* Folder MRU */
+       /* Folder MRU */
     load_mru(&balsa_app.folder_mru, "FolderMRU");
 
-    /* FCC MRU */
+       /* FCC MRU */
     load_mru(&balsa_app.fcc_mru, "FccMRU");
 
     /* Pipe commands */
     load_mru(&balsa_app.pipe_cmds, "PipeCommands");
-    if (!balsa_app.pipe_cmds) {
-        balsa_app.pipe_cmds = g_list_prepend(NULL,
+    if (!balsa_app.pipe_cmds)
+        balsa_app.pipe_cmds = g_list_prepend(NULL, 
                                              g_strdup("sa-learn --spam"));
-    }
 
     /* We load identities at the end because they may refer to SMTP
      * servers. This is also critical when handling damaged config
@@ -1171,60 +1097,54 @@ config_global_load(void)
     }
 
     return TRUE;
-}                               /* config_global_load */
-
+}                              /* config_global_load */
 
 static void
-save_gtk_print_setting(const gchar *key,
-                       const gchar *value,
-                       gpointer     user_data)
+save_gtk_print_setting(const gchar *key, const gchar *value, gpointer user_data)
 {
     libbalsa_conf_set_string(key, value);
 }
 
-
 static void
 save_gtk_page_setup(GtkPageSetup *page_setup)
 {
     GtkPaperSize *paper_size;
 
-    if (!page_setup) {
-        return;
-    }
+    if (!page_setup)
+       return;
 
     paper_size = gtk_page_setup_get_paper_size(page_setup);
     g_assert(paper_size != NULL);
 
     libbalsa_conf_set_string("PaperName",
-                             gtk_paper_size_get_name (paper_size));
+                            gtk_paper_size_get_name (paper_size));
     libbalsa_conf_set_string("DisplayName",
-                             gtk_paper_size_get_display_name (paper_size));
+                            gtk_paper_size_get_display_name (paper_size));
     libbalsa_conf_set_string("PPDName",
-                             gtk_paper_size_get_ppd_name (paper_size));
+                            gtk_paper_size_get_ppd_name (paper_size));
 
     libbalsa_conf_set_double("Width",
-                             gtk_paper_size_get_width(paper_size,
-                                                      GTK_UNIT_MM));
+                            gtk_paper_size_get_width(paper_size,
+                                                     GTK_UNIT_MM));
     libbalsa_conf_set_double("Height",
-                             gtk_paper_size_get_height(paper_size,
-                                                       GTK_UNIT_MM));
+                            gtk_paper_size_get_height(paper_size,
+                                                      GTK_UNIT_MM));
     libbalsa_conf_set_double("MarginTop",
-                             gtk_page_setup_get_top_margin(page_setup,
-                                                           GTK_UNIT_MM));
+                            gtk_page_setup_get_top_margin(page_setup,
+                                                          GTK_UNIT_MM));
     libbalsa_conf_set_double("MarginBottom",
-                             gtk_page_setup_get_bottom_margin(page_setup,
-                                                              GTK_UNIT_MM));
+                            gtk_page_setup_get_bottom_margin(page_setup,
+                                                             GTK_UNIT_MM));
     libbalsa_conf_set_double("MarginLeft",
-                             gtk_page_setup_get_left_margin(page_setup,
-                                                            GTK_UNIT_MM));
+                            gtk_page_setup_get_left_margin(page_setup,
+                                                           GTK_UNIT_MM));
     libbalsa_conf_set_double("MarginRight",
-                             gtk_page_setup_get_right_margin(page_setup,
-                                                             GTK_UNIT_MM));
+                            gtk_page_setup_get_right_margin(page_setup,
+                                                            GTK_UNIT_MM));
     libbalsa_conf_set_int("Orientation",
-                          gtk_page_setup_get_orientation(page_setup));
+                         gtk_page_setup_get_orientation(page_setup));
 }
 
-
 gint
 config_save(void)
 {
@@ -1237,7 +1157,7 @@ config_save(void)
     /* Section for the balsa_information() settings... */
     libbalsa_conf_push_group("InformationMessages");
     libbalsa_conf_set_int("ShowInformationMessages",
-                          balsa_app.information_message);
+                        balsa_app.information_message);
     libbalsa_conf_set_int("ShowWarningMessages", balsa_app.warning_message);
     libbalsa_conf_set_int("ShowErrorMessages", balsa_app.error_message);
     libbalsa_conf_set_int("ShowDebugMessages", balsa_app.debug_message);
@@ -1250,18 +1170,18 @@ config_save(void)
 
     /* ... column width settings */
     libbalsa_conf_set_int("MailboxListNameWidth",
-                          balsa_app.mblist_name_width);
+                        balsa_app.mblist_name_width);
     libbalsa_conf_set_int("MailboxListNewMsgWidth",
-                          balsa_app.mblist_newmsg_width);
+                        balsa_app.mblist_newmsg_width);
     libbalsa_conf_set_int("MailboxListTotalMsgWidth",
-                          balsa_app.mblist_totalmsg_width);
+                        balsa_app.mblist_totalmsg_width);
     libbalsa_conf_set_int("IndexNumWidth", balsa_app.index_num_width);
     libbalsa_conf_set_int("IndexStatusWidth", balsa_app.index_status_width);
     libbalsa_conf_set_int("IndexAttachmentWidth",
-                          balsa_app.index_attachment_width);
+                        balsa_app.index_attachment_width);
     libbalsa_conf_set_int("IndexFromWidth", balsa_app.index_from_width);
     libbalsa_conf_set_int("IndexSubjectWidth",
-                          balsa_app.index_subject_width);
+                        balsa_app.index_subject_width);
     libbalsa_conf_set_int("IndexDateWidth", balsa_app.index_date_width);
     libbalsa_conf_set_int("IndexSizeWidth", balsa_app.index_size_width);
 
@@ -1277,9 +1197,9 @@ config_save(void)
                            !!balsa_app.sw_maximized);
 
     libbalsa_conf_set_int("MessageWindowWidth",
-                          balsa_app.message_window_width);
+                         balsa_app.message_window_width);
     libbalsa_conf_set_int("MessageWindowHeight",
-                          balsa_app.message_window_height);
+                         balsa_app.message_window_height);
     libbalsa_conf_set_bool("MessageWindowMaximized",
                            !!balsa_app.message_window_maximized);
 
@@ -1296,9 +1216,9 @@ config_save(void)
     libbalsa_conf_set_string("SelectedHeaders", balsa_app.selected_headers);
     libbalsa_conf_set_bool("ExpandTree", balsa_app.expand_tree);
     libbalsa_conf_set_int("SortField",
-                          libbalsa_mailbox_get_sort_field(NULL));
+                        libbalsa_mailbox_get_sort_field(NULL));
     libbalsa_conf_set_int("ThreadingType",
-                          libbalsa_mailbox_get_threading_type(NULL));
+                        libbalsa_mailbox_get_threading_type(NULL));
     libbalsa_conf_set_bool("MarkQuoted", balsa_app.mark_quoted);
     libbalsa_conf_set_string("QuoteRegex", balsa_app.quote_regex);
     libbalsa_conf_set_bool("UseSystemFonts", balsa_app.use_system_fonts);
@@ -1307,22 +1227,22 @@ config_save(void)
     libbalsa_conf_set_bool("WordWrap", balsa_app.browse_wrap);
     libbalsa_conf_set_int("WordWrapLength", balsa_app.browse_wrap_length);
 
-    for (i = 0; i < MAX_QUOTED_COLOR; i++) {
-        gchar *text = g_strdup_printf("QuotedColor%d", i);
-        save_color(text, &balsa_app.quoted_color[i]);
-        g_free(text);
+    for(i=0;i<MAX_QUOTED_COLOR;i++) {
+       gchar *text = g_strdup_printf("QuotedColor%d", i);
+       save_color(text, &balsa_app.quoted_color[i]);
+       g_free(text);
     }
 
     save_color("UrlColor", &balsa_app.url_color);
 
     /* ... handling of Multipart/Alternative */
     libbalsa_conf_set_bool("DisplayAlternativeAsPlain",
-                           balsa_app.display_alt_plain);
+                         balsa_app.display_alt_plain);
 
     /* ... handling of broken mails with 8-bit chars */
     libbalsa_conf_set_bool("ConvertUnknown8Bit", balsa_app.convert_unknown_8bit);
-    libbalsa_conf_set_int("ConvertUnknown8BitCodeset",
-                          balsa_app.convert_unknown_8bit_codeset);
+    libbalsa_conf_set_int("ConvertUnknown8BitCodeset", 
+                           balsa_app.convert_unknown_8bit_codeset);
 
     libbalsa_conf_pop_group();
 
@@ -1332,9 +1252,9 @@ config_save(void)
     libbalsa_conf_set_bool("ShowPreviewPane", balsa_app.previewpane);
     libbalsa_conf_set_bool("ShowMailboxList", balsa_app.show_mblist);
     libbalsa_conf_set_bool("ShowTabs", balsa_app.show_notebook_tabs);
-    libbalsa_conf_set_bool("ShowRecvProgressDlg", balsa_app.recv_progress_dialog);
+       libbalsa_conf_set_bool("ShowRecvProgressDlg", balsa_app.recv_progress_dialog);
     libbalsa_conf_set_bool("ShowSendProgressDlg", balsa_app.send_progress_dialog);
-    libbalsa_conf_set_int("LayoutType", balsa_app.layout_type);
+    libbalsa_conf_set_int("LayoutType",     balsa_app.layout_type);
     libbalsa_conf_set_bool("ViewMessageOnOpen", balsa_app.view_message_on_open);
     libbalsa_conf_set_bool("AskBeforeSelect", balsa_app.ask_before_select);
     libbalsa_conf_set_bool("PageDownMod", balsa_app.pgdownmod);
@@ -1355,23 +1275,23 @@ config_save(void)
     libbalsa_conf_set_bool("ExpungeOnClose", balsa_app.expunge_on_close);
     libbalsa_conf_set_bool("AutoExpunge", balsa_app.expunge_auto);
     libbalsa_conf_set_int("AutoExpungeMinutes",
-                          balsa_app.expunge_timeout / 60);
+                         balsa_app.expunge_timeout / 60);
     libbalsa_conf_set_int("MessageWindowActionAfterMove",
-                          balsa_app.mw_action_after_move);
+        balsa_app.mw_action_after_move);
 
     libbalsa_conf_pop_group();
 
     /* Source browsing ... */
     libbalsa_conf_push_group("SourcePreview");
     libbalsa_conf_set_bool("EscapeSpecials",
-                           balsa_app.source_escape_specials);
-    libbalsa_conf_set_int("Width", balsa_app.source_width);
+                          balsa_app.source_escape_specials);
+    libbalsa_conf_set_int("Width",  balsa_app.source_width);
     libbalsa_conf_set_int("Height", balsa_app.source_height);
     libbalsa_conf_pop_group();
 
     /* MRU mailbox tree ... */
     libbalsa_conf_push_group("MruTree");
-    libbalsa_conf_set_int("Width", balsa_app.mru_tree_width);
+    libbalsa_conf_set_int("Width",  balsa_app.mru_tree_width);
     libbalsa_conf_set_int("Height", balsa_app.mru_tree_height);
     libbalsa_conf_pop_group();
 
@@ -1384,23 +1304,22 @@ config_save(void)
     libbalsa_conf_set_double("BottomMargin", balsa_app.margin_bottom);
 
     libbalsa_conf_set_string("PrintHeaderFont",
-                             balsa_app.print_header_font);
+                            balsa_app.print_header_font);
     libbalsa_conf_set_string("PrintBodyFont", balsa_app.print_body_font);
     libbalsa_conf_set_string("PrintFooterFont",
-                             balsa_app.print_footer_font);
+                            balsa_app.print_footer_font);
     libbalsa_conf_set_bool("PrintHighlightCited",
-                           balsa_app.print_highlight_cited);
+                          balsa_app.print_highlight_cited);
     libbalsa_conf_set_bool("PrintHighlightPhrases",
-                           balsa_app.print_highlight_phrases);
+                          balsa_app.print_highlight_phrases);
     libbalsa_conf_pop_group();
 
     /* GtkPrintSettings stuff */
     libbalsa_conf_remove_group("GtkPrint");
     libbalsa_conf_push_group("GtkPrint");
-    if (balsa_app.print_settings) {
-        gtk_print_settings_foreach(balsa_app.print_settings,
-                                   save_gtk_print_setting, NULL);
-    }
+    if (balsa_app.print_settings)
+       gtk_print_settings_foreach(balsa_app.print_settings,
+                                  save_gtk_print_setting, NULL);
     libbalsa_conf_pop_group();
 
     /* Spelling options ... */
@@ -1410,7 +1329,7 @@ config_save(void)
     libbalsa_conf_set_string("SpellCheckLanguage",
                              balsa_app.spell_check_lang);
 #if HAVE_GSPELL || HAVE_GTKSPELL
-    libbalsa_conf_set_bool("SpellCheckActive",
+    libbalsa_conf_set_bool("SpellCheckActive", 
                            balsa_app.spell_check_active);
 #else                           /* HAVE_GTKSPELL */
     libbalsa_conf_set_int("SpellCheckSignature", balsa_app.check_sig);
@@ -1423,7 +1342,7 @@ config_save(void)
     libbalsa_conf_push_group("MailboxList");
 
     libbalsa_conf_set_bool("ShowMailboxContentInfo",
-                           balsa_app.mblist_show_mb_content_info);
+                         balsa_app.mblist_show_mb_content_info);
 
     libbalsa_conf_pop_group();
 
@@ -1442,7 +1361,7 @@ config_save(void)
     libbalsa_conf_set_int("CheckIMAP", balsa_app.check_imap);
     libbalsa_conf_set_int("CheckIMAPInbox", balsa_app.check_imap_inbox);
     libbalsa_conf_set_int("QuietBackgroundCheck",
-                          balsa_app.quiet_background_check);
+                        balsa_app.quiet_background_check);
     libbalsa_conf_set_int("POPMsgSizeLimit", balsa_app.msg_size_limit);
 
     libbalsa_conf_pop_group();
@@ -1468,7 +1387,7 @@ config_save(void)
             g_strconcat(SMTP_SERVER_SECTION_PREFIX,
                         libbalsa_smtp_server_get_name(smtp_server), NULL);
         libbalsa_conf_push_group(group);
-        g_free(group);
+       g_free(group);
         libbalsa_smtp_server_save_config(smtp_server);
         libbalsa_conf_pop_group();
     }
@@ -1482,10 +1401,10 @@ config_save(void)
     libbalsa_conf_set_bool("StripHtmlInReply", balsa_app.reply_strip_html);
     libbalsa_conf_set_bool("ForwardAttached", balsa_app.forward_attached);
 
-    libbalsa_conf_set_int("AlwaysQueueSentMail", balsa_app.always_queue_sent_mail);
+       libbalsa_conf_set_int("AlwaysQueueSentMail", balsa_app.always_queue_sent_mail);
     libbalsa_conf_set_bool("AutoSend", balsa_app.send_mail_auto);
     libbalsa_conf_set_int("AutoSendDelay", balsa_app.send_mail_timer);
-    libbalsa_conf_set_int("CopyToSentbox", balsa_app.copy_to_sentbox);
+       libbalsa_conf_set_int("CopyToSentbox", balsa_app.copy_to_sentbox);
     libbalsa_conf_pop_group();
 
     /* Compose window ... */
@@ -1503,27 +1422,26 @@ config_save(void)
 
     libbalsa_conf_set_string("MailDir", balsa_app.local_mail_directory);
 
-    libbalsa_conf_set_bool("OpenInboxOnStartup",
-                           balsa_app.open_inbox_upon_startup);
+    libbalsa_conf_set_bool("OpenInboxOnStartup", 
+                          balsa_app.open_inbox_upon_startup);
     libbalsa_conf_set_bool("Debug", balsa_app.debug);
 
     libbalsa_conf_set_bool("AutoCloseMailbox", balsa_app.close_mailbox_auto);
-    libbalsa_conf_set_int("AutoCloseMailboxTimeout", balsa_app.close_mailbox_timeout / 60);
+    libbalsa_conf_set_int("AutoCloseMailboxTimeout", balsa_app.close_mailbox_timeout/60);
 
     libbalsa_conf_set_bool("RememberOpenMailboxes",
-                           balsa_app.remember_open_mboxes);
+                         balsa_app.remember_open_mboxes);
     libbalsa_conf_set_string("CurrentMailboxURL",
                              balsa_app.current_mailbox_url);
 
     libbalsa_conf_set_bool("EmptyTrash", balsa_app.empty_trash_on_exit);
 
-    if (balsa_app.default_address_book) {
+    if (balsa_app.default_address_book)
         libbalsa_conf_set_string("DefaultAddressBook",
                                  libbalsa_address_book_get_config_prefix
-                                     (balsa_app.default_address_book));
-    } else {
-        libbalsa_conf_clean_key("DefaultAddressBook");
-    }
+                                 (balsa_app.default_address_book));
+    else
+       libbalsa_conf_clean_key("DefaultAddressBook");
 
     libbalsa_conf_pop_group();
 
@@ -1531,43 +1449,38 @@ config_save(void)
     save_toolbars();
 
     libbalsa_conf_push_group("Paths");
-    if (balsa_app.attach_dir) {
-        libbalsa_conf_set_string("AttachDir", balsa_app.attach_dir);
-    }
-    if (balsa_app.save_dir) {
-        libbalsa_conf_set_string("SavePartDir", balsa_app.save_dir);
-    }
+    if(balsa_app.attach_dir)
+       libbalsa_conf_set_string("AttachDir", balsa_app.attach_dir);
+    if(balsa_app.save_dir)
+       libbalsa_conf_set_string("SavePartDir", balsa_app.save_dir);
     libbalsa_conf_pop_group();
 
     save_mru(balsa_app.folder_mru, "FolderMRU");
-    save_mru(balsa_app.fcc_mru, "FccMRU");
-    save_mru(balsa_app.pipe_cmds, "PipeCommands");
+    save_mru(balsa_app.fcc_mru,    "FccMRU");
+    save_mru(balsa_app.pipe_cmds,  "PipeCommands");
 
     libbalsa_conf_sync();
     return TRUE;
-}                               /* config_global_save */
+}                              /* config_global_save */
 
 
 /* must use a sensible prefix, or this goes weird */
 
 static gboolean
-config_get_used_group(const gchar *key,
-                      const gchar *value,
-                      gpointer     data)
+config_get_used_group(const gchar * key, const gchar * value,
+                        gpointer data)
 {
     gint *max = data;
     gint curr;
 
-    if (*value && ((curr = atoi(value)) > *max)) {
+    if (*value && (curr = atoi(value)) > *max)
         *max = curr;
-    }
 
     return FALSE;
 }
 
-
 static gchar *
-config_get_unused_group(const gchar *prefix)
+config_get_unused_group(const gchar * prefix)
 {
     gint max = 0;
     gchar *name;
@@ -1575,18 +1488,14 @@ config_get_unused_group(const gchar *prefix)
     libbalsa_conf_foreach_group(prefix, config_get_used_group, &max);
 
     name = g_strdup_printf("%s%d", prefix, ++max);
-    if (balsa_app.debug) {
+    if (balsa_app.debug)
         g_print("config_mailbox_get_highest_number: name='%s'\n", name);
-    }
 
     return name;
 }
 
-
 static gboolean
-config_list_section(const gchar *key,
-                    const gchar *value,
-                    gpointer     data)
+config_list_section(const gchar * key, const gchar * value, gpointer data)
 {
     GSList **l = data;
 
@@ -1595,26 +1504,23 @@ config_list_section(const gchar *key,
     return FALSE;
 }
 
-
 static void
-config_remove_groups(const gchar *section_prefix)
+config_remove_groups(const gchar * section_prefix)
 {
     GSList *sections = NULL, *list;
 
     libbalsa_conf_foreach_group(section_prefix, config_list_section,
                                 &sections);
     for (list = sections; list; list = list->next) {
-        libbalsa_conf_remove_group(list->data);
-        g_free(list->data);
+       libbalsa_conf_remove_group(list->data);
+       g_free(list->data);
     }
     g_slist_free(sections);
 }
 
-
 static gboolean
-config_address_book_load(const gchar *key,
-                         const gchar *value,
-                         gpointer     data)
+config_address_book_load(const gchar * key, const gchar * value,
+                         gpointer data)
 {
     const gchar *default_address_book_prefix = data;
     LibBalsaAddressBook *address_book;
@@ -1633,7 +1539,6 @@ config_address_book_load(const gchar *key,
     return FALSE;
 }
 
-
 void
 config_address_books_load(void)
 {
@@ -1657,7 +1562,6 @@ config_address_books_load(void)
     g_free(default_address_book_prefix);
 }
 
-
 static void
 config_address_books_save(void)
 {
@@ -1665,23 +1569,20 @@ config_address_books_save(void)
                    (GFunc) config_address_book_save, NULL);
 }
 
-
 static LibBalsaSmtpServer *
-find_smtp_server_by_name(const gchar *name)
+find_smtp_server_by_name(const gchar * name)
 {
     GSList *list;
 
-    if (!name) {
+    if (!name)
         name = libbalsa_smtp_server_get_name(NULL);
-    }
 
     for (list = balsa_app.smtp_servers; list; list = list->next) {
         LibBalsaSmtpServer *smtp_server =
             LIBBALSA_SMTP_SERVER(list->data);
         if (strcmp(name,
-                   libbalsa_smtp_server_get_name(smtp_server)) == 0) {
+                   libbalsa_smtp_server_get_name(smtp_server)) == 0)
             return smtp_server;
-        }
     }
 
     /* Use the first in the list, if any (there really must be one by
@@ -1690,11 +1591,8 @@ find_smtp_server_by_name(const gchar *name)
     return LIBBALSA_SMTP_SERVER(balsa_app.smtp_servers->data);
 }
 
-
 static gboolean
-config_identity_load(const gchar *key,
-                     const gchar *value,
-                     gpointer     data)
+config_identity_load(const gchar * key, const gchar * value, gpointer data)
 {
     const gchar *default_ident = data;
     LibBalsaIdentity *ident;
@@ -1705,18 +1603,16 @@ config_identity_load(const gchar *key,
     smtp_server_name = libbalsa_conf_get_string("SmtpServer");
     libbalsa_identity_set_smtp_server(ident,
                                       find_smtp_server_by_name
-                                          (smtp_server_name));
+                                      (smtp_server_name));
     g_free(smtp_server_name);
     libbalsa_conf_pop_group();
     balsa_app.identities = g_list_prepend(balsa_app.identities, ident);
-    if (g_ascii_strcasecmp(default_ident, ident->identity_name) == 0) {
+    if (g_ascii_strcasecmp(default_ident, ident->identity_name) == 0)
         balsa_app.current_ident = ident;
-    }
 
     return FALSE;
 }
 
-
 static void
 config_identities_load()
 {
@@ -1735,56 +1631,52 @@ config_identities_load()
     balsa_app.identities = g_list_reverse(balsa_app.identities);
 
     if (!balsa_app.identities) {
-        libbalsa_conf_push_group("identity-default");
+       libbalsa_conf_push_group("identity-default");
         balsa_app.identities =
             g_list_prepend(NULL,
                            libbalsa_identity_new_config("default"));
-        libbalsa_conf_pop_group();
+       libbalsa_conf_pop_group();
     }
 
-    if (balsa_app.current_ident == NULL) {
+    if (balsa_app.current_ident == NULL)
         balsa_app.current_ident =
             LIBBALSA_IDENTITY(balsa_app.identities->data);
-    }
 
     g_free(default_ident);
-    if (balsa_app.main_window) {
+    if (balsa_app.main_window)
         balsa_identities_changed(balsa_app.main_window);
-    }
 }
 
-
 /* config_identities_save:
    saves the balsa_app.identites list.
- */
+*/
 void
 config_identities_save(void)
 {
-    LibBalsaIdentity *ident;
-    GList *list;
+    LibBalsaIdentity* ident;
+    GList* list;
     gchar *prefix;
 
     libbalsa_conf_push_group("identity");
-    libbalsa_conf_set_string("CurrentIdentity",
-                             balsa_app.current_ident->identity_name);
+    libbalsa_conf_set_string("CurrentIdentity", 
+                            balsa_app.current_ident->identity_name);
     libbalsa_conf_pop_group();
 
     config_remove_groups(IDENTITY_SECTION_PREFIX);
 
     /* save current */
     for (list = balsa_app.identities; list; list = list->next) {
-        ident = LIBBALSA_IDENTITY(list->data);
-        prefix = g_strconcat(IDENTITY_SECTION_PREFIX,
-                             ident->identity_name, NULL);
+       ident = LIBBALSA_IDENTITY(list->data);
+       prefix = g_strconcat(IDENTITY_SECTION_PREFIX, 
+                            ident->identity_name, NULL);
         libbalsa_identity_save(ident, prefix);
-        g_free(prefix);
+       g_free(prefix);
     }
 }
 
-
 /* Get viewByUrl prefix */
 static gchar *
-view_by_url_prefix(const gchar *url)
+view_by_url_prefix(const gchar * url)
 {
     gchar *url_enc;
     gchar *prefix;
@@ -1798,14 +1690,13 @@ view_by_url_prefix(const gchar *url)
 
 
 LibBalsaMailboxView *
-config_load_mailbox_view(const gchar *url)
+config_load_mailbox_view(const gchar * url)
 {
     gchar *prefix;
     LibBalsaMailboxView *view;
 
-    if (!url) {
+    if (!url)
         return NULL;
-    }
 
     prefix = view_by_url_prefix(url);
     if (!libbalsa_conf_has_group(prefix)) {
@@ -1819,55 +1710,43 @@ config_load_mailbox_view(const gchar *url)
 
     view->identity_name = libbalsa_conf_get_string("Identity");
 
-    if (libbalsa_conf_has_key("Threading")) {
+    if (libbalsa_conf_has_key("Threading"))
         view->threading_type = libbalsa_conf_get_int("Threading");
-    }
 
-    if (libbalsa_conf_has_key("GUIFilter")) {
+    if (libbalsa_conf_has_key("GUIFilter"))
         view->filter = libbalsa_conf_get_int("GUIFilter");
-    }
 
-    if (libbalsa_conf_has_key("SortType")) {
+    if (libbalsa_conf_has_key("SortType"))
         view->sort_type = libbalsa_conf_get_int("SortType");
-    }
 
-    if (libbalsa_conf_has_key("SortField")) {
+    if (libbalsa_conf_has_key("SortField"))
         view->sort_field = libbalsa_conf_get_int("SortField");
-    }
 
-    if (libbalsa_conf_has_key("Show")) {
+    if (libbalsa_conf_has_key("Show"))
         view->show = libbalsa_conf_get_int("Show");
-    }
 
-    if (libbalsa_conf_has_key("Subscribe")) {
+    if (libbalsa_conf_has_key("Subscribe"))
         view->subscribe = libbalsa_conf_get_int("Subscribe");
-    }
 
-    if (libbalsa_conf_has_key("Exposed")) {
+    if (libbalsa_conf_has_key("Exposed"))
         view->exposed = libbalsa_conf_get_bool("Exposed");
-    }
 
-    if (libbalsa_conf_has_key("Open")) {
+    if (libbalsa_conf_has_key("Open"))
         view->open = libbalsa_conf_get_bool("Open");
-    }
 
 #ifdef HAVE_GPGME
-    if (libbalsa_conf_has_key("CryptoMode")) {
+    if (libbalsa_conf_has_key("CryptoMode"))
         view->gpg_chk_mode = libbalsa_conf_get_int("CryptoMode");
-    }
 #endif
 
-    if (libbalsa_conf_has_key("Total")) {
+    if (libbalsa_conf_has_key("Total"))
         view->total = libbalsa_conf_get_int("Total");
-    }
 
-    if (libbalsa_conf_has_key("Unread")) {
+    if (libbalsa_conf_has_key("Unread"))
         view->unread = libbalsa_conf_get_int("Unread");
-    }
 
-    if (libbalsa_conf_has_key("ModTime")) {
+    if (libbalsa_conf_has_key("ModTime"))
         view->mtime = libbalsa_conf_get_int("ModTime");
-    }
 
     libbalsa_conf_pop_group();
     g_free(prefix);
@@ -1875,16 +1754,13 @@ config_load_mailbox_view(const gchar *url)
     return view;
 }
 
-
 void
-config_save_mailbox_view(const gchar         *url,
-                         LibBalsaMailboxView *view)
+config_save_mailbox_view(const gchar * url, LibBalsaMailboxView * view)
 {
     gchar *prefix;
 
-    if (!view || (view->in_sync && view->used)) {
-        return;
-    }
+    if (!view || (view->in_sync && view->used))
+       return;
     view->in_sync = TRUE;
 
     prefix = view_by_url_prefix(url);
@@ -1895,72 +1771,58 @@ config_save_mailbox_view(const gchar         *url,
     libbalsa_conf_push_group(prefix);
     g_free(prefix);
 
-    if (view->identity_name != libbalsa_mailbox_get_identity_name(NULL)) {
-        libbalsa_conf_set_string("Identity", view->identity_name);
-    }
-    if (view->threading_type != libbalsa_mailbox_get_threading_type(NULL)) {
-        libbalsa_conf_set_int("Threading", view->threading_type);
-    }
-    if (view->filter != libbalsa_mailbox_get_filter(NULL)) {
-        libbalsa_conf_set_int("GUIFilter", view->filter);
-    }
-    if (view->sort_type != libbalsa_mailbox_get_sort_type(NULL)) {
-        libbalsa_conf_set_int("SortType", view->sort_type);
-    }
-    if (view->sort_field != libbalsa_mailbox_get_sort_field(NULL)) {
-        libbalsa_conf_set_int("SortField", view->sort_field);
-    }
-    if (view->show == LB_MAILBOX_SHOW_TO) {
-        libbalsa_conf_set_int("Show", view->show);
-    }
-    if (view->subscribe == LB_MAILBOX_SUBSCRIBE_NO) {
-        libbalsa_conf_set_int("Subscribe", view->subscribe);
-    }
-    if (view->exposed != libbalsa_mailbox_get_exposed(NULL)) {
-        libbalsa_conf_set_bool("Exposed", view->exposed);
-    }
+    if (view->identity_name  != libbalsa_mailbox_get_identity_name(NULL))
+       libbalsa_conf_set_string("Identity", view->identity_name);
+    if (view->threading_type != libbalsa_mailbox_get_threading_type(NULL))
+       libbalsa_conf_set_int("Threading",   view->threading_type);
+    if (view->filter         != libbalsa_mailbox_get_filter(NULL))
+       libbalsa_conf_set_int("GUIFilter",   view->filter);
+    if (view->sort_type      != libbalsa_mailbox_get_sort_type(NULL))
+       libbalsa_conf_set_int("SortType",    view->sort_type);
+    if (view->sort_field     != libbalsa_mailbox_get_sort_field(NULL))
+       libbalsa_conf_set_int("SortField",   view->sort_field);
+    if (view->show           == LB_MAILBOX_SHOW_TO)
+       libbalsa_conf_set_int("Show",        view->show);
+    if (view->subscribe      == LB_MAILBOX_SUBSCRIBE_NO)
+       libbalsa_conf_set_int("Subscribe",   view->subscribe);
+    if (view->exposed        != libbalsa_mailbox_get_exposed(NULL))
+       libbalsa_conf_set_bool("Exposed",    view->exposed);
     if (balsa_app.remember_open_mboxes &&
-        (view->open != libbalsa_mailbox_get_open(NULL))) {
-        libbalsa_conf_set_bool("Open", view->open);
-    }
+        view->open           != libbalsa_mailbox_get_open(NULL))
+       libbalsa_conf_set_bool("Open",       view->open);
 #ifdef HAVE_GPGME
-    if (view->gpg_chk_mode != libbalsa_mailbox_get_crypto_mode(NULL)) {
-        libbalsa_conf_set_int("CryptoMode", view->gpg_chk_mode);
-    }
+    if (view->gpg_chk_mode   != libbalsa_mailbox_get_crypto_mode(NULL))
+       libbalsa_conf_set_int("CryptoMode",  view->gpg_chk_mode);
 #endif
     /* To avoid accumulation of config entries with only message counts,
      * we save them only if used in this session. */
-    if (view->used && (view->mtime != 0)) {
+    if (view->used && view->mtime != 0) {
         gboolean save_mtime = FALSE;
-        if (view->unread != libbalsa_mailbox_get_unread(NULL)) {
-            libbalsa_conf_set_int("Unread", view->unread);
+        if (view->unread     != libbalsa_mailbox_get_unread(NULL)) {
+            libbalsa_conf_set_int("Unread",  view->unread);
             save_mtime = TRUE;
         }
-        if (view->total != libbalsa_mailbox_get_total(NULL)) {
-            libbalsa_conf_set_int("Total", view->total);
+        if (view->total      != libbalsa_mailbox_get_total(NULL)) {
+            libbalsa_conf_set_int("Total",   view->total);
             save_mtime = TRUE;
         }
-        if (save_mtime) {
+        if (save_mtime)
             libbalsa_conf_set_int("ModTime", view->mtime);
-        }
     }
 
     libbalsa_conf_pop_group();
 }
 
-
 void
-config_view_remove(const gchar *url)
+config_view_remove(const gchar * url)
 {
     gchar *prefix = view_by_url_prefix(url);
     libbalsa_conf_remove_group(prefix);
     g_free(prefix);
 }
 
-
 static void
-save_color(const gchar *key,
-           GdkRGBA     *rgba)
+save_color(const gchar * key, GdkRGBA * rgba)
 {
     gchar *full_key;
     gchar *str;
@@ -1972,20 +1834,16 @@ save_color(const gchar *key,
     g_free(full_key);
 }
 
-
 static gboolean
-config_filter_load(const gchar *key,
-                   const gchar *value,
-                   gpointer     data)
+config_filter_load(const gchar * key, const gchar * value, gpointer data)
 {
     char *endptr;
     LibBalsaFilter *fil;
     long int dummy;
 
     dummy = strtol(value, &endptr, 10);
-    if ((dummy == LONG_MIN) || (dummy == LONG_MAX)) {
+    if (dummy == LONG_MIN || dummy == LONG_MAX)
         g_message("Value is too large");
-    }
     if (*endptr) {              /* Bad format. */
         libbalsa_conf_remove_group(key);
         return FALSE;
@@ -2008,7 +1866,6 @@ config_filter_load(const gchar *key,
     return filter_errno != FILTER_NOERR;
 }
 
-
 static void
 config_filters_load(void)
 {
@@ -2017,85 +1874,78 @@ config_filters_load(void)
                                 config_filter_load, NULL);
 }
 
-
 #define FILTER_SECTION_MAX "9999"
 
 void
 config_filters_save(void)
 {
     GSList *list;
-    LibBalsaFilter *fil;
-    gchar *buffer, *tmp;
-    gint i, nb = 0, tmp_len = strlen(FILTER_SECTION_MAX) + 2;
+    LibBalsaFilter* fil;
+    gchar * buffer,* tmp;
+    gint i,nb=0,tmp_len=strlen(FILTER_SECTION_MAX)+2;
 
     /* We allocate once for all a buffer to store conditions sections names */
-    buffer = g_strdup_printf(FILTER_SECTION_PREFIX "%s", FILTER_SECTION_MAX);
+    buffer=g_strdup_printf(FILTER_SECTION_PREFIX "%s", FILTER_SECTION_MAX);
     /* section_name points to the beginning of the filter section name */
     /* tmp points to the space where filter number is appended */
     tmp = buffer + strlen(FILTER_SECTION_PREFIX);
 
-    for (list = balsa_app.filters; list; list = list->next) {
-        fil = (LibBalsaFilter *)(list->data);
-        i = snprintf(tmp, tmp_len, "%d", nb++);
-        if (i >= tmp_len) {
+    for(list = balsa_app.filters; list; list = list->next) {
+       fil = (LibBalsaFilter*)(list->data);
+       i=snprintf(tmp,tmp_len,"%d",nb++);
+        if (i >= tmp_len)
             g_message("Group name was truncated");
-        }
-        libbalsa_conf_push_group(buffer);
-        libbalsa_filter_save_config(fil);
-        libbalsa_conf_pop_group();
+       libbalsa_conf_push_group(buffer);
+       libbalsa_filter_save_config(fil);
+       libbalsa_conf_pop_group();
     }
     libbalsa_conf_queue_sync();
     /* This loop takes care of cleaning up old filter sections */
     while (TRUE) {
-        i = snprintf(tmp, tmp_len, "%d", nb++);
-        if (i >= tmp_len) {
+       i=snprintf(tmp,tmp_len,"%d",nb++);
+        if (i >= tmp_len)
             g_message("Group name was truncated");
-        }
-        if (libbalsa_conf_has_group(buffer)) {
-            libbalsa_conf_remove_group(buffer);
-        } else {
-            break;
-        }
+       if (libbalsa_conf_has_group(buffer)) {
+           libbalsa_conf_remove_group(buffer);
+       }
+       else break;
     }
     libbalsa_conf_queue_sync();
     g_free(buffer);
 }
 
-
 void
-config_mailbox_filters_save(LibBalsaMailbox *mbox)
+config_mailbox_filters_save(LibBalsaMailbox * mbox)
 {
-    gchar *tmp;
+    gchar * tmp;
 
     g_return_if_fail(mbox);
     tmp = mailbox_filters_section_lookup(mbox->url ? mbox->url : mbox->name);
     if (!mbox->filters) {
-        if (tmp) {
-            libbalsa_conf_remove_group(tmp);
-            g_free(tmp);
-        }
-        return;
+       if (tmp) {
+           libbalsa_conf_remove_group(tmp);
+           g_free(tmp);
+       }
+       return;
     }
     if (!tmp) {
-        /* If there was no existing filters section for this mailbox we create one */
-        tmp = config_get_unused_group(MAILBOX_FILTERS_SECTION_PREFIX);
-        libbalsa_conf_push_group(tmp);
-        g_free(tmp);
-        libbalsa_conf_set_string(MAILBOX_FILTERS_URL_KEY, mbox->url);
-    } else {
-        libbalsa_conf_push_group(tmp);
-        g_free(tmp);
+       /* If there was no existing filters section for this mailbox we create one */
+       tmp=config_get_unused_group(MAILBOX_FILTERS_SECTION_PREFIX);
+       libbalsa_conf_push_group(tmp);
+       g_free(tmp);
+       libbalsa_conf_set_string(MAILBOX_FILTERS_URL_KEY,mbox->url);
+    }
+    else {
+       libbalsa_conf_push_group(tmp);
+       g_free(tmp);
     }
     libbalsa_mailbox_filters_save_config(mbox);
     libbalsa_conf_pop_group();
     libbalsa_conf_queue_sync();
 }
 
-
 static void
-load_color(const gchar *key,
-           const gchar *def_val,
-           GdkRGBA     *rgba)
+load_color(const gchar * key, const gchar * def_val, GdkRGBA * rgba)
 {
     gchar *full_key;
     gchar *str;
@@ -2113,33 +1963,28 @@ load_color(const gchar *key,
     g_free(str);
 }
 
-
 static void
-load_mru(GList      **mru,
-         const gchar *group)
+load_mru(GList **mru, const gchar * group)
 {
     int count, i;
     char tmpkey[32];
-
+    
     tmpkey[sizeof tmpkey - 1] = '\0';
 
     libbalsa_conf_push_group(group);
-    count = d_get_gint("MRUCount", 0);
-    for (i = 0; i < count; i++) {
+    count=d_get_gint("MRUCount", 0);
+    for(i=0;i<count;i++) {
         gchar *val;
-        snprintf(tmpkey, sizeof tmpkey - 1, "MRU%d", i + 1);
-        if ((val = libbalsa_conf_get_string(tmpkey)) != NULL ) {
-            (*mru) = g_list_prepend((*mru), val);
-        }
+       snprintf(tmpkey, sizeof tmpkey - 1, "MRU%d", i + 1);
+        if( (val = libbalsa_conf_get_string(tmpkey)) != NULL )
+            (*mru)=g_list_prepend((*mru), val);
     }
     *mru = g_list_reverse(*mru);
     libbalsa_conf_pop_group();
 }
 
-
 static void
-save_mru(GList       *mru,
-         const gchar *group)
+save_mru(GList * mru, const gchar * group)
 {
     int i;
     char tmpkey[32];
@@ -2149,7 +1994,7 @@ save_mru(GList       *mru,
 
     libbalsa_conf_push_group(group);
     for (ltmp = mru, i = 0; ltmp; ltmp = ltmp->next, i++) {
-        snprintf(tmpkey, sizeof tmpkey - 1, "MRU%d", i + 1);
+       snprintf(tmpkey, sizeof tmpkey - 1, "MRU%d", i + 1);
         libbalsa_conf_set_string(tmpkey, (gchar *) (ltmp->data));
     }
 
@@ -2157,16 +2002,14 @@ save_mru(GList       *mru,
     libbalsa_conf_pop_group();
 }
 
-
 void
 config_defclient_save(void)
 {
     GDesktopAppInfo *info;
     GError *err;
 
-    if (!balsa_app.default_client) {
+    if (!balsa_app.default_client)
         return;
-    }
 
     info = g_desktop_app_info_new("balsa.desktop");
     if (!info) {
@@ -2177,7 +2020,7 @@ config_defclient_save(void)
 
     err = NULL;
     if (!g_app_info_set_as_default_for_type
-            (G_APP_INFO(info), "x-scheme-handler/mailto", &err)) {
+        (G_APP_INFO(info), "x-scheme-handler/mailto", &err)) {
         g_warning("Failed to set Balsa as the default application "
                   "for “mailto”: %s", err->message);
         g_error_free(err);
@@ -2185,10 +2028,8 @@ config_defclient_save(void)
     g_object_unref(info);
 }
 
-
 static gboolean
-config_mailbox_had_property(const gchar *url,
-                            const gchar *key)
+config_mailbox_had_property(const gchar * url, const gchar * key)
 {
     gchar *prefix;
     gboolean retval = FALSE;
@@ -2201,9 +2042,8 @@ config_mailbox_had_property(const gchar *url,
 
     libbalsa_conf_push_group(prefix);
 
-    if (libbalsa_conf_has_key(key)) {
+    if (libbalsa_conf_has_key(key))
         retval = libbalsa_conf_get_bool(key);
-    }
 
     libbalsa_conf_pop_group();
     g_free(prefix);
@@ -2211,16 +2051,14 @@ config_mailbox_had_property(const gchar *url,
     return retval;
 }
 
-
 gboolean
-config_mailbox_was_open(const gchar *url)
+config_mailbox_was_open(const gchar * url)
 {
     return config_mailbox_had_property(url, "Open");
 }
 
-
 gboolean
-config_mailbox_was_exposed(const gchar *url)
+config_mailbox_was_exposed(const gchar * url)
 {
     return config_mailbox_had_property(url, "Exposed");
 }
diff --git a/src/save-restore.h b/src/save-restore.h
index 08ebe6b..adc2c92 100644
--- a/src/save-restore.h
+++ b/src/save-restore.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -21,7 +21,7 @@
 #define __SAVE_RESTORE_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include "libbalsa.h"
@@ -37,40 +37,37 @@ typedef enum {
     SPECIAL_OUTBOX
 } specialType;
 
-void config_mailbox_set_as_special(LibBalsaMailbox *mailbox,
-                                   specialType      which);
+void config_mailbox_set_as_special(LibBalsaMailbox * mailbox,
+                                  specialType which);
 
 gint config_load(void);
 void config_load_sections(void);
 gint config_save(void);
 void config_defclient_save(void);
 
-gchar *mailbox_get_pkey(const LibBalsaMailbox *mbox);
-gint config_mailbox_add(LibBalsaMailbox *mailbox,
-                        const char      *key_arg);
-gint config_mailbox_delete(const LibBalsaMailbox *mailbox);
-gint config_mailbox_update(LibBalsaMailbox *mailbox);
+gchar *mailbox_get_pkey(const LibBalsaMailbox * mbox);
+gint config_mailbox_add(LibBalsaMailbox * mailbox, const char *key_arg);
+gint config_mailbox_delete(const LibBalsaMailbox * mailbox);
+gint config_mailbox_update(LibBalsaMailbox * mailbox);
 
-gint config_folder_add(BalsaMailboxNode *mbnode,
-                       const char       *key_arg);
-gint config_folder_delete(const BalsaMailboxNode *mbnode);
-gint config_folder_update(BalsaMailboxNode *mbnode);
+gint config_folder_add(BalsaMailboxNode * mbnode, const char *key_arg);
+gint config_folder_delete(const BalsaMailboxNode * mbnode);
+gint config_folder_update(BalsaMailboxNode * mbnode);
 
-void config_address_book_save(LibBalsaAddressBook *ab);
-void config_address_book_delete(LibBalsaAddressBook *ab);
+void config_address_book_save(LibBalsaAddressBook * ab);
+void config_address_book_delete(LibBalsaAddressBook * ab);
 void config_address_books_load(void);
 
 void config_identities_save(void);
-void config_view_remove(const gchar *url);
-LibBalsaMailboxView *config_load_mailbox_view(const gchar *url);
-void config_save_mailbox_view(const gchar         *url,
-                              LibBalsaMailboxView *view);
+void config_view_remove(const gchar * url);
+LibBalsaMailboxView *config_load_mailbox_view(const gchar * url);
+void config_save_mailbox_view(const gchar * url, LibBalsaMailboxView * view);
 
-gboolean config_mailbox_was_open(const gchar *url);
-gboolean config_mailbox_was_exposed(const gchar *url);
+gboolean config_mailbox_was_open(const gchar * url);
+gboolean config_mailbox_was_exposed(const gchar * url);
 
 void config_filters_save(void);
-void config_mailbox_filters_save(LibBalsaMailbox *mbox);
-void clean_filter_config_section(const gchar *name);
+void config_mailbox_filters_save(LibBalsaMailbox * mbox);
+void clean_filter_config_section(const gchar * name);
 
-#endif                          /* __SAVE_RESTORE_H__ */
+#endif                         /* __SAVE_RESTORE_H__ */
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index f68d68c..8853722 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -19,11 +19,11 @@
 /* FONT SELECTION DISCUSSION:
    We use pango now.
    Locale data is then used exclusively for the spelling checking.
- */
+*/
 
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "sendmsg-window.h"
 
@@ -38,7 +38,7 @@
 #include <glib.h>
 
 #ifdef HAVE_LOCALE_H
-#   include <locale.h>
+#include <locale.h>
 #endif
 
 #include <sys/wait.h>
@@ -46,7 +46,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #ifdef HAVE_UNISTD_H
-#   include <unistd.h>
+#include <unistd.h>
 #endif
 #include <errno.h>
 #include "application-helpers.h"
@@ -68,17 +68,17 @@
 #include "macosx-helpers.h"
 
 #if !HAVE_GSPELL && !HAVE_GTKSPELL_3_0_3
-#   include <enchant/enchant.h>
+#include <enchant/enchant.h>
 #endif                          /* HAVE_GTKSPELL_3_0_3 */
 #if HAVE_GTKSPELL
-#   include "gtkspell/gtkspell.h"
+#include "gtkspell/gtkspell.h"
 #elif HAVE_GSPELL
-#   include "gspell/gspell.h"
+#include "gspell/gspell.h"
 #else                           /* HAVE_GTKSPELL */
-#   include "spell-check.h"
+#include "spell-check.h"
 #endif                          /* HAVE_GTKSPELL */
 #if HAVE_GTKSOURCEVIEW
-#   include <gtksourceview/gtksource.h>
+#include <gtksourceview/gtksource.h>
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 typedef struct {
@@ -87,77 +87,61 @@ typedef struct {
     BalsaSendmsg *bsmsg;
 } balsa_edit_with_gnome_data;
 
-typedef enum {
-    QUOTE_HEADERS, QUOTE_ALL, QUOTE_NOPREFIX
-} QuoteType;
+typedef enum { QUOTE_HEADERS, QUOTE_ALL, QUOTE_NOPREFIX } QuoteType;
 
-static gint message_postpone(BalsaSendmsg *bsmsg);
+static gint message_postpone(BalsaSendmsg * bsmsg);
 
-static void balsa_sendmsg_destroy_handler(BalsaSendmsg *bsmsg);
-static void check_readiness(BalsaSendmsg *bsmsg);
+static void balsa_sendmsg_destroy_handler(BalsaSendmsg * bsmsg);
+static void check_readiness(BalsaSendmsg * bsmsg);
 static void init_menus(BalsaSendmsg *);
-
 #ifdef HAVE_GPGME
 static void bsmsg_setup_gpg_ui(BalsaSendmsg *bsmsg);
-static void bsmsg_update_gpg_ui_on_ident_change(BalsaSendmsg     *bsmsg,
+static void bsmsg_update_gpg_ui_on_ident_change(BalsaSendmsg *bsmsg,
                                                 LibBalsaIdentity *new_ident);
-static void bsmsg_setup_gpg_ui_by_mode(BalsaSendmsg *bsmsg,
-                                       gint          mode);
-
+static void bsmsg_setup_gpg_ui_by_mode(BalsaSendmsg *bsmsg, gint mode);
 #endif
 
 #if !HAVE_GSPELL && !HAVE_GTKSPELL_3_0_3
-static void sw_spell_check_weak_notify(BalsaSendmsg *bsmsg);
-
+static void sw_spell_check_weak_notify(BalsaSendmsg * bsmsg);
 #endif                          /* HAVE_GTKSPELL */
 
-static void address_book_cb(LibBalsaAddressView *address_view,
-                            GtkWidget           *widget,
-                            BalsaSendmsg        *bsmsg);
-static void address_book_response(GtkWidget           *ab,
-                                  gint                 response,
-                                  LibBalsaAddressView *address_view);
-
-static void set_locale(BalsaSendmsg *bsmsg,
-                       const gchar  *locale);
-
-static void replace_identity_signature(BalsaSendmsg     *bsmsg,
-                                       LibBalsaIdentity *new_ident,
-                                       LibBalsaIdentity *old_ident,
-                                       gint             *replace_offset,
-                                       gint              siglen,
-                                       const gchar      *new_sig);
-static void update_bsmsg_identity(BalsaSendmsg *,
-                                  LibBalsaIdentity *);
-
-static void sw_size_alloc_cb(GtkWidget *window);
-static GString *quote_message_body(BalsaSendmsg    *bsmsg,
-                                   LibBalsaMessage *message,
-                                   QuoteType        type);
-static void set_list_post_address(BalsaSendmsg *bsmsg);
-static gboolean set_list_post_rfc2369(BalsaSendmsg *bsmsg,
-                                      const gchar  *url);
-static const gchar *rfc2822_skip_comments(const gchar *str);
-static void sendmsg_window_set_title(BalsaSendmsg *bsmsg);
+static void address_book_cb(LibBalsaAddressView * address_view,
+                            GtkWidget * widget,
+                            BalsaSendmsg * bsmsg);
+static void address_book_response(GtkWidget * ab, gint response,
+                                  LibBalsaAddressView * address_view);
+
+static void set_locale(BalsaSendmsg * bsmsg, const gchar * locale);
+
+static void replace_identity_signature(BalsaSendmsg* bsmsg,
+                                       LibBalsaIdentity* new_ident,
+                                       LibBalsaIdentity* old_ident,
+                                       gint* replace_offset, gint siglen,
+                                       const gchar* new_sig);
+static void update_bsmsg_identity(BalsaSendmsg*, LibBalsaIdentity*);
+
+static void sw_size_alloc_cb(GtkWidget * window);
+static GString *quote_message_body(BalsaSendmsg * bsmsg,
+                                   LibBalsaMessage * message,
+                                   QuoteType type);
+static void set_list_post_address(BalsaSendmsg * bsmsg);
+static gboolean set_list_post_rfc2369(BalsaSendmsg * bsmsg,
+                                      const gchar * url);
+static const gchar *rfc2822_skip_comments(const gchar * str);
+static void sendmsg_window_set_title(BalsaSendmsg * bsmsg);
 
 #if !HAVE_GTKSOURCEVIEW
 /* Undo/Redo buffer helpers. */
-static void sw_buffer_save(BalsaSendmsg *bsmsg);
-static void sw_buffer_swap(BalsaSendmsg *bsmsg,
-                           gboolean      undo);
-
+static void sw_buffer_save(BalsaSendmsg * bsmsg);
+static void sw_buffer_swap(BalsaSendmsg * bsmsg, gboolean undo);
 #endif                          /* HAVE_GTKSOURCEVIEW */
-static void sw_buffer_signals_connect(BalsaSendmsg *bsmsg);
-
+static void sw_buffer_signals_connect(BalsaSendmsg * bsmsg);
 #if !HAVE_GTKSOURCEVIEW || !(HAVE_GSPELL || HAVE_GTKSPELL)
-static void sw_buffer_signals_disconnect(BalsaSendmsg *bsmsg);
-
+static void sw_buffer_signals_disconnect(BalsaSendmsg * bsmsg);
 #endif                          /* !HAVE_GTKSOURCEVIEW || !HAVE_GTKSPELL */
 #if !HAVE_GTKSOURCEVIEW
-static void sw_buffer_set_undo(BalsaSendmsg *bsmsg,
-                               gboolean      undo,
-                               gboolean      redo);
-
+static void sw_buffer_set_undo(BalsaSendmsg * bsmsg, gboolean undo,
+                              gboolean redo);
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 /* Standard DnD types */
@@ -167,97 +151,94 @@ enum {
     TARGET_STRING
 };
 
-static const gchar *drop_types[] = {
+static const gchar * drop_types[] = {
     "x-application/x-message-list",
     "text/uri-list",
     "STRING",
     "text/plain"
 };
 
-static const gchar *email_field_drop_types[] = {
+static const gchar * email_field_drop_types[] = {
     "STRING",
     "text/plain"
 };
 
-static void lang_set_cb(GtkWidget    *widget,
-                        BalsaSendmsg *bsmsg);
+static void lang_set_cb(GtkWidget *widget, BalsaSendmsg *bsmsg);
 
-static void bsmsg_set_subject_from_body(BalsaSendmsg        *bsmsg,
-                                        LibBalsaMessageBody *body,
-                                        LibBalsaIdentity    *ident);
+static void bsmsg_set_subject_from_body(BalsaSendmsg * bsmsg,
+                                        LibBalsaMessageBody * body,
+                                        LibBalsaIdentity * ident);
 
 /* the array of locale names and charset names included in the MIME
    type information.
    if you add a new encoding here add to SendCharset in libbalsa.c
- */
+*/
 struct SendLocales {
     const gchar *locale, *charset, *lang_name;
 } locales[] = {
     /* Translators: please use the initial letter of each language as
      * its accelerator; this is a long list, and unique accelerators
      * cannot be found. */
-    {"pt_BR", "ISO-8859-1", N_("_Brazilian Portuguese")},
-    {"ca_ES", "ISO-8859-15", N_("_Catalan")},
+    {"pt_BR", "ISO-8859-1",    N_("_Brazilian Portuguese")},
+    {"ca_ES", "ISO-8859-15",   N_("_Catalan")},
     {"zh_CN.GB2312", "gb2312", N_("_Chinese Simplified")},
-    {"zh_TW.Big5", "big5", N_("_Chinese Traditional")},
-    {"cs_CZ", "ISO-8859-2", N_("_Czech")},
-    {"da_DK", "ISO-8859-1", N_("_Danish")},
-    {"nl_NL", "ISO-8859-15", N_("_Dutch")},
-    {"en_US", "ISO-8859-1", N_("_English (American)")},
-    {"en_GB", "ISO-8859-1", N_("_English (British)")},
-    {"eo_XX", "UTF-8", N_("_Esperanto")},
-    {"et_EE", "ISO-8859-15", N_("_Estonian")},
-    {"fi_FI", "ISO-8859-15", N_("_Finnish")},
-    {"fr_FR", "ISO-8859-15", N_("_French")},
-    {"de_DE", "ISO-8859-15", N_("_German")},
-    {"de_AT", "ISO-8859-15", N_("_German (Austrian)")},
-    {"de_CH", "ISO-8859-1", N_("_German (Swiss)")},
-    {"el_GR", "ISO-8859-7", N_("_Greek")},
-    {"he_IL", "UTF-8", N_("_Hebrew")},
-    {"hu_HU", "ISO-8859-2", N_("_Hungarian")},
-    {"it_IT", "ISO-8859-15", N_("_Italian")},
-    {"ja_JP", "ISO-2022-JP", N_("_Japanese (JIS)")},
-    {"kk_KZ", "UTF-8", N_("_Kazakh")},
-    {"ko_KR", "euc-kr", N_("_Korean")},
-    {"lv_LV", "ISO-8859-13", N_("_Latvian")},
-    {"lt_LT", "ISO-8859-13", N_("_Lithuanian")},
-    {"no_NO", "ISO-8859-1", N_("_Norwegian")},
-    {"pl_PL", "ISO-8859-2", N_("_Polish")},
-    {"pt_PT", "ISO-8859-15", N_("_Portuguese")},
-    {"ro_RO", "ISO-8859-2", N_("_Romanian")},
-    {"ru_RU", "KOI8-R", N_("_Russian")},
-    {"sr_Cyrl", "ISO-8859-5", N_("_Serbian")},
-    {"sr_Latn", "ISO-8859-2", N_("_Serbian (Latin)")},
-    {"sk_SK", "ISO-8859-2", N_("_Slovak")},
-    {"es_ES", "ISO-8859-15", N_("_Spanish")},
-    {"sv_SE", "ISO-8859-1", N_("_Swedish")},
-    {"tt_RU", "UTF-8", N_("_Tatar")},
-    {"tr_TR", "ISO-8859-9", N_("_Turkish")},
-    {"uk_UK", "KOI8-U", N_("_Ukrainian")},
-    {"", "UTF-8", N_("_Generic UTF-8")}
+    {"zh_TW.Big5", "big5",     N_("_Chinese Traditional")},
+    {"cs_CZ", "ISO-8859-2",    N_("_Czech")},
+    {"da_DK", "ISO-8859-1",    N_("_Danish")},
+    {"nl_NL", "ISO-8859-15",   N_("_Dutch")},
+    {"en_US", "ISO-8859-1",    N_("_English (American)")},
+    {"en_GB", "ISO-8859-1",    N_("_English (British)")},
+    {"eo_XX", "UTF-8",         N_("_Esperanto")},
+    {"et_EE", "ISO-8859-15",   N_("_Estonian")},
+    {"fi_FI", "ISO-8859-15",   N_("_Finnish")},
+    {"fr_FR", "ISO-8859-15",   N_("_French")},
+    {"de_DE", "ISO-8859-15",   N_("_German")},
+    {"de_AT", "ISO-8859-15",   N_("_German (Austrian)")},
+    {"de_CH", "ISO-8859-1",    N_("_German (Swiss)")},
+    {"el_GR", "ISO-8859-7",    N_("_Greek")},
+    {"he_IL", "UTF-8",         N_("_Hebrew")},
+    {"hu_HU", "ISO-8859-2",    N_("_Hungarian")},
+    {"it_IT", "ISO-8859-15",   N_("_Italian")},
+    {"ja_JP", "ISO-2022-JP",   N_("_Japanese (JIS)")},
+    {"kk_KZ", "UTF-8",         N_("_Kazakh")},
+    {"ko_KR", "euc-kr",        N_("_Korean")},
+    {"lv_LV", "ISO-8859-13",   N_("_Latvian")},
+    {"lt_LT", "ISO-8859-13",   N_("_Lithuanian")},
+    {"no_NO", "ISO-8859-1",    N_("_Norwegian")},
+    {"pl_PL", "ISO-8859-2",    N_("_Polish")},
+    {"pt_PT", "ISO-8859-15",   N_("_Portuguese")},
+    {"ro_RO", "ISO-8859-2",    N_("_Romanian")},
+    {"ru_RU", "KOI8-R",        N_("_Russian")},
+    {"sr_Cyrl", "ISO-8859-5",  N_("_Serbian")},
+    {"sr_Latn", "ISO-8859-2",  N_("_Serbian (Latin)")},
+    {"sk_SK", "ISO-8859-2",    N_("_Slovak")},
+    {"es_ES", "ISO-8859-15",   N_("_Spanish")},
+    {"sv_SE", "ISO-8859-1",    N_("_Swedish")},
+    {"tt_RU", "UTF-8",         N_("_Tatar")},
+    {"tr_TR", "ISO-8859-9",    N_("_Turkish")},
+    {"uk_UK", "KOI8-U",        N_("_Ukrainian")},
+    {"", "UTF-8",              N_("_Generic UTF-8")}
 };
 
 static const gchar *
-sw_preferred_charset(BalsaSendmsg *bsmsg)
+sw_preferred_charset(BalsaSendmsg * bsmsg)
 {
     guint i;
 
     for (i = 0; i < G_N_ELEMENTS(locales); i++) {
-        if (g_strcmp0(bsmsg->spell_check_lang, locales[i].locale) == 0) {
+        if (g_strcmp0(bsmsg->spell_check_lang, locales[i].locale) == 0)
             return locales[i].charset;
-        }
     }
 
     return NULL;
 }
 
-
 /* ===================================================================
    Balsa menus. Touchpad has some simplified menus which do not
    overlap very much with the default balsa menus. They are here
    because they represent an alternative probably appealing to the all
    proponents of GNOME2 dumbify approach (OK, I am bit unfair here).
- */
+*/
 
 /*
  * lists of actions that are enabled or disabled as groups
@@ -283,10 +264,8 @@ enum {
 typedef struct _BalsaAttachInfo BalsaAttachInfo;
 typedef struct _BalsaAttachInfoClass BalsaAttachInfoClass;
 
-static const gchar *const attach_modes[] =
-{
-    NULL, N_("Attachment"), N_("Inline"), N_("Reference")
-};
+static const gchar * const attach_modes[] =
+    {NULL, N_("Attachment"), N_("Inline"), N_("Reference") };
 
 struct _BalsaAttachInfo {
     GObject parent_object;
@@ -309,21 +288,20 @@ struct _BalsaAttachInfoClass {
 
 
 static GType balsa_attach_info_get_type();
-static void balsa_attach_info_init(GObject *object,
-                                   gpointer data);
-static BalsaAttachInfo *balsa_attach_info_new();
-static void balsa_attach_info_finalize(GObject *object);
+static void balsa_attach_info_init(GObject *object, gpointer data);
+static BalsaAttachInfo* balsa_attach_info_new();
+static void balsa_attach_info_finalize(GObject * object);
 
 
 #define BALSA_MSG_ATTACH_MODEL(x)   gtk_tree_view_get_model(GTK_TREE_VIEW((x)->tree_view))
 
 
 #define TYPE_BALSA_ATTACH_INFO          \
-    (balsa_attach_info_get_type ())
+        (balsa_attach_info_get_type ())
 #define BALSA_ATTACH_INFO(obj)          \
-    (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BALSA_ATTACH_INFO, BalsaAttachInfo))
+        (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BALSA_ATTACH_INFO, BalsaAttachInfo))
 #define IS_BALSA_ATTACH_INFO(obj)       \
-    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BALSA_ATTACH_INFO))
+        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BALSA_ATTACH_INFO))
 
 static void
 balsa_attach_info_class_init(BalsaAttachInfoClass *klass)
@@ -333,38 +311,35 @@ balsa_attach_info_class_init(BalsaAttachInfoClass *klass)
     object_class->finalize = balsa_attach_info_finalize;
 }
 
-
 static GType
 balsa_attach_info_get_type()
 {
-    static GType balsa_attach_info_type = 0;
+    static GType balsa_attach_info_type = 0 ;
 
     if (!balsa_attach_info_type) {
         static const GTypeInfo balsa_attach_info_info =
-        {
-            sizeof (BalsaAttachInfoClass),
-            (GBaseInitFunc) NULL,
-            (GBaseFinalizeFunc) NULL,
-            (GClassInitFunc) balsa_attach_info_class_init,
-            (GClassFinalizeFunc) NULL,
-            NULL,
-            sizeof(BalsaAttachInfo),
-            0,
-            (GInstanceInitFunc) balsa_attach_info_init
-        };
+            {
+                sizeof (BalsaAttachInfoClass),
+                (GBaseInitFunc) NULL,
+                (GBaseFinalizeFunc) NULL,
+                (GClassInitFunc) balsa_attach_info_class_init,
+                (GClassFinalizeFunc) NULL,
+                NULL,
+                sizeof(BalsaAttachInfo),
+                0,
+                (GInstanceInitFunc) balsa_attach_info_init
+            };
         balsa_attach_info_type =
-            g_type_register_static (G_TYPE_OBJECT, "BalsaAttachInfo",
-                                    &balsa_attach_info_info, 0);
+           g_type_register_static (G_TYPE_OBJECT, "BalsaAttachInfo",
+                                   &balsa_attach_info_info, 0);
     }
     return balsa_attach_info_type;
 }
 
-
 static void
-balsa_attach_info_init(GObject *object,
-                       gpointer data)
+balsa_attach_info_init(GObject *object, gpointer data)
 {
-    BalsaAttachInfo *info = BALSA_ATTACH_INFO(object);
+    BalsaAttachInfo * info = BALSA_ATTACH_INFO(object);
 
     info->popup_menu = NULL;
     info->file_uri = NULL;
@@ -375,21 +350,19 @@ balsa_attach_info_init(GObject *object,
     info->headers = NULL;
 }
 
-
-static BalsaAttachInfo *
+static BalsaAttachInfo*
 balsa_attach_info_new(BalsaSendmsg *bm)
 {
-    BalsaAttachInfo *info = g_object_new(TYPE_BALSA_ATTACH_INFO, NULL);
+    BalsaAttachInfo * info = g_object_new(TYPE_BALSA_ATTACH_INFO, NULL);
 
     info->bm = bm;
     return info;
 }
 
-
 static void
-balsa_attach_info_finalize(GObject *object)
+balsa_attach_info_finalize(GObject * object)
 {
-    BalsaAttachInfo *info;
+    BalsaAttachInfo * info;
     GObjectClass *parent_class;
 
     g_return_if_fail(object != NULL);
@@ -398,35 +371,31 @@ balsa_attach_info_finalize(GObject *object)
 
     /* unlink the file if necessary */
     if (info->delete_on_destroy && info->file_uri) {
-        gchar *folder_name;
+        gchar * folder_name;
 
         /* unlink the file */
-        if (balsa_app.debug) {
-            fprintf (stderr, "%s:%s: unlink `%s'\n", __FILE__, __FUNCTION__,
-                     libbalsa_vfs_get_uri_utf8(info->file_uri));
-        }
-        libbalsa_vfs_file_unlink(info->file_uri, NULL);
+       if (balsa_app.debug)
+           fprintf (stderr, "%s:%s: unlink `%s'\n", __FILE__, __FUNCTION__,
+                    libbalsa_vfs_get_uri_utf8(info->file_uri));
+       libbalsa_vfs_file_unlink(info->file_uri, NULL);
 
         /* remove the folder if possible */
         folder_name = g_filename_from_uri(libbalsa_vfs_get_folder(info->file_uri),
                                           NULL, NULL);
         if (folder_name) {
-            if (balsa_app.debug) {
+            if (balsa_app.debug)
                 fprintf (stderr, "%s:%s: rmdir `%s'\n", __FILE__, __FUNCTION__,
                          folder_name);
-            }
             g_rmdir(folder_name);
             g_free(folder_name);
         }
     }
 
     /* clean up memory */
-    if (info->popup_menu) {
+    if (info->popup_menu)
         gtk_widget_destroy(info->popup_menu);
-    }
-    if (info->file_uri) {
+    if (info->file_uri)
         g_object_unref(G_OBJECT(info->file_uri));
-    }
     g_free(info->force_mime_type);
     g_free(info->charset);
     libbalsa_message_headers_destroy(info->headers);
@@ -435,39 +404,34 @@ balsa_attach_info_finalize(GObject *object)
     parent_class->finalize(object);
 }
 
-
 /* ===================================================================
  *                end of attachment related stuff
  * =================================================================== */
 
 
 static void
-append_comma_separated(GtkEditable *editable,
-                       const gchar *text)
+append_comma_separated(GtkEditable *editable, const gchar * text)
 {
     gint position;
 
-    if (!text || !*text) {
+    if (!text || !*text)
         return;
-    }
 
     gtk_editable_set_position(editable, -1);
     position = gtk_editable_get_position(editable);
-    if (position > 0) {
+    if (position > 0)
         gtk_editable_insert_text(editable, ", ", 2, &position);
-    }
     gtk_editable_insert_text(editable, text, -1, &position);
     gtk_editable_set_position(editable, position);
 }
 
-
 /* the callback handlers */
 #define BALSA_SENDMSG_ADDRESS_BOOK_KEY "balsa-sendmsg-address-book"
 #define BALSA_SENDMSG_BUTTON_KEY       "balsa-sendmsg-button"
 static void
-address_book_cb(LibBalsaAddressView *address_view,
-                GtkWidget           *widget,
-                BalsaSendmsg        *bsmsg)
+address_book_cb(LibBalsaAddressView * address_view,
+                GtkWidget * widget,
+                BalsaSendmsg * bsmsg)
 {
     GtkWidget *ab;
 
@@ -492,12 +456,10 @@ address_book_cb(LibBalsaAddressView *address_view,
     gtk_widget_show(ab);
 }
 
-
 /* Callback for the "response" signal for the address book dialog. */
 static void
-address_book_response(GtkWidget           *ab,
-                      gint                 response,
-                      LibBalsaAddressView *address_view)
+address_book_response(GtkWidget * ab, gint response,
+                      LibBalsaAddressView * address_view)
 {
     GtkWindow *parent = gtk_window_get_transient_for(GTK_WINDOW(ab));
     GtkWidget *button =
@@ -515,20 +477,17 @@ address_book_response(GtkWidget           *ab,
     gtk_widget_set_sensitive(GTK_WIDGET(address_view), TRUE);
 }
 
-
 static void
-sw_delete_draft(BalsaSendmsg *bsmsg)
+sw_delete_draft(BalsaSendmsg * bsmsg)
 {
     LibBalsaMessage *message = bsmsg->draft_message;
-    if (message && message->mailbox && !message->mailbox->readonly) {
+    if (message && message->mailbox && !message->mailbox->readonly)
         libbalsa_message_change_flags(message,
                                       LIBBALSA_MESSAGE_FLAG_DELETED, 0);
-    }
 }
 
-
 static gboolean
-close_handler(BalsaSendmsg *bsmsg)
+close_handler(BalsaSendmsg * bsmsg)
 {
     InternetAddressList *list;
     InternetAddress *ia;
@@ -537,25 +496,21 @@ close_handler(BalsaSendmsg *bsmsg)
     gint reply;
     GtkWidget *d;
 
-    if (balsa_app.debug) {
+    if (balsa_app.debug)
         printf("%s\n", __func__);
-    }
 
-    if (bsmsg->state == SENDMSG_STATE_CLEAN) {
+    if (bsmsg->state == SENDMSG_STATE_CLEAN)
         return FALSE;
-    }
 
     list = libbalsa_address_view_get_list(bsmsg->recipient_view, "To:");
     ia = internet_address_list_get_address(list, 0);
     if (ia) {
         tmp = ia->name;
-        if (!tmp || !*tmp) {
+        if (!tmp || !*tmp)
             tmp = free_me = internet_address_to_string(ia, FALSE);
-        }
     }
-    if (!tmp || !*tmp) {
+    if (!tmp || !*tmp)
         tmp = _("(No name)");
-    }
 
     d = gtk_message_dialog_new(GTK_WINDOW(bsmsg->window),
                                GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -576,19 +531,14 @@ close_handler(BalsaSendmsg *bsmsg)
 
     switch (reply) {
     case GTK_RESPONSE_YES:
-        if (bsmsg->state == SENDMSG_STATE_MODIFIED) {
-            if (!message_postpone(bsmsg)) {
+        if (bsmsg->state == SENDMSG_STATE_MODIFIED)
+            if (!message_postpone(bsmsg))
                 return TRUE;
-            }
-        }
         break;
-
     case GTK_RESPONSE_NO:
-        if (!bsmsg->is_continue) {
+        if (!bsmsg->is_continue)
             sw_delete_draft(bsmsg);
-        }
         break;
-
     default:
         return TRUE;
     }
@@ -596,37 +546,31 @@ close_handler(BalsaSendmsg *bsmsg)
     return FALSE;
 }
 
-
 static gboolean
-close_request_cb(GtkWidget *widget,
-                 gpointer   data)
+close_request_cb(GtkWidget * widget, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
     return close_handler(bsmsg);
 }
 
-
 static void
-sw_close_activated(GSimpleAction *action,
-                   GVariant      *parameter,
-                   gpointer       data)
+sw_close_activated(GSimpleAction * action,
+                   GVariant      * parameter,
+                   gpointer        data)
 {
     BalsaSendmsg *bsmsg = data;
 
     BALSA_DEBUG_MSG("close_window_cb: start\n");
     g_object_set_data(G_OBJECT(bsmsg->window), "destroying",
                       GINT_TO_POINTER(TRUE));
-    if (!close_handler(bsmsg)) {
-        gtk_widget_destroy(bsmsg->window);
-    }
+    if(!close_handler(bsmsg))
+       gtk_widget_destroy(bsmsg->window);
     BALSA_DEBUG_MSG("close_window_cb: end\n");
 }
 
-
 static gint
-destroy_event_cb(GtkWidget *widget,
-                 gpointer   data)
+destroy_event_cb(GtkWidget * widget, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -634,13 +578,12 @@ destroy_event_cb(GtkWidget *widget,
     return TRUE;
 }
 
-
 /* the balsa_sendmsg destructor; copies first the shown headers setting
    to the balsa_app structure.
- */
+*/
 #define BALSA_SENDMSG_WINDOW_KEY "balsa-sendmsg-window-key"
 static void
-balsa_sendmsg_destroy_handler(BalsaSendmsg *bsmsg)
+balsa_sendmsg_destroy_handler(BalsaSendmsg * bsmsg)
 {
     gboolean quit_on_close;
 
@@ -654,35 +597,30 @@ balsa_sendmsg_destroy_handler(BalsaSendmsg *bsmsg)
         g_object_weak_unref(G_OBJECT(balsa_app.main_window),
                             (GWeakNotify) gtk_widget_destroy, bsmsg->window);
     }
-    if (balsa_app.debug) {
-        g_message("balsa_sendmsg_destroy()_handler: Start.");
-    }
+    if(balsa_app.debug) g_message("balsa_sendmsg_destroy()_handler: Start.");
 
     if (bsmsg->parent_message) {
-        if (bsmsg->parent_message->mailbox) {
-            libbalsa_mailbox_close(bsmsg->parent_message->mailbox,
-                                   /* Respect pref setting: */
-                                   balsa_app.expunge_on_close);
-        }
-        g_object_unref(G_OBJECT(bsmsg->parent_message));
+       if (bsmsg->parent_message->mailbox)
+           libbalsa_mailbox_close(bsmsg->parent_message->mailbox,
+                   /* Respect pref setting: */
+                                  balsa_app.expunge_on_close);
+       g_object_unref(G_OBJECT(bsmsg->parent_message));
         bsmsg->parent_message = NULL;
     }
 
     if (bsmsg->draft_message) {
         g_object_set_data(G_OBJECT(bsmsg->draft_message),
                           BALSA_SENDMSG_WINDOW_KEY, NULL);
-        if (bsmsg->draft_message->mailbox) {
-            libbalsa_mailbox_close(bsmsg->draft_message->mailbox,
-                                   /* Respect pref setting: */
-                                   balsa_app.expunge_on_close);
-        }
-        g_object_unref(G_OBJECT(bsmsg->draft_message));
+       if (bsmsg->draft_message->mailbox)
+           libbalsa_mailbox_close(bsmsg->draft_message->mailbox,
+                   /* Respect pref setting: */
+                                  balsa_app.expunge_on_close);
+       g_object_unref(G_OBJECT(bsmsg->draft_message));
         bsmsg->draft_message = NULL;
     }
 
-    if (balsa_app.debug) {
-        printf("balsa_sendmsg_destroy_handler: Freeing bsmsg\n");
-    }
+    if (balsa_app.debug)
+       printf("balsa_sendmsg_destroy_handler: Freeing bsmsg\n");
     gtk_widget_destroy(bsmsg->window);
     quit_on_close = bsmsg->quit_on_close;
     g_free(bsmsg->fcc_url);
@@ -690,9 +628,8 @@ balsa_sendmsg_destroy_handler(BalsaSendmsg *bsmsg)
     libbalsa_clear_list(&bsmsg->references, g_free);
 
 #if !(HAVE_GSPELL || HAVE_GTKSPELL)
-    if (bsmsg->spell_checker) {
+    if (bsmsg->spell_checker)
         gtk_widget_destroy(bsmsg->spell_checker);
-    }
 #endif                          /* HAVE_GTKSPELL */
     libbalsa_clear_source_id(&bsmsg->autosave_timeout_id);
 
@@ -713,14 +650,11 @@ balsa_sendmsg_destroy_handler(BalsaSendmsg *bsmsg)
 
     if (quit_on_close) {
         libbalsa_wait_for_sending_thread(-1);
-        gtk_main_quit();
-    }
-    if (balsa_app.debug) {
-        g_message("balsa_sendmsg_destroy(): Stop.");
+       gtk_main_quit();
     }
+    if(balsa_app.debug) g_message("balsa_sendmsg_destroy(): Stop.");
 }
 
-
 /* language menu helper functions */
 /* find_locale_index_by_locale:
    finds the longest fit so the one who has en_GB will gent en_US if en_GB
@@ -729,31 +663,27 @@ balsa_sendmsg_destroy_handler(BalsaSendmsg *bsmsg)
    instead of LC_ALL. But it is simpler to set it here instead of answering
    the questions (OTOH, I am afraid that people will start claiming "but
    balsa can recognize my language!" on failures in other software.
- */
+*/
 static gint
-find_locale_index_by_locale(const gchar *locale)
+find_locale_index_by_locale(const gchar * locale)
 {
     unsigned i, j, maxfit = 0;
     gint maxpos = -1;
 
-    if (!locale || (strcmp(locale, "C") == 0)) {
+    if (!locale || strcmp(locale, "C") == 0)
         locale = "en_US";
-    }
     for (i = 0; i < G_N_ELEMENTS(locales); i++) {
-        for (j = 0; locale[j] && locales[i].locale[j] == locale[j]; j++) {
-        }
-        if (j > maxfit) {
-            maxfit = j;
-            maxpos = i;
-        }
+       for (j = 0; locale[j] && locales[i].locale[j] == locale[j]; j++);
+       if (j > maxfit) {
+           maxfit = j;
+           maxpos = i;
+       }
     }
     return maxpos;
 }
 
-
 static void
-sw_buffer_signals_block(BalsaSendmsg  *bsmsg,
-                        GtkTextBuffer *buffer)
+sw_buffer_signals_block(BalsaSendmsg * bsmsg, GtkTextBuffer * buffer)
 {
     g_signal_handler_block(buffer, bsmsg->changed_sig_id);
 #if !HAVE_GTKSOURCEVIEW
@@ -762,10 +692,8 @@ sw_buffer_signals_block(BalsaSendmsg  *bsmsg,
     g_signal_handler_block(buffer, bsmsg->insert_text_sig_id);
 }
 
-
 static void
-sw_buffer_signals_unblock(BalsaSendmsg  *bsmsg,
-                          GtkTextBuffer *buffer)
+sw_buffer_signals_unblock(BalsaSendmsg * bsmsg, GtkTextBuffer * buffer)
 {
     g_signal_handler_unblock(buffer, bsmsg->changed_sig_id);
 #if !HAVE_GTKSOURCEVIEW
@@ -774,15 +702,11 @@ sw_buffer_signals_unblock(BalsaSendmsg  *bsmsg,
     g_signal_handler_unblock(buffer, bsmsg->insert_text_sig_id);
 }
 
-
 static const gchar *const address_types[] =
-{
-    N_("To:"), N_("CC:"), N_("BCC:")
-};
+    { N_("To:"), N_("CC:"), N_("BCC:") };
 
 static gboolean
-edit_with_gnome_check(gpointer data)
-{
+edit_with_gnome_check(gpointer data) {
     FILE *tmp;
     balsa_edit_with_gnome_data *data_real = (balsa_edit_with_gnome_data *)data;
     GtkTextBuffer *buffer;
@@ -791,15 +715,13 @@ edit_with_gnome_check(gpointer data)
     gchar line[81]; /* FIXME:All lines should wrap at this line */
     /* Editor not ready */
     pid = waitpid (data_real->pid_editor, NULL, WNOHANG);
-    if (pid == -1) {
+    if(pid == -1) {
         perror("waitpid");
         return TRUE;
-    } else if (pid == 0) {
-        return TRUE;
-    }
+    } else if(pid == 0) return TRUE;
 
     tmp = fopen(data_real->filename, "r");
-    if (tmp == NULL) {
+    if(tmp == NULL){
         perror("fopen");
         return TRUE;
     }
@@ -807,9 +729,8 @@ edit_with_gnome_check(gpointer data)
         while (fgets(line, sizeof(line), tmp)) {
             guint type;
 
-            if (line[strlen(line) - 1] == '\n') {
+            if (line[strlen(line) - 1] == '\n')
                 line[strlen(line) - 1] = '\0';
-            }
 
             if (libbalsa_str_has_prefix(line, _("Subject:")) == 0) {
                 gtk_entry_set_text(GTK_ENTRY(data_real->bsmsg->subject[1]),
@@ -821,12 +742,11 @@ edit_with_gnome_check(gpointer data)
                  type < G_N_ELEMENTS(address_types);
                  type++) {
                 const gchar *type_string = _(address_types[type]);
-                if (libbalsa_str_has_prefix(line, type_string)) {
+                if (libbalsa_str_has_prefix(line, type_string))
                     libbalsa_address_view_set_from_string
                         (data_real->bsmsg->recipient_view,
-                        address_types[type],
-                        line + strlen(type_string) + 1);
-                }
+                         address_types[type],
+                         line + strlen(type_string) + 1);
             }
         }
     }
@@ -837,9 +757,8 @@ edit_with_gnome_check(gpointer data)
 #endif                          /* HAVE_GTKSOURCEVIEW */
     sw_buffer_signals_block(data_real->bsmsg, buffer);
     gtk_text_buffer_set_text(buffer, "", 0);
-    while (fgets(line, sizeof(line), tmp)) {
+    while(fgets(line, sizeof(line), tmp))
         gtk_text_buffer_insert_at_cursor(buffer, line, -1);
-    }
     sw_buffer_signals_unblock(data_real->bsmsg, buffer);
 
     fclose(tmp);
@@ -851,7 +770,6 @@ edit_with_gnome_check(gpointer data)
     return FALSE;
 }
 
-
 /* Edit the current file with an external editor.
  *
  * We fork twice current process, so we get:
@@ -862,9 +780,9 @@ edit_with_gnome_check(gpointer data)
  * - New (grandchild) process (executes editor)
  */
 static void
-sw_edit_activated(GSimpleAction *action,
-                  GVariant      *parameter,
-                  gpointer       data)
+sw_edit_activated(GSimpleAction * action,
+                  GVariant      * parameter,
+                  gpointer        data)
 {
     BalsaSendmsg *bsmsg = data;
     static const char TMP_PATTERN[] = "/tmp/balsa-edit-XXXXXX";
@@ -904,7 +822,7 @@ sw_edit_activated(GSimpleAction *action,
     tmpfd = mkstemp(filename);
     tmp = fdopen(tmpfd, "w+");
 
-    if (balsa_app.edit_headers) {
+    if(balsa_app.edit_headers) {
         guint type;
 
         fprintf(tmp, "%s %s\n", _("Subject:"),
@@ -949,11 +867,10 @@ sw_edit_activated(GSimpleAction *action,
     g_timeout_add(200, (GSourceFunc)edit_with_gnome_check, edit_data);
 }
 
-
 static void
-sw_select_ident_activated(GSimpleAction *action,
-                          GVariant      *parameter,
-                          gpointer       data)
+sw_select_ident_activated(GSimpleAction * action,
+                          GVariant      * parameter,
+                          gpointer        data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -969,12 +886,9 @@ sw_select_ident_activated(GSimpleAction *action,
 
 /* NOTE: replace_offset and siglen are  utf-8 character offsets. */
 static void
-replace_identity_signature(BalsaSendmsg     *bsmsg,
-                           LibBalsaIdentity *new_ident,
-                           LibBalsaIdentity *old_ident,
-                           gint             *replace_offset,
-                           gint              siglen,
-                           const gchar      *new_sig)
+replace_identity_signature(BalsaSendmsg* bsmsg, LibBalsaIdentity* new_ident,
+                           LibBalsaIdentity* old_ident, gint* replace_offset,
+                           gint siglen, const gchar* new_sig)
 {
     gint newsiglen;
     GtkTextBuffer *buffer =
@@ -1001,13 +915,11 @@ replace_identity_signature(BalsaSendmsg     *bsmsg,
     default:
         insert_signature = TRUE;
         break;
-
     case SEND_REPLY:
     case SEND_REPLY_ALL:
     case SEND_REPLY_GROUP:
         insert_signature = new_ident->sig_whenreply;
         break;
-
     case SEND_FORWARD_ATTACH:
     case SEND_FORWARD_INLINE:
         insert_signature = new_ident->sig_whenforward;
@@ -1039,95 +951,82 @@ replace_identity_signature(BalsaSendmsg     *bsmsg,
     gtk_text_buffer_delete_mark(buffer, mark);
 }
 
-
 /*
  * GAction helpers
  */
 
 static GAction *
-sw_get_action(BalsaSendmsg *bsmsg,
-              const gchar  *action_name)
+sw_get_action(BalsaSendmsg * bsmsg, const gchar * action_name)
 {
     GAction *action;
 
-    if (g_object_get_data(G_OBJECT(bsmsg->window), "destroying")) {
+    if (g_object_get_data(G_OBJECT(bsmsg->window), "destroying"))
         return NULL;
-    }
 
     action = g_action_map_lookup_action(G_ACTION_MAP(bsmsg->window),
                                         action_name);
-    if (!action) {
+    if (!action)
         g_print("%s %s not found\n", __func__, action_name);
-    }
 
     return action;
 }
 
-
 static void
-sw_action_set_enabled(BalsaSendmsg *bsmsg,
-                      const gchar  *action_name,
-                      gboolean      enabled)
+sw_action_set_enabled(BalsaSendmsg * bsmsg,
+                      const gchar  * action_name,
+                      gboolean       enabled)
 {
     GAction *action;
 
     action = sw_get_action(bsmsg, action_name);
-    if (action) {
+    if (action)
         g_simple_action_set_enabled(G_SIMPLE_ACTION(action), enabled);
-    }
 }
 
-
 /*
  * Enable or disable a group of actions
  */
 
 static void
-sw_actions_set_enabled(BalsaSendmsg       *bsmsg,
-                       const gchar *const *actions,
-                       guint               n_actions,
-                       gboolean            enabled)
+sw_actions_set_enabled(BalsaSendmsg        * bsmsg,
+                       const gchar * const * actions,
+                       guint                 n_actions,
+                       gboolean              enabled)
 {
     guint i;
 
-    for (i = 0; i < n_actions; i++) {
+    for (i = 0; i < n_actions; i++)
         sw_action_set_enabled(bsmsg, *actions++, enabled);
-    }
 }
 
-
 #if !HAVE_GTKSOURCEVIEW || HAVE_GSPELL || HAVE_GTKSPELL
 static gboolean
-sw_action_get_enabled(BalsaSendmsg *bsmsg,
-                      const gchar  *action_name)
+sw_action_get_enabled(BalsaSendmsg * bsmsg,
+                      const gchar  * action_name)
 {
     GAction *action;
 
     action = sw_get_action(bsmsg, action_name);
     return action ? g_action_get_enabled(action) : FALSE;
 }
-
-
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 /* Set the state of a toggle-type GAction. */
 static void
-sw_action_set_active(BalsaSendmsg *bsmsg,
-                     const gchar  *action_name,
-                     gboolean      state)
+sw_action_set_active(BalsaSendmsg * bsmsg,
+                     const gchar  * action_name,
+                     gboolean       state)
 {
     GAction *action;
 
     action = sw_get_action(bsmsg, action_name);
-    if (action) {
+    if (action)
         g_action_change_state(action, g_variant_new_boolean(state));
-    }
 }
 
-
 static gboolean
-sw_action_get_active(BalsaSendmsg *bsmsg,
-                     const gchar  *action_name)
+sw_action_get_active(BalsaSendmsg * bsmsg,
+                     const gchar  * action_name)
 {
     GAction *action;
     gboolean retval = FALSE;
@@ -1144,7 +1043,6 @@ sw_action_get_active(BalsaSendmsg *bsmsg,
     return retval;
 }
 
-
 /*
  * end of GAction helpers
  */
@@ -1156,8 +1054,7 @@ sw_action_get_active(BalsaSendmsg *bsmsg,
  * corresponding fields.
  * */
 static void
-update_bsmsg_identity(BalsaSendmsg     *bsmsg,
-                      LibBalsaIdentity *ident)
+update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
 {
     GtkTextBuffer *buffer =
         gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
@@ -1167,16 +1064,16 @@ update_bsmsg_identity(BalsaSendmsg     *bsmsg,
     gint siglen;
 
     gboolean found_sig = FALSE;
-    gchar *old_sig;
-    gchar *new_sig;
-    gchar *message_text;
-    gchar *compare_str;
-    gchar **message_split;
-    gchar *tmpstr;
-    const gchar *subject;
+    gchar* old_sig;
+    gchar* new_sig;
+    gchar* message_text;
+    gchar* compare_str;
+    gchar** message_split;
+    gchar* tmpstr;
+    const gchar* subject;
     gint replen, fwdlen;
 
-    LibBalsaIdentity *old_ident;
+    LibBalsaIdentity* old_ident;
     gboolean reply_type = (bsmsg->type == SEND_REPLY ||
                            bsmsg->type == SEND_REPLY_ALL ||
                            bsmsg->type == SEND_REPLY_GROUP);
@@ -1222,9 +1119,8 @@ update_bsmsg_identity(BalsaSendmsg     *bsmsg,
                 for (j = 0; j < ident_list_len; j++) {
                     InternetAddress *ia2 =
                         internet_address_list_get_address(ident_list, j);
-                    if (libbalsa_ia_rfc2821_equal(ia, ia2)) {
+                    if (libbalsa_ia_rfc2821_equal(ia, ia2))
                         break;
-                    }
                 }
 
                 if (j < ident_list_len) {
@@ -1267,18 +1163,18 @@ update_bsmsg_identity(BalsaSendmsg     *bsmsg,
 
     old_ident = bsmsg->ident;
     if (((replen = strlen(old_ident->reply_string)) > 0) &&
-        (strncmp(subject, old_ident->reply_string, replen) == 0)) {
-        tmpstr = g_strconcat(ident->reply_string, &(subject[replen]), NULL);
-        gtk_entry_set_text(GTK_ENTRY(bsmsg->subject[1]), tmpstr);
-        g_free(tmpstr);
+       (strncmp(subject, old_ident->reply_string, replen) == 0)) {
+       tmpstr = g_strconcat(ident->reply_string, &(subject[replen]), NULL);
+       gtk_entry_set_text(GTK_ENTRY(bsmsg->subject[1]), tmpstr);
+       g_free(tmpstr);
     } else if (((fwdlen = strlen(old_ident->forward_string)) > 0) &&
-               (strncmp(subject, old_ident->forward_string, fwdlen) == 0)) {
-        tmpstr = g_strconcat(ident->forward_string, &(subject[fwdlen]), NULL);
-        gtk_entry_set_text(GTK_ENTRY(bsmsg->subject[1]), tmpstr);
-        g_free(tmpstr);
+              (strncmp(subject, old_ident->forward_string, fwdlen) == 0)) {
+       tmpstr = g_strconcat(ident->forward_string, &(subject[fwdlen]), NULL);
+       gtk_entry_set_text(GTK_ENTRY(bsmsg->subject[1]), tmpstr);
+       g_free(tmpstr);
     } else {
-        if (((replen == 0) && reply_type) ||
-            ((fwdlen == 0) && forward_type)) {
+        if ( (replen == 0 && reply_type) ||
+             (fwdlen == 0 && forward_type) ) {
             LibBalsaMessage *msg = bsmsg->parent_message ?
                 bsmsg->parent_message : bsmsg->draft_message;
             bsmsg_set_subject_from_body(bsmsg, msg->body_list, ident);
@@ -1295,16 +1191,13 @@ update_bsmsg_identity(BalsaSendmsg     *bsmsg,
     /* switch identities in bsmsg here so we can use read_signature
      * again */
     bsmsg->ident = ident;
-    if ((reply_type && ident->sig_whenreply)
-        || (forward_type && ident->sig_whenforward)
-        || ((bsmsg->type == SEND_NORMAL) && ident->sig_sending)) {
+    if ( (reply_type && ident->sig_whenreply)
+         || (forward_type && ident->sig_whenforward)
+         || (bsmsg->type == SEND_NORMAL && ident->sig_sending))
         new_sig = libbalsa_identity_get_signature(ident, NULL);
-    } else {
+    else
         new_sig = NULL;
-    }
-    if (!new_sig) {
-        new_sig = g_strdup("");
-    }
+    if(!new_sig) new_sig = g_strdup("");
 
     gtk_text_buffer_get_bounds(buffer, &start, &end);
     message_text = gtk_text_iter_get_text(&start, &end);
@@ -1318,34 +1211,34 @@ update_bsmsg_identity(BalsaSendmsg     *bsmsg,
         message_split = g_strsplit(message_text, "\n-- \n", 0);
         siglen = g_utf8_strlen(old_sig, -1);
 
-        /* check the special case of starting a message with a sig */
-        compare_str = g_strconcat("\n", message_split[0], NULL);
+       /* check the special case of starting a message with a sig */
+       compare_str = g_strconcat("\n", message_split[0], NULL);
 
-        if (g_ascii_strncasecmp(old_sig, compare_str, siglen) == 0) {
-            g_free(compare_str);
-            replace_identity_signature(bsmsg, ident, old_ident,
+       if (g_ascii_strncasecmp(old_sig, compare_str, siglen) == 0) {
+           g_free(compare_str);
+           replace_identity_signature(bsmsg, ident, old_ident,
                                        &replace_offset, siglen - 1, new_sig);
-            found_sig = TRUE;
-        } else {
+           found_sig = TRUE;
+       } else {
             gint i;
 
             g_free(compare_str);
             for (i = 0; message_split[i] != NULL; i++) {
-                /* put sig separator back to search */
-                compare_str = g_strconcat("\n-- \n", message_split[i], NULL);
+               /* put sig separator back to search */
+               compare_str = g_strconcat("\n-- \n", message_split[i], NULL);
 
-                /* try to find occurance of old signature */
-                if (g_ascii_strncasecmp(old_sig, compare_str, siglen) == 0) {
-                    replace_identity_signature(bsmsg, ident, old_ident,
+               /* try to find occurance of old signature */
+               if (g_ascii_strncasecmp(old_sig, compare_str, siglen) == 0) {
+                   replace_identity_signature(bsmsg, ident, old_ident,
                                                &replace_offset, siglen,
                                                new_sig);
-                    found_sig = TRUE;
-                }
+                   found_sig = TRUE;
+               }
 
-                replace_offset +=
-                    g_utf8_strlen(i ? compare_str : message_split[i], -1);
-                g_free(compare_str);
-            }
+               replace_offset +=
+                   g_utf8_strlen(i ? compare_str : message_split[i], -1);
+               g_free(compare_str);
+           }
         }
         /* if no sig seperators found, do a slower brute force
          * approach.  We could have stopped earlier if the message was
@@ -1355,28 +1248,28 @@ update_bsmsg_identity(BalsaSendmsg     *bsmsg,
             compare_str = message_text;
             replace_offset = 0;
 
-            /* check the special case of starting a message with a sig */
-            tmpstr = g_strconcat("\n", message_text, NULL);
+           /* check the special case of starting a message with a sig */
+           tmpstr = g_strconcat("\n", message_text, NULL);
 
-            if (g_ascii_strncasecmp(old_sig, tmpstr, siglen) == 0) {
-                g_free(tmpstr);
-                replace_identity_signature(bsmsg, ident, old_ident,
+           if (g_ascii_strncasecmp(old_sig, tmpstr, siglen) == 0) {
+               g_free(tmpstr);
+               replace_identity_signature(bsmsg, ident, old_ident,
                                            &replace_offset, siglen - 1,
                                            new_sig);
-            } else {
-                g_free(tmpstr);
-                replace_offset++;
-                compare_str = g_utf8_next_char(compare_str);
-                while (*compare_str) {
-                    if (g_ascii_strncasecmp(old_sig, compare_str, siglen) == 0) {
-                        replace_identity_signature(bsmsg, ident, old_ident,
+           } else {
+               g_free(tmpstr);
+               replace_offset++;
+               compare_str = g_utf8_next_char(compare_str);
+               while (*compare_str) {
+                   if (g_ascii_strncasecmp(old_sig, compare_str, siglen) == 0) {
+                       replace_identity_signature(bsmsg, ident, old_ident,
                                                    &replace_offset, siglen,
                                                    new_sig);
-                    }
-                    replace_offset++;
-                    compare_str = g_utf8_next_char(compare_str);
-                }
-            }
+                   }
+                   replace_offset++;
+                   compare_str = g_utf8_next_char(compare_str);
+               }
+           }
         }
         g_strfreev(message_split);
     }
@@ -1398,31 +1291,28 @@ update_bsmsg_identity(BalsaSendmsg     *bsmsg,
 
 
 static void
-sw_size_alloc_cb(GtkWidget *window)
+sw_size_alloc_cb(GtkWidget * window)
 {
     GdkWindow *gdk_window;
 
     gdk_window = gtk_widget_get_window(window);
-    if (gdk_window == NULL) {
+    if (gdk_window == NULL)
         return;
-    }
 
     balsa_app.sw_maximized =
         (gdk_window_get_state(gdk_window) &
          (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN)) != 0;
 
-    if (!balsa_app.sw_maximized) {
+    if (!balsa_app.sw_maximized)
         gtk_window_get_size(GTK_WINDOW(window),
-                            &balsa_app.sw_width,
-                            &balsa_app.sw_height);
-    }
+                            & balsa_app.sw_width,
+                            & balsa_app.sw_height);
 }
 
 
 /* remove_attachment - right mouse button callback */
 static void
-remove_attachment(GtkWidget       *menu_item,
-                  BalsaAttachInfo *info)
+remove_attachment(GtkWidget * menu_item, BalsaAttachInfo *info)
 {
     GtkTreeIter iter;
     GtkTreeModel *model;
@@ -1433,17 +1323,15 @@ remove_attachment(GtkWidget       *menu_item,
 
     /* get the selected element */
     selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(info->bm->tree_view));
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
-        return;
-    }
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+       return;
 
     /* make sure we got the right element */
     gtk_tree_model_get(model, &iter, ATTACH_INFO_COLUMN, &test_info, -1);
     if (test_info != info) {
-        if (test_info) {
-            g_object_unref(test_info);
-        }
-        return;
+       if (test_info)
+           g_object_unref(test_info);
+       return;
     }
     g_object_unref(test_info);
 
@@ -1451,24 +1339,19 @@ remove_attachment(GtkWidget       *menu_item,
     gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
 }
 
-
 static void
-set_attach_menu_sensitivity(GtkWidget *widget,
-                            gpointer   data)
+set_attach_menu_sensitivity(GtkWidget * widget, gpointer data)
 {
     gint mode =
         GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "new-mode"));
 
-    if (mode) {
+    if (mode)
         gtk_widget_set_sensitive(widget, mode != GPOINTER_TO_INT(data));
-    }
 }
 
-
 /* change attachment mode - right mouse button callback */
 static void
-change_attach_mode(GtkWidget       *menu_item,
-                   BalsaAttachInfo *info)
+change_attach_mode(GtkWidget * menu_item, BalsaAttachInfo *info)
 {
     gint new_mode =
         GPOINTER_TO_INT(g_object_get_data(G_OBJECT(menu_item),
@@ -1482,68 +1365,64 @@ change_attach_mode(GtkWidget       *menu_item,
 
     /* get the selected element */
     selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(info->bm->tree_view));
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
-        return;
-    }
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+       return;
 
     /* make sure we got the right element */
     gtk_tree_model_get(model, &iter, ATTACH_INFO_COLUMN, &test_info, -1);
     if (test_info != info) {
-        if (test_info) {
-            g_object_unref(test_info);
-        }
-        return;
+       if (test_info)
+           g_object_unref(test_info);
+       return;
     }
     g_object_unref(test_info);
 
     /* verify that the user *really* wants to attach as reference */
-    if ((info->mode != new_mode) && (new_mode == LIBBALSA_ATTACH_AS_EXTBODY)) {
-        GtkWidget *extbody_dialog, *parent;
-        gint result;
-
-        parent = gtk_widget_get_toplevel(menu_item);
-        extbody_dialog =
-            gtk_message_dialog_new(GTK_WINDOW(parent),
-                                   GTK_DIALOG_DESTROY_WITH_PARENT,
-                                   GTK_MESSAGE_QUESTION,
-                                   GTK_BUTTONS_YES_NO,
-                                   _("Saying yes will not send the file "
-                                     "“%s” itself, but just a MIME "
-                                     "message/external-body reference. "
-                                     "Note that the recipient must "
-                                     "have proper permissions to see the "
-                                     "“real” file.\n\n"
-                                     "Do you really want to attach "
-                                     "this file as reference?"),
-                                   libbalsa_vfs_get_uri_utf8(info->file_uri));
+    if (info->mode != new_mode && new_mode == LIBBALSA_ATTACH_AS_EXTBODY) {
+       GtkWidget *extbody_dialog, *parent;
+       gint result;
+
+       parent = gtk_widget_get_toplevel(menu_item);
+       extbody_dialog =
+           gtk_message_dialog_new(GTK_WINDOW(parent),
+                                  GTK_DIALOG_DESTROY_WITH_PARENT,
+                                  GTK_MESSAGE_QUESTION,
+                                  GTK_BUTTONS_YES_NO,
+                                  _("Saying yes will not send the file "
+                                    "“%s” itself, but just a MIME "
+                                    "message/external-body reference. "
+                                    "Note that the recipient must "
+                                    "have proper permissions to see the "
+                                    "“real” file.\n\n"
+                                    "Do you really want to attach "
+                                    "this file as reference?"),
+                                  libbalsa_vfs_get_uri_utf8(info->file_uri));
 #if HAVE_MACOSX_DESKTOP
-        libbalsa_macosx_menu_for_parent(extbody_dialog, GTK_WINDOW(parent));
+       libbalsa_macosx_menu_for_parent(extbody_dialog, GTK_WINDOW(parent));
 #endif
-        gtk_window_set_title(GTK_WINDOW(extbody_dialog),
-                             _("Attach as Reference?"));
-        result = gtk_dialog_run(GTK_DIALOG(extbody_dialog));
-        gtk_widget_destroy(extbody_dialog);
-        if (result != GTK_RESPONSE_YES) {
-            return;
-        }
+       gtk_window_set_title(GTK_WINDOW(extbody_dialog),
+                            _("Attach as Reference?"));
+       result = gtk_dialog_run(GTK_DIALOG(extbody_dialog));
+       gtk_widget_destroy(extbody_dialog);
+       if (result != GTK_RESPONSE_YES)
+           return;
     }
 
     /* change the attachment mode */
     info->mode = new_mode;
     gtk_list_store_set(GTK_LIST_STORE(model), &iter, ATTACH_MODE_COLUMN,
-                       info->mode, -1);
+                      info->mode, -1);
 
     /* set the menu's sensitivities */
     gtk_container_forall(GTK_CONTAINER(gtk_widget_get_parent(menu_item)),
-                         set_attach_menu_sensitivity,
+                        set_attach_menu_sensitivity,
                          GINT_TO_POINTER(info->mode));
 }
 
 
 /* attachment vfs menu - right mouse button callback */
 static void
-attachment_menu_vfs_cb(GtkWidget       *menu_item,
-                       BalsaAttachInfo *info)
+attachment_menu_vfs_cb(GtkWidget * menu_item, BalsaAttachInfo * info)
 {
     GError *err = NULL;
     gboolean result;
@@ -1553,23 +1432,21 @@ attachment_menu_vfs_cb(GtkWidget       *menu_item,
     result = libbalsa_vfs_launch_app(info->file_uri,
                                      G_OBJECT(menu_item),
                                      &err);
-    if (!result) {
+    if (!result)
         balsa_information(LIBBALSA_INFORMATION_WARNING,
                           _("Could not launch application: %s"),
                           err ? err->message : "Unknown error");
-    }
     g_clear_error(&err);
 }
 
 
 /* URL external body - right mouse button callback */
 static void
-on_open_url_cb(GtkWidget       *menu_item,
-               BalsaAttachInfo *info)
+on_open_url_cb(GtkWidget * menu_item, BalsaAttachInfo * info)
 {
     GtkWidget *toplevel;
     GError *err = NULL;
-    const gchar *uri;
+    const gchar * uri;
 
     g_return_if_fail(info != NULL);
     uri = libbalsa_vfs_get_uri(info->file_uri);
@@ -1583,15 +1460,13 @@ on_open_url_cb(GtkWidget       *menu_item,
     }
     if (err) {
         balsa_information(LIBBALSA_INFORMATION_WARNING,
-                          _("Error showing %s: %s\n"),
-                          uri, err->message);
+                         _("Error showing %s: %s\n"),
+                         uri, err->message);
         g_error_free(err);
     }
 }
 
-
-static GtkWidget *sw_attachment_list(BalsaSendmsg *bsmsg);
-
+static GtkWidget * sw_attachment_list(BalsaSendmsg *bsmsg);
 static void
 show_attachment_widget(BalsaSendmsg *bsmsg)
 {
@@ -1632,22 +1507,18 @@ show_attachment_widget(BalsaSendmsg *bsmsg)
     }
 }
 
-
 /* Ask the user for a charset; returns ((LibBalsaCodeset) -1) on cancel. */
 static void
-sw_charset_combo_box_changed(GtkComboBox *combo_box,
-                             GtkWidget   *charset_button)
+sw_charset_combo_box_changed(GtkComboBox * combo_box,
+                             GtkWidget * charset_button)
 {
     gtk_widget_set_sensitive(charset_button,
                              gtk_combo_box_get_active(combo_box) == 0);
 }
 
-
 static LibBalsaCodeset
-sw_get_user_codeset(BalsaSendmsg *bsmsg,
-                    gboolean     *change_type,
-                    const gchar  *mime_type,
-                    const char   *fname)
+sw_get_user_codeset(BalsaSendmsg * bsmsg, gboolean * change_type,
+                    const gchar * mime_type, const char *fname)
 {
     GtkWidget *combo_box = NULL;
     gint codeset = -1;
@@ -1660,9 +1531,9 @@ sw_get_user_codeset(BalsaSendmsg *bsmsg,
                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
                                     NULL);
     gchar *msg = g_strdup_printf
-            (_("File\n%s\nis not encoded in US-ASCII or UTF-8.\n"
-               "Please choose the character set used to encode the file."),
-            fname);
+        (_("File\n%s\nis not encoded in US-ASCII or UTF-8.\n"
+           "Please choose the character set used to encode the file."),
+         fname);
     GtkWidget *info = gtk_label_new(msg);
     GtkWidget *charset_button = libbalsa_charset_button_new();
     GtkBox *content_box;
@@ -1701,49 +1572,41 @@ sw_get_user_codeset(BalsaSendmsg *bsmsg,
     }
 
     if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
-        if (change_type) {
+        if (change_type)
             *change_type =
                 gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box)) != 0;
-        }
-        if (!change_type || !*change_type) {
-            codeset = gtk_combo_box_get_active(GTK_COMBO_BOX(charset_button));
-        }
+        if (!change_type || !*change_type)
+           codeset = gtk_combo_box_get_active(GTK_COMBO_BOX(charset_button));
     }
 
     gtk_widget_destroy(dialog);
     return (LibBalsaCodeset) codeset;
 }
 
-
 static gboolean
-sw_set_charset(BalsaSendmsg *bsmsg,
-               const gchar  *filename,
-               const gchar  *content_type,
-               gboolean     *change_type,
-               gchar       **attach_charset)
+sw_set_charset(BalsaSendmsg * bsmsg, const gchar * filename,
+               const gchar * content_type, gboolean * change_type,
+               gchar ** attach_charset)
 {
     const gchar *charset;
     LibBalsaTextAttribute attr;
 
     attr = libbalsa_text_attr_file(filename);
-    if ((gint) attr < 0) {
+    if ((gint) attr < 0)
         return FALSE;
-    }
 
-    if (attr == 0) {
+    if (attr == 0)
         charset = "us-ascii";
-    } else if (attr & LIBBALSA_TEXT_HI_UTF8) {
+    else if (attr & LIBBALSA_TEXT_HI_UTF8)
         charset = "UTF-8";
-    } else {
+    else {
         LibBalsaCodesetInfo *info;
         LibBalsaCodeset codeset =
             sw_get_user_codeset(bsmsg, change_type, content_type, filename);
-        if (*change_type) {
+        if (*change_type)
             return TRUE;
-        }
-        if (codeset == (LibBalsaCodeset) (-1)) {
+        if (codeset == (LibBalsaCodeset) (-1))
             return FALSE;
-        }
 
         info = &libbalsa_codeset_info[codeset];
         charset = info->std;
@@ -1772,12 +1635,11 @@ get_fwd_mail_headers(const gchar *mailfile)
     LibBalsaMessageHeaders *headers;
 
     /* try to open the mail file */
-    if ((fd = open(mailfile, O_RDONLY)) == -1) {
-        return NULL;
-    }
+    if ((fd = open(mailfile, O_RDONLY)) == -1)
+       return NULL;
     if ((stream = g_mime_stream_fs_new(fd)) == NULL) {
-        close(fd);
-        return NULL;
+       close(fd);
+       return NULL;
     }
 
     /* parse the file */
@@ -1792,17 +1654,16 @@ get_fwd_mail_headers(const gchar *mailfile)
     headers = g_new0(LibBalsaMessageHeaders, 1);
     libbalsa_message_headers_from_gmime(headers, message);
     if (!headers->subject) {
-        const gchar *subject = g_mime_message_get_subject(message);
+       const gchar * subject = g_mime_message_get_subject(message);
 
-        if (!subject) {
-            headers->subject = g_strdup(_("(no subject)"));
-        } else {
-            headers->subject = g_mime_utils_header_decode_text(subject);
-        }
+       if (!subject)
+           headers->subject = g_strdup(_("(no subject)"));
+       else
+           headers->subject = g_mime_utils_header_decode_text(subject);
     }
     libbalsa_utf8_sanitize(&headers->subject,
-                           balsa_app.convert_unknown_8bit,
-                           NULL);
+                          balsa_app.convert_unknown_8bit,
+                          NULL);
 
     /* unref the gmime message and return the information */
     g_object_unref(message);
@@ -1812,14 +1673,12 @@ get_fwd_mail_headers(const gchar *mailfile)
 
 /* add_attachment:
    adds given filename (uri format) to the list.
- */
+*/
 gboolean
-add_attachment(BalsaSendmsg *bsmsg,
-               const gchar  *filename,
-               gboolean      is_a_temp_file,
-               const gchar  *forced_mime_type)
+add_attachment(BalsaSendmsg * bsmsg, const gchar *filename,
+               gboolean is_a_temp_file, const gchar *forced_mime_type)
 {
-    LibbalsaVfs *file_uri;
+    LibbalsaVfs * file_uri;
     GtkTreeModel *model;
     GtkTreeIter iter;
     BalsaAttachInfo *attach_data;
@@ -1831,9 +1690,8 @@ add_attachment(BalsaSendmsg *bsmsg,
     GtkWidget *menu_item;
     gchar *content_desc;
 
-    if (balsa_app.debug) {
-        fprintf(stderr, "Trying to attach '%s'\n", filename);
-    }
+    if (balsa_app.debug)
+       fprintf(stderr, "Trying to attach '%s'\n", filename);
     if (!(file_uri = libbalsa_vfs_new_from_uri(filename))) {
         balsa_information_parented(GTK_WINDOW(bsmsg->window),
                                    LIBBALSA_INFORMATION_ERROR,
@@ -1846,66 +1704,63 @@ add_attachment(BalsaSendmsg *bsmsg,
                                    LIBBALSA_INFORMATION_ERROR,
                                    "%s: %s", filename,
                                    err && err->message ? err->message : _("unknown error"));
-        g_error_free(err);
-        g_object_unref(file_uri);
-        return FALSE;
+       g_error_free(err);
+       g_object_unref(file_uri);
+       return FALSE;
     }
 
     /* get the pixbuf for the attachment's content type */
     is_fwd_message = forced_mime_type &&
-        !g_ascii_strncasecmp(forced_mime_type, "message/", 8) && is_a_temp_file;
-    if (is_fwd_message) {
-        content_type = g_strdup(forced_mime_type);
-    }
+       !g_ascii_strncasecmp(forced_mime_type, "message/", 8) && is_a_temp_file;
+    if (is_fwd_message)
+       content_type = g_strdup(forced_mime_type);
     pixbuf =
         libbalsa_icon_finder(GTK_WIDGET(bsmsg->window), forced_mime_type,
                              file_uri, &content_type, 24);
-    if (!content_type) {
-        /* Last ditch. */
-        content_type = g_strdup("application/octet-stream");
-    }
+    if (!content_type)
+       /* Last ditch. */
+       content_type = g_strdup("application/octet-stream");
 
     /* create a new attachment info block */
     attach_data = balsa_attach_info_new(bsmsg);
     attach_data->charset = NULL;
     if (!g_ascii_strncasecmp(content_type, "text/", 5)) {
-        gboolean change_type = FALSE;
-        if (!sw_set_charset(bsmsg, filename, content_type,
-                            &change_type, &attach_data->charset)) {
-            g_free(content_type);
-            g_object_unref(attach_data);
-            return FALSE;
-        }
-        if (change_type) {
-            forced_mime_type = "application/octet-stream";
-            g_free(content_type);
-            content_type = g_strdup(forced_mime_type);
-        }
+       gboolean change_type = FALSE;
+       if (!sw_set_charset(bsmsg, filename, content_type,
+                           &change_type, &attach_data->charset)) {
+           g_free(content_type);
+           g_object_unref(attach_data);
+           return FALSE;
+       }
+       if (change_type) {
+           forced_mime_type = "application/octet-stream";
+           g_free(content_type);
+           content_type = g_strdup(forced_mime_type);
+       }
     }
 
     if (is_fwd_message) {
-        attach_data->headers = get_fwd_mail_headers(filename);
-        if (!attach_data->headers) {
-            utf8name = g_strdup(_("forwarded message"));
-        } else {
+       attach_data->headers = get_fwd_mail_headers(filename);
+       if (!attach_data->headers)
+           utf8name = g_strdup(_("forwarded message"));
+       else {
             gchar *tmp =
                 internet_address_list_to_string(attach_data->headers->from,
                                                 FALSE);
-            utf8name = g_strdup_printf(_("Message from %s, subject: “%s”"),
-                                       tmp,
-                                       attach_data->headers->subject);
-            g_free(tmp);
-        }
+           utf8name = g_strdup_printf(_("Message from %s, subject: “%s”"),
+                                      tmp,
+                                      attach_data->headers->subject);
+           g_free(tmp);
+       }
     } else {
         const gchar *uri_utf8 = libbalsa_vfs_get_uri_utf8(file_uri);
-        const gchar *home = g_getenv("HOME");
+       const gchar *home = g_getenv("HOME");
 
-        if (home && !strncmp(uri_utf8, "file://", 7) &&
+       if (home && !strncmp(uri_utf8, "file://", 7) &&
             !strncmp(uri_utf8 + 7, home, strlen(home))) {
-            utf8name = g_strdup_printf("~%s", uri_utf8 + 7 + strlen(home));
-        } else {
-            utf8name = g_strdup(uri_utf8);
-        }
+           utf8name = g_strdup_printf("~%s", uri_utf8 + 7 + strlen(home));
+       } else
+           utf8name = g_strdup(uri_utf8);
     }
 
     show_attachment_widget(bsmsg);
@@ -1918,8 +1773,8 @@ add_attachment(BalsaSendmsg *bsmsg,
 
     attach_data->delete_on_destroy = is_a_temp_file;
     can_inline = !is_a_temp_file &&
-        (!g_ascii_strncasecmp(content_type, "text/", 5) ||
-         !g_ascii_strncasecmp(content_type, "image/", 6));
+       (!g_ascii_strncasecmp(content_type, "text/", 5) ||
+        !g_ascii_strncasecmp(content_type, "image/", 6));
     attach_data->mode = LIBBALSA_ATTACH_AS_ATTACHMENT;
 
     /* build the attachment's popup menu */
@@ -1927,75 +1782,74 @@ add_attachment(BalsaSendmsg *bsmsg,
 
     /* only real text/... and image/... parts may be inlined */
     if (can_inline) {
-        menu_item =
-            gtk_menu_item_new_with_label(_(attach_modes
+       menu_item =
+           gtk_menu_item_new_with_label(_(attach_modes
                                            [LIBBALSA_ATTACH_AS_INLINE]));
-        g_object_set_data(G_OBJECT(menu_item), "new-mode",
-                          GINT_TO_POINTER(LIBBALSA_ATTACH_AS_INLINE));
-        g_signal_connect(G_OBJECT(menu_item), "activate",
-                         G_CALLBACK(change_attach_mode),
-                         (gpointer)attach_data);
-        gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
-                              menu_item);
+       g_object_set_data(G_OBJECT(menu_item), "new-mode",
+                         GINT_TO_POINTER(LIBBALSA_ATTACH_AS_INLINE));
+       g_signal_connect(G_OBJECT(menu_item), "activate",
+                        G_CALLBACK(change_attach_mode),
+                        (gpointer)attach_data);
+       gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
+                             menu_item);
     }
 
     /* all real files can be attachments */
     if (can_inline || !is_a_temp_file) {
-        menu_item =
-            gtk_menu_item_new_with_label(_(attach_modes
+       menu_item =
+           gtk_menu_item_new_with_label(_(attach_modes
                                            [LIBBALSA_ATTACH_AS_ATTACHMENT]));
-        gtk_widget_set_sensitive(menu_item, FALSE);
-        g_object_set_data(G_OBJECT(menu_item), "new-mode",
-                          GINT_TO_POINTER(LIBBALSA_ATTACH_AS_ATTACHMENT));
-        g_signal_connect(G_OBJECT(menu_item), "activate",
-                         G_CALLBACK(change_attach_mode),
-                         (gpointer)attach_data);
-        gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
-                              menu_item);
+       gtk_widget_set_sensitive(menu_item, FALSE);
+       g_object_set_data(G_OBJECT(menu_item), "new-mode",
+                         GINT_TO_POINTER(LIBBALSA_ATTACH_AS_ATTACHMENT));
+       g_signal_connect(G_OBJECT(menu_item), "activate",
+                        G_CALLBACK(change_attach_mode),
+                        (gpointer)attach_data);
+       gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
+                             menu_item);
     }
 
     /* real files may be references (external body) */
     if (!is_a_temp_file) {
-        menu_item =
-            gtk_menu_item_new_with_label(_(attach_modes
+       menu_item =
+           gtk_menu_item_new_with_label(_(attach_modes
                                            [LIBBALSA_ATTACH_AS_EXTBODY]));
-        g_object_set_data(G_OBJECT(menu_item), "new-mode",
-                          GINT_TO_POINTER(LIBBALSA_ATTACH_AS_EXTBODY));
-        g_signal_connect(G_OBJECT(menu_item), "activate",
-                         G_CALLBACK(change_attach_mode),
-                         (gpointer)attach_data);
-        gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
-                              menu_item);
+       g_object_set_data(G_OBJECT(menu_item), "new-mode",
+                         GINT_TO_POINTER(LIBBALSA_ATTACH_AS_EXTBODY));
+       g_signal_connect(G_OBJECT(menu_item), "activate",
+                        G_CALLBACK(change_attach_mode),
+                        (gpointer)attach_data);
+       gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
+                             menu_item);
     }
 
     /* an attachment can be removed */
     menu_item =
-        gtk_menu_item_new_with_label(_("Remove"));
+       gtk_menu_item_new_with_label(_("Remove"));
     g_signal_connect(G_OBJECT (menu_item), "activate",
-                     G_CALLBACK(remove_attachment),
-                     (gpointer)attach_data);
+                    G_CALLBACK(remove_attachment),
+                    (gpointer)attach_data);
     gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
-                          menu_item);
+                         menu_item);
 
     /* add the usual vfs menu so the user can inspect what (s)he actually
        attached... (only for non-message attachments) */
-    if (!is_fwd_message) {
-        libbalsa_vfs_fill_menu_by_content_type(GTK_MENU(attach_data->popup_menu),
-                                               content_type,
-                                               G_CALLBACK(attachment_menu_vfs_cb),
-                                               (gpointer)attach_data);
-    }
+    if (!is_fwd_message)
+       libbalsa_vfs_fill_menu_by_content_type(GTK_MENU(attach_data->popup_menu),
+                                              content_type,
+                                              G_CALLBACK(attachment_menu_vfs_cb),
+                                              (gpointer)attach_data);
 
     /* append to the list store */
-    content_desc = libbalsa_vfs_content_description(content_type);
+    content_desc =libbalsa_vfs_content_description(content_type);
     gtk_list_store_set(GTK_LIST_STORE(model), &iter,
-                       ATTACH_INFO_COLUMN, attach_data,
-                       ATTACH_ICON_COLUMN, pixbuf,
-                       ATTACH_TYPE_COLUMN, content_desc,
-                       ATTACH_MODE_COLUMN, attach_data->mode,
-                       ATTACH_SIZE_COLUMN, libbalsa_vfs_get_size(file_uri),
-                       ATTACH_DESC_COLUMN, utf8name,
-                       -1);
+                      ATTACH_INFO_COLUMN, attach_data,
+                      ATTACH_ICON_COLUMN, pixbuf,
+                      ATTACH_TYPE_COLUMN, content_desc,
+                      ATTACH_MODE_COLUMN, attach_data->mode,
+                      ATTACH_SIZE_COLUMN, libbalsa_vfs_get_size(file_uri),
+                      ATTACH_DESC_COLUMN, utf8name,
+                      -1);
     g_object_unref(attach_data);
     g_object_unref(pixbuf);
     g_free(utf8name);
@@ -2005,24 +1859,21 @@ add_attachment(BalsaSendmsg *bsmsg,
     return TRUE;
 }
 
-
 /* add_urlref_attachment:
    adds given url as reference to the to the list.
    frees url.
- */
+*/
 static gboolean
-add_urlref_attachment(BalsaSendmsg *bsmsg,
-                      gchar        *url)
+add_urlref_attachment(BalsaSendmsg * bsmsg, gchar *url)
 {
     GtkTreeModel *model;
     GtkTreeIter iter;
     BalsaAttachInfo *attach_data;
-    GdkPixbuf *pixbuf;
+    GdkPixbuf * pixbuf;
     GtkWidget *menu_item;
 
-    if (balsa_app.debug) {
-        fprintf(stderr, "Trying to attach '%s'\n", url);
-    }
+    if (balsa_app.debug)
+       fprintf(stderr, "Trying to attach '%s'\n", url);
 
     /* get the pixbuf for the attachment's content type */
     pixbuf =
@@ -2046,34 +1897,34 @@ add_urlref_attachment(BalsaSendmsg *bsmsg,
     /* build the attachment's popup menu - may only be removed */
     attach_data->popup_menu = gtk_menu_new();
     menu_item =
-        gtk_menu_item_new_with_label(_("Remove"));
+       gtk_menu_item_new_with_label(_("Remove"));
     g_signal_connect(G_OBJECT (menu_item), "activate",
-                     G_CALLBACK(remove_attachment),
-                     (gpointer)attach_data);
+                    G_CALLBACK(remove_attachment),
+                    (gpointer)attach_data);
     gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
-                          menu_item);
+                         menu_item);
 
     /* add a separator and the usual vfs menu so the user can inspect what
        (s)he actually attached... (only for non-message attachments) */
     gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
-                          gtk_separator_menu_item_new());
+                         gtk_separator_menu_item_new());
     menu_item =
-        gtk_menu_item_new_with_label(_("Open…"));
+       gtk_menu_item_new_with_label(_("Open…"));
     g_signal_connect(G_OBJECT (menu_item), "activate",
-                     G_CALLBACK(on_open_url_cb),
-                     (gpointer)attach_data);
+                    G_CALLBACK(on_open_url_cb),
+                    (gpointer)attach_data);
     gtk_menu_shell_append(GTK_MENU_SHELL(attach_data->popup_menu),
-                          menu_item);
+                         menu_item);
 
     /* append to the list store */
     gtk_list_store_set(GTK_LIST_STORE(model), &iter,
-                       ATTACH_INFO_COLUMN, attach_data,
-                       ATTACH_ICON_COLUMN, pixbuf,
-                       ATTACH_TYPE_COLUMN, _("(URL)"),
-                       ATTACH_MODE_COLUMN, attach_data->mode,
-                       ATTACH_SIZE_COLUMN, 0,
-                       ATTACH_DESC_COLUMN, url,
-                       -1);
+                      ATTACH_INFO_COLUMN, attach_data,
+                      ATTACH_ICON_COLUMN, pixbuf,
+                      ATTACH_TYPE_COLUMN, _("(URL)"),
+                      ATTACH_MODE_COLUMN, attach_data->mode,
+                      ATTACH_SIZE_COLUMN, 0,
+                      ATTACH_DESC_COLUMN, url,
+                      -1);
     g_object_unref(attach_data);
     g_object_unref(pixbuf);
     g_free(url);
@@ -2081,17 +1932,15 @@ add_urlref_attachment(BalsaSendmsg *bsmsg,
     return TRUE;
 }
 
-
 /* attach_dialog_ok:
    processes the attachment file selection. Adds them to the list,
    showing the attachment list, if was hidden.
- */
+*/
 static void
-attach_dialog_response(GtkWidget    *dialog,
-                       gint          response,
-                       BalsaSendmsg *bsmsg)
+attach_dialog_response(GtkWidget * dialog, gint response,
+                      BalsaSendmsg * bsmsg)
 {
-    GtkFileChooser *fc;
+    GtkFileChooser * fc;
     GSList *files, *list;
     int res = 0;
 
@@ -2099,16 +1948,15 @@ attach_dialog_response(GtkWidget    *dialog,
                       "balsa-sendmsg-window-attach-dialog", NULL);
 
     if (response != GTK_RESPONSE_OK) {
-        gtk_widget_destroy(dialog);
-        return;
+       gtk_widget_destroy(dialog);
+       return;
     }
 
     fc = GTK_FILE_CHOOSER(dialog);
     files = gtk_file_chooser_get_uris(fc);
     for (list = files; list; list = list->next) {
-        if (!add_attachment(bsmsg, list->data, FALSE, NULL)) {
-            res++;
-        }
+        if(!add_attachment(bsmsg, list->data, FALSE, NULL))
+           res++;
         g_free(list->data);
     }
 
@@ -2117,14 +1965,12 @@ attach_dialog_response(GtkWidget    *dialog,
     g_free(balsa_app.attach_dir);
     balsa_app.attach_dir = gtk_file_chooser_get_current_folder_uri(fc);
 
-    if (res == 0) {
+    if (res == 0)
         gtk_widget_destroy(dialog);
-    }
 }
 
-
 static GtkFileChooser *
-sw_attach_dialog(BalsaSendmsg *bsmsg)
+sw_attach_dialog(BalsaSendmsg * bsmsg)
 {
     GtkWidget *fsw;
     GtkFileChooser *fc;
@@ -2134,7 +1980,7 @@ sw_attach_dialog(BalsaSendmsg *bsmsg)
                                     GTK_WINDOW(bsmsg->window),
                                     GTK_FILE_CHOOSER_ACTION_OPEN,
                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                    _("_OK"), GTK_RESPONSE_OK,
+                                    _("_OK"),     GTK_RESPONSE_OK,
                                     NULL);
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(fsw, GTK_WINDOW(bsmsg->window));
@@ -2145,47 +1991,42 @@ sw_attach_dialog(BalsaSendmsg *bsmsg)
 
     fc = GTK_FILE_CHOOSER(fsw);
     gtk_file_chooser_set_select_multiple(fc, TRUE);
-    if (balsa_app.attach_dir) {
-        gtk_file_chooser_set_current_folder_uri(fc, balsa_app.attach_dir);
-    }
+    if (balsa_app.attach_dir)
+       gtk_file_chooser_set_current_folder_uri(fc, balsa_app.attach_dir);
 
     g_signal_connect(G_OBJECT(fc), "response",
-                     G_CALLBACK(attach_dialog_response), bsmsg);
+                    G_CALLBACK(attach_dialog_response), bsmsg);
 
     gtk_widget_show(fsw);
 
     return fc;
 }
 
-
 /* attach_clicked - menu callback */
 static void
-sw_attach_file_activated(GSimpleAction *action,
-                         GVariant      *parameter,
-                         gpointer       data)
+sw_attach_file_activated(GSimpleAction * action,
+                         GVariant      * parameter,
+                         gpointer        data)
 {
     BalsaSendmsg *bsmsg = data;
 
     sw_attach_dialog(bsmsg);
 }
 
-
 /* attach_message:
    returns TRUE on success, FALSE on failure.
- */
+*/
 static gboolean
-attach_message(BalsaSendmsg    *bsmsg,
-               LibBalsaMessage *message)
+attach_message(BalsaSendmsg *bsmsg, LibBalsaMessage *message)
 {
     gchar *name, *tmp_file_name;
 
-    if (libbalsa_mktempdir(&tmp_file_name) == FALSE) {
-        return FALSE;
-    }
+    if (libbalsa_mktempdir(&tmp_file_name) == FALSE)
+       return FALSE;
     name = g_strdup_printf("%s/forwarded-message", tmp_file_name);
     g_free(tmp_file_name);
 
-    if (!libbalsa_message_save(message, name)) {
+    if(!libbalsa_message_save(message, name)) {
         g_free(name);
         return FALSE;
     }
@@ -2196,35 +2037,32 @@ attach_message(BalsaSendmsg    *bsmsg,
     return TRUE;
 }
 
-
 static void
-insert_selected_messages(BalsaSendmsg *bsmsg,
-                         QuoteType     type)
+insert_selected_messages(BalsaSendmsg *bsmsg, QuoteType type)
 {
     GtkTextBuffer *buffer =
         gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
     GtkWidget *index =
-        balsa_window_find_current_index(balsa_app.main_window);
+       balsa_window_find_current_index(balsa_app.main_window);
     GList *l;
 
     if (index && (l = balsa_index_selected_list(BALSA_INDEX(index)))) {
-        GList *node;
+       GList *node;
 
-        for (node = l; node != NULL; node = node->next) {
-            LibBalsaMessage *message = node->data;
+       for (node = l; node != NULL; node = node->next) {
+           LibBalsaMessage *message = node->data;
             GString *body = quote_message_body(bsmsg, message, type);
             gtk_text_buffer_insert_at_cursor(buffer, body->str, body->len);
             g_string_free(body, TRUE);
-        }
-        g_list_free_full(l, g_object_unref);
+       }
+       g_list_free_full(l, g_object_unref);
     }
 }
 
-
 static void
-sw_include_messages_activated(GSimpleAction *action,
-                              GVariant      *parameter,
-                              gpointer       data)
+sw_include_messages_activated(GSimpleAction * action,
+                              GVariant      * parameter,
+                              gpointer        data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -2233,63 +2071,60 @@ sw_include_messages_activated(GSimpleAction *action,
 
 
 static void
-sw_attach_messages_activated(GSimpleAction *action,
-                             GVariant      *parameter,
-                             gpointer       data)
+sw_attach_messages_activated(GSimpleAction * action,
+                             GVariant      * parameter,
+                             gpointer        data)
 {
     BalsaSendmsg *bsmsg = data;
     GtkWidget *index =
-        balsa_window_find_current_index(balsa_app.main_window);
+       balsa_window_find_current_index(balsa_app.main_window);
 
     if (index) {
-        GList *node, *l = balsa_index_selected_list(BALSA_INDEX(index));
+       GList *node, *l = balsa_index_selected_list(BALSA_INDEX(index));
 
-        for (node = l; node != NULL; node = node->next) {
-            LibBalsaMessage *message = node->data;
+       for (node = l; node != NULL; node = node->next) {
+           LibBalsaMessage *message = node->data;
 
-            if (!attach_message(bsmsg, message)) {
+           if(!attach_message(bsmsg, message)) {
                 balsa_information_parented(GTK_WINDOW(bsmsg->window),
                                            LIBBALSA_INFORMATION_WARNING,
                                            _("Attaching message failed.\n"
                                              "Possible reason: not enough temporary space"));
                 break;
             }
-        }
-        g_list_free_full(l, g_object_unref);
+       }
+       g_list_free_full(l, g_object_unref);
     }
 }
 
 
 /* attachments_add - attachments field D&D callback */
-static GSList *
+static GSList*
 uri2gslist(const char *uri_list)
 {
-    GSList *list = NULL;
+  GSList *list = NULL;
 
-    while (*uri_list) {
-        char *linebreak = strchr(uri_list, 13);
-        int length;
+  while (*uri_list) {
+    char       *linebreak = strchr(uri_list, 13);
+    int        length;
 
-        if (!linebreak || (linebreak[1] != '\n')) {
-            return list;
-        }
+    if (!linebreak || linebreak[1] != '\n')
+        return list;
 
-        length = linebreak - uri_list;
+    length = linebreak - uri_list;
 
-        if (length && (uri_list[0] != '#')) {
-            gchar *this_uri = g_strndup(uri_list, length);
+    if (length && uri_list[0] != '#') {
+       gchar *this_uri = g_strndup(uri_list, length);
 
-            if (this_uri) {
-                list = g_slist_append(list, this_uri);
-            }
-        }
+       if (this_uri)
+           list = g_slist_append(list, this_uri);
+      }
 
-        uri_list = linebreak + 2;
-    }
-    return list;
+    uri_list = linebreak + 2;
+  }
+  return list;
 }
 
-
 /* Helper: check if the passed parameter contains a valid RFC 2396 URI (leading
  * & trailing whitespaces allowed). Return a newly allocated string with the
  * spaces stripped on success or NULL on fail. Note that the URI may still be
@@ -2305,65 +2140,61 @@ rfc2396_uri(const gchar *instr)
 
     /* check that the string starts with ftp[s]:// or http[s]:// */
     if (g_ascii_strncasecmp(uri, "ftp://";, 6) &&
-        g_ascii_strncasecmp(uri, "ftps://", 7) &&
-        g_ascii_strncasecmp(uri, "http://";, 7) &&
-        g_ascii_strncasecmp(uri, "https://";, 8)) {
-        g_free(uri);
-        return NULL;
+       g_ascii_strncasecmp(uri, "ftps://", 7) &&
+       g_ascii_strncasecmp(uri, "http://";, 7) &&
+       g_ascii_strncasecmp(uri, "https://";, 8)) {
+       g_free(uri);
+       return NULL;
     }
 
     /* verify that the string contains only valid chars (see rfc 2396) */
     s1 = uri + 6;   /* skip verified beginning */
     while (*s1 != '\0') {
-        if (!g_ascii_isalnum(*s1) && !strchr(uri_extra, *s1)) {
-            g_free(uri);
-            return NULL;
-        }
-        s1++;
+       if (!g_ascii_isalnum(*s1) && !strchr(uri_extra, *s1)) {
+           g_free(uri);
+           return NULL;
+       }
+       s1++;
     }
 
     /* success... */
     return uri;
 }
 
-
 static void
-attachments_add(GtkWidget        *widget,
-                GdkDragContext   *context,
-                GtkSelectionData *selection_data,
-                guint32           time,
-                BalsaSendmsg     *bsmsg)
+attachments_add(GtkWidget        * widget,
+               GdkDragContext   * context,
+               GtkSelectionData * selection_data,
+               guint32 time,
+                BalsaSendmsg     * bsmsg)
 {
     const gchar *target;
     gboolean drag_result = TRUE;
 
     target = gtk_selection_data_get_target(selection_data);
-    if (balsa_app.debug) {
+    if (balsa_app.debug)
         printf("attachments_add: target %s\n", target);
-    }
 
     if (target == g_intern_static_string("x-application/x-message-list")) {
-        BalsaIndex *index =
+       BalsaIndex *index =
             *(BalsaIndex **) gtk_selection_data_get_data(selection_data);
-        LibBalsaMailbox *mailbox = index->mailbox_node->mailbox;
+       LibBalsaMailbox *mailbox = index->mailbox_node->mailbox;
         GArray *selected = balsa_index_selected_msgnos_new(index);
-        guint i;
+       guint i;
 
         for (i = 0; i < selected->len; i++) {
-            guint msgno = g_array_index(selected, guint, i);
-            LibBalsaMessage *message =
-                libbalsa_mailbox_get_message(mailbox, msgno);
-            if (!message) {
+           guint msgno = g_array_index(selected, guint, i);
+           LibBalsaMessage *message =
+               libbalsa_mailbox_get_message(mailbox, msgno);
+            if (!message)
                 continue;
-            }
 
-            if (!attach_message(bsmsg, message)) {
+            if(!attach_message(bsmsg, message))
                 balsa_information_parented(GTK_WINDOW(bsmsg->window),
                                            LIBBALSA_INFORMATION_WARNING,
                                            _("Attaching message failed.\n"
                                              "Possible reason: not enough temporary space"));
-            }
-            g_object_unref(message);
+           g_object_unref(message);
         }
         balsa_index_selected_msgnos_free(index, selected);
     } else if (target == g_intern_static_string("text/uri-list")) {
@@ -2371,31 +2202,29 @@ attachments_add(GtkWidget        *widget,
 
         uri_list = uri2gslist((gchar *) gtk_selection_data_get_data(selection_data));
         for (list = uri_list; list != NULL; list = list->next) {
-            add_attachment(bsmsg, list->data, FALSE, NULL);
+           add_attachment(bsmsg, list->data, FALSE, NULL);
             g_free(list->data);
         }
         g_slist_free(uri_list);
-    } else if ((target == g_intern_static_string("STRING")) ||
-               (target == g_intern_static_string("text/plain"))) {
-        gchar *url = rfc2396_uri((gchar *) gtk_selection_data_get_data(selection_data));
+    } else if (target == g_intern_static_string("STRING") ||
+               target == g_intern_static_string("text/plain")) {
+       gchar *url = rfc2396_uri((gchar *) gtk_selection_data_get_data(selection_data));
 
-        if (url) {
-            add_urlref_attachment(bsmsg, url);
-        } else {
-            drag_result = FALSE;
-        }
+       if (url)
+           add_urlref_attachment(bsmsg, url);
+       else
+           drag_result = FALSE;
     }
 
     gtk_drag_finish(context, drag_result, time);
 }
 
-
 /* to_add - address-view D&D callback; we assume it's a To: address */
 static void
-to_add(GtkWidget        *widget,
-       GdkDragContext   *context,
-       GtkSelectionData *selection_data,
-       guint32           time)
+to_add(GtkWidget        * widget,
+       GdkDragContext   * context,
+       GtkSelectionData * selection_data,
+       guint32            time)
 {
     const gchar *target;
     gboolean drag_result = FALSE;
@@ -2408,8 +2237,8 @@ to_add(GtkWidget        *widget,
 
     target = gtk_selection_data_get_target(selection_data);
 
-    if ((target == g_intern_static_string("STRING")) ||
-        (target == g_intern_static_string("text/plain"))) {
+    if (target == g_intern_static_string("STRING") ||
+        target == g_intern_static_string("text/plain")) {
         const gchar *address;
 
         address =
@@ -2420,7 +2249,6 @@ to_add(GtkWidget        *widget,
     gtk_drag_finish(context, drag_result, time);
 }
 
-
 /*
  * static void create_email_or_string_entry()
  *
@@ -2437,18 +2265,17 @@ to_add(GtkWidget        *widget,
 #define BALSA_COMPOSE_ENTRY "balsa-compose-entry"
 
 static void
-create_email_or_string_entry(BalsaSendmsg *bsmsg,
-                             GtkWidget    *grid,
-                             const gchar  *label,
-                             int           y_pos,
-                             GtkWidget    *arr[])
+create_email_or_string_entry(BalsaSendmsg * bsmsg,
+                             GtkWidget    * grid,
+                             const gchar  * label,
+                             int            y_pos,
+                             GtkWidget    * arr[])
 {
     GtkWidget *mnemonic_widget;
 
     mnemonic_widget = arr[1];
-    if (GTK_IS_FRAME(mnemonic_widget)) {
+    if (GTK_IS_FRAME(mnemonic_widget))
         mnemonic_widget = gtk_bin_get_child(GTK_BIN(mnemonic_widget));
-    }
     arr[0] = gtk_label_new_with_mnemonic(label);
     gtk_label_set_mnemonic_widget(GTK_LABEL(arr[0]), mnemonic_widget);
     gtk_widget_set_halign(arr[0], GTK_ALIGN_START);
@@ -2467,7 +2294,7 @@ create_email_or_string_entry(BalsaSendmsg *bsmsg,
         gtk_css_provider_load_from_data(css_provider, css, -1);
         g_free(css);
 
-        gtk_style_context_add_provider(gtk_widget_get_style_context(arr[1]),
+        gtk_style_context_add_provider(gtk_widget_get_style_context(arr[1]) ,
                                        GTK_STYLE_PROVIDER(css_provider),
                                        GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
         g_object_unref(css_provider);
@@ -2491,18 +2318,17 @@ create_email_or_string_entry(BalsaSendmsg *bsmsg,
  *                          - arr[1] will be the entry widget.
  */
 static void
-create_string_entry(BalsaSendmsg *bsmsg,
-                    GtkWidget    *grid,
-                    const gchar  *label,
-                    int           y_pos,
-                    GtkWidget    *arr[])
+create_string_entry(BalsaSendmsg * bsmsg,
+                    GtkWidget    * grid,
+                    const gchar  * label,
+                    int            y_pos,
+                    GtkWidget    * arr[])
 {
     arr[1] = gtk_entry_new();
     gtk_entry_set_max_length(GTK_ENTRY(arr[1]), 2048);
     create_email_or_string_entry(bsmsg, grid, label, y_pos, arr);
 }
 
-
 /*
  * static void create_email_entry()
  *
@@ -2517,14 +2343,14 @@ create_string_entry(BalsaSendmsg *bsmsg,
  */
 
 static void
-create_email_entry(BalsaSendmsg         *bsmsg,
-                   GtkWidget            *grid,
-                   int                   y_pos,
-                   LibBalsaAddressView **view,
-                   GtkWidget           **widget,
-                   const gchar          *label,
-                   const gchar *const   *types,
-                   guint                 n_types)
+create_email_entry(BalsaSendmsg         * bsmsg,
+                   GtkWidget            * grid,
+                   int                    y_pos,
+                   LibBalsaAddressView ** view,
+                   GtkWidget           ** widget,
+                   const gchar          * label,
+                   const gchar * const  * types,
+                   guint                  n_types)
 {
     GtkWidget *scroll;
     GdkContentFormats *formats;
@@ -2535,8 +2361,8 @@ create_email_entry(BalsaSendmsg         *bsmsg,
 
     scroll = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
-                                   GTK_POLICY_AUTOMATIC,
-                                   GTK_POLICY_AUTOMATIC);
+                                  GTK_POLICY_AUTOMATIC,
+                                  GTK_POLICY_AUTOMATIC);
     /* This is a horrible hack, but we need to make sure that the
      * recipient list is more than one line high: */
     gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scroll),
@@ -2552,13 +2378,13 @@ create_email_entry(BalsaSendmsg         *bsmsg,
     g_signal_connect(*view, "drag_data_received",
                      G_CALLBACK(to_add), NULL);
     g_signal_connect(*view, "open-address-book",
-                     G_CALLBACK(address_book_cb), bsmsg);
+                    G_CALLBACK(address_book_cb), bsmsg);
 
     formats = gdk_content_formats_new(email_field_drop_types,
                                       G_N_ELEMENTS(email_field_drop_types));
     gtk_drag_dest_set(GTK_WIDGET(*view), GTK_DEST_DEFAULT_ALL,
-                      formats,
-                      GDK_ACTION_COPY | GDK_ACTION_MOVE);
+                     formats,
+                     GDK_ACTION_COPY | GDK_ACTION_MOVE);
     gdk_content_formats_unref(formats);
 
     libbalsa_address_view_set_domain(*view, bsmsg->ident->domain);
@@ -2566,10 +2392,8 @@ create_email_entry(BalsaSendmsg         *bsmsg,
                              G_CALLBACK(check_readiness), bsmsg);
 }
 
-
 static void
-sw_combo_box_changed(GtkComboBox  *combo_box,
-                     BalsaSendmsg *bsmsg)
+sw_combo_box_changed(GtkComboBox * combo_box, BalsaSendmsg * bsmsg)
 {
     GtkTreeIter iter;
 
@@ -2583,10 +2407,8 @@ sw_combo_box_changed(GtkComboBox  *combo_box,
     }
 }
 
-
 static void
-create_from_entry(GtkWidget    *grid,
-                  BalsaSendmsg *bsmsg)
+create_from_entry(GtkWidget * grid, BalsaSendmsg * bsmsg)
 {
     bsmsg->from[1] =
         libbalsa_identity_combo_box(balsa_app.identities, NULL,
@@ -2594,7 +2416,6 @@ create_from_entry(GtkWidget    *grid,
     create_email_or_string_entry(bsmsg, grid, _("F_rom:"), 0, bsmsg->from);
 }
 
-
 static void
 sw_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
                       gint                  n_press,
@@ -2610,34 +2431,33 @@ sw_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
     gesture = GTK_GESTURE(multi_press);
     event = gtk_gesture_get_last_event(gesture, gtk_gesture_get_last_updated_sequence(gesture));
     g_return_if_fail(event != NULL);
-    if (!gdk_event_triggers_context_menu(event)) {
+    if (!gdk_event_triggers_context_menu(event))
         return;
-    }
 
     tree_view = GTK_TREE_VIEW(gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture)));
 
     if (gtk_tree_view_get_path_at_pos(tree_view, (gint) x, (gint) y,
                                       &path, NULL, NULL, NULL)) {
         GtkTreeIter iter;
-        GtkTreeSelection *selection =
+        GtkTreeSelection * selection =
             gtk_tree_view_get_selection(tree_view);
-        GtkTreeModel *model = gtk_tree_view_get_model(tree_view);
-
-        gtk_tree_selection_unselect_all(selection);
-        gtk_tree_selection_select_path(selection, path);
-        gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree_view), path, NULL,
-                                 FALSE);
-        if (gtk_tree_model_get_iter (model, &iter, path)) {
-            BalsaAttachInfo *attach_info;
-
-            gtk_tree_model_get(model, &iter, ATTACH_INFO_COLUMN, &attach_info, -1);
-            if (attach_info) {
-                if (attach_info->popup_menu) {
+        GtkTreeModel * model = gtk_tree_view_get_model(tree_view);
+
+       gtk_tree_selection_unselect_all(selection);
+       gtk_tree_selection_select_path(selection, path);
+       gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree_view), path, NULL,
+                                FALSE);
+       if (gtk_tree_model_get_iter (model, &iter, path)) {
+           BalsaAttachInfo *attach_info;
+
+           gtk_tree_model_get(model, &iter, ATTACH_INFO_COLUMN, &attach_info, -1);
+           if (attach_info) {
+               if (attach_info->popup_menu) {
                     gtk_menu_popup_at_pointer(GTK_MENU(attach_info->popup_menu),
                                               (GdkEvent *) event);
                 }
-                g_object_unref(attach_info);
-            }
+               g_object_unref(attach_info);
+           }
         }
         gtk_tree_path_free(path);
     }
@@ -2645,27 +2465,25 @@ sw_gesture_pressed_cb(GtkGestureMultiPress *multi_press,
 
 
 static gboolean
-attachment_popup_cb(GtkWidget *widget,
-                    gpointer   user_data)
+attachment_popup_cb(GtkWidget *widget, gpointer user_data)
 {
     GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
     GtkTreeModel *model;
     GtkTreeIter iter;
     BalsaAttachInfo *attach_info;
 
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
-        return FALSE;
-    }
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+       return FALSE;
 
     gtk_tree_model_get(model, &iter, ATTACH_INFO_COLUMN, &attach_info, -1);
     if (attach_info) {
-        if (attach_info->popup_menu) {
+       if (attach_info->popup_menu) {
             gtk_menu_popup_at_widget(GTK_MENU(attach_info->popup_menu),
                                      GTK_WIDGET(widget),
                                      GDK_GRAVITY_CENTER, GDK_GRAVITY_CENTER,
                                      NULL);
         }
-        g_object_unref(attach_info);
+       g_object_unref(attach_info);
     }
 
     return TRUE;
@@ -2673,11 +2491,8 @@ attachment_popup_cb(GtkWidget *widget,
 
 
 static void
-render_attach_mode(GtkTreeViewColumn *column,
-                   GtkCellRenderer   *cell,
-                   GtkTreeModel      *model,
-                   GtkTreeIter       *iter,
-                   gpointer           data)
+render_attach_mode(GtkTreeViewColumn *column, GtkCellRenderer *cell,
+                  GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
 {
     gint mode;
 
@@ -2687,23 +2502,19 @@ render_attach_mode(GtkTreeViewColumn *column,
 
 
 static void
-render_attach_size(GtkTreeViewColumn *column,
-                   GtkCellRenderer   *cell,
-                   GtkTreeModel      *model,
-                   GtkTreeIter       *iter,
-                   gpointer           data)
+render_attach_size(GtkTreeViewColumn *column, GtkCellRenderer *cell,
+                  GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
 {
     gint mode;
     guint64 size;
     gchar *sstr;
 
     gtk_tree_model_get(model, iter, ATTACH_MODE_COLUMN, &mode,
-                       ATTACH_SIZE_COLUMN, &size, -1);
-    if (mode == LIBBALSA_ATTACH_AS_EXTBODY) {
+                      ATTACH_SIZE_COLUMN, &size, -1);
+    if (mode == LIBBALSA_ATTACH_AS_EXTBODY)
         sstr = g_strdup("-");
-    } else {
+    else
         sstr = g_format_size(size);
-    }
     g_object_set(cell, "text", sstr, NULL);
     g_free(sstr);
 }
@@ -2712,9 +2523,9 @@ render_attach_size(GtkTreeViewColumn *column,
 /* create_info_pane
    creates upper panel with the message headers: From, To, ... and
    returns it.
- */
+*/
 static GtkWidget *
-create_info_pane(BalsaSendmsg *bsmsg)
+create_info_pane(BalsaSendmsg * bsmsg)
 {
     guint row = 0;
     GtkWidget *grid;
@@ -2754,9 +2565,8 @@ create_info_pane(BalsaSendmsg *bsmsg)
 #undef REPLY_TO_ROW
 
     /* fcc: mailbox folder where the message copy will be written to */
-    if (!balsa_app.fcc_mru) {
+    if (!balsa_app.fcc_mru)
         balsa_mblist_mru_add(&balsa_app.fcc_mru, balsa_app.sentbox->url);
-    }
     balsa_mblist_mru_add(&balsa_app.fcc_mru, "");
     if (balsa_app.copy_to_sentbox) {
         /* move the NULL option to the bottom */
@@ -2765,10 +2575,9 @@ create_info_pane(BalsaSendmsg *bsmsg)
         balsa_app.fcc_mru = g_list_reverse(balsa_app.fcc_mru);
     }
     if (bsmsg->draft_message && bsmsg->draft_message->headers &&
-        bsmsg->draft_message->headers->fcc_url) {
+       bsmsg->draft_message->headers->fcc_url)
         balsa_mblist_mru_add(&balsa_app.fcc_mru,
                              bsmsg->draft_message->headers->fcc_url);
-    }
     bsmsg->fcc[1] =
         balsa_mblist_mru_option_menu(GTK_WINDOW(bsmsg->window),
                                      &balsa_app.fcc_mru);
@@ -2778,7 +2587,6 @@ create_info_pane(BalsaSendmsg *bsmsg)
     return grid;
 }
 
-
 static GtkWidget *
 sw_attachment_list(BalsaSendmsg *bsmsg)
 {
@@ -2807,19 +2615,19 @@ sw_attachment_list(BalsaSendmsg *bsmsg)
 
     sw = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
-                                   GTK_POLICY_AUTOMATIC,
-                                   GTK_POLICY_AUTOMATIC);
+                                  GTK_POLICY_AUTOMATIC,
+                                  GTK_POLICY_AUTOMATIC);
 
     store = gtk_list_store_new(ATTACH_NUM_COLUMNS,
-                               TYPE_BALSA_ATTACH_INFO,
-                               GDK_TYPE_PIXBUF,
-                               G_TYPE_STRING,
-                               G_TYPE_INT,
-                               G_TYPE_UINT64,
-                               G_TYPE_STRING);
+                              TYPE_BALSA_ATTACH_INFO,
+                              GDK_TYPE_PIXBUF,
+                              G_TYPE_STRING,
+                              G_TYPE_INT,
+                              G_TYPE_UINT64,
+                              G_TYPE_STRING);
 
     bsmsg->tree_view = tree_view =
-            gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
+        gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
     gtk_widget_set_vexpand(tree_view, TRUE);
     view = GTK_TREE_VIEW(tree_view);
     gtk_tree_view_set_headers_visible(view, TRUE);
@@ -2829,26 +2637,26 @@ sw_attachment_list(BalsaSendmsg *bsmsg)
     renderer = gtk_cell_renderer_pixbuf_new();
     g_object_set(G_OBJECT(renderer), "xalign", 0.0, NULL);
     gtk_tree_view_insert_column_with_attributes(view,
-                                                -1, NULL, renderer,
-                                                "pixbuf", ATTACH_ICON_COLUMN,
-                                                NULL);
+                                               -1, NULL, renderer,
+                                               "pixbuf", ATTACH_ICON_COLUMN,
+                                               NULL);
 
     /* column for the mime type */
     renderer = gtk_cell_renderer_text_new();
     g_object_set(G_OBJECT(renderer), "xalign", 0.0, NULL);
     gtk_tree_view_insert_column_with_attributes(view,
-                                                -1, _("Type"), renderer,
-                                                "text", ATTACH_TYPE_COLUMN,
-                                                NULL);
+                                               -1, _("Type"), renderer,
+                                               "text", ATTACH_TYPE_COLUMN,
+                                               NULL);
 
     /* column for the attachment mode */
     renderer = gtk_cell_renderer_text_new();
     g_object_set(G_OBJECT(renderer), "xalign", 0.0, NULL);
     column = gtk_tree_view_column_new_with_attributes(_("Mode"), renderer,
-                                                      "text", ATTACH_MODE_COLUMN,
-                                                      NULL);
+                                                     "text", ATTACH_MODE_COLUMN,
+                                                     NULL);
     gtk_tree_view_column_set_cell_data_func(column,
-                                            renderer, render_attach_mode,
+                                           renderer, render_attach_mode,
                                             NULL, NULL);
     gtk_tree_view_append_column(view, column);
 
@@ -2856,10 +2664,10 @@ sw_attachment_list(BalsaSendmsg *bsmsg)
     renderer = gtk_cell_renderer_text_new();
     g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL);
     column = gtk_tree_view_column_new_with_attributes(_("Size"), renderer,
-                                                      "text", ATTACH_SIZE_COLUMN,
-                                                      NULL);
+                                                     "text", ATTACH_SIZE_COLUMN,
+                                                     NULL);
     gtk_tree_view_column_set_cell_data_func(column,
-                                            renderer, render_attach_size,
+                                           renderer, render_attach_size,
                                             NULL, NULL);
     gtk_tree_view_append_column(view, column);
 
@@ -2867,12 +2675,12 @@ sw_attachment_list(BalsaSendmsg *bsmsg)
     renderer = gtk_cell_renderer_text_new();
     g_object_set(G_OBJECT(renderer), "xalign", 0.0, NULL);
     gtk_tree_view_insert_column_with_attributes(view,
-                                                -1, _("Description"), renderer,
-                                                "text", ATTACH_DESC_COLUMN,
-                                                NULL);
+                                               -1, _("Description"), renderer,
+                                               "text", ATTACH_DESC_COLUMN,
+                                               NULL);
 
     gtk_tree_selection_set_mode(gtk_tree_view_get_selection(view),
-                                GTK_SELECTION_SINGLE);
+                               GTK_SELECTION_SINGLE);
 
     gesture = gtk_gesture_multi_press_new(tree_view);
     gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(gesture), 0);
@@ -2884,12 +2692,12 @@ sw_attachment_list(BalsaSendmsg *bsmsg)
                      G_CALLBACK(attachment_popup_cb), NULL);
 
     g_signal_connect(G_OBJECT(bsmsg->window), "drag_data_received",
-                     G_CALLBACK(attachments_add), bsmsg);
+                    G_CALLBACK(attachments_add), bsmsg);
 
     formats = gdk_content_formats_new(drop_types, G_N_ELEMENTS(drop_types));
     gtk_drag_dest_set(GTK_WIDGET(bsmsg->window), GTK_DEST_DEFAULT_ALL,
-                      formats,
-                      GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
+                     formats,
+                     GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
     gdk_content_formats_unref(formats);
 
     frame = gtk_frame_new(NULL);
@@ -2903,43 +2711,37 @@ sw_attachment_list(BalsaSendmsg *bsmsg)
     return grid;
 }
 
-
 typedef struct {
-    gchar *name;
+    gchar * name;
     gboolean found;
 } has_file_attached_t;
 
 static gboolean
-has_file_attached(GtkTreeModel *model,
-                  GtkTreePath  *path,
-                  GtkTreeIter  *iter,
-                  gpointer      data)
+has_file_attached(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
+                 gpointer data)
 {
     has_file_attached_t *find_file = (has_file_attached_t *)data;
     BalsaAttachInfo *info;
-    const gchar *uri;
+    const gchar * uri;
 
     gtk_tree_model_get(model, iter, ATTACH_INFO_COLUMN, &info, -1);
-    if (!info) {
-        return FALSE;
-    }
+    if (!info)
+       return FALSE;
     uri = libbalsa_vfs_get_uri(info->file_uri);
-    if (g_strcmp0(find_file->name, uri) == 0) {
-        find_file->found = TRUE;
-    }
+    if (g_strcmp0(find_file->name, uri) == 0)
+       find_file->found = TRUE;
     g_object_unref(info);
 
     return find_file->found;
 }
 
-
 /* drag_data_quote - text area D&D callback */
 static void
-drag_data_quote(GtkWidget        *widget,
-                GdkDragContext   *context,
-                GtkSelectionData *selection_data,
-                guint32           time,
-                BalsaSendmsg     *bsmsg)
+drag_data_quote(GtkWidget        * widget,
+                GdkDragContext   * context,
+                GtkSelectionData * selection_data,
+                guint32            time,
+                BalsaSendmsg     * bsmsg)
 {
     const gchar *target;
     GtkTextBuffer *buffer;
@@ -2951,24 +2753,23 @@ drag_data_quote(GtkWidget        *widget,
     target = gtk_selection_data_get_target(selection_data);
 
     if (target == g_intern_static_string(drop_types[TARGET_MESSAGES])) {
-        index =
+       index =
             *(BalsaIndex **) gtk_selection_data_get_data(selection_data);
-        mailbox = index->mailbox_node->mailbox;
+       mailbox = index->mailbox_node->mailbox;
         selected = balsa_index_selected_msgnos_new(index);
-        buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
 
         for (i = 0; i < selected->len; i++) {
-            guint msgno = g_array_index(selected, guint, i);
-            LibBalsaMessage *message;
+           guint msgno = g_array_index(selected, guint, i);
+           LibBalsaMessage *message;
             GString *body;
 
-            message = libbalsa_mailbox_get_message(mailbox, msgno);
-            if (!message) {
+           message = libbalsa_mailbox_get_message(mailbox, msgno);
+            if (!message)
                 continue;
-            }
 
             body = quote_message_body(bsmsg, message, QUOTE_ALL);
-            g_object_unref(message);
+           g_object_unref(message);
             gtk_text_buffer_insert_at_cursor(buffer, body->str, body->len);
             g_string_free(body, TRUE);
         }
@@ -2981,17 +2782,15 @@ drag_data_quote(GtkWidget        *widget,
             /* Since current GtkTextView gets this signal twice for
              * every action (#150141) we need to check for duplicates,
              * which is a good idea anyway. */
-            has_file_attached_t find_file;
+           has_file_attached_t find_file;
 
-            find_file.name = list->data;
-            find_file.found = FALSE;
-            if (bsmsg->tree_view) {
+           find_file.name = list->data;
+           find_file.found = FALSE;
+            if (bsmsg->tree_view)
                 gtk_tree_model_foreach(BALSA_MSG_ATTACH_MODEL(bsmsg),
                                        has_file_attached, &find_file);
-            }
-            if (!find_file.found) {
+            if (!find_file.found)
                 add_attachment(bsmsg, list->data, FALSE, NULL);
-            }
             g_free(list->data);
         }
         g_slist_free(uri_list);
@@ -3000,16 +2799,14 @@ drag_data_quote(GtkWidget        *widget,
     gtk_drag_finish(context, TRUE, time);
 }
 
-
 /* create_text_area
    Creates the text entry part of the compose window.
- */
+*/
 #ifdef HAVE_GTKSOURCEVIEW
 
 static void
-sw_can_undo_cb(GtkSourceBuffer *source_buffer,
-               GParamSpec      *arg1,
-               BalsaSendmsg    *bsmsg)
+sw_can_undo_cb(GtkSourceBuffer * source_buffer, GParamSpec *arg1,
+              BalsaSendmsg * bsmsg)
 {
     gboolean can_undo;
 
@@ -3017,11 +2814,9 @@ sw_can_undo_cb(GtkSourceBuffer *source_buffer,
     sw_action_set_enabled(bsmsg, "undo", can_undo);
 }
 
-
 static void
-sw_can_redo_cb(GtkSourceBuffer *source_buffer,
-               GParamSpec      *arg1,
-               BalsaSendmsg    *bsmsg)
+sw_can_redo_cb(GtkSourceBuffer * source_buffer, GParamSpec *arg1,
+              BalsaSendmsg * bsmsg)
 {
     gboolean can_redo;
 
@@ -3029,20 +2824,19 @@ sw_can_redo_cb(GtkSourceBuffer *source_buffer,
     sw_action_set_enabled(bsmsg, "redo", can_redo);
 }
 
-
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 static GtkWidget *
-create_text_area(BalsaSendmsg *bsmsg)
+create_text_area(BalsaSendmsg * bsmsg)
 {
     GtkTextView *text_view;
     GtkTextBuffer *buffer;
 #if HAVE_GSPELL
     GspellTextBuffer *gspell_buffer;
     GspellChecker *checker;
-#   if HAVE_GSPELL_1_2
+#if HAVE_GSPELL_1_2
     GspellTextView *gspell_view;
-#   endif                       /* HAVE_GSPELL_1_2 */
+#endif                          /* HAVE_GSPELL_1_2 */
 #endif                          /* HAVE_GSPELL */
     GtkWidget *scroll;
     GdkContentFormats *formats;
@@ -3069,7 +2863,7 @@ create_text_area(BalsaSendmsg *bsmsg)
         g_free(css);
 
         gtk_widget_set_name(bsmsg->text, BALSA_COMPOSE_ENTRY);
-        gtk_style_context_add_provider(gtk_widget_get_style_context(bsmsg->text),
+        gtk_style_context_add_provider(gtk_widget_get_style_context(bsmsg->text) ,
                                        GTK_STYLE_PROVIDER(css_provider),
                                        GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
         g_object_unref(css_provider);
@@ -3083,7 +2877,7 @@ create_text_area(BalsaSendmsg *bsmsg)
                      G_CALLBACK(sw_can_redo_cb), bsmsg);
 #else                           /* HAVE_GTKSOURCEVIEW */
     bsmsg->buffer2 =
-        gtk_text_buffer_new(gtk_text_buffer_get_tag_table(buffer));
+         gtk_text_buffer_new(gtk_text_buffer_get_tag_table(buffer));
 #endif                          /* HAVE_GTKSOURCEVIEW */
     gtk_text_buffer_create_tag(buffer, "url", NULL, NULL);
     gtk_text_view_set_editable(text_view, TRUE);
@@ -3096,46 +2890,42 @@ create_text_area(BalsaSendmsg *bsmsg)
         gspell_text_buffer_set_spell_checker(gspell_buffer, checker);
         g_object_unref(checker);
 
-#   if HAVE_GSPELL_1_2
+#if HAVE_GSPELL_1_2
         gspell_view = gspell_text_view_get_from_gtk_text_view(text_view);
         gspell_text_view_set_enable_language_menu(gspell_view, TRUE);
-#   endif                       /* HAVE_GSPELL_1_2 */
+#endif                          /* HAVE_GSPELL_1_2 */
     }
 #endif                          /* HAVE_GSPELL */
 
     scroll = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
-                                   GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
+                                  GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
     gtk_container_add(GTK_CONTAINER(scroll), bsmsg->text);
     g_signal_connect(G_OBJECT(bsmsg->text), "drag_data_received",
-                     G_CALLBACK(drag_data_quote), bsmsg);
+                    G_CALLBACK(drag_data_quote), bsmsg);
 
     formats = gdk_content_formats_new(drop_types, G_N_ELEMENTS(drop_types));
     /* GTK_DEST_DEFAULT_ALL in drag_set would trigger bug 150141 */
     gtk_drag_dest_set(GTK_WIDGET(bsmsg->text), 0,
-                      formats,
-                      GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
+                     formats,
+                     GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
     gdk_content_formats_unref(formats);
 
     return scroll;
 }
 
-
 /* Check whether the string can be converted. */
 static gboolean
-sw_can_convert(const gchar *string,
-               gssize       len,
-               const gchar *to_codeset,
-               const gchar *from_codeset,
-               gchar      **result)
+sw_can_convert(const gchar * string, gssize len,
+               const gchar * to_codeset, const gchar * from_codeset,
+               gchar ** result)
 {
     gsize bytes_read, bytes_written;
     GError *err = NULL;
     gchar *s;
 
-    if (!(to_codeset && from_codeset)) {
+    if (!(to_codeset && from_codeset))
         return FALSE;
-    }
 
     s = g_convert(string, len, to_codeset, from_codeset,
                   &bytes_read, &bytes_written, &err);
@@ -3145,81 +2935,75 @@ sw_can_convert(const gchar *string,
         s = NULL;
     }
 
-    if (result) {
+    if (result)
         *result = s;
-    } else {
+    else
         g_free(s);
-    }
 
     return !err;
 }
 
-
 /* continue_body --------------------------------------------------------
    a short-circuit procedure for the 'Continue action'
    basically copies the first text/plain part over to the entry field.
    Attachments (if any) are saved temporarily in subfolders to preserve
    their original names and then attached again.
    NOTE that rbdy == NULL if message has no text parts.
- */
+*/
 static void
-continue_body(BalsaSendmsg    *bsmsg,
-              LibBalsaMessage *message)
+continue_body(BalsaSendmsg * bsmsg, LibBalsaMessage * message)
 {
     LibBalsaMessageBody *body;
 
     body = message->body_list;
     if (body) {
-        if (libbalsa_message_body_type(body) == LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART) {
-            body = body->parts;
-        }
-        /* if the first part is of type text/plain with a NULL filename, it
-           was the message... */
-        if (body && !body->filename) {
-            GString *rbdy;
-            gchar *body_type = libbalsa_message_body_get_mime_type(body);
+       if (libbalsa_message_body_type(body) == LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART)
+           body = body->parts;
+       /* if the first part is of type text/plain with a NULL filename, it
+          was the message... */
+       if (body && !body->filename) {
+           GString *rbdy;
+           gchar *body_type = libbalsa_message_body_get_mime_type(body);
             gint llen = -1;
             GtkTextBuffer *buffer =
                 gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
 
-            if (bsmsg->flow && libbalsa_message_body_is_flowed(body)) {
+            if (bsmsg->flow && libbalsa_message_body_is_flowed(body))
                 llen = balsa_app.wraplength;
-            }
-            if (!strcmp(body_type, "text/plain") &&
-                (rbdy = process_mime_part(message, body, NULL, llen, FALSE,
+           if (!strcmp(body_type, "text/plain") &&
+               (rbdy = process_mime_part(message, body, NULL, llen, FALSE,
                                           bsmsg->flow))) {
                 gtk_text_buffer_insert_at_cursor(buffer, rbdy->str, rbdy->len);
-                g_string_free(rbdy, TRUE);
-            }
-            g_free(body_type);
-            body = body->next;
-        }
-        while (body) {
-            gchar *name, *body_type, *tmp_file_name;
+               g_string_free(rbdy, TRUE);
+           }
+           g_free(body_type);
+           body = body->next;
+       }
+       while (body) {
+           gchar *name, *body_type, *tmp_file_name;
             GError *err = NULL;
             gboolean res = FALSE;
 
-            if (body->filename) {
-                libbalsa_mktempdir(&tmp_file_name);
-                name = g_strdup_printf("%s/%s", tmp_file_name, body->filename);
-                g_free(tmp_file_name);
-                res = libbalsa_message_body_save(body, name,
+           if (body->filename) {
+               libbalsa_mktempdir(&tmp_file_name);
+               name = g_strdup_printf("%s/%s", tmp_file_name, body->filename);
+               g_free(tmp_file_name);
+               res = libbalsa_message_body_save(body, name,
                                                  LIBBALSA_MESSAGE_BODY_SAFE,
                                                  FALSE, &err);
-            } else {
+           } else {
                 int fd;
 
-                if ((fd = g_file_open_tmp("balsa-continue-XXXXXX", &name, NULL)) > 0) {
-                    GMimeStream *tmp_stream;
+               if ((fd = g_file_open_tmp("balsa-continue-XXXXXX", &name, NULL)) > 0) {
+                    GMimeStream * tmp_stream;
 
-                    if ((tmp_stream = g_mime_stream_fs_new(fd)) != NULL) {
+                    if ((tmp_stream = g_mime_stream_fs_new(fd)) != NULL)
                         res = libbalsa_message_body_save_stream(body, tmp_stream, FALSE, &err);
-                    } else {
+                    else
                         close(fd);
-                    }
                 }
-            }
-            if (!res) {
+           }
+            if(!res) {
                 balsa_information_parented(GTK_WINDOW(bsmsg->window),
                                            LIBBALSA_INFORMATION_ERROR,
                                            _("Could not save attachment: %s"),
@@ -3227,35 +3011,31 @@ continue_body(BalsaSendmsg    *bsmsg,
                 g_clear_error(&err);
                 /* FIXME: do not try any further? */
             }
-            body_type = libbalsa_message_body_get_mime_type(body);
+           body_type = libbalsa_message_body_get_mime_type(body);
             tmp_file_name = g_filename_to_uri(name, NULL, NULL);
             g_free(name);
-            add_attachment(bsmsg, tmp_file_name, TRUE, body_type);
-            g_free(body_type);
-            g_free(tmp_file_name);
-            body = body->next;
-        }
+           add_attachment(bsmsg, tmp_file_name, TRUE, body_type);
+           g_free(body_type);
+           g_free(tmp_file_name);
+           body = body->next;
+       }
     }
 }
 
-
-static gchar *
+static gchar*
 message_part_get_subject(LibBalsaMessageBody *part)
 {
     gchar *subject = NULL;
-    if (part->embhdrs && part->embhdrs->subject) {
+    if(part->embhdrs && part->embhdrs->subject)
         subject = g_strdup(part->embhdrs->subject);
-    } else if (part->message && part->message->subj) {
+    else if(part->message && part->message->subj)
         subject = g_strdup(part->message->subj);
-    } else {
-        subject = g_strdup(_("No subject"));
-    }
+    else subject = g_strdup(_("No subject"));
     libbalsa_utf8_sanitize(&subject, balsa_app.convert_unknown_8bit,
-                           NULL);
+                          NULL);
     return subject;
 }
 
-
 /* --- stuff for collecting parts for a reply --- */
 
 enum {
@@ -3266,186 +3046,165 @@ enum {
 };
 
 static void
-tree_add_quote_body(LibBalsaMessageBody *body,
-                    GtkTreeStore        *store,
-                    GtkTreeIter         *parent)
+tree_add_quote_body(LibBalsaMessageBody * body, GtkTreeStore * store, GtkTreeIter * parent)
 {
     GtkTreeIter iter;
-    gchar *mime_type = libbalsa_message_body_get_mime_type(body);
-    const gchar *disp_type;
+    gchar * mime_type = libbalsa_message_body_get_mime_type(body);
+    const gchar * disp_type;
     static gboolean preselect;
-    gchar *description;
+    gchar * description;
 
     gtk_tree_store_append(store, &iter, parent);
-    if (body->mime_part) {
-        disp_type = g_mime_object_get_disposition(body->mime_part);
-    } else {
-        disp_type = NULL;
-    }
+    if (body->mime_part)
+       disp_type = g_mime_object_get_disposition(body->mime_part);
+    else
+       disp_type = NULL;
     /* cppcheck-suppress nullPointer */
     preselect = !disp_type || *disp_type == '\0' ||
-        !g_ascii_strcasecmp(disp_type, "inline");
+       !g_ascii_strcasecmp(disp_type, "inline");
     if (body->filename && *body->filename) {
-        if (preselect) {
+        if (preselect)
             description = g_strdup_printf(_("inlined file “%s” (%s)"),
                                           body->filename, mime_type);
-        } else {
+        else
             description = g_strdup_printf(_("attached file “%s” (%s)"),
                                           body->filename, mime_type);
-        }
     } else {
-        if (preselect) {
+        if (preselect)
             description = g_strdup_printf(_("inlined %s part"), mime_type);
-        } else {
+        else
             description = g_strdup_printf(_("attached %s part"), mime_type);
-        }
     }
     g_free(mime_type);
     gtk_tree_store_set(store, &iter,
-                       QUOTE_INCLUDE, preselect,
-                       QUOTE_DESCRIPTION, description,
-                       QUOTE_BODY, body,
-                       -1);
+                      QUOTE_INCLUDE, preselect,
+                      QUOTE_DESCRIPTION, description,
+                      QUOTE_BODY, body,
+                      -1);
     g_free(description);
 }
 
-
 static gint
-scan_bodies(GtkTreeStore        *bodies,
-            GtkTreeIter         *parent,
-            LibBalsaMessageBody *body,
-            gboolean             ignore_html,
-            gboolean             container_mp_alt)
+scan_bodies(GtkTreeStore * bodies, GtkTreeIter * parent, LibBalsaMessageBody * body,
+           gboolean ignore_html, gboolean container_mp_alt)
 {
-    gchar *mime_type;
+    gchar * mime_type;
     gint count = 0;
 
     while (body) {
-        switch (libbalsa_message_body_type(body)) {
-        case LIBBALSA_MESSAGE_BODY_TYPE_TEXT:
-        {
-            LibBalsaHTMLType html_type;
-
-            mime_type = libbalsa_message_body_get_mime_type(body);
-            html_type = libbalsa_html_type(mime_type);
-            g_free(mime_type);
-
-            /* On a multipart/alternative, ignore_html defines if html or
-             * non-html parts will be added. Eject from the container when
-             * the first part has been found.
-             * Otherwise, select all text parts. */
-            if (container_mp_alt) {
-                if ((ignore_html && (html_type == LIBBALSA_HTML_TYPE_NONE)) ||
-                    (!ignore_html && (html_type != LIBBALSA_HTML_TYPE_NONE))) {
-                    tree_add_quote_body(body, bodies, parent);
-                    return count + 1;
-                }
-            } else {
-                tree_add_quote_body(body, bodies, parent);
-                count++;
-            }
-            break;
-        }
-
-        case LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART:
-            mime_type = libbalsa_message_body_get_mime_type(body);
-            count += scan_bodies(bodies, parent, body->parts, ignore_html,
-                                 !g_ascii_strcasecmp(mime_type, "multipart/alternative"));
-            g_free(mime_type);
-            break;
-
-        case LIBBALSA_MESSAGE_BODY_TYPE_MESSAGE:
-        {
-            GtkTreeIter iter;
-            gchar *description = NULL;
-
-            mime_type = libbalsa_message_body_get_mime_type(body);
-            if ((g_ascii_strcasecmp(mime_type, "message/rfc822") == 0) &&
-                body->embhdrs) {
-                gchar *from = balsa_message_sender_to_gchar(body->embhdrs->from, 0);
-                gchar *subj = g_strdup(body->embhdrs->subject);
-
-
-                libbalsa_utf8_sanitize(&from, balsa_app.convert_unknown_8bit, NULL);
-                libbalsa_utf8_sanitize(&subj, balsa_app.convert_unknown_8bit, NULL);
-                description =
-                    g_strdup_printf(_("message from %s, subject “%s”"),
-                                    from, subj);
-                g_free(from);
-                g_free(subj);
-            } else {
-                description = g_strdup(mime_type);
-            }
-
-            gtk_tree_store_append(bodies, &iter, parent);
-            gtk_tree_store_set(bodies, &iter,
-                               QUOTE_INCLUDE, FALSE,
-                               QUOTE_DESCRIPTION, description,
-                               QUOTE_BODY, NULL,
-                               -1);
-            g_free(mime_type);
-            g_free(description);
-            count += scan_bodies(bodies, &iter, body->parts, ignore_html, 0);
-        }
-
-        default:
-            break;
-        }
-
-        body = body->next;
+       switch (libbalsa_message_body_type(body)) {
+       case LIBBALSA_MESSAGE_BODY_TYPE_TEXT:
+           {
+               LibBalsaHTMLType html_type;
+
+               mime_type = libbalsa_message_body_get_mime_type(body);
+               html_type = libbalsa_html_type(mime_type);
+               g_free(mime_type);
+
+               /* On a multipart/alternative, ignore_html defines if html or
+                * non-html parts will be added. Eject from the container when
+                * the first part has been found.
+                * Otherwise, select all text parts. */
+               if (container_mp_alt) {
+                   if ((ignore_html && html_type == LIBBALSA_HTML_TYPE_NONE) ||
+                       (!ignore_html && html_type != LIBBALSA_HTML_TYPE_NONE)) {
+                       tree_add_quote_body(body, bodies, parent);
+                       return count + 1;
+                   }
+               } else {
+                   tree_add_quote_body(body, bodies, parent);
+                   count++;
+               }
+               break;
+           }
+
+       case LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART:
+           mime_type = libbalsa_message_body_get_mime_type(body);
+           count += scan_bodies(bodies, parent, body->parts, ignore_html,
+                                !g_ascii_strcasecmp(mime_type, "multipart/alternative"));
+           g_free(mime_type);
+           break;
+
+       case LIBBALSA_MESSAGE_BODY_TYPE_MESSAGE:
+           {
+               GtkTreeIter iter;
+               gchar * description = NULL;
+
+               mime_type = libbalsa_message_body_get_mime_type(body);
+               if (g_ascii_strcasecmp(mime_type, "message/rfc822") == 0 &&
+                   body->embhdrs) {
+                   gchar *from = balsa_message_sender_to_gchar(body->embhdrs->from, 0);
+                   gchar *subj = g_strdup(body->embhdrs->subject);
+
+
+                   libbalsa_utf8_sanitize(&from, balsa_app.convert_unknown_8bit, NULL);
+                   libbalsa_utf8_sanitize(&subj, balsa_app.convert_unknown_8bit, NULL);
+                   description =
+                       g_strdup_printf(_("message from %s, subject “%s”"),
+                                       from, subj);
+                   g_free(from);
+                   g_free(subj);
+               } else
+                   description = g_strdup(mime_type);
+
+               gtk_tree_store_append(bodies, &iter, parent);
+               gtk_tree_store_set(bodies, &iter,
+                                  QUOTE_INCLUDE, FALSE,
+                                  QUOTE_DESCRIPTION, description,
+                                  QUOTE_BODY, NULL,
+                                  -1);
+               g_free(mime_type);
+               g_free(description);
+               count += scan_bodies(bodies, &iter, body->parts, ignore_html, 0);
+           }
+
+       default:
+           break;
+       }
+
+       body = body->next;
     }
 
     return count;
 }
 
-
 static void
-set_all_cells(GtkTreeModel  *model,
-              GtkTreeIter   *iter,
-              const gboolean value)
+set_all_cells(GtkTreeModel * model, GtkTreeIter * iter, const gboolean value)
 {
     do {
-        GtkTreeIter children;
+       GtkTreeIter children;
 
-        if (gtk_tree_model_iter_children(model, &children, iter)) {
-            set_all_cells(model, &children, value);
-        }
-        gtk_tree_store_set(GTK_TREE_STORE(model), iter, QUOTE_INCLUDE, value, -1);
+       if (gtk_tree_model_iter_children(model, &children, iter))
+           set_all_cells(model, &children, value);
+       gtk_tree_store_set(GTK_TREE_STORE(model), iter, QUOTE_INCLUDE, value, -1);
     } while (gtk_tree_model_iter_next(model, iter));
 }
 
-
 static gboolean
-calculate_expander_toggles(GtkTreeModel *model,
-                           GtkTreeIter  *iter)
+calculate_expander_toggles(GtkTreeModel * model, GtkTreeIter * iter)
 {
     gint count, on;
 
     count = on = 0;
     do {
-        GtkTreeIter children;
-        gboolean value;
-
-        if (gtk_tree_model_iter_children(model, &children, iter)) {
-            value = calculate_expander_toggles(model, &children);
-            gtk_tree_store_set(GTK_TREE_STORE(model), iter, QUOTE_INCLUDE, value, -1);
-        } else {
-            gtk_tree_model_get(model, iter, QUOTE_INCLUDE, &value, -1);
-        }
-        if (value) {
-            on++;
-        }
-        count++;
+       GtkTreeIter children;
+       gboolean value;
+
+       if (gtk_tree_model_iter_children(model, &children, iter)) {
+           value = calculate_expander_toggles(model, &children);
+           gtk_tree_store_set(GTK_TREE_STORE(model), iter, QUOTE_INCLUDE, value, -1);
+       } else
+           gtk_tree_model_get(model, iter, QUOTE_INCLUDE, &value, -1);
+       if (value)
+           on++;
+       count++;
     } while (gtk_tree_model_iter_next(model, iter));
 
     return count == on;
 }
 
-
 static void
-cell_toggled_cb(GtkCellRendererToggle *cell,
-                gchar                 *path_str,
-                GtkTreeView           *treeview)
+cell_toggled_cb(GtkCellRendererToggle *cell, gchar *path_str, GtkTreeView *treeview)
 {
     GtkTreeModel *model = NULL;
     GtkTreePath *path;
@@ -3454,94 +3213,80 @@ cell_toggled_cb(GtkCellRendererToggle *cell,
     gboolean active;
 
     g_return_if_fail (GTK_IS_TREE_VIEW (treeview));
-    if (!(model = gtk_tree_view_get_model(treeview))) {
-        return;
-    }
+    if (!(model = gtk_tree_view_get_model(treeview)))
+       return;
 
     path = gtk_tree_path_new_from_string(path_str);
-    if (!gtk_tree_model_get_iter(model, &iter, path)) {
-        return;
-    }
+    if (!gtk_tree_model_get_iter(model, &iter, path))
+       return;
     gtk_tree_path_free(path);
 
     gtk_tree_model_get(model, &iter,
-                       QUOTE_INCLUDE, &active,
-                       -1);
+                      QUOTE_INCLUDE, &active,
+                      -1);
     gtk_tree_store_set(GTK_TREE_STORE (model), &iter,
-                       QUOTE_INCLUDE, !active,
-                       -1);
-    if (gtk_tree_model_iter_children(model, &children, &iter)) {
-        set_all_cells(model, &children, !active);
-    }
+                      QUOTE_INCLUDE, !active,
+                      -1);
+    if (gtk_tree_model_iter_children(model, &children, &iter))
+       set_all_cells(model, &children, !active);
     gtk_tree_model_get_iter_first(model, &children);
     calculate_expander_toggles(model, &children);
 }
 
-
 static void
-append_parts(GString         *q_body,
-             LibBalsaMessage *message,
-             GtkTreeModel    *model,
-             GtkTreeIter     *iter,
-             const gchar     *from_msg,
-             gchar           *reply_prefix_str,
-             gint             llen,
-             gboolean         flow)
+append_parts(GString * q_body, LibBalsaMessage *message, GtkTreeModel * model,
+            GtkTreeIter * iter, const gchar * from_msg, gchar * reply_prefix_str,
+            gint llen, gboolean flow)
 {
     gboolean used_from_msg = FALSE;
 
     do {
-        GtkTreeIter children;
-
-        if (gtk_tree_model_iter_children(model, &children, iter)) {
-            gchar *description;
-
-            gtk_tree_model_get(model, iter, QUOTE_DESCRIPTION, &description, -1);
-            append_parts(q_body, message, model, &children, description,
-                         reply_prefix_str, llen, flow);
-            g_free(description);
-        } else {
-            gboolean do_include;
-
-            gtk_tree_model_get(model, iter, QUOTE_INCLUDE, &do_include, -1);
-            if (do_include) {
-                LibBalsaMessageBody *this_body;
-
-                gtk_tree_model_get(model, iter, QUOTE_BODY, &this_body, -1);
-                if (this_body) {
-                    GString *this_part;
-                    this_part = process_mime_part(message, this_body,
-                                                  reply_prefix_str, llen,
-                                                  FALSE, flow);
-
-                    if ((q_body->len > 0) && (q_body->str[q_body->len - 1] != '\n')) {
-                        g_string_append_c(q_body, '\n');
-                    }
-                    if (!used_from_msg && from_msg) {
-                        g_string_append_printf(q_body, "\n======%s %s======\n", _(
-                                                   "quoted"), from_msg);
-                        used_from_msg = TRUE;
-                    } else if (q_body->len > 0) {
-                        if (this_body->filename) {
-                            g_string_append_printf(q_body, "\n------%s “%s”------\n",
-                                                   _("quoted attachment"), this_body->filename);
-                        } else {
-                            g_string_append_printf(q_body, "\n------%s------\n",
-                                                   _("quoted attachment"));
-                        }
-                    }
-                    g_string_append(q_body, this_part->str);
-                    g_string_free(this_part, TRUE);
-                }
-            }
-        }
+       GtkTreeIter children;
+
+       if (gtk_tree_model_iter_children(model, &children, iter)) {
+           gchar * description;
+
+           gtk_tree_model_get(model, iter, QUOTE_DESCRIPTION, &description, -1);
+           append_parts(q_body, message, model, &children, description,
+                        reply_prefix_str, llen, flow);
+           g_free(description);
+       } else {
+           gboolean do_include;
+
+           gtk_tree_model_get(model, iter, QUOTE_INCLUDE, &do_include, -1);
+           if (do_include) {
+               LibBalsaMessageBody *this_body;
+
+               gtk_tree_model_get(model, iter, QUOTE_BODY, &this_body, -1);
+               if (this_body) {
+                   GString * this_part;
+                   this_part= process_mime_part(message, this_body,
+                                                 reply_prefix_str, llen,
+                                                 FALSE, flow);
+
+                   if (q_body->len > 0 && q_body->str[q_body->len - 1] != '\n')
+                       g_string_append_c(q_body, '\n');
+                   if (!used_from_msg && from_msg) {
+                       g_string_append_printf(q_body, "\n======%s %s======\n", _("quoted"), from_msg);
+                       used_from_msg = TRUE;
+                   } else if (q_body->len > 0) {
+                       if (this_body->filename)
+                           g_string_append_printf(q_body, "\n------%s “%s”------\n",
+                                                  _("quoted attachment"), this_body->filename);
+                       else
+                           g_string_append_printf(q_body, "\n------%s------\n",
+                                                  _("quoted attachment"));
+                   }
+                   g_string_append(q_body, this_part->str);
+                   g_string_free(this_part, TRUE);
+               }
+           }
+       }
     } while (gtk_tree_model_iter_next(model, iter));
 }
 
-
 static gboolean
-quote_parts_select_dlg(GtkTreeStore *tree_store,
-                       GtkWindow    *parent)
+quote_parts_select_dlg(GtkTreeStore *tree_store, GtkWindow * parent)
 {
     GtkWidget *dialog;
     GtkWidget *label;
@@ -3557,12 +3302,12 @@ quote_parts_select_dlg(GtkTreeStore *tree_store,
     GtkBox *content_box;
 
     dialog = gtk_dialog_new_with_buttons(_("Select parts for quotation"),
-                                         parent,
-                                         GTK_DIALOG_DESTROY_WITH_PARENT |
+                                        parent,
+                                        GTK_DIALOG_DESTROY_WITH_PARENT |
                                          libbalsa_dialog_flags(),
-                                         _("_OK"), GTK_RESPONSE_OK,
-                                         _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                         NULL);
+                                        _("_OK"), GTK_RESPONSE_OK,
+                                        _("_Cancel"), GTK_RESPONSE_CANCEL,
+                                        NULL);
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(dialog, parent);
 #endif
@@ -3608,14 +3353,14 @@ quote_parts_select_dlg(GtkTreeStore *tree_store,
     gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree_view), FALSE);
     renderer = gtk_cell_renderer_toggle_new();
     g_signal_connect(renderer, "toggled", G_CALLBACK(cell_toggled_cb),
-                     tree_view);
+                    tree_view);
     column = gtk_tree_view_column_new_with_attributes(NULL, renderer,
-                                                      "active", QUOTE_INCLUDE,
+                                                     "active", QUOTE_INCLUDE,
                                                       NULL);
     gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
     gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree_view), column);
     column = gtk_tree_view_column_new_with_attributes(NULL, gtk_cell_renderer_text_new(),
-                                                      "text", QUOTE_DESCRIPTION,
+                                                     "text", QUOTE_DESCRIPTION,
                                                       NULL);
     gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
     gtk_tree_view_expand_all(GTK_TREE_VIEW(tree_view));
@@ -3629,41 +3374,35 @@ quote_parts_select_dlg(GtkTreeStore *tree_store,
     return result;
 }
 
-
 static gboolean
-tree_find_single_part(GtkTreeModel *model,
-                      GtkTreePath  *path,
-                      GtkTreeIter  *iter,
-                      gpointer      data)
+tree_find_single_part(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
+                     gpointer data)
 {
-    LibBalsaMessageBody **this_body = (LibBalsaMessageBody **) data;
+    LibBalsaMessageBody ** this_body = (LibBalsaMessageBody **) data;
 
     gtk_tree_model_get(model, iter, QUOTE_BODY, this_body, -1);
-    if (*this_body) {
-        return TRUE;
-    } else {
-        return FALSE;
-    }
+    if (*this_body)
+       return TRUE;
+    else
+       return FALSE;
 }
 
-
 static GString *
-collect_for_quote(BalsaSendmsg        *bsmsg,
-                  LibBalsaMessageBody *root,
-                  gchar               *reply_prefix_str,
-                  gint                 llen,
-                  gboolean             ignore_html,
-                  gboolean             flow)
-{
-    GtkTreeStore *tree_store;
+collect_for_quote(BalsaSendmsg        * bsmsg,
+                  LibBalsaMessageBody * root,
+                  gchar               * reply_prefix_str,
+                  gint                  llen,
+                  gboolean              ignore_html,
+                  gboolean              flow)
+{
+    GtkTreeStore * tree_store;
     gint text_bodies;
     LibBalsaMessage *message;
     GString *q_body = NULL;
 
 
-    if (!root) {
+    if (!root)
         return q_body;
-    }
 
     message = root->message;
     libbalsa_message_body_ref(message, FALSE, FALSE);
@@ -3671,29 +3410,28 @@ collect_for_quote(BalsaSendmsg        *bsmsg,
     /* scan the message and collect text parts which might be included
      * in the reply, and if there is only one return this part */
     tree_store = gtk_tree_store_new(QOUTE_NUM_ELEMS,
-                                    G_TYPE_BOOLEAN, G_TYPE_STRING,
-                                    G_TYPE_POINTER);
+                                   G_TYPE_BOOLEAN, G_TYPE_STRING,
+                                   G_TYPE_POINTER);
     text_bodies = scan_bodies(tree_store, NULL, root, ignore_html, FALSE);
     if (text_bodies == 1) {
-        /* note: the only text body may be buried in an attached message, so
-         * we have to search the tree store... */
-        LibBalsaMessageBody *this_body;
-
-        gtk_tree_model_foreach(GTK_TREE_MODEL(tree_store), tree_find_single_part,
-                               &this_body);
-        if (this_body) {
-            q_body = process_mime_part(message, this_body, reply_prefix_str,
-                                       llen, FALSE, flow);
-        }
+       /* note: the only text body may be buried in an attached message, so
+        * we have to search the tree store... */
+       LibBalsaMessageBody *this_body;
+
+       gtk_tree_model_foreach(GTK_TREE_MODEL(tree_store), tree_find_single_part,
+                              &this_body);
+       if (this_body)
+           q_body = process_mime_part(message, this_body, reply_prefix_str,
+                                      llen, FALSE, flow);
     } else if (text_bodies > 1) {
-        if (quote_parts_select_dlg(tree_store, GTK_WINDOW(bsmsg->window))) {
-            GtkTreeIter iter;
+       if (quote_parts_select_dlg(tree_store, GTK_WINDOW(bsmsg->window))) {
+           GtkTreeIter iter;
 
-            q_body = g_string_new("");
-            gtk_tree_model_get_iter_first(GTK_TREE_MODEL(tree_store), &iter);
-            append_parts(q_body, message, GTK_TREE_MODEL(tree_store), &iter, NULL,
-                         reply_prefix_str, llen, flow);
-        }
+           q_body = g_string_new("");
+           gtk_tree_model_get_iter_first(GTK_TREE_MODEL(tree_store), &iter);
+           append_parts(q_body, message, GTK_TREE_MODEL(tree_store), &iter, NULL,
+                        reply_prefix_str, llen, flow);
+       }
     }
 
     /* clean up */
@@ -3708,14 +3446,11 @@ collect_for_quote(BalsaSendmsg        *bsmsg,
    Use GString to optimize memory usage.
    Specifying type explicitly allows for later message quoting when
    eg. a new message is composed.
- */
+*/
 static GString *
-quote_body(BalsaSendmsg           *bsmsg,
-           LibBalsaMessageHeaders *headers,
-           const gchar            *message_id,
-           GList                  *references,
-           LibBalsaMessageBody    *root,
-           QuoteType               qtype)
+quote_body(BalsaSendmsg * bsmsg, LibBalsaMessageHeaders *headers,
+           const gchar *message_id, GList *references,
+           LibBalsaMessageBody *root, QuoteType qtype)
 {
     GString *body;
     gchar *str, *date = NULL;
@@ -3725,105 +3460,98 @@ quote_body(BalsaSendmsg           *bsmsg,
     g_return_val_if_fail(headers, NULL);
 
     if (headers->from &&
-        (orig_address =
-             libbalsa_address_get_name_from_list(headers->from))) {
+       (orig_address =
+        libbalsa_address_get_name_from_list(headers->from))) {
         personStr = g_strdup(orig_address);
         libbalsa_utf8_sanitize(&personStr,
                                balsa_app.convert_unknown_8bit,
                                NULL);
-    } else {
+    } else
         personStr = g_strdup(_("you"));
-    }
 
-    if (headers->date) {
+    if (headers->date)
         date = libbalsa_message_headers_date_to_utf8(headers,
                                                      balsa_app.date_string);
-    }
 
     if (qtype == QUOTE_HEADERS) {
-        gchar *subject;
-
-        str = g_strdup_printf(_("------forwarded message from %s------\n"),
-                              personStr);
-        body = g_string_new(str);
-        g_free(str);
-
-        if (date) {
-            g_string_append_printf(body, "%s %s\n", _("Date:"), date);
-        }
-
-        subject = message_part_get_subject(root);
-        if (subject) {
-            g_string_append_printf(body, "%s %s\n", _("Subject:"), subject);
-        }
-        g_free(subject);
-
-        if (headers->from) {
-            gchar *from =
-                internet_address_list_to_string(headers->from,
-                                                FALSE);
-            g_string_append_printf(body, "%s %s\n", _("From:"), from);
-            g_free(from);
-        }
-
-        if (internet_address_list_length(headers->to_list) > 0) {
-            gchar *to_list =
-                internet_address_list_to_string(headers->to_list,
-                                                FALSE);
-            g_string_append_printf(body, "%s %s\n", _("To:"), to_list);
-            g_free(to_list);
-        }
-
-        if (internet_address_list_length(headers->cc_list) > 0) {
-            gchar *cc_list =
-                internet_address_list_to_string(headers->cc_list,
-                                                FALSE);
-            g_string_append_printf(body, "%s %s\n", _("CC:"), cc_list);
-            g_free(cc_list);
-        }
-
-        g_string_append_printf(body, _("Message-ID: %s\n"),
+       gchar *subject;
+
+       str = g_strdup_printf(_("------forwarded message from %s------\n"),
+                             personStr);
+       body = g_string_new(str);
+       g_free(str);
+
+       if (date)
+           g_string_append_printf(body, "%s %s\n", _("Date:"), date);
+
+       subject = message_part_get_subject(root);
+       if (subject)
+           g_string_append_printf(body, "%s %s\n", _("Subject:"), subject);
+       g_free(subject);
+
+       if (headers->from) {
+           gchar *from =
+               internet_address_list_to_string(headers->from,
+                                               FALSE);
+           g_string_append_printf(body, "%s %s\n", _("From:"), from);
+           g_free(from);
+       }
+
+       if (internet_address_list_length(headers->to_list) > 0) {
+           gchar *to_list =
+               internet_address_list_to_string(headers->to_list,
+                                               FALSE);
+           g_string_append_printf(body, "%s %s\n", _("To:"), to_list);
+           g_free(to_list);
+       }
+
+       if (internet_address_list_length(headers->cc_list) > 0) {
+           gchar *cc_list =
+               internet_address_list_to_string(headers->cc_list,
+                                               FALSE);
+           g_string_append_printf(body, "%s %s\n", _("CC:"), cc_list);
+           g_free(cc_list);
+       }
+
+       g_string_append_printf(body, _("Message-ID: %s\n"),
                                message_id);
 
-        if (references) {
-            GList *ref_list;
+       if (references) {
+           GList *ref_list;
 
-            g_string_append(body, _("References:"));
+           g_string_append(body, _("References:"));
 
-            for (ref_list = references; ref_list != NULL;
-                 ref_list = ref_list->next) {
-                g_string_append_printf(body, " <%s>",
-                                       (gchar *) ref_list->data);
-            }
+           for (ref_list = references; ref_list != NULL;
+                 ref_list = ref_list->next)
+               g_string_append_printf(body, " <%s>",
+                                      (gchar *) ref_list->data);
 
-            g_string_append_c(body, '\n');
-        }
+           g_string_append_c(body, '\n');
+       }
     } else {
-        if (date) {
-            str = g_strdup_printf(_("On %s, %s wrote:\n"), date, personStr);
-        } else {
-            str = g_strdup_printf(_("%s wrote:\n"), personStr);
-        }
-
-        /* scan the message and collect text parts which might be included
-         * in the reply */
-        body = collect_for_quote(bsmsg, root,
-                                 qtype == QUOTE_ALL ? balsa_app.quote_str : NULL,
-                                 bsmsg->flow ? -1 : balsa_app.wraplength,
-                                 balsa_app.reply_strip_html, bsmsg->flow);
-        if (body) {
-            gchar *buf;
-
-            buf = g_string_free(body, FALSE);
-            libbalsa_utf8_sanitize(&buf, balsa_app.convert_unknown_8bit,
-                                   NULL);
-            body = g_string_new(buf);
-            g_free(buf);
-            g_string_prepend(body, str);
-        } else {
-            body = g_string_new(str);
-        }
-        g_free(str);
+       if (date)
+           str = g_strdup_printf(_("On %s, %s wrote:\n"), date, personStr);
+       else
+           str = g_strdup_printf(_("%s wrote:\n"), personStr);
+
+       /* scan the message and collect text parts which might be included
+        * in the reply */
+       body = collect_for_quote(bsmsg, root,
+                                qtype == QUOTE_ALL ? balsa_app.quote_str : NULL,
+                                bsmsg->flow ? -1 : balsa_app.wraplength,
+                                balsa_app.reply_strip_html, bsmsg->flow);
+       if (body) {
+           gchar *buf;
+
+           buf = g_string_free(body, FALSE);
+           libbalsa_utf8_sanitize(&buf, balsa_app.convert_unknown_8bit,
+                                  NULL);
+           body = g_string_new(buf);
+           g_free(buf);
+           g_string_prepend(body, str);
+       } else
+           body = g_string_new(str);
+       g_free(str);
     }
 
     g_free(date);
@@ -3832,20 +3560,16 @@ quote_body(BalsaSendmsg           *bsmsg,
     return body;
 }
 
-
 /* fill_body -------------------------------------------------------------
    fills the body of the message to be composed based on the given message.
    First quotes the original one, if autoquote is set,
    and then adds the signature.
    Optionally prepends the signature to quoted text.
- */
+*/
 static void
-fill_body_from_part(BalsaSendmsg           *bsmsg,
-                    LibBalsaMessageHeaders *headers,
-                    const gchar            *message_id,
-                    GList                  *references,
-                    LibBalsaMessageBody    *root,
-                    QuoteType               qtype)
+fill_body_from_part(BalsaSendmsg * bsmsg, LibBalsaMessageHeaders *headers,
+                    const gchar *message_id, GList *references,
+                    LibBalsaMessageBody *root, QuoteType qtype)
 {
     GString *body;
     GtkTextBuffer *buffer =
@@ -3859,43 +3583,36 @@ fill_body_from_part(BalsaSendmsg           *bsmsg,
 
     g_return_if_fail(body != NULL);
 
-    if (body->len && (body->str[body->len] != '\n')) {
+    if(body->len && body->str[body->len] != '\n')
         g_string_append_c(body, '\n');
-    }
     gtk_text_buffer_insert_at_cursor(buffer, body->str, body->len);
 
-    if (qtype == QUOTE_HEADERS) {
+    if(qtype == QUOTE_HEADERS)
         gtk_text_buffer_get_end_iter(buffer, &start);
-    } else {
+    else
         gtk_text_buffer_get_start_iter(buffer, &start);
-    }
 
     gtk_text_buffer_place_cursor(buffer, &start);
     g_string_free(body, TRUE);
 }
 
-
-static GString *
-quote_message_body(BalsaSendmsg    *bsmsg,
-                   LibBalsaMessage *message,
-                   QuoteType        qtype)
+static GString*
+quote_message_body(BalsaSendmsg * bsmsg,
+                   LibBalsaMessage * message,
+                   QuoteType qtype)
 {
     GString *res;
-    if (libbalsa_message_body_ref(message, FALSE, FALSE)) {
+    if(libbalsa_message_body_ref(message, FALSE, FALSE)) {
         res = quote_body(bsmsg, message->headers, message->message_id,
                          message->references, message->body_list, qtype);
         libbalsa_message_body_unref(message);
-    } else {
-        res = g_string_new("");
-    }
+    } else res = g_string_new("");
     return res;
 }
 
-
 static void
-fill_body_from_message(BalsaSendmsg    *bsmsg,
-                       LibBalsaMessage *message,
-                       QuoteType        qtype)
+fill_body_from_message(BalsaSendmsg *bsmsg, LibBalsaMessage *message,
+                       QuoteType qtype)
 {
     fill_body_from_part(bsmsg, message->headers, message->message_id,
                         message->references, message->body_list, qtype);
@@ -3903,9 +3620,9 @@ fill_body_from_message(BalsaSendmsg    *bsmsg,
 
 
 static void
-sw_insert_sig_activated(GSimpleAction *action,
-                        GVariant      *parameter,
-                        gpointer       data)
+sw_insert_sig_activated(GSimpleAction * action,
+                        GVariant      * parameter,
+                        gpointer        data)
 {
     BalsaSendmsg *bsmsg = data;
     gchar *signature;
@@ -3923,7 +3640,7 @@ sw_insert_sig_activated(GSimpleAction *action,
         gtk_text_buffer_insert_at_cursor(buffer, signature, -1);
         sw_buffer_signals_unblock(bsmsg, buffer);
 
-        g_free(signature);
+       g_free(signature);
     } else if (error != NULL) {
         balsa_information_parented(GTK_WINDOW(bsmsg->window),
                                    LIBBALSA_INFORMATION_ERROR,
@@ -3934,9 +3651,9 @@ sw_insert_sig_activated(GSimpleAction *action,
 
 
 static void
-sw_quote_activated(GSimpleAction *action,
-                   GVariant      *parameter,
-                   gpointer       data)
+sw_quote_activated(GSimpleAction * action,
+                   GVariant      * parameter,
+                   gpointer        data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -3947,22 +3664,21 @@ sw_quote_activated(GSimpleAction *action,
 /** Generates a new subject for forwarded messages based on a message
     being responded to and identity.
  */
-static char *
-generate_forwarded_subject(const char             *orig_subject,
+static char*
+generate_forwarded_subject(const char *orig_subject,
                            LibBalsaMessageHeaders *headers,
                            LibBalsaIdentity       *ident)
 {
     char *newsubject;
 
     if (!orig_subject) {
-        if (headers && headers->from) {
+        if (headers && headers->from)
             newsubject = g_strdup_printf("%s from %s",
                                          ident->forward_string,
                                          libbalsa_address_get_mailbox_from_list
-                                             (headers->from));
-        } else {
+                                         (headers->from));
+        else
             newsubject = g_strdup(ident->forward_string);
-        }
     } else {
         const char *tmp = orig_subject;
         if (g_ascii_strncasecmp(tmp, "fwd:", 4) == 0) {
@@ -3976,17 +3692,15 @@ generate_forwarded_subject(const char             *orig_subject,
                 tmp += i;
             }
         }
-        while ( *tmp && isspace((int)*tmp)) {
-            tmp++;
-        }
-        if (headers && headers->from) {
+        while( *tmp && isspace((int)*tmp) ) tmp++;
+        if (headers && headers->from)
             newsubject =
                 g_strdup_printf("%s %s [%s]",
                                 ident->forward_string,
                                 tmp,
                                 libbalsa_address_get_mailbox_from_list
-                                    (headers->from));
-        } else {
+                                (headers->from));
+        else {
             newsubject =
                 g_strdup_printf("%s %s",
                                 ident->forward_string,
@@ -3996,22 +3710,19 @@ generate_forwarded_subject(const char             *orig_subject,
     }
     return newsubject;
 }
-
-
 /* bsmsg_set_subject_from_body:
    set subject entry based on given replied/forwarded/continued message
    and the compose type.
- */
+*/
 static void
-bsmsg_set_subject_from_body(BalsaSendmsg        *bsmsg,
-                            LibBalsaMessageBody *part,
-                            LibBalsaIdentity    *ident)
+bsmsg_set_subject_from_body(BalsaSendmsg * bsmsg,
+                            LibBalsaMessageBody * part,
+                            LibBalsaIdentity * ident)
 {
     gchar *subject;
 
-    if (!part) {
+    if (!part)
         return;
-    }
     subject = message_part_get_subject(part);
 
     if (!bsmsg->is_continue) {
@@ -4029,21 +3740,19 @@ bsmsg_set_subject_from_body(BalsaSendmsg        *bsmsg,
             }
 
             tmp = subject;
-            if ((g_ascii_strncasecmp(tmp, "re:", 3) == 0) ||
-                (g_ascii_strncasecmp(tmp, "aw:", 3) == 0)) {
+            if (g_ascii_strncasecmp(tmp, "re:", 3) == 0 ||
+                g_ascii_strncasecmp(tmp, "aw:", 3) == 0)
                 tmp += 3;
-            } else if (g_ascii_strncasecmp(tmp, _("Re:"), strlen(_("Re:")))
-                       == 0) {
+            else if (g_ascii_strncasecmp(tmp, _("Re:"), strlen(_("Re:")))
+                       == 0)
                 tmp += strlen(_("Re:"));
-            } else {
+            else {
                 gint len = strlen(ident->reply_string);
-                if (g_ascii_strncasecmp(tmp, ident->reply_string, len) == 0) {
+                if (g_ascii_strncasecmp(tmp, ident->reply_string, len) == 0)
                     tmp += len;
-                }
             }
-            while (*tmp && isspace((int) *tmp)) {
+            while (*tmp && isspace((int) *tmp))
                 tmp++;
-            }
             newsubject = g_strdup_printf("%s %s", ident->reply_string, tmp);
             g_strchomp(newsubject);
             g_strdelimit(newsubject, "\r\n", ' ');
@@ -4056,7 +3765,6 @@ bsmsg_set_subject_from_body(BalsaSendmsg        *bsmsg,
             newsubject =
                 generate_forwarded_subject(subject, headers, ident);
             break;
-
         default:
             break;
         }
@@ -4071,44 +3779,42 @@ bsmsg_set_subject_from_body(BalsaSendmsg        *bsmsg,
     g_free(subject);
 }
 
-
 static gboolean
-sw_save_draft(BalsaSendmsg *bsmsg)
+sw_save_draft(BalsaSendmsg * bsmsg)
 {
     GError *err = NULL;
 
     if (!message_postpone(bsmsg)) {
-        balsa_information_parented(GTK_WINDOW(bsmsg->window),
-                                   LIBBALSA_INFORMATION_MESSAGE,
+       balsa_information_parented(GTK_WINDOW(bsmsg->window),
+                                  LIBBALSA_INFORMATION_MESSAGE,
                                    _("Could not save message."));
         return FALSE;
     }
 
-    if (!libbalsa_mailbox_open(balsa_app.draftbox, &err)) {
-        balsa_information_parented(GTK_WINDOW(bsmsg->window),
-                                   LIBBALSA_INFORMATION_WARNING,
-                                   _("Could not open draftbox: %s"),
-                                   err ? err->message : _("Unknown error"));
-        g_clear_error(&err);
-        return FALSE;
+    if(!libbalsa_mailbox_open(balsa_app.draftbox, &err)) {
+       balsa_information_parented(GTK_WINDOW(bsmsg->window),
+                                  LIBBALSA_INFORMATION_WARNING,
+                                  _("Could not open draftbox: %s"),
+                                  err ? err->message : _("Unknown error"));
+       g_clear_error(&err);
+       return FALSE;
     }
 
     if (bsmsg->draft_message) {
         g_object_set_data(G_OBJECT(bsmsg->draft_message),
                           BALSA_SENDMSG_WINDOW_KEY, NULL);
-        if (bsmsg->draft_message->mailbox) {
-            libbalsa_mailbox_close(bsmsg->draft_message->mailbox,
-                                   /* Respect pref setting: */
-                                   balsa_app.expunge_on_close);
-        }
-        g_object_unref(G_OBJECT(bsmsg->draft_message));
+       if (bsmsg->draft_message->mailbox)
+           libbalsa_mailbox_close(bsmsg->draft_message->mailbox,
+                   /* Respect pref setting: */
+                                  balsa_app.expunge_on_close);
+       g_object_unref(G_OBJECT(bsmsg->draft_message));
     }
     bsmsg->state = SENDMSG_STATE_CLEAN;
 
     bsmsg->draft_message =
-        libbalsa_mailbox_get_message(balsa_app.draftbox,
-                                     libbalsa_mailbox_total_messages
-                                         (balsa_app.draftbox));
+       libbalsa_mailbox_get_message(balsa_app.draftbox,
+                                    libbalsa_mailbox_total_messages
+                                    (balsa_app.draftbox));
     g_object_set_data(G_OBJECT(bsmsg->draft_message),
                       BALSA_SENDMSG_WINDOW_KEY, bsmsg);
     balsa_information_parented(GTK_WINDOW(bsmsg->window),
@@ -4118,23 +3824,19 @@ sw_save_draft(BalsaSendmsg *bsmsg)
     return TRUE;
 }
 
-
 static gboolean
-sw_autosave_timeout_cb(BalsaSendmsg *bsmsg)
+sw_autosave_timeout_cb(BalsaSendmsg * bsmsg)
 {
     if (bsmsg->state == SENDMSG_STATE_MODIFIED) {
-        if (sw_save_draft(bsmsg)) {
+        if (sw_save_draft(bsmsg))
             bsmsg->state = SENDMSG_STATE_AUTO_SAVED;
-        }
     }
 
     return TRUE;                /* do repeat it */
 }
 
-
 static void
-setup_headers_from_message(BalsaSendmsg    *bsmsg,
-                           LibBalsaMessage *message)
+setup_headers_from_message(BalsaSendmsg* bsmsg, LibBalsaMessage *message)
 {
     g_return_if_fail(message->headers);
 
@@ -4163,19 +3865,16 @@ setup_headers_from_message(BalsaSendmsg    *bsmsg,
  * the message.
  **/
 static gboolean
-set_identity_from_mailbox(BalsaSendmsg    *bsmsg,
-                          LibBalsaMessage *message)
+set_identity_from_mailbox(BalsaSendmsg* bsmsg, LibBalsaMessage * message)
 {
     const gchar *identity;
 
-    LibBalsaIdentity *ident;
+    LibBalsaIdentity* ident;
     GList *ilist;
 
-    if ( message && message->mailbox && balsa_app.identities) {
+    if( message && message->mailbox && balsa_app.identities) {
         identity = libbalsa_mailbox_get_identity_name(message->mailbox);
-        if (!identity) {
-            return FALSE;
-        }
+        if(!identity) return FALSE;
         for (ilist = balsa_app.identities;
              ilist != NULL;
              ilist = ilist->next) {
@@ -4190,7 +3889,6 @@ set_identity_from_mailbox(BalsaSendmsg    *bsmsg,
     return FALSE; /* use default */
 }
 
-
 /*
  * guess_identity
  *
@@ -4201,15 +3899,13 @@ set_identity_from_mailbox(BalsaSendmsg    *bsmsg,
 /* First a helper; groups cannot be nested, and are not allowed in the
  * From: list. */
 static gboolean
-guess_identity_from_list(BalsaSendmsg        *bsmsg,
-                         InternetAddressList *list,
-                         gboolean             allow_group)
+guess_identity_from_list(BalsaSendmsg * bsmsg, InternetAddressList * list,
+                         gboolean allow_group)
 {
     gint i;
 
-    if (!list) {
+    if (!list)
         return FALSE;
-    }
 
     for (i = 0; i < internet_address_list_length(list); i++) {
         InternetAddress *ia = internet_address_list_get_address(list, i);
@@ -4218,9 +3914,8 @@ guess_identity_from_list(BalsaSendmsg        *bsmsg,
             InternetAddressList *members =
                 INTERNET_ADDRESS_GROUP(ia)->members;
             if (allow_group
-                && guess_identity_from_list(bsmsg, members, FALSE)) {
+                && guess_identity_from_list(bsmsg, members, FALSE))
                 return TRUE;
-            }
         } else {
             GList *l;
 
@@ -4237,66 +3932,54 @@ guess_identity_from_list(BalsaSendmsg        *bsmsg,
     return FALSE;
 }
 
-
 static gboolean
-guess_identity(BalsaSendmsg    *bsmsg,
-               LibBalsaMessage *message)
+guess_identity(BalsaSendmsg* bsmsg, LibBalsaMessage * message)
 {
-    if (!message || !message->headers || !balsa_app.identities) {
+    if (!message  || !message->headers || !balsa_app.identities)
         return FALSE; /* use default */
 
-    }
-    if (bsmsg->is_continue) {
+    if (bsmsg->is_continue)
         return guess_identity_from_list(bsmsg, message->headers->from,
                                         FALSE);
-    }
 
-    if (bsmsg->type != SEND_NORMAL) {
-        /* bsmsg->type == SEND_REPLY || bsmsg->type == SEND_REPLY_ALL ||
-         *  bsmsg->type == SEND_REPLY_GROUP || bsmsg->type == SEND_FORWARD_ATTACH ||
-         *  bsmsg->type == SEND_FORWARD_INLINE */
+    if (bsmsg->type != SEND_NORMAL)
+       /* bsmsg->type == SEND_REPLY || bsmsg->type == SEND_REPLY_ALL ||
+       *  bsmsg->type == SEND_REPLY_GROUP || bsmsg->type == SEND_FORWARD_ATTACH ||
+       *  bsmsg->type == SEND_FORWARD_INLINE */
         return guess_identity_from_list(bsmsg, message->headers->to_list,
                                         TRUE)
-               || guess_identity_from_list(bsmsg, message->headers->cc_list,
-                                           TRUE);
-    }
+            || guess_identity_from_list(bsmsg, message->headers->cc_list,
+                                        TRUE);
 
     return FALSE;
 }
 
-
 static void
-setup_headers_from_identity(BalsaSendmsg     *bsmsg,
-                            LibBalsaIdentity *ident)
+setup_headers_from_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity *ident)
 {
     gtk_combo_box_set_active(GTK_COMBO_BOX(bsmsg->from[1]),
                              g_list_index(balsa_app.identities, ident));
-    if (ident->replyto) {
+    if(ident->replyto)
         libbalsa_address_view_set_from_string(bsmsg->replyto_view,
                                               "Reply To:",
                                               ident->replyto);
-    }
-    if (ident->bcc) {
+    if(ident->bcc)
         libbalsa_address_view_set_from_string(bsmsg->recipient_view,
                                               "BCC:",
                                               ident->bcc);
-    }
 
     /* Make sure the blank line is "To:" */
     libbalsa_address_view_add_from_string(bsmsg->recipient_view,
                                           "To:", NULL);
 }
 
-
 static int
-comp_send_locales(const void *a,
-                  const void *b)
+comp_send_locales(const void* a, const void* b)
 {
-    return g_utf8_collate(((struct SendLocales *)a)->lang_name,
-                          ((struct SendLocales *)b)->lang_name);
+    return g_utf8_collate(((struct SendLocales*)a)->lang_name,
+                          ((struct SendLocales*)b)->lang_name);
 }
 
-
 /* create_lang_menu:
    create language menu for the compose window. The order cannot be
    hardcoded because it depends on the current locale.
@@ -4305,28 +3988,25 @@ comp_send_locales(const void *a,
    and the menu was created;
    returns NULL if no dictionaries were found,
    in which case spell-checking must be disabled.
- */
+*/
 #define BALSA_LANGUAGE_MENU_LANG "balsa-language-menu-lang"
 #if !HAVE_GSPELL && !HAVE_GTKSPELL_3_0_3
 static void
-sw_broker_cb(const gchar *lang_tag,
-             const gchar *provider_name,
-             const gchar *provider_desc,
-             const gchar *provider_file,
-             gpointer     data)
+sw_broker_cb(const gchar * lang_tag,
+             const gchar * provider_name,
+             const gchar * provider_desc,
+             const gchar * provider_file,
+             gpointer      data)
 {
     GList **lang_list = data;
 
     *lang_list = g_list_insert_sorted(*lang_list, g_strdup(lang_tag),
                                       (GCompareFunc) strcmp);
 }
-
-
 #endif                          /* HAVE_GTKSPELL_3_0_3 */
 
 static const gchar *
-create_lang_menu(GtkWidget    *parent,
-                 BalsaSendmsg *bsmsg)
+create_lang_menu(GtkWidget * parent, BalsaSendmsg * bsmsg)
 {
     guint i;
     GtkWidget *langs;
@@ -4359,9 +4039,8 @@ create_lang_menu(GtkWidget    *parent,
     }
 
     if (!locales_sorted) {
-        for (i = 0; i < G_N_ELEMENTS(locales); i++) {
+        for (i = 0; i < G_N_ELEMENTS(locales); i++)
             locales[i].lang_name = _(locales[i].lang_name);
-        }
         qsort(locales, G_N_ELEMENTS(locales), sizeof(struct SendLocales),
               comp_send_locales);
         locales_sorted = TRUE;
@@ -4375,11 +4054,10 @@ create_lang_menu(GtkWidget    *parent,
     for (i = 0; i < G_N_ELEMENTS(locales); i++) {
         gconstpointer found;
 
-        if ((locales[i].locale == NULL) || (locales[i].locale[0] == '\0')) {
+        if (locales[i].locale == NULL || locales[i].locale[0] == '\0')
             /* GtkSpell handles NULL lang, but complains about empty
              * lang; in either case, it does not go in the langs menu. */
             continue;
-        }
 
 #if HAVE_GSPELL
         found = gspell_language_lookup(locales[i].locale);
@@ -4400,9 +4078,8 @@ create_lang_menu(GtkWidget    *parent,
                                    g_strdup(locales[i].locale), g_free);
             gtk_menu_shell_append(GTK_MENU_SHELL(langs), w);
 
-            if (!active_item || (strcmp(preferred_lang, locales[i].locale) == 0)) {
+            if (!active_item || strcmp(preferred_lang, locales[i].locale) == 0)
                 active_item = w;
-            }
         }
     }
 
@@ -4418,7 +4095,7 @@ create_lang_menu(GtkWidget    *parent,
         gint j;
 
         j = find_locale_index_by_locale(lang);
-        if ((j < 0) || (strcmp(lang, locales[j].locale) != 0)) {
+        if (j < 0 || strcmp(lang, locales[j].locale) != 0) {
             GtkWidget *w;
 
             w = gtk_radio_menu_item_new_with_label(group, lang);
@@ -4429,9 +4106,8 @@ create_lang_menu(GtkWidget    *parent,
                                    g_strdup(lang), g_free);
             gtk_menu_shell_append(GTK_MENU_SHELL(langs), w);
 
-            if (!active_item || (strcmp(preferred_lang, lang) == 0)) {
+            if (!active_item || strcmp(preferred_lang, lang) == 0)
                 active_item = w;
-            }
         }
     }
 #if !HAVE_GSPELL
@@ -4446,37 +4122,36 @@ create_lang_menu(GtkWidget    *parent,
     return g_object_get_data(G_OBJECT(active_item), BALSA_LANGUAGE_MENU_LANG);
 }
 
-
 /* Standard buttons; "" means a separator. */
 static const BalsaToolbarEntry compose_toolbar[] = {
     { "toolbar-send", BALSA_PIXMAP_SEND       },
     { "", ""                                  },
-    { "attach-file", BALSA_PIXMAP_ATTACHMENT },
+    { "attach-file",  BALSA_PIXMAP_ATTACHMENT },
     { "", ""                                  },
-    { "save", "document-save"          },
+    { "save",        "document-save"          },
     { "", ""                                  },
-    { "undo", "edit-undo"              },
-    { "redo", "edit-redo"              },
+    { "undo",        "edit-undo"              },
+    { "redo",        "edit-redo"              },
     { "", ""                                  },
     { "select-ident", BALSA_PIXMAP_IDENTITY   },
     { "", ""                                  },
     { "spell-check", "tools-check-spelling"   },
     { "", ""                                  },
-    {"print", "document-print"         },
+    {"print",        "document-print"         },
     { "", ""                                  },
-    {"close", "window-close-symbolic"  }
+    {"close",        "window-close-symbolic"  }
 };
 
 /* Optional extra buttons */
 static const BalsaToolbarEntry compose_toolbar_extras[] = {
-    { "postpone", BALSA_PIXMAP_POSTPONE    },
+    { "postpone",    BALSA_PIXMAP_POSTPONE    },
     { "request-mdn", BALSA_PIXMAP_REQUEST_MDN },
 #ifdef HAVE_GPGME
-    { "sign", BALSA_PIXMAP_GPG_SIGN    },
-    { "encrypt", BALSA_PIXMAP_GPG_ENCRYPT },
+    { "sign",        BALSA_PIXMAP_GPG_SIGN    },
+    { "encrypt",     BALSA_PIXMAP_GPG_ENCRYPT },
 #endif /* HAVE_GPGME */
-    { "edit", "gtk-edit"               },
-    { "queue", BALSA_PIXMAP_QUEUE               }
+    { "edit",        "gtk-edit"               },
+       { "queue",               BALSA_PIXMAP_QUEUE               }
 };
 
 /* Create the toolbar model for the compose window's toolbar.
@@ -4486,9 +4161,8 @@ sendmsg_window_get_toolbar_model(void)
 {
     static BalsaToolbarModel *model = NULL;
 
-    if (model) {
+    if (model)
         return model;
-    }
 
     model =
         balsa_toolbar_model_new(BALSA_TOOLBAR_TYPE_COMPOSE_WINDOW,
@@ -4500,46 +4174,38 @@ sendmsg_window_get_toolbar_model(void)
     return model;
 }
 
-
 static void
-bsmsg_identities_changed_cb(BalsaSendmsg *bsmsg)
+bsmsg_identities_changed_cb(BalsaSendmsg * bsmsg)
 {
     sw_action_set_enabled(bsmsg, "SelectIdentity",
-                          balsa_app.identities->next != NULL);
+                     balsa_app.identities->next != NULL);
 }
 
-
 static void
-sw_cc_add_list(InternetAddressList **new_cc,
-               InternetAddressList  *list)
+sw_cc_add_list(InternetAddressList **new_cc, InternetAddressList * list)
 {
     int i;
 
-    if (!list) {
+    if (!list)
         return;
-    }
 
     for (i = 0; i < internet_address_list_length(list); i++) {
         InternetAddress *ia = internet_address_list_get_address (list, i);
-        GList *ident;
-
-        /* do not insert any of my identities into the cc: list */
-        for (ident = balsa_app.identities; ident; ident = ident->next) {
-            if (libbalsa_ia_rfc2821_equal
-                    (ia, LIBBALSA_IDENTITY(ident->data)->ia)) {
-                break;
-            }
-        }
-        if (!ident) {
-            if (*new_cc == NULL) {
+       GList *ident;
+
+       /* do not insert any of my identities into the cc: list */
+       for (ident = balsa_app.identities; ident; ident = ident->next)
+           if (libbalsa_ia_rfc2821_equal
+               (ia, LIBBALSA_IDENTITY(ident->data)->ia))
+               break;
+       if (!ident) {
+            if (*new_cc == NULL)
                 *new_cc = internet_address_list_new();
-            }
-            internet_address_list_add(*new_cc, ia);
+           internet_address_list_add(*new_cc, ia);
         }
     }
 }
 
-
 static void
 insert_initial_sig(BalsaSendmsg *bsmsg)
 {
@@ -4547,24 +4213,21 @@ insert_initial_sig(BalsaSendmsg *bsmsg)
     GtkTextBuffer *buffer =
         gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
 
-    if (bsmsg->ident->sig_prepend) {
+    if(bsmsg->ident->sig_prepend)
         gtk_text_buffer_get_start_iter(buffer, &sig_pos);
-    } else {
+    else
         gtk_text_buffer_get_end_iter(buffer, &sig_pos);
-    }
     gtk_text_buffer_insert(buffer, &sig_pos, "\n", 1);
     sw_insert_sig_activated(NULL, NULL, bsmsg);
     gtk_text_buffer_get_start_iter(buffer, &sig_pos);
     gtk_text_buffer_place_cursor(buffer, &sig_pos);
 }
 
-
 static void
 bsm_prepare_for_setup(LibBalsaMessage *message)
 {
-    if (message->mailbox) {
+    if (message->mailbox)
         libbalsa_mailbox_open(message->mailbox, NULL);
-    }
     /* fill in that info:
      * ref the message so that we have all needed headers */
     libbalsa_message_body_ref(message, TRUE, TRUE);
@@ -4576,29 +4239,25 @@ bsm_prepare_for_setup(LibBalsaMessage *message)
 #endif
 }
 
-
 /* libbalsa_message_body_unref() may destroy the @param part - this is
    why body_unref() is done at the end. */
 static void
-bsm_finish_setup(BalsaSendmsg        *bsmsg,
-                 LibBalsaMessageBody *part)
+bsm_finish_setup(BalsaSendmsg *bsmsg, LibBalsaMessageBody *part)
 {
     g_return_if_fail(part != NULL);
     g_return_if_fail(part->message != NULL);
 
     if (part->message->mailbox &&
-        !bsmsg->parent_message && !bsmsg->draft_message) {
+        !bsmsg->parent_message && !bsmsg->draft_message)
         libbalsa_mailbox_close(part->message->mailbox, FALSE);
-    }
     /* ...but mark it as unmodified. */
     bsmsg->state = SENDMSG_STATE_CLEAN;
     bsmsg_set_subject_from_body(bsmsg, part, bsmsg->ident);
     libbalsa_message_body_unref(part->message);
 }
 
-
 static void
-set_cc_from_all_recipients(BalsaSendmsg           *bsmsg,
+set_cc_from_all_recipients(BalsaSendmsg* bsmsg,
                            LibBalsaMessageHeaders *headers)
 {
     InternetAddressList *new_cc = NULL;
@@ -4609,47 +4268,39 @@ set_cc_from_all_recipients(BalsaSendmsg           *bsmsg,
     libbalsa_address_view_set_from_list(bsmsg->recipient_view,
                                         "CC:",
                                         new_cc);
-    if (new_cc) {
+    if (new_cc)
         g_object_unref(new_cc);
-    }
 }
 
-
 static void
-set_in_reply_to(BalsaSendmsg           *bsmsg,
-                const gchar            *message_id,
+set_in_reply_to(BalsaSendmsg *bsmsg, const gchar *message_id,
                 LibBalsaMessageHeaders *headers)
 {
     gchar *tmp;
 
     g_assert(message_id);
-    if (message_id[0] == '<') {
+    if(message_id[0] == '<')
         tmp = g_strdup(message_id);
-    } else {
+    else
         tmp = g_strconcat("<", message_id, ">", NULL);
-    }
     if (headers && headers->from) {
         gchar recvtime[50];
 
         ctime_r(&headers->date, recvtime);
-        if (recvtime[0]) { /* safety check; remove trailing '\n' */
-            recvtime[strlen(recvtime) - 1] = '\0';
-        }
+        if (recvtime[0]) /* safety check; remove trailing '\n' */
+            recvtime[strlen(recvtime)-1] = '\0';
         bsmsg->in_reply_to =
             g_strconcat(tmp, " (from ",
                         libbalsa_address_get_mailbox_from_list
-                            (headers->from),
+                        (headers->from),
                         " on ", recvtime, ")", NULL);
         g_free(tmp);
-    } else {
+    } else
         bsmsg->in_reply_to = tmp;
-    }
 }
 
-
 static void
-set_to(BalsaSendmsg           *bsmsg,
-       LibBalsaMessageHeaders *headers)
+set_to(BalsaSendmsg *bsmsg, LibBalsaMessageHeaders *headers)
 {
     if (bsmsg->type == SEND_REPLY_GROUP) {
         set_list_post_address(bsmsg);
@@ -4662,140 +4313,115 @@ set_to(BalsaSendmsg           *bsmsg,
     }
 }
 
-
 static void
-set_references_reply(BalsaSendmsg *bsmsg,
-                     GList        *references,
-                     const gchar  *in_reply_to,
-                     const gchar  *message_id)
+set_references_reply(BalsaSendmsg *bsmsg, GList *references,
+                     const gchar *in_reply_to, const gchar *message_id)
 {
     GList *refs = NULL, *list;
 
-    for (list = references; list; list = list->next) {
+    for (list = references; list; list = list->next)
         refs = g_list_prepend(refs, g_strdup(list->data));
-    }
 
     /* We're replying to parent_message, so construct the
      * references according to RFC 2822. */
     if (!references
         /* Parent message has no References header... */
-        && in_reply_to) {
-        /* ...but it has an In-Reply-To header with a single
-         * message identifier. */
+        && in_reply_to)
+            /* ...but it has an In-Reply-To header with a single
+             * message identifier. */
         refs = g_list_prepend(refs, g_strdup(in_reply_to));
-    }
-    if (message_id) {
+    if (message_id)
         refs = g_list_prepend(refs, g_strdup(message_id));
-    }
 
     bsmsg->references = g_list_reverse(refs);
 }
 
-
 static void
-set_identity(BalsaSendmsg    *bsmsg,
-             LibBalsaMessage *message)
+set_identity(BalsaSendmsg * bsmsg, LibBalsaMessage * message)
 {
     /* Set up the default identity */
-    if (!set_identity_from_mailbox(bsmsg, message)) {
+    if(!set_identity_from_mailbox(bsmsg, message))
         /* Get the identity from the To: field of the original message */
         guess_identity(bsmsg, message);
-    }
     /* From: */
     setup_headers_from_identity(bsmsg, bsmsg->ident);
 }
 
-
 static gboolean
-sw_grab_focus_to_text(GtkWidget *text)
+sw_grab_focus_to_text(GtkWidget * text)
 {
     gtk_widget_grab_focus(text);
     g_object_unref(text);
     return FALSE;
 }
 
-
 /* decode_and_strdup:
    decodes given URL string up to the delimiter and places the
    eos pointer in newstr if supplied (eos==NULL if end of string was reached)
- */
-static gchar *
-decode_and_strdup(const gchar *str,
-                  int          delim,
-                  gchar      **newstr)
+*/
+static gchar*
+decode_and_strdup(const gchar*str, int delim, gchar** newstr)
 {
     gchar num[3];
     GString *s = g_string_new(NULL);
     /* eos points to the character after the last to parse */
     gchar *eos = strchr(str, delim);
 
-    if (!eos) {
-        eos = (gchar *)str + strlen(str);
-    }
-    while (str < eos) {
-        switch (*str) {
-        case '+':
-            g_string_append_c(s, ' ');
-            str++;
-            break;
-
-        case '%':
-            if (str + 2 < eos) {
-                strncpy(num, str + 1, 2);
-                num[2] = 0;
-                g_string_append_c(s, strtol(num, NULL, 16));
-            }
-            str += 3;
-            break;
-
-        default:
-            g_string_append_c(s, *str++);
-        }
-    }
-    if (newstr) {
-        *newstr = *eos ? eos + 1 : NULL;
-    }
+    if(!eos) eos = (gchar*)str + strlen(str);
+    while(str<eos) {
+       switch(*str) {
+       case '+':
+           g_string_append_c(s, ' ');
+           str++;
+           break;
+       case '%':
+           if(str+2<eos) {
+               strncpy(num, str+1, 2); num[2] = 0;
+               g_string_append_c(s, strtol(num,NULL,16));
+           }
+           str+=3;
+           break;
+       default:
+           g_string_append_c(s, *str++);
+       }
+    }
+    if(newstr) *newstr = *eos ? eos+1 : NULL;
     eos = s->str;
-    g_string_free(s, FALSE);
+    g_string_free(s,FALSE);
     return eos;
 }
 
-
 /* process_url:
    extracts all characters until NUL or question mark; parse later fields
    of format 'key'='value' with ampersands as separators.
- */
+*/
 void
-sendmsg_window_process_url(const char  *url,
-                           field_setter func,
-                           void        *data)
+sendmsg_window_process_url(const char *url, field_setter func, void *data)
 {
-    gchar *ptr, *to, *key, *val;
+    gchar * ptr, *to, *key, *val;
 
-    to = decode_and_strdup(url, '?', &ptr);
+    to = decode_and_strdup(url,'?', &ptr);
     func(data, "to", to);
     g_free(to);
-    while (ptr) {
-        key = decode_and_strdup(ptr, '=', &ptr);
-        if (ptr) {
-            val = decode_and_strdup(ptr, '&', &ptr);
-            func(data, key, val);
-            g_free(val);
-        }
-        g_free(key);
+    while(ptr) {
+       key = decode_and_strdup(ptr,'=', &ptr);
+       if(ptr) {
+           val = decode_and_strdup(ptr,'&', &ptr);
+           func(data, key, val);
+           g_free(val);
+       }
+       g_free(key);
     }
 }
 
-
 /* sendmsg_window_set_field:
    sets given field of the compose window to the specified value.
- */
+*/
 
 #define NO_SECURITY_ISSUES_WITH_ATTACHMENTS TRUE
 #if defined(NO_SECURITY_ISSUES_WITH_ATTACHMENTS)
 static void
-sw_attach_file(BalsaSendmsg *bsmsg,
-               const gchar  *val)
+sw_attach_file(BalsaSendmsg * bsmsg, const gchar * val)
 {
     GtkFileChooser *attach;
 
@@ -4855,14 +4481,11 @@ sw_attach_file(BalsaSendmsg *bsmsg,
     }
     gtk_file_chooser_select_filename(attach, val);
 }
-
-
 #endif
 
 void
-sendmsg_window_set_field(BalsaSendmsg *bsmsg,
-                         const gchar  *key,
-                         const gchar  *val)
+sendmsg_window_set_field(BalsaSendmsg * bsmsg, const gchar * key,
+                         const gchar * val)
 {
     const gchar *type;
     g_return_if_fail(bsmsg);
@@ -4881,29 +4504,29 @@ sendmsg_window_set_field(BalsaSendmsg *bsmsg,
         return;
     }
 #endif
-    if (g_ascii_strcasecmp(key, "subject") == 0) {
+    if(g_ascii_strcasecmp(key, "subject") == 0) {
         append_comma_separated(GTK_EDITABLE(bsmsg->subject[1]), val);
         return;
     }
 
-    if (g_ascii_strcasecmp(key, "to") == 0) {
+    if (g_ascii_strcasecmp(key, "to") == 0)
         type = "To:";
-    } else if (g_ascii_strcasecmp(key, "cc") == 0) {
+    else if(g_ascii_strcasecmp(key, "cc") == 0)
         type = "CC:";
-    } else if (g_ascii_strcasecmp(key, "bcc") == 0) {
+    else if(g_ascii_strcasecmp(key, "bcc") == 0) {
         type = "BCC:";
         if (!g_object_get_data(G_OBJECT(bsmsg->window),
                                "balsa-sendmsg-window-url-bcc")) {
             GtkWidget *dialog =
                 gtk_message_dialog_new
-                    (GTK_WINDOW(bsmsg->window),
-                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                    GTK_MESSAGE_INFO,
-                    GTK_BUTTONS_OK,
-                    _("The link that you selected created\n"
-                      "a “Blind copy” (BCC) address.\n"
-                      "Please check that the address\n"
-                      "is appropriate."));
+                (GTK_WINDOW(bsmsg->window),
+                 GTK_DIALOG_DESTROY_WITH_PARENT,
+                 GTK_MESSAGE_INFO,
+                 GTK_BUTTONS_OK,
+                 _("The link that you selected created\n"
+                   "a “Blind copy” (BCC) address.\n"
+                   "Please check that the address\n"
+                   "is appropriate."));
 #if HAVE_MACOSX_DESKTOP
             libbalsa_macosx_menu_for_parent(dialog, GTK_WINDOW(bsmsg->window));
 #endif
@@ -4913,14 +4536,14 @@ sendmsg_window_set_field(BalsaSendmsg *bsmsg,
                              G_CALLBACK(gtk_widget_destroy), NULL);
             gtk_widget_show(dialog);
         }
-    } else if (g_ascii_strcasecmp(key, "replyto") == 0) {
+    }
+    else if(g_ascii_strcasecmp(key, "replyto") == 0) {
         libbalsa_address_view_add_from_string(bsmsg->replyto_view,
                                               "Reply To:",
                                               val);
         return;
-    } else {
-        return;
     }
+    else return;
 
     libbalsa_address_view_add_from_string(bsmsg->recipient_view, type, val);
 }
@@ -4930,30 +4553,26 @@ sendmsg_window_set_field(BalsaSendmsg *bsmsg,
    it at current point */
 
 static void
-do_insert_string_select_ch(BalsaSendmsg  *bsmsg,
-                           GtkTextBuffer *buffer,
-                           const gchar   *string,
-                           size_t         len,
-                           const gchar   *fname)
+do_insert_string_select_ch(BalsaSendmsg* bsmsg, GtkTextBuffer *buffer,
+                           const gchar* string, size_t len,
+                           const gchar* fname)
 {
     const gchar *charset = NULL;
     LibBalsaTextAttribute attr = libbalsa_text_attr_string(string);
 
     do {
-        LibBalsaCodeset codeset;
-        LibBalsaCodesetInfo *info;
-        gchar *s;
+       LibBalsaCodeset codeset;
+       LibBalsaCodesetInfo *info;
+       gchar* s;
 
         if ((codeset = sw_get_user_codeset(bsmsg, NULL, NULL, fname))
-            == (LibBalsaCodeset) (-1)) {
+            == (LibBalsaCodeset) (-1))
             break;
-        }
         info = &libbalsa_codeset_info[codeset];
 
-        charset = info->std;
-        if (info->win && (attr & LIBBALSA_TEXT_HI_CTRL)) {
+       charset = info->std;
+        if (info->win && (attr & LIBBALSA_TEXT_HI_CTRL))
             charset = info->win;
-        }
 
         g_print("Trying charset: %s\n", charset);
         if (sw_can_convert(string, len, "UTF-8", charset, &s)) {
@@ -4961,21 +4580,20 @@ do_insert_string_select_ch(BalsaSendmsg  *bsmsg,
             g_free(s);
             break;
         }
-    } while (1);
+    } while(1);
 }
 
-
 static void
 insert_file_response(GtkWidget    *selector,
-                     gint          response,
-                     BalsaSendmsg *bsmsg)
+                                        gint          response,
+                                        BalsaSendmsg *bsmsg)
 {
     GtkFileChooser *fc;
     gchar *fname;
 
     if (response != GTK_RESPONSE_OK) {
-        gtk_widget_destroy(selector);
-        return;
+       gtk_widget_destroy(selector);
+       return;
     }
 
     fc = GTK_FILE_CHOOSER(selector);
@@ -4985,7 +4603,7 @@ insert_file_response(GtkWidget    *selector,
         gsize len;
         GError *error = NULL;
 
-        if (g_file_get_contents(fname, &string, &len, &error)) {
+       if (g_file_get_contents(fname, &string, &len, &error)) {
             LibBalsaTextAttribute attr;
             GtkTextBuffer *buffer;
 
@@ -5003,24 +4621,20 @@ insert_file_response(GtkWidget    *selector,
                     /* ...but seems to be in current charset. */
                     gtk_text_buffer_insert_at_cursor(buffer, s, -1);
                     g_free(s);
-                } else {
+                } else
                     /* ...and can't be decoded from current charset. */
                     do_insert_string_select_ch(bsmsg, buffer, string, len, fname);
-                }
             }
             g_free(string);
 
             /* Use the same folder as for attachments. */
             g_free(balsa_app.attach_dir);
             balsa_app.attach_dir = gtk_file_chooser_get_current_folder(fc);
-        } else {
-            balsa_information_parented(GTK_WINDOW(bsmsg->window),
-                                       LIBBALSA_INFORMATION_WARNING,
-                                       _(
-                                           "Cannot not read the file “%s”: %s"), fname,
-                                       error->message);
-            g_error_free(error);
-        }
+       } else {
+               balsa_information_parented(GTK_WINDOW(bsmsg->window),
+                       LIBBALSA_INFORMATION_WARNING, _("Cannot not read the file “%s”: %s"), fname, 
error->message);
+               g_error_free(error);
+       }
 
         g_free(fname);
     }
@@ -5028,32 +4642,30 @@ insert_file_response(GtkWidget    *selector,
     gtk_widget_destroy(selector);
 }
 
-
 static void
-sw_include_file_activated(GSimpleAction *action,
-                          GVariant      *parameter,
-                          gpointer       data)
+sw_include_file_activated(GSimpleAction * action,
+                          GVariant      * parameter,
+                          gpointer        data)
 {
     BalsaSendmsg *bsmsg = data;
     GtkWidget *file_selector;
 
     file_selector =
-        gtk_file_chooser_dialog_new(_("Include file"),
+       gtk_file_chooser_dialog_new(_("Include file"),
                                     GTK_WINDOW(bsmsg->window),
                                     GTK_FILE_CHOOSER_ACTION_OPEN,
                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                    _("_OK"), GTK_RESPONSE_OK,
+                                    _("_OK"),     GTK_RESPONSE_OK,
                                     NULL);
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(file_selector, GTK_WINDOW(bsmsg->window));
 #endif
     gtk_window_set_destroy_with_parent(GTK_WINDOW(file_selector), TRUE);
     /* Use the same folder as for attachments. */
-    if (balsa_app.attach_dir) {
+    if (balsa_app.attach_dir)
         gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER
-                                                (file_selector),
+                                            (file_selector),
                                             balsa_app.attach_dir);
-    }
     g_signal_connect(G_OBJECT(file_selector), "response",
                      G_CALLBACK(insert_file_response), bsmsg);
 
@@ -5061,24 +4673,20 @@ sw_include_file_activated(GSimpleAction *action,
     gtk_widget_show(file_selector);
 }
 
-
 static void
-strip_chars(gchar       *str,
-            const gchar *char2strip)
+strip_chars(gchar * str, const gchar * char2strip)
 {
     gchar *ins = str;
     while (*str) {
-        if (strchr(char2strip, *str) == NULL) {
-            *ins++ = *str;
-        }
-        str++;
+       if (strchr(char2strip, *str) == NULL)
+           *ins++ = *str;
+       str++;
     }
     *ins = '\0';
 }
 
-
 static void
-sw_wrap_body(BalsaSendmsg *bsmsg)
+sw_wrap_body(BalsaSendmsg * bsmsg)
 {
     GtkTextView *text_view = GTK_TEXT_VIEW(bsmsg->text);
     GtkTextBuffer *buffer = gtk_text_view_get_buffer(text_view);
@@ -5087,9 +4695,9 @@ sw_wrap_body(BalsaSendmsg *bsmsg)
     gtk_text_buffer_get_bounds(buffer, &start, &end);
 
     if (bsmsg->flow) {
-        sw_buffer_signals_block(bsmsg, buffer);
+       sw_buffer_signals_block(bsmsg, buffer);
         libbalsa_unwrap_buffer(buffer, &start, -1);
-        sw_buffer_signals_unblock(bsmsg, buffer);
+       sw_buffer_signals_unblock(bsmsg, buffer);
     } else {
         GtkTextIter now;
         gint pos;
@@ -5116,10 +4724,8 @@ sw_wrap_body(BalsaSendmsg *bsmsg)
 
 
 static gboolean
-attachment2message(GtkTreeModel *model,
-                   GtkTreePath  *path,
-                   GtkTreeIter  *iter,
-                   gpointer      data)
+attachment2message(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
+                  gpointer data)
 {
     LibBalsaMessage *message = LIBBALSA_MESSAGE(data);
     BalsaAttachInfo *attachment;
@@ -5131,11 +4737,10 @@ attachment2message(GtkTreeModel *model,
     /* create the attachment */
     body = libbalsa_message_body_new(message);
     body->file_uri = attachment->file_uri;
-    if (attachment->file_uri) {
+    if (attachment->file_uri)
         g_object_ref(attachment->file_uri);
-    } else {
+    else
         body->filename = g_strdup(attachment->uri_ref);
-    }
     body->content_type = g_strdup(attachment->force_mime_type);
     body->charset = g_strdup(attachment->charset);
     body->attach_mode = attachment->mode;
@@ -5152,20 +4757,18 @@ attachment2message(GtkTreeModel *model,
    stripping EOL chars is necessary - the GtkEntry fields can in principle
    contain them. Such characters might screw up message formatting
    (consider moving this code to mutt part).
- */
+*/
 
 static void
-sw_set_header_from_path(LibBalsaMessage *message,
-                        const gchar     *header,
-                        const gchar     *path,
-                        const gchar     *error_format)
+sw_set_header_from_path(LibBalsaMessage * message, const gchar * header,
+                        const gchar * path, const gchar * error_format)
 {
     gchar *content = NULL;
     GError *err = NULL;
 
     if (path && !(content =
-                      libbalsa_get_header_from_path(header, path, NULL,
-                                                    &err))) {
+                  libbalsa_get_header_from_path(header, path, NULL,
+                                                &err))) {
         balsa_information(LIBBALSA_INFORMATION_WARNING,
                           error_format, path, err->message);
         g_error_free(err);
@@ -5175,26 +4778,22 @@ sw_set_header_from_path(LibBalsaMessage *message,
     g_free(content);
 }
 
-
 static const gchar *
-sw_required_charset(BalsaSendmsg *bsmsg,
-                    const gchar  *text)
+sw_required_charset(BalsaSendmsg * bsmsg, const gchar * text)
 {
     const gchar *charset = "us-ascii";
 
     if (libbalsa_text_attr_string(text)) {
         charset = sw_preferred_charset(bsmsg);
-        if (!sw_can_convert(text, -1, charset, "UTF-8", NULL)) {
+        if (!sw_can_convert(text, -1, charset, "UTF-8", NULL))
             charset = "UTF-8";
-        }
     }
 
     return charset;
 }
 
-
 static LibBalsaMessage *
-bsmsg2message(BalsaSendmsg *bsmsg)
+bsmsg2message(BalsaSendmsg * bsmsg)
 {
     LibBalsaMessage *message;
     LibBalsaMessageBody *body;
@@ -5231,25 +4830,23 @@ bsmsg2message(BalsaSendmsg *bsmsg)
     message->headers->reply_to =
         libbalsa_address_view_get_list(bsmsg->replyto_view, "Reply To:");
 
-    if (bsmsg->req_mdn) {
-        libbalsa_message_set_dispnotify(message, ident->ia);
-    }
+    if (bsmsg->req_mdn)
+       libbalsa_message_set_dispnotify(message, ident->ia);
     message->request_dsn = bsmsg->req_dsn;
 
     sw_set_header_from_path(message, "Face", ident->face,
-                            /* Translators: please do not translate Face. */
+            /* Translators: please do not translate Face. */
                             _("Could not load Face header file %s: %s"));
     sw_set_header_from_path(message, "X-Face", ident->x_face,
-                            /* Translators: please do not translate Face. */
+            /* Translators: please do not translate Face. */
                             _("Could not load X-Face header file %s: %s"));
 
     message->references = bsmsg->references;
     bsmsg->references = NULL; /* steal it */
 
-    if (bsmsg->in_reply_to) {
+    if (bsmsg->in_reply_to)
         message->in_reply_to =
             g_list_prepend(NULL, g_strdup(bsmsg->in_reply_to));
-    }
 
     body = libbalsa_message_body_new(message);
 
@@ -5275,20 +4872,17 @@ bsmsg2message(BalsaSendmsg *bsmsg)
 
     /* Copy the buffer text to the message: */
     body->buffer = gtk_text_iter_get_text(&start, &end);
-    if (new_buffer) {
+    if (new_buffer)
         g_object_unref(new_buffer);
-    }
 
-    if (bsmsg->send_mp_alt) {
+    if (bsmsg->send_mp_alt)
         body->html_buffer =
             libbalsa_text_to_html(message->subj, body->buffer,
                                   bsmsg->spell_check_lang);
-    }
-    if (bsmsg->flow) {
-        body->buffer =
-            libbalsa_wrap_rfc2646(body->buffer, balsa_app.wraplength,
+    if (bsmsg->flow)
+       body->buffer =
+           libbalsa_wrap_rfc2646(body->buffer, balsa_app.wraplength,
                                   TRUE, FALSE, TRUE);
-    }
 
     /* Ildar reports that, when a message contains both text/plain and
      * text/html parts, some broken MUAs use the charset from the
@@ -5302,10 +4896,9 @@ bsmsg2message(BalsaSendmsg *bsmsg)
     libbalsa_message_append_part(message, body);
 
     /* add attachments */
-    if (bsmsg->tree_view) {
+    if (bsmsg->tree_view)
         gtk_tree_model_foreach(BALSA_MSG_ATTACH_MODEL(bsmsg),
                                attachment2message, message);
-    }
 
     message->headers->date = time(NULL);
 #ifdef HAVE_GPGME
@@ -5322,15 +4915,14 @@ bsmsg2message(BalsaSendmsg *bsmsg)
 
     /* remember the parent window */
     g_object_set_data(G_OBJECT(message), "parent-window",
-                      GTK_WINDOW(bsmsg->window));
+                     GTK_WINDOW(bsmsg->window));
 
     return message;
 }
 
-
 /* ask the user for a subject */
 static gboolean
-subject_not_empty(BalsaSendmsg *bsmsg)
+subject_not_empty(BalsaSendmsg * bsmsg)
 {
     const gchar *subj;
     GtkWidget *no_subj_dialog;
@@ -5347,14 +4939,12 @@ subject_not_empty(BalsaSendmsg *bsmsg)
        than spaces */
     subj = gtk_entry_get_text(GTK_ENTRY(bsmsg->subject[1]));
     if (subj) {
-        const gchar *p = subj;
+       const gchar *p = subj;
 
-        while (*p && g_unichar_isspace(g_utf8_get_char(p))) {
-            p = g_utf8_next_char(p);
-        }
-        if (*p != '\0') {
-            return TRUE;
-        }
+       while (*p && g_unichar_isspace(g_utf8_get_char(p)))
+           p = g_utf8_next_char(p);
+       if (*p != '\0')
+           return TRUE;
     }
 
     /* build the dialog */
@@ -5364,7 +4954,7 @@ subject_not_empty(BalsaSendmsg *bsmsg)
                                     GTK_DIALOG_MODAL |
                                     libbalsa_dialog_flags(),
                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                    _("_Send"), GTK_RESPONSE_OK,
+                                    _("_Send"),   GTK_RESPONSE_OK,
                                     NULL);
     gtk_window_set_resizable (GTK_WINDOW (no_subj_dialog), FALSE);
     gtk_window_set_type_hint (GTK_WINDOW (no_subj_dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
@@ -5386,8 +4976,8 @@ subject_not_empty(BalsaSendmsg *bsmsg)
     gtk_box_pack_start (GTK_BOX (hbox), vbox);
 
     text_str = g_strdup_printf("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s",
-                               _("You did not specify a subject for this message"),
-                               _("If you would like to provide one, enter it below."));
+                              _("You did not specify a subject for this message"),
+                              _("If you would like to provide one, enter it below."));
     label = gtk_label_new (text_str);
     g_free(text_str);
     gtk_box_pack_start (GTK_BOX (vbox), label);
@@ -5417,43 +5007,39 @@ subject_not_empty(BalsaSendmsg *bsmsg)
 
     /* always set the current string in the subject entry */
     gtk_entry_set_text(GTK_ENTRY(bsmsg->subject[1]),
-                       gtk_entry_get_text(GTK_ENTRY(subj_entry)));
+                      gtk_entry_get_text(GTK_ENTRY(subj_entry)));
     gtk_widget_destroy(no_subj_dialog);
 
     return response == GTK_RESPONSE_OK;
 }
 
-
 #ifdef HAVE_GPGME
 static gboolean
-check_suggest_encryption(BalsaSendmsg *bsmsg)
+check_suggest_encryption(BalsaSendmsg * bsmsg)
 {
-    InternetAddressList *ia_list;
+    InternetAddressList * ia_list;
     gboolean can_encrypt;
     gpgme_protocol_t protocol;
     gint len;
 
     /* check if the user wants to see the message */
-    if (!bsmsg->ident->warn_send_plain) {
-        return TRUE;
-    }
+    if (!bsmsg->ident->warn_send_plain)
+       return TRUE;
 
     /* nothing to do if encryption is already enabled */
-    if ((bsmsg->gpg_mode & LIBBALSA_PROTECT_ENCRYPT) != 0) {
-        return TRUE;
-    }
+    if ((bsmsg->gpg_mode & LIBBALSA_PROTECT_ENCRYPT) != 0)
+       return TRUE;
 
     /* we can not encrypt if we have bcc recipients */
     ia_list = libbalsa_address_view_get_list(bsmsg->recipient_view, "BCC:");
     len = internet_address_list_length(ia_list);
     g_object_unref(ia_list);
-    if (len > 0) {
+    if (len > 0)
         return TRUE;
-    }
 
     /* collect all to and cc recipients */
     protocol = bsmsg->gpg_mode & LIBBALSA_PROTECT_SMIMEV3 ?
-        GPGME_PROTOCOL_CMS : GPGME_PROTOCOL_OpenPGP;
+       GPGME_PROTOCOL_CMS : GPGME_PROTOCOL_OpenPGP;
 
     ia_list = libbalsa_address_view_get_list(bsmsg->recipient_view, "To:");
     can_encrypt = libbalsa_can_encrypt_for_all(ia_list, protocol);
@@ -5472,79 +5058,75 @@ check_suggest_encryption(BalsaSendmsg *bsmsg)
 
     /* ask the user if we could encrypt this message */
     if (can_encrypt) {
-        GtkWidget *dialog;
-        gint choice;
-        GtkWidget *button;
-        GtkWidget *hbox;
-        GtkWidget *image;
-        GtkWidget *label;
-
-        dialog = gtk_message_dialog_new
-                (GTK_WINDOW(bsmsg->window),
-                GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
-                GTK_MESSAGE_QUESTION,
-                GTK_BUTTONS_NONE,
-                _("You did not select encryption for this message, although "
-                  "%s public keys are available for all recipients. In order "
-                  "to protect your privacy, the message could be %s encrypted."),
-                gpgme_get_protocol_name(protocol),
-                gpgme_get_protocol_name(protocol));
-#   if HAVE_MACOSX_DESKTOP
+       GtkWidget *dialog;
+       gint choice;
+       GtkWidget *button;
+       GtkWidget *hbox;
+       GtkWidget *image;
+       GtkWidget *label;
+
+       dialog = gtk_message_dialog_new
+           (GTK_WINDOW(bsmsg->window),
+            GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
+            GTK_MESSAGE_QUESTION,
+            GTK_BUTTONS_NONE,
+            _("You did not select encryption for this message, although "
+               "%s public keys are available for all recipients. In order "
+               "to protect your privacy, the message could be %s encrypted."),
+             gpgme_get_protocol_name(protocol),
+             gpgme_get_protocol_name(protocol));
+#if HAVE_MACOSX_DESKTOP
         libbalsa_macosx_menu_for_parent(dialog, GTK_WINDOW(bsmsg->window));
-#   endif
+#endif
 
 
-        button = gtk_button_new();
-        gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button, GTK_RESPONSE_YES);
+       button = gtk_button_new();
+       gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button, GTK_RESPONSE_YES);
         gtk_widget_set_can_default(button, TRUE);
-        gtk_widget_grab_focus(button);
+       gtk_widget_grab_focus(button);
 
-        hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
+       hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
         gtk_widget_set_halign(hbox, GTK_ALIGN_CENTER);
         gtk_widget_set_valign(hbox, GTK_ALIGN_CENTER);
-        gtk_container_add(GTK_CONTAINER(button), hbox);
-        image = gtk_image_new_from_icon_name(balsa_icon_id(BALSA_PIXMAP_GPG_ENCRYPT));
-        gtk_box_pack_start(GTK_BOX(hbox), image);
-        label = gtk_label_new_with_mnemonic(_("Send _encrypted"));
-        gtk_box_pack_start(GTK_BOX(hbox), label);
-
-        button = gtk_button_new();
-        gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button, GTK_RESPONSE_NO);
+       gtk_container_add(GTK_CONTAINER(button), hbox);
+       image = gtk_image_new_from_icon_name(balsa_icon_id(BALSA_PIXMAP_GPG_ENCRYPT));
+       gtk_box_pack_start(GTK_BOX(hbox), image);
+       label = gtk_label_new_with_mnemonic(_("Send _encrypted"));
+       gtk_box_pack_start(GTK_BOX(hbox), label);
+
+       button = gtk_button_new();
+       gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button, GTK_RESPONSE_NO);
         gtk_widget_set_can_default(button, TRUE);
 
-        hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
+       hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
         gtk_widget_set_halign(hbox, GTK_ALIGN_CENTER);
         gtk_widget_set_valign(hbox, GTK_ALIGN_CENTER);
-        gtk_container_add(GTK_CONTAINER(button), hbox);
-        image = gtk_image_new_from_icon_name(balsa_icon_id(BALSA_PIXMAP_SEND));
-        gtk_box_pack_start(GTK_BOX(hbox), image);
-        label = gtk_label_new_with_mnemonic(_("Send _unencrypted"));
-        gtk_box_pack_start(GTK_BOX(hbox), label);
-
-        button = gtk_button_new_with_mnemonic(_("_Cancel"));
-        gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button, GTK_RESPONSE_CANCEL);
+       gtk_container_add(GTK_CONTAINER(button), hbox);
+       image = gtk_image_new_from_icon_name(balsa_icon_id(BALSA_PIXMAP_SEND));
+       gtk_box_pack_start(GTK_BOX(hbox), image);
+       label = gtk_label_new_with_mnemonic(_("Send _unencrypted"));
+       gtk_box_pack_start(GTK_BOX(hbox), label);
+
+       button = gtk_button_new_with_mnemonic(_("_Cancel"));
+       gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button, GTK_RESPONSE_CANCEL);
         gtk_widget_set_can_default(button, TRUE);
 
-        choice = gtk_dialog_run(GTK_DIALOG(dialog));
-        gtk_widget_destroy(dialog);
-        if (choice == GTK_RESPONSE_YES) {
-            bsmsg_setup_gpg_ui_by_mode(bsmsg, bsmsg->gpg_mode | LIBBALSA_PROTECT_ENCRYPT);
-        } else if ((choice == GTK_RESPONSE_CANCEL) || (choice == GTK_RESPONSE_DELETE_EVENT)) {
-            return FALSE;
-        }
+       choice = gtk_dialog_run(GTK_DIALOG(dialog));
+       gtk_widget_destroy(dialog);
+       if (choice == GTK_RESPONSE_YES)
+           bsmsg_setup_gpg_ui_by_mode(bsmsg, bsmsg->gpg_mode | LIBBALSA_PROTECT_ENCRYPT);
+       else if (choice == GTK_RESPONSE_CANCEL || choice == GTK_RESPONSE_DELETE_EVENT)
+           return FALSE;
     }
 
     return TRUE;
 }
-
-
 #endif
 
 /* "send message" menu and toolbar callback.
  */
 static gint
-send_message_handler(BalsaSendmsg *bsmsg,
-                     gboolean      queue_only)
+send_message_handler(BalsaSendmsg * bsmsg, gboolean queue_only)
 {
     LibBalsaMsgCreateResult result;
     LibBalsaMessage *message;
@@ -5552,20 +5134,17 @@ send_message_handler(BalsaSendmsg *bsmsg,
 #ifdef HAVE_GPGME
     GtkTreeIter iter;
 #endif
-    GError *error = NULL;
+    GError * error = NULL;
 
-    if (!bsmsg->ready_to_send) {
-        return FALSE;
-    }
+    if (!bsmsg->ready_to_send)
+       return FALSE;
 
-    if (!subject_not_empty(bsmsg)) {
-        return FALSE;
-    }
+    if(!subject_not_empty(bsmsg))
+       return FALSE;
 
 #ifdef HAVE_GPGME
-    if (!check_suggest_encryption(bsmsg)) {
-        return FALSE;
-    }
+    if (!check_suggest_encryption(bsmsg))
+       return FALSE;
 
     if ((bsmsg->gpg_mode & LIBBALSA_PROTECT_OPENPGP) != 0) {
         gboolean warn_mp;
@@ -5582,39 +5161,36 @@ send_message_handler(BalsaSendmsg *bsmsg,
              * RFC2440 sign a multipart/alternative... */
             GtkWidget *dialog;
             gint choice;
-            GString *string =
+            GString * string =
                 g_string_new(_("You selected OpenPGP security for this message.\n"));
 
-            if (warn_html_sign) {
+            if (warn_html_sign)
                 string =
                     g_string_append(string,
-                                    _("The message text will be sent as plain text and as "
-                                      "HTML, but only the plain part can be signed.\n"));
-            }
-            if (warn_mp) {
+                        _("The message text will be sent as plain text and as "
+                          "HTML, but only the plain part can be signed.\n"));
+            if (warn_mp)
                 string =
                     g_string_append(string,
-                                    _("The message contains attachments, which cannot be "
-                                      "signed or encrypted.\n"));
-            }
+                        _("The message contains attachments, which cannot be "
+                          "signed or encrypted.\n"));
             string =
                 g_string_append(string,
-                                _("You should select MIME mode if the complete "
-                                  "message shall be protected. Do you really want to proceed?"));
+                    _("You should select MIME mode if the complete "
+                      "message shall be protected. Do you really want to proceed?"));
             dialog = gtk_message_dialog_new
-                    (GTK_WINDOW(bsmsg->window),
-                    GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
-                    GTK_MESSAGE_QUESTION,
-                    GTK_BUTTONS_OK_CANCEL, "%s", string->str);
-#   if HAVE_MACOSX_DESKTOP
-            libbalsa_macosx_menu_for_parent(dialog, GTK_WINDOW(bsmsg->window));
-#   endif
+                (GTK_WINDOW(bsmsg->window),
+                 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
+                 GTK_MESSAGE_QUESTION,
+                 GTK_BUTTONS_OK_CANCEL, "%s", string->str);
+#if HAVE_MACOSX_DESKTOP
+           libbalsa_macosx_menu_for_parent(dialog, GTK_WINDOW(bsmsg->window));
+#endif
             g_string_free(string, TRUE);
             choice = gtk_dialog_run(GTK_DIALOG(dialog));
             gtk_widget_destroy(dialog);
-            if (choice != GTK_RESPONSE_OK) {
+            if (choice != GTK_RESPONSE_OK)
                 return FALSE;
-            }
         }
     }
 #endif
@@ -5629,23 +5205,21 @@ send_message_handler(BalsaSendmsg *bsmsg,
                                message->gpg_mode);
 #endif
 
-    if (queue_only) {
-        result = libbalsa_message_queue(message, balsa_app.outbox, fcc,
-                                        bsmsg->ident->smtp_server,
-                                        bsmsg->flow, &error);
-    } else {
+    if(queue_only)
+       result = libbalsa_message_queue(message, balsa_app.outbox, fcc,
+                                       bsmsg->ident->smtp_server,
+                                       bsmsg->flow, &error);
+    else
         result = libbalsa_message_send(message, balsa_app.outbox, fcc,
                                        balsa_find_sentbox_by_url,
-                                       bsmsg->ident->smtp_server,
-                                       balsa_app.send_progress_dialog,
+                                      bsmsg->ident->smtp_server,
+                                                                          balsa_app.send_progress_dialog,
                                        GTK_WINDOW(balsa_app.main_window),
                                        bsmsg->flow, &error);
-    }
     if (result == LIBBALSA_MESSAGE_CREATE_OK) {
-        if (bsmsg->parent_message && bsmsg->parent_message->mailbox
-            && !bsmsg->parent_message->mailbox->readonly) {
-            libbalsa_message_reply(bsmsg->parent_message);
-        }
+       if (bsmsg->parent_message && bsmsg->parent_message->mailbox
+            && !bsmsg->parent_message->mailbox->readonly)
+           libbalsa_message_reply(bsmsg->parent_message);
         sw_delete_draft(bsmsg);
     }
 
@@ -5653,45 +5227,33 @@ send_message_handler(BalsaSendmsg *bsmsg,
 
     if (result != LIBBALSA_MESSAGE_CREATE_OK) {
         const char *msg;
-        switch (result) {
+        switch(result) {
         default:
         case LIBBALSA_MESSAGE_CREATE_ERROR:
-            msg = _("Message could not be created");
-            break;
-
+            msg = _("Message could not be created"); break;
         case LIBBALSA_MESSAGE_QUEUE_ERROR:
-            msg = _("Message could not be queued in outbox");
-            break;
-
+            msg = _("Message could not be queued in outbox"); break;
         case LIBBALSA_MESSAGE_SAVE_ERROR:
-            msg = _("Message could not be saved in sentbox");
-            break;
-
+            msg = _("Message could not be saved in sentbox"); break;
         case LIBBALSA_MESSAGE_SEND_ERROR:
-            msg = _("Message could not be sent");
-            break;
-
+            msg = _("Message could not be sent"); break;
 #ifdef HAVE_GPGME
-        case LIBBALSA_MESSAGE_SIGN_ERROR:
-            msg = _("Message could not be signed");
-            break;
-
-        case LIBBALSA_MESSAGE_ENCRYPT_ERROR:
-            msg = _("Message could not be encrypted");
-            break;
+       case LIBBALSA_MESSAGE_SIGN_ERROR:
+            msg = _("Message could not be signed"); break;
+       case LIBBALSA_MESSAGE_ENCRYPT_ERROR:
+            msg = _("Message could not be encrypted"); break;
 #endif
         }
-        if (error) {
-            balsa_information_parented(GTK_WINDOW(bsmsg->window),
-                                       LIBBALSA_INFORMATION_ERROR,
-                                       _("Send failed: %s\n%s"), msg,
-                                       error->message);
-        } else {
-            balsa_information_parented(GTK_WINDOW(bsmsg->window),
-                                       LIBBALSA_INFORMATION_ERROR,
-                                       _("Send failed: %s"), msg);
-        }
-        return FALSE;
+       if (error)
+           balsa_information_parented(GTK_WINDOW(bsmsg->window),
+                                      LIBBALSA_INFORMATION_ERROR,
+                                      _("Send failed: %s\n%s"), msg,
+                                      error->message);
+       else
+           balsa_information_parented(GTK_WINDOW(bsmsg->window),
+                                      LIBBALSA_INFORMATION_ERROR,
+                                      _("Send failed: %s"), msg);
+       return FALSE;
     }
     g_clear_error(&error);
 
@@ -5703,20 +5265,15 @@ send_message_handler(BalsaSendmsg *bsmsg,
 
 /* "send message" menu callback */
 static void
-sw_toolbar_send_activated(GSimpleAction *action,
-                          GVariant      *parameter,
-                          gpointer       data)
+sw_toolbar_send_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
     send_message_handler(bsmsg, balsa_app.always_queue_sent_mail);
 }
 
-
 static void
-sw_send_activated(GSimpleAction *action,
-                  GVariant      *parameter,
-                  gpointer       data)
+sw_send_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -5725,18 +5282,15 @@ sw_send_activated(GSimpleAction *action,
 
 
 static void
-sw_queue_activated(GSimpleAction *action,
-                   GVariant      *parameter,
-                   gpointer       data)
+sw_queue_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
     send_message_handler(bsmsg, TRUE);
 }
 
-
 static gboolean
-message_postpone(BalsaSendmsg *bsmsg)
+message_postpone(BalsaSendmsg * bsmsg)
 {
     gboolean successp;
     LibBalsaMessage *message;
@@ -5780,46 +5334,44 @@ message_postpone(BalsaSendmsg *bsmsg)
     g_ptr_array_add(headers, g_strdup_printf("%d", bsmsg->type));
     g_ptr_array_add(headers, NULL);
 
-    if (((bsmsg->type == SEND_REPLY) || (bsmsg->type == SEND_REPLY_ALL) ||
-         (bsmsg->type == SEND_REPLY_GROUP))) {
-        successp = libbalsa_message_postpone(message, balsa_app.draftbox,
+    if ((bsmsg->type == SEND_REPLY || bsmsg->type == SEND_REPLY_ALL ||
+        bsmsg->type == SEND_REPLY_GROUP))
+       successp = libbalsa_message_postpone(message, balsa_app.draftbox,
                                              bsmsg->parent_message,
                                              (gchar **) headers->pdata,
                                              bsmsg->flow, &error);
-    } else {
-        successp = libbalsa_message_postpone(message, balsa_app.draftbox,
+    else
+       successp = libbalsa_message_postpone(message, balsa_app.draftbox,
                                              NULL,
                                              (gchar **) headers->pdata,
                                              bsmsg->flow, &error);
-    }
     g_ptr_array_foreach(headers, (GFunc) g_free, NULL);
     g_ptr_array_free(headers, TRUE);
 
-    if (successp) {
+    if(successp)
         sw_delete_draft(bsmsg);
-    } else {
+    else {
         balsa_information_parented(GTK_WINDOW(bsmsg->window),
                                    LIBBALSA_INFORMATION_ERROR,
                                    _("Could not postpone message: %s"),
-                                   error ? error->message : "");
-        g_clear_error(&error);
+                                  error ? error->message : "");
+       g_clear_error(&error);
     }
 
     g_object_unref(G_OBJECT(message));
     return successp;
 }
 
-
 /* "postpone message" menu callback */
 static void
-sw_postpone_activated(GSimpleAction *action,
-                      GVariant      *parameter,
-                      gpointer       data)
+sw_postpone_activated(GSimpleAction * action,
+                      GVariant      * parameter,
+                      gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
     if (bsmsg->ready_to_send) {
-        if (message_postpone(bsmsg)) {
+        if(message_postpone(bsmsg)) {
             balsa_information_parented(GTK_WINDOW(bsmsg->window),
                                        LIBBALSA_INFORMATION_MESSAGE,
                                        _("Message postponed."));
@@ -5832,24 +5384,21 @@ sw_postpone_activated(GSimpleAction *action,
     }
 }
 
-
 static void
-sw_save_activated(GSimpleAction *action,
-                  GVariant      *parameter,
-                  gpointer       data)
+sw_save_activated(GSimpleAction * action,
+                  GVariant      * parameter,
+                  gpointer        data)
 {
     BalsaSendmsg *bsmsg = data;
 
-    if (sw_save_draft(bsmsg)) {
+    if (sw_save_draft(bsmsg))
         bsmsg->state = SENDMSG_STATE_CLEAN;
-    }
 }
 
-
 static void
-sw_page_setup_activated(GSimpleAction *action,
-                        GVariant      *parameter,
-                        gpointer       data)
+sw_page_setup_activated(GSimpleAction * action,
+                        GVariant      * parameter,
+                        gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
     LibBalsaMessage *message;
@@ -5859,11 +5408,10 @@ sw_page_setup_activated(GSimpleAction *action,
     g_object_unref(message);
 }
 
-
 static void
-sw_print_activated(GSimpleAction *action,
-                   GVariant      *parameter,
-                   gpointer       data)
+sw_print_activated(GSimpleAction * action,
+                   GVariant      * parameter,
+                   gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
     LibBalsaMessage *message;
@@ -5873,7 +5421,6 @@ sw_print_activated(GSimpleAction *action,
     g_object_unref(message);
 }
 
-
 /*
  * Signal handlers for updating the cursor when text is inserted.
  * The "insert-text" signal is emitted before the insertion, so we
@@ -5886,11 +5433,8 @@ sw_print_activated(GSimpleAction *action,
  * the insertion.
  */
 static void
-sw_buffer_insert_text(GtkTextBuffer *buffer,
-                      GtkTextIter   *iter,
-                      const gchar   *text,
-                      gint           len,
-                      BalsaSendmsg  *bsmsg)
+sw_buffer_insert_text(GtkTextBuffer * buffer, GtkTextIter * iter,
+                      const gchar * text, gint len, BalsaSendmsg * bsmsg)
 {
     bsmsg->insert_mark =
         gtk_text_buffer_create_mark(buffer, "balsa-insert-mark", iter,
@@ -5898,17 +5442,14 @@ sw_buffer_insert_text(GtkTextBuffer *buffer,
 #if !HAVE_GTKSOURCEVIEW
     /* If this insertion is not from the keyboard, or if we just undid
      * something, save the current buffer for undo. */
-    if ((len > 1) /* Not keyboard? */
-        || !sw_action_get_enabled(bsmsg, "undo")) {
+    if (len > 1 /* Not keyboard? */
+        || !sw_action_get_enabled(bsmsg, "undo"))
         sw_buffer_save(bsmsg);
-    }
 #endif                          /* HAVE_GTKSOURCEVIEW */
 }
 
-
 static void
-sw_buffer_changed(GtkTextBuffer *buffer,
-                  BalsaSendmsg  *bsmsg)
+sw_buffer_changed(GtkTextBuffer * buffer, BalsaSendmsg * bsmsg)
 {
     if (bsmsg->insert_mark) {
         GtkTextIter iter;
@@ -5922,28 +5463,22 @@ sw_buffer_changed(GtkTextBuffer *buffer,
     bsmsg->state = SENDMSG_STATE_MODIFIED;
 }
 
-
 #if !HAVE_GTKSOURCEVIEW
 static void
-sw_buffer_delete_range(GtkTextBuffer *buffer,
-                       GtkTextIter   *start,
-                       GtkTextIter   *end,
-                       BalsaSendmsg  *bsmsg)
+sw_buffer_delete_range(GtkTextBuffer * buffer, GtkTextIter * start,
+                       GtkTextIter * end, BalsaSendmsg * bsmsg)
 {
     if (gtk_text_iter_get_offset(end) >
-        gtk_text_iter_get_offset(start) + 1) {
+        gtk_text_iter_get_offset(start) + 1)
         sw_buffer_save(bsmsg);
-    }
 }
-
-
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 /*
  * Helpers for the undo and redo buffers.
  */
 static void
-sw_buffer_signals_connect(BalsaSendmsg *bsmsg)
+sw_buffer_signals_connect(BalsaSendmsg * bsmsg)
 {
     GtkTextBuffer *buffer =
         gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
@@ -5961,35 +5496,28 @@ sw_buffer_signals_connect(BalsaSendmsg *bsmsg)
 #endif                          /* HAVE_GTKSOURCEVIEW */
 }
 
-
 #if !HAVE_GTKSOURCEVIEW || !(HAVE_GSPELL || HAVE_GTKSPELL)
 static void
-sw_buffer_signals_disconnect(BalsaSendmsg *bsmsg)
+sw_buffer_signals_disconnect(BalsaSendmsg * bsmsg)
 {
     GtkTextBuffer *buffer =
         gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
 
     g_signal_handler_disconnect(buffer, bsmsg->changed_sig_id);
-#   if !HAVE_GTKSOURCEVIEW
+#if !HAVE_GTKSOURCEVIEW
     g_signal_handler_disconnect(buffer, bsmsg->delete_range_sig_id);
-#   endif                       /* HAVE_GTKSOURCEVIEW */
+#endif                          /* HAVE_GTKSOURCEVIEW */
     g_signal_handler_disconnect(buffer, bsmsg->insert_text_sig_id);
 }
-
-
 #endif                          /* !HAVE_GTKSOURCEVIEW || !HAVE_GTKSPELL */
 
 #if !HAVE_GTKSOURCEVIEW
 static void
-sw_buffer_set_undo(BalsaSendmsg *bsmsg,
-                   gboolean      undo,
-                   gboolean      redo)
+sw_buffer_set_undo(BalsaSendmsg * bsmsg, gboolean undo, gboolean redo)
 {
     sw_action_set_enabled(bsmsg, "undo", undo);
     sw_action_set_enabled(bsmsg, "redo", redo);
 }
-
-
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 #ifdef HAVE_GTKSPELL
@@ -6001,16 +5529,16 @@ sw_buffer_set_undo(BalsaSendmsg *bsmsg,
  * the menu, set the appropriate item active.
  */
 static void
-sw_spell_language_changed_cb(GtkSpellChecker *spell,
-                             const gchar     *new_lang,
-                             gpointer         data)
+sw_spell_language_changed_cb(GtkSpellChecker * spell,
+                             const gchar     * new_lang,
+                             gpointer          data)
 {
     BalsaSendmsg *bsmsg = data;
     GtkWidget *langs;
     GList *list, *children;
 
     langs = gtk_menu_item_get_submenu(GTK_MENU_ITEM
-                                          (bsmsg->current_language_menu));
+                                      (bsmsg->current_language_menu));
     children = gtk_container_get_children(GTK_CONTAINER(langs));
 
     for (list = children; list; list = list->next) {
@@ -6036,23 +5564,20 @@ sw_spell_language_changed_cb(GtkSpellChecker *spell,
     balsa_app.spell_check_lang = g_strdup(new_lang);
 }
 
-
 static gboolean
-sw_spell_detach(BalsaSendmsg *bsmsg)
+sw_spell_detach(BalsaSendmsg * bsmsg)
 {
     GtkSpellChecker *spell;
 
     spell = gtk_spell_checker_get_from_text_view(GTK_TEXT_VIEW(bsmsg->text));
-    if (spell) {
+    if (spell)
         gtk_spell_checker_detach(spell);
-    }
 
     return spell != NULL;
 }
 
-
 static void
-sw_spell_attach(BalsaSendmsg *bsmsg)
+sw_spell_attach(BalsaSendmsg * bsmsg)
 {
     GtkSpellChecker *spell;
     GError *err = NULL;
@@ -6078,41 +5603,36 @@ sw_spell_attach(BalsaSendmsg *bsmsg)
                          G_CALLBACK(sw_spell_language_changed_cb), bsmsg);
     }
 }
-
-
 #endif                          /* HAVE_GTKSPELL */
 
 #if !HAVE_GTKSOURCEVIEW
 static void
-sw_buffer_swap(BalsaSendmsg *bsmsg,
-               gboolean      undo)
+sw_buffer_swap(BalsaSendmsg * bsmsg, gboolean undo)
 {
     GtkTextBuffer *buffer =
         gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
-#   if HAVE_GTKSPELL
+#if HAVE_GTKSPELL
     gboolean had_spell;
 
     /* GtkSpell doesn't seem to handle setting a new buffer... */
     had_spell = sw_spell_detach(bsmsg);
-#   endif                       /* HAVE_GTKSPELL */
+#endif                          /* HAVE_GTKSPELL */
 
     sw_buffer_signals_disconnect(bsmsg);
     g_object_ref(G_OBJECT(buffer));
     gtk_text_view_set_buffer(GTK_TEXT_VIEW(bsmsg->text), bsmsg->buffer2);
-#   if HAVE_GTKSPELL
-    if (had_spell) {
+#if HAVE_GTKSPELL
+    if (had_spell)
         sw_spell_attach(bsmsg);
-    }
-#   endif                       /* HAVE_GTKSPELL */
+#endif                          /* HAVE_GTKSPELL */
     g_object_unref(bsmsg->buffer2);
     bsmsg->buffer2 = buffer;
     sw_buffer_signals_connect(bsmsg);
     sw_buffer_set_undo(bsmsg, !undo, undo);
 }
 
-
 static void
-sw_buffer_save(BalsaSendmsg *bsmsg)
+sw_buffer_save(BalsaSendmsg * bsmsg)
 {
     GtkTextBuffer *buffer =
         gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
@@ -6125,8 +5645,6 @@ sw_buffer_save(BalsaSendmsg *bsmsg)
 
     sw_buffer_set_undo(bsmsg, TRUE, FALSE);
 }
-
-
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 /*
@@ -6135,58 +5653,43 @@ sw_buffer_save(BalsaSendmsg *bsmsg)
 
 #if HAVE_GTKSOURCEVIEW
 static void
-sw_undo_activated(GSimpleAction *action,
-                  GVariant      *parameter,
-                  gpointer       data)
+sw_undo_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
     g_signal_emit_by_name(bsmsg->text, "undo");
 }
 
-
 static void
-sw_redo_activated(GSimpleAction *action,
-                  GVariant      *parameter,
-                  gpointer       data)
+sw_redo_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
     g_signal_emit_by_name(bsmsg->text, "redo");
 }
-
-
 #else                           /* HAVE_GTKSOURCEVIEW */
 static void
-sw_undo_activated(GSimpleAction *action,
-                  GVariant      *parameter,
-                  gpointer       data)
+sw_undo_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
     sw_buffer_swap(bsmsg, TRUE);
 }
 
-
 static void
-sw_redo_activated(GSimpleAction *action,
-                  GVariant      *parameter,
-                  gpointer       data)
+sw_redo_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
     sw_buffer_swap(bsmsg, FALSE);
 }
-
-
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 /*
  * Cut, copy, and paste callbacks, and a helper.
  */
 static void
-clipboard_helper(BalsaSendmsg *bsmsg,
-                 gchar        *signal)
+clipboard_helper(BalsaSendmsg * bsmsg, gchar * signal)
 {
     guint signal_id;
     GtkWidget *focus_widget =
@@ -6194,57 +5697,51 @@ clipboard_helper(BalsaSendmsg *bsmsg,
 
     signal_id =
         g_signal_lookup(signal, G_TYPE_FROM_INSTANCE(focus_widget));
-    if (signal_id) {
+    if (signal_id)
         g_signal_emit(focus_widget, signal_id, (GQuark) 0);
-    }
 }
 
-
 static void
-sw_cut_activated(GSimpleAction *action,
-                 GVariant      *parameter,
-                 gpointer       data)
+sw_cut_activated(GSimpleAction * action,
+                 GVariant      * parameter,
+                 gpointer        data)
 {
     clipboard_helper(data, "cut-clipboard");
 }
 
-
 static void
-sw_copy_activated(GSimpleAction *action,
-                  GVariant      *parameter,
-                  gpointer       data)
+sw_copy_activated(GSimpleAction * action,
+                  GVariant      * parameter,
+                  gpointer        data)
 {
     clipboard_helper(data, "copy-clipboard");
 }
 
-
 static void
-sw_paste_activated(GSimpleAction *action,
-                   GVariant      *parameter,
-                   gpointer       data)
+sw_paste_activated(GSimpleAction * action,
+                   GVariant      * parameter,
+                   gpointer        data)
 {
     clipboard_helper(data, "paste-clipboard");
 }
 
-
 /*
  * More menu callbacks.
  */
 static void
-sw_select_text_activated(GSimpleAction *action,
-                         GVariant      *parameter,
-                         gpointer       data)
+sw_select_text_activated(GSimpleAction * action,
+                         GVariant      * parameter,
+                         gpointer        data)
 {
     BalsaSendmsg *bsmsg = data;
 
     balsa_window_select_all(GTK_WINDOW(bsmsg->window));
 }
 
-
 static void
-sw_wrap_body_activated(GSimpleAction *action,
-                       GVariant      *parameter,
-                       gpointer       data)
+sw_wrap_body_activated(GSimpleAction * action,
+                       GVariant      * parameter,
+                       gpointer        data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -6254,24 +5751,19 @@ sw_wrap_body_activated(GSimpleAction *action,
     sw_wrap_body(bsmsg);
 }
 
-
 static void
-sw_reflow_activated(GSimpleAction *action,
-                    GVariant      *parameter,
-                    gpointer       data)
+sw_reflow_activated(GSimpleAction * action, GVariant * parameter, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
     GtkTextView *text_view;
     GtkTextBuffer *buffer;
     GRegex *rex;
 
-    if (!bsmsg->flow) {
-        return;
-    }
+    if (!bsmsg->flow)
+       return;
 
-    if (!(rex = balsa_quote_regex_new())) {
+    if (!(rex = balsa_quote_regex_new()))
         return;
-    }
 
 #if !HAVE_GTKSOURCEVIEW
     sw_buffer_save(bsmsg);
@@ -6285,31 +5777,28 @@ sw_reflow_activated(GSimpleAction *action,
 
     bsmsg->state = SENDMSG_STATE_MODIFIED;
     gtk_text_view_scroll_to_mark(text_view,
-                                 gtk_text_buffer_get_insert(buffer),
-                                 0, FALSE, 0, 0);
+                                gtk_text_buffer_get_insert(buffer),
+                                0, FALSE, 0, 0);
 
     g_regex_unref(rex);
 }
 
-
 /* To field "changed" signal callback. */
 static void
-check_readiness(BalsaSendmsg *bsmsg)
+check_readiness(BalsaSendmsg * bsmsg)
 {
     gboolean ready =
         libbalsa_address_view_n_addresses(bsmsg->recipient_view) > 0;
     if (ready
-        && (libbalsa_address_view_n_addresses(bsmsg->replyto_view) < 0)) {
+        && libbalsa_address_view_n_addresses(bsmsg->replyto_view) < 0)
         ready = FALSE;
-    }
 
     bsmsg->ready_to_send = ready;
     sw_actions_set_enabled(bsmsg, ready_actions,
                            G_N_ELEMENTS(ready_actions), ready);
 }
 
-
-static const gchar *const header_action_names[] = {
+static const gchar * const header_action_names[] = {
     "from",
     "recips",
     "reply-to",
@@ -6321,10 +5810,10 @@ static const gchar *const header_action_names[] = {
    saves the show header configuration.
  */
 static void
-sw_entry_helper(GSimpleAction *action,
-                GVariant      *state,
-                BalsaSendmsg  *bsmsg,
-                GtkWidget     *entry[])
+sw_entry_helper(GSimpleAction      * action,
+                GVariant     * state,
+                BalsaSendmsg * bsmsg,
+                GtkWidget    * entry[])
 {
     if (g_variant_get_boolean(state)) {
         gtk_widget_show(entry[0]);
@@ -6343,9 +5832,8 @@ sw_entry_helper(GSimpleAction *action,
 
         for (i = 0; i < G_N_ELEMENTS(header_action_names); i++) {
             if (sw_action_get_active(bsmsg, header_action_names[i])) {
-                if (str->len > 0) {
+                if (str->len > 0)
                     g_string_append_c(str, ' ');
-                }
                 g_string_append(str, header_action_names[i]);
             }
         }
@@ -6356,55 +5844,40 @@ sw_entry_helper(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 static void
-sw_from_change_state(GSimpleAction *action,
-                     GVariant      *state,
-                     gpointer       data)
+sw_from_change_state(GSimpleAction * action, GVariant * state, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
     sw_entry_helper(action, state, bsmsg, bsmsg->from);
 }
 
-
 static void
-sw_recips_change_state(GSimpleAction *action,
-                       GVariant      *state,
-                       gpointer       data)
+sw_recips_change_state(GSimpleAction * action, GVariant * state, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
     sw_entry_helper(action, state, bsmsg, bsmsg->recipients);
 }
 
-
 static void
-sw_reply_to_change_state(GSimpleAction *action,
-                         GVariant      *state,
-                         gpointer       data)
+sw_reply_to_change_state(GSimpleAction * action, GVariant * state, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
     sw_entry_helper(action, state, bsmsg, bsmsg->replyto);
 }
 
-
 static void
-sw_fcc_change_state(GSimpleAction *action,
-                    GVariant      *state,
-                    gpointer       data)
+sw_fcc_change_state(GSimpleAction * action, GVariant * state, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
     sw_entry_helper(action, state, bsmsg, bsmsg->fcc);
 }
 
-
 static void
-sw_request_mdn_change_state(GSimpleAction *action,
-                            GVariant      *state,
-                            gpointer       data)
+sw_request_mdn_change_state(GSimpleAction * action, GVariant * state, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -6413,11 +5886,8 @@ sw_request_mdn_change_state(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 static void
-sw_request_dsn_change_state(GSimpleAction *action,
-                            GVariant      *state,
-                            gpointer       data)
+sw_request_dsn_change_state(GSimpleAction * action, GVariant * state, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -6426,29 +5896,22 @@ sw_request_dsn_change_state(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 static void
-sw_show_toolbar_change_state(GSimpleAction *action,
-                             GVariant      *state,
-                             gpointer       data)
+sw_show_toolbar_change_state(GSimpleAction * action, GVariant * state, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
     balsa_app.show_compose_toolbar = g_variant_get_boolean(state);
-    if (balsa_app.show_compose_toolbar) {
+    if (balsa_app.show_compose_toolbar)
         gtk_widget_show(bsmsg->toolbar);
-    } else {
+    else
         gtk_widget_hide(bsmsg->toolbar);
-    }
 
     g_simple_action_set_state(action, state);
 }
 
-
 static void
-sw_flowed_change_state(GSimpleAction *action,
-                       GVariant      *state,
-                       gpointer       data)
+sw_flowed_change_state(GSimpleAction * action, GVariant * state, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -6458,11 +5921,8 @@ sw_flowed_change_state(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 static void
-sw_send_html_change_state(GSimpleAction *action,
-                          GVariant      *state,
-                          gpointer       data)
+sw_send_html_change_state(GSimpleAction * action, GVariant * state, gpointer data)
 {
     BalsaSendmsg *bsmsg = data;
 
@@ -6471,23 +5931,21 @@ sw_send_html_change_state(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 #ifdef HAVE_GPGME
 static void
-sw_gpg_helper(GSimpleAction *action,
-              GVariant      *state,
-              gpointer       data,
-              guint          mask)
+sw_gpg_helper(GSimpleAction  * action,
+              GVariant       * state,
+              gpointer         data,
+              guint            mask)
 {
     BalsaSendmsg *bsmsg = data;
     gboolean butval, radio_on;
 
     butval = g_variant_get_boolean(state);
-    if (butval) {
+    if (butval)
         bsmsg->gpg_mode |= mask;
-    } else {
+    else
         bsmsg->gpg_mode &= ~mask;
-    }
 
     radio_on = (bsmsg->gpg_mode & LIBBALSA_PROTECT_MODE) > 0;
     sw_action_set_enabled(bsmsg, "gpg-mode", radio_on);
@@ -6495,29 +5953,20 @@ sw_gpg_helper(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 static void
-sw_sign_change_state(GSimpleAction *action,
-                     GVariant      *state,
-                     gpointer       data)
+sw_sign_change_state(GSimpleAction * action, GVariant * state, gpointer data)
 {
     sw_gpg_helper(action, state, data, LIBBALSA_PROTECT_SIGN);
 }
 
-
 static void
-sw_encrypt_change_state(GSimpleAction *action,
-                        GVariant      *state,
-                        gpointer       data)
+sw_encrypt_change_state(GSimpleAction * action, GVariant * state, gpointer data)
 {
     sw_gpg_helper(action, state, data, LIBBALSA_PROTECT_ENCRYPT);
 }
 
-
 static void
-sw_att_pubkey_change_state(GSimpleAction *action,
-                           GVariant      *state,
-                           gpointer       data)
+sw_att_pubkey_change_state(GSimpleAction * action, GVariant * state, gpointer data)
 {
     BalsaSendmsg *bsmsg = (BalsaSendmsg *) data;
 
@@ -6525,24 +5974,23 @@ sw_att_pubkey_change_state(GSimpleAction *action,
     g_simple_action_set_state(action, state);
 }
 
-
 static void
-sw_gpg_mode_change_state(GSimpleAction *action,
-                         GVariant      *state,
-                         gpointer       data)
+sw_gpg_mode_change_state(GSimpleAction  * action,
+                         GVariant       * state,
+                         gpointer         data)
 {
     BalsaSendmsg *bsmsg = data;
     const gchar *mode;
     guint rfc_flag = 0;
 
     mode = g_variant_get_string(state, NULL);
-    if (strcmp(mode, "mime") == 0) {
+    if (strcmp(mode, "mime") == 0)
         rfc_flag = LIBBALSA_PROTECT_RFC3156;
-    } else if (strcmp(mode, "open-pgp") == 0) {
+    else if (strcmp(mode, "open-pgp") == 0)
         rfc_flag = LIBBALSA_PROTECT_OPENPGP;
-    } else if (strcmp(mode, "smime") == 0) {
+    else if (strcmp(mode, "smime") == 0)
         rfc_flag = LIBBALSA_PROTECT_SMIMEV3;
-    } else {
+    else {
         g_print("%s unknown mode “%s”\n", __func__, mode);
         return;
     }
@@ -6552,17 +6000,15 @@ sw_gpg_mode_change_state(GSimpleAction *action,
 
     g_simple_action_set_state(action, state);
 }
-
-
 #endif                          /* HAVE_GPGME */
 
 
 /* init_menus:
    performs the initial menu setup: shown headers as well as correct
    message charset.
- */
+*/
 static void
-init_menus(BalsaSendmsg *bsmsg)
+init_menus(BalsaSendmsg * bsmsg)
 {
     unsigned i;
 
@@ -6576,10 +6022,10 @@ init_menus(BalsaSendmsg *bsmsg)
                 const gchar *old_action_name;
                 const gchar *new_action_name;
             } name_map[] = {
-                {"From", "from"},
+                {"From",       "from"},
                 {"Recipients", "recips"},
-                {"ReplyTo", "reply-to"},
-                {"Fcc", "fcc"}
+                {"ReplyTo",    "reply-to"},
+                {"Fcc",        "fcc"}
             };
             guint j;
 
@@ -6599,10 +6045,8 @@ init_menus(BalsaSendmsg *bsmsg)
     check_readiness(bsmsg);
 }
 
-
 static void
-set_locale(BalsaSendmsg *bsmsg,
-           const gchar  *locale)
+set_locale(BalsaSendmsg * bsmsg, const gchar * locale)
 {
 #if HAVE_GSPELL
     if (sw_action_get_enabled(bsmsg, "spell-check")) {
@@ -6627,26 +6071,24 @@ set_locale(BalsaSendmsg *bsmsg,
 
 #if HAVE_GTKSPELL
     if (sw_action_get_enabled(bsmsg, "spell-check")) {
-        if (sw_spell_detach(bsmsg)) {
+        if (sw_spell_detach(bsmsg))
             sw_spell_attach(bsmsg);
-        }
     }
 #endif                          /* HAVE_GTKSPELL */
 }
 
-
 #if HAVE_GSPELL || HAVE_GTKSPELL
 /* spell_check_menu_cb
  *
  * Toggle the spell checker
  */
 static void
-sw_spell_check_change_state(GSimpleAction *action,
-                            GVariant      *state,
-                            gpointer       data)
+sw_spell_check_change_state(GSimpleAction * action,
+                            GVariant      * state,
+                            gpointer        data)
 {
     BalsaSendmsg *bsmsg = data;
-#   if HAVE_GSPELL
+#if HAVE_GSPELL
     GtkTextView *text_view;
     GspellTextView *gspell_view;
 
@@ -6655,28 +6097,26 @@ sw_spell_check_change_state(GSimpleAction *action,
     gspell_view = gspell_text_view_get_from_gtk_text_view(text_view);
     gspell_text_view_set_inline_spell_checking(gspell_view,
                                                balsa_app.spell_check_active);
-#   elif HAVE_GTKSPELL
+#elif HAVE_GTKSPELL
 
-    if ((balsa_app.spell_check_active = g_variant_get_boolean(state))) {
+    if ((balsa_app.spell_check_active = g_variant_get_boolean(state)))
         sw_spell_attach(bsmsg);
-    } else {
+    else
         sw_spell_detach(bsmsg);
-    }
-#   endif                       /* HAVE_GSPELL */
+#endif                          /* HAVE_GSPELL */
 
     g_simple_action_set_state(action, state);
 }
 
-
 #else                           /* HAVE_GTKSPELL */
 /* spell_check_cb
  *
  * Start the spell check
  * */
 static void
-sw_spell_check_activated(GSimpleAction *action,
-                         GVariant      *parameter,
-                         gpointer       data)
+sw_spell_check_activated(GSimpleAction * action,
+                         GVariant      * parameter,
+                         gpointer        data)
 {
     BalsaSendmsg *bsmsg = data;
     GtkTextView *text_view = GTK_TEXT_VIEW(bsmsg->text);
@@ -6686,11 +6126,10 @@ sw_spell_check_activated(GSimpleAction *action,
         if (gtk_widget_get_window(bsmsg->spell_checker)) {
             gtk_window_present(GTK_WINDOW(bsmsg->spell_checker));
             return;
-        } else {
+        } else
             /* A spell checker was created, but not shown because of
              * errors; we'll destroy it, and create a new one. */
             gtk_widget_destroy(bsmsg->spell_checker);
-        }
     }
 
     sw_buffer_signals_disconnect(bsmsg);
@@ -6703,27 +6142,23 @@ sw_spell_check_activated(GSimpleAction *action,
     balsa_spell_check_set_language(sc, bsmsg->spell_check_lang);
 
     g_object_weak_ref(G_OBJECT(sc),
-                      (GWeakNotify) sw_spell_check_weak_notify, bsmsg);
+                     (GWeakNotify) sw_spell_check_weak_notify, bsmsg);
     gtk_text_view_set_editable(text_view, FALSE);
 
     balsa_spell_check_start(sc);
 }
 
-
 static void
-sw_spell_check_weak_notify(BalsaSendmsg *bsmsg)
+sw_spell_check_weak_notify(BalsaSendmsg * bsmsg)
 {
     bsmsg->spell_checker = NULL;
     gtk_text_view_set_editable(GTK_TEXT_VIEW(bsmsg->text), TRUE);
     sw_buffer_signals_connect(bsmsg);
 }
-
-
 #endif                          /* HAVE_GTKSPELL */
 
 static void
-lang_set_cb(GtkWidget    *w,
-            BalsaSendmsg *bsmsg)
+lang_set_cb(GtkWidget * w, BalsaSendmsg * bsmsg)
 {
     if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))) {
         const gchar *lang;
@@ -6738,16 +6173,14 @@ lang_set_cb(GtkWidget    *w,
     }
 }
 
-
 /* sendmsg_window_new_from_list:
  * like sendmsg_window_new, but takes a GList of messages, instead of a
  * single message;
  * called by compose_from_list (balsa-index.c)
  */
 BalsaSendmsg *
-sendmsg_window_new_from_list(LibBalsaMailbox *mailbox,
-                             GArray          *selected,
-                             SendType         type)
+sendmsg_window_new_from_list(LibBalsaMailbox * mailbox,
+                             GArray * selected, SendType type)
 {
     BalsaSendmsg *bsmsg;
     LibBalsaMessage *message;
@@ -6759,17 +6192,15 @@ sendmsg_window_new_from_list(LibBalsaMailbox *mailbox,
 
     msgno = g_array_index(selected, guint, 0);
     message = libbalsa_mailbox_get_message(mailbox, msgno);
-    if (!message) {
+    if (!message)
         return NULL;
-    }
 
-    switch (type) {
+    switch(type) {
     case SEND_FORWARD_ATTACH:
     case SEND_FORWARD_INLINE:
         bsmsg = sendmsg_window_forward(mailbox, msgno,
                                        type == SEND_FORWARD_ATTACH);
         break;
-
     default:
         g_assert_not_reached(); /* since it hardly makes sense... */
         bsmsg = NULL; /** silence invalid warnings */
@@ -6780,15 +6211,14 @@ sendmsg_window_new_from_list(LibBalsaMailbox *mailbox,
     buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
 
     for (i = 1; i < selected->len; i++) {
-        msgno = g_array_index(selected, guint, i);
+       msgno = g_array_index(selected, guint, i);
         message = libbalsa_mailbox_get_message(mailbox, msgno);
-        if (!message) {
+        if (!message)
             continue;
-        }
 
-        if (type == SEND_FORWARD_ATTACH) {
+        if (type == SEND_FORWARD_ATTACH)
             attach_message(bsmsg, message);
-        } else if (type == SEND_FORWARD_INLINE) {
+        else if (type == SEND_FORWARD_INLINE) {
             GString *body =
                 quote_message_body(bsmsg, message, QUOTE_NOPREFIX);
             gtk_text_buffer_insert_at_cursor(buffer, body->str, body->len);
@@ -6802,11 +6232,10 @@ sendmsg_window_new_from_list(LibBalsaMailbox *mailbox,
     return bsmsg;
 }
 
-
 /* set_list_post_address:
  * look for the address for posting messages to a list */
 static void
-set_list_post_address(BalsaSendmsg *bsmsg)
+set_list_post_address(BalsaSendmsg * bsmsg)
 {
     LibBalsaMessage *message =
         bsmsg->parent_message ?
@@ -6814,27 +6243,23 @@ set_list_post_address(BalsaSendmsg *bsmsg)
     const gchar *header;
 
     if ((header = libbalsa_message_get_user_header(message, "list-post"))
-        && set_list_post_rfc2369(bsmsg, header)) {
-        return;
-    }
+       && set_list_post_rfc2369(bsmsg, header))
+       return;
 
     /* we didn't find "list-post", so try some nonstandard
      * alternatives: */
 
     if ((header = libbalsa_message_get_user_header(message, "x-beenthere"))
         || (header =
-                libbalsa_message_get_user_header(message, "x-mailing-list"))) {
+            libbalsa_message_get_user_header(message, "x-mailing-list")))
         libbalsa_address_view_set_from_string(bsmsg->recipient_view, "To:",
                                               header);
-    }
 }
 
-
 /* set_list_post_rfc2369:
  * look for "List-Post:" header, and get the address */
 static gboolean
-set_list_post_rfc2369(BalsaSendmsg *bsmsg,
-                      const gchar  *url)
+set_list_post_rfc2369(BalsaSendmsg * bsmsg, const gchar * url)
 {
     /* RFC 2369: To allow for future extension, client
      * applications MUST follow the following guidelines for
@@ -6857,28 +6282,25 @@ set_list_post_rfc2369(BalsaSendmsg *bsmsg,
      * left most protocol that it supports, or knows how to
      * access by a separate application. */
     while (*(url = rfc2822_skip_comments(url)) == '<') {
-        const gchar *close = strchr(++url, '>');
-        if (!close) {
-            /* broken syntax--break and return FALSE */
-            break;
-        }
-        if (g_ascii_strncasecmp(url, "mailto:";, 7) == 0) {
-            /* we support mailto! */
+       const gchar *close = strchr(++url, '>');
+       if (!close)
+           /* broken syntax--break and return FALSE */
+           break;
+       if (g_ascii_strncasecmp(url, "mailto:";, 7) == 0) {
+           /* we support mailto! */
             gchar *field = g_strndup(&url[7], close - &url[7]);
-            sendmsg_window_process_url(field, sendmsg_window_set_field,
+           sendmsg_window_process_url(field, sendmsg_window_set_field,
                                        bsmsg);
             g_free(field);
-            return TRUE;
-        }
-        if (!(*++close && (*(close = rfc2822_skip_comments(close)) == ','))) {
-            break;
-        }
-        url = ++close;
+           return TRUE;
+       }
+       if (!(*++close && *(close = rfc2822_skip_comments(close)) == ','))
+           break;
+       url = ++close;
     }
     return FALSE;
 }
 
-
 /* rfc2822_skip_comments:
  * skip CFWS (comments and folding white space)
  *
@@ -6888,33 +6310,30 @@ set_list_post_rfc2369(BalsaSendmsg *bsmsg,
  * returns a pointer to the first character following the CFWS,
  * which may point to a '\0' character but is never a NULL pointer */
 static const gchar *
-rfc2822_skip_comments(const gchar *str)
+rfc2822_skip_comments(const gchar * str)
 {
     gint level = 0;
 
     while (*str) {
-        if (*str == '(') {
+        if (*str == '(')
             /* start of a comment--they nest */
             ++level;
-        } else if (level > 0) {
-            if (*str == ')') {
+        else if (level > 0) {
+            if (*str == ')')
                 /* end of a comment */
                 --level;
-            } else if ((*str == '\\') && (*++str == '\0')) {
+            else if (*str == '\\' && *++str == '\0')
                 /* quoted-pair: we must test for the end of the string,
                  * which would be an error; in this case, return a
                  * pointer to the '\0' character following the '\\' */
                 break;
-            }
-        } else if (!((*str == ' ') || (*str == '\t'))) {
+        } else if (!(*str == ' ' || *str == '\t'))
             break;
-        }
         ++str;
     }
     return str;
 }
 
-
 /* Set the title for the compose window;
  *
  * handler for the "changed" signals of the "To:" address and the
@@ -6923,7 +6342,7 @@ rfc2822_skip_comments(const gchar *str)
  * also called directly from sendmsg_window_new.
  */
 static void
-sendmsg_window_set_title(BalsaSendmsg *bsmsg)
+sendmsg_window_set_title(BalsaSendmsg * bsmsg)
 {
     gchar *title_format;
     InternetAddressList *list;
@@ -6958,48 +6377,41 @@ sendmsg_window_set_title(BalsaSendmsg *bsmsg)
     g_free(title);
 }
 
-
 #ifdef HAVE_GPGME
 static void
-bsmsg_update_gpg_ui_on_ident_change(BalsaSendmsg     *bsmsg,
-                                    LibBalsaIdentity *ident)
+bsmsg_update_gpg_ui_on_ident_change(BalsaSendmsg * bsmsg,
+                                    LibBalsaIdentity * ident)
 {
     GAction *action;
 
     /* do nothing if we don't support crypto */
-    if (!balsa_app.has_openpgp && !balsa_app.has_smime) {
+    if (!balsa_app.has_openpgp && !balsa_app.has_smime)
         return;
-    }
 
     action = sw_get_action(bsmsg, "gpg-mode");
 
     /* preset according to identity */
     bsmsg->gpg_mode = 0;
-    if (ident->always_trust) {
+    if (ident->always_trust)
         bsmsg->gpg_mode |= LIBBALSA_PROTECT_ALWAYS_TRUST;
-    }
 
     sw_action_set_active(bsmsg, "sign", ident->gpg_sign);
-    if (ident->gpg_sign) {
+    if (ident->gpg_sign)
         bsmsg->gpg_mode |= LIBBALSA_PROTECT_SIGN;
-    }
 
     sw_action_set_active(bsmsg, "encrypt", ident->gpg_encrypt);
-    if (ident->gpg_encrypt) {
+    if (ident->gpg_encrypt)
         bsmsg->gpg_mode |= LIBBALSA_PROTECT_ENCRYPT;
-    }
 
     switch (ident->crypt_protocol) {
     case LIBBALSA_PROTECT_OPENPGP:
         bsmsg->gpg_mode |= LIBBALSA_PROTECT_OPENPGP;
         g_action_change_state(action, g_variant_new_string("open-pgp"));
         break;
-
     case LIBBALSA_PROTECT_SMIMEV3:
         bsmsg->gpg_mode |= LIBBALSA_PROTECT_SMIMEV3;
         g_action_change_state(action, g_variant_new_string("smime"));
         break;
-
     case LIBBALSA_PROTECT_RFC3156:
     default:
         bsmsg->gpg_mode |= LIBBALSA_PROTECT_RFC3156;
@@ -7007,7 +6419,6 @@ bsmsg_update_gpg_ui_on_ident_change(BalsaSendmsg     *bsmsg,
     }
 }
 
-
 static void
 bsmsg_setup_gpg_ui(BalsaSendmsg *bsmsg)
 {
@@ -7017,123 +6428,113 @@ bsmsg_setup_gpg_ui(BalsaSendmsg *bsmsg)
     sw_action_set_enabled(bsmsg, "attpubkey", balsa_app.has_openpgp);
 }
 
-
 static void
-bsmsg_setup_gpg_ui_by_mode(BalsaSendmsg *bsmsg,
-                           gint          mode)
+bsmsg_setup_gpg_ui_by_mode(BalsaSendmsg *bsmsg, gint mode)
 {
     GAction *action;
 
     /* do nothing if we don't support crypto */
-    if (!balsa_app.has_openpgp && !balsa_app.has_smime) {
-        return;
-    }
+    if (!balsa_app.has_openpgp && !balsa_app.has_smime)
+       return;
 
     bsmsg->gpg_mode = mode;
     sw_action_set_active(bsmsg, "sign", mode & LIBBALSA_PROTECT_SIGN);
     sw_action_set_active(bsmsg, "encrypt", mode & LIBBALSA_PROTECT_ENCRYPT);
 
     action = sw_get_action(bsmsg, "gpg-mode");
-    if (mode & LIBBALSA_PROTECT_SMIMEV3) {
+    if (mode & LIBBALSA_PROTECT_SMIMEV3)
         g_action_change_state(action, g_variant_new_string("smime"));
-    } else if (mode & LIBBALSA_PROTECT_OPENPGP) {
+    else if (mode & LIBBALSA_PROTECT_OPENPGP)
         g_action_change_state(action, g_variant_new_string("open-pgp"));
-    } else {
+    else
         g_action_change_state(action, g_variant_new_string("mime"));
-    }
 }
-
-
 #endif /* HAVE_GPGME */
 
 static GActionEntry win_entries[] = {
-    {"include-file", sw_include_file_activated      },
-    {"attach-file", sw_attach_file_activated       },
+    {"include-file",     sw_include_file_activated      },
+    {"attach-file",      sw_attach_file_activated       },
     {"include-messages", sw_include_messages_activated  },
-    {"attach-messages", sw_attach_messages_activated   },
-    {"send", sw_send_activated              },
-    {"queue", sw_queue_activated             },
-    {"postpone", sw_postpone_activated          },
-    {"save", sw_save_activated              },
-    {"page-setup", sw_page_setup_activated        },
-    {"print", sw_print_activated             },
-    {"close", sw_close_activated             },
-    {"undo", sw_undo_activated              },
-    {"redo", sw_redo_activated              },
-    {"cut", sw_cut_activated               },
-    {"copy", sw_copy_activated              },
-    {"paste", sw_paste_activated             },
-    {"select-all", sw_select_text_activated       },
-    {"wrap-body", sw_wrap_body_activated         },
-    {"reflow", sw_reflow_activated            },
-    {"insert-sig", sw_insert_sig_activated        },
-    {"quote", sw_quote_activated             },
+    {"attach-messages",  sw_attach_messages_activated   },
+    {"send",             sw_send_activated              },
+    {"queue",            sw_queue_activated             },
+    {"postpone",         sw_postpone_activated          },
+    {"save",             sw_save_activated              },
+    {"page-setup",       sw_page_setup_activated        },
+    {"print",            sw_print_activated             },
+    {"close",            sw_close_activated             },
+    {"undo",             sw_undo_activated              },
+    {"redo",             sw_redo_activated              },
+    {"cut",              sw_cut_activated               },
+    {"copy",             sw_copy_activated              },
+    {"paste",            sw_paste_activated             },
+    {"select-all",       sw_select_text_activated       },
+    {"wrap-body",        sw_wrap_body_activated         },
+    {"reflow",           sw_reflow_activated            },
+    {"insert-sig",       sw_insert_sig_activated        },
+    {"quote",            sw_quote_activated             },
 #if HAVE_GSPELL || HAVE_GTKSPELL
-    {"spell-check", libbalsa_toggle_activated, NULL, "false",
-     sw_spell_check_change_state    },
+    {"spell-check",      libbalsa_toggle_activated, NULL, "false",
+                         sw_spell_check_change_state    },
 #else                           /* HAVE_GTKSPELL */
-    {"spell-check", sw_spell_check_activated       },
+    {"spell-check",      sw_spell_check_activated       },
 #endif                          /* HAVE_GTKSPELL */
-    {"select-ident", sw_select_ident_activated      },
-    {"edit", sw_edit_activated              },
-    {"show-toolbar", libbalsa_toggle_activated, NULL, "false",
-     sw_show_toolbar_change_state   },
-    {"from", libbalsa_toggle_activated, NULL, "false",
-     sw_from_change_state           },
-    {"recips", libbalsa_toggle_activated, NULL, "false",
-     sw_recips_change_state         },
-    {"reply-to", libbalsa_toggle_activated, NULL, "false",
-     sw_reply_to_change_state       },
-    {"fcc", libbalsa_toggle_activated, NULL, "false",
-     sw_fcc_change_state            },
-    {"request-mdn", libbalsa_toggle_activated, NULL, "false",
-     sw_request_mdn_change_state    },
-    {"request-dsn", libbalsa_toggle_activated, NULL, "false",
-     sw_request_dsn_change_state    },
-    {"flowed", libbalsa_toggle_activated, NULL, "false",
-     sw_flowed_change_state         },
-    {"send-html", libbalsa_toggle_activated, NULL, "false",
-     sw_send_html_change_state      },
+    {"select-ident",     sw_select_ident_activated      },
+    {"edit",             sw_edit_activated              },
+    {"show-toolbar",     libbalsa_toggle_activated, NULL, "false",
+                         sw_show_toolbar_change_state   },
+    {"from",             libbalsa_toggle_activated, NULL, "false",
+                         sw_from_change_state           },
+    {"recips",           libbalsa_toggle_activated, NULL, "false",
+                         sw_recips_change_state         },
+    {"reply-to",         libbalsa_toggle_activated, NULL, "false",
+                         sw_reply_to_change_state       },
+    {"fcc",              libbalsa_toggle_activated, NULL, "false",
+                         sw_fcc_change_state            },
+    {"request-mdn",      libbalsa_toggle_activated, NULL, "false",
+                         sw_request_mdn_change_state    },
+    {"request-dsn",      libbalsa_toggle_activated, NULL, "false",
+                         sw_request_dsn_change_state    },
+    {"flowed",           libbalsa_toggle_activated, NULL, "false",
+                         sw_flowed_change_state         },
+    {"send-html",        libbalsa_toggle_activated, NULL, "false",
+                         sw_send_html_change_state      },
 #ifdef HAVE_GPGME
-    {"sign", libbalsa_toggle_activated, NULL, "false",
-     sw_sign_change_state           },
-    {"encrypt", libbalsa_toggle_activated, NULL, "false",
-     sw_encrypt_change_state        },
-    {"gpg-mode", libbalsa_radio_activated, "s", "'mime'",
-     sw_gpg_mode_change_state       },
-    {"gpg-mode", libbalsa_radio_activated, "s", "'open-pgp'",
-     sw_gpg_mode_change_state       },
-    {"gpg-mode", libbalsa_radio_activated, "s", "'smime'",
-     sw_gpg_mode_change_state       },
-    {"attpubkey", libbalsa_toggle_activated, NULL, "false",
-     sw_att_pubkey_change_state     },
+    {"sign",             libbalsa_toggle_activated, NULL, "false",
+                         sw_sign_change_state           },
+    {"encrypt",          libbalsa_toggle_activated, NULL, "false",
+                         sw_encrypt_change_state        },
+    {"gpg-mode",         libbalsa_radio_activated, "s", "'mime'",
+                         sw_gpg_mode_change_state       },
+    {"gpg-mode",         libbalsa_radio_activated, "s", "'open-pgp'",
+                         sw_gpg_mode_change_state       },
+    {"gpg-mode",         libbalsa_radio_activated, "s", "'smime'",
+                         sw_gpg_mode_change_state       },
+       {"attpubkey",        libbalsa_toggle_activated, NULL, "false",
+                                                sw_att_pubkey_change_state     },
 #endif /* HAVE_GPGME */
     /* Only a toolbar button: */
-    {"toolbar-send", sw_toolbar_send_activated      }
+    {"toolbar-send",     sw_toolbar_send_activated      }
 };
 
 void
-sendmsg_window_add_action_entries(GActionMap *action_map)
+sendmsg_window_add_action_entries(GActionMap * action_map)
 {
     g_action_map_add_action_entries(action_map, win_entries,
                                     G_N_ELEMENTS(win_entries), action_map);
 }
 
-
 static void
-sw_menubar_foreach(GtkWidget *widget,
-                   gpointer   data)
+sw_menubar_foreach(GtkWidget *widget, gpointer data)
 {
     GtkWidget **lang_menu = data;
     GtkMenuItem *item = GTK_MENU_ITEM(widget);
 
-    if (strcmp(gtk_menu_item_get_label(item), _("_Language")) == 0) {
+    if (strcmp(gtk_menu_item_get_label(item), _("_Language")) == 0)
         *lang_menu = widget;
-    }
 }
 
-
-static BalsaSendmsg *
+static BalsaSendmsg*
 sendmsg_window_new()
 {
     BalsaToolbarModel *model;
@@ -7153,7 +6554,7 @@ sendmsg_window_new()
     bsmsg->in_reply_to = NULL;
     bsmsg->references = NULL;
     bsmsg->spell_check_lang = NULL;
-    bsmsg->fcc_url = NULL;
+    bsmsg->fcc_url  = NULL;
     bsmsg->insert_mark = NULL;
     bsmsg->ident = balsa_app.current_ident;
     bsmsg->update_config = FALSE;
@@ -7161,7 +6562,7 @@ sendmsg_window_new()
     bsmsg->state = SENDMSG_STATE_CLEAN;
 
     bsmsg->window = window =
-            gtk_application_window_new(balsa_app.application);
+        gtk_application_window_new(balsa_app.application);
 
     /*
      * restore the SendMsg window size
@@ -7169,9 +6570,8 @@ sendmsg_window_new()
     gtk_window_set_default_size(GTK_WINDOW(window),
                                 balsa_app.sw_width,
                                 balsa_app.sw_height);
-    if (balsa_app.sw_maximized) {
+    if (balsa_app.sw_maximized)
         gtk_window_maximize(GTK_WINDOW(window));
-    }
 
     gtk_window_set_role(GTK_WINDOW(window), "compose");
 
@@ -7188,16 +6588,16 @@ sendmsg_window_new()
     bsmsg->attach_pubkey = FALSE;
 #endif
     bsmsg->autosave_timeout_id = /* autosave every 5 minutes */
-        g_timeout_add_seconds(60 * 5, (GSourceFunc)sw_autosave_timeout_cb, bsmsg);
+        g_timeout_add_seconds(60*5, (GSourceFunc)sw_autosave_timeout_cb, bsmsg);
 
     bsmsg->draft_message = NULL;
     bsmsg->parent_message = NULL;
     g_signal_connect(window, "close-request",
-                     G_CALLBACK(close_request_cb), bsmsg);
+                    G_CALLBACK(close_request_cb), bsmsg);
     g_signal_connect(G_OBJECT(window), "destroy",
-                     G_CALLBACK(destroy_event_cb), bsmsg);
+                    G_CALLBACK(destroy_event_cb), bsmsg);
     g_signal_connect(G_OBJECT(window), "size_allocate",
-                     G_CALLBACK(sw_size_alloc_cb), NULL);
+                    G_CALLBACK(sw_size_alloc_cb), NULL);
     /* If any compose windows are open when Balsa is closed, we want
      * them also to be closed. */
     g_object_weak_ref(G_OBJECT(balsa_app.main_window),
@@ -7242,7 +6642,7 @@ sendmsg_window_new()
     bsmsg->send_mp_alt = FALSE;
 
     sw_action_set_enabled(bsmsg, "select-ident",
-                          balsa_app.identities->next != NULL);
+                     balsa_app.identities->next != NULL);
     bsmsg->identities_changed_id =
         g_signal_connect_swapped(balsa_app.main_window, "identities-changed",
                                  (GCallback)bsmsg_identities_changed_cb,
@@ -7285,7 +6685,7 @@ sendmsg_window_new()
 
 #if HAVE_GTKSOURCEVIEW
     source_buffer = GTK_SOURCE_BUFFER(gtk_text_view_get_buffer
-                                          (GTK_TEXT_VIEW(bsmsg->text)));
+                                      (GTK_TEXT_VIEW(bsmsg->text)));
     gtk_source_buffer_begin_not_undoable_action(source_buffer);
     gtk_source_buffer_end_not_undoable_action(source_buffer);
     sw_action_set_enabled(bsmsg, "undo", FALSE);
@@ -7297,8 +6697,8 @@ sendmsg_window_new()
     bsmsg->update_config = TRUE;
 
     bsmsg->delete_sig_id =
-        g_signal_connect(G_OBJECT(balsa_app.main_window), "close-request",
-                         G_CALLBACK(close_request_cb), bsmsg);
+       g_signal_connect(G_OBJECT(balsa_app.main_window), "close-request",
+                        G_CALLBACK(close_request_cb), bsmsg);
 
     setup_headers_from_identity(bsmsg, bsmsg->ident);
 
@@ -7313,8 +6713,7 @@ sendmsg_window_new()
     return bsmsg;
 }
 
-
-BalsaSendmsg *
+BalsaSendmsg*
 sendmsg_window_compose(void)
 {
     BalsaSendmsg *bsmsg = sendmsg_window_new();
@@ -7322,16 +6721,14 @@ sendmsg_window_compose(void)
     /* set the initial window title */
     bsmsg->type = SEND_NORMAL;
     sendmsg_window_set_title(bsmsg);
-    if (bsmsg->ident->sig_sending) {
+    if(bsmsg->ident->sig_sending)
         insert_initial_sig(bsmsg);
-    }
     bsmsg->state = SENDMSG_STATE_CLEAN;
     return bsmsg;
 }
 
-
-BalsaSendmsg *
-sendmsg_window_compose_with_address(const gchar *address)
+BalsaSendmsg*
+sendmsg_window_compose_with_address(const gchar * address)
 {
     BalsaSendmsg *bsmsg = sendmsg_window_compose();
     libbalsa_address_view_add_from_string(bsmsg->recipient_view,
@@ -7339,26 +6736,21 @@ sendmsg_window_compose_with_address(const gchar *address)
     return bsmsg;
 }
 
-
 BalsaSendmsg *
-sendmsg_window_reply(LibBalsaMailbox *mailbox,
-                     guint            msgno,
-                     SendType         reply_type)
+sendmsg_window_reply(LibBalsaMailbox * mailbox, guint msgno,
+                     SendType reply_type)
 {
     LibBalsaMessage *message =
         libbalsa_mailbox_get_message(mailbox, msgno);
     BalsaSendmsg *bsmsg = sendmsg_window_new();
 
     g_assert(message);
-    switch (reply_type) {
+    switch(reply_type) {
     case SEND_REPLY:
     case SEND_REPLY_ALL:
     case SEND_REPLY_GROUP:
-        bsmsg->type = reply_type;
-        break;
-
-    default: printf("reply_type: %d\n", reply_type);
-        g_assert_not_reached();
+        bsmsg->type = reply_type;       break;
+    default: printf("reply_type: %d\n", reply_type); g_assert_not_reached();
     }
     bsmsg->parent_message = message;
     set_identity(bsmsg, message);
@@ -7367,32 +6759,27 @@ sendmsg_window_reply(LibBalsaMailbox *mailbox,
 
     set_to(bsmsg, message->headers);
 
-    if (message->message_id) {
+    if (message->message_id)
         set_in_reply_to(bsmsg, message->message_id, message->headers);
-    }
-    if (reply_type == SEND_REPLY_ALL) {
+    if (reply_type == SEND_REPLY_ALL)
         set_cc_from_all_recipients(bsmsg, message->headers);
-    }
     set_references_reply(bsmsg, message->references,
                          message->in_reply_to
                          ? message->in_reply_to->data : NULL,
                          message->message_id);
-    if (balsa_app.autoquote) {
+    if(balsa_app.autoquote)
         fill_body_from_message(bsmsg, message, QUOTE_ALL);
-    }
-    if (bsmsg->ident->sig_whenreply) {
+    if(bsmsg->ident->sig_whenreply)
         insert_initial_sig(bsmsg);
-    }
     bsm_finish_setup(bsmsg, message->body_list);
     g_idle_add((GSourceFunc) sw_grab_focus_to_text,
                g_object_ref(bsmsg->text));
     return bsmsg;
 }
 
-
-BalsaSendmsg *
+BalsaSendmsg*
 sendmsg_window_reply_embedded(LibBalsaMessageBody *part,
-                              SendType             reply_type)
+                              SendType reply_type)
 {
     BalsaSendmsg *bsmsg = sendmsg_window_new();
     LibBalsaMessageHeaders *headers;
@@ -7400,31 +6787,27 @@ sendmsg_window_reply_embedded(LibBalsaMessageBody *part,
     g_assert(part);
     g_return_val_if_fail(part->embhdrs, bsmsg);
 
-    switch (reply_type) {
+    switch(reply_type) {
     case SEND_REPLY:
     case SEND_REPLY_ALL:
     case SEND_REPLY_GROUP:
-        bsmsg->type = reply_type;
-        break;
-
-    default: printf("reply_type: %d\n", reply_type);
-        g_assert_not_reached();
+        bsmsg->type = reply_type;       break;
+    default: printf("reply_type: %d\n", reply_type); g_assert_not_reached();
     }
     bsm_prepare_for_setup(g_object_ref(part->message));
     headers = part->embhdrs;
     /* To: */
     set_to(bsmsg, headers);
 
-    if (part->embhdrs) {
+    if(part->embhdrs) {
         const gchar *message_id =
             libbalsa_message_header_get_one(part->embhdrs, "Message-Id");
         const gchar *in_reply_to =
             libbalsa_message_header_get_one(part->embhdrs, "In-Reply-To");
         GList *references =
             libbalsa_message_header_get_all(part->embhdrs, "References");
-        if (message_id) {
+        if (message_id)
             set_in_reply_to(bsmsg, message_id, headers);
-        }
         set_references_reply(bsmsg, references,
                              in_reply_to, message_id);
         fill_body_from_part(bsmsg, part->embhdrs, message_id, references,
@@ -7432,24 +6815,20 @@ sendmsg_window_reply_embedded(LibBalsaMessageBody *part,
         g_list_free_full(references, g_free);
     }
 
-    if (reply_type == SEND_REPLY_ALL) {
+    if (reply_type == SEND_REPLY_ALL)
         set_cc_from_all_recipients(bsmsg, part->embhdrs);
-    }
 
     bsm_finish_setup(bsmsg, part);
-    if (bsmsg->ident->sig_whenreply) {
+    if(bsmsg->ident->sig_whenreply)
         insert_initial_sig(bsmsg);
-    }
     g_idle_add((GSourceFunc) sw_grab_focus_to_text,
                g_object_ref(bsmsg->text));
     return bsmsg;
 }
 
-
-BalsaSendmsg *
-sendmsg_window_forward(LibBalsaMailbox *mailbox,
-                       guint            msgno,
-                       gboolean         attach)
+BalsaSendmsg*
+sendmsg_window_forward(LibBalsaMailbox *mailbox, guint msgno,
+                       gboolean attach)
 {
     LibBalsaMessage *message =
         libbalsa_mailbox_get_message(mailbox, msgno);
@@ -7458,12 +6837,11 @@ sendmsg_window_forward(LibBalsaMailbox *mailbox,
 
     bsmsg->type = attach ? SEND_FORWARD_ATTACH : SEND_FORWARD_INLINE;
     if (attach) {
-        if (!attach_message(bsmsg, message)) {
+       if(!attach_message(bsmsg, message))
             balsa_information_parented(GTK_WINDOW(bsmsg->window),
                                        LIBBALSA_INFORMATION_WARNING,
                                        _("Attaching message failed.\n"
                                          "Possible reason: not enough temporary space"));
-        }
         bsmsg->state = SENDMSG_STATE_CLEAN;
         bsmsg_set_subject_from_body(bsmsg, message->body_list, bsmsg->ident);
     } else {
@@ -7471,10 +6849,9 @@ sendmsg_window_forward(LibBalsaMailbox *mailbox,
         fill_body_from_message(bsmsg, message, QUOTE_NOPREFIX);
         bsm_finish_setup(bsmsg, message->body_list);
     }
-    if (bsmsg->ident->sig_whenforward) {
+    if(bsmsg->ident->sig_whenforward)
         insert_initial_sig(bsmsg);
-    }
-    if (!attach) {
+    if(!attach) {
         GtkTextBuffer *buffer =
             gtk_text_view_get_buffer(GTK_TEXT_VIEW(bsmsg->text));
         GtkTextIter pos;
@@ -7483,14 +6860,12 @@ sendmsg_window_forward(LibBalsaMailbox *mailbox,
         gtk_text_buffer_insert_at_cursor(buffer, "\n", 1);
         gtk_text_buffer_get_start_iter(buffer, &pos);
         gtk_text_buffer_place_cursor(buffer, &pos);
-    }
+     }
     return bsmsg;
 }
 
-
-BalsaSendmsg *
-sendmsg_window_continue(LibBalsaMailbox *mailbox,
-                        guint            msgno)
+BalsaSendmsg*
+sendmsg_window_continue(LibBalsaMailbox * mailbox, guint msgno)
 {
     LibBalsaMessage *message =
         libbalsa_mailbox_get_message(mailbox, msgno);
@@ -7518,34 +6893,30 @@ sendmsg_window_continue(LibBalsaMailbox *mailbox,
     libbalsa_address_view_set_from_list(bsmsg->replyto_view,
                                         "Reply To:",
                                         message->headers->reply_to);
-    if (message->in_reply_to) {
+    if (message->in_reply_to)
         bsmsg->in_reply_to =
             g_strconcat("<", message->in_reply_to->data, ">", NULL);
-    }
 
 #ifdef HAVE_GPGME
     if ((postpone_hdr =
-             libbalsa_message_get_user_header(message, "X-Balsa-Crypto"))) {
+         libbalsa_message_get_user_header(message, "X-Balsa-Crypto")))
         bsmsg_setup_gpg_ui_by_mode(bsmsg, atoi(postpone_hdr));
-    }
     postpone_hdr = libbalsa_message_get_user_header(message, "X-Balsa-Att-Pubkey");
     if (postpone_hdr != NULL) {
-        sw_action_set_active(bsmsg, "attpubkey", atoi(postpone_hdr) != 0);
+       sw_action_set_active(bsmsg, "attpubkey", atoi(postpone_hdr) != 0);
     }
 #endif
     if ((postpone_hdr =
-             libbalsa_message_get_user_header(message, "X-Balsa-MDN"))) {
+         libbalsa_message_get_user_header(message, "X-Balsa-MDN")))
         sw_action_set_active(bsmsg, "request-mdn", atoi(postpone_hdr) != 0);
-    }
     if ((postpone_hdr =
-             libbalsa_message_get_user_header(message, "X-Balsa-DSN"))) {
+         libbalsa_message_get_user_header(message, "X-Balsa-DSN")))
         sw_action_set_active(bsmsg, "request-dsn", atoi(postpone_hdr) != 0);
-    }
     if ((postpone_hdr =
-             libbalsa_message_get_user_header(message, "X-Balsa-Lang"))) {
+         libbalsa_message_get_user_header(message, "X-Balsa-Lang"))) {
         GtkWidget *langs =
             gtk_menu_item_get_submenu(GTK_MENU_ITEM
-                                          (bsmsg->current_language_menu));
+                                      (bsmsg->current_language_menu));
         GList *children =
             gtk_container_get_children(GTK_CONTAINER(langs));
         set_locale(bsmsg, postpone_hdr);
@@ -7555,28 +6926,23 @@ sendmsg_window_continue(LibBalsaMailbox *mailbox,
 
             lang = g_object_get_data(G_OBJECT(menu_item),
                                      BALSA_LANGUAGE_MENU_LANG);
-            if (strcmp(lang, postpone_hdr) == 0) {
+            if (strcmp(lang, postpone_hdr) == 0)
                 gtk_check_menu_item_set_active(menu_item, TRUE);
-            }
         }
         g_list_free(children);
     }
     if ((postpone_hdr =
-             libbalsa_message_get_user_header(message, "X-Balsa-Format"))) {
+         libbalsa_message_get_user_header(message, "X-Balsa-Format")))
         sw_action_set_active(bsmsg, "flowed", strcmp(postpone_hdr, "Fixed"));
-    }
     if ((postpone_hdr =
-             libbalsa_message_get_user_header(message, "X-Balsa-MP-Alt"))) {
+         libbalsa_message_get_user_header(message, "X-Balsa-MP-Alt")))
         sw_action_set_active(bsmsg, "send-html", !strcmp(postpone_hdr, "yes"));
-    }
     if ((postpone_hdr =
-             libbalsa_message_get_user_header(message, "X-Balsa-Send-Type"))) {
+         libbalsa_message_get_user_header(message, "X-Balsa-Send-Type")))
         bsmsg->type = atoi(postpone_hdr);
-    }
 
-    for (list = message->references; list; list = list->next) {
+    for (list = message->references; list; list = list->next)
         refs = g_list_prepend(refs, g_strdup(list->data));
-    }
     bsmsg->references = g_list_reverse(refs);
 
     continue_body(bsmsg, message);
diff --git a/src/sendmsg-window.h b/src/sendmsg-window.h
index 9bea5d4..e77aa4a 100644
--- a/src/sendmsg-window.h
+++ b/src/sendmsg-window.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -21,7 +21,7 @@
 #define __BALSA_SENDMSG_H__
 
 #ifndef BALSA_VERSION
-#   error "Include config.h before this file."
+# error "Include config.h before this file."
 #endif
 
 #include "libbalsa.h"
@@ -30,124 +30,118 @@
 
 G_BEGIN_DECLS
 
-typedef enum {
-    SEND_NORMAL,               /* initialized by Compose */
-    SEND_REPLY,                /* by Reply               */
-    SEND_REPLY_ALL,            /* by Reply All           */
-    SEND_REPLY_GROUP,          /* by Reply to Group      */
-    SEND_FORWARD_ATTACH,       /* by Forward attached    */
-    SEND_FORWARD_INLINE,       /* by Forward inline      */
-    SEND_CONTINUE              /* by Continue postponed  */
-} SendType;
-
-typedef enum {
-    SENDMSG_STATE_CLEAN,
-    SENDMSG_STATE_MODIFIED,
-    SENDMSG_STATE_AUTO_SAVED
-} SendmsgState;
+    typedef enum {
+       SEND_NORMAL,            /* initialized by Compose */
+       SEND_REPLY,             /* by Reply               */
+       SEND_REPLY_ALL,         /* by Reply All           */
+       SEND_REPLY_GROUP,       /* by Reply to Group      */
+       SEND_FORWARD_ATTACH,    /* by Forward attached    */
+       SEND_FORWARD_INLINE,    /* by Forward inline      */
+       SEND_CONTINUE           /* by Continue postponed  */
+    } SendType;
+
+    typedef enum {
+        SENDMSG_STATE_CLEAN,
+        SENDMSG_STATE_MODIFIED,
+        SENDMSG_STATE_AUTO_SAVED
+    } SendmsgState;
 
 #define VIEW_MENU_LENGTH 5
 
-typedef struct _BalsaSendmsg BalsaSendmsg;
-
-struct _BalsaSendmsg {
-    GtkWidget *window;
-    GtkWidget *toolbar;
-    LibBalsaAddressView *recipient_view, *replyto_view;
-    GtkWidget *from[2], *recipients[2], *subject[2], *fcc[2];
-    GtkWidget *replyto[2];
-    GtkWidget *tree_view;
-    gchar *in_reply_to;
-    GList *references;
-    GtkWidget *text;
+    typedef struct _BalsaSendmsg BalsaSendmsg;
+
+    struct _BalsaSendmsg {
+       GtkWidget *window;
+       GtkWidget *toolbar;
+        LibBalsaAddressView *recipient_view, *replyto_view;
+       GtkWidget *from[2], *recipients[2], *subject[2], *fcc[2];
+       GtkWidget *replyto[2];
+       GtkWidget *tree_view;
+        gchar *in_reply_to;
+        GList *references;
+       GtkWidget *text;
 #if !HAVE_GTKSPELL
-    GtkWidget *spell_checker;
+       GtkWidget *spell_checker;
 #endif                          /* HAVE_GTKSPELL */
-    GtkWidget *notebook;
-    LibBalsaMessage *parent_message;     /* to which we're replying     */
-    LibBalsaMessage *draft_message;      /* where the message was saved */
-    SendType type;
-    gboolean is_continue;
-    /* language selection related data */
-    gchar *spell_check_lang;
-    GtkWidget *current_language_menu;
-    /* identity related data */
-    LibBalsaIdentity *ident;
-    /* fcc mailbox */
-    gchar *fcc_url;
-    gboolean update_config;     /* is the window being set up or in normal  */
-                                /* operation and user actions should update */
-                                /* the config */
-    gulong delete_sig_id;
-    gulong changed_sig_id;
+       GtkWidget *notebook;
+       LibBalsaMessage *parent_message; /* to which we're replying     */
+       LibBalsaMessage *draft_message;  /* where the message was saved */
+       SendType type;
+        gboolean is_continue;
+       /* language selection related data */
+       gchar *spell_check_lang;
+       GtkWidget *current_language_menu;
+       /* identity related data */
+       LibBalsaIdentity* ident;
+        /* fcc mailbox */
+        gchar *fcc_url;
+       gboolean update_config; /* is the window being set up or in normal  */
+                               /* operation and user actions should update */
+                               /* the config */
+       gulong delete_sig_id;
+        gulong changed_sig_id;
 #if !HAVE_GTKSOURCEVIEW
-    gulong delete_range_sig_id;
+        gulong delete_range_sig_id;
 #endif                          /* HAVE_GTKSOURCEVIEW */
-    gulong insert_text_sig_id;
-    guint autosave_timeout_id;
-    SendmsgState state;
-    gulong identities_changed_id;
-    gboolean flow;              /* send format=flowed */
-    gboolean send_mp_alt;       /* send multipart/alternative (plain and html) */
-    gboolean req_mdn;            /* send a MDN */
-    gboolean req_dsn;            /* send a delivery status notification */
-    gboolean quit_on_close;     /* quit balsa after the compose window */
-                                /* is closed.                          */
+        gulong insert_text_sig_id;
+        guint autosave_timeout_id;
+        SendmsgState state;
+        gulong identities_changed_id;
+       gboolean flow;          /* send format=flowed */ 
+       gboolean send_mp_alt;   /* send multipart/alternative (plain and html) */ 
+       gboolean req_mdn;        /* send a MDN */
+       gboolean req_dsn;        /* send a delivery status notification */
+       gboolean quit_on_close; /* quit balsa after the compose window */
+                               /* is closed.                          */
 #ifdef HAVE_GPGME
-    guint gpg_mode;
-    gboolean attach_pubkey;
+       guint gpg_mode;
+       gboolean attach_pubkey;
 #endif
 
 #if !HAVE_GTKSOURCEVIEW
-    GtkTextBuffer *buffer2;           /* Undo buffer. */
+        GtkTextBuffer *buffer2;       /* Undo buffer. */
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
-    /* To update cursor after text is inserted. */
-    GtkTextMark *insert_mark;
-
-    GtkWidget *paned;
-    gboolean ready_to_send;
-};
-
-BalsaSendmsg *sendmsg_window_compose(void);
-BalsaSendmsg *sendmsg_window_compose_with_address(const gchar *
-                                                  address);
-BalsaSendmsg *sendmsg_window_reply(LibBalsaMailbox *,
-                                   guint    msgno,
-                                   SendType rt);
-BalsaSendmsg *sendmsg_window_reply_embedded(LibBalsaMessageBody *part,
-                                            SendType             reply_type);
-
-BalsaSendmsg *sendmsg_window_forward(LibBalsaMailbox *,
-                                     guint    msgno,
-                                     gboolean attach);
-BalsaSendmsg *sendmsg_window_continue(LibBalsaMailbox *,
-                                      guint msgno);
-
-void sendmsg_window_set_field(BalsaSendmsg *bsmsg,
-                              const gchar  *key,
-                              const gchar  *val);
-
-gboolean add_attachment(BalsaSendmsg *bsmsg,
-                        const gchar  *filename,
-                        gboolean      is_a_tmp_file,
-                        const gchar  *forced_mime_type);
-
-typedef void (*field_setter)(BalsaSendmsg *d,
-                             const gchar *,
-                             const gchar *);
-
-void sendmsg_window_process_url(const char  *url,
-                                field_setter func,
-                                void        *data);
-BalsaSendmsg *sendmsg_window_new_from_list(LibBalsaMailbox *mailbox,
-                                           GArray          *selected,
-                                           SendType         type);
-BalsaToolbarModel *sendmsg_window_get_toolbar_model(void);
-void sendmsg_window_add_action_entries(GActionMap *action_map);
-
-#define SENDMSG_WINDOW_QUIT_ON_CLOSE(bsmsg) ((bsmsg)->quit_on_close = TRUE)
+        /* To update cursor after text is inserted. */
+        GtkTextMark *insert_mark;
+
+        GtkWidget *paned;
+        gboolean ready_to_send;
+    };
+
+    BalsaSendmsg *sendmsg_window_compose(void);
+    BalsaSendmsg *sendmsg_window_compose_with_address(const gchar *
+                                                      address);
+    BalsaSendmsg *sendmsg_window_reply(LibBalsaMailbox *,
+                                       guint msgno, SendType rt);
+    BalsaSendmsg *sendmsg_window_reply_embedded(LibBalsaMessageBody *part,
+                                                SendType reply_type);
+
+    BalsaSendmsg *sendmsg_window_forward(LibBalsaMailbox *,
+                                         guint msgno, gboolean attach);
+    BalsaSendmsg *sendmsg_window_continue(LibBalsaMailbox *,
+                                          guint msgno);
+
+    void sendmsg_window_set_field(BalsaSendmsg *bsmsg, const gchar* key,
+                                  const gchar* val);
+
+    gboolean add_attachment(BalsaSendmsg * bsmsg,
+                            const gchar *filename, 
+                            gboolean is_a_tmp_file, 
+                            const gchar *forced_mime_type);
+
+    typedef void (*field_setter)(BalsaSendmsg *d, const gchar*, const gchar*);
+
+    void sendmsg_window_process_url(const char *url, field_setter func,
+                                   void *data);
+    BalsaSendmsg *sendmsg_window_new_from_list(LibBalsaMailbox * mailbox,
+                                               GArray * selected,
+                                               SendType type);
+    BalsaToolbarModel *sendmsg_window_get_toolbar_model(void);
+    void sendmsg_window_add_action_entries(GActionMap * action_map);
+
+#define SENDMSG_WINDOW_QUIT_ON_CLOSE(bsmsg) ((bsmsg)->quit_on_close=TRUE)
 
 G_END_DECLS
 
-#endif                          /* __BALSA_SENDMSG_H__ */
+#endif                         /* __BALSA_SENDMSG_H__ */
diff --git a/src/spell-check.c b/src/spell-check.c
index 5b30813..7fa7f14 100644
--- a/src/spell-check.c
+++ b/src/spell-check.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "spell-check.h"
 
@@ -30,7 +30,7 @@
 #include "balsa-icons.h"
 
 #if HAVE_GTKSOURCEVIEW
-#   include <gtksourceview/gtksource.h>
+#include <gtksourceview/gtksource.h>
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
 #define BALSA_SPELL_CHECK_PADDING 6
@@ -95,63 +95,50 @@ enum {
 /* initialization stuff */
 static void balsa_spell_check_class_init(BalsaSpellCheckClass *);
 static void balsa_spell_check_init(BalsaSpellCheck *);
-static void spch_set_property(GObject      *object,
-                              guint         prop_id,
-                              const GValue *value,
-                              GParamSpec   *pspec);
-static void spch_get_property(GObject    *object,
-                              guint       prop_id,
-                              GValue     *value,
-                              GParamSpec *pspec);
-static void balsa_spell_check_destroy(GObject *object);
+static void spch_set_property(GObject * object, guint prop_id,
+                              const GValue * value, GParamSpec * pspec);
+static void spch_get_property(GObject * object, guint prop_id,
+                              GValue * value, GParamSpec * pspec);
+static void balsa_spell_check_destroy(GObject * object);
 
 
 /* signal callbacks */
-static void done_cb(GtkButton *,
-                    gpointer);
-static void change_cb(GtkButton *,
-                      gpointer);
-static void change_all_cb(GtkButton *,
-                          gpointer);
-static void ignore_cb(GtkButton *,
-                      gpointer);
-static void ignore_all_cb(GtkButton *,
-                          gpointer);
-static void learn_cb(GtkButton *button,
-                     gpointer);
-static void cancel_cb(GtkButton *button,
-                      gpointer);
-static void select_word_cb(GtkTreeSelection *selection,
-                           gpointer          data);
+static void done_cb(GtkButton *, gpointer);
+static void change_cb(GtkButton *, gpointer);
+static void change_all_cb(GtkButton *, gpointer);
+static void ignore_cb(GtkButton *, gpointer);
+static void ignore_all_cb(GtkButton *, gpointer);
+static void learn_cb(GtkButton * button, gpointer);
+static void cancel_cb(GtkButton * button, gpointer);
+static void select_word_cb(GtkTreeSelection * selection, gpointer data);
 
 
 /* function prototypes */
-static gboolean next_word(BalsaSpellCheck *spell_check);
-static gboolean check_word(BalsaSpellCheck *spell_check);
-static void switch_word(BalsaSpellCheck *spell_check,
-                        const gchar     *new_word);
-static void finish_check(BalsaSpellCheck *spell_check);
-static gboolean check_error(BalsaSpellCheck *spell_check);
-
-static void setup_suggestions(BalsaSpellCheck *spell_check,
-                              gsize            n_suggs);
-static gboolean balsa_spell_check_next(BalsaSpellCheck *spell_check);
-static gboolean highlight_idle(BalsaSpellCheck *spell_check);
-static void balsa_spell_check_fix(BalsaSpellCheck *spell_check,
-                                  gboolean         fix_al);
-static void balsa_spell_check_learn(BalsaSpellCheck *spell_check,
-                                    LearnType        learn);
-static void spch_save_word_iters(BalsaSpellCheck *spell_check);
-static void spch_restore_word_iters(BalsaSpellCheck *spell_check);
-static void spch_finish(BalsaSpellCheck *spell_check,
-                        gboolean         keep_changes);
+static gboolean next_word(BalsaSpellCheck * spell_check);
+static gboolean check_word(BalsaSpellCheck * spell_check);
+static void switch_word(BalsaSpellCheck * spell_check,
+                        const gchar * new_word);
+static void finish_check(BalsaSpellCheck * spell_check);
+static gboolean check_error(BalsaSpellCheck * spell_check);
+
+static void setup_suggestions(BalsaSpellCheck * spell_check, gsize n_suggs);
+static gboolean balsa_spell_check_next(BalsaSpellCheck * spell_check);
+static gboolean highlight_idle(BalsaSpellCheck * spell_check);
+static void balsa_spell_check_fix(BalsaSpellCheck * spell_check,
+                                 gboolean fix_al);
+static void balsa_spell_check_learn(BalsaSpellCheck * spell_check,
+                                   LearnType learn);
+static void spch_save_word_iters(BalsaSpellCheck * spell_check);
+static void spch_restore_word_iters(BalsaSpellCheck * spell_check);
+static void spch_finish(BalsaSpellCheck * spell_check,
+                        gboolean keep_changes);
 
 /* define the class */
 
 G_DEFINE_TYPE(BalsaSpellCheck, balsa_spell_check, GTK_TYPE_WINDOW);
 
 static void
-balsa_spell_check_class_init(BalsaSpellCheckClass *klass)
+balsa_spell_check_class_init(BalsaSpellCheckClass * klass)
 {
     GObjectClass *object_class;
 
@@ -172,40 +159,36 @@ balsa_spell_check_class_init(BalsaSpellCheckClass *klass)
 
 
 static void
-spch_set_property(GObject      *object,
-                  guint         prop_id,
-                  const GValue *value,
-                  GParamSpec   *pspec)
+spch_set_property(GObject * object, guint prop_id, const GValue * value,
+                  GParamSpec * pspec)
 {
     BalsaSpellCheck *spell_check = BALSA_SPELL_CHECK(object);
 
     switch (prop_id) {
     case PROP_LANGUAGE:
-        balsa_spell_check_set_language(spell_check,
-                                       g_value_get_string(value));
-        break;
+       balsa_spell_check_set_language(spell_check,
+                                      g_value_get_string(value));
+       break;
 
     default:
-        break;
+       break;
     }
 }
 
 
 static void
-spch_get_property(GObject    *object,
-                  guint       prop_id,
-                  GValue     *value,
-                  GParamSpec *pspec)
+spch_get_property(GObject * object, guint prop_id, GValue * value,
+                  GParamSpec * pspec)
 {
     BalsaSpellCheck *spell_check = BALSA_SPELL_CHECK(object);
 
     switch (prop_id) {
     case PROP_LANGUAGE:
         g_value_set_string(value, spell_check->language_tag);
-        break;
+       break;
 
     default:
-        break;
+       break;
     }
 }
 
@@ -215,7 +198,7 @@ spch_get_property(GObject    *object,
  * Create a new spell check widget.
  * */
 GtkWidget *
-balsa_spell_check_new(GtkWindow *parent)
+balsa_spell_check_new(GtkWindow * parent)
 {
     BalsaSpellCheck *spell_check;
 
@@ -237,8 +220,8 @@ balsa_spell_check_new(GtkWindow *parent)
  * Create a new spell check widget, assigning the GtkText to check.
  * */
 GtkWidget *
-balsa_spell_check_new_with_text(GtkWindow   *parent,
-                                GtkTextView *check_text)
+balsa_spell_check_new_with_text(GtkWindow   * parent,
+                                GtkTextView * check_text)
 {
     BalsaSpellCheck *spell_check;
 
@@ -257,8 +240,8 @@ balsa_spell_check_new_with_text(GtkWindow   *parent,
  * Set the text widget the spell check should check.
  * */
 void
-balsa_spell_check_set_text(BalsaSpellCheck *spell_check,
-                           GtkTextView     *check_text)
+balsa_spell_check_set_text(BalsaSpellCheck * spell_check,
+                           GtkTextView     * check_text)
 {
     g_return_if_fail(BALSA_IS_SPELL_CHECK(spell_check));
     g_return_if_fail(GTK_IS_TEXT_VIEW(check_text));
@@ -272,8 +255,8 @@ balsa_spell_check_set_text(BalsaSpellCheck *spell_check,
  * Set the language to do spell checking in.
  * */
 void
-balsa_spell_check_set_language(BalsaSpellCheck *spell_check,
-                               const gchar     *language)
+balsa_spell_check_set_language(BalsaSpellCheck * spell_check,
+                               const gchar     * language)
 {
     g_return_if_fail(BALSA_IS_SPELL_CHECK(spell_check));
 
@@ -283,12 +266,12 @@ balsa_spell_check_set_language(BalsaSpellCheck *spell_check,
 
 
 /* balsa_spell_check_init ()
- *
+ * 
  * Initialization of the class to reasonable default values, set up
- * buttons signal callbacks.
+ * buttons signal callbacks.  
  * */
 static void
-balsa_spell_check_init(BalsaSpellCheck *spell_check)
+balsa_spell_check_init(BalsaSpellCheck * spell_check)
 {
     GtkWidget *widget;
     GtkGrid *grid;
@@ -321,8 +304,8 @@ balsa_spell_check_init(BalsaSpellCheck *spell_check)
 
     sw = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
-                                   GTK_POLICY_AUTOMATIC,
-                                   GTK_POLICY_AUTOMATIC);
+                                  GTK_POLICY_AUTOMATIC,
+                                  GTK_POLICY_AUTOMATIC);
     gtk_widget_set_vexpand(sw, TRUE);
     gtk_box_pack_start(box, sw);
 
@@ -342,7 +325,7 @@ balsa_spell_check_init(BalsaSpellCheck *spell_check)
     selection = gtk_tree_view_get_selection(tree_view);
     gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
     g_signal_connect(selection, "changed",
-                     G_CALLBACK(select_word_cb), spell_check);
+                    G_CALLBACK(select_word_cb), spell_check);
 
     gtk_tree_view_set_headers_visible(tree_view, FALSE);
 
@@ -359,7 +342,7 @@ balsa_spell_check_init(BalsaSpellCheck *spell_check)
                                 _("Replace the current word "
                                   "with the selected suggestion"));
     g_signal_connect(widget, "clicked",
-                     G_CALLBACK(change_cb), spell_check);
+                    G_CALLBACK(change_cb), spell_check);
     gtk_grid_attach(grid, widget, 0, 0, 1, 1);
 
     widget = gtk_button_new_with_mnemonic(_("Change _All"));
@@ -367,54 +350,53 @@ balsa_spell_check_init(BalsaSpellCheck *spell_check)
                                 _("Replace all occurrences of the current word "
                                   "with the selected suggestion"));
     g_signal_connect(widget, "clicked",
-                     G_CALLBACK(change_all_cb), spell_check);
+                    G_CALLBACK(change_all_cb), spell_check);
     gtk_grid_attach(grid, widget, 0, 1, 1, 1);
 
     widget = gtk_button_new_with_mnemonic(_("_Ignore"));
     gtk_widget_set_tooltip_text(widget,
                                 _("Skip the current word"));
     g_signal_connect(widget, "clicked",
-                     G_CALLBACK(ignore_cb), spell_check);
+                    G_CALLBACK(ignore_cb), spell_check);
     gtk_grid_attach(grid, widget, 1, 0, 1, 1);
 
     widget = gtk_button_new_with_mnemonic(_("I_gnore All"));
     gtk_widget_set_tooltip_text(widget,
                                 _("Skip all occurrences of the current word"));
     g_signal_connect(widget, "clicked",
-                     G_CALLBACK(ignore_all_cb), spell_check);
+                    G_CALLBACK(ignore_all_cb), spell_check);
     gtk_grid_attach(grid, widget, 1, 1, 1, 1);
 
     widget = gtk_button_new_with_mnemonic(_("_Learn"));
     gtk_widget_set_tooltip_text(widget,
                                 _("Add the current word to your personal dictionary"));
     g_signal_connect(widget, "clicked",
-                     G_CALLBACK(learn_cb), spell_check);
+                    G_CALLBACK(learn_cb), spell_check);
     gtk_grid_attach(grid, widget, 2, 0, 1, 1);
 
     widget = gtk_button_new_with_mnemonic(_("_Done"));
     gtk_widget_set_tooltip_text(widget, _("Finish spell checking"));
     g_signal_connect(widget, "clicked",
-                     G_CALLBACK(done_cb), spell_check);
+                    G_CALLBACK(done_cb), spell_check);
     gtk_grid_attach(grid, widget, 3, 0, 1, 1);
 
     widget = gtk_button_new_with_mnemonic(_("_Cancel"));
     gtk_widget_set_tooltip_text(widget,
                                 _("Revert all changes and finish spell checking"));
     g_signal_connect(widget, "clicked",
-                     G_CALLBACK(cancel_cb), spell_check);
+                    G_CALLBACK(cancel_cb), spell_check);
     gtk_grid_attach(grid, widget, 3, 1, 1, 1);
 }
 
 
 /* select_word_cb ()
- *
+ * 
  * When the user selects a word from the list of available
  * suggestions, replace the text in the entry text box with the text
  * from the clist selection.
  * */
 static void
-select_word_cb(GtkTreeSelection *selection,
-               gpointer          data)
+select_word_cb(GtkTreeSelection * selection, gpointer data)
 {
     GtkTreeModel *model;
     GtkTreeIter iter;
@@ -431,13 +413,12 @@ select_word_cb(GtkTreeSelection *selection,
 
 
 /* ignore_cb ()
- *
+ * 
  * Selecting the ignore button causes the current word to be skipped
  * for checking.
  * */
 static void
-ignore_cb(GtkButton *button,
-          gpointer   data)
+ignore_cb(GtkButton * button, gpointer data)
 {
     BalsaSpellCheck *spell_check;
 
@@ -451,13 +432,12 @@ ignore_cb(GtkButton *button,
 
 
 /* ignore_all_cb ()
- *
+ * 
  * Add the current word to the session library, causing it to be
  * skipped for the rest of the checking session.
  * */
 static void
-ignore_all_cb(GtkButton *button,
-              gpointer   data)
+ignore_all_cb(GtkButton * button, gpointer data)
 {
     /* add the current word to the session library */
     BalsaSpellCheck *spell_check;
@@ -470,13 +450,12 @@ ignore_all_cb(GtkButton *button,
 
 
 /* change_cb ()
- *
+ * 
  * Change the current word being checked to the selected suggestion or
  * what the user enters in the entry box.
  * */
 static void
-change_cb(GtkButton *button,
-          gpointer   data)
+change_cb(GtkButton * button, gpointer data)
 {
     BalsaSpellCheck *spell_check;
 
@@ -489,13 +468,12 @@ change_cb(GtkButton *button,
 
 
 /* change_all_cb ()
- *
+ * 
  * Replace all occurances of the currently misspelled word in the text
  * to the current suggestion.
  * */
 static void
-change_all_cb(GtkButton *button,
-              gpointer   data)
+change_all_cb(GtkButton * button, gpointer data)
 {
     BalsaSpellCheck *spell_check;
 
@@ -510,12 +488,11 @@ change_all_cb(GtkButton *button,
 
 
 /* learn_cb ()
- *
+ * 
  * Add the current word to the permanent personal dictionary.
  * */
 static void
-learn_cb(GtkButton *button,
-         gpointer   data)
+learn_cb(GtkButton * button, gpointer data)
 {
     BalsaSpellCheck *spell_check;
 
@@ -528,12 +505,11 @@ learn_cb(GtkButton *button,
 
 
 /* cancel_cb ()
- *
+ * 
  * Cancel the check, restoring the original text.
  * */
 static void
-cancel_cb(GtkButton *button,
-          gpointer   data)
+cancel_cb(GtkButton * button, gpointer data)
 {
     BalsaSpellCheck *spell_check;
 
@@ -543,15 +519,13 @@ cancel_cb(GtkButton *button,
     spch_finish(spell_check, FALSE);
 }
 
-
 /* done_cb ()
- *
+ * 
  * Signal callback for the done button, end the spell check, keeping
  * all changes up to this point.
  * */
 static void
-done_cb(GtkButton *button,
-        gpointer   data)
+done_cb(GtkButton * button, gpointer data)
 {
     BalsaSpellCheck *spell_check;
 
@@ -563,7 +537,7 @@ done_cb(GtkButton *button,
 
 
 /* balsa_spell_check_start ()
- *
+ * 
  * Start the spell check, allocating the Enchant broker and
  * dictionary to do the checking.
  * */
@@ -571,7 +545,7 @@ done_cb(GtkButton *button,
 static GRegex *quoted_rex = NULL;
 
 void
-balsa_spell_check_start(BalsaSpellCheck *spell_check)
+balsa_spell_check_start(BalsaSpellCheck * spell_check)
 {
     const gchar *enchant_error;
     GtkTextBuffer *buffer;
@@ -584,18 +558,18 @@ balsa_spell_check_start(BalsaSpellCheck *spell_check)
 
     enchant_error = enchant_broker_get_error(spell_check->broker);
     if (enchant_error) {
-        /* quit without breaking things */
+       /* quit without breaking things */
         GtkWindow *parent;
 
         parent = gtk_window_get_transient_for(GTK_WINDOW(spell_check));
-        balsa_information_parented(parent,
+       balsa_information_parented(parent,
                                    LIBBALSA_INFORMATION_ERROR,
                                    "%s",
                                    enchant_error);
 
-        gtk_widget_destroy((GtkWidget *) spell_check);
+       gtk_widget_destroy((GtkWidget *) spell_check);
 
-        return;
+       return;
     }
 
     spell_check->dict =
@@ -618,7 +592,7 @@ balsa_spell_check_start(BalsaSpellCheck *spell_check)
     /* Get the original text so we can always revert */
 #if HAVE_GTKSOURCEVIEW
     spell_check->original_text =
-        gtk_source_buffer_new(gtk_text_buffer_get_tag_table(buffer));
+       gtk_source_buffer_new(gtk_text_buffer_get_tag_table(buffer));
     gtk_text_buffer_get_start_iter((GtkTextBuffer *)
                                    spell_check->original_text, &iter);
     gtk_text_buffer_get_bounds((GtkTextBuffer *) buffer, &start, &end);
@@ -627,39 +601,35 @@ balsa_spell_check_start(BalsaSpellCheck *spell_check)
                                  &start, &end);
 #else                           /* HAVE_GTKSOURCEVIEW */
     spell_check->original_text =
-        gtk_text_buffer_new(gtk_text_buffer_get_tag_table(buffer));
+       gtk_text_buffer_new(gtk_text_buffer_get_tag_table(buffer));
     gtk_text_buffer_get_start_iter(spell_check->original_text, &iter);
     gtk_text_buffer_get_bounds(buffer, &start, &end);
     gtk_text_buffer_insert_range(spell_check->original_text, &iter,
                                  &start, &end);
 #endif                          /* HAVE_GTKSOURCEVIEW */
 
-    if (balsa_app.debug) {
-        balsa_information(LIBBALSA_INFORMATION_DEBUG,
-                          "BalsaSpellCheck: Start\n");
-    }
+    if (balsa_app.debug)
+       balsa_information(LIBBALSA_INFORMATION_DEBUG,
+                         "BalsaSpellCheck: Start\n");
 
-    /*
+    /* 
      * compile the quoted-text regular expression (note:
      * balsa_app.quote_regex may change, so compile it new every
      * time!)
      */
-    if (quoted_rex != NULL) {
+    if (quoted_rex != NULL)
         g_regex_unref(quoted_rex);
-    }
     quoted_rex = balsa_quote_regex_new();
 
     spell_check->end_iter = start;
 
     /* start the check */
-    if (!balsa_spell_check_next(spell_check)) {
+    if (!balsa_spell_check_next(spell_check))
         gtk_widget_show(GTK_WIDGET(spell_check));
-    }
 }
 
-
 /* balsa_spell_check_next ()
- *
+ * 
  * Continue the spell check, clear the old words and suggestions, and
  * moving onto the next incorrect word.  Replace the incorrect word
  * with a highlighted version, move the text to display it, and setup
@@ -668,7 +638,7 @@ balsa_spell_check_start(BalsaSpellCheck *spell_check)
  * Return TRUE if there are no more errors, FALSE if we found one
  * */
 static gboolean
-balsa_spell_check_next(BalsaSpellCheck *spell_check)
+balsa_spell_check_next(BalsaSpellCheck * spell_check)
 {
     GtkTextBuffer *buffer;
     GtkTreeView *tree_view;
@@ -676,15 +646,15 @@ balsa_spell_check_next(BalsaSpellCheck *spell_check)
     GtkTreeIter iter;
 
     if (!next_word(spell_check)) {
-        spch_finish(spell_check, TRUE);
-        return TRUE;
+       spch_finish(spell_check, TRUE);
+       return TRUE;
     }
 
     while (check_word(spell_check)) {
-        if (!next_word(spell_check)) {
-            spch_finish(spell_check, TRUE);
-            return TRUE;
-        }
+       if (!next_word(spell_check)) {
+           spch_finish(spell_check, TRUE);
+           return TRUE;
+       }
     }
 
     tree_view = spell_check->tree_view;
@@ -720,11 +690,10 @@ balsa_spell_check_next(BalsaSpellCheck *spell_check)
     return FALSE;
 }
 
-
 /* Move the selection bound to the end of the current word, to highlight
  * it. */
 static gboolean
-highlight_idle(BalsaSpellCheck *spell_check)
+highlight_idle(BalsaSpellCheck * spell_check)
 {
     GtkTextBuffer *buffer;
 
@@ -740,13 +709,13 @@ highlight_idle(BalsaSpellCheck *spell_check)
 
 
 /* balsa_spell_check_learn ()
- *
+ * 
  * Learn the current word, either to the personal or session
- * dictionaries.
+ * dictionaries.  
  * */
 static void
-balsa_spell_check_learn(BalsaSpellCheck *spell_check,
-                        LearnType        learn_type)
+balsa_spell_check_learn(BalsaSpellCheck * spell_check,
+                       LearnType learn_type)
 {
     GtkTextBuffer *buffer = gtk_text_view_get_buffer(spell_check->text_view);
     gchar *word;
@@ -755,15 +724,14 @@ balsa_spell_check_learn(BalsaSpellCheck *spell_check,
         gtk_text_buffer_get_text(buffer, &spell_check->start_iter,
                                  &spell_check->end_iter, FALSE);
 
-    if (balsa_app.debug) {
-        balsa_information(LIBBALSA_INFORMATION_DEBUG,
-                          "BalsaSpellCheck: Learn %s\n", word);
-    }
+    if (balsa_app.debug)
+       balsa_information(LIBBALSA_INFORMATION_DEBUG,
+                         "BalsaSpellCheck: Learn %s\n", word);
 
     if (learn_type == SESSION_DICT) {
-        enchant_dict_add_to_session(spell_check->dict, word, -1);
+       enchant_dict_add_to_session(spell_check->dict, word, -1);
     } else {
-        enchant_dict_add(spell_check->dict, word, -1);
+       enchant_dict_add(spell_check->dict, word, -1);
     }
 
     g_free(word);
@@ -772,14 +740,13 @@ balsa_spell_check_learn(BalsaSpellCheck *spell_check,
 
 
 /* balsa_spell_check_fix ()
- *
+ * 
  * Replace the current word with the currently selected word, and if
  * fix_all is true, replace all other occurances of the current word
  * in the text with the correction.
  * */
 static void
-balsa_spell_check_fix(BalsaSpellCheck *spell_check,
-                      gboolean         fix_all)
+balsa_spell_check_fix(BalsaSpellCheck * spell_check, gboolean fix_all)
 {
     GtkTextBuffer *buffer = gtk_text_view_get_buffer(spell_check->text_view);
     gchar *new_word;
@@ -789,13 +756,13 @@ balsa_spell_check_fix(BalsaSpellCheck *spell_check,
         gtk_text_buffer_get_text(buffer, &spell_check->start_iter,
                                  &spell_check->end_iter, FALSE);
     new_word = gtk_editable_get_chars(GTK_EDITABLE(spell_check->entry),
-                                      0, -1);
+                                     0, -1);
 
     if (!*new_word) {
-        /* no word to replace, ignore */
+       /* no word to replace, ignore */
         g_free(new_word);
-        g_free(old_word);
-        return;
+       g_free(old_word);
+       return;
     }
 
     /* Some spelling modules can learn from user
@@ -804,33 +771,32 @@ balsa_spell_check_fix(BalsaSpellCheck *spell_check,
                                    old_word, -1, new_word, -1);
 
     if (check_error(spell_check)) {
-        spch_finish(spell_check, TRUE);
-        g_free(new_word);
-        g_free(old_word);
-        return;
+       spch_finish(spell_check, TRUE);
+       g_free(new_word);
+       g_free(old_word);
+       return;
     }
 
-    if (balsa_app.debug) {
-        balsa_information(LIBBALSA_INFORMATION_DEBUG,
-                          "BalsaSpellCheck: Replace %s with %s\n",
-                          old_word, new_word);
-    }
+    if (balsa_app.debug)
+       balsa_information(LIBBALSA_INFORMATION_DEBUG,
+                         "BalsaSpellCheck: Replace %s with %s\n",
+                         old_word, new_word);
 
     switch_word(spell_check, new_word);
 
     if (fix_all) {
         spch_save_word_iters(spell_check);
-        while (next_word(spell_check)) {
+       while (next_word(spell_check)) {
             gchar *this_word;
 
             this_word =
                 gtk_text_buffer_get_text(buffer, &spell_check->start_iter,
                                          &spell_check->end_iter, FALSE);
-            if (g_ascii_strcasecmp(old_word, this_word) == 0) {
-                switch_word(spell_check, new_word);
-            }
-            g_free(this_word);
-        }
+           if (g_ascii_strcasecmp(old_word, this_word) == 0) {
+               switch_word(spell_check, new_word);
+           }
+           g_free(this_word);
+       }
         spch_restore_word_iters(spell_check);
     }
 
@@ -846,18 +812,18 @@ balsa_spell_check_fix(BalsaSpellCheck *spell_check,
  * Clean up variables if the widget is destroyed.
  * */
 static void
-balsa_spell_check_destroy(GObject *object)
+balsa_spell_check_destroy(GObject * object)
 {
     BalsaSpellCheck *spell_check;
 
     spell_check = BALSA_SPELL_CHECK(object);
 
     if (spell_check->suggestions) {
-        finish_check(spell_check);
+       finish_check(spell_check);
     }
 
     if (spell_check->broker) {
-        spch_finish(spell_check, FALSE);
+       spch_finish(spell_check, FALSE);
     }
 
     libbalsa_clear_source_id(&spell_check->highlight_idle_id);
@@ -865,10 +831,9 @@ balsa_spell_check_destroy(GObject *object)
     g_clear_pointer(&spell_check->language_tag, g_free);
     g_clear_pointer(&quoted_rex, g_regex_unref);
 
-    if (G_OBJECT_CLASS(balsa_spell_check_parent_class)->dispose) {
+    if (G_OBJECT_CLASS(balsa_spell_check_parent_class)->dispose)
         (*G_OBJECT_CLASS(balsa_spell_check_parent_class)->
-         dispose)(object);
-    }
+         dispose) (object);
 }
 
 
@@ -877,8 +842,7 @@ balsa_spell_check_destroy(GObject *object)
  * Clean up the variables from the spell check
  * */
 static void
-spch_finish(BalsaSpellCheck *spell_check,
-            gboolean         keep_changes)
+spch_finish(BalsaSpellCheck * spell_check, gboolean keep_changes)
 {
     GtkTextBuffer *buffer = gtk_text_view_get_buffer(spell_check->text_view);
     GtkTextIter original;
@@ -894,7 +858,7 @@ spch_finish(BalsaSpellCheck *spell_check,
         gtk_text_buffer_delete_mark(buffer, spell_check->end_mark);
         g_object_unref(spell_check->original_text);
     } else {
-        /* replace corrected text with original text */
+       /* replace corrected text with original text */
 #if HAVE_GTKSOURCEVIEW
         buffer = (GtkTextBuffer *) spell_check->original_text;
 #else                           /* HAVE_GTKSOURCEVIEW */
@@ -920,23 +884,21 @@ spch_finish(BalsaSpellCheck *spell_check,
         spell_check->broker = NULL;
     }
 
-    if (balsa_app.debug) {
-        balsa_information(LIBBALSA_INFORMATION_DEBUG,
-                          "BalsaSpellCheck: Finished\n");
-    }
+    if (balsa_app.debug)
+       balsa_information(LIBBALSA_INFORMATION_DEBUG,
+                         "BalsaSpellCheck: Finished\n");
 
     gtk_widget_destroy((GtkWidget *) spell_check);
 }
 
 
 /* setup_suggestions ()
- *
+ * 
  * Retrieves the suggestions for the word that is currently being
  * checked, and place them in the word list.
  * */
 static void
-setup_suggestions(BalsaSpellCheck *spell_check,
-                  gsize            n_suggs)
+setup_suggestions(BalsaSpellCheck * spell_check, gsize n_suggs)
 {
     GtkTreeModel *model;
     GtkListStore *store;
@@ -956,14 +918,14 @@ setup_suggestions(BalsaSpellCheck *spell_check,
 
 
 /* check_word ()
- *
+ * 
  * Check the current word of the BalsaSpellCheck object.  If
  * incorrect, fill the tree_view and entrybox with the suggestions
  * obtained from enchant, and return a false value.  Otherwise return
  * true.
  * */
 static gboolean
-check_word(BalsaSpellCheck *spell_check)
+check_word(BalsaSpellCheck * spell_check)
 {
     gboolean correct;
     GtkTextBuffer *buffer;
@@ -972,18 +934,17 @@ check_word(BalsaSpellCheck *spell_check)
 
     buffer = gtk_text_view_get_buffer(spell_check->text_view);
     word = gtk_text_buffer_get_text(buffer,
-                                    &spell_check->start_iter,
-                                    &spell_check->end_iter, FALSE);
+                                   &spell_check->start_iter,
+                                   &spell_check->end_iter, FALSE);
 
     if (word) {
         gint enchant_check;
 
-        if (balsa_app.debug) {
-            balsa_information(LIBBALSA_INFORMATION_DEBUG,
-                              "BalsaSpellCheck: Check %s", word);
-        }
+       if (balsa_app.debug)
+           balsa_information(LIBBALSA_INFORMATION_DEBUG,
+                             "BalsaSpellCheck: Check %s", word);
 
-        enchant_check = enchant_dict_check(spell_check->dict, word, -1);
+       enchant_check = enchant_dict_check(spell_check->dict, word, -1);
 
         if (enchant_check < 0) {
             check_error(spell_check);
@@ -991,25 +952,23 @@ check_word(BalsaSpellCheck *spell_check)
         }
         correct = !enchant_check;
     } else {
-        return TRUE;
+       return TRUE;
     }
 
     if (!correct) {
         gsize n_suggs;
 
-        if (balsa_app.debug) {
-            balsa_information(LIBBALSA_INFORMATION_DEBUG,
-                              " …incorrect.\n");
-        }
+       if (balsa_app.debug)
+           balsa_information(LIBBALSA_INFORMATION_DEBUG,
+                             " …incorrect.\n");
 
-        spell_check->suggestions =
-            enchant_dict_suggest(spell_check->dict, word, -1, &n_suggs);
-        setup_suggestions(spell_check, n_suggs);
+       spell_check->suggestions =
+           enchant_dict_suggest(spell_check->dict, word, -1, &n_suggs);
+       setup_suggestions(spell_check, n_suggs);
     } else {
-        if (balsa_app.debug) {
-            balsa_information(LIBBALSA_INFORMATION_DEBUG,
-                              " …correct.\n");
-        }
+       if (balsa_app.debug)
+           balsa_information(LIBBALSA_INFORMATION_DEBUG,
+                             " …correct.\n");
     }
 
     g_free(word);
@@ -1018,12 +977,12 @@ check_word(BalsaSpellCheck *spell_check)
 
 
 /* finish_check ()
- *
- * Clean up all of the variables from the spell checking,
- * freeing the suggestions.
+ * 
+ * Clean up all of the variables from the spell checking, 
+ * freeing the suggestions.  
  * */
 static void
-finish_check(BalsaSpellCheck *spell_check)
+finish_check(BalsaSpellCheck * spell_check)
 {
     GtkTreeModel *model = gtk_tree_view_get_model(spell_check->tree_view);
 
@@ -1039,35 +998,35 @@ finish_check(BalsaSpellCheck *spell_check)
 
 
 /* check_error ()
- *
+ * 
  * To be called after trying things with the enchant broker, if there
  * were any errors with the operation it will generate an error
  * message and return true.
  * */
 static gboolean
-check_error(BalsaSpellCheck *spell_check)
+check_error(BalsaSpellCheck * spell_check)
 {
     const gchar *enchant_error;
 
     enchant_error = enchant_broker_get_error(spell_check->broker);
     if (enchant_error) {
-        balsa_information(LIBBALSA_INFORMATION_WARNING,
-                          _("BalsaSpellCheck: Enchant Error: %s\n"),
-                          enchant_error);
-        return TRUE;
+       balsa_information(LIBBALSA_INFORMATION_WARNING,
+                         _("BalsaSpellCheck: Enchant Error: %s\n"),
+                         enchant_error);
+       return TRUE;
     }
     return FALSE;
 }
 
 
-/* next_word()
- *
+/* next_word() 
+ * 
  * Move the pointer positions to the next word in preparation for
  * checking.  Returns true if successful, false if it has reached the
  * end of the text.
  * */
 static gboolean
-next_word(BalsaSpellCheck *spell_check)
+next_word(BalsaSpellCheck * spell_check)
 {
     GtkTextBuffer *buffer;
     GtkTextIter line_start, line_end;
@@ -1086,10 +1045,9 @@ next_word(BalsaSpellCheck *spell_check)
         /* move forward one word */
         do {
 
-            if (!gtk_text_iter_forward_word_end(&spell_check->end_iter)) {
+            if (!gtk_text_iter_forward_word_end(&spell_check->end_iter))
                 /* end of buffer */
                 return FALSE;
-            }
 
             /* we want only alpha words */
             spell_check->start_iter = spell_check->end_iter;
@@ -1102,17 +1060,16 @@ next_word(BalsaSpellCheck *spell_check)
             line_start = line_end;
             gtk_text_iter_forward_line(&line_end);
             line = gtk_text_buffer_get_text(buffer, &line_start,
-                                            &line_end, FALSE);
+                                        &line_end, FALSE);
             skip_sig = (!balsa_app.check_sig
                         && strcmp(line, "-- \n") == 0);
             skip_quoted = (!balsa_app.check_quoted && quoted_rex != NULL
                            && is_a_quote(line, quoted_rex) > 0);
             g_free(line);
 
-            if (skip_sig) {
+            if (skip_sig)
                 /* new word is in the sig */
                 return FALSE;
-            }
         }
         /* we've found the line that the new word is on--keep looking if
          * it's quoted */
@@ -1126,12 +1083,11 @@ next_word(BalsaSpellCheck *spell_check)
 
 
 /* switch_word ()
- *
+ * 
  * Replace the current word with the new_word.
  * */
 static void
-switch_word(BalsaSpellCheck *spell_check,
-            const gchar     *new_word)
+switch_word(BalsaSpellCheck * spell_check, const gchar * new_word)
 {
     GtkTextBuffer *buffer = gtk_text_view_get_buffer(spell_check->text_view);
 
@@ -1143,9 +1099,8 @@ switch_word(BalsaSpellCheck *spell_check,
     spch_restore_word_iters(spell_check);
 }
 
-
 static void
-spch_save_word_iters(BalsaSpellCheck *spell_check)
+spch_save_word_iters(BalsaSpellCheck * spell_check)
 {
     GtkTextBuffer *buffer = gtk_text_view_get_buffer(spell_check->text_view);
 
@@ -1155,9 +1110,8 @@ spch_save_word_iters(BalsaSpellCheck *spell_check)
                               &spell_check->end_iter);
 }
 
-
 static void
-spch_restore_word_iters(BalsaSpellCheck *spell_check)
+spch_restore_word_iters(BalsaSpellCheck * spell_check)
 {
     GtkTextBuffer *buffer = gtk_text_view_get_buffer(spell_check->text_view);
 
diff --git a/src/spell-check.h b/src/spell-check.h
index 109eb0c..d065688 100644
--- a/src/spell-check.h
+++ b/src/spell-check.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -27,37 +27,36 @@
 G_BEGIN_DECLS
 
 #define BALSA_TYPE_SPELL_CHECK \
-    (balsa_spell_check_get_type ())
+        (balsa_spell_check_get_type ())
 #define BALSA_SPELL_CHECK(obj) \
-    G_TYPE_CHECK_INSTANCE_CAST (obj, BALSA_TYPE_SPELL_CHECK, BalsaSpellCheck)
+        G_TYPE_CHECK_INSTANCE_CAST (obj, BALSA_TYPE_SPELL_CHECK, BalsaSpellCheck)
 #define BALSA_SPELL_CHECK_CLASS(klass) \
-    G_TYPE_CHECK_CLASS_CAST (klass, BALSA_TYPE_SPELL_CHECK, \
-                             BalsaSpellCheckClass)
+        G_TYPE_CHECK_CLASS_CAST (klass, BALSA_TYPE_SPELL_CHECK, \
+                BalsaSpellCheckClass)
 #define BALSA_IS_SPELL_CHECK(obj) \
-    G_TYPE_CHECK_INSTANCE_TYPE (obj, BALSA_TYPE_SPELL_CHECK)
+        G_TYPE_CHECK_INSTANCE_TYPE (obj, BALSA_TYPE_SPELL_CHECK)
 #define BALSA_IS_SPELL_CHECK_CLASS(klass) \
-    (G_TYPE_CHECK_CLASS_TYPE ((klass), BALSA_TYPE_SPELL_CHECK))
+        (G_TYPE_CHECK_CLASS_TYPE ((klass), BALSA_TYPE_SPELL_CHECK))
 
 
 /* opaque structures, declared in spell-check.c */
-typedef struct _BalsaSpellCheck BalsaSpellCheck;
-typedef struct _BalsaSpellCheckClass BalsaSpellCheckClass;
+    typedef struct _BalsaSpellCheck BalsaSpellCheck;
+    typedef struct _BalsaSpellCheckClass BalsaSpellCheckClass;
 
-GType balsa_spell_check_get_type(void);
+    GType balsa_spell_check_get_type(void);
 
 /* argument setters */
-void balsa_spell_check_set_language(BalsaSpellCheck *,
-                                    const gchar *);
+    void balsa_spell_check_set_language(BalsaSpellCheck *, const gchar *);
 
 /* function prototypes */
-GtkWidget *balsa_spell_check_new(GtkWindow *parent);
-GtkWidget *balsa_spell_check_new_with_text(GtkWindow   *parent,
-                                           GtkTextView *view);
-void balsa_spell_check_set_text(BalsaSpellCheck *spell_check,
-                                GtkTextView     *view);
-void balsa_spell_check_start(BalsaSpellCheck *spell_check);
+    GtkWidget *balsa_spell_check_new(GtkWindow * parent);
+    GtkWidget *balsa_spell_check_new_with_text(GtkWindow * parent,
+                                               GtkTextView * view);
+    void balsa_spell_check_set_text(BalsaSpellCheck * spell_check,
+                                   GtkTextView * view);
+    void balsa_spell_check_start(BalsaSpellCheck * spell_check);
 
 
 G_END_DECLS
 
-#endif                          /* __BALSA_SPELL_CHECK_H__ */
+#endif                         /* __BALSA_SPELL_CHECK_H__ */
diff --git a/src/store-address.c b/src/store-address.c
index 603bd76..a6cc2ea 100644
--- a/src/store-address.c
+++ b/src/store-address.c
@@ -5,20 +5,20 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "store-address.h"
 
@@ -26,7 +26,7 @@
 #include <glib/gi18n.h>
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#  include "macosx-helpers.h"
 #endif
 
 #include "balsa-app.h"
@@ -42,36 +42,35 @@ struct _StoreAddressInfo {
 };
 
 /* statics */
-static GtkWidget *store_address_dialog(StoreAddressInfo *info);
-static void store_address_weak_notify(StoreAddressInfo *info,
-                                      gpointer          message);
-static void store_address_response(GtkWidget        *dialog,
-                                   gint              response,
+static GtkWidget *store_address_dialog(StoreAddressInfo * info);
+static void store_address_weak_notify(StoreAddressInfo * info,
+                                      gpointer message);
+static void store_address_response(GtkWidget * dialog, gint response,
                                    StoreAddressInfo *info);
-static void store_address_free(StoreAddressInfo *info);
-static gboolean store_address_from_entries(GtkWindow        *window,
-                                           StoreAddressInfo *info,
-                                           GtkWidget       **entries);
-static GtkWidget *store_address_book_frame(StoreAddressInfo *info);
-static GtkWidget *store_address_note_frame(StoreAddressInfo *info);
-static void store_address_book_menu_cb(GtkWidget        *widget,
-                                       StoreAddressInfo *info);
-static void store_address_add_address(StoreAddressInfo *info,
-                                      const gchar      *label,
-                                      InternetAddress  *address,
-                                      InternetAddress  *group);
-static void store_address_add_lbaddress(StoreAddressInfo      *info,
+static void store_address_free(StoreAddressInfo * info);
+static gboolean store_address_from_entries(GtkWindow *window,
+                                           StoreAddressInfo * info,
+                                           GtkWidget ** entries);
+static GtkWidget *store_address_book_frame(StoreAddressInfo * info);
+static GtkWidget *store_address_note_frame(StoreAddressInfo * info);
+static void store_address_book_menu_cb(GtkWidget * widget, 
+                                       StoreAddressInfo * info);
+static void store_address_add_address(StoreAddressInfo * info,
+                                      const gchar * label,
+                                      InternetAddress * address,
+                                      InternetAddress * group);
+static void store_address_add_lbaddress(StoreAddressInfo * info,
                                         const LibBalsaAddress *address);
-static void store_address_add_list(StoreAddressInfo    *info,
-                                   const gchar         *label,
-                                   InternetAddressList *list);
+static void store_address_add_list(StoreAddressInfo * info,
+                                   const gchar * label,
+                                  InternetAddressList * list);
 
-/*
+/* 
  * public interface: balsa_store_address
  */
 #define BALSA_STORE_ADDRESS_KEY "balsa-store-address"
 void
-balsa_store_address_from_messages(GList *messages)
+balsa_store_address_from_messages(GList * messages)
 {
     StoreAddressInfo *info = NULL;
     GList *message_list = NULL;
@@ -81,18 +80,16 @@ balsa_store_address_from_messages(GList *messages)
         gpointer data = g_object_get_data(G_OBJECT(list->data),
                                           BALSA_STORE_ADDRESS_KEY);
 
-        if (data) {
+        if (data)
             info = data;
-        } else {
+        else
             message_list = g_list_prepend(message_list, list->data);
-        }
     }
 
     if (!message_list) {
         /* All messages are already showing. */
-        if (info) {
+        if (info)
             gtk_window_present(GTK_WINDOW(info->dialog));
-        }
         return;
     }
 
@@ -121,7 +118,6 @@ balsa_store_address_from_messages(GList *messages)
     gtk_widget_show(GTK_WIDGET(info->dialog));
 }
 
-
 void
 balsa_store_address(const LibBalsaAddress *address)
 {
@@ -140,24 +136,19 @@ balsa_store_address(const LibBalsaAddress *address)
     gtk_widget_show(GTK_WIDGET(info->dialog));
 }
 
-
 /* Weak notify that a message was deleted; remove it from our list. */
 static void
-store_address_weak_notify(StoreAddressInfo *info,
-                          gpointer          message)
+store_address_weak_notify(StoreAddressInfo * info, gpointer message)
 {
     info->message_list = g_list_remove(info->message_list, message);
-    if (!info->message_list) {
+    if (!info->message_list)
         gtk_dialog_response(GTK_DIALOG(info->dialog), GTK_RESPONSE_NONE);
-    }
 }
 
-
 /* Response signal handler for the dialog. */
 static void
-store_address_response(GtkWidget        *dialog,
-                       gint              response,
-                       StoreAddressInfo *info)
+store_address_response(GtkWidget * dialog, gint response,
+                       StoreAddressInfo * info)
 {
     GtkNotebook *notebook = GTK_NOTEBOOK(info->notebook);
     GList *list;
@@ -174,10 +165,9 @@ store_address_response(GtkWidget        *dialog,
 
         page = gtk_notebook_get_current_page(notebook);
         entries = g_list_nth_data(info->entries_list, page);
-        if (!store_address_from_entries(GTK_WINDOW(dialog), info, entries)) {
+        if (!store_address_from_entries(GTK_WINDOW(dialog), info, entries))
             /* Keep the dialog open. */
             return;
-        }
     }
 
     /* Let go of remaining messages. */
@@ -191,21 +181,19 @@ store_address_response(GtkWidget        *dialog,
     store_address_free(info);
 }
 
-
 /* Clean up when we're done, or if there's nothing to do. */
 static void
-store_address_free(StoreAddressInfo *info)
+store_address_free(StoreAddressInfo * info)
 {
     g_list_free(info->message_list);
     gtk_widget_destroy(info->dialog);
     g_free(info);
 }
 
-
 /* store_address_dialog:
  * create the main dialog */
 static GtkWidget *
-store_address_dialog(StoreAddressInfo *info)
+store_address_dialog(StoreAddressInfo * info)
 {
     GtkWidget *dialog;
     GtkWidget *vbox;
@@ -221,7 +209,7 @@ store_address_dialog(StoreAddressInfo *info)
                                     NULL);
     gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
     gtk_widget_grab_focus(gtk_dialog_get_widget_for_response
-                              (GTK_DIALOG(dialog), GTK_RESPONSE_OK));
+                          (GTK_DIALOG(dialog), GTK_RESPONSE_OK));
     vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
 
 #if HAVE_MACOSX_DESKTOP
@@ -242,60 +230,52 @@ store_address_dialog(StoreAddressInfo *info)
     return dialog;
 }
 
-
 /* store_address_from_entries:
  * make the actual address book entry */
 static gboolean
-store_address_from_entries(GtkWindow        *window,
-                           StoreAddressInfo *info,
-                           GtkWidget       **entries)
+store_address_from_entries(GtkWindow *window, StoreAddressInfo * info,
+                           GtkWidget ** entries)
 {
     LibBalsaAddress *address;
     LibBalsaABErr rc;
 
     if (info->current_address_book == NULL) {
         balsa_information(LIBBALSA_INFORMATION_WARNING,
-                          _("No address book selected…"));
+                     _("No address book selected…"));
         return FALSE;
     }
 
     address = libbalsa_address_new_from_edit_entries(entries);
     rc = libbalsa_address_book_add_address(info->current_address_book,
                                            address);
-    if (rc != LBABERR_OK) {
+    if(rc != LBABERR_OK) {
         const gchar *msg =
             libbalsa_address_book_strerror(info->current_address_book, rc);
-        if (!msg) {
-            switch (rc) {
-            case LBABERR_CANNOT_WRITE:
+        if(!msg) {
+            switch(rc) {
+            case LBABERR_CANNOT_WRITE: 
                 msg = _("Address could not be written to this address book.");
                 break;
-
             case LBABERR_CANNOT_CONNECT:
-                msg = _("Address book could not be accessed.");
-                break;
-
+                msg = _("Address book could not be accessed."); break;
             case LBABERR_DUPLICATE:
                 msg = _("This mail address is already in this address book.");
                 break;
-
             default:
-                msg = _("Unexpected address book error. Report it.");
-                break;
+                msg = _("Unexpected address book error. Report it."); break;
             }
         }
         balsa_information_parented(window, LIBBALSA_INFORMATION_ERROR, "%s", msg);
     }
-
+    
     g_object_unref(address);
     return rc == LBABERR_OK;
 }
 
-
 /* store_address_book_frame:
  * create the frame containing the address book menu */
 static GtkWidget *
-store_address_book_frame(StoreAddressInfo *info)
+store_address_book_frame(StoreAddressInfo * info)
 {
     guint default_ab_offset = 0;
     GtkWidget *hbox;
@@ -321,15 +301,13 @@ store_address_book_frame(StoreAddressInfo *info)
         const gchar *name;
 
         address_book = LIBBALSA_ADDRESS_BOOK(ab_list->data);
-        if (info->current_address_book == NULL) {
+        if (info->current_address_book == NULL)
             info->current_address_book = address_book;
-        }
 
         name = libbalsa_address_book_get_name(address_book);
         gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), name);
-        if (address_book == balsa_app.default_address_book) {
+        if (address_book == balsa_app.default_address_book)
             default_ab_offset = off;
-        }
     }
     gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), default_ab_offset);
 
@@ -339,7 +317,6 @@ store_address_book_frame(StoreAddressInfo *info)
     return hbox;
 }
 
-
 /* store_address_note_frame:
  * create the frame containing the notebook with address information */
 static GtkWidget *
@@ -354,48 +331,43 @@ store_address_note_frame(StoreAddressInfo *info)
 
     for (list = info->message_list; list; list = list->next) {
         message = LIBBALSA_MESSAGE(list->data);
-        if (message->headers) {
-            store_address_add_list(info, _("From: "), message->headers->from);
-            store_address_add_list(info, _("To: "), message->headers->to_list);
-            store_address_add_list(info, _("CC: "), message->headers->cc_list);
-            store_address_add_list(info, _("BCC: "), message->headers->bcc_list);
-        }
+       if (message->headers) {
+           store_address_add_list(info, _("From: "), message->headers->from);
+           store_address_add_list(info, _("To: "), message->headers->to_list);
+           store_address_add_list(info, _("CC: "), message->headers->cc_list);
+           store_address_add_list(info, _("BCC: "), message->headers->bcc_list);
+       }
     }
 
     return info->notebook;
 }
 
-
 /* store_address_book_menu_cb:
  * callback for the address book menu */
 static void
-store_address_book_menu_cb(GtkWidget        *widget,
-                           StoreAddressInfo *info)
+store_address_book_menu_cb(GtkWidget * widget, 
+                           StoreAddressInfo * info)
 {
     guint i = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
     GList *nth = g_list_nth(balsa_app.address_book_list, i);
-    if (nth) {
+    if(nth)
         info->current_address_book = LIBBALSA_ADDRESS_BOOK(nth->data);
-    }
 }
 
-
 /* store_address_add_address:
  * make a new page in the notebook */
 static void
-store_address_add_address(StoreAddressInfo *info,
-                          const gchar      *lab,
-                          InternetAddress  *ia,
-                          InternetAddress  *group)
+store_address_add_address(StoreAddressInfo * info,
+                          const gchar * lab, InternetAddress * ia,
+                         InternetAddress * group)
 {
     gchar *text;
     LibBalsaAddress *address;
     gchar *label_text;
     GtkWidget **entries, *ew;
 
-    if (ia == NULL) {
+    if (ia == NULL)
         return;
-    }
 
     entries = g_new(GtkWidget *, NUM_FIELDS);
     info->entries_list = g_list_append(info->entries_list, entries);
@@ -414,10 +386,9 @@ store_address_add_address(StoreAddressInfo *info,
         for (j = 0; j < internet_address_list_length(members); j++) {
             InternetAddress *member_address =
                 internet_address_list_get_address(members, j);
-            if (INTERNET_ADDRESS_IS_MAILBOX(member_address)) {
+            if (INTERNET_ADDRESS_IS_MAILBOX(member_address))
                 libbalsa_address_add_addr
                     (address, INTERNET_ADDRESS_MAILBOX(member_address)->addr);
-            }
         }
     } else {
         libbalsa_address_add_addr(address, INTERNET_ADDRESS_MAILBOX(ia)->addr);
@@ -427,18 +398,16 @@ store_address_add_address(StoreAddressInfo *info,
 
     label_text = g_strconcat(lab, text, NULL);
     g_free(text);
-    if (g_utf8_strlen(label_text, -1) > 15) {
+    if (g_utf8_strlen(label_text, -1) > 15)
         /* truncate to an arbitrary length: */
         *g_utf8_offset_to_pointer(label_text, 15) = '\0';
-    }
     gtk_notebook_append_page(GTK_NOTEBOOK(info->notebook), ew,
                              gtk_label_new(label_text));
     g_free(label_text);
 }
 
-
 static void
-store_address_add_lbaddress(StoreAddressInfo      *info,
+store_address_add_lbaddress(StoreAddressInfo * info,
                             const LibBalsaAddress *address)
 {
     gchar *label_text;
@@ -456,29 +425,26 @@ store_address_add_lbaddress(StoreAddressInfo      *info,
 
     full_name = libbalsa_address_get_full_name(address);
     label_text = g_strdup(full_name != NULL ? full_name : addr);
-    if (g_utf8_strlen(label_text, -1) > 15) {
+    if (g_utf8_strlen(label_text, -1) > 15)
         /* truncate to an arbitrary length: */
         *g_utf8_offset_to_pointer(label_text, 15) = '\0';
-    }
     gtk_notebook_append_page(GTK_NOTEBOOK(info->notebook), ew,
                              gtk_label_new(label_text));
     g_free(label_text);
 }
 
-
 /* store_address_add_list:
  * take a list of addresses and pass them one at a time to
  * store_address_add_address */
 static void
-store_address_add_list(StoreAddressInfo    *info,
-                       const gchar         *label,
-                       InternetAddressList *list)
+store_address_add_list(StoreAddressInfo    * info,
+                       const gchar         * label,
+                       InternetAddressList * list)
 {
     int i, j;
 
-    if (!list) {
+    if (!list)
         return;
-    }
 
     for (i = 0; i < internet_address_list_length(list); i++) {
         InternetAddress *ia = internet_address_list_get_address(list, i);
@@ -488,7 +454,7 @@ store_address_add_list(StoreAddressInfo    *info,
         if (INTERNET_ADDRESS_IS_MAILBOX(ia)) {
             store_address_add_address(info, label, ia, NULL);
         } else if (dist_list_mode) {
-            store_address_add_address(info, label, ia, ia);
+                store_address_add_address(info, label, ia, ia);
         } else {
             InternetAddressList *members =
                 INTERNET_ADDRESS_GROUP(ia)->members;
@@ -497,10 +463,9 @@ store_address_add_list(StoreAddressInfo    *info,
                 InternetAddress *member_address =
                     internet_address_list_get_address(members, j);
 
-                if (INTERNET_ADDRESS_IS_MAILBOX(member_address)) {
+                if (INTERNET_ADDRESS_IS_MAILBOX(member_address))
                     store_address_add_address(info, label, member_address,
                                               ia);
-                }
             }
         }
     }
diff --git a/src/store-address.h b/src/store-address.h
index 394022e..b050dbb 100644
--- a/src/store-address.h
+++ b/src/store-address.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -23,7 +23,7 @@
 #include <glib.h>
 #include "libbalsa.h"
 
-void balsa_store_address_from_messages(GList *messages);
+void balsa_store_address_from_messages(GList * messages);
 void balsa_store_address(const LibBalsaAddress *address);
 
 #endif
diff --git a/src/toolbar-factory.c b/src/toolbar-factory.c
index f028344..42dc480 100644
--- a/src/toolbar-factory.c
+++ b/src/toolbar-factory.c
@@ -18,7 +18,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "toolbar-factory.h"
 
@@ -36,9 +36,7 @@
 
 /* Must be consistent with BalsaToolbarType enum: */
 static const gchar *const balsa_toolbar_names[] =
-{
-    "MainWindow", "ComposeWindow", "MessageWindow"
-};
+    { "MainWindow", "ComposeWindow", "MessageWindow" };
 
 /*
  * The BalsaToolbarModel class.
@@ -47,12 +45,12 @@ static const gchar *const balsa_toolbar_names[] =
 struct BalsaToolbarModel_ {
     GObject object;
 
-    GHashTable *legal;
-    GArray *standard;
-    GArray *current;
+    GHashTable      *legal;
+    GArray          *standard;
+    GArray          *current;
     BalsaToolbarType type;
-    GtkToolbarStyle style;
-    GSettings *settings;
+    GtkToolbarStyle  style;
+    GSettings       *settings;
 };
 
 enum {
@@ -60,13 +58,11 @@ enum {
     LAST_SIGNAL
 };
 
-static GObjectClass *parent_class;
-static guint model_signals[LAST_SIGNAL] = {
-    0
-};
+static GObjectClass* parent_class;
+static guint model_signals[LAST_SIGNAL] = { 0 };
 
 static void
-balsa_toolbar_model_dispose(GObject *object)
+balsa_toolbar_model_dispose(GObject * object)
 {
     BalsaToolbarModel *model = BALSA_TOOLBAR_MODEL(object);
 
@@ -77,7 +73,7 @@ balsa_toolbar_model_dispose(GObject *object)
 
 
 static void
-balsa_toolbar_model_finalize(GObject *object)
+balsa_toolbar_model_finalize(GObject * object)
 {
     BalsaToolbarModel *model = BALSA_TOOLBAR_MODEL(object);
 
@@ -88,9 +84,8 @@ balsa_toolbar_model_finalize(GObject *object)
     G_OBJECT_CLASS(parent_class)->finalize(object);
 }
 
-
 static void
-balsa_toolbar_model_class_init(BalsaToolbarModelClass *klass)
+balsa_toolbar_model_class_init(BalsaToolbarModelClass* klass)
 {
     GObjectClass *object_class = (GObjectClass *) klass;
 
@@ -108,15 +103,13 @@ balsa_toolbar_model_class_init(BalsaToolbarModelClass *klass)
     object_class->finalize = balsa_toolbar_model_finalize;
 }
 
-
 static void
-balsa_toolbar_model_init(BalsaToolbarModel *model)
+balsa_toolbar_model_init(BalsaToolbarModel * model)
 {
     model->legal =
         g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
 }
 
-
 GType
 balsa_toolbar_model_get_type()
 {
@@ -144,53 +137,52 @@ balsa_toolbar_model_get_type()
     return balsa_toolbar_model_type;
 }
 
-
 /* End of class boilerplate */
 
 /* The descriptions must be SHORT */
-button_data toolbar_buttons[] = {
-    {"", N_("Separator"), FALSE},
-    {"application-exit", N_("Quit"), FALSE},
-    {BALSA_PIXMAP_RECEIVE, N_("Check"), TRUE},
-    {BALSA_PIXMAP_COMPOSE, N_("Compose"), TRUE},
-    {BALSA_PIXMAP_CONTINUE, N_("Continue"), FALSE},
-    {BALSA_PIXMAP_REPLY, N_("Reply"), TRUE},
-    {BALSA_PIXMAP_REPLY_ALL, N_("Reply\nto all"), FALSE},
-    {BALSA_PIXMAP_REPLY_GROUP, N_("Reply\nto group"), FALSE},
-    {BALSA_PIXMAP_FORWARD, N_("Forward"), FALSE},
-    {BALSA_PIXMAP_PREVIOUS, N_("Previous"), FALSE},
-    {BALSA_PIXMAP_NEXT, N_("Next"), FALSE},
-    {BALSA_PIXMAP_NEXT_UNREAD, N_("Next\nunread"), TRUE},
-    {BALSA_PIXMAP_NEXT_FLAGGED, N_("Next\nflagged"), FALSE},
-    {BALSA_PIXMAP_PREVIOUS_PART, N_("Previous\npart"), FALSE},
-    {BALSA_PIXMAP_NEXT_PART, N_("Next\npart"), FALSE},
-    {"edit-delete", N_("Trash /\nDelete"), FALSE},
-    {BALSA_PIXMAP_POSTPONE, N_("Postpone"), FALSE},
-    {"document-print", N_("Print"), FALSE},
-    {BALSA_PIXMAP_REQUEST_MDN, N_("Request\nMDN"), FALSE},
-    {BALSA_PIXMAP_SEND, N_("Send"), TRUE},
-    {BALSA_PIXMAP_SEND_QUEUED, N_("Send queued"), TRUE},
-    {BALSA_PIXMAP_SEND_RECEIVE, N_("Exchange"), FALSE},
-    {BALSA_PIXMAP_QUEUE, N_("Queue"), TRUE},
-    {BALSA_PIXMAP_ATTACHMENT, N_("Attach"), TRUE},
-    {"document-save", N_("Save"), TRUE},
-    {BALSA_PIXMAP_IDENTITY, N_("Identity"), FALSE},
-    {"tools-check-spelling", N_("Spelling"), TRUE},
-    {"window-close-symbolic", N_("Close"), FALSE},
-    {BALSA_PIXMAP_MARKED_NEW, N_("Toggle\nnew"), FALSE},
-    {BALSA_PIXMAP_MARK_ALL, N_("Mark all"), FALSE},
-    {BALSA_PIXMAP_SHOW_HEADERS, N_("All\nheaders"), FALSE},
-    {"gtk-cancel", N_("Reset\nFilter"), FALSE},
-    {BALSA_PIXMAP_SHOW_PREVIEW, N_("Message Preview"), FALSE},
+button_data toolbar_buttons[]={
+    {"",                         N_("Separator"),       FALSE},
+    {"application-exit",         N_("Quit"),            FALSE},
+    {BALSA_PIXMAP_RECEIVE,       N_("Check"),           TRUE},
+    {BALSA_PIXMAP_COMPOSE,       N_("Compose"),         TRUE},
+    {BALSA_PIXMAP_CONTINUE,      N_("Continue"),        FALSE},
+    {BALSA_PIXMAP_REPLY,         N_("Reply"),           TRUE},
+    {BALSA_PIXMAP_REPLY_ALL,     N_("Reply\nto all"),   FALSE},
+    {BALSA_PIXMAP_REPLY_GROUP,   N_("Reply\nto group"), FALSE},
+    {BALSA_PIXMAP_FORWARD,       N_("Forward"),         FALSE},
+    {BALSA_PIXMAP_PREVIOUS,      N_("Previous"),        FALSE},
+    {BALSA_PIXMAP_NEXT,          N_("Next"),            FALSE},
+    {BALSA_PIXMAP_NEXT_UNREAD,   N_("Next\nunread"),    TRUE},
+    {BALSA_PIXMAP_NEXT_FLAGGED,  N_("Next\nflagged"),   FALSE},
+    {BALSA_PIXMAP_PREVIOUS_PART, N_("Previous\npart"),  FALSE},
+    {BALSA_PIXMAP_NEXT_PART,     N_("Next\npart"),      FALSE},
+    {"edit-delete",           N_("Trash /\nDelete"), FALSE},
+    {BALSA_PIXMAP_POSTPONE,      N_("Postpone"),        FALSE},
+    {"document-print",            N_("Print"),           FALSE},
+    {BALSA_PIXMAP_REQUEST_MDN,   N_("Request\nMDN"),    FALSE},
+    {BALSA_PIXMAP_SEND,          N_("Send"),            TRUE},
+    {BALSA_PIXMAP_SEND_QUEUED,   N_("Send queued"),     TRUE},
+    {BALSA_PIXMAP_SEND_RECEIVE,  N_("Exchange"),        FALSE},
+       {BALSA_PIXMAP_QUEUE,         N_("Queue"),           TRUE},
+    {BALSA_PIXMAP_ATTACHMENT,    N_("Attach"),          TRUE},
+    {"document-save",             N_("Save"),            TRUE},
+    {BALSA_PIXMAP_IDENTITY,      N_("Identity"),        FALSE},
+    {"tools-check-spelling",      N_("Spelling"),        TRUE},
+    {"window-close-symbolic",    N_("Close"),           FALSE},
+    {BALSA_PIXMAP_MARKED_NEW,    N_("Toggle\nnew"),     FALSE},
+    {BALSA_PIXMAP_MARK_ALL,      N_("Mark all"),        FALSE},
+    {BALSA_PIXMAP_SHOW_HEADERS,  N_("All\nheaders"),    FALSE},
+    {"gtk-cancel",           N_("Reset\nFilter"),   FALSE},
+    {BALSA_PIXMAP_SHOW_PREVIEW,  N_("Message Preview"),     FALSE},
 #ifdef HAVE_GPGME
-    {BALSA_PIXMAP_GPG_SIGN, N_("Sign"), FALSE},
-    {BALSA_PIXMAP_GPG_ENCRYPT, N_("Encrypt"), FALSE},
+    {BALSA_PIXMAP_GPG_SIGN,      N_("Sign"),            FALSE},
+    {BALSA_PIXMAP_GPG_ENCRYPT,   N_("Encrypt"),         FALSE},
 #endif
-    {"edit-undo", N_("Undo"), FALSE},
-    {"edit-redo", N_("Redo"), FALSE},
-    {"edit-clear", N_("Expunge"), FALSE},
-    {"list-remove", N_("Empty\nTrash"), FALSE},
-    {"gtk-edit", N_("Edit"), FALSE},
+    {"edit-undo",             N_("Undo"),            FALSE},
+    {"edit-redo",             N_("Redo"),            FALSE},
+    {"edit-clear",            N_("Expunge"),         FALSE},
+    {"list-remove",           N_("Empty\nTrash"),    FALSE},
+    {"gtk-edit",             N_("Edit"),            FALSE},
 };
 
 const int toolbar_button_count =
@@ -206,37 +198,32 @@ balsa_toolbar_button_text(gint button)
              N_("Queue") : toolbar_buttons[button].button_text);
 }
 
-
 const gchar *
 balsa_toolbar_sanitize_id(const gchar *id)
 {
     gint button = get_toolbar_button_index(id);
 
-    if (button >= 0) {
-        return toolbar_buttons[button].pixmap_id;
-    } else {
-        return NULL;
-    }
+    if (button >= 0)
+       return toolbar_buttons[button].pixmap_id;
+    else
+       return NULL;
 }
 
-
 /* this should go to GTK because it modifies its internal structures. */
 static void
-balsa_toolbar_remove_all(GtkWidget *widget)
+balsa_toolbar_remove_all(GtkWidget * widget)
 {
     GtkToolItem *item;
 
-    while ((item = gtk_toolbar_get_nth_item((GtkToolbar *) widget, 0))) {
+    while ((item = gtk_toolbar_get_nth_item((GtkToolbar *) widget, 0)))
         gtk_container_remove((GtkContainer *) widget, (GtkWidget *) item);
-    }
 }
 
-
 /* Load and save config
  */
 
 static void
-tm_load_model(BalsaToolbarModel *model)
+tm_load_model(BalsaToolbarModel * model)
 {
     gchar *key;
     guint j;
@@ -254,9 +241,8 @@ tm_load_model(BalsaToolbarModel *model)
         entry.action = libbalsa_conf_get_string(key);
         g_free(key);
 
-        if (!entry.action) {
+        if (!entry.action)
             break;
-        }
 
         key = g_strdup_printf("Icon%d", j);
         entry.icon = libbalsa_conf_get_string(key);
@@ -268,9 +254,8 @@ tm_load_model(BalsaToolbarModel *model)
     libbalsa_conf_pop_group();
 }
 
-
 static void
-tm_save_model(BalsaToolbarModel *model)
+tm_save_model(BalsaToolbarModel * model)
 {
     gchar *key;
     guint j;
@@ -280,9 +265,8 @@ tm_save_model(BalsaToolbarModel *model)
     libbalsa_conf_push_group(key);
     g_free(key);
 
-    if (model->style != (GtkToolbarStyle) (-1)) {
+    if (model->style != (GtkToolbarStyle) (-1))
         libbalsa_conf_set_int("Style", model->style);
-    }
 
 
     for (j = 0; j < model->current->len; j++) {
@@ -300,29 +284,26 @@ tm_save_model(BalsaToolbarModel *model)
     libbalsa_conf_pop_group();
 }
 
-
 /* GSettings change_cb
  */
 static void
-tm_gsettings_change_cb(GSettings   *settings,
-                       const gchar *key,
-                       gpointer     user_data)
+tm_gsettings_change_cb(GSettings   * settings,
+                       const gchar * key,
+                       gpointer      user_data)
 {
     BalsaToolbarModel *model = user_data;
 
     if (!strcmp(key, "toolbar-style") &&
-        (model->style == (GtkToolbarStyle) (-1))) {
+        model->style == (GtkToolbarStyle) (-1))
         balsa_toolbar_model_changed(model);
-    }
 }
 
-
 /* Create a BalsaToolbarModel structure.
  */
 BalsaToolbarModel *
-balsa_toolbar_model_new(BalsaToolbarType         type,
-                        const BalsaToolbarEntry *entries,
-                        guint                    n_entries)
+balsa_toolbar_model_new(BalsaToolbarType          type,
+                        const BalsaToolbarEntry * entries,
+                        guint                     n_entries)
 {
     guint i;
     BalsaToolbarModel *model;
@@ -335,7 +316,7 @@ balsa_toolbar_model_new(BalsaToolbarType         type,
         BalsaToolbarEntry entry;
 
         entry.action = g_strdup(entries[i].action);
-        entry.icon = g_strdup(entries[i].icon);
+        entry.icon   = g_strdup(entries[i].icon);
         g_array_append_val(model->standard, entry);
     }
 
@@ -350,36 +331,32 @@ balsa_toolbar_model_new(BalsaToolbarType         type,
     return model;
 }
 
-
 /* balsa_toolbar_model_changed:
    Update all toolbars derived from the model.
 
    Called from toolbar-prefs.c after a change has been made to a toolbar
    layout.
- */
+*/
 void
-balsa_toolbar_model_changed(BalsaToolbarModel *model)
+balsa_toolbar_model_changed(BalsaToolbarModel * model)
 {
     g_signal_emit(model, model_signals[CHANGED], 0);
 }
 
-
 static void
-tm_add_action(BalsaToolbarModel       *model,
-              const BalsaToolbarEntry *entry)
+tm_add_action(BalsaToolbarModel       * model,
+              const BalsaToolbarEntry * entry)
 {
     /* Check whether we have already seen this icon: */
-    if (entry->icon && !g_hash_table_lookup(model->legal, entry->icon)) {
+    if (entry->icon && !g_hash_table_lookup(model->legal, entry->icon))
         g_hash_table_insert(model->legal, g_strdup(entry->icon),
                             g_strdup(entry->action));
-    }
 }
 
-
 void
-balsa_toolbar_model_add_entries(BalsaToolbarModel       *model,
-                                const BalsaToolbarEntry *entries,
-                                guint                    n_entries)
+balsa_toolbar_model_add_entries(BalsaToolbarModel       * model,
+                                const BalsaToolbarEntry * entries,
+                                guint                     n_entries)
 {
     while (n_entries > 0) {
         tm_add_action(model, entries++);
@@ -387,38 +364,33 @@ balsa_toolbar_model_add_entries(BalsaToolbarModel       *model,
     }
 }
 
-
 /* Return the legal icons.
  */
 GHashTable *
-balsa_toolbar_model_get_legal(BalsaToolbarModel *model)
+balsa_toolbar_model_get_legal(BalsaToolbarModel * model)
 {
     return model->legal;
 }
 
-
 /* Return the current icons.
  */
 GArray *
-balsa_toolbar_model_get_current(BalsaToolbarModel *model)
+balsa_toolbar_model_get_current(BalsaToolbarModel * model)
 {
     return model->current->len > 0 ?  model->current : model->standard;
 }
 
-
 gboolean
-balsa_toolbar_model_is_standard(BalsaToolbarModel *model)
+balsa_toolbar_model_is_standard(BalsaToolbarModel * model)
 {
     return model->current->len == 0;
 }
 
-
 /* Add an icon to the list of current icons in a BalsaToolbarModel.
  */
 void
-balsa_toolbar_model_insert_icon(BalsaToolbarModel *model,
-                                gchar             *icon,
-                                gint               position)
+balsa_toolbar_model_insert_icon(BalsaToolbarModel * model, gchar * icon,
+                                gint position)
 {
     const gchar *real_button = balsa_toolbar_sanitize_id(icon);
 
@@ -426,22 +398,19 @@ balsa_toolbar_model_insert_icon(BalsaToolbarModel *model,
         BalsaToolbarEntry entry;
 
         entry.action = g_strdup(g_hash_table_lookup(model->legal, real_button));
-        entry.icon = g_strdup(real_button);
-        if (position >= 0) {
+        entry.icon   = g_strdup(real_button);
+        if (position >= 0)
             g_array_insert_val(model->current, position, entry);
-        } else {
+        else
             g_array_append_val(model->current, entry);
-        }
-    } else {
+    } else
         g_warning(_("Unknown toolbar icon “%s”"), icon);
-    }
 }
 
-
 /* Remove all icons from the BalsaToolbarModel.
  */
 void
-balsa_toolbar_model_clear(BalsaToolbarModel *model)
+balsa_toolbar_model_clear(BalsaToolbarModel * model)
 {
     guint j;
 
@@ -455,12 +424,11 @@ balsa_toolbar_model_clear(BalsaToolbarModel *model)
     g_array_set_size(model->current, 0);
 }
 
-
 /* Create a new instance of a toolbar
  */
 
 static gboolean
-tm_has_second_line(BalsaToolbarModel *model)
+tm_has_second_line(BalsaToolbarModel * model)
 {
     GArray *current;
     guint j;
@@ -474,27 +442,23 @@ tm_has_second_line(BalsaToolbarModel *model)
         icon = g_array_index(current, BalsaToolbarEntry, j).icon;
         button = get_toolbar_button_index(icon);
 
-        if ((button >= 0) && strchr(balsa_toolbar_button_text(button), '\n')) {
+        if (button >= 0 && strchr(balsa_toolbar_button_text(button), '\n'))
             return TRUE;
-        }
     }
 
     return FALSE;
 }
 
-
 static gint
-tm_set_tool_item_label(GtkToolItem *tool_item,
-                       const gchar *stock_id,
-                       gboolean     make_two_line)
+tm_set_tool_item_label(GtkToolItem * tool_item, const gchar * stock_id,
+                       gboolean make_two_line)
 {
     gint button = get_toolbar_button_index(stock_id);
     const gchar *text;
     gchar *label;
 
-    if (button < 0) {
+    if (button < 0)
         return button;
-    }
 
     text = balsa_toolbar_button_text(button);
     if (balsa_app.toolbar_wrap_button_text) {
@@ -504,9 +468,8 @@ tm_set_tool_item_label(GtkToolItem *tool_item,
             g_strconcat(text, "\n", NULL) : g_strdup(text);
     } else {
         gchar *p = label = g_strdup(text);
-        while ((p = strchr(p, '\n'))) {
+        while ((p = strchr(p, '\n')))
             *p++ = ' ';
-        }
     }
 
     gtk_tool_button_set_label(GTK_TOOL_BUTTON(tool_item), label);
@@ -515,16 +478,14 @@ tm_set_tool_item_label(GtkToolItem *tool_item,
     gtk_tool_item_set_is_important(tool_item,
                                    toolbar_buttons[button].is_important);
 
-    if ((strcmp(toolbar_buttons[button].pixmap_id, BALSA_PIXMAP_SEND) == 0)
-        && balsa_app.always_queue_sent_mail) {
+    if (strcmp(toolbar_buttons[button].pixmap_id, BALSA_PIXMAP_SEND) == 0
+        && balsa_app.always_queue_sent_mail)
         gtk_tool_item_set_tooltip_text(tool_item,
                                        _("Queue this message for sending"));
-    }
 
     return button;
 }
 
-
 static GtkToolbarStyle tm_default_style(void);
 
 static const struct {
@@ -532,11 +493,11 @@ static const struct {
     const gchar *config_name;
     GtkToolbarStyle style;
 } tm_toolbar_options[] = {
-    {N_("Text Be_low Icons"), "both", GTK_TOOLBAR_BOTH},
+    {N_("Text Be_low Icons"),           "both",       GTK_TOOLBAR_BOTH},
     {N_("Priority Text Be_side Icons"), "both-horiz", GTK_TOOLBAR_BOTH_HORIZ},
-    {NULL, "both_horiz", GTK_TOOLBAR_BOTH_HORIZ},
-    {N_("_Icons Only"), "icons", GTK_TOOLBAR_ICONS},
-    {N_("_Text Only"), "text", GTK_TOOLBAR_TEXT}
+    {NULL,                              "both_horiz", GTK_TOOLBAR_BOTH_HORIZ},
+    {N_("_Icons Only"),                 "icons",      GTK_TOOLBAR_ICONS},
+    {N_("_Text Only"),                  "text",       GTK_TOOLBAR_TEXT}
 };
 
 static GtkToolbarStyle
@@ -548,16 +509,15 @@ tm_default_style(void)
 
     /* Get global setting */
     settings = g_settings_new("org.gnome.desktop.interface");
-    str = g_settings_get_string(settings, "toolbar-style");
+    str  = g_settings_get_string(settings, "toolbar-style");
     if (str) {
         guint i;
 
-        for (i = 0; i < G_N_ELEMENTS(tm_toolbar_options); i++) {
+        for (i = 0; i < G_N_ELEMENTS(tm_toolbar_options); i++)
             if (strcmp(tm_toolbar_options[i].config_name, str) == 0) {
                 default_style = tm_toolbar_options[i].style;
                 break;
             }
-        }
         g_free(str);
     }
     g_object_unref(settings);
@@ -565,13 +525,11 @@ tm_default_style(void)
     return default_style;
 }
 
-
 /* Populate a model
  */
 #define BALSA_TOOLBAR_ACTION_MAP "balsa-toolbar-action-map"
 static void
-tm_populate(GtkWidget         *toolbar,
-            BalsaToolbarModel *model)
+tm_populate(GtkWidget * toolbar, BalsaToolbarModel * model)
 {
     gboolean style_is_both;
     gboolean make_two_line;
@@ -629,50 +587,42 @@ tm_populate(GtkWidget         *toolbar,
                           model->style : tm_default_style());
 }
 
-
 /* Update a real toolbar when the model has changed.
  */
 static void
-tm_changed_cb(BalsaToolbarModel *model,
-              GtkWidget         *toolbar)
+tm_changed_cb(BalsaToolbarModel * model, GtkWidget * toolbar)
 {
     balsa_toolbar_remove_all(toolbar);
     tm_populate(toolbar, model);
     tm_save_model(model);
 }
 
-
 typedef struct {
     BalsaToolbarModel *model;
-    GtkWidget *menu;
+    GtkWidget         *menu;
 } toolbar_info;
 
 static void
-tm_toolbar_weak_notify(toolbar_info *info,
-                       GtkWidget    *toolbar)
+tm_toolbar_weak_notify(toolbar_info * info, GtkWidget * toolbar)
 {
     g_signal_handlers_disconnect_by_data(info->model, toolbar);
     g_free(info);
 }
 
-
 #define BALSA_TOOLBAR_STYLE "balsa-toolbar-style"
 static void
-menu_item_toggled_cb(GtkCheckMenuItem *item,
-                     toolbar_info     *info)
+menu_item_toggled_cb(GtkCheckMenuItem * item, toolbar_info * info)
 {
     if (gtk_check_menu_item_get_active(item)) {
         info->model->style =
             GPOINTER_TO_INT(g_object_get_data
-                                (G_OBJECT(item), BALSA_TOOLBAR_STYLE));
+                            (G_OBJECT(item), BALSA_TOOLBAR_STYLE));
         balsa_toolbar_model_changed(info->model);
-        if (info->menu) {
+        if (info->menu)
             gtk_menu_shell_deactivate(GTK_MENU_SHELL(info->menu));
-        }
     }
 }
 
-
 /* We want to destroy the popup menu after handling the "toggled"
  * signal; the "deactivate" signal is apparently emitted before
  * "toggled", so we have to use an idle callback. */
@@ -683,10 +633,8 @@ tm_popup_idle_cb(GtkWidget *menu)
     return FALSE;
 }
 
-
 static void
-tm_popup_deactivated_cb(GtkWidget    *menu,
-                        toolbar_info *info)
+tm_popup_deactivated_cb(GtkWidget * menu, toolbar_info * info)
 {
     if (info->menu) {
         g_idle_add((GSourceFunc) tm_popup_idle_cb, menu);
@@ -694,29 +642,25 @@ tm_popup_deactivated_cb(GtkWidget    *menu,
     }
 }
 
-
 static gchar *
-tm_remove_underscore(const gchar *text)
+tm_remove_underscore(const gchar * text)
 {
     gchar *p, *q, *r = g_strdup(text);
 
-    for (p = q = r; *p; p++) {
-        if (*p != '_') {
+    for (p = q = r; *p; p++)
+        if (*p != '_')
             *q++ = *p;
-        }
-    }
     *q = '\0';
 
     return r;
 }
 
-
 static gboolean
-tm_popup_context_menu_cb(GtkWidget    *toolbar,
-                         gint          x,
-                         gint          y,
-                         gint          button,
-                         toolbar_info *info)
+tm_popup_context_menu_cb(GtkWidget    * toolbar,
+                         gint           x,
+                         gint           y,
+                         gint           button,
+                         toolbar_info * info)
 {
     GtkWidget *menu;
     guint i;
@@ -724,9 +668,8 @@ tm_popup_context_menu_cb(GtkWidget    *toolbar,
     GtkToolbarStyle default_style;
     GdkEvent *event;
 
-    if (info->menu != NULL) {
+    if (info->menu != NULL)
         return FALSE;
-    }
 
     info->menu = menu = gtk_menu_new();
     g_signal_connect(menu, "deactivate",
@@ -736,9 +679,8 @@ tm_popup_context_menu_cb(GtkWidget    *toolbar,
     for (i = 0; i < G_N_ELEMENTS(tm_toolbar_options); i++) {
         GtkWidget *item;
 
-        if (!tm_toolbar_options[i].text) {
+        if (!tm_toolbar_options[i].text)
             continue;
-        }
 
         item =
             gtk_radio_menu_item_new_with_mnemonic(group,
@@ -746,10 +688,9 @@ tm_popup_context_menu_cb(GtkWidget    *toolbar,
                                                     text));
         group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(item));
 
-        if (tm_toolbar_options[i].style == info->model->style) {
+        if (tm_toolbar_options[i].style == info->model->style)
             gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
                                            TRUE);
-        }
 
         gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
         g_object_set_data(G_OBJECT(item), BALSA_TOOLBAR_STYLE,
@@ -762,9 +703,8 @@ tm_popup_context_menu_cb(GtkWidget    *toolbar,
 
     for (i = 0; i < G_N_ELEMENTS(tm_toolbar_options); i++) {
 
-        if (!tm_toolbar_options[i].text) {
+        if (!tm_toolbar_options[i].text)
             continue;
-        }
 
         if (tm_toolbar_options[i].style == default_style) {
             gchar *option_text, *text;
@@ -783,10 +723,9 @@ tm_popup_context_menu_cb(GtkWidget    *toolbar,
             item = gtk_radio_menu_item_new_with_mnemonic(group, text);
             g_free(text);
 
-            if (info->model->style == (GtkToolbarStyle) (-1)) {
+            if (info->model->style == (GtkToolbarStyle) (-1))
                 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
-                                                   (item), TRUE);
-            }
+                                               (item), TRUE);
             gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
             g_object_set_data(G_OBJECT(item), BALSA_TOOLBAR_STYLE,
                               GINT_TO_POINTER(-1));
@@ -817,7 +756,7 @@ tm_popup_context_menu_cb(GtkWidget    *toolbar,
     gtk_menu_attach_to_widget(GTK_MENU(menu), toolbar, NULL);
 
     event = gtk_get_current_event();
-    if ((event != NULL) && (gdk_event_get_event_type(event) == GDK_BUTTON_PRESS)) {
+    if (event != NULL && gdk_event_get_event_type(event) == GDK_BUTTON_PRESS) {
         gtk_menu_popup_at_pointer(GTK_MENU(menu), event);
     } else {
         gtk_menu_popup_at_widget(GTK_MENU(menu),
@@ -827,17 +766,14 @@ tm_popup_context_menu_cb(GtkWidget    *toolbar,
                                  NULL);
     }
 
-    if (event != NULL) {
+    if (event != NULL)
         gdk_event_free(event);
-    }
 
     return TRUE;
 }
 
-
-GtkWidget *
-balsa_toolbar_new(BalsaToolbarModel *model,
-                  GActionMap        *action_map)
+GtkWidget *balsa_toolbar_new(BalsaToolbarModel * model,
+                             GActionMap        * action_map)
 {
     toolbar_info *info;
     GtkWidget *toolbar;
diff --git a/src/toolbar-factory.h b/src/toolbar-factory.h
index a65e41f..2831abf 100644
--- a/src/toolbar-factory.h
+++ b/src/toolbar-factory.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -44,8 +44,7 @@ typedef struct BalsaToolbarModelClass_ BalsaToolbarModelClass;
 struct BalsaToolbarModelClass_ {
     GObjectClass parent_class;
 };
-typedef void (*BalsaToolbarFunc) (GtkWidget *,
-                                  gpointer);
+typedef void (*BalsaToolbarFunc) (GtkWidget *, gpointer);
 #define BALSA_TOOLBAR_FUNC(f) ((BalsaToolbarFunc) (f))
 
 typedef struct t_button_data {
@@ -72,28 +71,28 @@ void update_all_toolbars(void);
 
 /* toolbar code for gtk+-2 */
 const gchar *balsa_toolbar_button_text(gint button);
-const gchar *balsa_toolbar_sanitize_id(const gchar *id);
+const gchar *balsa_toolbar_sanitize_id(const gchar * id);
 
 /* BalsaToolbarModel */
-BalsaToolbarModel *balsa_toolbar_model_new(BalsaToolbarType         type,
-                                           const BalsaToolbarEntry *entries,
-                                           guint                    n_entries);
-void balsa_toolbar_model_add_entries(BalsaToolbarModel       *model,
-                                     const BalsaToolbarEntry *entries,
-                                     guint                    n_entries);
-GHashTable *balsa_toolbar_model_get_legal(BalsaToolbarModel *model);
-GArray *balsa_toolbar_model_get_current(BalsaToolbarModel *model);
-gboolean balsa_toolbar_model_is_standard(BalsaToolbarModel *model);
-void balsa_toolbar_model_insert_icon(BalsaToolbarModel *model,
-                                     gchar             *icon,
-                                     gint               position);
-void balsa_toolbar_model_delete_icon(BalsaToolbarModel *model,
-                                     gchar             *icon);
-void balsa_toolbar_model_clear(BalsaToolbarModel *model);
-void balsa_toolbar_model_changed(BalsaToolbarModel *model);
+BalsaToolbarModel *
+    balsa_toolbar_model_new(BalsaToolbarType          type,
+                            const BalsaToolbarEntry * entries,
+                            guint                     n_entries);
+void balsa_toolbar_model_add_entries(BalsaToolbarModel       * model,
+                                     const BalsaToolbarEntry * entries,
+                                     guint                     n_entries);
+GHashTable *balsa_toolbar_model_get_legal(BalsaToolbarModel * model);
+GArray *balsa_toolbar_model_get_current(BalsaToolbarModel * model);
+gboolean balsa_toolbar_model_is_standard(BalsaToolbarModel * model);
+void balsa_toolbar_model_insert_icon(BalsaToolbarModel * model,
+                                     gchar * icon, gint position);
+void balsa_toolbar_model_delete_icon(BalsaToolbarModel * model,
+                                     gchar * icon);
+void balsa_toolbar_model_clear(BalsaToolbarModel * model);
+void balsa_toolbar_model_changed(BalsaToolbarModel * model);
 
 /* BalsaToolbar */
-GtkWidget *balsa_toolbar_new(BalsaToolbarModel *model,
-                             GActionMap        *map);
+GtkWidget *balsa_toolbar_new(BalsaToolbarModel * model,
+                             GActionMap        * map);
 
 #endif
diff --git a/src/toolbar-prefs.c b/src/toolbar-prefs.c
index 2559d95..ecfd3f2 100644
--- a/src/toolbar-prefs.c
+++ b/src/toolbar-prefs.c
@@ -18,7 +18,7 @@
  */
 
 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#   include "config.h"
+# include "config.h"
 #endif                          /* HAVE_CONFIG_H */
 #include "toolbar-prefs.h"
 
@@ -33,11 +33,11 @@
 #include "toolbar-factory.h"
 
 #if HAVE_MACOSX_DESKTOP
-#   include "macosx-helpers.h"
+#  include "macosx-helpers.h"
 #endif
 
 #ifndef MAX
-#   define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
 #endif
 
 /* Uncomment the next line to check for invalid action names */
@@ -68,67 +68,52 @@ struct ToolbarPage_ {
 };
 
 /* Callbacks. */
-static void tp_dialog_response_cb(GtkDialog *dialog,
-                                  gint       response,
-                                  gpointer   data);
-static void add_button_cb(GtkWidget *,
-                          ToolbarPage *page);
-static void remove_button_cb(GtkWidget *,
-                             ToolbarPage *page);
-static void back_button_cb(GtkWidget *,
-                           ToolbarPage *page);
-static void forward_button_cb(GtkWidget *,
-                              ToolbarPage *page);
-static void wrap_toggled_cb(GtkWidget   *widget,
-                            GtkNotebook *notebook);
-static void available_selection_changed_cb(GtkTreeSelection *selection,
-                                           ToolbarPage      *page);
-static void current_selection_changed_cb(GtkTreeSelection *selection,
-                                         ToolbarPage      *page);
-static void available_row_activated_cb(GtkTreeView *treeview,
-                                       GtkTreeIter *arg1,
-                                       GtkTreePath *arg2,
-                                       ToolbarPage *page);
-static void current_row_activated_cb(GtkTreeView *treeview,
-                                     GtkTreeIter *arg1,
-                                     GtkTreePath *arg2,
-                                     ToolbarPage *page);
+static void tp_dialog_response_cb(GtkDialog * dialog, gint response,
+                                  gpointer data);
+static void add_button_cb(GtkWidget *, ToolbarPage * page);
+static void remove_button_cb(GtkWidget *, ToolbarPage * page);
+static void back_button_cb(GtkWidget *, ToolbarPage * page);
+static void forward_button_cb(GtkWidget *, ToolbarPage * page);
+static void wrap_toggled_cb(GtkWidget * widget, GtkNotebook * notebook);
+static void available_selection_changed_cb(GtkTreeSelection * selection,
+                                           ToolbarPage * page);
+static void current_selection_changed_cb(GtkTreeSelection * selection,
+                                         ToolbarPage * page);
+static void available_row_activated_cb(GtkTreeView * treeview,
+                                       GtkTreeIter * arg1,
+                                       GtkTreePath * arg2,
+                                       ToolbarPage * page);
+static void current_row_activated_cb(GtkTreeView * treeview,
+                                     GtkTreeIter * arg1,
+                                     GtkTreePath * arg2,
+                                     ToolbarPage * page);
 
 /* Helpers. */
-static GtkWidget *create_toolbar_page(BalsaToolbarModel *model,
-                                      GActionMap        *map);
+static GtkWidget *create_toolbar_page(BalsaToolbarModel * model,
+                                      GActionMap        * map);
 static GtkWidget *tp_list_new(void);
-static gboolean tp_list_iter_is_first(GtkWidget   *list,
-                                      GtkTreeIter *iter);
-static gboolean tp_list_iter_is_last(GtkWidget   *list,
-                                     GtkTreeIter *iter);
-
+static gboolean tp_list_iter_is_first(GtkWidget * list, GtkTreeIter * iter);
+static gboolean tp_list_iter_is_last(GtkWidget * list, GtkTreeIter * iter);
 #ifndef BALSA_TOOLBAR_DEBUG_ACTIONS
-static void tp_page_refresh_available(ToolbarPage *page);
-
+static void tp_page_refresh_available(ToolbarPage * page);
 #else /* BALSA_TOOLBAR_DEBUG_ACTIONS */
-static void tp_page_refresh_available(ToolbarPage *page,
-                                      GActionMap  *map);
-
+static void tp_page_refresh_available(ToolbarPage * page, GActionMap * map);
 #endif /* BALSA_TOOLBAR_DEBUG_ACTIONS */
-static void tp_page_refresh_current(ToolbarPage *page);
-static void tp_page_refresh_preview(ToolbarPage *page);
-static void tp_page_swap_rows(ToolbarPage *page,
-                              gboolean     forward);
-static void tp_page_add_selected(ToolbarPage *page);
-static void tp_page_remove_selected(ToolbarPage *page);
-static void tp_store_set(GtkListStore *store,
-                         GtkTreeIter  *iter,
-                         gint          item);
-static void replace_nl_with_space(char *str);
+static void tp_page_refresh_current(ToolbarPage * page);
+static void tp_page_refresh_preview(ToolbarPage * page);
+static void tp_page_swap_rows(ToolbarPage * page, gboolean forward);
+static void tp_page_add_selected(ToolbarPage * page);
+static void tp_page_remove_selected(ToolbarPage * page);
+static void tp_store_set(GtkListStore * store, GtkTreeIter * iter,
+                         gint item);
+static void replace_nl_with_space(char* str);
 
 /* Public methods. */
 
 /* create the toolbar-customization dialog
  */
 void
-customize_dialog_cb(GtkWidget *widget,
-                    gpointer   data)
+customize_dialog_cb(GtkWidget * widget, gpointer data)
 {
     GtkWidget *notebook;
     GtkWidget *child;
@@ -136,7 +121,7 @@ customize_dialog_cb(GtkWidget *widget,
     GtkWidget *option_box;
     GtkWidget *wrap_button;
     GtkWidget *active_window = data;
-    BalsaToolbarType type;
+    BalsaToolbarType   type;
     BalsaToolbarModel *model;
     GSimpleActionGroup *group;
     GtkWidget *content_area;
@@ -153,7 +138,7 @@ customize_dialog_cb(GtkWidget *widget,
                                     GTK_DIALOG_DESTROY_WITH_PARENT |
                                     libbalsa_dialog_flags(),
                                     _("_Close"), GTK_RESPONSE_CLOSE,
-                                    _("_Help"), GTK_RESPONSE_HELP,
+                                    _("_Help"),  GTK_RESPONSE_HELP,
                                     NULL);
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(customize_widget, GTK_WINDOW(active_window));
@@ -229,15 +214,14 @@ customize_dialog_cb(GtkWidget *widget,
      * corresponding to the toolbar that the user clicked on. */
     type =
         GPOINTER_TO_INT(g_object_get_data
-                            (G_OBJECT(widget), BALSA_TOOLBAR_MODEL_TYPE));
+                        (G_OBJECT(widget), BALSA_TOOLBAR_MODEL_TYPE));
     gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), type);
 }
 
-
 /* get_toolbar_button_index:
    id - button id
    returns -1 on failure.
- */
+*/
 int
 get_toolbar_button_index(const char *id)
 {
@@ -245,23 +229,20 @@ get_toolbar_button_index(const char *id)
 
     g_return_val_if_fail(id, -1);
 
-    for (i = 0; i < toolbar_button_count; i++) {
-        if (!strcmp(id, toolbar_buttons[i].pixmap_id)) {
-            return i;
-        }
+    for(i=0; i<toolbar_button_count; i++) {
+       if(!strcmp(id, toolbar_buttons[i].pixmap_id))
+           return i;
     }
     return -1;
 }
 
-
 /* Callbacks. */
 
 #define BALSA_KEY_TOOLBAR_PAGE "balsa-toolbar-page"
 
 /* Callback for the wrap_buttons' "toggled" signal. */
 static void
-wrap_toggled_cb(GtkWidget   *widget,
-                GtkNotebook *notebook)
+wrap_toggled_cb(GtkWidget * widget, GtkNotebook * notebook)
 {
     gint i;
     GtkWidget *child;
@@ -272,53 +253,42 @@ wrap_toggled_cb(GtkWidget   *widget,
 
     for (i = 0; (child = gtk_notebook_get_nth_page(notebook, i)); i++) {
         page = g_object_get_data(G_OBJECT(child), BALSA_KEY_TOOLBAR_PAGE);
-        if (page) {
+        if (page)
             balsa_toolbar_model_changed(page->model);
-        }
     }
 }
 
-
 /* Button callbacks: each makes the appropriate change to the
  * page->current GtkTreeView, then refreshes the page's
  * BalsaToolbarModel and GtkToolbar; add_button_cb and remove_button_cb
  * also refresh the page's available GtkTreeView.
  */
 static void
-back_button_cb(GtkWidget   *widget,
-               ToolbarPage *page)
+back_button_cb(GtkWidget * widget, ToolbarPage * page)
 {
     tp_page_swap_rows(page, FALSE);
 }
 
-
 static void
-forward_button_cb(GtkWidget   *widget,
-                  ToolbarPage *page)
+forward_button_cb(GtkWidget * widget, ToolbarPage * page)
 {
     tp_page_swap_rows(page, TRUE);
 }
 
-
 static void
-add_button_cb(GtkWidget   *widget,
-              ToolbarPage *page)
+add_button_cb(GtkWidget *widget, ToolbarPage * page)
 {
     tp_page_add_selected(page);
 }
 
-
 static void
-remove_button_cb(GtkWidget   *widget,
-                 ToolbarPage *page)
+remove_button_cb(GtkWidget *widget, ToolbarPage * page)
 {
     tp_page_remove_selected(page);
 }
 
-
 static void
-standard_button_cb(GtkWidget   *widget,
-                   ToolbarPage *page)
+standard_button_cb(GtkWidget *widget, ToolbarPage * page)
 {
     balsa_toolbar_model_clear(page->model);
     gtk_widget_set_sensitive(page->standard_button, FALSE);
@@ -331,54 +301,43 @@ standard_button_cb(GtkWidget   *widget,
     balsa_toolbar_model_changed(page->model);
 }
 
-
 static void
-style_button_cb(GtkWidget   *widget,
-                ToolbarPage *page)
+style_button_cb(GtkWidget *widget, ToolbarPage * page)
 {
     gboolean handled;
 
     g_signal_emit_by_name(page->toolbar, "popup-menu", &handled);
 }
 
-
 /* Callback for the "row-activated" signal for the available list. */
 static void
-available_row_activated_cb(GtkTreeView *treeview,
-                           GtkTreeIter *arg1,
-                           GtkTreePath *arg2,
-                           ToolbarPage *page)
+available_row_activated_cb(GtkTreeView * treeview, GtkTreeIter * arg1,
+                        GtkTreePath * arg2, ToolbarPage * page)
 {
     tp_page_add_selected(page);
 }
 
-
 /* Callback for the selection "changed" signal for the available list. */
 static void
-available_selection_changed_cb(GtkTreeSelection *selection,
-                               ToolbarPage      *page)
+available_selection_changed_cb(GtkTreeSelection * selection,
+                            ToolbarPage * page)
 {
     gtk_widget_set_sensitive(page->add_button,
                              gtk_tree_selection_get_selected(selection,
                                                              NULL, NULL));
 }
 
-
 /* Callback for the "row-activated" signal for the current list. */
 static void
-current_row_activated_cb(GtkTreeView *treeview,
-                         GtkTreeIter *arg1,
-                         GtkTreePath *arg2,
-                         ToolbarPage *page)
+current_row_activated_cb(GtkTreeView * treeview, GtkTreeIter * arg1,
+                      GtkTreePath * arg2, ToolbarPage * page)
 {
     tp_page_remove_selected(page);
 }
 
-
 /* Callback for the selection "changed" signal for the destination list. */
 static void
-current_selection_changed_cb(GtkTreeSelection *selection,
-                             ToolbarPage      *page)
+current_selection_changed_cb(GtkTreeSelection * selection, ToolbarPage * page)
 {
     GtkTreeModel *model;
     GtkTreeIter iter;
@@ -400,12 +359,9 @@ current_selection_changed_cb(GtkTreeSelection *selection,
     gtk_widget_set_sensitive(page->forward_button, forward);
 }
 
-
 /* Callback for the "response" signal of the dialog. */
 static void
-tp_dialog_response_cb(GtkDialog *dialog,
-                      gint       response,
-                      gpointer   data)
+tp_dialog_response_cb(GtkDialog * dialog, gint response, gpointer data)
 {
     GError *err = NULL;
 
@@ -414,31 +370,27 @@ tp_dialog_response_cb(GtkDialog *dialog,
     case GTK_RESPONSE_CLOSE:
         gtk_widget_destroy(GTK_WIDGET(dialog));
         break;
-
     case GTK_RESPONSE_HELP:
         gtk_show_uri_on_window(GTK_WINDOW(dialog), "help:balsa/toolbar-prefs",
                                gtk_get_current_event_time(), &err);
         if (err) {
             balsa_information(LIBBALSA_INFORMATION_WARNING,
-                              _("Error displaying toolbar help: %s\n"),
-                              err->message);
+                   _("Error displaying toolbar help: %s\n"),
+                   err->message);
             g_error_free(err);
         }
         break;
-
     default:
         break;
     }
 }
 
-
 /* Helpers. */
 
 /* Create a page for the main notebook.
  */
-static GtkWidget *
-create_toolbar_page(BalsaToolbarModel *model,
-                    GActionMap        *map)
+static GtkWidget*
+create_toolbar_page(BalsaToolbarModel * model, GActionMap * map)
 {
     GtkWidget *outer_box;
     GtkWidget *toolbar_frame, *toolbar_scroll;
@@ -454,16 +406,16 @@ create_toolbar_page(BalsaToolbarModel *model,
     page->model = model;
 
     /* The "window itself" */
-    outer_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+    outer_box=gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
     g_object_set_data_full(G_OBJECT(outer_box), BALSA_KEY_TOOLBAR_PAGE,
                            page, g_free);
 
     /* Preview display */
-    toolbar_frame = gtk_frame_new(_("Preview"));
+    toolbar_frame=gtk_frame_new(_("Preview"));
     g_object_set((GObject *) toolbar_frame, "margin", 5, NULL);
     gtk_box_pack_start(GTK_BOX(outer_box), toolbar_frame);
 
-    toolbar_ctlbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
+    toolbar_ctlbox=gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
     g_object_set(G_OBJECT(toolbar_ctlbox), "margin", 5, NULL);
     gtk_container_add(GTK_CONTAINER(toolbar_frame), toolbar_ctlbox);
 
@@ -472,9 +424,9 @@ create_toolbar_page(BalsaToolbarModel *model,
     gtk_widget_set_sensitive(page->toolbar, FALSE);
 
     /* embedded in a scrolled_window */
-    toolbar_scroll = gtk_scrolled_window_new(NULL, NULL);
+    toolbar_scroll=gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(toolbar_scroll),
-                                   GTK_POLICY_AUTOMATIC,
+                                  GTK_POLICY_AUTOMATIC,
                                    GTK_POLICY_NEVER);
 
     g_object_set(G_OBJECT(toolbar_scroll), "margin", 5, NULL);
@@ -500,19 +452,19 @@ create_toolbar_page(BalsaToolbarModel *model,
     /* Done with preview */
 
     /* Box for lower half of window */
-    lower_ctlbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
+    lower_ctlbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
     g_object_set(G_OBJECT(lower_ctlbox), "margin", 5, NULL);
 
     gtk_widget_set_vexpand(lower_ctlbox, TRUE);
     gtk_box_pack_start(GTK_BOX(outer_box), lower_ctlbox);
 
     /* A list to show the available items */
-    list_scroll = gtk_scrolled_window_new(NULL, NULL);
+    list_scroll=gtk_scrolled_window_new(NULL, NULL);
 
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(list_scroll),
-                                   GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+                                  GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
 
-    list_frame = gtk_frame_new(_("Available buttons"));
+    list_frame=gtk_frame_new(_("Available buttons"));
     page->available = tp_list_new();
 
     gtk_widget_set_hexpand(list_frame, TRUE);
@@ -523,12 +475,12 @@ create_toolbar_page(BalsaToolbarModel *model,
     /* Done with available list */
 
     /* Another list to show the current tools */
-    destination_scroll = gtk_scrolled_window_new(NULL, NULL);
+    destination_scroll=gtk_scrolled_window_new(NULL, NULL);
 
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(destination_scroll),
-                                   GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+                                  GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
 
-    destination_frame = gtk_frame_new(_("Current toolbar"));
+    destination_frame=gtk_frame_new(_("Current toolbar"));
     page->current = tp_list_new();
 
     /* Done with destination list */
@@ -537,7 +489,7 @@ create_toolbar_page(BalsaToolbarModel *model,
     center_button_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
     gtk_box_set_homogeneous(GTK_BOX(center_button_box), TRUE);
 
-    button_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+    button_box=gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
 
     gtk_box_pack_start(GTK_BOX(lower_ctlbox), center_button_box);
 
@@ -548,7 +500,7 @@ create_toolbar_page(BalsaToolbarModel *model,
                                 _("Move selected item up"));
     gtk_box_pack_start(GTK_BOX(button_box), page->back_button);
 
-    move_button_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+    move_button_box=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
     gtk_box_pack_start(GTK_BOX(button_box), move_button_box);
 
     page->remove_button = gtk_button_new_from_icon_name("go-previous-symbolic");
@@ -577,27 +529,27 @@ create_toolbar_page(BalsaToolbarModel *model,
                      G_CALLBACK(available_row_activated_cb), page);
     selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(page->available));
     g_signal_connect(G_OBJECT(selection), "changed",
-                     G_CALLBACK(available_selection_changed_cb), page);
+                      G_CALLBACK(available_selection_changed_cb), page);
 
     g_signal_connect(G_OBJECT(page->current), "row-activated",
                      G_CALLBACK(current_row_activated_cb), page);
     selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(page->current));
     g_signal_connect(G_OBJECT(selection), "changed",
-                     G_CALLBACK(current_selection_changed_cb), page);
+                      G_CALLBACK(current_selection_changed_cb), page);
 
     g_signal_connect(G_OBJECT(page->add_button), "clicked",
-                     G_CALLBACK(add_button_cb), page);
+                      G_CALLBACK(add_button_cb), page);
     g_signal_connect(G_OBJECT(page->remove_button), "clicked",
-                     G_CALLBACK(remove_button_cb), page);
+                      G_CALLBACK(remove_button_cb), page);
     g_signal_connect(G_OBJECT(page->forward_button), "clicked",
-                     G_CALLBACK(forward_button_cb), page);
+                      G_CALLBACK(forward_button_cb), page);
     g_signal_connect(G_OBJECT(page->back_button), "clicked",
-                     G_CALLBACK(back_button_cb), page);
+                      G_CALLBACK(back_button_cb), page);
 
     g_signal_connect(G_OBJECT(page->standard_button), "clicked",
-                     G_CALLBACK(standard_button_cb), page);
+                      G_CALLBACK(standard_button_cb), page);
     g_signal_connect(G_OBJECT(style_button), "clicked",
-                     G_CALLBACK(style_button_cb), page);
+                      G_CALLBACK(style_button_cb), page);
 
     gtk_widget_set_sensitive(page->add_button, FALSE);
     gtk_widget_set_sensitive(page->remove_button, FALSE);
@@ -616,27 +568,23 @@ create_toolbar_page(BalsaToolbarModel *model,
     return outer_box;
 }
 
-
 /* Refresh the page's available GtkTreeView.
  */
 static gboolean
-tp_find_icon(GArray      *array,
-             const gchar *icon)
+tp_find_icon(GArray * array, const gchar * icon)
 {
     guint j;
 
     for (j = 0; j < array->len; j++) {
-        if (strcmp(icon, g_array_index(array, BalsaToolbarEntry, j).icon) == 0) {
+        if (strcmp(icon, g_array_index(array, BalsaToolbarEntry, j).icon) == 0)
             return TRUE;
-        }
     }
     return FALSE;
 }
 
-
 static void
 #ifndef BALSA_TOOLBAR_DEBUG_ACTIONS
-tp_page_refresh_available(ToolbarPage *page)
+tp_page_refresh_available(ToolbarPage * page)
 #else /* BALSA_TOOLBAR_DEBUG_ACTIONS */
 tp_page_refresh_available(ToolbarPage * page, GActionMap * map)
 #endif /* BALSA_TOOLBAR_DEBUG_ACTIONS */
@@ -651,9 +599,9 @@ tp_page_refresh_available(ToolbarPage * page, GActionMap * map)
     int item;
 
     /* save currently selected path, or point path to the first row */
-    if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
+    if (gtk_tree_selection_get_selected(selection, &model, &iter))
         path = gtk_tree_model_get_path(model, &iter);
-    } else {
+    else {
         path = gtk_tree_path_new();
         gtk_tree_path_down(path);
     }
@@ -666,18 +614,16 @@ tp_page_refresh_available(ToolbarPage * page, GActionMap * map)
                 gchar *action;
 
                 action = g_hash_table_lookup(legal, toolbar_buttons[item].pixmap_id);
-                if (action && !g_action_map_lookup_action(map, action)) {
+                if (action && !g_action_map_lookup_action(map, action))
                     g_print("undefined action: “%s”\n", action);
-                }
             }
         }
 #endif /* BALSA_TOOLBAR_DEBUG_ACTIONS */
-        if ((item > 0)
+        if (item > 0
             && (!g_hash_table_lookup(legal,
                                      toolbar_buttons[item].pixmap_id)
-                || tp_find_icon(current, toolbar_buttons[item].pixmap_id))) {
+                || tp_find_icon(current, toolbar_buttons[item].pixmap_id)))
             continue;
-        }
 
         gtk_list_store_append(GTK_LIST_STORE(model), &iter);
         tp_store_set(GTK_LIST_STORE(model), &iter, item);
@@ -695,7 +641,7 @@ tp_page_refresh_available(ToolbarPage * page, GActionMap * map)
 /* Refresh the page's current GtkTreeView.
  */
 static void
-tp_page_refresh_current(ToolbarPage *page)
+tp_page_refresh_current(ToolbarPage * page)
 {
     GtkTreeSelection *selection =
         gtk_tree_view_get_selection(GTK_TREE_VIEW(page->current));
@@ -707,9 +653,9 @@ tp_page_refresh_current(ToolbarPage *page)
     guint j;
 
     /* save currently selected path, or point path to the first row */
-    if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
+    if (gtk_tree_selection_get_selected(selection, &model, &iter))
         path = gtk_tree_model_get_path(model, &iter);
-    } else {
+    else {
         path = gtk_tree_path_new();
         gtk_tree_path_down(path);
     }
@@ -722,9 +668,8 @@ tp_page_refresh_current(ToolbarPage *page)
         entry = &g_array_index(current, BalsaToolbarEntry, j);
         item = get_toolbar_button_index(entry->icon);
 
-        if (item < 0) {
+        if (item < 0)
             continue;
-        }
 
         gtk_list_store_append(GTK_LIST_STORE(model), &iter);
         tp_store_set(GTK_LIST_STORE(model), &iter, item);
@@ -739,11 +684,10 @@ tp_page_refresh_current(ToolbarPage *page)
     gtk_tree_path_free(path);
 }
 
-
 /* Refresh a page after its destination TreeView has changed.
  */
 static void
-tp_page_refresh_preview(ToolbarPage *page)
+tp_page_refresh_preview(ToolbarPage * page)
 {
     GtkTreeModel *model =
         gtk_tree_view_get_model(GTK_TREE_VIEW(page->current));
@@ -757,15 +701,13 @@ tp_page_refresh_preview(ToolbarPage *page)
         gint item;
 
         gtk_tree_model_get(model, &iter, TP_ITEM_COLUMN, &item, -1);
-        if ((item >= 0) && (item < toolbar_button_count)) {
+        if (item >= 0 && item < toolbar_button_count)
             balsa_toolbar_model_insert_icon(page->model,
                                             toolbar_buttons[item].pixmap_id,
                                             -1);
-        }
     }
 }
 
-
 /* Create a GtkTreeView for an icon list.
  */
 static GtkWidget *
@@ -782,7 +724,7 @@ tp_list_new(void)
                                     G_TYPE_INT       /* TP_ITEM_COLUMN */
                                     );
     view = GTK_TREE_VIEW(gtk_tree_view_new_with_model
-                             (GTK_TREE_MODEL(list_store)));
+                         (GTK_TREE_MODEL(list_store)));
     g_object_unref(list_store);
 
     renderer = gtk_cell_renderer_text_new();
@@ -801,12 +743,10 @@ tp_list_new(void)
     return GTK_WIDGET(view);
 }
 
-
 /* Test whether the iter addresses the first row.
  */
 static gboolean
-tp_list_iter_is_first(GtkWidget   *list,
-                      GtkTreeIter *iter)
+tp_list_iter_is_first(GtkWidget * list, GtkTreeIter * iter)
 {
     GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list));
     GtkTreePath *path = gtk_tree_model_get_path(model, iter);
@@ -815,25 +755,21 @@ tp_list_iter_is_first(GtkWidget   *list,
     return ret_val;
 }
 
-
 /* Test whether the iter addresses the last row.
  */
 static gboolean
-tp_list_iter_is_last(GtkWidget   *list,
-                     GtkTreeIter *iter)
+tp_list_iter_is_last(GtkWidget * list, GtkTreeIter * iter)
 {
     GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list));
     GtkTreeIter tmp_iter = *iter;
     return !gtk_tree_model_iter_next(model, &tmp_iter);
 }
 
-
 /* Swap the currently selected row in page->current
  * with the next or previous row.
  */
 static void
-tp_page_swap_rows(ToolbarPage *page,
-                  gboolean     forward)
+tp_page_swap_rows(ToolbarPage * page, gboolean forward)
 {
     GtkTreeModel *model =
         gtk_tree_view_get_model(GTK_TREE_VIEW(page->current));
@@ -845,15 +781,13 @@ tp_page_swap_rows(ToolbarPage *page,
 
     selection =
         gtk_tree_view_get_selection(GTK_TREE_VIEW(page->current));
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
         return;
-    }
 
     if (forward) {
         tmp_iter = iter;
-        if (!gtk_tree_model_iter_next(model, &tmp_iter)) {
+        if (!gtk_tree_model_iter_next(model, &tmp_iter))
             return;
-        }
         tmp_path = gtk_tree_model_get_path(model, &tmp_iter);
     } else {
         tmp_path = gtk_tree_model_get_path(model, &iter);
@@ -879,13 +813,10 @@ tp_page_swap_rows(ToolbarPage *page,
     balsa_toolbar_model_changed(page->model);
 }
 
-
 /* Add an item to a GtkTreeView's GtkListStore.
  */
 static void
-tp_store_set(GtkListStore *store,
-             GtkTreeIter  *iter,
-             gint          item)
+tp_store_set(GtkListStore * store, GtkTreeIter * iter, gint item)
 {
     GdkPixbuf *pixbuf;
     gchar *text;
@@ -904,16 +835,14 @@ tp_store_set(GtkListStore *store,
                        TP_ITEM_COLUMN, item,
                        -1);
     g_free(text);
-    if (pixbuf) {
+    if (pixbuf)
         g_object_unref(pixbuf);
-    }
 }
 
-
 /* Add an item to the current list.
  */
 static void
-tp_page_add_selected(ToolbarPage *page)
+tp_page_add_selected(ToolbarPage * page)
 {
     gint item = 0;
     GtkTreeSelection *selection;
@@ -923,19 +852,17 @@ tp_page_add_selected(ToolbarPage *page)
     GtkTreePath *path;
 
     selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(page->available));
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
-        return;
-    }
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+       return;
     gtk_tree_model_get(model, &iter, TP_ITEM_COLUMN, &item, -1);
 
     selection =
         gtk_tree_view_get_selection(GTK_TREE_VIEW(page->current));
-    if (gtk_tree_selection_get_selected(selection, &model, &sibling)) {
+    if (gtk_tree_selection_get_selected(selection, &model, &sibling))
         gtk_list_store_insert_before(GTK_LIST_STORE(model), &iter,
                                      &sibling);
-    } else {
+    else
         gtk_list_store_append(GTK_LIST_STORE(model), &iter);
-    }
 
     tp_store_set(GTK_LIST_STORE(model), &iter, item);
 
@@ -955,11 +882,10 @@ tp_page_add_selected(ToolbarPage *page)
     balsa_toolbar_model_changed(page->model);
 }
 
-
 /* Remove an item from the page's current list.
  */
 static void
-tp_page_remove_selected(ToolbarPage *page)
+tp_page_remove_selected(ToolbarPage * page)
 {
     GtkTreeSelection *selection =
         gtk_tree_view_get_selection(GTK_TREE_VIEW(page->current));
@@ -967,9 +893,8 @@ tp_page_remove_selected(ToolbarPage *page)
     GtkTreeIter iter;
     GtkTreePath *path;
 
-    if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
         return;
-    }
     path = gtk_tree_model_get_path(model, &iter);
 
     gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
@@ -992,16 +917,14 @@ tp_page_remove_selected(ToolbarPage *page)
     balsa_toolbar_model_changed(page->model);
 }
 
-
 /* Unwrap text.
  */
 static void
-replace_nl_with_space(char *str)
+replace_nl_with_space(char* str)
 {
-    while (*str) {
-        if (*str == '\n') {
-            *str = ' ';
-        }
-        str++;
+    while(*str) {
+       if(*str == '\n')
+           *str=' ';
+       str++;
     }
 }
diff --git a/src/toolbar-prefs.h b/src/toolbar-prefs.h
index 4994643..cfd674b 100644
--- a/src/toolbar-prefs.h
+++ b/src/toolbar-prefs.h
@@ -5,14 +5,14 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
+ * the Free Software Foundation; either version 2, or (at your option) 
  * any later version.
- *
+ *  
  * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.
- *
+ *  
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]