Added inlined documentation from generated through the Gtk-doc migration script.
authorMikael Hallendal <micke@imendio.com>
Sat, 21 Jun 2008 13:19:21 +0200
changeset 417 364c17252e5f
parent 416 70e99906149f
child 418 a8af09193258
Added inlined documentation from generated through the Gtk-doc migration script. Started moving the documentation from the tmpl file to code inline to not have it spread out over to different places and files.
loudmouth/lm-connection.c
loudmouth/lm-connection.h
loudmouth/lm-error.c
loudmouth/lm-error.h
loudmouth/lm-message-handler.c
loudmouth/lm-message-handler.h
loudmouth/lm-message-node.c
loudmouth/lm-message-node.h
loudmouth/lm-message.c
loudmouth/lm-message.h
loudmouth/lm-proxy.c
loudmouth/lm-proxy.h
loudmouth/lm-ssl.h
loudmouth/lm-utils.c
--- a/loudmouth/lm-connection.c	Fri Jun 20 17:14:45 2008 +0200
+++ b/loudmouth/lm-connection.c	Sat Jun 21 13:19:21 2008 +0200
@@ -20,6 +20,50 @@
  * Boston, MA 02111-1307, USA.
  */
 
+/**
+ * SECTION:LmConnection
+ * @Short_description: A client connection to the server
+ * 
+ * An example of how to use Loudmouth with the synchronous API.
+ * <informalexample><programlisting>
+ * int
+ * main (int argc, char **argv)
+ * {
+ *         LmConnection *connection;
+ *         GError       *error = NULL;
+ *         gint          i;
+ * 	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", 
+ * 						   "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>
+ */
+
 #include <config.h>
 
 #include <string.h>
--- a/loudmouth/lm-connection.h	Fri Jun 20 17:14:45 2008 +0200
+++ b/loudmouth/lm-connection.h	Sat Jun 21 13:19:21 2008 +0200
@@ -31,26 +31,67 @@
 
 G_BEGIN_DECLS
 
+/**
+ * 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
 
 typedef struct _LmConnection LmConnection;
 
 typedef struct LmMessageHandler LmMessageHandler;
 
+/**
+ * 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 {
 	LM_HANDLER_RESULT_REMOVE_MESSAGE,
 	LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS
 } LmHandlerResult;
- 
+
+/**
+ * LmHandlerPriority:
+ * @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 {
 	LM_HANDLER_PRIORITY_LAST   = 1,
 	LM_HANDLER_PRIORITY_NORMAL = 2,
 	LM_HANDLER_PRIORITY_FIRST  = 3
 } LmHandlerPriority;
 
+/**
+ * LmDisconnectReason:
+ * @LM_DISCONNECT_REASON_OK:  * @LM_DISCONNECT_REASON_PING_TIME_OUT: Connection to the server timed out.
+ * @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 {
 	LM_DISCONNECT_REASON_OK,
 	LM_DISCONNECT_REASON_PING_TIME_OUT,
@@ -61,6 +102,16 @@
 	LM_DISCONNECT_REASON_UNKNOWN
 } LmDisconnectReason;
 
+/**
+ * LmConnectionState:
+ * @LM_CONNECTION_STATE_CLOSED: The connection is closed.
+ * @LM_CONNECTION_STATE_OPENING: The connection is in the process of opening.
+ * @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 {
 	LM_CONNECTION_STATE_CLOSED,
 	LM_CONNECTION_STATE_OPENING,
@@ -69,10 +120,26 @@
 	LM_CONNECTION_STATE_AUTHENTICATED
 } LmConnectionState;
 
+/**
+ * LmResultFunction:
+ * @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,
 						gboolean            success,
 						gpointer            user_data);
 
+/**
+ * LmDisconnectFunction:
+ * @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,
 						LmDisconnectReason  reason,
 						gpointer            user_data);
--- a/loudmouth/lm-error.c	Fri Jun 20 17:14:45 2008 +0200
+++ b/loudmouth/lm-error.c	Sat Jun 21 13:19:21 2008 +0200
@@ -18,6 +18,11 @@
  * Boston, MA 02111-1307, USA.
  */
 
+/**
+ * SECTION:LmError
+ * @Short_description: Error reporting.
+ */
+
 #include <config.h>
 #include <glib/gerror.h>
 #include "lm-error.h"
--- a/loudmouth/lm-error.h	Fri Jun 20 17:14:45 2008 +0200
+++ b/loudmouth/lm-error.h	Sat Jun 21 13:19:21 2008 +0200
@@ -29,8 +29,21 @@
 
 G_BEGIN_DECLS
 
+/**
+ * LM_ERROR:
+ * 
+ * Macro for getting the error quark.
+ */
 #define LM_ERROR lm_error_quark ()
 
