Changeset 2b86d14


Ignore:
Timestamp:
Dec 25, 2003, 10:25:18 AM (20 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
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r280ddc6 r2b86d14  
    1111          messages that are not these"
    1212        Added the 'ignorelogins' variable
     13        Log when outgoing personal message fails
    1314       
    14152.1.1-pre-2
  • 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");
  • zephyr.c

    r701a184 r2b86d14  
    441441      sprintf(buff, "Could not send message to %s: not logged in or subscribing to messages.\n", tmp);
    442442      owl_function_adminmsg("", buff);
     443      if (owl_global_is_logging(&g)) owl_log_outgoing_zephyr_error(tmp, buff);
    443444      owl_free(tmp);
    444445    }
Note: See TracChangeset for help on using the changeset viewer.