Initial revision
authorhallski <hallski>
Mon, 19 May 2003 18:27:00 +0000
changeset 1 50e230cf7818
parent 0 fc42ea7f810d
child 2 f5b19569e1bc
Initial revision
.svn/README
.svn/dir-wcprops
.svn/empty-file
.svn/entries
.svn/format
.svn/prop-base/AUTHORS.svn-base
.svn/prop-base/COPYING.svn-base
.svn/prop-base/ChangeLog.svn-base
.svn/prop-base/INSTALL.svn-base
.svn/prop-base/Makefile.am.svn-base
.svn/prop-base/NEWS.svn-base
.svn/prop-base/README.svn-base
.svn/prop-base/acinclude.m4.svn-base
.svn/prop-base/autogen.sh.svn-base
.svn/prop-base/configure.in.svn-base
.svn/prop-base/loudmouth-1.0.pc.in.svn-base
.svn/prop-base/loudmouth.spec.in.svn-base
.svn/props/AUTHORS.svn-work
.svn/props/COPYING.svn-work
.svn/props/ChangeLog.svn-work
.svn/props/INSTALL.svn-work
.svn/props/Makefile.am.svn-work
.svn/props/NEWS.svn-work
.svn/props/README.svn-work
.svn/props/acinclude.m4.svn-work
.svn/props/autogen.sh.svn-work
.svn/props/configure.in.svn-work
.svn/props/loudmouth-1.0.pc.in.svn-work
.svn/props/loudmouth.spec.in.svn-work
.svn/text-base/AUTHORS.svn-base
.svn/text-base/COPYING.svn-base
.svn/text-base/ChangeLog.svn-base
.svn/text-base/INSTALL.svn-base
.svn/text-base/Makefile.am.svn-base
.svn/text-base/NEWS.svn-base
.svn/text-base/README.svn-base
.svn/text-base/acinclude.m4.svn-base
.svn/text-base/autogen.sh.svn-base
.svn/text-base/configure.in.svn-base
.svn/text-base/loudmouth-1.0.pc.in.svn-base
.svn/text-base/loudmouth.spec.in.svn-base
.svn/wcprops/AUTHORS.svn-work
.svn/wcprops/COPYING.svn-work
.svn/wcprops/ChangeLog.svn-work
.svn/wcprops/INSTALL.svn-work
.svn/wcprops/Makefile.am.svn-work
.svn/wcprops/NEWS.svn-work
.svn/wcprops/README.svn-work
.svn/wcprops/acinclude.m4.svn-work
.svn/wcprops/autogen.sh.svn-work
.svn/wcprops/configure.in.svn-work
.svn/wcprops/loudmouth-1.0.pc.in.svn-work
.svn/wcprops/loudmouth.spec.in.svn-work
AUTHORS
COPYING
ChangeLog
INSTALL
Makefile.am
NEWS
README
acinclude.m4
autogen.sh
configure.in
docs/.svn/README
docs/.svn/dir-wcprops
docs/.svn/empty-file
docs/.svn/entries
docs/.svn/format
docs/.svn/prop-base/Makefile.am.svn-base
docs/.svn/props/Makefile.am.svn-work
docs/.svn/text-base/Makefile.am.svn-base
docs/.svn/wcprops/Makefile.am.svn-work
docs/Makefile.am
docs/reference/.svn/README
docs/reference/.svn/dir-wcprops
docs/reference/.svn/empty-file
docs/reference/.svn/entries
docs/reference/.svn/format
docs/reference/.svn/prop-base/Makefile.am.svn-base
docs/reference/.svn/prop-base/loudmouth-docs.sgml.svn-base
docs/reference/.svn/prop-base/loudmouth-overrides.txt.svn-base
docs/reference/.svn/prop-base/loudmouth-sections.txt.svn-base
docs/reference/.svn/prop-base/loudmouth.types.svn-base
docs/reference/.svn/props/Makefile.am.svn-work
docs/reference/.svn/props/loudmouth-docs.sgml.svn-work
docs/reference/.svn/props/loudmouth-overrides.txt.svn-work
docs/reference/.svn/props/loudmouth-sections.txt.svn-work
docs/reference/.svn/props/loudmouth.types.svn-work
docs/reference/.svn/text-base/Makefile.am.svn-base
docs/reference/.svn/text-base/loudmouth-docs.sgml.svn-base
docs/reference/.svn/text-base/loudmouth-overrides.txt.svn-base
docs/reference/.svn/text-base/loudmouth-sections.txt.svn-base
docs/reference/.svn/text-base/loudmouth.types.svn-base
docs/reference/.svn/wcprops/Makefile.am.svn-work
docs/reference/.svn/wcprops/loudmouth-docs.sgml.svn-work
docs/reference/.svn/wcprops/loudmouth-overrides.txt.svn-work
docs/reference/.svn/wcprops/loudmouth-sections.txt.svn-work
docs/reference/.svn/wcprops/loudmouth.types.svn-work
docs/reference/Makefile.am
docs/reference/loudmouth-docs.sgml
docs/reference/loudmouth-overrides.txt
docs/reference/loudmouth-sections.txt
docs/reference/loudmouth.types
docs/reference/tmpl/.svn/README
docs/reference/tmpl/.svn/dir-wcprops
docs/reference/tmpl/.svn/empty-file
docs/reference/tmpl/.svn/entries
docs/reference/tmpl/.svn/format
docs/reference/tmpl/.svn/prop-base/lm-connection.sgml.svn-base
docs/reference/tmpl/.svn/prop-base/lm-error.sgml.svn-base
docs/reference/tmpl/.svn/prop-base/lm-message-handler.sgml.svn-base
docs/reference/tmpl/.svn/prop-base/lm-message-node.sgml.svn-base
docs/reference/tmpl/.svn/prop-base/lm-message.sgml.svn-base
docs/reference/tmpl/.svn/prop-base/lm-result.sgml.svn-base
docs/reference/tmpl/.svn/prop-base/lm-utils.sgml.svn-base
docs/reference/tmpl/.svn/prop-base/loudmouth-unused.sgml.svn-base
docs/reference/tmpl/.svn/props/lm-connection.sgml.svn-work
docs/reference/tmpl/.svn/props/lm-error.sgml.svn-work
docs/reference/tmpl/.svn/props/lm-message-handler.sgml.svn-work
docs/reference/tmpl/.svn/props/lm-message-node.sgml.svn-work
docs/reference/tmpl/.svn/props/lm-message.sgml.svn-work
docs/reference/tmpl/.svn/props/lm-result.sgml.svn-work
docs/reference/tmpl/.svn/props/lm-utils.sgml.svn-work
docs/reference/tmpl/.svn/props/loudmouth-unused.sgml.svn-work
docs/reference/tmpl/.svn/text-base/lm-connection.sgml.svn-base
docs/reference/tmpl/.svn/text-base/lm-error.sgml.svn-base
docs/reference/tmpl/.svn/text-base/lm-message-handler.sgml.svn-base
docs/reference/tmpl/.svn/text-base/lm-message-node.sgml.svn-base
docs/reference/tmpl/.svn/text-base/lm-message.sgml.svn-base
docs/reference/tmpl/.svn/text-base/lm-result.sgml.svn-base
docs/reference/tmpl/.svn/text-base/lm-utils.sgml.svn-base
docs/reference/tmpl/.svn/text-base/loudmouth-unused.sgml.svn-base
docs/reference/tmpl/.svn/wcprops/lm-connection.sgml.svn-work
docs/reference/tmpl/.svn/wcprops/lm-error.sgml.svn-work
docs/reference/tmpl/.svn/wcprops/lm-message-handler.sgml.svn-work
docs/reference/tmpl/.svn/wcprops/lm-message-node.sgml.svn-work
docs/reference/tmpl/.svn/wcprops/lm-message.sgml.svn-work
docs/reference/tmpl/.svn/wcprops/lm-result.sgml.svn-work
docs/reference/tmpl/.svn/wcprops/lm-utils.sgml.svn-work
docs/reference/tmpl/.svn/wcprops/loudmouth-unused.sgml.svn-work
docs/reference/tmpl/lm-connection.sgml
docs/reference/tmpl/lm-error.sgml
docs/reference/tmpl/lm-message-handler.sgml
docs/reference/tmpl/lm-message-node.sgml
docs/reference/tmpl/lm-message.sgml
docs/reference/tmpl/lm-result.sgml
docs/reference/tmpl/lm-utils.sgml
docs/reference/tmpl/loudmouth-unused.sgml
loudmouth-1.0.pc.in
loudmouth.spec.in
loudmouth/.svn/README
loudmouth/.svn/dir-wcprops
loudmouth/.svn/empty-file
loudmouth/.svn/entries
loudmouth/.svn/format
loudmouth/.svn/prop-base/Makefile.am.svn-base
loudmouth/.svn/prop-base/lm-connection.c.svn-base
loudmouth/.svn/prop-base/lm-connection.h.svn-base
loudmouth/.svn/prop-base/lm-debug.c.svn-base
loudmouth/.svn/prop-base/lm-debug.h.svn-base
loudmouth/.svn/prop-base/lm-error.c.svn-base
loudmouth/.svn/prop-base/lm-error.h.svn-base
loudmouth/.svn/prop-base/lm-internals.h.svn-base
loudmouth/.svn/prop-base/lm-message-handler.c.svn-base
loudmouth/.svn/prop-base/lm-message-handler.h.svn-base
loudmouth/.svn/prop-base/lm-message-node.c.svn-base
loudmouth/.svn/prop-base/lm-message-node.h.svn-base
loudmouth/.svn/prop-base/lm-message.c.svn-base
loudmouth/.svn/prop-base/lm-message.h.svn-base
loudmouth/.svn/prop-base/lm-parser.c.svn-base
loudmouth/.svn/prop-base/lm-parser.h.svn-base
loudmouth/.svn/prop-base/lm-sha.c.svn-base
loudmouth/.svn/prop-base/lm-sha.h.svn-base
loudmouth/.svn/prop-base/lm-utils.c.svn-base
loudmouth/.svn/prop-base/lm-utils.h.svn-base
loudmouth/.svn/prop-base/loudmouth.h.svn-base
loudmouth/.svn/prop-base/test-jid.c.svn-base
loudmouth/.svn/prop-base/test-lm.c.svn-base
loudmouth/.svn/props/Makefile.am.svn-work
loudmouth/.svn/props/lm-connection.c.svn-work
loudmouth/.svn/props/lm-connection.h.svn-work
loudmouth/.svn/props/lm-debug.c.svn-work
loudmouth/.svn/props/lm-debug.h.svn-work
loudmouth/.svn/props/lm-error.c.svn-work
loudmouth/.svn/props/lm-error.h.svn-work
loudmouth/.svn/props/lm-internals.h.svn-work
loudmouth/.svn/props/lm-message-handler.c.svn-work
loudmouth/.svn/props/lm-message-handler.h.svn-work
loudmouth/.svn/props/lm-message-node.c.svn-work
loudmouth/.svn/props/lm-message-node.h.svn-work
loudmouth/.svn/props/lm-message.c.svn-work
loudmouth/.svn/props/lm-message.h.svn-work
loudmouth/.svn/props/lm-parser.c.svn-work
loudmouth/.svn/props/lm-parser.h.svn-work
loudmouth/.svn/props/lm-sha.c.svn-work
loudmouth/.svn/props/lm-sha.h.svn-work
loudmouth/.svn/props/lm-utils.c.svn-work
loudmouth/.svn/props/lm-utils.h.svn-work
loudmouth/.svn/props/loudmouth.h.svn-work
loudmouth/.svn/props/test-jid.c.svn-work
loudmouth/.svn/props/test-lm.c.svn-work
loudmouth/.svn/text-base/Makefile.am.svn-base
loudmouth/.svn/text-base/lm-connection.c.svn-base
loudmouth/.svn/text-base/lm-connection.h.svn-base
loudmouth/.svn/text-base/lm-debug.c.svn-base
loudmouth/.svn/text-base/lm-debug.h.svn-base
loudmouth/.svn/text-base/lm-error.c.svn-base
loudmouth/.svn/text-base/lm-error.h.svn-base
loudmouth/.svn/text-base/lm-internals.h.svn-base
loudmouth/.svn/text-base/lm-message-handler.c.svn-base
loudmouth/.svn/text-base/lm-message-handler.h.svn-base
loudmouth/.svn/text-base/lm-message-node.c.svn-base
loudmouth/.svn/text-base/lm-message-node.h.svn-base
loudmouth/.svn/text-base/lm-message.c.svn-base
loudmouth/.svn/text-base/lm-message.h.svn-base
loudmouth/.svn/text-base/lm-parser.c.svn-base
loudmouth/.svn/text-base/lm-parser.h.svn-base
loudmouth/.svn/text-base/lm-sha.c.svn-base
loudmouth/.svn/text-base/lm-sha.h.svn-base
loudmouth/.svn/text-base/lm-utils.c.svn-base
loudmouth/.svn/text-base/lm-utils.h.svn-base
loudmouth/.svn/text-base/loudmouth.h.svn-base
loudmouth/.svn/text-base/test-jid.c.svn-base
loudmouth/.svn/text-base/test-lm.c.svn-base
loudmouth/.svn/wcprops/Makefile.am.svn-work
loudmouth/.svn/wcprops/lm-connection.c.svn-work
loudmouth/.svn/wcprops/lm-connection.h.svn-work
loudmouth/.svn/wcprops/lm-debug.c.svn-work
loudmouth/.svn/wcprops/lm-debug.h.svn-work
loudmouth/.svn/wcprops/lm-error.c.svn-work
loudmouth/.svn/wcprops/lm-error.h.svn-work
loudmouth/.svn/wcprops/lm-internals.h.svn-work
loudmouth/.svn/wcprops/lm-message-handler.c.svn-work
loudmouth/.svn/wcprops/lm-message-handler.h.svn-work
loudmouth/.svn/wcprops/lm-message-node.c.svn-work
loudmouth/.svn/wcprops/lm-message-node.h.svn-work
loudmouth/.svn/wcprops/lm-message.c.svn-work
loudmouth/.svn/wcprops/lm-message.h.svn-work
loudmouth/.svn/wcprops/lm-parser.c.svn-work
loudmouth/.svn/wcprops/lm-parser.h.svn-work
loudmouth/.svn/wcprops/lm-sha.c.svn-work
loudmouth/.svn/wcprops/lm-sha.h.svn-work
loudmouth/.svn/wcprops/lm-utils.c.svn-work
loudmouth/.svn/wcprops/lm-utils.h.svn-work
loudmouth/.svn/wcprops/loudmouth.h.svn-work
loudmouth/.svn/wcprops/test-jid.c.svn-work
loudmouth/.svn/wcprops/test-lm.c.svn-work
loudmouth/Makefile.am
loudmouth/lm-connection.c
loudmouth/lm-connection.h
loudmouth/lm-debug.c
loudmouth/lm-debug.h
loudmouth/lm-error.c
loudmouth/lm-error.h
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.c
loudmouth/lm-message.h
loudmouth/lm-parser.c
loudmouth/lm-parser.h
loudmouth/lm-sha.c
loudmouth/lm-sha.h
loudmouth/lm-utils.c
loudmouth/lm-utils.h
loudmouth/loudmouth.h
loudmouth/test-jid.c
loudmouth/test-lm.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/README	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,2 @@
+This is a Subversion working copy administrative directory.
+Visit http://subversion.tigris.org/ for more information.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/dir-wcprops	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,9 @@
+K 25
+svn:wc:ra_dav:version-url
+V 42
+/svn/projects/!svn/ver/346/loudmouth/trunk
+K 26
+svn:wc:ra_dav:activity-url
+V 23
+/svn/projects/!svn/act/
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/entries	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<wc-entries
+   xmlns="svn:">
+<entry
+   committed-rev="346"
+   name="svn:this_dir"
+   committed-date="2003-04-17T10:56:10.375431Z"
+   url="http://svn.codefactory.se/svn/projects/loudmouth/trunk"
+   last-author="micke"
+   kind="dir"
+   revision="349"/>
+<entry
+   name="loudmouth"
+   kind="dir"/>
+<entry
+   committed-rev="14"
+   name="loudmouth-1.0.pc.in"
+   text-time="2003-05-19T18:17:28.000000Z"
+   committed-date="2003-02-02T02:56:08.000000Z"
+   checksum="b9e5d2c4fde31253abf576a0cc27c126"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:28.000000Z"/>
+<entry
+   committed-rev="5"
+   name="AUTHORS"
+   text-time="2003-05-19T18:17:37.000000Z"
+   committed-date="2003-01-31T12:27:42.000000Z"
+   checksum="e45079c9a18bfcf7c0f7aa3861971438"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:37.000000Z"/>
+<entry
+   committed-rev="12"
+   name="acinclude.m4"
+   text-time="2003-05-19T18:17:34.000000Z"
+   committed-date="2003-02-02T02:13:19.000000Z"
+   checksum="d8abfc739967a530a76d41df8df5e643"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:34.000000Z"/>
+<entry
+   committed-rev="1"
+   name="INSTALL"
+   text-time="2003-05-19T18:17:35.000000Z"
+   committed-date="2003-01-31T11:46:56.000000Z"
+   checksum="0d6be33865b76025c20b48bcac87adb7"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:35.000000Z"/>
+<entry
+   committed-rev="337"
+   name="configure.in"
+   text-time="2003-05-19T18:17:36.000000Z"
+   committed-date="2003-04-10T22:31:29.810044Z"
+   checksum="ea451fd3205e8c5b53f1dd72f9d87cda"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:36.000000Z"/>
+<entry
+   committed-rev="346"
+   name="ChangeLog"
+   text-time="2003-05-19T18:17:34.000000Z"
+   committed-date="2003-04-17T10:56:10.375431Z"
+   checksum="ca00a3c7ba3160b5a598c6b187089a92"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:34.000000Z"/>
+<entry
+   committed-rev="28"
+   name="COPYING"
+   text-time="2003-05-19T18:17:33.000000Z"
+   committed-date="2003-03-03T21:14:06.000000Z"
+   checksum="c4f38aef94828f6b280e00d1173be689"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:33.000000Z"/>
+<entry
+   name="docs"
+   kind="dir"/>
+<entry
+   committed-rev="324"
+   name="Makefile.am"
+   text-time="2003-05-19T18:17:32.000000Z"
+   committed-date="2003-04-04T22:42:44.686791Z"
+   checksum="7d8c44694961ad1cc17bc0c65e86a578"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:32.000000Z"/>
+<entry
+   committed-rev="47"
+   name="autogen.sh"
+   text-time="2003-05-19T18:17:31.000000Z"
+   committed-date="2003-03-13T01:41:32.000000Z"
+   checksum="efe34bcc54ee79c68ba836c90eb57bd8"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:31.000000Z"/>
+<entry
+   committed-rev="337"
+   name="NEWS"
+   text-time="2003-05-19T18:17:30.000000Z"
+   committed-date="2003-04-10T22:31:29.810044Z"
+   checksum="9cc657364e1eda18f8ed6f5b28a95444"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:30.000000Z"/>
+<entry
+   committed-rev="329"
+   name="README"
+   text-time="2003-05-19T18:17:30.000000Z"
+   committed-date="2003-04-07T08:54:07.401630Z"
+   checksum="aad35ccceeb2fd692ddb44ebe7fb8c4b"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:30.000000Z"/>
+<entry
+   committed-rev="337"
+   name="loudmouth.spec.in"
+   text-time="2003-05-19T18:17:29.000000Z"
+   committed-date="2003-04-10T22:31:29.810044Z"
+   checksum="ceb8ea0d61e3a482dedd3a29d5a04a14"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:29.000000Z"/>
+</wc-entries>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/format	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/prop-base/AUTHORS.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/prop-base/COPYING.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/prop-base/ChangeLog.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/prop-base/INSTALL.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/prop-base/Makefile.am.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/prop-base/NEWS.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/prop-base/README.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/prop-base/acinclude.m4.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/prop-base/autogen.sh.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 14
+svn:executable
+V 0
+
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/prop-base/configure.in.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/prop-base/loudmouth-1.0.pc.in.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/prop-base/loudmouth.spec.in.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/props/AUTHORS.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/props/COPYING.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/props/ChangeLog.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/props/INSTALL.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/props/Makefile.am.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/props/NEWS.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/props/README.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/props/acinclude.m4.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/props/autogen.sh.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 14
+svn:executable
+V 0
+
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/props/configure.in.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/props/loudmouth-1.0.pc.in.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/props/loudmouth.spec.in.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/text-base/AUTHORS.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,2 @@
+Mikael Hallendal <micke@codefactory.se>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/text-base/COPYING.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,502 @@
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/text-base/ChangeLog.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,573 @@
+2003-04-17  Mikael Hallendal  <micke@codefactory.se>
+
+	* docs/reference/Makefile.am: Make --disable-gtk-doc not try to 
+	  install the documents :) Fixes #633, patch by Kevin Dougherty.
+	
+	* loudmouth/lm-debug.c: Make build work with --disable-debug, 
+	  fixes #634, patch by Kevin Dougherty.
+
+2003-04-11  Mikael Hallendal  <micke@codefactory.se>
+
+	* NEWS: More updates
+	
+	* configure.in: Bumped version to 0.9
+	
+	* loudmouth.spec.in: Fixed
+	
+	* loudmouth/lm-connection.c:
+	(lm_connection_send_with_reply_and_block): Removed debug output.
+	
+2003-04-10  Mikael Hallendal  <micke@codefactory.se>
+
+        * NEWS: Updated for upcoming 0.9 release.
+	
+2003-04-07  Mikael Hallendal  <micke@codefactory.se>
+
+	* README: Added information about debug output.
+	
+	* loudmouth/lm-connection.c: 
+	(connection_in_event): Use a define for IN_BUFFER_SIZE
+
+2003-04-07  Mikael Hallendal  <micke@codefactory.se>
+
+	* README:
+	* loudmouth/lm-connection.c: (connection_in_event):
+
+2003-04-07  Mikael Hallendal  <micke@codefactory.se>
+
+	* configure.in:
+        - Added debug flag.
+	* loudmouth/Makefile.am:
+	- Added lm-debug.[ch]
+	* loudmouth/lm-internals.h: Added debug-stuff
+	* loudmouth/lm-connection.c: Use debug-stuff instead of d()-macro.
+	* loudmouth/lm-message.c: Same
+	* loudmouth/lm-parser.c: Same
+
+2003-04-05  Mikael Hallendal  <micke@codefactory.se>
+
+	* Makefile.am: Added .spec and .spec.in to EXTRA_DIST
+	* configure.in: Set GLIB2_REQUIRED, will be used in the spec-file.
+	* loudmouth/lm-message.c:
+	* loudmouth/lm-message.h:
+	- fixed the support for message and presence elements without type 
+	  attribute.
+
+2003-04-01  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-message.c:
+	(lm_message_get_node): added, using for bindings.
+
+	* loudmouth/lm-message-node.c:
+	(lm_message_node_get_value): added, makes binding easier.
+	(lm_message_node_set_attribute): splitted out to just set one
+	  attribute. using just this one to bind for C#.
+
+2003-03-24  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-connection.c:
+	(connection_incoming_dispatch):
+	- don't call handle_message if message is NULL.
+	(connection_do_open): 
+	- set error, don't send any messages, just open the socket and
+	  send the xml-document starter.
+	(connection_do_block): Removed.
+	(connection_create_source): added
+	(lm_connection_open_and_block): implemented.
+	(lm_connection_authenticate_and_block): implemented.
+	(lm_connection_send_with_reply_and_block): implemented.
+
+2003-03-23  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-connection.c:
+	- Now uses a queue for all incoming messages and a source that
+	  polls the queue.
+	(connection_do_close): added, unrefs
+	  io_channel and sets connection to be disconnected.
+	(connection_do_open): renamed from connection_connect
+
+2003-03-14  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-connection.c:
+	(lm_connection_get_server): added
+	(lm_connection_set_server): added
+	(lm_connection_get_port): added
+	(lm_connection_set_port): added
+	(lm_connection_get_use_ssl): added
+	(lm_connection_set_use_ssl): added
+	(lm_connection_new): Don't take port and use_ssl arguments. Make
+	  server-attribute optional (passing NULL).
+
+	* configure.in: bumped to 0.8.99
+	
+2003-03-13  Mikael Hallendal  <micke@codefactory.se>
+
+	* autogen.sh (need_configure_in):
+	- fix to autogen on solaris. Reported by stric.
+
+	* configure.in: 
+	- Added check for -lnsl and -lsocket needed to link on solaris.
+
+	* Released 0.8
+
+	* configure.in: bumped version to 0.8
+
+	* README (Introduction): added some information before the 0.8
+	  release.
+
+	* loudmouth/lm-connection.c:
+	(connection_error_event): call disconnect callback.
+	(connection_hup_event): same.
+	(lm_connection_set_disconnect_function): added.
+
+2003-03-05  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/*.h: prettified headers.
+	
+	* docs/reference/*: Updating docs. Now at 100%!
+
+2003-03-03  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-message-node.h:
+	- removed LmMessageNodeFunc, wasn't used anywhere.
+
+	* docs/reference/*: Updating docs. At 88% now... sooon!
+
+	* Changed license (again), this time back to LGPL. And it'll stay
+	  there :)
+	
+2003-02-27  Mikael Hallendal  <micke@codefactory.se>
+
+	* Worked alot on documenting.
+	
+2003-02-25  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-connection.c (connection_in_event): 
+	- Try to solve #553
+
+2003-02-24  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-sha.c: don't use stdint.h, instead use the g*
+	  versions of different int lengths. Fixes #536
+
+2003-02-08  Mikael Hallendal  <micke@codefactory.se>
+
+	* src/*.c: Started to document
+
+	* src/lm-result.h: Removed
+
+	* src/lm-error.[ch]: Added
+
+	* src/lm-connection.[ch]: 
+	- Use GErrors for reporting errors.
+	- Fixes #510
+
+	* docs/reference/Makefile.am: Don't link against GObject.
+
+2003-02-06  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-connection.c (connection_connect): send the opening
+	  xml tag stating that we'll use encoding utf-8.
+
+2003-02-02  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-message.c:
+	- fixes #504
+	(lm_message_new): take to-argument
+	(lm_message_new_with_sub_type): take to-argument
+
+	* loudmouth/test-lm.c (main): don't init GType, not used anymore..
+
+	* lm-message-handler.c:
+	- include files we actually need :)
+
+	* loudmouth/lm-connection.c: don't include removed files.
+
+	* loudmouth/Makefile.am:
+	- Removed all the stuff that generated the marshallers.
+
+	* configure.in: 
+	- removed gobject deps
+	- removed glib-genmarshal deps
+
+	* loudmouth-1.0.pc.in (Requires): removed all deps except glib.
+
+	* loudmouth/lm-connection.c: 
+	- Is no more a GObject, this means that loudmouth now only depends
+	  on GLib which makes it minimal and perfect for embedded systems.
+
+	* configure.in: Don't require libgtcpsocket
+
+	* loudmouth/lm-connection.c: Don't use libgtcpsocket for
+	  communication. Now uses a GIOChannel.
+
+	* loudmouth/*.c:
+	- Use GDestroyNotify instead of LmFreeFunction.
+	- Added LmCallback which is a struct with callback, 
+	  user_data and a notify function.
+	- Changed LmConnectionOpenFunction and LmAuthenticateFunction to
+	  be LmResultFunction.
+
+2003-02-01  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-sha.c (lm_sha_hash): don't print the digest.
+
+2003-01-31  Mikael Hallendal  <micke@codefactory.se>
+
+	* *: changed the license to the same one used in RoadRunner.
+
+	* loudmouth/lm-sha.c:
+	- switched the SHA implementation for one with BSD license.
+
+	* loudmouth/lm-connection.c (lm_connection_authenticate): 
+	- lm_sha_hash now returns a const gchar *
+
+
+2003-01-30  Mikael Hallendal  <micke@codefactory.se>
+
+	* docs/*: Added gtk-doc support. Now I just have to write API docs
+	  for everything :)
+
+	* loudmouth/lm-helper.[ch]: Removed.
+	
+2003-01-30  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-message-node.c:
+	(lm_message_node_to_string): made public since it's really useful
+	  for debugging your client.
+	(lm_message_node_find_child): readded this function from the old
+	  LmNode. It traverses the tree to see if it can find the child
+	  and returns at the first it finds. lm_message_node_get_child
+	  only looks at the direct children.
+
+2003-01-29  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-connection.c:
+	(lm_connection_send): don't set ID here. we set it in
+	  send_with_reply if it's not set (since it's needed there to find
+	  the correct handler).
+	(connection_connection_recv_cb): 
+	- not sure if this helps any, return if length <= 0 instead of
+	  feeding it to the parser.
+	
+	* loudmouth/lm-message.[ch]: 
+	- Added LmMessageSubType that can be used to set and check a
+	  message's sub type <node type="sub type">.
+	(message_sub_type_from_string): added
+	(message_sub_type_to_string): added
+	(lm_message_new_with_sub_type): added
+	(lm_message_get_sub_type): added
+
+	* loudmouth/lm-message-node.c (lm_message_node_get_child): 
+	- remove variable that caused warning.
+
+	* configure.in: updated version to 0.2
+
+2003-01-27  Mikael Hallendal <micke@codefactory.se>
+
+	* src/*: 
+	- LmClient -> LmConnection
+	- Use Message Handlers on LmConnection instead of signals
+	- LmElement, LmPresence and LmIQ removed
+	- LmMessage used for all kinds of messages now
+	- LmMessageHandler added as a generic message handler for all
+	  kinds of messages.
+	- send_with_reply added to give a callback when waiting for an
+	  answer to a request.
+	- LmResult added to most calls. Used to get some feedback on what
+	  might have gone wrong.
+		
+2003-01-27  Anders Carlsson  <andersca@codefactory.se>
+
+	* autogen.sh (FILE): Use lm-message.c for testing.
+
+2003-01-26  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/*: Added lm-helper which will create elements to send
+	  through client.
+	
+2003-01-25  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-marshal.list (VOID): cleaned up old marshallers.
+
+	* loudmouth/lm-element.c (lm_element_get_type_string): added.
+
+	* loudmouth/lm-client.c: 
+	- Changed message, presence and iq received back into signals
+	- Added default handlers to class
+	- Calling default handlers only if none of the connected callbacks
+	  returned TRUE.
+
+2003-01-21  Mikael Hallendal  <micke@codefactory.se>
+
+	* configure.in: don't use libgtcpsocket 1.0, use 0.1.0
+
+2002-12-10  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-util.c:
+	(lm_util_get_localtime): Added
+	(lm_util_case_strstr): Removed
+
+	* loudmouth/lm-x.h: Removed.
+
+	* loudmouth/lm-element.c:
+	- Added support for an iter for iterating over all x elements.
+	- Needed to resolve #347
+	(lm_element_get_x_iter): Added
+	(lm_x_iter_next): Added
+	(x_iter_next): Added
+	(lm_x_iter_free): Added
+
+	* loudmouth/Makefile.am (libloudmouthinclude_HEADERS): 
+	- install lm_util.h
+
+2002-12-03  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-presence.c:
+	- Fixed show-array indexing, Fixes #341 and #342
+	(lm_presence_set_show): don't set
+	  <show/> to "normal", just leave it out.
+	(presence_show_from_string): don't strcmp for "normal".
+	(presence_string_from_show): don't return "normal".
+
+2002-11-29  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-client.c (lm_client_subscribe_jid): Wrap g_print
+	with debug macro.
+	(lm_client_unsubscribe_jid): Likewise.
+	(lm_client_connect): Add debug print.
+	(client_connect_done_cb): Add debug print.
+
+	* loudmouth/lm-element.c (lm_element_new): When creating a stream
+	element, use "stream:stream" instead of just "stream". This fixes
+	the "Invalid XML" error we were getting from the server at the end
+	of the stream.
+
+	* loudmouth/lm-client.c (lm_client_authenticate): Don't free the
+	digest, it's static memory. This fixes a couple of very weird
+	crashes.
+	(lm_client_disconnect): Revert the fix I did here earlier, we
+	don't want to set is_connected until we really get a disconnect
+	callback from the connection. The problem is somewhere else.
+	(lm_client_send): Compare against </stream:stream> instead of just
+	</stream>.
+
+2002-11-29  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-node.c (node_free): don't free directly, use
+	ref-counts.
+	(lm_node_add_child_node): ref the child node.
+
+	* loudmouth/lm-element.c:
+	(lm_element_unref): implemented
+	(lm_element_set_tree): ref the tree.
+
+2002-11-29  Mikael Hallendal <micke@codefactory.se>
+
+	* loudmouth/lm-client.c: Changed default_foo_handler to
+	  foo_handler.
+	
+2002-11-27  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-client.c (client_handle_iq): Fix warning by making
+	id const.
+
+2002-11-26  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-client.c (client_connection_closed_cb): 
+	- Set is_connected to FALSE.
+
+2002-11-26  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/*: Changed so that LmElement and subclasses are no
+	  longer objects. Just structs. You need to use get/set-functions
+	  instead of properties.
+	
+2002-11-25  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-element.c (element_get_property): fixed error
+	  causing object_get ("from") trying to get "to" value.
+
+2002-11-24  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-client.c (client_handle_presence): 
+	- Try to implement subscription requests.
+
+	* loudmouth/test-lm.c (main): Fix more callback types.
+
+	* loudmouth/lm-client.h: 
+	- Remove lm_client_set_subscription_request_handler, unused.
+
+	* loudmouth/test-lm.c (main): Don't cast callbacks with (Type*).
+
+	* loudmouth/lm-client.c: 
+	- Change function prototypes from *callback to callback.
+
+	* loudmouth/lm-client.h: Remove signal entry from object struct 
+	  and change function prototypes to match the definitions.
+	
+2002-11-23  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-client.h: Add lm_client_get_agents.
+
+	* configure.in: Add compiler warnings logic but leave it disabled
+	  since the sha stuff is not very warning free.
+
+	* loudmouth/lm-node.c (lm_node_get_string): Escape the body string
+	  so we generate valid xml when sending things like '<', '>', and 
+	  '&'.
+
+2002-11-23  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-node.c (lm_node_unlink): added
+
+	* loudmouth/lm-presence.c (presence_set_property): don't set
+	  <show>normal</show>
+
+	* loudmouth/lm-iq.c:
+	(lm_iq_get_query_node):
+	(lm_iq_set_query_node): removed, use lm_element_find_child and
+	  lm_element_add_child_node instead.
+
+	* loudmouth/lm-element.c:
+	(lm_element_add_child): added :)
+	(lm_element_find_child): added
+
+	* loudmouth/lm-client.c (client_connection_closed_cb): call
+	  disconnect callback.
+
+	* loudmouth/lm-sha.[ch]: added, found in jabberd2, remember to
+	  check license issues with this.
+
+	* loudmouth/lm-client.c:
+	(lm_client_authenticate): use digest for sending password instead
+	  of clear text.
+
+	* loudmouth/lm-client.c:
+	(client_handle_iq): handle register reply
+	(lm_client_register): added
+	(lm_client_authenticate): moved stuff from iq-helper, easy enough
+	  now with the changes earlier today.
+
+	* loudmouth/lm-iq-helper.[ch]: removed, not needed anymore.
+
+	* loudmouth/lm-element.c (lm_element_add_child_node): added, this
+	  can be used to add any node to any element.
+
+	* loudmouth/lm-presence.c (presence_set_property): priority is an
+	  int, not string.
+
+	* loudmouth/lm-node.c (lm_node_add_child_node): rethinking, don't
+	  ref.
+	
+2002-11-22  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-node.c:
+	(lm_node_add_child): changed to take a name
+	  and a value, very handy when adding key/value pair nodes.
+	(lm_node_add_child_node): added a _node to the old
+	  lm_node_add_child. Also ref's the child so the user should unref
+	  it after he's finished with it.
+
+	* loudmouth/lm-iq.c (lm_iq_new): take the type as argument.
+
+	* loudmouth/lm-client.c: added a default iq handler attribute and
+	  use it in handle_iq if the incoming IQ isn't handled by the
+	  library. This way a user of the library can now do anything with
+	  it, even use it's own namespaces and such.
+
+	* loudmouth/*: Changes LmXMLNode -> LmNode
+
+	* loudmouth/*:
+	- Using LmXMLNode internally in all elements
+	- Use lm_message_new, lm_iq_new, lm_presence new instead of
+	  g_object_new
+	
+	* loudmouth/lm-presence.c:
+	(presence_get_xml_string): set to='' if it exists
+
+	* loudmouth/lm-xml-node.c:
+	(lm_xml_node_ref): added
+	(lm_xml_node_unref): added
+	(lm_xml_node_free): made private
+
+	* loudmouth/lm-parser.c:
+	(parser_end_element_cb): just unref the node, don't free it.
+
+	* loudmouth/lm-client.c: 
+	- added "name", "version" and "os" proprties.
+	(lm_client_register_default_message_handler):
+	(lm_client_register_default_presence_handler): removed, unused
+
+	* loudmouth/lm-element.[ch]: 
+	(lm_element_get_tree): Added, returns the XML tree for the
+	  element.
+	(ilm_element_setup_from_xml): ref the node.
+
+2002-11-20  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-parser.c (lm_parser_parse): Try to convert the xml
+	  input to from ISO-8859-1 to UTF-8 if it's not valid UTF-8. Not
+	  the perfect fix but it makes a common case work.
+
+2002-11-16  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-client.c (lm_client_disconnect): send end of
+  	  stream.
+
+2002-11-15  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-roster.c (lm_roster_new_from_query_node): Get the
+	  group from the child of the query node.
+
+2002-11-15  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-client.c: no more signals. You now register message
+	  and presence handlers.
+
+	* loudmouth/lm-presence.c (presence_get_property): implemented
+
+	* loudmouth/lm-client.c: 
+	- removed the disconnected and connected signals. Now callbacks
+	  passed to lm_client_connect.
+
+2002-11-14  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-presence.c:
+	(presence_class_init): type and show to be int's.
+	(presence_set_property): same.
+
+	* configure.in: bumped version to 0.1.1
+
+	* loudmouth/lm-presence.c (lm_presence_set_status): added.
+
+	* loudmouth/lm-element.c (element_class_init): not sure if we want
+	  this but readded the PROP_ERROR.
+
+	* loudmouth/lm-client.c (lm_client_authenticate): silent warnings
+
+	* loudmouth/lm-iq.c (iq_set_attribute): chain up.
+
+	* loudmouth/lm-element.c (element_get_property): implement.
+
+	* loudmouth/lm-client.c:
+	- use callbacks for auth and roster instead of signals.
+	(client_handle_iq): handle auth and roster
+	(client_add_callback): added
+	(client_find_callback): added
+	(client_remove_callback): added
+	(lm_client_send): take an extra id argument. If passed the message
+	  id will be copied to this argument.
+	(lm_client_authenticate): take callback+userdata as arguments.
+	(lm_client_request_roster): same
+
+2002-10-21  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-message.c (message_get_xml_string): Escape the
+	  body, fixes server disconnecting on messages containing <>.
+
+2002-10-02  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-xml-node.c (lm_xml_node_set_value): Don't run
+	  strdown on the node value.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/text-base/INSTALL.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,182 @@
+Basic Installation
+==================
+
+   These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+   The file `configure.in' is used to create `configure' by a program
+called `autoconf'.  You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  You can give `configure'
+initial values for variables by setting them in the environment.  Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory.  After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on.  Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+     CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+   If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+     Use and save the results of the tests in FILE instead of
+     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
+     debugging `configure'.
+
+`--help'
+     Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--version'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/text-base/Makefile.am.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,10 @@
+SUBDIRS = loudmouth docs
+
+EXTRA_DIST =			\
+	loudmouth-1.0.pc.in     \
+        loudmouth.spec          \
+	loudmouth.spec.in
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = loudmouth-1.0.pc
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/text-base/NEWS.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,10 @@
+Changes in 0.9:
+---------------
+
+* Build fixes Solaris
+* Non async operations
+* API additions to ease binding efforts
+* Added Debug output support
+* Bug fixes
+* API changes (see below).
+* Support for disconnect and disconnect signalling.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/text-base/README.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,56 @@
+Introduction:
+=============
+
+Loudmouth is a lightweight and easy-to-use C library for programming with the
+Jabber protocol. It's designed to be easy to get started with and yet
+extensible to let you do anything the Jabber protocol allows.
+
+The goal is to fully support Linux, *BSD, Mac OSX and Windows. It has
+currently only been tested on Linux (Red Hat 8.0, Debian Unstable) and FreeBSD
+that I know of. If someone with access to other machines can provide
+feedback I would be most grateful.
+
+
+Requirements:
+=============
+
+Glib >= 2.0:
+ftp://ftp.gtk.org/pub/gtk/v2.2/
+
+gtk-doc (optional, if you want documentation built):
+ftp://ftp.gnome.org/pub/GNOME/sources/gtk-doc/1.0
+
+
+Building:
+=========
+
+./configure --prefix=
+make
+make install
+
+
+Debugging:
+==========
+
+You can get debug information printed to STDOUT by using the environment 
+variable LM_DEBUG.
+
+export LM_DEBUG=<keyword>
+
+Where keyword is one or more (separated by :) of the following:
+
+* "NET": Shows all the data sent over the network.
+* "PARSER": Shows debug output from the parser.
+* "VERBOSE": Shows various verbose output.
+* "ALL": Enables all output.
+
+
+Questions, remarks, bug reports:
+================================
+
+Please file bugs at:
+http://bugzilla.codefactory.se/enter_bug.cgi?product=loudmouth
+
+Questions and others can be sent to me at:
+email: micke@codefactory.se
+jabber: micke@jabber.codefactory.se
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/text-base/acinclude.m4.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,61 @@
+dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.
+
+AC_DEFUN([LM_COMPILE_WARNINGS],[
+   if test -f $srcdir/autogen.sh; then
+	default_compile_warnings="error"
+    else
+	default_compile_warnings="no"
+    fi
+
+    AC_ARG_WITH(compile-warnings, [  --with-compile-warnings=[no/yes/error] Compiler warnings ], [enable_compile_warnings="$withval"], [enable_compile_warnings="$default_compile_warnings"])
+
+    warnCFLAGS=
+    if test "x$GCC" != xyes; then
+	enable_compile_warnings=no
+    fi
+
+    warning_flags=
+    realsave_CFLAGS="$CFLAGS"
+
+    case "$enable_compile_warnings" in
+    no)
+	warning_flags=
+	;;
+    yes)
+	warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations"
+	;;
+    maximum|error)
+	warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
+	CFLAGS="$warning_flags $CFLAGS"
+	for option in -Wsign-promo -Wno-sign-compare; do
+		SAVE_CFLAGS="$CFLAGS"
+		CFLAGS="$CFLAGS $option"
+		AC_MSG_CHECKING([whether gcc understands $option])
+		AC_TRY_COMPILE([], [],
+			has_option=yes,
+			has_option=no,)
+		CFLAGS="$SAVE_CFLAGS"
+		AC_MSG_RESULT($has_option)
+		if test $has_option = yes; then
+		  warning_flags="$warning_flags $option"
+		fi
+		unset has_option
+		unset SAVE_CFLAGS
+	done
+	unset option
+	if test "$enable_compile_warnings" = "error" ; then
+	    warning_flags="$warning_flags -Werror"
+	fi
+	;;
+    *)
+	AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
+	;;
+    esac
+    CFLAGS="$realsave_CFLAGS"
+    AC_MSG_CHECKING(what warning flags to pass to the C compiler)
+    AC_MSG_RESULT($warning_flags)
+
+    WARN_CFLAGS="$warning_flags"
+    AC_SUBST(WARN_CFLAGS)
+])
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/text-base/autogen.sh.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+PACKAGE="loudmouth"
+
+have_libtool=false
+have_autoconf=false
+have_automake=false
+need_configure_in=false
+
+if libtool --version < /dev/null > /dev/null 2>&1 ; then
+	libtool_version=`libtoolize --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
+	have_libtool=true
+	case $libtool_version in
+	    1.3*)
+		need_configure_in=true
+		;;
+	esac
+fi
+
+if autoconf --version < /dev/null > /dev/null 2>&1 ; then
+	autoconf_version=`autoconf --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
+	have_autoconf=true
+	case $autoconf_version in
+	    2.13)
+		need_configure_in=true
+		;;
+	esac
+fi
+
+if $have_libtool ; then : ; else
+	echo;
+	echo "You must have libtool >= 1.3 installed to compile $PACKAGE";
+	echo;
+	exit;
+fi
+
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+	echo;
+	echo "You must have automake installed to compile $PACKAGE";
+	echo;
+	exit;
+}
+
+echo "Generating configuration files for $PACKAGE, please wait...."
+echo;
+
+if $need_configure_in ; then
+    if test ! -f configure.in ; then
+	echo "Creating symlink from configure.in to configure.ac..."
+	echo
+	ln -s configure.ac configure.in
+    fi
+fi
+
+aclocal $ACLOCAL_FLAGS
+libtoolize --force
+autoheader
+automake --add-missing
+autoconf
+
+./configure $@ --enable-maintainer-mode --enable-compile-warnings
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/text-base/configure.in.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,129 @@
+AC_INIT(loudmouth/lm-message.h)
+
+AM_CONFIG_HEADER(config.h)
+
+AM_INIT_AUTOMAKE(loudmouth, 0.9)
+
+AM_MAINTAINER_MODE
+
+AC_PROG_CC
+AC_ISC_POSIX
+AC_HEADER_STDC
+AM_PROG_LIBTOOL
+
+AM_PATH_GLIB_2_0
+
+LM_COMPILE_WARNINGS
+
+changequote(,)dnl
+if test "x$GCC" = "xyes"; then
+  case " $CFLAGS " in
+  *[\ \	]-Wall[\ \	]*) ;;
+  *) CFLAGS="$CFLAGS -Wall" ;;
+  esac
+fi
+changequote([,])dnl
+
+AC_SUBST(CFLAGS)
+AC_SUBST(LDFLAGS)
+
+GLIB2_REQUIRED=2.0.0
+AC_SUBST(GLIB2_REQUIRED)
+
+PKG_CHECK_MODULES(LOUDMOUTH, glib-2.0 >= $GLIB2_REQUIRED)
+
+dnl +--------------------+
+dnl | Check for gtk-doc. |-------------------------------
+dnl +--------------------+
+
+AC_ARG_WITH(html-dir, [  --with-html-dir=PATH path to installed docs ])
+
+if test "x$with_html_dir" = "x" ; then
+  HTML_DIR='${datadir}/gtk-doc/html'
+else
+  HTML_DIR=$with_html_dir
+fi
+
+AC_SUBST(HTML_DIR)
+
+gtk_doc_min_version=1.0
+AC_MSG_CHECKING([gtk-doc version >= $gtk_doc_min_version])
+if pkg-config --atleast-version=$gtk_doc_min_version gtk-doc; then
+  AC_MSG_RESULT(yes)
+  GTKDOC=true
+else
+  AC_MSG_RESULT(no)
+  GTKDOC=false
+fi
+
+dnl Let people disable the gtk-doc stuff.
+AC_ARG_ENABLE(gtk-doc, [  --enable-gtk-doc  Use gtk-doc to build documentation [default=no]], enable_gtk_doc="$enableval", enable_gtk_doc=no)
+
+if test x$enable_gtk_doc = xauto ; then
+  if test x$GTKDOC = xtrue ; then
+    enable_gtk_doc=yes
+  else
+    enable_gtk_doc=no
+  fi
+fi
+
+AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
+
+dnl define a MAINT-like variable REBUILD which is set if Perl
+dnl and awk are found, so autogenerated sources can be rebuilt
+AC_ARG_ENABLE(rebuilds, [  --disable-rebuilds      disable all source autogeneration rules],,enable_rebuilds=yes)
+REBUILD=\#
+if test "x$enable_rebuilds" = "xyes" && \
+     test -n "$PERL" && \
+     $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 && \
+     test -n "$AWK" ; then
+  REBUILD=
+fi
+AC_SUBST(REBUILD)
+
+
+dnl +--------------------------------------------------------+
+dnl | Checking for libnsl and libsocket need on some systems |-
+dnl +--------------------------------------------------------+
+AC_CHECK_LIB(nsl,gethostbyname)
+AC_CHECK_LIB(socket,socket)
+
+
+dnl +-------------+
+dnl | Build Flags |--------------------------------------------
+dnl +-------------+
+DOC_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $WARN_CFLAGS"
+AC_SUBST(DOC_CFLAGS)
+AC_SUBST(CFLAGS)
+AC_SUBST(CPPFLAGS)
+AC_SUBST(LDFLAGS)
+dnl -----------------------------------------------------------
+
+dnl +--------------+
+dnl | Debug output |-------------------------------------------
+dnl +--------------+
+
+AC_ARG_ENABLE(debug, 
+	      [  --enable-debug          Enable debug output [default=yes]],
+	      enable_debug="$enableval", enable_debug=yes, enable_debug=no)
+
+if test x$enable_debug = xno ; then
+	echo "Debugging disabled"
+	LOUDMOUTH_CFLAGS="$LOUDMOUTH_CFLAGS -DLM_NO_DEBUG"
+else
+	echo "Debugging enabled"
+fi
+
+AC_SUBST(LOUDMOUTH_CFLAGS)
+AC_SUBST(LOUDMOUTH_LIBS)
+
+#CFLAGS="$CFLAGS $WARN_CFLAGS"
+
+AC_OUTPUT([
+Makefile
+docs/Makefile
+docs/reference/Makefile
+loudmouth/Makefile
+loudmouth-1.0.pc
+loudmouth.spec])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/text-base/loudmouth-1.0.pc.in.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libloudmouth
+Description: libloudmouth
+Requires: glib-2.0
+Version: @VERSION@
+Libs: -L${libdir} -lloudmouth
+Cflags: -I${includedir}/loudmouth-1.0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/text-base/loudmouth.spec.in.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,61 @@
+%define ver @VERSION@
+%define name @PACKAGE@
+
+Summary: Loadmouth is a Jabber client written in C.
+Name: %name
+Version: %ver
+Release: cf1
+URL: http://people.codefactory.se/~micke/loudmouth
+Source0: %{name}-%{ver}.tar.gz
+License: LGPL
+Group: System Environment/Libraries
+BuildRoot: %{_tmppath}/%{name}-root
+Requires: glib2 >= @GLIB2_REQUIRED@
+BuildRequires: glib2-devel >= @GLIB2_REQUIRED@
+
+%description
+Loudmouth is a lightweight and easy-to-use C library for programming with the Jabber protocol. It's designed to be easy to get started with and yet extensible to let you do anything the Jabber protocol allows. 
+
+%package devel
+Summary:	Development files for RoadRunner..
+Group: 		Development/Libraries
+Requires:	%name = %{PACKAGE_VERSION}
+Requires:	glib2-devel >= @GLIB2_REQUIRED@
+
+%description devel
+Loudmouth is a lightweight and easy-to-use C library for programming with the Jabber protocol. It's designed to be easy to get started with and yet extensible to let you do anything the Jabber protocol allows. 
+
+%prep
+%setup -q
+
+%build
+
+%configure
+make
+
+%install
+rm -rf %{buildroot}
+%makeinstall 
+
+# remove, not shipped
+rm -f $RPM_BUILD_ROOT%{_libdir}/libloudmouth.la
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+%doc ChangeLog NEWS README COPYING
+%{_libdir}/libloudmouth*.so.*
+
+%files devel
+%defattr(-,root,root)
+%{_libdir}/libloudmouth*.so
+%{_libdir}/libloudmouth*.a
+%{_libdir}/pkgconfig/*
+%{_prefix}/include/loudmouth-1.0
+%{_datadir}/gtk-doc/html/loudmouth
+
+%changelog
+* Sat Mar 29 2003 Mikael Hallendal <micke@codefactory.se>
+- Initial build
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/wcprops/AUTHORS.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 48
+/svn/projects/!svn/ver/5/loudmouth/trunk/AUTHORS
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/wcprops/COPYING.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/projects/!svn/ver/28/loudmouth/trunk/COPYING
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/wcprops/ChangeLog.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 52
+/svn/projects/!svn/ver/346/loudmouth/trunk/ChangeLog
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/wcprops/INSTALL.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 48
+/svn/projects/!svn/ver/1/loudmouth/trunk/INSTALL
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/wcprops/Makefile.am.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 54
+/svn/projects/!svn/ver/324/loudmouth/trunk/Makefile.am
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/wcprops/NEWS.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 47
+/svn/projects/!svn/ver/337/loudmouth/trunk/NEWS
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/wcprops/README.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/projects/!svn/ver/329/loudmouth/trunk/README
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/wcprops/acinclude.m4.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 54
+/svn/projects/!svn/ver/12/loudmouth/trunk/acinclude.m4
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/wcprops/autogen.sh.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 52
+/svn/projects/!svn/ver/47/loudmouth/trunk/autogen.sh
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/wcprops/configure.in.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 55
+/svn/projects/!svn/ver/337/loudmouth/trunk/configure.in
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/wcprops/loudmouth-1.0.pc.in.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 61
+/svn/projects/!svn/ver/14/loudmouth/trunk/loudmouth-1.0.pc.in
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/wcprops/loudmouth.spec.in.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/projects/!svn/ver/337/loudmouth/trunk/loudmouth.spec.in
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AUTHORS	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,2 @@
+Mikael Hallendal <micke@codefactory.se>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/COPYING	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,502 @@
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ChangeLog	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,573 @@
+2003-04-17  Mikael Hallendal  <micke@codefactory.se>
+
+	* docs/reference/Makefile.am: Make --disable-gtk-doc not try to 
+	  install the documents :) Fixes #633, patch by Kevin Dougherty.
+	
+	* loudmouth/lm-debug.c: Make build work with --disable-debug, 
+	  fixes #634, patch by Kevin Dougherty.
+
+2003-04-11  Mikael Hallendal  <micke@codefactory.se>
+
+	* NEWS: More updates
+	
+	* configure.in: Bumped version to 0.9
+	
+	* loudmouth.spec.in: Fixed
+	
+	* loudmouth/lm-connection.c:
+	(lm_connection_send_with_reply_and_block): Removed debug output.
+	
+2003-04-10  Mikael Hallendal  <micke@codefactory.se>
+
+        * NEWS: Updated for upcoming 0.9 release.
+	
+2003-04-07  Mikael Hallendal  <micke@codefactory.se>
+
+	* README: Added information about debug output.
+	
+	* loudmouth/lm-connection.c: 
+	(connection_in_event): Use a define for IN_BUFFER_SIZE
+
+2003-04-07  Mikael Hallendal  <micke@codefactory.se>
+
+	* README:
+	* loudmouth/lm-connection.c: (connection_in_event):
+
+2003-04-07  Mikael Hallendal  <micke@codefactory.se>
+
+	* configure.in:
+        - Added debug flag.
+	* loudmouth/Makefile.am:
+	- Added lm-debug.[ch]
+	* loudmouth/lm-internals.h: Added debug-stuff
+	* loudmouth/lm-connection.c: Use debug-stuff instead of d()-macro.
+	* loudmouth/lm-message.c: Same
+	* loudmouth/lm-parser.c: Same
+
+2003-04-05  Mikael Hallendal  <micke@codefactory.se>
+
+	* Makefile.am: Added .spec and .spec.in to EXTRA_DIST
+	* configure.in: Set GLIB2_REQUIRED, will be used in the spec-file.
+	* loudmouth/lm-message.c:
+	* loudmouth/lm-message.h:
+	- fixed the support for message and presence elements without type 
+	  attribute.
+
+2003-04-01  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-message.c:
+	(lm_message_get_node): added, using for bindings.
+
+	* loudmouth/lm-message-node.c:
+	(lm_message_node_get_value): added, makes binding easier.
+	(lm_message_node_set_attribute): splitted out to just set one
+	  attribute. using just this one to bind for C#.
+
+2003-03-24  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-connection.c:
+	(connection_incoming_dispatch):
+	- don't call handle_message if message is NULL.
+	(connection_do_open): 
+	- set error, don't send any messages, just open the socket and
+	  send the xml-document starter.
+	(connection_do_block): Removed.
+	(connection_create_source): added
+	(lm_connection_open_and_block): implemented.
+	(lm_connection_authenticate_and_block): implemented.
+	(lm_connection_send_with_reply_and_block): implemented.
+
+2003-03-23  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-connection.c:
+	- Now uses a queue for all incoming messages and a source that
+	  polls the queue.
+	(connection_do_close): added, unrefs
+	  io_channel and sets connection to be disconnected.
+	(connection_do_open): renamed from connection_connect
+
+2003-03-14  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-connection.c:
+	(lm_connection_get_server): added
+	(lm_connection_set_server): added
+	(lm_connection_get_port): added
+	(lm_connection_set_port): added
+	(lm_connection_get_use_ssl): added
+	(lm_connection_set_use_ssl): added
+	(lm_connection_new): Don't take port and use_ssl arguments. Make
+	  server-attribute optional (passing NULL).
+
+	* configure.in: bumped to 0.8.99
+	
+2003-03-13  Mikael Hallendal  <micke@codefactory.se>
+
+	* autogen.sh (need_configure_in):
+	- fix to autogen on solaris. Reported by stric.
+
+	* configure.in: 
+	- Added check for -lnsl and -lsocket needed to link on solaris.
+
+	* Released 0.8
+
+	* configure.in: bumped version to 0.8
+
+	* README (Introduction): added some information before the 0.8
+	  release.
+
+	* loudmouth/lm-connection.c:
+	(connection_error_event): call disconnect callback.
+	(connection_hup_event): same.
+	(lm_connection_set_disconnect_function): added.
+
+2003-03-05  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/*.h: prettified headers.
+	
+	* docs/reference/*: Updating docs. Now at 100%!
+
+2003-03-03  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-message-node.h:
+	- removed LmMessageNodeFunc, wasn't used anywhere.
+
+	* docs/reference/*: Updating docs. At 88% now... sooon!
+
+	* Changed license (again), this time back to LGPL. And it'll stay
+	  there :)
+	
+2003-02-27  Mikael Hallendal  <micke@codefactory.se>
+
+	* Worked alot on documenting.
+	
+2003-02-25  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-connection.c (connection_in_event): 
+	- Try to solve #553
+
+2003-02-24  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-sha.c: don't use stdint.h, instead use the g*
+	  versions of different int lengths. Fixes #536
+
+2003-02-08  Mikael Hallendal  <micke@codefactory.se>
+
+	* src/*.c: Started to document
+
+	* src/lm-result.h: Removed
+
+	* src/lm-error.[ch]: Added
+
+	* src/lm-connection.[ch]: 
+	- Use GErrors for reporting errors.
+	- Fixes #510
+
+	* docs/reference/Makefile.am: Don't link against GObject.
+
+2003-02-06  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-connection.c (connection_connect): send the opening
+	  xml tag stating that we'll use encoding utf-8.
+
+2003-02-02  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-message.c:
+	- fixes #504
+	(lm_message_new): take to-argument
+	(lm_message_new_with_sub_type): take to-argument
+
+	* loudmouth/test-lm.c (main): don't init GType, not used anymore..
+
+	* lm-message-handler.c:
+	- include files we actually need :)
+
+	* loudmouth/lm-connection.c: don't include removed files.
+
+	* loudmouth/Makefile.am:
+	- Removed all the stuff that generated the marshallers.
+
+	* configure.in: 
+	- removed gobject deps
+	- removed glib-genmarshal deps
+
+	* loudmouth-1.0.pc.in (Requires): removed all deps except glib.
+
+	* loudmouth/lm-connection.c: 
+	- Is no more a GObject, this means that loudmouth now only depends
+	  on GLib which makes it minimal and perfect for embedded systems.
+
+	* configure.in: Don't require libgtcpsocket
+
+	* loudmouth/lm-connection.c: Don't use libgtcpsocket for
+	  communication. Now uses a GIOChannel.
+
+	* loudmouth/*.c:
+	- Use GDestroyNotify instead of LmFreeFunction.
+	- Added LmCallback which is a struct with callback, 
+	  user_data and a notify function.
+	- Changed LmConnectionOpenFunction and LmAuthenticateFunction to
+	  be LmResultFunction.
+
+2003-02-01  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-sha.c (lm_sha_hash): don't print the digest.
+
+2003-01-31  Mikael Hallendal  <micke@codefactory.se>
+
+	* *: changed the license to the same one used in RoadRunner.
+
+	* loudmouth/lm-sha.c:
+	- switched the SHA implementation for one with BSD license.
+
+	* loudmouth/lm-connection.c (lm_connection_authenticate): 
+	- lm_sha_hash now returns a const gchar *
+
+
+2003-01-30  Mikael Hallendal  <micke@codefactory.se>
+
+	* docs/*: Added gtk-doc support. Now I just have to write API docs
+	  for everything :)
+
+	* loudmouth/lm-helper.[ch]: Removed.
+	
+2003-01-30  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-message-node.c:
+	(lm_message_node_to_string): made public since it's really useful
+	  for debugging your client.
+	(lm_message_node_find_child): readded this function from the old
+	  LmNode. It traverses the tree to see if it can find the child
+	  and returns at the first it finds. lm_message_node_get_child
+	  only looks at the direct children.
+
+2003-01-29  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-connection.c:
+	(lm_connection_send): don't set ID here. we set it in
+	  send_with_reply if it's not set (since it's needed there to find
+	  the correct handler).
+	(connection_connection_recv_cb): 
+	- not sure if this helps any, return if length <= 0 instead of
+	  feeding it to the parser.
+	
+	* loudmouth/lm-message.[ch]: 
+	- Added LmMessageSubType that can be used to set and check a
+	  message's sub type <node type="sub type">.
+	(message_sub_type_from_string): added
+	(message_sub_type_to_string): added
+	(lm_message_new_with_sub_type): added
+	(lm_message_get_sub_type): added
+
+	* loudmouth/lm-message-node.c (lm_message_node_get_child): 
+	- remove variable that caused warning.
+
+	* configure.in: updated version to 0.2
+
+2003-01-27  Mikael Hallendal <micke@codefactory.se>
+
+	* src/*: 
+	- LmClient -> LmConnection
+	- Use Message Handlers on LmConnection instead of signals
+	- LmElement, LmPresence and LmIQ removed
+	- LmMessage used for all kinds of messages now
+	- LmMessageHandler added as a generic message handler for all
+	  kinds of messages.
+	- send_with_reply added to give a callback when waiting for an
+	  answer to a request.
+	- LmResult added to most calls. Used to get some feedback on what
+	  might have gone wrong.
+		
+2003-01-27  Anders Carlsson  <andersca@codefactory.se>
+
+	* autogen.sh (FILE): Use lm-message.c for testing.
+
+2003-01-26  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/*: Added lm-helper which will create elements to send
+	  through client.
+	
+2003-01-25  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-marshal.list (VOID): cleaned up old marshallers.
+
+	* loudmouth/lm-element.c (lm_element_get_type_string): added.
+
+	* loudmouth/lm-client.c: 
+	- Changed message, presence and iq received back into signals
+	- Added default handlers to class
+	- Calling default handlers only if none of the connected callbacks
+	  returned TRUE.
+
+2003-01-21  Mikael Hallendal  <micke@codefactory.se>
+
+	* configure.in: don't use libgtcpsocket 1.0, use 0.1.0
+
+2002-12-10  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-util.c:
+	(lm_util_get_localtime): Added
+	(lm_util_case_strstr): Removed
+
+	* loudmouth/lm-x.h: Removed.
+
+	* loudmouth/lm-element.c:
+	- Added support for an iter for iterating over all x elements.
+	- Needed to resolve #347
+	(lm_element_get_x_iter): Added
+	(lm_x_iter_next): Added
+	(x_iter_next): Added
+	(lm_x_iter_free): Added
+
+	* loudmouth/Makefile.am (libloudmouthinclude_HEADERS): 
+	- install lm_util.h
+
+2002-12-03  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-presence.c:
+	- Fixed show-array indexing, Fixes #341 and #342
+	(lm_presence_set_show): don't set
+	  <show/> to "normal", just leave it out.
+	(presence_show_from_string): don't strcmp for "normal".
+	(presence_string_from_show): don't return "normal".
+
+2002-11-29  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-client.c (lm_client_subscribe_jid): Wrap g_print
+	with debug macro.
+	(lm_client_unsubscribe_jid): Likewise.
+	(lm_client_connect): Add debug print.
+	(client_connect_done_cb): Add debug print.
+
+	* loudmouth/lm-element.c (lm_element_new): When creating a stream
+	element, use "stream:stream" instead of just "stream". This fixes
+	the "Invalid XML" error we were getting from the server at the end
+	of the stream.
+
+	* loudmouth/lm-client.c (lm_client_authenticate): Don't free the
+	digest, it's static memory. This fixes a couple of very weird
+	crashes.
+	(lm_client_disconnect): Revert the fix I did here earlier, we
+	don't want to set is_connected until we really get a disconnect
+	callback from the connection. The problem is somewhere else.
+	(lm_client_send): Compare against </stream:stream> instead of just
+	</stream>.
+
+2002-11-29  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-node.c (node_free): don't free directly, use
+	ref-counts.
+	(lm_node_add_child_node): ref the child node.
+
+	* loudmouth/lm-element.c:
+	(lm_element_unref): implemented
+	(lm_element_set_tree): ref the tree.
+
+2002-11-29  Mikael Hallendal <micke@codefactory.se>
+
+	* loudmouth/lm-client.c: Changed default_foo_handler to
+	  foo_handler.
+	
+2002-11-27  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-client.c (client_handle_iq): Fix warning by making
+	id const.
+
+2002-11-26  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-client.c (client_connection_closed_cb): 
+	- Set is_connected to FALSE.
+
+2002-11-26  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/*: Changed so that LmElement and subclasses are no
+	  longer objects. Just structs. You need to use get/set-functions
+	  instead of properties.
+	
+2002-11-25  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-element.c (element_get_property): fixed error
+	  causing object_get ("from") trying to get "to" value.
+
+2002-11-24  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-client.c (client_handle_presence): 
+	- Try to implement subscription requests.
+
+	* loudmouth/test-lm.c (main): Fix more callback types.
+
+	* loudmouth/lm-client.h: 
+	- Remove lm_client_set_subscription_request_handler, unused.
+
+	* loudmouth/test-lm.c (main): Don't cast callbacks with (Type*).
+
+	* loudmouth/lm-client.c: 
+	- Change function prototypes from *callback to callback.
+
+	* loudmouth/lm-client.h: Remove signal entry from object struct 
+	  and change function prototypes to match the definitions.
+	
+2002-11-23  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-client.h: Add lm_client_get_agents.
+
+	* configure.in: Add compiler warnings logic but leave it disabled
+	  since the sha stuff is not very warning free.
+
+	* loudmouth/lm-node.c (lm_node_get_string): Escape the body string
+	  so we generate valid xml when sending things like '<', '>', and 
+	  '&'.
+
+2002-11-23  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-node.c (lm_node_unlink): added
+
+	* loudmouth/lm-presence.c (presence_set_property): don't set
+	  <show>normal</show>
+
+	* loudmouth/lm-iq.c:
+	(lm_iq_get_query_node):
+	(lm_iq_set_query_node): removed, use lm_element_find_child and
+	  lm_element_add_child_node instead.
+
+	* loudmouth/lm-element.c:
+	(lm_element_add_child): added :)
+	(lm_element_find_child): added
+
+	* loudmouth/lm-client.c (client_connection_closed_cb): call
+	  disconnect callback.
+
+	* loudmouth/lm-sha.[ch]: added, found in jabberd2, remember to
+	  check license issues with this.
+
+	* loudmouth/lm-client.c:
+	(lm_client_authenticate): use digest for sending password instead
+	  of clear text.
+
+	* loudmouth/lm-client.c:
+	(client_handle_iq): handle register reply
+	(lm_client_register): added
+	(lm_client_authenticate): moved stuff from iq-helper, easy enough
+	  now with the changes earlier today.
+
+	* loudmouth/lm-iq-helper.[ch]: removed, not needed anymore.
+
+	* loudmouth/lm-element.c (lm_element_add_child_node): added, this
+	  can be used to add any node to any element.
+
+	* loudmouth/lm-presence.c (presence_set_property): priority is an
+	  int, not string.
+
+	* loudmouth/lm-node.c (lm_node_add_child_node): rethinking, don't
+	  ref.
+	
+2002-11-22  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-node.c:
+	(lm_node_add_child): changed to take a name
+	  and a value, very handy when adding key/value pair nodes.
+	(lm_node_add_child_node): added a _node to the old
+	  lm_node_add_child. Also ref's the child so the user should unref
+	  it after he's finished with it.
+
+	* loudmouth/lm-iq.c (lm_iq_new): take the type as argument.
+
+	* loudmouth/lm-client.c: added a default iq handler attribute and
+	  use it in handle_iq if the incoming IQ isn't handled by the
+	  library. This way a user of the library can now do anything with
+	  it, even use it's own namespaces and such.
+
+	* loudmouth/*: Changes LmXMLNode -> LmNode
+
+	* loudmouth/*:
+	- Using LmXMLNode internally in all elements
+	- Use lm_message_new, lm_iq_new, lm_presence new instead of
+	  g_object_new
+	
+	* loudmouth/lm-presence.c:
+	(presence_get_xml_string): set to='' if it exists
+
+	* loudmouth/lm-xml-node.c:
+	(lm_xml_node_ref): added
+	(lm_xml_node_unref): added
+	(lm_xml_node_free): made private
+
+	* loudmouth/lm-parser.c:
+	(parser_end_element_cb): just unref the node, don't free it.
+
+	* loudmouth/lm-client.c: 
+	- added "name", "version" and "os" proprties.
+	(lm_client_register_default_message_handler):
+	(lm_client_register_default_presence_handler): removed, unused
+
+	* loudmouth/lm-element.[ch]: 
+	(lm_element_get_tree): Added, returns the XML tree for the
+	  element.
+	(ilm_element_setup_from_xml): ref the node.
+
+2002-11-20  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-parser.c (lm_parser_parse): Try to convert the xml
+	  input to from ISO-8859-1 to UTF-8 if it's not valid UTF-8. Not
+	  the perfect fix but it makes a common case work.
+
+2002-11-16  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-client.c (lm_client_disconnect): send end of
+  	  stream.
+
+2002-11-15  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-roster.c (lm_roster_new_from_query_node): Get the
+	  group from the child of the query node.
+
+2002-11-15  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-client.c: no more signals. You now register message
+	  and presence handlers.
+
+	* loudmouth/lm-presence.c (presence_get_property): implemented
+
+	* loudmouth/lm-client.c: 
+	- removed the disconnected and connected signals. Now callbacks
+	  passed to lm_client_connect.
+
+2002-11-14  Mikael Hallendal  <micke@codefactory.se>
+
+	* loudmouth/lm-presence.c:
+	(presence_class_init): type and show to be int's.
+	(presence_set_property): same.
+
+	* configure.in: bumped version to 0.1.1
+
+	* loudmouth/lm-presence.c (lm_presence_set_status): added.
+
+	* loudmouth/lm-element.c (element_class_init): not sure if we want
+	  this but readded the PROP_ERROR.
+
+	* loudmouth/lm-client.c (lm_client_authenticate): silent warnings
+
+	* loudmouth/lm-iq.c (iq_set_attribute): chain up.
+
+	* loudmouth/lm-element.c (element_get_property): implement.
+
+	* loudmouth/lm-client.c:
+	- use callbacks for auth and roster instead of signals.
+	(client_handle_iq): handle auth and roster
+	(client_add_callback): added
+	(client_find_callback): added
+	(client_remove_callback): added
+	(lm_client_send): take an extra id argument. If passed the message
+	  id will be copied to this argument.
+	(lm_client_authenticate): take callback+userdata as arguments.
+	(lm_client_request_roster): same
+
+2002-10-21  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-message.c (message_get_xml_string): Escape the
+	  body, fixes server disconnecting on messages containing <>.
+
+2002-10-02  Richard Hult  <rhult@codefactory.se>
+
+	* loudmouth/lm-xml-node.c (lm_xml_node_set_value): Don't run
+	  strdown on the node value.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/INSTALL	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,182 @@
+Basic Installation
+==================
+
+   These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+   The file `configure.in' is used to create `configure' by a program
+called `autoconf'.  You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  You can give `configure'
+initial values for variables by setting them in the environment.  Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory.  After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on.  Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+     CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+   If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+     Use and save the results of the tests in FILE instead of
+     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
+     debugging `configure'.
+
+`--help'
+     Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--version'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile.am	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,10 @@
+SUBDIRS = loudmouth docs
+
+EXTRA_DIST =			\
+	loudmouth-1.0.pc.in     \
+        loudmouth.spec          \
+	loudmouth.spec.in
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = loudmouth-1.0.pc
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NEWS	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,10 @@
+Changes in 0.9:
+---------------
+
+* Build fixes Solaris
+* Non async operations
+* API additions to ease binding efforts
+* Added Debug output support
+* Bug fixes
+* API changes (see below).
+* Support for disconnect and disconnect signalling.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,56 @@
+Introduction:
+=============
+
+Loudmouth is a lightweight and easy-to-use C library for programming with the
+Jabber protocol. It's designed to be easy to get started with and yet
+extensible to let you do anything the Jabber protocol allows.
+
+The goal is to fully support Linux, *BSD, Mac OSX and Windows. It has
+currently only been tested on Linux (Red Hat 8.0, Debian Unstable) and FreeBSD
+that I know of. If someone with access to other machines can provide
+feedback I would be most grateful.
+
+
+Requirements:
+=============
+
+Glib >= 2.0:
+ftp://ftp.gtk.org/pub/gtk/v2.2/
+
+gtk-doc (optional, if you want documentation built):
+ftp://ftp.gnome.org/pub/GNOME/sources/gtk-doc/1.0
+
+
+Building:
+=========
+
+./configure --prefix=
+make
+make install
+
+
+Debugging:
+==========
+
+You can get debug information printed to STDOUT by using the environment 
+variable LM_DEBUG.
+
+export LM_DEBUG=<keyword>
+
+Where keyword is one or more (separated by :) of the following:
+
+* "NET": Shows all the data sent over the network.
+* "PARSER": Shows debug output from the parser.
+* "VERBOSE": Shows various verbose output.
+* "ALL": Enables all output.
+
+
+Questions, remarks, bug reports:
+================================
+
+Please file bugs at:
+http://bugzilla.codefactory.se/enter_bug.cgi?product=loudmouth
+
+Questions and others can be sent to me at:
+email: micke@codefactory.se
+jabber: micke@jabber.codefactory.se
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/acinclude.m4	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,61 @@
+dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.
+
+AC_DEFUN([LM_COMPILE_WARNINGS],[
+   if test -f $srcdir/autogen.sh; then
+	default_compile_warnings="error"
+    else
+	default_compile_warnings="no"
+    fi
+
+    AC_ARG_WITH(compile-warnings, [  --with-compile-warnings=[no/yes/error] Compiler warnings ], [enable_compile_warnings="$withval"], [enable_compile_warnings="$default_compile_warnings"])
+
+    warnCFLAGS=
+    if test "x$GCC" != xyes; then
+	enable_compile_warnings=no
+    fi
+
+    warning_flags=
+    realsave_CFLAGS="$CFLAGS"
+
+    case "$enable_compile_warnings" in
+    no)
+	warning_flags=
+	;;
+    yes)
+	warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations"
+	;;
+    maximum|error)
+	warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
+	CFLAGS="$warning_flags $CFLAGS"
+	for option in -Wsign-promo -Wno-sign-compare; do
+		SAVE_CFLAGS="$CFLAGS"
+		CFLAGS="$CFLAGS $option"
+		AC_MSG_CHECKING([whether gcc understands $option])
+		AC_TRY_COMPILE([], [],
+			has_option=yes,
+			has_option=no,)
+		CFLAGS="$SAVE_CFLAGS"
+		AC_MSG_RESULT($has_option)
+		if test $has_option = yes; then
+		  warning_flags="$warning_flags $option"
+		fi
+		unset has_option
+		unset SAVE_CFLAGS
+	done
+	unset option
+	if test "$enable_compile_warnings" = "error" ; then
+	    warning_flags="$warning_flags -Werror"
+	fi
+	;;
+    *)
+	AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
+	;;
+    esac
+    CFLAGS="$realsave_CFLAGS"
+    AC_MSG_CHECKING(what warning flags to pass to the C compiler)
+    AC_MSG_RESULT($warning_flags)
+
+    WARN_CFLAGS="$warning_flags"
+    AC_SUBST(WARN_CFLAGS)
+])
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autogen.sh	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+PACKAGE="loudmouth"
+
+have_libtool=false
+have_autoconf=false
+have_automake=false
+need_configure_in=false
+
+if libtool --version < /dev/null > /dev/null 2>&1 ; then
+	libtool_version=`libtoolize --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
+	have_libtool=true
+	case $libtool_version in
+	    1.3*)
+		need_configure_in=true
+		;;
+	esac
+fi
+
+if autoconf --version < /dev/null > /dev/null 2>&1 ; then
+	autoconf_version=`autoconf --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
+	have_autoconf=true
+	case $autoconf_version in
+	    2.13)
+		need_configure_in=true
+		;;
+	esac
+fi
+
+if $have_libtool ; then : ; else
+	echo;
+	echo "You must have libtool >= 1.3 installed to compile $PACKAGE";
+	echo;
+	exit;
+fi
+
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+	echo;
+	echo "You must have automake installed to compile $PACKAGE";
+	echo;
+	exit;
+}
+
+echo "Generating configuration files for $PACKAGE, please wait...."
+echo;
+
+if $need_configure_in ; then
+    if test ! -f configure.in ; then
+	echo "Creating symlink from configure.in to configure.ac..."
+	echo
+	ln -s configure.ac configure.in
+    fi
+fi
+
+aclocal $ACLOCAL_FLAGS
+libtoolize --force
+autoheader
+automake --add-missing
+autoconf
+
+./configure $@ --enable-maintainer-mode --enable-compile-warnings
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configure.in	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,129 @@
+AC_INIT(loudmouth/lm-message.h)
+
+AM_CONFIG_HEADER(config.h)
+
+AM_INIT_AUTOMAKE(loudmouth, 0.9)
+
+AM_MAINTAINER_MODE
+
+AC_PROG_CC
+AC_ISC_POSIX
+AC_HEADER_STDC
+AM_PROG_LIBTOOL
+
+AM_PATH_GLIB_2_0
+
+LM_COMPILE_WARNINGS
+
+changequote(,)dnl
+if test "x$GCC" = "xyes"; then
+  case " $CFLAGS " in
+  *[\ \	]-Wall[\ \	]*) ;;
+  *) CFLAGS="$CFLAGS -Wall" ;;
+  esac
+fi
+changequote([,])dnl
+
+AC_SUBST(CFLAGS)
+AC_SUBST(LDFLAGS)
+
+GLIB2_REQUIRED=2.0.0
+AC_SUBST(GLIB2_REQUIRED)
+
+PKG_CHECK_MODULES(LOUDMOUTH, glib-2.0 >= $GLIB2_REQUIRED)
+
+dnl +--------------------+
+dnl | Check for gtk-doc. |-------------------------------
+dnl +--------------------+
+
+AC_ARG_WITH(html-dir, [  --with-html-dir=PATH path to installed docs ])
+
+if test "x$with_html_dir" = "x" ; then
+  HTML_DIR='${datadir}/gtk-doc/html'
+else
+  HTML_DIR=$with_html_dir
+fi
+
+AC_SUBST(HTML_DIR)
+
+gtk_doc_min_version=1.0
+AC_MSG_CHECKING([gtk-doc version >= $gtk_doc_min_version])
+if pkg-config --atleast-version=$gtk_doc_min_version gtk-doc; then
+  AC_MSG_RESULT(yes)
+  GTKDOC=true
+else
+  AC_MSG_RESULT(no)
+  GTKDOC=false
+fi
+
+dnl Let people disable the gtk-doc stuff.
+AC_ARG_ENABLE(gtk-doc, [  --enable-gtk-doc  Use gtk-doc to build documentation [default=no]], enable_gtk_doc="$enableval", enable_gtk_doc=no)
+
+if test x$enable_gtk_doc = xauto ; then
+  if test x$GTKDOC = xtrue ; then
+    enable_gtk_doc=yes
+  else
+    enable_gtk_doc=no
+  fi
+fi
+
+AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
+
+dnl define a MAINT-like variable REBUILD which is set if Perl
+dnl and awk are found, so autogenerated sources can be rebuilt
+AC_ARG_ENABLE(rebuilds, [  --disable-rebuilds      disable all source autogeneration rules],,enable_rebuilds=yes)
+REBUILD=\#
+if test "x$enable_rebuilds" = "xyes" && \
+     test -n "$PERL" && \
+     $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 && \
+     test -n "$AWK" ; then
+  REBUILD=
+fi
+AC_SUBST(REBUILD)
+
+
+dnl +--------------------------------------------------------+
+dnl | Checking for libnsl and libsocket need on some systems |-
+dnl +--------------------------------------------------------+
+AC_CHECK_LIB(nsl,gethostbyname)
+AC_CHECK_LIB(socket,socket)
+
+
+dnl +-------------+
+dnl | Build Flags |--------------------------------------------
+dnl +-------------+
+DOC_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $WARN_CFLAGS"
+AC_SUBST(DOC_CFLAGS)
+AC_SUBST(CFLAGS)
+AC_SUBST(CPPFLAGS)
+AC_SUBST(LDFLAGS)
+dnl -----------------------------------------------------------
+
+dnl +--------------+
+dnl | Debug output |-------------------------------------------
+dnl +--------------+
+
+AC_ARG_ENABLE(debug, 
+	      [  --enable-debug          Enable debug output [default=yes]],
+	      enable_debug="$enableval", enable_debug=yes, enable_debug=no)
+
+if test x$enable_debug = xno ; then
+	echo "Debugging disabled"
+	LOUDMOUTH_CFLAGS="$LOUDMOUTH_CFLAGS -DLM_NO_DEBUG"
+else
+	echo "Debugging enabled"
+fi
+
+AC_SUBST(LOUDMOUTH_CFLAGS)
+AC_SUBST(LOUDMOUTH_LIBS)
+
+#CFLAGS="$CFLAGS $WARN_CFLAGS"
+
+AC_OUTPUT([
+Makefile
+docs/Makefile
+docs/reference/Makefile
+loudmouth/Makefile
+loudmouth-1.0.pc
+loudmouth.spec])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/.svn/README	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,2 @@
+This is a Subversion working copy administrative directory.
+Visit http://subversion.tigris.org/ for more information.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/.svn/dir-wcprops	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,9 @@
+K 25
+svn:wc:ra_dav:version-url
+V 47
+/svn/projects/!svn/ver/346/loudmouth/trunk/docs
+K 26
+svn:wc:ra_dav:activity-url
+V 23
+/svn/projects/!svn/act/
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/.svn/entries	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<wc-entries
+   xmlns="svn:">
+<entry
+   committed-rev="346"
+   name="svn:this_dir"
+   committed-date="2003-04-17T10:56:10.375431Z"
+   url="http://svn.codefactory.se/svn/projects/loudmouth/trunk/docs"
+   last-author="micke"
+   kind="dir"
+   revision="349"/>
+<entry
+   committed-rev="21"
+   name="Makefile.am"
+   text-time="2003-05-19T18:18:03.000000Z"
+   committed-date="2003-02-11T01:38:55.000000Z"
+   checksum="95029d86262c62b94e0a7bc5a57c36bf"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:18:03.000000Z"/>
+<entry
+   name="reference"
+   kind="dir"/>
+</wc-entries>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/.svn/format	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/.svn/prop-base/Makefile.am.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/.svn/props/Makefile.am.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/.svn/text-base/Makefile.am.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,2 @@
+SUBDIRS = reference
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/.svn/wcprops/Makefile.am.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 58
+/svn/projects/!svn/ver/21/loudmouth/trunk/docs/Makefile.am
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/Makefile.am	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,2 @@
+SUBDIRS = reference
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/README	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,2 @@
+This is a Subversion working copy administrative directory.
+Visit http://subversion.tigris.org/ for more information.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/dir-wcprops	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,9 @@
+K 25
+svn:wc:ra_dav:version-url
+V 57
+/svn/projects/!svn/ver/346/loudmouth/trunk/docs/reference
+K 26
+svn:wc:ra_dav:activity-url
+V 23
+/svn/projects/!svn/act/
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/entries	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<wc-entries
+   xmlns="svn:">
+<entry
+   committed-rev="346"
+   name="svn:this_dir"
+   committed-date="2003-04-17T10:56:10.375431Z"
+   url="http://svn.codefactory.se/svn/projects/loudmouth/trunk/docs/reference"
+   last-author="micke"
+   kind="dir"
+   revision="349"/>
+<entry
+   committed-rev="42"
+   name="loudmouth.types"
+   text-time="2003-05-19T18:18:07.000000Z"
+   committed-date="2003-03-12T23:52:11.000000Z"
+   checksum="d41d8cd98f00b204e9800998ecf8427e"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:18:07.000000Z"/>
+<entry
+   committed-rev="317"
+   name="loudmouth-sections.txt"
+   text-time="2003-05-19T18:18:08.000000Z"
+   committed-date="2003-04-01T02:25:19.357019Z"
+   checksum="08709516b858396f24178ef6c6783597"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:18:08.000000Z"/>
+<entry
+   committed-rev="21"
+   name="loudmouth-docs.sgml"
+   text-time="2003-05-19T18:18:06.000000Z"
+   committed-date="2003-02-11T01:38:55.000000Z"
+   checksum="d96a032397c2ae06084fc110d8dc2101"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:18:06.000000Z"/>
+<entry
+   committed-rev="346"
+   name="Makefile.am"
+   text-time="2003-05-19T18:18:05.000000Z"
+   committed-date="2003-04-17T10:56:10.375431Z"
+   checksum="e5c00eb8a03370796ced1fdab203f2c6"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:18:05.000000Z"/>
+<entry
+   name="tmpl"
+   kind="dir"/>
+<entry
+   committed-rev="1"
+   name="loudmouth-overrides.txt"
+   text-time="2003-05-19T18:18:08.000000Z"
+   committed-date="2003-01-31T11:46:56.000000Z"
+   checksum="03cb3cb89d00280a2c431f89499b2b62"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:18:08.000000Z"/>
+</wc-entries>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/format	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/prop-base/Makefile.am.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/prop-base/loudmouth-docs.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/prop-base/loudmouth-overrides.txt.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/prop-base/loudmouth-sections.txt.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/prop-base/loudmouth.types.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/props/Makefile.am.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/props/loudmouth-docs.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/props/loudmouth-overrides.txt.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/props/loudmouth-sections.txt.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/props/loudmouth.types.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/text-base/Makefile.am.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,195 @@
+## Process this file with automake to produce Makefile.in
+
+# The name of the module.
+DOC_MODULE=loudmouth
+
+# The top-level SGML file.
+DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
+
+# The directory containing the source code. Relative to $(srcdir)
+DOC_SOURCE_DIR=../../loudmouth
+
+# Extra options to pass to gtkdoc-scangobj
+SCANGOBJ_OPTIONS=
+
+# Extra options to supply to gtkdoc-scan
+#SCAN_OPTIONS=--deprecated-guards="GTK_ENABLE_BROKEN|GTK_DISABLE_DEPRECATED" 
+
+# Extra options to supply to gtkdoc-mkdb
+MKDB_OPTIONS=--sgml-mode --output-format=xml
+
+# Extra options to supply to gtkdoc-fixref
+#FIXXREF_OPTIONS=--extra-dir=../file-modules/html --extra-dir=../file-modules/html
+
+# Used for dependencies
+HFILE_GLOB=$(top_srcdir)/loudmouth/*.h
+CFILE_GLOB=$(top_srcdir)/loudmouth/*.c
+
+# Header files to ignore when scanning
+IGNORE_HFILES= lm-internals.h lm-sha.h lm-parser.h loudmouth.h
+
+# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE)
+content_files = 		
+
+# Other files to distribute
+extra_files =
+
+# CFLAGS and LDFLAGS for compiling scan program. Only needed
+# if $(DOC_MODULE).types is non-empty.
+GTKDOC_CFLAGS = 					\
+	$(LOUDMOUTH_CFLAGS)				\
+	-DLM_COMPILATION				\
+	-I$(top_srcdir) 				\
+	-I$(top_builddir)/loudmouth
+
+GTKDOC_LIBS =						\
+	$(LOUDMOUTH_LIBS)				\
+	$(top_builddir)/loudmouth/libloudmouth.la
+
+
+GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC)
+GTKDOC_LD=$(LIBTOOL) --mode=link $(CC)
+
+
+####################################
+# Everything below here is generic #
+####################################
+
+# We set GPATH here; this gives us semantics for GNU make
+# which are more like other make's VPATH, when it comes to
+# whether a source that is a target of one rule is then
+# searched for in VPATH/GPATH.
+#
+GPATH = $(srcdir)
+
+TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
+
+EXTRA_DIST = 				\
+	$(content_files)		\
+	$(extra_files)			\
+	$(DOC_MAIN_SGML_FILE)		\
+	$(DOC_MODULE).types		\
+	$(DOC_MODULE)-sections.txt	\
+	$(DOC_MODULE)-overrides.txt
+
+DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \
+	   $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp
+
+SCANOBJ_FILES = 		 \
+	$(DOC_MODULE).args 	 \
+	$(DOC_MODULE).hierarchy  \
+	$(DOC_MODULE).interfaces \
+	$(DOC_MODULE).prerequisites \
+	$(DOC_MODULE).signals
+
+if ENABLE_GTK_DOC
+all-local: html-build.stamp
+
+#### scan ####
+
+scan-build.stamp: $(HFILE_GLOB)
+	@echo '*** Scanning header files ***'
+	if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null ; then \
+	    CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
+	else \
+	    cd $(srcdir) ; \
+	    for i in $(SCANOBJ_FILES) ; do \
+               test -f $$i || touch $$i ; \
+	    done \
+	fi
+	cd $(srcdir) && \
+	  gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
+	touch scan-build.stamp
+
+$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp
+	@true
+
+#### templates ####
+
+tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
+	@echo '*** Rebuilding template files ***'
+	cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE)
+	touch tmpl-build.stamp
+
+tmpl.stamp: tmpl-build.stamp
+	@true
+
+#### sgml ####
+
+sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(srcdir)/tmpl/*.sgml
+	@echo '*** Building SGML ***'
+	cd $(srcdir) && \
+	gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) $(MKDB_OPTIONS)
+	touch sgml-build.stamp
+
+sgml.stamp: sgml-build.stamp
+	@true
+
+#### html ####
+
+html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
+	@echo '*** Building HTML ***'
+	rm -rf $(srcdir)/html 
+	mkdir $(srcdir)/html
+	cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
+	test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
+	@echo '-- Fixing Crossreferences' 
+	cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
+	touch html-build.stamp
+endif
+
+##############
+
+clean-local:
+	rm -f *~ *.bak $(SCANOBJ_FILES) *-unused.txt $(DOC_STAMPS)
+
+maintainer-clean-local: clean
+	cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
+
+if ENABLE_GTK_DOC
+install-data-local:
+	$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)
+	(installfiles=`echo $(srcdir)/html/*`; \
+	if test "$$installfiles" = '$(srcdir)/html/*'; \
+	then echo '-- Nothing to install' ; \
+	else \
+	  for i in $$installfiles; do \
+	    echo '-- Installing '$$i ; \
+	    $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
+	  done; \
+	  echo '-- Installing $(srcdir)/html/index.sgml' ; \
+	  $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR); \
+	fi)
+else
+install-data-local:
+endif
+
+#
+# Require gtk-doc when making dist
+#
+if ENABLE_GTK_DOC
+dist-check-gtkdoc:
+else
+dist-check-gtkdoc:
+	@echo "*** gtk-doc must be installed and enabled in order to make dist"
+#	@false
+endif
+
+dist-hook: dist-check-gtkdoc dist-hook-local
+	mkdir $(distdir)/tmpl
+	mkdir $(distdir)/xml
+	mkdir $(distdir)/html
+	-cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
+	-cp $(srcdir)/xml/*.xml $(distdir)/xml
+	-cp $(srcdir)/html/* $(distdir)/html
+
+.PHONY : dist-hook-local
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/text-base/loudmouth-docs.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
+               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<book id="index" xmlns:xi="http://www.w3.org/2001/XInclude">
+  <bookinfo>
+    <title>Loudmouth Reference Manual</title>
+  </bookinfo>
+
+  <chapter>
+    <title>Loudmouth</title>
+    <xi:include href="xml/lm-connection.xml"/>
+    <xi:include href="xml/lm-error.xml"/>
+    <xi:include href="xml/lm-message.xml"/>
+    <xi:include href="xml/lm-message-handler.xml"/>
+    <xi:include href="xml/lm-message-node.xml"/>
+  </chapter>
+</book>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/text-base/loudmouth-overrides.txt.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,4 @@
+# These are manually-edited to override or add declarations to those scanned
+# from the header files.
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/text-base/loudmouth-sections.txt.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,84 @@
+<SECTION>
+<FILE>lm-connection</FILE>
+LM_CONNECTION
+LM_CONNECTION_DEFAULT_PORT
+LM_CONNECTION_DEFAULT_PORT_SSL
+LmConnection
+LmHandlerResult
+LmHandlerPriority
+LmDisconnectReason
+LmResultFunction
+LmDisconnectFunction
+lm_connection_new
+lm_connection_open
+lm_connection_open_and_block
+lm_connection_close
+lm_connection_authenticate
+lm_connection_authenticate_and_block
+lm_connection_is_connected
+lm_connection_is_authenticated
+lm_connection_get_server
+lm_connection_set_server
+lm_connection_get_port
+lm_connection_set_port
+lm_connection_get_use_ssl
+lm_connection_set_use_ssl
+lm_connection_send
+lm_connection_send_with_reply
+lm_connection_send_with_reply_and_block
+lm_connection_register_message_handler
+lm_connection_unregister_message_handler
+lm_connection_set_disconnect_function
+lm_connection_send_raw
+lm_connection_ref
+lm_connection_unref
+</SECTION>
+
+<SECTION>
+<FILE>lm-message-handler</FILE>
+LmHandleMessageFunction
+lm_message_handler_new
+lm_message_handler_ref
+lm_message_handler_unref
+</SECTION>
+
+<SECTION>
+<FILE>lm-message-node</FILE>
+LmMessageNode
+lm_message_node_get_value
+lm_message_node_set_value
+lm_message_node_add_child
+lm_message_node_set_attributes
+lm_message_node_get_attribute
+lm_message_node_set_attribute
+lm_message_node_get_child
+lm_message_node_find_child
+lm_message_node_ref
+lm_message_node_unref
+lm_message_node_to_string
+</SECTION>
+
+<SECTION>
+<FILE>lm-message</FILE>
+LmMessage
+LmMessageType
+LmMessageSubType
+lm_message_new
+lm_message_new_with_sub_type
+lm_message_get_type
+lm_message_get_sub_type
+lm_message_get_node
+lm_message_ref
+lm_message_unref
+</SECTION>
+
+<SECTION>
+<FILE>lm-utils</FILE>
+</SECTION>
+
+<SECTION>
+<FILE>lm-error</FILE>
+lm_error_quark
+</SECTION>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/wcprops/Makefile.am.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 69
+/svn/projects/!svn/ver/346/loudmouth/trunk/docs/reference/Makefile.am
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/wcprops/loudmouth-docs.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/projects/!svn/ver/21/loudmouth/trunk/docs/reference/loudmouth-docs.sgml
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/wcprops/loudmouth-overrides.txt.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 79
+/svn/projects/!svn/ver/1/loudmouth/trunk/docs/reference/loudmouth-overrides.txt
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/wcprops/loudmouth-sections.txt.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 80
+/svn/projects/!svn/ver/317/loudmouth/trunk/docs/reference/loudmouth-sections.txt
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/.svn/wcprops/loudmouth.types.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/projects/!svn/ver/42/loudmouth/trunk/docs/reference/loudmouth.types
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/Makefile.am	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,195 @@
+## Process this file with automake to produce Makefile.in
+
+# The name of the module.
+DOC_MODULE=loudmouth
+
+# The top-level SGML file.
+DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
+
+# The directory containing the source code. Relative to $(srcdir)
+DOC_SOURCE_DIR=../../loudmouth
+
+# Extra options to pass to gtkdoc-scangobj
+SCANGOBJ_OPTIONS=
+
+# Extra options to supply to gtkdoc-scan
+#SCAN_OPTIONS=--deprecated-guards="GTK_ENABLE_BROKEN|GTK_DISABLE_DEPRECATED" 
+
+# Extra options to supply to gtkdoc-mkdb
+MKDB_OPTIONS=--sgml-mode --output-format=xml
+
+# Extra options to supply to gtkdoc-fixref
+#FIXXREF_OPTIONS=--extra-dir=../file-modules/html --extra-dir=../file-modules/html
+
+# Used for dependencies
+HFILE_GLOB=$(top_srcdir)/loudmouth/*.h
+CFILE_GLOB=$(top_srcdir)/loudmouth/*.c
+
+# Header files to ignore when scanning
+IGNORE_HFILES= lm-internals.h lm-sha.h lm-parser.h loudmouth.h
+
+# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE)
+content_files = 		
+
+# Other files to distribute
+extra_files =
+
+# CFLAGS and LDFLAGS for compiling scan program. Only needed
+# if $(DOC_MODULE).types is non-empty.
+GTKDOC_CFLAGS = 					\
+	$(LOUDMOUTH_CFLAGS)				\
+	-DLM_COMPILATION				\
+	-I$(top_srcdir) 				\
+	-I$(top_builddir)/loudmouth
+
+GTKDOC_LIBS =						\
+	$(LOUDMOUTH_LIBS)				\
+	$(top_builddir)/loudmouth/libloudmouth.la
+
+
+GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC)
+GTKDOC_LD=$(LIBTOOL) --mode=link $(CC)
+
+
+####################################
+# Everything below here is generic #
+####################################
+
+# We set GPATH here; this gives us semantics for GNU make
+# which are more like other make's VPATH, when it comes to
+# whether a source that is a target of one rule is then
+# searched for in VPATH/GPATH.
+#
+GPATH = $(srcdir)
+
+TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
+
+EXTRA_DIST = 				\
+	$(content_files)		\
+	$(extra_files)			\
+	$(DOC_MAIN_SGML_FILE)		\
+	$(DOC_MODULE).types		\
+	$(DOC_MODULE)-sections.txt	\
+	$(DOC_MODULE)-overrides.txt
+
+DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \
+	   $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp
+
+SCANOBJ_FILES = 		 \
+	$(DOC_MODULE).args 	 \
+	$(DOC_MODULE).hierarchy  \
+	$(DOC_MODULE).interfaces \
+	$(DOC_MODULE).prerequisites \
+	$(DOC_MODULE).signals
+
+if ENABLE_GTK_DOC
+all-local: html-build.stamp
+
+#### scan ####
+
+scan-build.stamp: $(HFILE_GLOB)
+	@echo '*** Scanning header files ***'
+	if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null ; then \
+	    CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
+	else \
+	    cd $(srcdir) ; \
+	    for i in $(SCANOBJ_FILES) ; do \
+               test -f $$i || touch $$i ; \
+	    done \
+	fi
+	cd $(srcdir) && \
+	  gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
+	touch scan-build.stamp
+
+$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp
+	@true
+
+#### templates ####
+
+tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
+	@echo '*** Rebuilding template files ***'
+	cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE)
+	touch tmpl-build.stamp
+
+tmpl.stamp: tmpl-build.stamp
+	@true
+
+#### sgml ####
+
+sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(srcdir)/tmpl/*.sgml
+	@echo '*** Building SGML ***'
+	cd $(srcdir) && \
+	gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) $(MKDB_OPTIONS)
+	touch sgml-build.stamp
+
+sgml.stamp: sgml-build.stamp
+	@true
+
+#### html ####
+
+html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
+	@echo '*** Building HTML ***'
+	rm -rf $(srcdir)/html 
+	mkdir $(srcdir)/html
+	cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
+	test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
+	@echo '-- Fixing Crossreferences' 
+	cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
+	touch html-build.stamp
+endif
+
+##############
+
+clean-local:
+	rm -f *~ *.bak $(SCANOBJ_FILES) *-unused.txt $(DOC_STAMPS)
+
+maintainer-clean-local: clean
+	cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
+
+if ENABLE_GTK_DOC
+install-data-local:
+	$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)
+	(installfiles=`echo $(srcdir)/html/*`; \
+	if test "$$installfiles" = '$(srcdir)/html/*'; \
+	then echo '-- Nothing to install' ; \
+	else \
+	  for i in $$installfiles; do \
+	    echo '-- Installing '$$i ; \
+	    $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
+	  done; \
+	  echo '-- Installing $(srcdir)/html/index.sgml' ; \
+	  $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR); \
+	fi)
+else
+install-data-local:
+endif
+
+#
+# Require gtk-doc when making dist
+#
+if ENABLE_GTK_DOC
+dist-check-gtkdoc:
+else
+dist-check-gtkdoc:
+	@echo "*** gtk-doc must be installed and enabled in order to make dist"
+#	@false
+endif
+
+dist-hook: dist-check-gtkdoc dist-hook-local
+	mkdir $(distdir)/tmpl
+	mkdir $(distdir)/xml
+	mkdir $(distdir)/html
+	-cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
+	-cp $(srcdir)/xml/*.xml $(distdir)/xml
+	-cp $(srcdir)/html/* $(distdir)/html
+
+.PHONY : dist-hook-local
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/loudmouth-docs.sgml	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
+               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<book id="index" xmlns:xi="http://www.w3.org/2001/XInclude">
+  <bookinfo>
+    <title>Loudmouth Reference Manual</title>
+  </bookinfo>
+
+  <chapter>
+    <title>Loudmouth</title>
+    <xi:include href="xml/lm-connection.xml"/>
+    <xi:include href="xml/lm-error.xml"/>
+    <xi:include href="xml/lm-message.xml"/>
+    <xi:include href="xml/lm-message-handler.xml"/>
+    <xi:include href="xml/lm-message-node.xml"/>
+  </chapter>
+</book>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/loudmouth-overrides.txt	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,4 @@
+# These are manually-edited to override or add declarations to those scanned
+# from the header files.
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/loudmouth-sections.txt	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,84 @@
+<SECTION>
+<FILE>lm-connection</FILE>
+LM_CONNECTION
+LM_CONNECTION_DEFAULT_PORT
+LM_CONNECTION_DEFAULT_PORT_SSL
+LmConnection
+LmHandlerResult
+LmHandlerPriority
+LmDisconnectReason
+LmResultFunction
+LmDisconnectFunction
+lm_connection_new
+lm_connection_open
+lm_connection_open_and_block
+lm_connection_close
+lm_connection_authenticate
+lm_connection_authenticate_and_block
+lm_connection_is_connected
+lm_connection_is_authenticated
+lm_connection_get_server
+lm_connection_set_server
+lm_connection_get_port
+lm_connection_set_port
+lm_connection_get_use_ssl
+lm_connection_set_use_ssl
+lm_connection_send
+lm_connection_send_with_reply
+lm_connection_send_with_reply_and_block
+lm_connection_register_message_handler
+lm_connection_unregister_message_handler
+lm_connection_set_disconnect_function
+lm_connection_send_raw
+lm_connection_ref
+lm_connection_unref
+</SECTION>
+
+<SECTION>
+<FILE>lm-message-handler</FILE>
+LmHandleMessageFunction
+lm_message_handler_new
+lm_message_handler_ref
+lm_message_handler_unref
+</SECTION>
+
+<SECTION>
+<FILE>lm-message-node</FILE>
+LmMessageNode
+lm_message_node_get_value
+lm_message_node_set_value
+lm_message_node_add_child
+lm_message_node_set_attributes
+lm_message_node_get_attribute
+lm_message_node_set_attribute
+lm_message_node_get_child
+lm_message_node_find_child
+lm_message_node_ref
+lm_message_node_unref
+lm_message_node_to_string
+</SECTION>
+
+<SECTION>
+<FILE>lm-message</FILE>
+LmMessage
+LmMessageType
+LmMessageSubType
+lm_message_new
+lm_message_new_with_sub_type
+lm_message_get_type
+lm_message_get_sub_type
+lm_message_get_node
+lm_message_ref
+lm_message_unref
+</SECTION>
+
+<SECTION>
+<FILE>lm-utils</FILE>
+</SECTION>
+
+<SECTION>
+<FILE>lm-error</FILE>
+lm_error_quark
+</SECTION>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/README	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,2 @@
+This is a Subversion working copy administrative directory.
+Visit http://subversion.tigris.org/ for more information.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/dir-wcprops	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,9 @@
+K 25
+svn:wc:ra_dav:version-url
+V 62
+/svn/projects/!svn/ver/337/loudmouth/trunk/docs/reference/tmpl
+K 26
+svn:wc:ra_dav:activity-url
+V 23
+/svn/projects/!svn/act/
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/entries	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<wc-entries
+   xmlns="svn:">
+<entry
+   committed-rev="337"
+   name="svn:this_dir"
+   committed-date="2003-04-10T22:31:29.810044Z"
+   url="http://svn.codefactory.se/svn/projects/loudmouth/trunk/docs/reference/tmpl"
+   last-author="micke"
+   kind="dir"
+   revision="349"/>
+<entry
+   committed-rev="36"
+   name="lm-error.sgml"
+   text-time="2003-05-19T18:18:11.000000Z"
+   committed-date="2003-03-05T01:15:07.000000Z"
+   checksum="afda254755c6d28195678c7c8ea24817"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:18:11.000000Z"/>
+<entry
+   committed-rev="34"
+   name="loudmouth-unused.sgml"
+   text-time="2003-05-19T18:18:16.000000Z"
+   committed-date="2003-03-05T00:32:17.000000Z"
+   checksum="9d53229711c45a70506591c26fccbd95"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:18:16.000000Z"/>
+<entry
+   committed-rev="21"
+   name="lm-result.sgml"
+   text-time="2003-05-19T18:18:15.000000Z"
+   committed-date="2003-02-11T01:38:55.000000Z"
+   checksum="98caf5f35acf6c3d141fce5c559abaee"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:18:15.000000Z"/>
+<entry
+   committed-rev="337"
+   name="lm-connection.sgml"
+   text-time="2003-05-19T18:18:14.000000Z"
+   committed-date="2003-04-10T22:31:29.810044Z"
+   checksum="0d9b09592666562d9501f528f465f619"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:18:14.000000Z"/>
+<entry
+   committed-rev="32"
+   name="lm-message-handler.sgml"
+   text-time="2003-05-19T18:18:14.000000Z"
+   committed-date="2003-03-05T00:17:50.000000Z"
+   checksum="d9ab150839b0ec4929bd88086f8af42c"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:18:14.000000Z"/>
+<entry
+   committed-rev="1"
+   name="lm-utils.sgml"
+   text-time="2003-05-19T18:18:13.000000Z"
+   committed-date="2003-01-31T11:46:56.000000Z"
+   checksum="77ab146ed72c12994bcc59593f4b3d20"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:18:13.000000Z"/>
+<entry
+   committed-rev="337"
+   name="lm-message.sgml"
+   text-time="2003-05-19T18:18:12.000000Z"
+   committed-date="2003-04-10T22:31:29.810044Z"
+   checksum="0d4727f0401fb88e44dd4710b54b6e6c"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:18:12.000000Z"/>
+<entry
+   committed-rev="337"
+   name="lm-message-node.sgml"
+   text-time="2003-05-19T18:18:11.000000Z"
+   committed-date="2003-04-10T22:31:29.810044Z"
+   checksum="1a1ba94cc05483e372d50623ac11b25e"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:18:11.000000Z"/>
+</wc-entries>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/format	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/prop-base/lm-connection.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/prop-base/lm-error.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/prop-base/lm-message-handler.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/prop-base/lm-message-node.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/prop-base/lm-message.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/prop-base/lm-result.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/prop-base/lm-utils.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/prop-base/loudmouth-unused.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/props/lm-connection.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/props/lm-error.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/props/lm-message-handler.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/props/lm-message-node.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/props/lm-message.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/props/lm-result.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/props/lm-utils.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/props/loudmouth-unused.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/text-base/lm-connection.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,323 @@
+<!-- ##### SECTION Title ##### -->
+LmConnection
+
+<!-- ##### SECTION Short_Description ##### -->
+A client connection to the server
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### MACRO LM_CONNECTION ##### -->
+<para>
+Convenience macro used to cast a pointer to a #LmConnection.
+</para>
+
+@o: pointer to cast
+
+
+<!-- ##### MACRO LM_CONNECTION_DEFAULT_PORT ##### -->
+<para>
+Default jabber client port.
+</para>
+
+
+
+<!-- ##### MACRO LM_CONNECTION_DEFAULT_PORT_SSL ##### -->
+<para>
+Default jabber client port when using SSL encryption.
+</para>
+
+
+
+<!-- ##### STRUCT LmConnection ##### -->
+<para>
+This should not be accessed directly. Use the accessor functions as described below.
+</para>
+
+
+<!-- ##### ENUM LmHandlerResult ##### -->
+<para>
+The return type of an LmMessageHandler. This determines whether more message handlers should be called.
+</para>
+
+@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.
+
+<!-- ##### ENUM LmHandlerPriority ##### -->
+<para>
+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 side about which handler will be called first of them.
+</para>
+
+@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.
+
+<!-- ##### ENUM LmDisconnectReason ##### -->
+<para>
+Sent with #LmDisconnectFunction to describe why a connection was closed.
+</para>
+
+@LM_DISCONNECT_REASON_OK: 
+@LM_DISCONNECT_REASON_PING_TIME_OUT: Connection to the server pinged 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_UNKNOWN: An unknown error.
+
+<!-- ##### USER_FUNCTION LmResultFunction ##### -->
+<para>
+Callback for informing if an asynchronous operation was successful.
+</para>
+
+@connection: an #LmConnection
+@success: the result, %TRUE if operation succeeded, otherwise %FALSE
+@user_data: User data passed when function being called.
+
+
+<!-- ##### USER_FUNCTION LmDisconnectFunction ##### -->
+<para>
+Callback called when a connection is closed.
+</para>
+
+@connection: an #LmConnection
+@reason: the reason the connection was closed.
+@user_data: User data passed when function being called.
+
+
+<!-- ##### FUNCTION lm_connection_new ##### -->
+<para>
+
+</para>
+
+@server: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_open ##### -->
+<para>
+
+</para>
+
+@connection: 
+@function: 
+@user_data: 
+@notify: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_open_and_block ##### -->
+<para>
+
+</para>
+
+@connection: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_close ##### -->
+<para>
+
+</para>
+
+@connection: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_authenticate ##### -->
+<para>
+
+</para>
+
+@connection: 
+@username: 
+@password: 
+@resource: 
+@function: 
+@user_data: 
+@notify: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_authenticate_and_block ##### -->
+<para>
+
+</para>
+
+@connection: 
+@username: 
+@password: 
+@resource: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_is_authenticated ##### -->
+<para>
+
+</para>
+
+@connection: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_get_server ##### -->
+<para>
+
+</para>
+
+@connection: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_set_server ##### -->
+<para>
+
+</para>
+
+@connection: 
+@server: 
+
+
+<!-- ##### FUNCTION lm_connection_get_port ##### -->
+<para>
+
+</para>
+
+@connection: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_set_port ##### -->
+<para>
+
+</para>
+
+@connection: 
+@port: 
+
+
+<!-- ##### FUNCTION lm_connection_get_use_ssl ##### -->
+<para>
+
+</para>
+
+@connection: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_set_use_ssl ##### -->
+<para>
+
+</para>
+
+@connection: 
+@use_ssl: 
+
+
+<!-- ##### FUNCTION lm_connection_send ##### -->
+<para>
+
+</para>
+
+@connection: 
+@message: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_send_with_reply ##### -->
+<para>
+
+</para>
+
+@connection: 
+@message: 
+@handler: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_send_with_reply_and_block ##### -->
+<para>
+
+</para>
+
+@connection: 
+@message: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_register_message_handler ##### -->
+<para>
+
+</para>
+
+@connection: 
+@handler: 
+@type: 
+@priority: 
+
+
+<!-- ##### FUNCTION lm_connection_unregister_message_handler ##### -->
+<para>
+
+</para>
+
+@connection: 
+@handler: 
+@type: 
+
+
+<!-- ##### FUNCTION lm_connection_set_disconnect_function ##### -->
+<para>
+
+</para>
+
+@connection: 
+@function: 
+@user_data: 
+@notify: 
+
+
+<!-- ##### FUNCTION lm_connection_send_raw ##### -->
+<para>
+
+</para>
+
+@connection: 
+@str: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_ref ##### -->
+<para>
+
+</para>
+
+@connection: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_unref ##### -->
+<para>
+
+</para>
+
+@connection: 
+
+
+y<
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/text-base/lm-error.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,24 @@
+<!-- ##### SECTION Title ##### -->
+LmError
+
+<!-- ##### SECTION Short_Description ##### -->
+Error reporting.
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### FUNCTION lm_error_quark ##### -->
+<para>
+-
+</para>
+
+@Returns: 
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/text-base/lm-message-handler.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,56 @@
+<!-- ##### SECTION Title ##### -->
+LmMessageHandler
+
+<!-- ##### SECTION Short_Description ##### -->
+A handler for incoming messages.
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+ 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.
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### USER_FUNCTION LmHandleMessageFunction ##### -->
+<para>
+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.
+</para>
+
+@handler: an #LmMessageHandler
+@connection: an #LmConnection
+@message: an #LmMessage
+@user_data: user data set when creating the handler
+@Returns: #LM_HANDLER_RESULT_REMOVE_MESSAGE to indicate that message has been handled, otherwise #LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS.
+
+
+<!-- ##### FUNCTION lm_message_handler_new ##### -->
+<para>
+
+</para>
+
+@function: 
+@user_data: 
+@notify: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_handler_ref ##### -->
+<para>
+
+</para>
+
+@handler: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_handler_unref ##### -->
+<para>
+
+</para>
+
+@handler: 
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/text-base/lm-message-node.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,135 @@
+<!-- ##### SECTION Title ##### -->
+LmMessageNode
+
+<!-- ##### SECTION Short_Description ##### -->
+A node in the message tree
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### STRUCT LmMessageNode ##### -->
+<para>
+A struct representing a node in a message. 
+</para>
+
+@name: the name of the node
+@value: value of the node, can be NULL
+@next: next sibling
+@prev: previous sibling
+@parent: node parent
+@children: pointing to first child
+@attributes: list of attributes. This shouldn't be accessed directly.
+@ref_count: Reference count of node, internal value.
+
+<!-- ##### FUNCTION lm_message_node_get_value ##### -->
+<para>
+
+</para>
+
+@node: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_node_set_value ##### -->
+<para>
+
+</para>
+
+@node: 
+@value: 
+
+
+<!-- ##### FUNCTION lm_message_node_add_child ##### -->
+<para>
+
+</para>
+
+@node: 
+@name: 
+@value: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_node_set_attributes ##### -->
+<para>
+
+</para>
+
+@node: 
+@name: 
+@Varargs: 
+
+
+<!-- ##### FUNCTION lm_message_node_get_attribute ##### -->
+<para>
+
+</para>
+
+@node: 
+@name: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_node_set_attribute ##### -->
+<para>
+
+</para>
+
+@node: 
+@name: 
+@value: 
+
+
+<!-- ##### FUNCTION lm_message_node_get_child ##### -->
+<para>
+
+</para>
+
+@message_node: 
+@child_name: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_node_find_child ##### -->
+<para>
+
+</para>
+
+@message_node: 
+@child_name: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_node_ref ##### -->
+<para>
+
+</para>
+
+@node: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_node_unref ##### -->
+<para>
+
+</para>
+
+@node: 
+
+
+<!-- ##### FUNCTION lm_message_node_to_string ##### -->
+<para>
+
+</para>
+
+@node: 
+@Returns: 
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/text-base/lm-message.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,122 @@
+<!-- ##### SECTION Title ##### -->
+LmMessage
+
+<!-- ##### SECTION Short_Description ##### -->
+A message is built up like a tree of message nodes.
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+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.
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### TYPEDEF LmMessage ##### -->
+<para>
+Struct 
+</para>
+
+
+<!-- ##### ENUM LmMessageType ##### -->
+<para>
+Describes what type of message a message is. This maps directly to top level elements in the jabber protocol.
+</para>
+
+@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_UNKNOWN: incoming message is of some unknown type.
+
+<!-- ##### ENUM LmMessageSubType ##### -->
+<para>
+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.
+</para>
+
+@LM_MESSAGE_SUB_TYPE_NOT_SET: the default. No "type" attribute will be sent.
+@LM_MESSAGE_SUB_TYPE_NORMAL: 
+@LM_MESSAGE_SUB_TYPE_AVAILABLE: presence is available, applies to message type "presence"
+@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.
+
+<!-- ##### FUNCTION lm_message_new ##### -->
+<para>
+
+</para>
+
+@to: 
+@type: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_new_with_sub_type ##### -->
+<para>
+
+</para>
+
+@to: 
+@type: 
+@sub_type: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_get_type ##### -->
+<para>
+
+</para>
+
+@message: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_get_sub_type ##### -->
+<para>
+
+</para>
+
+@message: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_get_node ##### -->
+<para>
+
+</para>
+
+@message: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_ref ##### -->
+<para>
+
+</para>
+
+@message: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_unref ##### -->
+<para>
+
+</para>
+
+@message: 
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/text-base/lm-result.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,18 @@
+<!-- ##### SECTION Title ##### -->
+lm-result
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/text-base/lm-utils.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,16 @@
+<!-- ##### SECTION Title ##### -->
+lm-utils
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/text-base/loudmouth-unused.sgml.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,86 @@
+<!-- ##### SECTION ./tmpl/lm-result.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/lm-result.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/lm-result.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/lm-result.sgml:Title ##### -->
+lm-result
+
+
+<!-- ##### MACRO LM_ERROR ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ENUM LmError ##### -->
+<para>
+Describes the problem of the error.
+</para>
+
+@LM_ERROR_CONNECTION_NO_SERVER: No server defined before trying to open connection.
+@LM_ERROR_CONNECTION_NOT_OPEN: Connection not open when trying to send a message
+@LM_ERROR_CONNECTION_ALREADY_OPEN: Connection already open when trying to connect.
+@LM_ERROR_AUTH_FAILED: Authentication failed while opening connection
+
+<!-- ##### USER_FUNCTION MessageNodeFunc ##### -->
+<para>
+
+</para>
+
+@attribute: 
+@value: 
+@user_data: 
+
+<!-- ##### FUNCTION lm_message_node_add_child_message_node ##### -->
+<para>
+
+</para>
+
+@message_node: 
+@child: 
+
+<!-- ##### FUNCTION lm_message_node_foreach_attribute ##### -->
+<para>
+
+</para>
+
+@message_node: 
+@func: 
+@user_data: 
+
+<!-- ##### FUNCTION lm_message_node_new ##### -->
+<para>
+
+</para>
+
+@name: 
+@Returns: 
+
+<!-- ##### FUNCTION lm_message_node_set_child_value ##### -->
+<para>
+
+</para>
+
+@message_node: 
+@child_name: 
+@value: 
+
+<!-- ##### FUNCTION lm_message_node_unlink ##### -->
+<para>
+
+</para>
+
+@message_node: 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/wcprops/lm-connection.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 81
+/svn/projects/!svn/ver/337/loudmouth/trunk/docs/reference/tmpl/lm-connection.sgml
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/wcprops/lm-error.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 75
+/svn/projects/!svn/ver/36/loudmouth/trunk/docs/reference/tmpl/lm-error.sgml
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/wcprops/lm-message-handler.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 85
+/svn/projects/!svn/ver/32/loudmouth/trunk/docs/reference/tmpl/lm-message-handler.sgml
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/wcprops/lm-message-node.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 83
+/svn/projects/!svn/ver/337/loudmouth/trunk/docs/reference/tmpl/lm-message-node.sgml
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/wcprops/lm-message.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/projects/!svn/ver/337/loudmouth/trunk/docs/reference/tmpl/lm-message.sgml
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/wcprops/lm-result.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/projects/!svn/ver/21/loudmouth/trunk/docs/reference/tmpl/lm-result.sgml
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/wcprops/lm-utils.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 74
+/svn/projects/!svn/ver/1/loudmouth/trunk/docs/reference/tmpl/lm-utils.sgml
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/.svn/wcprops/loudmouth-unused.sgml.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 83
+/svn/projects/!svn/ver/34/loudmouth/trunk/docs/reference/tmpl/loudmouth-unused.sgml
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/lm-connection.sgml	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,323 @@
+<!-- ##### SECTION Title ##### -->
+LmConnection
+
+<!-- ##### SECTION Short_Description ##### -->
+A client connection to the server
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### MACRO LM_CONNECTION ##### -->
+<para>
+Convenience macro used to cast a pointer to a #LmConnection.
+</para>
+
+@o: pointer to cast
+
+
+<!-- ##### MACRO LM_CONNECTION_DEFAULT_PORT ##### -->
+<para>
+Default jabber client port.
+</para>
+
+
+
+<!-- ##### MACRO LM_CONNECTION_DEFAULT_PORT_SSL ##### -->
+<para>
+Default jabber client port when using SSL encryption.
+</para>
+
+
+
+<!-- ##### STRUCT LmConnection ##### -->
+<para>
+This should not be accessed directly. Use the accessor functions as described below.
+</para>
+
+
+<!-- ##### ENUM LmHandlerResult ##### -->
+<para>
+The return type of an LmMessageHandler. This determines whether more message handlers should be called.
+</para>
+
+@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.
+
+<!-- ##### ENUM LmHandlerPriority ##### -->
+<para>
+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 side about which handler will be called first of them.
+</para>
+
+@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.
+
+<!-- ##### ENUM LmDisconnectReason ##### -->
+<para>
+Sent with #LmDisconnectFunction to describe why a connection was closed.
+</para>
+
+@LM_DISCONNECT_REASON_OK: 
+@LM_DISCONNECT_REASON_PING_TIME_OUT: Connection to the server pinged 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_UNKNOWN: An unknown error.
+
+<!-- ##### USER_FUNCTION LmResultFunction ##### -->
+<para>
+Callback for informing if an asynchronous operation was successful.
+</para>
+
+@connection: an #LmConnection
+@success: the result, %TRUE if operation succeeded, otherwise %FALSE
+@user_data: User data passed when function being called.
+
+
+<!-- ##### USER_FUNCTION LmDisconnectFunction ##### -->
+<para>
+Callback called when a connection is closed.
+</para>
+
+@connection: an #LmConnection
+@reason: the reason the connection was closed.
+@user_data: User data passed when function being called.
+
+
+<!-- ##### FUNCTION lm_connection_new ##### -->
+<para>
+
+</para>
+
+@server: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_open ##### -->
+<para>
+
+</para>
+
+@connection: 
+@function: 
+@user_data: 
+@notify: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_open_and_block ##### -->
+<para>
+
+</para>
+
+@connection: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_close ##### -->
+<para>
+
+</para>
+
+@connection: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_authenticate ##### -->
+<para>
+
+</para>
+
+@connection: 
+@username: 
+@password: 
+@resource: 
+@function: 
+@user_data: 
+@notify: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_authenticate_and_block ##### -->
+<para>
+
+</para>
+
+@connection: 
+@username: 
+@password: 
+@resource: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_is_authenticated ##### -->
+<para>
+
+</para>
+
+@connection: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_get_server ##### -->
+<para>
+
+</para>
+
+@connection: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_set_server ##### -->
+<para>
+
+</para>
+
+@connection: 
+@server: 
+
+
+<!-- ##### FUNCTION lm_connection_get_port ##### -->
+<para>
+
+</para>
+
+@connection: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_set_port ##### -->
+<para>
+
+</para>
+
+@connection: 
+@port: 
+
+
+<!-- ##### FUNCTION lm_connection_get_use_ssl ##### -->
+<para>
+
+</para>
+
+@connection: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_set_use_ssl ##### -->
+<para>
+
+</para>
+
+@connection: 
+@use_ssl: 
+
+
+<!-- ##### FUNCTION lm_connection_send ##### -->
+<para>
+
+</para>
+
+@connection: 
+@message: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_send_with_reply ##### -->
+<para>
+
+</para>
+
+@connection: 
+@message: 
+@handler: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_send_with_reply_and_block ##### -->
+<para>
+
+</para>
+
+@connection: 
+@message: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_register_message_handler ##### -->
+<para>
+
+</para>
+
+@connection: 
+@handler: 
+@type: 
+@priority: 
+
+
+<!-- ##### FUNCTION lm_connection_unregister_message_handler ##### -->
+<para>
+
+</para>
+
+@connection: 
+@handler: 
+@type: 
+
+
+<!-- ##### FUNCTION lm_connection_set_disconnect_function ##### -->
+<para>
+
+</para>
+
+@connection: 
+@function: 
+@user_data: 
+@notify: 
+
+
+<!-- ##### FUNCTION lm_connection_send_raw ##### -->
+<para>
+
+</para>
+
+@connection: 
+@str: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_ref ##### -->
+<para>
+
+</para>
+
+@connection: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_connection_unref ##### -->
+<para>
+
+</para>
+
+@connection: 
+
+
+y<
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/lm-error.sgml	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,24 @@
+<!-- ##### SECTION Title ##### -->
+LmError
+
+<!-- ##### SECTION Short_Description ##### -->
+Error reporting.
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### FUNCTION lm_error_quark ##### -->
+<para>
+-
+</para>
+
+@Returns: 
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/lm-message-handler.sgml	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,56 @@
+<!-- ##### SECTION Title ##### -->
+LmMessageHandler
+
+<!-- ##### SECTION Short_Description ##### -->
+A handler for incoming messages.
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+ 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.
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### USER_FUNCTION LmHandleMessageFunction ##### -->
+<para>
+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.
+</para>
+
+@handler: an #LmMessageHandler
+@connection: an #LmConnection
+@message: an #LmMessage
+@user_data: user data set when creating the handler
+@Returns: #LM_HANDLER_RESULT_REMOVE_MESSAGE to indicate that message has been handled, otherwise #LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS.
+
+
+<!-- ##### FUNCTION lm_message_handler_new ##### -->
+<para>
+
+</para>
+
+@function: 
+@user_data: 
+@notify: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_handler_ref ##### -->
+<para>
+
+</para>
+
+@handler: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_handler_unref ##### -->
+<para>
+
+</para>
+
+@handler: 
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/lm-message-node.sgml	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,135 @@
+<!-- ##### SECTION Title ##### -->
+LmMessageNode
+
+<!-- ##### SECTION Short_Description ##### -->
+A node in the message tree
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### STRUCT LmMessageNode ##### -->
+<para>
+A struct representing a node in a message. 
+</para>
+
+@name: the name of the node
+@value: value of the node, can be NULL
+@next: next sibling
+@prev: previous sibling
+@parent: node parent
+@children: pointing to first child
+@attributes: list of attributes. This shouldn't be accessed directly.
+@ref_count: Reference count of node, internal value.
+
+<!-- ##### FUNCTION lm_message_node_get_value ##### -->
+<para>
+
+</para>
+
+@node: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_node_set_value ##### -->
+<para>
+
+</para>
+
+@node: 
+@value: 
+
+
+<!-- ##### FUNCTION lm_message_node_add_child ##### -->
+<para>
+
+</para>
+
+@node: 
+@name: 
+@value: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_node_set_attributes ##### -->
+<para>
+
+</para>
+
+@node: 
+@name: 
+@Varargs: 
+
+
+<!-- ##### FUNCTION lm_message_node_get_attribute ##### -->
+<para>
+
+</para>
+
+@node: 
+@name: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_node_set_attribute ##### -->
+<para>
+
+</para>
+
+@node: 
+@name: 
+@value: 
+
+
+<!-- ##### FUNCTION lm_message_node_get_child ##### -->
+<para>
+
+</para>
+
+@message_node: 
+@child_name: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_node_find_child ##### -->
+<para>
+
+</para>
+
+@message_node: 
+@child_name: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_node_ref ##### -->
+<para>
+
+</para>
+
+@node: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_node_unref ##### -->
+<para>
+
+</para>
+
+@node: 
+
+
+<!-- ##### FUNCTION lm_message_node_to_string ##### -->
+<para>
+
+</para>
+
+@node: 
+@Returns: 
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/lm-message.sgml	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,122 @@
+<!-- ##### SECTION Title ##### -->
+LmMessage
+
+<!-- ##### SECTION Short_Description ##### -->
+A message is built up like a tree of message nodes.
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+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.
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### TYPEDEF LmMessage ##### -->
+<para>
+Struct 
+</para>
+
+
+<!-- ##### ENUM LmMessageType ##### -->
+<para>
+Describes what type of message a message is. This maps directly to top level elements in the jabber protocol.
+</para>
+
+@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_UNKNOWN: incoming message is of some unknown type.
+
+<!-- ##### ENUM LmMessageSubType ##### -->
+<para>
+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.
+</para>
+
+@LM_MESSAGE_SUB_TYPE_NOT_SET: the default. No "type" attribute will be sent.
+@LM_MESSAGE_SUB_TYPE_NORMAL: 
+@LM_MESSAGE_SUB_TYPE_AVAILABLE: presence is available, applies to message type "presence"
+@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.
+
+<!-- ##### FUNCTION lm_message_new ##### -->
+<para>
+
+</para>
+
+@to: 
+@type: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_new_with_sub_type ##### -->
+<para>
+
+</para>
+
+@to: 
+@type: 
+@sub_type: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_get_type ##### -->
+<para>
+
+</para>
+
+@message: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_get_sub_type ##### -->
+<para>
+
+</para>
+
+@message: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_get_node ##### -->
+<para>
+
+</para>
+
+@message: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_ref ##### -->
+<para>
+
+</para>
+
+@message: 
+@Returns: 
+
+
+<!-- ##### FUNCTION lm_message_unref ##### -->
+<para>
+
+</para>
+
+@message: 
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/lm-result.sgml	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,18 @@
+<!-- ##### SECTION Title ##### -->
+lm-result
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/lm-utils.sgml	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,16 @@
+<!-- ##### SECTION Title ##### -->
+lm-utils
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/reference/tmpl/loudmouth-unused.sgml	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,86 @@
+<!-- ##### SECTION ./tmpl/lm-result.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/lm-result.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/lm-result.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/lm-result.sgml:Title ##### -->
+lm-result
+
+
+<!-- ##### MACRO LM_ERROR ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ENUM LmError ##### -->
+<para>
+Describes the problem of the error.
+</para>
+
+@LM_ERROR_CONNECTION_NO_SERVER: No server defined before trying to open connection.
+@LM_ERROR_CONNECTION_NOT_OPEN: Connection not open when trying to send a message
+@LM_ERROR_CONNECTION_ALREADY_OPEN: Connection already open when trying to connect.
+@LM_ERROR_AUTH_FAILED: Authentication failed while opening connection
+
+<!-- ##### USER_FUNCTION MessageNodeFunc ##### -->
+<para>
+
+</para>
+
+@attribute: 
+@value: 
+@user_data: 
+
+<!-- ##### FUNCTION lm_message_node_add_child_message_node ##### -->
+<para>
+
+</para>
+
+@message_node: 
+@child: 
+
+<!-- ##### FUNCTION lm_message_node_foreach_attribute ##### -->
+<para>
+
+</para>
+
+@message_node: 
+@func: 
+@user_data: 
+
+<!-- ##### FUNCTION lm_message_node_new ##### -->
+<para>
+
+</para>
+
+@name: 
+@Returns: 
+
+<!-- ##### FUNCTION lm_message_node_set_child_value ##### -->
+<para>
+
+</para>
+
+@message_node: 
+@child_name: 
+@value: 
+
+<!-- ##### FUNCTION lm_message_node_unlink ##### -->
+<para>
+
+</para>
+
+@message_node: 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth-1.0.pc.in	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libloudmouth
+Description: libloudmouth
+Requires: glib-2.0
+Version: @VERSION@
+Libs: -L${libdir} -lloudmouth
+Cflags: -I${includedir}/loudmouth-1.0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth.spec.in	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,61 @@
+%define ver @VERSION@
+%define name @PACKAGE@
+
+Summary: Loadmouth is a Jabber client written in C.
+Name: %name
+Version: %ver
+Release: cf1
+URL: http://people.codefactory.se/~micke/loudmouth
+Source0: %{name}-%{ver}.tar.gz
+License: LGPL
+Group: System Environment/Libraries
+BuildRoot: %{_tmppath}/%{name}-root
+Requires: glib2 >= @GLIB2_REQUIRED@
+BuildRequires: glib2-devel >= @GLIB2_REQUIRED@
+
+%description
+Loudmouth is a lightweight and easy-to-use C library for programming with the Jabber protocol. It's designed to be easy to get started with and yet extensible to let you do anything the Jabber protocol allows. 
+
+%package devel
+Summary:	Development files for RoadRunner..
+Group: 		Development/Libraries
+Requires:	%name = %{PACKAGE_VERSION}
+Requires:	glib2-devel >= @GLIB2_REQUIRED@
+
+%description devel
+Loudmouth is a lightweight and easy-to-use C library for programming with the Jabber protocol. It's designed to be easy to get started with and yet extensible to let you do anything the Jabber protocol allows. 
+
+%prep
+%setup -q
+
+%build
+
+%configure
+make
+
+%install
+rm -rf %{buildroot}
+%makeinstall 
+
+# remove, not shipped
+rm -f $RPM_BUILD_ROOT%{_libdir}/libloudmouth.la
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+%doc ChangeLog NEWS README COPYING
+%{_libdir}/libloudmouth*.so.*
+
+%files devel
+%defattr(-,root,root)
+%{_libdir}/libloudmouth*.so
+%{_libdir}/libloudmouth*.a
+%{_libdir}/pkgconfig/*
+%{_prefix}/include/loudmouth-1.0
+%{_datadir}/gtk-doc/html/loudmouth
+
+%changelog
+* Sat Mar 29 2003 Mikael Hallendal <micke@codefactory.se>
+- Initial build
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/README	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,2 @@
+This is a Subversion working copy administrative directory.
+Visit http://subversion.tigris.org/ for more information.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/dir-wcprops	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,9 @@
+K 25
+svn:wc:ra_dav:version-url
+V 52
+/svn/projects/!svn/ver/346/loudmouth/trunk/loudmouth
+K 26
+svn:wc:ra_dav:activity-url
+V 23
+/svn/projects/!svn/act/
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/entries	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,219 @@
+<?xml version="1.0" encoding="utf-8"?>
+<wc-entries
+   xmlns="svn:">
+<entry
+   committed-rev="346"
+   name="svn:this_dir"
+   committed-date="2003-04-17T10:56:10.375431Z"
+   url="http://svn.codefactory.se/svn/projects/loudmouth/trunk/loudmouth"
+   last-author="micke"
+   kind="dir"
+   revision="349"/>
+<entry
+   committed-rev="28"
+   name="lm-error.c"
+   text-time="2003-05-19T18:17:43.000000Z"
+   committed-date="2003-03-03T21:14:06.000000Z"
+   checksum="7cb5ccd82b7a64b6b92d0812e93c8736"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:43.000000Z"/>
+<entry
+   committed-rev="324"
+   name="lm-message.h"
+   text-time="2003-05-19T18:17:43.000000Z"
+   committed-date="2003-04-04T22:42:44.686791Z"
+   checksum="513f8a47e7c12a5699e220704da6feee"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:43.000000Z"/>
+<entry
+   committed-rev="330"
+   name="lm-debug.h"
+   text-time="2003-05-19T18:17:42.000000Z"
+   committed-date="2003-04-07T09:10:38.452108Z"
+   checksum="97a040c81fcad281448d5453a659ade3"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:42.000000Z"/>
+<entry
+   committed-rev="337"
+   name="lm-parser.c"
+   text-time="2003-05-19T18:17:41.000000Z"
+   committed-date="2003-04-10T22:31:29.810044Z"
+   checksum="e6d57fa9435f7cc81f7aa44abac57a73"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:41.000000Z"/>
+<entry
+   committed-rev="50"
+   name="lm-error.h"
+   text-time="2003-05-19T18:18:00.000000Z"
+   committed-date="2003-03-24T00:26:36.000000Z"
+   checksum="5a10ad1583e09154fd75b5e64e3ad3f2"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:18:00.000000Z"/>
+<entry
+   committed-rev="337"
+   name="lm-connection.c"
+   text-time="2003-05-19T18:17:58.000000Z"
+   committed-date="2003-04-10T22:31:29.810044Z"
+   checksum="a5a79cc81b6de5702136fbff0d17c297"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:58.000000Z"/>
+<entry
+   committed-rev="28"
+   name="lm-message-handler.c"
+   text-time="2003-05-19T18:17:59.000000Z"
+   committed-date="2003-03-03T21:14:06.000000Z"
+   checksum="ec20dc894176d8ec3054f1b05fdbf259"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:59.000000Z"/>
+<entry
+   committed-rev="28"
+   name="lm-utils.c"
+   text-time="2003-05-19T18:17:57.000000Z"
+   committed-date="2003-03-03T21:14:06.000000Z"
+   checksum="8f4203c0ca1c728a1007661f9685fc17"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:57.000000Z"/>
+<entry
+   committed-rev="49"
+   name="lm-parser.h"
+   text-time="2003-05-19T18:17:56.000000Z"
+   committed-date="2003-03-23T02:56:50.000000Z"
+   checksum="bf91e66076c3a0b31e05f58a71add7d4"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:56.000000Z"/>
+<entry
+   committed-rev="321"
+   name="lm-connection.h"
+   text-time="2003-05-19T18:17:54.000000Z"
+   committed-date="2003-04-03T13:56:09.915880Z"
+   checksum="082e5b0ae3899c6c7b4fe82e1649ec8a"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:54.000000Z"/>
+<entry
+   committed-rev="36"
+   name="lm-message-handler.h"
+   text-time="2003-05-19T18:17:55.000000Z"
+   committed-date="2003-03-05T01:15:07.000000Z"
+   checksum="ba9f9d70cf521b05e406890116eb00cd"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:55.000000Z"/>
+<entry
+   committed-rev="328"
+   name="lm-internals.h"
+   text-time="2003-05-19T18:17:56.000000Z"
+   committed-date="2003-04-06T23:45:14.454305Z"
+   checksum="8d1a1776d4a8e9e691ec98609ba1543b"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:56.000000Z"/>
+<entry
+   committed-rev="36"
+   name="lm-utils.h"
+   text-time="2003-05-19T18:17:53.000000Z"
+   committed-date="2003-03-05T01:15:07.000000Z"
+   checksum="4e3849fc954dea8796910ac7a75e523e"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:53.000000Z"/>
+<entry
+   committed-rev="317"
+   name="lm-message-node.c"
+   text-time="2003-05-19T18:17:53.000000Z"
+   committed-date="2003-04-01T02:25:19.357019Z"
+   checksum="d0f5cddff1c735d55056fccf6f3bd5d6"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:53.000000Z"/>
+<entry
+   committed-rev="49"
+   name="lm-sha.c"
+   text-time="2003-05-19T18:17:52.000000Z"
+   committed-date="2003-03-23T02:56:50.000000Z"
+   checksum="df27cf38cea2d92eee59b7ff6bf248d7"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:52.000000Z"/>
+<entry
+   committed-rev="317"
+   name="lm-message-node.h"
+   text-time="2003-05-19T18:17:50.000000Z"
+   committed-date="2003-04-01T02:25:19.357019Z"
+   checksum="4f4d97b1200b8b4a85fc7cd1d4e44de9"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:50.000000Z"/>
+<entry
+   committed-rev="1"
+   name="test-jid.c"
+   text-time="2003-05-19T18:17:49.000000Z"
+   committed-date="2003-01-31T11:46:56.000000Z"
+   checksum="3b67f75d3d5f3e2363634925238b3ae1"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:49.000000Z"/>
+<entry
+   committed-rev="28"
+   name="loudmouth.h"
+   text-time="2003-05-19T18:17:48.000000Z"
+   committed-date="2003-03-03T21:14:06.000000Z"
+   checksum="3085c80ec8b39e6b7f392f721399ec71"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:48.000000Z"/>
+<entry
+   committed-rev="48"
+   name="test-lm.c"
+   text-time="2003-05-19T18:17:48.000000Z"
+   committed-date="2003-03-14T01:25:25.000000Z"
+   checksum="0198283473a2bd540ca027170c7db0cc"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:48.000000Z"/>
+<entry
+   committed-rev="28"
+   name="lm-sha.h"
+   text-time="2003-05-19T18:17:46.000000Z"
+   committed-date="2003-03-03T21:14:06.000000Z"
+   checksum="af4b130fcda26d360cc930378d33cc87"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:46.000000Z"/>
+<entry
+   committed-rev="328"
+   name="Makefile.am"
+   text-time="2003-05-19T18:17:46.000000Z"
+   committed-date="2003-04-06T23:45:14.454305Z"
+   checksum="9c321d48a3c4ea273ecb5d5fb42e1581"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:46.000000Z"/>
+<entry
+   committed-rev="328"
+   name="lm-message.c"
+   text-time="2003-05-19T18:17:45.000000Z"
+   committed-date="2003-04-06T23:45:14.454305Z"
+   checksum="e4ff58e77fae68c5101c6c148cff58cc"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:45.000000Z"/>
+<entry
+   committed-rev="346"
+   name="lm-debug.c"
+   text-time="2003-05-19T18:17:44.000000Z"
+   committed-date="2003-04-17T10:56:10.375431Z"
+   checksum="dba65a5ecf3ef9feb904c963ac426a60"
+   last-author="micke"
+   kind="file"
+   prop-time="2003-05-19T18:17:44.000000Z"/>
+</wc-entries>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/format	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/Makefile.am.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-connection.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-connection.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-debug.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-debug.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-error.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-error.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-internals.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-message-handler.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-message-handler.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-message-node.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-message-node.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-message.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-message.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-parser.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-parser.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-sha.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-sha.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-utils.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/lm-utils.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/loudmouth.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/test-jid.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/prop-base/test-lm.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/Makefile.am.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-connection.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-connection.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-debug.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-debug.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-error.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-error.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-internals.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-message-handler.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-message-handler.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-message-node.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-message-node.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-message.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-message.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-parser.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-parser.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-sha.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-sha.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-utils.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/lm-utils.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/loudmouth.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/test-jid.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/props/test-lm.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1 @@
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/Makefile.am.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,56 @@
+NULL=
+
+INCLUDES = 				\
+	-I.				\
+	-I$(top_srcdir)			\
+	$(LOUDMOUTH_CFLAGS)		\
+	-DLM_COMPILATION		\
+	$(NULL)
+
+lib_LTLIBRARIES = libloudmouth.la
+
+libloudmouth_la_SOURCES =		\
+	lm-connection.c	 		\
+	lm-debug.c                      \
+	lm-debug.h                      \
+	lm-error.c			\
+	lm-message.c	 		\
+	lm-message-handler.c		\
+	lm-message-node.c		\
+	lm-parser.c			\
+	lm-parser.h			\
+	lm-internals.h			\
+	lm-sha.c			\
+	lm-sha.h			\
+	lm-utils.c			\
+	$(NULL)
+
+libloudmouthinclude_HEADERS =		\
+	lm-connection.h			\
+	lm-error.h			\
+	lm-message.h		 	\
+	lm-message-handler.h		\
+	lm-message-node.h		\
+	lm-utils.h			\
+	loudmouth.h			\
+	$(NULL)
+
+libloudmouth_la_LIBADD = 		\
+	$(LOUDMOUTH_LIBS)
+
+libloudmouthincludedir = $(includedir)/loudmouth-1.0/loudmouth
+
+# an explicit dependency here so alm generated files get built
+$(OBJECTS): $(built_sources)
+
+noinst_PROGRAMS = test-lm
+
+test_lm_SOURCES =			\
+	test-lm.c
+
+test_lm_LDADD =			 	\
+	$(LOUDMOUTH_LIBS)		\
+	libloudmouth.la			\
+	$(NULL)
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-connection.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1347 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+
+#include <netdb.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+#include "lm-debug.h"
+#include "lm-error.h"
+#include "lm-internals.h"
+#include "lm-parser.h"
+#include "lm-sha.h"
+#include "lm-connection.h"
+
+#define IN_BUFFER_SIZE 1024
+
+typedef struct {
+	LmHandlerPriority  priority;
+	LmMessageHandler  *handler;
+} HandlerData;
+
+typedef struct {
+	GSource source;
+	
+	LmConnection *connection;
+} LmIncomingSource;
+
+struct _LmConnection {
+	/* Parameters */
+	gchar      *server;
+	guint       port;
+	gboolean    use_ssl;
+
+	gboolean    is_open;
+	gboolean    is_authenticated;
+	
+	LmParser   *parser;
+	gchar      *stream_id;
+
+	GHashTable *id_handlers;
+	GSList     *handlers[LM_MESSAGE_TYPE_UNKNOWN];
+
+	/* Communication */
+	GIOChannel *io_channel;
+
+	LmCallback *open_cb;
+	LmCallback *close_cb;
+	LmCallback *auth_cb;
+	LmCallback *register_cb;
+
+	LmCallback *disconnect_cb;
+
+	GQueue     *incoming_messages;
+	GSource    *incoming_source;
+
+	gint        ref_count;
+};
+
+static void     connection_free (LmConnection *connection);
+
+
+static void     connection_handle_message    (LmConnection         *connection,
+					      LmMessage            *message);
+
+static void     connection_new_message_cb    (LmParser             *parser,
+					      LmMessage            *message,
+					      LmConnection         *connection);
+static gboolean connection_do_open         (LmConnection     *connection,
+					      GError          **error);
+
+static void     connection_do_close           (LmConnection          *connection);
+static gboolean connection_in_event          (GIOChannel   *source,
+					      GIOCondition  condition,
+					      LmConnection *connection);
+static gboolean connection_error_event       (GIOChannel   *source,
+					      GIOCondition  condition,
+					      LmConnection *connection);
+static gboolean connection_hup_event         (GIOChannel   *source,
+					      GIOCondition  condition,
+					      LmConnection *connection);
+static gboolean connection_send              (LmConnection             *connection,
+					      const gchar          *str,
+					      gint                  len,
+					      GError               **error);
+static LmHandlerResult connection_auth_reply (LmMessageHandler    *handler,
+					      LmConnection        *connection,
+					      LmMessage           *m,
+					      gpointer             user_data);
+
+static void     connection_stream_received   (LmConnection             *connection, 
+					      LmMessage                *m);
+
+static gint     connection_handler_compare_func (HandlerData  *a,
+						 HandlerData  *b);
+static gboolean connection_incoming_prepare  (GSource         *source,
+					      gint            *timeout);
+static gboolean connection_incoming_check    (GSource         *source);
+static gboolean connection_incoming_dispatch (GSource         *source,
+					      GSourceFunc      callback,
+					      gpointer           user_data);
+static GSource * connection_create_source    (LmConnection *connection);
+static void      connection_signal_disconnect (LmConnection *connection,
+					       LmDisconnectReason reason);
+
+static GSourceFuncs incoming_funcs = {
+	connection_incoming_prepare,
+	connection_incoming_check,
+	connection_incoming_dispatch,
+	NULL
+};
+
+static void
+connection_free (LmConnection *connection)
+{
+	g_free (connection->server);
+
+	if (connection->io_channel) {
+		g_io_channel_unref (connection->io_channel);
+	}
+
+	g_free (connection);
+}
+
+
+static void
+connection_handle_message (LmConnection *connection, LmMessage *m)
+{
+	LmMessageHandler *handler;
+	GSList           *l;
+	const gchar      *id;
+	LmHandlerResult   result = LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+
+	if (lm_message_get_type (m) == LM_MESSAGE_TYPE_STREAM) {
+		connection_stream_received (connection, m);
+		return;
+	}
+	
+	id = lm_message_node_get_attribute (m->node, "id");
+	
+	if (id) {
+		handler = g_hash_table_lookup (connection->id_handlers, id);
+		if (handler) {
+			result = _lm_message_handler_handle_message (handler, 
+								     connection,
+								     m);
+			g_hash_table_remove (connection->id_handlers, id);
+		}
+	}
+	
+	if (result == LM_HANDLER_RESULT_REMOVE_MESSAGE) {
+		return;
+	}
+
+	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);
+	}
+	
+	return;
+}
+
+static void
+connection_new_message_cb (LmParser     *parser,
+			   LmMessage    *m,
+			   LmConnection *connection)
+{
+	lm_message_ref (m);
+
+	lm_verbose ("New message with type=\"%s\" from: %s\n",
+		    _lm_message_type_to_string (lm_message_get_type (m)),
+		    lm_message_node_get_attribute (m->node, "from"));
+
+	g_queue_push_tail (connection->incoming_messages, m);
+}
+
+static gboolean
+connection_do_open (LmConnection *connection, GError **error)
+{
+	struct hostent     *he;
+        struct in_addr     *haddr;
+        struct sockaddr_in  saddr;
+	gint                fd;
+	
+	g_return_val_if_fail (connection != NULL, FALSE);
+	
+        he = gethostbyname(connection->server);
+        if (he == NULL) {
+ 		g_set_error (error,
+ 			     LM_ERROR,                 
+ 			     LM_ERROR_CONNECTION_OPEN,   
+ 			     "gethostbyname() failed");
+		return FALSE;
+        }
+
+        haddr = ((struct in_addr *) (he->h_addr_list)[0]);
+
+        fd = socket(AF_INET, SOCK_STREAM, 0);
+        memset(&saddr, 0, sizeof(saddr));
+        memcpy(&saddr.sin_addr, haddr, sizeof(struct in_addr));
+        saddr.sin_family = AF_INET;
+        saddr.sin_port = htons (connection->port);
+ 
+        if (connect(fd, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) {
+ 		g_set_error (error,
+ 			     LM_ERROR,           
+ 			     LM_ERROR_CONNECTION_OPEN,
+ 			     "connect() failed");
+		close (fd);
+		return FALSE;
+        }
+	
+	connection->io_channel = g_io_channel_unix_new (fd);
+	g_io_channel_set_close_on_unref (connection->io_channel, TRUE);
+	g_io_channel_set_encoding (connection->io_channel, NULL, NULL);
+	
+	g_io_channel_set_buffered (connection->io_channel, FALSE);
+	g_io_channel_set_flags (connection->io_channel,
+				G_IO_FLAG_NONBLOCK, NULL);
+	g_io_add_watch (connection->io_channel,
+			G_IO_IN,
+			(GIOFunc) connection_in_event,
+			connection);
+	g_io_add_watch (connection->io_channel, 
+			G_IO_ERR,
+			(GIOFunc) connection_error_event,
+			connection);
+	g_io_add_watch (connection->io_channel,
+			G_IO_HUP,
+			(GIOFunc) connection_hup_event,
+			connection);
+
+	connection->is_open = TRUE;
+
+	if (!connection_send (connection,
+			      "<?xml version='1.0' encoding='UTF-8'?>", -1, 
+			      error)) {
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static void
+connection_do_close (LmConnection *connection)
+{
+	if (connection->io_channel) {
+		g_io_channel_unref (connection->io_channel);
+	}
+
+	connection->io_channel = NULL;
+	connection->is_open = FALSE;
+}
+
+
+static gboolean
+connection_in_event (GIOChannel   *source,
+		     GIOCondition  condition,
+		     LmConnection *connection)
+{
+	gchar             buf[IN_BUFFER_SIZE];
+	gsize             bytes_read;
+       
+	if (!connection->io_channel) {
+		return FALSE;
+	}
+	g_io_channel_read_chars (connection->io_channel,
+				 buf, IN_BUFFER_SIZE - 1,
+				 &bytes_read,
+				 NULL);
+	buf[bytes_read] = '\0';
+	g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, "\nRECV:\n");
+	g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, 
+	       "-----------------------------------\n");
+	g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, "%s\n", buf);
+	g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, 
+	       "-----------------------------------\n");
+	
+	lm_parser_parse (connection->parser, buf);
+	
+	return TRUE;
+}
+
+static gboolean
+connection_error_event (GIOChannel   *source,
+			GIOCondition  condition,
+			LmConnection *connection)
+{
+	lm_verbose ("Error event: %d\n", condition);
+	
+	connection_do_close (connection);
+	connection_signal_disconnect (connection, LM_DISCONNECT_REASON_ERROR);
+	
+	return TRUE;
+}
+
+static gboolean
+connection_hup_event (GIOChannel   *source,
+		      GIOCondition  condition,
+		      LmConnection *connection)
+{
+	lm_verbose ("HUP event\n");
+
+	connection_do_close (connection);
+	connection_signal_disconnect (connection, LM_DISCONNECT_REASON_HUP);
+	
+	return TRUE;
+}
+
+static gboolean
+connection_send (LmConnection  *connection, 
+		 const gchar   *str, 
+		 gint           len, 
+		 GError       **error)
+{
+	gsize             bytes_written;
+	
+	if (!lm_connection_is_open (connection)) {
+		g_set_error (error,
+			     LM_ERROR,
+			     LM_ERROR_CONNECTION_NOT_OPEN,
+			     "Connection is not open, call lm_connection_open() first");
+		return FALSE;
+	}
+
+	if (len == -1) {
+		len = strlen (str);
+	}
+
+	g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, "\nSEND:\n");
+	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, 
+	       "-----------------------------------\n");
+	
+	g_io_channel_write_chars (connection->io_channel, str, len, 
+				  &bytes_written, NULL);
+
+	return TRUE;
+}
+
+static LmHandlerResult 
+connection_auth_reply (LmMessageHandler *handler,
+		       LmConnection     *connection,
+		       LmMessage        *m,
+		       gpointer          user_data)
+{
+	const gchar *type;
+	gboolean     result = TRUE;
+	
+	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;
+	} 
+	else if (strcmp (type, "error") == 0) {
+		result = FALSE;
+	}
+	
+	lm_verbose ("AUTH reply: %d\n", result);
+	
+	if (connection->auth_cb && connection->auth_cb->func) {
+		LmCallback *cb = connection->auth_cb;
+
+		(* ((LmResultFunction) cb->func)) (connection, 
+						   result, cb->user_data);
+	}
+	
+	_lm_utils_free_callback (connection->auth_cb);
+	connection->auth_cb = NULL;
+	
+	return LM_HANDLER_RESULT_REMOVE_MESSAGE;
+}
+
+
+static void
+connection_stream_received (LmConnection *connection, LmMessage *m)
+{
+	gboolean result;
+	
+	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"));;
+	
+	lm_verbose ("Stream received: %s\n", connection->stream_id);
+	
+	/* Check to see if the stream is correctly set up */
+	result = TRUE;
+
+	if (connection->open_cb && connection->open_cb->func) {
+		LmCallback *cb = connection->open_cb;
+		
+		(* ((LmResultFunction) cb->func)) (connection, result,
+						   cb->user_data);
+	}
+	
+	_lm_utils_free_callback (connection->open_cb);
+	connection->open_cb = NULL;
+}
+
+static gint
+connection_handler_compare_func (HandlerData *a, HandlerData *b)
+{
+	return b->priority - a->priority;
+}
+
+static gboolean 
+connection_incoming_prepare (GSource *source, gint *timeout)
+{
+	LmConnection *connection;
+	
+	connection = ((LmIncomingSource *)source)->connection;
+	
+	return !g_queue_is_empty (connection->incoming_messages);
+}
+
+static gboolean
+connection_incoming_check (GSource *source)
+{
+	return FALSE;
+}
+
+static gboolean
+connection_incoming_dispatch (GSource *source, 
+			      GSourceFunc callback, 
+			      gpointer user_data)
+{
+	LmConnection *connection;
+	LmMessage    *m;
+	
+	connection = ((LmIncomingSource *) source)->connection;
+
+	m = (LmMessage *) g_queue_pop_head (connection->incoming_messages);
+	
+	if (m) {
+		connection_handle_message (connection, m);
+		lm_message_unref (m);
+	}
+
+	return TRUE;
+}
+
+static GSource *
+connection_create_source (LmConnection *connection)
+{
+	GSource *source;
+	
+	source = g_source_new (&incoming_funcs, sizeof (LmIncomingSource));
+	((LmIncomingSource *) source)->connection = connection;
+	
+	return source;
+}
+
+static void
+connection_signal_disconnect (LmConnection       *connection,
+			      LmDisconnectReason  reason)
+{
+	if (connection->disconnect_cb && connection->disconnect_cb->func) {
+		LmCallback *cb = connection->disconnect_cb;
+		
+		(* ((LmDisconnectFunction) cb->func)) (connection,
+						       reason,
+						       cb->user_data);
+	}
+}
+
+/**
+ * lm_connection_new:
+ * @server: The hostname to the server for the connection.
+ * 
+ * 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 *
+lm_connection_new (const gchar *server)
+{
+	LmConnection *connection;
+	gint          i;
+	
+	lm_debug_init ();
+	
+	connection = g_new0 (LmConnection, 1);
+
+	if (server) {
+		connection->server = g_strdup (server);
+	} else {
+		connection->server = NULL;
+	}
+	
+	connection->port              = LM_CONNECTION_DEFAULT_PORT;
+	connection->use_ssl           = FALSE;
+	connection->disconnect_cb     = NULL;
+	connection->incoming_messages = g_queue_new ();
+	connection->incoming_source   = connection_create_source (connection);
+	
+	connection->id_handlers = g_hash_table_new_full (g_str_hash, 
+							 g_str_equal,
+							 g_free, 
+							 (GDestroyNotify) lm_message_handler_unref);
+	connection->ref_count         = 1;
+	g_source_attach (connection->incoming_source, NULL);
+	
+	for (i = 0; i < LM_MESSAGE_TYPE_UNKNOWN; ++i) {
+		connection->handlers[i] = NULL;
+	}
+
+	connection->parser = lm_parser_new 
+		((LmParserMessageFunction) connection_new_message_cb, 
+		 connection, NULL);
+
+	return connection;
+}
+
+/**
+ * lm_connection_open:
+ * @connection: #LmConnection to open
+ * @function: Callback function that will be called when the connection is open.
+ * @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, 
+		    LmResultFunction   function,
+		    gpointer           user_data,
+		    GDestroyNotify     notify,
+		    GError           **error)
+{
+	LmMessage *m;
+	gboolean   result;
+	
+	g_return_val_if_fail (connection != NULL, FALSE);
+	
+	if (lm_connection_is_open (connection)) {
+		g_set_error (error,
+			     LM_ERROR,
+			     LM_ERROR_CONNECTION_NOT_OPEN,
+			     "Connection is already open, call lm_connection_close() first");
+		return FALSE;
+	}
+
+	if (!connection->server) {
+		g_set_error (error,
+			     LM_ERROR,
+			     LM_ERROR_CONNECTION_OPEN,
+			     "You need to set the server hostname in the call to lm_connection_new()");
+		return FALSE;
+	}
+
+	connection->open_cb = _lm_utils_new_callback (function, user_data, notify);
+	
+	lm_verbose ("Connecting to: %s:%d\n", 
+		    connection->server, connection->port);
+	
+	if (!connection_do_open (connection, error)) {
+		return FALSE;
+	}
+	
+	m = lm_message_new (connection->server, LM_MESSAGE_TYPE_STREAM);
+	lm_message_node_set_attributes (m->node,
+					"xmlns:stream", "http://etherx.jabber.org/streams",
+					"xmlns", "jabber:client",
+					NULL);
+	
+	lm_verbose ("Opening stream...");
+	
+	result = lm_connection_send (connection, m, error);
+	lm_message_unref (m);
+	
+	return result;
+}
+
+/**
+ * lm_connection_open_and_block:
+ * @connection: an #LmConnection
+ * @error: location to store error, or %NULL
+ * 
+ * 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)
+{
+	LmMessage *m;
+	gboolean   result;
+	gboolean   finished = FALSE;
+	gboolean   ret_val = FALSE;
+	gint       last_len = 0;
+
+	g_return_val_if_fail (connection != NULL, FALSE);
+	
+	if (lm_connection_is_open (connection)) {
+		g_set_error (error,
+			     LM_ERROR,
+			     LM_ERROR_CONNECTION_NOT_OPEN,
+			     "Connection is already open, call lm_connection_close() first");
+		return FALSE;
+	}
+	if (!connection->server) {
+		g_set_error (error,
+			     LM_ERROR,
+			     LM_ERROR_CONNECTION_OPEN,
+			     "You need to set the server hostname in the call to lm_connection_new()");
+		return FALSE;
+	}
+
+	lm_verbose ("(Block)Connecting to: %s:%d\n", 
+		    connection->server, connection->port);
+	
+	if (!connection_do_open (connection, error)) {
+		return FALSE;
+	}
+	
+	m = lm_message_new (connection->server, LM_MESSAGE_TYPE_STREAM);
+	lm_message_node_set_attributes (m->node,
+					"xmlns:stream", "http://etherx.jabber.org/streams",
+					"xmlns", "jabber:client",
+					NULL);
+	
+	lm_verbose ("Sending stream: \n%s\n", 
+		    lm_message_node_to_string (m->node));
+	
+	result = lm_connection_send (connection, m, error);
+	lm_message_unref (m);
+
+ 	g_source_remove (g_source_get_id (connection->incoming_source));
+	g_source_unref (connection->incoming_source);
+
+	while (!finished) {
+		gint len;
+		
+		g_main_context_iteration (NULL, TRUE);
+		
+		len = connection->incoming_messages->length;
+		
+		if (len > last_len) {
+			LmMessage *m;
+			
+			last_len = len;
+			m = (LmMessage *) g_queue_peek_tail (connection->incoming_messages);
+			if (lm_message_get_type (m) == LM_MESSAGE_TYPE_STREAM) {
+				connection->stream_id = 
+					g_strdup (lm_message_node_get_attribute (m->node, "id"));
+				ret_val = TRUE;
+				finished = TRUE;
+				g_queue_pop_tail (connection->incoming_messages);
+			}
+		}
+	}
+	
+	connection->incoming_source = connection_create_source (connection);
+	g_source_attach (connection->incoming_source, NULL);
+
+	return ret_val;
+}
+
+/**
+ * lm_connection_close:
+ * @connection: #LmConnection to close 
+ * @error: location to store error, or %NULL
+ * 
+ * A synchronos 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)
+{
+	g_return_val_if_fail (connection != NULL, FALSE);
+	
+	if (!lm_connection_is_open (connection)) {
+		g_set_error (error,
+			     LM_ERROR,
+			     LM_ERROR_CONNECTION_NOT_OPEN,
+			     "Connection is not open, call lm_connection_open() first");
+		return FALSE;
+	}
+	
+	lm_verbose ("Disconnecting from: %s:%d\n", 
+		    connection->server,
+		    connection->port);
+	
+	if (!connection_send (connection, "</stream:stream>", -1, error)) {
+		return FALSE;
+	}
+	
+ 	g_io_channel_flush (connection->io_channel, NULL);
+	
+	connection_do_close (connection);
+	connection_signal_disconnect (connection, LM_DISCONNECT_REASON_OK);
+	
+	return TRUE;
+}
+
+/**
+ * lm_connection_authenticate:
+ * @connection: #LmConnection to authenticate.
+ * @username: Username used to authenticate.
+ * @password: Password corresponding to @username.
+ * @resource: Resource used for this connection.
+ * @function: Callback called when authentication is finished.
+ * @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 will tell if it succeeded or not. 
+ * 
+ * Return value: #TRUE if no errors where detected while sending the authentication message, #FALSE otherwise.
+ **/
+gboolean
+lm_connection_authenticate (LmConnection      *connection,
+			    const gchar       *username,
+			    const gchar       *password,
+			    const gchar       *resource,
+			    LmResultFunction   function,
+			    gpointer           user_data,
+			    GDestroyNotify     notify,
+			    GError           **error)
+{
+	LmMessage        *m;
+	LmMessageNode    *q_node;
+	LmMessageHandler *handler;
+	gboolean          result;
+	
+	g_return_val_if_fail (connection != NULL, FALSE);
+	g_return_val_if_fail (username != NULL, FALSE);
+	g_return_val_if_fail (password != NULL, FALSE);
+	g_return_val_if_fail (resource != NULL, FALSE);
+
+	if (!lm_connection_is_open (connection)) {
+		g_set_error (error,
+			     LM_ERROR,
+			     LM_ERROR_CONNECTION_NOT_OPEN,
+			     "Connection is not open, call lm_connection_open() first");
+		return FALSE;
+	}
+	
+	connection->auth_cb = _lm_utils_new_callback (function, 
+						      user_data, 
+						      notify);
+	
+	m = lm_message_new_with_sub_type (NULL, LM_MESSAGE_TYPE_IQ,
+					  LM_MESSAGE_SUB_TYPE_SET);
+	q_node = lm_message_node_add_child (m->node, "query", NULL);
+	lm_message_node_set_attributes (q_node,
+					"xmlns", "jabber:iq:auth", 
+					NULL);
+	lm_message_node_add_child (q_node, "username", username);
+
+	/* Check what the server can handle */
+	if (TRUE) {
+		gchar       *str;
+		const gchar *digest;
+		str = g_strconcat (connection->stream_id, password, NULL);
+		digest = lm_sha_hash (str);
+		g_free (str);
+		lm_message_node_add_child (q_node, "digest", digest);
+	} else {
+		lm_message_node_add_child (q_node, "password", password);
+	}
+
+	lm_message_node_add_child (q_node, "resource", resource);
+	handler = lm_message_handler_new (connection_auth_reply, NULL, NULL);
+
+	result = lm_connection_send_with_reply (connection, m, handler, error);
+	
+	lm_message_handler_unref (handler);
+	lm_message_unref (m);
+
+	return result;
+}
+
+/**
+ * lm_connection_authenticate_and_block:
+ * @connection: an #LmConnection
+ * @username: Username used to authenticate.
+ * @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
+lm_connection_authenticate_and_block (LmConnection  *connection,
+				      const gchar   *username,
+				      const gchar   *password,
+				      const gchar   *resource,
+				      GError       **error)
+{
+	LmMessage     *m;
+	LmMessageNode *q_node;
+	LmMessage     *result;
+		
+	g_return_val_if_fail (connection != NULL, FALSE);
+	g_return_val_if_fail (username != NULL, FALSE);
+	g_return_val_if_fail (password != NULL, FALSE);
+	g_return_val_if_fail (resource != NULL, FALSE);
+
+	if (!lm_connection_is_open (connection)) {
+		g_set_error (error,
+			     LM_ERROR,
+			     LM_ERROR_CONNECTION_NOT_OPEN,
+			     "Connection is not open, call lm_connection_open() first");
+		return FALSE;
+	}
+	
+	m = lm_message_new_with_sub_type (NULL, LM_MESSAGE_TYPE_IQ,
+					  LM_MESSAGE_SUB_TYPE_SET);
+	q_node = lm_message_node_add_child (m->node, "query", NULL);
+	lm_message_node_set_attributes (q_node,
+					"xmlns", "jabber:iq:auth", 
+					NULL);
+	lm_message_node_add_child (q_node, "username", username);
+
+	/* Check what the server can handle */
+	if (TRUE) {
+		gchar       *str;
+		const gchar *digest;
+		str = g_strconcat (connection->stream_id, password, NULL);
+		digest = lm_sha_hash (str);
+		g_free (str);
+		lm_message_node_add_child (q_node, "digest", digest);
+	} else {
+		lm_message_node_add_child (q_node, "password", password);
+	}
+
+	lm_message_node_add_child (q_node, "resource", resource);
+
+	result = lm_connection_send_with_reply_and_block (connection, m, error);
+	lm_message_unref (m);
+
+	if (!result) {
+		return FALSE;
+	}
+	
+	switch (lm_message_get_sub_type (result)) {
+	case LM_MESSAGE_SUB_TYPE_RESULT:
+		return TRUE;
+		break;
+	case LM_MESSAGE_SUB_TYPE_ERROR:
+		return FALSE;
+		break;
+	default:
+		g_assert_not_reached ();
+		break;
+	} 
+
+	return FALSE;
+}
+
+/**
+ * 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)
+{
+	return connection->is_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 
+lm_connection_is_authenticated (LmConnection *connection)
+{
+	return connection->is_authenticated;
+}
+
+/**
+ * lm_connection_get_server:
+ * @connection: an #LmConnection
+ * 
+ * Fetches the server address that @connection is using.
+ * 
+ * Return value: the server address
+ **/
+const gchar *
+lm_connection_get_server (LmConnection *connection)
+{
+	return connection->server;
+}
+
+/**
+ * lm_connection_set_server:
+ * @connection: an #LmConnection
+ * @server: Address of the server
+ * 
+ * Sets the server address to @connection. Notice that @connection can't be open while doing this.
+ **/
+void
+lm_connection_set_server (LmConnection *connection, const gchar *server)
+{
+	if (lm_connection_is_open (connection)) {
+		g_warning ("Can't change server address while connected");
+		return;
+	}
+	
+	if (connection->server) {
+		g_free (connection->server);
+	}
+	
+	connection->server = g_strdup (server);
+}
+
+/**
+ * lm_connection_get_port:
+ * @connection: an #LmConnection
+ * 
+ * Fetches the port tnat @connection is using.
+ * 
+ * Return value: 
+ **/
+guint
+lm_connection_get_port (LmConnection *connection)
+{
+	return connection->port;
+}
+
+/**
+ * lm_connection_set_port:
+ * @connection: an #LmConnection
+ * @port: server port
+ * 
+ * Sets the server port of that @connection will be using.
+ **/
+void
+lm_connection_set_port (LmConnection *connection, guint port)
+{
+	if (lm_connection_is_open (connection)) {
+		g_warning ("Can't change server port while connected");
+		return;
+	}
+	
+	connection->port = port;
+}
+
+/**
+ * lm_connection_get_use_ssl:
+ * @connection: an #LmConnection
+ * 
+ * Fetches if @connection is using SSL or not
+ * 
+ * Return value: #TRUE if @connection is using SSL, #FALSE otherwise.
+ **/
+gboolean
+lm_connection_get_use_ssl (LmConnection *connection)
+{
+	return connection->use_ssl;
+}
+
+/**
+ * lm_connection_set_use_ssl:
+ * @connection: an #LmConnection
+ * @use_ssl: whether to use SSL or not.
+ * 
+ * Sets whether @connection should use SSL for encryping traffic to/from the server.
+ **/
+void
+lm_connection_set_use_ssl (LmConnection *connection, gboolean use_ssl)
+{
+	if (lm_connection_is_open (connection)) {
+		g_warning ("use_ssl can't be changed while connected");
+		return;
+	}
+
+	connection->use_ssl = use_ssl;
+}
+
+/**
+ * lm_connection_send: 
+ * @connection: #LmConnection to send connection 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, 
+		    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);
+	
+	xml_str = lm_message_node_to_string (message->node);
+	if ((ch = strstr (xml_str, "</stream:stream>"))) {
+		*ch = '\0';
+	}
+	
+	result = connection_send (connection, xml_str, -1, error);
+	g_free (xml_str);
+
+	return result;
+}
+
+/**
+ * lm_connection_send_with_reply:
+ * @connection: #LmConnection used to send message.
+ * @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. 
+ * 
+ * Return value: 
+ **/
+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"));
+	} else {
+		id = _lm_utils_generate_id ();
+		lm_message_node_set_attributes (message->node, "id", id, NULL);
+	}
+	
+	g_hash_table_insert (connection->id_handlers, 
+			     id, lm_message_handler_ref (handler));
+	
+	return lm_connection_send (connection, message, error);
+}
+
+/**
+ * lm_connection_send_with_reply_and_block:
+ * @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 *
+lm_connection_send_with_reply_and_block (LmConnection  *connection,
+					 LmMessage     *message,
+					 GError       **error)
+{
+	gchar     *id;
+	LmMessage *reply = NULL;
+	gint       last_len = 0;
+
+	if (lm_message_node_get_attribute (message->node, "id")) {
+		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_source_remove (g_source_get_id (connection->incoming_source));
+	g_source_unref (connection->incoming_source);
+
+	lm_connection_send (connection, message, error);
+
+	while (!reply) {
+		gint         len;
+		const gchar *m_id;
+		
+		g_main_context_iteration (NULL, TRUE);
+		
+		len = connection->incoming_messages->length;
+		
+		if (len > last_len) {
+			LmMessage *m;
+			last_len = len;
+			m = (LmMessage *) g_queue_peek_tail (connection->incoming_messages);
+			m_id = lm_message_node_get_attribute (m->node, "id");
+			
+			if (m_id && strcmp (m_id, id) == 0) {
+				reply = m;
+			}
+
+			g_queue_pop_tail (connection->incoming_messages);
+		}
+	}
+
+	g_free (id);
+	connection->incoming_source = connection_create_source (connection);
+	g_source_attach (connection->incoming_source, NULL);
+
+	return reply;
+}
+
+/**
+ * lm_connection_register_message_handler:
+ * @connection: Connection to register a handler for.
+ * @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().
+ **/
+void
+lm_connection_register_message_handler  (LmConnection       *connection,
+					 LmMessageHandler   *handler,
+					 LmMessageType       type,
+					 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);
+
+	hd = g_new0 (HandlerData, 1);
+	hd->priority = priority;
+	hd->handler  = lm_message_handler_ref (handler);
+
+	connection->handlers[type] = g_slist_insert_sorted (connection->handlers[type],
+							    hd, 
+							    (GCompareFunc) connection_handler_compare_func);
+}
+
+/**
+ * lm_connection_unregister_message_handler:
+ * @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 
+ * when incoming messages of @type arrive.
+ **/
+void
+lm_connection_unregister_message_handler (LmConnection      *connection,
+					  LmMessageHandler  *handler,
+					  LmMessageType      type)
+{
+	GSList *l, *prev = NULL;
+	
+	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 (hd->handler == handler) {
+			if (prev) {
+				prev->next = l->next;
+			} else {
+				connection->handlers[type] = l->next;
+			}
+			l->next = NULL;
+			g_slist_free (l);
+			lm_message_handler_unref (hd->handler);
+			g_free (hd);
+			break;
+		}
+		prev = l;
+	}
+}
+
+/**
+ * lm_connection_set_disconnect_function:
+ * @connection: Connection to register disconnect callback for.
+ * @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. 
+ **/
+void
+lm_connection_set_disconnect_function (LmConnection         *connection,
+				       LmDisconnectFunction  function,
+				       gpointer              user_data,
+				       GDestroyNotify        notify)
+{
+	if (connection->disconnect_cb) {
+		_lm_utils_free_callback (connection->disconnect_cb);
+	}
+		
+	connection->disconnect_cb = _lm_utils_new_callback (function, 
+							    user_data,
+							    notify);
+}
+
+/**
+ * lm_connection_send_raw:
+ * @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, 
+ * #FALSE otherwise.
+ **/
+gboolean 
+lm_connection_send_raw (LmConnection  *connection, 
+			const gchar   *str, 
+			GError       **error)
+{
+	g_return_val_if_fail (connection != NULL, FALSE);
+
+	return connection_send (connection, str, -1, error);
+}
+
+/**
+ * lm_connection_ref:
+ * @connection: Connection to add a reference to.
+ * 
+ * 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 fried and shouldn't be used again.
+ **/
+void
+lm_connection_unref (LmConnection *connection)
+{
+	g_return_if_fail (connection != NULL);
+	
+	connection->ref_count--;
+	
+	if (connection->ref_count == 0) {
+		connection_free (connection);
+	}
+}
+
+#if 0
+void
+lm_connection_register (LmConnection           *connection,
+		    const gchar        *username,
+		    const gchar        *password,
+		    const gchar        *resource,
+		    LmRegisterCallback  callback,
+		    gpointer            user_data)
+{
+	LmElement    *element;
+	LmNode       *q_node;
+	gchar        *id;
+	static gint   register_id = 0;
+	
+	g_return_if_fail (connection != NULL);
+	g_return_if_fail (lm_connection_is_open (connection));
+	
+	/* Use lm:iq:register name space */
+
+	element = lm_iq_new (LM_IQ_TYPE_SET);
+	
+	q_node = lm_node_new ("query");
+	lm_node_set_attribute (q_node, "xmlns", JABBER_IQ_REGISTER);
+	lm_node_add_child (q_node, "username", username);
+	lm_node_add_child (q_node, "password", password);
+	lm_node_add_child (q_node, "resource", resource);
+
+	lm_element_add_child_node (element, q_node);
+	
+	id = g_strdup_printf ("register_%d", ++register_id);
+	lm_element_set_id (element, id);
+	
+	lm_connection_send (connection, element, NULL);
+	connection_add_callback (connection, id, callback, user_data);
+	lm_element_unref (element);
+
+	g_free (id);
+
+	
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-connection.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,140 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_CONNECTION_H__
+#define __LM_CONNECTION_H__
+
+#if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
+#error "Only <loudmouth/loudmouth.h> can be included directly, this file may di\sappear or change contents."
+#endif
+
+#include <loudmouth/lm-message.h>
+
+#define LM_CONNECTION(o) (LmConnection *) o;
+
+#define LM_CONNECTION_DEFAULT_PORT     5222
+#define LM_CONNECTION_DEFAULT_PORT_SSL 5223
+
+typedef struct _LmConnection LmConnection;
+
+typedef struct LmMessageHandler LmMessageHandler;
+
+typedef enum {
+	LM_HANDLER_RESULT_REMOVE_MESSAGE,
+	LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS
+} LmHandlerResult;
+ 
+typedef enum {
+	LM_HANDLER_PRIORITY_LAST   = 1,
+	LM_HANDLER_PRIORITY_NORMAL = 2,
+	LM_HANDLER_PRIORITY_FIRST  = 3
+} LmHandlerPriority;
+
+typedef enum {
+	LM_DISCONNECT_REASON_OK,
+	LM_DISCONNECT_REASON_PING_TIME_OUT,
+	LM_DISCONNECT_REASON_HUP,
+	LM_DISCONNECT_REASON_ERROR,
+	LM_DISCONNECT_REASON_UNKNOWN
+} LmDisconnectReason;
+
+typedef void (* LmResultFunction)     (LmConnection *connection,
+				       gboolean      success,
+				       gpointer      user_data);
+
+typedef void (* LmDisconnectFunction) (LmConnection *connection,
+				       LmDisconnectReason reason,
+				       gpointer           user_data);
+
+
+LmConnection *lm_connection_new               (const gchar        *server);
+gboolean      lm_connection_open              (LmConnection       *connection,
+					       LmResultFunction    function,
+					       gpointer            user_data,
+					       GDestroyNotify      notify,
+					       GError            **error);
+gboolean      lm_connection_open_and_block    (LmConnection       *connection,
+					       GError            **error);
+
+gboolean      lm_connection_close             (LmConnection       *connection,
+					       GError            **error);
+gboolean      lm_connection_authenticate      (LmConnection       *connection,
+					       const gchar        *username,
+					       const gchar        *password,
+					       const gchar        *resource,
+					       LmResultFunction    function,
+					       gpointer            user_data,
+					       GDestroyNotify      notify,
+					       GError            **error);
+gboolean
+lm_connection_authenticate_and_block          (LmConnection       *connection,
+					       const gchar        *username,
+					       const gchar        *password,
+					       const gchar        *resource,
+					       GError            **error);
+gboolean      lm_connection_is_open           (LmConnection       *connection);
+gboolean      lm_connection_is_authenticated  (LmConnection       *connection);
+
+const gchar * lm_connection_get_server        (LmConnection       *connection);
+void          lm_connection_set_server        (LmConnection       *connection,
+					       const gchar        *server);
+
+guint         lm_connection_get_port          (LmConnection       *connection);
+void          lm_connection_set_port          (LmConnection       *connection,
+					       guint               port);
+gboolean      lm_connection_get_use_ssl       (LmConnection       *connection);
+void          lm_connection_set_use_ssl       (LmConnection       *connection,
+					       gboolean            use_ssl);
+					       
+gboolean      lm_connection_send              (LmConnection       *connection,
+					       LmMessage          *message,
+					       GError            **error);
+gboolean      lm_connection_send_with_reply   (LmConnection       *connection,
+					       LmMessage          *message,
+					       LmMessageHandler   *handler,
+					       GError            **error);
+LmMessage *   
+lm_connection_send_with_reply_and_block       (LmConnection       *connection,
+					       LmMessage          *message,
+					       GError            **error);
+void
+lm_connection_register_message_handler        (LmConnection       *connection,
+					       LmMessageHandler   *handler,
+					       LmMessageType       type,
+					       LmHandlerPriority   priority);
+void
+lm_connection_unregister_message_handler      (LmConnection       *connection,
+					       LmMessageHandler   *handler,
+					       LmMessageType       type);
+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);
+LmConnection* lm_connection_ref               (LmConnection       *connection);
+void          lm_connection_unref             (LmConnection       *connection);
+
+
+#endif /* __LM_CONNECTION_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-debug.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,77 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "lm-debug.h"
+
+#ifndef LM_NO_DEBUG
+
+static LmLogLevelFlags debug_flags = 0;
+static gboolean initialized = FALSE;
+
+static const GDebugKey debug_keys[] = {
+	{"VERBOSE",      LM_LOG_LEVEL_VERBOSE},
+	{"NET",          LM_LOG_LEVEL_NET},
+	{"PARSER",       LM_LOG_LEVEL_PARSER},
+	{"ALL",          LM_LOG_LEVEL_ALL}
+};
+
+#define NUM_DEBUG_KEYS (sizeof (debug_keys) / sizeof (GDebugKey))
+
+static void
+debug_log_handler (const gchar    *log_domain,
+		   GLogLevelFlags  log_level,
+		   const gchar    *message,
+		   gpointer        user_data)
+{
+	if (debug_flags & log_level) {
+		if (log_level & LM_LOG_LEVEL_VERBOSE) {
+			g_print ("*** ");
+		}
+		else if (log_level & LM_LOG_LEVEL_PARSER) {
+			g_print ("LM-PARSER: ");
+		}
+	
+		g_print ("%s", message);
+	}
+}
+
+void 
+lm_debug_init (void)
+{
+	const gchar *env_lm_debug;
+
+	if (initialized) {
+		return;
+	}
+	
+	env_lm_debug = g_getenv ("LM_DEBUG");
+	if (env_lm_debug) {
+		debug_flags = g_parse_debug_string (env_lm_debug, debug_keys,
+						    NUM_DEBUG_KEYS);
+	}
+
+	g_log_set_handler (LM_LOG_DOMAIN, LM_LOG_LEVEL_ALL, 
+			   debug_log_handler, NULL);
+
+	initialized = TRUE;
+}
+#endif /* LM_NO_DEBUG */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-debug.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,76 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_DEBUG_H__
+#define __LM_DEBUG_H__
+
+#include <glib.h>
+
+typedef enum {
+	LM_LOG_LEVEL_VERBOSE = 1 << (G_LOG_LEVEL_USER_SHIFT),
+	LM_LOG_LEVEL_NET     = 1 << (G_LOG_LEVEL_USER_SHIFT + 1),
+	LM_LOG_LEVEL_PARSER  = 1 << (G_LOG_LEVEL_USER_SHIFT + 2),
+	LM_LOG_LEVEL_ALL     = (LM_LOG_LEVEL_NET |
+				LM_LOG_LEVEL_VERBOSE |
+				LM_LOG_LEVEL_PARSER)
+} LmLogLevelFlags;
+
+#ifndef LL_LOG_DOMAIN
+#  define LM_LOG_DOMAIN "LM"
+#endif
+
+#ifdef G_HAVE_ISO_VARARGS
+#  ifdef LM_NO_DEBUG
+#    define lm_verbose(...)
+#  else
+#    define lm_verbose(...) \
+       g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE, __VA_ARGS__)
+#  endif
+#elif defined(G_HAVE_GNUC_VARARGS)
+#  if LM_NO_DEBUG
+#    define lm_verbose(fmt...)
+#  else
+#    define lm_verbose(fmt...) \
+       g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE, fmt)
+#  endif
+#else
+#  if LM_NO_DEBUG
+#    define lm_verbose(const gchar *format, ...) {};
+#  else
+static void
+lm_verbose (const gchar *format, ...)
+{
+  va_list args;
+  va_start (args, format);
+  g_logv (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE, format, args);
+  va_end (args);
+}
+#  endif
+#endif
+
+#if LM_NO_DEBUG
+#  define lm_debug_init() {};
+#else
+void lm_debug_init (void);
+#endif
+
+#endif /* __LM_DEBUG_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-error.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <glib/gerror.h>
+#include "lm-error.h"
+
+GQuark
+lm_error_quark (void)
+{
+	static GQuark q = 0;
+
+	if (q == 0) {
+		q = g_quark_from_static_string ("lm-error-quark");
+	}
+	
+	return q;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-error.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,41 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_ERROR_H__
+#define __LM_ERROR_H__
+
+#if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
+#error "Only <loudmouth/loudmouth.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#include <glib.h>
+
+#define LM_ERROR lm_error_quark ()
+
+typedef enum {
+        LM_ERROR_CONNECTION_NOT_OPEN,
+        LM_ERROR_CONNECTION_OPEN,
+        LM_ERROR_AUTH_FAILED
+} LmError;
+
+GQuark lm_error_quark (void) G_GNUC_CONST;
+
+#endif /* __LM_ERROR_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-internals.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,55 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* Private functions that are internal to the library */
+
+#ifndef __LM_INTERNALS_H__
+#define __LM_INTERNALS_H__
+
+#include "lm-message.h"
+#include "lm-message-handler.h"
+#include "lm-message-node.h"
+
+typedef struct {
+	gpointer       func;
+	gpointer       user_data;
+	GDestroyNotify notify;
+} LmCallback;
+
+LmCallback *_lm_utils_new_callback (gpointer func, 
+				    gpointer user_data,
+				    GDestroyNotify notify);
+void _lm_utils_free_callback (LmCallback *cb);
+
+gchar *            _lm_utils_generate_id             (void);
+LmHandlerResult _lm_message_handler_handle_message   (LmMessageHandler *handler,
+						      LmConnection     *connection,
+						      LmMessage        *messag);
+
+const gchar *      _lm_message_type_to_string         (LmMessageType     type);
+const gchar *      _lm_message_sub_type_to_string     (LmMessageSubType  type);
+LmMessage *        _lm_message_new_from_node          (LmMessageNode    *node);
+void               _lm_message_node_add_child_node    (LmMessageNode    *node,
+						       LmMessageNode    *child);
+LmMessageNode *    _lm_message_node_new               (const gchar  *name);
+void               _lm_debug_init                     (void);
+
+#endif /* __LM_INTERNALS_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-message-handler.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,122 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "lm-internals.h"
+#include "lm-message-handler.h"
+
+struct LmMessageHandler {
+        gint                    ref_count;
+        LmHandleMessageFunction function;
+        gpointer                user_data;
+        GDestroyNotify          notify;
+};
+
+LmHandlerResult 
+_lm_message_handler_handle_message (LmMessageHandler *handler,
+                                    LmConnection     *connection,
+                                    LmMessage        *message)
+{
+        g_return_val_if_fail (handler != NULL, 
+                          LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS);
+        
+        if (handler->function) {
+                return (* handler->function) (handler, connection, 
+                                              message, handler->user_data);
+        }
+        
+        return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+}
+
+/**
+ * lm_message_handler_new:
+ * @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 *
+lm_message_handler_new (LmHandleMessageFunction function,
+                        gpointer                user_data,
+                        GDestroyNotify          notify)
+{
+        LmMessageHandler *handler;
+        
+        handler = g_new0 (LmMessageHandler, 1);
+        
+        if (handler == NULL) {
+                return NULL;
+        }
+        
+        handler->ref_count = 1;
+        handler->function  = function;
+        handler->user_data = user_data;
+        handler->notify    = notify;
+        
+        return handler;
+}
+
+/**
+ * lm_message_handler_ref:
+ * @handler: an #LmMessageHandler
+ * 
+ * Adds a reference to @node.
+ * 
+ * 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;
+}
+
+/**
+ * lm_message_handler_unref:
+ * @handler: an #LmMessagHandler
+ * 
+ * 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);
+                }
+                g_free (handler);
+        }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-message-handler.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,44 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_MESSAGE_HANDLER_H__
+#define __LM_MESSAGE_HANDLER_H__
+
+#if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
+#error "Only <loudmouth/loudmouth.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#include <loudmouth/lm-connection.h>
+
+typedef LmHandlerResult (* LmHandleMessageFunction) (LmMessageHandler *handler,
+						     LmConnection     *connection,
+						     LmMessage        *message,
+						     gpointer          user_data);
+
+LmMessageHandler *lm_message_handler_new   (LmHandleMessageFunction  function,
+					    gpointer                 user_data,
+					    GDestroyNotify           notify);
+LmMessageHandler *lm_message_handler_ref   (LmMessageHandler        *handler);
+void              lm_message_handler_unref (LmMessageHandler        *handler);
+
+
+#endif /* __LM_MESSAGE_HANDLER_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-message-node.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,451 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <string.h>
+
+#include "lm-internals.h"
+#include "lm-message-node.h"
+
+typedef struct {
+        gchar *key;
+        gchar *value;
+} KeyValuePair;
+
+static void            message_node_free            (LmMessageNode    *node);
+static LmMessageNode * message_node_last_child      (LmMessageNode    *node);
+
+static void
+message_node_free (LmMessageNode *node)
+{
+        LmMessageNode *l;
+        GSList        *list;
+        
+        g_return_if_fail (node != NULL);
+
+	for (l = node->children; l;) {
+		LmMessageNode *next = l->next;
+
+		lm_message_node_unref (l);
+		l = next;
+        }
+
+        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);
+}
+
+static LmMessageNode *
+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) {
+                l = l->next;
+        }
+
+        return l;
+}
+
+LmMessageNode *
+_lm_message_node_new (const gchar *name)
+{
+        LmMessageNode *node;
+
+        node = g_new0 (LmMessageNode, 1);
+        
+        node->name       = g_ascii_strdown (name, -1);
+        node->value      = NULL;
+        node->attributes = NULL;
+        node->next       = NULL;
+        node->prev       = NULL;
+        node->parent     = NULL;
+        node->children   = NULL;
+
+	node->ref_count  = 1;
+
+        return node;
+}
+void
+_lm_message_node_add_child_node (LmMessageNode *node, LmMessageNode *child)
+{
+        LmMessageNode *prev;
+	
+        g_return_if_fail (node != NULL);
+
+        prev = message_node_last_child (node);
+	lm_message_node_ref (child);
+
+        if (prev) {
+                prev->next    = child;
+                child->prev   = prev;
+        } else {
+                node->children = child;
+        }
+        
+        child->parent = node;
+}
+
+/**
+ * lm_message_node_get_value:
+ * @node: an #LmMessageNode
+ * 
+ * Retrieves the value of @node.
+ * 
+ * Return value: 
+ **/
+const gchar *
+lm_message_node_get_value (LmMessageNode *node)
+{
+	g_return_val_if_fail (node != NULL, NULL);
+	
+	return node->value;
+}
+
+/**
+ * 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;
+        }
+
+        node->value = g_strdup (value);
+}
+
+/**
+ * lm_message_node_add_child:
+ * @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. 
+ * 
+ * Return value: the newly created child
+ **/
+LmMessageNode *
+lm_message_node_add_child (LmMessageNode *node, 
+			   const gchar   *name, 
+			   const gchar   *value)
+{
+	LmMessageNode *child;
+	
+	child = _lm_message_node_new (name);
+
+	lm_message_node_set_value (child, value);
+	_lm_message_node_add_child_node (node, child);
+	lm_message_node_unref (child);
+
+	return child;
+}
+
+/**
+ * lm_message_node_set_attributes:
+ * @node: an #LmMessageNode
+ * @name: the first attribute, should be followed by a string with the value
+ * 
+ * Sets a list of attributes. The arguments should be names and corresponding 
+ * value and needs to be ended with %NULL.
+ **/
+void
+lm_message_node_set_attributes  (LmMessageNode *node,
+				 const gchar   *name,
+				 ...)
+{
+	va_list args;
+	
+        g_return_if_fail (node != NULL);
+
+	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);
+}
+
+/**
+ * lm_message_node_set_attribute:
+ * @node: an #LmMessageNode
+ * @name: name of attribute
+ * @value: value of attribute.
+ * 
+ * Sets the attribute @name to @value.
+ **/
+void
+lm_message_node_set_attribute (LmMessageNode *node,
+			       const gchar   *name,
+			       const gchar   *value)
+{
+	gboolean  found = FALSE; 
+	GSList   *l;
+	gchar    *key;
+	
+	key = g_utf8_strdown (name, -1);
+
+	for (l = node->attributes; l; l = l->next) {
+		KeyValuePair *kvp = (KeyValuePair *) l->data;
+                
+		if (strcmp (kvp->key, key) == 0) {
+			g_free (kvp->value);
+			kvp->value = g_strdup (value);
+			g_free (key);
+			found = TRUE;
+			break;
+		}
+	}
+	
+	if (!found) {
+		KeyValuePair *kvp;
+	
+		kvp = g_new0 (KeyValuePair, 1);                
+		kvp->key = key;
+		kvp->value = g_strdup (value);
+		
+		node->attributes = g_slist_prepend (node->attributes,
+						    kvp);
+	}
+}
+
+/**
+ * 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 *
+lm_message_node_get_attribute (LmMessageNode *node, const gchar *name)
+{
+        GSList      *l;
+        const gchar *ret_val = NULL;
+        gchar       *key;
+
+        g_return_val_if_fail (node != NULL, NULL);
+
+        key = g_utf8_strdown (name, -1);
+
+        for (l = node->attributes; l; l = l->next) {
+                KeyValuePair *kvp = (KeyValuePair *) l->data;
+                
+                if (strcmp (kvp->key, key) == 0) {
+                        ret_val = kvp->value;
+                }
+        }
+        
+        g_free (key);
+        
+        return ret_val;
+}
+
+/**
+ * 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 
+ * immediate child of @node %NULL is returned.
+ * 
+ * Return value: the child node or %NULL if not found
+ **/
+LmMessageNode *
+lm_message_node_get_child (LmMessageNode *node, const gchar *child_name)
+{
+	LmMessageNode *l;
+	
+	for (l = node->children; l; l = l->next) {
+		if (g_ascii_strcasecmp (l->name, child_name) == 0) {
+			return l;
+		}
+	}
+
+	return NULL;
+}
+
+/**
+ * lm_message_node_find_child:
+ * @node: 
+ * @child_name: 
+ * 
+ * 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 * 
+lm_message_node_find_child (LmMessageNode *node,
+			    const gchar   *child_name)
+{
+        LmMessageNode *l;
+        LmMessageNode *ret_val = NULL;
+
+        for (l = node->children; l; l = l->next) {
+                if (g_ascii_strcasecmp (l->name, child_name) == 0) {
+                        return l;
+                }
+                if (l->children) {
+                        ret_val = lm_message_node_find_child (l, child_name);
+                        if (ret_val) {
+                                return ret_val;
+                        }
+                }
+        }
+
+        return NULL;
+}
+
+/**
+ * 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 
+ *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);
+	}
+}
+
+/**
+ * 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 
+ * purposes.
+ * 
+ * Return value: an XML string representation of @node
+ **/
+gchar *
+lm_message_node_to_string (LmMessageNode *node)
+{
+	gchar         *ret_val;
+	gchar         *str;
+	GSList        *l;
+	LmMessageNode *child;
+	
+	if (node->name == NULL) {
+		return g_strdup ("");
+	}
+	
+	str = g_strdup_printf ("<%s", node->name);
+	
+	for (l = node->attributes; l; l = l->next) {
+		KeyValuePair *kvp = (KeyValuePair *) l->data;
+		
+		ret_val = g_strdup_printf ("%s %s=\"%s\"", 
+					   str, kvp->key, kvp->value);
+		g_free (str);
+		str = ret_val;
+	}
+	
+	ret_val = g_strconcat (str, ">", NULL);
+	g_free (str);
+	
+	if (node->value) {
+		gchar *tmp;
+
+		str = ret_val;
+
+		tmp = g_markup_escape_text (node->value, -1);
+		ret_val = g_strconcat (str, tmp, NULL);
+		g_free (str);
+		g_free (tmp);
+	} 
+
+	for (child = node->children; child; child = child->next) {
+		gchar *child_str = lm_message_node_to_string (child);
+		str = ret_val;
+		ret_val = g_strconcat (str, "  ", child_str, NULL);
+		g_free (str);
+	}
+
+	str = ret_val;
+	ret_val = g_strdup_printf ("%s</%s>\n", str, node->name);
+	g_free (str);
+	
+	return ret_val;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-message-node.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,71 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_MESSAGE_NODE_H__
+#define __LM_MESSAGE_NODE_H__
+
+#if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
+#error "Only <loudmouth/loudmouth.h> can be included directly, this file may disappear or change contents."
+#endif
+
+
+#include <glib.h>
+
+typedef struct _LmMessageNode LmMessageNode;
+
+struct _LmMessageNode {
+	gchar      *name;
+	gchar      *value;
+
+        LmMessageNode     *next;
+        LmMessageNode     *prev;
+	LmMessageNode     *parent;
+        LmMessageNode     *children;
+
+	/* Private */
+	GSList     *attributes;
+	gint        ref_count;
+};
+
+const gchar *  lm_message_node_get_value      (LmMessageNode *node);
+void           lm_message_node_set_value      (LmMessageNode *node,
+					       const gchar   *value);
+LmMessageNode *lm_message_node_add_child      (LmMessageNode *node,
+					       const gchar   *name,
+					       const gchar   *value);
+void           lm_message_node_set_attributes (LmMessageNode *node,
+					       const gchar   *name,
+					       ...);
+void           lm_message_node_set_attribute  (LmMessageNode *node,
+					       const gchar   *name,
+					       const gchar   *value);
+const gchar *  lm_message_node_get_attribute  (LmMessageNode *node,
+					       const gchar   *name);
+LmMessageNode *lm_message_node_get_child      (LmMessageNode *message_node,
+					       const gchar   *child_name);
+LmMessageNode *lm_message_node_find_child     (LmMessageNode *message_node,
+					       const gchar   *child_name);
+LmMessageNode *lm_message_node_ref            (LmMessageNode *node);
+void           lm_message_node_unref          (LmMessageNode *node);
+gchar *        lm_message_node_to_string      (LmMessageNode *node);
+
+
+#endif /* __LM_MESSAGE_NODE_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-message.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,336 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <string.h>
+
+#include "lm-internals.h"
+#include "lm-message.h"
+
+#define PRIV(o) ((LmMessage *)o)->priv
+
+static struct TypeNames 
+{
+        LmMessageType  type;
+        const gchar   *name;
+} type_names[] = {
+	{ LM_MESSAGE_TYPE_MESSAGE,       "message"       },
+	{ LM_MESSAGE_TYPE_PRESENCE,      "presence"      },
+	{ LM_MESSAGE_TYPE_IQ,            "iq"            },
+	{ LM_MESSAGE_TYPE_STREAM,        "stream:stream" },
+	{ LM_MESSAGE_TYPE_STREAM_ERROR,  "stream:error"  }
+};
+
+static struct SubTypeNames 
+{
+        LmMessageSubType  type;
+        const gchar      *name;
+} sub_type_names[] = {
+        { LM_MESSAGE_SUB_TYPE_CHAT,            "chat"          },
+	{ LM_MESSAGE_SUB_TYPE_GROUPCHAT,       "groupchat"     },
+	{ LM_MESSAGE_SUB_TYPE_HEADLINE,        "headline"      },
+	{ LM_MESSAGE_SUB_TYPE_UNAVAILABLE,     "unavailable"   },
+        { LM_MESSAGE_SUB_TYPE_PROBE,           "probe"         },
+	{ LM_MESSAGE_SUB_TYPE_SUBSCRIBE,       "subscribe"     },
+	{ LM_MESSAGE_SUB_TYPE_UNSUBSCRIBE,     "unsubscribe"   },
+	{ LM_MESSAGE_SUB_TYPE_SUBSCRIBED,      "subscribed"    },
+	{ 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_ERROR,           "error"         }
+};
+
+struct LmMessagePriv {
+	LmMessageType    type;
+	LmMessageSubType sub_type;
+	gint             ref_count;
+};
+
+static LmMessageType
+message_type_from_string (const gchar *type_str)
+{
+        gint i;
+
+        if (!type_str) {
+                return LM_MESSAGE_TYPE_UNKNOWN;
+        }
+
+        for (i = LM_MESSAGE_TYPE_MESSAGE;
+	     i <= LM_MESSAGE_TYPE_STREAM_ERROR;
+	     ++i) {
+                if (g_ascii_strcasecmp (type_str, type_names[i].name) == 0) {
+                        return i;
+                }
+        }
+
+        return LM_MESSAGE_TYPE_UNKNOWN;
+}
+
+
+const gchar *
+_lm_message_type_to_string (LmMessageType type)
+{
+        if (type < LM_MESSAGE_TYPE_MESSAGE ||
+            type > LM_MESSAGE_TYPE_STREAM_ERROR) {
+                type = LM_MESSAGE_TYPE_UNKNOWN;
+        }
+
+        return type_names[type].name;
+}
+
+static LmMessageSubType
+message_sub_type_from_string (const gchar *type_str)
+{
+        gint i;
+
+        if (!type_str) {
+                return LM_MESSAGE_SUB_TYPE_NOT_SET;
+        }
+
+        for (i = LM_MESSAGE_SUB_TYPE_CHAT;
+	     i <= LM_MESSAGE_SUB_TYPE_ERROR;
+	     ++i) {
+                if (g_ascii_strcasecmp (type_str, 
+					sub_type_names[i].name) == 0) {
+                        return i;
+                }
+        }
+
+        return LM_MESSAGE_SUB_TYPE_NOT_SET;
+}
+
+const gchar *
+_lm_message_sub_type_to_string (LmMessageSubType type)
+{
+        if (type < LM_MESSAGE_SUB_TYPE_CHAT ||
+            type > LM_MESSAGE_SUB_TYPE_ERROR) {
+		return NULL;
+        }
+
+        return sub_type_names[type].name;
+}
+
+static LmMessageSubType
+message_sub_type_when_unset (LmMessageType type) {
+	LmMessageSubType sub_type = LM_MESSAGE_SUB_TYPE_NORMAL;
+
+	switch (type) {
+	case LM_MESSAGE_TYPE_MESSAGE:
+		sub_type = LM_MESSAGE_SUB_TYPE_NORMAL;
+		break;
+	case LM_MESSAGE_TYPE_PRESENCE:
+		sub_type = LM_MESSAGE_SUB_TYPE_AVAILABLE;
+		break;
+	case LM_MESSAGE_TYPE_IQ:
+		sub_type = LM_MESSAGE_SUB_TYPE_GET;
+		break;
+	default:
+		break;
+	}
+
+	return sub_type;
+}
+
+LmMessage *
+_lm_message_new_from_node (LmMessageNode *node)
+{
+	LmMessage        *m;
+	LmMessageType     type;
+	LmMessageSubType  sub_type;
+	const gchar      *sub_type_str;
+	
+	type = message_type_from_string (node->name);
+
+	if (type == LM_MESSAGE_TYPE_UNKNOWN) {
+		return NULL;
+	}
+
+	sub_type_str = lm_message_node_get_attribute (node, "type");
+	if (sub_type_str) {
+		sub_type = message_sub_type_from_string (sub_type_str);
+	} else {
+		sub_type = message_sub_type_when_unset (type);
+	}
+
+	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;
+}
+
+/**
+ * lm_message_new:
+ * @to: receipient jid
+ * @type: message type
+ * 
+ * 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() 
+ * when caller is finished with it.
+ * 
+ * Return value: a newly created #LmMessage
+ **/
+LmMessage *
+lm_message_new (const gchar *to, LmMessageType type)
+{
+	LmMessage *m = g_new0 (LmMessage, 1);
+	
+	m->priv = g_new0 (LmMessagePriv, 1);
+
+	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 (to) {
+		lm_message_node_set_attribute (m->node, "to", to);
+	}
+
+	if (type == LM_MESSAGE_TYPE_IQ) {
+		lm_message_node_set_attribute (m->node, "type", "get");
+	}
+	
+	return m;
+}
+
+/**
+ * lm_message_new_with_sub_type:
+ * @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 
+ * information.
+ * 
+ * Return value: a newly created #LmMessage
+ **/
+LmMessage *
+lm_message_new_with_sub_type (const gchar      *to,
+			      LmMessageType     type, 
+			      LmMessageSubType  sub_type)
+{
+	LmMessage   *m = lm_message_new (to, type);
+	const gchar *type_str;
+
+	type_str = _lm_message_sub_type_to_string (sub_type);
+
+	if (type_str) {
+		lm_message_node_set_attributes (m->node,
+						"type", type_str, NULL);
+		PRIV(m)->sub_type = sub_type;
+	}
+
+	return m;
+}
+
+/**
+ * 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: 
+ * 
+ * Fetches the sub type of @message.
+ * 
+ * Return value: the message sub type
+ **/
+LmMessageType
+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 
+ * message is freed.
+ **/
+void
+lm_message_unref (LmMessage *message)
+{
+	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);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-message.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,78 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_MESSAGE_H__
+#define __LM_MESSAGE_H__
+
+#if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
+#error "Only <loudmouth/loudmouth.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#include <loudmouth/lm-message-node.h>
+
+typedef struct LmMessagePriv LmMessagePriv;
+
+typedef struct {
+	LmMessageNode *node;
+
+	LmMessagePriv *priv;
+} LmMessage;
+
+typedef enum {
+	LM_MESSAGE_TYPE_MESSAGE,
+	LM_MESSAGE_TYPE_PRESENCE,
+	LM_MESSAGE_TYPE_IQ,
+	LM_MESSAGE_TYPE_STREAM,
+	LM_MESSAGE_TYPE_STREAM_ERROR,
+	LM_MESSAGE_TYPE_UNKNOWN
+} LmMessageType;
+
+typedef enum {
+        LM_MESSAGE_SUB_TYPE_NOT_SET = -10,
+	LM_MESSAGE_SUB_TYPE_NORMAL = -2,
+	LM_MESSAGE_SUB_TYPE_AVAILABLE = -1,
+	LM_MESSAGE_SUB_TYPE_CHAT = 0,
+        LM_MESSAGE_SUB_TYPE_GROUPCHAT,
+        LM_MESSAGE_SUB_TYPE_HEADLINE,
+        LM_MESSAGE_SUB_TYPE_UNAVAILABLE,
+        LM_MESSAGE_SUB_TYPE_PROBE,
+        LM_MESSAGE_SUB_TYPE_SUBSCRIBE,
+        LM_MESSAGE_SUB_TYPE_UNSUBSCRIBE,
+        LM_MESSAGE_SUB_TYPE_SUBSCRIBED,
+        LM_MESSAGE_SUB_TYPE_UNSUBSCRIBED,
+	LM_MESSAGE_SUB_TYPE_GET,
+	LM_MESSAGE_SUB_TYPE_SET,
+	LM_MESSAGE_SUB_TYPE_RESULT,
+	LM_MESSAGE_SUB_TYPE_ERROR
+} LmMessageSubType;
+
+LmMessage *   lm_message_new               (const gchar      *to,
+					    LmMessageType     type);
+LmMessage *   lm_message_new_with_sub_type (const gchar      *to,
+					    LmMessageType     type,
+					    LmMessageSubType  sub_type);
+LmMessageType lm_message_get_type          (LmMessage        *message);
+LmMessageType lm_message_get_sub_type      (LmMessage        *message);
+LmMessageNode * lm_message_get_node        (LmMessage        *message);
+LmMessage *   lm_message_ref               (LmMessage        *message);
+void          lm_message_unref             (LmMessage        *message);
+
+#endif /* __LM_MESSAGE_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-parser.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,288 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <string.h>
+
+#include "lm-debug.h"
+#include "lm-internals.h"
+#include "lm-message-node.h"
+#include "lm-parser.h"
+
+#define SHORT_END_TAG "/>"
+#define XML_MAX_DEPTH 5
+
+#define LM_PARSER(o) ((LmParser *) o)
+
+struct LmParser {
+	LmParserMessageFunction  function;
+	gpointer                 user_data;
+	GDestroyNotify           notify;
+	
+	LmMessageNode           *cur_root;
+	LmMessageNode           *cur_node;
+		
+	GMarkupParser           *m_parser;
+	GMarkupParseContext     *context;
+};
+
+
+/* Used while parsing */
+static void    parser_start_node_cb (GMarkupParseContext  *context,
+				     const gchar          *node_name,
+				     const gchar         **attribute_names,
+				     const gchar         **attribute_values,
+				     gpointer              user_data,
+				     GError              **error);
+static void    parser_end_node_cb   (GMarkupParseContext  *context,
+				     const gchar          *node_name,
+				     gpointer              user_data,
+				     GError              **error);
+static void    parser_text_cb       (GMarkupParseContext  *context,
+				     const gchar          *text,
+				     gsize                 text_len,  
+				     gpointer              user_data,
+				     GError              **error);
+static void    parser_error_cb      (GMarkupParseContext  *context,
+				     GError               *error,
+				     gpointer              user_data);
+
+static void
+parser_start_node_cb (GMarkupParseContext  *context,
+		      const gchar          *node_name,
+		      const gchar         **attribute_names,
+		      const gchar         **attribute_values,
+		      gpointer              user_data,
+		      GError              **error)
+{	
+	LmParser     *parser;
+	gint          i;
+	
+	parser = LM_PARSER (user_data);;
+	
+
+/* 	parser->cur_depth++; */
+
+	if (!parser->cur_root) {
+		/* New toplevel element */
+		parser->cur_root = _lm_message_node_new (node_name);
+		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", 
+		       attribute_names[i],
+		       attribute_values[i]);
+		
+		lm_message_node_set_attributes (parser->cur_node,
+						attribute_names[i],
+						attribute_values[i], 
+						NULL);
+	}
+	
+	if (g_ascii_strcasecmp ("stream:stream", node_name) == 0) {
+		parser_end_node_cb (context,
+				    "stream:stream",
+				    user_data, 
+				    error);
+	}
+}
+
+static void
+parser_end_node_cb (GMarkupParseContext  *context,
+		    const gchar          *node_name,
+		    gpointer              user_data,
+		    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);
+
+	if (g_ascii_strcasecmp (parser->cur_node->name, node_name) != 0) {
+		if (g_ascii_strcasecmp (node_name, "stream:stream")) {
+			g_print ("Got an stream:stream end\n");
+		}
+		g_warning ("Trying to close node that isn't open: %s",
+			   node_name);
+		return;
+	}
+
+	if (parser->cur_node == parser->cur_root) {
+		LmMessage *m;
+		
+		m = _lm_message_new_from_node (parser->cur_root);
+
+		if (!m) {
+			g_warning ("Couldn't create message: %s\n",
+				   parser->cur_root->name);
+			return;
+		}
+
+		g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_PARSER,
+		       "Have a new message\n");
+		if (parser->function) {
+			(* parser->function) (parser, m, parser->user_data);
+		}
+
+		lm_message_unref (m);
+ 		lm_message_node_unref (parser->cur_root);
+		
+		parser->cur_node = parser->cur_root = NULL;
+	} else {
+		LmMessageNode *tmp_node;
+		tmp_node = parser->cur_node;
+		parser->cur_node = parser->cur_node->parent;
+	}
+}
+
+static void
+parser_text_cb (GMarkupParseContext   *context,
+		const gchar           *text,
+		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
+parser_error_cb (GMarkupParseContext *context,
+		 GError              *error,
+		 gpointer             user_data)
+{
+	LmParser     *parser;
+	
+	g_return_if_fail (user_data != NULL);
+	
+	parser = LM_PARSER (user_data);
+
+	g_markup_parse_context_free (parser->context);
+	parser->context = NULL;
+}
+
+LmParser *
+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);
+		return NULL;
+	}
+
+	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;
+	parser->m_parser->error         = parser_error_cb;
+
+	parser->context = g_markup_parse_context_new (parser->m_parser, 0,
+						    parser, NULL);
+
+	parser->cur_root = NULL;
+	parser->cur_node = NULL;
+
+	return parser;
+}
+
+void
+lm_parser_parse (LmParser *parser, const gchar *string)
+{
+	g_return_if_fail (parser != NULL);
+	
+	if (!parser->context) {
+		parser->context = g_markup_parse_context_new (parser->m_parser, 0,
+							      parser, NULL);
+	}
+
+	if (!g_utf8_validate (string, -1, NULL)) {
+		gchar *tmp;
+		
+		/* We can't do much better than guess what charset the string is
+		 * encoded in... Try ISO-8859-1.
+		 */
+		tmp = g_convert (string, -1,
+				 "UTF-8", "ISO-8859-1",
+				 NULL, NULL,
+				 NULL);
+		
+		if (tmp) {
+			if (g_markup_parse_context_parse (parser->context, tmp, 
+							  strlen (tmp), NULL)) {
+			} else {
+				g_warning ("Parsing failed\n");
+			}
+			
+			g_free (tmp);
+		} else {
+			g_warning ("Trying to parse a string that is not UTF-8 and not ISO-8859-1.");
+		}
+	} else {
+		if (g_markup_parse_context_parse (parser->context, string, 
+						  strlen (string), NULL)) {
+		} else {
+			g_warning ("Parsing failed\n");
+		}
+	}
+}
+
+void
+lm_parser_free (LmParser *parser)
+{
+	if (parser->notify) {
+		(* parser->notify) (parser->user_data);
+	}
+	
+	g_free (parser);
+	g_print ("Free parser\n");
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-parser.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,41 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_PARSER_H__
+#define __LM_PARSER_H__
+
+#include <glib.h>
+#include "lm-message.h"
+
+typedef struct LmParser LmParser;
+
+typedef void (* LmParserMessageFunction) (LmParser     *parser,
+					  LmMessage    *message,
+					  gpointer      user_data);
+
+LmParser *   lm_parser_new       (LmParserMessageFunction  function,
+				  gpointer                 user_data,
+				  GDestroyNotify           notify);
+void         lm_parser_parse     (LmParser                *parser,
+				  const gchar             *string);
+void         lm_parser_free      (LmParser                *parser);
+
+#endif /* __LM_PARSER_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-sha.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,617 @@
+/*-
+ * Copyright (c) 2001, 2002 Allan Saddi <allan@saddi.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	$Id: lm-sha.c.svn-base,v 1.1 2003/05/19 18:26:57 hallski Exp $
+ */
+
+/*
+ * Define WORDS_BIGENDIAN if compiling on a big-endian architecture.
+ *
+ * Define SHA1_TEST to test the implementation using the NIST's
+ * sample messages. The output should be:
+ *
+ *   a9993e36 4706816a ba3e2571 7850c26c 9cd0d89d
+ *   84983e44 1c3bd26e baae4aa1 f95129e5 e54670f1
+ *   34aa973c d4c4daa4 f61eeb2b dbad2731 6534016f
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#include <string.h>
+#include <stdio.h>
+#include <glib.h>
+
+#include "lm-sha.h"
+
+#define SHA1_HASH_SIZE 20
+
+/* Hash size in 32-bit words */
+#define SHA1_HASH_WORDS 5
+
+struct _SHA1Context {
+  guint64 totalLength;
+  guint32 hash[SHA1_HASH_WORDS];
+  guint32 bufferLength;
+  union {
+    guint32 words[16];
+    guint8 bytes[64];
+  } buffer;
+};
+
+typedef struct _SHA1Context SHA1Context;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void SHA1Init (SHA1Context *sc);
+void SHA1Update (SHA1Context *sc, const void *data, guint32 len);
+void SHA1Final (SHA1Context *sc, guint8 hash[SHA1_HASH_SIZE]);
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifndef lint
+static const char rcsid[] =
+	"$Id: lm-sha.c.svn-base,v 1.1 2003/05/19 18:26:57 hallski Exp $";
+#endif /* !lint */
+
+#define ROTL(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
+#define ROTR(x, n) (((x) >> (n)) | ((x) << (32 - (n))))
+
+#define F_0_19(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
+#define F_20_39(x, y, z) ((x) ^ (y) ^ (z))
+#define F_40_59(x, y, z) (((x) & ((y) | (z))) | ((y) & (z)))
+#define F_60_79(x, y, z) ((x) ^ (y) ^ (z))
+
+#define DO_ROUND(F, K) { \
+  temp = ROTL(a, 5) + F(b, c, d) + e + *(W++) + K; \
+  e = d; \
+  d = c; \
+  c = ROTL(b, 30); \
+  b = a; \
+  a = temp; \
+}
+
+#define K_0_19 0x5a827999L
+#define K_20_39 0x6ed9eba1L
+#define K_40_59 0x8f1bbcdcL
+#define K_60_79 0xca62c1d6L
+
+#ifndef RUNTIME_ENDIAN
+
+#ifdef WORDS_BIGENDIAN
+
+#define BYTESWAP(x) (x)
+#define BYTESWAP64(x) (x)
+
+#else /* WORDS_BIGENDIAN */
+
+#define BYTESWAP(x) ((ROTR((x), 8) & 0xff00ff00L) | \
+		     (ROTL((x), 8) & 0x00ff00ffL))
+#define BYTESWAP64(x) _byteswap64(x)
+
+static inline guint64 _byteswap64(guint64 x)
+{
+  guint32 a = x >> 32;
+  guint32 b = (guint32) x;
+  return ((guint64) BYTESWAP(b) << 32) | (guint64) BYTESWAP(a);
+}
+
+#endif /* WORDS_BIGENDIAN */
+
+#else /* !RUNTIME_ENDIAN */
+
+static int littleEndian;
+
+#define BYTESWAP(x) _byteswap(x)
+#define BYTESWAP64(x) _byteswap64(x)
+
+#define _BYTESWAP(x) ((ROTR((x), 8) & 0xff00ff00L) | \
+		      (ROTL((x), 8) & 0x00ff00ffL))
+#define _BYTESWAP64(x) __byteswap64(x)
+
+static inline guint64 __byteswap64(guint64 x)
+{
+  guint32 a = x >> 32;
+  guint32 b = (guint32) x;
+  return ((guint64) _BYTESWAP(b) << 32) | (guint64) _BYTESWAP(a);
+}
+
+static inline guint32 _byteswap(guint32 x)
+{
+  if (!littleEndian)
+    return x;
+  else
+    return _BYTESWAP(x);
+}
+
+static inline guint64 _byteswap64(guint64 x)
+{
+  if (!littleEndian)
+    return x;
+  else
+    return _BYTESWAP64(x);
+}
+
+static inline void setEndian(void)
+{
+  union {
+    guint32 w;
+    guint8 b[4];
+  } endian;
+
+  endian.w = 1L;
+  littleEndian = endian.b[0] != 0;
+}
+
+#endif /* !RUNTIME_ENDIAN */
+
+static const guint8 padding[64] = {
+  0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+void
+SHA1Init (SHA1Context *sc)
+{
+#ifdef RUNTIME_ENDIAN
+  setEndian ();
+#endif /* RUNTIME_ENDIAN */
+
+  sc->totalLength = 0LL;
+  sc->hash[0] = 0x67452301L;
+  sc->hash[1] = 0xefcdab89L;
+  sc->hash[2] = 0x98badcfeL;
+  sc->hash[3] = 0x10325476L;
+  sc->hash[4] = 0xc3d2e1f0L;
+  sc->bufferLength = 0L;
+}
+
+static void
+burnStack (int size)
+{
+  char buf[128];
+
+  memset (buf, 0, sizeof (buf));
+  size -= sizeof (buf);
+  if (size > 0)
+    burnStack (size);
+}
+
+static void
+SHA1Guts (SHA1Context *sc, const guint32 *cbuf)
+{
+  guint32 buf[80];
+  guint32 *W, *W3, *W8, *W14, *W16;
+  guint32 a, b, c, d, e, temp;
+  int i;
+
+  W = buf;
+
+  for (i = 15; i >= 0; i--) {
+    *(W++) = BYTESWAP(*cbuf);
+    cbuf++;
+  }
+
+  W16 = &buf[0];
+  W14 = &buf[2];
+  W8 = &buf[8];
+  W3 = &buf[13];
+
+  for (i = 63; i >= 0; i--) {
+    *W = *(W3++) ^ *(W8++) ^ *(W14++) ^ *(W16++);
+    *W = ROTL(*W, 1);
+    W++;
+  }
+
+  a = sc->hash[0];
+  b = sc->hash[1];
+  c = sc->hash[2];
+  d = sc->hash[3];
+  e = sc->hash[4];
+
+  W = buf;
+
+#ifndef SHA1_UNROLL
+#define SHA1_UNROLL 20
+#endif /* !SHA1_UNROLL */
+
+#if SHA1_UNROLL == 1
+  for (i = 19; i >= 0; i--)
+    DO_ROUND(F_0_19, K_0_19);
+
+  for (i = 19; i >= 0; i--)
+    DO_ROUND(F_20_39, K_20_39);
+
+  for (i = 19; i >= 0; i--)
+    DO_ROUND(F_40_59, K_40_59);
+
+  for (i = 19; i >= 0; i--)
+    DO_ROUND(F_60_79, K_60_79);
+#elif SHA1_UNROLL == 2
+  for (i = 9; i >= 0; i--) {
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+  }
+
+  for (i = 9; i >= 0; i--) {
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+  }
+
+  for (i = 9; i >= 0; i--) {
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+  }
+
+  for (i = 9; i >= 0; i--) {
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+  }
+#elif SHA1_UNROLL == 4
+  for (i = 4; i >= 0; i--) {
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+  }
+
+  for (i = 4; i >= 0; i--) {
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+  }
+
+  for (i = 4; i >= 0; i--) {
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+  }
+
+  for (i = 4; i >= 0; i--) {
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+  }
+#elif SHA1_UNROLL == 5
+  for (i = 3; i >= 0; i--) {
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+  }
+
+  for (i = 3; i >= 0; i--) {
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+  }
+
+  for (i = 3; i >= 0; i--) {
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+  }
+
+  for (i = 3; i >= 0; i--) {
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+  }
+#elif SHA1_UNROLL == 10
+  for (i = 1; i >= 0; i--) {
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+  }
+
+  for (i = 1; i >= 0; i--) {
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+  }
+
+  for (i = 1; i >= 0; i--) {
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+  }
+
+  for (i = 1; i >= 0; i--) {
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+  }
+#elif SHA1_UNROLL == 20
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+#else /* SHA1_UNROLL */
+#error SHA1_UNROLL must be 1, 2, 4, 5, 10 or 20!
+#endif
+
+  sc->hash[0] += a;
+  sc->hash[1] += b;
+  sc->hash[2] += c;
+  sc->hash[3] += d;
+  sc->hash[4] += e;
+}
+
+void
+SHA1Update (SHA1Context *sc, const void *data, guint32 len)
+{
+  guint32 bufferBytesLeft;
+  guint32 bytesToCopy;
+  int needBurn = 0;
+
+#ifdef SHA1_FAST_COPY
+  if (sc->bufferLength) {
+    bufferBytesLeft = 64L - sc->bufferLength;
+
+    bytesToCopy = bufferBytesLeft;
+    if (bytesToCopy > len)
+      bytesToCopy = len;
+
+    memcpy (&sc->buffer.bytes[sc->bufferLength], data, bytesToCopy);
+
+    sc->totalLength += bytesToCopy * 8L;
+
+    sc->bufferLength += bytesToCopy;
+    ((guint8 *) data) += bytesToCopy;
+    len -= bytesToCopy;
+
+    if (sc->bufferLength == 64L) {
+      SHA1Guts (sc, sc->buffer.words);
+      needBurn = 1;
+      sc->bufferLength = 0L;
+    }
+  }
+
+  while (len > 63) {
+    sc->totalLength += 512L;
+
+    SHA1Guts (sc, data);
+    needBurn = 1;
+
+    ((guint8 *) data) += 64L;
+    len -= 64L;
+  }
+
+  if (len) {
+    memcpy (&sc->buffer.bytes[sc->bufferLength], data, len);
+
+    sc->totalLength += len * 8L;
+
+    sc->bufferLength += len;
+  }
+#else /* SHA1_FAST_COPY */
+  while (len) {
+    bufferBytesLeft = 64L - sc->bufferLength;
+
+    bytesToCopy = bufferBytesLeft;
+    if (bytesToCopy > len)
+      bytesToCopy = len;
+
+    memcpy (&sc->buffer.bytes[sc->bufferLength], data, bytesToCopy);
+
+    sc->totalLength += bytesToCopy * 8L;
+
+    sc->bufferLength += bytesToCopy;
+    ((guint8 *) data) += bytesToCopy;
+    len -= bytesToCopy;
+
+    if (sc->bufferLength == 64L) {
+      SHA1Guts (sc, sc->buffer.words);
+      needBurn = 1;
+      sc->bufferLength = 0L;
+    }
+  }
+#endif /* SHA1_FAST_COPY */
+
+  if (needBurn)
+    burnStack (sizeof (guint32[86]) + sizeof (guint32 *[5]) + sizeof (int));
+}
+
+void
+SHA1Final (SHA1Context *sc, guint8 hash[SHA1_HASH_SIZE])
+{
+  guint32 bytesToPad;
+  guint64 lengthPad;
+  int i;
+
+  bytesToPad = 120L - sc->bufferLength;
+  if (bytesToPad > 64L)
+    bytesToPad -= 64L;
+
+  lengthPad = BYTESWAP64(sc->totalLength);
+
+  SHA1Update (sc, padding, bytesToPad);
+  SHA1Update (sc, &lengthPad, 8L);
+
+  if (hash) {
+    for (i = 0; i < SHA1_HASH_WORDS; i++) {
+#ifdef SHA1_FAST_COPY
+      *((guint32 *) hash) = BYTESWAP(sc->hash[i]);
+#else /* SHA1_FAST_COPY */
+      hash[0] = (guint8) (sc->hash[i] >> 24);
+      hash[1] = (guint8) (sc->hash[i] >> 16);
+      hash[2] = (guint8) (sc->hash[i] >> 8);
+      hash[3] = (guint8) sc->hash[i];
+#endif /* SHA1_FAST_COPY */
+      hash += 4;
+    }
+  }
+}
+
+const gchar *
+lm_sha_hash (const gchar *str)
+{
+        static gchar  ret_val[41];
+        SHA1Context   ctx;
+        guint8         hash[SHA1_HASH_SIZE];
+        gchar        *ch;
+        guint          i;
+        
+        SHA1Init (&ctx);
+        SHA1Update (&ctx, str, strlen (str));
+        SHA1Final (&ctx, hash);
+
+        ch = ret_val;
+
+        for (i = 0; i < SHA1_HASH_SIZE; ++i) {
+                snprintf (ch, 3, "%02x", hash[i]);
+                ch += 2;
+        }
+
+        return (const gchar *) ret_val;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-sha.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,29 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_SHA_H__
+#define __LM_SHA_H__
+
+#include <glib.h>
+
+const gchar *     lm_sha_hash    (const gchar *str);
+
+#endif /* __LM_SHA_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-utils.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,84 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <string.h>
+#include <stdio.h>
+#include <time.h>
+
+#include "lm-internals.h"
+#include "lm-utils.h"
+
+LmCallback *
+_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;
+	cb->notify = notify;
+
+	return cb;
+}
+
+void
+_lm_utils_free_callback (LmCallback *cb)
+{
+	if (cb->notify) {
+		(* cb->notify) (cb->user_data);
+	}
+	g_free (cb);
+}
+
+gchar *
+_lm_utils_generate_id (void)
+{
+	static gint  number = 0;
+
+	return g_strdup_printf ("msg_%d", ++number);
+}
+
+struct tm *
+lm_utils_get_localtime (const gchar *stamp)
+{
+	struct tm tmp_tm;
+	time_t    t;
+	gint      year, month;
+	
+	/* 20021209T23:51:30 */
+
+	sscanf (stamp, "%4d%2d%2dT%2d:%2d:%2d", 
+		&year, &month, &tmp_tm.tm_mday, &tmp_tm.tm_hour,
+		&tmp_tm.tm_min, &tmp_tm.tm_sec);
+
+	tmp_tm.tm_year = year - 1900;
+	tmp_tm.tm_mon = month - 1;
+	tmp_tm.tm_isdst = -1;
+
+ 	t = mktime (&tmp_tm);
+	t = t - (int) timezone;
+
+	return localtime (&t);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/lm-utils.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,33 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_UTIL_H__
+#define __LM_UTIL_H__
+
+#if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
+#error "Only <loudmouth/loudmouth.h> can be included directly, this file may di\sappear or change contents."
+#endif
+
+#include <glib.h>
+
+struct tm *lm_utils_get_localtime (const gchar *stamp);
+
+#endif /* __LM_UTIL__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/loudmouth.h.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LOUDMOUTH_H__
+#define __LOUDMOUTH_H__
+
+#define LM_INSIDE_LOUDMOUTH_H 1
+
+#include <loudmouth/lm-connection.h>
+#include <loudmouth/lm-error.h>
+#include <loudmouth/lm-message.h>
+#include <loudmouth/lm-message-handler.h>
+#include <loudmouth/lm-message-node.h>
+#include <loudmouth/lm-utils.h>
+
+#undef LM_INSIDE_LOUDMOUTH_H
+
+#endif /* __LOUDMOUTH_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/test-jid.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,28 @@
+#include "lm-jid.h"
+
+int 
+main (int argc, char **argv)
+{
+        int i;
+        
+        if (argc < 2) {
+                g_print ("Usage: %s <jid> <jid> ...\n", argv[0]);
+                exit (1);
+        }
+
+        for (i = 1; i < argc; ++i) {
+                LmJID *jid;
+                
+                jid = lm_jid_new (argv[i]);
+                
+                g_print ("=======( JID[%i] )=======\n", i);
+                g_print ("# Name: '%s'\n", jid->name);
+                g_print ("# Host: '%s'\n", jid->host);
+                if (jid->resource) {
+                        g_print ("# Resource: '%s'\n", jid->resource);
+                }
+                g_print ("-------------------------\n");
+                g_print ("# JID: '%s'\n", lm_jid_to_string (jid));
+                g_print ("=========================\n\n");
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/text-base/test-lm.c.svn-base	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,117 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <string.h>
+#include <loudmouth/loudmouth.h>
+#include "lm-internals.h"
+
+#define USAGE "Usage: test-lm <server> <username> <password>\n"
+
+typedef struct {
+	gchar *name;
+	gchar *passwd;
+} UserInfo;
+
+static void
+authentication_cb (LmConnection *connection, gboolean result, gpointer ud)
+{
+	g_print ("Auth: %d\n", result);
+
+	if (result == TRUE) {
+		LmMessage *m;
+		
+		m = lm_message_new_with_sub_type (NULL,
+						  LM_MESSAGE_TYPE_PRESENCE,
+						  LM_MESSAGE_SUB_TYPE_AVAILABLE);
+		g_print (":: %s\n", lm_message_node_to_string (m->node));
+		
+		lm_connection_send (connection, m, NULL);
+		lm_message_unref (m);
+	}
+}
+
+static void
+connection_open_cb (LmConnection *connection, gboolean result, UserInfo *info)
+{
+	g_print ("Connected callback\n");
+	lm_connection_authenticate (connection,
+				    info->name, info->passwd, "TestLM",
+				    FALSE, authentication_cb, NULL, NULL);
+	g_print ("Sent auth message\n");
+}
+
+static LmHandlerResult
+handle_messages (LmMessageHandler *handler,
+		 LmConnection     *connection,
+		 LmMessage        *m,
+		 gpointer          user_data)
+{
+	g_print ("Incoming message from: %s\n",
+		 lm_message_node_get_attribute (m->node, "from"));
+
+	return LM_HANDLER_RESULT_REMOVE_MESSAGE;
+}
+
+int 
+main (int argc, char **argv)
+{
+	GMainLoop        *main_loop;
+	LmConnection     *connection;
+	LmMessageHandler *handler;
+	gboolean          result;
+	UserInfo         *info;
+	
+	if (argc < 4) {
+		g_print (USAGE);
+		return 1;
+	}
+
+        connection = lm_connection_new (argv[1]);
+
+	handler = lm_message_handler_new (handle_messages, NULL, NULL);
+	lm_connection_register_message_handler (connection, handler, 
+						LM_MESSAGE_TYPE_MESSAGE, 
+						LM_HANDLER_PRIORITY_NORMAL);
+	
+	lm_message_handler_unref (handler);
+	
+	info = g_new0 (UserInfo, 1);
+	info->name = g_strdup (argv[2]);
+	info->passwd = g_strdup (argv[3]);
+	
+	result = lm_connection_open (connection,
+				     (LmResultFunction) connection_open_cb,
+				     info, NULL, NULL);
+
+	if (!result) {
+		g_print ("Opening connection failed: %d\n", result);
+	} else {
+		g_print ("Returned from the connection_open\n");
+	}
+	
+	main_loop = g_main_loop_new (NULL, FALSE);
+	g_main_loop_run (main_loop);
+
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/Makefile.am.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 64
+/svn/projects/!svn/ver/328/loudmouth/trunk/loudmouth/Makefile.am
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-connection.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 68
+/svn/projects/!svn/ver/337/loudmouth/trunk/loudmouth/lm-connection.c
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-connection.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 68
+/svn/projects/!svn/ver/321/loudmouth/trunk/loudmouth/lm-connection.h
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-debug.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 63
+/svn/projects/!svn/ver/346/loudmouth/trunk/loudmouth/lm-debug.c
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-debug.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 63
+/svn/projects/!svn/ver/330/loudmouth/trunk/loudmouth/lm-debug.h
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-error.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 62
+/svn/projects/!svn/ver/28/loudmouth/trunk/loudmouth/lm-error.c
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-error.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 62
+/svn/projects/!svn/ver/50/loudmouth/trunk/loudmouth/lm-error.h
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-internals.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 67
+/svn/projects/!svn/ver/328/loudmouth/trunk/loudmouth/lm-internals.h
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-message-handler.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/projects/!svn/ver/28/loudmouth/trunk/loudmouth/lm-message-handler.c
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-message-handler.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/projects/!svn/ver/36/loudmouth/trunk/loudmouth/lm-message-handler.h
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-message-node.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 70
+/svn/projects/!svn/ver/317/loudmouth/trunk/loudmouth/lm-message-node.c
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-message-node.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 70
+/svn/projects/!svn/ver/317/loudmouth/trunk/loudmouth/lm-message-node.h
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-message.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 65
+/svn/projects/!svn/ver/328/loudmouth/trunk/loudmouth/lm-message.c
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-message.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 65
+/svn/projects/!svn/ver/324/loudmouth/trunk/loudmouth/lm-message.h
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-parser.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 64
+/svn/projects/!svn/ver/337/loudmouth/trunk/loudmouth/lm-parser.c
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-parser.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 63
+/svn/projects/!svn/ver/49/loudmouth/trunk/loudmouth/lm-parser.h
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-sha.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/projects/!svn/ver/49/loudmouth/trunk/loudmouth/lm-sha.c
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-sha.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/projects/!svn/ver/28/loudmouth/trunk/loudmouth/lm-sha.h
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-utils.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 62
+/svn/projects/!svn/ver/28/loudmouth/trunk/loudmouth/lm-utils.c
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/lm-utils.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 62
+/svn/projects/!svn/ver/36/loudmouth/trunk/loudmouth/lm-utils.h
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/loudmouth.h.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 63
+/svn/projects/!svn/ver/28/loudmouth/trunk/loudmouth/loudmouth.h
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/test-jid.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 61
+/svn/projects/!svn/ver/1/loudmouth/trunk/loudmouth/test-jid.c
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.svn/wcprops/test-lm.c.svn-work	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 61
+/svn/projects/!svn/ver/48/loudmouth/trunk/loudmouth/test-lm.c
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/Makefile.am	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,56 @@
+NULL=
+
+INCLUDES = 				\
+	-I.				\
+	-I$(top_srcdir)			\
+	$(LOUDMOUTH_CFLAGS)		\
+	-DLM_COMPILATION		\
+	$(NULL)
+
+lib_LTLIBRARIES = libloudmouth.la
+
+libloudmouth_la_SOURCES =		\
+	lm-connection.c	 		\
+	lm-debug.c                      \
+	lm-debug.h                      \
+	lm-error.c			\
+	lm-message.c	 		\
+	lm-message-handler.c		\
+	lm-message-node.c		\
+	lm-parser.c			\
+	lm-parser.h			\
+	lm-internals.h			\
+	lm-sha.c			\
+	lm-sha.h			\
+	lm-utils.c			\
+	$(NULL)
+
+libloudmouthinclude_HEADERS =		\
+	lm-connection.h			\
+	lm-error.h			\
+	lm-message.h		 	\
+	lm-message-handler.h		\
+	lm-message-node.h		\
+	lm-utils.h			\
+	loudmouth.h			\
+	$(NULL)
+
+libloudmouth_la_LIBADD = 		\
+	$(LOUDMOUTH_LIBS)
+
+libloudmouthincludedir = $(includedir)/loudmouth-1.0/loudmouth
+
+# an explicit dependency here so alm generated files get built
+$(OBJECTS): $(built_sources)
+
+noinst_PROGRAMS = test-lm
+
+test_lm_SOURCES =			\
+	test-lm.c
+
+test_lm_LDADD =			 	\
+	$(LOUDMOUTH_LIBS)		\
+	libloudmouth.la			\
+	$(NULL)
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-connection.c	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,1347 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+
+#include <netdb.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+#include "lm-debug.h"
+#include "lm-error.h"
+#include "lm-internals.h"
+#include "lm-parser.h"
+#include "lm-sha.h"
+#include "lm-connection.h"
+
+#define IN_BUFFER_SIZE 1024
+
+typedef struct {
+	LmHandlerPriority  priority;
+	LmMessageHandler  *handler;
+} HandlerData;
+
+typedef struct {
+	GSource source;
+	
+	LmConnection *connection;
+} LmIncomingSource;
+
+struct _LmConnection {
+	/* Parameters */
+	gchar      *server;
+	guint       port;
+	gboolean    use_ssl;
+
+	gboolean    is_open;
+	gboolean    is_authenticated;
+	
+	LmParser   *parser;
+	gchar      *stream_id;
+
+	GHashTable *id_handlers;
+	GSList     *handlers[LM_MESSAGE_TYPE_UNKNOWN];
+
+	/* Communication */
+	GIOChannel *io_channel;
+
+	LmCallback *open_cb;
+	LmCallback *close_cb;
+	LmCallback *auth_cb;
+	LmCallback *register_cb;
+
+	LmCallback *disconnect_cb;
+
+	GQueue     *incoming_messages;
+	GSource    *incoming_source;
+
+	gint        ref_count;
+};
+
+static void     connection_free (LmConnection *connection);
+
+
+static void     connection_handle_message    (LmConnection         *connection,
+					      LmMessage            *message);
+
+static void     connection_new_message_cb    (LmParser             *parser,
+					      LmMessage            *message,
+					      LmConnection         *connection);
+static gboolean connection_do_open         (LmConnection     *connection,
+					      GError          **error);
+
+static void     connection_do_close           (LmConnection          *connection);
+static gboolean connection_in_event          (GIOChannel   *source,
+					      GIOCondition  condition,
+					      LmConnection *connection);
+static gboolean connection_error_event       (GIOChannel   *source,
+					      GIOCondition  condition,
+					      LmConnection *connection);
+static gboolean connection_hup_event         (GIOChannel   *source,
+					      GIOCondition  condition,
+					      LmConnection *connection);
+static gboolean connection_send              (LmConnection             *connection,
+					      const gchar          *str,
+					      gint                  len,
+					      GError               **error);
+static LmHandlerResult connection_auth_reply (LmMessageHandler    *handler,
+					      LmConnection        *connection,
+					      LmMessage           *m,
+					      gpointer             user_data);
+
+static void     connection_stream_received   (LmConnection             *connection, 
+					      LmMessage                *m);
+
+static gint     connection_handler_compare_func (HandlerData  *a,
+						 HandlerData  *b);
+static gboolean connection_incoming_prepare  (GSource         *source,
+					      gint            *timeout);
+static gboolean connection_incoming_check    (GSource         *source);
+static gboolean connection_incoming_dispatch (GSource         *source,
+					      GSourceFunc      callback,
+					      gpointer           user_data);
+static GSource * connection_create_source    (LmConnection *connection);
+static void      connection_signal_disconnect (LmConnection *connection,
+					       LmDisconnectReason reason);
+
+static GSourceFuncs incoming_funcs = {
+	connection_incoming_prepare,
+	connection_incoming_check,
+	connection_incoming_dispatch,
+	NULL
+};
+
+static void
+connection_free (LmConnection *connection)
+{
+	g_free (connection->server);
+
+	if (connection->io_channel) {
+		g_io_channel_unref (connection->io_channel);
+	}
+
+	g_free (connection);
+}
+
+
+static void
+connection_handle_message (LmConnection *connection, LmMessage *m)
+{
+	LmMessageHandler *handler;
+	GSList           *l;
+	const gchar      *id;
+	LmHandlerResult   result = LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+
+	if (lm_message_get_type (m) == LM_MESSAGE_TYPE_STREAM) {
+		connection_stream_received (connection, m);
+		return;
+	}
+	
+	id = lm_message_node_get_attribute (m->node, "id");
+	
+	if (id) {
+		handler = g_hash_table_lookup (connection->id_handlers, id);
+		if (handler) {
+			result = _lm_message_handler_handle_message (handler, 
+								     connection,
+								     m);
+			g_hash_table_remove (connection->id_handlers, id);
+		}
+	}
+	
+	if (result == LM_HANDLER_RESULT_REMOVE_MESSAGE) {
+		return;
+	}
+
+	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);
+	}
+	
+	return;
+}
+
+static void
+connection_new_message_cb (LmParser     *parser,
+			   LmMessage    *m,
+			   LmConnection *connection)
+{
+	lm_message_ref (m);
+
+	lm_verbose ("New message with type=\"%s\" from: %s\n",
+		    _lm_message_type_to_string (lm_message_get_type (m)),
+		    lm_message_node_get_attribute (m->node, "from"));
+
+	g_queue_push_tail (connection->incoming_messages, m);
+}
+
+static gboolean
+connection_do_open (LmConnection *connection, GError **error)
+{
+	struct hostent     *he;
+        struct in_addr     *haddr;
+        struct sockaddr_in  saddr;
+	gint                fd;
+	
+	g_return_val_if_fail (connection != NULL, FALSE);
+	
+        he = gethostbyname(connection->server);
+        if (he == NULL) {
+ 		g_set_error (error,
+ 			     LM_ERROR,                 
+ 			     LM_ERROR_CONNECTION_OPEN,   
+ 			     "gethostbyname() failed");
+		return FALSE;
+        }
+
+        haddr = ((struct in_addr *) (he->h_addr_list)[0]);
+
+        fd = socket(AF_INET, SOCK_STREAM, 0);
+        memset(&saddr, 0, sizeof(saddr));
+        memcpy(&saddr.sin_addr, haddr, sizeof(struct in_addr));
+        saddr.sin_family = AF_INET;
+        saddr.sin_port = htons (connection->port);
+ 
+        if (connect(fd, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) {
+ 		g_set_error (error,
+ 			     LM_ERROR,           
+ 			     LM_ERROR_CONNECTION_OPEN,
+ 			     "connect() failed");
+		close (fd);
+		return FALSE;
+        }
+	
+	connection->io_channel = g_io_channel_unix_new (fd);
+	g_io_channel_set_close_on_unref (connection->io_channel, TRUE);
+	g_io_channel_set_encoding (connection->io_channel, NULL, NULL);
+	
+	g_io_channel_set_buffered (connection->io_channel, FALSE);
+	g_io_channel_set_flags (connection->io_channel,
+				G_IO_FLAG_NONBLOCK, NULL);
+	g_io_add_watch (connection->io_channel,
+			G_IO_IN,
+			(GIOFunc) connection_in_event,
+			connection);
+	g_io_add_watch (connection->io_channel, 
+			G_IO_ERR,
+			(GIOFunc) connection_error_event,
+			connection);
+	g_io_add_watch (connection->io_channel,
+			G_IO_HUP,
+			(GIOFunc) connection_hup_event,
+			connection);
+
+	connection->is_open = TRUE;
+
+	if (!connection_send (connection,
+			      "<?xml version='1.0' encoding='UTF-8'?>", -1, 
+			      error)) {
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static void
+connection_do_close (LmConnection *connection)
+{
+	if (connection->io_channel) {
+		g_io_channel_unref (connection->io_channel);
+	}
+
+	connection->io_channel = NULL;
+	connection->is_open = FALSE;
+}
+
+
+static gboolean
+connection_in_event (GIOChannel   *source,
+		     GIOCondition  condition,
+		     LmConnection *connection)
+{
+	gchar             buf[IN_BUFFER_SIZE];
+	gsize             bytes_read;
+       
+	if (!connection->io_channel) {
+		return FALSE;
+	}
+	g_io_channel_read_chars (connection->io_channel,
+				 buf, IN_BUFFER_SIZE - 1,
+				 &bytes_read,
+				 NULL);
+	buf[bytes_read] = '\0';
+	g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, "\nRECV:\n");
+	g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, 
+	       "-----------------------------------\n");
+	g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, "%s\n", buf);
+	g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, 
+	       "-----------------------------------\n");
+	
+	lm_parser_parse (connection->parser, buf);
+	
+	return TRUE;
+}
+
+static gboolean
+connection_error_event (GIOChannel   *source,
+			GIOCondition  condition,
+			LmConnection *connection)
+{
+	lm_verbose ("Error event: %d\n", condition);
+	
+	connection_do_close (connection);
+	connection_signal_disconnect (connection, LM_DISCONNECT_REASON_ERROR);
+	
+	return TRUE;
+}
+
+static gboolean
+connection_hup_event (GIOChannel   *source,
+		      GIOCondition  condition,
+		      LmConnection *connection)
+{
+	lm_verbose ("HUP event\n");
+
+	connection_do_close (connection);
+	connection_signal_disconnect (connection, LM_DISCONNECT_REASON_HUP);
+	
+	return TRUE;
+}
+
+static gboolean
+connection_send (LmConnection  *connection, 
+		 const gchar   *str, 
+		 gint           len, 
+		 GError       **error)
+{
+	gsize             bytes_written;
+	
+	if (!lm_connection_is_open (connection)) {
+		g_set_error (error,
+			     LM_ERROR,
+			     LM_ERROR_CONNECTION_NOT_OPEN,
+			     "Connection is not open, call lm_connection_open() first");
+		return FALSE;
+	}
+
+	if (len == -1) {
+		len = strlen (str);
+	}
+
+	g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, "\nSEND:\n");
+	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, 
+	       "-----------------------------------\n");
+	
+	g_io_channel_write_chars (connection->io_channel, str, len, 
+				  &bytes_written, NULL);
+
+	return TRUE;
+}
+
+static LmHandlerResult 
+connection_auth_reply (LmMessageHandler *handler,
+		       LmConnection     *connection,
+		       LmMessage        *m,
+		       gpointer          user_data)
+{
+	const gchar *type;
+	gboolean     result = TRUE;
+	
+	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;
+	} 
+	else if (strcmp (type, "error") == 0) {
+		result = FALSE;
+	}
+	
+	lm_verbose ("AUTH reply: %d\n", result);
+	
+	if (connection->auth_cb && connection->auth_cb->func) {
+		LmCallback *cb = connection->auth_cb;
+
+		(* ((LmResultFunction) cb->func)) (connection, 
+						   result, cb->user_data);
+	}
+	
+	_lm_utils_free_callback (connection->auth_cb);
+	connection->auth_cb = NULL;
+	
+	return LM_HANDLER_RESULT_REMOVE_MESSAGE;
+}
+
+
+static void
+connection_stream_received (LmConnection *connection, LmMessage *m)
+{
+	gboolean result;
+	
+	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"));;
+	
+	lm_verbose ("Stream received: %s\n", connection->stream_id);
+	
+	/* Check to see if the stream is correctly set up */
+	result = TRUE;
+
+	if (connection->open_cb && connection->open_cb->func) {
+		LmCallback *cb = connection->open_cb;
+		
+		(* ((LmResultFunction) cb->func)) (connection, result,
+						   cb->user_data);
+	}
+	
+	_lm_utils_free_callback (connection->open_cb);
+	connection->open_cb = NULL;
+}
+
+static gint
+connection_handler_compare_func (HandlerData *a, HandlerData *b)
+{
+	return b->priority - a->priority;
+}
+
+static gboolean 
+connection_incoming_prepare (GSource *source, gint *timeout)
+{
+	LmConnection *connection;
+	
+	connection = ((LmIncomingSource *)source)->connection;
+	
+	return !g_queue_is_empty (connection->incoming_messages);
+}
+
+static gboolean
+connection_incoming_check (GSource *source)
+{
+	return FALSE;
+}
+
+static gboolean
+connection_incoming_dispatch (GSource *source, 
+			      GSourceFunc callback, 
+			      gpointer user_data)
+{
+	LmConnection *connection;
+	LmMessage    *m;
+	
+	connection = ((LmIncomingSource *) source)->connection;
+
+	m = (LmMessage *) g_queue_pop_head (connection->incoming_messages);
+	
+	if (m) {
+		connection_handle_message (connection, m);
+		lm_message_unref (m);
+	}
+
+	return TRUE;
+}
+
+static GSource *
+connection_create_source (LmConnection *connection)
+{
+	GSource *source;
+	
+	source = g_source_new (&incoming_funcs, sizeof (LmIncomingSource));
+	((LmIncomingSource *) source)->connection = connection;
+	
+	return source;
+}
+
+static void
+connection_signal_disconnect (LmConnection       *connection,
+			      LmDisconnectReason  reason)
+{
+	if (connection->disconnect_cb && connection->disconnect_cb->func) {
+		LmCallback *cb = connection->disconnect_cb;
+		
+		(* ((LmDisconnectFunction) cb->func)) (connection,
+						       reason,
+						       cb->user_data);
+	}
+}
+
+/**
+ * lm_connection_new:
+ * @server: The hostname to the server for the connection.
+ * 
+ * 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 *
+lm_connection_new (const gchar *server)
+{
+	LmConnection *connection;
+	gint          i;
+	
+	lm_debug_init ();
+	
+	connection = g_new0 (LmConnection, 1);
+
+	if (server) {
+		connection->server = g_strdup (server);
+	} else {
+		connection->server = NULL;
+	}
+	
+	connection->port              = LM_CONNECTION_DEFAULT_PORT;
+	connection->use_ssl           = FALSE;
+	connection->disconnect_cb     = NULL;
+	connection->incoming_messages = g_queue_new ();
+	connection->incoming_source   = connection_create_source (connection);
+	
+	connection->id_handlers = g_hash_table_new_full (g_str_hash, 
+							 g_str_equal,
+							 g_free, 
+							 (GDestroyNotify) lm_message_handler_unref);
+	connection->ref_count         = 1;
+	g_source_attach (connection->incoming_source, NULL);
+	
+	for (i = 0; i < LM_MESSAGE_TYPE_UNKNOWN; ++i) {
+		connection->handlers[i] = NULL;
+	}
+
+	connection->parser = lm_parser_new 
+		((LmParserMessageFunction) connection_new_message_cb, 
+		 connection, NULL);
+
+	return connection;
+}
+
+/**
+ * lm_connection_open:
+ * @connection: #LmConnection to open
+ * @function: Callback function that will be called when the connection is open.
+ * @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, 
+		    LmResultFunction   function,
+		    gpointer           user_data,
+		    GDestroyNotify     notify,
+		    GError           **error)
+{
+	LmMessage *m;
+	gboolean   result;
+	
+	g_return_val_if_fail (connection != NULL, FALSE);
+	
+	if (lm_connection_is_open (connection)) {
+		g_set_error (error,
+			     LM_ERROR,
+			     LM_ERROR_CONNECTION_NOT_OPEN,
+			     "Connection is already open, call lm_connection_close() first");
+		return FALSE;
+	}
+
+	if (!connection->server) {
+		g_set_error (error,
+			     LM_ERROR,
+			     LM_ERROR_CONNECTION_OPEN,
+			     "You need to set the server hostname in the call to lm_connection_new()");
+		return FALSE;
+	}
+
+	connection->open_cb = _lm_utils_new_callback (function, user_data, notify);
+	
+	lm_verbose ("Connecting to: %s:%d\n", 
+		    connection->server, connection->port);
+	
+	if (!connection_do_open (connection, error)) {
+		return FALSE;
+	}
+	
+	m = lm_message_new (connection->server, LM_MESSAGE_TYPE_STREAM);
+	lm_message_node_set_attributes (m->node,
+					"xmlns:stream", "http://etherx.jabber.org/streams",
+					"xmlns", "jabber:client",
+					NULL);
+	
+	lm_verbose ("Opening stream...");
+	
+	result = lm_connection_send (connection, m, error);
+	lm_message_unref (m);
+	
+	return result;
+}
+
+/**
+ * lm_connection_open_and_block:
+ * @connection: an #LmConnection
+ * @error: location to store error, or %NULL
+ * 
+ * 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)
+{
+	LmMessage *m;
+	gboolean   result;
+	gboolean   finished = FALSE;
+	gboolean   ret_val = FALSE;
+	gint       last_len = 0;
+
+	g_return_val_if_fail (connection != NULL, FALSE);
+	
+	if (lm_connection_is_open (connection)) {
+		g_set_error (error,
+			     LM_ERROR,
+			     LM_ERROR_CONNECTION_NOT_OPEN,
+			     "Connection is already open, call lm_connection_close() first");
+		return FALSE;
+	}
+	if (!connection->server) {
+		g_set_error (error,
+			     LM_ERROR,
+			     LM_ERROR_CONNECTION_OPEN,
+			     "You need to set the server hostname in the call to lm_connection_new()");
+		return FALSE;
+	}
+
+	lm_verbose ("(Block)Connecting to: %s:%d\n", 
+		    connection->server, connection->port);
+	
+	if (!connection_do_open (connection, error)) {
+		return FALSE;
+	}
+	
+	m = lm_message_new (connection->server, LM_MESSAGE_TYPE_STREAM);
+	lm_message_node_set_attributes (m->node,
+					"xmlns:stream", "http://etherx.jabber.org/streams",
+					"xmlns", "jabber:client",
+					NULL);
+	
+	lm_verbose ("Sending stream: \n%s\n", 
+		    lm_message_node_to_string (m->node));
+	
+	result = lm_connection_send (connection, m, error);
+	lm_message_unref (m);
+
+ 	g_source_remove (g_source_get_id (connection->incoming_source));
+	g_source_unref (connection->incoming_source);
+
+	while (!finished) {
+		gint len;
+		
+		g_main_context_iteration (NULL, TRUE);
+		
+		len = connection->incoming_messages->length;
+		
+		if (len > last_len) {
+			LmMessage *m;
+			
+			last_len = len;
+			m = (LmMessage *) g_queue_peek_tail (connection->incoming_messages);
+			if (lm_message_get_type (m) == LM_MESSAGE_TYPE_STREAM) {
+				connection->stream_id = 
+					g_strdup (lm_message_node_get_attribute (m->node, "id"));
+				ret_val = TRUE;
+				finished = TRUE;
+				g_queue_pop_tail (connection->incoming_messages);
+			}
+		}
+	}
+	
+	connection->incoming_source = connection_create_source (connection);
+	g_source_attach (connection->incoming_source, NULL);
+
+	return ret_val;
+}
+
+/**
+ * lm_connection_close:
+ * @connection: #LmConnection to close 
+ * @error: location to store error, or %NULL
+ * 
+ * A synchronos 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)
+{
+	g_return_val_if_fail (connection != NULL, FALSE);
+	
+	if (!lm_connection_is_open (connection)) {
+		g_set_error (error,
+			     LM_ERROR,
+			     LM_ERROR_CONNECTION_NOT_OPEN,
+			     "Connection is not open, call lm_connection_open() first");
+		return FALSE;
+	}
+	
+	lm_verbose ("Disconnecting from: %s:%d\n", 
+		    connection->server,
+		    connection->port);
+	
+	if (!connection_send (connection, "</stream:stream>", -1, error)) {
+		return FALSE;
+	}
+	
+ 	g_io_channel_flush (connection->io_channel, NULL);
+	
+	connection_do_close (connection);
+	connection_signal_disconnect (connection, LM_DISCONNECT_REASON_OK);
+	
+	return TRUE;
+}
+
+/**
+ * lm_connection_authenticate:
+ * @connection: #LmConnection to authenticate.
+ * @username: Username used to authenticate.
+ * @password: Password corresponding to @username.
+ * @resource: Resource used for this connection.
+ * @function: Callback called when authentication is finished.
+ * @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 will tell if it succeeded or not. 
+ * 
+ * Return value: #TRUE if no errors where detected while sending the authentication message, #FALSE otherwise.
+ **/
+gboolean
+lm_connection_authenticate (LmConnection      *connection,
+			    const gchar       *username,
+			    const gchar       *password,
+			    const gchar       *resource,
+			    LmResultFunction   function,
+			    gpointer           user_data,
+			    GDestroyNotify     notify,
+			    GError           **error)
+{
+	LmMessage        *m;
+	LmMessageNode    *q_node;
+	LmMessageHandler *handler;
+	gboolean          result;
+	
+	g_return_val_if_fail (connection != NULL, FALSE);
+	g_return_val_if_fail (username != NULL, FALSE);
+	g_return_val_if_fail (password != NULL, FALSE);
+	g_return_val_if_fail (resource != NULL, FALSE);
+
+	if (!lm_connection_is_open (connection)) {
+		g_set_error (error,
+			     LM_ERROR,
+			     LM_ERROR_CONNECTION_NOT_OPEN,
+			     "Connection is not open, call lm_connection_open() first");
+		return FALSE;
+	}
+	
+	connection->auth_cb = _lm_utils_new_callback (function, 
+						      user_data, 
+						      notify);
+	
+	m = lm_message_new_with_sub_type (NULL, LM_MESSAGE_TYPE_IQ,
+					  LM_MESSAGE_SUB_TYPE_SET);
+	q_node = lm_message_node_add_child (m->node, "query", NULL);
+	lm_message_node_set_attributes (q_node,
+					"xmlns", "jabber:iq:auth", 
+					NULL);
+	lm_message_node_add_child (q_node, "username", username);
+
+	/* Check what the server can handle */
+	if (TRUE) {
+		gchar       *str;
+		const gchar *digest;
+		str = g_strconcat (connection->stream_id, password, NULL);
+		digest = lm_sha_hash (str);
+		g_free (str);
+		lm_message_node_add_child (q_node, "digest", digest);
+	} else {
+		lm_message_node_add_child (q_node, "password", password);
+	}
+
+	lm_message_node_add_child (q_node, "resource", resource);
+	handler = lm_message_handler_new (connection_auth_reply, NULL, NULL);
+
+	result = lm_connection_send_with_reply (connection, m, handler, error);
+	
+	lm_message_handler_unref (handler);
+	lm_message_unref (m);
+
+	return result;
+}
+
+/**
+ * lm_connection_authenticate_and_block:
+ * @connection: an #LmConnection
+ * @username: Username used to authenticate.
+ * @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
+lm_connection_authenticate_and_block (LmConnection  *connection,
+				      const gchar   *username,
+				      const gchar   *password,
+				      const gchar   *resource,
+				      GError       **error)
+{
+	LmMessage     *m;
+	LmMessageNode *q_node;
+	LmMessage     *result;
+		
+	g_return_val_if_fail (connection != NULL, FALSE);
+	g_return_val_if_fail (username != NULL, FALSE);
+	g_return_val_if_fail (password != NULL, FALSE);
+	g_return_val_if_fail (resource != NULL, FALSE);
+
+	if (!lm_connection_is_open (connection)) {
+		g_set_error (error,
+			     LM_ERROR,
+			     LM_ERROR_CONNECTION_NOT_OPEN,
+			     "Connection is not open, call lm_connection_open() first");
+		return FALSE;
+	}
+	
+	m = lm_message_new_with_sub_type (NULL, LM_MESSAGE_TYPE_IQ,
+					  LM_MESSAGE_SUB_TYPE_SET);
+	q_node = lm_message_node_add_child (m->node, "query", NULL);
+	lm_message_node_set_attributes (q_node,
+					"xmlns", "jabber:iq:auth", 
+					NULL);
+	lm_message_node_add_child (q_node, "username", username);
+
+	/* Check what the server can handle */
+	if (TRUE) {
+		gchar       *str;
+		const gchar *digest;
+		str = g_strconcat (connection->stream_id, password, NULL);
+		digest = lm_sha_hash (str);
+		g_free (str);
+		lm_message_node_add_child (q_node, "digest", digest);
+	} else {
+		lm_message_node_add_child (q_node, "password", password);
+	}
+
+	lm_message_node_add_child (q_node, "resource", resource);
+
+	result = lm_connection_send_with_reply_and_block (connection, m, error);
+	lm_message_unref (m);
+
+	if (!result) {
+		return FALSE;
+	}
+	
+	switch (lm_message_get_sub_type (result)) {
+	case LM_MESSAGE_SUB_TYPE_RESULT:
+		return TRUE;
+		break;
+	case LM_MESSAGE_SUB_TYPE_ERROR:
+		return FALSE;
+		break;
+	default:
+		g_assert_not_reached ();
+		break;
+	} 
+
+	return FALSE;
+}
+
+/**
+ * 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)
+{
+	return connection->is_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 
+lm_connection_is_authenticated (LmConnection *connection)
+{
+	return connection->is_authenticated;
+}
+
+/**
+ * lm_connection_get_server:
+ * @connection: an #LmConnection
+ * 
+ * Fetches the server address that @connection is using.
+ * 
+ * Return value: the server address
+ **/
+const gchar *
+lm_connection_get_server (LmConnection *connection)
+{
+	return connection->server;
+}
+
+/**
+ * lm_connection_set_server:
+ * @connection: an #LmConnection
+ * @server: Address of the server
+ * 
+ * Sets the server address to @connection. Notice that @connection can't be open while doing this.
+ **/
+void
+lm_connection_set_server (LmConnection *connection, const gchar *server)
+{
+	if (lm_connection_is_open (connection)) {
+		g_warning ("Can't change server address while connected");
+		return;
+	}
+	
+	if (connection->server) {
+		g_free (connection->server);
+	}
+	
+	connection->server = g_strdup (server);
+}
+
+/**
+ * lm_connection_get_port:
+ * @connection: an #LmConnection
+ * 
+ * Fetches the port tnat @connection is using.
+ * 
+ * Return value: 
+ **/
+guint
+lm_connection_get_port (LmConnection *connection)
+{
+	return connection->port;
+}
+
+/**
+ * lm_connection_set_port:
+ * @connection: an #LmConnection
+ * @port: server port
+ * 
+ * Sets the server port of that @connection will be using.
+ **/
+void
+lm_connection_set_port (LmConnection *connection, guint port)
+{
+	if (lm_connection_is_open (connection)) {
+		g_warning ("Can't change server port while connected");
+		return;
+	}
+	
+	connection->port = port;
+}
+
+/**
+ * lm_connection_get_use_ssl:
+ * @connection: an #LmConnection
+ * 
+ * Fetches if @connection is using SSL or not
+ * 
+ * Return value: #TRUE if @connection is using SSL, #FALSE otherwise.
+ **/
+gboolean
+lm_connection_get_use_ssl (LmConnection *connection)
+{
+	return connection->use_ssl;
+}
+
+/**
+ * lm_connection_set_use_ssl:
+ * @connection: an #LmConnection
+ * @use_ssl: whether to use SSL or not.
+ * 
+ * Sets whether @connection should use SSL for encryping traffic to/from the server.
+ **/
+void
+lm_connection_set_use_ssl (LmConnection *connection, gboolean use_ssl)
+{
+	if (lm_connection_is_open (connection)) {
+		g_warning ("use_ssl can't be changed while connected");
+		return;
+	}
+
+	connection->use_ssl = use_ssl;
+}
+
+/**
+ * lm_connection_send: 
+ * @connection: #LmConnection to send connection 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, 
+		    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);
+	
+	xml_str = lm_message_node_to_string (message->node);
+	if ((ch = strstr (xml_str, "</stream:stream>"))) {
+		*ch = '\0';
+	}
+	
+	result = connection_send (connection, xml_str, -1, error);
+	g_free (xml_str);
+
+	return result;
+}
+
+/**
+ * lm_connection_send_with_reply:
+ * @connection: #LmConnection used to send message.
+ * @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. 
+ * 
+ * Return value: 
+ **/
+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"));
+	} else {
+		id = _lm_utils_generate_id ();
+		lm_message_node_set_attributes (message->node, "id", id, NULL);
+	}
+	
+	g_hash_table_insert (connection->id_handlers, 
+			     id, lm_message_handler_ref (handler));
+	
+	return lm_connection_send (connection, message, error);
+}
+
+/**
+ * lm_connection_send_with_reply_and_block:
+ * @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 *
+lm_connection_send_with_reply_and_block (LmConnection  *connection,
+					 LmMessage     *message,
+					 GError       **error)
+{
+	gchar     *id;
+	LmMessage *reply = NULL;
+	gint       last_len = 0;
+
+	if (lm_message_node_get_attribute (message->node, "id")) {
+		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_source_remove (g_source_get_id (connection->incoming_source));
+	g_source_unref (connection->incoming_source);
+
+	lm_connection_send (connection, message, error);
+
+	while (!reply) {
+		gint         len;
+		const gchar *m_id;
+		
+		g_main_context_iteration (NULL, TRUE);
+		
+		len = connection->incoming_messages->length;
+		
+		if (len > last_len) {
+			LmMessage *m;
+			last_len = len;
+			m = (LmMessage *) g_queue_peek_tail (connection->incoming_messages);
+			m_id = lm_message_node_get_attribute (m->node, "id");
+			
+			if (m_id && strcmp (m_id, id) == 0) {
+				reply = m;
+			}
+
+			g_queue_pop_tail (connection->incoming_messages);
+		}
+	}
+
+	g_free (id);
+	connection->incoming_source = connection_create_source (connection);
+	g_source_attach (connection->incoming_source, NULL);
+
+	return reply;
+}
+
+/**
+ * lm_connection_register_message_handler:
+ * @connection: Connection to register a handler for.
+ * @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().
+ **/
+void
+lm_connection_register_message_handler  (LmConnection       *connection,
+					 LmMessageHandler   *handler,
+					 LmMessageType       type,
+					 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);
+
+	hd = g_new0 (HandlerData, 1);
+	hd->priority = priority;
+	hd->handler  = lm_message_handler_ref (handler);
+
+	connection->handlers[type] = g_slist_insert_sorted (connection->handlers[type],
+							    hd, 
+							    (GCompareFunc) connection_handler_compare_func);
+}
+
+/**
+ * lm_connection_unregister_message_handler:
+ * @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 
+ * when incoming messages of @type arrive.
+ **/
+void
+lm_connection_unregister_message_handler (LmConnection      *connection,
+					  LmMessageHandler  *handler,
+					  LmMessageType      type)
+{
+	GSList *l, *prev = NULL;
+	
+	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 (hd->handler == handler) {
+			if (prev) {
+				prev->next = l->next;
+			} else {
+				connection->handlers[type] = l->next;
+			}
+			l->next = NULL;
+			g_slist_free (l);
+			lm_message_handler_unref (hd->handler);
+			g_free (hd);
+			break;
+		}
+		prev = l;
+	}
+}
+
+/**
+ * lm_connection_set_disconnect_function:
+ * @connection: Connection to register disconnect callback for.
+ * @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. 
+ **/
+void
+lm_connection_set_disconnect_function (LmConnection         *connection,
+				       LmDisconnectFunction  function,
+				       gpointer              user_data,
+				       GDestroyNotify        notify)
+{
+	if (connection->disconnect_cb) {
+		_lm_utils_free_callback (connection->disconnect_cb);
+	}
+		
+	connection->disconnect_cb = _lm_utils_new_callback (function, 
+							    user_data,
+							    notify);
+}
+
+/**
+ * lm_connection_send_raw:
+ * @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, 
+ * #FALSE otherwise.
+ **/
+gboolean 
+lm_connection_send_raw (LmConnection  *connection, 
+			const gchar   *str, 
+			GError       **error)
+{
+	g_return_val_if_fail (connection != NULL, FALSE);
+
+	return connection_send (connection, str, -1, error);
+}
+
+/**
+ * lm_connection_ref:
+ * @connection: Connection to add a reference to.
+ * 
+ * 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 fried and shouldn't be used again.
+ **/
+void
+lm_connection_unref (LmConnection *connection)
+{
+	g_return_if_fail (connection != NULL);
+	
+	connection->ref_count--;
+	
+	if (connection->ref_count == 0) {
+		connection_free (connection);
+	}
+}
+
+#if 0
+void
+lm_connection_register (LmConnection           *connection,
+		    const gchar        *username,
+		    const gchar        *password,
+		    const gchar        *resource,
+		    LmRegisterCallback  callback,
+		    gpointer            user_data)
+{
+	LmElement    *element;
+	LmNode       *q_node;
+	gchar        *id;
+	static gint   register_id = 0;
+	
+	g_return_if_fail (connection != NULL);
+	g_return_if_fail (lm_connection_is_open (connection));
+	
+	/* Use lm:iq:register name space */
+
+	element = lm_iq_new (LM_IQ_TYPE_SET);
+	
+	q_node = lm_node_new ("query");
+	lm_node_set_attribute (q_node, "xmlns", JABBER_IQ_REGISTER);
+	lm_node_add_child (q_node, "username", username);
+	lm_node_add_child (q_node, "password", password);
+	lm_node_add_child (q_node, "resource", resource);
+
+	lm_element_add_child_node (element, q_node);
+	
+	id = g_strdup_printf ("register_%d", ++register_id);
+	lm_element_set_id (element, id);
+	
+	lm_connection_send (connection, element, NULL);
+	connection_add_callback (connection, id, callback, user_data);
+	lm_element_unref (element);
+
+	g_free (id);
+
+	
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-connection.h	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,140 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_CONNECTION_H__
+#define __LM_CONNECTION_H__
+
+#if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
+#error "Only <loudmouth/loudmouth.h> can be included directly, this file may di\sappear or change contents."
+#endif
+
+#include <loudmouth/lm-message.h>
+
+#define LM_CONNECTION(o) (LmConnection *) o;
+
+#define LM_CONNECTION_DEFAULT_PORT     5222
+#define LM_CONNECTION_DEFAULT_PORT_SSL 5223
+
+typedef struct _LmConnection LmConnection;
+
+typedef struct LmMessageHandler LmMessageHandler;
+
+typedef enum {
+	LM_HANDLER_RESULT_REMOVE_MESSAGE,
+	LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS
+} LmHandlerResult;
+ 
+typedef enum {
+	LM_HANDLER_PRIORITY_LAST   = 1,
+	LM_HANDLER_PRIORITY_NORMAL = 2,
+	LM_HANDLER_PRIORITY_FIRST  = 3
+} LmHandlerPriority;
+
+typedef enum {
+	LM_DISCONNECT_REASON_OK,
+	LM_DISCONNECT_REASON_PING_TIME_OUT,
+	LM_DISCONNECT_REASON_HUP,
+	LM_DISCONNECT_REASON_ERROR,
+	LM_DISCONNECT_REASON_UNKNOWN
+} LmDisconnectReason;
+
+typedef void (* LmResultFunction)     (LmConnection *connection,
+				       gboolean      success,
+				       gpointer      user_data);
+
+typedef void (* LmDisconnectFunction) (LmConnection *connection,
+				       LmDisconnectReason reason,
+				       gpointer           user_data);
+
+
+LmConnection *lm_connection_new               (const gchar        *server);
+gboolean      lm_connection_open              (LmConnection       *connection,
+					       LmResultFunction    function,
+					       gpointer            user_data,
+					       GDestroyNotify      notify,
+					       GError            **error);
+gboolean      lm_connection_open_and_block    (LmConnection       *connection,
+					       GError            **error);
+
+gboolean      lm_connection_close             (LmConnection       *connection,
+					       GError            **error);
+gboolean      lm_connection_authenticate      (LmConnection       *connection,
+					       const gchar        *username,
+					       const gchar        *password,
+					       const gchar        *resource,
+					       LmResultFunction    function,
+					       gpointer            user_data,
+					       GDestroyNotify      notify,
+					       GError            **error);
+gboolean
+lm_connection_authenticate_and_block          (LmConnection       *connection,
+					       const gchar        *username,
+					       const gchar        *password,
+					       const gchar        *resource,
+					       GError            **error);
+gboolean      lm_connection_is_open           (LmConnection       *connection);
+gboolean      lm_connection_is_authenticated  (LmConnection       *connection);
+
+const gchar * lm_connection_get_server        (LmConnection       *connection);
+void          lm_connection_set_server        (LmConnection       *connection,
+					       const gchar        *server);
+
+guint         lm_connection_get_port          (LmConnection       *connection);
+void          lm_connection_set_port          (LmConnection       *connection,
+					       guint               port);
+gboolean      lm_connection_get_use_ssl       (LmConnection       *connection);
+void          lm_connection_set_use_ssl       (LmConnection       *connection,
+					       gboolean            use_ssl);
+					       
+gboolean      lm_connection_send              (LmConnection       *connection,
+					       LmMessage          *message,
+					       GError            **error);
+gboolean      lm_connection_send_with_reply   (LmConnection       *connection,
+					       LmMessage          *message,
+					       LmMessageHandler   *handler,
+					       GError            **error);
+LmMessage *   
+lm_connection_send_with_reply_and_block       (LmConnection       *connection,
+					       LmMessage          *message,
+					       GError            **error);
+void
+lm_connection_register_message_handler        (LmConnection       *connection,
+					       LmMessageHandler   *handler,
+					       LmMessageType       type,
+					       LmHandlerPriority   priority);
+void
+lm_connection_unregister_message_handler      (LmConnection       *connection,
+					       LmMessageHandler   *handler,
+					       LmMessageType       type);
+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);
+LmConnection* lm_connection_ref               (LmConnection       *connection);
+void          lm_connection_unref             (LmConnection       *connection);
+
+
+#endif /* __LM_CONNECTION_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-debug.c	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,77 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "lm-debug.h"
+
+#ifndef LM_NO_DEBUG
+
+static LmLogLevelFlags debug_flags = 0;
+static gboolean initialized = FALSE;
+
+static const GDebugKey debug_keys[] = {
+	{"VERBOSE",      LM_LOG_LEVEL_VERBOSE},
+	{"NET",          LM_LOG_LEVEL_NET},
+	{"PARSER",       LM_LOG_LEVEL_PARSER},
+	{"ALL",          LM_LOG_LEVEL_ALL}
+};
+
+#define NUM_DEBUG_KEYS (sizeof (debug_keys) / sizeof (GDebugKey))
+
+static void
+debug_log_handler (const gchar    *log_domain,
+		   GLogLevelFlags  log_level,
+		   const gchar    *message,
+		   gpointer        user_data)
+{
+	if (debug_flags & log_level) {
+		if (log_level & LM_LOG_LEVEL_VERBOSE) {
+			g_print ("*** ");
+		}
+		else if (log_level & LM_LOG_LEVEL_PARSER) {
+			g_print ("LM-PARSER: ");
+		}
+	
+		g_print ("%s", message);
+	}
+}
+
+void 
+lm_debug_init (void)
+{
+	const gchar *env_lm_debug;
+
+	if (initialized) {
+		return;
+	}
+	
+	env_lm_debug = g_getenv ("LM_DEBUG");
+	if (env_lm_debug) {
+		debug_flags = g_parse_debug_string (env_lm_debug, debug_keys,
+						    NUM_DEBUG_KEYS);
+	}
+
+	g_log_set_handler (LM_LOG_DOMAIN, LM_LOG_LEVEL_ALL, 
+			   debug_log_handler, NULL);
+
+	initialized = TRUE;
+}
+#endif /* LM_NO_DEBUG */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-debug.h	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,76 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_DEBUG_H__
+#define __LM_DEBUG_H__
+
+#include <glib.h>
+
+typedef enum {
+	LM_LOG_LEVEL_VERBOSE = 1 << (G_LOG_LEVEL_USER_SHIFT),
+	LM_LOG_LEVEL_NET     = 1 << (G_LOG_LEVEL_USER_SHIFT + 1),
+	LM_LOG_LEVEL_PARSER  = 1 << (G_LOG_LEVEL_USER_SHIFT + 2),
+	LM_LOG_LEVEL_ALL     = (LM_LOG_LEVEL_NET |
+				LM_LOG_LEVEL_VERBOSE |
+				LM_LOG_LEVEL_PARSER)
+} LmLogLevelFlags;
+
+#ifndef LL_LOG_DOMAIN
+#  define LM_LOG_DOMAIN "LM"
+#endif
+
+#ifdef G_HAVE_ISO_VARARGS
+#  ifdef LM_NO_DEBUG
+#    define lm_verbose(...)
+#  else
+#    define lm_verbose(...) \
+       g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE, __VA_ARGS__)
+#  endif
+#elif defined(G_HAVE_GNUC_VARARGS)
+#  if LM_NO_DEBUG
+#    define lm_verbose(fmt...)
+#  else
+#    define lm_verbose(fmt...) \
+       g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE, fmt)
+#  endif
+#else
+#  if LM_NO_DEBUG
+#    define lm_verbose(const gchar *format, ...) {};
+#  else
+static void
+lm_verbose (const gchar *format, ...)
+{
+  va_list args;
+  va_start (args, format);
+  g_logv (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE, format, args);
+  va_end (args);
+}
+#  endif
+#endif
+
+#if LM_NO_DEBUG
+#  define lm_debug_init() {};
+#else
+void lm_debug_init (void);
+#endif
+
+#endif /* __LM_DEBUG_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-error.c	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <glib/gerror.h>
+#include "lm-error.h"
+
+GQuark
+lm_error_quark (void)
+{
+	static GQuark q = 0;
+
+	if (q == 0) {
+		q = g_quark_from_static_string ("lm-error-quark");
+	}
+	
+	return q;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-error.h	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,41 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_ERROR_H__
+#define __LM_ERROR_H__
+
+#if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
+#error "Only <loudmouth/loudmouth.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#include <glib.h>
+
+#define LM_ERROR lm_error_quark ()
+
+typedef enum {
+        LM_ERROR_CONNECTION_NOT_OPEN,
+        LM_ERROR_CONNECTION_OPEN,
+        LM_ERROR_AUTH_FAILED
+} LmError;
+
+GQuark lm_error_quark (void) G_GNUC_CONST;
+
+#endif /* __LM_ERROR_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-internals.h	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,55 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* Private functions that are internal to the library */
+
+#ifndef __LM_INTERNALS_H__
+#define __LM_INTERNALS_H__
+
+#include "lm-message.h"
+#include "lm-message-handler.h"
+#include "lm-message-node.h"
+
+typedef struct {
+	gpointer       func;
+	gpointer       user_data;
+	GDestroyNotify notify;
+} LmCallback;
+
+LmCallback *_lm_utils_new_callback (gpointer func, 
+				    gpointer user_data,
+				    GDestroyNotify notify);
+void _lm_utils_free_callback (LmCallback *cb);
+
+gchar *            _lm_utils_generate_id             (void);
+LmHandlerResult _lm_message_handler_handle_message   (LmMessageHandler *handler,
+						      LmConnection     *connection,
+						      LmMessage        *messag);
+
+const gchar *      _lm_message_type_to_string         (LmMessageType     type);
+const gchar *      _lm_message_sub_type_to_string     (LmMessageSubType  type);
+LmMessage *        _lm_message_new_from_node          (LmMessageNode    *node);
+void               _lm_message_node_add_child_node    (LmMessageNode    *node,
+						       LmMessageNode    *child);
+LmMessageNode *    _lm_message_node_new               (const gchar  *name);
+void               _lm_debug_init                     (void);
+
+#endif /* __LM_INTERNALS_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-message-handler.c	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,122 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "lm-internals.h"
+#include "lm-message-handler.h"
+
+struct LmMessageHandler {
+        gint                    ref_count;
+        LmHandleMessageFunction function;
+        gpointer                user_data;
+        GDestroyNotify          notify;
+};
+
+LmHandlerResult 
+_lm_message_handler_handle_message (LmMessageHandler *handler,
+                                    LmConnection     *connection,
+                                    LmMessage        *message)
+{
+        g_return_val_if_fail (handler != NULL, 
+                          LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS);
+        
+        if (handler->function) {
+                return (* handler->function) (handler, connection, 
+                                              message, handler->user_data);
+        }
+        
+        return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+}
+
+/**
+ * lm_message_handler_new:
+ * @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 *
+lm_message_handler_new (LmHandleMessageFunction function,
+                        gpointer                user_data,
+                        GDestroyNotify          notify)
+{
+        LmMessageHandler *handler;
+        
+        handler = g_new0 (LmMessageHandler, 1);
+        
+        if (handler == NULL) {
+                return NULL;
+        }
+        
+        handler->ref_count = 1;
+        handler->function  = function;
+        handler->user_data = user_data;
+        handler->notify    = notify;
+        
+        return handler;
+}
+
+/**
+ * lm_message_handler_ref:
+ * @handler: an #LmMessageHandler
+ * 
+ * Adds a reference to @node.
+ * 
+ * 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;
+}
+
+/**
+ * lm_message_handler_unref:
+ * @handler: an #LmMessagHandler
+ * 
+ * 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);
+                }
+                g_free (handler);
+        }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-message-handler.h	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,44 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_MESSAGE_HANDLER_H__
+#define __LM_MESSAGE_HANDLER_H__
+
+#if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
+#error "Only <loudmouth/loudmouth.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#include <loudmouth/lm-connection.h>
+
+typedef LmHandlerResult (* LmHandleMessageFunction) (LmMessageHandler *handler,
+						     LmConnection     *connection,
+						     LmMessage        *message,
+						     gpointer          user_data);
+
+LmMessageHandler *lm_message_handler_new   (LmHandleMessageFunction  function,
+					    gpointer                 user_data,
+					    GDestroyNotify           notify);
+LmMessageHandler *lm_message_handler_ref   (LmMessageHandler        *handler);
+void              lm_message_handler_unref (LmMessageHandler        *handler);
+
+
+#endif /* __LM_MESSAGE_HANDLER_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-message-node.c	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,451 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <string.h>
+
+#include "lm-internals.h"
+#include "lm-message-node.h"
+
+typedef struct {
+        gchar *key;
+        gchar *value;
+} KeyValuePair;
+
+static void            message_node_free            (LmMessageNode    *node);
+static LmMessageNode * message_node_last_child      (LmMessageNode    *node);
+
+static void
+message_node_free (LmMessageNode *node)
+{
+        LmMessageNode *l;
+        GSList        *list;
+        
+        g_return_if_fail (node != NULL);
+
+	for (l = node->children; l;) {
+		LmMessageNode *next = l->next;
+
+		lm_message_node_unref (l);
+		l = next;
+        }
+
+        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);
+}
+
+static LmMessageNode *
+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) {
+                l = l->next;
+        }
+
+        return l;
+}
+
+LmMessageNode *
+_lm_message_node_new (const gchar *name)
+{
+        LmMessageNode *node;
+
+        node = g_new0 (LmMessageNode, 1);
+        
+        node->name       = g_ascii_strdown (name, -1);
+        node->value      = NULL;
+        node->attributes = NULL;
+        node->next       = NULL;
+        node->prev       = NULL;
+        node->parent     = NULL;
+        node->children   = NULL;
+
+	node->ref_count  = 1;
+
+        return node;
+}
+void
+_lm_message_node_add_child_node (LmMessageNode *node, LmMessageNode *child)
+{
+        LmMessageNode *prev;
+	
+        g_return_if_fail (node != NULL);
+
+        prev = message_node_last_child (node);
+	lm_message_node_ref (child);
+
+        if (prev) {
+                prev->next    = child;
+                child->prev   = prev;
+        } else {
+                node->children = child;
+        }
+        
+        child->parent = node;
+}
+
+/**
+ * lm_message_node_get_value:
+ * @node: an #LmMessageNode
+ * 
+ * Retrieves the value of @node.
+ * 
+ * Return value: 
+ **/
+const gchar *
+lm_message_node_get_value (LmMessageNode *node)
+{
+	g_return_val_if_fail (node != NULL, NULL);
+	
+	return node->value;
+}
+
+/**
+ * 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;
+        }
+
+        node->value = g_strdup (value);
+}
+
+/**
+ * lm_message_node_add_child:
+ * @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. 
+ * 
+ * Return value: the newly created child
+ **/
+LmMessageNode *
+lm_message_node_add_child (LmMessageNode *node, 
+			   const gchar   *name, 
+			   const gchar   *value)
+{
+	LmMessageNode *child;
+	
+	child = _lm_message_node_new (name);
+
+	lm_message_node_set_value (child, value);
+	_lm_message_node_add_child_node (node, child);
+	lm_message_node_unref (child);
+
+	return child;
+}
+
+/**
+ * lm_message_node_set_attributes:
+ * @node: an #LmMessageNode
+ * @name: the first attribute, should be followed by a string with the value
+ * 
+ * Sets a list of attributes. The arguments should be names and corresponding 
+ * value and needs to be ended with %NULL.
+ **/
+void
+lm_message_node_set_attributes  (LmMessageNode *node,
+				 const gchar   *name,
+				 ...)
+{
+	va_list args;
+	
+        g_return_if_fail (node != NULL);
+
+	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);
+}
+
+/**
+ * lm_message_node_set_attribute:
+ * @node: an #LmMessageNode
+ * @name: name of attribute
+ * @value: value of attribute.
+ * 
+ * Sets the attribute @name to @value.
+ **/
+void
+lm_message_node_set_attribute (LmMessageNode *node,
+			       const gchar   *name,
+			       const gchar   *value)
+{
+	gboolean  found = FALSE; 
+	GSList   *l;
+	gchar    *key;
+	
+	key = g_utf8_strdown (name, -1);
+
+	for (l = node->attributes; l; l = l->next) {
+		KeyValuePair *kvp = (KeyValuePair *) l->data;
+                
+		if (strcmp (kvp->key, key) == 0) {
+			g_free (kvp->value);
+			kvp->value = g_strdup (value);
+			g_free (key);
+			found = TRUE;
+			break;
+		}
+	}
+	
+	if (!found) {
+		KeyValuePair *kvp;
+	
+		kvp = g_new0 (KeyValuePair, 1);                
+		kvp->key = key;
+		kvp->value = g_strdup (value);
+		
+		node->attributes = g_slist_prepend (node->attributes,
+						    kvp);
+	}
+}
+
+/**
+ * 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 *
+lm_message_node_get_attribute (LmMessageNode *node, const gchar *name)
+{
+        GSList      *l;
+        const gchar *ret_val = NULL;
+        gchar       *key;
+
+        g_return_val_if_fail (node != NULL, NULL);
+
+        key = g_utf8_strdown (name, -1);
+
+        for (l = node->attributes; l; l = l->next) {
+                KeyValuePair *kvp = (KeyValuePair *) l->data;
+                
+                if (strcmp (kvp->key, key) == 0) {
+                        ret_val = kvp->value;
+                }
+        }
+        
+        g_free (key);
+        
+        return ret_val;
+}
+
+/**
+ * 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 
+ * immediate child of @node %NULL is returned.
+ * 
+ * Return value: the child node or %NULL if not found
+ **/
+LmMessageNode *
+lm_message_node_get_child (LmMessageNode *node, const gchar *child_name)
+{
+	LmMessageNode *l;
+	
+	for (l = node->children; l; l = l->next) {
+		if (g_ascii_strcasecmp (l->name, child_name) == 0) {
+			return l;
+		}
+	}
+
+	return NULL;
+}
+
+/**
+ * lm_message_node_find_child:
+ * @node: 
+ * @child_name: 
+ * 
+ * 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 * 
+lm_message_node_find_child (LmMessageNode *node,
+			    const gchar   *child_name)
+{
+        LmMessageNode *l;
+        LmMessageNode *ret_val = NULL;
+
+        for (l = node->children; l; l = l->next) {
+                if (g_ascii_strcasecmp (l->name, child_name) == 0) {
+                        return l;
+                }
+                if (l->children) {
+                        ret_val = lm_message_node_find_child (l, child_name);
+                        if (ret_val) {
+                                return ret_val;
+                        }
+                }
+        }
+
+        return NULL;
+}
+
+/**
+ * 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 
+ *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);
+	}
+}
+
+/**
+ * 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 
+ * purposes.
+ * 
+ * Return value: an XML string representation of @node
+ **/
+gchar *
+lm_message_node_to_string (LmMessageNode *node)
+{
+	gchar         *ret_val;
+	gchar         *str;
+	GSList        *l;
+	LmMessageNode *child;
+	
+	if (node->name == NULL) {
+		return g_strdup ("");
+	}
+	
+	str = g_strdup_printf ("<%s", node->name);
+	
+	for (l = node->attributes; l; l = l->next) {
+		KeyValuePair *kvp = (KeyValuePair *) l->data;
+		
+		ret_val = g_strdup_printf ("%s %s=\"%s\"", 
+					   str, kvp->key, kvp->value);
+		g_free (str);
+		str = ret_val;
+	}
+	
+	ret_val = g_strconcat (str, ">", NULL);
+	g_free (str);
+	
+	if (node->value) {
+		gchar *tmp;
+
+		str = ret_val;
+
+		tmp = g_markup_escape_text (node->value, -1);
+		ret_val = g_strconcat (str, tmp, NULL);
+		g_free (str);
+		g_free (tmp);
+	} 
+
+	for (child = node->children; child; child = child->next) {
+		gchar *child_str = lm_message_node_to_string (child);
+		str = ret_val;
+		ret_val = g_strconcat (str, "  ", child_str, NULL);
+		g_free (str);
+	}
+
+	str = ret_val;
+	ret_val = g_strdup_printf ("%s</%s>\n", str, node->name);
+	g_free (str);
+	
+	return ret_val;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-message-node.h	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,71 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_MESSAGE_NODE_H__
+#define __LM_MESSAGE_NODE_H__
+
+#if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
+#error "Only <loudmouth/loudmouth.h> can be included directly, this file may disappear or change contents."
+#endif
+
+
+#include <glib.h>
+
+typedef struct _LmMessageNode LmMessageNode;
+
+struct _LmMessageNode {
+	gchar      *name;
+	gchar      *value;
+
+        LmMessageNode     *next;
+        LmMessageNode     *prev;
+	LmMessageNode     *parent;
+        LmMessageNode     *children;
+
+	/* Private */
+	GSList     *attributes;
+	gint        ref_count;
+};
+
+const gchar *  lm_message_node_get_value      (LmMessageNode *node);
+void           lm_message_node_set_value      (LmMessageNode *node,
+					       const gchar   *value);
+LmMessageNode *lm_message_node_add_child      (LmMessageNode *node,
+					       const gchar   *name,
+					       const gchar   *value);
+void           lm_message_node_set_attributes (LmMessageNode *node,
+					       const gchar   *name,
+					       ...);
+void           lm_message_node_set_attribute  (LmMessageNode *node,
+					       const gchar   *name,
+					       const gchar   *value);
+const gchar *  lm_message_node_get_attribute  (LmMessageNode *node,
+					       const gchar   *name);
+LmMessageNode *lm_message_node_get_child      (LmMessageNode *message_node,
+					       const gchar   *child_name);
+LmMessageNode *lm_message_node_find_child     (LmMessageNode *message_node,
+					       const gchar   *child_name);
+LmMessageNode *lm_message_node_ref            (LmMessageNode *node);
+void           lm_message_node_unref          (LmMessageNode *node);
+gchar *        lm_message_node_to_string      (LmMessageNode *node);
+
+
+#endif /* __LM_MESSAGE_NODE_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-message.c	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,336 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <string.h>
+
+#include "lm-internals.h"
+#include "lm-message.h"
+
+#define PRIV(o) ((LmMessage *)o)->priv
+
+static struct TypeNames 
+{
+        LmMessageType  type;
+        const gchar   *name;
+} type_names[] = {
+	{ LM_MESSAGE_TYPE_MESSAGE,       "message"       },
+	{ LM_MESSAGE_TYPE_PRESENCE,      "presence"      },
+	{ LM_MESSAGE_TYPE_IQ,            "iq"            },
+	{ LM_MESSAGE_TYPE_STREAM,        "stream:stream" },
+	{ LM_MESSAGE_TYPE_STREAM_ERROR,  "stream:error"  }
+};
+
+static struct SubTypeNames 
+{
+        LmMessageSubType  type;
+        const gchar      *name;
+} sub_type_names[] = {
+        { LM_MESSAGE_SUB_TYPE_CHAT,            "chat"          },
+	{ LM_MESSAGE_SUB_TYPE_GROUPCHAT,       "groupchat"     },
+	{ LM_MESSAGE_SUB_TYPE_HEADLINE,        "headline"      },
+	{ LM_MESSAGE_SUB_TYPE_UNAVAILABLE,     "unavailable"   },
+        { LM_MESSAGE_SUB_TYPE_PROBE,           "probe"         },
+	{ LM_MESSAGE_SUB_TYPE_SUBSCRIBE,       "subscribe"     },
+	{ LM_MESSAGE_SUB_TYPE_UNSUBSCRIBE,     "unsubscribe"   },
+	{ LM_MESSAGE_SUB_TYPE_SUBSCRIBED,      "subscribed"    },
+	{ 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_ERROR,           "error"         }
+};
+
+struct LmMessagePriv {
+	LmMessageType    type;
+	LmMessageSubType sub_type;
+	gint             ref_count;
+};
+
+static LmMessageType
+message_type_from_string (const gchar *type_str)
+{
+        gint i;
+
+        if (!type_str) {
+                return LM_MESSAGE_TYPE_UNKNOWN;
+        }
+
+        for (i = LM_MESSAGE_TYPE_MESSAGE;
+	     i <= LM_MESSAGE_TYPE_STREAM_ERROR;
+	     ++i) {
+                if (g_ascii_strcasecmp (type_str, type_names[i].name) == 0) {
+                        return i;
+                }
+        }
+
+        return LM_MESSAGE_TYPE_UNKNOWN;
+}
+
+
+const gchar *
+_lm_message_type_to_string (LmMessageType type)
+{
+        if (type < LM_MESSAGE_TYPE_MESSAGE ||
+            type > LM_MESSAGE_TYPE_STREAM_ERROR) {
+                type = LM_MESSAGE_TYPE_UNKNOWN;
+        }
+
+        return type_names[type].name;
+}
+
+static LmMessageSubType
+message_sub_type_from_string (const gchar *type_str)
+{
+        gint i;
+
+        if (!type_str) {
+                return LM_MESSAGE_SUB_TYPE_NOT_SET;
+        }
+
+        for (i = LM_MESSAGE_SUB_TYPE_CHAT;
+	     i <= LM_MESSAGE_SUB_TYPE_ERROR;
+	     ++i) {
+                if (g_ascii_strcasecmp (type_str, 
+					sub_type_names[i].name) == 0) {
+                        return i;
+                }
+        }
+
+        return LM_MESSAGE_SUB_TYPE_NOT_SET;
+}
+
+const gchar *
+_lm_message_sub_type_to_string (LmMessageSubType type)
+{
+        if (type < LM_MESSAGE_SUB_TYPE_CHAT ||
+            type > LM_MESSAGE_SUB_TYPE_ERROR) {
+		return NULL;
+        }
+
+        return sub_type_names[type].name;
+}
+
+static LmMessageSubType
+message_sub_type_when_unset (LmMessageType type) {
+	LmMessageSubType sub_type = LM_MESSAGE_SUB_TYPE_NORMAL;
+
+	switch (type) {
+	case LM_MESSAGE_TYPE_MESSAGE:
+		sub_type = LM_MESSAGE_SUB_TYPE_NORMAL;
+		break;
+	case LM_MESSAGE_TYPE_PRESENCE:
+		sub_type = LM_MESSAGE_SUB_TYPE_AVAILABLE;
+		break;
+	case LM_MESSAGE_TYPE_IQ:
+		sub_type = LM_MESSAGE_SUB_TYPE_GET;
+		break;
+	default:
+		break;
+	}
+
+	return sub_type;
+}
+
+LmMessage *
+_lm_message_new_from_node (LmMessageNode *node)
+{
+	LmMessage        *m;
+	LmMessageType     type;
+	LmMessageSubType  sub_type;
+	const gchar      *sub_type_str;
+	
+	type = message_type_from_string (node->name);
+
+	if (type == LM_MESSAGE_TYPE_UNKNOWN) {
+		return NULL;
+	}
+
+	sub_type_str = lm_message_node_get_attribute (node, "type");
+	if (sub_type_str) {
+		sub_type = message_sub_type_from_string (sub_type_str);
+	} else {
+		sub_type = message_sub_type_when_unset (type);
+	}
+
+	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;
+}
+
+/**
+ * lm_message_new:
+ * @to: receipient jid
+ * @type: message type
+ * 
+ * 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() 
+ * when caller is finished with it.
+ * 
+ * Return value: a newly created #LmMessage
+ **/
+LmMessage *
+lm_message_new (const gchar *to, LmMessageType type)
+{
+	LmMessage *m = g_new0 (LmMessage, 1);
+	
+	m->priv = g_new0 (LmMessagePriv, 1);
+
+	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 (to) {
+		lm_message_node_set_attribute (m->node, "to", to);
+	}
+
+	if (type == LM_MESSAGE_TYPE_IQ) {
+		lm_message_node_set_attribute (m->node, "type", "get");
+	}
+	
+	return m;
+}
+
+/**
+ * lm_message_new_with_sub_type:
+ * @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 
+ * information.
+ * 
+ * Return value: a newly created #LmMessage
+ **/
+LmMessage *
+lm_message_new_with_sub_type (const gchar      *to,
+			      LmMessageType     type, 
+			      LmMessageSubType  sub_type)
+{
+	LmMessage   *m = lm_message_new (to, type);
+	const gchar *type_str;
+
+	type_str = _lm_message_sub_type_to_string (sub_type);
+
+	if (type_str) {
+		lm_message_node_set_attributes (m->node,
+						"type", type_str, NULL);
+		PRIV(m)->sub_type = sub_type;
+	}
+
+	return m;
+}
+
+/**
+ * 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: 
+ * 
+ * Fetches the sub type of @message.
+ * 
+ * Return value: the message sub type
+ **/
+LmMessageType
+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 
+ * message is freed.
+ **/
+void
+lm_message_unref (LmMessage *message)
+{
+	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);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-message.h	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,78 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_MESSAGE_H__
+#define __LM_MESSAGE_H__
+
+#if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
+#error "Only <loudmouth/loudmouth.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#include <loudmouth/lm-message-node.h>
+
+typedef struct LmMessagePriv LmMessagePriv;
+
+typedef struct {
+	LmMessageNode *node;
+
+	LmMessagePriv *priv;
+} LmMessage;
+
+typedef enum {
+	LM_MESSAGE_TYPE_MESSAGE,
+	LM_MESSAGE_TYPE_PRESENCE,
+	LM_MESSAGE_TYPE_IQ,
+	LM_MESSAGE_TYPE_STREAM,
+	LM_MESSAGE_TYPE_STREAM_ERROR,
+	LM_MESSAGE_TYPE_UNKNOWN
+} LmMessageType;
+
+typedef enum {
+        LM_MESSAGE_SUB_TYPE_NOT_SET = -10,
+	LM_MESSAGE_SUB_TYPE_NORMAL = -2,
+	LM_MESSAGE_SUB_TYPE_AVAILABLE = -1,
+	LM_MESSAGE_SUB_TYPE_CHAT = 0,
+        LM_MESSAGE_SUB_TYPE_GROUPCHAT,
+        LM_MESSAGE_SUB_TYPE_HEADLINE,
+        LM_MESSAGE_SUB_TYPE_UNAVAILABLE,
+        LM_MESSAGE_SUB_TYPE_PROBE,
+        LM_MESSAGE_SUB_TYPE_SUBSCRIBE,
+        LM_MESSAGE_SUB_TYPE_UNSUBSCRIBE,
+        LM_MESSAGE_SUB_TYPE_SUBSCRIBED,
+        LM_MESSAGE_SUB_TYPE_UNSUBSCRIBED,
+	LM_MESSAGE_SUB_TYPE_GET,
+	LM_MESSAGE_SUB_TYPE_SET,
+	LM_MESSAGE_SUB_TYPE_RESULT,
+	LM_MESSAGE_SUB_TYPE_ERROR
+} LmMessageSubType;
+
+LmMessage *   lm_message_new               (const gchar      *to,
+					    LmMessageType     type);
+LmMessage *   lm_message_new_with_sub_type (const gchar      *to,
+					    LmMessageType     type,
+					    LmMessageSubType  sub_type);
+LmMessageType lm_message_get_type          (LmMessage        *message);
+LmMessageType lm_message_get_sub_type      (LmMessage        *message);
+LmMessageNode * lm_message_get_node        (LmMessage        *message);
+LmMessage *   lm_message_ref               (LmMessage        *message);
+void          lm_message_unref             (LmMessage        *message);
+
+#endif /* __LM_MESSAGE_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-parser.c	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,288 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <string.h>
+
+#include "lm-debug.h"
+#include "lm-internals.h"
+#include "lm-message-node.h"
+#include "lm-parser.h"
+
+#define SHORT_END_TAG "/>"
+#define XML_MAX_DEPTH 5
+
+#define LM_PARSER(o) ((LmParser *) o)
+
+struct LmParser {
+	LmParserMessageFunction  function;
+	gpointer                 user_data;
+	GDestroyNotify           notify;
+	
+	LmMessageNode           *cur_root;
+	LmMessageNode           *cur_node;
+		
+	GMarkupParser           *m_parser;
+	GMarkupParseContext     *context;
+};
+
+
+/* Used while parsing */
+static void    parser_start_node_cb (GMarkupParseContext  *context,
+				     const gchar          *node_name,
+				     const gchar         **attribute_names,
+				     const gchar         **attribute_values,
+				     gpointer              user_data,
+				     GError              **error);
+static void    parser_end_node_cb   (GMarkupParseContext  *context,
+				     const gchar          *node_name,
+				     gpointer              user_data,
+				     GError              **error);
+static void    parser_text_cb       (GMarkupParseContext  *context,
+				     const gchar          *text,
+				     gsize                 text_len,  
+				     gpointer              user_data,
+				     GError              **error);
+static void    parser_error_cb      (GMarkupParseContext  *context,
+				     GError               *error,
+				     gpointer              user_data);
+
+static void
+parser_start_node_cb (GMarkupParseContext  *context,
+		      const gchar          *node_name,
+		      const gchar         **attribute_names,
+		      const gchar         **attribute_values,
+		      gpointer              user_data,
+		      GError              **error)
+{	
+	LmParser     *parser;
+	gint          i;
+	
+	parser = LM_PARSER (user_data);;
+	
+
+/* 	parser->cur_depth++; */
+
+	if (!parser->cur_root) {
+		/* New toplevel element */
+		parser->cur_root = _lm_message_node_new (node_name);
+		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", 
+		       attribute_names[i],
+		       attribute_values[i]);
+		
+		lm_message_node_set_attributes (parser->cur_node,
+						attribute_names[i],
+						attribute_values[i], 
+						NULL);
+	}
+	
+	if (g_ascii_strcasecmp ("stream:stream", node_name) == 0) {
+		parser_end_node_cb (context,
+				    "stream:stream",
+				    user_data, 
+				    error);
+	}
+}
+
+static void
+parser_end_node_cb (GMarkupParseContext  *context,
+		    const gchar          *node_name,
+		    gpointer              user_data,
+		    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);
+
+	if (g_ascii_strcasecmp (parser->cur_node->name, node_name) != 0) {
+		if (g_ascii_strcasecmp (node_name, "stream:stream")) {
+			g_print ("Got an stream:stream end\n");
+		}
+		g_warning ("Trying to close node that isn't open: %s",
+			   node_name);
+		return;
+	}
+
+	if (parser->cur_node == parser->cur_root) {
+		LmMessage *m;
+		
+		m = _lm_message_new_from_node (parser->cur_root);
+
+		if (!m) {
+			g_warning ("Couldn't create message: %s\n",
+				   parser->cur_root->name);
+			return;
+		}
+
+		g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_PARSER,
+		       "Have a new message\n");
+		if (parser->function) {
+			(* parser->function) (parser, m, parser->user_data);
+		}
+
+		lm_message_unref (m);
+ 		lm_message_node_unref (parser->cur_root);
+		
+		parser->cur_node = parser->cur_root = NULL;
+	} else {
+		LmMessageNode *tmp_node;
+		tmp_node = parser->cur_node;
+		parser->cur_node = parser->cur_node->parent;
+	}
+}
+
+static void
+parser_text_cb (GMarkupParseContext   *context,
+		const gchar           *text,
+		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
+parser_error_cb (GMarkupParseContext *context,
+		 GError              *error,
+		 gpointer             user_data)
+{
+	LmParser     *parser;
+	
+	g_return_if_fail (user_data != NULL);
+	
+	parser = LM_PARSER (user_data);
+
+	g_markup_parse_context_free (parser->context);
+	parser->context = NULL;
+}
+
+LmParser *
+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);
+		return NULL;
+	}
+
+	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;
+	parser->m_parser->error         = parser_error_cb;
+
+	parser->context = g_markup_parse_context_new (parser->m_parser, 0,
+						    parser, NULL);
+
+	parser->cur_root = NULL;
+	parser->cur_node = NULL;
+
+	return parser;
+}
+
+void
+lm_parser_parse (LmParser *parser, const gchar *string)
+{
+	g_return_if_fail (parser != NULL);
+	
+	if (!parser->context) {
+		parser->context = g_markup_parse_context_new (parser->m_parser, 0,
+							      parser, NULL);
+	}
+
+	if (!g_utf8_validate (string, -1, NULL)) {
+		gchar *tmp;
+		
+		/* We can't do much better than guess what charset the string is
+		 * encoded in... Try ISO-8859-1.
+		 */
+		tmp = g_convert (string, -1,
+				 "UTF-8", "ISO-8859-1",
+				 NULL, NULL,
+				 NULL);
+		
+		if (tmp) {
+			if (g_markup_parse_context_parse (parser->context, tmp, 
+							  strlen (tmp), NULL)) {
+			} else {
+				g_warning ("Parsing failed\n");
+			}
+			
+			g_free (tmp);
+		} else {
+			g_warning ("Trying to parse a string that is not UTF-8 and not ISO-8859-1.");
+		}
+	} else {
+		if (g_markup_parse_context_parse (parser->context, string, 
+						  strlen (string), NULL)) {
+		} else {
+			g_warning ("Parsing failed\n");
+		}
+	}
+}
+
+void
+lm_parser_free (LmParser *parser)
+{
+	if (parser->notify) {
+		(* parser->notify) (parser->user_data);
+	}
+	
+	g_free (parser);
+	g_print ("Free parser\n");
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-parser.h	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,41 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_PARSER_H__
+#define __LM_PARSER_H__
+
+#include <glib.h>
+#include "lm-message.h"
+
+typedef struct LmParser LmParser;
+
+typedef void (* LmParserMessageFunction) (LmParser     *parser,
+					  LmMessage    *message,
+					  gpointer      user_data);
+
+LmParser *   lm_parser_new       (LmParserMessageFunction  function,
+				  gpointer                 user_data,
+				  GDestroyNotify           notify);
+void         lm_parser_parse     (LmParser                *parser,
+				  const gchar             *string);
+void         lm_parser_free      (LmParser                *parser);
+
+#endif /* __LM_PARSER_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-sha.c	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,617 @@
+/*-
+ * Copyright (c) 2001, 2002 Allan Saddi <allan@saddi.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	$Id$
+ */
+
+/*
+ * Define WORDS_BIGENDIAN if compiling on a big-endian architecture.
+ *
+ * Define SHA1_TEST to test the implementation using the NIST's
+ * sample messages. The output should be:
+ *
+ *   a9993e36 4706816a ba3e2571 7850c26c 9cd0d89d
+ *   84983e44 1c3bd26e baae4aa1 f95129e5 e54670f1
+ *   34aa973c d4c4daa4 f61eeb2b dbad2731 6534016f
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#include <string.h>
+#include <stdio.h>
+#include <glib.h>
+
+#include "lm-sha.h"
+
+#define SHA1_HASH_SIZE 20
+
+/* Hash size in 32-bit words */
+#define SHA1_HASH_WORDS 5
+
+struct _SHA1Context {
+  guint64 totalLength;
+  guint32 hash[SHA1_HASH_WORDS];
+  guint32 bufferLength;
+  union {
+    guint32 words[16];
+    guint8 bytes[64];
+  } buffer;
+};
+
+typedef struct _SHA1Context SHA1Context;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void SHA1Init (SHA1Context *sc);
+void SHA1Update (SHA1Context *sc, const void *data, guint32 len);
+void SHA1Final (SHA1Context *sc, guint8 hash[SHA1_HASH_SIZE]);
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifndef lint
+static const char rcsid[] =
+	"$Id$";
+#endif /* !lint */
+
+#define ROTL(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
+#define ROTR(x, n) (((x) >> (n)) | ((x) << (32 - (n))))
+
+#define F_0_19(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
+#define F_20_39(x, y, z) ((x) ^ (y) ^ (z))
+#define F_40_59(x, y, z) (((x) & ((y) | (z))) | ((y) & (z)))
+#define F_60_79(x, y, z) ((x) ^ (y) ^ (z))
+
+#define DO_ROUND(F, K) { \
+  temp = ROTL(a, 5) + F(b, c, d) + e + *(W++) + K; \
+  e = d; \
+  d = c; \
+  c = ROTL(b, 30); \
+  b = a; \
+  a = temp; \
+}
+
+#define K_0_19 0x5a827999L
+#define K_20_39 0x6ed9eba1L
+#define K_40_59 0x8f1bbcdcL
+#define K_60_79 0xca62c1d6L
+
+#ifndef RUNTIME_ENDIAN
+
+#ifdef WORDS_BIGENDIAN
+
+#define BYTESWAP(x) (x)
+#define BYTESWAP64(x) (x)
+
+#else /* WORDS_BIGENDIAN */
+
+#define BYTESWAP(x) ((ROTR((x), 8) & 0xff00ff00L) | \
+		     (ROTL((x), 8) & 0x00ff00ffL))
+#define BYTESWAP64(x) _byteswap64(x)
+
+static inline guint64 _byteswap64(guint64 x)
+{
+  guint32 a = x >> 32;
+  guint32 b = (guint32) x;
+  return ((guint64) BYTESWAP(b) << 32) | (guint64) BYTESWAP(a);
+}
+
+#endif /* WORDS_BIGENDIAN */
+
+#else /* !RUNTIME_ENDIAN */
+
+static int littleEndian;
+
+#define BYTESWAP(x) _byteswap(x)
+#define BYTESWAP64(x) _byteswap64(x)
+
+#define _BYTESWAP(x) ((ROTR((x), 8) & 0xff00ff00L) | \
+		      (ROTL((x), 8) & 0x00ff00ffL))
+#define _BYTESWAP64(x) __byteswap64(x)
+
+static inline guint64 __byteswap64(guint64 x)
+{
+  guint32 a = x >> 32;
+  guint32 b = (guint32) x;
+  return ((guint64) _BYTESWAP(b) << 32) | (guint64) _BYTESWAP(a);
+}
+
+static inline guint32 _byteswap(guint32 x)
+{
+  if (!littleEndian)
+    return x;
+  else
+    return _BYTESWAP(x);
+}
+
+static inline guint64 _byteswap64(guint64 x)
+{
+  if (!littleEndian)
+    return x;
+  else
+    return _BYTESWAP64(x);
+}
+
+static inline void setEndian(void)
+{
+  union {
+    guint32 w;
+    guint8 b[4];
+  } endian;
+
+  endian.w = 1L;
+  littleEndian = endian.b[0] != 0;
+}
+
+#endif /* !RUNTIME_ENDIAN */
+
+static const guint8 padding[64] = {
+  0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+void
+SHA1Init (SHA1Context *sc)
+{
+#ifdef RUNTIME_ENDIAN
+  setEndian ();
+#endif /* RUNTIME_ENDIAN */
+
+  sc->totalLength = 0LL;
+  sc->hash[0] = 0x67452301L;
+  sc->hash[1] = 0xefcdab89L;
+  sc->hash[2] = 0x98badcfeL;
+  sc->hash[3] = 0x10325476L;
+  sc->hash[4] = 0xc3d2e1f0L;
+  sc->bufferLength = 0L;
+}
+
+static void
+burnStack (int size)
+{
+  char buf[128];
+
+  memset (buf, 0, sizeof (buf));
+  size -= sizeof (buf);
+  if (size > 0)
+    burnStack (size);
+}
+
+static void
+SHA1Guts (SHA1Context *sc, const guint32 *cbuf)
+{
+  guint32 buf[80];
+  guint32 *W, *W3, *W8, *W14, *W16;
+  guint32 a, b, c, d, e, temp;
+  int i;
+
+  W = buf;
+
+  for (i = 15; i >= 0; i--) {
+    *(W++) = BYTESWAP(*cbuf);
+    cbuf++;
+  }
+
+  W16 = &buf[0];
+  W14 = &buf[2];
+  W8 = &buf[8];
+  W3 = &buf[13];
+
+  for (i = 63; i >= 0; i--) {
+    *W = *(W3++) ^ *(W8++) ^ *(W14++) ^ *(W16++);
+    *W = ROTL(*W, 1);
+    W++;
+  }
+
+  a = sc->hash[0];
+  b = sc->hash[1];
+  c = sc->hash[2];
+  d = sc->hash[3];
+  e = sc->hash[4];
+
+  W = buf;
+
+#ifndef SHA1_UNROLL
+#define SHA1_UNROLL 20
+#endif /* !SHA1_UNROLL */
+
+#if SHA1_UNROLL == 1
+  for (i = 19; i >= 0; i--)
+    DO_ROUND(F_0_19, K_0_19);
+
+  for (i = 19; i >= 0; i--)
+    DO_ROUND(F_20_39, K_20_39);
+
+  for (i = 19; i >= 0; i--)
+    DO_ROUND(F_40_59, K_40_59);
+
+  for (i = 19; i >= 0; i--)
+    DO_ROUND(F_60_79, K_60_79);
+#elif SHA1_UNROLL == 2
+  for (i = 9; i >= 0; i--) {
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+  }
+
+  for (i = 9; i >= 0; i--) {
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+  }
+
+  for (i = 9; i >= 0; i--) {
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+  }
+
+  for (i = 9; i >= 0; i--) {
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+  }
+#elif SHA1_UNROLL == 4
+  for (i = 4; i >= 0; i--) {
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+  }
+
+  for (i = 4; i >= 0; i--) {
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+  }
+
+  for (i = 4; i >= 0; i--) {
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+  }
+
+  for (i = 4; i >= 0; i--) {
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+  }
+#elif SHA1_UNROLL == 5
+  for (i = 3; i >= 0; i--) {
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+  }
+
+  for (i = 3; i >= 0; i--) {
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+  }
+
+  for (i = 3; i >= 0; i--) {
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+  }
+
+  for (i = 3; i >= 0; i--) {
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+  }
+#elif SHA1_UNROLL == 10
+  for (i = 1; i >= 0; i--) {
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+    DO_ROUND(F_0_19, K_0_19);
+  }
+
+  for (i = 1; i >= 0; i--) {
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+    DO_ROUND(F_20_39, K_20_39);
+  }
+
+  for (i = 1; i >= 0; i--) {
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+    DO_ROUND(F_40_59, K_40_59);
+  }
+
+  for (i = 1; i >= 0; i--) {
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+    DO_ROUND(F_60_79, K_60_79);
+  }
+#elif SHA1_UNROLL == 20
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+  DO_ROUND(F_0_19, K_0_19);
+
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+  DO_ROUND(F_20_39, K_20_39);
+
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+  DO_ROUND(F_40_59, K_40_59);
+
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+  DO_ROUND(F_60_79, K_60_79);
+#else /* SHA1_UNROLL */
+#error SHA1_UNROLL must be 1, 2, 4, 5, 10 or 20!
+#endif
+
+  sc->hash[0] += a;
+  sc->hash[1] += b;
+  sc->hash[2] += c;
+  sc->hash[3] += d;
+  sc->hash[4] += e;
+}
+
+void
+SHA1Update (SHA1Context *sc, const void *data, guint32 len)
+{
+  guint32 bufferBytesLeft;
+  guint32 bytesToCopy;
+  int needBurn = 0;
+
+#ifdef SHA1_FAST_COPY
+  if (sc->bufferLength) {
+    bufferBytesLeft = 64L - sc->bufferLength;
+
+    bytesToCopy = bufferBytesLeft;
+    if (bytesToCopy > len)
+      bytesToCopy = len;
+
+    memcpy (&sc->buffer.bytes[sc->bufferLength], data, bytesToCopy);
+
+    sc->totalLength += bytesToCopy * 8L;
+
+    sc->bufferLength += bytesToCopy;
+    ((guint8 *) data) += bytesToCopy;
+    len -= bytesToCopy;
+
+    if (sc->bufferLength == 64L) {
+      SHA1Guts (sc, sc->buffer.words);
+      needBurn = 1;
+      sc->bufferLength = 0L;
+    }
+  }
+
+  while (len > 63) {
+    sc->totalLength += 512L;
+
+    SHA1Guts (sc, data);
+    needBurn = 1;
+
+    ((guint8 *) data) += 64L;
+    len -= 64L;
+  }
+
+  if (len) {
+    memcpy (&sc->buffer.bytes[sc->bufferLength], data, len);
+
+    sc->totalLength += len * 8L;
+
+    sc->bufferLength += len;
+  }
+#else /* SHA1_FAST_COPY */
+  while (len) {
+    bufferBytesLeft = 64L - sc->bufferLength;
+
+    bytesToCopy = bufferBytesLeft;
+    if (bytesToCopy > len)
+      bytesToCopy = len;
+
+    memcpy (&sc->buffer.bytes[sc->bufferLength], data, bytesToCopy);
+
+    sc->totalLength += bytesToCopy * 8L;
+
+    sc->bufferLength += bytesToCopy;
+    ((guint8 *) data) += bytesToCopy;
+    len -= bytesToCopy;
+
+    if (sc->bufferLength == 64L) {
+      SHA1Guts (sc, sc->buffer.words);
+      needBurn = 1;
+      sc->bufferLength = 0L;
+    }
+  }
+#endif /* SHA1_FAST_COPY */
+
+  if (needBurn)
+    burnStack (sizeof (guint32[86]) + sizeof (guint32 *[5]) + sizeof (int));
+}
+
+void
+SHA1Final (SHA1Context *sc, guint8 hash[SHA1_HASH_SIZE])
+{
+  guint32 bytesToPad;
+  guint64 lengthPad;
+  int i;
+
+  bytesToPad = 120L - sc->bufferLength;
+  if (bytesToPad > 64L)
+    bytesToPad -= 64L;
+
+  lengthPad = BYTESWAP64(sc->totalLength);
+
+  SHA1Update (sc, padding, bytesToPad);
+  SHA1Update (sc, &lengthPad, 8L);
+
+  if (hash) {
+    for (i = 0; i < SHA1_HASH_WORDS; i++) {
+#ifdef SHA1_FAST_COPY
+      *((guint32 *) hash) = BYTESWAP(sc->hash[i]);
+#else /* SHA1_FAST_COPY */
+      hash[0] = (guint8) (sc->hash[i] >> 24);
+      hash[1] = (guint8) (sc->hash[i] >> 16);
+      hash[2] = (guint8) (sc->hash[i] >> 8);
+      hash[3] = (guint8) sc->hash[i];
+#endif /* SHA1_FAST_COPY */
+      hash += 4;
+    }
+  }
+}
+
+const gchar *
+lm_sha_hash (const gchar *str)
+{
+        static gchar  ret_val[41];
+        SHA1Context   ctx;
+        guint8         hash[SHA1_HASH_SIZE];
+        gchar        *ch;
+        guint          i;
+        
+        SHA1Init (&ctx);
+        SHA1Update (&ctx, str, strlen (str));
+        SHA1Final (&ctx, hash);
+
+        ch = ret_val;
+
+        for (i = 0; i < SHA1_HASH_SIZE; ++i) {
+                snprintf (ch, 3, "%02x", hash[i]);
+                ch += 2;
+        }
+
+        return (const gchar *) ret_val;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-sha.h	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,29 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_SHA_H__
+#define __LM_SHA_H__
+
+#include <glib.h>
+
+const gchar *     lm_sha_hash    (const gchar *str);
+
+#endif /* __LM_SHA_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-utils.c	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,84 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <string.h>
+#include <stdio.h>
+#include <time.h>
+
+#include "lm-internals.h"
+#include "lm-utils.h"
+
+LmCallback *
+_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;
+	cb->notify = notify;
+
+	return cb;
+}
+
+void
+_lm_utils_free_callback (LmCallback *cb)
+{
+	if (cb->notify) {
+		(* cb->notify) (cb->user_data);
+	}
+	g_free (cb);
+}
+
+gchar *
+_lm_utils_generate_id (void)
+{
+	static gint  number = 0;
+
+	return g_strdup_printf ("msg_%d", ++number);
+}
+
+struct tm *
+lm_utils_get_localtime (const gchar *stamp)
+{
+	struct tm tmp_tm;
+	time_t    t;
+	gint      year, month;
+	
+	/* 20021209T23:51:30 */
+
+	sscanf (stamp, "%4d%2d%2dT%2d:%2d:%2d", 
+		&year, &month, &tmp_tm.tm_mday, &tmp_tm.tm_hour,
+		&tmp_tm.tm_min, &tmp_tm.tm_sec);
+
+	tmp_tm.tm_year = year - 1900;
+	tmp_tm.tm_mon = month - 1;
+	tmp_tm.tm_isdst = -1;
+
+ 	t = mktime (&tmp_tm);
+	t = t - (int) timezone;
+
+	return localtime (&t);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-utils.h	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,33 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_UTIL_H__
+#define __LM_UTIL_H__
+
+#if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
+#error "Only <loudmouth/loudmouth.h> can be included directly, this file may di\sappear or change contents."
+#endif
+
+#include <glib.h>
+
+struct tm *lm_utils_get_localtime (const gchar *stamp);
+
+#endif /* __LM_UTIL__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/loudmouth.h	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LOUDMOUTH_H__
+#define __LOUDMOUTH_H__
+
+#define LM_INSIDE_LOUDMOUTH_H 1
+
+#include <loudmouth/lm-connection.h>
+#include <loudmouth/lm-error.h>
+#include <loudmouth/lm-message.h>
+#include <loudmouth/lm-message-handler.h>
+#include <loudmouth/lm-message-node.h>
+#include <loudmouth/lm-utils.h>
+
+#undef LM_INSIDE_LOUDMOUTH_H
+
+#endif /* __LOUDMOUTH_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/test-jid.c	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,28 @@
+#include "lm-jid.h"
+
+int 
+main (int argc, char **argv)
+{
+        int i;
+        
+        if (argc < 2) {
+                g_print ("Usage: %s <jid> <jid> ...\n", argv[0]);
+                exit (1);
+        }
+
+        for (i = 1; i < argc; ++i) {
+                LmJID *jid;
+                
+                jid = lm_jid_new (argv[i]);
+                
+                g_print ("=======( JID[%i] )=======\n", i);
+                g_print ("# Name: '%s'\n", jid->name);
+                g_print ("# Host: '%s'\n", jid->host);
+                if (jid->resource) {
+                        g_print ("# Resource: '%s'\n", jid->resource);
+                }
+                g_print ("-------------------------\n");
+                g_print ("# JID: '%s'\n", lm_jid_to_string (jid));
+                g_print ("=========================\n\n");
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/test-lm.c	Mon May 19 18:27:00 2003 +0000
@@ -0,0 +1,117 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003 Mikael Hallendal <micke@codefactory.se>
+ * Copyright (C) 2003 CodeFactory 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <string.h>
+#include <loudmouth/loudmouth.h>
+#include "lm-internals.h"
+
+#define USAGE "Usage: test-lm <server> <username> <password>\n"
+
+typedef struct {
+	gchar *name;
+	gchar *passwd;
+} UserInfo;
+
+static void
+authentication_cb (LmConnection *connection, gboolean result, gpointer ud)
+{
+	g_print ("Auth: %d\n", result);
+
+	if (result == TRUE) {
+		LmMessage *m;
+		
+		m = lm_message_new_with_sub_type (NULL,
+						  LM_MESSAGE_TYPE_PRESENCE,
+						  LM_MESSAGE_SUB_TYPE_AVAILABLE);
+		g_print (":: %s\n", lm_message_node_to_string (m->node));
+		
+		lm_connection_send (connection, m, NULL);
+		lm_message_unref (m);
+	}
+}
+
+static void
+connection_open_cb (LmConnection *connection, gboolean result, UserInfo *info)
+{
+	g_print ("Connected callback\n");
+	lm_connection_authenticate (connection,
+				    info->name, info->passwd, "TestLM",
+				    FALSE, authentication_cb, NULL, NULL);
+	g_print ("Sent auth message\n");
+}
+
+static LmHandlerResult
+handle_messages (LmMessageHandler *handler,
+		 LmConnection     *connection,
+		 LmMessage        *m,
+		 gpointer          user_data)
+{
+	g_print ("Incoming message from: %s\n",
+		 lm_message_node_get_attribute (m->node, "from"));
+
+	return LM_HANDLER_RESULT_REMOVE_MESSAGE;
+}
+
+int 
+main (int argc, char **argv)
+{
+	GMainLoop        *main_loop;
+	LmConnection     *connection;
+	LmMessageHandler *handler;
+	gboolean          result;
+	UserInfo         *info;
+	
+	if (argc < 4) {
+		g_print (USAGE);
+		return 1;
+	}
+
+        connection = lm_connection_new (argv[1]);
+
+	handler = lm_message_handler_new (handle_messages, NULL, NULL);
+	lm_connection_register_message_handler (connection, handler, 
+						LM_MESSAGE_TYPE_MESSAGE, 
+						LM_HANDLER_PRIORITY_NORMAL);
+	
+	lm_message_handler_unref (handler);
+	
+	info = g_new0 (UserInfo, 1);
+	info->name = g_strdup (argv[2]);
+	info->passwd = g_strdup (argv[3]);
+	
+	result = lm_connection_open (connection,
+				     (LmResultFunction) connection_open_cb,
+				     info, NULL, NULL);
+
+	if (!result) {
+		g_print ("Opening connection failed: %d\n", result);
+	} else {
+		g_print ("Returned from the connection_open\n");
+	}
+	
+	main_loop = g_main_loop_new (NULL, FALSE);
+	g_main_loop_run (main_loop);
+
+	return 0;
+}