public function check_permflag($flag)
    {
        $flag       = strtoupper($flag);
        $perm_flags = $this->get_permflags($this->folder);
        $imap_flag  = $this->conn->flags[$flag];

        return $imap_flag && !empty($perm_flags) && in_array_nocase($imap_flag, $perm_flags);
    }