Skip to content

Commit 6e6124a

Browse files
committed
backend update to 24.10.000.073
1 parent fd5cf18 commit 6e6124a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1473
-906
lines changed

backend/build-backend.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
3838
lib:
3939
src/script/data/bav.rc
40-
src/script/data/bav.rule
4140
4241
scripts mode=0755:
4342
src/script/tools/activator3.py
@@ -50,6 +49,8 @@
5049
src/script/tools/service3.py
5150
src/script/tools/service3.cfg mode=0644
5251
src/script/lib/cq.rc mode=0644
52+
src/script/lib/requirements.py
53+
src/script/lib/requirements.txt mode=0644
5354
5455
scripts/agn3:
5556
src/script/lib/agn3/*.*
@@ -66,9 +67,6 @@
6667
6768
scripts/once/tags:
6869
lib/tags/*.lua
69-
70-
scripts/requirements:
71-
src/script/lib/requirements.txt mode=0644
7270
"""
7371

7472
def toint (s: Any) -> int:
@@ -162,7 +160,7 @@ def create_package (self) -> None:
162160
tf.addfile (ti)
163161
#
164162
# on-the-fly created file
165-
build_spec = f'{self.version};{datetime.fromtimestamp (now):%Y-%m-%d %H:%M:%S};openemm.org;openemm'.encode ('UTF-8')
163+
build_spec = f'{self.version};{datetime.fromtimestamp (now):%Y-%m-%d %H:%M:%S};openemm.org;openemm;openemm'.encode ('UTF-8')
166164
ti = tarfile.TarInfo (os.path.join (self.directory, 'scripts', 'build.spec'))
167165
ti.size = len (build_spec)
168166
ti.mtime = now

backend/src/c/lib/agn.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ typedef struct { /*{{{*/
348348
const char *timestamp;
349349
const char *host;
350350
const char *user;
351+
const char *typ;
351352
/*}}}*/
352353
} build_t;
353354

@@ -409,6 +410,7 @@ extern void buffer_ltrim (buffer_t *b);
409410
extern void buffer_rtrim (buffer_t *b);
410411
extern void buffer_trim (buffer_t *b);
411412
extern void buffer_universal_newline (buffer_t *b, int start);
413+
extern bool_t buffer_universal_crlf (buffer_t *b, int start);
412414

413415
extern pool_t *pool_alloc (void);
414416
extern pool_t *pool_free (pool_t *p);

backend/src/c/lib/buffer.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,49 @@ buffer_universal_newline (buffer_t *b, int start) /*{{{*/
823823
if (src != dst)
824824
b -> length -= src - dst;
825825
}/*}}}*/
826+
bool_t
827+
buffer_universal_crlf (buffer_t *b, int start) /*{{{*/
828+
{
829+
bool_t ok;
830+
buffer_t *scratch;
831+
832+
ok = true;
833+
if (start < buffer_length (b))
834+
if (scratch = buffer_alloc (buffer_length (b) + 128)) {
835+
int pending;
836+
int n;
837+
byte_t *src;
838+
bool_t modified;
839+
840+
modified = false;
841+
for (n = pending = start, src = b -> buffer + start; ok && (n < b -> length); )
842+
if (*src == '\r') {
843+
++n, ++src;
844+
if ((n < b -> length) && (*src == '\n'))
845+
++n, ++src;
846+
} else {
847+
if (*src == '\n') {
848+
if (pending < n)
849+
ok = buffer_stiff (scratch, b -> buffer + pending, n - pending);
850+
pending = n + 1;
851+
if (ok && (ok = buffer_stiffsn (scratch, "\r\n", 2)))
852+
modified = true;
853+
}
854+
++n, ++src;
855+
}
856+
if (ok && modified) {
857+
if (pending < n)
858+
ok = buffer_stiff (scratch, b -> buffer + pending, n - pending);
859+
if (ok) {
860+
buffer_truncate (b, start);
861+
ok = buffer_appendbuf (b, scratch);
862+
}
863+
}
864+
buffer_free (scratch);
865+
} else
866+
ok = false;
867+
return ok;
868+
}/*}}}*/
826869

