Changeset e5da3fe for functions.c


Ignore:
Timestamp:
Mar 24, 2011, 4:24:25 PM (13 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.8, release-1.9
Children:
a5b5d00
Parents:
283ff1e
git-author:
DD Liu <liudi@mit.edu> (11/06/10 22:35:54)
git-committer:
David Benjamin <davidben@mit.edu> (03/24/11 16:24:25)
Message:
Create per-recipient copies of outgoing messages for non-CC'd personals

Fixes bug #63.

[davidben@mit.edu: Fix up comment, rebase to master]
[davidben@mit.edu: Address nitpicks]
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    rc809f5e re5da3fe  
    250250}
    251251
    252 /* Create an outgoing zephyr message and return a pointer to it.  Does
    253  * not put it on the global queue, use owl_global_messagequeue_addmsg() for
    254  * that.
     252/* Queues outgoing zephyrs; if z sends to n people, queue n messages
     253 * (except in case of cc). If there are no recipients queues 1
     254 * message.
    255255 */
    256 owl_message *owl_function_make_outgoing_zephyr(const owl_zwrite *z)
    257 {
    258   owl_message *m;
    259 
    260   /* create the message */
    261   m=g_new(owl_message, 1);
    262   owl_message_create_from_zwrite(m, z, owl_zwrite_get_message(z));
    263 
    264   return(m);
     256void owl_function_add_outgoing_zephyrs(const owl_zwrite *z)
     257{
     258  if (z->cc || owl_zwrite_get_numrecips(z) == 0) {
     259    /* create the message */
     260    owl_message *m = g_new(owl_message, 1);
     261    owl_message_create_from_zwrite(m, z, owl_zwrite_get_message(z), 0);
     262
     263    owl_global_messagequeue_addmsg(&g, m);
     264  } else {
     265    int i;
     266    for (i = 0; i < owl_zwrite_get_numrecips(z); i++) {
     267      /* create the message */
     268      owl_message *m = g_new(owl_message, 1);
     269      owl_message_create_from_zwrite(m, z, owl_zwrite_get_message(z), i);
     270
     271      owl_global_messagequeue_addmsg(&g, m);
     272    }
     273  }
    265274}
    266275
     
    268277 * message or NULL if we're not logged into AIM (and thus unable to
    269278 * create the message).  Does not put it on the global queue.  Use
    270  * owl_global_messagequeue_addmsg() for that .
     279 * owl_global_messagequeue_addmsg() for that.
    271280 */
    272281owl_message *owl_function_make_outgoing_aim(const char *body, const char *to)
     
    378387}
    379388
    380 /* send, log and display an outgoing zephyr.  If 'msg' is NULL
    381  * the message is expected to be set from the zwrite line itself
     389/* send, log and display outgoing zephyrs.  If 'msg' is NULL the
     390 * message is expected to be set from the zwrite line itself
    382391 */
    383392#ifdef HAVE_LIBZEPHYR
    384393void owl_function_zwrite(owl_zwrite *z, const char *msg)
    385394{
    386   owl_message *m;
    387395  int ret;
    388396
     
    407415  if (owl_zwrite_is_personal(z)) {
    408416    /* create the outgoing message */
    409     m=owl_function_make_outgoing_zephyr(z);
    410 
    411     if (m) {
    412       owl_global_messagequeue_addmsg(&g, m);
    413     } else {
    414       owl_function_error("Could not create outgoing zephyr message");
    415     }
     417    owl_function_add_outgoing_zephyrs(z);
    416418  }
    417419}
     
    421423#endif
    422424
    423 /* send, log and display an outgoing zcrypt zephyr.  If 'msg' is NULL
     425/* send, log and display outgoing zcrypt zephyrs.  If 'msg' is NULL
    424426 * the message is expected to be set from the zwrite line itself
    425427 */
     
    427429{
    428430  char *cryptmsg;
    429   owl_message *m;
    430431  const char *argv[7];
    431432  char *zcrypt;
     
    469470    /* Create the outgoing message. Restore the un-crypted message for display. */
    470471    owl_zwrite_set_message_raw(z, old_msg);
    471     m=owl_function_make_outgoing_zephyr(z);
    472     if (m) {
    473       owl_global_messagequeue_addmsg(&g, m);
    474     } else {
    475       owl_function_error("Could not create outgoing zephyr message");
    476     }
     472    owl_function_add_outgoing_zephyrs(z);
    477473  }
    478474
Note: See TracChangeset for help on using the changeset viewer.