mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Include thumbnails in "move to" and "copy to" commands
SVN revision: 2206
This commit is contained in:
parent
fdd337540f
commit
7406bc589d
68
src/elogd.c
68
src/elogd.c
@ -22546,11 +22546,12 @@ void submit_elog_mirror(LOGBOOK * lbs)
|
|||||||
|
|
||||||
void copy_to(LOGBOOK * lbs, int src_id, char *dest_logbook, int move, int orig_id)
|
void copy_to(LOGBOOK * lbs, int src_id, char *dest_logbook, int move, int orig_id)
|
||||||
{
|
{
|
||||||
int size, i, n, n_done, n_done_reply, n_reply, index, status, fh, source_id, message_id;
|
int size, i, n, n_done, n_done_reply, n_reply, index, status, fh, source_id, message_id,
|
||||||
char str[256], str2[256], file_name[MAX_PATH_LENGTH], attrib[MAX_N_ATTR][NAME_LENGTH];
|
thumb_status;
|
||||||
char date[80], *text, msg_str[32], in_reply_to[80], reply_to[MAX_REPLY_TO * 10],
|
char str[256], str2[256], file_name[MAX_PATH_LENGTH], thumb_name[MAX_PATH_LENGTH],
|
||||||
attachment[MAX_ATTACHMENTS][MAX_PATH_LENGTH], encoding[80], locked_by[256], *buffer,
|
attrib[MAX_N_ATTR][NAME_LENGTH], date[80], *text, msg_str[32], in_reply_to[80],
|
||||||
list[MAX_N_ATTR][NAME_LENGTH];
|
reply_to[MAX_REPLY_TO * 10], attachment[MAX_ATTACHMENTS][MAX_PATH_LENGTH],
|
||||||
|
encoding[80], locked_by[256], *buffer, list[MAX_N_ATTR][NAME_LENGTH];
|
||||||
LOGBOOK *lbs_dest;
|
LOGBOOK *lbs_dest;
|
||||||
BOOL bedit;
|
BOOL bedit;
|
||||||
|
|
||||||
@ -22629,13 +22630,68 @@ void copy_to(LOGBOOK * lbs, int src_id, char *dest_logbook, int move, int orig_i
|
|||||||
/* keep original file name for inline references */
|
/* keep original file name for inline references */
|
||||||
strlcpy(file_name, attachment[i], NAME_LENGTH);
|
strlcpy(file_name, attachment[i], NAME_LENGTH);
|
||||||
|
|
||||||
el_submit_attachment(lbs_dest, file_name, buffer, size, attachment[i]);
|
el_submit_attachment(lbs_dest, file_name, buffer, size, NULL);
|
||||||
|
|
||||||
if (buffer)
|
if (buffer)
|
||||||
xfree(buffer);
|
xfree(buffer);
|
||||||
} else
|
} else
|
||||||
/* attachment is invalid */
|
/* attachment is invalid */
|
||||||
attachment[i][0] = 0;
|
attachment[i][0] = 0;
|
||||||
|
|
||||||
|
/* check for thumbnail */
|
||||||
|
strlcpy(file_name, lbs->data_dir, sizeof(file_name));
|
||||||
|
strlcat(file_name, attachment[i], sizeof(file_name));
|
||||||
|
thumb_status = get_thumb_name(file_name, thumb_name, sizeof(thumb_name), 0);
|
||||||
|
|
||||||
|
if (thumb_status == 1) {
|
||||||
|
fh = open(thumb_name, O_RDONLY | O_BINARY);
|
||||||
|
if (fh > 0) {
|
||||||
|
lseek(fh, 0, SEEK_END);
|
||||||
|
size = TELL(fh);
|
||||||
|
lseek(fh, 0, SEEK_SET);
|
||||||
|
buffer = xmalloc(size);
|
||||||
|
read(fh, buffer, size);
|
||||||
|
close(fh);
|
||||||
|
|
||||||
|
/* keep original file name for inline references */
|
||||||
|
if (strrchr(thumb_name, '\\'))
|
||||||
|
strlcpy(str, strrchr(thumb_name, '\\')+1, sizeof(str));
|
||||||
|
else
|
||||||
|
strlcpy(str, thumb_name, sizeof(str));
|
||||||
|
|
||||||
|
el_submit_attachment(lbs_dest, str, buffer, size, NULL);
|
||||||
|
|
||||||
|
if (buffer)
|
||||||
|
xfree(buffer);
|
||||||
|
}
|
||||||
|
} if (thumb_status == 2) {
|
||||||
|
for (i = 0;; i++) {
|
||||||
|
get_thumb_name(file_name, thumb_name, sizeof(thumb_name), i);
|
||||||
|
if (thumb_name[0]) {
|
||||||
|
fh = open(thumb_name, O_RDONLY | O_BINARY);
|
||||||
|
if (fh > 0) {
|
||||||
|
lseek(fh, 0, SEEK_END);
|
||||||
|
size = TELL(fh);
|
||||||
|
lseek(fh, 0, SEEK_SET);
|
||||||
|
buffer = xmalloc(size);
|
||||||
|
read(fh, buffer, size);
|
||||||
|
close(fh);
|
||||||
|
|
||||||
|
/* keep original file name for inline references */
|
||||||
|
if (strrchr(thumb_name, '\\'))
|
||||||
|
strlcpy(str, strrchr(thumb_name, '\\')+1, sizeof(str));
|
||||||
|
else
|
||||||
|
strlcpy(str, thumb_name, sizeof(str));
|
||||||
|
|
||||||
|
el_submit_attachment(lbs_dest, str, buffer, size, NULL);
|
||||||
|
|
||||||
|
if (buffer)
|
||||||
|
xfree(buffer);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* correct possible references to attachments */
|
/* correct possible references to attachments */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user