From 5e8bb18089b1d24a1449cd7048ef72035859a201 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Tue, 4 Mar 2003 21:14:47 +0000 Subject: [PATCH] 'Copy to' and 'Move to' now processes whole threads SVN revision: 427 --- src/elogd.c | 71 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 14 deletions(-) diff --git a/src/elogd.c b/src/elogd.c index 194864b3..855e5dd5 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -6,6 +6,9 @@ Contents: Web server program for Electronic Logbook ELOG $Log$ + Revision 1.37 2003/03/04 21:14:47 midas + 'Copy to' and 'Move to' now processes whole threads + Revision 1.36 2003/03/01 16:08:02 midas Ignore 's in config file correctly @@ -6465,7 +6468,7 @@ char message[TEXT_SIZE+1000], *p; void display_line(LOGBOOK *lbs, int message_id, int number, char *mode, int expand, int level, BOOL printable, int n_line, int show_attachments, - char *date, char *reply_to, + char *date, char *in_reply_to, char *reply_to, int n_attr_disp, char disp_attr[MAX_N_ATTR+4][NAME_LENGTH], char attrib[MAX_N_ATTR][NAME_LENGTH], int n_attr, char *text, @@ -6506,7 +6509,7 @@ FILE *f; rsprintf("", sclass); /* show select box */ - if (select) + if (select && level == 0) rsprintf("\n", (*n_display)++, message_id); for (i=0 ; i\n", - sclass, (*n_display)++, message_id); - + { + rsprintf("", sclass); + if (in_reply_to[0] == 0) + rsprintf("\n", (*n_display)++, message_id); + } if (equal_ustring(mode, "Threaded")) rsprintf("", ref); @@ -6945,7 +6950,7 @@ char *p; } display_line(lbs, message_id, 0, "threaded", expand, level, printable, n_line, - FALSE, date, reply_to, n_attr_disp, disp_attr, + FALSE, date, in_reply_to, reply_to, n_attr_disp, disp_attr, attrib, lbs->n_attr, text, NULL, encoding, 0, NULL); if (reply_to[0]) @@ -8572,7 +8577,7 @@ LOGBOOK *lbs_cur; display_line(msg_list[index].lbs, message_id, index, mode, expand, 0, printable, n_line, - show_attachments, date, reply_to, n_attr_disp, disp_attr, + show_attachments, date, in_reply_to, reply_to, n_attr_disp, disp_attr, attrib, lbs->n_attr, text, attachment, encoding, atoi(getparam("select")), &n_display); if (threaded) @@ -9068,12 +9073,13 @@ int i, j, n, missing, first, index, mindex, suppress, message_id, resubmit_or /*------------------------------------------------------------------*/ -void copy_to(LOGBOOK *lbs, int src_id, char *dest_logbook, int move) +void copy_to(LOGBOOK *lbs, int src_id, char *dest_logbook, int move, int orig_id) { -int size, i, n, n_done, index, status, fh, source_id, message_id; +int size, i, n, n_done, n_reply, index, status, fh, source_id, message_id; char str[256], file_name[MAX_PATH_LENGTH], attrib[MAX_N_ATTR][NAME_LENGTH]; char date[80], text[TEXT_SIZE], msg_str[32], in_reply_to[80], reply_to[256], - attachment[MAX_ATTACHMENTS][MAX_PATH_LENGTH], encoding[80], *buffer; + attachment[MAX_ATTACHMENTS][MAX_PATH_LENGTH], encoding[80], *buffer, + list[MAX_N_ATTR][NAME_LENGTH]; LOGBOOK *lbs_dest; for (i=0 ; lb_list[i].name[0] ; i++) @@ -9116,6 +9122,28 @@ LOGBOOK *lbs_dest; return; } + if (orig_id == 0) + { + /* search message head */ + while (atoi(in_reply_to) > 0) + { + source_id = atoi(in_reply_to); + size = sizeof(text); + status = el_retrieve(lbs, source_id, date, attr_list, attrib, lbs->n_attr, + text, &size, in_reply_to, reply_to, + attachment, encoding); + + if (status != EL_SUCCESS) + { + sprintf(msg_str, "%d", source_id); + sprintf(str, loc("Message %s cannot be read from logbook \"%s\""), msg_str, lbs->name); + show_error(str); + return; + } + } + } + + /* read attachments */ for (i=0 ; in_attr, text, - "", "", encoding, + str, "", encoding, attachment, TRUE); if (message_id <= 0) @@ -9170,8 +9203,15 @@ LOGBOOK *lbs_dest; n_done++; + /* submit all replies */ + n_reply = strbreak(reply_to, list, MAX_N_ATTR); + for (i=0 ; i