MCPcopy Create free account
hub / github.com/MailCore/mailcore2 / select

Method select

src/core/imap/MCIMAPSession.cpp:1142–1206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1140}
1141
1142void IMAPSession::select(String * folder, ErrorCode * pError)
1143{
1144 int r;
1145
1146 MCLog("select");
1147 MCAssert(mState == STATE_LOGGEDIN || mState == STATE_SELECTED);
1148
1149 r = mailimap_select(mImap, MCUTF8(folder));
1150 MCLog("select error : %i", r);
1151 if (r == MAILIMAP_ERROR_STREAM) {
1152 mShouldDisconnect = true;
1153 * pError = ErrorConnection;
1154 MCLog("select error : %s %i", MCUTF8DESC(this), * pError);
1155 return;
1156 }
1157 else if (r == MAILIMAP_ERROR_PARSE) {
1158 mShouldDisconnect = true;
1159 * pError = ErrorParse;
1160 return;
1161 }
1162 else if (hasError(r)) {
1163 * pError = ErrorNonExistantFolder;
1164 mState = STATE_LOGGEDIN;
1165 MC_SAFE_RELEASE(mCurrentFolder);
1166 return;
1167 }
1168
1169 MC_SAFE_REPLACE_COPY(String, mCurrentFolder, folder);
1170
1171 if (mImap->imap_selection_info != NULL) {
1172 mUIDValidity = mImap->imap_selection_info->sel_uidvalidity;
1173 mUIDNext = mImap->imap_selection_info->sel_uidnext;
1174 if (mImap->imap_selection_info->sel_has_exists) {
1175 mFolderMsgCount = (unsigned int) (mImap->imap_selection_info->sel_exists);
1176 } else {
1177 mFolderMsgCount = -1;
1178 }
1179
1180 if (mImap->imap_selection_info->sel_first_unseen) {
1181 mFirstUnseenUid = mImap->imap_selection_info->sel_first_unseen;
1182 } else {
1183 mFirstUnseenUid = 0;
1184 }
1185
1186 if (mImap->imap_selection_info->sel_perm_flags) {
1187 clistiter * cur;
1188
1189 struct mailimap_flag_perm * perm_flag;
1190 for(cur = clist_end(mImap->imap_selection_info->sel_perm_flags) ; cur != NULL ;
1191 cur = clist_previous(cur)) {
1192 perm_flag = (struct mailimap_flag_perm *)clist_content(cur);
1193 mAllowsNewPermanentFlags = perm_flag->fl_type == MAILIMAP_FLAG_PERM_ALL;
1194 if (mAllowsNewPermanentFlags) {
1195 break;
1196 }
1197 }
1198 }
1199

Callers 1

mainMethod · 0.80

Calls 2

hasErrorFunction · 0.85
get_mod_sequence_valueFunction · 0.85

Tested by

no test coverage detected