Changes in / [7655e08:f578d18]


Ignore:
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • cmd.c

    r6a71113 rf25df21  
    9999
    100100char *owl_cmddict_execute_argv(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc) {
    101   char *buff;
    102   char *retval = NULL;
    103 
    104   buff = g_strjoinv(" ", (char**)argv);
    105   retval = _owl_cmddict_execute(cd, ctx, argv, argc, buff);
    106   g_free(buff);
    107 
     101  GString *buf = g_string_new("");
     102  int i;
     103  char *retval;
     104
     105  /* We weren't given a command line, so fabricate a valid one. */
     106  for(i = 0; i < argc; i++) {
     107    if (i != 0)
     108      g_string_append_c(buf, ' ');
     109    owl_string_append_quoted_arg(buf, argv[i]);
     110  }
     111
     112  retval = _owl_cmddict_execute(cd, ctx, argv, argc, buf->str);
     113
     114  g_string_free(buf, true);
    108115  return retval;
    109116}
  • functions.c

    r4fd211f r37d188f  
    29592959 
    29602960  if (viewsize==0) {
    2961     owl_function_makemsg("No messages present");
     2961    owl_function_error("No messages present");
    29622962    return;
    29632963  }
     
    29732973  /* bounds check */
    29742974  if (start>=viewsize || start<0) {
    2975     owl_function_makemsg("No further matches found");
     2975    owl_function_error("No further matches found");
    29762976    return;
    29772977  }
     
    30023002  }
    30033003  owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    3004   owl_function_makemsg("No matches found");
     3004  owl_function_error("No matches found");
    30053005}
    30063006
  • owl.c

    r25f7c57 r25f7c57  
    4141  char *confdir;
    4242  bool debug;
     43  bool rm_debug;
    4344} owl_options;
    4445
     
    4950  fprintf(stderr, "  -n,--no-subs        don't load zephyr subscriptions\n");
    5051  fprintf(stderr, "  -d,--debug          enable debugging\n");
     52  fprintf(stderr, "  -D,--remove-debug   enable debugging and delete previous debug file\n");
    5153  fprintf(stderr, "  -v,--version        print the Barnowl version number and exit\n");
    5254  fprintf(stderr, "  -h,--help           print this help message\n");
     
    6466    { "tty",             1, 0, 't' },
    6567    { "debug",           0, 0, 'd' },
     68    { "remove-debug",    0, 0, 'D' },
    6669    { "version",         0, 0, 'v' },
    6770    { "help",            0, 0, 'h' },
     
    8588      opts->tty = g_strdup(optarg);
    8689      break;
     90    case 'D':
     91      opts->rm_debug = 1;
     92      /* fallthrough */
    8793    case 'd':
    8894      opts->debug = 1;
     
    503509  /* owl global init */
    504510  owl_global_init(&g);
     511  if (opts.rm_debug) unlink(OWL_DEBUG_FILE);
    505512  if (opts.debug) owl_global_set_debug_on(&g);
    506513  if (opts.confdir) owl_global_set_confdir(&g, opts.confdir);
  • perlglue.xs

    r6a71113 rf25df21  
    4343                        rv = owl_function_command(cmd);
    4444                } else {
    45                         /* Ensure this is NULL-terminated. */
    46                         argv = g_new0(const char *, items + 1);
     45                        argv = g_new(const char *, items + 1);
    4746                        argv[0] = cmd;
    4847                        for(i = 1; i < items; i++) {
  • variable.c

    rf203cad rf25df21  
    3030        NULL, NULL, NULL, NULL, NULL, NULL }
    3131
    32 #define OWLVAR_STRING_FULL(name,default,validset,summary,description,validate,set,get) \
    33         { name, OWL_VARIABLE_STRING, default, 0, validset, summary,description, NULL, \
     32#define OWLVAR_STRING_FULL(name,default,summary,description,validate,set,get) \
     33        { name, OWL_VARIABLE_STRING, default, 0, "<string>", summary,description, NULL, \
    3434        validate, set, NULL, get, NULL, NULL }
    3535
     
    266266                 "" ),
    267267
    268   OWLVAR_STRING_FULL( "tty" /* %OwlVarStub */, "", "<string>", "tty name for zephyr location", "",
     268  OWLVAR_STRING_FULL( "tty" /* %OwlVarStub */, "", "tty name for zephyr location", "",
    269269                      NULL, owl_variable_tty_set, NULL),
    270270
     
    370370               "delete a message right as it came in.\n" ),
    371371
    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 
    437372  /* This MUST be last... */
    438373  { NULL, 0, NULL, 0, NULL, NULL, NULL, NULL,
     
    535470}
    536471
    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 }
    554472
    555473/**************************************************************************/
     
    770688  }
    771689  if (msg && v->get_tostring_fn) {
    772     tostring = v->get_tostring_fn(v, v->get_fn(v));
     690    tostring = v->get_tostring_fn(v, v->val);
    773691    owl_function_makemsg("%s = '%s'", name, tostring);
    774692    g_free(tostring);
     
    808726  v = owl_dict_find_element(d, name);
    809727  if (v == NULL || !v->get_tostring_fn) return NULL;
    810   return v->get_tostring_fn(v, v->get_fn(v));
     728  return v->get_tostring_fn(v, v->val);
    811729}
    812730
  • viewwin.c

    r4fd211f r237d02c  
    150150
    151151  if (!owl_viewwin_search(v, owl_global_get_search_re(&g), consider_current, direction))
    152     owl_function_makemsg("No more matches");
     152    owl_function_error("No more matches");
    153153  return NULL;
    154154}
     
    172172  if (!owl_viewwin_search(data->v, owl_global_get_search_re(&g),
    173173                          consider_current, data->direction))
    174     owl_function_makemsg("No matches");
     174    owl_function_error("No matches");
    175175}
    176176
  • zephyr.c

    rf203cad rcd28517  
    10491049{
    10501050#ifdef HAVE_LIBZEPHYR
     1051  char *exposure, *eset;
     1052  Code_t ret;
     1053
    10511054  ZResetAuthentication();
    10521055
    1053   /* ZSetLocation, and store the default value as the current value */
    1054   owl_global_set_exposure(&g, owl_global_get_default_exposure(&g));
     1056  eset = EXPOSE_REALMVIS;
     1057  exposure = ZGetVariable(zstr("exposure"));
     1058  if (exposure)
     1059    exposure = ZParseExposureLevel(exposure);
     1060  if (exposure)
     1061    eset = exposure;
     1062   
     1063  ret = ZSetLocation(eset);
     1064  if (ret != ZERR_NONE)
     1065    owl_function_error("Error setting location: %s", error_message(ret));
    10551066#endif
    10561067}
     
    11731184  ZInitLocationInfo(zstr(host), zstr(val));
    11741185#endif
    1175 }
    1176 
    1177 const char *owl_zephyr_normalize_exposure(const char *exposure)
    1178 {
    1179   if (exposure == NULL)
    1180     return NULL;
    1181 #ifdef HAVE_LIBZEPHYR
    1182   return ZParseExposureLevel(zstr(exposure));
    1183 #else
    1184   return exposure;
    1185 #endif
    1186 }
    1187 
    1188 int owl_zephyr_set_default_exposure(const char *exposure)
    1189 {
    1190 #ifdef HAVE_LIBZEPHYR
    1191   Code_t ret;
    1192   if (exposure == NULL)
    1193     return -1;
    1194   exposure = ZParseExposureLevel(zstr(exposure));
    1195   if (exposure == NULL)
    1196     return -1;
    1197   ret = ZSetVariable(zstr("exposure"), zstr(exposure)); /* ZSetVariable does file I/O */
    1198   if (ret != ZERR_NONE) {
    1199     owl_function_error("Unable to set default exposure location: %s", error_message(ret));
    1200     return -1;
    1201   }
    1202 #endif
    1203   return 0;
    1204 }
    1205 
    1206 const char *owl_zephyr_get_default_exposure(void)
    1207 {
    1208 #ifdef HAVE_LIBZEPHYR
    1209   const char *exposure = ZGetVariable(zstr("exposure")); /* ZGetVariable does file I/O */
    1210   if (exposure == NULL)
    1211     return EXPOSE_REALMVIS;
    1212   exposure = ZParseExposureLevel(zstr(exposure));
    1213   if (exposure == NULL) /* The user manually entered an invalid value in ~/.zephyr.vars, or something weird happened. */
    1214     return EXPOSE_REALMVIS;
    1215   return exposure;
    1216 #else
    1217   return "";
    1218 #endif
    1219 }
    1220 
    1221 int owl_zephyr_set_exposure(const char *exposure)
    1222 {
    1223 #ifdef HAVE_LIBZEPHYR
    1224   Code_t ret;
    1225   if (exposure == NULL)
    1226     return -1;
    1227   exposure = ZParseExposureLevel(zstr(exposure));
    1228   if (exposure == NULL)
    1229     return -1;
    1230   ret = ZSetLocation(zstr(exposure));
    1231   if (ret != ZERR_NONE) {
    1232     owl_function_error("Unable to set exposure level: %s.", error_message(ret));
    1233     return -1;
    1234   }
    1235 #endif
    1236   return 0;
    12371186}
    12381187 
Note: See TracChangeset for help on using the changeset viewer.