| 1210 | |
| 1211 | |
| 1212 | IMAPFolderStatus * IMAPSession::folderStatus(String * folder, ErrorCode * pError) |
| 1213 | { |
| 1214 | int r; |
| 1215 | |
| 1216 | MCLog("status"); |
| 1217 | MCAssert(mState == STATE_LOGGEDIN || mState == STATE_SELECTED); |
| 1218 | |
| 1219 | struct mailimap_mailbox_data_status * status; |
| 1220 | |
| 1221 | struct mailimap_status_att_list * status_att_list; |
| 1222 | |
| 1223 | status_att_list = mailimap_status_att_list_new_empty(); |
| 1224 | mailimap_status_att_list_add(status_att_list, MAILIMAP_STATUS_ATT_UNSEEN); |
| 1225 | mailimap_status_att_list_add(status_att_list, MAILIMAP_STATUS_ATT_MESSAGES); |
| 1226 | mailimap_status_att_list_add(status_att_list, MAILIMAP_STATUS_ATT_RECENT); |
| 1227 | mailimap_status_att_list_add(status_att_list, MAILIMAP_STATUS_ATT_UIDNEXT); |
| 1228 | mailimap_status_att_list_add(status_att_list, MAILIMAP_STATUS_ATT_UIDVALIDITY); |
| 1229 | if (mCondstoreEnabled || mXYMHighestModseqEnabled) { |
| 1230 | mailimap_status_att_list_add(status_att_list, MAILIMAP_STATUS_ATT_HIGHESTMODSEQ); |
| 1231 | } |
| 1232 | |
| 1233 | r = mailimap_status(mImap, MCUTF8(folder), status_att_list, &status); |
| 1234 | |
| 1235 | IMAPFolderStatus * fs; |
| 1236 | fs = new IMAPFolderStatus(); |
| 1237 | fs->autorelease(); |
| 1238 | |
| 1239 | MCLog("status error : %i", r); |
| 1240 | if (r == MAILIMAP_ERROR_STREAM) { |
| 1241 | mShouldDisconnect = true; |
| 1242 | * pError = ErrorConnection; |
| 1243 | MCLog("status error : %s %i", MCUTF8DESC(this), * pError); |
| 1244 | mailimap_status_att_list_free(status_att_list); |
| 1245 | return fs; |
| 1246 | } |
| 1247 | else if (r == MAILIMAP_ERROR_PARSE) { |
| 1248 | mShouldDisconnect = true; |
| 1249 | * pError = ErrorParse; |
| 1250 | mailimap_status_att_list_free(status_att_list); |
| 1251 | return fs; |
| 1252 | } |
| 1253 | else if (hasError(r)) { |
| 1254 | * pError = ErrorNonExistantFolder; |
| 1255 | mailimap_status_att_list_free(status_att_list); |
| 1256 | return fs; |
| 1257 | } |
| 1258 | |
| 1259 | clistiter * cur; |
| 1260 | |
| 1261 | |
| 1262 | if (status != NULL) { |
| 1263 | |
| 1264 | struct mailimap_status_info * status_info; |
| 1265 | for(cur = clist_begin(status->st_info_list) ; cur != NULL ; |
| 1266 | cur = clist_next(cur)) { |
| 1267 | |
| 1268 | status_info = (struct mailimap_status_info *) clist_content(cur); |
| 1269 |
no test coverage detected