Remove source/Utils.hs
Add missing modules to Cabal file

Added the missing modules, that were not XEP files, to Other-Modules.
Add toError catch-all line to prevent crashing upon unexpected stream error

This is a temporary fix - we will have to revamp the error handling code.
Make the stream failure types more intuitive and clear

StreamError has been renamed to StreamFailure, as it's neither an
error or an exception, and since the term "stream error" is ambigous
(it can also refer to the stream error element on the XMPP stream).
Furthermore, XmppTLSError has been renamed to TLSFailure.

The data types related to the above mentioned failures are now
exported.

We do no longer clutter the API with detailed error conditions such as
StreamNotStreamElement. These kinds of conditions are such rare
occurances, and details about them are better suited in the logging
system (to be implemented soon).

Stream failures can occur either when a `stream:error' first-level
XML element is encountered, or if something unexpected happens in the
stream. Currently, `StreamErrorFailure', `StreamEndFailure', and
`StreamOtherFailure' are defined for these purposes, but additional
exceptions can be added if that would be helpful for the developers.

TLSFailure is moved to Types.hs and is now exported.

Also temporarily removed findStreamErrors.
Enable proof-of-concept logging by use of hslogger

Started to use hslogger in `EchoClient' and `connectTcpRaw'. Pontarius
XMPP now shows all binary data going in and out at the `debug' level.
Also modified the TCP conduit byte source to log the incoming data.
Projects/Pontarius/Apply various minor fixes

Started using double quotes instead of single quotes on XMLDecl, to
conform to the quotations of the other XML.

To conform with the Haskell style guidelines, `TLS' is now spelled
`Tls', and `XML' is now spelled `Xml'.

Updated library name in README file.
Re-add `findStreamErrors' functionality

The library should now generate the proper stream errors again, in
case of received stream open element problem.

The return type of streamS has been modified so that the validation
can be performed in startStream instead, and without exceptions. This
will also help enable implementation of logging later.

The Errors module has been removed.
Simplify API

Drops the Connection newtype, and shows TMVar Connection instead.

Hides Connection from Network.Xmpp, as the vast majority of users will
not need to work with Connection directly. The related functions are
now instead available from Network.Xmpp.Basic.

Renames `simpleConnect' to `session', and makes it flexible in terms
of authentication and whether or not to use TLS.

Adds some minor documentation changes.

We will need to export some session related information (such as the
acquired resource, stream properties, etc.). We will also need to
expose any failures encountered, probably by making `session' an
ErrorT calculation.

Also removed the Errors module from the Cabal file.
Rename `AuthError' to `AuthFailure'; apply minor documentation changes
Hide `Context', add exports, extend documentation

As mentioned in #pontarius, `Context' is simply a bunch of thread
management features, and users that want that can build their own on
top of the `Connection' layer. The benefit of hiding `Context' is that
it makes the API clearer, and significantly decreases the complexity
of the library.

As the `Basic' module is simply an interface to `Connection', it was
renamed to `Connection'. The old `Connection' module was moved to
`Connection_'.

Exported the types of the fields of `Connection' (such as
`ConnectionState' and `ConnectionHandle' (previously `HandleLike').
Fix silly stream element validation bug
Conform to tls-1.1
Remove Context

As previously mentioned, `Context' is simply a bunch of thread
management features. This patch moves the `Context' fields into
`Session', and the `Network.Xmpp.Concurrent.Channel' modules into
`Network.Xmpp.Concurrent'.
Tweak failure approach

I'm assuming and defining the following:

1. XMPP failures (which can occur at the TCP, TLS, and XML/XMPP
   layers (as a stream error or forbidden input)) are fatal; they will
   distrupt the XMPP session.

2. All fatal failures should be thrown (or similar) by `session', or
   any other function that might produce them.

3. Authentication failures that are not "XMPP failures" are not fatal.
   They do not necessarily terminate the stream. For example, the
   developer should be able to make another authentication attempt.
   The `Session' object returned by `session' might be useful even if
   the authentication fails.

4. We can (and should) use one single data type for fatal failures.
   (Previously, both StreamFailure and TlsFailure was used.)

