From a7f1f3d61df6b4606873a781bcea13e1dec91e10 Mon Sep 17 00:00:00 2001 From: Darren Date: Tue, 16 Aug 2011 21:55:50 +0100 Subject: [PATCH] Rehashing status messages --- .gitignore | 2 ++ img/Thumbs.db | Bin 0 -> 3072 bytes node/kiwi.js | 51 +++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 .gitignore create mode 100644 img/Thumbs.db diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ef8e716 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.DC +.DS_Store diff --git a/img/Thumbs.db b/img/Thumbs.db new file mode 100644 index 0000000000000000000000000000000000000000..5ffc0f10823e3dcc37d9477f965a0e98a1c2b1b4 GIT binary patch literal 3072 zcmca`Uhu)fjZzO8(10BSGsD0CoD6J8;*3Bx2!nwD0|OI~0pkDr|NlQkkbwcn90fxt z1pWfu3W`4vW`V}#5OV&gQz;CAAclM(EMZV!aAn8?(nSoFu&hiJEylnK&-3uI0f){7 zg1YmLd7NQn2Ff1*5kO$XV9H>|5YJ%AkOstw3`qFNjV73W^F;Lb7EDBMLNop}L zF@nk=STJC!z%KG1qzMRM_8WoiHv_sQmBAe73KO6^l7M0$`$2BP1%UR$?FP94mpWu| z9w4V1S%5+|%Wy96-zo#9Tnk4aA@_f)_~hLD|Um zj?!9LeRE)c?qW*Qdtm1m_p#Ix?=SEGDF^MRc zQ|IAdW+|sNZPxqA>(_I;=f@s+rER`%*Bp`e$2ThM%vii#wzWKa!;_K&F!DGshUMoiQn5-R7tqGgOkgp(f!jxBc3fhjh{WrxNb-%YWcRe z-FNX>-5TfFx@?toSLi^Ie6a5_P z86Wc|C^>Ihq@eRc!Nv8@tSIMWs?wj<$2=A~WU+6@+$Xga!qfhkyyy&fRdNcH%+z{& zUEtaBT8(X2m7j0w?LM!*P0HQkkmH@r{QEcrKCp&l2eu@)=!!Kzn!fOU{-J4ZcO>tN z`Q40t^7f_6y_ZE9PYog_b(r4dw_I^+is;v0A`$&l6E?2qHNJGY#r5GH%gJF@^B3;8 z)6{!0@N4S=t1}A}dA9^!-E`=H6VJc)3FrPWyZ&{K4dH)p)xYN#o60APi?^KeHcxC@qn2f#u%zGbdY+nXUT0j| zvcP&zJ=<+FGS<9|Yr4(*spqh-uN!x5K=H5o6USrucFirFa4hQW?mPB#OjE?RR2Xgo zCRPSdS3j3^P6" + data[i]); + + // We have a complete line of data, parse it! parseIRCMessage(websocket, ircSocket, data[i].replace(/^\r+|\r+$/, '')); } } @@ -567,7 +582,6 @@ var websocketListen = function (port, host, handler, secure, key, cert) { websocket.sendServerLine = function (data, eol) { eol = (typeof eol === 'undefined') ? '\r\n' : eol; - //console.log('Out: -----\n' + data + '\n-----'); websocket.ircSocket.write(data + eol); }; @@ -593,7 +607,6 @@ var websocketListen = function (port, host, handler, secure, key, cert) { ircSocket.held = ''; ircSocket.on('data', function (data) { - //console.log('In: -----\n' + data + '\n-----'); ircSocketDataHandler(data, websocket, ircSocket); }); @@ -694,9 +707,19 @@ websocketListen(config.port, config.bind_address, httpHandler, config.listen_ssl // Now we're listening on the network, set our UID/GIDs if required changeUser(); + + + var rehash = function () { var changes, i; - changes = loadConfig()[1]; + var reload_config = loadConfig(); + + // If loading the new config errored out, dont attempt any changes + if (reload_config === false) return false; + + // We just want the settings that have been changed + changes = reload_config[1]; + if (Object.keys(changes).length !== 0) { console.log('%s config changes: \n', Object.keys(changes).length, changes); for (i in changes) { @@ -729,17 +752,27 @@ var rehash = function () { } } } + + return true; }; + + +/* + * KiwiIRC controlling via STDIN + */ process.stdin.resume(); process.stdin.on('data', function (chunk) { var command; command = chunk.toString().trim(); - console.log(command); switch (command) { case 'rehash': - rehash(); + console.log('Rehashing...'); + console.log(rehash() ? 'Rehash complete' : 'Rehash failed'); break; + + default: + console.log('Unknown command \'' + command + '\''); } }); -- 2.25.1