Back to index

lightning-sunbird  0.9+nobinonly
nsIMsgFilterList.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1999
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Seth Spitzer <sspitzer@netscape.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #include "nsISupports.idl"
00040 #include "nsMsgFilterCore.idl"
00041 #include "nsIMsgFilter.idl"
00042 #include "nsIMsgFilterHitNotify.idl"
00043 
00044 interface nsIOFileStream;
00045 interface nsIOutputStream;
00046 
00048 // The Msg Filter List is an interface designed to make accessing filter lists
00049 // easier. Clients typically open a filter list and either enumerate the filters,
00050 // or add new filters, or change the order around...
00051 //
00053 
00054 typedef long nsMsgFilterFileAttribValue;
00055 
00056 [scriptable, uuid(ab0105ad-86bf-4862-9adb-84f4e266577c)]
00057 interface nsIMsgFilterList : nsISupports {
00058 
00059     const nsMsgFilterFileAttribValue attribNone = 0;
00060     const nsMsgFilterFileAttribValue attribVersion = 1;
00061     const nsMsgFilterFileAttribValue attribLogging = 2;
00062     const nsMsgFilterFileAttribValue attribName = 3;
00063     const nsMsgFilterFileAttribValue attribEnabled = 4; 
00064     const nsMsgFilterFileAttribValue attribDescription = 5; 
00065     const nsMsgFilterFileAttribValue attribType = 6;
00066     const nsMsgFilterFileAttribValue attribScriptFile = 7; 
00067     const nsMsgFilterFileAttribValue attribAction = 8; 
00068     const nsMsgFilterFileAttribValue attribActionValue = 9; 
00069     const nsMsgFilterFileAttribValue attribCondition = 10;
00070 
00071     attribute nsIMsgFolder folder;
00072     readonly attribute short version;
00073     readonly attribute string arbitraryHeaders;
00074     readonly attribute boolean shouldDownloadAllHeaders;
00075     readonly attribute unsigned long filterCount;
00076     nsIMsgFilter getFilterAt(in unsigned long filterIndex);
00077     nsIMsgFilter getFilterNamed(in wstring filterName);
00078 
00079     void setFilterAt(in unsigned long filterIndex, in nsIMsgFilter filter);
00080     void removeFilter(in nsIMsgFilter filter);
00081     void removeFilterAt(in unsigned long filterIndex);
00082     
00083     void moveFilterAt(in unsigned long filterIndex,
00084                       in nsMsgFilterMotionValue motion);
00085     void moveFilter(in nsIMsgFilter filter,
00086                     in nsMsgFilterMotionValue motion);
00087     
00088     void insertFilterAt(in unsigned long filterIndex, in nsIMsgFilter filter);
00089 
00090     attribute boolean loggingEnabled;
00091 
00092     nsIMsgFilter createFilter(in wstring name);
00093 
00094     void saveToFile(in nsIOFileStream stream);
00095 
00096     void parseCondition(in nsIMsgFilter aFilter, in string condition);
00097     // this is temporary so that we can save the filterlist to disk
00098     // without knowing where the filters were read from intially
00099     // (such as the filter list dialog)
00100     attribute nsIFileSpec defaultFile;
00101     void saveToDefaultFile();
00102     
00103 
00104     // marking noscript because headers is a null-separated list
00105     // of strings, which is not scriptable
00106     [noscript]
00107     void applyFiltersToHdr(in nsMsgFilterTypeType filterType,
00108                            in nsIMsgDBHdr msgHdr,
00109                            in nsIMsgFolder folder,
00110                            in nsIMsgDatabase db,
00111                            in string headers,
00112                            //[array, size_is(headerSize)] in string headers,
00113                            in unsigned long headerSize,
00114                            in nsIMsgFilterHitNotify listener,
00115                            in nsIMsgWindow msgWindow,
00116                            in nsILocalFile aMessageFile);
00117 
00118     // IO routines, used by filter object filing code.
00119     void writeIntAttr(in nsMsgFilterFileAttribValue attrib, in long value, in nsIOFileStream stream);
00120     void writeStrAttr(in nsMsgFilterFileAttribValue attrib, in string value, in nsIOFileStream stream);
00121     void writeWstrAttr(in nsMsgFilterFileAttribValue attrib, in wstring value, in nsIOFileStream stream);
00122     void writeBoolAttr(in nsMsgFilterFileAttribValue attrib, in boolean value, in nsIOFileStream stream);
00123     boolean matchOrChangeFilterTarget(in string oldUri, in string newUri, in boolean caseInsensitive);
00124  
00125     // for filter logging
00126     attribute nsIOutputStream logStream;
00127     readonly attribute string logURL;
00128     void clearLog();
00129     void ensureLogFile();
00130        void flushLogIfNecessary();
00131 };
00132 
00133 
00134 /* these longs are all actually of type nsMsgFilterMotionValue */
00135 [scriptable, uuid(d067b528-304e-11d3-a0e1-00a0c900d445)]
00136 interface nsMsgFilterMotion {
00137     const long up = 0;
00138     const long down = 1;
00139 };