[1176] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[D-O-H] r1117 - trunk/owl

daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:13:48 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
X-Original-To: nelhage@nelhage.com
To: dirty-owl-hackers@mit.edu
From: nelhage@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Mon, 25 Aug 2008 20:11:13 -0400 (EDT)

Author: nelhage
Date: 2008-08-25 20:11:12 -0400 (Mon, 25 Aug 2008)
New Revision: 1117

Modified:
   trunk/owl/message.c
   trunk/owl/owl.h
Log:
Move 'zwriteline' to a message attribute, not a field in struct owl_message.


Modified: trunk/owl/message.c
===================================================================
--- trunk/owl/message.c	2008-08-23 01:48:20 UTC (rev 1116)
+++ trunk/owl/message.c	2008-08-26 00:11:12 UTC (rev 1117)
@@ -41,7 +41,6 @@
   m->id=owl_global_get_nextmsgid(&g);
   owl_message_set_direction_none(m);
   m->delete=0;
-  m->zwriteline=NULL;
 
   owl_message_set_hostname(m, "");
   owl_list_create(&(m->attributes));
@@ -484,15 +483,14 @@
 
 char *owl_message_get_zwriteline(owl_message *m)
 {
-  if(!m->zwriteline)
-    return "";
-  return(m->zwriteline);
+  char *z = owl_message_get_attribute_value(m, "zwriteline");
+  if (!z) return "";
+  return z;
 }
 
 void owl_message_set_zwriteline(owl_message *m, char *line)
 {
-  if(m->zwriteline) owl_free(m->zwriteline);
-  m->zwriteline=owl_strdup(line);
+  owl_message_set_attribute(m, "zwriteline", line);
 }
 
 int owl_message_is_delete(owl_message *m)
@@ -859,8 +857,6 @@
     owl_message_set_attribute(m, "isauto", "");
   }
 
-  m->zwriteline=owl_strdup("");
-
   /* save the hostname */
   owl_function_debugmsg("About to do gethostbyaddr");
   hent=gethostbyaddr((char *) &(n->z_uid.zuid_addr), sizeof(n->z_uid.zuid_addr), AF_INET);
@@ -941,8 +937,6 @@
     owl_message_set_realm(m, owl_zephyr_get_realm());
   }
 
-  m->zwriteline=owl_strdup("");
-
   owl_message_set_body(m, "<uninitialized>");
 
   /* save the hostname */
@@ -974,7 +968,7 @@
   }
   owl_message_set_opcode(m, owl_zwrite_get_opcode(&z));
   owl_message_set_realm(m, owl_zwrite_get_realm(&z)); /* also a hack, but not here */
-  m->zwriteline=owl_strdup(line);
+  owl_message_set_zwriteline(m, line);
   owl_message_set_body(m, body);
   owl_message_set_zsig(m, zsig);
   
@@ -1015,7 +1009,6 @@
   }
 #endif
   if (m->timestr) owl_free(m->timestr);
-  if (m->zwriteline) owl_free(m->zwriteline);
 
   /* free all the attributes */
   j=owl_list_get_size(&(m->attributes));

Modified: trunk/owl/owl.h
===================================================================
--- trunk/owl/owl.h	2008-08-23 01:48:20 UTC (rev 1116)
+++ trunk/owl/owl.h	2008-08-26 00:11:12 UTC (rev 1117)
@@ -341,7 +341,6 @@
   owl_list attributes;            /* this is a list of pairs */
   char *timestr;
   time_t time;
-  char *zwriteline;
 } owl_message;
 
 #define OWL_FMTEXT_CACHE_SIZE 1000


home help back first fref pref prev next nref lref last post