]> jfr.im git - irc/grawity/eggdrop-ts6.git/commitdiff
kill any possible impostors
authorMantas Mikulėnas <redacted>
Wed, 22 Jan 2014 18:37:59 +0000 (20:37 +0200)
committerMantas Mikulėnas <redacted>
Wed, 22 Jan 2014 19:07:51 +0000 (21:07 +0200)
g_ts6.tcl

index 9a59f79e80fb99ae95cea29cab3abeebc578131e..f693231b7aa0d14feac9d1ae217910a5ef56cd6d 100644 (file)
--- a/g_ts6.tcl
+++ b/g_ts6.tcl
@@ -463,6 +463,13 @@ proc ts6:cnote {uid chan msg} {
        ts6:cput "NOTICE $uid :\[$chan\] $msg"
 }
 
+proc ts6:kill {uid msg} {
+       global myserv
+       ts6:log "Killing user [uid:get $uid NICK *]{$uid} ($msg)"
+       ts6:sput "KILL $uid :$myserv ($msg)"
+       uid:forget $uid
+}
+
 proc ts6:log {msg} {
        global ts6-eob
        putlog $msg
@@ -651,6 +658,11 @@ proc ts6:handshake {idx input} {
                        set nick [lindex $input 1]
                        set uid  [lindex $input 8]
 
+                       if {[ts6:myuid $nick] || [ts6:myuid $uid]} {
+                               ts6:kill $uid "Impostor!"
+                               return 1
+                       }
+
                        ts6:log "User: $nick{$uid} via [sid:get $prefix SERVER]{$prefix}"
                        uid:set $uid NICK                       $nick
                        uid:set $uid USERNAME           [lindex $input 5]
@@ -695,6 +707,12 @@ proc ts6:handshake {idx input} {
                NICK {
                        set oldnick [ts6:uid2nick $prefix]
                        set newnick [lindex $input 1]
+
+                       if {[ts6:myuid $newnick]} {
+                               ts6:kill $prefix "Impostor!"
+                               return 1
+                       }
+
                        ts6:changed-nick $oldnick $newnick $prefix
                        dccputchan 0 "$oldnick is now known as $newnick"
                }
@@ -965,6 +983,11 @@ proc ts6:handshake {idx input} {
                        set nick [lindex $input 1]
                        set uid  [lindex $input 8]
 
+                       if {[ts6:myuid $nick] || [ts6:myuid $uid]} {
+                               ts6:kill $uid "Impostor!"
+                               return 1
+                       }
+
                        ts6:log "User: $nick{$uid} via [sid:get $prefix SERVER]{$prefix}"
                        uid:set $uid NICK                       $nick
                        uid:set $uid USERNAME           [lindex $input 5]