@Override
 public Boolean input(JIDContext context, Protocol protocol) {
   JID master = super.jidBuilder.build(protocol.getTo()).getBare();
   super.presenceQueue.offer(
       master,
       context.getJid().getBare(),
       master,
       context.getPresence().setTypeText(Presence.Type.ONLINE.toString()));
   return true;
 }
 @Override
 public boolean input(JIDContext context, Protocol protocol) {
   XData data = protocol.cast(Message.class).getData();
   JID group = super.build(protocol.parent().getTo());
   JID to =
       super.build(data.findField(MucApplyContext.MUC_JID, XField.class).getValue().toString());
   this.mucRoleBuilder
       .build(data.findField(MucApplyContext.MUC_ROLE, XField.class).getValue().toString())
       .change(group.resource(super.ourRelation(to, group).name()));
   return this.proxy.input(
       super.findOne(to, true),
       new Presence()
           .add(this.muc)
           .setTo(
               group.resource(
                   data.findField(MucApplyContext.MUC_NICKNAME, XField.class)
                       .getValue()
                       .toString())));
 }
 @Override
 public boolean input(JIDContext context, Protocol protocol) {
   context.write(
       protocol
           .cast(Bytestreams.class)
           .setStreamhostUsed(this.streamhostUsed)
           .parent()
           .reply()
           .setType(ProtocolType.RESULT));
   return true;
 }
 /**
  * {"pid":Xxx},{"$set":{"ack":false}}
  *
  * @param context
  * @param protocol
  * @return
  */
 private boolean writeAndReturn(JIDContext context, Protocol protocol) {
   this.persistent.peek(
       MongoUtils.asMap(
           BasicDBObjectBuilder.start(
                   Dictionary.FIELD_PID, protocol.cast(Message.class).getReceived().id())
               .get()),
       MongoUtils.asMap(
           BasicDBObjectBuilder.start(
                   "$set", BasicDBObjectBuilder.start(Dictionary.FIELD_ACK, false).get())
               .get()));
   return false;
 }
Esempio n. 5
0
 @Override
 public boolean match(Protocol protocol) {
   return super.match(protocol) && protocol.parent().type(this.type);
 }
 /*
  * 如果为ACK请求
  *
  * @see com.sissi.pipeline.Input#input(com.sissi.context.JIDContext, com.sissi.protocol.Protocol)
  */
 @Override
 public boolean input(JIDContext context, Protocol protocol) {
   return protocol.cast(Message.class).received() ? this.writeAndReturn(context, protocol) : true;
 }
 @Override
 public boolean input(JIDContext context, Protocol protocol) {
   return context.auth() ? this.writeFeature(protocol.cast(Stream.class)) : true;
 }
 @Override
 public boolean input(JIDContext context, Protocol protocol) {
   super.priority(context.priority(protocol.cast(Presence.class).priority(-1)));
   return true;
 }