зеркало из https://github.com/mozilla/gecko-dev.git
jefft@netscape.com's changes to eliminate calls to libmsg/libmime when composing
a cancel message
This commit is contained in:
Родитель
d43ca7d6d2
Коммит
5940bd6852
|
@ -29,7 +29,7 @@
|
||||||
#include "mime.h"
|
#include "mime.h"
|
||||||
#include "shist.h"
|
#include "shist.h"
|
||||||
#include "glhist.h"
|
#include "glhist.h"
|
||||||
/*#include "xp_reg.h"*/
|
|
||||||
#include "mknews.h"
|
#include "mknews.h"
|
||||||
#include "mktcp.h"
|
#include "mktcp.h"
|
||||||
#include "mkparse.h"
|
#include "mkparse.h"
|
||||||
|
@ -3292,7 +3292,7 @@ net_NewsRCProcessPost(ActiveEntry *ce)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef USE_LIBMSG
|
||||||
static void
|
static void
|
||||||
net_cancel_done_cb (MWContext *context, void *data, int status,
|
net_cancel_done_cb (MWContext *context, void *data, int status,
|
||||||
const char *file_name)
|
const char *file_name)
|
||||||
|
@ -3303,6 +3303,7 @@ net_cancel_done_cb (MWContext *context, void *data, int status,
|
||||||
PR_ASSERT(status < 0 || file_name);
|
PR_ASSERT(status < 0 || file_name);
|
||||||
cd->cancel_msg_file = (status < 0 ? 0 : PL_strdup(file_name));
|
cd->cancel_msg_file = (status < 0 ? 0 : PL_strdup(file_name));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -3329,7 +3330,9 @@ net_do_cancel (ActiveEntry *ce)
|
||||||
char *id, *subject, *newsgroups, *distribution, *other_random_headers, *body;
|
char *id, *subject, *newsgroups, *distribution, *other_random_headers, *body;
|
||||||
char *from, *old_from, *news_url;
|
char *from, *old_from, *news_url;
|
||||||
int L;
|
int L;
|
||||||
|
#ifdef USE_LIBMSG
|
||||||
MSG_CompositionFields *fields = NULL;
|
MSG_CompositionFields *fields = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* #### Should we do a more real check than this? If the POST command
|
/* #### Should we do a more real check than this? If the POST command
|
||||||
|
@ -3439,9 +3442,11 @@ net_do_cancel (ActiveEntry *ce)
|
||||||
PL_strcat (body, XP_AppCodeName);
|
PL_strcat (body, XP_AppCodeName);
|
||||||
PL_strcat (body, "." CRLF);
|
PL_strcat (body, "." CRLF);
|
||||||
|
|
||||||
|
#ifdef USE_LIBMSG
|
||||||
fields = MSG_CreateCompositionFields(from, 0, 0, 0, 0, 0, newsgroups,
|
fields = MSG_CreateCompositionFields(from, 0, 0, 0, 0, 0, newsgroups,
|
||||||
0, 0, subject, id, other_random_headers,
|
0, 0, subject, id, other_random_headers,
|
||||||
0, 0, news_url);
|
0, 0, news_url);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* so that this would compile - will probably change later */
|
/* so that this would compile - will probably change later */
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -3450,14 +3455,18 @@ net_do_cancel (ActiveEntry *ce)
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_LIBMSG
|
||||||
if (!fields)
|
if (!fields)
|
||||||
{
|
{
|
||||||
status = MK_OUT_OF_MEMORY;
|
status = MK_OUT_OF_MEMORY;
|
||||||
goto FAIL;
|
goto FAIL;
|
||||||
}
|
}
|
||||||
HG38712
|
HG38712
|
||||||
|
#endif
|
||||||
|
|
||||||
cd->cancel_status = 0;
|
cd->cancel_status = 0;
|
||||||
|
|
||||||
|
#ifdef USE_LIBMSG
|
||||||
MSG_StartMessageDelivery (cd->pane, (void *) ce,
|
MSG_StartMessageDelivery (cd->pane, (void *) ce,
|
||||||
fields,
|
fields,
|
||||||
FALSE, /* digest_p */
|
FALSE, /* digest_p */
|
||||||
|
@ -3525,6 +3534,38 @@ net_do_cancel (ActiveEntry *ce)
|
||||||
cd->next_state = NNTP_RESPONSE;
|
cd->next_state = NNTP_RESPONSE;
|
||||||
cd->next_state_after_response = NNTP_SEND_POST_DATA_RESPONSE;
|
cd->next_state_after_response = NNTP_SEND_POST_DATA_RESPONSE;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
{
|
||||||
|
/* NET_BlockingWrite() should go away soon? I think. */
|
||||||
|
/* The following are what we really need to cancel a posted message */
|
||||||
|
char *data;
|
||||||
|
data = PR_smprintf("From: %s" CRLF
|
||||||
|
"Newsgroups: %s" CRLF
|
||||||
|
"Subject: %s" CRLF
|
||||||
|
"References: %s" CRLF
|
||||||
|
"%s" CRLF /* other_random_headers */
|
||||||
|
"%s" /* body */
|
||||||
|
CRLF "." CRLF CRLF, /* trailing SMTP "." */
|
||||||
|
from, newsgroups, subject, id,
|
||||||
|
other_random_headers, body);
|
||||||
|
|
||||||
|
status = NET_BlockingWrite(ce->socket, data, PL_strlen(data));
|
||||||
|
NNTP_LOG_WRITE(data);
|
||||||
|
PR_Free (data);
|
||||||
|
if (status < 0)
|
||||||
|
{
|
||||||
|
ce->URL_s->error_msg = NET_ExplainErrorDetails(MK_TCP_WRITE_ERROR,
|
||||||
|
status);
|
||||||
|
goto FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cd->pause_for_read = TRUE;
|
||||||
|
cd->next_state = NNTP_RESPONSE;
|
||||||
|
cd->next_state_after_response = NNTP_SEND_POST_DATA_RESPONSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
FAIL:
|
FAIL:
|
||||||
FREEIF (id);
|
FREEIF (id);
|
||||||
|
@ -3536,8 +3577,11 @@ net_do_cancel (ActiveEntry *ce)
|
||||||
FREEIF (other_random_headers);
|
FREEIF (other_random_headers);
|
||||||
FREEIF (body);
|
FREEIF (body);
|
||||||
FREEIF (cd->cancel_msg_file);
|
FREEIF (cd->cancel_msg_file);
|
||||||
|
|
||||||
|
#ifdef USE_LIBMSG
|
||||||
if (fields)
|
if (fields)
|
||||||
MSG_DestroyCompositionFields(fields);
|
MSG_DestroyCompositionFields(fields);
|
||||||
|
#endif
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче