Skip to content
Snippets Groups Projects
Commit f14c4939 authored by rswindell's avatar rswindell
Browse files

MsgBase class now requires an open() method call.

parent 46e64a88
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,10 @@ if(freespace==-1 || freespace > Number(argv[0])*1024*1024)
log("!Low disk space: " + freespace + " bytes");
msgbase = new MsgBase("mail");
if(msgbase.open!=undefined && msgbase.open()==false) {
log("!ERROR " + msgbase.last_error);
exit();
}
hdr = { to: 'sysop', to_ext: '1', from: 'chkspace', subject: 'Low disk space notification' }
......
......@@ -214,8 +214,9 @@ for(i in area) {
printf("sub: %s, newsgroup: %s\r\n",sub,newsgroup);
msgbase = new MsgBase(sub);
if(msgbase == null) {
printf("!ERROR opening msgbase: %s\r\n",sub);
if(msgbase.open!=undefined && msgbase.open()==false) {
printf("!ERROR %s opening msgbase: %s\r\n",msgbase.last_error,sub);
delete msgbase;
continue;
}
......
......@@ -78,11 +78,14 @@ function getReferenceTo(reference) {
var msg = parseInt(reference.replace(re,"$1"));
var msgbase = new MsgBase(sub);
if (msgbase != null) {
var hdr = msgbase.get_msg_header(false,msg);
if (hdr != null)
to = hdr.from;
}
if(msgbase.open!=undefined && msgbase.open()==false)
return to;
var hdr = msgbase.get_msg_header(false,msg);
if (hdr != null)
to = hdr.from;
msgbase.close();
return to;
}
......@@ -205,6 +208,8 @@ while(client.socket.is_connected) {
for(g in msg_area.grp_list)
for(s in msg_area.grp_list[g].sub_list) {
msgbase=new MsgBase(msg_area.grp_list[g].sub_list[s].code);
if(msgbase.open!=undefined && msgbase.open()==false)
continue;
writeln(format("%s %u %u %s"
,msg_area.grp_list[g].sub_list[s].newsgroup
,msgbase.last_msg
......@@ -237,9 +242,12 @@ while(client.socket.is_connected) {
for(g in msg_area.grp_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()) {
found=true;
msgbase=new MsgBase(msg_area.grp_list[g].sub_list[s].code);
if(msgbase.open!=undefined && msgbase.open()==false)
continue;
found=true;
selected=msg_area.grp_list[g].sub_list[s];
break;
}
if(found)
writeln(format("211 %u %u %u %s group selected"
......@@ -652,6 +660,8 @@ while(client.socket.is_connected) {
hdr.from=user.name; // Use real names
msgbase=new MsgBase(msg_area.grp_list[g].sub_list[s].code);
if(msgbase.open!=undefined && msgbase.open()==false)
continue;
if(msgbase.save_msg(hdr,body)) {
log(format("%s posted a message on %s",user.alias,newsgroups[n]));
writeln("240 article posted ok");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment