Index: commands.c
===================================================================
--- commands.c	(revision 0a0fb74b83a9ed9c98ab0492bb484850c478d38b)
+++ commands.c	(revision c08c70a8ae70f559969b32d12b418a460bfa0f61)
@@ -2013,5 +2013,5 @@
     owl_function_reply(1, !edit);
   } else if (argc==2 && !strcmp(argv[1], "zaway")) {
-    owl_message *m;
+    const owl_message *m;
     owl_view    *v;
     v = owl_global_get_current_view(&g);    
Index: filter.c
===================================================================
--- filter.c	(revision e19eb97bacd75cf02905ec2b7a6a73b9642b907a)
+++ filter.c	(revision c08c70a8ae70f559969b32d12b418a460bfa0f61)
@@ -189,5 +189,5 @@
  * return 0.
  */
-int owl_filter_message_match(owl_filter *f, owl_message *m)
+int owl_filter_message_match(owl_filter *f, const owl_message *m)
 {
   int ret;
@@ -270,5 +270,5 @@
 #ifdef OWL_INCLUDE_REG_TESTS
 
-int owl_filter_test_string(const char * filt, owl_message *m, int shouldmatch) /* noproto */ {
+int owl_filter_test_string(const char * filt, const owl_message *m, int shouldmatch) /* noproto */ {
   owl_filter f;
   int ok;
Index: filterelement.c
===================================================================
--- filterelement.c	(revision e19eb97bacd75cf02905ec2b7a6a73b9642b907a)
+++ filterelement.c	(revision c08c70a8ae70f559969b32d12b418a460bfa0f61)
@@ -1,5 +1,5 @@
 #include "owl.h"
 
-static const char * owl_filterelement_get_field(owl_message *m, const char * field)
+static const char * owl_filterelement_get_field(const owl_message *m, const char * field)
 {
   const char *match;
@@ -48,15 +48,15 @@
 }
 
-static int owl_filterelement_match_false(owl_filterelement *fe, owl_message *m)
+static int owl_filterelement_match_false(owl_filterelement *fe, const owl_message *m)
 {
   return 0;
 }
 
-static int owl_filterelement_match_true(owl_filterelement *fe, owl_message *m)
+static int owl_filterelement_match_true(owl_filterelement *fe, const owl_message *m)
 {
   return 1;
 }
 
-static int owl_filterelement_match_re(owl_filterelement *fe, owl_message *m)
+static int owl_filterelement_match_re(owl_filterelement *fe, const owl_message *m)
 {
   const char * val = owl_filterelement_get_field(m, fe->field);
@@ -64,5 +64,5 @@
 }
 
-static int owl_filterelement_match_filter(owl_filterelement *fe, owl_message *m)
+static int owl_filterelement_match_filter(owl_filterelement *fe, const owl_message *m)
 {
   owl_filter *subfilter;
@@ -77,5 +77,5 @@
 }
 
-static int owl_filterelement_match_perl(owl_filterelement *fe, owl_message *m)
+static int owl_filterelement_match_perl(owl_filterelement *fe, const owl_message *m)
 {
   const char *subname;
@@ -97,5 +97,5 @@
 }
 
-static int owl_filterelement_match_group(owl_filterelement *fe, owl_message *m)
+static int owl_filterelement_match_group(owl_filterelement *fe, const owl_message *m)
 {
   return owl_filterelement_match(fe->left, m);
@@ -106,5 +106,5 @@
 */
 
-static int owl_filterelement_match_and(owl_filterelement *fe, owl_message *m)
+static int owl_filterelement_match_and(owl_filterelement *fe, const owl_message *m)
 {
   return owl_filterelement_match(fe->left, m) &&
@@ -112,5 +112,5 @@
 }
 
-static int owl_filterelement_match_or(owl_filterelement *fe, owl_message *m)
+static int owl_filterelement_match_or(owl_filterelement *fe, const owl_message *m)
 {
   return owl_filterelement_match(fe->left, m) ||
@@ -118,5 +118,5 @@
 }
 
-static int owl_filterelement_match_not(owl_filterelement *fe, owl_message *m)
+static int owl_filterelement_match_not(owl_filterelement *fe, const owl_message *m)
 {
   return !owl_filterelement_match(fe->left, m);
@@ -276,5 +276,5 @@
 }
 
-int owl_filterelement_match(owl_filterelement *fe, owl_message *m)
+int owl_filterelement_match(owl_filterelement *fe, const owl_message *m)
 {
   if(!fe) return 0;
Index: functions.c
===================================================================
--- functions.c	(revision 0a0fb74b83a9ed9c98ab0492bb484850c478d38b)
+++ functions.c	(revision c08c70a8ae70f559969b32d12b418a460bfa0f61)
@@ -595,5 +595,5 @@
   owl_view *v;
   owl_filter *f = NULL;
-  owl_message *m;
+  const owl_message *m;
 
   v=owl_global_get_current_view(&g);
@@ -648,5 +648,5 @@
   owl_view *v;
   owl_filter *f = NULL;
-  owl_message *m;
+  const owl_message *m;
 
   v=owl_global_get_current_view(&g);
@@ -774,5 +774,5 @@
 {
   int curmsg;
-  owl_message *m;
+  const owl_message *m;
   owl_messagelist *ml;
   owl_view *v;
@@ -1411,5 +1411,5 @@
 void owl_function_info()
 {
-  owl_message *m;
+  const owl_message *m;
   owl_fmtext fm, attrfm;
   owl_view *v;
@@ -1547,5 +1547,5 @@
 {
   owl_view *v;
-  owl_message *m;
+  const owl_message *m;
   owl_style *s;
   owl_fmtext fm;
@@ -1886,5 +1886,5 @@
 {
   char *buff=NULL;
-  owl_message *m;
+  const owl_message *m;
   owl_filter *f;
   
@@ -2109,5 +2109,5 @@
   owl_filter *f;
   int curid=-1, newpos, curmsg;
-  owl_message *curm=NULL;
+  const owl_message *curm=NULL;
 
   v=owl_global_get_current_view(&g);
@@ -2580,5 +2580,5 @@
 {
   owl_view *v;
-  owl_message *m;
+  const owl_message *m;
   char *zperson, *filtname=NULL;
   const char *argv[1];
@@ -2652,5 +2652,5 @@
    * If type=0, uses just class.  If type=1, uses instance as well. */
   owl_view *v;
-  owl_message *m;
+  const owl_message *m;
   const char *cmdprefix, *mclass, *minst;
   char *cmd;
@@ -3567,5 +3567,5 @@
 }
 
-void _owl_function_mark_message(owl_message *m)
+void _owl_function_mark_message(const owl_message *m)
 {
   if (m)
@@ -3575,5 +3575,5 @@
 void owl_function_mark_message()
 {
-  owl_message *m;
+  const owl_message *m;
   owl_view *v;
 
@@ -3595,5 +3595,5 @@
 {
   int marked_id;
-  owl_message *m;
+  const owl_message *m;
   owl_view *v;
 
Index: global.c
===================================================================
--- global.c	(revision 77bced3ebcc3a797dc45daf2049e2a8c6a9bf900)
+++ global.c	(revision c08c70a8ae70f559969b32d12b418a460bfa0f61)
@@ -212,5 +212,5 @@
   g->markedmsgid=i;
   /* i; index of message in the current view.
-  owl_message *m;
+  const owl_message *m;
   owl_view *v;
 
@@ -684,5 +684,5 @@
 }
 
-int owl_global_message_is_puntable(owl_global *g, owl_message *m) {
+int owl_global_message_is_puntable(owl_global *g, const owl_message *m) {
   const owl_list *pl;
   int i, j;
Index: logging.c
===================================================================
--- logging.c	(revision e19eb97bacd75cf02905ec2b7a6a73b9642b907a)
+++ logging.c	(revision c08c70a8ae70f559969b32d12b418a460bfa0f61)
@@ -9,5 +9,5 @@
  * functions in this file as necessary.
  */
-void owl_log_message(owl_message *m) {
+void owl_log_message(const owl_message *m) {
   owl_function_debugmsg("owl_log_message: entering");
 
@@ -37,5 +37,5 @@
 
 /* Return 1 if we should log the given message, otherwise return 0 */
-int owl_log_shouldlog_message(owl_message *m) {
+int owl_log_shouldlog_message(const owl_message *m) {
   owl_filter *f;
 
@@ -70,5 +70,5 @@
 }
 
-void owl_log_zephyr(owl_message *m, FILE *file) {
+void owl_log_zephyr(const owl_message *m, FILE *file) {
     char *tmp;
     tmp=short_zuser(owl_message_get_sender(m));
@@ -82,5 +82,5 @@
 }
 
-void owl_log_aim(owl_message *m, FILE *file) {
+void owl_log_aim(const owl_message *m, FILE *file) {
     fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m));
     fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m));
@@ -93,5 +93,5 @@
 }
 
-void owl_log_jabber(owl_message *m, FILE *file) {
+void owl_log_jabber(const owl_message *m, FILE *file) {
     fprintf(file, "From: <%s> To: <%s>\n",owl_message_get_sender(m), owl_message_get_recipient(m));
     fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m));
@@ -99,5 +99,5 @@
 }
 
-void owl_log_generic(owl_message *m, FILE *file) {
+void owl_log_generic(const owl_message *m, FILE *file) {
     fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m));
     fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m));
@@ -105,5 +105,5 @@
 }
 
-void owl_log_append(owl_message *m, const char *filename) {
+void owl_log_append(const owl_message *m, const char *filename) {
     FILE *file;
     file=fopen(filename, "a");
@@ -124,5 +124,5 @@
 }
 
-void owl_log_outgoing(owl_message *m)
+void owl_log_outgoing(const owl_message *m)
 {
   char filename[MAXPATHLEN], *logpath;
@@ -227,5 +227,5 @@
 }
 
-void owl_log_incoming(owl_message *m)
+void owl_log_incoming(const owl_message *m)
 {
   char filename[MAXPATHLEN], allfilename[MAXPATHLEN], *logpath;
Index: message.c
===================================================================
--- message.c	(revision 1077891a70f9f4c4b766de9b7d6d481d7805bb88)
+++ message.c	(revision c08c70a8ae70f559969b32d12b418a460bfa0f61)
@@ -82,5 +82,5 @@
  * the attribute does not exist
  */
-const char *owl_message_get_attribute_value(owl_message *m, const char *attrname)
+const char *owl_message_get_attribute_value(const owl_message *m, const char *attrname)
 {
   int i, j;
@@ -107,5 +107,5 @@
  * function to indent fmtext.
  */
-void owl_message_attributes_tofmtext(owl_message *m, owl_fmtext *fm) {
+void owl_message_attributes_tofmtext(const owl_message *m, owl_fmtext *fm) {
   int i, j;
   owl_pair *p;
@@ -164,5 +164,5 @@
 }
 
-const char *owl_message_get_class(owl_message *m)
+const char *owl_message_get_class(const owl_message *m)
 {
   const char *class;
@@ -178,5 +178,5 @@
 }
 
-const char *owl_message_get_instance(owl_message *m)
+const char *owl_message_get_instance(const owl_message *m)
 {
   const char *instance;
@@ -192,5 +192,5 @@
 }
 
-const char *owl_message_get_sender(owl_message *m)
+const char *owl_message_get_sender(const owl_message *m)
 {
   const char *sender;
@@ -206,5 +206,5 @@
 }
 
-const char *owl_message_get_zsig(owl_message *m)
+const char *owl_message_get_zsig(const owl_message *m)
 {
   const char *zsig;
@@ -220,5 +220,5 @@
 }
 
-const char *owl_message_get_recipient(owl_message *m)
+const char *owl_message_get_recipient(const owl_message *m)
 {
   /* this is stupid for outgoing messages, we need to fix it. */
@@ -236,5 +236,5 @@
 }
 
-const char *owl_message_get_realm(owl_message *m)
+const char *owl_message_get_realm(const owl_message *m)
 {
   const char *realm;
@@ -250,5 +250,5 @@
 }
 
-const char *owl_message_get_body(owl_message *m)
+const char *owl_message_get_body(const owl_message *m)
 {
   const char *body;
@@ -265,5 +265,5 @@
 }
 
-const char *owl_message_get_opcode(owl_message *m)
+const char *owl_message_get_opcode(const owl_message *m)
 {
   const char *opcode;
@@ -286,5 +286,5 @@
 }
 
-int owl_message_is_loginout(owl_message *m)
+int owl_message_is_loginout(const owl_message *m)
 {
   const char *res;
@@ -295,5 +295,5 @@
 }
 
-int owl_message_is_login(owl_message *m)
+int owl_message_is_login(const owl_message *m)
 {
   const char *res;
@@ -306,5 +306,5 @@
 
 
-int owl_message_is_logout(owl_message *m)
+int owl_message_is_logout(const owl_message *m)
 {
   const char *res;
@@ -321,5 +321,5 @@
 }
 
-int owl_message_is_private(owl_message *m)
+int owl_message_is_private(const owl_message *m)
 {
   const char *res;
@@ -330,5 +330,5 @@
 }
 
-const char *owl_message_get_timestr(owl_message *m)
+const char *owl_message_get_timestr(const owl_message *m)
 {
   if (m->timestr) return(m->timestr);
@@ -361,5 +361,5 @@
 }
 
-int owl_message_is_type(owl_message *m, const char *type) {
+int owl_message_is_type(const owl_message *m, const char *type) {
   const char * t = owl_message_get_attribute_value(m, "type");
   if(!t) return 0;
@@ -367,15 +367,15 @@
 }
 						
-int owl_message_is_type_admin(owl_message *m)
+int owl_message_is_type_admin(const owl_message *m)
 {
   return owl_message_is_type(m, "admin");
 }
 
-int owl_message_is_type_zephyr(owl_message *m)
+int owl_message_is_type_zephyr(const owl_message *m)
 {
   return owl_message_is_type(m, "zephyr");
 }
 
-int owl_message_is_type_aim(owl_message *m)
+int owl_message_is_type_aim(const owl_message *m)
 {
   return owl_message_is_type(m, "aim");
@@ -383,15 +383,15 @@
 
 /* XXX TODO: deprecate this */
-int owl_message_is_type_jabber(owl_message *m)
+int owl_message_is_type_jabber(const owl_message *m)
 {
   return owl_message_is_type(m, "jabber");
 }
 
-int owl_message_is_type_loopback(owl_message *m)
+int owl_message_is_type_loopback(const owl_message *m)
 {
   return owl_message_is_type(m, "loopback");
 }
 
-int owl_message_is_pseudo(owl_message *m)
+int owl_message_is_pseudo(const owl_message *m)
 {
   if (owl_message_get_attribute_value(m, "pseudo")) return(1);
@@ -425,5 +425,5 @@
 }
 
-int owl_message_is_direction_in(owl_message *m)
+int owl_message_is_direction_in(const owl_message *m)
 {
   if (m->direction==OWL_MESSAGE_DIRECTION_IN) return(1);
@@ -431,5 +431,5 @@
 }
 
-int owl_message_is_direction_out(owl_message *m)
+int owl_message_is_direction_out(const owl_message *m)
 {
   if (m->direction==OWL_MESSAGE_DIRECTION_OUT) return(1);
@@ -437,5 +437,5 @@
 }
 
-int owl_message_is_direction_none(owl_message *m)
+int owl_message_is_direction_none(const owl_message *m)
 {
   if (m->direction==OWL_MESSAGE_DIRECTION_NONE) return(1);
@@ -462,5 +462,5 @@
 }
 
-const char *owl_message_get_zwriteline(owl_message *m)
+const char *owl_message_get_zwriteline(const owl_message *m)
 {
   const char *z = owl_message_get_attribute_value(m, "zwriteline");
@@ -474,5 +474,5 @@
 }
 
-int owl_message_is_delete(owl_message *m)
+int owl_message_is_delete(const owl_message *m)
 {
   if (m == NULL) return(0);
@@ -482,10 +482,10 @@
 
 #ifdef HAVE_LIBZEPHYR
-const ZNotice_t *owl_message_get_notice(owl_message *m)
+const ZNotice_t *owl_message_get_notice(const owl_message *m)
 {
   return(&(m->notice));
 }
 #else
-void *owl_message_get_notice(owl_message *m)
+void *owl_message_get_notice(const owl_message *m)
 {
   return(NULL);
@@ -498,5 +498,5 @@
 }
 
-const char *owl_message_get_hostname(owl_message *m)
+const char *owl_message_get_hostname(const owl_message *m)
 {
   return(m->hostname);
@@ -524,5 +524,5 @@
 }
 
-int owl_message_is_personal(owl_message *m)
+int owl_message_is_personal(const owl_message *m)
 {
   owl_filter * f = owl_global_get_filter(&g, "personal");
@@ -534,5 +534,5 @@
 }
 
-int owl_message_is_question(owl_message *m)
+int owl_message_is_question(const owl_message *m)
 {
   if(!owl_message_is_type_admin(m)) return 0;
@@ -541,5 +541,5 @@
 }
 
-int owl_message_is_answered(owl_message *m) {
+int owl_message_is_answered(const owl_message *m) {
   const char *q;
   if(!owl_message_is_question(m)) return 0;
@@ -553,5 +553,5 @@
 }
 
-int owl_message_is_mail(owl_message *m)
+int owl_message_is_mail(const owl_message *m)
 {
   if (owl_message_is_type_zephyr(m)) {
@@ -566,5 +566,5 @@
 
 /* caller must free return value. */
-char *owl_message_get_cc(owl_message *m)
+char *owl_message_get_cc(const owl_message *m)
 {
   const char *cur;
@@ -583,5 +583,5 @@
 
 /* caller must free return value */
-char *owl_message_get_cc_without_recipient(owl_message *m)
+char *owl_message_get_cc_without_recipient(const owl_message *m)
 {
   char *cc, *out, *end, *shortuser, *recip;
@@ -620,10 +620,10 @@
 }
 
-int owl_message_get_id(owl_message *m)
+int owl_message_get_id(const owl_message *m)
 {
   return(m->id);
 }
 
-const char *owl_message_get_type(owl_message *m) {
+const char *owl_message_get_type(const owl_message *m) {
   const char * type = owl_message_get_attribute_value(m, "type");
   if(!type) {
@@ -633,5 +633,5 @@
 }
 
-const char *owl_message_get_direction(owl_message *m) {
+const char *owl_message_get_direction(const owl_message *m) {
   switch (m->direction) {
   case OWL_MESSAGE_DIRECTION_IN:
@@ -657,5 +657,5 @@
 
 
-const char *owl_message_get_login(owl_message *m) {
+const char *owl_message_get_login(const owl_message *m) {
   if (owl_message_is_login(m)) {
     return "login";
@@ -668,5 +668,5 @@
 
 
-const char *owl_message_get_header(owl_message *m) {
+const char *owl_message_get_header(const owl_message *m) {
   return owl_message_get_attribute_value(m, "adminheader");
 }
Index: owl.h
===================================================================
--- owl.h	(revision 64735f070e2e046896d08af6734c2350b0e752a3)
+++ owl.h	(revision c08c70a8ae70f559969b32d12b418a460bfa0f61)
@@ -398,5 +398,5 @@
 
 typedef struct _owl_filterelement {
-  int (*match_message)(struct _owl_filterelement *fe, owl_message *m);
+  int (*match_message)(struct _owl_filterelement *fe, const owl_message *m);
   /* Append a string representation of the filterelement onto buf*/
   void (*print_elt)(struct _owl_filterelement *fe, GString *buf);
Index: perlconfig.c
===================================================================
--- perlconfig.c	(revision 25fb825f0ab7aaffd87d84f2f8c7d7a365b52b70)
+++ perlconfig.c	(revision c08c70a8ae70f559969b32d12b418a460bfa0f61)
@@ -22,5 +22,5 @@
 }
 
-SV *owl_perlconfig_message2hashref(owl_message *m)
+SV *owl_perlconfig_message2hashref(const owl_message *m)
 {
   HV *h, *stash;
@@ -197,5 +197,5 @@
 /* Calls in a scalar context, passing it a hash reference.
    If return value is non-null, caller must free. */
-char *owl_perlconfig_call_with_message(const char *subname, owl_message *m)
+char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m)
 {
   dSP ;
@@ -246,5 +246,5 @@
    If the return value is non-null, the caller must free it.
  */
-char * owl_perlconfig_message_call_method(owl_message *m, const char *method, int argc, const char ** argv)
+char * owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char ** argv)
 {
   dSP;
@@ -408,5 +408,5 @@
 }
 
-void owl_perlconfig_getmsg(owl_message *m, const char *subname)
+void owl_perlconfig_getmsg(const owl_message *m, const char *subname)
 {
   char *ptr = NULL;
@@ -419,5 +419,5 @@
 
 /* Called on all new messages; receivemsg is only called on incoming ones */
-void owl_perlconfig_newmsg(owl_message *m, const char *subname)
+void owl_perlconfig_newmsg(const owl_message *m, const char *subname)
 {
   char *ptr = NULL;
Index: style.c
===================================================================
--- style.c	(revision e19eb97bacd75cf02905ec2b7a6a73b9642b907a)
+++ style.c	(revision c08c70a8ae70f559969b32d12b418a460bfa0f61)
@@ -39,5 +39,5 @@
  * 'fm' should already be be initialzed
  */
-void owl_style_get_formattext(owl_style *s, owl_fmtext *fm, owl_message *m)
+void owl_style_get_formattext(owl_style *s, owl_fmtext *fm, const owl_message *m)
 {
   const char *body;
Index: zephyr.c
===================================================================
--- zephyr.c	(revision 1077891a70f9f4c4b766de9b7d6d481d7805bb88)
+++ zephyr.c	(revision c08c70a8ae70f559969b32d12b418a460bfa0f61)
@@ -570,5 +570,5 @@
  * caller must free the return
  */
-char *owl_zephyr_get_message(const ZNotice_t *n, owl_message *m)
+char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m)
 {
   /* don't let ping messages have a body */
@@ -824,5 +824,5 @@
 #endif
   
-void owl_zephyr_zaway(owl_message *m)
+void owl_zephyr_zaway(const owl_message *m)
 {
 #ifdef HAVE_LIBZEPHYR
