Changeset 7451af9


Ignore:
Timestamp:
May 26, 2009, 10:32:00 PM (12 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
3ef779b
Parents:
f0f919d
git-author:
Alexander W Dehnert <adehnert@mit.edu> (05/26/09 14:49:46)
git-committer:
Nelson Elhage <nelhage@mit.edu> (05/26/09 22:32:00)
Message:
Add <message,*,%me%> to default Barnowl subs.

Also adds support for default Barnowl subs and
fixes the return value of owl_zephyr_loadsubs.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zephyr.c

    rd73e3af r7451af9  
    125125
    126126void owl_zephyr_load_initial_subs() {
    127   int ret, ret2;
     127  int ret_sd, ret_bd, ret_u;
    128128
    129129  owl_function_debugmsg("startup: loading initial zephyr subs");
    130130
    131131  /* load default subscriptions */
    132   ret = owl_zephyr_loaddefaultsubs();
     132  ret_sd = owl_zephyr_loaddefaultsubs();
     133
     134  /* load Barnowl default subscriptions */
     135  ret_bd = owl_zephyr_loadbarnowldefaultsubs();
    133136
    134137  /* load subscriptions from subs file */
    135   ret2 = owl_zephyr_loadsubs(NULL, 0);
    136 
    137   if (ret || ret2) {
     138  ret_u = owl_zephyr_loadsubs(NULL, 0);
     139
     140  if (ret_sd || ret_bd || ret_u) {
    138141    owl_function_error("Error loading zephyr subscriptions");
    139   } else if (ret2!=-1) {
     142  } else if (ret_u!=-1) {
    140143    owl_global_add_userclue(&g, OWL_USERCLUE_CLASSES);
    141144  }
     
    226229#endif
    227230
    228 /* Load zephyr subscriptions form 'filename'.  If 'filename' is NULL,
     231/* Load zephyr subscriptions from 'filename'.  If 'filename' is NULL,
    229232 * the default file $HOME/.zephyr.subs will be used.
    230233 *
     
    298301  fclose(file);
    299302
    300   owl_zephyr_loadsubs_helper(subs, count);
     303  ret = owl_zephyr_loadsubs_helper(subs, count);
     304  return(ret);
     305#else
     306  return(0);
     307#endif
     308}
     309
     310/* Load default Barnowl subscriptions
     311 *
     312 * Returns 0 on success.
     313 * Return -2 if there is a failure from zephyr to load the subscriptions.
     314 */
     315int owl_zephyr_loadbarnowldefaultsubs()
     316{
     317#ifdef HAVE_LIBZEPHYR
     318  ZSubscription_t *subs;
     319  int subSize = 10; /* Max Barnowl default subs we allow */
     320  int count, ret;
     321
     322  subs = owl_malloc(sizeof(ZSubscription_t) * subSize);
     323  ret = 0;
     324  ZResetAuthentication();
     325  count=0;
     326
     327  subs[count].zsub_class=owl_strdup("message");
     328  subs[count].zsub_classinst=owl_strdup("*");
     329  subs[count].zsub_recipient=owl_strdup("%me%");
     330  count++;
     331
     332  ret = owl_zephyr_loadsubs_helper(subs, count);
    301333  return(ret);
    302334#else
Note: See TracChangeset for help on using the changeset viewer.