Update of /cvsroot/mahogany/M/src/modules/viewflt
In directory sc8-pr-cvs1:/tmp/cvs-serv12709/src/modules/viewflt

Modified Files:
        PGP.cpp 
Log Message:
allow PGP messages to begin after a brief prologue

Index: PGP.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/viewflt/PGP.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -u -2 -r1.1 -r1.2
--- PGP.cpp     1 Dec 2002 02:41:08 -0000       1.1
+++ PGP.cpp     1 Dec 2002 02:47:35 -0000       1.2
@@ -87,8 +87,24 @@
 {
    // do we have something looking like a PGP message?
-   if ( text.StartsWith(PGP_BEGIN_PREFIX) )
+   //
+   // there should be a BEGIN line near the start of the message
+   bool foundBegin = false;
+   const char *start = text.c_str();
+   for ( size_t numLines = 0; numLines < 10; numLines++ )
    {
-      const char * const start = text.c_str();
+      if ( strncmp(start, PGP_BEGIN_PREFIX, strlen(PGP_BEGIN_PREFIX)) == 0 )
+      {
+         foundBegin = true;
+         break;
+      }
+
+      // try the next line
+      start = strchr(start + 1, '\n');
+      if ( start )
+         start++; // skip '\n' itself
+   }
 
+   if ( foundBegin )
+   {
       // is the message just signed or encrypted?
       const char *tail = start + strlen(PGP_BEGIN_PREFIX);
@@ -178,4 +194,11 @@
       if ( ok )
       {
+         // output the part before the BEGIN line, if any
+         String prolog(text.c_str(), start);
+         if ( !prolog.empty() )
+         {
+            m_next->Process(prolog, viewer, style);
+         }
+
          if ( isSigned )
          {



-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T 
handheld. Power & Color in a compact size! 
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to