Author: xor
Date: 2008-10-28 13:41:14 +0000 (Tue, 28 Oct 2008)
New Revision: 23152

Modified:
   trunk/plugins/FMSPlugin/FMSBoard.java
Log:
Implement basic functions.

Modified: trunk/plugins/FMSPlugin/FMSBoard.java
===================================================================
--- trunk/plugins/FMSPlugin/FMSBoard.java       2008-10-28 13:40:54 UTC (rev 
23151)
+++ trunk/plugins/FMSPlugin/FMSBoard.java       2008-10-28 13:41:14 UTC (rev 
23152)
@@ -11,12 +11,19 @@
  */
 public class FMSBoard {

+       private final FMSMessageManager mMessageManager;
        private final String mName;
        private String mDescription;

-       public FMSBoard(String newName, String newDescription) {
+       public FMSBoard(FMSMessageManager newMessageManager, String newName, 
String newDescription) {
+               if(newName==null || newName.isEmpty())
+                       throw new IllegalArgumentException("Empty board name.");
+               
+               assert(newMessageManager != null);
+               mMessageManager = newMessageManager;
+               // FIXME: Remove anything dangerous from name and description.
                mName = newName;
-               mDescription = newDescription;
+               setDescription(newDescription);
        }

        /**
@@ -25,12 +32,13 @@
        public String getDescription() {
                return mDescription;
        }
-
+       
        /**
         * @param description The description to set.
         */
        public void setDescription(String newDescription) {
-               mDescription = newDescription;
+               //FIXME: Remove anything dangerous from description.
+               mDescription = newDescription!=null ? newDescription : "";
        }

        /**
@@ -40,9 +48,13 @@
                return mName;
        }

-       public Iterator<FMSMessage> iterator(FMSOwnIdentity identity) {
-               // TODO Auto-generated method stub
-               return null;
+       /**
+        * Get all messages in the board. The view is specified to the 
FMSOwnIdentity displaying it, therefore you have to pass one as parameter.
+        * @param identity The identity viewing the board.
+        * @return An iterator of the message which the identity will see 
(based on its trust levels).
+        */
+       public Iterator<FMSMessage> messageIterator(FMSOwnIdentity identity) {
+               return mMessageManager.messageIterator(identity);
        }

 }


Reply via email to