[775] in BarnOwl Developers

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

[D-O-H] r777 - in branches/barnowl_unicode: . owl owl/debian owl/perl/lib/BarnOwl owl/perl/modules/Jabber/lib/BarnOwl/Module owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber owl/perl/modules/Jabber/lib/Net/Jabber owl/perl/modules/Jabber/lib/XML

daemon@ATHENA.MIT.EDU (asedeno@MIT.EDU)
Thu Oct 29 18:09:35 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: asedeno@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Sun, 23 Dec 2007 19:52:19 -0500 (EST)

Author: asedeno
Date: 2007-12-23 19:52:17 -0500 (Sun, 23 Dec 2007)
New Revision: 777

Added:
   branches/barnowl_unicode/owl/t/
Modified:
   branches/barnowl_unicode/
   branches/barnowl_unicode/owl/
   branches/barnowl_unicode/owl/Makefile.in
   branches/barnowl_unicode/owl/commands.c
   branches/barnowl_unicode/owl/configure.in
   branches/barnowl_unicode/owl/debian/control
   branches/barnowl_unicode/owl/dict.c
   branches/barnowl_unicode/owl/filter.c
   branches/barnowl_unicode/owl/functions.c
   branches/barnowl_unicode/owl/global.c
   branches/barnowl_unicode/owl/keys.c
   branches/barnowl_unicode/owl/message.c
   branches/barnowl_unicode/owl/obarray.c
   branches/barnowl_unicode/owl/owl.c
   branches/barnowl_unicode/owl/owl.h
   branches/barnowl_unicode/owl/perl/lib/BarnOwl/ModuleLoader.pm
   branches/barnowl_unicode/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
   branches/barnowl_unicode/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm
   branches/barnowl_unicode/owl/perl/modules/Jabber/lib/Net/Jabber/MUC.pm
   branches/barnowl_unicode/owl/perl/modules/Jabber/lib/XML/Stream.pm
   branches/barnowl_unicode/owl/perlconfig.c
   branches/barnowl_unicode/owl/perlglue.xs
   branches/barnowl_unicode/owl/perlwrap.pm
   branches/barnowl_unicode/owl/test.h
   branches/barnowl_unicode/owl/tester.c
   branches/barnowl_unicode/owl/util.c
   branches/barnowl_unicode/owl/variable.c
   branches/barnowl_unicode/owl/zephyr.c
   branches/barnowl_unicode/owl/zwrite.c
Log:
Merged revisions 734-776 via svnmerge from 
file:///afs/sipb.mit.edu/project/barnowl/src/svn/trunk

........
  r738 | nelhage | 2007-07-07 17:42:45 -0400 (Sat, 07 Jul 2007) | 3 lines
  
  Make the built-in regression tests output TAP and add a perl wrapper
  to call it.
........
  r739 | nelhage | 2007-07-07 17:43:22 -0400 (Sat, 07 Jul 2007) | 2 lines
  
  Forgot these in the last commit; Make all the tests output TAP
........
  r740 | nelhage | 2007-07-07 19:46:16 -0400 (Sat, 07 Jul 2007) | 2 lines
  
  Clean up an unused var warning.
........
  r741 | nelhage | 2007-07-08 15:37:43 -0400 (Sun, 08 Jul 2007) | 2 lines
  
  Adding a -s switch to change the location of the config dir (~/.owl)
........
  r742 | nelhage | 2007-07-08 15:39:57 -0400 (Sun, 08 Jul 2007) | 2 lines
  
  I don't understand why this didn't commit last time. I blame psvn.
........
  r743 | nelhage | 2007-07-11 22:37:16 -0400 (Wed, 11 Jul 2007) | 3 lines
  
  Don't allow you to go off the end of an empty message list. [fixes:
  #9]
........
  r744 | nelhage | 2007-07-30 18:47:39 -0400 (Mon, 30 Jul 2007) | 2 lines
  
  Fix sending to -c message -i personal
........
  r745 | chmrr | 2007-07-30 20:21:18 -0400 (Mon, 30 Jul 2007) | 3 lines
  
   r20981@zoq-fot-pik:  chmrr | 2007-07-30 20:20:44 -0400
    * message length 0 means no fields
........
  r746 | nelhage | 2007-07-30 20:25:59 -0400 (Mon, 30 Jul 2007) | 4 lines
  
  * zero-len message means no fields
  * Actually use owl_zephyr_get_zsig to get the zsig, which handles 0-
    and 1- field zephyrs correctly.
........
  r747 | nelhage | 2007-07-30 20:29:36 -0400 (Mon, 30 Jul 2007) | 2 lines
  
  Making that last patch actually compile. Bad me.
........
  r748 | nelhage | 2007-08-01 01:42:53 -0400 (Wed, 01 Aug 2007) | 3 lines
  
  owl_message_get_text needs to make sure there's text to return before
  returning it. fixes: #15
........
  r749 | nelhage | 2007-08-01 01:52:08 -0400 (Wed, 01 Aug 2007) | 5 lines
  
  zephyr smartnarrow now uses the ``personal'' filter to decide whether
  to narrow to user or not, and the zephyr-user filter now checks for
  `filter personal' instead of <message,personal,*>.
  closes #2
........
  r750 | nelhage | 2007-08-01 02:27:30 -0400 (Wed, 01 Aug 2007) | 5 lines
  
  Changing the default personal filter to <message,personal,*> for
  zephyr.
  
  refs 2
........
  r751 | nelhage | 2007-08-01 22:58:31 -0400 (Wed, 01 Aug 2007) | 2 lines
  
  Display opcodes with the default style
........
  r752 | nelhage | 2007-08-08 18:01:51 -0400 (Wed, 08 Aug 2007) | 2 lines
  
  Applying ctl's variable shuffling patch for better ANSI C-ness. closes #18
........
  r753 | nelhage | 2007-08-11 01:04:07 -0400 (Sat, 11 Aug 2007) | 3 lines
  
  Implement :punt and :unpunt to punt arbitrary filters, rather than
  just z-triplets. closes #6
........
  r754 | nelhage | 2007-08-11 01:18:37 -0400 (Sat, 11 Aug 2007) | 2 lines
  
  Show non-personal pings like stock owl does. closes #12
........
  r756 | asedeno | 2007-08-17 12:48:37 -0400 (Fri, 17 Aug 2007) | 8 lines
  
  Apply patch from:
  http://rt.cpan.org/Public/Bug/Display.html?id=17484
  
  Fixing problems with jabber servers keeping the same stream id when negotiating TLS.
  
  Thanks to ghudson for tracking this down.
........
  r757 | nelhage | 2007-08-17 17:26:44 -0400 (Fri, 17 Aug 2007) | 4 lines
  
  When we're narrowing to an instance, properly include
  un-instances. This fixes narrowing to any instance that starts with
  ``un-''
........
  r758 | nelhage | 2007-08-27 19:17:20 -0400 (Mon, 27 Aug 2007) | 2 lines
  
  Don't read before the start of the string for an instance
........
  r759 | nelhage | 2007-09-07 00:13:45 -0400 (Fri, 07 Sep 2007) | 3 lines
  
  Adding an explicit -f - to the tar commands for FreeBSD compatibility
  (reported by ecprice)
........
  r760 | ecprice | 2007-09-08 17:33:34 -0400 (Sat, 08 Sep 2007) | 3 lines
  
  Fixes for FreeBSD.
........
  r761 | nelhage | 2007-09-10 20:00:45 -0400 (Mon, 10 Sep 2007) | 3 lines
  
  Use "" instead of `undef' as a default for messages with no reply
  command to hopefully squelch perl warnings.
........
  r762 | nelhage | 2007-09-12 21:37:41 -0400 (Wed, 12 Sep 2007) | 2 lines
  
  Do ~-expansion in :loadsubs. closes #26
........
  r763 | nelhage | 2007-09-12 21:54:51 -0400 (Wed, 12 Sep 2007) | 2 lines
  
  Validate JIDs passed to jmuc join. closes #25
........
  r764 | nelhage | 2007-09-12 22:46:17 -0400 (Wed, 12 Sep 2007) | 2 lines
  
  Show full JIDs for users in non-anonymous JIDs in :jmuc presence. closes #24
........
  r766 | nelhage | 2007-10-02 00:38:49 -0400 (Tue, 02 Oct 2007) | 3 lines
  
  Don't crash if we hit `i' on iso-8859-*. This is not the right
  solution, but at least it doesn't SEGV.
........
  r767 | asedeno | 2007-10-10 15:21:13 -0400 (Wed, 10 Oct 2007) | 1 line
  
  Fixing a typo pointed out by kchen.
........
  r768 | matt | 2007-10-14 17:16:35 -0400 (Sun, 14 Oct 2007) | 1 line
  
  added -m flag to aimwrite
........
  r769 | austein | 2007-10-14 18:16:44 -0400 (Sun, 14 Oct 2007) | 1 line
  
  aimwrite -m displays according to displayoutgoing
........
  r770 | asedeno | 2007-12-06 14:38:05 -0500 (Thu, 06 Dec 2007) | 3 lines
  
  Making usleep call more reasonable.
  Responsiveness seems okay on linerva, no-knife, and darkmatter, and reported good
  on zephyr.
........
  r771 | nelhage | 2007-12-10 21:34:46 -0500 (Mon, 10 Dec 2007) | 2 lines
  
  Add zip as build-depends
