当前位置: 首页>>代码示例>>Java>>正文


Java Message.getFromJid方法代码示例

本文整理汇总了Java中com.google.appengine.api.xmpp.Message.getFromJid方法的典型用法代码示例。如果您正苦于以下问题:Java Message.getFromJid方法的具体用法?Java Message.getFromJid怎么用?Java Message.getFromJid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.appengine.api.xmpp.Message的用法示例。


在下文中一共展示了Message.getFromJid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doPost

import com.google.appengine.api.xmpp.Message; //导入方法依赖的package包/类
public void doPost(HttpServletRequest req, HttpServletResponse res)
      throws IOException {
    XMPPService xmpp = XMPPServiceFactory.getXMPPService();
    
    Message message = xmpp.parseMessage(req);

    JID fromJid = message.getFromJid();
    String body = message.getBody();
    JID toJid = new JID("[email protected]/arlearn");
    //XMPPService xmppService = XMPPServiceFactory.getXMPPService();
    xmpp.sendPresence( toJid, PresenceType.AVAILABLE, PresenceShow.NONE, "Dit is mijn status");
    
    Message msg = new MessageBuilder()
    .asXml(true)
    .withRecipientJids( toJid)
    .withBody("Dit is een bericht voor stefaan op android")
    .build();
    
    xmpp.sendMessage(msg);
}
 
开发者ID:WELTEN,项目名称:dojo-ibl,代码行数:21,代码来源:XMPPReceiverServlet.java

示例2: processMessage

import com.google.appengine.api.xmpp.Message; //导入方法依赖的package包/类
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)").
      withRecipientJids(fromId).
      build());

  for (Map.Entry<JID, SendResponse.Status> entry :
      response.getStatusMap().entrySet()) {
    res.getWriter().println(entry.getKey() + "," + entry.getValue() + "<br>");
  }

  res.getWriter().println("processed");
}
 
开发者ID:dougkoellmer,项目名称:swarm,代码行数:18,代码来源:HelloXmpp.java

示例3: doPost

import com.google.appengine.api.xmpp.Message; //导入方法依赖的package包/类
public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException {
	XMPPService xmpp = XMPPServiceFactory.getXMPPService();
	Message msg = xmpp.parseMessage(req);

	JID fromJid = msg.getFromJid();
	String body = msg.getBody();

	// Unsubscribe, if requested
	if (body.startsWith("STOP")) {
		MultichannelChatManager.removeSub(fromJid.getId());
	} else {
		// If they aren't subscribed, subscribe them
		if (!MultichannelChatManager.isSubscribed(fromJid.getId())) {
			MultichannelChatManager.addSub(fromJid.getId());
		}
		MultichannelChatManager.sendMessage(body, "xmpp");
	}
}
 
开发者ID:kwhinnery,项目名称:gae-chat,代码行数:19,代码来源:XMPPReceiverServlet.java


注:本文中的com.google.appengine.api.xmpp.Message.getFromJid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。