// Example IAF header
// "\x66\x4D\x41\x49\x00\x00\x05\x00\x01\x00\x00\x00"
// Offs 00-03 = 'fMAI' (IAF magic string)
// Offs 04-05 = 0000
// Offs 06 = 05 or 07 (05=Outlook Express format/8-bit char, 07=Unicode Windows Mail/Windows Live Mail format/UTF-16LE char)
// Offs 07 = 00
// Offs 08 = 00 or 01 or 02 (00=News acount, 01=IMAP/POP3 account, 02=Active Directory/LDAP account)
// Offs 09-0a = 000000
// IAF fields - PHP code
private $_fieldsTable = array(
// 305-306 -> General settings
'AccountName' => array('305464304', 'nullstr_fmt', '', ''),
'TemporaryAccount' => array('305595369', 'ulong_le_fmt', 'bool_re', ''),
'GENERAL-305660911' => array('305660911', 'nullstr_fmt', '', ''), // UNKNOWN - added from Windows Mail and Windows Live Mail - NNTP only?
'ConnectionType' => array('305726441', 'ulong_le_fmt', 'iaf_ct_re', ''),
'ConnectionName' => array('305791984', 'nullstr_fmt', '', ''),
'ConnectionFlags' => array('305857513', 'ulong_le_fmt', 'num_re', ''),
'AccountID' => array('305988592', 'nullstr_fmt', '', ''), // Win32-Outlook-IAF fix
'BackupConnectionName' => array('306054128', 'nullstr_fmt', '', ''),
'MakeAvailableOffline' => array('306185193', 'ulong_le_fmt', 'bool_re', ''),
'ServerReadOnly' => array('306316277', 'ulong_le_fmt', 'bool_re', ''),
'GENERAL-306381801' => array('306381801', 'nullstr_fmt', '', ''), // UNKNOWN - added from Windows Mail and Windows Live Mail
// 311-314 -> IMAP settings
'IMAPServer' => array('311952368', 'nullstr_fmt', '', ''),
'IMAPUserName' => array('312017904', 'nullstr_fmt', '', ''),
'IMAPPassword' => array('312083446', 'nullstr_fmt', '', 'iaf_password'), // NOTE - Windows Live Mail does not export passwords so this field can be absent
'IMAPAuthUseSPA' => array('312214517', 'ulong_le_fmt', 'bool_re', ''),
'IMAPPort' => array('312280041', 'ulong_le_fmt', 'num_re', ''),
'IMAPSecureConnection' => array('312345589', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'IMAPTimeout' => array('312411113', 'ulong_le_fmt', 'num_re', ''),
'IMAPRootFolder' => array('312476656', 'nullstr_fmt', '', ''),
'IMAPUseLSUB' => array('312673269', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'IMAPPolling' => array('312738805', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'IMAPFullList' => array('312804341', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'IMAPStoreSpecialFolders' => array('313000949', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'IMAPSentItemsFolder' => array('313066480', 'nullstr_fmt', '', ''),
'IMAPDraftsFolder' => array('313197552', 'nullstr_fmt', '', ''),
'IMAPPasswordPrompt' => array('313525237', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'IMAPDirty' => array('313590761', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'IMAPPollAllFolders' => array('313656309', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'IMAPDeletedItemsFolder' => array('313721840', 'nullstr_fmt', '', ''), // added from Vista
'IMAPJunkEmailFolder' => array('313787376', 'nullstr_fmt', '', ''), // added from Vista
'IMAPInboxFolder' => array('313852912', 'nullstr_fmt', '', ''), // added from Windows Mail and Windows Live Mail
'IMAP-313918453' => array('313918453', 'nullstr_fmt', '', ''), // UNKNOWN - added from Windows Mail and Windows Live Mail
'IMAP-313983989' => array('313983989', 'nullstr_fmt', '', ''), // UNKNOWN - added from Windows Mail and Windows Live Mail
'IMAP-314049525' => array('314049525', 'nullstr_fmt', '', ''), // UNKNOWN - added from Windows Mail and Windows Live Mail
'IMAP-314115061' => array('314115061', 'nullstr_fmt', '', ''), // UNKNOWN - added from Windows Mail and Windows Live Mail
'IMAP-314180597' => array('314180597', 'nullstr_fmt', '', ''), // UNKNOWN - added from Windows Mail and Windows Live Mail
// 321-323 -> HTTP settings
'HTTPServer' => array('321782768', 'nullstr_fmt', '', ''),
'HTTPUserName' => array('321848304', 'nullstr_fmt', '', ''),
'HTTPPassword' => array('321913846', 'nullstr_fmt', '', 'iaf_password'),
'HTTPPasswordPrompt' => array('321979381', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'HTTPAuthUseSPA' => array('322044905', 'ulong_le_fmt', 'bool_re', ''),
'HTTPFriendlyName' => array('322110448', 'nullstr_fmt', '', ''),
'HTTPDomainIsMSN' => array('322175989', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'HTTPPolling' => array('322241525', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'HTTPAdBarURL' => array('322307056', 'nullstr_fmt', '', ''),
'HTTPShowAdBar' => array('322372597', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'HTTPMinPollingInterval' => array('322438135', 'ulong_le_fmt', 'num_re', ''),
'HTTPGotPollingInterval' => array('322503669', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'HTTPLastPolledTime' => array('322569207', 'ulong_le_fmt', 'num_re', ''),
'HTTP-322634741' => array('322634741', 'nullstr_fmt', '', ''), // UNKNOWN - added from Windows Mail and Windows Live Mail
'HTTP-323552245' => array('323552245', 'nullstr_fmt', '', ''), // UNKNOWN - added from Vista
'HTTP-323683317' => array('323683317', 'nullstr_fmt', '', ''), // UNKNOWN - added from Windows Mail and Windows Live Mail
'HTTP-323748853' => array('323748853', 'nullstr_fmt', '', ''), // UNKNOWN - added from Windows Mail and Windows Live Mail
// 325-326 -> NNTP settings
'NNTPServer' => array('325059568', 'nullstr_fmt', '', ''),
'NNTPUserName' => array('325125104', 'nullstr_fmt', '', ''),
'NNTPPassword' => array('325190646', 'nullstr_fmt', '', 'iaf_password'), // NOTE - Windows Live Mail does not export passwords so this field can be absent
'NNTPAuthMethod' => array('325321717', 'ulong_le_fmt', 'iaf_am_re', ''),
'NNTPPort' => array('325387241', 'ulong_le_fmt', 'num_re', ''),
'NNTPSecureConnection' => array('325452789', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'NNTPTimeout' => array('325518313', 'ulong_le_fmt', 'num_re', ''),
'NNTPDisplayName' => array('325583856', 'nullstr_fmt', '', ''),
'NNTPOrganizationName' => array('325649392', 'nullstr_fmt', '', ''),
'NNTPEmailAddress' => array('325714928', 'nullstr_fmt', '', ''),
'NNTPReplyToEmailAddress' => array('325780464', 'nullstr_fmt', '', ''),
'NNTPSplitMessages' => array('325846005', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'NNTPSplitMessageSize' => array('325911529', 'ulong_le_fmt', 'num_re', ''),
'NNTPUseGroupDescriptions' => array('325977077', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'NNTPPolling' => array('326108149', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'NNTPPostingFormat' => array('326173673', 'ulong_le_fmt', 'iaf_pf_re', ''),
'NNTPSignature' => array('326239216', 'nullstr_fmt', 'regkey_re', ''),
'NNTPPasswordPrompt' => array('326304757', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'NNTP-326370281' => array('326370281', 'nullstr_fmt', '', ''), // UNKNOWN - added from Windows Mail and Windows Live Mail - NNTP only
'NNTP-326632425' => array('326632425', 'nullstr_fmt', '', ''), // UNKNOWN - added from Windows Mail and Windows Live Mail - NNTP only
// 331-332 -> POP3 settings
'POP3Server' => array('331613168', 'nullstr_fmt', '', ''),
'POP3UserName' => array('331678704', 'nullstr_fmt', '', ''),
'POP3Password' => array('331744246', 'nullstr_fmt', '', 'iaf_password'), // NOTE - Windows Live Mail does not export passwords so this field can be absent
'POP3AuthUseSPA' => array('331875317', 'ulong_le_fmt', 'bool_re', ''),
'POP3Port' => array('331940841', 'ulong_le_fmt', 'num_re', ''),
'POP3SecureConnection' => array('332006389', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'POP3Timeout' => array('332071913', 'ulong_le_fmt', 'num_re', ''),
'POP3LeaveMailOnServer' => array('332137461', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'POP3RemoveWhenDeleted' => array('332202997', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'POP3RemoveWhenExpired' => array('332268533', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'POP3ExpireDays' => array('332334057', 'ulong_le_fmt', 'num_re', ''),
'POP3SkipAccount' => array('332399605', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'POP3PasswordPrompt' => array('332530677', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
// 338-339 -> SMTP settings
'SMTPServer' => array('338166768', 'nullstr_fmt', '', ''),
'SMTPUserName' => array('338232304', 'nullstr_fmt', '', ''), // NOTE - If SMTPAuthMethod is set to "Use incoming" (value=02) then username/password will be absent
'SMTPPassword' => array('338297846', 'nullstr_fmt', '', 'iaf_password'), // NOTE - Windows Live Mail does not export passwords so this field can be absent
'SMTPAuthMethod' => array('338428905', 'ulong_le_fmt', 'iaf_am_re', ''),
'SMTPPort' => array('338494441', 'ulong_le_fmt', 'num_re', ''),
'SMTPSecureConnection' => array('338559989', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'SMTPTimeout' => array('338625513', 'ulong_le_fmt', 'num_re', ''),
'SMTPDisplayName' => array('338691056', 'nullstr_fmt', '', ''),
'SMTPOrganizationName' => array('338756592', 'nullstr_fmt', '', ''),
'SMTPEmailAddress' => array('338822128', 'nullstr_fmt', '', ''),
'SMTPReplyToEmailAddress' => array('338887664', 'nullstr_fmt', '', ''),
'SMTPSplitMessages' => array('338953205', 'ulong_le_fmt', 'bool_re', 'iaf_bool'),
'SMTPSplitMessageSize' => array('339018729', 'ulong_le_fmt', 'num_re', ''),
'SMTPSignature' => array('339149808', 'nullstr_fmt', 'regkey_re', ''),
'SMTPPasswordPrompt' => array('339215349', 'ulong_le_fmt', 'bool_re', 'iaf_bool')
);