........
  r772 | nelhage | 2007-12-10 21:36:25 -0500 (Mon, 10 Dec 2007) | 2 lines
  
  We're not ktools
........
  r773 | nelhage | 2007-12-23 11:32:02 -0500 (Sun, 23 Dec 2007) | 2 lines
  
  bind END in popless windows. closes #41
........
  r774 | chmrr | 2007-12-23 15:16:26 -0500 (Sun, 23 Dec 2007) | 3 lines
  
   r1805@utwig:  chmrr | 2007-12-23 15:15:33 -0500
    * Allow C-r on outgoing messages (useful for CCs)
........
  r775 | chmrr | 2007-12-23 15:16:29 -0500 (Sun, 23 Dec 2007) | 3 lines
  
   r1806@utwig:  chmrr | 2007-12-23 15:15:50 -0500
    * Identify ourselves as barnowl in a couple more places
........



Property changes on: branches/barnowl_unicode
___________________________________________________________________
Name: svnmerge-integrated
   - /trunk:1-733
   + /trunk:1-776


Property changes on: branches/barnowl_unicode/owl
___________________________________________________________________
Name: svk:merge
   - 06e3988a-d725-0410-af47-c5dd11e74598:/local/barnowl:1614
8baf6839-b125-0410-9df9-922793c80423:/local/barnowl:17717
8baf6839-b125-0410-9df9-922793c80423:/local/owl:15641
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/branches/par:19594
fe09232e-8620-0410-8e36-e6b4839e121d:/branches/par:688
   + 06e3988a-d725-0410-af47-c5dd11e74598:/local/barnowl:1806
8baf6839-b125-0410-9df9-922793c80423:/local/barnowl:20981
8baf6839-b125-0410-9df9-922793c80423:/local/owl:15641
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/branches/par:19594
fe09232e-8620-0410-8e36-e6b4839e121d:/branches/par:688

Modified: branches/barnowl_unicode/owl/Makefile.in
===================================================================
--- branches/barnowl_unicode/owl/Makefile.in	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/Makefile.in	2007-12-24 00:52:17 UTC (rev 777)
@@ -44,7 +44,7 @@
 AUTOGEN=$(GEN_C) $(GEN_H)
 #AUTOGEN=$(GEN_C)
 
-HEADERS=$(GEN_H) owl.h config.h
+HEADERS=$(GEN_H) owl.h config.h test.h
 
 %.o: %.c $(HEADERS)
 	$(CC) -c $(CFLAGS) $< -o $@
@@ -126,7 +126,7 @@
 	${INSTALL_DATA} doc/owl.1 ${DESTDIR}${mandir}/man1/barnowl.1
 	${INSTALL} -d ${DESTDIR}${datadir}/lib
 	${INSTALL} -d ${DESTDIR}${datadir}/modules
-	tar -C perl/lib --exclude .svn -c . | tar -C ${DESTDIR}${datadir}/lib -x
+	tar -C perl/lib --exclude .svn -cf - . | tar -C ${DESTDIR}${datadir}/lib -xf -
 	for i in $(PERL_MODULES); do \
 		${INSTALL_DATA} perl/modules/$$i/$$i.par ${DESTDIR}${datadir}/modules/$$i.par; \
 	done

Modified: branches/barnowl_unicode/owl/commands.c
===================================================================
--- branches/barnowl_unicode/owl/commands.c	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/commands.c	2007-12-24 00:52:17 UTC (rev 777)
@@ -131,8 +131,10 @@
 
   OWLCMD_ARGS("aimwrite", owl_command_aimwrite, OWL_CTX_INTERACTIVE,
 	      "send an AIM message",
-	      "aimzwrite <user>",
-	      "Send an aim message to a user.\n"),
+	      "aimwrite <user> [-m <message...>]",
+	      "Send an aim message to a user.\n\n" 
+              "The following options are available:\n\n"
+              "-m    Specifies a message to send without prompting.\n"),
 
   OWLCMD_ARGS("loopwrite", owl_command_loopwrite, OWL_CTX_INTERACTIVE,
 	      "send a loopback message",
@@ -280,6 +282,25 @@
 	      "suppressed to be received again.\n\n"
 	      "SEE ALSO:  zpunt, show zpunts\n"),
 
+  OWLCMD_ARGS("punt", owl_command_punt, OWL_CTX_ANY,
+	      "suppress an arbitrary filter",
+	      "punt <filter-name>",
+	      "punt <filter-text (multiple words)>\n"
+	      "The punt command will supress message to the specified\n"
+	      "filter\n\n"
+	      "SEE ALSO:  unpunt, zpunt, show zpunts\n"),
+
+  OWLCMD_ARGS("unpunt", owl_command_unpunt, OWL_CTX_ANY,
+	      "remove an entry from the punt list",
+	      "zpunt <filter-name>\n"
+	      "zpunt <filter-text>\n"
+	      "zpunt <number>\n",
+	      "The unpunt command will remove an entry from the puntlist.\n"
+	      "The first two forms correspond to the first two forms of the :punt\n"
+	      "command. The latter allows you to remove a specific entry from the\n"
+	      "the list (see :show zpunts)\n\n"
+	      "SEE ALSO:  punt, zpunt, zunpunt, show zpunts\n"),
+
   OWLCMD_VOID("info", owl_command_info, OWL_CTX_INTERACTIVE,
 	      "display detailed information about the current message",
 	      "", ""),
@@ -1866,8 +1887,9 @@
 
 char *owl_command_aimwrite(int argc, char **argv, char *buff)
 {
-  char *newbuff;
-  int i, j;
+  char *newbuff, *recip, **myargv;
+  int i, j, myargc;
+  owl_message *m;
   
   if (!owl_global_is_aimloggedin(&g)) {
     owl_function_makemsg("You are not logged in to AIM.");
@@ -1879,6 +1901,56 @@
     return(NULL);
   }
 
+  myargv=argv;
+  if (argc<0) {
+    owl_function_error("Unbalanced quotes in aimwrite");
+    return(NULL);
+  }
+  myargc=argc;
+  if (myargc && *(myargv[0])!='-') {
+    myargc--;
+    myargv++;
+  }
+  while (myargc) {
+    if (!strcmp(myargv[0], "-m")) {
+      if (myargc<2) {
+	break;
+      }
+
+      /* Once we have -m, gobble up everything else on the line */
+      myargv++;
+      myargc--;
+      newbuff=owl_malloc(1);
+      newbuff=owl_strdup("");
+      while (myargc) {
+	newbuff=realloc(newbuff, strlen(newbuff)+strlen(myargv[0])+5);
+	strcat(newbuff, myargv[0]);
+	strcat(newbuff, " ");
+	myargc--;
+	myargv++;
+      }
+      newbuff[strlen(newbuff)-1]='\0'; /* remove last space */
+
+      recip=owl_malloc(strlen(argv[0])+5);
+      sprintf(recip, "%s ", argv[1]);
+      owl_aim_send_im(recip, newbuff);
+      m=owl_function_make_outgoing_aim(newbuff, recip);
+      if (m) { 
+          owl_global_messagequeue_addmsg(&g, m);
+      } else {
+          owl_function_error("Could not create outgoing AIM message");
+      }
+
+      owl_free(recip);
+      owl_free(newbuff);
+      return(NULL);
+    } else {
+      /* we don't care */
+      myargv++;
+      myargc--;
+    }
+  }
+
   /* squish arguments together to make one screenname w/o spaces for now */
   newbuff=owl_malloc(strlen(buff)+5);
   sprintf(newbuff, "%s ", argv[0]);
@@ -2141,9 +2213,8 @@
   } else if (!strcmp(argv[1], "startup")) {
     char *filename;
     
-    filename=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);
+    filename=owl_global_get_startupfile(&g);
     owl_function_popless_file(filename);
-    owl_free(filename);
   } else if (!strcmp(argv[1], "errors")) {
     owl_function_showerrs();
   } else {
@@ -2294,7 +2365,6 @@
   return NULL;
 }
 
