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

Enforce user lines_per_message limit.

parent b867b19b
No related branches found
No related tags found
No related merge requests found
......@@ -557,6 +557,7 @@ while(client.socket.is_connected && !quit) {
var header=true;
var body="";
var newsgroups=new Array();
var lines=0;
while(client.socket.is_connected) {
line = client.socket.recvline(512 /*maxlen*/, 300 /*timeout*/);
......@@ -582,12 +583,23 @@ while(client.socket.is_connected && !quit) {
line=line.slice(1); // Skip prepended dots
body += line;
body += "\r\n";
lines++;
continue;
}
log(line);
parse_news_header(hdr,line); // from newsutil.js
}
if(user.limits!=undefined
&& lines > user.limits.lines_per_message) {
log(format("!Message of %u lines exceeds user limit (%u lines)"
,lines,user.limits.lines_per_message));
writeln(format("441 posting failed, number of lines (%u) exceeds max (%u)"
,lines,user.limits.lines_per_message));
break;
}
newsgroups=hdr.newsgroups.split(',');
if(hdr.to==undefined && hdr.reply_id!=undefined)
......@@ -635,8 +647,8 @@ while(client.socket.is_connected && !quit) {
if(msgbase.open!=undefined && msgbase.open()==false)
continue;
if(msgbase.save_msg(hdr,body)) {
log(format("%s posted a message (%lu chars) on %s"
,user.alias, body.length, newsgroups[n]));
log(format("%s posted a message (%u chars, %u lines) on %s"
,user.alias, body.length, lines, newsgroups[n]));
writeln("240 article posted ok");
posted=true;
msgs_posted++;
......
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