2 Commits

Author SHA1 Message Date
  Alois Mahdal 8cb014ec81 Add support for channels 4 years ago
  Alois Mahdal 645885eb2a Extend usage message with info on config and logging 4 years ago
1 changed files with 17 additions and 3 deletions
  1. 17
    3
      bin/notifirc

+ 17
- 3
bin/notifirc View File

@@ -7,9 +7,20 @@ usage() {
7 7
     #
8 8
     local self      # our name
9 9
     self=$(basename "$0")
10
-    echo "usage: $self [options] message" >&2
11
-    echo "usage: $self [options] [-l max_lines] [-L max_width] -f message_file|-" >&2
12
-    echo "options: [-h host] [-p port] [-n nick] [-c context] [-u user]" >&2
10
+    {
11
+        echo "usage: $self [options] message"
12
+        echo "usage: $self [options] [-l max_lines] [-L max_width] -f message_file|-"
13
+        echo "options: [-h host] [-p port] [-n nick] [-c context] [-u user]"
14
+        echo ""
15
+        echo "user can be user name but also channel name, in that case notifirc"
16
+        echo "will JOIN the channel first."
17
+        echo ""
18
+        echo "Defaults for options can be defined as POSIX shell assignments under"
19
+        echo "/etc/notifirc.rc or ~/.notifirc.rc. (E.g. 'nick=jdoe', 'max_width=40')."
20
+        echo ""
21
+        echo "All is logged under /var/log/notifirc.log, ~/.notifirc.log, or"
22
+        echo "/tmp/notifirc.log, whichever $self can write to."
23
+    } >&2
13 24
     exit 2
14 25
 }
15 26
 
@@ -22,6 +33,9 @@ mkcommands() {
22 33
     local message
23 34
     echo "NICK $nick"
24 35
     echo "USER $nick 8 * :notifirc bot"
36
+    if test "${user:0:1}" == '#'; then
37
+        echo "JOIN $user"
38
+    fi
25 39
     while read -r message;
26 40
     do
27 41
         echo "PRIVMSG $user :$message"