Some style fixes
authorFrank Zschockelt <lm@freakysoft.de>
Sun, 11 Oct 2009 18:03:48 +0200
changeset 607 e2bd14357c9a
parent 606 14aa64152209
child 608 59d517aa4770
Some style fixes
loudmouth/lm-asyncns-resolver.c
loudmouth/lm-blocking-resolver.h
loudmouth/lm-connection.c
loudmouth/lm-connection.h
loudmouth/lm-dummy.c
loudmouth/lm-dummy.h
loudmouth/lm-error.c
loudmouth/lm-error.h
loudmouth/lm-feature-ping.c
loudmouth/lm-internals.h
loudmouth/lm-message-handler.c
loudmouth/lm-message-handler.h
loudmouth/lm-message-node.c
loudmouth/lm-message-node.h
loudmouth/lm-message-queue.c
loudmouth/lm-message.c
loudmouth/lm-message.h
loudmouth/lm-misc.c
loudmouth/lm-old-socket.c
loudmouth/lm-old-socket.h
loudmouth/lm-parser.c
loudmouth/lm-proxy.c
loudmouth/lm-proxy.h
loudmouth/lm-resolver.c
loudmouth/lm-resolver.h
loudmouth/lm-sasl.c
loudmouth/lm-sasl.h
loudmouth/lm-simple-io.c
loudmouth/lm-sock.h
loudmouth/lm-socket.c
loudmouth/lm-ssl-base.c
loudmouth/lm-ssl-base.h
loudmouth/lm-ssl-generic.c
loudmouth/lm-ssl-gnutls.c
loudmouth/lm-ssl-openssl.c
loudmouth/lm-ssl.h
loudmouth/lm-utils.c
loudmouth/md5.h
loudmouth/test-dns.c
--- a/loudmouth/lm-asyncns-resolver.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-asyncns-resolver.c	Sun Oct 11 18:03:48 2009 +0200
@@ -95,7 +95,7 @@
         g_io_channel_unref (priv->resolv_channel);
         priv->resolv_channel = NULL;
     }
- 
+
     if (priv->watch_resolv) {
         g_source_destroy (priv->watch_resolv);
         priv->watch_resolv = NULL;
@@ -124,7 +124,7 @@
 
     if (err) {
         _lm_resolver_set_result (resolver,
-                                 LM_RESOLVER_RESULT_FAILED, 
+                                 LM_RESOLVER_RESULT_FAILED,
                                  NULL);
     } else {
         _lm_resolver_set_result (resolver,
@@ -171,8 +171,8 @@
     priv->asyncns_ctx = asyncns_new (1);
     if (priv->asyncns_ctx == NULL) {
         g_set_error (error,
-                     LM_ERROR,                 
-                     LM_ERROR_CONNECTION_FAILED,   
+                     LM_ERROR,
+                     LM_ERROR_CONNECTION_FAILED,
                      "can't initialise libasyncns");
         return FALSE;
     }
@@ -181,8 +181,8 @@
         g_io_channel_unix_new (asyncns_fd (priv->asyncns_ctx));
 
     g_object_get (resolver, "context", &context, NULL);
-        
-    priv->watch_resolv = 
+
+    priv->watch_resolv =
         lm_misc_add_io_watch (context,
                               priv->resolv_channel,
                               G_IO_IN,
@@ -232,7 +232,7 @@
 
     g_print ("srv_done callback\n");
 
-    srv_len = asyncns_res_done (priv->asyncns_ctx, 
+    srv_len = asyncns_res_done (priv->asyncns_ctx,
                                 priv->resolv_query, &srv_ans);
 
     priv->resolv_query = NULL;
@@ -264,7 +264,7 @@
     }
 
     asyncns_resolver_cleanup (resolver);
-    
+
     g_object_ref (resolver);
     if (result == TRUE) {
         _lm_resolver_set_result (LM_RESOLVER (resolver), LM_RESOLVER_RESULT_OK, NULL);
@@ -288,9 +288,9 @@
                   "service", &service,
                   "protocol", &protocol,
                   NULL);
-        
+
     srv = _lm_resolver_create_srv_string (domain, service, protocol);
-        
+
     g_print ("ASYNCNS: Looking up service: %s %s %s\n[%s]", domain, service, protocol, srv);
 
     if (!asyncns_resolver_prep (resolver, /* Use GError? */ NULL)) {
@@ -301,9 +301,9 @@
 
     priv->resolv_query =
         asyncns_res_query (priv->asyncns_ctx, srv, C_IN, T_SRV);
-        
-    asyncns_setuserdata (priv->asyncns_ctx, 
-                         priv->resolv_query, 
+
+    asyncns_setuserdata (priv->asyncns_ctx,
+                         priv->resolv_query,
                          (gpointer) asyncns_resolver_srv_done);
 
     g_free (srv);
@@ -332,7 +332,7 @@
     };
 
     /* End of DNS querying */
-} 
+}
 
 static void
 asyncns_resolver_cancel (LmResolver *resolver)
--- a/loudmouth/lm-blocking-resolver.h	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-blocking-resolver.h	Sun Oct 11 18:03:48 2009 +0200
@@ -23,7 +23,7 @@
 
 #include <glib-object.h>
 
-#include "lm-resolver.h" 
+#include "lm-resolver.h"
 
 G_BEGIN_DECLS
 
--- a/loudmouth/lm-connection.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-connection.c	Sun Oct 11 18:03:48 2009 +0200
@@ -24,7 +24,7 @@
  * SECTION:lm-connection
  * @Title: LmConnection
  * @Short_description: A client connection to the server
- * 
+ *
  * An example of how to use Loudmouth with the synchronous API.
  * <informalexample><programlisting>
  * int
@@ -36,30 +36,30 @@
  *      LmMessage    *m;
  *
  *      connection = lm_connection_new ("myserver");
- * 
+ *
  *      if (!lm_connection_open_and_block (connection, &amp;error)) {
  *          g_error ("Failed to open: &percnt;s\n", error->message);
  *      }
- * 
+ *
  *      if (!lm_connection_authenticate_and_block (connection,
- *                                                 "username", "password", 
+ *                                                 "username", "password",
  *                                                 "resource",
  *                                                 &amp;error)) {
  *          g_error ("Failed to authenticate: &percnt;s\n", error->message);
  *      }
- *  
+ *
  *      m = lm_message_new ("recipient", LM_MESSAGE_TYPE_MESSAGE);
  *      lm_message_node_add_child (m->node, "body", "message");
- *  
+ *
  *      if (!lm_connection_send (connection, m, &amp;error)) {
  *          g_error ("Send failed: &percnt;s\n", error->message);
  *      }
- * 
+ *
  *      lm_message_unref (m);
- * 
+ *
  *      lm_connection_close (connection, NULL);
  *      lm_connection_unref (connection);
- *  
+ *
  *      return 0;
  * }
  * </programlisting></informalexample>
@@ -68,7 +68,7 @@
 #include <config.h>
 
 #include <string.h>
-#include <sys/stat.h> 
+#include <sys/stat.h>
 #include <sys/types.h>
 #include <fcntl.h>
 
@@ -106,7 +106,7 @@
 struct _LmConnection {
     /* Parameters */
     GMainContext      *context;
-    
+
     /* TODO: Clean up this and make some parameter object for server, jid, effective jid etc */
     gchar             *server;
     gchar             *jid;
@@ -170,14 +170,14 @@
 static gboolean connection_do_open           (LmConnection        *connection,
                                               GError             **error);
 void            connection_do_close          (LmConnection        *connection);
-static LmMessage *     
+static LmMessage *
 connection_create_auth_req_msg               (LmAuthParameters    *auth_params);
-    
+
 static LmMessage *
 connection_create_auth_msg                   (LmConnection        *connection,
                                               LmAuthParameters    *auth_params,
                                               gint                 auth_type);
-static LmHandlerResult 
+static LmHandlerResult
 connection_auth_req_reply                    (LmMessageHandler    *handler,
                                               LmConnection        *connection,
                                               LmMessage           *m,
@@ -188,31 +188,31 @@
                                               LmConnection        *connection,
                                               LmMessage           *m,
                                               gpointer             user_data);
-static void     connection_stream_received   (LmConnection        *connection, 
+static void     connection_stream_received   (LmConnection        *connection,
                                               LmMessage           *m);
-static void     connection_stream_error      (LmConnection        *connection, 
+static void     connection_stream_error      (LmConnection        *connection,
                                               LmMessage           *m);
-static gint      
+static gint
 connection_handler_compare_func              (HandlerData         *a,
                                               HandlerData         *b);
 static void     connection_start_keep_alive  (LmConnection        *connection);
 static void     connection_stop_keep_alive   (LmConnection        *connection);
-static gboolean connection_send              (LmConnection        *connection, 
-                                              const gchar         *str, 
-                                              gint                 len, 
+static gboolean connection_send              (LmConnection        *connection,
+                                              const gchar         *str,
+                                              gint                 len,
                                               GError             **error);
 static void     connection_message_queue_cb  (LmMessageQueue      *queue,
                                               LmConnection        *connection);
-static void      
+static void
 connection_signal_disconnect                 (LmConnection        *connection,
                                               LmDisconnectReason   reason);
-static void     connection_incoming_data     (LmOldSocket         *socket, 
+static void     connection_incoming_data     (LmOldSocket         *socket,
                                               const gchar         *buf,
                                               LmConnection        *connection);
 static void     connection_socket_closed_cb  (LmOldSocket            *socket,
                                               LmDisconnectReason   reason,
                                               LmConnection        *connection);
-static void      
+static void
 connection_socket_connect_cb                 (LmOldSocket         *socket,
                                               gboolean             result,
                                               LmConnection        *connection);
@@ -221,7 +221,7 @@
                                               gchar              **server);
 static void
 connection_send_stream_header                (LmConnection        *connection);
-static LmHandlerResult 
+static LmHandlerResult
 connection_features_cb                       (LmMessageHandler    *handler,
                                               LmConnection        *connection,
                                               LmMessage           *message,
@@ -241,7 +241,7 @@
 
         for (l = connection->handlers[i]; l; l = l->next) {
             HandlerData *hd = (HandlerData *) l->data;
-            
+
             lm_message_handler_unref (hd->handler);
             g_free (hd);
         }
@@ -276,13 +276,13 @@
     }
 
     connection_free_handlers (connection);
-    
+
     g_hash_table_destroy (connection->id_handlers);
-    
+
     if (connection->open_cb) {
         _lm_utils_free_callback (connection->open_cb);
     }
-    
+
     if (connection->auth_cb) {
         _lm_utils_free_callback (connection->auth_cb);
     }
@@ -348,11 +348,11 @@
         goto out;
     }
 
-    for (l = connection->handlers[lm_message_get_type (m)]; 
-         l && result == LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; 
+    for (l = connection->handlers[lm_message_get_type (m)];
+         l && result == LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
          l = l->next) {
         HandlerData *hd = (HandlerData *) l->data;
-        
+
         result = _lm_message_handler_handle_message (hd->handler,
                                                      connection,
                                                      m);
@@ -362,10 +362,10 @@
         connection_stream_error (connection, m);
         goto out;
     }
-    
+
  out:
     lm_connection_unref (connection);
-    
+
     return;
 }
 
@@ -375,14 +375,14 @@
                            LmConnection *connection)
 {
     const gchar *from;
-    
+
     lm_message_ref (m);
 
     from = lm_message_node_get_attribute (m->node, "from");
     if (!from) {
         from = "unknown";
     }
-    
+
     lm_verbose ("New message with type=\"%s\" from: %s\n",
                 _lm_message_type_to_string (lm_message_get_type (m)),
                 from);
@@ -427,7 +427,7 @@
                                               connection);
         g_object_unref (connection->feature_ping);
     }
-        
+
     connection->feature_ping = NULL;
 }
 
@@ -437,17 +437,17 @@
                      gint          len)
 {
     g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, "\nSEND:\n");
-    g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, 
+    g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET,
            "-----------------------------------\n");
     g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, "%s\n", str);
-    g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, 
+    g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET,
            "-----------------------------------\n");
 }
 
 static gboolean
