Commit cb40122c cb40122c2443232bfdbaa41d51998c2c3cde6168 by Sergey Poznyakoff

added attribute_set_modified() function. Fixed attribute_unset.* functions to ra…

…ise MU_ATTRIBUTE_MODIFIED bit.
1 parent 27c42053
...@@ -82,6 +82,18 @@ attribute_clear_modified (attribute_t attr) ...@@ -82,6 +82,18 @@ attribute_clear_modified (attribute_t attr)
82 } 82 }
83 83
84 int 84 int
85 attribute_set_modified (attribute_t attr)
86 {
87 int status;
88 if (!attr)
89 return EINVAL;
90 if (attr->_set_flags)
91 status = attr->_set_flags (attr, MU_ATTRIBUTE_MODIFIED);
92 attr->flags |= MU_ATTRIBUTE_MODIFIED;
93 return status;
94 }
95
96 int
85 attribute_get_flags (attribute_t attr, int *pflags) 97 attribute_get_flags (attribute_t attr, int *pflags)
86 { 98 {
87 if (attr == NULL) 99 if (attr == NULL)
...@@ -352,6 +364,7 @@ attribute_unset_seen (attribute_t attr) ...@@ -352,6 +364,7 @@ attribute_unset_seen (attribute_t attr)
352 if (attr->_unset_flags) 364 if (attr->_unset_flags)
353 status = attr->_unset_flags (attr, MU_ATTRIBUTE_SEEN); 365 status = attr->_unset_flags (attr, MU_ATTRIBUTE_SEEN);
354 attr->flags &= ~MU_ATTRIBUTE_SEEN; 366 attr->flags &= ~MU_ATTRIBUTE_SEEN;
367 attribute_set_modified (attr);
355 return status; 368 return status;
356 } 369 }
357 370
...@@ -364,6 +377,7 @@ attribute_unset_answered (attribute_t attr) ...@@ -364,6 +377,7 @@ attribute_unset_answered (attribute_t attr)
364 if (attr->_unset_flags) 377 if (attr->_unset_flags)
365 status = attr->_unset_flags (attr, MU_ATTRIBUTE_ANSWERED); 378 status = attr->_unset_flags (attr, MU_ATTRIBUTE_ANSWERED);
366 attr->flags &= ~MU_ATTRIBUTE_ANSWERED; 379 attr->flags &= ~MU_ATTRIBUTE_ANSWERED;
380 attribute_set_modified (attr);
367 return status; 381 return status;
368 } 382 }
369 383
...@@ -376,6 +390,7 @@ attribute_unset_flagged (attribute_t attr) ...@@ -376,6 +390,7 @@ attribute_unset_flagged (attribute_t attr)
376 if (attr->_unset_flags) 390 if (attr->_unset_flags)
377 status = attr->_unset_flags (attr, MU_ATTRIBUTE_FLAGGED); 391 status = attr->_unset_flags (attr, MU_ATTRIBUTE_FLAGGED);
378 attr->flags &= ~MU_ATTRIBUTE_FLAGGED; 392 attr->flags &= ~MU_ATTRIBUTE_FLAGGED;
393 attribute_set_modified (attr);
379 return status; 394 return status;
380 } 395 }
381 396
...@@ -388,6 +403,7 @@ attribute_unset_read (attribute_t attr) ...@@ -388,6 +403,7 @@ attribute_unset_read (attribute_t attr)
388 if (attr->_unset_flags) 403 if (attr->_unset_flags)
389 status = attr->_unset_flags (attr, MU_ATTRIBUTE_READ); 404 status = attr->_unset_flags (attr, MU_ATTRIBUTE_READ);
390 attr->flags &= ~MU_ATTRIBUTE_READ; 405 attr->flags &= ~MU_ATTRIBUTE_READ;
406 attribute_set_modified (attr);
391 return status; 407 return status;
392 } 408 }
393 409
...@@ -400,6 +416,7 @@ attribute_unset_deleted (attribute_t attr) ...@@ -400,6 +416,7 @@ attribute_unset_deleted (attribute_t attr)
400 if (attr->_unset_flags) 416 if (attr->_unset_flags)
401 status = attr->_unset_flags (attr, MU_ATTRIBUTE_DELETED); 417 status = attr->_unset_flags (attr, MU_ATTRIBUTE_DELETED);
402 attr->flags &= ~MU_ATTRIBUTE_DELETED; 418 attr->flags &= ~MU_ATTRIBUTE_DELETED;
419 attribute_set_modified (attr);
403 return status; 420 return status;
404 } 421 }
405 422
...@@ -412,6 +429,7 @@ attribute_unset_draft (attribute_t attr) ...@@ -412,6 +429,7 @@ attribute_unset_draft (attribute_t attr)
412 if (attr->_unset_flags) 429 if (attr->_unset_flags)
413 status = attr->_unset_flags (attr, MU_ATTRIBUTE_DRAFT); 430 status = attr->_unset_flags (attr, MU_ATTRIBUTE_DRAFT);
414 attr->flags &= ~MU_ATTRIBUTE_DRAFT; 431 attr->flags &= ~MU_ATTRIBUTE_DRAFT;
432 attribute_set_modified (attr);
415 return status; 433 return status;
416 } 434 }
417 435
...@@ -424,6 +442,7 @@ attribute_unset_recent (attribute_t attr) ...@@ -424,6 +442,7 @@ attribute_unset_recent (attribute_t attr)
424 if (attr->_unset_flags) 442 if (attr->_unset_flags)
425 status = attr->_unset_flags (attr, MU_ATTRIBUTE_SEEN); 443 status = attr->_unset_flags (attr, MU_ATTRIBUTE_SEEN);
426 attr->flags |= MU_ATTRIBUTE_SEEN; 444 attr->flags |= MU_ATTRIBUTE_SEEN;
445 attribute_set_modified (attr);
427 return status; 446 return status;
428 } 447 }
429 448
......