updated on Tue Jan 10 04:01:21 UTC 2012
[aur-mirror.git] / pwsafe-twice / pwsafe-twice.patch
bloba91cc5b363fe13aca0ca4acfcbb4dd2c9eee8f97
1 --- pwsafe1.cpp 2011-05-18 22:06:52.424328914 +0900
2 +++ pwsafe.cpp 2011-05-18 22:33:52.480699995 +0900
3 @@ -398,6 +398,7 @@
4 bool arg_username = false;
5 bool arg_password = false;
6 bool arg_details = false;
7 +bool twice = false;
8 int arg_verbose = 0;
9 int arg_debug = 0;
10 #ifndef X_DISPLAY_MISSING
11 @@ -440,6 +441,7 @@
12 {"display", required_argument, 0,'d'},
13 {"selection", required_argument, 0,'s'},
14 {"ignore", required_argument, 0,'G'},
15 + {"twice", no_argument, 0, '2'},
16 #endif
17 // standard stuff
18 {"quiet", no_argument, 0, 'q'},
19 @@ -1159,6 +1161,7 @@
20 int c;
22 while ((c = getopt_long (argc, argv,
23 + "2" // post username/password to the clipboard twice
24 "l" // long listing
25 "a" // add
26 "e" // edit
27 @@ -1308,6 +1311,9 @@
28 case 'h':
29 usage(false);
30 throw ExitEx(0);
31 + case '2':
32 + twice = true;
33 + break;
34 case ':':
35 case '?':
36 // the message getopt() printed out is good enough
37 @@ -1343,6 +1349,7 @@
38 " -d, --display=XDISPLAY override $DISPLAY (implies -x)\n"
39 " -s, --selection={Primary,Secondary,Clipboard,Both} select the X selection effected (implies -x)\n"
40 " -G, --ignore=NAME@HOST add NAME@HOST to set of windows that don't receive the selection. Either NAME or @HOST can be omitted. (default is xclipboard, wmcliphist and klipper)\n"
41 + " -2, --twice copy each value to the X selection twice\n"
42 #endif
43 " -q, --quiet print no extra information\n"
44 " -v, --verbose print more information (can be repeated)\n"
45 @@ -2654,10 +2661,13 @@
46 // if we're not emit()ing to stdout, then print notes before sending login/password to X clipboard.
47 // this way if the notes contain a URL, the user can cut/paste that too
48 emit_notes(e.notes);
49 + const int times = (!arg_echo && twice) ? 2 : 1;
51 if (username)
52 + for(int i = 0; i < times; ++i)
53 ::emit(e.groupname(), "username", e.default_login?e.the_default_login:e.login);
54 if (password)
55 + for(int i = 0; i < times; ++i)
56 ::emit(e.groupname(), "password", e.password);
58 if (arg_echo && arg_details)