827870
struct pool { /*{{{*/
828871
buffer_t *root;

backend/src/c/lib/build.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ build_alloc (void) /*{{{*/
3737
while ((n > 0) && strchr (" \t\r\n\v", (b -> version[n - 1])))
3838
--n;
3939
b -> version[n] = '\0';
40-
b -> timestamp = b -> host = b -> user = b -> version + n;
40+
b -> timestamp = b -> host = b -> user = b -> typ = b -> version + n;
4141
if (ptr = strchr (b -> version, ';')) {
4242
*ptr++ = '\0';
4343
b -> timestamp = ptr;
@@ -47,6 +47,12 @@ build_alloc (void) /*{{{*/
4747
if (ptr = strchr (ptr, ';')) {
4848
*ptr++ = '\0';
4949
b -> user = ptr;
50+
if (ptr = strchr (ptr, ';')) {
51+
*ptr++ = '\0';
52+
b -> typ = ptr;
53+
if (ptr = strchr (ptr, ';'))
54+
*ptr = '\0';
55+
}
5056
}
5157
}
5258
}

backend/src/c/lib/fsdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ fsdb_remove (fsdb_t *f, const char *key) /*{{{*/
252252
if (errno == ENOENT)
253253
return true;
254254
} else if (S_ISREG (st.st_mode) && (unlink (f -> path) != -1))
255-
return true;
255+
return true;
256256
}
257257
return false;
258258
}/*}}}*/

