librelist archives

« back to archive

CTCoreMessage's sequenceNumber = 0

CTCoreMessage's sequenceNumber = 0

From:
Olivier Palliere
Date:
2012-10-03 @ 08:55
Hi Guys, 

I have a problem trying to gather the rfc822 of a message in a particular case.

As I said before, during scanning, I can get the rfc822 by querying the 
CTCoreMessage object, which in turn goes to libetpan and does a  

r = mailimap_fetch(session, set, fetch_type, &fetch_list);

The set being populated with the message's sequence number. During this 
scan phase, where I get all the CTCoreMessage objects using this:

- (NSArray *)messagesFromSequenceNumber:(NSUInteger)startNum 
to:(NSUInteger)endNum withFetchAttributes:(CTFetchAttributes)attrs;


I have a valid value set for sequenceNumber, and can thus use it to 
retrieve the right message.

But when I'm using CTCoreFolder's

- (CTCoreMessage *)messageWithUID:(NSUInteger)uid;

The sequenceNumber of the CTCore object is always 0, hence a rfc822 
messages does that to the server:

FETCH * RFC822.text
* 75 FETCH (RFC822.TEXT {76835}...)

And queries the last message in the mailbox.

I can modify the call to use the uid instead of the sequenceNumber, but I 
assume it should work fine with the sequenceNumber in all situations.

Any idea why that could be?

If I find anything, I'll report back to you.

Olivier./.

Re: [mailcore] CTCoreMessage's sequenceNumber = 0

From:
Matt Ronge
Date:
2012-10-09 @ 02:13
Hi!

I dug into the code a bit and the problem is that [msg 
setSequenceNumber:num] isn't called when using - (CTCoreMessage 
*)messageWithUID:(NSUInteger)uid; 

On the other hand messagesFromSequenceNumber:to:withFetchAttributes: DOES 
call [msg setSequenceNumber:num] so it works properly. I tried to fix it 
but I couldn't figure out where to grab the sequence number inside 
messageWithUID:

It may be easier to switch rfc822 to use uid instead?

Matt 

On Oct 3, 2012, at 3:55 AM, Olivier Palliere <olivier@molowa.com> wrote:

> Hi Guys, 
> 
> I have a problem trying to gather the rfc822 of a message in a particular case.
> 
> As I said before, during scanning, I can get the rfc822 by querying the 
CTCoreMessage object, which in turn goes to libetpan and does a  
> 
> r = mailimap_fetch(session, set, fetch_type, &fetch_list);
> 
> The set being populated with the message's sequence number. During this 
scan pha se, where I get all the CTCoreMessage objects using this:
> 
> - (NSArray *)messagesFromSequenceNumber:(NSUInteger)startNum 
to:(NSUInteger)endNum withFetchAttributes:(CTFetchAttributes)attrs;
> 
> 
> I have a valid value set for sequenceNumber, and can thus use it to 
retrieve the right message.
> 
> But when I'm using CTCoreFolder's
> 
> - (CTCoreMessage *)messageWithUID:(NSUInteger)uid;
> 
> The sequenceNumber of the CTCore object is always 0, hence a rfc822 
messages does that to the server:
> 
> FETCH * RFC822.text
> * 75 FETCH (RFC822.TEXT {76835}...)
> 
> And queries the last message in the mailbox.
> 
> I can modify the call to use the uid instead of the sequenceNumber, but 
I assume it should work fine with the sequenceNumber in all situations.
> 
> Any idea why that could be?
> 
> If I find anything, I'll report back to you.
> 
> Olivier./.
> 

Re: [mailcore] CTCoreMessage's sequenceNumber = 0

From:
Olivier Palliere
Date:
2012-10-09 @ 09:51
hi Matt,

Actually, I added those lines in CTCoreFolder.m

    CTCoreMessage *msg = [[[CTCoreMessage alloc] 
initWithMessageStruct:msgStruct] autorelease];

    NSUInteger seq;

    if ([self sequenceNumberForUID:uid sequenceNumber:&seq])
        msg.sequenceNumber = seq;
    
    msg.parentFolder = self;
    return msg;

Calling 

- (BOOL)sequenceNumberForUID:(NSUInteger)uid sequenceNumber:(NSUInteger 
*)sequenceNumber

from self. And I have my sequenceNumber filled in when I sue the message. 
Working great although I never noticed that method before in 
CTCoreFolder.h ;-)

I'd love to push the code but I don't know how to be honest.

Olivier./.


On Oct 9, 2012, at 4:13 AM, Matt Ronge <mronge@mronge.com> wrote:

