Hello community, here is the log from the commit of package imapfilter for openSUSE:Factory checked in at 2015-10-17 16:39:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/imapfilter (Old) and /work/SRC/openSUSE:Factory/.imapfilter.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "imapfilter" Changes: -------- --- /work/SRC/openSUSE:Factory/imapfilter/imapfilter.changes 2014-12-25 23:20:18.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.imapfilter.new/imapfilter.changes 2015-10-17 16:39:10.000000000 +0200 @@ -1,0 +2,37 @@ +Wed Oct 7 03:34:25 UTC 2015 - [email protected] + +- specfile: update copyright year + +- upgrade to version 2.6.3: + * Support for loading a default CA certificates file. + * A new has_unkeyword() method to search messages without a keyword + flag set. + * Bug fix; double quotation around keyword sent by the has_flag() + method. + +- changes from version 2.6.2: + * Bug fix; drop connection on local certificate mismatch. + +- changes from version 2.6.1: + * Support for loading the system's CA certificates from a file. + * Bug fix; flusing of standard output/error in a some cases. + +- changes from version 2.6: + * Optimizations that vastly improve performance of the + meta-searching functionality, by making subsequent search requests + limit their scope based on the results already returned by + previous requests (previously this was the case only for the + match_*() methods). + * Lua 5.3 compatibility (the codebase can still be compiled with + versions 5.2 and 5.1). + * A new "limit" option can be used as a work-around for problems + that some servers have with long requests. + * The documentation now clarifies how to make the client block + indefinitely. + * Bug fix; the check_status() method now returns 4 numbers on error + as described in the documentation (just negative values in this + case). + * Bug fix; flushing of default output on password prompt. + * Bug fix; program fault when very long requests were to be sent. + +------------------------------------------------------------------- Old: ---- imapfilter-2.5.7.tar.gz New: ---- imapfilter-2.6.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ imapfilter.spec ++++++ --- /var/tmp/diff_new_pack.3xaC6J/_old 2015-10-17 16:39:10.000000000 +0200 +++ /var/tmp/diff_new_pack.3xaC6J/_new 2015-10-17 16:39:10.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package imapfilter # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -21,7 +21,7 @@ License: MIT Group: Productivity/Networking/Email/Utilities Url: https://github.com/lefcha/imapfilter -Version: 2.5.7 +Version: 2.6.3 Release: 0 Source: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ imapfilter-2.5.7.tar.gz -> imapfilter-2.6.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/LICENSE new/imapfilter-2.6.3/LICENSE --- old/imapfilter-2.5.7/LICENSE 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/LICENSE 2015-09-30 22:55:26.000000000 +0200 @@ -1,4 +1,4 @@ -Copyright (c) 2001-2014 Eleftherios Chatzimparmpas +Copyright (c) 2001-2015 Eleftherios Chatzimparmpas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/NEWS new/imapfilter-2.6.3/NEWS --- old/imapfilter-2.5.7/NEWS 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/NEWS 2015-09-30 22:55:26.000000000 +0200 @@ -1,3 +1,30 @@ +IMAPFilter 2.6.3 - 30 Sep 2015 + - Support for loading a default CA certificates file. + - A new has_unkeyword() method to search messages without a keyword flag set. + - Bug fix; double quotation around keyword sent by the has_flag() method. + +IMAPFilter 2.6.2 - 30 Jun 2015 + - Bug fix; drop connection on local certificate mismatch. + +IMAPFilter 2.6.1 - 29 Jun 2015 + - Support for loading the system's CA certificates from a file. + - Bug fix; flusing of standard output/error in a some cases. + +IMAPFilter 2.6 - 16 Jun 2015 + - Optimizations that vastly improve performance of the meta-searching + functionality, by making subsequent search requests limit their scope based + on the results already returned by previous requests (previously this was + the case only for the match_*() methods). + - Lua 5.3 compatibility (the codebase can still be compiled with versions 5.2 + and 5.1). + - A new "limit" option can be used as a work-around for problems that some + servers have with long requests. + - The documentation now clarifies how to make the client block indefinitely. + - Bug fix; the check_status() method now returns 4 numbers on error as + described in the documentation (just negative values in this case). + - Bug fix; flushing of default output on password prompt. + - Bug fix; program fault when very long requests were to be sent. + IMAPFilter 2.5.7 - 16 Nov 2014 - Support for automatic validation of SSL connections, using the operating system's installed trusted CA certificates (usually from authorities that diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/README new/imapfilter-2.6.3/README --- old/imapfilter-2.5.7/README 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/README 2015-09-30 22:55:26.000000000 +0200 @@ -25,8 +25,8 @@ Installation - Compile time requirements are Lua (version 5.2 or 5.1), the PCRE library, and - the OpenSSL library. + Compile time requirements are Lua (version 5.3 or 5.2 or 5.1), the PCRE + library, and the OpenSSL library. Compile and install the program: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/doc/imapfilter.1 new/imapfilter-2.6.3/doc/imapfilter.1 --- old/imapfilter-2.5.7/doc/imapfilter.1 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/doc/imapfilter.1 2015-09-30 22:55:26.000000000 +0200 @@ -1,4 +1,4 @@ -.Dd Nov 9, 2014 +.Dd Jul 19, 2015 .Dt IMAPFILTER 1 .Os .Sh NAME @@ -44,12 +44,15 @@ .It Fl l Ar logfile File that contains logs of error messages produced. .It Fl t Ar truststore -The path to the system's SSL CA TrustStore directory. SSL connections will be -validated using the CA certificates found in this directory, and when this is -not possible the local +The path to the system's SSL CA TrustStore directory or file. SSL connections +will be validated using the CA certificates found in this directory or file, +and when this is not possible the local .Pa $HOME/.imapfilter/certificates -file will be used. The default is -.Pa /etc/ssl/certs . +file will be used. The default is either the +.Pa /etc/ssl/certs +directory or the +.Pa /etc/ssl/cert.pem +file, whichever is found. .It Fl V Displays version and copyright information. .It Fl v diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/doc/imapfilter_config.5 new/imapfilter-2.6.3/doc/imapfilter_config.5 --- old/imapfilter-2.5.7/doc/imapfilter_config.5 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/doc/imapfilter_config.5 2015-09-30 22:55:26.000000000 +0200 @@ -1,4 +1,4 @@ -.Dd Nov 9, 2014 +.Dd Sep 30, 2015 .Dt IMAPFILTER_CONFIG 5 .Os .Sh NAME @@ -141,6 +141,17 @@ as a value. Default is .Dq 29 minutes. +.It Va limit +Some servers have problems handling very long requests, but some of the +requests that need to be sent can become quite long, because they apply an +action for many messages at once. When this option is set, the client will try +to break up these requests into smaller requests, that each operates on fewer +messages at a time. A good value for this would be +.Dq 50, +This variable takes a +.Vt number +as a value. Default is +.Dq 0 . .It Va namespace When enabled, the program gets the namespace of the user's personal mailboxes, and applies automatically the prefix and hierarchy delimiter to any mailboxes @@ -196,7 +207,7 @@ .Dq false . .It Va timeout The time in seconds for the program to wait for a mail server's response. If -not set, the client will block indefinitely. This variable takes a +set to 0, the client will block indefinitely. This variable takes a .Vt number as a value. Default is .Dq 60 @@ -651,13 +662,17 @@ .El .Pp The following method can be used to search for messages that have a specific -flag set: +keyword flag set: .Pp .Bl -tag -width Ds -compact -.It Fn has_flag keyword +.It Fn has_keyword flag Messages with the specified keyword flag .Pq Vt string set. +.It Fn has_unkeyword flag +Messages without the specified keyword flag +.Pq Vt string +set. .El .Pp The following methods can be used to search for messages based on their size: @@ -838,7 +853,10 @@ .El .Pp The following methods can be used to do case-sensitive searching, for messages -that match a specific regular expression pattern. +that match a specific regular expression pattern. The matching mechanism that +is used to support this is based on the Perl-compatible regular expressions +(PCRE), and more information about the patterns and modifiers that can be used, +is available in the relevant documentation. .Pp This way of searching is not supported by the IMAP protocol, and this means that what actually happens under the hood, is that the relevant parts of all @@ -939,7 +957,7 @@ results = myaccount.mymailbox:is_recent() results = myaccount.mymailbox:is_larger(100000) results = myaccount.mymailbox:is_older(10) -results = myaccount.mymailbox:has_flag('MyFlag') +results = myaccount.mymailbox:has_keyword('MyFlag') results = myaccount.mymailbox:arrived_before('01-Jan-2007') results = myaccount.mymailbox:sent_since('01-Jan-2007') results = myaccount.mymailbox:contain_subject('test') @@ -1307,7 +1325,7 @@ become_daemon(600, myfunction) status = pipe_to('mycommandline', 'mydata') status, data = pipe_from('mycommandline') -success, capture = regex_search('^[PpCcRrEe]: (\e\ew)$', 'mystring') +success, capture = regex_search('^(?i)pcre: (\e\ew)$', 'mystring') .Ed .Sh EXAMPLES See @@ -1321,4 +1339,6 @@ User's home directory. .El .Sh SEE ALSO -.Xr imapfilter 1 +.Xr imapfilter 1 , +.Ad http://www.lua.org/docs.html , +.Ad http://pcre.org/original/doc/html/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/src/Makefile new/imapfilter-2.6.3/src/Makefile --- old/imapfilter-2.5.7/src/Makefile 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/src/Makefile 2015-09-30 22:55:26.000000000 +0200 @@ -18,7 +18,7 @@ CFLAGS = -Wall -Wextra -O -DCONFIG_SHAREDIR='"$(SHAREDIR)"' $(INCDIRS) $(MYCFLAGS) LDFLAGS = $(LIBDIRS) $(MYLDFLAGS) -LIBS = -lm $(LIBLUA) $(LIBPCRE) $(LIBSSL) $(LIBCRYPTO) $(MYLIBS) +LIBS = -lm -ldl $(LIBLUA) $(LIBPCRE) $(LIBSSL) $(LIBCRYPTO) $(MYLIBS) MAN1 = imapfilter.1 MAN5 = imapfilter_config.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/src/auxiliary.lua new/imapfilter-2.6.3/src/auxiliary.lua --- old/imapfilter-2.5.7/src/auxiliary.lua 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/src/auxiliary.lua 2015-09-30 22:55:26.000000000 +0200 @@ -14,6 +14,7 @@ else io.write('Enter password: ') end + io.flush() ifsys.noecho() local p = io.read() ifsys.echo() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/src/cert.c new/imapfilter-2.6.3/src/cert.c --- old/imapfilter-2.5.7/src/cert.c 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/src/cert.c 2015-09-30 22:55:26.000000000 +0200 @@ -20,8 +20,7 @@ int check_cert(X509 *pcert, unsigned char *pmd, unsigned int *pmdlen); void print_cert(X509 *cert, unsigned char *md, unsigned int *mdlen); char *get_serial(X509 *cert); -int write_cert(X509 *cert); -int mismatch_cert(void); +int store_cert(X509 *cert); /* @@ -44,8 +43,10 @@ verify = SSL_get_verify_result(ssn->sslconn); if (!((verify == X509_V_OK) || (verify == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) || - (verify == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY))) + (verify == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY))) { + error("certificate verification failed; %d\n", verify); goto fail; + } if (verify != X509_V_OK) { if (!(X509_digest(cert, EVP_md5(), md, &mdlen))) @@ -58,18 +59,12 @@ "can't accept certificate in " "non-interactive mode"); print_cert(cert, md, &mdlen); - if (write_cert(cert) == -1) + if (store_cert(cert) == -1) goto fail; break; case -1: - if (isatty(STDIN_FILENO) == 0) - fatal(ERROR_CERTIFICATE, "%s\n", - "certificate mismatch in non-interactive " - "mode"); - print_cert(cert, md, &mdlen); - if (mismatch_cert() == -1) - goto fail; - break; + error("certificate mismatch occured\n"); + goto fail; } } @@ -198,10 +193,10 @@ /* - * Write the SSL/TLS certificate after asking the user to accept/reject it. + * Store the SSL/TLS certificate after asking the user to accept/reject it. */ int -write_cert(X509 *cert) +store_cert(X509 *cert) { FILE *fd; char c, buf[LINE_MAX]; @@ -245,27 +240,3 @@ return 0; } - - -/* - * Ask user to proceed, while a fingerprint mismatch in the SSL/TLS certificate - * was found. - */ -int -mismatch_cert(void) -{ - char c, buf[LINE_MAX]; - - do { - printf("ATTENTION: SSL/TLS certificate fingerprint mismatch.\n" - "Proceed with the connection (y/n)? "); - if (fgets(buf, LINE_MAX, stdin) == NULL) - return -1; - c = tolower((int)(*buf)); - } while (c != 'y' && c != 'n'); - - if (c == 'y') - return 0; - else - return -1; -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/src/common.lua new/imapfilter-2.6.3/src/common.lua --- old/imapfilter-2.5.7/src/common.lua 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/src/common.lua 2015-09-30 22:55:26.000000000 +0200 @@ -91,8 +91,8 @@ end -function _make_query(criteria) - local s = 'ALL ' +function _make_query(criteria, messages) + local s = messages .. ' ' if criteria.invert ~= true then for ka, va in ipairs(criteria) do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/src/core.c new/imapfilter-2.6.3/src/core.c --- old/imapfilter-2.5.7/src/core.c 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/src/core.c 2015-09-30 22:55:26.000000000 +0200 @@ -190,10 +190,10 @@ return 0; lua_pushboolean(lua, (r == STATUS_OK)); - lua_pushnumber(lua, (lua_Number) (exists)); - lua_pushnumber(lua, (lua_Number) (recent)); - lua_pushnumber(lua, (lua_Number) (unseen)); - lua_pushnumber(lua, (lua_Number) (uidnext)); + lua_pushinteger(lua, (lua_Integer) (exists)); + lua_pushinteger(lua, (lua_Integer) (recent)); + lua_pushinteger(lua, (lua_Integer) (unseen)); + lua_pushinteger(lua, (lua_Integer) (uidnext)); return 5; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/src/file.c new/imapfilter-2.6.3/src/file.c --- old/imapfilter-2.5.7/src/file.c 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/src/file.c 2015-09-30 22:55:26.000000000 +0200 @@ -65,8 +65,7 @@ stat(fname, &fs); if (!S_ISREG(fs.st_mode)) { - error("file %s not a regular file\n", fname); - return -1; + return 0; } return 1; @@ -86,8 +85,7 @@ stat(dname, &ds); if (!S_ISDIR(ds.st_mode)) { - error("file %s not a directory\n", dname); - return -1; + return 0; } return 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/src/imapfilter.c new/imapfilter-2.6.3/src/imapfilter.c --- old/imapfilter-2.5.7/src/imapfilter.c 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/src/imapfilter.c 2015-09-30 22:55:26.000000000 +0200 @@ -42,6 +42,7 @@ main(int argc, char *argv[]) { int c; + char *cafile = NULL, *capath = NULL; setlocale(LC_CTYPE, ""); @@ -51,7 +52,12 @@ opts.config = NULL; opts.oneline = NULL; opts.debug = NULL; - opts.truststore = "/etc/ssl/certs"; + + opts.truststore = NULL; + if (exists_dir("/etc/ssl/certs")) + opts.truststore = "/etc/ssl/certs"; + else if (exists_file("/etc/ssl/cert.pem")) + opts.truststore = "/etc/ssl/cert.pem"; env.home = NULL; env.pathmax = -1; @@ -115,15 +121,17 @@ tls11ctx = SSL_CTX_new(TLSv1_1_client_method()); tls12ctx = SSL_CTX_new(TLSv1_2_client_method()); #endif - if (exists_dir(opts.truststore)) { - SSL_CTX_load_verify_locations(ssl3ctx, NULL, opts.truststore); - SSL_CTX_load_verify_locations(ssl23ctx, NULL, opts.truststore); - SSL_CTX_load_verify_locations(tls1ctx, NULL, opts.truststore); + if (exists_dir(opts.truststore)) + capath = opts.truststore; + else if (exists_file(opts.truststore)) + cafile = opts.truststore; + SSL_CTX_load_verify_locations(ssl3ctx, cafile, capath); + SSL_CTX_load_verify_locations(ssl23ctx, cafile, capath); + SSL_CTX_load_verify_locations(tls1ctx, cafile, capath); #if OPENSSL_VERSION_NUMBER >= 0x01000100fL - SSL_CTX_load_verify_locations(tls11ctx, NULL, opts.truststore); - SSL_CTX_load_verify_locations(tls12ctx, NULL, opts.truststore); + SSL_CTX_load_verify_locations(tls11ctx, cafile, capath); + SSL_CTX_load_verify_locations(tls12ctx, cafile, capath); #endif - } start_lua(); #if LUA_VERSION_NUM < 502 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/src/log.c new/imapfilter-2.6.3/src/log.c --- old/imapfilter-2.5.7/src/log.c 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/src/log.c 2015-09-30 22:55:26.000000000 +0200 @@ -39,6 +39,7 @@ va_start(args, fmt); vprintf(fmt, args); + fflush(stdout); va_end(args); } @@ -57,7 +58,6 @@ va_start(args, fmt); vfprintf(debugfp, fmt, args); fflush(debugfp); - va_end(args); } @@ -86,6 +86,7 @@ va_start(args, fmt); fprintf(stderr, "imapfilter: "); vfprintf(stderr, fmt, args); + fflush(stderr); va_end(args); if (logfp) { va_start(args, fmt); @@ -110,6 +111,7 @@ va_start(args, fmt); fprintf(stderr, "imapfilter: "); vfprintf(stderr, fmt, args); + fflush(stderr); va_end(args); if (logfp) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/src/mailbox.lua new/imapfilter-2.6.3/src/mailbox.lua --- old/imapfilter-2.5.7/src/mailbox.lua 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/src/mailbox.lua 2015-09-30 22:55:26.000000000 +0200 @@ -86,27 +86,39 @@ end -function Mailbox._send_query(self, criteria, charset) +function Mailbox._send_query(self, criteria, messages) _check_optional(criteria, { 'string', 'table' }) - _check_optional(charset, 'string') + _check_optional(messages, 'table') if self._cached_select(self) ~= true then return {} end + local mesgs + if messages == nil then + mesgs = nil + else + mesgs = _extract_messages(self, messages) + end + if mesgs == nil or #mesgs == 0 or + options.limit > 0 and #mesgs > options.limit then + mesgs = 'ALL' + else + mesgs = _make_range(mesgs) + mesgs = 'UID ' .. table.concat(mesgs, ',') + end + local query if criteria == nil then - query = 'ALL' + query = mesgs elseif type(criteria) == 'string' then - query = 'ALL ' .. criteria + query = mesgs .. ' ' .. criteria else - query = _make_query(criteria) + query = _make_query(criteria, mesgs) end - if charset == nil then - if type(options.charset) == 'string' then - charset = options.charset - else - charset = '' - end + if type(options.charset) == 'string' then + charset = options.charset + else + charset = '' end if not self._check_connection(self) then return end @@ -133,14 +145,15 @@ local f = '' if #flags ~= 0 then f = table.concat(flags, ' ') end + + local r = false local m = _make_range(messages) local n = #m - local r = false - for i = 1, n, 50 do - j = i + 49 - if n < j then - j = n - end + local l = n + if options.limit > 0 then l = options.limit end + for i = 1, n, l do + j = i + l - 1 + if n < j then j = n end if not self._check_connection(self) then return end r = ifcore.store(self._account._account.session, table.concat(m, ',', i, j), mode, f) @@ -163,11 +176,11 @@ local m = _make_range(messages) local n = #m - for i = 1, n, 50 do - j = i + 49 - if n < j then - j = n - end + local l = n + if options.limit > 0 then l = options.limit end + for i = 1, n, l do + j = i + l - 1 + if n < j then j = n end if not self._check_connection(self) then return end r = ifcore.copy(self._account._account.session, table.concat(m, ',', i, j), dest._mailbox) @@ -491,7 +504,7 @@ local r, exist, recent, unseen, uidnext = ifcore.status(self._account._account.session,self._mailbox) self._check_result(self, 'status', r) - if r == false then return false end + if r == false then return -1, -1, -1, -1 end if options.info == true then print(exist .. ' messages, ' .. recent .. ' recent, ' .. unseen .. @@ -502,8 +515,8 @@ end -function Mailbox.send_query(self, criteria, charset) - return Set(self._send_query(self, criteria, charset)) +function Mailbox.send_query(self, criteria, messages) + return Set(self._send_query(self, criteria, messages)) end function Mailbox.select_all(self) @@ -790,161 +803,172 @@ end -function Mailbox.is_answered(self) - return self.send_query(self, 'ANSWERED') +function Mailbox.is_answered(self, messages) + return self.send_query(self, 'ANSWERED', messages) end -function Mailbox.is_deleted(self) - return self.send_query(self, 'DELETED') +function Mailbox.is_deleted(self, messages) + return self.send_query(self, 'DELETED', messages) end -function Mailbox.is_draft(self) - return self.send_query(self, 'DRAFT') +function Mailbox.is_draft(self, messages) + return self.send_query(self, 'DRAFT', messages) end -function Mailbox.is_flagged(self) - return self.send_query(self, 'FLAGGED') +function Mailbox.is_flagged(self, messages) + return self.send_query(self, 'FLAGGED', messages) end -function Mailbox.is_new(self) - return self.send_query(self, 'NEW') +function Mailbox.is_new(self, messages) + return self.send_query(self, 'NEW', messages) end -function Mailbox.is_old(self) - return self.send_query(self, 'OLD') +function Mailbox.is_old(self, messages) + return self.send_query(self, 'OLD', messages) end -function Mailbox.is_recent(self) - return self.send_query(self, 'RECENT') +function Mailbox.is_recent(self, messages) + return self.send_query(self, 'RECENT', messages) end -function Mailbox.is_seen(self) - return self.send_query(self, 'SEEN') +function Mailbox.is_seen(self, messages) + return self.send_query(self, 'SEEN', messages) end -function Mailbox.is_unanswered(self) - return self.send_query(self, 'UNANSWERED') +function Mailbox.is_unanswered(self, messages) + return self.send_query(self, 'UNANSWERED', messages) end -function Mailbox.is_undeleted(self) - return self.send_query(self, 'UNDELETED') +function Mailbox.is_undeleted(self, messages) + return self.send_query(self, 'UNDELETED', messages) end -function Mailbox.is_undraft(self) - return self.send_query(self, 'UNDRAFT') +function Mailbox.is_undraft(self, messages) + return self.send_query(self, 'UNDRAFT', messages) end -function Mailbox.is_unflagged(self) - return self.send_query(self, 'UNFLAGGED') +function Mailbox.is_unflagged(self, messages) + return self.send_query(self, 'UNFLAGGED', messages) end -function Mailbox.is_unseen(self) - return self.send_query(self, 'UNSEEN') +function Mailbox.is_unseen(self, messages) + return self.send_query(self, 'UNSEEN', messages) end -function Mailbox.is_larger(self, size) + +function Mailbox.has_keyword(self, flag, message) + _check_required(flag, 'string') + return self.send_query(self, 'KEYWORD ' .. flag, messages) +end + +Mailbox.has_flag = Mailbox.has_keyword + +function Mailbox.has_unkeyword(self, flag, message) + _check_required(flag, 'string') + return self.send_query(self, 'UNKEYWORD ' .. flag, messages) +end + + +function Mailbox.is_larger(self, size, messages) _check_required(size, 'number') - return self.send_query(self, 'LARGER ' .. tostring(size)) + _check_optional(messages, 'table') + return self.send_query(self, 'LARGER ' .. tostring(size), messages) end -function Mailbox.is_smaller(self, size) +function Mailbox.is_smaller(self, size, messages) _check_required(size, 'number') - return self.send_query(self, 'SMALLER ' .. tostring(size)) + _check_optional(messages, 'table') + return self.send_query(self, 'SMALLER ' .. tostring(size), messages) end -function Mailbox.arrived_on(self, date) +function Mailbox.arrived_on(self, date, messages) _check_required(date, 'string') - return self.send_query(self, 'ON ' .. date) + return self.send_query(self, 'ON ' .. date, messages) end -function Mailbox.arrived_before(self, date) +function Mailbox.arrived_before(self, date, messages) _check_required(date, 'string') - return self.send_query(self, 'BEFORE ' .. date) + return self.send_query(self, 'BEFORE ' .. date, messages) end -function Mailbox.arrived_since(self, date) +function Mailbox.arrived_since(self, date, messages) _check_required(date, 'string') - return self.send_query(self, 'SINCE ' .. date) + return self.send_query(self, 'SINCE ' .. date, messages) end -function Mailbox.sent_on(self, date) +function Mailbox.sent_on(self, date, messages) _check_required(date, 'string') - return self.send_query(self, 'SENTON ' .. date) + return self.send_query(self, 'SENTON ' .. date, messages) end -function Mailbox.sent_before(self, date) +function Mailbox.sent_before(self, date, messages) _check_required(date, 'string') - return self.send_query(self, 'SENTBEFORE ' .. date) + return self.send_query(self, 'SENTBEFORE ' .. date, messages) end -function Mailbox.sent_since(self, date) +function Mailbox.sent_since(self, date, messages) _check_required(date, 'string') - return self.send_query(self, 'SENTSINCE ' .. date) + return self.send_query(self, 'SENTSINCE ' .. date, messages) end -function Mailbox.is_newer(self, days) +function Mailbox.is_newer(self, days, messages) _check_required(days, 'number') - return self.send_query(self, 'SINCE ' .. form_date(days)) + return self.send_query(self, 'SINCE ' .. form_date(days), messages) end -function Mailbox.is_older(self, days) +function Mailbox.is_older(self, days, messages) _check_required(days, 'number') - return self.send_query(self, 'BEFORE ' .. form_date(days)) -end - - -function Mailbox.has_flag(self, flag) - _check_required(flag, 'string') - return self.send_query(self, 'KEYWORD "' .. flag .. '"') + return self.send_query(self, 'BEFORE ' .. form_date(days), messages) end -function Mailbox.contain_field(self, field, string) +function Mailbox.contain_field(self, field, string, messages) _check_required(field, 'string') _check_required(string, 'string') - return self.send_query(self, 'HEADER ' .. field .. ' "' .. string .. '"') + return self.send_query(self, 'HEADER ' .. field .. ' "' .. string .. '"', + messages) end -function Mailbox.contain_bcc(self, string) +function Mailbox.contain_bcc(self, string, messages) _check_required(string, 'string') - return self.send_query(self, 'BCC "' .. string .. '"') + return self.send_query(self, 'BCC "' .. string .. '"', messages) end -function Mailbox.contain_cc(self, string) +function Mailbox.contain_cc(self, string, messages) _check_required(string, 'string') - return self.send_query(self, 'CC "' .. string .. '"') + return self.send_query(self, 'CC "' .. string .. '"', messages) end -function Mailbox.contain_from(self, string) +function Mailbox.contain_from(self, string, messages) _check_required(string, 'string') - return self.send_query(self, 'FROM "' .. string .. '"') + return self.send_query(self, 'FROM "' .. string .. '"', messages) end -function Mailbox.contain_subject(self, string) +function Mailbox.contain_subject(self, string, messages) _check_required(string, 'string') - return self.send_query(self, 'SUBJECT "' .. string .. '"') + return self.send_query(self, 'SUBJECT "' .. string .. '"', messages) end -function Mailbox.contain_to(self, string) +function Mailbox.contain_to(self, string, messages) _check_required(string, 'string') - return self.send_query(self, 'TO "' .. string .. '"') + return self.send_query(self, 'TO "' .. string .. '"', messages) end -function Mailbox.contain_header(self, string) +function Mailbox.contain_header(self, string, messages) _check_required(string, 'string') return self.send_query(self, 'TEXT "' .. string .. '" NOT BODY "' .. - string .. '"') + string .. '"', messages) end -function Mailbox.contain_body(self, string) +function Mailbox.contain_body(self, string, messages) _check_required(string, 'string') - return self.send_query(self, 'BODY "' .. string .. '"') + return self.send_query(self, 'BODY "' .. string .. '"', messages) end -function Mailbox.contain_message(self, string) +function Mailbox.contain_message(self, string, messages) _check_required(string, 'string') - return self.send_query(self, 'TEXT "' .. string .. '"') + return self.send_query(self, 'TEXT "' .. string .. '"', messages) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/src/options.lua new/imapfilter-2.6.3/src/options.lua --- old/imapfilter-2.5.7/src/options.lua 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/src/options.lua 2015-09-30 22:55:26.000000000 +0200 @@ -1,5 +1,7 @@ -- Options related to the interface implementation. options.cache = true +options.charset = '' options.close = false options.info = true +options.limit = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/src/request.c new/imapfilter-2.6.3/src/request.c --- old/imapfilter-2.5.7/src/request.c 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/src/request.c 2015-09-30 22:55:26.000000000 +0200 @@ -68,13 +68,15 @@ va_start(args, fmt); n = vsnprintf(obuf.data + obuf.len, obuf.size - obuf.len - strlen("\r\n") + 1, fmt, args); + va_end(args); if (n > (int)obuf.size) { buffer_check(&obuf, n); + va_start(args, fmt); vsnprintf(obuf.data + obuf.len, obuf.size - obuf.len - strlen("\r\n") + 1, fmt, args); + va_end(args); } obuf.len = strlen(obuf.data); - va_end(args); snprintf(obuf.data + obuf.len, obuf.size - obuf.len + 1, "\r\n"); obuf.len = strlen(obuf.data); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/src/set.lua new/imapfilter-2.6.3/src/set.lua --- old/imapfilter-2.5.7/src/set.lua 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/src/set.lua 2015-09-30 22:55:26.000000000 +0200 @@ -244,7 +244,7 @@ function Set.send_query(self, criteria) local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.send_query(mbox, criteria) + set = set + mbox.send_query(mbox, criteria, self) end return self * set end @@ -252,7 +252,7 @@ function Set.is_answered(self) local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_answered(mbox) + set = set + mbox.is_answered(mbox, self) end return self * set end @@ -260,7 +260,7 @@ function Set.is_deleted(self) local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_deleted(mbox) + set = set + mbox.is_deleted(mbox, self) end return self * set end @@ -268,7 +268,7 @@ function Set.is_draft(self) local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_draft(mbox) + set = set + mbox.is_draft(mbox, self) end return self * set end @@ -276,7 +276,7 @@ function Set.is_flagged(self) local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_flagged(mbox) + set = set + mbox.is_flagged(mbox, self) end return self * set end @@ -284,7 +284,7 @@ function Set.is_new(self) local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_new(mbox) + set = set + mbox.is_new(mbox, self) end return self * set end @@ -292,7 +292,7 @@ function Set.is_old(self) local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_old(mbox) + set = set + mbox.is_old(mbox, self) end return self * set end @@ -300,7 +300,7 @@ function Set.is_recent(self) local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_recent(mbox) + set = set + mbox.is_recent(mbox, self) end return self * set end @@ -308,7 +308,7 @@ function Set.is_seen(self) local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_seen(mbox) + set = set + mbox.is_seen(mbox, self) end return self * set end @@ -316,7 +316,7 @@ function Set.is_unanswered(self) local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_unanswered(mbox) + set = set + mbox.is_unanswered(mbox, self) end return self * set end @@ -324,7 +324,7 @@ function Set.is_undeleted(self) local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_undeleted(mbox) + set = set + mbox.is_undeleted(mbox, self) end return self * set end @@ -332,7 +332,7 @@ function Set.is_undraft(self) local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_undraft(mbox) + set = set + mbox.is_undraft(mbox, self) end return self * set end @@ -340,7 +340,7 @@ function Set.is_unflagged(self) local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_unflagged(mbox) + set = set + mbox.is_unflagged(mbox, self) end return self * set end @@ -348,17 +348,41 @@ function Set.is_unseen(self) local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_unseen(mbox) + set = set + mbox.is_unseen(mbox, self) end return self * set end + +function Set.has_keyword(self, flag) + _check_required(flag, 'string') + + local set = Set() + for mbox in pairs(_extract_mailboxes(self)) do + set = set + mbox.has_keyword(mbox, flag, self) + end + return self * set +end + +Set.has_flag = Set.has_keyword + +function Set.has_unkeyword(self, flag) + _check_required(flag, 'string') + + local set = Set() + for mbox in pairs(_extract_mailboxes(self)) do + set = set + mbox.has_unkeyword(mbox, flag, self) + end + return self * set +end + + function Set.is_larger(self, size) _check_required(size, 'number') local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_larger(mbox, size) + set = set + mbox.is_larger(mbox, size, self) end return self * set end @@ -368,7 +392,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_smaller(mbox, size) + set = set + mbox.is_smaller(mbox, size, self) end return self * set end @@ -379,7 +403,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.arrived_on(mbox, date) + set = set + mbox.arrived_on(mbox, date, self) end return self * set end @@ -389,7 +413,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.arrived_before(mbox, date) + set = set + mbox.arrived_before(mbox, date, self) end return self * set end @@ -399,7 +423,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.arrived_since(mbox, date) + set = set + mbox.arrived_since(mbox, date, self) end return self * set end @@ -409,7 +433,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.sent_on(mbox, date) + set = set + mbox.sent_on(mbox, date, self) end return self * set end @@ -419,7 +443,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.sent_before(mbox, date) + set = set + mbox.sent_before(mbox, date, self) end return self * set end @@ -429,7 +453,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.sent_since(mbox, date) + set = set + mbox.sent_since(mbox, date, self) end return self * set end @@ -439,7 +463,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_newer(mbox, days) + set = set + mbox.is_newer(mbox, days, self) end return self * set end @@ -449,18 +473,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.is_older(mbox, days) - end - return self * set -end - - -function Set.has_flag(self, flag) - _check_required(flag, 'string') - - local set = Set() - for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.has_flag(mbox, flag) + set = set + mbox.is_older(mbox, days, self) end return self * set end @@ -472,7 +485,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.contain_field(mbox, field, string) + set = set + mbox.contain_field(mbox, field, string, self) end return self * set end @@ -482,7 +495,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.contain_bcc(mbox, string) + set = set + mbox.contain_bcc(mbox, string, self) end return self * set end @@ -492,7 +505,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.contain_cc(mbox, string) + set = set + mbox.contain_cc(mbox, string, self) end return self * set end @@ -502,7 +515,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.contain_from(mbox, string) + set = set + mbox.contain_from(mbox, string, self) end return self * set end @@ -512,7 +525,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.contain_subject(mbox, string) + set = set + mbox.contain_subject(mbox, string, self) end return self * set end @@ -522,7 +535,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.contain_to(mbox, string) + set = set + mbox.contain_to(mbox, string, self) end return self * set end @@ -532,7 +545,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.contain_header(mbox, string) + set = set + mbox.contain_header(mbox, string, self) end return self * set end @@ -542,7 +555,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.contain_body(mbox, string) + set = set + mbox.contain_body(mbox, string, self) end return self * set end @@ -552,7 +565,7 @@ local set = Set() for mbox in pairs(_extract_mailboxes(self)) do - set = set + mbox.contain_message(mbox, string) + set = set + mbox.contain_message(mbox, string, self) end return self * set end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.7/src/version.h new/imapfilter-2.6.3/src/version.h --- old/imapfilter-2.5.7/src/version.h 2014-11-16 16:36:40.000000000 +0100 +++ new/imapfilter-2.6.3/src/version.h 2015-09-30 22:55:26.000000000 +0200 @@ -3,10 +3,10 @@ /* Program's version number. */ -#define VERSION "2.5.7" +#define VERSION "2.6.3" /* Program's copyright. */ -#define COPYRIGHT "Copyright (c) 2001-2014 Eleftherios Chatzimparmpas" +#define COPYRIGHT "Copyright (c) 2001-2015 Eleftherios Chatzimparmpas" #endif /* VERSION_H */
