rajout des fonctions de sauvegarde du message et d'dition
darcs-hash:20020125075449-a279a-2f37ccc1723499ac82d7da6d79d1d5ce0e9e0f7c.gz
This commit is contained in:
parent
e441343421
commit
9db7828e41
1 changed files with 77 additions and 16 deletions
93
news-cancel
93
news-cancel
|
@ -6,11 +6,56 @@
|
|||
## Login stransky <stransky@crans.org>
|
||||
##
|
||||
## Started on dim 13 jan 2002 02:30:56 CET Nicolas STRANSKY
|
||||
## Last update dim 13 jan 2002 11:52:27 CET Nicolas STRANSKY
|
||||
## Last update ven 25 jan 2002 08:53:48 CET Nicolas STRANSKY
|
||||
##
|
||||
## Script pour annuler un message de news.
|
||||
## Script pour annuler ou modérer un message de news.
|
||||
#
|
||||
# TODO : implémenter la possibilité de définir le message par un NG et un numéro.
|
||||
|
||||
|
||||
VERIF () {
|
||||
ligne=`grep --binary-files=text " "$1" " /var/spool/news/overview/OV1 | head -n 1 | awk -F "\t" '{print $1"~"$2"~"$3"~"$9}'`
|
||||
numero=`echo $ligne | awk -F "~" '{print $1}'`
|
||||
auteur=`echo $ligne | awk -F "~" '{print $3}'`
|
||||
titre=`echo $ligne | awk -F "~" '{print $2}'`
|
||||
newsgroup=`echo $ligne | awk -F "~" '{print $4}' | awk '{print $3}' | awk -F : '{print $1}'`
|
||||
echo "il s'agit du message $titre, numéro $numero, posté par $auteur dans $newsgroup"
|
||||
echo ""
|
||||
echo -n "exact ? [o/n] "
|
||||
read confirmation
|
||||
case $confirmation in
|
||||
o*|O*)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "on ne fait rien"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
SAUVEGARDE () {
|
||||
echo "sauvegarde du mail dans /root/moderes/ ? [o/n] "
|
||||
read reponse
|
||||
case $reponse in
|
||||
o*|O*)
|
||||
rep=`echo $newsgroup | sed 's/\./\//g'`
|
||||
cp /var/spool/news/articles/$rep/$numero /root/moderes/$newsgroup'.'$numero
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "on ne fait rien"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
EDITION () {
|
||||
$EDITOR /var/spool/news/articles/$rep/$numero
|
||||
}
|
||||
|
||||
CANCEL () {
|
||||
echo -n 'throttling inn... '
|
||||
/bin/su - news -c "/usr/lib/news/bin/ctlinnd throttle 'article canceling'"
|
||||
|
@ -23,17 +68,33 @@ CANCEL () {
|
|||
}
|
||||
|
||||
|
||||
case $1 in
|
||||
\<*\>)
|
||||
if [[ "X$UID" == "X0" ]]
|
||||
then
|
||||
CANCEL \'$1\'
|
||||
else
|
||||
echo "You must be root to launch this command."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "usage : news-cancel '<Message-ID>'"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "X$UID" == "X0" ]]
|
||||
then
|
||||
case $1 in
|
||||
\<*@*\>)
|
||||
VERIF $1
|
||||
SAUVEGARDE
|
||||
echo "edition ou annulation du message ? [E/A] "
|
||||
read action
|
||||
case $action in
|
||||
e*|E*)
|
||||
EDITION
|
||||
;;
|
||||
a*|A*)
|
||||
CANCEL \'$1\'
|
||||
;;
|
||||
*)
|
||||
echo "attention, il n'y a eu ni édition ni annulation. relancer le script"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "usage : news-cancel '<Message-ID>'"
|
||||
;;
|
||||
esac
|
||||
|
||||
else
|
||||
echo "You must be root to launch this command."
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue