Review few strings for translations purposes.
[claws.git] / tools / popfile-link.sh
blobf75a3f1d7a674adce3e83ef6f088fe6db5921190
1 #!/usr/bin/env bash
3 # * Copyright 2007 Tristan Chabredier <wwp@claws-mail.org>
4 # *
5 # * This file is free software; you can redistribute it and/or modify it
6 # * under the terms of the GNU General Public License as published by
7 # * the Free Software Foundation; either version 3 of the License, or
8 # * (at your option) any later version.
9 # *
10 # * This program is distributed in the hope that it will be useful, but
11 # * WITHOUT ANY WARRANTY; without even the implied warranty of
12 # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # * General Public License for more details.
14 # *
15 # * You should have received a copy of the GNU General Public License
16 # * along with this program; if not, write to the Free Software
17 # * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 # popfile-link.sh helper script to open messages in POPFile's control center
20 # in order to edit their status
22 # Requires that POPFile is running and that the message has been processed
23 # by it (X-POPFile-Link: header present). POPFile control center opens with
24 # the web browser set in Claws Mail prefs.
27 open_page()
29 TMPCMD=$(echo $OPEN_CMD | sed "s|\"%s\"|$1|")
30 $TMPCMD &
34 SESSION_ID=""
35 if [ "$1" = "--ask-session-id" ]
36 then
37 shift
38 SESSION_ID=$(gxmessage -entry -center -wrap -buttons "OK:0,Cancel:1" -default "OK" \
39 -name "popfile-link" -title "POPFile session ID" "Type in the ID of a running POPFile session to use")
40 test -z "$SESSION_ID" -o $? -ne 0 && \
41 exit 0
44 test -z "$1" && \
45 exit 1
47 CM_DIR=$(claws-mail --config-dir)
48 test -z "$CM_DIR" -o ! -d "$HOME/$CM_DIR" && \
49 exit 1
51 OPEN_CMD=$(grep -Em 1 "^uri_open_command=" "$HOME/$CM_DIR/clawsrc" | cut -d '=' -f 2-)
52 test -z "$OPEN_CMD" && \
53 exit 1
55 while [ -n "$1" ]
57 LINK=$(grep -Eim 1 "^X\-POPFile\-Link: " "$1")
58 if [ -n "$LINK" ]
59 then
60 LINK=${LINK:16}
61 if [ -n "$SESSION_ID" ]
62 then
63 open_page "${LINK}\\&session=$SESSION_ID"
64 else
65 open_page "$LINK"
68 shift
69 done
70 exit 0