backend/src/c/lib/systemconfig.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ config_extra (systemconfig_t *c) /*{{{*/
390390
config_add (c, "build.timestamp", build && build -> timestamp ? build -> timestamp : "unknown");
391391
config_add (c, "build.host", build && build -> host ? build -> host : "unknown");
392392
config_add (c, "build.user", build && build -> user ? build -> user : "unknwon");
393+
config_add (c, "build.typ", build && build -> typ ? build -> typ : "classic");
393394
if (build)
394395
build_free (build);
395396
if ((fd = open (PATH_OSRELEASE, O_RDONLY)) != -1) {

backend/src/c/tools/cquery.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ execute_script (const char *filename, const char *script, char **argv, int argc)
5555
if (! rc) {
5656
lua_State *lua;
5757
int n;
58+
const char *ptr;
5859
char *path;
5960

6061
if (! (lua = alua_alloc (Worthy))) {
@@ -67,12 +68,15 @@ execute_script (const char *filename, const char *script, char **argv, int argc)
6768
lua_seti (lua, -2, n + 1);
6869
}
6970
lua_setglobal (lua, "argv");
70-
for (n = 0; n < 2; ++n) {
71+
for (n = 0; n < 3; ++n) {
7172
switch (n) {
7273
case 0:
73-
path = mkpath (path_home (), ".cqrc", NULL);
74+
path = (ptr = getenv ("CQRC")) ? strdup (ptr) : NULL;
7475
break;
7576
case 1:
77+
path = mkpath (path_home (), ".cqrc", NULL);
78+
break;
79+
case 2:
7680
path = mkpath (path_home (), "scripts", "cq.rc", NULL);
7781
break;
7882
default:

backend/src/c/xmlback/block.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ block_alloc (void) /*{{{*/
8383
b -> bout = NULL;
8484
DO_ZERO (b, tagpos);
8585
b -> inuse = false;
86+
b -> dvalue = 0;
8687
}
8788
return b;
8889
}/*}}}*/

backend/src/c/xmlback/blockmail.c

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ blockmail_alloc (const char *fname, bool_t syncfile, log_t *lg) /*{{{*/
175175

176176
b -> ltag = NULL;
177177
b -> taglist_count = 0;
178-
b -> clear_empty_dyn_block = false;
178+
b -> clear_empty_dyn_block = true;
179+
b -> clear_empty_dyn_block_without_dvalue = true;
179180

180181
b -> gtag = NULL;
181182
b -> globaltag_count = 0;
@@ -193,6 +194,8 @@ blockmail_alloc (const char *fname, bool_t syncfile, log_t *lg) /*{{{*/
193194
DO_ZERO (b, url);
194195
DO_ZERO (b, link_resolve);
195196

197+
b -> virtuals = NULL;
198+
196199
DO_ZERO (b, field);
197200
b -> mailtype_index = -1;
198201

@@ -211,8 +214,6 @@ blockmail_alloc (const char *fname, bool_t syncfile, log_t *lg) /*{{{*/
211214
b -> spf = NULL;
212215
b -> vip = NULL;
213216
b -> onepix_template = NULL;
214-
b -> offline_picture_prefix = NULL;
215-
b -> opp_len = 0;
216217
b -> force_ecs_uid = false;
217218
b -> uid_version = 0;
218219

@@ -337,6 +338,8 @@ blockmail_free (blockmail_t *b) /*{{{*/
337338

338339
DO_FREE (b, url);
339340
DO_FREE (b, link_resolve);
341+
if (b -> virtuals)
342+
var_free_all (b -> virtuals);
340343
DO_FREE (b, field);
341344
if (b -> target_groups)
342345
free (b -> target_groups);
@@ -352,8 +355,6 @@ blockmail_free (blockmail_t *b) /*{{{*/
352355
xmlBufferFree (b -> vip);
353356
if (b -> onepix_template)
354357
xmlBufferFree (b -> onepix_template);
355-
if (b -> offline_picture_prefix)
356-
free (b -> offline_picture_prefix);
357358
free (b);
358359
}
359360
return NULL;
@@ -752,6 +753,8 @@ blockmail_setup_tagpositions (blockmail_t *b) /*{{{*/
752753

753754
if (tmp = company_info_find (b, "clear-empty-dyn-block"))
754755
b -> clear_empty_dyn_block = atob (tmp -> val);
756+
if (tmp = company_info_find (b, "clear-empty-dyn-block-enhanced"))
757+
b -> clear_empty_dyn_block_without_dvalue = atob (tmp -> val);
755758
if (b -> ltag) {
756759
int n, m;
757760
dyn_t *d, *dd;
@@ -766,22 +769,6 @@ blockmail_setup_tagpositions (blockmail_t *b) /*{{{*/
766769
}
767770
}/*}}}*/
768771
void
769-
blockmail_setup_offline_picture_prefix (blockmail_t *b) /*{{{*/
770-
{
771-
var_t *tmp;
772-
773-
if (tmp = company_info_find (b, "offline-picture-prefix")) {
774-
if (b -> offline_picture_prefix) {
775-
free (b -> offline_picture_prefix);
776-
b -> offline_picture_prefix = NULL;
777-
}
778-
if (tmp -> val && (b -> offline_picture_prefix = strdup (tmp -> val)))
779-
b -> opp_len = strlen (b -> offline_picture_prefix);
780-
else
781-
b -> opp_len = 0;
782-
}
783-
}/*}}}*/
784-
void
785772
blockmail_setup_auto_url_prefix (blockmail_t *b, const char *nprefix) /*{{{*/
786773
{
787774
if (b -> auto_url_prefix)

backend/src/c/xmlback/blockspec.c

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ blockspec_alloc (void) /*{{{*/
2222
b -> prefix = fix_alloc ();
2323
DO_ZERO (b, postfix);
2424
b -> linelength = 0;
25-
b -> linesep = NULL;
26-
b -> seplength = 0;
2725
b -> opl = Add_None;
2826
b -> clearance = false;
2927
if (! b -> prefix)
@@ -38,65 +36,7 @@ blockspec_free (blockspec_t *b) /*{{{*/
3836
if (b -> prefix)
3937
fix_free (b -> prefix);
4038
DO_FREE (b, postfix);
41-
if (b -> linesep)
42-
free (b -> linesep);
4339
free (b);
4440
}
4541
return NULL;
4642
}/*}}}*/
47-
bool_t
48-
blockspec_set_lineseparator (blockspec_t *b, const xmlChar *sep, int slen) /*{{{*/
49-
{
50-
bool_t rc;
51-
52-
rc = true;
53-
if (! sep) {
54-
if (b -> linesep) {
55-
free (b -> linesep);
56-
b -> linesep = NULL;
57-
}
58-
b -> seplength = 0;
59-
} else if (b -> linesep = (b -> linesep ? realloc (b -> linesep, slen) : malloc (slen))) {
60-
memcpy (b -> linesep, sep, slen);
61-
b -> seplength = slen;
62-
} else
63-
rc = false;
64-
return rc;
65-
}/*}}}*/
66-
bool_t
67-
blockspec_find_lineseparator (blockspec_t *b) /*{{{*/
68-
{
69-
const xmlChar *sep;
70-
int slen;
71-
int len;
72-
const xmlChar *cont;
73-
int n;
74-
75-
sep = NULL;
76-
slen = 0;
77-
if (b -> block && b -> block -> content) {
78-
len = xmlBufferLength (b -> block -> content);
79-
cont = xmlBufferContent (b -> block -> content);
80-
for (n = 0; n < len; )
81-
if ((cont[n] == '\r') || (cont[n] == '\n')) {
82-
sep = cont + n;
83-
slen = 1;
84-
++n;
85-
if (n < len)
86-
if (sep[0] == '\r') {
87-
if (cont[n] == '\n')
88-
slen++;
89-
} else if (sep[0] == '\n') {
90-
if (cont[n] == '\r')
91-
slen++;
92-
}
93-
break;
94-
} else
95-
n += xmlCharLength (cont[n]);
96-
if (! sep) {
97-
sep = char2xml ("\r\n");
98-
slen = 2;
99-
}
100-
}
101-
return blockspec_set_lineseparator (b, sep, slen);
102-
}/*}}}*/

