Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Jigsy1 committed Jul 18, 2023
1 parent c5cb775 commit 934e718
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 25 deletions.
29 changes: 29 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
mIRCd[0.09hf11(Rev.2)][2021-2023] - 19/07/2023
--------------------------------------------------
1. /STATS m now counts the data length received.
2. Fixed a bug with +g where users could bypass the gag if they weren't on the channel and +n wasn't set.
3. Fixed a bug where OPLESS_CHANS=1 would still op opers even though it wasn't supposed to.
4. Can now prevent users from having ops in persistant channels if they join and there are no other users by adding
NOOP_PERSIST=1 or NOOP_PERSIST=2 to [Mechanics] in mIRCd.ini. Meaning: 0 = Disabled, 1 = Everybody, 2 = Non-opers.

This can work in conjunction with OPLESS_CHANS.
5. Fixed a bug in /WHO where a user wouldn't appear if they themselves are +i under certain conditions.
6. Given the recent SUPERBOWL related spam and based on a discussion with an oper on another ircu based IRC network (Nefarious),
we were quite surprised to learn that there isn't a way to use /WHO to return users who've been connected to the IRCd
for a certain duration of time, so I decided to add this in just for test purposes.

Since /WHO is a powerful tool, and it would be useful to deal with annoying spambots, hopefully it'll become part of WHOX
"standard" one day.

Using the j (joined) flag, you can return users - via !=, <, <=, =, >=, > - who've been connected for N seconds. E.g.

/WHO >3600 j
/WHO * j%n :<=60

I've indicated this code with: *** OWN IDEA *** ... *** END ***
7. I've decided to classify this as a bug. If a channel is +H, the modes don't appear in /LIST... however, someone could
still get the modes by doing /MODE #chan. So now the modes aren't returned if the user isn't on the channel and does
/MODE #chan. (Excluding opers.)
8. /LIST now works the way it should on other IRCds. (E.g. /LIST >0,C<5,T>0,!*exclude*, etc.)


mIRCd[0.09hf10(Rev.2)][2021-2023] - 26/05/2023
--------------------------------------------------
1. Forgot a /return in $mIRCd.makeDefaultModes in mIRCd_modeHandle.mrc.
Expand Down
4 changes: 4 additions & 0 deletions mIRCd.ini
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ MODESPL=6
NICK_CHANGE_THROTTLE=15
; How long a user must wait before being able to change their nick each time. (15 seconds.)

NOOP_PERSIST=1
; Prevent users from being opped on joining persistant channels if there are no other users. Works with OPLESS_CHANS.
; 0 - Disabled; 1 - Everybody; 2 - Just Non-opers.

OPER_CMDS=HASH,LINKS,MAP
; Prevent these non-oper commands from being used by non-opers.

