Index: trunk/src/helpers/apps.c
===================================================================
--- trunk/src/helpers/apps.c	(revision 355)
+++ trunk/src/helpers/apps.c	(revision 361)
@@ -15,5 +15,5 @@
 
 /*
- *      Copyright (C) 1997-2005 Ulrich Mller.
+ *      Copyright (C) 1997-2008 Ulrich Mller.
  *      This file is part of the "XWorkplace helpers" source package.
  *      This is free software; you can redistribute it and/or modify
@@ -2002,5 +2002,13 @@
  *@@added V0.9.20 (2002-08-10) [umoeller]
  *@@changed V1.0.0 (2002-08-21) [umoeller]: changed prototype to return browser
- */
+ *@@changed WarpIN V1.0.17 (2008-03-08) [pr]: rewritten to add IAIUTIL settings
+*/
+
+typedef struct _URLPROTOAPP {
+    PCSZ    pcszProtocol;
+    PCSZ    pcszKeyExe;
+    PCSZ    pcszKeyParam;
+    PCSZ    pcszKeyDir;
+} URLPROTOAPP;
 
 APIRET appOpenURL(PCSZ pcszURL,           // in: URL to open
@@ -2009,7 +2017,14 @@
 {
     APIRET      arc = ERROR_NO_DATA;
-
-    CHAR        szStartupDir[CCHMAXPATH];
     XSTRING     strParameters;
+    PCSZ        pcszApp = "WPURLDEFAULTSETTINGS", pcszKeyExe, pcszKeyParam, pcszKeyDir;
+    ULONG       i;
+    URLPROTOAPP urlProtoApps[] = {
+        { "", "DefaultBrowserExe", "DefaultParameters", "DefaultWorkingDir" },
+        { "mailto:", "DefaultMailExe", "DefaultMailParameters", "DefaultMailWorkingDir" },
+        { "news:", "DefaultNewsExe", "DefaultNewsParameters", "DefaultNewsWorkingDir" },
+        { "ftp:", "DefaultFTPExe", "DefaultFTPParameters", "DefaultFTPWorkingDir" },
+        { "irc:", "DefaultIRCExe", "DefaultIRCParameters", "DefaultIRCWorkingDir" }
+    };
 
     if (    (!pcszURL)
@@ -2020,44 +2035,50 @@
 
     xstrInit(&strParameters, 0);
-
-    if (PrfQueryProfileString(HINI_USER,
-                              "WPURLDEFAULTSETTINGS",
-                              "DefaultBrowserExe",
-                              "NETSCAPE.EXE",
-                              pszAppStarted,
-                              cbAppStarted))
-    {
-        PSZ     pszDefParams;
-        HAPP    happ;
-
-        if (pszDefParams = prfhQueryProfileData(HINI_USER,
-                                                "WPURLDEFAULTSETTINGS",
-                                                "DefaultParameters",
-                                                NULL))
-        {
-            xstrcpy(&strParameters, pszDefParams, 0);
-            xstrcatc(&strParameters, ' ');
-            free(pszDefParams);
-        }
-
-        xstrcat(&strParameters, pcszURL, 0);
-
-        PrfQueryProfileString(HINI_USER,
-                              "WPURLDEFAULTSETTINGS",
-                              "DefaultWorkingDir",
-                              "",
-                              szStartupDir,
-                              sizeof(szStartupDir));
-
-        arc = appQuickStartApp(pszAppStarted,
-                               PROG_DEFAULT,
-                               strParameters.psz,
-                               szStartupDir,
-                               &happ,
-                               NULL);     // don't wait
+    for (i = sizeof(urlProtoApps) / sizeof(urlProtoApps[0]); i; i--)
+    {
+        if (!strnicmp(pcszURL,
+                      urlProtoApps[i - 1].pcszProtocol,
+                      strlen(urlProtoApps[i - 1].pcszProtocol)))
+        {
+            if (PrfQueryProfileString(HINI_USER,
+                                      (PSZ) pcszApp,
+                                      (PSZ) urlProtoApps[i - 1].pcszKeyExe,
+                                      NULL,
+                                      pszAppStarted,
+                                      cbAppStarted))
+            {
+                PSZ     pszDefParams;
+                CHAR    szStartupDir[CCHMAXPATH];
+                HAPP    happ;
+
+                if (pszDefParams = prfhQueryProfileData(HINI_USER,
+                                                        pcszApp,
+                                                        urlProtoApps[i - 1].pcszKeyParam,
+                                                        NULL))
+                {
+                    xstrcpy(&strParameters, pszDefParams, 0);
+                    xstrcatc(&strParameters, ' ');
+                    free(pszDefParams);
+                }
+
+                xstrcat(&strParameters, pcszURL, 0);
+                PrfQueryProfileString(HINI_USER,
+                                      (PSZ) pcszApp,
+                                      (PSZ) urlProtoApps[i - 1].pcszKeyDir,
+                                      "",
+                                      szStartupDir,
+                                      sizeof(szStartupDir));
+                arc = appQuickStartApp(pszAppStarted,
+                                       PROG_DEFAULT,
+                                       strParameters.psz,
+                                       szStartupDir,
+                                       &happ,
+                                       NULL);     // don't wait
+                break;
+            }
+        }
     }
 
     xstrClear(&strParameters);
-
     return arc;
 }
