Jump to content

chain

Administrators
  • Posts

    5,971
  • Joined

  • Last visited

  • Days Won

    17

Posts posted by chain

  1. Just a VERY basic aligned theme....

    Looks best in a light gray BG..

    *****NOTE**** YOU HAVTA have fixed width font!!!
    Windows = New Courier
    Linux = FreeMono (which i use!)

     

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;Code By: KronicDreamer
    ;;$regex credit to napalm
    ;;
    ;;rip/thrash/trash or break i dont care just dont take credit kthnx!
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    on ^*:TEXT:*:#: { 
      echo -i36 # $thstamp $thspace $thop $+ $nick $+ 7: $1- | halt 
    }
    on ^*:TEXT:*:?: {
      echo -i36 $nick $thstamp $thspace $thop $+ $nick $+ 7: $1- | halt
    }
    on ^*:ACTION:*:#: {
      echo -i36 # $thstamp $thspace $thop $+ $nick $+ 7: * $1- | halt
    }
    on ^*:JOIN:*: {
      echo # $thstamp $thjpq 7: Join $nick ( $+ $address $+ ) | halt
    }
    on ^*:PART:*: {
      echo # $thstamp $thjpq 7: Part $thop $+ $nick ( $+ $address $+ ) | halt
    }
    on &*:INPUT:#: {
      if (/* !iswm $1) {
        echo -i36 # $thstamp $thspme $thop $+ $me $+ 7: $1-
        .msg $active $1-
        halt
      }
    }
    on &*:INPUT:?: {
      if (/* !iswm $1) {
        echo -i36 $nick $thstamp $thop $+ $thspme $me $+ 7: $1- 
        .msg $target $1-
        halt
      } 
    }
    ;;;; Edited in 9/26/08
    raw 301:*: {
      echo -ai36 $thstamp $th2(4) Away7: Yes: ( $+ $3- $+ )  
      halt
    }
    raw 307:*: {
      echo -a $thstamp $th2(10) Registered7: Yes. 
      halt
    }
    raw 310:*: {
      echo -a $thstamp $th2(10) IRC Helper7: Yes.
      halt
    }
    raw 311:*: {
      echo -a $thstamp $th2(10) ----------7:----------
      echo -a $thstamp $th2(6) Whois 7- $2 
      echo -a $thstamp $th2(8) NickName7: $2 
      echo -a $thstamp $th2(8) RealName7: $6-
      echo -a $thstamp $th2(5) Ident7: $3 
      echo -a $thstamp $th2(7) Address7: *!*@ $+ $4 
      halt
    }
    raw 378:*: {
      echo -ai36 $thstamp $th2(8) Hostmask7: $6
      echo -ai36 $thstamp $th2(2) IP7: $7
      halt
    }
    raw 379:*: {
      echo -ai36 $thstamp $th2(5) Modes7: $6-
      halt
    }
    raw 671:*: {
      echo -a $thstamp $th2(3) SSL7: Yes
      halt
    }
    raw 312:*: {
      echo -a $thstamp $th2(6) Server7: $3 
      echo -ai36 $thstamp $th2(11) Description7: $4- 
      halt
    }
    
    raw 313:*: {
      echo -a $thstamp $th2(8) Net Rank7: $5-9 
      halt
    }
    raw 319:*: {
      echo -a $thstamp $th2(8) Channels7: $Replace($3-,~,~,&,&,@,@,%,%,+,+) 
      halt
    }
    raw 317:*: {
      echo -a $thstamp $th2(9) Signed on7: $asctime($4,dddd mm/dd/yyyy HH:nn:sstt)
      echo -a $thstamp $th2(4) Idle7: $duration($3)
      echo -a $thstamp $th2(6) Online7: $duration($calc($ctime - $4))
      halt
    }
    raw 335:*: { 
      echo -a $thstamp $th2(3) Bot7: Yes. 
      halt
    }
    
    raw 318:*: { 
      echo -a $thstamp $th2(6) Whois 7- End
      echo -a $thstamp $th2(10) ----------7:---------- 
      halt
    }
    alias th2 return $str($chr(160),$calc(16 - $1))
    ;;;;;;;; End Edit 9/26/08
    alias thop {
      if (!$regex($nick($chan,$nick).pnick,[~\&@%\+])) return $chr(160)
      if ($regex($nick($chan,$nick).pnick,[~\&@%\+])) return $left($nick($chan,$nick).pnick,1) 
    }
    
    alias thspme return $str($chr(160),$calc(15 - $len($me)))
    alias thspace return $str($chr(160),$calc(15 - $len($nick)))
    alias thstamp return $asctime(hh:nn)
    alias thjpq return $str($chr(160),16))

     

    m_49008_ujnCpAPA0sD6IkTpkfntJkdm3.png

  2. ;;; E-peen by KronicDreamer .... bordem!
    alias sepeen {
      var %epeen = $ceil($calc($uptime(system,3) / 100000))
      echo My system Epeen is %epeen inches long!
    }
    
    alias mepeen {
      var %mepeen = $ceil($calc($uptime(mirc,3) / 100000))
      echo My mIRC Epeen is %mepeen inches long!
    }
    
    ;; /sepeen for system epeen!
    ;; /mepeen for mirc epeen!

     

  3. Product of boredom.

    /fin [-c]

    -c = close

    ;the finger
    
    alias fin {
      var %win @Fuck
      if ($1 == -c) { fin.close | return }
      elseif (!$window(%win)) window -dBpfk0 %win 1 1 188 210
      titlebar %win You
      the.finger
    }
    
    alias fin.close {
      .timerfin off 
      unset %fin* 
      close -@ @Fuck
    }
    
    alias the.finger {
      set %fin.sc +
      set %fin.c 1
      var %win @Fuck , %x 1 , %w 5
      clear %win
      drawrect -ndf %win 1 4 68 10 36 100
      drawrect -ndf %win 1 4 2 90 168 90
      drawrect -ndf %win 0 4 5 127 162 50
      while (%x <= 5) {
        drawrect -ndf %win 0 4 %w 93 30 45
        inc %w 33
        inc %x 1
      }
      drawrect -ndf %win 0 4 71 13 30 150
      drawrect -nd %win 1 2 74 16 23 19 4 5
      drawtext -np %win 1 Arial 20 8 183 2m4IR8C hates 3YOU :)
      drawdot %win
      .timerfin -m 0 50 fin.sc %fin.sc
    }
    alias -l fin.sc {
      if (!$window(@Fuck)) {
        fin.close
        return
      }
      else {
        if (%fin.c == 18) { %fin.sc = $iif(%fin.sc == +,-,+) | %fin.c = 1 }
        drawscroll @Fuck $+(%fin.sc,1) 0 0 0 199 180
        inc %fin.c
      }
    }
    
    on 1:CLOSE:@Fuck:fin.close
    
    ;EOF

     

  4. This snippet slaps a user with anything but a large trout.

    Syntax: /slap NickName

    If a user is not provided, it slaps the user(s) selected in the nicklist. If no user is selected/provided then nothing happens.

     

    ;Slapper
    ;napalm - 14 JUN 2011
    
    alias slap {
      var %n $iif($1,$1,$$snicks)
      if ($sock(slap)) sockclose slap
      sockopen slap www.watchout4snakes.com 80
      sockmark slap $active %n
    }
    
    alias slap.error echo $color(kick) -at /SLAP: Sock $+ $2 Error. $sock($1).wsmsg 
    
    on *:sockopen:slap:{
      if ($sockerr) || ($sock($sockname).status != active) { slap.error $sockname open | return }
      sockwrite -n $sockname GET /CreativityTools/RandomWord/RandomPhrase.aspx HTTP/1.1
      sockwrite -n $sockname Host: www.watchout4snakes.com
      sockwrite -n $sockname User-Agent: mIRC $version
      sockwrite -n $sockname $crlf
    }
    
    on *:sockread:slap:{
      var %r | sockread %r | tokenize 32 %r
      if ($sockerr) || ($sock($sockname).status != active) { slap.error $sockname read | return }
      elseif ($regex(%r,main_lblPhrase.+>(.+)</span>)) {
        tokenize 32 $sock($sockname).mark $regml(1)
        describe $1 slaps $2 around a bit with $+(a,$iif($regex($left($3,1),[aeiou]),n)) $3-
        return
      }
      elseif ($1 == </HTML>) sockclose $sockname
    }
    
    ;EOF

     

  5. So as of lately i've been looking for all types of mIRC snippets in various languages to archive most of them due to IRC website slowly closing.

    I'am also trying to get Hawkee site to keep running and have been messageing Scott = Hawkee if he needs help or wants to sell. there's so much history in that site wouldnt want to see it go to waste. 

    So if you know old sites that are closing and have snippets let me know i'll grab them and add them here.

  6. on *:load: { 
      .echo -aq $input(Yapımcı: SaNCaK $+ $crlf $+ $crlf $+ Addon: Küfür Koruması $chr(40) $+ v5.4 $+ $chr(41) $+ $crlf $+ $crlf $+ Yapım: 17/10/2014 $+ $crlf $+ $crlf $+ Iletişim: sancak@outlook.com.tr $+ $crlf $+ $crlf $+ Kodu Kullandığınız için Teşekkür ederim,igo,Addon: Küfür Koruması$chr(40) $+ v5.4 $+ $chr(41))
      echo -a _____________________________________________________________________________________
      echo -a 4,1 -=^ 14,1S15,1aN15,1C0,1aK4,1^=-  0,1 Add-On yükleniyor... 
      echo -a 4,1 -=^ 14,1S15,1aN15,1C0,1aK4,1^=-  0,1 Çalışan mIRC15 $version 0Sistem15 Windows $+ $os 
      echo -a 4,1 -=^ 14,1S15,1aN15,1C0,1aK4,1^=-  0,1 Coder: 15SaNCaK 0,1 E-Mail: 15sancak@outlook.com.tr 
      echo -a 4,1 -=^ 14,1S15,1aN15,1C0,1aK4,1^=-  0,1 Web: 15www.0,1Turkirc.com
      echo -a 4,1 -=^ 14,1S15,1aN15,1C0,1aK4,1^=-  15,1 Copyright 12©15 1999-2018 
      echo -a ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
      echo -a 4,1[15,1 NOT: 4,1] 0,1 kufur.txt Dosyası oluşturarak siteadresiniz.com adresinizin ana dizinine atınız.
      echo -a ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
    }
     
    Menu Channel {
      -
      $iif($group(#Kufurkoruma) == on,$style(1) Kufur Koruma  [Açık],Kufur Koruma [Kapalı]) { $iif($group(#Kufurkoruma) == on, .disable  #Kufurkoruma, .enable #Kufurkoruma) }
      -
    }
     
    #Kufurkoruma off
    on @*:text:*:#: bw $1-
    on @*:action:*:#: bw $1-
    on @*:notice:*:#: bw $1-
    #Kufurkoruma end
     
    on *:sockopen:bw*:{
      if (!$sockerr) {
        tokenize 96 $str($chr(96) sockwrite -n $sockname,2)
        $1 GET /kufur.txt HTTP/1.1
        $2 Host: $+($sock($sockname).addr,$str($crlf,2))
      }
    }
    alias -l bw {
      var %b = $+(bw,$site,$r(1,9999),$ticks)
      if ($sock(%b)) sockclose $v1
      sockopen %b sitenizinadi.com 80 
      set -e %1- $strip($1-) | set -e %1-- kick # $nick Küfür etmek yasaktır!
    }
    on *:sockread:bw*:{
      if (!$sockerr) {
        if (!$sock($sockname).mark) {
          var %b | sockread %b
          if (!%b) sockmark $sockname 1 | halt
        }
        while ($sock($sockname).rq > 0) {
          sockread -fn &bw
          if ($regex(%1-,/(^| )\Q $+ $bvar(&bw,1-).text $+ \E\b/)) {
            %1-- | unset %1* | sockclose $sockname
          }
        }
      }
    }

     

  7. menu channel {
      .Kanal Mod
    ..CTCP( +f [5c#M3]=7 ):/mode # +f [5c#M3]:7
    ..Flood Giriş( +f [6j#R3]=4 ):/mode # +f [6j#R3]:4
    ..KNOCK( +f [4k]=8 ):/mode # +f [4k]:8
    ..Mesaj Flood Genel( +f [10m#m5]=6 ):/mode # +f [10m#m5]:6
    ..Nick Değiştirme( +f [3n#N1]=10 ):/mode # +f [3n#N1]:10
    ..Mesaj Flood 1 kullancı( +f [5t#b]=5):/mode #kanaladı +f [5t#b]:10
    ..-
    ..$iif(B isincs $chan(#).mode,$style(1)) +B (Büyük Harf Yasağı): if (B isincs $chan(#).mode) { mode # -B } | else { mode # +B }
    ..$iif(n isincs $chan(#).mode,$style(1)) +n (Kanalda bulunmayan birinden gelecek mesajlarin bloklandigi kanal): if (n isincs $chan(#).mode) { mode # -n } | else { mode # +n }
    ..$iif(t isincs $chan(#).mode,$style(1)) +t (Sadece +hoaq kiplerini almis kullanicilarin /topic komutunu kullanabilecegi kanal): if (t isincs $chan(#).mode) { mode # -t } | else { mode # +t }
    ..$iif(s isincs $chan(#).mode,$style(1)) +s (Gizli bir kanal): if (s isincs $chan(#).mode) { mode # -s } | else { mode # +s }
    ..$iif(p isincs $chan(#).mode,$style(1)) +p (Ozel bir kanal): if (p isincs $chan(#).mode) { mode # -p } | else { mode # +p }
    ..$iif(i isincs $chan(#).mode,$style(1)) +i (Sadece davetle girilebilen kanal): if (i isincs $chan(#).mode) { mode # -i } | else { mode # +i }
    ..$iif(m isincs $chan(#).mode,$style(1)) +m (Sadece +vhoaq kiplerini almis kullanicilarin konusabilecegi kanal ): if (m isincs $chan(#).mode) { mode # -m } | else { mode # +m }
    ..$iif(l isincs $chan(#).mode,$style(1)) +l (Kanala girebilicek olan maximum kullanici sayisini belirler $chr(8) $chan(#).limit ): if (l isincs $chan(#).mode) { mode # -l } | else { mode # +l $$?=" Limit? " }
    ..$iif(k isincs $chan(#).mode,$style(1)) +k ( = Kanala giris icin gereken anahtar $chr(8) $chan(#).key ): if (k isincs $chan(#).mode) { mode # -k $chan(#).key } | else { mode # +k $$?=" Şifre? " }
    ..$iif(R isincs $chan(#).mode,$style(1)) +R (Sadece kayitli (+r) kullanicilarin girebilecegi kanal.): if (R isincs $chan(#).mode) { mode # -R } | else { mode # +R }
    ..$iif(Q isincs $chan(#).mode,$style(1)) +Q (Kick atilmayan kanal.): if (Q isincs $chan(#).mode) { mode # -Q } | else { mode # +Q }
    ..$iif(N isincs $chan(#).mode,$style(1)) +N (Nick degisikligi yapilamayan kanal): if (N isincs $chan(#).mode) { mode # -N } | else { mode # +N }
    ..$iif(M isincs $chan(#).mode,$style(1)) +M (Sadece kayitli (+r) veya voice'i olan (+v) kullanicilarin konusabilecegi kanal): if (M isincs $chan(#).mode) { mode # -M } | else { mode # +M }
    ..$iif(G isincs $chan(#).mode,$style(1)) +G (Yasak kelimelerin sansurlenecegi kanal): if (G isincs $chan(#).mode) { mode # -G } | else { mode # +G }
    ..$iif(C isincs $chan(#).mode,$style(1)) +C (CTCp metinlerini engeller): if (C isincs $chan(#).mode) { mode # -C } | else { mode # +C }
    ..$iif(L isincs $chan(#).mode,$style(1)) +L #kanal2 (Kanal linkleme. (kanal dolu ise, sonraki kullanici otomatik olarak  girer.)): if (L isincs $chan(#).mode) { mode # -L } | else { mode # +L $$?="Yönlendirilecek Kanal" }
    ..$iif(f isincs $chan(#).mode,$style(1)) +f ([*]: = Flood korumasi.): if (f isincs $chan(#).mode) { mode # -f } | else { mode # +f $$?=" satır:saniye 3:5 " }
    ..$iif(u isincs $chan(#).mode,$style(1)) +u (Kanal yonetici kiplerinin gizli oldugu kanal): if (u isincs $chan(#).mode) { mode # -u } | else { mode # +u }
    ..$iif(D isincs $chan(#).mode,$style(1)) +D (/me veya /ame mesajlarinin kanala gonderilmesini engeller): if (D isincs $chan(#).mode) { mode # -D } | else { mode # +D }
    ..$iif(c isincs $chan(#).mode,$style(1)) +c (Kanal icerisinde renk kullanimini engeller): if (c isincs $chan(#).mode) { mode # -c } | else { mode # +c }
    ..$iif(A isincs $chan(#).mode,$style(1)) +A (Sadece Sunucu/Ag yoneticilerinin girebilecegi kanal. (Yoneticiler icin.)): if (A isincs $chan(#).mode) { mode # -A } | else { mode # +A }
    ..$iif(z isincs $chan(#).mode,$style(1)) +z (Sadece Guvenli Baglanti (SSL) kullananlarin girebilecegi kanal): if (z isincs $chan(#).mode) { mode # -z } | else { mode # +z }
    ..$iif(K isincs $chan(#).mode,$style(1)) +K (KNOCK komutuna izin verilmeyen kanal): if (u isincs $chan(#).mode) { mode # -u } | else { mode # +u }
    ..$iif(O isincs $chan(#).mode,$style(1)) +O (Sadece IRCoplarin girebilecegi kanal (Yoneticiler icin.) ): if (K isincs $chan(#).mode) { mode # -K } | else { mode # +K }
    ..$iif(S isincs $chan(#).mode,$style(1)) +S (Renkli yazilarin, renkli kodlardan arindirilip kanala gonderilmesini saglar): if (S isincs $chan(#).mode) { mode # -S } | else { mode # +S }
    ..$iif(V isincs $chan(#).mode,$style(1)) +V (INVITE 'in kapali oldugu kanal): if (V isincs $chan(#).mode) { mode # -V } | else { mode # +V }
    ..$iif(T isincs $chan(#).mode,$style(1)) +T (Noticenin komutunun kullanilamayacagi kanal): if (T isincs $chan(#).mode) { mode # -T } | else { mode # +T }
    ..$iif(u isincs $chan(#).mode,$style(1)) +u (Kanal yonetici kiplerinin gizli oldugu kanal): if (u isincs $chan(#).mode) { mode # -u } | else { mode # +u }
    .-

     

  8. C++
    ####################
    menu menubar { 
      Admin Paneli:/Adminmenu
    } 
    ####################
    ## Admin Paneli:Adminmenu
    alias Adminmenu { dialog -m Adminmenu Adminmenu }
    dialog Adminmenu {
      title "Admin Paneli"
      size -1 -1 247 223
      option dbu
      button "« « KAPAT » »", 10, 3 208 242 13, flat ok
      list 1, 2 10 71 139, size
      text "Nickin üstünü Tıklayın ve işlem yapın", 8, 5 153 122 8, center
      button "Gline", 2, 2 164 64 13, flat
      button "Shun", 4, 69 164 63 13, flat
      button "Kill", 3, 135 164 58 13, flat
      button "Tüm Kanaldan Çıkar", 5, 2 180 64 12, flat
      button "Tüm Kanallara Al", 6, 69 180 63 12, flat
      button "Ban (+b)", 7, 194 180 51 12, flat
      text "Tüm Nickler", 11, 3 2 69 8, center
      list 12, 73 10 56 139, size
      text "Ident", 13, 73 2 56 8, center
      list 14, 129 10 65 139, size
      text " ip", 15, 130 2 65 8, center
      text "", 16, 137 153 53 7, center
      box "", 17, 2 148 129 14
      box "", 18, 135 148 58 14
      button "Değiştir", 20, 135 195 58 12, flat
      edit "", 19, 69 195 63 10, multi autohs
      text "User Nicki değistir :", 21, 4 196 55 8, center
      box "", 22, 3 192 61 14
      text " Global Odalar", 23, 194 2 50 8, center
      list 24, 194 10 51 66, size
      text " Yönetici odaları", 25, 194 76 53 8, center
      list 26, 194 84 51 40, size
      button " Sajoin", 27, 194 151 51 12, flat
      button "Sapart", 28, 194 165 51 12, flat
      button "Bütün +b Kaldır", 29, 135 180 58 12, flat
      button "Alban (+b)", 30, 194 195 51 12, flat
      list 31, 194 125 51 24, size
      box "", 9, 392 89 0 88
    }
     
     
    ;alias sonuc { noop $tip(b, %kn_, Kanalından4 $iif(%k-nick,%k-nick, $iif(%bnick, %bnick, Kullanıcı)) Ban Yedi,9999999999999) }
    ;alias knk { .timerbnb 1 2 sonuc } 
    on *:ban:#:{ unset %k-nick | set -e %bnick $bnick | set -e %kn_ # } 
    on *:kick:#:{ set -e %k-nick $knick }
    on *:dialog:Adminmenu:sclick:26:{
      if $did(Adminmenu,26).sel { did -u Adminmenu 24 | did -u Adminmenu 31 }
    }
    on *:dialog:Adminmenu:sclick:24:{ 
      if $did(Adminmenu,24).sel { did -u Adminmenu 26 | did -u Adminmenu 31  }
    }
    on *:dialog:Adminmenu:sclick:31:{ 
      if $did(Adminmenu,31).sel { did -u Adminmenu 26 | did -u Adminmenu 24 }
    }
    on *:dialog:Adminmenu:sclick:30:{ albans $did(1).seltext  }
    alias albans {
      var %l_ 1, %l- $did(Adminmenu,24).lines
      while %l_ &lt;= %l- { samode $did(Adminmenu,24,%l_).text +b $1 | inc %l_ }
    }
    alias -l ksec { 
      if $did(24).sel { return $did(24).seltext }
      elseif $did(26).sel { return $did(26).seltext }
      elseif $did(31).sel { return $did(31).seltext }
    }
    on *:dialog:Adminmenu:sclick:29:{ .bn #Radyo #Kelime #isLam #Test #Bilgi #Yarisma #SaNCaK #Admin #Services #Kontrol #Help #Opers #Dj }
    alias bn {
      var %a 1 ,%b $numtok($1-,32)
      while %a &lt;= %b { 
        var %c 1
        while %c &lt;= $ibl($gettok($1-,%a,32),0)  {
        samode $gettok($1-,%a,32) -b $ibl($gettok($1-,%a,32),%c) | inc %c } 
        inc %a 
      } 
    }
    on *:dialog:Adminmenu:sclick:27:{ 
      if $did(1).sel &amp;&amp; $did(24).sel || $did(26).sel || $did(31).sel { sajoin $did(1).seltext $ksec }  
    }
    on *:dialog:Adminmenu:sclick:28:{
      if $did(1).sel &amp;&amp; $did(24).sel || $did(26).sel || $did(31).sel { sapart $did(1).seltext $ksec }  
    }
    on *:dialog:Adminmenu:sclick:1: { did -c $dname 1 $did(1).sel | did -c $dname 12 $did(1).sel | did -c $dname 14 $did(1).sel }
    on *:dialog:Adminmenu:dclick:1: { !query $$did(1).seltext }
    on *:dialog:Adminmenu:dclick:24: { join $$did(24).seltext }
    on *:dialog:Adminmenu:dclick:26: { join $$did(26).seltext }
    on *:dialog:Adminmenu:dclick:31: { join $$did(31).seltext }
    on *:dialog:Adminmenu:sclick:12: { did -c $dname 12 $did(12).sel | did -c $dname 14 $did(12).sel | did -c $dname 1 $did(12).sel }
    on *:dialog:Adminmenu:sclick:14: { did -c $dname 1 $did(14).sel | did -c $dname 14 $did(14).sel | did -c $dname 12 $did(14).sel }
     
    on *:dialog:Adminmenu:*:*: {
      if $devent == init { 
        set %Adminmenu on | who +I 
        mdx MarkDialog $dname
        mdx SetDialog $dname bgcolor $rgb(237,241,219)
        mdx SetFont $dname 1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,33,34 +b Turkish 15 950 Tahoma
        mdx SetColor $dname 1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,32,33,33,34 textbg $rgb(237,241,219)
        mdx SetColor $dname 1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,32,33,33,34 background $rgb(237,241,219)
        mdx SetColor $dname 1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21 text $rgb(0,0,0)
        mdx SetColor $dname 11,13,15,16,8,21,23,25l text $rgb(199,92,2)
        did -a $dname 24 #Radyo
        did -a $dname 24 #Sohbet
        did -a $dname 24 #Chat
        did -a $dname 24 #Felsefe
        did -a $dname 24 #İzmir
        did -a $dname 24 #İstanbul
        did -a $dname 24 #SaNCaK
        did -a $dname 26 #Master
        did -a $dname 26 #Xline
        did -a $dname 26 #Admin
        did -a $dname 26 #OperSohbet
        did -a $dname 31 #Operhelp
        did -a $dname 31 #Help
      }
      if $devent == sclick &amp;&amp; $status == connected {
        if $did == 2 { gzline $did(1).seltext 8,115Sunucumuzda 4Reklam15/ 4Kufur15/ 4Saldiri 15Tespit Edilmistir4.15 Kosullara Gore gerekli Mudahalelerde Bulunma Uyeyi Odadan Men etme Kanali veya Rumuzu Kapatma Yasaklama ve Uyelik iptali Haklarina ve Yetkilerine Sahiptir. 4Lutfen 15Sohbet kurallarina Uyunuz. } 
        if $did == 3 { kill $did(1).seltext Kill }
        if $did == 20 { /operserv badnick $did(1).seltext } 
        if $did == 30 { cs unban $did(24).seltext,$did(26).seltext$did(31).seltext all  }
        if  $did == 4 { shun $did(1).seltext 8,115Sunucumuzda 4Reklam15/ 4Kufur15/ 4Saldiri 15Tespit Edilmistir4.15 Kosullara Gore gerekli Mudahalelerde Bulunma Uyeyi Odadan Men etme Kanali veya Rumuzu Kapatma Yasaklama ve Uyelik iptali Haklarina ve Yetkilerine Sahiptir. 4Lutfen 15Sohbet kurallarina Uyunuz. } 
        if $did == 5 { 
          set %offlan $did(Adminmenu,1).seltext
          kapats
        }
        if $did == 6 { 
          set %offlan $did(Adminmenu,1).seltext
          yetergir
        }
        if $did == 7 { 
          if $did(24).sel { ksecb $did(Adminmenu,24).seltext } 
          elseif $did(26).sel { ksecb $did(Adminmenu,26).seltext }
          elseif $did(31).sel { ksecb $did(Adminmenu,31).seltext }
          else { ksecb $active }
        }
      }
      if $devent == close { 
        write -c wholist.txt 
        unset %Adminmenu
      }
    }
     
    alias ksecb { os mode $1 +b $did(Adminmenu,1).seltext }
     
     
    raw 352:*: { 
      if (%Adminmenu == on) {
        if ($8 == 1) { halt }
        if ($6 == S-Bot) { halt }
        if ($3 == SekerShell) { halt }
        if (*B* iswm $7) { halt }
        write wholist.txt $6
        did -a Adminmenu 16 Toplam = $lines(wholist.txt) Kişi
        did -a Adminmenu 1 $6
        did -a Adminmenu 12 $3
        did -a Adminmenu 14 $4  
        .timer 1 2 unset %Adminmenu
        /halt
      }
    }
    raw 315:*: { /halt }
     
    alias yetergir {
      set %veri4 1
      set %veri5 $chan(0)
      while %veri4 &lt;= %veri5 {
        if $regex($chan(%veri4),/operhelp|opers|log|services|x|dj|op|admin|help|kontrol/i) { halt }
        sajoin %offlan $chan(%veri4) 
        inc %veri4 
      }
    }
    alias kapats {
      set %kapats1 1
      set %kapats2 $chan(0)
      while %kapats1 &lt;= %kapats2 {
        sapart %offlan $chan(%kapats1) 
        inc %kapats1 
      }
    }

     

  9. Kodu eklemeniz gereken kısım; ALT+R => Remote => kendi oluşturduğunuz .ini dosyası veya boş bir ini dosyasına yapıştırabilirsiniz

     

    menu status,menubar,channel {
    
    
    
    -
    }
    dialog glist {
    title "Ban Listesi"
    size -1 -1 423 162
    option dbu
    list 1, 2 10 82 126, size
    text "Gline Listesi", 4, 4 2 45 8
    button "« « KAPAT » »", 5, 170 116 82 20, flat ok
    list 2, 86 10 82 126, size
    list 3, 254 10 82 126, size
    text "Shun Listesi", 6, 86 2 71 8
    text "Zline Listesi", 7, 254 2 54 8
    text "Kaldirmak istediginiz Banin ip numarasinin Uzerine Cift tiklayinca Ban Kalkacak.", 8, 72 140 266 8
    list 9, 170 10 82 103, size
    text "G-Zline Listesi", 10, 170 2 65 8
    list 11, 338 10 82 126, size
    text "Kline Listesi", 12, 338 2 60 8
    edit "", 13, 116 150 147 10, read
    }
    
    on *:dialog:glist:*:*:{
    if $devent == init {
    mdx MarkDialog $dname
    mdx SetDialog $dname bgcolor $rgb(240,240,240)
    mdx SetFont $dname 1,2,3,4,5,6,7,8,9,10,11,12,13 +b Turkish 13 950 Tahoma
    mdx SetColor $dname 1,2,3,4,5,6,7,8,9,10,11,12,13 textbg $rgb(240,240,240)
    mdx SetColor $dname 1,2,3,4,5,6,7,8,9,10,11,12,13 background $rgb(240,240,240)
    mdx SetColor $dname 1,2,3,4,5,6,7,8,9,10,11,12,13 text $rgb(0,0,0)
    mdx SetColor $dname 8 text $rgb(199,92,2)
    mdx SetColor $dname 13 text $rgb(255,0,0)
    if !$regex($usermode,/o/) { did -a $dname 13 Bu islemi Yapmaniz icin Admin olmalisiniz.. | return }
    set %gkontrol on | .enable #bangizle | .stats g | .stats s | .stats k | .stats Z
    .timer 1 1 .disable #bangizle
    
    if $devent == dclick {
    if $did == 1 {
    gline $+(-*@, $did(1).seltext)
    did -d $dname 1 $did(1).sel
    }
    if $did == 2 {
    shun $+(-*@, $did(2).seltext)
    did -d $dname 2 $did(2).sel
    }
    if $did == 3 {
    zline $+(-*@, $did(3).seltext)
    did -d $dname 3 $did(3).sel
    }
    if $did == 9 {
    gzline $+(-*@, $did(9).seltext)
    did -d $dname 9 $did(9).sel
    }
    if $did == 11 {
    kline $+(-*@, $did(11).seltext)
    did -d $dname 11 $did(11).sel
    }
    }
    if $devent == close {
    write -c gline.txt
    write -c zline.txt
    write -c shun.txt
    write -c gzline.txt
    write -c kline.txt
    }
    }
    raw 223:*: {
    if ($2 isincs G) && (%gkontrol == on) && ($dialog(glist)) {
    did -a glist 1 $gettok($3,2,64) | write gline.txt $gettok($3,2,64)
    .timer 1 3 unset %gkontrol
    }
    if ($2 isincs z) && (%gkontrol == on) && ($dialog(glist)) {
    did -a glist 3 $gettok($3,2,64) | write zline.txt $gettok($3,2,64)
    }
    if ($2 isincs s) && (%gkontrol == on) && ($dialog(glist)) {
    did -a glist 2 $gettok($3,2,64) | write shun.txt $gettok($3,2,64)
    }
    if ($2 isincs Z) && (%gkontrol == on) && ($dialog(glist)) {
    did -a glist 9 $gettok($3,2,64) | write gzline.txt $gettok($3,2,64)
    }
    if ($2 isincs K) && (%gkontrol == on) && ($dialog(glist)) {
    did -a glist 11 $gettok($3,2,64) | write kline.txt $gettok($3,2,64)
    }
    /halt
    }
    alias glist { dialog -m glist glist }
    #bangizle off
    raw 223:*: { /halt }
    raw 249:*: { /halt }
    raw 219:*: { /halt }
    raw 216:*: { /halt }
    #bangizle end

     

  10. on *:text:*:#KANAL:{
      if !proxyekle* iswm $1- {
        if $read(proxy.txt,w,$2-) {
          .msg $chan $2 Proxy Listesinde zaten ekli.
        }
        else {
          write proxy.txt $2-
          .msg #KANAL $2 Proxy Listesine Eklendi.
          .gzline $2 Proxy PERM
        }
      }
      if !proxysil* iswm $1- {
        if !$read(proxy.txt,w,$2-) {
          .msg #KANAL $2 Maskı Zaten Proxy Listesinde yok.
        }
        else {
          write $+(-,dw,$2-) badnick.txt
          .msg #KANAL $2 Maskı Proxy Listesinden Silindi.
          .gzline $2
        }
      }
    }

     

  11. kanalınıza girmesini istemediğiniz kişileri otomatik olarak banlaması ve nick değiştirse dahi kanala girişini engellemektir.
    Kişiye özel akick listesi diyebiliriz.
     

    on *:input:#: {
      if $regex($1,/^([.!-]ban)/Si) {
        if !$2 { echo -a 2Lütfen parametre belirtiniz.4 !ban kayit|liste|sil Örnek : !ban Liste | return }
      }
      if $2 == liste {
        if $lines(ban.txt) = 0 { echo -a 2Belirtilen ban mevcut değil. | halt }
        echo -a 2ban listesi siralaniyor.
        var %banla 1
        while (%banla <= $lines(ban.txt)) {
          echo -a %banla $read(ban.txt,%banla)
          inc %banla
        }
      }
      if $2 == ekle {
        if !$3 { echo -a 2Lütfen nick belirtiniz.4 !ban ekle nick | return }
        if $read(ban.txt,w, $+ * $+ $nick $+ * $+ ) { echo -a 2Eklemeye çalıştığınız nick zaten listede ekli bulunuyor. | halt }
        write ban.txt $3 | mode # +b $3 | kick # $3 4,1Kişisel Ban listeme eklendiniz.
        echo -a 4 $+ $3 $+ , 2ban listesine eklenmiştir.
      }
      if $2 == sil {
        if !$3 { echo -a $nick 2Lütfen nick belirtiniz.4 !ban sil numara | return }
        if $lines(ban.txt) = 0 { echo -a 2Ban kaydı bulunamadi. | halt }
        write $+(,-dl,$3,) ban.txt
        echo -a $3 $+ , 2Numaralı nickin ban kaydı silindi.
      }
    }
    on *:join:#: {
      if ($read(ban.txt,w,$nick)) {
        mode # +b $nick | kick # $nick 4,1 Kişisel Ban Listemdesiniz.
      }
    }
    on *:nick: { if $read(ban.txt,w,$nick) { echo -a Ban listesindeki $nick  $newnick nickini aldığı için ban listesine eklendi. | write ban.txt $newnick  | mode # +b $newnick | kick # $newnick 4,1Nick değiştirip kanalıma girmeye çalıştığınızı tespit ettim.  } }

     

  12. Başlıkta belirrtiğim gibi bir kanalda yetkili oldugunuzda veya yetkiniz aldığında size bilgi vermeye yarayan güzel bir kod

     

    on 1:op:#: {
    if ($opnick != $me) { halt }
    else { /echo -a 11,1 - 15,1 Dikkat! 11,1 -  11,1 - 0,1 # 15Kanalında $nick tarafından 0op 15oldunuz. 11,1 -  | halt }
    }
    on 1:deop:#: {
    if ($opnick != $me) { halt }
    else { /echo -a 11,1 - 15,1 Dikkat! 11,1 -  11,1 - 0,1 # 15Kanalında $nick tarafından 0deop 15oldunuz. 11,1 -  | halt }
    }

     

  13. Sunucu üzerinde Sqline listesini tek bir komut ile tek seferde tüm Sqline listesini temizleyebilirsiniz .

    Kullanımı : /sqlinedell

     

    alias Sqlinedell { .set -u3 %:sqline on | echo -a Sqline listesi siliniyor. | os sqline list }
    on *:notice:*:?:{
      if %:sqline == on {
        if ($nick == OperServ) && (SQLINE listesinden silindi !isin $strip($1-)) {
          if (Aktüel liste: isin $1-) { return }
          os sqline del $1
        }
      }
    }

     

  14. Kodun amacı bir kanalda !preferix yazdınığınızda size otomatik olarak bu modeleri verir.
    Veye !depreferix yazdığınızda sizden bu modeleri tekrar geri alır.

     

    on *:input:#:{
      if ($regex($1,^(!preferix|!deprefefrx)$)) { 
        mode # $iif($left($1,3) = !de,-,+) $+ qaohve $str($+($me,$chr(32)),6) 
      }
    }

     

  15. Sunucu üzerindeki belirlediğiniz bir İdent'i İstediğiniz Limit kadar kullanılmasına izin verir.
    Ama limit aşılırsa otomatik olarak Kill atar .
    Giriş cıkısları otomatik olarak kontrol eder ve girdi(inc)/çıktı(dec) şeklinde tutar.

     

    on *:snotice:*: {
         if (*client conn* iswm $1-) {
           var %i = $gettok($remove($10,$chr(40)),1,64)
           if ($hget(ident,%i) >= 6) kill $9 KILL SEBEBİ.
           else hinc -m ident %i 1
        }
        if (*client exiting* iswm $1-) {
           var %ii = $gettok($remove($7,$chr(40)),1,64)
           $iif($hget(ident,%ii) >= 1,hdec ident %ii 1)
        }
    }

     

  16. #otokomut on
    on *:input:*: {
      if ($1 == !kick) { /kick # $2 4 $me İyi Yolculuklar Diler. }
      if ($1 == !ban) { /ban -u600 $2 }
      if ($1 == !kb) { /ban -u600 $2 | /kick # $2 4 $me İyi Yolculuklar Diler. }
      if ($1 == !gel) { /msg # 2 $2 4Getiriliyor... | /sajoin $2 # }
      if ($1 == !git) { /msg # 2 $2 4Gönderiliyor... | /sapart $2 # }
      if ($1 == !cs) { /Chanserv $2 # $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 $20 $21 $22 $23 $24 $25 $26 $27 $28 $29 $30 $31 $32 $33 $34 $35 $36 $37 $38 $39 $40 $41 $42 $43 $44 $45 $46 $47 $48 $49 $50 $51 $52 $53 $54 $55 $56 $57 $58 $59 $60 }
      if ($1 == !ms) { /Memoserv $2 $3 $4 $5 $6 $7 $8 $9 }
      if ($1 == !os) { /Operserv $2 $3 $4 $5 $6 $7 $8 $9 }
      if ($1 == !ns) { /Nickserv $2 $3 $4 $5 $6 $7 $8 $9 }
      if ($1 == !info) { /ns info $2 all }
      if ($1 == !infochan) { /cs info # all }
      if ($1 == !founder) { /cs set # founder $2 }
      if ($1 == !mlock) { /cs set # mlock $2 }
      if ($1 == !privateon) { /cs set # private on }
      if ($1 == !privateoff) { /cs set # private off }
      if ($1 == !secureon) { /cs set # secure on }
      if ($1 == !secureoff) { /cs set # secure off }
      if ($1 == !enforceon) { /cs set # enforce on }
      if ($1 == !enforceoff) { /cs set # enforce off }
      if ($1 == !topic) { /cs topic # $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 $20 $21 $22 $23 $24 $25 $26 $27 $28 $29 $30 $31 $32 $33 $34 $35 $36 $37 $38 $39 $40 $41 $42 $43 $44 $45 $46 $47 $48 $49 $50 $51 $52 $53 $54 $55 $56 $57 $58 $59 $60 }
      if ($1 == !successor) { /cs set # successor $2 }
      if ($1 == !unban) { /cs unban #$2 }
      if ($1 == !opekle) { /cs access # add $2 50 }
      if ($1 == !opsil) { /cs access # del $2 } 
      if ($1 == !sopekle) { /cs access # add $2 100 }
      if ($1 == !oplist) { /cs access # list } 
      if ($1 == !hopekle) { /cs access # add $2 40 }
      if ($1 == !gir) { /join #$2 }
      if ($1 == !voice) { /cs voice # $2 }
      if ($1 == !devoice) { /cs devoice # $2 }
      if ($1 == !op) { /cs op # $2 }
      if ($1 == !deop) { /cs deop # $2 }
      if ($1 == !ownerim) { /mode # +q $me }
      if ($1 == !deownerim) { /mode # -q $me }
      if ($1 == !owner) { /mode # +q $2 }
      if ($1 == !deowner) { /mode # -q $2 }
      if ($1 == !sop) { /Os raw :Chanserv mode # +o $2 | /Os raw :Chanserv mode # +a $2 }
      if ($1 == !desop) { /Os raw :Chanserv mode # -o $2 | /Os raw :Chanserv mode # -a $2 }
      if ($1 == !hop) { /cs halfop # $2 }
      if ($1 == !dehop) { /cs dehalfop # $2 }
      if ($1 == !awayon) { /away Uzaklardayım... }
      if ($1 == !awayoff) { /away }
      if ($1 == !kill) { /kill $2 4 $me İyi Yolculuklar Diler. }
      if ($1 == !zline) { /zline $2 4 $me İyi Yolculuklar Diler. }
      if ($1 == !shun) { /shun $2 4 $me Sana 3 Maymunu Oynatıyor. }
      if ($1 == !bye) { /kill $2 4 $me İyi Yolculuklar Diler. }
      if ($1 == !opum) { /mode # +o $me }
      if ($1 == !deopum) { /mode # -o $me }
      if ($1 == !voicem) { /mode # +v $me }
      if ($1 == !devoicem) { /mode # -v $me }
      if ($1 == !sopum) { /mode # +o $me | /mode # +a $me }
      if ($1 == !desopum) { /mode # -a $me | /mode # -o $me }
      if ($1 == !hopum) { /mode # +h $me }
      if ($1 == !dehopum) { /mode # -h $me }
      if ($1 == !nick) { /os raw svsnick $2 $3 1:0 }
      if ($1 == !botnick) { /os raw $2 nick $3 }
      if ($1 == !botgel) { /os raw $2 join # }
      if ($1 == !botgit) { /os raw $2 part # }
      if ($1 == !botde) { /os raw $2 privmsg # $3 $4 $5 $6 $7 $8 $9 }
      if ($1 == !sessiz) { /mode # +m }
      if ($1 == !mode) { /mode # $2 }
      if ($1 == !sesli) { /mode # -m }
      if ($1 == !sakin) { /mode # +m | /msg # !temizle | .timer34 1 60 /mode # -m }
    }
    #otokomut end
    
    menu menubar,channel {
      Oto Komutlar
      .Aç:.enable #otokomut | echo -a 4,1..::Oto Komutlar Açıldı::..
     .Kapat:.disable #otokomut | echo -a 4,1..::Oto Komutlar Kapandı:..
      -
    }

     

  17. Herhangi belirlediğiniz bir kanal için ve her kanal olarak kullanabileceğiniz ident'e göre voice vermek icin kullanılan bir remotedir .

     

    on *:join:#KANAL: {
      if $gettok($gettok($address($nick,5),1,64),2,33) == X {
        ym $nick
      }
    }
    
    alias ym {
      var %bakiyor = 1
      while $nick(#z,%bakiyor) { 
        if !$regex($nick(#z,$ifmatch).pnick,/^(@|&|~)/) { 
          mode #z +v $1
          msg $$1 #Z kanalında tarafımdan 013voice yapıldınız.
        }
        inc %bakiyor
      }
    }

     

  18. on *:text:*:#CHANNEL: {
      if ($1 == !announcement) {
        if !$hget(announcement,$nick) {
          .hadd -msu120 announcement $nick 1
          msg #Your Channel MESSAGE
          msg #Your Channel MESSAGE
          return
        }
        else {
          You can use the .notice $nick announcement command once in 2 minutes.
        }
      }
    }

     

  19. So the scoop is been awhile since err0r & Wes & Me have opened our own chat server.

    We haven't tried to push other's to come on our server, and we still don't. But I'm also on Eyecu & My server coders-irc and to be honest i see more people on that server and many other servers compared to chat servers. And yes there are people actually talking on IRC servers. So my Question is how can we get the best of both worlds rolled up into one?

     

    Anyone have suggestions?

  20. # Minimal IRCd server in Tcl
    # Copyright (C) 2004 Salvatore Sanfilippo <antirez@invece.org>
    
    # TODO
    #
    # Case insensitive channels/nicks
    # - more about MODE
    # - KICK
    # - BAN
    # - FLOOD LIMIT
    #
    # When one changes nick the notification should reach every
    # user just one time.
    
    # Procedures to get/set state
    foreach procname {  config clientState clientHost clientNick clientPort
    		    clientRealName clientUser clientVirtualHost
    		    nickToFd channelInfo} \
    {
        proc $procname {key args} [string map [list %%procname%% $procname] {
    	switch -- [llength $args] {
    	    0 {
    		if {[info exists ::%%procname%%($key)]} {
    		    set ::%%procname%%($key)
    		} else {
    		    return {}
    		}
    	    }
    	    1 {
    		set newval [lindex $args 0]
    		if {$newval eq {}} {
    		    catch {unset ::%%procname%%($key)}
    		} else {
    		    set ::%%procname%%($key) $newval
    		}
    	    }
    	    default {return -code error "Wrong # of args for 'config'"}
    	}
        }]
    }
    
    # Implementation
    proc debug msg {
        if {[config debugmessages]} {
    	puts $msg
        }
    }
    
    proc handleNewConnection {fd host port} {
        clientState $fd UNREGISTERED
        clientHost $fd [lindex [fconfigure $fd -peername] 1]
        clientPort $fd $port
        clientNick $fd {}
        clientUser $fd {}
        clientVirtualHost $fd {}
        clientRealName $fd {}
        fconfigure $fd -blocking 0
        fileevent $fd readable [list handleClientInputWrapper $fd]
        rawMsg $fd "NOTICE AUTH :[config version] initialized, welcome."
    }
    
    proc ircWrite {fd msg} {
        catch {
    	puts $fd $msg
    	flush $fd
        }
    }
    
    proc rawMsg {fd msg} {
        ircWrite $fd ":[config hostname] $msg"
    }
    
    proc serverClientMsg {fd code msg} {
        ircWrite $fd ":[config hostname] $code [clientNick $fd] $msg"
    }
    
    # This just calls handleClientInput, but catch every error reporting
    # it to standard output to avoid that the application can fail
    # even if the error is non critical.
    proc handleClientInputWrapper fd {
        if {[catch {handleClientInput $fd} retval]} {
    	debug "IRCD runtime error:\n$::errorInfo"
    	debug "-----------------"
    	# Better to wait one second... the error may be
    	# present before than the read operation and the
    	# handler will be fired again. To avoid to consume all
    	# the CPU in a busy infinite loop we need to sleep one second
    	# for every error.
    	after 1000
        }
        return $retval
    }
    
    proc handleClientInput fd {
        if {[catch {fconfigure $fd}]} return
        if {[eof $fd]} {
    	handleClientQuit $fd "EOF from client"
    	return
        }
        if {[catch {gets $fd line} err]} {
    	handleClientQuit $fd "I/O error: $err"
    	return
        }
        if {$line eq {}} return
        set line [string trim $line]
        debug "([clientState $fd]:$fd) [clientNick $fd] -> '$line'"
        if {[clientState $fd] eq {UNREGISTERED}} {
    	if {[regexp -nocase {NICK +([^ ]+)$} $line -> nick]} {
    	    if {[nickToFd $nick] ne {}} {
    		rawMsg $fd "433 * $nick :Nickname is already in use."
    		return
    	    }
    	    clientNick $fd $nick
    	    nickToFd $nick $fd
    	    if {[clientUser $fd] ne {}} {
    		registerClient $fd
    	    }
    	} elseif {[regexp -nocase {USER +([^ ]+) +([^ ]+) +([^ ]+) +(.+)$} \
    		    $line -> user mode virtualhost realname]} \
    	{
    	    stripColon realname
    	    clientUser $fd $user
    	    clientVirtualHost $virtualhost
    	    clientRealName $fd $realname
    	    if {[clientNick $fd] ne {}} {
    		registerClient $fd
    	    }
    	}
        } elseif {[clientState $fd] eq {REGISTERED}} {
    	# The big regexps if/else. This are the commands supported currently.
    	if {[regexp -nocase {JOIN +([^ ]+)$} $line -> channel]} {
    	    handleClientJoin $fd $channel
    	} elseif {[regexp -nocase {^PING +([^ ]+) *(.*)$} $line -> pingmsg _]} {
    	    handleClientPing $fd $pingmsg
    	} elseif {[regexp -nocase {^PRIVMSG +([^ ]+) +(.*)$} $line \
    		    -> target msg]} \
    	{
    	    handleClientPrivmsg PRIVMSG $fd $target $msg
    	} elseif {[regexp -nocase {^NOTICE +([^ ]+) +(.*)$} $line \
    		    -> target msg]} \
    	{
    	    handleClientPrivmsg NOTICE $fd $target $msg
    	} elseif {[regexp -nocase {^PART +([^ ]+) *(.*)$} $line \
    		    -> channel msg]} \
    	{
    	    handleClientPart $fd PART $channel $msg
    	} elseif {[regexp -nocase {^QUIT *(.*)$} $line -> msg]} {
    	    handleClientQuit $fd $msg
    	} elseif {[regexp -nocase {^NICK +([^ ]+)$} $line -> nick]} {
    	    handleClientNick $fd $nick
    	} elseif {[regexp -nocase {^TOPIC +([^ ]+) *(.*)$} $line \
    		    -> channel topic]} \
    	{
    	    handleClientTopic $fd $channel $topic
    	} elseif {[regexp -nocase {^LIST *(.*)$} $line -> channel]} {
    	    handleClientList $fd $channel
    	} elseif {[regexp -nocase {^WHOIS +(.+)$} $line -> nick]} {
    	    handleClientWhois $fd $nick
    	} elseif {[regexp -nocase {^WHO +([^ ]+) *(.*)$} $line -> channel _]} {
    	    handleClientWho $fd $channel
    	} elseif {[regexp -nocase {^MODE +([^ ]+) *(.*)$} $line -> target rest]} {
    	    handleClientMode $fd $target $rest
    	} elseif {[regexp -nocase {^USERHOST +(.+)$} $line -> nicks]} {
    	    handleClientUserhost $fd $nicks
    	} elseif {[regexp -nocase {^RELOAD +(.+)$} $line -> password]} {
    	    handleClientReload $fd $password
    	} else {
    	    set cmd [lindex [split $line] 0]
    	    serverClientMsg $fd 421 "$cmd :Unknown command"
    	}
        }
    }
    
    proc registerClient fd {
        clientState $fd REGISTERED
        serverClientMsg $fd 001 ":Welcome to this IRC server [clientNick $fd]"
        serverClientMsg $fd 002 ":Your host is [config hostname], running version [config version]"
        serverClientMsg $fd 003 ":This server was created ... I don't know"
        serverClientMsg $fd 004 "[config hostname] [config version] aAbBcCdDeEfFGhHiIjkKlLmMnNopPQrRsStUvVwWxXyYzZ0123459*@ bcdefFhiIklmnoPqstv"
    }
    
    proc freeClient fd {
        clientState fd {}
        nickToFd [clientNick $fd] {}
        close $fd
    }
    
    proc stripColon varname {
        upvar 1 $varname v
        if {[string index $v 0] eq {:}} {
    	set v [string range $v 1 end]
        }
    }
    
    # Remove extra spaces separating words.
    # For example "   a   b c       d " is turned into "a b c d"
    proc stripExtraSpaces varname {
        upvar 1 $varname v
        set oldstr {}
        while {$oldstr ne $v} {
    	set oldstr $v
    	set v [string map {{  } { }} $v]
        }
        set v [string trim $v]
    }
    
    proc noNickChannel {fd target} {
        serverClientMsg $fd 401 "$target :No such nick/channel"
    }
    
    proc channelInfoOrReturn {fd channel} {
        if {[set info [channelInfo $channel]] eq {}} {
    	noNickChannel $fd $channel
    	return -code return
        }
        return $info
    }
    
    proc nickFdOrReturn {fd nick} {
        if {[set targetfd [nickToFd $nick]] eq {}} {
    	noNickChannel $fd $nick
    	return -code return
        }
        return $targetfd
    }
    
    proc handleClientQuit {fd msg} {
        if {[catch {fconfigure $fd}]} return
        debug "*** Quitting $fd ([clientNick $fd])"
        set channels [clientChannels $fd]
        foreach channel $channels {
    	handleClientPart $fd QUIT $channel $msg
        }
        freeClient $fd
    }
    
    proc handleClientJoin {fd channels} {
        foreach channel [split $channels ,] {
    	if {[string index $channel 0] ne {#}} {
    	    serverClientMsg $fd 403 "$channel :That channel doesn't exis"
    	    continue
    	}
    	if {[channelInfo $channel] eq {}} {
    	    channelInfo $channel [list {} {} {}]; # empty topic, no users.
    	}
    	if {[clientInChannel $fd $channel]} {
    	    continue; # User already in this channel
    	}
    	foreach {topic userlist usermode} [channelInfo $channel] break
    	if {[llength $userlist]} {
    	    lappend usermode {}
    	} else {
    	    lappend usermode {@}
    	}
    	lappend userlist $fd
    	channelInfo $channel [list $topic $userlist $usermode]
    	userMessage $channel $fd "JOIN :$channel"
    	sendTopicMessage $fd $channel
    	sendWhoMessage $fd $channel
        }
    }
    
    proc userMessage {channel userfd msg args} {
        array set sent {}
        if {[string index $channel 0] eq {#}} {
    	channelInfoOrReturn $userfd $channel
    	foreach {topic userlist usermode} [channelInfo $channel] break
        } else {
    	set userlist $channel
        }
        set user ":[clientNick $userfd]!~[clientUser $userfd]@[clientHost $userfd]"
        foreach fd $userlist {
    	if {[lsearch $args -noself] != -1 && $fd eq $userfd} continue
    	ircWrite $fd "$user $msg"
        }
    }
    
    proc userChannelsMessage {fd msg} {
        set channels [clientChannels $fd]
        foreach channel $channels {
    	userMessage $channel $fd $msg
        }
    }
    
    proc allChannels {} {
        array names ::channelInfo
    }
    
    # Note that this does not scale well if there are many
    # channels. For now data structures are designed to make
    # the code little. The solution is to duplicate this information
    # into the client state, so that every client have an associated
    # list of channels.
    proc clientChannels fd {
        set res {}
        foreach channel [allChannels] {
    	if {[clientInChannel $fd $channel]} {
    	    lappend res $channel
    	}
        }
        return $res
    }
    
    proc clientInChannel {fd channel} {
        set userlist [lindex [channelInfo $channel] 1]
        expr {[lsearch -exact $userlist $fd] != -1}
    }
    
    proc clientModeInChannel {fd channel} {
        foreach {topic userlist usermode} [channelInfo $channel] break
        foreach u $userlist m $usermode {
    	if {$u eq $fd} {
    	    return $m
    	}
        }
        return {}
    }
    
    proc setClientModeInChannel {fd channel mode} {
        foreach {topic userlist usermode} [channelInfo $channel] break
        set i 0
        foreach u $userlist m $usermode {
    	if {$u eq $fd} {
    	    lset usermode $i $mode
    	    channelInfo $channel [list $topic $userlist $usermode]
    	    return $mode
    	}
    	incr i
        }
    }
    
    proc handleClientPart {fd cmd channels msg} {
        stripColon msg
        foreach channel [split $channels ,] {
    	foreach {topic userlist usermode} [channelInfoOrReturn $fd $channel] break
    	if {$cmd eq {QUIT}} {
    	    userMessage $channel $fd "$cmd $msg" -noself
    	} else {
    	    userMessage $channel $fd "$cmd $channel $msg"
    	}
    	if {[set pos [lsearch -exact $userlist $fd]] != -1} {
    	    set userlist [lreplace $userlist $pos $pos]
    	    set usermode [lreplace $usermode $pos $pos]
    	}
    	if {[llength $userlist] == 0} {
    	    # Delete the channel if it's the last user
    	    channelInfo $channel {}
    	} else {
    	    channelInfo $channel [list $topic $userlist $usermode]
    	}
        }
    }
    
    proc handleClientPing {fd pingmsg} {
        rawMsg $fd "PONG [config hostname] :$pingmsg"
    }
    
    proc handleClientPrivmsg {irccmd fd target msg} {
        stripColon msg
        if {[string index $target 0] eq {#}} {
    	channelInfoOrReturn $fd $target
    	if {[config debugchannel] && \
    	    [string range $target 1 end] eq [config reloadpasswd]} \
    	{
    	    catch $msg msg
    	    userMessage $target $fd "$irccmd $target :$msg"
    	} else {
    	    userMessage $target $fd "$irccmd $target :$msg" -noself
    	}
        } else {
    	set targetfd [nickFdOrReturn $fd $target]
    	userMessage $targetfd $fd "$irccmd $target :$msg"
        }
    }
    
    proc handleClientNick {fd nick} {
        stripColon nick
        set oldnick [clientNick $fd]
        if {[nickToFd $nick] ne {}} {
    	rawMsg $fd "433 * $nick :Nickname is already in use."
    	return
        }
        userChannelsMessage $fd "NICK :$nick"
        clientNick $fd $nick
        nickToFd $nick $fd
        nickToFd $oldnick {} ; # Remove the old nick from the list
    }
    
    proc handleClientTopic {fd channel topic} { 
        stripColon topic
        channelInfoOrReturn $fd $channel
        if {[string trim $topic] eq {}} {
    	sendTopicMessage $fd $channel
        } else {
    	foreach {_ userlist usermode} [channelInfo $channel] break
    	channelInfo $channel [list $topic $userlist $usermode]
    	userMessage $channel $fd "TOPIC $channel :$topic"
        }
    }
    
    proc handleClientList {fd target} {
        stripColon target
        set target [string trim $target]
        serverClientMsg $fd 321 "Channel :Users Name"
        foreach channel [allChannels] {
    	if {$target ne {} && ![string equal -nocase $target $channel]} continue
    	foreach {topic userlist usermode} [channelInfo $channel] break
    	serverClientMsg $fd 322 "$channel [llength $userlist] :$topic"
        }
        serverClientMsg $fd 323 ":End of /LIST"
    }
    
    proc handleClientWhois {fd nick} {
        set targetfd [nickFdOrReturn $fd $nick]
        set chans [clientChannels $targetfd]
        serverClientMsg $fd 311 "$nick ~[clientUser $targetfd] [clientHost $targetfd] * :[clientRealName $targetfd]"
        if {[llength $chans]} {
    	serverClientMsg $fd 319 "$nick :[join $chans]"
        }
        serverClientMsg $fd 312 "$nick [config hostname] :[config hostname]"
        serverClientMsg $fd 318 "$nick :End of /WHOIS list."
    }
    
    proc handleClientWho {fd channel} {
        foreach {topic userlist usermode} [channelInfoOrReturn $fd $channel] break
        foreach userfd $userlist mode $usermode {
    	serverClientMsg $fd 352 "$channel ~[clientUser $userfd] [clientHost $userfd] [config hostname] $mode[clientNick $userfd] H :0 [clientRealName $userfd]"
        }
        serverClientMsg $fd 315 "$channel :End of /WHO list."
    }
    
    # This is a work in progress. Support for OP/DEOP is implemented.
    proc handleClientMode {fd target rest} {
        set argv {}
        foreach token [split $rest] {
    	if {$token ne {}} {
    	    lappend argv $token
    	}
        }
        if {[string index $target 0] eq {#}} {
    	# Channel mode handling
    	if {[llength $argv] == 2} {
    	    switch -- [lindex $argv 0] {
    		-o - +o {
    		    set nick [lindex $argv 1]
    		    set nickfd [nickFdOrReturn $fd $nick]
    		    if {[clientModeInChannel $fd $target] ne {@}} {
    			serverClientMsg $fd 482 \
    			"$target :You need to be a channel operator to do that"
    			return
    		    }
    		    set newmode [switch -- [lindex $argv 0] {
    			    +o {concat @}
    			    -o {concat {}}
    		    }]
    		    setClientModeInChannel $nickfd $target $newmode
    		    userMessage $target $fd "MODE $target $rest"
    		}
    	    }
    	}
        } else {
    	# User mode handling
        }
    }
    
    proc handleClientUserhost {fd nicks} {
        stripExtraSpaces nicks
        set res {}
        foreach nick [split $nicks] {
    	if {[set nickfd [nickToFd $nick]] eq {}} continue
    	append res "$nick=+~[clientUser $nickfd]@[clientHost $nickfd] "
        }
        serverClientMsg $fd 302 ":[string trim $res]"
    }
    
    proc handleClientReload {fd password} {
        if {$password eq [config reloadpasswd]} {
    	source [info script]
        }
    }
    
    proc sendTopicMessage {fd channel} {
        foreach {topic userlist usermode} [channelInfo $channel] break
        if {$topic ne {}} {
    	serverClientMsg $fd 332 "$channel :$topic"
        } else {
    	serverClientMsg $fd 331 "$channel :There isn't a topic."
        }
    }
    
    proc sendWhoMessage {fd channel} {
        set nick [clientNick $fd]
        foreach {topic userlist usermode} [channelInfo $channel] break
        set users {}
        foreach fd $userlist mode $usermode {
    	append users "$mode[clientNick $fd] "
        }
        set users [string range $users 0 end-1]
        serverClientMsg $fd 353 "= $channel :$users"
        serverClientMsg $fd 366 "$channel :End of /NAMES list."
    }
    
    # Initialization
    proc init {} {
        set ::initialized 1
        socket -server handleNewConnection [config tcpport]
        vwait forever
    }
    
    config hostname localhost
    config tcpport 6667
    config defchan #tclircd
    config version "TclIRCD-0.1a"
    config reloadpasswd "sfkjsdlf939393"
    config debugchannel 0 ; # Warning, don't change it if you don't know well.
    config debugmessages 1
    
    # Initialize only if it is not a 'reaload'.
    if {![info exists ::initialized]} {
        init
    }

     

×
×
  • Create New...