-connection_send (LmConnection  *connection, 
-                 const gchar   *str, 
-                 gint           len, 
+connection_send (LmConnection  *connection,
+                 const gchar   *str,
+                 gint           len,
                  GError       **error)
 {
     gint b_written;
@@ -501,7 +501,7 @@
 /* Returns directly */
 /* Setups all data needed to start the connection attempts */
 static gboolean
-connection_do_open (LmConnection *connection, GError **error) 
+connection_do_open (LmConnection *connection, GError **error)
 {
     gchar *domain = NULL;
 
@@ -537,12 +537,12 @@
     }
 
     lm_message_queue_attach (connection->queue, connection->context);
-    
+
     connection->state = LM_CONNECTION_STATE_OPENING;
 
     return TRUE;
 }
-                    
+
 void
 connection_do_close (LmConnection *connection)
 {
@@ -553,13 +553,13 @@
     }
 
     lm_message_queue_detach (connection->queue);
-    
+
     if (!lm_connection_is_open (connection)) {
         /* lm_connection_is_open is FALSE for state OPENING as well */
         connection->state = LM_CONNECTION_STATE_CLOSED;
         return;
     }
-    
+
     connection->state = LM_CONNECTION_STATE_CLOSED;
 
     if (connection->sasl) {
@@ -573,7 +573,7 @@
 {
     LmMessage     *m;
     LmMessageNode *q_node;
-    
+
     m = lm_message_new_with_sub_type (NULL, LM_MESSAGE_TYPE_IQ,
                                       LM_MESSAGE_SUB_TYPE_GET);
     q_node = lm_message_node_add_child (m->node, "query", NULL);
@@ -595,15 +595,15 @@
 
     auth_msg = lm_message_new_with_sub_type (NULL, LM_MESSAGE_TYPE_IQ,
                                              LM_MESSAGE_SUB_TYPE_SET);
-    
+
     q_node = lm_message_node_add_child (auth_msg->node, "query", NULL);
-    
+
     lm_message_node_set_attributes (q_node,
-                                    "xmlns", "jabber:iq:auth", 
+                                    "xmlns", "jabber:iq:auth",
                                     NULL);
 
     lm_message_node_add_child (q_node, "username", lm_auth_parameters_get_username (auth_params));
-    
+
     if (auth_type & AUTH_TYPE_0K) {
         lm_verbose ("Using 0k auth (not implemented yet)\n");
         /* TODO: Should probably use this? */
@@ -619,14 +619,14 @@
         g_free (str);
         lm_message_node_add_child (q_node, "digest", digest);
         g_free (digest);
-    } 
+    }
     else if (auth_type & AUTH_TYPE_PLAIN) {
         lm_verbose ("Using plaintext auth\n");
         lm_message_node_add_child (q_node, "password", lm_auth_parameters_get_password (auth_params));
     } else {
         /* TODO: Report error somehow */
     }
-    
+
     lm_message_node_add_child (q_node, "resource", lm_auth_parameters_get_resource (auth_params));
 
     return auth_msg;
@@ -643,18 +643,18 @@
     LmMessageHandler *auth_handler;
     LmAuthParameters *auth_params = (LmAuthParameters *) user_data;
     gboolean          result;
-    
+
     auth_type = connection_check_auth_type (m);
 
     auth_msg = connection_create_auth_msg (connection, auth_params, auth_type);
 
     auth_handler = lm_message_handler_new (connection_auth_reply,
                                            NULL, NULL);
-    result = lm_connection_send_with_reply (connection, auth_msg, 
+    result = lm_connection_send_with_reply (connection, auth_msg,
                                             auth_handler, NULL);
     lm_message_handler_unref (auth_handler);
     lm_message_unref (auth_msg);
-    
+
     return LM_HANDLER_RESULT_REMOVE_MESSAGE;
 }
 
@@ -662,10 +662,10 @@
 connection_check_auth_type (LmMessage *auth_req_rpl)
 {
     LmMessageNode *q_node;
-    gint           ret_val = 0; 
+    gint           ret_val = 0;
 
     q_node = lm_message_node_get_child (auth_req_rpl->node, "query");
-    
+
     if (!q_node) {
         return AUTH_TYPE_PLAIN;
     }
@@ -686,7 +686,7 @@
     return ret_val;
 }
 
-static LmHandlerResult 
+static LmHandlerResult
 connection_auth_reply (LmMessageHandler *handler,
                        LmConnection     *connection,
                        LmMessage        *m,
@@ -694,37 +694,37 @@
 {
     const gchar *type;
     gboolean     result = TRUE;
-    
-    g_return_val_if_fail (connection != NULL, 
+
+    g_return_val_if_fail (connection != NULL,
                           LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS);
-    
+
 
     type = lm_message_node_get_attribute (m->node, "type");
     if (strcmp (type, "result") == 0) {
         result = TRUE;
         connection->state = LM_CONNECTION_STATE_AUTHENTICATED;
-    } 
+    }
     else if (strcmp (type, "error") == 0) {
         result = FALSE;
         connection->state = LM_CONNECTION_STATE_OPEN;
     }
-    
+
     lm_verbose ("AUTH reply: %d\n", result);
-    
+
     if (connection->auth_cb) {
         LmCallback *cb = connection->auth_cb;
 
         connection->auth_cb = NULL;
 
         if (cb->func) {
-            (* ((LmResultFunction) cb->func)) (connection, 
+            (* ((LmResultFunction) cb->func)) (connection,
                                                result,
                                                cb->user_data);
         }
 
         _lm_utils_free_callback (cb);
     }
-    
+
     return LM_HANDLER_RESULT_REMOVE_MESSAGE;
 }
 
@@ -740,7 +740,7 @@
         connection_send_stream_header (connection);
     } else {
         connection_do_close (connection);
-        connection_signal_disconnect (connection, 
+        connection_signal_disconnect (connection,
                                       LM_DISCONNECT_REASON_ERROR);
     }
 
@@ -748,7 +748,7 @@
 }
 
 static void
-connection_possibly_register_starttls_handler (LmConnection *connection) 
+connection_possibly_register_starttls_handler (LmConnection *connection)
 {
     /* if we'd like to use tls and we didn't already start
      * it, prepare for it now */
@@ -770,10 +770,10 @@
 {
     gboolean result;
     const char *xmpp_version;
-    
+
     g_return_if_fail (connection != NULL);
     g_return_if_fail (m != NULL);
-    
+
     connection->stream_id = g_strdup (lm_message_node_get_attribute (m->node,
                                                                      "id"));
 
@@ -783,7 +783,7 @@
                     connection->stream_id);
 
         connection->use_sasl = TRUE;
-        
+
         /* stream is started multiple times, but we only want
          * one sasl mechanism */
         if (!connection->sasl) {
@@ -792,14 +792,14 @@
 
         connection_possibly_register_starttls_handler (connection);
     } else {
-        lm_verbose ("Old Jabber stream received: %s\n", 
+        lm_verbose ("Old Jabber stream received: %s\n",
                     connection->stream_id);
     }
-    
+
     if (connection->state < LM_CONNECTION_STATE_OPEN) {
         connection->state = LM_CONNECTION_STATE_OPEN;
     }
-    
+
     /* Check to see if the stream is correctly set up */
     result = TRUE;
 
@@ -809,7 +809,7 @@
         LmCallback *cb = connection->open_cb;
 
         connection->open_cb = NULL;
-        
+
         if (cb->func) {
             (* ((LmResultFunction) cb->func)) (connection, result,
                                                cb->user_data);
@@ -866,7 +866,7 @@
 {
     if (connection->disconnect_cb && connection->disconnect_cb->func) {
         LmCallback *cb = connection->disconnect_cb;
-        
+
         lm_connection_ref (connection);
         (* ((LmDisconnectFunction) cb->func)) (connection,
                                                reason,
@@ -876,8 +876,8 @@
 }
 
 static void
-connection_incoming_data (LmOldSocket  *socket, 
-                          const gchar  *buf, 
+connection_incoming_data (LmOldSocket  *socket,
+                          const gchar  *buf,
                           LmConnection *connection)
 {
     lm_parser_parse (connection->parser, buf);
@@ -904,18 +904,18 @@
             LmCallback *cb = connection->open_cb;
 
             connection->open_cb = NULL;
-            
+
             (* ((LmResultFunction) cb->func)) (connection, FALSE,
                                                cb->user_data);
             _lm_utils_free_callback (cb);
         }
-    
+
         return;
     }
-    
+
     /* FIXME: Set up according to XMPP 1.0 specification */
     /*        StartTLS and the like */
-    if (!connection_send (connection, 
+    if (!connection_send (connection,
                           "<?xml version='1.0' encoding='UTF-8'?>", -1,
                           NULL)) {
         lm_verbose ("Failed to send xml version and encoding\n");
@@ -942,8 +942,8 @@
         }
 
         return TRUE;
-    } 
-    
+    }
+
     return FALSE;
 }
 
@@ -959,19 +959,19 @@
 
     m = lm_message_new (server_from_jid, LM_MESSAGE_TYPE_STREAM);
     lm_message_node_set_attributes (m->node,
-                                    "xmlns:stream", 
+                                    "xmlns:stream",
                                     "http://etherx.jabber.org/streams",
                                     "xmlns", "jabber:client",
                                     "version", "1.0",
                                     NULL);
-    
+
     g_free (server_from_jid);
 
     if (!lm_connection_send (connection, m, NULL)) {
         lm_verbose ("Failed to send stream information\n");
         connection_do_close (connection);
     }
-        
+
     lm_message_unref (m);
 }
 
@@ -1012,7 +1012,7 @@
         connection->auth_cb = NULL;
 
         if (cb->func) {
-            (* ((LmResultFunction) cb->func)) (connection, 
+            (* ((LmResultFunction) cb->func)) (connection,
                                                success,
                                                cb->user_data);
         }
@@ -1035,11 +1035,11 @@
 
     type = lm_message_get_sub_type (message);
     if (type == LM_MESSAGE_SUB_TYPE_ERROR) {
-        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL, 
+        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL,
                "%s: error while binding to resource\n", G_STRFUNC);
-    
+
         connection_call_auth_cb (connection, FALSE);
-        
+
         return LM_HANDLER_RESULT_REMOVE_MESSAGE;
     }
 
@@ -1053,7 +1053,7 @@
 
 
     m = lm_message_new_with_sub_type (NULL,
-                                      LM_MESSAGE_TYPE_IQ, 
+                                      LM_MESSAGE_TYPE_IQ,
                                       LM_MESSAGE_SUB_TYPE_SET);
 
     session_node = lm_message_node_add_child (m->node, "session", NULL);
@@ -1083,7 +1083,7 @@
     LmMessageNode *starttls_node;
     LmMessageNode *old_auth;
     LmMessageNode *sasl_mechanisms;
-    
+
     starttls_node = lm_message_node_find_child (message->node, "starttls");
     if (connection->ssl && lm_old_socket_get_use_starttls (connection->socket)) {
         if (starttls_node) {
@@ -1105,7 +1105,7 @@
             /* If there were no starttls features present and we require it, this is
              * the place to scream. */
 
-            g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL, 
+            g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL,
                    "%s: required StartTLS feature not supported by server\n", G_STRFUNC);
             connection_do_close (connection);
             connection_signal_disconnect (connection,
@@ -1127,10 +1127,10 @@
         }
 
         bind_msg = lm_message_new_with_sub_type (NULL,
-                                                 LM_MESSAGE_TYPE_IQ, 
+                                                 LM_MESSAGE_TYPE_IQ,
                                                  LM_MESSAGE_SUB_TYPE_SET);
 
-        bind_node = lm_message_node_add_child (bind_msg->node, 
+        bind_node = lm_message_node_add_child (bind_msg->node,
                                                "bind", NULL);
         lm_message_node_set_attributes (bind_node,
                                         "xmlns", XMPP_NS_BIND,
@@ -1141,13 +1141,13 @@
 
         bind_handler = lm_message_handler_new (connection_bind_reply,
                                                NULL, NULL);
-        result = lm_connection_send_with_reply (connection, bind_msg, 
+        result = lm_connection_send_with_reply (connection, bind_msg,
                                                 bind_handler, NULL);
         lm_message_handler_unref (bind_handler);
         lm_message_unref (bind_msg);
 
         if (result < 0) {
-            g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL, 
+            g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL,
                    "%s: can't send resource binding request\n", G_STRFUNC);
             connection_do_close (connection);
         }
@@ -1157,7 +1157,7 @@
 
     sasl_mechanisms = lm_message_node_find_child (message->node, "mechanisms");
     if (connection->use_sasl && old_auth != NULL && sasl_mechanisms == NULL) {
-        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL, 
+        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL,
                "Server uses XEP-0078 (jabber iq auth) instead of SASL\n");
         /* So the server is XMPP1.0, but doesn't support SASL and uses
          * obsolete XEP-0078 instead. Let's cope. */
@@ -1186,10 +1186,10 @@
 /**
  * lm_connection_new:
  * @server: The hostname to the server for the connection.
- * 
- * Creates a new closed connection. To open the connection call 
+ *
+ * Creates a new closed connection. To open the connection call
  * lm_connection_open(). @server can be #NULL but must be set before calling lm_connection_open().
- * 
+ *
  * Return value: A newly created LmConnection, should be unreffed with lm_connection_unref().
  **/
 LmConnection *
@@ -1209,22 +1209,22 @@
     }
 
     connection->port        = LM_CONNECTION_DEFAULT_PORT;
-    connection->queue       = lm_message_queue_new ((LmMessageQueueCallback) connection_message_queue_cb, 
+    connection->queue       = lm_message_queue_new ((LmMessageQueueCallback) connection_message_queue_cb,
                                                           connection);
     connection->state       = LM_CONNECTION_STATE_CLOSED;
-    
-    connection->id_handlers = g_hash_table_new_full (g_str_hash, 
+
+    connection->id_handlers = g_hash_table_new_full (g_str_hash,
                                                      g_str_equal,
-                                                     g_free, 
+                                                     g_free,
                                                      (GDestroyNotify) lm_message_handler_unref);
     connection->ref_count   = 1;
-    
+
     for (i = 0; i < LM_MESSAGE_TYPE_UNKNOWN; ++i) {
         connection->handlers[i] = NULL;
     }
 
-    connection->parser = lm_parser_new 
-        ((LmParserMessageFunction) connection_new_message_cb, 
+    connection->parser = lm_parser_new
+        ((LmParserMessageFunction) connection_new_message_cb,
          connection, NULL);
 
     return connection;
@@ -1234,11 +1234,11 @@
  * lm_connection_new_with_context:
  * @server: The hostname to the server for the connection.
  * @context: The context this connection should be running in.
- * 
- * Creates a new closed connection running in a certain context. To open the 
- * connection call #lm_connection_open. @server can be #NULL but must be set 
+ *
+ * Creates a new closed connection running in a certain context. To open the
+ * connection call #lm_connection_open. @server can be #NULL but must be set
  * before calling #lm_connection_open.
- * 
+ *
  * Return value: A newly created LmConnection, should be unreffed with lm_connection_unref().
  **/
 LmConnection *
@@ -1263,21 +1263,21 @@
  * @user_data: User data that will be passed to @function.
  * @notify: Function for freeing that user_data, can be NULL.
  * @error: location to store error, or %NULL
- * 
+ *
  * An async call to open @connection. When the connection is open @function will be called.
- * 
+ *
  * Return value: #TRUE if everything went fine, otherwise #FALSE.
  **/
 gboolean
-lm_connection_open (LmConnection      *connection, 
+lm_connection_open (LmConnection      *connection,
                     LmResultFunction   function,
                     gpointer           user_data,
                     GDestroyNotify     notify,
                     GError           **error)
 {
     g_return_val_if_fail (connection != NULL, FALSE);
-    
-    connection->open_cb = _lm_utils_new_callback (function, 
+
+    connection->open_cb = _lm_utils_new_callback (function,
                                                   user_data, notify);
 
     return connection_do_open (connection, error);
@@ -1287,16 +1287,16 @@
  * lm_connection_open_and_block:
  * @connection: an #LmConnection to open
  * @error: location to store error, or %NULL
- * 
- * Opens @connection and waits until the stream is setup. 
- * 
+ *
+ * Opens @connection and waits until the stream is setup.
+ *
  * Return value: #TRUE if no errors where encountered during opening and stream setup successfully, #FALSE otherwise.
  **/
 gboolean
 lm_connection_open_and_block (LmConnection *connection, GError **error)
 {
     gboolean result;
-    
+
     g_return_val_if_fail (connection != NULL, FALSE);
 
     connection->open_cb = NULL;
@@ -1306,7 +1306,7 @@
     if (result == FALSE) {
         return FALSE;
     }
-        
+
     while (lm_connection_get_state (connection) == LM_CONNECTION_STATE_OPENING) {
         if (g_main_context_pending (connection->context)) {
             g_main_context_iteration (connection->context, TRUE);
@@ -1353,18 +1353,18 @@
 
 /**
  * lm_connection_close:
- * @connection: #LmConnection to close 
+ * @connection: #LmConnection to close
  * @error: location to store error, or %NULL
- * 
+ *
  * A synchronous call to close the connection. When returning the connection is considered to be closed and can be opened again with lm_connection_open().
- * 
+ *
  * Return value: Returns #TRUE if no errors where detected, otherwise #FALSE.
  **/
 gboolean
 lm_connection_close (LmConnection *connection, GError **error)
 {
     gboolean no_errors = TRUE;
-    
+
     g_return_val_if_fail (connection != NULL, FALSE);
 
     if (connection->socket) {
@@ -1379,9 +1379,9 @@
         return FALSE;
     }
 
-    lm_verbose ("Disconnecting from: %s:%d\n", 
+    lm_verbose ("Disconnecting from: %s:%d\n",
                 connection->server, connection->port);
-    
+
     if (lm_connection_is_open (connection)) {
         if (!connection_send (connection, "</stream:stream>", -1, error)) {
             no_errors = FALSE;
@@ -1389,10 +1389,10 @@
 
         lm_old_socket_flush (connection->socket);
     }
-    
+
     connection_do_close (connection);
     connection_signal_disconnect (connection, LM_DISCONNECT_REASON_OK);
-    
+
     return no_errors;
 }
 
@@ -1421,9 +1421,9 @@
  * @user_data: Userdata passed to @function when called.
  * @notify: Destroy function to free the memory used by @user_data, can be NULL.
  * @error: location to store error, or %NULL
- * 
- * Tries to authenticate a user against the server. The #LmResult in the result callback @function will say whether it succeeded or not. 
- * 
+ *
+ * Tries to authenticate a user against the server. The #LmResult in the result callback @function will say whether it succeeded or not.
+ *
  * Return value: #TRUE if no errors where detected while sending the authentication message, #FALSE otherwise.
  **/
 gboolean
@@ -1438,7 +1438,7 @@
 {
     LmAuthParameters *auth_params;
     gboolean          ret_val;
-    
+
     g_return_val_if_fail (connection != NULL, FALSE);
     g_return_val_if_fail (username != NULL, FALSE);
     g_return_val_if_fail (password != NULL, FALSE);
@@ -1455,14 +1455,14 @@
     }
 
     connection->state = LM_CONNECTION_STATE_AUTHENTICATING;
-    
-    connection->auth_cb = _lm_utils_new_callback (function, 
-                                                  user_data, 
+
+    connection->auth_cb = _lm_utils_new_callback (function,
+                                                  user_data,
                                                   notify);
 
     connection->resource = g_strdup (lm_auth_parameters_get_resource (auth_params));
-                                              
-    connection->effective_jid = g_strdup_printf ("%s/%s", 
+
+    connection->effective_jid = g_strdup_printf ("%s/%s",
                                                  connection->jid, connection->resource);
 
     /* TODO: Break out Credentials (or use the already existing AuthReqData struct for *
@@ -1504,14 +1504,14 @@
     LmMessage        *m;
     LmMessageHandler *handler;
     gboolean          result;
-    
+
     m = connection_create_auth_req_msg (auth_params);
-        
-    handler = lm_message_handler_new (connection_auth_req_reply, 
+
+    handler = lm_message_handler_new (connection_auth_req_reply,
                                       lm_auth_parameters_ref (auth_params),
                                       (GDestroyNotify) lm_auth_parameters_unref);
     result = lm_connection_send_with_reply (connection, m, handler, error);
-    
+
     lm_message_handler_unref (handler);
     lm_message_unref (m);
 
@@ -1525,9 +1525,9 @@
  * @password: Password corresponding to @username.
  * @resource: Resource used for this connection.
  * @error: location to store error, or %NULL
- * 
+ *
  * Tries to authenticate a user against the server. This function blocks until a reply to the authentication attempt is returned and returns whether it was successful or not.
- * 
+ *
  * Return value: #TRUE if no errors where detected and authentication was successful. #FALSE otherwise.
  **/
 gboolean
@@ -1568,14 +1568,14 @@
     default:
         g_assert_not_reached ();
         break;
-    } 
+    }
 
     return FALSE;
 }
 
 /**
  * lm_connection_get_keep_alive_rate:
- * @connection: an #LmConnection 
+ * @connection: an #LmConnection
  *
  * Get the keep alive rate, in seconds. Zero is returned if no keep alive rate has been set.
  *
@@ -1593,7 +1593,7 @@
  * lm_connection_set_keep_alive_rate:
  * @connection: an #LmConnection
  * @rate: Number of seconds between keep alive packages are sent.
- * 
+ *
  * Set the keep alive rate, in seconds. Set to 0 to prevent keep alive messages to be sent.
  * A keep alive message is a single space character.
  **/
@@ -1609,7 +1609,7 @@
     }
 
     connection->keep_alive_rate = rate;
-    
+
     if (lm_connection_is_open (connection)) {
         connection_start_keep_alive (connection);
     }
@@ -1618,28 +1618,28 @@
 /**
  * lm_connection_is_open:
  * @connection: #LmConnection to check if it is open.
- * 
+ *
  * Check if the @connection is currently open.
- * 
+ *
  * Return value: #TRUE if connection is open and #FALSE if it is closed.
  **/
 gboolean
 lm_connection_is_open (LmConnection *connection)
 {
     g_return_val_if_fail (connection != NULL, FALSE);
-    
+
     return connection->state >= LM_CONNECTION_STATE_OPEN;
 }
 
 /**
  * lm_connection_is_authenticated:
  * @connection: #LmConnection to check if it is authenticated
- * 
+ *
  * Check if @connection is authenticated.
- * 
+ *
  * Return value: #TRUE if connection is authenticated, #FALSE otherwise.
  **/
-gboolean 
+gboolean
 lm_connection_is_authenticated (LmConnection *connection)
 {
     g_return_val_if_fail (connection != NULL, FALSE);
@@ -1650,9 +1650,9 @@
 /**
  * lm_connection_get_server:
  * @connection: an #LmConnection
- * 
- * Fetches the server address that @connection is using. 
- * 
+ *
+ * Fetches the server address that @connection is using.
+ *
  * Return value: the server address
  **/
 const gchar *
@@ -1667,21 +1667,21 @@
  * lm_connection_set_server:
  * @connection: an #LmConnection
  * @server: Address of the server
- * 
+ *
  * Sets the server address for @connection to @server. Notice that @connection
- * can't be open while doing this. 
+ * can't be open while doing this.
  **/
 void
 lm_connection_set_server (LmConnection *connection, const gchar *server)
 {
     g_return_if_fail (connection != NULL);
     g_return_if_fail (server != NULL);
-    
+
     if (lm_connection_is_open (connection)) {
         g_warning ("Can't change server address while connected");
         return;
     }
-    
+
     g_free (connection->server);
     connection->server = _lm_utils_hostname_to_punycode (server);
 }
@@ -1689,9 +1689,9 @@
 /**
  * lm_connection_get_jid:
  * @connection: an #LmConnection
- * 
- * Fetches the jid set for @connection is using. 
- * 
+ *
+ * Fetches the jid set for @connection is using.
+ *
  * Return value: the jid
  **/
 const gchar *
@@ -1705,7 +1705,7 @@
 /**
  * lm_connection_get_full_jid:
  * @connection: an #LmConnection
- * 
+ *
  * Returns the full jid that server set for us after
  * resource binding, complete with the resource.
  *
@@ -1723,10 +1723,10 @@
  * lm_connection_set_jid:
  * @connection: an #LmConnection
  * @jid: JID to be used for @connection
- * 
+ *
  * Sets the JID to be used for @connection.
  **/
-void 
+void
 lm_connection_set_jid (LmConnection *connection, const gchar *jid)
 {
     g_return_if_fail (connection != NULL);
@@ -1743,10 +1743,10 @@
 /**
  * lm_connection_get_port:
  * @connection: an #LmConnection
- * 
+ *
  * Fetches the port that @connection is using.
- * 
- * Return value: 
+ *
+ * Return value:
  **/
 guint
 lm_connection_get_port (LmConnection *connection)
@@ -1760,35 +1760,35 @@
  * lm_connection_set_port:
  * @connection: an #LmConnection
  * @port: server port
- * 
+ *
  * Sets the server port that @connection will be using.
  **/
 void
 lm_connection_set_port (LmConnection *connection, guint port)
 {
     g_return_if_fail (connection != NULL);
-    
+
     if (lm_connection_is_open (connection)) {
         g_warning ("Can't change server port while connected");
         return;
     }
-    
+
     connection->port = port;
 }
 
 /**
- * lm_connection_get_ssl: 
+ * lm_connection_get_ssl:
  * @connection: an #LmConnection
  *
  * Returns the SSL struct if the connection is using one.
- * 
+ *
  * Return value: The ssl struct or %NULL if no proxy is used.
  **/
 LmSSL *
 lm_connection_get_ssl (LmConnection *connection)
 {
     g_return_val_if_fail (connection != NULL, NULL);
-    
+
     return connection->ssl;
 }
 
@@ -1817,11 +1817,11 @@
 }
 
 /**
- * lm_connection_get_proxy: 
+ * lm_connection_get_proxy:
  * @connection: an #LmConnection
  *
  * Returns the proxy if the connection is using one.
- * 
+ *
  * Return value: The proxy or %NULL if no proxy is used.
  **/
 LmProxy *
@@ -1830,15 +1830,15 @@
     g_return_val_if_fail (connection != NULL, NULL);
 
     return connection->proxy;
-} 
+}
 
 /**
- * lm_connection_set_proxy: 
+ * lm_connection_set_proxy:
  * @connection: an #LmConnection
  * @proxy: an #LmProxy
  *
  * Sets the proxy to use for this connection. To unset pass #NULL.
- * 
+ *
  **/
 void
 lm_connection_set_proxy (LmConnection *connection, LmProxy *proxy)
@@ -1861,24 +1861,24 @@
 }
 
 /**
- * lm_connection_send: 
+ * lm_connection_send:
  * @connection: #LmConnection to send message over.
  * @message: #LmMessage to send.
  * @error: location to store error, or %NULL
- * 
+ *
  * Asynchronous call to send a message.
- * 
+ *
  * Return value: Returns #TRUE if no errors where detected while sending, #FALSE otherwise.
  **/
 gboolean
-lm_connection_send (LmConnection  *connection, 
-                    LmMessage     *message, 
+lm_connection_send (LmConnection  *connection,
+                    LmMessage     *message,
                     GError       **error)
 {
     gchar    *xml_str;
     gchar    *ch;
     gboolean  result;
-    
+
     g_return_val_if_fail (connection != NULL, FALSE);
     g_return_val_if_fail (message != NULL, FALSE);
 
@@ -1886,7 +1886,7 @@
     if ((ch = strstr (xml_str, "</stream:stream>"))) {
         *ch = '\0';
     }
-    
+
     result = connection_send (connection, xml_str, -1, error);
     g_free (xml_str);
 
@@ -1899,34 +1899,34 @@
  * @message: #LmMessage to send.
  * @handler: #LmMessageHandler that will be used when a reply to @message arrives
  * @error: location to store error, or %NULL
- * 
- * Send a #LmMessage which will result in a reply. 
- * 
+ *
+ * Send a #LmMessage which will result in a reply.
+ *
  * Return value: Returns #TRUE if no errors where detected while sending, #FALSE otherwise.
  **/
-gboolean 
+gboolean
 lm_connection_send_with_reply (LmConnection      *connection,
                                LmMessage         *message,
                                LmMessageHandler  *handler,
                                GError           **error)
 {
     gchar *id;
-    
+
     g_return_val_if_fail (connection != NULL, FALSE);
     g_return_val_if_fail (message != NULL, FALSE);
     g_return_val_if_fail (handler != NULL, FALSE);
 
     if (lm_message_node_get_attribute (message->node, "id")) {
-        id = g_strdup (lm_message_node_get_attribute (message->node, 
+        id = g_strdup (lm_message_node_get_attribute (message->node,
                                                       "id"));
     } else {
         id = _lm_utils_generate_id ();
         lm_message_node_set_attributes (message->node, "id", id, NULL);
     }
-    
-    g_hash_table_insert (connection->id_handlers, 
+
+    g_hash_table_insert (connection->id_handlers,
                          id, lm_message_handler_ref (handler));
-    
+
     return lm_connection_send (connection, message, error);
 }
 
@@ -1935,9 +1935,9 @@
  * @connection: an #LmConnection
  * @message: an #LmMessage
  * @error: Set if error was detected during sending.
- * 
+ *
  * Send @message and wait for return.
- * 
+ *
  * Return value: The reply
  **/
 LmMessage *
@@ -1961,7 +1961,7 @@
 
 
     if (lm_message_node_get_attribute (message->node, "id")) {
-        id = g_strdup (lm_message_node_get_attribute (message->node, 
+        id = g_strdup (lm_message_node_get_attribute (message->node,
                                                       "id"));
     } else {
         id = _lm_utils_generate_id ();
@@ -1977,7 +1977,7 @@
         guint        n;
 
         g_main_context_iteration (connection->context, TRUE);
-    
+
         if (lm_message_queue_is_empty (connection->queue)) {
             continue;
         }
@@ -1988,7 +1988,7 @@
             m = (LmMessage *) lm_message_queue_peek_nth (connection->queue, n);
 
             m_id = lm_message_node_get_attribute (m->node, "id");
-            
+
             if (m_id && strcmp (m_id, id) == 0) {
                 reply = m;
                 lm_message_queue_pop_nth (connection->queue, n);
@@ -2009,7 +2009,7 @@
  * @handler: Message handler to register.
  * @type: Message type that @handler will handle.
  * @priority: The priority in which to call @handler.
- * 
+ *
  * Registers a #LmMessageHandler to handle incoming messages of a certain type.
  * To unregister the handler call lm_connection_unregister_message_handler().
  **/
@@ -2020,7 +2020,7 @@
                                          LmHandlerPriority  priority)
 {
     HandlerData *hd;
-    
+
     g_return_if_fail (connection != NULL);
     g_return_if_fail (handler != NULL);
     g_return_if_fail (type != LM_MESSAGE_TYPE_UNKNOWN);
@@ -2030,7 +2030,7 @@
     hd->handler  = lm_message_handler_ref (handler);
 
     connection->handlers[type] = g_slist_insert_sorted (connection->handlers[type],
-                                                        hd, 
+                                                        hd,
                                                         (GCompareFunc) connection_handler_compare_func);
 }
 
@@ -2039,8 +2039,8 @@
  * @connection: Connection to unregister a handler for.
  * @handler: The handler to unregister.
  * @type: What type of messages to unregister this handler for.
- * 
- * Unregisters a handler for @connection. @handler will no longer be called 
+ *
+ * Unregisters a handler for @connection. @handler will no longer be called
  * when incoming messages of @type arrive.
  **/
 void
@@ -2049,14 +2049,14 @@
                                           LmMessageType     type)
 {
     GSList *l;
-    
+
     g_return_if_fail (connection != NULL);
     g_return_if_fail (handler != NULL);
     g_return_if_fail (type != LM_MESSAGE_TYPE_UNKNOWN);
 
     for (l = connection->handlers[type]; l; l = l->next) {
         HandlerData *hd = (HandlerData *) l->data;
-        
+
         if (handler == hd->handler) {
             connection->handlers[type] = g_slist_remove_link (connection->handlers[type], l);
             g_slist_free (l);
@@ -2073,8 +2073,8 @@
  * @function: Function to be called when @connection is closed.
  * @user_data: User data passed to @function.
  * @notify: Function that will be called with @user_data when @user_data needs to be freed. Pass #NULL if it shouldn't be freed.
- * 
- * Set the callback that will be called when a connection is closed. 
+ *
+ * Set the callback that will be called when a connection is closed.
  **/
 void
 lm_connection_set_disconnect_function (LmConnection         *connection,
@@ -2087,9 +2087,9 @@
     if (connection->disconnect_cb) {
         _lm_utils_free_callback (connection->disconnect_cb);
     }
-        
+
     if (function) {
-        connection->disconnect_cb = _lm_utils_new_callback (function, 
+        connection->disconnect_cb = _lm_utils_new_callback (function,
                                                             user_data,
                                                             notify);
     } else {
@@ -2102,15 +2102,15 @@
  * @connection: Connection used to send
  * @str: The string to send, the entire string will be sent.
  * @error: Set if error was detected during sending.
- * 
+ *
  * Asynchronous call to send a raw string. Useful for debugging and testing.
- * 
- * Return value: Returns #TRUE if no errors was detected during sending, 
+ *
+ * Return value: Returns #TRUE if no errors was detected during sending,
  * #FALSE otherwise.
  **/
-gboolean 
-lm_connection_send_raw (LmConnection  *connection, 
-                        const gchar   *str, 
+gboolean
+lm_connection_send_raw (LmConnection  *connection,
+                        const gchar   *str,
                         GError       **error)
 {
     g_return_val_if_fail (connection != NULL, FALSE);
@@ -2126,10 +2126,10 @@
  *
  * Return value: The state of the connection.
  **/
-LmConnectionState 
+LmConnectionState
 lm_connection_get_state (LmConnection *connection)
 {
-    g_return_val_if_fail (connection != NULL, 
+    g_return_val_if_fail (connection != NULL,
                           LM_CONNECTION_STATE_CLOSED);
 
     return connection->state;
@@ -2152,26 +2152,26 @@
 /**
  * lm_connection_ref:
  * @connection: Connection to add a reference to.
- * 
- * Add a reference on @connection. To remove a reference call 
+ *
+ * Add a reference on @connection. To remove a reference call
  * lm_connection_unref().
- * 
+ *
  * Return value: Returns the same connection.
  **/
 LmConnection*
 lm_connection_ref (LmConnection *connection)
 {
     g_return_val_if_fail (connection != NULL, NULL);
-    
+
     connection->ref_count++;
-    
+
     return connection;
 }
 
 /**
  * lm_connection_unref:
  * @connection: Connection to remove reference from.
- * 
+ *
  * Removes a reference on @connection. If there are no references to
  * @connection it will be freed and shouldn't be used again.
  **/
@@ -2179,9 +2179,9 @@
 lm_connection_unref (LmConnection *connection)
 {
     g_return_if_fail (connection != NULL);
-    
+
     connection->ref_count--;
-    
+
     if (connection->ref_count == 0) {
         connection_free (connection);
     }
--- a/loudmouth/lm-connection.h	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-connection.h	Sun Oct 11 18:03:48 2009 +0200
@@ -34,21 +34,21 @@
 /**
  * LM_CONNECTION:
  * @o: pointer to cast
- * 
+ *
  * Convenience macro used to cast a pointer to a #LmConnection.
  */
 #define LM_CONNECTION(o) (LmConnection *) o;
 
 /**
  * LM_CONNECTION_DEFAULT_PORT:
- * 
+ *
  * Default jabber client port.
  */
 #define LM_CONNECTION_DEFAULT_PORT     5222
 
 /**
  * LM_CONNECTION_DEFAULT_PORT_SSL:
- * 
+ *
  * Default jabber client port when using SSL encryption.
  */
 #define LM_CONNECTION_DEFAULT_PORT_SSL 5223
@@ -61,7 +61,7 @@
  * LmHandlerResult:
  * @LM_HANDLER_RESULT_REMOVE_MESSAGE: Stop calling message handlers. The message handler returning this declares the message has been handled and should be removed.
  * @LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS: Return to continue the calling handlers from the handler list. This declares that another handlers should handle the message.
- * 
+ *
  * The return type of an LmMessageHandler. This determines whether more message handlers should be called.
  */
 typedef enum {
@@ -74,7 +74,7 @@
  * @LM_HANDLER_PRIORITY_LAST: Call the handler after all handlers with #NORMAL and #FIRST priority.
  * @LM_HANDLER_PRIORITY_NORMAL: Called before handlers with priority #LAST and after those with #FIRST.
  * @LM_HANDLER_PRIORITY_FIRST: These are called before all other handlers.
- * 
+ *
  * Since the handlers decide whether to stop the calling chain with there return values it's sometimes decirable to be able to set priority. For example a handler that only logs all incoming messages and then pass the message on to another handler wants to have priority %LM_HANDLER_PRIORITY_FIRST. An handler that should take all messages that wasn't handled by anything else would want to have priority %LM_HANDLER_PRIORITY_LAST. If several handlers have the same priority nothing can be said about the order the handlers will be called in.
  */
 typedef enum {
@@ -89,7 +89,7 @@
  * @LM_DISCONNECT_REASON_HUP: The socket emitted that the connection was hung up.
  * @LM_DISCONNECT_REASON_ERROR: A generic error somewhere in the transport layer.
  * @LM_DISCONNECT_REASON_RESOURCE_CONFLICT:  * @LM_DISCONNECT_REASON_INVALID_XML:  * @LM_DISCONNECT_REASON_UNKNOWN: An unknown error.
- * 
+ *
  * Sent with #LmDisconnectFunction to describe why a connection was closed.
  */
 typedef enum {
@@ -109,7 +109,7 @@
  * @LM_CONNECTION_STATE_OPEN: The connection is open.
  * @LM_CONNECTION_STATE_AUTHENTICATING: The connection is in the process of authenticating.
  * @LM_CONNECTION_STATE_AUTHENTICATED: The connection is authenticated and is ready to start sending/receiving messages.
- * 
+ *
  * Describes the current state of an #LmConnection.
  */
 typedef enum {
@@ -125,7 +125,7 @@
  * @connection: an #LmConnection
  * @success: the result, %TRUE if operation succeeded, otherwise %FALSE
  * @user_data: User data passed when function being called.
- * 
+ *
  * Callback for informing if an asynchronous operation was successful.
  */
 typedef void          (* LmResultFunction)     (LmConnection       *connection,
@@ -137,7 +137,7 @@
  * @connection: an #LmConnection
  * @reason: the reason the connection was closed.
  * @user_data: User data passed when function being called.
- * 
+ *
  * Callback called when a connection is closed.
  */
 typedef void         (* LmDisconnectFunction) (LmConnection       *connection,
@@ -205,7 +205,7 @@
                                                LmMessage          *message,
                                                LmMessageHandler   *handler,
                                                GError            **error);
-LmMessage *   
+LmMessage *
 lm_connection_send_with_reply_and_block       (LmConnection       *connection,
                                                LmMessage          *message,
                                                GError            **error);
@@ -218,12 +218,12 @@
 lm_connection_unregister_message_handler      (LmConnection       *connection,
                                                LmMessageHandler   *handler,
                                                LmMessageType       type);
-void 
+void
 lm_connection_set_disconnect_function         (LmConnection       *connection,
                                                LmDisconnectFunction function,
                                                gpointer             user_data,
                                                GDestroyNotify       notify);
-                           
+
 gboolean      lm_connection_send_raw          (LmConnection       *connection,
                                                const gchar        *str,
                                                GError            **error);
--- a/loudmouth/lm-dummy.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-dummy.c	Sun Oct 11 18:03:48 2009 +0200
@@ -70,17 +70,17 @@
                                                           "My Property",
                                                           NULL,
                                                           G_PARAM_READWRITE));
-    
-    signals[SIGNAL_NAME] = 
+
+    signals[SIGNAL_NAME] =
         g_signal_new ("signal-name",
                       G_OBJECT_CLASS_TYPE (object_class),
                       G_SIGNAL_RUN_LAST,
                       0,
                       NULL, NULL,
                       _lm_marshal_VOID__INT,
-                      G_TYPE_NONE, 
+                      G_TYPE_NONE,
                       1, G_TYPE_INT);
-    
+
     g_type_class_add_private (object_class, sizeof (LmDummyPriv));
 }
 
--- a/loudmouth/lm-dummy.h	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-dummy.h	Sun Oct 11 18:03:48 2009 +0200
@@ -41,7 +41,7 @@
 
 struct LmDummyClass {
     GObjectClass parent_class;
-    
+
     /* <vtable> */
     void  (*initialize)    (LmDummy     *dummy,
                             const char *username,
--- a/loudmouth/lm-error.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-error.c	Sun Oct 11 18:03:48 2009 +0200
@@ -36,6 +36,6 @@
     if (q == 0) {
         q = g_quark_from_static_string ("lm-error-quark");
     }
-    
+
     return q;
 }
--- a/loudmouth/lm-error.h	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-error.h	Sun Oct 11 18:03:48 2009 +0200
@@ -31,7 +31,7 @@
 
 /**
  * LM_ERROR:
- * 
+ *
  * Macro for getting the error quark.
  */
 #define LM_ERROR lm_error_quark ()
@@ -41,7 +41,7 @@
  * @LM_ERROR_CONNECTION_NOT_OPEN: Connection not open when trying to send a message
  * @LM_ERROR_CONNECTION_OPEN: Connection is already open when trying to open it again.
  * @LM_ERROR_AUTH_FAILED: Authentication failed while opening connection
- * @LM_ERROR_CONNECTION_FAILED:  * 
+ * @LM_ERROR_CONNECTION_FAILED:  *
  * Describes the problem of the error.
  */
 typedef enum {
--- a/loudmouth/lm-feature-ping.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-feature-ping.c	Sun Oct 11 18:03:48 2009 +0200
@@ -97,7 +97,7 @@
                                                         0,
                                                         G_PARAM_READWRITE));
 
-    signals[TIMED_OUT] = 
+    signals[TIMED_OUT] =
         g_signal_new ("timed-out",
                       G_OBJECT_CLASS_TYPE (object_class),
                       G_SIGNAL_RUN_LAST,
@@ -105,7 +105,7 @@
                       NULL, NULL,
                       _lm_marshal_VOID__VOID,
                       G_TYPE_NONE, 0);
-    
+
     g_type_class_add_private (object_class, sizeof (LmFeaturePingPriv));
 }
 
@@ -183,7 +183,7 @@
     priv = GET_PRIV (user_data);
 
     priv->keep_alive_counter = 0;
-    
+
     return LM_HANDLER_RESULT_REMOVE_MESSAGE;
 }
 
@@ -211,7 +211,7 @@
     }
 
     server = _lm_connection_get_server (priv->connection);
-    
+
     ping = lm_message_new_with_sub_type (server,
                                          LM_MESSAGE_TYPE_IQ,
                                          LM_MESSAGE_SUB_TYPE_GET);
--- a/loudmouth/lm-internals.h	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-internals.h	Sun Oct 11 18:03:48 2009 +0200
@@ -67,19 +67,19 @@
 gboolean         _lm_old_socket_failed            (LmConnectData         *data);
 void             _lm_old_socket_succeeded         (LmConnectData         *data);
 
-LmCallback *     _lm_utils_new_callback       (gpointer               func, 
+LmCallback *     _lm_utils_new_callback       (gpointer               func,
                                                gpointer               data,
                                                GDestroyNotify         notify);
 void             _lm_utils_free_callback      (LmCallback            *cb);
 
 gchar *          _lm_utils_generate_id        (void);
-gchar *          
+gchar *
 _lm_utils_hostname_to_punycode                (const gchar           *hostname);
 const gchar *    _lm_message_type_to_string   (LmMessageType          type);
-const gchar * 
+const gchar *
 _lm_message_sub_type_to_string                (LmMessageSubType       type);
 LmMessage *      _lm_message_new_from_node    (LmMessageNode         *node);
-void            
+void
 _lm_message_node_add_child_node               (LmMessageNode         *node,
                                                LmMessageNode         *child);
 LmMessageNode *  _lm_message_node_new         (const gchar           *name);
@@ -87,7 +87,7 @@
 gboolean         _lm_proxy_connect_cb         (GIOChannel            *source,
                                                GIOCondition           condition,
                                                gpointer               data);
-LmHandlerResult    
+LmHandlerResult
 _lm_message_handler_handle_message            (LmMessageHandler      *handler,
                                                LmConnection          *conn,
                                                LmMessage             *messag);
@@ -106,11 +106,11 @@
 gboolean         _lm_sock_is_blocking_error   (int                    err);
 gboolean         _lm_sock_is_blocking_success (int                    err);
 int              _lm_sock_get_last_error      (void);
-void             _lm_sock_get_error           (LmOldSocketT              sock, 
-                                               void                  *error, 
+void             _lm_sock_get_error           (LmOldSocketT              sock,
+                                               void                  *error,
                                                socklen_t             *len);
 const gchar *    _lm_sock_get_error_str       (int                    err);
-const gchar * 
+const gchar *
 _lm_sock_addrinfo_get_error_str               (int                    err);
 gchar       *    _lm_sock_get_local_host      (LmOldSocketT              sock);
 
--- a/loudmouth/lm-message-handler.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-message-handler.c	Sun Oct 11 18:03:48 2009 +0200
@@ -22,7 +22,7 @@
  * SECTION:lm-message-handler
  * @Title: LmMessageHandler
  * @Short_description: A handler for incoming messages.
- * 
+ *
  *  A handler can be registered to listen to incoming messages with lm_connection_register_message_handler(). When a message is recieved the handlers of the correct type will be called.
  */
 
@@ -39,23 +39,23 @@
     GDestroyNotify          notify;
 };
 
-LmHandlerResult 
+LmHandlerResult
 _lm_message_handler_handle_message (LmMessageHandler *handler,
                                     LmConnection     *connection,
                                     LmMessage        *message)
 {
-    g_return_val_if_fail (handler != NULL, 
+    g_return_val_if_fail (handler != NULL,
                           LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS);
 
     if (!handler->valid) {
         return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
     }
-        
+
     if (handler->function) {
-        return (* handler->function) (handler, connection, 
+        return (* handler->function) (handler, connection,
                                       message, handler->user_data);
     }
-        
+
     return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
 }
 
@@ -64,13 +64,13 @@
  * @function: a callback
  * @user_data: user data passed to function
  * @notify: function called when the message handler is freed
- * 
+ *
  * Creates a new message handler. This can be set to handle incoming messages
  * and when a message of the type the handler is registered to handle is
  * received @function will be called and @user_data will be passed to it.
  * @notify is called when the message handler is freed, that way any memory
  * allocated by @user_data can be freed.
- * 
+ *
  * Return value: a newly created message handler
  **/
 LmMessageHandler *
@@ -81,19 +81,19 @@
     LmMessageHandler *handler;
 
     g_return_val_if_fail (function != NULL, NULL);
-        
+
     handler = g_new0 (LmMessageHandler, 1);
-        
+
     if (handler == NULL) {
         return NULL;
     }
-        
-    handler->valid     = TRUE;  
+
+    handler->valid     = TRUE;
     handler->ref_count = 1;
     handler->function  = function;
     handler->user_data = user_data;
     handler->notify    = notify;
-        
+
     return handler;
 }
 
@@ -128,16 +128,16 @@
 /**
  * lm_message_handler_ref:
  * @handler: an #LmMessageHandler
- * 
+ *
  * Adds a reference to @handler.
- * 
+ *
  * Return value: the message handler
  **/
 LmMessageHandler *
 lm_message_handler_ref (LmMessageHandler *handler)
 {
     g_return_val_if_fail (handler != NULL, NULL);
-        
+
     handler->ref_count++;
 
     return handler;
@@ -146,17 +146,17 @@
 /**
  * lm_message_handler_unref:
  * @handler: an #LmMessagHandler
- * 
- * Removes a reference from @handler. When no more references are present the 
+ *
+ * Removes a reference from @handler. When no more references are present the
  * handler is freed.
  **/
 void
 lm_message_handler_unref (LmMessageHandler *handler)
 {
     g_return_if_fail (handler != NULL);
-        
+
     handler->ref_count --;
-        
+
     if (handler->ref_count == 0) {
         if (handler->notify) {
             (* handler->notify) (handler->user_data);
--- a/loudmouth/lm-message-handler.h	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-message-handler.h	Sun Oct 11 18:03:48 2009 +0200
@@ -35,9 +35,9 @@
  * @connection: an #LmConnection
  * @message: an #LmMessage
  * @user_data: user data set when creating the handler
- * 
+ *
  * The actual callback function in an #LmMessageHandler. This function is called when an incoming message arrives that haven't been handled by an handler with higher priority.
- * 
+ *
  * Returns: #LM_HANDLER_RESULT_REMOVE_MESSAGE to indicate that message has been handled, otherwise #LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS.
  */
 typedef LmHandlerResult (* LmHandleMessageFunction) (LmMessageHandler *handler,
--- a/loudmouth/lm-message-node.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-message-node.c	Sun Oct 11 18:03:48 2009 +0200
@@ -43,7 +43,7 @@
 {
     LmMessageNode *l;
     GSList        *list;
-        
+
     g_return_if_fail (node != NULL);
 
     for (l = node->children; l;) {
@@ -55,15 +55,15 @@
 
     g_free (node->name);
     g_free (node->value);
-        
+
     for (list = node->attributes; list; list = list->next) {
         KeyValuePair *kvp = (KeyValuePair *) list->data;
-                
+
         g_free (kvp->key);
         g_free (kvp->value);
         g_free (kvp);
     }
-        
+
     g_slist_free (node->attributes);
     g_free (node);
 }
@@ -72,13 +72,13 @@
 message_node_last_child (LmMessageNode *node)
 {
     LmMessageNode *l;
-        
+
     g_return_val_if_fail (node != NULL, NULL);
 
     if (!node->children) {
         return NULL;
     }
-                
+
     l = node->children;
 
     while (l->next) {
@@ -94,7 +94,7 @@
     LmMessageNode *node;
 
     node = g_new0 (LmMessageNode, 1);
-        
+
     node->name       = g_strdup (name);
     node->value      = NULL;
     node->raw_mode   = FALSE;
@@ -112,7 +112,7 @@
 _lm_message_node_add_child_node (LmMessageNode *node, LmMessageNode *child)
 {
     LmMessageNode *prev;
-    
+
     g_return_if_fail (node != NULL);
 
     prev = message_node_last_child (node);
@@ -124,23 +124,23 @@
     } else {
         node->children = child;
     }
-        
+
     child->parent = node;
 }
 
 /**
  * lm_message_node_get_value:
  * @node: an #LmMessageNode
- * 
+ *
  * Retrieves the value of @node.
- * 
- * Return value: 
+ *
+ * Return value:
  **/
 const gchar *
 lm_message_node_get_value (LmMessageNode *node)
 {
     g_return_val_if_fail (node != NULL, NULL);
-    
+
     return node->value;
 }
 
@@ -148,16 +148,16 @@
  * lm_message_node_set_value:
  * @node: an #LmMessageNode
  * @value: the new value.
- * 
+ *
  * Sets the value of @node. If a previous value is set it will be freed.
  **/
 void
 lm_message_node_set_value (LmMessageNode *node, const gchar *value)
 {
     g_return_if_fail (node != NULL);
-       
+
     g_free (node->value);
-    
+
     if (!value) {
         node->value = NULL;
         return;
@@ -171,18 +171,18 @@
  * @node: an #LmMessageNode
  * @name: the name of the new child
  * @value: value of the new child
- * 
- * Add a child node with @name and value set to @value. 
- * 
+ *
+ * Add a child node with @name and value set to @value.
+ *
  * Return value: the newly created child
  **/
 LmMessageNode *
-lm_message_node_add_child (LmMessageNode *node, 
-                           const gchar   *name, 
+lm_message_node_add_child (LmMessageNode *node,
+                           const gchar   *name,
                            const gchar   *value)
 {
     LmMessageNode *child;
-    
+
     g_return_val_if_fail (node != NULL, NULL);
     g_return_val_if_fail (name != NULL, NULL);
 
@@ -200,8 +200,8 @@
  * @node: an #LmMessageNode
  * @name: the first attribute, should be followed by a string with the value
  * @Varargs: The rest of the name/value pairs
- * 
- * Sets a list of attributes. The arguments should be names and corresponding 
+ *
+ * Sets a list of attributes. The arguments should be names and corresponding
  * value and needs to be ended with %NULL.
  **/
 void
@@ -210,18 +210,18 @@
                                  ...)
 {
     va_list args;
-    
+
     g_return_if_fail (node != NULL);
 
-    for (va_start (args, name); 
-         name; 
+    for (va_start (args, name);
+         name;
          name = (const gchar *) va_arg (args, gpointer)) {
         const gchar *value;
 
         value = (const gchar *) va_arg (args, gpointer);
 
         lm_message_node_set_attribute (node, name, value);
-        
+
     }
 
     va_end (args);
@@ -232,7 +232,7 @@
  * @node: an #LmMessageNode
  * @name: name of attribute
  * @value: value of attribute.
- * 
+ *
  * Sets the attribute @name to @value.
  **/
 void
@@ -240,7 +240,7 @@
                                const gchar   *name,
                                const gchar   *value)
 {
-    gboolean  found = FALSE; 
+    gboolean  found = FALSE;
     GSList   *l;
 
     g_return_if_fail (node != NULL);
@@ -249,7 +249,7 @@
 
     for (l = node->attributes; l; l = l->next) {
         KeyValuePair *kvp = (KeyValuePair *) l->data;
-                
+
         if (strcmp (kvp->key, name) == 0) {
             g_free (kvp->value);
             kvp->value = g_strdup (value);
@@ -257,14 +257,14 @@
             break;
         }
     }
-    
+
     if (!found) {
         KeyValuePair *kvp;
-    
-        kvp = g_new0 (KeyValuePair, 1);                
+
+        kvp = g_new0 (KeyValuePair, 1);
         kvp->key = g_strdup (name);
         kvp->value = g_strdup (value);
-        
+
         node->attributes = g_slist_prepend (node->attributes, kvp);
     }
 }
@@ -273,9 +273,9 @@
  * lm_message_node_get_attribute:
  * @node: an #LmMessageNode
  * @name: the attribute name
- * 
+ *
  * Fetches the attribute @name from @node.
- * 
+ *
  * Return value: the attribute value or %NULL if not set
  **/
 const gchar *
@@ -289,12 +289,12 @@
 
     for (l = node->attributes; l; l = l->next) {
         KeyValuePair *kvp = (KeyValuePair *) l->data;
-                
+
         if (strcmp (kvp->key, name) == 0) {
             ret_val = kvp->value;
         }
     }
-        
+
     return ret_val;
 }
 
@@ -302,10 +302,10 @@
  * lm_message_node_get_child:
  * @node: an #LmMessageNode
  * @child_name: the childs name
- * 
- * Fetches the child @child_name from @node. If child is not found as an 
+ *
+ * Fetches the child @child_name from @node. If child is not found as an
  * immediate child of @node %NULL is returned.
- * 
+ *
  * Return value: the child node or %NULL if not found
  **/
 LmMessageNode *
@@ -329,13 +329,13 @@
  * lm_message_node_find_child:
  * @node: A #LmMessageNode
  * @child_name: The name of the child to find
- * 
- * Locates a child among all children of @node. The entire tree will be search 
- * until a child with name @child_name is located. 
- * 
+ *
+ * Locates a child among all children of @node. The entire tree will be search
+ * until a child with name @child_name is located.
+ *
  * Return value: the located child or %NULL if not found
  **/
-LmMessageNode * 
+LmMessageNode *
 lm_message_node_find_child (LmMessageNode *node,
                             const gchar   *child_name)
 {
@@ -363,8 +363,8 @@
 /**
  * lm_message_node_get_raw_mode:
  * @node: an #LmMessageNode
- * 
- * Checks if the nodes value should be sent as raw mode. 
+ *
+ * Checks if the nodes value should be sent as raw mode.
  *
  * Return value: %TRUE if nodes value should be sent as is and %FALSE if the value will be escaped before sending.
  **/
@@ -376,7 +376,7 @@
     return node->raw_mode;
 }
 
-/** 
+/**
  * lm_message_node_set_raw_mode:
  * @node: an #LmMessageNode
  * @raw_mode: boolean specifying if node value should be escaped or not.
@@ -388,44 +388,44 @@
 {
     g_return_if_fail (node != NULL);
 
-    node->raw_mode = raw_mode;  
+    node->raw_mode = raw_mode;
 }
 
 /**
  * lm_message_node_ref:
  * @node: an #LmMessageNode
- * 
+ *
  * Adds a reference to @node.
- * 
+ *
  * Return value: the node
  **/
 LmMessageNode *
 lm_message_node_ref (LmMessageNode *node)
 {
     g_return_val_if_fail (node != NULL, NULL);
-    
+
     node->ref_count++;
-       
+
     return node;
 }
 
 /**
  * lm_message_node_unref:
  * @node: an #LmMessageNode
- * 
+ *
  * Removes a reference from @node. When no more references are present the
  * node is freed. When freed lm_message_node_unref() will be called on all
- * children. If caller needs to keep references to the children a call to 
- * lm_message_node_ref() needs to be done before the call to 
+ * children. If caller needs to keep references to the children a call to
+ * lm_message_node_ref() needs to be done before the call to
  *lm_message_unref().
  **/
 void
 lm_message_node_unref (LmMessageNode *node)
 {
     g_return_if_fail (node != NULL);
-    
+
     node->ref_count--;
-    
+
     if (node->ref_count == 0) {
         message_node_free (node);
     }
@@ -434,11 +434,11 @@
 /**
  * lm_message_node_to_string:
  * @node: an #LmMessageNode
- * 
+ *
  * Returns an XML string representing the node. This is what is sent over the
- * wire. This is used internally Loudmouth and is external for debugging 
+ * wire. This is used internally Loudmouth and is external for debugging
  * purposes.
- * 
+ *
  * Return value: an XML string representation of @node
  **/
 gchar *
@@ -449,14 +449,14 @@
     LmMessageNode *child;
 
     g_return_val_if_fail (node != NULL, NULL);
-    
+
     if (node->name == NULL) {
         return g_strdup ("");
     }
-    
+
     ret = g_string_new ("<");
     g_string_append (ret, node->name);
-    
+
     for (l = node->attributes; l; l = l->next) {
         KeyValuePair *kvp = (KeyValuePair *) l->data;
 
@@ -464,18 +464,18 @@
             gchar *escaped;
 
             escaped = g_markup_escape_text (kvp->value, -1);
-            g_string_append_printf (ret, " %s=\"%s\"", 
+            g_string_append_printf (ret, " %s=\"%s\"",
                                     kvp->key, escaped);
             g_free (escaped);
         } else {
-            g_string_append_printf (ret, " %s=\"%s\"", 
+            g_string_append_printf (ret, " %s=\"%s\"",
                                     kvp->key, kvp->value);
         }
-        
+
     }
-    
+
     g_string_append_c (ret, '>');
-    
+
     if (node->value) {
         gchar *tmp;
 
@@ -486,7 +486,7 @@
         } else {
             g_string_append (ret, node->value);
         }
-    } 
+    }
 
     for (child = node->children; child; child = child->next) {
         gchar *child_str = lm_message_node_to_string (child);
@@ -497,6 +497,6 @@
 
     /* g_string_append_printf (ret, "</%s>\n", node->name); */
     g_string_append_printf (ret, "</%s>", node->name);
-    
+
     return g_string_free (ret, FALSE);
 }
--- a/loudmouth/lm-message-node.h	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-message-node.h	Sun Oct 11 18:03:48 2009 +0200
@@ -38,8 +38,8 @@
  * @prev: previous sibling
  * @parent: node parent
  * @children: pointing to first child
- * 
- * A struct representing a node in a message. 
+ *
+ * A struct representing a node in a message.
  */
 typedef struct _LmMessageNode LmMessageNode;
 
--- a/loudmouth/lm-message-queue.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-message-queue.c	Sun Oct 11 18:03:48 2009 +0200
@@ -64,7 +64,7 @@
 message_queue_free (LmMessageQueue *queue)
 {
     lm_message_queue_detach (queue);
-    
+
     g_queue_foreach (queue->messages, (GFunc) foreach_free_message, NULL);
     g_queue_free (queue->messages);
 
@@ -138,7 +138,7 @@
     if (context)  {
         queue->context = g_main_context_ref (context);
     }
-    
+
     source = g_source_new (&source_funcs, sizeof (MessageQueueSource));
     ((MessageQueueSource *)source)->queue = queue;
     queue->source = source;
@@ -195,7 +195,7 @@
     return g_queue_get_length (queue->messages);
 }
 
-gboolean 
+gboolean
 lm_message_queue_is_empty (LmMessageQueue *queue)
 {
     g_return_val_if_fail (queue != NULL, TRUE);
--- a/loudmouth/lm-message.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-message.c	Sun Oct 11 18:03:48 2009 +0200
@@ -22,7 +22,7 @@
  * SECTION:lm-message
  * @Title: LmMessage
  * @Short_description: A message is built up like a tree of message nodes.
- * 
+ *
  * Represents a message that can be sent with lm_connection_send(), lm_connection_send_with_reply() or lm_connection_send_with_reply_and_block(). Either use lm_message_new() or lm_message_new_with_subtype() to create a message. You need to call lm_message_unref() when are finished with it.
  */
 
@@ -34,7 +34,7 @@
 
 #define PRIV(o) ((LmMessage *)o)->priv
 
-static struct TypeNames 
+static struct TypeNames
 {
     LmMessageType  type;
     const gchar   *name;
@@ -55,7 +55,7 @@
     { LM_MESSAGE_TYPE_UNKNOWN,         NULL              }
 };
 
-static struct SubTypeNames 
+static struct SubTypeNames
 {
     LmMessageSubType  type;
     const gchar      *name;
@@ -72,7 +72,7 @@
     { LM_MESSAGE_SUB_TYPE_UNSUBSCRIBED,    "unsubscribed"  },
     { LM_MESSAGE_SUB_TYPE_GET,             "get"           },
     { LM_MESSAGE_SUB_TYPE_SET,             "set"           },
-    { LM_MESSAGE_SUB_TYPE_RESULT,          "result"        }, 
+    { LM_MESSAGE_SUB_TYPE_RESULT,          "result"        },
     { LM_MESSAGE_SUB_TYPE_ERROR,           "error"         }
 };
 
@@ -126,7 +126,7 @@
     for (i = LM_MESSAGE_SUB_TYPE_NORMAL;
          i <= LM_MESSAGE_SUB_TYPE_ERROR;
          ++i) {
-        if (g_ascii_strcasecmp (type_str, 
+        if (g_ascii_strcasecmp (type_str,
                                 sub_type_names[i].name) == 0) {
             return i;
         }
@@ -178,7 +178,7 @@
     LmMessageType     type;
     LmMessageSubType  sub_type;
     const gchar      *sub_type_str;
-    
+
     type = message_type_from_string (node->name);
 
     if (type == LM_MESSAGE_TYPE_UNKNOWN) {
@@ -194,13 +194,13 @@
 
     m = g_new0 (LmMessage, 1);
     m->priv = g_new0 (LmMessagePriv, 1);
-    
+
     PRIV(m)->ref_count = 1;
     PRIV(m)->type = type;
     PRIV(m)->sub_type = sub_type;
-    
+
     m->node = lm_message_node_ref (node);
-    
+
     return m;
 }
 
@@ -208,12 +208,12 @@
  * lm_message_new:
  * @to: receipient jid
  * @type: message type
- * 
- * Creates a new #LmMessage which can be sent with lm_connection_send() or 
+ *
+ * Creates a new #LmMessage which can be sent with lm_connection_send() or
  * lm_connection_send_with_reply(). If @to is %NULL the message is sent to the
- * server. The returned message should be unreferenced with lm_message_unref() 
+ * server. The returned message should be unreferenced with lm_message_unref()
  * when caller is finished with it.
- * 
+ *
  * Return value: a newly created #LmMessage
  **/
 LmMessage *
@@ -228,7 +228,7 @@
     PRIV(m)->ref_count = 1;
     PRIV(m)->type      = type;
     PRIV(m)->sub_type  = message_sub_type_when_unset (type);
-    
+
     m->node = _lm_message_node_new (_lm_message_type_to_string (type));
 
     if (type != LM_MESSAGE_TYPE_STREAM) {
@@ -244,7 +244,7 @@
     if (type == LM_MESSAGE_TYPE_IQ) {
         lm_message_node_set_attribute (m->node, "type", "get");
     }
-    
+
     return m;
 }
 
@@ -253,15 +253,15 @@
  * @to: receipient jid
  * @type: message type
  * @sub_type: message sub type
- * 
- * Creates a new #LmMessage with sub type set. See lm_message_new() for more 
+ *
+ * Creates a new #LmMessage with sub type set. See lm_message_new() for more
  * information.
- * 
+ *
  * Return value: a newly created #LmMessage
  **/
 LmMessage *
 lm_message_new_with_sub_type (const gchar      *to,
-                              LmMessageType     type, 
+                              LmMessageType     type,
                               LmMessageSubType  sub_type)
 {
     LmMessage   *m;
@@ -283,74 +283,74 @@
 /**
  * lm_message_get_type:
  * @message: an #LmMessage
- * 
+ *
  * Fetches the type of @message.
- * 
+ *
  * Return value: the message type
  **/
 LmMessageType
 lm_message_get_type (LmMessage *message)
 {
     g_return_val_if_fail (message != NULL, LM_MESSAGE_TYPE_UNKNOWN);
-    
+
     return PRIV(message)->type;
 }
 
 /**
  * lm_message_get_sub_type:
- * @message: 
- * 
+ * @message:
+ *
  * Fetches the sub type of @message.
- * 
+ *
  * Return value: the message sub type
  **/
 LmMessageSubType
 lm_message_get_sub_type (LmMessage *message)
 {
     g_return_val_if_fail (message != NULL, LM_MESSAGE_TYPE_UNKNOWN);
-    
+
     return PRIV(message)->sub_type;
 }
 
 /**
  * lm_message_get_node:
  * @message: an #LmMessage
- * 
+ *
  * Retrieves the root node from @message.
- * 
+ *
  * Return value: an #LmMessageNode
  **/
 LmMessageNode *
 lm_message_get_node (LmMessage *message)
 {
     g_return_val_if_fail (message != NULL, NULL);
-    
+
     return message->node;
 }
 
 /**
  * lm_message_ref:
  * @message: an #LmMessage
- * 
+ *
  * Adds a reference to @message.
- * 
+ *
  * Return value: the message
  **/
 LmMessage *
 lm_message_ref (LmMessage *message)
 {
     g_return_val_if_fail (message != NULL, NULL);
-    
+
     PRIV(message)->ref_count++;
-    
+
     return message;
 }
 
 /**
  * lm_message_unref:
  * @message: an #LmMessage
- * 
- * Removes a reference from @message. When no more references are present the 
+ *
+ * Removes a reference from @message. When no more references are present the
  * message is freed.
  **/
 void
@@ -359,7 +359,7 @@
     g_return_if_fail (message != NULL);
 
     PRIV(message)->ref_count--;
-    
+
     if (PRIV(message)->ref_count == 0) {
         lm_message_node_unref (message->node);
         g_free (message->priv);
--- a/loudmouth/lm-message.h	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-message.h	Sun Oct 11 18:03:48 2009 +0200
@@ -45,7 +45,7 @@
  * @LM_MESSAGE_TYPE_STREAM: the stream:stream element, you probably don't need to create a message of this type.
  * @LM_MESSAGE_TYPE_STREAM_ERROR: a stream:error element
  * @LM_MESSAGE_TYPE_STREAM_FEATURES:  * @LM_MESSAGE_TYPE_AUTH:  * @LM_MESSAGE_TYPE_CHALLENGE:  * @LM_MESSAGE_TYPE_RESPONSE:  * @LM_MESSAGE_TYPE_SUCCESS:  * @LM_MESSAGE_TYPE_FAILURE:  * @LM_MESSAGE_TYPE_PROCEED:  * @LM_MESSAGE_TYPE_STARTTLS:  * @LM_MESSAGE_TYPE_UNKNOWN: incoming message is of some unknown type.
- * 
+ *
  * Describes what type of message a message is. This maps directly to top level elements in the jabber protocol.
  */
 typedef enum {
@@ -82,7 +82,7 @@
  * @LM_MESSAGE_SUB_TYPE_SET: used to set information in a IQ call, applised to message type "iq"
  * @LM_MESSAGE_SUB_TYPE_RESULT: message is an IQ reply, applies to message type "iq"
  * @LM_MESSAGE_SUB_TYPE_ERROR: messages is an error, applies to all message types.
- * 
+ *
  * Describes the sub type of a message. This is equal to the "type" attribute in the jabber protocol. What sub type a message can have is depending on the type of the message.
  */
 typedef enum {
--- a/loudmouth/lm-misc.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-misc.c	Sun Oct 11 18:03:48 2009 +0200
@@ -43,9 +43,9 @@
                       gpointer      data)
 {
     GSource *source;
-                                                                                
+
     g_return_val_if_fail (channel != NULL, 0);
-                                                                                
+
     source = g_io_create_watch (channel, condition);
     misc_setup_source (context, source, (GSourceFunc) function, data);
 
@@ -58,12 +58,12 @@
                   gpointer      data)
 {
     GSource *source;
-                                                                                
+
     g_return_val_if_fail (function != NULL, 0);
-                                                                                
+
     source = g_idle_source_new ();
     misc_setup_source (context, source, function, data);
-  
+
     return source;
 }
 
@@ -74,12 +74,12 @@
                      gpointer      data)
 {
     GSource *source;
-                                                                                
+
     g_return_val_if_fail (function != NULL, 0);
-                                                                                
+
     source = g_timeout_source_new (interval);
     misc_setup_source (context, source, function, data);
-  
+
     return source;
 }
 
--- a/loudmouth/lm-old-socket.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-old-socket.c	Sun Oct 11 18:03:48 2009 +0200
@@ -804,7 +804,7 @@
                "Unable to locate server available over IPv4.\n");
     };
 
-    /* FIXME: What do we do here?  How to make the mainloop exit with an 
+    /* FIXME: What do we do here?  How to make the mainloop exit with an
        error, while having no ref to said mainloop */
 }
 
--- a/loudmouth/lm-old-socket.h	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-old-socket.h	Sun Oct 11 18:03:48 2009 +0200
@@ -18,7 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LM_OLD_SOCKET_H__ 
+#ifndef __LM_OLD_SOCKET_H__
 #define __LM_OLD_SOCKET_H__
 
 #include <glib.h>
@@ -39,15 +39,15 @@
                                        gboolean             result,
                                        gpointer             user_data);
 
-LmOldSocket * lm_old_socket_create          (GMainContext       *context, 
+LmOldSocket * lm_old_socket_create          (GMainContext       *context,
                                              IncomingDataFunc    data_func,
                                              SocketClosedFunc    closed_func,
                                              ConnectResultFunc   connect_func,
                                              gpointer            user_data,
                                              LmConnection       *connection,
-                                             const gchar        *server, 
+                                             const gchar        *server,
                                              const gchar        *domain,
-                                             guint               port, 
+                                             guint               port,
                                              LmSSL              *ssl,
                                              LmProxy            *proxy,
                                              GError           **error);
@@ -59,7 +59,7 @@
 LmOldSocket *  lm_old_socket_ref            (LmOldSocket        *socket);
 void           lm_old_socket_unref          (LmOldSocket        *socket);
 gboolean       lm_old_socket_starttls       (LmOldSocket        *socket);
-gboolean       lm_old_socket_set_keepalive  (LmOldSocket        *socket, 
+gboolean       lm_old_socket_set_keepalive  (LmOldSocket        *socket,
                                              int                 delay);
 gchar *        lm_old_socket_get_local_host (LmOldSocket        *socket);
 void           lm_old_socket_asyncns_cancel (LmOldSocket        *socket);
--- a/loudmouth/lm-parser.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-parser.c	Sun Oct 11 18:03:48 2009 +0200
@@ -37,10 +37,10 @@
     LmParserMessageFunction  function;
     gpointer                 user_data;
     GDestroyNotify           notify;
-    
+
     LmMessageNode           *cur_root;
     LmMessageNode           *cur_node;
-        
+
     GMarkupParser           *m_parser;
     GMarkupParseContext     *context;
 };
@@ -59,7 +59,7 @@
                                      GError              **error);
 static void    parser_text_cb       (GMarkupParseContext  *context,
                                      const gchar          *text,
-                                     gsize                 text_len,  
+                                     gsize                 text_len,
                                      gpointer              user_data,
                                      GError              **error);
 static void    parser_error_cb      (GMarkupParseContext  *context,
@@ -73,12 +73,12 @@
                       const gchar         **attribute_values,
                       gpointer              user_data,
                       GError              **error)
-{   
+{
     LmParser     *parser;
     gint          i;
-    
+
     parser = LM_PARSER (user_data);;
-    
+
 
 /*  parser->cur_depth++; */
 
@@ -88,30 +88,30 @@
         parser->cur_node = parser->cur_root;
     } else {
         LmMessageNode *parent_node;
-        
+
         parent_node = parser->cur_node;
-        
+
         parser->cur_node = _lm_message_node_new (node_name);
         _lm_message_node_add_child_node (parent_node,
                                          parser->cur_node);
     }
 
     for (i = 0; attribute_names[i]; ++i) {
-        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_PARSER, 
-               "ATTRIBUTE: %s = %s\n", 
+        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_PARSER,
+               "ATTRIBUTE: %s = %s\n",
                attribute_names[i],
                attribute_values[i]);
-        
+
         lm_message_node_set_attributes (parser->cur_node,
                                         attribute_names[i],
-                                        attribute_values[i], 
+                                        attribute_values[i],
                                         NULL);
     }
-    
+
     if (strcmp ("stream:stream", node_name) == 0) {
         parser_end_node_cb (context,
                             "stream:stream",
-                            user_data, 
+                            user_data,
                             error);
     }
 }
@@ -123,9 +123,9 @@
                     GError              **error)
 {
     LmParser     *parser;
-    
+
     parser = LM_PARSER (user_data);
-    
+
     g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_PARSER,
            "Trying to close node: %s\n", node_name);
 
@@ -133,12 +133,12 @@
         /* FIXME: LM-1 should look at this */
         return;
     }
-        
+
     if (strcmp (parser->cur_node->name, node_name) != 0) {
         if (strcmp (node_name, "stream:stream")) {
             g_print ("Got an stream:stream end\n");
         }
-        
+
         g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_PARSER,
                "Trying to close node that isn't open: %s",
                node_name);
@@ -147,7 +147,7 @@
 
     if (parser->cur_node == parser->cur_root) {
         LmMessage *m;
-        
+
         m = _lm_message_new_from_node (parser->cur_root);
 
         if (!m) {
@@ -177,19 +177,19 @@
 static void
 parser_text_cb (GMarkupParseContext   *context,
                 const gchar           *text,
-                gsize                  text_len,  
+                gsize                  text_len,
                 gpointer               user_data,
                 GError               **error)
 {
     LmParser *parser;
-    
+
     g_return_if_fail (user_data != NULL);
-    
+
     parser = LM_PARSER (user_data);
-    
+
     if (parser->cur_node && strcmp (text, "") != 0) {
         lm_message_node_set_value (parser->cur_node, text);
-    } 
+    }
 }
 
 static void
@@ -199,23 +199,23 @@
 {
     g_return_if_fail (user_data != NULL);
     g_return_if_fail (error != NULL);
-    
+
     g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_PARSER,
            "Parsing failed: %s\n", error->message);
 }
 
 LmParser *
-lm_parser_new (LmParserMessageFunction function, 
-               gpointer                user_data, 
+lm_parser_new (LmParserMessageFunction function,
+               gpointer                user_data,
                GDestroyNotify          notify)
 {
     LmParser *parser;
-    
+
     parser = g_new0 (LmParser, 1);
     if (!parser) {
         return NULL;
     }
-    
+
     parser->m_parser = g_new0 (GMarkupParser, 1);
     if (!parser->m_parser) {
         g_free (parser);
@@ -225,7 +225,7 @@
     parser->function  = function;
     parser->user_data = user_data;
     parser->notify    = notify;
-    
+
     parser->m_parser->start_element = parser_start_node_cb;
     parser->m_parser->end_element   = parser_end_node_cb;
     parser->m_parser->text          = parser_text_cb;
@@ -244,13 +244,13 @@
 lm_parser_parse (LmParser *parser, const gchar *string)
 {
     g_return_val_if_fail (parser != NULL, FALSE);
-    
+
     if (!parser->context) {
         parser->context = g_markup_parse_context_new (parser->m_parser, 0,
                                                       parser, NULL);
     }
-        
-    if (g_markup_parse_context_parse (parser->context, string, 
+
+    if (g_markup_parse_context_parse (parser->context, string,
                                       (gssize)strlen (string), NULL)) {
         return TRUE;
     } else {
--- a/loudmouth/lm-proxy.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-proxy.c	Sun Oct 11 18:03:48 2009 +0200
@@ -23,12 +23,12 @@
  * SECTION:lm-proxy
  * @Title: LmProxy
  * @Short_description: API for the proxy support in Loudmouth
- * 
+ *
  * Use this together with an #LmConnection to get the connection to use connect through a proxy. Example of how to use the #LmProxy API.
  * <informalexample><programlisting><![CDATA[
  * LmConnection *connection;
  * LmProxy      *proxy;
- * 
+ *
  * connection = lm_connection_new ("myserver");
  * proxy = lm_proxy_new_with_server (LM_PROXY_TYPE_HTTP,
  *                "myproxyserver",
@@ -70,7 +70,7 @@
 
 static void          proxy_free              (LmProxy       *proxy);
 static gboolean      proxy_http_negotiate    (LmProxy       *proxy,
-                                              gint           fd, 
+                                              gint           fd,
                                               const gchar   *server,
                                               guint          port);
 static gboolean      proxy_negotiate         (LmProxy       *proxy,
@@ -104,9 +104,9 @@
         gchar *tmp2;
 
         tmp1 = g_strdup_printf ("%s:%s",
-                                proxy->username, 
+                                proxy->username,
                                 proxy->password);
-        tmp2 = g_base64_encode ((const guchar *) tmp1, 
+        tmp2 = g_base64_encode ((const guchar *) tmp1,
                                 (gsize) strlen (tmp1));
         g_free (tmp1);
 
@@ -117,7 +117,7 @@
         g_free (tmp2);
     } else {
         str = g_strdup_printf ("CONNECT %s:%u HTTP/1.1\r\nHost: %s:%u\r\n\r\n",
-                               server, port, 
+                               server, port,
                                server, port);
     }
 
@@ -230,7 +230,7 @@
             _lm_old_socket_failed (connect_data);
             return FALSE;
         }
-            
+
         proxy->io_watch = g_io_add_watch (connect_data->io_channel,
                                           G_IO_IN|G_IO_ERR,
                                           (GIOFunc) proxy_read_cb,
@@ -245,19 +245,19 @@
 /**
  * lm_proxy_new
  * @type: the type of the new proxy
- * 
- * Creates a new Proxy. Used #lm_connection_set_proxy to make a connection 
+ *
+ * Creates a new Proxy. Used #lm_connection_set_proxy to make a connection
  * user this proxy.
- * 
+ *
  * Return value: a newly create proxy
  **/
-LmProxy * 
+LmProxy *
 lm_proxy_new (LmProxyType type)
 {
     LmProxy *proxy;
 
     proxy = g_new0 (LmProxy, 1);
-    
+
     proxy->ref_count = 1;
     proxy->type = type;
 
@@ -277,10 +277,10 @@
  * @type: the type of the new proxy
  * @server: the proxy server
  * @port: the proxy server port
- * 
- * Creates a new Proxy. Use #lm_connection_set_proxy to make a connection 
+ *
+ * Creates a new Proxy. Use #lm_connection_set_proxy to make a connection
  * user this proxy.
- * 
+ *
  * Return value: a newly create proxy
  **/
 LmProxy *
@@ -300,10 +300,10 @@
 /**
  * lm_proxy_get_type
  * @proxy: an #LmProxy
- * 
+ *
  * Fetches the proxy type
- * 
- * Return value: the type 
+ *
+ * Return value: the type
  **/
 LmProxyType
 lm_proxy_get_type (LmProxy *proxy)
@@ -318,7 +318,7 @@
  * @proxy: an #LmProxy
  * @type: an LmProxyType
  *
- * Sets the proxy type for @proxy to @type. 
+ * Sets the proxy type for @proxy to @type.
  **/
 void
 lm_proxy_set_type (LmProxy *proxy, LmProxyType type)
@@ -331,16 +331,16 @@
 /**
  * lm_proxy_get_server:
  * @proxy: an #LmProxy
- * 
+ *
  * Fetches the server address that @proxy is using.
- * 
+ *
  * Return value: the proxy server address
  **/
 const gchar *
 lm_proxy_get_server (LmProxy *proxy)
 {
     g_return_val_if_fail (proxy != NULL, NULL);
-    
+
     return proxy->server;
 }
 
@@ -348,15 +348,15 @@
  * lm_proxy_set_server:
  * @proxy: an #LmProxy
  * @server: Address of the proxy server
- * 
- * Sets the server address for @proxy to @server. 
+ *
+ * Sets the server address for @proxy to @server.
  **/
 void
 lm_proxy_set_server (LmProxy *proxy, const gchar *server)
 {
     g_return_if_fail (proxy != NULL);
     g_return_if_fail (server != NULL);
-    
+
     g_free (proxy->server);
     proxy->server = _lm_utils_hostname_to_punycode (server);
 }
@@ -364,10 +364,10 @@
 /**
  * lm_proxy_get_port:
  * @proxy: an #LmProxy
- * 
+ *
  * Fetches the port that @proxy is using.
- * 
- * Return value: The port 
+ *
+ * Return value: The port
  **/
 guint
 lm_proxy_get_port (LmProxy *proxy)
@@ -381,30 +381,30 @@
  * lm_proxy_set_port:
  * @proxy: an #LmProxy
  * @port: proxy server port
- * 
+ *
  * Sets the server port that @proxy will be using.
  **/
 void
 lm_proxy_set_port (LmProxy *proxy, guint port)
 {
     g_return_if_fail (proxy != NULL);
-    
+
     proxy->port = port;
 }
 
 /**
  * lm_proxy_get_username:
  * @proxy: an #LmProxy
- * 
+ *
  * Fetches the username that @proxy is using.
- * 
+ *
  * Return value: the username
  **/
 const gchar *
 lm_proxy_get_username (LmProxy *proxy)
 {
     g_return_val_if_fail (proxy != NULL, NULL);
-    
+
     return proxy->username;
 }
 
@@ -412,16 +412,16 @@
  * lm_proxy_set_username:
  * @proxy: an #LmProxy
  * @username: Username
- * 
- * Sets the username for @proxy to @username or %NULL to unset.  
+ *
+ * Sets the username for @proxy to @username or %NULL to unset.
  **/
 void
 lm_proxy_set_username (LmProxy *proxy, const gchar *username)
 {
     g_return_if_fail (proxy != NULL);
-    
+
     g_free (proxy->username);
-    
+
     if (username) {
         proxy->username = g_strdup (username);
     } else {
@@ -431,16 +431,16 @@
 /**
  * lm_proxy_get_password:
  * @proxy: an #LmProxy
- * 
+ *
  * Fetches the password that @proxy is using.
- * 
+ *
  * Return value: the proxy password
  **/
 const gchar *
 lm_proxy_get_password (LmProxy *proxy)
 {
     g_return_val_if_fail (proxy != NULL, NULL);
-    
+
     return proxy->password;
 }
 
@@ -448,14 +448,14 @@
  * lm_proxy_set_password:
  * @proxy: an #LmProxy
  * @password: Password
- * 
- * Sets the password for @proxy to @password or %NULL to unset. 
+ *
+ * Sets the password for @proxy to @password or %NULL to unset.
  **/
 void
 lm_proxy_set_password (LmProxy *proxy, const gchar *password)
 {
     g_return_if_fail (proxy != NULL);
-    
+
     g_free (proxy->password);
 
     if (password) {
@@ -468,16 +468,16 @@
 /**
  * lm_proxy_ref:
  * @proxy: an #LmProxy
- * 
+ *
  * Adds a reference to @proxy.
- * 
+ *
  * Return value: the proxy
  **/
 LmProxy *
 lm_proxy_ref (LmProxy *proxy)
 {
     g_return_val_if_fail (proxy != NULL, NULL);
-    
+
     proxy->ref_count++;
     return proxy;
 }
@@ -485,7 +485,7 @@
 /**
  * lm_proxy_unref
  * @proxy: an #LmProxy
- * 
+ *
  * Removes a reference from @proxy. When no more references are present
  * @proxy is freed.
  **/
@@ -493,7 +493,7 @@
 lm_proxy_unref (LmProxy *proxy)
 {
     g_return_if_fail (proxy != NULL);
-    
+
     proxy->ref_count--;
 
     if (proxy->ref_count == 0) {
--- a/loudmouth/lm-proxy.h	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-proxy.h	Sun Oct 11 18:03:48 2009 +0200
@@ -28,7 +28,7 @@
 
 /**
  * LmProxy:
- * 
+ *
  * This should not be accessed directly. Use the accessor functions as described below.
  */
 typedef struct _LmProxy LmProxy;
@@ -37,7 +37,7 @@
  * LmProxyType:
  * @LM_PROXY_TYPE_NONE: Unused
  * @LM_PROXY_TYPE_HTTP: An HTTP proxy.
- * 
+ *
  * The type of the proxy.
  */
 typedef enum {
--- a/loudmouth/lm-resolver.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-resolver.c	Sun Oct 11 18:03:48 2009 +0200
@@ -125,7 +125,7 @@
                                                         "Port",
                                                         "Port number",
                                                         0,
-                                                        LM_MAX_PORT, 
+                                                        LM_MAX_PORT,
                                                         0,
                                                         G_PARAM_READWRITE));
 
@@ -323,7 +323,7 @@
 }
 
 LmResolver *
-lm_resolver_new_for_service (const gchar        *domain, 
+lm_resolver_new_for_service (const gchar        *domain,
                              const gchar        *service,
                              const gchar        *protocol,
                              LmResolverCallback  callback,
@@ -343,7 +343,7 @@
                              "service", service,
                              "protocol", protocol,
                              NULL);
-        
+
     priv = GET_PRIV (resolver);
 
     priv->callback = callback;
@@ -372,7 +372,7 @@
     LM_RESOLVER_GET_CLASS(resolver)->cancel (resolver);
 }
 
-/* To iterate through the results */ 
+/* To iterate through the results */
 struct addrinfo *
 lm_resolver_results_get_next (LmResolver *resolver)
 {
@@ -414,7 +414,7 @@
 }
 
 gchar *
-_lm_resolver_create_srv_string (const gchar *domain, 
+_lm_resolver_create_srv_string (const gchar *domain,
                                 const gchar *service,
                                 const gchar *protocol)
 {
@@ -425,7 +425,7 @@
     return g_strdup_printf ("_%s._%s.%s", service, protocol, domain);
 }
 
-void 
+void
 _lm_resolver_set_result (LmResolver       *resolver,
                          LmResolverResult  result,
                          struct addrinfo  *results)
@@ -445,9 +445,9 @@
 }
 
 gboolean
-_lm_resolver_parse_srv_response (unsigned char  *srv, 
-                                 int             srv_len, 
-                                 gchar         **out_server, 
+_lm_resolver_parse_srv_response (unsigned char  *srv,
+                                 int             srv_len,
+                                 gchar         **out_server,
                                  guint          *out_port)
 {
     int                  qdcount;
@@ -502,7 +502,7 @@
         *out_server = g_strdup (pref_name);
         *out_port = pref_port;
         return TRUE;
-    } 
+    }
     return FALSE;
 }
 
--- a/loudmouth/lm-resolver.h	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-resolver.h	Sun Oct 11 18:03:48 2009 +0200
@@ -41,7 +41,7 @@
 
 struct LmResolverClass {
     GObjectClass parent_class;
-    
+
     /* <vtable> */
     void (*lookup)  (LmResolver  *resolver);
     void (*cancel)  (LmResolver  *resolver);
@@ -75,21 +75,21 @@
                                                  gpointer            user_data);
 void              lm_resolver_lookup            (LmResolver         *resolver);
 void              lm_resolver_cancel            (LmResolver         *resolver);
-/* To iterate through the results */ 
+/* To iterate through the results */
 struct addrinfo * lm_resolver_results_get_next  (LmResolver         *resolver);
 void              lm_resolver_results_reset     (LmResolver         *resolver);
 
 /* Only for sub classes */
-gchar *           _lm_resolver_create_srv_string (const gchar        *domain, 
+gchar *           _lm_resolver_create_srv_string (const gchar        *domain,
                                                   const gchar        *service,
                                                   const gchar        *protocol);
 
 void              _lm_resolver_set_result       (LmResolver         *resolver,
                                                  LmResolverResult    result,
                                                  struct addrinfo    *results);
-gboolean        _lm_resolver_parse_srv_response (unsigned char      *srv, 
-                                                 int                 srv_len, 
-                                                 gchar            **out_server, 
+gboolean        _lm_resolver_parse_srv_response (unsigned char      *srv,
+                                                 int                 srv_len,
+                                                 gchar            **out_server,
                                                  guint              *out_port);
 
 G_END_DECLS
--- a/loudmouth/lm-sasl.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-sasl.c	Sun Oct 11 18:03:48 2009 +0200
@@ -112,7 +112,7 @@
 sasl_gssapi_handle_challenge (LmSASL *sasl, LmMessageNode *node);
 
 static void
-sasl_gssapi_fail (LmSASL     *sasl, 
+sasl_gssapi_fail (LmSASL     *sasl,
                   const char *message,
                   guint32     major_status,
                   guint32     minor_status)
@@ -124,7 +124,7 @@
     gss_buffer_desc minor_status_string = GSS_C_EMPTY_BUFFER;
 
     err_major_status = gss_display_status (&err_minor_status, major_status,
-                                           GSS_C_GSS_CODE, GSS_C_NO_OID, 
+                                           GSS_C_GSS_CODE, GSS_C_NO_OID,
                                            &msg_ctx, &major_status_string);
 
     if (!GSS_ERROR(err_major_status)) {
@@ -348,7 +348,7 @@
                                     NULL);
 
     if (output_buffer_desc.value != NULL) {
-        response64 = g_base64_encode ((const guchar *) output_buffer_desc.value, 
+        response64 = g_base64_encode ((const guchar *) output_buffer_desc.value,
                                       (gsize) output_buffer_desc.length);
 
     } else {
@@ -384,7 +384,7 @@
 
     if (sasl->gss_service != GSS_C_NO_NAME) {
         major_status = gss_release_name (&minor_status, &sasl->gss_service);
-    } 
+    }
 
     if (sasl->gss_ctx != GSS_C_NO_CONTEXT) {
         major_status = gss_delete_sec_context (&minor_status, &sasl->gss_ctx,
@@ -399,7 +399,7 @@
 /* DIGEST-MD5 mechanism code from libgibber */
 
 static gchar *
-sasl_strndup_unescaped (const gchar *str, gsize len) 
+sasl_strndup_unescaped (const gchar *str, gsize len)
 {
     const gchar *s;
     gchar       *d;
@@ -421,11 +421,11 @@
     const gchar *c = challenge;
     gchar       *key, *val;
     GHashTable  *result;
-    
-    result = g_hash_table_new_full (g_str_hash, g_str_equal, 
+
+    result = g_hash_table_new_full (g_str_hash, g_str_equal,
                                     g_free, g_free);
 
-    do { 
+    do {
         while (g_ascii_isspace(*c)) c++;
 
         keystart = c;
@@ -433,7 +433,7 @@
 
         if (*c == '\0' || c == keystart) goto error;
 
-        keyend = c; 
+        keyend = c;
         c++;
 
         if (*c == '"') {
@@ -459,7 +459,7 @@
 
     return result;
  error:
-    g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL, 
+    g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL,
            "Failed to parse challenge: %s", challenge);
 
     g_hash_table_destroy (result);
@@ -467,7 +467,7 @@
 }
 
 static gchar *
-sasl_md5_hex_hash (gchar *value, gsize len) 
+sasl_md5_hex_hash (gchar *value, gsize len)
 {
     md5_byte_t   digest_md5[16];
     md5_state_t  md5_calc;
@@ -493,7 +493,7 @@
     /* RFC 2831 recommends the the nonce to be either hexadecimal or base64 with
      * at least 64 bits of entropy */
 #define NR 8
-    guint32 n[NR]; 
+    guint32 n[NR];
     int i;
 
     for (i = 0; i < NR; i++) {
@@ -521,7 +521,7 @@
         g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL,
                "%s: no authentication parameters provided", G_STRFUNC);
         if (sasl->handler) {
-            sasl->handler (sasl, sasl->connection, 
+            sasl->handler (sasl, sasl->connection,
                            FALSE, "no username/password provided");
         }
         goto error;
@@ -530,7 +530,7 @@
     nonce = g_hash_table_lookup (challenge, "nonce");
     if (nonce == NULL || nonce == '\0') {
         g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL,
-               "%s: server didn't provide a nonce in the challenge", 
+               "%s: server didn't provide a nonce in the challenge",
                G_STRFUNC);
         if (sasl->handler) {
             sasl->handler (sasl, sasl->connection,
@@ -556,10 +556,10 @@
     /* FIXME should check if auth is in the cop challenge val */
     g_string_append_printf (response, ",qop=auth,charset=utf-8");
 
-    tmp = g_strdup_printf ("%s:%s:%s", 
-                           lm_auth_parameters_get_username (sasl->auth_params), 
+    tmp = g_strdup_printf ("%s:%s:%s",
+                           lm_auth_parameters_get_username (sasl->auth_params),
                            realm, lm_auth_parameters_get_password (sasl->auth_params));
-        
+
     md5_init (&md5_calc);
     md5_append (&md5_calc, (const md5_byte_t *)tmp, strlen(tmp));
     md5_finish (&md5_calc, digest_md5);
@@ -624,7 +624,7 @@
         return FALSE;
     }
 
-    response64 = g_base64_encode ((const guchar *) response, 
+    response64 = g_base64_encode ((const guchar *) response,
                                   (gsize) strlen(response));
 
     msg = lm_message_new (NULL, LM_MESSAGE_TYPE_RESPONSE);
@@ -662,7 +662,7 @@
                G_STRFUNC);
 
         if (sasl->handler) {
-            sasl->handler (sasl, sasl->connection, 
+            sasl->handler (sasl, sasl->connection,
                            TRUE, "server error");
         }
         return FALSE;
@@ -670,7 +670,7 @@
 
     if (strcmp (sasl->digest_md5_rspauth, rspauth) != 0) {
         g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SSL,
-               "%s: server sent an invalid reply (rspauth not matching)\n", 
+               "%s: server sent an invalid reply (rspauth not matching)\n",
                G_STRFUNC);
 
         if (sasl->handler) {
@@ -721,7 +721,7 @@
         g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL,
                "%s: server sent an invalid challenge", G_STRFUNC);
         if (sasl->handler) {
-            sasl->handler (sasl, sasl->connection, 
+            sasl->handler (sasl, sasl->connection,
                            FALSE, "server error");
         }
         return FALSE;
@@ -729,14 +729,14 @@
 
     switch (sasl->state) {
     case SASL_AUTH_STATE_DIGEST_MD5_STARTED:
-        sasl_digest_md5_send_initial_response (sasl, h); 
+        sasl_digest_md5_send_initial_response (sasl, h);
         break;
     case SASL_AUTH_STATE_DIGEST_MD5_SENT_AUTH_RESPONSE:
-        sasl_digest_md5_check_server_response (sasl, h); 
+        sasl_digest_md5_check_server_response (sasl, h);
         break;
     default:
         g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL,
-               "%s: server sent a challenge at the wrong time", 
+               "%s: server sent a challenge at the wrong time",
                G_STRFUNC);
         if (sasl->handler) {
             sasl->handler (sasl, sasl->connection,
@@ -744,7 +744,7 @@
         }
 
         return FALSE;
-    } 
+    }
 
     g_hash_table_destroy(h);
 
@@ -774,7 +774,7 @@
                G_STRFUNC);
 
         if (sasl->handler) {
-            sasl->handler (sasl, sasl->connection, 
+            sasl->handler (sasl, sasl->connection,
                            FALSE, "server error");
         }
         break;
@@ -802,7 +802,7 @@
 {
     LmSASL      *sasl;
     const gchar *ns;
-    
+
     ns = lm_message_node_get_attribute (message->node, "xmlns");
     if (!ns || strcmp (ns, XMPP_NS_SASL_AUTH) != 0) {
         return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
@@ -814,10 +814,10 @@
     case AUTH_TYPE_PLAIN:
         if (sasl->state != SASL_AUTH_STATE_PLAIN_STARTED) {
             g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL,
-                   "%s: server sent success before finishing auth", 
+                   "%s: server sent success before finishing auth",
                    G_STRFUNC);
             if (sasl->handler) {
-                sasl->handler (sasl, sasl->connection, 
+                sasl->handler (sasl, sasl->connection,
                                FALSE, "server error");
             }
         }
@@ -826,10 +826,10 @@
         if (sasl->state != SASL_AUTH_STATE_DIGEST_MD5_SENT_AUTH_RESPONSE &&
             sasl->state != SASL_AUTH_STATE_DIGEST_MD5_SENT_FINAL_RESPONSE) {
             g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL,
-                   "%s: server sent success before finishing auth", 
+                   "%s: server sent success before finishing auth",
                    G_STRFUNC);
             if (sasl->handler) {
-                sasl->handler (sasl, sasl->connection, 
+                sasl->handler (sasl, sasl->connection,
                                FALSE, "server error");
             }
         }
@@ -839,7 +839,7 @@
         if (sasl->state != SASL_AUTH_STATE_GSSAPI_SENT_AUTH_RESPONSE &&
             sasl->state != SASL_AUTH_STATE_GSSAPI_SENT_FINAL_RESPONSE) {
             sasl_gssapi_finish(sasl, message->node);
-            g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL, 
+            g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL,
                    "%s: server sent success before starting auth",
                    G_STRFUNC);
             if (sasl->handler) {
@@ -862,7 +862,7 @@
     }
 
     return LM_HANDLER_RESULT_REMOVE_MESSAGE;
-    
+
 }
 
 static LmHandlerResult
@@ -874,7 +874,7 @@
     LmSASL      *sasl;
     const gchar *ns;
     const gchar *reason = "unknown reason";
-    
+
     ns = lm_message_node_get_attribute (message->node, "xmlns");
     if (!ns || strcmp (ns, XMPP_NS_SASL_AUTH) != 0) {
         return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
@@ -884,13 +884,13 @@
 
     if (message->node->children) {
         const gchar *r;
-        
+
         r = lm_message_node_get_value (message->node->children);
         if (r) {
             reason = r;
         }
     }
-    
+
     g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL,
            "%s: SASL authentication failed: %s", G_STRFUNC, reason);
 
@@ -922,7 +922,7 @@
 
         if (sasl->auth_params == NULL) {
             g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL,
-                   "%s: no authentication parameters provided", 
+                   "%s: no authentication parameters provided",
                    G_STRFUNC);
             if (sasl->handler) {
                 sasl->handler (sasl, sasl->connection, FALSE, "no username/password provided");
@@ -935,7 +935,7 @@
         g_string_append (str, lm_auth_parameters_get_username (sasl->auth_params));
         g_string_append_c (str, '\0');
         g_string_append (str, lm_auth_parameters_get_password (sasl->auth_params));
-        cstr = g_base64_encode ((const guchar *) str->str, 
+        cstr = g_base64_encode ((const guchar *) str->str,
                                 (gsize) str->len);
 
         lm_message_node_set_value (auth_msg->node, cstr);
@@ -949,7 +949,7 @@
                                         "ga:client-uses-full-bind-result", "true",
                                         NULL);
 
-    } 
+    }
     else if (sasl->auth_type == AUTH_TYPE_DIGEST) {
         mech = "DIGEST-MD5";
         sasl->state = SASL_AUTH_STATE_DIGEST_MD5_STARTED;
@@ -1009,7 +1009,7 @@
             sasl->auth_type |= AUTH_TYPE_GSSAPI;
             continue;
         }
-        
+
         g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SASL,
                "%s: unknown SASL auth mechanism: %s", G_STRFUNC, name);
     }
@@ -1043,7 +1043,7 @@
     else if (sasl->auth_type & AUTH_TYPE_PLAIN) {
         sasl->auth_type = AUTH_TYPE_PLAIN;
         return sasl_start (sasl);
-    } 
+    }
 
     return FALSE;
 }
@@ -1079,7 +1079,7 @@
 lm_sasl_new (LmConnection *connection)
 {
     LmSASL *sasl;
-    
+
     sasl = g_new0 (LmSASL, 1);
 
     sasl->connection = connection;
@@ -1114,7 +1114,7 @@
                                             sasl->challenge_cb,
                                             LM_MESSAGE_TYPE_CHALLENGE,
                                             LM_HANDLER_PRIORITY_FIRST);
-    
+
     sasl->success_cb = lm_message_handler_new (sasl_success_cb,
                                                sasl,
                                                NULL);
@@ -1142,7 +1142,7 @@
 lm_sasl_free (LmSASL *sasl)
 {
     g_return_if_fail (sasl != NULL);
-    
+
     if (sasl->auth_params) {
         lm_auth_parameters_unref (sasl->auth_params);
     }
@@ -1151,7 +1151,7 @@
 
     if (sasl->features_cb) {
         lm_connection_unregister_message_handler (sasl->connection,
-                                                  sasl->features_cb, 
+                                                  sasl->features_cb,
                                                   LM_MESSAGE_TYPE_STREAM_FEATURES);
     }
 
--- a/loudmouth/lm-sasl.h	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-sasl.h	Sun Oct 11 18:03:48 2009 +0200
@@ -40,7 +40,7 @@
 
 LmSASL *           lm_sasl_new              (LmConnection         *connection);
 
-void               lm_sasl_authenticate     (LmSASL               *sasl, 
+void               lm_sasl_authenticate     (LmSASL               *sasl,
                                              LmAuthParameters     *auth_params,
                                              const gchar          *server,
                                              LmSASLResultHandler   handler);
--- a/loudmouth/lm-simple-io.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-simple-io.c	Sun Oct 11 18:03:48 2009 +0200
@@ -72,7 +72,7 @@
                                                           "My Property",
                                                           NULL,
                                                           G_PARAM_READWRITE));
-    
+
     g_type_class_add_private (object_class, sizeof (LmSimpleIOPriv));
 }
 
--- a/loudmouth/lm-sock.h	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-sock.h	Sun Oct 11 18:03:48 2009 +0200
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
- * Copyright (C) 2006 Imendio AB 
+ * Copyright (C) 2006 Imendio AB
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License as
@@ -50,7 +50,7 @@
 /* This means that we require Windows XP or above to build on
  * Windows, the reason for this, is that getaddrinfo() and
  * freeaddrinfo() require ws2tcpip.h functions that are only available
- * on these platforms. 
+ * on these platforms.
  *
  * This MUST be defined before windows.h is included.
  */
--- a/loudmouth/lm-socket.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-socket.c	Sun Oct 11 18:03:48 2009 +0200
@@ -72,7 +72,7 @@
                           _lm_marshal_VOID__VOID,
                           G_TYPE_NONE,
                           0);
-        signals[WRITABLE] = 
+        signals[WRITABLE] =
             g_signal_new ("writable",
                           LM_TYPE_SOCKET,
                           G_SIGNAL_RUN_LAST,
@@ -111,7 +111,7 @@
     return NULL;
 }
 
-void 
+void
 lm_socket_connect (LmSocket *socket)
 {
     g_return_if_fail (LM_IS_SOCKET (socket));
@@ -155,7 +155,7 @@
     return LM_SOCKET_GET_IFACE(socket)->read (socket, buf, buf_len, read_len);
 }
 
-void 
+void
 lm_socket_disconnect (LmSocket *socket)
 {
     g_return_if_fail (LM_IS_SOCKET (socket));
--- a/loudmouth/lm-ssl-base.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-ssl-base.c	Sun Oct 11 18:03:48 2009 +0200
@@ -22,7 +22,7 @@
 #include "lm-ssl-internals.h"
 
 void
-_lm_ssl_base_init (LmSSLBase      *base, 
+_lm_ssl_base_init (LmSSLBase      *base,
                    const gchar    *expected_fingerprint,
                    LmSSLFunction   ssl_function,
                    gpointer        user_data,
@@ -33,7 +33,7 @@
     base->func_data      = user_data;
     base->data_notify    = notify;
     base->fingerprint[0] = '\0';
-    
+
     if (expected_fingerprint) {
         base->expected_fingerprint = g_memdup (expected_fingerprint, 16);
     } else {
--- a/loudmouth/lm-ssl-base.h	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-ssl-base.h	Sun Oct 11 18:03:48 2009 +0200
@@ -38,7 +38,7 @@
     gint            ref_count;
 };
 
-void _lm_ssl_base_init         (LmSSLBase      *base, 
+void _lm_ssl_base_init         (LmSSLBase      *base,
                                 const gchar    *expected_fingerprint,
                                 LmSSLFunction   ssl_function,
                                 gpointer        user_data,
--- a/loudmouth/lm-ssl-generic.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-ssl-generic.c	Sun Oct 11 18:03:48 2009 +0200
@@ -24,7 +24,7 @@
 #include "lm-ssl-base.h"
 #include "lm-ssl-internals.h"
 
-LmSSLResponse  
+LmSSLResponse
 _lm_ssl_func_always_continue (LmSSL       *ssl,
                               LmSSLStatus  status,
                               gpointer     user_data)
@@ -71,13 +71,13 @@
     return G_IO_STATUS_EOF;
 }
 
-gboolean 
+gboolean
 _lm_ssl_send (LmSSL *ssl, const gchar *str, gint len)
 {
     /* NOOP */
     return TRUE;
 }
-void 
+void
 _lm_ssl_close (LmSSL *ssl)
 {
     /* NOOP */
@@ -100,7 +100,7 @@
  * @user_data: Data sent with the callback.
  * @notify: Function to free @user_dataa when the connection is finished. %NULL if @user_data should not be freed.
  *
- * Creates a new SSL struct, call #lm_connection_set_ssl to use it. 
+ * Creates a new SSL struct, call #lm_connection_set_ssl to use it.
  *
  * Return value: A new #LmSSL struct.
  **/
@@ -111,7 +111,7 @@
             GDestroyNotify  notify)
 {
     /* The implementation of this function will be different depending
-     * on which implementation is used 
+     * on which implementation is used
      */
     return _lm_ssl_new (expected_fingerprint,
                         ssl_function, user_data, notify);
@@ -136,27 +136,27 @@
 
 
 /**
- * lm_ssl_get_fingerprint: 
+ * lm_ssl_get_fingerprint:
  * @ssl: an #LmSSL
  *
  * Returns the MD5 fingerprint of the remote server's certificate.
- * 
+ *
  * Return value: A 16-byte array representing the fingerprint or %NULL if unknown.
  **/
 const gchar *
 lm_ssl_get_fingerprint (LmSSL *ssl)
 {
     g_return_val_if_fail (ssl != NULL, NULL);
-    
+
     return LM_SSL_BASE(ssl)->fingerprint;
 }
 
 /**
  * lm_ssl_ref:
  * @ssl: an #LmSSL
- * 
+ *
  * Adds a reference to @ssl.
- * 
+ *
  * Return value: the ssl
  **/
 LmSSL *
@@ -218,26 +218,26 @@
 /**
  * lm_ssl_unref
  * @ssl: an #LmSSL
- * 
+ *
  * Removes a reference from @ssl. When no more references are present
  * @ssl is freed.
  **/
-void 
+void
 lm_ssl_unref (LmSSL *ssl)
 {
     LmSSLBase *base;
-    
+
     g_return_if_fail (ssl != NULL);
-        
+
     base = LM_SSL_BASE (ssl);
 
     base->ref_count --;
-        
+
     if (base->ref_count == 0) {
         if (base->data_notify) {
             (* base->data_notify) (base->func_data);
         }
-             
+
         _lm_ssl_free (ssl);
     }
 }
--- a/loudmouth/lm-ssl-gnutls.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-ssl-gnutls.c	Sun Oct 11 18:03:48 2009 +0200
@@ -82,7 +82,7 @@
             return FALSE;
         }
     }
-    
+
     if (status & GNUTLS_CERT_INVALID
         || status & GNUTLS_CERT_REVOKED) {
         if (base->func (ssl, LM_SSL_STATUS_UNTRUSTED_CERT,
@@ -90,27 +90,27 @@
             return FALSE;
         }
     }
-    
+
     if (gnutls_certificate_expiration_time_peers (ssl->gnutls_session) < time (0)) {
         if (base->func (ssl, LM_SSL_STATUS_CERT_EXPIRED,
                         base->func_data) != LM_SSL_RESPONSE_CONTINUE) {
             return FALSE;
         }
     }
-    
+
     if (gnutls_certificate_activation_time_peers (ssl->gnutls_session) > time (0)) {
         if (base->func (ssl, LM_SSL_STATUS_CERT_NOT_ACTIVATED,
                         base->func_data) != LM_SSL_RESPONSE_CONTINUE) {
             return FALSE;
         }
     }
-    
+
     if (gnutls_certificate_type_get (ssl->gnutls_session) == GNUTLS_CRT_X509) {
         const gnutls_datum* cert_list;
         guint cert_list_size;
         size_t digest_size;
         gnutls_x509_crt cert;
-        
+
         cert_list = gnutls_certificate_get_peers (ssl->gnutls_session, &cert_list_size);
         if (cert_list == NULL) {
             if (base->func (ssl, LM_SSL_STATUS_NO_CERT_FOUND,
@@ -123,7 +123,7 @@
 
         if (gnutls_x509_crt_import (cert, &cert_list[0],
                                     GNUTLS_X509_FMT_DER) != 0) {
-            if (base->func (ssl, LM_SSL_STATUS_NO_CERT_FOUND, 
+            if (base->func (ssl, LM_SSL_STATUS_NO_CERT_FOUND,
                             base->func_data) != LM_SSL_RESPONSE_CONTINUE) {
                 return FALSE;
             }
@@ -144,7 +144,7 @@
                                 base->fingerprint,
                                 &digest_size) >= 0) {
             if (base->expected_fingerprint &&
-                memcmp (base->expected_fingerprint, 
+                memcmp (base->expected_fingerprint,
                         base->fingerprint,
                         digest_size) &&
                 base->func (ssl,
@@ -152,11 +152,11 @@
                             base->func_data) != LM_SSL_RESPONSE_CONTINUE) {
                 return FALSE;
             }
-        } 
+        }
         else if (base->func (ssl, LM_SSL_STATUS_GENERIC_ERROR,
                              base->func_data) != LM_SSL_RESPONSE_CONTINUE) {
-            return FALSE; 
-        } 
+            return FALSE;
+        }
     }
 
     return TRUE;
@@ -182,7 +182,7 @@
 }
 
 void
-_lm_ssl_initialize (LmSSL *ssl) 
+_lm_ssl_initialize (LmSSL *ssl)
 {
     gnutls_global_init ();
     gnutls_certificate_allocate_credentials (&ssl->gnutls_xcred);
@@ -229,10 +229,10 @@
             errmsg = "handshake failed";
         }
 
-        g_set_error (error, 
+        g_set_error (error,
                      LM_ERROR, LM_ERROR_CONNECTION_OPEN,
                      "*** GNUTLS %s: %s",
-                     errmsg, gnutls_strerror (ret));            
+                     errmsg, gnutls_strerror (ret));
 
         return FALSE;
     }
@@ -283,15 +283,15 @@
             bytes_written != GNUTLS_E_AGAIN) {
             return -1;
         }
-    
-        bytes_written = gnutls_record_send (ssl->gnutls_session, 
+
+        bytes_written = gnutls_record_send (ssl->gnutls_session,
                                             str, len);
     }
 
     return bytes_written;
 }
 
-void 
+void
 _lm_ssl_close (LmSSL *ssl)
 {
     if (!ssl->started)
--- a/loudmouth/lm-ssl-openssl.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-ssl-openssl.c	Sun Oct 11 18:03:48 2009 +0200
@@ -106,7 +106,7 @@
   return _ssl_error_code;
   }*/
 
-    
+
 int
 ssl_verify_cb (int preverify_ok, X509_STORE_CTX *x509_ctx)
 {
@@ -204,14 +204,14 @@
       }*/
     crt_subj = X509_get_subject_name(srv_crt);
     cn = (gchar *) g_malloc0(LM_SSL_CN_MAX + 1);
-    
+
     if (X509_NAME_get_text_by_NID(crt_subj, NID_commonName, cn, LM_SSL_CN_MAX) > 0) {
         gchar *domain = cn;
 
         g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SSL,
                "%s: server = '%s', cn = '%s'\n",
                __FILE__, server, cn);
-        
+
         if ((cn[0] == '*') && (cn[1] == '.')) {
             domain = strstr (cn, server);
         }
@@ -227,7 +227,7 @@
         g_warning ("X509_NAME_get_text_by_NID() failed");
     }
 
-    g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SSL, 
+    g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_SSL,
            "%s:\n\tIssuer: %s\n\tSubject: %s\n\tFor: %s\n",
            __FILE__,
            X509_NAME_oneline(X509_get_issuer_name(srv_crt), NULL, 0),
@@ -235,7 +235,7 @@
            cn);
 
     g_free(cn);
-    
+
     return retval;
 }
 
@@ -283,7 +283,7 @@
 }
 
 void
-_lm_ssl_initialize (LmSSL *ssl) 
+_lm_ssl_initialize (LmSSL *ssl)
 {
     static gboolean initialized = FALSE;
     /*const char *cert_file = NULL;*/
@@ -306,8 +306,8 @@
         abort();
     }
 
-    /* Set the NO_TICKET option on the context to allow for talk to Google Talk 
-     * which apparently seems to be having a problem handling empty session 
+    /* Set the NO_TICKET option on the context to allow for talk to Google Talk
+     * which apparently seems to be having a problem handling empty session
      * tickets due to a bug in Java.
      *
      * See http://twistedmatrix.com/trac/ticket/3463 and
@@ -382,8 +382,8 @@
                      "*** SSL certificate verification failed");
         return FALSE;
     }
-    
-    return TRUE; 
+
+    return TRUE;
 }
 
 GIOStatus
@@ -398,7 +398,7 @@
     if (status == G_IO_STATUS_NORMAL) {
         *bytes_read = ssl_ret;
     }
-    
+
     return status;
 }
 
@@ -420,7 +420,7 @@
     return ssl_ret;
 }
 
-void 
+void
 _lm_ssl_close (LmSSL *ssl)
 {
     if (ssl->ssl != NULL) {
--- a/loudmouth/lm-ssl.h	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-ssl.h	Sun Oct 11 18:03:48 2009 +0200
@@ -22,13 +22,13 @@
  * SECTION:lm-ssl
  * @Title: LmSSL
  * @Short_description: SSL struct for SSL support in Loudmouth
- * 
+ *
  * Use this together with an #LmConnection to get the connection to use SSL. Example of how to use the #LmSSL API.
- * 
+ *
  * <informalexample><programlisting><![CDATA[
  * LmConnection *connection;
  * LmSSL        *ssl;
- * 
+ *
  * connection = lm_connection_new ("myserver");
  * ssl = lm_ssl_new (NULL, my_ssl_func, NULL, NULL);
  * lm_connection_set_ssl (connection, ssl);
@@ -49,7 +49,7 @@
 
 /**
  * LmSSL:
- * 
+ *
  * This should not be accessed directly. Use the accessor functions as described below.
  */
 typedef struct _LmSSL LmSSL;
@@ -59,7 +59,7 @@
  * @LM_CERT_INVALID: The certificate is invalid.
  * @LM_CERT_ISSUER_NOT_FOUND: The issuer of the certificate is not found.
  * @LM_CERT_REVOKED: The certificate has been revoked.
- * 
+ *
  * Provides information of the status of a certain certificate.
  */
 typedef enum {
@@ -77,16 +77,16 @@
  * @LM_SSL_STATUS_CERT_HOSTNAME_MISMATCH: The server hostname doesn't match the one in the certificate.
  * @LM_SSL_STATUS_CERT_FINGERPRINT_MISMATCH: The fingerprint doesn't match your expected.
  * @LM_SSL_STATUS_GENERIC_ERROR: Some other error.
- * 
+ *
  * Provides information about something gone wrong when trying to setup the SSL connection.
  */
 typedef enum {
-    LM_SSL_STATUS_NO_CERT_FOUND,    
+    LM_SSL_STATUS_NO_CERT_FOUND,
     LM_SSL_STATUS_UNTRUSTED_CERT,
     LM_SSL_STATUS_CERT_EXPIRED,
     LM_SSL_STATUS_CERT_NOT_ACTIVATED,
-    LM_SSL_STATUS_CERT_HOSTNAME_MISMATCH,           
-    LM_SSL_STATUS_CERT_FINGERPRINT_MISMATCH,            
+    LM_SSL_STATUS_CERT_HOSTNAME_MISMATCH,
+    LM_SSL_STATUS_CERT_FINGERPRINT_MISMATCH,
     LM_SSL_STATUS_GENERIC_ERROR
 } LmSSLStatus;
 
@@ -94,7 +94,7 @@
  * LmSSLResponse:
  * @LM_SSL_RESPONSE_CONTINUE: Continue to connect.
  * @LM_SSL_RESPONSE_STOP: Stop the connection.
- * 
+ *
  * Used to inform #LmConnection if you want to stop due to an error reported or if you want to continue to connect.
  */
 typedef enum {
@@ -107,9 +107,9 @@
  * @ssl: An #LmSSL.
  * @status: The status informing what went wrong.
  * @user_data: User data provided in the callback.
- * 
+ *
  * This function is called if something goes wrong during the connecting phase.
- * 
+ *
  * Returns: User should return #LM_SSL_RESPONSE_CONTINUE if connection should proceed and otherwise #LM_SSL_RESPONSE_STOP.
  */
 typedef LmSSLResponse (* LmSSLFunction)      (LmSSL        *ssl,
--- a/loudmouth/lm-utils.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/lm-utils.c	Sun Oct 11 18:03:48 2009 +0200
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
- * Copyright (C) 2003 Imendio AB 
+ * Copyright (C) 2003 Imendio AB
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License as
@@ -22,7 +22,7 @@
  * SECTION:lm-utils
  * @Title: Miscellaneous Utility Functions
  * @Short_description: Miscellaneous Utility Functions
- * 
+ *
  * Functions to help application developers when writing XMPP applications using Loudmouth.
  */
 
@@ -48,12 +48,12 @@
 #include "lm-utils.h"
 
 LmCallback *
-_lm_utils_new_callback (gpointer       func, 
+_lm_utils_new_callback (gpointer       func,
                         gpointer       user_data,
                         GDestroyNotify notify)
 {
     LmCallback *cb;
-    
+
     cb = g_new0 (LmCallback, 1);
     cb->func = func;
     cb->user_data = user_data;
@@ -84,7 +84,7 @@
 
     g_get_current_time (&tv);
     val = (tv.tv_sec & tv.tv_usec) + last_id++;
-        
+
     return g_strdup_printf ("%ld%ld", val, tv.tv_usec);
 }
 
@@ -123,7 +123,7 @@
  * @stamp: An XMPP timestamp
  *
  * Converts an XMPP timestamp to a struct tm showing local time.
- * 
+ *
  * Return value: The local time struct.
  **/
 struct tm *
@@ -132,12 +132,12 @@
     struct tm tm;
     time_t    t;
     gint      year, month;
-    
+
     g_return_val_if_fail (stamp != NULL, NULL);
 
     /* 20021209T23:51:30 */
 
-    sscanf (stamp, "%4d%2d%2dT%2d:%2d:%2d", 
+    sscanf (stamp, "%4d%2d%2dT%2d:%2d:%2d",
             &year, &month, &tm.tm_mday, &tm.tm_hour,
             &tm.tm_min, &tm.tm_sec);
 
@@ -154,7 +154,7 @@
     if (tm.tm_isdst > 0) {
         t += 3600;
     }
-#endif  
+#endif
 
     return localtime (&t);
 }
--- a/loudmouth/md5.h	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/md5.h	Sun Oct 11 18:03:48 2009 +0200
@@ -72,7 +72,7 @@
 } md5_state_t;
 
 #ifdef __cplusplus
-extern "C" 
+extern "C"
 {
 #endif
 
--- a/loudmouth/test-dns.c	Sat Oct 10 23:17:16 2009 +0200
+++ b/loudmouth/test-dns.c	Sun Oct 11 18:03:48 2009 +0200
@@ -2,7 +2,7 @@
 
 #include <loudmouth.h>
 #include "lm-blocking-resolver.h"
-        
+
 GMainLoop *main_loop;
 
 static void