From 30e94134ba7fda94b053373325ad93a658ba6f20 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Thu, 4 Oct 2018 06:23:50 +0000 Subject: [PATCH] This module can now: - be used to enter the inter-BBS instant message module with the 'I' command (this should make responding to inter-BBS instant messages much easier as the recipient can respond from anywhere using Ctrl-P global hotkey). - be installed using "jsexec privatemsg.js install" --- exec/privatemsg.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/exec/privatemsg.js b/exec/privatemsg.js index fe19d174de..f492c25627 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(); -- GitLab