Index: owl.c
===================================================================
--- owl.c	(revision cde4a7136ad93073de0f094a953db584fbef859b)
+++ owl.c	(revision 0b7082c1518be8fb8e173d6702a8f51fa1a89535)
@@ -262,9 +262,4 @@
   owl_style_create_internal(s, "basic", &owl_stylefunc_basic, "Basic message formatting.");
   owl_global_add_style(&g, s);
-#if 0
-  s=owl_malloc(sizeof(owl_style));
-  owl_style_create_internal(s, "vt", &owl_stylefunc_vt, "VT message formatting.");
-  owl_global_add_style(&g, s);
-#endif
   s=owl_malloc(sizeof(owl_style));
   owl_style_create_internal(s, "oneline", &owl_stylefunc_oneline, "Formats for one-line-per-message");
Index: owl.h
===================================================================
--- owl.h	(revision 62fdd29eadd2938ccaf92db2c8c290bb10efd323)
+++ owl.h	(revision 88dc766f92b555243e8aa1fdd3dde181bd80a04a)
@@ -67,4 +67,6 @@
 /* logout is defined in FreeBSD. */
 #define logout logout_
+/* aim.h defines bool */
+#define HAS_BOOL
 #include <perl.h>
 #undef logout
@@ -76,5 +78,5 @@
 static const char owl_h_fileIdent[] = "$Id$";
 
-#define STRINGIFY(x) _STRINGIFY(x)
+#define BARNOWL_STRINGIFY(x) _STRINGIFY(x)
 #define _STRINGIFY(x) #x
 
@@ -83,5 +85,5 @@
 #endif
 
-#define OWL_VERSION_STRING "r" STRINGIFY(OWL_SVN_REVNO)
+#define OWL_VERSION_STRING "r" BARNOWL_STRINGIFY(OWL_SVN_REVNO)
 
 
Index: perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
===================================================================
--- perl/modules/IRC/lib/BarnOwl/Module/IRC.pm	(revision b0c8011c53aca2ee3a18f07e779400df969cbdb3)
+++ perl/modules/IRC/lib/BarnOwl/Module/IRC.pm	(revision fe8cad8a54b6d52e321b40cc805adfc2522af7a5)
@@ -28,4 +28,5 @@
 # Hash alias -> BarnOwl::Module::IRC::Connection object
 our %ircnets;
+our %channels;
 
 sub startup {
@@ -210,4 +211,6 @@
     my $conn = get_connection(\@_);
     my $chan = shift or die("Usage: $cmd channel\n");
+    $channels{$chan} ||= [];
+    push @{$channels{$chan}}, $conn;
     $conn->join($chan);
 }
@@ -217,4 +220,5 @@
     my $conn = get_connection(\@_);
     my $chan = get_channel(\@_) || die("Usage: $cmd <channel>\n");
+    $channels{$chan} = [grep {$_ ne $conn} @{$channels{$chan} || []}];
     $conn->part($chan);
 }
@@ -251,4 +255,8 @@
         return get_connection_by_alias(shift @$args);
     }
+    my $channel = $args->[-1];
+    if ($channel =~ /^#/ and $channels{$channel} and @{$channels{$channel}} == 1) {
+        return $channels{$channel}[0];
+    }
     my $m = BarnOwl::getcurmsg();
     if($m && $m->type eq 'IRC') {
Index: stylefunc.c
===================================================================
--- stylefunc.c	(revision 9aba27b09772afc02de6f037fba0f0b73ea2cdac)
+++ stylefunc.c	(revision 0b7082c1518be8fb8e173d6702a8f51fa1a89535)
@@ -221,180 +221,4 @@
 }
 
