Changeset ecd5dc5


Ignore:
Timestamp:
Apr 12, 2003, 4:54:57 PM (18 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
e9b1f60
Parents:
8262340
Message:
M-p is bound to 'view personal' by default
loadsubs and loadloginsubs only print messages if in interactive
  mode
added the 'alert_filter' variable, defaults to 'none'.
added the 'alert_action' variable, which is an owl command that
  will be executed when new messages arive that match the
  alert_filter
added the 'term' command which takes the 'raise' and 'deiconify'
  options.  It assumes xterm for now.
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r8262340 recd5dc5  
    3333          with stale tickets
    3434        Added some hooks for malloc debugging
     35        M-p is bound to 'view personal' by default
     36        loadsubs and loadloginsubs only print messages if in interactive
     37          mode
     38        added the 'alert_filter' variable, defaults to 'none'.
     39        added the 'alert_action' variable, which is an owl command that
     40          will be executed when new messages arive that match the
     41          alert_filter
     42        added the 'term' command which takes the 'raise' and 'deiconify'
     43          options.  It assumes xterm for now.
    3544       
    36451.2.8
  • commands.c

    r7933748 recd5dc5  
    6161  OWLCMD_ALIAS("exit", "quit"),
    6262  OWLCMD_ALIAS("q",    "quit"),
     63
     64  OWLCMD_ARGS("term", owl_command_term, OWL_CTX_ANY,
     65              "control the terminal",
     66              "term raise\n"
     67              "term deiconify\n",
     68              ""),
     69
     70  OWLCMD_VOID("nop", owl_command_nop, OWL_CTX_ANY,
     71              "do nothing",
     72              "",
     73              ""),
    6374 
    6475  OWLCMD_ARGS("start-command", owl_command_start_command, OWL_CTX_INTERACTIVE,
     
    750761}
    751762
     763void owl_command_nop() {
     764}
     765
    752766char *owl_command_help(int argc, char **argv, char *buff) {
    753767  if (argc!=2) {
     
    11681182  if (argc<2) {
    11691183    owl_function_makemsg("Need at least one argument to debug command");
    1170     return NULL;
     1184    return(NULL);
    11711185  }
    11721186
    11731187  if (!owl_global_is_debug_fast(&g)) {
    11741188    owl_function_makemsg("Debugging is not turned on");
    1175     return NULL;
     1189    return(NULL);
    11761190  }
    11771191
    11781192  owl_function_debugmsg(argv[1]);
    1179   return NULL;
    1180 }
    1181 
    1182 char *owl_command_ktest(int argc, char **argv, char *buff) {
    1183   owl_function_popless_text("foobar");
    1184   return NULL;
     1193  return(NULL);
     1194}
     1195
     1196char *owl_command_term(int argc, char **argv, char *buff) {
     1197  if (argc<2) {
     1198    owl_function_makemsg("Need at least one argument to the term command");
     1199    return(NULL);
     1200  }
     1201
     1202  if (!strcmp(argv[1], "raise")) {
     1203    owl_function_xterm_raise();
     1204  } else if (!strcmp(argv[1], "deiconify")) {
     1205    owl_function_xterm_deiconify();
     1206  } else {
     1207    owl_function_makemsg("Uknown terminal subcommand");
     1208  }
     1209  return(NULL);
    11851210}
    11861211
  • context.c

    r10b866d recd5dc5  
    4444}
    4545
     46int owl_context_is_interactive(owl_context *ctx) {
     47  return(ctx->mode & OWL_CTX_INTERACTIVE)?1:0;
     48}
    4649
    4750void owl_context_set_startup(owl_context *ctx) {
  • functions.c

    r8262340 recd5dc5  
    515515void owl_function_loadsubs(char *file) {
    516516  int ret;
     517
    517518  ret=owl_zephyr_loadsubs(file);
     519
     520  if (!owl_context_is_interactive(owl_global_get_context(&g))) return;
    518521  if (ret==0) {
    519522    owl_function_makemsg("Subscribed to messages from file.");
     
    527530void owl_function_loadloginsubs(char *file) {
    528531  int ret;
     532
    529533  ret=owl_zephyr_loadloginsubs(file);
     534
     535  if (!owl_context_is_interactive(owl_global_get_context(&g))) return;
    530536  if (ret==0) {
    531537    owl_function_makemsg("Subscribed to login messages from file.");
     
    26252631  }
    26262632}
     2633
     2634void owl_function_xterm_raise() {
     2635  char buff[10];
     2636
     2637  buff[0]=0x1b;
     2638  buff[1]='[';
     2639  buff[2]='5';
     2640  buff[3]='t';
     2641  write(fileno(stdout), buff, 4);
     2642}
     2643
     2644void owl_function_xterm_deiconify() {
     2645  char buff[10];
     2646
     2647  buff[0]=0x1b;
     2648  buff[1]='[';
     2649  buff[2]='1';
     2650  buff[3]='t';
     2651  write(fileno(stdout), buff, 4);
     2652}
  • global.c

    r8262340 recd5dc5  
    9090
    9191void _owl_global_setup_windows(owl_global *g) {
    92   int lines, cols, typwin_lines;
    93 
    94   lines=g->lines;
     92  int cols, typwin_lines;
     93
    9594  cols=g->cols;
    96   typwin_lines = owl_global_get_typwin_lines(g);
     95  typwin_lines=owl_global_get_typwin_lines(g);
    9796
    9897  /* set the new window sizes */
    9998  g->recwinlines=g->lines-(typwin_lines+2);
     99  if (g->recwinlines<1) {
     100    /* this will screw things up.  I'm not sure what to do yet,
     101       but this is better than nothing */
     102    /* g->recwinlines=1; */
     103  }
    100104
    101105  /* create the new windows */
    102106  g->recwin=newwin(g->recwinlines, cols, 0, 0);
     107  if (g->recwin==NULL) {
     108    owl_function_debugmsg("\n\nI just received an error on creating a new receive window\n");
     109    owl_function_debugmsg("newwin was called with arguments (%i, %i, 0, 0) and returned NULL\n",
     110           g->recwinlines, cols);
     111    endwin();
     112
     113    exit(50);
     114  }
     115     
    103116  g->sepwin=newwin(1, cols, g->recwinlines, 0);
    104117  g->msgwin=newwin(1, cols, g->recwinlines+1, 0);
     
    375388  }
    376389
    377   /*
    378   char buff[1024];
    379   sprintf(buff, "New size is %i lines, %i cols.\n", size.ws_row, size.ws_col);
    380   owl_function_makemsg(buff);
    381   */
     390  owl_function_debugmsg("New size is %i lines, %i cols.", size.ws_row, size.ws_col);
    382391  owl_function_makemsg("");
    383 
    384392  g->resizepending=0;
    385393}
  • keys.c

    r42abb10 recd5dc5  
    203203  BIND_CMD("M-n", "smartnarrow",      "narrow to a view based on the current message");
    204204  BIND_CMD("M-N", "smartnarrow -i",   "narrow to a view based on the current message, and consider instance pair");
    205 
     205  BIND_CMD("M-p", "view personal", "");
     206 
    206207  BIND_CMD("/",   "start-command search ", "start a search command");
    207208  BIND_CMD("?",   "start-command search -r ", "start a revrerse search command");
  • message.c

    r8262340 recd5dc5  
    472472    tmp2=owl_util_stripnewlines(tmp);
    473473    owl_message_set_body(m, tmp2);
    474     owl_free(tmp);
    475474    owl_free(tmp2);
    476475  } else {
    477476    owl_message_set_body(m, tmp);
    478477  }
     478  owl_free(tmp);
    479479
    480480  /* if zcrypt is enabled try to decrypt the message */
     
    743743
    744744  /* get the body */
    745   body=owl_malloc(strlen(owl_message_get_body(m)+30));
    746   strcpy(body, owl_message_get_body(m));
     745  body=owl_strdup(owl_message_get_body(m));
     746  body=realloc(body, strlen(body)+30);
    747747
    748748  /* add a newline if we need to */
  • owl.c

    r7933748 recd5dc5  
    268268      struct sockaddr_in from;
    269269      owl_message *m;
     270      owl_filter *f;
    270271
    271272      /* grab a notice, but if we've done 20 without stopping, take
     
    315316        owl_function_beep();
    316317      }
     318
     319      /* if it matches the alert filter, do the alert action */
     320      f=owl_global_get_filter(&g, owl_global_get_alert_filter(&g));
     321      if (f && owl_filter_message_match(f, m)) {
     322        owl_function_command(owl_global_get_alert_action(&g));
     323      }
     324
     325         
    317326
    318327      /* check for burning ears message */
  • variable.c

    rced25d1 recd5dc5  
    187187                 "home view to switch to after 'X' and 'V'",
    188188                 "SEE ALSO: view, filter\n" ),
     189
     190  OWLVAR_STRING( "alert_filter" /* %OwlVarStub */, "none",
     191                 "filter on which to trigger alert actions",
     192                 "" ),
     193
     194  OWLVAR_STRING( "alert_action" /* %OwlVarStub */, "nop",
     195                 "filter on which to trigger alert actions",
     196                 "" ),
    189197
    190198  OWLVAR_STRING_FULL( "tty" /* %OwlVarStub */, "", "tty name for zephyr location", "",
     
    257265               "to display the requested URL.\n",
    258266               "none,netscape,galeon,opera" ),
     267
    259268
    260269  OWLVAR_BOOL( "_followlast" /* %OwlVarStub */, 0,
Note: See TracChangeset for help on using the changeset viewer.