Back to index

lightning-sunbird  0.9+nobinonly
nsMsgComposeParams.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; 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  *   Jean-Francois Ducarroz <ducarroz@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 "nsMsgComposeParams.h"
00040 #include "nsReadableUtils.h"
00041 
00042 nsMsgComposeParams::nsMsgComposeParams() :
00043   mType(nsIMsgCompType::New),
00044   mFormat(nsIMsgCompFormat::Default),
00045   mBodyIsLink(PR_FALSE)
00046 {
00047 }
00048 
00049 /* the following macro actually implement addref, release and query interface for our component. */
00050 NS_IMPL_ISUPPORTS1(nsMsgComposeParams, nsIMsgComposeParams)
00051 
00052 nsMsgComposeParams::~nsMsgComposeParams()
00053 {
00054 }
00055 
00056 /* attribute MSG_ComposeType type; */
00057 NS_IMETHODIMP nsMsgComposeParams::GetType(MSG_ComposeType *aType)
00058 {
00059   NS_ENSURE_ARG_POINTER(aType);
00060   
00061   *aType = mType;
00062   return NS_OK;
00063 }
00064 NS_IMETHODIMP nsMsgComposeParams::SetType(MSG_ComposeType aType)
00065 {
00066   mType = aType;
00067   return NS_OK;
00068 }
00069 
00070 /* attribute MSG_ComposeFormat format; */
00071 NS_IMETHODIMP nsMsgComposeParams::GetFormat(MSG_ComposeFormat *aFormat)
00072 {
00073   NS_ENSURE_ARG_POINTER(aFormat);
00074   
00075   *aFormat = mFormat;
00076   return NS_OK;
00077 }
00078 NS_IMETHODIMP nsMsgComposeParams::SetFormat(MSG_ComposeFormat aFormat)
00079 {
00080   mFormat = aFormat;
00081   return NS_OK;
00082 }
00083 
00084 /* attribute string originalMsgURI; */
00085 NS_IMETHODIMP nsMsgComposeParams::GetOriginalMsgURI(char * *aOriginalMsgURI)
00086 {
00087   NS_ENSURE_ARG_POINTER(aOriginalMsgURI);
00088   
00089   *aOriginalMsgURI = ToNewCString(mOriginalMsgUri);
00090   return NS_OK;
00091 }
00092 NS_IMETHODIMP nsMsgComposeParams::SetOriginalMsgURI(const char * aOriginalMsgURI)
00093 {
00094   mOriginalMsgUri = aOriginalMsgURI;
00095   return NS_OK;
00096 }
00097 
00098 /* attribute nsIMsgIdentity identity; */
00099 NS_IMETHODIMP nsMsgComposeParams::GetIdentity(nsIMsgIdentity * *aIdentity)
00100 {
00101   NS_ENSURE_ARG_POINTER(aIdentity);
00102   NS_IF_ADDREF(*aIdentity = mIdentity);
00103   return NS_OK;
00104 }
00105 
00106 NS_IMETHODIMP nsMsgComposeParams::SetIdentity(nsIMsgIdentity * aIdentity)
00107 {
00108   mIdentity = aIdentity;
00109   return NS_OK;
00110 }
00111 
00112 NS_IMETHODIMP nsMsgComposeParams::SetOrigMsgHdr(nsIMsgDBHdr *aMsgHdr)
00113 {
00114   mOrigMsgHdr = aMsgHdr;
00115   return NS_OK;
00116 }
00117 
00118 NS_IMETHODIMP nsMsgComposeParams::GetOrigMsgHdr(nsIMsgDBHdr * *aMsgHdr)
00119 {
00120   NS_ENSURE_ARG_POINTER(aMsgHdr);
00121   NS_IF_ADDREF(*aMsgHdr = mOrigMsgHdr);
00122   return NS_OK;
00123 }
00124 
00125 /* attribute nsIMsgCompFields composeFields; */
00126 NS_IMETHODIMP nsMsgComposeParams::GetComposeFields(nsIMsgCompFields * *aComposeFields)
00127 {
00128   NS_ENSURE_ARG_POINTER(aComposeFields);
00129   
00130   if (mComposeFields)
00131   {
00132      *aComposeFields = mComposeFields;
00133      NS_ADDREF(*aComposeFields);
00134   }
00135   else
00136     *aComposeFields = nsnull;
00137   return NS_OK;
00138 }
00139 NS_IMETHODIMP nsMsgComposeParams::SetComposeFields(nsIMsgCompFields * aComposeFields)
00140 {
00141   mComposeFields = aComposeFields;
00142   return NS_OK;
00143 }
00144 
00145 /* attribute boolean bodyIsLink; */
00146 NS_IMETHODIMP nsMsgComposeParams::GetBodyIsLink(PRBool *aBodyIsLink)
00147 {
00148   NS_ENSURE_ARG_POINTER(aBodyIsLink);
00149   
00150   *aBodyIsLink = mBodyIsLink;
00151   return NS_OK;
00152 }
00153 NS_IMETHODIMP nsMsgComposeParams::SetBodyIsLink(PRBool aBodyIsLink)
00154 {
00155   mBodyIsLink = aBodyIsLink;
00156   return NS_OK;
00157 }
00158 
00159 /* attribute nsIMsgSendLisneter sendListener; */
00160 NS_IMETHODIMP nsMsgComposeParams::GetSendListener(nsIMsgSendListener * *aSendListener)
00161 {
00162   NS_ENSURE_ARG_POINTER(aSendListener);
00163   
00164   if (mSendListener)
00165   {
00166      *aSendListener = mSendListener;
00167      NS_ADDREF(*aSendListener);
00168   }
00169   else
00170     *aSendListener = nsnull;
00171   return NS_OK;
00172 }
00173 NS_IMETHODIMP nsMsgComposeParams::SetSendListener(nsIMsgSendListener * aSendListener)
00174 {
00175   mSendListener = aSendListener;
00176   return NS_OK;
00177 }
00178 
00179 /* attribute string smtpPassword; */
00180 NS_IMETHODIMP nsMsgComposeParams::GetSmtpPassword(char * *aSmtpPassword)
00181 {
00182   NS_ENSURE_ARG_POINTER(aSmtpPassword);
00183   
00184   *aSmtpPassword = ToNewCString(mSMTPPassword);
00185   return NS_OK;
00186 }
00187 NS_IMETHODIMP nsMsgComposeParams::SetSmtpPassword(const char * aSmtpPassword)
00188 {
00189   mSMTPPassword = aSmtpPassword;
00190   return NS_OK;
00191 }
00192