Index: owl.c
===================================================================
--- owl.c	(revision 0b7082c1518be8fb8e173d6702a8f51fa1a89535)
+++ owl.c	(revision f2d72128d54fe0a3466422505e2ae01e3b137498)
@@ -254,7 +254,4 @@
   owl_style_create_internal(s, "basic", &owl_stylefunc_basic, "Basic message formatting.");
   owl_global_add_style(&g, s);
-  s=owl_malloc(sizeof(owl_style));
-  owl_style_create_internal(s, "oneline", &owl_stylefunc_oneline, "Formats for one-line-per-message");
-  owl_global_add_style(&g, s);
 
   /* setup the default filters */
Index: perlwrap.pm
===================================================================
--- perlwrap.pm	(revision b0c8011c53aca2ee3a18f07e779400df969cbdb3)
+++ perlwrap.pm	(revision f2d72128d54fe0a3466422505e2ae01e3b137498)
@@ -831,8 +831,108 @@
     # newline plus four spaces and that thing.
     $body =~ s/\n(.)/\n    $1/g;
-
+    # Trim trailing newlines.
+    $body =~ s/\n*$//;
     return "    ".$body;
 }
 
+package BarnOwl::Style::OneLine;
+################################################################################
+# Branching point for various formatting functions in this style.
+################################################################################
+use constant BASE_FORMAT => '%s %-13.13s %-11.11s %-12.12s ';
+sub format_message($) {
+  my $m = shift;
+
+#  if ( $m->is_zephyr ) {
+#    return format_zephyr($m);
+#  }
+  if ( $m->is_login ) {
+    return format_login($m);
+  }
+  elsif ( $m->is_ping) {
+    return format_ping($m);
+  }
+  elsif ( $m->is_admin || $m->is_loopback) {
+    return format_local($m);
+  }
+  else {
+    return format_chat($m);
+  }
+}
+
+BarnOwl::_create_style("oneline", "BarnOwl::Style::OneLine::format_message", "Formats for one-line-per-message");
+
+################################################################################
+
+sub format_login($) {
+  my $m = shift;
+  return sprintf(
+    BASE_FORMAT,
+    '<',
+    $m->type,
+    uc( $m->login ),
+    $m->pretty_sender)
+    . ($m->login_extra ? "at ".$m->login_extra : '');
+}
+
+sub format_ping($) {
+  my $m = shift;
+  return sprintf(
+    BASE_FORMAT,
+    '<',
+    $m->type,
+    'PING',
+    $m->pretty_sender)
+}
+
+sub format_chat($)
+{
+  my $m = shift;
+  my $dir = lc($m->{direction});
+  my $dirsym = '-';
+  if ($dir eq 'in') {
+    $dirsym = '<';
+  }
+  elsif ($dir eq 'out') {
+    $dirsym = '>';
+  }
+
+  my $line;
+  if ($m->is_personal) {
+    $line= sprintf(BASE_FORMAT,
+		   $dirsym,
+		   $m->type,
+		   '',
+		   ($dir eq 'out'
+		      ? $m->pretty_recipient
+		      : $m->pretty_sender));
+  }
+  else {
+    $line = sprintf(BASE_FORMAT,
+		    $dirsym,
+		    $m->context,
+		    $m->subcontext,
+		    ($dir eq 'out'
+		       ? $m->pretty_recipient
+		       : $m->pretty_sender));
+  }
+
+  my $body = $m->{body};
+  $body =~ tr/\n/ /;
+  $line .= $body;
+  $line = BarnOwl::Style::boldify($line) if ($m->is_personal && lc($m->direction) eq 'in');
+  return $line;
+}
+
+# Format locally generated messages
+sub format_local($)
+{
+  my $m = shift;
+  my $type = uc($m->{type});
+  my $line = sprintf(BASE_FORMAT, '<', $type, '', '');
+  my $body = $m->{body};
+  $body =~ tr/\n/ /;
+  return $line.$body;
+}
 
 package BarnOwl::Style;
Index: stylefunc.c
===================================================================
--- stylefunc.c	(revision 0b7082c1518be8fb8e173d6702a8f51fa1a89535)
+++ stylefunc.c	(revision f2d72128d54fe0a3466422505e2ae01e3b137498)
@@ -220,132 +220,2 @@
   }
 }
