aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--g10/ChangeLog6
-rw-r--r--g10/plaintext.c18
-rw-r--r--g10/status.c6
-rw-r--r--g10/status.h8
4 files changed, 32 insertions, 6 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index a9786a26c..64d45d6ea 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,9 @@
+2004-06-18 David Shaw <[email protected]>
+
+ * status.h, status.c (get_status_string), plaintext.c
+ (handle_plaintext): New status tags PLAINTEXT and
+ PLAINTEXT_LENGTH.
+
2004-06-16 David Shaw <[email protected]>
* keygen.c (make_backsig): Make sure that the backsig was built
diff --git a/g10/plaintext.c b/g10/plaintext.c
index 3f946c1d3..6a0adfc93 100644
--- a/g10/plaintext.c
+++ b/g10/plaintext.c
@@ -58,6 +58,24 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
int c;
int convert = (pt->mode == 't' || pt->mode == 'u');
+ /* Let people know what the plaintext info is. This allows the
+ receiving program to try and do something different based on
+ the format code (say, recode UTF-8 to local). */
+ if(!nooutput && is_status_enabled())
+ {
+ char status[20];
+
+ sprintf(status,"%X %lu ",(byte)pt->mode,(ulong)pt->timestamp);
+ write_status_text_and_buffer(STATUS_PLAINTEXT,
+ status,pt->name,pt->namelen,0);
+
+ if(!pt->is_partial)
+ {
+ sprintf(status,"%lu",(ulong)pt->len);
+ write_status_text(STATUS_PLAINTEXT_LENGTH,status);
+ }
+ }
+
/* create the filename as C string */
if( nooutput )
;
diff --git a/g10/status.c b/g10/status.c
index f260ab038..9b0cbe82c 100644
--- a/g10/status.c
+++ b/g10/status.c
@@ -1,6 +1,6 @@
/* status.c
- * Copyright (C) 1998, 1999, 2000, 2001, 2002,
- * 2004 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
+ * 2004 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -151,6 +151,8 @@ get_status_string ( int no )
case STATUS_EXPKEYSIG : s = "EXPKEYSIG"; break;
case STATUS_REVKEYSIG : s = "REVKEYSIG"; break;
case STATUS_ATTRIBUTE : s = "ATTRIBUTE"; break;
+ case STATUS_PLAINTEXT : s = "PLAINTEXT"; break;
+ case STATUS_PLAINTEXT_LENGTH:s = "PLAINTEXT_LENGTH"; break;
default: s = "?"; break;
}
return s;
diff --git a/g10/status.h b/g10/status.h
index 68da60d28..d33ff5ae6 100644
--- a/g10/status.h
+++ b/g10/status.h
@@ -1,5 +1,6 @@
/* status.h
- * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
+ * 2004 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -20,7 +21,6 @@
#ifndef G10_STATUS_H
#define G10_STATUS_H
-
#define STATUS_ENTER 1
#define STATUS_LEAVE 2
#define STATUS_ABORT 3
@@ -29,7 +29,6 @@
#define STATUS_BADSIG 5
#define STATUS_ERRSIG 6
-
#define STATUS_BADARMOR 7
#define STATUS_RSA_OR_IDEA 8
@@ -100,6 +99,8 @@
#define STATUS_IMPORT_OK 68
#define STATUS_IMPORT_CHECK 69
#define STATUS_REVKEYSIG 70
+#define STATUS_PLAINTEXT 71
+#define STATUS_PLAINTEXT_LENGTH 72
/*-- status.c --*/
void set_status_fd ( int fd );
@@ -124,5 +125,4 @@ void cpr_kill_prompt(void);
int cpr_get_answer_is_yes( const char *keyword, const char *prompt );
int cpr_get_answer_yes_no_quit( const char *keyword, const char *prompt );
-
#endif /*G10_STATUS_H*/