SHOW:
|
|
- or go back to the newest paste.
| 1 | - | // TLD LIST |
| 1 | + | // Some generic lists that may be used elsewhere |
| 2 | ||
| 3 | - | tld = [ |
| 3 | + | tld = [com net org de us cz fr gb jp ro ru se uk ws] |
| 4 | - | AC AD AE AF AG AI AL AM AO AR AS ASIA AT AU AW AX AZ BA BB BD BE BF BG BH |
| 4 | + | char_high = [ABCDEFGHIJKLMNOPQRSTUVWXYZ] |
| 5 | - | BI BIZ BJ BM BN BO BR BS BT BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO |
| 5 | + | char_low = [abcdefghijklmnopqrstuvwxyz] |
| 6 | - | COM CR CU CV CX CY CZ DE DJ DK DM DO DZ EC EDU EE EG ER ES ET EU FI FJ FK |
| 6 | + | |
| 7 | - | FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN |
| 7 | + | |
| 8 | - | HR HT HU ID IE IL IM IN INFO IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN |
| 8 | + | |
| 9 | - | KP KR KW KY KZ LB LC LI LK LR LS LT LU LV LY MA MC ME MG MH ML MM MN MO MP |
| 9 | + | |
| 10 | - | MQ MR MS MT MU MV MW MX MY MZ NA NC NE NET NF NG NI NL NO NP NR NU NZ OM |
| 10 | + | |
| 11 | - | ORG PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC |
| 11 | + | |
| 12 | - | SD SE SG SH SI SK SL SM SN SO SR ST SU SV SY SZ TC TD TG TH TJ TK TL TM TN |
| 12 | + | charcase = [ |
| 13 | - | TO TP TR TT TV TW TZ UA UG UK US UY UZ VC VE VG VI VN VU WF WS YE YT ZA ZM ZW |
| 13 | + | str = $arg1 |
| 14 | bool = [? $arg1 $char_high $char_low] | |
| 15 | loop c (strlen $arg1) [ | |
| 16 | - | //---------------------------------- |
| 16 | + | char = (substr $str $c 1) |
| 17 | if (> (strstr (bool (! $arg2)) $char) -1) [ | |
| 18 | str = (strreplace $str $char (substr (bool $arg2) (strstr (bool (! $arg2)) $char) 1)) | |
| 19 | ] | |
| 20 | ] | |
| 21 | result $str | |
| 22 | ] | |
| 23 | ||
| 24 | isnum = [ | |
| 25 | - | if (< (strstr "0123456789." (substr $arg1 $c 1)) 0) [bool = 0] |
| 25 | + | |
| 26 | loop n (strlen $arg1) [ | |
| 27 | if (< (strstr "0123456789." (substr $arg1 $n 1)) 0) [bool = 0] | |
| 28 | ] | |
| 29 | result $bool | |
| 30 | - | // Ugly and could use many improvements, but for |
| 30 | + | |
| 31 | - | // the most part, it does its job pretty nicely |
| 31 | + | |
| 32 | isip = [ | |
| 33 | result ( | |
| 34 | && ( | |
| 35 | = (listlen (strreplace $arg1 . " ")) 4 | |
| 36 | ) ( | |
| 37 | < (listfind i (strreplace $arg1 . " ") [|| (> $i 255) (< $i 0)]) 0 | |
| 38 | ) (isnum $arg1) | |
| 39 | ) | |
| 40 | ] | |
| 41 | ||
| 42 | // Alias variables for the first use | |
| 43 | ||
| 44 | createine qc_servlist "" | |
| 45 | createine _qc_servname "" | |
| 46 | - | createine qc_servname "" |
| 46 | + | |
| 47 | // Define some commands as helpers | |
| 48 | ||
| 49 | _qc_findserv = [listfind i $qc_servlist [=s $arg1 (at $i 0)]] | |
| 50 | - | qc_findserv = [listfind i $qc_servlist [=s $arg1 (at $i 0)]] |
| 50 | + | _qc_complete = [ |
| 51 | - | qc_complete = [ |
| 51 | + | _qc_servname = "" |
| 52 | - | qc_servname = "" |
| 52 | + | looplist i $qc_servlist [append _qc_servname (at $i 0)] |
| 53 | - | looplist i $qc_servlist [append qc_servname (at $i 0)] |
| 53 | + | _qc_servname = (substr $_qc_servname 1) |
| 54 | - | qc_servname = (substr $qc_servname 1) |
| 54 | + | listcomplete qc $_qc_servname |
| 55 | - | listcomplete qc $qc_servname |
| 55 | + | listcomplete delqcserv $_qc_servname |
| 56 | - | listcomplete delqcserv $qc_servname |
| 56 | + | listcomplete viewqcserv $_qc_servname |
| 57 | - | listcomplete viewqcserv $qc_servname |
| 57 | + | |
| 58 | _qc_info = [ | |
| 59 | - | qc_info = [ |
| 59 | + | qc_sel = (at $qc_servlist (_qc_findserv $arg1)) |
| 60 | - | qc_sel = (at $qc_servlist (qc_findserv $arg1)) |
| 60 | + | |
| 61 | ] | |
| 62 | ||
| 63 | // Below here lies the magic, user commands. | |
| 64 | ||
| 65 | qcaddserv = [ | |
| 66 | cond (|| (> (_qc_findserv $arg1) -1) (isip $arg1)) [ | |
| 67 | - | cond (|| (> (qc_findserv $arg1) -1) (isip $arg1)) [ |
| 67 | + | |
| 68 | ] ( | |
| 69 | ? (>= $numargs 2) ( | |
| 70 | ? (< (indexof $tld (charcase (at (strreplace $arg2 . " ") (- (listlen (strreplace $arg2 . " ")) 1)))) 0) (! (isip $arg2)) | |
| 71 | - | ? (< (indexof $tld (at (strreplace $arg2 . " ") (- (listlen (strreplace $arg2 . " ")) 1))) 0) (! (isip $arg2)) |
| 71 | + | |
| 72 | ) [ | |
| 73 | error "^f3IP or Domain is invalid!" | |
| 74 | ] [ | |
| 75 | append qc_servlist ( | |
| 76 | format ["%1 %2 %3"] @arg1 ( | |
| 77 | ? (> @numargs 1) $arg2 (connectedip) | |
| 78 | ) ( | |
| 79 | ? (> @numargs 2) $arg3 (? (isconnected) (connectedport) 28785) | |
| 80 | ) | |
| 81 | ) | |
| 82 | echo "^f2QC ^f7entry^f2" $arg1 "^f7has been included successfully!" | |
| 83 | - | echo "^f2QC ^f7entry has been included successfully!" |
| 83 | + | _qc_complete |
| 84 | - | qc_complete |
| 84 | + | |
| 85 | ] | |
| 86 | ||
| 87 | qcdelserv = [ | |
| 88 | if (< (_qc_findserv $arg1) 0) [ | |
| 89 | - | if (< (qc_findserv $arg1) 0) [ |
| 89 | + | |
| 90 | ] [ | |
| 91 | qc_servlist = (strreplace $qc_servlist (format ["%1"] (at $qc_servlist (_qc_findserv $arg1))) "") | |
| 92 | - | qc_servlist = (strreplace $qc_servlist (format ["%1"] (at $qc_servlist (qc_findserv $arg1))) "") |
| 92 | + | echo "^f2QC ^f7entry^f2" $arg1 "^f7has been deleted successfully!" |
| 93 | - | echo "^f2QC ^f7entry has been deleted successfully!" |
| 93 | + | _qc_complete |
| 94 | - | qc_complete |
| 94 | + | |
| 95 | ] | |
| 96 | ||
| 97 | qclistserv = [ | |
| 98 | if (!=s $qc_servlist "") [ | |
| 99 | - | echo (format "^f2%1^f7 Available servers: ^f2%2" (listlen $qc_servname) (strreplace $qc_servname " " "^f7, ^f2")) |
| 99 | + | if $numargs [looplist i $_qc_servname [_qc_info $i]] [ |
| 100 | echo (format "^f2%1^f7 Available servers: ^f2%2" (listlen $_qc_servname) (strreplace (prettylist $_qc_servname) "," "^f7,^f2")) | |
| 101 | ] | |
| 102 | ] [error "^f3No registered entries!"] | |
| 103 | - | if (< (qc_findserv $arg1) 0) [ |
| 103 | + | |
| 104 | ||
| 105 | - | ] [qc_info $arg1] |
| 105 | + | |
| 106 | if (< (_qc_findserv $arg1) 0) [ | |
| 107 | error "^f3QC entry does not exist!" | |
| 108 | - | qcviewservall = [ |
| 108 | + | ] [_qc_info $arg1] |
| 109 | ] | |
| 110 | - | looplist i $qc_servname [qc_info $i] |
| 110 | + | |
| 111 | qc = [ | |
| 112 | if (!=s $qc_servlist "") [ | |
| 113 | connect (at (at $qc_servlist (_qc_findserv $arg1)) 1) (at (at $qc_servlist (_qc_findserv $arg1)) 2) | |
| 114 | ] [error "^f3No registered entries!"] | |
| 115 | ] | |
| 116 | - | connect (at (at $qc_servlist (qc_findserv $arg1)) 1) (at (at $qc_servlist (qc_findserv $arg1)) 2) |
| 116 | + | |
| 117 | // Compile tab completion upon execution, just in case | |
| 118 | ||
| 119 | _qc_complete | |
| 120 |