Changeset 7360fab
- Timestamp:
- Jun 29, 2002, 1:21:36 PM (23 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:
- d36f2cb
- Parents:
- 855ebe7
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r855ebe7 r7360fab 19 19 Updated examples/owlconf.erik with the above. 20 20 Fixed the annoying pagedown sometimes-not-working bug. 21 Made owl_function_fast*filt return a string and not do the 22 narrowing, to make it more general. 23 Added a smartfilter command that creates a filter 24 based on the current message and returns the name 25 of the filter. 26 Added --smart-filter and --smart-filter-instance options 27 to the next and prev commands. 28 Added M-C-n and M-C-p keybindings to "move to next message 29 matching current" and "move to previous message 30 matching current" 21 31 22 32 1.2.0-pre-erikdevel-17 -
commands.c
rb950088 r7360fab 195 195 OWLCMD_ARGS("next", owl_command_next, OWL_CTX_INTERACTIVE, 196 196 "move the pointer to the next message", 197 "recv:next [ --filter <name> ] [ --skip-deleted ] [ --last-if-none ]", 197 "recv:next [ --filter <name> ] [ --skip-deleted ] [ --last-if-none ]\n" 198 " [ --smart-filter | --smart-filter-instance ]", 198 199 "Moves the pointer to the next message in the current view.\n" 199 200 "If --filter is specified, will only consider messages in\n" 200 201 "the filter <name>.\n" 202 "If --smart-filter or --smart-filter-instance is specified,\n" 203 "goes to the next message that is similar to the current message.\n" 201 204 "If --skip-deleted is specified, deleted messages will\n" 202 205 "be skipped.\n" … … 207 210 OWLCMD_ARGS("prev", owl_command_prev, OWL_CTX_INTERACTIVE, 208 211 "move the pointer to the previous message", 209 "recv:prev [ --filter <name> ] [ --skip-deleted ] [ --first-if-none ]", 212 "recv:prev [ --filter <name> ] [ --skip-deleted ] [ --first-if-none ]\n" 213 " [ --smart-filter | --smart-filter-instance ]", 210 214 "Moves the pointer to the next message in the current view.\n" 211 215 "If --filter is specified, will only consider messages in\n" 212 216 "the filter <name>.\n" 217 "If --smart-filter or --smart-filter-instance is specified,\n" 218 "goes to the previous message that is similar to the current message.\n" 213 219 "If --skip-deleted is specified, deleted messages will\n" 214 220 "be skipped.\n" … … 366 372 OWLCMD_ARGS("smartnarrow", owl_command_smartnarrow, OWL_CTX_INTERACTIVE, 367 373 "view only messages similar to the current message", 368 "smartnarrow [-i ]",374 "smartnarrow [-i | --instance]", 369 375 "If the curmsg is a personal message narrow\n" 370 376 " to the converstaion with that user.\n" … … 375 381 "If the curmsg is a class message and '-i' is specied\n" 376 382 " then narrow to the class, instance\n"), 383 384 OWLCMD_ARGS("smartfilter", owl_command_smartfilter, OWL_CTX_INTERACTIVE, 385 "returns the name of a filter based on the current message", 386 "smartfilter [-i | --instance]", 387 "If the curmsg is a personal message, the filter is\n" 388 " the converstaion with that user.\n" 389 "If the curmsg is a class message, instance foo, recip *\n" 390 " message, the filter is the class, inst.\n" 391 "If the curmsg is a class message, the filter is that class.\n" 392 "If the curmsg is a class message and '-i' is specied\n" 393 " the filter is that <class,instance> pair\n"), 377 394 378 395 OWLCMD_ARGS("viewclass", owl_command_viewclass, OWL_CTX_INTERACTIVE, … … 672 689 argc-=1; argv+=1; 673 690 } else if (argc>=2 && !strcmp(argv[1], "--filter")) { 674 filter = argv[2]; 691 filter = owl_strdup(argv[2]); 692 argc-=2; argv+=2; 693 } else if (argc>=2 && !strcmp(argv[1], "--smart-filter")) { 694 filter = owl_function_smartfilter(0); 695 argc-=2; argv+=2; 696 } else if (argc>=2 && !strcmp(argv[1], "--smart-filter-instance")) { 697 filter = owl_function_smartfilter(1); 675 698 argc-=2; argv+=2; 676 699 } else { … … 680 703 } 681 704 owl_function_nextmsg_full(filter, skip_deleted, last_if_none); 705 if (filter) owl_free(filter); 682 706 return(NULL); 683 707 } … … 694 718 argc-=1; argv+=1; 695 719 } else if (argc>=2 && !strcmp(argv[1], "--filter")) { 696 filter = argv[2];720 filter = owl_strdup(argv[2]); 697 721 argc-=2; argv+=2; 698 } else { 722 } else if (argc>=2 && !strcmp(argv[1], "--smart-filter")) { 723 filter = owl_function_smartfilter(0); 724 argc-=2; argv+=2; 725 } else if (argc>=2 && !strcmp(argv[1], "--smart-filter-instance")) { 726 filter = owl_function_smartfilter(1); 727 argc-=2; argv+=2; 728 } else { 699 729 owl_function_makemsg("Invalid arguments to command 'prev'."); 700 730 return(NULL); … … 702 732 } 703 733 owl_function_prevmsg_full(filter, skip_deleted, first_if_none); 734 if (filter) owl_free(filter); 704 735 return(NULL); 705 736 } 706 737 707 738 char *owl_command_smartnarrow(int argc, char **argv, char *buff) { 739 char *filtname = NULL; 740 708 741 if (argc == 1) { 709 owl_function_smartnarrow(0);710 } else if (argc == 2 && !strcmp(argv[1], "-i")) {711 owl_function_smartnarrow(1);742 filtname = owl_function_smartfilter(0); 743 } else if (argc == 2 && (!strcmp(argv[1], "-i") || !strcmp(argv[1], "--instance"))) { 744 filtname = owl_function_smartfilter(1); 712 745 } else { 713 746 owl_function_makemsg("Wrong number of arguments for %s", argv[0]); 714 747 } 715 return NULL; 748 if (filtname) { 749 owl_function_change_view(filtname); 750 owl_free(filtname); 751 } 752 return NULL; 753 } 754 755 char *owl_command_smartfilter(int argc, char **argv, char *buff) { 756 char *filtname = NULL; 757 758 if (argc == 1) { 759 filtname = owl_function_smartfilter(0); 760 } else if (argc == 2 && (!strcmp(argv[1], "-i") || !strcmp(argv[1], "--instance"))) { 761 filtname = owl_function_smartfilter(1); 762 } else { 763 owl_function_makemsg("Wrong number of arguments for %s", argv[0]); 764 } 765 return filtname; 716 766 } 717 767 … … 1183 1233 1184 1234 char *owl_command_viewclass(int argc, char **argv, char *buff) { 1235 char *filtname; 1185 1236 if (argc!=2) { 1186 1237 owl_function_makemsg("Wrong number of arguments to viewclass command"); 1187 1238 return NULL; 1188 1239 } 1189 owl_function_fastclassinstfilt(argv[1], NULL); 1240 filtname = owl_function_fastclassinstfilt(argv[1], NULL); 1241 owl_function_change_view(filtname); 1242 owl_free(filtname); 1190 1243 return NULL; 1191 1244 } 1192 1245 1193 1246 char *owl_command_viewuser(int argc, char **argv, char *buff) { 1247 char *filtname; 1194 1248 if (argc!=2) { 1195 1249 owl_function_makemsg("Wrong number of arguments to viewuser command"); 1196 1250 return NULL; 1197 1251 } 1198 owl_function_fastuserfilt(argv[1]); 1252 filtname = owl_function_fastuserfilt(argv[1]); 1253 owl_function_change_view(filtname); 1254 owl_free(filtname); 1199 1255 return NULL; 1200 1256 } … … 1233 1289 } 1234 1290 1235 if (argc==3 && !strcmp(argv[1], "-id")) {1291 if (argc==3 && (!strcmp(argv[1], "-id") || !strcmp(argv[1], "--id"))) { 1236 1292 owl_function_delete_by_id(atoi(argv[2]), 1); 1237 1293 return NULL; … … 1261 1317 } 1262 1318 1263 if (argc==3 && !strcmp(argv[1], "-id")) {1319 if (argc==3 && (!strcmp(argv[1], "-id") || !strcmp(argv[1], "--id"))) { 1264 1320 owl_function_delete_by_id(atoi(argv[2]), 0); 1265 1321 return NULL; -
functions.c
r855ebe7 r7360fab 1683 1683 } 1684 1684 1685 void owl_function_fastclassinstfilt(char *class, char *instance) { 1686 /* narrow to the current class, instance. If instance is null then 1687 just narrow to the current class */ 1685 char *owl_function_fastclassinstfilt(char *class, char *instance) { 1686 /* creates a filter for a class, instance if one doesn't exist. 1687 * If instance is null then apply for all messgaes in the class. 1688 * returns the name of the filter, which the caller must free.*/ 1688 1689 owl_list *fl; 1689 1690 owl_filter *f; … … 1706 1707 /* if it already exists then go with it. This lets users override */ 1707 1708 if (owl_global_get_filter(&g, filtname)) { 1708 owl_function_change_view(filtname); 1709 owl_free(filtname); 1710 return; 1709 return filtname; 1711 1710 } 1712 1711 … … 1724 1723 owl_global_add_filter(&g, f); 1725 1724 1726 /* set the current view to use it */1727 owl_function_change_view(filtname);1728 1729 1725 owl_free(argbuff); 1730 owl_free(filtname);1731 } 1732 1733 voidowl_function_fastuserfilt(char *user) {1726 return filtname; 1727 } 1728 1729 char *owl_function_fastuserfilt(char *user) { 1734 1730 owl_filter *f; 1735 1731 char *argbuff, *longuser, *shortuser, *filtname; … … 1745 1741 /* if it already exists then go with it. This lets users override */ 1746 1742 if (owl_global_get_filter(&g, filtname)) { 1747 owl_function_change_view(filtname); 1748 owl_free(filtname); 1749 return; 1743 return filtname; 1750 1744 } 1751 1745 … … 1763 1757 owl_global_add_filter(&g, f); 1764 1758 1765 /* set the current view to use it */1766 owl_function_change_view(filtname);1767 1768 1759 /* free stuff */ 1769 1760 owl_free(argbuff); 1770 owl_free(filtname);1771 1761 owl_free(longuser); 1772 1762 owl_free(shortuser); 1773 1763 1764 return filtname; 1774 1765 } 1775 1766 … … 1795 1786 } 1796 1787 1797 void owl_function_smartnarrow(int type) { 1798 /* if the curmsg is a personal message narrow 1788 char *owl_function_smartfilter(int type) { 1789 /* Returns the name of a filter, or null. The caller 1790 * must free this name. */ 1791 /* if the curmsg is a personal message return a filter name 1799 1792 * to the converstaion with that user. 1800 1793 * If the curmsg is a class message, instance foo, recip * 1801 * message, narrowto the class, inst.1802 * If the curmsg is a class message and type==0 then narrow1803 * to the class1804 * If the curmsg is a class message and type==1 then narrow1805 * to the class, instance1794 * message, return a filter name to the class, inst. 1795 * If the curmsg is a class message and type==0 then 1796 * return a filter name for just the class. 1797 * If the curmsg is a class message and type==1 then 1798 * return a filter name for the class and instance. 1806 1799 */ 1807 1800 owl_view *v; 1808 1801 owl_message *m; 1809 char *sender ;1802 char *sender, *filtname=NULL; 1810 1803 1811 1804 v=owl_global_get_current_view(&g); … … 1814 1807 if (owl_view_get_size(v)==0) { 1815 1808 owl_function_makemsg("No message selected\n"); 1816 return ;1809 return NULL; 1817 1810 } 1818 1811 … … 1820 1813 if (owl_message_is_admin(m)) { 1821 1814 owl_function_makemsg("Narrowing on an admin message has not been implemented yet. Check back soon."); 1822 return ;1815 return NULL; 1823 1816 } 1824 1817 … … 1827 1820 if (owl_message_is_zephyr(m)) { 1828 1821 sender=pretty_sender(owl_message_get_sender(m)); 1829 owl_function_fastuserfilt(sender); 1830 free(sender); 1831 } 1832 return; 1822 filtname = owl_function_fastuserfilt(sender); 1823 owl_free(sender); 1824 return filtname; 1825 } 1826 return NULL; 1833 1827 } 1834 1828 … … 1836 1830 if (!strcasecmp(owl_message_get_class(m), "message") && 1837 1831 !owl_message_is_personal(m)) { 1838 owl_function_fastclassinstfilt(owl_message_get_class(m), owl_message_get_instance(m));1839 return ;1832 filtname = owl_function_fastclassinstfilt(owl_message_get_class(m), owl_message_get_instance(m)); 1833 return filtname; 1840 1834 } 1841 1835 1842 1836 /* otherwise narrow to the class */ 1843 1837 if (type==0) { 1844 owl_function_fastclassinstfilt(owl_message_get_class(m), NULL);1838 filtname = owl_function_fastclassinstfilt(owl_message_get_class(m), NULL); 1845 1839 } else if (type==1) { 1846 owl_function_fastclassinstfilt(owl_message_get_class(m), owl_message_get_instance(m)); 1847 } 1840 filtname = owl_function_fastclassinstfilt(owl_message_get_class(m), owl_message_get_instance(m)); 1841 } 1842 return filtname; 1848 1843 } 1849 1844 -
keys.c
r1aee7d9 r7360fab 200 200 BIND_CMD("DOWN", "recv:next", ""); 201 201 BIND_CMD("C-n", "recv:next", ""); 202 BIND_CMD("M-C-n", "recv:next --smart-filter", "move to next message matching the current one"); 202 203 BIND_CMD("UP", "recv:prev", ""); 203 204 BIND_CMD("n", "recv:next-notdel", ""); 204 205 BIND_CMD("p", "recv:prev-notdel", ""); 205 206 BIND_CMD("C-p", "recv:prev", ""); 207 BIND_CMD("M-C-p", "recv:prev --smart-filter", "move to previous message matching the current one"); 206 208 BIND_CMD("P", "recv:next-personal", ""); 207 209 BIND_CMD("M-P", "recv:prev-personal", "");
Note: See TracChangeset
for help on using the changeset viewer.