Index: ChangeLog
===================================================================
--- ChangeLog	(revision 8262340da7afa4c7f9e0d5bdcfee0e8006bf087d)
+++ ChangeLog	(revision ecd5dc5ca65a64da2e84de5dd1f997d246afd294)
@@ -33,4 +33,13 @@
 	  with stale tickets
 	Added some hooks for malloc debugging
+	M-p is bound to 'view personal' by default
+	loadsubs and loadloginsubs only print messages if in interactive
+	  mode
+	added the 'alert_filter' variable, defaults to 'none'.
+	added the 'alert_action' variable, which is an owl command that
+	  will be executed when new messages arive that match the
+	  alert_filter
+	added the 'term' command which takes the 'raise' and 'deiconify'
+	  options.  It assumes xterm for now.
 	
 1.2.8
Index: commands.c
===================================================================
--- commands.c	(revision 79337483b401f9ac599edc5c0c685cc574abc45a)
+++ commands.c	(revision ecd5dc5ca65a64da2e84de5dd1f997d246afd294)
@@ -61,4 +61,15 @@
   OWLCMD_ALIAS("exit", "quit"),
   OWLCMD_ALIAS("q",    "quit"),
+
+  OWLCMD_ARGS("term", owl_command_term, OWL_CTX_ANY,
+	      "control the terminal",
+	      "term raise\n"
+	      "term deiconify\n",
+	      ""),
+
+  OWLCMD_VOID("nop", owl_command_nop, OWL_CTX_ANY,
+	      "do nothing",
+	      "",
+	      ""),
   
   OWLCMD_ARGS("start-command", owl_command_start_command, OWL_CTX_INTERACTIVE,
@@ -750,4 +761,7 @@
 }
 
+void owl_command_nop() {
+}
+
 char *owl_command_help(int argc, char **argv, char *buff) {
   if (argc!=2) {
@@ -1168,19 +1182,30 @@
   if (argc<2) {
     owl_function_makemsg("Need at least one argument to debug command");
-    return NULL;
+    return(NULL);
   }
 
   if (!owl_global_is_debug_fast(&g)) {
     owl_function_makemsg("Debugging is not turned on");
-    return NULL;
+    return(NULL);
   }
 
   owl_function_debugmsg(argv[1]);
-  return NULL;
-}
-
-char *owl_command_ktest(int argc, char **argv, char *buff) {
-  owl_function_popless_text("foobar");
-  return NULL;
+  return(NULL);
+}
+
+char *owl_command_term(int argc, char **argv, char *buff) {
+  if (argc<2) {
+    owl_function_makemsg("Need at least one argument to the term command");
+    return(NULL);
+  }
+
+  if (!strcmp(argv[1], "raise")) {
+    owl_function_xterm_raise();
+  } else if (!strcmp(argv[1], "deiconify")) {
+    owl_function_xterm_deiconify();
+  } else {
+    owl_function_makemsg("Uknown terminal subcommand");
+  }
+  return(NULL);
 }
 
Index: context.c
===================================================================
--- context.c	(revision 10b866d633f70e1c8778b601ad1cc1b6596e8563)
+++ context.c	(revision ecd5dc5ca65a64da2e84de5dd1f997d246afd294)
@@ -44,4 +44,7 @@
 }
 
