| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637 |
- ###########################################################################
- # ® BLaCkShaDoW ProductionS ® #
- # #
- # Presents #
-
- #### # #### ##### # # ##### ##### #### # #####
- # # # # # # # # # # # # # # #
- # # # # # # # # # # # # # # #
- ## # # ###### # ## # # # # # # #####
- # # # # # # # # # # # # # # #
- # # # # # # # # # # # # # # #
- #### ##### # # ##### # # # ##### #### ##### #####
-
- # #
- # #
- # ##### ##### #
- # # # #
- # # # #
- # #### ##### #
- # # # #
- # # # #
- # ##### # ##### #
- # #
- # #
- # THE NEXT GENERATION TCL #
- # #
- # - #TCL-HELP @ UNDERNET - WwW.TclScripts.Net - #
- ###########################################################################
- #A Next Generation Channel Control Script that contains a lot of commands #
- #modules, and protections that make`s your life easy for you and for your #
- # Eggdrop. #
- ###########################################################################
- # #
- # Many thanks for without this script wouldn't got this far to: #
- # #
- # Time2Go@Oradea(#Bihor Admin) #
- # #
- # Offcourse i thanks all the users who participate with ideas, #
- # opinions, which took the script to this version. #
- # #
- # cola @ #Tcl-Help btw @ #ialomita #
- # #
- # Cacique @ #mures bandyt @ #bandyt #
- # #
- ###########################################################################
- #
- #Please specify the folder name that contains the BlackTools.tcl and the lang
- #folder (Default "scripts")
- #
- set black(dirname) "scripts"
- #
- ###########################################################################
- #First Char ( "- . !" ) - ( "none" ) (for no char)
- #
- set black(cmdchar) ". !"
- #
- ###########################################################################
-
- #-------------------------- Default Language -----------------------------#
- #Default language ( RO / EN )
- set black(default_lang) "RO"
- #-------------------------------------------------------------------------#
- #----------------------------- Max Handle --------------------------------#
- #Max Handle ( 1 - for handle < 9 ; 0 - for handle > 9 )
- set black(maxhand) "0"
- #-------------------------------------------------------------------------#
- #######################################################################
- # #
- # Command Help - h - Command Help #
- # #
- #######################################################################
- #---------------------------------------------------------------------#
- #######################################################################
- # Chanserv Name
- #
- set black(chanserv) "X"
- #
- #######################################################################
- #---------------------------------------------------------------------#
- #######################################################################
- # #
- #---------------------------------------------------------------------#
- # #
- #######################################################################
-
- #------------------------- Chanserv Login ----------------------------#
- #Login On Connect ( 1 - ON ; 0 - OFF)
- set black(logonconect) "1"
-
- #------------------------- Chanserv User ----------------------------##
-
- set black(username) "username"
-
- #------------------------- Chanserv Pass ----------------------------##
-
- set black(password) "password"
- #------------------------- Login Command ----------------------------##
- set black(login) "PRIVMSG x@channels.undernet.org :login $black(username) $black(password)"
-
- #--------------------------- Login Mode ------------------------------##
-
- set black(xmod) "+x"
-
- #######################################################################
- # #
- #---------------------------------------------------------------------#
- # #
- #######################################################################
- #---------------------------------------------------------------------#
- ################################# add #################################
- #
- # add <level> <user> (level : manager,admin,senior,op voice)
- #
- #######################################################################
- #Default Hostname for - add <user> command -
- set black(hostadd) "*!*@%user%.users.undernet.org"
- #######################################################################
- #
- #
- # Protection
- #
- #
- #
- #######################################################################
- #Op Protect (1 - ON ; 0 - OFF)
- set black(vprotect) "1"
- #VOICE Protect (1 - ON ; 0 - OFF)
- set black(oprotect) "1"
- #######################################################################
- #
- # Antipub Protection
- #
- #
- #
- #######################################################################
- #Ban-Time
- set black(antipubbantime) "2880"
- #Words
- set black(antipubword) {
- "*#*"
- "*www.*"
- "*http://*"
- "*.ro"
- "*.com"
- "*/server*"
- }
- #Ban-Mode
- set black(antipubmode) "m"
- #Ban-mode Time (Seconds)
- set black(antipubsecunde) "5"
- #######################################################################
- #
- # AntiNotice Protection
- #
- #
- #######################################################################
- #Ban-Time
- set black(antinoticebantime) "2880"
- #Ban-Mode
- set black(antinoticemode) "mr"
- #Ban-mode Time (Seconds)
- set black(antinoticesecunde) "7"
- #######################################################################
- #
- # AntiCTCP Protection
- #
- #
- #######################################################################
- #Ban-Time
- set black(antictcpbantime) "2880"
- #Ban-Mode
- set black(antictcpmode) "mr"
- #Ban-mode Time (Seconds)
- set black(antictcpsecunde) "8"
- #######################################################################
- #
- # AntiBadWord Protection
- #
- #
- #######################################################################
- #Ban-Time
- set black(antibadwordbantime) "360"
- #Words
- set black(antibadword) {
- "*pula*"
- "*pizda*"
- "*muie*"
- "*sugi"
- "mwie"
- "*pwla*"
- "*muisti*"
- "*fut*"
- "*fwt*"
- "tarfa"
- }
- #######################################################################
- #
- # AntiLongText Protection
- #
- #
- #######################################################################
- #Char length
- set black(longchar) "400"
- #Ban-Time
- set black(longbantime) "30"
- #Ban-Mode
- set black(longmode) "mr"
- #Ban-mode Time (Seconds)
- set black(longtimemode) "10"
- #######################################################################
- #
- # AntiBAdQuitPart Protection
- #
- #
- #######################################################################
- #Ban-Time
- set black(badquitparttime) "60"
- #Words
- set black(badquitpartwords) {
- "*www.*"
- "*http://*"
- "*#*"
- }
- #Ban on COLORS (1 - ON ; 0 - OFF)
- set black(badquitpartcolour) "1"
- #######################################################################
- #
- # Protectia AntiJoinPart
- #
- #
- #######################################################################
- #Ban-Time
- set black(joinpartbantime) "30"
- #Stay-Time
- set black(joinparttime) "2"
- #Ban-Mode
- set black(joinpartmode) "mr"
- #Ban-Mode Time (Seconds)
- set black(joinparttimemode) "10"
- #######################################################################
- #
- # AntiSpam Protection
- #
- #
- #######################################################################
- #Ban-Time
- set black(spamban) "2880"
- #Words
- set black(spamword) {
- "*#*"
- "*www.*"
- "*http://*"
- }
- #Cycle-Time
- set black(spamcycle) "30"
- #ON-JOIN Message ( 1 - ON ; 0 - OFF)
- set black(spamreq) "1"
- #Part Message
- set black(spammsgcycle) "Checking for spam.."
- #######################################################################
- #
- # AntiRepeat Protection
- #
- #
- #######################################################################
- #Repeat Setting (number repeats:seconds)
- set black(repeats) "3:5"
- #Ban-Type (1 - KICK -> BAN ; 0 - BAN )
- set black(antirepeattype) "1"
- #Ban-Time
- set black(antirepeatbantime) "10"
- #######################################################################
- #
- # Anticolor Protection
- #
- #
- #######################################################################
- #Ban-Type (1 - KICK -> BAN ; 0 - BAN )
- set black(anticolortype) "1"
- #Ban-Time
- set black(anticolorbantime) "10"
- #######################################################################
- #
- # AntiBold Protection
- #
- #
- #######################################################################
- #Ban-Type (1 - KICK -> BAN ; 0 - BAN )
- set black(antiboldtype) "1"
- #Ban-Time
- set black(antiboldbantime) "10"
- #######################################################################
- #
- # AntiUnderline Protection
- #
- #
- #######################################################################
- #Ban-Type (1 - KICK -> BAN ; 0 - BAN )
- set black(antiunderlinetype) "1"
- #Ban-Time
- set black(antiunderlinebantime) "10"
- #######################################################################
- #
- # AntiCaps Protection
- #
- #
- #######################################################################
- #Ban-Type (1 - KICK -> BAN ; 0 - BAN )
- set black(anticapstype) "1"
- #Caps Char Length
- set black(anticapscount) "40"
- #Ban-Time
- set black(anticapsbantime) "10"
- #######################################################################
- #
- # BadFullName Protection
- #
- #
- #######################################################################
- #Ban-Time
- set black(badfbantime) "60"
- #Words
- set black(badfwords) {
- "*www.*"
- "*#*"
- "*http://*"
- }
- #######################################################################
- #
- # BadNick Protection
- #
- #
- #######################################################################
- #Ban-Time
- set black(badnickbantime) "60"
- #Words
- set black(badnickwords) {
- "*pula*"
- "*muie *"
- "pwla*"
- "pizda*"
- "laba*"
- }
- #######################################################################
- #
- # BadIdent Protection
- #
- #
- #######################################################################
- #Ban-Time
- set black(badidentbantime) "60"
- #Words
- set black(badidentwords) {
- "*pula*"
- "*muie *"
- "pwla*"
- "pizda*"
- "laba*"
- }
- #######################################################################
- #
- # AntiJoinFlood Protection
- #
- #
- #######################################################################
- #Join-Mode
- set black(modes) "mir"
- #Join-Mode Time (Seconds)
- set black(nomodetime) "15"
- #Op ALERT (1 - ON ; 0 - OFF)
- set black(fjoinhow) "1"
- #######################################################################
- #
- # AntiChanFlood Protection
- #
- #
- #######################################################################
- #Ban-Type (1 - KICK -> BAN ; 0 - BAN )
- set black(antifloodchantype) "1"
- #Ban-Time
- set black(antifloodchanbantime) "10"
- #######################################################################
- #
- # Module
- #
- #
- #######################################################################
- #######################################################################
- #
- # Topic refresh
- #
- #
- #######################################################################
- #Refresh Time
- set black(topic_time) "60"
- #Standard Topic
- set black(topics) "Reloading topic..."
- ########################################################################
- #
- # Count
- #
- # count <on> / <off> / <display> / <reset>
- #
- #######################################################################
- #MSg Type ( 1 - NOTICE ; 0 - PRIVMSG )
- set black(counthow) "1"
- #######################################################################
- #
- # BadChan
- #
- # badchan | <on> | <off> | add | del | | list |
- #
- #######################################################################
- #Ban-Time
- set black(badcbantime) "360"
- #User Message ( 1 - ON ; 0 - OFF)
- set black(badcwhyreason) "1"
- ########################################################################
- #
- # Anunt
- #
- # Anunt <on> | <off> | <add> | <list> | <del>
- #
- #######################################################################
- #Anunt Time ( 60 min max )
- set black(anunttime) "45"
- #MSg Type ( 1 - ACTION ; 0 - PRIVMSG )
- set black(anunthow) "0"
- ########################################################################
- #
- # AutoBroadcast
- #
- # bt <on> | <off> | <add> | <list> | <del>
- #
- #######################################################################
- #BRoadcast Time
- set black(bttime) "60"
- #MSg Type ( 1 - ACTION ; 0 - PRIVMSG )
- set black(bthow) "1"
- #######################################################################
- #
- # CloneScan
- #
- #
- #######################################################################
- #Max Clones
- set black(maxclone) "2"
- #Ban-Type ( 0 - OP Message ; 1 - Ban )
- set black(what) "0"
- #Ban-Time
- set black(clonebtime) "180"
- #######################################################################
- #
- # AntiBoTidle
- #
- #
- #######################################################################
- #Random Object
- set black(noobject) "blacky:P"
- #Max Idle
- set black(noidlemax) "10"
- #######################################################################
- #
- # Seen
- #
- # seen <host> / <nick>
- #
- #######################################################################
- #Flood-Protection (searches : seconds)
- set black(seenflood) "4:5"
- #MSg Type ( 1 - NOTICE ; 0 - PRIVMSG )
- set black(seenmet) "1"
- ########################################################################
- #
- # Greet
- #
- # greet <on> | <off> | <add> | <list> | <del>
- #
- #######################################################################
- #MSg Type ( 1 - NOTICE ; 0 - PRIVMSG )
- set black(howgreet) "1"
- ########################################################################
- #
- # Leave
- #
- # leave <on> | <off> | <add> | <list> | <del>
- #
- #######################################################################
- #MSg Type ( 1 - NOTICE ; 0 - PRIVMSG )
- set black(howleave) "0"
- ########################################################################
- #
- # idle
- #
- #
- # idle <on> | <off> | voice <on>/<off> | op <on>/<off> | add <nick>
- #
- #######################################################################
- #Idle Scan Time
- set black(idleinterval) "60"
- #Op max idle
- set black(idleopmax) "30"
- #Voice idle Max
- set black(idlevoicemax) "60"
- ########################################################################
- #
- # Private
- #
- #
- # private <on> | <off> | <add> <user> | <list> | del <nume>
- #
- #######################################################################
- #Ban-Time
- set black(privatebantime) "10"
- #######################################################################
- #
- #
- # Commands
- #
- #
- #######################################################################
- #######################################################################
- #
- # dr <nick> / <host>
- #
- #######################################################################
- #Ban-Time
- set black(drtime) "20160"
- #######################################################################
- #
- # bot <nick> / <host>
- #
- #######################################################################
- #Ban-Time
- set black(bottime) "10160"
- ########################################################################
- #
- # b <nick> / <host>
- #
- #######################################################################
- #Ban-Time
- set black(btime) "2880"
- #######################################################################
- #
- # n <nick>
- #
- #######################################################################
- #Ban-Time
- set black(ntime) "120"
- ######################################################################
- #
- # id <nick>
- #
- ######################################################################
- #Ban-Time
- set black(idtime) "120"
- ######################################################################
- #
- # spam <nick> / <host> (pentru spammeri)
- #
- ######################################################################
- #Ban-Time
- set black(spamtime) "10080"
- ######################################################################
- #
- # k <nick> <reason>
- #
- ######################################################################
- #Access Except ( 1 - ON ; 0 - OFF )
- set black(kaccess) "1"
- #######################################################################
- #
- # bw <nick> / <host> ( bad word)
- #
- #######################################################################
- #Ban-Time
- set black(bwtime) "360"
- ########################################################################
- #
- # stick <nick> / <host> <timp> <motiv>
- #
- ########################################################################
- #Ban-Time
- set black(dfstickbantime) "5040"
- ########################################################################
- #
- # l <seconds>
- #
- ########################################################################
- #Mode Type
- set black(lmode) "m"
- ########################################################################
- #
- # ul
- #
- ########################################################################
- #Mode Type
- set black(ulmodes) "mir"
- ########################################################################
- #
- #
- # This is the END !
- #
- #
- ########################################################################
- set black(exceptflags) "nm|HAMOVSo"
- setudef flag antipub
- setudef flag antinotice
- setudef flag antictcp
- setudef flag antilongtext
- setudef flag antibadword
- setudef flag antijoinpart
- setudef flag antispam
- setudef flag antirepeat
- setudef flag badquitpart
- setudef flag anticolor
- setudef flag antibold
- setudef flag antiunderline
- setudef flag anticaps
- setudef flag badfullname
- setudef flag badnick
- setudef flag badident
- setudef flag antijoinflood
- setudef flag antichanflood
- setudef flag xtools
- setudef flag topicrefresh
- setudef flag count
- setudef flag antibadchan
- setudef flag anunt
- setudef flag limit
- setudef flag refresh
- setudef flag clonescan
- setudef flag seen
- setudef flag antidle
- setudef flag antividle
- setudef flag antididle
- setudef flag autoop
- setudef flag autovoice
- setudef flag leave
- setudef flag chanreport
- setudef flag topwords
- setudef flag xban
- setudef flag protectop
- setudef flag protectvoice
- setudef flag dontop
- setudef flag dontdeop
- setudef flag private
- setudef flag silent
- setudef flag showtime
- setudef flag showhandle
- setudef flag showcount
- setudef int idlevoicemax
- setudef int idleopmax
- setudef int countnumber
- setudef int kickcount
- setudef int xbantime
- setudef int xbanlevel
- setudef int blacklimit
- setudef str backchan
- #Motive / Bantime
- #Protection
- setudef str antipub-reason
- setudef int antipub-bantime
- setudef str antinotice-reason
- setudef int antinotice-bantime
- setudef str antictcp-reason
- setudef int antictcp-bantime
- setudef str antibadword-reason
- setudef int antibadword-bantime
- setudef str antilongtext-reason
- setudef int antilongtext-bantime
- setudef str antibadquitpart-reason
- setudef int antibadquitpart-bantime
- setudef str antijoinpart-reason
- setudef int antijoinpart-bantime
- setudef str antispam-reason
- setudef int antispam-bantime
- setudef str antispam-message
- setudef str antirepeat-reason
- setudef int antirepeat-bantime
- setudef str anticolor-reason
- setudef int anticolor-bantime
- setudef str antibold-reason
- setudef int antibold-bantime
- setudef str antiunderline-reason
- setudef int antiunderline-bantime
- setudef str anticaps-reason
- setudef int anticaps-bantime
- setudef str badfullname-reason
- setudef int badfullname-bantime
- setudef str badnick-reason
- setudef int badnick-bantime
- setudef str badident-reason
- setudef int badident-bantime
- setudef str antichanflood-reason
- setudef int antichanflood-bantime
- setudef str joinflood
- setudef str chanflood
- setudef int private-bantime
- setudef str private-reason
- setudef int antilongtextmax
- setudef str antirepeat-setting
- #commands
- setudef str dr-reason
- setudef int dr-bantime
- setudef str n-reason
- setudef int n-bantime
- setudef int b-bantime
- setudef str id-reason
- setudef int id-bantime
- setudef str w-reason
- setudef str spam-reason
- setudef int spam-bantime
- setudef str bw-reason
- setudef int bw-bantime
- setudef int bot-bantime
- setudef str bot-reason
- #module
- setudef str badchan-reason
- setudef int badchan-bantime
- setudef str count-message
- setudef str lang
- if {$black(logonconect) == "1"} {
- bind evnt - init-server loginpublic
- }
- bind pubm - * topwordspublic
- bind pubm - * antipub:protect
- bind ctcp - ACTION antipub:protect:me
- bind notc - * antinotice:protect
- bind ctcp - * antictcp:protect
- bind pubm - * antibadword:protect
- bind ctcp - ACTION antibadword:protect:me
- bind pubm - * antilongtext:protect
- bind ctcp - ACTION antilongtext:protect:me
- bind part - * antipubpart:protect
- bind sign - * antipubsign:protect
- bind part - * anticolorpart:protect
- bind sign - * anticolorquit:protect
- bind part - * antijoinpart:protect
- bind join - * antispam:protect:msg
- bind msgm - * antispam:protect
- bind time - * antispam:protect:cycle
- bind time - "30 * * * *" clonescanner
- bind time - "* * * * *" limit:timer
- bind pubm - * antirepeat:protect
- bind pubm - * antifloodchan:protect
- bind ctcp - version blackreply
- bind ctcp - ACTION antirepeat:protect:me
- bind ctcp - ACTION antifloodchan:protect:me
- bind pubm - * anticolor:protect
- bind ctcp - ACTION anticolor:protect:me
- bind pubm - * antibold:protect
- bind ctcp - ACTION antibold:protect:me
- bind pubm - * antiunderline:protect
- bind ctcp - ACTION antiunderline:protect:me
- bind pubm - * anticaps:protect
- bind ctcp - ACTION anticaps:protect:me
- bind join - * badfullname:protect:join
- bind join - * badnick:protect:join
- bind join - * badident:protect:join
- bind nick - * badnick:protect:change
- bind mode - "*+b*" protectpublic
- bind join - * joinflood:protect
- bind join - * rebanpublic
- bind need - * toolspublic
- bind join - * countpublic:join
- bind join - * badchanpublic:join
- bind join - * seen:join
- bind part - * seen:part
- bind sign - * seen:sign
- bind kick - * seen:kick
- bind splt - * seen:split
- bind nick - * seen:changenick
- bind join - * greetpublic:join
- bind part - * leavepublic:part
- bind time - * idlewhoispublic
- bind evnt - init-server setaway
- bind join - * autovonjoin
- bind join - * autoponjoin
- bind join - * addopjoin
- bind join - * addvoicejoin
- bind join - * private:module
- bind join - * timeban:module
- bind ctcr mn|MOSAV PING pingpublic
- bind ctcr - VERSION ctcpvers
- bind mode - *+o* dontoppublic
- bind mode - *-o* dontdeoppublic
- bind pubm nm|MmvVNnoOSA * comand:pubme
- foreach black(char) $black(cmdchar) {
- if {[string match -nocase "$black(char)" "none"]} {
- set black(char) ""
- }
- bind pub nm|MAS $black(char)clonescan scannerpublic
- bind pub nm|MASO $black(char)r refreshpublic
- bind pub nm|M $black(char)count countpublic
- bind pub nm|M $black(char)badchan badchanpublic
- bind pub nm|M $black(char)badword antibadword:command:public
- bind pub nm|M $black(char)anunt anuntpublic
- bind pub nm|M $black(char)limit limitpublic
- bind pub nm|M $black(char)topic topicpublic
- bind pub -|- $black(char)seen seenpublic
- bind pub nm|M $black(char)greet greetpublic
- bind pub nm|M $black(char)leave leavepublic
- bind pub nm|M $black(char)idle antidlepublic
- bind pub nm|OSMA $black(char)dr drpublic
- bind pub nm|OSMA $black(char)bot botpublic
- bind pub nm|OSMA $black(char)b bpublic
- bind pub nm|OSMA $black(char)n npublic
- bind pub nm|OSMA $black(char)id idpublic
- bind pub nm|SMA $black(char)black blackpublic
- bind pub nm|SMA $black(char)bl blackpublic
- bind pub nm|VOSMA $black(char)w wpublic
- bind pub nm|OSMA $black(char)spam spampublic
- bind pub nm|VOSMA $black(char)k kpublic
- bind pub nm|OSMA $black(char)bw bwpublic
- bind pub nm|OSMA $black(char)ub ubpublic
- bind pub nm|VOSMA $black(char)sb sbpublic
- bind pub nm|SMA $black(char)d dpublic
- bind pub nm|SMA $black(char)stick stickpublic
- bind pub nm|VOSMA $black(char)t tpublic
- bind pub nm|M $black(char)show showpublic
- bind pub nm|- $black(char)status statuspublic
- bind pub nm|- $black(char)channels channelspublic
- bind pub nm|- $black(char)chat chatpublic
- bind pub nm|- $black(char)uptime uptimepublic
- bind pub nm|VOSMA $black(char)i ipublic
- bind pub nm|VOSMA $black(char)addinfo addinfopublic
- bind pub nm|VOSMA $black(char)v vpublic
- bind pub nm|VOSMA $black(char)myset mysetpublic
- bind pub nm|OSMA $black(char)o opublic
- bind pub nm|VOSMA $black(char)l lpublic
- bind pub nm|VOSMA $black(char)ul ulpublic
- bind pub nm|SMA $black(char)say saypublic
- bind pub nm|SMA $black(char)act actpublic
- bind pub nm|- $black(char)broadcast broadcastpublic
- bind pub nm|OSMA $black(char)check checkpublic
- bind pub nm|VOSMA $black(char)version versionpublic
- bind pub nm|OSMA $black(char)cycle cyclepublic
- bind pub nm|- $black(char)away awaypublic
- bind pub nm|M $black(char)private privatepublic
- bind pub nm|OSMA $black(char)mode modepublic
- bind pub nm|M $black(char)set setpublic
- bind pub nm|- $black(char)silence silencepublic
- bind pub nm|- $black(char)msg msgpublic
- bind pub nm|MA $black(char)add publicadd
- bind pub nm|MA $black(char)adduser adduserpublic
- bind pub nm|MA $black(char)delacc delaccpublic
- bind pub nm|- $black(char)del delpublic
- bind pub nm|- $black(char)ignore ignorepublic
- bind pub nm|- $black(char)botidle botidlepublic
- bind pub nm|M $black(char)addhost addhostpublic
- bind pub nm|M $black(char)delhost delhostpuplic
- bind pub nm|OSMA $black(char)banlist banlistpublic
- bind pub nm|M $black(char)purge purgepublic
- bind pub nm|M $black(char)chuser chuserpublic
- bind pub nm|MASOV $black(char)userlist publicuserlist
- bind pub nm|MASOV $black(char)info infopublic
- bind pub nm|MA $black(char)s spublic
- bind pub nm|MA $black(char)us uspublic
- bind pub nm|MAOSV $black(char)ping pings
- bind pub nm|MASOV $black(char)time timepublic
- bind pub nm|MAOSV $black(char)vers verspublic
- bind pub nm|MAOSV $black(char)whois whoispublic
- bind pub nm|MAOS $black(char)gag gagpublic
- bind pub nm|M $black(char)reset resetpublic
- bind pub nm|M $black(char)clear clearpublic
- bind pub nm|- $black(char)addbot addbotpublic
- bind pub nm|M $black(char)addop addoppublic
- bind pub nm|M $black(char)addvoice addvoicepublic
- bind pub nm|M $black(char)delop deloppublic
- bind pub nm|M $black(char)delvoice delvoicepublic
- bind pub nm|- $black(char)addmyhost addmyhostpublic
- bind pub nm|- $black(char)delmyhost delmyhostpublic
- bind pub nm|VOSAM $black(char)activ activpublic
- bind pub nm|MASOV $black(char)h hpublic
- bind pub nm|MASO $black(char)cc ccpublic
- bind pub nm|MAOSV $black(char)top toppublic
- bind pub nm|M $black(char)secure securepublic
- bind pub nm|- $black(char)bt broadcastpublic:module
- bind pub nm|- $black(char)login publiclogin:Cmd
- bind pub nm|MASO $black(char)stats statspublic
- }
- bind msg nm|- addchan addchanpublic
- bind msg nm|- delchan delchanpublic
- bind msg nm|- suspend suspendpublic
- bind msg nm|- unsuspend unsuspendpublic
- bind msg nm|- nick nickpublic
- bind msg nm|- rehash rehashme
- bind msg nm|- restart restartme
- bind msg nm|- save saveme
- bind msg nm|- jump jumpme
- bind msg nm|- die dieme
- bind msg nm|OSAM op oppublic
- bind msg nm|OSAM deop deoppublic
- bind msg nm|OSAM voice voicepublic
- bind msg nm|OSAM devoice devoicepublic
- bind msg nm|OSAM invite invitepublic
- ##########################################################################
- #
- #
- # Dont try to modify if you dont know what are you doing !
- #
- #
- #########################################################################
- set black(name) "BlackToolS"
- set black(author) "BLaCkShaDoW"
- set black(vers) "2.3"
- set black(site) "WwW.TclScripts.Net"
- set sdir "$username.status.txt"
- set wdir "$username.away.txt"
- set seendir "$username.Seen.db"
- set statsdir "$username.stats.db"
- set bwordir "$username.bword.db"
- set black(loader_error) [catch {source $black(dirname)/lang/loader.tcl} black(loader_error_stats)]
- if {$black(loader_error) == "1"} {
- die "4BlackTools :I didnt find the 12loader.tcl in the 12lang folder. This file contains the language for the script.PLease load it."
- }
- if {![info exists anuntpublic:show_running]} {
- timer $black(anunttime) anuntpublic:show
- set anuntpublic:show_running 1
- }
- if {![info exists times_topic_running]} {
- timer $black(topic_time) times_topic
- set times_topic_running 1
- }
- if {![file exists $seendir]} {
- set file [open $seendir w]
- close $file
- }
- if {![file exists $sdir]} {
- set file [open $sdir w]
- close $file
- }
- if {![file exists $wdir]} {
- set file [open $wdir w]
- close $file
- }
- if {![file exists $bwordir]} {
- set file [open $bwordir w]
- close $file
- }
- if {![file exists $statsdir]} {
- set file [open $statsdir w]
- close $file
- }
- if {![info exists antibotidle:module_running]} {
- set file [open $sdir "r"]
- set database [read -nonewline $file]
- close $file
- set data [split $database "\n"]
- if {$data != ""} {
- foreach line $data {
- set type [lindex [split $line] 0]
- set stats [lindex [split $line] 1]
- if {($type == "antibotidle:module") && ($stats == "ON")} {
- timer $black(noidlemax) antibotidle:module
- }
- }
- }
- set antibotidle:module_running 1
- }
- if {![info exists broadcastpublic:show_running]} {
- set file [open $sdir "r"]
- set database [read -nonewline $file]
- close $file
- set data [split $database "\n"]
- if {$data != ""} {
- foreach line $data {
- set type [lindex [split $line] 0]
- set stats [lindex [split $line] 1]
- if {($type == "broadcastpublic:show") && ($stats == "ON")} {
- timer $black(bttime) broadcastpublic:show
- }
- }
- }
- set broadcastpublic:show_running 1
- }
- proc blacktools:tell:prv {nick host hand type arg} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set replace(%botnick%) $botnick
- set replace(%char%) $char(p)
- set replace(%msg%) [lrange [split $arg] 0 end]
- set replace(%msg.1%) [lindex [split $arg] 0]
- set replace(%msg.2%) [lindex [split $arg] 1]
- set replace(%msg.3%) [lindex [split $arg] 2]
- set replace(%msg.4%) [lrange [split $arg] 1 end]
- set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- if {[info exists black(say.$getlang.$type)]} {
- set reply [string map [array get replace] $black(say.$getlang.$type)]
- puthelp "PRIVMSG $nick :$reply"
- }
- }
- proc blacktools:tell {nick host hand chan chan1 type arg} {
- global black botnick
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set replace(%botnick%) $botnick
- set replace(%char%) $char(p)
- set replace(%chan%) $chan
- set replace(%msg%) [lrange $arg 0 end]
- set replace(%msg.set%) [lrange $arg 1 end]
- set replace(%msg.1%) [lindex $arg 0]
- set replace(%msg.2%) [lindex $arg 1]
- set replace(%msg.3%) [lindex $arg 2]
- set replace(%msg.4%) [lindex $arg 3]
- set replace(%msg.5%) [lrange $arg 4 end]
- set replace(%msg.6%) [lrange $arg 3 end]
- set replace(%msg.7%) [lrange $arg 2 end]
- set replace(%msg.8%) [lrange $arg 1 end]
- set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
- set getmethod [getuser $hand XTRA OUTPUT_TYPE]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- if {$getmethod == ""} { set getmethod "1" }
- if {[info exists black(say.$getlang.$type)]} {
- set reply [string map [array get replace] $black(say.$getlang.$type)]
- if {$getmethod == "1"} {
- putserv "NOTICE $nick :$reply"
- } else {
- putserv "PRIVMSG $chan1 :$reply"
- }
- }
- }
- proc blacktools:banner:1 {banmask botnick chan reason mode timer bantime} {
- global black
- if {[channel get $chan xban]} {
- set getcount [channel get $chan kickcount]
- set getxtime [channel get $chan xbantime]
- set getxlevel [channel get $chan xbanlevel]
- if {$getxlevel == "0"} { set getxlevel "100"}
- if {$getxtime == "0"} { set getxtime "1" }
- set kcount [expr $getcount +1]
- channel set $chan kickcount $kcount
- if {[channel get $chan showcount]} {
- set reason "$reason - $kcount -"
- } else {
- set reason "$reason"
- }
- putquick "MODE $chan +$mode" -next ;utimer $timer [list putquick "MODE $chan -$mode"]
- putquick "PRIVMSG $black(chanserv) :ban $chan $banmask $getxtime $getxlevel $reason"
- newchanban $chan $banmask $botnick $reason $bantime
- if {![channel get $chan chanreport]} {
- return 0
- }
- set backchan [channel get $chan backchan]
- if {$backchan == ""} {
- return 0
- }
- if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
- return 0
- }
- if {[info exists black($chan:anounce)]} {
- return 0
- }
- set black($chan:anounce) 1
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replace(%banmask%) $banmask
- set replace(%bantime%) $bantime
- set replace(%reason%) $reason
- set replace(%chan%) $chan
- puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
- } else {
- set getcount [channel get $chan kickcount]
- set kcount [expr $getcount +1]
- channel set $chan kickcount $kcount
- if {[channel get $chan showcount]} {
- set reason "$reason - $kcount -" } else {
- set reason "$reason" }
- putquick "MODE $chan +$mode" -next ;utimer $timer [list putquick "MODE $chan -$mode"]
- newchanban $chan $banmask $botnick $reason $bantime
- if {![channel get $chan chanreport]} {
- return 0
- }
- set backchan [channel get $chan backchan]
- if {$backchan == ""} {
- return 0
- }
- if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
- return 0
- }
- if {[info exists black($chan:anounce)]} {
- return 0
- }
- set black($chan:anounce) 1
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replace(%banmask%) $banmask
- set replace(%bantime%) $bantime
- set replace(%reason%) $reason
- set replace(%chan%) $chan
- puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
- }
- utimer 5 [list unset black($chan:anounce)]
- }
- proc blacktools:banner:2 {banmask botnick chan reason bantime} {
- global black
- if {[channel get $chan xban]} {
- set getcount [channel get $chan kickcount]
- set getxtime [channel get $chan xbantime]
- if {$getxtime == "0"} { set getxtime "1" }
- set getxlevel [channel get $chan xbanlevel]
- if {$getxlevel == "0"} { set getxlevel "100"}
- set kcount [expr $getcount +1]
- channel set $chan kickcount $kcount
- if {[channel get $chan showcount]} {
- set reason "$reason - $kcount -"
- } else {
- set reason "$reason"
- }
- putquick "PRIVMSG $black(chanserv) :ban $chan $banmask $getxtime $getxlevel $reason"
- newchanban $chan $banmask $botnick $reason $bantime
- if {![channel get $chan chanreport]} {
- return 0
- }
- set backchan [channel get $chan backchan]
- if {$backchan == ""} {
- return 0
- }
- if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
- return 0
- }
- if {[info exists black($chan:anounce)]} {
- return 0
- }
- set black($chan:anounce) 1
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replace(%banmask%) $banmask
- set replace(%bantime%) $bantime
- set replace(%reason%) $reason
- set replace(%chan%) $chan
- puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
- } else {
- set getcount [channel get $chan kickcount]
- set kcount [expr $getcount +1]
- channel set $chan kickcount $kcount
- if {[channel get $chan showcount]} {
- set reason "$reason - $kcount -" } else {
- set reason "$reason" }
- newchanban $chan $banmask $botnick $reason $bantime
- if {![channel get $chan chanreport]} {
- return 0
- }
- set backchan [channel get $chan backchan]
- if {$backchan == ""} {
- return 0
- }
- if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
- return 0
- }
- if {[info exists black($chan:anounce)]} {
- return 0
- }
- set black($chan:anounce) 1
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replace(%banmask%) $banmask
- set replace(%bantime%) $bantime
- set replace(%reason%) $reason
- set replace(%chan%) $chan
- puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
- }
- utimer 5 [list unset black($chan:anounce)]
- }
- proc blacktools:banner:3 {mask hand chan reason bantime type} {
- global black botnick
- if {[channel get $chan xban]} {
- set getcount [channel get $chan kickcount]
- set getxtime [channel get $chan xbantime]
- if {$getxtime == "0"} { set getxtime "1" }
- set getxlevel [channel get $chan xbanlevel]
- if {$getxlevel == "0"} { set getxlevel "100"}
- set getcount [channel get $chan kickcount]
- set kcount [expr $getcount +1]
- channel set $chan kickcount $kcount
- set countz [getuser $hand XTRA $type]
- if {$countz == ""} { set countz 0 }
- set counts [expr $countz + 1]
- setuser $hand XTRA $type $counts
- if {[channel get $chan showcount]} {
- set reason "$reason - $kcount -"
- } else {
- set reason "$reason"
- }
- putquick "PRIVMSG $black(chanserv) :ban $chan $mask $getxtime $getxlevel $reason"
- utimer 1 [list newchanban $chan $mask $hand $reason $bantime]
- putquick "MODE $chan +b $mask"
- if {![channel get $chan chanreport]} {
- return 0
- }
- set backchan [channel get $chan backchan]
- if {$backchan == ""} {
- return 0
- }
- if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
- return 0
- }
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replace(%banmask%) $mask
- set replace(%bantime%) $bantime
- set replace(%reason%) $reason
- set replace(%chan%) $chan
- puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
- } else {
- set getcount [channel get $chan kickcount]
- set kcount [expr $getcount +1]
- channel set $chan kickcount $kcount
- set countz [getuser $hand XTRA $type]
- if {$countz == ""} { set countz 0 }
- set counts [expr $countz + 1]
- setuser $hand XTRA $type $counts
- if {[channel get $chan showcount]} {
- set reason "$reason - $kcount -" } else {
- set reason "$reason" }
- newchanban $chan $mask $hand $reason $bantime
- putquick "MODE $chan +b $mask"
- if {![channel get $chan chanreport]} {
- return 0
- }
- set backchan [channel get $chan backchan]
- if {$backchan == ""} {
- return 0
- }
- if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
- return 0
- }
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replace(%banmask%) $mask
- set replace(%bantime%) $bantime
- set replace(%reason%) $reason
- set replace(%chan%) $chan
- puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
- }
- }
- proc blacktools:banner:4 {mask hand chan reason bantime type} {
- global black botnick
- if {[channel get $chan xban]} {
- set getcount [channel get $chan kickcount]
- set getxtime [channel get $chan xbantime]
- if {$getxtime == "0"} { set getxtime "1" }
- set getxlevel [channel get $chan xbanlevel]
- if {$getxlevel == "0"} { set getxlevel "100"}
- set getcount [channel get $chan kickcount]
- set kcount [expr $getcount +1]
- channel set $chan kickcount $kcount
- set countz [getuser $hand XTRA $type]
- if {$countz == ""} { set countz 0 }
- set counts [expr $countz + 1]
- setuser $hand XTRA $type $counts
- if {[channel get $chan showcount]} {
- set reason "$reason - $kcount -"
- } else {
- set reason "$reason"
- }
- putquick "PRIVMSG $black(chanserv) :ban $chan $mask $getxtime $getxlevel $reason"
- utimer 1 [list newchanban $chan $mask $hand $reason $bantime sticky]
- putquick "MODE $chan +b $mask"
- if {![channel get $chan chanreport]} {
- return 0
- }
- set backchan [channel get $chan backchan]
- if {$backchan == ""} {
- return 0
- }
- if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
- return 0
- }
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replace(%banmask%) $mask
- set replace(%bantime%) $bantime
- set replace(%reason%) $reason
- set replace(%chan%) $chan
- puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
- } else {
- set getcount [channel get $chan kickcount]
- set kcount [expr $getcount +1]
- channel set $chan kickcount $kcount
- set countz [getuser $hand XTRA $type]
- if {$countz == ""} { set countz 0 }
- set counts [expr $countz + 1]
- setuser $hand XTRA $type $counts
- if {[channel get $chan showcount]} {
- set reason "$reason - $kcount -" } else {
- set reason "$reason" }
- newchanban $chan $mask $hand $reason $bantime sticky
- putquick "MODE $chan +b $mask"
- if {![channel get $chan chanreport]} {
- return 0
- }
- set backchan [channel get $chan backchan]
- if {$backchan == ""} {
- return 0
- }
- if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
- return 0
- }
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replace(%banmask%) $mask
- set replace(%bantime%) $bantime
- set replace(%reason%) $reason
- set replace(%chan%) $chan
- puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
- }
- }
- ################################ antipub ###########################
- proc antipub:filter {str} {
- regsub -all -- {\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\037|\002|\026|\006|\007} $str "" str
- return $str
- }
- proc antipub:protect {nick host hand chan arg} {
- global black botnick
- set text [antipub:filter $arg]
- set handle [nick2hand $nick]
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan antipub-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.antipub.1)
- }
- set getbantime [channel get $chan antipub-bantime]
- if {$getbantime == "0"} { set getbantime $black(antipubbantime) }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set reason "$protectreason"
- set banmask *!*@[lindex [split $host @] 1]
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- if {![botisop $chan]} { return 0 }
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {[isbotnick $nick]} { return 0 }
- if { [channel get $chan antipub] } {
- foreach antipub [string tolower $black(antipubword)] {
- if {[string match -nocase $antipub $arg]} {
- blacktools:banner:1 $banmask $botnick $chan $reason $black(antipubmode) $black(antipubsecunde) $getbantime
- }
- }
- }
- }
- proc antipub:protect:me {nick host hand chan keyword arg} {
- global black
- antipub:protect $nick $host $hand $chan $arg
- }
- ############################### antinotice #############################
- proc antinotice:protect {nick host hand arg chan} {
- global black botnick
- set handle [nick2hand $nick]
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan antinotice-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.antinotice.1)
- }
- set getbantime [channel get $chan antinotice-bantime]
- if {$getbantime == "0"} { set getbantime $black(antinoticebantime) }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set banmask *!*@[lindex [split $host @] 1]
- set reason "$protectreason"
- if {![botisop $chan]} { return 0 }
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {[isbotnick $nick]} { return 0 }
- if {$chan == $botnick} { return 0 }
- if { [channel get $chan antinotice] } {
- blacktools:banner:1 $banmask $botnick $chan $reason $black(antinoticemode) $black(antinoticesecunde) $getbantime
- }
- }
- ############################## antictcp ################################
- proc antictcp:protect {nick host hand chan keyword arg} {
- global black botnick
- set handle [nick2hand $nick]
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan antictcp-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.antictcp.1)
- }
- set getbantime [channel get $chan antictcp-bantime]
- if {$getbantime == "0"} { set getbantime $black(antictcpbantime) }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set reason "$protectreason"
- set banmask *!*@[lindex [split $host @] 1]
- if {[string equal -nocase "action" $keyword] || [string equal -nocase "chat" $keyword]} {return 0}
- if {![botisop $chan]} { return 0 }
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {[isbotnick $nick]} { return 0 }
- if { [channel get $chan antictcp] } {
- blacktools:banner:1 $banmask $botnick $chan $reason $black(antictcpmode) $black(antictcpsecunde) $getbantime
- }
- }
- ############################## antibadword ################################
- proc antibadword:filter {str} {
- regsub -all -- {\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\037|\002|\026|\006|\007} $str "" str
- return $str
- }
- proc antibadword:protect {nick host hand chan arg} {
- global black botnick bwordir
- set handle [nick2hand $nick]
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan antibadword-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.antibadword.1)
- }
- set getbantime [channel get $chan antibadword-bantime]
- if {$getbantime == "0"} { set getbantime $black(antibadwordbantime) }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set text [antibadword:filter $arg]
- set reason "$protectreason"
- set banmask *!*@[lindex [split $host @] 1]
- if {![botisop $chan]} { return 0 }
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {[isbotnick $nick]} { return 0 }
- if {[channel get $chan antibadword]} {
- set file [open $bwordir "r"]
- set data [read -nonewline $file]
- close $file
- set lines [split $data "\n"]
- foreach word $lines {
- set c [lindex [split $word] 0]
- set w [lrange [split $word] 1 end]
- if {[string match -nocase $c $chan]} {
- if {[string match -nocase $w $text]} {
- blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
- }
- }
- }
- foreach antibadword [string tolower $black(antibadword)] {
- if {[string match -nocase $antibadword $text]} {
- blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
- }
- }
- }
- }
- proc antibadword:protect:me {nick host hand chan keyword arg} {
- global black
- antibadword:protect $nick $host $hand $chan $arg
- }
- ################################ badword ##################################
- proc antibadword:command:public {nick host hand chan arg} {
- global black botnick
- set why [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- set bdword [lrange [split $arg] 1 end]
- set bdnumber [lindex [split $arg] 1]
- if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
- set chan "$why"
- set why [lindex [split $arg] 1]
- set bdnumber [lindex [split $arg] 2]
- set bdword [lrange [split $arg] 2 end]
- }
- antibadword:command:process $nick $host $hand $chan $chan1 $why $bdword $bdnumber $type
- }
- proc antibadword:command:process {nick host hand chan chan1 why bdword bdnumber type} {
- global black bwordir botnick
- set i 0
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($why == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 badword.1 none
- return 0
- }
- if {($why == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 badword.2 none
- return 0
- }
- }
- if {($why == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 badword.3 none
- return 0
- }
- if {($why == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 badword.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- switch -exact -- [string tolower $why] {
- add {
- set file [open $bwordir a]
- puts $file "$chan $bdword"
- close $file
- blacktools:tell $nick $host $hand $chan $chan1 badword.5 $bdword
- }
- list {
- set file [open $bwordir "r"]
- set why [read -nonewline $file]
- close $file
- set data [split $why "\n"]
- if {$data == ""} {
- blacktools:tell $nick $host $hand $chan $chan1 badword.6 none
- blacktools:tell $nick $host $hand $chan $chan1 badword.7 none
- return 0
- }
- foreach word $data {
- set c [lindex [split $word] 0]
- set word [lrange [split $word] 1 end]
- if {[string match -nocase $chan $c]} {
- set foundchan 1
- set i [expr $i +1]
- blacktools:tell $nick $host $hand $chan $chan1 badword.6 none
- blacktools:tell $nick $host $hand $chan $chan1 badword.8 "4 $i. 12$word"
- }
- if {![info exists foundchan]} {
- blacktools:tell $nick $host $hand $chan $chan1 badword.6 none
- blacktools:tell $nick $host $hand $chan $chan1 badword.7 none
- }
- }
- }
- del {
- if {![regexp {^[0-9]} $bdnumber]} {
- blacktools:tell $nick $host $hand $chan $chan1 badword.9 $bdword
- return 0
- }
- set file [open $bwordir "r"]
- set data [read -nonewline $file]
- close $file
- set lines [split $data "\n"]
- foreach word $lines {
- set c [lindex [split $word] 0]
- if {[string match -nocase $c $chan]} {
- set i [expr $bdnumber - 1]
- set delete [lreplace $lines $i $i]
- set file [open $bwordir "w"]
- puts $file [join $delete "\n"]
- close $file
- }
- }
- set file [open $bwordir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $bwordir "w"]
- close $files
- }
- blacktools:tell $nick $host $hand $chan $chan1 badword.10 $bdnumber
- }
- }
- }
- ############################## AntiLongText ################################
- proc antilongtext:protect {nick uhost hand chan arg} {
- global black botnick
- set handle [nick2hand $nick]
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan antilongtext-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.antilongtext.1)
- }
- set getbantime [channel get $chan antilongtext-bantime]
- if {$getbantime == "0"} { set getbantime $black(longbantime) }
- set getlongchar [channel get $chan antilongtextmax]
- if {$getlongchar == "0"} { set getlongchar "$black(longchar)" }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set banmask "*!*@[lindex [split $uhost @] 1]"
- set reason "$protectreason"
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- if {![botisop $chan]} { return 0 }
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {[isbotnick $nick]} { return 0 }
- if {[string length $arg] >= $getlongchar} {
- if {[channel get $chan antilongtext]} {
- blacktools:banner:1 $banmask $botnick $chan $reason $black(longmode) $black(longtimemode) $getbantime
- }
- }
- }
- proc antilongtext:protect:me {nick host hand chan keyword arg} {
- global black
- antilongtext:protect $nick $host $hand $chan $arg
- }
- ############################ AntiBAdQuitPart ##############################
- set black(badcolors) {
- "*\x03*"
- "*\037*"
- "*\002*"
- }
- proc antipubpart:protect {nick host hand chan arg} {
- global botnick black
- set handle [nick2hand $nick]
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan antibadquitpart-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.antibadquitpart.1)
- }
- set getbantime [channel get $chan antibadquitpart-bantime]
- if {$getbantime == "0"} { set getbantime $black(badquitparttime) }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set banmask "*!*@[lindex [split $host @] 1]"
- set reason "$protectreason"
- if {[channel get $chan badquitpart]} {
- foreach word $black(badquitpartwords) {
- if {![botisop $chan]} { return 0 }
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {[isbotnick $nick]} { return 0 }
- if {[string match -nocase $word $arg]} {
- blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
- }
- }
- }
- }
- proc antipubsign:protect {nick host hand chan arg} {
- antipubpart:protect $nick $host $hand $chan $arg
- }
- proc anticolorpart:protect {nick host hand chan arg} {
- global botnick black
- set handle [nick2hand $nick]
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan antibadquitpart-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.antibadquitpart.1)
- }
- set getbantime [channel get $chan antibadquitpart-bantime]
- if {$getbantime == "0"} { set getbantime $black(badquitparttime) }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set banmask "*!*@[lindex [split $host @] 1]"
- set reason "$protectreason"
- if {[channel get $chan badquitpart]} {
- foreach color $black(badcolors) {
- if {![botisop $chan]} { return 0 }
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {[isbotnick $nick]} { return 0 }
- if {($black(badquitpartcolour) == "1") && [string match -nocase $color $arg]} {
- blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
- }
- }
- }
- }
- proc anticolorquit:protect {nick host hand chan arg} {
- anticolorpart:protect $nick $host $hand $chan $arg
- }
- ########################### AntiJoinPart #############################
- proc antijoinpart:protect {nick host hand chan arg} {
- global black botnick
- set handle [nick2hand $nick]
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan antijoinpart-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.antijoinpart.1)
- }
- set getbantime [channel get $chan antijoinpart-bantime]
- if {$getbantime == "0"} { set getbantime $black(joinpartbantime) }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set banmask "*!*@[lindex [split $host @] 1]"
- set reason "$protectreason"
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- if {[isbotnick $nick]} { return 0 }
- if {$chan == $botnick} { return 0 }
- if {[channel get $chan antijoinpart]} {
- if {[getchanjoin $nick $chan] >= [expr {[clock seconds]-$black(joinparttime)}]} {
- blacktools:banner:1 $banmask $botnick $chan $reason $black(joinpartmode) $black(joinparttimemode) $getbantime
- }
- }
- }
- proc spam:filter {str} {
- regsub -all -- {\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\037|\002|\026|\006|\007} $str "" str
- return $str
- }
- ############################# AntiSpam ##############################
- proc antispam:protect {nick uhost hand arg} {
- global botnick black
- set text [spam:filter $arg]
- set handle [nick2hand $nick]
- foreach spammer [string tolower $black(spamword)] {
- if {[string match -nocase $spammer $arg]} {
- foreach chans [channels] {
- if {![validchan $chans]} { return 0 }
- set getreason [channel get $chans antispam-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chans lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.antispam.1)
- }
- set getbantime [channel get $chans antispam-bantime]
- if {$getbantime == "0"} { set getbantime $black(spamban) }
- if {[onchan $nick $chans]} {
- if {[channel get $chans antispam]} {
- if {![botisop $chans]} { return 0 }
- if {[isbotnick $nick]} { return 0 }
- set banmask *!*@[lindex [split $uhost @] 1]
- set replace(%chan%) $chans
- set protectreason [string map [array get replace] $getreason]
- set reason "$protectreason"
- if {[matchattr $handle $black(exceptflags) $chans]} { return 0 }
- if {[isvoice $nick $chans] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chans] && ($black(oprotect) == "1")} { return 0 }
- blacktools:banner:2 $banmask $botnick $chans $reason $getbantime
- }
- }
- }
- }
- }
- }
- proc antispam:protect:msg {nick host hand chan } {
- global black
- if {![validchan $chan]} { return 0 }
- if {[channel get $chan antispam]} {
- if {[isbotnick $nick]} { return 0 }
- if {$black(spamreq) == "1"} {
- set getmsg [channel get $chan antispam-message]
- if {$getmsg == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getmsg $black(say.$getlang.antispam.2)
- }
- set replace(%nick%) $nick
- set replace(%chan%) $chan
- set spamsg [string map [array get replace] $getmsg]
- puthelp "PRIVMSG $nick :$spamsg"
- }
- }
- }
- proc antispam:protect:cycle {min hour day mon year} {
- global black
- if {([scan $min %d]+([scan $hour %d]*60)) % $black(spamcycle) == 0} {
- foreach chan [channels] {
- if { [channel get $chan antispam]} {
- putserv "PART $chan :$black(spammsgcycle)"; putserv "JOIN $chan"
- }
- }
- }
- }
- ############################## AntiRepeat ###############################
- proc antirepeat:protect {nick host hand chan arg} {
- global black botnick count
- set arg [join [split $arg]]
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan antirepeat-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.antirepeat.1)
- }
- set getbantime [channel get $chan antirepeat-bantime]
- if {$getbantime == "0"} { set getbantime $black(antirepeatbantime) }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set reason "$protectreason"
- set repeatset [channel get $chan antirepeat-setting]
- if {$repeatset == ""} { set repeatset "$black(repeats)" }
- set number [scan $repeatset %\[^:\]]
- set time [scan $repeatset %*\[^:\]:%s]
- set banmask *!*@[lindex [split $host @] 1]
- set handle [nick2hand $nick]
- foreach tmr [utimers] {
- if {[string match "*count(repeat:$host:$chan:$arg)*" [join [lindex $tmr 1]]]} {
- killutimer [lindex $tmr 2]
- }
- }
- if {[channel get $chan antirepeat]} {
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {![botisop $chan]} { return 0 }
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- if {[isbotnick $nick]} { return 0 }
- if {![info exists count(repeat:$host:$chan:$arg)]} {
- set count(repeat:$host:$chan:$arg) 0
- }
- if {![info exists count(repeat:$host:$chan)]} {
- set count(repeat:$host:$chan) 0
- }
- incr count(repeat:$host:$chan:$arg)
- utimer $time [list unset count(repeat:$host:$chan:$arg)]
- if {$count(repeat:$host:$chan:$arg) >= $number} {
- if {$black(antirepeattype) == "0"} { set count(repeat:$host:$chan) 2 }
- incr count(repeat:$host:$chan)
- if {$count(repeat:$host:$chan) == 1} {
- set getcount [channel get $chan kickcount]
- set kcount [expr $getcount +1]
- channel set $chan kickcount $kcount
- if {[channel get $chan showcount]} {
- set reason "$reason - $kcount -"
- } else {
- set reason "$reason"
- }
- putquick "KICK $chan $nick :$reason"
- }
- if {$count(repeat:$host:$chan) >= 2} {
- blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
- unset count(repeat:$host:$chan)
- }
- }
- }
- }
- proc antirepeat:protect:me {nick host hand chan keyword arg} {
- antirepeat:protect $nick $host $hand $chan $arg
- }
- ############################# AntiColor ################################
- proc anticolor:protect {nick host hand chan arg} {
- global black botnick count
- set arg [join [split $arg]]
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan anticolor-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.anticolor.1)
- }
- set getbantime [channel get $chan anticolor-bantime]
- if {$getbantime == "0"} { set getbantime $black(anticolorbantime) }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set reason "$protectreason"
- set banmask *!*@[lindex [split $host @] 1]
- set handle [nick2hand $nick]
- if {[channel get $chan anticolor]} {
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {![botisop $chan]} { return 0 }
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- if {[isbotnick $nick]} { return 0 }
- if {![info exists count(color:$host:$chan)]} {
- set count(color:$host:$chan) 0
- }
- if {[string match *\003* $arg]} {
- incr count(color:$host:$chan)
- if {$black(anticolortype) == "0" } { set count(color:$host:$chan) 2 }
- if {$count(color:$host:$chan) == 1} {
- set getcount [channel get $chan kickcount]
- set kcount [expr $getcount +1]
- channel set $chan kickcount $kcount
- if {[channel get $chan showcount]} {
- set reason "$reason - $kcount -"
- } else {
- set reason "$reason"
- }
- putquick "KICK $chan $nick :$reason"
- }
- if {$count(color:$host:$chan) == 2} {
- blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
- unset count(color:$host:$chan)
- }
- }
- }
- }
- proc anticolor:protect:me {nick host hand chan keyword arg} {
- anticolor:protect $nick $host $hand $chan $arg
- }
- ############################# AntiBold ################################
- proc antibold:protect {nick host hand chan arg} {
- global black botnick count
- set arg [split $arg]
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan antibold-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.antibold.1)
- }
- set getbantime [channel get $chan antibold-bantime]
- if {$getbantime == "0"} { set getbantime $black(antiboldbantime) }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set reason "$protectreason"
- set banmask *!*@[lindex [split $host @] 1]
- set handle [nick2hand $nick]
- if {[channel get $chan antibold]} {
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {![botisop $chan]} { return 0 }
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- if {[isbotnick $nick]} { return 0 }
- if {![info exists count(bold:$host:$chan)]} {
- set count(bold:$host:$chan) 0
- }
- if {[string match *\002* $arg]} {
- incr count(bold:$host:$chan)
- if {$black(antiboldtype) == "0" } { set count(bold:$host:$chan) 2 }
- if {$count(bold:$host:$chan) == 1} {
- set getcount [channel get $chan kickcount]
- set kcount [expr $getcount +1]
- channel set $chan kickcount $kcount
- if {[channel get $chan showcount]} {
- set reason "$reason - $kcount -"
- } else {
- set reason "$reason"
- }
- putquick "KICK $chan $nick :$reason"
- }
- if {$count(bold:$host:$chan) == 2} {
- blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
- unset count(bold:$host:$chan)
- }
- }
- }
- }
- proc antibold:protect:me {nick host hand chan keyword arg} {
- antibold:protect $nick $host $hand $chan $arg
- }
- ############################ AntiUnderline ###############################
- proc antiunderline:protect {nick host hand chan arg} {
- global black botnick count
- set arg [split $arg]
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan antiunderline-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.antiunderline.1)
- }
- set getbantime [channel get $chan antiunderline-bantime]
- if {$getbantime == "0"} { set getbantime $black(antiunderlinebantime) }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set reason "$protectreason"
- set banmask *!*@[lindex [split $host @] 1]
- set handle [nick2hand $nick]
- if {[channel get $chan antiunderline]} {
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {![botisop $chan]} { return 0 }
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- if {[isbotnick $nick]} { return 0 }
- if {![info exists count(underline:$host:$chan)]} {
- set count(underline:$host:$chan) 0
- }
- if {[string match *\037* $arg]} {
- incr count(underline:$host:$chan)
- if {$black(antiunderlinetype) == "0" } { set count(underline:$host:$chan) 2 }
- if {$count(underline:$host:$chan) == 1} {
- set getcount [channel get $chan kickcount]
- set kcount [expr $getcount +1]
- channel set $chan kickcount $kcount
- if {[channel get $chan showcount]} {
- set reason "$reason - $kcount -"
- } else {
- set reason "$reason"
- }
- putquick "KICK $chan $nick :$reason"
- }
- if {$count(underline:$host:$chan) == 2} {
- blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
- unset count(underline:$host:$chan)
- }
- }
- }
- }
- proc antiunderline:protect:me {nick host hand chan keyword arg} {
- antiunderline:protect $nick $host $hand $chan $arg
- }
- ############################## AntiCaps #################################
- proc anticaps:protect {nick host hand chan arg} {
- global black botnick count
- set handle [nick2hand $nick]
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan anticaps-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.anticaps.1)
- }
- set getbantime [channel get $chan anticaps-bantime]
- if {$getbantime == "0"} { set getbantime $black(anticapsbantime) }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set reason "$protectreason"
- set banmask *!*@[lindex [split $host @] 1]
- if {![info exists count(caps:$host:$chan)]} {
- set count(caps:$host:$chan) 0
- }
- if {[channel get $chan anticaps]} {
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {![botisop $chan]} { return 0 }
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- if {[isbotnick $nick]} { return 0 }
- set caps($nick:$host) 0
- foreach word [split $arg {}] {
- if [string match \[A-Z\] $word] {
- incr caps($nick:$host)
- }
- }
- if {$caps($nick:$host) == 0} {
- return 0
- }
- if {[string length $arg] < 20} {return 0}
- set capchar [string length $arg]
- set number $caps($nick:$host)/$capchar
- if {[expr 100 * $caps($nick:$host) / $capchar] > $black(anticapscount)} {
- incr count(caps:$host:$chan)
- if {$black(anticapstype) == "0" } { set count(caps:$host:$chan) 2 }
- if {$count(caps:$host:$chan) == 1} {
- set getcount [channel get $chan kickcount]
- set kcount [expr $getcount +1]
- channel set $chan kickcount $kcount
- if {[channel get $chan showcount]} {
- set reason "$reason - $kcount -"
- } else {
- set reason "$reason"
- }
- putquick "KICK $chan $nick :$reason"
- }
- if {$count(caps:$host:$chan) == 2} {
- blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
- unset count(caps:$host:$chan)
- }
- }
- }
- }
- proc anticaps:protect:me {nick host hand chan keyword arg} {
- anticaps:protect $nick $host $hand $chan $arg
- }
- ################################ BadIdent #################################
- proc badident:protect:join {nick host hand chan} {
- global black botnick
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan badident-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.badident.1)
- }
- set getbantime [channel get $chan badident-bantime]
- if {$getbantime == "0"} { set getbantime $black(badidentbantime) }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set reason "$protectreason"
- set ident "[string trimleft [string tolower [lindex [split $host "@"] 0]] "~"]"
- set banmask "*!*$ident@*"
- if {![validchan $chan]} { return 0 }
- if {[channel get $chan badident]} {
- if {![botisop $chan]} { return 0 }
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {[matchattr $hand $black(exceptflags) $chan]} { return 0 }
- foreach bit $black(badidentwords) {
- if {[string match -nocase $bit $ident]} {
- blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
- }
- }
- }
- }
- ############################## BadFullname ###############################
- proc badfullname:protect:join {nick host hand chan} {
- global botnick black
- set ::cchan $chan
- set ::nnick $nick
- set ::hhost $host
- set handle [nick2hand $nick]
- if { [channel get $chan badfullname] } {
- if {![botisop $chan]} { return 0 }
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- if {[onchan $nick $chan]} {
- putquick "WHOIS $nick $nick"
- bind RAW - 311 badfullname:protect
- }
- }
- }
- proc badfullname:protect { from keyword arguments } {
- global botnick black
- set chan $::cchan
- set nick $::nnick
- set host $::hhost
- set getreason [channel get $chan badfullname-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.badfullname.1)
- }
- set getbantime [channel get $chan badfullname-bantime]
- if {$getbantime == "0"} { set getbantime $black(badfbantime) }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set reason "$protectreason"
- set fullname [string range [join [lrange $arguments 5 end]] 1 end]
- if {[onchan $nick $chan]} {
- set banmask *!*@[lindex [split [getchanhost $nick $chan] "@"] 1]
- }
- foreach realname $black(badfwords) {
- if {[string match -nocase $realname $fullname]} {
- blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
- }
- }
- unbind RAW - 311 badfullname:protect
- }
- ################################ BadNick #################################
- proc badnick:protect:join {nick host hand chan} {
- global black botnick
- set handle [nick2hand $nick]
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan badnick-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.badnick.1)
- }
- set getbantime [channel get $chan badnick-bantime]
- if {$getbantime == "0"} { set getbantime $black(badnickbantime) }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set reason "$protectreason"
- set banmask "$nick*!*@*"
- if {![validchan $chan]} { return 0 }
- if {[channel get $chan badnick]} {
- if {![botisop $chan]} { return 0 }
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- foreach badnick [string tolower $black(badnickwords)] {
- if {[string match $badnick [string tolower $nick]]} {
- blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
- }
- }
- }
- }
- proc badnick:protect:change {nick host hand chan newnick} {
- global black botnick
- set handle [nick2hand $nick]
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan badnick-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.badnick.1)
- }
- set getbantime [channel get $chan badnick-bantime]
- if {$getbantime == "0"} { set getbantime $black(badnickbantime) }
- set replace(%chan%) $chan
- set protectreason [string map [array get replace] $getreason]
- set reason "$protectreason"
- set banmask "$newnick*!*@*"
- if {![validchan $chan]} { return 0 }
- if {[channel get $chan badnick]} {
- if {![botisop $chan]} { return 0 }
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- foreach badnick [string tolower $black(badnickwords)] {
- if {[string match $badnick [string tolower $newnick]]} {
- blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
- }
- }
- }
- }
- ########################### AntiJoinFlood ################################
- proc joinflood:protect {nick host hand chan} {
- global black count
- if {[channel get $chan antijoinflood]} {
- set getset [channel get $chan joinflood]
- if {$getset == ""} { set getset "4 5" }
- set number [lindex [split $getset] 0]
- set time [lindex [split $getset] 1]
- set replace(%chan%) $chan
- foreach tmr [utimers] {
- if {[string match "*count(joinflood:$chan)*" [join [lindex $tmr 1]]]} {
- killutimer [lindex $tmr 2]
- }
- }
- if {![info exists count(joinflood:$chan)]} {
- set count(joinflood:$chan) 0
- }
- incr count(joinflood:$chan)
- utimer $time [list unset count(joinflood:$chan)]
- if {$count(joinflood:$chan) >= "$number"} {
- if {![botisop $chan]} { return 0 }
- putquick "MODE $chan +$black(modes)" ; utimer $black(nomodetime) [list putquick "MODE $chan -$black(modes)"]
- if {$black(fjoinhow) == "1"} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getmessage $black(say.$getlang.antijoinflood.1)
- set message [string map [array get replace] $getmessage]
- puthelp "NOTICE @$chan :$message"
- }
- }
- }
- }
- ########################## Login ###############################
- proc loginpublic {my} {
- global botnick black
- putquick "$black(login)"
- putquick "MODE $botnick :$black(xmod)"
-
- }
- proc publiclogin:Cmd {nick host hand chan arg} {
- global botnick black
- putquick "$black(login)"
- putquick "MODE $botnick :$black(xmod)"
- blacktools:tell:prv $nick $host $hand login.1 $black(chanserv)
- }
- ########################### User Protection ################################
- proc protectpublic {nick host hand chan args} {
- global black
- set bans [lindex $args 1]
- if {![botisop $chan]} { return 0 }
- if {$bans == "*!*@*"} { putquick "MODE $chan -b $bans"
- return 0
- }
- set list [userlist $black(exceptflags) $chan]
- foreach user $list {
- set hosts [getuser $user hosts]
- foreach host $hosts {
- if {[string match -nocase $bans $host]} {
- putquick "MODE $chan -b $bans"
- if {[onchan $black(chanserv) $chan]} {
- putquick "PRIVMSG $black(chanserv) :unban $chan $bans"
- }
- }
- }
- }
- }
- ############################## AntiChanFlood ###############################
- proc antifloodchan:protect {nick host hand chan arg} {
- global black botnick count
- set arg [split $arg]
- if {![validchan $chan]} { return 0 }
- set getreason [channel get $chan antichanflood-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.antichanflood.1)
- }
- set getbantime [channel get $chan antichanflood-bantime]
- if {$getbantime == "0"} { set getbantime $black(antifloodchanbantime) }
- set replace(%chan%) $chan
- set getset [channel get $chan chanflood]
- if {$getset == ""} { set getset "4 5" }
- set protectreason [string map [array get replace] $getreason]
- set reason "$protectreason"
- set number [lindex [split $getset] 0]
- set time [lindex [split $getset] 1]
- set banmask *!*@[lindex [split $host @] 1]
- set handle [nick2hand $nick]
- foreach tmr [utimers] {
- if {[string match "*count(repeat:$host:$chan:flood)*" [join [lindex $tmr 1]]]} {
- killutimer [lindex $tmr 2]
- }
- }
- if {[channel get $chan antichanflood]} {
- if {[isvoice $nick $chan] && ($black(vprotect) == "1")} { return 0 }
- if {[isop $nick $chan] && ($black(oprotect) == "1")} { return 0 }
- if {![botisop $chan]} { return 0 }
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- if {[isbotnick $nick]} { return 0 }
- if {![info exists count(repeat:$host:$chan:flood)]} {
- set count(repeat:$host:$chan:flood) 0
- }
- if {![info exists count(repeat:$host:$chan)]} {
- set count(repeat:$host:$chan) 0
- }
- incr count(repeat:$host:$chan:flood)
- utimer $time [list unset count(repeat:$host:$chan:flood)]
- if {$count(repeat:$host:$chan:flood) >= $number} {
- if {$black(antifloodchantype) == "0"} { set count(repeat:$host:$chan) 2 }
- incr count(repeat:$host:$chan)
- if {$count(repeat:$host:$chan) == 1} {
- set getcount [channel get $chan kickcount]
- set kcount [expr $getcount +1]
- channel set $chan kickcount $kcount
- if {[channel get $chan showcount]} {
- set reason "$reason - $kcount -"
- } else {
- set reason "$reason"
- }
- putquick "KICK $chan $nick :$reason"
- }
- if {$count(repeat:$host:$chan) >= 2} {
- blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
- unset count(repeat:$host:$chan)
- }
- }
- }
- }
- proc antifloodchan:protect:me {nick host hand chan keyword arg} {
- antirepeat:protect $nick $host $hand $chan $arg
- }
- ################################# reban ################################
- proc rebanpublic {nick host hand chan} {
- global black
- if {[channel get $chan xban]} {
- set host "$nick![getchanhost $nick $chan]"
- set getxtime [channel get $chan xbantime]
- set getxlevel [channel get $chan xbanlevel]
- if {$getxlevel == "0"} { set getxlevel "100" }
- if {$getxtime == "0"} { set getxtime "1" }
- foreach ban [banlist $chan] {
- set reason "[lindex $ban 1]"
- if {[string match -nocase [string tolower [lindex $ban 0]] $host]} {
- putquick "PRIVMSG $black(chanserv) :ban $chan [lindex $ban 0] $getxtime $getxlevel $reason"
- }
- }
- }
- }
- ################################# XTOOLS ################################
- proc toolspublic {chan type} {
- global botnick black
- if {![channel get $chan xtools]} {
- return 0
- }
- if {$type == "op"} {
- if {![onchan "$black(chanserv)" $chan] && ![botisop $chan]} {
- return 0
- }
- putquick "PRIVMSG $black(chanserv) :unban $chan $botnick"
- putquick "PRIVMSG $black(chanserv) :op $chan $botnick"
- return 0
- }
- if {$type == "unban"} {
- putquick "PRIVMSG $black(chanserv) :unban $chan $botnick"
- return 0
- }
- if {$type == "invite" || $type == "limit"} {
- putquick "PRIVMSG $black(chanserv) :invite $chan $botnick"
- return 0
- }
- }
- ################################# Clone Scan ###################################
- proc scannerpublic {nick host hand chan arg} {
- global black count
- set c [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- }
- scanner:process $nick $host $hand $chan $chan1
- }
- proc scanner:process {nick host hand chan chan1} {
- global botnick black
- array set clones [list]
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 clonescan.4 none
- foreach user [chanlist $chan] {
- set host [string tolower [lindex [split [getchanhost $user $chan] @] 1]]
- if {![string match "*.undernet.org*" $host]} {
- if {!($black(maxclone) >= "2")} { return 0 }
- if {![info exists c($host:$chan)]} {
- set c($host:$chan) 0
- }
- set c($host:$chan) [expr $c($host:$chan) +1]
- lappend clones($user) $host
- if {$c($host:$chan) >= $black(maxclone)} {
- foreach clon [lsort -unique [array names clones]] {
- set hosts [string tolower [lindex [split [getchanhost $clon $chan] @] 1]]
- if {$host == $hosts} {
- lappend clona($host) [join $clon " , "]
- }
- }
- blacktools:tell $nick $host $hand $chan $chan1 clonescan.1 "$c($host:$chan) $host [lsort -unique $clona($host)]"
- }
- utimer 3 [list blacktools:tell $nick $host $hand $chan $chan1 clonescan.2 none]
- }
- }
- }
- proc clonescanner {minute hour day month year} {
- global black botnick
- foreach chan [channels] {
- set replace(%chan%) $chan
- if {[channel get $chan clonescan]} {
- putlog "Scaning for clones on $chan.."
- foreach user [chanlist $chan] {
- set host [string tolower [lindex [split [getchanhost $user $chan] @] 1]]
- set replace(%host%) $host
- if {![info exists c($host:$chan)]} {
- set c($host:$chan) 0
- }
- array set clones [list]
- if {![string match "*.undernet.org*" $host]} {
- if {!($black(maxclone) >= "2")} { return 0 }
- set c($host:$chan) [expr $c($host:$chan) +1]
- lappend clones($user) $host
- if {$c($host:$chan) >= $black(maxclone)} {
- foreach clon [array names clones] {
- set hosts [string tolower [lindex [split [getchanhost $clon $chan] @] 1]]
- if {$host == $hosts} {
- lappend clona($host) [join $clon " , "]
- }
- }
- set replace(%num%) $c($host:$chan)
- set replace(%clone%) [lsort -unique $clona($host)]
- if {$black(what) == "0"} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- putserv "NOTICE @$chan :[string map [array get replace] $black(say.$getlang.clonescan.3)]"
- }
- if {$black(what) == "1"} {
- set banmask *!*@[lindex [split $host @] 1]
- set reason [string map [array get replace] $black(reason)]
- blacktools:banner:2 $banmask $botnick $chan $reason $black(clonebtime)
- }
- }
- }
- }
- }
- }
- }
- ############################# Topic refresh #########################
- proc refreshpublic {nick host hand chan arg} {
- global botnick black
- set thetopic [topic $chan]
- puthelp "TOPIC $chan :$black(topics)"
- puthelp "TOPIC $chan :$thetopic"
- }
- proc times_topic {} {
- global black
- foreach chan [channels] {
- if {[channel get $chan topicrefresh] } {
- set thetopic [topic $chan]
- puthelp "TOPIC $chan :$black(topics)"
- puthelp "TOPIC $chan :$thetopic"
- }
- }
- timer $black(topic_time) times_topic
- return 1
- }
- ################################ count ####################################
- proc countpublic {nick host hand chan arg} {
- global black
- set type 0
- set chan1 "$chan"
- set why [lindex [split $arg] 0]
- if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
- set chan "$why"
- set why [lindex [split $arg] 1]
- }
- count:process $nick $host $hand $chan $chan1 $why $type
- }
- proc count:process {nick host hand chan chan1 why type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($why == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 count.1 none
- return 0
- }
- if {($why == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 count.2 none
- return 0
- }
- }
- if {($why == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 count.3 none
- return 0
- }
- if {($why == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 count.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if { [channel get $chan count] } { set countstats "on" } else { set countstats "off"}
- if {($countstats == "on") && ($why == "on")} { blacktools:tell $nick $host $hand $chan $chan1 count.5 none
- return 0
- }
- if {($countstats == "off") && ($why == "off")} { blacktools:tell $nick $host $hand $chan $chan1 count.6 none
- return 0
- }
- if {([regexp -nocase -- {(#[0-9]+|on|off|display|reset)} $why tmp counter]) && (![regexp -nocase -- {\S#} $why])} {
- switch $counter {
- on {
- channel set $chan +count
- blacktools:tell $nick $host $hand $chan $chan1 count.7 none
- }
- off {
- channel set $chan -count
- blacktools:tell $nick $host $hand $chan $chan1 count.8 none
- }
- display {
- set stats [channel get $chan countnumber]
- blacktools:tell $nick $host $hand $chan $chan1 count.9 $stats
- }
- reset {
- channel set $chan countnumber 0
- blacktools:tell $nick $host $hand $chan $chan1 count.10 none
- }
- }
- }
- }
- proc countpublic:join {nick host hand chan} {
- global black
- if {[isbotnick $nick]} { return 0}
- if {[channel get $chan count]} {
- set stats [channel get $chan countnumber]
- set counting [expr $stats +1]
- channel set $chan countnumber $counting
- set replace(%num%) $counting
- set replace(%chan%) $chan
- set countmes [channel get $chan count-message]
- if {$countmes == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set countmessage [string map [array get replace] $black(say.$getlang.count.11)]
- }
- putquick "NOTICE $nick :$countmessage"
- }
- }
- ############################### Private ##########################
- proc privatepublic {nick host hand chan arg} {
- global black
- set type 0
- set chan1 "$chan"
- set why [lindex [split $arg] 0]
- set user [lindex [split $arg] 1]
- set host [lindex [split $arg] 2]
- if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
- set chan "$why"
- set why [lindex [split $arg] 1]
- set user [lindex [split $arg] 2]
- set host [lindex [split $arg] 3]
- }
- private:process $nick $host $hand $chan $chan1 $why $user $host $type
- }
- proc private:process {nick host hand chan chan1 why user host type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set flags "-|f"
- if {[matchattr $hand nm|- $chan]} {
- if {($why == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 private.1 none
- return 0
- }
- if {($why == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 private.2 none
- return 0
- }
- }
- if {($why == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 private.3 none
- return 0
- }
- if {($why == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 private.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {([regexp -nocase -- {(#[0-9]+|on|off|add|list|del)} $why tmp privat]) && (![regexp -nocase -- {\S#} $why])} {
- switch $privat {
- on {
- channel set $chan +private
- blacktools:tell $nick $host $hand $chan $chan1 private.5 none
- }
- off {
- channel set $chan -private
- blacktools:tell $nick $host $hand $chan $chan1 private.6 none
- }
- add {
- if {[validuser $user]} {
- chattr $user $flags $chan
- blacktools:tell $nick $host $hand $chan $chan1 private.7 $user
- return 0
- }
- adduser $user $host
- chattr $user $flags $chan
- blacktools:tell $nick $host $hand $chan $chan1 private.8 "$user $host"
- }
- del {
- if {[validuser $user]} {
- chattr $user -|-f $chan
- blacktools:tell $nick $host $hand $chan $chan1 private.9 $user
- } else { blacktools:tell $nick $host $hand $chan $chan1 private.10 $user
- return 0
- }
- }
- list {
- set list [userlist $flags $chan]
- blacktools:tell $nick $host $hand $chan $chan1 private.11 $list
- }
- }
- }
- }
- proc private:module {nick host hand chan} {
- global black botnick
- set getreason [channel get $chan private-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.private.12)
- }
- set getbantime [channel get $chan private-bantime]
- if {$getbantime == "0"} { set getbantime $black(privatebantime) }
- set handle [nick2hand $nick]
- set mask "*!*@[lindex [split $host @] 1]"
- if {[channel get $chan private]} {
- if {[matchattr $handle nm|oMASOVf $chan]} {
- return 0
- }
- newchanban $chan $mask $botnick $getreason $getbantime
- }
- }
- ############################### BadChan ###########################
- proc badchanpublic {nick host hand chan arg} {
- global black
- set why [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- set bdchan [join [lindex [split $arg] 1]]
- if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
- set chan "$why"
- set why [lindex [split $arg] 1]
- set bdchan [join [lindex [split $arg] 2]]
- }
- badchan:process $nick $host $hand $chan $chan1 $why $bdchan $type
- }
- proc badchan:process {nick host hand chan chan1 why bdchan type} {
- global botnick black
- set flag "antibadchan"
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set dir "logs/badchan($chan).txt"
- if {[matchattr $hand nm|- $chan]} {
- if {($why == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 badchan.1 none
- return 0
- }
- if {($why == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 badchan.2 none
- return 0
- }
- }
- if {($why == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 badchan.3 none
- return 0
- }
- if {($why == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 badchan.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {([regexp -nocase -- {(#[0-9]+|on|off|add|list|del)} $why tmp bc]) && (![regexp -nocase -- {\S#} $why])} {
- switch $bc {
- on {
- channel set $chan +$flag
- blacktools:tell $nick $host $hand $chan $chan1 badchan.5 none
- }
- off {
- channel set $chan -$flag
- blacktools:tell $nick $host $hand $chan $chan1 badchan.6 none
- }
- add {
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set file [open $dir a]
- puts $file $bdchan
- close $file
- blacktools:tell $nick $host $hand $chan $chan1 badchan.7 $bdchan
- }
- list {
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set dir "logs/badchan($chan).txt"
- set file [open $dir "r"]
- set w [read -nonewline $file]
- close $file
- set data [split $w "\n"]
- set i 0
- if {$data == ""} { blacktools:tell $nick $host $hand $chan $chan1 badchan.8 none
- return 0
- }
- foreach cc $data {
- set i [expr $i +1]
- blacktools:tell $nick $host $hand $chan $chan1 badchan.9 none
- blacktools:tell $nick $host $hand $chan $chan1 badchan.10 "$i. $cc"
- }
- }
- del {
- if {![regexp {^[0-9]} $bdchan]} {
- blacktools:tell $nick $host $hand $chan $chan1 badchan.11 none
- return 0
- }
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- set lines [split $data "\n"]
- set i [expr $bdchan - 1]
- set delete [lreplace $lines $i $i]
- set file [open $dir "w"]
- puts $file [join $delete "\n"]
- close $file
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $dir "w"]
- close $files
- }
- blacktools:tell $nick $host $hand $chan $chan1 badchan.12 $bdchan
- blacktools:tell $nick $host $hand $chan $chan1 badchan.13 none
- }
- }
- }
- }
- proc badchanpublic:join {nick host hand chan} {
- global black
- set handle [nick2hand $nick]
- set ::ccchan $chan
- if {![validchan $chan]} {
- return 0
- }
- if {[matchattr $handle nm|MASoOVv $chan]} { return 0 }
- if {![botisop $chan]} { return 0 }
- if {[isbotnick $nick]} { return 0 }
- if {[channel get $chan antibadchan]} {
- if {[onchan $nick $chan]} {
- utimer 5 [list putquick "WHOIS $nick $nick"]
- bind RAW - 319 badchanpublic:ban
- }
- }
- }
- proc badchanpublic:ban {from keyword arguments } {
- global botnick black
- set chan $::ccchan
- set arguments [join $arguments]
- set nick [string tolower [lindex $arguments 1]]
- set replace(%chan%) $chan
- set replace(%nick%) $nick
- set handle [nick2hand $nick]
- set args [join $arguments]
- set getreason [channel get $chan badchan-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.badchan.14)
- }
- set getbantime [channel get $chan badchan-bantime]
- if {$getbantime == "0"} { set getbantime $black(badcbantime) }
- if {[channel get $chan antibadchan]} {
- if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
- set protectreason [string map [array get replace] $getreason]
- set reason "$protectreason"
- set channels [string tolower [lrange $args 2 end]]
- set banmask *!*@[lindex [split [getchanhost $nick $chan] "@"] 1]
- set dir "logs/badchan($chan).txt"
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set file [open $dir "r"]
- set w [read -nonewline $file]
- close $file
- set bchan [split $w "\n"]
- if {$w == ""} { return 0 }
- foreach badchan $bchan {
- set replace(%bchan%) $badchan
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set protectmsg [string map [array get replace] $black(say.$getlang.badchan.15)]
- foreach c $channels {
- set ch [string trimleft $c ":@+"]
- if {[string match -nocase $badchan $ch]} {
- blacktools:banner:2 $banmask $botnick $chan $getreason $getbantime
- putserv "PRIVMSG $nick :$protectmsg"
- }
- }
- }
- }
- }
- ################################# Antitake ##################################
- proc dontdeoppublic {nick host hand chan args} {
- global black botnick
- set dnick [lindex $args 1]
- set handle [nick2hand $nick]
- if {[channel get $chan dontdeop] } {
- if {[string match -nocase $nick $botnick]} {
- return 0
- }
- if {![matchattr $handle $black(exceptflags) $chan]} {
- putquick "MODE $chan -o $nick"
- putquick "MODE $chan +o $dnick"
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- puthelp "NOTICE $nick :$black(say.$getlang.antitake.1)"
- }
- }
- }
-
- proc dontoppublic {nick host hand chan args} {
- global black botnick
- set onick [lindex $args 1]
- set handle [nick2hand $nick]
- if {[channel get $chan dontop]} {
- if {[string match -nocase $nick $botnick]} {
- return 0
- }
- if {[string match -nocase $onick $botnick]} {
- return 0
- }
- if {![matchattr $handle $black(exceptflags) $chan]} {
- putquick "MODE $chan -o $nick"
- putquick "MODE $chan -o $onick"
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- puthelp "NOTICE $nick :$black(say.$getlang.antitake.2)"
- }
- }
- }
- ################################# Anunt ###################################
- proc anuntpublic {nick host hand chan arg} {
- global black
- set type 0
- set chan1 "$chan"
- set who [lindex [split $arg] 0]
- set message [join [lrange [split $arg] 1 end]]
- set number [lindex [split $arg] 1]
- if {[regexp {^[\\+!#&]} $who] && [matchattr $hand nm|- $chan]} {
- set chan "$who"
- set who [lindex [split $arg] 1]
- set message [join [lrange [split $arg] 2 end]]
- set number [lindex [split $arg] 2]
- }
- anunt:process $nick $host $hand $chan $chan1 $who $message $number $type
- }
- proc anunt:process {nick host hand chan chan1 who message number type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set dir "logs/anunt($chan).txt"
- if {[matchattr $hand nm|- $chan]} {
- if {($who == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 anunt.1 none
- return 0
- }
- if {($who == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 anunt.2 none
- return 0
- }
- }
- if {($who == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 anunt.3 none
- return 0
- }
- if {($who == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 anunt.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {([regexp -nocase -- {(#[0-9]+|on|off|add|list|del)} $who tmp a]) && (![regexp -nocase -- {\S#} $who])} {
- switch $a {
- on {
- channel set $chan +anunt
- blacktools:tell $nick $host $hand $chan $chan1 anunt.5 none
- }
- off {
- channel set $chan -anunt
- blacktools:tell $nick $host $hand $chan $chan1 anunt.6 none
- }
- add {
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set file [open $dir a]
- puts $file $message
- close $file
- blacktools:tell $nick $host $hand $chan $chan1 anunt.7 none
- blacktools:tell $nick $host $hand $chan $chan1 anunt.8 $message
- }
- list {
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set file [open $dir "r"]
- set w [read -nonewline $file]
- close $file
- set data [split $w "\n"]
- set i 0
- if {$data == ""} { blacktools:tell $nick $host $hand $chan $chan1 anunt.9 none
- return 0
- }
- foreach mes $data {
- set i [expr $i +1]
- blacktools:tell $nick $host $hand $chan $chan1 anunt.10 none
- blacktools:tell $nick $host $hand $chan $chan1 anunt.8 "$i. $mes"
- }
- }
- del {
- if {![regexp {^[0-9]} $number]} {
- blacktools:tell $nick $host $hand $chan $chan1 anunt.11 none
- return 0
- }
- set dir "logs/anunt($chan).txt"
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- set lines [split $data "\n"]
- set i [expr $number - 1]
- set delete [lreplace $lines $i $i]
- set files [open $dir "w"]
- puts $files [join $delete "\n"]
- close $files
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $dir "w"]
- close $files
- }
- blacktools:tell $nick $host $hand $chan $chan1 anunt.12 $number
- blacktools:tell $nick $host $hand $chan $chan1 anunt.13 none
- }
- }
- }
- }
- proc anuntpublic:show {} {
- global black count
- foreach chan [channels] {
- if {[validchan $chan]} {
- set dir "logs/anunt($chan).txt"
- if {[channel get $chan anunt]} {
- if {![info exists count(anunt:$chan)]} {
- set count(anunt:$chan) 0
- }
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- set lines [split $data "\n"]
- set line [lindex $lines $count(anunt:$chan)]
- incr count(anunt:$chan)
- if {$line == ""} {
- unset count(anunt:$chan)
- }
- if {$black(anunthow) == "1"} {
- puthelp "PRIVMSG $chan :\001ACTION $line\001"
- } else {
- puthelp "PRIVMSG $chan :$line"
- }
- }
- }
- }
- timer $black(anunttime) anuntpublic:show
- return 1
- }
- ################################## TimeBan #############################
- proc timeban:module {nick host hand chan} {
- global botnick
- if {[channel get $chan showtime]} {
- set host "$nick![getchanhost $nick $chan]"
- foreach ban [banlist $chan] {
- if {[string match -nocase [string tolower [lindex $ban 0]] $host]} {
- set reason "[lindex $ban 1]"
- set bantime "[lindex $ban 2]"
- set totalday [expr $bantime - [unixtime]]
- if {$totalday >= 86400} {
- set daysfull [expr $totalday/86400]
- set days [expr int($daysfull)]
- set dayssub [expr 86400*$days]
- set totalhour [expr $totalday - $dayssub]
- }
- if {$totalday < 86400} {
- set totalhour $totalday
- set days 0
- }
- if {$totalhour >= 3600} {
- set hoursfull [expr $totalhour/3600]
- set hours [expr int($hoursfull)]
- set hourssub [expr 3600*$hours]
- set totalmin [expr $totalhour - $hourssub]
- }
- if {$totalhour < 3600} {
- set totalmin $totalhour
- set hours 0
- }
- if {$totalmin >= 60} {
- set minsfull [expr $totalmin/60]
- set mins [expr int($minsfull)]
- }
- if {$totalmin < 60} {
- set mins 0
- }
- if {$days < 1} {set zi "0 zile, "} elseif {$days == 1} {set zi "$days zi, "} {set zi "$days zile, "}
- if {$hours < 1} {set ora "0"} else { set ora "$hours" }
- set minut "$mins"
- set re "$reason Expire :$zi$ora:$minut"
- if {[lindex $ban 2] == 0} {
- set expire "Expire :Perm Ban"
- set re "$reason $expire"
- }
- putquick "MODE $chan +b [lindex $ban 0]"
- putquick "KICK $chan $nick :$re"
- }
- }
- }
- }
- ############################### AutoBroadcast ############################
- proc broadcastpublic:module {nick host hand chan arg} {
- global black sdir
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set chan1 "$chan"
- set who [lindex [split $arg] 0]
- set message [join [lrange [split $arg] 1 end]]
- set number [lindex [split $arg] 1]
- if {$who == ""} { blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.1 none
- return 0
- }
- broadcast:process $nick $host $hand $chan $chan1 $who $message $number
- }
- proc broadcast:process {nick host hand chan chan1 who message number} {
- global botnick black sdir
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set dir "logs/broadcast.txt"
- set lin 0
- if {([regexp -nocase -- {(#[0-9]+|on|off|add|list|del)} $who tmp a]) && (![regexp -nocase -- {\S#} $who])} {
- switch $a {
- on {
- set type "broadcastpublic:show ON"
- foreach tmr [timers] {
- if {[string match "*broadcastpublic:show*" [join [lindex $tmr 1]]]} {
- blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.3 none
- return 0
- }
- }
- blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.4 none
- set file [open $sdir "r"]
- set database [read -nonewline $file]
- close $file
- set data [split $database "\n"]
- foreach line $data {
- set lin [expr $lin +1]
- set who [lindex [split $line] 0]
- set stats [lindex [split $line] 1]
- if {[string match -nocase "broadcastpublic:show" $who]} {
- if {$line != ""} {
- set num [expr $lin - 1]
- set delete [lreplace $data $num $num]
- set files [open $sdir "w"]
- puts $files [join $delete "\n"]
- close $files
- }
- }
- }
- set file [open $sdir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $sdir "w"]
- close $files
- }
- set file [open $sdir "a"]
- puts $file "$type"
- close $file
- timer $black(bttime) broadcastpublic:show
- }
- off {
- blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.5 none
- set type "broadcastpublic:show OFF"
- foreach tmr [timers] {
- if {[string match -nocase "*broadcastpublic:show*" [join [lindex $tmr 1]]]} {
- killtimer [lindex $tmr 2]
- }
- }
- set file [open $sdir "r"]
- set database [read -nonewline $file]
- close $file
- set data [split $database "\n"]
- foreach line $data {
- set lin [expr $lin +1]
- set who [lindex [split $line] 0]
- set stats [lindex [split $line] 1]
- if {[string match -nocase "broadcastpublic:show" $who]} {
- if {$line != ""} {
- set num [expr $lin - 1]
- set delete [lreplace $data $num $num]
- set files [open $sdir "w"]
- puts $files [join $delete "\n"]
- close $files
- }
- }
- }
- set file [open $sdir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $sdir "w"]
- close $files
- }
- set file [open $sdir "a"]
- puts $file "$type"
- close $file
- }
- add {
- if {[file exists $dir] == 0} {
- set file [open $dir a]
- close $file
- }
- set file [open $dir a]
- puts $file $message
- close $file
- blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.6 none
- blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.7 $message
- }
- list {
- if {[file exists $dir] == 0} {
- set file [open $dir a]
- close $file
- }
- set dir "logs/broadcast.txt"
- set file [open $dir "r"]
- set w [read -nonewline $file]
- close $file
- set data [split $w "\n"]
- set i 0
- if {$data == ""} { blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.8 none
- return 0
- }
- foreach mes $data {
- set i [expr $i +1]
- blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.9 none
- blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.7 "$i. $mes"
- }
- }
- del {
- if {![regexp {^[0-9]} $number]} {
- blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.10 none
- return 0
- }
- set dir "logs/broadcast.txt"
- if {[file exists $dir] == 0} {
- set file [open $dir a]
- close $file
- }
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- set lines [split $data "\n"]
- set i [expr $number - 1]
- set delete [lreplace $lines $i $i]
- set files [open $dir "w"]
- puts $files [join $delete "\n"]
- close $files
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $dir "w"]
- close $files
- }
- blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.11 $number
- }
- }
- }
- }
- proc broadcastpublic:show {} {
- global black
- set dir "logs/broadcast.txt"
- if {[file exists $dir] == 0} {
- set file [open $dir a]
- close $file
- }
- foreach chan [channels] {
- if {[isdynamic $chan] && (![channel get $chan silent])} {
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- set lines [split $data "\n"]
- set numlines [llength $lines]
- set random [rand $numlines]
- set randomline [lindex $lines $random]
- if {$black(bthow) == "1"} {
- puthelp "PRIVMSG $chan :\001ACTION 1(BROADCAST) $randomline\001"
- } else {
- puthelp "PRIVMSG $chan :1(BROADCAST) $randomline"
- }
- }
- }
- timer $black(bttime) broadcastpublic:show
- return 1
- }
- ################################# Limit ###################################
- proc limitpublic {nick host hand chan arg} {
- global black
- set why [lindex [split $arg] 0]
- set lm [lindex [split $arg] 1]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
- set chan "$why"
- set why [lindex [split $arg] 1]
- set lm [lindex [split $arg] 2]
- }
- limit:process $nick $host $hand $chan $chan1 $why $lm $type
- }
- proc limit:process {nick host hand chan chan1 why lm type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($why == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 limit.1 none
- return 0
- }
- if {($why == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 limit.2 none
- return 0
- }
- }
- if {($why == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 limit.3 none
- return 0
- }
- if {($why == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 limit.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- set usersnum [llength [chanlist $chan]]
- set setnum [channel get $chan blacklimit]
- if {([regexp -nocase -- {(#[0-9]+|on|off|set|on|off)} $why tmp lmt]) && (![regexp -nocase -- {\S#} $why])} {
- switch $lmt {
- on {
- set limt [channel get $chan blacklimit]
- channel set $chan +limit
- blacktools:tell $nick $host $hand $chan $chan1 limit.5 none
- if {($limt != "0")} {
- putserv "MODE $chan +l [expr $usersnum + $limt]"
- } else {
- putserv "MODE $chan +l [expr $usersnum + 10]"
- channel set $chan blacklimit 10
- blacktools:tell $nick $host $hand $chan $chan1 limit.6 none
- }
- }
- off {
- channel set $chan -limit
- blacktools:tell $nick $host $hand $chan $chan1 limit.7 none
- putquick "MODE $chan -l"
- }
- set {
- if {![regexp {^[0-9]} $lm]} {
- blacktools:tell $nick $host $hand $chan $chan1 limit.8 none
- return 0
- }
- if {$lm < 2} { blacktools:tell $nick $host $hand $chan $chan1 limit.9 none
- channel set $chan blacklimit 2
- putserv "MODE $chan +l [expr $usersnum + $lm]"
- blacktools:tell $nick $host $hand $chan $chan1 limit.10 none
- return 0
- }
- if {$lm > 500} { blacktools:tell $nick $host $hand $chan $chan1 limit.11 none
- return 0
- }
- channel set $chan blacklimit $lm
- blacktools:tell $nick $host $hand $chan $chan1 limit.12 $lm
- putserv "MODE $chan +l [expr $usersnum + $lm]"
- }
- }
- }
- }
- proc limit:timer {min hour day mon year} {
- global black
- foreach chan [channels] {
- if {[channel get $chan limit]} {
- set usersnum [llength [chanlist $chan]]
- set setnum [channel get $chan blacklimit]
- if {$setnum == "0"} { set setnum "10" }
- if {![botisop $chan]} { return 0 }
- set chanmode [getchanmode $chan]
- if {[string match "*l*" "$chanmode"]} {
- set lim [lindex $chanmode 1]
- } else { set lim "0" }
- if {$usersnum > $lim} { set dif [expr $usersnum - $lim] } else { set dif [expr $lim - $usersnum] }
- if {($dif >= $setnum) || ($dif <= $setnum)} {
- putserv "MODE $chan +l [expr $usersnum + $setnum]"
- }
- }
- }
- }
- ################################# Topic ###################################
- proc topicpublic {nick host hand chan arg} {
- global black
- set nop [lindex [split $arg] 0]
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set type 0
- set chan1 "$chan"
- set tp [join [lrange [split $arg] 1 end]]
- set number [lindex [split $arg] 1]
- if {[regexp {^[\\+!#&]} $nop] && [matchattr $hand nm|- $chan]} {
- set chan "$nop"
- set nop [lindex [split $arg] 1]
- set tp [join [lrange [split $arg] 2 end]]
- set number [lindex [split $arg] 2]
- }
- topic:process $nick $host $hand $chan $chan1 $nop $tp $number $type
- }
- proc topic:process {nick host hand chan chan1 nop tp number type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set dir "logs/topic($chan).txt"
- if {[matchattr $hand nm|- $chan]} {
- if {($nop == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 topic.1 none
- return 0
- }
- if {($nop == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 topic.2 none
- return 0
- }
- }
- if {($nop == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 topic.3 none
- return 0
- }
- if {($nop == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 topic.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {([regexp -nocase -- {(#[0-9]+|save|list|add|del|set)} $nop tmp topc]) && (![regexp -nocase -- {\S#} $nop])} {
- switch $topc {
- save {
- set t [join [topic $chan]]
- if {$t == ""} { blacktools:tell $nick $host $hand $chan $chan1 topic.5 none
- return 0
- }
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set file [open $dir a]
- puts $file $t
- close $file
- blacktools:tell $nick $host $hand $chan $chan1 topic.6 none
- }
- add {
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set file [open $dir a]
- puts $file $tp
- close $file
- blacktools:tell $nick $host $hand $chan $chan1 topic.7 none
- }
- list {
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set file [open $dir "r"]
- set w [read -nonewline $file]
- close $file
- set data [split $w "\n"]
- set i 0
- if {$data == ""} { blacktools:tell $nick $host $hand $chan $chan1 topic.8 none
- return 0
- }
- foreach ts $data {
- set i [expr $i +1]
- blacktools:tell $nick $host $hand $chan $chan1 topic.9 none
- blacktools:tell $nick $host $hand $chan $chan1 topic.10 "$i. $ts"
- }
- }
- del {
- if {![regexp {^[0-9]} $number]} {
- blacktools:tell $nick $host $hand $chan $chan1 topic.11 none
- return 0
- }
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- set lines [split $data "\n"]
- set i [expr $number - 1]
- set delete [lreplace $lines $i $i]
- set files [open $dir "w"]
- puts $files [join $delete "\n"]
- close $files
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $dir "w"]
- close $files
- }
- blacktools:tell $nick $host $hand $chan $chan1 topic.12 $number
- }
- set {
- if {$number == ""} { blacktools:tell $nick $host $hand $chan $chan1 topic.13 none
- return 0
- }
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- set lines [split $data "\n"]
- set num [expr $number - 1]
- set line [lindex $lines $num]
- putquick "TOPIC $chan :Setting topic.."
- puthelp "TOPIC $chan :$line"
- blacktools:tell $nick $host $hand $chan $chan1 topic.14 $number
- }
- }
- }
- }
- ################################# Seen ###################################
- proc seen:save:2 {nick chan host type time staytimer reason} {
- global seendir
- set lin 0
- set j 0
- set who "$type $chan $nick $host $time $staytimer $reason"
- set file [open $seendir "r"]
- set database [read -nonewline $file]
- close $file
- set data [split $database "\n"]
- foreach line $data {
- set lin [expr $lin +1]
- set userentry [lindex [split $line] 2]
- set chanentry [lindex [split $line] 1]
- if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} {
- set joined [lindex [split $line] 0]
- if {$joined == "JOIN"} {
- set j [lindex [split $line] 4]
- if {![regexp {^[0-9]} $j] || ($j == "")} {
- set j 0
- }
- }
- set who "$type $chan $nick $host $time $j $reason"
- if {$line != ""} {
- set num [expr $lin - 1]
- set delete [lreplace $data $num $num]
- set files [open $seendir "w"]
- puts $files [join $delete "\n"]
- close $files
- }
- }
- }
- set file [open $seendir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $seendir "w"]
- close $files
- }
- set file [open $seendir "a"]
- puts $file "$who"
- close $file
- }
- proc seen:save:1 {nick chan host type time staytimer} {
- global seendir
- set lin 0
- set who "$type $chan $nick $host $time $staytimer"
- set file [open $seendir "r"]
- set database [read -nonewline $file]
- close $file
- set data [split $database "\n"]
- foreach line $data {
- set lin [expr $lin +1]
- set userentry [lindex [split $line] 2]
- set chanentry [lindex [split $line] 1]
- if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} {
- if {$line != ""} {
- set num [expr $lin - 1]
- set delete [lreplace $data $num $num]
- set files [open $seendir "w"]
- puts $files [join $delete "\n"]
- close $files
- }
- }
- }
- set file [open $seendir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $seendir "w"]
- close $files
- }
- set file [open $seendir "a"]
- puts $file "$who"
- close $file
- }
- proc seen:join {nick host hand chan} {
- global seendir botnick
- if {![channel get $chan seen]} {
- return 0
- }
- if {[isbotnick $nick]} { return 0 }
- set time [unixtime]
- set host "*!$host"
- set type "JOIN"
- set staytimer "0"
- seen:save:1 $nick $chan $host $type $time $staytimer
- }
- proc seen:part {nick host hand chan arg} {
- global seendir botnick
- if {![validchan $chan]} { return 0 }
- if {![channel get $chan seen]} {
- return 0
- }
- set time [unixtime]
- set staytimer "0"
- set type "PART"
- set reason [join [lrange [split $arg] 0 end]]
- if {$reason == ""} { set reason "No Reason" }
- set host "*!$host"
- if {[isbotnick $nick]} { return 0 }
- seen:save:2 $nick $chan $host $type $time $staytimer $reason
- }
- proc seen:sign {nick host hand chan arg} {
- global seendir botnick
- if {![validchan $chan]} { return 0 }
- if {![channel get $chan seen]} {
- return 0
- }
- set time [unixtime]
- set staytimer "0"
- set type "SIGN"
- set host "*!$host"
- set reason [join [lrange [split $arg] 0 end]]
- if {$reason == ""} { set reason "No Reason" }
- if {[isbotnick $nick]} { return 0 }
- seen:save:2 $nick $chan $host $type $time $staytimer $reason
- }
- proc seen:kick {nick host hand chan kicked reason} {
- global seendir botnick
- if {![validchan $chan]} { return 0 }
- if {![channel get $chan seen]} {
- return 0
- }
- set lin 0
- set j 0
- set time [unixtime]
- set hosted [getchanhost $kicked $chan]
- set hosted "*!$hosted"
- set reason [join [lrange [split $reason] 1 end]]
- if {$reason == ""} { set reason "No Reason" }
- if {[isbotnick $kicked]} { return 0 }
- set who "KICK $chan $kicked $hosted $time 0 $reason"
- set file [open $seendir "r"]
- set database [read -nonewline $file]
- close $file
- set data [split $database "\n"]
- foreach line $data {
- set lin [expr $lin +1]
- set userentry [lindex [split $line] 2]
- set chanentry [lindex [split $line] 1]
- if {[string equal -nocase $kicked $userentry] && [string match -nocase $chanentry $chan]} {
- set joined [lindex [split $line] 0]
- if {$joined == "JOIN"} {
- set j [lindex [split $line] 4]
- if {![regexp {^[0-9]} $j] || ($j == "")} {
- set j 0
- }
- }
- set who "KICK $chan $kicked $hosted $time $j $reason"
- if {$line != ""} {
- set num [expr $lin - 1]
- set delete [lreplace $data $num $num]
- set files [open $seendir "w"]
- puts $files [join $delete "\n"]
- close $files
- }
- }
- }
- set file [open $seendir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $seendir "w"]
- close $files
- }
- set file [open $seendir "a"]
- puts $file "$who"
- close $file
- }
- proc seen:split {nick host hand chan args} {
- global seendir botnick
- if {![validchan $chan]} { return 0 }
- if {![channel get $chan seen]} {
- return 0
- }
- set time [unixtime]
- set staytimer "0"
- set type "SPLIT"
- set host "*!$host"
- set reason [join [lrange [split $args] 0 end]]
- if {[isbotnick $nick]} { return 0 }
- seen:save:2 $nick $chan $host $type $time $staytimer $reason
- }
- proc seen:changenick {nick host hand chan newnick} {
- global seendir botnick
- if {![channel get $chan seen]} {
- return 0
- }
- set time [unixtime]
- set host "*!$host"
- set staytimer "0"
- set type "NICKCHANGE"
- if {[isbotnick $nick]} { return 0 }
- seen:save:2 $nick $chan $host $type $time $staytimer $newnick
- }
- proc seenpublic {nick host hand chan arg} {
- global black
- if {![channel get $chan seen]} {
- return 0
- }
- set type 0
- set chan1 "$chan"
- set what [lindex [split $arg] 0]
- if {[regexp {^[\\+!#&]} $what] && [matchattr $hand nm|- $chan]} {
- set chan1 "$chan"
- set chan "$what"
- set what [lindex [split $arg] 1]
- }
- seen:process $nick $host $hand $chan $chan1 $what $type
- }
- proc seen:process {nick host hand chan chan1 what type} {
- global seendir black count botnick
- set number [scan $black(seenflood) %\[^:\]]
- set timer [scan $black(seenflood) %*\[^:\]:%s]
- set i 0
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($what == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 seen.1 none
- return 0
- }
- if {($what == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 seen.2 none
- return 0
- }
- }
- if {($what == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 seen.3 none
- return 0
- }
- if {($what == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 seen.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- foreach tmr [utimers] {
- if {[string match "*count(flood:$host:$chan)*" [join [lindex $tmr 1]]]} {
- killutimer [lindex $tmr 2]
- }
- }
- if {![info exists count(flood:$host:$chan)]} {
- set count(flood:$host:$chan) 0
- }
- incr count(flood:$host:$chan)
- utimer $timer [list unset count(flood:$host:$chan)]
- if {$count(flood:$host:$chan) == "$number"} {
- blacktools:tell $nick $host $hand $chan $chan1 seen.5 none
- return 0
- }
- if {[string match -nocase $what $nick]} { blacktools:tell $nick $host $hand $chan $chan1 seen.6 $nick
- return 0
- }
- if {[onchan $what $chan]} { blacktools:tell $nick $host $hand $chan $chan1 seen.7 $what
- return 0
- }
- set file [open $seendir "r"]
- set database [read -nonewline $file]
- close $file
- set data [split $database "\n"]
- foreach line $data {
- set userentry [lindex [split $line] 2]
- set chanentry [lindex [split $line] 1]
- set host [lindex [split $line] 3]
- set tm [lindex [split $line] 4]
- set jointime [lindex [split $line] 5]
- set newnick [lindex [split $line] 6]
- set reason [lrange [split $line] 6 end]
- if {!([regexp {^[0-9]} $jointime]) || ($jointime == "")} {
- set jointime 0
- set reason [lrange [split $line] 5 end]
- }
- if {$reason == ""} { set reason "No Reason" }
- set output [duration [expr [unixtime] - $tm]]
- set staytime [expr [unixtime] - $jointime]
- set staytime [duration [expr $tm - $jointime]]
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set date [clock format $tm -format %d.%m.]
- set hour [clock format $tm -format %H:%M]
- if {$what == "*!*@*"} { return 0 }
- if {([string equal -nocase $userentry $what] || [string match -nocase $what $userentry] || [string match -nocase $what $host]) && [string match -nocase $chanentry $chan]} {
- set i [expr $i +1]
- set host [string trim $host "*!~"]
- if {$i < 6} {
- lappend entry $userentry
- }
- set seenfound 1
- set entry [lsort -unique $entry]
- set replace(%entry%) "[join $entry ","]"
- set replace(%host%) "$host"
- set replace(%output%) "$output"
- set replace(%date%) "($date $hour)"
- set replace(%newnick%) "$newnick"
- set replace(%userentry%) "$userentry"
- set replace(%chan%) "$chan"
- set replace(%reason%) "$reason"
- set replace(%staytime%) "$staytime"
- if {$jointime == "0"} { set staymsg "[string map [array get replace] $black(say.$getlang.seen.8)]"
- set replace(%staymsg%) "$staymsg"
- } else {
- set staymsg "[string map [array get replace] $black(say.$getlang.seen.9)]"
- set replace(%staymsg%) "$staymsg"
- }
- if {[lindex [split $line] 0] == "PART"} {
- set reply "[string map [array get replace] $black(say.$getlang.seen.12)]"
- }
- if {[lindex [split $line] 0] == "SIGN"} {
- set reply "[string map [array get replace] $black(say.$getlang.seen.13)]"
- }
- if {[lindex [split $line] 0] == "JOIN"} {
- if {[onchan $userentry $chan]} {
- set nowon "[string map [array get replace] $black(say.$getlang.seen.10)]"
- set replace(%nowon%) "$nowon"
- } else {
- set nowon "[string map [array get replace] $black(say.$getlang.seen.11)]"
- set replace(%nowon%) "$nowon"
- }
- set reply "[string map [array get replace] $black(say.$getlang.seen.14)]"
- }
- if {[lindex [split $line] 0] == "SPLIT"} {
- set reply "[string map [array get replace] $black(say.$getlang.seen.15)]"
- }
- if {[lindex [split $line] 0] == "KICK"} {
- set reply "[string map [array get replace] $black(say.$getlang.seen.16)]"
- }
- if {[lindex [split $line] 0] == "NICKCHANGE"} {
- if {[onchan $newnick $chan]} {
- set nowon "[string map [array get replace] $black(say.$getlang.seen.10)]"
- set replace(%nowon%) "$nowon"
- } else {
- set nowon "[string map [array get replace] $black(say.$getlang.seen.11)]"
- set replace(%nowon%) "$nowon"
- }
- set reply "[string map [array get replace] $black(say.$getlang.seen.17)]"
- }
- }
- if {$black(seenmet) == "1"} {
- set method "NOTICE"
- set onwho "$nick"
- } else {
- set method "PRIVMSG"
- set onwho "$chan1"
- }
- }
- if {[info exists reply]} {
- puthelp "$method $onwho :$reply"
- }
- if {![info exists seenfound]} {
- blacktools:tell $nick $host $hand $chan $chan1 seen.18 $what
- }
- }
- ############################### Greet #####################################
- proc greetpublic {nick host hand chan arg} {
- global black
- set who [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- set greet [join [lrange [split $arg] 1 end]]
- set number [lindex [split $arg] 1]
- if {[regexp {^[\\+!#&]} $who] && [matchattr $hand nm|- $chan]} {
- set chan "$who"
- set who [lindex [split $arg] 1]
- set greet [join [lrange [split $arg] 2 end]]
- set number [lindex [split $arg] 2]
- }
- greet:process $who $greet $number $type $nick $host $hand $chan $chan1
- }
- proc greet:process {who greet number type nick host hand chan chan1} {
- global botnick black
- set dir "logs/greet($chan).txt"
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($who == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 greet.1 none
- blacktools:tell $nick $host $hand $chan $chan1 greet.2 none
- return 0
- }
- if {($who == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 greet.3 none
- blacktools:tell $nick $host $hand $chan $chan1 greet.4 none
- return 0
- }
- }
- if {($who == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 greet.5 none
- return 0
- }
- if {($who == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 greet.6 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {([regexp -nocase -- {(#[0-9]+|on|off|add|list|del)} $who tmp a]) && (![regexp -nocase -- {\S#} $who])} {
- switch $a {
- on {
- channel set $chan +greet
- blacktools:tell $nick $host $hand $chan $chan1 greet.7 none
- }
- off {
- channel set $chan -greet
- blacktools:tell $nick $host $hand $chan $chan1 greet.8 none
- }
- add {
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set file [open $dir a]
- puts $file $greet
- close $file
- blacktools:tell $nick $host $hand $chan $chan1 greet.9 none
- blacktools:tell $nick $host $hand $chan $chan1 greet.10 $greet
- }
- list {
- if {[file exists $dir] == 0} {
- set file [open $dir a]
- close $file
- }
- set dir "logs/greet($chan).txt"
- set file [open $dir "r"]
- set w [read -nonewline $file]
- close $file
- set data [split $w "\n"]
- set i 0
- if {$data == ""} { blacktools:tell $nick $host $hand $chan $chan1 greet.11 none
- return 0
- }
- foreach mes $data {
- set i [expr $i +1]
- blacktools:tell $nick $host $hand $chan $chan1 greet.12 none
- blacktools:tell $nick $host $hand $chan $chan1 greet.10 "$i. $mes"
- }
- }
- del {
- if {![regexp {^[0-9]} $number]} {
- blacktools:tell $nick $host $hand $chan $chan1 greet.13 none
- return 0
- }
- set dir "logs/greet($chan).txt"
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- set lines [split $data "\n"]
- set i [expr $number - 1]
- set delete [lreplace $lines $i $i]
- set files [open $dir "w"]
- puts $files [join $delete "\n"]
- close $files
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $dir "w"]
- close $files
- }
- blacktools:tell $nick $host $hand $chan $chan1 greet.14 $number
- blacktools:tell $nick $host $hand $chan $chan1 greet.15 none
- }
- }
- }
- }
- proc greetpublic:join {nick host hand chan} {
- global black
- set dir "logs/greet($chan).txt"
- if {![validchan $chan]} { return 0 }
- if {[channel get $chan greet]} {
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- if {[isbotnick $nick]} { return 0 }
- set replace(%nick%) $nick
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} { return 0 }
- set lines [split $data "\n"]
- set numlines [llength $lines]
- set random [rand $numlines]
- set randomline [lindex $lines $random]
- set message [string map [array get replace] $randomline]
- if {$black(howgreet) == "1"} {
- puthelp "NOTICE $nick :$message"
- } else { puthelp "PRIVMSG $nick :$message" }
- }
- }
- ################################ Leave ###################################
- proc leave:process {who leave number type nick host hand chan chan1} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set dir "logs/leave($chan).txt"
- if {[matchattr $hand nm|- $chan]} {
- if {($who == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 leave.1 none
- blacktools:tell $nick $host $hand $chan $chan1 leave.2 none
- return 0
- }
- if {($who == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 leave.3 none
- blacktools:tell $nick $host $hand $chan $chan1 leave.4 none
- return 0
- }
- }
- if {($who == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 leave.5 none
- return 0
- }
- if {($who == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 leave.6 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {([regexp -nocase -- {(#[0-9]+|on|off|add|list|del)} $who tmp a]) && (![regexp -nocase -- {\S#} $who])} {
- switch $a {
- on {
- channel set $chan +leave
- blacktools:tell $nick $host $hand $chan $chan1 leave.7 none
- }
- off {
- channel set $chan -leave
- blacktools:tell $nick $host $hand $chan $chan1 leave.8 none
- }
- add {
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set file [open $dir a]
- puts $file $leave
- close $file
- blacktools:tell $nick $host $hand $chan $chan1 leave.9 none
- blacktools:tell $nick $host $hand $chan $chan1 leave.10 $leave
- }
- list {
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set dir "logs/leave($chan).txt"
- set file [open $dir "r"]
- set w [read -nonewline $file]
- close $file
- set data [split $w "\n"]
- set i 0
- if {$data == ""} { blacktools:tell $nick $host $hand $chan $chan1 leave.11 none
- return 0
- }
- foreach mes $data {
- set i [expr $i +1]
- blacktools:tell $nick $host $hand $chan $chan1 leave.12 none
- blacktools:tell $nick $host $hand $chan $chan1 leave.10 "$i. $mes"
- }
- }
- del {
- if {![regexp {^[0-9]} $number]} {
- blacktools:tell $nick $host $hand $chan $chan1 leave.13 none
- return 0
- }
- set dir "logs/leave($chan).txt"
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- set lines [split $data "\n"]
- set i [expr $number - 1]
- set delete [lreplace $lines $i $i]
- set files [open $dir "w"]
- puts $files [join $delete "\n"]
- close $files
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $dir "w"]
- close $files
- }
- blacktools:tell $nick $host $hand $chan $chan1 leave.14 $number
- blacktools:tell $nick $host $hand $chan $chan1 leave.15 none
- }
- }
- }
- }
- proc leavepublic {nick host hand chan arg} {
- global black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set dir "logs/leave($chan).txt"
- set type 0
- set chan1 "$chan"
- set who [lindex [split $arg] 0]
- set leave [join [lrange [split $arg] 1 end]]
- set number [lindex [split $arg] 1]
- if {[regexp {^[\\+!#&]} $who] && [matchattr $hand nm|- $chan]} {
- set chan "$who"
- set who [lindex [split $arg] 1]
- set leave [join [lrange [split $arg] 2 end]]
- set number [lindex [split $arg] 2]
- }
- leave:process $who $leave $number $type $nick $host $hand $chan $chan1
- }
- proc leavepublic:part {nick host hand chan args} {
- global black
- set dir "logs/leave($chan).txt"
- if {![validchan $chan]} { return 0 }
- if {[channel get $chan leave]} {
- if {[file exists $dir] == 0} {
- set file [open $dir w]
- close $file
- }
- if {[isbotnick $nick]} { return 0 }
- set replace(%nick%) $nick
- set file [open $dir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} { return 0 }
- set lines [split $data "\n"]
- set numlines [llength $lines]
- set random [rand $numlines]
- set randomline [lindex $lines $random]
- set message [string map [array get replace] $randomline]
- if {$black(howleave) == "1"} {
- puthelp "NOTICE $nick :$message"
- } else { puthelp "PRIVMSG $nick :$message" }
- }
- }
- ################################ Idle ###################################
- proc antidlepublic {nick host hand chan arg} {
- global black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set type1 0
- set chan1 "$chan"
- set why [lindex [split $arg] 0]
- set type [lindex [split $arg] 1]
- set user [lindex [split $arg] 1]
- set host [lindex [split $arg] 2]
- if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
- set chan "$why"
- set why [lindex [split $arg] 1]
- set type [lindex [split $arg] 2]
- set user [lindex [split $arg] 2]
- set host [lindex [split $arg] 3]
- }
- antidle:process $why $type $type1 $user $host $nick $hand $chan $chan1
- }
- proc antidle:process {why type type1 user host nick hand chan chan1} {
- global botnick black
- set flag "-|f"
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set handle [nick2hand $user]
- if {[matchattr $hand nm|- $chan]} {
- if {($why == "") && ($type1 == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 idle.1 none
- blacktools:tell $nick $host $hand $chan $chan1 idle.2 none
- return 0
- }
- if {($why == "") && ($type1 == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 idle.3 none
- blacktools:tell $nick $host $hand $chan $chan1 idle.4 none
- return 0
- }
- }
- if {($why == "") && ($type1 == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 idle.5 none
- return 0
- }
- if {($why == "") && ($type1 == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 idle.6 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {([regexp -nocase -- {(#[0-9]+|op|voice|add|on|off)} $why tmp idler]) && (![regexp -nocase -- {\S#} $why])} {
- switch $idler {
- on {
- channel set $chan +antidle
- blacktools:tell $nick $host $hand $chan $chan1 idle.7 none
- }
- off {
- channel set $chan -antidle
- blacktools:tell $nick $host $hand $chan $chan1 idle.8 none
- }
- op {
- if {$type == ""} { blacktools:tell $nick $host $hand $chan $chan1 idle.9 none
- return 0
- }
- if {[string match -nocase $type "on"]} {
- if {[channel get $chan antidle]} { set antidle "on" } else { set antidle "off"}
- if {$antidle == "off"} { blacktools:tell $nick $host $hand $chan $chan1 idle.10 none
- return 0
- }
- channel set $chan +antididle
- blacktools:tell $nick $host $hand $chan $chan1 idle.11 none
- }
- if {[string match -nocase $type "off"]} {
- if {[channel get $chan antidle]} { set antidle "on" } else { set antidle "off"}
- if {$antidle == "off"} { blacktools:tell $nick $host $hand $chan $chan1 idle.10 none
- return 0
- }
- channel set $chan -antididle
- blacktools:tell $nick $host $hand $chan $chan1 idle.12 none
- }
- }
- voice {
- if {$type == ""} { blacktools:tell $nick $host $hand $chan $chan1 idle.13 none
- return 0
- }
- if {[string match -nocase $type "on"]} {
- if {[channel get $chan antidle]} { set antidle "on" } else { set antidle "off"}
- if {$antidle == "off"} { blacktools:tell $nick $host $hand $chan $chan1 idle.10 none
- return 0
- }
- channel set $chan +antividle
- blacktools:tell $nick $host $hand $chan $chan1 idle.14 none
- }
- if {[string match -nocase $type "off"]} {
- if {[channel get $chan antidle]} { set antidle "on" } else { set antidle "off"}
- if {$antidle == "off"} { blacktools:tell $nick $host $hand $chan $chan1 idle.10 none
- return 0
- }
- channel set $chan -antividle
- blacktools:tell $nick $host $hand $chan $chan1 idle.15 none
- }
- }
- add {
- if {$user == ""} { blacktools:tell $nick $host $hand $chan $chan1 idle.16 none
- return 0
- }
- if {(![onchan $user $chan]) && (![validuser $user])} { blacktools:tell $nick $host $hand $chan $chan1 idle.17 $user
- return 0
- }
- if {[validuser $user]} {
- chattr $user $flag $chan
- blacktools:tell $nick $host $hand $chan $chan1 idle.18 $user
- } else {
- set hosts [getchanhost $user $chan]
- set uhost "*!*@[lindex [split $hosts @] 1]"
- adduser $user $uhost
- chattr $user $flag $chan
- blacktools:tell $nick $host $hand $chan $chan1 idle.19 "$user $uhost"
- }
- }
- }
- }
- }
- proc idlewhoispublic {min hour day mon year} {
- global black botnick
- if {([scan $min %d]+([scan $hour %d]*60)) % $black(idleinterval) == 0} {
- foreach chan [channels] {
- if {[channel get $chan antidle]} {
- foreach user [chanlist $chan] {
- set user [split $user]
- set handle [nick2hand $user]
- if {[isop $user $chan] || [isvoice $user $chan]} {
- if {$user != $botnick} { putserv "WHOIS $user $user" }
- }
- }
- }
- }
- }
- bind raw - 317 idleprocespublic
- }
- proc idleprocespublic {nick int arg} {
- global black
- set nick [string tolower [lindex $arg 1]]
- set handle [nick2hand $nick]
- set idler [string tolower [lindex $arg 2]]
- set minutesidle [expr $idler / 60]
- foreach chan [channels] {
- set replace(%chan%) $chan
- set idlevoicetime [channel get $chan idlevoicemax]
- if {$idlevoicetime == "0"} { set idlevoicetime "$black(idlevoicemax)" }
- set idleoptime [channel get $chan idleopmax]
- if {$idleoptime == "0"} { set idleoptime "$black(idleopmax)" }
- if {[channel get $chan antividle]} {
- if {[isvoice $nick $chan] && ![matchattr $handle -|f $chan]} {
- if {$minutesidle > $idlevoicetime} {
- putserv "MODE $chan -v $nick"
- }
- }
- }
- if {[channel get $chan antididle]} {
- if {[isop $nick $chan] && ![matchattr $handle -|f $chan]} {
- if {$minutesidle > $idleoptime} {
- putserv "MODE $chan -o $nick"
- }
- }
- }
- }
- }
- ######################################### AntiBotIdle #############################
- proc botidlepublic {nick host hand chan arg} {
- global black botnick sdir
- set what [lindex [split $arg] 0]
- set lin 0
- set chan1 "$chan"
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {$what == ""} { blacktools:tell $nick $host $hand $chan $chan1 antibotidle.1 none
- return 0
- }
- botidle:process $nick $host $hand $chan $chan1 $what
- }
- proc botidle:process {nick host hand chan chan1 what} {
- global botnick black sdir
- set lin 0
- switch -exact -- [string tolower $what] {
- on {
- set type "antibotidle:module ON"
- foreach tmr [timers] {
- if {[string match "*antibotidle:module*" [join [lindex $tmr 1]]]} {
- blacktools:tell $nick $host $hand $chan $chan1 antibotidle.3 none
- return 0
- }
- }
- set file [open $sdir "r"]
- set database [read -nonewline $file]
- close $file
- set data [split $database "\n"]
- foreach line $data {
- set lin [expr $lin +1]
- set who [lindex [split $line] 0]
- set stats [lindex [split $line] 1]
- if {[string match -nocase "antibotidle:module" $who]} {
- if {$line != ""} {
- set num [expr $lin - 1]
- set delete [lreplace $data $num $num]
- set files [open $sdir "w"]
- puts $files [join $delete "\n"]
- close $files
- }
- }
- }
- set file [open $sdir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $sdir "w"]
- close $files
- }
- set file [open $sdir "a"]
- puts $file "$type"
- close $file
- blacktools:tell $nick $host $hand $chan $chan1 antibotidle.4 none
- timer $black(noidlemax) antibotidle:module
- }
- off {
- blacktools:tell $nick $host $hand $chan $chan1 antibotidle.5 none
- set type "antibotidle:module OFF"
- foreach tmr [timers] {
- if {[string match "*antibotidle:module*" [join [lindex $tmr 1]]]} {
- killtimer [lindex $tmr 2]
- }
- }
- set file [open $sdir "r"]
- set database [read -nonewline $file]
- close $file
- set data [split $database "\n"]
- foreach line $data {
- set lin [expr $lin +1]
- set who [lindex [split $line] 0]
- set stats [lindex [split $line] 1]
- if {[string match -nocase "antibotidle:module" $who]} {
- if {$line != ""} {
- set num [expr $lin - 1]
- set delete [lreplace $data $num $num]
- set files [open $sdir "w"]
- puts $files [join $delete "\n"]
- close $files
- }
- }
- }
- set file [open $sdir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $sdir "w"]
- close $files
- }
- set file [open $sdir "a"]
- puts $file "$type"
- close $file
- }
- }
- }
- proc antibotidle:module {} {
- global black
- putquick "PRIVMSG $black(noobject) :"
- timer $black(noidlemax) antibotidle:module
- return 1
- }
- ######################################## Comenzi #####################################
- proc drpublic {nick host hand chan arg} {
- global botnick black
- set drone [lindex [split $arg] 0]
- set chan1 "$chan"
- set mask [lindex [split $arg] 0]
- set type "0"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[#&]} $drone] && [matchattr $hand nm|- $chan]} {
- set chan "$drone"
- set drone [lindex [split $arg] 1]
- set mask [lindex [split $arg] 1]
- }
- dr:process $drone $mask $nick $hand $host $chan $chan1 $type
- }
- proc dr:process {drone mask nick hand host chan chan1 type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set handle [nick2hand $drone]
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- set list [userlist $black(exceptflags) $chan]
- set getreason [channel get $chan dr-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.dr.5)
- }
- if {[channel get $chan showhandle]} {
- set reason "($hand) $getreason"
- } else { set reason "$getreason"
- }
- set getbantime [channel get $chan dr-bantime]
- if {$getbantime == "0"} { set getbantime $black(drtime) }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- foreach user $list {
- set hosts [getuser $user hosts]
- foreach host $hosts {
- if {[string match -nocase $mask $host]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- }
- }
- if {[matchattr $handle $black(exceptflags) $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- if {$mask == "*!*@*"} {
- return 0
- }
- if {[isbotnick $drone]} {
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {[onchan $drone $chan]} {
- set mask *!*@[lindex [split [getchanhost $drone $chan] "@"] 1]
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($drone == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 dr.1 none
- return 0
- }
- if {($drone == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 dr.2 none
- return 0
- }
- }
- if {($drone == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 dr.3 none
- return 0
- }
- if {($drone == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 dr.4 none
- return 0
- }
- blacktools:banner:3 $mask $hand $chan $reason $getbantime DR($chan)
- }
- proc botpublic {nick host hand chan arg} {
- global botnick black
- set bot [lindex [split $arg] 0]
- set mask [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $bot] && [matchattr $hand nm|- $chan]} {
- set chan "$bot"
- set bot [lindex [split $arg] 1]
- set mask [lindex [split $arg] 1]
- }
- bot:process $bot $mask $nick $hand $host $chan $chan1 $type
- }
- proc bot:process {bot mask nick hand host chan chan1 type} {
- global black botnick
- set handle [nick2hand $bot]
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- set list [userlist $black(exceptflags) $chan]
- set getreason [channel get $chan bot-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.bot.5)
- }
- if {[channel get $chan showhandle]} {
- set reason "($hand) $getreason"
- } else { set reason "$getreason"
- }
- set getbantime [channel get $chan bot-bantime]
- if {$getbantime == "0"} { set getbantime $black(bottime) }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- foreach user $list {
- set hosts [getuser $user hosts]
- foreach host $hosts {
- if {[string match -nocase $mask $host]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- }
- }
- if {[matchattr $handle $black(exceptflags) $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- if {$mask == "*!*@*"} {
- return 0
- }
- if {[isbotnick $bot]} {
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {[onchan $bot $chan]} {
- set mask *!*@[lindex [split [getchanhost $bot $chan] "@"] 1]
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($bot == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 bot.1 none
- return 0
- }
- if {($bot == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 bot.2 none
- return 0
- }
- }
- if {($bot == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 bot.3 none
- return 0
- }
- if {($bot == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 bot.4 none
- return 0
- }
- blacktools:banner:3 $mask $hand $chan $reason $getbantime bot($chan)
- }
- proc b:local {bnick mask time nick reason hand host chan chan1 type} {
- global botnick black
- set handle [nick2hand $bnick]
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- set list [userlist $black(exceptflags) $chan]
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- foreach user $list {
- set hosts [getuser $user hosts]
- foreach host $hosts {
- if {[string match -nocase $mask $host]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- }
- }
- if {[matchattr $handle $black(exceptflags) $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- if {$reason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set reason1 $black(say.$getlang.b.9)
- } else { set reason1 "$reason" }
- if {[channel get $chan showhandle]} {
- set reason "($hand) $reason1"
- } else { set reason "$reason1"
- }
- if {[isbotnick $bnick]} {
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {$mask == "*!*@*"} {
- return 0
- }
- if {[onchan $bnick $chan]} {
- set mask *!*@[lindex [split [getchanhost $bnick $chan] "@"] 1]
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($bnick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 b.1 none
- blacktools:tell $nick $host $hand $chan $chan1 b.2 none
- return 0
- }
- if {($bnick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 b.3 none
- blacktools:tell $nick $host $hand $chan $chan1 b.4 none
- return 0
- }
- }
- if {($bnick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 b.5 none
- return 0
- }
- if {($bnick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 b.6 none
- return 0
- }
- blacktools:banner:3 $mask $hand $chan $reason $time b($chan)
- if {$time == "0"} { set reply "Permanent" } else { set reply "$time minute" }
- blacktools:tell $nick $host $hand $chan $chan1 b.7 "$mask $reply"
- }
- proc bpublic {nick host hand chan arg} {
- global botnick black
- set bnick [lindex [split $arg] 0]
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set type 0
- set chan1 "$chan"
- set mask [lindex [split $arg] 0]
- set time [lindex [split $arg] 1]
- set type1 [lindex [split $arg] 1]
- set type2 [lindex [split $arg] 2]
- set reason [join [lrange [split $arg] 2 end]]
- set handle [nick2hand $bnick]
- if {[string match -nocase "global" $type1] || [string match -nocase "global" $type2] && [matchattr $hand nm|- $chan]} {
- if {[string match -nocase $type1 "global"]} {
- set reason [join [lrange [split $arg] 2 end]]
- }
- if {[string match -nocase $type2 "global"]} {
- set reason [join [lrange [split $arg] 3 end]]
- }
- set list [userlist nm|-]
- foreach user $list {
- set hosts [getuser $user hosts]
- foreach host $hosts {
- if {[string match $mask $host]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- }
- }
- if {[matchattr $handle nm|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- if {![regexp {^[0-9]} $time]} {
- set reason [join [lrange [split $arg] 2 end]]
- set time "$black(btime)"
- }
- if {$reason == ""} {set reason1 "(GLOBAL) $black(dfreason)"
- } else { set reason1 "(GLOBAL) $reason" }
- if {[channel get $chan showhandle]} {
- set reason "($hand) $reason1"
- } else { set reason "$reason1"
- }
- if {[isbotnick $bnick]} {
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {$mask == "*!*@*"} {
- return 0
- }
- if {[onchan $bnick $chan]} {
- set mask *!*@[lindex [split [getchanhost $bnick $chan] "@"] 1]
- }
- newban $mask $hand $reason $time
- if {$time == "0"} { set reply "Permanent" } else { set reply "$time" }
- blacktools:tell $nick $host $hand $chan $chan1 b.8 "$mask $reply"
- return 0
- }
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $bnick] && [matchattr $hand nm|- $chan]} {
- set chan "$bnick"
- set bnick [lindex [split $arg] 1]
- set mask [lindex [split $arg] 1]
- set time [lindex [split $arg] 2]
- set reason [join [lrange [split $arg] 3 end]]
- if {![regexp {^[0-9]} $time]} {
- set reason [join [lrange [split $arg] 2 end]]
- set time "$black(btime)"
- }
- }
- if {![regexp {^[0-9]} $time]} {
- set time "$black(btime)"
- set reason [join [lrange [split $arg] 1 end]]
- }
- b:local $bnick $mask $time $nick $reason $hand $host $chan $chan1 $type
- }
- ################################### n #################################
- proc n:process {bnick nick hand host chan chan1 type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set handle [nick2hand $bnick]
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $handle $black(exceptflags) $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- set getreason [channel get $chan n-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.n.5)
- }
- if {[channel get $chan showhandle]} {
- set reason "($hand) $getreason"
- } else { set reason "$getreason"
- }
- set getbantime [channel get $chan n-bantime]
- if {$getbantime == "0"} { set getbantime $black(ntime) }
- if {[isbotnick $bnick]} {
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($bnick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 n.1 none
- return 0
- }
- if {($bnick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 n.2 none
- return 0
- }
- }
- if {($bnick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 n.3 none
- return 0
- }
- if {($bnick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 n.4 none
- return 0
- }
- if {[onchan $bnick $chan]} {
- set mask "$bnick*!*@*"
- } else {
- blacktools:tell $nick $host $hand $chan $chan1 gl.usernotonchan "$bnick"
- return 0
- }
- blacktools:banner:3 $mask $hand $chan $reason $getbantime n($chan)
- }
- proc npublic {nick host hand chan arg} {
- global botnick black
- set bnick [lindex [split $arg] 0]
- set type 0
- set handle [nick2hand $bnick]
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $bnick] && [matchattr $hand nm|- $chan]} {
- set chan "$bnick"
- set bnick [lindex [split $arg] 1]
- }
- n:process $bnick $nick $hand $host $chan $chan1 $type
- }
- ################################## id #################################
- proc idpublic {nick host hand chan arg} {
- global botnick black
- set idnick [lindex [split $arg] 0]
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set handle [nick2hand $idnick]
- set type 0
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $idnick] && [matchattr $hand nm|- $chan]} {
- set chan "$idnick"
- set idnick [lindex [split $arg] 1]
- }
- id:process $idnick $nick $hand $host $chan $chan1 $type
- }
- proc id:process {idnick nick hand host chan chan1 type} {
- global botnick black
- set handle [nick2hand $idnick]
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- set uhost [getchanhost $idnick $chan]
- set ident "[string trimleft [string tolower [lindex [split $uhost "@"] 0]] "~"]"
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $handle $black(exceptflags) $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- set getreason [channel get $chan id-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.id.5)
- }
- if {[channel get $chan showhandle]} {
- set reason "($hand) $getreason"
- } else { set reason "$getreason"
- }
- set getbantime [channel get $chan id-bantime]
- if {$getbantime == "0"} { set getbantime $black(idtime) }
- if {[isbotnick $idnick]} {
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($idnick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 id.1 none
- return 0
- }
- if {($idnick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 id.2 none
- return 0
- }
- }
- if {($idnick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 id.3 none
- return 0
- }
- if {($idnick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 id.4 none
- return 0
- }
- if {[onchan $idnick $chan]} {
- set mask "*!*$ident@*"
- } else { blacktools:tell $nick $host $hand $chan $chan1 gl.usernotonchan "$idnick"
- return 0
- }
- blacktools:banner:3 $mask $hand $chan $getreason $getbantime id($chan)
- }
- ############################### black #################################
- proc black:process {blnick nick mask hand host chan chan1 reason type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set handle [nick2hand $blnick]
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- set list [userlist $black(exceptflags) $chan]
- if {[matchattr $hand -|q $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- foreach user $list {
- set hosts [getuser $user hosts]
- foreach host $hosts {
- if {[string match -nocase $mask $host]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- }
- }
- if {[matchattr $handle $black(exceptflags) $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- if {$reason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set reason1 "BlackListed: $black(say.$getlang.black.5)"
- } else { set reason1 "BlackListed: $reason" }
- if {[channel get $chan showhandle]} {
- set reason "($hand) $reason1"
- } else { set reason "$reason1"
- }
- if {[isbotnick $blnick]} {
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {$mask == "*!*@*"} {
- return 0
- }
- if {[onchan $blnick $chan]} {
- set mask *!*@[lindex [split [getchanhost $blnick $chan] "@"] 1]
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($blnick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 black.1 none
- return 0
- }
- if {($blnick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 black.2 none
- return 0
- }
- }
- if {($blnick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 black.3 none
- return 0
- }
- if {($blnick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 black.4 none
- return 0
- }
-
- blacktools:banner:3 $mask $hand $chan $reason 0 Black($chan)
- }
- proc blackpublic {nick host hand chan arg} {
- global botnick black
- set blnick [lindex [split $arg] 0]
- set mask [lindex [split $arg] 0]
- set type 0
- set reason [join [lrange [split $arg] 1 end]]
- set handle [nick2hand $blnick]
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $blnick] && [matchattr $hand nm|- $chan]} {
- set chan "$blnick"
- set blnick [lindex [split $arg] 1]
- set mask [lindex [split $arg] 1]
- set reason [join [lrange [split $arg] 2 end]]
- }
- black:process $blnick $nick $mask $hand $host $chan $chan1 $reason $type
- }
- ################################ w ####################################
- proc wpublic {nick host hand chan arg} {
- global botnick black
- set wnick [lindex [split $arg] 0]
- set type 0
- set handle [nick2hand $wnick]
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $wnick] && [matchattr $hand nm|- $chan]} {
- set chan "$wnick"
- set wnick [lindex [split $arg] 1]
- }
- w:process $wnick $nick $hand $host $chan $chan1 $type
- }
- proc w:process {wnick nick hand host chan chan1 type} {
- global botnick black
- set handle [nick2hand $wnick]
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[isbotnick $wnick]} {
- return 0
- }
- if {[matchattr $handle $black(exceptflags) $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- set getreason [channel get $chan w-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.w.5)
- }
- if {[channel get $chan showhandle]} {
- set reason "($hand) $getreason"
- } else { set reason "$getreason"
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($wnick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 w.1 none
- return 0
- }
- if {($wnick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 w.2 none
- return 0
- }
- }
- if {($wnick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 w.3 none
- return 0
- }
- if {($wnick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 w.4 none
- return 0
- }
- set getcount [channel get $chan kickcount]
- set kcount [expr $getcount +1]
- channel set $chan kickcount $kcount
- set countz [getuser $hand XTRA w($chan)]
- if {$countz == ""} { set countz 0 }
- set counts [expr $countz + 1]
- setuser $hand XTRA w($chan) $counts
- if {[channel get $chan showcount]} {
- set reason "$reason - $kcount -"
- } else {
- set reason "$reason"
- }
- putquick "KICK $chan $wnick :$reason"
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- puthelp "PRIVMSG $wnick :$black(say.$getlang.w.6)"
- }
- ############################### spam ##################################
- proc spam:process {spammer mask nick hand host chan chan1 type} {
- global botnick black
- set handle [nick2hand $spammer]
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- set list [userlist $black(exceptflags) $chan]
- set getreason [channel get $chan spam-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.spam.5)
- }
- if {[channel get $chan showhandle]} {
- set reason "($hand) $getreason"
- } else { set reason "$getreason"
- }
- set getbantime [channel get $chan spam-bantime]
- if {$getbantime == "0"} { set getbantime $black(spamtime) }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- foreach user $list {
- set hosts [getuser $user hosts]
- foreach host $hosts {
- if {[string match -nocase $mask $host]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- }
- }
- if {[matchattr $handle $black(exceptflags) $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- if {$mask == "*!*@*"} {
- return 0
- }
- if {[isbotnick $spammer]} {
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {[onchan $spammer $chan]} {
- set mask *!*@[lindex [split [getchanhost $spammer $chan] "@"] 1]
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($spammer == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 spam.1 none
- return 0
- }
- if {($spammer == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 spam.2 none
- return 0
- }
- }
- if {($spammer == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 spam.3 none
- return 0
- }
- if {($spammer == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 spam.4 none
- return 0
- }
- blacktools:banner:3 $mask $hand $chan $reason $getbantime spam($chan)
- }
- proc spampublic {nick host hand chan arg} {
- global botnick black
- set spammer [lindex [split $arg] 0]
- set chan1 "$chan"
- set type 0
- set mask [lindex [split $arg] 0]
- set handle [nick2hand $spammer]
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $spammer] && [matchattr $hand nm|- $chan]} {
- set chan "$spammer"
- set spammer [lindex [split $arg] 1]
- set mask [lindex [split $arg] 1]
- }
- spam:process $spammer $mask $nick $hand $host $chan $chan1 $type
- }
- ################################### k #################################
- proc k:process {knick nick hand host reason chan chan1 type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set handle [nick2hand $knick]
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[isbotnick $knick]} {
- return 0
- }
- if {[matchattr $handle $black(exceptflags) $chan] && ($black(kaccess) == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- if {$reason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set reason1 "$black(say.$getlang.k.5)"
- } else { set reason1 "$reason" }
- if {[channel get $chan showhandle]} {
- set reason "($hand) $reason1"
- } else { set reason "$reason1"
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($knick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 k.1 none
- return 0
- }
- if {($knick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 k.2 none
- return 0
- }
- }
- if {($knick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 k.3 none
- return 0
- }
- if {($knick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 k.4 none
- return 0
- }
- if {![onchan $knick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.usernotonchan "$knick"
- return 0
- }
- set getcount [channel get $chan kickcount]
- set kcount [expr $getcount +1]
- channel set $chan kickcount $kcount
- set countz [getuser $hand XTRA k($chan)]
- if {$countz == ""} { set countz 0 }
- set counts [expr $countz + 1]
- setuser $hand XTRA k($chan) $counts
- if {[channel get $chan showcount]} {
- set reason "$reason - $kcount -"
- } else {
- set reason "$reason"
- }
- putquick "KICK $chan $knick :$reason"
- }
- proc kpublic {nick host hand chan arg} {
- global botnick black
- set knick [lindex [split $arg] 0]
- set type 0
- set reason [join [lrange [split $arg] 1 end]]
- set handle [nick2hand $knick]
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $knick] && [matchattr $hand nm|- $chan]} {
- set chan "$knick"
- set knick [lindex [split $arg] 1]
- set reason [join [lrange [split $arg] 2 end]]
- }
- k:process $knick $nick $hand $host $reason $chan $chan1 $type
- }
- ################################### gag ###############################
- proc gag:process {gagger nick hand host chan chan1 type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set handle [nick2hand $gagger]
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($gagger == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 gag.1 none
- return 0
- }
- if {($gagger == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 gag.2 none
- return 0
- }
- }
- if {($gagger == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 gag.3 none
- return 0
- }
- if {($gagger == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 gag.4 none
- return 0
- }
- if {[matchattr $handle $black(exceptflags) $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- if {[isbotnick $gagger]} {
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {[onchan $gagger $chan]} {
- set mask *!*@[lindex [split [getchanhost $gagger $chan] "@"] 1]
- } else { blacktools:tell $nick $host $hand $chan $chan1 gl.usernotonchan "$gagger"
- return 0
- }
- putquick "MODE $chan +b $mask"
- blacktools:tell $gagger $host $hand $chan $chan1 gag.5 "$gagger"
- }
- proc gagpublic {nick host hand chan arg} {
- global black
- set gagger [lindex [split $arg] 0]
- set type 0
- set handle [nick2hand $gagger]
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $gagger] && [matchattr $hand nm|- $chan]} {
- set chan "$gagger"
- set gagger [lindex [split $arg] 1]
- }
- gag:process $gagger $nick $hand $host $chan $chan1 $type
- }
- ################################## bw #################################
- proc bw:process {abuser mask nick hand host chan chan1 type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set handle [nick2hand $abuser]
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- set list [userlist $black(exceptflags) $chan]
- set getreason [channel get $chan bw-reason]
- if {$getreason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getreason $black(say.$getlang.bw.5)
- }
- if {[channel get $chan showhandle]} {
- set reason "($hand) $getreason"
- } else { set reason "$getreason"
- }
- set getbantime [channel get $chan bw-bantime]
- if {$getbantime == "0"} { set getbantime $black(bwtime) }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- foreach user $list {
- set hosts [getuser $user hosts]
- foreach host $hosts {
- if {[string match -nocase $mask $host]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- }
- }
- if {[matchattr $handle $black(exceptflags) $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- if {$mask == "*!*@*"} {
- return 0
- }
- if {[isbotnick $abuser]} {
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {[onchan $abuser $chan]} {
- set mask *!*@[lindex [split [getchanhost $abuser $chan] "@"] 1]
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($abuser == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 bw.1 none
- return 0
- }
- if {($abuser == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 bw.2 none
- return 0
- }
- }
- if {($abuser == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 bw.3 none
- return 0
- }
- if {($abuser == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 bw.4 none
- return 0
- }
- blacktools:banner:3 $mask $hand $chan $reason $getbantime bw($chan)
- }
- proc bwpublic {nick host hand chan arg} {
- global botnick black
- set abuser [lindex [split $arg] 0]
- set mask [lindex [split $arg] 0]
- set type 0
- set handle [nick2hand $abuser]
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $abuser] && [matchattr $hand nm|- $chan]} {
- set chan "$abuser"
- set abuser [lindex [split $arg] 1]
- set mask [lindex [split $arg] 1]
- }
- bw:process $abuser $mask $nick $hand $host $chan $chan1 $type
- }
- ################################ ub ###################################
- proc ub:process {ban why nick hand host chan chan1 type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($ban == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 ub.1 none
- return 0
- }
- if {($ban == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 ub.2 none
- return 0
- }
- }
- if {($ban == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 ub.3 none
- return 0
- }
- if {($ban == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 ub.4 none
- return 0
- }
-
- if {$ban == "*!*@*"} {
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {[ispermban $ban $chan] && [matchattr $hand -|O $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 ub.5 none
- return 0
- }
- if {($why == "global") && [matchattr $hand nm|- $chan]} {
- if {[killban $ban] == "0"} {
- set notfound 1
- }
- killban $ban
- if {![info exists notfound]} {
- blacktools:tell $nick $host $hand $chan $chan1 ub.6 $ban
- return 0
- } else { blacktools:tell $nick $host $hand $chan $chan1 ub.7 none
- return 0
- }
- }
- if {[killchanban $chan $ban] == "0"} {
- set notfound 1
- }
-
- killchanban $chan $ban
- if {[onchan "X" $chan]} {
- putquick "PRIVMSG $black(chanserv) :unban $chan $ban"
- }
- putquick "MODE $chan -b $ban"
- if {![info exists notfound]} {
- blacktools:tell $nick $host $hand $chan $chan1 ub.8 $ban
- } else { blacktools:tell $nick $host $hand $chan $chan1 ub.9 none
- return 0
- }
- if {[channel get $chan chanreport]} {
- set backchan [channel get $chan backchan]
- if {$backchan == ""} {
- return 0
- }
- if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
- return 0
- }
- blacktools:tell $nick $host $hand $chan $backchan ub.10 "$hand $ban"
- }
- }
- proc ubpublic {nick host hand chan arg} {
- global botnick black
- set ban [lindex [split $arg] 0]
- set why [lindex [split $arg] 1]
- set type 0
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $ban] && [matchattr $hand nm|- $chan]} {
- set chan "$ban"
- set ban [lindex [split $arg] 1]
- }
- ub:process $ban $why $nick $hand $host $chan $chan1 $type
- }
- ################################ sb ###################################
- proc sb:process {bhost what nick hand host chan chan1 type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($bhost == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 sb.1 none
- return 0
- }
- if {($bhost == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 sb.2 none
- return 0
- }
- }
- if {($bhost == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 sb.3 none
- return 0
- }
- if {($bhost == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 sb.4 none
- return 0
- }
- if {[string match -nocase $what "global"] && [matchattr $hand mn|- $chan]} {
-
- foreach ban [banlist] {
- set expire [clock format [lindex $ban 2] -format %D-%H:%M:%S]
- set created [clock format [lindex $ban 3] -format %D-%H:%M:%S]
- set fban [lindex $ban 0]
- set freason [lindex $ban 1]
- set fbywho [lindex $ban 5]
- if {[string match $bhost [string tolower [lindex $ban 0]]]} {
- set foundban 1
- if {[lindex $ban 2] == 0} {
- if {[isbansticky [lindex $ban 0]]} {
- blacktools:tell $nick $host $hand $chan $chan1 sb.5 "$fban $fbywho $created 0 $freason"
- } else {
- blacktools:tell $nick $host $hand $chan $chan1 sb.6 "$fban $fbywho $created 0 $freason"
- }
- } else {
- if {[isbansticky [lindex $ban 0]]} {
- blacktools:tell $nick $host $hand $chan $chan1 sb.7 "$fban $fbywho $created $expire $freason"
- } else {
- blacktools:tell $nick $host $hand $chan $chan1 sb.8 "$fban $fbywho $created $expire $freason"
-
- }
- }
- }
- }
- if {![info exists foundban]} {
- blacktools:tell $nick $host $hand $chan $chan1 sb.13 none
- }
- return 0
- }
- foreach ban [banlist $chan] {
- set expire [clock format [lindex $ban 2] -format %D-%H:%M:%S]
- set created [clock format [lindex $ban 3] -format %D-%H:%M:%S]
- set fban [lindex $ban 0]
- set freason [lindex $ban 1]
- set fbywho [lindex $ban 5]
- if {[string match $bhost [string tolower [lindex $ban 0]]]} {
- set foundban 1
- if {[lindex $ban 2] == 0} {
- if {[isbansticky [lindex $ban 0] $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 sb.9 "$fban $fbywho $created $expire $freason"
- } else {
- blacktools:tell $nick $host $hand $chan $chan1 sb.10 "$fban $fbywho $created 0 $freason"
- }
- } else {
- if {[isbansticky [lindex $ban 0] $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 sb.11 "$fban $fbywho $created $expire $freason"
- } else {
- blacktools:tell $nick $host $hand $chan $chan1 sb.12 "$fban $fbywho $created $expire $freason"
-
- }
- }
- }
- }
- if {![info exists foundban]} {
- blacktools:tell $nick $host $hand $chan $chan1 sb.13 none
- return 0
- }
- }
- proc sbpublic {nick host hand chan arg} {
- global botnick black
- set bhost [string tolower [lindex [split $arg] 0]]
- set what [lindex [split $arg] 1]
- set chan1 "$chan"
- set type 0
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $bhost] && [matchattr $hand nm|- $chan]} {
- set chan "$bhost"
- set bhost [string tolower [lindex [split $arg] 1]]
- set what [lindex [split $arg] 2]
- }
- sb:process $bhost $what $nick $hand $host $chan $chan1 $type
- }
- ################################# d ###################################
- proc d:process {dnick mask days reason nick hand host chan chan1 type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set handle [nick2hand $dnick]
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- set list [userlist $black(exceptflags) $chan]
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($dnick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 d.1 none
- return 0
- }
- if {($dnick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 d.2 none
- return 0
- }
- }
- if {($dnick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 d.3 none
- return 0
- }
- if {($dnick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 d.4 none
- return 0
- }
- foreach user $list {
- set hosts [getuser $user hosts]
- foreach host $hosts {
- if {[string match -nocase $mask $host]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- }
- }
- if {[matchattr $handle $black(exceptflags) $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- if {$reason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set reason1 $black(say.$getlang.d.5)
- } else { set reason1 "$reason" }
- if {[channel get $chan showhandle]} {
- set reason "($hand) $reason1"
- } else { set reason "$reason1"
- }
- if {[isbotnick $dnick]} {
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {$mask == "*!*@*"} {
- return 0
- }
- if {[onchan $dnick $chan]} {
- set mask *!*@[lindex [split [getchanhost $dnick $chan] "@"] 1]
- }
- blacktools:banner:3 $mask $hand $chan $reason [expr $days * 1440] d($chan)
- }
- proc dpublic {nick host hand chan arg} {
- global botnick black
- set days [lindex [split $arg] 0]
- set dnick [lindex [split $arg] 1]
- set type 0
- set mask [lindex [split $arg] 1]
- set reason [join [lrange [split $arg] 2 end]]
- set handle [nick2hand $dnick]
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $days] && [matchattr $hand nm|- $chan]} {
- set chan "$days"
- set days [lindex [split $arg] 1]
- set mask [lindex [split $arg] 2]
- set dnick [lindex [split $arg] 2]
- set reason [join [lrange [split $arg] 3 end]]
- if {![regexp {^[0-9]} $days]} {
- set days 1
- set mask [lindex [split $arg] 1]
- set dnick [lindex [split $arg] 1]
- set reason [join [lrange [split $arg] 2 end]]
- }
- }
- if {![regexp {^[0-9]} $days]} {
- set days 1
- set mask [lindex [split $arg] 0]
- set dnick [lindex [split $arg] 0]
- set reason [join [lrange [split $arg] 1 end]]
- }
- d:process $dnick $mask $days $reason $nick $hand $host $chan $chan1 $type
- }
- ############################### stick #################################
- proc stick:process {snick mask time reason nick hand host chan chan1 type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set handle [nick2hand $snick]
- set list [userlist $black(exceptflags) $chan]
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- foreach user $list {
- set hosts [getuser $user hosts]
- foreach host $hosts {
- if {[string match $mask $host]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- }
- }
- if {[matchattr $handle nm|AMOVS $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- if {$reason == ""} {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set reason1 $black(say.$getlang.stick.5)
- } else { set reason1 "$reason" }
- if {[channel get $chan showhandle]} {
- set reason "($hand) $reason1"
- } else { set reason "$reason1"
- }
- if {[isbotnick $snick]} {
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {$mask == "*!*@*"} {
- return 0
- }
- if {[onchan $snick $chan]} {
- set mask *!*@[lindex [split [getchanhost $snick $chan] "@"] 1]
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($snick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 stick.1 none
- return 0
- }
- if {($snick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 stick.2 none
- return 0
- }
- }
- if {($snick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 stick.3 none
- return 0
- }
- if {($snick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 stick.4 none
- return 0
- }
- blacktools:banner:4 $mask $hand $chan $reason $time stick($chan)
- }
- proc stickpublic {nick host hand chan arg} {
- global botnick black
- set snick [lindex [split $arg] 0]
- set mask [lindex [split $arg] 0]
- set chan1 "$chan"
- set type 0
- set time [lindex [split $arg] 1]
- set reason [join [lrange [split $arg] 2 end]]
- set handle [nick2hand $snick]
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $snick] && [matchattr $hand nm|- $chan]} {
- set chan "$snick"
- set time [lindex [split $arg] 2]
- set mask [lindex [split $arg] 1]
- set snick [lindex [split $arg] 1]
- set reason [join [lrange [split $arg] 3 end]]
- if {![regexp {^[0-9]} $time]} {
- set time "$black(dfstickbantime)"
- set reason [join [lrange [split $arg] 2 end]]
- }
- }
- if {![regexp {^[0-9]} $time]} {
- set time "$black(dfstickbantime)"
- set reason [join [lrange [split $arg] 1 end]]
- }
- stick:process $snick $mask $time $reason $nick $hand $host $chan $chan1 $type
- }
- ################################### t #################################
- proc tpublic {nick host hand chan arg} {
- global black
- set topics [join [lrange [split $arg] 0 end]]
- set c [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set topics [join [lrange [split $arg] 1 end]]
- }
- t:process $nick $host $hand $chan $chan1 $topics $type
- }
- proc t:process {nick host hand chan chan1 topics type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($topics == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 t.1 none
- return 0
- }
- if {($topics == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 t.2 none
- return 0
- }
- }
- if {($topics == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 t.3 none
- return 0
- }
- if {($topics == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 t.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {[channel get $chan showhandle]} {
- set topics "($hand) $topics"
- } else { set topics "$topics"
- }
- putquick "TOPIC $chan :$topics"
- }
- ############################## status #################################
- proc statuspublic {nick host hand chan arg} {
- global botnick server uptime {server-online}
- set chan1 "$chan"
- regsub -all " " [channels] ", " chans
- catch {exec uptime} shelluptime
- set up [duration [expr [unixtime] - $uptime]]
- set on [duration [expr [unixtime] - ${server-online}]]
- blacktools:tell $nick $host $hand $chan $chan1 status.1 $up
- blacktools:tell $nick $host $hand $chan $chan1 status.2 $server
- blacktools:tell $nick $host $hand $chan $chan1 status.3 $on
- blacktools:tell $nick $host $hand $chan $chan1 status.4 $chans
- blacktools:tell $nick $host $hand $chan $chan1 status.5 $shelluptime
- }
- ############################## uptime #################################
- proc uptimepublic {nick host hand chan arg} {
- global botnick uptime {server-online} server
- set chan1 "$chan"
- set up [duration [expr [unixtime] - $uptime]]
- set on [duration [expr [unixtime] - ${server-online}]]
- blacktools:tell $nick $host $hand $chan $chan1 status.1 $up
- blacktools:tell $nick $host $hand $chan $chan1 status.2 $server
- blacktools:tell $nick $host $hand $chan $chan1 status.3 $on
- }
- ################################# i ###################################
- proc ipublic {nick host hand chan arg} {
- global botnick black
- set type 0
- set chan1 "$chan"
- set inick [lrange [split $arg] 0 end]
- set c [lindex [split $arg] 0]
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set inick [join [lrange [split $arg] 1 end]]
- }
- i:process $nick $host $hand $chan $chan1 $inick $type
- }
- proc i:process {nick host hand chan chan1 inick type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($inick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 i.3 none
- return 0
- }
- if {($inick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 i.4 none
- return 0
- }
- }
- if {($inick == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 i.5 none
- return 0
- }
- if {($inick == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 i.6 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- set replace(%nick%) $nick
- set replace(%chan%) $chan
- set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getmsg $black(say.$getlang.i.7)
- if {[info exists black(say.$getlang.i.7)]} {
- set imessage [string map [array get replace] $getmsg]
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- foreach in $inick {
- if {[onchan $in $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 i.1 $in
- return 0
- }
- set countz [getuser $hand XTRA i($chan)]
- if {$countz == ""} { set countz 0 }
- set counts [expr $countz + 1]
- setuser $hand XTRA i($chan) $counts
- putquick "INVITE $in $chan"
- putquick "PRIVMSG $in :$imessage"
- blacktools:tell $nick $host $hand $chan $chan1 i.2 $in
- }
- }
- ############################### addinfo ###############################
- proc addinfopublic {nick host hand chan arg} {
- global botnick black
- set info [join [lrange [split $arg] 0 end]]
- set chan1 "$chan"
- set char(p) [lindex $black(cmdchar) 0]
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {$info == ""} {
- blacktools:tell $nick $host $hand $chan $chan1 addinfo.1 none
- return 0
- }
- addinfo:process $nick $host $hand $chan $chan1 $info
- }
- proc addinfo:process {nick host hand chan chan1 info} {
- global botnick black
- if {[string match -nocase "$info" "off"]} {
- set infos ""
- setuser $hand info $infos
- blacktools:tell $nick $host $hand $chan $chan1 addinfo.3 none
- return 0
- }
- setuser $hand info $info
- blacktools:tell $nick $host $hand $chan $chan1 addinfo.4 $info
- }
- ############################### purge ###############################
- proc purgepublic {nick host hand chan arg} {
- global botnick black
- set reason [join [lrange [split $arg] 0 end]]
- set chan1 "$chan"
- if {$reason == ""} {
- blacktools:tell $nick $host $hand $chan $chan1 purge.1 none
- return 0
- }
- purge:process $nick $host $hand $chan $chan1 $reason
- }
- proc purge:process {nick host hand chan chan1 reason} {
- channel remove $chan
- delchan:stats $chan $hand $host
- blacktools:tell $nick $host $hand $chan $chan1 purge.2 none
- putquick "PART $chan :PURGED by $hand :$reason"
- }
- ################################### v #################################
- proc vpublic {nick host hand chan arg} {
- global botnick black
- set c [lindex [split $arg] 0]
- set arg [split $arg]
- set nick [split $nick]
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set arg [lrange $arg 1 end]
- }
- v:process $nick $host $hand $chan $chan1 $arg
- }
- proc v:process {nick host hand chan chan1 arg} {
- global botnick black
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {![botisop $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {$arg == ""} {
- set arg $nick
- }
- foreach voicenick $arg {
- if {[isbotnick $voicenick]} { return 0 }
- if {[isvoice $voicenick $chan]} {putquick "MODE $chan -v $voicenick"} else {putquick "MODE $chan +v $voicenick"}
- }
- }
- ################################## o ##################################
- proc opublic {nick host hand chan arg} {
- global botnick black
- set c [lindex [split $arg] 0]
- set arg [split $arg]
- set nick [split $nick]
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set arg [lrange $arg 1 end]
- }
- o:process $nick $host $hand $chan $chan1 $arg
- }
- proc o:process {nick host hand chan chan1 arg} {
- global botnick black
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {![botisop $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {$arg == ""} {
- set arg $nick
- }
- foreach opnick $arg {
- if {[isbotnick $opnick]} { return 0 }
- if {[isop $opnick $chan]} {putquick "MODE $chan -o $opnick"} else {putquick "MODE $chan +o $opnick"}
- }
- }
- ################################# l ###################################
- proc lpublic {nick host hand chan arg} {
- global black
- set times [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $times] && [matchattr $hand nm|- $chan]} {
- set chan "$times"
- set times [lindex [split $arg] 1]
- }
- l:process $nick $host $hand $chan $chan1 $times $type
- }
- proc l:process {nick host hand chan chan1 time type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($time == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 l.1 none
- return 0
- }
- if {($time == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 l.2 none
- return 0
- }
- }
- if {($time == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 l.3 none
- return 0
- }
- if {($time == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 l.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {$time >= 300} {
- blacktools:tell $nick $host $hand $chan $chan1 l.5 none
- return 0
- }
- putserv "MODE $chan +$black(lmode)" ;utimer $time [list putquick "MODE $chan -$black(lmode)"]
- blacktools:tell $nick $host $hand $chan $chan1 l.6 "$black(lmode) $time"
- }
- proc chatpublic {nick host hand chan arg} {
- global botnick
- *ctcp:CHAT $nick $host $hand $botnick CHAT $arg
- blacktools:tell $nick $host $hand $chan $chan1 chat.1 none
- }
- ################################ ul ###################################
- proc ul:process {nick host hand chan chan1} {
- global black botnick
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- putquick "MODE $chan -$black(ulmodes)"
- blacktools:tell $nick $host $hand $chan $chan1 ul.1 $black(ulmodes)
- }
- proc ulpublic {nick host hand chan arg} {
- global black
- set c [lindex [split $arg] 0]
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- }
- ul:process $nick $host $hand $chan $chan1
- }
- ################################ say ##################################
- proc saypublic {nick host hand chan arg} {
- global black
- set text [join [lrange [split $arg] 0 end]]
- set c [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set text [join [lrange [split $arg] 1 end]]
- }
- say:process $nick $host $hand $chan $chan1 $text $type
- }
- proc say:process {nick host hand chan chan1 text type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($text == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 say.1 none
- return 0
- }
- if {($text == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 say.2 none
- return 0
- }
- }
- if {($text == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 say.3 none
- return 0
- }
- if {($text == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 say.4 none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- putquick "PRIVMSG $chan :$text"
- }
- ################################ act ##################################
- proc actpublic {nick host hand chan arg} {
- global black
- set text [join [lrange [split $arg] 0 end]]
- set c [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set text [join [lrange [split $arg] 1 end]]
- }
- act:process $nick $host $hand $chan $chan1 $text $type
- }
- proc act:process {nick host hand chan chan1 text type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($text == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 act.1 none
- return 0
- }
- if {($text == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 act.2 none
- return 0
- }
- }
- if {($text == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 act.3 none
- return 0
- }
- if {($text == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 act.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- putquick "PRIVMSG $chan :\001ACTION $text\001"
- }
- ############################## broadcast ##############################
- proc broadcastpublic {nick host hand chan arg} {
- global black
- set text [join [lrange [split $arg] 0 end]]
- set chan1 "$chan"
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {$text == ""} {
- blacktools:tell $nick $host $hand $chan $chan1 broadcast.1 none
- return 0
- }
- broadcast:cmd:process $nick $host $hand $chan $chan1 $text
- }
- proc broadcast:cmd:process {nick host hand chan chan1 text} {
- global botnick black
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- foreach c [channels] {
- if {![channel get $c silent]} {
- putquick "PRIVMSG $c :(BROADCAST) $text"
- }
- }
- }
- ############################### check #################################
- proc checkpublic {nick host hand chan arg} {
- global black
- set chan1 "$chan"
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set checked [lindex [split $arg] 0]
- if {$checked == ""} { blacktools:tell $nick $host $hand $chan $chan1 check.1 none
- return 0
- }
- check:process $nick $host $hand $chan $chan1 $checked
- }
- proc check:process {nick host hand chan chan1 checked} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set handle [nick2hand $checked]
- if {[matchattr $hand -|q $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $handle $black(exceptflags) $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- if {[isbotnick $checked]} {
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {![onchan $checked $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.usernotonchan $checked
- return 0
- }
- if {[onchan $checked $chan]} {
- set mask *!*@[lindex [split [getchanhost $checked $chan] "@"] 1]
- }
- set countz [getuser $hand XTRA check($chan)]
- if {$countz == ""} { set countz 0 }
- set counts [expr $countz + 1]
- setuser $hand XTRA check($chan) $counts
- set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getmsg $black(say.$getlang.check.3)
- if {[info exists black(say.$getlang.check.3)]} {
- putquick "PRIVMSG $checked :$black(say.$getlang.check.3)"
- }
- }
- ############################## version ################################
- proc versionpublic {nick host hand chan arg} {
- global botnick black
- set chan1 "$chan"
- version:process $nick $host $hand $chan $chan1
- }
- proc version:process {nick host hand chan chan1} {
- global botnick black
- blacktools:tell $nick $host $hand $chan $chan1 version.1 none
- }
- ############################### cycle #################################
- proc cycle:process {nick host hand chan chan1 reason} {
- global black botnick
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {$reason == ""} { set reason "No Reason" }
- putquick "PART $chan :$reason"
- utimer 5 [list putquick "JOIN $chan"]
- }
- proc cyclepublic {nick host hand chan arg} {
- global black
- set reason [join [lrange [split $arg] 0 end]]
- set c [lindex [split $arg] 0]
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set reason [join [lrange [split $arg] 1 end]]
- }
- cycle:process $nick $host $hand $chan $chan1 $reason
- }
- ################################ away #################################
- proc awaypublic {nick host hand chan arg} {
- global black
- set chan1 "$chan"
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set aw [join [lrange [split $arg] 0 end]]
- if {$aw == "" } {blacktools:tell $nick $host $hand $chan $chan1 away.1 none
- return 0
- }
- away:process $nick $host $hand $chan $chan1 $aw
- }
- proc away:process {nick host hand chan chan1 aw} {
- global black botnick wdir
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[string match -nocase "$aw" "off"]} {
- blacktools:tell $nick $host $hand $chan $chan1 away.3 none
- putquick "AWAY :"
- set type [open $wdir w]
- set none ""
- puts $type "$none"
- close $type
- return 0
- } else {
- blacktools:tell $nick $host $hand $chan $chan1 away.4 $aw ; putquick "AWAY :$aw"
- set type [open $wdir w]
- puts $type "$aw"
- close $type
- }
- }
- proc setaway {my} {
- global wdir
- if {[file exists $wdir] == 0} {
- set file [open $wdir a]
- close $file
- }
- set aways [open $wdir r]
- set away "[gets $aways]"
- catch {close $aways}
- if {$away == ""} {
- return 0
- } else {
- putserv "AWAY :"
- putserv "AWAY :$away"
- }
- }
- ################################### mode ######################################
- proc modepublic {nick host hand chan arg} {
- global black
- set modes [lindex [split $arg] 0]
- set chan1 "$chan"
- set type 0
- if {[regexp {^[#&]} $modes] && [matchattr $hand nm|- $chan]} {
- set chan "$modes"
- set modes [lindex [split $arg] 1]
- }
- mode:process $nick $host $hand $chan $chan1 $modes $type
- }
- proc mode:process {nick host hand chan chan1 modes type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($modes == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 mode.1 none
- return 0
- }
- if {($modes == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 mode.2 none
- return 0
- }
- }
- if {($modes == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 mode.3 none
- return 0
- }
- if {($modes == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 mode.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {![regexp {^[+ -]} $modes]} {
- blacktools:tell $nick $host $hand $chan $chan1 mode.5 none
- return 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 mode.6 $modes
- putserv "MODE $chan $modes"
- }
- ################################## myset #############################
- proc mysetpublic {nick host hand chan arg} {
- global black
- set chan1 "$chan"
- set flags [lindex [split $arg] 0]
- set type [lindex [split $arg] 1]
- if {$type == ""} {
- blacktools:tell $nick $host $hand $chan $chan1 myset.3 none
- return 0
- }
- myset:process $nick $host $hand $chan $chan1 $flags $type
- }
- proc myset:process {nick host hand chan chan1 flags typez} {
- global black
- switch -exact -- [string tolower $flags] {
- lang {
- setuser $hand XTRA OUTPUT_LANG $typez
- blacktools:tell $nick $host $hand $chan $chan1 myset.1 $typez
- return 0
- }
- output {
- if {[string match -nocase $typez "notice"]} {
- setuser $hand XTRA OUTPUT_TYPE 1
- blacktools:tell $nick $host $hand $chan $chan1 myset.2 $typez
- return 0
- }
- if {[string match -nocase $typez "chan"]} {
- setuser $hand XTRA OUTPUT_TYPE 0
- blacktools:tell $nick $host $hand $chan $chan1 myset.2 $typez
- return 0
- }
- }
- }
- }
- ################################# set #################################
- proc setpublic {nick host hand chan arg} {
- global black
- set flags [lindex [split $arg] 0]
- set type [join [lrange [split $arg] 1 end]]
- set chan1 "$chan"
- set type1 0
- if {[regexp {^[#&]} $flags] && [matchattr $hand nm|- $chan]} {
- set chan "$flags"
- set flags [lindex [split $arg] 1]
- set type [join [lrange [split $arg] 2 end]]
- }
- set:process $nick $host $hand $chan $chan1 $flags $type $type1
- }
- proc set:process {nick host hand chan chan1 flags type type1} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand -|q $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($flags == "") && ($type1 == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 set.1 none
- return 0
- }
- if {($flags == "") && ($type1 == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 set.2 none
- return 0
- }
- }
- if {($flags == "") && ($type1 == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 set.3 none
- return 0
- }
- if {($flags == "") && ($type1 == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 set.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {$type == ""} {
- set why [catch {channel set $chan $flags} error]
- if {$why == "1"} { blacktools:tell $nick $host $hand $chan $chan1 set.5 $flags
- return 0
- } else {
- channel set $chan $flags ; blacktools:tell $nick $host $hand $chan $chan1 set.6 $flags
- }
-
- } else {
- set why [catch {channel set $chan $flags $type} error]
- if {!([matchattr $hand mn|- $chan]) && [string match -nocase "backchan" $flags]} {
- return 0
- }
- if {$why == "1"} { blacktools:tell $nick $host $hand $chan $chan1 set.7 "$flags $type"
- return 0
- } else {
- channel set $chan $flags $type ; blacktools:tell $nick $host $hand $chan $chan1 set.8 "$flags $type"
- }
- }
- }
- proc ignorepublic {nick host hand chan arg} {
- global black
- set chan1 "$chan"
- set what [lindex [split $arg] 0]
- set mask [lindex [split $arg] 1]
- set time [lindex [split $arg] 2]
- set reason [join [lrange [split $arg] 3 end]]
- if {$what == ""} { blacktools:tell $nick $host $hand $chan $chan1 ignore.1 none
- return 0
- }
- ignore:process $nick $host $hand $chan $chan1 $what $mask $time $reason
- }
- proc ignore:process {nick host hand chan chan1 what mask time reason} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- switch -exact -- [string tolower $what] {
- list {
- if {[llength [ignorelist]] == "0"} { blacktools:tell $nick $host $hand $chan $chan1 ignore.3 none
- return 0
- }
- foreach ig [ignorelist] {
- set hostig [lindex $ig 0]
- set byig [lindex $ig 4]
- set time [lindex $ig 2]
- set reasig [lindex $ig 1]
- if {$time != "0"} {
- set bytime [clock format $time -format %D-%H:%M:%S]
- } else { set bytime "-"}
- blacktools:tell $nick $host $hand $chan $chan1 ignore.4 "$hostig $byig $bytime $reasig"
- }
- }
- add {
- if {[isignore $mask]} {
- blacktools:tell $nick $host $hand $chan $chan1 ignore.5 "$mask"
- return 0
- }
- if {![regexp {^[0-9]} $time]} {
- set time "60"
- }
- if {$reason == ""} { set reason "No Reason" }
- newignore $mask $hand $reason $time
- blacktools:tell $nick $host $hand $chan $chan1 ignore.6 "$mask $time $reason"
- }
- delete {
- if {$mask == ""} { blacktools:tell $nick $host $hand $chan $chan1 ignore.7 none
- return 0
- }
- if {[isignore $mask]} {
- killignore $mask
- } else { blacktools:tell $nick $host $hand $chan $chan1 ignore.8 "$mask"
- return 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 ignore.9 "$mask"
- }
- }
- }
- ################################# show ################################
- proc showpublic {nick host hand chan arg} {
- global black
- set wich [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[#&]} $wich] && [matchattr $hand nm|- $chan]} {
- set chan "$wich"
- set wich [lindex [split $arg] 1]
- }
- show:process $nick $host $hand $chan $chan1 $wich $type
- }
- proc show:process {nick host hand chan chan1 wich type} {
- global black botnick
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($wich == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 show.1 none
- return 0
- }
- if {($wich == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 show.2 none
- return 0
- }
- }
- if {($wich == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 show.3 none
- return 0
- }
- if {($wich == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 show.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- set why [catch {channel get $chan $wich} error]
- if {$why == "1"} { blacktools:tell $nick $host $hand $chan $chan1 show.5 $wich
- return 0
- } else {
- set replyinfo [channel get $chan $wich]
- if {($replyinfo == "") || ($replyinfo == "0")} {
- switch -exact -- [string tolower $wich] {
- antipub-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.antipub.1)
- }
- antilongtextmax {
- set replyinfo [channel get $chan antilongtextmax]
- if {$replyinfo == "0"} {
- set replyinfo "$black(longchar)"
- }
- }
- joinflood {
- set replyinfo [channel get $chan joinflood]
- if {$replyinfo == ""} {
- set replyinfo "4 5"
- }
- }
- chanflood {
- set replyinfo [channel get $chan chanflood]
- if {$replyinfo == ""} {
- set replyinfo "4 5"
- }
- }
- idleopmax {
- set replyinfo [channel get $chan idleopmax]
- if {$replyinfo == "0"} {
- set replyinfo "$black(idleopmax)"
- }
- }
- idlevoicemax {
- set replyinfo [channel get $chan idlevoicemax]
- if {$replyinfo == "0"} {
- set replyinfo "$black(idlevoicemax)"
- }
- }
- private-bantime {
- set replyinfo "$black(privatebantime)"
- }
- private-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.private.12)
- }
- antipub-bantime {
- set replyinfo "$black(antipubbantime)"
- }
- antinotice-bantime {
- set replyinfo "$black(antinoticebantime)"
- }
- antinotice-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.antinotice.1)
- }
- antictcp-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.antictcp.1)
- }
- antictcp-bantime {
- set replyinfo "$black(antictcpbantime)"
- }
- antibadword-bantime {
- set replyinfo "$black(antibadwordbantime)"
- }
- antibadword-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.antibadword.1)
- }
- antilongtext-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.antilongtext.1)
- }
- antilongtext-bantime {
- set replyinfo "$black(longbantime)"
- }
- antibadquitpart-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.antibadquitpart.1)
- }
- antibadquitpart-bantime {
- set replyinfo "$black(badquitparttime)"
- }
- antijoinpart-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.antijoinpart.1)
- }
- antijoinpart-bantime {
- set replyinfo "$black(joinpartbantime)"
- }
- antispam-bantime {
- set replyinfo "$black(spamban)"
- }
- antispam-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.antispam.1)
- }
- antirepeat-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.antirepeat.1)
- }
- antirepeat-setting {
- set replyinfo "$black(repeats)"
- }
- antirepeat-bantime {
- set replyinfo "$black(antirepeatbantime)"
- }
- anticolor-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.anticolor.1)
- }
- anticolor-bantime {
- set replyinfo "$black(anticolorbantime)"
- }
- antibold-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.antibold.1)
- }
- antibold-bantime {
- set replyinfo "$black(antiboldbantime)"
- }
- antiunderline-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.antiunderline.1)
- }
- antiunderline-bantime {
- set replyinfo "$black(antiunderlinebantime)"
- }
- anticaps-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.anticaps.1)
- }
- anticaps-bantime {
- set replyinfo "$black(anticapsbantime)"
- }
- badfullname-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.badfullname.1)
- }
- badfullname-bantime {
- set replyinfo "$black(badfbantime)"
- }
- badnick-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.badnick.1)
- }
- badnick-bantime {
- set replyinfo "$black(badnickbantime)"
- }
- badident-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.badident.1)
- }
- badident-bantime {
- set replyinfo "$black(badidentbantime)"
- }
- antichanflood-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.antichanflood.1)
- }
- antichanflood-bantime {
- set replyinfo "$black(antifloodchanbantime)"
- }
- badchan-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.badchan.15)
- }
- badchan-bantime {
- set replyinfo "$black(badcbantime)"
- }
- count-message {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.count.11)
- }
- dr-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.dr.5)
- }
- dr-bantime {
- set replyinfo "$black(drtime)"
- }
- bot-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.bot.5)
- }
- bot-bantime {
- set replyinfo "$black(bottime)"
- }
- n-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.n.5)
- }
- n-bantime {
- set replyinfo "$black(ntime)"
- }
- id-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.id.5)
- }
- id-bantime {
- set replyinfo "$black(idtime)"
- }
- w-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.w.5)
- }
- spam-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.spam.5)
- }
- spam-bantime {
- set replyinfo "$black(spamtime)"
- }
- bw-reason {
- set getlang [string tolower [channel get $chan lang]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set replyinfo $black(say.$getlang.bw.5)
- }
- bw-bantime {
- set replyinfo "$black(bwtime)"
- }
- }
- }
- blacktools:tell $nick $host $hand $chan $chan1 show.6 "$wich $replyinfo"
- }
- }
- ############################## silence ################################
- proc silencepublic {nick host hand chan arg} {
- global black
- set value [lindex [split $arg] 0]
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set chan1 "$chan"
- if {$value == ""} { blacktools:tell $nick $host $hand $chan $chan1 silence.1 none
- return 0
- }
- silence:process $nick $host $hand $chan $chan1 $value
- }
- proc silence:process {nick host hand chan chan1 value} {
- global botnick black
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {([regexp -nocase -- {(#[0-9]+|on|off)} $value tmp silents]) && (![regexp -nocase -- {\S#} $value])} {
- switch $silents {
- on { blacktools:tell $nick $host $hand $chan $chan1 silence.3 none ; putquick "SILENCE +*!*@*"
- }
- off { blacktools:tell $nick $host $hand $chan $chan1 silence.4 none ; putquick "SILENCE -*!*@*"
- }
- }
- }
- }
- ############################## msg ####################################
- proc msgpublic {nick host hand chan arg} {
- global black
- set nicks [lindex [split $arg] 0]
- set chan1 "$chan"
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set msg [join [lrange [split $arg] 1 end]]
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {$nicks == ""} {blacktools:tell $nick $host $hand $chan $chan1 msg.1 none
- return 0
- }
- if {[isbotnick $nicks]} {
- return 0
- }
- putquick "PRIVMSG $nicks :$msg"
- }
- ############################### reset #################################
- proc resetpublic {nick host hand chan arg} {
- global black
- set dece [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[#&]} $dece] && [matchattr $hand nm|- $chan]} {
- set chan "$dece"
- set dece [lindex [split $arg] 1]
- }
- reset:process $nick $host $hand $chan $chan1 $dece $type
- }
- proc reset:process {nick host hand chan chan1 dece type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($dece == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 reset.1 none
- return 0
- }
- if {($dece == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 reset.2 none
- return 0
- }
- }
- if {($dece == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 reset.3 none
- return 0
- }
- if {($dece == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 reset.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {[string match -nocase "all" "$dece"]} {
- 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"
- foreach eflag $emptyflag {
- channel set $chan $eflag ""
- }
- 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"
- foreach oflag $zeroflag {
- channel set $chan $oflag 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 reset.5 none
- return 0
- }
- set why [catch {channel set $chan $dece ""} error]
- if {$why == "1"} { blacktools:tell $nick $host $hand $chan $chan1 reset.6 $dece
- } else {
- channel set $chan $dece ""
- blacktools:tell $nick $host $hand $chan $chan1 reset.7 $dece
- }
- }
- ################################### banlist ###################################
- proc banlistpublic {nick host hand chan arg} {
- global botnick black
- set user [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
- set chan "$user"
- set user [lindex [split $arg] 1]
- }
- banlist:process $nick $host $hand $chan $chan1 $user $type
- }
- proc banlist:process {nick host hand chan chan1 user type} {
- global botnick black
- set i 0
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 banlist.1 none
- blacktools:tell $nick $host $hand $chan $chan1 banlist.2 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 banlist.3 none
- blacktools:tell $nick $host $hand $chan $chan1 banlist.4 none
- return 0
- }
- }
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 banlist.5 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 banlist.6 none
- return 0
- }
- if {[matchattr $hand nm|- $chan] && [string match -nocase "global" $user]} {
- foreach ban [banlist] {
- set i [expr $i +1]
- set expire [clock format [lindex $ban 2] -format %D-%H:%M:%S]
- set create [clock format [lindex $ban 3] -format %D-%H:%M:%S]
- set fban [lindex $ban 0]
- set freason [lindex $ban 1]
- set fbywho [lindex $ban 5]
- if {[lindex $ban 2] == 0} {
- set expire "Permanent"
- }
- blacktools:tell $nick $host $hand $chan $chan1 banlist.9 none
- blacktools:tell $nick $host $hand $chan $chan1 banlist.10 "$fban $fbywho $create $expire $freason"
- set foundban 1
- }
- if {![info exists foundban]} {
- blacktools:tell $nick $host $hand $chan $chan1 banlist.7 none
- } else { blacktools:tell $nick $host $hand $chan $chan1 banlist.8 none }
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {![validuser $user]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
- return 0
- }
- if {![matchattr $user nm|OASMN $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none
- return 0
- }
- foreach ban [banlist $chan] {
- set own [lindex $ban 5]
- if {[string match -nocase $own $user]} {
- set i [expr $i +1]
- set expire [clock format [lindex $ban 2] -format %D-%H:%M:%S]
- set create [clock format [lindex $ban 3] -format %D-%H:%M:%S]
- set fban [lindex $ban 0]
- set freason [lindex $ban 1]
- if {[lindex $ban 2] == 0} {
- set expire "Permanent"
- }
- blacktools:tell $nick $host $hand $chan $chan1 banlist.11 $user
- blacktools:tell $nick $host $hand $chan $chan1 banlist.12 "$fban $create $expire $freason"
- set foundban 1
- }
- }
- if {![info exists foundban]} {
- blacktools:tell $nick $host $hand $chan $chan1 banlist.11 $user
- blacktools:tell $nick $host $hand $chan $chan1 banlist.7 $user
- } else {
- blacktools:tell $nick $host $hand $chan $chan1 banlist.8 $user }
- }
- ############################## rehash #################################
- proc rehashme {nick host hand arg} {
- global black
- blacktools:tell:prv $nick $host $hand rehash.1 none
- rehash
- }
- ############################## VERSION ################################
- proc blackreply {nick host hand dest key text} {
- global ctcp-version
- set {ctcp-version} "1Using 4BlackTools 2.3 1by 12BLaCkShaDoW"
- }
- ############################## restart ################################
- proc restartme {nick host hand arg} {
- global black
- blacktools:tell:prv $nick $host $hand restart.1 none
- utimer 3 [list restart ]
- }
- ############################### save #################################
- proc saveme {nick host hand arg} {
- global black
- blacktools:tell:prv $nick $host $hand save.1 none
- save
- }
- ############################### jump #################################
- proc jumpme {nick host hand arg} {
- global black
- blacktools:tell:prv $nick $host $hand jump.1 none
- utimer 3 [list jump]
- }
- ############################### die ###################################
- proc dieme {nick host hand arg} {
- global black
- blacktools:tell:prv $nick $host $hand die.1 none
- utimer 3 [list die "byeeee" ]
- }
- ############################## nick ###################################
- proc nickpublic {altnick host hand arg} {
- global nick black
- set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
- set newnick [lindex [split $arg] 0]
- if {$newnick == ""} { blacktools:tell:prv $nick $host $hand nick.2 none
- return 0
- }
- blacktools:tell:prv $nick $host $hand nick.1 "$newnick"
- set nick $newnick
- }
- proc nick:process {who newnick host hand chan} {
- global black nick
- set chan1 "$chan"
- if {$newnick == ""} {
- blacktools:tell $who $host $hand $chan $chan1 nick.2 none
- return 0
- }
- blacktools:tell $who $host $hand $chan $chan1 nick.1 none
- set nick $newnick
- }
- ############################## addchan ################################
- proc addchanpublic {nick host hand arg} {
- global black
- set chans [lindex [split $arg] 0]
- if {$chans == ""} {blacktools:tell:prv $nick $host $hand addchan.1 none
- return 0
- }
- if {![regexp {^[#&]} $chans]} {
- blacktools:tell:prv $nick $host $hand gl.novalidchan none
- return 0
- }
- if {[validchan $chans]} {
- blacktools:tell:prv $nick $host $hand addchan.2 "$chans"
- return 0
- } else {
- channel add $chans
- addchan:stats $chans $hand $host
- blacktools:tell:prv $nick $host $hand addchan.3 "$chans"
- }
- }
- proc addchan:stats {chan hand host} {
- global black botnick statsdir
- set k 0
- set time [unixtime]
- set file [open $statsdir "r"]
- set addfile "$chan ADDED $hand $host $time 0"
- set database [read -nonewline $file]
- close $file
- set data [split $database "\n"]
- foreach line $data {
- set k [expr $k +1]
- set chanentry [lindex [split $line] 0]
- set addtype [lindex [split $line] 1]
- if {[string equal -nocase "REMOVED" "$addtype"] && [string match -nocase $chanentry $chan]} {
- if {$line != ""} {
- set num [expr $k - 1]
- set delete [lreplace $data $num $num]
- set files [open $statsdir "w"]
- puts $files [join $delete "\n"]
- close $files
- }
- }
- }
- set file [open $statsdir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $statsdir "w"]
- close $files
- }
- set file [open $statsdir "a"]
- puts $file "$addfile"
- close $file
- }
- proc delchan:stats {chan hand host} {
- global black botnick statsdir
- set k 0
- set time [unixtime]
- set file [open $statsdir "r"]
- set database [read -nonewline $file]
- close $file
- set data [split $database "\n"]
- set addfile "$chan REMOVED $hand $host $time 0 0 none none"
- foreach line $data {
- set k [expr $k +1]
- set chanentry [lindex [split $line] 0]
- set addtype [lindex [split $line] 1]
- if {[string equal -nocase "REMOVED" "$addtype"] && [string match -nocase $chanentry $chan]} {
- if {$line != ""} {
- set num [expr $k - 1]
- set delete [lreplace $data $num $num]
- set files [open $statsdir "w"]
- puts $files [join $delete "\n"]
- close $files
- }
- }
- if {[string equal -nocase "ADDED" "$addtype"] && [string match -nocase $chanentry $chan]} {
- set added [lindex [split $line] 4]
- set bywho [lindex [split $line] 2]
- set byhost [lindex [split $line] 3]
- set addfile "$chan REMOVED $hand $host $time $added $bywho $byhost"
- if {$line != ""} {
- set num [expr $k - 1]
- set delete [lreplace $data $num $num]
- set files [open $statsdir "w"]
- puts $files [join $delete "\n"]
- close $files
- }
- }
- }
- set file [open $statsdir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $statsdir "w"]
- close $files
- }
- set file [open $statsdir "a"]
- puts $file "$addfile"
- close $file
- }
- ############################## delchan ################################
- proc delchanpublic {nick host hand arg} {
- global black
- set chans [lindex [split $arg] 0]
- if {$chans == ""} {blacktools:tell:prv $nick $host $hand delchan.1 none
- return 0
- }
- if {![regexp {^[\\+!#&]} $chans]} {
- blacktools:tell:prv $nick $host $hand gl.novalidchan none
- return 0
- }
- if {![validchan $chans]} { blacktools:tell:prv $nick $host $hand delchan.2 $chans
- return 0
- }
- delchan:stats $chans $hand $host
- channel remove $chans
- blacktools:tell:prv $nick $host $hand delchan.3 $chans
- }
- ############################## suspend ################################
- proc suspendpublic {nick host hand arg} {
- global black
- set chans [lindex [split $arg] 0]
- if {$chans == ""} {blacktools:tell:prv $nick $host $hand suspend.1 none
- return 0
- }
- if {![regexp {^[\\+!#&]} $chans]} {
- blacktools:tell:prv $nick $host $hand gl.novalidchan none
- return 0
- }
- if {![validchan $chans]} { blacktools:tell:prv $nick $host $hand suspend.2 $chans
- return 0
- }
- if {[channel get $chans inactive]} {
- blacktools:tell:prv $nick $host $hand suspend.3 $chans
- return 0
- }
- channel set $chans +inactive
- blacktools:tell:prv $nick $host $hand suspend.4 $chans
- }
- ############################# unsuspend ###############################
- proc unsuspendpublic {nick host hand arg} {
- global black
- set chans [lindex [split $arg] 0]
- if {$chans == ""} {blacktools:tell:prv $nick $host $hand unsuspend.1 none
- return 0
- }
- if {![regexp {^[\\+!#&]} $chans]} {
- blacktools:tell:prv $nick $host $hand gl.novalidchan none
- return 0
- }
-
- if {![validchan $chans]} { blacktools:tell:prv $nick $host $hand unsuspend.2 $chans
- return 0
- }
- if {![channel get $chans inactive]} {
- blacktools:tell:prv $nick $host $hand unsuspend.3 $chans
- return 0
- }
- channel set $chans -inactive
- blacktools:tell:prv $nick $host $hand unsuspend.4 $chans
- }
- ################################ op ###################################
- proc oppublic {nick host hand arg} {
- global black
- set chan [lindex [split $arg] 0]
- set nicks [lrange [split $arg] 1 end]
- if {![validchan $chan]} {
- blacktools:tell:prv $nick $host $hand gl.nocmem $chan
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell:prv $nick $host $hand gl.suspend none
- return 0
- }
- if {$nicks == ""} { set nicks "$nick" }
- if {[matchattr $hand nm|OASM $chan]} {
- if {![regexp {^[\\+!#&]} $chan]} {
- blacktools:tell:prv $nick $host $hand gl.novalidchan none
- return 0
- }
- if {![botisop $chan]} { blacktools:tell:prv $nick $host $hand gl.noop none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell:prv $nick $host $hand op.1 $chan
- return 0
- }
- foreach nickz $nicks {
- if {[isop $nickz $chan]} {
- blacktools:tell:prv $nick $host $hand op.2 $nickz
- return 0
- }
- putquick "MODE $chan +o $nickz"
- }
- }
- }
- ############################### deop ##################################
- proc deoppublic {nick host hand arg} {
- global black
- set chan [lindex [split $arg] 0]
- set nicks [lrange [split $arg] 1 end]
- if {![validchan $chan]} {
- blacktools:tell:prv $nick $host $hand gl.nocmem $chan
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell:prv $nick $host $hand gl.suspend none
- return 0
- }
- if {$nicks == ""} { set nicks "$nick" }
- if {[matchattr $hand nm|OASM $chan]} {
- if {![regexp {^[\\+!#&]} $chan]} {
- blacktools:tell:prv $nick $host $hand gl.novalidchan none
- return 0
- }
- if {![botisop $chan]} { blacktools:tell:prv $nick $host $hand gl.noop none
- return 0
- }
- if {![validchan $chan]} { blacktools:tell:prv $nick $host $hand deop.1 $chan
- return 0
- }
- foreach nickz $nicks {
- if {[onchan $nickz $chan]} {
- putquick "MODE $chan -o $nickz"
- }
- }
- }
- }
- ############################### voice #################################
- proc voicepublic {nick host hand arg} {
- global black
- set chan [lindex [split $arg] 0]
- set nicks [lrange [split $arg] 1 end]
- if {![validchan $chan]} {
- blacktools:tell:prv $nick $host $hand gl.nocmem $chan
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell:prv $nick $host $hand gl.suspend none
- return 0
- }
- if {$nicks == ""} { set nicks "$nick" }
- if {[matchattr $hand nm|OASM $chan]} {
- if {![regexp {^[\\+!#&]} $chan]} {
- blacktools:tell:prv $nick $host $hand gl.novalidchan none
- return 0
- }
- if {![botisop $chan]} { blacktools:tell:prv $nick $host $hand gl.noop none
- return 0
- }
- if {![validchan $chan]} { blacktools:tell:prv $nick $host $hand voice.1 $chan
- return 0
- }
- foreach nickz $nicks {
- if {[onchan $nickz $chan]} {
- if {[isvoice $nickz $chan]} {
- blacktools:tell:prv $nick $host $hand voice.2 $nickz
- return 0
- }
- putquick "MODE $chan +v $nickz"
- }
- }
- }
- }
- ############################## devoice ################################
- proc devoicepublic {nick host hand arg} {
- global black
- set chan [lindex [split $arg] 0]
- set nicks [lrange [split $arg] 1 end]
- if {![validchan $chan]} {
- blacktools:tell:prv $nick $host $hand gl.nocmem $chan
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell:prv $nick $host $hand gl.suspend none
- return 0
- }
- if {$nicks == ""} { set nicks "$nick" }
- if {[matchattr $hand nm|OASM $chan]} {
- if {![regexp {^[\\+!#&]} $chan]} {
- blacktools:tell:prv $nick $host $hand gl.novalidchan none
- return 0
- }
- if {![botisop $chan]} { blacktools:tell:prv $nick $host $hand gl.noop none
- return 0
- }
- if {![validchan $chan]} { blacktools:tell:prv $nick $host $hand devoice.1 $chan
- return 0
- }
- foreach nickz $nicks {
- if {[onchan $nickz $chan]} {
- putquick "MODE $chan -v $nickz"
- }
- }
- }
- }
- ############################## invite #################################
- proc invitepublic {nick host hand arg} {
- global black
- set chan [lindex [split $arg] 0]
- set replace(%chan%) $chan
- if {![validchan $chan]} {
- blacktools:tell:prv $nick $host $hand gl.nocmem $chan
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell:prv $nick $host $hand gl.suspend none"
- return 0
- }
- if {[matchattr $hand nm|OASM $chan]} {
- if {$chan == ""} { blacktools:tell:prv $nick $host $hand invite.1 none
- return 0
- }
- putquick "INVITE $nick $chan"
- set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set getmsg $black(say.$getlang.invite.2)
- if {[info exists black(say.$getlang.invite.2)]} {
- set getmsg [string map [array get replace] $getmsg]
- putquick "PRIVMSG $nick :$getmsg"
- }
- }
- }
- ##############################add ######################################
- proc add:process {args time level hand host chan chan1 nick type} {
- global black botnick
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set flags "nm|NMOSAV"
- if {[matchattr $hand nm|- $chan]} {
- if {($level == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 add.1 none
- return 0
- }
- if {($level == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 add.2 none
- return 0
- }
- }
- if {($level == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 add.3 none
- return 0
- }
- if {($level == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 add.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- foreach user $args {
- if {$user != ""} {
- set replace(%user%) $user
- if {([string length $user]>=10) && ($black(maxhand) == "1")} {
- set user [string range $user 0 8]
- }
- set uhost [string map [array get replace] $black(hostadd)]
- if {[userlist] != ""} {
- foreach usr [userlist] {
- set hst [getuser $usr hosts]
- foreach hhost $hst {
- if {[string match -nocase $hhost $uhost] && (![string match -nocase $usr $user])} {
- blacktools:tell $nick $host $hand $chan $chan1 add.5 $usr
- return 0
- }
- }
- }
- }
-
- if {[matchattr $hand -|A $chan] && ($level == "manager")} {
- blacktools:tell $nick $host $hand $chan $chan1 add.6 none
- return 0
- }
- if {[matchattr $hand -|A $chan] && ($level == "admin")} {
- blacktools:tell $nick $host $hand $chan $chan1 add.7 none
- return 0
- }
- if {[matchattr $hand -|M $chan] && ($level == "manager")} {
- blacktools:tell $nick $host $hand $chan $chan1 add.8 none
- return 0
- }
- if {([regexp -nocase -- {(#[0-9]+|owner|manager|admin|senior|op|voice|protect)} $level tmp access]) && (![regexp -nocase -- {\S#} $level])} {
- switch $access {
- manager {
- set flags "-|olM"
- if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[validuser $user]} {
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.9 $user
- } else {
- adduser $user $uhost
- chattr $user -|-SOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
- blacktools:tell $nick $host $hand $chan $chan1 add.9 $user
- }
- }
- admin {
- set flags "-|olA"
- if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[validuser $user]} {
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.11 $user
- } else {
- adduser $user $uhost
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
- blacktools:tell $nick $host $hand $chan $chan1 add.11 $user
- }
- }
- senior {
- set flags "-|olS"
- if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[validuser $user]} {
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.12 $user
- } else {
- adduser $user $uhost
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
- blacktools:tell $nick $host $hand $chan $chan1 add.12 $user
- }
- }
- owner {
- if {[matchattr $hand n|- $chan]} {
- set flags "m|-"
- if {[validuser $user]} {
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.16 $user
- } else {
- adduser $user $uhost
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
- blacktools:tell $nick $host $hand $chan $chan1 add.16 $user
- }
- }
- }
- op {
- set flags "-|olO"
- if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[validuser $user]} {
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.13 $user
- } else {
- adduser $user $uhost
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
- blacktools:tell $nick $host $hand $chan $chan1 add.13 $user
- }
- }
- protect {
- set flags "-|H"
- if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[validuser $user]} {
- chattr $user -|-qHolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.15 $user
- } else {
- adduser $user $uhost
- chattr $user -|-qolHSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
- blacktools:tell $nick $host $hand $chan $chan1 add.15 $user
- }
- }
- voice {
- set flags "-|lV"
- if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[validuser $user]} {
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.14 $user
- } else {
- adduser $user $uhost
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
- blacktools:tell $nick $host $hand $chan $chan1 add.14 $user
- }
- }
- }
- }
- }
- }
- }
- ########################## adduser ################################
- proc adduserpublic {nick host hand chan arg} {
- global black
- set level [lindex [split $arg] 0]
- set args [lrange [split $arg] 1 end]
- set c [lindex [split $arg] 1]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set args [lrange [split $arg] 2 end]
- }
- adduser:process $nick $host $hand $chan $chan1 $args $level $type
- }
- proc adduser:process {nick host hand chan chan1 args level type} {
- global black botnick
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set time [ctime [unixtime]]
- set flags "nm|NMOSVA"
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($level == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 adduser.1 none
- return 0
- }
- if {($level == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 adduser.2 none
- return 0
- }
- }
- if {($level == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 adduser.3 none
- return 0
- }
- if {($level == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 adduser.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- foreach user $args {
- if {$user != ""} {
- if {![onchan $user $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.usernotonchan $user
- return 0
- }
- set handle [nick2hand $user]
- set hosts [getchanhost $user $chan]
- set uhost "*!*@[lindex [split $hosts @] 1]"
- if {([string length $user]>=10) && ($black(maxhand) == "1")} {
- set user [string range $user 0 8]
- }
- if {[userlist] != ""} {
- foreach usr [userlist] {
- set hst [getuser $usr hosts]
- foreach hhost $hst {
- if {[string match -nocase $hhost $uhost] && (![string match -nocase $usr $user])} {
- blacktools:tell $nick $host $hand $chan $chan1 add.5 $usr
- return 0
- }
- }
- }
- }
- if {[matchattr $hand -|A $chan] && ($level == "manager")} {
- blacktools:tell $nick $host $hand $chan $chan1 add.6 none
- return 0
- }
- if {[matchattr $hand -|A $chan] && ($level == "admin")} {
- blacktools:tell $nick $host $hand $chan $chan1 add.7 none
- return 0
- }
- if {[matchattr $hand -|M $chan] && ($level == "manager")} {
- blacktools:tell $nick $host $hand $chan $chan1 add.8 none
- return 0
- }
- if {([regexp -nocase -- {(#[0-9]+|owner|manager|admin|senior|op|voice|protect)} $level tmp access]) && (![regexp -nocase -- {\S#} $level])} {
- switch $access {
- manager {
- set flags "-|olM"
- if {[matchattr $handle m|- $chan] && [matchattr $hand -|M $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle -|M $chan] && [matchattr $hand -|M $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[validuser $user]} {
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.9 $user
- } else {
- adduser $user $uhost
- chattr $user -|-SOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
- blacktools:tell $nick $host $hand $chan $chan1 add.9 $user
- }
- }
- admin {
- set flags "-|olA"
- if {[matchattr $handle -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[validuser $user]} {
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.11 $user
- } else {
- adduser $user $uhost
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
- blacktools:tell $nick $host $hand $chan $chan1 add.11 $user
- }
- }
- senior {
- set flags "-|olS"
- if {[matchattr $handle -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[validuser $user]} {
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.12 $user
- } else {
- adduser $user $uhost
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
- blacktools:tell $nick $host $hand $chan $chan1 add.12 $user
- }
- }
- owner {
- if {[matchattr $hand n|- $chan]} {
- set flags "m|-"
- if {[validuser $user]} {
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.16 $user
- } else {
- adduser $user $uhost
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
- blacktools:tell $nick $host $hand $chan $chan1 add.16 $user
- }
- }
- }
- op {
- set flags "-|olO"
- if {[matchattr $handle -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[validuser $user]} {
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.13 $user
- } else {
- adduser $user $uhost
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
- blacktools:tell $nick $host $hand $chan $chan1 add.13 $user
- }
- }
- protect {
- set flags "-|H"
- if {[matchattr $handle -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[validuser $user]} {
- chattr $user -|-qolHSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.15 $user
- } else {
- adduser $user $uhost
- chattr $user -|-qolHSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
- blacktools:tell $nick $host $hand $chan $chan1 add.15 $user
- }
- }
- voice {
- set flags "-|lV"
- if {[matchattr $handle -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $handle n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[validuser $user]} {
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.14 $user
- } else {
- adduser $user $uhost
- chattr $user -|-qolSOAMV $chan
- chattr $user $flags $chan
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 add.10 "$user $uhost"
- blacktools:tell $nick $host $hand $chan $chan1 add.14 $user
- }
- }
- }
- }
- }
- }
- }
- proc publicadd {nick host hand chan arg} {
- global black
- set level [lindex [split $arg] 0]
- set time [ctime [unixtime]]
- set type 0
- set chan1 "$chan"
- set args [lrange [split $arg] 1 end]
- set c [lindex [split $arg] 1]
- if {[regexp {^[#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set args [lrange [split $arg] 2 end]
- }
- if {[matchattr $hand -|q $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- add:process $args $time $level $hand $host $chan $chan1 $nick $type
- }
- ############################## delacc ################################
- proc delaccpublic {nick host hand chan arg} {
- global black
- set args [lrange [split $arg] 0 end]
- set type 0
- set chan1 "$chan"
- set c [lindex [split $arg] 0]
- if {[regexp {^[#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set args [lrange [split $arg] 1 end]
- }
- delacc:process $nick $host $hand $chan $chan1 $args $type
- }
- proc delacc:process {nick host hand chan chan1 args type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($args == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 delacc.1 none
- return 0
- }
- if {($args == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 delacc.2 none
- return 0
- }
- }
- if {($args == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 delacc.3 none
- return 0
- }
- if {($args == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 delacc.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- foreach user $args {
- if {$user != ""} {
- if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {![matchattr $user nm|aolSOAMV $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none
- return 0
- }
- if {[validuser $user]} {
- chattr $user -|-qaolSOAMV $chan
- blacktools:tell $nick $host $hand $chan $chan1 delacc.5 $user
- } else { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none }
- }
- }
- }
- ############################## del #####################################
- proc delpublic {nick host hand chan arg} {
- global black
- set args [lrange [split $arg] 0 end]
- set type 0
- set chan1 "$chan"
- del:process $nick $host $hand $chan $chan1 $args $type
- }
- proc del:process {nick host hand chan chan1 args type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {($args == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 del.1 none
- return 0
- }
- if {($args == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 del.2 none
- return 0
- }
- foreach user $args {
- if {$user != ""} {
- if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[validuser $user]} {
- deluser $user
- blacktools:tell $nick $host $hand $chan $chan1 del.3 $user
- } else { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none }
- }
- }
- }
- ################################ addhost #############################
- proc addhostpublic {nick host hand chan arg} {
- global black
- set user [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- set hosts [lrange [split $arg] 1 end]
- addhost:process $nick $host $hand $chan $chan1 $user $hosts $type
- }
- proc addhost:process {nick host hand chan chan1 user hosts type} {
- global black botnick
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set time [ctime [unixtime]]
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 addhost.1 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 addhost.2 none
- return 0
- }
- if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[validuser $user]} {
- set hhost [getuser $user hosts]
- foreach hhost $hhost {
- if {[string match -nocase $hosts $hhost]} {
- blacktools:tell $nick $host $hand $chan $chan1 addhost.3 "$user $hosts"
- return 0
- }
- }
- setuser $user HOSTS $hosts
- setuser $user XTRA LASTMODIFBY $hand
- setuser $user XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 addhost.4 "$user $hosts"
- } else { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none }
- }
- ############################### delhost ############################
- proc delhostpuplic {nick host hand chan arg} {
- global black
- set user [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- set hosts [lrange [split $arg] 1 end]
- delhost:process $nick $host $hand $chan $chan1 $user $hosts $type
- }
- proc delhost:process {nick host hand chan chan1 user hosts type} {
- global black botnick
- set time [ctime [unixtime]]
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 delhost.1 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 delhost.2 none
- return 0
- }
- if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[validuser $user]} {
- set hhost [getuser $user hosts]
- foreach hhost $hhost {
- if {[string match -nocase $hhost $hosts]} {
- set foundhost 1
- }
- }
- if {![info exists foundhost]} {
- blacktools:tell $nick $host $hand $chan $chan1 delhost.3 "$user $hosts"
- return 0
- }
- delhost $user $hosts
- blacktools:tell $nick $host $hand $chan $chan1 delhost.4 "$user $hosts"
- } else {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
- }
- }
- proc chuserpublic {nick host hand chan arg} {
- global black
- set user [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- set chandle [lindex [split $arg] 1]
- chuser:process $nick $host $hand $chan $chan1 $user $chandle $type
- }
- proc chuser:process {nick host hand chan chan1 user chandle type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set time [ctime [unixtime]]
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 chuser.1 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 chuser.2 none
- return 0
- }
- if {[matchattr $user -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $user n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[validuser $user]} {
- chhandle $user $chandle
- setuser $chandle XTRA LASTMODIFBY $hand
- setuser $chandle XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 chuser.3 "$user $chandle"
- } else {blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none }
- }
- proc userlist:execute {hand host level chan chan1 nick type} {
- global black botnick
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($level == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 userlist.1 none
- return 0
- }
- if {($level == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 userlist.2 none
- return 0
- }
- }
- if {($level == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 userlist.3 none
- return 0
- }
- if {($level == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 userlist.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {([regexp -nocase -- {(#[0-9]+|manager|protect|admin|senior|op|voice|all|owner)} $level tmp access]) && (![regexp -nocase -- {\S#} $level])} {
- switch $access {
- manager {
- set flags "-|M"
- set numar [llength [userlist $flags $chan]]
- set list [userlist $flags $chan]
- foreach user [wordwrap [join $list " "] 250 ,] {
- if {$list == ""} { set user "NONE" }
- blacktools:tell $nick $host $hand $chan $chan1 userlist.5 $numar
- blacktools:tell $nick $host $hand $chan $chan1 userlist.6 none
- blacktools:tell $nick $host $hand $chan $chan1 userlist.7 $user
- }
- }
- admin {
- set flags "-|A"
- set numar [llength [userlist $flags $chan]]
- set list [userlist $flags $chan]
- foreach user [wordwrap [join $list " , "] 250 ,] {
- if {$list == ""} { set user "NONE" }
- blacktools:tell $nick $host $hand $chan $chan1 userlist.8 $numar
- blacktools:tell $nick $host $hand $chan $chan1 userlist.9 none
- blacktools:tell $nick $host $hand $chan $chan1 userlist.7 $user
- }
- }
- senior {
- set flags "-|S"
- set list [userlist $flags $chan]
- set numar [llength [userlist $flags $chan]]
- foreach user [wordwrap [join $list " , "] 250 ,] {
- if {$list == ""} { set user "NONE" }
- blacktools:tell $nick $host $hand $chan $chan1 userlist.10 $numar
- blacktools:tell $nick $host $hand $chan $chan1 userlist.11 none
- blacktools:tell $nick $host $hand $chan $chan1 userlist.7 $user
- }
- }
- protect {
- set flags "-|H"
- set list [userlist $flags $chan]
- set numar [llength [userlist $flags $chan]]
- foreach user [wordwrap [join $list " , "] 250 ,] {
- if {$list == ""} { set user "NONE" }
- blacktools:tell $nick $host $hand $chan $chan1 userlist.12 $numar
- blacktools:tell $nick $host $hand $chan $chan1 userlist.13 none
- blacktools:tell $nick $host $hand $chan $chan1 userlist.7 $user
- }
- }
- op {
- set flags "-|O"
- set list [userlist $flags $chan]
- set numar [llength [userlist $flags $chan]]
- foreach user [wordwrap [join $list " , "] 250 ,] {
- if {$list == ""} { set user "NONE" }
- blacktools:tell $nick $host $hand $chan $chan1 userlist.14 $numar
- blacktools:tell $nick $host $hand $chan $chan1 userlist.15 none
- blacktools:tell $nick $host $hand $chan $chan1 userlist.7 $user
- }
- }
- owner {
- if {[matchattr $hand nm|- $chan]} {
- set bossflags "n|-"
- set ownerflags "m|-"
- set listbossowner [userlist $bossflags]
- set listowner [userlist $ownerflags]
- blacktools:tell $nick $host $hand $chan $chan1 userlist.16 $listbossowner
- blacktools:tell $nick $host $hand $chan $chan1 userlist.17 $listowner
- }
- }
- voice {
- set flags "-|V"
- set numar [llength [userlist $flags $chan]]
- set list [userlist $flags $chan]
- foreach user [wordwrap [join $list " , "] 250 ,] {
- if {$list == ""} { set user "NONE" }
- blacktools:tell $nick $host $hand $chan $chan1 userlist.18 $numar
- blacktools:tell $nick $host $hand $chan $chan1 userlist.19 none
- blacktools:tell $nick $host $hand $chan $chan1 userlist.7 $user
- }
- }
- all {
- array set flgc [list]
- set flags "-|MNASVO"
- set list [userlist $flags $chan]
- set numar [llength [userlist $flags $chan]]
- foreach user $list {
- if {[matchattr $user -|V $chan]} {
- lappend flgc(VOICE) $user
- } elseif {[matchattr $user -|O $chan]} {
-
- lappend flgc(OP) $user
- } elseif {[matchattr $user -|S $chan]} {
- lappend flgc(SENIOR) $user
- } elseif {[matchattr $user -|A $chan]} {
-
- lappend flgc(ADMINISTRATOR) $user
- } elseif {[matchattr $user -|M $chan]} {
-
- lappend flgc(MANAGER) $user
-
- }
- }
- foreach flw [array names flgc] {
- lappend messall [join 4$flgc($flw) " , "] -> 12($flw)
- }
- if {$list == ""} { set messall "NONE" }
- blacktools:tell $nick $host $hand $chan $chan1 userlist.20 $numar
- blacktools:tell $nick $host $hand $chan $chan1 userlist.21 none
- foreach mes [wordwrap [join $messall] 250] {
- blacktools:tell $nick $host $hand $chan $chan1 userlist.7 $mes
- }
- }
- }
- }
- }
- proc wordwrap {str {len 100} {splitChr { }}} {
- set out [set cur {}]; set i 0
- foreach word [split [set str][unset str] $splitChr] {
- if {[incr i [string len $word]]>$len} {
- lappend out [join $cur $splitChr]
- set cur [list $word]
- set i [string len $word]
- } {
- lappend cur $word
- }
- incr i
- }
- lappend out [join $cur $splitChr]
- }
- proc publicuserlist {nick host hand chan arg} {
- global black
- set level [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[#&]} $level] && [matchattr $hand nm|- $chan]} {
- set chan "$level"
- set level [lindex [split $arg] 1]
- }
- userlist:execute $hand $host $level $chan $chan1 $nick $type
- }
- ############################### channels ########################
- proc channelspublic {nick host hand chan arg} {
- global botnick black
- set chan1 "$chan"
- channels:process $nick $host $hand $chan $chan1
- }
- proc channels:process {nick host hand chan chan1} {
- global botnick black
- set num [llength [channels]]
- set minusers "5"
- array set status [list]
- set notonchan "(NoT on ChaN)"
- set notenough "(users < $minusers)"
- set suspended "(SUSPENDED)"
- foreach c [channels] {
- set usersnumber [llength [chanlist $c]]
- if {[channel get $c inactive]} {
- lappend status($c) "4$c $suspended"
- } elseif {![onchan $botnick $c]} {
- lappend status($c) "4$c $notonchan"
- } elseif {[onchan $botnick $c] && (![botisop $c])} {
- lappend status($c) "4$c"
- } elseif {[onchan $botnick $c] && ($usersnumber < $minusers)} {
- lappend status($c) "4$c $notenough"
- }
- if {![info exists status($c)]} {
- lappend status($c) "1@$c"
- }
- lappend message "[join $status($c) ", "]"
- }
- blacktools:tell $nick $host $hand $chan $chan1 channels.1 $num
- foreach word [wordwrap [join $message] 350 ,] {
- blacktools:tell $nick $host $hand $chan $chan1 channels.2 $word
- }
- }
- ############################### info ############################
- proc infopublic {nick host hand chan arg} {
- global black
- set user [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
- set chan "$user"
- set user [lindex [split $arg] 1]
- }
- info:process $nick $host $hand $chan $chan1 $user $type
- }
- proc info:process {nick host hand chan chan1 user type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set time [ctime [unixtime]]
- array set flg [list]
- if {[matchattr $hand nm|- $chan]} {
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 info.1 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 info.2 none
- return 0
- }
- }
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 info.3 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 info.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[validuser $user]} {
- } else { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- foreach c [channels] {
- if {[matchattr $user -|V $c]} {
- set fl "VOICE"
- lappend flg($fl) $c
- } elseif {[matchattr $user -|O $c]} {
- set fl "OP"
- lappend flg($fl) $c
- } elseif {[matchattr $user -|S $c]} {
- set fl "SENIOR"
- lappend flg($fl) $c
- } elseif {[matchattr $user -|A $c]} {
- set fl "ADMINISTRATOR"
- lappend flg($fl) $c
- } elseif {[matchattr $user -|M $c]} {
- set fl "MANAGER"
- lappend flg($fl) $c
- }
- }
- foreach cf [array names flg] {
- lappend exit 1[join $flg($cf) ,] 12($cf) |
- }
- }
- if {![matchattr $user nm|OAHSMNV $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none
- if {![info exists exit]} { set exit "1NONE"}
- if {[matchattr $hand nm|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 info.5 "[join $exit]"
- if {[getuser $user HOSTS] != ""} {
- set hosts [getuser $user hosts]
- blacktools:tell $nick $host $hand $chan $chan1 info.6 $hosts
- }
- set lastseen [getuser $user LASTON $chan]
- if {($lastseen == "0") || ($lastseen == "")} {
- set seened "1NONE"
- } else { set seened [ctime $lastseen] }
- blacktools:tell $nick $host $hand $chan $chan1 info.7 $seened
- }
- return 0
- }
- set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set suspendat "$black(say.$getlang.info.10)"
- set cflags [chattr $user | $chan]
- blacktools:tell $nick $host $hand $chan $chan1 info.8 $user
- blacktools:tell $nick $host $hand $chan $chan1 info.9 $time
- 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"}
- 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 !"
- return 0
- }
- if {[matchattr $user -|q $chan]} {
- 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)"}
- if {[matchattr $user -|M $chan]} { set flags "MANAGER ($suspendat)" } elseif {[matchattr $user m|- $chan]} { set flags "OWNER ($suspendat)" } elseif {$cflags == "-|-"} {puthelp "NOTICE $nick :$user
- S pe acest canal !"
- return 0
- }
- }
- blacktools:tell $nick $host $hand $chan $chan1 info.11 "$cflags $flags"
- if {[getuser $user INFO] != ""} {
- blacktools:tell $nick $host $hand $chan $chan1 info.12 "[getuser $user INFO]"
- }
-
- set date [getuser $user XTRA LASTMODIFDATE]
- if {[matchattr $user n|- $chan]} { set date "No Date" }
- if {$date == ""} { set date "No Date" }
- set lastt [getuser $user XTRA LASTMODIFBY]
- if {$lastt == ""} { set lastt "No info" }
- if {[matchattr $user n|- $chan]} { set lastt "NONE" }
- blacktools:tell $nick $host $hand $chan $chan1 info.13 "$lastt $date"
- if {[getuser $user HOSTS] != ""} {
- set hosts [getuser $user hosts]
- blacktools:tell $nick $host $hand $chan $chan1 info.6 $hosts
- }
- if {![info exists exit]} { set exit "NONE"}
- if {![matchattr $user nm|- $chan] && [matchattr $hand nm|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 info.5 "[join $exit]"
- }
- set lastseen [getuser $user LASTON $chan]
- if {($lastseen == "0") || ($lastseen == "")} {
- blacktools:tell $nick $host $hand $chan $chan1 info.14 none
- blacktools:tell $nick $host $hand $chan $chan1 info.15 $user
- blacktools:tell $nick $host $hand $chan $chan1 info.16 none
- return 0
- }
- set seened [ctime $lastseen]
- blacktools:tell $nick $host $hand $chan $chan1 info.17 $seened
- blacktools:tell $nick $host $hand $chan $chan1 info.15 $user
- blacktools:tell $nick $host $hand $chan $chan1 info.16 none
- }
- ################################# s ###############################
- proc spublic {nick host hand chan arg} {
- global black
- set type 0
- set chan1 "$chan"
- set users [lindex [split $arg] 0]
- if {[regexp {^[#&]} $users] && [matchattr $hand nm|- $chan]} {
- set chan "$users"
- set users [lindex [split $arg] 1]
- }
- s:process $nick $host $hand $chan $chan1 $users $type
- }
- proc s:process {nick host hand chan chan1 users type} {
- global botnick black
- set flags "-|q"
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set time [ctime [unixtime]]
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($users == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 s.1 none
- return 0
- }
- if {($users == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 s.2 none
- return 0
- }
- }
- if {($users == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 s.3 none
- return 0
- }
- if {($users == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 s.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {[matchattr $users -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 s.5 $users
- return 0
- }
- if {![validuser $users]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
- return 0
- }
- if {![matchattr $users nm|OASMNV $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none
- return 0
- }
-
- if {[matchattr $users -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $users -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $users m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $users m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $users -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $users n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $users n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $users n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $users n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- chattr $users $flags $chan
- setuser $users XTRA LASTMODIFBY $hand
- setuser $users XTRA LASTMODIFDATE $time
- blacktools:tell $nick $host $hand $chan $chan1 s.6 $users
- }
- ################################## us ################################
- proc uspublic {nick host hand chan arg} {
- global black
- set type 0
- set chan1 "$chan"
- set users [lindex [split $arg] 0]
- if {[regexp {^[\\+!#&]} $users] && [matchattr $hand nm|- $chan]} {
- set chan "$users"
- set users [lindex [split $arg] 1]
- }
- us:process $nick $host $hand $chan $chan1 $users $type
- }
- proc us:process {nick host hand chan chan1 users type} {
- global botnick black
- set flags "-|-q"
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set time [ctime [unixtime]]
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($users == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 us.1 none
- return 0
- }
- if {($users == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 us.2 none
- return 0
- }
- }
- if {($users == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 us.3 none
- return 0
- }
- if {($users == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 us.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {![validuser $users]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
- return 0
- }
- if {![matchattr $users nm|OASMNV $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none
- return 0
- }
- if {![matchattr $users -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 us.5 $users
- return 0
- }
- if {[matchattr $users -|M $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $users -|M $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $users m|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $users m|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $users -|A $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $users n|- $chan] && [matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $users n|- $chan] && [matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $users n|- $chan] && [matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- if {[matchattr $users n|- $chan] && [matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.nomodif none
- return 0
- }
- setuser $users XTRA LASTMODIFBY $hand
- setuser $users XTRA LASTMODIFDATE $time
- chattr $users $flags $chan
- blacktools:tell $nick $host $hand $chan $chan1 us.6 $users
- }
- ############################## ping ##################################
- proc pings {nick host hand chan arg} {
- putquick "PRIVMSG $nick :\001PING [expr {abs([clock clicks -milliseconds])}]\001"
- return 0
- }
- proc pingpublic {nick host hand dest key arg} {
- global botnick black
- set ping [split $arg "."]
- set pingreply [lindex $ping 0]
- if {[regexp -- {^-?[0-9]+$} $pingreply]} {
- set second "[expr {abs([expr [expr {abs([clock clicks -milliseconds])} - $pingreply] / 1000.000])}]"
- blacktools:tell:prv $nick $host $hand ping.1 $second
- }
- }
- ############################### time ##################################
- proc timepublic {nick host hand chan arg} {
- global black
- set chan1 "$chan"
- set time [ctime [unixtime]]
- blacktools:tell $nick $host $hand $chan $chan1 time.1 $time
- }
- ################################### vers ###############################
- proc verspublic {nick host hand chan arg} {
- global black
- set why [lindex [split $arg] 0]
- set chan1 "$chan"
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {$why == ""} { blacktools:tell $nick $host $hand $chan $chan1 vers.1 none
- return 0
- }
- vers:process $nick $host $hand $chan $chan1 $why
- }
- proc vers:process {nick host hand chan chan1 why} {
- global botnick black
- set ::verschan $chan
- set ::versnick $nick
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {![onchan $why $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan $why
- return 0
- }
- putserv "PRIVMSG $why :\001VERSION\001"
- }
- proc ctcpvers {nickname hostname handle dest key arg} {
- set text [split $arg]
- set chan $::verschan
- set nick $::versnick
- blacktools:tell:prv $nick $hostname $handle vers.3 "$nickname $text"
- }
- ################################### whois ###############################
- proc whoispublic {nick host hand chan arg} {
- global black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set chan1 "$chan"
- set who [lindex [split $arg] 0]
- if {$who == ""} { blacktools:tell $nick $host $hand $chan $chan1 whois.1 none
- return 0
- }
- whois:process $nick $host $hand $chan $chan1 $who
- }
- proc whois:process {nick host hand chan chan1 who} {
- global botnick black
- set ::wnick $nick
- set ::hand $hand
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- putquick "WHOIS $who $who"
- bind RAW - 311 winfo
- bind RAW - 319 wchannels
- bind RAW - 401 nonicks
- }
- proc winfo { from keyword arguments } {
- global black
- set hand $::hand
- set nick $::wnick
- set nickname [lindex [split $arguments] 1]
- set ident [lindex [split $arguments] 2]
- set host [lindex [split $arguments] 3]
- set realname [string range [join [lrange $arguments 5 end]] 1 end]
- blacktools:tell:prv $nick hostname $hand whois.3 "$nickname 4host - 12*!*$ident@$host * $realname"
- unbind RAW - 311 winfo
- }
- proc wchannels { from keyword arguments } {
- global black
- set hand $::hand
- set nick $::wnick
- set channels [string range [join [lrange $arguments 2 end]] 1 end]
- blacktools:tell:prv $nick hostname $hand whois.4 $channels
- unbind RAW - 319 wchannels
- }
- proc nonicks { from keyword arguments } {
- global black
- set hand $::hand
- set nick $::wnick
- blacktools:tell:prv $nick hostname $hand whois.5 none
- unbind RAW - 401 nonicks
- }
- ################################### clear ###############################
- proc clearpublic {nick host hand chan arg} {
- global black
- set why [lindex [split $arg] 0]
- set chan1 "$chan"
- set type 0
- if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
- set chan "$why"
- set why [lindex [split $arg] 1]
- }
- clear:process $nick $host $hand $chan $chan1 $why $type
- }
- proc clear:process {nick host hand chan chan1 why type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($why == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 clear.1 none
- return 0
- }
- if {($why == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 clear.2 none
- return 0
- }
- }
- if {($why == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 clear.3 none
- return 0
- }
- if {($why == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 clear.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {([regexp -nocase -- {(#[0-9]+|banlist|userlist)} $why tmp cleanlist]) && (![regexp -nocase -- {\S#} $why])} {
- switch $cleanlist {
- userlist {
- set list [userlist -|AOSV $chan]
- foreach user $list {
- chattr $user -|-AOVS $chan
- }
- blacktools:tell $nick $host $hand $chan $chan1 clear.5 none
- }
- banlist {
- set i 0
- foreach ban [banlist $chan] {
- set theban [lindex $ban 0]
- if {[string match "*" $theban]} {
- set i [expr $i +1]
- killchanban $chan $theban
- }
- }
- blacktools:tell $nick $host $hand $chan $chan1 clear.6 $i
- }
- }
- }
- }
- ################################# addbot ################################
- proc addbotpublic {nick host hand chan arg} {
- global black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set chan1 "$chan"
- set why [lindex [split $arg] 0]
- set host [lindex [split $arg] 1]
- if {$why == ""} { blacktools:tell $nick $host $hand $chan $chan1 addbot.1 none
- return 0
- }
- addbot:process $nick $host $hand $chan $chan1 $why $host
- }
- proc addbot:process {nick host hand chan chan1 why host} {
- global botnick black
- set flags "ao|ao"
- if {[validuser $why]} {
- blacktools:tell $nick $host $hand $chan $chan1 addbot.3 $why
- return 0
- }
- addbot $why $host
- chattr $why $flags $chan
- blacktools:tell $nick $host $hand $chan $chan1 addbot.4 "$why $host"
- }
- proc autovonjoin {nick host hand chan} {
- if {[channel get $chan autovoice]} {
- pushmode $chan +v $nick
- }
- }
- proc autoponjoin {nick host hand chan} {
- if {[channel get $chan autoop]} {
- pushmode $chan +o $nick
- }
- }
- ############################# addop #################################
- proc addoppublic {nick host hand chan arg} {
- global black
- set user [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
- set chan "$user"
- set user [lindex [split $arg] 1]
- }
- addop:process $nick $host $hand $chan $chan1 $user $type
- }
- proc addop:process {nick host hand chan chan1 user type} {
- global black botnick
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set flag "-|a"
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 addop.1 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 addop.2 none
- return 0
- }
- }
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 addop.3 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 addop.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {![validuser $user]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
- return 0
- }
- if {[matchattr $user -|a $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 addop.5 $user
- return 0
- }
- chattr $user $flag $chan
- blacktools:tell $nick $host $hand $chan $chan1 addop.6 $user
- }
- proc addopjoin {nick host hand chan} {
- if {[matchattr $hand -|a $chan]} {
- pushmode $chan +o $nick
- }
- }
- ########################### addvoice ################################
- proc addvoicepublic {nick host hand chan arg} {
- global black
- set user [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
- set chan "$user"
- set user [lindex [split $arg] 1]
- }
- addvoice:process $nick $host $hand $chan $chan1 $user $type
- }
- proc addvoice:process {nick host hand chan chan1 user type} {
- global black botnick
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set flag "-|g"
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 addvoice.1 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 addvoice.2 none
- return 0
- }
- }
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 addvoice.3 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 addvoice.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {![validuser $user]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
- return 0
- }
- if {[matchattr $user -|g $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 addvoice.5 $user
- return 0
- }
- chattr $user $flag $chan
- blacktools:tell $nick $host $hand $chan $chan1 addvoice.6 $user
- }
- proc addvoicejoin {nick host hand chan} {
- if {[matchattr $hand -|g $chan]} {
- pushmode $chan +v $nick
- }
- }
- ########################### delop ##################################
- proc deloppublic {nick host hand chan arg} {
- global black botnick
- set user [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
- set chan "$user"
- set user [lindex [split $arg] 1]
- }
- delop:process $nick $host $hand $chan $chan1 $user $type
- }
- proc delop:process {nick host hand chan chan1 user type} {
- global black botnick
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set flag "-|-a"
- if {[matchattr $hand -|q $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 delop.1 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 delop.2 none
- return 0
- }
- }
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 delop.3 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 delop.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {![validuser $user]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
- return 0
- }
- if {[matchattr $user -|a $chan]} {
- set noautoop 1
- }
- if {![info exists noautoop]} {
- blacktools:tell $nick $host $hand $chan $chan1 delop.5 $user
- return 0
- }
- chattr $user $flag $chan
- blacktools:tell $nick $host $hand $chan $chan1 delop.6 $user
- }
- ############################ delvoice ###############################
- proc delvoicepublic {nick host hand chan arg} {
- global black
- set user [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
- set chan "$user"
- set user [lindex [split $arg] 1]
- }
- delvoice:process $nick $host $hand $chan $chan1 $user $type
- }
- proc delvoice:process {nick host hand chan chan1 user type} {
- global black botnick
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set flag "-|-g"
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 delvoice.1 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 delvoice.2 none
- return 0
- }
- }
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 delvoice.3 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 delvoice.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {![validuser $user]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
- return 0
- }
- if {[matchattr $user -|g $chan]} {
- set noautovoice 1
- }
- if {![info exists noautovoice]} {
- blacktools:tell $nick $host $hand $chan $chan1 delvoice.5 $user
- return 0
- }
- chattr $user $flag $chan
- blacktools:tell $nick $host $hand $chan $chan1 delvoice.6 $user
- }
- ############################## activ ##################################
- proc activpublic {nick host hand chan arg} {
- global black
- set type 0
- set chan1 "$chan"
- set user [lindex [split $arg] 0]
- if {[regexp {^[#&]} $user] && [matchattr $hand nm|- $chan]} {
- set chan "$user"
- set user [lindex [split $arg] 1]
- }
- activ:process $nick $host $hand $chan $chan1 $user $type
- }
- proc activ:process {nick host hand chan chan1 user type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 activ.1 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 activ.2 none
- return 0
- }
- }
- if {($user == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 activ.3 none
- return 0
- }
- if {($user == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 activ.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {![validuser $user]} { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none
- return 0
- }
- if {![matchattr $user mn|OAVMS $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.noaccess none
- return 0
- }
- set dr [getuser $user XTRA DR($chan)]
- set ban [getuser $user XTRA b($chan)]
- set spam [getuser $user XTRA spam($chan)]
- set badnick [getuser $user XTRA n($chan)]
- set invite [getuser $user XTRA i($chan)]
- set blacks [getuser $user XTRA Black($chan)]
- set warn [getuser $user XTRA w($chan)]
- set day [getuser $user XTRA d($chan)]
- set kick [getuser $user XTRA k($chan)]
- set stick [getuser $user XTRA stick($chan)]
- set bw [getuser $user XTRA bw($chan)]
- set bot [getuser $user XTRA bot($chan)]
- if {$ban == ""} { set ban "0" }
- if {$dr == ""} { set dr "0" }
- if {$spam == ""} { set spam "0" }
- if {$badnick == ""} { set badnick "0" }
- if {$invite == ""} { set invite "0" }
- if {$blacks == ""} { set blacks "0" }
- if {$warn == ""} { set warn "0" }
- if {$day == ""} { set day "0" }
- if {$kick == ""} { set kick "0" }
- if {$stick == ""} { set stick "0" }
- if {$bw == ""} { set bw "0" }
- if {$bot == ""} { set bot "0" }
- if {[matchattr $user mn|AMS $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 activ.5 $user
- 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) ."
- blacktools:tell $nick $host $hand $chan $chan1 activ.7 none
- return 0
- }
- if {[matchattr $user -|O $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 activ.8 $user
- 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) ."
- blacktools:tell $nick $host $hand $chan $chan1 activ.7 none
- return 0
- }
- if {[matchattr $user -|V $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 activ.9 $user
- blacktools:tell $nick $host $hand $chan $chan1 activ.6 "12- $char(p)w - 4($warn) | 12- $char(p)k - 4($kick)"
- blacktools:tell $nick $host $hand $chan $chan1 activ.7 none
- return 0
- }
- }
- proc addmyhostpublic {nick host hand chan arg} {
- global black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set chan1 "$chan"
- set why [lindex [split $arg] 0]
- if {$why == ""} { blacktools:tell $nick $host $hand $chan $chan1 addmyhost.1 none
- return 0
- }
- addmyhost:process $nick $host $hand $chan $chan1 $why
- }
- proc addmyhost:process {nick host hand chan chan1 why} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set hhost [getuser $hand hosts]
- foreach hhost $hhost {
- if {[string match -nocase $hhost $why]} {
- set foundhost 1
- }
- }
- if {[info exists foundhost]} {
- blacktools:tell $nick $host $hand $chan $chan1 addmyhost.3 $why
- return 0
- }
- setuser $hand HOSTS $why
- blacktools:tell $nick $host $hand $chan $chan1 addmyhost.4 $why
- }
- ############################## delmyhost ##########################
- proc delmyhostpublic {nick host hand chan arg} {
- global black
- set chan1 "$chan"
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set why [lindex [split $arg] 0]
- if {$why == ""} { blacktools:tell $nick $host $hand $chan $chan1 delmyhost.1 none
- return 0
- }
- delmyhost:process $nick $host $hand $chan $chan1 $why
- }
- proc delmyhost:process {nick host hand chan chan1 why} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set hhost [getuser $hand hosts]
- foreach hhost $hhost {
- if {[string match -nocase $hhost $why]} {
- set foundhost 1
- }
- }
- if {![info exists foundhost]} {
- blacktools:tell $nick $host $hand $chan $chan1 delmyhost.3 $why
- return 0
- }
- delhost $hand $why
- blacktools:tell $nick $host $hand $chan $chan1 delmyhost.4 $why
- }
- ######################## cc (channel created) #######################
- proc createdpublic { from keyword arguments } {
- set hand $::hand
- set nick $::ccnick
- set date [lindex [split $arguments] 2]
- set dates [ctime $date]
- blacktools:tell:prv $nick host $hand cc.3 $dates
- unbind RAW - 329 createdpublic
- }
- proc nocreatedpublic { from keyword arguments } {
- set hand $::hand
- set nick $::ccnick
- blacktools:tell:prv $nick host $hand cc.4 none
- unbind RAW - 403 nocreatedpublic
- }
- proc ccpublic {nick host hand chan arg} {
- global black
- set ::ccnick $nick
- set ::hand $hand
- set chan1 "$chan"
- set c [lindex [split $arg] 0]
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {$c == ""} { blacktools:tell $nick $host $hand $chan $chan1 cc.1 none
- return 0
- }
- if {![regexp {^[\\+!#&]} $c]} {
- set c #$c
- }
- putquick "MODE $c"
- bind raw - 329 createdpublic
- bind raw - 403 nocreatedpublic
- }
- proc statspublic {nick host hand chan arg} {
- global botnick black
- set c [lindex [split $arg] 0]
- set chan1 "$chan"
- if {[regexp {^[#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- }
- stats:process $nick $host $hand $chan $chan1
- }
- proc stats:process {nick host hand chan chan1} {
- global botnick black statsdir
- set ops 0
- set numban 0
- set voices 0
- set numuser 0
- set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- set time [unixtime]
- set file [open $statsdir "r"]
- set database [read -nonewline $file]
- set data [split $database "\n"]
- foreach line $data {
- set c [lindex [split $line] 0]
- set type [lindex [split $line] 1]
- if {[string match "ADDED" "$type"] && [string match -nocase $c $chan]} {
- set foundchan 1
- set chanadded 1
- set awho [lindex [split $line] 2]
- set ahost [lindex [split $line] 3]
- set a1time [lindex [split $line] 4]
- if {[regexp {^[0-9]} $a1time]} {
- set duration [duration [expr [unixtime] - $a1time]]
- } else { set duration "NONE" }
- if {[regexp {^[0-9]} $a1time]} {
- set atime [clock format $a1time -format %D-%H:%M:%S]
- } else { set atime "NONE"}
- set replace(%ahost%) $ahost
- set replace(%atime%) $atime
- set replace(%duration%) $duration
- set replace(%awho%) $awho
- lappend mes "[string map [array get replace] $black(say.$getlang.stats.1)]"
- lappend mes1 "[string map [array get replace] $black(say.$getlang.stats.2)]"
- }
- if {[string match "REMOVED" "$type"] && [string match -nocase $c $chan]} {
- set foundchan 1
- set chanremoved 1
- set rwho [lindex [split $line] 2]
- set rhost [lindex [split $line] 3]
- set rtime [lindex [split $line] 4]
- set a1time [lindex [split $line] 5]
- if {[regexp {^[0-9]} $a1time]} {
- set duration [duration [expr [unixtime] - $a1time]]
- } else { set duration "NONE" }
- if {[regexp {^[0-9]} $a1time]} {
- set atime [clock format $a1time -format %D-%H:%M:%S]
- } else { set atime "NONE"}
- if {[regexp {^[0-9]} $rtime]} {
- set rtime [clock format $rtime -format %D-%H:%M:%S]
- } else { set rtime "NONE" }
- set awho [lindex [split $line] 6]
- set ahost [lindex [split $line] 7]
- set replace(%ahost%) $ahost
- set replace(%atime%) $atime
- set replace(%rtime%) $rtime
- set replace(%duration%) $duration
- set replace(%awho%) $awho
- set replace(%rwho%) $rwho
- set replace(%rhost%) $ahost
- lappend mes "[string map [array get replace] $black(say.$getlang.stats.1)]"
- lappend mes1 "[string map [array get replace] $black(say.$getlang.stats.3)]"
- lappend mes2 "[string map [array get replace] $black(say.$getlang.stats.4)]"
- }
- }
- if {![info exists foundchan]} {
- blacktools:tell $nick $host $hand $chan $chan1 stats.5 none
- return 0
- }
- if {[validchan $chan] && ([onchan $botnick $chan])} {
- set numban [llength [banlist $chan]]
- set numuser [llength [chanlist $chan]]
- foreach user [chanlist $chan] {
- if {[isop $user $chan] && (![isvoice $user $chan])} {
- set ops [expr $ops +1]
- }
- if {[isvoice $user $chan]} {
- set voices [expr $voices +1]
- }
- }
- }
- if {[info exists chanadded]} {
- blacktools:tell $nick $host $hand $chan $chan1 stats.6 none
- blacktools:tell $nick $host $hand $chan $chan1 stats.7 "[join $mes]"
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 stats.9 none
- } else {
- blacktools:tell $nick $host $hand $chan $chan1 stats.8 none
- }
- blacktools:tell $nick $host $hand $chan $chan1 stats.7 "[join $mes1]"
- blacktools:tell $nick $host $hand $chan $chan1 stats.10 "$numuser $ops $voices $numban"
- blacktools:tell $nick $host $hand $chan $chan1 stats.11 none
- }
- if {[info exists chanremoved]} {
- blacktools:tell $nick $host $hand $chan $chan1 stats.6 none
- blacktools:tell $nick $host $hand $chan $chan1 stats.7 "[join $mes]"
- blacktools:tell $nick $host $hand $chan $chan1 stats.12 none
- blacktools:tell $nick $host $hand $chan $chan1 stats.7 "[join $mes1]"
- blacktools:tell $nick $host $hand $chan $chan1 stats.7 "[join $mes2]"
- blacktools:tell $nick $host $hand $chan $chan1 stats.11 none
- }
- }
- ####################### TopWords ####################################
- proc topwordspublic {nick host hand chan arg} {
- global black who username
- set arg [split $arg]
- if {![validchan $chan]} {
- return 0
- }
- if {[channel get $chan topwords]} {
- set lin 0
- set wordsdir "logs/$username.$chan.words.db"
- if {![file exists $wordsdir]} {
- set file [open $wordsdir w]
- close $file
- }
- set host "*!*@[lindex [split $host @] 1]"
- set len($host) [llength $arg]
- set words($host:$chan) $len($host)
- if {[isbotnick $nick]} { return 0 }
- set who "$chan $nick $host $words($host:$chan)"
- set file [open $wordsdir "r"]
- set database [read -nonewline $file]
- close $file
- set data [split $database "\n"]
- foreach line $data {
- set lin [expr $lin +1]
- set hhost [lindex [split $line] 2]
- set hscore [lindex [split $line] 3]
- set chanentry [lindex [split $line] 0]
- if {[string match -nocase $hhost $host] && [string match -nocase $chanentry $chan]} {
- lappend current($hhost:$chan) $hscore
- set who "$chan $nick $hhost [expr $words($host:$chan) + $current($hhost:$chan)]"
- if {$line != ""} {
- set num [expr $lin - 1]
- set delete [lreplace $data $num $num]
- set files [open $wordsdir "w"]
- puts $files [join $delete "\n"]
- close $files
- }
- }
- }
- set file [open $wordsdir "r"]
- set data [read -nonewline $file]
- close $file
- if {$data == ""} {
- set files [open $wordsdir "w"]
- close $files
- }
- set file [open $wordsdir "a"]
- puts $file "$who"
- close $file
- }
- }
- ################################## TOP ################################
- proc toppublic {nick host hand chan arg} {
- global black
- set cmd [lindex [split $arg] 0]
- set del [lindex [split $arg] 1]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[#&]} $cmd] && [matchattr $hand nm|- $chan]} {
- set chan1 "$chan"
- set chan "$cmd"
- set cmd [lindex [split $arg] 1]
- set del [lindex [split $arg] 2]
- }
- top:process $nick $host $hand $chan $chan1 $cmd $type $del
- }
- proc top:process {nick host hand chan chan1 cmd type del} {
- global botnick black username
- set max "20"
- set i 0
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set list [userlist nm|OSVAM $chan]
- set wordsdir "logs/$username.$chan.words.db"
- if {![file exists $wordsdir]} {
- set file [open $wordsdir w]
- close $file
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($cmd == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 top.1 none
- blacktools:tell $nick $host $hand $chan $chan1 top.2 none
- return 0
- }
- if {($cmd == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 top.3 none
- blacktools:tell $nick $host $hand $chan $chan1 top.4 none
- return 0
- }
- }
- if {($cmd == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 top.5 none
- blacktools:tell $nick $host $hand $chan $chan1 top.6 none
- return 0
- }
- if {($cmd == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 top.7 none
- blacktools:tell $nick $host $hand $chan $chan1 top.8 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
-
- switch -exact -- [string tolower $cmd] {
- dr {
- array set blacks [list]
- set list [userlist nm|OSVAM $chan]
- foreach user $list {
- set b [getuser $user XTRA DR($chan)]
- if {$b == ""} { set b 0 }
- if {$b > 0} {
- lappend blacks($b) $user
- }
- }
- foreach blackq [lsort -integer -decreasing [array names blacks]] {
- set i [expr $i +1]
- lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
- }
- if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
- return 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 top.10 none
- foreach txt [wordwrap [join $topblack " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
- }
- }
- b {
-
- array set blacks [list]
- set list [userlist nm|OSVAM $chan]
- foreach user $list {
- set b [getuser $user XTRA b($chan)]
- if {$b == ""} { set b 0 }
- if {$b > 0} {
- lappend blacks($b) $user
- }
- }
- foreach blackq [lsort -integer -decreasing [array names blacks]] {
- set i [expr $i +1]
- lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
- }
- if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
- return 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 top.12 none
- foreach txt [wordwrap [join $topblack " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
- }
- }
- bot {
-
- array set blacks [list]
- set list [userlist nm|OSVAM $chan]
- foreach user $list {
- set b [getuser $user XTRA bot($chan)]
- if {$b == ""} { set b 0 }
- if {$b > 0} {
- lappend blacks($b) $user
- }
- }
- foreach blackq [lsort -integer -decreasing [array names blacks]] {
- set i [expr $i +1]
- lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
- }
- if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
- return 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 top.13 none
- foreach txt [wordwrap [join $topblack " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
- }
- }
- bw {
-
- array set blacks [list]
- set list [userlist nm|OSVAM $chan]
- foreach user $list {
- set b [getuser $user XTRA bw($chan)]
- if {$b == ""} { set b 0 }
- if {$b > 0} {
- lappend blacks($b) $user
- }
- }
- foreach blackq [lsort -integer -decreasing [array names blacks]] {
- set i [expr $i +1]
- lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
- }
- if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
- return 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 top.14 none
- foreach txt [wordwrap [join $topblack " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
- }
- }
- black {
- array set blacks [list]
- set list [userlist nm|OSVAM $chan]
- foreach user $list {
- set b [getuser $user XTRA Black($chan)]
- if {$b == ""} { set b 0 }
- if {$b > 0} {
- lappend blacks($b) $user
- }
- }
- foreach blackq [lsort -integer -decreasing [array names blacks]] {
- set i [expr $i +1]
- lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
- }
- if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
- return 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 top.15 none
- foreach txt [wordwrap [join $topblack " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
- }
- }
- spam {
-
- array set blacks [list]
- set list [userlist nm|OSVAM $chan]
- foreach user $list {
- set b [getuser $user XTRA spam($chan)]
- if {$b == ""} { set b 0 }
- if {$b > 0} {
- lappend blacks($b) $user
- }
- }
- foreach blackq [lsort -integer -decreasing [array names blacks]] {
- set i [expr $i +1]
- lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
- }
- if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
- return 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 top.16 none
- foreach txt [wordwrap [join $topblack " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
- }
- }
- stick {
-
- array set blacks [list]
- set list [userlist nm|OSVAM $chan]
- foreach user $list {
- set b [getuser $user XTRA stick($chan)]
- if {$b == ""} { set b 0 }
- if {$b > 0} {
- lappend blacks($b) $user
- }
- }
- foreach blackq [lsort -integer -decreasing [array names blacks]] {
- set i [expr $i +1]
- lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
- }
- if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
- return 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 top.17 none
- foreach txt [wordwrap [join $topblack " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
- }
- }
- n {
-
- array set blacks [list]
- set list [userlist nm|OSVAM $chan]
- foreach user $list {
- set b [getuser $user XTRA n($chan)]
- if {$b == ""} { set b 0 }
- if {$b > 0} {
- lappend blacks($b) $user
- }
- }
- foreach blackq [lsort -integer -decreasing [array names blacks]] {
- set i [expr $i +1]
- lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
- }
- if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
- return 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 top.18 none
- foreach txt [wordwrap [join $topblack " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
- }
- }
- i {
-
- array set blacks [list]
- set list [userlist nm|OSVAM $chan]
- foreach user $list {
- set b [getuser $user XTRA i($chan)]
- if {$b == ""} { set b 0 }
- if {$b > 0} {
- lappend blacks($b) $user
- }
- }
- foreach blackq [lsort -integer -decreasing [array names blacks]] {
- set i [expr $i +1]
- lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
- }
- if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
- return 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 top.19 none
- foreach txt [wordwrap [join $topblack " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
- }
- }
- k {
-
- array set blacks [list]
- set list [userlist nm|OSVAM $chan]
- foreach user $list {
- set b [getuser $user XTRA k($chan)]
- if {$b == ""} { set b 0 }
- if {$b > 0} {
- lappend blacks($b) $user
- }
- }
- foreach blackq [lsort -integer -decreasing [array names blacks]] {
- set i [expr $i +1]
- lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
- }
- if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
- return 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 top.20 none
- foreach txt [wordwrap [join $topblack " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
- }
- }
- w {
-
- array set blacks [list]
- set list [userlist nm|OSVAM $chan]
- foreach user $list {
- set b [getuser $user XTRA w($chan)]
- if {$b == ""} { set b 0 }
- if {$b > 0} {
- lappend blacks($b) $user
- }
- }
- foreach blackq [lsort -integer -decreasing [array names blacks]] {
- set i [expr $i +1]
- lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
- }
- if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
- return 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 top.21 none
- foreach txt [wordwrap [join $topblack " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
- }
- }
- d {
-
- array set blacks [list]
- set list [userlist nm|OSVAM $chan]
- foreach user $list {
- set b [getuser $user XTRA d($chan)]
- if {$b == ""} { set b 0 }
- if {$b > 0} {
- lappend blacks($b) $user
- }
- }
- foreach blackq [lsort -integer -decreasing [array names blacks]] {
- set i [expr $i +1]
- lappend topblack 1- $i - : 1[join $blacks($blackq) ,] 12($blackq) |
- }
- if {![info exists topblack]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
- return 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 top.22 none
- foreach txt [wordwrap [join $topblack " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
- }
- }
- words {
- array set topw [list]
- if {![channel get $chan topwords]} {
- blacktools:tell $nick $host $hand $chan $chan1 top.23 none
- return 0
- }
- if {[string match -nocase $del "erase"] && [matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 top.24 none
- set file [open $wordsdir "w"]
- close $file
- return 0
- }
- set file [open $wordsdir "r"]
- set database [read -nonewline $file]
- close $file
- if {$database == ""} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
- return 0
- }
- set data [split $database "\n"]
- foreach line $data {
- set hhost [lindex [split $line] 2]
- set hentry [lindex [split $line] 1]
- set chanentry [lindex [split $line] 0]
- set tw [lindex [split $line] 3]
- if {[string match -nocase $chanentry $chan]} {
- lappend topw($tw) $hentry
- }
- }
- foreach twords [lsort -integer -decreasing [array names topw]] {
- set i [expr $i +1]
- if {!($i > $max)} {
- lappend topwo 1- $i - : 1[join $topw($twords) ,] 12($twords) |
- }
- }
- if {![info exists topwo]} { blacktools:tell $nick $host $hand $chan $chan1 top.9 none
- return 0
- }
- blacktools:tell $nick $host $hand $chan $chan1 top.25 $max
- foreach txt [wordwrap [join $topwo " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 top.11 $txt
- }
- }
- }
- }
- proc securepublic {nick host hand chan arg} {
- global black
- set what [lindex [split $arg] 0]
- set type 0
- set chan1 "$chan"
- if {[regexp {^[#&]} $what] && [matchattr $hand nm|- $chan]} {
- set chan "$what"
- set what [lindex [split $arg] 1]
- }
- secure:process $nick $host $hand $chan $chan1 $what $type
- }
- proc secure:process {nick host hand chan chan1 what type} {
- global botnick black
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- if {[matchattr $hand nm|- $chan]} {
- if {($what == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 secure.1 none
- return 0
- }
- if {($what == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 secure.2 none
- return 0
- }
- }
- if {($what == "") && ($type == "0")} {
- blacktools:tell $nick $host $hand $chan $chan1 secure.3 none
- return 0
- }
- if {($what == "") && ($type == "1")} {
- blacktools:tell $nick $host $hand $chan $chan1 secure.4 none
- return 0
- }
- if {![validchan $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![onchan $botnick $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
- return 0
- }
- if {[string match -nocase "$what" "on"]} {
- set char(a) "+"
- 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
- blacktools:tell $nick $host $hand $chan $chan1 secure.5 none
- }
- if {[string match -nocase "$what" "off"]} {
- set char(a) "-"
- 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
- blacktools:tell $nick $host $hand $chan $chan1 secure.6 none
- }
- }
- proc hpublic {nick host hand chan arg} {
- global black botnick
- set chan1 "$chan"
- set command [lindex [split $arg] 0]
- h:process $nick $host $hand $chan $chan1 $command
- }
- proc h:process {nick host hand chan chan1 command} {
- global black botnick
- set char(p) [lindex $black(cmdchar) 0]
- if {[string match -nocase "$char(p)" "none"]} {
- set char(p) ""
- }
- set replace(%chan%) $chan
- set replace(%char%) $char(p)
- set greeting [getuser $hand XTRA GREET]
- set chanlang [string tolower [channel get $chan lang]]
- if {$chanlang == ""} { set chanlang "[string tolower $black(default_lang)]" }
- if {$greeting == ""} {
- putserv "PRIVMSG $nick :[string map [array get replace] $black(say.$chanlang.greeting.1)]"
- putserv "PRIVMSG $nick :[string map [array get replace] $black(say.$chanlang.greeting.2)]"
- putserv "PRIVMSG $nick :[string map [array get replace] $black(say.$chanlang.greeting.3)]"
- putserv "PRIVMSG $nick :[string map [array get replace] $black(say.$chanlang.greeting.4)]"
- setuser $hand XTRA GREET 1
- return 0
- }
- set getlang [string tolower [getuser $hand XTRA OUTPUT_LANG]]
- set replace(%char%) "$char(p)"
- if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {$command == ""} {
- if {[matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 h.1 none
- blacktools:tell $nick $host $hand $chan $chan1 h.2 none
- return 0
- }
- if {[matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 h.3 none
- blacktools:tell $nick $host $hand $chan $chan1 h.4 none
- return 0
- }
- if {[matchattr $hand -|V $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 h.5 none
- blacktools:tell $nick $host $hand $chan $chan1 h.6 none
- return 0
- }
- if {[matchattr $hand -|O $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 h.7 none
- blacktools:tell $nick $host $hand $chan $chan1 h.8 none
- return 0
- }
- if {[matchattr $hand -|S $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 h.9 none
- blacktools:tell $nick $host $hand $chan $chan1 h.10 none
- return 0
- }
- if {[matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 h.11 none
- blacktools:tell $nick $host $hand $chan $chan1 h.12 none
- return 0
- }
- if {[matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 h.13 none
- blacktools:tell $nick $host $hand $chan $chan1 h.14 none
- return 0
- }
- return 0
- }
- switch -exact -- [string tolower $command] {
- cmds {
- if {[matchattr $hand -|V $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 cmdsvoice none
- return 0
- }
- if {[matchattr $hand -|O $chan]} {
- foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.cmdsop)] " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
- }
- return 0
- }
- if {[matchattr $hand -|S $chan]} {
- foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.cmdsenior)] " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
- }
- return 0
- }
- if {[matchattr $hand -|A $chan]} {
- foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.cmdadmin)] " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
- b
- }
- return 0
- }
- if {[matchattr $hand -|M $chan]} {
- foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.cmdmanager)] " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
- }
- return 0
- }
- if {[matchattr $hand n|- $chan]} {
- foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.cmdbossowner)] " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
- }
- return 0
- }
- if {[matchattr $hand m|- $chan]} {
- foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.cmdowner)] " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
- }
- return 0
- }
- }
- ban {
- if {[matchattr $hand -|V $chan]} {
- foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.banvoice)] " "] 450] {
- blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
- }
- return 0
- }
- if {[matchattr $hand -|O $chan]} {
- foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.banop)] " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
- }
- return 0
- }
- if {[matchattr $hand -|S $chan]} {
- foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.bansenior)] " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
- }
- return 0
- }
- if {[matchattr $hand -|A $chan]} {
- foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.banadmin)] " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
- }
- return 0
- }
- if {[matchattr $hand -|M $chan]} {
- foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.banmanager)] " "] 300] {
- blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
- }
- return 0
- }
- if {[matchattr $hand n|- $chan]} {
- foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.banbossowner)] " "] 380] {
- blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
- }
- return 0
- }
- if {[matchattr $hand m|- $chan]} {
- foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.banowner)] " "] 380] {
- blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
- }
- return 0
- }
- }
- add {
- if {[matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 addadmin none
- return 0
- }
- if {[matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 addmanager none
- return 0
- }
- if {[matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 addbossowner none
- return 0
- }
- if {[matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 addowner none
- return 0
- }
- }
- modif {
- if {[matchattr $hand -|A $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 modifadmin none
- return 0
- }
- if {[matchattr $hand -|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 modifmanager none
- return 0
- }
- if {[matchattr $hand n|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 modifbossowner none
- return 0
- }
- if {[matchattr $hand m|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 modifowner none
- return 0
- }
- }
- owner {
- if {[matchattr $hand nm|- $chan]} {
- foreach txt [wordwrap [join [string map [array get replace] $black(say.$getlang.howner)] " "] 390] {
- blacktools:tell $nick $host $hand $chan $chan1 h.15 $txt
- }
- }
- }
- top {
- if {[matchattr $hand nm|MASOV $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 htop $nick
- }
- }
- blacktools {
- if {[matchattr $hand nm|M $chan]} {
- if {[channel get $chan antipub]} { set pubstatus "+antipub" } else { set pubstatus "-antipub" }
- if {[channel get $chan antinotice]} { set noticestatus "+antinotice" } else { set noticestatus "-antinotice" }
- if {[channel get $chan antictcp]} { set ctcpstatus "+antictcp" } else { set ctcpstatus "-antictcp" }
- if {[channel get $chan antibadword]} { set badwordstatus "+antibadword" } else { set badwordstatus "-antibadword" }
- if {[channel get $chan antilongtext]} { set longtextstatus "+antilongtext" } else { set longtextstatus "-antilongtext" }
- if {[channel get $chan badquitpart]} { set badquitpartstatus "+badquitpart" } else { set badquitpartstatus "-badquitpart" }
- if {[channel get $chan antijoinpart]} { set joinpartstatus "+antijoinpart" } else { set joinpartstatus "-antijoinpart" }
- if {[channel get $chan antispam]} { set antispamstatus "+antispam" } else { set antispamstatus "-antispam" }
- if {[channel get $chan antirepeat]} { set repeatstatus "+antirepeat" } else { set repeatstatus "-antirepeat" }
- if {[channel get $chan anticolor]} { set colorstatus "+anticolor" } else { set colorstatus "-anticolor" }
- if {[channel get $chan antibold]} { set boldstatus "+antibold" } else { set boldstatus "-antibold" }
- if {[channel get $chan antiunderline]} { set underlinestatus "+antiunderline" } else { set underlinestatus "-antiunderline" }
- if {[channel get $chan anticaps]} { set capsstatus "+anticaps" } else { set capsstatus "-anticaps" }
- if {[channel get $chan badnick]} { set nickstatus "+badnick" } else { set nickstatus "-badnick" }
- if {[channel get $chan badfullname]} { set fullnamestatus "+badfullname" } else { set fullnamestatus "-badfullname" }
- if {[channel get $chan autoop]} { set opstatus "+autoop" } else { set opstatus "-autoop" }
- if {[channel get $chan autovoice]} { set voicestatus "+autovoice" } else { set voicestatus "-autovoice" }
- if {[channel get $chan antijoinflood]} { set joinfloodstatus "+antijoinflood" } else { set joinfloodstatus "-antijoinflood" }
- if {[channel get $chan antichanflood]} { set chanfloodstatus "+antichanflood" } else { set chanfloodstatus "-antichanflood" }
- if {[channel get $chan badident]} { set badidentstatus "+badident" } else { set badidentstatus "-badident" }
- set xbantime [channel get $chan xbantime]
- if {$xbantime == "0"} { set xbantime 1 }
- set xbanlevel [channel get $chan xbanlevel]
- if {$xbanlevel == "0"} { set xbanlevel 100 }
- 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."
- blacktools:tell $nick $host $hand $chan $chan1 hblacktools.2 none
- }
- }
- standard {
- if {[matchattr $hand nm|M $chan]} {
- if {[channel get $chan protectops]} { set protectops "+protectops" } else { set protectops "-protectops" }
- if {[channel get $chan bitch]} { set bitch "+bitch" } else { set bitch "-bitch" }
- if {[channel get $chan enforcebans]} { set enforcebans "+enforcebans" } else { set enforcebans "-enforcebans" }
- if {[channel get $chan protecthalfops]} { set protecthalfops "+protecthalfops" } else { set protecthalfops "-protecthalfops" }
- if {[channel get $chan protectfriends]} { set protectfriends "+protectfriends" } else { set protectfriends "-protectfriends" }
- if {[channel get $chan dynamicbans]} { set dynamicbans "+dynamicbans" } else { set dynamicbans "-dynamicbans" }
- if {[channel get $chan dontkickops]} { set dontkickops "+dontkickops" } else { set dontkickops "-dontkickops" }
- if {[channel get $chan nodesynch]} { set nodesynch "+nodesynch" } else { set nodesynch "-nodesynch" }
- if {[channel get $chan dynamicbans]} { set noticestatus "+dynamicbans" } else { set dynamicbans "-dynamicbans" }
- set bantime [channel get $chan ban-time]
- set floodchan [channel get $chan flood-chan]
- set floodjoin [channel get $chan flood-join]
- set floodkick [channel get $chan flood-kick]
- set floodctcp [channel get $chan flood-ctcp]
- set floodnick [channel get $chan flood-nick]
- set flooddeop [channel get $chan flood-deop]
- set chanmode [channel get $chan chanmode]
- blacktools:tell $nick $host $hand $chan $chan1 hstandard.1 none
- 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"
- 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 "
- blacktools:tell $nick $host $hand $chan $chan1 hstandard.3 "12ChanMode :1$chanmode 12Ban-Time :1 $bantime "
- blacktools:tell $nick $host $hand $chan $chan1 hstandard.2 none
- }
- }
- chaninfo {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hchaninfo.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hchaninfo.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hchaninfo.3 none
- blacktools:tell $nick $host $hand $chan $chan1 hchaninfo.4 none
- blacktools:tell $nick $host $hand $chan $chan1 hchaninfo.5 none
- }
- }
- module {
- if {[matchattr $hand nm|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hmodule.1 none
- } else { blacktools:tell $nick $host $hand $chan $chan1 hmodule.2 none }
- blacktools:tell $nick $host $hand $chan $chan1 hmodule.3 none
- }
- antitake {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hantitake.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hantitake.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hantitake.3 none
- blacktools:tell $nick $host $hand $chan $chan1 hantitake.4 none
- }
- }
- private {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hprivate.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hprivate.2 none
- }
- }
- language {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hlanguage.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hlanguage.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hlanguage.3 none
- }
- }
- xban {
- set xbantime [channel get $chan xbantime]
- if {$xbantime == "0"} { set xbantime 1 }
- set xlevel [channel get $chan xbanlevel]
- if {$xlevel == "0"} { set xlevel 100 }
- if {[matchattr $hand nm|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hxban.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hxban.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hxban.3 "$xbantime $xlevel"
- }
- }
- topicrefresh {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 htopicrefresh.1 none
- blacktools:tell $nick $host $hand $chan $chan1 htopicrefresh.2 none
- }
- }
- count {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hcount.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hcount.2 none
- }
- }
- xtools {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hxtools.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hxtools.2 none
- }
- }
- badchan {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hbadchan.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hbadchan.2 none
- }
- }
- badword {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hbadword.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hbadword.2 none
- }
- }
- anunt {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hanunt.1 $black(anunttime)
- blacktools:tell $nick $host $hand $chan $chan1 hanunt.2 none
- }
- }
- autobroadcast {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hautobroadcast.1 $black(bttime)
- blacktools:tell $nick $host $hand $chan $chan1 hautobroadcast.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hautobroadcast.3 none
- }
- }
- antibotidle {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hantibotidle.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hantibotidle.2 $black(noidlemax)
- }
- }
- limit {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hlimit.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hlimit.2 none
- }
- }
- topic {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 htopic.1 none
- blacktools:tell $nick $host $hand $chan $chan1 htopic.2 none
- }
- }
- seen {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hseen.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hseen.2 none
- }
- }
- clonescan {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hclonescan.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hclonescan.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hclonescan.3 none
- }
- }
- greet {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hgreet.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hgreet.2 none
- }
- }
- leave {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hleave.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hleave.2 none
- }
- }
- idle {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hidle.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hidle.2 none
- }
- }
- chanreport {
- if {[matchattr $hand nm|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hchanreport.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hchanreport.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hchanreport.3 none
- }
- }
- topwords {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 htopwords.1 none
- blacktools:tell $nick $host $hand $chan $chan1 htopwords.2 none
- blacktools:tell $nick $host $hand $chan $chan1 htopwords.3 none
- }
- }
- settings {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hsettings.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hsettings.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hsettings.3 none
- blacktools:tell $nick $host $hand $chan $chan1 hsettings.4 none
- blacktools:tell $nick $host $hand $chan $chan1 hsettings.5 none
- blacktools:tell $nick $host $hand $chan $chan1 hsettings.6 none
- }
- }
- reason {
- if {[matchattr $hand nm|M $chan]} {
- if {[channel get $chan showhandle]} { set showhandle "+showhandle" } else { set showhandle "-showhandle" }
- if {[channel get $chan showcount]} { set showcount "+showcount" } else { set showcount "-showcount" }
- if {[channel get $chan showtime]} { set showtime "+showtime" } else { set showtime "-showtime" }
- blacktools:tell $nick $host $hand $chan $chan1 hreason.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hreason.2 "$showhandle $showcount $showtime"
- blacktools:tell $nick $host $hand $chan $chan1 hreason.3 none
- blacktools:tell $nick $host $hand $chan $chan1 hreason.4 none
- blacktools:tell $nick $host $hand $chan $chan1 hreason.5 none
- blacktools:tell $nick $host $hand $chan $chan1 hreason.6 none
- }
- }
- extra {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hextra.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hextra.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hextra.3 none
- blacktools:tell $nick $host $hand $chan $chan1 hextra.4 none
- blacktools:tell $nick $host $hand $chan $chan1 hextra.5 none
- }
- }
- antipub {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hantipub.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hantipub.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hantipub.3 none
- }
- }
- privat {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hprivat.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hprivat.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hprivat.3 none
- }
- }
- antidle {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hantidle.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hantidle.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hantidle.3 none
- }
- }
- antinotice {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hantinotice.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hantinotice.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hantinotice.3 none
- }
- }
- antictcp {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hantictcp.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hantictcp.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hantictcp.3 none
- }
- }
- antibadword {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hantibadword.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hantibadword.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hantibadword.3 none
- }
- }
- antilongtext {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hantilongtext.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hantilongtext.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hantilongtext.3 none
- }
- }
-
- antibadquitpart {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hantibadquitpart.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hantibadquitpart.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hantibadquitpart.3 none
- }
- }
- antijoinpart {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hantijoinpart.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hantijoinpart.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hantijoinpart.3 none
- }
- }
- antispam {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hantispam.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hantispam.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hantispam.3 none
- }
- }
- antirepeat {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hantirepeat.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hantirepeat.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hantirepeat.3 none
- }
- }
- anticolor {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hanticolor.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hanticolor.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hanticolor.3 none
- }
- }
- antibold {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hantibold.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hantibold.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hantibold.3 none
- }
- }
- antiunderline {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hantiunderline.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hantiunderline.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hantiunderline.3 none
- }
- }
- anticaps {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hanticaps.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hanticaps.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hanticaps.3 none
- }
- }
- badfullname {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hbadfullname.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hbadfullname.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hbadfullname.3 none
- }
- }
- badnick {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hbadnick.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hbadnick.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hbadnick.3 none
- }
- }
- badident {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hbadident.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hbadident.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hbadident.3 none
- }
- }
- antichanflood {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hantichanflood.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hantichanflood.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hantichanflood.3 none
- }
- }
- antijoinflood {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hantijoinflood.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hantijoinflood.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hantijoinflood.3 none
- }
- }
- dr {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hdr.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hdr.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hdr.3 none
- }
- }
- bot {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hbot.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hbot.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hbot.3 none
- }
- }
- n {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hn.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hn.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hn.3 none
- }
- }
- id {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hid.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hid.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hid.3 none
- }
- }
- w {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hw.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hw.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hw.3 none
- }
- }
- spam {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hspam.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hspam.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hspam.3 none
- }
- }
- bw {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hbw.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hbw.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hbw.3 none
- }
- }
- badchannel {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hbadchannel.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hbadchannel.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hbadchannel.3 none
- }
- }
- counter {
- if {[matchattr $hand nm|M $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 hcounter.1 none
- blacktools:tell $nick $host $hand $chan $chan1 hcounter.2 none
- blacktools:tell $nick $host $hand $chan $chan1 hcounter.3 none
- }
- }
- }
- }
- proc comand:pubme {nick host hand chan arg} {
- global botnick wordsdir wdir sdir black seendir count server uptime {server-online}
- set arg [split $arg]
- set bnick [lindex [split $arg] 0]
- set what [lindex [split $arg] 1]
- if {([lsearch -exact [string tolower $bnick] [string tolower $botnick]] == 0)} {
- switch -exact -- [string tolower $what] {
- clear {
- if {[matchattr $hand nm|M $chan]} {
- set why [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
- set chan "$why"
- set why [lindex [split $arg] 3]
- }
- clear:process $nick $host $hand $chan $chan1 $why $type
- }
- }
- private {
- if {[matchattr $hand nm|M $chan]} {
- set type 1
- set chan1 "$chan"
- set why [lindex [split $arg] 2]
- set user [lindex [split $arg] 3]
- set host [lindex [split $arg] 4]
- if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
- set chan "$why"
- set why [lindex [split $arg] 3]
- set user [lindex [split $arg] 4]
- set host [lindex [split $arg] 5]
- }
- private:process $nick $host $hand $chan $chan1 $why $user $host $type
- }
- }
- login {
- if {[matchattr $hand nm|MSOAV $chan]} {
- putquick "$black(login)"
- putquick "MODE $botnick :$black(xmod)"
- blacktools:tell:prv $nick $host $hand login.1 $black(chanserv)
- }
- }
- h {
- if {[matchattr $hand nm|MSOAV $chan]} {
- set chan1 "$chan"
- set command [lindex [split $arg] 2]
- h:process $nick $host $hand $chan $chan1 $command
- }
- }
- secure {
- if {[matchattr $hand nm|M $chan]} {
- set what [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[#&]} $what] && [matchattr $hand nm|- $chan]} {
- set chan "$what"
- set what [lindex [split $arg] 3]
- }
- secure:process $nick $host $hand $chan $chan1 $what $type
- }
- }
- ignore {
- if {[matchattr $hand nm|- $chan]} {
- set chan1 "$chan"
- set what [lindex [split $arg] 2]
- set mask [lindex [split $arg] 3]
- set time [lindex [split $arg] 4]
- set reason [join [lrange [split $arg] 5 end]]
- if {$what == ""} { blacktools:tell $nick $host $hand $chan $chan1 ignore.2 none
- return 0
- }
- ignore:process $nick $host $hand $chan $chan1 $what $mask $time $reason
- }
- }
- idle {
- if {[matchattr $hand nm|M $chan]} {
- set char(p) [lindex $black(cmdchar) 0]
- set flag "-|f"
- set type1 1
- set chan1 "$chan"
- set why [lindex [split $arg] 2]
- set type [lindex [split $arg] 3]
- set user [lindex [split $arg] 3]
- set host [lindex [split $arg] 4]
- if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
- set chan "$why"
- set why [lindex [split $arg] 3]
- set type [lindex [split $arg] 4]
- set user [lindex [split $arg] 4]
- set host [lindex [split $arg] 5]
- }
- antidle:process $why $type $type1 $user $host $nick $hand $chan $chan1
- }
- }
- version {
- if {[matchattr $hand nm|MASOV $chan]} {
- set chan1 "$chan"
- version:process $nick $host $hand $chan $chan1
- }
- }
- cc {
- if {[matchattr $hand nm|MASO $chan]} {
- set ::chan $chan
- set chan1 "$chan"
- set c [lindex [split $arg] 2]
- if {$c == ""} { blacktools:tell $nick $host $hand $chan $chan1 cc.2 none
- return 0
- }
- if {![regexp {^[\\+!#&]} $c]} {
- set c #$c
- }
- putquick "MODE $c"
- bind raw - 329 createdpublic
- bind raw - 403 nocreatedpublic
- }
- }
- activ {
- if {[matchattr $hand nm|MASOV $chan]} {
- set type 1
- set chan1 "$chan"
- set user [lindex [split $arg] 2]
- if {[regexp {^[#&]} $user] && [matchattr $hand nm|- $chan]} {
- set chan "$user"
- set user [lindex [split $arg] 3]
- }
- activ:process $nick $host $hand $chan $chan1 $user $type
- }
- }
- delmyhost {
- if {[matchattr $hand nm|- $chan]} {
- set chan1 "$chan"
- set why [lindex [split $arg] 2]
- if {$why == ""} { blacktools:tell $nick $host $hand $chan $chan1 delmyhost.1 none
- return 0
- }
- delmyhost:process $nick $host $hand $chan $chan1 $why
- }
- }
- addmyhost {
- if {[matchattr $hand nm|- $chan]} {
- set why [lindex [split $arg] 2]
- set chan1 "$chan"
- if {$why == ""} { blacktools:tell $nick $host $hand $chan $chan1 addmyhost.2 none
- return 0
- }
- addmyhost:process $nick $host $hand $chan $chan1 $why
- }
- }
- leave {
- if {[matchattr $hand nm|M $chan]} {
- set dir "logs/leave($chan).txt"
- set type 1
- set chan1 "$chan"
- set who [lindex [split $arg] 2]
- set leave [join [lrange [split $arg] 3 end]]
- set number [lindex [split $arg] 3]
- if {[regexp {^[\\+!#&]} $who] && [matchattr $hand nm|- $chan]} {
- set chan "$who"
- set who [lindex [split $arg] 3]
- set leave [join [lrange [split $arg] 4 end]]
- set number [lindex [split $arg] 4]
- }
- leave:process $who $leave $number $type $nick $host $hand $chan $chan1
- }
- }
- greet {
- if {[matchattr $hand nm|M $chan]} {
- set who [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- set greet [join [lrange [split $arg] 3 end]]
- set number [lindex [split $arg] 3]
- if {[regexp {^[\\+!#&]} $who] && [matchattr $hand nm|- $chan]} {
- set chan "$who"
- set who [lindex [split $arg] 3]
- set greet [join [lrange [split $arg] 4 end]]
- set number [lindex [split $arg] 4]
- }
- greet:process $who $greet $number $type $nick $host $hand $chan $chan1
- }
- }
- chat {
- if {[matchattr $hand nm|- $chan]} {
- *ctcp:CHAT $nick $host $hand $botnick CHAT $arg
- blacktools:tell $nick $host $hand $chan $chan1 chat.1 none
- }
- }
- seen {
- if {[matchattr $hand -|- $chan]} {
- if {![channel get $chan seen]} {
- return 0
- }
- set type 1
- set wseen [lindex $arg 2]
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $wseen] && [matchattr $hand nm|- $chan]} {
- set chan1 "$chan"
- set chan "$wseen"
- set wseen [lindex $arg 3]
- }
- seen:process $nick $host $hand $chan $chan1 $wseen $type
- }
- }
- topic {
- if {[matchattr $hand nm|M $chan]} {
- set nop [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- set tp [join [lrange [split $arg] 3 end]]
- set number [lindex [split $arg] 3]
- if {[regexp {^[\\+!#&]} $nop] && [matchattr $hand nm|- $chan]} {
- set chan "$nop"
- set nop [lindex [split $arg] 3]
- set tp [join [lrange [split $arg] 4 end]]
- set number [lindex [split $arg] 4]
- }
- topic:process $nick $host $hand $chan $chan1 $nop $tp $number $type
- }
- }
- limit {
- if {[matchattr $hand nm|M $chan]} {
- set why [lindex [split $arg] 2]
- set lm [lindex [split $arg] 3]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
- set chan "$why"
- set why [lindex [split $arg] 3]
- set lm [lindex [split $arg] 4]
- }
- limit:process $nick $host $hand $chan $chan1 $why $lm $type
- }
- }
- anunt {
- if {[matchattr $hand nm|M $chan]} {
- set type 1
- set chan1 "$chan"
- set who [lindex [split $arg] 2]
- set message [join [lrange [split $arg] 3 end]]
- set number [lindex [split $arg] 3]
- if {[regexp {^[\\+!#&]} $who] && [matchattr $hand nm|- $chan]} {
- set chan "$who"
- set who [lindex [split $arg] 3]
- set message [join [lrange [split $arg] 4 end]]
- set number [lindex [split $arg] 4]
- }
- anunt:process $nick $host $hand $chan $chan1 $who $message $number $type
- }
- }
- bt {
- if {[matchattr $hand nm|- $chan]} {
- set who [lindex [split $arg] 2]
- set chan1 "$chan"
- set message [join [lrange [split $arg] 3 end]]
- set number [lindex [split $arg] 3]
- if {$who == ""} { blacktools:tell $nick $host $hand $chan $chan1 autobroadcast.2 none
- return 0
- }
- broadcast:process $nick $host $hand $chan $chan1 $who $message $number
- }
- }
- badchan {
- if {[matchattr $hand nm|M $chan]} {
- set why [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- set bdchan [join [lindex [split $arg] 3]]
- if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
- set chan "$why"
- set why [lindex [split $arg] 3]
- set bdchan [join [lindex [split $arg] 4]]
- }
- badchan:process $nick $host $hand $chan $chan1 $why $bdchan $type
- }
- }
- count {
- if {[matchattr $hand nm|M $chan]} {
- set why [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
- set chan "$why"
- set why [lindex [split $arg] 3]
- }
- count:process $nick $host $hand $chan $chan1 $why $type
- }
- }
- delvoice {
- if {[matchattr $hand nm|M $chan]} {
- set user [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
- set chan "$user"
- set user [lindex [split $arg] 3]
- }
- delvoice:process $nick $host $hand $chan $chan1 $user $type
- }
- }
- delop {
- if {[matchattr $hand nm|M $chan]} {
- set user [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
- set chan "$user"
- set user [lindex [split $arg] 3]
- }
- delop:process $nick $host $hand $chan $chan1 $user $type
- }
- }
- addvoice {
- if {[matchattr $hand nm|M $chan]} {
- set user [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
- set chan "$user"
- set user [lindex [split $arg] 3]
- }
- addvoice:process $nick $host $hand $chan $chan1 $user $type
- }
- }
- addop {
- if {[matchattr $hand nm|M $chan]} {
- set user [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
- set chan "$user"
- set user [lindex [split $arg] 3]
- }
- addop:process $nick $host $hand $chan $chan1 $user $type
- }
- }
- addbot {
- if {[matchattr $hand nm|- $chan]} {
- set why [lindex [split $arg] 2]
- set host [lindex [split $arg] 3]
- set chan1 "$chan"
- if {$why == ""} { blacktools:tell $nick $host $hand $chan $chan1 addbot.2 none
- return 0
- }
- addbot:process $nick $host $hand $chan $chan1 $why $host
- }
- }
- whois {
- if {[matchattr $hand nm|MAOS $chan]} {
- set chan1 "$chan"
- set who [lindex [split $arg] 2]
- if {$who == ""} { blacktools:tell $nick $host $hand $chan $chan1 whois.2 none
- return 0
- }
- whois:process $nick $host $hand $chan $chan1 $who
- }
- }
- vers {
- if {[matchattr $hand nm|MAOS $chan]} {
- set chan1 "$chan"
- set why [lindex [split $arg] 2]
- if {$why == ""} { blacktools:tell $nick $host $hand $chan $chan1 vers.2 none
- return 0
- }
- vers:process $nick $host $hand $chan $chan1 $why
- }
- }
- time {
- if {[matchattr $hand nm|MAOSV $chan]} {
- set chan1 "$chan"
- set time [ctime [unixtime]]
- blacktools:tell $nick $host $hand $chan $chan1 time.1 $time
- }
- }
- ping {
- if {[matchattr $hand nm|MAOSV $chan]} {
- putquick "PRIVMSG $nick :\001PING [expr {abs([clock clicks -milliseconds])}]\001"
- return 0
- }
- }
- us {
- if {[matchattr $hand nm|MA $chan]} {
- set type 1
- set chan1 "$chan"
- set users [lindex [split $arg] 2]
- if {[regexp {^[#&]} $users] && [matchattr $hand nm|- $chan]} {
- set chan "$users"
- set users [lindex [split $arg] 3]
- }
- us:process $nick $host $hand $chan $chan1 $users $type
- }
- }
- s {
- if {[matchattr $hand nm|MA $chan]} {
- set type 1
- set chan1 "$chan"
- set users [lindex [split $arg] 2]
- if {[regexp {^[#&]} $users] && [matchattr $hand nm|- $chan]} {
- set chan "$users"
- set users [lindex [split $arg] 3]
- }
- s:process $nick $host $hand $chan $chan1 $users $type
- }
- }
- info {
- if {[matchattr $hand nm|MASOV $chan]} {
- set user [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
- set chan "$user"
- set user [lindex [split $arg] 3]
- }
- info:process $nick $host $hand $chan $chan1 $user $type
- }
- }
- channels {
- if {[matchattr $hand nm|MASOV $chan]} {
- set chan1 "$chan"
- channels:process $nick $host $hand $chan $chan1
- }
- }
- userlist {
- if {[matchattr $hand nm|MASOV $chan]} {
- set level [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[#&]} $level] && [matchattr $hand nm|- $chan]} {
- set chan "$level"
- set level [lindex [split $arg] 3]
- }
- userlist:execute $hand $host $level $chan $chan1 $nick $type
- }
- }
- chuser {
- if {[matchattr $hand nm|M $chan]} {
- set user [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- set chandle [lindex [split $arg] 3]
- chuser:process $nick $host $hand $chan $chan1 $user $chandle $type
- }
- }
- delhost {
- if {[matchattr $hand nm|M $chan]} {
- set user [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- set hosts [lrange [split $arg] 3 end]
- delhost:process $nick $host $hand $chan $chan1 $user $hosts $type
- }
- }
- botidle {
- if {[matchattr $hand nm|M $chan]} {
- set chan1 "$chan"
- set what [lindex [split $arg] 2]
- if {$what == ""} { blacktools:tell $nick $host $hand $chan $chan1 antibotidle.2 none
- return 0
- }
- botidle:process $nick $host $hand $chan $chan1 $what
- }
- }
- addhost {
- if {[matchattr $hand nm|M $chan]} {
- set type 1
- set chan1 "$chan"
- set user [lindex [split $arg] 2]
- set hosts [lrange [split $arg] 3 end]
- addhost:process $nick $host $hand $chan $chan1 $user $hosts $type
- }
- }
- del {
- if {[matchattr $hand nm|- $chan]} {
- set args [lrange [split $arg] 2 end]
- set type 1
- set chan1 "$chan"
- del:process $nick $host $hand $chan $chan1 $args $type
- }
- }
- delacc {
- if {[matchattr $hand nm|MA $chan]} {
- set args [lrange [split $arg] 2 end]
- set type 1
- set chan1 "$chan"
- set c [lindex [split $arg] 2]
- if {[regexp {^[#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set args [lrange [split $arg] 3 end]
- }
- delacc:process $nick $host $hand $chan $chan1 $args $type
- }
- }
- adduser {
- if {[matchattr $hand nm|MA $chan]} {
- set chan1 "$chan"
- set level [lindex [split $arg] 2]
- set args [lrange [split $arg] 3 end]
- set c [lindex [split $arg] 3]
- set type 1
- if {[regexp {^[#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set args [lrange [split $arg] 4 end]
- }
- adduser:process $nick $host $hand $chan $chan1 $args $level $type
- }
- }
- add {
- if {[matchattr $hand nm|MA $chan]} {
- set level [lindex [split $arg] 2]
- set time [ctime [unixtime]]
- set type 1
- set chan1 "$chan"
- set args [lrange [split $arg] 3 end]
- set c [lindex [split $arg] 3]
- if {[regexp {^[#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set args [lrange [split $arg] 4 end]
- }
- if {[matchattr $hand -|q $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- add:process $args $time $level $hand $host $chan $chan1 $nick $type
- }
- }
- unsuspend {
- if {[matchattr $hand nm|- $chan]} {
- set chans [lindex [split $arg] 2]
- set chan1 "$chan"
- if {$chans == ""} {blacktools:tell $nick $host $hand $chan $chan1 unsuspend.5 none
- return 0
- }
- if {![regexp {^[\\+!#&]} $chans]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
-
- if {![validchan $chans]} { blacktools:tell $nick $host $hand $chan $chan1 unsuspend.2 $chans
- return 0
- }
- if {![channel get $chans inactive]} {
- blacktools:tell $nick $host $hand $chan $chan1 unsuspend.3 $chans
- return 0
- }
- channel set $chans -inactive
- blacktools:tell $nick $host $hand $chan $chan1 unsuspend.4 $chans
- }
- }
- suspend {
- if {[matchattr $hand nm|- $chan]} {
- set chans [lindex [split $arg] 2]
- set chan1 "$chan"
- if {$chans == ""} {blacktools:tell $nick $host $hand $chan $chan1 suspend.5 none
- return 0
- }
- if {![regexp {^[\\+!#&]} $chans]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![validchan $chans]} { blacktools:tell $nick $host $hand $chan $chan1 suspend.2 $chans
- return 0
- }
- if { [channel get $chans inactive]} {
- blacktools:tell $nick $host $hand $chan $chan1 suspend.3 $chans
- return 0
- }
- channel set $chans +inactive
- blacktools:tell $nick $host $hand $chan $chan1 suspend.4 $chans
- }
- }
- delchan {
- if {[matchattr $hand nm|- $chan]} {
- set chans [lindex [split $arg] 2]
- set chan1 "$chan"
- if {$chans == ""} {blacktools:tell $nick $host $hand $chan $chan1 delchan.4 none
- return 0
- }
- if {![regexp {^[\\+!#&]} $chans]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {![validchan $chans]} { blacktools:tell $nick $host $hand $chan $chan1 delchan.2 $chans
- return 0
- }
- channel remove $chans
- delchan:stats $chans $hand $host
- blacktools:tell $nick $host $hand $chan $chan1 delchan.3 $chans
- }
- }
- addchan {
- if {[matchattr $hand nm|- $chan]} {
- set chan1 "$chan"
- set chans [lindex [split $arg] 2]
- if {$chans == ""} {blacktools:tell $nick $host $hand $chan $chan1 addchan.4 none
- return 0
- }
- if {![regexp {^[\\+!#&]} $chans]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
- return 0
- }
- if {[validchan $chans]} {
- blacktools:tell $nick $host $hand $chan $chan1 addchan.2 $chans
- return 0
- } else {
- channel add $chans
- addchan:stats $chans $hand $host
- blacktools:tell $nick $host $hand $chan $chan1 addchan.3 $chans
- }
- }
- }
- die {
- if {[matchattr $hand nm|- $chan]} {
- set chan1 "$chan"
- blacktools:tell $nick $host $hand $chan $chan1 die.1 none
- utimer 3 [list die "byeeee"]
- }
- }
- jump {
- if {[matchattr $hand nm|- $chan]} {
- set chan1 "$chan"
- set serv [lindex [split $arg] 2]
- blacktools:tell $nick $host $hand $chan $chan1 jump.1 none
- utimer 3 [list jump $serv]
- }
- }
- save {
- if {[matchattr $hand nm|- $chan]} {
- set chan1 "$chan"
- blacktools:tell $nick $host $hand $chan $chan1 save.1 none
- save
- }
- }
- restart {
- if {[matchattr $hand nm|- $chan]} {
- set chan1 "$chan"
- blacktools:tell $nick $host $hand $chan $chan1 restart.1 none
- utimer 3 [list restart]
- }
- }
- rehash {
- if {[matchattr $hand nm|- $chan]} {
- set chan1 "$chan"
- blacktools:tell $nick $host $hand $chan $chan1 rehash.1 none
- rehash
- }
- }
- nick {
- if {[matchattr $hand nm|- $chan]} {
- set who "$nick"
- set newnick [lindex [split $arg] 2]
- nick:process $who $newnick $host $hand $chan
- }
- }
- msg {
- if {[matchattr $hand nm|- $chan]} {
- set nicks [lindex [split $arg] 2]
- set chan1 "$chan"
- set msg [join [lrange [split $arg] 3 end]]
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {$nicks == ""} {blacktools:tell $nick $host $hand $chan $chan1 msg.2 none
- return 0
- }
- if {[isbotnick $nicks]} {
- return 0
- }
- putquick "PRIVMSG $nicks :$msg"
- }
- }
- silence {
- if {[matchattr $hand nm|- $chan]} {
- set value [lindex [split $arg] 2]
- set chan1 "$chan"
- if {$value == ""} { blacktools:tell $nick $host $hand $chan $chan1 silence.2 none
- return 0
- }
- silence:process $nick $host $hand $chan $chan1 $value
- }
- }
- set {
- if {[matchattr $hand nm|M $chan]} {
- set flags [lindex [split $arg] 2]
- set type [join [lrange [split $arg] 3 end]]
- set type1 1
- set chan1 "$chan"
- if {[regexp {^[#&]} $flags] && [matchattr $hand nm|- $chan]} {
- set chan "$flags"
- set flags [lindex [split $arg] 3]
- set type [join [lrange [split $arg] 4 end]]
- }
- set:process $nick $host $hand $chan $chan1 $flags $type $type1
- }
- }
- mode {
- if {[matchattr $hand nm|OSMA $chan]} {
- set modes [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[#&]} $modes] && [matchattr $hand nm|- $chan]} {
- set chan "$modes"
- set modes [lindex [split $arg] 3]
- }
- mode:process $nick $host $hand $chan $chan1 $modes $type
- }
- }
- away {
- if {[matchattr $hand nm|- $chan]} {
- set chan1 "$chan"
- set aw [join [lrange [split $arg] 2 end]]
- if {$aw == "" } {blacktools:tell $nick $host $hand $chan $chan1 away.2 none
- return 0
- }
- away:process $nick $host $hand $chan $chan1 $aw
- }
- }
- cycle {
- if {[matchattr $hand nm|OSMA $chan]} {
- set reason [join [lrange [split $arg] 2 end]]
- set c [lindex [split $arg] 2]
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set reason [join [lrange [split $arg] 3 end]]
- }
- cycle:process $nick $host $hand $chan $chan1 $reason
- }
- }
- purge {
- if {[matchattr $hand nm|M $chan]} {
- set reason [join [lrange [split $arg] 2 end]]
- set chan1 "$chan"
- if {$reason == ""} {
- blacktools:tell $nick $host $hand $chan $chan1 purge.1 none
- return 0
- }
- purge:process $nick $host $hand $chan $chan1 $reason
- }
- }
- check {
- if {[matchattr $hand nm|OSMA $chan]} {
- set chan1 "$chan"
- set checked [lindex [split $arg] 2]
- if {$checked == ""} { blacktools:tell $nick $host $hand $chan $chan1 check.2 none
- return 0
- }
- check:process $nick $host $hand $chan $chan1 $checked
- }
- }
- broadcast {
- if {[matchattr $hand nm|- $chan]} {
- set chan1 "$chan"
- set text [join [lrange [split $arg] 2 end]]
- if {$text == ""} {
- blacktools:tell $nick $host $hand $chan $chan1 broadcast.2 none
- return 0
- }
- broadcast:cmd:process $nick $host $hand $chan $chan1 $text
- }
- }
- act {
- if {[matchattr $hand nm|SMA $chan]} {
- set text [join [lrange [split $arg] 2 end]]
- set c [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set text [join [lrange [split $arg] 3 end]]
- }
- act:process $nick $host $hand $chan $chan1 $text $type
- }
- }
- say {
- if {[matchattr $hand nm|SMA $chan]} {
- set text [join [lrange [split $arg] 2 end]]
- set c [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set text [join [lrange [split $arg] 3 end]]
- }
- say:process $nick $host $hand $chan $chan1 $text $type
- }
- }
- v {
- if {[matchattr $hand nm|VOSMA $chan]} {
- set voicex [lrange $arg 2 end]
- set c [lindex [split $arg] 2]
- set nick [split $nick]
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set voicex [lrange $arg 3 end]
- }
- v:process $nick $host $hand $chan $chan1 $voicex
- }
- }
- o {
- if {[matchattr $hand nm|OSMA $chan]} {
- set opex [lrange $arg 2 end]
- set c [lindex [split $arg] 2]
- set nick [split $nick]
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set opex [lrange $arg 3 end]
- }
- o:process $nick $host $hand $chan $chan1 $opex
- }
- }
- uptime {
- if {[matchattr $hand nm|- $chan]} {
- set chan1 "$chan"
- set up [duration [expr [unixtime] - $uptime]]
- set on [duration [expr [unixtime] - ${server-online}]]
- blacktools:tell $nick $host $hand $chan $chan1 status.1 $up
- blacktools:tell $nick $host $hand $chan $chan1 status.2 $server
- blacktools:tell $nick $host $hand $chan $chan1 status.3 $on
- }
- }
- status {
- if {[matchattr $hand nm|- $chan]} {
- set chan1 "$chan"
- regsub -all " " [channels] ", " chans
- catch {exec uptime} shelluptime
- set up [duration [expr [unixtime] - $uptime]]
- set on [duration [expr [unixtime] - ${server-online}]]
- blacktools:tell $nick $host $hand $chan $chan1 status.1 $up
- blacktools:tell $nick $host $hand $chan $chan1 status.2 $server
- blacktools:tell $nick $host $hand $chan $chan1 status.3 $on
- blacktools:tell $nick $host $hand $chan $chan1 status.4 $chans
- blacktools:tell $nick $host $hand $chan $chan1 status.5 $shelluptime
- }
- }
- t {
- if {[matchattr $hand nm|VOSMA $chan]} {
- set topics [join [lrange [split $arg] 2 end]]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $topics] && [matchattr $hand nm|- $chan]} {
- set chan "$topics"
- set topics [join [lrange [split $arg] 3 end]]
- }
- t:process $nick $host $hand $chan $chan1 $topics $type
- }
- }
- d {
- if {[matchattr $hand nm|SMA $chan]} {
- set days [lindex [split $arg] 2]
- set dnick [lindex [split $arg] 3]
- set type 1
- set mask [lindex [split $arg] 3]
- set reason [join [lrange [split $arg] 4 end]]
- set handle [nick2hand $dnick]
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $days] && [matchattr $hand nm|- $chan]} {
- set chan "$days"
- set days [lindex [split $arg] 3]
- set mask [lindex [split $arg] 4]
- set dnick [lindex [split $arg] 4]
- set reason [join [lrange [split $arg] 5 end]]
- if {![regexp {^[0-9]} $days]} {
- set days 1
- set mask [lindex [split $arg] 3]
- set dnick [lindex [split $arg] 3]
- set reason [join [lrange [split $arg] 4 end]]
- }
- }
- if {![regexp {^[0-9]} $days]} {
- set days 1
- set mask [lindex [split $arg] 2]
- set dnick [lindex [split $arg] 2]
- set reason [join [lrange [split $arg] 3 end]]
- }
- d:process $dnick $mask $days $reason $nick $hand $host $chan $chan1 $type
- }
- }
- sb {
- if {[matchattr $hand nm|VOSMA $chan]} {
- set bhost [string tolower [lindex [split $arg] 2]]
- set what [lindex [split $arg] 3]
- set type 1
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $bhost] && [matchattr $hand nm|- $chan]} {
- set chan "$bhost"
- set bhost [string tolower [lindex [split $arg] 3]]
- set what [lindex [split $arg] 4]
- }
- sb:process $bhost $what $nick $hand $host $chan $chan1 $type
- }
- }
- ub {
- if {[matchattr $hand nm|OSMA $chan]} {
- set ban [lindex [split $arg] 2]
- set why [lindex [split $arg] 3]
- set type 1
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $ban] && [matchattr $hand nm|- $chan]} {
- set chan "$ban"
- set ban [lindex [split $arg] 3]
- }
- ub:process $ban $why $nick $hand $host $chan $chan1 $type
- }
- }
- bw {
- if {[matchattr $hand nm|OSMA $chan]} {
- set abuser [lindex [split $arg] 2]
- set mask [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- set handle [nick2hand $abuser]
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $abuser] && [matchattr $hand nm|- $chan]} {
- set chan "$abuser"
- set abuser [lindex [split $arg] 3]
- set mask [lindex [split $arg] 3]
- }
- bw:process $abuser $mask $nick $hand $host $chan $chan1 $type
- }
- }
- stick {
- if {[matchattr $hand nm|SMA $chan]} {
- set snick [lindex [split $arg] 2]
- set mask [lindex [split $arg] 2]
- set type 1
- set time [lindex [split $arg] 3]
- set reason [join [lrange [split $arg] 4 end]]
- set handle [nick2hand $snick]
- set list [userlist $black(exceptflags) $chan]
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $snick] && [matchattr $hand nm|- $chan]} {
- set chan "$snick"
- set time [lindex [split $arg] 4]
- set mask [lindex [split $arg] 3]
- set snick [lindex [split $arg] 3]
- set reason [join [lrange [split $arg] 5 end]]
- if {![regexp {^[0-9]} $time]} {
- set time "$black(dfstickbantime)"
- set reason [join [lrange [split $arg] 4 end]]
- }
- }
- if {![regexp {^[0-9]} $time]} {
- set time "$black(dfstickbantime)"
- set reason [join [lrange [split $arg] 3 end]]
- }
- stick:process $snick $mask $time $reason $nick $hand $host $chan $chan1 $type
- }
- }
- k {
- if {[matchattr $hand nm|VOSMA $chan]} {
- set knick [lindex [split $arg] 2]
- set type 1
- set reason [join [lrange [split $arg] 3 end]]
- set handle [nick2hand $knick]
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $knick] && [matchattr $hand nm|- $chan]} {
- set chan "$knick"
- set knick [lindex [split $arg] 3]
- set reason [join [lrange [split $arg] 4 end]]
- }
- k:process $knick $nick $hand $host $reason $chan $chan1 $type
- }
- }
- spam {
- if {[matchattr $hand nm|OSMA $chan]} {
- set spammer [lindex [split $arg] 2]
- set type 1
- set mask [lindex [split $arg] 2]
- set handle [nick2hand $spammer]
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $spammer] && [matchattr $hand nm|- $chan]} {
- set chan "$spammer"
- set spammer [lindex [split $arg] 2]
- set mask [lindex [split $arg] 2]
- }
- spam:process $spammer $mask $nick $hand $host $chan $chan1 $type
- }
- }
- w {
- if {[matchattr $hand nm|OVSMA $chan]} {
- set wnick [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- set handle [nick2hand $wnick]
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $wnick] && [matchattr $hand nm|- $chan]} {
- set chan "$wnick"
- set wnick [lindex [split $arg] 3]
- }
- w:process $wnick $nick $hand $host $chan $chan1 $type
- }
- }
- black {
- if {[matchattr $hand nm|SMA $chan]} {
- set blnick [lindex [split $arg] 2]
- set mask [lindex [split $arg] 2]
- set type 1
- set reason [join [lrange [split $arg] 3 end]]
- set handle [nick2hand $blnick]
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $blnick] && [matchattr $hand nm|- $chan]} {
- set chan "$blnick"
- set blnick [lindex [split $arg] 3]
- set mask [lindex [split $arg] 3]
- set reason [join [lrange [split $arg] 4 end]]
- }
- black:process $blnick $nick $mask $hand $host $chan $chan1 $reason $type
- }
- }
- bl {
- if {[matchattr $hand nm|SMA $chan]} {
- set blnick [lindex [split $arg] 2]
- set mask [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- set reason [join [lrange [split $arg] 3 end]]
- set handle [nick2hand $blnick]
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $blnick] && [matchattr $hand nm|- $chan]} {
- set chan "$blnick"
- set blnick [lindex [split $arg] 3]
- set mask [lindex [split $arg] 3]
- set reason [join [lrange [split $arg] 4 end]]
- }
- black:process $blnick $nick $mask $hand $host $chan $chan1 $reason $type
- }
- }
- id {
- if {[matchattr $hand nm|OSMA $chan]} {
- set idnick [lindex [split $arg] 2]
- set handle [nick2hand $idnick]
- set type 1
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $idnick] && [matchattr $hand nm|- $chan]} {
- set chan "$idnick"
- set idnick [lindex [split $arg] 3]
- }
- id:process $idnick $nick $hand $host $chan $chan1 $type
- }
- }
- bot {
- if {[matchattr $hand nm|OSMA $chan]} {
- set bot [lindex [split $arg] 2]
- set mask [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $bot] && [matchattr $hand nm|- $chan]} {
- set chan "$bot"
- set bot [lindex [split $arg] 3]
- set mask [lindex [split $arg] 3]
- }
- bot:process $bot $mask $nick $hand $host $chan $chan1 $type
- }
- }
- dr {
- if {[matchattr $hand nm|OSMA $chan]} {
- set drone [lindex [split $arg] 2]
- set mask [lindex [split $arg] 2]
- set type "1"
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $drone] && [matchattr $hand nm|- $chan]} {
- set chan "$drone"
- set drone [lindex [split $arg] 3]
- set mask [lindex [split $arg] 3]
- }
- dr:process $drone $mask $nick $hand $host $chan $chan1 $type
- }
- }
- b {
- if {[matchattr $hand nm|OSMA $chan]} {
- set bnick [lindex [split $arg] 2]
- set mask [lindex [split $arg] 2]
- set time [lindex [split $arg] 3]
- set type 1
- set chan1 "$chan"
- set type1 [lindex [split $arg] 3]
- set type2 [lindex [split $arg] 4]
- set reason [join [lrange [split $arg] 4 end]]
- set handle [nick2hand $bnick]
- if {[string match -nocase "global" $type1] || [string match -nocase "global" $type2] && [matchattr $hand nm|- $chan]} {
- if {[string match -nocase $type1 "global"]} {
- set reason [join [lrange [split $arg] 4 end]]
- }
- if {[string match -nocase $type2 "global"]} {
- set reason [join [lrange [split $arg] 5 end]]
- }
- set list [userlist nm|-]
- foreach user $list {
- set hosts [getuser $user hosts]
- foreach host $hosts {
- if {[string match $mask $host]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- }
- }
- if {[matchattr $handle nm|- $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noban none
- return 0
- }
- if {![regexp {^[0-9]} $time]} {
- set reason [join [lrange [split $arg] 4 end]]
- set time "$black(btime)"
- }
- if {$reason == ""} {set reason1 "(GLOBAL) $black(dfreason)"
- } else { set reason1 "(GLOBAL) $reason" }
- if {[channel get $chan showhandle]} {
- set reason "($hand) $reason1"
- } else { set reason "$reason1"
- }
- if {[isbotnick $bnick]} {
- return 0
- }
- if {![botisop $chan]} {
- blacktools:tell $nick $host $hand $chan $chan1 gl.noop none
- return 0
- }
- if {$mask == "*!*@*"} {
- return 0
- }
- if {[onchan $bnick $chan]} {
- set mask *!*@[lindex [split [getchanhost $bnick $chan] "@"] 1]
- }
- newban $mask $hand $reason $time
- if {$time == "0"} { set reply "Permanent" } else { set reply "$time" }
- blacktools:tell $nick $host $hand $chan $chan1 b.8 "$mask $reply"
- return 0
- }
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $bnick] && [matchattr $hand nm|- $chan]} {
- set chan "$bnick"
- set bnick [lindex [split $arg] 3]
- set mask [lindex [split $arg] 3]
- set time [lindex [split $arg] 4]
- set reason [join [lrange [split $arg] 5 end]]
- if {![regexp {^[0-9]} $time]} {
- set reason [join [lrange [split $arg] 4 end]]
- set time "$black(btime)"
- }
- }
- if {![regexp {^[0-9]} $time]} {
- set reason [join [lrange [split $arg] 3 end]]
- set time "$black(btime)"
- }
- b:local $bnick $mask $time $nick $reason $hand $host $chan $chan1 $type
- }
- }
- n {
- if {[matchattr $hand nm|OSMA $chan]} {
- set bnick [lindex [split $arg] 2]
- set type 1
- set handle [nick2hand $bnick]
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $bnick] && [matchattr $hand nm|- $chan]} {
- set chan "$bnick"
- set bnick [lindex [split $arg] 3]
- }
- n:process $bnick $nick $hand $host $chan $chan1 $type
- }
- }
- gag {
- if {[matchattr $hand nm|OSMA $chan]} {
- set gagger [lindex [split $arg] 2]
- set type 1
- set handle [nick2hand $gagger]
- set chan1 "$chan"
- foreach c [channels] {
- set backchan [channel get $c backchan]
- if {[string match -nocase $chan $backchan] && [channel get $c chanreport]} {
- set chan "$c"
- }
- }
- if {[regexp {^[\\+!#&]} $gagger] && [matchattr $hand nm|- $chan]} {
- set chan "$gagger"
- set gagger [lindex [split $arg] 3]
- }
- gag:process $gagger $nick $hand $host $chan $chan1 $type
- }
- }
- l {
- if {[matchattr $hand nm|OSMA $chan]} {
- set times [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $times] && [matchattr $hand nm|- $chan]} {
- set chan "$times"
- set times [lindex [split $arg] 3]
- }
- l:process $nick $host $hand $chan $chan1 $times $type
- }
- }
- ul {
- if {[matchattr $hand nm|OSMA $chan]} {
- set c [lindex [split $arg] 0]
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- }
- ul:process $nick $host $hand $chan $chan1
- }
- }
- show {
- if {[matchattr $hand nm|OSMA $chan]} {
- set wich [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[#&]} $wich] && [matchattr $hand nm|- $chan]} {
- set chan "$wich"
- set wich [lindex [split $arg] 3]
- }
- show:process $nick $host $hand $chan $chan1 $wich $type
- }
- }
- reset {
- if {[matchattr $hand nm|M $chan]} {
- set dece [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[#&]} $dece] && [matchattr $hand nm|- $chan]} {
- set chan "$dece"
- set dece [lindex [split $arg] 3]
- }
- reset:process $nick $host $hand $chan $chan1 $dece $type
- }
- }
- clonescan {
- if {[matchattr $hand nm|M $chan]} {
- set c [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- }
- scanner:process $nick $host $hand $chan $chan1
- }
- }
- top {
- if {[matchattr $hand nm|AOSM $chan]} {
- set cmd [lindex [split $arg] 2]
- set del [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[#&]} $cmd] && [matchattr $hand nm|- $chan]} {
- set chan "$cmd"
- set cmd [lindex [split $arg] 3]
- set del [lindex [split $arg] 3]
- }
- top:process $nick $host $hand $chan $chan1 $cmd $type $del
- }
- }
- banlist {
- if {[matchattr $hand nm|AOSM $chan]} {
- set user [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- if {[regexp {^[\\+!#&]} $user] && [matchattr $hand nm|- $chan]} {
- set chan "$user"
- set user [lindex [split $arg] 3]
- }
- banlist:process $nick $host $hand $chan $chan1 $user $type
- }
- }
- stats {
- if {[matchattr $hand nm|AOSM $chan]} {
- set chan1 "$chan"
- set c [lindex [split $arg] 2]
- if {[regexp {^[#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- }
- stats:process $nick $host $hand $chan $chan1
- }
- }
- myset {
- if {[matchattr $hand nm|VAOSM $chan]} {
- set chan1 "$chan"
- set flags [lindex [split $arg] 2]
- set type [lindex [split $arg] 3]
- if {$type == ""} {
- blacktools:tell $nick $host $hand $chan $chan1 myset.4 none
- return 0
- }
- myset:process $nick $host $hand $chan $chan1 $flags $type
- }
- }
- i {
- if {[matchattr $hand nm|VAOSM $chan]} {
- set type 1
- set chan1 "$chan"
- set inick [lrange [split $arg] 2 end]
- set c [lindex [split $arg] 2]
- if {[regexp {^[\\+!#&]} $c] && [matchattr $hand nm|- $chan]} {
- set chan "$c"
- set inick [join [lrange [split $arg] 3 end]]
- }
- i:process $nick $host $hand $chan $chan1 $inick $type
- }
- }
- addinfo {
- if {[matchattr $hand nm|VAOSM $chan]} {
- set info [join [lrange [split $arg] 2 end]]
- set chan1 "$chan"
- if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
- return 0
- }
- if {$info == ""} {
- blacktools:tell $nick $host $hand $chan $chan1 addinfo.2 none
- return 0
- }
- addinfo:process $nick $host $hand $chan $chan1 $info
- }
- }
- badword {
- if {[matchattr $hand nm|M $chan]} {
- set why [lindex [split $arg] 2]
- set type 1
- set chan1 "$chan"
- set bdword [lrange [split $arg] 3 end]
- set bdnumber [lindex [split $arg] 3]
- if {[regexp {^[\\+!#&]} $why] && [matchattr $hand nm|- $chan]} {
- set chan "$why"
- set why [lindex [split $arg] 3]
- set bdnumber [lindex [split $arg] 4]
- set bdword [lrange [split $arg] 4 end]
- }
- antibadword:command:process $nick $host $hand $chan $chan1 $why $bdword $bdnumber $type
- }
- }
- }
- }
- }
- putlog "$black(name) $black(vers) by $black(author) Loaded -> BLaCkShaDoW ProductionS ®"
|