Changeset b43035e


Ignore:
Timestamp:
Jan 23, 2012, 6:41:42 PM (10 years ago)
Author:
GitHub Merge Button <merge-button@github.com>
Parents:
d126a19 (diff), bd482c3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merge bd482c3a3acaa8cee4b0527fb21a61c2ed52e4e6 into d126a19eb5f8a883b722fb26d21fb7b62b2aedeb
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    recfbdcc rbd482c3  
    216216void owl_function_add_outgoing_zephyrs(const owl_zwrite *z)
    217217{
    218   if (z->cc || owl_zwrite_get_numrecips(z) == 0) {
     218  if (z->cc && owl_zwrite_is_personal(z)) {
    219219    /* create the message */
    220220    owl_message *m = g_new(owl_message, 1);
     
    225225    int i;
    226226    for (i = 0; i < owl_zwrite_get_numrecips(z); i++) {
     227      owl_message *m;
     228
     229      if (!owl_zwrite_recip_is_personal(owl_zwrite_get_recip_n(z, i)))
     230        continue;
     231
    227232      /* create the message */
    228       owl_message *m = g_new(owl_message, 1);
     233      m = g_new(owl_message, 1);
    229234      owl_message_create_from_zwrite(m, z, owl_zwrite_get_message(z), i);
    230235
     
    373378  owl_function_makemsg("Waiting for ack...");
    374379
    375   /* If it's personal */
    376   if (owl_zwrite_is_personal(z)) {
    377     /* create the outgoing message */
    378     owl_function_add_outgoing_zephyrs(z);
    379   }
     380  /* create the outgoing message */
     381  owl_function_add_outgoing_zephyrs(z);
    380382}
    381383#else
     
    427429  owl_function_makemsg("Waiting for ack...");
    428430
    429   /* If it's personal */
    430   if (owl_zwrite_is_personal(z)) {
    431     /* Create the outgoing message. Restore the un-crypted message for display. */
    432     owl_zwrite_set_message_raw(z, old_msg);
    433     owl_function_add_outgoing_zephyrs(z);
    434   }
     431  /* Create the outgoing message. Restore the un-crypted message for display. */
     432  owl_zwrite_set_message_raw(z, old_msg);
     433  owl_function_add_outgoing_zephyrs(z);
    435434
    436435  /* Clean up. */
  • message.c

    r6646fdb rbff1f22  
    836836
    837837 
    838   /* set the "isprivate" attribute if it's a private zephyr.
    839    ``private'' means recipient is non-empty and doesn't start wit
    840    `@' */
    841   if (*n->z_recipient && *n->z_recipient != '@') {
     838  /* set the "isprivate" attribute if it's a private zephyr. */
     839  if (owl_zwrite_recip_is_personal(n->z_recipient)) {
    842840    owl_message_set_isprivate(m);
    843841  }
  • perl/lib/BarnOwl/Message/Zephyr.pm

    redd0be7 rbf70350  
    171171        $class = $self->class;
    172172        $instance = $self->instance;
    173         if ($self->recipient eq '*' || $self->recipient eq '') {
    174             $to = '';
    175         } elsif ($self->recipient =~ /^@/) {
     173        if ($self->recipient eq '' || $self->recipient =~ /^@/) {
    176174            $to = $self->recipient;
    177175        } else {
  • zephyr.c

    rd953ede rf183917  
    697697  Code_t ret;
    698698  ZNotice_t notice;
     699  char *zsender = NULL;
    699700   
    700701  memset(&notice, 0, sizeof(notice));
     
    708709  notice.z_class=zstr(class);
    709710  notice.z_class_inst=zstr(instance);
    710   notice.z_sender=NULL;
    711   if (!strcmp(recipient, "*") || !strcmp(recipient, "@")) {
     711  if (!strcmp(recipient, "@")) {
    712712    notice.z_recipient=zstr("");
    713     if (*owl_global_get_zsender(&g))
    714         notice.z_sender=zstr(owl_global_get_zsender(&g));
    715713  } else {
    716714    notice.z_recipient=zstr(recipient);
    717715  }
     716  if (!owl_zwrite_recip_is_personal(recipient) && *owl_global_get_zsender(&g))
     717    notice.z_sender = zsender = long_zuser(owl_global_get_zsender(&g));
    718718  notice.z_default_format=zstr("Class $class, Instance $instance:\nTo: @bold($recipient) at $time $date\nFrom: @bold{$1 <$sender>}\n\n$2");
    719719  if (opcode) notice.z_opcode=zstr(opcode);
     
    730730  g_free(notice.z_message);
    731731  ZFreeNotice(&notice);
     732  g_free(zsender);
    732733  if (ret != ZERR_NONE) {
    733734    owl_function_error("Error sending zephyr: %s", error_message(ret));
     
    789790  } else if (!strcmp(retnotice->z_message, ZSRVACK_NOTSENT)) {
    790791    if (retnotice->z_recipient == NULL
    791         || *retnotice->z_recipient == 0
    792         || *retnotice->z_recipient == '@') {
     792        || !owl_zwrite_recip_is_personal(retnotice->z_recipient)) {
    793793      char *buff;
    794794      owl_function_error("No one subscribed to class %s", retnotice->z_class);
  • zwrite.c

    ref4074b r919cbf2  
    182182  }
    183183
    184   /* if there are no recipients we won't send a ping, which
    185      is what we want */
    186184  for (i = 0; i < z->recips->len; i++) {
    187185    to = owl_zwrite_get_recip_n_with_realm(z, i);
    188     send_ping(to, z->class, z->inst);
     186    if (owl_zwrite_recip_is_personal(to))
     187      send_ping(to, z->class, z->inst);
    189188    g_free(to);
    190189  }
     
    207206  g_free(z->message);
    208207
    209   if (z->recips->len > 0 && z->cc) {
     208  if (z->cc && owl_zwrite_is_personal(z)) {
    210209    message = g_string_new("CC: ");
    211210    for (i = 0; i < z->recips->len; i++) {
     
    338337}
    339338
    340 int owl_zwrite_is_personal(const owl_zwrite *z)
     339bool owl_zwrite_recip_is_personal(const char *recipient)
     340{
     341  return recipient[0] && recipient[0] != '@';
     342}
     343
     344bool owl_zwrite_is_personal(const owl_zwrite *z)
    341345{
    342346  /* return true if at least one of the recipients is personal */
    343347  int i;
    344   char *recip;
    345 
    346   for (i = 0; i < z->recips->len; i++) {
    347     recip = z->recips->pdata[i];
    348     if (recip[0] != '@') return 1;
    349   }
    350   return(0);
     348
     349  for (i = 0; i < z->recips->len; i++)
     350    if (owl_zwrite_recip_is_personal(z->recips->pdata[i]))
     351      return true;
     352  return false;
    351353}
    352354
Note: See TracChangeset for help on using the changeset viewer.