using imclient

Patrick Radtke phr2101 at columbia.edu
Mon Mar 21 13:03:28 EST 2005


On Mar 17, 2005, at 1:21 PM, Patrick Welche wrote:

> On Wed, Mar 16, 2005 at 04:04:48PM -0500, Patrick Radtke wrote:
>> I'll add a little code sample
>>
>> // server returns NO on an error
>> imclient_addcallback(imclient, "NO",
>> 		       CALLBACK_NOLITERAL,
>> 		       callback_error,
>> 		       &error_string,
>> 		       NULL);
>>
>>  nc =1;
>>   imclient_send(imclient,end_command,(void*) &nc,"create
>> \"user/bigtestuser3\"");
>>  while(nc > 0) {
>>     imclient_processoneevent(imclient);
>>       }
>> cout << "create data is " << error_string << endl;
>>
>>
>> So bigtestuser3 already exists. So I would expect the imap server to
>> return 'NO Mailbox already exists'.
>> So I add a callback on the keyword 'NO', but it never gets called. Are
>> there other settings I need to use on the callback?
>
> Just experimenting, you could try CALLBACK_NUMBERED instead of
> CALLBACK_NOLITERAL, or just NULL, and you could even use "" instead
> of "NO" at least to start by catching all responses..
>
> Cheers,
>
> Patrick
>

I tried various combinations of CALLBACK_NUMBERED, NULL, "" and NO and 
did not have any luck.

I tried making things as simple as possible.

static void callback_generic(struct imclient *imclient,
			   void *rock,
			   struct imclient_reply *reply) {
   cout << "in gerneric callback " << endl;
   cout << "\tKeyword: " << reply->keyword << endl
        << "\tMsgno: " << reply->msgno << endl
        << "\tText: " << reply->text << endl << endl;

}


then in main

  imclient_addcallback(imclient,
		       "",		/*also tried NO */
		       NULL,   /*also tried  CALLBACK_NUMBERED*/
		       callback_generic,
		       &msg_string,
		       NULL);


   nc =1;
   imclient_send(imclient,end_command,(void*) &nc,"create 
\"user/bigtestuser10\"");

   while(nc > 0) {
     imclient_processoneevent(imclient);
   }


and I've tried both setting and not setting (my server supports 
LITERAL+)
  imclient_setflags(imclient, IMCLIENT_CONN_NONSYNCLITERAL);


Is there some other step that must be performed?
Things like getquota, getacl work fine.

 From reading through 'man imclient' and the Imap V4 rev 1 RFC, it 
appears that  imclient_addcallback is only good for untagged data 
response from the server.
While the response I am trying to detect (OK, NO) is a tagged response. 
Does anyone know how to process a tagged response with imclient?

-Patrick

---
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html




More information about the Info-cyrus mailing list