From 5ecec81c22623035fbd404d3b29d717ca300dc0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Sat, 16 Nov 2024 15:23:47 -0500
Subject: [PATCH] Replace / with - in group/sub names

Almost no clients support a / in names.  Maybe I'll define an x-
extension or something when I write my own mail client.
---
 exec/imapservice.js | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/exec/imapservice.js b/exec/imapservice.js
index a9ab705826..9fd9b0a7b0 100644
--- a/exec/imapservice.js
+++ b/exec/imapservice.js
@@ -13,7 +13,7 @@ load("822header.js");
 load("mime.js");
 
 var sepchar="|";
-var debug_exceptions = true;
+var debug_exceptions = false;
 var debug=false;
 var debugRX=false;
 
@@ -1244,8 +1244,9 @@ function sublist(group, match, subscribed)
 		ret.push("INBOX");
 
 	for(grp in msg_area.grp_list) {
-		if(re.test(msg_area.grp_list[grp].description))
-			ret.push((msg_area.grp_list[grp].description+sepchar).replace(/&/g,'&-'));
+		if(re.test(msg_area.grp_list[grp].description)) {
+			ret.push((msg_area.grp_list[grp].description+sepchar).replace(/&/g,'&-').replace(/\//g,'-'));
+		}
 
 		for(sub in msg_area.grp_list[grp].sub_list) {
 			code = msg_area.grp_list[grp].sub_list[sub].code
@@ -1264,7 +1265,7 @@ function sublist(group, match, subscribed)
 					if(base == undefined || sub=="NONE!!!" || (!base.open()))
 						continue;
 					base.close();
-					ret.push((msg_area.grp_list[grp].description+sepchar+msg_area.grp_list[grp].sub_list[sub].description).replace(/&/g,'&-'));
+					ret.push((msg_area.grp_list[grp].description+sepchar+msg_area.grp_list[grp].sub_list[sub].description).replace(/&/g,'&-').replace(/\//g,'-'));
 				}
 			}
 		}
@@ -1282,9 +1283,9 @@ function getsub(longname) {
 	longname = longname.replace(/&-/g,'&');
 	components=longname.split(sepchar);
 	for(grp in msg_area.grp_list) {
-		if(msg_area.grp_list[grp].description==components[0]) {
+		if(msg_area.grp_list[grp].description.replace(/\//g,'-')==components[0]) {
 			for(sub in msg_area.grp_list[grp].sub_list) {
-				if(components[1]==msg_area.grp_list[grp].sub_list[sub].description) {
+				if(components[1]==msg_area.grp_list[grp].sub_list[sub].description.replace(/\//g,'-')) {
 					return(msg_area.grp_list[grp].sub_list[sub].code);
 				}
 			}
-- 
GitLab