There is a use case where this has caused crashes:
A message was hard-deleted using an IMAP client, this is the first
message you deleted in that folder and you have cleared offline
items in the client so a full sync is asked by upper layer.
In that situation, the SyncLastDeleteChangeNumber version property
is not set and return 0 in [getDeletedKeysFromChangeNumber:andCN:inTableType]
making OpenChange to crash while it is asking for deleted fmids
since a given change number.
This is a regression from 18d7070c4a.
Sometimes we're trying to get the `objectVersion` of a calendar message,
but this message's entry is not in the cache. The method
`synchroniseCache` won't work in this case, so we try to force the
synchronisation of that particular message in order to get the change
number before aborting.
And perform the real IMAP operation on save method as described by
[MS-OXCFXICS] and [MS-OXCMSG] Section 2.2.3.3, these operations must be
committed when SaveChangesMessage is called.
As it is expected by Outlook to increase the change number when
performing the `SetMessageReadFlag` ROP, if it is not done, the client
tries indefinitely to store that.
This method does not longer returns true if the content id
was a empty string.
In some case the old false positive triggered the removal of
attachments when sending messages.
The operation RopFastTransferSourceCopyTo calls the available
properties for a message using the instance method. It seems the
preferred method by Outlook to synchronise a FAI message. OpenChange
calls the message to get the available properties, so the instance
method is called. As it is specialised to return the custom hack
FAI properties, we have to call that class method instead of using
generic one available at NSObject (MAPIStoreProperties) class.
This avoids crashing the Outlook client after we synchronise the
calendar folder after changing the timeframe view (eg from day view
to month view).
The folder names are encoded through the `asCSSIdentifier` and
`stringByEncodingImap4FolderName` functions when we store them as folder
keys. In addition, the prefix "folder" is added to the key.
The order in which these operations were done when storing the folder
keys (and reverted when retrieving them) wasn't consistent trough the
code. This led to problems such as creating twice a folder with a digit
at the beginning of its name.
The folder name goes now through the following operations when being
stored as a key (the retrieval reverts these in the reverse order):
* `stringByEncodingImap4FolderName`
* `asCSSIdentifier`
* Add "folder" prefix
It was not working because we try to save as component the
full calendar and its parent was nil. We have to save the calendar
itself to save the task in the personal calendar.
versionsMessage object could have outdated version in a root folder
in the following case:
* Download latest contents using FXBuffer
* versionsMessage is updated by synchroniseCache
* OpenMessage from last FXBuffer
* Setup versions message as root folder
* Get Predecessor Change List from that message
We could just reload if needed the versions message if something
is missing but I don't know if that situation fixes more than this
one.
After saving a draft mail (this is done automatically by Outlook)
a GetProps call is done checking the PidTagChangeKey has been
updated properly. Without this patch, it returned MAPI_E_NOT_FOUND.
With this patch, we addressed that problem and we have updated
the Predecessor Change List metadata for the draft mail with the
change key provided by the client to avoid conflicting messages
whenever it is possible.
The attachments which used a extended parameter for their filename
('filename*=') where silently dropped.
This was because MAPIStore was only looking for no-extended filename
parameter.
The solution is using the 'filename' from the
SOGOExtension of the NSDictionary interface.
It is required when you are using SynchronizeImportReadStateChanges ROP
to update the MetaTagCnsetRead meta property.
See [MS-OXCFXICS] Section 3.2.5.9.4.6
This could lead to sync issues.
There were cases where only the change key was updated (GCS) or
others were the change key was updated with wrong info.
This changeset has as goal to update the predecessor change list
and, change key if required, on saving taking into account the latest information
given by the client in high level ROPs such as ImportMessageMove
or SetProperties, and merge it with information provided by the server
backend (IMAP server, SOGo DB) using `synchroniseCache`.
For more details about `PidTagChangeKey` and `PidTagPredecessorChangeList`
property values check [MS-OXCFXICS] Section 2.2.1.2
As required by operations like SynchronizationImportHierarchyChanges
a new change number must be generated when a change in a folder
is set. This affects to subfolders.
See [MS-OXCFXICS] Section 3.2.5.9.4.3 for details.
Some clients such as OpenChange client does not send the following
properties PidTagNormalizedSubject or PidTagSubjectPrefix as
suggested by [MS-OXCMAIL].
On [MAPIStoreContext idForObjectWithKey: key inFolderUrl: url] check the ret value
of mapistore_indexing_get_new_folderID. This should never happen (oh my...) but
if this happens it will be reported
This adds [MAPIStoreUserContext activate] method to use
it instead of activateWithUser.
A cleanup operation is executed after each public function
so there won't be any conflicts with future calls.
In practice, this will deactivate the current user context set on
MAPIApp, this means two things: (1) set nil as current user context
on MAPIApp and (2) remove woContext from current thread dictionary
This is crashing when the PidTagObjectType property is set for
some recipient and not for others.
If the property is missing, then no object type for the recipient
is assumed.
Before this change, the recipient address was only extracted from the sogo
user object. This made mail to groups undeliverable.
Now if we do not have mail addresses from user object,
we try to use parameters from the client call.
Introduced by ebe2a466e7 in PR #132 when the event is not
all day neither recurrent one.
The fix is just to initialise to nil when it is a normal event
and it returns NOT_FOUND for this property.
The value of `PidTagResponseRequested` property in the invitation mail
wasn't being set properly, while the `PidTagReplyRequested` property
wasn't being set at all. This caused invitation response mails not to be
sent. Both properties are expected to be `true`.
This fixes two scenarios:
* An IMAP subfolder has updated its hierarchy when it is asked
to be synchronised
* An IMAP root folder is created on Outlook when you logon. OpenChange
changes are required to be refreshed on synchronisation.
All this basically is to make it work on multidomain environment
the Reply all functionality of emails but I'm sure there are more use cases
as an Outlook client that don't work nowadays without this patch.
More info on commit message but basically it was that we were using user
instead of user@domain.com in several places.
Take into account optional attendees setting the recipient
type to MAPI_CC when they have the iCal role set to OPT-PARTICIPANT
instead of harding always MAPI_TO (required) as was done before.
This is a complementary fix for: https://github.com/Zentyal/sogo/pull/108
oc: return last modified messages when sorted by PidMessageTagDeliveryTime
This change is required as oxcfxics is asking for sorting
using this property.
We fake this property on GCS folders (Tasks, Calendar, Contacts)
using c_lastmodified column.
PidTag*EntryId properties were not being generated (which contain
the email address and so on). Functionality on Outlook clients like
"Reply All" were not working because of this (probably a lot more
stuff related with email addresses).
With multidomain support enabled outlook clients will use full email
address (e.g. user@domain.com) as login.
This change is needed because we were performing ldap queries on samdb
using (sAMAccountName=UIDFieldName), being UIDFieldName the parameter
configured in sogo.conf for that source. In multidomain environment
this field could be `sAMAccountName` but it could not. Actually the
more logical scenario will be to use `uid` field here (which will be
just `user`, without the `@domain.com` part).
SOGoUserManager will return `sAMAccountName` if the contact has it
(in Outlook environment that means always) so it can (and must) be
used to query samdb in MAPIStoreSamDBUtils properly.
TL;DR: use sAMAccoutName instead of uid to query samdb
So when multidomain is enabled we will have tables like
sogo_cache_folder_user_A_domain_D_com instead of just
sogo_cache_folder_user
If multidomain is disabled the folders will still be like
sogo_cache_folder_user
We believe the folder ID OpenChange is sending us is new
and we keep the indexing database properly updated.
Although the solution is not elegant, this could avoid
inconsistencies between what the client stores and the
relation in the MAPIStore backend.
Avoiding the usage of __FUNCTION__ and __LINE__
and more related with the logging system is being in place
for OpenChange.
As well as set the proper level to some debug messages.
This change is required as oxcfxics is asking for sorting
using this property.
We fake this property on GCS folders (Tasks, Calendar, Contacts)
using c_lastmodified column.
As well as hard deleted
As explained in [MS-OXCFXICS] Section 2.2.1.3.1, the
property MetaTagIdsetDeleted must include both types
of messages and this idset is filled with the return
value of this message.
This property is needed to show the 'Internet Headers' in Outlook.
Outlook 2010 shows them in the properties dialog of a message.
Outlook 2007 show them in message options section from context menu
of a mail message.
The property is defined in [MS-OXOMSG] section 2.2.1.61.
The property is formed concatenating the mail message headers
properly mime encoded.
The headers are appended in no defined order.
As it happened with dba17fb if we interleave requests
from different users while creating a folder we can
create the folder in other user's mailbox as latest
activeUser is the one from latest sogo_context_get_root_folder
call.
This is for me a lack of right design and a workaround
only fixing this issue but not the root cause.
As it happened with dba17fb if we interleave requests
from different users while creating a folder we can
create the folder in other user's mailbox as latest
activeUser is the one from latest sogo_context_get_root_folder
call.
This is for me a lack of right design and a workaround
only fixing this issue but not the root cause.
* PidNameXSharingFlavor is used by Outlook 2010 so we have
to store it
* 0x5100 is used although it is not in spec as Sharing Flavour
value when the request is denied from a message where
Request + Invitation was sent.
* Return properly PidNameXSharingCapabilities and PidNameXSharingFlavor
as it is an string representation of a hex number
* Try to guess proper sharing flavour value when it is missing
Save them in extra properties from folder container.
This is required because the client once a request is accepted
or denied sets these two properties and save the message again.
As we cannot modify an IMAP message, we use this utility.
See [MS-OXSHARE] Section 3.1.4.3 for details.
A failure in parsing an ICS makes return a nil calendar
object. Instead of creating an appointment with nil
information which can lead to crashes like the one
generated creating PidLidCleanGlobalObjectId property.
We return an empty message with no information which is
taken into account in Outlook but not displayed like
in SOGo webmail does.
A failure in parsing an ICS makes return a nil calendar
object. Instead of creating an appointment with nil
information which can lead to crashes like the one
generated creating PidLidCleanGlobalObjectId property.
We return an empty message with no information which is
taken into account in Outlook but not displayed like
in SOGo webmail does.
The `[SOGoFolder:aclUsers]` returns a reference to a `NSArray`
which is being modified in the `for` loop making fail when
more than one user is in the ACL with `NSRangeException`.
Outlook sets recipient type of Required attendees as MAPI_TO and
optional ones as MAPI_CC, so the fix is just to not only iterate
over the "to" list of recipients but also the "cc" one. We're
also setting the proper iCal value for this case (OPT-PARTICIPANT
instead of REQ-PARTICIPANT)
In [MS-OXOCAL] Section 2.2.4.10.7 says the recipient type is 0x01
as Required and 0x02 as Optional and other documents such as
[MS-OXCMSG] 2.2.3.1.2 indicates that MAPI_TO is 0x01 and MAPI_CC
is 0x02, that's why is stored in 'to' and 'cc' respectively.
SOGo does not create BYDAY mask in weekly recurrence, so
we have to guess it from the start date's day of week.
In other case, the event is not exported to Outlook and it
says that is corrupted.
According to [MS-OXICAL] Section 2.1.3.1.1.20.13, the EXDATE property
must be written only if there are ocurrences from the series that have
been deleted and before this commit ModifiedInstanceDates were also
included.
We check against every ExceptionInfo from exception ocurrences of the series
to know if the ocurrence was deleted or only modified.
This makes sent mails are not longer automatically copied
to Drafts folder.
Reasoning:
When Outlook sends a mail, OpenChange submits the message and
copy the message to Drafts folder. Afterwards, the client asks
to move this message using SyncImportMessageMove ROP from
Drafts to Sent. During this movement, the message is unregistered
from the indexing database. If the client has updated Drafts
folder before that movement, then the client will keep this
message as the MID is not returned in oxcfxics download sync
as deleted. Setting the message as soft deleted, make it work.
In this way, we do not modify the flags (\Seen) on preloading.
The IMAP server returns the content without .peek section so
it is removed.
This also performs the modification intended by the following
Pull Request:
https://github.com/Zentyal/sogo/pull/50
That tried to avoid set \Seen flag when preloading message bodies
on synchronisation. But in this case we are not incrementing the
modseq as we are not modifying any messages flags.