# XMPPService
Date: 2012-02-24

## com.google.appengine.api.xmpp
Interface XMPPService

    public interface XMPPService

Interface for accessing XMPP status information, sending XMPP messages, and parsing XMPP responses.

See Also:
  RFC 3921 for the XMPP specification.

Method Summary
`Presence` `getPresence(JID jabberId)` Given a JID, look up the user's status and return it.
`Presence` `getPresence(JID jabberId, JID fromJid)` Given a JID, look up the user's status and return it.
`Message` `parseMessage(HttpServletRequest request)` Parse the incoming message provided in `request`.
`Presence` `parsePresence(HttpServletRequest request)` Parse the incoming presence notification provided in `request`.
`Subscription` `parseSubscription(HttpServletRequest request)` Parse the incoming subscription notification provided in `request`.
`void` `sendInvitation(JID jabberId)` Given a JID, sends a chat invitation.
`void` `sendInvitation(JID jabberId, JID fromJid)` Given a JID, sends a chat invitation.
`SendResponse` `sendMessage(Message message)` Send provided message to specified JIDs.
`void` `sendPresence(JID jabberId, PresenceType type, PresenceShow show, java.lang.String status)` Given a JID, type and optional show and status value, sends a presence packet.
`void` `sendPresence(JID jabberId, PresenceType type, PresenceShow show, java.lang.String status, JID fromJid)` Given a JID, type and optional show and status value, sends a presence packet.

Method Detail

### getPresence

    Presence getPresence(JID jabberId)

  Given a JID, look up the user's status and return it.

  Parameters:
    `jabberId` - JID of the user whose presence should be fetched.
  Throws:
    `java.lang.IllegalArgumentException` - if the id is not valid

### getPresence

    Presence getPresence(JID jabberId,
                         JID fromJid)

  Given a JID, look up the user's status and return it. Uses a custom JID as the sender.

  Parameters:
    `jabberId` - JID of the user whose presence should be fetched.
    `fromJid` - JID of the chat bot. Can be null.
  Throws:
    `java.lang.IllegalArgumentException` - if the id is not valid

### sendPresence

    void sendPresence(JID jabberId,
                      PresenceType type,
                      PresenceShow show,
                      java.lang.String status)

  Given a JID, type and optional show and status value, sends a presence packet.

  Parameters:
    `jabberId` - JID of the user to send presence to.
    `type` - Type of presence. Can be null (available).
    `show` - Value for show element. Can be null.
    `status` - String for status element. Can be null.
  Throws:
    `java.lang.IllegalArgumentException` - If the one or more of the parameters are not valid.

### sendPresence

    void sendPresence(JID jabberId,
                      PresenceType type,
                      PresenceShow show,
                      java.lang.String status,
                      JID fromJid)

  Given a JID, type and optional show and status value, sends a presence packet.

  Parameters:
    `jabberId` - JID of the user to send presence to.
    `type` - Type of presence. Can be null (available).
    `show` - Value for show element. Can be null.
    `status` - String for status element. Can be null.
    `fromJid` - JID of the chat bot. Can be null.
  Throws:
    `java.lang.IllegalArgumentException` - If the one or more of the parameters are not valid.

### sendInvitation

    void sendInvitation(JID jabberId)

  Given a JID, sends a chat invitation.

  Parameters:
    `jabberId` - JID of the user to invite.
  Throws:
    `java.lang.IllegalArgumentException` - if the id is not valid

### sendInvitation

    void sendInvitation(JID jabberId,
                        JID fromJid)

  Given a JID, sends a chat invitation. Uses a custom JID as the sender.

  Parameters:
    `fromJid` - JID of the chat bot. Can be null.
  Throws:
    `java.lang.IllegalArgumentException` - if the id is not valid

### sendMessage

    SendResponse sendMessage(Message message)

  Send provided message to specified JIDs.

  Parameters:
    `message` - Message to send.
  Throws:
    `java.lang.IllegalArgumentException` - if the message or ids are not valid

### parseMessage

    Message parseMessage(HttpServletRequest request)
                         throws java.io.IOException

  Parse the incoming message provided in `request`. This method should only be called from within an XMPP webhook.

  Throws:
    `java.io.IOException`

### parsePresence

    Presence parsePresence(HttpServletRequest request)
                           throws java.io.IOException

  Parse the incoming presence notification provided in `request`. This method should only be called from within an XMPP webhook.

  Throws:
    `java.io.IOException`

### parseSubscription

    Subscription parseSubscription(HttpServletRequest request)
                                   throws java.io.IOException

  Parse the incoming subscription notification provided in `request`. This method should only be called from within an XMPP webhook.

  Throws:
    `java.io.IOException`