Skip to content
Snippets Groups Projects
Commit 0410c602 authored by deuce's avatar deuce
Browse files

put_telegram() and put_node_message() are in bbs. AND system.

parent 8b836659
No related branches found
No related tags found
No related merge requests found
......@@ -58,58 +58,6 @@ function read_str(msg)
}
}
function putsmsg(usernumber, message)
{
var str;
var file;
var i;
if(message==undefined && message=='')
return(false);
str=format("%smsgs/%4.4u.msg",system.data_dir,usernumber);
file=new File(str);
if(!file.open("a")) {
log("Cannot open "+str+" for append");
return(false);
}
file.writeln(message);
file.close();
for(i in system.node_list) { /* flag node if user on that msg waiting */
if(system.node_list[i].useron==usernumber
&& (system.node_list[i].status == NODE_INUSE || system.node_list[i].status == NODE_QUIET)
&& !(system.node_list[i].misc & NODE_MSGW)) {
system.node_list[i].misc |= NODE_MSGW;
}
}
return(true);
}
function putnmsg(nodenumber, message)
{
var str;
var file;
if(message==undefined && message=='')
return(false);
str=format("%smsgs/n%3.3u.msg",system.data_dir,nodenumber);
file=new File(str);
if(!file.open("a")) {
log("Cannot open "+str+" for append");
return(false);
}
file.writeln(message);
file.close();
if((system.node_list[i].status == NODE_INUSE || system.node_list[i].status == NODE_QUIET)
&& !(system.node_list[i].misc & NODE_NMSG)) {
system.node_list[i].misc |= NODE_NMSG;
}
return(true);
}
var b;
var recipient="";
var recip_node="";
......@@ -187,19 +135,19 @@ if(recipient != "") {
log("Recipient specified: "+recipient);
if(to_node) {
if(system.node_list[to_node].useron==usernum) {
success=putnmsg(to_node, telegram_buf);
success=system.put_node_message(to_node, telegram_buf);
log("Attempt to send node message: "+(success?"Success":"Failure"));
}
else
log("Cannot send to user "+recipient+" on node "+to_node);
}
else {
success=putsmsg(usernum, telegram_buf);
success=system.put_telegram(usernum, telegram_buf);
log("Attempt to send telegram: "+(success?"Success":"Failure"));
}
}
else if(to_node) {
success=putnmsg(to_node, telegram_buf);
success=system.put_node_message(to_node, telegram_buf);
log("Attempt to send node message: "+(success?"Success":"Failure"));
}
else {
......
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