Changeset 2b86d14 for logging.c


Ignore:
Timestamp:
Dec 25, 2003, 10:25:18 AM (21 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
81634b6
Parents:
3038d13
Message:
Log when outgoing personal message fails
File:
1 edited

Legend:

Unmodified
Added
Removed
  • logging.c

    r12c35df r2b86d14  
    4949  }
    5050  fprintf(file, "OUTGOING (owl): %s\n%s\n", tobuff, text);
     51  if (text[strlen(text)-1]!='\n') {
     52    fprintf(file, "\n");
     53  }
     54  fclose(file);
     55
     56  owl_free(tobuff);
     57}
     58
     59void owl_log_outgoing_zephyr_error(char *to, char *text)
     60{
     61  FILE *file;
     62  char filename[MAXPATHLEN], *logpath;
     63  char *tobuff, *ptr="";
     64
     65  tobuff=owl_malloc(strlen(to)+20);
     66  strcpy(tobuff, to);
     67
     68  /* chop off a local realm */
     69  ptr=strchr(tobuff, '@');
     70  if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) {
     71    *ptr='\0';
     72  }
     73
     74  /* expand ~ in path names */
     75  logpath = owl_text_substitute(owl_global_get_logpath(&g), "~",
     76                                owl_global_get_homedir(&g));
     77
     78  snprintf(filename, MAXPATHLEN, "%s/%s", logpath, tobuff);
     79  file=fopen(filename, "a");
     80  if (!file) {
     81    owl_function_error("Unable to open file for outgoing logging");
     82    owl_free(logpath);
     83    return;
     84  }
     85  fprintf(file, "ERROR (owl): %s\n%s\n", tobuff, text);
     86  if (text[strlen(text)-1]!='\n') {
     87    fprintf(file, "\n");
     88  }
     89  fclose(file);
     90
     91  snprintf(filename, MAXPATHLEN, "%s/all", logpath);
     92  owl_free(logpath);
     93  file=fopen(filename, "a");
     94  if (!file) {
     95    owl_function_error("Unable to open file for outgoing logging");
     96    return;
     97  }
     98  fprintf(file, "ERROR (owl): %s\n%s\n", tobuff, text);
    5199  if (text[strlen(text)-1]!='\n') {
    52100    fprintf(file, "\n");
Note: See TracChangeset for help on using the changeset viewer.