PureBasic
PureBasic
Transition from Imap.Sort to Imap.QueryMbx
Provides instructions for replacing deprecated Sort method calls with QueryMbx.Chilkat PureBasic Downloads
IncludeFile "CkImap.pb"
IncludeFile "CkMessageSet.pb"
Procedure ChilkatExample()
success.i = 0
imap.i = CkImap::ckCreate()
If imap.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; ...
; ...
searchCriteria.s = "FROM bob@example.com"
bUid.i = 1
sortCriteria.s = "DATE SUBJECT"
; ------------------------------------------------------------------------
; The Sort method is deprecated:
msgSetObj.i = CkImap::ckSort(imap,sortCriteria,"UTF-8",searchCriteria,bUid)
If CkImap::ckLastMethodSuccess(imap) = 0
Debug CkImap::ckLastErrorText(imap)
CkImap::ckDispose(imap)
ProcedureReturn
EndIf
; ...
; ...
CkMessageSet::ckDispose(msgSetObj)
; ------------------------------------------------------------------------
; Do the equivalent using QueryMbx.
; Your application creates a new, empty MessageSet object which is passed
; in the last argument and filled upon success.
; The following properties are used instead of function arguments.
CkImap::setCkSortCriteria(imap, "DATE SUBJECT")
CkImap::setCkSearchCharset(imap, "UTF-8")
mset.i = CkMessageSet::ckCreate()
If mset.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkImap::ckQueryMbx(imap,searchCriteria,bUid,mset)
If success = 0
Debug CkImap::ckLastErrorText(imap)
CkImap::ckDispose(imap)
CkMessageSet::ckDispose(mset)
ProcedureReturn
EndIf
CkImap::ckDispose(imap)
CkMessageSet::ckDispose(mset)
ProcedureReturn
EndProcedure