Package net.pterodactylus.sone.freenet.wot

Examples of net.pterodactylus.sone.freenet.wot.Identity


  /**
   * {@inheritDoc}
   */
  @Override
  public Object get(TemplateContext templateContext, Object object, String member) {
    Identity identity = (Identity) object;
    if ("uniqueNickname".equals(member)) {
      int minLength = -1;
      boolean found = false;
      Set<OwnIdentity> ownIdentities = null;
      ownIdentities = core.getIdentityManager().getAllOwnIdentities();
View Full Code Here


   * @param identityAddedEvent
   *            The event
   */
  @Subscribe
  public void identityAdded(IdentityAddedEvent identityAddedEvent) {
    Identity identity = identityAddedEvent.identity();
    logger.log(Level.FINEST, String.format("Adding Identity: %s", identity));
    trustedIdentities.put(identityAddedEvent.ownIdentity(), identity);
    addRemoteSone(identity);
  }
View Full Code Here

   * @param identityUpdatedEvent
   *            The event
   */
  @Subscribe
  public void identityUpdated(IdentityUpdatedEvent identityUpdatedEvent) {
    final Identity identity = identityUpdatedEvent.identity();
    soneDownloaders.execute(new Runnable() {

      @Override
      @SuppressWarnings("synthetic-access")
      public void run() {
        Sone sone = getRemoteSone(identity.getId(), false);
        if (sone.isLocal()) {
          return;
        }
        sone.setIdentity(identity);
        sone.setLatestEdition(Numbers.safeParseLong(identity.getProperty("Sone.LatestEdition"), sone.getLatestEdition()));
        soneDownloader.addSone(sone);
        soneDownloader.fetchSone(sone);
      }
    });
  }
View Full Code Here

   *            The event
   */
  @Subscribe
  public void identityRemoved(IdentityRemovedEvent identityRemovedEvent) {
    OwnIdentity ownIdentity = identityRemovedEvent.ownIdentity();
    Identity identity = identityRemovedEvent.identity();
    trustedIdentities.remove(ownIdentity, identity);
    boolean foundIdentity = false;
    for (Entry<OwnIdentity, Collection<Identity>> trustedIdentity : trustedIdentities.asMap().entrySet()) {
      if (trustedIdentity.getKey().equals(ownIdentity)) {
        continue;
      }
      if (trustedIdentity.getValue().contains(identity)) {
        foundIdentity = true;
      }
    }
    if (foundIdentity) {
      /* some local identity still trusts this identity, don’t remove. */
      return;
    }
    Optional<Sone> sone = getSone(identity.getId());
    if (!sone.isPresent()) {
      /* TODO - we don’t have the Sone anymore. should this happen? */
      return;
    }
    database.removePosts(sone.get());
    for (Post post : sone.get().getPosts()) {
      eventBus.post(new PostRemovedEvent(post));
    }
    database.removePostReplies(sone.get());
    for (PostReply reply : sone.get().getReplies()) {
      eventBus.post(new PostReplyRemovedEvent(reply));
    }
    synchronized (sones) {
      sones.remove(identity.getId());
    }
    eventBus.post(new SoneRemovedEvent(sone.get()));
  }
View Full Code Here

TOP

Related Classes of net.pterodactylus.sone.freenet.wot.Identity

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.