I need to cover some quite special scenarios here in terms of identity selection, and therefore wanted first to understand the current logic how an identity is being selected (in order to implement a correct and working patch later on).
I got stuck already at first attempt. Say we have the following two messages with their headers (please don't ask why there are two headers "Envelope-To:", just please take it as a matter of fact):
Delivery-date: Sat, 06 Jul 2013 20:29:21 +0200 Return-path: theo1@tester.de Envelope-To: identity1@test.de Envelope-To: identity2@test.de MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 06 Jul 2013 20:29:21 +0200 From: theo1@tester.de To: theo2@tester.de Subject: Test #1 (Envelope-To: identity1@test.de, Envelope-To: identity2@test.de) Message-ID: identity1@tester.de X-Sender: theo1@tester.de User-Agent: Roundcube Webmail/1.0-git
Delivery-date: Sat, 06 Jul 2013 20:29:21 +0200 Return-path: theo1@tester.de Envelope-To: identity2@test.de Envelope-To: identity1@test.de MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 06 Jul 2013 20:29:21 +0200 From: theo1@tester.de To: theo2@tester.de Subject: Test #1 (Envelope-To: identity2@test.de, Envelope-To: identity1@test.de) Message-ID: identity2@tester.de X-Sender: theo1@tester.de User-Agent: Roundcube Webmail/1.0-git
Please also take it as a matter of fact that "identity1@test.de" and "identity2@test.de" are being defined as identities in Roundcube.
The main difference between these two messages is the order of the "Envelope-To:" headers. But apparently that doesn't make any difference at all, as when replying to these messages, the identity "identity1@test.de" is being used as the sender in the "From:" header in both cases. Hmm...?!?
This logic escapes me and makes my life more difficult, as this behaviour is telling me that the order (of both the same headers in the same message!) doesn't make any difference. Is the choice being taken because of the alphabetical order of the sender addresses (so that "identity1@test.de" is preceding "identity2@test.de")?
At this point I stopped testing, and my next question is:
As I'm able to create any custom header right before delivery, how can I make sure that this - and only this - custom header will be respected with regards to identity selection, disregarding any other headers/addresses and the entire rest of the logic...?
This would be a private patch, of course. Any help and hint appreciated, for I'm a noob in terms of PHP (= I have an idea of the logic, but just can't code it).
Michael Heydekamp Co-Admin freexp.de Düsseldorf/Germany
On 07/06/2013 10:58 PM, Michael Heydekamp wrote:
The main difference between these two messages is the order of the "Envelope-To:" headers. But apparently that doesn't make any difference at all, as when replying to these messages, the identity "identity1@test.de" is being used as the sender in the "From:" header in both cases. Hmm...?!?
See line 1905-1812 of steps/mail/func.inc (git-master). It matches the header value with identities in identities order. I suppose this is good because we give a precedence to default identity which is first on the list here.
As I'm able to create any custom header right before delivery, how can I make sure that this - and only this - custom header will be respected with regards to identity selection, disregarding any other headers/addresses and the entire rest of the logic...?
This would be a private patch, of course. Any help and hint appreciated, for I'm a noob in terms of PHP (= I have an idea of the logic, but just can't code it).
Maybe a hook for plugin at the end of rcmail_identity_select() function would be the best solution for you. I'd call it 'identity_select' or 'message_compose_identity'.
Am 08.07.2013 08:19, schrieb A.L.E.C:
On 07/06/2013 10:58 PM, Michael Heydekamp wrote:
The main difference between these two messages is the order of the "Envelope-To:" headers. But apparently that doesn't make any difference at all, as when replying to these messages, the identity "identity1@test.de" is being used as the sender in the "From:" header in both cases. Hmm...?!?
See line 1905-1812 of steps/mail/func.inc (git-master).
Yep, afterwards I did find this place. Originally this code was in steps/mail/compose.inc.
As I'm able to create any custom header right before delivery, how can I make sure that this - and only this - custom header will be respected with regards to identity selection, disregarding any other headers/addresses and the entire rest of the logic...?
This would be a private patch, of course. Any help and hint appreciated, for I'm a noob in terms of PHP (= I have an idea of the logic, but just can't code it).
Maybe a hook for plugin at the end of rcmail_identity_select() function would be the best solution for you. I'd call it 'identity_select' or 'message_compose_identity'.
Sounds like a perfect idea - and a lot better than to patch the existing code in func.inc, as the daily git-pull will then often run into conflicts and abort the merge.
The problem just is: As I said, I'm a PHP noob and have no clue what I have to do to create/use such a hook with a plugin. I may probably be able to patch the existing code in func.inc, but that's it. Even though the plugin code will most likely be pretty similar to the code in func.inc.
If anyone of the Roundcube and/or plugin developers want to help me, you're welcome. A fair and tax-free ;-) compensation is granted.
Michael Heydekamp Co-Admin freexp.de Düsseldorf/Germany
Am 08.07.2013 20:13, schrieb Michael Heydekamp:
Am 08.07.2013 08:19, schrieb A.L.E.C:
Maybe a hook for plugin at the end of rcmail_identity_select() function would be the best solution for you. I'd call it 'identity_select' or 'message_compose_identity'.
Sounds like a perfect idea - and a lot better than to patch the existing code in func.inc, as the daily git-pull will then often run into conflicts and abort the merge.
The problem just is: As I said, I'm a PHP noob and have no clue what I have to do to create/use such a hook with a plugin. I may probably be able to patch the existing code in func.inc, but that's it. Even though the plugin code will most likely be pretty similar to the code in func.inc.
If anyone of the Roundcube and/or plugin developers want to help me, you're welcome. A fair and tax-free ;-) compensation is granted.
To make a bit more clear what such a tiny plugin should do:
If a specific header (say "RC-Identity:") does exist, the current RC logic shall be overridden by this header, and the address specified in this header shall be used as identity (if the address is configured as an identity at all).
If this header does not exist (or if the address specified in this header is not configured as an identity), the current RC logic shall apply.
Probably an easy task for any PHP developer, but not for me.
Michael Heydekamp Co-Admin freexp.de Düsseldorf/Germany
Am 08.07.2013 20:13, schrieb Michael Heydekamp:
Am 08.07.2013 08:19, schrieb A.L.E.C:
On 07/06/2013 10:58 PM, Michael Heydekamp wrote:
The main difference between these two messages is the order of the "Envelope-To:" headers. But apparently that doesn't make any difference at all, as when replying to these messages, the identity "identity1@test.de" is being used as the sender in the "From:" header in both cases. Hmm...?!?
See line 1905-1812 of steps/mail/func.inc (git-master).
Yep, afterwards I did find this place. Originally this code was in steps/mail/compose.inc.
As I'm able to create any custom header right before delivery, how can I make sure that this - and only this - custom header will be respected with regards to identity selection, disregarding any other headers/addresses and the entire rest of the logic...?
This would be a private patch, of course. Any help and hint appreciated, for I'm a noob in terms of PHP (= I have an idea of the logic, but just can't code it).
Maybe a hook for plugin at the end of rcmail_identity_select() function would be the best solution for you. I'd call it 'identity_select' or 'message_compose_identity'.
Sounds like a perfect idea - and a lot better than to patch the existing code in func.inc, as the daily git-pull will then often run into conflicts and abort the merge.
The problem just is: As I said, I'm a PHP noob and have no clue what I have to do to create/use such a hook with a plugin. I may probably be able to patch the existing code in func.inc, but that's it. Even though the plugin code will most likely be pretty similar to the code in func.inc.
Contact me once the hook is present (myroundcube [at] mail4us [dot] net). Such a plugin isn't a big thing.
If anyone of the Roundcube and/or plugin developers want to help me, you're welcome. A fair and tax-free ;-) compensation is granted.
Cheers,
Am 08.07.2013 20:28, schrieb Rosali:
Am 08.07.2013 20:13, schrieb Michael Heydekamp:
The problem just is: As I said, I'm a PHP noob and have no clue what I have to do to create/use such a hook with a plugin. I may probably be able to patch the existing code in func.inc, but that's it. Even though the plugin code will most likely be pretty similar to the code in func.inc.
Contact me once the hook is present (myroundcube [at] mail4us [dot] net). Such a plugin isn't a big thing.
Uh, THAT was quick... :-)
I'll be more than happy to do that, but: How do we make this hook being present? Can anyone do that, or just @alec and/or @thomas?
Sorry if this question does sound silly to you dev folks...
@alec and @thomas: Besides this hook, I don't want to miss to remind you that besides "Delivered-To:" and "Envelope-To:", the pretty common header "X-Envelope-To:" should be supported as a last resort for identity selection as well (see http://trac.roundcube.net/ticket/1488553). This patch is so trivial that even I could do it myself. I'm aware that Justin van Beusekom pointed me to https://github.com/roundcube/roundcubemail/pulls, but either I or my IE8 (or we both) are too dumb to use this facility. :(
Michael Heydekamp Co-Admin freexp.de Düsseldorf/Germany
Am 08.07.2013 20:56, schrieb Michael Heydekamp:
Am 08.07.2013 20:28, schrieb Rosali:
Am 08.07.2013 20:13, schrieb Michael Heydekamp:
The problem just is: As I said, I'm a PHP noob and have no clue what I have to do to create/use such a hook with a plugin. I may probably be able to patch the existing code in func.inc, but that's it. Even though the plugin code will most likely be pretty similar to the code in func.inc.
Contact me once the hook is present (myroundcube [at] mail4us [dot] net). Such a plugin isn't a big thing.
Uh, THAT was quick... :-)
I'll be more than happy to do that, but: How do we make this hook being present? Can anyone do that, or just @alec and/or @thomas?
I don't think we need the hook. If I understand you right you need the identity selection when replying to a message. We have 'storage_init' and 'message_compose' hooks. 'storage_init' hook allows us to fetch any custom header from the IMAP server. 'message_compose' hook can be used to create a Roundcube message object ...
$MESSAGE = new rcube_message($args['param']['reply_uid']);
The object contains in 'others' the custom header field (added by 'storage_init'). Now we can query the database for an existing identity and add some javascript stuff to the client to select the according identity.
Of course a hook would be more elegant. If you are interested, then send me a message which contains your custom header field and lets talk about details.
Sorry if this question does sound silly to you dev folks...
@alec and @thomas: Besides this hook, I don't want to miss to remind you that besides "Delivered-To:" and "Envelope-To:", the pretty common header "X-Envelope-To:" should be supported as a last resort for identity selection as well (see http://trac.roundcube.net/ticket/1488553). This patch is so trivial that even I could do it myself. I'm aware that Justin van Beusekom pointed me to https://github.com/roundcube/roundcubemail/pulls, but either I or my IE8 (or we both) are too dumb to use this facility. :(
Cheers,
Am 08.07.2013 21:43, schrieb Rosali:
Of course a hook would be more elegant. If you are interested, then send me a message which contains your custom header field and lets talk about details.
Michael Heydekamp Co-Admin freexp.de Düsseldorf/Germany
Am 08.07.2013 23:03, schrieb Michael Heydekamp:
Am 08.07.2013 21:43, schrieb Rosali:
Of course a hook would be more elegant. If you are interested, then send me a message which contains your custom header field and lets talk about details.
You have mail. ;)
Please let me know your email address. The plugin is ready for testing. Mailto: myroundcube [at] mail4us [dot] net
Am 09.07.2013 08:48, schrieb Rosali:
Am 08.07.2013 23:03, schrieb Michael Heydekamp:
Am 08.07.2013 21:43, schrieb Rosali:
Of course a hook would be more elegant. If you are interested, then send me a message which contains your custom header field and lets talk about details.
You have mail. ;)
Please let me know your email address.
Well, the address that I used when I sent you my mail (which is the same I'm using for this list) is fine. ;) But you can also use michael [at] heydekamp [dot] de.
The plugin is ready for testing.
Yep, have received it, thanks a lot! I'm just about to start testing (and donating...), will revert asap to your mail address. As almost always, came home from the office a bit late.
Michael Heydekamp Co-Admin freexp.de Düsseldorf/Germany