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 |
State ⇒ Resolved
anything different from _identities() The unset() part is a NOP
$_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.
anything different from _identities() The unset() part is a NOP
http://lists.horde.org/archives/cvs/Week-of-Mon-20080107/074068.html
State ⇒ Feedback
http://lists.horde.org/archives/cvs/Week-of-Mon-20080107/074067.html
Priority ⇒ 1. Low
State ⇒ Accepted
the first one matches.
Seems like the default identity should win in case of a tie.
State ⇒
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.
not good enough to make the necessary changes.
locked the from address will always be
$imp['user']@$imp['maildomain'] no matter what the user has in the
horde_prefs database.
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().
the from address will always be $imp['user']@$imp['maildomain'] no
matter what the user has in the horde_prefs database.
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.
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;
}
I can certainly give it a try. :-)
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.
New Attachment: message.php.diff
just use the default identity when replying or forwarding a message.
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. :-)
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');
State ⇒ Feedback
information, i.e. identities details, urls, email server details, etc.
Priority ⇒ 2. Medium
State ⇒ Unconfirmed
Queue ⇒ IMP
Summary ⇒ Default identity not selected correctly when replying to or forwarding messages in Inbox
Type ⇒ Bug
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.