[240] in bug-owl
Logging when zephyrs don't get through
daemon@ATHENA.MIT.EDU (Arun A Tharuvai)
Sun Jul 27 21:13:52 2003
Date: Sun, 27 Jul 2003 21:13:44 -0400
From: Arun A Tharuvai <aatharuv@MIT.EDU>
To: bug-owl@MIT.EDU, owl-developers@MIT.EDU
Cc: aatharuv@MIT.EDU
Message-ID: <20030728011344.GG19561@multics.mit.edu>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="/9DWx/yDrRhgMJTb"
Content-Disposition: inline
--/9DWx/yDrRhgMJTb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Currently, if a recipient is not receiving personal zephyrs, there are
no indications in owl's logs to that affect. Here's a patch against
current CVS that appends the following error message whenever this
happens:
ERROR while sending (owl): username
Arun
--
Arun A Tharuvai
aatharuv (at) mit (dot) edu
aat (at) alum (dot) mit (dot) edu
--/9DWx/yDrRhgMJTb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="owl.logerror.patch"
Index: logging.c
===================================================================
RCS file: /mit/ktools/src/owl/repository/owl/logging.c,v
retrieving revision 1.11
diff -u -r1.11 logging.c
--- logging.c 3 Jul 2003 00:15:05 -0000 1.11
+++ logging.c 28 Jul 2003 01:10:40 -0000
@@ -6,6 +6,47 @@
static const char fileIdent[] = "$Id: logging.c,v 1.11 2003/07/03 00:15:05 kretch Exp $";
+void owl_log_error(char *to) {
+ FILE *file;
+ char filename[MAXPATHLEN], *logpath;
+ char *tobuff, *ptr="";
+
+ tobuff=owl_malloc(strlen(to)+20);
+ strcpy(tobuff, to);
+
+ /* chop off a local realm */
+ ptr=strchr(tobuff, '@');
+ if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) {
+ *ptr='\0';
+ }
+
+ /* expand ~ in path names */
+ logpath = owl_util_substitute(owl_global_get_logpath(&g), "~",
+ owl_global_get_homedir(&g));
+
+ snprintf(filename, MAXPATHLEN, "%s/%s", logpath, tobuff);
+ file=fopen(filename, "a");
+ if (!file) {
+ owl_function_makemsg("Unable to open file for outgoing logging");
+ owl_free(logpath);
+ return;
+ }
+ fprintf(file, "ERROR while sending (owl): %s\n\n", tobuff);
+ fclose(file);
+
+ snprintf(filename, MAXPATHLEN, "%s/all", logpath);
+ owl_free(logpath);
+ file=fopen(filename, "a");
+ if (!file) {
+ owl_function_makemsg("Unable to open file for outgoing logging");
+ return;
+ }
+ fprintf(file, "ERROR while sending (owl): %s\n\n", tobuff);
+ fclose(file);
+
+ owl_free(tobuff);
+}
+
void owl_log_outgoing_zephyr(char *to, char *text) {
FILE *file;
char filename[MAXPATHLEN], *logpath;
Index: zephyr.c
===================================================================
RCS file: /mit/ktools/src/owl/repository/owl/zephyr.c,v
retrieving revision 1.24
diff -u -r1.24 zephyr.c
--- zephyr.c 6 Jul 2003 22:42:38 -0000 1.24
+++ zephyr.c 28 Jul 2003 00:57:45 -0000
@@ -434,6 +434,7 @@
tmp = short_zuser(retnotice->z_recipient);
owl_function_makemsg("%s: Not logged in or subscribing to messages.",
tmp);
+ owl_log_error(tmp);
owl_free(tmp);
}
} else {
--/9DWx/yDrRhgMJTb--