Expand Down
8 changes: 5 additions & 3 deletions mIRCd.mrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; mIRCd v0.09hf10 (Revision 2) - an IRCd scripted entirely in mSL - by Jigsy (https://github.com/Jigsy1/mIRCd)
; mIRCd v0.09hf11 (Revision 2) - an IRCd scripted entirely in mSL - by Jigsy (https://github.com/Jigsy1/mIRCd)
; "You were so preoccupied with whether or not you could, you didn't stop to think if you should." -Dr. Ian Malcolm (Jurrasic Park)
;
; Note: It is recommended running these scripts in a separate instance of mIRC - or in a Virtual Machine/under WINE.
Expand Down Expand Up @@ -66,6 +66,8 @@ alias mIRCd.whoWas { return $+(mIRCd[WhoWas],$iif($1 != $null,$bracket($v1))) }

alias _debugline { echo -aet [DEBUG]: $1- }
; `-> Useful for hunting down annoying bugs.
alias _stripMatch { return $remove($1-, !, <, =, >) }
alias _stripNumbers { return $remove($1-, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9) }
alias bracket { return [[ $+ $$1- $+ ]] }
alias bool_fmt { return $iif($istok(1 ok okay on t true y yes,$1,32) == $true,$true,$false) }
alias colonize { return $iif($count($1-,:) == 0,$+(:,$gettok($1-,-1,32)),$gettok($1-,$+($findtok($1-,$matchtok($1-,:,1,32),1,32),-),32)) }
Expand Down Expand Up @@ -395,10 +397,10 @@ alias mIRCd.unloadScripts {
; `-> A quick and dirty loop.
if ($script($script) != $null) { .unload -rs $qt($script) }
}
alias mIRCd.version { return mIRCd[0.09hf10(Rev.2)][2021-2023] }
alias mIRCd.version { return mIRCd[0.09hf11(Rev.2)][2021-2023] }
alias mIRCd.window { return @mIRCd }
alias -l nextHour { return $+($asctime($calc($ctime + 3600),HH),:00) }
alias -l requiredVersion { return 7.66 }
; `-> Note: Although I've since modified this from a version of mIRC higher than 7.66 (currently 7.72), this should still work on 7.66.
; `-> Note: Although I've since modified this from a version of mIRC higher than 7.66 (currently 7.73), this should still work on 7.66.

; EOF
7 changes: 5 additions & 2 deletions mIRCd_chanHandle.mrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ alias mIRCd_command_invite {

if ($3 == $null) {
; `-> Return any outstanding invite(s).

if ($mIRCd.info($1,invites) == $null) {
mIRCd.sraw $1 $mIRCd.reply(347,$mIRCd.info($1,nick))
return
Expand Down Expand Up @@ -618,7 +617,11 @@ alias mIRCd.chanAddUser {
var %this.users = $hcount($mIRCd.chanUsers(%this.id)), %this.opFlag = $iif(%this.users > 0,0,1)
if (($mIRCd(OPLESS_CHANS) isnum 1-2) && (%this.opFlag == 1)) {
var %this.opFlag = 0
if ($is_oper($2) == $true) { var %this.opFlag = 1 }
if (($mIRCd(OPLESS_CHANS) == 2) && ($is_oper($2) == $true)) { var %this.opFlag = 1 }
}
if ((P isincs $mIRCd.info(%this.id,modes)) && ($mIRCd(NOOP_PERSIST) isnum 1-2)) {
var %this.opFlag = 0
if (($mIRCd(NOOP_PERSIST) == 2) && ($is_oper($2) == $true)) { var %this.opFlag = 1 }
}
hadd -m $mIRCd.chanUsers(%this.id) $2 $ctime $iif(%this.users > 0 && $is_modeSet(%this.id,D).chan == $true,1,0) %this.opFlag 0 0
; `-> Explaination of everything here-^: <time joined> <hidden via +D> <op> <hop> <voice>
Expand Down
2 changes: 1 addition & 1 deletion mIRCd_connHandle.mrc
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ alias mIRCd.destroyUser {
alias mIRCd.doCommand {
; /mIRCd.doCommand <sockname> <args>

hinc -m $mIRCd.mStats $2 1
hadd -m $mIRCd.mStats $2 $calc($hget($mIRCd.mStats,$2) + 1) $len($2-)
[ [ $+(mIRCd_command_,$2) ] ] $1-
}
alias mIRCd.dnsUser {
Expand Down
64 changes: 60 additions & 4 deletions mIRCd_misc.mrc
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ alias mIRCd_command_ison {
mIRCd.sraw $1 $mIRCd.reply(303,$mIRCd.info($1,nick),%this.string)
}
alias mIRCd_command_list {
; /mIRCd_command_list <sockname> LIST [STOP]
; /mIRCd_command_list <sockname> LIST [term[,term,term,...]|STOP]

if ($mIRCd(CONNECTED_LIST_THROTTLE) isnum 1-) {
if ($sock($1).to < $mIRCd(CONNECTED_LIST_THROTTLE)) {
mIRCd.sraw $1 NOTICE $mIRCd.info($1,nick) $+(:,$upper($2)) cannot be used for $v2 second(s) upon connecting to the server.
mIRCd.sraw $1 NOTICE $mIRCd.info($1,nick) $+(:/,$upper($2)) cannot be used for $v2 second(s) upon connecting to the server.
return
}
}
Expand All @@ -84,11 +84,67 @@ alias mIRCd_command_list {
mIRCd.sraw $1 $mIRCd.reply(321,$mIRCd.info($1,nick))
var %this.loop = 0
while (%this.loop < $hcount($mIRCd.chans)) {
var %this.onChan = 0, %this.modes = $null, %this.modeArgs = $null, %this.string = $null
var %this.skipList = 0, %this.onChan = 0, %this.modes = $null, %this.modeArgs = $null, %this.string = $null
inc %this.loop 1
if ($mIRCd.info($1,listing) == $null) { break }
; `-> Backup. If listing was removed via STOP, stop listing.
var %this.id = $hget($mIRCd.chans,%this.loop).item
if (($3 != $null) && ($3 != STOP)) {
var %this.searchLoop = 0
while (%this.searchLoop < $numtok($3,44)) {
inc %this.searchLoop 1
var %this.term = $gettok($3,%this.searchLoop,44)
if ($regex(%this.term,^(=|>|<|>=|<|<=|!=)\d+) == 1) {
; `-> Users.
var %this.cmp = $_stripNumbers(%this.term), %this.match = $_stripMatch(%this.term)
var %this.result = $iif($hcount($mIRCd.chanUsers(%this.id)) %this.cmp %this.match,1,0)
if (%this.result == 0) {
var %this.skipList = 1
break
}
}
if ($regex(%this.term,^C(=|>|<|>=|<|<=|!=)\d+) == 1) {
; `-> Creation.
var %this.cmp = $remove($_stripNumbers(%this.term), C), %this.match = $remove($_stripMatch(%this.term), C)
var %this.result = $iif($calc($ctime - $mIRCd.info(%this.id,createTime)) %this.cmp $calc(%this.match * 60),1,0)
if (%this.result == 0) {
var %this.skipList = 1
break
}
}
; if ($regex(%this.term,^M(=|>|<|>=|<|<=|!=)\d+) == 1) {
; `-> Activity.
;}
if ($regex(%this.term,^T(=|>|<|>=|<|<=|!=)\d+) == 1) {
; `-> Topic.
var %this.cmp = $remove($_stripNumbers(%this.term), T), %this.match = $remove($_stripMatch(%this.term), T)
if ($mIRCd.info(%this.id,topicTime) == $null) {
var %this.skipList = 1
break
}
var %this.result = $iif($calc($ctime - $mIRCd.info(%this.id,topicTime)) %this.cmp $calc(%this.match * 60),1,0)
if (%this.result == 0) {
var %this.skipList = 1
break
}
}
if (($left(%this.term,1) == !) && ($left(%this.term,2) != !=)) {
; `-> !not matching pattern. E.g. Filter out everything containing !*twitter*
if (($mIRCd.info(%this.id,name) == $right(%this.term,-1)) || ($right(%this.term,-1) iswm $mIRCd.info(%this.id,name))) {
var %this.skipList = 1
break
}
}
if ($istok(! < = > C T,$left(%this.term,1),32) == $false) {
; ,-> Matching pattern.
if (($mIRCd.info(%this.id,name) != %this.term) && (%this.term !iswm $mIRCd.info(%this.id,name))) {
var %this.skipList = 1
break
}
}
}
if (%this.skipList == 1) { continue }
}
if (($is_oper($1) == $true) || ($is_on(%this.id,$1) == $true)) { var %this.onChan = 1 }
if (($is_private(%this.id) == $true) || ($is_secret(%this.id) == $true)) {
if (%this.OnChan != 1) { continue }
Expand Down Expand Up @@ -218,7 +274,7 @@ alias mIRCd_command_stats {
while (%this.loop < $hget($mIRCd.commands(1),0).data) {
inc %this.loop 1
var %this.command = $hget($mIRCd.commands(1),%this.loop).data, %this.data = $iif($hget($mIRCd.mStats,%this.command) != $null,$v1,0)
if (%this.data == 0) { continue }
if ($gettok(%this.data,1,32) == 0) { continue }
mIRCd.sraw $1 $mIRCd.reply(212,$mIRCd.info($1,nick),%this.command,%this.data)
}
mIRCd.sraw $1 $mIRCd.reply(219,$mIRCd.info($1,nick),$3)
Expand Down
5 changes: 5 additions & 0 deletions mIRCd_modeHandle.mrc
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,11 @@ alias -l mIRCd.parseMode {
var %this.modeString = $mIRCd.info(%this.id,modes), %this.modeItem = B bandwidth,g gagTime,j joinThrottle,l limit,k key
var %this.key = $iif($is_oper($1) == $false && $is_on(%this.id,$1) == $false,*,$mIRCd.info(%this.id,key))
var %this.modeArgs = $regsubex(%this.modeString,/(.)/g,$iif($poscs(Bgjlk,\t) != $null,$+($iif(\t === k,%this.key,$mIRCd.info(%this.id,$gettok($matchtokcs(%this.modeItem,$+(\t,$chr(32)),1,44),2,32))),$chr(32))))
if ((H isincs $mIRCd.info(%this.id,modes)) && ($is_on(%this.id,$1) == $false) && ($is_oper($1) == $false)) {
var %this.modeString = +, %this.modeArgs = $null
; ¦-> Unsure if this should return +H since it's specified as hide modes or to also keep +H hidden as well and just return +.
; `-> But since +H doesn't appear in /LIST either, maybe + is the better CoA.
}
mIRCd.sraw $1 $mIRCd.reply(324,$mIRCd.info($1,nick),%this.name,%this.modeString) $iif(%this.modeArgs != $null,$v1)
mIRCd.sraw $1 $mIRCd.reply(329,$mIRCd.info($1,nick),%this.name,$mIRCd.info(%this.id,createTime))
return
Expand Down
10 changes: 7 additions & 3 deletions mIRCd_msgHandle.mrc
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,12 @@ alias mIRCd.parseMsg {
mIRCd.sraw $1 $mIRCd.reply(404,$mIRCd.info($1,nick),%this.name) (Channel is moderated (+m))
continue
}
if (($is_modeSet(%this.id,g).chan == $true) && ($calc($ctime - $gettok($hget($mIRCd.chanUsers(%this.id),$1),1,32)) <= $mIRCd.info(%this.id,gagTime))) {
mIRCd.sraw $1 $mIRCd.reply(404,$mIRCd.info($1,nick),%this.name) (Gagged: Please wait $calc($mIRCd.info(%this.id,gagTime) - $calc($ctime - $gettok($hget($mIRCd.chanUsers(%this.id),$1),1,32))) seconds (+g))
continue
if ($is_modeSet(%this.id,g).chan == $true) {
var %this.timestamp = $iif($gettok($hget($mIRCd.chanUsers(%this.id),$1),1,32) != $null,$v1,$ctime)
if ($calc($ctime - %this.timestamp) <= $mIRCd.info(%this.id,gagTime)) {
mIRCd.sraw $1 $mIRCd.reply(404,$mIRCd.info($1,nick),%this.name) (Gagged: Please wait $calc($mIRCd.info(%this.id,gagTime) - $calc($ctime - %this.timestamp)) seconds (+g))
continue
}
}
if (($is_modeSet(%this.id,c).chan == $true) && ($+(*,$chr(3),*) iswm %this.message)) {
; `-> Just block the use of color. Bold, underline, etc. is okay.
Expand Down Expand Up @@ -219,6 +222,7 @@ alias mIRCd.parseMsg {
}
var %this.sock = $getSockname($gettok(%this.target,1,64)), %this.nick = $mIRCd.info(%this.sock,nick)
if ($1 == %this.sock) { goto parsePrivate }
; ,-> Note to self: Couldn't I just do like above and check if oper then use a goto?
if (($is_modeSet(%this.sock,c).nick == $true) && ($+(*,$chr(3),*) iswm %this.message)) {
if ($is_oper($1) == $false) {
mIRCd.sraw $1 $mIRCd.reply(599,$mIRCd.info($1,nick),%this.nick) (This user blocks colors (+c))
Expand Down
Loading

0 comments on commit 934e718

Please sign in to comment.