mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-06-24 03:14:17 +00:00
See ChangeLog
Monotone-Parent: a4f6c377a41454eb21ed5b253cb7d07fc2c1a55e Monotone-Revision: 3c7106a946b0d9786d46c4f0c0a7e5bc1e5f8684 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2011-12-29T17:50:48
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2007-2011 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
* Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -21,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
@@ -122,10 +124,16 @@
|
||||
SOGoUserManager *userManager;
|
||||
NSDictionary *folderData;
|
||||
NSMutableArray *folders;
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
folders = [NSMutableArray array];
|
||||
while ((currentFolder = [rawFolders nextObject]))
|
||||
{
|
||||
// Using a local pool to avoid using too many file descriptors. This could
|
||||
// happen with tons of mailboxes under "Other Users" as LDAP connections
|
||||
// are never reused and "autoreleased" at the end. This loop would consume
|
||||
// lots of LDAP connections during its execution.
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
currentFolderType = [self _folderType: currentFolder];
|
||||
|
||||
// We translate the "Other Users" and "Shared Folders" namespaces.
|
||||
@@ -169,6 +177,7 @@
|
||||
currentDisplayName, @"displayName",
|
||||
nil];
|
||||
[folders addObject: folderData];
|
||||
[pool release];
|
||||
}
|
||||
|
||||
return folders;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* UIxMailMainFrame.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2006 Inverse inc.
|
||||
* Copyright (C) 2006-2011 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
Copyright (C) 2007-2011 Inverse inc.
|
||||
Copyright (C) 2004-2005 SKYRIX Software AG
|
||||
|
||||
Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||
|
||||
This file is part of SOGo.
|
||||
|
||||
SOGo is free software; you can redistribute it and/or modify it under
|
||||
@@ -626,14 +629,55 @@
|
||||
return [self labelForKey: [currentColumn objectForKey: @"value"]];
|
||||
}
|
||||
|
||||
- (NSString *) getUnseenCountForAllFolders
|
||||
- (NSString *) unseenCountFolders
|
||||
{
|
||||
SOGoDomainDefaults *dd;
|
||||
NSArray *pathComponents, *filters, *actions;
|
||||
NSDictionary *d, *action;
|
||||
NSMutableArray *folders;
|
||||
NSMutableString *path;
|
||||
SOGoUserDefaults *ud;
|
||||
NSString *s;
|
||||
int i, j, k;
|
||||
|
||||
dd = [[context activeUser] domainDefaults];
|
||||
ud = [[context activeUser] userDefaults];
|
||||
folders = [NSMutableArray array];
|
||||
|
||||
return ([dd mailCheckAllUnseenCounts] ? @"true" : @"false");
|
||||
filters = [ud sieveFilters];
|
||||
|
||||
for (i = 0; i < [filters count]; i++)
|
||||
{
|
||||
d = [filters objectAtIndex: i];
|
||||
actions = [d objectForKey: @"actions"];
|
||||
|
||||
for (j = 0; j < [actions count]; j++)
|
||||
{
|
||||
action = [actions objectAtIndex: j];
|
||||
|
||||
if ([[action objectForKey: @"method"] caseInsensitiveCompare: @"fileinto"] == NSOrderedSame)
|
||||
{
|
||||
s = [action objectForKey: @"argument"];
|
||||
|
||||
// We format the result string so that MailerUI.js can simply consume that information
|
||||
// without doing anything special on its side
|
||||
if (s)
|
||||
{
|
||||
pathComponents = [s componentsSeparatedByString: @"/"];
|
||||
path = [NSMutableString string];
|
||||
|
||||
for (k = 0; k < [pathComponents count]; k++)
|
||||
{
|
||||
[path appendFormat: @"folder%@", [[pathComponents objectAtIndex: k] asCSSIdentifier]];
|
||||
if (k < [pathComponents count] - 1)
|
||||
[path appendString: @"/"];
|
||||
}
|
||||
|
||||
[folders addObject: [NSString stringWithFormat: @"/0/%@", path]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [folders jsonRepresentation];
|
||||
}
|
||||
|
||||
@end /* UIxMailMainFrame */
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<script type="text/javascript">
|
||||
var mailAccounts = <var:string value="mailAccounts" const:escapeHTML="NO"/>;
|
||||
var inboxData = <var:string value="inboxData" const:escapeHTML="NO"/>;
|
||||
var getUnseenCountForAllFolders = <var:string value="getUnseenCountForAllFolders"/>;
|
||||
var unseenCountFolders = <var:string value="unseenCountFolders" const:escapeHTML="NO"/>;
|
||||
</script>
|
||||
<style type="text/css">
|
||||
<var:if condition="horizontalDragHandleStyle">
|
||||
|
||||
@@ -855,7 +855,7 @@ function openMailbox(mailbox, reload) {
|
||||
|
||||
Mailer.currentMailbox = mailbox;
|
||||
|
||||
if (!getUnseenCountForAllFolders && Mailer.unseenCountMailboxes.indexOf(mailbox) == -1) {
|
||||
if (Mailer.unseenCountMailboxes.indexOf(mailbox) == -1) {
|
||||
Mailer.unseenCountMailboxes.push(mailbox);
|
||||
}
|
||||
|
||||
@@ -2048,10 +2048,9 @@ function initMailboxTreeCB() {
|
||||
checkAjaxRequestsState();
|
||||
getFoldersState();
|
||||
configureDroppables();
|
||||
if (getUnseenCountForAllFolders) {
|
||||
for (var i = 0; i < mailboxTree.aNodes.length; i++) {
|
||||
var mailboxPath = mailboxTree.aNodes[i].dataname;
|
||||
Mailer.unseenCountMailboxes.push(mailboxPath);
|
||||
if (unseenCountFolders.length > 0) {
|
||||
for (var i = 0; i < unseenCountFolders.length; i++) {
|
||||
Mailer.unseenCountMailboxes.push(unseenCountFolders[i]);
|
||||
}
|
||||
refreshUnseenCounts();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user