Skip to content
Snippets Groups Projects
Commit cd9b8ce3 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Merge remote-tracking branch 'origin/master'

parents 11c59f7e 490aceeb
No related branches found
No related tags found
No related merge requests found
...@@ -106,7 +106,10 @@ function getReferenceTo(hdr) { ...@@ -106,7 +106,10 @@ function getReferenceTo(hdr) {
for(s in msg_area.grp_list[g].sub_list) for(s in msg_area.grp_list[g].sub_list)
if (msg_area.grp_list[g].sub_list[s].newsgroup.toLowerCase() == newsgroups[n].toLowerCase()) { if (msg_area.grp_list[g].sub_list[s].newsgroup.toLowerCase() == newsgroups[n].toLowerCase()) {
var mb=new MsgBase(msg_area.grp_list[g].sub_list[s].code); var mb=new MsgBase(msg_area.grp_list[g].sub_list[s].code);
if (mb.open() != true) continue; if (!mb.open() ) {
log(LOG_ERR, "Error " + mb.error + " opening " + mb.file);
continue;
}
var hdr2 = mb.get_msg_header(hdr.reply_id); var hdr2 = mb.get_msg_header(hdr.reply_id);
if (hdr2 != null) to = hdr2.from; if (hdr2 != null) to = hdr2.from;
mb.close(); mb.close();
...@@ -317,19 +320,26 @@ while(client.socket.is_connected && !quit) { ...@@ -317,19 +320,26 @@ while(client.socket.is_connected && !quit) {
pattern=cmd[2]; pattern=cmd[2];
writeln("215 list of newsgroups follows"); writeln("215 list of newsgroups follows");
if(include_mail && user.security.level == 99 && wildmatch("mail", pattern)) { if(include_mail && user.security.level == 99 && wildmatch("mail", pattern)) {
if(msgbase && msgbase.is_open)
msgbase.close();
msgbase=new MsgBase("mail"); msgbase=new MsgBase("mail");
if(msgbase.open()==true) { if(msgbase.open()==true) {
writeln(format("mail %u %u n", msgbase.last_msg, msgbase.first_msg)); writeln(format("mail %u %u n", msgbase.last_msg, msgbase.first_msg));
msgbase.close(); msgbase.close();
} } else
log(LOG_ERR, "Error " + msgbase.error + " opening " + msgbase.file);
} }
for(g in msg_area.grp_list) for(g in msg_area.grp_list)
for(s in msg_area.grp_list[g].sub_list) { for(s in msg_area.grp_list[g].sub_list) {
if(!wildmatch(msg_area.grp_list[g].sub_list[s].newsgroup, pattern)) if(!wildmatch(msg_area.grp_list[g].sub_list[s].newsgroup, pattern))
continue; continue;
if(msgbase && msgbase.is_open)
msgbase.close();
msgbase=new MsgBase(msg_area.grp_list[g].sub_list[s].code); msgbase=new MsgBase(msg_area.grp_list[g].sub_list[s].code);
if(msgbase.open!=undefined && msgbase.open()==false) if(!msgbase.open()) {
log(LOG_ERR, "Error " + msgbase.error + " opening " + msgbase.file);
continue; continue;
}
var count = count_msgs(msgbase); var count = count_msgs(msgbase);
writeln(format("%s %u %u %s" writeln(format("%s %u %u %s"
,msg_area.grp_list[g].sub_list[s].newsgroup ,msg_area.grp_list[g].sub_list[s].newsgroup
...@@ -443,13 +453,15 @@ while(client.socket.is_connected && !quit) { ...@@ -443,13 +453,15 @@ while(client.socket.is_connected && !quit) {
writeln("231 list of new newsgroups since " + compare.toISOString() + " follows"); writeln("231 list of new newsgroups since " + compare.toISOString() + " follows");
for(g in msg_area.grp_list) { for(g in msg_area.grp_list) {
for(s in msg_area.grp_list[g].sub_list) { for(s in msg_area.grp_list[g].sub_list) {
if(msgbase && msgbase.is_open)
msgbase.close();
msgbase=new MsgBase(msg_area.grp_list[g].sub_list[s].code); msgbase=new MsgBase(msg_area.grp_list[g].sub_list[s].code);
var ini_file = new File(msgbase.file + ".ini"); var ini_file = new File(msgbase.file + ".ini");
if(ini_file.open("r")) { if(ini_file.open("r")) {
var created = ini_file.iniGetValue(null, "Created", 0); var created = ini_file.iniGetValue(null, "Created", 0);
ini_file.close(); ini_file.close();
if(created >= compare.getTime() / 1000 if(created >= compare.getTime() / 1000) {
&& msgbase.open()) { if(msgbase.open()) {
var count = count_msgs(msgbase); var count = count_msgs(msgbase);
writeln(format("%s %u %u %s" writeln(format("%s %u %u %s"
,msg_area.grp_list[g].sub_list[s].newsgroup ,msg_area.grp_list[g].sub_list[s].newsgroup
...@@ -458,6 +470,9 @@ while(client.socket.is_connected && !quit) { ...@@ -458,6 +470,9 @@ while(client.socket.is_connected && !quit) {
,msg_area.grp_list[g].sub_list[s].is_moderated ? "m" : (msg_area.grp_list[g].sub_list[s].can_post ? "y" : "n") ,msg_area.grp_list[g].sub_list[s].is_moderated ? "m" : (msg_area.grp_list[g].sub_list[s].can_post ? "y" : "n")
)); ));
msgbase.close(); msgbase.close();
} else {
log(LOG_ERR, "Error " + msgbase.error + " opening " + msgbase.file);
}
} }
} }
} }
...@@ -481,19 +496,27 @@ while(client.socket.is_connected && !quit) { ...@@ -481,19 +496,27 @@ while(client.socket.is_connected && !quit) {
found=true; found=true;
} }
else if(include_mail && user.security.level==99 && cmd[1].toLowerCase()=="mail") { else if(include_mail && user.security.level==99 && cmd[1].toLowerCase()=="mail") {
if(msgbase && msgbase.is_open)
msgbase.close();
msgbase=new MsgBase("mail"); msgbase=new MsgBase("mail");
if(msgbase.open()==true) { if(msgbase.open()==true) {
selected = { newsgroup: "mail" }; selected = { newsgroup: "mail" };
found=true; found=true;
} else {
log(LOG_ERR, "Error " + msgbase.error + " opening " + msgbase.file);
} }
} }
if(!found) { if(!found) {
if(msgbase && msgbase.is_open)
msgbase.close();
for(g in msg_area.grp_list) for(g in msg_area.grp_list)
for(s in msg_area.grp_list[g].sub_list) for(s in msg_area.grp_list[g].sub_list)
if(msg_area.grp_list[g].sub_list[s].newsgroup.toLowerCase()==cmd[1].toLowerCase()) { if(msg_area.grp_list[g].sub_list[s].newsgroup.toLowerCase()==cmd[1].toLowerCase()) {
msgbase=new MsgBase(msg_area.grp_list[g].sub_list[s].code); msgbase=new MsgBase(msg_area.grp_list[g].sub_list[s].code);
if(msgbase.open!=undefined && msgbase.open()==false) if(!msgbase.open()) {
log(LOG_ERR, "Error " + msgbase.error + " opening " + msgbase.file);
continue; continue;
}
found=true; found=true;
selected=msg_area.grp_list[g].sub_list[s]; selected=msg_area.grp_list[g].sub_list[s];
break; break;
...@@ -941,8 +964,10 @@ while(client.socket.is_connected && !quit) { ...@@ -941,8 +964,10 @@ while(client.socket.is_connected && !quit) {
} }
msgbase=new MsgBase(msg_area.grp_list[g].sub_list[s].code); msgbase=new MsgBase(msg_area.grp_list[g].sub_list[s].code);
if(msgbase.open!=undefined && msgbase.open()==false) if(!msgbase.open()) {
log(LOG_ERR, "Error " + msgbase.error + " opening " + msgbase.file);
continue; continue;
}
/* NNTP Control Message? */ /* NNTP Control Message? */
if(hdr.control!=undefined) { if(hdr.control!=undefined) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment