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


Java JID.getDomain方法代码示例

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


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

示例1: handleMMXMulticast

import org.xmpp.packet.JID; //导入方法依赖的package包/类
public void handleMMXMulticast(MMXMsgRuleInput input)
    throws PacketRejectedException {
  Message message = input.getMessage();
  JID mcastJid = message.getTo();
  String appId = JIDUtil.getAppId(mcastJid);
  PacketExtension payload = message.getExtension(Constants.MMX,
      Constants.MMX_NS_MSG_PAYLOAD);
  if (payload == null) {
    LOGGER.warn("Dropping a malformed MMX multicast message.");
    if (!(Boolean) getMmxMeta(payload, MmxHeaders.NO_ACK, Boolean.FALSE)) {
      sendBeginAckMessageOnce(message, appId, 0, ErrorCode.SEND_MESSAGE_MALFORMED);
    }
    throw new PacketRejectedException(
        "Stop processing for malformed multicast message");
  }

  MMXid[] recipients = getRecipients(payload);
  if (recipients == null || recipients.length == 0) {
    LOGGER.warn("No recipients found in MMX multicast message");
    if (!(Boolean) getMmxMeta(payload, MmxHeaders.NO_ACK, Boolean.FALSE)) {
      sendBeginAckMessageOnce(message, appId, 0, ErrorCode.SEND_MESSAGE_NO_TARGET);
    }
  } else {
    // Save a recipient counter for the multicast message and send a begin
    // ack. The count will be decremented when each routed message is handled
    // later.  When the count reaches zero, the end ack will be sent.  Note,
    // the packet routing in the for-loop is done asynchronously.
    if (!(Boolean) getMmxMeta(payload, MmxHeaders.NO_ACK, Boolean.FALSE)) {
      sendBeginAckMessageOnce(message, appId, recipients.length, ErrorCode.NO_ERROR);
    }

    PacketRouter pktRouter = XMPPServer.getInstance().getPacketRouter();
    for (MMXid recipient : recipients) {
      JID jid = new JID(JIDUtil.makeNode(recipient.getUserId(), appId),
          mcastJid.getDomain(), recipient.getDeviceId(), true);
      // TODO: need a deep copy because payload cannot be shared with
      // multiple messages; it has a DOM parent.
      Message unicastMsg = message.createCopy();
      unicastMsg.setTo(jid);
      pktRouter.route(unicastMsg);
    }
  }
  throw new PacketRejectedException("MMX multicast message is processed");
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:45,代码来源:MMXMessageHandlingRule.java


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