BlackTools.tcl 402 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637
  1. ###########################################################################
  2. # ® BLaCkShaDoW ProductionS ® #
  3. # #
  4. # Presents #
  5. #### # #### ##### # # ##### ##### #### # #####
  6. # # # # # # # # # # # # # # #
  7. # # # # # # # # # # # # # # #
  8. ## # # ###### # ## # # # # # # #####
  9. # # # # # # # # # # # # # # #
  10. # # # # # # # # # # # # # # #
  11. #### ##### # # ##### # # # ##### #### ##### #####
  12. # #
  13. # #
  14. # ##### ##### #
  15. # # # #
  16. # # # #
  17. # #### ##### #
  18. # # # #
  19. # # # #
  20. # ##### # ##### #
  21. # #
  22. # #
  23. # THE NEXT GENERATION TCL #
  24. # #
  25. # - #TCL-HELP @ UNDERNET - WwW.TclScripts.Net - #
  26. ###########################################################################
  27. #A Next Generation Channel Control Script that contains a lot of commands #
  28. #modules, and protections that make`s your life easy for you and for your #
  29. # Eggdrop. #
  30. ###########################################################################
  31. # #
  32. # Many thanks for without this script wouldn't got this far to: #
  33. # #
  34. # Time2Go@Oradea(#Bihor Admin) #
  35. # #
  36. # Offcourse i thanks all the users who participate with ideas, #
  37. # opinions, which took the script to this version. #
  38. # #
  39. # cola @ #Tcl-Help btw @ #ialomita #
  40. # #
  41. # Cacique @ #mures bandyt @ #bandyt #
  42. # #
  43. ###########################################################################
  44. #
  45. #Please specify the folder name that contains the BlackTools.tcl and the lang
  46. #folder (Default "scripts")
  47. #
  48. set black(dirname) "scripts"
  49. #
  50. ###########################################################################
  51. #First Char ( "- . !" ) - ( "none" ) (for no char)
  52. #
  53. set black(cmdchar) ". !"
  54. #
  55. ###########################################################################
  56. #-------------------------- Default Language -----------------------------#
  57. #Default language ( RO / EN )
  58. set black(default_lang) "RO"
  59. #-------------------------------------------------------------------------#
  60. #----------------------------- Max Handle --------------------------------#
  61. #Max Handle ( 1 - for handle < 9 ; 0 - for handle > 9 )
  62. set black(maxhand) "0"
  63. #-------------------------------------------------------------------------#
  64. #######################################################################
  65. # #
  66. # Command Help - h - Command Help #
  67. # #
  68. #######################################################################
  69. #---------------------------------------------------------------------#
  70. #######################################################################
  71. # Chanserv Name
  72. #
  73. set black(chanserv) "X"
  74. #
  75. #######################################################################
  76. #---------------------------------------------------------------------#
  77. #######################################################################
  78. # #
  79. #---------------------------------------------------------------------#
  80. # #
  81. #######################################################################
  82. #------------------------- Chanserv Login ----------------------------#
  83. #Login On Connect ( 1 - ON ; 0 - OFF)
  84. set black(logonconect) "1"
  85. #------------------------- Chanserv User ----------------------------##
  86. set black(username) "username"
  87. #------------------------- Chanserv Pass ----------------------------##
  88. set black(password) "password"
  89. #------------------------- Login Command ----------------------------##
  90. set black(login) "PRIVMSG x@channels.undernet.org :login $black(username) $black(password)"
  91. #--------------------------- Login Mode ------------------------------##
  92. set black(xmod) "+x"
  93. #######################################################################
  94. # #
  95. #---------------------------------------------------------------------#
  96. # #
  97. #######################################################################
  98. #---------------------------------------------------------------------#
  99. ################################# add #################################
  100. #
  101. # add <level> <user> (level : manager,admin,senior,op voice)
  102. #
  103. #######################################################################
  104. #Default Hostname for - add <user> command -
  105. set black(hostadd) "*!*@%user%.users.undernet.org"
  106. #######################################################################
  107. #
  108. #
  109. # Protection
  110. #
  111. #
  112. #
  113. #######################################################################
  114. #Op Protect (1 - ON ; 0 - OFF)
  115. set black(vprotect) "1"
  116. #VOICE Protect (1 - ON ; 0 - OFF)
  117. set black(oprotect) "1"
  118. #######################################################################
  119. #
  120. # Antipub Protection
  121. #
  122. #
  123. #
  124. #######################################################################
  125. #Ban-Time
  126. set black(antipubbantime) "2880"
  127. #Words
  128. set black(antipubword) {
  129. "*#*"
  130. "*www.*"
  131. "*http://*"
  132. "*.ro"
  133. "*.com"
  134. "*/server*"
  135. }
  136. #Ban-Mode
  137. set black(antipubmode) "m"
  138. #Ban-mode Time (Seconds)
  139. set black(antipubsecunde) "5"
  140. #######################################################################
  141. #
  142. # AntiNotice Protection
  143. #
  144. #
  145. #######################################################################
  146. #Ban-Time
  147. set black(antinoticebantime) "2880"
  148. #Ban-Mode
  149. set black(antinoticemode) "mr"
  150. #Ban-mode Time (Seconds)
  151. set black(antinoticesecunde) "7"
  152. #######################################################################
  153. #
  154. # AntiCTCP Protection
  155. #
  156. #
  157. #######################################################################
  158. #Ban-Time
  159. set black(antictcpbantime) "2880"
  160. #Ban-Mode
  161. set black(antictcpmode) "mr"
  162. #Ban-mode Time (Seconds)
  163. set black(antictcpsecunde) "8"
  164. #######################################################################
  165. #
  166. # AntiBadWord Protection
  167. #
  168. #
  169. #######################################################################
  170. #Ban-Time
  171. set black(antibadwordbantime) "360"
  172. #Words
  173. set black(antibadword) {
  174. "*pula*"
  175. "*pizda*"
  176. "*muie*"
  177. "*sugi"
  178. "mwie"
  179. "*pwla*"
  180. "*muisti*"
  181. "*fut*"
  182. "*fwt*"
  183. "tarfa"
  184. }
  185. #######################################################################
  186. #
  187. # AntiLongText Protection
  188. #
  189. #
  190. #######################################################################
  191. #Char length
  192. set black(longchar) "400"
  193. #Ban-Time
  194. set black(longbantime) "30"
  195. #Ban-Mode
  196. set black(longmode) "mr"
  197. #Ban-mode Time (Seconds)
  198. set black(longtimemode) "10"
  199. #######################################################################
  200. #
  201. # AntiBAdQuitPart Protection
  202. #
  203. #
  204. #######################################################################
  205. #Ban-Time
  206. set black(badquitparttime) "60"
  207. #Words
  208. set black(badquitpartwords) {
  209. "*www.*"
  210. "*http://*"
  211. "*#*"
  212. }
  213. #Ban on COLORS (1 - ON ; 0 - OFF)
  214. set black(badquitpartcolour) "1"
  215. #######################################################################
  216. #
  217. # Protectia AntiJoinPart
  218. #
  219. #
  220. #######################################################################
  221. #Ban-Time
  222. set black(joinpartbantime) "30"
  223. #Stay-Time
  224. set black(joinparttime) "2"
  225. #Ban-Mode
  226. set black(joinpartmode) "mr"
  227. #Ban-Mode Time (Seconds)
  228. set black(joinparttimemode) "10"
  229. #######################################################################
  230. #
  231. # AntiSpam Protection
  232. #
  233. #
  234. #######################################################################
  235. #Ban-Time
  236. set black(spamban) "2880"
  237. #Words
  238. set black(spamword) {
  239. "*#*"
  240. "*www.*"
  241. "*http://*"
  242. }
  243. #Cycle-Time
  244. set black(spamcycle) "30"
  245. #ON-JOIN Message ( 1 - ON ; 0 - OFF)
  246. set black(spamreq) "1"
  247. #Part Message
  248. set black(spammsgcycle) "Checking for spam.."
  249. #######################################################################
  250. #
  251. # AntiRepeat Protection
  252. #
  253. #
  254. #######################################################################
  255. #Repeat Setting (number repeats:seconds)
  256. set black(repeats) "3:5"
  257. #Ban-Type (1 - KICK -> BAN ; 0 - BAN )
  258. set black(antirepeattype) "1"
  259. #Ban-Time
  260. set black(antirepeatbantime) "10"
  261. #######################################################################
  262. #
  263. # Anticolor Protection
  264. #
  265. #
  266. #######################################################################
  267. #Ban-Type (1 - KICK -> BAN ; 0 - BAN )
  268. set black(anticolortype) "1"
  269. #Ban-Time
  270. set black(anticolorbantime) "10"
  271. #######################################################################
  272. #
  273. # AntiBold Protection
  274. #
  275. #
  276. #######################################################################
  277. #Ban-Type (1 - KICK -> BAN ; 0 - BAN )
  278. set black(antiboldtype) "1"
  279. #Ban-Time
  280. set black(antiboldbantime) "10"
  281. #######################################################################
  282. #
  283. # AntiUnderline Protection
  284. #
  285. #
  286. #######################################################################
  287. #Ban-Type (1 - KICK -> BAN ; 0 - BAN )
  288. set black(antiunderlinetype) "1"
  289. #Ban-Time
  290. set black(antiunderlinebantime) "10"
  291. #######################################################################
  292. #
  293. # AntiCaps Protection
  294. #
  295. #
  296. #######################################################################
  297. #Ban-Type (1 - KICK -> BAN ; 0 - BAN )
  298. set black(anticapstype) "1"
  299. #Caps Char Length
  300. set black(anticapscount) "40"
  301. #Ban-Time
  302. set black(anticapsbantime) "10"
  303. #######################################################################
  304. #
  305. # BadFullName Protection
  306. #
  307. #
  308. #######################################################################
  309. #Ban-Time
  310. set black(badfbantime) "60"
  311. #Words
  312. set black(badfwords) {
  313. "*www.*"
  314. "*#*"
  315. "*http://*"
  316. }
  317. #######################################################################
  318. #
  319. # BadNick Protection
  320. #
  321. #
  322. #######################################################################
  323. #Ban-Time
  324. set black(badnickbantime) "60"
  325. #Words
  326. set black(badnickwords) {
  327. "*pula*"
  328. "*muie *"
  329. "pwla*"
  330. "pizda*"
  331. "laba*"
  332. }
  333. #######################################################################
  334. #
  335. # BadIdent Protection
  336. #
  337. #
  338. #######################################################################
  339. #Ban-Time
  340. set black(badidentbantime) "60"
  341. #Words
  342. set black(badidentwords) {
  343. "*pula*"
  344. "*muie *"
  345. "pwla*"
  346. "pizda*"
  347. "laba*"
  348. }
  349. #######################################################################
  350. #
  351. # AntiJoinFlood Protection
  352. #
  353. #
  354. #######################################################################
  355. #Join-Mode
  356. set black(modes) "mir"
  357. #Join-Mode Time (Seconds)
  358. set black(nomodetime) "15"
  359. #Op ALERT (1 - ON ; 0 - OFF)
  360. set black(fjoinhow) "1"
  361. #######################################################################
  362. #
  363. # AntiChanFlood Protection
  364. #
  365. #
  366. #######################################################################
  367. #Ban-Type (1 - KICK -> BAN ; 0 - BAN )
  368. set black(antifloodchantype) "1"
  369. #Ban-Time
  370. set black(antifloodchanbantime) "10"
  371. #######################################################################
  372. #
  373. # Module
  374. #
  375. #
  376. #######################################################################
  377. #######################################################################
  378. #
  379. # Topic refresh
  380. #
  381. #
  382. #######################################################################
  383. #Refresh Time
  384. set black(topic_time) "60"
  385. #Standard Topic
  386. set black(topics) "Reloading topic..."
  387. ########################################################################
  388. #
  389. # Count
  390. #
  391. # count <on> / <off> / <display> / <reset>
  392. #
  393. #######################################################################
  394. #MSg Type ( 1 - NOTICE ; 0 - PRIVMSG )
  395. set black(counthow) "1"
  396. #######################################################################
  397. #
  398. # BadChan
  399. #
  400. # badchan | <on> | <off> | add | del | | list |
  401. #
  402. #######################################################################
  403. #Ban-Time
  404. set black(badcbantime) "360"
  405. #User Message ( 1 - ON ; 0 - OFF)
  406. set black(badcwhyreason) "1"
  407. ########################################################################
  408. #
  409. # Anunt
  410. #
  411. # Anunt <on> | <off> | <add> | <list> | <del>
  412. #
  413. #######################################################################
  414. #Anunt Time ( 60 min max )
  415. set black(anunttime) "45"
  416. #MSg Type ( 1 - ACTION ; 0 - PRIVMSG )
  417. set black(anunthow) "0"
  418. ########################################################################
  419. #
  420. # AutoBroadcast
  421. #
  422. # bt <on> | <off> | <add> | <list> | <del>
  423. #
  424. #######################################################################
  425. #BRoadcast Time
  426. set black(bttime) "60"
  427. #MSg Type ( 1 - ACTION ; 0 - PRIVMSG )
  428. set black(bthow) "1"
  429. #######################################################################
  430. #
  431. # CloneScan
  432. #
  433. #
  434. #######################################################################
  435. #Max Clones
  436. set black(maxclone) "2"
  437. #Ban-Type ( 0 - OP Message ; 1 - Ban )
  438. set black(what) "0"
  439. #Ban-Time
  440. set black(clonebtime) "180"
  441. #######################################################################
  442. #
  443. # AntiBoTidle
  444. #
  445. #
  446. #######################################################################
  447. #Random Object
  448. set black(noobject) "blacky:P"
  449. #Max Idle
  450. set black(noidlemax) "10"
  451. #######################################################################
  452. #
  453. # Seen
  454. #
  455. # seen <host> / <nick>
  456. #
  457. #######################################################################
  458. #Flood-Protection (searches : seconds)
  459. set black(seenflood) "4:5"
  460. #MSg Type ( 1 - NOTICE ; 0 - PRIVMSG )
  461. set black(seenmet) "1"
  462. ########################################################################
  463. #
  464. # Greet
  465. #
  466. # greet <on> | <off> | <add> | <list> | <del>
  467. #
  468. #######################################################################
  469. #MSg Type ( 1 - NOTICE ; 0 - PRIVMSG )
  470. set black(howgreet) "1"
  471. ########################################################################
  472. #
  473. # Leave
  474. #
  475. # leave <on> | <off> | <add> | <list> | <del>
  476. #
  477. #######################################################################
  478. #MSg Type ( 1 - NOTICE ; 0 - PRIVMSG )
  479. set black(howleave) "0"
  480. ########################################################################
  481. #
  482. # idle
  483. #
  484. #
  485. # idle <on> | <off> | voice <on>/<off> | op <on>/<off> | add <nick>
  486. #
  487. #######################################################################
  488. #Idle Scan Time
  489. set black(idleinterval) "60"
  490. #Op max idle
  491. set black(idleopmax) "30"
  492. #Voice idle Max
  493. set black(idlevoicemax) "60"
  494. ########################################################################
  495. #
  496. # Private
  497. #
  498. #
  499. # private <on> | <off> | <add> <user> | <list> | del <nume>
  500. #
  501. #######################################################################
  502. #Ban-Time
  503. set black(privatebantime) "10"
  504. #######################################################################
  505. #
  506. #
  507. # Commands
  508. #
  509. #
  510. #######################################################################
  511. #######################################################################
  512. #
  513. # dr <nick> / <host>
  514. #
  515. #######################################################################
  516. #Ban-Time
  517. set black(drtime) "20160"
  518. #######################################################################
  519. #
  520. # bot <nick> / <host>
  521. #
  522. #######################################################################
  523. #Ban-Time
  524. set black(bottime) "10160"
  525. ########################################################################
  526. #
  527. # b <nick> / <host>
  528. #
  529. #######################################################################
  530. #Ban-Time
  531. set black(btime) "2880"
  532. #######################################################################
  533. #
  534. # n <nick>
  535. #
  536. #######################################################################
  537. #Ban-Time
  538. set black(ntime) "120"
  539. ######################################################################
  540. #
  541. # id <nick>
  542. #
  543. ######################################################################
  544. #Ban-Time
  545. set black(idtime) "120"
  546. ######################################################################
  547. #
  548. # spam <nick> / <host> (pentru spammeri)
  549. #
  550. ######################################################################
  551. #Ban-Time
  552. set black(spamtime) "10080"
  553. ######################################################################
  554. #
  555. # k <nick> <reason>
  556. #
  557. ######################################################################
  558. #Access Except ( 1 - ON ; 0 - OFF )
  559. set black(kaccess) "1"
  560. #######################################################################
  561. #
  562. # bw <nick> / <host> ( bad word)
  563. #
  564. #######################################################################
  565. #Ban-Time
  566. set black(bwtime) "360"
  567. ########################################################################
  568. #
  569. # stick <nick> / <host> <timp> <motiv>
  570. #
  571. ########################################################################
  572. #Ban-Time
  573. set black(dfstickbantime) "5040"
  574. ########################################################################
  575. #
  576. # l <seconds>
  577. #
  578. ########################################################################
  579. #Mode Type
  580. set black(lmode) "m"
  581. ########################################################################
  582. #
  583. # ul
  584. #
  585. ########################################################################
  586. #Mode Type
  587. set black(ulmodes) "mir"
  588. ########################################################################
  589. #
  590. #
  591. # This is the END !
  592. #
  593. #
  594. ########################################################################
  595. set black(exceptflags) "nm|HAMOVSo"
  596. setudef flag antipub
  597. setudef flag antinotice
  598. setudef flag antictcp
  599. setudef flag antilongtext
  600. setudef flag antibadword
  601. setudef flag antijoinpart
  602. setudef flag antispam
  603. setudef flag antirepeat
  604. setudef flag badquitpart
  605. setudef flag anticolor
  606. setudef flag antibold
  607. setudef flag antiunderline
  608. setudef flag anticaps
  609. setudef flag badfullname
  610. setudef flag badnick
  611. setudef flag badident
  612. setudef flag antijoinflood
  613. setudef flag antichanflood
  614. setudef flag xtools
  615. setudef flag topicrefresh
  616. setudef flag count
  617. setudef flag antibadchan
  618. setudef flag anunt
  619. setudef flag limit
  620. setudef flag refresh
  621. setudef flag clonescan
  622. setudef flag seen
  623. setudef flag antidle
  624. setudef flag antividle
  625. setudef flag antididle
  626. setudef flag autoop
  627. setudef flag autovoice
  628. setudef flag leave
  629. setudef flag chanreport
  630. setudef flag topwords
  631. setudef flag xban
  632. setudef flag protectop
  633. setudef flag protectvoice
  634. setudef flag dontop
  635. setudef flag dontdeop
  636. setudef flag private
  637. setudef flag silent
  638. setudef flag showtime
  639. setudef flag showhandle
  640. setudef flag showcount
  641. setudef int idlevoicemax
  642. setudef int idleopmax
  643. setudef int countnumber
  644. setudef int kickcount
  645. setudef int xbantime
  646. setudef int xbanlevel
  647. setudef int blacklimit
  648. setudef str backchan
  649. #Motive / Bantime
  650. #Protection
  651. setudef str antipub-reason
  652. setudef int antipub-bantime
  653. setudef str antinotice-reason
  654. setudef int antinotice-bantime
  655. setudef str antictcp-reason
  656. setudef int antictcp-bantime
  657. setudef str antibadword-reason
  658. setudef int antibadword-bantime
  659. setudef str antilongtext-reason
  660. setudef int antilongtext-bantime
  661. setudef str antibadquitpart-reason
  662. setudef int antibadquitpart-bantime
  663. setudef str antijoinpart-reason
  664. setudef int antijoinpart-bantime
  665. setudef str antispam-reason
  666. setudef int antispam-bantime
  667. setudef str antispam-message
  668. setudef str antirepeat-reason
  669. setudef int antirepeat-bantime
  670. setudef str anticolor-reason
  671. setudef int anticolor-bantime
  672. setudef str antibold-reason
  673. setudef int antibold-bantime
  674. setudef str antiunderline-reason
  675. setudef int antiunderline-bantime
  676. setudef str anticaps-reason
  677. setudef int anticaps-bantime
  678. setudef str badfullname-reason
  679. setudef int badfullname-bantime
  680. setudef str badnick-reason
  681. setudef int badnick-bantime
  682. setudef str badident-reason
  683. setudef int badident-bantime
  684. setudef str antichanflood-reason
  685. setudef int antichanflood-bantime
  686. setudef str joinflood
  687. setudef str chanflood
  688. setudef int private-bantime
  689. setudef str private-reason
  690. setudef int antilongtextmax
  691. setudef str antirepeat-setting
  692. #commands
  693. setudef str dr-reason
  694. setudef int dr-bantime
  695. setudef str n-reason
  696. setudef int n-bantime
  697. setudef int b-bantime
  698. setudef str id-reason
  699. setudef int id-bantime
  700. setudef str w-reason
  701. setudef str spam-reason
  702. setudef int spam-bantime
  703. setudef str bw-reason
  704. setudef int bw-bantime
  705. setudef int bot-bantime
  706. setudef str bot-reason
  707. #module
  708. setudef str badchan-reason
  709. setudef int badchan-bantime
  710. setudef str count-message
  711. setudef str lang
  712. if {$black(logonconect) == "1"} {
  713. bind evnt - init-server loginpublic
  714. }
  715. bind pubm - * topwordspublic
  716. bind pubm - * antipub:protect
  717. bind ctcp - ACTION antipub:protect:me
  718. bind notc - * antinotice:protect
  719. bind ctcp - * antictcp:protect
  720. bind pubm - * antibadword:protect
  721. bind ctcp - ACTION antibadword:protect:me
  722. bind pubm - * antilongtext:protect
  723. bind ctcp - ACTION antilongtext:protect:me
  724. bind part - * antipubpart:protect
  725. bind sign - * antipubsign:protect
  726. bind part - * anticolorpart:protect
  727. bind sign - * anticolorquit:protect
  728. bind part - * antijoinpart:protect
  729. bind join - * antispam:protect:msg
  730. bind msgm - * antispam:protect
  731. bind time - * antispam:protect:cycle
  732. bind time - "30 * * * *" clonescanner
  733. bind time - "* * * * *" limit:timer
  734. bind pubm - * antirepeat:protect
  735. bind pubm - * antifloodchan:protect
  736. bind ctcp - version blackreply
  737. bind ctcp - ACTION antirepeat:protect:me
  738. bind ctcp - ACTION antifloodchan:protect:me
  739. bind pubm - * anticolor:protect
  740. bind ctcp - ACTION anticolor:protect:me
  741. bind pubm - * antibold:protect
  742. bind ctcp - ACTION antibold:protect:me
  743. bind pubm - * antiunderline:protect
  744. bind ctcp - ACTION antiunderline:protect:me
  745. bind pubm - * anticaps:protect
  746. bind ctcp - ACTION anticaps:protect:me
  747. bind join - * badfullname:protect:join
  748. bind join - * badnick:protect:join
  749. bind join - * badident:protect:join
  750. bind nick - * badnick:protect:change
  751. bind mode - "*+b*" protectpublic
  752. bind join - * joinflood:protect
  753. bind join - * rebanpublic
  754. bind need - * toolspublic
  755. bind join - * countpublic:join
  756. bind join - * badchanpublic:join
  757. bind join - * seen:join
  758. bind part - * seen:part
  759. bind sign - * seen:sign
  760. bind kick - * seen:kick
  761. bind splt - * seen:split
  762. bind nick - * seen:changenick
  763. bind join - * greetpublic:join
  764. bind part - * leavepublic:part
  765. bind time - * idlewhoispublic
  766. bind evnt - init-server setaway
  767. bind join - * autovonjoin
  768. bind join - * autoponjoin
  769. bind join - * addopjoin
  770. bind join - * addvoicejoin
  771. bind join - * private:module
  772. bind join - * timeban:module
  773. bind ctcr mn|MOSAV PING pingpublic
  774. bind ctcr - VERSION ctcpvers
  775. bind mode - *+o* dontoppublic
  776. bind mode - *-o* dontdeoppublic
  777. bind pubm nm|MmvVNnoOSA * comand:pubme
  778. foreach black(char) $black(cmdchar) {
  779. if {[string match -nocase "$black(char)" "none"]} {
  780. set black(char) ""
  781. }
  782. bind pub nm|MAS $black(char)clonescan scannerpublic
  783. bind pub nm|MASO $black(char)r refreshpublic
  784. bind pub nm|M $black(char)count countpublic
  785. bind pub nm|M $black(char)badchan badchanpublic
  786. bind pub nm|M $black(char)badword antibadword:command:public
  787. bind pub nm|M $black(char)anunt anuntpublic
  788. bind pub nm|M $black(char)limit limitpublic
  789. bind pub nm|M $black(char)topic topicpublic
  790. bind pub -|- $black(char)seen seenpublic
  791. bind pub nm|M $black(char)greet greetpublic
  792. bind pub nm|M $black(char)leave leavepublic
  793. bind pub nm|M $black(char)idle antidlepublic
  794. bind pub nm|OSMA $black(char)dr drpublic
  795. bind pub nm|OSMA $black(char)bot botpublic
  796. bind pub nm|OSMA $black(char)b bpublic
  797. bind pub nm|OSMA $black(char)n npublic
  798. bind pub nm|OSMA $black(char)id idpublic
  799. bind pub nm|SMA $black(char)black blackpublic
  800. bind pub nm|SMA $black(char)bl blackpublic
  801. bind pub nm|VOSMA $black(char)w wpublic
  802. bind pub nm|OSMA $black(char)spam spampublic
  803. bind pub nm|VOSMA $black(char)k kpublic
  804. bind pub nm|OSMA $black(char)bw bwpublic
  805. bind pub nm|OSMA $black(char)ub ubpublic
  806. bind pub nm|VOSMA $black(char)sb sbpublic
  807. bind pub nm|SMA $black(char)d dpublic
  808. bind pub nm|SMA $black(char)stick stickpublic
  809. bind pub nm|VOSMA $black(char)t tpublic
  810. bind pub nm|M $black(char)show showpublic
  811. bind pub nm|- $black(char)status statuspublic
  812. bind pub nm|- $black(char)channels channelspublic
  813. bind pub nm|- $black(char)chat chatpublic
  814. bind pub nm|- $black(char)uptime uptimepublic
  815. bind pub nm|VOSMA $black(char)i ipublic
  816. bind pub nm|VOSMA $black(char)addinfo addinfopublic
  817. bind pub nm|VOSMA $black(char)v vpublic
  818. bind pub nm|VOSMA $black(char)myset mysetpublic
  819. bind pub nm|OSMA $black(char)o opublic
  820. bind pub nm|VOSMA $black(char)l lpublic
  821. bind pub nm|VOSMA $black(char)ul ulpublic
  822. bind pub nm|SMA $black(char)say saypublic
  823. bind pub nm|SMA $black(char)act actpublic
  824. bind pub nm|- $black(char)broadcast broadcastpublic
  825. bind pub nm|OSMA $black(char)check checkpublic
  826. bind pub nm|VOSMA $black(char)version versionpublic
  827. bind pub nm|OSMA $black(char)cycle cyclepublic
  828. bind pub nm|- $black(char)away awaypublic
  829. bind pub nm|M $black(char)private privatepublic
  830. bind pub nm|OSMA $black(char)mode modepublic
  831. bind pub nm|M $black(char)set setpublic
  832. bind pub nm|- $black(char)silence silencepublic
  833. bind pub nm|- $black(char)msg msgpublic
  834. bind pub nm|MA $black(char)add publicadd
  835. bind pub nm|MA $black(char)adduser adduserpublic
  836. bind pub nm|MA $black(char)delacc delaccpublic
  837. bind pub nm|- $black(char)del delpublic
  838. bind pub nm|- $black(char)ignore ignorepublic
  839. bind pub nm|- $black(char)botidle botidlepublic
  840. bind pub nm|M $black(char)addhost addhostpublic
  841. bind pub nm|M $black(char)delhost delhostpuplic
  842. bind pub nm|OSMA $black(char)banlist banlistpublic
  843. bind pub nm|M $black(char)purge purgepublic
  844. bind pub nm|M $black(char)chuser chuserpublic
  845. bind pub nm|MASOV $black(char)userlist publicuserlist
  846. bind pub nm|MASOV $black(char)info infopublic
  847. bind pub nm|MA $black(char)s spublic
  848. bind pub nm|MA $black(char)us uspublic
  849. bind pub nm|MAOSV $black(char)ping pings
  850. bind pub nm|MASOV $black(char)time timepublic
  851. bind pub nm|MAOSV $black(char)vers verspublic
  852. bind pub nm|MAOSV $black(char)whois whoispublic
  853. bind pub nm|MAOS $black(char)gag gagpublic
  854. bind pub nm|M $black(char)reset resetpublic
  855. bind pub nm|M $black(char)clear clearpublic
  856. bind pub nm|- $black(char)addbot addbotpublic
  857. bind pub nm|M $black(char)addop addoppublic
  858. bind pub nm|M $black(char)addvoice addvoicepublic
  859. bind pub nm|M $black(char)delop deloppublic
  860. bind pub nm|M $black(char)delvoice delvoicepublic
  861. bind pub nm|- $black(char)addmyhost addmyhostpublic
  862. bind pub nm|- $black(char)delmyhost delmyhostpublic
  863. bind pub nm|VOSAM $black(char)activ activpublic
  864. bind pub nm|MASOV $black(char)h hpublic
  865. bind pub nm|MASO $black(char)cc ccpublic
  866. bind pub nm|MAOSV $black(char)top toppublic
  867. bind pub nm|M $black(char)secure securepublic
  868. bind pub nm|- $black(char)bt broadcastpublic:module
  869. bind pub nm|- $black(char)login publiclogin:Cmd
  870. bind pub nm|MASO $black(char)stats statspublic
  871. }
  872. bind msg nm|- addchan addchanpublic
  873. bind msg nm|- delchan delchanpublic
  874. bind msg nm|- suspend suspendpublic
  875. bind msg nm|- unsuspend unsuspendpublic
  876. bind msg nm|- nick nickpublic
  877. bind msg nm|- rehash rehashme
  878. bind msg nm|- restart restartme
  879. bind msg nm|- save saveme
  880. bind msg nm|- jump jumpme
  881. bind msg nm|- die dieme
  882. bind msg nm|OSAM op oppublic
  883. bind msg nm|OSAM deop deoppublic
  884. bind msg nm|OSAM voice voicepublic
  885. bind msg nm|OSAM devoice devoicepublic
  886. bind msg nm|OSAM invite invitepublic
  887. ##########################################################################
  888. #
  889. #
  890. # Dont try to modify if you dont know what are you doing !
  891. #
  892. #
  893. #########################################################################
  894. set black(name) "BlackToolS"
  895. set black(author) "BLaCkShaDoW"
  896. set black(vers) "2.3"
  897. set black(site) "WwW.TclScripts.Net"
  898. set sdir "$username.status.txt"
  899. set wdir "$username.away.txt"
  900. set seendir "$username.Seen.db"
  901. set statsdir "$username.stats.db"
  902. set bwordir "$username.bword.db"
  903. set black(loader_error) [catch {source $black(dirname)/lang/loader.tcl} black(loader_error_stats)]
  904. if {$black(loader_error) == "1"} {
  905. die "4BlackTools :I didnt find the 12loader.tcl in the 12lang folder. This file contains the language for the script.PLease load it."
  906. }
  907. if {![info exists anuntpublic:show_running]} {
  908. timer $black(anunttime) anuntpublic:show
  909. set anuntpublic:show_running 1
  910. }
  911. if {![info exists times_topic_running]} {
  912. timer $black(topic_time) times_topic
  913. set times_topic_running 1
  914. }
  915. if {![file exists $seendir]} {
  916. set file [open $seendir w]
  917. close $file
  918. }
  919. if {![file exists $sdir]} {
  920. set file [open $sdir w]
  921. close $file
  922. }
  923. if {![file exists $wdir]} {
  924. set file [open $wdir w]
  925. close $file
  926. }
  927. if {![file exists $bwordir]} {
  928. set file [open $bwordir w]
  929. close $file
  930. }
  931. if {![file exists $statsdir]} {
  932. set file [open $statsdir w]
  933. close $file
  934. }
  935. if {![info exists antibotidle:module_running]} {
  936. set file [open $sdir "r"]
  937. set database [read -nonewline $file]
  938. close $file
  939. set data [split $database "\n"]
  940. if {$data != ""} {
  941. foreach line $data {
  942. set type [lindex [split $line] 0]
  943. set stats [lindex [split $line] 1]
  944. if {($type == "antibotidle:module") && ($stats == "ON")} {
  945. timer $black(noidlemax) antibotidle:module
  946. }
  947. }
  948. }
  949. set antibotidle:module_running 1
  950. }
  951. if {![info exists broadcastpublic:show_running]} {
  952. set file [open $sdir "r"]
  953. set database [read -nonewline $file]
  954. close $file
  955. set data [split $database "\n"]
  956. if {$data != ""} {
  957. foreach line $data {
  958. set type [lindex [split $line] 0]
  959. set stats [lindex [split $line] 1]
  960. if {($type == "broadcastpublic:show") && ($stats == "ON")} {
  961. timer $black(bttime) broadcastpublic:show
  962. }
  963. }
  964. }
  965. set broadcastpublic:show_running 1
  966. }
  967. proc blacktools:tell:prv {nick host hand type arg} {
  968. global botnick black
  969. set char(p) [lindex $black(cmdchar) 0]
  970. if {[string match -nocase "$char(p)" "none"]} {
  971. set char(p) ""
  972. }
  973. set replace(%botnick%) $botnick
  974. set replace(%char%) $char(p)
  975. set replace(%msg%) [lrange [split $arg] 0 end]
  976. set replace(%msg.1%) [lindex [split $arg] 0]
  977. set replace(%msg.2%) [lindex [split $arg] 1]
  978. set replace(%msg.3%) [lindex [split $arg] 2]
  979. set replace(%msg.4%) [lrange [split $arg] 1 end]
  980. set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
  981. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  982. if {[info exists black(say.$getlang.$type)]} {
  983. set reply [string map [array get replace] $black(say.$getlang.$type)]
  984. puthelp "PRIVMSG $nick :$reply"
  985. }
  986. }
  987. proc blacktools:tell {nick host hand chan chan1 type arg} {
  988. global black botnick
  989. set char(p) [lindex $black(cmdchar) 0]
  990. if {[string match -nocase "$char(p)" "none"]} {
  991. set char(p) ""
  992. }
  993. set replace(%botnick%) $botnick
  994. set replace(%char%) $char(p)
  995. set replace(%chan%) $chan
  996. set replace(%msg%) [lrange $arg 0 end]
  997. set replace(%msg.set%) [lrange $arg 1 end]
  998. set replace(%msg.1%) [lindex $arg 0]
  999. set replace(%msg.2%) [lindex $arg 1]
  1000. set replace(%msg.3%) [lindex $arg 2]
  1001. set replace(%msg.4%) [lindex $arg 3]
  1002. set replace(%msg.5%) [lrange $arg 4 end]
  1003. set replace(%msg.6%) [lrange $arg 3 end]
  1004. set replace(%msg.7%) [lrange $arg 2 end]
  1005. set replace(%msg.8%) [lrange $arg 1 end]
  1006. set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
  1007. set getmethod [getuser $hand XTRA OUTPUT_TYPE]
  1008. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1009. if {$getmethod == ""} { set getmethod "1" }
  1010. if {[info exists black(say.$getlang.$type)]} {
  1011. set reply [string map [array get replace] $black(say.$getlang.$type)]
  1012. if {$getmethod == "1"} {
  1013. putserv "NOTICE $nick :$reply"
  1014. } else {
  1015. putserv "PRIVMSG $chan1 :$reply"
  1016. }
  1017. }
  1018. }
  1019. proc blacktools:banner:1 {banmask botnick chan reason mode timer bantime} {
  1020. global black
  1021. if {[channel get $chan xban]} {
  1022. set getcount [channel get $chan kickcount]
  1023. set getxtime [channel get $chan xbantime]
  1024. set getxlevel [channel get $chan xbanlevel]
  1025. if {$getxlevel == "0"} { set getxlevel "100"}
  1026. if {$getxtime == "0"} { set getxtime "1" }
  1027. set kcount [expr $getcount +1]
  1028. channel set $chan kickcount $kcount
  1029. if {[channel get $chan showcount]} {
  1030. set reason "$reason - $kcount -"
  1031. } else {
  1032. set reason "$reason"
  1033. }
  1034. putquick "MODE $chan +$mode" -next ;utimer $timer [list putquick "MODE $chan -$mode"]
  1035. putquick "PRIVMSG $black(chanserv) :ban $chan $banmask $getxtime $getxlevel $reason"
  1036. newchanban $chan $banmask $botnick $reason $bantime
  1037. if {![channel get $chan chanreport]} {
  1038. return 0
  1039. }
  1040. set backchan [channel get $chan backchan]
  1041. if {$backchan == ""} {
  1042. return 0
  1043. }
  1044. if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
  1045. return 0
  1046. }
  1047. if {[info exists black($chan:anounce)]} {
  1048. return 0
  1049. }
  1050. set black($chan:anounce) 1
  1051. set getlang [string tolower [channel get $chan lang]]
  1052. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1053. set replace(%banmask%) $banmask
  1054. set replace(%bantime%) $bantime
  1055. set replace(%reason%) $reason
  1056. set replace(%chan%) $chan
  1057. puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
  1058. } else {
  1059. set getcount [channel get $chan kickcount]
  1060. set kcount [expr $getcount +1]
  1061. channel set $chan kickcount $kcount
  1062. if {[channel get $chan showcount]} {
  1063. set reason "$reason - $kcount -" } else {
  1064. set reason "$reason" }
  1065. putquick "MODE $chan +$mode" -next ;utimer $timer [list putquick "MODE $chan -$mode"]
  1066. newchanban $chan $banmask $botnick $reason $bantime
  1067. if {![channel get $chan chanreport]} {
  1068. return 0
  1069. }
  1070. set backchan [channel get $chan backchan]
  1071. if {$backchan == ""} {
  1072. return 0
  1073. }
  1074. if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
  1075. return 0
  1076. }
  1077. if {[info exists black($chan:anounce)]} {
  1078. return 0
  1079. }
  1080. set black($chan:anounce) 1
  1081. set getlang [string tolower [channel get $chan lang]]
  1082. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1083. set replace(%banmask%) $banmask
  1084. set replace(%bantime%) $bantime
  1085. set replace(%reason%) $reason
  1086. set replace(%chan%) $chan
  1087. puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
  1088. }
  1089. utimer 5 [list unset black($chan:anounce)]
  1090. }
  1091. proc blacktools:banner:2 {banmask botnick chan reason bantime} {
  1092. global black
  1093. if {[channel get $chan xban]} {
  1094. set getcount [channel get $chan kickcount]
  1095. set getxtime [channel get $chan xbantime]
  1096. if {$getxtime == "0"} { set getxtime "1" }
  1097. set getxlevel [channel get $chan xbanlevel]
  1098. if {$getxlevel == "0"} { set getxlevel "100"}
  1099. set kcount [expr $getcount +1]
  1100. channel set $chan kickcount $kcount
  1101. if {[channel get $chan showcount]} {
  1102. set reason "$reason - $kcount -"
  1103. } else {
  1104. set reason "$reason"
  1105. }
  1106. putquick "PRIVMSG $black(chanserv) :ban $chan $banmask $getxtime $getxlevel $reason"
  1107. newchanban $chan $banmask $botnick $reason $bantime
  1108. if {![channel get $chan chanreport]} {
  1109. return 0
  1110. }
  1111. set backchan [channel get $chan backchan]
  1112. if {$backchan == ""} {
  1113. return 0
  1114. }
  1115. if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
  1116. return 0
  1117. }
  1118. if {[info exists black($chan:anounce)]} {
  1119. return 0
  1120. }
  1121. set black($chan:anounce) 1
  1122. set getlang [string tolower [channel get $chan lang]]
  1123. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1124. set replace(%banmask%) $banmask
  1125. set replace(%bantime%) $bantime
  1126. set replace(%reason%) $reason
  1127. set replace(%chan%) $chan
  1128. puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
  1129. } else {
  1130. set getcount [channel get $chan kickcount]
  1131. set kcount [expr $getcount +1]
  1132. channel set $chan kickcount $kcount
  1133. if {[channel get $chan showcount]} {
  1134. set reason "$reason - $kcount -" } else {
  1135. set reason "$reason" }
  1136. newchanban $chan $banmask $botnick $reason $bantime
  1137. if {![channel get $chan chanreport]} {
  1138. return 0
  1139. }
  1140. set backchan [channel get $chan backchan]
  1141. if {$backchan == ""} {
  1142. return 0
  1143. }
  1144. if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
  1145. return 0
  1146. }
  1147. if {[info exists black($chan:anounce)]} {
  1148. return 0
  1149. }
  1150. set black($chan:anounce) 1
  1151. set getlang [string tolower [channel get $chan lang]]
  1152. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1153. set replace(%banmask%) $banmask
  1154. set replace(%bantime%) $bantime
  1155. set replace(%reason%) $reason
  1156. set replace(%chan%) $chan
  1157. puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
  1158. }
  1159. utimer 5 [list unset black($chan:anounce)]
  1160. }
  1161. proc blacktools:banner:3 {mask hand chan reason bantime type} {
  1162. global black botnick
  1163. if {[channel get $chan xban]} {
  1164. set getcount [channel get $chan kickcount]
  1165. set getxtime [channel get $chan xbantime]
  1166. if {$getxtime == "0"} { set getxtime "1" }
  1167. set getxlevel [channel get $chan xbanlevel]
  1168. if {$getxlevel == "0"} { set getxlevel "100"}
  1169. set getcount [channel get $chan kickcount]
  1170. set kcount [expr $getcount +1]
  1171. channel set $chan kickcount $kcount
  1172. set countz [getuser $hand XTRA $type]
  1173. if {$countz == ""} { set countz 0 }
  1174. set counts [expr $countz + 1]
  1175. setuser $hand XTRA $type $counts
  1176. if {[channel get $chan showcount]} {
  1177. set reason "$reason - $kcount -"
  1178. } else {
  1179. set reason "$reason"
  1180. }
  1181. putquick "PRIVMSG $black(chanserv) :ban $chan $mask $getxtime $getxlevel $reason"
  1182. utimer 1 [list newchanban $chan $mask $hand $reason $bantime]
  1183. putquick "MODE $chan +b $mask"
  1184. if {![channel get $chan chanreport]} {
  1185. return 0
  1186. }
  1187. set backchan [channel get $chan backchan]
  1188. if {$backchan == ""} {
  1189. return 0
  1190. }
  1191. if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
  1192. return 0
  1193. }
  1194. set getlang [string tolower [channel get $chan lang]]
  1195. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1196. set replace(%banmask%) $mask
  1197. set replace(%bantime%) $bantime
  1198. set replace(%reason%) $reason
  1199. set replace(%chan%) $chan
  1200. puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
  1201. } else {
  1202. set getcount [channel get $chan kickcount]
  1203. set kcount [expr $getcount +1]
  1204. channel set $chan kickcount $kcount
  1205. set countz [getuser $hand XTRA $type]
  1206. if {$countz == ""} { set countz 0 }
  1207. set counts [expr $countz + 1]
  1208. setuser $hand XTRA $type $counts
  1209. if {[channel get $chan showcount]} {
  1210. set reason "$reason - $kcount -" } else {
  1211. set reason "$reason" }
  1212. newchanban $chan $mask $hand $reason $bantime
  1213. putquick "MODE $chan +b $mask"
  1214. if {![channel get $chan chanreport]} {
  1215. return 0
  1216. }
  1217. set backchan [channel get $chan backchan]
  1218. if {$backchan == ""} {
  1219. return 0
  1220. }
  1221. if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
  1222. return 0
  1223. }
  1224. set getlang [string tolower [channel get $chan lang]]
  1225. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1226. set replace(%banmask%) $mask
  1227. set replace(%bantime%) $bantime
  1228. set replace(%reason%) $reason
  1229. set replace(%chan%) $chan
  1230. puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
  1231. }
  1232. }
  1233. proc blacktools:banner:4 {mask hand chan reason bantime type} {
  1234. global black botnick
  1235. if {[channel get $chan xban]} {
  1236. set getcount [channel get $chan kickcount]
  1237. set getxtime [channel get $chan xbantime]
  1238. if {$getxtime == "0"} { set getxtime "1" }
  1239. set getxlevel [channel get $chan xbanlevel]
  1240. if {$getxlevel == "0"} { set getxlevel "100"}
  1241. set getcount [channel get $chan kickcount]
  1242. set kcount [expr $getcount +1]
  1243. channel set $chan kickcount $kcount
  1244. set countz [getuser $hand XTRA $type]
  1245. if {$countz == ""} { set countz 0 }
  1246. set counts [expr $countz + 1]
  1247. setuser $hand XTRA $type $counts
  1248. if {[channel get $chan showcount]} {
  1249. set reason "$reason - $kcount -"
  1250. } else {
  1251. set reason "$reason"
  1252. }
  1253. putquick "PRIVMSG $black(chanserv) :ban $chan $mask $getxtime $getxlevel $reason"
  1254. utimer 1 [list newchanban $chan $mask $hand $reason $bantime sticky]
  1255. putquick "MODE $chan +b $mask"
  1256. if {![channel get $chan chanreport]} {
  1257. return 0
  1258. }
  1259. set backchan [channel get $chan backchan]
  1260. if {$backchan == ""} {
  1261. return 0
  1262. }
  1263. if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
  1264. return 0
  1265. }
  1266. set getlang [string tolower [channel get $chan lang]]
  1267. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1268. set replace(%banmask%) $mask
  1269. set replace(%bantime%) $bantime
  1270. set replace(%reason%) $reason
  1271. set replace(%chan%) $chan
  1272. puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
  1273. } else {
  1274. set getcount [channel get $chan kickcount]
  1275. set kcount [expr $getcount +1]
  1276. channel set $chan kickcount $kcount
  1277. set countz [getuser $hand XTRA $type]
  1278. if {$countz == ""} { set countz 0 }
  1279. set counts [expr $countz + 1]
  1280. setuser $hand XTRA $type $counts
  1281. if {[channel get $chan showcount]} {
  1282. set reason "$reason - $kcount -" } else {
  1283. set reason "$reason" }
  1284. newchanban $chan $mask $hand $reason $bantime sticky
  1285. putquick "MODE $chan +b $mask"
  1286. if {![channel get $chan chanreport]} {
  1287. return 0
  1288. }
  1289. set backchan [channel get $chan backchan]
  1290. if {$backchan == ""} {
  1291. return 0
  1292. }
  1293. if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
  1294. return 0
  1295. }
  1296. set getlang [string tolower [channel get $chan lang]]
  1297. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1298. set replace(%banmask%) $mask
  1299. set replace(%bantime%) $bantime
  1300. set replace(%reason%) $reason
  1301. set replace(%chan%) $chan
  1302. puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
  1303. }
  1304. }
  1305. ################################ antipub ###########################
  1306. proc antipub:filter {str} {
  1307. regsub -all -- {\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\037|\002|\026|\006|\007} $str "" str
  1308. return $str
  1309. }
  1310. proc antipub:protect {nick host hand chan arg} {
  1311. global black botnick
  1312. set text [antipub:filter $arg]
  1313. set handle [nick2hand $nick]
  1314. if {![validchan $chan]} { return 0 }
  1315. set getreason [channel get $chan antipub-reason]
  1316. if {$getreason == ""} {
  1317. set getlang [string tolower [channel get $chan lang]]
  1318. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1319. set getreason $black(say.$getlang.antipub.1)
  1320. }
  1321. set getbantime [channel get $chan antipub-bantime]
  1322. if {$getbantime == "0"} { set getbantime $black(antipubbantime) }
  1323. set replace(%chan%) $chan
  1324. set protectreason [string map [array get replace] $getreason]
  1325. set reason "$protectreason"
  1326. set banmask *!*@[lindex [split $host @] 1]
  1327. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  1328. if {![botisop $chan]} { return 0 }
  1329. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  1330. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  1331. if {[isbotnick $nick]} { return 0 }
  1332. if { [channel get $chan antipub] } {
  1333. foreach antipub [string tolower $black(antipubword)] {
  1334. if {[string match -nocase $antipub $arg]} {
  1335. blacktools:banner:1 $banmask $botnick $chan $reason $black(antipubmode) $black(antipubsecunde) $getbantime
  1336. }
  1337. }
  1338. }
  1339. }
  1340. proc antipub:protect:me {nick host hand chan keyword arg} {
  1341. global black
  1342. antipub:protect $nick $host $hand $chan $arg
  1343. }
  1344. ############################### antinotice #############################
  1345. proc antinotice:protect {nick host hand arg chan} {
  1346. global black botnick
  1347. set handle [nick2hand $nick]
  1348. if {![validchan $chan]} { return 0 }
  1349. set getreason [channel get $chan antinotice-reason]
  1350. if {$getreason == ""} {
  1351. set getlang [string tolower [channel get $chan lang]]
  1352. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1353. set getreason $black(say.$getlang.antinotice.1)
  1354. }
  1355. set getbantime [channel get $chan antinotice-bantime]
  1356. if {$getbantime == "0"} { set getbantime $black(antinoticebantime) }
  1357. set replace(%chan%) $chan
  1358. set protectreason [string map [array get replace] $getreason]
  1359. set banmask *!*@[lindex [split $host @] 1]
  1360. set reason "$protectreason"
  1361. if {![botisop $chan]} { return 0 }
  1362. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  1363. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  1364. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  1365. if {[isbotnick $nick]} { return 0 }
  1366. if {$chan == $botnick} { return 0 }
  1367. if { [channel get $chan antinotice] } {
  1368. blacktools:banner:1 $banmask $botnick $chan $reason $black(antinoticemode) $black(antinoticesecunde) $getbantime
  1369. }
  1370. }
  1371. ############################## antictcp ################################
  1372. proc antictcp:protect {nick host hand chan keyword arg} {
  1373. global black botnick
  1374. set handle [nick2hand $nick]
  1375. if {![validchan $chan]} { return 0 }
  1376. set getreason [channel get $chan antictcp-reason]
  1377. if {$getreason == ""} {
  1378. set getlang [string tolower [channel get $chan lang]]
  1379. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1380. set getreason $black(say.$getlang.antictcp.1)
  1381. }
  1382. set getbantime [channel get $chan antictcp-bantime]
  1383. if {$getbantime == "0"} { set getbantime $black(antictcpbantime) }
  1384. set replace(%chan%) $chan
  1385. set protectreason [string map [array get replace] $getreason]
  1386. set reason "$protectreason"
  1387. set banmask *!*@[lindex [split $host @] 1]
  1388. if {[string equal -nocase "action" $keyword] || [string equal -nocase "chat" $keyword]} {return 0}
  1389. if {![botisop $chan]} { return 0 }
  1390. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  1391. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  1392. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  1393. if {[isbotnick $nick]} { return 0 }
  1394. if { [channel get $chan antictcp] } {
  1395. blacktools:banner:1 $banmask $botnick $chan $reason $black(antictcpmode) $black(antictcpsecunde) $getbantime
  1396. }
  1397. }
  1398. ############################## antibadword ################################
  1399. proc antibadword:filter {str} {
  1400. regsub -all -- {\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\037|\002|\026|\006|\007} $str "" str
  1401. return $str
  1402. }
  1403. proc antibadword:protect {nick host hand chan arg} {
  1404. global black botnick bwordir
  1405. set handle [nick2hand $nick]
  1406. if {![validchan $chan]} { return 0 }
  1407. set getreason [channel get $chan antibadword-reason]
  1408. if {$getreason == ""} {
  1409. set getlang [string tolower [channel get $chan lang]]
  1410. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1411. set getreason $black(say.$getlang.antibadword.1)
  1412. }
  1413. set getbantime [channel get $chan antibadword-bantime]
  1414. if {$getbantime == "0"} { set getbantime $black(antibadwordbantime) }
  1415. set replace(%chan%) $chan
  1416. set protectreason [string map [array get replace] $getreason]
  1417. set text [antibadword:filter $arg]
  1418. set reason "$protectreason"
  1419. set banmask *!*@[lindex [split $host @] 1]
  1420. if {![botisop $chan]} { return 0 }
  1421. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  1422. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  1423. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  1424. if {[isbotnick $nick]} { return 0 }
  1425. if {[channel get $chan antibadword]} {
  1426. set file [open $bwordir "r"]
  1427. set data [read -nonewline $file]
  1428. close $file
  1429. set lines [split $data "\n"]
  1430. foreach word $lines {
  1431. set c [lindex [split $word] 0]
  1432. set w [lrange [split $word] 1 end]
  1433. if {[string match -nocase $c $chan]} {
  1434. if {[string match -nocase $w $text]} {
  1435. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1436. }
  1437. }
  1438. }
  1439. foreach antibadword [string tolower $black(antibadword)] {
  1440. if {[string match -nocase $antibadword $text]} {
  1441. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1442. }
  1443. }
  1444. }
  1445. }
  1446. proc antibadword:protect:me {nick host hand chan keyword arg} {
  1447. global black
  1448. antibadword:protect $nick $host $hand $chan $arg
  1449. }
  1450. ################################ badword ##################################
  1451. proc antibadword:command:public {nick host hand chan arg} {
  1452. global black botnick
  1453. set why [lindex [split $arg] 0]
  1454. set type 0
  1455. set chan1 "$chan"
  1456. set bdword [lrange [split $arg] 1 end]
  1457. set bdnumber [lindex [split $arg] 1]
  1458. if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
  1459. set chan "$why"
  1460. set why [lindex [split $arg] 1]
  1461. set bdnumber [lindex [split $arg] 2]
  1462. set bdword [lrange [split $arg] 2 end]
  1463. }
  1464. antibadword:command:process $nick $host $hand $chan $chan1 $why $bdword $bdnumber $type
  1465. }
  1466. proc antibadword:command:process {nick host hand chan chan1 why bdword bdnumber type} {
  1467. global black bwordir botnick
  1468. set i 0
  1469. set char(p) [lindex $black(cmdchar) 0]
  1470. if {[string match -nocase "$char(p)" "none"]} {
  1471. set char(p) ""
  1472. }
  1473. if {[matchattr $hand nm|- $chan]} {
  1474. if {($why == "") && ($type == "0")} {
  1475. blacktools:tell $nick $host $hand $chan $chan1 badword.1 none
  1476. return 0
  1477. }
  1478. if {($why == "") && ($type == "1")} {
  1479. blacktools:tell $nick $host $hand $chan $chan1 badword.2 none
  1480. return 0
  1481. }
  1482. }
  1483. if {($why == "") && ($type == "0")} {
  1484. blacktools:tell $nick $host $hand $chan $chan1 badword.3 none
  1485. return 0
  1486. }
  1487. if {($why == "") && ($type == "1")} {
  1488. blacktools:tell $nick $host $hand $chan $chan1 badword.4 none
  1489. return 0
  1490. }
  1491. if {![validchan $chan]} {
  1492. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  1493. return 0
  1494. }
  1495. if {![onchan $botnick $chan]} {
  1496. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  1497. return 0
  1498. }
  1499. switch -exact -- [string tolower $why] {
  1500. add {
  1501. set file [open $bwordir a]
  1502. puts $file "$chan $bdword"
  1503. close $file
  1504. blacktools:tell $nick $host $hand $chan $chan1 badword.5 $bdword
  1505. }
  1506. list {
  1507. set file [open $bwordir "r"]
  1508. set why [read -nonewline $file]
  1509. close $file
  1510. set data [split $why "\n"]
  1511. if {$data == ""} {
  1512. blacktools:tell $nick $host $hand $chan $chan1 badword.6 none
  1513. blacktools:tell $nick $host $hand $chan $chan1 badword.7 none
  1514. return 0
  1515. }
  1516. foreach word $data {
  1517. set c [lindex [split $word] 0]
  1518. set word [lrange [split $word] 1 end]
  1519. if {[string match -nocase $chan $c]} {
  1520. set foundchan 1
  1521. set i [expr $i +1]
  1522. blacktools:tell $nick $host $hand $chan $chan1 badword.6 none
  1523. blacktools:tell $nick $host $hand $chan $chan1 badword.8 "4 $i. 12$word"
  1524. }
  1525. if {![info exists foundchan]} {
  1526. blacktools:tell $nick $host $hand $chan $chan1 badword.6 none
  1527. blacktools:tell $nick $host $hand $chan $chan1 badword.7 none
  1528. }
  1529. }
  1530. }
  1531. del {
  1532. if {![regexp {^[0-9]} $bdnumber]} {
  1533. blacktools:tell $nick $host $hand $chan $chan1 badword.9 $bdword
  1534. return 0
  1535. }
  1536. set file [open $bwordir "r"]
  1537. set data [read -nonewline $file]
  1538. close $file
  1539. set lines [split $data "\n"]
  1540. foreach word $lines {
  1541. set c [lindex [split $word] 0]
  1542. if {[string match -nocase $c $chan]} {
  1543. set i [expr $bdnumber - 1]
  1544. set delete [lreplace $lines $i $i]
  1545. set file [open $bwordir "w"]
  1546. puts $file [join $delete "\n"]
  1547. close $file
  1548. }
  1549. }
  1550. set file [open $bwordir "r"]
  1551. set data [read -nonewline $file]
  1552. close $file
  1553. if {$data == ""} {
  1554. set files [open $bwordir "w"]
  1555. close $files
  1556. }
  1557. blacktools:tell $nick $host $hand $chan $chan1 badword.10 $bdnumber
  1558. }
  1559. }
  1560. }
  1561. ############################## AntiLongText ################################
  1562. proc antilongtext:protect {nick uhost hand chan arg} {
  1563. global black botnick
  1564. set handle [nick2hand $nick]
  1565. if {![validchan $chan]} { return 0 }
  1566. set getreason [channel get $chan antilongtext-reason]
  1567. if {$getreason == ""} {
  1568. set getlang [string tolower [channel get $chan lang]]
  1569. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1570. set getreason $black(say.$getlang.antilongtext.1)
  1571. }
  1572. set getbantime [channel get $chan antilongtext-bantime]
  1573. if {$getbantime == "0"} { set getbantime $black(longbantime) }
  1574. set getlongchar [channel get $chan antilongtextmax]
  1575. if {$getlongchar == "0"} { set getlongchar "$black(longchar)" }
  1576. set replace(%chan%) $chan
  1577. set protectreason [string map [array get replace] $getreason]
  1578. set banmask "*!*@[lindex [split $uhost @] 1]"
  1579. set reason "$protectreason"
  1580. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  1581. if {![botisop $chan]} { return 0 }
  1582. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  1583. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  1584. if {[isbotnick $nick]} { return 0 }
  1585. if {[string length $arg] >= $getlongchar} {
  1586. if {[channel get $chan antilongtext]} {
  1587. blacktools:banner:1 $banmask $botnick $chan $reason $black(longmode) $black(longtimemode) $getbantime
  1588. }
  1589. }
  1590. }
  1591. proc antilongtext:protect:me {nick host hand chan keyword arg} {
  1592. global black
  1593. antilongtext:protect $nick $host $hand $chan $arg
  1594. }
  1595. ############################ AntiBAdQuitPart ##############################
  1596. set black(badcolors) {
  1597. "*\x03*"
  1598. "*\037*"
  1599. "*\002*"
  1600. }
  1601. proc antipubpart:protect {nick host hand chan arg} {
  1602. global botnick black
  1603. set handle [nick2hand $nick]
  1604. if {![validchan $chan]} { return 0 }
  1605. set getreason [channel get $chan antibadquitpart-reason]
  1606. if {$getreason == ""} {
  1607. set getlang [string tolower [channel get $chan lang]]
  1608. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1609. set getreason $black(say.$getlang.antibadquitpart.1)
  1610. }
  1611. set getbantime [channel get $chan antibadquitpart-bantime]
  1612. if {$getbantime == "0"} { set getbantime $black(badquitparttime) }
  1613. set replace(%chan%) $chan
  1614. set protectreason [string map [array get replace] $getreason]
  1615. set banmask "*!*@[lindex [split $host @] 1]"
  1616. set reason "$protectreason"
  1617. if {[channel get $chan badquitpart]} {
  1618. foreach word $black(badquitpartwords) {
  1619. if {![botisop $chan]} { return 0 }
  1620. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  1621. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  1622. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  1623. if {[isbotnick $nick]} { return 0 }
  1624. if {[string match -nocase $word $arg]} {
  1625. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1626. }
  1627. }
  1628. }
  1629. }
  1630. proc antipubsign:protect {nick host hand chan arg} {
  1631. antipubpart:protect $nick $host $hand $chan $arg
  1632. }
  1633. proc anticolorpart:protect {nick host hand chan arg} {
  1634. global botnick black
  1635. set handle [nick2hand $nick]
  1636. if {![validchan $chan]} { return 0 }
  1637. set getreason [channel get $chan antibadquitpart-reason]
  1638. if {$getreason == ""} {
  1639. set getlang [string tolower [channel get $chan lang]]
  1640. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1641. set getreason $black(say.$getlang.antibadquitpart.1)
  1642. }
  1643. set getbantime [channel get $chan antibadquitpart-bantime]
  1644. if {$getbantime == "0"} { set getbantime $black(badquitparttime) }
  1645. set replace(%chan%) $chan
  1646. set protectreason [string map [array get replace] $getreason]
  1647. set banmask "*!*@[lindex [split $host @] 1]"
  1648. set reason "$protectreason"
  1649. if {[channel get $chan badquitpart]} {
  1650. foreach color $black(badcolors) {
  1651. if {![botisop $chan]} { return 0 }
  1652. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  1653. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  1654. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  1655. if {[isbotnick $nick]} { return 0 }
  1656. if {($black(badquitpartcolour) == "1") && [string match -nocase $color $arg]} {
  1657. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1658. }
  1659. }
  1660. }
  1661. }
  1662. proc anticolorquit:protect {nick host hand chan arg} {
  1663. anticolorpart:protect $nick $host $hand $chan $arg
  1664. }
  1665. ########################### AntiJoinPart #############################
  1666. proc antijoinpart:protect {nick host hand chan arg} {
  1667. global black botnick
  1668. set handle [nick2hand $nick]
  1669. if {![validchan $chan]} { return 0 }
  1670. set getreason [channel get $chan antijoinpart-reason]
  1671. if {$getreason == ""} {
  1672. set getlang [string tolower [channel get $chan lang]]
  1673. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1674. set getreason $black(say.$getlang.antijoinpart.1)
  1675. }
  1676. set getbantime [channel get $chan antijoinpart-bantime]
  1677. if {$getbantime == "0"} { set getbantime $black(joinpartbantime) }
  1678. set replace(%chan%) $chan
  1679. set protectreason [string map [array get replace] $getreason]
  1680. set banmask "*!*@[lindex [split $host @] 1]"
  1681. set reason "$protectreason"
  1682. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  1683. if {[isbotnick $nick]} { return 0 }
  1684. if {$chan == $botnick} { return 0 }
  1685. if {[channel get $chan antijoinpart]} {
  1686. if {[getchanjoin $nick $chan] >= [expr {[clock seconds]-$black(joinparttime)}]} {
  1687. blacktools:banner:1 $banmask $botnick $chan $reason $black(joinpartmode) $black(joinparttimemode) $getbantime
  1688. }
  1689. }
  1690. }
  1691. proc spam:filter {str} {
  1692. regsub -all -- {\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\037|\002|\026|\006|\007} $str "" str
  1693. return $str
  1694. }
  1695. ############################# AntiSpam ##############################
  1696. proc antispam:protect {nick uhost hand arg} {
  1697. global botnick black
  1698. set text [spam:filter $arg]
  1699. set handle [nick2hand $nick]
  1700. foreach spammer [string tolower $black(spamword)] {
  1701. if {[string match -nocase $spammer $arg]} {
  1702. foreach chans [channels] {
  1703. if {![validchan $chans]} { return 0 }
  1704. set getreason [channel get $chans antispam-reason]
  1705. if {$getreason == ""} {
  1706. set getlang [string tolower [channel get $chans lang]]
  1707. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1708. set getreason $black(say.$getlang.antispam.1)
  1709. }
  1710. set getbantime [channel get $chans antispam-bantime]
  1711. if {$getbantime == "0"} { set getbantime $black(spamban) }
  1712. if {[onchan $nick $chans]} {
  1713. if {[channel get $chans antispam]} {
  1714. if {![botisop $chans]} { return 0 }
  1715. if {[isbotnick $nick]} { return 0 }
  1716. set banmask *!*@[lindex [split $uhost @] 1]
  1717. set replace(%chan%) $chans
  1718. set protectreason [string map [array get replace] $getreason]
  1719. set reason "$protectreason"
  1720. if {[matchattr $handle $black(exceptflags) $chans]} { return 0 }
  1721. if {[isvoice $nick $chans] && ($black(vprotect) == "1")} { return 0 }
  1722. if {[isop $nick $chans] && ($black(oprotect) == "1")} { return 0 }
  1723. blacktools:banner:2 $banmask $botnick $chans $reason $getbantime
  1724. }
  1725. }
  1726. }
  1727. }
  1728. }
  1729. }
  1730. proc antispam:protect:msg {nick host hand chan } {
  1731. global black
  1732. if {![validchan $chan]} { return 0 }
  1733. if {[channel get $chan antispam]} {
  1734. if {[isbotnick $nick]} { return 0 }
  1735. if {$black(spamreq) == "1"} {
  1736. set getmsg [channel get $chan antispam-message]
  1737. if {$getmsg == ""} {
  1738. set getlang [string tolower [channel get $chan lang]]
  1739. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1740. set getmsg $black(say.$getlang.antispam.2)
  1741. }
  1742. set replace(%nick%) $nick
  1743. set replace(%chan%) $chan
  1744. set spamsg [string map [array get replace] $getmsg]
  1745. puthelp "PRIVMSG $nick :$spamsg"
  1746. }
  1747. }
  1748. }
  1749. proc antispam:protect:cycle {min hour day mon year} {
  1750. global black
  1751. if {([scan $min %d]+([scan $hour %d]*60)) % $black(spamcycle) == 0} {
  1752. foreach chan [channels] {
  1753. if { [channel get $chan antispam]} {
  1754. putserv "PART $chan :$black(spammsgcycle)"; putserv "JOIN $chan"
  1755. }
  1756. }
  1757. }
  1758. }
  1759. ############################## AntiRepeat ###############################
  1760. proc antirepeat:protect {nick host hand chan arg} {
  1761. global black botnick count
  1762. set arg [join [split $arg]]
  1763. if {![validchan $chan]} { return 0 }
  1764. set getreason [channel get $chan antirepeat-reason]
  1765. if {$getreason == ""} {
  1766. set getlang [string tolower [channel get $chan lang]]
  1767. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1768. set getreason $black(say.$getlang.antirepeat.1)
  1769. }
  1770. set getbantime [channel get $chan antirepeat-bantime]
  1771. if {$getbantime == "0"} { set getbantime $black(antirepeatbantime) }
  1772. set replace(%chan%) $chan
  1773. set protectreason [string map [array get replace] $getreason]
  1774. set reason "$protectreason"
  1775. set repeatset [channel get $chan antirepeat-setting]
  1776. if {$repeatset == ""} { set repeatset "$black(repeats)" }
  1777. set number [scan $repeatset %\[^:\]]
  1778. set time [scan $repeatset %*\[^:\]:%s]
  1779. set banmask *!*@[lindex [split $host @] 1]
  1780. set handle [nick2hand $nick]
  1781. foreach tmr [utimers] {
  1782. if {[string match "*count(repeat:$host:$chan:$arg)*" [join [lindex $tmr 1]]]} {
  1783. killutimer [lindex $tmr 2]
  1784. }
  1785. }
  1786. if {[channel get $chan antirepeat]} {
  1787. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  1788. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  1789. if {![botisop $chan]} { return 0 }
  1790. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  1791. if {[isbotnick $nick]} { return 0 }
  1792. if {![info exists count(repeat:$host:$chan:$arg)]} {
  1793. set count(repeat:$host:$chan:$arg) 0
  1794. }
  1795. if {![info exists count(repeat:$host:$chan)]} {
  1796. set count(repeat:$host:$chan) 0
  1797. }
  1798. incr count(repeat:$host:$chan:$arg)
  1799. utimer $time [list unset count(repeat:$host:$chan:$arg)]
  1800. if {$count(repeat:$host:$chan:$arg) >= $number} {
  1801. if {$black(antirepeattype) == "0"} { set count(repeat:$host:$chan) 2 }
  1802. incr count(repeat:$host:$chan)
  1803. if {$count(repeat:$host:$chan) == 1} {
  1804. set getcount [channel get $chan kickcount]
  1805. set kcount [expr $getcount +1]
  1806. channel set $chan kickcount $kcount
  1807. if {[channel get $chan showcount]} {
  1808. set reason "$reason - $kcount -"
  1809. } else {
  1810. set reason "$reason"
  1811. }
  1812. putquick "KICK $chan $nick :$reason"
  1813. }
  1814. if {$count(repeat:$host:$chan) >= 2} {
  1815. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1816. unset count(repeat:$host:$chan)
  1817. }
  1818. }
  1819. }
  1820. }
  1821. proc antirepeat:protect:me {nick host hand chan keyword arg} {
  1822. antirepeat:protect $nick $host $hand $chan $arg
  1823. }
  1824. ############################# AntiColor ################################
  1825. proc anticolor:protect {nick host hand chan arg} {
  1826. global black botnick count
  1827. set arg [join [split $arg]]
  1828. if {![validchan $chan]} { return 0 }
  1829. set getreason [channel get $chan anticolor-reason]
  1830. if {$getreason == ""} {
  1831. set getlang [string tolower [channel get $chan lang]]
  1832. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1833. set getreason $black(say.$getlang.anticolor.1)
  1834. }
  1835. set getbantime [channel get $chan anticolor-bantime]
  1836. if {$getbantime == "0"} { set getbantime $black(anticolorbantime) }
  1837. set replace(%chan%) $chan
  1838. set protectreason [string map [array get replace] $getreason]
  1839. set reason "$protectreason"
  1840. set banmask *!*@[lindex [split $host @] 1]
  1841. set handle [nick2hand $nick]
  1842. if {[channel get $chan anticolor]} {
  1843. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  1844. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  1845. if {![botisop $chan]} { return 0 }
  1846. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  1847. if {[isbotnick $nick]} { return 0 }
  1848. if {![info exists count(color:$host:$chan)]} {
  1849. set count(color:$host:$chan) 0
  1850. }
  1851. if {[string match *\003* $arg]} {
  1852. incr count(color:$host:$chan)
  1853. if {$black(anticolortype) == "0" } { set count(color:$host:$chan) 2 }
  1854. if {$count(color:$host:$chan) == 1} {
  1855. set getcount [channel get $chan kickcount]
  1856. set kcount [expr $getcount +1]
  1857. channel set $chan kickcount $kcount
  1858. if {[channel get $chan showcount]} {
  1859. set reason "$reason - $kcount -"
  1860. } else {
  1861. set reason "$reason"
  1862. }
  1863. putquick "KICK $chan $nick :$reason"
  1864. }
  1865. if {$count(color:$host:$chan) == 2} {
  1866. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1867. unset count(color:$host:$chan)
  1868. }
  1869. }
  1870. }
  1871. }
  1872. proc anticolor:protect:me {nick host hand chan keyword arg} {
  1873. anticolor:protect $nick $host $hand $chan $arg
  1874. }
  1875. ############################# AntiBold ################################
  1876. proc antibold:protect {nick host hand chan arg} {
  1877. global black botnick count
  1878. set arg [split $arg]
  1879. if {![validchan $chan]} { return 0 }
  1880. set getreason [channel get $chan antibold-reason]
  1881. if {$getreason == ""} {
  1882. set getlang [string tolower [channel get $chan lang]]
  1883. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1884. set getreason $black(say.$getlang.antibold.1)
  1885. }
  1886. set getbantime [channel get $chan antibold-bantime]
  1887. if {$getbantime == "0"} { set getbantime $black(antiboldbantime) }
  1888. set replace(%chan%) $chan
  1889. set protectreason [string map [array get replace] $getreason]
  1890. set reason "$protectreason"
  1891. set banmask *!*@[lindex [split $host @] 1]
  1892. set handle [nick2hand $nick]
  1893. if {[channel get $chan antibold]} {
  1894. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  1895. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  1896. if {![botisop $chan]} { return 0 }
  1897. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  1898. if {[isbotnick $nick]} { return 0 }
  1899. if {![info exists count(bold:$host:$chan)]} {
  1900. set count(bold:$host:$chan) 0
  1901. }
  1902. if {[string match *\002* $arg]} {
  1903. incr count(bold:$host:$chan)
  1904. if {$black(antiboldtype) == "0" } { set count(bold:$host:$chan) 2 }
  1905. if {$count(bold:$host:$chan) == 1} {
  1906. set getcount [channel get $chan kickcount]
  1907. set kcount [expr $getcount +1]
  1908. channel set $chan kickcount $kcount
  1909. if {[channel get $chan showcount]} {
  1910. set reason "$reason - $kcount -"
  1911. } else {
  1912. set reason "$reason"
  1913. }
  1914. putquick "KICK $chan $nick :$reason"
  1915. }
  1916. if {$count(bold:$host:$chan) == 2} {
  1917. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1918. unset count(bold:$host:$chan)
  1919. }
  1920. }
  1921. }
  1922. }
  1923. proc antibold:protect:me {nick host hand chan keyword arg} {
  1924. antibold:protect $nick $host $hand $chan $arg
  1925. }
  1926. ############################ AntiUnderline ###############################
  1927. proc antiunderline:protect {nick host hand chan arg} {
  1928. global black botnick count
  1929. set arg [split $arg]
  1930. if {![validchan $chan]} { return 0 }
  1931. set getreason [channel get $chan antiunderline-reason]
  1932. if {$getreason == ""} {
  1933. set getlang [string tolower [channel get $chan lang]]
  1934. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1935. set getreason $black(say.$getlang.antiunderline.1)
  1936. }
  1937. set getbantime [channel get $chan antiunderline-bantime]
  1938. if {$getbantime == "0"} { set getbantime $black(antiunderlinebantime) }
  1939. set replace(%chan%) $chan
  1940. set protectreason [string map [array get replace] $getreason]
  1941. set reason "$protectreason"
  1942. set banmask *!*@[lindex [split $host @] 1]
  1943. set handle [nick2hand $nick]
  1944. if {[channel get $chan antiunderline]} {
  1945. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  1946. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  1947. if {![botisop $chan]} { return 0 }
  1948. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  1949. if {[isbotnick $nick]} { return 0 }
  1950. if {![info exists count(underline:$host:$chan)]} {
  1951. set count(underline:$host:$chan) 0
  1952. }
  1953. if {[string match *\037* $arg]} {
  1954. incr count(underline:$host:$chan)
  1955. if {$black(antiunderlinetype) == "0" } { set count(underline:$host:$chan) 2 }
  1956. if {$count(underline:$host:$chan) == 1} {
  1957. set getcount [channel get $chan kickcount]
  1958. set kcount [expr $getcount +1]
  1959. channel set $chan kickcount $kcount
  1960. if {[channel get $chan showcount]} {
  1961. set reason "$reason - $kcount -"
  1962. } else {
  1963. set reason "$reason"
  1964. }
  1965. putquick "KICK $chan $nick :$reason"
  1966. }
  1967. if {$count(underline:$host:$chan) == 2} {
  1968. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1969. unset count(underline:$host:$chan)
  1970. }
  1971. }
  1972. }
  1973. }
  1974. proc antiunderline:protect:me {nick host hand chan keyword arg} {
  1975. antiunderline:protect $nick $host $hand $chan $arg
  1976. }
  1977. ############################## AntiCaps #################################
  1978. proc anticaps:protect {nick host hand chan arg} {
  1979. global black botnick count
  1980. set handle [nick2hand $nick]
  1981. if {![validchan $chan]} { return 0 }
  1982. set getreason [channel get $chan anticaps-reason]
  1983. if {$getreason == ""} {
  1984. set getlang [string tolower [channel get $chan lang]]
  1985. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1986. set getreason $black(say.$getlang.anticaps.1)
  1987. }
  1988. set getbantime [channel get $chan anticaps-bantime]
  1989. if {$getbantime == "0"} { set getbantime $black(anticapsbantime) }
  1990. set replace(%chan%) $chan
  1991. set protectreason [string map [array get replace] $getreason]
  1992. set reason "$protectreason"
  1993. set banmask *!*@[lindex [split $host @] 1]
  1994. if {![info exists count(caps:$host:$chan)]} {
  1995. set count(caps:$host:$chan) 0
  1996. }
  1997. if {[channel get $chan anticaps]} {
  1998. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  1999. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  2000. if {![botisop $chan]} { return 0 }
  2001. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  2002. if {[isbotnick $nick]} { return 0 }
  2003. set caps($nick:$host) 0
  2004. foreach word [split $arg {}] {
  2005. if [string match \[A-Z\] $word] {
  2006. incr caps($nick:$host)
  2007. }
  2008. }
  2009. if {$caps($nick:$host) == 0} {
  2010. return 0
  2011. }
  2012. if {[string length $arg] < 20} {return 0}
  2013. set capchar [string length $arg]
  2014. set number $caps($nick:$host)/$capchar
  2015. if {[expr 100 * $caps($nick:$host) / $capchar] > $black(anticapscount)} {
  2016. incr count(caps:$host:$chan)
  2017. if {$black(anticapstype) == "0" } { set count(caps:$host:$chan) 2 }
  2018. if {$count(caps:$host:$chan) == 1} {
  2019. set getcount [channel get $chan kickcount]
  2020. set kcount [expr $getcount +1]
  2021. channel set $chan kickcount $kcount
  2022. if {[channel get $chan showcount]} {
  2023. set reason "$reason - $kcount -"
  2024. } else {
  2025. set reason "$reason"
  2026. }
  2027. putquick "KICK $chan $nick :$reason"
  2028. }
  2029. if {$count(caps:$host:$chan) == 2} {
  2030. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  2031. unset count(caps:$host:$chan)
  2032. }
  2033. }
  2034. }
  2035. }
  2036. proc anticaps:protect:me {nick host hand chan keyword arg} {
  2037. anticaps:protect $nick $host $hand $chan $arg
  2038. }
  2039. ################################ BadIdent #################################
  2040. proc badident:protect:join {nick host hand chan} {
  2041. global black botnick
  2042. if {![validchan $chan]} { return 0 }
  2043. set getreason [channel get $chan badident-reason]
  2044. if {$getreason == ""} {
  2045. set getlang [string tolower [channel get $chan lang]]
  2046. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  2047. set getreason $black(say.$getlang.badident.1)
  2048. }
  2049. set getbantime [channel get $chan badident-bantime]
  2050. if {$getbantime == "0"} { set getbantime $black(badidentbantime) }
  2051. set replace(%chan%) $chan
  2052. set protectreason [string map [array get replace] $getreason]
  2053. set reason "$protectreason"
  2054. set ident "[string trimleft [string tolower [lindex [split $host "@"] 0]] "~"]"
  2055. set banmask "*!*$ident@*"
  2056. if {![validchan $chan]} { return 0 }
  2057. if {[channel get $chan badident]} {
  2058. if {![botisop $chan]} { return 0 }
  2059. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  2060. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  2061. if {[matchattr $hand $black(exceptflags) $chan]} { return 0 }
  2062. foreach bit $black(badidentwords) {
  2063. if {[string match -nocase $bit $ident]} {
  2064. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  2065. }
  2066. }
  2067. }
  2068. }
  2069. ############################## BadFullname ###############################
  2070. proc badfullname:protect:join {nick host hand chan} {
  2071. global botnick black
  2072. set ::cchan $chan
  2073. set ::nnick $nick
  2074. set ::hhost $host
  2075. set handle [nick2hand $nick]
  2076. if { [channel get $chan badfullname] } {
  2077. if {![botisop $chan]} { return 0 }
  2078. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  2079. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  2080. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  2081. if {[onchan $nick $chan]} {
  2082. putquick "WHOIS $nick $nick"
  2083. bind RAW - 311 badfullname:protect
  2084. }
  2085. }
  2086. }
  2087. proc badfullname:protect { from keyword arguments } {
  2088. global botnick black
  2089. set chan $::cchan
  2090. set nick $::nnick
  2091. set host $::hhost
  2092. set getreason [channel get $chan badfullname-reason]
  2093. if {$getreason == ""} {
  2094. set getlang [string tolower [channel get $chan lang]]
  2095. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  2096. set getreason $black(say.$getlang.badfullname.1)
  2097. }
  2098. set getbantime [channel get $chan badfullname-bantime]
  2099. if {$getbantime == "0"} { set getbantime $black(badfbantime) }
  2100. set replace(%chan%) $chan
  2101. set protectreason [string map [array get replace] $getreason]
  2102. set reason "$protectreason"
  2103. set fullname [string range [join [lrange $arguments 5 end]] 1 end]
  2104. if {[onchan $nick $chan]} {
  2105. set banmask *!*@[lindex [split [getchanhost $nick $chan] "@"] 1]
  2106. }
  2107. foreach realname $black(badfwords) {
  2108. if {[string match -nocase $realname $fullname]} {
  2109. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  2110. }
  2111. }
  2112. unbind RAW - 311 badfullname:protect
  2113. }
  2114. ################################ BadNick #################################
  2115. proc badnick:protect:join {nick host hand chan} {
  2116. global black botnick
  2117. set handle [nick2hand $nick]
  2118. if {![validchan $chan]} { return 0 }
  2119. set getreason [channel get $chan badnick-reason]
  2120. if {$getreason == ""} {
  2121. set getlang [string tolower [channel get $chan lang]]
  2122. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  2123. set getreason $black(say.$getlang.badnick.1)
  2124. }
  2125. set getbantime [channel get $chan badnick-bantime]
  2126. if {$getbantime == "0"} { set getbantime $black(badnickbantime) }
  2127. set replace(%chan%) $chan
  2128. set protectreason [string map [array get replace] $getreason]
  2129. set reason "$protectreason"
  2130. set banmask "$nick*!*@*"
  2131. if {![validchan $chan]} { return 0 }
  2132. if {[channel get $chan badnick]} {
  2133. if {![botisop $chan]} { return 0 }
  2134. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  2135. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  2136. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  2137. foreach badnick [string tolower $black(badnickwords)] {
  2138. if {[string match $badnick [string tolower $nick]]} {
  2139. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  2140. }
  2141. }
  2142. }
  2143. }
  2144. proc badnick:protect:change {nick host hand chan newnick} {
  2145. global black botnick
  2146. set handle [nick2hand $nick]
  2147. if {![validchan $chan]} { return 0 }
  2148. set getreason [channel get $chan badnick-reason]
  2149. if {$getreason == ""} {
  2150. set getlang [string tolower [channel get $chan lang]]
  2151. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  2152. set getreason $black(say.$getlang.badnick.1)
  2153. }
  2154. set getbantime [channel get $chan badnick-bantime]
  2155. if {$getbantime == "0"} { set getbantime $black(badnickbantime) }
  2156. set replace(%chan%) $chan
  2157. set protectreason [string map [array get replace] $getreason]
  2158. set reason "$protectreason"
  2159. set banmask "$newnick*!*@*"
  2160. if {![validchan $chan]} { return 0 }
  2161. if {[channel get $chan badnick]} {
  2162. if {![botisop $chan]} { return 0 }
  2163. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  2164. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  2165. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  2166. foreach badnick [string tolower $black(badnickwords)] {
  2167. if {[string match $badnick [string tolower $newnick]]} {
  2168. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  2169. }
  2170. }
  2171. }
  2172. }
  2173. ########################### AntiJoinFlood ################################
  2174. proc joinflood:protect {nick host hand chan} {
  2175. global black count
  2176. if {[channel get $chan antijoinflood]} {
  2177. set getset [channel get $chan joinflood]
  2178. if {$getset == ""} { set getset "4 5" }
  2179. set number [lindex [split $getset] 0]
  2180. set time [lindex [split $getset] 1]
  2181. set replace(%chan%) $chan
  2182. foreach tmr [utimers] {
  2183. if {[string match "*count(joinflood:$chan)*" [join [lindex $tmr 1]]]} {
  2184. killutimer [lindex $tmr 2]
  2185. }
  2186. }
  2187. if {![info exists count(joinflood:$chan)]} {
  2188. set count(joinflood:$chan) 0
  2189. }
  2190. incr count(joinflood:$chan)
  2191. utimer $time [list unset count(joinflood:$chan)]
  2192. if {$count(joinflood:$chan) >= "$number"} {
  2193. if {![botisop $chan]} { return 0 }
  2194. putquick "MODE $chan +$black(modes)" ; utimer $black(nomodetime) [list putquick "MODE $chan -$black(modes)"]
  2195. if {$black(fjoinhow) == "1"} {
  2196. set getlang [string tolower [channel get $chan lang]]
  2197. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  2198. set getmessage $black(say.$getlang.antijoinflood.1)
  2199. set message [string map [array get replace] $getmessage]
  2200. puthelp "NOTICE @$chan :$message"
  2201. }
  2202. }
  2203. }
  2204. }
  2205. ########################## Login ###############################
  2206. proc loginpublic {my} {
  2207. global botnick black
  2208. putquick "$black(login)"
  2209. putquick "MODE $botnick :$black(xmod)"
  2210. }
  2211. proc publiclogin:Cmd {nick host hand chan arg} {
  2212. global botnick black
  2213. putquick "$black(login)"
  2214. putquick "MODE $botnick :$black(xmod)"
  2215. blacktools:tell:prv $nick $host $hand login.1 $black(chanserv)
  2216. }
  2217. ########################### User Protection ################################
  2218. proc protectpublic {nick host hand chan args} {
  2219. global black
  2220. set bans [lindex $args 1]
  2221. if {![botisop $chan]} { return 0 }
  2222. if {$bans == "*!*@*"} { putquick "MODE $chan -b $bans"
  2223. return 0
  2224. }
  2225. set list [userlist $black(exceptflags) $chan]
  2226. foreach user $list {
  2227. set hosts [getuser $user hosts]
  2228. foreach host $hosts {
  2229. if {[string match -nocase $bans $host]} {
  2230. putquick "MODE $chan -b $bans"
  2231. if {[onchan $black(chanserv) $chan]} {
  2232. putquick "PRIVMSG $black(chanserv) :unban $chan $bans"
  2233. }
  2234. }
  2235. }
  2236. }
  2237. }
  2238. ############################## AntiChanFlood ###############################
  2239. proc antifloodchan:protect {nick host hand chan arg} {
  2240. global black botnick count
  2241. set arg [split $arg]
  2242. if {![validchan $chan]} { return 0 }
  2243. set getreason [channel get $chan antichanflood-reason]
  2244. if {$getreason == ""} {
  2245. set getlang [string tolower [channel get $chan lang]]
  2246. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  2247. set getreason $black(say.$getlang.antichanflood.1)
  2248. }
  2249. set getbantime [channel get $chan antichanflood-bantime]
  2250. if {$getbantime == "0"} { set getbantime $black(antifloodchanbantime) }
  2251. set replace(%chan%) $chan
  2252. set getset [channel get $chan chanflood]
  2253. if {$getset == ""} { set getset "4 5" }
  2254. set protectreason [string map [array get replace] $getreason]
  2255. set reason "$protectreason"
  2256. set number [lindex [split $getset] 0]
  2257. set time [lindex [split $getset] 1]
  2258. set banmask *!*@[lindex [split $host @] 1]
  2259. set handle [nick2hand $nick]
  2260. foreach tmr [utimers] {
  2261. if {[string match "*count(repeat:$host:$chan:flood)*" [join [lindex $tmr 1]]]} {
  2262. killutimer [lindex $tmr 2]
  2263. }
  2264. }
  2265. if {[channel get $chan antichanflood]} {
  2266. if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
  2267. if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
  2268. if {![botisop $chan]} { return 0 }
  2269. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  2270. if {[isbotnick $nick]} { return 0 }
  2271. if {![info exists count(repeat:$host:$chan:flood)]} {
  2272. set count(repeat:$host:$chan:flood) 0
  2273. }
  2274. if {![info exists count(repeat:$host:$chan)]} {
  2275. set count(repeat:$host:$chan) 0
  2276. }
  2277. incr count(repeat:$host:$chan:flood)
  2278. utimer $time [list unset count(repeat:$host:$chan:flood)]
  2279. if {$count(repeat:$host:$chan:flood) >= $number} {
  2280. if {$black(antifloodchantype) == "0"} { set count(repeat:$host:$chan) 2 }
  2281. incr count(repeat:$host:$chan)
  2282. if {$count(repeat:$host:$chan) == 1} {
  2283. set getcount [channel get $chan kickcount]
  2284. set kcount [expr $getcount +1]
  2285. channel set $chan kickcount $kcount
  2286. if {[channel get $chan showcount]} {
  2287. set reason "$reason - $kcount -"
  2288. } else {
  2289. set reason "$reason"
  2290. }
  2291. putquick "KICK $chan $nick :$reason"
  2292. }
  2293. if {$count(repeat:$host:$chan) >= 2} {
  2294. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  2295. unset count(repeat:$host:$chan)
  2296. }
  2297. }
  2298. }
  2299. }
  2300. proc antifloodchan:protect:me {nick host hand chan keyword arg} {
  2301. antirepeat:protect $nick $host $hand $chan $arg
  2302. }
  2303. ################################# reban ################################
  2304. proc rebanpublic {nick host hand chan} {
  2305. global black
  2306. if {[channel get $chan xban]} {
  2307. set host "$nick![getchanhost $nick $chan]"
  2308. set getxtime [channel get $chan xbantime]
  2309. set getxlevel [channel get $chan xbanlevel]
  2310. if {$getxlevel == "0"} { set getxlevel "100" }
  2311. if {$getxtime == "0"} { set getxtime "1" }
  2312. foreach ban [banlist $chan] {
  2313. set reason "[lindex $ban 1]"
  2314. if {[string match -nocase [string tolower [lindex $ban 0]] $host]} {
  2315. putquick "PRIVMSG $black(chanserv) :ban $chan [lindex $ban 0] $getxtime $getxlevel $reason"
  2316. }
  2317. }
  2318. }
  2319. }
  2320. ################################# XTOOLS ################################
  2321. proc toolspublic {chan type} {
  2322. global botnick black
  2323. if {![channel get $chan xtools]} {
  2324. return 0
  2325. }
  2326. if {$type == "op"} {
  2327. if {![onchan "$black(chanserv)" $chan] && ![botisop $chan]} {
  2328. return 0
  2329. }
  2330. putquick "PRIVMSG $black(chanserv) :unban $chan $botnick"
  2331. putquick "PRIVMSG $black(chanserv) :op $chan $botnick"
  2332. return 0
  2333. }
  2334. if {$type == "unban"} {
  2335. putquick "PRIVMSG $black(chanserv) :unban $chan $botnick"
  2336. return 0
  2337. }
  2338. if {$type == "invite" || $type == "limit"} {
  2339. putquick "PRIVMSG $black(chanserv) :invite $chan $botnick"
  2340. return 0
  2341. }
  2342. }
  2343. ################################# Clone Scan ###################################
  2344. proc scannerpublic {nick host hand chan arg} {
  2345. global black count
  2346. set c [lindex [split $arg] 0]
  2347. set type 0
  2348. set chan1 "$chan"
  2349. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  2350. set chan "$c"
  2351. }
  2352. scanner:process $nick $host $hand $chan $chan1
  2353. }
  2354. proc scanner:process {nick host hand chan chan1} {
  2355. global botnick black
  2356. array set clones [list]
  2357. if {![validchan $chan]} {
  2358. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  2359. return 0
  2360. }
  2361. if {![onchan $botnick $chan]} {
  2362. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  2363. return 0
  2364. }
  2365. blacktools:tell $nick $host $hand $chan $chan1 clonescan.4 none
  2366. foreach user [chanlist $chan] {
  2367. set host [string tolower [lindex [split [getchanhost $user $chan] @] 1]]
  2368. if {![string match "*.undernet.org*" $host]} {
  2369. if {!($black(maxclone) >= "2")} { return 0 }
  2370. if {![info exists c($host:$chan)]} {
  2371. set c($host:$chan) 0
  2372. }
  2373. set c($host:$chan) [expr $c($host:$chan) +1]
  2374. lappend clones($user) $host
  2375. if {$c($host:$chan) >= $black(maxclone)} {
  2376. foreach clon [lsort -unique [array names clones]] {
  2377. set hosts [string tolower [lindex [split [getchanhost $clon $chan] @] 1]]
  2378. if {$host == $hosts} {
  2379. lappend clona($host) [join $clon " , "]
  2380. }
  2381. }
  2382. blacktools:tell $nick $host $hand $chan $chan1 clonescan.1 "$c($host:$chan) $host [lsort -unique $clona($host)]"
  2383. }
  2384. utimer 3 [list blacktools:tell $nick $host $hand $chan $chan1 clonescan.2 none]
  2385. }
  2386. }
  2387. }
  2388. proc clonescanner {minute hour day month year} {
  2389. global black botnick
  2390. foreach chan [channels] {
  2391. set replace(%chan%) $chan
  2392. if {[channel get $chan clonescan]} {
  2393. putlog "Scaning for clones on $chan.."
  2394. foreach user [chanlist $chan] {
  2395. set host [string tolower [lindex [split [getchanhost $user $chan] @] 1]]
  2396. set replace(%host%) $host
  2397. if {![info exists c($host:$chan)]} {
  2398. set c($host:$chan) 0
  2399. }
  2400. array set clones [list]
  2401. if {![string match "*.undernet.org*" $host]} {
  2402. if {!($black(maxclone) >= "2")} { return 0 }
  2403. set c($host:$chan) [expr $c($host:$chan) +1]
  2404. lappend clones($user) $host
  2405. if {$c($host:$chan) >= $black(maxclone)} {
  2406. foreach clon [array names clones] {
  2407. set hosts [string tolower [lindex [split [getchanhost $clon $chan] @] 1]]
  2408. if {$host == $hosts} {
  2409. lappend clona($host) [join $clon " , "]
  2410. }
  2411. }
  2412. set replace(%num%) $c($host:$chan)
  2413. set replace(%clone%) [lsort -unique $clona($host)]
  2414. if {$black(what) == "0"} {
  2415. set getlang [string tolower [channel get $chan lang]]
  2416. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  2417. putserv "NOTICE @$chan :[string map [array get replace] $black(say.$getlang.clonescan.3)]"
  2418. }
  2419. if {$black(what) == "1"} {
  2420. set banmask *!*@[lindex [split $host @] 1]
  2421. set reason [string map [array get replace] $black(reason)]
  2422. blacktools:banner:2 $banmask $botnick $chan $reason $black(clonebtime)
  2423. }
  2424. }
  2425. }
  2426. }
  2427. }
  2428. }
  2429. }
  2430. ############################# Topic refresh #########################
  2431. proc refreshpublic {nick host hand chan arg} {
  2432. global botnick black
  2433. set thetopic [topic $chan]
  2434. puthelp "TOPIC $chan :$black(topics)"
  2435. puthelp "TOPIC $chan :$thetopic"
  2436. }
  2437. proc times_topic {} {
  2438. global black
  2439. foreach chan [channels] {
  2440. if {[channel get $chan topicrefresh] } {
  2441. set thetopic [topic $chan]
  2442. puthelp "TOPIC $chan :$black(topics)"
  2443. puthelp "TOPIC $chan :$thetopic"
  2444. }
  2445. }
  2446. timer $black(topic_time) times_topic
  2447. return 1
  2448. }
  2449. ################################ count ####################################
  2450. proc countpublic {nick host hand chan arg} {
  2451. global black
  2452. set type 0
  2453. set chan1 "$chan"
  2454. set why [lindex [split $arg] 0]
  2455. if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
  2456. set chan "$why"
  2457. set why [lindex [split $arg] 1]
  2458. }
  2459. count:process $nick $host $hand $chan $chan1 $why $type
  2460. }
  2461. proc count:process {nick host hand chan chan1 why type} {
  2462. global botnick black
  2463. set char(p) [lindex $black(cmdchar) 0]
  2464. if {[string match -nocase "$char(p)" "none"]} {
  2465. set char(p) ""
  2466. }
  2467. if {[matchattr $hand nm|- $chan]} {
  2468. if {($why == "") && ($type == "0")} {
  2469. blacktools:tell $nick $host $hand $chan $chan1 count.1 none
  2470. return 0
  2471. }
  2472. if {($why == "") && ($type == "1")} {
  2473. blacktools:tell $nick $host $hand $chan $chan1 count.2 none
  2474. return 0
  2475. }
  2476. }
  2477. if {($why == "") && ($type == "0")} {
  2478. blacktools:tell $nick $host $hand $chan $chan1 count.3 none
  2479. return 0
  2480. }
  2481. if {($why == "") && ($type == "1")} {
  2482. blacktools:tell $nick $host $hand $chan $chan1 count.4 none
  2483. return 0
  2484. }
  2485. if {![validchan $chan]} {
  2486. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  2487. return 0
  2488. }
  2489. if {![onchan $botnick $chan]} {
  2490. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  2491. return 0
  2492. }
  2493. if { [channel get $chan count] } { set countstats "on" } else { set countstats "off"}
  2494. if {($countstats == "on") && ($why == "on")} { blacktools:tell $nick $host $hand $chan $chan1 count.5 none
  2495. return 0
  2496. }
  2497. if {($countstats == "off") && ($why == "off")} { blacktools:tell $nick $host $hand $chan $chan1 count.6 none
  2498. return 0
  2499. }
  2500. if {([regexp -nocase -- {(#[0-9]+|on|off|display|reset)} $why tmp counter]) && (![regexp -nocase -- {\S#} $why])} {
  2501. switch $counter {
  2502. on {
  2503. channel set $chan +count
  2504. blacktools:tell $nick $host $hand $chan $chan1 count.7 none
  2505. }
  2506. off {
  2507. channel set $chan -count
  2508. blacktools:tell $nick $host $hand $chan $chan1 count.8 none
  2509. }
  2510. display {
  2511. set stats [channel get $chan countnumber]
  2512. blacktools:tell $nick $host $hand $chan $chan1 count.9 $stats
  2513. }
  2514. reset {
  2515. channel set $chan countnumber 0
  2516. blacktools:tell $nick $host $hand $chan $chan1 count.10 none
  2517. }
  2518. }
  2519. }
  2520. }
  2521. proc countpublic:join {nick host hand chan} {
  2522. global black
  2523. if {[isbotnick $nick]} { return 0}
  2524. if {[channel get $chan count]} {
  2525. set stats [channel get $chan countnumber]
  2526. set counting [expr $stats +1]
  2527. channel set $chan countnumber $counting
  2528. set replace(%num%) $counting
  2529. set replace(%chan%) $chan
  2530. set countmes [channel get $chan count-message]
  2531. if {$countmes == ""} {
  2532. set getlang [string tolower [channel get $chan lang]]
  2533. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  2534. set countmessage [string map [array get replace] $black(say.$getlang.count.11)]
  2535. }
  2536. putquick "NOTICE $nick :$countmessage"
  2537. }
  2538. }
  2539. ############################### Private ##########################
  2540. proc privatepublic {nick host hand chan arg} {
  2541. global black
  2542. set type 0
  2543. set chan1 "$chan"
  2544. set why [lindex [split $arg] 0]
  2545. set user [lindex [split $arg] 1]
  2546. set host [lindex [split $arg] 2]
  2547. if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
  2548. set chan "$why"
  2549. set why [lindex [split $arg] 1]
  2550. set user [lindex [split $arg] 2]
  2551. set host [lindex [split $arg] 3]
  2552. }
  2553. private:process $nick $host $hand $chan $chan1 $why $user $host $type
  2554. }
  2555. proc private:process {nick host hand chan chan1 why user host type} {
  2556. global botnick black
  2557. set char(p) [lindex $black(cmdchar) 0]
  2558. if {[string match -nocase "$char(p)" "none"]} {
  2559. set char(p) ""
  2560. }
  2561. set flags "-|f"
  2562. if {[matchattr $hand nm|- $chan]} {
  2563. if {($why == "") && ($type == "0")} {
  2564. blacktools:tell $nick $host $hand $chan $chan1 private.1 none
  2565. return 0
  2566. }
  2567. if {($why == "") && ($type == "1")} {
  2568. blacktools:tell $nick $host $hand $chan $chan1 private.2 none
  2569. return 0
  2570. }
  2571. }
  2572. if {($why == "") && ($type == "0")} {
  2573. blacktools:tell $nick $host $hand $chan $chan1 private.3 none
  2574. return 0
  2575. }
  2576. if {($why == "") && ($type == "1")} {
  2577. blacktools:tell $nick $host $hand $chan $chan1 private.4 none
  2578. return 0
  2579. }
  2580. if {![validchan $chan]} {
  2581. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  2582. return 0
  2583. }
  2584. if {![onchan $botnick $chan]} {
  2585. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  2586. return 0
  2587. }
  2588. if {([regexp -nocase -- {(#[0-9]+|on|off|add|list|del)} $why tmp privat]) && (![regexp -nocase -- {\S#} $why])} {
  2589. switch $privat {
  2590. on {
  2591. channel set $chan +private
  2592. blacktools:tell $nick $host $hand $chan $chan1 private.5 none
  2593. }
  2594. off {
  2595. channel set $chan -private
  2596. blacktools:tell $nick $host $hand $chan $chan1 private.6 none
  2597. }
  2598. add {
  2599. if {[validuser $user]} {
  2600. chattr $user $flags $chan
  2601. blacktools:tell $nick $host $hand $chan $chan1 private.7 $user
  2602. return 0
  2603. }
  2604. adduser $user $host
  2605. chattr $user $flags $chan
  2606. blacktools:tell $nick $host $hand $chan $chan1 private.8 "$user $host"
  2607. }
  2608. del {
  2609. if {[validuser $user]} {
  2610. chattr $user -|-f $chan
  2611. blacktools:tell $nick $host $hand $chan $chan1 private.9 $user
  2612. } else { blacktools:tell $nick $host $hand $chan $chan1 private.10 $user
  2613. return 0
  2614. }
  2615. }
  2616. list {
  2617. set list [userlist $flags $chan]
  2618. blacktools:tell $nick $host $hand $chan $chan1 private.11 $list
  2619. }
  2620. }
  2621. }
  2622. }
  2623. proc private:module {nick host hand chan} {
  2624. global black botnick
  2625. set getreason [channel get $chan private-reason]
  2626. if {$getreason == ""} {
  2627. set getlang [string tolower [channel get $chan lang]]
  2628. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  2629. set getreason $black(say.$getlang.private.12)
  2630. }
  2631. set getbantime [channel get $chan private-bantime]
  2632. if {$getbantime == "0"} { set getbantime $black(privatebantime) }
  2633. set handle [nick2hand $nick]
  2634. set mask "*!*@[lindex [split $host @] 1]"
  2635. if {[channel get $chan private]} {
  2636. if {[matchattr $handle nm|oMASOVf $chan]} {
  2637. return 0
  2638. }
  2639. newchanban $chan $mask $botnick $getreason $getbantime
  2640. }
  2641. }
  2642. ############################### BadChan ###########################
  2643. proc badchanpublic {nick host hand chan arg} {
  2644. global black
  2645. set why [lindex [split $arg] 0]
  2646. set type 0
  2647. set chan1 "$chan"
  2648. set bdchan [join [lindex [split $arg] 1]]
  2649. if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
  2650. set chan "$why"
  2651. set why [lindex [split $arg] 1]
  2652. set bdchan [join [lindex [split $arg] 2]]
  2653. }
  2654. badchan:process $nick $host $hand $chan $chan1 $why $bdchan $type
  2655. }
  2656. proc badchan:process {nick host hand chan chan1 why bdchan type} {
  2657. global botnick black
  2658. set flag "antibadchan"
  2659. set char(p) [lindex $black(cmdchar) 0]
  2660. if {[string match -nocase "$char(p)" "none"]} {
  2661. set char(p) ""
  2662. }
  2663. set dir "logs/badchan($chan).txt"
  2664. if {[matchattr $hand nm|- $chan]} {
  2665. if {($why == "") && ($type == "0")} {
  2666. blacktools:tell $nick $host $hand $chan $chan1 badchan.1 none
  2667. return 0
  2668. }
  2669. if {($why == "") && ($type == "1")} {
  2670. blacktools:tell $nick $host $hand $chan $chan1 badchan.2 none
  2671. return 0
  2672. }
  2673. }
  2674. if {($why == "") && ($type == "0")} {
  2675. blacktools:tell $nick $host $hand $chan $chan1 badchan.3 none
  2676. return 0
  2677. }
  2678. if {($why == "") && ($type == "1")} {
  2679. blacktools:tell $nick $host $hand $chan $chan1 badchan.4 none
  2680. return 0
  2681. }
  2682. if {![validchan $chan]} {
  2683. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  2684. return 0
  2685. }
  2686. if {![onchan $botnick $chan]} {
  2687. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  2688. return 0
  2689. }
  2690. if {([regexp -nocase -- {(#[0-9]+|on|off|add|list|del)} $why tmp bc]) && (![regexp -nocase -- {\S#} $why])} {
  2691. switch $bc {
  2692. on {
  2693. channel set $chan +$flag
  2694. blacktools:tell $nick $host $hand $chan $chan1 badchan.5 none
  2695. }
  2696. off {
  2697. channel set $chan -$flag
  2698. blacktools:tell $nick $host $hand $chan $chan1 badchan.6 none
  2699. }
  2700. add {
  2701. if {[file exists $dir] == 0} {
  2702. set file [open $dir w]
  2703. close $file
  2704. }
  2705. set file [open $dir a]
  2706. puts $file $bdchan
  2707. close $file
  2708. blacktools:tell $nick $host $hand $chan $chan1 badchan.7 $bdchan
  2709. }
  2710. list {
  2711. if {[file exists $dir] == 0} {
  2712. set file [open $dir w]
  2713. close $file
  2714. }
  2715. set dir "logs/badchan($chan).txt"
  2716. set file [open $dir "r"]
  2717. set w [read -nonewline $file]
  2718. close $file
  2719. set data [split $w "\n"]
  2720. set i 0
  2721. if {$data == ""} { blacktools:tell $nick $host $hand $chan $chan1 badchan.8 none
  2722. return 0
  2723. }
  2724. foreach cc $data {
  2725. set i [expr $i +1]
  2726. blacktools:tell $nick $host $hand $chan $chan1 badchan.9 none
  2727. blacktools:tell $nick $host $hand $chan $chan1 badchan.10 "$i. $cc"
  2728. }
  2729. }
  2730. del {
  2731. if {![regexp {^[0-9]} $bdchan]} {
  2732. blacktools:tell $nick $host $hand $chan $chan1 badchan.11 none
  2733. return 0
  2734. }
  2735. if {[file exists $dir] == 0} {
  2736. set file [open $dir w]
  2737. close $file
  2738. }
  2739. set file [open $dir "r"]
  2740. set data [read -nonewline $file]
  2741. close $file
  2742. set lines [split $data "\n"]
  2743. set i [expr $bdchan - 1]
  2744. set delete [lreplace $lines $i $i]
  2745. set file [open $dir "w"]
  2746. puts $file [join $delete "\n"]
  2747. close $file
  2748. set file [open $dir "r"]
  2749. set data [read -nonewline $file]
  2750. close $file
  2751. if {$data == ""} {
  2752. set files [open $dir "w"]
  2753. close $files
  2754. }
  2755. blacktools:tell $nick $host $hand $chan $chan1 badchan.12 $bdchan
  2756. blacktools:tell $nick $host $hand $chan $chan1 badchan.13 none
  2757. }
  2758. }
  2759. }
  2760. }
  2761. proc badchanpublic:join {nick host hand chan} {
  2762. global black
  2763. set handle [nick2hand $nick]
  2764. set ::ccchan $chan
  2765. if {![validchan $chan]} {
  2766. return 0
  2767. }
  2768. if {[matchattr $handle nm|MASoOVv $chan]} { return 0 }
  2769. if {![botisop $chan]} { return 0 }
  2770. if {[isbotnick $nick]} { return 0 }
  2771. if {[channel get $chan antibadchan]} {
  2772. if {[onchan $nick $chan]} {
  2773. utimer 5 [list putquick "WHOIS $nick $nick"]
  2774. bind RAW - 319 badchanpublic:ban
  2775. }
  2776. }
  2777. }
  2778. proc badchanpublic:ban {from keyword arguments } {
  2779. global botnick black
  2780. set chan $::ccchan
  2781. set arguments [join $arguments]
  2782. set nick [string tolower [lindex $arguments 1]]
  2783. set replace(%chan%) $chan
  2784. set replace(%nick%) $nick
  2785. set handle [nick2hand $nick]
  2786. set args [join $arguments]
  2787. set getreason [channel get $chan badchan-reason]
  2788. if {$getreason == ""} {
  2789. set getlang [string tolower [channel get $chan lang]]
  2790. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  2791. set getreason $black(say.$getlang.badchan.14)
  2792. }
  2793. set getbantime [channel get $chan badchan-bantime]
  2794. if {$getbantime == "0"} { set getbantime $black(badcbantime) }
  2795. if {[channel get $chan antibadchan]} {
  2796. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  2797. set protectreason [string map [array get replace] $getreason]
  2798. set reason "$protectreason"
  2799. set channels [string tolower [lrange $args 2 end]]
  2800. set banmask *!*@[lindex [split [getchanhost $nick $chan] "@"] 1]
  2801. set dir "logs/badchan($chan).txt"
  2802. if {[file exists $dir] == 0} {
  2803. set file [open $dir w]
  2804. close $file
  2805. }
  2806. set file [open $dir "r"]
  2807. set w [read -nonewline $file]
  2808. close $file
  2809. set bchan [split $w "\n"]
  2810. if {$w == ""} { return 0 }
  2811. foreach badchan $bchan {
  2812. set replace(%bchan%) $badchan
  2813. set getlang [string tolower [channel get $chan lang]]
  2814. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  2815. set protectmsg [string map [array get replace] $black(say.$getlang.badchan.15)]
  2816. foreach c $channels {
  2817. set ch [string trimleft $c ":@+"]
  2818. if {[string match -nocase $badchan $ch]} {
  2819. blacktools:banner:2 $banmask $botnick $chan $getreason $getbantime
  2820. putserv "PRIVMSG $nick :$protectmsg"
  2821. }
  2822. }
  2823. }
  2824. }
  2825. }
  2826. ################################# Antitake ##################################
  2827. proc dontdeoppublic {nick host hand chan args} {
  2828. global black botnick
  2829. set dnick [lindex $args 1]
  2830. set handle [nick2hand $nick]
  2831. if {[channel get $chan dontdeop] } {
  2832. if {[string match -nocase $nick $botnick]} {
  2833. return 0
  2834. }
  2835. if {![matchattr $handle $black(exceptflags) $chan]} {
  2836. putquick "MODE $chan -o $nick"
  2837. putquick "MODE $chan +o $dnick"
  2838. set getlang [string tolower [channel get $chan lang]]
  2839. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  2840. puthelp "NOTICE $nick :$black(say.$getlang.antitake.1)"
  2841. }
  2842. }
  2843. }
  2844. proc dontoppublic {nick host hand chan args} {
  2845. global black botnick
  2846. set onick [lindex $args 1]
  2847. set handle [nick2hand $nick]
  2848. if {[channel get $chan dontop]} {
  2849. if {[string match -nocase $nick $botnick]} {
  2850. return 0
  2851. }
  2852. if {[string match -nocase $onick $botnick]} {
  2853. return 0
  2854. }
  2855. if {![matchattr $handle $black(exceptflags) $chan]} {
  2856. putquick "MODE $chan -o $nick"
  2857. putquick "MODE $chan -o $onick"
  2858. set getlang [string tolower [channel get $chan lang]]
  2859. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  2860. puthelp "NOTICE $nick :$black(say.$getlang.antitake.2)"
  2861. }
  2862. }
  2863. }
  2864. ################################# Anunt ###################################
  2865. proc anuntpublic {nick host hand chan arg} {
  2866. global black
  2867. set type 0
  2868. set chan1 "$chan"
  2869. set who [lindex [split $arg] 0]
  2870. set message [join [lrange [split $arg] 1 end]]
  2871. set number [lindex [split $arg] 1]
  2872. if {[regexp {^[\\+!#&]} $who] && [matchattr $hand nm|- $chan]} {
  2873. set chan "$who"
  2874. set who [lindex [split $arg] 1]
  2875. set message [join [lrange [split $arg] 2 end]]
  2876. set number [lindex [split $arg] 2]
  2877. }
  2878. anunt:process $nick $host $hand $chan $chan1 $who $message $number $type
  2879. }
  2880. proc anunt:process {nick host hand chan chan1 who message number type} {
  2881. global botnick black
  2882. set char(p) [lindex $black(cmdchar) 0]
  2883. if {[string match -nocase "$char(p)" "none"]} {
  2884. set char(p) ""
  2885. }
  2886. set dir "logs/anunt($chan).txt"
  2887. if {[matchattr $hand nm|- $chan]} {
  2888. if {($who == "") && ($type == "0")} {
  2889. blacktools:tell $nick $host $hand $chan $chan1 anunt.1 none
  2890. return 0
  2891. }
  2892. if {($who == "") && ($type == "1")} {
  2893. blacktools:tell $nick $host $hand $chan $chan1 anunt.2 none
  2894. return 0
  2895. }
  2896. }
  2897. if {($who == "") && ($type == "0")} {
  2898. blacktools:tell $nick $host $hand $chan $chan1 anunt.3 none
  2899. return 0
  2900. }
  2901. if {($who == "") && ($type == "1")} {
  2902. blacktools:tell $nick $host $hand $chan $chan1 anunt.4 none
  2903. return 0
  2904. }
  2905. if {![validchan $chan]} {
  2906. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  2907. return 0
  2908. }
  2909. if {![onchan $botnick $chan]} {
  2910. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  2911. return 0
  2912. }
  2913. if {([regexp -nocase -- {(#[0-9]+|on|off|add|list|del)} $who tmp a]) && (![regexp -nocase -- {\S#} $who])} {
  2914. switch $a {
  2915. on {
  2916. channel set $chan +anunt
  2917. blacktools:tell $nick $host $hand $chan $chan1 anunt.5 none
  2918. }
  2919. off {
  2920. channel set $chan -anunt
  2921. blacktools:tell $nick $host $hand $chan $chan1 anunt.6 none
  2922. }
  2923. add {
  2924. if {[file exists $dir] == 0} {
  2925. set file [open $dir w]
  2926. close $file
  2927. }
  2928. set file [open $dir a]
  2929. puts $file $message
  2930. close $file
  2931. blacktools:tell $nick $host $hand $chan $chan1 anunt.7 none
  2932. blacktools:tell $nick $host $hand $chan $chan1 anunt.8 $message
  2933. }
  2934. list {
  2935. if {[file exists $dir] == 0} {
  2936. set file [open $dir w]
  2937. close $file
  2938. }
  2939. set file [open $dir "r"]
  2940. set w [read -nonewline $file]
  2941. close $file
  2942. set data [split $w "\n"]
  2943. set i 0
  2944. if {$data == ""} { blacktools:tell $nick $host $hand $chan $chan1 anunt.9 none
  2945. return 0
  2946. }
  2947. foreach mes $data {
  2948. set i [expr $i +1]
  2949. blacktools:tell $nick $host $hand $chan $chan1 anunt.10 none
  2950. blacktools:tell $nick $host $hand $chan $chan1 anunt.8 "$i. $mes"
  2951. }
  2952. }
  2953. del {
  2954. if {![regexp {^[0-9]} $number]} {
  2955. blacktools:tell $nick $host $hand $chan $chan1 anunt.11 none
  2956. return 0
  2957. }
  2958. set dir "logs/anunt($chan).txt"
  2959. if {[file exists $dir] == 0} {
  2960. set file [open $dir w]
  2961. close $file
  2962. }
  2963. set file [open $dir "r"]
  2964. set data [read -nonewline $file]
  2965. close $file
  2966. set lines [split $data "\n"]
  2967. set i [expr $number - 1]
  2968. set delete [lreplace $lines $i $i]
  2969. set files [open $dir "w"]
  2970. puts $files [join $delete "\n"]
  2971. close $files
  2972. set file [open $dir "r"]
  2973. set data [read -nonewline $file]
  2974. close $file
  2975. if {$data == ""} {
  2976. set files [open $dir "w"]
  2977. close $files
  2978. }
  2979. blacktools:tell $nick $host $hand $chan $chan1 anunt.12 $number
  2980. blacktools:tell $nick $host $hand $chan $chan1 anunt.13 none
  2981. }
  2982. }
  2983. }
  2984. }
  2985. proc anuntpublic:show {} {
  2986. global black count
  2987. foreach chan [channels] {
  2988. if {[validchan $chan]} {
  2989. set dir "logs/anunt($chan).txt"
  2990. if {[channel get $chan anunt]} {
  2991. if {![info exists count(anunt:$chan)]} {
  2992. set count(anunt:$chan) 0
  2993. }
  2994. if {[file exists $dir] == 0} {
  2995. set file [open $dir w]
  2996. close $file
  2997. }
  2998. set file [open $dir "r"]
  2999. set data [read -nonewline $file]
  3000. close $file
  3001. set lines [split $data "\n"]
  3002. set line [lindex $lines $count(anunt:$chan)]
  3003. incr count(anunt:$chan)
  3004. if {$line == ""} {
  3005. unset count(anunt:$chan)
  3006. }
  3007. if {$black(anunthow) == "1"} {
  3008. puthelp "PRIVMSG $chan :\001ACTION $line\001"
  3009. } else {
  3010. puthelp "PRIVMSG $chan :$line"
  3011. }
  3012. }
  3013. }
  3014. }
  3015. timer $black(anunttime) anuntpublic:show
  3016. return 1
  3017. }
  3018. ################################## TimeBan #############################
  3019. proc timeban:module {nick host hand chan} {
  3020. global botnick
  3021. if {[channel get $chan showtime]} {
  3022. set host "$nick![getchanhost $nick $chan]"
  3023. foreach ban [banlist $chan] {
  3024. if {[string match -nocase [string tolower [lindex $ban 0]] $host]} {
  3025. set reason "[lindex $ban 1]"
  3026. set bantime "[lindex $ban 2]"
  3027. set totalday [expr $bantime - [unixtime]]
  3028. if {$totalday >= 86400} {
  3029. set daysfull [expr $totalday/86400]
  3030. set days [expr int($daysfull)]
  3031. set dayssub [expr 86400*$days]
  3032. set totalhour [expr $totalday - $dayssub]
  3033. }
  3034. if {$totalday < 86400} {
  3035. set totalhour $totalday
  3036. set days 0
  3037. }
  3038. if {$totalhour >= 3600} {
  3039. set hoursfull [expr $totalhour/3600]
  3040. set hours [expr int($hoursfull)]
  3041. set hourssub [expr 3600*$hours]
  3042. set totalmin [expr $totalhour - $hourssub]
  3043. }
  3044. if {$totalhour < 3600} {
  3045. set totalmin $totalhour
  3046. set hours 0
  3047. }
  3048. if {$totalmin >= 60} {
  3049. set minsfull [expr $totalmin/60]
  3050. set mins [expr int($minsfull)]
  3051. }
  3052. if {$totalmin < 60} {
  3053. set mins 0
  3054. }
  3055. if {$days < 1} {set zi "0 zile, "} elseif {$days == 1} {set zi "$days zi, "} {set zi "$days zile, "}
  3056. if {$hours < 1} {set ora "0"} else { set ora "$hours" }
  3057. set minut "$mins"
  3058. set re "$reason Expire :$zi$ora:$minut"
  3059. if {[lindex $ban 2] == 0} {
  3060. set expire "Expire :Perm Ban"
  3061. set re "$reason $expire"
  3062. }
  3063. putquick "MODE $chan +b [lindex $ban 0]"
  3064. putquick "KICK $chan $nick :$re"
  3065. }
  3066. }
  3067. }
  3068. }
  3069. ############################### AutoBroadcast ############################
  3070. proc broadcastpublic:module {nick host hand chan arg} {
  3071. global black sdir
  3072. set char(p) [lindex $black(cmdchar) 0]
  3073. if {[string match -nocase "$char(p)" "none"]} {
  3074. set char(p) ""
  3075. }
  3076. set chan1 "$chan"
  3077. set who [lindex [split $arg] 0]
  3078. set message [join [lrange [split $arg] 1 end]]
  3079. set number [lindex [split $arg] 1]
  3080. if {$who == ""} { blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.1 none
  3081. return 0
  3082. }
  3083. broadcast:process $nick $host $hand $chan $chan1 $who $message $number
  3084. }
  3085. proc broadcast:process {nick host hand chan chan1 who message number} {
  3086. global botnick black sdir
  3087. set char(p) [lindex $black(cmdchar) 0]
  3088. if {[string match -nocase "$char(p)" "none"]} {
  3089. set char(p) ""
  3090. }
  3091. set dir "logs/broadcast.txt"
  3092. set lin 0
  3093. if {([regexp -nocase -- {(#[0-9]+|on|off|add|list|del)} $who tmp a]) && (![regexp -nocase -- {\S#} $who])} {
  3094. switch $a {
  3095. on {
  3096. set type "broadcastpublic:show ON"
  3097. foreach tmr [timers] {
  3098. if {[string match "*broadcastpublic:show*" [join [lindex $tmr 1]]]} {
  3099. blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.3 none
  3100. return 0
  3101. }
  3102. }
  3103. blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.4 none
  3104. set file [open $sdir "r"]
  3105. set database [read -nonewline $file]
  3106. close $file
  3107. set data [split $database "\n"]
  3108. foreach line $data {
  3109. set lin [expr $lin +1]
  3110. set who [lindex [split $line] 0]
  3111. set stats [lindex [split $line] 1]
  3112. if {[string match -nocase "broadcastpublic:show" $who]} {
  3113. if {$line != ""} {
  3114. set num [expr $lin - 1]
  3115. set delete [lreplace $data $num $num]
  3116. set files [open $sdir "w"]
  3117. puts $files [join $delete "\n"]
  3118. close $files
  3119. }
  3120. }
  3121. }
  3122. set file [open $sdir "r"]
  3123. set data [read -nonewline $file]
  3124. close $file
  3125. if {$data == ""} {
  3126. set files [open $sdir "w"]
  3127. close $files
  3128. }
  3129. set file [open $sdir "a"]
  3130. puts $file "$type"
  3131. close $file
  3132. timer $black(bttime) broadcastpublic:show
  3133. }
  3134. off {
  3135. blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.5 none
  3136. set type "broadcastpublic:show OFF"
  3137. foreach tmr [timers] {
  3138. if {[string match -nocase "*broadcastpublic:show*" [join [lindex $tmr 1]]]} {
  3139. killtimer [lindex $tmr 2]
  3140. }
  3141. }
  3142. set file [open $sdir "r"]
  3143. set database [read -nonewline $file]
  3144. close $file
  3145. set data [split $database "\n"]
  3146. foreach line $data {
  3147. set lin [expr $lin +1]
  3148. set who [lindex [split $line] 0]
  3149. set stats [lindex [split $line] 1]
  3150. if {[string match -nocase "broadcastpublic:show" $who]} {
  3151. if {$line != ""} {
  3152. set num [expr $lin - 1]
  3153. set delete [lreplace $data $num $num]
  3154. set files [open $sdir "w"]
  3155. puts $files [join $delete "\n"]
  3156. close $files
  3157. }
  3158. }
  3159. }
  3160. set file [open $sdir "r"]
  3161. set data [read -nonewline $file]
  3162. close $file
  3163. if {$data == ""} {
  3164. set files [open $sdir "w"]
  3165. close $files
  3166. }
  3167. set file [open $sdir "a"]
  3168. puts $file "$type"
  3169. close $file
  3170. }
  3171. add {
  3172. if {[file exists $dir] == 0} {
  3173. set file [open $dir a]
  3174. close $file
  3175. }
  3176. set file [open $dir a]
  3177. puts $file $message
  3178. close $file
  3179. blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.6 none
  3180. blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.7 $message
  3181. }
  3182. list {
  3183. if {[file exists $dir] == 0} {
  3184. set file [open $dir a]
  3185. close $file
  3186. }
  3187. set dir "logs/broadcast.txt"
  3188. set file [open $dir "r"]
  3189. set w [read -nonewline $file]
  3190. close $file
  3191. set data [split $w "\n"]
  3192. set i 0
  3193. if {$data == ""} { blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.8 none
  3194. return 0
  3195. }
  3196. foreach mes $data {
  3197. set i [expr $i +1]
  3198. blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.9 none
  3199. blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.7 "$i. $mes"
  3200. }
  3201. }
  3202. del {
  3203. if {![regexp {^[0-9]} $number]} {
  3204. blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.10 none
  3205. return 0
  3206. }
  3207. set dir "logs/broadcast.txt"
  3208. if {[file exists $dir] == 0} {
  3209. set file [open $dir a]
  3210. close $file
  3211. }
  3212. set file [open $dir "r"]
  3213. set data [read -nonewline $file]
  3214. close $file
  3215. set lines [split $data "\n"]
  3216. set i [expr $number - 1]
  3217. set delete [lreplace $lines $i $i]
  3218. set files [open $dir "w"]
  3219. puts $files [join $delete "\n"]
  3220. close $files
  3221. set file [open $dir "r"]
  3222. set data [read -nonewline $file]
  3223. close $file
  3224. if {$data == ""} {
  3225. set files [open $dir "w"]
  3226. close $files
  3227. }
  3228. blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.11 $number
  3229. }
  3230. }
  3231. }
  3232. }
  3233. proc broadcastpublic:show {} {
  3234. global black
  3235. set dir "logs/broadcast.txt"
  3236. if {[file exists $dir] == 0} {
  3237. set file [open $dir a]
  3238. close $file
  3239. }
  3240. foreach chan [channels] {
  3241. if {[isdynamic $chan] && (![channel get $chan silent])} {
  3242. set file [open $dir "r"]
  3243. set data [read -nonewline $file]
  3244. close $file
  3245. set lines [split $data "\n"]
  3246. set numlines [llength $lines]
  3247. set random [rand $numlines]
  3248. set randomline [lindex $lines $random]
  3249. if {$black(bthow) == "1"} {
  3250. puthelp "PRIVMSG $chan :\001ACTION 1(BROADCAST) $randomline\001"
  3251. } else {
  3252. puthelp "PRIVMSG $chan :1(BROADCAST) $randomline"
  3253. }
  3254. }
  3255. }
  3256. timer $black(bttime) broadcastpublic:show
  3257. return 1
  3258. }
  3259. ################################# Limit ###################################
  3260. proc limitpublic {nick host hand chan arg} {
  3261. global black
  3262. set why [lindex [split $arg] 0]
  3263. set lm [lindex [split $arg] 1]
  3264. set type 0
  3265. set chan1 "$chan"
  3266. if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
  3267. set chan "$why"
  3268. set why [lindex [split $arg] 1]
  3269. set lm [lindex [split $arg] 2]
  3270. }
  3271. limit:process $nick $host $hand $chan $chan1 $why $lm $type
  3272. }
  3273. proc limit:process {nick host hand chan chan1 why lm type} {
  3274. global botnick black
  3275. set char(p) [lindex $black(cmdchar) 0]
  3276. if {[string match -nocase "$char(p)" "none"]} {
  3277. set char(p) ""
  3278. }
  3279. if {[matchattr $hand nm|- $chan]} {
  3280. if {($why == "") && ($type == "0")} {
  3281. blacktools:tell $nick $host $hand $chan $chan1 limit.1 none
  3282. return 0
  3283. }
  3284. if {($why == "") && ($type == "1")} {
  3285. blacktools:tell $nick $host $hand $chan $chan1 limit.2 none
  3286. return 0
  3287. }
  3288. }
  3289. if {($why == "") && ($type == "0")} {
  3290. blacktools:tell $nick $host $hand $chan $chan1 limit.3 none
  3291. return 0
  3292. }
  3293. if {($why == "") && ($type == "1")} {
  3294. blacktools:tell $nick $host $hand $chan $chan1 limit.4 none
  3295. return 0
  3296. }
  3297. if {![validchan $chan]} {
  3298. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  3299. return 0
  3300. }
  3301. if {![onchan $botnick $chan]} {
  3302. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  3303. return 0
  3304. }
  3305. set usersnum [llength [chanlist $chan]]
  3306. set setnum [channel get $chan blacklimit]
  3307. if {([regexp -nocase -- {(#[0-9]+|on|off|set|on|off)} $why tmp lmt]) && (![regexp -nocase -- {\S#} $why])} {
  3308. switch $lmt {
  3309. on {
  3310. set limt [channel get $chan blacklimit]
  3311. channel set $chan +limit
  3312. blacktools:tell $nick $host $hand $chan $chan1 limit.5 none
  3313. if {($limt != "0")} {
  3314. putserv "MODE $chan +l [expr $usersnum + $limt]"
  3315. } else {
  3316. putserv "MODE $chan +l [expr $usersnum + 10]"
  3317. channel set $chan blacklimit 10
  3318. blacktools:tell $nick $host $hand $chan $chan1 limit.6 none
  3319. }
  3320. }
  3321. off {
  3322. channel set $chan -limit
  3323. blacktools:tell $nick $host $hand $chan $chan1 limit.7 none
  3324. putquick "MODE $chan -l"
  3325. }
  3326. set {
  3327. if {![regexp {^[0-9]} $lm]} {
  3328. blacktools:tell $nick $host $hand $chan $chan1 limit.8 none
  3329. return 0
  3330. }
  3331. if {$lm < 2} { blacktools:tell $nick $host $hand $chan $chan1 limit.9 none
  3332. channel set $chan blacklimit 2
  3333. putserv "MODE $chan +l [expr $usersnum + $lm]"
  3334. blacktools:tell $nick $host $hand $chan $chan1 limit.10 none
  3335. return 0
  3336. }
  3337. if {$lm > 500} { blacktools:tell $nick $host $hand $chan $chan1 limit.11 none
  3338. return 0
  3339. }
  3340. channel set $chan blacklimit $lm
  3341. blacktools:tell $nick $host $hand $chan $chan1 limit.12 $lm
  3342. putserv "MODE $chan +l [expr $usersnum + $lm]"
  3343. }
  3344. }
  3345. }
  3346. }
  3347. proc limit:timer {min hour day mon year} {
  3348. global black
  3349. foreach chan [channels] {
  3350. if {[channel get $chan limit]} {
  3351. set usersnum [llength [chanlist $chan]]
  3352. set setnum [channel get $chan blacklimit]
  3353. if {$setnum == "0"} { set setnum "10" }
  3354. if {![botisop $chan]} { return 0 }
  3355. set chanmode [getchanmode $chan]
  3356. if {[string match "*l*" "$chanmode"]} {
  3357. set lim [lindex $chanmode 1]
  3358. } else { set lim "0" }
  3359. if {$usersnum > $lim} { set dif [expr $usersnum - $lim] } else { set dif [expr $lim - $usersnum] }
  3360. if {($dif >= $setnum) || ($dif <= $setnum)} {
  3361. putserv "MODE $chan +l [expr $usersnum + $setnum]"
  3362. }
  3363. }
  3364. }
  3365. }
  3366. ################################# Topic ###################################
  3367. proc topicpublic {nick host hand chan arg} {
  3368. global black
  3369. set nop [lindex [split $arg] 0]
  3370. set char(p) [lindex $black(cmdchar) 0]
  3371. if {[string match -nocase "$char(p)" "none"]} {
  3372. set char(p) ""
  3373. }
  3374. set type 0
  3375. set chan1 "$chan"
  3376. set tp [join [lrange [split $arg] 1 end]]
  3377. set number [lindex [split $arg] 1]
  3378. if {[regexp {^[\\+!#&]} $nop] && [matchattr $hand nm|- $chan]} {
  3379. set chan "$nop"
  3380. set nop [lindex [split $arg] 1]
  3381. set tp [join [lrange [split $arg] 2 end]]
  3382. set number [lindex [split $arg] 2]
  3383. }
  3384. topic:process $nick $host $hand $chan $chan1 $nop $tp $number $type
  3385. }
  3386. proc topic:process {nick host hand chan chan1 nop tp number type} {
  3387. global botnick black
  3388. set char(p) [lindex $black(cmdchar) 0]
  3389. if {[string match -nocase "$char(p)" "none"]} {
  3390. set char(p) ""
  3391. }
  3392. set dir "logs/topic($chan).txt"
  3393. if {[matchattr $hand nm|- $chan]} {
  3394. if {($nop == "") && ($type == "0")} {
  3395. blacktools:tell $nick $host $hand $chan $chan1 topic.1 none
  3396. return 0
  3397. }
  3398. if {($nop == "") && ($type == "1")} {
  3399. blacktools:tell $nick $host $hand $chan $chan1 topic.2 none
  3400. return 0
  3401. }
  3402. }
  3403. if {($nop == "") && ($type == "0")} {
  3404. blacktools:tell $nick $host $hand $chan $chan1 topic.3 none
  3405. return 0
  3406. }
  3407. if {($nop == "") && ($type == "1")} {
  3408. blacktools:tell $nick $host $hand $chan $chan1 topic.4 none
  3409. return 0
  3410. }
  3411. if {![validchan $chan]} {
  3412. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  3413. return 0
  3414. }
  3415. if {![onchan $botnick $chan]} {
  3416. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  3417. return 0
  3418. }
  3419. if {([regexp -nocase -- {(#[0-9]+|save|list|add|del|set)} $nop tmp topc]) && (![regexp -nocase -- {\S#} $nop])} {
  3420. switch $topc {
  3421. save {
  3422. set t [join [topic $chan]]
  3423. if {$t == ""} { blacktools:tell $nick $host $hand $chan $chan1 topic.5 none
  3424. return 0
  3425. }
  3426. if {[file exists $dir] == 0} {
  3427. set file [open $dir w]
  3428. close $file
  3429. }
  3430. set file [open $dir a]
  3431. puts $file $t
  3432. close $file
  3433. blacktools:tell $nick $host $hand $chan $chan1 topic.6 none
  3434. }
  3435. add {
  3436. if {[file exists $dir] == 0} {
  3437. set file [open $dir w]
  3438. close $file
  3439. }
  3440. set file [open $dir a]
  3441. puts $file $tp
  3442. close $file
  3443. blacktools:tell $nick $host $hand $chan $chan1 topic.7 none
  3444. }
  3445. list {
  3446. if {[file exists $dir] == 0} {
  3447. set file [open $dir w]
  3448. close $file
  3449. }
  3450. set file [open $dir "r"]
  3451. set w [read -nonewline $file]
  3452. close $file
  3453. set data [split $w "\n"]
  3454. set i 0
  3455. if {$data == ""} { blacktools:tell $nick $host $hand $chan $chan1 topic.8 none
  3456. return 0
  3457. }
  3458. foreach ts $data {
  3459. set i [expr $i +1]
  3460. blacktools:tell $nick $host $hand $chan $chan1 topic.9 none
  3461. blacktools:tell $nick $host $hand $chan $chan1 topic.10 "$i. $ts"
  3462. }
  3463. }
  3464. del {
  3465. if {![regexp {^[0-9]} $number]} {
  3466. blacktools:tell $nick $host $hand $chan $chan1 topic.11 none
  3467. return 0
  3468. }
  3469. if {[file exists $dir] == 0} {
  3470. set file [open $dir w]
  3471. close $file
  3472. }
  3473. set file [open $dir "r"]
  3474. set data [read -nonewline $file]
  3475. close $file
  3476. set lines [split $data "\n"]
  3477. set i [expr $number - 1]
  3478. set delete [lreplace $lines $i $i]
  3479. set files [open $dir "w"]
  3480. puts $files [join $delete "\n"]
  3481. close $files
  3482. set file [open $dir "r"]
  3483. set data [read -nonewline $file]
  3484. close $file
  3485. if {$data == ""} {
  3486. set files [open $dir "w"]
  3487. close $files
  3488. }
  3489. blacktools:tell $nick $host $hand $chan $chan1 topic.12 $number
  3490. }
  3491. set {
  3492. if {$number == ""} { blacktools:tell $nick $host $hand $chan $chan1 topic.13 none
  3493. return 0
  3494. }
  3495. set file [open $dir "r"]
  3496. set data [read -nonewline $file]
  3497. close $file
  3498. set lines [split $data "\n"]
  3499. set num [expr $number - 1]
  3500. set line [lindex $lines $num]
  3501. putquick "TOPIC $chan :Setting topic.."
  3502. puthelp "TOPIC $chan :$line"
  3503. blacktools:tell $nick $host $hand $chan $chan1 topic.14 $number
  3504. }
  3505. }
  3506. }
  3507. }
  3508. ################################# Seen ###################################
  3509. proc seen:save:2 {nick chan host type time staytimer reason} {
  3510. global seendir
  3511. set lin 0
  3512. set j 0
  3513. set who "$type $chan $nick $host $time $staytimer $reason"
  3514. set file [open $seendir "r"]
  3515. set database [read -nonewline $file]
  3516. close $file
  3517. set data [split $database "\n"]
  3518. foreach line $data {
  3519. set lin [expr $lin +1]
  3520. set userentry [lindex [split $line] 2]
  3521. set chanentry [lindex [split $line] 1]
  3522. if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} {
  3523. set joined [lindex [split $line] 0]
  3524. if {$joined == "JOIN"} {
  3525. set j [lindex [split $line] 4]
  3526. if {![regexp {^[0-9]} $j] || ($j == "")} {
  3527. set j 0
  3528. }
  3529. }
  3530. set who "$type $chan $nick $host $time $j $reason"
  3531. if {$line != ""} {
  3532. set num [expr $lin - 1]
  3533. set delete [lreplace $data $num $num]
  3534. set files [open $seendir "w"]
  3535. puts $files [join $delete "\n"]
  3536. close $files
  3537. }
  3538. }
  3539. }
  3540. set file [open $seendir "r"]
  3541. set data [read -nonewline $file]
  3542. close $file
  3543. if {$data == ""} {
  3544. set files [open $seendir "w"]
  3545. close $files
  3546. }
  3547. set file [open $seendir "a"]
  3548. puts $file "$who"
  3549. close $file
  3550. }
  3551. proc seen:save:1 {nick chan host type time staytimer} {
  3552. global seendir
  3553. set lin 0
  3554. set who "$type $chan $nick $host $time $staytimer"
  3555. set file [open $seendir "r"]
  3556. set database [read -nonewline $file]
  3557. close $file
  3558. set data [split $database "\n"]
  3559. foreach line $data {
  3560. set lin [expr $lin +1]
  3561. set userentry [lindex [split $line] 2]
  3562. set chanentry [lindex [split $line] 1]
  3563. if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} {
  3564. if {$line != ""} {
  3565. set num [expr $lin - 1]
  3566. set delete [lreplace $data $num $num]
  3567. set files [open $seendir "w"]
  3568. puts $files [join $delete "\n"]
  3569. close $files
  3570. }
  3571. }
  3572. }
  3573. set file [open $seendir "r"]
  3574. set data [read -nonewline $file]
  3575. close $file
  3576. if {$data == ""} {
  3577. set files [open $seendir "w"]
  3578. close $files
  3579. }
  3580. set file [open $seendir "a"]
  3581. puts $file "$who"
  3582. close $file
  3583. }
  3584. proc seen:join {nick host hand chan} {
  3585. global seendir botnick
  3586. if {![channel get $chan seen]} {
  3587. return 0
  3588. }
  3589. if {[isbotnick $nick]} { return 0 }
  3590. set time [unixtime]
  3591. set host "*!$host"
  3592. set type "JOIN"
  3593. set staytimer "0"
  3594. seen:save:1 $nick $chan $host $type $time $staytimer
  3595. }
  3596. proc seen:part {nick host hand chan arg} {
  3597. global seendir botnick
  3598. if {![validchan $chan]} { return 0 }
  3599. if {![channel get $chan seen]} {
  3600. return 0
  3601. }
  3602. set time [unixtime]
  3603. set staytimer "0"
  3604. set type "PART"
  3605. set reason [join [lrange [split $arg] 0 end]]
  3606. if {$reason == ""} { set reason "No Reason" }
  3607. set host "*!$host"
  3608. if {[isbotnick $nick]} { return 0 }
  3609. seen:save:2 $nick $chan $host $type $time $staytimer $reason
  3610. }
  3611. proc seen:sign {nick host hand chan arg} {
  3612. global seendir botnick
  3613. if {![validchan $chan]} { return 0 }
  3614. if {![channel get $chan seen]} {
  3615. return 0
  3616. }
  3617. set time [unixtime]
  3618. set staytimer "0"
  3619. set type "SIGN"
  3620. set host "*!$host"
  3621. set reason [join [lrange [split $arg] 0 end]]
  3622. if {$reason == ""} { set reason "No Reason" }
  3623. if {[isbotnick $nick]} { return 0 }
  3624. seen:save:2 $nick $chan $host $type $time $staytimer $reason
  3625. }
  3626. proc seen:kick {nick host hand chan kicked reason} {
  3627. global seendir botnick
  3628. if {![validchan $chan]} { return 0 }
  3629. if {![channel get $chan seen]} {
  3630. return 0
  3631. }
  3632. set lin 0
  3633. set j 0
  3634. set time [unixtime]
  3635. set hosted [getchanhost $kicked $chan]
  3636. set hosted "*!$hosted"
  3637. set reason [join [lrange [split $reason] 1 end]]
  3638. if {$reason == ""} { set reason "No Reason" }
  3639. if {[isbotnick $kicked]} { return 0 }
  3640. set who "KICK $chan $kicked $hosted $time 0 $reason"
  3641. set file [open $seendir "r"]
  3642. set database [read -nonewline $file]
  3643. close $file
  3644. set data [split $database "\n"]
  3645. foreach line $data {
  3646. set lin [expr $lin +1]
  3647. set userentry [lindex [split $line] 2]
  3648. set chanentry [lindex [split $line] 1]
  3649. if {[string equal -nocase $kicked $userentry] && [string match -nocase $chanentry $chan]} {
  3650. set joined [lindex [split $line] 0]
  3651. if {$joined == "JOIN"} {
  3652. set j [lindex [split $line] 4]
  3653. if {![regexp {^[0-9]} $j] || ($j == "")} {
  3654. set j 0
  3655. }
  3656. }
  3657. set who "KICK $chan $kicked $hosted $time $j $reason"
  3658. if {$line != ""} {
  3659. set num [expr $lin - 1]
  3660. set delete [lreplace $data $num $num]
  3661. set files [open $seendir "w"]
  3662. puts $files [join $delete "\n"]
  3663. close $files
  3664. }
  3665. }
  3666. }
  3667. set file [open $seendir "r"]
  3668. set data [read -nonewline $file]
  3669. close $file
  3670. if {$data == ""} {
  3671. set files [open $seendir "w"]
  3672. close $files
  3673. }
  3674. set file [open $seendir "a"]
  3675. puts $file "$who"
  3676. close $file
  3677. }
  3678. proc seen:split {nick host hand chan args} {
  3679. global seendir botnick
  3680. if {![validchan $chan]} { return 0 }
  3681. if {![channel get $chan seen]} {
  3682. return 0
  3683. }
  3684. set time [unixtime]
  3685. set staytimer "0"
  3686. set type "SPLIT"
  3687. set host "*!$host"
  3688. set reason [join [lrange [split $args] 0 end]]
  3689. if {[isbotnick $nick]} { return 0 }
  3690. seen:save:2 $nick $chan $host $type $time $staytimer $reason
  3691. }
  3692. proc seen:changenick {nick host hand chan newnick} {
  3693. global seendir botnick
  3694. if {![channel get $chan seen]} {
  3695. return 0
  3696. }
  3697. set time [unixtime]
  3698. set host "*!$host"
  3699. set staytimer "0"
  3700. set type "NICKCHANGE"
  3701. if {[isbotnick $nick]} { return 0 }
  3702. seen:save:2 $nick $chan $host $type $time $staytimer $newnick
  3703. }
  3704. proc seenpublic {nick host hand chan arg} {
  3705. global black
  3706. if {![channel get $chan seen]} {
  3707. return 0
  3708. }
  3709. set type 0
  3710. set chan1 "$chan"
  3711. set what [lindex [split $arg] 0]
  3712. if {[regexp {^[\\+!#&]} $what] && [matchattr $hand nm|- $chan]} {
  3713. set chan1 "$chan"
  3714. set chan "$what"
  3715. set what [lindex [split $arg] 1]
  3716. }
  3717. seen:process $nick $host $hand $chan $chan1 $what $type
  3718. }
  3719. proc seen:process {nick host hand chan chan1 what type} {
  3720. global seendir black count botnick
  3721. set number [scan $black(seenflood) %\[^:\]]
  3722. set timer [scan $black(seenflood) %*\[^:\]:%s]
  3723. set i 0
  3724. set char(p) [lindex $black(cmdchar) 0]
  3725. if {[string match -nocase "$char(p)" "none"]} {
  3726. set char(p) ""
  3727. }
  3728. if {[matchattr $hand nm|- $chan]} {
  3729. if {($what == "") && ($type == "0")} {
  3730. blacktools:tell $nick $host $hand $chan $chan1 seen.1 none
  3731. return 0
  3732. }
  3733. if {($what == "") && ($type == "1")} {
  3734. blacktools:tell $nick $host $hand $chan $chan1 seen.2 none
  3735. return 0
  3736. }
  3737. }
  3738. if {($what == "") && ($type == "0")} {
  3739. blacktools:tell $nick $host $hand $chan $chan1 seen.3 none
  3740. return 0
  3741. }
  3742. if {($what == "") && ($type == "1")} {
  3743. blacktools:tell $nick $host $hand $chan $chan1 seen.4 none
  3744. return 0
  3745. }
  3746. if {![validchan $chan]} {
  3747. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  3748. return 0
  3749. }
  3750. if {![onchan $botnick $chan]} {
  3751. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  3752. return 0
  3753. }
  3754. foreach tmr [utimers] {
  3755. if {[string match "*count(flood:$host:$chan)*" [join [lindex $tmr 1]]]} {
  3756. killutimer [lindex $tmr 2]
  3757. }
  3758. }
  3759. if {![info exists count(flood:$host:$chan)]} {
  3760. set count(flood:$host:$chan) 0
  3761. }
  3762. incr count(flood:$host:$chan)
  3763. utimer $timer [list unset count(flood:$host:$chan)]
  3764. if {$count(flood:$host:$chan) == "$number"} {
  3765. blacktools:tell $nick $host $hand $chan $chan1 seen.5 none
  3766. return 0
  3767. }
  3768. if {[string match -nocase $what $nick]} { blacktools:tell $nick $host $hand $chan $chan1 seen.6 $nick
  3769. return 0
  3770. }
  3771. if {[onchan $what $chan]} { blacktools:tell $nick $host $hand $chan $chan1 seen.7 $what
  3772. return 0
  3773. }
  3774. set file [open $seendir "r"]
  3775. set database [read -nonewline $file]
  3776. close $file
  3777. set data [split $database "\n"]
  3778. foreach line $data {
  3779. set userentry [lindex [split $line] 2]
  3780. set chanentry [lindex [split $line] 1]
  3781. set host [lindex [split $line] 3]
  3782. set tm [lindex [split $line] 4]
  3783. set jointime [lindex [split $line] 5]
  3784. set newnick [lindex [split $line] 6]
  3785. set reason [lrange [split $line] 6 end]
  3786. if {!([regexp {^[0-9]} $jointime]) || ($jointime == "")} {
  3787. set jointime 0
  3788. set reason [lrange [split $line] 5 end]
  3789. }
  3790. if {$reason == ""} { set reason "No Reason" }
  3791. set output [duration [expr [unixtime] - $tm]]
  3792. set staytime [expr [unixtime] - $jointime]
  3793. set staytime [duration [expr $tm - $jointime]]
  3794. set getlang [string tolower [channel get $chan lang]]
  3795. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  3796. set date [clock format $tm -format %d.%m.]
  3797. set hour [clock format $tm -format %H:%M]
  3798. if {$what == "*!*@*"} { return 0 }
  3799. if {([string equal -nocase $userentry $what] || [string match -nocase $what $userentry] || [string match -nocase $what $host]) && [string match -nocase $chanentry $chan]} {
  3800. set i [expr $i +1]
  3801. set host [string trim $host "*!~"]
  3802. if {$i < 6} {
  3803. lappend entry $userentry
  3804. }
  3805. set seenfound 1
  3806. set entry [lsort -unique $entry]
  3807. set replace(%entry%) "[join $entry ","]"
  3808. set replace(%host%) "$host"
  3809. set replace(%output%) "$output"
  3810. set replace(%date%) "($date $hour)"
  3811. set replace(%newnick%) "$newnick"
  3812. set replace(%userentry%) "$userentry"
  3813. set replace(%chan%) "$chan"
  3814. set replace(%reason%) "$reason"
  3815. set replace(%staytime%) "$staytime"
  3816. if {$jointime == "0"} { set staymsg "[string map [array get replace] $black(say.$getlang.seen.8)]"
  3817. set replace(%staymsg%) "$staymsg"
  3818. } else {
  3819. set staymsg "[string map [array get replace] $black(say.$getlang.seen.9)]"
  3820. set replace(%staymsg%) "$staymsg"
  3821. }
  3822. if {[lindex [split $line] 0] == "PART"} {
  3823. set reply "[string map [array get replace] $black(say.$getlang.seen.12)]"
  3824. }
  3825. if {[lindex [split $line] 0] == "SIGN"} {
  3826. set reply "[string map [array get replace] $black(say.$getlang.seen.13)]"
  3827. }
  3828. if {[lindex [split $line] 0] == "JOIN"} {
  3829. if {[onchan $userentry $chan]} {
  3830. set nowon "[string map [array get replace] $black(say.$getlang.seen.10)]"
  3831. set replace(%nowon%) "$nowon"
  3832. } else {
  3833. set nowon "[string map [array get replace] $black(say.$getlang.seen.11)]"
  3834. set replace(%nowon%) "$nowon"
  3835. }
  3836. set reply "[string map [array get replace] $black(say.$getlang.seen.14)]"
  3837. }
  3838. if {[lindex [split $line] 0] == "SPLIT"} {
  3839. set reply "[string map [array get replace] $black(say.$getlang.seen.15)]"
  3840. }
  3841. if {[lindex [split $line] 0] == "KICK"} {
  3842. set reply "[string map [array get replace] $black(say.$getlang.seen.16)]"
  3843. }
  3844. if {[lindex [split $line] 0] == "NICKCHANGE"} {
  3845. if {[onchan $newnick $chan]} {
  3846. set nowon "[string map [array get replace] $black(say.$getlang.seen.10)]"
  3847. set replace(%nowon%) "$nowon"
  3848. } else {
  3849. set nowon "[string map [array get replace] $black(say.$getlang.seen.11)]"
  3850. set replace(%nowon%) "$nowon"
  3851. }
  3852. set reply "[string map [array get replace] $black(say.$getlang.seen.17)]"
  3853. }
  3854. }
  3855. if {$black(seenmet) == "1"} {
  3856. set method "NOTICE"
  3857. set onwho "$nick"
  3858. } else {
  3859. set method "PRIVMSG"
  3860. set onwho "$chan1"
  3861. }
  3862. }
  3863. if {[info exists reply]} {
  3864. puthelp "$method $onwho :$reply"
  3865. }
  3866. if {![info exists seenfound]} {
  3867. blacktools:tell $nick $host $hand $chan $chan1 seen.18 $what
  3868. }
  3869. }
  3870. ############################### Greet #####################################
  3871. proc greetpublic {nick host hand chan arg} {
  3872. global black
  3873. set who [lindex [split $arg] 0]
  3874. set type 0
  3875. set chan1 "$chan"
  3876. set greet [join [lrange [split $arg] 1 end]]
  3877. set number [lindex [split $arg] 1]
  3878. if {[regexp {^[\\+!#&]} $who] && [matchattr $hand nm|- $chan]} {
  3879. set chan "$who"
  3880. set who [lindex [split $arg] 1]
  3881. set greet [join [lrange [split $arg] 2 end]]
  3882. set number [lindex [split $arg] 2]
  3883. }
  3884. greet:process $who $greet $number $type $nick $host $hand $chan $chan1
  3885. }
  3886. proc greet:process {who greet number type nick host hand chan chan1} {
  3887. global botnick black
  3888. set dir "logs/greet($chan).txt"
  3889. set char(p) [lindex $black(cmdchar) 0]
  3890. if {[string match -nocase "$char(p)" "none"]} {
  3891. set char(p) ""
  3892. }
  3893. if {[matchattr $hand nm|- $chan]} {
  3894. if {($who == "") && ($type == "0")} {
  3895. blacktools:tell $nick $host $hand $chan $chan1 greet.1 none
  3896. blacktools:tell $nick $host $hand $chan $chan1 greet.2 none
  3897. return 0
  3898. }
  3899. if {($who == "") && ($type == "1")} {
  3900. blacktools:tell $nick $host $hand $chan $chan1 greet.3 none
  3901. blacktools:tell $nick $host $hand $chan $chan1 greet.4 none
  3902. return 0
  3903. }
  3904. }
  3905. if {($who == "") && ($type == "0")} {
  3906. blacktools:tell $nick $host $hand $chan $chan1 greet.5 none
  3907. return 0
  3908. }
  3909. if {($who == "") && ($type == "1")} {
  3910. blacktools:tell $nick $host $hand $chan $chan1 greet.6 none
  3911. return 0
  3912. }
  3913. if {![validchan $chan]} {
  3914. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  3915. return 0
  3916. }
  3917. if {![onchan $botnick $chan]} {
  3918. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  3919. return 0
  3920. }
  3921. if {([regexp -nocase -- {(#[0-9]+|on|off|add|list|del)} $who tmp a]) && (![regexp -nocase -- {\S#} $who])} {
  3922. switch $a {
  3923. on {
  3924. channel set $chan +greet
  3925. blacktools:tell $nick $host $hand $chan $chan1 greet.7 none
  3926. }
  3927. off {
  3928. channel set $chan -greet
  3929. blacktools:tell $nick $host $hand $chan $chan1 greet.8 none
  3930. }
  3931. add {
  3932. if {[file exists $dir] == 0} {
  3933. set file [open $dir w]
  3934. close $file
  3935. }
  3936. set file [open $dir a]
  3937. puts $file $greet
  3938. close $file
  3939. blacktools:tell $nick $host $hand $chan $chan1 greet.9 none
  3940. blacktools:tell $nick $host $hand $chan $chan1 greet.10 $greet
  3941. }
  3942. list {
  3943. if {[file exists $dir] == 0} {
  3944. set file [open $dir a]
  3945. close $file
  3946. }
  3947. set dir "logs/greet($chan).txt"
  3948. set file [open $dir "r"]
  3949. set w [read -nonewline $file]
  3950. close $file
  3951. set data [split $w "\n"]
  3952. set i 0
  3953. if {$data == ""} { blacktools:tell $nick $host $hand $chan $chan1 greet.11 none
  3954. return 0
  3955. }
  3956. foreach mes $data {
  3957. set i [expr $i +1]
  3958. blacktools:tell $nick $host $hand $chan $chan1 greet.12 none
  3959. blacktools:tell $nick $host $hand $chan $chan1 greet.10 "$i. $mes"
  3960. }
  3961. }
  3962. del {
  3963. if {![regexp {^[0-9]} $number]} {
  3964. blacktools:tell $nick $host $hand $chan $chan1 greet.13 none
  3965. return 0
  3966. }
  3967. set dir "logs/greet($chan).txt"
  3968. if {[file exists $dir] == 0} {
  3969. set file [open $dir w]
  3970. close $file
  3971. }
  3972. set file [open $dir "r"]
  3973. set data [read -nonewline $file]
  3974. close $file
  3975. set lines [split $data "\n"]
  3976. set i [expr $number - 1]
  3977. set delete [lreplace $lines $i $i]
  3978. set files [open $dir "w"]
  3979. puts $files [join $delete "\n"]
  3980. close $files
  3981. set file [open $dir "r"]
  3982. set data [read -nonewline $file]
  3983. close $file
  3984. if {$data == ""} {
  3985. set files [open $dir "w"]
  3986. close $files
  3987. }
  3988. blacktools:tell $nick $host $hand $chan $chan1 greet.14 $number
  3989. blacktools:tell $nick $host $hand $chan $chan1 greet.15 none
  3990. }
  3991. }
  3992. }
  3993. }
  3994. proc greetpublic:join {nick host hand chan} {
  3995. global black
  3996. set dir "logs/greet($chan).txt"
  3997. if {![validchan $chan]} { return 0 }
  3998. if {[channel get $chan greet]} {
  3999. if {[file exists $dir] == 0} {
  4000. set file [open $dir w]
  4001. close $file
  4002. }
  4003. if {[isbotnick $nick]} { return 0 }
  4004. set replace(%nick%) $nick
  4005. set file [open $dir "r"]
  4006. set data [read -nonewline $file]
  4007. close $file
  4008. if {$data == ""} { return 0 }
  4009. set lines [split $data "\n"]
  4010. set numlines [llength $lines]
  4011. set random [rand $numlines]
  4012. set randomline [lindex $lines $random]
  4013. set message [string map [array get replace] $randomline]
  4014. if {$black(howgreet) == "1"} {
  4015. puthelp "NOTICE $nick :$message"
  4016. } else { puthelp "PRIVMSG $nick :$message" }
  4017. }
  4018. }
  4019. ################################ Leave ###################################
  4020. proc leave:process {who leave number type nick host hand chan chan1} {
  4021. global botnick black
  4022. set char(p) [lindex $black(cmdchar) 0]
  4023. if {[string match -nocase "$char(p)" "none"]} {
  4024. set char(p) ""
  4025. }
  4026. set dir "logs/leave($chan).txt"
  4027. if {[matchattr $hand nm|- $chan]} {
  4028. if {($who == "") && ($type == "0")} {
  4029. blacktools:tell $nick $host $hand $chan $chan1 leave.1 none
  4030. blacktools:tell $nick $host $hand $chan $chan1 leave.2 none
  4031. return 0
  4032. }
  4033. if {($who == "") && ($type == "1")} {
  4034. blacktools:tell $nick $host $hand $chan $chan1 leave.3 none
  4035. blacktools:tell $nick $host $hand $chan $chan1 leave.4 none
  4036. return 0
  4037. }
  4038. }
  4039. if {($who == "") && ($type == "0")} {
  4040. blacktools:tell $nick $host $hand $chan $chan1 leave.5 none
  4041. return 0
  4042. }
  4043. if {($who == "") && ($type == "1")} {
  4044. blacktools:tell $nick $host $hand $chan $chan1 leave.6 none
  4045. return 0
  4046. }
  4047. if {![validchan $chan]} {
  4048. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  4049. return 0
  4050. }
  4051. if {![onchan $botnick $chan]} {
  4052. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  4053. return 0
  4054. }
  4055. if {([regexp -nocase -- {(#[0-9]+|on|off|add|list|del)} $who tmp a]) && (![regexp -nocase -- {\S#} $who])} {
  4056. switch $a {
  4057. on {
  4058. channel set $chan +leave
  4059. blacktools:tell $nick $host $hand $chan $chan1 leave.7 none
  4060. }
  4061. off {
  4062. channel set $chan -leave
  4063. blacktools:tell $nick $host $hand $chan $chan1 leave.8 none
  4064. }
  4065. add {
  4066. if {[file exists $dir] == 0} {
  4067. set file [open $dir w]
  4068. close $file
  4069. }
  4070. set file [open $dir a]
  4071. puts $file $leave
  4072. close $file
  4073. blacktools:tell $nick $host $hand $chan $chan1 leave.9 none
  4074. blacktools:tell $nick $host $hand $chan $chan1 leave.10 $leave
  4075. }
  4076. list {
  4077. if {[file exists $dir] == 0} {
  4078. set file [open $dir w]
  4079. close $file
  4080. }
  4081. set dir "logs/leave($chan).txt"
  4082. set file [open $dir "r"]
  4083. set w [read -nonewline $file]
  4084. close $file
  4085. set data [split $w "\n"]
  4086. set i 0
  4087. if {$data == ""} { blacktools:tell $nick $host $hand $chan $chan1 leave.11 none
  4088. return 0
  4089. }
  4090. foreach mes $data {
  4091. set i [expr $i +1]
  4092. blacktools:tell $nick $host $hand $chan $chan1 leave.12 none
  4093. blacktools:tell $nick $host $hand $chan $chan1 leave.10 "$i. $mes"
  4094. }
  4095. }
  4096. del {
  4097. if {![regexp {^[0-9]} $number]} {
  4098. blacktools:tell $nick $host $hand $chan $chan1 leave.13 none
  4099. return 0
  4100. }
  4101. set dir "logs/leave($chan).txt"
  4102. if {[file exists $dir] == 0} {
  4103. set file [open $dir w]
  4104. close $file
  4105. }
  4106. set file [open $dir "r"]
  4107. set data [read -nonewline $file]
  4108. close $file
  4109. set lines [split $data "\n"]
  4110. set i [expr $number - 1]
  4111. set delete [lreplace $lines $i $i]
  4112. set files [open $dir "w"]
  4113. puts $files [join $delete "\n"]
  4114. close $files
  4115. set file [open $dir "r"]
  4116. set data [read -nonewline $file]
  4117. close $file
  4118. if {$data == ""} {
  4119. set files [open $dir "w"]
  4120. close $files
  4121. }
  4122. blacktools:tell $nick $host $hand $chan $chan1 leave.14 $number
  4123. blacktools:tell $nick $host $hand $chan $chan1 leave.15 none
  4124. }
  4125. }
  4126. }
  4127. }
  4128. proc leavepublic {nick host hand chan arg} {
  4129. global black
  4130. set char(p) [lindex $black(cmdchar) 0]
  4131. if {[string match -nocase "$char(p)" "none"]} {
  4132. set char(p) ""
  4133. }
  4134. set dir "logs/leave($chan).txt"
  4135. set type 0
  4136. set chan1 "$chan"
  4137. set who [lindex [split $arg] 0]
  4138. set leave [join [lrange [split $arg] 1 end]]
  4139. set number [lindex [split $arg] 1]
  4140. if {[regexp {^[\\+!#&]} $who] && [matchattr $hand nm|- $chan]} {
  4141. set chan "$who"
  4142. set who [lindex [split $arg] 1]
  4143. set leave [join [lrange [split $arg] 2 end]]
  4144. set number [lindex [split $arg] 2]
  4145. }
  4146. leave:process $who $leave $number $type $nick $host $hand $chan $chan1
  4147. }
  4148. proc leavepublic:part {nick host hand chan args} {
  4149. global black
  4150. set dir "logs/leave($chan).txt"
  4151. if {![validchan $chan]} { return 0 }
  4152. if {[channel get $chan leave]} {
  4153. if {[file exists $dir] == 0} {
  4154. set file [open $dir w]
  4155. close $file
  4156. }
  4157. if {[isbotnick $nick]} { return 0 }
  4158. set replace(%nick%) $nick
  4159. set file [open $dir "r"]
  4160. set data [read -nonewline $file]
  4161. close $file
  4162. if {$data == ""} { return 0 }
  4163. set lines [split $data "\n"]
  4164. set numlines [llength $lines]
  4165. set random [rand $numlines]
  4166. set randomline [lindex $lines $random]
  4167. set message [string map [array get replace] $randomline]
  4168. if {$black(howleave) == "1"} {
  4169. puthelp "NOTICE $nick :$message"
  4170. } else { puthelp "PRIVMSG $nick :$message" }
  4171. }
  4172. }
  4173. ################################ Idle ###################################
  4174. proc antidlepublic {nick host hand chan arg} {
  4175. global black
  4176. set char(p) [lindex $black(cmdchar) 0]
  4177. if {[string match -nocase "$char(p)" "none"]} {
  4178. set char(p) ""
  4179. }
  4180. set type1 0
  4181. set chan1 "$chan"
  4182. set why [lindex [split $arg] 0]
  4183. set type [lindex [split $arg] 1]
  4184. set user [lindex [split $arg] 1]
  4185. set host [lindex [split $arg] 2]
  4186. if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
  4187. set chan "$why"
  4188. set why [lindex [split $arg] 1]
  4189. set type [lindex [split $arg] 2]
  4190. set user [lindex [split $arg] 2]
  4191. set host [lindex [split $arg] 3]
  4192. }
  4193. antidle:process $why $type $type1 $user $host $nick $hand $chan $chan1
  4194. }
  4195. proc antidle:process {why type type1 user host nick hand chan chan1} {
  4196. global botnick black
  4197. set flag "-|f"
  4198. set char(p) [lindex $black(cmdchar) 0]
  4199. if {[string match -nocase "$char(p)" "none"]} {
  4200. set char(p) ""
  4201. }
  4202. set handle [nick2hand $user]
  4203. if {[matchattr $hand nm|- $chan]} {
  4204. if {($why == "") && ($type1 == "0")} {
  4205. blacktools:tell $nick $host $hand $chan $chan1 idle.1 none
  4206. blacktools:tell $nick $host $hand $chan $chan1 idle.2 none
  4207. return 0
  4208. }
  4209. if {($why == "") && ($type1 == "1")} {
  4210. blacktools:tell $nick $host $hand $chan $chan1 idle.3 none
  4211. blacktools:tell $nick $host $hand $chan $chan1 idle.4 none
  4212. return 0
  4213. }
  4214. }
  4215. if {($why == "") && ($type1 == "0")} {
  4216. blacktools:tell $nick $host $hand $chan $chan1 idle.5 none
  4217. return 0
  4218. }
  4219. if {($why == "") && ($type1 == "1")} {
  4220. blacktools:tell $nick $host $hand $chan $chan1 idle.6 none
  4221. return 0
  4222. }
  4223. if {![validchan $chan]} {
  4224. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  4225. return 0
  4226. }
  4227. if {![onchan $botnick $chan]} {
  4228. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  4229. return 0
  4230. }
  4231. if {([regexp -nocase -- {(#[0-9]+|op|voice|add|on|off)} $why tmp idler]) && (![regexp -nocase -- {\S#} $why])} {
  4232. switch $idler {
  4233. on {
  4234. channel set $chan +antidle
  4235. blacktools:tell $nick $host $hand $chan $chan1 idle.7 none
  4236. }
  4237. off {
  4238. channel set $chan -antidle
  4239. blacktools:tell $nick $host $hand $chan $chan1 idle.8 none
  4240. }
  4241. op {
  4242. if {$type == ""} { blacktools:tell $nick $host $hand $chan $chan1 idle.9 none
  4243. return 0
  4244. }
  4245. if {[string match -nocase $type "on"]} {
  4246. if {[channel get $chan antidle]} { set antidle "on" } else { set antidle "off"}
  4247. if {$antidle == "off"} { blacktools:tell $nick $host $hand $chan $chan1 idle.10 none
  4248. return 0
  4249. }
  4250. channel set $chan +antididle
  4251. blacktools:tell $nick $host $hand $chan $chan1 idle.11 none
  4252. }
  4253. if {[string match -nocase $type "off"]} {
  4254. if {[channel get $chan antidle]} { set antidle "on" } else { set antidle "off"}
  4255. if {$antidle == "off"} { blacktools:tell $nick $host $hand $chan $chan1 idle.10 none
  4256. return 0
  4257. }
  4258. channel set $chan -antididle
  4259. blacktools:tell $nick $host $hand $chan $chan1 idle.12 none
  4260. }
  4261. }
  4262. voice {
  4263. if {$type == ""} { blacktools:tell $nick $host $hand $chan $chan1 idle.13 none
  4264. return 0
  4265. }
  4266. if {[string match -nocase $type "on"]} {
  4267. if {[channel get $chan antidle]} { set antidle "on" } else { set antidle "off"}
  4268. if {$antidle == "off"} { blacktools:tell $nick $host $hand $chan $chan1 idle.10 none
  4269. return 0
  4270. }
  4271. channel set $chan +antividle
  4272. blacktools:tell $nick $host $hand $chan $chan1 idle.14 none
  4273. }
  4274. if {[string match -nocase $type "off"]} {
  4275. if {[channel get $chan antidle]} { set antidle "on" } else { set antidle "off"}
  4276. if {$antidle == "off"} { blacktools:tell $nick $host $hand $chan $chan1 idle.10 none
  4277. return 0
  4278. }
  4279. channel set $chan -antividle
  4280. blacktools:tell $nick $host $hand $chan $chan1 idle.15 none
  4281. }
  4282. }
  4283. add {
  4284. if {$user == ""} { blacktools:tell $nick $host $hand $chan $chan1 idle.16 none
  4285. return 0
  4286. }
  4287. if {(![onchan $user $chan]) && (![validuser $user])} { blacktools:tell $nick $host $hand $chan $chan1 idle.17 $user
  4288. return 0
  4289. }
  4290. if {[validuser $user]} {
  4291. chattr $user $flag $chan
  4292. blacktools:tell $nick $host $hand $chan $chan1 idle.18 $user
  4293. } else {
  4294. set hosts [getchanhost $user $chan]
  4295. set uhost "*!*@[lindex [split $hosts @] 1]"
  4296. adduser $user $uhost
  4297. chattr $user $flag $chan
  4298. blacktools:tell $nick $host $hand $chan $chan1 idle.19 "$user $uhost"
  4299. }
  4300. }
  4301. }
  4302. }
  4303. }
  4304. proc idlewhoispublic {min hour day mon year} {
  4305. global black botnick
  4306. if {([scan $min %d]+([scan $hour %d]*60)) % $black(idleinterval) == 0} {
  4307. foreach chan [channels] {
  4308. if {[channel get $chan antidle]} {
  4309. foreach user [chanlist $chan] {
  4310. set user [split $user]
  4311. set handle [nick2hand $user]
  4312. if {[isop $user $chan] || [isvoice $user $chan]} {
  4313. if {$user != $botnick} { putserv "WHOIS $user $user" }
  4314. }
  4315. }
  4316. }
  4317. }
  4318. }
  4319. bind raw - 317 idleprocespublic
  4320. }
  4321. proc idleprocespublic {nick int arg} {
  4322. global black
  4323. set nick [string tolower [lindex $arg 1]]
  4324. set handle [nick2hand $nick]
  4325. set idler [string tolower [lindex $arg 2]]
  4326. set minutesidle [expr $idler / 60]
  4327. foreach chan [channels] {
  4328. set replace(%chan%) $chan
  4329. set idlevoicetime [channel get $chan idlevoicemax]
  4330. if {$idlevoicetime == "0"} { set idlevoicetime "$black(idlevoicemax)" }
  4331. set idleoptime [channel get $chan idleopmax]
  4332. if {$idleoptime == "0"} { set idleoptime "$black(idleopmax)" }
  4333. if {[channel get $chan antividle]} {
  4334. if {[isvoice $nick $chan] && ![matchattr $handle -|f $chan]} {
  4335. if {$minutesidle > $idlevoicetime} {
  4336. putserv "MODE $chan -v $nick"
  4337. }
  4338. }
  4339. }
  4340. if {[channel get $chan antididle]} {
  4341. if {[isop $nick $chan] && ![matchattr $handle -|f $chan]} {
  4342. if {$minutesidle > $idleoptime} {
  4343. putserv "MODE $chan -o $nick"
  4344. }
  4345. }
  4346. }
  4347. }
  4348. }
  4349. ######################################### AntiBotIdle #############################
  4350. proc botidlepublic {nick host hand chan arg} {
  4351. global black botnick sdir
  4352. set what [lindex [split $arg] 0]
  4353. set lin 0
  4354. set chan1 "$chan"
  4355. set char(p) [lindex $black(cmdchar) 0]
  4356. if {[string match -nocase "$char(p)" "none"]} {
  4357. set char(p) ""
  4358. }
  4359. if {$what == ""} { blacktools:tell $nick $host $hand $chan $chan1 antibotidle.1 none
  4360. return 0
  4361. }
  4362. botidle:process $nick $host $hand $chan $chan1 $what
  4363. }
  4364. proc botidle:process {nick host hand chan chan1 what} {
  4365. global botnick black sdir
  4366. set lin 0
  4367. switch -exact -- [string tolower $what] {
  4368. on {
  4369. set type "antibotidle:module ON"
  4370. foreach tmr [timers] {
  4371. if {[string match "*antibotidle:module*" [join [lindex $tmr 1]]]} {
  4372. blacktools:tell $nick $host $hand $chan $chan1 antibotidle.3 none
  4373. return 0
  4374. }
  4375. }
  4376. set file [open $sdir "r"]
  4377. set database [read -nonewline $file]
  4378. close $file
  4379. set data [split $database "\n"]
  4380. foreach line $data {
  4381. set lin [expr $lin +1]
  4382. set who [lindex [split $line] 0]
  4383. set stats [lindex [split $line] 1]
  4384. if {[string match -nocase "antibotidle:module" $who]} {
  4385. if {$line != ""} {
  4386. set num [expr $lin - 1]
  4387. set delete [lreplace $data $num $num]
  4388. set files [open $sdir "w"]
  4389. puts $files [join $delete "\n"]
  4390. close $files
  4391. }
  4392. }
  4393. }
  4394. set file [open $sdir "r"]
  4395. set data [read -nonewline $file]
  4396. close $file
  4397. if {$data == ""} {
  4398. set files [open $sdir "w"]
  4399. close $files
  4400. }
  4401. set file [open $sdir "a"]
  4402. puts $file "$type"
  4403. close $file
  4404. blacktools:tell $nick $host $hand $chan $chan1 antibotidle.4 none
  4405. timer $black(noidlemax) antibotidle:module
  4406. }
  4407. off {
  4408. blacktools:tell $nick $host $hand $chan $chan1 antibotidle.5 none
  4409. set type "antibotidle:module OFF"
  4410. foreach tmr [timers] {
  4411. if {[string match "*antibotidle:module*" [join [lindex $tmr 1]]]} {
  4412. killtimer [lindex $tmr 2]
  4413. }
  4414. }
  4415. set file [open $sdir "r"]
  4416. set database [read -nonewline $file]
  4417. close $file
  4418. set data [split $database "\n"]
  4419. foreach line $data {
  4420. set lin [expr $lin +1]
  4421. set who [lindex [split $line] 0]
  4422. set stats [lindex [split $line] 1]
  4423. if {[string match -nocase "antibotidle:module" $who]} {
  4424. if {$line != ""} {
  4425. set num [expr $lin - 1]
  4426. set delete [lreplace $data $num $num]
  4427. set files [open $sdir "w"]
  4428. puts $files [join $delete "\n"]
  4429. close $files
  4430. }
  4431. }
  4432. }
  4433. set file [open $sdir "r"]
  4434. set data [read -nonewline $file]
  4435. close $file
  4436. if {$data == ""} {
  4437. set files [open $sdir "w"]
  4438. close $files
  4439. }
  4440. set file [open $sdir "a"]
  4441. puts $file "$type"
  4442. close $file
  4443. }
  4444. }
  4445. }
  4446. proc antibotidle:module {} {
  4447. global black
  4448. putquick "PRIVMSG $black(noobject) :"
  4449. timer $black(noidlemax) antibotidle:module
  4450. return 1
  4451. }
  4452. ######################################## Comenzi #####################################
  4453. proc drpublic {nick host hand chan arg} {
  4454. global botnick black
  4455. set drone [lindex [split $arg] 0]
  4456. set chan1 "$chan"
  4457. set mask [lindex [split $arg] 0]
  4458. set type "0"
  4459. foreach c [channels] {
  4460. set backchan [channel get $c backchan]
  4461. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  4462. set chan "$c"
  4463. }
  4464. }
  4465. if {[regexp {^[#&]} $drone] && [matchattr $hand nm|- $chan]} {
  4466. set chan "$drone"
  4467. set drone [lindex [split $arg] 1]
  4468. set mask [lindex [split $arg] 1]
  4469. }
  4470. dr:process $drone $mask $nick $hand $host $chan $chan1 $type
  4471. }
  4472. proc dr:process {drone mask nick hand host chan chan1 type} {
  4473. global botnick black
  4474. set char(p) [lindex $black(cmdchar) 0]
  4475. if {[string match -nocase "$char(p)" "none"]} {
  4476. set char(p) ""
  4477. }
  4478. set handle [nick2hand $drone]
  4479. if {![validchan $chan]} {
  4480. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  4481. return 0
  4482. }
  4483. if {![onchan $botnick $chan]} {
  4484. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  4485. return 0
  4486. }
  4487. set list [userlist $black(exceptflags) $chan]
  4488. set getreason [channel get $chan dr-reason]
  4489. if {$getreason == ""} {
  4490. set getlang [string tolower [channel get $chan lang]]
  4491. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  4492. set getreason $black(say.$getlang.dr.5)
  4493. }
  4494. if {[channel get $chan showhandle]} {
  4495. set reason "($hand) $getreason"
  4496. } else { set reason "$getreason"
  4497. }
  4498. set getbantime [channel get $chan dr-bantime]
  4499. if {$getbantime == "0"} { set getbantime $black(drtime) }
  4500. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  4501. return 0
  4502. }
  4503. foreach user $list {
  4504. set hosts [getuser $user hosts]
  4505. foreach host $hosts {
  4506. if {[string match -nocase $mask $host]} {
  4507. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  4508. return 0
  4509. }
  4510. }
  4511. }
  4512. if {[matchattr $handle $black(exceptflags) $chan]} {
  4513. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  4514. return 0
  4515. }
  4516. if {$mask == "*!*@*"} {
  4517. return 0
  4518. }
  4519. if {[isbotnick $drone]} {
  4520. return 0
  4521. }
  4522. if {![botisop $chan]} {
  4523. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  4524. return 0
  4525. }
  4526. if {[onchan $drone $chan]} {
  4527. set mask *!*@[lindex [split [getchanhost $drone $chan] "@"] 1]
  4528. }
  4529. if {[matchattr $hand nm|- $chan]} {
  4530. if {($drone == "") && ($type == "0")} {
  4531. blacktools:tell $nick $host $hand $chan $chan1 dr.1 none
  4532. return 0
  4533. }
  4534. if {($drone == "") && ($type == "1")} {
  4535. blacktools:tell $nick $host $hand $chan $chan1 dr.2 none
  4536. return 0
  4537. }
  4538. }
  4539. if {($drone == "") && ($type == "0")} {
  4540. blacktools:tell $nick $host $hand $chan $chan1 dr.3 none
  4541. return 0
  4542. }
  4543. if {($drone == "") && ($type == "1")} {
  4544. blacktools:tell $nick $host $hand $chan $chan1 dr.4 none
  4545. return 0
  4546. }
  4547. blacktools:banner:3 $mask $hand $chan $reason $getbantime DR($chan)
  4548. }
  4549. proc botpublic {nick host hand chan arg} {
  4550. global botnick black
  4551. set bot [lindex [split $arg] 0]
  4552. set mask [lindex [split $arg] 0]
  4553. set type 0
  4554. set chan1 "$chan"
  4555. foreach c [channels] {
  4556. set backchan [channel get $c backchan]
  4557. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  4558. set chan "$c"
  4559. }
  4560. }
  4561. if {[regexp {^[\\+!#&]} $bot] && [matchattr $hand nm|- $chan]} {
  4562. set chan "$bot"
  4563. set bot [lindex [split $arg] 1]
  4564. set mask [lindex [split $arg] 1]
  4565. }
  4566. bot:process $bot $mask $nick $hand $host $chan $chan1 $type
  4567. }
  4568. proc bot:process {bot mask nick hand host chan chan1 type} {
  4569. global black botnick
  4570. set handle [nick2hand $bot]
  4571. set char(p) [lindex $black(cmdchar) 0]
  4572. if {[string match -nocase "$char(p)" "none"]} {
  4573. set char(p) ""
  4574. }
  4575. if {![validchan $chan]} {
  4576. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  4577. return 0
  4578. }
  4579. if {![onchan $botnick $chan]} {
  4580. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  4581. return 0
  4582. }
  4583. set list [userlist $black(exceptflags) $chan]
  4584. set getreason [channel get $chan bot-reason]
  4585. if {$getreason == ""} {
  4586. set getlang [string tolower [channel get $chan lang]]
  4587. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  4588. set getreason $black(say.$getlang.bot.5)
  4589. }
  4590. if {[channel get $chan showhandle]} {
  4591. set reason "($hand) $getreason"
  4592. } else { set reason "$getreason"
  4593. }
  4594. set getbantime [channel get $chan bot-bantime]
  4595. if {$getbantime == "0"} { set getbantime $black(bottime) }
  4596. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  4597. return 0
  4598. }
  4599. foreach user $list {
  4600. set hosts [getuser $user hosts]
  4601. foreach host $hosts {
  4602. if {[string match -nocase $mask $host]} {
  4603. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  4604. return 0
  4605. }
  4606. }
  4607. }
  4608. if {[matchattr $handle $black(exceptflags) $chan]} {
  4609. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  4610. return 0
  4611. }
  4612. if {$mask == "*!*@*"} {
  4613. return 0
  4614. }
  4615. if {[isbotnick $bot]} {
  4616. return 0
  4617. }
  4618. if {![botisop $chan]} {
  4619. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  4620. return 0
  4621. }
  4622. if {[onchan $bot $chan]} {
  4623. set mask *!*@[lindex [split [getchanhost $bot $chan] "@"] 1]
  4624. }
  4625. if {[matchattr $hand nm|- $chan]} {
  4626. if {($bot == "") && ($type == "0")} {
  4627. blacktools:tell $nick $host $hand $chan $chan1 bot.1 none
  4628. return 0
  4629. }
  4630. if {($bot == "") && ($type == "1")} {
  4631. blacktools:tell $nick $host $hand $chan $chan1 bot.2 none
  4632. return 0
  4633. }
  4634. }
  4635. if {($bot == "") && ($type == "0")} {
  4636. blacktools:tell $nick $host $hand $chan $chan1 bot.3 none
  4637. return 0
  4638. }
  4639. if {($bot == "") && ($type == "1")} {
  4640. blacktools:tell $nick $host $hand $chan $chan1 bot.4 none
  4641. return 0
  4642. }
  4643. blacktools:banner:3 $mask $hand $chan $reason $getbantime bot($chan)
  4644. }
  4645. proc b:local {bnick mask time nick reason hand host chan chan1 type} {
  4646. global botnick black
  4647. set handle [nick2hand $bnick]
  4648. set char(p) [lindex $black(cmdchar) 0]
  4649. if {[string match -nocase "$char(p)" "none"]} {
  4650. set char(p) ""
  4651. }
  4652. if {![validchan $chan]} {
  4653. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  4654. return 0
  4655. }
  4656. if {![onchan $botnick $chan]} {
  4657. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  4658. return 0
  4659. }
  4660. set list [userlist $black(exceptflags) $chan]
  4661. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  4662. return 0
  4663. }
  4664. foreach user $list {
  4665. set hosts [getuser $user hosts]
  4666. foreach host $hosts {
  4667. if {[string match -nocase $mask $host]} {
  4668. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  4669. return 0
  4670. }
  4671. }
  4672. }
  4673. if {[matchattr $handle $black(exceptflags) $chan]} {
  4674. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  4675. return 0
  4676. }
  4677. if {$reason == ""} {
  4678. set getlang [string tolower [channel get $chan lang]]
  4679. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  4680. set reason1 $black(say.$getlang.b.9)
  4681. } else { set reason1 "$reason" }
  4682. if {[channel get $chan showhandle]} {
  4683. set reason "($hand) $reason1"
  4684. } else { set reason "$reason1"
  4685. }
  4686. if {[isbotnick $bnick]} {
  4687. return 0
  4688. }
  4689. if {![botisop $chan]} {
  4690. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  4691. return 0
  4692. }
  4693. if {$mask == "*!*@*"} {
  4694. return 0
  4695. }
  4696. if {[onchan $bnick $chan]} {
  4697. set mask *!*@[lindex [split [getchanhost $bnick $chan] "@"] 1]
  4698. }
  4699. if {[matchattr $hand nm|- $chan]} {
  4700. if {($bnick == "") && ($type == "0")} {
  4701. blacktools:tell $nick $host $hand $chan $chan1 b.1 none
  4702. blacktools:tell $nick $host $hand $chan $chan1 b.2 none
  4703. return 0
  4704. }
  4705. if {($bnick == "") && ($type == "1")} {
  4706. blacktools:tell $nick $host $hand $chan $chan1 b.3 none
  4707. blacktools:tell $nick $host $hand $chan $chan1 b.4 none
  4708. return 0
  4709. }
  4710. }
  4711. if {($bnick == "") && ($type == "0")} {
  4712. blacktools:tell $nick $host $hand $chan $chan1 b.5 none
  4713. return 0
  4714. }
  4715. if {($bnick == "") && ($type == "1")} {
  4716. blacktools:tell $nick $host $hand $chan $chan1 b.6 none
  4717. return 0
  4718. }
  4719. blacktools:banner:3 $mask $hand $chan $reason $time b($chan)
  4720. if {$time == "0"} { set reply "Permanent" } else { set reply "$time minute" }
  4721. blacktools:tell $nick $host $hand $chan $chan1 b.7 "$mask $reply"
  4722. }
  4723. proc bpublic {nick host hand chan arg} {
  4724. global botnick black
  4725. set bnick [lindex [split $arg] 0]
  4726. set char(p) [lindex $black(cmdchar) 0]
  4727. if {[string match -nocase "$char(p)" "none"]} {
  4728. set char(p) ""
  4729. }
  4730. set type 0
  4731. set chan1 "$chan"
  4732. set mask [lindex [split $arg] 0]
  4733. set time [lindex [split $arg] 1]
  4734. set type1 [lindex [split $arg] 1]
  4735. set type2 [lindex [split $arg] 2]
  4736. set reason [join [lrange [split $arg] 2 end]]
  4737. set handle [nick2hand $bnick]
  4738. if {[string match -nocase "global" $type1] || [string match -nocase "global" $type2] && [matchattr $hand nm|- $chan]} {
  4739. if {[string match -nocase $type1 "global"]} {
  4740. set reason [join [lrange [split $arg] 2 end]]
  4741. }
  4742. if {[string match -nocase $type2 "global"]} {
  4743. set reason [join [lrange [split $arg] 3 end]]
  4744. }
  4745. set list [userlist nm|-]
  4746. foreach user $list {
  4747. set hosts [getuser $user hosts]
  4748. foreach host $hosts {
  4749. if {[string match $mask $host]} {
  4750. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  4751. return 0
  4752. }
  4753. }
  4754. }
  4755. if {[matchattr $handle nm|- $chan]} {
  4756. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  4757. return 0
  4758. }
  4759. if {![regexp {^[0-9]} $time]} {
  4760. set reason [join [lrange [split $arg] 2 end]]
  4761. set time "$black(btime)"
  4762. }
  4763. if {$reason == ""} {set reason1 "(GLOBAL) $black(dfreason)"
  4764. } else { set reason1 "(GLOBAL) $reason" }
  4765. if {[channel get $chan showhandle]} {
  4766. set reason "($hand) $reason1"
  4767. } else { set reason "$reason1"
  4768. }
  4769. if {[isbotnick $bnick]} {
  4770. return 0
  4771. }
  4772. if {![botisop $chan]} {
  4773. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  4774. return 0
  4775. }
  4776. if {$mask == "*!*@*"} {
  4777. return 0
  4778. }
  4779. if {[onchan $bnick $chan]} {
  4780. set mask *!*@[lindex [split [getchanhost $bnick $chan] "@"] 1]
  4781. }
  4782. newban $mask $hand $reason $time
  4783. if {$time == "0"} { set reply "Permanent" } else { set reply "$time" }
  4784. blacktools:tell $nick $host $hand $chan $chan1 b.8 "$mask $reply"
  4785. return 0
  4786. }
  4787. foreach c [channels] {
  4788. set backchan [channel get $c backchan]
  4789. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  4790. set chan "$c"
  4791. }
  4792. }
  4793. if {[regexp {^[\\+!#&]} $bnick] && [matchattr $hand nm|- $chan]} {
  4794. set chan "$bnick"
  4795. set bnick [lindex [split $arg] 1]
  4796. set mask [lindex [split $arg] 1]
  4797. set time [lindex [split $arg] 2]
  4798. set reason [join [lrange [split $arg] 3 end]]
  4799. if {![regexp {^[0-9]} $time]} {
  4800. set reason [join [lrange [split $arg] 2 end]]
  4801. set time "$black(btime)"
  4802. }
  4803. }
  4804. if {![regexp {^[0-9]} $time]} {
  4805. set time "$black(btime)"
  4806. set reason [join [lrange [split $arg] 1 end]]
  4807. }
  4808. b:local $bnick $mask $time $nick $reason $hand $host $chan $chan1 $type
  4809. }
  4810. ################################### n #################################
  4811. proc n:process {bnick nick hand host chan chan1 type} {
  4812. global botnick black
  4813. set char(p) [lindex $black(cmdchar) 0]
  4814. if {[string match -nocase "$char(p)" "none"]} {
  4815. set char(p) ""
  4816. }
  4817. set handle [nick2hand $bnick]
  4818. if {![validchan $chan]} {
  4819. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  4820. return 0
  4821. }
  4822. if {![onchan $botnick $chan]} {
  4823. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  4824. return 0
  4825. }
  4826. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  4827. return 0
  4828. }
  4829. if {[matchattr $handle $black(exceptflags) $chan]} {
  4830. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  4831. return 0
  4832. }
  4833. set getreason [channel get $chan n-reason]
  4834. if {$getreason == ""} {
  4835. set getlang [string tolower [channel get $chan lang]]
  4836. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  4837. set getreason $black(say.$getlang.n.5)
  4838. }
  4839. if {[channel get $chan showhandle]} {
  4840. set reason "($hand) $getreason"
  4841. } else { set reason "$getreason"
  4842. }
  4843. set getbantime [channel get $chan n-bantime]
  4844. if {$getbantime == "0"} { set getbantime $black(ntime) }
  4845. if {[isbotnick $bnick]} {
  4846. return 0
  4847. }
  4848. if {![botisop $chan]} {
  4849. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  4850. return 0
  4851. }
  4852. if {[matchattr $hand nm|- $chan]} {
  4853. if {($bnick == "") && ($type == "0")} {
  4854. blacktools:tell $nick $host $hand $chan $chan1 n.1 none
  4855. return 0
  4856. }
  4857. if {($bnick == "") && ($type == "1")} {
  4858. blacktools:tell $nick $host $hand $chan $chan1 n.2 none
  4859. return 0
  4860. }
  4861. }
  4862. if {($bnick == "") && ($type == "0")} {
  4863. blacktools:tell $nick $host $hand $chan $chan1 n.3 none
  4864. return 0
  4865. }
  4866. if {($bnick == "") && ($type == "1")} {
  4867. blacktools:tell $nick $host $hand $chan $chan1 n.4 none
  4868. return 0
  4869. }
  4870. if {[onchan $bnick $chan]} {
  4871. set mask "$bnick*!*@*"
  4872. } else {
  4873. blacktools:tell $nick $host $hand $chan $chan1 gl.usernotonchan "$bnick"
  4874. return 0
  4875. }
  4876. blacktools:banner:3 $mask $hand $chan $reason $getbantime n($chan)
  4877. }
  4878. proc npublic {nick host hand chan arg} {
  4879. global botnick black
  4880. set bnick [lindex [split $arg] 0]
  4881. set type 0
  4882. set handle [nick2hand $bnick]
  4883. set chan1 "$chan"
  4884. foreach c [channels] {
  4885. set backchan [channel get $c backchan]
  4886. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  4887. set chan "$c"
  4888. }
  4889. }
  4890. if {[regexp {^[\\+!#&]} $bnick] && [matchattr $hand nm|- $chan]} {
  4891. set chan "$bnick"
  4892. set bnick [lindex [split $arg] 1]
  4893. }
  4894. n:process $bnick $nick $hand $host $chan $chan1 $type
  4895. }
  4896. ################################## id #################################
  4897. proc idpublic {nick host hand chan arg} {
  4898. global botnick black
  4899. set idnick [lindex [split $arg] 0]
  4900. set char(p) [lindex $black(cmdchar) 0]
  4901. if {[string match -nocase "$char(p)" "none"]} {
  4902. set char(p) ""
  4903. }
  4904. set handle [nick2hand $idnick]
  4905. set type 0
  4906. set chan1 "$chan"
  4907. foreach c [channels] {
  4908. set backchan [channel get $c backchan]
  4909. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  4910. set chan "$c"
  4911. }
  4912. }
  4913. if {[regexp {^[\\+!#&]} $idnick] && [matchattr $hand nm|- $chan]} {
  4914. set chan "$idnick"
  4915. set idnick [lindex [split $arg] 1]
  4916. }
  4917. id:process $idnick $nick $hand $host $chan $chan1 $type
  4918. }
  4919. proc id:process {idnick nick hand host chan chan1 type} {
  4920. global botnick black
  4921. set handle [nick2hand $idnick]
  4922. set char(p) [lindex $black(cmdchar) 0]
  4923. if {[string match -nocase "$char(p)" "none"]} {
  4924. set char(p) ""
  4925. }
  4926. if {![validchan $chan]} {
  4927. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  4928. return 0
  4929. }
  4930. if {![onchan $botnick $chan]} {
  4931. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  4932. return 0
  4933. }
  4934. set uhost [getchanhost $idnick $chan]
  4935. set ident "[string trimleft [string tolower [lindex [split $uhost "@"] 0]] "~"]"
  4936. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  4937. return 0
  4938. }
  4939. if {[matchattr $handle $black(exceptflags) $chan]} {
  4940. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  4941. return 0
  4942. }
  4943. set getreason [channel get $chan id-reason]
  4944. if {$getreason == ""} {
  4945. set getlang [string tolower [channel get $chan lang]]
  4946. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  4947. set getreason $black(say.$getlang.id.5)
  4948. }
  4949. if {[channel get $chan showhandle]} {
  4950. set reason "($hand) $getreason"
  4951. } else { set reason "$getreason"
  4952. }
  4953. set getbantime [channel get $chan id-bantime]
  4954. if {$getbantime == "0"} { set getbantime $black(idtime) }
  4955. if {[isbotnick $idnick]} {
  4956. return 0
  4957. }
  4958. if {![botisop $chan]} {
  4959. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  4960. return 0
  4961. }
  4962. if {[matchattr $hand nm|- $chan]} {
  4963. if {($idnick == "") && ($type == "0")} {
  4964. blacktools:tell $nick $host $hand $chan $chan1 id.1 none
  4965. return 0
  4966. }
  4967. if {($idnick == "") && ($type == "1")} {
  4968. blacktools:tell $nick $host $hand $chan $chan1 id.2 none
  4969. return 0
  4970. }
  4971. }
  4972. if {($idnick == "") && ($type == "0")} {
  4973. blacktools:tell $nick $host $hand $chan $chan1 id.3 none
  4974. return 0
  4975. }
  4976. if {($idnick == "") && ($type == "1")} {
  4977. blacktools:tell $nick $host $hand $chan $chan1 id.4 none
  4978. return 0
  4979. }
  4980. if {[onchan $idnick $chan]} {
  4981. set mask "*!*$ident@*"
  4982. } else { blacktools:tell $nick $host $hand $chan $chan1 gl.usernotonchan "$idnick"
  4983. return 0
  4984. }
  4985. blacktools:banner:3 $mask $hand $chan $getreason $getbantime id($chan)
  4986. }
  4987. ############################### black #################################
  4988. proc black:process {blnick nick mask hand host chan chan1 reason type} {
  4989. global botnick black
  4990. set char(p) [lindex $black(cmdchar) 0]
  4991. if {[string match -nocase "$char(p)" "none"]} {
  4992. set char(p) ""
  4993. }
  4994. set handle [nick2hand $blnick]
  4995. if {![validchan $chan]} {
  4996. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  4997. return 0
  4998. }
  4999. if {![onchan $botnick $chan]} {
  5000. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  5001. return 0
  5002. }
  5003. set list [userlist $black(exceptflags) $chan]
  5004. if {[matchattr $hand -|q $chan]} {
  5005. blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  5006. return 0
  5007. }
  5008. foreach user $list {
  5009. set hosts [getuser $user hosts]
  5010. foreach host $hosts {
  5011. if {[string match -nocase $mask $host]} {
  5012. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  5013. return 0
  5014. }
  5015. }
  5016. }
  5017. if {[matchattr $handle $black(exceptflags) $chan]} {
  5018. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  5019. return 0
  5020. }
  5021. if {$reason == ""} {
  5022. set getlang [string tolower [channel get $chan lang]]
  5023. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  5024. set reason1 "BlackListed: $black(say.$getlang.black.5)"
  5025. } else { set reason1 "BlackListed: $reason" }
  5026. if {[channel get $chan showhandle]} {
  5027. set reason "($hand) $reason1"
  5028. } else { set reason "$reason1"
  5029. }
  5030. if {[isbotnick $blnick]} {
  5031. return 0
  5032. }
  5033. if {![botisop $chan]} {
  5034. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  5035. return 0
  5036. }
  5037. if {$mask == "*!*@*"} {
  5038. return 0
  5039. }
  5040. if {[onchan $blnick $chan]} {
  5041. set mask *!*@[lindex [split [getchanhost $blnick $chan] "@"] 1]
  5042. }
  5043. if {[matchattr $hand nm|- $chan]} {
  5044. if {($blnick == "") && ($type == "0")} {
  5045. blacktools:tell $nick $host $hand $chan $chan1 black.1 none
  5046. return 0
  5047. }
  5048. if {($blnick == "") && ($type == "1")} {
  5049. blacktools:tell $nick $host $hand $chan $chan1 black.2 none
  5050. return 0
  5051. }
  5052. }
  5053. if {($blnick == "") && ($type == "0")} {
  5054. blacktools:tell $nick $host $hand $chan $chan1 black.3 none
  5055. return 0
  5056. }
  5057. if {($blnick == "") && ($type == "1")} {
  5058. blacktools:tell $nick $host $hand $chan $chan1 black.4 none
  5059. return 0
  5060. }
  5061. blacktools:banner:3 $mask $hand $chan $reason 0 Black($chan)
  5062. }
  5063. proc blackpublic {nick host hand chan arg} {
  5064. global botnick black
  5065. set blnick [lindex [split $arg] 0]
  5066. set mask [lindex [split $arg] 0]
  5067. set type 0
  5068. set reason [join [lrange [split $arg] 1 end]]
  5069. set handle [nick2hand $blnick]
  5070. set chan1 "$chan"
  5071. foreach c [channels] {
  5072. set backchan [channel get $c backchan]
  5073. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  5074. set chan "$c"
  5075. }
  5076. }
  5077. if {[regexp {^[\\+!#&]} $blnick] && [matchattr $hand nm|- $chan]} {
  5078. set chan "$blnick"
  5079. set blnick [lindex [split $arg] 1]
  5080. set mask [lindex [split $arg] 1]
  5081. set reason [join [lrange [split $arg] 2 end]]
  5082. }
  5083. black:process $blnick $nick $mask $hand $host $chan $chan1 $reason $type
  5084. }
  5085. ################################ w ####################################
  5086. proc wpublic {nick host hand chan arg} {
  5087. global botnick black
  5088. set wnick [lindex [split $arg] 0]
  5089. set type 0
  5090. set handle [nick2hand $wnick]
  5091. set chan1 "$chan"
  5092. foreach c [channels] {
  5093. set backchan [channel get $c backchan]
  5094. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  5095. set chan "$c"
  5096. }
  5097. }
  5098. if {[regexp {^[\\+!#&]} $wnick] && [matchattr $hand nm|- $chan]} {
  5099. set chan "$wnick"
  5100. set wnick [lindex [split $arg] 1]
  5101. }
  5102. w:process $wnick $nick $hand $host $chan $chan1 $type
  5103. }
  5104. proc w:process {wnick nick hand host chan chan1 type} {
  5105. global botnick black
  5106. set handle [nick2hand $wnick]
  5107. set char(p) [lindex $black(cmdchar) 0]
  5108. if {[string match -nocase "$char(p)" "none"]} {
  5109. set char(p) ""
  5110. }
  5111. if {![validchan $chan]} {
  5112. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  5113. return 0
  5114. }
  5115. if {![onchan $botnick $chan]} {
  5116. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  5117. return 0
  5118. }
  5119. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  5120. return 0
  5121. }
  5122. if {[isbotnick $wnick]} {
  5123. return 0
  5124. }
  5125. if {[matchattr $handle $black(exceptflags) $chan]} {
  5126. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  5127. return 0
  5128. }
  5129. set getreason [channel get $chan w-reason]
  5130. if {$getreason == ""} {
  5131. set getlang [string tolower [channel get $chan lang]]
  5132. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  5133. set getreason $black(say.$getlang.w.5)
  5134. }
  5135. if {[channel get $chan showhandle]} {
  5136. set reason "($hand) $getreason"
  5137. } else { set reason "$getreason"
  5138. }
  5139. if {![botisop $chan]} {
  5140. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  5141. return 0
  5142. }
  5143. if {[matchattr $hand nm|- $chan]} {
  5144. if {($wnick == "") && ($type == "0")} {
  5145. blacktools:tell $nick $host $hand $chan $chan1 w.1 none
  5146. return 0
  5147. }
  5148. if {($wnick == "") && ($type == "1")} {
  5149. blacktools:tell $nick $host $hand $chan $chan1 w.2 none
  5150. return 0
  5151. }
  5152. }
  5153. if {($wnick == "") && ($type == "0")} {
  5154. blacktools:tell $nick $host $hand $chan $chan1 w.3 none
  5155. return 0
  5156. }
  5157. if {($wnick == "") && ($type == "1")} {
  5158. blacktools:tell $nick $host $hand $chan $chan1 w.4 none
  5159. return 0
  5160. }
  5161. set getcount [channel get $chan kickcount]
  5162. set kcount [expr $getcount +1]
  5163. channel set $chan kickcount $kcount
  5164. set countz [getuser $hand XTRA w($chan)]
  5165. if {$countz == ""} { set countz 0 }
  5166. set counts [expr $countz + 1]
  5167. setuser $hand XTRA w($chan) $counts
  5168. if {[channel get $chan showcount]} {
  5169. set reason "$reason - $kcount -"
  5170. } else {
  5171. set reason "$reason"
  5172. }
  5173. putquick "KICK $chan $wnick :$reason"
  5174. set getlang [string tolower [channel get $chan lang]]
  5175. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  5176. puthelp "PRIVMSG $wnick :$black(say.$getlang.w.6)"
  5177. }
  5178. ############################### spam ##################################
  5179. proc spam:process {spammer mask nick hand host chan chan1 type} {
  5180. global botnick black
  5181. set handle [nick2hand $spammer]
  5182. set char(p) [lindex $black(cmdchar) 0]
  5183. if {[string match -nocase "$char(p)" "none"]} {
  5184. set char(p) ""
  5185. }
  5186. if {![validchan $chan]} {
  5187. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  5188. return 0
  5189. }
  5190. if {![onchan $botnick $chan]} {
  5191. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  5192. return 0
  5193. }
  5194. set list [userlist $black(exceptflags) $chan]
  5195. set getreason [channel get $chan spam-reason]
  5196. if {$getreason == ""} {
  5197. set getlang [string tolower [channel get $chan lang]]
  5198. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  5199. set getreason $black(say.$getlang.spam.5)
  5200. }
  5201. if {[channel get $chan showhandle]} {
  5202. set reason "($hand) $getreason"
  5203. } else { set reason "$getreason"
  5204. }
  5205. set getbantime [channel get $chan spam-bantime]
  5206. if {$getbantime == "0"} { set getbantime $black(spamtime) }
  5207. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  5208. return 0
  5209. }
  5210. foreach user $list {
  5211. set hosts [getuser $user hosts]
  5212. foreach host $hosts {
  5213. if {[string match -nocase $mask $host]} {
  5214. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  5215. return 0
  5216. }
  5217. }
  5218. }
  5219. if {[matchattr $handle $black(exceptflags) $chan]} {
  5220. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  5221. return 0
  5222. }
  5223. if {$mask == "*!*@*"} {
  5224. return 0
  5225. }
  5226. if {[isbotnick $spammer]} {
  5227. return 0
  5228. }
  5229. if {![botisop $chan]} {
  5230. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  5231. return 0
  5232. }
  5233. if {[onchan $spammer $chan]} {
  5234. set mask *!*@[lindex [split [getchanhost $spammer $chan] "@"] 1]
  5235. }
  5236. if {[matchattr $hand nm|- $chan]} {
  5237. if {($spammer == "") && ($type == "0")} {
  5238. blacktools:tell $nick $host $hand $chan $chan1 spam.1 none
  5239. return 0
  5240. }
  5241. if {($spammer == "") && ($type == "1")} {
  5242. blacktools:tell $nick $host $hand $chan $chan1 spam.2 none
  5243. return 0
  5244. }
  5245. }
  5246. if {($spammer == "") && ($type == "0")} {
  5247. blacktools:tell $nick $host $hand $chan $chan1 spam.3 none
  5248. return 0
  5249. }
  5250. if {($spammer == "") && ($type == "1")} {
  5251. blacktools:tell $nick $host $hand $chan $chan1 spam.4 none
  5252. return 0
  5253. }
  5254. blacktools:banner:3 $mask $hand $chan $reason $getbantime spam($chan)
  5255. }
  5256. proc spampublic {nick host hand chan arg} {
  5257. global botnick black
  5258. set spammer [lindex [split $arg] 0]
  5259. set chan1 "$chan"
  5260. set type 0
  5261. set mask [lindex [split $arg] 0]
  5262. set handle [nick2hand $spammer]
  5263. foreach c [channels] {
  5264. set backchan [channel get $c backchan]
  5265. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  5266. set chan "$c"
  5267. }
  5268. }
  5269. if {[regexp {^[\\+!#&]} $spammer] && [matchattr $hand nm|- $chan]} {
  5270. set chan "$spammer"
  5271. set spammer [lindex [split $arg] 1]
  5272. set mask [lindex [split $arg] 1]
  5273. }
  5274. spam:process $spammer $mask $nick $hand $host $chan $chan1 $type
  5275. }
  5276. ################################### k #################################
  5277. proc k:process {knick nick hand host reason chan chan1 type} {
  5278. global botnick black
  5279. set char(p) [lindex $black(cmdchar) 0]
  5280. if {[string match -nocase "$char(p)" "none"]} {
  5281. set char(p) ""
  5282. }
  5283. set handle [nick2hand $knick]
  5284. if {![validchan $chan]} {
  5285. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  5286. return 0
  5287. }
  5288. if {![onchan $botnick $chan]} {
  5289. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  5290. return 0
  5291. }
  5292. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  5293. return 0
  5294. }
  5295. if {[isbotnick $knick]} {
  5296. return 0
  5297. }
  5298. if {[matchattr $handle $black(exceptflags) $chan] && ($black(kaccess) == "1")} {
  5299. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  5300. return 0
  5301. }
  5302. if {$reason == ""} {
  5303. set getlang [string tolower [channel get $chan lang]]
  5304. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  5305. set reason1 "$black(say.$getlang.k.5)"
  5306. } else { set reason1 "$reason" }
  5307. if {[channel get $chan showhandle]} {
  5308. set reason "($hand) $reason1"
  5309. } else { set reason "$reason1"
  5310. }
  5311. if {![botisop $chan]} {
  5312. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  5313. return 0
  5314. }
  5315. if {[matchattr $hand nm|- $chan]} {
  5316. if {($knick == "") && ($type == "0")} {
  5317. blacktools:tell $nick $host $hand $chan $chan1 k.1 none
  5318. return 0
  5319. }
  5320. if {($knick == "") && ($type == "1")} {
  5321. blacktools:tell $nick $host $hand $chan $chan1 k.2 none
  5322. return 0
  5323. }
  5324. }
  5325. if {($knick == "") && ($type == "0")} {
  5326. blacktools:tell $nick $host $hand $chan $chan1 k.3 none
  5327. return 0
  5328. }
  5329. if {($knick == "") && ($type == "1")} {
  5330. blacktools:tell $nick $host $hand $chan $chan1 k.4 none
  5331. return 0
  5332. }
  5333. if {![onchan $knick $chan]} {
  5334. blacktools:tell $nick $host $hand $chan $chan1 gl.usernotonchan "$knick"
  5335. return 0
  5336. }
  5337. set getcount [channel get $chan kickcount]
  5338. set kcount [expr $getcount +1]
  5339. channel set $chan kickcount $kcount
  5340. set countz [getuser $hand XTRA k($chan)]
  5341. if {$countz == ""} { set countz 0 }
  5342. set counts [expr $countz + 1]
  5343. setuser $hand XTRA k($chan) $counts
  5344. if {[channel get $chan showcount]} {
  5345. set reason "$reason - $kcount -"
  5346. } else {
  5347. set reason "$reason"
  5348. }
  5349. putquick "KICK $chan $knick :$reason"
  5350. }
  5351. proc kpublic {nick host hand chan arg} {
  5352. global botnick black
  5353. set knick [lindex [split $arg] 0]
  5354. set type 0
  5355. set reason [join [lrange [split $arg] 1 end]]
  5356. set handle [nick2hand $knick]
  5357. set chan1 "$chan"
  5358. foreach c [channels] {
  5359. set backchan [channel get $c backchan]
  5360. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  5361. set chan "$c"
  5362. }
  5363. }
  5364. if {[regexp {^[\\+!#&]} $knick] && [matchattr $hand nm|- $chan]} {
  5365. set chan "$knick"
  5366. set knick [lindex [split $arg] 1]
  5367. set reason [join [lrange [split $arg] 2 end]]
  5368. }
  5369. k:process $knick $nick $hand $host $reason $chan $chan1 $type
  5370. }
  5371. ################################### gag ###############################
  5372. proc gag:process {gagger nick hand host chan chan1 type} {
  5373. global botnick black
  5374. set char(p) [lindex $black(cmdchar) 0]
  5375. if {[string match -nocase "$char(p)" "none"]} {
  5376. set char(p) ""
  5377. }
  5378. set handle [nick2hand $gagger]
  5379. if {![validchan $chan]} {
  5380. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  5381. return 0
  5382. }
  5383. if {![onchan $botnick $chan]} {
  5384. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  5385. return 0
  5386. }
  5387. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  5388. return 0
  5389. }
  5390. if {[matchattr $hand nm|- $chan]} {
  5391. if {($gagger == "") && ($type == "0")} {
  5392. blacktools:tell $nick $host $hand $chan $chan1 gag.1 none
  5393. return 0
  5394. }
  5395. if {($gagger == "") && ($type == "1")} {
  5396. blacktools:tell $nick $host $hand $chan $chan1 gag.2 none
  5397. return 0
  5398. }
  5399. }
  5400. if {($gagger == "") && ($type == "0")} {
  5401. blacktools:tell $nick $host $hand $chan $chan1 gag.3 none
  5402. return 0
  5403. }
  5404. if {($gagger == "") && ($type == "1")} {
  5405. blacktools:tell $nick $host $hand $chan $chan1 gag.4 none
  5406. return 0
  5407. }
  5408. if {[matchattr $handle $black(exceptflags) $chan]} {
  5409. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  5410. return 0
  5411. }
  5412. if {[isbotnick $gagger]} {
  5413. return 0
  5414. }
  5415. if {![botisop $chan]} {
  5416. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  5417. return 0
  5418. }
  5419. if {[onchan $gagger $chan]} {
  5420. set mask *!*@[lindex [split [getchanhost $gagger $chan] "@"] 1]
  5421. } else { blacktools:tell $nick $host $hand $chan $chan1 gl.usernotonchan "$gagger"
  5422. return 0
  5423. }
  5424. putquick "MODE $chan +b $mask"
  5425. blacktools:tell $gagger $host $hand $chan $chan1 gag.5 "$gagger"
  5426. }
  5427. proc gagpublic {nick host hand chan arg} {
  5428. global black
  5429. set gagger [lindex [split $arg] 0]
  5430. set type 0
  5431. set handle [nick2hand $gagger]
  5432. set chan1 "$chan"
  5433. foreach c [channels] {
  5434. set backchan [channel get $c backchan]
  5435. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  5436. set chan "$c"
  5437. }
  5438. }
  5439. if {[regexp {^[\\+!#&]} $gagger] && [matchattr $hand nm|- $chan]} {
  5440. set chan "$gagger"
  5441. set gagger [lindex [split $arg] 1]
  5442. }
  5443. gag:process $gagger $nick $hand $host $chan $chan1 $type
  5444. }
  5445. ################################## bw #################################
  5446. proc bw:process {abuser mask nick hand host chan chan1 type} {
  5447. global botnick black
  5448. set char(p) [lindex $black(cmdchar) 0]
  5449. if {[string match -nocase "$char(p)" "none"]} {
  5450. set char(p) ""
  5451. }
  5452. set handle [nick2hand $abuser]
  5453. if {![validchan $chan]} {
  5454. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  5455. return 0
  5456. }
  5457. if {![onchan $botnick $chan]} {
  5458. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  5459. return 0
  5460. }
  5461. set list [userlist $black(exceptflags) $chan]
  5462. set getreason [channel get $chan bw-reason]
  5463. if {$getreason == ""} {
  5464. set getlang [string tolower [channel get $chan lang]]
  5465. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  5466. set getreason $black(say.$getlang.bw.5)
  5467. }
  5468. if {[channel get $chan showhandle]} {
  5469. set reason "($hand) $getreason"
  5470. } else { set reason "$getreason"
  5471. }
  5472. set getbantime [channel get $chan bw-bantime]
  5473. if {$getbantime == "0"} { set getbantime $black(bwtime) }
  5474. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  5475. return 0
  5476. }
  5477. foreach user $list {
  5478. set hosts [getuser $user hosts]
  5479. foreach host $hosts {
  5480. if {[string match -nocase $mask $host]} {
  5481. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  5482. return 0
  5483. }
  5484. }
  5485. }
  5486. if {[matchattr $handle $black(exceptflags) $chan]} {
  5487. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  5488. return 0
  5489. }
  5490. if {$mask == "*!*@*"} {
  5491. return 0
  5492. }
  5493. if {[isbotnick $abuser]} {
  5494. return 0
  5495. }
  5496. if {![botisop $chan]} {
  5497. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  5498. return 0
  5499. }
  5500. if {[onchan $abuser $chan]} {
  5501. set mask *!*@[lindex [split [getchanhost $abuser $chan] "@"] 1]
  5502. }
  5503. if {[matchattr $hand nm|- $chan]} {
  5504. if {($abuser == "") && ($type == "0")} {
  5505. blacktools:tell $nick $host $hand $chan $chan1 bw.1 none
  5506. return 0
  5507. }
  5508. if {($abuser == "") && ($type == "1")} {
  5509. blacktools:tell $nick $host $hand $chan $chan1 bw.2 none
  5510. return 0
  5511. }
  5512. }
  5513. if {($abuser == "") && ($type == "0")} {
  5514. blacktools:tell $nick $host $hand $chan $chan1 bw.3 none
  5515. return 0
  5516. }
  5517. if {($abuser == "") && ($type == "1")} {
  5518. blacktools:tell $nick $host $hand $chan $chan1 bw.4 none
  5519. return 0
  5520. }
  5521. blacktools:banner:3 $mask $hand $chan $reason $getbantime bw($chan)
  5522. }
  5523. proc bwpublic {nick host hand chan arg} {
  5524. global botnick black
  5525. set abuser [lindex [split $arg] 0]
  5526. set mask [lindex [split $arg] 0]
  5527. set type 0
  5528. set handle [nick2hand $abuser]
  5529. set chan1 "$chan"
  5530. foreach c [channels] {
  5531. set backchan [channel get $c backchan]
  5532. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  5533. set chan "$c"
  5534. }
  5535. }
  5536. if {[regexp {^[\\+!#&]} $abuser] && [matchattr $hand nm|- $chan]} {
  5537. set chan "$abuser"
  5538. set abuser [lindex [split $arg] 1]
  5539. set mask [lindex [split $arg] 1]
  5540. }
  5541. bw:process $abuser $mask $nick $hand $host $chan $chan1 $type
  5542. }
  5543. ################################ ub ###################################
  5544. proc ub:process {ban why nick hand host chan chan1 type} {
  5545. global botnick black
  5546. set char(p) [lindex $black(cmdchar) 0]
  5547. if {[string match -nocase "$char(p)" "none"]} {
  5548. set char(p) ""
  5549. }
  5550. if {![validchan $chan]} {
  5551. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  5552. return 0
  5553. }
  5554. if {![onchan $botnick $chan]} {
  5555. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  5556. return 0
  5557. }
  5558. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  5559. return 0
  5560. }
  5561. if {[matchattr $hand nm|- $chan]} {
  5562. if {($ban == "") && ($type == "0")} {
  5563. blacktools:tell $nick $host $hand $chan $chan1 ub.1 none
  5564. return 0
  5565. }
  5566. if {($ban == "") && ($type == "1")} {
  5567. blacktools:tell $nick $host $hand $chan $chan1 ub.2 none
  5568. return 0
  5569. }
  5570. }
  5571. if {($ban == "") && ($type == "0")} {
  5572. blacktools:tell $nick $host $hand $chan $chan1 ub.3 none
  5573. return 0
  5574. }
  5575. if {($ban == "") && ($type == "1")} {
  5576. blacktools:tell $nick $host $hand $chan $chan1 ub.4 none
  5577. return 0
  5578. }
  5579. if {$ban == "*!*@*"} {
  5580. return 0
  5581. }
  5582. if {![botisop $chan]} {
  5583. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  5584. return 0
  5585. }
  5586. if {[ispermban $ban $chan] && [matchattr $hand -|O $chan]} {
  5587. blacktools:tell $nick $host $hand $chan $chan1 ub.5 none
  5588. return 0
  5589. }
  5590. if {($why == "global") && [matchattr $hand nm|- $chan]} {
  5591. if {[killban $ban] == "0"} {
  5592. set notfound 1
  5593. }
  5594. killban $ban
  5595. if {![info exists notfound]} {
  5596. blacktools:tell $nick $host $hand $chan $chan1 ub.6 $ban
  5597. return 0
  5598. } else { blacktools:tell $nick $host $hand $chan $chan1 ub.7 none
  5599. return 0
  5600. }
  5601. }
  5602. if {[killchanban $chan $ban] == "0"} {
  5603. set notfound 1
  5604. }
  5605. killchanban $chan $ban
  5606. if {[onchan "X" $chan]} {
  5607. putquick "PRIVMSG $black(chanserv) :unban $chan $ban"
  5608. }
  5609. putquick "MODE $chan -b $ban"
  5610. if {![info exists notfound]} {
  5611. blacktools:tell $nick $host $hand $chan $chan1 ub.8 $ban
  5612. } else { blacktools:tell $nick $host $hand $chan $chan1 ub.9 none
  5613. return 0
  5614. }
  5615. if {[channel get $chan chanreport]} {
  5616. set backchan [channel get $chan backchan]
  5617. if {$backchan == ""} {
  5618. return 0
  5619. }
  5620. if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
  5621. return 0
  5622. }
  5623. blacktools:tell $nick $host $hand $chan $backchan ub.10 "$hand $ban"
  5624. }
  5625. }
  5626. proc ubpublic {nick host hand chan arg} {
  5627. global botnick black
  5628. set ban [lindex [split $arg] 0]
  5629. set why [lindex [split $arg] 1]
  5630. set type 0
  5631. set chan1 "$chan"
  5632. foreach c [channels] {
  5633. set backchan [channel get $c backchan]
  5634. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  5635. set chan "$c"
  5636. }
  5637. }
  5638. if {[regexp {^[\\+!#&]} $ban] && [matchattr $hand nm|- $chan]} {
  5639. set chan "$ban"
  5640. set ban [lindex [split $arg] 1]
  5641. }
  5642. ub:process $ban $why $nick $hand $host $chan $chan1 $type
  5643. }
  5644. ################################ sb ###################################
  5645. proc sb:process {bhost what nick hand host chan chan1 type} {
  5646. global botnick black
  5647. set char(p) [lindex $black(cmdchar) 0]
  5648. if {[string match -nocase "$char(p)" "none"]} {
  5649. set char(p) ""
  5650. }
  5651. if {![validchan $chan]} {
  5652. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  5653. return 0
  5654. }
  5655. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  5656. return 0
  5657. }
  5658. if {[matchattr $hand nm|- $chan]} {
  5659. if {($bhost == "") && ($type == "0")} {
  5660. blacktools:tell $nick $host $hand $chan $chan1 sb.1 none
  5661. return 0
  5662. }
  5663. if {($bhost == "") && ($type == "1")} {
  5664. blacktools:tell $nick $host $hand $chan $chan1 sb.2 none
  5665. return 0
  5666. }
  5667. }
  5668. if {($bhost == "") && ($type == "0")} {
  5669. blacktools:tell $nick $host $hand $chan $chan1 sb.3 none
  5670. return 0
  5671. }
  5672. if {($bhost == "") && ($type == "1")} {
  5673. blacktools:tell $nick $host $hand $chan $chan1 sb.4 none
  5674. return 0
  5675. }
  5676. if {[string match -nocase $what "global"] && [matchattr $hand mn|- $chan]} {
  5677. foreach ban [banlist] {
  5678. set expire [clock format [lindex $ban 2] -format %D-%H:%M:%S]
  5679. set created [clock format [lindex $ban 3] -format %D-%H:%M:%S]
  5680. set fban [lindex $ban 0]
  5681. set freason [lindex $ban 1]
  5682. set fbywho [lindex $ban 5]
  5683. if {[string match $bhost [string tolower [lindex $ban 0]]]} {
  5684. set foundban 1
  5685. if {[lindex $ban 2] == 0} {
  5686. if {[isbansticky [lindex $ban 0]]} {
  5687. blacktools:tell $nick $host $hand $chan $chan1 sb.5 "$fban $fbywho $created 0 $freason"
  5688. } else {
  5689. blacktools:tell $nick $host $hand $chan $chan1 sb.6 "$fban $fbywho $created 0 $freason"
  5690. }
  5691. } else {
  5692. if {[isbansticky [lindex $ban 0]]} {
  5693. blacktools:tell $nick $host $hand $chan $chan1 sb.7 "$fban $fbywho $created $expire $freason"
  5694. } else {
  5695. blacktools:tell $nick $host $hand $chan $chan1 sb.8 "$fban $fbywho $created $expire $freason"
  5696. }
  5697. }
  5698. }
  5699. }
  5700. if {![info exists foundban]} {
  5701. blacktools:tell $nick $host $hand $chan $chan1 sb.13 none
  5702. }
  5703. return 0
  5704. }
  5705. foreach ban [banlist $chan] {
  5706. set expire [clock format [lindex $ban 2] -format %D-%H:%M:%S]
  5707. set created [clock format [lindex $ban 3] -format %D-%H:%M:%S]
  5708. set fban [lindex $ban 0]
  5709. set freason [lindex $ban 1]
  5710. set fbywho [lindex $ban 5]
  5711. if {[string match $bhost [string tolower [lindex $ban 0]]]} {
  5712. set foundban 1
  5713. if {[lindex $ban 2] == 0} {
  5714. if {[isbansticky [lindex $ban 0] $chan]} {
  5715. blacktools:tell $nick $host $hand $chan $chan1 sb.9 "$fban $fbywho $created $expire $freason"
  5716. } else {
  5717. blacktools:tell $nick $host $hand $chan $chan1 sb.10 "$fban $fbywho $created 0 $freason"
  5718. }
  5719. } else {
  5720. if {[isbansticky [lindex $ban 0] $chan]} {
  5721. blacktools:tell $nick $host $hand $chan $chan1 sb.11 "$fban $fbywho $created $expire $freason"
  5722. } else {
  5723. blacktools:tell $nick $host $hand $chan $chan1 sb.12 "$fban $fbywho $created $expire $freason"
  5724. }
  5725. }
  5726. }
  5727. }
  5728. if {![info exists foundban]} {
  5729. blacktools:tell $nick $host $hand $chan $chan1 sb.13 none
  5730. return 0
  5731. }
  5732. }
  5733. proc sbpublic {nick host hand chan arg} {
  5734. global botnick black
  5735. set bhost [string tolower [lindex [split $arg] 0]]
  5736. set what [lindex [split $arg] 1]
  5737. set chan1 "$chan"
  5738. set type 0
  5739. foreach c [channels] {
  5740. set backchan [channel get $c backchan]
  5741. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  5742. set chan "$c"
  5743. }
  5744. }
  5745. if {[regexp {^[\\+!#&]} $bhost] && [matchattr $hand nm|- $chan]} {
  5746. set chan "$bhost"
  5747. set bhost [string tolower [lindex [split $arg] 1]]
  5748. set what [lindex [split $arg] 2]
  5749. }
  5750. sb:process $bhost $what $nick $hand $host $chan $chan1 $type
  5751. }
  5752. ################################# d ###################################
  5753. proc d:process {dnick mask days reason nick hand host chan chan1 type} {
  5754. global botnick black
  5755. set char(p) [lindex $black(cmdchar) 0]
  5756. if {[string match -nocase "$char(p)" "none"]} {
  5757. set char(p) ""
  5758. }
  5759. set handle [nick2hand $dnick]
  5760. if {![validchan $chan]} {
  5761. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  5762. return 0
  5763. }
  5764. if {![onchan $botnick $chan]} {
  5765. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  5766. return 0
  5767. }
  5768. set list [userlist $black(exceptflags) $chan]
  5769. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  5770. return 0
  5771. }
  5772. if {[matchattr $hand nm|- $chan]} {
  5773. if {($dnick == "") && ($type == "0")} {
  5774. blacktools:tell $nick $host $hand $chan $chan1 d.1 none
  5775. return 0
  5776. }
  5777. if {($dnick == "") && ($type == "1")} {
  5778. blacktools:tell $nick $host $hand $chan $chan1 d.2 none
  5779. return 0
  5780. }
  5781. }
  5782. if {($dnick == "") && ($type == "0")} {
  5783. blacktools:tell $nick $host $hand $chan $chan1 d.3 none
  5784. return 0
  5785. }
  5786. if {($dnick == "") && ($type == "1")} {
  5787. blacktools:tell $nick $host $hand $chan $chan1 d.4 none
  5788. return 0
  5789. }
  5790. foreach user $list {
  5791. set hosts [getuser $user hosts]
  5792. foreach host $hosts {
  5793. if {[string match -nocase $mask $host]} {
  5794. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  5795. return 0
  5796. }
  5797. }
  5798. }
  5799. if {[matchattr $handle $black(exceptflags) $chan]} {
  5800. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  5801. return 0
  5802. }
  5803. if {$reason == ""} {
  5804. set getlang [string tolower [channel get $chan lang]]
  5805. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  5806. set reason1 $black(say.$getlang.d.5)
  5807. } else { set reason1 "$reason" }
  5808. if {[channel get $chan showhandle]} {
  5809. set reason "($hand) $reason1"
  5810. } else { set reason "$reason1"
  5811. }
  5812. if {[isbotnick $dnick]} {
  5813. return 0
  5814. }
  5815. if {![botisop $chan]} {
  5816. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  5817. return 0
  5818. }
  5819. if {$mask == "*!*@*"} {
  5820. return 0
  5821. }
  5822. if {[onchan $dnick $chan]} {
  5823. set mask *!*@[lindex [split [getchanhost $dnick $chan] "@"] 1]
  5824. }
  5825. blacktools:banner:3 $mask $hand $chan $reason [expr $days * 1440] d($chan)
  5826. }
  5827. proc dpublic {nick host hand chan arg} {
  5828. global botnick black
  5829. set days [lindex [split $arg] 0]
  5830. set dnick [lindex [split $arg] 1]
  5831. set type 0
  5832. set mask [lindex [split $arg] 1]
  5833. set reason [join [lrange [split $arg] 2 end]]
  5834. set handle [nick2hand $dnick]
  5835. set chan1 "$chan"
  5836. foreach c [channels] {
  5837. set backchan [channel get $c backchan]
  5838. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  5839. set chan "$c"
  5840. }
  5841. }
  5842. if {[regexp {^[\\+!#&]} $days] && [matchattr $hand nm|- $chan]} {
  5843. set chan "$days"
  5844. set days [lindex [split $arg] 1]
  5845. set mask [lindex [split $arg] 2]
  5846. set dnick [lindex [split $arg] 2]
  5847. set reason [join [lrange [split $arg] 3 end]]
  5848. if {![regexp {^[0-9]} $days]} {
  5849. set days 1
  5850. set mask [lindex [split $arg] 1]
  5851. set dnick [lindex [split $arg] 1]
  5852. set reason [join [lrange [split $arg] 2 end]]
  5853. }
  5854. }
  5855. if {![regexp {^[0-9]} $days]} {
  5856. set days 1
  5857. set mask [lindex [split $arg] 0]
  5858. set dnick [lindex [split $arg] 0]
  5859. set reason [join [lrange [split $arg] 1 end]]
  5860. }
  5861. d:process $dnick $mask $days $reason $nick $hand $host $chan $chan1 $type
  5862. }
  5863. ############################### stick #################################
  5864. proc stick:process {snick mask time reason nick hand host chan chan1 type} {
  5865. global botnick black
  5866. set char(p) [lindex $black(cmdchar) 0]
  5867. if {[string match -nocase "$char(p)" "none"]} {
  5868. set char(p) ""
  5869. }
  5870. set handle [nick2hand $snick]
  5871. set list [userlist $black(exceptflags) $chan]
  5872. if {![validchan $chan]} {
  5873. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  5874. return 0
  5875. }
  5876. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  5877. return 0
  5878. }
  5879. if {![onchan $botnick $chan]} {
  5880. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  5881. return 0
  5882. }
  5883. foreach user $list {
  5884. set hosts [getuser $user hosts]
  5885. foreach host $hosts {
  5886. if {[string match $mask $host]} {
  5887. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  5888. return 0
  5889. }
  5890. }
  5891. }
  5892. if {[matchattr $handle nm|AMOVS $chan]} {
  5893. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  5894. return 0
  5895. }
  5896. if {$reason == ""} {
  5897. set getlang [string tolower [channel get $chan lang]]
  5898. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  5899. set reason1 $black(say.$getlang.stick.5)
  5900. } else { set reason1 "$reason" }
  5901. if {[channel get $chan showhandle]} {
  5902. set reason "($hand) $reason1"
  5903. } else { set reason "$reason1"
  5904. }
  5905. if {[isbotnick $snick]} {
  5906. return 0
  5907. }
  5908. if {![botisop $chan]} {
  5909. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  5910. return 0
  5911. }
  5912. if {$mask == "*!*@*"} {
  5913. return 0
  5914. }
  5915. if {[onchan $snick $chan]} {
  5916. set mask *!*@[lindex [split [getchanhost $snick $chan] "@"] 1]
  5917. }
  5918. if {[matchattr $hand nm|- $chan]} {
  5919. if {($snick == "") && ($type == "0")} {
  5920. blacktools:tell $nick $host $hand $chan $chan1 stick.1 none
  5921. return 0
  5922. }
  5923. if {($snick == "") && ($type == "1")} {
  5924. blacktools:tell $nick $host $hand $chan $chan1 stick.2 none
  5925. return 0
  5926. }
  5927. }
  5928. if {($snick == "") && ($type == "0")} {
  5929. blacktools:tell $nick $host $hand $chan $chan1 stick.3 none
  5930. return 0
  5931. }
  5932. if {($snick == "") && ($type == "1")} {
  5933. blacktools:tell $nick $host $hand $chan $chan1 stick.4 none
  5934. return 0
  5935. }
  5936. blacktools:banner:4 $mask $hand $chan $reason $time stick($chan)
  5937. }
  5938. proc stickpublic {nick host hand chan arg} {
  5939. global botnick black
  5940. set snick [lindex [split $arg] 0]
  5941. set mask [lindex [split $arg] 0]
  5942. set chan1 "$chan"
  5943. set type 0
  5944. set time [lindex [split $arg] 1]
  5945. set reason [join [lrange [split $arg] 2 end]]
  5946. set handle [nick2hand $snick]
  5947. foreach c [channels] {
  5948. set backchan [channel get $c backchan]
  5949. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  5950. set chan "$c"
  5951. }
  5952. }
  5953. if {[regexp {^[\\+!#&]} $snick] && [matchattr $hand nm|- $chan]} {
  5954. set chan "$snick"
  5955. set time [lindex [split $arg] 2]
  5956. set mask [lindex [split $arg] 1]
  5957. set snick [lindex [split $arg] 1]
  5958. set reason [join [lrange [split $arg] 3 end]]
  5959. if {![regexp {^[0-9]} $time]} {
  5960. set time "$black(dfstickbantime)"
  5961. set reason [join [lrange [split $arg] 2 end]]
  5962. }
  5963. }
  5964. if {![regexp {^[0-9]} $time]} {
  5965. set time "$black(dfstickbantime)"
  5966. set reason [join [lrange [split $arg] 1 end]]
  5967. }
  5968. stick:process $snick $mask $time $reason $nick $hand $host $chan $chan1 $type
  5969. }
  5970. ################################### t #################################
  5971. proc tpublic {nick host hand chan arg} {
  5972. global black
  5973. set topics [join [lrange [split $arg] 0 end]]
  5974. set c [lindex [split $arg] 0]
  5975. set type 0
  5976. set chan1 "$chan"
  5977. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  5978. set chan "$c"
  5979. set topics [join [lrange [split $arg] 1 end]]
  5980. }
  5981. t:process $nick $host $hand $chan $chan1 $topics $type
  5982. }
  5983. proc t:process {nick host hand chan chan1 topics type} {
  5984. global botnick black
  5985. set char(p) [lindex $black(cmdchar) 0]
  5986. if {[string match -nocase "$char(p)" "none"]} {
  5987. set char(p) ""
  5988. }
  5989. if {[matchattr $hand nm|- $chan]} {
  5990. if {($topics == "") && ($type == "0")} {
  5991. blacktools:tell $nick $host $hand $chan $chan1 t.1 none
  5992. return 0
  5993. }
  5994. if {($topics == "") && ($type == "1")} {
  5995. blacktools:tell $nick $host $hand $chan $chan1 t.2 none
  5996. return 0
  5997. }
  5998. }
  5999. if {($topics == "") && ($type == "0")} {
  6000. blacktools:tell $nick $host $hand $chan $chan1 t.3 none
  6001. return 0
  6002. }
  6003. if {($topics == "") && ($type == "1")} {
  6004. blacktools:tell $nick $host $hand $chan $chan1 t.4 none
  6005. return 0
  6006. }
  6007. if {![validchan $chan]} {
  6008. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  6009. return 0
  6010. }
  6011. if {![onchan $botnick $chan]} {
  6012. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  6013. return 0
  6014. }
  6015. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  6016. return 0
  6017. }
  6018. if {![botisop $chan]} {
  6019. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  6020. return 0
  6021. }
  6022. if {[channel get $chan showhandle]} {
  6023. set topics "($hand) $topics"
  6024. } else { set topics "$topics"
  6025. }
  6026. putquick "TOPIC $chan :$topics"
  6027. }
  6028. ############################## status #################################
  6029. proc statuspublic {nick host hand chan arg} {
  6030. global botnick server uptime {server-online}
  6031. set chan1 "$chan"
  6032. regsub -all " " [channels] ", " chans
  6033. catch {exec uptime} shelluptime
  6034. set up [duration [expr [unixtime] - $uptime]]
  6035. set on [duration [expr [unixtime] - ${server-online}]]
  6036. blacktools:tell $nick $host $hand $chan $chan1 status.1 $up
  6037. blacktools:tell $nick $host $hand $chan $chan1 status.2 $server
  6038. blacktools:tell $nick $host $hand $chan $chan1 status.3 $on
  6039. blacktools:tell $nick $host $hand $chan $chan1 status.4 $chans
  6040. blacktools:tell $nick $host $hand $chan $chan1 status.5 $shelluptime
  6041. }
  6042. ############################## uptime #################################
  6043. proc uptimepublic {nick host hand chan arg} {
  6044. global botnick uptime {server-online} server
  6045. set chan1 "$chan"
  6046. set up [duration [expr [unixtime] - $uptime]]
  6047. set on [duration [expr [unixtime] - ${server-online}]]
  6048. blacktools:tell $nick $host $hand $chan $chan1 status.1 $up
  6049. blacktools:tell $nick $host $hand $chan $chan1 status.2 $server
  6050. blacktools:tell $nick $host $hand $chan $chan1 status.3 $on
  6051. }
  6052. ################################# i ###################################
  6053. proc ipublic {nick host hand chan arg} {
  6054. global botnick black
  6055. set type 0
  6056. set chan1 "$chan"
  6057. set inick [lrange [split $arg] 0 end]
  6058. set c [lindex [split $arg] 0]
  6059. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  6060. set chan "$c"
  6061. set inick [join [lrange [split $arg] 1 end]]
  6062. }
  6063. i:process $nick $host $hand $chan $chan1 $inick $type
  6064. }
  6065. proc i:process {nick host hand chan chan1 inick type} {
  6066. global botnick black
  6067. set char(p) [lindex $black(cmdchar) 0]
  6068. if {[string match -nocase "$char(p)" "none"]} {
  6069. set char(p) ""
  6070. }
  6071. if {[matchattr $hand nm|- $chan]} {
  6072. if {($inick == "") && ($type == "0")} {
  6073. blacktools:tell $nick $host $hand $chan $chan1 i.3 none
  6074. return 0
  6075. }
  6076. if {($inick == "") && ($type == "1")} {
  6077. blacktools:tell $nick $host $hand $chan $chan1 i.4 none
  6078. return 0
  6079. }
  6080. }
  6081. if {($inick == "") && ($type == "0")} {
  6082. blacktools:tell $nick $host $hand $chan $chan1 i.5 none
  6083. return 0
  6084. }
  6085. if {($inick == "") && ($type == "1")} {
  6086. blacktools:tell $nick $host $hand $chan $chan1 i.6 none
  6087. return 0
  6088. }
  6089. if {![validchan $chan]} {
  6090. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  6091. return 0
  6092. }
  6093. if {![onchan $botnick $chan]} {
  6094. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  6095. return 0
  6096. }
  6097. set replace(%nick%) $nick
  6098. set replace(%chan%) $chan
  6099. set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
  6100. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  6101. set getmsg $black(say.$getlang.i.7)
  6102. if {[info exists black(say.$getlang.i.7)]} {
  6103. set imessage [string map [array get replace] $getmsg]
  6104. }
  6105. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  6106. return 0
  6107. }
  6108. if {![botisop $chan]} {
  6109. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  6110. return 0
  6111. }
  6112. foreach in $inick {
  6113. if {[onchan $in $chan]} {
  6114. blacktools:tell $nick $host $hand $chan $chan1 i.1 $in
  6115. return 0
  6116. }
  6117. set countz [getuser $hand XTRA i($chan)]
  6118. if {$countz == ""} { set countz 0 }
  6119. set counts [expr $countz + 1]
  6120. setuser $hand XTRA i($chan) $counts
  6121. putquick "INVITE $in $chan"
  6122. putquick "PRIVMSG $in :$imessage"
  6123. blacktools:tell $nick $host $hand $chan $chan1 i.2 $in
  6124. }
  6125. }
  6126. ############################### addinfo ###############################
  6127. proc addinfopublic {nick host hand chan arg} {
  6128. global botnick black
  6129. set info [join [lrange [split $arg] 0 end]]
  6130. set chan1 "$chan"
  6131. set char(p) [lindex $black(cmdchar) 0]
  6132. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  6133. return 0
  6134. }
  6135. if {$info == ""} {
  6136. blacktools:tell $nick $host $hand $chan $chan1 addinfo.1 none
  6137. return 0
  6138. }
  6139. addinfo:process $nick $host $hand $chan $chan1 $info
  6140. }
  6141. proc addinfo:process {nick host hand chan chan1 info} {
  6142. global botnick black
  6143. if {[string match -nocase "$info" "off"]} {
  6144. set infos ""
  6145. setuser $hand info $infos
  6146. blacktools:tell $nick $host $hand $chan $chan1 addinfo.3 none
  6147. return 0
  6148. }
  6149. setuser $hand info $info
  6150. blacktools:tell $nick $host $hand $chan $chan1 addinfo.4 $info
  6151. }
  6152. ############################### purge ###############################
  6153. proc purgepublic {nick host hand chan arg} {
  6154. global botnick black
  6155. set reason [join [lrange [split $arg] 0 end]]
  6156. set chan1 "$chan"
  6157. if {$reason == ""} {
  6158. blacktools:tell $nick $host $hand $chan $chan1 purge.1 none
  6159. return 0
  6160. }
  6161. purge:process $nick $host $hand $chan $chan1 $reason
  6162. }
  6163. proc purge:process {nick host hand chan chan1 reason} {
  6164. channel remove $chan
  6165. delchan:stats $chan $hand $host
  6166. blacktools:tell $nick $host $hand $chan $chan1 purge.2 none
  6167. putquick "PART $chan :PURGED by $hand :$reason"
  6168. }
  6169. ################################### v #################################
  6170. proc vpublic {nick host hand chan arg} {
  6171. global botnick black
  6172. set c [lindex [split $arg] 0]
  6173. set arg [split $arg]
  6174. set nick [split $nick]
  6175. set chan1 "$chan"
  6176. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  6177. set chan "$c"
  6178. set arg [lrange $arg 1 end]
  6179. }
  6180. v:process $nick $host $hand $chan $chan1 $arg
  6181. }
  6182. proc v:process {nick host hand chan chan1 arg} {
  6183. global botnick black
  6184. if {![validchan $chan]} {
  6185. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  6186. return 0
  6187. }
  6188. if {![onchan $botnick $chan]} {
  6189. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  6190. return 0
  6191. }
  6192. if {![botisop $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  6193. return 0
  6194. }
  6195. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  6196. return 0
  6197. }
  6198. if {$arg == ""} {
  6199. set arg $nick
  6200. }
  6201. foreach voicenick $arg {
  6202. if {[isbotnick $voicenick]} { return 0 }
  6203. if {[isvoice $voicenick $chan]} {putquick "MODE $chan -v $voicenick"} else {putquick "MODE $chan +v $voicenick"}
  6204. }
  6205. }
  6206. ################################## o ##################################
  6207. proc opublic {nick host hand chan arg} {
  6208. global botnick black
  6209. set c [lindex [split $arg] 0]
  6210. set arg [split $arg]
  6211. set nick [split $nick]
  6212. set chan1 "$chan"
  6213. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  6214. set chan "$c"
  6215. set arg [lrange $arg 1 end]
  6216. }
  6217. o:process $nick $host $hand $chan $chan1 $arg
  6218. }
  6219. proc o:process {nick host hand chan chan1 arg} {
  6220. global botnick black
  6221. if {![validchan $chan]} {
  6222. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  6223. return 0
  6224. }
  6225. if {![onchan $botnick $chan]} {
  6226. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  6227. return 0
  6228. }
  6229. if {![botisop $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  6230. return 0
  6231. }
  6232. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  6233. return 0
  6234. }
  6235. if {$arg == ""} {
  6236. set arg $nick
  6237. }
  6238. foreach opnick $arg {
  6239. if {[isbotnick $opnick]} { return 0 }
  6240. if {[isop $opnick $chan]} {putquick "MODE $chan -o $opnick"} else {putquick "MODE $chan +o $opnick"}
  6241. }
  6242. }
  6243. ################################# l ###################################
  6244. proc lpublic {nick host hand chan arg} {
  6245. global black
  6246. set times [lindex [split $arg] 0]
  6247. set type 0
  6248. set chan1 "$chan"
  6249. if {[regexp {^[\\+!#&]} $times] && [matchattr $hand nm|- $chan]} {
  6250. set chan "$times"
  6251. set times [lindex [split $arg] 1]
  6252. }
  6253. l:process $nick $host $hand $chan $chan1 $times $type
  6254. }
  6255. proc l:process {nick host hand chan chan1 time type} {
  6256. global botnick black
  6257. set char(p) [lindex $black(cmdchar) 0]
  6258. if {[string match -nocase "$char(p)" "none"]} {
  6259. set char(p) ""
  6260. }
  6261. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  6262. return 0
  6263. }
  6264. if {[matchattr $hand nm|- $chan]} {
  6265. if {($time == "") && ($type == "0")} {
  6266. blacktools:tell $nick $host $hand $chan $chan1 l.1 none
  6267. return 0
  6268. }
  6269. if {($time == "") && ($type == "1")} {
  6270. blacktools:tell $nick $host $hand $chan $chan1 l.2 none
  6271. return 0
  6272. }
  6273. }
  6274. if {($time == "") && ($type == "0")} {
  6275. blacktools:tell $nick $host $hand $chan $chan1 l.3 none
  6276. return 0
  6277. }
  6278. if {($time == "") && ($type == "1")} {
  6279. blacktools:tell $nick $host $hand $chan $chan1 l.4 none
  6280. return 0
  6281. }
  6282. if {![validchan $chan]} {
  6283. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  6284. return 0
  6285. }
  6286. if {![onchan $botnick $chan]} {
  6287. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  6288. return 0
  6289. }
  6290. if {![botisop $chan]} {
  6291. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  6292. return 0
  6293. }
  6294. if {$time >= 300} {
  6295. blacktools:tell $nick $host $hand $chan $chan1 l.5 none
  6296. return 0
  6297. }
  6298. putserv "MODE $chan +$black(lmode)" ;utimer $time [list putquick "MODE $chan -$black(lmode)"]
  6299. blacktools:tell $nick $host $hand $chan $chan1 l.6 "$black(lmode) $time"
  6300. }
  6301. proc chatpublic {nick host hand chan arg} {
  6302. global botnick
  6303. *ctcp:CHAT $nick $host $hand $botnick CHAT $arg
  6304. blacktools:tell $nick $host $hand $chan $chan1 chat.1 none
  6305. }
  6306. ################################ ul ###################################
  6307. proc ul:process {nick host hand chan chan1} {
  6308. global black botnick
  6309. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  6310. return 0
  6311. }
  6312. if {![validchan $chan]} {
  6313. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  6314. return 0
  6315. }
  6316. if {![onchan $botnick $chan]} {
  6317. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  6318. return 0
  6319. }
  6320. if {![botisop $chan]} {
  6321. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  6322. return 0
  6323. }
  6324. putquick "MODE $chan -$black(ulmodes)"
  6325. blacktools:tell $nick $host $hand $chan $chan1 ul.1 $black(ulmodes)
  6326. }
  6327. proc ulpublic {nick host hand chan arg} {
  6328. global black
  6329. set c [lindex [split $arg] 0]
  6330. set chan1 "$chan"
  6331. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  6332. set chan "$c"
  6333. }
  6334. ul:process $nick $host $hand $chan $chan1
  6335. }
  6336. ################################ say ##################################
  6337. proc saypublic {nick host hand chan arg} {
  6338. global black
  6339. set text [join [lrange [split $arg] 0 end]]
  6340. set c [lindex [split $arg] 0]
  6341. set type 0
  6342. set chan1 "$chan"
  6343. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  6344. set chan "$c"
  6345. set text [join [lrange [split $arg] 1 end]]
  6346. }
  6347. say:process $nick $host $hand $chan $chan1 $text $type
  6348. }
  6349. proc say:process {nick host hand chan chan1 text type} {
  6350. global botnick black
  6351. set char(p) [lindex $black(cmdchar) 0]
  6352. if {[string match -nocase "$char(p)" "none"]} {
  6353. set char(p) ""
  6354. }
  6355. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  6356. return 0
  6357. }
  6358. if {![validchan $chan]} {
  6359. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  6360. return 0
  6361. }
  6362. if {[matchattr $hand nm|- $chan]} {
  6363. if {($text == "") && ($type == "0")} {
  6364. blacktools:tell $nick $host $hand $chan $chan1 say.1 none
  6365. return 0
  6366. }
  6367. if {($text == "") && ($type == "1")} {
  6368. blacktools:tell $nick $host $hand $chan $chan1 say.2 none
  6369. return 0
  6370. }
  6371. }
  6372. if {($text == "") && ($type == "0")} {
  6373. blacktools:tell $nick $host $hand $chan $chan1 say.3 none
  6374. return 0
  6375. }
  6376. if {($text == "") && ($type == "1")} {
  6377. blacktools:tell $nick $host $hand $chan $chan1 say.4 none
  6378. return 0
  6379. }
  6380. if {![onchan $botnick $chan]} {
  6381. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  6382. return 0
  6383. }
  6384. putquick "PRIVMSG $chan :$text"
  6385. }
  6386. ################################ act ##################################
  6387. proc actpublic {nick host hand chan arg} {
  6388. global black
  6389. set text [join [lrange [split $arg] 0 end]]
  6390. set c [lindex [split $arg] 0]
  6391. set type 0
  6392. set chan1 "$chan"
  6393. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  6394. set chan "$c"
  6395. set text [join [lrange [split $arg] 1 end]]
  6396. }
  6397. act:process $nick $host $hand $chan $chan1 $text $type
  6398. }
  6399. proc act:process {nick host hand chan chan1 text type} {
  6400. global botnick black
  6401. set char(p) [lindex $black(cmdchar) 0]
  6402. if {[string match -nocase "$char(p)" "none"]} {
  6403. set char(p) ""
  6404. }
  6405. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  6406. return 0
  6407. }
  6408. if {[matchattr $hand nm|- $chan]} {
  6409. if {($text == "") && ($type == "0")} {
  6410. blacktools:tell $nick $host $hand $chan $chan1 act.1 none
  6411. return 0
  6412. }
  6413. if {($text == "") && ($type == "1")} {
  6414. blacktools:tell $nick $host $hand $chan $chan1 act.2 none
  6415. return 0
  6416. }
  6417. }
  6418. if {($text == "") && ($type == "0")} {
  6419. blacktools:tell $nick $host $hand $chan $chan1 act.3 none
  6420. return 0
  6421. }
  6422. if {($text == "") && ($type == "1")} {
  6423. blacktools:tell $nick $host $hand $chan $chan1 act.4 none
  6424. return 0
  6425. }
  6426. if {![validchan $chan]} {
  6427. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  6428. return 0
  6429. }
  6430. if {![onchan $botnick $chan]} {
  6431. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  6432. return 0
  6433. }
  6434. putquick "PRIVMSG $chan :\001ACTION $text\001"
  6435. }
  6436. ############################## broadcast ##############################
  6437. proc broadcastpublic {nick host hand chan arg} {
  6438. global black
  6439. set text [join [lrange [split $arg] 0 end]]
  6440. set chan1 "$chan"
  6441. set char(p) [lindex $black(cmdchar) 0]
  6442. if {[string match -nocase "$char(p)" "none"]} {
  6443. set char(p) ""
  6444. }
  6445. if {$text == ""} {
  6446. blacktools:tell $nick $host $hand $chan $chan1 broadcast.1 none
  6447. return 0
  6448. }
  6449. broadcast:cmd:process $nick $host $hand $chan $chan1 $text
  6450. }
  6451. proc broadcast:cmd:process {nick host hand chan chan1 text} {
  6452. global botnick black
  6453. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  6454. return 0
  6455. }
  6456. foreach c [channels] {
  6457. if {![channel get $c silent]} {
  6458. putquick "PRIVMSG $c :(BROADCAST) $text"
  6459. }
  6460. }
  6461. }
  6462. ############################### check #################################
  6463. proc checkpublic {nick host hand chan arg} {
  6464. global black
  6465. set chan1 "$chan"
  6466. set char(p) [lindex $black(cmdchar) 0]
  6467. if {[string match -nocase "$char(p)" "none"]} {
  6468. set char(p) ""
  6469. }
  6470. set checked [lindex [split $arg] 0]
  6471. if {$checked == ""} { blacktools:tell $nick $host $hand $chan $chan1 check.1 none
  6472. return 0
  6473. }
  6474. check:process $nick $host $hand $chan $chan1 $checked
  6475. }
  6476. proc check:process {nick host hand chan chan1 checked} {
  6477. global botnick black
  6478. set char(p) [lindex $black(cmdchar) 0]
  6479. if {[string match -nocase "$char(p)" "none"]} {
  6480. set char(p) ""
  6481. }
  6482. set handle [nick2hand $checked]
  6483. if {[matchattr $hand -|q $chan]} {
  6484. blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  6485. return 0
  6486. }
  6487. if {[matchattr $handle $black(exceptflags) $chan]} {
  6488. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  6489. return 0
  6490. }
  6491. if {[isbotnick $checked]} {
  6492. return 0
  6493. }
  6494. if {![botisop $chan]} {
  6495. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  6496. return 0
  6497. }
  6498. if {![onchan $checked $chan]} {
  6499. blacktools:tell $nick $host $hand $chan $chan1 gl.usernotonchan $checked
  6500. return 0
  6501. }
  6502. if {[onchan $checked $chan]} {
  6503. set mask *!*@[lindex [split [getchanhost $checked $chan] "@"] 1]
  6504. }
  6505. set countz [getuser $hand XTRA check($chan)]
  6506. if {$countz == ""} { set countz 0 }
  6507. set counts [expr $countz + 1]
  6508. setuser $hand XTRA check($chan) $counts
  6509. set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
  6510. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  6511. set getmsg $black(say.$getlang.check.3)
  6512. if {[info exists black(say.$getlang.check.3)]} {
  6513. putquick "PRIVMSG $checked :$black(say.$getlang.check.3)"
  6514. }
  6515. }
  6516. ############################## version ################################
  6517. proc versionpublic {nick host hand chan arg} {
  6518. global botnick black
  6519. set chan1 "$chan"
  6520. version:process $nick $host $hand $chan $chan1
  6521. }
  6522. proc version:process {nick host hand chan chan1} {
  6523. global botnick black
  6524. blacktools:tell $nick $host $hand $chan $chan1 version.1 none
  6525. }
  6526. ############################### cycle #################################
  6527. proc cycle:process {nick host hand chan chan1 reason} {
  6528. global black botnick
  6529. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  6530. return 0
  6531. }
  6532. if {![validchan $chan]} {
  6533. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  6534. return 0
  6535. }
  6536. if {![onchan $botnick $chan]} {
  6537. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  6538. return 0
  6539. }
  6540. if {$reason == ""} { set reason "No Reason" }
  6541. putquick "PART $chan :$reason"
  6542. utimer 5 [list putquick "JOIN $chan"]
  6543. }
  6544. proc cyclepublic {nick host hand chan arg} {
  6545. global black
  6546. set reason [join [lrange [split $arg] 0 end]]
  6547. set c [lindex [split $arg] 0]
  6548. set chan1 "$chan"
  6549. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  6550. set chan "$c"
  6551. set reason [join [lrange [split $arg] 1 end]]
  6552. }
  6553. cycle:process $nick $host $hand $chan $chan1 $reason
  6554. }
  6555. ################################ away #################################
  6556. proc awaypublic {nick host hand chan arg} {
  6557. global black
  6558. set chan1 "$chan"
  6559. set char(p) [lindex $black(cmdchar) 0]
  6560. if {[string match -nocase "$char(p)" "none"]} {
  6561. set char(p) ""
  6562. }
  6563. set aw [join [lrange [split $arg] 0 end]]
  6564. if {$aw == "" } {blacktools:tell $nick $host $hand $chan $chan1 away.1 none
  6565. return 0
  6566. }
  6567. away:process $nick $host $hand $chan $chan1 $aw
  6568. }
  6569. proc away:process {nick host hand chan chan1 aw} {
  6570. global black botnick wdir
  6571. set char(p) [lindex $black(cmdchar) 0]
  6572. if {[string match -nocase "$char(p)" "none"]} {
  6573. set char(p) ""
  6574. }
  6575. if {[string match -nocase "$aw" "off"]} {
  6576. blacktools:tell $nick $host $hand $chan $chan1 away.3 none
  6577. putquick "AWAY :"
  6578. set type [open $wdir w]
  6579. set none ""
  6580. puts $type "$none"
  6581. close $type
  6582. return 0
  6583. } else {
  6584. blacktools:tell $nick $host $hand $chan $chan1 away.4 $aw ; putquick "AWAY :$aw"
  6585. set type [open $wdir w]
  6586. puts $type "$aw"
  6587. close $type
  6588. }
  6589. }
  6590. proc setaway {my} {
  6591. global wdir
  6592. if {[file exists $wdir] == 0} {
  6593. set file [open $wdir a]
  6594. close $file
  6595. }
  6596. set aways [open $wdir r]
  6597. set away "[gets $aways]"
  6598. catch {close $aways}
  6599. if {$away == ""} {
  6600. return 0
  6601. } else {
  6602. putserv "AWAY :"
  6603. putserv "AWAY :$away"
  6604. }
  6605. }
  6606. ################################### mode ######################################
  6607. proc modepublic {nick host hand chan arg} {
  6608. global black
  6609. set modes [lindex [split $arg] 0]
  6610. set chan1 "$chan"
  6611. set type 0
  6612. if {[regexp {^[#&]} $modes] && [matchattr $hand nm|- $chan]} {
  6613. set chan "$modes"
  6614. set modes [lindex [split $arg] 1]
  6615. }
  6616. mode:process $nick $host $hand $chan $chan1 $modes $type
  6617. }
  6618. proc mode:process {nick host hand chan chan1 modes type} {
  6619. global botnick black
  6620. set char(p) [lindex $black(cmdchar) 0]
  6621. if {[string match -nocase "$char(p)" "none"]} {
  6622. set char(p) ""
  6623. }
  6624. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  6625. return 0
  6626. }
  6627. if {[matchattr $hand nm|- $chan]} {
  6628. if {($modes == "") && ($type == "0")} {
  6629. blacktools:tell $nick $host $hand $chan $chan1 mode.1 none
  6630. return 0
  6631. }
  6632. if {($modes == "") && ($type == "1")} {
  6633. blacktools:tell $nick $host $hand $chan $chan1 mode.2 none
  6634. return 0
  6635. }
  6636. }
  6637. if {($modes == "") && ($type == "0")} {
  6638. blacktools:tell $nick $host $hand $chan $chan1 mode.3 none
  6639. return 0
  6640. }
  6641. if {($modes == "") && ($type == "1")} {
  6642. blacktools:tell $nick $host $hand $chan $chan1 mode.4 none
  6643. return 0
  6644. }
  6645. if {![validchan $chan]} {
  6646. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  6647. return 0
  6648. }
  6649. if {![onchan $botnick $chan]} {
  6650. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  6651. return 0
  6652. }
  6653. if {![botisop $chan]} {
  6654. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  6655. return 0
  6656. }
  6657. if {![regexp {^[+ -]} $modes]} {
  6658. blacktools:tell $nick $host $hand $chan $chan1 mode.5 none
  6659. return 0
  6660. }
  6661. blacktools:tell $nick $host $hand $chan $chan1 mode.6 $modes
  6662. putserv "MODE $chan $modes"
  6663. }
  6664. ################################## myset #############################
  6665. proc mysetpublic {nick host hand chan arg} {
  6666. global black
  6667. set chan1 "$chan"
  6668. set flags [lindex [split $arg] 0]
  6669. set type [lindex [split $arg] 1]
  6670. if {$type == ""} {
  6671. blacktools:tell $nick $host $hand $chan $chan1 myset.3 none
  6672. return 0
  6673. }
  6674. myset:process $nick $host $hand $chan $chan1 $flags $type
  6675. }
  6676. proc myset:process {nick host hand chan chan1 flags typez} {
  6677. global black
  6678. switch -exact -- [string tolower $flags] {
  6679. lang {
  6680. setuser $hand XTRA OUTPUT_LANG $typez
  6681. blacktools:tell $nick $host $hand $chan $chan1 myset.1 $typez
  6682. return 0
  6683. }
  6684. output {
  6685. if {[string match -nocase $typez "notice"]} {
  6686. setuser $hand XTRA OUTPUT_TYPE 1
  6687. blacktools:tell $nick $host $hand $chan $chan1 myset.2 $typez
  6688. return 0
  6689. }
  6690. if {[string match -nocase $typez "chan"]} {
  6691. setuser $hand XTRA OUTPUT_TYPE 0
  6692. blacktools:tell $nick $host $hand $chan $chan1 myset.2 $typez
  6693. return 0
  6694. }
  6695. }
  6696. }
  6697. }
  6698. ################################# set #################################
  6699. proc setpublic {nick host hand chan arg} {
  6700. global black
  6701. set flags [lindex [split $arg] 0]
  6702. set type [join [lrange [split $arg] 1 end]]
  6703. set chan1 "$chan"
  6704. set type1 0
  6705. if {[regexp {^[#&]} $flags] && [matchattr $hand nm|- $chan]} {
  6706. set chan "$flags"
  6707. set flags [lindex [split $arg] 1]
  6708. set type [join [lrange [split $arg] 2 end]]
  6709. }
  6710. set:process $nick $host $hand $chan $chan1 $flags $type $type1
  6711. }
  6712. proc set:process {nick host hand chan chan1 flags type type1} {
  6713. global botnick black
  6714. set char(p) [lindex $black(cmdchar) 0]
  6715. if {[string match -nocase "$char(p)" "none"]} {
  6716. set char(p) ""
  6717. }
  6718. if {[matchattr $hand -|q $chan]} {
  6719. blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  6720. return 0
  6721. }
  6722. if {[matchattr $hand nm|- $chan]} {
  6723. if {($flags == "") && ($type1 == "0")} {
  6724. blacktools:tell $nick $host $hand $chan $chan1 set.1 none
  6725. return 0
  6726. }
  6727. if {($flags == "") && ($type1 == "1")} {
  6728. blacktools:tell $nick $host $hand $chan $chan1 set.2 none
  6729. return 0
  6730. }
  6731. }
  6732. if {($flags == "") && ($type1 == "0")} {
  6733. blacktools:tell $nick $host $hand $chan $chan1 set.3 none
  6734. return 0
  6735. }
  6736. if {($flags == "") && ($type1 == "1")} {
  6737. blacktools:tell $nick $host $hand $chan $chan1 set.4 none
  6738. return 0
  6739. }
  6740. if {![validchan $chan]} {
  6741. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  6742. return 0
  6743. }
  6744. if {![onchan $botnick $chan]} {
  6745. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  6746. return 0
  6747. }
  6748. if {$type == ""} {
  6749. set why [catch {channel set $chan $flags} error]
  6750. if {$why == "1"} { blacktools:tell $nick $host $hand $chan $chan1 set.5 $flags
  6751. return 0
  6752. } else {
  6753. channel set $chan $flags ; blacktools:tell $nick $host $hand $chan $chan1 set.6 $flags
  6754. }
  6755. } else {
  6756. set why [catch {channel set $chan $flags $type} error]
  6757. if {!([matchattr $hand mn|- $chan]) && [string match -nocase "backchan" $flags]} {
  6758. return 0
  6759. }
  6760. if {$why == "1"} { blacktools:tell $nick $host $hand $chan $chan1 set.7 "$flags $type"
  6761. return 0
  6762. } else {
  6763. channel set $chan $flags $type ; blacktools:tell $nick $host $hand $chan $chan1 set.8 "$flags $type"
  6764. }
  6765. }
  6766. }
  6767. proc ignorepublic {nick host hand chan arg} {
  6768. global black
  6769. set chan1 "$chan"
  6770. set what [lindex [split $arg] 0]
  6771. set mask [lindex [split $arg] 1]
  6772. set time [lindex [split $arg] 2]
  6773. set reason [join [lrange [split $arg] 3 end]]
  6774. if {$what == ""} { blacktools:tell $nick $host $hand $chan $chan1 ignore.1 none
  6775. return 0
  6776. }
  6777. ignore:process $nick $host $hand $chan $chan1 $what $mask $time $reason
  6778. }
  6779. proc ignore:process {nick host hand chan chan1 what mask time reason} {
  6780. global botnick black
  6781. set char(p) [lindex $black(cmdchar) 0]
  6782. if {[string match -nocase "$char(p)" "none"]} {
  6783. set char(p) ""
  6784. }
  6785. switch -exact -- [string tolower $what] {
  6786. list {
  6787. if {[llength [ignorelist]] == "0"} { blacktools:tell $nick $host $hand $chan $chan1 ignore.3 none
  6788. return 0
  6789. }
  6790. foreach ig [ignorelist] {
  6791. set hostig [lindex $ig 0]
  6792. set byig [lindex $ig 4]
  6793. set time [lindex $ig 2]
  6794. set reasig [lindex $ig 1]
  6795. if {$time != "0"} {
  6796. set bytime [clock format $time -format %D-%H:%M:%S]
  6797. } else { set bytime "-"}
  6798. blacktools:tell $nick $host $hand $chan $chan1 ignore.4 "$hostig $byig $bytime $reasig"
  6799. }
  6800. }
  6801. add {
  6802. if {[isignore $mask]} {
  6803. blacktools:tell $nick $host $hand $chan $chan1 ignore.5 "$mask"
  6804. return 0
  6805. }
  6806. if {![regexp {^[0-9]} $time]} {
  6807. set time "60"
  6808. }
  6809. if {$reason == ""} { set reason "No Reason" }
  6810. newignore $mask $hand $reason $time
  6811. blacktools:tell $nick $host $hand $chan $chan1 ignore.6 "$mask $time $reason"
  6812. }
  6813. delete {
  6814. if {$mask == ""} { blacktools:tell $nick $host $hand $chan $chan1 ignore.7 none
  6815. return 0
  6816. }
  6817. if {[isignore $mask]} {
  6818. killignore $mask
  6819. } else { blacktools:tell $nick $host $hand $chan $chan1 ignore.8 "$mask"
  6820. return 0
  6821. }
  6822. blacktools:tell $nick $host $hand $chan $chan1 ignore.9 "$mask"
  6823. }
  6824. }
  6825. }
  6826. ################################# show ################################
  6827. proc showpublic {nick host hand chan arg} {
  6828. global black
  6829. set wich [lindex [split $arg] 0]
  6830. set type 0
  6831. set chan1 "$chan"
  6832. if {[regexp {^[#&]} $wich] && [matchattr $hand nm|- $chan]} {
  6833. set chan "$wich"
  6834. set wich [lindex [split $arg] 1]
  6835. }
  6836. show:process $nick $host $hand $chan $chan1 $wich $type
  6837. }
  6838. proc show:process {nick host hand chan chan1 wich type} {
  6839. global black botnick
  6840. set char(p) [lindex $black(cmdchar) 0]
  6841. if {[string match -nocase "$char(p)" "none"]} {
  6842. set char(p) ""
  6843. }
  6844. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  6845. return 0
  6846. }
  6847. if {[matchattr $hand nm|- $chan]} {
  6848. if {($wich == "") && ($type == "0")} {
  6849. blacktools:tell $nick $host $hand $chan $chan1 show.1 none
  6850. return 0
  6851. }
  6852. if {($wich == "") && ($type == "1")} {
  6853. blacktools:tell $nick $host $hand $chan $chan1 show.2 none
  6854. return 0
  6855. }
  6856. }
  6857. if {($wich == "") && ($type == "0")} {
  6858. blacktools:tell $nick $host $hand $chan $chan1 show.3 none
  6859. return 0
  6860. }
  6861. if {($wich == "") && ($type == "1")} {
  6862. blacktools:tell $nick $host $hand $chan $chan1 show.4 none
  6863. return 0
  6864. }
  6865. if {![validchan $chan]} {
  6866. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  6867. return 0
  6868. }
  6869. if {![onchan $botnick $chan]} {
  6870. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  6871. return 0
  6872. }
  6873. set why [catch {channel get $chan $wich} error]
  6874. if {$why == "1"} { blacktools:tell $nick $host $hand $chan $chan1 show.5 $wich
  6875. return 0
  6876. } else {
  6877. set replyinfo [channel get $chan $wich]
  6878. if {($replyinfo == "") || ($replyinfo == "0")} {
  6879. switch -exact -- [string tolower $wich] {
  6880. antipub-reason {
  6881. set getlang [string tolower [channel get $chan lang]]
  6882. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  6883. set replyinfo $black(say.$getlang.antipub.1)
  6884. }
  6885. antilongtextmax {
  6886. set replyinfo [channel get $chan antilongtextmax]
  6887. if {$replyinfo == "0"} {
  6888. set replyinfo "$black(longchar)"
  6889. }
  6890. }
  6891. joinflood {
  6892. set replyinfo [channel get $chan joinflood]
  6893. if {$replyinfo == ""} {
  6894. set replyinfo "4 5"
  6895. }
  6896. }
  6897. chanflood {
  6898. set replyinfo [channel get $chan chanflood]
  6899. if {$replyinfo == ""} {
  6900. set replyinfo "4 5"
  6901. }
  6902. }
  6903. idleopmax {
  6904. set replyinfo [channel get $chan idleopmax]
  6905. if {$replyinfo == "0"} {
  6906. set replyinfo "$black(idleopmax)"
  6907. }
  6908. }
  6909. idlevoicemax {
  6910. set replyinfo [channel get $chan idlevoicemax]
  6911. if {$replyinfo == "0"} {
  6912. set replyinfo "$black(idlevoicemax)"
  6913. }
  6914. }
  6915. private-bantime {
  6916. set replyinfo "$black(privatebantime)"
  6917. }
  6918. private-reason {
  6919. set getlang [string tolower [channel get $chan lang]]
  6920. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  6921. set replyinfo $black(say.$getlang.private.12)
  6922. }
  6923. antipub-bantime {
  6924. set replyinfo "$black(antipubbantime)"
  6925. }
  6926. antinotice-bantime {
  6927. set replyinfo "$black(antinoticebantime)"
  6928. }
  6929. antinotice-reason {
  6930. set getlang [string tolower [channel get $chan lang]]
  6931. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  6932. set replyinfo $black(say.$getlang.antinotice.1)
  6933. }
  6934. antictcp-reason {
  6935. set getlang [string tolower [channel get $chan lang]]
  6936. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  6937. set replyinfo $black(say.$getlang.antictcp.1)
  6938. }
  6939. antictcp-bantime {
  6940. set replyinfo "$black(antictcpbantime)"
  6941. }
  6942. antibadword-bantime {
  6943. set replyinfo "$black(antibadwordbantime)"
  6944. }
  6945. antibadword-reason {
  6946. set getlang [string tolower [channel get $chan lang]]
  6947. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  6948. set replyinfo $black(say.$getlang.antibadword.1)
  6949. }
  6950. antilongtext-reason {
  6951. set getlang [string tolower [channel get $chan lang]]
  6952. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  6953. set replyinfo $black(say.$getlang.antilongtext.1)
  6954. }
  6955. antilongtext-bantime {
  6956. set replyinfo "$black(longbantime)"
  6957. }
  6958. antibadquitpart-reason {
  6959. set getlang [string tolower [channel get $chan lang]]
  6960. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  6961. set replyinfo $black(say.$getlang.antibadquitpart.1)
  6962. }
  6963. antibadquitpart-bantime {
  6964. set replyinfo "$black(badquitparttime)"
  6965. }
  6966. antijoinpart-reason {
  6967. set getlang [string tolower [channel get $chan lang]]
  6968. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  6969. set replyinfo $black(say.$getlang.antijoinpart.1)
  6970. }
  6971. antijoinpart-bantime {
  6972. set replyinfo "$black(joinpartbantime)"
  6973. }
  6974. antispam-bantime {
  6975. set replyinfo "$black(spamban)"
  6976. }
  6977. antispam-reason {
  6978. set getlang [string tolower [channel get $chan lang]]
  6979. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  6980. set replyinfo $black(say.$getlang.antispam.1)
  6981. }
  6982. antirepeat-reason {
  6983. set getlang [string tolower [channel get $chan lang]]
  6984. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  6985. set replyinfo $black(say.$getlang.antirepeat.1)
  6986. }
  6987. antirepeat-setting {
  6988. set replyinfo "$black(repeats)"
  6989. }
  6990. antirepeat-bantime {
  6991. set replyinfo "$black(antirepeatbantime)"
  6992. }
  6993. anticolor-reason {
  6994. set getlang [string tolower [channel get $chan lang]]
  6995. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  6996. set replyinfo $black(say.$getlang.anticolor.1)
  6997. }
  6998. anticolor-bantime {
  6999. set replyinfo "$black(anticolorbantime)"
  7000. }
  7001. antibold-reason {
  7002. set getlang [string tolower [channel get $chan lang]]
  7003. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7004. set replyinfo $black(say.$getlang.antibold.1)
  7005. }
  7006. antibold-bantime {
  7007. set replyinfo "$black(antiboldbantime)"
  7008. }
  7009. antiunderline-reason {
  7010. set getlang [string tolower [channel get $chan lang]]
  7011. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7012. set replyinfo $black(say.$getlang.antiunderline.1)
  7013. }
  7014. antiunderline-bantime {
  7015. set replyinfo "$black(antiunderlinebantime)"
  7016. }
  7017. anticaps-reason {
  7018. set getlang [string tolower [channel get $chan lang]]
  7019. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7020. set replyinfo $black(say.$getlang.anticaps.1)
  7021. }
  7022. anticaps-bantime {
  7023. set replyinfo "$black(anticapsbantime)"
  7024. }
  7025. badfullname-reason {
  7026. set getlang [string tolower [channel get $chan lang]]
  7027. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7028. set replyinfo $black(say.$getlang.badfullname.1)
  7029. }
  7030. badfullname-bantime {
  7031. set replyinfo "$black(badfbantime)"
  7032. }
  7033. badnick-reason {
  7034. set getlang [string tolower [channel get $chan lang]]
  7035. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7036. set replyinfo $black(say.$getlang.badnick.1)
  7037. }
  7038. badnick-bantime {
  7039. set replyinfo "$black(badnickbantime)"
  7040. }
  7041. badident-reason {
  7042. set getlang [string tolower [channel get $chan lang]]
  7043. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7044. set replyinfo $black(say.$getlang.badident.1)
  7045. }
  7046. badident-bantime {
  7047. set replyinfo "$black(badidentbantime)"
  7048. }
  7049. antichanflood-reason {
  7050. set getlang [string tolower [channel get $chan lang]]
  7051. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7052. set replyinfo $black(say.$getlang.antichanflood.1)
  7053. }
  7054. antichanflood-bantime {
  7055. set replyinfo "$black(antifloodchanbantime)"
  7056. }
  7057. badchan-reason {
  7058. set getlang [string tolower [channel get $chan lang]]
  7059. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7060. set replyinfo $black(say.$getlang.badchan.15)
  7061. }
  7062. badchan-bantime {
  7063. set replyinfo "$black(badcbantime)"
  7064. }
  7065. count-message {
  7066. set getlang [string tolower [channel get $chan lang]]
  7067. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7068. set replyinfo $black(say.$getlang.count.11)
  7069. }
  7070. dr-reason {
  7071. set getlang [string tolower [channel get $chan lang]]
  7072. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7073. set replyinfo $black(say.$getlang.dr.5)
  7074. }
  7075. dr-bantime {
  7076. set replyinfo "$black(drtime)"
  7077. }
  7078. bot-reason {
  7079. set getlang [string tolower [channel get $chan lang]]
  7080. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7081. set replyinfo $black(say.$getlang.bot.5)
  7082. }
  7083. bot-bantime {
  7084. set replyinfo "$black(bottime)"
  7085. }
  7086. n-reason {
  7087. set getlang [string tolower [channel get $chan lang]]
  7088. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7089. set replyinfo $black(say.$getlang.n.5)
  7090. }
  7091. n-bantime {
  7092. set replyinfo "$black(ntime)"
  7093. }
  7094. id-reason {
  7095. set getlang [string tolower [channel get $chan lang]]
  7096. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7097. set replyinfo $black(say.$getlang.id.5)
  7098. }
  7099. id-bantime {
  7100. set replyinfo "$black(idtime)"
  7101. }
  7102. w-reason {
  7103. set getlang [string tolower [channel get $chan lang]]
  7104. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7105. set replyinfo $black(say.$getlang.w.5)
  7106. }
  7107. spam-reason {
  7108. set getlang [string tolower [channel get $chan lang]]
  7109. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7110. set replyinfo $black(say.$getlang.spam.5)
  7111. }
  7112. spam-bantime {
  7113. set replyinfo "$black(spamtime)"
  7114. }
  7115. bw-reason {
  7116. set getlang [string tolower [channel get $chan lang]]
  7117. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7118. set replyinfo $black(say.$getlang.bw.5)
  7119. }
  7120. bw-bantime {
  7121. set replyinfo "$black(bwtime)"
  7122. }
  7123. }
  7124. }
  7125. blacktools:tell $nick $host $hand $chan $chan1 show.6 "$wich $replyinfo"
  7126. }
  7127. }
  7128. ############################## silence ################################
  7129. proc silencepublic {nick host hand chan arg} {
  7130. global black
  7131. set value [lindex [split $arg] 0]
  7132. set char(p) [lindex $black(cmdchar) 0]
  7133. if {[string match -nocase "$char(p)" "none"]} {
  7134. set char(p) ""
  7135. }
  7136. set chan1 "$chan"
  7137. if {$value == ""} { blacktools:tell $nick $host $hand $chan $chan1 silence.1 none
  7138. return 0
  7139. }
  7140. silence:process $nick $host $hand $chan $chan1 $value
  7141. }
  7142. proc silence:process {nick host hand chan chan1 value} {
  7143. global botnick black
  7144. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  7145. return 0
  7146. }
  7147. if {([regexp -nocase -- {(#[0-9]+|on|off)} $value tmp silents]) && (![regexp -nocase -- {\S#} $value])} {
  7148. switch $silents {
  7149. on { blacktools:tell $nick $host $hand $chan $chan1 silence.3 none ; putquick "SILENCE +*!*@*"
  7150. }
  7151. off { blacktools:tell $nick $host $hand $chan $chan1 silence.4 none ; putquick "SILENCE -*!*@*"
  7152. }
  7153. }
  7154. }
  7155. }
  7156. ############################## msg ####################################
  7157. proc msgpublic {nick host hand chan arg} {
  7158. global black
  7159. set nicks [lindex [split $arg] 0]
  7160. set chan1 "$chan"
  7161. set char(p) [lindex $black(cmdchar) 0]
  7162. if {[string match -nocase "$char(p)" "none"]} {
  7163. set char(p) ""
  7164. }
  7165. set msg [join [lrange [split $arg] 1 end]]
  7166. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  7167. return 0
  7168. }
  7169. if {$nicks == ""} {blacktools:tell $nick $host $hand $chan $chan1 msg.1 none
  7170. return 0
  7171. }
  7172. if {[isbotnick $nicks]} {
  7173. return 0
  7174. }
  7175. putquick "PRIVMSG $nicks :$msg"
  7176. }
  7177. ############################### reset #################################
  7178. proc resetpublic {nick host hand chan arg} {
  7179. global black
  7180. set dece [lindex [split $arg] 0]
  7181. set type 0
  7182. set chan1 "$chan"
  7183. if {[regexp {^[#&]} $dece] && [matchattr $hand nm|- $chan]} {
  7184. set chan "$dece"
  7185. set dece [lindex [split $arg] 1]
  7186. }
  7187. reset:process $nick $host $hand $chan $chan1 $dece $type
  7188. }
  7189. proc reset:process {nick host hand chan chan1 dece type} {
  7190. global botnick black
  7191. set char(p) [lindex $black(cmdchar) 0]
  7192. if {[string match -nocase "$char(p)" "none"]} {
  7193. set char(p) ""
  7194. }
  7195. if {[matchattr $hand nm|- $chan]} {
  7196. if {($dece == "") && ($type == "0")} {
  7197. blacktools:tell $nick $host $hand $chan $chan1 reset.1 none
  7198. return 0
  7199. }
  7200. if {($dece == "") && ($type == "1")} {
  7201. blacktools:tell $nick $host $hand $chan $chan1 reset.2 none
  7202. return 0
  7203. }
  7204. }
  7205. if {($dece == "") && ($type == "0")} {
  7206. blacktools:tell $nick $host $hand $chan $chan1 reset.3 none
  7207. return 0
  7208. }
  7209. if {($dece == "") && ($type == "1")} {
  7210. blacktools:tell $nick $host $hand $chan $chan1 reset.4 none
  7211. return 0
  7212. }
  7213. if {![validchan $chan]} {
  7214. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  7215. return 0
  7216. }
  7217. if {![onchan $botnick $chan]} {
  7218. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  7219. return 0
  7220. }
  7221. if {[string match -nocase "all" "$dece"]} {
  7222. set emptyflag "antipub-reason antinotice-reason antictcp-reason antibadword-reason antilongtext-reason antijoinpart-reason antirepeat-reason antirepeat-setting antispam-reason anticolor-reason antibold-reason antiunderline-reason anticaps-reason badfullname-reason badnick-reason badident-reason antichanflood-reason chanflood joinflood private-reason dr-reason n-reason id-reason spam-reason w-reason bw-reason bot-reason badchan-reason count-message"
  7223. foreach eflag $emptyflag {
  7224. channel set $chan $eflag ""
  7225. }
  7226. set zeroflag "antinotice-bantime antipub-bantime antictcp-bantime antibadword-bantime antilongtext-bantime antijoinpart-bantime antispam-bantime idleopmax idlevoicemax antilongtextmax antirepeat-bantime anticolor-bantime antibold-bantime antiunderline-bantime anticaps-bantime badfullname-bantime badnick-bantime badident-bantime antichanflood-bantime private-bantime dr-bantime n-bantime id-bantime spam-bantime bw-bantime bot-bantime kickcount"
  7227. foreach oflag $zeroflag {
  7228. channel set $chan $oflag 0
  7229. }
  7230. blacktools:tell $nick $host $hand $chan $chan1 reset.5 none
  7231. return 0
  7232. }
  7233. set why [catch {channel set $chan $dece ""} error]
  7234. if {$why == "1"} { blacktools:tell $nick $host $hand $chan $chan1 reset.6 $dece
  7235. } else {
  7236. channel set $chan $dece ""
  7237. blacktools:tell $nick $host $hand $chan $chan1 reset.7 $dece
  7238. }
  7239. }
  7240. ################################### banlist ###################################
  7241. proc banlistpublic {nick host hand chan arg} {
  7242. global botnick black
  7243. set user [lindex [split $arg] 0]
  7244. set type 0
  7245. set chan1 "$chan"
  7246. if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
  7247. set chan "$user"
  7248. set user [lindex [split $arg] 1]
  7249. }
  7250. banlist:process $nick $host $hand $chan $chan1 $user $type
  7251. }
  7252. proc banlist:process {nick host hand chan chan1 user type} {
  7253. global botnick black
  7254. set i 0
  7255. set char(p) [lindex $black(cmdchar) 0]
  7256. if {[string match -nocase "$char(p)" "none"]} {
  7257. set char(p) ""
  7258. }
  7259. if {[matchattr $hand nm|- $chan]} {
  7260. if {($user == "") && ($type == "0")} {
  7261. blacktools:tell $nick $host $hand $chan $chan1 banlist.1 none
  7262. blacktools:tell $nick $host $hand $chan $chan1 banlist.2 none
  7263. return 0
  7264. }
  7265. if {($user == "") && ($type == "1")} {
  7266. blacktools:tell $nick $host $hand $chan $chan1 banlist.3 none
  7267. blacktools:tell $nick $host $hand $chan $chan1 banlist.4 none
  7268. return 0
  7269. }
  7270. }
  7271. if {($user == "") && ($type == "0")} {
  7272. blacktools:tell $nick $host $hand $chan $chan1 banlist.5 none
  7273. return 0
  7274. }
  7275. if {($user == "") && ($type == "1")} {
  7276. blacktools:tell $nick $host $hand $chan $chan1 banlist.6 none
  7277. return 0
  7278. }
  7279. if {[matchattr $hand nm|- $chan] && [string match -nocase "global" $user]} {
  7280. foreach ban [banlist] {
  7281. set i [expr $i +1]
  7282. set expire [clock format [lindex $ban 2] -format %D-%H:%M:%S]
  7283. set create [clock format [lindex $ban 3] -format %D-%H:%M:%S]
  7284. set fban [lindex $ban 0]
  7285. set freason [lindex $ban 1]
  7286. set fbywho [lindex $ban 5]
  7287. if {[lindex $ban 2] == 0} {
  7288. set expire "Permanent"
  7289. }
  7290. blacktools:tell $nick $host $hand $chan $chan1 banlist.9 none
  7291. blacktools:tell $nick $host $hand $chan $chan1 banlist.10 "$fban $fbywho $create $expire $freason"
  7292. set foundban 1
  7293. }
  7294. if {![info exists foundban]} {
  7295. blacktools:tell $nick $host $hand $chan $chan1 banlist.7 none
  7296. } else { blacktools:tell $nick $host $hand $chan $chan1 banlist.8 none }
  7297. return 0
  7298. }
  7299. if {![validchan $chan]} {
  7300. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  7301. return 0
  7302. }
  7303. if {![onchan $botnick $chan]} {
  7304. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  7305. return 0
  7306. }
  7307. if {![validuser $user]} {
  7308. blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
  7309. return 0
  7310. }
  7311. if {![matchattr $user nm|OASMN $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none
  7312. return 0
  7313. }
  7314. foreach ban [banlist $chan] {
  7315. set own [lindex $ban 5]
  7316. if {[string match -nocase $own $user]} {
  7317. set i [expr $i +1]
  7318. set expire [clock format [lindex $ban 2] -format %D-%H:%M:%S]
  7319. set create [clock format [lindex $ban 3] -format %D-%H:%M:%S]
  7320. set fban [lindex $ban 0]
  7321. set freason [lindex $ban 1]
  7322. if {[lindex $ban 2] == 0} {
  7323. set expire "Permanent"
  7324. }
  7325. blacktools:tell $nick $host $hand $chan $chan1 banlist.11 $user
  7326. blacktools:tell $nick $host $hand $chan $chan1 banlist.12 "$fban $create $expire $freason"
  7327. set foundban 1
  7328. }
  7329. }
  7330. if {![info exists foundban]} {
  7331. blacktools:tell $nick $host $hand $chan $chan1 banlist.11 $user
  7332. blacktools:tell $nick $host $hand $chan $chan1 banlist.7 $user
  7333. } else {
  7334. blacktools:tell $nick $host $hand $chan $chan1 banlist.8 $user }
  7335. }
  7336. ############################## rehash #################################
  7337. proc rehashme {nick host hand arg} {
  7338. global black
  7339. blacktools:tell:prv $nick $host $hand rehash.1 none
  7340. rehash
  7341. }
  7342. ############################## VERSION ################################
  7343. proc blackreply {nick host hand dest key text} {
  7344. global ctcp-version
  7345. set {ctcp-version} "1Using 4BlackTools 2.3 1by 12BLaCkShaDoW"
  7346. }
  7347. ############################## restart ################################
  7348. proc restartme {nick host hand arg} {
  7349. global black
  7350. blacktools:tell:prv $nick $host $hand restart.1 none
  7351. utimer 3 [list restart ]
  7352. }
  7353. ############################### save #################################
  7354. proc saveme {nick host hand arg} {
  7355. global black
  7356. blacktools:tell:prv $nick $host $hand save.1 none
  7357. save
  7358. }
  7359. ############################### jump #################################
  7360. proc jumpme {nick host hand arg} {
  7361. global black
  7362. blacktools:tell:prv $nick $host $hand jump.1 none
  7363. utimer 3 [list jump]
  7364. }
  7365. ############################### die ###################################
  7366. proc dieme {nick host hand arg} {
  7367. global black
  7368. blacktools:tell:prv $nick $host $hand die.1 none
  7369. utimer 3 [list die "byeeee" ]
  7370. }
  7371. ############################## nick ###################################
  7372. proc nickpublic {altnick host hand arg} {
  7373. global nick black
  7374. set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
  7375. set newnick [lindex [split $arg] 0]
  7376. if {$newnick == ""} { blacktools:tell:prv $nick $host $hand nick.2 none
  7377. return 0
  7378. }
  7379. blacktools:tell:prv $nick $host $hand nick.1 "$newnick"
  7380. set nick $newnick
  7381. }
  7382. proc nick:process {who newnick host hand chan} {
  7383. global black nick
  7384. set chan1 "$chan"
  7385. if {$newnick == ""} {
  7386. blacktools:tell $who $host $hand $chan $chan1 nick.2 none
  7387. return 0
  7388. }
  7389. blacktools:tell $who $host $hand $chan $chan1 nick.1 none
  7390. set nick $newnick
  7391. }
  7392. ############################## addchan ################################
  7393. proc addchanpublic {nick host hand arg} {
  7394. global black
  7395. set chans [lindex [split $arg] 0]
  7396. if {$chans == ""} {blacktools:tell:prv $nick $host $hand addchan.1 none
  7397. return 0
  7398. }
  7399. if {![regexp {^[#&]} $chans]} {
  7400. blacktools:tell:prv $nick $host $hand gl.novalidchan none
  7401. return 0
  7402. }
  7403. if {[validchan $chans]} {
  7404. blacktools:tell:prv $nick $host $hand addchan.2 "$chans"
  7405. return 0
  7406. } else {
  7407. channel add $chans
  7408. addchan:stats $chans $hand $host
  7409. blacktools:tell:prv $nick $host $hand addchan.3 "$chans"
  7410. }
  7411. }
  7412. proc addchan:stats {chan hand host} {
  7413. global black botnick statsdir
  7414. set k 0
  7415. set time [unixtime]
  7416. set file [open $statsdir "r"]
  7417. set addfile "$chan ADDED $hand $host $time 0"
  7418. set database [read -nonewline $file]
  7419. close $file
  7420. set data [split $database "\n"]
  7421. foreach line $data {
  7422. set k [expr $k +1]
  7423. set chanentry [lindex [split $line] 0]
  7424. set addtype [lindex [split $line] 1]
  7425. if {[string equal -nocase "REMOVED" "$addtype"] && [string match -nocase $chanentry $chan]} {
  7426. if {$line != ""} {
  7427. set num [expr $k - 1]
  7428. set delete [lreplace $data $num $num]
  7429. set files [open $statsdir "w"]
  7430. puts $files [join $delete "\n"]
  7431. close $files
  7432. }
  7433. }
  7434. }
  7435. set file [open $statsdir "r"]
  7436. set data [read -nonewline $file]
  7437. close $file
  7438. if {$data == ""} {
  7439. set files [open $statsdir "w"]
  7440. close $files
  7441. }
  7442. set file [open $statsdir "a"]
  7443. puts $file "$addfile"
  7444. close $file
  7445. }
  7446. proc delchan:stats {chan hand host} {
  7447. global black botnick statsdir
  7448. set k 0
  7449. set time [unixtime]
  7450. set file [open $statsdir "r"]
  7451. set database [read -nonewline $file]
  7452. close $file
  7453. set data [split $database "\n"]
  7454. set addfile "$chan REMOVED $hand $host $time 0 0 none none"
  7455. foreach line $data {
  7456. set k [expr $k +1]
  7457. set chanentry [lindex [split $line] 0]
  7458. set addtype [lindex [split $line] 1]
  7459. if {[string equal -nocase "REMOVED" "$addtype"] && [string match -nocase $chanentry $chan]} {
  7460. if {$line != ""} {
  7461. set num [expr $k - 1]
  7462. set delete [lreplace $data $num $num]
  7463. set files [open $statsdir "w"]
  7464. puts $files [join $delete "\n"]
  7465. close $files
  7466. }
  7467. }
  7468. if {[string equal -nocase "ADDED" "$addtype"] && [string match -nocase $chanentry $chan]} {
  7469. set added [lindex [split $line] 4]
  7470. set bywho [lindex [split $line] 2]
  7471. set byhost [lindex [split $line] 3]
  7472. set addfile "$chan REMOVED $hand $host $time $added $bywho $byhost"
  7473. if {$line != ""} {
  7474. set num [expr $k - 1]
  7475. set delete [lreplace $data $num $num]
  7476. set files [open $statsdir "w"]
  7477. puts $files [join $delete "\n"]
  7478. close $files
  7479. }
  7480. }
  7481. }
  7482. set file [open $statsdir "r"]
  7483. set data [read -nonewline $file]
  7484. close $file
  7485. if {$data == ""} {
  7486. set files [open $statsdir "w"]
  7487. close $files
  7488. }
  7489. set file [open $statsdir "a"]
  7490. puts $file "$addfile"
  7491. close $file
  7492. }
  7493. ############################## delchan ################################
  7494. proc delchanpublic {nick host hand arg} {
  7495. global black
  7496. set chans [lindex [split $arg] 0]
  7497. if {$chans == ""} {blacktools:tell:prv $nick $host $hand delchan.1 none
  7498. return 0
  7499. }
  7500. if {![regexp {^[\\+!#&]} $chans]} {
  7501. blacktools:tell:prv $nick $host $hand gl.novalidchan none
  7502. return 0
  7503. }
  7504. if {![validchan $chans]} { blacktools:tell:prv $nick $host $hand delchan.2 $chans
  7505. return 0
  7506. }
  7507. delchan:stats $chans $hand $host
  7508. channel remove $chans
  7509. blacktools:tell:prv $nick $host $hand delchan.3 $chans
  7510. }
  7511. ############################## suspend ################################
  7512. proc suspendpublic {nick host hand arg} {
  7513. global black
  7514. set chans [lindex [split $arg] 0]
  7515. if {$chans == ""} {blacktools:tell:prv $nick $host $hand suspend.1 none
  7516. return 0
  7517. }
  7518. if {![regexp {^[\\+!#&]} $chans]} {
  7519. blacktools:tell:prv $nick $host $hand gl.novalidchan none
  7520. return 0
  7521. }
  7522. if {![validchan $chans]} { blacktools:tell:prv $nick $host $hand suspend.2 $chans
  7523. return 0
  7524. }
  7525. if {[channel get $chans inactive]} {
  7526. blacktools:tell:prv $nick $host $hand suspend.3 $chans
  7527. return 0
  7528. }
  7529. channel set $chans +inactive
  7530. blacktools:tell:prv $nick $host $hand suspend.4 $chans
  7531. }
  7532. ############################# unsuspend ###############################
  7533. proc unsuspendpublic {nick host hand arg} {
  7534. global black
  7535. set chans [lindex [split $arg] 0]
  7536. if {$chans == ""} {blacktools:tell:prv $nick $host $hand unsuspend.1 none
  7537. return 0
  7538. }
  7539. if {![regexp {^[\\+!#&]} $chans]} {
  7540. blacktools:tell:prv $nick $host $hand gl.novalidchan none
  7541. return 0
  7542. }
  7543. if {![validchan $chans]} { blacktools:tell:prv $nick $host $hand unsuspend.2 $chans
  7544. return 0
  7545. }
  7546. if {![channel get $chans inactive]} {
  7547. blacktools:tell:prv $nick $host $hand unsuspend.3 $chans
  7548. return 0
  7549. }
  7550. channel set $chans -inactive
  7551. blacktools:tell:prv $nick $host $hand unsuspend.4 $chans
  7552. }
  7553. ################################ op ###################################
  7554. proc oppublic {nick host hand arg} {
  7555. global black
  7556. set chan [lindex [split $arg] 0]
  7557. set nicks [lrange [split $arg] 1 end]
  7558. if {![validchan $chan]} {
  7559. blacktools:tell:prv $nick $host $hand gl.nocmem $chan
  7560. }
  7561. if {[matchattr $hand -|q $chan]} { blacktools:tell:prv $nick $host $hand gl.suspend none
  7562. return 0
  7563. }
  7564. if {$nicks == ""} { set nicks "$nick" }
  7565. if {[matchattr $hand nm|OASM $chan]} {
  7566. if {![regexp {^[\\+!#&]} $chan]} {
  7567. blacktools:tell:prv $nick $host $hand gl.novalidchan none
  7568. return 0
  7569. }
  7570. if {![botisop $chan]} { blacktools:tell:prv $nick $host $hand gl.noop none
  7571. return 0
  7572. }
  7573. if {![validchan $chan]} {
  7574. blacktools:tell:prv $nick $host $hand op.1 $chan
  7575. return 0
  7576. }
  7577. foreach nickz $nicks {
  7578. if {[isop $nickz $chan]} {
  7579. blacktools:tell:prv $nick $host $hand op.2 $nickz
  7580. return 0
  7581. }
  7582. putquick "MODE $chan +o $nickz"
  7583. }
  7584. }
  7585. }
  7586. ############################### deop ##################################
  7587. proc deoppublic {nick host hand arg} {
  7588. global black
  7589. set chan [lindex [split $arg] 0]
  7590. set nicks [lrange [split $arg] 1 end]
  7591. if {![validchan $chan]} {
  7592. blacktools:tell:prv $nick $host $hand gl.nocmem $chan
  7593. }
  7594. if {[matchattr $hand -|q $chan]} { blacktools:tell:prv $nick $host $hand gl.suspend none
  7595. return 0
  7596. }
  7597. if {$nicks == ""} { set nicks "$nick" }
  7598. if {[matchattr $hand nm|OASM $chan]} {
  7599. if {![regexp {^[\\+!#&]} $chan]} {
  7600. blacktools:tell:prv $nick $host $hand gl.novalidchan none
  7601. return 0
  7602. }
  7603. if {![botisop $chan]} { blacktools:tell:prv $nick $host $hand gl.noop none
  7604. return 0
  7605. }
  7606. if {![validchan $chan]} { blacktools:tell:prv $nick $host $hand deop.1 $chan
  7607. return 0
  7608. }
  7609. foreach nickz $nicks {
  7610. if {[onchan $nickz $chan]} {
  7611. putquick "MODE $chan -o $nickz"
  7612. }
  7613. }
  7614. }
  7615. }
  7616. ############################### voice #################################
  7617. proc voicepublic {nick host hand arg} {
  7618. global black
  7619. set chan [lindex [split $arg] 0]
  7620. set nicks [lrange [split $arg] 1 end]
  7621. if {![validchan $chan]} {
  7622. blacktools:tell:prv $nick $host $hand gl.nocmem $chan
  7623. }
  7624. if {[matchattr $hand -|q $chan]} { blacktools:tell:prv $nick $host $hand gl.suspend none
  7625. return 0
  7626. }
  7627. if {$nicks == ""} { set nicks "$nick" }
  7628. if {[matchattr $hand nm|OASM $chan]} {
  7629. if {![regexp {^[\\+!#&]} $chan]} {
  7630. blacktools:tell:prv $nick $host $hand gl.novalidchan none
  7631. return 0
  7632. }
  7633. if {![botisop $chan]} { blacktools:tell:prv $nick $host $hand gl.noop none
  7634. return 0
  7635. }
  7636. if {![validchan $chan]} { blacktools:tell:prv $nick $host $hand voice.1 $chan
  7637. return 0
  7638. }
  7639. foreach nickz $nicks {
  7640. if {[onchan $nickz $chan]} {
  7641. if {[isvoice $nickz $chan]} {
  7642. blacktools:tell:prv $nick $host $hand voice.2 $nickz
  7643. return 0
  7644. }
  7645. putquick "MODE $chan +v $nickz"
  7646. }
  7647. }
  7648. }
  7649. }
  7650. ############################## devoice ################################
  7651. proc devoicepublic {nick host hand arg} {
  7652. global black
  7653. set chan [lindex [split $arg] 0]
  7654. set nicks [lrange [split $arg] 1 end]
  7655. if {![validchan $chan]} {
  7656. blacktools:tell:prv $nick $host $hand gl.nocmem $chan
  7657. }
  7658. if {[matchattr $hand -|q $chan]} { blacktools:tell:prv $nick $host $hand gl.suspend none
  7659. return 0
  7660. }
  7661. if {$nicks == ""} { set nicks "$nick" }
  7662. if {[matchattr $hand nm|OASM $chan]} {
  7663. if {![regexp {^[\\+!#&]} $chan]} {
  7664. blacktools:tell:prv $nick $host $hand gl.novalidchan none
  7665. return 0
  7666. }
  7667. if {![botisop $chan]} { blacktools:tell:prv $nick $host $hand gl.noop none
  7668. return 0
  7669. }
  7670. if {![validchan $chan]} { blacktools:tell:prv $nick $host $hand devoice.1 $chan
  7671. return 0
  7672. }
  7673. foreach nickz $nicks {
  7674. if {[onchan $nickz $chan]} {
  7675. putquick "MODE $chan -v $nickz"
  7676. }
  7677. }
  7678. }
  7679. }
  7680. ############################## invite #################################
  7681. proc invitepublic {nick host hand arg} {
  7682. global black
  7683. set chan [lindex [split $arg] 0]
  7684. set replace(%chan%) $chan
  7685. if {![validchan $chan]} {
  7686. blacktools:tell:prv $nick $host $hand gl.nocmem $chan
  7687. }
  7688. if {[matchattr $hand -|q $chan]} { blacktools:tell:prv $nick $host $hand gl.suspend none"
  7689. return 0
  7690. }
  7691. if {[matchattr $hand nm|OASM $chan]} {
  7692. if {$chan == ""} { blacktools:tell:prv $nick $host $hand invite.1 none
  7693. return 0
  7694. }
  7695. putquick "INVITE $nick $chan"
  7696. set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
  7697. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  7698. set getmsg $black(say.$getlang.invite.2)
  7699. if {[info exists black(say.$getlang.invite.2)]} {
  7700. set getmsg [string map [array get replace] $getmsg]
  7701. putquick "PRIVMSG $nick :$getmsg"
  7702. }
  7703. }
  7704. }
  7705. ##############################add ######################################
  7706. proc add:process {args time level hand host chan chan1 nick type} {
  7707. global black botnick
  7708. set char(p) [lindex $black(cmdchar) 0]
  7709. if {[string match -nocase "$char(p)" "none"]} {
  7710. set char(p) ""
  7711. }
  7712. set flags "nm|NMOSAV"
  7713. if {[matchattr $hand nm|- $chan]} {
  7714. if {($level == "") && ($type == "0")} {
  7715. blacktools:tell $nick $host $hand $chan $chan1 add.1 none
  7716. return 0
  7717. }
  7718. if {($level == "") && ($type == "1")} {
  7719. blacktools:tell $nick $host $hand $chan $chan1 add.2 none
  7720. return 0
  7721. }
  7722. }
  7723. if {($level == "") && ($type == "0")} {
  7724. blacktools:tell $nick $host $hand $chan $chan1 add.3 none
  7725. return 0
  7726. }
  7727. if {($level == "") && ($type == "1")} {
  7728. blacktools:tell $nick $host $hand $chan $chan1 add.4 none
  7729. return 0
  7730. }
  7731. if {![validchan $chan]} {
  7732. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  7733. return 0
  7734. }
  7735. if {![onchan $botnick $chan]} {
  7736. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  7737. return 0
  7738. }
  7739. foreach user $args {
  7740. if {$user != ""} {
  7741. set replace(%user%) $user
  7742. if {([string length $user]>=10) && ($black(maxhand) == "1")} {
  7743. set user [string range $user 0 8]
  7744. }
  7745. set uhost [string map [array get replace] $black(hostadd)]
  7746. if {[userlist] != ""} {
  7747. foreach usr [userlist] {
  7748. set hst [getuser $usr hosts]
  7749. foreach hhost $hst {
  7750. if {[string match -nocase $hhost $uhost] && (![string match -nocase $usr $user])} {
  7751. blacktools:tell $nick $host $hand $chan $chan1 add.5 $usr
  7752. return 0
  7753. }
  7754. }
  7755. }
  7756. }
  7757. if {[matchattr $hand -|A $chan] && ($level == "manager")} {
  7758. blacktools:tell $nick $host $hand $chan $chan1 add.6 none
  7759. return 0
  7760. }
  7761. if {[matchattr $hand -|A $chan] && ($level == "admin")} {
  7762. blacktools:tell $nick $host $hand $chan $chan1 add.7 none
  7763. return 0
  7764. }
  7765. if {[matchattr $hand -|M $chan] && ($level == "manager")} {
  7766. blacktools:tell $nick $host $hand $chan $chan1 add.8 none
  7767. return 0
  7768. }
  7769. if {([regexp -nocase -- {(#[0-9]+|owner|manager|admin|senior|op|voice|protect)} $level tmp access]) && (![regexp -nocase -- {\S#} $level])} {
  7770. switch $access {
  7771. manager {
  7772. set flags "-|olM"
  7773. if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7774. return 0
  7775. }
  7776. if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7777. return 0
  7778. }
  7779. if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
  7780. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7781. return 0
  7782. }
  7783. if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
  7784. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7785. return 0
  7786. }
  7787. if {[validuser $user]} {
  7788. chattr $user -|-qolSOAMV $chan
  7789. chattr $user $flags $chan
  7790. setuser $user XTRA LASTMODIFBY $hand
  7791. setuser $user XTRA LASTMODIFDATE $time
  7792. blacktools:tell $nick $host $hand $chan $chan1 add.9 $user
  7793. } else {
  7794. adduser $user $uhost
  7795. chattr $user -|-SOAMV $chan
  7796. chattr $user $flags $chan
  7797. setuser $user XTRA LASTMODIFBY $hand
  7798. setuser $user XTRA LASTMODIFDATE $time
  7799. blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
  7800. blacktools:tell $nick $host $hand $chan $chan1 add.9 $user
  7801. }
  7802. }
  7803. admin {
  7804. set flags "-|olA"
  7805. if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
  7806. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7807. return 0
  7808. }
  7809. if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
  7810. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7811. return 0
  7812. }
  7813. if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
  7814. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7815. return 0
  7816. }
  7817. if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
  7818. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7819. return 0
  7820. }
  7821. if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
  7822. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7823. return 0
  7824. }
  7825. if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
  7826. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7827. return 0
  7828. }
  7829. if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
  7830. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7831. return 0
  7832. }
  7833. if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
  7834. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7835. return 0
  7836. }
  7837. if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
  7838. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7839. return 0
  7840. }
  7841. if {[validuser $user]} {
  7842. chattr $user -|-qolSOAMV $chan
  7843. chattr $user $flags $chan
  7844. setuser $user XTRA LASTMODIFBY $hand
  7845. setuser $user XTRA LASTMODIFDATE $time
  7846. blacktools:tell $nick $host $hand $chan $chan1 add.11 $user
  7847. } else {
  7848. adduser $user $uhost
  7849. chattr $user -|-qolSOAMV $chan
  7850. chattr $user $flags $chan
  7851. setuser $user XTRA LASTMODIFBY $hand
  7852. setuser $user XTRA LASTMODIFDATE $time
  7853. blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
  7854. blacktools:tell $nick $host $hand $chan $chan1 add.11 $user
  7855. }
  7856. }
  7857. senior {
  7858. set flags "-|olS"
  7859. if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
  7860. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7861. return 0
  7862. }
  7863. if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
  7864. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7865. return 0
  7866. }
  7867. if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
  7868. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7869. return 0
  7870. }
  7871. if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
  7872. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7873. return 0
  7874. }
  7875. if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
  7876. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7877. return 0
  7878. }
  7879. if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
  7880. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7881. return 0
  7882. }
  7883. if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
  7884. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7885. return 0
  7886. }
  7887. if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
  7888. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7889. return 0
  7890. }
  7891. if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
  7892. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7893. return 0
  7894. }
  7895. if {[validuser $user]} {
  7896. chattr $user -|-qolSOAMV $chan
  7897. chattr $user $flags $chan
  7898. setuser $user XTRA LASTMODIFBY $hand
  7899. setuser $user XTRA LASTMODIFDATE $time
  7900. blacktools:tell $nick $host $hand $chan $chan1 add.12 $user
  7901. } else {
  7902. adduser $user $uhost
  7903. chattr $user -|-qolSOAMV $chan
  7904. chattr $user $flags $chan
  7905. setuser $user XTRA LASTMODIFBY $hand
  7906. setuser $user XTRA LASTMODIFDATE $time
  7907. blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
  7908. blacktools:tell $nick $host $hand $chan $chan1 add.12 $user
  7909. }
  7910. }
  7911. owner {
  7912. if {[matchattr $hand n|- $chan]} {
  7913. set flags "m|-"
  7914. if {[validuser $user]} {
  7915. chattr $user -|-qolSOAMV $chan
  7916. chattr $user $flags
  7917. setuser $user XTRA LASTMODIFBY $hand
  7918. setuser $user XTRA LASTMODIFDATE $time
  7919. blacktools:tell $nick $host $hand $chan $chan1 add.16 $user
  7920. } else {
  7921. adduser $user $uhost
  7922. chattr $user -|-qolSOAMV $chan
  7923. chattr $user $flags
  7924. setuser $user XTRA LASTMODIFBY $hand
  7925. setuser $user XTRA LASTMODIFDATE $time
  7926. blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
  7927. blacktools:tell $nick $host $hand $chan $chan1 add.16 $user
  7928. }
  7929. }
  7930. }
  7931. op {
  7932. set flags "-|olO"
  7933. if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
  7934. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7935. return 0
  7936. }
  7937. if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
  7938. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7939. return 0
  7940. }
  7941. if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
  7942. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7943. return 0
  7944. }
  7945. if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
  7946. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7947. return 0
  7948. }
  7949. if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
  7950. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7951. return 0
  7952. }
  7953. if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
  7954. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7955. return 0
  7956. }
  7957. if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
  7958. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7959. return 0
  7960. }
  7961. if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
  7962. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7963. return 0
  7964. }
  7965. if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
  7966. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7967. return 0
  7968. }
  7969. if {[validuser $user]} {
  7970. chattr $user -|-qolSOAMV $chan
  7971. chattr $user $flags $chan
  7972. setuser $user XTRA LASTMODIFBY $hand
  7973. setuser $user XTRA LASTMODIFDATE $time
  7974. blacktools:tell $nick $host $hand $chan $chan1 add.13 $user
  7975. } else {
  7976. adduser $user $uhost
  7977. chattr $user -|-qolSOAMV $chan
  7978. chattr $user $flags $chan
  7979. setuser $user XTRA LASTMODIFBY $hand
  7980. setuser $user XTRA LASTMODIFDATE $time
  7981. blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
  7982. blacktools:tell $nick $host $hand $chan $chan1 add.13 $user
  7983. }
  7984. }
  7985. protect {
  7986. set flags "-|H"
  7987. if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
  7988. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7989. return 0
  7990. }
  7991. if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
  7992. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7993. return 0
  7994. }
  7995. if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
  7996. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  7997. return 0
  7998. }
  7999. if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
  8000. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8001. return 0
  8002. }
  8003. if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
  8004. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8005. return 0
  8006. }
  8007. if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
  8008. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8009. return 0
  8010. }
  8011. if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
  8012. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8013. return 0
  8014. }
  8015. if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
  8016. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8017. return 0
  8018. }
  8019. if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
  8020. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8021. return 0
  8022. }
  8023. if {[validuser $user]} {
  8024. chattr $user -|-qHolSOAMV $chan
  8025. chattr $user $flags $chan
  8026. setuser $user XTRA LASTMODIFBY $hand
  8027. setuser $user XTRA LASTMODIFDATE $time
  8028. blacktools:tell $nick $host $hand $chan $chan1 add.15 $user
  8029. } else {
  8030. adduser $user $uhost
  8031. chattr $user -|-qolHSOAMV $chan
  8032. chattr $user $flags $chan
  8033. setuser $user XTRA LASTMODIFBY $hand
  8034. setuser $user XTRA LASTMODIFDATE $time
  8035. blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
  8036. blacktools:tell $nick $host $hand $chan $chan1 add.15 $user
  8037. }
  8038. }
  8039. voice {
  8040. set flags "-|lV"
  8041. if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
  8042. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8043. return 0
  8044. }
  8045. if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
  8046. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8047. return 0
  8048. }
  8049. if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
  8050. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8051. return 0
  8052. }
  8053. if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
  8054. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8055. return 0
  8056. }
  8057. if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
  8058. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8059. return 0
  8060. }
  8061. if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
  8062. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8063. return 0
  8064. }
  8065. if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
  8066. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8067. return 0
  8068. }
  8069. if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
  8070. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8071. return 0
  8072. }
  8073. if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
  8074. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8075. return 0
  8076. }
  8077. if {[validuser $user]} {
  8078. chattr $user -|-qolSOAMV $chan
  8079. chattr $user $flags $chan
  8080. setuser $user XTRA LASTMODIFBY $hand
  8081. setuser $user XTRA LASTMODIFDATE $time
  8082. blacktools:tell $nick $host $hand $chan $chan1 add.14 $user
  8083. } else {
  8084. adduser $user $uhost
  8085. chattr $user -|-qolSOAMV $chan
  8086. chattr $user $flags $chan
  8087. setuser $user XTRA LASTMODIFBY $hand
  8088. setuser $user XTRA LASTMODIFDATE $time
  8089. blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
  8090. blacktools:tell $nick $host $hand $chan $chan1 add.14 $user
  8091. }
  8092. }
  8093. }
  8094. }
  8095. }
  8096. }
  8097. }
  8098. ########################## adduser ################################
  8099. proc adduserpublic {nick host hand chan arg} {
  8100. global black
  8101. set level [lindex [split $arg] 0]
  8102. set args [lrange [split $arg] 1 end]
  8103. set c [lindex [split $arg] 1]
  8104. set type 0
  8105. set chan1 "$chan"
  8106. if {[regexp {^[#&]} $c] && [matchattr $hand nm|- $chan]} {
  8107. set chan "$c"
  8108. set args [lrange [split $arg] 2 end]
  8109. }
  8110. adduser:process $nick $host $hand $chan $chan1 $args $level $type
  8111. }
  8112. proc adduser:process {nick host hand chan chan1 args level type} {
  8113. global black botnick
  8114. set char(p) [lindex $black(cmdchar) 0]
  8115. if {[string match -nocase "$char(p)" "none"]} {
  8116. set char(p) ""
  8117. }
  8118. set time [ctime [unixtime]]
  8119. set flags "nm|NMOSVA"
  8120. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  8121. return 0
  8122. }
  8123. if {[matchattr $hand nm|- $chan]} {
  8124. if {($level == "") && ($type == "0")} {
  8125. blacktools:tell $nick $host $hand $chan $chan1 adduser.1 none
  8126. return 0
  8127. }
  8128. if {($level == "") && ($type == "1")} {
  8129. blacktools:tell $nick $host $hand $chan $chan1 adduser.2 none
  8130. return 0
  8131. }
  8132. }
  8133. if {($level == "") && ($type == "0")} {
  8134. blacktools:tell $nick $host $hand $chan $chan1 adduser.3 none
  8135. return 0
  8136. }
  8137. if {($level == "") && ($type == "1")} {
  8138. blacktools:tell $nick $host $hand $chan $chan1 adduser.4 none
  8139. return 0
  8140. }
  8141. if {![validchan $chan]} {
  8142. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  8143. return 0
  8144. }
  8145. if {![onchan $botnick $chan]} {
  8146. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  8147. return 0
  8148. }
  8149. foreach user $args {
  8150. if {$user != ""} {
  8151. if {![onchan $user $chan]} {
  8152. blacktools:tell $nick $host $hand $chan $chan1 gl.usernotonchan $user
  8153. return 0
  8154. }
  8155. set handle [nick2hand $user]
  8156. set hosts [getchanhost $user $chan]
  8157. set uhost "*!*@[lindex [split $hosts @] 1]"
  8158. if {([string length $user]>=10) && ($black(maxhand) == "1")} {
  8159. set user [string range $user 0 8]
  8160. }
  8161. if {[userlist] != ""} {
  8162. foreach usr [userlist] {
  8163. set hst [getuser $usr hosts]
  8164. foreach hhost $hst {
  8165. if {[string match -nocase $hhost $uhost] && (![string match -nocase $usr $user])} {
  8166. blacktools:tell $nick $host $hand $chan $chan1 add.5 $usr
  8167. return 0
  8168. }
  8169. }
  8170. }
  8171. }
  8172. if {[matchattr $hand -|A $chan] && ($level == "manager")} {
  8173. blacktools:tell $nick $host $hand $chan $chan1 add.6 none
  8174. return 0
  8175. }
  8176. if {[matchattr $hand -|A $chan] && ($level == "admin")} {
  8177. blacktools:tell $nick $host $hand $chan $chan1 add.7 none
  8178. return 0
  8179. }
  8180. if {[matchattr $hand -|M $chan] && ($level == "manager")} {
  8181. blacktools:tell $nick $host $hand $chan $chan1 add.8 none
  8182. return 0
  8183. }
  8184. if {([regexp -nocase -- {(#[0-9]+|owner|manager|admin|senior|op|voice|protect)} $level tmp access]) && (![regexp -nocase -- {\S#} $level])} {
  8185. switch $access {
  8186. manager {
  8187. set flags "-|olM"
  8188. if {[matchattr $handle m|- $chan] && [matchattr $hand -|M $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8189. return 0
  8190. }
  8191. if {[matchattr $handle -|M $chan] && [matchattr $hand -|M $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8192. return 0
  8193. }
  8194. if {[matchattr $handle n|- $chan] && [matchattr $hand n|- $chan]} {
  8195. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8196. return 0
  8197. }
  8198. if {[matchattr $handle n|- $chan] && [matchattr $hand m|- $chan]} {
  8199. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8200. return 0
  8201. }
  8202. if {[validuser $user]} {
  8203. chattr $user -|-qolSOAMV $chan
  8204. chattr $user $flags $chan
  8205. setuser $user XTRA LASTMODIFBY $hand
  8206. setuser $user XTRA LASTMODIFDATE $time
  8207. blacktools:tell $nick $host $hand $chan $chan1 add.9 $user
  8208. } else {
  8209. adduser $user $uhost
  8210. chattr $user -|-SOAMV $chan
  8211. chattr $user $flags $chan
  8212. setuser $user XTRA LASTMODIFBY $hand
  8213. setuser $user XTRA LASTMODIFDATE $time
  8214. blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
  8215. blacktools:tell $nick $host $hand $chan $chan1 add.9 $user
  8216. }
  8217. }
  8218. admin {
  8219. set flags "-|olA"
  8220. if {[matchattr $handle -|M $chan] && [matchattr $hand -|M $chan]} {
  8221. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8222. return 0
  8223. }
  8224. if {[matchattr $handle -|M $chan] && [matchattr $hand -|A $chan]} {
  8225. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8226. return 0
  8227. }
  8228. if {[matchattr $handle m|- $chan] && [matchattr $hand -|M $chan]} {
  8229. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8230. return 0
  8231. }
  8232. if {[matchattr $handle m|- $chan] && [matchattr $hand -|A $chan]} {
  8233. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8234. return 0
  8235. }
  8236. if {[matchattr $handle -|A $chan] && [matchattr $hand -|A $chan]} {
  8237. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8238. return 0
  8239. }
  8240. if {[matchattr $handle n|- $chan] && [matchattr $hand -|A $chan]} {
  8241. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8242. return 0
  8243. }
  8244. if {[matchattr $handle n|- $chan] && [matchattr $hand -|M $chan]} {
  8245. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8246. return 0
  8247. }
  8248. if {[matchattr $handle n|- $chan] && [matchattr $hand n|- $chan]} {
  8249. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8250. return 0
  8251. }
  8252. if {[matchattr $handle n|- $chan] && [matchattr $hand m|- $chan]} {
  8253. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8254. return 0
  8255. }
  8256. if {[validuser $user]} {
  8257. chattr $user -|-qolSOAMV $chan
  8258. chattr $user $flags $chan
  8259. setuser $user XTRA LASTMODIFBY $hand
  8260. setuser $user XTRA LASTMODIFDATE $time
  8261. blacktools:tell $nick $host $hand $chan $chan1 add.11 $user
  8262. } else {
  8263. adduser $user $uhost
  8264. chattr $user -|-qolSOAMV $chan
  8265. chattr $user $flags $chan
  8266. setuser $user XTRA LASTMODIFBY $hand
  8267. setuser $user XTRA LASTMODIFDATE $time
  8268. blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
  8269. blacktools:tell $nick $host $hand $chan $chan1 add.11 $user
  8270. }
  8271. }
  8272. senior {
  8273. set flags "-|olS"
  8274. if {[matchattr $handle -|M $chan] && [matchattr $hand -|M $chan]} {
  8275. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8276. return 0
  8277. }
  8278. if {[matchattr $handle -|M $chan] && [matchattr $hand -|A $chan]} {
  8279. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8280. return 0
  8281. }
  8282. if {[matchattr $handle m|- $chan] && [matchattr $hand -|M $chan]} {
  8283. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8284. return 0
  8285. }
  8286. if {[matchattr $handle m|- $chan] && [matchattr $hand -|A $chan]} {
  8287. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8288. return 0
  8289. }
  8290. if {[matchattr $handle -|A $chan] && [matchattr $hand -|A $chan]} {
  8291. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8292. return 0
  8293. }
  8294. if {[matchattr $handle n|- $chan] && [matchattr $hand -|A $chan]} {
  8295. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8296. return 0
  8297. }
  8298. if {[matchattr $handle n|- $chan] && [matchattr $hand -|M $chan]} {
  8299. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8300. return 0
  8301. }
  8302. if {[matchattr $handle n|- $chan] && [matchattr $hand n|- $chan]} {
  8303. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8304. return 0
  8305. }
  8306. if {[matchattr $handle n|- $chan] && [matchattr $hand m|- $chan]} {
  8307. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8308. return 0
  8309. }
  8310. if {[validuser $user]} {
  8311. chattr $user -|-qolSOAMV $chan
  8312. chattr $user $flags $chan
  8313. setuser $user XTRA LASTMODIFBY $hand
  8314. setuser $user XTRA LASTMODIFDATE $time
  8315. blacktools:tell $nick $host $hand $chan $chan1 add.12 $user
  8316. } else {
  8317. adduser $user $uhost
  8318. chattr $user -|-qolSOAMV $chan
  8319. chattr $user $flags $chan
  8320. setuser $user XTRA LASTMODIFBY $hand
  8321. setuser $user XTRA LASTMODIFDATE $time
  8322. blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
  8323. blacktools:tell $nick $host $hand $chan $chan1 add.12 $user
  8324. }
  8325. }
  8326. owner {
  8327. if {[matchattr $hand n|- $chan]} {
  8328. set flags "m|-"
  8329. if {[validuser $user]} {
  8330. chattr $user -|-qolSOAMV $chan
  8331. chattr $user $flags
  8332. setuser $user XTRA LASTMODIFBY $hand
  8333. setuser $user XTRA LASTMODIFDATE $time
  8334. blacktools:tell $nick $host $hand $chan $chan1 add.16 $user
  8335. } else {
  8336. adduser $user $uhost
  8337. chattr $user -|-qolSOAMV $chan
  8338. chattr $user $flags
  8339. setuser $user XTRA LASTMODIFBY $hand
  8340. setuser $user XTRA LASTMODIFDATE $time
  8341. blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
  8342. blacktools:tell $nick $host $hand $chan $chan1 add.16 $user
  8343. }
  8344. }
  8345. }
  8346. op {
  8347. set flags "-|olO"
  8348. if {[matchattr $handle -|M $chan] && [matchattr $hand -|M $chan]} {
  8349. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8350. return 0
  8351. }
  8352. if {[matchattr $handle -|M $chan] && [matchattr $hand -|A $chan]} {
  8353. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8354. return 0
  8355. }
  8356. if {[matchattr $handle m|- $chan] && [matchattr $hand -|M $chan]} {
  8357. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8358. return 0
  8359. }
  8360. if {[matchattr $handle m|- $chan] && [matchattr $hand -|A $chan]} {
  8361. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8362. return 0
  8363. }
  8364. if {[matchattr $handle -|A $chan] && [matchattr $hand -|A $chan]} {
  8365. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8366. return 0
  8367. }
  8368. if {[matchattr $handle n|- $chan] && [matchattr $hand -|A $chan]} {
  8369. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8370. return 0
  8371. }
  8372. if {[matchattr $handle n|- $chan] && [matchattr $hand -|M $chan]} {
  8373. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8374. return 0
  8375. }
  8376. if {[matchattr $handle n|- $chan] && [matchattr $hand n|- $chan]} {
  8377. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8378. return 0
  8379. }
  8380. if {[matchattr $handle n|- $chan] && [matchattr $hand m|- $chan]} {
  8381. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8382. return 0
  8383. }
  8384. if {[validuser $user]} {
  8385. chattr $user -|-qolSOAMV $chan
  8386. chattr $user $flags $chan
  8387. setuser $user XTRA LASTMODIFBY $hand
  8388. setuser $user XTRA LASTMODIFDATE $time
  8389. blacktools:tell $nick $host $hand $chan $chan1 add.13 $user
  8390. } else {
  8391. adduser $user $uhost
  8392. chattr $user -|-qolSOAMV $chan
  8393. chattr $user $flags $chan
  8394. setuser $user XTRA LASTMODIFBY $hand
  8395. setuser $user XTRA LASTMODIFDATE $time
  8396. blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
  8397. blacktools:tell $nick $host $hand $chan $chan1 add.13 $user
  8398. }
  8399. }
  8400. protect {
  8401. set flags "-|H"
  8402. if {[matchattr $handle -|M $chan] && [matchattr $hand -|M $chan]} {
  8403. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8404. return 0
  8405. }
  8406. if {[matchattr $handle -|M $chan] && [matchattr $hand -|A $chan]} {
  8407. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8408. return 0
  8409. }
  8410. if {[matchattr $handle m|- $chan] && [matchattr $hand -|M $chan]} {
  8411. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8412. return 0
  8413. }
  8414. if {[matchattr $handle m|- $chan] && [matchattr $hand -|A $chan]} {
  8415. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8416. return 0
  8417. }
  8418. if {[matchattr $handle -|A $chan] && [matchattr $hand -|A $chan]} {
  8419. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8420. return 0
  8421. }
  8422. if {[matchattr $handle n|- $chan] && [matchattr $hand -|A $chan]} {
  8423. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8424. return 0
  8425. }
  8426. if {[matchattr $handle n|- $chan] && [matchattr $hand -|M $chan]} {
  8427. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8428. return 0
  8429. }
  8430. if {[matchattr $handle n|- $chan] && [matchattr $hand n|- $chan]} {
  8431. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8432. return 0
  8433. }
  8434. if {[matchattr $handle n|- $chan] && [matchattr $hand m|- $chan]} {
  8435. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8436. return 0
  8437. }
  8438. if {[validuser $user]} {
  8439. chattr $user -|-qolHSOAMV $chan
  8440. chattr $user $flags $chan
  8441. setuser $user XTRA LASTMODIFBY $hand
  8442. setuser $user XTRA LASTMODIFDATE $time
  8443. blacktools:tell $nick $host $hand $chan $chan1 add.15 $user
  8444. } else {
  8445. adduser $user $uhost
  8446. chattr $user -|-qolHSOAMV $chan
  8447. chattr $user $flags $chan
  8448. setuser $user XTRA LASTMODIFBY $hand
  8449. setuser $user XTRA LASTMODIFDATE $time
  8450. blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
  8451. blacktools:tell $nick $host $hand $chan $chan1 add.15 $user
  8452. }
  8453. }
  8454. voice {
  8455. set flags "-|lV"
  8456. if {[matchattr $handle -|M $chan] && [matchattr $hand -|M $chan]} {
  8457. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8458. return 0
  8459. }
  8460. if {[matchattr $handle -|M $chan] && [matchattr $hand -|A $chan]} {
  8461. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8462. return 0
  8463. }
  8464. if {[matchattr $handle m|- $chan] && [matchattr $hand -|M $chan]} {
  8465. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8466. return 0
  8467. }
  8468. if {[matchattr $handle m|- $chan] && [matchattr $hand -|A $chan]} {
  8469. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8470. return 0
  8471. }
  8472. if {[matchattr $handle -|A $chan] && [matchattr $hand -|A $chan]} {
  8473. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8474. return 0
  8475. }
  8476. if {[matchattr $handle n|- $chan] && [matchattr $hand -|A $chan]} {
  8477. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8478. return 0
  8479. }
  8480. if {[matchattr $handle n|- $chan] && [matchattr $hand -|M $chan]} {
  8481. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8482. return 0
  8483. }
  8484. if {[matchattr $handle n|- $chan] && [matchattr $hand n|- $chan]} {
  8485. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8486. return 0
  8487. }
  8488. if {[matchattr $handle n|- $chan] && [matchattr $hand m|- $chan]} {
  8489. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8490. return 0
  8491. }
  8492. if {[validuser $user]} {
  8493. chattr $user -|-qolSOAMV $chan
  8494. chattr $user $flags $chan
  8495. setuser $user XTRA LASTMODIFBY $hand
  8496. setuser $user XTRA LASTMODIFDATE $time
  8497. blacktools:tell $nick $host $hand $chan $chan1 add.14 $user
  8498. } else {
  8499. adduser $user $uhost
  8500. chattr $user -|-qolSOAMV $chan
  8501. chattr $user $flags $chan
  8502. setuser $user XTRA LASTMODIFBY $hand
  8503. setuser $user XTRA LASTMODIFDATE $time
  8504. blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
  8505. blacktools:tell $nick $host $hand $chan $chan1 add.14 $user
  8506. }
  8507. }
  8508. }
  8509. }
  8510. }
  8511. }
  8512. }
  8513. proc publicadd {nick host hand chan arg} {
  8514. global black
  8515. set level [lindex [split $arg] 0]
  8516. set time [ctime [unixtime]]
  8517. set type 0
  8518. set chan1 "$chan"
  8519. set args [lrange [split $arg] 1 end]
  8520. set c [lindex [split $arg] 1]
  8521. if {[regexp {^[#&]} $c] && [matchattr $hand nm|- $chan]} {
  8522. set chan "$c"
  8523. set args [lrange [split $arg] 2 end]
  8524. }
  8525. if {[matchattr $hand -|q $chan]} {
  8526. blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  8527. return 0
  8528. }
  8529. add:process $args $time $level $hand $host $chan $chan1 $nick $type
  8530. }
  8531. ############################## delacc ################################
  8532. proc delaccpublic {nick host hand chan arg} {
  8533. global black
  8534. set args [lrange [split $arg] 0 end]
  8535. set type 0
  8536. set chan1 "$chan"
  8537. set c [lindex [split $arg] 0]
  8538. if {[regexp {^[#&]} $c] && [matchattr $hand nm|- $chan]} {
  8539. set chan "$c"
  8540. set args [lrange [split $arg] 1 end]
  8541. }
  8542. delacc:process $nick $host $hand $chan $chan1 $args $type
  8543. }
  8544. proc delacc:process {nick host hand chan chan1 args type} {
  8545. global botnick black
  8546. set char(p) [lindex $black(cmdchar) 0]
  8547. if {[string match -nocase "$char(p)" "none"]} {
  8548. set char(p) ""
  8549. }
  8550. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  8551. return 0
  8552. }
  8553. if {[matchattr $hand nm|- $chan]} {
  8554. if {($args == "") && ($type == "0")} {
  8555. blacktools:tell $nick $host $hand $chan $chan1 delacc.1 none
  8556. return 0
  8557. }
  8558. if {($args == "") && ($type == "1")} {
  8559. blacktools:tell $nick $host $hand $chan $chan1 delacc.2 none
  8560. return 0
  8561. }
  8562. }
  8563. if {($args == "") && ($type == "0")} {
  8564. blacktools:tell $nick $host $hand $chan $chan1 delacc.3 none
  8565. return 0
  8566. }
  8567. if {($args == "") && ($type == "1")} {
  8568. blacktools:tell $nick $host $hand $chan $chan1 delacc.4 none
  8569. return 0
  8570. }
  8571. if {![validchan $chan]} {
  8572. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  8573. return 0
  8574. }
  8575. if {![onchan $botnick $chan]} {
  8576. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  8577. return 0
  8578. }
  8579. foreach user $args {
  8580. if {$user != ""} {
  8581. if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
  8582. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8583. return 0
  8584. }
  8585. if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
  8586. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8587. return 0
  8588. }
  8589. if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
  8590. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8591. return 0
  8592. }
  8593. if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
  8594. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8595. return 0
  8596. }
  8597. if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
  8598. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8599. return 0
  8600. }
  8601. if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
  8602. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8603. return 0
  8604. }
  8605. if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
  8606. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8607. return 0
  8608. }
  8609. if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
  8610. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8611. return 0
  8612. }
  8613. if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
  8614. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8615. return 0
  8616. }
  8617. if {![matchattr $user nm|aolSOAMV $chan]} {
  8618. blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none
  8619. return 0
  8620. }
  8621. if {[validuser $user]} {
  8622. chattr $user -|-qaolSOAMV $chan
  8623. blacktools:tell $nick $host $hand $chan $chan1 delacc.5 $user
  8624. } else { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none }
  8625. }
  8626. }
  8627. }
  8628. ############################## del #####################################
  8629. proc delpublic {nick host hand chan arg} {
  8630. global black
  8631. set args [lrange [split $arg] 0 end]
  8632. set type 0
  8633. set chan1 "$chan"
  8634. del:process $nick $host $hand $chan $chan1 $args $type
  8635. }
  8636. proc del:process {nick host hand chan chan1 args type} {
  8637. global botnick black
  8638. set char(p) [lindex $black(cmdchar) 0]
  8639. if {[string match -nocase "$char(p)" "none"]} {
  8640. set char(p) ""
  8641. }
  8642. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  8643. return 0
  8644. }
  8645. if {($args == "") && ($type == "0")} {
  8646. blacktools:tell $nick $host $hand $chan $chan1 del.1 none
  8647. return 0
  8648. }
  8649. if {($args == "") && ($type == "1")} {
  8650. blacktools:tell $nick $host $hand $chan $chan1 del.2 none
  8651. return 0
  8652. }
  8653. foreach user $args {
  8654. if {$user != ""} {
  8655. if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
  8656. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8657. return 0
  8658. }
  8659. if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
  8660. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8661. return 0
  8662. }
  8663. if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
  8664. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8665. return 0
  8666. }
  8667. if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
  8668. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8669. return 0
  8670. }
  8671. if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
  8672. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8673. return 0
  8674. }
  8675. if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
  8676. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8677. return 0
  8678. }
  8679. if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
  8680. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8681. return 0
  8682. }
  8683. if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
  8684. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8685. return 0
  8686. }
  8687. if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
  8688. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8689. return 0
  8690. }
  8691. if {[validuser $user]} {
  8692. deluser $user
  8693. blacktools:tell $nick $host $hand $chan $chan1 del.3 $user
  8694. } else { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none }
  8695. }
  8696. }
  8697. }
  8698. ################################ addhost #############################
  8699. proc addhostpublic {nick host hand chan arg} {
  8700. global black
  8701. set user [lindex [split $arg] 0]
  8702. set type 0
  8703. set chan1 "$chan"
  8704. set hosts [lrange [split $arg] 1 end]
  8705. addhost:process $nick $host $hand $chan $chan1 $user $hosts $type
  8706. }
  8707. proc addhost:process {nick host hand chan chan1 user hosts type} {
  8708. global black botnick
  8709. set char(p) [lindex $black(cmdchar) 0]
  8710. if {[string match -nocase "$char(p)" "none"]} {
  8711. set char(p) ""
  8712. }
  8713. set time [ctime [unixtime]]
  8714. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  8715. return 0
  8716. }
  8717. if {($user == "") && ($type == "0")} {
  8718. blacktools:tell $nick $host $hand $chan $chan1 addhost.1 none
  8719. return 0
  8720. }
  8721. if {($user == "") && ($type == "1")} {
  8722. blacktools:tell $nick $host $hand $chan $chan1 addhost.2 none
  8723. return 0
  8724. }
  8725. if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
  8726. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8727. return 0
  8728. }
  8729. if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
  8730. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8731. return 0
  8732. }
  8733. if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
  8734. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8735. return 0
  8736. }
  8737. if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
  8738. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8739. return 0
  8740. }
  8741. if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
  8742. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8743. return 0
  8744. }
  8745. if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
  8746. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8747. return 0
  8748. }
  8749. if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
  8750. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8751. return 0
  8752. }
  8753. if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
  8754. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8755. return 0
  8756. }
  8757. if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
  8758. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8759. return 0
  8760. }
  8761. if {[validuser $user]} {
  8762. set hhost [getuser $user hosts]
  8763. foreach hhost $hhost {
  8764. if {[string match -nocase $hosts $hhost]} {
  8765. blacktools:tell $nick $host $hand $chan $chan1 addhost.3 "$user $hosts"
  8766. return 0
  8767. }
  8768. }
  8769. setuser $user HOSTS $hosts
  8770. setuser $user XTRA LASTMODIFBY $hand
  8771. setuser $user XTRA LASTMODIFDATE $time
  8772. blacktools:tell $nick $host $hand $chan $chan1 addhost.4 "$user $hosts"
  8773. } else { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none }
  8774. }
  8775. ############################### delhost ############################
  8776. proc delhostpuplic {nick host hand chan arg} {
  8777. global black
  8778. set user [lindex [split $arg] 0]
  8779. set type 0
  8780. set chan1 "$chan"
  8781. set hosts [lrange [split $arg] 1 end]
  8782. delhost:process $nick $host $hand $chan $chan1 $user $hosts $type
  8783. }
  8784. proc delhost:process {nick host hand chan chan1 user hosts type} {
  8785. global black botnick
  8786. set time [ctime [unixtime]]
  8787. set char(p) [lindex $black(cmdchar) 0]
  8788. if {[string match -nocase "$char(p)" "none"]} {
  8789. set char(p) ""
  8790. }
  8791. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  8792. return 0
  8793. }
  8794. if {($user == "") && ($type == "0")} {
  8795. blacktools:tell $nick $host $hand $chan $chan1 delhost.1 none
  8796. return 0
  8797. }
  8798. if {($user == "") && ($type == "1")} {
  8799. blacktools:tell $nick $host $hand $chan $chan1 delhost.2 none
  8800. return 0
  8801. }
  8802. if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
  8803. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8804. return 0
  8805. }
  8806. if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
  8807. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8808. return 0
  8809. }
  8810. if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
  8811. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8812. return 0
  8813. }
  8814. if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
  8815. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8816. return 0
  8817. }
  8818. if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
  8819. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8820. return 0
  8821. }
  8822. if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
  8823. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8824. return 0
  8825. }
  8826. if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
  8827. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8828. return 0
  8829. }
  8830. if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
  8831. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8832. return 0
  8833. }
  8834. if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
  8835. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8836. return 0
  8837. }
  8838. if {[validuser $user]} {
  8839. set hhost [getuser $user hosts]
  8840. foreach hhost $hhost {
  8841. if {[string match -nocase $hhost $hosts]} {
  8842. set foundhost 1
  8843. }
  8844. }
  8845. if {![info exists foundhost]} {
  8846. blacktools:tell $nick $host $hand $chan $chan1 delhost.3 "$user $hosts"
  8847. return 0
  8848. }
  8849. delhost $user $hosts
  8850. blacktools:tell $nick $host $hand $chan $chan1 delhost.4 "$user $hosts"
  8851. } else {
  8852. blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
  8853. }
  8854. }
  8855. proc chuserpublic {nick host hand chan arg} {
  8856. global black
  8857. set user [lindex [split $arg] 0]
  8858. set type 0
  8859. set chan1 "$chan"
  8860. set chandle [lindex [split $arg] 1]
  8861. chuser:process $nick $host $hand $chan $chan1 $user $chandle $type
  8862. }
  8863. proc chuser:process {nick host hand chan chan1 user chandle type} {
  8864. global botnick black
  8865. set char(p) [lindex $black(cmdchar) 0]
  8866. if {[string match -nocase "$char(p)" "none"]} {
  8867. set char(p) ""
  8868. }
  8869. set time [ctime [unixtime]]
  8870. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  8871. return 0
  8872. }
  8873. if {($user == "") && ($type == "0")} {
  8874. blacktools:tell $nick $host $hand $chan $chan1 chuser.1 none
  8875. return 0
  8876. }
  8877. if {($user == "") && ($type == "1")} {
  8878. blacktools:tell $nick $host $hand $chan $chan1 chuser.2 none
  8879. return 0
  8880. }
  8881. if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
  8882. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8883. return 0
  8884. }
  8885. if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
  8886. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8887. return 0
  8888. }
  8889. if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
  8890. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8891. return 0
  8892. }
  8893. if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
  8894. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8895. return 0
  8896. }
  8897. if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
  8898. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8899. return 0
  8900. }
  8901. if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
  8902. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8903. return 0
  8904. }
  8905. if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
  8906. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8907. return 0
  8908. }
  8909. if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
  8910. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8911. return 0
  8912. }
  8913. if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
  8914. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  8915. return 0
  8916. }
  8917. if {[validuser $user]} {
  8918. chhandle $user $chandle
  8919. setuser $chandle XTRA LASTMODIFBY $hand
  8920. setuser $chandle XTRA LASTMODIFDATE $time
  8921. blacktools:tell $nick $host $hand $chan $chan1 chuser.3 "$user $chandle"
  8922. } else {blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none }
  8923. }
  8924. proc userlist:execute {hand host level chan chan1 nick type} {
  8925. global black botnick
  8926. set char(p) [lindex $black(cmdchar) 0]
  8927. if {[string match -nocase "$char(p)" "none"]} {
  8928. set char(p) ""
  8929. }
  8930. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  8931. return 0
  8932. }
  8933. if {[matchattr $hand nm|- $chan]} {
  8934. if {($level == "") && ($type == "0")} {
  8935. blacktools:tell $nick $host $hand $chan $chan1 userlist.1 none
  8936. return 0
  8937. }
  8938. if {($level == "") && ($type == "1")} {
  8939. blacktools:tell $nick $host $hand $chan $chan1 userlist.2 none
  8940. return 0
  8941. }
  8942. }
  8943. if {($level == "") && ($type == "0")} {
  8944. blacktools:tell $nick $host $hand $chan $chan1 userlist.3 none
  8945. return 0
  8946. }
  8947. if {($level == "") && ($type == "1")} {
  8948. blacktools:tell $nick $host $hand $chan $chan1 userlist.4 none
  8949. return 0
  8950. }
  8951. if {![validchan $chan]} {
  8952. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  8953. return 0
  8954. }
  8955. if {![onchan $botnick $chan]} {
  8956. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  8957. return 0
  8958. }
  8959. if {([regexp -nocase -- {(#[0-9]+|manager|protect|admin|senior|op|voice|all|owner)} $level tmp access]) && (![regexp -nocase -- {\S#} $level])} {
  8960. switch $access {
  8961. manager {
  8962. set flags "-|M"
  8963. set numar [llength [userlist $flags $chan]]
  8964. set list [userlist $flags $chan]
  8965. foreach user [wordwrap [join $list " "] 250 ,] {
  8966. if {$list == ""} { set user "NONE" }
  8967. blacktools:tell $nick $host $hand $chan $chan1 userlist.5 $numar
  8968. blacktools:tell $nick $host $hand $chan $chan1 userlist.6 none
  8969. blacktools:tell $nick $host $hand $chan $chan1 userlist.7 $user
  8970. }
  8971. }
  8972. admin {
  8973. set flags "-|A"
  8974. set numar [llength [userlist $flags $chan]]
  8975. set list [userlist $flags $chan]
  8976. foreach user [wordwrap [join $list " , "] 250 ,] {
  8977. if {$list == ""} { set user "NONE" }
  8978. blacktools:tell $nick $host $hand $chan $chan1 userlist.8 $numar
  8979. blacktools:tell $nick $host $hand $chan $chan1 userlist.9 none
  8980. blacktools:tell $nick $host $hand $chan $chan1 userlist.7 $user
  8981. }
  8982. }
  8983. senior {
  8984. set flags "-|S"
  8985. set list [userlist $flags $chan]
  8986. set numar [llength [userlist $flags $chan]]
  8987. foreach user [wordwrap [join $list " , "] 250 ,] {
  8988. if {$list == ""} { set user "NONE" }
  8989. blacktools:tell $nick $host $hand $chan $chan1 userlist.10 $numar
  8990. blacktools:tell $nick $host $hand $chan $chan1 userlist.11 none
  8991. blacktools:tell $nick $host $hand $chan $chan1 userlist.7 $user
  8992. }
  8993. }
  8994. protect {
  8995. set flags "-|H"
  8996. set list [userlist $flags $chan]
  8997. set numar [llength [userlist $flags $chan]]
  8998. foreach user [wordwrap [join $list " , "] 250 ,] {
  8999. if {$list == ""} { set user "NONE" }
  9000. blacktools:tell $nick $host $hand $chan $chan1 userlist.12 $numar
  9001. blacktools:tell $nick $host $hand $chan $chan1 userlist.13 none
  9002. blacktools:tell $nick $host $hand $chan $chan1 userlist.7 $user
  9003. }
  9004. }
  9005. op {
  9006. set flags "-|O"
  9007. set list [userlist $flags $chan]
  9008. set numar [llength [userlist $flags $chan]]
  9009. foreach user [wordwrap [join $list " , "] 250 ,] {
  9010. if {$list == ""} { set user "NONE" }
  9011. blacktools:tell $nick $host $hand $chan $chan1 userlist.14 $numar
  9012. blacktools:tell $nick $host $hand $chan $chan1 userlist.15 none
  9013. blacktools:tell $nick $host $hand $chan $chan1 userlist.7 $user
  9014. }
  9015. }
  9016. owner {
  9017. if {[matchattr $hand nm|- $chan]} {
  9018. set bossflags "n|-"
  9019. set ownerflags "m|-"
  9020. set listbossowner [userlist $bossflags]
  9021. set listowner [userlist $ownerflags]
  9022. blacktools:tell $nick $host $hand $chan $chan1 userlist.16 $listbossowner
  9023. blacktools:tell $nick $host $hand $chan $chan1 userlist.17 $listowner
  9024. }
  9025. }
  9026. voice {
  9027. set flags "-|V"
  9028. set numar [llength [userlist $flags $chan]]
  9029. set list [userlist $flags $chan]
  9030. foreach user [wordwrap [join $list " , "] 250 ,] {
  9031. if {$list == ""} { set user "NONE" }
  9032. blacktools:tell $nick $host $hand $chan $chan1 userlist.18 $numar
  9033. blacktools:tell $nick $host $hand $chan $chan1 userlist.19 none
  9034. blacktools:tell $nick $host $hand $chan $chan1 userlist.7 $user
  9035. }
  9036. }
  9037. all {
  9038. array set flgc [list]
  9039. set flags "-|MNASVO"
  9040. set list [userlist $flags $chan]
  9041. set numar [llength [userlist $flags $chan]]
  9042. foreach user $list {
  9043. if {[matchattr $user -|V $chan]} {
  9044. lappend flgc(VOICE) $user
  9045. } elseif {[matchattr $user -|O $chan]} {
  9046. lappend flgc(OP) $user
  9047. } elseif {[matchattr $user -|S $chan]} {
  9048. lappend flgc(SENIOR) $user
  9049. } elseif {[matchattr $user -|A $chan]} {
  9050. lappend flgc(ADMINISTRATOR) $user
  9051. } elseif {[matchattr $user -|M $chan]} {
  9052. lappend flgc(MANAGER) $user
  9053. }
  9054. }
  9055. foreach flw [array names flgc] {
  9056. lappend messall [join 4$flgc($flw) " , "] -> 12($flw)
  9057. }
  9058. if {$list == ""} { set messall "NONE" }
  9059. blacktools:tell $nick $host $hand $chan $chan1 userlist.20 $numar
  9060. blacktools:tell $nick $host $hand $chan $chan1 userlist.21 none
  9061. foreach mes [wordwrap [join $messall] 250] {
  9062. blacktools:tell $nick $host $hand $chan $chan1 userlist.7 $mes
  9063. }
  9064. }
  9065. }
  9066. }
  9067. }
  9068. proc wordwrap {str {len 100} {splitChr { }}} {
  9069. set out [set cur {}]; set i 0
  9070. foreach word [split [set str][unset str] $splitChr] {
  9071. if {[incr i [string len $word]]>$len} {
  9072. lappend out [join $cur $splitChr]
  9073. set cur [list $word]
  9074. set i [string len $word]
  9075. } {
  9076. lappend cur $word
  9077. }
  9078. incr i
  9079. }
  9080. lappend out [join $cur $splitChr]
  9081. }
  9082. proc publicuserlist {nick host hand chan arg} {
  9083. global black
  9084. set level [lindex [split $arg] 0]
  9085. set type 0
  9086. set chan1 "$chan"
  9087. if {[regexp {^[#&]} $level] && [matchattr $hand nm|- $chan]} {
  9088. set chan "$level"
  9089. set level [lindex [split $arg] 1]
  9090. }
  9091. userlist:execute $hand $host $level $chan $chan1 $nick $type
  9092. }
  9093. ############################### channels ########################
  9094. proc channelspublic {nick host hand chan arg} {
  9095. global botnick black
  9096. set chan1 "$chan"
  9097. channels:process $nick $host $hand $chan $chan1
  9098. }
  9099. proc channels:process {nick host hand chan chan1} {
  9100. global botnick black
  9101. set num [llength [channels]]
  9102. set minusers "5"
  9103. array set status [list]
  9104. set notonchan "(NoT on ChaN)"
  9105. set notenough "(users < $minusers)"
  9106. set suspended "(SUSPENDED)"
  9107. foreach c [channels] {
  9108. set usersnumber [llength [chanlist $c]]
  9109. if {[channel get $c inactive]} {
  9110. lappend status($c) "4$c $suspended"
  9111. } elseif {![onchan $botnick $c]} {
  9112. lappend status($c) "4$c $notonchan"
  9113. } elseif {[onchan $botnick $c] && (![botisop $c])} {
  9114. lappend status($c) "4$c"
  9115. } elseif {[onchan $botnick $c] && ($usersnumber < $minusers)} {
  9116. lappend status($c) "4$c $notenough"
  9117. }
  9118. if {![info exists status($c)]} {
  9119. lappend status($c) "1@$c"
  9120. }
  9121. lappend message "[join $status($c) ", "]"
  9122. }
  9123. blacktools:tell $nick $host $hand $chan $chan1 channels.1 $num
  9124. foreach word [wordwrap [join $message] 350 ,] {
  9125. blacktools:tell $nick $host $hand $chan $chan1 channels.2 $word
  9126. }
  9127. }
  9128. ############################### info ############################
  9129. proc infopublic {nick host hand chan arg} {
  9130. global black
  9131. set user [lindex [split $arg] 0]
  9132. set type 0
  9133. set chan1 "$chan"
  9134. if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
  9135. set chan "$user"
  9136. set user [lindex [split $arg] 1]
  9137. }
  9138. info:process $nick $host $hand $chan $chan1 $user $type
  9139. }
  9140. proc info:process {nick host hand chan chan1 user type} {
  9141. global botnick black
  9142. set char(p) [lindex $black(cmdchar) 0]
  9143. if {[string match -nocase "$char(p)" "none"]} {
  9144. set char(p) ""
  9145. }
  9146. set time [ctime [unixtime]]
  9147. array set flg [list]
  9148. if {[matchattr $hand nm|- $chan]} {
  9149. if {($user == "") && ($type == "0")} {
  9150. blacktools:tell $nick $host $hand $chan $chan1 info.1 none
  9151. return 0
  9152. }
  9153. if {($user == "") && ($type == "1")} {
  9154. blacktools:tell $nick $host $hand $chan $chan1 info.2 none
  9155. return 0
  9156. }
  9157. }
  9158. if {($user == "") && ($type == "0")} {
  9159. blacktools:tell $nick $host $hand $chan $chan1 info.3 none
  9160. return 0
  9161. }
  9162. if {($user == "") && ($type == "1")} {
  9163. blacktools:tell $nick $host $hand $chan $chan1 info.4 none
  9164. return 0
  9165. }
  9166. if {![validchan $chan]} {
  9167. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  9168. return 0
  9169. }
  9170. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  9171. return 0
  9172. }
  9173. if {[validuser $user]} {
  9174. } else { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
  9175. return 0
  9176. }
  9177. if {[matchattr $hand nm|- $chan]} {
  9178. foreach c [channels] {
  9179. if {[matchattr $user -|V $c]} {
  9180. set fl "VOICE"
  9181. lappend flg($fl) $c
  9182. } elseif {[matchattr $user -|O $c]} {
  9183. set fl "OP"
  9184. lappend flg($fl) $c
  9185. } elseif {[matchattr $user -|S $c]} {
  9186. set fl "SENIOR"
  9187. lappend flg($fl) $c
  9188. } elseif {[matchattr $user -|A $c]} {
  9189. set fl "ADMINISTRATOR"
  9190. lappend flg($fl) $c
  9191. } elseif {[matchattr $user -|M $c]} {
  9192. set fl "MANAGER"
  9193. lappend flg($fl) $c
  9194. }
  9195. }
  9196. foreach cf [array names flg] {
  9197. lappend exit 1[join $flg($cf) ,] 12($cf) |
  9198. }
  9199. }
  9200. if {![matchattr $user nm|OAHSMNV $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none
  9201. if {![info exists exit]} { set exit "1NONE"}
  9202. if {[matchattr $hand nm|- $chan]} {
  9203. blacktools:tell $nick $host $hand $chan $chan1 info.5 "[join $exit]"
  9204. if {[getuser $user HOSTS] != ""} {
  9205. set hosts [getuser $user hosts]
  9206. blacktools:tell $nick $host $hand $chan $chan1 info.6 $hosts
  9207. }
  9208. set lastseen [getuser $user LASTON $chan]
  9209. if {($lastseen == "0") || ($lastseen == "")} {
  9210. set seened "1NONE"
  9211. } else { set seened [ctime $lastseen] }
  9212. blacktools:tell $nick $host $hand $chan $chan1 info.7 $seened
  9213. }
  9214. return 0
  9215. }
  9216. set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
  9217. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  9218. set suspendat "$black(say.$getlang.info.10)"
  9219. set cflags [chattr $user | $chan]
  9220. blacktools:tell $nick $host $hand $chan $chan1 info.8 $user
  9221. blacktools:tell $nick $host $hand $chan $chan1 info.9 $time
  9222. if {[matchattr $user -|V $chan]} { set flags "VOICE" } elseif {[matchattr $user -|O $chan]} { set flags "OP" } elseif {[matchattr $user -|S $chan]} { set flags "SENIOR" } elseif {[matchattr $user -|A $chan]} { set flags "ADMINISTRATOR" } elseif {[matchattr $user -|H $chan]} { set flags "PROTECT"}
  9223. if {[matchattr $user -|M $chan]} { set flags "MANAGER" } elseif {[matchattr $user n|- $chan]} { set flags "THE BOSS OWNER" } elseif {[matchattr $user m|- $chan]} { set flags "OWNER" } elseif {$cflags == "-|-"} {puthelp "NOTICE $nick :$user nu are ACCESS pe acest canal !"
  9224. return 0
  9225. }
  9226. if {[matchattr $user -|q $chan]} {
  9227. if {[matchattr $user -|V $chan]} { set flags "VOICE ($suspendat)" } elseif {[matchattr $user -|O $chan]} { set flags "OP ($suspendat)" } elseif {[matchattr $user -|S $chan]} { set flags "SENIOR ($suspendat)" } elseif {[matchattr $user -|A $chan]} { set flags "ADMINISTRATOR ($suspendat)" } elseif {[matchattr $user -|O $chan]} { set flags "PROTECT ($suspendat)"}
  9228. if {[matchattr $user -|M $chan]} { set flags "MANAGER ($suspendat)" } elseif {[matchattr $user m|- $chan]} { set flags "OWNER ($suspendat)" } elseif {$cflags == "-|-"} {puthelp "NOTICE $nick :$user
  9229. S pe acest canal !"
  9230. return 0
  9231. }
  9232. }
  9233. blacktools:tell $nick $host $hand $chan $chan1 info.11 "$cflags $flags"
  9234. if {[getuser $user INFO] != ""} {
  9235. blacktools:tell $nick $host $hand $chan $chan1 info.12 "[getuser $user INFO]"
  9236. }
  9237. set date [getuser $user XTRA LASTMODIFDATE]
  9238. if {[matchattr $user n|- $chan]} { set date "No Date" }
  9239. if {$date == ""} { set date "No Date" }
  9240. set lastt [getuser $user XTRA LASTMODIFBY]
  9241. if {$lastt == ""} { set lastt "No info" }
  9242. if {[matchattr $user n|- $chan]} { set lastt "NONE" }
  9243. blacktools:tell $nick $host $hand $chan $chan1 info.13 "$lastt $date"
  9244. if {[getuser $user HOSTS] != ""} {
  9245. set hosts [getuser $user hosts]
  9246. blacktools:tell $nick $host $hand $chan $chan1 info.6 $hosts
  9247. }
  9248. if {![info exists exit]} { set exit "NONE"}
  9249. if {![matchattr $user nm|- $chan] && [matchattr $hand nm|- $chan]} {
  9250. blacktools:tell $nick $host $hand $chan $chan1 info.5 "[join $exit]"
  9251. }
  9252. set lastseen [getuser $user LASTON $chan]
  9253. if {($lastseen == "0") || ($lastseen == "")} {
  9254. blacktools:tell $nick $host $hand $chan $chan1 info.14 none
  9255. blacktools:tell $nick $host $hand $chan $chan1 info.15 $user
  9256. blacktools:tell $nick $host $hand $chan $chan1 info.16 none
  9257. return 0
  9258. }
  9259. set seened [ctime $lastseen]
  9260. blacktools:tell $nick $host $hand $chan $chan1 info.17 $seened
  9261. blacktools:tell $nick $host $hand $chan $chan1 info.15 $user
  9262. blacktools:tell $nick $host $hand $chan $chan1 info.16 none
  9263. }
  9264. ################################# s ###############################
  9265. proc spublic {nick host hand chan arg} {
  9266. global black
  9267. set type 0
  9268. set chan1 "$chan"
  9269. set users [lindex [split $arg] 0]
  9270. if {[regexp {^[#&]} $users] && [matchattr $hand nm|- $chan]} {
  9271. set chan "$users"
  9272. set users [lindex [split $arg] 1]
  9273. }
  9274. s:process $nick $host $hand $chan $chan1 $users $type
  9275. }
  9276. proc s:process {nick host hand chan chan1 users type} {
  9277. global botnick black
  9278. set flags "-|q"
  9279. set char(p) [lindex $black(cmdchar) 0]
  9280. if {[string match -nocase "$char(p)" "none"]} {
  9281. set char(p) ""
  9282. }
  9283. set time [ctime [unixtime]]
  9284. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  9285. return 0
  9286. }
  9287. if {[matchattr $hand nm|- $chan]} {
  9288. if {($users == "") && ($type == "0")} {
  9289. blacktools:tell $nick $host $hand $chan $chan1 s.1 none
  9290. return 0
  9291. }
  9292. if {($users == "") && ($type == "1")} {
  9293. blacktools:tell $nick $host $hand $chan $chan1 s.2 none
  9294. return 0
  9295. }
  9296. }
  9297. if {($users == "") && ($type == "0")} {
  9298. blacktools:tell $nick $host $hand $chan $chan1 s.3 none
  9299. return 0
  9300. }
  9301. if {($users == "") && ($type == "1")} {
  9302. blacktools:tell $nick $host $hand $chan $chan1 s.4 none
  9303. return 0
  9304. }
  9305. if {![validchan $chan]} {
  9306. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  9307. return 0
  9308. }
  9309. if {![onchan $botnick $chan]} {
  9310. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  9311. return 0
  9312. }
  9313. if {[matchattr $users -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 s.5 $users
  9314. return 0
  9315. }
  9316. if {![validuser $users]} {
  9317. blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
  9318. return 0
  9319. }
  9320. if {![matchattr $users nm|OASMNV $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none
  9321. return 0
  9322. }
  9323. if {[matchattr $users -|M $chan] && [matchattr $hand -|M $chan]} {
  9324. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9325. return 0
  9326. }
  9327. if {[matchattr $users -|M $chan] && [matchattr $hand -|A $chan]} {
  9328. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9329. return 0
  9330. }
  9331. if {[matchattr $users m|- $chan] && [matchattr $hand -|M $chan]} {
  9332. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9333. return 0
  9334. }
  9335. if {[matchattr $users m|- $chan] && [matchattr $hand -|A $chan]} {
  9336. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9337. return 0
  9338. }
  9339. if {[matchattr $users -|A $chan] && [matchattr $hand -|A $chan]} {
  9340. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9341. return 0
  9342. }
  9343. if {[matchattr $users n|- $chan] && [matchattr $hand -|A $chan]} {
  9344. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9345. return 0
  9346. }
  9347. if {[matchattr $users n|- $chan] && [matchattr $hand -|M $chan]} {
  9348. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9349. return 0
  9350. }
  9351. if {[matchattr $users n|- $chan] && [matchattr $hand n|- $chan]} {
  9352. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9353. return 0
  9354. }
  9355. if {[matchattr $users n|- $chan] && [matchattr $hand m|- $chan]} {
  9356. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9357. return 0
  9358. }
  9359. chattr $users $flags $chan
  9360. setuser $users XTRA LASTMODIFBY $hand
  9361. setuser $users XTRA LASTMODIFDATE $time
  9362. blacktools:tell $nick $host $hand $chan $chan1 s.6 $users
  9363. }
  9364. ################################## us ################################
  9365. proc uspublic {nick host hand chan arg} {
  9366. global black
  9367. set type 0
  9368. set chan1 "$chan"
  9369. set users [lindex [split $arg] 0]
  9370. if {[regexp {^[\\+!#&]} $users] && [matchattr $hand nm|- $chan]} {
  9371. set chan "$users"
  9372. set users [lindex [split $arg] 1]
  9373. }
  9374. us:process $nick $host $hand $chan $chan1 $users $type
  9375. }
  9376. proc us:process {nick host hand chan chan1 users type} {
  9377. global botnick black
  9378. set flags "-|-q"
  9379. set char(p) [lindex $black(cmdchar) 0]
  9380. if {[string match -nocase "$char(p)" "none"]} {
  9381. set char(p) ""
  9382. }
  9383. set time [ctime [unixtime]]
  9384. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  9385. return 0
  9386. }
  9387. if {[matchattr $hand nm|- $chan]} {
  9388. if {($users == "") && ($type == "0")} {
  9389. blacktools:tell $nick $host $hand $chan $chan1 us.1 none
  9390. return 0
  9391. }
  9392. if {($users == "") && ($type == "1")} {
  9393. blacktools:tell $nick $host $hand $chan $chan1 us.2 none
  9394. return 0
  9395. }
  9396. }
  9397. if {($users == "") && ($type == "0")} {
  9398. blacktools:tell $nick $host $hand $chan $chan1 us.3 none
  9399. return 0
  9400. }
  9401. if {($users == "") && ($type == "1")} {
  9402. blacktools:tell $nick $host $hand $chan $chan1 us.4 none
  9403. return 0
  9404. }
  9405. if {![validchan $chan]} {
  9406. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  9407. return 0
  9408. }
  9409. if {![onchan $botnick $chan]} {
  9410. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  9411. return 0
  9412. }
  9413. if {![validuser $users]} {
  9414. blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
  9415. return 0
  9416. }
  9417. if {![matchattr $users nm|OASMNV $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none
  9418. return 0
  9419. }
  9420. if {![matchattr $users -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 us.5 $users
  9421. return 0
  9422. }
  9423. if {[matchattr $users -|M $chan] && [matchattr $hand -|M $chan]} {
  9424. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9425. return 0
  9426. }
  9427. if {[matchattr $users -|M $chan] && [matchattr $hand -|A $chan]} {
  9428. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9429. return 0
  9430. }
  9431. if {[matchattr $users m|- $chan] && [matchattr $hand -|M $chan]} {
  9432. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9433. return 0
  9434. }
  9435. if {[matchattr $users m|- $chan] && [matchattr $hand -|A $chan]} {
  9436. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9437. return 0
  9438. }
  9439. if {[matchattr $users -|A $chan] && [matchattr $hand -|A $chan]} {
  9440. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9441. return 0
  9442. }
  9443. if {[matchattr $users n|- $chan] && [matchattr $hand -|A $chan]} {
  9444. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9445. return 0
  9446. }
  9447. if {[matchattr $users n|- $chan] && [matchattr $hand -|M $chan]} {
  9448. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9449. return 0
  9450. }
  9451. if {[matchattr $users n|- $chan] && [matchattr $hand n|- $chan]} {
  9452. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9453. return 0
  9454. }
  9455. if {[matchattr $users n|- $chan] && [matchattr $hand m|- $chan]} {
  9456. blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
  9457. return 0
  9458. }
  9459. setuser $users XTRA LASTMODIFBY $hand
  9460. setuser $users XTRA LASTMODIFDATE $time
  9461. chattr $users $flags $chan
  9462. blacktools:tell $nick $host $hand $chan $chan1 us.6 $users
  9463. }
  9464. ############################## ping ##################################
  9465. proc pings {nick host hand chan arg} {
  9466. putquick "PRIVMSG $nick :\001PING [expr {abs([clock clicks -milliseconds])}]\001"
  9467. return 0
  9468. }
  9469. proc pingpublic {nick host hand dest key arg} {
  9470. global botnick black
  9471. set ping [split $arg "."]
  9472. set pingreply [lindex $ping 0]
  9473. if {[regexp -- {^-?[0-9]+$} $pingreply]} {
  9474. set second "[expr {abs([expr [expr {abs([clock clicks -milliseconds])} - $pingreply] / 1000.000])}]"
  9475. blacktools:tell:prv $nick $host $hand ping.1 $second
  9476. }
  9477. }
  9478. ############################### time ##################################
  9479. proc timepublic {nick host hand chan arg} {
  9480. global black
  9481. set chan1 "$chan"
  9482. set time [ctime [unixtime]]
  9483. blacktools:tell $nick $host $hand $chan $chan1 time.1 $time
  9484. }
  9485. ################################### vers ###############################
  9486. proc verspublic {nick host hand chan arg} {
  9487. global black
  9488. set why [lindex [split $arg] 0]
  9489. set chan1 "$chan"
  9490. set char(p) [lindex $black(cmdchar) 0]
  9491. if {[string match -nocase "$char(p)" "none"]} {
  9492. set char(p) ""
  9493. }
  9494. if {$why == ""} { blacktools:tell $nick $host $hand $chan $chan1 vers.1 none
  9495. return 0
  9496. }
  9497. vers:process $nick $host $hand $chan $chan1 $why
  9498. }
  9499. proc vers:process {nick host hand chan chan1 why} {
  9500. global botnick black
  9501. set ::verschan $chan
  9502. set ::versnick $nick
  9503. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  9504. return 0
  9505. }
  9506. if {![onchan $why $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan $why
  9507. return 0
  9508. }
  9509. putserv "PRIVMSG $why :\001VERSION\001"
  9510. }
  9511. proc ctcpvers {nickname hostname handle dest key arg} {
  9512. set text [split $arg]
  9513. set chan $::verschan
  9514. set nick $::versnick
  9515. blacktools:tell:prv $nick $hostname $handle vers.3 "$nickname $text"
  9516. }
  9517. ################################### whois ###############################
  9518. proc whoispublic {nick host hand chan arg} {
  9519. global black
  9520. set char(p) [lindex $black(cmdchar) 0]
  9521. if {[string match -nocase "$char(p)" "none"]} {
  9522. set char(p) ""
  9523. }
  9524. set chan1 "$chan"
  9525. set who [lindex [split $arg] 0]
  9526. if {$who == ""} { blacktools:tell $nick $host $hand $chan $chan1 whois.1 none
  9527. return 0
  9528. }
  9529. whois:process $nick $host $hand $chan $chan1 $who
  9530. }
  9531. proc whois:process {nick host hand chan chan1 who} {
  9532. global botnick black
  9533. set ::wnick $nick
  9534. set ::hand $hand
  9535. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  9536. return 0
  9537. }
  9538. putquick "WHOIS $who $who"
  9539. bind RAW - 311 winfo
  9540. bind RAW - 319 wchannels
  9541. bind RAW - 401 nonicks
  9542. }
  9543. proc winfo { from keyword arguments } {
  9544. global black
  9545. set hand $::hand
  9546. set nick $::wnick
  9547. set nickname [lindex [split $arguments] 1]
  9548. set ident [lindex [split $arguments] 2]
  9549. set host [lindex [split $arguments] 3]
  9550. set realname [string range [join [lrange $arguments 5 end]] 1 end]
  9551. blacktools:tell:prv $nick hostname $hand whois.3 "$nickname 4host - 12*!*$ident@$host * $realname"
  9552. unbind RAW - 311 winfo
  9553. }
  9554. proc wchannels { from keyword arguments } {
  9555. global black
  9556. set hand $::hand
  9557. set nick $::wnick
  9558. set channels [string range [join [lrange $arguments 2 end]] 1 end]
  9559. blacktools:tell:prv $nick hostname $hand whois.4 $channels
  9560. unbind RAW - 319 wchannels
  9561. }
  9562. proc nonicks { from keyword arguments } {
  9563. global black
  9564. set hand $::hand
  9565. set nick $::wnick
  9566. blacktools:tell:prv $nick hostname $hand whois.5 none
  9567. unbind RAW - 401 nonicks
  9568. }
  9569. ################################### clear ###############################
  9570. proc clearpublic {nick host hand chan arg} {
  9571. global black
  9572. set why [lindex [split $arg] 0]
  9573. set chan1 "$chan"
  9574. set type 0
  9575. if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
  9576. set chan "$why"
  9577. set why [lindex [split $arg] 1]
  9578. }
  9579. clear:process $nick $host $hand $chan $chan1 $why $type
  9580. }
  9581. proc clear:process {nick host hand chan chan1 why type} {
  9582. global botnick black
  9583. set char(p) [lindex $black(cmdchar) 0]
  9584. if {[string match -nocase "$char(p)" "none"]} {
  9585. set char(p) ""
  9586. }
  9587. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  9588. return 0
  9589. }
  9590. if {[matchattr $hand nm|- $chan]} {
  9591. if {($why == "") && ($type == "0")} {
  9592. blacktools:tell $nick $host $hand $chan $chan1 clear.1 none
  9593. return 0
  9594. }
  9595. if {($why == "") && ($type == "1")} {
  9596. blacktools:tell $nick $host $hand $chan $chan1 clear.2 none
  9597. return 0
  9598. }
  9599. }
  9600. if {($why == "") && ($type == "0")} {
  9601. blacktools:tell $nick $host $hand $chan $chan1 clear.3 none
  9602. return 0
  9603. }
  9604. if {($why == "") && ($type == "1")} {
  9605. blacktools:tell $nick $host $hand $chan $chan1 clear.4 none
  9606. return 0
  9607. }
  9608. if {![validchan $chan]} {
  9609. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  9610. return 0
  9611. }
  9612. if {![onchan $botnick $chan]} {
  9613. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  9614. return 0
  9615. }
  9616. if {([regexp -nocase -- {(#[0-9]+|banlist|userlist)} $why tmp cleanlist]) && (![regexp -nocase -- {\S#} $why])} {
  9617. switch $cleanlist {
  9618. userlist {
  9619. set list [userlist -|AOSV $chan]
  9620. foreach user $list {
  9621. chattr $user -|-AOVS $chan
  9622. }
  9623. blacktools:tell $nick $host $hand $chan $chan1 clear.5 none
  9624. }
  9625. banlist {
  9626. set i 0
  9627. foreach ban [banlist $chan] {
  9628. set theban [lindex $ban 0]
  9629. if {[string match "*" $theban]} {
  9630. set i [expr $i +1]
  9631. killchanban $chan $theban
  9632. }
  9633. }
  9634. blacktools:tell $nick $host $hand $chan $chan1 clear.6 $i
  9635. }
  9636. }
  9637. }
  9638. }
  9639. ################################# addbot ################################
  9640. proc addbotpublic {nick host hand chan arg} {
  9641. global black
  9642. set char(p) [lindex $black(cmdchar) 0]
  9643. if {[string match -nocase "$char(p)" "none"]} {
  9644. set char(p) ""
  9645. }
  9646. set chan1 "$chan"
  9647. set why [lindex [split $arg] 0]
  9648. set host [lindex [split $arg] 1]
  9649. if {$why == ""} { blacktools:tell $nick $host $hand $chan $chan1 addbot.1 none
  9650. return 0
  9651. }
  9652. addbot:process $nick $host $hand $chan $chan1 $why $host
  9653. }
  9654. proc addbot:process {nick host hand chan chan1 why host} {
  9655. global botnick black
  9656. set flags "ao|ao"
  9657. if {[validuser $why]} {
  9658. blacktools:tell $nick $host $hand $chan $chan1 addbot.3 $why
  9659. return 0
  9660. }
  9661. addbot $why $host
  9662. chattr $why $flags $chan
  9663. blacktools:tell $nick $host $hand $chan $chan1 addbot.4 "$why $host"
  9664. }
  9665. proc autovonjoin {nick host hand chan} {
  9666. if {[channel get $chan autovoice]} {
  9667. pushmode $chan +v $nick
  9668. }
  9669. }
  9670. proc autoponjoin {nick host hand chan} {
  9671. if {[channel get $chan autoop]} {
  9672. pushmode $chan +o $nick
  9673. }
  9674. }
  9675. ############################# addop #################################
  9676. proc addoppublic {nick host hand chan arg} {
  9677. global black
  9678. set user [lindex [split $arg] 0]
  9679. set type 0
  9680. set chan1 "$chan"
  9681. if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
  9682. set chan "$user"
  9683. set user [lindex [split $arg] 1]
  9684. }
  9685. addop:process $nick $host $hand $chan $chan1 $user $type
  9686. }
  9687. proc addop:process {nick host hand chan chan1 user type} {
  9688. global black botnick
  9689. set char(p) [lindex $black(cmdchar) 0]
  9690. if {[string match -nocase "$char(p)" "none"]} {
  9691. set char(p) ""
  9692. }
  9693. set flag "-|a"
  9694. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  9695. return 0
  9696. }
  9697. if {[matchattr $hand nm|- $chan]} {
  9698. if {($user == "") && ($type == "0")} {
  9699. blacktools:tell $nick $host $hand $chan $chan1 addop.1 none
  9700. return 0
  9701. }
  9702. if {($user == "") && ($type == "1")} {
  9703. blacktools:tell $nick $host $hand $chan $chan1 addop.2 none
  9704. return 0
  9705. }
  9706. }
  9707. if {($user == "") && ($type == "0")} {
  9708. blacktools:tell $nick $host $hand $chan $chan1 addop.3 none
  9709. return 0
  9710. }
  9711. if {($user == "") && ($type == "1")} {
  9712. blacktools:tell $nick $host $hand $chan $chan1 addop.4 none
  9713. return 0
  9714. }
  9715. if {![validchan $chan]} {
  9716. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  9717. return 0
  9718. }
  9719. if {![onchan $botnick $chan]} {
  9720. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  9721. return 0
  9722. }
  9723. if {![validuser $user]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
  9724. return 0
  9725. }
  9726. if {[matchattr $user -|a $chan]} {
  9727. blacktools:tell $nick $host $hand $chan $chan1 addop.5 $user
  9728. return 0
  9729. }
  9730. chattr $user $flag $chan
  9731. blacktools:tell $nick $host $hand $chan $chan1 addop.6 $user
  9732. }
  9733. proc addopjoin {nick host hand chan} {
  9734. if {[matchattr $hand -|a $chan]} {
  9735. pushmode $chan +o $nick
  9736. }
  9737. }
  9738. ########################### addvoice ################################
  9739. proc addvoicepublic {nick host hand chan arg} {
  9740. global black
  9741. set user [lindex [split $arg] 0]
  9742. set type 0
  9743. set chan1 "$chan"
  9744. if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
  9745. set chan "$user"
  9746. set user [lindex [split $arg] 1]
  9747. }
  9748. addvoice:process $nick $host $hand $chan $chan1 $user $type
  9749. }
  9750. proc addvoice:process {nick host hand chan chan1 user type} {
  9751. global black botnick
  9752. set char(p) [lindex $black(cmdchar) 0]
  9753. if {[string match -nocase "$char(p)" "none"]} {
  9754. set char(p) ""
  9755. }
  9756. set flag "-|g"
  9757. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  9758. return 0
  9759. }
  9760. if {[matchattr $hand nm|- $chan]} {
  9761. if {($user == "") && ($type == "0")} {
  9762. blacktools:tell $nick $host $hand $chan $chan1 addvoice.1 none
  9763. return 0
  9764. }
  9765. if {($user == "") && ($type == "1")} {
  9766. blacktools:tell $nick $host $hand $chan $chan1 addvoice.2 none
  9767. return 0
  9768. }
  9769. }
  9770. if {($user == "") && ($type == "0")} {
  9771. blacktools:tell $nick $host $hand $chan $chan1 addvoice.3 none
  9772. return 0
  9773. }
  9774. if {($user == "") && ($type == "1")} {
  9775. blacktools:tell $nick $host $hand $chan $chan1 addvoice.4 none
  9776. return 0
  9777. }
  9778. if {![validchan $chan]} {
  9779. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  9780. return 0
  9781. }
  9782. if {![onchan $botnick $chan]} {
  9783. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  9784. return 0
  9785. }
  9786. if {![validuser $user]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
  9787. return 0
  9788. }
  9789. if {[matchattr $user -|g $chan]} {
  9790. blacktools:tell $nick $host $hand $chan $chan1 addvoice.5 $user
  9791. return 0
  9792. }
  9793. chattr $user $flag $chan
  9794. blacktools:tell $nick $host $hand $chan $chan1 addvoice.6 $user
  9795. }
  9796. proc addvoicejoin {nick host hand chan} {
  9797. if {[matchattr $hand -|g $chan]} {
  9798. pushmode $chan +v $nick
  9799. }
  9800. }
  9801. ########################### delop ##################################
  9802. proc deloppublic {nick host hand chan arg} {
  9803. global black botnick
  9804. set user [lindex [split $arg] 0]
  9805. set type 0
  9806. set chan1 "$chan"
  9807. if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
  9808. set chan "$user"
  9809. set user [lindex [split $arg] 1]
  9810. }
  9811. delop:process $nick $host $hand $chan $chan1 $user $type
  9812. }
  9813. proc delop:process {nick host hand chan chan1 user type} {
  9814. global black botnick
  9815. set char(p) [lindex $black(cmdchar) 0]
  9816. if {[string match -nocase "$char(p)" "none"]} {
  9817. set char(p) ""
  9818. }
  9819. set flag "-|-a"
  9820. if {[matchattr $hand -|q $chan]} {
  9821. blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  9822. return 0
  9823. }
  9824. if {[matchattr $hand nm|- $chan]} {
  9825. if {($user == "") && ($type == "0")} {
  9826. blacktools:tell $nick $host $hand $chan $chan1 delop.1 none
  9827. return 0
  9828. }
  9829. if {($user == "") && ($type == "1")} {
  9830. blacktools:tell $nick $host $hand $chan $chan1 delop.2 none
  9831. return 0
  9832. }
  9833. }
  9834. if {($user == "") && ($type == "0")} {
  9835. blacktools:tell $nick $host $hand $chan $chan1 delop.3 none
  9836. return 0
  9837. }
  9838. if {($user == "") && ($type == "1")} {
  9839. blacktools:tell $nick $host $hand $chan $chan1 delop.4 none
  9840. return 0
  9841. }
  9842. if {![validchan $chan]} {
  9843. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  9844. return 0
  9845. }
  9846. if {![onchan $botnick $chan]} {
  9847. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  9848. return 0
  9849. }
  9850. if {![validuser $user]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
  9851. return 0
  9852. }
  9853. if {[matchattr $user -|a $chan]} {
  9854. set noautoop 1
  9855. }
  9856. if {![info exists noautoop]} {
  9857. blacktools:tell $nick $host $hand $chan $chan1 delop.5 $user
  9858. return 0
  9859. }
  9860. chattr $user $flag $chan
  9861. blacktools:tell $nick $host $hand $chan $chan1 delop.6 $user
  9862. }
  9863. ############################ delvoice ###############################
  9864. proc delvoicepublic {nick host hand chan arg} {
  9865. global black
  9866. set user [lindex [split $arg] 0]
  9867. set type 0
  9868. set chan1 "$chan"
  9869. if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
  9870. set chan "$user"
  9871. set user [lindex [split $arg] 1]
  9872. }
  9873. delvoice:process $nick $host $hand $chan $chan1 $user $type
  9874. }
  9875. proc delvoice:process {nick host hand chan chan1 user type} {
  9876. global black botnick
  9877. set char(p) [lindex $black(cmdchar) 0]
  9878. if {[string match -nocase "$char(p)" "none"]} {
  9879. set char(p) ""
  9880. }
  9881. set flag "-|-g"
  9882. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  9883. return 0
  9884. }
  9885. if {[matchattr $hand nm|- $chan]} {
  9886. if {($user == "") && ($type == "0")} {
  9887. blacktools:tell $nick $host $hand $chan $chan1 delvoice.1 none
  9888. return 0
  9889. }
  9890. if {($user == "") && ($type == "1")} {
  9891. blacktools:tell $nick $host $hand $chan $chan1 delvoice.2 none
  9892. return 0
  9893. }
  9894. }
  9895. if {($user == "") && ($type == "0")} {
  9896. blacktools:tell $nick $host $hand $chan $chan1 delvoice.3 none
  9897. return 0
  9898. }
  9899. if {($user == "") && ($type == "1")} {
  9900. blacktools:tell $nick $host $hand $chan $chan1 delvoice.4 none
  9901. return 0
  9902. }
  9903. if {![validchan $chan]} {
  9904. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  9905. return 0
  9906. }
  9907. if {![onchan $botnick $chan]} {
  9908. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  9909. return 0
  9910. }
  9911. if {![validuser $user]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
  9912. return 0
  9913. }
  9914. if {[matchattr $user -|g $chan]} {
  9915. set noautovoice 1
  9916. }
  9917. if {![info exists noautovoice]} {
  9918. blacktools:tell $nick $host $hand $chan $chan1 delvoice.5 $user
  9919. return 0
  9920. }
  9921. chattr $user $flag $chan
  9922. blacktools:tell $nick $host $hand $chan $chan1 delvoice.6 $user
  9923. }
  9924. ############################## activ ##################################
  9925. proc activpublic {nick host hand chan arg} {
  9926. global black
  9927. set type 0
  9928. set chan1 "$chan"
  9929. set user [lindex [split $arg] 0]
  9930. if {[regexp {^[#&]} $user] && [matchattr $hand nm|- $chan]} {
  9931. set chan "$user"
  9932. set user [lindex [split $arg] 1]
  9933. }
  9934. activ:process $nick $host $hand $chan $chan1 $user $type
  9935. }
  9936. proc activ:process {nick host hand chan chan1 user type} {
  9937. global botnick black
  9938. set char(p) [lindex $black(cmdchar) 0]
  9939. if {[string match -nocase "$char(p)" "none"]} {
  9940. set char(p) ""
  9941. }
  9942. if {[matchattr $hand nm|- $chan]} {
  9943. if {($user == "") && ($type == "0")} {
  9944. blacktools:tell $nick $host $hand $chan $chan1 activ.1 none
  9945. return 0
  9946. }
  9947. if {($user == "") && ($type == "1")} {
  9948. blacktools:tell $nick $host $hand $chan $chan1 activ.2 none
  9949. return 0
  9950. }
  9951. }
  9952. if {($user == "") && ($type == "0")} {
  9953. blacktools:tell $nick $host $hand $chan $chan1 activ.3 none
  9954. return 0
  9955. }
  9956. if {($user == "") && ($type == "1")} {
  9957. blacktools:tell $nick $host $hand $chan $chan1 activ.4 none
  9958. return 0
  9959. }
  9960. if {![validchan $chan]} {
  9961. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  9962. return 0
  9963. }
  9964. if {![onchan $botnick $chan]} {
  9965. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  9966. return 0
  9967. }
  9968. if {![validuser $user]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
  9969. return 0
  9970. }
  9971. if {![matchattr $user mn|OAVMS $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none
  9972. return 0
  9973. }
  9974. set dr [getuser $user XTRA DR($chan)]
  9975. set ban [getuser $user XTRA b($chan)]
  9976. set spam [getuser $user XTRA spam($chan)]
  9977. set badnick [getuser $user XTRA n($chan)]
  9978. set invite [getuser $user XTRA i($chan)]
  9979. set blacks [getuser $user XTRA Black($chan)]
  9980. set warn [getuser $user XTRA w($chan)]
  9981. set day [getuser $user XTRA d($chan)]
  9982. set kick [getuser $user XTRA k($chan)]
  9983. set stick [getuser $user XTRA stick($chan)]
  9984. set bw [getuser $user XTRA bw($chan)]
  9985. set bot [getuser $user XTRA bot($chan)]
  9986. if {$ban == ""} { set ban "0" }
  9987. if {$dr == ""} { set dr "0" }
  9988. if {$spam == ""} { set spam "0" }
  9989. if {$badnick == ""} { set badnick "0" }
  9990. if {$invite == ""} { set invite "0" }
  9991. if {$blacks == ""} { set blacks "0" }
  9992. if {$warn == ""} { set warn "0" }
  9993. if {$day == ""} { set day "0" }
  9994. if {$kick == ""} { set kick "0" }
  9995. if {$stick == ""} { set stick "0" }
  9996. if {$bw == ""} { set bw "0" }
  9997. if {$bot == ""} { set bot "0" }
  9998. if {[matchattr $user mn|AMS $chan]} {
  9999. blacktools:tell $nick $host $hand $chan $chan1 activ.5 $user
  10000. blacktools:tell $nick $host $hand $chan $chan1 activ.6 "12- $char(p)dr - 4($dr) | 12- $char(p)bot - 4($bot) | 12- $char(p)b - 4($ban) | 12- $char(p)spam - 4($spam) | 12- $char(p)n - 4($badnick) | 12- $char(p)i - 4($invite) | 12- $char(p)black - 4($blacks) | 12- $char(p)w - 4($warn) | 12- $char(p)d - 4($day) | 12- $char(p)k - 4($kick) | 12- $char(p)stick - 4($stick) | 12- $char(p)bw - 4($bw) ."
  10001. blacktools:tell $nick $host $hand $chan $chan1 activ.7 none
  10002. return 0
  10003. }
  10004. if {[matchattr $user -|O $chan]} {
  10005. blacktools:tell $nick $host $hand $chan $chan1 activ.8 $user
  10006. blacktools:tell $nick $host $hand $chan $chan1 activ.6 "12- $char(p)dr - 4($dr) | 12- $char(p)bot - 4($bot) | 12- $char(p)b - 4($ban) | 12- $char(p)spam - 4($spam) | 12- $char(p)n - 4($badnick) | 12- $char(p)i - 4($invite) | 12- $char(p)w - 4($warn) | 12- $char(p)k - 4($kick) | 12- $char(p)bw - 4($bw) ."
  10007. blacktools:tell $nick $host $hand $chan $chan1 activ.7 none
  10008. return 0
  10009. }
  10010. if {[matchattr $user -|V $chan]} {
  10011. blacktools:tell $nick $host $hand $chan $chan1 activ.9 $user
  10012. blacktools:tell $nick $host $hand $chan $chan1 activ.6 "12- $char(p)w - 4($warn) | 12- $char(p)k - 4($kick)"
  10013. blacktools:tell $nick $host $hand $chan $chan1 activ.7 none
  10014. return 0
  10015. }
  10016. }
  10017. proc addmyhostpublic {nick host hand chan arg} {
  10018. global black
  10019. set char(p) [lindex $black(cmdchar) 0]
  10020. if {[string match -nocase "$char(p)" "none"]} {
  10021. set char(p) ""
  10022. }
  10023. set chan1 "$chan"
  10024. set why [lindex [split $arg] 0]
  10025. if {$why == ""} { blacktools:tell $nick $host $hand $chan $chan1 addmyhost.1 none
  10026. return 0
  10027. }
  10028. addmyhost:process $nick $host $hand $chan $chan1 $why
  10029. }
  10030. proc addmyhost:process {nick host hand chan chan1 why} {
  10031. global botnick black
  10032. set char(p) [lindex $black(cmdchar) 0]
  10033. if {[string match -nocase "$char(p)" "none"]} {
  10034. set char(p) ""
  10035. }
  10036. set hhost [getuser $hand hosts]
  10037. foreach hhost $hhost {
  10038. if {[string match -nocase $hhost $why]} {
  10039. set foundhost 1
  10040. }
  10041. }
  10042. if {[info exists foundhost]} {
  10043. blacktools:tell $nick $host $hand $chan $chan1 addmyhost.3 $why
  10044. return 0
  10045. }
  10046. setuser $hand HOSTS $why
  10047. blacktools:tell $nick $host $hand $chan $chan1 addmyhost.4 $why
  10048. }
  10049. ############################## delmyhost ##########################
  10050. proc delmyhostpublic {nick host hand chan arg} {
  10051. global black
  10052. set chan1 "$chan"
  10053. set char(p) [lindex $black(cmdchar) 0]
  10054. if {[string match -nocase "$char(p)" "none"]} {
  10055. set char(p) ""
  10056. }
  10057. set why [lindex [split $arg] 0]
  10058. if {$why == ""} { blacktools:tell $nick $host $hand $chan $chan1 delmyhost.1 none
  10059. return 0
  10060. }
  10061. delmyhost:process $nick $host $hand $chan $chan1 $why
  10062. }
  10063. proc delmyhost:process {nick host hand chan chan1 why} {
  10064. global botnick black
  10065. set char(p) [lindex $black(cmdchar) 0]
  10066. if {[string match -nocase "$char(p)" "none"]} {
  10067. set char(p) ""
  10068. }
  10069. set hhost [getuser $hand hosts]
  10070. foreach hhost $hhost {
  10071. if {[string match -nocase $hhost $why]} {
  10072. set foundhost 1
  10073. }
  10074. }
  10075. if {![info exists foundhost]} {
  10076. blacktools:tell $nick $host $hand $chan $chan1 delmyhost.3 $why
  10077. return 0
  10078. }
  10079. delhost $hand $why
  10080. blacktools:tell $nick $host $hand $chan $chan1 delmyhost.4 $why
  10081. }
  10082. ######################## cc (channel created) #######################
  10083. proc createdpublic { from keyword arguments } {
  10084. set hand $::hand
  10085. set nick $::ccnick
  10086. set date [lindex [split $arguments] 2]
  10087. set dates [ctime $date]
  10088. blacktools:tell:prv $nick host $hand cc.3 $dates
  10089. unbind RAW - 329 createdpublic
  10090. }
  10091. proc nocreatedpublic { from keyword arguments } {
  10092. set hand $::hand
  10093. set nick $::ccnick
  10094. blacktools:tell:prv $nick host $hand cc.4 none
  10095. unbind RAW - 403 nocreatedpublic
  10096. }
  10097. proc ccpublic {nick host hand chan arg} {
  10098. global black
  10099. set ::ccnick $nick
  10100. set ::hand $hand
  10101. set chan1 "$chan"
  10102. set c [lindex [split $arg] 0]
  10103. set char(p) [lindex $black(cmdchar) 0]
  10104. if {[string match -nocase "$char(p)" "none"]} {
  10105. set char(p) ""
  10106. }
  10107. if {$c == ""} { blacktools:tell $nick $host $hand $chan $chan1 cc.1 none
  10108. return 0
  10109. }
  10110. if {![regexp {^[\\+!#&]} $c]} {
  10111. set c #$c
  10112. }
  10113. putquick "MODE $c"
  10114. bind raw - 329 createdpublic
  10115. bind raw - 403 nocreatedpublic
  10116. }
  10117. proc statspublic {nick host hand chan arg} {
  10118. global botnick black
  10119. set c [lindex [split $arg] 0]
  10120. set chan1 "$chan"
  10121. if {[regexp {^[#&]} $c] && [matchattr $hand nm|- $chan]} {
  10122. set chan "$c"
  10123. }
  10124. stats:process $nick $host $hand $chan $chan1
  10125. }
  10126. proc stats:process {nick host hand chan chan1} {
  10127. global botnick black statsdir
  10128. set ops 0
  10129. set numban 0
  10130. set voices 0
  10131. set numuser 0
  10132. set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
  10133. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  10134. set time [unixtime]
  10135. set file [open $statsdir "r"]
  10136. set database [read -nonewline $file]
  10137. set data [split $database "\n"]
  10138. foreach line $data {
  10139. set c [lindex [split $line] 0]
  10140. set type [lindex [split $line] 1]
  10141. if {[string match "ADDED" "$type"] && [string match -nocase $c $chan]} {
  10142. set foundchan 1
  10143. set chanadded 1
  10144. set awho [lindex [split $line] 2]
  10145. set ahost [lindex [split $line] 3]
  10146. set a1time [lindex [split $line] 4]
  10147. if {[regexp {^[0-9]} $a1time]} {
  10148. set duration [duration [expr [unixtime] - $a1time]]
  10149. } else { set duration "NONE" }
  10150. if {[regexp {^[0-9]} $a1time]} {
  10151. set atime [clock format $a1time -format %D-%H:%M:%S]
  10152. } else { set atime "NONE"}
  10153. set replace(%ahost%) $ahost
  10154. set replace(%atime%) $atime
  10155. set replace(%duration%) $duration
  10156. set replace(%awho%) $awho
  10157. lappend mes "[string map [array get replace] $black(say.$getlang.stats.1)]"
  10158. lappend mes1 "[string map [array get replace] $black(say.$getlang.stats.2)]"
  10159. }
  10160. if {[string match "REMOVED" "$type"] && [string match -nocase $c $chan]} {
  10161. set foundchan 1
  10162. set chanremoved 1
  10163. set rwho [lindex [split $line] 2]
  10164. set rhost [lindex [split $line] 3]
  10165. set rtime [lindex [split $line] 4]
  10166. set a1time [lindex [split $line] 5]
  10167. if {[regexp {^[0-9]} $a1time]} {
  10168. set duration [duration [expr [unixtime] - $a1time]]
  10169. } else { set duration "NONE" }
  10170. if {[regexp {^[0-9]} $a1time]} {
  10171. set atime [clock format $a1time -format %D-%H:%M:%S]
  10172. } else { set atime "NONE"}
  10173. if {[regexp {^[0-9]} $rtime]} {
  10174. set rtime [clock format $rtime -format %D-%H:%M:%S]
  10175. } else { set rtime "NONE" }
  10176. set awho [lindex [split $line] 6]
  10177. set ahost [lindex [split $line] 7]
  10178. set replace(%ahost%) $ahost
  10179. set replace(%atime%) $atime
  10180. set replace(%rtime%) $rtime
  10181. set replace(%duration%) $duration
  10182. set replace(%awho%) $awho
  10183. set replace(%rwho%) $rwho
  10184. set replace(%rhost%) $ahost
  10185. lappend mes "[string map [array get replace] $black(say.$getlang.stats.1)]"
  10186. lappend mes1 "[string map [array get replace] $black(say.$getlang.stats.3)]"
  10187. lappend mes2 "[string map [array get replace] $black(say.$getlang.stats.4)]"
  10188. }
  10189. }
  10190. if {![info exists foundchan]} {
  10191. blacktools:tell $nick $host $hand $chan $chan1 stats.5 none
  10192. return 0
  10193. }
  10194. if {[validchan $chan] && ([onchan $botnick $chan])} {
  10195. set numban [llength [banlist $chan]]
  10196. set numuser [llength [chanlist $chan]]
  10197. foreach user [chanlist $chan] {
  10198. if {[isop $user $chan] && (![isvoice $user $chan])} {
  10199. set ops [expr $ops +1]
  10200. }
  10201. if {[isvoice $user $chan]} {
  10202. set voices [expr $voices +1]
  10203. }
  10204. }
  10205. }
  10206. if {[info exists chanadded]} {
  10207. blacktools:tell $nick $host $hand $chan $chan1 stats.6 none
  10208. blacktools:tell $nick $host $hand $chan $chan1 stats.7 "[join $mes]"
  10209. if {![onchan $botnick $chan]} {
  10210. blacktools:tell $nick $host $hand $chan $chan1 stats.9 none
  10211. } else {
  10212. blacktools:tell $nick $host $hand $chan $chan1 stats.8 none
  10213. }
  10214. blacktools:tell $nick $host $hand $chan $chan1 stats.7 "[join $mes1]"
  10215. blacktools:tell $nick $host $hand $chan $chan1 stats.10 "$numuser $ops $voices $numban"
  10216. blacktools:tell $nick $host $hand $chan $chan1 stats.11 none
  10217. }
  10218. if {[info exists chanremoved]} {
  10219. blacktools:tell $nick $host $hand $chan $chan1 stats.6 none
  10220. blacktools:tell $nick $host $hand $chan $chan1 stats.7 "[join $mes]"
  10221. blacktools:tell $nick $host $hand $chan $chan1 stats.12 none
  10222. blacktools:tell $nick $host $hand $chan $chan1 stats.7 "[join $mes1]"
  10223. blacktools:tell $nick $host $hand $chan $chan1 stats.7 "[join $mes2]"
  10224. blacktools:tell $nick $host $hand $chan $chan1 stats.11 none
  10225. }
  10226. }
  10227. ####################### TopWords ####################################
  10228. proc topwordspublic {nick host hand chan arg} {
  10229. global black who username
  10230. set arg [split $arg]
  10231. if {![validchan $chan]} {
  10232. return 0
  10233. }
  10234. if {[channel get $chan topwords]} {
  10235. set lin 0
  10236. set wordsdir "logs/$username.$chan.words.db"
  10237. if {![file exists $wordsdir]} {
  10238. set file [open $wordsdir w]
  10239. close $file
  10240. }
  10241. set host "*!*@[lindex [split $host @] 1]"
  10242. set len($host) [llength $arg]
  10243. set words($host:$chan) $len($host)
  10244. if {[isbotnick $nick]} { return 0 }
  10245. set who "$chan $nick $host $words($host:$chan)"
  10246. set file [open $wordsdir "r"]
  10247. set database [read -nonewline $file]
  10248. close $file
  10249. set data [split $database "\n"]
  10250. foreach line $data {
  10251. set lin [expr $lin +1]
  10252. set hhost [lindex [split $line] 2]
  10253. set hscore [lindex [split $line] 3]
  10254. set chanentry [lindex [split $line] 0]
  10255. if {[string match -nocase $hhost $host] && [string match -nocase $chanentry $chan]} {
  10256. lappend current($hhost:$chan) $hscore
  10257. set who "$chan $nick $hhost [expr $words($host:$chan) + $current($hhost:$chan)]"
  10258. if {$line != ""} {
  10259. set num [expr $lin - 1]
  10260. set delete [lreplace $data $num $num]
  10261. set files [open $wordsdir "w"]
  10262. puts $files [join $delete "\n"]
  10263. close $files
  10264. }
  10265. }
  10266. }
  10267. set file [open $wordsdir "r"]
  10268. set data [read -nonewline $file]
  10269. close $file
  10270. if {$data == ""} {
  10271. set files [open $wordsdir "w"]
  10272. close $files
  10273. }
  10274. set file [open $wordsdir "a"]
  10275. puts $file "$who"
  10276. close $file
  10277. }
  10278. }
  10279. ################################## TOP ################################
  10280. proc toppublic {nick host hand chan arg} {
  10281. global black
  10282. set cmd [lindex [split $arg] 0]
  10283. set del [lindex [split $arg] 1]
  10284. set type 0
  10285. set chan1 "$chan"
  10286. if {[regexp {^[#&]} $cmd] && [matchattr $hand nm|- $chan]} {
  10287. set chan1 "$chan"
  10288. set chan "$cmd"
  10289. set cmd [lindex [split $arg] 1]
  10290. set del [lindex [split $arg] 2]
  10291. }
  10292. top:process $nick $host $hand $chan $chan1 $cmd $type $del
  10293. }
  10294. proc top:process {nick host hand chan chan1 cmd type del} {
  10295. global botnick black username
  10296. set max "20"
  10297. set i 0
  10298. set char(p) [lindex $black(cmdchar) 0]
  10299. if {[string match -nocase "$char(p)" "none"]} {
  10300. set char(p) ""
  10301. }
  10302. set list [userlist nm|OSVAM $chan]
  10303. set wordsdir "logs/$username.$chan.words.db"
  10304. if {![file exists $wordsdir]} {
  10305. set file [open $wordsdir w]
  10306. close $file
  10307. }
  10308. if {[matchattr $hand nm|- $chan]} {
  10309. if {($cmd == "") && ($type == "0")} {
  10310. blacktools:tell $nick $host $hand $chan $chan1 top.1 none
  10311. blacktools:tell $nick $host $hand $chan $chan1 top.2 none
  10312. return 0
  10313. }
  10314. if {($cmd == "") && ($type == "1")} {
  10315. blacktools:tell $nick $host $hand $chan $chan1 top.3 none
  10316. blacktools:tell $nick $host $hand $chan $chan1 top.4 none
  10317. return 0
  10318. }
  10319. }
  10320. if {($cmd == "") && ($type == "0")} {
  10321. blacktools:tell $nick $host $hand $chan $chan1 top.5 none
  10322. blacktools:tell $nick $host $hand $chan $chan1 top.6 none
  10323. return 0
  10324. }
  10325. if {($cmd == "") && ($type == "1")} {
  10326. blacktools:tell $nick $host $hand $chan $chan1 top.7 none
  10327. blacktools:tell $nick $host $hand $chan $chan1 top.8 none
  10328. return 0
  10329. }
  10330. if {![validchan $chan]} {
  10331. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  10332. return 0
  10333. }
  10334. if {![onchan $botnick $chan]} {
  10335. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  10336. return 0
  10337. }
  10338. switch -exact -- [string tolower $cmd] {
  10339. dr {
  10340. array set blacks [list]
  10341. set list [userlist nm|OSVAM $chan]
  10342. foreach user $list {
  10343. set b [getuser $user XTRA DR($chan)]
  10344. if {$b == ""} { set b 0 }
  10345. if {$b > 0} {
  10346. lappend blacks($b) $user
  10347. }
  10348. }
  10349. foreach blackq [lsort -integer -decreasing [array names blacks]] {
  10350. set i [expr $i +1]
  10351. lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
  10352. }
  10353. if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
  10354. return 0
  10355. }
  10356. blacktools:tell $nick $host $hand $chan $chan1 top.10 none
  10357. foreach txt [wordwrap [join $topblack " "] 300] {
  10358. blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
  10359. }
  10360. }
  10361. b {
  10362. array set blacks [list]
  10363. set list [userlist nm|OSVAM $chan]
  10364. foreach user $list {
  10365. set b [getuser $user XTRA b($chan)]
  10366. if {$b == ""} { set b 0 }
  10367. if {$b > 0} {
  10368. lappend blacks($b) $user
  10369. }
  10370. }
  10371. foreach blackq [lsort -integer -decreasing [array names blacks]] {
  10372. set i [expr $i +1]
  10373. lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
  10374. }
  10375. if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
  10376. return 0
  10377. }
  10378. blacktools:tell $nick $host $hand $chan $chan1 top.12 none
  10379. foreach txt [wordwrap [join $topblack " "] 300] {
  10380. blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
  10381. }
  10382. }
  10383. bot {
  10384. array set blacks [list]
  10385. set list [userlist nm|OSVAM $chan]
  10386. foreach user $list {
  10387. set b [getuser $user XTRA bot($chan)]
  10388. if {$b == ""} { set b 0 }
  10389. if {$b > 0} {
  10390. lappend blacks($b) $user
  10391. }
  10392. }
  10393. foreach blackq [lsort -integer -decreasing [array names blacks]] {
  10394. set i [expr $i +1]
  10395. lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
  10396. }
  10397. if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
  10398. return 0
  10399. }
  10400. blacktools:tell $nick $host $hand $chan $chan1 top.13 none
  10401. foreach txt [wordwrap [join $topblack " "] 300] {
  10402. blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
  10403. }
  10404. }
  10405. bw {
  10406. array set blacks [list]
  10407. set list [userlist nm|OSVAM $chan]
  10408. foreach user $list {
  10409. set b [getuser $user XTRA bw($chan)]
  10410. if {$b == ""} { set b 0 }
  10411. if {$b > 0} {
  10412. lappend blacks($b) $user
  10413. }
  10414. }
  10415. foreach blackq [lsort -integer -decreasing [array names blacks]] {
  10416. set i [expr $i +1]
  10417. lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
  10418. }
  10419. if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
  10420. return 0
  10421. }
  10422. blacktools:tell $nick $host $hand $chan $chan1 top.14 none
  10423. foreach txt [wordwrap [join $topblack " "] 300] {
  10424. blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
  10425. }
  10426. }
  10427. black {
  10428. array set blacks [list]
  10429. set list [userlist nm|OSVAM $chan]
  10430. foreach user $list {
  10431. set b [getuser $user XTRA Black($chan)]
  10432. if {$b == ""} { set b 0 }
  10433. if {$b > 0} {
  10434. lappend blacks($b) $user
  10435. }
  10436. }
  10437. foreach blackq [lsort -integer -decreasing [array names blacks]] {
  10438. set i [expr $i +1]
  10439. lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
  10440. }
  10441. if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
  10442. return 0
  10443. }
  10444. blacktools:tell $nick $host $hand $chan $chan1 top.15 none
  10445. foreach txt [wordwrap [join $topblack " "] 300] {
  10446. blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
  10447. }
  10448. }
  10449. spam {
  10450. array set blacks [list]
  10451. set list [userlist nm|OSVAM $chan]
  10452. foreach user $list {
  10453. set b [getuser $user XTRA spam($chan)]
  10454. if {$b == ""} { set b 0 }
  10455. if {$b > 0} {
  10456. lappend blacks($b) $user
  10457. }
  10458. }
  10459. foreach blackq [lsort -integer -decreasing [array names blacks]] {
  10460. set i [expr $i +1]
  10461. lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
  10462. }
  10463. if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
  10464. return 0
  10465. }
  10466. blacktools:tell $nick $host $hand $chan $chan1 top.16 none
  10467. foreach txt [wordwrap [join $topblack " "] 300] {
  10468. blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
  10469. }
  10470. }
  10471. stick {
  10472. array set blacks [list]
  10473. set list [userlist nm|OSVAM $chan]
  10474. foreach user $list {
  10475. set b [getuser $user XTRA stick($chan)]
  10476. if {$b == ""} { set b 0 }
  10477. if {$b > 0} {
  10478. lappend blacks($b) $user
  10479. }
  10480. }
  10481. foreach blackq [lsort -integer -decreasing [array names blacks]] {
  10482. set i [expr $i +1]
  10483. lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
  10484. }
  10485. if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
  10486. return 0
  10487. }
  10488. blacktools:tell $nick $host $hand $chan $chan1 top.17 none
  10489. foreach txt [wordwrap [join $topblack " "] 300] {
  10490. blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
  10491. }
  10492. }
  10493. n {
  10494. array set blacks [list]
  10495. set list [userlist nm|OSVAM $chan]
  10496. foreach user $list {
  10497. set b [getuser $user XTRA n($chan)]
  10498. if {$b == ""} { set b 0 }
  10499. if {$b > 0} {
  10500. lappend blacks($b) $user
  10501. }
  10502. }
  10503. foreach blackq [lsort -integer -decreasing [array names blacks]] {
  10504. set i [expr $i +1]
  10505. lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
  10506. }
  10507. if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
  10508. return 0
  10509. }
  10510. blacktools:tell $nick $host $hand $chan $chan1 top.18 none
  10511. foreach txt [wordwrap [join $topblack " "] 300] {
  10512. blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
  10513. }
  10514. }
  10515. i {
  10516. array set blacks [list]
  10517. set list [userlist nm|OSVAM $chan]
  10518. foreach user $list {
  10519. set b [getuser $user XTRA i($chan)]
  10520. if {$b == ""} { set b 0 }
  10521. if {$b > 0} {
  10522. lappend blacks($b) $user
  10523. }
  10524. }
  10525. foreach blackq [lsort -integer -decreasing [array names blacks]] {
  10526. set i [expr $i +1]
  10527. lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
  10528. }
  10529. if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
  10530. return 0
  10531. }
  10532. blacktools:tell $nick $host $hand $chan $chan1 top.19 none
  10533. foreach txt [wordwrap [join $topblack " "] 300] {
  10534. blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
  10535. }
  10536. }
  10537. k {
  10538. array set blacks [list]
  10539. set list [userlist nm|OSVAM $chan]
  10540. foreach user $list {
  10541. set b [getuser $user XTRA k($chan)]
  10542. if {$b == ""} { set b 0 }
  10543. if {$b > 0} {
  10544. lappend blacks($b) $user
  10545. }
  10546. }
  10547. foreach blackq [lsort -integer -decreasing [array names blacks]] {
  10548. set i [expr $i +1]
  10549. lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
  10550. }
  10551. if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
  10552. return 0
  10553. }
  10554. blacktools:tell $nick $host $hand $chan $chan1 top.20 none
  10555. foreach txt [wordwrap [join $topblack " "] 300] {
  10556. blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
  10557. }
  10558. }
  10559. w {
  10560. array set blacks [list]
  10561. set list [userlist nm|OSVAM $chan]
  10562. foreach user $list {
  10563. set b [getuser $user XTRA w($chan)]
  10564. if {$b == ""} { set b 0 }
  10565. if {$b > 0} {
  10566. lappend blacks($b) $user
  10567. }
  10568. }
  10569. foreach blackq [lsort -integer -decreasing [array names blacks]] {
  10570. set i [expr $i +1]
  10571. lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
  10572. }
  10573. if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
  10574. return 0
  10575. }
  10576. blacktools:tell $nick $host $hand $chan $chan1 top.21 none
  10577. foreach txt [wordwrap [join $topblack " "] 300] {
  10578. blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
  10579. }
  10580. }
  10581. d {
  10582. array set blacks [list]
  10583. set list [userlist nm|OSVAM $chan]
  10584. foreach user $list {
  10585. set b [getuser $user XTRA d($chan)]
  10586. if {$b == ""} { set b 0 }
  10587. if {$b > 0} {
  10588. lappend blacks($b) $user
  10589. }
  10590. }
  10591. foreach blackq [lsort -integer -decreasing [array names blacks]] {
  10592. set i [expr $i +1]
  10593. lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
  10594. }
  10595. if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
  10596. return 0
  10597. }
  10598. blacktools:tell $nick $host $hand $chan $chan1 top.22 none
  10599. foreach txt [wordwrap [join $topblack " "] 300] {
  10600. blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
  10601. }
  10602. }
  10603. words {
  10604. array set topw [list]
  10605. if {![channel get $chan topwords]} {
  10606. blacktools:tell $nick $host $hand $chan $chan1 top.23 none
  10607. return 0
  10608. }
  10609. if {[string match -nocase $del "erase"] && [matchattr $hand nm|M $chan]} {
  10610. blacktools:tell $nick $host $hand $chan $chan1 top.24 none
  10611. set file [open $wordsdir "w"]
  10612. close $file
  10613. return 0
  10614. }
  10615. set file [open $wordsdir "r"]
  10616. set database [read -nonewline $file]
  10617. close $file
  10618. if {$database == ""} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
  10619. return 0
  10620. }
  10621. set data [split $database "\n"]
  10622. foreach line $data {
  10623. set hhost [lindex [split $line] 2]
  10624. set hentry [lindex [split $line] 1]
  10625. set chanentry [lindex [split $line] 0]
  10626. set tw [lindex [split $line] 3]
  10627. if {[string match -nocase $chanentry $chan]} {
  10628. lappend topw($tw) $hentry
  10629. }
  10630. }
  10631. foreach twords [lsort -integer -decreasing [array names topw]] {
  10632. set i [expr $i +1]
  10633. if {!($i > $max)} {
  10634. lappend topwo 1- $i - : 1[join $topw($twords) ,] 12($twords) |
  10635. }
  10636. }
  10637. if {![info exists topwo]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
  10638. return 0
  10639. }
  10640. blacktools:tell $nick $host $hand $chan $chan1 top.25 $max
  10641. foreach txt [wordwrap [join $topwo " "] 300] {
  10642. blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
  10643. }
  10644. }
  10645. }
  10646. }
  10647. proc securepublic {nick host hand chan arg} {
  10648. global black
  10649. set what [lindex [split $arg] 0]
  10650. set type 0
  10651. set chan1 "$chan"
  10652. if {[regexp {^[#&]} $what] && [matchattr $hand nm|- $chan]} {
  10653. set chan "$what"
  10654. set what [lindex [split $arg] 1]
  10655. }
  10656. secure:process $nick $host $hand $chan $chan1 $what $type
  10657. }
  10658. proc secure:process {nick host hand chan chan1 what type} {
  10659. global botnick black
  10660. set char(p) [lindex $black(cmdchar) 0]
  10661. if {[string match -nocase "$char(p)" "none"]} {
  10662. set char(p) ""
  10663. }
  10664. if {[matchattr $hand nm|- $chan]} {
  10665. if {($what == "") && ($type == "0")} {
  10666. blacktools:tell $nick $host $hand $chan $chan1 secure.1 none
  10667. return 0
  10668. }
  10669. if {($what == "") && ($type == "1")} {
  10670. blacktools:tell $nick $host $hand $chan $chan1 secure.2 none
  10671. return 0
  10672. }
  10673. }
  10674. if {($what == "") && ($type == "0")} {
  10675. blacktools:tell $nick $host $hand $chan $chan1 secure.3 none
  10676. return 0
  10677. }
  10678. if {($what == "") && ($type == "1")} {
  10679. blacktools:tell $nick $host $hand $chan $chan1 secure.4 none
  10680. return 0
  10681. }
  10682. if {![validchan $chan]} {
  10683. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  10684. return 0
  10685. }
  10686. if {![onchan $botnick $chan]} {
  10687. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  10688. return 0
  10689. }
  10690. if {[string match -nocase "$what" "on"]} {
  10691. set char(a) "+"
  10692. channel set $chan $char(a)antipub ; channel set $chan $char(a)antinotice ; channel set $chan $char(a)antictcp ; channel set $chan $char(a)antibadword ; channel set $chan $char(a)antibadword ; channel set $chan $char(a)antilongtext ; channel set $chan $char(a)badquitpart ; channel set $chan $char(a)antijoinpart ; channel set $chan $char(a)antispam ; channel set $chan $char(a)antirepeat ; channel set $chan $char(a)anticolor ; channel set $chan $char(a)antibold ; channel set $chan $char(a)antiunderline ; channel set $chan $char(a)anticaps ; channel set $chan $char(a)badnick ; channel set $chan $char(a)badfullname ; channel set $chan $char(a)antijoinflood ; channel set $chan $char(a)antichanflood ; channel set $chan $char(a)badident
  10693. blacktools:tell $nick $host $hand $chan $chan1 secure.5 none
  10694. }
  10695. if {[string match -nocase "$what" "off"]} {
  10696. set char(a) "-"
  10697. channel set $chan $char(a)antipub ; channel set $chan $char(a)antinotice ; channel set $chan $char(a)antictcp ; channel set $chan $char(a)antibadword ; channel set $chan $char(a)antibadword ; channel set $chan $char(a)antilongtext ; channel set $chan $char(a)badquitpart ; channel set $chan $char(a)antijoinpart ; channel set $chan $char(a)antispam ; channel set $chan $char(a)antirepeat ; channel set $chan $char(a)anticolor ; channel set $chan $char(a)antibold ; channel set $chan $char(a)antiunderline ; channel set $chan $char(a)anticaps ; channel set $chan $char(a)badnick ; channel set $chan $char(a)badfullname ; channel set $chan $char(a)antijoinflood ; channel set $chan $char(a)antichanflood ; channel set $chan $char(a)badident
  10698. blacktools:tell $nick $host $hand $chan $chan1 secure.6 none
  10699. }
  10700. }
  10701. proc hpublic {nick host hand chan arg} {
  10702. global black botnick
  10703. set chan1 "$chan"
  10704. set command [lindex [split $arg] 0]
  10705. h:process $nick $host $hand $chan $chan1 $command
  10706. }
  10707. proc h:process {nick host hand chan chan1 command} {
  10708. global black botnick
  10709. set char(p) [lindex $black(cmdchar) 0]
  10710. if {[string match -nocase "$char(p)" "none"]} {
  10711. set char(p) ""
  10712. }
  10713. set replace(%chan%) $chan
  10714. set replace(%char%) $char(p)
  10715. set greeting [getuser $hand XTRA GREET]
  10716. set chanlang [string tolower [channel get $chan lang]]
  10717. if {$chanlang == ""} { set chanlang "[string tolower $black(default_lang)]" }
  10718. if {$greeting == ""} {
  10719. putserv "PRIVMSG $nick :[string map [array get replace] $black(say.$chanlang.greeting.1)]"
  10720. putserv "PRIVMSG $nick :[string map [array get replace] $black(say.$chanlang.greeting.2)]"
  10721. putserv "PRIVMSG $nick :[string map [array get replace] $black(say.$chanlang.greeting.3)]"
  10722. putserv "PRIVMSG $nick :[string map [array get replace] $black(say.$chanlang.greeting.4)]"
  10723. setuser $hand XTRA GREET 1
  10724. return 0
  10725. }
  10726. set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
  10727. set replace(%char%) "$char(p)"
  10728. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  10729. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  10730. return 0
  10731. }
  10732. if {$command == ""} {
  10733. if {[matchattr $hand n|- $chan]} {
  10734. blacktools:tell $nick $host $hand $chan $chan1 h.1 none
  10735. blacktools:tell $nick $host $hand $chan $chan1 h.2 none
  10736. return 0
  10737. }
  10738. if {[matchattr $hand m|- $chan]} {
  10739. blacktools:tell $nick $host $hand $chan $chan1 h.3 none
  10740. blacktools:tell $nick $host $hand $chan $chan1 h.4 none
  10741. return 0
  10742. }
  10743. if {[matchattr $hand -|V $chan]} {
  10744. blacktools:tell $nick $host $hand $chan $chan1 h.5 none
  10745. blacktools:tell $nick $host $hand $chan $chan1 h.6 none
  10746. return 0
  10747. }
  10748. if {[matchattr $hand -|O $chan]} {
  10749. blacktools:tell $nick $host $hand $chan $chan1 h.7 none
  10750. blacktools:tell $nick $host $hand $chan $chan1 h.8 none
  10751. return 0
  10752. }
  10753. if {[matchattr $hand -|S $chan]} {
  10754. blacktools:tell $nick $host $hand $chan $chan1 h.9 none
  10755. blacktools:tell $nick $host $hand $chan $chan1 h.10 none
  10756. return 0
  10757. }
  10758. if {[matchattr $hand -|A $chan]} {
  10759. blacktools:tell $nick $host $hand $chan $chan1 h.11 none
  10760. blacktools:tell $nick $host $hand $chan $chan1 h.12 none
  10761. return 0
  10762. }
  10763. if {[matchattr $hand -|M $chan]} {
  10764. blacktools:tell $nick $host $hand $chan $chan1 h.13 none
  10765. blacktools:tell $nick $host $hand $chan $chan1 h.14 none
  10766. return 0
  10767. }
  10768. return 0
  10769. }
  10770. switch -exact -- [string tolower $command] {
  10771. cmds {
  10772. if {[matchattr $hand -|V $chan]} {
  10773. blacktools:tell $nick $host $hand $chan $chan1 cmdsvoice none
  10774. return 0
  10775. }
  10776. if {[matchattr $hand -|O $chan]} {
  10777. foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.cmdsop)] " "] 300] {
  10778. blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
  10779. }
  10780. return 0
  10781. }
  10782. if {[matchattr $hand -|S $chan]} {
  10783. foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.cmdsenior)] " "] 300] {
  10784. blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
  10785. }
  10786. return 0
  10787. }
  10788. if {[matchattr $hand -|A $chan]} {
  10789. foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.cmdadmin)] " "] 300] {
  10790. blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
  10791. b
  10792. }
  10793. return 0
  10794. }
  10795. if {[matchattr $hand -|M $chan]} {
  10796. foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.cmdmanager)] " "] 300] {
  10797. blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
  10798. }
  10799. return 0
  10800. }
  10801. if {[matchattr $hand n|- $chan]} {
  10802. foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.cmdbossowner)] " "] 300] {
  10803. blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
  10804. }
  10805. return 0
  10806. }
  10807. if {[matchattr $hand m|- $chan]} {
  10808. foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.cmdowner)] " "] 300] {
  10809. blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
  10810. }
  10811. return 0
  10812. }
  10813. }
  10814. ban {
  10815. if {[matchattr $hand -|V $chan]} {
  10816. foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.banvoice)] " "] 450] {
  10817. blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
  10818. }
  10819. return 0
  10820. }
  10821. if {[matchattr $hand -|O $chan]} {
  10822. foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.banop)] " "] 300] {
  10823. blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
  10824. }
  10825. return 0
  10826. }
  10827. if {[matchattr $hand -|S $chan]} {
  10828. foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.bansenior)] " "] 300] {
  10829. blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
  10830. }
  10831. return 0
  10832. }
  10833. if {[matchattr $hand -|A $chan]} {
  10834. foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.banadmin)] " "] 300] {
  10835. blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
  10836. }
  10837. return 0
  10838. }
  10839. if {[matchattr $hand -|M $chan]} {
  10840. foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.banmanager)] " "] 300] {
  10841. blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
  10842. }
  10843. return 0
  10844. }
  10845. if {[matchattr $hand n|- $chan]} {
  10846. foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.banbossowner)] " "] 380] {
  10847. blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
  10848. }
  10849. return 0
  10850. }
  10851. if {[matchattr $hand m|- $chan]} {
  10852. foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.banowner)] " "] 380] {
  10853. blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
  10854. }
  10855. return 0
  10856. }
  10857. }
  10858. add {
  10859. if {[matchattr $hand -|A $chan]} {
  10860. blacktools:tell $nick $host $hand $chan $chan1 addadmin none
  10861. return 0
  10862. }
  10863. if {[matchattr $hand -|M $chan]} {
  10864. blacktools:tell $nick $host $hand $chan $chan1 addmanager none
  10865. return 0
  10866. }
  10867. if {[matchattr $hand n|- $chan]} {
  10868. blacktools:tell $nick $host $hand $chan $chan1 addbossowner none
  10869. return 0
  10870. }
  10871. if {[matchattr $hand m|- $chan]} {
  10872. blacktools:tell $nick $host $hand $chan $chan1 addowner none
  10873. return 0
  10874. }
  10875. }
  10876. modif {
  10877. if {[matchattr $hand -|A $chan]} {
  10878. blacktools:tell $nick $host $hand $chan $chan1 modifadmin none
  10879. return 0
  10880. }
  10881. if {[matchattr $hand -|M $chan]} {
  10882. blacktools:tell $nick $host $hand $chan $chan1 modifmanager none
  10883. return 0
  10884. }
  10885. if {[matchattr $hand n|- $chan]} {
  10886. blacktools:tell $nick $host $hand $chan $chan1 modifbossowner none
  10887. return 0
  10888. }
  10889. if {[matchattr $hand m|- $chan]} {
  10890. blacktools:tell $nick $host $hand $chan $chan1 modifowner none
  10891. return 0
  10892. }
  10893. }
  10894. owner {
  10895. if {[matchattr $hand nm|- $chan]} {
  10896. foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.howner)] " "] 390] {
  10897. blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
  10898. }
  10899. }
  10900. }
  10901. top {
  10902. if {[matchattr $hand nm|MASOV $chan]} {
  10903. blacktools:tell $nick $host $hand $chan $chan1 htop $nick
  10904. }
  10905. }
  10906. blacktools {
  10907. if {[matchattr $hand nm|M $chan]} {
  10908. if {[channel get $chan antipub]} { set pubstatus "+antipub" } else { set pubstatus "-antipub" }
  10909. if {[channel get $chan antinotice]} { set noticestatus "+antinotice" } else { set noticestatus "-antinotice" }
  10910. if {[channel get $chan antictcp]} { set ctcpstatus "+antictcp" } else { set ctcpstatus "-antictcp" }
  10911. if {[channel get $chan antibadword]} { set badwordstatus "+antibadword" } else { set badwordstatus "-antibadword" }
  10912. if {[channel get $chan antilongtext]} { set longtextstatus "+antilongtext" } else { set longtextstatus "-antilongtext" }
  10913. if {[channel get $chan badquitpart]} { set badquitpartstatus "+badquitpart" } else { set badquitpartstatus "-badquitpart" }
  10914. if {[channel get $chan antijoinpart]} { set joinpartstatus "+antijoinpart" } else { set joinpartstatus "-antijoinpart" }
  10915. if {[channel get $chan antispam]} { set antispamstatus "+antispam" } else { set antispamstatus "-antispam" }
  10916. if {[channel get $chan antirepeat]} { set repeatstatus "+antirepeat" } else { set repeatstatus "-antirepeat" }
  10917. if {[channel get $chan anticolor]} { set colorstatus "+anticolor" } else { set colorstatus "-anticolor" }
  10918. if {[channel get $chan antibold]} { set boldstatus "+antibold" } else { set boldstatus "-antibold" }
  10919. if {[channel get $chan antiunderline]} { set underlinestatus "+antiunderline" } else { set underlinestatus "-antiunderline" }
  10920. if {[channel get $chan anticaps]} { set capsstatus "+anticaps" } else { set capsstatus "-anticaps" }
  10921. if {[channel get $chan badnick]} { set nickstatus "+badnick" } else { set nickstatus "-badnick" }
  10922. if {[channel get $chan badfullname]} { set fullnamestatus "+badfullname" } else { set fullnamestatus "-badfullname" }
  10923. if {[channel get $chan autoop]} { set opstatus "+autoop" } else { set opstatus "-autoop" }
  10924. if {[channel get $chan autovoice]} { set voicestatus "+autovoice" } else { set voicestatus "-autovoice" }
  10925. if {[channel get $chan antijoinflood]} { set joinfloodstatus "+antijoinflood" } else { set joinfloodstatus "-antijoinflood" }
  10926. if {[channel get $chan antichanflood]} { set chanfloodstatus "+antichanflood" } else { set chanfloodstatus "-antichanflood" }
  10927. if {[channel get $chan badident]} { set badidentstatus "+badident" } else { set badidentstatus "-badident" }
  10928. set xbantime [channel get $chan xbantime]
  10929. if {$xbantime == "0"} { set xbantime 1 }
  10930. set xbanlevel [channel get $chan xbanlevel]
  10931. if {$xbanlevel == "0"} { set xbanlevel 100 }
  10932. blacktools:tell $nick $host $hand $chan $chan1 hblacktools.1 "1$pubstatus | 4$noticestatus | 1$ctcpstatus | 4$badwordstatus | 1$longtextstatus | 4$badquitpartstatus | 1$joinpartstatus | 4$antispamstatus | 1$repeatstatus | 4$colorstatus | 1$boldstatus | 4$underlinestatus | 1$capsstatus | 4$nickstatus | 1$fullnamestatus | 4$opstatus | 1$voicestatus | 4$joinfloodstatus | 1$chanfloodstatus | 4$badidentstatus | 1xbantime $xbantime | 4xbanlevel $xbanlevel."
  10933. blacktools:tell $nick $host $hand $chan $chan1 hblacktools.2 none
  10934. }
  10935. }
  10936. standard {
  10937. if {[matchattr $hand nm|M $chan]} {
  10938. if {[channel get $chan protectops]} { set protectops "+protectops" } else { set protectops "-protectops" }
  10939. if {[channel get $chan bitch]} { set bitch "+bitch" } else { set bitch "-bitch" }
  10940. if {[channel get $chan enforcebans]} { set enforcebans "+enforcebans" } else { set enforcebans "-enforcebans" }
  10941. if {[channel get $chan protecthalfops]} { set protecthalfops "+protecthalfops" } else { set protecthalfops "-protecthalfops" }
  10942. if {[channel get $chan protectfriends]} { set protectfriends "+protectfriends" } else { set protectfriends "-protectfriends" }
  10943. if {[channel get $chan dynamicbans]} { set dynamicbans "+dynamicbans" } else { set dynamicbans "-dynamicbans" }
  10944. if {[channel get $chan dontkickops]} { set dontkickops "+dontkickops" } else { set dontkickops "-dontkickops" }
  10945. if {[channel get $chan nodesynch]} { set nodesynch "+nodesynch" } else { set nodesynch "-nodesynch" }
  10946. if {[channel get $chan dynamicbans]} { set noticestatus "+dynamicbans" } else { set dynamicbans "-dynamicbans" }
  10947. set bantime [channel get $chan ban-time]
  10948. set floodchan [channel get $chan flood-chan]
  10949. set floodjoin [channel get $chan flood-join]
  10950. set floodkick [channel get $chan flood-kick]
  10951. set floodctcp [channel get $chan flood-ctcp]
  10952. set floodnick [channel get $chan flood-nick]
  10953. set flooddeop [channel get $chan flood-deop]
  10954. set chanmode [channel get $chan chanmode]
  10955. blacktools:tell $nick $host $hand $chan $chan1 hstandard.1 none
  10956. blacktools:tell $nick $host $hand $chan $chan1 hstandard.3 "1$protectops 4$bitch 1$enforcebans 4$protecthalfops 1$protectfriends 4$dynamicbans 1$dontkickops 4$nodesynch"
  10957. blacktools:tell $nick $host $hand $chan $chan1 hstandard.3 "12Flood-Chan :1 $floodchan  12Flood-join :4 $floodjoin  12Flood-Kick :1 $floodkick  12Flood-Ctcp :4 $floodctcp  12Flood-Nick :1 $floodnick  12Flood-Deop :4 $flooddeop "
  10958. blacktools:tell $nick $host $hand $chan $chan1 hstandard.3 "12ChanMode :1$chanmode 12Ban-Time :1 $bantime "
  10959. blacktools:tell $nick $host $hand $chan $chan1 hstandard.2 none
  10960. }
  10961. }
  10962. chaninfo {
  10963. if {[matchattr $hand nm|M $chan]} {
  10964. blacktools:tell $nick $host $hand $chan $chan1 hchaninfo.1 none
  10965. blacktools:tell $nick $host $hand $chan $chan1 hchaninfo.2 none
  10966. blacktools:tell $nick $host $hand $chan $chan1 hchaninfo.3 none
  10967. blacktools:tell $nick $host $hand $chan $chan1 hchaninfo.4 none
  10968. blacktools:tell $nick $host $hand $chan $chan1 hchaninfo.5 none
  10969. }
  10970. }
  10971. module {
  10972. if {[matchattr $hand nm|- $chan]} {
  10973. blacktools:tell $nick $host $hand $chan $chan1 hmodule.1 none
  10974. } else { blacktools:tell $nick $host $hand $chan $chan1 hmodule.2 none }
  10975. blacktools:tell $nick $host $hand $chan $chan1 hmodule.3 none
  10976. }
  10977. antitake {
  10978. if {[matchattr $hand nm|M $chan]} {
  10979. blacktools:tell $nick $host $hand $chan $chan1 hantitake.1 none
  10980. blacktools:tell $nick $host $hand $chan $chan1 hantitake.2 none
  10981. blacktools:tell $nick $host $hand $chan $chan1 hantitake.3 none
  10982. blacktools:tell $nick $host $hand $chan $chan1 hantitake.4 none
  10983. }
  10984. }
  10985. private {
  10986. if {[matchattr $hand nm|M $chan]} {
  10987. blacktools:tell $nick $host $hand $chan $chan1 hprivate.1 none
  10988. blacktools:tell $nick $host $hand $chan $chan1 hprivate.2 none
  10989. }
  10990. }
  10991. language {
  10992. if {[matchattr $hand nm|M $chan]} {
  10993. blacktools:tell $nick $host $hand $chan $chan1 hlanguage.1 none
  10994. blacktools:tell $nick $host $hand $chan $chan1 hlanguage.2 none
  10995. blacktools:tell $nick $host $hand $chan $chan1 hlanguage.3 none
  10996. }
  10997. }
  10998. xban {
  10999. set xbantime [channel get $chan xbantime]
  11000. if {$xbantime == "0"} { set xbantime 1 }
  11001. set xlevel [channel get $chan xbanlevel]
  11002. if {$xlevel == "0"} { set xlevel 100 }
  11003. if {[matchattr $hand nm|- $chan]} {
  11004. blacktools:tell $nick $host $hand $chan $chan1 hxban.1 none
  11005. blacktools:tell $nick $host $hand $chan $chan1 hxban.2 none
  11006. blacktools:tell $nick $host $hand $chan $chan1 hxban.3 "$xbantime $xlevel"
  11007. }
  11008. }
  11009. topicrefresh {
  11010. if {[matchattr $hand nm|M $chan]} {
  11011. blacktools:tell $nick $host $hand $chan $chan1 htopicrefresh.1 none
  11012. blacktools:tell $nick $host $hand $chan $chan1 htopicrefresh.2 none
  11013. }
  11014. }
  11015. count {
  11016. if {[matchattr $hand nm|M $chan]} {
  11017. blacktools:tell $nick $host $hand $chan $chan1 hcount.1 none
  11018. blacktools:tell $nick $host $hand $chan $chan1 hcount.2 none
  11019. }
  11020. }
  11021. xtools {
  11022. if {[matchattr $hand nm|M $chan]} {
  11023. blacktools:tell $nick $host $hand $chan $chan1 hxtools.1 none
  11024. blacktools:tell $nick $host $hand $chan $chan1 hxtools.2 none
  11025. }
  11026. }
  11027. badchan {
  11028. if {[matchattr $hand nm|M $chan]} {
  11029. blacktools:tell $nick $host $hand $chan $chan1 hbadchan.1 none
  11030. blacktools:tell $nick $host $hand $chan $chan1 hbadchan.2 none
  11031. }
  11032. }
  11033. badword {
  11034. if {[matchattr $hand nm|M $chan]} {
  11035. blacktools:tell $nick $host $hand $chan $chan1 hbadword.1 none
  11036. blacktools:tell $nick $host $hand $chan $chan1 hbadword.2 none
  11037. }
  11038. }
  11039. anunt {
  11040. if {[matchattr $hand nm|M $chan]} {
  11041. blacktools:tell $nick $host $hand $chan $chan1 hanunt.1 $black(anunttime)
  11042. blacktools:tell $nick $host $hand $chan $chan1 hanunt.2 none
  11043. }
  11044. }
  11045. autobroadcast {
  11046. if {[matchattr $hand nm|M $chan]} {
  11047. blacktools:tell $nick $host $hand $chan $chan1 hautobroadcast.1 $black(bttime)
  11048. blacktools:tell $nick $host $hand $chan $chan1 hautobroadcast.2 none
  11049. blacktools:tell $nick $host $hand $chan $chan1 hautobroadcast.3 none
  11050. }
  11051. }
  11052. antibotidle {
  11053. if {[matchattr $hand nm|M $chan]} {
  11054. blacktools:tell $nick $host $hand $chan $chan1 hantibotidle.1 none
  11055. blacktools:tell $nick $host $hand $chan $chan1 hantibotidle.2 $black(noidlemax)
  11056. }
  11057. }
  11058. limit {
  11059. if {[matchattr $hand nm|M $chan]} {
  11060. blacktools:tell $nick $host $hand $chan $chan1 hlimit.1 none
  11061. blacktools:tell $nick $host $hand $chan $chan1 hlimit.2 none
  11062. }
  11063. }
  11064. topic {
  11065. if {[matchattr $hand nm|M $chan]} {
  11066. blacktools:tell $nick $host $hand $chan $chan1 htopic.1 none
  11067. blacktools:tell $nick $host $hand $chan $chan1 htopic.2 none
  11068. }
  11069. }
  11070. seen {
  11071. if {[matchattr $hand nm|M $chan]} {
  11072. blacktools:tell $nick $host $hand $chan $chan1 hseen.1 none
  11073. blacktools:tell $nick $host $hand $chan $chan1 hseen.2 none
  11074. }
  11075. }
  11076. clonescan {
  11077. if {[matchattr $hand nm|M $chan]} {
  11078. blacktools:tell $nick $host $hand $chan $chan1 hclonescan.1 none
  11079. blacktools:tell $nick $host $hand $chan $chan1 hclonescan.2 none
  11080. blacktools:tell $nick $host $hand $chan $chan1 hclonescan.3 none
  11081. }
  11082. }
  11083. greet {
  11084. if {[matchattr $hand nm|M $chan]} {
  11085. blacktools:tell $nick $host $hand $chan $chan1 hgreet.1 none
  11086. blacktools:tell $nick $host $hand $chan $chan1 hgreet.2 none
  11087. }
  11088. }
  11089. leave {
  11090. if {[matchattr $hand nm|M $chan]} {
  11091. blacktools:tell $nick $host $hand $chan $chan1 hleave.1 none
  11092. blacktools:tell $nick $host $hand $chan $chan1 hleave.2 none
  11093. }
  11094. }
  11095. idle {
  11096. if {[matchattr $hand nm|M $chan]} {
  11097. blacktools:tell $nick $host $hand $chan $chan1 hidle.1 none
  11098. blacktools:tell $nick $host $hand $chan $chan1 hidle.2 none
  11099. }
  11100. }
  11101. chanreport {
  11102. if {[matchattr $hand nm|- $chan]} {
  11103. blacktools:tell $nick $host $hand $chan $chan1 hchanreport.1 none
  11104. blacktools:tell $nick $host $hand $chan $chan1 hchanreport.2 none
  11105. blacktools:tell $nick $host $hand $chan $chan1 hchanreport.3 none
  11106. }
  11107. }
  11108. topwords {
  11109. if {[matchattr $hand nm|M $chan]} {
  11110. blacktools:tell $nick $host $hand $chan $chan1 htopwords.1 none
  11111. blacktools:tell $nick $host $hand $chan $chan1 htopwords.2 none
  11112. blacktools:tell $nick $host $hand $chan $chan1 htopwords.3 none
  11113. }
  11114. }
  11115. settings {
  11116. if {[matchattr $hand nm|M $chan]} {
  11117. blacktools:tell $nick $host $hand $chan $chan1 hsettings.1 none
  11118. blacktools:tell $nick $host $hand $chan $chan1 hsettings.2 none
  11119. blacktools:tell $nick $host $hand $chan $chan1 hsettings.3 none
  11120. blacktools:tell $nick $host $hand $chan $chan1 hsettings.4 none
  11121. blacktools:tell $nick $host $hand $chan $chan1 hsettings.5 none
  11122. blacktools:tell $nick $host $hand $chan $chan1 hsettings.6 none
  11123. }
  11124. }
  11125. reason {
  11126. if {[matchattr $hand nm|M $chan]} {
  11127. if {[channel get $chan showhandle]} { set showhandle "+showhandle" } else { set showhandle "-showhandle" }
  11128. if {[channel get $chan showcount]} { set showcount "+showcount" } else { set showcount "-showcount" }
  11129. if {[channel get $chan showtime]} { set showtime "+showtime" } else { set showtime "-showtime" }
  11130. blacktools:tell $nick $host $hand $chan $chan1 hreason.1 none
  11131. blacktools:tell $nick $host $hand $chan $chan1 hreason.2 "$showhandle $showcount $showtime"
  11132. blacktools:tell $nick $host $hand $chan $chan1 hreason.3 none
  11133. blacktools:tell $nick $host $hand $chan $chan1 hreason.4 none
  11134. blacktools:tell $nick $host $hand $chan $chan1 hreason.5 none
  11135. blacktools:tell $nick $host $hand $chan $chan1 hreason.6 none
  11136. }
  11137. }
  11138. extra {
  11139. if {[matchattr $hand nm|M $chan]} {
  11140. blacktools:tell $nick $host $hand $chan $chan1 hextra.1 none
  11141. blacktools:tell $nick $host $hand $chan $chan1 hextra.2 none
  11142. blacktools:tell $nick $host $hand $chan $chan1 hextra.3 none
  11143. blacktools:tell $nick $host $hand $chan $chan1 hextra.4 none
  11144. blacktools:tell $nick $host $hand $chan $chan1 hextra.5 none
  11145. }
  11146. }
  11147. antipub {
  11148. if {[matchattr $hand nm|M $chan]} {
  11149. blacktools:tell $nick $host $hand $chan $chan1 hantipub.1 none
  11150. blacktools:tell $nick $host $hand $chan $chan1 hantipub.2 none
  11151. blacktools:tell $nick $host $hand $chan $chan1 hantipub.3 none
  11152. }
  11153. }
  11154. privat {
  11155. if {[matchattr $hand nm|M $chan]} {
  11156. blacktools:tell $nick $host $hand $chan $chan1 hprivat.1 none
  11157. blacktools:tell $nick $host $hand $chan $chan1 hprivat.2 none
  11158. blacktools:tell $nick $host $hand $chan $chan1 hprivat.3 none
  11159. }
  11160. }
  11161. antidle {
  11162. if {[matchattr $hand nm|M $chan]} {
  11163. blacktools:tell $nick $host $hand $chan $chan1 hantidle.1 none
  11164. blacktools:tell $nick $host $hand $chan $chan1 hantidle.2 none
  11165. blacktools:tell $nick $host $hand $chan $chan1 hantidle.3 none
  11166. }
  11167. }
  11168. antinotice {
  11169. if {[matchattr $hand nm|M $chan]} {
  11170. blacktools:tell $nick $host $hand $chan $chan1 hantinotice.1 none
  11171. blacktools:tell $nick $host $hand $chan $chan1 hantinotice.2 none
  11172. blacktools:tell $nick $host $hand $chan $chan1 hantinotice.3 none
  11173. }
  11174. }
  11175. antictcp {
  11176. if {[matchattr $hand nm|M $chan]} {
  11177. blacktools:tell $nick $host $hand $chan $chan1 hantictcp.1 none
  11178. blacktools:tell $nick $host $hand $chan $chan1 hantictcp.2 none
  11179. blacktools:tell $nick $host $hand $chan $chan1 hantictcp.3 none
  11180. }
  11181. }
  11182. antibadword {
  11183. if {[matchattr $hand nm|M $chan]} {
  11184. blacktools:tell $nick $host $hand $chan $chan1 hantibadword.1 none
  11185. blacktools:tell $nick $host $hand $chan $chan1 hantibadword.2 none
  11186. blacktools:tell $nick $host $hand $chan $chan1 hantibadword.3 none
  11187. }
  11188. }
  11189. antilongtext {
  11190. if {[matchattr $hand nm|M $chan]} {
  11191. blacktools:tell $nick $host $hand $chan $chan1 hantilongtext.1 none
  11192. blacktools:tell $nick $host $hand $chan $chan1 hantilongtext.2 none
  11193. blacktools:tell $nick $host $hand $chan $chan1 hantilongtext.3 none
  11194. }
  11195. }
  11196. antibadquitpart {
  11197. if {[matchattr $hand nm|M $chan]} {
  11198. blacktools:tell $nick $host $hand $chan $chan1 hantibadquitpart.1 none
  11199. blacktools:tell $nick $host $hand $chan $chan1 hantibadquitpart.2 none
  11200. blacktools:tell $nick $host $hand $chan $chan1 hantibadquitpart.3 none
  11201. }
  11202. }
  11203. antijoinpart {
  11204. if {[matchattr $hand nm|M $chan]} {
  11205. blacktools:tell $nick $host $hand $chan $chan1 hantijoinpart.1 none
  11206. blacktools:tell $nick $host $hand $chan $chan1 hantijoinpart.2 none
  11207. blacktools:tell $nick $host $hand $chan $chan1 hantijoinpart.3 none
  11208. }
  11209. }
  11210. antispam {
  11211. if {[matchattr $hand nm|M $chan]} {
  11212. blacktools:tell $nick $host $hand $chan $chan1 hantispam.1 none
  11213. blacktools:tell $nick $host $hand $chan $chan1 hantispam.2 none
  11214. blacktools:tell $nick $host $hand $chan $chan1 hantispam.3 none
  11215. }
  11216. }
  11217. antirepeat {
  11218. if {[matchattr $hand nm|M $chan]} {
  11219. blacktools:tell $nick $host $hand $chan $chan1 hantirepeat.1 none
  11220. blacktools:tell $nick $host $hand $chan $chan1 hantirepeat.2 none
  11221. blacktools:tell $nick $host $hand $chan $chan1 hantirepeat.3 none
  11222. }
  11223. }
  11224. anticolor {
  11225. if {[matchattr $hand nm|M $chan]} {
  11226. blacktools:tell $nick $host $hand $chan $chan1 hanticolor.1 none
  11227. blacktools:tell $nick $host $hand $chan $chan1 hanticolor.2 none
  11228. blacktools:tell $nick $host $hand $chan $chan1 hanticolor.3 none
  11229. }
  11230. }
  11231. antibold {
  11232. if {[matchattr $hand nm|M $chan]} {
  11233. blacktools:tell $nick $host $hand $chan $chan1 hantibold.1 none
  11234. blacktools:tell $nick $host $hand $chan $chan1 hantibold.2 none
  11235. blacktools:tell $nick $host $hand $chan $chan1 hantibold.3 none
  11236. }
  11237. }
  11238. antiunderline {
  11239. if {[matchattr $hand nm|M $chan]} {
  11240. blacktools:tell $nick $host $hand $chan $chan1 hantiunderline.1 none
  11241. blacktools:tell $nick $host $hand $chan $chan1 hantiunderline.2 none
  11242. blacktools:tell $nick $host $hand $chan $chan1 hantiunderline.3 none
  11243. }
  11244. }
  11245. anticaps {
  11246. if {[matchattr $hand nm|M $chan]} {
  11247. blacktools:tell $nick $host $hand $chan $chan1 hanticaps.1 none
  11248. blacktools:tell $nick $host $hand $chan $chan1 hanticaps.2 none
  11249. blacktools:tell $nick $host $hand $chan $chan1 hanticaps.3 none
  11250. }
  11251. }
  11252. badfullname {
  11253. if {[matchattr $hand nm|M $chan]} {
  11254. blacktools:tell $nick $host $hand $chan $chan1 hbadfullname.1 none
  11255. blacktools:tell $nick $host $hand $chan $chan1 hbadfullname.2 none
  11256. blacktools:tell $nick $host $hand $chan $chan1 hbadfullname.3 none
  11257. }
  11258. }
  11259. badnick {
  11260. if {[matchattr $hand nm|M $chan]} {
  11261. blacktools:tell $nick $host $hand $chan $chan1 hbadnick.1 none
  11262. blacktools:tell $nick $host $hand $chan $chan1 hbadnick.2 none
  11263. blacktools:tell $nick $host $hand $chan $chan1 hbadnick.3 none
  11264. }
  11265. }
  11266. badident {
  11267. if {[matchattr $hand nm|M $chan]} {
  11268. blacktools:tell $nick $host $hand $chan $chan1 hbadident.1 none
  11269. blacktools:tell $nick $host $hand $chan $chan1 hbadident.2 none
  11270. blacktools:tell $nick $host $hand $chan $chan1 hbadident.3 none
  11271. }
  11272. }
  11273. antichanflood {
  11274. if {[matchattr $hand nm|M $chan]} {
  11275. blacktools:tell $nick $host $hand $chan $chan1 hantichanflood.1 none
  11276. blacktools:tell $nick $host $hand $chan $chan1 hantichanflood.2 none
  11277. blacktools:tell $nick $host $hand $chan $chan1 hantichanflood.3 none
  11278. }
  11279. }
  11280. antijoinflood {
  11281. if {[matchattr $hand nm|M $chan]} {
  11282. blacktools:tell $nick $host $hand $chan $chan1 hantijoinflood.1 none
  11283. blacktools:tell $nick $host $hand $chan $chan1 hantijoinflood.2 none
  11284. blacktools:tell $nick $host $hand $chan $chan1 hantijoinflood.3 none
  11285. }
  11286. }
  11287. dr {
  11288. if {[matchattr $hand nm|M $chan]} {
  11289. blacktools:tell $nick $host $hand $chan $chan1 hdr.1 none
  11290. blacktools:tell $nick $host $hand $chan $chan1 hdr.2 none
  11291. blacktools:tell $nick $host $hand $chan $chan1 hdr.3 none
  11292. }
  11293. }
  11294. bot {
  11295. if {[matchattr $hand nm|M $chan]} {
  11296. blacktools:tell $nick $host $hand $chan $chan1 hbot.1 none
  11297. blacktools:tell $nick $host $hand $chan $chan1 hbot.2 none
  11298. blacktools:tell $nick $host $hand $chan $chan1 hbot.3 none
  11299. }
  11300. }
  11301. n {
  11302. if {[matchattr $hand nm|M $chan]} {
  11303. blacktools:tell $nick $host $hand $chan $chan1 hn.1 none
  11304. blacktools:tell $nick $host $hand $chan $chan1 hn.2 none
  11305. blacktools:tell $nick $host $hand $chan $chan1 hn.3 none
  11306. }
  11307. }
  11308. id {
  11309. if {[matchattr $hand nm|M $chan]} {
  11310. blacktools:tell $nick $host $hand $chan $chan1 hid.1 none
  11311. blacktools:tell $nick $host $hand $chan $chan1 hid.2 none
  11312. blacktools:tell $nick $host $hand $chan $chan1 hid.3 none
  11313. }
  11314. }
  11315. w {
  11316. if {[matchattr $hand nm|M $chan]} {
  11317. blacktools:tell $nick $host $hand $chan $chan1 hw.1 none
  11318. blacktools:tell $nick $host $hand $chan $chan1 hw.2 none
  11319. blacktools:tell $nick $host $hand $chan $chan1 hw.3 none
  11320. }
  11321. }
  11322. spam {
  11323. if {[matchattr $hand nm|M $chan]} {
  11324. blacktools:tell $nick $host $hand $chan $chan1 hspam.1 none
  11325. blacktools:tell $nick $host $hand $chan $chan1 hspam.2 none
  11326. blacktools:tell $nick $host $hand $chan $chan1 hspam.3 none
  11327. }
  11328. }
  11329. bw {
  11330. if {[matchattr $hand nm|M $chan]} {
  11331. blacktools:tell $nick $host $hand $chan $chan1 hbw.1 none
  11332. blacktools:tell $nick $host $hand $chan $chan1 hbw.2 none
  11333. blacktools:tell $nick $host $hand $chan $chan1 hbw.3 none
  11334. }
  11335. }
  11336. badchannel {
  11337. if {[matchattr $hand nm|M $chan]} {
  11338. blacktools:tell $nick $host $hand $chan $chan1 hbadchannel.1 none
  11339. blacktools:tell $nick $host $hand $chan $chan1 hbadchannel.2 none
  11340. blacktools:tell $nick $host $hand $chan $chan1 hbadchannel.3 none
  11341. }
  11342. }
  11343. counter {
  11344. if {[matchattr $hand nm|M $chan]} {
  11345. blacktools:tell $nick $host $hand $chan $chan1 hcounter.1 none
  11346. blacktools:tell $nick $host $hand $chan $chan1 hcounter.2 none
  11347. blacktools:tell $nick $host $hand $chan $chan1 hcounter.3 none
  11348. }
  11349. }
  11350. }
  11351. }
  11352. proc comand:pubme {nick host hand chan arg} {
  11353. global botnick wordsdir wdir sdir black seendir count server uptime {server-online}
  11354. set arg [split $arg]
  11355. set bnick [lindex [split $arg] 0]
  11356. set what [lindex [split $arg] 1]
  11357. if {([lsearch -exact [string tolower $bnick] [string tolower $botnick]] == 0)} {
  11358. switch -exact -- [string tolower $what] {
  11359. clear {
  11360. if {[matchattr $hand nm|M $chan]} {
  11361. set why [lindex [split $arg] 2]
  11362. set type 1
  11363. set chan1 "$chan"
  11364. if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
  11365. set chan "$why"
  11366. set why [lindex [split $arg] 3]
  11367. }
  11368. clear:process $nick $host $hand $chan $chan1 $why $type
  11369. }
  11370. }
  11371. private {
  11372. if {[matchattr $hand nm|M $chan]} {
  11373. set type 1
  11374. set chan1 "$chan"
  11375. set why [lindex [split $arg] 2]
  11376. set user [lindex [split $arg] 3]
  11377. set host [lindex [split $arg] 4]
  11378. if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
  11379. set chan "$why"
  11380. set why [lindex [split $arg] 3]
  11381. set user [lindex [split $arg] 4]
  11382. set host [lindex [split $arg] 5]
  11383. }
  11384. private:process $nick $host $hand $chan $chan1 $why $user $host $type
  11385. }
  11386. }
  11387. login {
  11388. if {[matchattr $hand nm|MSOAV $chan]} {
  11389. putquick "$black(login)"
  11390. putquick "MODE $botnick :$black(xmod)"
  11391. blacktools:tell:prv $nick $host $hand login.1 $black(chanserv)
  11392. }
  11393. }
  11394. h {
  11395. if {[matchattr $hand nm|MSOAV $chan]} {
  11396. set chan1 "$chan"
  11397. set command [lindex [split $arg] 2]
  11398. h:process $nick $host $hand $chan $chan1 $command
  11399. }
  11400. }
  11401. secure {
  11402. if {[matchattr $hand nm|M $chan]} {
  11403. set what [lindex [split $arg] 2]
  11404. set type 1
  11405. set chan1 "$chan"
  11406. if {[regexp {^[#&]} $what] && [matchattr $hand nm|- $chan]} {
  11407. set chan "$what"
  11408. set what [lindex [split $arg] 3]
  11409. }
  11410. secure:process $nick $host $hand $chan $chan1 $what $type
  11411. }
  11412. }
  11413. ignore {
  11414. if {[matchattr $hand nm|- $chan]} {
  11415. set chan1 "$chan"
  11416. set what [lindex [split $arg] 2]
  11417. set mask [lindex [split $arg] 3]
  11418. set time [lindex [split $arg] 4]
  11419. set reason [join [lrange [split $arg] 5 end]]
  11420. if {$what == ""} { blacktools:tell $nick $host $hand $chan $chan1 ignore.2 none
  11421. return 0
  11422. }
  11423. ignore:process $nick $host $hand $chan $chan1 $what $mask $time $reason
  11424. }
  11425. }
  11426. idle {
  11427. if {[matchattr $hand nm|M $chan]} {
  11428. set char(p) [lindex $black(cmdchar) 0]
  11429. set flag "-|f"
  11430. set type1 1
  11431. set chan1 "$chan"
  11432. set why [lindex [split $arg] 2]
  11433. set type [lindex [split $arg] 3]
  11434. set user [lindex [split $arg] 3]
  11435. set host [lindex [split $arg] 4]
  11436. if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
  11437. set chan "$why"
  11438. set why [lindex [split $arg] 3]
  11439. set type [lindex [split $arg] 4]
  11440. set user [lindex [split $arg] 4]
  11441. set host [lindex [split $arg] 5]
  11442. }
  11443. antidle:process $why $type $type1 $user $host $nick $hand $chan $chan1
  11444. }
  11445. }
  11446. version {
  11447. if {[matchattr $hand nm|MASOV $chan]} {
  11448. set chan1 "$chan"
  11449. version:process $nick $host $hand $chan $chan1
  11450. }
  11451. }
  11452. cc {
  11453. if {[matchattr $hand nm|MASO $chan]} {
  11454. set ::chan $chan
  11455. set chan1 "$chan"
  11456. set c [lindex [split $arg] 2]
  11457. if {$c == ""} { blacktools:tell $nick $host $hand $chan $chan1 cc.2 none
  11458. return 0
  11459. }
  11460. if {![regexp {^[\\+!#&]} $c]} {
  11461. set c #$c
  11462. }
  11463. putquick "MODE $c"
  11464. bind raw - 329 createdpublic
  11465. bind raw - 403 nocreatedpublic
  11466. }
  11467. }
  11468. activ {
  11469. if {[matchattr $hand nm|MASOV $chan]} {
  11470. set type 1
  11471. set chan1 "$chan"
  11472. set user [lindex [split $arg] 2]
  11473. if {[regexp {^[#&]} $user] && [matchattr $hand nm|- $chan]} {
  11474. set chan "$user"
  11475. set user [lindex [split $arg] 3]
  11476. }
  11477. activ:process $nick $host $hand $chan $chan1 $user $type
  11478. }
  11479. }
  11480. delmyhost {
  11481. if {[matchattr $hand nm|- $chan]} {
  11482. set chan1 "$chan"
  11483. set why [lindex [split $arg] 2]
  11484. if {$why == ""} { blacktools:tell $nick $host $hand $chan $chan1 delmyhost.1 none
  11485. return 0
  11486. }
  11487. delmyhost:process $nick $host $hand $chan $chan1 $why
  11488. }
  11489. }
  11490. addmyhost {
  11491. if {[matchattr $hand nm|- $chan]} {
  11492. set why [lindex [split $arg] 2]
  11493. set chan1 "$chan"
  11494. if {$why == ""} { blacktools:tell $nick $host $hand $chan $chan1 addmyhost.2 none
  11495. return 0
  11496. }
  11497. addmyhost:process $nick $host $hand $chan $chan1 $why
  11498. }
  11499. }
  11500. leave {
  11501. if {[matchattr $hand nm|M $chan]} {
  11502. set dir "logs/leave($chan).txt"
  11503. set type 1
  11504. set chan1 "$chan"
  11505. set who [lindex [split $arg] 2]
  11506. set leave [join [lrange [split $arg] 3 end]]
  11507. set number [lindex [split $arg] 3]
  11508. if {[regexp {^[\\+!#&]} $who] && [matchattr $hand nm|- $chan]} {
  11509. set chan "$who"
  11510. set who [lindex [split $arg] 3]
  11511. set leave [join [lrange [split $arg] 4 end]]
  11512. set number [lindex [split $arg] 4]
  11513. }
  11514. leave:process $who $leave $number $type $nick $host $hand $chan $chan1
  11515. }
  11516. }
  11517. greet {
  11518. if {[matchattr $hand nm|M $chan]} {
  11519. set who [lindex [split $arg] 2]
  11520. set type 1
  11521. set chan1 "$chan"
  11522. set greet [join [lrange [split $arg] 3 end]]
  11523. set number [lindex [split $arg] 3]
  11524. if {[regexp {^[\\+!#&]} $who] && [matchattr $hand nm|- $chan]} {
  11525. set chan "$who"
  11526. set who [lindex [split $arg] 3]
  11527. set greet [join [lrange [split $arg] 4 end]]
  11528. set number [lindex [split $arg] 4]
  11529. }
  11530. greet:process $who $greet $number $type $nick $host $hand $chan $chan1
  11531. }
  11532. }
  11533. chat {
  11534. if {[matchattr $hand nm|- $chan]} {
  11535. *ctcp:CHAT $nick $host $hand $botnick CHAT $arg
  11536. blacktools:tell $nick $host $hand $chan $chan1 chat.1 none
  11537. }
  11538. }
  11539. seen {
  11540. if {[matchattr $hand -|- $chan]} {
  11541. if {![channel get $chan seen]} {
  11542. return 0
  11543. }
  11544. set type 1
  11545. set wseen [lindex $arg 2]
  11546. set chan1 "$chan"
  11547. if {[regexp {^[\\+!#&]} $wseen] && [matchattr $hand nm|- $chan]} {
  11548. set chan1 "$chan"
  11549. set chan "$wseen"
  11550. set wseen [lindex $arg 3]
  11551. }
  11552. seen:process $nick $host $hand $chan $chan1 $wseen $type
  11553. }
  11554. }
  11555. topic {
  11556. if {[matchattr $hand nm|M $chan]} {
  11557. set nop [lindex [split $arg] 2]
  11558. set type 1
  11559. set chan1 "$chan"
  11560. set tp [join [lrange [split $arg] 3 end]]
  11561. set number [lindex [split $arg] 3]
  11562. if {[regexp {^[\\+!#&]} $nop] && [matchattr $hand nm|- $chan]} {
  11563. set chan "$nop"
  11564. set nop [lindex [split $arg] 3]
  11565. set tp [join [lrange [split $arg] 4 end]]
  11566. set number [lindex [split $arg] 4]
  11567. }
  11568. topic:process $nick $host $hand $chan $chan1 $nop $tp $number $type
  11569. }
  11570. }
  11571. limit {
  11572. if {[matchattr $hand nm|M $chan]} {
  11573. set why [lindex [split $arg] 2]
  11574. set lm [lindex [split $arg] 3]
  11575. set type 1
  11576. set chan1 "$chan"
  11577. if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
  11578. set chan "$why"
  11579. set why [lindex [split $arg] 3]
  11580. set lm [lindex [split $arg] 4]
  11581. }
  11582. limit:process $nick $host $hand $chan $chan1 $why $lm $type
  11583. }
  11584. }
  11585. anunt {
  11586. if {[matchattr $hand nm|M $chan]} {
  11587. set type 1
  11588. set chan1 "$chan"
  11589. set who [lindex [split $arg] 2]
  11590. set message [join [lrange [split $arg] 3 end]]
  11591. set number [lindex [split $arg] 3]
  11592. if {[regexp {^[\\+!#&]} $who] && [matchattr $hand nm|- $chan]} {
  11593. set chan "$who"
  11594. set who [lindex [split $arg] 3]
  11595. set message [join [lrange [split $arg] 4 end]]
  11596. set number [lindex [split $arg] 4]
  11597. }
  11598. anunt:process $nick $host $hand $chan $chan1 $who $message $number $type
  11599. }
  11600. }
  11601. bt {
  11602. if {[matchattr $hand nm|- $chan]} {
  11603. set who [lindex [split $arg] 2]
  11604. set chan1 "$chan"
  11605. set message [join [lrange [split $arg] 3 end]]
  11606. set number [lindex [split $arg] 3]
  11607. if {$who == ""} { blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.2 none
  11608. return 0
  11609. }
  11610. broadcast:process $nick $host $hand $chan $chan1 $who $message $number
  11611. }
  11612. }
  11613. badchan {
  11614. if {[matchattr $hand nm|M $chan]} {
  11615. set why [lindex [split $arg] 2]
  11616. set type 1
  11617. set chan1 "$chan"
  11618. set bdchan [join [lindex [split $arg] 3]]
  11619. if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
  11620. set chan "$why"
  11621. set why [lindex [split $arg] 3]
  11622. set bdchan [join [lindex [split $arg] 4]]
  11623. }
  11624. badchan:process $nick $host $hand $chan $chan1 $why $bdchan $type
  11625. }
  11626. }
  11627. count {
  11628. if {[matchattr $hand nm|M $chan]} {
  11629. set why [lindex [split $arg] 2]
  11630. set type 1
  11631. set chan1 "$chan"
  11632. if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
  11633. set chan "$why"
  11634. set why [lindex [split $arg] 3]
  11635. }
  11636. count:process $nick $host $hand $chan $chan1 $why $type
  11637. }
  11638. }
  11639. delvoice {
  11640. if {[matchattr $hand nm|M $chan]} {
  11641. set user [lindex [split $arg] 2]
  11642. set type 1
  11643. set chan1 "$chan"
  11644. if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
  11645. set chan "$user"
  11646. set user [lindex [split $arg] 3]
  11647. }
  11648. delvoice:process $nick $host $hand $chan $chan1 $user $type
  11649. }
  11650. }
  11651. delop {
  11652. if {[matchattr $hand nm|M $chan]} {
  11653. set user [lindex [split $arg] 2]
  11654. set type 1
  11655. set chan1 "$chan"
  11656. if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
  11657. set chan "$user"
  11658. set user [lindex [split $arg] 3]
  11659. }
  11660. delop:process $nick $host $hand $chan $chan1 $user $type
  11661. }
  11662. }
  11663. addvoice {
  11664. if {[matchattr $hand nm|M $chan]} {
  11665. set user [lindex [split $arg] 2]
  11666. set type 1
  11667. set chan1 "$chan"
  11668. if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
  11669. set chan "$user"
  11670. set user [lindex [split $arg] 3]
  11671. }
  11672. addvoice:process $nick $host $hand $chan $chan1 $user $type
  11673. }
  11674. }
  11675. addop {
  11676. if {[matchattr $hand nm|M $chan]} {
  11677. set user [lindex [split $arg] 2]
  11678. set type 1
  11679. set chan1 "$chan"
  11680. if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
  11681. set chan "$user"
  11682. set user [lindex [split $arg] 3]
  11683. }
  11684. addop:process $nick $host $hand $chan $chan1 $user $type
  11685. }
  11686. }
  11687. addbot {
  11688. if {[matchattr $hand nm|- $chan]} {
  11689. set why [lindex [split $arg] 2]
  11690. set host [lindex [split $arg] 3]
  11691. set chan1 "$chan"
  11692. if {$why == ""} { blacktools:tell $nick $host $hand $chan $chan1 addbot.2 none
  11693. return 0
  11694. }
  11695. addbot:process $nick $host $hand $chan $chan1 $why $host
  11696. }
  11697. }
  11698. whois {
  11699. if {[matchattr $hand nm|MAOS $chan]} {
  11700. set chan1 "$chan"
  11701. set who [lindex [split $arg] 2]
  11702. if {$who == ""} { blacktools:tell $nick $host $hand $chan $chan1 whois.2 none
  11703. return 0
  11704. }
  11705. whois:process $nick $host $hand $chan $chan1 $who
  11706. }
  11707. }
  11708. vers {
  11709. if {[matchattr $hand nm|MAOS $chan]} {
  11710. set chan1 "$chan"
  11711. set why [lindex [split $arg] 2]
  11712. if {$why == ""} { blacktools:tell $nick $host $hand $chan $chan1 vers.2 none
  11713. return 0
  11714. }
  11715. vers:process $nick $host $hand $chan $chan1 $why
  11716. }
  11717. }
  11718. time {
  11719. if {[matchattr $hand nm|MAOSV $chan]} {
  11720. set chan1 "$chan"
  11721. set time [ctime [unixtime]]
  11722. blacktools:tell $nick $host $hand $chan $chan1 time.1 $time
  11723. }
  11724. }
  11725. ping {
  11726. if {[matchattr $hand nm|MAOSV $chan]} {
  11727. putquick "PRIVMSG $nick :\001PING [expr {abs([clock clicks -milliseconds])}]\001"
  11728. return 0
  11729. }
  11730. }
  11731. us {
  11732. if {[matchattr $hand nm|MA $chan]} {
  11733. set type 1
  11734. set chan1 "$chan"
  11735. set users [lindex [split $arg] 2]
  11736. if {[regexp {^[#&]} $users] && [matchattr $hand nm|- $chan]} {
  11737. set chan "$users"
  11738. set users [lindex [split $arg] 3]
  11739. }
  11740. us:process $nick $host $hand $chan $chan1 $users $type
  11741. }
  11742. }
  11743. s {
  11744. if {[matchattr $hand nm|MA $chan]} {
  11745. set type 1
  11746. set chan1 "$chan"
  11747. set users [lindex [split $arg] 2]
  11748. if {[regexp {^[#&]} $users] && [matchattr $hand nm|- $chan]} {
  11749. set chan "$users"
  11750. set users [lindex [split $arg] 3]
  11751. }
  11752. s:process $nick $host $hand $chan $chan1 $users $type
  11753. }
  11754. }
  11755. info {
  11756. if {[matchattr $hand nm|MASOV $chan]} {
  11757. set user [lindex [split $arg] 2]
  11758. set type 1
  11759. set chan1 "$chan"
  11760. if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
  11761. set chan "$user"
  11762. set user [lindex [split $arg] 3]
  11763. }
  11764. info:process $nick $host $hand $chan $chan1 $user $type
  11765. }
  11766. }
  11767. channels {
  11768. if {[matchattr $hand nm|MASOV $chan]} {
  11769. set chan1 "$chan"
  11770. channels:process $nick $host $hand $chan $chan1
  11771. }
  11772. }
  11773. userlist {
  11774. if {[matchattr $hand nm|MASOV $chan]} {
  11775. set level [lindex [split $arg] 2]
  11776. set type 1
  11777. set chan1 "$chan"
  11778. if {[regexp {^[#&]} $level] && [matchattr $hand nm|- $chan]} {
  11779. set chan "$level"
  11780. set level [lindex [split $arg] 3]
  11781. }
  11782. userlist:execute $hand $host $level $chan $chan1 $nick $type
  11783. }
  11784. }
  11785. chuser {
  11786. if {[matchattr $hand nm|M $chan]} {
  11787. set user [lindex [split $arg] 2]
  11788. set type 1
  11789. set chan1 "$chan"
  11790. set chandle [lindex [split $arg] 3]
  11791. chuser:process $nick $host $hand $chan $chan1 $user $chandle $type
  11792. }
  11793. }
  11794. delhost {
  11795. if {[matchattr $hand nm|M $chan]} {
  11796. set user [lindex [split $arg] 2]
  11797. set type 1
  11798. set chan1 "$chan"
  11799. set hosts [lrange [split $arg] 3 end]
  11800. delhost:process $nick $host $hand $chan $chan1 $user $hosts $type
  11801. }
  11802. }
  11803. botidle {
  11804. if {[matchattr $hand nm|M $chan]} {
  11805. set chan1 "$chan"
  11806. set what [lindex [split $arg] 2]
  11807. if {$what == ""} { blacktools:tell $nick $host $hand $chan $chan1 antibotidle.2 none
  11808. return 0
  11809. }
  11810. botidle:process $nick $host $hand $chan $chan1 $what
  11811. }
  11812. }
  11813. addhost {
  11814. if {[matchattr $hand nm|M $chan]} {
  11815. set type 1
  11816. set chan1 "$chan"
  11817. set user [lindex [split $arg] 2]
  11818. set hosts [lrange [split $arg] 3 end]
  11819. addhost:process $nick $host $hand $chan $chan1 $user $hosts $type
  11820. }
  11821. }
  11822. del {
  11823. if {[matchattr $hand nm|- $chan]} {
  11824. set args [lrange [split $arg] 2 end]
  11825. set type 1
  11826. set chan1 "$chan"
  11827. del:process $nick $host $hand $chan $chan1 $args $type
  11828. }
  11829. }
  11830. delacc {
  11831. if {[matchattr $hand nm|MA $chan]} {
  11832. set args [lrange [split $arg] 2 end]
  11833. set type 1
  11834. set chan1 "$chan"
  11835. set c [lindex [split $arg] 2]
  11836. if {[regexp {^[#&]} $c] && [matchattr $hand nm|- $chan]} {
  11837. set chan "$c"
  11838. set args [lrange [split $arg] 3 end]
  11839. }
  11840. delacc:process $nick $host $hand $chan $chan1 $args $type
  11841. }
  11842. }
  11843. adduser {
  11844. if {[matchattr $hand nm|MA $chan]} {
  11845. set chan1 "$chan"
  11846. set level [lindex [split $arg] 2]
  11847. set args [lrange [split $arg] 3 end]
  11848. set c [lindex [split $arg] 3]
  11849. set type 1
  11850. if {[regexp {^[#&]} $c] && [matchattr $hand nm|- $chan]} {
  11851. set chan "$c"
  11852. set args [lrange [split $arg] 4 end]
  11853. }
  11854. adduser:process $nick $host $hand $chan $chan1 $args $level $type
  11855. }
  11856. }
  11857. add {
  11858. if {[matchattr $hand nm|MA $chan]} {
  11859. set level [lindex [split $arg] 2]
  11860. set time [ctime [unixtime]]
  11861. set type 1
  11862. set chan1 "$chan"
  11863. set args [lrange [split $arg] 3 end]
  11864. set c [lindex [split $arg] 3]
  11865. if {[regexp {^[#&]} $c] && [matchattr $hand nm|- $chan]} {
  11866. set chan "$c"
  11867. set args [lrange [split $arg] 4 end]
  11868. }
  11869. if {[matchattr $hand -|q $chan]} {
  11870. blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  11871. return 0
  11872. }
  11873. add:process $args $time $level $hand $host $chan $chan1 $nick $type
  11874. }
  11875. }
  11876. unsuspend {
  11877. if {[matchattr $hand nm|- $chan]} {
  11878. set chans [lindex [split $arg] 2]
  11879. set chan1 "$chan"
  11880. if {$chans == ""} {blacktools:tell $nick $host $hand $chan $chan1 unsuspend.5 none
  11881. return 0
  11882. }
  11883. if {![regexp {^[\\+!#&]} $chans]} {
  11884. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  11885. return 0
  11886. }
  11887. if {![validchan $chans]} { blacktools:tell $nick $host $hand $chan $chan1 unsuspend.2 $chans
  11888. return 0
  11889. }
  11890. if {![channel get $chans inactive]} {
  11891. blacktools:tell $nick $host $hand $chan $chan1 unsuspend.3 $chans
  11892. return 0
  11893. }
  11894. channel set $chans -inactive
  11895. blacktools:tell $nick $host $hand $chan $chan1 unsuspend.4 $chans
  11896. }
  11897. }
  11898. suspend {
  11899. if {[matchattr $hand nm|- $chan]} {
  11900. set chans [lindex [split $arg] 2]
  11901. set chan1 "$chan"
  11902. if {$chans == ""} {blacktools:tell $nick $host $hand $chan $chan1 suspend.5 none
  11903. return 0
  11904. }
  11905. if {![regexp {^[\\+!#&]} $chans]} {
  11906. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  11907. return 0
  11908. }
  11909. if {![validchan $chans]} { blacktools:tell $nick $host $hand $chan $chan1 suspend.2 $chans
  11910. return 0
  11911. }
  11912. if { [channel get $chans inactive]} {
  11913. blacktools:tell $nick $host $hand $chan $chan1 suspend.3 $chans
  11914. return 0
  11915. }
  11916. channel set $chans +inactive
  11917. blacktools:tell $nick $host $hand $chan $chan1 suspend.4 $chans
  11918. }
  11919. }
  11920. delchan {
  11921. if {[matchattr $hand nm|- $chan]} {
  11922. set chans [lindex [split $arg] 2]
  11923. set chan1 "$chan"
  11924. if {$chans == ""} {blacktools:tell $nick $host $hand $chan $chan1 delchan.4 none
  11925. return 0
  11926. }
  11927. if {![regexp {^[\\+!#&]} $chans]} {
  11928. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  11929. return 0
  11930. }
  11931. if {![validchan $chans]} { blacktools:tell $nick $host $hand $chan $chan1 delchan.2 $chans
  11932. return 0
  11933. }
  11934. channel remove $chans
  11935. delchan:stats $chans $hand $host
  11936. blacktools:tell $nick $host $hand $chan $chan1 delchan.3 $chans
  11937. }
  11938. }
  11939. addchan {
  11940. if {[matchattr $hand nm|- $chan]} {
  11941. set chan1 "$chan"
  11942. set chans [lindex [split $arg] 2]
  11943. if {$chans == ""} {blacktools:tell $nick $host $hand $chan $chan1 addchan.4 none
  11944. return 0
  11945. }
  11946. if {![regexp {^[\\+!#&]} $chans]} {
  11947. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  11948. return 0
  11949. }
  11950. if {[validchan $chans]} {
  11951. blacktools:tell $nick $host $hand $chan $chan1 addchan.2 $chans
  11952. return 0
  11953. } else {
  11954. channel add $chans
  11955. addchan:stats $chans $hand $host
  11956. blacktools:tell $nick $host $hand $chan $chan1 addchan.3 $chans
  11957. }
  11958. }
  11959. }
  11960. die {
  11961. if {[matchattr $hand nm|- $chan]} {
  11962. set chan1 "$chan"
  11963. blacktools:tell $nick $host $hand $chan $chan1 die.1 none
  11964. utimer 3 [list die "byeeee"]
  11965. }
  11966. }
  11967. jump {
  11968. if {[matchattr $hand nm|- $chan]} {
  11969. set chan1 "$chan"
  11970. set serv [lindex [split $arg] 2]
  11971. blacktools:tell $nick $host $hand $chan $chan1 jump.1 none
  11972. utimer 3 [list jump $serv]
  11973. }
  11974. }
  11975. save {
  11976. if {[matchattr $hand nm|- $chan]} {
  11977. set chan1 "$chan"
  11978. blacktools:tell $nick $host $hand $chan $chan1 save.1 none
  11979. save
  11980. }
  11981. }
  11982. restart {
  11983. if {[matchattr $hand nm|- $chan]} {
  11984. set chan1 "$chan"
  11985. blacktools:tell $nick $host $hand $chan $chan1 restart.1 none
  11986. utimer 3 [list restart]
  11987. }
  11988. }
  11989. rehash {
  11990. if {[matchattr $hand nm|- $chan]} {
  11991. set chan1 "$chan"
  11992. blacktools:tell $nick $host $hand $chan $chan1 rehash.1 none
  11993. rehash
  11994. }
  11995. }
  11996. nick {
  11997. if {[matchattr $hand nm|- $chan]} {
  11998. set who "$nick"
  11999. set newnick [lindex [split $arg] 2]
  12000. nick:process $who $newnick $host $hand $chan
  12001. }
  12002. }
  12003. msg {
  12004. if {[matchattr $hand nm|- $chan]} {
  12005. set nicks [lindex [split $arg] 2]
  12006. set chan1 "$chan"
  12007. set msg [join [lrange [split $arg] 3 end]]
  12008. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  12009. return 0
  12010. }
  12011. if {$nicks == ""} {blacktools:tell $nick $host $hand $chan $chan1 msg.2 none
  12012. return 0
  12013. }
  12014. if {[isbotnick $nicks]} {
  12015. return 0
  12016. }
  12017. putquick "PRIVMSG $nicks :$msg"
  12018. }
  12019. }
  12020. silence {
  12021. if {[matchattr $hand nm|- $chan]} {
  12022. set value [lindex [split $arg] 2]
  12023. set chan1 "$chan"
  12024. if {$value == ""} { blacktools:tell $nick $host $hand $chan $chan1 silence.2 none
  12025. return 0
  12026. }
  12027. silence:process $nick $host $hand $chan $chan1 $value
  12028. }
  12029. }
  12030. set {
  12031. if {[matchattr $hand nm|M $chan]} {
  12032. set flags [lindex [split $arg] 2]
  12033. set type [join [lrange [split $arg] 3 end]]
  12034. set type1 1
  12035. set chan1 "$chan"
  12036. if {[regexp {^[#&]} $flags] && [matchattr $hand nm|- $chan]} {
  12037. set chan "$flags"
  12038. set flags [lindex [split $arg] 3]
  12039. set type [join [lrange [split $arg] 4 end]]
  12040. }
  12041. set:process $nick $host $hand $chan $chan1 $flags $type $type1
  12042. }
  12043. }
  12044. mode {
  12045. if {[matchattr $hand nm|OSMA $chan]} {
  12046. set modes [lindex [split $arg] 2]
  12047. set type 1
  12048. set chan1 "$chan"
  12049. foreach c [channels] {
  12050. set backchan [channel get $c backchan]
  12051. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12052. set chan "$c"
  12053. }
  12054. }
  12055. if {[regexp {^[#&]} $modes] && [matchattr $hand nm|- $chan]} {
  12056. set chan "$modes"
  12057. set modes [lindex [split $arg] 3]
  12058. }
  12059. mode:process $nick $host $hand $chan $chan1 $modes $type
  12060. }
  12061. }
  12062. away {
  12063. if {[matchattr $hand nm|- $chan]} {
  12064. set chan1 "$chan"
  12065. set aw [join [lrange [split $arg] 2 end]]
  12066. if {$aw == "" } {blacktools:tell $nick $host $hand $chan $chan1 away.2 none
  12067. return 0
  12068. }
  12069. away:process $nick $host $hand $chan $chan1 $aw
  12070. }
  12071. }
  12072. cycle {
  12073. if {[matchattr $hand nm|OSMA $chan]} {
  12074. set reason [join [lrange [split $arg] 2 end]]
  12075. set c [lindex [split $arg] 2]
  12076. set chan1 "$chan"
  12077. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  12078. set chan "$c"
  12079. set reason [join [lrange [split $arg] 3 end]]
  12080. }
  12081. cycle:process $nick $host $hand $chan $chan1 $reason
  12082. }
  12083. }
  12084. purge {
  12085. if {[matchattr $hand nm|M $chan]} {
  12086. set reason [join [lrange [split $arg] 2 end]]
  12087. set chan1 "$chan"
  12088. if {$reason == ""} {
  12089. blacktools:tell $nick $host $hand $chan $chan1 purge.1 none
  12090. return 0
  12091. }
  12092. purge:process $nick $host $hand $chan $chan1 $reason
  12093. }
  12094. }
  12095. check {
  12096. if {[matchattr $hand nm|OSMA $chan]} {
  12097. set chan1 "$chan"
  12098. set checked [lindex [split $arg] 2]
  12099. if {$checked == ""} { blacktools:tell $nick $host $hand $chan $chan1 check.2 none
  12100. return 0
  12101. }
  12102. check:process $nick $host $hand $chan $chan1 $checked
  12103. }
  12104. }
  12105. broadcast {
  12106. if {[matchattr $hand nm|- $chan]} {
  12107. set chan1 "$chan"
  12108. set text [join [lrange [split $arg] 2 end]]
  12109. if {$text == ""} {
  12110. blacktools:tell $nick $host $hand $chan $chan1 broadcast.2 none
  12111. return 0
  12112. }
  12113. broadcast:cmd:process $nick $host $hand $chan $chan1 $text
  12114. }
  12115. }
  12116. act {
  12117. if {[matchattr $hand nm|SMA $chan]} {
  12118. set text [join [lrange [split $arg] 2 end]]
  12119. set c [lindex [split $arg] 2]
  12120. set type 1
  12121. set chan1 "$chan"
  12122. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  12123. set chan "$c"
  12124. set text [join [lrange [split $arg] 3 end]]
  12125. }
  12126. act:process $nick $host $hand $chan $chan1 $text $type
  12127. }
  12128. }
  12129. say {
  12130. if {[matchattr $hand nm|SMA $chan]} {
  12131. set text [join [lrange [split $arg] 2 end]]
  12132. set c [lindex [split $arg] 2]
  12133. set type 1
  12134. set chan1 "$chan"
  12135. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  12136. set chan "$c"
  12137. set text [join [lrange [split $arg] 3 end]]
  12138. }
  12139. say:process $nick $host $hand $chan $chan1 $text $type
  12140. }
  12141. }
  12142. v {
  12143. if {[matchattr $hand nm|VOSMA $chan]} {
  12144. set voicex [lrange $arg 2 end]
  12145. set c [lindex [split $arg] 2]
  12146. set nick [split $nick]
  12147. set chan1 "$chan"
  12148. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  12149. set chan "$c"
  12150. set voicex [lrange $arg 3 end]
  12151. }
  12152. v:process $nick $host $hand $chan $chan1 $voicex
  12153. }
  12154. }
  12155. o {
  12156. if {[matchattr $hand nm|OSMA $chan]} {
  12157. set opex [lrange $arg 2 end]
  12158. set c [lindex [split $arg] 2]
  12159. set nick [split $nick]
  12160. set chan1 "$chan"
  12161. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  12162. set chan "$c"
  12163. set opex [lrange $arg 3 end]
  12164. }
  12165. o:process $nick $host $hand $chan $chan1 $opex
  12166. }
  12167. }
  12168. uptime {
  12169. if {[matchattr $hand nm|- $chan]} {
  12170. set chan1 "$chan"
  12171. set up [duration [expr [unixtime] - $uptime]]
  12172. set on [duration [expr [unixtime] - ${server-online}]]
  12173. blacktools:tell $nick $host $hand $chan $chan1 status.1 $up
  12174. blacktools:tell $nick $host $hand $chan $chan1 status.2 $server
  12175. blacktools:tell $nick $host $hand $chan $chan1 status.3 $on
  12176. }
  12177. }
  12178. status {
  12179. if {[matchattr $hand nm|- $chan]} {
  12180. set chan1 "$chan"
  12181. regsub -all " " [channels] ", " chans
  12182. catch {exec uptime} shelluptime
  12183. set up [duration [expr [unixtime] - $uptime]]
  12184. set on [duration [expr [unixtime] - ${server-online}]]
  12185. blacktools:tell $nick $host $hand $chan $chan1 status.1 $up
  12186. blacktools:tell $nick $host $hand $chan $chan1 status.2 $server
  12187. blacktools:tell $nick $host $hand $chan $chan1 status.3 $on
  12188. blacktools:tell $nick $host $hand $chan $chan1 status.4 $chans
  12189. blacktools:tell $nick $host $hand $chan $chan1 status.5 $shelluptime
  12190. }
  12191. }
  12192. t {
  12193. if {[matchattr $hand nm|VOSMA $chan]} {
  12194. set topics [join [lrange [split $arg] 2 end]]
  12195. set type 1
  12196. set chan1 "$chan"
  12197. if {[regexp {^[\\+!#&]} $topics] && [matchattr $hand nm|- $chan]} {
  12198. set chan "$topics"
  12199. set topics [join [lrange [split $arg] 3 end]]
  12200. }
  12201. t:process $nick $host $hand $chan $chan1 $topics $type
  12202. }
  12203. }
  12204. d {
  12205. if {[matchattr $hand nm|SMA $chan]} {
  12206. set days [lindex [split $arg] 2]
  12207. set dnick [lindex [split $arg] 3]
  12208. set type 1
  12209. set mask [lindex [split $arg] 3]
  12210. set reason [join [lrange [split $arg] 4 end]]
  12211. set handle [nick2hand $dnick]
  12212. set chan1 "$chan"
  12213. foreach c [channels] {
  12214. set backchan [channel get $c backchan]
  12215. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12216. set chan "$c"
  12217. }
  12218. }
  12219. if {[regexp {^[\\+!#&]} $days] && [matchattr $hand nm|- $chan]} {
  12220. set chan "$days"
  12221. set days [lindex [split $arg] 3]
  12222. set mask [lindex [split $arg] 4]
  12223. set dnick [lindex [split $arg] 4]
  12224. set reason [join [lrange [split $arg] 5 end]]
  12225. if {![regexp {^[0-9]} $days]} {
  12226. set days 1
  12227. set mask [lindex [split $arg] 3]
  12228. set dnick [lindex [split $arg] 3]
  12229. set reason [join [lrange [split $arg] 4 end]]
  12230. }
  12231. }
  12232. if {![regexp {^[0-9]} $days]} {
  12233. set days 1
  12234. set mask [lindex [split $arg] 2]
  12235. set dnick [lindex [split $arg] 2]
  12236. set reason [join [lrange [split $arg] 3 end]]
  12237. }
  12238. d:process $dnick $mask $days $reason $nick $hand $host $chan $chan1 $type
  12239. }
  12240. }
  12241. sb {
  12242. if {[matchattr $hand nm|VOSMA $chan]} {
  12243. set bhost [string tolower [lindex [split $arg] 2]]
  12244. set what [lindex [split $arg] 3]
  12245. set type 1
  12246. set chan1 "$chan"
  12247. foreach c [channels] {
  12248. set backchan [channel get $c backchan]
  12249. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12250. set chan "$c"
  12251. }
  12252. }
  12253. if {[regexp {^[\\+!#&]} $bhost] && [matchattr $hand nm|- $chan]} {
  12254. set chan "$bhost"
  12255. set bhost [string tolower [lindex [split $arg] 3]]
  12256. set what [lindex [split $arg] 4]
  12257. }
  12258. sb:process $bhost $what $nick $hand $host $chan $chan1 $type
  12259. }
  12260. }
  12261. ub {
  12262. if {[matchattr $hand nm|OSMA $chan]} {
  12263. set ban [lindex [split $arg] 2]
  12264. set why [lindex [split $arg] 3]
  12265. set type 1
  12266. set chan1 "$chan"
  12267. foreach c [channels] {
  12268. set backchan [channel get $c backchan]
  12269. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12270. set chan "$c"
  12271. }
  12272. }
  12273. if {[regexp {^[\\+!#&]} $ban] && [matchattr $hand nm|- $chan]} {
  12274. set chan "$ban"
  12275. set ban [lindex [split $arg] 3]
  12276. }
  12277. ub:process $ban $why $nick $hand $host $chan $chan1 $type
  12278. }
  12279. }
  12280. bw {
  12281. if {[matchattr $hand nm|OSMA $chan]} {
  12282. set abuser [lindex [split $arg] 2]
  12283. set mask [lindex [split $arg] 2]
  12284. set type 1
  12285. set chan1 "$chan"
  12286. set handle [nick2hand $abuser]
  12287. foreach c [channels] {
  12288. set backchan [channel get $c backchan]
  12289. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12290. set chan "$c"
  12291. }
  12292. }
  12293. if {[regexp {^[\\+!#&]} $abuser] && [matchattr $hand nm|- $chan]} {
  12294. set chan "$abuser"
  12295. set abuser [lindex [split $arg] 3]
  12296. set mask [lindex [split $arg] 3]
  12297. }
  12298. bw:process $abuser $mask $nick $hand $host $chan $chan1 $type
  12299. }
  12300. }
  12301. stick {
  12302. if {[matchattr $hand nm|SMA $chan]} {
  12303. set snick [lindex [split $arg] 2]
  12304. set mask [lindex [split $arg] 2]
  12305. set type 1
  12306. set time [lindex [split $arg] 3]
  12307. set reason [join [lrange [split $arg] 4 end]]
  12308. set handle [nick2hand $snick]
  12309. set list [userlist $black(exceptflags) $chan]
  12310. set chan1 "$chan"
  12311. foreach c [channels] {
  12312. set backchan [channel get $c backchan]
  12313. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12314. set chan "$c"
  12315. }
  12316. }
  12317. if {[regexp {^[\\+!#&]} $snick] && [matchattr $hand nm|- $chan]} {
  12318. set chan "$snick"
  12319. set time [lindex [split $arg] 4]
  12320. set mask [lindex [split $arg] 3]
  12321. set snick [lindex [split $arg] 3]
  12322. set reason [join [lrange [split $arg] 5 end]]
  12323. if {![regexp {^[0-9]} $time]} {
  12324. set time "$black(dfstickbantime)"
  12325. set reason [join [lrange [split $arg] 4 end]]
  12326. }
  12327. }
  12328. if {![regexp {^[0-9]} $time]} {
  12329. set time "$black(dfstickbantime)"
  12330. set reason [join [lrange [split $arg] 3 end]]
  12331. }
  12332. stick:process $snick $mask $time $reason $nick $hand $host $chan $chan1 $type
  12333. }
  12334. }
  12335. k {
  12336. if {[matchattr $hand nm|VOSMA $chan]} {
  12337. set knick [lindex [split $arg] 2]
  12338. set type 1
  12339. set reason [join [lrange [split $arg] 3 end]]
  12340. set handle [nick2hand $knick]
  12341. set chan1 "$chan"
  12342. foreach c [channels] {
  12343. set backchan [channel get $c backchan]
  12344. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12345. set chan "$c"
  12346. }
  12347. }
  12348. if {[regexp {^[\\+!#&]} $knick] && [matchattr $hand nm|- $chan]} {
  12349. set chan "$knick"
  12350. set knick [lindex [split $arg] 3]
  12351. set reason [join [lrange [split $arg] 4 end]]
  12352. }
  12353. k:process $knick $nick $hand $host $reason $chan $chan1 $type
  12354. }
  12355. }
  12356. spam {
  12357. if {[matchattr $hand nm|OSMA $chan]} {
  12358. set spammer [lindex [split $arg] 2]
  12359. set type 1
  12360. set mask [lindex [split $arg] 2]
  12361. set handle [nick2hand $spammer]
  12362. set chan1 "$chan"
  12363. foreach c [channels] {
  12364. set backchan [channel get $c backchan]
  12365. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12366. set chan "$c"
  12367. }
  12368. }
  12369. if {[regexp {^[\\+!#&]} $spammer] && [matchattr $hand nm|- $chan]} {
  12370. set chan "$spammer"
  12371. set spammer [lindex [split $arg] 2]
  12372. set mask [lindex [split $arg] 2]
  12373. }
  12374. spam:process $spammer $mask $nick $hand $host $chan $chan1 $type
  12375. }
  12376. }
  12377. w {
  12378. if {[matchattr $hand nm|OVSMA $chan]} {
  12379. set wnick [lindex [split $arg] 2]
  12380. set type 1
  12381. set chan1 "$chan"
  12382. set handle [nick2hand $wnick]
  12383. foreach c [channels] {
  12384. set backchan [channel get $c backchan]
  12385. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12386. set chan "$c"
  12387. }
  12388. }
  12389. if {[regexp {^[\\+!#&]} $wnick] && [matchattr $hand nm|- $chan]} {
  12390. set chan "$wnick"
  12391. set wnick [lindex [split $arg] 3]
  12392. }
  12393. w:process $wnick $nick $hand $host $chan $chan1 $type
  12394. }
  12395. }
  12396. black {
  12397. if {[matchattr $hand nm|SMA $chan]} {
  12398. set blnick [lindex [split $arg] 2]
  12399. set mask [lindex [split $arg] 2]
  12400. set type 1
  12401. set reason [join [lrange [split $arg] 3 end]]
  12402. set handle [nick2hand $blnick]
  12403. set chan1 "$chan"
  12404. foreach c [channels] {
  12405. set backchan [channel get $c backchan]
  12406. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12407. set chan "$c"
  12408. }
  12409. }
  12410. if {[regexp {^[\\+!#&]} $blnick] && [matchattr $hand nm|- $chan]} {
  12411. set chan "$blnick"
  12412. set blnick [lindex [split $arg] 3]
  12413. set mask [lindex [split $arg] 3]
  12414. set reason [join [lrange [split $arg] 4 end]]
  12415. }
  12416. black:process $blnick $nick $mask $hand $host $chan $chan1 $reason $type
  12417. }
  12418. }
  12419. bl {
  12420. if {[matchattr $hand nm|SMA $chan]} {
  12421. set blnick [lindex [split $arg] 2]
  12422. set mask [lindex [split $arg] 2]
  12423. set type 1
  12424. set chan1 "$chan"
  12425. set reason [join [lrange [split $arg] 3 end]]
  12426. set handle [nick2hand $blnick]
  12427. foreach c [channels] {
  12428. set backchan [channel get $c backchan]
  12429. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12430. set chan "$c"
  12431. }
  12432. }
  12433. if {[regexp {^[\\+!#&]} $blnick] && [matchattr $hand nm|- $chan]} {
  12434. set chan "$blnick"
  12435. set blnick [lindex [split $arg] 3]
  12436. set mask [lindex [split $arg] 3]
  12437. set reason [join [lrange [split $arg] 4 end]]
  12438. }
  12439. black:process $blnick $nick $mask $hand $host $chan $chan1 $reason $type
  12440. }
  12441. }
  12442. id {
  12443. if {[matchattr $hand nm|OSMA $chan]} {
  12444. set idnick [lindex [split $arg] 2]
  12445. set handle [nick2hand $idnick]
  12446. set type 1
  12447. set chan1 "$chan"
  12448. foreach c [channels] {
  12449. set backchan [channel get $c backchan]
  12450. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12451. set chan "$c"
  12452. }
  12453. }
  12454. if {[regexp {^[\\+!#&]} $idnick] && [matchattr $hand nm|- $chan]} {
  12455. set chan "$idnick"
  12456. set idnick [lindex [split $arg] 3]
  12457. }
  12458. id:process $idnick $nick $hand $host $chan $chan1 $type
  12459. }
  12460. }
  12461. bot {
  12462. if {[matchattr $hand nm|OSMA $chan]} {
  12463. set bot [lindex [split $arg] 2]
  12464. set mask [lindex [split $arg] 2]
  12465. set type 1
  12466. set chan1 "$chan"
  12467. foreach c [channels] {
  12468. set backchan [channel get $c backchan]
  12469. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12470. set chan "$c"
  12471. }
  12472. }
  12473. if {[regexp {^[\\+!#&]} $bot] && [matchattr $hand nm|- $chan]} {
  12474. set chan "$bot"
  12475. set bot [lindex [split $arg] 3]
  12476. set mask [lindex [split $arg] 3]
  12477. }
  12478. bot:process $bot $mask $nick $hand $host $chan $chan1 $type
  12479. }
  12480. }
  12481. dr {
  12482. if {[matchattr $hand nm|OSMA $chan]} {
  12483. set drone [lindex [split $arg] 2]
  12484. set mask [lindex [split $arg] 2]
  12485. set type "1"
  12486. set chan1 "$chan"
  12487. foreach c [channels] {
  12488. set backchan [channel get $c backchan]
  12489. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12490. set chan "$c"
  12491. }
  12492. }
  12493. if {[regexp {^[\\+!#&]} $drone] && [matchattr $hand nm|- $chan]} {
  12494. set chan "$drone"
  12495. set drone [lindex [split $arg] 3]
  12496. set mask [lindex [split $arg] 3]
  12497. }
  12498. dr:process $drone $mask $nick $hand $host $chan $chan1 $type
  12499. }
  12500. }
  12501. b {
  12502. if {[matchattr $hand nm|OSMA $chan]} {
  12503. set bnick [lindex [split $arg] 2]
  12504. set mask [lindex [split $arg] 2]
  12505. set time [lindex [split $arg] 3]
  12506. set type 1
  12507. set chan1 "$chan"
  12508. set type1 [lindex [split $arg] 3]
  12509. set type2 [lindex [split $arg] 4]
  12510. set reason [join [lrange [split $arg] 4 end]]
  12511. set handle [nick2hand $bnick]
  12512. if {[string match -nocase "global" $type1] || [string match -nocase "global" $type2] && [matchattr $hand nm|- $chan]} {
  12513. if {[string match -nocase $type1 "global"]} {
  12514. set reason [join [lrange [split $arg] 4 end]]
  12515. }
  12516. if {[string match -nocase $type2 "global"]} {
  12517. set reason [join [lrange [split $arg] 5 end]]
  12518. }
  12519. set list [userlist nm|-]
  12520. foreach user $list {
  12521. set hosts [getuser $user hosts]
  12522. foreach host $hosts {
  12523. if {[string match $mask $host]} {
  12524. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  12525. return 0
  12526. }
  12527. }
  12528. }
  12529. if {[matchattr $handle nm|- $chan]} {
  12530. blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
  12531. return 0
  12532. }
  12533. if {![regexp {^[0-9]} $time]} {
  12534. set reason [join [lrange [split $arg] 4 end]]
  12535. set time "$black(btime)"
  12536. }
  12537. if {$reason == ""} {set reason1 "(GLOBAL) $black(dfreason)"
  12538. } else { set reason1 "(GLOBAL) $reason" }
  12539. if {[channel get $chan showhandle]} {
  12540. set reason "($hand) $reason1"
  12541. } else { set reason "$reason1"
  12542. }
  12543. if {[isbotnick $bnick]} {
  12544. return 0
  12545. }
  12546. if {![botisop $chan]} {
  12547. blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
  12548. return 0
  12549. }
  12550. if {$mask == "*!*@*"} {
  12551. return 0
  12552. }
  12553. if {[onchan $bnick $chan]} {
  12554. set mask *!*@[lindex [split [getchanhost $bnick $chan] "@"] 1]
  12555. }
  12556. newban $mask $hand $reason $time
  12557. if {$time == "0"} { set reply "Permanent" } else { set reply "$time" }
  12558. blacktools:tell $nick $host $hand $chan $chan1 b.8 "$mask $reply"
  12559. return 0
  12560. }
  12561. set chan1 "$chan"
  12562. foreach c [channels] {
  12563. set backchan [channel get $c backchan]
  12564. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12565. set chan "$c"
  12566. }
  12567. }
  12568. if {[regexp {^[\\+!#&]} $bnick] && [matchattr $hand nm|- $chan]} {
  12569. set chan "$bnick"
  12570. set bnick [lindex [split $arg] 3]
  12571. set mask [lindex [split $arg] 3]
  12572. set time [lindex [split $arg] 4]
  12573. set reason [join [lrange [split $arg] 5 end]]
  12574. if {![regexp {^[0-9]} $time]} {
  12575. set reason [join [lrange [split $arg] 4 end]]
  12576. set time "$black(btime)"
  12577. }
  12578. }
  12579. if {![regexp {^[0-9]} $time]} {
  12580. set reason [join [lrange [split $arg] 3 end]]
  12581. set time "$black(btime)"
  12582. }
  12583. b:local $bnick $mask $time $nick $reason $hand $host $chan $chan1 $type
  12584. }
  12585. }
  12586. n {
  12587. if {[matchattr $hand nm|OSMA $chan]} {
  12588. set bnick [lindex [split $arg] 2]
  12589. set type 1
  12590. set handle [nick2hand $bnick]
  12591. set chan1 "$chan"
  12592. foreach c [channels] {
  12593. set backchan [channel get $c backchan]
  12594. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12595. set chan "$c"
  12596. }
  12597. }
  12598. if {[regexp {^[\\+!#&]} $bnick] && [matchattr $hand nm|- $chan]} {
  12599. set chan "$bnick"
  12600. set bnick [lindex [split $arg] 3]
  12601. }
  12602. n:process $bnick $nick $hand $host $chan $chan1 $type
  12603. }
  12604. }
  12605. gag {
  12606. if {[matchattr $hand nm|OSMA $chan]} {
  12607. set gagger [lindex [split $arg] 2]
  12608. set type 1
  12609. set handle [nick2hand $gagger]
  12610. set chan1 "$chan"
  12611. foreach c [channels] {
  12612. set backchan [channel get $c backchan]
  12613. if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
  12614. set chan "$c"
  12615. }
  12616. }
  12617. if {[regexp {^[\\+!#&]} $gagger] && [matchattr $hand nm|- $chan]} {
  12618. set chan "$gagger"
  12619. set gagger [lindex [split $arg] 3]
  12620. }
  12621. gag:process $gagger $nick $hand $host $chan $chan1 $type
  12622. }
  12623. }
  12624. l {
  12625. if {[matchattr $hand nm|OSMA $chan]} {
  12626. set times [lindex [split $arg] 2]
  12627. set type 1
  12628. set chan1 "$chan"
  12629. if {[regexp {^[\\+!#&]} $times] && [matchattr $hand nm|- $chan]} {
  12630. set chan "$times"
  12631. set times [lindex [split $arg] 3]
  12632. }
  12633. l:process $nick $host $hand $chan $chan1 $times $type
  12634. }
  12635. }
  12636. ul {
  12637. if {[matchattr $hand nm|OSMA $chan]} {
  12638. set c [lindex [split $arg] 0]
  12639. set chan1 "$chan"
  12640. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  12641. set chan "$c"
  12642. }
  12643. ul:process $nick $host $hand $chan $chan1
  12644. }
  12645. }
  12646. show {
  12647. if {[matchattr $hand nm|OSMA $chan]} {
  12648. set wich [lindex [split $arg] 2]
  12649. set type 1
  12650. set chan1 "$chan"
  12651. if {[regexp {^[#&]} $wich] && [matchattr $hand nm|- $chan]} {
  12652. set chan "$wich"
  12653. set wich [lindex [split $arg] 3]
  12654. }
  12655. show:process $nick $host $hand $chan $chan1 $wich $type
  12656. }
  12657. }
  12658. reset {
  12659. if {[matchattr $hand nm|M $chan]} {
  12660. set dece [lindex [split $arg] 2]
  12661. set type 1
  12662. set chan1 "$chan"
  12663. if {[regexp {^[#&]} $dece] && [matchattr $hand nm|- $chan]} {
  12664. set chan "$dece"
  12665. set dece [lindex [split $arg] 3]
  12666. }
  12667. reset:process $nick $host $hand $chan $chan1 $dece $type
  12668. }
  12669. }
  12670. clonescan {
  12671. if {[matchattr $hand nm|M $chan]} {
  12672. set c [lindex [split $arg] 2]
  12673. set type 1
  12674. set chan1 "$chan"
  12675. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  12676. set chan "$c"
  12677. }
  12678. scanner:process $nick $host $hand $chan $chan1
  12679. }
  12680. }
  12681. top {
  12682. if {[matchattr $hand nm|AOSM $chan]} {
  12683. set cmd [lindex [split $arg] 2]
  12684. set del [lindex [split $arg] 2]
  12685. set type 1
  12686. set chan1 "$chan"
  12687. if {[regexp {^[#&]} $cmd] && [matchattr $hand nm|- $chan]} {
  12688. set chan "$cmd"
  12689. set cmd [lindex [split $arg] 3]
  12690. set del [lindex [split $arg] 3]
  12691. }
  12692. top:process $nick $host $hand $chan $chan1 $cmd $type $del
  12693. }
  12694. }
  12695. banlist {
  12696. if {[matchattr $hand nm|AOSM $chan]} {
  12697. set user [lindex [split $arg] 2]
  12698. set type 1
  12699. set chan1 "$chan"
  12700. if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
  12701. set chan "$user"
  12702. set user [lindex [split $arg] 3]
  12703. }
  12704. banlist:process $nick $host $hand $chan $chan1 $user $type
  12705. }
  12706. }
  12707. stats {
  12708. if {[matchattr $hand nm|AOSM $chan]} {
  12709. set chan1 "$chan"
  12710. set c [lindex [split $arg] 2]
  12711. if {[regexp {^[#&]} $c] && [matchattr $hand nm|- $chan]} {
  12712. set chan "$c"
  12713. }
  12714. stats:process $nick $host $hand $chan $chan1
  12715. }
  12716. }
  12717. myset {
  12718. if {[matchattr $hand nm|VAOSM $chan]} {
  12719. set chan1 "$chan"
  12720. set flags [lindex [split $arg] 2]
  12721. set type [lindex [split $arg] 3]
  12722. if {$type == ""} {
  12723. blacktools:tell $nick $host $hand $chan $chan1 myset.4 none
  12724. return 0
  12725. }
  12726. myset:process $nick $host $hand $chan $chan1 $flags $type
  12727. }
  12728. }
  12729. i {
  12730. if {[matchattr $hand nm|VAOSM $chan]} {
  12731. set type 1
  12732. set chan1 "$chan"
  12733. set inick [lrange [split $arg] 2 end]
  12734. set c [lindex [split $arg] 2]
  12735. if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
  12736. set chan "$c"
  12737. set inick [join [lrange [split $arg] 3 end]]
  12738. }
  12739. i:process $nick $host $hand $chan $chan1 $inick $type
  12740. }
  12741. }
  12742. addinfo {
  12743. if {[matchattr $hand nm|VAOSM $chan]} {
  12744. set info [join [lrange [split $arg] 2 end]]
  12745. set chan1 "$chan"
  12746. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  12747. return 0
  12748. }
  12749. if {$info == ""} {
  12750. blacktools:tell $nick $host $hand $chan $chan1 addinfo.2 none
  12751. return 0
  12752. }
  12753. addinfo:process $nick $host $hand $chan $chan1 $info
  12754. }
  12755. }
  12756. badword {
  12757. if {[matchattr $hand nm|M $chan]} {
  12758. set why [lindex [split $arg] 2]
  12759. set type 1
  12760. set chan1 "$chan"
  12761. set bdword [lrange [split $arg] 3 end]
  12762. set bdnumber [lindex [split $arg] 3]
  12763. if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
  12764. set chan "$why"
  12765. set why [lindex [split $arg] 3]
  12766. set bdnumber [lindex [split $arg] 4]
  12767. set bdword [lrange [split $arg] 4 end]
  12768. }
  12769. antibadword:command:process $nick $host $hand $chan $chan1 $why $bdword $bdnumber $type
  12770. }
  12771. }
  12772. }
  12773. }
  12774. }
  12775. putlog "$black(name) $black(vers) by $black(author) Loaded -> BLaCkShaDoW ProductionS ®"