On Mon, 03 Jan 2011 18:19:59 +0100, Holger Mauermann wrote:
 
> Above regex simply strips out k, x, t and e and puts only 'RIGHTS=' 
> in
> $capability so it's possible to test for RFC 4314 support with
> getCapability('RIGHTS=').

 Right. However, I was hinking about something more useful:

 Index: rcube_imap_generic.php
 ===================================================================
 --- rcube_imap_generic.php  (wersja 4384)
 +++ rcube_imap_generic.php  (kopia robocza)
 @@ -371,11 +371,44 @@
          return false;
      }

 -    function getCapability($name)
 +    private function hasCapability($name)
      {
 +        if (empty($this->capability) || $name == '') {
 +            return false;
 +        }
 +
          if (in_array($name, $this->capability)) {
              return true;
          }
 +        else if (strpos($name, '=')) {
 +            return false;
 +        }
 +
 +        $result = array();
 +        foreach ($this->capability as $cap) {
 +            $entry = explode('=', $cap);
 +            if ($entry[0] == $name) {
 +                $result[] = $entry[1];
 +            }
 +        }
 +
 +        return !empty($result) ? $result : false;
 +    }
 +
 +    /**
 +     * Capabilities checker
 +     *
 +     * @param string $name Capability name
 +     *
 +     * @return mixed Capability values array for key=value pairs, 
 true/false for others
 +     */
 +    function getCapability($name)
 +    {
 +        $result = $this->hasCapability($name);
 +
 +        if (!empty($result)) {
 +            return $result;
 +        }
          else if ($this->capability_readed) {
              return false;
          }
 @@ -390,11 +423,7 @@

          $this->capability_readed = true;

 -        if (in_array($name, $this->capability)) {
 -            return true;
 -        }
 -
 -        return false;
 +        return $this->hasCapability($name);
      }

      function clearCapability()


-- 
 Aleksander 'A.L.E.C' Machniak
 LAN Management System Developer [http://lms.org.pl]
 Roundcube Webmail Developer  [http://roundcube.net]
 ---------------------------------------------------
 PGP: 19359DC1 @@ GG: 2275252 @@ WWW: http://alec.pl
_______________________________________________
List info: http://lists.roundcube.net/dev/
BT/8f4f07cd

Reply via email to