Package com.google.appengine.api.xmpp

Examples of com.google.appengine.api.xmpp.JID


      throws IOException {
    processMessage(xmppService.parseMessage(req), res);
  }

  public void processMessage(Message message, HttpServletResponse res) throws IOException {
    JID fromId = message.getFromJid();
    Presence presence = xmppService.getPresence(fromId);
    String presenceString = presence.isAvailable() ? "" : "not ";
    SendResponse response = xmppService.sendMessage(
        new MessageBuilder().
        withBody(message.getBody() + " (you are " + presenceString + "available)").
View Full Code Here


  private boolean sendResponseToSender(XMPPService xmpp, JID sender, String messageBody) throws Exception {
    boolean sent = false;
    // Send the message only if the buddy is online
    if (xmpp.getPresence(sender).isAvailable()) {
      // Create a message container
      Message msg = new MessageBuilder().withRecipientJids(sender).withBody(messageBody.trim()).withFromJid(new JID(APPLICATION_JID)).withMessageType(MessageType.CHAT).build();
      SendResponse status = xmpp.sendMessage(msg);
      // Check delivery status
      if ((status.getStatusMap().get(sender) == SendResponse.Status.SUCCESS)) {
        sent = true;
      }
View Full Code Here

      eMsg.setText(trace);
      // --Send it
      // Transport.send(eMsg);
      // By XMPP
      // --Create the receiver and sender buddies
      JID toJid = new JID(getServletContext().getInitParameter("admin.gmail.email"));
      JID fromJid = new JID("filedownloadrelay@appspot.com");
      // --Create the message
      com.google.appengine.api.xmpp.Message xMsg = new MessageBuilder().withRecipientJids(toJid).withBody(trace).withMessageType(MessageType.NORMAL).withFromJid(fromJid).build();
      // --Get a XMPP service provider
      XMPPService xmpp = XMPPServiceFactory.getXMPPService();
      // --Send the message only if the receiver buddy is connected
View Full Code Here

    PreparedQuery pq = datastore.prepare(q);
    for (Entity result : pq.asIterable())
    {
      Key key = result.getKey();
      try{
        JID fromJID = new JID(key.getName());
        XMPPService xmpp = XMPPServiceFactory.getXMPPService();
        if(xmpp.getPresence(fromJID).isAvailable())
        {
          doCheckMention(fromJID);
        }
View Full Code Here

    req.setCharacterEncoding("UTF-8");
    resp.setCharacterEncoding("UTF-8");
    resp.setContentType("text/html; charset=utf-8");
    XMPPService xmpp = XMPPServiceFactory.getXMPPService();
    Message message = xmpp.parseMessage(req);
    JID fromJID = message.getFromJid();                    //发送者JID
    String msgbody = message.getBody();                    //接收到的消息
    msgbody = msgbody.trim();
    if(msgbody.isEmpty())
    {
      return;
View Full Code Here

      throws IOException {
    XMPPService xmpp = XMPPServiceFactory.getXMPPService();
   
    // receive message
    Message message = xmpp.parseMessage(req);
    JID from = message.getFromJid();
    JID[] recipients = message.getRecipientJids();
    JID to = (recipients.length > 0) ? recipients[0] : null;
   
    String body = message.getBody();
    if (body != null && body.startsWith("{") || body.trim().startsWith("{")) {
      // the body contains a JSON object
      ObjectNode json = null;
      try {
        String agentUrl = "xmpp:" + to.getId();
        String agentId = xmppService != null ? xmppService
            .getAgentId(agentUrl) : null;
       
        json = JOM.getInstance().readValue(body, ObjectNode.class);
        if (isResponse(json)) {
View Full Code Here

        assertThat(
            " 指定した宛先に送られる",
            delegate.messages.get(0).getBody(),
            is(" 議事録' 活発な議事録' に100 件目が投稿されました."));
        XMPPServiceFactory.getXMPPService().getPresence(
            new JID(ProspectiveSearchController.ADMIN_EMAIL));
    }
View Full Code Here

            leaseDurationSeconds,
            "memoCount = 100",
            schema);
        XMPPServiceFactory
            .getXMPPService()
            .sendInvitation(new JID(ADMIN_EMAIL));
        return null;
    }
View Full Code Here

        b.append("' に");
        b.append(document.getProperty("memoCount"));
        b.append(" 件目が投稿されました.");
        Message message =
            new MessageBuilder()
                .withRecipientJids(new JID(ADMIN_EMAIL))
                .withBody(b.toString())
                .build();
        XMPPServiceFactory.getXMPPService().sendMessage(message);
    }
View Full Code Here

      return false;
    }
  }

  public static boolean sendInvite(String id) {
    return XMPP.sendInvite(new JID(id));
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.xmpp.JID

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.