Back to index

lightning-sunbird  0.9+nobinonly
nsSmtpUrl.cpp
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  *
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 #include "msgCore.h"
00039 
00040 #include "nsIURI.h"
00041 #include "nsNetCID.h"
00042 #include "nsSmtpUrl.h"
00043 #include "nsString.h"
00044 #include "nsReadableUtils.h"
00045 #include "nsXPIDLString.h"
00046 #include "nsEscape.h"
00047 #include "nsIMimeConverter.h"
00048 #include "nsMsgMimeCID.h"
00049 #include "nsISupportsObsolete.h"
00050 
00051 static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
00052 
00054 // mailto url definition
00056 nsMailtoUrl::nsMailtoUrl()
00057 {
00058   mFormat = nsIMsgCompFormat::Default;
00059   m_baseURL = do_CreateInstance(kSimpleURICID);
00060 }
00061 
00062 nsMailtoUrl::~nsMailtoUrl()
00063 {
00064 }
00065 
00066 NS_IMPL_ISUPPORTS2(nsMailtoUrl, nsIMailtoUrl, nsIURI)
00067 
00068 nsresult nsMailtoUrl::ParseMailtoUrl(char * searchPart)
00069 {
00070        char *rest = searchPart;
00071         nsCAutoString inReplyToPart;
00072        // okay, first, free up all of our old search part state.....
00073        CleanupMailtoState();
00074 
00075        if (rest && *rest == '?')
00076        {
00077               /* start past the '?' */
00078               rest++;
00079        }
00080 
00081        if (rest)
00082        {
00083     char *token = nsCRT::strtok(rest, "&", &rest);
00084               while (token && *token)
00085               {
00086                      char *value = 0;
00087       char *eq = PL_strchr(token, '=');
00088                      if (eq)
00089                      {
00090                             value = eq+1;
00091                             *eq = 0;
00092                      }
00093                      
00094                      switch (nsCRT::ToUpper(*token))
00095                      {
00096 /* DO NOT support attachment= in mailto urls. This poses a security fire hole!!! 
00097                             case 'A':
00098           if (!nsCRT::strcasecmp (token, "attachment"))
00099                                      m_attachmentPart = value;
00100                               break;
00101 */
00102                             case 'B':
00103                               if (!nsCRT::strcasecmp (token, "bcc"))
00104                               {
00105                                      if (!m_bccPart.IsEmpty())
00106             {
00107                m_bccPart += ", ";
00108                m_bccPart += value;
00109             }
00110             else
00111                                        m_bccPart = value; 
00112           }
00113                                    else if (!nsCRT::strcasecmp (token, "body"))
00114                                    {
00115             if (!m_bodyPart.IsEmpty())
00116             {
00117               m_bodyPart +="\n";
00118               m_bodyPart += value;
00119             }
00120             else
00121               m_bodyPart = value;
00122           }
00123           break;
00124         case 'C': 
00125                                    if (!nsCRT::strcasecmp  (token, "cc"))
00126                                    {
00127                                           if (!m_ccPart.IsEmpty())
00128                                           {
00129               m_ccPart += ", ";
00130               m_ccPart += value;
00131                                           }
00132                                           else
00133                                                  m_ccPart = value;
00134                                    }
00135           break;
00136         case 'F': 
00137                                    if (!nsCRT::strcasecmp (token, "followup-to"))
00138                                           m_followUpToPart = value;
00139                                    else if (!nsCRT::strcasecmp (token, "from"))
00140                                           m_fromPart = value;
00141                                    break;
00142         case 'H':
00143           if (!nsCRT::strcasecmp(token, "html-part") || !nsCRT::strcasecmp (token, "html-body"))
00144           {
00145             // m_htmlPart holds the body for both html-part and html-body.
00146             m_htmlPart = value;
00147             mFormat = nsIMsgCompFormat::HTML;
00148           }
00149           break;
00150                                 case 'I':
00151                                         if (!nsCRT::strcasecmp (token, "in-reply-to"))
00152                                                 inReplyToPart = value;
00153                                         break;
00154 
00155                             case 'N':
00156                                    if (!nsCRT::strcasecmp (token, "newsgroups"))
00157                                           m_newsgroupPart = value;
00158                                    else if (!nsCRT::strcasecmp (token, "newshost"))
00159                                           m_newsHostPart = value;
00160                               break;
00161                             case 'O':
00162                                    if (!nsCRT::strcasecmp (token, "organization"))
00163                                           m_organizationPart = value;
00164                                    break;
00165         case 'R':
00166                                    if (!nsCRT::strcasecmp (token, "references"))
00167                                           m_referencePart = value;
00168                                    else if (!nsCRT::strcasecmp (token, "reply-to"))
00169                                           m_replyToPart = value;
00170                                    break;
00171                             case 'S':
00172                                    if(!nsCRT::strcasecmp (token, "subject"))
00173                                           m_subjectPart = value;
00174                                    break;
00175                             case 'P':
00176                                    if (!nsCRT::strcasecmp (token, "priority"))
00177                                           m_priorityPart = PL_strdup(value);
00178                                    break;
00179                             case 'T':
00180                                    if (!nsCRT::strcasecmp (token, "to"))
00181                               {
00182                                           if (!m_toPart.IsEmpty())
00183                                           {
00184               m_toPart += ", ";
00185               m_toPart += value;
00186                                           }
00187                                           else
00188                                                  m_toPart = value;
00189                                    }
00190                                    break;
00191         default:
00192           break;
00193       } // end of switch statement...
00194                      
00195                      if (eq)
00196                               *eq = '='; /* put it back */
00197                             token = nsCRT::strtok(rest, "&", &rest);
00198               } // while we still have part of the url to parse...
00199        } // if rest && *rest
00200 
00201   // Ensure that References and In-Reply-To are consistent...
00202   if (!inReplyToPart.IsEmpty())
00203   {
00204     if (m_referencePart.IsEmpty())
00205       m_referencePart = inReplyToPart;
00206     else
00207     {
00208       const char * lastRef = strrchr(m_referencePart.get(), '<');
00209       nsCAutoString lastReference;
00210       lastReference = lastRef ? lastRef : m_referencePart.get();
00211       if (lastReference != inReplyToPart)
00212       {
00213         m_referencePart += " ";
00214         m_referencePart += inReplyToPart;
00215       }
00216     }
00217   }
00218 
00219   nsCOMPtr<nsIMimeConverter> mimeConverter = do_GetService(NS_MIME_CONVERTER_CONTRACTID);
00220   char *decodedString;
00221 
00222   // Now unescape any fields that need escaped...
00223        if (!m_toPart.IsEmpty())
00224   {
00225               nsUnescape(m_toPart.BeginWriting());
00226     if (mimeConverter)
00227     {
00228       if (NS_SUCCEEDED(mimeConverter->DecodeMimeHeader(m_toPart.get(),
00229                                                        &decodedString,
00230                                                        "UTF-8", PR_FALSE))
00231                                                        && decodedString)
00232         m_toPart.Adopt(decodedString);
00233     }
00234   }
00235        if (!m_ccPart.IsEmpty())
00236   {
00237               nsUnescape(m_ccPart.BeginWriting());
00238     if (mimeConverter)
00239     {
00240       if (NS_SUCCEEDED(mimeConverter->DecodeMimeHeader(m_ccPart.get(),
00241                                                        &decodedString,
00242                                                        "UTF-8", PR_FALSE))
00243                                                        && decodedString)
00244         m_ccPart.Adopt(decodedString);
00245     }
00246   }
00247        if (!m_subjectPart.IsEmpty())
00248   {
00249     nsUnescape(m_subjectPart.BeginWriting());
00250     if (mimeConverter)
00251     {
00252       if (NS_SUCCEEDED(mimeConverter->DecodeMimeHeader(m_subjectPart.get(),
00253                                                        &decodedString,
00254                                                        "UTF-8", PR_FALSE))
00255                                                        && decodedString)
00256         m_subjectPart.Adopt(decodedString);
00257     }
00258   }
00259        if (!m_newsgroupPart.IsEmpty())
00260               nsUnescape(m_newsgroupPart.BeginWriting());
00261        if (!m_referencePart.IsEmpty())
00262               nsUnescape(m_referencePart.BeginWriting());
00263        if (!m_bodyPart.IsEmpty())
00264   {
00265               nsUnescape(m_bodyPart.BeginWriting());
00266     if (mimeConverter)
00267     {
00268       if (NS_SUCCEEDED(mimeConverter->DecodeMimeHeader(m_bodyPart.get(),
00269                                                        &decodedString,
00270                                                        "UTF-8", PR_FALSE,
00271                                                        PR_FALSE))
00272                                                        && decodedString)
00273         m_bodyPart.Adopt(decodedString);
00274     }
00275   }
00276        if (!m_newsHostPart.IsEmpty())
00277               nsUnescape(m_newsHostPart.BeginWriting());
00278 
00279        return NS_OK;
00280 }
00281 
00282 
00283 NS_IMETHODIMP nsMailtoUrl::SetSpec(const nsACString &aSpec)
00284 {
00285   m_baseURL->SetSpec(aSpec);
00286        return ParseUrl();
00287 }
00288 
00289 nsresult nsMailtoUrl::CleanupMailtoState()
00290 {
00291     m_ccPart = "";
00292     m_subjectPart = "";
00293     m_newsgroupPart = "";
00294     m_newsHostPart = ""; 
00295     m_referencePart = "";
00296     m_bodyPart = "";
00297     m_bccPart = "";
00298     m_followUpToPart = "";
00299     m_fromPart = "";
00300     m_htmlPart = "";
00301     m_organizationPart = "";
00302     m_replyToPart = "";
00303     m_priorityPart = "";
00304        return NS_OK;
00305 }
00306 
00307 nsresult nsMailtoUrl::ParseUrl()
00308 {
00309        nsresult rv = NS_OK;
00310 
00311   // we can get the path from the simple url.....
00312   nsCAutoString aPath;
00313   m_baseURL->GetPath(aPath);
00314   m_toPart.Assign(aPath);
00315 
00316   PRInt32 startOfSearchPart = m_toPart.FindChar('?');
00317   if (startOfSearchPart >= 0)
00318   {
00319     // now parse out the search field...
00320     nsCAutoString searchPart;
00321     PRUint32 numExtraChars = m_toPart.Right(searchPart,
00322                                             m_toPart.Length() -
00323                                             startOfSearchPart);
00324     if (!searchPart.IsEmpty())
00325     {
00326       // now we need to strip off the search part from the
00327       // to part....
00328       m_toPart.Cut(startOfSearchPart, numExtraChars);
00329       ParseMailtoUrl(searchPart.BeginWriting());
00330     }
00331        }
00332   else if (!m_toPart.IsEmpty())
00333   {
00334     nsUnescape(m_toPart.BeginWriting());
00335   }
00336 
00337   return rv;
00338 }
00339 
00340 NS_IMETHODIMP nsMailtoUrl::GetMessageContents(char ** aToPart, char ** aCcPart, char ** aBccPart, 
00341               char ** aFromPart, char ** aFollowUpToPart, char ** aOrganizationPart, 
00342               char ** aReplyToPart, char ** aSubjectPart, char ** aBodyPart, char ** aHtmlPart, 
00343               char ** aReferencePart, char ** aAttachmentPart, char ** aPriorityPart, 
00344               char ** aNewsgroupPart, char ** aNewsHostPart, MSG_ComposeFormat * aFormat)
00345 {
00346        if (aToPart)
00347               *aToPart = ToNewCString(m_toPart);
00348        if (aCcPart)
00349               *aCcPart = ToNewCString(m_ccPart);
00350        if (aBccPart)
00351               *aBccPart = ToNewCString(m_bccPart);
00352        if (aFromPart)
00353               *aFromPart = ToNewCString(m_fromPart);
00354        if (aFollowUpToPart)
00355               *aFollowUpToPart = ToNewCString(m_followUpToPart);
00356        if (aOrganizationPart)
00357               *aOrganizationPart = ToNewCString(m_organizationPart);
00358        if (aReplyToPart)
00359               *aReplyToPart = ToNewCString(m_replyToPart);
00360        if (aSubjectPart)
00361               *aSubjectPart = ToNewCString(m_subjectPart);
00362        if (aBodyPart)
00363               *aBodyPart = ToNewCString(m_bodyPart);
00364        if (aHtmlPart)
00365               *aHtmlPart = ToNewCString(m_htmlPart);
00366        if (aReferencePart)
00367               *aReferencePart = ToNewCString(m_referencePart);
00368        if (aAttachmentPart)
00369               *aAttachmentPart = nsnull; // never pass out an attachment part as part of a mailto url
00370        if (aPriorityPart)
00371               *aPriorityPart = ToNewCString(m_priorityPart);
00372        if (aNewsgroupPart)
00373               *aNewsgroupPart = ToNewCString(m_newsgroupPart);
00374        if (aNewsHostPart)
00375               *aNewsHostPart = ToNewCString(m_newsHostPart);
00376        if (aFormat)
00377               *aFormat = mFormat;
00378        return NS_OK;
00379 }
00380 
00382 // Begin nsIURI support
00384 
00385 
00386 NS_IMETHODIMP nsMailtoUrl::GetSpec(nsACString &aSpec)
00387 {
00388        return m_baseURL->GetSpec(aSpec);
00389 }
00390 
00391 NS_IMETHODIMP nsMailtoUrl::GetPrePath(nsACString &aPrePath)
00392 {
00393        return m_baseURL->GetPrePath(aPrePath);
00394 }
00395 
00396 NS_IMETHODIMP nsMailtoUrl::GetScheme(nsACString &aScheme)
00397 {
00398        return m_baseURL->GetScheme(aScheme);
00399 }
00400 
00401 NS_IMETHODIMP nsMailtoUrl::SetScheme(const nsACString &aScheme)
00402 {
00403        m_baseURL->SetScheme(aScheme);
00404        return ParseUrl();
00405 }
00406 
00407 NS_IMETHODIMP nsMailtoUrl::GetUserPass(nsACString &aUserPass)
00408 {
00409        return m_baseURL->GetUserPass(aUserPass);
00410 }
00411 
00412 NS_IMETHODIMP nsMailtoUrl::SetUserPass(const nsACString &aUserPass)
00413 {
00414        m_baseURL->SetUserPass(aUserPass);
00415        return ParseUrl();
00416 }
00417 
00418 NS_IMETHODIMP nsMailtoUrl::GetUsername(nsACString &aUsername)
00419 {
00420        return m_baseURL->GetUsername(aUsername);
00421 }
00422 
00423 NS_IMETHODIMP nsMailtoUrl::SetUsername(const nsACString &aUsername)
00424 {
00425        m_baseURL->SetUsername(aUsername);
00426        return ParseUrl();
00427 }
00428 
00429 NS_IMETHODIMP nsMailtoUrl::GetPassword(nsACString &aPassword)
00430 {
00431        return m_baseURL->GetPassword(aPassword);
00432 }
00433 
00434 NS_IMETHODIMP nsMailtoUrl::SetPassword(const nsACString &aPassword)
00435 {
00436        m_baseURL->SetPassword(aPassword);
00437        return ParseUrl();
00438 }
00439 
00440 NS_IMETHODIMP nsMailtoUrl::GetHostPort(nsACString &aHostPort)
00441 {
00442        return m_baseURL->GetHost(aHostPort);
00443 }
00444 
00445 NS_IMETHODIMP nsMailtoUrl::SetHostPort(const nsACString &aHostPort)
00446 {
00447        m_baseURL->SetHost(aHostPort);
00448        return ParseUrl();
00449 }
00450 
00451 NS_IMETHODIMP nsMailtoUrl::GetHost(nsACString &aHost)
00452 {
00453        return m_baseURL->GetHost(aHost);
00454 }
00455 
00456 NS_IMETHODIMP nsMailtoUrl::SetHost(const nsACString &aHost)
00457 {
00458        m_baseURL->SetHost(aHost);
00459        return ParseUrl();
00460 }
00461 
00462 NS_IMETHODIMP nsMailtoUrl::GetPort(PRInt32 *aPort)
00463 {
00464        return m_baseURL->GetPort(aPort);
00465 }
00466 
00467 NS_IMETHODIMP nsMailtoUrl::SetPort(PRInt32 aPort)
00468 {
00469        m_baseURL->SetPort(aPort);
00470        return ParseUrl();
00471 }
00472 
00473 NS_IMETHODIMP nsMailtoUrl::GetPath(nsACString &aPath)
00474 {
00475        return m_baseURL->GetPath(aPath);
00476 }
00477 
00478 NS_IMETHODIMP nsMailtoUrl::SetPath(const nsACString &aPath)
00479 {
00480        m_baseURL->SetPath(aPath);
00481        return ParseUrl();
00482 }
00483 
00484 NS_IMETHODIMP nsMailtoUrl::GetAsciiHost(nsACString &aHostA)
00485 {
00486        return m_baseURL->GetAsciiHost(aHostA);
00487 }
00488 
00489 NS_IMETHODIMP nsMailtoUrl::GetAsciiSpec(nsACString &aSpecA)
00490 {
00491        return m_baseURL->GetAsciiSpec(aSpecA);
00492 }
00493 
00494 NS_IMETHODIMP nsMailtoUrl::GetOriginCharset(nsACString &aOriginCharset)
00495 {
00496     return m_baseURL->GetOriginCharset(aOriginCharset);
00497 }
00498 
00499 NS_IMETHODIMP nsMailtoUrl::SchemeIs(const char *aScheme, PRBool *_retval)
00500 {
00501        return m_baseURL->SchemeIs(aScheme, _retval);
00502 }
00503 
00504 NS_IMETHODIMP nsMailtoUrl::Equals(nsIURI *other, PRBool *_retval)
00505 {
00506        return m_baseURL->Equals(other, _retval);
00507 }
00508 
00509 NS_IMETHODIMP nsMailtoUrl::Clone(nsIURI **_retval)
00510 {
00511        return m_baseURL->Clone(_retval);
00512 }      
00513 
00514 NS_IMETHODIMP nsMailtoUrl::Resolve(const nsACString &relativePath, nsACString &result) 
00515 {
00516        return m_baseURL->Resolve(relativePath, result);
00517 }
00518 
00519 
00520 
00521 
00523 // smtp url definition
00525 
00526 nsSmtpUrl::nsSmtpUrl() : nsMsgMailNewsUrl()
00527 {
00528   // nsISmtpUrl specific state...
00529 
00530   m_fileName = nsnull;
00531   m_isPostMessage = PR_TRUE;
00532 }
00533  
00534 nsSmtpUrl::~nsSmtpUrl()
00535 {
00536 }
00537   
00538 NS_IMPL_ISUPPORTS_INHERITED1(nsSmtpUrl, nsMsgMailNewsUrl, nsISmtpUrl)  
00539 
00540 
00541 // Begin nsISmtpUrl specific support
00542 
00543 
00544 
00545 NS_IMETHODIMP nsSmtpUrl::SetSpec(const nsACString &aSpec)
00546 {
00547   nsresult rv = nsMsgMailNewsUrl::SetSpec(aSpec);
00548   if (NS_SUCCEEDED(rv))
00549     rv = ParseUrl();
00550   return rv;
00551 }
00552 
00553 // mscott - i think this function can be obsoleted and its functionality
00554 // moved into SetSpec or an init method....
00555 nsresult nsSmtpUrl::ParseUrl()
00556 {
00557   nsresult rv = NS_OK;
00558   
00559   // set the username
00560   nsCAutoString userName;
00561   rv = GetUsername(userName);
00562   if (NS_FAILED(rv)) return rv; 
00563   m_userName = userName;
00564   
00565   return NS_OK;
00566 }
00567 
00568 NS_IMETHODIMP
00569 nsSmtpUrl::SetRecipients(const char * aRecipientsList)
00570 {
00571   NS_ENSURE_ARG(aRecipientsList);
00572   m_toPart = aRecipientsList;
00573   if (!m_toPart.IsEmpty())
00574     nsUnescape(m_toPart.BeginWriting());
00575   return NS_OK;
00576 }
00577 
00578 
00579 NS_IMETHODIMP
00580 nsSmtpUrl::GetRecipients(char ** aRecipientsList)
00581 {
00582   NS_ENSURE_ARG_POINTER(aRecipientsList);
00583        if (aRecipientsList)
00584               *aRecipientsList = ToNewCString(m_toPart);
00585        return NS_OK;
00586 }
00587 
00588 NS_IMPL_GETSET(nsSmtpUrl, PostMessage, PRBool, m_isPostMessage)
00589 
00590 // the message can be stored in a file....allow accessors for getting and setting
00591 // the file name to post...
00592 NS_IMETHODIMP nsSmtpUrl::SetPostMessageFile(nsIFileSpec * aFileSpec)
00593 {
00594   nsresult rv = NS_OK;
00595   if (aFileSpec)
00596     m_fileName = aFileSpec;
00597   else
00598     rv = NS_ERROR_NULL_POINTER;
00599   
00600   return rv;
00601 }
00602 
00603 NS_IMETHODIMP nsSmtpUrl::GetPostMessageFile(nsIFileSpec ** aFileSpec)
00604 {
00605   nsresult rv = NS_OK;
00606   if (aFileSpec)
00607   {
00608     *aFileSpec = m_fileName;
00609     NS_IF_ADDREF(*aFileSpec);
00610   }
00611   else
00612     rv = NS_ERROR_NULL_POINTER;
00613   
00614   return rv;
00615 }
00616 
00617 NS_IMETHODIMP 
00618 nsSmtpUrl::GetSenderIdentity(nsIMsgIdentity * *aSenderIdentity)
00619 {
00620   NS_ENSURE_ARG_POINTER(aSenderIdentity); 
00621   
00622   *aSenderIdentity = m_senderIdentity;
00623   NS_ADDREF(*aSenderIdentity);
00624   return NS_OK;
00625 }
00626 
00627 NS_IMETHODIMP 
00628 nsSmtpUrl::SetSenderIdentity(nsIMsgIdentity * aSenderIdentity) 
00629 {
00630   NS_ENSURE_ARG_POINTER(aSenderIdentity);
00631   
00632   m_senderIdentity = aSenderIdentity;
00633   return NS_OK;
00634 }
00635 
00636 NS_IMETHODIMP
00637 nsSmtpUrl::SetPrompt(nsIPrompt *aNetPrompt)
00638 {
00639     NS_ENSURE_ARG_POINTER(aNetPrompt);
00640     m_netPrompt = aNetPrompt;
00641     return NS_OK;
00642 }
00643 
00644 NS_IMETHODIMP
00645 nsSmtpUrl::GetPrompt(nsIPrompt **aNetPrompt)
00646 {
00647     NS_ENSURE_ARG_POINTER(aNetPrompt);
00648     if (!m_netPrompt) return NS_ERROR_NULL_POINTER;
00649     *aNetPrompt = m_netPrompt;
00650     NS_ADDREF(*aNetPrompt);
00651     return NS_OK;
00652 }
00653 
00654 NS_IMETHODIMP
00655 nsSmtpUrl::SetAuthPrompt(nsIAuthPrompt *aNetAuthPrompt)
00656 {
00657     NS_ENSURE_ARG_POINTER(aNetAuthPrompt);
00658     m_netAuthPrompt = aNetAuthPrompt;
00659     return NS_OK;
00660 }
00661 
00662 NS_IMETHODIMP
00663 nsSmtpUrl::GetAuthPrompt(nsIAuthPrompt **aNetAuthPrompt)
00664 {
00665     NS_ENSURE_ARG_POINTER(aNetAuthPrompt);
00666     if (!m_netAuthPrompt) return NS_ERROR_NULL_POINTER;
00667     *aNetAuthPrompt = m_netAuthPrompt;
00668     NS_ADDREF(*aNetAuthPrompt);
00669     return NS_OK;
00670 }
00671 
00672 NS_IMETHODIMP
00673 nsSmtpUrl::SetNotificationCallbacks(nsIInterfaceRequestor* aCallbacks)
00674 {
00675     NS_ENSURE_ARG_POINTER(aCallbacks);
00676     m_callbacks = aCallbacks;
00677     return NS_OK;
00678 }
00679 
00680 NS_IMETHODIMP
00681 nsSmtpUrl::GetNotificationCallbacks(nsIInterfaceRequestor** aCallbacks)
00682 {
00683     NS_ENSURE_ARG_POINTER(aCallbacks);
00684     if (!m_callbacks) return NS_ERROR_NULL_POINTER;
00685     *aCallbacks = m_callbacks;
00686     NS_ADDREF(*aCallbacks);
00687     return NS_OK;
00688 }
00689 
00690 NS_IMETHODIMP
00691 nsSmtpUrl::SetSmtpServer(nsISmtpServer * aSmtpServer)
00692 {
00693     NS_ENSURE_ARG_POINTER(aSmtpServer);
00694     m_smtpServer = aSmtpServer;
00695     return NS_OK;
00696 }
00697 
00698 NS_IMETHODIMP
00699 nsSmtpUrl::GetSmtpServer(nsISmtpServer ** aSmtpServer)
00700 {
00701     NS_ENSURE_ARG_POINTER(aSmtpServer);
00702     if (!m_smtpServer) return NS_ERROR_NULL_POINTER;
00703     *aSmtpServer = m_smtpServer;
00704     NS_ADDREF(*aSmtpServer);
00705     return NS_OK;
00706 }
00707