Index: variable.c
===================================================================
--- variable.c	(revision 779bd3d2f7b9cdf45cdf1186a035713f3321e166)
+++ variable.c	(revision f203cad04d71e968a11be5e72e6c9d805e02010d)
@@ -30,6 +30,6 @@
         NULL, NULL, NULL, NULL, NULL, NULL }
 
-#define OWLVAR_STRING_FULL(name,default,summary,description,validate,set,get) \
-        { name, OWL_VARIABLE_STRING, default, 0, "<string>", summary,description, NULL, \
+#define OWLVAR_STRING_FULL(name,default,validset,summary,description,validate,set,get) \
+        { name, OWL_VARIABLE_STRING, default, 0, validset, summary,description, NULL, \
         validate, set, NULL, get, NULL, NULL }
 
@@ -266,5 +266,5 @@
 		 "" ),
 
-  OWLVAR_STRING_FULL( "tty" /* %OwlVarStub */, "", "tty name for zephyr location", "",
+  OWLVAR_STRING_FULL( "tty" /* %OwlVarStub */, "", "<string>", "tty name for zephyr location", "",
 		      NULL, owl_variable_tty_set, NULL),
 
@@ -370,4 +370,69 @@
 	       "delete a message right as it came in.\n" ),
 
+  OWLVAR_STRING_FULL( "default_exposure" /* %OwlVarStub */, "",
+                      "none,opstaff,realm-visible,realm-announced,net-visible,net-announced",
+                      "controls the persistent value for exposure",
+                      "The default exposure level corresponds to the Zephyr exposure value\n"
+                      "in ~/.zephyr.vars.  Defaults to realm-visible if there is no value in\n"
+                      "~/.zephyr.vars.\n"
+                      "See the description of exposure for the values this can be.",
+                      NULL, owl_variable_default_exposure_set, owl_variable_default_exposure_get ),
+
+  OWLVAR_STRING_FULL( "exposure" /* %OwlVarStub */, "",
+                      "none,opstaff,realm-visible,realm-announced,net-visible,net-announced",
+                      "controls who can zlocate you",
+                      "The exposure level, defaulting to the value of default_exposure,\n"
+                      "can be one of the following (from least exposure to widest exposure,\n"
+                      "as listed in zctl(1)):\n"
+                      "\n"
+                      "   none            - This completely disables Zephyr for the user. \n"
+                      "                     The user is not registered with Zephyr.  No user\n"
+                      "                     location information is retained by Zephyr.  No\n"
+                      "                     login or logout announcements will be sent.  No\n"
+                      "                     subscriptions will be entered for the user, and\n"
+                      "                     no notices will be displayed by zwgc(1).\n"
+                      "   opstaff         - The user is registered with Zephyr.  No login or\n"
+                      "                     logout announcements will be sent, and location\n"
+                      "                     information will only be visible to Operations\n"
+                      "                     staff.  Default subscriptions and any additional\n"
+                      "                     personal subscriptions will be entered for the\n"
+                      "                     user.\n"
+                      "   realm-visible   - The user is registered with Zephyr.  User\n"
+                      "                     location information is retained by Zephyr and\n"
+                      "                     made available only to users within the user’s\n"
+                      "                     Kerberos realm.  No login or logout\n"
+                      "                     announcements will be sent.  This is the system\n"
+                      "                     default.  Default subscriptions and any\n"
+                      "                     additional personal subscriptions will be\n"
+                      "                     entered for the user.\n"
+                      "   realm-announced - The user is registered with Zephyr.  User\n"
+                      "                     location information is retained by Zephyr and\n"
+                      "                     made available only to users authenticated\n"
+                      "                     within the user’s Kerberos realm.  Login and\n"
+                      "                     logout announcements will be sent, but only to\n"
+                      "                     users within the user’s Kerberos realm who have\n"
+                      "                     explicitly requested such via subscriptions. \n"
+                      "                     Default subscriptions and any additional\n"
+                      "                     personal subscriptions will be entered for the\n"
+                      "                     user.\n"
+                      "   net-visible     - The user is registered with Zephyr.  User\n"
+                      "                     location information is retained by Zephyr and\n"
+                      "                     made available to any authenticated user who\n"
+                      "                     requests such.  Login and logout announcements\n"
+                      "                     will be sent only to users within the user’s\n"
+                      "                     Kerberos realm who have explicitly requested\n"
+                      "                     such via subscriptions.  Default subscriptions\n"
+                      "                     and any additional personal subscriptions will\n"
+                      "                     be entered for the user.\n"
+                      "   net-announced   - The user is registered with Zephyr.  User\n"
+                      "                     location information is retained by Zephyr and\n"
+                      "                     made available to any authenticated user who\n"
+                      "                     requests such.  Login and logout announcements\n"
+                      "                     will be sent to any user has requested such. \n"
+                      "                     Default subscriptions and any additional\n"
+                      "                     personal subscriptions will be entered for the\n"
+                      "                     user.\n",
+                      NULL, owl_variable_exposure_set, NULL /* use default for get */ ),
+
   /* This MUST be last... */
   { NULL, 0, NULL, 0, NULL, NULL, NULL, NULL,
@@ -470,4 +535,21 @@
 }
 
