Revision: 7206
          http://svn.sourceforge.net/mahogany/?rev=7206&view=rev
Author:   vadz
Date:     2007-01-08 14:01:30 -0800 (Mon, 08 Jan 2007)

Log Message:
-----------
added support for subject parameter of mailto URLs

Modified Paths:
--------------
    trunk/M/CHANGES
    trunk/M/src/adb/AdbManager.cpp

Modified: trunk/M/CHANGES
===================================================================
--- trunk/M/CHANGES     2007-01-08 22:00:36 UTC (rev 7205)
+++ trunk/M/CHANGES     2007-01-08 22:01:30 UTC (rev 7206)
@@ -9,6 +9,7 @@
 Release 0.68 '' September xx, 2006
 ---------------------------------------
 
+2007-01-08 VZ: Added support for "subject" parameter of mailto: URLs
 2006-12-25 VZ: Added "Remove attachments" command
 2006-09-05 NB: Mahogany can now be compiled with wxWine
 

Modified: trunk/M/src/adb/AdbManager.cpp
===================================================================
--- trunk/M/src/adb/AdbManager.cpp      2007-01-08 22:00:36 UTC (rev 7205)
+++ trunk/M/src/adb/AdbManager.cpp      2007-01-08 22:01:30 UTC (rev 7206)
@@ -359,9 +359,6 @@
 
    // remove "mailto:"; prefix if it's there - this is convenient when you paste
    // in an URL from the web browser
-   //
-   // TODO: add support for the mailto URL parameters, i.e. should support
-   //       things like "mailto:[EMAIL PROTECTED]"
    String newText;
    if ( !textOrig.StartsWith(_T("mailto:";), &newText) )
    {
@@ -407,8 +404,49 @@
          }
       }
    }
-   //else: address following mailto: doesn't need to be expanded
+   else // address following mailto: doesn't need to be expanded
+   {
+      // this is a non-standard but custom extension: mailto URLs can have
+      // extra parameters introduced by '?' and separated by '&'
+      const size_t posQuestion  = newText.find('?');
+      for ( size_t posParamStart = posQuestion; posParamStart != String::npos; 
)
+      {
+         posParamStart++;
+         size_t posEq = newText.find('=', posParamStart);
+         if ( posEq != String::npos )
+         {
+            size_t posParamEnd = newText.find('&', posEq);
 
+            const String param(newText, posParamStart, posEq - posParamStart),
+                         value(newText, posEq + 1,
+                               posParamEnd == String::npos
+                                 ? posParamEnd
+                                 : posParamEnd - posEq - 1);
+;
+            if ( stricmp(param, "subject") == 0 )
+            {
+               *subject = value;
+            }
+            else
+            {
+               // at least cc, bcc and body are also possible
+               wxLogDebug("Ignoring unknown mailto: URL parameter %s=\"%s\"",
+                          param.c_str(), value.c_str());
+            }
+
+            posParamStart = posParamEnd;
+         }
+         else // unknown parameter
+         {
+            wxLogDebug("Ignoring unknown mailto: URL parameter without value");
+
+            posParamStart = newText.find('&', posParamStart);
+         }
+      }
+
+      newText.erase(posQuestion, String::npos);
+   }
+
    *address = newText;
 
    return true;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to