mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-22 03:45:25 +00:00
Monotone-Parent: a53e8fa477d2f4de8903fd3a522065e3698b4749
Monotone-Revision: 3e73bc9e2ac67c257e07beaab3ae5c3a2c1f7479 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-10-29T20:46:59 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -3,6 +3,10 @@
|
||||
* UI/MailerUI/UIxMailListView.m ([UIxMailListView
|
||||
-lastFirstMessageNumber]): new accessor that returns the first
|
||||
message number of the last series of messages.
|
||||
([UIxMailListView -fetchKeys]): request the bodystructure for each
|
||||
listed message.
|
||||
([UIxMailListView -hasMessageAttachment]): extract the attachment
|
||||
information from the message bodystructure.
|
||||
|
||||
2007-10-26 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
|
||||
@@ -40,13 +40,13 @@
|
||||
|
||||
#import <SoObjects/Mailer/SOGoMailFolder.h>
|
||||
#import <SoObjects/Mailer/SOGoMailObject.h>
|
||||
#import <SoObjects/SOGo/NSArray+Utilities.h>
|
||||
#import <SoObjects/SOGo/SOGoDateFormatter.h>
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
|
||||
#import "UIxMailListView.h"
|
||||
|
||||
#define messagesPerPage 50
|
||||
static int attachmentFlagSize = 8096;
|
||||
|
||||
@implementation UIxMailListView
|
||||
|
||||
@@ -80,7 +80,7 @@ static int attachmentFlagSize = 8096;
|
||||
|
||||
- (void) setMessage: (id) _msg
|
||||
{
|
||||
ASSIGN(message, _msg);
|
||||
ASSIGN (message, _msg);
|
||||
}
|
||||
|
||||
- (id) message
|
||||
@@ -203,11 +203,25 @@ static int attachmentFlagSize = 8096;
|
||||
|
||||
- (BOOL) hasMessageAttachment
|
||||
{
|
||||
/* we detect attachments by size ... */
|
||||
unsigned size;
|
||||
|
||||
size = [[[self message] valueForKey:@"size"] intValue];
|
||||
return size > attachmentFlagSize;
|
||||
NSArray *parts;
|
||||
NSEnumerator *dispositions;
|
||||
NSDictionary *currentDisp;
|
||||
BOOL hasAttachment;
|
||||
|
||||
parts = [[message objectForKey: @"body"] objectForKey: @"parts"];
|
||||
if ([parts count] > 1)
|
||||
{
|
||||
dispositions
|
||||
= [[parts objectsForKey: @"disposition"] objectEnumerator];
|
||||
while (!hasAttachment
|
||||
&& (currentDisp = [dispositions nextObject]))
|
||||
hasAttachment = ([[currentDisp objectForKey: @"type"]
|
||||
isEqualToString: @"ATTACHMENT"]);
|
||||
}
|
||||
else
|
||||
hasAttachment = NO;
|
||||
|
||||
return hasAttachment;
|
||||
}
|
||||
|
||||
/* fetching messages */
|
||||
@@ -216,10 +230,12 @@ static int attachmentFlagSize = 8096;
|
||||
{
|
||||
/* Note: see SOGoMailManager.m for allowed IMAP4 keys */
|
||||
static NSArray *keys = nil;
|
||||
if (keys == nil) {
|
||||
|
||||
if (!keys)
|
||||
keys = [[NSArray alloc] initWithObjects: @"UID",
|
||||
@"FLAGS", @"ENVELOPE", @"RFC822.SIZE", nil];
|
||||
}
|
||||
@"FLAGS", @"ENVELOPE", @"RFC822.SIZE",
|
||||
@"BODYSTRUCTURE", nil];
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
@@ -384,22 +400,23 @@ static int attachmentFlagSize = 8096;
|
||||
|
||||
- (NSArray *) messages
|
||||
{
|
||||
NSArray *uids;
|
||||
NSArray *msgs;
|
||||
NSRange r;
|
||||
NSArray *uids;
|
||||
NSDictionary *msgs;
|
||||
NSRange r;
|
||||
unsigned len;
|
||||
|
||||
if (messages != nil)
|
||||
return messages;
|
||||
|
||||
r = [self fetchBlock];
|
||||
uids = [self sortedUIDs];
|
||||
if ((len = [uids count]) > r.length)
|
||||
/* only need to restrict if we have a lot */
|
||||
uids = [uids subarrayWithRange:r];
|
||||
if (!messages)
|
||||
{
|
||||
r = [self fetchBlock];
|
||||
uids = [self sortedUIDs];
|
||||
len = [uids count];
|
||||
if (len > r.length)
|
||||
/* only need to restrict if we have a lot */
|
||||
uids = [uids subarrayWithRange: r];
|
||||
|
||||
msgs = [[self clientObject] fetchUIDs: uids parts: [self fetchKeys]];
|
||||
messages = [[msgs valueForKey: @"fetch"] retain];
|
||||
msgs = [[self clientObject] fetchUIDs: uids parts: [self fetchKeys]];
|
||||
messages = [[msgs objectForKey: @"fetch"] retain];
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user