From 5af560a0ef23b5a1d134f65e135e5c7f4bc1a84c Mon Sep 17 00:00:00 2001 From: nils Date: Tue, 11 Oct 2011 20:34:55 +0000 Subject: moved textissigned to context git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@545 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- context.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'context.cpp') diff --git a/context.cpp b/context.cpp index 87b6c3f..d7a17a1 100644 --- a/context.cpp +++ b/context.cpp @@ -633,6 +633,22 @@ void Context::preventNoDataErr(QByteArray *in) } } +/* + * isSigned returns: + * - 0, if text isn't signed at all + * - 1, if text is partially signed + * - 2, if text is completly signed + */ +int Context::textIsSigned(const QByteArray &text) { + if (text.trimmed().startsWith("-----BEGIN PGP SIGNED MESSAGE-----") && text.trimmed().endsWith("-----END PGP SIGNATURE-----")) { + return 2; + } + if (text.contains("-----BEGIN PGP SIGNED MESSAGE-----") && text.contains("-----END PGP SIGNATURE-----")) { + return 1; + } + return 0; +} + } -- cgit