Back to index

lightning-sunbird  0.9+nobinonly
nsIMsgIncomingServer.idl
Go to the documentation of this file.
00001 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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) 1998
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 "MailNewsTypes2.idl"
00041 
00042 interface nsIFileSpec;
00043 interface nsIMsgFolder;
00044 interface nsIMsgFolderCache;
00045 interface nsIMsgWindow;
00046 interface nsIMsgFilterList;
00047 interface nsIMsgRetentionSettings;
00048 interface nsIMsgDownloadSettings;
00049 interface nsISpamSettings;
00050 interface nsIMsgFilterPlugin;
00051 interface nsIUrlListener;
00052 interface nsIMsgDBHdr;
00053 /*
00054  * Interface for incoming mail/news host
00055  * this is the base interface for all mail server types (imap, pop, nntp, etc)
00056  * often you will want to add extra interfaces that give you server-specific
00057  * attributes and methods.
00058  */
00059 [scriptable, uuid(DBA43E06-A4B2-4c9e-B4D5-002504F63212)]
00060 interface nsIMsgIncomingServer : nsISupports {
00061 
00065   attribute string key;
00066 
00071   attribute wstring prettyName;
00072 
00077   readonly attribute wstring constructedPrettyName;
00078 
00082   attribute string hostName;
00083   
00087   attribute string realHostName;
00088   
00089   /* port of the server */
00090   attribute long port;
00091 
00095   attribute string username;
00096 
00100   attribute string realUsername;
00101 
00106   attribute string type;
00107 
00108   readonly attribute AString accountManagerChrome;
00109 
00115   readonly attribute string localStoreType;
00116 
00117   // Perform specific tasks (reset flags, remove files, etc) for account user/server name changes.
00118   void OnUserOrHostNameChanged(in string oldName, in string newName);
00119   
00120   /* should we remember the password? */
00121   attribute boolean rememberPassword;
00122 
00123   /* cleartext version of the password */
00124   attribute string password;
00125 
00126   /* prompt the user for a password */
00127   string getPasswordWithUI(in wstring aPromptString, in wstring aPromptTitle, in nsIMsgWindow aMsgWindow, out boolean okayValue);
00128 
00129   /* forget the password in memory and in single signon database */
00130   void forgetPassword();
00131 
00135   void storePassword(); 
00136 
00137   /* forget the password in memory which is cached for the session */
00138   void forgetSessionPassword();
00139 
00140   /* should we download whole messages when biff goes off? */
00141   /* in 4.x, this was "mail.pop3_gets_new_mail" for pop */
00142   /* "mail.imap.new_mail_get_headers" for imap, and it was global.  in 5.x, it is per server */
00143   attribute boolean downloadOnBiff;
00144 
00145   /* should we biff the server? */
00146   attribute boolean doBiff;
00147 
00148   /* how often to biff */
00149   attribute long biffMinutes;
00150 
00151   /* current biff state */
00152   attribute unsigned long biffState;
00153 
00154   /* are we running a url as a result of biff going off? (different from user clicking get msg) */
00155   attribute boolean performingBiff; 
00156 
00157   /* the on-disk path to message storage for this server */
00158   attribute nsIFileSpec localPath;
00159 
00160   /* the RDF URI for the root mail folder */
00161   readonly attribute string serverURI;
00162 
00163   /* the root folder for this server, even if server is deferred */
00164   attribute nsIMsgFolder rootFolder;
00165 
00166   /* root folder for this account 
00167      - if account is deferred, root folder of deferred-to account */
00168   readonly attribute nsIMsgFolder rootMsgFolder;
00169 
00170   /* are we already getting new Messages on the current server..
00171      This is used to help us prevent multiple get new msg commands from
00172      going off at the same time. */
00173   attribute boolean serverBusy;
00174 
00175   /* should we use a secure channel? */
00176   attribute boolean isSecure;
00177 
00178   /* should we use secure authentication? */
00179   attribute boolean useSecAuth;
00180 
00181   const long defaultSocket = 0;
00182   const long tryTLS = 1;
00183   const long alwaysUseTLS = 2;
00184   const long useSSL = 3;
00185 
00186   /* use above values */
00187   attribute long socketType;
00188 
00189   /* if a logon mechanism fails, should we fallback to a different
00190      mechanism?
00191   */
00192   attribute boolean logonFallback;
00193 
00194   /* can server support a secure channel? */
00195   readonly attribute boolean isSecureServer;
00196 
00197   /* what kind of logon redirector to use for this server, if any */
00198   attribute string redirectorType;
00199 
00200   /* empty trash on exit */
00201   attribute boolean emptyTrashOnExit;
00202 
00203   /* get filter list */
00204   nsIMsgFilterList getFilterList(in nsIMsgWindow aMsgWindow);
00205 
00206   /* set filter list */
00207   void setFilterList(in nsIMsgFilterList aFilterList);
00208 
00209   /* we use this to set the default local path.  we use this when migrating prefs */
00210   void SetDefaultLocalPath(in nsIFileSpec aDefaultLocalPath);
00211 
00212   /* do a biff */
00213   void PerformBiff(in nsIMsgWindow aMsgWindow);
00214   
00215   /* get new messages */
00216   void getNewMessages(in nsIMsgFolder aFolder, in nsIMsgWindow aMsgWindow, 
00217                       in nsIUrlListener aUrlListener);
00218   /* this checks if a server needs a password to do biff */
00219   readonly attribute boolean serverRequiresPasswordForBiff;
00220   
00221   /* this gets called when the server is expanded in the folder pane */
00222   void performExpand(in nsIMsgWindow aMsgWindow);
00223 
00224   /* Write out all known folder data to panacea.dat */
00225   void WriteToFolderCache(in nsIMsgFolderCache folderCache);
00226 
00227   /* close any server connections */
00228   void CloseCachedConnections();
00229  
00230   /* ... */
00231   void shutdown();
00232 
00233   /* access to generic attributes */
00234   boolean getBoolValue(in string attr);
00235   void setBoolValue(in string attr, in boolean value);
00236 
00237   string getCharValue(in string attr);
00238   void setCharValue(in string attr, in string value);
00239 
00240   wstring getUnicharValue(in string attr);
00241   void setUnicharValue(in string attr, in wstring value);
00242   
00243   long getIntValue(in string attr);
00244   void setIntValue(in string attr, in long value);
00245 
00246   nsIFileSpec getFileValue(in string attr);
00247   void setFileValue(in string attr, in nsIFileSpec value);
00248 
00253   void clearAllValues();
00254 
00259   void removeFiles();
00260   
00261   attribute boolean valid;
00262   
00263   wstring toString();
00264 
00265   void displayOfflineMsg(in nsIMsgWindow aWindow);
00266 
00267   /* used for comparing nsIMsgIncomingServers */
00268   boolean equals(in nsIMsgIncomingServer server);
00269 
00270   /* Get Messages at startup */
00271   readonly attribute boolean downloadMessagesAtStartup; 
00272 
00273   /* check to this if the server supports filters */
00274   readonly attribute boolean canHaveFilters;
00275 
00280   attribute boolean canDelete;
00281 
00282   attribute boolean loginAtStartUp;
00283 
00284   attribute boolean limitOfflineMessageSize;
00285   attribute long maxMessageSize;
00286 
00287   attribute nsIMsgRetentionSettings retentionSettings;
00288 
00289   /* check if this server can be a default server */
00290   readonly attribute boolean canBeDefaultServer;
00291 
00292   /* check if this server allows search operations */
00293   readonly attribute boolean canSearchMessages;
00294 
00295   /* check if this server allows canEmptyTrashOnExit operations */
00296   readonly attribute boolean canEmptyTrashOnExit;
00297 
00298   /* display startup page once per account per session */
00299   attribute boolean displayStartupPage;
00300   attribute nsIMsgDownloadSettings downloadSettings;
00301 
00302   /*
00303    * Offline support level. Support level can vary based on abilities 
00304    * and features each server can offer wrt to offline service.
00305    * Here is the legend to determine the each support level details
00306    *
00307    * supportLevel == 0  --> no offline support (default) 
00308    * supportLevel == 10 --> regular offline feature support
00309    * supportLevel == 20 --> extended offline feature support 
00310    *
00311    * Each server can initialize itself to the support level if needed
00312    * to override the default choice i.e., no offline support.
00313    *
00314    * POP3, None and Movemail will default to 0. 
00315    * IMAP level 10 and NEWS with level 20. 
00316    * 
00317    */
00318   attribute long offlineSupportLevel;
00319 
00320   /* create pretty name for migrated accounts */
00321   wstring generatePrettyNameForMigration(); 
00322 
00323   /* does this server have disk space settings? */
00324   readonly attribute boolean supportsDiskSpace;
00325 
00337   attribute boolean defaultCopiesAndFoldersPrefsToServer;
00338 
00339   /* can this server allows sub folder creation */
00340   attribute boolean canCreateFoldersOnServer;
00341 
00342   /* can this server allows message filing ? */
00343   attribute boolean canFileMessagesOnServer;
00344 
00345   /* can this server allow compacting folders ? */
00346   readonly attribute boolean canCompactFoldersOnServer;
00347 
00348   /* can this server allow undo delete ? */
00349   readonly attribute boolean canUndoDeleteOnServer;
00350 
00351   /* used for setting up the filter UI */
00352   readonly attribute nsMsgSearchScopeValue filterScope;
00353 
00354   /* used for setting up the search UI */
00355   readonly attribute nsMsgSearchScopeValue searchScope;
00356 
00361   wstring getUnicharAttribute(in string name);
00362   void setUnicharAttribute(in string name, in wstring value);
00363   
00364   string getCharAttribute(in string name);
00365   void setCharAttribute(in string name, in string value);
00366 
00367   boolean getBoolAttribute(in string name);
00368   void setBoolAttribute(in string name, in boolean value);
00369 
00370   long getIntAttribute(in string name);
00371   void setIntAttribute(in string name, in long value);
00372 
00379   readonly attribute boolean passwordPromptRequired;
00380 
00392   void configureTemporaryFilters(in nsIMsgFilterList filterList);
00393 
00399   void clearTemporaryReturnReceiptsFilter();
00400 
00404   readonly attribute nsISpamSettings spamSettings;
00405   readonly attribute nsIMsgFilterPlugin spamFilterPlugin;
00406 
00407   nsIMsgFolder getMsgFolderFromURI(in nsIMsgFolder aFolderResource, in string aURI);
00408 
00409   readonly attribute boolean isDeferredTo;
00410 
00411   const long keepDups = 0;
00412   const long deleteDups = 1;
00413   const long moveDupsToTrash = 2;
00414   const long markDupsRead = 3;
00415 
00416   attribute long incomingDuplicateAction;
00417 
00418   // check if new hdr is a duplicate of a recently arrived header
00419   boolean isNewHdrDuplicate(in nsIMsgDBHdr aNewHdr);
00420 };
00421 
00422 %{C++
00423 /*
00424  * Following values for offline support have been used by
00425  * various files. If you are modifying any of the values
00426  * below, please do take care of the following files.
00427  * - mozilla/mailnews/base/src/nsMsgAccountManagerDS.cpp
00428  * - mozilla/mailnews/base/util/nsMsgIncomingServer.cpp
00429  * - mozilla/mailnews/imap/src/nsImapIncomingServer.cpp
00430  * - mozilla/mailnews/local/src/nsPop3IncomingServer.cpp
00431  * - mozilla/mailnews/news/src/nsNntpIncomingServer.cpp
00432  * - mozilla/mailnews/base/resources/content/msgAccountCentral.js
00433  * - mozilla/modules/libpref/src/init/mailnews.js
00434  * - ns/modules/libpref/src/init/mailnews-ns.js
00435  * - ns/mailnews/base/ispdata/aol.rdf
00436  * - ns/mailnews/base/ispdata/nswebmail.rdf
00437  */
00438 #define OFFLINE_SUPPORT_LEVEL_NONE 0
00439 #define OFFLINE_SUPPORT_LEVEL_REGULAR 10
00440 #define OFFLINE_SUPPORT_LEVEL_EXTENDED 20
00441 #define OFFLINE_SUPPORT_LEVEL_UNDEFINED -1
00442 
00443 // Value when no port setting is found
00444 #define PORT_NOT_SET -1
00445 
00446 /* some useful macros to implement nsIMsgIncomingServer accessors */
00447 #define NS_IMPL_SERVERPREF_STR(_class, _postfix, _prefname)    \
00448 NS_IMETHODIMP                                                         \
00449 _class::Get##_postfix(char **retval)                    \
00450 {                                                                                   \
00451   return GetCharValue(_prefname, retval);        \
00452 }                                                                                   \
00453 NS_IMETHODIMP                                                         \
00454 _class::Set##_postfix(const char *chvalue)                     \
00455 {                                                                                   \
00456   return SetCharValue(_prefname, chvalue);              \
00457 }
00458 
00459 #define NS_IMPL_SERVERPREF_BOOL(_class, _postfix, _prefname)\
00460 NS_IMETHODIMP                                                         \
00461 _class::Get##_postfix(PRBool *retval)            \
00462 {                                                                                   \
00463   return GetBoolValue(_prefname, retval);        \
00464 }                                                                                   \
00465 NS_IMETHODIMP                                                         \
00466 _class::Set##_postfix(PRBool bvalue)                    \
00467 {                                                                                   \
00468   return SetBoolValue(_prefname, bvalue);        \
00469 }
00470 
00471 #define NS_IMPL_SERVERPREF_INT(_class, _postfix, _prefname)\
00472 NS_IMETHODIMP                                                         \
00473 _class::Get##_postfix(PRInt32 *retval)           \
00474 {                                                                                   \
00475   return GetIntValue(_prefname, retval);                \
00476 }                                                                                   \
00477 NS_IMETHODIMP                                                         \
00478 _class::Set##_postfix(PRInt32 ivalue)                   \
00479 {                                                                                   \
00480   return SetIntValue(_prefname, ivalue);                \
00481 }
00482 
00483 #define NS_IMPL_SERVERPREF_FILE(_class, _postfix, _prefname)\
00484 NS_IMETHODIMP                                                         \
00485 _class::Get##_postfix(nsIFileSpec **retval)             \
00486 {                                                                                   \
00487   return GetFileValue(_prefname, retval);               \
00488 }                                                                                   \
00489 NS_IMETHODIMP                                                         \
00490 _class::Set##_postfix(nsIFileSpec* ivalue)                     \
00491 {                                                                                   \
00492   return SetFileValue(_prefname, ivalue);               \
00493 }
00494 
00495 
00496 %}