diff --git a/exec/privatemsg.js b/exec/privatemsg.js index fe19d174de45a9d1918042e12196b62836064221..f492c25627142f809ec142e4c007c8ac2a3384f8 100644 --- a/exec/privatemsg.js +++ b/exec/privatemsg.js @@ -7,10 +7,33 @@ // Install this module in SCFG->External Programs->Global Hot Key Events: // Global Hot Key Ctrl-P // Command Line ?privatemsg.js +// +// or, by running "jsexec privatemsg.js install" + +if(argc == 1 && argv[0] == "install") { + var cnflib = load({}, "cnflib.js"); + var xtrn_cnf = cnflib.read("xtrn.cnf"); + if(!xtrn_cnf) { + alert("Failed to read xtrn.cnf"); + exit(-1); + } + xtrn_cnf.hotkey.push({ key: /* Ctrl-P */16, cmd: '?privatemsg.js' }); + + if(!cnflib.write("xtrn.cnf", undefined, xtrn_cnf)) { + alert("Failed to write xtrn.cnf"); + exit(-1); + } + + exit(0); +} require("sbbsdefs.js", 'SS_USERON'); require("text.js", 'PrivateMsgPrompt'); +bbs.replace_text(PrivateMsgPrompt, + "\r\n\1b\1hPrivate: \1g~T\1n\1gelegram, " + + "\1h~M\1n\1gessage, \1h~C\1n\1ghat, \1h~I\1n\1gnter-BBS, or \1h~Q\1n\1guit: \1c\1h"); + if(!(bbs.sys_status&SS_USERON)) exit(); @@ -28,7 +51,7 @@ while(bbs.online && !(console.aborted)) { var ch; while(bbs.online && !console.aborted) { /* Watch for incoming messages */ ch=console.inkey(/* mode: */K_UPPER, /* timeout: */1000); - if(ch && "TMCQ\r".indexOf(ch)>=0) + if(ch && "TMCIQ\r".indexOf(ch)>=0) break; console.line_counter = 0; @@ -54,6 +77,10 @@ while(bbs.online && !(console.aborted)) { bbs.private_chat(); bbs.node_action = saved_node_action; break; + case 'I': /* Inter-BBS */ + console.print("Inter-BBS\r\n"); + load({}, 'sbbsimsg.js'); + break; default: console.print("Quit\r\n"); exit();