-void owl_stylefunc_default(owl_fmtext *fm, owl_message *m)
-{
-  char *shorttimestr;
-#ifdef HAVE_LIBZEPHYR
-  char *ptr, *zsigbuff, frombuff[LINE];
-  ZNotice_t *n;
-#endif
-
-  shorttimestr=owl_message_get_shorttimestr(m);
-
-  if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) {
-#ifdef HAVE_LIBZEPHYR
-    n=owl_message_get_notice(m);
-
-    /* edit the from addr for printing */
-    strcpy(frombuff, owl_message_get_sender(m));
-    ptr=strchr(frombuff, '@');
-    if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) {
-      *ptr='\0';
-    }
-    
-    /* set the message for printing */
-    owl_fmtext_append_normal(fm, OWL_TABSTR);
-    
-    if (owl_message_is_ping(m) && owl_message_is_private(m)) {
-      owl_fmtext_append_bold(fm, "PING");
-      owl_fmtext_append_normal(fm, " from ");
-      owl_fmtext_append_bold(fm, frombuff);
-      owl_fmtext_append_normal(fm, "\n");
-    } else 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)) {
-	owl_fmtext_append_bold(fm, "LOGIN");
-      } else if (owl_message_is_logout(m)) {
-	owl_fmtext_append_bold(fm, "LOGOUT");
-      }
-
-      if (owl_message_is_pseudo(m)) owl_fmtext_append_bold(fm, " (PSEUDO)");
-	
-      owl_fmtext_append_normal(fm, " for ");
-      ptr=short_zuser(owl_message_get_instance(m));
-      owl_fmtext_append_bold(fm, ptr);
-      owl_free(ptr);
-      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, " ");
-      owl_fmtext_append_normal(fm, shorttimestr);
-      owl_fmtext_append_normal(fm, "\n");
-    } else {
-      owl_fmtext_append_normal(fm, owl_message_get_class(m));
-      owl_fmtext_append_normal(fm, " / ");
-      owl_fmtext_append_normal(fm, owl_message_get_instance(m));
-      owl_fmtext_append_normal(fm, " / ");
-      owl_fmtext_append_bold(fm, frombuff);
-      if (strcasecmp(owl_message_get_realm(m), ZGetRealm())) {
-	owl_fmtext_append_normal(fm, " {");
-	owl_fmtext_append_normal(fm, owl_message_get_realm(m));
-	owl_fmtext_append_normal(fm, "}");
-      }
-      if (strcmp(owl_message_get_opcode(m), "")) {
-	owl_fmtext_append_normal(fm, " [");
-	owl_fmtext_append_normal(fm, owl_message_get_opcode(m));
-	owl_fmtext_append_normal(fm, "]");
-      }
-
-      owl_fmtext_append_normal(fm, "  ");
-      owl_fmtext_append_normal(fm, shorttimestr);
-
-      /* stick on the zsig */
-      zsigbuff=owl_malloc(strlen(owl_message_get_zsig(m))+30);
-      owl_message_pretty_zsig(m, zsigbuff);
-      owl_fmtext_append_normal(fm, "    (");
-      owl_fmtext_append_ztext(fm, zsigbuff);
-      owl_fmtext_append_normal(fm, ")");
-      owl_fmtext_append_normal(fm, "\n");
-      owl_free(zsigbuff);
-      
-      owl_style_basic_format_body(fm, m);
-      
-      /* make private messages bold for smaat users */
-      if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) {
-	if (owl_message_is_personal(m)) {
-	  owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD);
-	}
-      }
-    }
-    
-#endif
-  } else if (owl_message_is_type_zephyr(m) && owl_message_is_direction_out(m)) {
-    char *zsigbuff, *foo;
-    
-    owl_fmtext_append_normal(fm, OWL_TABSTR);
-    owl_fmtext_append_normal(fm, "Zephyr sent to ");
-    foo=short_zuser(owl_message_get_recipient(m));
-    owl_fmtext_append_normal(fm, foo);
-    owl_free(foo);
-
-    owl_fmtext_append_normal(fm, "  ");
-    owl_fmtext_append_normal(fm, shorttimestr);
-
-    owl_fmtext_append_normal(fm, "  (Zsig: ");
-    
-    zsigbuff=owl_malloc(strlen(owl_message_get_zsig(m))+30);
-    owl_message_pretty_zsig(m, zsigbuff);
-    owl_fmtext_append_ztext(fm, zsigbuff);
-    owl_free(zsigbuff);
-    
-    owl_fmtext_append_normal(fm, ")");
-    owl_fmtext_append_normal(fm, "\n");
-    owl_style_basic_format_body(fm, m);
-  } else if (owl_message_is_type_aim(m)) {
-    if (owl_message_is_loginout(m)) {
-      owl_fmtext_append_normal(fm, OWL_TABSTR);
-      if (owl_message_is_login(m)) {
-	owl_fmtext_append_bold(fm, "AIM LOGIN");
-      } else {
-	owl_fmtext_append_bold(fm, "AIM LOGOUT");
-      }
-      owl_fmtext_append_normal(fm, " for ");
-      owl_fmtext_append_normal(fm, owl_message_get_sender(m));
-      owl_fmtext_append_normal(fm, " ");
-      owl_fmtext_append_normal(fm, shorttimestr);
-      owl_fmtext_append_normal(fm, "\n");
-    } else if (owl_message_is_direction_in(m)) {
-      owl_fmtext_append_bold(fm, OWL_TABSTR);
-      owl_fmtext_append_bold(fm, "AIM from ");
-      owl_fmtext_append_bold(fm, owl_message_get_sender(m));
-      
-      owl_fmtext_append_normal(fm, "  ");
-      owl_fmtext_append_normal(fm, shorttimestr);
-
-      owl_fmtext_append_bold(fm, "\n");
-      owl_style_basic_format_body(fm, m);
-    } else if (owl_message_is_direction_out(m)) {
-      owl_fmtext_append_normal(fm, OWL_TABSTR);
-      owl_fmtext_append_normal(fm, "AIM sent to ");
-      owl_fmtext_append_normal(fm, owl_message_get_recipient(m));
-      owl_fmtext_append_normal(fm, "  ");
-      owl_fmtext_append_normal(fm, shorttimestr);
-      owl_fmtext_append_normal(fm, "\n");
-      owl_style_basic_format_body(fm, m);
-    }
-  } else if (owl_message_is_type_admin(m)) {
-    char *header;
-    
-    header=owl_message_get_attribute_value(m, "adminheader");
-    
-    owl_fmtext_append_normal(fm, OWL_TABSTR);
-    owl_fmtext_append_bold(fm, "OWL ADMIN ");
-    owl_fmtext_append_ztext(fm, header);
-    owl_fmtext_append_normal(fm, "\n");
-    owl_style_basic_format_body(fm, m);
-  } else {
-    char *header;
-    
-    header=owl_sprintf("%s from: %s to: %s",
-		       owl_message_get_type(m),
-		       owl_message_get_sender(m),
-		       owl_message_get_recipient(m));
-    
-    owl_fmtext_append_normal(fm, OWL_TABSTR);
-    owl_fmtext_append_normal(fm, header);
-    owl_fmtext_append_normal(fm, "  ");
-    owl_fmtext_append_normal(fm, shorttimestr);
-    owl_fmtext_append_normal(fm, "\n");
-    owl_style_basic_format_body(fm, m);
-  }
-  owl_free(shorttimestr);
-}
-
 void owl_stylefunc_oneline(owl_fmtext *fm, owl_message *m)
 {
@@ -526,204 +350,2 @@
 
 }
