From: Eric Bollengier Date: Wed, 23 Feb 2022 17:51:23 +0000 (+0100) Subject: Add isinline and contenttype filters to metadata list command X-Git-Tag: Beta-15.0.0~639 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6c81d62c79027332f327424daa3cdfb325d5643;p=thirdparty%2Fbacula.git Add isinline and contenttype filters to metadata list command --- diff --git a/bacula/src/cats/cats.c b/bacula/src/cats/cats.c index 7984d2896..1c13e36f1 100644 --- a/bacula/src/cats/cats.c +++ b/bacula/src/cats/cats.c @@ -809,6 +809,17 @@ void META_DBR::create_db_filter(JCR *jcr, BDB *db, POOLMEM **where) db->search_op(jcr, "MetaAttachment.AttachmentName", Name, esc.handle(), tmp.handle()); append_AND_OR_filter(and_or, where, tmp.c_str()); } + + if (isInline >= 0) { + Mmsg(tmp, " MetaAttachment.AttachmentIsInline = %d", isInline); + append_filter(where, tmp.c_str()); + } + + if (ContentType[0]) { + db_escape_string(jcr, jcr->db, esc.c_str(), ContentType, strlen(ContentType)); + Mmsg(tmp, " MetaAttachment.AttachmentContentType = '%s'", esc.c_str()); + append_filter(where, tmp.c_str()); + } } if (Owner[0]) { diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index d398aaf4c..6974f99e1 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -650,6 +650,7 @@ public: int HasAttachment; int isDraft; int isRead; + int isInline; uint64_t offset; uint32_t limit; int order; @@ -675,15 +676,18 @@ public: char Plugin[MAX_NAME_LENGTH]; char Name[MAX_SEARCH_LENGTH]; char FolderName[MAX_SEARCH_LENGTH]; + char ContentType[MAX_SEARCH_LENGTH]; char errmsg[MAX_NAME_LENGTH]; META_DBR(): MinSize(-1), MaxSize(-1), HasAttachment(-1), - isDraft(-1), isRead(-1), offset(0), limit(512), order(0), orderby(0), all(false) + isDraft(-1), isRead(-1), isInline(-1), offset(0), limit(512), + order(0), orderby(0), all(false) { JobIds = NULL; *Id = *Tenant = *Owner = 0; *ClientName = *From = *To = *Cc = *Subject = *Tags = 0; *BodyPreview = *Type = *ConversationId = *Category = 0; *FolderName = *Name = *MinTime = *MaxTime = *Plugin = 0; + *ContentType = 0; *errmsg = 0; }; ~META_DBR() {}; diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index 5a5394588..fc9859bdc 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -143,7 +143,7 @@ static struct cmdstruct commands[] = { /* C "\t [from= to= cc= tags= subject= bodypreview= all=\n" "\t minsize= maxsize= importance= isread=<0|1> isdraft=<0|1> categories=\n" "\t conversationid= hasattachment=<0|1> starttime=