Package plugins.Freetalk.MessageList

Examples of plugins.Freetalk.MessageList.MessageFetchFailedMarker


   
    final WoTMessageManager messageManager = mFreetalk.getMessageManager();
   
    synchronized(messageManager) {
      for(final MessageList.MessageReference ref : messageManager.getDownloadableMessagesSortedByDate(mBoard)) {
        MessageFetchFailedMarker failureMarker = null;
        int failedFetches;
       
        try {
          failureMarker = messageManager.getMessageFetchFailedMarker(ref);
          failedFetches = failureMarker.getNumberOfRetries();
        } catch(NoSuchFetchFailedMarkerException e) {
          if(ref.wasMessageDownloaded())
            continue; // We are the unfetched messages page, don't display fetched ones
         
          failedFetches = 0;
        }
       
        String authorText;
        String authorScore;
       
        // Author related stuff
        {
          Identity author = null;
         
          // TODO: Use a colored "unknown" if the author/score is unknown
          // TODO: Use a special color if author == yourself
          authorText = "?"; // TODO: l10n
          authorScore = "?";
         
          try {
            author = ref.getMessageList().getAuthor();
            authorText = author.getShortestUniqueName();
           
            // TODO: Get rid of the cast somehow, we should maybe call this WoTBoardPage :|
            final int score = ((WoTOwnIdentity)mOwnIdentity).getScoreFor((WoTIdentity)author);
            if (score == Integer.MAX_VALUE)
              authorScore = "-"; // TODO: l10n
            else
              authorScore = Integer.toString(score);
          } catch(NotInTrustTreeException e) {
            authorScore = l10n().getString("Common.WebOfTrust.ScoreNull");
          } catch(Exception e) {
            Logger.error(this, "getScoreFor() failed", e);
          }
        }
               
        row = table.addChild("tr", "class", "message-row");

        /* URI */
        row.addChild("td", "class", "uri", ref.getURI().toString());

        /* Author */
        row.addChild("td", "class", "author-name", authorText);

        /* Trust */
        row.addChild("td", "class", "author-score", authorScore);

        /* Date */
        row.addChild("td", "class", "date", dateFormat.format(ref.getCreationDate()));
       
        /* Fetched fail count */
        row.addChild("td", "class", "failed-fetches", Integer.toString(failedFetches));
       
        /* Last fail reason. TODO: l10n */
        row.addChild("td", "class", "failure-reason", failureMarker == null ? "-" : failureMarker.getReason().toString());
      }
    }
  }
View Full Code Here


   
    for(FetchFailedMarker marker : getExpiredFetchFailedMarkers(now)) {
      synchronized(Persistent.transactionLock(db)) {
        try {
          if(marker instanceof MessageFetchFailedMarker) {
            MessageFetchFailedMarker m = (MessageFetchFailedMarker)marker;
            MessageReference ref = m.getMessageReference();
            ref.clearMessageWasDownloadedFlag();
            ref.storeWithoutCommit();
          } else if(marker instanceof MessageListFetchFailedMarker) {
            MessageListFetchFailedMarker m = (MessageListFetchFailedMarker)marker;
            try {
              MessageList list = getMessageList(m.getMessageListID());
              list.deleteWithoutCommit();
             
              final IdentityStatistics stats = getOrCreateIdentityStatistics(list.getAuthor());
              stats.onMessageListDeleted(list);
              stats.storeWithoutCommit();
             
              m.storeWithoutCommit(); // MessageList.deleteWithoutCommit deletes it.
            }
            catch(NoSuchMessageListException e) {
              // The marker was already processed.
            }
          } else
View Full Code Here

TOP

Related Classes of plugins.Freetalk.MessageList.MessageFetchFailedMarker

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.