123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #!/bin/bash
- db="/var/lib/isso/comments.db"
- jid=""
- dir="~/.comentarios/"
- web=""
- cd "$dir"
- if [[ -e "comentarios" ]];
- then
-
- sqlite3 -line $db "select * from threads;" > comentarios_temporal
-
- if [[ $(wc -l comentarios_temporal | cut -d' ' -f1) -lt $(wc -l comentarios | cut -d' ' -f1) ]];
- then
- cp comentarios_temporal comentarios
- exit 1
- fi
-
- ids=$(diff comentarios comentarios_temporal | grep ">"| grep tid | cut -d'=' -f2 | sed "s/ //")
- if [[ -n "$ids" ]];
- then
- for id in `echo $ids`;
- do
- echo "Nuevo comentario en: " > mensaje
- sqlite3 -line $db "select title from threads where id = $id;" | grep title | cut -d'=' -f2 | sed "s/ //" | sed "s/+/ /g" >> mensaje
- echo "$web$(sqlite3 -line $db "select uri from threads where id = $id;" | cut -d'=' -f2 | sed 's/ //')" >> mensaje
- torify /usr/local/bin/sendxmpp mensaje $jid
- done
- cp comentarios_temporal comentarios
- fi
- else
- sqlite3 -line $db "select * from threads;" > comentarios
- fi
|