Back to index

lightning-sunbird  0.9+nobinonly
nsSmtpUrl.h
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) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef nsSmtpUrl_h__
00039 #define nsSmtpUrl_h__
00040 
00041 #include "nsISmtpUrl.h"
00042 #include "nsIURI.h"
00043 #include "nsMsgMailNewsUrl.h"
00044 #include "nsIFileSpec.h"
00045 #include "nsIMsgIdentity.h"
00046 #include "nsCOMPtr.h"
00047 #include "nsIPrompt.h"
00048 #include "nsIAuthPrompt.h"
00049 #include "nsISmtpServer.h"
00050 #include "nsIInterfaceRequestor.h"
00051 #include "nsIInterfaceRequestorUtils.h"
00052 
00053 class nsMailtoUrl : public nsIMailtoUrl, public nsIURI
00054 {
00055 public:
00056     NS_DECL_ISUPPORTS
00057     NS_DECL_NSIURI
00058     NS_DECL_NSIMAILTOURL
00059 
00060     nsMailtoUrl();
00061 
00062 protected:
00063   virtual ~nsMailtoUrl();
00064   nsresult ParseUrl();
00065   nsresult CleanupMailtoState();
00066   nsresult ParseMailtoUrl(char * searchPart);
00067 
00068   nsCOMPtr<nsIURI> m_baseURL;
00069     
00070   // data retrieved from parsing the url: (Note the url could be a post from file or it could be in the url)
00071   nsCString m_toPart;
00072        nsCString m_ccPart;
00073        nsCString     m_subjectPart;
00074        nsCString     m_newsgroupPart;
00075        nsCString     m_newsHostPart;
00076        nsCString     m_referencePart;
00077        nsCString     m_bodyPart;
00078        nsCString     m_bccPart;
00079        nsCString     m_followUpToPart;
00080        nsCString     m_fromPart;
00081        nsCString     m_htmlPart;
00082        nsCString     m_organizationPart;
00083        nsCString     m_replyToPart;
00084        nsCString     m_priorityPart;
00085 
00086   MSG_ComposeFormat mFormat;
00087 };
00088 
00089 class nsSmtpUrl : public nsISmtpUrl, public nsMsgMailNewsUrl
00090 {
00091 public:
00092        NS_DECL_ISUPPORTS_INHERITED
00093 
00094        // nsIURI over-ride...
00095        NS_IMETHOD SetSpec(const nsACString &aSpec);
00096 
00097        // From nsISmtpUrl
00098        NS_DECL_NSISMTPURL
00099 
00100        // nsSmtpUrl
00101     nsSmtpUrl();
00102 
00103 protected:
00104   virtual ~nsSmtpUrl();
00105        
00106   // protocol specific code to parse a url...
00107   virtual nsresult ParseUrl();
00108        virtual const char * GetUserName() { return m_userName.get();}
00109 
00110        // data retrieved from parsing the url: (Note the url could be a post from file or it could be inthe url)
00111   nsCString   m_toPart;
00112 
00113        PRBool        m_isPostMessage;
00114 
00115        /* Smtp specific event sinks */
00116        nsCString     m_userName;
00117        nsCOMPtr<nsIFileSpec> m_fileName;
00118        nsCOMPtr<nsIMsgIdentity> m_senderIdentity;
00119     nsCOMPtr<nsIPrompt> m_netPrompt;
00120     nsCOMPtr<nsIAuthPrompt> m_netAuthPrompt;
00121     nsCOMPtr<nsIInterfaceRequestor> m_callbacks;
00122     nsCOMPtr<nsISmtpServer> m_smtpServer;
00123 
00124        // it is possible to encode the message to parse in the form of a url.
00125        // This function is used to decompose the search and path part into the bare
00126        // message components (to, fcc, bcc, etc.)
00127        nsresult ParseMessageToPost(char * searchPart);
00128 };
00129 
00130 #endif // nsSmtpUrl_h__