5. We can catch and rethrow/wrap IO exceptions in the context of the
   Pontarius XMPP error system that we decide to use, making the error
   system more intuitive, Haskell-like, and more straight-forward to
   implement. Calling `error' may only be done in the case of a
   program error (a bug).

6. A logging system will remove the need for many of the error types.
   Only exceptions that seem likely to affect the flow of client
   applications should be defined.

7. The authentication functions are prone to fatal XMPP failures in
   addition to non-fatal authentication conditions. (Previously,
   `AuthStreamFailure' was used to wrap these errors.)

I'm hereby suggesting (and implementing) the following:

`StreamFailure' and `TlsFailure' should be joined into `XmppFailure'.

`pullStanza' and the other Connection functions used to throw
`IOException', `StreamFailure' and `TlsFailure' exceptions. With this
patch, they have been converted to `StateT Connection IO (Either
XmppFailure a)' computations. They also catch (some) IOException
errors and wrap them in the new `XmppIOException' constructor.
`newSession' is now `IO (Either XmppFailure Session)' as well (being
capable of throwing IO exceptions).

Whether or not to continue to a) wrap `XmppFailure' failures in an
`AuthStreamFailure' equivalent, or, b) treat the authentication
functions just like the other functions that may result in failure
(Either XmppFailure a), depends on how Network.Xmpp.Connection.auth
will be used. Since the latter will make `auth' more consistent, as
well as remove the need for a wrapped (and special-case) "AuthFailure"
type, I have decided to give the "b" approach a try. (The drawback
being, of course, that authentication errors can not be accessed
through the use of ErrorT. Whether or not this might be a problem, I
don't really know at this point.) As the SASL code (and SaslM)
depended on `AuthStreamFailure', it remains for internal use, at least
for the time-being. `session' is now an ErrorT computation as well.

Some functions have been updated as hacks, but this will be changed if
we decide to move forward with this approach.
Add limited SourceGraph module imports diagram, remove some imports

In my ongoing "high-level analysis" of Pontarius XMPP, I've proceeded
to take a quick look at the module imports.

The diagram provided is limited in that it does not include the
concurrent implementation, the Sasl modules, the IM modules, the XEP
modules, the example modules, nor the test modules.

Also, Network.Xmpp really does not need Network.Xmpp.Marshal,
Network.Xmpp.Stream, Network.Xmpp.Bind, or Network.Xmpp.Connection_.
Network.Xmpp.Connection does not need Network.Xmpp.Stream either.
These imports, and some others, have been removed with this patch.

Note also that Network.Xmpp.Tls does not need Network.Xmpp.Pickle.

Some observations:

1. There are three simple "utility" modules that depends only on
   Network.Xmpp.Types: Utilities, Presence, and Message. Utilities is
   inaccessible (indicated by the red colour).

2. There are two exposed "base" modules, Network.Xmpp and
   Network.Xmpp.Connection. The former does not need to access
   Network.Xmpp.Connection_, while the latter does. Otherwise, they
   both import the three modules: Session, Tls, and Types.
   Network.Xmpp also import the "utility" modules
   Network.Xmpp.Message, Network.Xmpp.Presence, and Network.Xmpp.Jid.

3. In Network.Xmpp.Session, if the `session' function is moved to the
   concurrent implementation, we can get rid of a dependency towards
   the concurrent implementation in the internal Network.Xmpp modules.
   If we take it one step further and also remove the Sasl functions,
   we can remove the need for Network.Xmpp to import this module (and
   probably get rid of the module completely).

4. Data.Conduit.Tls is only accessed by Network.Xmpp.Tls.

5. Text.Xml.Stream.Elements is only accessed by Network.Xmpp.Stream,
   Network.Xmpp.Connection_, and Network.Xmpp.Pickle.

6. Network.Xmpp.Types depends on Network.Xmpp.Jid (and re-exports it).
add lenses for stanza types
Merge remote-tracking branch 'nejla/master'

Conflicts:
	pontarius-xmpp.cabal
	source/Network/Xmpp/Basic.hs
	source/Network/Xmpp/Concurrent/Channels/Types.hs
	source/Network/Xmpp/Connection.hs
	source/Network/Xmpp/Errors.hs
	source/Network/Xmpp/Marshal.hs
	source/Network/Xmpp/Pickle.hs
	source/Network/Xmpp/Session.hs
	source/Network/Xmpp/Stream.hs
	source/Network/Xmpp/Tls.hs
	source/Network/Xmpp/Types.hs
	source/Network/Xmpp/Xep/InbandRegistration.hs