-
-void owl_stylefunc_oneline(owl_fmtext *fm, owl_message *m)
-{
-  char *tmp;
-  char *baseformat="%s %-13.13s %-11.11s %-12.12s ";
-  char *sender, *recip;
-#ifdef HAVE_LIBZEPHYR
-  ZNotice_t *n;
-#endif
-
-  sender=short_zuser(owl_message_get_sender(m));
-  recip=short_zuser(owl_message_get_recipient(m));
-  
-  if (owl_message_is_type_zephyr(m)) {
-#ifdef HAVE_LIBZEPHYR
-    n=owl_message_get_notice(m);
-    
-    owl_fmtext_append_spaces(fm, OWL_TAB);
-
-    if (owl_message_is_loginout(m)) {
-      char *host, *tty;
-      
-      host=owl_message_get_attribute_value(m, "loginhost");
-      tty=owl_message_get_attribute_value(m, "logintty");
-
-      if (owl_message_is_login(m)) {
-	tmp=owl_sprintf(baseformat, "<", owl_message_is_pseudo(m)?"LOGIN-P":"LOGIN", "", sender);
-	owl_fmtext_append_normal(fm, tmp);
-	owl_free(tmp);
-      } else if (owl_message_is_logout(m)) {
-	tmp=owl_sprintf(baseformat, "<", owl_message_is_pseudo(m)?"LOGOUT-P":"LOGOUT", "", sender);
-	owl_fmtext_append_normal(fm, tmp);
-	owl_free(tmp);
-      }
-
-      owl_fmtext_append_normal(fm, "at ");
-      owl_fmtext_append_normal(fm, host ? host : "");
-      owl_fmtext_append_normal(fm, " ");
-      owl_fmtext_append_normal(fm, tty ? tty : "");
-      owl_fmtext_append_normal(fm, "\n");
-
-    } else if (owl_message_is_ping(m)) {
-      tmp=owl_sprintf(baseformat, "<", "PING", "", sender);
-      owl_fmtext_append_normal(fm, tmp);
-      owl_fmtext_append_normal(fm, "\n");
-      owl_free(tmp);
-
-    } else {
-      if (owl_message_is_direction_in(m)) {
-	tmp=owl_sprintf(baseformat, "<", owl_message_get_class(m), owl_message_get_instance(m), sender);
-      } else if (owl_message_is_direction_out(m)) {
-	tmp=owl_sprintf(baseformat, ">", owl_message_get_class(m), owl_message_get_instance(m), recip);
-      } else {
-	tmp=owl_sprintf(baseformat, "-", owl_message_get_class(m), owl_message_get_instance(m), sender);
-      }
-      owl_fmtext_append_normal(fm, tmp);
-      if (tmp) owl_free(tmp);
-      
-      tmp=owl_strdup(owl_message_get_body(m));
-      owl_text_tr(tmp, '\n', ' ');
-      owl_fmtext_append_ztext(fm, tmp);
-      owl_fmtext_append_normal(fm, "\n");
-      if (tmp) owl_free(tmp);
-    }
-      
-    /* make personal messages bold for smaat users */
-    if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES) &&
-	owl_message_is_personal(m) &&
-	owl_message_is_direction_in(m)) {
-      owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD);
-    }
-
-    owl_free(sender);
-    owl_free(recip);
-#endif
-  } else if (owl_message_is_type_aim(m)) {
-    owl_fmtext_append_spaces(fm, OWL_TAB);
-    if (owl_message_is_login(m)) {
-      tmp=owl_sprintf(baseformat, "<", "AIM LOGIN", "", owl_message_get_sender(m));
-      owl_fmtext_append_normal(fm, tmp);
-      owl_fmtext_append_normal(fm, "\n");
-      if (tmp) owl_free(tmp);
-    } else if (owl_message_is_logout(m)) {
-      tmp=owl_sprintf(baseformat, "<", "AIM LOGOUT", "", owl_message_get_sender(m));
-      owl_fmtext_append_normal(fm, tmp);
-      owl_fmtext_append_normal(fm, "\n");
-      if (tmp) owl_free(tmp);
-    } else {
-      if (owl_message_is_direction_in(m)) {
-	tmp=owl_sprintf(baseformat, "<", "AIM", "", owl_message_get_sender(m));
-	owl_fmtext_append_normal(fm, tmp);
-	if (tmp) owl_free(tmp);
-      } else if (owl_message_is_direction_out(m)) {
-	tmp=owl_sprintf(baseformat, ">", "AIM", "", owl_message_get_recipient(m));
-	owl_fmtext_append_normal(fm, tmp);
-	if (tmp) owl_free(tmp);
-      }
-      
-      tmp=owl_strdup(owl_message_get_body(m));
-      owl_text_tr(tmp, '\n', ' ');
-      owl_fmtext_append_normal(fm, tmp);
-      owl_fmtext_append_normal(fm, "\n");
-      if (tmp) owl_free(tmp);
-
-      /* make personal messages bold for smaat users */
-      if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES) && owl_message_is_direction_in(m)) {
-	owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD);
-      }
-    }
-  } else if (owl_message_is_type_admin(m)) {
-    owl_fmtext_append_spaces(fm, OWL_TAB);
-    owl_fmtext_append_normal(fm, "< ADMIN                                  ");
-    
-    tmp=owl_strdup(owl_message_get_body(m));
-    owl_text_tr(tmp, '\n', ' ');
-    owl_fmtext_append_normal(fm, tmp);
-    owl_fmtext_append_normal(fm, "\n");
-    if (tmp) owl_free(tmp);
-  } else {
-    owl_fmtext_append_spaces(fm, OWL_TAB);
-    owl_fmtext_append_normal(fm, "< LOOPBACK                               ");
-    
-    tmp=owl_strdup(owl_message_get_body(m));
-    owl_text_tr(tmp, '\n', ' ');
-    owl_fmtext_append_normal(fm, tmp);
-    owl_fmtext_append_normal(fm, "\n");
-    if (tmp) owl_free(tmp);
-  }    
-
-}
