6.0.0-beta1
7/29/25

[#4991] Default identity not selected correctly when replying to or forwarding messages in Inbox
Summary Default identity not selected correctly when replying to or forwarding messages in Inbox
Queue IMP
Queue Version 4.1.3
Type Enhancement
State Resolved
Priority 1. Low
Owners slusarz (at) horde (dot) org
Requester boutilpj (at) ednet (dot) ns (dot) ca
Created 02/12/2007 (6742 days ago)
Due
Updated 01/11/2008 (6409 days ago)
Assigned 02/15/2007 (6739 days ago)
Resolved 01/11/2008 (6409 days ago)
Milestone
Patch No

History
01/11/2008 05:57:37 PM Michael Slusarz Comment #23
State ⇒ Resolved
Reply to this comment
Fixed in HEAD and FW_3.
01/11/2008 05:17:56 PM Michael Slusarz Comment #22 Reply to this comment
Is the _identitiesWithDefaultLast() needed?  I don't seem to do
anything different from _identities()  The unset() part is a NOP
How so?  Imagine this scenario:

$_identities = array(

   [0] => 'foo1@example.com',

   [1] => 'foo2@example.com',  (DEFAULT)

   [2] => 'foo2@example.com',

)



Running through the $_identities array only would cause identity 2 to 
blow away identity 1 when storing the identity for 'foo2@example.com'. 
  So we need to move the default identity to be the last entry in the 
loop.  After an unset($_identities[1]) and $_identities[1] = 
'foo2@example.com' the array looks like:

$_identities = array(

   [0] => 'foo1@example.com',

   [2] => 'foo2@example.com',

   [1] => 'foo2@example.com', (DEFAULT)

)



which is what we want.  You need to do the unset() before the 
assignment or else the array value will simply be overwritten instead 
of being appended to the end.
01/11/2008 05:05:08 PM Chuck Hagenbuch Assigned to Michael Slusarz
 
01/11/2008 07:37:54 AM Matt Selsky Comment #21 Reply to this comment
Is the _identitiesWithDefaultLast() needed?  I don't seem to do 
anything different from _identities()  The unset() part is a NOP
01/11/2008 07:23:49 AM Matt Selsky Comment #20 Reply to this comment
That seems to have done the trick.
01/11/2008 07:14:51 AM Michael Slusarz Comment #19 Reply to this comment
No.  Don't we want the default to be first?
Guess we need this also:

http://lists.horde.org/archives/cvs/Week-of-Mon-20080107/074068.html
01/11/2008 07:09:09 AM Matt Selsky Comment #18 Reply to this comment
No.  Don't we want the default to be first?
01/11/2008 06:54:14 AM Michael Slusarz Comment #17
State ⇒ Feedback
Reply to this comment
01/09/2008 08:28:27 AM Jan Schneider Type ⇒ Enhancement
Priority ⇒ 1. Low
State ⇒ Accepted
 
01/09/2008 12:53:22 AM Matt Selsky Comment #16 Reply to this comment
And to reply to myself, both identities have the same email address so 
the first one matches.



Seems like the default identity should win in case of a tie.


01/09/2008 12:28:37 AM Matt Selsky Comment #15 Reply to this comment
The reply and forward links contain "identity=0".  That can't be correct.
01/09/2008 12:25:08 AM Matt Selsky Comment #14
State ⇒
Reply to this comment
I'm seeing the same problem.  I have two identities. "id1" and "id2".   
id2 is the default.



When I compose a new message, id2 is correctly selected.

When I reply to (or forward) a message (in any folder), id1 is 
*incorrectly* selected.


04/30/2007 08:49:03 PM Chuck Hagenbuch State ⇒ No Feedback
 
04/07/2007 04:56:27 PM boutilpj (at) ednet (dot) ns (dot) ca Comment #13 Reply to this comment

[Show Quoted Text - 12 lines]
I looked at the getMatchingIdentity() function and my PHP skills are 
not good enough to make the necessary changes.
04/07/2007 01:13:26 PM Jan Schneider Comment #12 Reply to this comment
And what are you trying to say with this?
That my original patch should suffice because when from_addr is
locked the from address will always be
$imp['user']@$imp['maildomain'] no matter what the user has in the
horde_prefs database.
This assumption is wrong, because the value from the database (even 
though the address is stored in the identities, not in the from_addr 
preference) is alway taking precedence over the default value.



And I asked to move the code to getMatchingIdentity().
03/29/2007 11:09:55 PM boutilpj (at) ednet (dot) ns (dot) ca Comment #11 Reply to this comment
And what are you trying to say with this?
That my original patch should suffice because when from_addr is locked 
the from address will always be $imp['user']@$imp['maildomain'] no 
matter what the user has in the horde_prefs database.


03/29/2007 09:52:00 PM Jan Schneider Comment #10 Reply to this comment
And what are you trying to say with this?
03/16/2007 06:35:03 PM boutilpj (at) ednet (dot) ns (dot) ca Comment #9 Reply to this comment
First of all, this has to be implemented in getMatchingIdentity().
And there is the possibility that the from_addr is locked, but the
user still has two different from addresses. The correct logic would
be to not stop when the first matching identity is found, but to find
all of them, and then select the default identity or the first one
from this list.
From what I can see once the from_addr pref is locked and the value 
is '' , getMatchingIdentity() always just returns one value, 
$imp['user']@$imp['maildomain'] . That is because of the 
getFromAddress function below, in particular this bit:



$val = $this->getValue('from_addr', $ident);

         if (empty($val)) {

             $val = $imp['user'];

         }



I have tested by creating 4 identities with 4 different from_addr . As 
soon as I lock from_addr as false with a value of '' , those from_addr 
in horde_prefs are ignored.







     function getFromAddress($ident = null)

     {

         global $imp;



         if (!empty($this->_fromList[$ident])) {

             return $this->_fromList[$ident];

         }



         $val = $this->getValue('from_addr', $ident);

         if (empty($val)) {

             $val = $imp['user'];

         }



         if (!strstr($val, '@')) {

             $val .= '@' . $imp['maildomain'];

         }



         $this->_fromList[$ident] = $val;



         return $val;

     }


03/16/2007 04:29:56 PM boutilpj (at) ednet (dot) ns (dot) ca Comment #8 Reply to this comment
Are you going to update the patch?
Update the patch so it is implemented in getMatchingIdentity() ?

I can certainly give it a try. :-)
03/16/2007 03:08:42 PM Jan Schneider Comment #7 Reply to this comment
Are you going to update the patch?
02/16/2007 08:45:05 AM Jan Schneider Comment #6 Reply to this comment
First of all, this has to be implemented in getMatchingIdentity(). And 
there is the possibility that the from_addr is locked, but the user 
still has two different from addresses. The correct logic would be to 
not stop when the first matching identity is found, but to find all of 
them, and then select the default identity or the first one from this 
list.
02/16/2007 12:35:36 AM boutilpj (at) ednet (dot) ns (dot) ca Comment #5
New Attachment: message.php.diff Download
Reply to this comment
This small patch works for me. Basically if from_addr pref is locked 
just use the default identity when replying or forwarding a message.
02/15/2007 08:05:44 PM boutilpj (at) ednet (dot) ns (dot) ca Comment #4 Reply to this comment
Ok, starting at line 493 of imp/message.php :