backend/src/c/xmlback/head.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ head_set_value (head_t *h, buffer_t *value) /*{{{*/
158158
bool_t
159159
head_matchn (head_t *h, const char *name, int namelength) /*{{{*/
160160
{
161-
if (head_find_name (h, NULL) && (h -> _namelength > 0) && (h -> _namelength == namelength) && (! strcmp (h -> _name, name)))
161+
if (head_find_name (h, NULL) && (h -> _namelength == namelength) && (! strcmp (h -> _name, name)))
162162
return true;
163163
return false;
164164
}/*}}}*/
@@ -167,6 +167,18 @@ head_match (head_t *h, const char *name) /*{{{*/
167167
{
168168
return head_matchn (h, name, strlen (name));
169169
}/*}}}*/
170+
bool_t
171+
head_startswithn (head_t *h, const char *name, int namelength) /*{{{*/
172+
{
173+
if (head_find_name (h, NULL) && (h -> _namelength >= namelength) && (! strncmp (h -> _name, name, namelength)))
174+
return true;
175+
return false;
176+
}/*}}}*/
177+
bool_t
178+
head_startswith (head_t *h, const char *name) /*{{{*/
179+
{
180+
return head_startswithn (h, name, strlen (name));
181+
}/*}}}*/
170182
char *
171183
head_is (head_t *h, const char *name) /*{{{*/
172184
{

backend/src/c/xmlback/modify.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ modify_linelength (blockmail_t *blockmail, block_t *block, blockspec_t *bspec) /
13011301
if (slen > 0)
13021302
xmlBufferAdd (block -> out, cont + spos, slen);
13031303
if (doit & DOIT_NEWLINE) {
1304-
xmlBufferAdd (block -> out, bspec -> linesep, bspec -> seplength);
1304+
xmlBufferCCat (block -> out, "\n");
13051305
changed = true;
13061306
}
13071307
if (doit & DOIT_SKIP) {
@@ -1362,8 +1362,7 @@ modify_output (blockmail_t *blockmail, receiver_t *rec, block_t *block, blockspe
13621362
if (rc &&
13631363
(block -> tid == TID_EMail_Text) &&
13641364
bspec &&
1365-
(bspec -> linelength > 0) &&
1366-
bspec -> linesep) {
1365+
(bspec -> linelength > 0)) {
13671366
rc = modify_linelength (blockmail, block, bspec);
13681367
}
13691368
return rc;

0 commit comments

Comments
 (0)