Re: [Evolution-hackers] First attempt at support for NAMESPACE



* My current protocol related code does this for LIST, LSUB and
  NAMESPACE:

if capabilities contains NAMESPACE {

  personal, other, shared = get namespaces

/* We do both LIST and LSUB of the personal namespace
 * or we use LIST-EXTENDED and therefore don't need to
 * do the LSUB */

  if (personal->prefix.length > 0) {

    if capabilities contains LIST-EXTENDED
      LIST (SUBSCRIBED)  "personal->prefix" *   
    else {
      LIST "personal->prefix" *   
      LSUB "personal->prefix" *   
    }

  } else {

    /* If the namespace is "", this would otherwise result
     * in a LIST "" *, which would not be a good idea if 
     * the IMAP server has a huge list in shared and other */

    if capabilities contains LIST-EXTENDED
      LIST (SUBSCRIBED) "personal->prefix" %   
    else {
      LIST "personal->prefix" %   
      LSUB "personal->prefix" %   
    }
  }

/* We dont' get LIST of non-personal namespaces as that 
 * could lead to IMAP servers returning huge folder lists,
 * for example when the IMAP server proxies a news server */

  if (other->prefix.length > 0)
    LSUB "other->prefix" *   
  else
    LSUB "other->prefix" %   

  if (shared->prefix.length > 0)
    LSUB "shared->prefix" *   
  else
    LSUB "shared->prefix" %   

} else {

  /* We don't have namespaces, so we're pretty limited in what we
   * can ask for. */

  if capabilities contains LIST-EXTENDED
    LIST (SUBSCRIBED) "" * or %
  else {
    LIST "" * or %
    LSUB "" * or %
 }

}

* I changed the folder management related code to cope with folders
  under namespaces

* I changed the CamelImapStoreSummary format and code to cope with
  namespaces

* I have this patch for camel-lite, if the Evolution team is interested
  in changing quite a lot of their LIST LSUB and NAMESPACE related code,
  this can be ported to Evolution too.


-- 
Philip Van Hoof, freelance software developer
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
http://pvanhoof.be/blog
http://codeminded.be






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]