Package plugins.Freetalk

Examples of plugins.Freetalk.Board


    super.setUp();

    mMessageManager = mFreetalk.getMessageManager();
    mXML = new WoTMessageXML();
   
    Board myBoard = mMessageManager.getOrCreateBoard("eng.board1");
    HashSet<Board> myBoards = new HashSet<Board>();
    myBoards.add(myBoard);
    myBoards.add(mMessageManager.getOrCreateBoard("eng.board2"));
   
    FreenetURI authorRequestSSK = new FreenetURI("SSK@nU16TNCS7~isPTa9gw6nF8c3lQpJGFHA2KwTToMJuNk,FjCiOUGSl6ipOE9glNai9WCp1vPM8k181Gjw62HhYSo,AQACAAE/");
View Full Code Here


  private void addThreadIsNoThreadWarning(Message threadWhichIsNoThread) {
    HTMLNode div = addAlertBox(l10n().getString("ThreadPage.ThreadIsNoThreadWarning.Header")).addChild("div");

    String realThreadID = threadWhichIsNoThread.getThreadIDSafe();

    Board realThreadBoard;

    // mBoard is a SubscribedBoard, getBoards() only returns a list of Board objects, so we must call getParentBoard()
    // TODO: This should be encapsulated in a function Message.containedInBoard(Board board)
    if(Arrays.binarySearch(threadWhichIsNoThread.getBoards(), mBoard.getParentBoard()) >= 0)
      realThreadBoard = mBoard;
    else {
      try {
        realThreadBoard = threadWhichIsNoThread.getReplyToBoard();
      } catch(NoSuchBoardException e) {
        // TODO: List all boards to which the original thread was sent, not only the first one
        realThreadBoard = threadWhichIsNoThread.getBoards()[0];
      }
    }

        l10n().addL10nSubstitution(
                div,
                "ThreadPage.ThreadIsNoThreadWarning.Text",
                new String[] { "link" },
                new HTMLNode[] { HTMLNode.link(getURI(realThreadBoard.getName(), realThreadID)) });
  }
View Full Code Here

  }

  private void addThreadBelongsToDifferentBoardWarning(Message thread) {
    HTMLNode div = addAlertBox(l10n().getString("ThreadPage.ThreadBelongsToDifferentBoardWarning.Header")).addChild("div");

    Board realThreadBoard;

    try {
      realThreadBoard = thread.getReplyToBoard();
    } catch(NoSuchBoardException e) {
      // TODO: List all boards to which the original thread was sent, not only the first one
      realThreadBoard = thread.getBoards()[0];
    }

        l10n().addL10nSubstitution(
                div,
                "ThreadPage.ThreadBelongsToDifferentBoardWarning.Text",
                new String[] { "link" },
                new HTMLNode[] { HTMLNode.link(getURI(realThreadBoard.getName(), thread.isThread() ? thread.getID() : thread.getThreadIDSafe())) });
  }
View Full Code Here

      }
     
      // Reply-to board
     
      try {
        final Board replyToBoard = m.getReplyToBoard();
        final Element replyBoardTag = xmlDoc.createElement("ReplyToBoard");
        replyBoardTag.setAttribute("Name", replyToBoard.getName());
        boardsTag.appendChild(replyBoardTag);
      } catch(NoSuchBoardException e) {}
     
      messageElement.appendChild(boardsTag);
View Full Code Here

    }
   
    // ReplyTo board
   
    final Element replyToBoardElement = (Element)boardsElement.getElementsByTagName("ReplyToBoard").item(0);
    final Board messageReplyToBoard =  replyToBoardElement != null ? myFreetalk.getMessageManager().getOrCreateBoard(replyToBoardElement.getAttribute("Name")) : null;
   
    // Parent / thread URI
   
    WoTMessageURI parentMessageURI = null;
    WoTMessageURI parentThreadURI = null;
View Full Code Here

            final String boardName = getMandatoryParameter(params, "BoardName");
            if (!Board.isNameValid(boardName)) {
                throw new InvalidParameterException("BoardName parameter is not valid");
            }

            Board board;
            synchronized(mFreetalk.getMessageManager()) {

                try {
                    mFreetalk.getMessageManager().getBoardByName(boardName);
                    throw new InvalidParameterException("Board with same name already exists");
                } catch (final NoSuchBoardException e) {
                }

                board = mFreetalk.getMessageManager().getOrCreateBoard(boardName);
            }

            // board can't be null when we come here
            final SimpleFieldSet sfs = new SimpleFieldSet(true);
            sfs.putOverwrite("Message", "CreateBoardReply");
            sfs.putOverwrite("BoardCreated", "true");
            sfs.putOverwrite("StoredBoardName", board.getName());
            sfs.putOverwrite("ID", board.getID());
            replysender.send(sfs);

        } catch(final Exception e) {
            final SimpleFieldSet sfs = new SimpleFieldSet(true);
            sfs.putOverwrite("Message", "CreateBoardReply");
View Full Code Here

                    targetBoardName = targetBoardName.trim();
                    if (targetBoardName.length() == 0) {
                        throw new InvalidParameterException("Invalid TargetBoards parameter specified");
                    }
                    try {
                        final Board board = mFreetalk.getMessageManager().getBoardByName(targetBoardName);
                        targetBoards.add(board);
                    } catch(final NoSuchBoardException e) {
                        throw new InvalidParameterException("TargetBoard '"+targetBoardName+"' does not exist");
                    }
                }

                // evaluate replyToBoard
                final String replyToBoardName = params.get("ReplyToBoard"); // may be null
                Board replyToBoard = null;
                if (replyToBoardName != null ) {
                    try {
                        replyToBoard = mFreetalk.getMessageManager().getBoardByName(replyToBoardName);
                    } catch(final NoSuchBoardException e) {
                        throw new InvalidParameterException("ReplyToBoard '"+replyToBoardName+"' does not exist");
View Full Code Here

    case SUBJECT:
      return mMessage.getTitle();

    case NEWSGROUPS:
      final Board boards[] = mMessage.getBoards();
      final StringBuilder builder = new StringBuilder(1024);

      builder.append(FreetalkNNTPGroup.boardToGroupName(boards[0].getName()));

      for (int i = 1; i < boards.length; i++) {
        builder.append(", ");
        builder.append(FreetalkNNTPGroup.boardToGroupName(boards[i].getName()));
      }

      return builder.toString();

    case FOLLOWUP_TO:
      try {
        final Board board = mMessage.getReplyToBoard();
        return FreetalkNNTPGroup.boardToGroupName(board.getName());
      } catch(NoSuchBoardException e) {
        return "";
      }

    case DATE:
View Full Code Here

TOP

Related Classes of plugins.Freetalk.Board

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.