Changeset 8a5b5a1
- Timestamp:
- Apr 2, 2010, 10:40:39 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- e2cbbbe
- Parents:
- 66e409c
- git-author:
- Nelson Elhage <nelhage@mit.edu> (04/02/10 21:02:30)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (04/02/10 22:40:39)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
commands.c
r66e409c r8a5b5a1 1 #include <getopt.h> 1 2 #include <stdio.h> 2 3 #include <stdlib.h> … … 592 593 OWLCMD_ARGS("smartnarrow", owl_command_smartnarrow, OWL_CTX_INTERACTIVE, 593 594 "view only messages similar to the current message", 594 "smartnarrow [-i | --instance] ",595 "smartnarrow [-i | --instance] [-r | --relatde]", 595 596 "If the curmsg is a personal message narrow\n" 596 597 " to the conversation with that user.\n" … … 600 601 " to the class.\n" 601 602 "If the curmsg is a class message and '-i' is specified\n" 602 " then narrow to the class and instance.\n"), 603 " then narrow to the class and instance.\n" 604 "If '-r' or '--related' is specified, behave as though the\n" 605 " 'narrow-related' variable was inverted."), 603 606 604 607 OWLCMD_ARGS("smartfilter", owl_command_smartfilter, OWL_CTX_INTERACTIVE, … … 1238 1241 argc-=2; argv+=2; 1239 1242 } else if (argc>=2 && !strcmp(argv[1], "--smart-filter")) { 1240 filter = owl_function_smartfilter(0 );1243 filter = owl_function_smartfilter(0, 0); 1241 1244 argc-=2; argv+=2; 1242 1245 } else if (argc>=2 && !strcmp(argv[1], "--smart-filter-instance")) { 1243 filter = owl_function_smartfilter(1 );1246 filter = owl_function_smartfilter(1, 0); 1244 1247 argc-=2; argv+=2; 1245 1248 } else { … … 1268 1271 argc-=2; argv+=2; 1269 1272 } else if (argc>=2 && !strcmp(argv[1], "--smart-filter")) { 1270 filter = owl_function_smartfilter(0 );1273 filter = owl_function_smartfilter(0, 0); 1271 1274 argc-=2; argv+=2; 1272 1275 } else if (argc>=2 && !strcmp(argv[1], "--smart-filter-instance")) { 1273 filter = owl_function_smartfilter(1 );1276 filter = owl_function_smartfilter(1, 0); 1274 1277 argc-=2; argv+=2; 1275 1278 } else { … … 1287 1290 char *filtname = NULL; 1288 1291 1289 if (argc == 1) { 1290 filtname = owl_function_smartfilter(0); 1291 } else if (argc == 2 && (!strcmp(argv[1], "-i") || !strcmp(argv[1], "--instance"))) { 1292 filtname = owl_function_smartfilter(1); 1293 } else { 1294 owl_function_makemsg("Wrong number of arguments for %s", argv[0]); 1295 } 1292 char opt; 1293 int instance = 0, related = 0, i; 1294 char **tmp_argv = owl_malloc(sizeof(char *) * argc); 1295 1296 for (i = 0; i < argc; i++) 1297 tmp_argv[i] = owl_strdup(argv[i]); 1298 1299 static struct option options[] = { 1300 {"instance", 0, 0, 'i'}, 1301 {"related", 0, 0, 'r'}, 1302 {NULL, 0, 0, 0}}; 1303 while ((opt = getopt_long(argc, tmp_argv, "ir", options, NULL)) != -1) { 1304 switch (opt) { 1305 case 'i': 1306 instance = 1; 1307 break; 1308 case 'r': 1309 related = 1; 1310 break; 1311 default: 1312 owl_function_makemsg("Wrong number of arguments for %s (%c)", argv[0], opt); 1313 goto done; 1314 } 1315 } 1316 1317 for (i = 0; i < argc; i++) 1318 owl_free(tmp_argv[i]); 1319 owl_free(tmp_argv); 1320 1321 filtname = owl_function_smartfilter(instance, related); 1322 1296 1323 if (filtname) { 1297 1324 owl_function_change_currentview_filter(filtname); 1298 1325 owl_free(filtname); 1299 1326 } 1327 1328 done: 1329 optind = 0; /* reset getopt */ 1300 1330 return NULL; 1301 1331 } … … 1306 1336 1307 1337 if (argc == 1) { 1308 filtname = owl_function_smartfilter(0 );1338 filtname = owl_function_smartfilter(0, 0); 1309 1339 } else if (argc == 2 && (!strcmp(argv[1], "-i") || !strcmp(argv[1], "--instance"))) { 1310 filtname = owl_function_smartfilter(1 );1340 filtname = owl_function_smartfilter(1, 0); 1311 1341 } else { 1312 1342 owl_function_makemsg("Wrong number of arguments for %s", argv[0]); -
functions.c
r66e409c r8a5b5a1 2511 2511 * name to the AIM conversation with that user 2512 2512 */ 2513 char *owl_function_smartfilter(int type )2513 char *owl_function_smartfilter(int type, int invert_related) 2514 2514 { 2515 2515 const owl_view *v; … … 2517 2517 char *zperson, *filtname=NULL; 2518 2518 const char *argv[2]; 2519 int related = owl_global_is_narrow_related(&g) ;2520 2519 int related = owl_global_is_narrow_related(&g) ^ invert_related; 2520 2521 2521 v=owl_global_get_current_view(&g); 2522 2522 m=owl_view_get_element(v, owl_global_get_curmsg(&g)); -
keys.c
r8830df47 r8a5b5a1 246 246 BIND_CMD("M-n", "smartnarrow", "narrow to a view based on the current message"); 247 247 BIND_CMD("M-N", "smartnarrow -i", "narrow to a view based on the current message, and consider instance pair"); 248 BIND_CMD("M-m", "smartnarrow -r", "like M-n but with 'narrow-related' temporarily flipped."); 249 BIND_CMD("M-M", "smartnarrow -ri", "like M-N but with 'narrow-related' temporarily flipped."); 248 250 BIND_CMD("M-p", "view personal", ""); 249 251
Note: See TracChangeset
for help on using the changeset viewer.