From 18443d247e1035b0beb3763d12b7a239e6d3d8ef Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Thu, 1 Nov 2018 13:55:51 +1000 Subject: [PATCH] use uuids for qwk message ids --- src/bluewave.c | 8 ++++++-- src/mail_menu.c | 13 ++++++++++--- src/www_msgs.c | 7 +++++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/bluewave.c b/src/bluewave.c index cd8a610..62c5878 100644 --- a/src/bluewave.c +++ b/src/bluewave.c @@ -592,8 +592,9 @@ int bwave_add_message(int confr, int area, unsigned int dwritten, char *to, char s_JamSubfield jsf; int z; char buffer[256]; + char qwkuuid[38]; uuid_t magi_msgid; - + uuid_t qwk_msgid; struct mail_area *ma = get_area(confr, area); jb = open_jam_base(ma->path); if (!jb) { @@ -701,7 +702,10 @@ int bwave_add_message(int confr, int area, unsigned int dwritten, char *to, char JAM_PutSubfield(jsp, &jsf); if (conf.external_address != NULL) { - snprintf(buffer, sizeof buffer, "<%lx.%s@%s>", generate_msgid(), basename(ma->path), conf.external_address); + + uuid_generate(qwk_msgid); + uuid_unparse_lower(qwk_msgid, qwkuuid); + snprintf(buffer, sizeof buffer, "<%s@%s>", qwkuuid, conf.external_address); jsf.LoID = JAMSFLD_MSGID; jsf.HiID = 0; diff --git a/src/mail_menu.c b/src/mail_menu.c index 5d40487..8b6918b 100644 --- a/src/mail_menu.c +++ b/src/mail_menu.c @@ -1388,6 +1388,7 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno s_JamLastRead jlr; char buffer[256]; + char qwkuuid[38]; int z, z2; struct tm msg_date; @@ -1411,6 +1412,7 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno int position; int y; uuid_t magi_msgid; + uuid_t qwk_msgid; struct ptr_vector msg_lines; init_ptr_vector(&msg_lines); @@ -1734,7 +1736,9 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno JAM_PutSubfield(jsp, &jsf); if (conf.external_address != NULL) { - snprintf(buffer, sizeof buffer, "<%lx.%s@%s>", generate_msgid(), basename(ma->path), conf.external_address); + uuid_generate(qwk_msgid); + uuid_unparse_lower(qwk_msgid, qwkuuid); + snprintf(buffer, sizeof buffer, "<%s@%s>", qwkuuid, conf.external_address); jsf.LoID = JAMSFLD_MSGID; jsf.HiID = 0; @@ -2027,11 +2031,12 @@ void post_message(struct user_record *user) { struct fido_addr *from_addr = NULL; char buffer[256]; char buffer2[256]; + char qwkuuid[38]; int z; int sem_fd; char *bbsname; uuid_t magi_msgid; - + uuid_t qwk_msgid; s_JamBase *jb; s_JamMsgHeader jmh; s_JamSubPacket *jsp; @@ -2203,7 +2208,9 @@ void post_message(struct user_record *user) { JAM_PutSubfield(jsp, &jsf); if (conf.external_address != NULL) { - snprintf(buffer, sizeof buffer, "<%lx.%s@%s>", generate_msgid(), basename(ma->path), conf.external_address); + uuid_generate(qwk_msgid); + uuid_unparse_lower(qwk_msgid, qwkuuid); + snprintf(buffer, sizeof buffer, "<%s@%s>", qwkuuid, conf.external_address); jsf.LoID = JAMSFLD_MSGID; jsf.HiID = 0; diff --git a/src/www_msgs.c b/src/www_msgs.c index 62bdeed..5d86a16 100644 --- a/src/www_msgs.c +++ b/src/www_msgs.c @@ -945,6 +945,7 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference, int max_len; int len; char buffer[256]; + char qwkuuid[38]; char *body2; char *tagline; struct utsname name; @@ -956,7 +957,7 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference, size_t sz; char *inbuf, *oubuf; - uuid_t magi_msgid; + uuid_t magi_msgid, qwk_msgid; if (subj == NULL || to == NULL || body == NULL) { return 0; @@ -1086,7 +1087,9 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference, JAM_PutSubfield(jsp, &jsf); if (conf.external_address != NULL) { - snprintf(buffer, sizeof buffer, "<%lx.%s@%s>", generate_msgid(), basename(ma->path), conf.external_address); + uuid_generate(qwk_msgid); + uuid_unparse_lower(qwk_msgid, qwkuuid); + snprintf(buffer, sizeof buffer, "<%s@%s>", qwkuuid, conf.external_address); jsf.LoID = JAMSFLD_MSGID; jsf.HiID = 0;