Re: libcyrus and the imap proto
On Thu, Feb 27, 2003 at 07:01:28PM +, Patrick Welche wrote: On Thu, Feb 27, 2003 at 09:53:57AM -0500, John Alton Tamplin wrote: Patrick Welche wrote: ... same for eg . fetch 1 (internaldate) * 1 FETCH (INTERNALDATE 30-Jan-2003 19:23:41 +) . OK Completed How can I see the result of fetch? I have not used the C library, but the perl interface is similar so I suspect this approach will work for you. What I did was add a callback with an empty string for a trigger. The callback gets called on every line, and you can parse it as you please. ... Great idea - I kept thinking 14 RECENT was keyword RECENT.. but evidently not.. imclient_addcallback(imp, , /* keyword */ NULL, /* flags */ callback_all, /* proc*/ NULL, /* rock*/ NULL); did the trick. Incidentally, I didn't receive the messages if I set the CALLBACK_NOLITERAL flag. What does it do? (I thought it meant don't use eg. {42} followed by 42 characters, but in eg. 14 RECENT, no literal is used, yet I didn't see those messages either) Even better, the solution is: imclient_addcallback(fromimp, RECENT, /* keyword */ CALLBACK_NUMBERED,/* flags */ callback_recent, /* proc*/ curmbox, /* rock*/ NULL); in other words, RECENT returns a mesg number, that's why it didn't match the keyword withouth the CALL_NUMBERED flag.. Cheers, Patrick
libcyrus and the imap proto
Overall I see that you send commands to the imap server using imclient_send, the last argument of which is essentially the text of the imap command. You register callbacks based on keyword, so that when the server sends you a reply, the function registered gets called. I suspect I am getting confused between tagged and untagged. The following is fine, and I think that . capability - sent with imclient_send * CAPABILITY IMAP4 IMAP4rev1 ... - untagged? capability response picked up by callback based on keyword CAPABILITY . OK Completed - tagged? ok response picked up by imclient_send's finishproc but now for the problem . examine inbox- sent with imclient_send * FLAGS (\Answered \Flagged ...- untaged flags response, callback_flags * OK [PERMANENTFLAGS ()] - untagged ok response, callback_ok * 13 EXISTS * What about these two? * 1 RECENT * untagged responses with no keyword? * OK [UNSEEN 13] - untagged ok response, callback_ok * OK [UIDVALIDITY 1043953684] - untagged ok response, callback_ok * OK [UIDNEXT 15] - untagged ok response, callback_ok . OK [READ-ONLY] Completed - tagged? ok response picked up by imclient_send's finishproc same for eg . fetch 1 (internaldate) * 1 FETCH (INTERNALDATE 30-Jan-2003 19:23:41 +) . OK Completed How can I see the result of fetch? Cheers, Patrick
Re: libcyrus and the imap proto
Patrick Welche wrote: Overall I see that you send commands to the imap server using imclient_send, the last argument of which is essentially the text of the imap command. You register callbacks based on keyword, so that when the server sends you a reply, the function registered gets called. I suspect I am getting confused between tagged and untagged. The following is fine, and I think that . capability - sent with imclient_send * CAPABILITY IMAP4 IMAP4rev1 ... - untagged? capability response picked up by callback based on keyword CAPABILITY . OK Completed - tagged? ok response picked up by imclient_send's finishproc but now for the problem . examine inbox- sent with imclient_send * FLAGS (\Answered \Flagged ...- untaged flags response, callback_flags * OK [PERMANENTFLAGS ()] - untagged ok response, callback_ok * 13 EXISTS * What about these two? * 1 RECENT * untagged responses with no keyword? * OK [UNSEEN 13] - untagged ok response, callback_ok * OK [UIDVALIDITY 1043953684] - untagged ok response, callback_ok * OK [UIDNEXT 15] - untagged ok response, callback_ok . OK [READ-ONLY] Completed - tagged? ok response picked up by imclient_send's finishproc same for eg . fetch 1 (internaldate) * 1 FETCH (INTERNALDATE 30-Jan-2003 19:23:41 +) . OK Completed How can I see the result of fetch? I have not used the C library, but the perl interface is similar so I suspect this approach will work for you. What I did was add a callback with an empty string for a trigger. The callback gets called on every line, and you can parse it as you please. $imap-addcallback({-trigger='',-callback=sub { my [EMAIL PROTECTED]; if($a{-text}=~ /RFC822\.SIZE\s+(\d+)/i) { $totmsg++; $totbytes+=$1; if($110) { $largemsg++; $largebytes+=$1; } $largest=$1 if($1$largest); } }}); ($rc,$text)=$imap-send('','','FETCH 1:* RFC822.SIZE',$mbx); -- John A. Tamplin Unix System Administrator Emory University, School of Public Health +1 404/727-9931
Re: libcyrus and the imap proto
On Thu, Feb 27, 2003 at 09:53:57AM -0500, John Alton Tamplin wrote: Patrick Welche wrote: ... same for eg . fetch 1 (internaldate) * 1 FETCH (INTERNALDATE 30-Jan-2003 19:23:41 +) . OK Completed How can I see the result of fetch? I have not used the C library, but the perl interface is similar so I suspect this approach will work for you. What I did was add a callback with an empty string for a trigger. The callback gets called on every line, and you can parse it as you please. ... Great idea - I kept thinking 14 RECENT was keyword RECENT.. but evidently not.. imclient_addcallback(imp, , /* keyword */ NULL, /* flags */ callback_all, /* proc*/ NULL, /* rock*/ NULL); did the trick. Incidentally, I didn't receive the messages if I set the CALLBACK_NOLITERAL flag. What does it do? (I thought it meant don't use eg. {42} followed by 42 characters, but in eg. 14 RECENT, no literal is used, yet I didn't see those messages either) Cheers, Patrick