[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

net/imap retrieve list of folders

Robby Russell

4/26/2005 6:44:00 AM

I am playing with Net::IMAP and trying to figure out how to retrieve the
list of subscribed folders. In all the examples that I have come across,
none of them show this. I can find messages in a specific folder, but
for my app I will need to build a list of folders that the user is
subscribed to.

How/can this be done?

Thanks,

-Robby

--
/******************************************************
* Robby Russell, Owner.Developer.Geek
* PLANET ARGON, Open Source Solutions & Web Hosting
* Portland, Oregon | p: 503.351.4730 | f: 815.642.4068
* www.planetargon.com | www.robbyonrails.com
*******************************************************/



1 Answer

Paul Brannan

4/26/2005 3:33:00 PM

0

On Tue, Apr 26, 2005 at 03:44:02PM +0900, Robby Russell wrote:
> I am playing with Net::IMAP and trying to figure out how to retrieve the
> list of subscribed folders. In all the examples that I have come across,
> none of them show this. I can find messages in a specific folder, but
> for my app I will need to build a list of folders that the user is
> subscribed to.
>
> How/can this be done?

Use Net::IMAP#lsub:

irb(main):016:0> imap.subscribe('mail/ruby')
=> #<struct Net::IMAP::TaggedResponse tag="RUBY0011", name="OK", data=#<struct Net::IMAP::ResponseText code=nil, text="SUBSCRIBE completed">, raw_data="RUBY0011 OK SUBSCRIBE completed\r\n">
irb(main):017:0> imap.subscribe('mail/ruby-core')
=> #<struct Net::IMAP::TaggedResponse tag="RUBY0012", name="OK", data=#<struct Net::IMAP::ResponseText code=nil, text="SUBSCRIBE completed">, raw_data="RUBY0012 OK SUBSCRIBE completed\r\n">
irb(main):018:0> imap.subscribe('mail/rubygems')
=> #<struct Net::IMAP::TaggedResponse tag="RUBY0013", name="OK", data=#<struct Net::IMAP::ResponseText code=nil, text="SUBSCRIBE completed">, raw_data="RUBY0013 OK SUBSCRIBE completed\r\n">
irb(main):019:0> imap.lsub('mail', '*')
=> [#<struct Net::IMAP::MailboxList attr=[], delim="/", name="mail/ruby">, #<struct Net::IMAP::MailboxList attr=[], delim="/", name="mail/ruby-core">, #<struct Net::IMAP::MailboxList attr=[], delim="/", name="mail/rubygems">]

You can find the documentation for #list and #lsub in imap.rb.

Paul