> Hi!
> 
> I dug into the code a bit and the problem is that [msg 
setSequenceNumber:num] isn't called when using - (CTCoreMessage 
*)messageWithUID:(NSUInteger)uid; 
> 
> On the other hand messagesFromSequenceNumber:to:withFetchAttributes: 
DOES call [msg setSequenceNumber:num] so it works properly. I tried to fix
it but I couldn't figure out where to grab the sequence number inside 
messageWithUID:
> 
> It may be easier to switch rfc822 to use uid instead?
> 
> Matt 
> 
> On Oct 3, 2012, at 3:55 AM, Olivier Palliere <olivier@molowa.com> wrote:
> 
>> Hi Guys, 
>> 
>> I have a problem trying to gather the rfc822 of a message in a particular case.
>> 
>> As I said before, during scanning, I can get the rfc822 by querying the
CTCoreMessage object, which in turn goes to libetpan and does a  
>> 
>> r = mailimap_fetch(session, set, fetch_type, &fetch_list);
>> 
>> The set being populated with the message's sequence number. During this
scan pha se, where I get all the CTCoreMessage objects using this:
>> 
>> - (NSArray *)messagesFromSequenceNumber:(NSUInteger)startNum 
to:(NSUInteger)endNum withFetchAttributes:(CTFetchAttributes)attrs;
>> 
>> 
>> I have a valid value set for sequenceNumber, and can thus use it to 
retrieve the right message.
>> 
>> But when I'm using CTCoreFolder's
>> 
>> - (CTCoreMessage *)messageWithUID:(NSUInteger)uid;
>> 
>> The sequenceNumber of the CTCore object is always 0, hence a rfc822 
messages does that to the server:
>> 
>> FETCH * RFC822.text
>> * 75 FETCH (RFC822.TEXT {76835}...)
>> 
>> And queries the last message in the mailbox.
>> 
>> I can modify the call to use the uid instead of the sequenceNumber, but
I assume it should work fine with the sequenceNumber in all situations.
>> 
>> Any idea why that could be?
>> 
>> If I find anything, I'll report back to you.
>> 
>> Olivier./.
>> 
> 

Re: [mailcore] CTCoreMessage's sequenceNumber = 0

From:
Olivier Pallière
Date:
2012-10-09 @ 10:01
I added it to the messageWithUID method. 

Olivier./.

On Oct 9, 2012, at 11:57 AM, Olivier Palliere <olivier@molowa.com> wrote:

> hi Matt,
> 
> Actually, I added those lines in CTCoreFolder.m
> 
>     CTCoreMessage *msg = [[[CTCoreMessage alloc] 
initWithMessageStruct:msgStruct] autorelease];
> 
>     NSUInteger seq;
> 
>     if ([self sequenceNumberForUID:uid sequenceNumber:&seq])
>         msg.sequenceNumber = seq;
>     
>     msg.parentFolder = self;
>     return msg;
> 
> Calling 
> 
> - (BOOL)sequenceNumberForUID:(NSUInteger)uid sequenceNumber:(NSUInteger 
*)sequenceNumber
> 
> from self. And I have my sequenceNumber filled in when I sue the 
message. Working great although I never noticed that method before in 
CTCoreFolder.h ;-)
> 
> I'd love to push the code but I don't know how to be honest.
> 
> Olivier./.
> 
> 
> On Oct 9, 2012, at 4:13 AM, Matt Ronge <mronge@mronge.com> wrote:
> 
> Hi!
> 
> I dug into the code a bit and the problem is that [msg 
setSequenceNumber:num] isn't called when using - (CTCoreMessage 
*)messageWithUID:(NSUInteger)uid; 
> 
> On the other hand messagesFromSequenceNumber:to:withFetchAttributes: 
DOES call [msg setSequenceNumber:num] so it works properly. I tried to fix
it but I couldn't figure out where to grab the sequence number inside 
messageWithUID:
> 
> It may be easier to switch rfc822 to use uid instead?
> 
> Matt 
> 
> On Oct 3, 2012, at 3:55 AM, Olivier Palliere <olivier@molowa.com> wrote:
> 
> Hi Guys, 
> 
> I have a problem trying to gather the rfc822 of a message in a particular case.
> 
> As I said before, during scanning, I can get the rfc822 by querying the 
CTCoreMessage object, which in turn goes to libetpan and does a  
> 
> r = mailimap_fetch(session, set, fetch_type, &fetch_list);
> 
> The set being populated with the message's sequence number. During this 
scan pha se, wh ere I get all the CTCoreMessage objects using this:
> 
> - (NSArray *)messagesFromSequenceNumber:(NSUInteger)startNum 
to:(NSUInteger)endNum withFetchAttributes:(CTFetchAttributes)attrs;
> 
> 
> I have a valid value set for sequenceNumber, and can thus use it to 
retrieve the right message.
> 
> But when I'm using CTCoreFolder's
> 
> - (CTCoreMessage *)messageWithUID:(NSUInteger)uid;
> 
> The sequenceNumber of the CTCore object is always 0, hence a rfc822 
messages does that to the server:
> 
> FETCH * RFC822.text
> * 75 FETCH (RFC822.TEXT {76835}...)
> 
> And queries the last message in the mailbox.
> 
> I can modify the call to use the uid instead of the sequenceNumber, but 
I assume it should work fine with the sequenceNumber in all situations.
> 
> Any idea why that could be?
> 
> If I find anything, I'll report back to you.
> 
> Olivier./.
> 
> 
> 