-
-void owl_stylefunc_vt(owl_fmtext *fm, owl_message *m)
-{
-#ifdef HAVE_LIBZEPHYR
-  char *body, *indent, *ptr, frombuff[LINE];
-  owl_fmtext fm_first, fm_other, fm_tmp;
-  ZNotice_t *n;
-#endif
-  char *sender, *hostname, *timestr, *classinst1, *classinst2;
-
-  if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) {
-#ifdef HAVE_LIBZEPHYR
-    n=owl_message_get_notice(m);
-
-    /* get the body */
-    body=owl_malloc(strlen(owl_message_get_body(m))+30);
-    strcpy(body, owl_message_get_body(m));
-    
-    /* add a newline if we need to */
-    if (body[0]!='\0' && body[strlen(body)-1]!='\n') {
-      strcat(body, "\n");
-    }
-
-    owl_fmtext_init_null(&fm_tmp);
-    owl_fmtext_append_ztext(&fm_tmp, body);
-    owl_fmtext_init_null(&fm_first);
-    owl_fmtext_truncate_lines(&fm_tmp, 0, 1, &fm_first);
-
-    /* do the indenting into indent */
-    indent=owl_malloc(strlen(body)+owl_text_num_lines(body)*OWL_MSGTAB+10);
-    owl_text_indent(indent, body, 31);
-
-    owl_fmtext_free(&fm_tmp);
-    owl_fmtext_init_null(&fm_tmp);
-    owl_fmtext_append_ztext(&fm_tmp, indent);
-    owl_fmtext_init_null(&fm_other);
-    owl_fmtext_truncate_lines(&fm_tmp, 1, owl_fmtext_num_lines(&fm_tmp)-1, &fm_other);
-    owl_fmtext_free(&fm_tmp);
-    
-    /* edit the from addr for printing */
-    strcpy(frombuff, owl_message_get_sender(m));
-    ptr=strchr(frombuff, '@');
-    if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) {
-      *ptr='\0';
-    }
-    sender=owl_sprintf("%-9.9s", frombuff);
-
-    hostname=owl_sprintf("%-9.9s", owl_message_get_hostname(m));
-    timestr=owl_strdup("00:00");
-    classinst1=owl_sprintf("<%s>[%s]", owl_message_get_class(m), owl_message_get_instance(m));
-    classinst2=owl_sprintf("%-9.9s", classinst1);
-    
-    /* set the message for printing */
-    owl_fmtext_append_normal(fm, OWL_TABSTR);
-    
-    if (owl_message_is_ping(m) && owl_message_is_private(m)) {
-      owl_fmtext_append_bold(fm, "PING");
-      owl_fmtext_append_normal(fm, " from ");
-      owl_fmtext_append_bold(fm, frombuff);
-      owl_fmtext_append_normal(fm, "\n");
-    } else 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)) {
-	owl_fmtext_append_bold(fm, "LOGIN");
-      } else if (owl_message_is_logout(m)) {
-	owl_fmtext_append_bold(fm, "LOGOUT");
-      }
-      if (owl_message_is_pseudo(m)) owl_fmtext_append_bold(fm, " (PSEUDO)");
-
-      owl_fmtext_append_normal(fm, " for ");
-      ptr=short_zuser(owl_message_get_instance(m));
-      owl_fmtext_append_bold(fm, ptr);
-      owl_free(ptr);
-      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 {
-      owl_fmtext_append_normal(fm, sender);
-      owl_fmtext_append_normal(fm, "|");
-      owl_fmtext_append_normal(fm, hostname);
-      owl_fmtext_append_normal(fm, " ");
-      owl_fmtext_append_normal(fm, timestr);
-      owl_fmtext_append_normal(fm, " ");
-      owl_fmtext_append_normal(fm, classinst2);
-
-      owl_fmtext_append_normal(fm, "   ");
-      owl_fmtext_append_fmtext(fm, &fm_first);
-      owl_fmtext_append_fmtext(fm, &fm_other);
-
-      owl_fmtext_free(&fm_other);
-      owl_fmtext_free(&fm_first);
-      
-      /* make private messages bold for smaat users */
-      if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) {
-	if (owl_message_is_personal(m)) {
-	  owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD);
-	}
-      }
-    }
-
-    owl_free(sender);
-    owl_free(hostname);
-    owl_free(timestr);
-    owl_free(classinst1);
-    owl_free(classinst2);
-    
-    owl_free(body);
-    owl_free(indent);
-#endif
-  } else if (owl_message_is_type_zephyr(m) && owl_message_is_direction_out(m)) {
-    char *indent, *text, *zsigbuff, *foo;
-    
-    text=owl_message_get_body(m);
-    
-    indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10);
-    owl_text_indent(indent, text, OWL_MSGTAB);
-    owl_fmtext_append_normal(fm, OWL_TABSTR);
-    owl_fmtext_append_normal(fm, "Zephyr sent to ");
-    foo=short_zuser(owl_message_get_recipient(m));
-    owl_fmtext_append_normal(fm, foo);
-    owl_free(foo);
-    owl_fmtext_append_normal(fm, "  (Zsig: ");
-    
-    zsigbuff=owl_malloc(strlen(owl_message_get_zsig(m))+30);
-    owl_message_pretty_zsig(m, zsigbuff);
-    owl_fmtext_append_ztext(fm, zsigbuff);
-    owl_free(zsigbuff);
-    
-    owl_fmtext_append_normal(fm, ")");
-    owl_fmtext_append_normal(fm, "\n");
-    owl_fmtext_append_ztext(fm, indent);
-    if (text[strlen(text)-1]!='\n') {
-      owl_fmtext_append_normal(fm, "\n");
-    }
-    
-    owl_free(indent);
-  } else if (owl_message_is_type_aim(m)) {
-    char *indent;
-    
-    if (owl_message_is_loginout(m)) {
-      owl_fmtext_append_normal(fm, OWL_TABSTR);
-      if (owl_message_is_login(m)) {
-	owl_fmtext_append_bold(fm, "AIM LOGIN");
-      } else {
-	owl_fmtext_append_bold(fm, "AIM LOGOUT");
-      }
-      owl_fmtext_append_normal(fm, " for ");
-      owl_fmtext_append_normal(fm, owl_message_get_sender(m));
-      owl_fmtext_append_normal(fm, "\n");
-    } else if (owl_message_is_direction_in(m)) {
-      indent=owl_malloc(strlen(owl_message_get_body(m))+owl_text_num_lines(owl_message_get_body(m))*OWL_MSGTAB+10);
-      owl_text_indent(indent, owl_message_get_body(m), OWL_MSGTAB);
-      owl_fmtext_append_bold(fm, OWL_TABSTR);
-      owl_fmtext_append_bold(fm, "AIM from ");
-      owl_fmtext_append_bold(fm, owl_message_get_sender(m));
-      owl_fmtext_append_bold(fm, "\n");
-      owl_fmtext_append_bold(fm, indent);
-      if (indent[strlen(indent)-1]!='\n') {
-	owl_fmtext_append_normal(fm, "\n");
-      }
-      owl_free(indent);
-    } else if (owl_message_is_direction_out(m)) {
-      indent=owl_malloc(strlen(owl_message_get_body(m))+owl_text_num_lines(owl_message_get_body(m))*OWL_MSGTAB+10);
-      owl_text_indent(indent, owl_message_get_body(m), OWL_MSGTAB);
-      owl_fmtext_append_normal(fm, OWL_TABSTR);
-      owl_fmtext_append_normal(fm, "AIM sent to ");
-      owl_fmtext_append_normal(fm, owl_message_get_recipient(m));
-      owl_fmtext_append_normal(fm, "\n");
-      owl_fmtext_append_ztext(fm, indent);
-      if (indent[strlen(indent)-1]!='\n') {
-	owl_fmtext_append_normal(fm, "\n");
-      }
-      owl_free(indent);
-    }
-  } else if (owl_message_is_type_admin(m)) {
-    char *text, *header, *indent;
-    
-    text=owl_message_get_body(m);
-    header=owl_message_get_attribute_value(m, "adminheader");
-    
-    indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10);
-    owl_text_indent(indent, text, OWL_MSGTAB);
-    owl_fmtext_append_normal(fm, OWL_TABSTR);
-    owl_fmtext_append_bold(fm, "OWL ADMIN ");
-    owl_fmtext_append_ztext(fm, header);
-    owl_fmtext_append_normal(fm, "\n");
-    owl_fmtext_append_ztext(fm, indent);
-    if (text[strlen(text)-1]!='\n') {
-      owl_fmtext_append_normal(fm, "\n");
-    }
-    
-    owl_free(indent);
-  } else {
-
-  }
-}
Index: zephyr.c
===================================================================
--- zephyr.c	(revision 1151f0b8fd4e4263a6af273ce954554f2745add5)
+++ zephyr.c	(revision 60c2e1efd8372f99fd923f856eea1e9cc79d63aa)
@@ -603,5 +603,5 @@
     #define BUFFLEN 1024
     if (retnotice->z_recipient == NULL
-        || *retnotice->z_recipient == NULL
+        || *retnotice->z_recipient == 0
         || *retnotice->z_recipient == '@') {
       char buff[BUFFLEN];