+int owl_context_is_interactive(owl_context *ctx) {
+  return(ctx->mode & OWL_CTX_INTERACTIVE)?1:0;
+}
 
 void owl_context_set_startup(owl_context *ctx) {
Index: functions.c
===================================================================
--- functions.c	(revision 8262340da7afa4c7f9e0d5bdcfee0e8006bf087d)
+++ functions.c	(revision ecd5dc5ca65a64da2e84de5dd1f997d246afd294)
@@ -515,5 +515,8 @@
 void owl_function_loadsubs(char *file) {
   int ret;
+
   ret=owl_zephyr_loadsubs(file);
+
+  if (!owl_context_is_interactive(owl_global_get_context(&g))) return;
   if (ret==0) {
     owl_function_makemsg("Subscribed to messages from file.");
@@ -527,5 +530,8 @@
 void owl_function_loadloginsubs(char *file) {
   int ret;
+
   ret=owl_zephyr_loadloginsubs(file);
+
+  if (!owl_context_is_interactive(owl_global_get_context(&g))) return;
   if (ret==0) {
     owl_function_makemsg("Subscribed to login messages from file.");
@@ -2625,2 +2631,22 @@
   }
 }
+
+void owl_function_xterm_raise() {
+  char buff[10];
+
+  buff[0]=0x1b;
+  buff[1]='[';
+  buff[2]='5';
+  buff[3]='t';
+  write(fileno(stdout), buff, 4);
+}
+
+void owl_function_xterm_deiconify() {
+  char buff[10];
+
+  buff[0]=0x1b;
+  buff[1]='[';
+  buff[2]='1';
+  buff[3]='t';
+  write(fileno(stdout), buff, 4);
+}
Index: global.c
===================================================================
--- global.c	(revision 8262340da7afa4c7f9e0d5bdcfee0e8006bf087d)
+++ global.c	(revision ecd5dc5ca65a64da2e84de5dd1f997d246afd294)
@@ -90,15 +90,28 @@
 
 void _owl_global_setup_windows(owl_global *g) {
-  int lines, cols, typwin_lines;
-
-  lines=g->lines;
+  int cols, typwin_lines;
+
   cols=g->cols;
-  typwin_lines = owl_global_get_typwin_lines(g);
+  typwin_lines=owl_global_get_typwin_lines(g);
 
   /* set the new window sizes */
   g->recwinlines=g->lines-(typwin_lines+2);
+  if (g->recwinlines<1) {
+    /* this will screw things up.  I'm not sure what to do yet,
+       but this is better than nothing */
+    /* g->recwinlines=1; */
+  }
 
   /* create the new windows */
   g->recwin=newwin(g->recwinlines, cols, 0, 0);
+  if (g->recwin==NULL) {
+    owl_function_debugmsg("\n\nI just received an error on creating a new receive window\n");
+    owl_function_debugmsg("newwin was called with arguments (%i, %i, 0, 0) and returned NULL\n",
+	   g->recwinlines, cols);
+    endwin();
+
+    exit(50);
+  }
+      
   g->sepwin=newwin(1, cols, g->recwinlines, 0);
   g->msgwin=newwin(1, cols, g->recwinlines+1, 0);
@@ -375,11 +388,6 @@
   }
 
-  /*
-  char buff[1024];
-  sprintf(buff, "New size is %i lines, %i cols.\n", size.ws_row, size.ws_col);
-  owl_function_makemsg(buff);
-  */
+  owl_function_debugmsg("New size is %i lines, %i cols.", size.ws_row, size.ws_col);
   owl_function_makemsg("");
-
   g->resizepending=0;
 }
Index: keys.c
===================================================================
--- keys.c	(revision 42abb1086ee4767c4cd8243ba67ee63091f135b0)
+++ keys.c	(revision ecd5dc5ca65a64da2e84de5dd1f997d246afd294)
@@ -203,5 +203,6 @@
   BIND_CMD("M-n", "smartnarrow",      "narrow to a view based on the current message");
   BIND_CMD("M-N", "smartnarrow -i",   "narrow to a view based on the current message, and consider instance pair");
-
+  BIND_CMD("M-p", "view personal", "");
+  
   BIND_CMD("/",   "start-command search ", "start a search command");
   BIND_CMD("?",   "start-command search -r ", "start a revrerse search command");
Index: message.c
===================================================================
--- message.c	(revision 8262340da7afa4c7f9e0d5bdcfee0e8006bf087d)
+++ message.c	(revision ecd5dc5ca65a64da2e84de5dd1f997d246afd294)
@@ -472,9 +472,9 @@
     tmp2=owl_util_stripnewlines(tmp);
     owl_message_set_body(m, tmp2);
-    owl_free(tmp);
     owl_free(tmp2);
   } else {
     owl_message_set_body(m, tmp);
   }
+  owl_free(tmp);
 
   /* if zcrypt is enabled try to decrypt the message */
@@ -743,6 +743,6 @@
 
   /* get the body */
-  body=owl_malloc(strlen(owl_message_get_body(m)+30));
-  strcpy(body, owl_message_get_body(m));
+  body=owl_strdup(owl_message_get_body(m));
+  body=realloc(body, strlen(body)+30);
 
   /* add a newline if we need to */
Index: owl.c
===================================================================
--- owl.c	(revision 79337483b401f9ac599edc5c0c685cc574abc45a)
+++ owl.c	(revision ecd5dc5ca65a64da2e84de5dd1f997d246afd294)
@@ -268,4 +268,5 @@
       struct sockaddr_in from;
       owl_message *m;
+      owl_filter *f;
 
       /* grab a notice, but if we've done 20 without stopping, take
@@ -315,4 +316,12 @@
 	owl_function_beep();
       }
+
+      /* if it matches the alert filter, do the alert action */
+      f=owl_global_get_filter(&g, owl_global_get_alert_filter(&g));
+      if (f && owl_filter_message_match(f, m)) {
+	owl_function_command(owl_global_get_alert_action(&g));
+      }
+
+	 
 
       /* check for burning ears message */
Index: variable.c
===================================================================
--- variable.c	(revision ced25d1dc1145ae51fa851196df56a05dfab4d9f)
+++ variable.c	(revision ecd5dc5ca65a64da2e84de5dd1f997d246afd294)
@@ -187,4 +187,12 @@
 	         "home view to switch to after 'X' and 'V'", 
 		 "SEE ALSO: view, filter\n" ),
+
+  OWLVAR_STRING( "alert_filter" /* %OwlVarStub */, "none",
+		 "filter on which to trigger alert actions",
+		 "" ),
+
+  OWLVAR_STRING( "alert_action" /* %OwlVarStub */, "nop",
+		 "filter on which to trigger alert actions",
+		 "" ),
 
   OWLVAR_STRING_FULL( "tty" /* %OwlVarStub */, "", "tty name for zephyr location", "",
@@ -257,4 +265,5 @@
 	       "to display the requested URL.\n",
 	       "none,netscape,galeon,opera" ),
+
 
   OWLVAR_BOOL( "_followlast" /* %OwlVarStub */, 0,
