Changeset 1b6b2f3 for functions.c


Ignore:
Timestamp:
Oct 27, 2006, 1:17:18 PM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
e74c01c
Parents:
dd16bdd
Message:
Refactoring the editwin code somewhat, and adding the ability to hang
arbitrary reply commands off of messages.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r4211f50b r1b6b2f3  
    320320
    321321  owl_global_set_buffercommand(&g, line);
    322   owl_global_set_buffercallback(&g, &owl_function_zwrite);
     322  owl_global_set_buffercallback(&g, &owl_callback_zwrite);
    323323}
    324324
     
    351351
    352352  owl_global_set_buffercommand(&g, line);
    353   owl_global_set_buffercallback(&g, &owl_function_aimwrite);
     353  owl_global_set_buffercallback(&g, &owl_callback_aimwrite);
    354354}
    355355
     
    376376
    377377  owl_global_set_buffercommand(&g, "loopwrite");
    378   owl_global_set_buffercallback(&g, &owl_function_loopwrite);
     378  owl_global_set_buffercallback(&g, &owl_callback_loopwrite);
     379}
     380
     381void owl_callback_zwrite(owl_editwin *e) {
     382  owl_function_zwrite(owl_editwin_get_command(e),
     383                      owl_editwin_get_text(e));
    379384}
    380385
     
    486491}
    487492
     493void owl_callback_aimwrite(owl_editwin *e) {
     494  owl_function_aimwrite(owl_editwin_get_command(e),
     495                        owl_editwin_get_text(e));
     496}
     497
    488498void owl_function_aimwrite(char *line, char *msg)
    489499{
     
    562572}
    563573
    564 void owl_function_loopwrite(char *line, char *msg)
     574void owl_callback_loopwrite(owl_editwin *e) {
     575  owl_function_loopwrite(owl_editwin_get_text(e));
     576}
     577
     578void owl_function_loopwrite(char *msg)
    565579{
    566580  owl_message *min, *mout;
     
    932946    owl_function_error("Error subscribing to login messages from file.");
    933947  }
     948}
     949
     950void owl_callback_aimlogin(owl_editwin *e) {
     951  owl_function_aimlogin(owl_editwin_get_command(e),
     952                        owl_global_get_response(&g));
    934953}
    935954
     
    13241343void owl_function_run_buffercommand()
    13251344{
    1326   char *buff;
    1327   void (*cb)(char*, char*);
    1328 
    1329   buff=owl_global_get_buffercommand(&g);
    1330   cb=owl_global_get_buffercallback(&g);
    1331   if(!cb) {
    1332     owl_function_error("Internal error: No callback for buffercommand %s", buff);
    1333   } else {
    1334     cb(buff, owl_editwin_get_text(owl_global_get_typwin(&g)));
    1335   }
     1345  owl_editwin_do_callback(owl_global_get_typwin(&g));
    13361346}
    13371347
     
    21672177      }
    21682178      if (cc) owl_free(cc);
    2169     }
    2170 
    2171     /* aim */
    2172     if (owl_message_is_type_aim(m)) {
     2179    } else if (owl_message_is_type_aim(m)) {
     2180      /* aim */
    21732181      if (owl_message_is_direction_out(m)) {
    21742182        buff=owl_sprintf("aimwrite %s", owl_message_get_recipient(m));
     
    21762184        buff=owl_sprintf("aimwrite %s", owl_message_get_sender(m));
    21772185      }
    2178     }
    2179    
     2186    } else {
     2187      char *cmd;
     2188      if((type==0 && (cmd=owl_message_get_attribute_value(m, "replycmd")))
     2189         || (type==1 && (cmd=owl_message_get_attribute_value(m, "replysendercmd")))) {
     2190        buff = owl_strdup(cmd);
     2191      }
     2192    }
     2193
    21802194    if (enter) {
    21812195      owl_history *hist = owl_global_get_cmd_history(&g);
Note: See TracChangeset for help on using the changeset viewer.