Re: [mailcore] CTCoreMessage's sequenceNumber = 0

From:
Matt Ronge
Date:
2012-10-09 @ 15:02
Nice!

I'm glad that is working for you. 

However I'm hesitant to merge that into messageWithUID: because 
sequenceNumberForUID:sequenceNumber: introduces another roundtrip to the 
server and I want to keep messageWithUID: fast as possible.

I'll let you know if I find a way to skip the 
sequenceNumberForUID:sequenceNumber: 

Sorry about this bug :)

Matt


On Oct 9, 2012, at 5:01 AM, "Olivier Pallière" <olivier@molowa.com> wrote:

> I added it to the messageWithUID method. 
> 
> Olivier./.
> 
> On Oct 9, 2012, at 11:57 AM, Olivier Palliere <olivier@molowa.com> wrote:
> 
>> hi Matt,
>> 
>> Actually, I added those lines in CTCoreFolder.m
>> 
>>     CTCoreMessage *msg = [[[CTCoreMessage alloc] 
initWithMessageStruct:msgStruct] autorelease];
>>     NSUInteger seq;
>> 
>>     if ([self sequenceNumberForUID:uid sequenceNumber:&seq])
>>         msg.sequenceNumber = seq;
>>     
>>     msg.parentFolder = self;
>>     return msg;
>> 
>> Calling 
>> 
>> - (BOOL)sequenceNumberForUID:(NSUInteger)uid sequenceNumber:(NSUInteger
*)sequenceNumber
>> 
>> from self. And I have my sequenceNumber filled in when I sue the 
message. Working great although I never noticed that method before in 
CTCoreFolder.h ;-)
>> 
>> I'd love to push the code but I don't know how to be honest.
>> 
>> Olivier./.
>> 
>> 
>> On Oct 9, 2012, at 4:13 AM, Matt Ronge <mronge@mronge.com> wrote:
>> 
>> Hi!
>> 
>> I dug into the code a bit and the problem is that [msg 
setSequenceNumber:num] isn't called when using - (CTCoreMessage 
*)messageWithUID:(NSUInteger)uid; 
>> 
>> On the other hand messagesFromSequenceNumber:to:withFetchAttributes: 
DOES call [msg setSequenceNumber:num] so it works properly. I tried to fix
it but I couldn't figure out where to grab the sequence number inside 
messageWithUID:
>> 
>> It may be easier to switch rfc822 to use uid instead?
>> 
>> Matt 
>> 
>> On Oct 3, 2012, at 3:55 AM, Olivier Palliere <olivier@molowa.com> wrote:
>> 
>> Hi Guys, 
>> 
>> I have a problem trying to gather the rfc822 of a message in a particular case.
>> 
>> As I said before, during scanning, I can get the rfc822 by querying the
CTCoreMessage object, which in turn goes to libetpan and does a  
>> 
>> r = mailimap_fetch(session, set, fetch_type, &fetch_list);
>> 
>> The set being populated with the message's sequence number. During this
scan pha se, wh ere I get all the CTCoreMessage objects using this:
>> 
>> - (NSArray *)messagesFromSequenceNumber:(NSUInteger)startNum 
to:(NSUInteger)endNum withFetchAttributes:(CTFetchAttributes)attrs;
>> 
>> 
>> I have a valid value set for sequenceNumber, and can thus use it to 
retrieve the right message.
>> 
>> But when I'm using CTCoreFolder's
>> 
>> - (CTCoreMessage *)messageWithUID:(NSUInteger)uid;
>> 
>> The sequenceNumber of the CTCore object is always 0, hence a rfc822 
messages does that to the server:
>> 
>> FETCH * RFC822.text
>> * 75 FETCH (RFC822.TEXT {76835}...)
>> 
>> And queries the last message in the mailbox.
>> 
>> I can modify the call to use the uid instead of the sequenceNumber, but
I assume it should work fine with the sequenceNumber in all situations.
>> 
>> Any idea why that could be?
>> 
>> If I find anything, I'll report back to you.
>> 
>> Olivier./.
>> 
>> 
>> 

