Package com.sissi.protocol.presence

Examples of com.sissi.protocol.presence.Presence


*/
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


*/
public class RosterRemove2SelfsPresenceProcessor extends ProxyProcessor {

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

*/
abstract class ToFansPresenceProcessor extends ProxyProcessor {

  @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()));
      }
    }
    return true;
  }
View Full Code Here

*/
abstract class ToSelfsPresenceProcessor extends ProxyProcessor {

  @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());
      for (JID resource : super.resources(to)) {
        // super.findOne(to, true, true) -> Block.item.jid指定资源的JIDContext
        super.broadcast(context.jid(), presence.setFrom(resource).clauses(this.build(super.findOne(to, true, true)).clauses()));
      }
    }
    return true;
  }
View Full Code Here

  private static class DefaultPresenceBuilder implements PresenceBuilder {

    @Override
    public Presence build(JID from, Status status) {
      return status.getClass() == Presence.class ? Presence.class.cast(status).setFrom(from) : new Presence().setFrom(from).clauses(status.clauses());
    }
View Full Code Here

public class MucOwnerDestoryLeaveProcessor extends ProxyProcessor {

  @Override
  public boolean input(JIDContext context, Protocol protocol) {
    JID group = super.build(protocol.parent().getTo());
    Presence presence = new Presence().destory(protocol.cast(Owner.class).getDestory());
    for (JID jid : super.whoSubscribedMe(super.build(protocol.parent().getTo()))) {
      super.findOne(jid, true).write(presence.setFrom(group.resource(super.ourRelation(jid, group).name())));
    }
    return true;
  }
View Full Code Here

    this.proxy = proxy;
  }

  @Override
  public boolean input(JIDContext context, Protocol protocol) {
    this.proxy.input(context, new Presence().type(PresenceType.SUBSCRIBE).setTo(protocol.cast(Roster.class).first().getJid()));
    return true;
  }
View Full Code Here

    this.proxy = proxy;
  }

  @Override
  public boolean input(JIDContext context, Protocol protocol) {
    Presence presence = Presence.muc();
    presence.findField(XMuc.NAME, XMuc.class).set(History.NAME, protocol.cast(Message.class).getHistory());
    return this.proxy.input(context, presence.setTo(protocol.getTo()));
  }
View Full Code Here

    this.relationContext = relationContext;
  }

  @Override
  public MucGetout getout(JIDContext context) {
    Presence presence = new Presence();
    for (JID group : this.relationContext.iSubscribedWho(context.jid())) {
      this.proxy.input(context, presence.setTo(group).type(PresenceType.UNAVAILABLE));
    }
    return this;
  }
View Full Code Here

    this.vCardContext = vCardContext;
  }

  @Override
  public PresenceGetout getout(JIDContext context) {
    this.proxy.input(context, new Presence().setFrom(context.jid()).status(this.vCardContext.pull(context.jid(), VCardContext.FIELD_SIGNATURE).getValue()).type(PresenceType.UNAVAILABLE));
    return this;
  }
View Full Code Here

TOP

Related Classes of com.sissi.protocol.presence.Presence

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.