Skip to content

Commit 6022ab7

Browse files
author
SReject
committed
Code cleanup
Change: AdiIRC minimum version now 2.8 Change: /JSONShutDown now called on start Change: /JSONShutDown now always called on load Cleaned up whitespacing
1 parent f91c1b6 commit 6022ab7

1 file changed

Lines changed: 34 additions & 15 deletions

File tree

src/JSON For mIRC.mrc

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ alias JSONUrlGet {
1818
;; Check to make sure mIRC/AdiIRC is of an applicable version
1919
on *:LOAD:{
2020

21+
;; call jsonshutdown so the JS engine from a previously loaded version gets shutdown
22+
JSONShutdown
23+
2124
;; Adiirc check
2225
if ($~adiircexe) {
23-
if ($version < 2.7) {
26+
if ($version < 2.8) {
2427
echo -ag [JSON For mIRC] AdiIRC v2.7 beta 01/28/2016 or later is required
2528
.unload -rs $qt($script)
2629
}
@@ -29,13 +32,14 @@ on *:LOAD:{
2932
;; mIRC check
3033
elseif ($version < 7.48) {
3134
echo -ag [JSON For mIRC] mIRC v7.48 or later is required
35+
.disable #SReject/JSONForMirc/CompatMode
3236
.unload -rs $qt($script)
3337
}
38+
}
3439

35-
;; If passed, call jsonshutdown so the JS engine from a previously loaded version gets shutdown
36-
else {
37-
JSONShutdown
38-
}
40+
;; clean up incase mirc/adiirc closed due to a crash
41+
on *:START:{
42+
JSONShutDown
3943
}
4044

4145

@@ -104,7 +108,9 @@ menu @SReject/JSONForMirc/Log {
104108
alias JSONOpen {
105109

106110
;; Insure the alias was called as a command
107-
if ($isid) return
111+
if ($isid) {
112+
return
113+
}
108114

109115
;; Unset the global error variable incase the last call ended in error
110116
if ($hget(SReject/JSONForMirc, Error)) {
@@ -264,7 +270,9 @@ alias JSONOpen {
264270
alias JSONHttpMethod {
265271

266272
;; Insure the alias was called as a command
267-
if ($isid) return
273+
if ($isid) {
274+
return
275+
}
268276

269277
;; Unset the global error variable incase the last call ended in error
270278
if ($hget(SReject/JSONForMirc, Error)) {
@@ -346,7 +354,9 @@ alias JSONHttpMethod {
346354
alias JSONHttpHeader {
347355

348356
;; Insure the alias was called as a command
349-
if ($isid) return
357+
if ($isid) {
358+
return
359+
}
350360

351361
;; Unset the global error variable incase the last call ended in error
352362
if ($hget(SReject/JSONForMirc, Error)) {
@@ -428,7 +438,9 @@ alias JSONHttpHeader {
428438
alias JSONHttpFetch {
429439

430440
;; Insure the alias is called as a command
431-
if ($isid) return
441+
if ($isid) {
442+
return
443+
}
432444

433445
;; Unset the global error variable incase the last call ended in error
434446
if ($hget(SReject/JSONForMirc, Error)) {
@@ -657,7 +669,9 @@ alias JSONClose {
657669
alias JSONList {
658670

659671
;; Insure the alias was called as a command
660-
if ($isid) return
672+
if ($isid) {
673+
return
674+
}
661675

662676
;; Local variable declarations
663677
var %X = 1, %I = 0
@@ -688,7 +702,9 @@ alias JSONList {
688702
alias JSONShutDown {
689703

690704
;; Insure the alias was called as a command
691-
if ($isid) return
705+
if ($isid) {
706+
return
707+
}
692708

693709
;; Close all json instances
694710
JSONClose -w *
@@ -1105,7 +1121,9 @@ alias JSON {
11051121
alias JSONForEach {
11061122

11071123
;; Insure the alias was called as an identifier
1108-
if (!$isid) return
1124+
if (!$isid) {
1125+
return
1126+
}
11091127

11101128
;; Unset the global error variable incase the last call ended in error
11111129
if ($hget(SReject/JSONForMirc,Error)) {
@@ -1894,7 +1912,9 @@ alias -l jfm_log {
18941912
;; If the debug window is not open, disable logging and unset the log indent variable
18951913
if (!$window(@SReject/JSONForMirc/Log)) {
18961914
.JSONDebug off
1897-
if ($hget(SReject/JSONForMirc,LogIndent)) { hdel SReject/JSONForMirc LogIndent }
1915+
if ($hget(SReject/JSONForMirc,LogIndent)) {
1916+
hdel SReject/JSONForMirc LogIndent
1917+
}
18981918
}
18991919
else {
19001920

@@ -1926,7 +1946,6 @@ alias -l jfm_log {
19261946
%Color = 13
19271947
}
19281948

1929-
19301949
;; Compile the prefix
19311950
%Prefix = $chr(3) $+ %Color $+ %Prefix
19321951
if (F !isincs %Switches) {
@@ -1999,4 +2018,4 @@ alias -l jfm_badd {
19992018
alias -l jfm_jscript {
20002019
var %File = $scriptdirJSON For Mirc.js
20012020
bread $qt(%File) 0 $file(%File).size $1
2002-
}
2021+
}

0 commit comments

Comments
 (0)