Changeset 09489b89 for zephyr.c


Ignore:
Timestamp:
Jul 2, 2003, 6:15:24 PM (21 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
373b7e7
Parents:
7c9c847
Message:
First pass at making owl build without zephyr
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zephyr.c

    rb2a91b6 r09489b89  
    44#include <sys/wait.h>
    55#include <string.h>
    6 #include <zephyr/zephyr.h>
    76#include <com_err.h>
    87#include "owl.h"
     
    109static const char fileIdent[] = "$Id$";
    1110
     11#ifdef HAVE_LIBZEPHYR
    1212Code_t ZResetAuthentication();
     13#endif
    1314
    1415int owl_zephyr_initialize()
    1516{
     17#ifdef HAVE_LIBZEPHYR
    1618  int ret;
    1719 
     
    2426    return(1);
    2527  }
     28#endif
     29  return(0);
     30}
     31
     32
     33int owl_zephyr_shutdown()
     34{
     35#ifdef HAVE_LIBZEPHYR
     36  unsuball();
     37  ZClosePort();
     38#endif
    2639  return(0);
    2740}
     
    3346#else
    3447  return(0);
     48#endif
     49}
     50
     51char *owl_zephyr_get_realm()
     52{
     53#ifdef HAVE_LIBZEPHYR
     54  return(ZGetRealm());
     55#else
     56  return("");
     57#endif
     58}
     59
     60char *owl_zephyr_get_sender()
     61{
     62#ifdef HAVE_LIBZEPHYR
     63  return(ZGetSender());
     64#else
     65  return("");
    3566#endif
    3667}
     
    258289  return("");
    259290}
     291#else
     292char *owl_zephyr_get_field(void *n, int j, int *k)
     293{
     294  return("");
     295}
    260296#endif
    261297
     
    271307 
    272308  return(fields);
     309}
     310#else
     311int owl_zephyr_get_num_fields(void *n)
     312{
     313  return(0);
    273314}
    274315#endif
     
    298339  *k=strlen(n->z_message);
    299340  return(n->z_message);
     341}
     342#else
     343char *owl_zephyr_get_zsig(void *n, int *k)
     344{
     345  return("");
    300346}
    301347#endif
     
    396442  }
    397443}
     444#else
     445void owl_zephyr_handle_ack(void *retnotice)
     446{
     447}
    398448#endif
    399449
     
    405455    return(1);
    406456  }
     457  return(0);
     458}
     459#else
     460int owl_zephyr_notice_is_ack(void *n)
     461{
    407462  return(0);
    408463}
     
    654709
    655710/* return auth string */
     711#ifdef HAVE_LIBZEPHYR
    656712char *owl_zephyr_get_authstr(ZNotice_t *n)
    657713{
     
    669725  }           
    670726}
    671 
    672 
     727#else
     728char *owl_zephyr_get_authstr(void *n)
     729{
     730  return("");
     731}
     732#endif
     733
     734
     735/* returns a buffer of subscriptions or an error message.
     736 * Caller must free the return.
     737 */
     738char *owl_zephyr_getsubs()
     739{
     740#ifdef HAVE_LIBZEPHYR
     741  int ret, num, i, one;
     742  ZSubscription_t sub;
     743  char *out, *tmpbuff;
     744  one=1;
     745
     746  ret=ZRetrieveSubscriptions(0, &num);
     747  if (ret==ZERR_TOOMANYSUBS) {
     748    out=owl_strdup("Zephyr: too many subscriptions\n");
     749    return(out);
     750  }
     751
     752  out=owl_malloc(num*500);
     753  tmpbuff=owl_malloc(num*500);
     754  strcpy(out, "");
     755  for (i=0; i<num; i++) {
     756    if ((ret = ZGetSubscriptions(&sub, &one)) != ZERR_NONE) {
     757      owl_free(out);
     758      owl_free(tmpbuff);
     759      ZFlushSubscriptions();
     760      out=owl_strdup("Error while getting subscriptions\n");
     761      return(out);
     762    } else {
     763      sprintf(tmpbuff, "<%s,%s,%s>\n%s", sub.zsub_class, sub.zsub_classinst, sub.zsub_recipient, buff);
     764      strcpy(out, tmpbuff);
     765    }
     766  }
     767
     768  owl_free(tmpbuff);
     769  ZFlushSubscriptions();
     770  return(out);
     771#else
     772  return("");
     773#endif
     774}
     775
     776char *owl_zephyr_get_variable(char *var)
     777{
     778#ifdef HAVE_LIBZEPHYR
     779  return(ZGetVariable(var));
     780#else
     781  return("");
     782#endif
     783}
     784
     785void owl_zephyr_set_locationinfo(char *host, char *val)
     786{
     787#ifdef HAVE_LIBZEPHYR
     788  ZInitLocationInfo(host, val);
     789#endif
     790}
     791 
Note: See TracChangeset for help on using the changeset viewer.