Changes in variable.c [f25df21:4c7c21f]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
variable.c
rf25df21 r4c7c21f 30 30 NULL, NULL, NULL, NULL, NULL, NULL } 31 31 32 #define OWLVAR_STRING_FULL(name,default, summary,description,validate,set,get) \33 { name, OWL_VARIABLE_STRING, default, 0, "<string>", summary,description, NULL, \32 #define OWLVAR_STRING_FULL(name,default,validset,summary,description,validate,set,get) \ 33 { name, OWL_VARIABLE_STRING, default, 0, validset, summary,description, NULL, \ 34 34 validate, set, NULL, get, NULL, NULL } 35 35 … … 266 266 "" ), 267 267 268 OWLVAR_STRING_FULL( "tty" /* %OwlVarStub */, "", " tty name for zephyr location", "",268 OWLVAR_STRING_FULL( "tty" /* %OwlVarStub */, "", "<string>", "tty name for zephyr location", "", 269 269 NULL, owl_variable_tty_set, NULL), 270 270 … … 370 370 "delete a message right as it came in.\n" ), 371 371 372 OWLVAR_STRING_FULL( "default_exposure" /* %OwlVarStub */, "", 373 "none,opstaff,realm-visible,realm-announced,net-visible,net-announced", 374 "controls the persistent value for exposure", 375 "The default exposure level corresponds to the Zephyr exposure value\n" 376 "in ~/.zephyr.vars. Defaults to realm-visible if there is no value in\n" 377 "~/.zephyr.vars.\n" 378 "See the description of exposure for the values this can be.", 379 NULL, owl_variable_default_exposure_set, owl_variable_default_exposure_get ), 380 381 OWLVAR_STRING_FULL( "exposure" /* %OwlVarStub */, "", 382 "none,opstaff,realm-visible,realm-announced,net-visible,net-announced", 383 "controls who can zlocate you", 384 "The exposure level, defaulting to the value of default_exposure,\n" 385 "can be one of the following (from least exposure to widest exposure,\n" 386 "as listed in zctl(1)):\n" 387 "\n" 388 " none - This completely disables Zephyr for the user. \n" 389 " The user is not registered with Zephyr. No user\n" 390 " location information is retained by Zephyr. No\n" 391 " login or logout announcements will be sent. No\n" 392 " subscriptions will be entered for the user, and\n" 393 " no notices will be displayed by zwgc(1).\n" 394 " opstaff - The user is registered with Zephyr. No login or\n" 395 " logout announcements will be sent, and location\n" 396 " information will only be visible to Operations\n" 397 " staff. Default subscriptions and any additional\n" 398 " personal subscriptions will be entered for the\n" 399 " user.\n" 400 " realm-visible - The user is registered with Zephyr. User\n" 401 " location information is retained by Zephyr and\n" 402 " made available only to users within the user’s\n" 403 " Kerberos realm. No login or logout\n" 404 " announcements will be sent. This is the system\n" 405 " default. Default subscriptions and any\n" 406 " additional personal subscriptions will be\n" 407 " entered for the user.\n" 408 " realm-announced - The user is registered with Zephyr. User\n" 409 " location information is retained by Zephyr and\n" 410 " made available only to users authenticated\n" 411 " within the user’s Kerberos realm. Login and\n" 412 " logout announcements will be sent, but only to\n" 413 " users within the user’s Kerberos realm who have\n" 414 " explicitly requested such via subscriptions. \n" 415 " Default subscriptions and any additional\n" 416 " personal subscriptions will be entered for the\n" 417 " user.\n" 418 " net-visible - The user is registered with Zephyr. User\n" 419 " location information is retained by Zephyr and\n" 420 " made available to any authenticated user who\n" 421 " requests such. Login and logout announcements\n" 422 " will be sent only to users within the user’s\n" 423 " Kerberos realm who have explicitly requested\n" 424 " such via subscriptions. Default subscriptions\n" 425 " and any additional personal subscriptions will\n" 426 " be entered for the user.\n" 427 " net-announced - The user is registered with Zephyr. User\n" 428 " location information is retained by Zephyr and\n" 429 " made available to any authenticated user who\n" 430 " requests such. Login and logout announcements\n" 431 " will be sent to any user has requested such. \n" 432 " Default subscriptions and any additional\n" 433 " personal subscriptions will be entered for the\n" 434 " user.\n", 435 NULL, owl_variable_exposure_set, NULL /* use default for get */ ), 436 372 437 /* This MUST be last... */ 373 438 { NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, … … 470 535 } 471 536 537 int owl_variable_default_exposure_set(owl_variable *v, const void *newval) 538 { 539 return owl_zephyr_set_default_exposure(newval); 540 } 541 542 const void *owl_variable_default_exposure_get(const owl_variable *v) 543 { 544 return owl_zephyr_get_default_exposure(); 545 } 546 547 int owl_variable_exposure_set(owl_variable *v, const void *newval) 548 { 549 int ret = owl_zephyr_set_exposure(newval); 550 if (ret != 0) 551 return ret; 552 return owl_variable_string_set_default(v, owl_zephyr_normalize_exposure(newval)); 553 } 472 554 473 555 /**************************************************************************/ … … 477 559 int owl_variable_dict_setup(owl_vardict *vd) { 478 560 owl_variable *var, *cur; 479 if (owl_dict_create(vd)) return(-1);561 owl_dict_create(vd); 480 562 for (var = variables_to_init; var->name != NULL; var++) { 481 563 cur = g_new(owl_variable, 1); … … 559 641 560 642 void owl_variable_update(owl_variable *var, const char *summary, const char *desc) { 561 if(var->summary)g_free(var->summary);643 g_free(var->summary); 562 644 var->summary = g_strdup(summary); 563 if(var->description)g_free(var->description);645 g_free(var->description); 564 646 var->description = g_strdup(desc); 565 647 } … … 569 651 if(old) { 570 652 owl_variable_update(old, summ, desc); 571 if(old->pval_default)g_free(old->pval_default);653 g_free(old->pval_default); 572 654 old->pval_default = g_strdup(initval); 573 655 } else { … … 688 770 } 689 771 if (msg && v->get_tostring_fn) { 690 tostring = v->get_tostring_fn(v, v-> val);772 tostring = v->get_tostring_fn(v, v->get_fn(v)); 691 773 owl_function_makemsg("%s = '%s'", name, tostring); 692 774 g_free(tostring); … … 726 808 v = owl_dict_find_element(d, name); 727 809 if (v == NULL || !v->get_tostring_fn) return NULL; 728 return v->get_tostring_fn(v, v-> val);810 return v->get_tostring_fn(v, v->get_fn(v)); 729 811 } 730 812 … … 862 944 void owl_variable_delete_default(owl_variable *v) 863 945 { 864 if (v->val)g_free(v->val);946 g_free(v->val); 865 947 } 866 948 … … 994 1076 if (!v->validate_fn(v, newval)) return(-1); 995 1077 } 996 if (v->val)g_free(v->val);1078 g_free(v->val); 997 1079 v->val = g_strdup(newval); 998 1080 return(0);
Note: See TracChangeset
for help on using the changeset viewer.