Package com.sissi.context

Examples of com.sissi.context.JID


    return false;
  }

  private Roster prepare(JIDContext context, Roster roster) {
    for (Relation each : super.myRelations(context.jid())) {
      JID to = super.build(each.jid());
      roster.add(new GroupItem(each.cast(RosterRelation.class)).nickname(this.vcardContext.pull(to, VCardContext.FIELD_NICK).getValue(), to.user()));
    }
    return roster;
  }
View Full Code Here


    this.relationContext = relationContext;
  }

  @Override
  public boolean input(JIDContext context, Protocol protocol) {
    JID group = super.build(protocol.parent().getTo());
    if (this.requestContext.apply(context.jid(), group, protocol.cast(Message.class).noneThread().subject(this.subject).getData())) {
      for (Relation relation : this.relationContext.myRelations(group, ItemRole.MODERATOR.toString())) {
        super.findOne(super.build(relation.jid()), true).write(protocol.reply());
      }
    }
View Full Code Here

*/
public class MessageMuc2AllProcessor extends ProxyProcessor {

  @Override
  public boolean input(JIDContext context, Protocol protocol) {
    JID group = super.build(protocol.getTo());
    // 重定向From为MUC JID
    protocol.setFrom(group.resource(super.ourRelation(context.jid(), group).name()));
    for (JID jid : super.whoSubscribedMe(group)) {
      super.findOne(jid, true).write(protocol);
    }
    return true;
  }
View Full Code Here

public class RosterRemove2FansPresenceProcessor extends ProxyProcessor {

  @Override
  public boolean input(JIDContext context, Protocol protocol) {
    Presence presence = new Presence().type(PresenceType.UNAVAILABLE);
    JID to = super.build(protocol.cast(Roster.class).first().getJid());
    for (JID resource : super.resources(context.jid())) {
      super.broadcast(to, presence.setFrom(resource));
    }
    return true;
  }
View Full Code Here

    this.mapping = mapping;
  }

  @Override
  public boolean input(JIDContext context, Protocol protocol) {
    JID group = super.build(protocol.parent().getTo());
    Room room = this.room.build(group);
    for (Item item : protocol.cast(XMucAdmin.class).getItem()) {
      // 同Nickname多JID
      for (JID each : this.mapping.mapping(item.actor(context.jid()).group(group))) {
        MucRelation relation = super.ourRelation(each, group).cast(MucRelation.class);
View Full Code Here

    entity.put(Dictionary.FIELD_PID, element.getId());
    entity.put(Dictionary.FIELD_TYPE, element.getType());
    entity.put(Dictionary.FIELD_TIMESTAMP, System.currentTimeMillis());
    entity.put(Dictionary.FIELD_DELAY, this.format.format(new Date()));
    entity.put(Dictionary.FIELD_CLASS, element.getClass().getSimpleName());
    JID to = this.jidBuilder.build(element.getTo());
    JID from = this.jidBuilder.build(element.getFrom());
    entity.put(Dictionary.FIELD_TO, this.bare ? to.asStringWithBare() : to.asString());
    entity.put(Dictionary.FIELD_FROM, this.bare ? from.asStringWithBare() : from.asString());
    return entity;
  }
View Full Code Here

   * @param element
   * @param message
   * @return
   */
  protected Delay delay(JID jid, Map<String, Object> element, Message message) {
    JID group = super.jidBuilder.build(element.get(Dictionary.FIELD_TO).toString());
    return new Delay(super.tip, this.room.build(group).allowed(jid, RoomConfig.WHOISALLOW, group) ? null : element.get(Dictionary.FIELD_SOURCE).toString(), element.get(Dictionary.FIELD_DELAY).toString());
  }
View Full Code Here

    this.mapping = mapping;
  }

  @Override
  public boolean input(JIDContext context, Protocol protocol) {
    JID group = super.build(protocol.parent().getTo());
    MucRelation relation = super.ourRelation(context.jid(), group).cast(MucRelation.class);
    for (Item item : protocol.cast(XMucAdmin.class).getItem()) {
      // 同Nickname多JID
      for (JID jid : this.mapping.mapping(group.resource(item.getNick()))) {
        if (ItemRole.parse(super.ourRelation(jid, group).cast(MucRelation.class).role()).contains(relation.role())) {
          return this.writeAndReturn(context, protocol);
        }
      }
    }
View Full Code Here

  @Override
  public boolean input(JIDContext context, Protocol protocol) {
    Presence presence = new Presence();
    for (BlockListItem item : protocol.cast(Block.class).getItem()) {
      JID to = super.build(item.getJid());
      // From: 当前JID所有资源, To: Block.item.jid
      for (JID resource : super.resources(context.jid())) {
        super.broadcast(to, presence.setFrom(resource).clauses(this.build(context).clauses()));
      }
    }
View Full Code Here

    this.identity = identity;
  }

  @Override
  public boolean input(JIDContext context, Protocol protocol) {
    JID group = super.build(protocol.parent().getTo());
    protocol.cast(DiscoInfo.class).data(this.vcardContext.pull(group, new XData().setType(XDataType.RESULT).add(this.form))).add(this.identity.clone().setName(group.user())).add(this.feature);
    context.write(protocol.parent().setType(ProtocolType.RESULT).reply());
    return true;
  }
View Full Code Here

TOP

Related Classes of com.sissi.context.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.