[Kolab-devel] Patch: Kontact Free/Busy MS-Outlook URL support

Stephan Buys list at codefusion.co.za
Tue Apr 27 10:36:07 CEST 2004


Hi all,

Below is a small patch that allows the user to specify an MS Outlook style Free/Busy URL
for the purpose of downloading freebusy information.

This allows URLs in the format:
http://host.tld.com/freebusy/%NAME%@%SERVER%.vfb

Adds %NAME% (for user portion of e-mail address)
Adds %SERVER% (for the domain portion of e-mail address)

Why is this important? 
1) You might want to have multiple domains supported on your server, this makes the 
%SERVER% macro necesarry.
2) You might want to specify another extension for your users to use on their iCal files,
thus the user has more control over the URL.

I have also disabled the check that disables Free/Busy downloads if the configured
mail host does not match the domain portion of the e-mail address. There are several
reasons for this:

1) The user might specify a ip-address for the server address.
2) It might be a big company that shares one e-mail domain accross multiple hosts.
3) There might be CNAME DNS entries for the mail host which does not match the email 
domain. 

Instead the retrieval fails gracefully, or so it seems...

Kind regards,
-- 
Stephan  Buys
Code Fusion cc.
Tel: +27 11 391 1412
Mobile: +27 83 294 1876
Email: s.buys at codefusion.co.za

E-mail Solutions, Kolab Specialists.
http://www.codefusion.co.za




--- freebusymanager.cpp 26 Apr 2004 00:06:13 -0000      1.15
+++ freebusymanager.cpp 27 Apr 2004 08:16:54 -0000
@@ -383,14 +383,28 @@ KURL FreeBusyManager::freeBusyUrl( const

   sourceURL = KOPrefs::instance()->mFreeBusyRetrieveUrl;

-  if ( sourceURL.host() != emailHost ) {
+  // FIXME: This assumption is just plain wrong, should rather just fail gracefully
+  /*if ( sourceURL.host() != emailHost ) {
     kdDebug() << "FreeBusyManager::freeBusyUrl(): " << sourceURL.host()
               << " doesn't match " << emailHost << ". Cancel retrieval."
               << endl;
     return KURL();
+  }*/
+
+  //Add some intelligence to the fb URL (MS Outlook style)
+  QString fbAddress = sourceURL.fileName();
+  if (fbAddress.find("%NAME%") != -1) {
+    fbAddress.replace("%NAME%",emailName);
+    fbAddress.replace("%SERVER%",emailHost);
+    //Just set it to what the user wants, make no assumptions on his/her behalf
+    kdDebug() << "FreeBusyManager::freeBusyUrl(): " << sourceURL.fileName()
+              << " set to " << fbAddress << "."
+              << endl;
+    sourceURL.setFileName( fbAddress );
+  } else {
+    //This is limiting especially on server hosting multiple domains
+    sourceURL.setFileName( emailName + ".vfb" );
   }
-
-  sourceURL.setFileName( emailName + ".vfb" );
   sourceURL.setUser( KOPrefs::instance()->mFreeBusyRetrieveUser );
   sourceURL.setPass( KOPrefs::instance()->mFreeBusyRetrievePassword );




More information about the devel mailing list