Changes in / [87dfeb7:82dd923]


Ignore:
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Makefile.in

    r1375a6a rf200413  
    7979modules_clean:
    8080        for i in $(MODULE_DIRS); do \
    81                 cd $$i; test ! -f Makefile || make clean; \
     81                (cd $$i && (test ! -f Makefile || make clean)) \
    8282        done
    8383
  • perl/modules/IRC/lib/BarnOwl/Module/IRC.pm

    rf17bb2c0 re0fba58  
    147147
    148148    BarnOwl::new_command(
    149         'irc-msg' => mk_irc_command( \&cmd_msg, OPTIONAL_CHANNEL ),
     149        'irc-msg' => mk_irc_command( \&cmd_msg ),
    150150        {
    151151            summary => 'Send an IRC message',
     
    380380    my $cmd  = shift;
    381381    my $conn = shift;
    382     my $to = shift || shift or die("Usage: $cmd NICK\n");
     382    my $to = shift or die("Usage: $cmd [NICK|CHANNEL]\n");
    383383    # handle multiple recipients?
    384384    if(@_) {
  • perlwrap.pm

    r7743955 r19aeff4  
    10481048    my $sender = $m->long_sender;
    10491049    $sender =~ s/\n.*$//s;
    1050     return "  (" . $sender . '@color[default]' . ")";
     1050    if (BarnOwl::getvar('colorztext') eq 'on') {
     1051      return "  (" . $sender . '@color[default]' . ")";
     1052    } else {
     1053      return "  ($sender)";
     1054    }
    10511055}
    10521056
  • zephyr.c

    r21882032 ra5e7ed6  
    88
    99static const char fileIdent[] = "$Id$";
     10
     11static GList *deferred_subs = NULL;
     12typedef struct _owl_sub_list {                            /* noproto */
     13  ZSubscription_t *subs;
     14  int nsubs;
     15} owl_sub_list;
    1016
    1117#ifdef HAVE_LIBZEPHYR
     
    102108    owl_zephyr_load_initial_subs();
    103109  }
     110  while(deferred_subs != NULL) {
     111    owl_sub_list *subs = deferred_subs->data;
     112    owl_function_debugmsg("Loading %d deferred subs.", subs->nsubs);
     113    owl_zephyr_loadsubs_helper(subs->subs, subs->nsubs);
     114    deferred_subs = g_list_delete_link(deferred_subs, deferred_subs);
     115    owl_free(subs);
     116  }
    104117}
    105118
     
    178191int owl_zephyr_loadsubs_helper(ZSubscription_t subs[], int count)
    179192{
    180   int i, ret = 0;
    181   /* sub without defaults */
    182   if (ZSubscribeToSansDefaults(subs,count,0) != ZERR_NONE) {
    183     owl_function_error("Error subscribing to zephyr notifications.");
    184     ret=-2;
    185   }
    186 
    187   /* free stuff */
    188   for (i=0; i<count; i++) {
    189     owl_free(subs[i].zsub_class);
    190     owl_free(subs[i].zsub_classinst);
    191     owl_free(subs[i].zsub_recipient);
     193  int ret;
     194  if (owl_global_is_havezephyr(&g)) {
     195    int i;
     196    /* sub without defaults */
     197    if (ZSubscribeToSansDefaults(subs,count,0) != ZERR_NONE) {
     198      owl_function_error("Error subscribing to zephyr notifications.");
     199      ret=-2;
     200    }
     201
     202    /* free stuff */
     203    for (i=0; i<count; i++) {
     204      owl_free(subs[i].zsub_class);
     205      owl_free(subs[i].zsub_classinst);
     206      owl_free(subs[i].zsub_recipient);
     207    }
     208
     209    owl_free(subs);
     210  } else {
     211    owl_sub_list *s = owl_malloc(sizeof(owl_sub_list));
     212    s->subs = subs;
     213    s->nsubs = count;
     214    deferred_subs = g_list_append(deferred_subs, s);
    192215  }
    193216
     
    242265   
    243266    if (count >= subSize) {
    244       ZSubscription_t* newsubs;
    245       newsubs = owl_realloc(subs, sizeof(ZSubscription_t) * subSize * 2);
    246       if (NULL == newsubs) {
    247         /* If realloc fails, load what we've got, clear, and continue */
    248         ret = owl_zephyr_loadsubs_helper(subs, count);
    249         if (ret != 0) {
    250           fclose(file);
    251           return(ret);
    252         }
    253         count=0;
    254       }
    255       else {
    256         subs = newsubs;
    257         subSize *= 2;
    258       }
     267      subSize *= 2;
     268      subs = owl_realloc(subs, sizeof(ZSubscription_t) * subSize);
    259269    }
    260270   
     
    281291  fclose(file);
    282292
    283   ret=owl_zephyr_loadsubs_helper(subs, count);
    284   owl_free(subs);
     293  owl_zephyr_loadsubs_helper(subs, count);
    285294  return(ret);
    286295#else
     
    308317#ifdef HAVE_LIBZEPHYR
    309318  FILE *file;
    310   ZSubscription_t subs[3001];
     319  ZSubscription_t *subs;
     320  int numSubs = 100;
    311321  char subsfile[1024], buffer[1024];
    312   int count, ret, i;
     322  int count, ret;
    313323  struct stat statbuff;
     324
     325  subs = owl_malloc(numSubs * sizeof(ZSubscription_t));
    314326
    315327  if (filename==NULL) {
     
    325337
    326338  ZResetAuthentication();
    327   /* need to redo this to do chunks, not just bag out after 3000 */
    328339  count=0;
    329340  file=fopen(subsfile, "r");
     
    332343      if (buffer[0]=='#' || buffer[0]=='\n' || buffer[0]=='\n') continue;
    333344     
    334       if (count >= 3000) break; /* also tell the user */
     345      if (count == numSubs) {
     346        numSubs *= 2;
     347        subs = owl_realloc(subs, numSubs * sizeof(ZSubscription_t));
     348      }
    335349
    336350      buffer[strlen(buffer)-1]='\0';
    337       subs[count].zsub_class="login";
    338       subs[count].zsub_recipient="*";
     351      subs[count].zsub_class=owl_strdup("login");
     352      subs[count].zsub_recipient=owl_strdup("*");
    339353      if (strchr(buffer, '@')) {
    340         subs[count].zsub_classinst=owl_strdup(buffer);
     354        subs[count].zsub_classinst=owl_strdup(buffer);
    341355      } else {
    342         subs[count].zsub_classinst=owl_sprintf("%s@%s", buffer, ZGetRealm());
     356        subs[count].zsub_classinst=owl_sprintf("%s@%s", buffer, ZGetRealm());
    343357      }
    344358
     
    351365  }
    352366
    353   /* sub with defaults */
    354   if (ZSubscribeToSansDefaults(subs,count,0) != ZERR_NONE) {
    355     owl_function_error("Error subscribing to zephyr notifications.");
    356     ret=-2;
    357   }
    358 
    359   /* free stuff */
    360   for (i=0; i<count; i++) {
    361     owl_free(subs[i].zsub_classinst);
    362   }
    363 
     367  ret = owl_zephyr_loadsubs_helper(subs, count);
    364368  return(ret);
    365369#else
Note: See TracChangeset for help on using the changeset viewer.