Changeset 486688f
- Timestamp:
- Sep 28, 2002, 1:14:45 PM (22 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 88736cb
- Parents:
- 55a4578
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r55faab7 r486688f 1 1 $Id$ 2 2 3 1.2.6 3 4 Started adding code for newmsgproc. It doesn't fully work yet! 4 5 Don't use it. 5 6 Added search, '/' and '?' to basic help. 7 Will attempt to keep the current message as close as possible 8 to the previous current message after an expunge. 9 "set <variable>" and "unset <variable>" now work for boolean variables. 6 10 7 11 1.2.5 … … 24 28 You can now use %me% in filters 25 29 The built-in personal filter is updated to do so 26 Fixed a bug in moving the poin er after an expunge30 Fixed a bug in moving the pointer after an expunge 27 31 Fixed up the normal scrolling code. Now it should always 28 32 land on a message, but it's still not optimal. -
commands.c
rbde7714 r486688f 114 114 OWLCMD_ARGS("set", owl_command_set, OWL_CTX_ANY, 115 115 "set a variable value", 116 "set [-q] <variable> <value>\n"116 "set [-q] <variable> [<value>]\n" 117 117 "set", 118 118 "Set the named variable to the specified value. If no\n" 119 119 "arguments are used print the value of all variables.\n" 120 "If value is unspecified and the variable is a boolean, will set it to 'on'.\n" 121 "If -q is specified, is silent and doesn't print a message.\n"), 122 123 OWLCMD_ARGS("unset", owl_command_unset, OWL_CTX_ANY, 124 "unset a boolean variable value", 125 "set [-q] <variable>\n" 126 "set", 127 "Set the named boolean variable to off.\n" 120 128 "If -q is specified, is silent and doesn't print a message.\n"), 121 129 … … 946 954 char *var, *val; 947 955 int silent=0; 956 int requirebool=0; 948 957 949 958 if (argc == 1) { 950 959 owl_function_printallvars(); 951 960 return NULL; 952 } else if (argc == 4 && !strcmp("-q",argv[1])) { 961 } 962 963 if (argc > 1 && !strcmp("-q",argv[1])) { 953 964 silent = 1; 954 var=argv[2]; 955 val=argv[3]; 965 argc--; argv++; 966 } 967 968 if (argc == 2) { 969 var=argv[1]; 970 val="on"; 971 requirebool=1; 956 972 } else if (argc == 3) { 957 973 var=argv[1]; … … 961 977 return NULL; 962 978 } 963 964 owl_variable_set_fromstring(owl_global_get_vardict(&g), var, val, !silent); 979 owl_variable_set_fromstring(owl_global_get_vardict(&g), var, val, !silent, requirebool); 980 return NULL; 981 } 982 983 char *owl_command_unset(int argc, char **argv, char *buff) { 984 char *var, *val; 985 int silent=0; 986 987 if (argc > 1 && !strcmp("-q",argv[1])) { 988 silent = 1; 989 argc--; argv++; 990 } 991 if (argc == 2) { 992 var=argv[1]; 993 val="off"; 994 } else { 995 owl_function_makemsg("Wrong number of arguments for unset command"); 996 return NULL; 997 } 998 owl_variable_set_fromstring(owl_global_get_vardict(&g), var, val, !silent, 1); 965 999 return NULL; 966 1000 } -
functions.c
r601a9e0 r486688f 397 397 owl_messagelist *ml; 398 398 owl_view *v; 399 int i, j;399 int lastmsgid=0; 400 400 401 401 curmsg=owl_global_get_curmsg(&g); … … 403 403 ml=owl_global_get_msglist(&g); 404 404 405 /* just check to make sure we're in bounds... */406 if (curmsg>owl_view_get_size(v)-1) curmsg=owl_view_get_size(v)-1;407 if (curmsg<0) curmsg=0;408 409 /* first try to move to an undeleted message in the view */410 405 m=owl_view_get_element(v, curmsg); 411 if (owl_message_is_delete(m)) { 412 /* try to find the next undeleted message */ 413 j=owl_view_get_size(v); 414 for (i=curmsg+1; i<j; i++) { 415 if (!owl_message_is_delete(owl_view_get_element(v, i))) { 416 owl_global_set_curmsg(&g, i); 417 break; 418 } 419 } 420 421 /* if we weren't successful try to find one backwards */ 422 curmsg=owl_global_get_curmsg(&g); 423 if (owl_message_is_delete(owl_view_get_element(v, curmsg))) { 424 for (i=curmsg; i>0; i--) { 425 if (!owl_message_is_delete(owl_view_get_element(v, i))) { 426 owl_global_set_curmsg(&g, i); 427 break; 428 } 429 } 430 } 431 } 406 if (m) lastmsgid = owl_message_get_id(m); 432 407 433 408 /* expunge the message list */ … … 437 412 owl_view_recalculate(v); 438 413 439 if (curmsg>owl_view_get_size(v)-1) { 440 owl_global_set_curmsg(&g, owl_view_get_size(v)-1); 441 if (owl_global_get_curmsg(&g)<0) { 442 owl_global_set_curmsg(&g, 0); 443 } 444 owl_function_calculate_topmsg(OWL_DIRECTION_NONE); 445 } 446 414 /* find where the new position should be 415 (as close as possible to where we last where) */ 416 curmsg = owl_view_get_nearest_to_msgid(v, lastmsgid); 417 if (curmsg>owl_view_get_size(v)-1) curmsg = owl_view_get_size(v)-1; 418 if (curmsg<0) curmsg = 0; 419 owl_global_set_curmsg(&g, curmsg); 420 owl_function_calculate_topmsg(OWL_DIRECTION_NONE); 447 421 /* if there are no messages set the direction to down in case we 448 422 delete everything upwards */ -
util.c
r5a6e6b9 r486688f 4 4 #include <unistd.h> 5 5 #include <malloc.h> 6 #include <unistd.h> 6 7 #include <ctype.h> 7 8 -
variable.c
r700c712 r486688f 430 430 431 431 /* returns 0 on success, prints a status msg if msg is true */ 432 int owl_variable_set_fromstring(owl_vardict *d, char *name, char *value, int msg ) {432 int owl_variable_set_fromstring(owl_vardict *d, char *name, char *value, int msg, int requirebool) { 433 433 owl_variable *v; 434 434 char buff2[1024]; … … 441 441 if (!v->set_fromstring_fn) { 442 442 if (msg) owl_function_makemsg("Variable %s is read-only", name); 443 return -1; 444 443 return -1; 444 } 445 if (requirebool && v->type!=OWL_VARIABLE_BOOL) { 446 if (msg) owl_function_makemsg("Variable %s is not a boolean", name); 447 return -1; 445 448 } 446 449 if (0 != v->set_fromstring_fn(v, value)) { … … 801 804 FAIL_UNLESS("set bool 1", 0==owl_variable_set_bool_on(&vd,"personalbell")); 802 805 FAIL_UNLESS("get bool 2", 1==owl_variable_get_bool(&vd,"personalbell")); 803 FAIL_UNLESS("set bool 3", 0==owl_variable_set_fromstring(&vd,"personalbell","off",0 ));806 FAIL_UNLESS("set bool 3", 0==owl_variable_set_fromstring(&vd,"personalbell","off",0,0)); 804 807 FAIL_UNLESS("get bool 4", 0==owl_variable_get_bool(&vd,"personalbell")); 805 FAIL_UNLESS("set bool 5", -1==owl_variable_set_fromstring(&vd,"personalbell","xxx",0 ));808 FAIL_UNLESS("set bool 5", -1==owl_variable_set_fromstring(&vd,"personalbell","xxx",0,0)); 806 809 FAIL_UNLESS("get bool 6", 0==owl_variable_get_bool(&vd,"personalbell")); 807 810 … … 819 822 FAIL_UNLESS("set int 1b", -1==owl_variable_set_int(&vd,"typewinsize",-3)); 820 823 FAIL_UNLESS("get int 2b", 12==owl_variable_get_int(&vd,"typewinsize")); 821 FAIL_UNLESS("set int 3", 0==owl_variable_set_fromstring(&vd,"typewinsize","9",0 ));824 FAIL_UNLESS("set int 3", 0==owl_variable_set_fromstring(&vd,"typewinsize","9",0,0)); 822 825 FAIL_UNLESS("get int 4", 9==owl_variable_get_int(&vd,"typewinsize")); 823 FAIL_UNLESS("set int 5", -1==owl_variable_set_fromstring(&vd,"typewinsize","xxx",0 ));824 FAIL_UNLESS("set int 6", -1==owl_variable_set_fromstring(&vd,"typewinsize","",0 ));826 FAIL_UNLESS("set int 5", -1==owl_variable_set_fromstring(&vd,"typewinsize","xxx",0,0)); 827 FAIL_UNLESS("set int 6", -1==owl_variable_set_fromstring(&vd,"typewinsize","",0,0)); 825 828 FAIL_UNLESS("get int 7", 9==owl_variable_get_int(&vd,"typewinsize")); 826 829 … … 833 836 FAIL_UNLESS("set enum 1b", -1==owl_variable_set_int(&vd,"webbrowser",209)); 834 837 FAIL_UNLESS("get enum 2b", OWL_WEBBROWSER_GALEON==owl_variable_get_int(&vd,"webbrowser")); 835 FAIL_UNLESS("set enum 3", 0==owl_variable_set_fromstring(&vd,"webbrowser","none",0 ));838 FAIL_UNLESS("set enum 3", 0==owl_variable_set_fromstring(&vd,"webbrowser","none",0,0)); 836 839 FAIL_UNLESS("get enum 4", OWL_WEBBROWSER_NONE==owl_variable_get_int(&vd,"webbrowser")); 837 FAIL_UNLESS("set enum 5", 0==owl_variable_set_fromstring(&vd,"webbrowser","netscape",0 ));840 FAIL_UNLESS("set enum 5", 0==owl_variable_set_fromstring(&vd,"webbrowser","netscape",0,0)); 838 841 FAIL_UNLESS("get enum 6", OWL_WEBBROWSER_NETSCAPE==owl_variable_get_int(&vd,"webbrowser")); 839 FAIL_UNLESS("set enum 7", -1==owl_variable_set_fromstring(&vd,"webbrowser","xxx",0 ));840 FAIL_UNLESS("set enum 8", -1==owl_variable_set_fromstring(&vd,"webbrowser","",0 ));841 FAIL_UNLESS("set enum 9", -1==owl_variable_set_fromstring(&vd,"webbrowser","netscapey",0 ));842 FAIL_UNLESS("set enum 7", -1==owl_variable_set_fromstring(&vd,"webbrowser","xxx",0,0)); 843 FAIL_UNLESS("set enum 8", -1==owl_variable_set_fromstring(&vd,"webbrowser","",0,0)); 844 FAIL_UNLESS("set enum 9", -1==owl_variable_set_fromstring(&vd,"webbrowser","netscapey",0,0)); 842 845 FAIL_UNLESS("get enum 10", OWL_WEBBROWSER_NETSCAPE==owl_variable_get_int(&vd,"webbrowser")); 843 846
Note: See TracChangeset
for help on using the changeset viewer.