Diffstat (limited to 'noncore/net/mail/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index b437df0..f1d42c2 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp | |||
@@ -933,4 +933,44 @@ int IMAPwrapper::deleteMbox(const Folder*folder) | |||
933 | return 0; | 933 | return 0; |
934 | } | 934 | } |
935 | return 1; | 935 | return 1; |
936 | } | 936 | } |
937 | |||
938 | void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | ||
939 | { | ||
940 | mailimap_status_att_list * att_list =0; | ||
941 | mailimap_mailbox_data_status * status=0; | ||
942 | clistiter * cur = 0; | ||
943 | int r = 0; | ||
944 | int res = 0; | ||
945 | target_stat.message_count = 0; | ||
946 | target_stat.message_unseen = 0; | ||
947 | target_stat.message_recent = 0; | ||
948 | login(); | ||
949 | if (!m_imap) { | ||
950 | return; | ||
951 | } | ||
952 | att_list = mailimap_status_att_list_new_empty(); | ||
953 | if (!att_list) return; | ||
954 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_MESSAGES); | ||
955 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_RECENT); | ||
956 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN); | ||
957 | r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status); | ||
958 | for (cur = clist_begin(status->st_info_list); | ||
959 | cur != NULL ; cur = clist_next(cur)) { | ||
960 | mailimap_status_info * status_info; | ||
961 | status_info = (mailimap_status_info *)clist_content(cur); | ||
962 | switch (status_info->st_att) { | ||
963 | case MAILIMAP_STATUS_ATT_MESSAGES: | ||
964 | target_stat.message_count = status_info->st_value; | ||
965 | break; | ||
966 | case MAILIMAP_STATUS_ATT_RECENT: | ||
967 | target_stat.message_recent = status_info->st_value; | ||
968 | break; | ||
969 | case MAILIMAP_STATUS_ATT_UNSEEN: | ||
970 | target_stat.message_unseen = status_info->st_value; | ||
971 | break; | ||
972 | } | ||
973 | } | ||
974 | mailimap_mailbox_data_status_free(status); | ||
975 | mailimap_status_att_list_free(att_list); | ||
976 | } | ||