Gary: I'll give it a try over the weekend and see what I can come up with. Thanks for the help!
Tod
Gary Mort wrote:
After looking through the code a bit, I think you can solve your issue using the imap_init plugin and one minor core change. All in all it looks like an hours coding and 3 hours testing.
imap_init is called in: program/include/rcmail.php so all you need to do there is
- Create your own socket/connection to the server and logon
$imapsocket = yourconnection();
2)set imap->conn->fp property to the socket your have opened
$GLOBALS['IMAP']->conn->fp = $imapsocket;
3)set the logged property on connection so it knows it is connected
$GLOBALS['IMAP']->conn->logged = TRUE;
Now for the core code change: In the imap library, the connect code is a do/while loop. This means it always tries to connect at least once, even if you are already connected. And while it is possible to force the imap_generic option to abort the connection attempt by setting userid or password to nothing, it won't abort before setting logged to false, so roundcube will not think it is logged in. Change that from a do/while loop to a while loop[move the condition to the top], or surround it by an if not connected clause, and you can bypass processing if you have already connected.
/program/include/rcube_imap.php
/do { $data = rcmail::get_instance()->plugins->exec_hook('imap_connect', array('host' => $host, 'user' => $user, 'attempt' => ++$attempt)); if (!empty($data['pass'])) $pass = $data['pass']; $this->conn->connect($data['host'], $data['user'], $pass, $this->options); } while(!$this->conn->connected() && $data['retry']);/
And that's it, you should be all good.
Sorry I couldn't be more help. I actually haven't used RoundCube before.... I was let go a couple months ago and am in the process of setting up my website for doing web engineering freelancing. The only reason I signed up to this list is because I want a webmail app to segregate out my email from multiple domains/addresses properly and RoundCube looks like the best one[Horde looks slightly better feature wise, but as too MANY features for my simple needs, while Squirrelmail has too few]. I don't currently have a test environment to throw all this onto to test it.
This was a fascinating problem though, so thanks for a few hours diversion.
-Gary