Package freenet.clients.fcp

Source Code of freenet.clients.fcp.WatchFeedsMessage

package freenet.clients.fcp;

import freenet.node.Node;
import freenet.support.SimpleFieldSet;

public class WatchFeedsMessage extends FCPMessage {

  public static final String NAME = "WatchFeeds";
  public final boolean enabled;

  public WatchFeedsMessage(SimpleFieldSet fs) {
    enabled = fs.getBoolean("Enabled", true);
  }

  @Override
  public String getName() {
    return NAME;
  }

  @Override
  public void run(FCPConnectionHandler handler, Node node)
      throws MessageInvalidException {
    if(enabled)
      node.clientCore.alerts.watch(handler);
    else
      node.clientCore.alerts.unwatch(handler);
  }

  @Override
  public SimpleFieldSet getFieldSet() {
    SimpleFieldSet fs = new SimpleFieldSet(true);
    fs.put("Enabled", enabled);
    return fs;
  }

}
TOP

Related Classes of freenet.clients.fcp.WatchFeedsMessage

TOP
Copyright © 2018 www.massapi.com. 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.