if (count($msgAddresses)) {

         $identity = $user_identity->getMatchingIdentity($msgAddresses);

         if (!is_null($identity) ||

             $user_identity->getMatchingIdentity($msgAddresses, false) 
!== null) {

             $status .= Horde::img('mail_personal.png', _("Personal"));

         }

         if (is_null($identity)) {

             $identity = $user_identity->getDefault();

         }

     }



Since from_addr pref is locked all the identities have the same e-mail 
address it will always pick identity 0 . I can see why the code would 
do this if the identities all had different e-mail addresses. In our 
situation, where we basically only allow different signatures per 
identity this does not work.



Will have to think about it for a bit. :-)
02/15/2007 06:56:09 PM boutilpj (at) ednet (dot) ns (dot) ca Comment #3 Reply to this comment
E-mail server: Cyrus 2.2.12



from_addr is locked in horde/config/prefs.php :



// user preferred email address for From: line

$_prefs['from_addr'] = array(

     'value' => '',

     'locked' => true,

     'shared' => true,

     'type' => 'text',

     'desc' =>  _("Your From: address:")

);



User has 2 identities. First identity is called "Default Identity" and 
is the identity that is created when a user logs in for the first 
time. Second identity is called ID1, Fullname is  Indentity One, and 
Signature is ID1



User has selected ID1 as "Your default identity: " from the pulldown 
menu in IMP, Options, Personal Information.



When the user composes a "New Message", the identity that gets 
selected in the "Identity" pulldown menu at the top of the Compose 
window is user@staff.ednet.ns.ca (ID1) . That works as expected.



When the user clicks reply or forward when reading an e-mail in their 
InBox, the identity that gets selected in the "Identity" pulldown menu 
at the top of the Compose window is user@staff.ednet.ns.ca (Default 
Identity). I would expect it to be user@staff.ednet.ns.ca (ID1)  or am 
I wrong in making that assumption?



I notice that the url that reply and forward point to include 
"identity=0" so I will look around in the code to see why it chooses 
identity 0 .



javascript:popup_imp('/imp/compose.php',700,650,'actionID=reply&index=85&identity=0&array_index=3&thismailbox=INBOX');
02/15/2007 05:52:57 PM Jan Schneider Comment #2
State ⇒ Feedback
Reply to this comment
It works perfectly here for years. You need to provide *far* more 
information, i.e. identities details, urls, email server details, etc.
02/12/2007 04:12:03 PM boutilpj (at) ednet (dot) ns (dot) ca Comment #1
Priority ⇒ 2. Medium
State ⇒ Unconfirmed
Queue ⇒ IMP
Summary ⇒ Default identity not selected correctly when replying to or forwarding messages in Inbox
Type ⇒ Bug
Reply to this comment
When a user has more than one identity the default identity is not 
selected correctly in the compose window when replying to or 
forwarding a message in Inbox.



When composing a new message or replying to/forwarding a message in 
other folders the correct identity is chosen.

Saved Queries