Changeset 3f82515 for functions.c


Ignore:
Timestamp:
Feb 10, 2011, 9:08:33 PM (14 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.8, release-1.9
Children:
edd0be7
Parents:
6965867
git-author:
David Benjamin <davidben@mit.edu> (01/24/11 17:33:31)
git-committer:
David Benjamin <davidben@mit.edu> (02/10/11 21:08:33)
Message:
Rewrite aimwrite

This now makes more gratuitous use of glib and should, as a bonus, be
more sensible. In particular, we now consistently handle multi-word
recipients with and without -m. Also avoid duplicating sending code.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r9de316d1 r3f82515  
    350350}
    351351
    352 void owl_function_aimwrite_setup(const char *line)
    353 {
     352void owl_function_aimwrite_setup(const char *to)
     353{
     354  /* TODO: We probably actually want an owl_aimwrite object like
     355   * owl_zwrite. */
     356  char *line = owl_sprintf("aimwrite %s", to);
    354357  owl_function_write_setup("message");
    355358  owl_function_start_edit_win(line,
    356359                              &owl_callback_aimwrite,
    357                               owl_strdup(line),
     360                              owl_strdup(to),
    358361                              owl_free);
    359 
     362  owl_free(line);
    360363}
    361364
     
    477480
    478481void owl_callback_aimwrite(owl_editwin *e) {
    479   char *command = owl_editwin_get_cbdata(e);
    480   owl_function_aimwrite(command,
    481                         owl_editwin_get_text(e));
    482 }
    483 
    484 void owl_function_aimwrite(const char *line, const char *msg)
     482  char *to = owl_editwin_get_cbdata(e);
     483  owl_function_aimwrite(to, owl_editwin_get_text(e), true);
     484}
     485
     486void owl_function_aimwrite(const char *to, const char *msg, bool unwrap)
    485487{
    486488  int ret;
    487   const char *to;
    488489  char *format_msg;
    489490  owl_message *m;
    490491
    491   to = line + 9;
    492 
    493492  /* make a formatted copy of the message */
    494   format_msg=owl_strdup(msg);
    495   owl_text_wordunwrap(format_msg);
     493  format_msg = owl_strdup(msg);
     494  if (unwrap)
     495    owl_text_wordunwrap(format_msg);
    496496 
    497497  /* send the message */
Note: See TracChangeset for help on using the changeset viewer.