com.google.appengine.api.xmpp.SendResponse

Here are the examples of the java api class com.google.appengine.api.xmpp.SendResponse taken from open source projects.

1. GoogleXMPPEndPoint#sendMessage()

Project: nuvem
File: GoogleXMPPEndPoint.java
/**
	 * {@inheritDoc}
	 */
public Status sendMessage(org.apache.nuvem.cloud.xmpp.api.message.Message message) {
    XMPPService xmpp = connector.getConnection();
    if (message == null || message.recipient() == null) {
        throw new IllegalArgumentException("invalid input");
    }
    Status deliveryStatus = new Status();
    JID jid = new JID(message.recipient().asString());
    Message msg = GoogleXMPPMessageAdapter.toGoogleMessage(message);
    SendResponse status = null;
    if (xmpp.getPresence(jid).isAvailable()) {
        log.info("user online...");
        try {
            status = xmpp.sendMessage(msg);
        } catch (RuntimeException e) {
            deliveryStatus.addError(new Error(ErrorCode.UNKNOWN_ERROR, "unknown runtime error while sending message over XMPP"));
            return deliveryStatus;
        }
        log.info(status.toString());
    } else {
        log.info("user offline...");
        deliveryStatus.addError(new org.apache.nuvem.cloud.xmpp.api.Error(ErrorCode.USER_OFFLINE));
        return deliveryStatus;
    }
    return GoogleStatusAdapter.toStatus(status);
}