Changeset 2224
- Timestamp:
- 06/19/07 16:29:37
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-msg-header.c (modified) (3 diffs)
- trunk/libtinymail-test/tny-header-test.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r2223 r2224 1 2007-06-19 Jose Dapena Paz <jdapena@igalia.com> 2 3 * libtinymail-camel/tny-camel-msg-header: 4 (tny_camel_msg_header_get_flags): added implementation 5 that obtains the priority flags using the headers 6 we set in our set/unset methods. 7 (tny_camel_msg_header_set_flags, tny_camel_msg_header_set_flags): 8 fixed the check for only allowing priority flags to be set or 9 unset. 10 11 * libtinymail-tests/tny-header-test.c: added unit test for 12 priority flags in camel msg header. 13 1 14 2007-06-19 Murray Cumming <murrayc@murrayc.com> 2 15 trunk/libtinymail-camel/tny-camel-msg-header.c
r2101 r2224 184 184 tny_camel_msg_header_get_flags (TnyHeader *self) 185 185 { 186 g_warning ("tny_header_get_flags: This is a header instance for a new message. It has no flags.\n"); 187 return 0; 186 187 TnyHeaderPriorityFlags priority_flags; 188 TnyCamelMsgHeader *me = TNY_CAMEL_MSG_HEADER (self); 189 const gchar *priority_string = NULL; 190 191 priority_string = camel_medium_get_header (CAMEL_MEDIUM (me->msg), "X-Priority"); 192 if (priority_string == NULL) 193 return 0; 194 if (g_strrstr (priority_string, "1") != NULL) 195 return TNY_HEADER_FLAG_HIGH_PRIORITY; 196 else if (g_strrstr (priority_string, "3") != NULL) 197 return TNY_HEADER_FLAG_LOW_PRIORITY; 198 else 199 return TNY_HEADER_FLAG_NORMAL_PRIORITY; 188 200 } 189 201 … … 194 206 TnyCamelMsgHeader *me = TNY_CAMEL_MSG_HEADER (self); 195 207 196 if (mask ^ TNY_HEADER_FLAG_PRIORITY) {208 if (mask & (~TNY_HEADER_FLAG_PRIORITY)) { 197 209 g_warning ("tny_header_set_flags: This is a header instance for a new message. Non-priority flags are not supported.\n"); 198 210 return; … … 226 238 TnyCamelMsgHeader *me = TNY_CAMEL_MSG_HEADER (self); 227 239 228 if (mask ^ TNY_HEADER_FLAG_PRIORITY) {240 if (mask & (~TNY_HEADER_FLAG_PRIORITY)) { 229 241 g_warning ("tny_header_set_flags: This is a header instance for a new message. Non-priority flags are not supported.\n"); 230 242 return; trunk/libtinymail-test/tny-header-test.c
r2029 r2224 143 143 END_TEST 144 144 145 START_TEST (tny_header_test_set_priority_flags) 146 { 147 TnyHeaderFlags flags; 148 149 tny_header_set_flags (iface, TNY_HEADER_FLAG_HIGH_PRIORITY); 150 flags = tny_header_get_flags (iface); 151 fail_unless (flags == TNY_HEADER_FLAG_HIGH_PRIORITY, "Unable to set high priority.\n"); 152 153 tny_header_unset_flags (iface, TNY_HEADER_FLAG_PRIORITY); 154 flags = tny_header_get_flags (iface); 155 fail_unless (flags == 0, "Unable to unset priority"); 156 157 tny_header_set_flags (iface, TNY_HEADER_FLAG_LOW_PRIORITY); 158 flags = tny_header_get_flags (iface); 159 fail_unless (flags == TNY_HEADER_FLAG_LOW_PRIORITY, "Unable to set low priority.\n"); 160 161 return; 162 } 163 END_TEST 164 145 165 Suite * 146 166 create_tny_header_suite (void) … … 179 199 suite_add_tcase (s, tc); 180 200 201 tc = tcase_create ("Set priority flags"); 202 tcase_add_checked_fixture (tc, tny_header_test_setup, tny_header_test_teardown); 203 tcase_add_test (tc, tny_header_test_set_priority_flags); 204 suite_add_tcase (s, tc); 205 181 206 return s; 182 207 }
