1. You can NOT add an identity 'outside' your own domain. That is if You are logged in as 'mail@gunfro.com' You could only add identities to that domain.
That's not really a good idea. I have a single mailbox with aliases into it. Many of those aliases are from different domains, so this patch would break my setup.
I suspect other people have identities for other domains, too.

On 7 Oct 2007, at 15:15, Brett Patterson wrote:

Got this in a private message on the forums.  Thought I'd pass it along:

You and the rest of the team are doing a great job.
This might not be the right way to send this information but I have posted about this before with no results, so here it is for You and the rest of the team to do whatever You want with.

My improvements to the identity section.
The easy one is about the sort order in the indentity list.
Code:

/program/steps/settings/func.inc
function rcmail_indentities_list.....
// get contacts from DB
ORDER BY standard DESC,
name ASC,
email ASC // this one is new....



The second one is a bit more. It improves the identity section in two ways.
1. You can NOT add an identity 'outside' your own domain. That is if You are logged in as 'mail@gunfro.com' You could only add identities to that domain.
2. You can NOT add an identity if it already exists in the domain. The domain You are logged into.

I made this in one chunk so it easier to add. It might be better to put the code more where it belongs, hope You get my point.

Code:

/program/steps/settings/save_identities.php

// check input
if (empty($_POST['_name']) || empty($_POST['_email']))
{
$OUTPUT->show_message('formincomplete', 'warning');
rcmail_overwrite_action('edit-identitiy');
return;
}

//*********************************************************************
// MOD GUNFRO START
$newa = explode("@", $_POST['_email']);
$curr = explode("@", $_SESSION['username']);
// Check valid domain.
if ($newa[1] != $curr[1])
{
$OUTPUT->show_message('domainnotvalid', 'warning');
rcmail_overwrite_action($_framed ? 'edit-identity' : 'identities');
return;
}
// Check if changing email and it exits.
if ($_POST['_iid'])
{
$DB->query("SELECT * FROM ".get_table_name('identities')."
WHERE identity_id=?
AND del<>1",
$_POST['_iid']);

$curri = $DB->fetch_assoc();
if ($curri['email'] <> $_POST['_email'])
{
$DB->query("SELECT * FROM ".get_table_name('identities')."
WHERE email=?
AND del<>1",
$_POST['_email']);

if ($DB->fetch_assoc() != NULL)
{
$OUTPUT->show_message('emailexists', 'warning');
rcmail_overwrite_action($_framed ? 'edit-identity' : 'identities');
return;
}
}
} else { // Just new a identity
$DB->query("SELECT * FROM ".get_table_name('identities')."
WHERE email=?
AND del<>1",
$_POST['_email']);

if ($DB->fetch_assoc() != NULL)
{
$OUTPUT->show_message('emailexists', 'warning');
rcmail_overwrite_action($_framed ? 'edit-identity' : 'identities');
return;
}
}

// MOD GUNFRO END
//*********************************************************************

// update an existing contact
if ($_POST['_iid'])



That was my contribution for now.
Best regards
Gunnar Frödin / GunFro
--
~ Brett Patterson
_______________________________________________
List info: http://lists.roundcube.net/dev/