"mail script"

Contenu du snippet

voila une petite interface pour memoserv, c moche et tres mal scripter mais comme auj jenvoi la plupart de mes productions ....

Source / Exemple :


;{#}-----------------------------------------------[ALIAS]---------------------------------------------{#}

alias -l d {
  if ($dialog($1).title) {
    dialog -x $1
  }
  dialog -md $1 $1
}
alias mail.get.msgs {
  var %i 1 
  while (%i <= $hget(tmail,memo)) {
    .msg MemoServ read %i
    inc %i
  }
}
alias mail.get.list {
  if ($hget(mail,0).item != 0) {
    var %i 1
    while ( %i <= $hget(tmail,memo) ) {
      did -o $1 $2 %i $gettok($hget($3,$hget($3,%i).item),1,1) : $gettok($hget(mail,$hget($3,%i).item),2,1) ( $+ $gettok($hget(mail,$hget($3,%i).item),3,1) $+ )
      inc %i
    }
  }
}
alias hlist {
  var %i 1
  while ( %i <= $hget($3,0).item ) {
    if ($hget($3,%i).item !isin $4-) {
      did -a $1 $2 $hget($3,%i).item
    }
    inc %i
  }
}
alias mail.del.all {
  did -r mail 7
  var %mail.del.all = $hget(tmail,memo)
  while (%mail.del.all > 0) {
    hdel mail $hget(mail,%mail.del.all).item
    did -d mail 8 %mail.del.all
    .msg MemoServ del %mail.del.all
    dec %mail.del.all
  }
}

;{#}-----------------------------------------------[MENU]----------------------------------------------{#}

menu channel {
  Mail_Script:d mail
}

;{#}----------------------------------------------[DIALOGS]--------------------------------------------{#}

dialog mail {
  title "           --=={#}[Mail_Script]{#}==--"
  size -1 -1 177 106
  option dbu
  tab "Boite de réception", 1, 0 0 178 106
  list 8, 8 26 130 30, tab 1 size
  box "      Mail      ", 9, 5 60 168 34, tab 1
  box "      Mails list      ", 18, 4 18 169 41, tab 1
  box "", 6, 8 15 38 10, tab 1
  box "", 19, 9 57 29 10, tab 1
  edit "", 7, 9 68 159 23, tab 1 read multi autovs
  button "Actualiser", 32, 140 25 30 11, tab 1
  button "Supprimer", 33, 140 36 30 11, tab 1
  button "Vider", 35, 140 47 30 10, tab 1
  tab "Envoyer un mail", 2
  text "Objet:", 12, 27 47 16 8, tab 2
  text "Message:", 13, 19 57 25 8, tab 2
  edit "", 15, 44 31 95 10, tab 2
  text "Destinataire:", 16, 12 32 32 8, tab 2
  box "       Envoyer un mail       ", 17, 6 19 168 75, tab 2
  edit "", 11, 44 46 124 10, tab 2 return limit 50
  edit "", 27, 44 56 124 27, tab 2 multi autovs
  button "Envoyer", 34, 135 83 37 10, tab 2
  button "Friend", 5, 142 31 26 10, tab 2
  box "", 10, 10 16 61 10, tab 2
  tab "Friend list", 3
  list 20, 5 27 57 67, tab 3 size
  box "     Nicks    ", 21, 2 19 63 79, tab 3
  button "Ajouter", 22, 67 61 37 11, tab 3
  button "Supprimer", 23, 67 72 37 11, tab 3
  edit "", 26, 69 27 102 30, tab 3 multi autovs
  box "     Commentaire      ", 24, 66 19 109 41, tab 3
  button "Modifier", 28, 67 83 37 11, tab 3
  button "Changer", 31, 135 61 37 11, tab 3
  box "", 14, 6 16 27 10, tab 3
  box "", 29, 70 16 50 10, tab 3
  tab "Options", 25
  check "Verification des nouveaux mails à la connection", 36, 14 26 128 10, tab 25
  check "Lancement automatique à la connection", 37, 14 40 119 10, tab 25
  check "Alerte lors de reception de nouveaux messages", 38, 14 54 134 10, tab 25
  button "Quiter", 4, 122 95 55 11, flat
  text "..:::Mail_Script© by Beyond_The_Grave:::..", 30, 6 98 114 7
}
dialog mail.nickadd {
  title "Mail_Script - Nick list"
  size -1 -1 119 40
  option dbu
  button "Ajouter", 1, 20 29 37 11
  button "Fermer", 2, 62 29 37 11
  text "Nick :", 3, 25 3 15 8
  edit "", 4, 38 1 61 10, multi
  text "Commentaires :", 5, 0 11 39 8
  edit "", 6, 38 12 80 17, multi
}
dialog mail.friend {
  title "Mail_Script - Friend"
  size -1 -1 88 75
  option dbu
  list 1, 3 9 58 63, size
  button "OK", 2, 62 15 24 12
  button "Annuler", 3, 62 28 24 12
  box "Friend list", 4, 16 1 33 6
}
dialog mail.send.error {
  title "Mail_Script - Error"
  size -1 -1 111 23
  option dbu
  text "Vous n'avez pas remplis tout les champs", 1, 7 2 101 8
  button "OK", 2, 37 11 37 11
}
dialog mail.newmsg {
  title "Mail_Script - NewMsg"
  size -1 -1 111 15
  option dbu
  text "Recherche de nouveaux messages ...", 1, 8 4 92 8
}
dialog mail.send.confirm {
  title "Mail_Script - Confirm"
  size -1 -1 111 23
  option dbu
  text "Votre message a bien été envoyé", 1, 15 2 101 8
  button "OK", 2, 37 11 37 11
}
dialog mail.newmsg.alert {
  title "Mail_Script - Alerte"
  size -1 -1 111 23
  option dbu
  text "Vous venez de recevoir 1 nouveau message", 1, 8 2 92 8
  button "OK", 2, 37 11 37 11
}
dialog mail.ident.off {
  title "Mail_Script - Error"
  size -1 -1 90 23
  option dbu
  text "Vous n'êtes pas identifié(e)", 1, 12 2 92 8
  button "OK", 2, 27 11 37 11
}
dialog mail.newmsg.off {
  title "Mail_Script - NewMsg"
  size -1 -1 90 23
  option dbu
  text "Aucun nouveaux messages", 1, 13 2 92 8
  button "OK", 2, 27 11 37 11
}

;{#}-------------------------------------------[SCRIPT-Notice]-----------------------------------------{#}

on *:notice:*:*:{
  if ($nick == MemoServ) {
    if (Vous avez actuellement isin $1-) {
      hadd -m tmail memo $strip($4)
    }
    if (authentification par mot de passe est requise pour cette commande isin $1-) {
      dialog -ma mail.ident.off mail.ident.off
    }
    if ($1 == memo) {
      hadd -mu10 tmail tmp $strip($2)
    }
    if ((avez aucun memo isin $1-) || (avez pas de memos isin $1-)) {
      dialog -ma mail.newmsg.off mail.newmsg.off
    }
    if ($1 == $chr(165)) {
      var %mail.ntc.name mailn $+ $hget(tmail,tmp)
      hadd -m mail %mail.ntc.name $2-
    }
  }
  if (($1 == $chr(165)) && ($nick != MemoServ) && ($0 < 2)) {
    if ($hget(tmail,autoalrt) == 1) {
      dialog -md mail.newmsg.alert mail.newmsg.alert
    }
    halt
  }
}

;{#}-------------------------------------------[SCRIPT-Dialog]-----------------------------------------{#}

on *:dialog:*:*:*: {
  if ($dname == mail) {
    if ($devent == init) {
      if ($hget(mail,0).item != 0) mail.get.list mail 8 mail
      if (($exists(mailnicks.htable)) && (!$hget(mail.nicks))) { hmake mail.nicks 10 | hload mail.nicks mailnicks.htable }
      if (($exists(mailconfg.htable)) && (!$hget(tmail))) { hmake tmail 10 | hload tmail mailconfg.htable }
      hlist mail 20 mail.nicks
      if ($hget(tmail,autonew) == 1) did -c mail 36
      if ($hget(tmail,autoconn) == 1) did -c mail 37
      if ($hget(tmail,autoalrt) == 1) did -c mail 38
    }
    if ($devent == close) { 
      hsave tmail mailconfg.htable
      hsave mail.nicks mailnicks.htable
    }
    if ($devent == sclick) {
      if ($did == 4) {
        dialog -c mail
      }
      if ($did == 5) {
        dialog -ma mail.friend mail.friend
      }
      if ($did == 8) {
        if ($did(8).seltext == $null) did -r mail 7
        did -ra mail 7 $gettok($hget(mail,$hget(mail,$did(8).sel).item),4,1)
      }
      if ($did == 20) {
        if ($did(20).seltext == $null) did -r mail 26
        did -ra mail 26 $hget(mail.nicks,$did(20).seltext)
      }
      if ($did == 22) {
        dialog -ma mail.nickadd mail.nickadd
      }
      if ($did == 23) {
        hdel mail.nicks $did(20).seltext
        did -d mail 20 $did(20).sel
        did -r mail 26
      }
      if ($did == 28) {
        var %mail.line $did(mail,20).sel
        var %mail.request $?="Renommer $did(20).seltext en ?"
        if (%mail.request != $null) {
          hadd -m mail.nicks %mail.request $hget(mail.nicks,$did(mail,20).seltext)
          hdel mail.nicks $did(mail,20).seltext
          did -d mail 20 %mail.line
          did -i mail 20 %mail.line %mail.request
        }
      }
      if ($did == 31) {
        hadd -m mail.nicks $did(mail,20).seltext $did(mail,26).text
      }
      if ($did == 32) {
        .msg MemoServ info
        .timer 1 1 mail.get.msgs
        .timer 1 3 mail.get.list mail 8 mail
      }
      if ($did == 33) {
        var %mail.del.line = $did(mail,8).sel
        hdel mail $hget(mail,%mail.del.line).item
        did -d mail 8 %mail.del.line
        did -r mail 7
        .msg MemoServ del %mail.del.line
      }
      if ($did == 34) {
        if (($did(mail,15).text) && ($did(mail,11).text) && ($did(mail,27).text)) {
          .msg MemoServ send $did(mail,15).text $chr(165) $me $+ $chr(1) $+ $did(mail,11).text $+ $chr(1) $+ $asctime(HH:nn) $+ $chr(124) $+ $asctime(dd/mm) $+ $chr(1) $+ $did(mail,27).text
          .notice $did(mail,15).text $chr(165)
          dialog -ma mail.send.confirm mail.send.confirm          
          did -r mail 15
          did -r mail 11
          did -r mail 27
        }
        else dialog -ma mail.send.error mail.send.error
      }
      if ($did == 35) {
        mail.del.all
      }
      if ($did == 36) {
        hadd -m tmail autonew $did(mail,36).state
        hsave tmail mailconfg.htable
      }
      if ($did == 37) {
        hadd -m tmail autoconn $did(mail,37).state
        hsave tmail mailconfg.htable
      }
      if ($did == 38) {
        hadd -m tmail autoalrt $did(mail,38).state
        hsave tmail mailconfg.htable
      }
    }
    if ($devent == dclick) {
      if ($did == 8) {
        did -f mail 2
        did -ra mail 15 $gettok($hget(mail,$hget(mail,$did(8).sel).item),1,1)
        did -ra mail 11 Re: $+ $gettok($hget(mail,$hget(mail,$did(8).sel).item),2,1)
        did -f mail 27
      }
    }
  }
  if ($dname == mail.nickadd) {
    if ($devent == sclick) {
      if ($did == 1) {
        var %mail.nickadd.nick = $did(mail.nickadd,4).text
        hadd -m mail.nicks %mail.nickadd.nick $did(mail.nickadd,6).text
        hsave mail.nicks mailnicks.htable
        did -a mail 20 %mail.nickadd.nick
        did -r mail.nickadd 4
        did -r mail.nickadd 6
        did -f mail.nickadd 4
      }
      if ($did == 2) {
        dialog -x mail.nickadd
      }
    }
  }
  if ($dname == mail.friend) {
    if ($devent == init) {
      hlist mail.friend 1 mail.nicks
    }
    if ($devent == sclick) {
      if ($did == 2) {
        did -ra mail 15 $did(mail.friend,1).seltext
        dialog -x mail.friend
      }
      if ($did == 3) {
        dialog -c mail.friend
      }
    }
    if ($devent == dclick) {
      if ($did == 1) {
        did -ra mail 15 $did(mail.friend,1).seltext
        dialog -x mail.friend
      }
    }
  }
  if ($dname == mail.send.error) {
    if ($devent == sclick) {
      if ($did == 2) {
        dialog -c mail.send.error
      }
    }
  }
  if ($dname == mail.send.confirm) {
    if ($devent == sclick) {
      if ($did == 2) {
        dialog -c mail.send.confirm
      }
    }
  }
  if ($dname == mail.newmsg.alert) {
    if ($devent == sclick) {
      if ($did == 2) {
        dialog -c mail.newmsg.alert
      }
    }
  }
  if ($dname == mail.ident.off) {
    if ($devent == sclick) {
      if ($did == 2) {
        dialog -c mail.ident.off
      }
    }
  }
  if ($dname == mail.newmsg.off) {
    if ($devent == sclick) {
      if ($did == 2) {
        dialog -c mail.newmsg.off
      }
    }
  }
}

;{#}-------------------------------------------[SCRIPT-Connect]----------------------------------------{#}

on *:connect:{
  if ($hget(tmail,autoconn) == 1) d mail
  if ($hget(tmail,autonew) == 1) {
    .timer -m 1 1 dialog -ma mail.newmsg
    .msg MemoServ info
    .timer 1 1 mail.get.msgs
    .timer 1 3 mail.get.list mail 8 mail
    .timer 1 6 dialog -x mail.newmsg
  }
}
on *:load:{
  scon -a .msg nickserv set language 2
}

Conclusion :


fouillez pas trop dans le script sinon attention aux yeux ! ^^

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.