Monotone-Parent: f90d169fbc251326ea6c8a2f620e125a8a7b4168

Monotone-Revision: 7786f49f6724383b92e91ba7998b99cfb52ceec3

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2012-04-20T13:27:21
maint-2.0.2
Wolfgang Sourdeau 2012-04-20 13:27:21 +00:00
parent 9ea333e6b6
commit fa4d2d3141
12 changed files with 135 additions and 65 deletions

View File

@ -1,3 +1,16 @@
2012-04-20 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Mailer/SOGoDraftObject.m
(-mimeHeaderMapWithHeaders:excluding:) take the new "replyTo"
header into account.
* SoObjects/SOGo/SOGoUser.m (-_appendSystemMailAccount): specify
the value of "SOGoMailReplyTo" in the "replyTo" field of each
identity, if present.
* SoObjects/SOGo/SOGoUserDefaults.m (-setMailReplyTo:)
(-mailReplyTo:): accessors for the "SOGoMailReplyTo" user default.
2012-04-19 Francis Lachapelle <flachapelle@inverse.ca>
* SoObjects/Appointments/SOGoAppointmentFolder.m

View File

@ -269,7 +269,7 @@ static NSString *userAgent = nil;
{
id headerValue;
unsigned int count;
NSString *messageID, *priority, *pureSender;
NSString *messageID, *priority, *pureSender,*replyTo;
for (count = 0; count < 8; count++)
{
@ -310,6 +310,13 @@ static NSString *userAgent = nil;
[headers setObject: @"5 (Lowest)" forKey: @"X-Priority"];
}
replyTo = [headers objectForKey: @"replyTo"];
if ([replyTo length] > 0)
{
[headers setObject: replyTo forKey: @"reply-to"];
[headers removeObjectForKey: @"replyTo"];
}
if ([[newHeaders objectForKey: @"receipt"] isEqualToString: @"true"])
{
pureSender = [[newHeaders objectForKey: @"from"] pureEMailAddress];
@ -1361,7 +1368,7 @@ static NSString *userAgent = nil;
NSString *s, *dateString;
NGMutableHashMap *map;
NSArray *emails;
id from;
id from, replyTo;
map = [[[NGMutableHashMap alloc] initWithCapacity:16] autorelease];
@ -1383,6 +1390,9 @@ static NSString *userAgent = nil;
[map setObject: [self _quoteSpecials: from] forKey: @"from"];
}
if (replyTo = [headers objectForKey: @"reply-to"])
[map setObject: replyTo forKey: @"reply-to"];
if (inReplyTo)
[map setObject: inReplyTo forKey: @"in-reply-to"];

View File

@ -576,8 +576,8 @@
- (void) _appendSystemMailAccount
{
NSString *fullName, *imapLogin, *imapServer, *signature, *encryption,
*scheme, *action, *query;
NSString *fullName, *replyTo, *imapLogin, *imapServer, *signature,
*encryption, *scheme, *action, *query;
NSMutableDictionary *mailAccount, *identity, *mailboxes, *receipts;
NSNumber *port;
NSMutableArray *identities;
@ -642,6 +642,8 @@
mails = [self allEmails];
[mailAccount setObject: [mails objectAtIndex: 0] forKey: @"name"];
replyTo = [_defaults mailReplyTo];
max = [mails count];
if (max > 1)
max--;
@ -653,6 +655,10 @@
fullName = login;
[identity setObject: fullName forKey: @"fullName"];
[identity setObject: [mails objectAtIndex: count] forKey: @"email"];
if ([replyTo length] > 0)
[identity setObject: replyTo forKey: @"replyTo"];
signature = [_defaults mailSignature];
if (signature)
[identity setObject: signature forKey: @"signature"];

View File

@ -130,6 +130,9 @@ extern NSString *SOGoWeekStartFirstFullWeek;
- (void) setMailSignaturePlacement: (NSString *) newValue;
- (NSString *) mailSignaturePlacement;
- (void) setMailReplyTo: (NSString *) newValue;
- (NSString *) mailReplyTo;
- (void) setAllowUserReceipt: (BOOL) allow;
- (BOOL) allowUserReceipt;
- (void) setUserReceiptNonRecipientAction: (NSString *) action;

View File

@ -531,6 +531,18 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
return signaturePlacement;
}
- (void) setMailReplyTo: (NSString *) newValue
{
if ([newValue length] == 0)
newValue = nil;
[self setObject: newValue forKey: @"SOGoMailReplyTo"];
}
- (NSString *) mailReplyTo
{
return [self stringForKey: @"SOGoMailReplyTo"];
}
- (void) setAllowUserReceipt: (BOOL) allow
{
[self setBool: allow forKey: @"SOGoMailReceiptAllow"];

View File

@ -104,6 +104,7 @@ static NSArray *infoKeys = nil;
infoKeys = [[NSArray alloc] initWithObjects:
@"subject", @"to", @"cc", @"bcc",
@"from", @"inReplyTo",
@"replyTo",
@"priority", @"receipt", nil];
}
@ -255,6 +256,15 @@ static NSArray *infoKeys = nil;
return from;
}
- (NSString *) replyTo
{
SOGoUserDefaults *ud;
ud = [[context activeUser] userDefaults];
return [ud mailReplyTo];
}
- (void) setSubject: (NSString *) newSubject
{
ASSIGN (subject, newSubject);

View File

@ -160,6 +160,7 @@
"Full Name:" = "Full Name:";
"Email:" = "Email:";
"Reply To Email:" = "Reply To Email:";
"Signature:" = "Signature:";
"(Click to create)" = "(Click to create)";

View File

@ -1273,33 +1273,21 @@
return [[user domainDefaults] mailAuxiliaryUserAccountsEnabled];
}
- (void) _extractMainSignature: (NSDictionary *) account
- (void) _extractMainIdentity: (NSDictionary *) identity
{
/* We perform some validation here as we have no guaranty on the input
validity. */
NSString *signature;
NSArray *identities;
NSDictionary *identity;
NSString *value;
if ([account isKindOfClass: [NSDictionary class]])
if ([identity isKindOfClass: [NSDictionary class]])
{
identities = [account objectForKey: @"identities"];
if ([identities isKindOfClass: [NSArray class]])
{
signature = nil;
if ([identities count] > 0)
{
identity = [identities objectAtIndex: 0];
if ([identity isKindOfClass: [NSDictionary class]])
{
signature = [identity objectForKey: @"signature"];
if (!signature)
signature = @"";
[userDefaults setMailSignature: signature];
}
}
}
value = [identity objectForKey: @"signature"];
if (!value)
value = @"";
[userDefaults setMailSignature: value];
value = [[identity objectForKey: @"replyTo"]
stringByTrimmingSpaces];
[userDefaults setMailReplyTo: value];
}
}
@ -1311,37 +1299,40 @@
|| [action isEqualToString: @"ask"]));
}
- (void) _extractMainReceiptsPreferences: (NSDictionary *) account
- (void) _extractMainReceiptsPreferences: (NSDictionary *) receipts
{
/* We perform some validation here as we have no guaranty on the input
validity. */
NSDictionary *receipts;
NSString *action;
if ([account isKindOfClass: [NSDictionary class]])
if ([receipts isKindOfClass: [NSDictionary class]])
{
receipts = [account objectForKey: @"receipts"];
if ([receipts isKindOfClass: [NSDictionary class]])
{
action = [receipts objectForKey: @"receiptAction"];
[userDefaults
setAllowUserReceipt: [action isEqualToString: @"allow"]];
action = [receipts objectForKey: @"receiptAction"];
[userDefaults
setAllowUserReceipt: [action isEqualToString: @"allow"]];
action = [receipts objectForKey: @"receiptNonRecipientAction"];
if ([self _validateReceiptAction: action])
[userDefaults setUserReceiptNonRecipientAction: action];
action = [receipts objectForKey: @"receiptNonRecipientAction"];
if ([self _validateReceiptAction: action])
[userDefaults setUserReceiptNonRecipientAction: action];
action = [receipts objectForKey: @"receiptOutsideDomainAction"];
if ([self _validateReceiptAction: action])
[userDefaults setUserReceiptOutsideDomainAction: action];
action = [receipts objectForKey: @"receiptAnyAction"];
if ([self _validateReceiptAction: action])
[userDefaults setUserReceiptAnyAction: action];
}
action = [receipts objectForKey: @"receiptOutsideDomainAction"];
if ([self _validateReceiptAction: action])
[userDefaults setUserReceiptOutsideDomainAction: action];
action = [receipts objectForKey: @"receiptAnyAction"];
if ([self _validateReceiptAction: action])
[userDefaults setUserReceiptAnyAction: action];
}
}
- (void) _extractMainCustomFrom: (NSDictionary *) account
{
}
- (void) _extractMainReplyTo: (NSDictionary *) account
{
}
- (BOOL) _validateAccountIdentities: (NSArray *) identities
{
static NSString *identityKeys[] = { @"fullName", @"email", nil };
@ -1355,7 +1346,7 @@
if (!knownKeys)
{
knownKeys = [NSArray arrayWithObjects: @"fullName", @"email",
@"signature", nil];
@"signature", @"replyTo", nil];
[knownKeys retain];
}
@ -1407,7 +1398,7 @@
if (!knownKeys)
{
knownKeys = [NSArray arrayWithObjects: @"name", @"serverName", @"port",
@"userName", @"password", @"encryption",
@"userName", @"password", @"encryption", @"replyTo",
@"identities", @"mailboxes",
@"receipts",
nil];
@ -1449,6 +1440,20 @@
return valid;
}
- (void) _extractMainAccountSettings: (NSDictionary *) account
{
NSArray *identities;
if ([account isKindOfClass: [NSDictionary class]])
{
identities = [account objectForKey: @"identities"];
if ([identities isKindOfClass: [NSArray class]]
&& [identities count] > 0)
[self _extractMainIdentity: [identities objectAtIndex: 0]];
[self _extractMainReceiptsPreferences: [account objectForKey: @"receipts"]];
}
}
- (void) _extractAuxiliaryAccounts: (NSArray *) accounts
{
int count, max, oldMax;
@ -1499,9 +1504,7 @@
max = [accounts count];
if (max > 0)
{
[self _extractMainSignature: [accounts objectAtIndex: 0]];
[self _extractMainReceiptsPreferences: [accounts objectAtIndex: 0]];
[self _extractMainAccountSettings: [accounts objectAtIndex: 0]];
if ([self mailAuxiliaryUserAccountsEnabled])
[self _extractAuxiliaryAccounts: accounts];
}

View File

@ -324,6 +324,8 @@
/></label><br/>
<label><var:string label:value="Email:"/>
<input const:name="email" const:id="email" type="text" const:value=""/></label><br/>
<label><var:string label:value="Reply To Email:"/>
<input const:name="replyTo" const:id="replyTo" type="text" const:value=""/></label><br/>
<var:string label:value="Signature:"/>
<span id="actSignature"><!--space --></span>
</fieldset>

View File

@ -1,5 +1,18 @@
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
if (NodeList) {
var _each = NodeList.prototype.forEach;
if (!_each) {
_each = function NodeList_each(iterator, context) {
for (var i = 0, length = this.length >>> 0; i < length; i++) {
if (i in this) iterator.call(context, this[i], i, this);
}
};
}
NodeList.prototype._each = _each;
Object.extend(NodeList.prototype, Enumerable);
}
/* custom extensions to the DOM api */
Element.addMethods({
addInterface: function(element, objectInterface) {

View File

@ -657,16 +657,15 @@ function onMailAccountEntryClick(event) {
function displayMailAccount(mailAccount, readOnly) {
var fieldSet = $("accountInfo");
var inputs = fieldSet.getElementsByTagName("input");
for (var i = 0; i < inputs.length; i++) {
inputs[i].disabled = readOnly;
inputs[i].mailAccount = mailAccount;
}
var inputs = $(fieldSet.getElementsByTagName("input"));
inputs.each(function (i) { i.disabled = readOnly;
i.mailAccount = mailAccount; });
fieldSet = $("identityInfo");
inputs = fieldSet.getElementsByTagName("input");
for (var i = 0; i < inputs.length; i++) {
inputs = $(fieldSet.getElementsByTagName("input"));
inputs.each(function (i) { i.mailAccount = mailAccount; });
for (var i = 0; i < 2; i++) {
inputs[i].disabled = readOnly;
inputs[i].mailAccount = mailAccount;
}
var form = $("mainForm");
@ -701,6 +700,7 @@ function displayMailAccount(mailAccount, readOnly) {
: {} );
$("fullName").value = identity["fullName"] || "";
$("email").value = identity["email"] || "";
$("replyTo").value = identity["replyTo"] || "";
displayAccountSignature(mailAccount);

View File

@ -1681,13 +1681,10 @@ function onPreferencesClick(event) {
}
else {
var w = window.open(urlstr, "SOGoPreferences",
"width=580,height=450,resizable=1,scrollbars=0,location=0");
"width=580,height=476,resizable=1,scrollbars=0,location=0");
w.opener = window;
w.focus();
}
preventDefault(event);
return false;
}
function configureLinkBanner() {
@ -1704,7 +1701,7 @@ function configureLinkBanner() {
link = $("preferencesBannerLink");
if (link) {
link.observe("mousedown", listRowMouseDownHandler);
link.observe("click", onPreferencesClick);
link.observe("click", clickEventWrapper(onPreferencesClick));
}
link = $("consoleBannerLink");
if (link) {