Re: [mailcore] CTCoreMessage's sequenceNumber = 0

From:
Olivier Pallière
Date:
2012-10-09 @ 16:39
Oh come on Matt!! 

I don't think you need to be sorry after the work you did!

I'll see if I can help rather!

And thank you!
Olivier./.

On Oct 9, 2012, at 5:02 PM, Matt Ronge <mronge@mronge.com> wrote:

> Nice!
> 
> I'm glad that is working for you. 
> 
> However I'm hesitant to merge that into messageWithUID: because 
sequenceNumberForUID:sequenceNumber: introduces another roundtrip to the 
server and I want to keep messageWithUID: fast as possible.
> 
> I'll let you know if I find a way to skip the 
sequenceNumberForUID:sequenceNumber: 
> 
> Sorry about this bug :)
> 
> Matt
> 
> 
> On Oct 9, 2012, at 5:01 AM, "Olivier Pallière" <olivier@molowa.com> wrote:
> 
>> I added it to the messageWithUID method. 
>> 
>> Olivier./.
>> 
>> On Oct 9, 2012, at 11:57 AM, Olivier Palliere <olivier@molowa.com> wrote:
>> 
>>> hi Matt,
>>> 
>>> Actually, I added those lines in CTCoreFolder.m
>>> 
>>>    CTCoreMessage *msg = [[[CTCoreMessage alloc] 
initWithMessageStruct:msgStruct] autorelease];
>>>    NSUInteger seq;
>>> 
>>>    if ([self sequenceNumberForUID:uid sequenceNumber:&seq])
>>>        msg.sequenceNumber = seq;
>>> 
>>>    msg.parentFolder = self;
>>>    return msg;
>>> 
>>> Calling 
>>> 
>>> - (BOOL)sequenceNumberForUID:(NSUInteger)uid 
sequenceNumber:(NSUInteger *)sequenceNumber
>>> 
>>> from self. And I have my sequenceNumber filled in when I sue the 
message. Working great although I never noticed that method before in 
CTCoreFolder.h ;-)
>>> 
>>> I'd love to push the code but I don't know how to be honest.
>>> 
>>> Olivier./.
>>> 
>>> 
>>> On Oct 9, 2012, at 4:13 AM, Matt Ronge <mronge@mronge.com> wrote:
>>> 
>>> Hi!
>>> 
>>> I dug into the code a bit and the problem is that [msg 
setSequenceNumber:num] isn't called when using - (CTCoreMessage 
*)messageWithUID:(NSUInteger)uid; 
>>> 
>>> On the other hand messagesFromSequenceNumber:to:withFetchAttributes: 
DOES call [msg setSequenceNumber:num] so it works properly. I tried to fix
it but I couldn't figure out where to grab the sequence number inside 
messageWithUID:
>>> 
>>> It may be easier to switch rfc822 to use uid instead?
>>> 
>>> Matt 
>>> 
>>> On Oct 3, 2012, at 3:55 AM, Olivier Palliere <olivier@molowa.com> wrote:
>>> 
>>> Hi Guys, 
>>> 
>>> I have a problem trying to gather the rfc822 of a message in a 
particular case.
>>> 
>>> As I said before, during scanning, I can get the rfc822 by querying 
the CTCoreMessage object, which in turn goes to libetpan and does a  
>>> 
>>> r = mailimap_fetch(session, set, fetch_type, &fetch_list);
>>> 
>>> The set being populated with the message's sequence number. During 
this scan pha se, wh ere I get all the CTCoreMessage objects using this:
>>> 
>>> - (NSArray *)messagesFromSequenceNumber:(NSUInteger)startNum 
to:(NSUInteger)endNum withFetchAttributes:(CTFetchAttributes)attrs;
>>> 
>>> 
>>> I have a valid value set for sequenceNumber, and can thus use it to 
retrieve the right message.
>>> 
>>> But when I'm using CTCoreFolder's
>>> 
>>> - (CTCoreMessage *)messageWithUID:(NSUInteger)uid;
>>> 
>>> The sequenceNumber of the CTCore object is always 0, hence a rfc822 
messages does that to the server:
>>> 
>>> FETCH * RFC822.text
>>> * 75 FETCH (RFC822.TEXT {76835}...)
>>> 
>>> And queries the last message in the mailbox.
>>> 
>>> I can modify the call to use the uid instead of the sequenceNumber, 
but I assume it should work fine with the sequenceNumber in all 
situations.
>>> 
>>> Any idea why that could be?
>>> 
>>> If I find anything, I'll report back to you.
>>> 
>>> Olivier./.
>