Gestion de bnc en dialog

Contenu du snippet

Voici un chti addon asser utile qui permet de controler plusieur bnc à la fois
Gesion d'utilisateurs et ajout/modification de serveurs en dialog :ppp
Voila tout ça en socket !
Commandes:
^join #channel
^part #channel
^msg #channel
^raw raw ...

Source / Exemple :


menu channel {

    • Gestion BNC**:/dialog -m GBNC GBNC
} dialog GBNC { title "Gestion BNC" size -1 -1 146 118 option dbu tab "Serveurs BNC", 3, 1 1 143 104 list 5, 5 20 59 81, tab 3 size vsbar box "Configuration", 6, 65 17 76 84, disable tab 3 text "Serveur: (serveur:port)", 7, 69 25 61 8, tab 3 edit "", 8, 68 34 68 10, tab 3 autohs limit 200 text "Ident:", 9, 69 45 16 8, tab 3 edit "", 10, 68 53 68 10, tab 3 autohs limit 200 text "Password:", 11, 69 64 26 8, tab 3 edit "", 12, 68 73 68 10, tab 3 autohs limit 200 button "Ajouter", 13, 67 85 21 12, tab 3 button "Supprimer", 16, 112 85 27 12, tab 3 button "Modifier", 25, 89 85 22 12, tab 3 tab "Utilisateurs", 14 list 15, 6 18 59 74, tab 14 size vsbar box "Configuration", 17, 66 17 76 68, disable tab 14 text "Nom d'utilisateur:", 18, 71 25 44 8, tab 14 edit "", 19, 71 35 65 10, tab 14 autohs limit 200 text "Mot de passe:", 20, 71 47 35 8, tab 14 edit "", 21, 71 56 65 10, tab 14 autohs limit 200 button "Ajouter", 22, 68 69 21 12, tab 14 button "Supprimer", 23, 113 69 27 12, tab 14 button "Modifier", 24, 90 69 22 12, tab 14 button "Connecter", 26, 74 90 30 12, tab 14 button "Déconnecter", 27, 106 90 34 12, tab 14 check "Anti Idle", 28, 7 93 33 10, tab 14 tab "Debug", 29 text "Glob. cmd:", 31, 3 94 27 8, tab 29 edit "PRIVMSG #channel :message", 32, 31 93 81 10, tab 29 autohs button "Ok", 33, 113 92 12 12, tab 29 button "Clear", 34, 126 92 17 12, tab 29 edit "", 35, 3 18 138 72, tab 29 read multi autohs autovs vsbar link "Gestion de BouNCer by win - www.warriorhouse.net", 4, 8 108 128 8 } on *:dialog:GBNC:init:0:{ if (!%aidle) set %aidle non var %i 1 while ($read(Gserv.win,%i)) { did -a GBNC 5 $gettok($read(Gserv.win,%i),1,32) | inc %i } var %i 1 while ($read(Guser.win,%i)) { did -a GBNC 15 $gettok($read(Guser.win,%i),1,32) | inc %i } dialog -t GBNC Gestion de BNC, $sock(GBNC_*,0) BNC Online. if ($sock(GBNC_*,0) < 1) { did -b GBNC 27,33,32 | did -e GBNC 26,28 } else { did -e GBNC 27,33,32 | did -b GBNC 26,28 } if (%aidle = oui) did -c GBNC 28 did -h GBNC 24,25 } on *:dialog:GBNC:SClick:*:{ if ($did = 4) run http://www.warriorhouse.net elseif ($did = 5) { var %i $did(GBNC,5).sel did -o GBNC 8 1 $gettok($read(Gserv.win,%i),1,32) did -o GBNC 10 1 $gettok($read(Gserv.win,%i),3-,32) did -o GBNC 12 1 $gettok($read(Gserv.win,%i),2,32) } elseif ($did = 13) { if (($did(GBNC,8)) && ($did(GBNC,10)) && ($did(GBNC,12))) { if ($chr(58) isin $did(GBNC,8)) { did -a GBNC 5 $did(GBNC,8) write Gserv.win $did(GBNC,8) $did(GBNC,12) $did(GBNC,10) } else var %i $input(Syntaxe: serveur:port,o,Erreur!) } } elseif ($did = 15) { var %i $did(GBNC,15).sel did -o GBNC 19 1 $gettok($read(Guser.win,%i),1,32) did -o GBNC 21 1 $gettok($read(Guser.win,%i),2-,32) } elseif ($did = 16) { if (!$did(GBNC,5).sel) halt did -d GBNC 5 $did(GBNC,5).sel write -dl $+ $did(GBNC,5).sel Gserv.win } elseif ($did = 22) { if (($did(GBNC,19)) && ($did(GBNC,21))) { write Guser.win $did(GBNC,19) $did(GBNC,21) did -a GBNC 15 $did(GBNC,19) } } elseif ($did = 23) { if (!$did(GBNC,15).sel) halt did -d GBNC 15 $did(GBNC,15).sel write -dl $+ $did(GBNC,15).sel Guser.win } elseif ($did = 24) { if (($did(GBNC,19)) && ($did(GBNC,21)) && ($did(GBNC,15).sel)) { did -o GBNC 15 $did(GBNC,15).sel $did(GBNC,19) write -l $+ $did(GBNC,15).sel Guser.win $did(GBNC,19) $did(GBNC,21) } } elseif ($did = 25) { if (($did(GBNC,8)) && ($did(GBNC,10)) && ($did(GBNC,12)) && ($did(GBNC,5).sel)) { did -o GBNC 5 $did(GBNC,5).sel $did(GBNC,8) write -l $+ $did(GBNC,5).sel Gserv.win $did(GBNC,8) $did(GBNC,12) $did(GBNC,10) } } elseif ($did = 26) { var %i 1 while (%i <= $lines(Gserv.win)) { .timer 1 2 sockopen GBNC_ $+ %i $gettok($read(Gserv.win,%i),1,58) $gettok($read(Gserv.win,%i),2,58) inc %i } } elseif ($did = 27) { GBNC.send GBNC_* QUIT | did -b GBNC 27,33,32 | did -e GBNC 26,28 } elseif ($did = 28) set %aidle $iif($did(GBNC,28).state,oui,non) elseif ($did = 33) { if ($did(GBNC,32).text) GBNC.send GBNC_* $did(GBNC,32).text } elseif ($did = 34) did -r GBNC 35 } on *:SOCKOPEN:GBNC_*:{ var %nbr $right($sockname,$calc($len($sockname)-5)) GBNC.send $sockname PASS $gettok($read(Gserv.win,%nbr),2,32) GBNC.send $sockname NICK $gettok($read(Gserv.win,%nbr),3,32) $+ `BNC $+ %nbr GBNC.send $sockname USER $gettok($read(Gserv.win,%nbr),3,32) " $+ $gettok($read(Gserv.win,%nbr),3,32) $+ " " $+ $gettok($read(Gserv.win,%nbr),1,58) $+ " :4Gestion BNC by win - #^warriorhouse^ @ Qnet GBNC.send $sockname SETUSERNAME 4Gestion BNC by win - #^warriorhouse^ @ Qnet GBNC.send $sockname AIDLE $iif(%aidle = oui,1,0) if ($dialog(GBNC)) { dialog -t GBNC Gestion de BNC, $sock(GBNC_*,0) BNC Online. did -e GBNC 27,32,33 did -b GBNC 26,28 } } on *:SOCKREAD:GBNC_*:{ if ($sockerr > 0) halt sockread %temp if (!%temp) halt if ($dialog(GBNC)) did -i GBNC 35 $did(GBNC,35).lines <- %temp if ($gettok(%temp,2,32) = PRIVMSG) { var %message $gettok(%temp,2-,58),%nick $gettok($gettok(%temp,1,33),1,58),%host $gettok($gettok($gettok(%temp,2,64),1,58),1,32) if ($level(*!*@ $+ %host) == GBNC) { if ($gettok(%message,1,32) == ^join) GBNC.send $sockname JOIN $gettok(%message,2-,32) elseif ($gettok(%message,1,32) == ^part) GBNC.send $sockname PART $gettok(%message,2-,32) elseif ($gettok(%message,1,32) == ^msg) GBNC.send $sockname PRIVMSG $gettok(%message,2,32) : $+ $gettok(%message,3-,32) elseif ($gettok(%message,1,32) == ^nick) GBNC.send $sockname NICK $gettok(%message,2,32) elseif ($gettok(%message,1,32) == ^raw) GBNC.send $sockname $gettok(%message,2-,32) } else { if ($gettok(%message,1,32) == AUTH) { var %i 1 while (%i <= $lines(Guser.win)) { if ($gettok($read(Guser.win,%i),1,32) == $gettok(%message,2,32) && $gettok($read(Guser.win,%i),2,32) == $gettok(%message,3,32)) { .auser GBNC *!*@ $+ %host | GBNC.send $sockname NOTICE %nick :vous êtes maintenant identifié ! | halt } inc %i } } } } unset %temp } alias GBNC.send { if ($sock($1)) sockwrite -n $1 $2- if ($dialog(GBNC)) did -i GBNC 35 $did(GBNC,35).lines -> $2- }

Conclusion :


Bon voila donc pour charger le script: /load -rs nomduscript
pour ouvrir le dialog: click droit: **Gestion BNC**
et pour vous identifier (apres vous être ajouté dans les user) :
/msg NomDuBnc AUTH login pass

voilouuuu chez moi ça marche parfaitement avec 3bnc!
    • news:

possibilité d'envoyer un message global via le dialog
fenetre debug
case anti idle.
bug pour + de 5bnc résolu!
    • bugs:

Pb pour modifier les bnc et les user quand il y en a plus qu'un (si qq1 vois où est le probleme (enlever la ligne "did -h GBNC 24,25"))

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.