While investigating appointments, I noticed that they get dumped twice:

$ openchangeclient --fetch-items=Appointment
MAILBOX (2 messages)
|==  ==| : 1D00000000000001/34CB000000000001
        Location: new york
        Start time     :   Thu May 23 06:30:00 2013 EST
        End time       :   Thu May 23 07:30:00 2013 EST
        Timezone: (GMT-08:00) Pacific Time (US & Canada)
        Private: False
        Status: Completed
|==  ==| : 1D00000000000001/33CB000000000001
        Location: washington dc
        Start time     :   Thu May 23 06:30:00 2013 EST
        End time       :   Thu May 23 07:30:00 2013 EST
        Timezone: (GMT-08:00) Pacific Time (US & Canada)
        Private: False
        Status: Completed
|==  ==| : 1D00000000000001/34CB000000000001
        Location: new york
        Start time     :   Thu May 23 06:30:00 2013 EST
        End time       :   Thu May 23 07:30:00 2013 EST
        Timezone: (GMT-08:00) Pacific Time (US & Canada)
        Private: False
        Status: Completed
|==  ==| : 1D00000000000001/33CB000000000001
        Location: washington dc
        Start time     :   Thu May 23 06:30:00 2013 EST
        End time       :   Thu May 23 07:30:00 2013 EST
        Timezone: (GMT-08:00) Pacific Time (US & Canada)
        Private: False
        Status: Completed

It looks like we're doing the comparison incorrectly. The "count" variable represents the number of messages still to be output, so
we should compare to that.

The patch below also includes a formatting fix - that is trivial though.

diff --git a/utils/openchangeclient.c b/utils/openchangeclient.c
index a284ed2..2bbe3cd 100644
--- a/utils/openchangeclient.c
+++ b/utils/openchangeclient.c
@@ -1816,7 +1816,7 @@ static bool openchangeclient_fetchitems(TALLOC_CTX 
*mem_ctx, mapi_object_t *obj_
        MAPIFreeBuffer(SPropTagArray);
        if (retval != MAPI_E_SUCCESS) return false;

-       while ((retval = QueryRows(&obj_table, count, TBL_ADVANCE, &SRowSet)) != 
MAPI_E_NOT_FOUND && SRowSet.cRows) {
+       while ((retval = QueryRows(&obj_table, count, TBL_ADVANCE, &SRowSet)) != 
MAPI_E_NOT_FOUND && count) {
                count -= SRowSet.cRows;
                for (i = 0; i < SRowSet.cRows; i++) {
                        mapi_object_init(&obj_message);
@@ -1837,7 +1837,7 @@ static bool openchangeclient_fetchitems(TALLOC_CTX 
*mem_ctx, mapi_object_t *obj_
                                                                            
&properties_array);
                                                switch (olFolder) {
                                                case olFolderInbox:
-                                                 
mapidump_message(&properties_array, id, NULL);
+                                                       
mapidump_message(&properties_array, id, NULL);
                                                        break;
                                                case olFolderCalendar:
                                                        
mapidump_appointment(&properties_array, id);

Does this look OK? If so, please apply.

Brad
_______________________________________________
devel mailing list
[email protected]
http://mailman.openchange.org/listinfo/devel

Reply via email to