Changeset cba04e0


Ignore:
Timestamp:
Jan 11, 2007, 11:02:24 AM (18 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
12e5f17
Parents:
dcc1335
Message:
* Make yes/no not segfault when there is no current messge.
* Make yes/no return types consistant with the rest of commands.c.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    rf4d32cd rcba04e0  
    24402440}
    24412441
    2442 void owl_command_yes(void)
    2443 {
    2444   owl_message *m = owl_view_get_element(owl_global_get_current_view(&g),
    2445                                         owl_global_get_curmsg(&g));
     2442char *owl_command_yes(void)
     2443{
     2444  owl_message *m;
     2445  owl_view *v;
     2446
     2447  v = owl_global_get_current_view(&g);
     2448
     2449  /* bail if there's no current message */
     2450  if (owl_view_get_size(v) < 1) {
     2451    owl_function_error("No current message.");
     2452    return NULL;
     2453  }
     2454
     2455  m = owl_view_get_element(v, owl_global_get_curmsg(&g));
    24462456  if(!owl_message_is_question(m)) {
    24472457    owl_function_error("That message isn't a question.");
     
    24602470  owl_function_command_norv(cmd);
    24612471  owl_message_set_isanswered(m);
     2472  return NULL;
    24622473}
    24632474
    24642475char *owl_command_no(void)
    24652476{
    2466   owl_message *m = owl_view_get_element(owl_global_get_current_view(&g),
    2467                                         owl_global_get_curmsg(&g));
     2477  owl_message *m;
     2478  owl_view *v;
     2479
     2480  v = owl_global_get_current_view(&g);
     2481
     2482  /* bail if there's no current message */
     2483  if (owl_view_get_size(v) < 1) {
     2484    owl_function_error("No current message.");
     2485    return NULL;
     2486  }
     2487
     2488  m = owl_view_get_element(v, owl_global_get_curmsg(&g));
    24682489  if(!owl_message_is_question(m)) {
    24692490    owl_function_error("That message isn't a question.");
     
    24822503  owl_function_command_norv(cmd);
    24832504  owl_message_set_isanswered(m);
     2505  return NULL;
    24842506}
    24852507
Note: See TracChangeset for help on using the changeset viewer.