summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Kenneth G Raeburn <raeburn@mit.edu>1990-05-24 18:42:31 +0000
committerGravatar Kenneth G Raeburn <raeburn@mit.edu>1990-05-24 18:42:31 +0000
commitc392ad6f92fc7e85885b72aad9ce7ea71e63fa6c (patch)
tree5fbe0f3e3166afac37d974bf54c5f5039b3f067c
parentace023e1bd22101ddccc4f1ea7ee9e3bdb2e7552 (diff)
Reverted "punt" semantics to previous form, for Athena release 7.0.
-rw-r--r--zwgc/main.c18
-rw-r--r--zwgc/subscriptions.c61
2 files changed, 26 insertions, 53 deletions
diff --git a/zwgc/main.c b/zwgc/main.c
index 92edea8..f092ec2 100644
--- a/zwgc/main.c
+++ b/zwgc/main.c
@@ -291,23 +291,23 @@ void notice_handler(notice)
notice->z_message_len, 1);
string instance = get_field(notice->z_message,
notice->z_message_len, 2);
- string sender = get_field(notice->z_message,
- notice->z_message_len, 3);
- punt(class, instance, sender);
+ string recipient = get_field(notice->z_message,
+ notice->z_message_len, 3);
+ punt(class, instance, recipient);
free(class);
free(instance);
- free(sender);
+ free(recipient);
} else if (!strcasecmp(control_opcode, USER_UNSUPPRESS)) {
string class = get_field(notice->z_message,
notice->z_message_len, 1);
string instance = get_field(notice->z_message,
notice->z_message_len, 2);
- string sender = get_field(notice->z_message,
- notice->z_message_len, 3);
- unpunt(class, instance, sender);
+ string recipient = get_field(notice->z_message,
+ notice->z_message_len, 3);
+ unpunt(class, instance, recipient);
free(class);
free(instance);
- free(sender);
+ free(recipient);
} else
printf("zwgc: unknown control opcode %s.\n", control_opcode);
@@ -324,7 +324,7 @@ void notice_handler(notice)
if (puntable_address_p(notice->z_class,
notice->z_class_inst,
- notice->z_sender)) {
+ notice->z_recipient)) {
#ifdef DEBUG
if (zwgc_debug)
printf("PUNTED <%s>!!!!\n", notice->z_class_inst);
diff --git a/zwgc/subscriptions.c b/zwgc/subscriptions.c
index 8327279..b7f6c40 100644
--- a/zwgc/subscriptions.c
+++ b/zwgc/subscriptions.c
@@ -79,70 +79,45 @@ static string address_to_string(class, instance, recipient)
return(result);
}
-/* hack. enumerate should allow client_data to be passed. If this
- * were C++ I could be amazingly more elegant.
- */
-
-static int in_punt_list;
-static char *ctest,*itest,*utest;
-
-static void punt_dict_test(binding)
- int_dictionary_binding *binding;
-{
- char *inst,*user;
- static char wild[] = "*"; /* len = 2 */
- char *key = binding->key;
-
- if (in_punt_list) return;
-
- inst = index(key,'\001')+1;
- user = index(inst,'\001')+1;
-
- if (((*key == '*') || (bcmp(key,ctest,inst-key) == 0)) &&
- ((*inst == '*') || (bcmp(inst,itest,user-inst) == 0)) &&
- ((*user == '*') || (strcmp(user,utest) == 0)))
- in_punt_list = 1;
- return;
-}
-
-int puntable_address_p(class, instance, sender)
+int puntable_address_p(class, instance, recipient)
string class;
string instance;
- string sender;
+ string recipient;
{
+ string temp;
+
if (!puntable_addresses_dict)
init_puntable_dict();
- in_punt_list = 0;
- ctest = address_to_string(class, instance, sender);
- itest = index(ctest,'\001')+1;
- utest = index(itest,'\001')+1;
-
- int_dictionary_Enumerate(puntable_addresses_dict,punt_dict_test);
+ temp = address_to_string(class, instance, recipient);
+ if (int_dictionary_Lookup(puntable_addresses_dict, temp)) {
+ free(temp);
+ return(1);
+ }
- free(ctest);
- return(in_punt_list);
+ free(temp);
+ return(0);
}
-void punt(class, instance, sender)
+void punt(class, instance, recipient)
string class;
string instance;
- string sender;
+ string recipient;
{
string temp;
if (!puntable_addresses_dict)
init_puntable_dict();
- temp = address_to_string(class, instance, sender);
+ temp = address_to_string(class, instance, recipient);
(void)int_dictionary_Define(puntable_addresses_dict, temp, 0);
free(temp);
}
-void unpunt(class, instance, sender)
+void unpunt(class, instance, recipient)
string class;
string instance;
- string sender;
+ string recipient;
{
string temp;
int_dictionary_binding *binding;
@@ -150,7 +125,7 @@ void unpunt(class, instance, sender)
if (!puntable_addresses_dict)
init_puntable_dict();
- temp = address_to_string(class, instance, sender);
+ temp = address_to_string(class, instance, recipient);
binding = int_dictionary_Define(puntable_addresses_dict, temp, 0);
free(temp);
if (binding)
@@ -323,8 +298,6 @@ static void load_subscriptions_from_file(file)
unsubscribe(class, instance, recipient);
break;
case PUNT_CHARACTER:
- /* well, if it's a punt, it's not a recip, but we'll
- let that go */
punt(class, instance, recipient);
break;
default: