Tweak in SM to directly view email in specified folder

View: New views
4 Messages — Rating Filter:   Alert me  

Tweak in SM to directly view email in specified folder

by Jean-Jacques de Jong :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

We have an IMAP mail server where we archive all our emails in a
specific folder hierarchy. There are thousands of folders containing
tens of thousands of emails.

I'd like to direct SM to a specific folder just by typing an URL with
the folder name in it. Something like:
http://server/squirrelmail/?mailbox=.X.Y.Z.foldername.
If the user hasn't logged in yet, he should be directed to the login
screen and then to the folder.

I managed to tweak and earlier version of SM, but I had to change code
in various places. I'm not sure I did it optimally, and my tweaks are
hard to port to later versions...

I wondered if anyone could advise on the best way to proceed, i.e.
change one line of code in just one file.

A plus would be to show on the left pane the folder and its subfolders.
SM apparently will do this for the subscribed folders, but I would need
it for all subfolders. I tried the autosubscribe plugin, but this just
subscribes to the whole hierarchy, which takes ages.

Thanks,
JJJ

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-devel@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel

Re: Tweak in SM to directly view email in specified folder

by Paul Lesniewski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Jan 31, 2009 at 10:30 PM, Jean-Jacques de Jong
<jean-jacques.de-jong@...> wrote:

> Hi,
>
> We have an IMAP mail server where we archive all our emails in a
> specific folder hierarchy. There are thousands of folders containing
> tens of thousands of emails.
>
> I'd like to direct SM to a specific folder just by typing an URL with
> the folder name in it. Something like:
> http://server/squirrelmail/?mailbox=.X.Y.Z.foldername.
> If the user hasn't logged in yet, he should be directed to the login
> screen and then to the folder.

You might start by looking at the Startup Folder plugin.  It requires
a prior user setting for the folder to load up, but you could try to
take the URL that hits the login page and if it contains some special
query argument of your choosing with a folder name in it, your plugin
can do the same thing as Startup Folder, but in a dynamic fashion.

> I managed to tweak and earlier version of SM, but I had to change code
> in various places. I'm not sure I did it optimally, and my tweaks are
> hard to port to later versions...
>
> I wondered if anyone could advise on the best way to proceed, i.e.
> change one line of code in just one file.
>
> A plus would be to show on the left pane the folder and its subfolders.
> SM apparently will do this for the subscribed folders, but I would need
> it for all subfolders. I tried the autosubscribe plugin, but this just
> subscribes to the whole hierarchy, which takes ages.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-devel@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel

Re: Tweak in SM to directly view email in specified folder

by Jean-Jacques de Jong :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/2/1 Paul Lesniewski <paul@...>
>
> On Sat, Jan 31, 2009 at 10:30 PM, Jean-Jacques de Jong
> <jean-jacques.de-jong@...> wrote:

> > I'd like to direct SM to a specific folder just by typing an URL with
> > the folder name in it. Something like:
> > http://server/squirrelmail/?mailbox=.X.Y.Z.foldername.
> > If the user hasn't logged in yet, he should be directed to the login
> > screen and then to the folder.
>
> You might start by looking at the Startup Folder plugin.  It requires
> a prior user setting for the folder to load up, but you could try to
> take the URL that hits the login page and if it contains some special
> query argument of your choosing with a folder name in it, your plugin
> can do the same thing as Startup Folder, but in a dynamic fashion.

This plugin should indeed be able to get me there. I probably just
need to assign a specific variable with my folder name rather than the
name stored in the user's configuration file. I see you are one of the
developers of this plugin. I am alas not familiar with the plugin
architecture and other internals of SM, and only an amateur in PHP
coding. In particular, I am not sure what file the predefined link
should call with the variable that has the folder name in it, i.e.
http://server/squirrelmail/what-file-do- i-put-here.php?startupfolder=myfolder

(In my previous attempts to tweak the code, my issue was that the
variable containing the folder name had to be passed between several
files in an order that was not so obvious.)

Do you have any guidance? We can forget the login issue, assuming I
tell my users that they first need to login before they try to use the
links containing the folder name.

Thanks,
JJJ

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-devel@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel

Re: Tweak in SM to directly view email in specified folder

by Paul Lesniewski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Feb 3, 2009 at 2:13 AM, Jean-Jacques de Jong
<jean-jacques.de-jong@...> wrote:

> 2009/2/1 Paul Lesniewski <paul@...>
>>
>> On Sat, Jan 31, 2009 at 10:30 PM, Jean-Jacques de Jong
>> <jean-jacques.de-jong@...> wrote:
>
>> > I'd like to direct SM to a specific folder just by typing an URL with
>> > the folder name in it. Something like:
>> > http://server/squirrelmail/?mailbox=.X.Y.Z.foldername.
>> > If the user hasn't logged in yet, he should be directed to the login
>> > screen and then to the folder.
>>
>> You might start by looking at the Startup Folder plugin.  It requires
>> a prior user setting for the folder to load up, but you could try to
>> take the URL that hits the login page and if it contains some special
>> query argument of your choosing with a folder name in it, your plugin
>> can do the same thing as Startup Folder, but in a dynamic fashion.
>
> This plugin should indeed be able to get me there. I probably just
> need to assign a specific variable with my folder name rather than the
> name stored in the user's configuration file. I see you are one of the
> developers of this plugin. I am alas not familiar with the plugin
> architecture and other internals of SM, and only an amateur in PHP
> coding. In particular, I am not sure what file the predefined link
> should call with the variable that has the folder name in it, i.e.
> http://server/squirrelmail/what-file-do- i-put-here.php?startupfolder=myfolder
>
> (In my previous attempts to tweak the code, my issue was that the
> variable containing the folder name had to be passed between several
> files in an order that was not so obvious.)
>
> Do you have any guidance? We can forget the login issue, assuming I
> tell my users that they first need to login before they try to use the
> links containing the folder name.

You can pass it to

....../squirrelmail/src/webmail.php?right_frame=right_main.php?startMessage=1&mailbox=INBOX.aaaaa

Where INBOX.aaaaa is the desired mailbox, which may be formatted
differently in your case - see what folder links look like in your
folder list to see.  You could also only load the mailbox list without
the folder list by using

....../squirrelmail/src/right_main.php?startMessage=1&mailbox=INBOX.aaaaa

If you want to do it through the login page, you'd pass the folder
name on the src/login.php URL and catch it in one of the hooks on the
login page, use sqsession_register() to store it in the user session
temporarily.  Then because I think the session is reset upon
authentication, you may need to pull it back out of the session using
sqGetGlobalVar() during the login_before hook and put it back into the
session as before during the login_verified hook (but it's up to you
to test if that's necessary).  Finally, in the webmail_top hook, do
the same thing Startup Folder does with that value.

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-devel@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel