aIRC — File Browser
aIRCv0.8.69 / aIRCv0.8.69 / script / partyline1.mrc
partyline1.mrc — 12.93 KB — Download this file
;/**********************************************************************
; *
; * aIRC
; * Partyline (events)
; *
; **********************************************************************/
#_udccchat off
CTCP &*:DCC CHAT:?:{
if (%+dcc.badcc == $null) && ($nick != $me) && (p isincs %++flags) && ($_userpass(%++handle) != $null) {
var %max = $_getsetup(script,max-dcc)
if ($_isint(%max)) && ($sock(partyline*.*.*,0) >= %max) { return }
var %i = 0,%s,%m
while (1) {
inc %i
%s = partyline $+ %i $+ . $+ %++handle $+ ._
%m = partyline $+ %i $+ .*._*
if ($sock(%m,0) == 0) { break }
}
sockopen %s $longip($4) $5
sockmark %s 0 $+ $chr(9) $+ %++handle $+ $chr(9) $+ %++handle $+ $chr(9) $+ $null $+ $chr(9) $+ $null $+ $chr(9) $+ bcruag $+ $chr(9) $+ dcc $+ $chr(9) $+ $gettok($address,1,64) $+ $chr(9) $+ _e
halt
}
}
#_udccchat end
ON *:SOCKCLOSE:partyline*.*._*:{
var %handle = $_pls.get($sockname,handle)
if (%handle == $null) { .timer -mo 1 0 _partyline.display o m * t * Lost telnet connection to $_pls.get($sockname,ident) $+ @ $+ $sock($sockname).ip $+ / $+ $sock($sockname).port }
else {
.timer -mo 1 0 _partyline.display o m * t * Lost dcc connection to %handle ( $+ $sock($sockname).ip $+ / $+ $sock($sockname).port $+ )
.timer -mo 1 100 _partyline.display * * * * * %handle lost dcc link.
}
}
ON *:SOCKOPEN:partyline*.*._*:{
if ($sockerr) {
error.a Partyline $remove($sockname,partyline) $+ : $_sockerr
return
}
_plsw Enter your password.
var %i = $remove($gettok($sockname,1,46),partyline)
.timer_PARTYLINETIMEOUT $+ %i -o 1 $_getsetup(script,connect-timeout) _partylinetimeout.login %i
}
ON *:SOCKLISTEN:partyline:{
var %i = 0,%s,%m,%tf = $_getsetup(script,telnet-flood),%ip,%port,%address = telnet!telnet@ip
while (1) {
inc %i
%s = partyline $+ %i $+ .$null._
%m = partyline $+ %i $+ .*._*
if ($sock(%m,0) == 0) { break }
}
sockaccept %s
var %ip = $sock(%s).ip,%port = $sock(%s).port,%address = telnet!telnet@ $+ %ip,%flags = $_maskflags(%address),%max-dcc = $_getsetup(script,max-dcc)
if ($_isint(%max-dcc)) && ($sock(partyline*.*.*,0) >= %max-dcc) {
sockwrite %s Sorry, too many connections already. $+ $cr $+ $crlf
sockclose %s
return
}
if (%port < 1024) || (%port > 65535) {
_putloglev b * Refused %ip $+ / $+ %port (bad src port)
sockclose %s
return
}
if (127.* iswm %ip) || (*.255 iswm %ip) || (*.0 iswm %ip) {
_putloglev b * Refused %ip $+ / $+ %port (invalid ip)
sockclose %s
return
}
if ($ignore(%address)) {
sockclose %s
return
}
var %tf1 = $gettok(%tf,1,58),%tf2 = $gettok(%tf,2,58)
if ($_not($_isint(%tf1))) || ($_not($_isint(%tf2))) || ((f isincs %flags) && ($_not($_getsetup(script,paranoid-telnet-flood)))) { }
else {
_flood.main 1 0 %tf1 0 %tf2 Ø_partylinesocklisten_ $+ %address 0
if ($result) {
_putlog Telnet connection flood from %address $+ ! Placing on ignore!
+ignore -u $+ $calc($_getsetup(script,ignore-time) * 60) %address Telnet connection flood
sockclose %s
return
}
}
if ($_getsetup(script,use-telnet-banner)) {
var %file = $_usrdir(partyline.banner),%win = @__banner,%filet = $_tmpdir(banner.tmp),%strip = $_pls.get(%s,strip)
if ($isfile(%file)) {
_openwins %win
loadbuf %win $"(%file)
_eggtext.parse $null 1 %win %filet
if ($file(%filet).size) { _plfile2sock %s $iif(%strip,%strip,$null) %filet }
_remove %filet
}
}
_putlog Telnet connection: %ip $+ / $+ %port
if ($_getsetup(script,stealth-telnets)) { sockwrite %s $crlf $+ Nickname. $+ $crlf }
else { sockwrite %s $cr $+ $crlf $+ $cr $+ $crlf $+ $crlf $+ $me ( $+ aIRC v $+ $_vers $+ +win $+ $bits (c)1997-2001 tabo) $+ $crlf $+ Please enter your nickname. $+ $crlf }
if ($_getsetup(script,open-telnets)) { sockwrite %s (If you are new, enter 'NEW' here.) $+ $cr $+ $crlf }
sockmark %s 0 $+ $chr(9) $+ $null $+ $chr(9) $+ $null $+ $chr(9) $+ $null $+ $chr(9) $+ $null $+ $chr(9) $+ bcruag $+ $chr(9) $+ telnet $+ $chr(9) $+ telnet $+ $chr(9) $+ _e
.timer_PARTYLINETIMEOUT $+ %i -o 1 $_getsetup(script,connect-timeout) _partylinetimeout.login %i
}
ON *:SOCKWRITE:partyline*.*._*:{
if ($sockerr) {
if ($null isin $sockname) { info.a Seems that somebody is portscanning the partyline port from $sock($sockname).ip }
else { error.a Partyline $remove($sockname,partyline) $+ : $_sockerr }
}
}
ON *:SOCKREAD:partyline*.*._*:{
if ($sockerr) {
error.a Partyline $remove($sockname,partyline) $+ : $_sockerr
return
}
var %s
sockread %s
while ($sockbr) {
%s = $_parsetelnet(%s)
if (%s != $null) { _partyline.sr %s }
if ($sockname == $null) { break }
sockread %s
}
}
alias _partylinetimeout.login {
var %m = partyline $+ $1 $+ .*,%s
if ($sock(%m,1)) {
%s = $ifmatch
_pl.swcrlf %s Guess you're not there. Bye.
if ($_sockmark(%s,2) != $null) { _putlog Timeout on new telnet user: [[ $+ $ifmatch $+ ]] $+ $_pls.get(%s,ident) $+ @ $+ $sock(%s).ip $+ / $+ $sock(%s).port }
else { _putlog Timeout on new telnet user: $_pls.get(%s,ident) $+ @ $+ $sock(%s).ip $+ / $+ $sock(%s).port }
sockclose %s
}
}
alias _partylinetimeout.pass {
var %m = partyline $+ $1 $+ .*,%s
if ($sock(%m,1)) {
%s = $ifmatch
_pl.swcrlf %s Timeout.
_putlog Password timeout on dcc chat: [[ $+ $_sockmark(%s,2) $+ ]] $+ $_pls.get(%s,ident) $+ @ $+ $sock(%s).ip
sockclose %s
}
}
alias _partyline.sr {
var %handle = $_sockmark(2),%session = $remove($gettok($sockname,1,46),partyline),%flood = $_getsetup(script,dcc-flood-thr),%ip = $sock($sockname).ip,%tmp,%echo
.timer_PARTYLINETIMEOUT $+ %session off
if ($_not($_sockmark(1))) {
if (%flood) {
_flood.main 1 0 %flood 0 1 Ø_partylinechat_ $+ %session 0
if ($result) {
_plsw *** FLOOD: Goodbye
sockclose $sockname
_partyline.display @ * * * * *** %ip has been forcibly removed for flooding.
return
}
}
if (%handle == $null) {
var %handle = $1-,%flags = $_nickflags(%handle)
if (%handle == new) && ($_getsetup(script,open-telnets)) {
_plsw $cr $+ $crlf $+ This is the telnet interface to $me $+ .
_plsw Don't abuse it, and it will be open for all your friends, too.
_plsw You now get to pick a nick to use on the bot,
_plsw and a password so nobody else can pretend to be you.
_plsw Please remember both!
_plsw Enter the nickname you would like to use.
%tmp = _n $+ $removecs($_sockmark(9),_,n)
sockmark $sockname $puttok($puttok($puttok($sock($sockname).mark,%handle,2,9),%handle,3,9),%tmp,9,9)
_sockrename $sockname $puttok($sockname,%handle,2,46)
.timer_PARTYLINETIMEOUT $+ %session -o 1 $_getsetup(script,connect-timeout) _partylinetimeout.login %session
}
elseif ((o isincs %flags) && ($_not($_getsetup(script,require-p)))) || (p isincs %flags) {
if ($_userpass(%handle) == $null) {
_plsw Can't telnet until you have a password set. $+ $cr
_putlog Refused [[ $+ %handle $+ ]] $+ %ip (no password)
sockclose $sockname
}
else {
_plsw $crlf $+ Enter your password. $+ $chr(255) $+ $chr(251) $+ $chr(1)
sockmark $sockname $puttok($puttok($sock($sockname).mark,%handle,2,9),%handle,3,9)
_sockrename $sockname $puttok($sockname,%handle,2,46)
.timer_PARTYLINETIMEOUT $+ %session -o 1 $_getsetup(script,connect-timeout) _partylinetimeout.pass %session
}
}
else {
_plsw You don't have access. $+ $cr
_putlog Refused %ip (invalid handle: %handle $+ )
sockclose $sockname
}
}
elseif ($_pls.get($sockname,newuser)) {
if (%handle == new) {
if ($_isinvalidinitialchar4handle($1-)) {
_plsw You can't start your nick with the character ' $+ $left($1,1) $+ '
_plsw Try another one please:
}
elseif ($_not($_isvalidhandle($1-))) {
_plsw You can't use weird symbols in your nick.
_plsw Try another one please:
}
elseif ($_isuser($1)) {
_plsw Sorry, that nickname is taken already.
_plsw Try another one please:
}
elseif ($1 == $me) { _plsw Sorry, can't use my name for a nick. }
else {
_plsw Okay, now choose and enter a password:
sockmark $sockname $puttok($sock($sockname).mark,$1,2,9)
}
.timer_PARTYLINETIMEOUT $+ %session -o 1 $_getsetup(script,connect-timeout) _partylinetimeout.pass %session
}
elseif ($len($1) < 4) {
_plsw Try to use at least 4 characters in your password.
_plsw Choose and enter a password:
.timer_PARTYLINETIMEOUT $+ %session -o 1 $_getsetup(script,connect-timeout) _partylinetimeout.pass %session
}
elseif ($_not($_isvalidhandle($1,ignorefirstcharacter))) {
_plsw You can't use weird symbols in your password.
_plsw Try another one please:
.timer_PARTYLINETIMEOUT $+ %session -o 1 $_getsetup(script,connect-timeout) _partylinetimeout.pass %session
}
else {
_putlog New user via telnet: [[ $+ %handle $+ ]] $+ $_pls.get($sockname,ident) $+ @ $+ %ip $+ / $+ $sock($sockname).port
if ($_getsetup(script,notify-newusers) != $null) {
var %i = 1,%notify = $replace($ifmatch,$chr(32),$chr(44)),%n = $numtok(%notify,44)
while (%i <= %n) {
_cmd.note $null $gettok(%notify,%i,44) introduced to %handle $+ , %ip
inc %i
}
}
_dummy $_creatinguser(%handle,$null,$_changemodes($_getsetup(script,default-flags),+p),$1)
_plsw Remember that! You'll need it next time you log in.
_plsw You now have an account on $me $+ ... $+ $cr $+ $crlf $+ $cr $+ $crlf
sockmark $sockname $puttok($puttok($sock($sockname).mark,%handle,2,9),%handle,3,9)
_sockrename $sockname $puttok($sockname,%handle,2,46)
_partyline.welcome %handle
}
}
elseif ($1- != $null) && ($_passwdok(%handle,$1-)) {
_putlog Logged in: %handle ( $+ %ip $+ / $+ $sock($sockname).port $+ )
_partyline.welcome %handle
}
else {
_plsw Negative on that, Houston.
_putlog Bad Password: [[ $+ %handle $+ ]] $+ %ip $+ / $+ $sock($sockname).port
if (%handle == $_sockmark(3)) { sockclose $sockname }
else {
_partyline.show join $_sockmark(3)
sockmark $sockname $puttok($puttok($sock($sockname).mark,1,1,9),$_sockmark(3),2,9)
var %l = _l $+ $removecs($gettok($sockname,3,46),_,l)
_sockrename $sockname $puttok($puttok($sockname,$_sockmark(3),2,46),%l,3,46)
}
}
}
else {
var %flags = $_nickflags(%handle)
if ($_not($_isint(%flood))) || ((f isincs %flags) && ($_not($_getsetup(script,paranoid-telnet-flood)))) { }
else {
_flood.main 1 0 %flood 0 1 Ø_partylinechat_ $+ %session 0
if ($result) {
_plsw *** FLOOD: Goodbye
sockclose $sockname
_partyline.display @ * * * * *** %handle has been forcibly removed for flooding.
return
}
}
if (.* iswm $1) { _partyline.parse $_inputcom(.,$1) $2- }
else {
if (e isincs $_sockmark(9)) { %echo = * }
else { %echo = %session }
if ($_sockmark(5)) { _cmd.back %handle }
if ($sock(partyline*.*._l@*,0)) {
if (,* iswm $1-) && ((m isincs %flags) || (n isincs %flags)) {
if ($1 == ,me) && ($2- != $null) { _partyline.display * m * * %echo -> %handle $2- }
else { _partyline.display * m * * %echo - $+ %handle $+ -> $right($1-,-1) }
}
else { _partyline.display @ * * * %echo < $+ %handle $+ > $1- }
}
}
}
}
alias _partyline.parse {
var %com = $1,%nick = $_sockmark(2),%echo
tokenize 32 $2-
unset %~plparse.*
if ($_sockmark(4) != $null) { set -u1 %~plparse.cchan $ifmatch }
if ($istok($_getsetup(script,_partyline.commands),%com,32) == $false) { _plsw What? You need '.help' }
elseif (%com == me) {
if ($len($1-) == 0) { _plsw Usage: .me <action> }
else {
if ($_pls.get($sockname,newuser)) { %echo = * }
else { %echo = %session }
if ($_sockmark(5)) { _cmd.back $_sockmark(2) }
_partyline.display @ * * * * %echo %nick $1-
}
}
elseif (%com == quit) {
_plsw *** Ja mata!
_partyline.show left %nick $1-
sockclose $sockname
}
else {
var %alias = _cmd. $+ %com
if ($isalias(%alias)) {
%alias %nick $1-
_useredit.sw $result
}
elseif (ch* iswm %com) && ($istok($_getsetup(script,userinfo-fields),$right(%com,-2),32)) { _useredit.sw $_chuserinfo(%nick,$right(%com,-2),%com,$1,$2-) }
elseif ($istok($_getsetup(script,userinfo-fields),%com,32)) { _useredit.sw $_setuserinfo(%nick,%com,$1-) }
else { _plsw What? You need '.help' }
}
}