Package com.sissi.protocol.presence

Examples of com.sissi.protocol.presence.Presence


    return this;
  }

  private Presence presence(XMucAdminAction action, String affiliation) {
    this.limit = !ItemAffiliation.parse(this.getAffiliation()).contains(affiliation);
    return new Presence().setType(this.limit ? PresenceType.UNAVAILABLE.toString() : XMucAdminAction.AFFILIATION == action ? ItemAffiliation.parse(this.getAffiliation()).presence() : ItemRole.parse(this.getRole()).presence()).setFrom(this.group).cast(Presence.class);
  }
View Full Code Here


  }

  @Override
  public boolean input(JIDContext context, Protocol protocol) {
    if (context.onlined()) {
      Presence presence = protocol.cast(Presence.class).clone();
      for (JID group : super.iSubscribedWho(context.jid())) {
        this.proxy.input(context, presence.setTo(group));
      }
    }
    return true;
  }
View Full Code Here

*/
public class PresenceProbeOnlineProcessor extends ProxyProcessor {

  @Override
  public boolean input(JIDContext context, Protocol protocol) {
    Presence presence = protocol.cast(Presence.class);
    for (JID resource : super.resources(super.build(protocol.getTo()))) {
      super.findOne(resource, true).write(presence.setFrom(context.jid()).clauses(super.findOne(resource, true).status().clauses()).type(PresenceType.PROBE));
    }
    return true;
  }
View Full Code Here

  @Override
  public boolean input(JIDContext context, Protocol protocol) {
    JID group = super.build(protocol.getTo());
    MucRelation relation = super.ourRelation(context.jid(), group).cast(MucRelation.class).noneRole();
    Room room = this.room.build(group);
    Presence presence = new Presence();
    for (Relation each : super.myRelations(group)) {
      JID to = super.build(each.cast(MucRelation.class).jid());
      super.findOne(to, true).write(presence.clear().add(this.judger.add(new XUser(group, to, room.allowed(to, RoomConfig.WHOISEXISTS)).item(new Item(room.allowed(to, RoomConfig.WHOISALLOW, context.jid()), relation))).cast(XUser.class)).type(PresenceType.UNAVAILABLE).setFrom(protocol.getTo()));
    }
    return true;
  }
View Full Code Here

public class PresenceRosterUnSubscribed2PresenceProcessor extends ProxyProcessor {

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

    return this.writePresence(protocol.cast(Presence.class).clone(), context);
  }

  private boolean writePresence(Presence presence, JIDContext context) {
    for (JID resource : super.resources(context.jid())) {
      context.write(new Presence().setFrom(resource).clauses(super.findOne(resource, true).status().clauses()), true);
    }
    return true;
  }
View Full Code Here

   *
   * @see com.sissi.pipeline.Input#input(com.sissi.context.JIDContext, com.sissi.protocol.Protocol)
   */
  @Override
  public boolean input(JIDContext context, Protocol protocol) {
    Presence presence = Presence.muc();
    presence.findField(XMuc.NAME, XMuc.class).history(new History().setSince(this.format.format(Long.valueOf(this.vcardContext.pull(context.jid(), VCardContext.FIELD_LOGOUT, String.valueOf(System.currentTimeMillis())).getValue()))));
    for (JID jid : super.iSubscribedWho(context.jid())) {
      this.proxy.input(context, presence.setTo(jid));
    }
    return true;
  }
View Full Code Here

  }

  private boolean writeAndReturn(JIDContext context, JID group, String nickname, MucRelation relation) {
    Room room = this.room.build(group);
    // 通知其他房客昵称修改
    Presence presence = new Presence();
    for (Relation each : super.myRelations(group)) {
      JID to = super.build(each.cast(MucRelation.class).jid());
      super.findOne(to, true).write(presence.clear().add(this.adder.add(new XUser(group, to, room.allowed(to, RoomConfig.WHOISEXISTS)).item(new Item(room.allowed(to, RoomConfig.WHOISALLOW, context.jid()), nickname, relation))).cast(XUser.class)).type(PresenceType.UNAVAILABLE).setFrom(group.resource(relation.name())));
    }
    return false;
  }
View Full Code Here

*/
public class PresenceRosterUnSubscribe2PresenceProcessor extends ProxyProcessor {

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

  public boolean input(JIDContext context, Protocol protocol) {
    return this.writeAsk(context);
  }

  private boolean writeAsk(JIDContext context) {
    Presence presence = new Presence().type(PresenceType.SUBSCRIBE);
    for (Relation relation : this.ack.ack(context.jid())) {
      context.write(presence.setFrom(relation.jid()), true);
    }
    return true;
  }
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.