...
 
Commits (1)
  • Rob Swindell's avatar
    2 new (mutually exclusive) command-line options: -force and -filter · d124e3fb
    Rob Swindell authored
    These options are to attempt to address the issue (#178) reported by Michael J. Ryan
    with regards to a Thunderbird error:
    "Sending of the messages failed. You can only send to one news server at a time."
    when attempting to reply to a message that was posted to multiple newsgroups,
    but the server has not actually advertised that it serves that newsgroups (because
    it doesn't or the names a different than one the server uses for the same area).
    
    -force will force the export "Newsgroups" header field to contain only the name
    of the locally selectec newsgroup.
    -filter will remove any Newsgroup names from the exported "Newsgroups" header
    if they don't exist on the local server.
    d124e3fb
......@@ -53,6 +53,8 @@ var impose_limit = true;
var sysop_login = false;
var add_tag = true;
var ex_ascii = true;
var force_newsgroups = false;
var filter_newsgroups = false;
// Parse arguments
for(i=0;i<argc;i++) {
......@@ -70,6 +72,10 @@ for(i=0;i<argc;i++) {
add_tag = false;
else if(argv[i].toLowerCase()=="-ascii")
ex_ascii = false;
else if(argv[i].toLowerCase()=="-force")
force_newsgroups = true;
else if(argv[i].toLowerCase()=="-filter")
filter_newsgroups = true;
else if(argv[i].toLowerCase()=="-auto") {
no_anonymous = true;
auto_login = true;
......@@ -282,6 +288,17 @@ while(client.socket.is_connected && !quit) {
}
}
// list of newsgroup names the logged-in user has access to
var newsgroup_list = [];
if(include_mail) {
newsgroup_list.push("mail");
}
for(g in msg_area.grp_list) {
for(s in msg_area.grp_list[g].sub_list) {
newsgroup_list.push(msg_area.grp_list[g].sub_list[s].newsgroup);
}
}
/* These commands require login/authentication */
switch(cmd[0].toUpperCase()) {
......@@ -758,17 +775,19 @@ while(client.socket.is_connected && !quit) {
if(hdr.path==undefined)
hdr.path="not-for-mail";
if(hdr.newsgroups==undefined)
if(hdr.newsgroups==undefined || force_newsgroups)
hdr.newsgroups = selected.newsgroup;
else { /* Tracker1's mod for adding the correct newsgroup name */
var ng_found = false; /* Requires sbbs v3.13 */
else {
var ng_list = hdr.newsgroups.split(',');
for(n in ng_list)
if(ng_list[n].toLowerCase() == selected.newsgroup.toLowerCase()) {
ng_found = true;
break;
}
if(!ng_found)
var filtered_list = [];
for(n in ng_list) {
if(filter_newsgroups && newsgroup_list.indexOf(ng_list[n]) < 0)
continue;
filtered_list.push(ng_list[n]);
}
hdr.newsgroups = filtered_list.join(',');
/* Tracker1's mod for adding the correct newsgroup name */
if(filtered_list.indexOf(selected.newsgroup) < 0)
hdr.newsgroups = selected.newsgroup + ',' + hdr.newsgroups;
}
......