mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-14 20:33:48 +00:00
Fixed bug that attachments got deleted if one replies to a message
SVN revision: 497
This commit is contained in:
parent
183de1dcab
commit
75026ee5b6
40
src/elogd.c
40
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.83 2003/04/14 08:43:11 midas
|
||||||
|
Fixed bug that attachments got deleted if one replies to a message
|
||||||
|
|
||||||
Revision 1.82 2003/04/11 07:25:52 midas
|
Revision 1.82 2003/04/11 07:25:52 midas
|
||||||
Eliminated WEB_BUFFER_SIZE and made memory allocation dynamically
|
Eliminated WEB_BUFFER_SIZE and made memory allocation dynamically
|
||||||
|
|
||||||
@ -2912,6 +2915,7 @@ char file_name[256], dir[256], str[NAME_LENGTH];
|
|||||||
time_t now, ltime;
|
time_t now, ltime;
|
||||||
char message[TEXT_SIZE+100], *p, *buffer;
|
char message[TEXT_SIZE+100], *p, *buffer;
|
||||||
BOOL bedit;
|
BOOL bedit;
|
||||||
|
char attachment_all[64*MAX_ATTACHMENTS];
|
||||||
|
|
||||||
/* generate new file name YYMMDD.log in data directory */
|
/* generate new file name YYMMDD.log in data directory */
|
||||||
strcpy(dir, lbs->data_dir);
|
strcpy(dir, lbs->data_dir);
|
||||||
@ -2970,6 +2974,7 @@ BOOL bedit;
|
|||||||
el_decode(message, "Reply to: ", reply_to);
|
el_decode(message, "Reply to: ", reply_to);
|
||||||
if (equal_ustring(in_reply_to, "<keep>"))
|
if (equal_ustring(in_reply_to, "<keep>"))
|
||||||
el_decode(message, "In reply to: ", in_reply_to);
|
el_decode(message, "In reply to: ", in_reply_to);
|
||||||
|
el_decode(message, "Attachment: ", attachment_all);
|
||||||
|
|
||||||
/* buffer tail of logfile */
|
/* buffer tail of logfile */
|
||||||
lseek(fh, 0, SEEK_END);
|
lseek(fh, 0, SEEK_END);
|
||||||
@ -3069,33 +3074,12 @@ BOOL bedit;
|
|||||||
for (i=0 ; i<n_attr ; i++)
|
for (i=0 ; i<n_attr ; i++)
|
||||||
sprintf(message+strlen(message), "%s: %s\n", attr_name[i], attr_value[i]);
|
sprintf(message+strlen(message), "%s: %s\n", attr_name[i], attr_value[i]);
|
||||||
|
|
||||||
/* keep original attachment if edit and no new attachment */
|
|
||||||
|
|
||||||
sprintf(message+strlen(message), "Attachment: ");
|
sprintf(message+strlen(message), "Attachment: ");
|
||||||
|
|
||||||
if (bedit)
|
sprintf(message+strlen(message), afilename[0]);
|
||||||
{
|
for (i=1 ; i<MAX_ATTACHMENTS ; i++)
|
||||||
for (i=n=0 ; i<MAX_ATTACHMENTS ; i++)
|
if (afilename[i][0])
|
||||||
{
|
sprintf(message+strlen(message), ",%s", afilename[i]);
|
||||||
if (afilename[i][0])
|
|
||||||
{
|
|
||||||
if (n == 0)
|
|
||||||
{
|
|
||||||
sprintf(message+strlen(message), "%s", afilename[i]);
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
sprintf(message+strlen(message), ",%s", afilename[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf(message+strlen(message), afilename[0]);
|
|
||||||
for (i=1 ; i<MAX_ATTACHMENTS ; i++)
|
|
||||||
if (afilename[i][0])
|
|
||||||
sprintf(message+strlen(message), ",%s", afilename[i]);
|
|
||||||
}
|
|
||||||
sprintf(message+strlen(message), "\n");
|
sprintf(message+strlen(message), "\n");
|
||||||
|
|
||||||
sprintf(message+strlen(message), "Encoding: %s\n", encoding);
|
sprintf(message+strlen(message), "Encoding: %s\n", encoding);
|
||||||
@ -3151,9 +3135,6 @@ BOOL bedit;
|
|||||||
strcat(reply_to, ", ");
|
strcat(reply_to, ", ");
|
||||||
sprintf(reply_to + strlen(reply_to), "%d", message_id);
|
sprintf(reply_to + strlen(reply_to), "%d", message_id);
|
||||||
|
|
||||||
/* don't resubmit attachments */
|
|
||||||
memset(att, 0, sizeof(att));
|
|
||||||
|
|
||||||
/* write modified message */
|
/* write modified message */
|
||||||
el_submit(lbs, reply_id, date, attr_list, attr, n_attr,
|
el_submit(lbs, reply_id, date, attr_list, attr, n_attr,
|
||||||
message, in_reply_to, reply_to, enc, att, TRUE);
|
message, in_reply_to, reply_to, enc, att, TRUE);
|
||||||
@ -3202,9 +3183,6 @@ int size, status;
|
|||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* don't resubmit attachments */
|
|
||||||
memset(att, 0, sizeof(att));
|
|
||||||
|
|
||||||
/* write modified message */
|
/* write modified message */
|
||||||
el_submit(lbs, message_id, date, attr_list, attr, lbs->n_attr,
|
el_submit(lbs, message_id, date, attr_list, attr, lbs->n_attr,
|
||||||
message, in_reply_to, reply_to, enc, att, TRUE);
|
message, in_reply_to, reply_to, enc, att, TRUE);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user