+void maybe_log_item(struct file_struct *file, int iflags, int itemizing,
+ const char *buf)
+{
+ int significant_flags = iflags & SIGNIFICANT_ITEM_FLAGS;
+ int see_item = itemizing && (significant_flags || *buf
+ || stdout_format_has_i > 1 || (verbose > 1 && stdout_format_has_i));
+ int local_change = iflags & ITEM_LOCAL_CHANGE && significant_flags;
+ if (am_server) {
+ if (logfile_name && !dry_run && see_item
+ && (significant_flags || logfile_format_has_i))
+ log_item(FLOG, file, &stats, iflags, buf);
+ } else if (see_item || local_change || *buf
+ || (S_ISDIR(file->mode) && significant_flags)) {
+ enum logcode code = significant_flags || logfile_format_has_i ? FINFO : FCLIENT;
+ log_item(code, file, &stats, iflags, buf);
+ }
+}
+
+void log_delete(const char *fname, int mode)
+{
+ static struct {
+ union flist_extras ex[4]; /* just in case... */
+ struct file_struct file;
+ char basename[1];
+ } x;
+ int len = strlen(fname);
+ const char *fmt;
+
+ x.file.mode = mode;
+
+ if (!verbose && !stdout_format)
+ ;
+ else if (am_server && protocol_version >= 29 && len < MAXPATHLEN) {
+ if (S_ISDIR(mode))
+ len++; /* directories include trailing null */
+ send_msg(MSG_DELETED, fname, len);
+ } else {
+ fmt = stdout_format_has_o_or_i ? stdout_format : "deleting %n";
+ log_formatted(FCLIENT, fmt, "del.", &x.file, fname, &stats,
+ ITEM_DELETED, NULL);
+ }