pontarius-xmpp-0.3.0.3: An XMPP client library

Safe HaskellNone

Network.Xmpp.IM

Contents

Description

RFC 6121: Instant Messaging and Presence

Synopsis

Instant Messages

data InstantMessage Source

The instant message (IM) specific part of a message.

simpleIMSource

Arguments

:: Jid

recipient

-> Text

body

-> Message 

Generate a simple message

getIM :: Message -> Maybe InstantMessageSource

Get the IM specific parts of a message. Returns Nothing when the received payload is not valid IM data.

withIM :: Message -> InstantMessage -> MessageSource

Append IM data to a message

answerIM :: [MessageBody] -> Message -> Maybe MessageSource

Generate an answer from a received message. The recepient is taken from the original sender, the sender is set to Nothing, message ID, language tag, message type as well as subject and thread are inherited, the remaining payload is replaced by the given one.

If multiple message bodies are given they MUST have different language tags

Presence

getIMPresence :: Presence -> Maybe IMPresenceSource

Try to extract RFC6121 IM presence information from presence stanza Returns Nothing when the data is malformed, (Just IMPresence) otherwise

Roster

data Roster Source

Constructors

Roster 

Fields

ver :: Maybe Text
 
items :: Map Jid Item
 

Instances

data Item Source

Roster Items

Constructors

Item 

Instances

getRoster :: Session -> IO RosterSource

Retrieve the current Roster state

rosterAddSource

Arguments

:: Jid

JID of the item

-> Maybe Text

Name alias

-> [Text]

Groups (duplicates will be removed)

-> Session 
-> IO (Maybe IQResponse) 

Add or update an item to the roster.

To update the item just send the complete set of new data

rosterRemove :: Jid -> Session -> IO BoolSource

Remove an item from the roster. Return True when the item is sucessfully removed or if it wasn't in the roster to begin with.