Ticket #938 (new enhancement)

Opened 13 years ago

Last modified 12 years ago

zwrite should whine at you if you're not subbed

Reported by: jdreed Owned by:
Priority: insignificant Milestone: The Distant Future
Component: -- Keywords:
Cc: Fixed in version:
Upstream bug:

Description

(Yes, I'm aware that all the cool kids use barnowl)

Periodically, someone will try out zephyr and not understand that they need to be subbed to use classes and instances. This is particularly frustrating because of the arbitrary decision we made to not run zwgc on dialups, so you can't even zephyr the user personally if they're using Linerva or athena.dialup.

zwrite should do some sanity checking. (Barnowl should do the same thing, but we're not upstream for that).

Change History

comment:1 Changed 13 years ago by kchen

One thing to watch out for is that such a change might break bots. It'd be possible to create an override, but then all the bots would also have to be updated (which might be considered acceptable).

comment:2 follow-up: ↓ 3 Changed 13 years ago by jdreed

I was thinking about whining on stderr, not failing (and -q would suppress such a warning).

comment:3 in reply to: ↑ 2 Changed 13 years ago by jweiss

I was thinking about whining on stderr, not failing (and -q would suppress such a warning).

I'd also recommend that -n punt the check entirely. That's overloading -n a little bit, but I suspect that's okay.

comment:4 Changed 13 years ago by jdreed

I could possibly be convinced that if you're passing any options other than -c or -i that you know what you're doing. zrand/zsr used to pass -n without users really understanding it, but I think those days are well behind us.

comment:5 Changed 12 years ago by jdreed

  • Owner set to jdreed
  • Status changed from new to accepted

I suggest shipping the following as part of zephyr-config and diverting zwrite. This will catch 99% of common errors, and will not trip up most bots, since I suspect bots pass one of -q, -n, or -d:

#!/bin/bash

class=
instance=
quiet=0
while getopts ":c:i:qn" opt; do
    case $opt in
        c)
            class=$OPTARG
            ;;
        i)
            instance=$OPTARG
            ;;
        q|n|d)
            quiet=1
            ;;
    esac   
done
[ -z "$class" ] && [ -n "$instance" ] && class=message
[ -n "$class" ] && [ -z "$instance" ] && instance='\*'
if [ $quiet -eq 0 ]; then
    if ! zctl ret 2>/dev/null | grep -q "^Class $class Instance $instance"; then
        echo "--> You don't appear to be subscribed to class $class, instance ${instance#\\}." >&2
    fi
fi

exec zwrite.debathena-orig "$@"

comment:6 Changed 12 years ago by jdreed

er, let's try that again:

#!/bin/bash

class=
instance=
quiet=0
while getopts ":c:i:qn" opt; do
    case $opt in
	c)
	    class=$OPTARG
	    ;;
	i)
	    instance=$OPTARG
	    ;;
	q|n|d)
	    quiet=1
	    ;;
    esac   
done
[ -z "$class" ] && [ -n "$instance" ] && class=message
[ -n "$class" ] && [ -z "$instance" ] && instance='\*'
if [ $quiet -eq 0 ] && [ -n "$class" ] && [ -n "$instance" ]; then
    if ! zctl ret 2>/dev/null | grep -q "^Class $class Instance $instance"; then
	echo "--> You don't appear to be subscribed to class $class, instance ${instance#\\}." >&2
    fi
fi

exec zwrite.debathena-orig "$@"

comment:7 Changed 12 years ago by jdreed

  • Priority changed from normal to insignificant
  • Milestone changed from Precise Beta to The Distant Future

It's been pointed out that a "zctl ret" for each zwrite invocation is probably not a good idea, and the code snippet has false positives anyway.

comment:8 Changed 12 years ago by jdreed

  • Owner jdreed deleted
  • Status changed from accepted to new
Note: See TracTickets for help on using tickets.