本文整理汇总了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);
}
示例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");
}
示例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");
}
}