зеркало из https://github.com/mozilla/pjs.git
more changes to get posting to a news server working
This commit is contained in:
Родитель
58fc853664
Коммит
2c18468d23
|
@ -901,9 +901,6 @@ NS_IMETHODIMP nsComposeAppCore::SendMessage(nsAutoString& aAddrTo,
|
||||||
|
|
||||||
if (mMsgSend)
|
if (mMsgSend)
|
||||||
mMsgSend->SendMessage(mMsgCompFields, NULL);
|
mMsgSend->SendMessage(mMsgCompFields, NULL);
|
||||||
|
|
||||||
if (mMsgPost)
|
|
||||||
mMsgPost->PostNewsMessage(mMsgCompFields);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsnull != mScriptContext) {
|
if (nsnull != mScriptContext) {
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "msgCore.h"
|
#include "msgCore.h"
|
||||||
|
|
||||||
#include "rosetta_mailnews.h"
|
#include "rosetta_mailnews.h"
|
||||||
#include "nsMsgLocalFolderHdrs.h"
|
#include "nsMsgLocalFolderHdrs.h"
|
||||||
#include "nsMsgCompose.h"
|
#include "nsMsgCompose.h"
|
||||||
|
@ -28,6 +27,7 @@
|
||||||
#include "nsIMsgHeaderParser.h"
|
#include "nsIMsgHeaderParser.h"
|
||||||
#include "nsINetService.h"
|
#include "nsINetService.h"
|
||||||
#include "nsISmtpService.h" // for actually sending the message...
|
#include "nsISmtpService.h" // for actually sending the message...
|
||||||
|
#include "nsINntpService.h" // for actually posting the message...
|
||||||
#include "nsMsgCompPrefs.h"
|
#include "nsMsgCompPrefs.h"
|
||||||
#include "nsIMsgMailSession.h"
|
#include "nsIMsgMailSession.h"
|
||||||
#include "nsIMsgIdentity.h"
|
#include "nsIMsgIdentity.h"
|
||||||
|
@ -38,6 +38,7 @@
|
||||||
static NS_DEFINE_IID(kIMsgSend, NS_IMSGSEND_IID);
|
static NS_DEFINE_IID(kIMsgSend, NS_IMSGSEND_IID);
|
||||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||||
static NS_DEFINE_CID(kSmtpServiceCID, NS_SMTPSERVICE_CID);
|
static NS_DEFINE_CID(kSmtpServiceCID, NS_SMTPSERVICE_CID);
|
||||||
|
static NS_DEFINE_CID(kNntpServiceCID, NS_NNTPSERVICE_CID);
|
||||||
static NS_DEFINE_CID(kMsgHeaderParserCID, NS_MSGHEADERPARSER_CID);
|
static NS_DEFINE_CID(kMsgHeaderParserCID, NS_MSGHEADERPARSER_CID);
|
||||||
static NS_DEFINE_CID(kNetServiceCID, NS_NETSERVICE_CID);
|
static NS_DEFINE_CID(kNetServiceCID, NS_NETSERVICE_CID);
|
||||||
|
|
||||||
|
@ -3212,8 +3213,8 @@ static char * mime_generate_headers (nsMsgCompFields *fields,
|
||||||
PUSH_NEWLINE ();
|
PUSH_NEWLINE ();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsINetService * pNetService;
|
nsresult rv = NS_OK;
|
||||||
nsresult rv = nsServiceManager::GetService(kNetServiceCID, nsINetService::GetIID(), (nsISupports **)&pNetService);
|
NS_WITH_SERVICE(nsINetService, pNetService, kNetServiceCID, &rv);
|
||||||
if (NS_SUCCEEDED(rv) && pNetService)
|
if (NS_SUCCEEDED(rv) && pNetService)
|
||||||
{
|
{
|
||||||
nsString aNSStr;
|
nsString aNSStr;
|
||||||
|
@ -3235,8 +3236,6 @@ static char * mime_generate_headers (nsMsgCompFields *fields,
|
||||||
}
|
}
|
||||||
PUSH_NEWLINE ();
|
PUSH_NEWLINE ();
|
||||||
}
|
}
|
||||||
|
|
||||||
pNetService->Release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for Netscape Server, Accept-Language data sent in Mail header */
|
/* for Netscape Server, Accept-Language data sent in Mail header */
|
||||||
|
@ -3637,16 +3636,14 @@ int MIME_GenerateMailtoFormPostHeaders (const char *old_post_url,
|
||||||
{
|
{
|
||||||
char* sAppName = nsnull;
|
char* sAppName = nsnull;
|
||||||
|
|
||||||
nsINetService * pNetService;
|
nsresult rv = NS_OK;
|
||||||
nsresult rv = nsServiceManager::GetService(kNetServiceCID, nsINetService::GetIID(), (nsISupports **)&pNetService);
|
NS_WITH_SERVICE(nsINetService, pNetService, kNetServiceCID, &rv);
|
||||||
if (NS_SUCCEEDED(rv) && pNetService)
|
if (NS_SUCCEEDED(rv) && pNetService)
|
||||||
{
|
{
|
||||||
nsString aNSStr;
|
nsString aNSStr;
|
||||||
|
|
||||||
pNetService->GetAppCodeName(aNSStr);
|
pNetService->GetAppCodeName(aNSStr);
|
||||||
sAppName = aNSStr.ToNewCString();
|
sAppName = aNSStr.ToNewCString();
|
||||||
|
|
||||||
pNetService->Release();
|
|
||||||
}
|
}
|
||||||
/* If the URL didn't provide a subject, we will. */
|
/* If the URL didn't provide a subject, we will. */
|
||||||
StrAllocCat (extra_headers, "Subject: Form posted from ");
|
StrAllocCat (extra_headers, "Subject: Form posted from ");
|
||||||
|
@ -4919,7 +4916,7 @@ void nsMsgSendMimeDeliveryState::DeliverMessage ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* XP_UNIX */
|
#endif /* 0 */
|
||||||
|
|
||||||
|
|
||||||
#ifdef MAIL_BEFORE_NEWS
|
#ifdef MAIL_BEFORE_NEWS
|
||||||
|
@ -4972,14 +4969,13 @@ void nsMsgSendMimeDeliveryState::DeliverFileAsMail ()
|
||||||
PL_strcat (buf2, m_fields->GetBcc());
|
PL_strcat (buf2, m_fields->GetBcc());
|
||||||
}
|
}
|
||||||
|
|
||||||
nsISmtpService * smtpService = nsnull;
|
|
||||||
nsFilePath filePath (m_msg_file_name ? m_msg_file_name : "");
|
nsFilePath filePath (m_msg_file_name ? m_msg_file_name : "");
|
||||||
|
|
||||||
nsresult rv = nsServiceManager::GetService(kSmtpServiceCID, nsISmtpService::GetIID(), (nsISupports **)&smtpService);
|
nsresult rv = NS_OK;
|
||||||
|
NS_WITH_SERVICE(nsISmtpService, smtpService, kSmtpServiceCID, &rv);
|
||||||
if (NS_SUCCEEDED(rv) && smtpService)
|
if (NS_SUCCEEDED(rv) && smtpService)
|
||||||
{
|
{
|
||||||
rv = smtpService->SendMailMessage(filePath, buf, nsnull, nsnull);
|
rv = smtpService->SendMailMessage(filePath, buf, nsnull, nsnull);
|
||||||
nsServiceManager::ReleaseService(kSmtpServiceCID, smtpService);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PR_FREEIF(buf); // free the buf because we are done with it....
|
PR_FREEIF(buf); // free the buf because we are done with it....
|
||||||
|
@ -4988,36 +4984,20 @@ void nsMsgSendMimeDeliveryState::DeliverFileAsMail ()
|
||||||
|
|
||||||
void nsMsgSendMimeDeliveryState::DeliverFileAsNews ()
|
void nsMsgSendMimeDeliveryState::DeliverFileAsNews ()
|
||||||
{
|
{
|
||||||
URL_Struct *url = NET_CreateURLStruct (m_fields->GetNewspostUrl(), NET_DONT_RELOAD);
|
if (m_fields->GetNewsgroups() == nsnull) {
|
||||||
if (! url) {
|
return;
|
||||||
Fail (MK_OUT_OF_MEMORY, 0);
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef UNREADY_CODE
|
nsFilePath filePath (m_msg_file_name ? m_msg_file_name : "");
|
||||||
FE_Progress (GetContext(), XP_GetString(MK_MSG_DELIV_NEWS));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* put the filename of the message into the post data field and set a flag
|
nsresult rv = NS_OK;
|
||||||
in the URL struct to specify that it is a file.
|
NS_WITH_SERVICE(nsINntpService, nntpService, kNntpServiceCID, &rv);
|
||||||
*/
|
|
||||||
PR_FREEIF(url->post_data);
|
|
||||||
url->post_data = PL_strdup(m_msg_file_name);
|
|
||||||
url->post_data_size = PL_strlen(url->post_data);
|
|
||||||
url->post_data_is_file = PR_TRUE;
|
|
||||||
url->method = URL_POST_METHOD;
|
|
||||||
|
|
||||||
url->fe_data = this;
|
if (NS_SUCCEEDED(rv) && nntpService) {
|
||||||
url->internal_url = PR_TRUE;
|
rv = nntpService->PostMessage(filePath, m_fields->GetSubject(), m_fields->GetNewsgroups(), nsnull, nsnull);
|
||||||
|
}
|
||||||
|
|
||||||
url->msg_pane = m_pane;
|
return;
|
||||||
|
|
||||||
/* We can ignore the return value of NET_GetURL() because we have
|
|
||||||
handled the error in mime_deliver_as_news_exit(). */
|
|
||||||
|
|
||||||
/*JFD
|
|
||||||
MSG_UrlQueue::AddUrlToPane (url, mime_deliver_as_news_exit, m_pane, PR_TRUE);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Загрузка…
Ссылка в новой задаче