Index: ChangeLog
===================================================================
--- ChangeLog	(revision 7c9c8477642df5ff7b307e152c19cf5bf63c22d7)
+++ ChangeLog	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -1,4 +1,7 @@
 $Id$
 
+2.0.7-pre-1
+	First pass at making owl build without zephyr
+	
 2.0.6
 	aimlogin will now accept the screenname without a password and ask
Index: codelist.pl
===================================================================
--- codelist.pl	(revision 0ff8fb572754799e77ac2cf2d386b7699f995257)
+++ codelist.pl	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -22,9 +22,12 @@
 	    && !/\/\*/
 	    && !/ZWRITEOPTIONS/
-	    && !/owlfaim_priv/) 
+	    && !/owlfaim_priv/)
 	{
+
 	    s/\s+\{/\;/;
 	    s/\)[ \t]*$/\)\;/;
 	    print "extern ";
+	    print;
+	} elsif (/^#if/ || /^#else/ || /^#endif/) {
 	    print;
 	}
Index: configure
===================================================================
--- configure	(revision e016fc2ee36fa9c8bb0afdd3a024e1f0368087de)
+++ configure	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -1380,9 +1380,8 @@
 else
   echo "$ac_t""no" 1>&6
-{ echo "configure: error: No zephyr library found." 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking for ZInitLocationInfo in -lzephyr""... $ac_c" 1>&6
-echo "configure:1387: checking for ZInitLocationInfo in -lzephyr" >&5
+echo "configure:1386: checking for ZInitLocationInfo in -lzephyr" >&5
 ac_lib_var=`echo zephyr'_'ZInitLocationInfo | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
@@ -1392,5 +1391,5 @@
 LIBS="-lzephyr  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1395 "configure"
+#line 1394 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -1403,5 +1402,5 @@
 ; return 0; }
 EOF
-if { (eval echo configure:1406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
@@ -1430,10 +1429,10 @@
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1433: checking for $ac_func" >&5
+echo "configure:1432: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1438 "configure"
+#line 1437 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
@@ -1458,5 +1457,5 @@
 ; return 0; }
 EOF
-if { (eval echo configure:1461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
@@ -1484,7 +1483,7 @@
 
 echo $ac_n "checking for des_ecb_encrypt prototype""... $ac_c" 1>&6
-echo "configure:1487: checking for des_ecb_encrypt prototype" >&5
+echo "configure:1486: checking for des_ecb_encrypt prototype" >&5
 cat > conftest.$ac_ext <<EOF
-#line 1489 "configure"
+#line 1488 "configure"
 #include "confdefs.h"
 #include <des.h>
@@ -1494,5 +1493,5 @@
 ; return 0; }
 EOF
-if { (eval echo configure:1497: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1496: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_des_ecb_encrypt_proto=no
@@ -1513,5 +1512,5 @@
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1516: checking how to run the C preprocessor" >&5
+echo "configure:1515: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
@@ -1528,5 +1527,5 @@
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1531 "configure"
+#line 1530 "configure"
 #include "confdefs.h"
 #include <assert.h>
@@ -1534,5 +1533,5 @@
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1537: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1536: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
@@ -1545,5 +1544,5 @@
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1548 "configure"
+#line 1547 "configure"
 #include "confdefs.h"
 #include <assert.h>
@@ -1551,5 +1550,5 @@
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1554: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1553: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
@@ -1562,5 +1561,5 @@
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 1565 "configure"
+#line 1564 "configure"
 #include "confdefs.h"
 #include <assert.h>
@@ -1568,5 +1567,5 @@
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1571: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1570: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
@@ -1593,10 +1592,10 @@
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1596: checking for ANSI C header files" >&5
+echo "configure:1595: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1601 "configure"
+#line 1600 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
@@ -1606,5 +1605,5 @@
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1609: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1608: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
@@ -1623,5 +1622,5 @@
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1626 "configure"
+#line 1625 "configure"
 #include "confdefs.h"
 #include <string.h>
@@ -1641,5 +1640,5 @@
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1644 "configure"
+#line 1643 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
@@ -1662,5 +1661,5 @@
 else
   cat > conftest.$ac_ext <<EOF
-#line 1665 "configure"
+#line 1664 "configure"
 #include "confdefs.h"
 #include <ctype.h>
@@ -1673,5 +1672,5 @@
 
 EOF
-if { (eval echo configure:1676: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
@@ -1697,10 +1696,10 @@
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:1700: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:1699: checking for sys/wait.h that is POSIX.1 compatible" >&5
 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1705 "configure"
+#line 1704 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
@@ -1718,5 +1717,5 @@
 ; return 0; }
 EOF
-if { (eval echo configure:1721: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1720: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
@@ -1742,15 +1741,15 @@
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1745: checking for $ac_hdr" >&5
+echo "configure:1744: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1750 "configure"
+#line 1749 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1755: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1754: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
@@ -1784,5 +1783,5 @@
 
 echo $ac_n "checking for the perl xsubpp precompiler""... $ac_c" 1>&6
-echo "configure:1787: checking for the perl xsubpp precompiler" >&5
+echo "configure:1786: checking for the perl xsubpp precompiler" >&5
 XSUBPPDIR="`(perl -MExtUtils::MakeMaker -e 'print ExtUtils::MakeMaker->new({NAME => qw(owl)})->tool_xsubpp;') | grep \^XSUBPPDIR | sed -e 's/XSUBPPDIR = //g;'`"
 if test -n "${XSUBPPDIR}"; then
@@ -1799,5 +1798,5 @@
 ac_safe=`echo "/usr/share/terminfo" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for /usr/share/terminfo""... $ac_c" 1>&6
-echo "configure:1802: checking for /usr/share/terminfo" >&5
+echo "configure:1801: checking for /usr/share/terminfo" >&5
 if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1824,5 +1823,5 @@
 ac_safe=`echo "/usr/share/lib/terminfo" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for /usr/share/lib/terminfo""... $ac_c" 1>&6
-echo "configure:1827: checking for /usr/share/lib/terminfo" >&5
+echo "configure:1826: checking for /usr/share/lib/terminfo" >&5
 if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1885,5 +1884,5 @@
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1888: checking for a BSD compatible install" >&5
+echo "configure:1887: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
Index: configure.in
===================================================================
--- configure.in	(revision e016fc2ee36fa9c8bb0afdd3a024e1f0368087de)
+++ configure.in	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -41,6 +41,7 @@
 AC_CHECK_LIB(krb4, krb_sendauth,,
    AC_CHECK_LIB(krb, krb_sendauth))
-AC_CHECK_LIB(zephyr, ZGetSender,, AC_MSG_ERROR(No zephyr library found.))
-dnl AC_CHECK_LIB(zephyr, ZGetSender)
+dnl These are both off right now to simluate zephyr not being present
+dnl AC_CHECK_LIB(zephyr, ZGetSender,, AC_MSG_ERROR(No zephyr library found.))
+AC_CHECK_LIB(zephyr, ZGetSender)
 AC_CHECK_LIB(zephyr, ZInitLocationInfo, AC_DEFINE([HAVE_LIBZEPHYR_ZINITLOCATIONINFO], [], [Have ZInitLocationInfo]),)
 
Index: filter.c
===================================================================
--- filter.c	(revision e1874457f651911254dfeee53055c59959f0a7fb)
+++ filter.c	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -69,5 +69,5 @@
 	  !strcasecmp(argv[i], "direction") ||
 	  !strcasecmp(argv[i], "login")) {
-	regexstr=owl_util_substitute(argv[i+1], "%me%", ZGetSender());
+	regexstr=owl_util_substitute(argv[i+1], "%me%", owl_zephyr_get_sender());
 	owl_filterelement_create_re(fe, argv[i], regexstr);
 	owl_free(regexstr);
Index: functions.c
===================================================================
--- functions.c	(revision 7c9c8477642df5ff7b307e152c19cf5bf63c22d7)
+++ functions.c	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -748,6 +748,5 @@
 
   /* final clean up */
-  unsuball();
-  ZClosePort();
+  owl_zephyr_shutdown();
   endwin();
   owl_function_debugmsg("Quitting Owl");
@@ -1256,9 +1255,9 @@
   owl_message *m;
   owl_fmtext fm, attrfm;
+  char buff[10000];
+  owl_view *v;
+#ifdef HAVE_LIBZEPHYR
   ZNotice_t *n;
-  char buff[10000], tmpbuff[1024];
-  char *ptr;
-  int i, j, fields, len;
-  owl_view *v;
+#endif
 
   owl_fmtext_init_null(&fm);
@@ -1321,6 +1320,9 @@
     owl_fmtext_append_normal(&fm, owl_message_get_timestr(m));
     owl_fmtext_append_normal(&fm, "\n");
-
+#ifdef HAVE_LIBZEPHYR
     if (owl_message_is_direction_in(m)) {
+      char *ptr, tmpbuff[1024];
+      int i, j, fields, len;
+
       n=owl_message_get_notice(m);
 
@@ -1394,4 +1396,5 @@
       owl_fmtext_append_normal(&fm, n->z_default_format);
     }
+#endif    
   }
 
@@ -1541,36 +1544,15 @@
 void owl_function_getsubs()
 {
-  int ret, num, i, one;
-  ZSubscription_t sub;
-  char *buff, *tmpbuff;
-
-  one = 1;
-
-  ret=ZRetrieveSubscriptions(0, &num);
-  if (ret == ZERR_TOOMANYSUBS) {
-    owl_function_makemsg("Zephyr: too many subscriptions");
-    return;
-  }
-
-  buff=owl_malloc(num*500);
-  tmpbuff=owl_malloc(num*500);
-  strcpy(buff, "");
-  for (i=0; i<num; i++) {
-    if ((ret = ZGetSubscriptions(&sub, &one)) != ZERR_NONE) {
-      owl_function_makemsg("Error while getting subscriptions");
-      owl_free(buff);
-      owl_free(tmpbuff);
-      ZFlushSubscriptions();
-      return;
-    } else {
-      sprintf(tmpbuff, "<%s,%s,%s>\n%s", sub.zsub_class, sub.zsub_classinst, sub.zsub_recipient, buff);
-      strcpy(buff, tmpbuff);
-    }
-  }
-
-  owl_function_popless_text(buff);
+  char *buff;
+
+  buff=owl_zephyr_getsubs();
+
+  if (buff) {
+    owl_function_popless_text(buff);
+  } else {
+    owl_function_popless_text("Error getting subscriptions");
+  }
+	   
   owl_free(buff);
-  owl_free(tmpbuff);
-  ZFlushSubscriptions();
 }
 
@@ -2863,10 +2845,13 @@
 void owl_function_buddylist(int aim, int zephyr, char *file)
 {
-  char *ourfile, *tmp, buff[LINE], *line;
-  FILE *f;
-  int numlocs, ret, i, j;
-  ZLocations_t location[200];
+  int i, j;
   owl_fmtext fm;
   owl_buddylist *b;
+#ifdef HAVE_LIBZEPHYR
+  char *ourfile, *tmp, buff[LINE], *line;
+  ZLocations_t location[200];
+  FILE *f;
+  int numlocs, ret;
+#endif
 
   owl_fmtext_init_null(&fm);
@@ -2884,4 +2869,5 @@
   }
 
+#ifdef HAVE_LIBZEPHYR
   if (zephyr) {
     if (file==NULL) {
@@ -2904,5 +2890,5 @@
       return;
     }
-    
+
     owl_fmtext_append_bold(&fm, "Zephyr users logged in:\n");
     
@@ -2958,4 +2944,5 @@
     owl_free(ourfile);
   }
+#endif
   
   owl_function_popless_fmtext(&fm);
Index: global.c
===================================================================
--- global.c	(revision cf83b7a15ef998b48ca0aa69dae69a963b365dc1)
+++ global.c	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -97,4 +97,6 @@
   owl_buddylist_init(&(g->buddylist));
   g->response=NULL;
+  g->havezephyr=0;
+  g->haveaim=0;
 }
 
@@ -779,2 +781,25 @@
   g->response=resp;
 }
+
+
+void owl_global_set_haveaim(owl_global *g)
+{
+  g->haveaim=1;
+}
+
+int owl_global_is_haveaim(owl_global *g)
+{
+  if (g->haveaim) return(1);
+  return(0);
+}
+
+void owl_global_set_havezephyr(owl_global *g)
+{
+  g->havezephyr=1;
+}
+
+int owl_global_is_havezephyr(owl_global *g)
+{
+  if (g->havezephyr) return(1);
+  return(0);
+}
Index: logging.c
===================================================================
--- logging.c	(revision 723c42792f2e83e2715c592abd024ab2d975fac2)
+++ logging.c	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -17,5 +17,5 @@
   /* chop off a local realm */
   ptr=strchr(tobuff, '@');
-  if (ptr && !strncmp(ptr+1, ZGetRealm(), strlen(ZGetRealm()))) {
+  if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) {
     *ptr='\0';
   }
@@ -129,5 +129,5 @@
 	from=frombuff=owl_strdup(owl_message_get_sender(m));
 	ptr=strchr(frombuff, '@');
-	if (ptr && !strncmp(ptr+1, ZGetRealm(), strlen(ZGetRealm()))) {
+	if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) {
 	  *ptr='\0';
 	}
Index: message.c
===================================================================
--- message.c	(revision 1d3e925df3ad2ad7fc8b9c3850a08828cdcbdba3)
+++ message.c	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -1,3 +1,2 @@
-#include <zephyr/zephyr.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -434,4 +433,9 @@
   return(&(m->notice));
 }
+#else
+void *owl_message_get_notice(owl_message *m)
+{
+  return(NULL);
+}
 #endif
 
@@ -473,6 +477,6 @@
     if (strcasecmp(owl_message_get_class(m), "message")) return(0);
     if (strcasecmp(owl_message_get_instance(m), "personal")) return(0);
-    if (!strcasecmp(owl_message_get_recipient(m), ZGetSender()) ||
-	!strcasecmp(owl_message_get_sender(m), ZGetSender())) {
+    if (!strcasecmp(owl_message_get_recipient(m), owl_zephyr_get_sender()) ||
+	!strcasecmp(owl_message_get_sender(m), owl_zephyr_get_sender())) {
       return(1);
     }
@@ -484,5 +488,5 @@
 {
   if (owl_message_is_type_zephyr(m)) {
-    if (!strcasecmp(owl_message_get_sender(m), ZGetSender())) {
+    if (!strcasecmp(owl_message_get_sender(m), owl_zephyr_get_sender())) {
       return(1);
     } else {
@@ -534,5 +538,5 @@
 
   if (owl_message_is_type_zephyr(m)) {
-    strcpy(sender, ZGetSender());
+    strcpy(sender, owl_zephyr_get_sender());
     ptr=strchr(sender, '@');
     if (ptr) *ptr='\0';
@@ -620,4 +624,5 @@
 }
 
+#ifdef HAVE_LIBZEPHYR
 void owl_message_create_from_znotice(owl_message *m, ZNotice_t *n)
 {
@@ -654,5 +659,5 @@
     owl_message_set_realm(m, ptr+1);
   } else {
-    owl_message_set_realm(m, ZGetRealm());
+    owl_message_set_realm(m, owl_zephyr_get_realm());
   }
 
@@ -667,5 +672,5 @@
 
   /* is the "isprivate" attribute if it's a private zephyr */
-  if (!strcasecmp(n->z_recipient, ZGetSender())) {
+  if (!strcasecmp(n->z_recipient, owl_zephyr_get_sender())) {
     owl_message_set_isprivate(m);
   }
@@ -716,4 +721,9 @@
   m->time[strlen(m->time)-1]='\0';
 }
+#else
+void owl_message_create_from_znotice(owl_message *m, void *n)
+{
+}
+#endif
 
 void owl_message_create_from_zwriteline(owl_message *m, char *line, char *body, char *zsig)
@@ -730,5 +740,5 @@
   owl_message_set_direction_out(m);
   owl_message_set_type_zephyr(m);
-  owl_message_set_sender(m, ZGetSender());
+  owl_message_set_sender(m, owl_zephyr_get_sender());
   owl_message_set_class(m, owl_zwrite_get_class(&z));
   owl_message_set_instance(m, owl_zwrite_get_instance(&z));
@@ -765,8 +775,9 @@
   int i, j;
   owl_pair *p;
-    
+#ifdef HAVE_LIBZEPHYR    
   if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) {
     ZFreeNotice(&(m->notice));
   }
+#endif
   if (m->time) owl_free(m->time);
   if (m->zwriteline) owl_free(m->zwriteline);
Index: owl.c
===================================================================
--- owl.c	(revision cf83b7a15ef998b48ca0aa69dae69a963b365dc1)
+++ owl.c	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -15,5 +15,4 @@
 #include <stdlib.h>
 #include <string.h>
-#include <zephyr/zephyr.h>
 #include <com_err.h>
 #include <signal.h>
@@ -41,5 +40,7 @@
   struct tm *today;
   char *dir;
+#ifdef HAVE_LIBZEPHYR
   ZNotice_t notice;
+#endif
 
   argcsave=argc;
@@ -133,5 +134,9 @@
   if (debug) owl_global_set_debug_on(&g);
   owl_global_set_startupargs(&g, argcsave, argvsave);
-
+#ifdef HAVE_LIBZEPHYR
+  owl_global_set_havezephyr(&g);
+#endif
+  owl_global_set_haveaim(&g);
+  
   /* create the owl directory, in case it does not exist */
   dir=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_CONFIG_DIR);
@@ -340,10 +345,13 @@
     zpendcount=0;
     while(owl_zephyr_zpending() || owl_global_messagequeue_pending(&g)) {
+#ifdef HAVE_LIBZEPHYR
       struct sockaddr_in from;
+#endif
       owl_message *m;
       owl_filter *f;
-      
+
       /* grab the new message, stick it in 'm' */
       if (owl_zephyr_zpending()) {
+#ifdef HAVE_LIBZEPHYR
 	/* grab a zephyr notice, but if we've done 20 without stopping,
 	   take a break to process keystrokes etc. */
@@ -366,4 +374,5 @@
 	m=owl_malloc(sizeof(owl_message));
 	owl_message_create_from_znotice(m, &notice);
+#endif
       } else if (owl_global_messagequeue_pending(&g)) {
 	m=owl_global_messageuque_popmsg(&g);
Index: owl.h
===================================================================
--- owl.h	(revision 7c9c8477642df5ff7b307e152c19cf5bf63c22d7)
+++ owl.h	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -11,5 +11,6 @@
 #include "config.h"
 #ifdef HAVE_LIBZEPHYR
-#include <zephyr/zephyr.h>
+#undef HAVE_LIBZEPHYR
+/* #include <zephyr/zephyr.h> */ /* this is to simulate not having zephyr */
 #endif
 
@@ -17,6 +18,6 @@
 static const char owl_h_fileIdent[] = "$Id$";
 
-#define OWL_VERSION         2.0.6
-#define OWL_VERSION_STRING "2.0.6"
+#define OWL_VERSION         2.0.7-pre-1
+#define OWL_VERSION_STRING "2.0.7-pre-1"
 
 #define OWL_DEBUG 0
@@ -446,4 +447,6 @@
   owl_list stylelist;       /* global list of available styles */
   char *response;           /* response to the last question asked */
+  int havezephyr;
+  int haveaim;
 } owl_global;
 
Index: stylefunc.c
===================================================================
--- stylefunc.c	(revision 778d0a93d7a55352c4bc524e65d2d1645befe839)
+++ stylefunc.c	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -9,10 +9,13 @@
 void owl_stylefunc_basic(owl_fmtext *fm, owl_message *m)
 {
+#ifdef HAVE_LIBZEPHYR
   char *body, *indent, *ptr, *zsigbuff, frombuff[LINE];
   ZNotice_t *n;
+#endif
 
   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_strdup(owl_message_get_body(m));
@@ -31,5 +34,5 @@
     strcpy(frombuff, owl_message_get_sender(m));
     ptr=strchr(frombuff, '@');
-    if (ptr && !strncmp(ptr+1, ZGetRealm(), strlen(ZGetRealm()))) {
+    if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) {
       *ptr='\0';
     }
@@ -84,5 +87,5 @@
       }
       owl_fmtext_append_normal(fm, frombuff);
-      if (strcasecmp(owl_message_get_realm(m), ZGetRealm())) {
+      if (strcasecmp(owl_message_get_realm(m), owl_zephyr_get_realm()) {
 	owl_fmtext_append_normal(fm, " {");
 	owl_fmtext_append_normal(fm, owl_message_get_realm(m));
@@ -112,4 +115,5 @@
     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;
@@ -200,10 +204,13 @@
 void owl_stylefunc_default(owl_fmtext *fm, owl_message *m)
 {
+#ifdef HAVE_LIBZEPHYR
   char *body, *indent, *ptr, *zsigbuff, frombuff[LINE];
   ZNotice_t *n;
+#endif
 
   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);
@@ -222,5 +229,5 @@
     strcpy(frombuff, owl_message_get_sender(m));
     ptr=strchr(frombuff, '@');
-    if (ptr && !strncmp(ptr+1, ZGetRealm(), strlen(ZGetRealm()))) {
+    if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) {
       *ptr='\0';
     }
@@ -254,5 +261,5 @@
       }
       owl_fmtext_append_normal(fm, " for ");
-      ptr=short_zuser(n->z_class_inst);
+      ptr=short_zuser(owl_zephyr_get_instance(m));
       owl_fmtext_append_bold(fm, ptr);
       owl_free(ptr);
@@ -276,5 +283,5 @@
 	owl_fmtext_append_normal(fm, "} ");
       }
-      if (n->z_opcode[0]!='\0') {
+      if (strccmp(owl_zephyr_get_opcode(m), "")) {
 	owl_fmtext_append_normal(fm, " [");
 	owl_fmtext_append_normal(fm, owl_message_get_opcode(m));
@@ -304,4 +311,5 @@
     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;
@@ -395,6 +403,7 @@
   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));
@@ -402,4 +411,5 @@
   
   if (owl_message_is_type_zephyr(m)) {
+#ifdef HAVE_LIBZEPHYR
     n=owl_message_get_notice(m);
     
@@ -472,5 +482,5 @@
     owl_free(sender);
     owl_free(recip);
-    
+#endif
   } else if (owl_message_is_type_aim(m)) {
     owl_fmtext_append_spaces(fm, OWL_TAB);
Index: util.c
===================================================================
--- util.c	(revision e7cc1c3646a75c061ae343c21420981119f5f88f)
+++ util.c	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -427,5 +427,5 @@
   ptr=strchr(out, '@');
   if (ptr) {
-    if (!strcasecmp(ptr+1, ZGetRealm())) {
+    if (!strcasecmp(ptr+1, owl_zephyr_get_realm())) {
       *ptr='\0';
     }
@@ -444,5 +444,5 @@
     return owl_strdup(in);
   } else {
-    return owl_sprintf("%s@%s", in, ZGetRealm());
+    return owl_sprintf("%s@%s", in, owl_zephyr_get_realm());
   }
 }
Index: variable.c
===================================================================
--- variable.c	(revision b278973f350f39aeba89174b31491b54faf5da25)
+++ variable.c	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -354,5 +354,5 @@
 
 int owl_variable_tty_set(owl_variable *v, void *newval) {
-  ZInitLocationInfo(owl_global_get_hostname(&g), newval);
+  owl_zephyr_set_locationinfo(owl_global_get_hostname(&g), newval);
   return(owl_variable_string_set_default(v, newval));
 }
Index: zcrypt.c
===================================================================
--- zcrypt.c	(revision c86a35c5566beb47fb2bb90015beb6055536aff8)
+++ zcrypt.c	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -26,5 +26,4 @@
 #include <sys/types.h>
 #include <des.h>
-#include <zephyr/zephyr.h>
 
 #define MAX_KEY 128
Index: zephyr.c
===================================================================
--- zephyr.c	(revision b2a91b619cffe6800ac7a2ccc9ab59fb6d14058f)
+++ zephyr.c	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -4,5 +4,4 @@
 #include <sys/wait.h>
 #include <string.h>
-#include <zephyr/zephyr.h>
 #include <com_err.h>
 #include "owl.h"
@@ -10,8 +9,11 @@
 static const char fileIdent[] = "$Id$";
 
+#ifdef HAVE_LIBZEPHYR
 Code_t ZResetAuthentication();
+#endif
 
 int owl_zephyr_initialize()
 {
+#ifdef HAVE_LIBZEPHYR
   int ret;
   
@@ -24,4 +26,15 @@
     return(1);
   }
+#endif
+  return(0);
+}
+
+
+int owl_zephyr_shutdown()
+{
+#ifdef HAVE_LIBZEPHYR
+  unsuball();
+  ZClosePort();
+#endif
   return(0);
 }
@@ -33,4 +46,22 @@
 #else
   return(0);
+#endif
+}
+
+char *owl_zephyr_get_realm()
+{
+#ifdef HAVE_LIBZEPHYR
+  return(ZGetRealm());
+#else
+  return("");
+#endif
+}
+
+char *owl_zephyr_get_sender()
+{
+#ifdef HAVE_LIBZEPHYR
+  return(ZGetSender());
+#else
+  return("");
 #endif
 }
@@ -258,4 +289,9 @@
   return("");
 }
+#else
+char *owl_zephyr_get_field(void *n, int j, int *k)
+{
+  return("");
+}
 #endif
 
@@ -271,4 +307,9 @@
   
   return(fields);
+}
+#else
+int owl_zephyr_get_num_fields(void *n)
+{
+  return(0);
 }
 #endif
@@ -298,4 +339,9 @@
   *k=strlen(n->z_message);
   return(n->z_message);
+}
+#else
+char *owl_zephyr_get_zsig(void *n, int *k)
+{
+  return("");
 }
 #endif
@@ -396,4 +442,8 @@
   }
 }
+#else
+void owl_zephyr_handle_ack(void *retnotice)
+{
+}
 #endif
 
@@ -405,4 +455,9 @@
     return(1);
   }
+  return(0);
+}
+#else
+int owl_zephyr_notice_is_ack(void *n)
+{
   return(0);
 }
@@ -654,4 +709,5 @@
 
 /* return auth string */
+#ifdef HAVE_LIBZEPHYR
 char *owl_zephyr_get_authstr(ZNotice_t *n)
 {
@@ -669,4 +725,67 @@
   }           
 }
-
-
+#else
+char *owl_zephyr_get_authstr(void *n)
+{
+  return("");
+}
+#endif
+
+
+/* returns a buffer of subscriptions or an error message.
+ * Caller must free the return.
+ */
+char *owl_zephyr_getsubs()
+{
+#ifdef HAVE_LIBZEPHYR
+  int ret, num, i, one;
+  ZSubscription_t sub;
+  char *out, *tmpbuff;
+  one=1;
+
+  ret=ZRetrieveSubscriptions(0, &num);
+  if (ret==ZERR_TOOMANYSUBS) {
+    out=owl_strdup("Zephyr: too many subscriptions\n");
+    return(out);
+  }
+
+  out=owl_malloc(num*500);
+  tmpbuff=owl_malloc(num*500);
+  strcpy(out, "");
+  for (i=0; i<num; i++) {
+    if ((ret = ZGetSubscriptions(&sub, &one)) != ZERR_NONE) {
+      owl_free(out);
+      owl_free(tmpbuff);
+      ZFlushSubscriptions();
+      out=owl_strdup("Error while getting subscriptions\n");
+      return(out);
+    } else {
+      sprintf(tmpbuff, "<%s,%s,%s>\n%s", sub.zsub_class, sub.zsub_classinst, sub.zsub_recipient, buff);
+      strcpy(out, tmpbuff);
+    }
+  }
+
+  owl_free(tmpbuff);
+  ZFlushSubscriptions();
+  return(out);
+#else
+  return("");
+#endif
+}
+
+char *owl_zephyr_get_variable(char *var)
+{
+#ifdef HAVE_LIBZEPHYR
+  return(ZGetVariable(var));
+#else
+  return("");
+#endif
+}
+
+void owl_zephyr_set_locationinfo(char *host, char *val)
+{
+#ifdef HAVE_LIBZEPHYR
+  ZInitLocationInfo(host, val);
+#endif
+}
+  
Index: zwrite.c
===================================================================
--- zwrite.c	(revision e016fc2ee36fa9c8bb0afdd3a024e1f0368087de)
+++ zwrite.c	(revision 09489b896891e6c4e2b0a2a7d622c25749410cf1)
@@ -143,5 +143,5 @@
     zsigproc = owl_global_get_zsigproc(&g);
     zsigowlvar = owl_global_get_zsig(&g);
-    zsigzvar = ZGetVariable("zwrite-signature");
+    zsigzvar = owl_zephyr_get_variable("zwrite-signature");
 
     if (zsigowlvar && *zsigowlvar) {