-
 void owl_command_zpunt_and_zunpunt(int argc, char **argv, int type)
 {
   /* if type==0 then zpunt
@@ -2344,6 +2414,52 @@
   return NULL;
 }
 
+char *owl_command_punt(int argc, char **argv, char *buff)
+{
+  owl_command_punt_unpunt(argc, argv, buff, 0);
+  return NULL;
+}
+
+char *owl_command_unpunt(int argc, char **argv, char *buff)
+{
+  owl_command_punt_unpunt(argc, argv, buff, 1);
+  return NULL;
+}
+
+void owl_command_punt_unpunt(int argc, char ** argv, char *buff, int unpunt)
+{
+  owl_list * fl;
+  owl_filter * f;
+  char * text;
+  int i;
+
+  fl = owl_global_get_puntlist(&g);
+  if(argc == 1) {
+    owl_function_show_zpunts();
+  }
+
+  if(argc == 2) {
+    /* Handle :unpunt <number> */
+    if(unpunt && (i=atoi(argv[1])) !=0) {
+      i--;      /* Accept 1-based indexing */
+      if(i < owl_list_get_size(fl)) {
+        f = (owl_filter*)owl_list_get_element(fl, i);
+        owl_list_remove_element(fl, i);
+        owl_filter_free(f);
+        return;
+      } else {
+        owl_function_error("No such filter number: %d", i+1);
+      }
+    }
+    text = owl_sprintf("filter %s", argv[1]);
+  } else {
+    text = skiptokens(buff, 1);
+  }
+
+  owl_function_punt(text, unpunt);
+}
+
+
 char *owl_command_getview(int argc, char **argv, char *buff)
 {
   char *filtname;
@@ -2468,6 +2584,7 @@
 {
   owl_message *m;
   owl_view *v;
+  char *cmd;
 
   v = owl_global_get_current_view(&g);
 
@@ -2486,7 +2603,7 @@
     owl_function_error("You already answered that question.");
     return;
   }
-  char * cmd = owl_message_get_attribute_value(m, "yescommand");
+  cmd = owl_message_get_attribute_value(m, "yescommand");
   if(!cmd) {
     owl_function_error("No yes command!");
     return;
@@ -2501,6 +2618,7 @@
 {
   owl_message *m;
   owl_view *v;
+  char *cmd;
 
   v = owl_global_get_current_view(&g);
 
@@ -2519,7 +2637,7 @@
     owl_function_error("You already answered that question.");
     return;
   }
-  char * cmd = owl_message_get_attribute_value(m, "nocommand");
+  cmd = owl_message_get_attribute_value(m, "nocommand");
   if(!cmd) {
     owl_function_error("No no command!");
     return;

Modified: branches/barnowl_unicode/owl/configure.in
===================================================================
--- branches/barnowl_unicode/owl/configure.in	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/configure.in	2007-12-24 00:52:17 UTC (rev 777)
@@ -32,11 +32,15 @@
 fi
 
 dnl Check for kerberosIV include
-AC_MSG_CHECKING(for /usr/include/kerberosIV)
+AC_MSG_CHECKING(for kerberosIV)
 if test -d /usr/include/kerberosIV; then
         CFLAGS=${CFLAGS}\ -I/usr/include/kerberosIV
         CPPFLAGS=${CPPFLAGS}\ -I/usr/include/kerberosIV
         AC_MSG_RESULT(yes)
+elif test -d /usr/local/include/kerberosIV; then
+        CFLAGS=${CFLAGS}\ -I/usr/local/include/kerberosIV
+        CPPFLAGS=${CPPFLAGS}\ -I/usr/local/include/kerberosIV
+        AC_MSG_RESULT(yes)
 else
         AC_MSG_RESULT(no)
 fi
@@ -101,7 +105,7 @@
    XSUBPPFLAGS=""
 fi
 
-dnl Add LDFLAGS for embeded perl
+dnl Add LDFLAGS for embedded perl
 FOO=`perl -MExtUtils::Embed -e ldopts`
 echo Adding perl LDFLAGS ${FOO}
 LDFLAGS=${LDFLAGS}\ ${FOO}
@@ -116,9 +120,6 @@
 
 
 dnl Checks for typedefs, structures, and compiler characteristics.
-AC_CHECK_FILE(/usr/share/terminfo, AC_DEFINE(TERMINFO, "/usr/share/terminfo", [Have terminfo]),
-  AC_CHECK_FILE(/usr/share/lib/terminfo, AC_DEFINE(TERMINFO, "/usr/share/lib/terminfo", [Have terminfo]),
-  AC_MSG_ERROR(No terminfo found for this system)))
 
 AC_SUBST(XSUBPPDIR)
 AC_SUBST(XSUBPPFLAGS)

Modified: branches/barnowl_unicode/owl/debian/control
===================================================================
--- branches/barnowl_unicode/owl/debian/control	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/debian/control	2007-12-24 00:52:17 UTC (rev 777)
@@ -2,7 +2,7 @@
 Section: net
 Priority: optional
 Maintainer: Sam Hartman <hartmans@debian.org>
-Build-Depends: debhelper (>> 4.0.0), libzephyr-dev (>= 2.1.20010518.SNAPSHOT-7), libncurses5-dev, libkrb5-dev, libperl-dev
+Build-Depends: debhelper (>> 4.0.0), libzephyr-dev (>= 2.1.20010518.SNAPSHOT-7), libncurses5-dev, libkrb5-dev, libperl-dev, zip
 Standards-Version: 3.5.2
 
 Package: barnowl
@@ -11,8 +11,8 @@
 Recommends: zephyr-clients
 Description: A curses-based tty Jabber and Zephyr client.
  An alternative standalone (doesn't use zwgc) Zephyr (instant
- messaging) client.  Also supports Jabber.
+ messaging) client.  Also supports AIM and Jabber.
  Much of the functionality is written in Perl, which is supported as 
  an extension language.
  .
- ktools software -- The 'k' is for Quality!
+ This is a fork of ktools software's owl Zephyr/AIM client

Modified: branches/barnowl_unicode/owl/dict.c
===================================================================
--- branches/barnowl_unicode/owl/dict.c	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/dict.c	2007-12-24 00:52:17 UTC (rev 777)
@@ -151,7 +151,7 @@
   int numfailed=0;
   char *av="aval", *bv="bval", *cv="cval", *dv="dval";
 
-  printf("BEGIN testing owl_dict\n");
+  printf("# BEGIN testing owl_dict\n");
   FAIL_UNLESS("create", 0==owl_dict_create(&d));
   FAIL_UNLESS("insert b", 0==owl_dict_insert_element(&d, "b", (void*)bv, owl_dict_noop_free));
   FAIL_UNLESS("insert d", 0==owl_dict_insert_element(&d, "d", (void*)dv, owl_dict_noop_free));
@@ -178,8 +178,8 @@
   owl_list_free_all(&l, owl_free);
   owl_dict_free_all(&d, NULL);
 
-  if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n");
-  printf("END testing owl_dict (%d failures)\n", numfailed);
+  //  if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n");
+  printf("# END testing owl_dict (%d failures)\n", numfailed);
   return(numfailed);
 }
 

Modified: branches/barnowl_unicode/owl/filter.c
===================================================================
--- branches/barnowl_unicode/owl/filter.c	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/filter.c	2007-12-24 00:52:17 UTC (rev 777)
@@ -62,13 +62,13 @@
 
 static owl_filterelement * owl_filter_parse_primitive_expression(int argc, char **argv, int *next)
 {
+  owl_filterelement *fe, *op;
+  int i = 0, skip;
+
   if(!argc) return NULL;
 
-  owl_filterelement * fe = owl_malloc(sizeof(owl_filterelement));
-  owl_filterelement *op;
-
+  fe = owl_malloc(sizeof(owl_filterelement));
   owl_filterelement_create(fe);
-  int i = 0, skip;
 
   if(!strcasecmp(argv[i], "(")) {
     i++;
@@ -117,7 +117,7 @@
 owl_filterelement * owl_filter_parse_expression(int argc, char **argv, int *next)
 {
   int i = 0, skip;
-  owl_filterelement * op1 = NULL, * op2 = NULL;
+  owl_filterelement * op1 = NULL, * op2 = NULL, *tmp;
 
   op1 = owl_filter_parse_primitive_expression(argc-i, argv+i, &skip);
   i += skip;
@@ -128,7 +128,7 @@
        strcasecmp(argv[i], "or")) break;
     op2 = owl_filter_parse_primitive_expression(argc-i-1, argv+i+1, &skip);
     if(!op2) goto err;
-    owl_filterelement * tmp = owl_malloc(sizeof(owl_filterelement));
+    tmp = owl_malloc(sizeof(owl_filterelement));
     if(!strcasecmp(argv[i], "and")) {
       owl_filterelement_create_and(tmp, op1, op2);
     } else {
@@ -203,8 +203,9 @@
  */
 int owl_filter_message_match(owl_filter *f, owl_message *m)
 {
+  int ret;
   if(!f->root) return 0;
-  int ret = owl_filterelement_match(f->root, m);
+  ret = owl_filterelement_match(f->root, m);
   if(f->polarity) ret = !ret;
   return ret;
 }
@@ -282,19 +283,19 @@
   int ok;
   int failed = 0;
   if(owl_filter_init_fromstring(&f, "test-filter", filt)) {
-    printf("\tFAIL: parse %s\n", filt);
+    printf("not ok can't parse %s\n", filt);
     failed = 1;
     goto out;
   }
   ok = owl_filter_message_match(&f, m);
   if((shouldmatch && !ok) || (!shouldmatch && ok)) {
-    printf("\tFAIL: match %s (got %d, expected %d)\n", filt, ok, shouldmatch);
+    printf("not ok match %s (got %d, expected %d)\n", filt, ok, shouldmatch);
     failed = 1;
   }
  out:
   owl_filter_free(&f);
   if(!failed) {
-    printf("\tok  : %s %s\n", shouldmatch ? "matches" : "doesn't match", filt);
+    printf("ok %s %s\n", shouldmatch ? "matches" : "doesn't match", filt);
   }
   return failed;
 }
@@ -304,9 +305,11 @@
 
 
 int owl_filter_regtest(void) {
-  owl_list_create(&(g.filterlist));
   int numfailed=0;
   owl_message m;
+  owl_filter f1, f2, f3, f4;
+
+  owl_list_create(&(g.filterlist));
   owl_message_init(&m);
   owl_message_set_type_zephyr(&m);
   owl_message_set_direction_in(&m);
@@ -344,8 +347,6 @@
   TEST_FILTER("false and false or true", 1);
   TEST_FILTER("true and false or false", 0);
 
-  owl_filter f1, f2, f3, f4;
-
   owl_filter_init_fromstring(&f1, "f1", "class owl");
   owl_global_add_filter(&g, &f1);
   TEST_FILTER("filter f1", 1);

Modified: branches/barnowl_unicode/owl/functions.c
===================================================================
--- branches/barnowl_unicode/owl/functions.c	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/functions.c	2007-12-24 00:52:17 UTC (rev 777)
@@ -579,6 +579,7 @@
   }
 
   if (i>owl_view_get_size(v)-1) i=owl_view_get_size(v)-1;
+  if (i<0) i=0;
 
   if (!found) {
     owl_function_makemsg("already at last%s message%s%s",
@@ -847,12 +848,14 @@
 void owl_function_loadsubs(char *file)
 {
   int ret, ret2;
-  char *foo;
+  char *foo, *path;
 
   if (file==NULL) {
     ret=owl_zephyr_loadsubs(NULL, 0);
   } else {
-    ret=owl_zephyr_loadsubs(file, 1);
+    path = owl_util_makepath(file);
+    ret=owl_zephyr_loadsubs(path, 1);
+    free(path);
   }
 
   /* for backwards compatibility for now */
@@ -2056,80 +2059,79 @@
     if (owl_message_is_type_zephyr(m)) {
       /* if it's a zephyr we sent, send it out the same way again */
       if (owl_message_is_direction_out(m)) {
-	owl_function_zwrite_setup(owl_message_get_zwriteline(m));
-	owl_global_set_buffercommand(&g, owl_message_get_zwriteline(m));
-	return;
-      }
+          buff = owl_strdup(owl_message_get_zwriteline(m));
+      } else {
 
-      /* Special case a personal reply to a webzephyr user on a class */
-      if ((type==1) && !strcasecmp(owl_message_get_opcode(m), OWL_WEBZEPHYR_OPCODE)) {
-	class=OWL_WEBZEPHYR_CLASS;
-	inst=owl_message_get_sender(m);
-	to=OWL_WEBZEPHYR_PRINCIPAL;
-      } else if (!strcasecmp(owl_message_get_class(m), OWL_WEBZEPHYR_CLASS) && owl_message_is_loginout(m)) {
-	/* Special case LOGIN/LOGOUT notifications on class "webzephyr" */
-	class=OWL_WEBZEPHYR_CLASS;
-	inst=owl_message_get_instance(m);
-	to=OWL_WEBZEPHYR_PRINCIPAL;
-      } else if (owl_message_is_loginout(m)) {
-	/* Normal LOGIN/LOGOUT messages */
-	class="MESSAGE";
-	inst="PERSONAL";
-	to=owl_message_get_sender(m);
-      } else if (type==1) {
-	/* Personal reply */
-	class="MESSAGE";
-	inst="PERSONAL";
-	to=owl_message_get_sender(m);
-      } else {
-	/* General reply */
-	class=owl_message_get_class(m);
-	inst=owl_message_get_instance(m);
-	to=owl_message_get_recipient(m);
-	cc=owl_message_get_cc_without_recipient(m);
-	if (!strcmp(to, "") || !strcmp(to, "*")) {
-	  to="";
-	} else if (to[0]=='@') {
-	  /* leave it, to get the realm */
-	} else {
-	  to=owl_message_get_sender(m);
-	}
+        /* Special case a personal reply to a webzephyr user on a class */
+        if ((type==1) && !strcasecmp(owl_message_get_opcode(m), OWL_WEBZEPHYR_OPCODE)) {
+          class=OWL_WEBZEPHYR_CLASS;
+          inst=owl_message_get_sender(m);
+          to=OWL_WEBZEPHYR_PRINCIPAL;
+        } else if (!strcasecmp(owl_message_get_class(m), OWL_WEBZEPHYR_CLASS) && owl_message_is_loginout(m)) {
+          /* Special case LOGIN/LOGOUT notifications on class "webzephyr" */
+          class=OWL_WEBZEPHYR_CLASS;
+          inst=owl_message_get_instance(m);
+          to=OWL_WEBZEPHYR_PRINCIPAL;
+        } else if (owl_message_is_loginout(m)) {
+          /* Normal LOGIN/LOGOUT messages */
+          class="MESSAGE";
+          inst="PERSONAL";
+          to=owl_message_get_sender(m);
+        } else if (type==1) {
+          /* Personal reply */
+          class="MESSAGE";
+          inst="PERSONAL";
+          to=owl_message_get_sender(m);
+        } else {
+          /* General reply */
+          class=owl_message_get_class(m);
+          inst=owl_message_get_instance(m);
+          to=owl_message_get_recipient(m);
+          cc=owl_message_get_cc_without_recipient(m);
+          if (!strcmp(to, "") || !strcmp(to, "*")) {
+            to="";
+          } else if (to[0]=='@') {
+            /* leave it, to get the realm */
+          } else {
+            to=owl_message_get_sender(m);
+          }
+        }
+
+        /* create the command line */
+        if (!strcasecmp(owl_message_get_opcode(m), "CRYPT")) {
+          buff=owl_strdup("zcrypt");
+        } else {
+          buff = owl_strdup("zwrite");
+        }
+        if (strcasecmp(class, "message")) {
+          buff = owl_sprintf("%s -c %s%s%s", oldbuff=buff, owl_getquoting(class), class, owl_getquoting(class));
+          owl_free(oldbuff);
+        }
+        if (strcasecmp(inst, "personal")) {
+          buff = owl_sprintf("%s -i %s%s%s", oldbuff=buff, owl_getquoting(inst), inst, owl_getquoting(inst));
+          owl_free(oldbuff);
+        }
+        if (*to != '\0') {
+          char *tmp, *oldtmp, *tmp2;
+          tmp=short_zuser(to);
+          if (cc) {
+            tmp = owl_util_uniq(oldtmp=tmp, cc, "-");
+            owl_free(oldtmp);
+            buff = owl_sprintf("%s -C %s", oldbuff=buff, tmp);
+            owl_free(oldbuff);
+          } else {
+            if (owl_global_is_smartstrip(&g)) {
+              tmp2=tmp;
+              tmp=owl_zephyr_smartstripped_user(tmp2);
+              owl_free(tmp2);
+            }
+            buff = owl_sprintf("%s %s", oldbuff=buff, tmp);
+            owl_free(oldbuff);
+          }
+          owl_free(tmp);
+        }
+        if (cc) owl_free(cc);
       }
-	
-      /* create the command line */
-      if (!strcasecmp(owl_message_get_opcode(m), "CRYPT")) {
-	buff=owl_strdup("zcrypt");
-      } else {
-	buff = owl_strdup("zwrite");
-      }
-      if (strcasecmp(class, "message")) {
-	buff = owl_sprintf("%s -c %s%s%s", oldbuff=buff, owl_getquoting(class), class, owl_getquoting(class));
-	owl_free(oldbuff);
-      }
-      if (strcasecmp(inst, "personal")) {
-	buff = owl_sprintf("%s -i %s%s%s", oldbuff=buff, owl_getquoting(inst), inst, owl_getquoting(inst));
-	owl_free(oldbuff);
-      }
-      if (*to != '\0') {
-	char *tmp, *oldtmp, *tmp2;
-	tmp=short_zuser(to);
-	if (cc) {
-	  tmp = owl_util_uniq(oldtmp=tmp, cc, "-");
-	  owl_free(oldtmp);
-	  buff = owl_sprintf("%s -C %s", oldbuff=buff, tmp);
-	  owl_free(oldbuff);
-	} else {
-	  if (owl_global_is_smartstrip(&g)) {
-	    tmp2=tmp;
-	    tmp=owl_zephyr_smartstripped_user(tmp2);
-	    owl_free(tmp2);
-	  }
-	  buff = owl_sprintf("%s %s", oldbuff=buff, tmp);
-	  owl_free(oldbuff);
-	}
-	owl_free(tmp);
-      }
-      if (cc) owl_free(cc);
     } else if (owl_message_is_type_aim(m)) {
       /* aim */
       if (owl_message_is_direction_out(m)) {
@@ -2556,6 +2558,8 @@
 
   for (i=0; i<j; i++) {
     f=owl_list_get_element(fl, i);
+    snprintf(buff, sizeof(buff), "[% 2d] ", i+1);
+    owl_fmtext_append_normal(&fm, buff);
     owl_filter_print(f, buff);
     owl_fmtext_append_normal(&fm, buff);
   }
@@ -2621,7 +2625,7 @@
   argbuff = owl_malloc(len);
   sprintf(argbuff, "class ^(un)*%s(\\.d)*$", tmpclass);
   if (tmpinstance) {
-    sprintf(argbuff, "%s and ( instance ^%s(\\.d)*$ )", argbuff, tmpinstance);
+    sprintf(argbuff, "%s and ( instance ^(un)*%s(\\.d)*$ )", argbuff, tmpinstance);
   }
   owl_free(tmpclass);
   if (tmpinstance) owl_free(tmpinstance);
@@ -2669,9 +2673,9 @@
   f=owl_malloc(sizeof(owl_filter));
 
   argbuff=owl_malloc(strlen(longuser)+1000);
-  sprintf(argbuff, "( type ^zephyr$ and ( class ^message$ and instance ^personal$ and ");
+  sprintf(argbuff, "( type ^zephyr$ and filter personal and ");
   sprintf(argbuff, "%s ( ( direction ^in$ and sender ^%s$ ) or ( direction ^out$ and recipient ^%s$ ) ) )", argbuff, longuser, longuser);
-  sprintf(argbuff, "%s or ( ( class ^login$ ) and ( sender ^%s$ ) ) )", argbuff, longuser);
+  sprintf(argbuff, "%s or ( ( class ^login$ ) and ( sender ^%s$ ) )", argbuff, longuser);
 
   owl_filter_init_fromstring(f, filtname, argbuff);
 
@@ -2799,6 +2803,7 @@
   owl_view *v;
   owl_message *m;
   char *zperson, *filtname=NULL;
+  char *argv[1];
   
   v=owl_global_get_current_view(&g);
   m=owl_view_get_element(v, owl_global_get_curmsg(&g));
@@ -2830,7 +2835,7 @@
 
   /* narrow personal and login messages to the sender or recip as appropriate */
   if (owl_message_is_type_zephyr(m)) {
-    if (owl_message_is_private(m) || owl_message_is_loginout(m)) {
+    if (owl_message_is_personal(m) || owl_message_is_loginout(m)) {
       if (owl_message_is_direction_in(m)) {
         zperson=short_zuser(owl_message_get_sender(m));
       } else {
@@ -2857,7 +2862,6 @@
   }
 
   /* pass it off to perl */
-  char *argv[1];
   if(type) {
     argv[0] = "-i";
   };
@@ -3015,16 +3019,9 @@
  */
 void owl_function_zpunt(char *class, char *inst, char *recip, int direction)
 {
-  owl_filter *f;
-  owl_list *fl;
   char *buff;
   char *quoted;
-  int ret, i, j;
 
-  fl=owl_global_get_puntlist(&g);
-
-  /* first, create the filter */
-  f=owl_malloc(sizeof(owl_filter));
   buff=owl_malloc(strlen(class)+strlen(inst)+strlen(recip)+100);
   strcpy(buff, "class");
   if (!strcmp(class, "*")) {
@@ -3055,10 +3052,23 @@
     sprintf(buff, "%s and recipient ^%s$", buff, quoted);
     owl_free(quoted);
   }
-  
-  owl_function_debugmsg("About to filter %s", buff);
-  ret=owl_filter_init_fromstring(f, "punt-filter", buff);
+
+  owl_function_punt(buff, direction);
   owl_free(buff);
+}
+
+void owl_function_punt(char *filter, int direction)
+{
+  owl_filter *f;
+  owl_list *fl;
+  int ret, i, j;
+  fl=owl_global_get_puntlist(&g);
+
+  /* first, create the filter */
+  f=malloc(sizeof(owl_filter));
+
+  owl_function_debugmsg("About to filter %s", filter);
+  ret=owl_filter_init_fromstring(f, "punt-filter", filter);
   if (ret) {
     owl_function_error("Error creating filter for zpunt");
     owl_filter_free(f);
@@ -3069,6 +3079,7 @@
   j=owl_list_get_size(fl);
   for (i=0; i<j; i++) {
     if (owl_filter_equiv(f, owl_list_get_element(fl, i))) {
+      owl_function_debugmsg("found an equivalent punt filter");
       /* if we're punting, then just silently bow out on this duplicate */
       if (direction==0) {
 	owl_filter_free(f);
@@ -3079,11 +3090,13 @@
       if (direction==1) {
 	owl_filter_free(owl_list_get_element(fl, i));
 	owl_list_remove_element(fl, i);
+        owl_filter_free(f);
 	return;
       }
     }
   }
 
+  owl_function_debugmsg("punting");
   /* If we're punting, add the filter to the global punt list */
   if (direction==0) {
     owl_list_append_element(fl, f);
@@ -3460,17 +3473,15 @@
   FILE *file;
   char *filename;
 
-  filename=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);
+  filename=owl_global_get_startupfile(&g);
   file=fopen(filename, "a");
   if (!file) {
     owl_function_error("Error opening startupfile for new command");
-    owl_free(filename);
     return;
   }
 
   /* delete earlier copies */
   owl_util_file_deleteline(filename, buff, 1);
-  owl_free(filename);
 
   /* add this line */
   fprintf(file, "%s\n", buff);
@@ -3482,9 +3493,8 @@
 void owl_function_delstartup(char *buff)
 {
   char *filename;
-  filename=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);
+  filename=owl_global_get_startupfile(&g);
   owl_util_file_deleteline(filename, buff, 1);
-  owl_free(filename);
 }
 
 /* Execute owl commands from the given filename.  If the filename
@@ -3496,9 +3506,8 @@
   char buff[LINE];
 
   if (!filename) {
-    filename=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);
+    filename=owl_global_get_startupfile(&g);
     file=fopen(filename, "r");
-    owl_free(filename);
   } else {
     file=fopen(filename, "r");
   }

Modified: branches/barnowl_unicode/owl/global.c
===================================================================
--- branches/barnowl_unicode/owl/global.c	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/global.c	2007-12-24 00:52:17 UTC (rev 777)
@@ -17,6 +17,7 @@
 void owl_global_init(owl_global *g) {
   struct hostent *hent;
   char hostname[MAXHOSTNAMELEN];
+  char *cd;
 
   g->malloced=0;
   g->freed=0;
@@ -85,6 +86,12 @@
   /* TODO: come back later and check passwd file first */
   g->homedir=owl_strdup(getenv("HOME"));
 
+  g->confdir = NULL;
+  g->startupfile = NULL;
+  cd = owl_sprintf("%s/%s", g->homedir, OWL_CONFIG_DIR);
+  owl_global_set_confdir(g, cd);
+  owl_free(cd);
+
   owl_messagelist_create(&(g->msglist));
   owl_mainwin_init(&(g->mw));
   owl_popwin_init(&(g->pw));
@@ -318,6 +325,26 @@
   return("/");
 }
 
+char *owl_global_get_confdir(owl_global *g) {
+  if (g->confdir) return(g->confdir);
+  return("/");
+}
+
+/*
+ * Setting this also sets startupfile to confdir/startup
+ */
+void owl_global_set_confdir(owl_global *g, char *cd) {
+  free(g->confdir);
+  g->confdir = owl_strdup(cd);
+  free(g->startupfile);
+  g->startupfile = owl_sprintf("%s/startup", cd);
+}
+
+char *owl_global_get_startupfile(owl_global *g) {
+  if(g->startupfile) return(g->startupfile);
+  return("/");
+}
+
 int owl_global_get_direction(owl_global *g) {
   return(g->direction);
 }

Modified: branches/barnowl_unicode/owl/keys.c
===================================================================
--- branches/barnowl_unicode/owl/keys.c	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/keys.c	2007-12-24 00:52:17 UTC (rev 777)
@@ -179,6 +179,7 @@
   BIND_CMD("<",           "popless:scroll-to-top", "");
   BIND_CMD("M-<",         "popless:scroll-to-top", "");
 
+  BIND_CMD("END",         "popless:scroll-to-bottom", "");
   BIND_CMD(">",           "popless:scroll-to-bottom", "");
   BIND_CMD("M->",         "popless:scroll-to-bottom", "");
 

Modified: branches/barnowl_unicode/owl/message.c
===================================================================
--- branches/barnowl_unicode/owl/message.c	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/message.c	2007-12-24 00:52:17 UTC (rev 777)
@@ -26,10 +26,10 @@
 
 owl_fmtext_cache * owl_message_next_fmtext() /*noproto*/
 {
+    owl_fmtext_cache * f = fmtext_cache_next;
     if(fmtext_cache_next->message != NULL) {
         owl_message_invalidate_format(fmtext_cache_next->message);
     }
-    owl_fmtext_cache * f = fmtext_cache_next;
     fmtext_cache_next++;
     if(fmtext_cache_next - fmtext_cache == OWL_FMTEXT_CACHE_SIZE)
         fmtext_cache_next = fmtext_cache;
@@ -120,6 +120,11 @@
   for (i=0; i<j; i++) {
     p=owl_list_get_element(&(m->attributes), i);
     buff=owl_sprintf("  %-15.15s: %-35.35s\n", owl_pair_get_key(p), owl_pair_get_value(p));
+    if(buff == NULL) {
+      buff=owl_sprintf("  %-15.15s: %-35.35s\n", owl_pair_get_key(p), "<error>");
+      if(buff == NULL)
+        buff=owl_strdup("   <error>\n");
+    }
     owl_fmtext_append_normal(fm, buff);
     owl_free(buff);
   }
@@ -416,6 +421,7 @@
 
 char *owl_message_get_text(owl_message *m)
 {
+  owl_message_format(m);
   return(owl_fmtext_get_text(&(m->fmtext->fmtext)));
 }
 
@@ -565,8 +571,9 @@
 }
 
 int owl_message_is_answered(owl_message *m) {
+  char *q;
   if(!owl_message_is_question(m)) return 0;
-  char * q = owl_message_get_attribute_value(m, "question");
+  q = owl_message_get_attribute_value(m, "question");
   if(!q) return 0;
   return !strcmp(q, "answered");
 }
@@ -812,6 +819,7 @@
 {
   struct hostent *hent;
   char *ptr, *tmp, *tmp2;
+  int len;
 
   owl_message_init(m);
   
@@ -840,7 +848,7 @@
   } else {
     owl_message_set_opcode(m, "");
   }
-  owl_message_set_zsig(m, n->z_message);
+  owl_message_set_zsig(m, owl_zephyr_get_zsig(n, &len));
 
   if ((ptr=strchr(n->z_recipient, '@'))!=NULL) {
     owl_message_set_realm(m, ptr+1);

Modified: branches/barnowl_unicode/owl/obarray.c
===================================================================
--- branches/barnowl_unicode/owl/obarray.c	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/obarray.c	2007-12-24 00:52:17 UTC (rev 777)
@@ -79,7 +79,7 @@
   owl_obarray oa;
   owl_obarray_init(&oa);
 
-  printf("BEGIN testing owl_obarray\n");
+  printf("# BEGIN testing owl_obarray\n");
 
   p = owl_obarray_insert(&oa, "test");
   FAIL_UNLESS("returned string is equal", p && !strcmp(p, "test"));
@@ -95,7 +95,7 @@
   p = owl_obarray_find(&oa, "nothere");
   FAIL_UNLESS("Didn't find a string that isn't there", p == NULL);
 
-  printf("END testing owl_obarray (%d failures)\n", numfailed);
+  printf("# END testing owl_obarray (%d failures)\n", numfailed);
 
   return numfailed;
 }

Modified: branches/barnowl_unicode/owl/owl.c
===================================================================
--- branches/barnowl_unicode/owl/owl.c	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/owl.c	2007-12-24 00:52:17 UTC (rev 777)
@@ -64,6 +64,13 @@
 
 owl_global g;
 
+char * owl_get_datadir() {
+    char * datadir = getenv("BARNOWL_DATA_DIR");
+    if(datadir != NULL)
+        return strchr(datadir, '=') + 1;
+    return DATADIR;
+}
+
 int main(int argc, char **argv, char **env)
 {
   WINDOW *recwin, *sepwin, *typwin, *msgwin;
@@ -73,6 +80,7 @@
   int newmsgs, nexttimediff;
   struct sigaction sigact;
   char *configfile, *tty, *perlout, *perlerr, **argvsave, buff[LINE], startupmsg[LINE];
+  char *confdir;
   owl_filter *f;
   owl_style *s;
   time_t nexttime, now;
@@ -87,6 +95,7 @@
   argcsave=argc;
   argvsave=argv;
   configfile=NULL;
+  confdir = NULL;
   tty=NULL;
   debug=0;
   initialsubs=1;
@@ -104,22 +113,31 @@
       argc--;
     } else if (!strcmp(argv[0], "-c")) {
       if (argc<2) {
-	fprintf(stderr, "Too few arguments to -c\n");
-	usage();
-	exit(1);
+        fprintf(stderr, "Too few arguments to -c\n");
+        usage();
+        exit(1);
       }
       configfile=argv[1];
       argv+=2;
       argc-=2;
     } else if (!strcmp(argv[0], "-t")) {
       if (argc<2) {
-	fprintf(stderr, "Too few arguments to -t\n");
-	usage();
-	exit(1);
+        fprintf(stderr, "Too few arguments to -t\n");
+        usage();
+        exit(1);
       }
       tty=argv[1];
       argv+=2;
       argc-=2;
+    } else if (!strcmp(argv[0], "-s")){
+      if (argc<2) {
+        fprintf(stderr, "Too few arguments to -s\n");
+        usage();
+        exit(1);
+      }
+      confdir = argv[1];
+      argv+=2;
+      argc-=2;
     } else if (!strcmp(argv[0], "-d")) {
       debug=1;
       argv++;
@@ -130,7 +148,7 @@
       argv++;
       argc--;
     } else if (!strcmp(argv[0], "-v")) {
-      printf("This is owl version %s\n", OWL_VERSION_STRING);
+      printf("This is barnowl version %s\n", OWL_VERSION_STRING);
       exit(0);
     } else {
       fprintf(stderr, "Uknown argument\n");
@@ -162,9 +180,7 @@
 
   /* screen init */
   if (!getenv("TERMINFO")) {
-    sprintf(buff, "TERMINFO=%s", TERMINFO);
-    putenv(buff);
-    owl_function_debugmsg("startup: setting TERMINFO to %s", TERMINFO);
+    owl_function_debugmsg("startup: Not setting TERMINFO");
   } else {
     owl_function_debugmsg("startup: leaving TERMINFO as %s from envrionment", getenv("TERMINFO"));
   }
@@ -194,7 +210,8 @@
 
   /* owl global init */
   owl_global_init(&g);
-    if (debug) owl_global_set_debug_on(&g);
+  if (debug) owl_global_set_debug_on(&g);
+  if (confdir) owl_global_set_confdir(&g, confdir);
   owl_function_debugmsg("startup: first available debugging message");
   owl_global_set_startupargs(&g, argcsave, argvsave);
   owl_global_set_haveaim(&g);
@@ -216,9 +233,8 @@
 
   /* create the owl directory, in case it does not exist */
   owl_function_debugmsg("startup: creating owl directory, if not present");
-  dir=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_CONFIG_DIR);
+  dir=owl_global_get_confdir(&g);
   mkdir(dir, S_IRWXU);
-  owl_free(dir);
 
   /* set the tty, either from the command line, or by figuring it out */
   owl_function_debugmsg("startup: setting tty name");
@@ -262,7 +278,9 @@
    *  included.  Also, there should be an %aimme% */
   owl_function_debugmsg("startup: creating default filters");
   f=owl_malloc(sizeof(owl_filter));
-  owl_filter_init_fromstring(f, "personal", "isprivate ^true$");
+  owl_filter_init_fromstring(f, "personal", "isprivate ^true$ and ( not type ^zephyr$"
+                             " or ( class ^message and"
+                             " ( instance ^personal$ or instance ^urgent$ ) ) )");
   owl_list_append_element(owl_global_get_filterlist(&g), f);
 
   f=owl_malloc(sizeof(owl_filter));
@@ -532,7 +550,7 @@
      * as quickly as possbile */
     j=wgetch(typwin);
     if (j==ERR) {
-      usleep(10);
+      usleep(10000);
     } else {
       owl_global_update_lastinputtime(&g);
       /* find and activate the current keymap.
@@ -699,14 +717,15 @@
 
 void usage()
 {
-  fprintf(stderr, "Owl version %s\n", OWL_VERSION_STRING);
-  fprintf(stderr, "Usage: owl [-n] [-d] [-D] [-v] [-h] [-c <configfile>] [-t <ttyname>]\n");
+  fprintf(stderr, "Barnowl version %s\n", OWL_VERSION_STRING);
+  fprintf(stderr, "Usage: barnowl [-n] [-d] [-D] [-v] [-h] [-c <configfile>] [-s <confdir>] [-t <ttyname>]\n");
   fprintf(stderr, "  -n      don't load zephyr subscriptions\n");
   fprintf(stderr, "  -d      enable debugging\n");
   fprintf(stderr, "  -D      enable debugging and delete previous debug file\n");
-  fprintf(stderr, "  -v      print the Owl version number and exit\n");
+  fprintf(stderr, "  -v      print the Barnowl version number and exit\n");
   fprintf(stderr, "  -h      print this help message\n");
   fprintf(stderr, "  -c      specify an alternate config file\n");
+  fprintf(stderr, "  -s      specify an alternate config dir (default ~/.owl)\n");
   fprintf(stderr, "  -t      set the tty name\n");
 }
 

Modified: branches/barnowl_unicode/owl/owl.h
===================================================================
--- branches/barnowl_unicode/owl/owl.h	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/owl.h	2007-12-24 00:52:17 UTC (rev 777)
@@ -63,7 +63,10 @@
 /* Perl and curses don't play nice. */
 #ifdef OWL_PERL
 typedef void WINDOW;
+/* logout is defined in FreeBSD. */
+#define logout logout_
 #include <perl.h>
+#undef logout
 #include "XSUB.h"
 #else
 typedef void SV;
@@ -559,6 +562,8 @@
   int typwinactive;
   char *thishost;
   char *homedir;
+  char *confdir;
+  char *startupfile;
   int direction;
   int zaway;
   char *cur_zaway_msg;

Modified: branches/barnowl_unicode/owl/perl/lib/BarnOwl/ModuleLoader.pm
===================================================================
--- branches/barnowl_unicode/owl/perl/lib/BarnOwl/ModuleLoader.pm	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/perl/lib/BarnOwl/ModuleLoader.pm	2007-12-24 00:52:17 UTC (rev 777)
@@ -5,14 +5,17 @@
 
 use lib (BarnOwl::get_data_dir() . "/modules/");
 use PAR (BarnOwl::get_data_dir() . "/modules/*.par");
-use PAR ($ENV{HOME} . "/.owl/modules/*.par");
+use PAR (BarnOwl::get_config_dir() . "/modules/*.par");
 
 sub load_all {
     my %modules;
     my @modules;
+
+    my @moddirs = ();
+    push @moddirs, BarnOwl::get_data_dir() . "/modules";
+    push @moddirs, BarnOwl::get_config_dir() . "/modules";
     
-    for my $dir ( BarnOwl::get_data_dir() . "/modules",
-                  $ENV{HOME} . "/.owl/modules" ) {
+    for my $dir (@moddirs) {
         opendir(my $dh, $dir) or next;
         while(defined(my $f = readdir($dh))) {
             next if $f =~ /^\./;

Modified: branches/barnowl_unicode/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm
===================================================================
--- branches/barnowl_unicode/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm	2007-12-24 00:52:17 UTC (rev 777)
@@ -51,6 +51,9 @@
 
 Leave a MUC. The MUC is specified in the same form as L</FindMUC>
 
+Returns true if successful, false if this connection was not in the
+named MUC.
+
 =cut
 
 sub MUCLeave {
@@ -60,6 +63,7 @@
 
     $muc->Leave();
     $self->{_BARNOWL_MUCS} = [grep {$_->BaseJID ne $muc->BaseJID} $self->MUCs];
+    return 1;
 }
 
 =head2 FindMUC ARGS

Modified: branches/barnowl_unicode/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
===================================================================
--- branches/barnowl_unicode/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm	2007-12-24 00:52:17 UTC (rev 777)
@@ -580,15 +580,17 @@
     $muc = shift @ARGV
       or die("Usage: jmuc join MUC [-p password] [-a account]");
 
+    die("Error: Must specify a fully-qualified MUC name (e.g. barnowl\@conference.mit.edu)\n")
+        unless $muc =~ /@/;
     $muc = Net::Jabber::JID->new($muc);
     $jid = Net::Jabber::JID->new($jid);
     $muc->SetResource($jid->GetJID('full')) unless length $muc->GetResource();
 
     $conn->getConnectionFromJID($jid)->MUCJoin(JID      => $muc,
-                                                  Password => $password,
-                                                  History  => {
-                                                      MaxChars => 0
-                                                     });
+                                               Password => $password,
+                                               History  => {
+                                                   MaxChars => 0
+                                                  });
     return;
 }
 
@@ -598,8 +600,11 @@
     $muc = shift @args if scalar @args;
     die("Usage: jmuc part MUC [-a account]") unless $muc;
 
-    $conn->getConnectionFromJID($jid)->MUCLeave(JID => $muc);
-    queue_admin_msg("$jid has left $muc.");
+    if($conn->getConnectionFromJID($jid)->MUCLeave(JID => $muc)) {
+        queue_admin_msg("$jid has left $muc.");
+    } else {
+        die("Error: Not joined to $muc");
+    }
 }
 
 sub jmuc_invite {
@@ -638,10 +643,27 @@
 sub jmuc_presence_single {
     my $m = shift;
     my @jids = $m->Presence();
-    return "JIDs present in " . $m->BaseJID . "\n\t"
-      . join("\n\t", map {$_->GetResource}@jids) . "\n";
+
+    my $presence = "JIDs present in " . $m->BaseJID;
+    if($m->Anonymous) {
+        $presence .= " [anonymous MUC]";
+    }
+    $presence .= "\n\t";
+    $presence .= join("\n\t", map {pp_jid($m, $_);} @jids) . "\n";
+    return $presence;
 }
 
+sub pp_jid {
+    my ($m, $jid) = @_;
+    my $nick = $jid->GetResource;
+    my $full = $m->GetFullJID($jid);
+    if($full && $full ne $nick) {
+        return "$nick ($full)";
+    } else {
+        return "$nick";
+    }
+}
+
 sub jmuc_presence {
     my ( $jid, $muc, @args ) = @_;
 
@@ -903,6 +925,7 @@
     my %jhash = j2hash( $j, { direction => 'in',
                               sid => $sid } );
     $jhash{type} = 'admin';
+    
     BarnOwl::queue_message( BarnOwl::Message->new(%jhash) );
 }
 
@@ -1133,14 +1156,14 @@
         }
     }
     elsif ( $jtype eq 'normal' ) {
-        $props{replycmd}  = undef;
+        $props{replycmd}  = "";
         $props{private} = 1;
     }
     elsif ( $jtype eq 'headline' ) {
-        $props{replycmd} = undef;
+        $props{replycmd} = "";
     }
     elsif ( $jtype eq 'error' ) {
-        $props{replycmd} = undef;
+        $props{replycmd} = "";
         $props{body}     = "Error "
           . $props{error_code}
           . " sending to "

Modified: branches/barnowl_unicode/owl/perl/modules/Jabber/lib/Net/Jabber/MUC.pm
===================================================================
--- branches/barnowl_unicode/owl/perl/modules/Jabber/lib/Net/Jabber/MUC.pm	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/perl/modules/Jabber/lib/Net/Jabber/MUC.pm	2007-12-24 00:52:17 UTC (rev 777)
@@ -63,6 +63,7 @@
     $self->{CONNECTION} = $args{connection};
     $self->{JID} = $args{jid};
     $self->{PRESENCE} = { };
+    $self->{ANONYMOUS} = 1;
 
     bless($self, $class);
 
@@ -187,7 +188,15 @@
     if($type eq 'unavailable') {
         delete $self->{PRESENCE}->{$from->GetJID('full')};
     } elsif($type eq 'available') {
-        $self->{PRESENCE}->{$from->GetJID('full')} = $from;
+        $self->{PRESENCE}->{$from->GetJID('full')} = {ROOMNICK => $from};
+        my $x = $presence->GetX('http://jabber.org/protocol/muc#user');
+        if($x && $x->DefinedItem()) {
+            my $item = $x->GetItem();
+            if($item->DefinedJID()) {
+                $self->{PRESENCE}->{$from->GetJID('full')}->{FULLJID} = $item->GetJID();
+                $self->{ANONYMOUS} = 0;
+            }
+        }
     }
 }
 
@@ -206,6 +215,24 @@
     return exists $self->{PRESENCE}->{$jid};
 }
 
+=head2 GetFullJID roomjid
+
+Given the roomnick of a user in the MUC, return their full NIC if the
+MUC makes it available. If the MUC is anonymous or the user does not
+exist in the MUC, return undef.
+
+=cut
+
+sub GetFullJID {
+    my $self = shift;
+    my $jid = shift;
+
+    $jid = $jid->GetJID('full') if UNIVERSAL::isa($jid, 'Net::Jabber::JID');
+    my $pres = $self->{PRESENCE}->{$jid};
+    return unless $pres;
+    return $pres->{FULLJID};
+}
+
 =head2 Presence
 
 Returns a list of JIDS in the MUC, as Net::Jabber::JID objects
@@ -214,7 +241,18 @@
 
 sub Presence {
     my $self = shift;
-    return values %{$self->{PRESENCE}};
+    return map {$_->{ROOMNICK}} values %{$self->{PRESENCE}};
 }
 
+=head2 Anonymous
+
+Returns true if the MUC is anonymous (hides participants real JIDs)
+
+=cut
+
+sub Anonymous {
+    my $self = shift;
+    return $self->{ANONYMOUS};
+}
+
 1;

Modified: branches/barnowl_unicode/owl/perl/modules/Jabber/lib/XML/Stream.pm
===================================================================
--- branches/barnowl_unicode/owl/perl/modules/Jabber/lib/XML/Stream.pm	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/perl/modules/Jabber/lib/XML/Stream.pm	2007-12-24 00:52:17 UTC (rev 777)
@@ -1160,7 +1160,8 @@
         $self->{SOCKETS}->{*STDIN} = $sid;
     }
 
-    delete($self->{SIDS}->{$currsid});
+    # 08.04.05(Fri) slipstream@yandex.ru for compapility with ejabberd since it reuses stream id
+    delete($self->{SIDS}->{$currsid}) unless ($currsid eq $sid);
 
     if (exists($self->GetRoot($sid)->{version}) &&
         ($self->GetRoot($sid)->{version} ne ""))

Modified: branches/barnowl_unicode/owl/perlconfig.c
===================================================================
--- branches/barnowl_unicode/owl/perlconfig.c	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/perlconfig.c	2007-12-24 00:52:17 UTC (rev 777)
@@ -136,6 +136,7 @@
   I32 count, len;
   char *key,*val;
   HV * hash;
+  struct tm tm;
 
   hash = (HV*)SvRV(msg);
 
@@ -161,7 +162,6 @@
       owl_message_set_zwriteline(m, val);
     } else if (!strcmp(key, "time")) {
       m->timestr = owl_strdup(val);
-      struct tm tm;
       strptime(val, "%a %b %d %T %Y", &tm);
       m->time = mktime(&tm);
     } else {
@@ -444,6 +444,7 @@
 {
   int i, count;
   char * ret = NULL;
+  SV *rv;
   STRLEN n_a;
   dSP;
 
@@ -466,7 +467,7 @@
   } else {
     if(count != 1)
       croak("Perl command %s returned more than one value!", cmd->name);
-    SV * rv = POPs;
+    rv = POPs;
     if(SvTRUE(rv)) {
       ret = owl_strdup(SvPV(rv, n_a));
     }
@@ -487,12 +488,12 @@
 {
   SV *cb = (SV*)(e->cbdata);
   unsigned int n_a;
+  dSP;
+
   if(cb == NULL) {
     owl_function_error("Perl callback is NULL!");
   }
 
-  dSP;
-
   ENTER;
   SAVETMPS;
 
@@ -515,9 +516,9 @@
 
 void owl_perlconfig_mainloop()
 {
+  dSP;
   if (!owl_perlconfig_is_function("BarnOwl::Hooks::_mainloop_hook"))
     return;
-  dSP ;
   PUSHMARK(SP) ;
   call_pv("BarnOwl::Hooks::_mainloop_hook", G_DISCARD|G_EVAL);
   if(SvTRUE(ERRSV)) {

Modified: branches/barnowl_unicode/owl/perlglue.xs
===================================================================
--- branches/barnowl_unicode/owl/perlglue.xs	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/perlglue.xs	2007-12-24 00:52:17 UTC (rev 777)
@@ -198,10 +198,17 @@
 char * 
 get_data_dir ()
 	CODE:
-		RETVAL = (char *) DATADIR;
+		RETVAL = (char *) owl_get_datadir();
 	OUTPUT:
 	RETVAL
 
+char * 
+get_config_dir ()
+	CODE:
+		RETVAL = (char *) owl_global_get_confdir(&g);
+	OUTPUT:
+	RETVAL	
+
 void
 popless_text(text) 
 	char *text

Modified: branches/barnowl_unicode/owl/perlwrap.pm
===================================================================
--- branches/barnowl_unicode/owl/perlwrap.pm	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/perlwrap.pm	2007-12-24 00:52:17 UTC (rev 777)
@@ -20,9 +20,11 @@
     bootstrap BarnOwl 1.2;
 };
 
-use lib(get_data_dir()."/lib");
-use lib($ENV{HOME}."/.owl/lib");
+use lib(get_data_dir() . "/lib");
+use lib(get_config_dir() . "/lib");
 
+# perlconfig.c will set this to the value of the -c command-line
+# switch, if present.
 our $configfile;
 
 if(!$configfile && -f $ENV{HOME} . "/.barnowlconf") {
@@ -519,7 +521,7 @@
 
     if ( $m->is_loginout) {
         return format_login($m);
-    } elsif($m->is_ping) {
+    } elsif($m->is_ping && $m->is_personal) {
         return ( "\@b(PING) from \@b(" . $m->pretty_sender . ")\n" );
     } elsif($m->is_admin) {
         return "\@bold(OWL ADMIN)\n" . indentBody($m);
@@ -567,6 +569,9 @@
         $header .= ' / @b{' . $m->pretty_sender . '}';
     }
 
+    if($m->opcode) {
+        $header .= " [" . $m->opcode . "]";
+    }
     $header .= "  " . time_hhmm($m);
     my $sender = $m->long_sender;
     $sender =~ s/\n.*$//s;

Copied: branches/barnowl_unicode/owl/t (from rev 775, trunk/owl/t)

Modified: branches/barnowl_unicode/owl/test.h
===================================================================
--- branches/barnowl_unicode/owl/test.h	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/test.h	2007-12-24 00:52:17 UTC (rev 777)
@@ -2,7 +2,7 @@
 #define __OWL_TEST_H__
 
 #define FAIL_UNLESS(desc,pred) do { int __pred = (pred);                \
-    printf("\t%-4s: %s", (__pred)?"ok":(numfailed++,"FAIL"), desc);     \
+    printf("%s %s", (__pred)?"ok":(numfailed++,"not ok"), desc);     \
     if(!(__pred)) printf("\t(%s:%d)", __FILE__, __LINE__); printf("%c", '\n'); } while(0)
 
 #endif

Modified: branches/barnowl_unicode/owl/tester.c
===================================================================
--- branches/barnowl_unicode/owl/tester.c	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/tester.c	2007-12-24 00:52:17 UTC (rev 777)
@@ -142,20 +142,28 @@
 }
 
 
+#define OWL_DICT_NTESTS  20
+#define OWL_UTIL_NTESTS  9
+#define OWL_OBARRAY_NTESTS  5
+#define OWL_VARIABLE_NTESTS  52
+#define OWL_FILTER_NTESTS  23
+
 int main(int argc, char **argv, char **env)
 {
   owl_errqueue_init(owl_global_get_errqueue(&g));
   owl_obarray_init(&(g.obarray));
 
   int numfailures=0;
-  if (argc==2 && 0==strcmp(argv[1],"reg")) {
+  if (argc==1 || (argc==2 && 0==strcmp(argv[1],"reg"))) {
+    printf("1..%d\n", OWL_UTIL_NTESTS+OWL_DICT_NTESTS+OWL_VARIABLE_NTESTS
+           +OWL_FILTER_NTESTS+OWL_OBARRAY_NTESTS);
     numfailures += owl_util_regtest();
     numfailures += owl_dict_regtest();
     numfailures += owl_variable_regtest();
     numfailures += owl_filter_regtest();
     numfailures += owl_obarray_regtest();
     if (numfailures) {
-      fprintf(stderr, "*** WARNING: %d failures total\n", numfailures);
+      fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures);
     }
     return(numfailures);
   } else if (argc==2 && 0==strcmp(argv[1],"test1")) {

Modified: branches/barnowl_unicode/owl/util.c
===================================================================
--- branches/barnowl_unicode/owl/util.c	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/util.c	2007-12-24 00:52:17 UTC (rev 777)
@@ -758,7 +758,6 @@
 */
 char * owl_util_baseclass(char * class)
 {
-  char *ret;
   char *start, *end;
 
   start = class;
@@ -768,7 +767,7 @@
 
   start = owl_strdup(start);
   end = start + strlen(start) - 1;
-  while(*end == 'd' && *(end-1) == '.') {
+  while(end > start && *end == 'd' && *(end-1) == '.') {
     end -= 2;
   }
   *(end + 1) = 0;
@@ -788,7 +787,7 @@
 {
   int numfailed=0;
 
-  printf("BEGIN testing owl_util\n");
+  printf("# BEGIN testing owl_util\n");
 
   FAIL_UNLESS("owl_util_substitute 1",
 	      !strcmp("foo", owl_text_substitute("foo", "", "Y")));
@@ -811,8 +810,8 @@
   FAIL_UNLESS("owl_util_uniq 3", 
 	      !strcmp("meep foo bar", owl_util_uniq("meep foo", "bar foo meep", "-")));
 
-  if (numfailed) printf("*** WARNING: failures encountered with owl_util\n");
-  printf("END testing owl_util (%d failures)\n", numfailed);
+  // if (numfailed) printf("*** WARNING: failures encountered with owl_util\n");
+  printf("# END testing owl_util (%d failures)\n", numfailed);
   return(numfailed);
 }
 

Modified: branches/barnowl_unicode/owl/variable.c
===================================================================
--- branches/barnowl_unicode/owl/variable.c	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/variable.c	2007-12-24 00:52:17 UTC (rev 777)
@@ -973,10 +973,11 @@
   owl_vardict vd;
   int numfailed=0;
   char buf[1024];
+  owl_variable * v;
 
   in_regtest = 1;
 
-  printf("BEGIN testing owl_variable\n");
+  printf("# BEGIN testing owl_variable\n");
   FAIL_UNLESS("setup", 0==owl_variable_dict_setup(&vd));
 
   FAIL_UNLESS("get bool", 0==owl_variable_get_bool(&vd,"rxping"));
@@ -1026,8 +1027,6 @@
   FAIL_UNLESS("set enum 9", -1==owl_variable_set_fromstring(&vd,"webbrowser","netscapey",0,0));
   FAIL_UNLESS("get enum 10", OWL_WEBBROWSER_NETSCAPE==owl_variable_get_int(&vd,"webbrowser"));
 
-  owl_variable * v;
-  
   owl_variable_dict_newvar_string(&vd, "stringvar", "", "", "testval");
   FAIL_UNLESS("get new string var", NULL != (v = owl_variable_get(&vd, "stringvar", OWL_VARIABLE_STRING)));
   FAIL_UNLESS("get new string val", !strcmp("testval", owl_variable_get_string(&vd, "stringvar")));
@@ -1048,8 +1047,8 @@
 
   owl_variable_dict_free(&vd);
 
-  if (numfailed) printf("*** WARNING: failures encountered with owl_variable\n");
-  printf("END testing owl_variable (%d failures)\n", numfailed);
+  // if (numfailed) printf("*** WARNING: failures encountered with owl_variable\n");
+  printf("# END testing owl_variable (%d failures)\n", numfailed);
   return(numfailed);
 }
 

Modified: branches/barnowl_unicode/owl/zephyr.c
===================================================================
--- branches/barnowl_unicode/owl/zephyr.c	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/zephyr.c	2007-12-24 00:52:17 UTC (rev 777)
@@ -327,6 +327,10 @@
   int i, count, save;
   char *out;
 
+  /* If there's no message here, just run along now */
+  if (n->z_message_len == 0)
+    return(owl_strdup(""));
+
   count=save=0;
   for (i=0; i<n->z_message_len; i++) {
     if (n->z_message[i]=='\0') {
@@ -362,6 +366,9 @@
 {
   int i, fields;
 
+  if(n->z_message_len == 0)
+    return 0;
+
   fields=1;
   for (i=0; i<n->z_message_len; i++) {
     if (n->z_message[i]=='\0') fields++;

Modified: branches/barnowl_unicode/owl/zwrite.c
===================================================================
--- branches/barnowl_unicode/owl/zwrite.c	2007-12-24 00:48:01 UTC (rev 776)
+++ branches/barnowl_unicode/owl/zwrite.c	2007-12-24 00:52:17 UTC (rev 777)
@@ -124,6 +124,13 @@
     return(-1);
   }
 
+  if (z->class == NULL &&
+      z->inst == NULL &&
+      owl_list_get_size(&(z->recips))==0) {
+    owl_function_error("You must specify a recipient for zwrite");
+    return(-1);
+  }
+
   /* now deal with defaults */
   if (z->class==NULL) z->class=owl_strdup("message");
   if (z->inst==NULL) z->inst=owl_strdup("personal");
@@ -131,13 +138,6 @@
   if (z->opcode==NULL) z->opcode=owl_strdup("");
   /* z->message is allowed to stay NULL */
   
-  if (!strcasecmp(z->class, "message") &&
-      !strcasecmp(z->inst, "personal") &&
-      owl_list_get_size(&(z->recips))==0) {
-    owl_function_error("You must specify a recipient for zwrite");
-    return(-1);
-  }
-
   /* get a zsig, if not given */
   if (z->zsig==NULL) {
     zsigproc = owl_global_get_zsigproc(&g);


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