ckimap.h
来自「DES加密解密算法,西望大家共享.参考学习」· C头文件 代码 · 共 237 行
H
237 行
// CkImap.h: interface for the CkImap class.
//
//////////////////////////////////////////////////////////////////////
#ifndef _CKIMAP_H
#define _CKIMAP_H
#pragma once
class CkByteData;
#include "CkString.h"
class CkMailboxes;
class CkMessageSet;
class CkEmail;
class CkEmailBundle;
class CkStringArray;
class CkImapProgress;
class CkCert;
class CkPrivateKey;
#include "CkObject.h"
#undef Copy
/*
IMPORTANT: Objects returned by methods as non-const pointers must be deleted
by the calling application.
*/
// CLASS: CkImap
class CkImap : public CkObject
{
public:
CkImap();
virtual ~CkImap();
// BEGIN PUBLIC INTERFACE
bool get_Utf8(void) const;
void put_Utf8(bool b);
bool SetDecryptCert2(const CkCert &cert, CkPrivateKey &key);
bool Connect(const char *hostname);
bool Disconnect(void);
bool IsConnected(void);
bool Login(const char *login, const char *password);
bool Logout(void);
bool IsLoggedIn(void);
void get_LoggedInUser(CkString &str);
void get_ConnectedToHost(CkString &str);
bool CreateMailbox(const char *mailbox);
bool DeleteMailbox(const char *mailbox);
bool RenameMailbox(const char *fromMailbox, const char *toMailbox);
// Gets the last response returned by the IMAP server.
void LastResponse(CkString &str);
CkMailboxes *ListMailboxes(const char *reference, const char *wildcardedMailbox);
bool SelectMailbox(const char *mailbox); // Email flags are modified when full email is fetched.
bool ExamineMailbox(const char *mailbox); // Email flags are not modified, mailbox cannot be modified.
bool Subscribe(const char *mailbox);
bool Unsubscribe(const char *mailbox);
// Search for messages and return a message set of either UIDs (if bUid = true) or sequence numbers.
CkMessageSet *Search(const char *criteria, bool bUid);
CkMessageSet *GetAllUids(void);
CkEmail *FetchSingle(long msgId, bool bUid);
CkEmail *FetchSingleHeader(long msgId, bool bUid);
CkEmailBundle *FetchBundle(const CkMessageSet &messageSet);
CkEmailBundle *FetchHeaders(const CkMessageSet &messageSet);
CkEmailBundle *FetchChunk(int startSeqNum, int count, CkMessageSet &failedSet, CkMessageSet &fetchedSet);
CkStringArray *FetchSequenceAsMime(int startSeqNum, int count);
CkEmailBundle *FetchSequence(int startSeqNum, int numMessages);
CkEmailBundle *FetchSequenceHeaders(int startSeqNum, int numMessages);
bool FetchSingleAsMime(long msgId, bool bUid, CkString &strMime);
CkStringArray *FetchBundleAsMime(const CkMessageSet &messageSet);
bool Expunge(void);
bool ExpungeAndClose(void);
bool StoreFlags(long msgId, bool bUid, const char *flagName, long value);
bool FetchFlags(long msgId, bool bUid, CkString &strFlags);
bool SetFlag(long msgId, bool bUid, const char *flagName, long value);
bool SetFlags(const CkMessageSet &messageSet, const char *flagName, long value);
void get_AuthMethod(CkString &str);
void put_AuthMethod(const char *str);
char get_SeparatorChar(void);
void put_SeparatorChar(char c);
void get_Domain(CkString &str);
void put_Domain(const char *str);
int get_Port(void);
void put_Port(int port);
bool get_Ssl(void);
void put_Ssl(bool s);
void ClearSessionLog(void);
void get_SessionLog(CkString &str);
bool get_KeepSessionLog(void);
void put_KeepSessionLog(bool newVal);
void get_LastResponse(CkString &str);
void get_LastIntermediateResponse(CkString &str);
void get_LastCommand(CkString &str);
// These times are in milliseconds.
long get_HeartbeatMs(void);
void put_HeartbeatMs(long newVal);
bool AppendMime(const char *mailbox, const char *mimeText);
bool AppendMail(const char *mailbox, const CkEmail &email);
// Copy a message from the currently selected mailbox to a new mailbox.
bool Copy(long msgId, bool bUid, const char *copyToMailbox);
bool SetMailFlag(const CkEmail &email, const char *flagName, long value);
long GetMailFlag(const CkEmail &email, const char *flagName);
// Query the IMAP server get get up-to-date flag information.
bool RefetchMailFlags(CkEmail &emailInOut);
long get_NumMessages(void);
// When headers are downloaded, information about the email can be retrieved
// using these methods.
long GetMailSize(const CkEmail &email);
long GetMailNumAttach(const CkEmail &email);
long GetMailAttachSize(const CkEmail &email, long attachIndex);
bool GetMailAttachFilename(const CkEmail &email, long attachIndex, CkString &strFilename);
// Automatically decrypt and/or verify signatures (the default).
// Results of the "unwrapping" are available via the CkEmail object.
bool get_AutoUnwrapSecurity(void);
void put_AutoUnwrapSecurity(bool bUnwrap);
// When peek-mode is true, fetching entire emails will not affect
// the email flags, regardless of whether the mailbox was "selected"
// using SelectMailbox or "examined" with ExamineMailbox.
bool get_PeekMode(void);
void put_PeekMode(bool bPeek);
// If AppendSeen is true (the default), then AppendMail and AppendMime will append
// an email as already-seen, otherwise it will be initialized to "unseen".
bool get_AppendSeen(void);
void put_AppendSeen(bool alreadySeen);
// Error log retrieval and saving (these methods are common to all Chilkat VC++ classes.)
bool SaveLastError(const char *filename);
void LastErrorXml(CkString &str);
void LastErrorHtml(CkString &str);
void LastErrorText(CkString &str);
bool UnlockComponent(const char *unlockCode);
bool IsUnlocked(void) const;
// timeouts in seconds...
int get_ReadTimeout(void) const;
void put_ReadTimeout(int numSeconds);
int get_ConnectTimeout(void) const;
void put_ConnectTimeout(int numSeconds);
bool SendRawCommand(const char *rawCommand, CkString &rawResponse);
CkString m_resultString;
const char *lastErrorText(void);
const char *lastErrorXml(void);
const char *lastErrorHtml(void);
const char *getMailAttachFilename(const CkEmail &email, long attachIndex);
const char *fetchFlags(long msgId, bool bUid);
const char *authMethod(void);
const char *domain(void);
const char *fetchSingleAsMime(long msgId, bool bUid);
const char *loggedInUser(void);
const char *connectedToHost(void);
const char *sendRawCommand(const char *rawCommand);
const char *sessionLog(void);
const char *lastResponse(void);
const char *lastCommand(void);
const char *lastIntermediateResponse(void);
// END PUBLIC INTERFACE
// For internal use only.
private:
CkImapProgress *m_callback;
void *m_impl;
bool m_utf8; // If true, all input "const char *" parameters are utf-8, otherwise they are ANSI strings.
// Don't allow assignment or copying these objects.
CkImap(const CkImap &) { }
CkImap &operator=(const CkImap &) { return *this; }
CkImap(void *impl) : m_impl(impl) { }
//CkEmailBundle *FetchBundle(const CkMessageSet *messageSet) { return 0; }
CkEmailBundle *FetchHeaders(const CkMessageSet *messageSet) { return 0; }
CkEmailBundle *FetchChunk(int startSeqNum, int count, CkMessageSet *failedSet, CkMessageSet *fetchedSet) { return 0; }
CkStringArray *FetchBundleAsMime(const CkMessageSet *messageSet) { return 0; }
bool SetFlags(const CkMessageSet *messageSet, const char *flagName, long value) { return false; }
public:
void *getImpl(void) const { return m_impl; }
CkImapProgress *get_EventCallbackObject(void) const { return m_callback; }
void put_EventCallbackObject(CkImapProgress *progress) { m_callback = progress; }
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?