[140] in Zephyr_Comments
[Barry R Jaspan: Suggestion]
daemon@ATHENA.MIT.EDU (John T Kohl)
Wed Nov 23 15:06:41 1988
Date: Wed, 23 Nov 88 15:06:08 EST
From: John T Kohl <jtkohl@ATHENA.MIT.EDU>
To: zephyr-comments@ATHENA.MIT.EDU
------- Forwarded Message
From: <bjaspan@ATHENA.MIT.EDU>
To: eichin@ATHENA.MIT.EDU
Cc: jtkohl@ATHENA.MIT.EDU
Subject: Suggestion
Date: Tue, 22 Nov 88 18:36:18 EST
Mark and John --
I don't know if Zephyr is still undergoing modification for
future releases (or if you are the people to send suggestions to), but
if it is I have a couple suggestions for the programmer's library.
They deal with default subscriptions. First I'll state the
suggestions and then comment on why I am making them.
1) Modify the design such that default subscriptions are added (only
once) at initialization, and not on subscription.
2) Provide a function ZCancelDefaultSubscriptions().
My reasons deal (obviously) with what I have learned from writing
btalk, but as far as I can tell the same things would apply to any
Zephyr client that is designed to coexist with zwgc.
I have a procedure that checks for any new messages with
ZPending() and retrieves them, acting on each one. BTALK, however, is
only interested in messages that it specifically subscribed to; other
messages cause problems. Currently, I simply have a piece of code
that trashes unwanted messages:
if (strcmp(notice.z_class,BTALK_CLASS)) {
ZFreeNotice(¬ice);
continue; }
This works, but is completely unnecessary. It causes extra work for
the program, and (perhaps more importantly) for the zehpyr server,
which is sending messages on a whole list of subscriptions which will
always be ignored.
The current method for removing the extra work, using
ZCancelSubscription() (or whatever the function is called) on each
subscription returned by ZGetDefaultSubscriptions(), is kludgy at
best. For instance, I wanted BTALK to remove all default
subscriptions, but I wanted to subscribe to MESSAGE, PERSONAL,
username. The only way to do this is write a function that reads each
default subscription, checks if is not MESSAGE,PERSONAL,username, and
removes it if it isn't. If I wanted to cancel all but two (or more)
default subscriptions, it would get even worse. (It is the only way
because if I cancel all default subscriptions and them subscribe to
MESSAGE,PERSONAL,username, I get all the defaults over again.)
The only reason I suggest ZCancelDefaultSubscriptions() is that I
suspect there is a more efficient way to do it than simply looping
through calls to ZGetDefaultSubscription() and ZCancelSubsription().
And while it isn't too tough to write that function, any client that
wants to use zephyr but does not want all of the default subscriptions
will have to implement it.
Barry
PS: I have this nagging feeling that one of you is going to tell me
about to already existing function that makes these suggestions moot..
and then I will feel very silly. :-)
------- End Forwarded Message