Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r99ac28a r287c634  
    12231223void G_GNUC_PRINTF(1, 2) owl_function_debugmsg(const char *fmt, ...)
    12241224{
     1225  char *tmpbuff;
    12251226  FILE *file;
    12261227  time_t now;
     
    12371238  now = time(NULL);
    12381239
    1239   fprintf(file, "[%d -  %.24s - %lds]: ",
    1240           (int) getpid(), ctime(&now), now - owl_global_get_starttime(&g));
     1240  tmpbuff = owl_util_time_to_timestr(localtime(&now));
     1241  fprintf(file, "[%d -  %s - %lds]: ",
     1242          (int) getpid(), tmpbuff, now - owl_global_get_starttime(&g));
     1243  g_free(tmpbuff);
    12411244  vfprintf(file, fmt, ap);
    12421245  putc('\n', file);
     
    14301433#ifdef HAVE_LIBZEPHYR
    14311434    if (owl_message_is_direction_in(m)) {
    1432       char *tmpbuff;
     1435      char *tmpbuff, *tmpbuff2;
    14331436      int i, fields;
    14341437
     
    14761479
    14771480        for (i = 0; i < fields; i++) {
    1478           tmpbuff = owl_zephyr_get_field_as_utf8(n, i + 1);
    1479 
    1480           g_strdelimit(tmpbuff, "\n", '~');
    1481           g_strdelimit(tmpbuff, "\r", '!');
    1482 
    1483           owl_fmtext_appendf_normal(&fm, "  Field %i   : %s\n", i + 1, tmpbuff);
    1484           g_free(tmpbuff);
     1481          tmpbuff = owl_zephyr_get_field_as_utf8(n, i + 1);
     1482          tmpbuff2 = owl_text_indent(tmpbuff, 14, false);
     1483          owl_fmtext_appendf_normal(&fm, "  Field %i   : %s\n", i + 1, tmpbuff2);
     1484          g_free(tmpbuff2);
     1485          g_free(tmpbuff);
    14851486        }
    1486         owl_fmtext_appendf_normal(&fm, "  Default Fm: %s\n", n->z_default_format);
     1487        tmpbuff = owl_text_indent(n->z_default_format, 14, false);
     1488        owl_fmtext_appendf_normal(&fm, "  Default Fm: %s\n", tmpbuff);
     1489        g_free(tmpbuff);
    14871490      }
    14881491
     
    17611764void owl_function_status(void)
    17621765{
     1766  char *tmpbuff;
    17631767  char buff[MAXPATHLEN+1];
    17641768  time_t start;
     
    17881792  owl_fmtext_append_normal(&fm, "\n");
    17891793
    1790   owl_fmtext_appendf_normal(&fm, "  Startup Time: %s", ctime(&start));
     1794  tmpbuff = owl_util_time_to_timestr(localtime(&start));
     1795  owl_fmtext_appendf_normal(&fm, "  Startup Time: %s\n", tmpbuff);
     1796  g_free(tmpbuff);
    17911797
    17921798  up=owl_global_get_runtime(&g);
     
    21262132
    21272133/* Create a new filter, or replace an existing one
    2128  * with a new definition.
     2134 * with a new definition. Returns true on success.
    21292135 */
    2130 void owl_function_create_filter(int argc, const char *const *argv)
     2136bool owl_function_create_filter(int argc, const char *const *argv)
    21312137{
    21322138  owl_filter *f;
     
    21362142  if (argc < 2) {
    21372143    owl_function_error("Wrong number of arguments to filter command");
    2138     return;
     2144    return false;
    21392145  }
    21402146
     
    21462152  if (!strcmp(argv[1], "all")) {
    21472153    owl_function_error("You may not change the 'all' filter.");
    2148     return;
     2154    return false;
    21492155  }
    21502156
     
    21542160    if (!f) {
    21552161      owl_function_error("The filter '%s' does not exist.", argv[1]);
    2156       return;
     2162      return false;
    21572163    }
    21582164    if (owl_util_string_to_color(argv[3])==OWL_COLOR_INVALID) {
    21592165      owl_function_error("The color '%s' is not available.", argv[3]);
    2160       return;
     2166      return false;
    21612167    }
    21622168    owl_filter_set_fgcolor(f, owl_util_string_to_color(argv[3]));
    21632169    owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    2164     return;
     2170    return false;
    21652171  }
    21662172  if (argc==4 && !strcmp(argv[2], "-b")) {
     
    21682174    if (!f) {
    21692175      owl_function_error("The filter '%s' does not exist.", argv[1]);
    2170       return;
     2176      return false;
    21712177    }
    21722178    if (owl_util_string_to_color(argv[3])==OWL_COLOR_INVALID) {
    21732179      owl_function_error("The color '%s' is not available.", argv[3]);
    2174       return;
     2180      return false;
    21752181    }
    21762182    owl_filter_set_bgcolor(f, owl_util_string_to_color(argv[3]));
    21772183    owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    2178     return;
     2184    return true;
    21792185  }
    21802186
     
    21832189  if (f == NULL) {
    21842190    owl_function_error("Invalid filter");
    2185     return;
     2191    return false;
    21862192  }
    21872193
     
    22042210  }
    22052211  owl_mainwin_redisplay(owl_global_get_mainwin(&g));
     2212  return true;
    22062213}
    22072214
     
    24552462  /* if it already exists then go with it.  This lets users override */
    24562463  if (owl_global_get_filter(&g, filtname)) {
    2457     return(g_strdup(filtname));
     2464    return filtname;
    24582465  }
    24592466
     
    34093416  char *buff;
    34103417
    3411   now=time(NULL);
    3412   date=g_strdup(ctime(&now));
    3413   date[strlen(date)-1]='\0';
     3418  now = time(NULL);
     3419  date = owl_util_time_to_timestr(localtime(&now));
    34143420
    34153421  buff = g_strdup_printf("%s %s", date, string);
Note: See TracChangeset for help on using the changeset viewer.