+/**
+ * LmError:
+ * @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:  * 
+ * Describes the problem of the error.
+ */
 typedef enum {
         LM_ERROR_CONNECTION_NOT_OPEN,
         LM_ERROR_CONNECTION_OPEN,
--- a/loudmouth/lm-message-handler.c	Fri Jun 20 17:14:45 2008 +0200
+++ b/loudmouth/lm-message-handler.c	Sat Jun 21 13:19:21 2008 +0200
@@ -18,6 +18,13 @@
  * Boston, MA 02111-1307, USA.
  */
 
+/**
+ * SECTION: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.
+ */
+
 #include <config.h>
 
 #include "lm-internals.h"
--- a/loudmouth/lm-message-handler.h	Fri Jun 20 17:14:45 2008 +0200
+++ b/loudmouth/lm-message-handler.h	Sat Jun 21 13:19:21 2008 +0200
@@ -29,6 +29,17 @@
 
 G_BEGIN_DECLS
 
+/**
+ * LmHandleMessageFunction:
+ * @handler: an #LmMessageHandler
+ * @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,
 						     LmConnection     *connection,
 						     LmMessage        *message,
--- a/loudmouth/lm-message-node.c	Fri Jun 20 17:14:45 2008 +0200
+++ b/loudmouth/lm-message-node.c	Sat Jun 21 13:19:21 2008 +0200
@@ -18,6 +18,11 @@
  * Boston, MA 02111-1307, USA.
  */
 
+/**
+ * SECTION:LmMessageNode
+ * @Short_description: A node in the message tree
+ */
+
 #include <config.h>
 #include <string.h>
 
--- a/loudmouth/lm-message-node.h	Fri Jun 20 17:14:45 2008 +0200
+++ b/loudmouth/lm-message-node.h	Sat Jun 21 13:19:21 2008 +0200
@@ -29,6 +29,18 @@
 
 G_BEGIN_DECLS
 
+/**
+ * LmMessageNode:
+ * @name: the name of the node
+ * @value: value of the node, can be NULL
+ * @raw_mode: if true, don't escape the content of the message. The content must be valid XML.
+ * @next: next sibling
+ * @prev: previous sibling
+ * @parent: node parent
+ * @children: pointing to first child
+ * 
+ * A struct representing a node in a message. 
+ */
 typedef struct _LmMessageNode LmMessageNode;
 
 struct _LmMessageNode {
--- a/loudmouth/lm-message.c	Fri Jun 20 17:14:45 2008 +0200
+++ b/loudmouth/lm-message.c	Sat Jun 21 13:19:21 2008 +0200
@@ -18,6 +18,13 @@
  * Boston, MA 02111-1307, USA.
  */
 
+/**
+ * SECTION: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.
+ */
+
 #include <config.h>
 #include <string.h>
 
--- a/loudmouth/lm-message.h	Fri Jun 20 17:14:45 2008 +0200
+++ b/loudmouth/lm-message.h	Sat Jun 21 13:19:21 2008 +0200
@@ -37,6 +37,17 @@
 	LmMessagePriv *priv;
 } LmMessage;
 
+/**
+ * LmMessageType:
+ * @LM_MESSAGE_TYPE_MESSAGE: a message, <message/>
+ * @LM_MESSAGE_TYPE_PRESENCE: a presence element, <presence/>
+ * @LM_MESSAGE_TYPE_IQ: an info/query element, <iq/>
+ * @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 {
 	LM_MESSAGE_TYPE_MESSAGE,
 	LM_MESSAGE_TYPE_PRESENCE,
@@ -54,6 +65,26 @@
 	LM_MESSAGE_TYPE_UNKNOWN
 } LmMessageType;
 
+/**
+ * LmMessageSubType:
+ * @LM_MESSAGE_SUB_TYPE_NOT_SET: the default. No "type" attribute will be sent.
+ * @LM_MESSAGE_SUB_TYPE_AVAILABLE: presence is available, applies to message type "presence"
+ * @LM_MESSAGE_SUB_TYPE_NORMAL:  * @LM_MESSAGE_SUB_TYPE_CHAT: message is a chat message, applies to message type "message"
+ * @LM_MESSAGE_SUB_TYPE_GROUPCHAT: message is a group chat message, applies to message type "message"
+ * @LM_MESSAGE_SUB_TYPE_HEADLINE: message is a headline message, applies to message type "message"
+ * @LM_MESSAGE_SUB_TYPE_UNAVAILABLE: presence is unavailable, applies to message type "presence"
+ * @LM_MESSAGE_SUB_TYPE_PROBE: a probe presence, applies to message type "presence"
+ * @LM_MESSAGE_SUB_TYPE_SUBSCRIBE: try to subscribe to another jids presence, applies to message type "presence"
+ * @LM_MESSAGE_SUB_TYPE_UNSUBSCRIBE: unsubscribes from another jids presence, applies to message type "presence"
+ * @LM_MESSAGE_SUB_TYPE_SUBSCRIBED: reply from a subscribe message, informs that the subscription was successful. Applies to message type "presence"
+ * @LM_MESSAGE_SUB_TYPE_UNSUBSCRIBED: reply from subscribe or unsubscribe message. If it's a reply from a subscribe message it notifies that the subscription failed. Applies to message type "presence"
+ * @LM_MESSAGE_SUB_TYPE_GET: used to get information from an IQ query, applies to message type "iq"
+ * @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 {
         LM_MESSAGE_SUB_TYPE_NOT_SET = -10,
 	LM_MESSAGE_SUB_TYPE_AVAILABLE = -1,
--- a/loudmouth/lm-proxy.c	Fri Jun 20 17:14:45 2008 +0200
+++ b/loudmouth/lm-proxy.c	Sat Jun 21 13:19:21 2008 +0200
@@ -19,6 +19,23 @@
  * Boston, MA 02111-1307, USA.
  */
 
+/**
+ * SECTION: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",
+ * 				  8080);
+ * lm_connection_set_proxy (connection, proxy);
+ * ...]]></programlisting></informalexample>
+ */
+
 #include <config.h>
 
 #include <glib.h>
--- a/loudmouth/lm-proxy.h	Fri Jun 20 17:14:45 2008 +0200
+++ b/loudmouth/lm-proxy.h	Sat Jun 21 13:19:21 2008 +0200
@@ -26,8 +26,20 @@
 
 G_BEGIN_DECLS
 
+/**
+ * LmProxy:
+ * 
+ * This should not be accessed directly. Use the accessor functions as described below.
+ */
 typedef struct _LmProxy LmProxy;
 
+/**
+ * LmProxyType:
+ * @LM_PROXY_TYPE_NONE: Unused
+ * @LM_PROXY_TYPE_HTTP: An HTTP proxy.
+ * 
+ * The type of the proxy.
+ */
 typedef enum {
 	LM_PROXY_TYPE_NONE = 0,
 	LM_PROXY_TYPE_HTTP
--- a/loudmouth/lm-ssl.h	Fri Jun 20 17:14:45 2008 +0200
+++ b/loudmouth/lm-ssl.h	Sat Jun 21 13:19:21 2008 +0200
@@ -18,6 +18,23 @@
  * Boston, MA 02111-1307, USA.
  */
 
+/**
+ * SECTION: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);
+ * ...
+ * ]]></programlisting></informalexample>
+ */
+
 #ifndef __LM_SSL_H__
 #define __LM_SSL_H__
 
@@ -29,14 +46,39 @@
 
 G_BEGIN_DECLS
 
+/**
+ * LmSSL:
+ * 
+ * This should not be accessed directly. Use the accessor functions as described below.
+ */
 typedef struct _LmSSL LmSSL;
 
+/**
+ * LmCertificateStatus:
+ * @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 {
 	LM_CERT_INVALID,
 	LM_CERT_ISSUER_NOT_FOUND,
 	LM_CERT_REVOKED
 } LmCertificateStatus;
 
+/**
+ * LmSSLStatus:
+ * @LM_SSL_STATUS_NO_CERT_FOUND: The server doesn't provide a certificate.
+ * @LM_SSL_STATUS_UNTRUSTED_CERT: The certification can not be trusted.
+ * @LM_SSL_STATUS_CERT_EXPIRED: The certificate has expired.
+ * @LM_SSL_STATUS_CERT_NOT_ACTIVATED: The certificate has not been activated.
+ * @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_UNTRUSTED_CERT,
@@ -47,11 +89,28 @@
 	LM_SSL_STATUS_GENERIC_ERROR
 } LmSSLStatus;
 
+/**
+ * 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 {
 	LM_SSL_RESPONSE_CONTINUE,
 	LM_SSL_RESPONSE_STOP
 } LmSSLResponse;
 
+/**
+ * LmSSLFunction:
+ * @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,
 					      LmSSLStatus   status,
 					      gpointer      user_data);
--- a/loudmouth/lm-utils.c	Fri Jun 20 17:14:45 2008 +0200
+++ b/loudmouth/lm-utils.c	Sat Jun 21 13:19:21 2008 +0200
@@ -18,6 +18,12 @@
  * Boston, MA 02111-1307, USA.
  */
 
+/**
+ * SECTION:Miscellaneous Utility Functions
+ * 
+ * Functions to help application developers when writing XMPP applications using Loudmouth.
+ */
+
 #include <config.h>
 #include <string.h>
 #include <stdio.h>