Browse Source

subscribe command in muttrc

Bob Mottram 10 years ago
parent
commit
3a3b1784a8
4 changed files with 25 additions and 2 deletions
  1. BIN
      man/freedombone-addlist.1.gz
  2. BIN
      man/freedombone-rmlist.1.gz
  3. 13
    1
      src/freedombone-addlist
  4. 12
    1
      src/freedombone-rmlist

BIN
man/freedombone-addlist.1.gz View File


BIN
man/freedombone-rmlist.1.gz View File


+ 13
- 1
src/freedombone-addlist View File

32
 MYUSERNAME=$USER
32
 MYUSERNAME=$USER
33
 MAILINGLIST=
33
 MAILINGLIST=
34
 SUBJECTTAG=
34
 SUBJECTTAG=
35
+LIST_ADDRESS=
35
 
36
 
36
 function show_help {
37
 function show_help {
37
     echo ''
38
     echo ''
38
-    echo 'freedombone-addlist -u [username] -l [mailing list name] -s [subject tag]'
39
+    echo 'freedombone-addlist -u [username] -l [mailing list name] -s [subject tag] -e [list email address]'
39
     echo ''
40
     echo ''
40
     exit 0
41
     exit 0
41
 }
42
 }
60
     shift
61
     shift
61
     SUBJECTTAG="$1"
62
     SUBJECTTAG="$1"
62
     ;;
63
     ;;
64
+    -e|--email)
65
+    shift
66
+    LIST_ADDRESS="$1"
67
+    ;;
63
     *)
68
     *)
64
     # unknown option
69
     # unknown option
65
     ;;
70
     ;;
113
     chown $MYUSERNAME:$MYUSERNAME $MUTTRC
118
     chown $MYUSERNAME:$MYUSERNAME $MUTTRC
114
 fi
119
 fi
115
 
120
 
121
+if [ $LIST_ADDRESS ]; then
122
+    sed -i "s|unsubscribe $LIST_ADDRESS|subscribe $LIST_ADDRESS|g" $MUTTRC
123
+    if ! grep -q "subscribe $LIST_ADDRESS" $MUTTRC; then
124
+        echo "subscribe $LIST_ADDRESS" >> $MUTTRC
125
+    fi
126
+fi
127
+
116
 exit 0
128
 exit 0

+ 12
- 1
src/freedombone-rmlist View File

31
 
31
 
32
 MYUSERNAME=$USER
32
 MYUSERNAME=$USER
33
 MAILINGLIST=
33
 MAILINGLIST=
34
+LIST_ADDRESS=
34
 
35
 
35
 function show_help {
36
 function show_help {
36
     echo ''
37
     echo ''
37
-    echo 'freedombone-rmlist -u [username] -l [mailing list name]'
38
+    echo 'freedombone-rmlist -u [username] -l [mailing list name] -e [list email address]'
38
     echo ''
39
     echo ''
39
     exit 0
40
     exit 0
40
 }
41
 }
55
     shift
56
     shift
56
     MAILINGLIST="$1"
57
     MAILINGLIST="$1"
57
     ;;
58
     ;;
59
+    -e|--email)
60
+    shift
61
+    LIST_ADDRESS="$1"
62
+    ;;
58
     *)
63
     *)
59
     # unknown option
64
     # unknown option
60
     ;;
65
     ;;
73
     chown $MYUSERNAME:$MYUSERNAME $MUTTRC
78
     chown $MYUSERNAME:$MYUSERNAME $MUTTRC
74
 fi
79
 fi
75
 
80
 
81
+if [ $LIST_ADDRESS ]; then
82
+    if ! grep -q "unsubscribe $LIST_ADDRESS" $MUTTRC; then
83
+        sed -i "s|subscribe $LIST_ADDRESS|unsubscribe $LIST_ADDRESS|g" $MUTTRC
84
+    fi
85
+fi
86
+
76
 exit 0
87
 exit 0