Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 26154 Details for
Bug 42580
pgp-patch for abook
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to add pgp - entries to abook
0.5.1-02_pgp (text/plain), 4.76 KB, created by
Mathias Gumz
on 2004-02-23 05:54:52 UTC
(
hide
)
Description:
patch to add pgp - entries to abook
Filename:
MIME Type:
Creator:
Mathias Gumz
Created:
2004-02-23 05:54:52 UTC
Size:
4.76 KB
patch
obsolete
>Nur in abook-0.5.1: abook.spec. >diff -abBpur abook-0.5.1/database.c abook-0.5.1.pgp/database.c >--- abook-0.5.1/database.c 2003-09-29 15:08:27.000000000 +0200 >+++ abook-0.5.1.pgp/database.c 2004-02-11 11:14:34.961100592 +0100 >@@ -14,6 +14,7 @@ > #include <fcntl.h> > #include "abook.h" > #include <assert.h> >+#include <ctype.h> > #include "database.h" > #include "list.h" > #include "misc.h" >@@ -57,6 +58,9 @@ extern char *rcfile; > > struct abook_field abook_fields[ITEM_FIELDS] = { > {"Name", "name", TAB_CONTACT},/* NAME */ >+ {"PGP", "pgp", TAB_CONTACT}, /* PGP */ >+ {"Key ID", "pgpkey", TAB_CONTACT}, /* PGPKEY */ >+ {"PGP/Mime", "pgpmime", TAB_CONTACT}, /* PGPSTYLE */ > {"E-mails", "email", TAB_CONTACT},/* EMAIL */ > {"Address", "address", TAB_ADDRESS},/* ADDRESS */ > {"Address2", "address2", TAB_ADDRESS},/* ADDRESS2 */ >@@ -122,6 +126,20 @@ next: > return 0; > } > >+void >+normalize_pgp_data() >+{ >+ struct db_enumerator e = init_db_enumerator(ENUM_ALL); >+ db_enumerate_items(e) >+ { >+ if( ! database[e.item][PGP] ) >+ database[e.item][PGP] = strdup( "None" ); >+ // Set PGP/Mime as default if not given >+ if( tolower( *database[e.item][PGP] ) != 'n' && ! database[e.item][PGPMIME] ){ >+ database[e.item][PGPMIME] = strdup( "Yes" ); >+ } >+ } >+} > > > int >@@ -136,6 +154,7 @@ load_database(char *filename) > return -1; > > parse_database(in); >+ normalize_pgp_data(); > > return (items == 0) ? 2 : 0; > } >diff -abBpur abook-0.5.1/database.h abook-0.5.1.pgp/database.h >--- abook-0.5.1/database.h 2003-09-18 16:08:22.000000000 +0200 >+++ abook-0.5.1.pgp/database.h 2004-02-11 11:15:08.018075168 +0100 >@@ -9,6 +9,9 @@ > > enum { > NAME, >+ PGP, >+ PGPKEY, >+ PGPMIME, > EMAIL, > ADDRESS, > ADDRESS2, >diff -abBpur abook-0.5.1/edit.c abook-0.5.1.pgp/edit.c >--- abook-0.5.1/edit.c 2003-11-17 12:32:41.000000000 +0100 >+++ abook-0.5.1.pgp/edit.c 2004-02-11 11:18:46.114919408 +0100 >@@ -9,6 +9,7 @@ > > #include <string.h> > #include <stdlib.h> >+#include <ctype.h> > #include "abook_curses.h" > #include "ui.h" > #include "abook.h" >@@ -170,7 +171,7 @@ editor_print_data(int tab, int item) > for(k = 0; k < MAX_EMAILS; k++) { > getyx(editw, y, x); > mvwprintw(editw, y+1, FIELDS_START_X, >- "%c -", '2' + k); >+ "%c -", '5' + k); > mvwprintw(editw, y +1, TAB_COLON_POS, > ": %s", emails[k]); > } >@@ -254,6 +255,51 @@ change_name_field(char **field) > } > > static void >+change_pgp_field(char **field) >+{ >+ const char *pgp = NULL; >+ >+ statusline_addstr( "PGP: (e)ncrypt, (s)ign, (b)oth, or (f)orget it?" ); >+ while( ! pgp ) >+ switch( getch() ) { >+ case 'e': >+ pgp = "Encrypt"; >+ break; >+ case 's': >+ pgp = "Sign"; >+ break; >+ case 'b': >+ pgp = "Encrypt and sign"; >+ break; >+ case 'f': >+ pgp = "None"; >+ break; >+ } >+ >+ clear_statusline(); >+ refresh_statusline(); >+ >+ if( *field ) >+ my_free( *field ); >+ *field = strdup( pgp ); >+} >+ >+static void >+change_pgpmime_field(char **field) >+{ >+ // Cycles between "Yes" and "No" >+ >+ if( ! *field || tolower( **field ) == 'n' ) { >+ if( *field ) my_free( *field ); >+ *field = strdup( "Yes" ); >+ } >+ else{ >+ my_free( *field ); >+ *field = strdup( "No" ); >+ } >+} >+ >+static void > fix_email_str(char *str) > { > for(; *str; str++ ) >@@ -267,7 +313,7 @@ edit_emails(char c, int item) > char emails[MAX_EMAILS][MAX_EMAIL_LEN]; > char tmp[MAX_EMAILSTR_LEN] = ""; > int i, len; >- int email_num = c - '2'; >+ int email_num = c - '5'; > > split_emailstr(item, emails); > field = strdup(emails[email_num]); >@@ -313,10 +359,18 @@ edit_field(int tab, char c, int item) > switch(c) { > case '1': change_name_field(&database[item][NAME]); > break; >- case '2': >- case '3': >- case '4': >- case '5': edit_emails(c, item); break; >+ case '2': change_pgp_field(&database[item][PGP]); >+ break; >+ case '3': str = mkstr("%s: ", abook_fields[PGPKEY].name); >+ change_field(str, &database[item][PGPKEY]); >+ free(str); >+ break; >+ case '4': change_pgpmime_field(&database[item][PGPMIME]); >+ break; >+ case '5': >+ case '6': >+ case '7': >+ case '8': edit_emails(c, item); break; > default: return 0; > } > return 1; >diff -abBpur abook-0.5.1/list.c abook-0.5.1.pgp/list.c >--- abook-0.5.1/list.c 2003-11-06 18:14:07.000000000 +0100 >+++ abook-0.5.1.pgp/list.c 2004-02-11 11:20:38.432844488 +0100 >@@ -9,6 +9,7 @@ > > #include <stdio.h> > #include <string.h> >+#include <ctype.h> > #include "abook.h" > #include <assert.h> > #include "ui.h" >@@ -118,7 +119,7 @@ print_list_line(int i, int line, int hig > { > int extra = extra_column; > char tmp[MAX_EMAILSTR_LEN]; >- int real_emaillen = (extra_column > 0 || extra_alternative > 0) ? >+ int real_emaillen = ((extra_column > 0 && extra_column < ITEM_FIELDS) || extra_alternative > 0 ) ? > EMAILLEN : COLS - EMAILPOS; > > scrollok(list, FALSE);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 42580
: 26154