Skip to content

Commit

Permalink
jjp: Add option to print status messages using the default color; Upd…
Browse files Browse the repository at this point in the history
…ate README.md
  • Loading branch information
aaronNGi committed Feb 12, 2020
1 parent 8fef7b5 commit 240b971
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ supported by `jjc(1)`.
| `IRC_PORT` | Connect using this port. | `6667` |
| `IRC_REALNAME` | The real name to use. Can be seen in `whois`. | `$USER` |
| `IRC_USER` | The user name to use. | `$USER` |
| `JJ_DEBUG` | When set, makes `jjc(1)` print debug output. | unset |

### Special Information for Hooks

Expand All @@ -272,6 +271,13 @@ variables are also available to the called program:
| `IRC_CASEMAPPING` | The servers casemapping. For rfc1459 for example, its value would be `][\~A-Z }{\|^a-z`, which can be split on space and then used as arguments for `tr(1)`, to properly casefold a string.
| `IRC_AWAY` | 1 when we are marked away, empty otherwise.

### Misc

| Name | Description |
|----------------|-------------|
| `JJ_SERVERLOG` | When not empty, `jjp(1)` will print status messages using the default color.
| `JJ_DEBUG` | When not emtpy, `jjc(1)` will print debug output.


Log Format
--------------------------------------------------------------------------
Expand Down
12 changes: 7 additions & 5 deletions jjp
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/usr/bin/awk -f

BEGIN {
FS=" "
if (length(ENVIRON["IRC_TERMTITLE"]))
printf "\033]0;%s\a", ENVIRON["IRC_TERMTITLE"]
} {
BEGIN { FS=" " } {
if (NF < 2) {
printf "\n%s", $0
next
Expand Down Expand Up @@ -33,6 +29,12 @@ BEGIN {
dcolor="38;5;8"
}

# When JJ_SERVERLOG is set, print messages in the default color.
if (ENVIRON["JJ_SERVERLOG"] != "") {
printf "\n\033[%sm%s\033[0m %s", dcolor, date[2], msg
next
}

# Status message.
if (nick == "-") {
printf "\n\033[%sm%s \033[%sm%s\033[0m",
Expand Down

0 comments on commit 240b971

Please sign in to comment.