+int owl_variable_default_exposure_set(owl_variable *v, const void *newval)
+{
+  return owl_zephyr_set_default_exposure(newval);
+}
+
+const void *owl_variable_default_exposure_get(const owl_variable *v)
+{
+  return owl_zephyr_get_default_exposure();
+}
+
+int owl_variable_exposure_set(owl_variable *v, const void *newval)
+{
+  int ret = owl_zephyr_set_exposure(newval);
+  if (ret != 0)
+    return ret;
+  return owl_variable_string_set_default(v, owl_zephyr_normalize_exposure(newval));
+}
 
 /**************************************************************************/
Index: zephyr.c
===================================================================
--- zephyr.c	(revision fe3b017371488552616f09bfed6345a51e6fe0fa)
+++ zephyr.c	(revision f203cad04d71e968a11be5e72e6c9d805e02010d)
@@ -1019,19 +1019,8 @@
 {
 #ifdef HAVE_LIBZEPHYR
-  char *exposure, *eset;
-  Code_t ret;
-
   ZResetAuthentication();
 
-  eset = EXPOSE_REALMVIS;
-  exposure = ZGetVariable(zstr("exposure"));
-  if (exposure)
-    exposure = ZParseExposureLevel(exposure);
-  if (exposure)
-    eset = exposure;
-   
-  ret = ZSetLocation(eset);
-  if (ret != ZERR_NONE)
-    owl_function_error("Error setting location: %s", error_message(ret));
+  /* ZSetLocation, and store the default value as the current value */
+  owl_global_set_exposure(&g, owl_global_get_default_exposure(&g));
 #endif
 }
@@ -1154,4 +1143,66 @@
   ZInitLocationInfo(zstr(host), zstr(val));
 #endif
+}
+
+const char *owl_zephyr_normalize_exposure(const char *exposure)
+{
+  if (exposure == NULL)
+    return NULL;
+#ifdef HAVE_LIBZEPHYR
+  return ZParseExposureLevel(zstr(exposure));
+#else
+  return exposure;
+#endif
+}
+
+int owl_zephyr_set_default_exposure(const char *exposure)
+{
+#ifdef HAVE_LIBZEPHYR
+  Code_t ret;
+  if (exposure == NULL)
+    return -1;
+  exposure = ZParseExposureLevel(zstr(exposure));
+  if (exposure == NULL)
+    return -1;
+  ret = ZSetVariable(zstr("exposure"), zstr(exposure)); /* ZSetVariable does file I/O */
+  if (ret != ZERR_NONE) {
+    owl_function_error("Unable to set default exposure location: %s", error_message(ret));
+    return -1;
+  }
+#endif
+  return 0;
+}
+
+const char *owl_zephyr_get_default_exposure(void)
+{
+#ifdef HAVE_LIBZEPHYR
+  const char *exposure = ZGetVariable(zstr("exposure")); /* ZGetVariable does file I/O */
+  if (exposure == NULL)
+    return EXPOSE_REALMVIS;
+  exposure = ZParseExposureLevel(zstr(exposure));
+  if (exposure == NULL) /* The user manually entered an invalid value in ~/.zephyr.vars, or something weird happened. */
+    return EXPOSE_REALMVIS;
+  return exposure;
+#else
+  return "";
+#endif
+}
+
+int owl_zephyr_set_exposure(const char *exposure)
+{
+#ifdef HAVE_LIBZEPHYR
+  Code_t ret;
+  if (exposure == NULL)
+    return -1;
+  exposure = ZParseExposureLevel(zstr(exposure));
+  if (exposure == NULL)
+    return -1;
+  ret = ZSetLocation(zstr(exposure));
+  if (ret != ZERR_NONE) {
+    owl_function_error("Unable to set exposure level: %s.", error_message(ret));
+    return -1;
+  }
+#endif
+  return 0;
 }
   
