pontarius-xmpp-0.0.5.0: A (prototyped) secure and easy to use XMPP library

Network.XMPP

Description

 

Synopsis

Documentation

data JID Source

Constructors

JID 

Instances

jid :: Maybe String -> String -> Maybe String -> JIDSource

Simple function to construct a JID. We will add validation to this function in a later release.

jidIsFull :: JID -> BoolSource

JIDs are written in the format of `node@server/resource'. A JID without a resource identifier (i.e. a JID in the form of server or `node@server') is called a `bare JID'. A JID with a resource identifier is called `full JID'. This function returns True if the JID is full and False otherwise.

jidIsBare :: JID -> BoolSource

JIDs are written in the format of `node@server/resource'. A JID without a resource identifier (i.e. a JID in the form of server or `node@server') is called a `bare JID'. A JID with a resource identifier is called `full JID'. This function returns True if the JID is bare and False otherwise.

stringToJID :: String -> Maybe JIDSource

Converts a (JID) String to a JID record.

jidToString :: JID -> StringSource

Converts a JID to a String.

data MonadIO m => ClientHandler s m Source

A client typically needs one or more ClientHandler objects to interact with Pontarius XMPP. Each client handler may provide four callback functions; the first three callbacks deals with received stanzas, and the last one is used when the session is terminated.

These stanza functions takes the current client state and an object containing the details of the stanza in question. The boolean returned along with the possibly updated state signals whether or not the message should be blocked to client handlerss further down the stack. For example, an XEP-0030: Service Discovery handler may choose to hide disco#info requests to handlers above it in the stack.

The sessionTerminated callback function takes a TerminationReason value along with the state and will be sent to all client handlers.

class ClientState s m whereSource

Methods

putSession :: s -> Session s m -> sSource

type HostName = StringSource

Readability type for host name Strings.

type Password = StringSource

Readability type for password Strings.

type PortNumber = IntegerSource

Readability type for port number Integers.

type Resource = StringSource

Readability type for (JID) resource identifier Strings.

data Session s m Source

The Session object is used by clients when interacting with Pontarius XMPP. It holds information needed by Pontarius XMPP; its content is not accessible from the client.

data TerminationReason Source

TerminationReason contains information on why the XMPP session was terminated.

type UserName = StringSource

Readability type for user name Strings.

sendIQ :: MonadIO m => Session s m -> IQ -> Maybe (IQ -> StateT s m Bool) -> Maybe (Timeout, StateT s m ()) -> Maybe (StreamError -> StateT s m ()) -> StateT s m ()Source

session :: (MonadIO m, ClientState s m) => s -> [ClientHandler s m] -> StateT s m () -> m ()Source

Creates an XMPP session. Blocks the current thread. The first parameter, s, is an arbitrary state that is defined by the client. This is the initial state, and it will be passed to the client (handlers) as XMPP events are emitted. The second parameter is the list of ClientHandlers; this is a way to provide a layered system of XMPP event handlers. For example, a client may have a dedicated handler to manage messages, implement a spam protection system, etc. Messages are piped through these handlers one by one, and any handler may block the message from being sent to the next handler(s) above in the stack. The third argument is a callback function that will be called when the session has been initialized, and this function should be used by the client to store the Session object in its state.

data OpenStreamResult Source

Constructors

OpenStreamSuccess StreamProperties StreamFeatures 
OpenStreamFailure 

data SecureWithTLSResult Source

Constructors

SecureWithTLSSuccess StreamProperties StreamFeatures 
SecureWithTLSFailure 

data AuthenticateResult Source

Constructors

AuthenticateSuccess StreamProperties StreamFeatures Resource 
AuthenticateFailure 

data StanzaID Source

Constructors

SID String 

Instances

type To = JIDSource

data PresenceType Source

Constructors

Subscribe

Sender wants to subscribe to presence

Subscribed

Sender has approved the subscription

Unsubscribe

Sender is unsubscribing from presence

Unsubscribed

Sender has denied or cancelled a subscription

Probe

Sender requests current presence; should only be used by servers PresenceError | -- ^ Processing or delivery of previously sent presence stanza failed

Available 
Unavailable 

data Presence Source

Presence stanzas are used to express an entity's network availability.

Instances

injectAction :: MonadIO m => Session s m -> Maybe (StateT s m Bool) -> StateT s m () -> StateT s m ()Source