Package plugins.Freetalk

Examples of plugins.Freetalk.OwnMessage


      /* Important: A OwnMessageList contains a single reference for each message. A MessageList however contains a message reference
       * for each board a message is posted to. If this function is changed to be able to encode non-own MessageLists then you need
       * to ensure that each message is only listed once, the for(each MessageReference) will return duplicates if a message is posted
       * to multiple boards.*/
      for(final MessageList.MessageReference ref : list) {
        final OwnMessage message = messageManager.getOwnMessage(ref.getMessageID());
       
        // Duplicate checks to prevent severe breakage, also done in message list constructor.
        if(message.getAuthor() != list.getAuthor())
          throw new RuntimeException("Message author does not match message list author");
       
        if(message.wasInserted() == false)
          throw new RuntimeException("Trying to convert a MessageList to XML which contains a not inserted message.");
       
        final Element messageElement = xmlDoc.createElement("Message");
       
        // ID
       
        messageElement.setAttribute("ID", message.getID());
       
        // URI

        messageElement.setAttribute("FreenetURI", message.getFreenetURI().toString());
       
        // Date
       
        synchronized(mDateFormat) {
          messageElement.setAttribute("Date", mDateFormat.format(message.getDate()));
        }
       
        // Boards
       
        for(final Board board : message.getBoards()) {
          final Element boardTag = xmlDoc.createElement("Board");
          boardTag.setAttribute("Name", board.getName());
          messageElement.appendChild(boardTag);
        }
 
View Full Code Here


                    if (parentMessage != null) {
                        parentMessageURI = parentMessage.isThread() ? parentMessage.getURI() : parentMessage.getThreadURI();
                    }

                    final HashSet<String> boardSet = new HashSet<String>(parser.getBoards());
                    final OwnMessage message = mMessageManager.postMessage(parentMessageURI,
                        parentMessage, boardSet, parser.getReplyToBoard(), mAuthenticatedUser, parser.getTitle(), parser.getDate(), parser.getText(), null);
                    printStatusLine("240 Message posted; ID is <" + message.getID() + ">");
                }
                catch (Exception e) {
                    Logger.error(this, "Error posting message: ", e);
                    printStatusLine("441 Posting failed");
                }
View Full Code Here

TOP

Related Classes of plugins.Freetalk.OwnMessage

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.