Antipv + gestion messages par fichier

Description

bon voila.. cet antipv :
- vous permet d'enregistrer ou pas le message de votre interlocuteur (configurable)
- vous permet de lire le message dans la fenetre active et enregistre ce message dans un fichier texte.
- vous permet de supprimer ou pas les messages précedents. (configurable)
(mis à jour suivant les indication de Kolibot (merci a toa) )

- mise à jour : ajout de la 'date 'effacement (01/01/2004)

Source / Exemple :


on *:LOAD:{ echo -a 4 vous venez de loader antiPV par SeigneurCarpe - Auteur de %version ! 10  visitez le site: http://www.onlyu.fr.st }
on *:UNLOAD:{ echo -a 4 vous venez de déloader antiPV par SeigneurCarpe - Auteur de %version ! 10  visitez le site: http://www.onlyu.fr.st }

dialog antipv {
  title AntiPV par SeigneurCarpe
  size -1 -1 277 183
  option dbu
  text "Que faire lorsque vous recevez un PV ?", 2, 85 4 98 8
  check "Fermer le PV", 3, 21 14 50 10
  check "Envoyer un message automatique", 4, 170 14 99 10
  text "Message envoyé si fermeture du pv : ", 5, 5 36 95 8
  edit %pv.fermé.msg, 6, 5 45 182 11
  radio "Activer les fonctions de l'antipv", 7, 145 130 93 10
  radio "Désactiver les fonctions de l'antipv", 8, 145 141 95 10
  button "&Fermer", 9, 136 159 49 20, flat multi ok
  check " Enregistrement des messages", 10, 6 130 104 10
  button "&Lire les msg", 14, 80 159 49 20, flat
  check "supprimer les messages après lecture", 15, 6 140 104 10
  text "Message envoyé si non fermeture du pv", 17, 5 80 100 8
  edit %pv.ouvert.msg, 18, 6 90 180 12
  edit %sonF, 19, 188 45 84 11, autohs
  edit %sonO, 20, 188 90 82 11
  button "&Parcourir ...", 21, 189 60 47 15
  link "http://www.onlyu.fr.st", 23, 20 163 56 8
  icon 24, 3 158 15 15,  icones\cs.ico, 0
  button "P&arcourir", 22, 190 105 47 15
  icon 11, 238 105 15 15,  icones\Lire.ico, 0, noborder
  icon 13, 254 105 15 15,  icones\stop2.ico, 0, noborder
  icon 25, 257 60 15 15,  icones\stop2.ico, 0, noborder
  icon 26, 239 60 15 15,  icones\Lire.ico, 0, noborder
  box "", 27, 1 123 137 32
  text "Son à jouer lors de la fermeture :", 28, 190 36 80 8
  text "Son à jouer lors de l'ouverture du PV", 29, 185 80 88 8
  box "", 30, 137 123 140 32
  box "", 1, 3 0 272 29
  box "", 12, 81 0 102 13
  icon 16, 254 161 15 15,  images\aide.jpg, 0
  text "De l'Aide ? cliquez ici --->", 31, 192 166 61 8
}

on *:dialog:antipv:*:*:{
  if ($devent == edit) {
    if ($did == 6) { set %pv.fermé.msg $did(6).text }
    if ($did == 18) { set %pv.ouvert.msg $did(18).text }
  }

  if ($devent == sclick) {
    if ($did == 14) { 
      if (%enregmsg == on && $exists(antipv.txt) == $true) { Lecture.fichier.pv }
      if (%enregmsg == on && $exists(antipv.txt) == $false) { set %message problème : le fichier antipv.txt est inexistant ! | Attention }
      if (%enregmsg == off && $exists(antipv.txt) == $true) { set %message fichier vide car pas d'enregstrement enregistré | Attention }
      if (%enregmsg == on && $exists(antipv.txt) == $false) { set %message le fichier antipv.txt est inexistant ou vide ! | Attention }
      if (%suppr == on &&  $exists(antipv.txt) == $true) { Effacement.fichier.pv }
      if (%suppr == on &&  $exists(antipv.txt) == $false) { set %message le fichier antipv.txt est inexistant ! | Attention }
    }
    if ($did == 23) { URL }
    if ($did == 16) { antipvread }
    if ($did(10).state == 1) { %enregmsg = on }
    if ($did(10).state == 0) { %enregmsg = off }
    if ($did(3).state == 1) { set %antipvclose on } 
    if ($did(3).state == 0) { set %antipvclose off }
    if ($did(7).state == 1) { enable #antipv }
    if ($did(8).state == 1) { disable #antipv }
    if ($did(4).state == 1) { %antipvmess = on }
    if ($did(4).state == 0) { %antipvmess = off }
    if ($did(15).state == 1) { %suppr = on }
    if ($did(15).state == 0) { %suppr = off } 

    if ($did == 22) { set %sonO $dir="Choisis un fichier WAV à jouer:" [ c:\ $+ *.wav ] | did -ra Antipv 20 %sonO  }
    if ($did == 11) { did -g Antipv 11 icones\lire2.ico | did -g Antipv 13 icones\stop.ico | splay %sonO }
    if ($did == 13) { did -g Antipv 13 icones\stop2.ico | did -g Antipv 11 icones\lire.ico | splay stop }

    if ($did == 21) { set %sonF $dir="Choisis un fichier WAV à jouer:" [ c:\ $+ *.wav ] | did -ra Antipv 19 %sonF  }
    if ($did == 26) { did -g Antipv 26 icones\lire2.ico | did -g Antipv 25 icones\stop.ico | splay %sonF }
    if ($did == 25) { did -g Antipv 25 icones\stop2.ico | did -g Antipv 26 icones\lire.ico | splay stop }
  }

  if ($devent == init) {
    did -e Antipv 16, 23
    if (%pv.fermé.msg) { did -ra antipv 6 %pv.fermé.msg }
    if (%pv.ouvert.msg) { did -ra antipv 18 %pv.ouvert.msg }
    if ($did(4).enabled == $true) { did -n antipv 6 }
    if ($group(#antipv) == on) { did -c antipv 7 }
    if ($group(#antipv) == off) { did -c antipv 8 }
    if (%antipvmess == on ) { did -c antipv 4 }
    if (%antipvmess == off) { did -u antipv 4 }

    if (%antipvclose == on) { did -c antipv 3 }
    if (%antipvclose == off) { did -u antipv 3 }

    if (%enregmsg == on) { did -c antipv 10 }

    if (%suppr == on) { did -c antipv 15 }
    if (%suppr == off) { did -u antipv 15 }    
  }
}

#antipv on
On 1:OPEN:?:{ 
  if (%antipvclose == on) {
    if (%sonF != $null) { splay %sonF }
    if (%enregmsg == on) { 
      write -l2 antipv.txt ----------------------------------------------
      set %nickpv $nick
      set %11 $1-
      set %len $lines(antipv.txt)
      inc %len
      write -il $+ %len antipv.txt Le $date à $timestamp $nick a dit : 4  %11
    } 
    if (%antipvmess == on) { msg $nick %pv.fermé.msg }
    close -m $nick
  }

  if (%antipvclose == off) { 
    set %enregmsg off
    if (%sonO != $null) { splay %sonO }
    if (%antipvmess == on) { msg $nick %pv.ouvert.msg }
  }
}
#antipv end

;### ALIASES ####

Alias Effacement.fichier.pv {
  write -c antipv.txt EFFACEMENT DU FICHIER le $date à $timestamp
  write -l2 antipv.txt ----------------------------------------------
}

Alias Lecture.fichier.pv {
  var %lirenum $lines(antipv.txt)
  var %lecturecompteur 0
  while ( %lecturecompteur < %lirenum) { 
    inc %lecturecompteur 
    echo -a $read(antipv.txt,%lecturecompteur)
  }
}

Conclusion :


pour tout reports de bugs : webmaster@onlyu.fr.St

Codes Sources

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.