Compare commits
954
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30b08941f6 | ||
|
|
e5b42c5e98 | ||
|
|
ed5d922ea4 | ||
|
|
82b919e7ee | ||
|
|
821b7c19ce | ||
|
|
bed5175a74 | ||
|
|
188328d5d7 | ||
|
|
17afe7c077 | ||
|
|
bfb7fa2e14 | ||
|
|
e8ff3dc539 | ||
|
|
20b1d3c0e9 | ||
|
|
3a66e54bd0 | ||
|
|
d1c3327d47 | ||
|
|
100841efbd | ||
|
|
8617ddc05e | ||
|
|
8e94c33a0f | ||
|
|
32bb1456e2 | ||
|
|
d01f5d36fa | ||
|
|
6de15edb9c | ||
|
|
a2078da5f0 | ||
|
|
2193dbb678 | ||
|
|
cb9f26cc1f | ||
|
|
e4473a656b | ||
|
|
7cbf019742 | ||
|
|
456ff7d5a3 | ||
|
|
5f0061205f | ||
|
|
11a2bcfffd | ||
|
|
0b1fbf0dee | ||
|
|
499dbf68ae | ||
|
|
4c6c0a3644 | ||
|
|
1c65424242 | ||
|
|
08bf6d528b | ||
|
|
a9083004ef | ||
|
|
ec02c41d9b | ||
|
|
07e3c48ed0 | ||
|
|
920bfba8b8 | ||
|
|
bc2e46cda7 | ||
|
|
e9d24fe0e6 | ||
|
|
24d32ae220 | ||
|
|
8baf8731b7 | ||
|
|
b9cdc437eb | ||
|
|
a451a1120b | ||
|
|
6cfed4eb67 | ||
|
|
a55c98b98d | ||
|
|
7c0649efcf | ||
|
|
0ca6512617 | ||
|
|
3ee29c0b71 | ||
|
|
7b4c6346f8 | ||
|
|
d5fd719212 | ||
|
|
be7971ceef | ||
|
|
3f0c2b647c | ||
|
|
155acfa9a6 | ||
|
|
57901b8469 | ||
|
|
5ba476789c | ||
|
|
49d5a72d65 | ||
|
|
f34aa2996d | ||
|
|
5686e086cd | ||
|
|
ed9ec04669 | ||
|
|
737d2ffccc | ||
|
|
7ca66b4078 | ||
|
|
04c68e0674 | ||
|
|
bf7f5e8be7 | ||
|
|
f1d0f770df | ||
|
|
596c22d828 | ||
|
|
e223d064d9 | ||
|
|
dbf6426449 | ||
|
|
7fc6eec157 | ||
|
|
f48b3405d7 | ||
|
|
52bc589ab8 | ||
|
|
03f879433b | ||
|
|
ad141295ed | ||
|
|
5fef815191 | ||
|
|
ec28fdc8d0 | ||
|
|
b1590f6b2e | ||
|
|
800d143a35 | ||
|
|
a503b34d7a | ||
|
|
65670027cb | ||
|
|
d5bf661cf1 | ||
|
|
dc2878b5e2 | ||
|
|
f9aab0de75 | ||
|
|
5c58299458 | ||
|
|
57fad470fb | ||
|
|
e0b7efbbbf | ||
|
|
4278e417a7 | ||
|
|
230688bf4e | ||
|
|
1a1f74b5d0 | ||
|
|
93d1c3d4e7 | ||
|
|
ea37a9cd29 | ||
|
|
8e8e19666a | ||
|
|
76b4563b2f | ||
|
|
4ce3947e60 | ||
|
|
0a8f52ce7d | ||
|
|
9bb2473c8e | ||
|
|
2d5995a8f4 | ||
|
|
cee83df085 | ||
|
|
0c5f4edb36 | ||
|
|
90378b76eb | ||
|
|
6aeb13ba65 | ||
|
|
216371fd80 | ||
|
|
5927d3303c | ||
|
|
6a3e64f849 | ||
|
|
490043b2e1 | ||
|
|
210d6908b8 | ||
|
|
ca7f093155 | ||
|
|
2ad00f8cef | ||
|
|
b5780357cb | ||
|
|
67f38e1127 | ||
|
|
36985a19e9 | ||
|
|
06cbe527e8 | ||
|
|
51dbfaba15 | ||
|
|
3d55396661 | ||
|
|
2c97b680a8 | ||
|
|
f9cb896f92 | ||
|
|
46edcce1d5 | ||
|
|
1b14fee96e | ||
|
|
0777e9fe67 | ||
|
|
8b078817e2 | ||
|
|
dd56d5e85c | ||
|
|
e009af6864 | ||
|
|
673db179b1 | ||
|
|
fd0f1499b1 | ||
|
|
20575226b8 | ||
|
|
8b04a468c2 | ||
|
|
ccd9e385a0 | ||
|
|
376e717f45 | ||
|
|
5b25f85c02 | ||
|
|
63b8c3ed5e | ||
|
|
c76c48fb0c | ||
|
|
7fe1b5f046 | ||
|
|
2a25675b3a | ||
|
|
dbfd86db04 | ||
|
|
135535e00e | ||
|
|
e386404b0a | ||
|
|
966d13c5b6 | ||
|
|
4ae5feb131 | ||
|
|
db213c2b73 | ||
|
|
c2922e2a26 | ||
|
|
1529e7ec4e | ||
|
|
332508e2db | ||
|
|
d2ea6fef2e | ||
|
|
75ff4af7cc | ||
|
|
916c04387b | ||
|
|
7c460b694e | ||
|
|
29f2d960a7 | ||
|
|
225fe847a7 | ||
|
|
720b1d5ab5 | ||
|
|
28bd4ca318 | ||
|
|
c6dbcb2f7c | ||
|
|
5dfbfe827d | ||
|
|
6ddb40fd2b | ||
|
|
37f29c06ea | ||
|
|
248892c394 | ||
|
|
b4e4b9c29f | ||
|
|
e94b4416f8 | ||
|
|
8d19ec4aff | ||
|
|
aeeeeea802 | ||
|
|
41e388c5f6 | ||
|
|
db17872dd6 | ||
|
|
73e86bb8e5 | ||
|
|
c3bce410f1 | ||
|
|
980db7a980 | ||
|
|
c5c6ff33d8 | ||
|
|
7e1bbe34dc | ||
|
|
a618386d5e | ||
|
|
5993fe97c3 | ||
|
|
7cdf48335b | ||
|
|
3dff73636c | ||
|
|
2fc21e48d8 | ||
|
|
98ed9c3b17 | ||
|
|
f9884e3f55 | ||
|
|
10cabca57e | ||
|
|
2e1ed274c8 | ||
|
|
e4cd451be8 | ||
|
|
603da75818 | ||
|
|
9ed3812795 | ||
|
|
a0b15d0c8c | ||
|
|
7e4571874e | ||
|
|
b076801e1b | ||
|
|
0316e441fc | ||
|
|
75208428dd | ||
|
|
942f48c9a0 | ||
|
|
24a7515bb5 | ||
|
|
a8e5a3c025 | ||
|
|
0b69727a49 | ||
|
|
2a2d141629 | ||
|
|
b98d112738 | ||
|
|
1c8b693656 | ||
|
|
15ab0f851d | ||
|
|
1f98d7cced | ||
|
|
2755a83e65 | ||
|
|
9936477f07 | ||
|
|
2e1bfb25d5 | ||
|
|
25dbce42cd | ||
|
|
a9fe80c367 | ||
|
|
bc5aa3cacb | ||
|
|
0ddbd79fad | ||
|
|
2a3367a13b | ||
|
|
4b7cbba0c8 | ||
|
|
2deda01e5c | ||
|
|
8c0ef9cf50 | ||
|
|
8456d49686 | ||
|
|
5a3cafbbb0 | ||
|
|
dc085789e7 | ||
|
|
f6973d8aa4 | ||
|
|
94d4da6e1e | ||
|
|
2f63542e07 | ||
|
|
3155bd0172 | ||
|
|
2518b37e32 | ||
|
|
8e3e4a5445 | ||
|
|
01dcf3d6c8 | ||
|
|
fa4d3a0e20 | ||
|
|
bbdb27e75e | ||
|
|
1279629e86 | ||
|
|
f7d748ea98 | ||
|
|
2d1a4b320c | ||
|
|
e8e610c7b3 | ||
|
|
8df311547f | ||
|
|
f42d6f5f4a | ||
|
|
01642eca3e | ||
|
|
9554e92c8b | ||
|
|
2ae8c6f8b2 | ||
|
|
f64b324133 | ||
|
|
31deae11b4 | ||
|
|
19676593ea | ||
|
|
4a27beabdd | ||
|
|
8dae5faaa1 | ||
|
|
85ce41dc68 | ||
|
|
0622980f38 | ||
|
|
a73df96b78 | ||
|
|
7015713741 | ||
|
|
7644d6fb4d | ||
|
|
9dcf459827 | ||
|
|
4c7bd6dd76 | ||
|
|
ec598321c4 | ||
|
|
4b8a9bcc3b | ||
|
|
a9984d9487 | ||
|
|
88a74bcb5c | ||
|
|
2a90102a81 | ||
|
|
fbc73dc3bc | ||
|
|
1d78b2df96 | ||
|
|
6aef713d28 | ||
|
|
71db3945cb | ||
|
|
da230410be | ||
|
|
82114f75aa | ||
|
|
f8d31a6413 | ||
|
|
707aabde15 | ||
|
|
ceec497aec | ||
|
|
46f93d8629 | ||
|
|
f2347e13d7 | ||
|
|
106f8ec314 | ||
|
|
f58554a700 | ||
|
|
76b8de1805 | ||
|
|
0751c51b89 | ||
|
|
64456c10e5 | ||
|
|
5f5b5d9273 | ||
|
|
194c415631 | ||
|
|
08f05ac2ef | ||
|
|
af413f2b32 | ||
|
|
77bba8e5ea | ||
|
|
946665ff49 | ||
|
|
ef7de7c10d | ||
|
|
106c6a24ae | ||
|
|
863f182e84 | ||
|
|
ba37353e42 | ||
|
|
1915748e33 | ||
|
|
b170ae866f | ||
|
|
7c69e37449 | ||
|
|
7f26d47cd1 | ||
|
|
b55ec52bfe | ||
|
|
f919df050a | ||
|
|
c2e4f7441d | ||
|
|
ca27464984 | ||
|
|
6cbc5573a1 | ||
|
|
e4fae417b9 | ||
|
|
a6bbe13f9b | ||
|
|
8cfb0f0d44 | ||
|
|
08f57f6ad5 | ||
|
|
30a94161af | ||
|
|
ec533809aa | ||
|
|
0d05e3579c | ||
|
|
bf4a581d0f | ||
|
|
9d3f3c619d | ||
|
|
7d49674d9d | ||
|
|
48832a4878 | ||
|
|
eda84c7b5d | ||
|
|
9d31023724 | ||
|
|
41e80bb105 | ||
|
|
e428e74e6c | ||
|
|
7a5e550510 | ||
|
|
0605fdf02a | ||
|
|
d3290dbb8d | ||
|
|
34f626b84c | ||
|
|
e173c6d621 | ||
|
|
1425bb1c75 | ||
|
|
5b65eaa572 | ||
|
|
892bd693d7 | ||
|
|
6812cb08dc | ||
|
|
b62167dd00 | ||
|
|
e0d49d2407 | ||
|
|
c8d05d41a5 | ||
|
|
1013c473cd | ||
|
|
b8d77259cd | ||
|
|
40cb81fd0b | ||
|
|
2937ba7f30 | ||
|
|
3c6fb10d9f | ||
|
|
b378d258cb | ||
|
|
3ba1e33eb6 | ||
|
|
40a1d5fdbf | ||
|
|
1b44218a35 | ||
|
|
df211af604 | ||
|
|
2c723070c6 | ||
|
|
6f5bb3882c | ||
|
|
fc9b175f25 | ||
|
|
1716e46210 | ||
|
|
8800cdf641 | ||
|
|
d998786ea6 | ||
|
|
a50758cc06 | ||
|
|
498cec767b | ||
|
|
8cb580633d | ||
|
|
2b1e060881 | ||
|
|
3702e79a00 | ||
|
|
beb484da10 | ||
|
|
a54cc22da8 | ||
|
|
7f92aca0bd | ||
|
|
8d85ca13df | ||
|
|
fb7e044bd3 | ||
|
|
c08abdb32f | ||
|
|
c55eab6404 | ||
|
|
7680c4091e | ||
|
|
5911563b0f | ||
|
|
eebf878e89 | ||
|
|
a8e02b94d4 | ||
|
|
6ada034c33 | ||
|
|
c01b21e402 | ||
|
|
c8c7aaa459 | ||
|
|
5409cb2927 | ||
|
|
b329513845 | ||
|
|
0ca6e7c6d3 | ||
|
|
bea2415fad | ||
|
|
180269e39e | ||
|
|
8a3adeadd2 | ||
|
|
fc8eedf494 | ||
|
|
c8acba8f5a | ||
|
|
deca6e383a | ||
|
|
f3ac7b8334 | ||
|
|
ad8941ba56 | ||
|
|
2bccfcb725 | ||
|
|
4d174b4c6c | ||
|
|
3b15a79c0a | ||
|
|
b4c2857bb5 | ||
|
|
6f2eae5d67 | ||
|
|
9a7ea26b80 | ||
|
|
38c9a229c0 | ||
|
|
e75ec09445 | ||
|
|
58d03eedc3 | ||
|
|
98ad8f1c0b | ||
|
|
37b817cd68 | ||
|
|
9fd8f3edef | ||
|
|
ce11aca2bd | ||
|
|
861057f22f | ||
|
|
b910501afa | ||
|
|
ba68bd8935 | ||
|
|
063f878199 | ||
|
|
6bccd2eea0 | ||
|
|
652ae763d4 | ||
|
|
734aba5ddb | ||
|
|
3da6c90bbe | ||
|
|
21a6480834 | ||
|
|
42f10e1929 | ||
|
|
03b706e1d8 | ||
|
|
2be556299e | ||
|
|
b075a306c6 | ||
|
|
36d8fa12d3 | ||
|
|
07092828fe | ||
|
|
7c0ba7b72b | ||
|
|
750a629df8 | ||
|
|
33a1d2c397 | ||
|
|
2e75972df6 | ||
|
|
1fdb44b0a7 | ||
|
|
3868ce0fb1 | ||
|
|
fc82eb79f6 | ||
|
|
9425868365 | ||
|
|
6280e4ded6 | ||
|
|
f19074334c | ||
|
|
b702e40ebb | ||
|
|
190f27ed7c | ||
|
|
cbc3e3e97d | ||
|
|
361d5ea3a6 | ||
|
|
24e3071e24 | ||
|
|
1f29198495 | ||
|
|
916442f9cf | ||
|
|
47859b76d6 | ||
|
|
3a60b6e38e | ||
|
|
ae3ac0a09a | ||
|
|
27a19ac956 | ||
|
|
27b9b7bfa7 | ||
|
|
18f758cb0a | ||
|
|
321672e2c3 | ||
|
|
8d9b54815c | ||
|
|
1dbfc18379 | ||
|
|
05b330e11b | ||
|
|
307876e6c7 | ||
|
|
ac6b299988 | ||
|
|
234db671ad | ||
|
|
2d33b01f31 | ||
|
|
490354427d | ||
|
|
22ce38808a | ||
|
|
82aca2cfe5 | ||
|
|
b17488ff25 | ||
|
|
ff3557598f | ||
|
|
26bd1b30fa | ||
|
|
0ce04fd4b6 | ||
|
|
f3656f7571 | ||
|
|
2aba083147 | ||
|
|
9414df26c5 | ||
|
|
7496b92da5 | ||
|
|
e38b0ac64f | ||
|
|
1404dbdb88 | ||
|
|
3dc8cc78ea | ||
|
|
72cbd9a45f | ||
|
|
10ac445f7c | ||
|
|
c5b5a4243d | ||
|
|
304ffa2099 | ||
|
|
e4ad255fc2 | ||
|
|
390a853471 | ||
|
|
dd9b5e18b6 | ||
|
|
5c017c19fc | ||
|
|
dec152e8e5 | ||
|
|
4922e6004d | ||
|
|
b91972d1dc | ||
|
|
5c3cdda186 | ||
|
|
4b19e64071 | ||
|
|
b6dee056ca | ||
|
|
372247a643 | ||
|
|
6830d6d930 | ||
|
|
366ad44cd1 | ||
|
|
9430f40101 | ||
|
|
b7c2d8ae95 | ||
|
|
f03e7a6604 | ||
|
|
4e7a3ce5fa | ||
|
|
61c542cb95 | ||
|
|
d2640e1501 | ||
|
|
20b91cc7bf | ||
|
|
b05f7a5beb | ||
|
|
3a61b7bae4 | ||
|
|
7bde181d3f | ||
|
|
1336a1d5a8 | ||
|
|
cf606e3224 | ||
|
|
c9f2fe2f85 | ||
|
|
10bc15d41d | ||
|
|
393b6d5128 | ||
|
|
68ae978b13 | ||
|
|
f4e3b98042 | ||
|
|
cfab18e1b8 | ||
|
|
959b4e015d | ||
|
|
7c6c78d13b | ||
|
|
7db109525d | ||
|
|
2ce85f6c5c | ||
|
|
7d2f96e96b | ||
|
|
3bf7afdfb7 | ||
|
|
503a70118f | ||
|
|
928b6b596e | ||
|
|
d0d93a297b | ||
|
|
936c38c43e | ||
|
|
7da7bdc1bf | ||
|
|
1e101ef01a | ||
|
|
3171257ef4 | ||
|
|
2c8d65843f | ||
|
|
62b16f4ef3 | ||
|
|
b86b1afdb9 | ||
|
|
8e047aaa9c | ||
|
|
dc2cc14d25 | ||
|
|
3f1a43cc13 | ||
|
|
67d0d95869 | ||
|
|
d16bf7c1a7 | ||
|
|
b527099907 | ||
|
|
72aab7f83f | ||
|
|
dfecce7381 | ||
|
|
82798ccb99 | ||
|
|
3809c002ed | ||
|
|
d9b4abc2f1 | ||
|
|
5ad3662640 | ||
|
|
667e38ff0c | ||
|
|
76196bf6f4 | ||
|
|
5435c2dd04 | ||
|
|
a70ea38572 | ||
|
|
5e66e8e299 | ||
|
|
44af47f69e | ||
|
|
54224637b6 | ||
|
|
d9896192f3 | ||
|
|
85ad849189 | ||
|
|
2c5f598a23 | ||
|
|
ac30c82165 | ||
|
|
6994c029b8 | ||
|
|
977406de76 | ||
|
|
7d018221ef | ||
|
|
662d06d24a | ||
|
|
9897cee779 | ||
|
|
1f83ba9d50 | ||
|
|
e40a19cf89 | ||
|
|
6bc471ad9a | ||
|
|
b1453e1d7e | ||
|
|
88cab67f6d | ||
|
|
e1ecf797f5 | ||
|
|
a56dbeb6a9 | ||
|
|
76360958a2 | ||
|
|
aa623c5171 | ||
|
|
c1b0fd53dc | ||
|
|
b93cbeee26 | ||
|
|
f3c2d3ca09 | ||
|
|
24edb2bce8 | ||
|
|
c0a22ead1d | ||
|
|
05232526a7 | ||
|
|
8c4cb64246 | ||
|
|
ccbaea6999 | ||
|
|
75206f1f2c | ||
|
|
d8e37cd7d8 | ||
|
|
7540cc3e33 | ||
|
|
18a0422367 | ||
|
|
2f533f6dae | ||
|
|
4df323eddb | ||
|
|
9435a22905 | ||
|
|
15bbfeda3a | ||
|
|
d92b0341fb | ||
|
|
5e84f2817f | ||
|
|
c61eca27a1 | ||
|
|
96d88de564 | ||
|
|
90e11d76f6 | ||
|
|
3dd8bddc0e | ||
|
|
95f11f6d0d | ||
|
|
617e6f6454 | ||
|
|
f65076defd | ||
|
|
1ec53a063c | ||
|
|
cab5846e37 | ||
|
|
289100beff | ||
|
|
7da6b0b822 | ||
|
|
6cf2fd1e52 | ||
|
|
c95568373f | ||
|
|
bd12a817a6 | ||
|
|
76f80c507c | ||
|
|
2fd0beeaca | ||
|
|
db4cd9da6e | ||
|
|
afed233131 | ||
|
|
d1551bc7bb | ||
|
|
bea9b26907 | ||
|
|
84dfba7978 | ||
|
|
b04b66fd79 | ||
|
|
ce3d55d2cc | ||
|
|
13f2ac9cbb | ||
|
|
b43c3f6d98 | ||
|
|
abcd48a0cd | ||
|
|
d07df554f3 | ||
|
|
7dc333e790 | ||
|
|
cc62576fef | ||
|
|
772c3b3115 | ||
|
|
ed42d1e26b | ||
|
|
e0c1d5e47b | ||
|
|
a1d07c59af | ||
|
|
55d91973bd | ||
|
|
0a37652dd6 | ||
|
|
4f303f8aa2 | ||
|
|
c8995087d8 | ||
|
|
2ae5f342da | ||
|
|
d6ab7582e5 | ||
|
|
725dea5f6f | ||
|
|
1e0473f1e5 | ||
|
|
7990e23aaa | ||
|
|
04ce8d1066 | ||
|
|
37461e650d | ||
|
|
9922ec56d9 | ||
|
|
7893349244 | ||
|
|
76dd53b461 | ||
|
|
020c895925 | ||
|
|
f4963df50f | ||
|
|
e40be92204 | ||
|
|
30103532ae | ||
|
|
b433bac432 | ||
|
|
79bfc7aedf | ||
|
|
54ab0bf822 | ||
|
|
7e8c79c646 | ||
|
|
7160d94e91 | ||
|
|
416711ea43 | ||
|
|
5a8f310bc8 | ||
|
|
ae72c2f1d5 | ||
|
|
ca500df0af | ||
|
|
e2ef0103c4 | ||
|
|
e6d1a00928 | ||
|
|
143ee59f5b | ||
|
|
037a3a136a | ||
|
|
c98a000515 | ||
|
|
cc1e9f2fff | ||
|
|
9dc0a08bba | ||
|
|
5412599832 | ||
|
|
fbf5c4f6c2 | ||
|
|
d97813451e | ||
|
|
4de814c3b2 | ||
|
|
fb121974ec | ||
|
|
39aa9a97db | ||
|
|
dc48e05dd3 | ||
|
|
0ea0a77666 | ||
|
|
f8b7ebdaf8 | ||
|
|
5cf500d560 | ||
|
|
c1ce32ac94 | ||
|
|
e71a1c9974 | ||
|
|
96b2e0e1f5 | ||
|
|
a145fdbb53 | ||
|
|
619e9fe7dd | ||
|
|
64da65d827 | ||
|
|
364a07bd05 | ||
|
|
2c78d60e4a | ||
|
|
ee8caa5a99 | ||
|
|
f666b436dd | ||
|
|
4826f01555 | ||
|
|
0a285eedec | ||
|
|
582c24afc5 | ||
|
|
92ab267db5 | ||
|
|
fbb779a71d | ||
|
|
54b405a83d | ||
|
|
15f95c4956 | ||
|
|
2d65b75b56 | ||
|
|
ebe2a466e7 | ||
|
|
7e89c43919 | ||
|
|
a37f438663 | ||
|
|
dc5237e92e | ||
|
|
50896eb526 | ||
|
|
7ff12c7a64 | ||
|
|
f2b5f5917b | ||
|
|
ee74b78bf2 | ||
|
|
dfb960eac4 | ||
|
|
a1406d01e1 | ||
|
|
07ac3f43fb | ||
|
|
1db2b9793a | ||
|
|
393d8e5a73 | ||
|
|
6f741168a9 | ||
|
|
84c199b95a | ||
|
|
769045bbf6 | ||
|
|
08501dacaa | ||
|
|
b7907d654d | ||
|
|
a94591a365 | ||
|
|
78f5f60b16 | ||
|
|
255b3d2d00 | ||
|
|
1d9e085658 | ||
|
|
9901788db6 | ||
|
|
8e39f03f83 | ||
|
|
f6370d10cb | ||
|
|
d0c1737b1b | ||
|
|
836095e984 | ||
|
|
a86b164228 | ||
|
|
5847e086ec | ||
|
|
3872af35d1 | ||
|
|
beb666bc5f | ||
|
|
8fce211172 | ||
|
|
030d343432 | ||
|
|
a7306a77cb | ||
|
|
58449076a3 | ||
|
|
539060d252 | ||
|
|
336c4fb9d3 | ||
|
|
d3bf3dcd8f | ||
|
|
d4930a7960 | ||
|
|
49ee0850e1 | ||
|
|
0f432b654f | ||
|
|
cdb6085510 | ||
|
|
6b3454376e | ||
|
|
a8e8ec535a | ||
|
|
3f3ae3acd7 | ||
|
|
8706443685 | ||
|
|
ca7c4c026e | ||
|
|
f0a3fdae5b | ||
|
|
210053ea20 | ||
|
|
35f81318d6 | ||
|
|
1d6f1a83af | ||
|
|
914e7b7418 | ||
|
|
bddd67fb93 | ||
|
|
fa23b574eb | ||
|
|
321e16c382 | ||
|
|
479bbce7d0 | ||
|
|
69b06d3c7a | ||
|
|
65d1fc2134 | ||
|
|
cdc74e4984 | ||
|
|
1e4596ca3a | ||
|
|
755efa789b | ||
|
|
eae327ca19 | ||
|
|
01857a9a47 | ||
|
|
e2c3259b16 | ||
|
|
77917780c8 | ||
|
|
9b320ec2a1 | ||
|
|
b2d7eb40c2 | ||
|
|
ab121e6c15 | ||
|
|
94d546dc7a | ||
|
|
2082acc1aa | ||
|
|
06ef3fe856 | ||
|
|
c9ec636a53 | ||
|
|
36a70b161c | ||
|
|
784f0100e9 | ||
|
|
db9536adcc | ||
|
|
c428ac2553 | ||
|
|
f5607b3e85 | ||
|
|
491d7aaffc | ||
|
|
95a8a9316a | ||
|
|
1ee47b1ee2 | ||
|
|
dfde498b7c | ||
|
|
06476abdf7 | ||
|
|
bb0221c763 | ||
|
|
dc869ce106 | ||
|
|
ddcae9f132 | ||
|
|
f11bcd3373 | ||
|
|
a47f1de607 | ||
|
|
09aed26f10 | ||
|
|
0e5de2df42 | ||
|
|
82fb03b67b | ||
|
|
f9c8661fe6 | ||
|
|
661b6694af | ||
|
|
514b1c03be | ||
|
|
a663fdd260 | ||
|
|
0db16aedb1 | ||
|
|
6f70066986 | ||
|
|
b933f53fc2 | ||
|
|
097d5c2333 | ||
|
|
d75fb0722a | ||
|
|
6204aebf2c | ||
|
|
26d876e67a | ||
|
|
cc3652b59b | ||
|
|
9d7bbbc312 | ||
|
|
d2915add6d | ||
|
|
67139ce3e3 | ||
|
|
9eb138b867 | ||
|
|
baf3d1f986 | ||
|
|
ecd336fa5c | ||
|
|
afd73289d1 | ||
|
|
bff21ab1ff | ||
|
|
6d99226b13 | ||
|
|
69974807b5 | ||
|
|
8ee2303e78 | ||
|
|
7bc8cd58dd | ||
|
|
2668bc313c | ||
|
|
418ac15de6 | ||
|
|
637ac1e98a | ||
|
|
b0ba6f4a22 | ||
|
|
cdb766e2ef | ||
|
|
fb4c3a4730 | ||
|
|
6f44ec42c1 | ||
|
|
e25a7e3d8d | ||
|
|
3b0b43f28f | ||
|
|
afa9061f2f | ||
|
|
9f3f2aebe4 | ||
|
|
1d5ae27c99 | ||
|
|
0be36df211 | ||
|
|
beb57707e8 | ||
|
|
1bdd5dfc90 | ||
|
|
43debc1d70 | ||
|
|
37fbd75d55 | ||
|
|
1c1a75d2c1 | ||
|
|
f048860729 | ||
|
|
6d6053865f | ||
|
|
6e00274988 | ||
|
|
307fe90854 | ||
|
|
8031f066dc | ||
|
|
f1fda8bd06 | ||
|
|
517f4b0f49 | ||
|
|
2b54897d29 | ||
|
|
ae7ac1be29 | ||
|
|
6af8b486df | ||
|
|
316ade13f8 | ||
|
|
cbba0719bb | ||
|
|
c4566c4773 | ||
|
|
3b2cbb945c | ||
|
|
8e0849029e | ||
|
|
6192322513 | ||
|
|
44dfd35521 | ||
|
|
575600cabc | ||
|
|
acc2bd0369 | ||
|
|
cd47c926c9 | ||
|
|
9b038db0b6 | ||
|
|
bcc1aa8049 | ||
|
|
ef6aab63c9 | ||
|
|
df59b73a22 | ||
|
|
a5672fda52 | ||
|
|
b593ddc643 | ||
|
|
38d61f720f | ||
|
|
733e334726 | ||
|
|
22888ba5ac | ||
|
|
33c485d2f6 | ||
|
|
9160e34134 | ||
|
|
5ceddc213e | ||
|
|
85d9440ccd | ||
|
|
b97002565e | ||
|
|
03b6a8a028 | ||
|
|
22196e0054 | ||
|
|
8d21bc3e36 | ||
|
|
4c3c741d9f | ||
|
|
731934f061 | ||
|
|
b645b4187d | ||
|
|
9b847a276c | ||
|
|
68216a7456 | ||
|
|
624967c60b | ||
|
|
e6ba15bbae | ||
|
|
2a1b363fee | ||
|
|
eaec3c0610 | ||
|
|
d3a4b497c6 | ||
|
|
b26ea30b1b | ||
|
|
72b210cd2e | ||
|
|
a80d75d09c | ||
|
|
aae76dc4e6 | ||
|
|
c20ca0e33d | ||
|
|
601a9ca559 | ||
|
|
d7c283f751 | ||
|
|
f3325b8b0d | ||
|
|
b4ea4d7e9f | ||
|
|
9447437d6f | ||
|
|
322f72626a | ||
|
|
55ae4cb8c0 | ||
|
|
e5d01428ad | ||
|
|
7406fc3772 | ||
|
|
82178fd6ce | ||
|
|
efe2070227 | ||
|
|
68ebc9e0ff | ||
|
|
6cf1ec998e | ||
|
|
6c9b1a494f | ||
|
|
98e4c8ca55 | ||
|
|
1178bf2d60 | ||
|
|
96986812f4 | ||
|
|
142deeb5f0 | ||
|
|
dc8012e3d3 | ||
|
|
3731819e15 | ||
|
|
eca22caefc | ||
|
|
923bcf8ae2 | ||
|
|
0b44fa81f4 | ||
|
|
776b17ff20 | ||
|
|
12b159a6c0 | ||
|
|
2aa528dacc | ||
|
|
d1d3980919 | ||
|
|
cf35eec1f5 | ||
|
|
58a0b0c173 | ||
|
|
723a9d4e08 | ||
|
|
4cc158043e | ||
|
|
7fd1564a86 | ||
|
|
981c718d22 | ||
|
|
6cfa6b9952 | ||
|
|
0a198ccb05 | ||
|
|
5258ee2e76 | ||
|
|
d5ec25ee62 | ||
|
|
57d591c427 | ||
|
|
b01de763da | ||
|
|
2dcb8fa732 | ||
|
|
6ce4cc1919 | ||
|
|
0e8bf0d239 | ||
|
|
086361b79a | ||
|
|
ab12c84887 | ||
|
|
312084243b | ||
|
|
47be392d4f | ||
|
|
34efcfee4e | ||
|
|
8e7f6d1aec | ||
|
|
e2bee23021 | ||
|
|
1a10599369 | ||
|
|
d907d5d268 | ||
|
|
7014d94937 | ||
|
|
99a36be034 | ||
|
|
8e41e5d665 | ||
|
|
b1dfe47f01 | ||
|
|
014632fddb | ||
|
|
8b44c08a32 | ||
|
|
c893963da5 | ||
|
|
c6b976a830 | ||
|
|
d5d97db8e8 | ||
|
|
d98ff69fbe | ||
|
|
87a91fbdf2 | ||
|
|
daa7ab87d7 | ||
|
|
00cef845b7 | ||
|
|
f9550b9181 | ||
|
|
3e59b1ad6e | ||
|
|
e45451a9f9 | ||
|
|
b35fee8efc | ||
|
|
e9e3dd5646 | ||
|
|
16c863d89d | ||
|
|
7e7d302165 | ||
|
|
d052356724 | ||
|
|
d87056ebfa | ||
|
|
135b463e8f | ||
|
|
f4c4f5af62 | ||
|
|
70e45f7843 | ||
|
|
28e449b050 | ||
|
|
6b52e9c945 | ||
|
|
1cfbea69c1 | ||
|
|
cb9118d869 | ||
|
|
dd6dd7251c | ||
|
|
24c6c8c91d | ||
|
|
b1ac7a0cca | ||
|
|
59e6d6df4a | ||
|
|
71ad5de910 | ||
|
|
b5369530f0 | ||
|
|
ead665de85 | ||
|
|
838ae8995f | ||
|
|
a0c1ce8f3b | ||
|
|
3ef28b390d | ||
|
|
0cd6fe6135 | ||
|
|
204a62aa6a | ||
|
|
31cffdffd3 | ||
|
|
501ee79766 | ||
|
|
255bcbe92f | ||
|
|
72732879fa | ||
|
|
a56fc93a9a | ||
|
|
24a934275f | ||
|
|
58f634bffe | ||
|
|
ca4a754f2c | ||
|
|
8015688df3 | ||
|
|
b07913d66d | ||
|
|
6b49a8a341 | ||
|
|
0e56527e05 | ||
|
|
12cdc60af7 | ||
|
|
dba17fbcbc | ||
|
|
ba79234ceb | ||
|
|
067809ef1c | ||
|
|
bdf12e5c01 | ||
|
|
97201c56a4 | ||
|
|
4a6daf45e0 | ||
|
|
7691d616a9 | ||
|
|
2c6d833c11 | ||
|
|
f4e15e2db8 | ||
|
|
a8b716fbaa | ||
|
|
ef7b919175 | ||
|
|
973ab78761 | ||
|
|
c4b0ac209b | ||
|
|
41320a4813 | ||
|
|
c410a9fc3f | ||
|
|
24e35103ff | ||
|
|
616f2abbb2 | ||
|
|
3910769ae8 | ||
|
|
b67e1deda5 | ||
|
|
35ca313c37 | ||
|
|
c631689975 | ||
|
|
cd64ca199a | ||
|
|
be60fdebcc | ||
|
|
d076e04ad4 | ||
|
|
7e0cddc06b | ||
|
|
258444bb93 | ||
|
|
75ce59d010 | ||
|
|
cbfcd54858 | ||
|
|
415fb6034e | ||
|
|
445a1fb2d6 | ||
|
|
c866bce8e8 | ||
|
|
ed4ca3bd1b | ||
|
|
bb9764bc6b | ||
|
|
05578bfcb6 | ||
|
|
a7c2054cce | ||
|
|
52ad0e0e5b | ||
|
|
dc8b73b12b | ||
|
|
18acdf20a6 | ||
|
|
0a23f18fc9 | ||
|
|
b8366d796d | ||
|
|
5ee8cb3a3f | ||
|
|
4e3a242f2f | ||
|
|
68c38e2b5c | ||
|
|
f1d14fdeca | ||
|
|
a5550cff18 |
No files matched your search
+77
@@ -12,20 +12,27 @@ trans.da_DK = UI/MailerUI/Danish.lproj/Localizable.strings
|
||||
trans.de = UI/MailerUI/German.lproj/Localizable.strings
|
||||
trans.es_AR = UI/MailerUI/SpanishArgentina.lproj/Localizable.strings
|
||||
trans.es_ES = UI/MailerUI/SpanishSpain.lproj/Localizable.strings
|
||||
trans.eu = UI/MailerUI/Basque.lproj/Localizable.strings
|
||||
trans.fi = UI/MailerUI/Finnish.lproj/Localizable.strings
|
||||
trans.fr = UI/MailerUI/French.lproj/Localizable.strings
|
||||
trans.hr_HR = UI/MailerUI/Croatian.lproj/Localizable.strings
|
||||
trans.hu = UI/MailerUI/Hungarian.lproj/Localizable.strings
|
||||
trans.is = UI/MailerUI/Icelandic.lproj/Localizable.strings
|
||||
trans.it = UI/MailerUI/Italian.lproj/Localizable.strings
|
||||
trans.lt = UI/MailerUI/Lithuanian.lproj/Localizable.strings
|
||||
trans.mk_MK = UI/MailerUI/Macedonian.lproj/Localizable.strings
|
||||
trans.nb_NO = UI/MailerUI/NorwegianBokmal.lproj/Localizable.strings
|
||||
trans.nl = UI/MailerUI/Dutch.lproj/Localizable.strings
|
||||
trans.nn_NO = UI/MailerUI/NorwegianNynorsk.lproj/Localizable.strings
|
||||
trans.pl = UI/MailerUI/Polish.lproj/Localizable.strings
|
||||
trans.pt = UI/MailerUI/Portuguese.lproj/Localizable.strings
|
||||
trans.pt_BR = UI/MailerUI/BrazilianPortuguese.lproj/Localizable.strings
|
||||
trans.ru = UI/MailerUI/Russian.lproj/Localizable.strings
|
||||
trans.sk = UI/MailerUI/Slovak.lproj/Localizable.strings
|
||||
trans.sl_SI = UI/MailerUI/Slovenian.lproj/Localizable.strings
|
||||
trans.sv = UI/MailerUI/Swedish.lproj/Localizable.strings
|
||||
trans.uk = UI/MailerUI/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_TW = UI/MailerUI/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.ui-preferencesui]
|
||||
source_file = UI/PreferencesUI/English.lproj/Localizable.strings
|
||||
@@ -38,20 +45,27 @@ trans.da_DK = UI/PreferencesUI/Danish.lproj/Localizable.strings
|
||||
trans.de = UI/PreferencesUI/German.lproj/Localizable.strings
|
||||
trans.es_AR = UI/PreferencesUI/SpanishArgentina.lproj/Localizable.strings
|
||||
trans.es_ES = UI/PreferencesUI/SpanishSpain.lproj/Localizable.strings
|
||||
trans.eu = UI/PreferencesUI/Basque.lproj/Localizable.strings
|
||||
trans.fi = UI/PreferencesUI/Finnish.lproj/Localizable.strings
|
||||
trans.fr = UI/PreferencesUI/French.lproj/Localizable.strings
|
||||
trans.hr_HR = UI/PreferencesUI/Croatian.lproj/Localizable.strings
|
||||
trans.hu = UI/PreferencesUI/Hungarian.lproj/Localizable.strings
|
||||
trans.is = UI/PreferencesUI/Icelandic.lproj/Localizable.strings
|
||||
trans.it = UI/PreferencesUI/Italian.lproj/Localizable.strings
|
||||
trans.lt = UI/PreferencesUI/Lithuanian.lproj/Localizable.strings
|
||||
trans.mk_MK = UI/PreferencesUI/Macedonian.lproj/Localizable.strings
|
||||
trans.nb_NO = UI/PreferencesUI/NorwegianBokmal.lproj/Localizable.strings
|
||||
trans.nl = UI/PreferencesUI/Dutch.lproj/Localizable.strings
|
||||
trans.nn_NO = UI/PreferencesUI/NorwegianNynorsk.lproj/Localizable.strings
|
||||
trans.pl = UI/PreferencesUI/Polish.lproj/Localizable.strings
|
||||
trans.pt = UI/PreferencesUI/Portuguese.lproj/Localizable.strings
|
||||
trans.pt_BR = UI/PreferencesUI/BrazilianPortuguese.lproj/Localizable.strings
|
||||
trans.ru = UI/PreferencesUI/Russian.lproj/Localizable.strings
|
||||
trans.sk = UI/PreferencesUI/Slovak.lproj/Localizable.strings
|
||||
trans.sl_SI = UI/PreferencesUI/Slovenian.lproj/Localizable.strings
|
||||
trans.sv = UI/PreferencesUI/Swedish.lproj/Localizable.strings
|
||||
trans.uk = UI/PreferencesUI/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_TW = UI/PreferencesUI/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.ui-scheduler]
|
||||
source_file = UI/Scheduler/English.lproj/Localizable.strings
|
||||
@@ -64,20 +78,27 @@ trans.da_DK = UI/Scheduler/Danish.lproj/Localizable.strings
|
||||
trans.de = UI/Scheduler/German.lproj/Localizable.strings
|
||||
trans.es_AR = UI/Scheduler/SpanishArgentina.lproj/Localizable.strings
|
||||
trans.es_ES = UI/Scheduler/SpanishSpain.lproj/Localizable.strings
|
||||
trans.eu = UI/Scheduler/Basque.lproj/Localizable.strings
|
||||
trans.fi = UI/Scheduler/Finnish.lproj/Localizable.strings
|
||||
trans.fr = UI/Scheduler/French.lproj/Localizable.strings
|
||||
trans.hr_HR = UI/Scheduler/Croatian.lproj/Localizable.strings
|
||||
trans.hu = UI/Scheduler/Hungarian.lproj/Localizable.strings
|
||||
trans.is = UI/Scheduler/Icelandic.lproj/Localizable.strings
|
||||
trans.it = UI/Scheduler/Italian.lproj/Localizable.strings
|
||||
trans.lt = UI/Scheduler/Lithuanian.lproj/Localizable.strings
|
||||
trans.mk_MK = UI/Scheduler/Macedonian.lproj/Localizable.strings
|
||||
trans.nb_NO = UI/Scheduler/NorwegianBokmal.lproj/Localizable.strings
|
||||
trans.nl = UI/Scheduler/Dutch.lproj/Localizable.strings
|
||||
trans.nn_NO = UI/Scheduler/NorwegianNynorsk.lproj/Localizable.strings
|
||||
trans.pl = UI/Scheduler/Polish.lproj/Localizable.strings
|
||||
trans.pt = UI/Scheduler/Portuguese.lproj/Localizable.strings
|
||||
trans.pt_BR = UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings
|
||||
trans.ru = UI/Scheduler/Russian.lproj/Localizable.strings
|
||||
trans.sk = UI/Scheduler/Slovak.lproj/Localizable.strings
|
||||
trans.sl_SI = UI/Scheduler/Slovenian.lproj/Localizable.strings
|
||||
trans.sv = UI/Scheduler/Swedish.lproj/Localizable.strings
|
||||
trans.uk = UI/Scheduler/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_TW = UI/Scheduler/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.ui-contacts]
|
||||
source_file = UI/Contacts/English.lproj/Localizable.strings
|
||||
@@ -90,20 +111,27 @@ trans.da_DK = UI/Contacts/Danish.lproj/Localizable.strings
|
||||
trans.de = UI/Contacts/German.lproj/Localizable.strings
|
||||
trans.es_AR = UI/Contacts/SpanishArgentina.lproj/Localizable.strings
|
||||
trans.es_ES = UI/Contacts/SpanishSpain.lproj/Localizable.strings
|
||||
trans.eu = UI/Contacts/Basque.lproj/Localizable.strings
|
||||
trans.fi = UI/Contacts/Finnish.lproj/Localizable.strings
|
||||
trans.fr = UI/Contacts/French.lproj/Localizable.strings
|
||||
trans.hr_HR = UI/Contacts/Croatian.lproj/Localizable.strings
|
||||
trans.hu = UI/Contacts/Hungarian.lproj/Localizable.strings
|
||||
trans.is = UI/Contacts/Icelandic.lproj/Localizable.strings
|
||||
trans.it = UI/Contacts/Italian.lproj/Localizable.strings
|
||||
trans.lt = UI/Contacts/Lithuanian.lproj/Localizable.strings
|
||||
trans.mk_MK = UI/Contacts/Macedonian.lproj/Localizable.strings
|
||||
trans.nb_NO = UI/Contacts/NorwegianBokmal.lproj/Localizable.strings
|
||||
trans.nl = UI/Contacts/Dutch.lproj/Localizable.strings
|
||||
trans.nn_NO = UI/Contacts/NorwegianNynorsk.lproj/Localizable.strings
|
||||
trans.pl = UI/Contacts/Polish.lproj/Localizable.strings
|
||||
trans.pt = UI/Contacts/Portuguese.lproj/Localizable.strings
|
||||
trans.pt_BR = UI/Contacts/BrazilianPortuguese.lproj/Localizable.strings
|
||||
trans.ru = UI/Contacts/Russian.lproj/Localizable.strings
|
||||
trans.sk = UI/Contacts/Slovak.lproj/Localizable.strings
|
||||
trans.sl_SI = UI/Contacts/Slovenian.lproj/Localizable.strings
|
||||
trans.sv = UI/Contacts/Swedish.lproj/Localizable.strings
|
||||
trans.uk = UI/Contacts/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_TW = UI/Contacts/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.ui-mainui]
|
||||
source_file = UI/MainUI/English.lproj/Localizable.strings
|
||||
@@ -116,20 +144,27 @@ trans.da_DK = UI/MainUI/Danish.lproj/Localizable.strings
|
||||
trans.de = UI/MainUI/German.lproj/Localizable.strings
|
||||
trans.es_AR = UI/MainUI/SpanishArgentina.lproj/Localizable.strings
|
||||
trans.es_ES = UI/MainUI/SpanishSpain.lproj/Localizable.strings
|
||||
trans.eu = UI/MainUI/Basque.lproj/Localizable.strings
|
||||
trans.fi = UI/MainUI/Finnish.lproj/Localizable.strings
|
||||
trans.fr = UI/MainUI/French.lproj/Localizable.strings
|
||||
trans.hr_HR = UI/MainUI/Croatian.lproj/Localizable.strings
|
||||
trans.hu = UI/MainUI/Hungarian.lproj/Localizable.strings
|
||||
trans.is = UI/MainUI/Icelandic.lproj/Localizable.strings
|
||||
trans.it = UI/MainUI/Italian.lproj/Localizable.strings
|
||||
trans.lt = UI/MainUI/Lithuanian.lproj/Localizable.strings
|
||||
trans.mk_MK = UI/MainUI/Macedonian.lproj/Localizable.strings
|
||||
trans.nb_NO = UI/MainUI/NorwegianBokmal.lproj/Localizable.strings
|
||||
trans.nl = UI/MainUI/Dutch.lproj/Localizable.strings
|
||||
trans.nn_NO = UI/MainUI/NorwegianNynorsk.lproj/Localizable.strings
|
||||
trans.pl = UI/MainUI/Polish.lproj/Localizable.strings
|
||||
trans.pt = UI/MainUI/Portuguese.lproj/Localizable.strings
|
||||
trans.pt_BR = UI/MainUI/BrazilianPortuguese.lproj/Localizable.strings
|
||||
trans.ru = UI/MainUI/Russian.lproj/Localizable.strings
|
||||
trans.sk = UI/MainUI/Slovak.lproj/Localizable.strings
|
||||
trans.sl_SI = UI/MainUI/Slovenian.lproj/Localizable.strings
|
||||
trans.sv = UI/MainUI/Swedish.lproj/Localizable.strings
|
||||
trans.uk = UI/MainUI/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_TW = UI/MainUI/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.ui-common]
|
||||
source_file = UI/Common/English.lproj/Localizable.strings
|
||||
@@ -142,20 +177,27 @@ trans.da_DK = UI/Common/Danish.lproj/Localizable.strings
|
||||
trans.de = UI/Common/German.lproj/Localizable.strings
|
||||
trans.es_AR = UI/Common/SpanishArgentina.lproj/Localizable.strings
|
||||
trans.es_ES = UI/Common/SpanishSpain.lproj/Localizable.strings
|
||||
trans.eu = UI/Common/Basque.lproj/Localizable.strings
|
||||
trans.fi = UI/Common/Finnish.lproj/Localizable.strings
|
||||
trans.fr = UI/Common/French.lproj/Localizable.strings
|
||||
trans.hr_HR = UI/Common/Croatian.lproj/Localizable.strings
|
||||
trans.hu = UI/Common/Hungarian.lproj/Localizable.strings
|
||||
trans.is = UI/Common/Icelandic.lproj/Localizable.strings
|
||||
trans.it = UI/Common/Italian.lproj/Localizable.strings
|
||||
trans.lt = UI/Common/Lithuanian.lproj/Localizable.strings
|
||||
trans.mk_MK = UI/Common/Macedonian.lproj/Localizable.strings
|
||||
trans.nb_NO = UI/Common/NorwegianBokmal.lproj/Localizable.strings
|
||||
trans.nl = UI/Common/Dutch.lproj/Localizable.strings
|
||||
trans.nn_NO = UI/Common/NorwegianNynorsk.lproj/Localizable.strings
|
||||
trans.pl = UI/Common/Polish.lproj/Localizable.strings
|
||||
trans.pt = UI/Common/Portuguese.lproj/Localizable.strings
|
||||
trans.pt_BR = UI/Common/BrazilianPortuguese.lproj/Localizable.strings
|
||||
trans.ru = UI/Common/Russian.lproj/Localizable.strings
|
||||
trans.sk = UI/Common/Slovak.lproj/Localizable.strings
|
||||
trans.sl_SI = UI/Common/Slovenian.lproj/Localizable.strings
|
||||
trans.sv = UI/Common/Swedish.lproj/Localizable.strings
|
||||
trans.uk = UI/Common/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_TW = UI/Common/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.ui-administrationui]
|
||||
source_file = UI/AdministrationUI/English.lproj/Localizable.strings
|
||||
@@ -168,20 +210,27 @@ trans.da_DK = UI/AdministrationUI/Danish.lproj/Localizable.strings
|
||||
trans.de = UI/AdministrationUI/German.lproj/Localizable.strings
|
||||
trans.es_AR = UI/AdministrationUI/SpanishArgentina.lproj/Localizable.strings
|
||||
trans.es_ES = UI/AdministrationUI/SpanishSpain.lproj/Localizable.strings
|
||||
trans.eu = UI/AdministrationUI/Basque.lproj/Localizable.strings
|
||||
trans.fi = UI/AdministrationUI/Finnish.lproj/Localizable.strings
|
||||
trans.fr = UI/AdministrationUI/French.lproj/Localizable.strings
|
||||
trans.hr_HR = UI/AdministrationUI/Croatian.lproj/Localizable.strings
|
||||
trans.hu = UI/AdministrationUI/Hungarian.lproj/Localizable.strings
|
||||
trans.is = UI/AdministrationUI/Icelandic.lproj/Localizable.strings
|
||||
trans.it = UI/AdministrationUI/Italian.lproj/Localizable.strings
|
||||
trans.lt = UI/AdministrationUI/Lithuanian.lproj/Localizable.strings
|
||||
trans.mk_MK = UI/AdministrationUI/Macedonian.lproj/Localizable.strings
|
||||
trans.nb_NO = UI/AdministrationUI/NorwegianBokmal.lproj/Localizable.strings
|
||||
trans.nl = UI/AdministrationUI/Dutch.lproj/Localizable.strings
|
||||
trans.nn_NO = UI/AdministrationUI/NorwegianNynorsk.lproj/Localizable.strings
|
||||
trans.pl = UI/AdministrationUI/Polish.lproj/Localizable.strings
|
||||
trans.pt = UI/AdministrationUI/Portuguese.lproj/Localizable.strings
|
||||
trans.pt_BR = UI/AdministrationUI/BrazilianPortuguese.lproj/Localizable.strings
|
||||
trans.ru = UI/AdministrationUI/Russian.lproj/Localizable.strings
|
||||
trans.sk = UI/AdministrationUI/Slovak.lproj/Localizable.strings
|
||||
trans.sl_SI = UI/AdministrationUI/Slovenian.lproj/Localizable.strings
|
||||
trans.sv = UI/AdministrationUI/Swedish.lproj/Localizable.strings
|
||||
trans.uk = UI/AdministrationUI/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_TW = UI/AdministrationUI/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.soobjects-appointments]
|
||||
source_file = SoObjects/Appointments/English.lproj/Localizable.strings
|
||||
@@ -194,20 +243,27 @@ trans.da_DK = SoObjects/Appointments/Danish.lproj/Localizable.strings
|
||||
trans.de = SoObjects/Appointments/German.lproj/Localizable.strings
|
||||
trans.es_AR = SoObjects/Appointments/SpanishArgentina.lproj/Localizable.strings
|
||||
trans.es_ES = SoObjects/Appointments/SpanishSpain.lproj/Localizable.strings
|
||||
trans.eu = SoObjects/Appointments/Basque.lproj/Localizable.strings
|
||||
trans.fi = SoObjects/Appointments/Finnish.lproj/Localizable.strings
|
||||
trans.fr = SoObjects/Appointments/French.lproj/Localizable.strings
|
||||
trans.hr_HR = SoObjects/Appointments/Croatian.lproj/Localizable.strings
|
||||
trans.hu = SoObjects/Appointments/Hungarian.lproj/Localizable.strings
|
||||
trans.is = SoObjects/Appointments/Icelandic.lproj/Localizable.strings
|
||||
trans.it = SoObjects/Appointments/Italian.lproj/Localizable.strings
|
||||
trans.lt = SoObjects/Appointments/Lithuanian.lproj/Localizable.strings
|
||||
trans.mk_MK = SoObjects/Appointments/Macedonian.lproj/Localizable.strings
|
||||
trans.nb_NO = SoObjects/Appointments/NorwegianBokmal.lproj/Localizable.strings
|
||||
trans.nl = SoObjects/Appointments/Dutch.lproj/Localizable.strings
|
||||
trans.nn_NO = SoObjects/Appointments/NorwegianNynorsk.lproj/Localizable.strings
|
||||
trans.pl = SoObjects/Appointments/Polish.lproj/Localizable.strings
|
||||
trans.pt = SoObjects/Appointments/Portuguese.lproj/Localizable.strings
|
||||
trans.pt_BR = SoObjects/Appointments/BrazilianPortuguese.lproj/Localizable.strings
|
||||
trans.ru = SoObjects/Appointments/Russian.lproj/Localizable.strings
|
||||
trans.sk = SoObjects/Appointments/Slovak.lproj/Localizable.strings
|
||||
trans.sl_SI = SoObjects/Appointments/Slovenian.lproj/Localizable.strings
|
||||
trans.sv = SoObjects/Appointments/Swedish.lproj/Localizable.strings
|
||||
trans.uk = SoObjects/Appointments/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_TW = SoObjects/Appointments/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.soobjects-contacts]
|
||||
source_file = SoObjects/Contacts/English.lproj/Localizable.strings
|
||||
@@ -220,20 +276,27 @@ trans.da_DK = SoObjects/Contacts/Danish.lproj/Localizable.strings
|
||||
trans.de = SoObjects/Contacts/German.lproj/Localizable.strings
|
||||
trans.es_AR = SoObjects/Contacts/SpanishArgentina.lproj/Localizable.strings
|
||||
trans.es_ES = SoObjects/Contacts/SpanishSpain.lproj/Localizable.strings
|
||||
trans.eu = SoObjects/Contacts/Basque.lproj/Localizable.strings
|
||||
trans.fi = SoObjects/Contacts/Finnish.lproj/Localizable.strings
|
||||
trans.fr = SoObjects/Contacts/French.lproj/Localizable.strings
|
||||
trans.hr_HR = SoObjects/Contacts/Croatian.lproj/Localizable.strings
|
||||
trans.hu = SoObjects/Contacts/Hungarian.lproj/Localizable.strings
|
||||
trans.is = SoObjects/Contacts/Icelandic.lproj/Localizable.strings
|
||||
trans.it = SoObjects/Contacts/Italian.lproj/Localizable.strings
|
||||
trans.lt = SoObjects/Contacts/Lithuanian.lproj/Localizable.strings
|
||||
trans.mk_MK = SoObjects/Contacts/Macedonian.lproj/Localizable.strings
|
||||
trans.nb_NO = SoObjects/Contacts/NorwegianBokmal.lproj/Localizable.strings
|
||||
trans.nl = SoObjects/Contacts/Dutch.lproj/Localizable.strings
|
||||
trans.nn_NO = SoObjects/Contacts/NorwegianNynorsk.lproj/Localizable.strings
|
||||
trans.pl = SoObjects/Contacts/Polish.lproj/Localizable.strings
|
||||
trans.pt = SoObjects/Contacts/Portuguese.lproj/Localizable.strings
|
||||
trans.pt_BR = SoObjects/Contacts/BrazilianPortuguese.lproj/Localizable.strings
|
||||
trans.ru = SoObjects/Contacts/Russian.lproj/Localizable.strings
|
||||
trans.sk = SoObjects/Contacts/Slovak.lproj/Localizable.strings
|
||||
trans.sl_SI = SoObjects/Contacts/Slovenian.lproj/Localizable.strings
|
||||
trans.sv = SoObjects/Contacts/Swedish.lproj/Localizable.strings
|
||||
trans.uk = SoObjects/Contacts/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_TW = SoObjects/Contacts/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.soobjects-mailer]
|
||||
source_file = SoObjects/Mailer/English.lproj/Localizable.strings
|
||||
@@ -246,20 +309,27 @@ trans.da_DK = SoObjects/Mailer/Danish.lproj/Localizable.strings
|
||||
trans.de = SoObjects/Mailer/German.lproj/Localizable.strings
|
||||
trans.es_AR = SoObjects/Mailer/SpanishArgentina.lproj/Localizable.strings
|
||||
trans.es_ES = SoObjects/Mailer/SpanishSpain.lproj/Localizable.strings
|
||||
trans.eu = SoObjects/Mailer/Basque.lproj/Localizable.strings
|
||||
trans.fi = SoObjects/Mailer/Finnish.lproj/Localizable.strings
|
||||
trans.fr = SoObjects/Mailer/French.lproj/Localizable.strings
|
||||
trans.hr_HR = SoObjects/Mailer/Croatian.lproj/Localizable.strings
|
||||
trans.hu = SoObjects/Mailer/Hungarian.lproj/Localizable.strings
|
||||
trans.is = SoObjects/Mailer/Icelandic.lproj/Localizable.strings
|
||||
trans.it = SoObjects/Mailer/Italian.lproj/Localizable.strings
|
||||
trans.lt = SoObjects/Mailer/Lithuanian.lproj/Localizable.strings
|
||||
trans.mk_MK = SoObjects/Mailer/Macedonian.lproj/Localizable.strings
|
||||
trans.nb_NO = SoObjects/Mailer/NorwegianBokmal.lproj/Localizable.strings
|
||||
trans.nl = SoObjects/Mailer/Dutch.lproj/Localizable.strings
|
||||
trans.nn_NO = SoObjects/Mailer/NorwegianNynorsk.lproj/Localizable.strings
|
||||
trans.pl = SoObjects/Mailer/Polish.lproj/Localizable.strings
|
||||
trans.pt = SoObjects/Mailer/Portuguese.lproj/Localizable.strings
|
||||
trans.pt_BR = SoObjects/Mailer/BrazilianPortuguese.lproj/Localizable.strings
|
||||
trans.ru = SoObjects/Mailer/Russian.lproj/Localizable.strings
|
||||
trans.sk = SoObjects/Mailer/Slovak.lproj/Localizable.strings
|
||||
trans.sl_SI = SoObjects/Mailer/Slovenian.lproj/Localizable.strings
|
||||
trans.sv = SoObjects/Mailer/Swedish.lproj/Localizable.strings
|
||||
trans.uk = SoObjects/Mailer/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_TW = SoObjects/Mailer/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.ui-mailpartviewers]
|
||||
source_file = UI/MailPartViewers/English.lproj/Localizable.strings
|
||||
@@ -272,17 +342,24 @@ trans.da_DK = UI/MailPartViewers/Danish.lproj/Localizable.strings
|
||||
trans.de = UI/MailPartViewers/German.lproj/Localizable.strings
|
||||
trans.es_AR = UI/MailPartViewers/SpanishArgentina.lproj/Localizable.strings
|
||||
trans.es_ES = UI/MailPartViewers/SpanishSpain.lproj/Localizable.strings
|
||||
trans.eu = UI/MailPartViewers/Basque.lproj/Localizable.strings
|
||||
trans.fi = UI/MailPartViewers/Finnish.lproj/Localizable.strings
|
||||
trans.fr = UI/MailPartViewers/French.lproj/Localizable.strings
|
||||
trans.hr_HR = UI/MailPartViewers/Croatian.lproj/Localizable.strings
|
||||
trans.hu = UI/MailPartViewers/Hungarian.lproj/Localizable.strings
|
||||
trans.is = UI/MailPartViewers/Icelandic.lproj/Localizable.strings
|
||||
trans.it = UI/MailPartViewers/Italian.lproj/Localizable.strings
|
||||
trans.lt = UI/MailPartViewers/Lithuanian.lproj/Localizable.strings
|
||||
trans.mk_MK = UI/MailPartViewers/Macedonian.lproj/Localizable.strings
|
||||
trans.nb_NO = UI/MailPartViewers/NorwegianBokmal.lproj/Localizable.strings
|
||||
trans.nl = UI/MailPartViewers/Dutch.lproj/Localizable.strings
|
||||
trans.nn_NO = UI/MailPartViewers/NorwegianNynorsk.lproj/Localizable.strings
|
||||
trans.pl = UI/MailPartViewers/Polish.lproj/Localizable.strings
|
||||
trans.pt = UI/MailPartViewers/Portuguese.lproj/Localizable.strings
|
||||
trans.pt_BR = UI/MailPartViewers/BrazilianPortuguese.lproj/Localizable.strings
|
||||
trans.ru = UI/MailPartViewers/Russian.lproj/Localizable.strings
|
||||
trans.sk = UI/MailPartViewers/Slovak.lproj/Localizable.strings
|
||||
trans.sl_SI = UI/MailPartViewers/Slovenian.lproj/Localizable.strings
|
||||
trans.sv = UI/MailPartViewers/Swedish.lproj/Localizable.strings
|
||||
trans.uk = UI/MailPartViewers/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_TW = UI/MailPartViewers/ChineseTaiwan.lproj/Localizable.strings
|
||||
@@ -1 +1,4 @@
|
||||
# compilation settings
|
||||
ifeq ($(HAS_LIBRARY_ssl),yes)
|
||||
ADDITIONAL_CPPFLAGS += -DHAVE_OPENSSL=1
|
||||
BUNDLE_LIBS += -lcrypto
|
||||
endif
|
||||
@@ -101,7 +101,7 @@ static NSArray *asElementArray = nil;
|
||||
int i, count;
|
||||
|
||||
if (!asElementArray)
|
||||
asElementArray = [[NSArray alloc] initWithObjects: @"Attendee", @"Category", nil];
|
||||
asElementArray = [[NSArray alloc] initWithObjects: @"Attendee", @"Category", @"Exception", nil];
|
||||
|
||||
data = [NSMutableDictionary dictionary];
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2014, Inverse inc.
|
||||
Copyright (c) 2015, Inverse inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -40,35 +40,38 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@implementation NGMimeMessage (ActiveSync)
|
||||
|
||||
- (NSArray *) allRecipients
|
||||
- (void) _addRecipients: (NSEnumerator *) enumerator
|
||||
toArray: (NSMutableArray *) recipients
|
||||
{
|
||||
NSEnumerator *enumerator, *addressList;
|
||||
NSMutableArray *recipients;
|
||||
NGMailAddressParser *parser;
|
||||
NSEnumerator *addressList;
|
||||
NGMailAddress *address;
|
||||
NSString *s;
|
||||
|
||||
while ((s = [enumerator nextObject]))
|
||||
{
|
||||
parser = [NGMailAddressParser mailAddressParserWithString: s];
|
||||
addressList = [[parser parseAddressList] objectEnumerator];
|
||||
|
||||
while ((address = [addressList nextObject]))
|
||||
[recipients addObject: [address address]];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray *) allRecipients
|
||||
{
|
||||
NSMutableArray *recipients;
|
||||
|
||||
recipients = [NSMutableArray array];
|
||||
|
||||
enumerator = [[self headersForKey: @"to"] objectEnumerator];
|
||||
while ((s = [enumerator nextObject]))
|
||||
{
|
||||
parser = [NGMailAddressParser mailAddressParserWithString: s];
|
||||
addressList = [[parser parseAddressList] objectEnumerator];
|
||||
|
||||
while ((address = [addressList nextObject]))
|
||||
[recipients addObject: [address address]];
|
||||
}
|
||||
[self _addRecipients: [[self headersForKey: @"to"] objectEnumerator]
|
||||
toArray: recipients];
|
||||
|
||||
enumerator = [[self headersForKey: @"cc"] objectEnumerator];
|
||||
while ((s = [enumerator nextObject]))
|
||||
{
|
||||
parser = [NGMailAddressParser mailAddressParserWithString: s];
|
||||
addressList = [[parser parseAddressList] objectEnumerator];
|
||||
|
||||
while ((address = [addressList nextObject]))
|
||||
[recipients addObject: [address address]];
|
||||
}
|
||||
[self _addRecipients: [[self headersForKey: @"cc"] objectEnumerator]
|
||||
toArray: recipients];
|
||||
|
||||
[self _addRecipients: [[self headersForKey: @"bcc"] objectEnumerator]
|
||||
toArray: recipients];
|
||||
|
||||
return recipients;
|
||||
}
|
||||
|
||||
+200
-52
@@ -33,6 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#import <Foundation/NSCalendarDate.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSTimeZone.h>
|
||||
|
||||
#import <NGExtensions/NSString+misc.h>
|
||||
|
||||
@@ -45,13 +46,49 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "NSDate+ActiveSync.h"
|
||||
#include "NSString+ActiveSync.h"
|
||||
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserDefaults.h>
|
||||
|
||||
@implementation NGVCard (ActiveSync)
|
||||
|
||||
//
|
||||
// This function is called for each elements which can be ghosted according to specs.
|
||||
// https://msdn.microsoft.com/en-us/library/gg650908%28v=exchg.80%29.aspx
|
||||
//
|
||||
- (BOOL) _isGhosted: (NSString *) element
|
||||
inContext: (WOContext *) context
|
||||
{
|
||||
NSArray *supportedElements;
|
||||
|
||||
supportedElements = [context objectForKey: @"SupportedElements"];
|
||||
|
||||
// If the client does not include a Supported element in the initial Sync command request for
|
||||
// a folder, then all of the elements that can be ghosted are considered not ghosted.
|
||||
if (!supportedElements)
|
||||
return NO;
|
||||
|
||||
// If the client includes an empty Supported element in the initial Sync command request for
|
||||
// a folder, then all elements that can be ghosted are considered ghosted.
|
||||
if (![supportedElements count])
|
||||
return YES;
|
||||
|
||||
// If the client includes a Supported element that contains child elements in the initial
|
||||
// Sync command request for a folder, then each child element of that Supported element is
|
||||
// considered not ghosted. All elements that can be ghosted that are not included as child
|
||||
// elements of the Supported element are considered ghosted.
|
||||
if (!([supportedElements indexOfObject: element] == NSNotFound))
|
||||
return YES;
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
|
||||
{
|
||||
NSArray *emails, *addresses, *categories, *elements;
|
||||
CardElement *n, *homeAdr, *workAdr;
|
||||
NSMutableString *s;
|
||||
NSMutableString *s, *a;
|
||||
NSString *url;
|
||||
id o;
|
||||
|
||||
@@ -62,7 +99,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
if ((o = [n flattenedValueAtIndex: 0 forKey: @""]))
|
||||
[s appendFormat: @"<LastName xmlns=\"Contacts:\">%@</LastName>", [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
|
||||
if ((o = [n flattenedValueAtIndex: 1 forKey: @""]))
|
||||
[s appendFormat: @"<FirstName xmlns=\"Contacts:\">%@</FirstName>", [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
@@ -145,16 +182,22 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
if ([addresses count])
|
||||
{
|
||||
homeAdr = [addresses objectAtIndex: 0];
|
||||
a = [NSMutableString string];
|
||||
|
||||
if ((o = [homeAdr flattenedValueAtIndex: 2 forKey: @""]))
|
||||
[s appendFormat: @"<HomeStreet xmlns=\"Contacts:\">%@</HomeStreet>", [o activeSyncRepresentationInContext: context]];
|
||||
[a appendString: o];
|
||||
|
||||
if ((o = [homeAdr flattenedValueAtIndex: 1 forKey: @""]) && [o length])
|
||||
[a appendFormat: @"\n%@", o];
|
||||
|
||||
[s appendFormat: @"<HomeStreet xmlns=\"Contacts:\">%@</HomeStreet>", [a activeSyncRepresentationInContext: context]];
|
||||
|
||||
if ((o = [homeAdr flattenedValueAtIndex: 3 forKey: @""]))
|
||||
[s appendFormat: @"<HomeCity xmlns=\"Contacts:\">%@</HomeCity>", [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
if ((o = [homeAdr flattenedValueAtIndex: 4 forKey: @""]))
|
||||
[s appendFormat: @"<HomeState xmlns=\"Contacts:\">%@</HomeState>", [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
|
||||
if ((o = [homeAdr flattenedValueAtIndex: 5 forKey: @""]))
|
||||
[s appendFormat: @"<HomePostalCode xmlns=\"Contacts:\">%@</HomePostalCode>", [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
@@ -170,9 +213,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
if ([addresses count])
|
||||
{
|
||||
workAdr = [addresses objectAtIndex: 0];
|
||||
a = [NSMutableString string];
|
||||
|
||||
if ((o = [workAdr flattenedValueAtIndex: 2 forKey: @""]))
|
||||
[s appendFormat: @"<BusinessStreet xmlns=\"Contacts:\">%@</BusinessStreet>", [o activeSyncRepresentationInContext: context]];
|
||||
[a appendString: o];
|
||||
|
||||
if ((o = [workAdr flattenedValueAtIndex: 1 forKey: @""]) && [o length])
|
||||
[a appendFormat: @"\n%@", o];
|
||||
|
||||
[s appendFormat: @"<BusinessStreet xmlns=\"Contacts:\">%@</BusinessStreet>", [a activeSyncRepresentationInContext: context]];
|
||||
|
||||
if ((o = [workAdr flattenedValueAtIndex: 3 forKey: @""]))
|
||||
[s appendFormat: @"<BusinessCity xmlns=\"Contacts:\">%@</BusinessCity>", [o activeSyncRepresentationInContext: context]];
|
||||
@@ -189,15 +238,25 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Other, less important fields
|
||||
if ((o = [self birthday]))
|
||||
[s appendFormat: @"<Birthday xmlns=\"Contacts:\">%@</Birthday>", [o activeSyncRepresentationInContext: context]];
|
||||
{
|
||||
NSTimeZone *userTimeZone;
|
||||
userTimeZone = [[[context activeUser] userDefaults] timeZone];
|
||||
|
||||
[s appendFormat: @"<Birthday xmlns=\"Contacts:\">%@</Birthday>",
|
||||
[[o dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: ([userTimeZone secondsFromGMTForDate: o])*-1]
|
||||
activeSyncRepresentationInContext: context]];
|
||||
}
|
||||
|
||||
if ((o = [self note]))
|
||||
{
|
||||
// It is very important here to NOT set <Truncated>0</Truncated> in the response,
|
||||
// otherwise it'll prevent WP8 phones from sync'ing. See #3028 for details.
|
||||
o = [o activeSyncRepresentationInContext: context];
|
||||
[s appendString: @"<Body xmlns=\"AirSyncBase:\">"];
|
||||
[s appendFormat: @"<Type>%d</Type>", 1];
|
||||
[s appendFormat: @"<EstimatedDataSize>%d</EstimatedDataSize>", [o length]];
|
||||
[s appendFormat: @"<Truncated>%d</Truncated>", 0];
|
||||
[s appendFormat: @"<Data>%@</Data>", o];
|
||||
[s appendString: @"</Body>"];
|
||||
}
|
||||
@@ -215,6 +274,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
inContext: (WOContext *) context
|
||||
{
|
||||
CardElement *element;
|
||||
NSMutableArray *addressLines;
|
||||
id o;
|
||||
|
||||
// Contact's note
|
||||
@@ -224,13 +284,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// Categories
|
||||
if ((o = [theValues objectForKey: @"Categories"]) && [o length])
|
||||
[self setCategories: o];
|
||||
else
|
||||
[[self children] removeObjectsInArray: [self childrenWithTag: @"Categories"]];
|
||||
|
||||
// Birthday
|
||||
if ((o = [theValues objectForKey: @"Birthday"]))
|
||||
{
|
||||
o = [o calendarDate];
|
||||
[self setBday: [o descriptionWithCalendarFormat: @"%Y-%m-%d"]];
|
||||
[self setBday: [o descriptionWithCalendarFormat: @"%Y-%m-%d" timeZone: nil locale: nil]];
|
||||
}
|
||||
else if (![self _isGhosted: @"Birthday" inContext: context])
|
||||
{
|
||||
[self setBday: @""];
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Business address information
|
||||
@@ -242,18 +309,48 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// BusinessCountry
|
||||
//
|
||||
element = [self elementWithTag: @"adr" ofType: @"work"];
|
||||
[element setSingleValue: @""
|
||||
atIndex: 1 forKey: @""];
|
||||
[element setSingleValue: [theValues objectForKey: @"BusinessStreet"]
|
||||
atIndex: 2 forKey: @""];
|
||||
[element setSingleValue: [theValues objectForKey: @"BusinessCity"]
|
||||
atIndex: 3 forKey: @""];
|
||||
[element setSingleValue: [theValues objectForKey: @"BusinessState"]
|
||||
atIndex: 4 forKey: @""];
|
||||
[element setSingleValue: [theValues objectForKey: @"BusinessPostalCode"]
|
||||
atIndex: 5 forKey: @""];
|
||||
[element setSingleValue: [theValues objectForKey: @"BusinessCountry"]
|
||||
atIndex: 6 forKey: @""];
|
||||
|
||||
if ((o = [theValues objectForKey: @"BusinessStreet"]) || ![self _isGhosted: @"BusinessStreet" inContext: context])
|
||||
{
|
||||
addressLines = [NSMutableArray arrayWithArray: [o componentsSeparatedByString: @"\n"]];
|
||||
|
||||
[element setSingleValue: @""
|
||||
atIndex: 1 forKey: @""];
|
||||
[element setSingleValue: [addressLines count] ? [addressLines objectAtIndex: 0] : @""
|
||||
atIndex: 2 forKey: @""];
|
||||
|
||||
// Extended address line. If there are more than 2 address lines we add them to the extended address line.
|
||||
if ([addressLines count] > 1)
|
||||
{
|
||||
[addressLines removeObjectAtIndex: 0];
|
||||
[element setSingleValue: [addressLines componentsJoinedByString: @" "]
|
||||
atIndex: 1 forKey: @""];
|
||||
}
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"BusinessCity"]) || ![self _isGhosted: @"BusinessCity" inContext: context])
|
||||
{
|
||||
[element setSingleValue: [theValues objectForKey: @"BusinessCity"]
|
||||
atIndex: 3 forKey: @""];
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"BusinessState"]) || ![self _isGhosted: @"BusinessState" inContext: context])
|
||||
{
|
||||
[element setSingleValue: [theValues objectForKey: @"BusinessState"]
|
||||
atIndex: 4 forKey: @""];
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"BusinessPostalCode"]) || ![self _isGhosted: @"BusinessPostalCode" inContext: context])
|
||||
{
|
||||
[element setSingleValue: [theValues objectForKey: @"BusinessPostalCode"]
|
||||
atIndex: 5 forKey: @""];
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"BusinessCountry"]) || ![self _isGhosted: @"BusinessCountry" inContext: context])
|
||||
{
|
||||
[element setSingleValue: [theValues objectForKey: @"BusinessCountry"]
|
||||
atIndex: 6 forKey: @""];
|
||||
}
|
||||
|
||||
//
|
||||
// Home address information
|
||||
@@ -265,35 +362,69 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// HomeCountry
|
||||
//
|
||||
element = [self elementWithTag: @"adr" ofType: @"home"];
|
||||
[element setSingleValue: @""
|
||||
atIndex: 1 forKey: @""];
|
||||
[element setSingleValue: [theValues objectForKey: @"HomeStreet"]
|
||||
atIndex: 2 forKey: @""];
|
||||
[element setSingleValue: [theValues objectForKey: @"HomeCity"]
|
||||
atIndex: 3 forKey: @""];
|
||||
[element setSingleValue: [theValues objectForKey: @"HomeState"]
|
||||
atIndex: 4 forKey: @""];
|
||||
[element setSingleValue: [theValues objectForKey: @"HomePostalCode"]
|
||||
atIndex: 5 forKey: @""];
|
||||
[element setSingleValue: [theValues objectForKey: @"HomeCountry"]
|
||||
atIndex: 6 forKey: @""];
|
||||
|
||||
if ((o = [theValues objectForKey: @"HomeStreet"]) || ![self _isGhosted: @"HomeStreet" inContext: context])
|
||||
{
|
||||
addressLines = [NSMutableArray arrayWithArray: [o componentsSeparatedByString: @"\n"]];
|
||||
|
||||
[element setSingleValue: @""
|
||||
atIndex: 1 forKey: @""];
|
||||
[element setSingleValue: [addressLines count] ? [addressLines objectAtIndex: 0] : @""
|
||||
atIndex: 2 forKey: @""];
|
||||
|
||||
// Extended address line. If there are more then 2 address lines we add them to the extended address line.
|
||||
if ([addressLines count] > 1)
|
||||
{
|
||||
[addressLines removeObjectAtIndex: 0];
|
||||
[element setSingleValue: [addressLines componentsJoinedByString: @" "]
|
||||
atIndex: 1 forKey: @""];
|
||||
}
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"HomeCity"]) || ![self _isGhosted: @"HomeCity" inContext: context])
|
||||
{
|
||||
[element setSingleValue: [theValues objectForKey: @"HomeCity"]
|
||||
atIndex: 3 forKey: @""];
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"HomeState"]) || ![self _isGhosted: @"HomeState" inContext: context])
|
||||
{
|
||||
[element setSingleValue: [theValues objectForKey: @"HomeState"]
|
||||
atIndex: 4 forKey: @""];
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"HomePostalCode"]) || ![self _isGhosted: @"HomePostalCode" inContext: context])
|
||||
{
|
||||
[element setSingleValue: [theValues objectForKey: @"HomePostalCode"]
|
||||
atIndex: 5 forKey: @""];
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"HomeCountry"]) || ![self _isGhosted: @"HomeCountry" inContext: context])
|
||||
{
|
||||
[element setSingleValue: [theValues objectForKey: @"HomeCountry"]
|
||||
atIndex: 6 forKey: @""];
|
||||
}
|
||||
|
||||
// Company's name
|
||||
if ((o = [theValues objectForKey: @"CompanyName"]))
|
||||
[self setOrg: o units: nil];
|
||||
else if (![self _isGhosted: @"CompanyName" inContext: context])
|
||||
[self setOrg: @"" units: nil];
|
||||
|
||||
// Department
|
||||
if ((o = [theValues objectForKey: @"Department"]))
|
||||
[self setOrg: nil units: [NSArray arrayWithObjects:o,nil]];
|
||||
else if (![self _isGhosted: @"Department" inContext: context])
|
||||
[self setOrg: nil units: [NSArray arrayWithObjects:@"",nil]];
|
||||
|
||||
// Email addresses
|
||||
if ((o = [theValues objectForKey: @"Email1Address"]))
|
||||
if ((o = [theValues objectForKey: @"Email1Address"]) || ![self _isGhosted: @"Email1Address" inContext: context])
|
||||
{
|
||||
element = [self elementWithTag: @"email" ofType: @"work"];
|
||||
[element setSingleValue: [o pureEMailAddress] forKey: @""];
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"Email2Address"]))
|
||||
if ((o = [theValues objectForKey: @"Email2Address"]) || ![self _isGhosted: @"Email2Address" inContext: context])
|
||||
{
|
||||
element = [self elementWithTag: @"email" ofType: @"home"];
|
||||
[element setSingleValue: [o pureEMailAddress] forKey: @""];
|
||||
@@ -301,7 +432,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// SOGo currently only supports 2 email addresses ... but AS clients might send 3
|
||||
// FIXME: revise this when the GUI revamp is done in SOGo
|
||||
if ((o = [theValues objectForKey: @"Email3Address"]))
|
||||
if ((o = [theValues objectForKey: @"Email3Address"]) || ![self _isGhosted: @"Email3Address" inContext: context])
|
||||
{
|
||||
element = [self elementWithTag: @"email" ofType: @"three"];
|
||||
[element setSingleValue: [o pureEMailAddress] forKey: @""];
|
||||
@@ -311,45 +442,62 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// MiddleName
|
||||
// Suffix (II)
|
||||
// Title (Mr.)
|
||||
[self setFn: [theValues objectForKey: @"FileAs"]];
|
||||
if ((o = [theValues objectForKey: @"FileAs"]) || ![self _isGhosted: @"FileAs" inContext: context])
|
||||
[self setFn: [theValues objectForKey: @"FileAs"]];
|
||||
|
||||
[self setNWithFamily: [theValues objectForKey: @"LastName"]
|
||||
given: [theValues objectForKey: @"FirstName"]
|
||||
additional: nil prefixes: nil suffixes: nil];
|
||||
|
||||
// IM information
|
||||
[[self uniqueChildWithTag: @"x-aim"]
|
||||
setSingleValue: [theValues objectForKey: @"IMAddress"]
|
||||
forKey: @""];
|
||||
if ((o = [theValues objectForKey: @"IMAddress"]) || ![self _isGhosted: @"IMAddress" inContext: context])
|
||||
[[self uniqueChildWithTag: @"x-aim"]
|
||||
setSingleValue: [theValues objectForKey: @"IMAddress"]
|
||||
forKey: @""];
|
||||
|
||||
//
|
||||
// Phone numbrrs
|
||||
//
|
||||
element = [self elementWithTag: @"tel" ofType: @"work"];
|
||||
[element setSingleValue: [theValues objectForKey: @"BusinessPhoneNumber"] forKey: @""];
|
||||
if ((o = [theValues objectForKey: @"BusinessPhoneNumber"]) || ![self _isGhosted: @"BusinessPhoneNumber" inContext: context])
|
||||
{
|
||||
element = [self elementWithTag: @"tel" ofType: @"work"];
|
||||
[element setSingleValue: [theValues objectForKey: @"BusinessPhoneNumber"] forKey: @""];
|
||||
}
|
||||
|
||||
element = [self elementWithTag: @"tel" ofType: @"home"];
|
||||
[element setSingleValue: [theValues objectForKey: @"HomePhoneNumber"] forKey: @""];
|
||||
if ((o = [theValues objectForKey: @"HomePhoneNumber"]) || ![self _isGhosted: @"HomePhoneNumber" inContext: context])
|
||||
{
|
||||
element = [self elementWithTag: @"tel" ofType: @"home"];
|
||||
[element setSingleValue: [theValues objectForKey: @"HomePhoneNumber"] forKey: @""];
|
||||
}
|
||||
|
||||
element = [self elementWithTag: @"tel" ofType: @"cell"];
|
||||
[element setSingleValue: [theValues objectForKey: @"MobilePhoneNumber"] forKey: @""];
|
||||
if ((o = [theValues objectForKey: @"MobilePhoneNumber"]) || ![self _isGhosted: @"MobilePhoneNumber" inContext: context])
|
||||
{
|
||||
element = [self elementWithTag: @"tel" ofType: @"cell"];
|
||||
[element setSingleValue: [theValues objectForKey: @"MobilePhoneNumber"] forKey: @""];
|
||||
}
|
||||
|
||||
element = [self elementWithTag: @"tel" ofType: @"fax"];
|
||||
[element setSingleValue: [theValues objectForKey: @"BusinessFaxNumber"] forKey: @""];
|
||||
if ((o = [theValues objectForKey: @"BusinessFaxNumber"]) || ![self _isGhosted: @"BusinessFaxNumber" inContext: context])
|
||||
{
|
||||
element = [self elementWithTag: @"tel" ofType: @"fax"];
|
||||
[element setSingleValue: [theValues objectForKey: @"BusinessFaxNumber"] forKey: @""];
|
||||
}
|
||||
|
||||
element = [self elementWithTag: @"tel" ofType: @"pager"];
|
||||
[element setSingleValue: [theValues objectForKey: @"PagerNumber"] forKey: @""];
|
||||
if ((o = [theValues objectForKey: @"PagerNumber"]) || ![self _isGhosted: @"PagerNumber" inContext: context])
|
||||
{
|
||||
element = [self elementWithTag: @"tel" ofType: @"pager"];
|
||||
[element setSingleValue: [theValues objectForKey: @"PagerNumber"] forKey: @""];
|
||||
}
|
||||
|
||||
// Job's title
|
||||
if ((o = [theValues objectForKey: @"JobTitle"]))
|
||||
if ((o = [theValues objectForKey: @"JobTitle"]) || ![self _isGhosted: @"JobTitle" inContext: context])
|
||||
[self setTitle: o];
|
||||
|
||||
// WebPage (work)
|
||||
if ((o = [theValues objectForKey: @"WebPage"]))
|
||||
if ((o = [theValues objectForKey: @"WebPage"]) || ![self _isGhosted: @"WebPage" inContext: context])
|
||||
[[self elementWithTag: @"url" ofType: @"work"]
|
||||
setSingleValue: o forKey: @""];
|
||||
|
||||
if ((o = [theValues objectForKey: @"NickName"]))
|
||||
if ((o = [theValues objectForKey: @"NickName"]) || ![self _isGhosted: @"NickName" inContext: context])
|
||||
[self setNickname: o];
|
||||
|
||||
if ((o = [theValues objectForKey: @"Picture"]))
|
||||
|
||||
@@ -32,7 +32,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#import <Foundation/NSProcessInfo.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <SOGo/SOGoSystemDefaults.h>
|
||||
|
||||
#import <NGExtensions/NGBase64Coding.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#include <wbxml/wbxml.h>
|
||||
#include <wbxml/wbxml_conv.h>
|
||||
@@ -44,11 +47,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
- (void) _dumpToFile
|
||||
{
|
||||
NSString *path;
|
||||
BOOL debugOn;
|
||||
|
||||
path = [NSString stringWithFormat: @"/tmp/%@.data", [[NSProcessInfo processInfo] globallyUniqueString]];
|
||||
[self writeToFile: path atomically: YES];
|
||||
NSLog(@"Original data written to: %@", path);
|
||||
debugOn = [[SOGoSystemDefaults sharedSystemDefaults] easDebugEnabled];
|
||||
|
||||
if (debugOn)
|
||||
{
|
||||
NSString *path;
|
||||
|
||||
path = [NSString stringWithFormat: @"/tmp/%@.data", [[NSProcessInfo processInfo] globallyUniqueString]];
|
||||
[self writeToFile: path atomically: YES];
|
||||
[self errorWithFormat: @"Original data written to: %@", path];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -56,7 +66,33 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
|
||||
{
|
||||
return [[self stringByEncodingBase64] stringByReplacingString: @"\n" withString: @""];
|
||||
NSString *tmp, *s;
|
||||
unichar *buf, *start, c;
|
||||
int len, i, j;
|
||||
|
||||
tmp = [self stringByEncodingBase64] ;
|
||||
|
||||
len = [tmp length];
|
||||
|
||||
start = buf = (unichar *)malloc(len*sizeof(unichar));
|
||||
[tmp getCharacters: buf range: NSMakeRange(0, len)];
|
||||
|
||||
for (i = 0, j = 0; i < len; i++)
|
||||
{
|
||||
c = *buf;
|
||||
|
||||
if (!(c == 0xA))
|
||||
{
|
||||
*(start+j) = c;
|
||||
j++;
|
||||
}
|
||||
|
||||
buf++;
|
||||
}
|
||||
|
||||
s = [[NSString alloc] initWithCharactersNoCopy: start length: j freeWhenDone: YES];
|
||||
|
||||
return AUTORELEASE(s);
|
||||
}
|
||||
|
||||
- (NSData *) wbxml2xml
|
||||
@@ -81,7 +117,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
if (ret != WBXML_OK)
|
||||
{
|
||||
NSLog(@"wbxml2xmlFromContent: failed: %s\n", wbxml_errors_string(ret));
|
||||
[self errorWithFormat: @"wbxml2xmlFromContent: failed: %s\n", wbxml_errors_string(ret)];
|
||||
[self _dumpToFile];
|
||||
return nil;
|
||||
}
|
||||
@@ -114,7 +150,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
if (ret != WBXML_OK)
|
||||
{
|
||||
NSLog(@"xml2wbxmlFromContent: failed: %s\n", wbxml_errors_string(ret));
|
||||
[self logWithFormat: @"xml2wbxmlFromContent: failed: %s\n", wbxml_errors_string(ret)];
|
||||
[self _dumpToFile];
|
||||
return nil;
|
||||
}
|
||||
@@ -129,7 +165,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
if (ret != WBXML_OK)
|
||||
{
|
||||
NSLog(@"xml2wbxmlFromContent: failed: %s\n", wbxml_errors_string(ret));
|
||||
[self errorWithFormat: @"xml2wbxmlFromContent: failed: %s\n", wbxml_errors_string(ret)];
|
||||
[self _dumpToFile];
|
||||
free(wbxml);
|
||||
wbxml_conv_xml2wbxml_destroy(conv);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2014, Inverse inc.
|
||||
Copyright (c) 2014-2015, Inverse inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -49,6 +49,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
- (NSString *) deviceType;
|
||||
- (NSString *) attachmentName;
|
||||
- (NSString *) command;
|
||||
- (NSString *) collectionid;
|
||||
- (NSString *) itemid;
|
||||
- (BOOL) acceptsMultiPart;
|
||||
- (NSData *) convertHexStringToBytes;
|
||||
|
||||
@end
|
||||
|
||||
@@ -33,6 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <Foundation/NSCalendarDate.h>
|
||||
#include <Foundation/NSData.h>
|
||||
#include <Foundation/NSDate.h>
|
||||
#include <Foundation/NSTimeZone.h>
|
||||
|
||||
#include <SOGo/NSString+Utilities.h>
|
||||
#include <SOGo/NSData+Crypto.h>
|
||||
@@ -45,6 +46,99 @@ static NSArray *easCommandParameters = nil;
|
||||
|
||||
@implementation NSString (ActiveSync)
|
||||
|
||||
//
|
||||
// This is a copy from NSString+XMLEscaping.m from SOPE.
|
||||
// The difference here is that we use wchar_t instead of unichar.
|
||||
// This is needed to get the rigth numeric character reference.
|
||||
// e.g. SMILING FACE WITH OPEN MOUTH
|
||||
// ok: wchar_t -> 😃 wrong: unichar -> � �
|
||||
//
|
||||
// We avoir naming it like the one in SOPE since if the ActiveSync
|
||||
// bundle is loaded, it'll overwrite the one provided by SOPE.
|
||||
//
|
||||
- (NSString *) _stringByEscapingXMLStringUsingCharacters {
|
||||
register unsigned i, len, j;
|
||||
register wchar_t *buf;
|
||||
const wchar_t *chars;
|
||||
unsigned escapeCount;
|
||||
|
||||
if ([self length] == 0) return @"";
|
||||
|
||||
NSData *data = [self dataUsingEncoding:NSUTF32StringEncoding];
|
||||
chars = [data bytes];
|
||||
len = [data length]/4;
|
||||
|
||||
/* check for characters to escape ... */
|
||||
for (i = 0, escapeCount = 0; i < len; i++) {
|
||||
switch (chars[i]) {
|
||||
case '&': case '"': case '<': case '>': case '\r':
|
||||
escapeCount++;
|
||||
break;
|
||||
default:
|
||||
if (chars[i] < 0x20 || chars[i] > 127)
|
||||
escapeCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (escapeCount == 0 ) {
|
||||
/* nothing to escape ... */
|
||||
return [[self copy] autorelease];
|
||||
}
|
||||
|
||||
buf = calloc((len + 5) + (escapeCount * 16), sizeof(wchar_t));
|
||||
for (i = 0, j = 0; i < len; i++) {
|
||||
switch (chars[i]) {
|
||||
/* escape special chars */
|
||||
case '\r':
|
||||
buf[j] = '&'; j++; buf[j] = '#'; j++; buf[j] = '1'; j++;
|
||||
buf[j] = '3'; j++; buf[j] = ';'; j++;
|
||||
break;
|
||||
case '&':
|
||||
buf[j] = '&'; j++; buf[j] = 'a'; j++; buf[j] = 'm'; j++;
|
||||
buf[j] = 'p'; j++; buf[j] = ';'; j++;
|
||||
break;
|
||||
case '"':
|
||||
buf[j] = '&'; j++; buf[j] = 'q'; j++; buf[j] = 'u'; j++;
|
||||
buf[j] = 'o'; j++; buf[j] = 't'; j++; buf[j] = ';'; j++;
|
||||
break;
|
||||
case '<':
|
||||
buf[j] = '&'; j++; buf[j] = 'l'; j++; buf[j] = 't'; j++;
|
||||
buf[j] = ';'; j++;
|
||||
break;
|
||||
case '>':
|
||||
buf[j] = '&'; j++; buf[j] = 'g'; j++; buf[j] = 't'; j++;
|
||||
buf[j] = ';'; j++;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* escape big chars */
|
||||
if (chars[i] > 127) {
|
||||
unsigned char nbuf[32];
|
||||
unsigned int k;
|
||||
|
||||
sprintf((char *)nbuf, "&#%i;", (int)chars[i]);
|
||||
for (k = 0; nbuf[k] != '\0'; k++) {
|
||||
buf[j] = nbuf[k];
|
||||
j++;
|
||||
}
|
||||
}
|
||||
else if (chars[i] == 0x9 || chars[i] == 0xA || chars[i] == 0xD || chars[i] >= 0x20) { // ignore any unsupported control character
|
||||
/* nothing to escape */
|
||||
buf[j] = chars[i];
|
||||
j++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
self = [[NSString alloc] initWithBytesNoCopy: buf
|
||||
length: (j*sizeof(wchar_t))
|
||||
encoding: NSUTF32StringEncoding
|
||||
freeWhenDone: YES];
|
||||
|
||||
return [self autorelease];
|
||||
}
|
||||
|
||||
- (NSString *) sanitizedServerIdWithType: (SOGoMicrosoftActiveSyncFolderType) folderType
|
||||
{
|
||||
if (folderType == ActiveSyncEventFolder)
|
||||
@@ -64,11 +158,7 @@ static NSArray *easCommandParameters = nil;
|
||||
|
||||
- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
|
||||
{
|
||||
NSString *s;
|
||||
|
||||
s = [self safeString];
|
||||
|
||||
return [s stringByEscapingHTMLString];
|
||||
return [self _stringByEscapingXMLStringUsingCharacters];
|
||||
}
|
||||
|
||||
- (int) activeSyncFolderType
|
||||
@@ -127,13 +217,17 @@ static NSArray *easCommandParameters = nil;
|
||||
//
|
||||
- (NSCalendarDate *) calendarDate
|
||||
{
|
||||
NSString *s;
|
||||
id o;
|
||||
|
||||
o = [NSCalendarDate dateWithString: self calendarFormat: @"%Y%m%dT%H%M%SZ"];
|
||||
// We force parsing in the GMT timezone. If we don't do that, the date will be parsed
|
||||
// in the default timezone.
|
||||
s = [NSString stringWithFormat: @"%@ GMT", self];
|
||||
o = [NSCalendarDate dateWithString: s calendarFormat: @"%Y%m%dT%H%M%SZ %Z"];
|
||||
|
||||
if (!o)
|
||||
o = [NSCalendarDate dateWithString: self calendarFormat: @"%Y-%m-%dT%H:%M:%S.%FZ"];
|
||||
|
||||
o = [NSCalendarDate dateWithString: s calendarFormat: @"%Y-%m-%dT%H:%M:%S.%FZ %Z"];
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
@@ -293,6 +387,43 @@ static NSArray *easCommandParameters = nil;
|
||||
return s;
|
||||
}
|
||||
|
||||
- (NSString *) itemid
|
||||
{
|
||||
NSString *s;
|
||||
|
||||
s = [self _valueForParameter: @"ITEMID="];
|
||||
|
||||
if (!s)
|
||||
s = @"Unknown";
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
- (NSString *) collectionid
|
||||
{
|
||||
NSString *s;
|
||||
|
||||
s = [self _valueForParameter: @"COLLECTIONID="];
|
||||
|
||||
if (!s)
|
||||
s = @"Unknown";
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
- (BOOL) acceptsMultiPart
|
||||
{
|
||||
NSString *s;
|
||||
|
||||
s = [self _valueForParameter: @"OPTIONS="];
|
||||
|
||||
if (s && [s rangeOfString: @"AcceptMultiPart" options: NSCaseInsensitiveSearch].location != NSNotFound)
|
||||
return YES;
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// FIXME: combine with our OpenChange code.
|
||||
//
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ to negotiate the fees associated to your user base.
|
||||
|
||||
To contact Microsoft, please visit:
|
||||
|
||||
http://www.microsoft.com/en-us/legal/intellectualproperty/IPLicensing/Programs/exchangeactivesyncprotocol.aspx
|
||||
http://www.microsoft.com/en-us/legal/intellectualproperty/
|
||||
|
||||
and send an email to iplicreq@microsoft.com
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2014, Inverse inc.
|
||||
Copyright (c) 2014-2015, Inverse inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -31,15 +31,25 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "SOGoActiveSyncConstants.h"
|
||||
|
||||
@class NSCalendarDate;
|
||||
@class NSException;
|
||||
@class NSMutableDictionary;
|
||||
@class NSURL;
|
||||
@class NSNumber;
|
||||
|
||||
@interface SOGoActiveSyncDispatcher : NSObject
|
||||
{
|
||||
NSURL *folderTableURL;
|
||||
NSDictionary *imapFolderGUIDS;
|
||||
id context;
|
||||
|
||||
NSNumber *syncRequest;
|
||||
|
||||
BOOL debugOn;
|
||||
}
|
||||
|
||||
- (NSMutableDictionary *) globalMetadataForDevice;
|
||||
|
||||
- (id) collectionFromId: (NSString *) theCollectionId
|
||||
type: (SOGoMicrosoftActiveSyncFolderType) theFolderType;
|
||||
|
||||
|
||||
+1029
-269
File diff suppressed because it is too large.
Load diff
@@ -34,6 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSException.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSCharacterSet.h>
|
||||
|
||||
#import <NGCards/iCalCalendar.h>
|
||||
#import <NGCards/iCalDateTime.h>
|
||||
@@ -47,7 +48,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#import <NGExtensions/NSString+Encoding.h>
|
||||
#import <NGImap4/NGImap4Envelope.h>
|
||||
#import <NGImap4/NGImap4EnvelopeAddress.h>
|
||||
#import <NGImap4/NSString+Imap4.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGObjWeb/WOApplication.h>
|
||||
|
||||
#import <NGMime/NGMimeBodyPart.h>
|
||||
#import <NGMime/NGMimeFileData.h>
|
||||
@@ -57,6 +60,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#import <NGMail/NGMimeMessage.h>
|
||||
#import <NGMail/NGMimeMessageGenerator.h>
|
||||
|
||||
#import <Mailer/SOGoMailLabel.h>
|
||||
|
||||
#import <SOGo/SOGoUserDefaults.h>
|
||||
|
||||
#include "iCalTimeZone+ActiveSync.h"
|
||||
#include "NSData+ActiveSync.h"
|
||||
#include "NSDate+ActiveSync.h"
|
||||
@@ -69,6 +76,43 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <SOGo/SOGoUser.h>
|
||||
#include <SOGo/NSString+Utilities.h>
|
||||
|
||||
#import <Appointments/SOGoAptMailNotification.h>
|
||||
|
||||
unsigned char strToChar(char a, char b) {
|
||||
char encoder[3] = {'\0','\0','\0'};
|
||||
encoder[0] = a;
|
||||
encoder[1] = b;
|
||||
return (char) strtol(encoder,NULL,16);
|
||||
}
|
||||
|
||||
@interface NSString (NSStringExtensions)
|
||||
- (NSData *) decodeFromHexidecimal;
|
||||
@end
|
||||
|
||||
@implementation NSString (NSStringExtensions)
|
||||
|
||||
- (NSData *) decodeFromHexidecimal;
|
||||
{
|
||||
const char * bytes = [self cStringUsingEncoding: NSUTF8StringEncoding];
|
||||
NSUInteger length = strlen(bytes);
|
||||
unsigned char * r = (unsigned char *) malloc(length / 2 + 1);
|
||||
unsigned char * index = r;
|
||||
|
||||
while ((*bytes) && (*(bytes +1))) {
|
||||
*index = strToChar(*bytes, *(bytes +1));
|
||||
index++;
|
||||
bytes+=2;
|
||||
}
|
||||
*index = '\0';
|
||||
|
||||
NSData * result = [NSData dataWithBytes: r length: length / 2];
|
||||
free(r);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
typedef struct {
|
||||
uint32_t dwLowDateTime;
|
||||
uint32_t dwHighDateTime;
|
||||
@@ -83,7 +127,7 @@ struct GlobalObjectId {
|
||||
FILETIME CreationTime;
|
||||
uint8_t X[8];
|
||||
uint32_t Size;
|
||||
uint8_t* Data;
|
||||
uint8_t Data[0];
|
||||
};
|
||||
|
||||
@implementation SOGoMailObject (ActiveSync)
|
||||
@@ -110,39 +154,40 @@ struct GlobalObjectId {
|
||||
//
|
||||
// The GlobalObjId is documented here: http://msdn.microsoft.com/en-us/library/ee160198(v=EXCHG.80).aspx
|
||||
//
|
||||
|
||||
- (NSData *) _computeGlobalObjectIdFromEvent: (iCalEvent *) event
|
||||
{
|
||||
NSData *binPrefix, *globalObjectId, *uidAsASCII;
|
||||
NSString *prefix, *uid;
|
||||
|
||||
struct GlobalObjectId newGlobalId;
|
||||
struct GlobalObjectId *newGlobalId;
|
||||
const char *bytes;
|
||||
|
||||
|
||||
uid = [event uid];
|
||||
uidAsASCII = [uid decodeFromHexidecimal];
|
||||
newGlobalId = (struct GlobalObjectId*)calloc(sizeof(uint8_t), sizeof(struct GlobalObjectId) + 0x0c + [uidAsASCII length]);
|
||||
|
||||
prefix = @"040000008200e00074c5b7101a82e008";
|
||||
|
||||
// dataPrefix is "vCal-Uid %x01 %x00 %x00 %x00"
|
||||
uint8_t dataPrefix[] = { 0x76, 0x43, 0x61, 0x6c, 0x2d, 0x55, 0x69, 0x64, 0x01, 0x00, 0x00, 0x00 };
|
||||
uid = [event uid];
|
||||
|
||||
binPrefix = [prefix convertHexStringToBytes];
|
||||
[binPrefix getBytes: &newGlobalId.ByteArrayID];
|
||||
[self _setInstanceDate: &newGlobalId
|
||||
[binPrefix getBytes: &newGlobalId->ByteArrayID];
|
||||
[self _setInstanceDate: newGlobalId
|
||||
fromDate: [event recurrenceId]];
|
||||
uidAsASCII = [uid dataUsingEncoding: NSASCIIStringEncoding];
|
||||
bytes = [uidAsASCII bytes];
|
||||
|
||||
// 0x0c is the size of our dataPrefix
|
||||
newGlobalId.Size = 0x0c + [uidAsASCII length];
|
||||
newGlobalId.Data = malloc(newGlobalId.Size * sizeof(uint8_t));
|
||||
memcpy(newGlobalId.Data, dataPrefix, 0x0c);
|
||||
memcpy(newGlobalId.Data + 0x0c, bytes, newGlobalId.Size - 0x0c);
|
||||
newGlobalId->Size = 0x0c + [uidAsASCII length];
|
||||
memcpy(newGlobalId->Data, dataPrefix, 0x0c);
|
||||
memcpy(newGlobalId->Data + 0x0c, bytes, newGlobalId->Size - 0x0c);
|
||||
|
||||
globalObjectId = [[NSData alloc] initWithBytes: &newGlobalId length: 40 + newGlobalId.Size*sizeof(uint8_t)];
|
||||
free(newGlobalId.Data);
|
||||
|
||||
globalObjectId = [[NSData alloc] initWithBytes: newGlobalId length: 40 + newGlobalId->Size*sizeof(uint8_t)];
|
||||
free(newGlobalId);
|
||||
return [globalObjectId autorelease];
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// For debugging purposes...
|
||||
//
|
||||
@@ -204,12 +249,15 @@ struct GlobalObjectId {
|
||||
//
|
||||
//
|
||||
- (NSData *) _preferredBodyDataInMultipartUsingType: (int) theType
|
||||
nativeTypeFound: (int *) theNativeTypeFound
|
||||
{
|
||||
NSString *encoding, *key, *plainKey, *htmlKey, *type, *subtype;
|
||||
NSDictionary *textParts, *part;
|
||||
NSEnumerator *e;
|
||||
NSData *d;
|
||||
|
||||
BOOL ignore;
|
||||
|
||||
textParts = [self fetchPlainTextParts];
|
||||
e = [textParts keyEnumerator];
|
||||
plainKey = nil;
|
||||
@@ -218,10 +266,35 @@ struct GlobalObjectId {
|
||||
|
||||
while ((key = [e nextObject]))
|
||||
{
|
||||
// Walk the hierarchy up and check whether parents are of type mulipart - i.e. ignore message/rfc822
|
||||
if ([key countOccurrencesOfString: @"."] > 0)
|
||||
{
|
||||
NSMutableArray *a;
|
||||
|
||||
a = [[[key componentsSeparatedByString: @"."] mutableCopy] autorelease];
|
||||
ignore = NO;
|
||||
|
||||
while ([a count] > 0)
|
||||
{
|
||||
[a removeLastObject];
|
||||
part = [self lookupInfoForBodyPart: [a componentsJoinedByString: @"."]];
|
||||
|
||||
if (![[part valueForKey: @"type"] isEqualToString: @"multipart"])
|
||||
ignore = YES;
|
||||
}
|
||||
|
||||
if (ignore)
|
||||
continue;
|
||||
}
|
||||
|
||||
part = [self lookupInfoForBodyPart: key];
|
||||
type = [part valueForKey: @"type"];
|
||||
subtype = [part valueForKey: @"subtype"];
|
||||
|
||||
// Don't select an attachment as body
|
||||
if ([[[part valueForKey: @"disposition"] valueForKey: @"type"] isEqualToString: @"attachment"])
|
||||
continue;
|
||||
|
||||
if ([type isEqualToString: @"text"] && [subtype isEqualToString: @"html"])
|
||||
htmlKey = key;
|
||||
else if ([type isEqualToString: @"text"] && [subtype isEqualToString: @"plain"])
|
||||
@@ -229,11 +302,22 @@ struct GlobalObjectId {
|
||||
}
|
||||
|
||||
key = nil;
|
||||
*theNativeTypeFound = 1;
|
||||
|
||||
if (theType == 2)
|
||||
key = htmlKey;
|
||||
else if (theType == 1)
|
||||
if (theType == 2 && htmlKey)
|
||||
{
|
||||
key = htmlKey;
|
||||
*theNativeTypeFound = 2;
|
||||
}
|
||||
else if (theType == 1 && plainKey)
|
||||
key = plainKey;
|
||||
else if (theType == 2 && plainKey)
|
||||
key = plainKey;
|
||||
else if (theType == 1 && htmlKey)
|
||||
{
|
||||
key = htmlKey;
|
||||
*theNativeTypeFound = 2;
|
||||
}
|
||||
|
||||
if (key)
|
||||
{
|
||||
@@ -251,9 +335,17 @@ struct GlobalObjectId {
|
||||
charset = [[[self lookupInfoForBodyPart: key] objectForKey: @"parameterList"] objectForKey: @"charset"];
|
||||
|
||||
if (![charset length])
|
||||
charset = @"us-ascii";
|
||||
charset = @"utf-8";
|
||||
|
||||
s = [NSString stringWithData: d usingEncodingNamed: charset];
|
||||
|
||||
// We fallback to ISO-8859-1 string encoding
|
||||
if (!s)
|
||||
s = [[[NSString alloc] initWithData: d encoding: NSISOLatin1StringEncoding] autorelease];
|
||||
|
||||
if (theType == 1 && *theNativeTypeFound == 2)
|
||||
s = [s htmlToText];
|
||||
|
||||
d = [s dataUsingEncoding: NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
@@ -298,7 +390,7 @@ struct GlobalObjectId {
|
||||
[[[thePart contentType] type] isEqualToString: @"text"] &&
|
||||
([[[thePart contentType] subType] isEqualToString: @"plain"] || [[[thePart contentType] subType] isEqualToString: @"html"]))
|
||||
{
|
||||
// We make sure everything is encoded in UTF-8
|
||||
// We make sure everything is encoded in UTF-8.
|
||||
NGMimeType *mimeType;
|
||||
NSString *s;
|
||||
|
||||
@@ -309,9 +401,13 @@ struct GlobalObjectId {
|
||||
charset = [[thePart contentType] valueOfParameter: @"charset"];
|
||||
|
||||
if (![charset length])
|
||||
charset = @"us-ascii";
|
||||
charset = @"utf-8";
|
||||
|
||||
s = [NSString stringWithData: body usingEncodingNamed: charset];
|
||||
s = [NSString stringWithData: body usingEncodingNamed: charset];
|
||||
|
||||
// We fallback to ISO-8859-1 string encoding. We avoid #3103.
|
||||
if (!s)
|
||||
s = [[[NSString alloc] initWithData: body encoding: NSISOLatin1StringEncoding] autorelease];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -322,11 +418,6 @@ struct GlobalObjectId {
|
||||
|
||||
if (s)
|
||||
{
|
||||
// We sanitize the content immediately, in case we have non-UNICODE safe
|
||||
// characters that would be re-encoded later in HTML entities and thus,
|
||||
// ignore afterwards.
|
||||
s = [s safeString];
|
||||
|
||||
body = [s dataUsingEncoding: NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
@@ -382,18 +473,46 @@ struct GlobalObjectId {
|
||||
return d;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
- (BOOL) _sanitinizeNeeded: (NSArray *) theParts
|
||||
{
|
||||
NSString *encoding, *charset;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < [theParts count]; i++)
|
||||
{
|
||||
encoding = [[theParts objectAtIndex: i ] objectForKey: @"encoding"];
|
||||
charset = [[[theParts objectAtIndex: i ] objectForKey: @"parameterList"] objectForKey: @"charset"];
|
||||
if (encoding && [encoding caseInsensitiveCompare: @"8bit"] == NSOrderedSame &&
|
||||
charset && ![charset caseInsensitiveCompare: @"utf-8"] == NSOrderedSame
|
||||
&& ![charset caseInsensitiveCompare: @"us-ascii"] == NSOrderedSame)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
if ([self _sanitinizeNeeded: [[theParts objectAtIndex: i ] objectForKey: @"parts"]])
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
- (NSData *) _preferredBodyDataUsingType: (int) theType
|
||||
mimeSupport: (int) theMimeSupport
|
||||
nativeType: (int *) theNativeType
|
||||
{
|
||||
NSString *type, *subtype, *encoding;
|
||||
NSData *d;
|
||||
BOOL isSMIME, sanitinizeNeeded;
|
||||
|
||||
type = [[[self bodyStructure] valueForKey: @"type"] lowercaseString];
|
||||
subtype = [[[self bodyStructure] valueForKey: @"subtype"] lowercaseString];
|
||||
|
||||
isSMIME = NO;
|
||||
d = nil;
|
||||
|
||||
// We determine the native type
|
||||
@@ -404,17 +523,23 @@ struct GlobalObjectId {
|
||||
else if ([type isEqualToString: @"multipart"])
|
||||
*theNativeType = 4;
|
||||
|
||||
// We get the right part based on the preference
|
||||
if (theType == 1 || theType == 2)
|
||||
if (([subtype isEqualToString: @"signed"] || [subtype isEqualToString: @"pkcs7-mime"] ) && theMimeSupport > 0)
|
||||
{
|
||||
if ([type isEqualToString: @"text"])
|
||||
*theNativeType = 4;
|
||||
isSMIME = YES;
|
||||
}
|
||||
|
||||
// We get the right part based on the preference
|
||||
if ((theType == 1 || theType == 2) && !isSMIME)
|
||||
{
|
||||
if ([type isEqualToString: @"text"] && ![subtype isEqualToString: @"calendar"])
|
||||
{
|
||||
NSString *s, *charset;
|
||||
|
||||
charset = [[[self lookupInfoForBodyPart: @""] objectForKey: @"parameterList"] objectForKey: @"charset"];
|
||||
|
||||
if (![charset length])
|
||||
charset = @"us-ascii";
|
||||
charset = @"utf-8";
|
||||
|
||||
d = [[self fetchPlainTextParts] objectForKey: @""];
|
||||
|
||||
@@ -428,25 +553,30 @@ struct GlobalObjectId {
|
||||
d = [d dataByDecodingQuotedPrintableTransferEncoding];
|
||||
|
||||
s = [NSString stringWithData: d usingEncodingNamed: charset];
|
||||
|
||||
// We fallback to ISO-8859-1 string encoding. We avoid #3103.
|
||||
if (!s)
|
||||
s = [[[NSString alloc] initWithData: d encoding: NSISOLatin1StringEncoding] autorelease];
|
||||
|
||||
// Check if we must convert html->plain
|
||||
if (theType == 1 && [subtype isEqualToString: @"html"])
|
||||
{
|
||||
s = [s htmlToText];
|
||||
}
|
||||
|
||||
|
||||
d = [s dataUsingEncoding: NSUTF8StringEncoding];
|
||||
}
|
||||
else if ([type isEqualToString: @"multipart"])
|
||||
{
|
||||
d = [self _preferredBodyDataInMultipartUsingType: theType];
|
||||
d = [self _preferredBodyDataInMultipartUsingType: theType nativeTypeFound: theNativeType];
|
||||
}
|
||||
}
|
||||
else if (theType == 4)
|
||||
else if (theType == 4 || isSMIME)
|
||||
{
|
||||
// We sanitize the content *ONLY* for Outlook clients. Outlook has strange issues
|
||||
// with quoted-printable/base64 encoded text parts. It just doesn't decode them.
|
||||
if ([[context objectForKey: @"DeviceType"] isEqualToString: @"WindowsOutlook15"])
|
||||
// We sanitize the content if the content-transfer-encoding is 8bit and charset is not utf-8 or us-ascii.
|
||||
sanitinizeNeeded = [self _sanitinizeNeeded: [NSArray arrayWithObject: [self bodyStructure]]];
|
||||
|
||||
if (sanitinizeNeeded && !isSMIME)
|
||||
d = [self _sanitizedMIMEMessage];
|
||||
else
|
||||
d = [self content];
|
||||
@@ -455,15 +585,94 @@ struct GlobalObjectId {
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
- (NSString *) _getNormalizedSubject
|
||||
{
|
||||
NSString *subject;
|
||||
NSUInteger colIdx;
|
||||
NSString *stringValue;
|
||||
|
||||
subject = [[self subject] decodedHeader];
|
||||
|
||||
colIdx = [subject rangeOfString: @":" options:NSBackwardsSearch].location;
|
||||
if (colIdx != NSNotFound && colIdx + 1 < [subject length])
|
||||
stringValue = [[subject substringFromIndex: colIdx + 1] stringByTrimmingLeadSpaces];
|
||||
else
|
||||
stringValue = subject;
|
||||
|
||||
if (!stringValue)
|
||||
stringValue = @"";
|
||||
|
||||
return stringValue;
|
||||
}
|
||||
|
||||
|
||||
- (NSString *) _truncateContent: (NSString *) theContent
|
||||
limit: (int) theLimit
|
||||
truncated: (int *) wasTruncated
|
||||
{
|
||||
if ([theContent length] > theLimit)
|
||||
{
|
||||
int i, len;
|
||||
|
||||
theContent = [theContent substringToIndex: theLimit];
|
||||
*wasTruncated = 1;
|
||||
|
||||
// We search for the first "space" character starting from the
|
||||
// end and we truncate the string once more. We do this to avoid
|
||||
// truncating the content in the middle of a XML entity
|
||||
len = theLimit-1;
|
||||
|
||||
for (i = len; i >= 0; i--)
|
||||
{
|
||||
if (isspace([theContent characterAtIndex: i]))
|
||||
break;
|
||||
}
|
||||
|
||||
return [theContent substringToIndex: i];
|
||||
}
|
||||
|
||||
*wasTruncated = 0;
|
||||
return theContent;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
- (iCalCalendar *) calendarFromIMIPMessage
|
||||
{
|
||||
NSDictionary *part;
|
||||
NSString *type, *subtype;
|
||||
NSArray *parts;
|
||||
int i;
|
||||
|
||||
type = [[[self bodyStructure] valueForKey: @"type"] lowercaseString];
|
||||
subtype = [[[self bodyStructure] valueForKey: @"subtype"] lowercaseString];
|
||||
|
||||
// process mail of type text/calendar
|
||||
if ([type isEqualToString: @"text"] && [subtype isEqualToString: @"calendar"])
|
||||
{
|
||||
iCalCalendar *calendar;
|
||||
NSString *encoding;
|
||||
NSData *calendarData;
|
||||
|
||||
encoding = [[[self bodyStructure] valueForKey: @"encoding"] lowercaseString];
|
||||
calendarData = [[self fetchPlainTextParts] objectForKey: @""];
|
||||
|
||||
if ([encoding caseInsensitiveCompare: @"base64"] == NSOrderedSame)
|
||||
calendarData = [calendarData dataByDecodingBase64];
|
||||
else if ([encoding caseInsensitiveCompare: @"quoted-printable"] == NSOrderedSame)
|
||||
calendarData = [calendarData dataByDecodingQuotedPrintableTransferEncoding];
|
||||
|
||||
NS_DURING
|
||||
calendar = [iCalCalendar parseSingleFromSource: calendarData];
|
||||
NS_HANDLER
|
||||
calendar = nil;
|
||||
NS_ENDHANDLER
|
||||
|
||||
return calendar;
|
||||
}
|
||||
|
||||
// We check if we have at least 2 parts and if one of them is a text/calendar
|
||||
parts = [[self bodyStructure] objectForKey: @"parts"];
|
||||
|
||||
@@ -511,12 +720,19 @@ struct GlobalObjectId {
|
||||
{
|
||||
NSData *d, *globalObjId;
|
||||
NSArray *attachmentKeys;
|
||||
iCalCalendar *calendar;
|
||||
NSString *p, *subtype;
|
||||
NSMutableString *s;
|
||||
id value;
|
||||
|
||||
iCalCalendar *calendar;
|
||||
|
||||
int preferredBodyType, nativeBodyType;
|
||||
int preferredBodyType, mimeSupport, mimeTruncation, nativeBodyType;
|
||||
uint32_t v;
|
||||
|
||||
subtype = [[[self bodyStructure] valueForKey: @"subtype"] lowercaseString];
|
||||
|
||||
preferredBodyType = [[context objectForKey: @"BodyPreferenceType"] intValue];
|
||||
mimeSupport = [[context objectForKey: @"MIMESupport"] intValue];
|
||||
mimeTruncation = [[context objectForKey: @"MIMETruncation"] intValue];
|
||||
|
||||
s = [NSMutableString string];
|
||||
|
||||
@@ -536,7 +752,7 @@ struct GlobalObjectId {
|
||||
if (value)
|
||||
{
|
||||
[s appendFormat: @"<Subject xmlns=\"Email:\">%@</Subject>", [value activeSyncRepresentationInContext: context]];
|
||||
[s appendFormat: @"<ThreadTopic xmlns=\"Email:\">%@</ThreadTopic>", [value activeSyncRepresentationInContext: context]];
|
||||
[s appendFormat: @"<ThreadTopic xmlns=\"Email:\">%@</ThreadTopic>", [[self _getNormalizedSubject] activeSyncRepresentationInContext: context]];
|
||||
}
|
||||
|
||||
// DateReceived
|
||||
@@ -552,8 +768,34 @@ struct GlobalObjectId {
|
||||
if (value)
|
||||
[s appendFormat: @"<Cc xmlns=\"Email:\">%@</Cc>", [value activeSyncRepresentationInContext: context]];
|
||||
|
||||
// Importance - FIXME
|
||||
[s appendFormat: @"<Importance xmlns=\"Email:\">%@</Importance>", @"1"];
|
||||
// Importance
|
||||
v = 0x1;
|
||||
value = [[self mailHeaders] objectForKey: @"x-priority"];
|
||||
if ([value isKindOfClass: [NSArray class]])
|
||||
p = [value lastObject];
|
||||
else
|
||||
p = value;
|
||||
|
||||
if (p)
|
||||
{
|
||||
if ([p hasPrefix: @"1"]) v = 0x2;
|
||||
else if ([p hasPrefix: @"2"]) v = 0x2;
|
||||
else if ([p hasPrefix: @"4"]) v = 0x0;
|
||||
else if ([p hasPrefix: @"5"]) v = 0x0;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = [[self mailHeaders] objectForKey: @"importance"];
|
||||
if ([value isKindOfClass: [NSArray class]])
|
||||
p = [value lastObject];
|
||||
else
|
||||
p = value;
|
||||
|
||||
if ([p hasPrefix: @"High"]) v = 0x2;
|
||||
else if ([p hasPrefix: @"Low"]) v = 0x0;
|
||||
}
|
||||
|
||||
[s appendFormat: @"<Importance xmlns=\"Email:\">%d</Importance>", v];
|
||||
|
||||
// Read
|
||||
[s appendFormat: @"<Read xmlns=\"Email:\">%d</Read>", ([self read] ? 1 : 0)];
|
||||
@@ -617,18 +859,18 @@ struct GlobalObjectId {
|
||||
|
||||
[s appendFormat: @"<AllDayEvent xmlns=\"Email:\">%d</AllDayEvent>", ([event isAllDay] ? 1 : 0)];
|
||||
|
||||
// StartTime -- http://msdn.microsoft.com/en-us/library/ee157132(v=exchg.80).aspx
|
||||
// StartTime -- https://msdn.microsoft.com/en-us/library/ee203365%28v=exchg.80%29.aspx
|
||||
if ([event startDate])
|
||||
[s appendFormat: @"<StartTime xmlns=\"Email:\">%@</StartTime>", [[event startDate] activeSyncRepresentationWithoutSeparatorsInContext: context]];
|
||||
[s appendFormat: @"<StartTime xmlns=\"Email:\">%@</StartTime>", [[event startDate] activeSyncRepresentationInContext: context]];
|
||||
|
||||
if ([event timeStampAsDate])
|
||||
[s appendFormat: @"<DTStamp xmlns=\"Email:\">%@</DTStamp>", [[event timeStampAsDate] activeSyncRepresentationWithoutSeparatorsInContext: context]];
|
||||
[s appendFormat: @"<DTStamp xmlns=\"Email:\">%@</DTStamp>", [[event timeStampAsDate] activeSyncRepresentationInContext: context]];
|
||||
else if ([event created])
|
||||
[s appendFormat: @"<DTStamp xmlns=\"Email:\">%@</DTStamp>", [[event created] activeSyncRepresentationWithoutSeparatorsInContext: context]];
|
||||
[s appendFormat: @"<DTStamp xmlns=\"Email:\">%@</DTStamp>", [[event created] activeSyncRepresentationInContext: context]];
|
||||
|
||||
// EndTime -- http://msdn.microsoft.com/en-us/library/ee157945(v=exchg.80).aspx
|
||||
// EndTime -- https://msdn.microsoft.com/en-us/library/ee158628(v=exchg.80).aspx
|
||||
if ([event endDate])
|
||||
[s appendFormat: @"<EndTime xmlns=\"Email:\">%@</EndTime>", [[event endDate] activeSyncRepresentationWithoutSeparatorsInContext: context]];
|
||||
[s appendFormat: @"<EndTime xmlns=\"Email:\">%@</EndTime>", [[event endDate] activeSyncRepresentationInContext: context]];
|
||||
|
||||
// FIXME: Single appointment - others are not supported right now
|
||||
[s appendFormat: @"<InstanceType xmlns=\"Email:\">%d</InstanceType>", 0];
|
||||
@@ -676,7 +918,9 @@ struct GlobalObjectId {
|
||||
[s appendFormat: @"<GlobalObjId xmlns=\"Email:\">%@</GlobalObjId>", [globalObjId activeSyncRepresentationInContext: context]];
|
||||
|
||||
// We set the right message type - we must set AS version to 14.1 for this
|
||||
[s appendFormat: @"<MeetingMessageType xmlns=\"Email2:\">%d</MeetingMessageType>", 1];
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"14.1"])
|
||||
[s appendFormat: @"<MeetingMessageType xmlns=\"Email2:\">%d</MeetingMessageType>", 1];
|
||||
|
||||
[s appendString: @"</MeetingRequest>"];
|
||||
|
||||
// ContentClass
|
||||
@@ -685,7 +929,12 @@ struct GlobalObjectId {
|
||||
else
|
||||
{
|
||||
// MesssageClass and ContentClass
|
||||
[s appendFormat: @"<MessageClass xmlns=\"Email:\">%@</MessageClass>", @"IPM.Note"];
|
||||
if ([subtype isEqualToString: @"signed"])
|
||||
[s appendFormat: @"<MessageClass xmlns=\"Email:\">%@</MessageClass>", @"IPM.Note.SMIME.MultipartSigned"];
|
||||
else if ([subtype isEqualToString: @"pkcs7-mime"])
|
||||
[s appendFormat: @"<MessageClass xmlns=\"Email:\">%@</MessageClass>", @"IPM.Note.SMIME"];
|
||||
else
|
||||
[s appendFormat: @"<MessageClass xmlns=\"Email:\">%@</MessageClass>", @"IPM.Note"];
|
||||
[s appendFormat: @"<ContentClass xmlns=\"Email:\">%@</ContentClass>", @"urn:content-classes:message"];
|
||||
}
|
||||
|
||||
@@ -699,17 +948,82 @@ struct GlobalObjectId {
|
||||
[s appendFormat: @"<InternetCPID xmlns=\"Email:\">%@</InternetCPID>", @"65001"];
|
||||
|
||||
// Body - namespace 17
|
||||
preferredBodyType = [[context objectForKey: @"BodyPreferenceType"] intValue];
|
||||
|
||||
nativeBodyType = 1;
|
||||
d = [self _preferredBodyDataUsingType: preferredBodyType nativeType: &nativeBodyType];
|
||||
d = [self _preferredBodyDataUsingType: preferredBodyType mimeSupport: mimeSupport nativeType: &nativeBodyType];
|
||||
|
||||
if (calendar && !d)
|
||||
{
|
||||
WOApplication *app;
|
||||
SOGoAptMailNotification *p;
|
||||
NSString *pageName;
|
||||
|
||||
nativeBodyType = 2;
|
||||
|
||||
/* get WOApplication instance */
|
||||
app = [WOApplication application];
|
||||
|
||||
/* create page name */
|
||||
pageName = [NSString stringWithFormat: @"SOGoAptMail%@", @"Invitation"];
|
||||
/* construct message content */
|
||||
p = [app pageWithName: pageName inContext: context];
|
||||
[p setApt: (iCalEvent *) [[calendar events] lastObject]];
|
||||
|
||||
if ([[ [[calendar events] lastObject] organizer] cn] && [[[ [[calendar events] lastObject] organizer] cn] length])
|
||||
{
|
||||
[p setOrganizerName: [[ [[calendar events] lastObject] organizer] cn]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[p setOrganizerName: [[SOGoUser userWithLogin: owner] cn]];
|
||||
}
|
||||
|
||||
if (preferredBodyType == 1 && nativeBodyType == 2)
|
||||
d = [[[p getBody] htmlToText] dataUsingEncoding: NSUTF8StringEncoding];
|
||||
else
|
||||
{
|
||||
preferredBodyType = 2;
|
||||
d = [[p getBody] dataUsingEncoding: NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (d)
|
||||
{
|
||||
NSMutableData *sanitizedData;
|
||||
NSString *content;
|
||||
int len, truncated;
|
||||
|
||||
content = [[NSString alloc] initWithData: d encoding: NSUTF8StringEncoding];
|
||||
|
||||
// Outlook fails to decode quoted-printable (see #3082) if lines are not termined by CRLF.
|
||||
const char *bytes;
|
||||
char *mbytes;
|
||||
int mlen;
|
||||
|
||||
len = [d length];
|
||||
mlen = 0;
|
||||
|
||||
sanitizedData = [NSMutableData dataWithLength: len*2];
|
||||
|
||||
bytes = [d bytes];
|
||||
mbytes = [sanitizedData mutableBytes];
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
if (*bytes == '\n' && *(bytes-1) != '\r' && mlen > 0)
|
||||
{
|
||||
*mbytes = '\r';
|
||||
mbytes++;
|
||||
mlen++;
|
||||
}
|
||||
|
||||
*mbytes = *bytes;
|
||||
mbytes++; bytes++;
|
||||
len--;
|
||||
mlen++;
|
||||
}
|
||||
|
||||
[sanitizedData setLength: mlen];
|
||||
|
||||
content = [[NSString alloc] initWithData: sanitizedData encoding: NSUTF8StringEncoding];
|
||||
|
||||
// FIXME: This is a hack. We should normally avoid doing this as we might get
|
||||
// broken encodings. We should rather tell that the data was truncated and expect
|
||||
@@ -719,36 +1033,94 @@ struct GlobalObjectId {
|
||||
// for an "interesting" discussion around this.
|
||||
//
|
||||
if (!content)
|
||||
content = [[NSString alloc] initWithData: d encoding: NSISOLatin1StringEncoding];
|
||||
content = [[NSString alloc] initWithData: sanitizedData encoding: NSISOLatin1StringEncoding];
|
||||
|
||||
AUTORELEASE(content);
|
||||
|
||||
content = [content activeSyncRepresentationInContext: context];
|
||||
truncated = 0;
|
||||
|
||||
len = [content length];
|
||||
|
||||
[s appendString: @"<Body xmlns=\"AirSyncBase:\">"];
|
||||
[s appendFormat: @"<Type>%d</Type>", preferredBodyType];
|
||||
[s appendFormat: @"<Truncated>%d</Truncated>", truncated];
|
||||
[s appendFormat: @"<Preview></Preview>"];
|
||||
truncated = 0;
|
||||
|
||||
if (!truncated)
|
||||
// We handle MIMETruncation
|
||||
switch (mimeTruncation)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
content = @"";
|
||||
len = 0; truncated = 1;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
content = [self _truncateContent: content limit: 4096 truncated: &truncated];
|
||||
len = [content length];
|
||||
break;
|
||||
case 2:
|
||||
content = [self _truncateContent: content limit: 5120 truncated: &truncated];
|
||||
len = [content length];
|
||||
break;
|
||||
case 3:
|
||||
content = [self _truncateContent: content limit: 7168 truncated: &truncated];
|
||||
len = [content length];
|
||||
break;
|
||||
case 4:
|
||||
content = [self _truncateContent: content limit: 10240 truncated: &truncated];
|
||||
len = [content length];
|
||||
break;
|
||||
case 5:
|
||||
content = [self _truncateContent: content limit: 20480 truncated: &truncated];
|
||||
len = [content length];
|
||||
break;
|
||||
case 6:
|
||||
content = [self _truncateContent: content limit: 51200 truncated: &truncated];
|
||||
len = [content length];
|
||||
break;
|
||||
case 7:
|
||||
content = [self _truncateContent: content limit: 102400 truncated: &truncated];
|
||||
len = [content length];
|
||||
break;
|
||||
case 8:
|
||||
default:
|
||||
truncated = 0;
|
||||
}
|
||||
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
{
|
||||
[s appendFormat: @"<Body xmlns=\"Email:\">%@</Body>", content];
|
||||
[s appendFormat: @"<BodyTruncated xmlns=\"Email:\">%d</BodyTruncated>", truncated];
|
||||
}
|
||||
else
|
||||
{
|
||||
[s appendString: @"<Body xmlns=\"AirSyncBase:\">"];
|
||||
|
||||
// Set the correct type if client requested text/html but we got text/plain.
|
||||
// For s/mime mails type is always 4 if mimeSupport is 1 or 2.
|
||||
if (preferredBodyType == 2 && nativeBodyType == 1)
|
||||
[s appendString: @"<Type>1</Type>"];
|
||||
else if (([subtype isEqualToString: @"signed"] || [subtype isEqualToString: @"pkcs7-mime"] ) && mimeSupport > 0)
|
||||
[s appendString: @"<Type>4</Type>"];
|
||||
else
|
||||
[s appendFormat: @"<Type>%d</Type>", preferredBodyType];
|
||||
|
||||
[s appendFormat: @"<Truncated>%d</Truncated>", truncated];
|
||||
[s appendFormat: @"<Preview></Preview>"];
|
||||
[s appendFormat: @"<Data>%@</Data>", content];
|
||||
[s appendFormat: @"<EstimatedDataSize>%d</EstimatedDataSize>", len];
|
||||
}
|
||||
[s appendString: @"</Body>"];
|
||||
[s appendString: @"</Body>"];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Attachments -namespace 16
|
||||
attachmentKeys = [self fetchFileAttachmentKeys];
|
||||
if ([attachmentKeys count])
|
||||
|
||||
if ([attachmentKeys count] && !([subtype isEqualToString: @"signed"]))
|
||||
{
|
||||
int i;
|
||||
|
||||
[s appendString: @"<Attachments xmlns=\"AirSyncBase:\">"];
|
||||
|
||||
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
[s appendString: @"<Attachments xmlns=\"Email:\">"];
|
||||
else
|
||||
[s appendString: @"<Attachments xmlns=\"AirSyncBase:\">"];
|
||||
|
||||
for (i = 0; i < [attachmentKeys count]; i++)
|
||||
{
|
||||
value = [attachmentKeys objectAtIndex: i];
|
||||
@@ -759,11 +1131,22 @@ struct GlobalObjectId {
|
||||
// FileReference must be a unique identifier across the whole store. We use the following structure:
|
||||
// mail/<foldername>/<message UID/<pathofpart>
|
||||
// mail/INBOX/2
|
||||
[s appendFormat: @"<FileReference>mail/%@/%@/%@</FileReference>", [[[self container] relativeImap4Name] stringByEscapingURL], [self nameInContainer], [value objectForKey: @"path"]];
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
[s appendFormat: @"<AttName>mail/%@/%@/%@</AttName>", [[[self container] relativeImap4Name] stringByEscapingURL], [self nameInContainer], [value objectForKey: @"path"]];
|
||||
else
|
||||
[s appendFormat: @"<FileReference>mail/%@/%@/%@</FileReference>", [[[self container] relativeImap4Name] stringByEscapingURL], [self nameInContainer], [value objectForKey: @"path"]];
|
||||
|
||||
[s appendFormat: @"<Method>%d</Method>", 1]; // See: http://msdn.microsoft.com/en-us/library/ee160322(v=exchg.80).aspx
|
||||
[s appendFormat: @"<EstimatedDataSize>%d</EstimatedDataSize>", [[value objectForKey: @"size"] intValue]];
|
||||
//[s appendFormat: @"<IsInline>%d</IsInline>", 1];
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
{
|
||||
[s appendFormat: @"<AttMethod>%d</AttMethod>", 1];
|
||||
[s appendFormat: @"<AttSize>%d</AttSize>", [[value objectForKey: @"size"] intValue]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[s appendFormat: @"<Method>%d</Method>", 1]; // See: http://msdn.microsoft.com/en-us/library/ee160322(v=exchg.80).aspx
|
||||
[s appendFormat: @"<EstimatedDataSize>%d</EstimatedDataSize>", [[value objectForKey: @"size"] intValue]];
|
||||
//[s appendFormat: @"<IsInline>%d</IsInline>", 1];
|
||||
}
|
||||
[s appendString: @"</Attachment>"];
|
||||
}
|
||||
|
||||
@@ -774,10 +1157,52 @@ struct GlobalObjectId {
|
||||
[s appendString: @"<Flag xmlns=\"Email:\">"];
|
||||
[s appendFormat: @"<FlagStatus>%d</FlagStatus>", ([self flagged] ? 2 : 0)];
|
||||
[s appendString: @"</Flag>"];
|
||||
|
||||
|
||||
// Categroies/Labels
|
||||
NSEnumerator *categories;
|
||||
categories = [[[self fetchCoreInfos] objectForKey: @"flags"] objectEnumerator];
|
||||
|
||||
if (categories)
|
||||
{
|
||||
NSString *currentFlag;
|
||||
NSDictionary *v;
|
||||
|
||||
v = [[[context activeUser] userDefaults] mailLabelsColors];
|
||||
|
||||
[s appendFormat: @"<Categories xmlns=\"Email:\">"];
|
||||
while ((currentFlag = [categories nextObject]))
|
||||
{
|
||||
if ([[v objectForKey: currentFlag] objectAtIndex:0])
|
||||
[s appendFormat: @"<Category>%@</Category>", [[[v objectForKey: currentFlag] objectAtIndex:0] activeSyncRepresentationInContext: context]];
|
||||
}
|
||||
[s appendFormat: @"</Categories>"];
|
||||
}
|
||||
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"14.0"] ||
|
||||
[[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"14.1"])
|
||||
{
|
||||
id value;
|
||||
NSString *reference;
|
||||
|
||||
value = [[self mailHeaders] objectForKey: @"references"];
|
||||
|
||||
if ([value isKindOfClass: [NSArray class]])
|
||||
reference = [[[value objectAtIndex: 0] componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] objectAtIndex: 0];
|
||||
else
|
||||
reference = [[value componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] objectAtIndex: 0];
|
||||
|
||||
if ([reference length] > 0)
|
||||
[s appendFormat: @"<ConversationId xmlns=\"Email2:\">%@</ConversationId>", [[reference dataUsingEncoding: NSUTF8StringEncoding] activeSyncRepresentationInContext: context]];
|
||||
else if ([[self inReplyTo] length] > 0)
|
||||
[s appendFormat: @"<ConversationId xmlns=\"Email2:\">%@</ConversationId>", [[[self inReplyTo] dataUsingEncoding: NSUTF8StringEncoding] activeSyncRepresentationInContext: context]];
|
||||
else if ([[self messageId] length] > 0)
|
||||
[s appendFormat: @"<ConversationId xmlns=\"Email2:\">%@</ConversationId>", [[[self messageId] dataUsingEncoding: NSUTF8StringEncoding] activeSyncRepresentationInContext: context]];
|
||||
}
|
||||
|
||||
// FIXME - support these in the future
|
||||
//[s appendString: @"<ConversationId xmlns=\"Email2:\">foobar</ConversationId>"];
|
||||
//[s appendString: @"<ConversationIndex xmlns=\"Email2:\">zot=</ConversationIndex>"];
|
||||
|
||||
|
||||
// NativeBodyType -- http://msdn.microsoft.com/en-us/library/ee218276(v=exchg.80).aspx
|
||||
// This is a required child element.
|
||||
@@ -836,6 +1261,65 @@ struct GlobalObjectId {
|
||||
else
|
||||
[self removeFlags: @"seen"];;
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"Categories"]))
|
||||
{
|
||||
NSEnumerator *categories;
|
||||
NSString *currentFlag;
|
||||
NSDictionary *v;
|
||||
|
||||
v = [[[context activeUser] userDefaults] mailLabelsColors];
|
||||
|
||||
// add categories/labels sent from client
|
||||
if ([o isKindOfClass: [NSArray class]])
|
||||
{
|
||||
NSEnumerator *enumerator;
|
||||
NSMutableArray *labels;
|
||||
NSEnumerator *flags;
|
||||
id key;
|
||||
|
||||
labels = [NSMutableArray array];
|
||||
|
||||
enumerator = [v keyEnumerator];
|
||||
flags = [o objectEnumerator];
|
||||
|
||||
while ((currentFlag = [flags nextObject]))
|
||||
{
|
||||
while ((key = [enumerator nextObject]))
|
||||
{
|
||||
if (([currentFlag isEqualToString:[[v objectForKey:key] objectAtIndex:0]]))
|
||||
{
|
||||
[labels addObject: key];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[self addFlags: [labels componentsJoinedByString: @" "]];
|
||||
}
|
||||
|
||||
categories = [[[self fetchCoreInfos] objectForKey: @"flags"] objectEnumerator];
|
||||
|
||||
// remove all categories/labels from server which were not it the list sent from client
|
||||
if (categories)
|
||||
{
|
||||
while ((currentFlag = [categories nextObject]))
|
||||
{
|
||||
// only deal with lables and don't touch flags like seen and flagged
|
||||
if (([v objectForKey: currentFlag]))
|
||||
{
|
||||
if (![o isKindOfClass: [NSArray class]])
|
||||
{
|
||||
[self removeFlags: currentFlag];
|
||||
}
|
||||
else if (([o indexOfObject: [[v objectForKey:currentFlag] objectAtIndex:0]] == NSNotFound))
|
||||
{
|
||||
[self removeFlags: currentFlag];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -37,6 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@interface SOGoSyncCacheObject : NSObject
|
||||
{
|
||||
@public
|
||||
id _uid;
|
||||
id _sequence;
|
||||
}
|
||||
|
||||
@@ -32,9 +32,17 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#import <Foundation/NSNull.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
|
||||
static Class NSNullK;
|
||||
|
||||
@implementation SOGoSyncCacheObject
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
NSNullK = [NSNull class];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
@@ -46,16 +54,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (id) syncCacheObjectWithUID: (id) theUID sequence: (id) theSequence;
|
||||
+ (id) syncCacheObjectWithUID: (id) theUID sequence: (id) theSequence
|
||||
{
|
||||
id o;
|
||||
|
||||
o = [[self alloc] init];
|
||||
|
||||
[o setUID: theUID];
|
||||
[o setSequence: theSequence];
|
||||
|
||||
[o setUID: [NSNumber numberWithInt: [theUID intValue]]];
|
||||
[o setSequence: ([theSequence isKindOfClass: NSNullK] ? theSequence : [NSNumber numberWithInt: [theSequence intValue]])];
|
||||
|
||||
return o;
|
||||
return [o autorelease];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
@@ -67,7 +75,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
- (id) uid
|
||||
{
|
||||
return _uid;
|
||||
return [_uid description];
|
||||
}
|
||||
|
||||
- (void) setUID: (id) theUID
|
||||
@@ -77,7 +85,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
- (id) sequence
|
||||
{
|
||||
return _sequence;
|
||||
return ([_sequence isKindOfClass: NSNullK] ? _sequence : [_sequence description]);
|
||||
}
|
||||
|
||||
- (void) setSequence: (id) theSequence
|
||||
@@ -88,7 +96,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
- (NSComparisonResult) compareUID: (SOGoSyncCacheObject *) theSyncCacheObject
|
||||
{
|
||||
return [[self uid] compare: [theSyncCacheObject uid]];
|
||||
return [self->_uid compare: theSyncCacheObject->_uid];
|
||||
}
|
||||
|
||||
//
|
||||
@@ -97,21 +105,21 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
- (NSComparisonResult) compareSequence: (SOGoSyncCacheObject *) theSyncCacheObject
|
||||
{
|
||||
if ([[self sequence] isEqual: [NSNull null]] &&
|
||||
[[theSyncCacheObject sequence] isEqual: [NSNull null]])
|
||||
if ([self->_sequence isEqual: [NSNull null]] &&
|
||||
[theSyncCacheObject->_sequence isEqual: [NSNull null]])
|
||||
return [self compareUID: theSyncCacheObject];
|
||||
|
||||
if (![[self sequence] isEqual: [NSNull null]] && [[theSyncCacheObject sequence] isEqual: [NSNull null]])
|
||||
if (![self->_sequence isEqual: [NSNull null]] && [theSyncCacheObject->_sequence isEqual: [NSNull null]])
|
||||
return NSOrderedDescending;
|
||||
|
||||
if ([[self sequence] isEqual: [NSNull null]] && ![[theSyncCacheObject sequence] isEqual: [NSNull null]])
|
||||
if ([self->_sequence isEqual: [NSNull null]] && ![theSyncCacheObject->_sequence isEqual: [NSNull null]])
|
||||
return NSOrderedAscending;
|
||||
|
||||
// Must check this here, to avoid comparing NSNull objects
|
||||
if ([[self sequence] compare: [theSyncCacheObject sequence]] == NSOrderedSame)
|
||||
if ([self->_sequence compare: theSyncCacheObject->_sequence] == NSOrderedSame)
|
||||
return [self compareUID: theSyncCacheObject];
|
||||
|
||||
return [[self sequence] compare: [theSyncCacheObject sequence]];
|
||||
return [self->_sequence compare: theSyncCacheObject->_sequence];
|
||||
}
|
||||
|
||||
- (NSString *) description
|
||||
@@ -120,3 +128,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -61,7 +61,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
[response setHeader: @"private" forKey: @"Cache-Control"];
|
||||
[response setHeader: @"OPTIONS, POST" forKey: @"Allow"];
|
||||
[response setHeader: @"14.1" forKey: @"MS-Server-ActiveSync"];
|
||||
[response setHeader: @"2.0,2.1,2.5,12.0,12.1,14.0,14.1" forKey: @"MS-ASProtocolVersions"];
|
||||
[response setHeader: @"2.5,12.0,12.1,14.0,14.1" forKey: @"MS-ASProtocolVersions"];
|
||||
[response setHeader: @"Sync,SendMail,SmartForward,SmartReply,GetAttachment,GetHierarchy,CreateCollection,DeleteCollection,MoveCollection,FolderSync,FolderCreate,FolderDelete,FolderUpdate,MoveItems,GetItemEstimate,MeetingResponse,Search,Settings,Ping,ItemOperations,ResolveRecipients,ValidateCert" forKey: @"MS-ASProtocolCommands"];
|
||||
[response setHeader: @"OPTIONS, POST" forKey: @"Public"];
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// don't send negative reminder - not supported
|
||||
if (delta > 0)
|
||||
[s appendFormat: @"<Reminder xmlns=\"Calendar:\">%d</Reminder>", delta];
|
||||
[s appendFormat: @"<Reminder xmlns=\"Calendar:\">%d</Reminder>", (int)delta];
|
||||
}
|
||||
|
||||
return s;
|
||||
|
||||
@@ -41,7 +41,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
- (NSString *) activeSyncRepresentationInContext: (WOContext *) context;
|
||||
- (void) takeActiveSyncValues: (NSDictionary *) theValues
|
||||
inContext: (WOContext *) context;
|
||||
|
||||
- (void) changeParticipationStatus: (NSDictionary *) theValues
|
||||
inContext: (WOContext *) context
|
||||
component: (id) component;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -38,17 +38,26 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#import <Foundation/NSTimeZone.h>
|
||||
|
||||
#import <NGExtensions/NSString+misc.h>
|
||||
#import <NGExtensions/NSCalendarDate+misc.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <NGObjWeb/WOContext.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
|
||||
#import <NGCards/iCalCalendar.h>
|
||||
#import <NGCards/iCalDateTime.h>
|
||||
#import <NGCards/iCalPerson.h>
|
||||
#import <NGCards/NSCalendarDate+NGCards.h>
|
||||
#import <NGCards/NSString+NGCards.h>
|
||||
#import <NGCards/iCalCalendar.h>
|
||||
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserDefaults.h>
|
||||
#import <SOGo/WORequest+SOGo.h>
|
||||
|
||||
#import <Appointments/iCalEntityObject+SOGo.h>
|
||||
#import <Appointments/iCalRepeatableEntityObject+SOGo.h>
|
||||
#import <Appointments/SOGoAppointmentObject.h>
|
||||
|
||||
#include "iCalAlarm+ActiveSync.h"
|
||||
#include "iCalRecurrenceRule+ActiveSync.h"
|
||||
@@ -97,10 +106,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
else if ([self created])
|
||||
[s appendFormat: @"<DTStamp xmlns=\"Calendar:\">%@</DTStamp>", [[self created] activeSyncRepresentationWithoutSeparatorsInContext: context]];
|
||||
|
||||
// Timezone
|
||||
tz = [(iCalDateTime *)[self firstChildWithTag: @"dtstart"] timeZone];
|
||||
|
||||
// StartTime -- http://msdn.microsoft.com/en-us/library/ee157132(v=exchg.80).aspx
|
||||
if ([self startDate])
|
||||
{
|
||||
if ([self isAllDay])
|
||||
if ([self isAllDay] && !tz)
|
||||
[s appendFormat: @"<StartTime xmlns=\"Calendar:\">%@</StartTime>",
|
||||
[[[self startDate] dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
@@ -113,7 +125,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// EndTime -- http://msdn.microsoft.com/en-us/library/ee157945(v=exchg.80).aspx
|
||||
if ([self endDate])
|
||||
{
|
||||
if ([self isAllDay])
|
||||
if ([self isAllDay] && !tz)
|
||||
[s appendFormat: @"<EndTime xmlns=\"Calendar:\">%@</EndTime>",
|
||||
[[[self endDate] dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
@@ -123,20 +135,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
[s appendFormat: @"<EndTime xmlns=\"Calendar:\">%@</EndTime>", [[self endDate] activeSyncRepresentationWithoutSeparatorsInContext: context]];
|
||||
}
|
||||
|
||||
// Timezone
|
||||
tz = [(iCalDateTime *)[self firstChildWithTag: @"dtstart"] timeZone];
|
||||
|
||||
if (!tz)
|
||||
tz = [iCalTimeZone timeZoneForName: [userTimeZone name]];
|
||||
|
||||
[s appendFormat: @"<TimeZone xmlns=\"Calendar:\">%@</TimeZone>", [tz activeSyncRepresentationInContext: context]];
|
||||
if (![self recurrenceId])
|
||||
[s appendFormat: @"<TimeZone xmlns=\"Calendar:\">%@</TimeZone>", [tz activeSyncRepresentationInContext: context]];
|
||||
|
||||
// Organizer and other invitations related properties
|
||||
if ((organizer = [self organizer]))
|
||||
{
|
||||
meetingStatus = 1; // meeting and the user is the meeting organizer.
|
||||
o = [organizer rfc822Email];
|
||||
if ([o length])
|
||||
if (![self recurrenceId] && [o length])
|
||||
{
|
||||
[s appendFormat: @"<Organizer_Email xmlns=\"Calendar:\">%@</Organizer_Email>", o];
|
||||
|
||||
@@ -225,9 +235,37 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//[s appendFormat: @"<Importance xmlns=\"Calendar:\">%d</Importance>", v];
|
||||
|
||||
// UID -- http://msdn.microsoft.com/en-us/library/ee159919(v=exchg.80).aspx
|
||||
if ([[self uid] length])
|
||||
[s appendFormat: @"<UID xmlns=\"Calendar:\">%@</UID>", [self uid]];
|
||||
|
||||
if (![self recurrenceId] && [[self uid] length])
|
||||
[s appendFormat: @"<UID xmlns=\"Calendar:\">%@</UID>", [[self uid] activeSyncRepresentationInContext: context]];
|
||||
|
||||
// Recurrence rules
|
||||
if ([self isRecurrent])
|
||||
[s appendString: [[[self recurrenceRules] lastObject] activeSyncRepresentationInContext: context]];
|
||||
|
||||
// Comment
|
||||
o = [self comment];
|
||||
//if (![self recurrenceId] && [o length])
|
||||
if ([o length])
|
||||
{
|
||||
// It is very important here to NOT set <Truncated>0</Truncated> in the response,
|
||||
// otherwise it'll prevent WP8 phones from sync'ing. See #3028 for details.
|
||||
o = [o activeSyncRepresentationInContext: context];
|
||||
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
{
|
||||
[s appendFormat: @"<Body xmlns=\"Calendar:\">%@</Body>", o];
|
||||
[s appendString: @"<BodyTruncated xmlns=\"Calendar:\">0</BodyTruncated>"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[s appendString: @"<Body xmlns=\"AirSyncBase:\">"];
|
||||
[s appendFormat: @"<Type>%d</Type>", 1];
|
||||
[s appendFormat: @"<EstimatedDataSize>%d</EstimatedDataSize>", (int)[o length]];
|
||||
[s appendFormat: @"<Data>%@</Data>", o];
|
||||
[s appendString: @"</Body>"];
|
||||
}
|
||||
}
|
||||
|
||||
// Sensitivity
|
||||
if ([[self accessClass] isEqualToString: @"PRIVATE"])
|
||||
v = 2;
|
||||
@@ -250,7 +288,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
[s appendFormat: @"</Categories>"];
|
||||
}
|
||||
|
||||
|
||||
// Reminder -- http://msdn.microsoft.com/en-us/library/ee219691(v=exchg.80).aspx
|
||||
// TODO: improve this to handle more alarm types
|
||||
if ([self hasAlarms])
|
||||
@@ -261,27 +298,79 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
[s appendString: [alarm activeSyncRepresentationInContext: context]];
|
||||
}
|
||||
|
||||
// Recurrence rules
|
||||
// Exceptions
|
||||
if ([self isRecurrent])
|
||||
{
|
||||
[s appendString: [[[self recurrenceRules] lastObject] activeSyncRepresentationInContext: context]];
|
||||
NSMutableArray *components, *exdates;
|
||||
iCalEvent *current_component;
|
||||
NSString *recurrence_id;
|
||||
|
||||
unsigned int count, max, i;
|
||||
|
||||
components = [NSMutableArray arrayWithArray: [[self parent] events]];
|
||||
max = [components count];
|
||||
|
||||
if (max > 1 || [self hasExceptionDates])
|
||||
{
|
||||
exdates = [NSMutableArray arrayWithArray: [self exceptionDates]];
|
||||
|
||||
[s appendString: @"<Exceptions xmlns=\"Calendar:\">"];
|
||||
|
||||
for (count = 1; count < max; count++)
|
||||
{
|
||||
current_component = [components objectAtIndex: count] ;
|
||||
|
||||
if ([self isAllDay])
|
||||
{
|
||||
recurrence_id = [NSString stringWithFormat: @"%@",
|
||||
[[[current_component recurrenceId] dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: -[userTimeZone secondsFromGMTForDate:
|
||||
[current_component recurrenceId]]]
|
||||
activeSyncRepresentationWithoutSeparatorsInContext: context]];
|
||||
}
|
||||
else
|
||||
{
|
||||
recurrence_id = [NSString stringWithFormat: @"%@", [[current_component recurrenceId]
|
||||
activeSyncRepresentationWithoutSeparatorsInContext: context]];
|
||||
}
|
||||
|
||||
[s appendString: @"<Exception>"];
|
||||
[s appendFormat: @"<Exception_StartTime xmlns=\"Calendar:\">%@</Exception_StartTime>", recurrence_id];
|
||||
[s appendFormat: @"%@", [current_component activeSyncRepresentationInContext: context]];
|
||||
[s appendString: @"</Exception>"];
|
||||
}
|
||||
|
||||
for (i = 0; i < [exdates count]; i++)
|
||||
{
|
||||
[s appendString: @"<Exception>"];
|
||||
[s appendString: @"<Exception_Deleted>1</Exception_Deleted>"];
|
||||
|
||||
if ([self isAllDay])
|
||||
{
|
||||
recurrence_id = [NSString stringWithFormat: @"%@",
|
||||
[[[[exdates objectAtIndex: i] asCalendarDate] dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: -[userTimeZone secondsFromGMTForDate:
|
||||
[[exdates objectAtIndex: i] asCalendarDate]]]
|
||||
activeSyncRepresentationWithoutSeparatorsInContext: context]];
|
||||
}
|
||||
else
|
||||
{
|
||||
recurrence_id = [NSString stringWithFormat: @"%@", [[[exdates objectAtIndex: i] asCalendarDate]
|
||||
activeSyncRepresentationWithoutSeparatorsInContext: context]];
|
||||
}
|
||||
|
||||
[s appendFormat: @"<Exception_StartTime xmlns=\"Calendar:\">%@</Exception_StartTime>", recurrence_id];
|
||||
[s appendString: @"</Exception>"];
|
||||
}
|
||||
|
||||
[s appendString: @"</Exceptions>"];
|
||||
}
|
||||
}
|
||||
|
||||
// Comment
|
||||
o = [self comment];
|
||||
if ([o length])
|
||||
{
|
||||
// It is very important here to NOT set <Truncated>0</Truncated> in the response,
|
||||
// otherwise it'll prevent WP8 phones from sync'ing. See #3028 for details.
|
||||
o = [o activeSyncRepresentationInContext: context];
|
||||
[s appendString: @"<Body xmlns=\"AirSyncBase:\">"];
|
||||
[s appendFormat: @"<Type>%d</Type>", 1];
|
||||
[s appendFormat: @"<EstimatedDataSize>%d</EstimatedDataSize>", [o length]];
|
||||
[s appendFormat: @"<Data>%@</Data>", o];
|
||||
[s appendString: @"</Body>"];
|
||||
}
|
||||
|
||||
[s appendFormat: @"<NativeBodyType xmlns=\"AirSyncBase:\">%d</NativeBodyType>", 1];
|
||||
if (![self recurrenceId])
|
||||
[s appendFormat: @"<NativeBodyType xmlns=\"AirSyncBase:\">%d</NativeBodyType>", 1];
|
||||
|
||||
return s;
|
||||
}
|
||||
@@ -327,14 +416,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
- (void) takeActiveSyncValues: (NSDictionary *) theValues
|
||||
inContext: (WOContext *) context
|
||||
{
|
||||
iCalDateTime *start, *end;
|
||||
iCalDateTime *start, *end; //, *oldstart;
|
||||
NSCalendarDate *oldstart;
|
||||
NSTimeZone *userTimeZone;
|
||||
iCalTimeZone *tz;
|
||||
id o;
|
||||
int deltasecs;
|
||||
|
||||
NSInteger tzOffset;
|
||||
BOOL isAllDay;
|
||||
|
||||
|
||||
NSMutableArray *occurences;
|
||||
|
||||
occurences = [NSMutableArray arrayWithArray: [[self parent] events]];
|
||||
|
||||
if ((o = [theValues objectForKey: @"UID"]))
|
||||
[self setUid: o];
|
||||
|
||||
@@ -347,6 +441,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
{
|
||||
isAllDay = YES;
|
||||
}
|
||||
else if ([occurences count] && !([theValues objectForKey: @"AllDayEvent"]))
|
||||
{
|
||||
// If the occurence has no AllDay tag use it from master.
|
||||
isAllDay = [[occurences objectAtIndex: 0] isAllDay];
|
||||
}
|
||||
|
||||
//
|
||||
// 0- free, 1- tentative, 2- busy and 3- out of office
|
||||
@@ -384,15 +483,28 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// Some Windows devices don't send during event updates.
|
||||
//if ((o = [theValues objectForKey: @"TimeZone"]))
|
||||
// {
|
||||
userTimeZone = [[[context activeUser] userDefaults] timeZone];
|
||||
tz = [iCalTimeZone timeZoneForName: [userTimeZone name]];
|
||||
[(iCalCalendar *) parent addTimeZone: tz];
|
||||
//}
|
||||
// }
|
||||
//else
|
||||
{
|
||||
// We haven't received a timezone, let's use the user's timezone
|
||||
// specified in SOGo for now.
|
||||
userTimeZone = [[[context activeUser] userDefaults] timeZone];
|
||||
tz = [iCalTimeZone timeZoneForName: [userTimeZone name]];
|
||||
[(iCalCalendar *) parent addTimeZone: tz];
|
||||
}
|
||||
|
||||
// FIXME: merge with iCalToDo
|
||||
if ((o = [[theValues objectForKey: @"Body"] objectForKey: @"Data"]))
|
||||
[self setComment: o];
|
||||
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
{
|
||||
if ((o = [theValues objectForKey: @"Body"]))
|
||||
[self setComment: o];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((o = [[theValues objectForKey: @"Body"] objectForKey: @"Data"]))
|
||||
[self setComment: o];
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"Location"]))
|
||||
[self setLocation: o];
|
||||
|
||||
@@ -400,25 +512,24 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
{
|
||||
o = [o calendarDate];
|
||||
start = (iCalDateTime *) [self uniqueChildWithTag: @"dtstart"];
|
||||
oldstart = [start dateTime];
|
||||
[start setTimeZone: tz];
|
||||
|
||||
if (isAllDay)
|
||||
{
|
||||
tzOffset = [userTimeZone secondsFromGMTForDate: o];
|
||||
o = [o dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: tzOffset];
|
||||
if (isAllDay)
|
||||
{
|
||||
[start setDate: o];
|
||||
[start setTimeZone: nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
tzOffset = [userTimeZone secondsFromGMTForDate: o];
|
||||
o = [o dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: tzOffset];
|
||||
[start setDateTime: o];
|
||||
}
|
||||
|
||||
// Calculate delta if start date has been changed.
|
||||
if (oldstart)
|
||||
deltasecs = [[start dateTime ] timeIntervalSinceDate: oldstart] * -1;
|
||||
else
|
||||
deltasecs = 0;
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"EndTime"]))
|
||||
@@ -429,19 +540,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
if (isAllDay)
|
||||
{
|
||||
tzOffset = [userTimeZone secondsFromGMTForDate: o];
|
||||
o = [o dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: tzOffset];
|
||||
[end setDate: o];
|
||||
[end setTimeZone: nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
tzOffset = [userTimeZone secondsFromGMTForDate: o];
|
||||
o = [o dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: tzOffset];
|
||||
[end setDateTime: o];
|
||||
}
|
||||
}
|
||||
@@ -485,6 +588,177 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
RELEASE(rule);
|
||||
|
||||
[rule takeActiveSyncValues: o inContext: context];
|
||||
|
||||
// Exceptions
|
||||
if ((o = [theValues objectForKey: @"Exceptions"]) && [o isKindOfClass: [NSArray class]])
|
||||
{
|
||||
NSCalendarDate *recurrenceId, *adjustedRecurrenceId, *currentId;
|
||||
NSMutableArray *exdates, *exceptionstouched;
|
||||
iCalEvent *currentOccurence;
|
||||
NSDictionary *exception;
|
||||
|
||||
unsigned int i, count, max;
|
||||
|
||||
[self removeAllExceptionDates];
|
||||
|
||||
exdates = [NSMutableArray array];
|
||||
exceptionstouched = [NSMutableArray array];
|
||||
|
||||
for (i = 0; i < [o count]; i++)
|
||||
{
|
||||
exception = [o objectAtIndex: i];
|
||||
|
||||
if (![[exception objectForKey: @"Exception_Deleted"] intValue])
|
||||
{
|
||||
recurrenceId = [[exception objectForKey: @"Exception_StartTime"] asCalendarDate];
|
||||
|
||||
if (isAllDay)
|
||||
recurrenceId = [recurrenceId dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: [userTimeZone secondsFromGMTForDate:recurrenceId]];
|
||||
|
||||
// When moving the calendar entry (i.e. changing the startDate) iOS and Android sometimes send a value for
|
||||
// Exception_StartTime which is not what we expect.
|
||||
// With this we make sure the recurrenceId is always correct.
|
||||
//
|
||||
// iOS problem - If the master is a no-allday-event but the exception is, an invalid Exception_StartTime is in the request.
|
||||
// e.g. it sends 20150409T040000Z instead of 20150409T060000Z;
|
||||
// This might be a special case since iPhone doesn't allow an allday-exception on a non-allday-event.
|
||||
if (!([[start dateTime] compare: [[start dateTime] hour:[recurrenceId hourOfDay] minute:[recurrenceId minuteOfHour]]] == NSOrderedSame))
|
||||
recurrenceId = [recurrenceId hour:[[start dateTime] hourOfDay] minute:[[start dateTime] minuteOfHour]];
|
||||
|
||||
// We need to store the recurrenceIds and exception dates adjusted by deltasecs.
|
||||
// This ensures that the adjustment in SOGoCalendarComponent->updateComponent->_updateRecurrenceIDsWithEvent gives the correct dates.
|
||||
adjustedRecurrenceId = [recurrenceId dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0 seconds: deltasecs];
|
||||
|
||||
// search for an existing occurence and update it
|
||||
max = [occurences count];
|
||||
currentOccurence = nil;
|
||||
count = 1;
|
||||
while (count < max)
|
||||
{
|
||||
currentOccurence = [occurences objectAtIndex: count] ;
|
||||
currentId = [currentOccurence recurrenceId];
|
||||
|
||||
if ([currentId compare: adjustedRecurrenceId] == NSOrderedSame)
|
||||
{
|
||||
[exceptionstouched addObject: adjustedRecurrenceId];
|
||||
[currentOccurence takeActiveSyncValues: exception inContext: context];
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
count++;
|
||||
currentOccurence = nil;
|
||||
}
|
||||
|
||||
// Create a new occurence if we found none to update.
|
||||
if (!currentOccurence)
|
||||
{
|
||||
iCalDateTime *recid;
|
||||
|
||||
currentOccurence = [self mutableCopy];
|
||||
[currentOccurence removeAllRecurrenceRules];
|
||||
[currentOccurence removeAllExceptionRules];
|
||||
[currentOccurence removeAllExceptionDates];
|
||||
|
||||
[[self parent] addToEvents: currentOccurence];
|
||||
[currentOccurence takeActiveSyncValues: exception inContext: context];
|
||||
|
||||
recid = (iCalDateTime *)[currentOccurence uniqueChildWithTag: @"recurrence-id"];
|
||||
if (isAllDay)
|
||||
[recid setDate: adjustedRecurrenceId];
|
||||
else
|
||||
[recid setDateTime: adjustedRecurrenceId];
|
||||
|
||||
[exceptionstouched addObject: [recid dateTime]];
|
||||
}
|
||||
}
|
||||
else if ([[exception objectForKey: @"Exception_Deleted"] intValue])
|
||||
{
|
||||
recurrenceId = [[exception objectForKey: @"Exception_StartTime"] asCalendarDate];
|
||||
|
||||
if (isAllDay)
|
||||
recurrenceId = [recurrenceId dateByAddingYears: 0 months: 0
|
||||
days: 0 hours: 0 minutes: 0
|
||||
seconds: [userTimeZone secondsFromGMTForDate:recurrenceId]];
|
||||
|
||||
// We add only valid exception dates.
|
||||
if ([self doesOccurOnDate: recurrenceId] &&
|
||||
([[start dateTime] compare: [[start dateTime] hour:[recurrenceId hourOfDay]
|
||||
minute:[recurrenceId minuteOfHour]]] == NSOrderedSame))
|
||||
{
|
||||
// We need to store the recurrenceIds and exception dates adjusted by deltasecs.
|
||||
// This ensures that the adjustment in SOGoCalendarComponent->updateComponent->_updateRecurrenceIDsWithEvent gives the correct dates.
|
||||
[exdates addObject: [recurrenceId dateByAddingYears: 0 months: 0 days: 0 hours: 0 minutes: 0 seconds: deltasecs]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update exception dates in master event.
|
||||
max = [exdates count];
|
||||
if (max > 0)
|
||||
{
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
if (([exceptionstouched indexOfObject: [exdates objectAtIndex: count]] == NSNotFound))
|
||||
[self addToExceptionDates: [exdates objectAtIndex: count]];
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all exceptions included in the request.
|
||||
max = [occurences count];
|
||||
count = 1; // skip the master event
|
||||
while (count < max)
|
||||
{
|
||||
currentOccurence = [occurences objectAtIndex: count] ;
|
||||
currentId = [currentOccurence recurrenceId];
|
||||
|
||||
// Delete all occurences which are not touched (modified/added).
|
||||
if (([exceptionstouched indexOfObject: currentId] == NSNotFound))
|
||||
[[[self parent] children] removeObject: currentOccurence];
|
||||
|
||||
count++;
|
||||
}
|
||||
}
|
||||
else if ([self isRecurrent])
|
||||
{
|
||||
// We have no exceptions in request but there is a recurrence rule.
|
||||
// Remove all excpetions and exception dates.
|
||||
iCalEvent *currentOccurence;
|
||||
unsigned int count, max;
|
||||
|
||||
[self removeAllExceptionDates];
|
||||
max = [occurences count];
|
||||
count = 1; // skip the master event
|
||||
while (count < max)
|
||||
{
|
||||
currentOccurence = [occurences objectAtIndex: count];
|
||||
[[[self parent] children] removeObject: currentOccurence];
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ([self isRecurrent])
|
||||
{
|
||||
// We have no recurrence rule in request.
|
||||
// Remove all exceptions, exception dates and recurrence rules.
|
||||
iCalEvent *currentOccurence;
|
||||
unsigned int count, max;
|
||||
|
||||
[self removeAllRecurrenceRules];
|
||||
[self removeAllExceptionRules];
|
||||
[self removeAllExceptionDates];
|
||||
|
||||
max = [occurences count];
|
||||
count = 1; // skip the master event
|
||||
while (count < max)
|
||||
{
|
||||
currentOccurence = [occurences objectAtIndex: count];
|
||||
[[[self parent] children] removeObject: currentOccurence];
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
// Organizer - we don't touch the value unless we're the organizer
|
||||
@@ -492,7 +766,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
([self userIsOrganizer: [context activeUser]] || [[context activeUser] hasEmail: o]))
|
||||
{
|
||||
iCalPerson *person;
|
||||
|
||||
|
||||
person = [iCalPerson elementWithTag: @"organizer"];
|
||||
[person setEmail: o];
|
||||
[person setCn: [theValues objectForKey: @"Organizer_Name"]];
|
||||
@@ -500,14 +774,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
[self setOrganizer: person];
|
||||
}
|
||||
|
||||
//
|
||||
// iOS is plain stupid here. It seends event invitations with no Organizer.
|
||||
// We check this corner-case and if MeetingStatus == 1 (see http://msdn.microsoft.com/en-us/library/ee219342(v=exchg.80).aspx or details)
|
||||
// and there's no organizer, we fake one.
|
||||
//
|
||||
if ((o = [theValues objectForKey: @"MeetingStatus"]))
|
||||
{
|
||||
if ([o intValue] == 1 && ![theValues objectForKey: @"Organizer_Email"])
|
||||
//
|
||||
// iOS is plain stupid here. It seends event invitations with no Organizer.
|
||||
// We check this corner-case and if MeetingStatus == 1 (see http://msdn.microsoft.com/en-us/library/ee219342(v=exchg.80).aspx or details)
|
||||
// and there's no organizer, we fake one.
|
||||
//
|
||||
if ([o intValue] == 1 && ![theValues objectForKey: @"Organizer_Email"] && ![[[self organizer] rfc822Email] length])
|
||||
{
|
||||
iCalPerson *person;
|
||||
|
||||
@@ -517,6 +791,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
[person setPartStat: @"ACCEPTED"];
|
||||
[self setOrganizer: person];
|
||||
}
|
||||
|
||||
//
|
||||
// When MeetingResponse fails Outlook still sends a new calendar entry with MeetingStatus=3.
|
||||
// Use the organizer from the request if the event has no organizer.
|
||||
//
|
||||
if ([o intValue] == 3 && [theValues objectForKey: @"Organizer_Email"] && ![[[self organizer] rfc822Email] length])
|
||||
{
|
||||
iCalPerson *person;
|
||||
person = [iCalPerson elementWithTag: @"organizer"];
|
||||
[person setEmail: [theValues objectForKey: @"Organizer_Email"]];
|
||||
[person setCn: [theValues objectForKey: @"Organizer_Name"]];
|
||||
[person setPartStat: @"ACCEPTED"];
|
||||
[self setOrganizer: person];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -526,7 +814,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
{
|
||||
// Windows phones sens sometimes an empty Attendees tag.
|
||||
// We check it's an array before processing it.
|
||||
if ((o = [theValues objectForKey: @"Attendees"])&& [o isKindOfClass: [NSArray class]])
|
||||
if ((o = [theValues objectForKey: @"Attendees"]) && [o isKindOfClass: [NSArray class]])
|
||||
{
|
||||
NSMutableArray *attendees;
|
||||
NSDictionary *attendee;
|
||||
@@ -575,4 +863,36 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
}
|
||||
}
|
||||
|
||||
- (void) changeParticipationStatus: (NSDictionary *) theValues
|
||||
inContext: (WOContext *) context
|
||||
component: (id) component
|
||||
{
|
||||
NSString *status;
|
||||
id o;
|
||||
|
||||
// See: https://msdn.microsoft.com/en-us/library/ee202290(v=exchg.80).aspx
|
||||
//
|
||||
// 0 == Free
|
||||
// 1 == Tentative
|
||||
// 2 == Busy
|
||||
// 3 == Out of Office
|
||||
// 4 == Working elsehwere
|
||||
//
|
||||
if ((o = [theValues objectForKey: @"BusyStatus"]))
|
||||
{
|
||||
// We translate >= 2 into ACCEPTED
|
||||
if ([o intValue] == 0)
|
||||
status = @"NEEDS-ACTION";
|
||||
else if ([o intValue] >= 2)
|
||||
status = @"ACCEPTED";
|
||||
else
|
||||
status = @"TENTATIVE";
|
||||
|
||||
// There's no delegate in EAS
|
||||
[(SOGoAppointmentObject *) component changeParticipationStatus: status
|
||||
withDelegate: nil
|
||||
alarm: nil];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -140,7 +140,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// Simple reccurrence rule of type "Monthly"
|
||||
type = 2;
|
||||
[s appendFormat: @"<Recurrence_DayOfMonth xmlns=\"Calendar:\">%d</Recurrence_DayOfMonth>",
|
||||
[[[self parent] startDate] dayOfMonth]];
|
||||
(int)[[[self parent] startDate] dayOfMonth]];
|
||||
}
|
||||
}
|
||||
else if ([self frequency] == iCalRecurrenceFrequenceYearly)
|
||||
|
||||
@@ -38,6 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#import <NGExtensions/NSString+misc.h>
|
||||
#import <NGObjWeb/WOContext.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserDefaults.h>
|
||||
@@ -49,6 +50,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "NSDate+ActiveSync.h"
|
||||
#include "NSString+ActiveSync.h"
|
||||
|
||||
|
||||
@implementation iCalToDo (ActiveSync)
|
||||
|
||||
- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
|
||||
@@ -62,11 +64,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
s = [NSMutableString string];
|
||||
|
||||
// Complete
|
||||
o = [self completed];
|
||||
[s appendFormat: @"<Complete xmlns=\"Tasks:\">%d</Complete>", (o ? 1 : 0)];
|
||||
[s appendFormat: @"<Complete xmlns=\"Tasks:\">%d</Complete>", [[self status] isEqualToString: @"COMPLETED"] ? 1 : 0];
|
||||
|
||||
// DateCompleted
|
||||
if (o)
|
||||
if ((o = [self completed]))
|
||||
[s appendFormat: @"<DateCompleted xmlns=\"Tasks:\">%@</DateCompleted>", [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
// Start date
|
||||
@@ -97,6 +98,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// Reminder - FIXME
|
||||
[s appendFormat: @"<ReminderSet xmlns=\"Tasks:\">%d</ReminderSet>", 0];
|
||||
|
||||
// Sensitivity
|
||||
if ([[self accessClass] isEqualToString: @"PRIVATE"])
|
||||
v = 2;
|
||||
else if ([[self accessClass] isEqualToString: @"CONFIDENTIAL"])
|
||||
@@ -104,6 +106,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
else
|
||||
v = 0;
|
||||
|
||||
[s appendFormat: @"<Sensitivity xmlns=\"Tasks:\">%d</Sensitivity>", v];
|
||||
|
||||
categories = [self categories];
|
||||
|
||||
if ([categories count])
|
||||
@@ -126,11 +130,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// It is very important here to NOT set <Truncated>0</Truncated> in the response,
|
||||
// otherwise it'll prevent WP8 phones from sync'ing. See #3028 for details.
|
||||
o = [o activeSyncRepresentationInContext: context];
|
||||
[s appendString: @"<Body xmlns=\"AirSyncBase:\">"];
|
||||
[s appendFormat: @"<Type>%d</Type>", 1];
|
||||
[s appendFormat: @"<EstimatedDataSize>%d</EstimatedDataSize>", [o length]];
|
||||
[s appendFormat: @"<Data>%@</Data>", o];
|
||||
[s appendString: @"</Body>"];
|
||||
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
{
|
||||
[s appendFormat: @"<Body xmlns=\"Tasks:\">%@</Body>", o];
|
||||
[s appendString: @"<BodyTruncated xmlns=\"Tasks:\">0</BodyTruncated>"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[s appendString: @"<Body xmlns=\"AirSyncBase:\">"];
|
||||
[s appendFormat: @"<Type>%d</Type>", 1];
|
||||
[s appendFormat: @"<EstimatedDataSize>%d</EstimatedDataSize>", (int)[o length]];
|
||||
[s appendFormat: @"<Data>%@</Data>", o];
|
||||
[s appendString: @"</Body>"];
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
@@ -143,8 +156,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
iCalTimeZone *tz;
|
||||
id o;
|
||||
|
||||
NSInteger tzOffset;
|
||||
|
||||
userTimeZone = [[[context activeUser] userDefaults] timeZone];
|
||||
tz = [iCalTimeZone timeZoneForName: [userTimeZone name]];
|
||||
[(iCalCalendar *) parent addTimeZone: tz];
|
||||
@@ -154,9 +165,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
[self setSummary: o];
|
||||
|
||||
// FIXME: merge with iCalEvent
|
||||
if ((o = [[theValues objectForKey: @"Body"] objectForKey: @"Data"]))
|
||||
[self setComment: o];
|
||||
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
{
|
||||
if ((o = [theValues objectForKey: @"Body"]))
|
||||
[self setComment: o];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((o = [[theValues objectForKey: @"Body"] objectForKey: @"Data"]))
|
||||
[self setComment: o];
|
||||
}
|
||||
|
||||
if ([[theValues objectForKey: @"Complete"] intValue] &&
|
||||
((o = [theValues objectForKey: @"DateCompleted"])) )
|
||||
@@ -165,27 +183,32 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
o = [o calendarDate];
|
||||
completed = (iCalDateTime *) [self uniqueChildWithTag: @"completed"];
|
||||
//tzOffset = [[o timeZone] secondsFromGMTForDate: o];
|
||||
//o = [o dateByAddingYears: 0 months: 0 days: 0
|
||||
// hours: 0 minutes: 0
|
||||
// seconds: -tzOffset];
|
||||
[completed setDate: o];
|
||||
[self setStatus: @"COMPLETED"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self setStatus: @"IN-PROCESS"];
|
||||
[self setCompleted: nil];
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"DueDate"]))
|
||||
{
|
||||
iCalDateTime *due;
|
||||
|
||||
|
||||
o = [o calendarDate];
|
||||
due = (iCalDateTime *) [self uniqueChildWithTag: @"due"];
|
||||
[due setTimeZone: tz];
|
||||
|
||||
tzOffset = [userTimeZone secondsFromGMTForDate: o];
|
||||
o = [o dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: tzOffset];
|
||||
[due setDateTime: o];
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"StartDate"]))
|
||||
{
|
||||
iCalDateTime *due;
|
||||
|
||||
o = [o calendarDate];
|
||||
due = (iCalDateTime *) [self uniqueChildWithTag: @"dtstart"];
|
||||
[due setTimeZone: tz];
|
||||
[due setDateTime: o];
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -57,8 +57,6 @@ ProxyPreserveHost On
|
||||
# Allow from your-cas-host-addr
|
||||
# </Proxy>
|
||||
|
||||
ProxyPass /SOGo http://127.0.0.1:20000/SOGo retry=0
|
||||
|
||||
# Enable to use Microsoft ActiveSync support
|
||||
# Note that you MUST have many sogod workers to use ActiveSync.
|
||||
# See the SOGo Installation and Configuration guide for more details.
|
||||
@@ -67,11 +65,13 @@ ProxyPass /SOGo http://127.0.0.1:20000/SOGo retry=0
|
||||
# http://127.0.0.1:20000/SOGo/Microsoft-Server-ActiveSync \
|
||||
# retry=60 connectiontimeout=5 timeout=360
|
||||
|
||||
ProxyPass /SOGo http://127.0.0.1:20000/SOGo retry=0
|
||||
|
||||
<Proxy http://127.0.0.1:20000/SOGo>
|
||||
## adjust the following to your configuration
|
||||
RequestHeader set "x-webobjects-server-port" "443"
|
||||
RequestHeader set "x-webobjects-server-name" "yourhostname"
|
||||
RequestHeader set "x-webobjects-server-url" "https://yourhostname"
|
||||
# RequestHeader set "x-webobjects-server-name" "yourhostname"
|
||||
# RequestHeader set "x-webobjects-server-url" "https://yourhostname"
|
||||
|
||||
## When using proxy-side autentication, you need to uncomment and
|
||||
## adjust the following line:
|
||||
@@ -90,5 +90,6 @@ ProxyPass /SOGo http://127.0.0.1:20000/SOGo retry=0
|
||||
<IfModule rewrite_module>
|
||||
RewriteEngine On
|
||||
RewriteRule ^/.well-known/caldav/?$ /SOGo/dav [R=301]
|
||||
RewriteRule ^/.well-known/carddav/?$ /SOGo/dav [R=301]
|
||||
</IfModule>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
Installation and Configuration Guide
|
||||
====================================
|
||||
:toc: left
|
||||
:icons: font
|
||||
|
||||
////
|
||||
|
||||
@@ -54,7 +56,7 @@ at http://www.sogo.nu/
|
||||
Architecture and Compatibility
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
image::images/architecture.png[System Architecture]
|
||||
image::images/architecture.png[System Architecture, 400, 964]
|
||||
|
||||
Standard protocols such as CalDAV, CardDAV, GroupDAV, HTTP, IMAP and
|
||||
SMTP are used to communicate with the SOGo platform or its
|
||||
@@ -167,10 +169,10 @@ Operating System Requirements
|
||||
The following 32-bit and 64-bit operating systems are currently
|
||||
supported by SOGo:
|
||||
|
||||
* Red Hat Enterprise Linux (RHEL) Server 5 and 6
|
||||
* Community ENTerprise Operating System (CentOS) 5 and 6
|
||||
* Debian GNU/Linux 5.0 (Lenny) to 7.0 (Wheezy)
|
||||
* Ubuntu 10.04 (Lucid) to 14.04 (Trusty)
|
||||
* Red Hat Enterprise Linux (RHEL) Server 5, 6 and 7
|
||||
* Community ENTerprise Operating System (CentOS) 5, 6 and 7
|
||||
* Debian GNU/Linux 6.0 (Squeeze) to 8.0 (Jessie)
|
||||
* Ubuntu 12.04 (Precise) to 14.04 (Trusty)
|
||||
|
||||
Make sure the required components are started automatically at boot time
|
||||
and that they are running before proceeding with the SOGo configuration.
|
||||
@@ -179,7 +181,7 @@ standard distribution. For example, if you are using Red Hat Enterprise
|
||||
Linux 5, you have to be subscribed to the Red Hat Network before
|
||||
continuing with the SOGo software installation.
|
||||
|
||||
This document covers the installation of SOGo under RHEL 6.
|
||||
NOTE: This document covers the installation of SOGo under RHEL 6.
|
||||
|
||||
For installation instructions on Debian and Ubuntu, please refer
|
||||
directly to the SOGo website at http://www.sogo.nu/.
|
||||
@@ -194,7 +196,8 @@ Installation
|
||||
|
||||
This section will guide you through the installation of SOGo together
|
||||
with its dependencies. The steps described here apply to an RPM-based
|
||||
installation for a Red Hat or CentOS distribution.
|
||||
installation for a Red Hat or CentOS 6 distribution. Most of these steps
|
||||
should apply to all supported operating systems.
|
||||
|
||||
Software Downloads
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
@@ -293,7 +296,7 @@ associated to a domain is limited to access only the users data from the
|
||||
same domain. Consequently, the configuration parameters of SOGo are
|
||||
defined on three levels:
|
||||
|
||||
image::images/preferences-hierarchy.png[Preferences Hierarchy]
|
||||
image::images/preferences-hierarchy.png[Preferences Hierarchy, 400, 400]
|
||||
|
||||
Each level inherits the preferences of the parent level. Therefore,
|
||||
domain preferences define the defaults values of the user preferences,
|
||||
@@ -566,17 +569,29 @@ usernames like this: `SOGoSuperUsernames = (<username1>[, <username2>, ...]);`
|
||||
for SOGo. Possible values are:
|
||||
|
||||
[options="compact"]
|
||||
* `Arabic`
|
||||
* `Basque`
|
||||
* `BrazilianPortuguese`
|
||||
* `Catalan`
|
||||
* `Czech`
|
||||
* `Danish`
|
||||
* `Dutch`
|
||||
* `English`
|
||||
* `Finnish`
|
||||
* `French`
|
||||
* `German`
|
||||
* `Hungarian`
|
||||
* `Icelandic`
|
||||
* `Italian`
|
||||
* `NorwegianBokmal`
|
||||
* `NorwegianNynorsk`
|
||||
* `Polish`
|
||||
* `Russian`
|
||||
* `Spanish`
|
||||
* `Slovak`
|
||||
* `SpanishSpain`
|
||||
* `SpanishArgentina`
|
||||
* `Swedish`
|
||||
* `Ukrainian`
|
||||
* `Welsh`
|
||||
|
||||
|D |SOGoNotifyOnPersonalModifications
|
||||
@@ -649,7 +664,7 @@ of 1 day by default.
|
||||
|Parameter used to configure which languages are available from SOGo's
|
||||
Web interface. Available languages are specified as an array of string.
|
||||
|
||||
The default value is: `( "Czech", "Welsh", "English", "Spanish", "French", "German", "Italian", "Hungarian", "Dutch", "BrazilianPortuguese", "Polish", "Russian", Ukrainian", "Swedish" )`
|
||||
The default value is: `( "Arabic", "Basque", "Catalan", "Czech", "Dutch", "Danish", "Welsh", "English", "SpanishSpain", "SpanishArgentina", "Finnish", "French", "German", "Icelandic", "Italian", "Hungarian", "BrazilianPortuguese", "NorwegianBokmal", "NorwegianNynorsk", "Polish", "Russian", "Slovak", "Ukrainian", "Swedish" )`
|
||||
|
||||
|D |SOGoHideSystemEMail
|
||||
|Parameter used to control if SOGo should hide or not the system email
|
||||
@@ -843,7 +858,7 @@ source:
|
||||
|
||||
[cols="^3,>47,50a"]
|
||||
|=======================================================================
|
||||
.33+|D <|SOGoUserSources
|
||||
.34+|D <|SOGoUserSources
|
||||
|Parameter used to set the LDAP and/or SQL sources used for
|
||||
authentication and global address books. Multiple sources can be
|
||||
specified as an array of dictionaries. A dictionary that defines an LDAP
|
||||
@@ -911,7 +926,8 @@ resource if the entry has the calendarresource objectClass set.
|
||||
to which a resource can be part of at any point in time.
|
||||
|
||||
If this is set to `0`, or if the attribute is missing, it means no
|
||||
limit.
|
||||
limit. If set to `-1`, no limit is imposed but the resource will
|
||||
be marked as busy the first time it is booked.
|
||||
|
||||
|filter (optional)
|
||||
|The filter to use for LDAP queries, it should be defined as an
|
||||
@@ -998,7 +1014,17 @@ context as Dovecot stores in its database.
|
||||
|passwordPolicy
|
||||
|If set to `YES`, SOGo will use the extended LDAP Password Policies
|
||||
attributes. If you LDAP server does not support those and you activate
|
||||
this feature, every LDAP requests will fail.
|
||||
this feature, every LDAP requests will fail. Note that some LDAP servers
|
||||
require LDAP/SSL for password policies to work. This is the case for
|
||||
example with 389 Directory Server.
|
||||
|
||||
|updateSambaNTLMPasswords
|
||||
|If set to `YES`, SOGo will automatically update the sambaNTPassword
|
||||
and sambaLMPassword attributes when changing passwords. The attributes
|
||||
must be called sambaNTPassword and sambaLMPassword. You must also make
|
||||
sure the correct ACL is set in your LDAP server to allow users to change
|
||||
their own sambaNTPassword and sambaLMPassword password attributes.
|
||||
Defaults to `NO` when unset.
|
||||
|
||||
|isAddressBook
|
||||
|If set to `YES`, this LDAP source is used as a shared address book
|
||||
@@ -1011,8 +1037,8 @@ repository
|
||||
|
||||
|ModulesConstraints (optional)
|
||||
|Limits the access of any module through a constraint based on an LDAP
|
||||
attribute; must be a dictionary with keys `Mail`, and/or `Calendar`, for
|
||||
example:
|
||||
attribute; must be a dictionary with keys `Mail`, and/or `Calendar`,
|
||||
and/or `ActiveSync` for example:
|
||||
|
||||
----
|
||||
ModulesConstraints = {
|
||||
@@ -1037,6 +1063,11 @@ of supported attributes.
|
||||
user addressbooks (see _abOU_ below), this list of object classes will
|
||||
be applied to new records as they are created.
|
||||
|
||||
|GroupObjectClasses
|
||||
|A list (array) of names identifying groups within the LDAP source. If not
|
||||
set, SOGo will use `group`, `groupofnames`, `groupofuniquenames`
|
||||
and `posixgroup`.
|
||||
|
||||
|modifiers
|
||||
|A list (array) of usernames that are authorized to perform
|
||||
modifications to the address book defined by this LDAP source.
|
||||
@@ -1096,7 +1127,7 @@ fax number, one could map it to the _facsimiletelephonenumber_ attribute
|
||||
like this:
|
||||
|
||||
----
|
||||
mapping = \{
|
||||
mapping = {
|
||||
facsimiletelephonenumber = ("fax", "facsimiletelephonenumber");
|
||||
};
|
||||
----
|
||||
@@ -1326,27 +1357,27 @@ The following table describes the parameters that were set:
|
||||
|
||||
[cols="3,47,50a"]
|
||||
|=======================================================================
|
||||
|D |SOGoProfileURL
|
||||
|S |SOGoProfileURL
|
||||
|Parameter used to set the database URL so that SOGo can retrieve user
|
||||
profiles.
|
||||
|
||||
For MySQL, set the database URL to something like:
|
||||
`mysql://sogo:sogo@localhost:3306/sogo/sogo_user_profile`.
|
||||
|
||||
|D |OCSFolderInfoURL
|
||||
|S |OCSFolderInfoURL
|
||||
|Parameter used to set the database URL so that SOGo can retrieve the
|
||||
location of user folders (address books and calendars).
|
||||
|
||||
For Oracle, set the database URL to something like:
|
||||
`oracle://sogo:sogo@localhost:1526/sogo/sogo_folder_info`.
|
||||
|
||||
|D |OCSSessionsFolderURL
|
||||
|S |OCSSessionsFolderURL
|
||||
|Parameter used to set the database URL so that SOGo can store and
|
||||
retrieve secured user sessions information. For PostgreSQL, the database
|
||||
URL could be set to something like:
|
||||
`postgresql://sogo:sogo@localhost:5432/sogo/sogo_sessions_folder`.
|
||||
|
||||
|D |OCSEMailAlarmsFolderURL
|
||||
|S |OCSEMailAlarmsFolderURL
|
||||
|Parameter used to set the database URL for email-based alarms (that can
|
||||
be set on events and tasks). This parameter is relevant only if
|
||||
_SOGoEnableEMailAlarms_ is set to `YES`. For PostgreSQL, the database
|
||||
@@ -1476,7 +1507,10 @@ case, SOGo will consider the returned entry to be a resource.
|
||||
which a resource can be part of at any point in time.
|
||||
|
||||
If this is set to `0`, or if the attribute is missing, it means no
|
||||
limit.
|
||||
limit and the resource will always be marked as free. If set to `-1`,
|
||||
no limit is imposed but the resource will be marked as busy the first
|
||||
time it is booked. If greater than 0, the resource will get marked as
|
||||
busy once it reaches the value.
|
||||
|
||||
|DomainFieldName (optional)
|
||||
|If set, SOGo will use the value of that field as the domain associated
|
||||
@@ -1596,6 +1630,16 @@ Defaults to `Trash` when unset.
|
||||
Use a `/` as a hierarchy separator if referring to an IMAP subfolder.
|
||||
For example: `INBOX/Trash`.
|
||||
|
||||
|U |SOGoJunkFolderName
|
||||
|Parameter used to set the IMAP folder name used to store junk
|
||||
messages.
|
||||
|
||||
Defaults to `Junk` when unset.
|
||||
|
||||
Use a `/` as a hierarchy separator if referring to an IMAP subfolder.
|
||||
For example: `INBOX/Junk`. Also see the SOGoMailJunkSettings for
|
||||
more options regarding junk/not-junk actions.
|
||||
|
||||
|D |SOGoIMAPCASServiceName
|
||||
|Parameter used to set the CAS service name (URL) of the imap service.
|
||||
This is useful if SOGo is connecting to the IMAP service through a
|
||||
@@ -1675,6 +1719,13 @@ cronjob `sogo-tmpwatch`.
|
||||
|
||||
Defaults to `/var/spool/sogo`.
|
||||
|
||||
|S |NGMimeBuildMimeTempDirectory
|
||||
|Parameter used to set the path where temporary files will be stored
|
||||
by SOPE when dealing with MIME messages.
|
||||
|
||||
Defaults to `/tmp`.
|
||||
|
||||
|
||||
|S |NGImap4DisableIMAP4Pooling
|
||||
|Disables IMAP pooling when set to `YES`. Enable pooling by setting to
|
||||
`NO` or using a caching proxy like imapproxy.
|
||||
@@ -1778,6 +1829,12 @@ host.
|
||||
|
||||
Defaults to `NO` when unset.
|
||||
|
||||
|D |SOGoForwardConstraints
|
||||
|Parameter used to set constraints on possible addresses used when
|
||||
automatically forwarding mails. When set to `0` (default), no constraint
|
||||
is enforced. When set to `1`, only internal domains can be used. When
|
||||
set to `2`, only external domains can be used.
|
||||
|
||||
|D |SOGoSieveScriptsEnabled
|
||||
|Parameter used to activate the edition from the preferences windows of
|
||||
server-side mail filters. Requires Sieve script support on the IMAP
|
||||
@@ -1875,10 +1932,11 @@ events. This parameter is an array of arbitrary strings.
|
||||
|
||||
Defaults to a list that depends on the language.
|
||||
|
||||
|U |SOGoCalendarDefaultCategoryColor
|
||||
|Parameter used to define the default colour of categories.
|
||||
|U |SOGoCalendarCategoriesColors
|
||||
|Parameter used to define the colour of categories. This parameter
|
||||
is a dictionary of category name/color.
|
||||
|
||||
Defaults to `#F0F0F0` when unset.
|
||||
Defaults to `#F0F0F0` for all categories when unset.
|
||||
|
||||
|U |SOGoCalendarEventsDefaultClassification
|
||||
|Parameter used to defined the default classification for new events.
|
||||
@@ -2036,7 +2094,21 @@ Defaults to `%{FolderName} (%{UserName} <%{Email}>)` when unset.
|
||||
the template named `UIxAdditionalPreferences.wox`. This template should
|
||||
be put under `~sogo/GNUstep/Library/SOGo/Templates/PreferencesUI/`.
|
||||
|
||||
Defaults to `NO` when unset.
|
||||
|D |SOGoMailJunkSettings
|
||||
|Parameter used to enable email junk settings. The value is a dictionary
|
||||
and the follow keys are supported: `vendor` (which must be set to "generic"
|
||||
for now), `junkEmailAddress` which sets the email address to whom SOGo will
|
||||
send junk mails to, `notJunkEmailAddress` which sets the email address to
|
||||
whome SOGo will send non-junk mails to and `limit`, which is an integer value
|
||||
and sets the maximum number of mails that will be attached to a
|
||||
junk/not junk report sent by SOGo. Example: `SOGoMailJunkSettings = {
|
||||
vendor = "generic"; junkEmailAddress = "spam@foo.com";
|
||||
notJunkEmailAddress = "ham@foo.com"; limit = 10;
|
||||
};`
|
||||
|
||||
|D |SOGoMailKeepDraftsAfterSend
|
||||
|Parameter used to keep mails in the drafts folder once they have been
|
||||
sent by SOGo. Defaults to `NO` when unset.
|
||||
|=======================================================================
|
||||
|
||||
SOGo Configuration Summary
|
||||
@@ -2065,6 +2137,7 @@ like this:
|
||||
SOGoDraftsFolderName = Drafts;
|
||||
SOGoSentFolderName = Sent;
|
||||
SOGoTrashFolderName = Trash;
|
||||
SOGoJunkFolderName = Junk;
|
||||
SOGoMailingMechanism = smtp;
|
||||
SOGoSMTPServer = 127.0.0.1;
|
||||
SOGoUserSources = (
|
||||
@@ -2091,7 +2164,8 @@ Multi-domains Configuration
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If you want your installation to isolate two groups of users, you must
|
||||
define a distinct authentication source for each _domain_. Following is
|
||||
define a distinct authentication source for each _domain_. Your domain keys
|
||||
must have the same value as your email domain you want to add. Following is
|
||||
the same configuration that now includes two domains (acme.com and
|
||||
coyote.com):
|
||||
|
||||
@@ -2099,7 +2173,7 @@ coyote.com):
|
||||
{
|
||||
...
|
||||
domains = {
|
||||
acme = {
|
||||
acme.com = {
|
||||
SOGoMailDomain = acme.com;
|
||||
SOGoDraftsFolderName = Drafts;
|
||||
SOGoUserSources = (
|
||||
@@ -2120,7 +2194,7 @@ coyote.com):
|
||||
}
|
||||
);
|
||||
};
|
||||
coyote = {
|
||||
coyote.com = {
|
||||
SOGoMailDomain = coyote.com;
|
||||
SOGoIMAPServer = imap.coyote.com;
|
||||
SOGoUserSources = (
|
||||
@@ -2151,7 +2225,7 @@ domains.
|
||||
[cols="3,47,50a"]
|
||||
|=======================================================================
|
||||
|S |SOGoEnableDomainBasedUID
|
||||
|Parameter used to activate user identification by domain. Users will be
|
||||
|Parameter used to enable user identification by domain. Users will be
|
||||
able (without being required) to login using the form `username@domain`,
|
||||
meaning that values of _UIDFieldName_ no longer have to be unique among
|
||||
all domains but only within the same domain. Internally, users will
|
||||
@@ -2340,8 +2414,8 @@ easier. These GUI utilities can make use of templates to create and
|
||||
pre-configure typical user accounts or any standardized LDAP record,
|
||||
along with the correct object classes, fields and default values.
|
||||
|
||||
Microsoft ActiveSync
|
||||
--------------------
|
||||
Microsoft Enterprise ActiveSync
|
||||
-------------------------------
|
||||
|
||||
SOGo supports the Microsoft ActiveSync protocol.
|
||||
|
||||
@@ -2390,6 +2464,15 @@ _SOGoMaximumPingInterval_.
|
||||
|
||||
If not set, it defaults to `10` seconds.
|
||||
|
||||
|S |SOGoMaximumSyncResponseSize
|
||||
|Parameter used to overwrite the maximum response size during
|
||||
a Sync operation. The value is in kilobytes. Setting this to 512
|
||||
means the response size will be of 524288 bytes or less. Note that
|
||||
if you set the value too low and a mail message (or any other object)
|
||||
surpasses it, it will still be synced but only this item will be.
|
||||
|
||||
Defaults to `0`, which means no overwrite is performed.
|
||||
|
||||
|S |SOGoMaximumSyncWindowSize
|
||||
|Parameter used to overwrite the maximum number of items returned during
|
||||
a Sync operation.
|
||||
@@ -2398,28 +2481,31 @@ Defaults to `0`, which means no overwrite is performed.
|
||||
|
||||
Setting this parameter to a value greater than `512` will
|
||||
have unexpected behaviour with various ActiveSync clients.
|
||||
|S |SOGoEASDebugEnabled
|
||||
|Parameter used to log the complete request and response of every single
|
||||
EAS command.
|
||||
|
||||
Defaults to `NO`, which means no logging is performed.
|
||||
|=======================================================================
|
||||
|
||||
Please be aware of the following limitations:
|
||||
|
||||
* Currently, only the personal calendar and address book are
|
||||
synchronized. Adding support for all folders is planned.
|
||||
* When creating an Outlook 2013 profile, you must actually kill Outlook
|
||||
before the end of the creation process. See http://www.vionblog.com/connect-zimbra-community-with-outlook-2013
|
||||
for a procedure example.
|
||||
* Outlook 2013 does not search the GAL. One possible alternative
|
||||
solution is to configure Outlook to use a LDAP server (over SSL) with
|
||||
authentication. Alternatively, when supporting more than just the
|
||||
personal address book, we'll also be able to expose the LDAP/SQL based
|
||||
address books in SOGo over ActiveSync.
|
||||
authentication. Outlook 2013 also does not seem to support multiple
|
||||
address books over ActiveSync.
|
||||
* To successfully synchronize Outlook email categories, a corresponding
|
||||
mail label (Preferences->Mail Options) has to be created manually in SOGo
|
||||
for each label defined in Outlook. The name in SOGo and in Outlook must be
|
||||
identical.
|
||||
* Make sure you do not use a self-signed certificate. While this will
|
||||
work, Outlook will work intermittently as it will raise popups for
|
||||
certificate validation, sometimes in background, preventing the user to
|
||||
see the warning and thus, preventing any synchronization to happen.
|
||||
* ActiveSync clients keep connections open for a while. Each connection
|
||||
will grab a hold on a sogod process so you will need a lot of processes
|
||||
to handle many clients. This limitation will eventually be overcome in
|
||||
SOGo.
|
||||
to handle many clients. Make sure you tune your SOGo server when having
|
||||
lots of ActiveSync clients.
|
||||
* Repetitive events with occurrences exceptions are currently not
|
||||
supported.
|
||||
* Outlook 2013 Autodiscovery is currently not supported.
|
||||
@@ -2441,13 +2527,90 @@ user base.
|
||||
|
||||
To contact Microsoft, please visit:
|
||||
|
||||
http://www.microsoft.com/en-us/legal/intellectualproperty/IPLicensing/Programs/exchangeactivesyncprotocol.aspx
|
||||
http://www.microsoft.com/en-us/legal/intellectualproperty/
|
||||
|
||||
and send an email to iplicreq@microsoft.com
|
||||
|
||||
Inverse inc. provides this software for free, but is not responsible for
|
||||
anything related to its usage.
|
||||
|
||||
Microsoft Enterprise ActiveSync Tuning
|
||||
--------------------------------------
|
||||
|
||||
First of all, it is important to know that most EAS devices will keep
|
||||
HTTP connections open to SOGo (and thus, Apache) for a long time. This
|
||||
is required for "push" to work properly. Connections can stay open for
|
||||
up to one hour, or 3600 seconds.
|
||||
|
||||
The first parameter to check is related to Apache's proxying to
|
||||
SOGo:
|
||||
|
||||
----
|
||||
ProxyPass /Microsoft-Server-ActiveSync \
|
||||
http://127.0.0.1:20000/SOGo/Microsoft-Server-ActiveSync \
|
||||
retry=60 connectiontimeout=5 timeout=360
|
||||
----
|
||||
|
||||
The above line sets a timeout for up to 360 seconds, or 6 minutes. If
|
||||
you want to let EAS clients keep their HTTP connections open for up
|
||||
to an hour, you must change the timeout parameter and set it to 3600.
|
||||
|
||||
If you change this value, the WOWatchDogRequestTimeout parameter must be changed
|
||||
accordingly in SOGo's configuration file (/etc/sogo/sogo.conf). By default,
|
||||
a SOGo child process is allowed to handle a request that can take up
|
||||
to 10 minutes before it gets killed by its parent process. When using
|
||||
EAS "push", the client expects to keep its connection open for up to one
|
||||
hour - so the WOWatchDogRequestTimeout, which is set in minutes,
|
||||
must be adjusted accordingly.
|
||||
|
||||
EAS clients will keep HTTP connections open for a long time
|
||||
during these two EAS commands: Ping and Sync. By default, SOGo will prevent
|
||||
EAS clients from keeping connections for a long time. This is to avoid the
|
||||
situation where all SOGo child processes would be monopolized by EAS clients -
|
||||
rendering the SOGo web interface or DAV interface unavailable. The
|
||||
default SOGo behavior is thus similar to disable EAS push entirely.
|
||||
|
||||
Two SOGo configuration parameters are available to modify this behavior:
|
||||
SOGoMaximumPingInterval (set by default to 10 seconds) and
|
||||
SOGoMaximumSyncInterval (set by default to 30 seconds). If you want
|
||||
connection to stay open for up to one hour, you should set these
|
||||
slightly under 3600 seconds (say 3540 - or 59 minutes). During a
|
||||
long-lived HTTP connection, the SOGo child process will perform
|
||||
internal polling to detect changes and return them to the EAS client
|
||||
if any changes are found. The parameter used to control this
|
||||
is SOGoInternalSyncInterval. By default, polling is done every 10
|
||||
seconds. This might generate too much load on large-scale system.
|
||||
|
||||
The last configuration parameter to adjust is WOWorkersCount - which sets the
|
||||
number of SOGo child process that will be used to handle requests.
|
||||
You should have at least one child per EAS device configured to use
|
||||
"push". You must also have more children than you have EAS devices
|
||||
configured to use "push" - in order to handle normal SOGo requests to
|
||||
its Web or DAV interfaces.
|
||||
|
||||
Here are some usage examples for EAS devices using "push". In all
|
||||
cases, the Apache timeout is set to 3600 and the
|
||||
WOWatchDogRequestTimeout parameter is set to 60.
|
||||
|
||||
Example 1 - 100 users, 10 EAS devices:
|
||||
|
||||
----
|
||||
WOWorkersCount = 15;
|
||||
SOGoMaximumPingInterval = 3540;
|
||||
SOGoMaximumSyncInterval = 3540;
|
||||
SOGoInternalSyncInterval = 30;
|
||||
----
|
||||
|
||||
Example 2 - 1000 users, 100 EAS devices:
|
||||
|
||||
----
|
||||
WOWorkersCount = 120;
|
||||
SOGoMaximumPingInterval = 3540;
|
||||
SOGoMaximumSyncInterval = 3540;
|
||||
SOGoInternalSyncInterval = 60;
|
||||
----
|
||||
|
||||
|
||||
Using SOGo
|
||||
----------
|
||||
|
||||
@@ -2577,6 +2740,21 @@ current version of SOGo from the previous release.
|
||||
|
||||
[cols="100a"]
|
||||
|=======================================================================
|
||||
h|2.3.1
|
||||
|The SOGoCalendarDefaultCategoryColor default has been removed. If you
|
||||
want to customize the color of calendar categories, use the
|
||||
SOGoCalendarCategories and SOGoCalendarCategoriesColors defaults.
|
||||
|
||||
h|2.3.0
|
||||
|Run the shell script `sql-update-2.2.17_to_2.3.0.sh` or
|
||||
`sql-update-2.2.17_to_2.3.0-mysql.sh` (if you use MySQL).
|
||||
|
||||
This will grow the "participant states" field of calendar quick tables to a larger
|
||||
size and add the the "c_description" column to calendar quick tables.
|
||||
|
||||
Moreover, if you are using a multi-domain configuration, make sure the keys for
|
||||
your domains match the email domains you have defined.
|
||||
|
||||
h|2.2.8
|
||||
|The configuration configuration parameters were renamed:
|
||||
|
||||
|
||||
@@ -233,13 +233,14 @@ Installation
|
||||
This section will guide you through the installation of the native
|
||||
Microsoft Outlook compatibility layer SOGo offers.
|
||||
|
||||
////
|
||||
Red Hat Enterprise Linux v6 x86_64
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If you are using Red Hat Enterprise Linux version 6 x86_64, packages
|
||||
for Samba 4, OpenChange and SOGo and the SOGo OpenChange backend are
|
||||
available from SOGo's web site. Please follow the instructions from
|
||||
http://www.sogo.nu/english/downloads/backend_nightly.html.
|
||||
http://www.sogo.nu/english/downloads/backend.html.
|
||||
|
||||
In order to satisfy certain dependencies, you should also add the EPEL
|
||||
source corresponding to your distribution and architecture. More
|
||||
@@ -266,32 +267,30 @@ from this guide.
|
||||
|
||||
[NOTE]
|
||||
Samba4/OpenChange are not available for now on CentOS 5 i386/x86_64,
|
||||
CentOS 6 i386 and CentOS 7.
|
||||
and CentOS 7. On Debian-based systems, packages are available only on
|
||||
the x86_64 platform.
|
||||
|
||||
Debian 7.0 (Wheezy) and Ubuntu 12.04 (Precise Pangolin)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Debian 7 (Wheezy) and Ubuntu 12.04 (Precise Pangolin)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
SOGo, OpenChange and the SOGo OpenChange backend are now
|
||||
available from SOGo's web site. Please follow the instructions from
|
||||
http://www.sogo.nu/english/downloads/backend.html to setup your
|
||||
apt sources.
|
||||
|
||||
For Samba 4, you need to use the _wheezy-backports_ repository. To do so, create
|
||||
`/etc/apt/sources.list.d/backports.list`:
|
||||
On Debian7, for some Samba 4 dependencies, you need to use the
|
||||
_wheezy-backports_ repository. To do so, create
|
||||
`/etc/apt/sources.list.d/backports.list` with the following
|
||||
content:
|
||||
|
||||
deb http://http.debian.net/debian wheezy-backports main
|
||||
|
||||
On Ubuntu 12.04, you will also have to add the Wheezy sources:
|
||||
|
||||
deb http://ftp.us.debian.org/debian wheezy main
|
||||
deb http://security.debian.org/ wheezy/updates main
|
||||
|
||||
Then install Samba 4 on top of an existing SOGo
|
||||
installation:
|
||||
|
||||
----
|
||||
apt-get update
|
||||
apt-get -t wheezy-backports install samba samba-dev
|
||||
apt-get install samba samba-dev
|
||||
----
|
||||
|
||||
Once completed, install the packages related to OpenChange and the SOGo
|
||||
@@ -303,7 +302,12 @@ apt-get install openchangeserver \
|
||||
openchangeproxy \
|
||||
python-ocsmanager \
|
||||
mysql-server \
|
||||
python-mysqldb
|
||||
python-mysqldb \
|
||||
openchange-ocsmanager \
|
||||
openchange-rpcproxy \
|
||||
python-sievelib \
|
||||
python-spyne \
|
||||
python-rpclib
|
||||
----
|
||||
|
||||
Once the packages are installed, refer to the _Configuration_ chapter
|
||||
@@ -313,12 +317,10 @@ from this guide.
|
||||
On Ubuntu 12.04, the Samba init scripts need to be modified to
|
||||
disable the upstart check. For more details, refer to:
|
||||
https://wiki.samba.org/index.php/Samba4/InitScript
|
||||
////
|
||||
|
||||
|
||||
Ubuntu 14.04 (Trusty Tahr)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
For Ubuntu 14.04, you must not use the Debian Wheezy backports.
|
||||
Debian 8 (Jessie) and Ubuntu 14.04 (Trusty Tahr)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Please follow the instructions from
|
||||
http://www.sogo.nu/english/downloads/backend.html to setup your
|
||||
@@ -341,12 +343,26 @@ apt-get install openchangeserver \
|
||||
openchangeproxy \
|
||||
python-ocsmanager \
|
||||
mysql-server \
|
||||
python-mysqldb
|
||||
python-mysqldb \
|
||||
openchange-ocsmanager \
|
||||
openchange-rpcproxy \
|
||||
python-sievelib \
|
||||
python-spyne \
|
||||
python-rpclib
|
||||
----
|
||||
|
||||
Once the packages are installed, refer to the _Configuration_ chapter
|
||||
from this guide.
|
||||
|
||||
[NOTE]
|
||||
The `ocsmanager.conf` and `rpcproxy.conf` are currently located in
|
||||
`/etc/apache2/conf.d`. These should be moved to `/etc/apache2/conf-available`.
|
||||
This is a packaging error that will soon be fixed.
|
||||
|
||||
[NOTE]
|
||||
You might have to adjust the `rpcproxy.conf` configuration file to add the
|
||||
`Require all granted` permission if you get Apache errors such as
|
||||
`client denied by server configuration`.
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
@@ -372,7 +388,7 @@ Run the following commands as root:
|
||||
|
||||
----
|
||||
samba-tool domain provision --realm=example.com \
|
||||
--domain=OPENCHANGE \
|
||||
--domain=EXAMPLE \
|
||||
--adminpass='%1OpenChange' \
|
||||
--server-role='domain controller'
|
||||
|
||||
@@ -380,7 +396,7 @@ samba-tool user setexpiry administrator --noexpiry
|
||||
----
|
||||
|
||||
You might consider changing the realm and domain used, to suit your
|
||||
enviroment.
|
||||
environment.
|
||||
|
||||
You might also have to
|
||||
remove `/etc/samba/smb.conf` prior running this command.
|
||||
@@ -390,6 +406,7 @@ Add the following parameters to the `[global]` section of the
|
||||
|
||||
----
|
||||
### Configuration required by OpenChange server ###
|
||||
dsdb:schema update allowed = true
|
||||
dcerpc endpoint servers = epmapper, mapiproxy, dnsserver
|
||||
dcerpc_mapiproxy:server = true
|
||||
dcerpc_mapiproxy:interfaces = exchange_emsmdb, exchange_nsp, exchange_ds_rfr
|
||||
@@ -407,6 +424,7 @@ Your Samba 4 configuration file should look like this:
|
||||
netbios name = sogo
|
||||
passdb backend = samba4
|
||||
### Configuration required by OpenChange server ###
|
||||
dsdb:schema update allowed = true
|
||||
dcerpc endpoint servers = +epmapper, +mapiproxy
|
||||
dcerpc_mapiproxy:server = true
|
||||
dcerpc_mapiproxy:interfaces = exchange_emsmdb, exchange_nsp, exchange_ds_rfr
|
||||
@@ -424,7 +442,7 @@ Your Samba 4 configuration file should look like this:
|
||||
OpenChange Configuration
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
OpenChange 2.2 stores its metadata in MySQL so you need to have it installed.
|
||||
Since v2.2, OpenChange stores its metadata in MySQL so you need to have it installed.
|
||||
|
||||
First, create the OpenChange MySQL user:
|
||||
|
||||
@@ -495,9 +513,11 @@ mapistore:indexing_backend = mysql://openchange-user:openchange$123@localhost/op
|
||||
mapiproxy:openchangedb = mysql://openchange-user:openchange$123@localhost/openchange
|
||||
----
|
||||
|
||||
////
|
||||
On RHEL, make sure SELinux is disabled:
|
||||
|
||||
setenforce 0
|
||||
////
|
||||
|
||||
Next, you can start Samba using the usual command:
|
||||
|
||||
@@ -528,12 +548,14 @@ This service runs as a WSGI application under apache (mod_wsgi).
|
||||
While HTTPS is not required to access this service, it is strongly
|
||||
recommended.
|
||||
|
||||
////
|
||||
On RHEL-based distributions, the apache configuration required by these
|
||||
services can be found in `/etc/httpd/conf.d/ocsmanager.conf` and
|
||||
`/etc/httpd/conf.d/rpcproxy.conf`.
|
||||
////
|
||||
|
||||
For Debian-based distributions, these files can be found
|
||||
in `/etc/apache2/conf.d/`.
|
||||
in `/etc/apache2/conf.d/` or `/etc/apache2/conf-available`.
|
||||
|
||||
The configuration requires three Apache modules: _mod_proxy_,
|
||||
_mod_proxy_http_ and _mod_wsgi_. These are usually already installed but
|
||||
@@ -541,13 +563,19 @@ might need to be activated on Debian-based installations:
|
||||
|
||||
a2enmod proxy proxy_http wsgi
|
||||
|
||||
The OCS Manager and RPC Proxy configuration module can be enabled using:
|
||||
|
||||
a2enconf ocsmanager
|
||||
a2enconf rpcproxy
|
||||
|
||||
////
|
||||
On RHEL-based distributions, make sure the `LoadModule` directive is
|
||||
uncommented in `/etc/httpd/conf.d/wsgi.conf` (or
|
||||
`python26-mod_wsgi.conf` on RHELv5).
|
||||
uncommented in `/etc/httpd/conf.d/wsgi.conf`.
|
||||
////
|
||||
|
||||
The _reqtimeout_ apache module is known to cause problems when using the
|
||||
default configuration shipped with Debian-based systems. On such
|
||||
distributions, apache will close (HTTP/1.1 500) any HTTP request for
|
||||
distributions, Apache will close (HTTP/1.1 500) any HTTP request for
|
||||
which the HTTP body hasn't arrived in 10 seconds.
|
||||
|
||||
While this is arguably good practice with regular HTTP, it will disrupt
|
||||
@@ -559,17 +587,112 @@ To avoid this problem, use a much higher timeout or disable the module:
|
||||
a2dismod reqtimeout
|
||||
|
||||
You should now restart the Apache service and make sure it will start on
|
||||
boot. On RHEL-based distributions, do:
|
||||
boot.
|
||||
////
|
||||
On RHEL-based distributions, do:
|
||||
|
||||
chkconfig httpd on && /etc/init.d/httpd restart
|
||||
|
||||
////
|
||||
On Debian-based distributions, do:
|
||||
|
||||
update-rc.d apache2 defaults && /etc/init.d/apache2 restart
|
||||
|
||||
[NOTE]
|
||||
Debian-based distributions are not supported anymore for
|
||||
OCSManager/rpcproxy. Support will soon resume.
|
||||
Finally, you must adjust the OCS Manager configuration file, which is
|
||||
located in `/etc/ocsmanager/ocsmanager.ini`. You should enable LDAP-based
|
||||
authentication in the `main` section and configure it accordingly. You should
|
||||
also enable rpcproxy. You file should be similar to this one:
|
||||
|
||||
----
|
||||
[DEFAULT]
|
||||
debug = true
|
||||
email_to = you@yourdomain.com
|
||||
smtp_server = localhost
|
||||
error_email_from = paste@localhost
|
||||
|
||||
[main]
|
||||
auth = ldap
|
||||
mapistore_root = /var/lib/samba/private
|
||||
mapistore_data = /var/lib/samba/private/mapistore
|
||||
debug = yes
|
||||
|
||||
[auth:file]
|
||||
|
||||
[auth:ldap]
|
||||
host = ldap://127.0.0.1
|
||||
port = 389
|
||||
bind_dn = cn=administrator,cn=Users,dc=example,dc=com
|
||||
bind_pw = %1OpenChange
|
||||
basedn = cn=Users,dc=example,dc=com
|
||||
|
||||
[auth:single]
|
||||
username = openchange
|
||||
password = {SSHA}I6Hy5Wv0wuxyXvMBFWFQDVVN12_CLaX9
|
||||
|
||||
[server:main]
|
||||
use = egg:Paste#http
|
||||
host = 127.0.0.1
|
||||
port = 5000
|
||||
protocol_version = HTTP/1.1
|
||||
|
||||
[app:main]
|
||||
use = egg:ocsmanager
|
||||
full_stack = true
|
||||
static_files = true
|
||||
cache_dir = %(here)s/data
|
||||
beaker.session.key = ocsmanager
|
||||
beaker.session.secret = SDyKK3dKyDgW0mlpqttTMGU1f
|
||||
app_instance_uuid = {ee533ebc-f266-49d1-ae10-d017ee6aa98c}
|
||||
NTLMAUTHHANDLER_WORKDIR = /var/cache/ntlmauthhandler
|
||||
SAMBA_HOST = 127.0.0.1
|
||||
|
||||
[rpcproxy:ldap]
|
||||
host = localhost
|
||||
port = 389
|
||||
basedn = CN=Users,DC=example,DC=com
|
||||
set debug = true
|
||||
----
|
||||
|
||||
----
|
||||
[autodiscover]
|
||||
|
||||
[autodiscover:rpcproxy]
|
||||
enabled = true
|
||||
|
||||
[outofoffice]
|
||||
|
||||
[outofoffice:file]
|
||||
sieve_script_path = /var/vmail/$domain/$user/sieve-script
|
||||
sieve_script_path_mkdir = false
|
||||
|
||||
[outofoffice:managesieve]
|
||||
secret = secret
|
||||
|
||||
[loggers]
|
||||
keys = root
|
||||
|
||||
[handlers]
|
||||
keys = console
|
||||
|
||||
[formatters]
|
||||
keys = generic
|
||||
|
||||
[logger_root]
|
||||
level = INFO
|
||||
handlers = console
|
||||
|
||||
[handler_console]
|
||||
class = StreamHandler
|
||||
args = (sys.stderr,)
|
||||
level = NOTSET
|
||||
formatter = generic
|
||||
|
||||
[formatter_generic]
|
||||
format = %(asctime)s %(levelname)-5.5s [%(name)s] [%(threadName)s] %(message)s
|
||||
----
|
||||
|
||||
Once completed, start the OCS Manager service:
|
||||
|
||||
/etc/init.d/openchange-ocsmanager start
|
||||
|
||||
Name Service Configuration for Web Services
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -695,11 +818,10 @@ can be ignored for now. This feature is currently not supported.
|
||||
remove any data associated with the user from the SOGo server and
|
||||
recreate a Microsoft Outlook profile.
|
||||
To remove any data associated to a user, use
|
||||
the `openchange_user_cleanup` script distributed with SOGo. The script
|
||||
can be found in `/usr/share/doc/sogo/` (`/usr/share/sogo-VERSION/` on
|
||||
RHEL).
|
||||
the `openchange_user_cleanup` script distributed with OpenChange. The script
|
||||
can be found in `/usr/share/openchange/`.
|
||||
To reset a user, run the script as root:
|
||||
`python openchange_user_cleanup username`. See the usage output for additional options.
|
||||
`openchange_user_cleanup username`. See the usage output for additional options.
|
||||
* The "Out of Office Assistant" will not currently work. This feature
|
||||
has not been implemented.
|
||||
* Creating folders below INBOX (when not normally permitted by the IMAP
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- TODO have the build system take care of this -->
|
||||
<releaseinfo>Version 2.2.12 - December 2014</releaseinfo>
|
||||
<subtitle>for version 2.2.12</subtitle>
|
||||
<date>2014-12-18</date>
|
||||
<releaseinfo>Version 2.3.9 - March 2016</releaseinfo>
|
||||
<subtitle>for version 2.3.9</subtitle>
|
||||
<date>2016-03-16</date>
|
||||
|
||||
<legalnotice>
|
||||
<para>Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".</para>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
@@ -6,13 +6,13 @@
|
||||
Authors:
|
||||
- Inverse inc. <info@inverse.ca>
|
||||
|
||||
Copyright (C) 2008-2014 Inverse inc.
|
||||
Copyright (C) 2008-2016 Inverse inc.
|
||||
License: GFDL 1.2 or later. http://www.gnu.org/licenses/fdl.html
|
||||
|
||||
////
|
||||
|
||||
// TODO have the build system take care of this
|
||||
|
||||
:release_version: 2.2.12
|
||||
:release_version: 2.3.9
|
||||
|
||||
// vim: set syntax=asciidoc tabstop=2 shiftwidth=2 expandtab:
|
||||
+1
-1
@@ -267,7 +267,7 @@
|
||||
NSObject <DOMNodeList> *list;
|
||||
NSObject <DOMNode> *valueNode;
|
||||
NSArray *elements;
|
||||
NSString *property, *match;
|
||||
NSString *property=nil, *match=nil;
|
||||
|
||||
list = [searchElement getElementsByTagName: @"prop"];
|
||||
if ([list length])
|
||||
|
||||
+2
-2
@@ -245,7 +245,7 @@ static BOOL debugLeaks;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog (@"No value specified for '%@'", *urlString);
|
||||
[self errorWithFormat: @"No value specified for '%@'", *urlString];
|
||||
ok = NO;
|
||||
}
|
||||
}
|
||||
@@ -441,7 +441,7 @@ static BOOL debugLeaks;
|
||||
if (debugLeaks)
|
||||
{
|
||||
if (debugOn)
|
||||
NSLog (@"allocated classes:\n%s", GSDebugAllocationList (YES));
|
||||
[self logWithFormat: @"allocated classes:\n%s", GSDebugAllocationList (YES)];
|
||||
else
|
||||
{
|
||||
debugOn = YES;
|
||||
|
||||
+4
-4
@@ -1,15 +1,15 @@
|
||||
/*
|
||||
Copyright (C) 2004-2005 SKYRIX Software AG
|
||||
Copyright (C) 2006-2009 Inverse inc.
|
||||
Copyright (C) 2006-2015 Inverse inc.
|
||||
|
||||
This file is part of OpenGroupware.org.
|
||||
This file is part of SOGo.
|
||||
|
||||
OGo is free software; you can redistribute it and/or modify it under
|
||||
SOGo is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
@@ -1,8 +1,377 @@
|
||||
2.3.9 (2016-03-16)
|
||||
------------------
|
||||
|
||||
New features
|
||||
- you can now limit the file upload size using the WOMaxUploadSize
|
||||
configuration parameter (integer value in kilobytes) (#3510, #3135)
|
||||
|
||||
Enhancements
|
||||
- allow resources to prevent invitations (#3410)
|
||||
- now support EAS MIME truncation
|
||||
- [web] added Lithuanan (lt) translation - thanks to Mantas Liobė
|
||||
|
||||
Bug fixes
|
||||
- allow EAS attachments get on 2nd-level mailboxes (#3505)
|
||||
- fixed EAS bday shift (#3518)
|
||||
- prefer SOGoRefreshViewCheck to SOGoMailMessageCheck (#3465)
|
||||
- properly unfold long mail headers (#3152)
|
||||
|
||||
2.3.8 (2016-02-05)
|
||||
------------------
|
||||
|
||||
Enhancements
|
||||
- updated CKEditor to version 4.5.7
|
||||
|
||||
Bug fixes
|
||||
- correctly encode filename of attachments over EAS (#3491)
|
||||
- correctly encode square brackets for IMAP folder names (#3321)
|
||||
- add shared/public namespaces in the list or returned folders
|
||||
|
||||
2.3.7 (2016-01-25)
|
||||
------------------
|
||||
|
||||
New features
|
||||
- new junk/not junk capability with generic SMTP integration
|
||||
|
||||
Enhancements
|
||||
- newly created folders using EAS are always sync'ed by default (#3454)
|
||||
- added Croatian (hr_HR) translation - thanks to Jens Riecken
|
||||
|
||||
Bug fixes
|
||||
- now always generate invitation updates when using EAS
|
||||
- rewrote the string sanitization to be 32-bit Unicode safe
|
||||
- do not try to decode non-wbxml responses for debug output (#3444)
|
||||
|
||||
2.3.6 (2016-01-18)
|
||||
------------------
|
||||
|
||||
New features
|
||||
- now able to sync only default mail folders when using EAS
|
||||
|
||||
Enhancements
|
||||
- unit testing for RTFHandler
|
||||
- JUnit output for sogo-tests
|
||||
|
||||
Bug fixes
|
||||
- don't unescape twice mail folder names (#3423)
|
||||
- don't consider mobile Outlook EAS clients as DAV ones (#3431)
|
||||
- we now follow 301 redirects when fetching ICS calendars
|
||||
- when deleting an event using EAS, properly invoke the auto-scheduling code
|
||||
- do not include failure attachments (really long filenames)
|
||||
- fix encoding of email subjects with non-ASCII characters
|
||||
- fix appointment notification mails using SOGoEnableDomainBasedUID configuration
|
||||
- fix shifts in event times on Outlook
|
||||
|
||||
2.3.5 (2016-01-05)
|
||||
------------------
|
||||
|
||||
Enhancements
|
||||
- return an error to openchange if mail message delivery fails
|
||||
- return the requested elements on complex requests from Outlook when downloading changes
|
||||
- user sources can be loaded dynamically
|
||||
- unify user sources API
|
||||
- updated Russian translation (#3383)
|
||||
|
||||
Bug fixes
|
||||
- properly compute the last week number for the year (#1010)
|
||||
- share calendar, tasks and contacts folders in Outlook 2013 with editor permissions
|
||||
- priorize filename in Content-Disposition against name in Content-Type to get the filename of an attachment in mail
|
||||
- request all contacts when there is no filter in Contacts menu in Webmail
|
||||
- personal contacts working properly on Outlook
|
||||
- fixes on RTF parsing used by event/contact description and mail as RTF to read non-ASCII characters:
|
||||
better parsing of font table, when using a font, switch to its character set, correct parsing of
|
||||
escaped characters and Unicode character command word support for unicode characters greater than 32767
|
||||
- no crash resolving recipients after reconnecting LDAP connection
|
||||
- avoid creation of phantom contacts in SOGo from distribution list synced from Outlook.
|
||||
- accepted & updated event names are now shown correctly in Outlook
|
||||
- provide safe guards in mail and calendar to avoid exceptions while syncing
|
||||
|
||||
2.3.4 (2015-12-15)
|
||||
------------------
|
||||
|
||||
New features
|
||||
- initial support for EAS calendar exceptions
|
||||
|
||||
Enhancements
|
||||
- limit the maximum width of toolbar buttons (#3381)
|
||||
- updated CKEditor to version 4.5.6
|
||||
|
||||
Bug fixes
|
||||
- JavaScript exception when printing events from calendars with no assigned color (#3203)
|
||||
- EAS fix for wrong charset being used (#3392)
|
||||
- EAS fix on qp-encoded subjects (#3390)
|
||||
- correctly handle all-day event exceptions when the master event changes
|
||||
- prevent characters in calendar component UID causing issues during import process
|
||||
- avoid duplicating attendees when accepting event using a different identity over CalDAV
|
||||
|
||||
2.3.3a (2015-11-18)
|
||||
-------------------
|
||||
|
||||
Bug fixes
|
||||
- expanded mail folders list is not saved (#3386)
|
||||
- cleanup translations
|
||||
|
||||
2.3.3 (2015-11-11)
|
||||
------------------
|
||||
|
||||
New features
|
||||
- initial S/MIME support for EAS (#3327)
|
||||
- now possible to choose which folders to sync over EAS
|
||||
|
||||
Enhancements
|
||||
- we no longer always entirely rewrite messages for Outlook 2013 when using EAS
|
||||
- support for ghosted elements on contacts over EAS
|
||||
- added Macedonian (mk_MK) translation - thanks to Miroslav Jovanovic
|
||||
- added Portuguese (pt) translation - thanks to Eduardo Crispim
|
||||
|
||||
Bug fixes
|
||||
- numerous EAS fixes when connections are dropped before the EAS client receives the response (#3058, #2849)
|
||||
- correctly handle the References header over EAS (#3365)
|
||||
- make sure English is always used when generating Date headers using EAS (#3356)
|
||||
- don't escape quoted strings during versit generation
|
||||
- we now return all cards when we receive an empty addressbook-query REPORT
|
||||
- avoid crash when replying to a mail with no recipients (#3359)
|
||||
- inline images sent from SOGo webmail are not displayed in Mozilla Thunderbird (#3271)
|
||||
- prevent postal address showing on single line over EAS (#2614)
|
||||
- display missing events when printing working hours only
|
||||
- fix corner case making server crash when syncing hard deleted messages when clear offline items was set up (Zentyal)
|
||||
- avoid infinite Outlook client loops trying to set read flag when it is already set (Zentyal)
|
||||
- avoid crashing when calendar metadata is missing in the cache (Zentyal)
|
||||
- fix recurrence pattern event corner case created by Mozilla Thunderbird which made server crash (Zentyal)
|
||||
- fix corner case that removes attachments on sending messages from Outlook (Zentyal)
|
||||
- freebusy on web interface works again in multidomain environments (Zentyal)
|
||||
- fix double creation of folders in Outlook when the folder name starts with a digit (Zentyal)
|
||||
- avoid crashing Outlook after setting a custom view in a calendar folder (Zentyal)
|
||||
- handle emails having an attachment as their content
|
||||
- fixed JavaScript syntax error in attendees editor
|
||||
- fixed wrong comparison of meta vs. META tag in HTML mails
|
||||
- fixed popup menu position when moved to the left (#3381)
|
||||
- fixed dialog position when at the bottom of the window (#2646, #3378)
|
||||
|
||||
2.3.2 (2015-09-16)
|
||||
------------------
|
||||
|
||||
Enhancements
|
||||
- improved EAS speed and memory usage, avoiding many IMAP LIST commands (#3294)
|
||||
- improved EAS speed during initial syncing of large mailboxes (#3293)
|
||||
- updated CKEditor to version 4.5.3
|
||||
|
||||
Bug fixes
|
||||
- fixed display of whitelisted attendees in Preferences window on Firefox (#3285)
|
||||
- non-latin subfolder names are displayed correctly on Outlook (Zentyal)
|
||||
- fixed several sync issues on environments with multiple users (Zentyal)
|
||||
- folders from other users will no longer appear on your Outlook (Zentyal)
|
||||
- use right auth in multidomain environments in contacts and calendar from Outlook (Zentyal)
|
||||
- session fix when SOGoEnableDomainBasedUID is enabled but logins are domain-less
|
||||
- less sync issues when setting read flag (Zentyal)
|
||||
- attachments with non-latin filenames sent by Outlook are now received (Zentyal)
|
||||
- support attachments from more mail clients (Zentyal)
|
||||
- avoid conflicting message on saving a draft mail (Zentyal)
|
||||
- less conflicting messages in Outlook while moving messages between folders (Zentyal)
|
||||
- start/end shifting by 1 hour due to timezone change on last Sunday of October 2015 (#3344)
|
||||
- fixed localization of calendar categories with empty profile (#3295)
|
||||
- fixed options availability in contextual menu of Contacts module (#3342)
|
||||
|
||||
2.3.1 (2015-07-23)
|
||||
------------------
|
||||
|
||||
Enhancements
|
||||
- improved EAS speed, especially when fetching big attachments
|
||||
- now always enforce the organizer's default identity in appointments
|
||||
- improved the handling of default calendar categories/colors (#3200)
|
||||
- added support for DeletesAsMoves over EAS
|
||||
- added create-folder subcommand to sogo-tool to create contact and calendar folders
|
||||
- group mail addresses can be used as recipient in Outlook
|
||||
- added 'ActiveSync' module constraints
|
||||
- updated CKEditor to version 4.5.1
|
||||
- added Slovenian translation - thanks to Jens Riecken
|
||||
- added Chinese (Taiwan) translation
|
||||
|
||||
Bug fixes
|
||||
- EAS's GetItemEstimate/ItemOperations now support fetching mails and empty folders
|
||||
- fixed some rare cornercases in multidomain configurations
|
||||
- properly escape folder after creation using EAS (#3237)
|
||||
- fixed potential organizer highjacking when using EAS (#3131)
|
||||
- properly support big characters in EAS and fix encoding QP EAS error for Outlook (#3082)
|
||||
- properly encode id of DOM elements in Address Book module (#3239, #3245)
|
||||
- fixed multi-domain support for sogo-tool backup/restore (#2600)
|
||||
- fixed data ordering in events list of Calendar module (#3261)
|
||||
- fixed data ordering in tasks list of Calendar module (#3267)
|
||||
- Android EAS Lollipop fixes (#3268 and #3269)
|
||||
- improved EAS email flagging handling (#3140)
|
||||
- fixed computation of GlobalObjectId (#3235)
|
||||
- fixed EAS conversation ID issues on BB10 (#3152)
|
||||
- fixed CR/LF printing in event's description (#3228)
|
||||
- optimized Calendar module in multidomain configurations
|
||||
|
||||
2.3.0 (2015-06-01)
|
||||
-------------------
|
||||
|
||||
New features
|
||||
- Internet headers are now shown in Outlook (Zentyal)
|
||||
|
||||
Enhancements
|
||||
- improved multipart handling using EAS
|
||||
- added systemd startup script (PR#76)
|
||||
- added Basque translation - thanks to Gorka Gonzalez
|
||||
- updated Brazilian (Portuguese), Dutch, Norwegian (Bokmal), Polish, Russian, and Spanish (Spain) translations
|
||||
- calendar sharing request support among different Outlook versions (Zentyal)
|
||||
- improved sync speed from Outlook by non-reprocessing already downloaded unread mails (Zentyal)
|
||||
- added support for sharing calendar invitations
|
||||
- missing contact fields are now saved and available when sharing it (Office, Profession, Manager's name, Assistant's name, Spouse/Partner, Anniversary) (Zentyal)
|
||||
- appointment color and importance work now between Outlooks (Zentyal)
|
||||
- synchronize events, contacts and tasks in reverse chronological order (Zentyal)
|
||||
- during login, we now extract the domain from the user to accelerate authentication requests on sources
|
||||
- make sure sure email invitations can always be read by EAS clients
|
||||
- now able to print event/task's description (new components only) in the list view (#2881)
|
||||
- now possible to log EAS commands using the SOGoEASDebugEnabled system defaults
|
||||
- many improvements to EAS SmartReply/SmartForward commands
|
||||
- event invitation response mails from Outlook are now sent
|
||||
- mail subfolders created in WebMail are created when Outlook synchronises
|
||||
- mail root folder created in WebMail (same level INBOX) are created on Outlook logon
|
||||
|
||||
Bug fixes
|
||||
- now keep the BodyPreference for future EAS use and default to MIME if none set (#3146)
|
||||
- EAS reply fix when message/rfc822 parts are included in the original mail (#3153)
|
||||
- fixed yet an other potential crash during freebusy lookups during timezone changes
|
||||
- fixed display of freebusy information in event attendees editor during timezone changes
|
||||
- fixed timezone of MSExchange freebusy information
|
||||
- fixed a potential EAS error with multiple email priority flags
|
||||
- fixed paragraphs margins in HTML messages (#3163)
|
||||
- fixed regression when loading the inbox for the first time
|
||||
- fixed serialization of the PreventInvitationsWhitelist settings
|
||||
- fixed md4 support (for NTLM password changes) with GNU TLS
|
||||
- fixed edition of attachment URL in event/task editor
|
||||
- sent mails are not longer in Drafts folder using Outlook (Zentyal)
|
||||
- deleted mails are properly synced between Outlook profiles from the same account (Zentyal)
|
||||
- does not create a mail folder in other user's mailbox (Zentyal)
|
||||
- fix server-side crash with invalid events (Zentyal)
|
||||
- fix setting permissions for a folder with several users (Zentyal)
|
||||
- fix reception of calendar event invitations on optional attendees (Zentyal)
|
||||
- fix server side crash parsing rtf without color table (Zentyal)
|
||||
- weekly recurring events created in SOGo web interface are now shown in Outlook (Zentyal)
|
||||
- fix exception modifications import in recurrence series (Zentyal)
|
||||
- fix server side crash parsing rtf emails with images (with word97 format) (Zentyal)
|
||||
- fix sender on importing email messages like event invitations (Zentyal)
|
||||
- fix Outlook crashes when modifying the view of a folder (Zentyal)
|
||||
- fix server side crash when reading some recurrence appointments (Zentyal)
|
||||
- Outlook clients can use reply all functionality on multidomain environment (Zentyal)
|
||||
- optional attendes on events are now shown properly (Zentyal)
|
||||
- fixed the EAS maximum response size being per-folder, and not global
|
||||
- now set MeetingMessageType only for EAS 14.1
|
||||
- now correctly handle external invitations using EAS
|
||||
- now correctly handle multiple email addresses in the GAL over EAS (#3102)
|
||||
- now handle very large amount of participants correctly (#3175)
|
||||
- fix message bodies not shown on some EAS devices (#3173)
|
||||
- avoid appending the domain unconditionally when SOGoEnableDomainBasedUID is set to YES
|
||||
- recurrent all day events are now shown properly in Outlook
|
||||
|
||||
2.2.17a (2015-03-15)
|
||||
--------------------
|
||||
|
||||
Bug fixes
|
||||
- avoid calling -stringByReplacingOccurrencesOfString:... for old GNUstep runtime
|
||||
|
||||
2.2.17 (2015-03-24)
|
||||
-------------------
|
||||
|
||||
Enhancements
|
||||
- support for mail prority using EAS
|
||||
- immediately delete mails from EAS clients when they are marked as deleted on the IMAP server
|
||||
- now favor login@domain as the default email address if multiple mail: fields are specified
|
||||
- enable by default HTML mails support using EAS on Windows and BB phones
|
||||
- now possible to configure objectClass names for LDAP groups using GroupObjectClasses (#1499)
|
||||
|
||||
Bug fixes
|
||||
- fixed login issue after password change (#2601)
|
||||
- fixed potential encoding issue using EAS and 8-bit mails (#3116)
|
||||
- multiple collections support for GetItemEstimate using EAS
|
||||
- fixed empty sync responses for EAS 2.5 and 12.0 clients
|
||||
- use the correct mail body element for EAS 2.5 clients
|
||||
- fixed tasks disappearing issue with RoadSync
|
||||
- use the correct body element for events for EAS 2.5 clients
|
||||
- SmartReply improvements for missing body attributes
|
||||
- do not use syncKey from cache when davCollectionTag = -1
|
||||
- use correct mail attachment elements for EAS 2.5 clients
|
||||
- fixed contacts lookup by UID in freebusy
|
||||
- reduced telephone number to a single value in JSON response of contacts list
|
||||
- fixed freebusy data when 'busy off hours' is enabled and period starts during the weekend
|
||||
- fixed fetching of freebusy data from the Web interface
|
||||
- fixed EAS handling of Bcc in emails (#3138)
|
||||
- fixed Language-Region tags in Web interface (#3121)
|
||||
- properly fallback over EAS to UTF-8 and then Latin1 for messages w/o charset (#3103)
|
||||
- prevent potential freebusy lookup crashes during timezone changes with repetitive events
|
||||
- improved GetItemEstimate to count all vasnished/deleted mails too
|
||||
- improvements to EAS SyncKey handling to avoid missing mails (#3048, #3058)
|
||||
- fixed EAS replies decoding from Outlook (#3123)
|
||||
|
||||
2.2.16 (2015-02-12)
|
||||
-------------------
|
||||
|
||||
New features
|
||||
- now possible for SOGo to change the sambaNTPassword/sambaLMPassword
|
||||
- now possible to limit automatic forwards to internal/external domains
|
||||
|
||||
Enhancements
|
||||
- added support for email categories using EAS (#2995)
|
||||
- now possible to always send vacation messages (#2332)
|
||||
- added EAS best practices to the documentation
|
||||
- improved fetching of text parts over EAS
|
||||
- updated Czech, Finnish, French, German and Hungarian translations
|
||||
|
||||
Bug fixes
|
||||
- (regression) fixed sending a message when mail module is not active (#3088)
|
||||
- mail labels with blanks are not handled correctly (#3078)
|
||||
- fixed BlackBerry issues sending multiple mails over EAS (#3095)
|
||||
- fixed plain/text mails showing on one line on Android/EAS (#3055)
|
||||
- fixed exception in sogo-tool when parsing arguments of a set operation
|
||||
|
||||
2.2.15 (2015-01-30)
|
||||
-------------------
|
||||
|
||||
Enhancements
|
||||
- improved handling of EAS Push when no heartbeat is provided
|
||||
- no longer need to kill Outlook 2013 when creating EAS profiles (#3076)
|
||||
- improved server-side CSS cleaner (#3040)
|
||||
- unified the logging messages in sogo.log file (#2534/#3063)
|
||||
- updated Brazilian (Portuguese) and Hungarian translations
|
||||
|
||||
2.2.14 (2015-01-20)
|
||||
-------------------
|
||||
|
||||
Enhancements
|
||||
- MultipleBookingsFieldName can be set to -1 to show busy status when booked at least once
|
||||
- handle multipart objects in EAS/ItemOperations
|
||||
|
||||
Bug fixes
|
||||
- fixed calendar selection in event and task editors (#3049, #3050)
|
||||
- check for resources existence when listing subscribed ones (#3054)
|
||||
- correctly recognize Apple Calendar on Yosemite (#2960)
|
||||
- fixed two potential autorelease pool leaks (#3026 and #3051)
|
||||
- fixed birthday offset in EAS
|
||||
- fixed From's full name over EAS
|
||||
- fixed potential issue when handling multiple Add/Change/Delete/Fetch EAS commands (#3057)
|
||||
- fixed wrong timezone calculation on recurring events
|
||||
|
||||
2.2.13 (2014-12-30)
|
||||
-------------------
|
||||
|
||||
Enhancements
|
||||
- initial support for empty sync request/response for EAS
|
||||
- added the SOGoMaximumSyncResponseSize EAS configuration parameter to
|
||||
support memory-limited sync response sizes
|
||||
- we now not only use the creation date for event's cutoff date (EAS)
|
||||
|
||||
Bug fixes
|
||||
- fixed contact description truncation on WP8 phones (#3028)
|
||||
- fixed freebusy information not always returned
|
||||
- fixed tz issue when the user one was different from the system one with EAS
|
||||
|
||||
2.2.12a (2014-12-19)
|
||||
--------------------
|
||||
|
||||
Bug fixes
|
||||
- fix empty HTML mails being sent (#3034)
|
||||
- fixed empty HTML mails being sent (#3034)
|
||||
|
||||
2.2.12 (2014-12-18)
|
||||
-------------------
|
||||
@@ -18,12 +387,12 @@ Enhancements
|
||||
- updated Czech, Dutch, Finnish, French, German, Polish and Spanish (Spain) translations
|
||||
|
||||
Bug fixes
|
||||
- fix for privacy and categories for EAS (#3022)
|
||||
- fixed for privacy and categories for EAS (#3022)
|
||||
- correctly set MeetingStatus for EAS on iOS devices
|
||||
- Ubuntu Lucid fixes for EAS
|
||||
- fix calendar reminders for future events (#3008)
|
||||
- fixed calendar reminders for future events (#3008)
|
||||
- make sure all text parts are UTF-8 re-encoded for Outlook 2013 over EAS (#3003)
|
||||
- fix task description truncation affecting WP8 phones over EAS (#3028)
|
||||
- fixed task description truncation affecting WP8 phones over EAS (#3028)
|
||||
|
||||
2.2.11a (2014-12-10)
|
||||
--------------------
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/* Codepages.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2014 Jesús García Sáez
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
|
||||
@interface Codepages
|
||||
|
||||
+ (NSDictionary *) getCodepagesTable;
|
||||
+ (NSDictionary *) getReverseCodepagesTable;
|
||||
|
||||
+ (NSNumber *) getCodepageFromName: (NSString *) name;
|
||||
+ (NSString *) getNameFromCodepage: (NSNumber *) codepage;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,214 @@
|
||||
/* Codepages.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2014 Jesús García Sáez
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import "Codepages.h"
|
||||
#import <Foundation/NSArray.h>
|
||||
|
||||
@implementation Codepages
|
||||
|
||||
+ (NSDictionary *) getCodepagesTable
|
||||
{
|
||||
static NSDictionary *table = nil;
|
||||
|
||||
if (table == nil)
|
||||
{
|
||||
/* http://msdn.microsoft.com/en-us/library/dd317756%28v=vs.85%29.aspx */
|
||||
table = [[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInt: 37], @"ibm037",
|
||||
[NSNumber numberWithInt: 437], @"ibm437",
|
||||
[NSNumber numberWithInt: 500], @"ibm500",
|
||||
[NSNumber numberWithInt: 708], @"asmo-708",
|
||||
[NSNumber numberWithInt: 720], @"dos-720",
|
||||
[NSNumber numberWithInt: 737], @"ibm737",
|
||||
[NSNumber numberWithInt: 775], @"ibm775",
|
||||
[NSNumber numberWithInt: 850], @"ibm850",
|
||||
[NSNumber numberWithInt: 852], @"ibm852",
|
||||
[NSNumber numberWithInt: 855], @"ibm855",
|
||||
[NSNumber numberWithInt: 857], @"ibm857",
|
||||
[NSNumber numberWithInt: 858], @"ibm00858",
|
||||
[NSNumber numberWithInt: 860], @"ibm860",
|
||||
[NSNumber numberWithInt: 861], @"ibm861",
|
||||
[NSNumber numberWithInt: 862], @"dos-862",
|
||||
[NSNumber numberWithInt: 863], @"ibm863",
|
||||
[NSNumber numberWithInt: 864], @"ibm864",
|
||||
[NSNumber numberWithInt: 865], @"ibm865",
|
||||
[NSNumber numberWithInt: 866], @"cp866",
|
||||
[NSNumber numberWithInt: 869], @"ibm869",
|
||||
[NSNumber numberWithInt: 870], @"ibm870",
|
||||
[NSNumber numberWithInt: 874], @"windows-874",
|
||||
[NSNumber numberWithInt: 875], @"cp875",
|
||||
[NSNumber numberWithInt: 932], @"shift_jis",
|
||||
[NSNumber numberWithInt: 936], @"gb2312",
|
||||
[NSNumber numberWithInt: 949], @"ks_c_5601-1987",
|
||||
[NSNumber numberWithInt: 950], @"big5",
|
||||
[NSNumber numberWithInt: 1026], @"ibm1026",
|
||||
[NSNumber numberWithInt: 1047], @"ibm01047",
|
||||
[NSNumber numberWithInt: 1140], @"ibm01140",
|
||||
[NSNumber numberWithInt: 1141], @"ibm01141",
|
||||
[NSNumber numberWithInt: 1142], @"ibm01142",
|
||||
[NSNumber numberWithInt: 1143], @"ibm01143",
|
||||
[NSNumber numberWithInt: 1144], @"ibm01144",
|
||||
[NSNumber numberWithInt: 1145], @"ibm01145",
|
||||
[NSNumber numberWithInt: 1146], @"ibm01146",
|
||||
[NSNumber numberWithInt: 1147], @"ibm01147",
|
||||
[NSNumber numberWithInt: 1148], @"ibm01148",
|
||||
[NSNumber numberWithInt: 1149], @"ibm01149",
|
||||
[NSNumber numberWithInt: 1200], @"utf-16",
|
||||
[NSNumber numberWithInt: 1201], @"unicodefffe",
|
||||
[NSNumber numberWithInt: 1250], @"windows-1250",
|
||||
[NSNumber numberWithInt: 1251], @"windows-1251",
|
||||
[NSNumber numberWithInt: 1252], @"windows-1252",
|
||||
[NSNumber numberWithInt: 1253], @"windows-1253",
|
||||
[NSNumber numberWithInt: 1254], @"windows-1254",
|
||||
[NSNumber numberWithInt: 1255], @"windows-1255",
|
||||
[NSNumber numberWithInt: 1256], @"windows-1256",
|
||||
[NSNumber numberWithInt: 1257], @"windows-1257",
|
||||
[NSNumber numberWithInt: 1258], @"windows-1258",
|
||||
[NSNumber numberWithInt: 1361], @"johab",
|
||||
[NSNumber numberWithInt: 10000], @"macintosh",
|
||||
[NSNumber numberWithInt: 10001], @"x-mac-japanese",
|
||||
[NSNumber numberWithInt: 10002], @"x-mac-chinesetrad",
|
||||
[NSNumber numberWithInt: 10003], @"x-mac-korean",
|
||||
[NSNumber numberWithInt: 10004], @"x-mac-arabic",
|
||||
[NSNumber numberWithInt: 10005], @"x-mac-hebrew",
|
||||
[NSNumber numberWithInt: 10006], @"x-mac-greek",
|
||||
[NSNumber numberWithInt: 10007], @"x-mac-cyrillic",
|
||||
[NSNumber numberWithInt: 10008], @"x-mac-chinesesimp",
|
||||
[NSNumber numberWithInt: 10010], @"x-mac-romanian",
|
||||
[NSNumber numberWithInt: 10017], @"x-mac-ukrainian",
|
||||
[NSNumber numberWithInt: 10021], @"x-mac-thai",
|
||||
[NSNumber numberWithInt: 10029], @"x-mac-ce",
|
||||
[NSNumber numberWithInt: 10079], @"x-mac-icelandic",
|
||||
[NSNumber numberWithInt: 10081], @"x-mac-turkish",
|
||||
[NSNumber numberWithInt: 10082], @"x-mac-croatian",
|
||||
[NSNumber numberWithInt: 12000], @"utf-32",
|
||||
[NSNumber numberWithInt: 12001], @"utf-32be",
|
||||
[NSNumber numberWithInt: 20000], @"x-chinese-cns",
|
||||
[NSNumber numberWithInt: 20001], @"x-cp20001",
|
||||
[NSNumber numberWithInt: 20002], @"x-chinese-eten",
|
||||
[NSNumber numberWithInt: 20003], @"x-cp20003",
|
||||
[NSNumber numberWithInt: 20004], @"x-cp20004",
|
||||
[NSNumber numberWithInt: 20005], @"x-cp20005",
|
||||
[NSNumber numberWithInt: 20105], @"x-ia5",
|
||||
[NSNumber numberWithInt: 20106], @"x-ia5-german",
|
||||
[NSNumber numberWithInt: 20107], @"x-ia5-swedish",
|
||||
[NSNumber numberWithInt: 20108], @"x-ia5-norwegian",
|
||||
[NSNumber numberWithInt: 20127], @"us-ascii",
|
||||
[NSNumber numberWithInt: 20261], @"x-cp20261",
|
||||
[NSNumber numberWithInt: 20269], @"x-cp20269",
|
||||
[NSNumber numberWithInt: 20273], @"ibm273",
|
||||
[NSNumber numberWithInt: 20277], @"ibm277",
|
||||
[NSNumber numberWithInt: 20278], @"ibm278",
|
||||
[NSNumber numberWithInt: 20280], @"ibm280",
|
||||
[NSNumber numberWithInt: 20284], @"ibm284",
|
||||
[NSNumber numberWithInt: 20285], @"ibm285",
|
||||
[NSNumber numberWithInt: 20290], @"ibm290",
|
||||
[NSNumber numberWithInt: 20297], @"ibm297",
|
||||
[NSNumber numberWithInt: 20420], @"ibm420",
|
||||
[NSNumber numberWithInt: 20423], @"ibm423",
|
||||
[NSNumber numberWithInt: 20424], @"ibm424",
|
||||
[NSNumber numberWithInt: 20833], @"x-ebcdic-koreanextended",
|
||||
[NSNumber numberWithInt: 20838], @"ibm-thai",
|
||||
[NSNumber numberWithInt: 20866], @"koi8-r",
|
||||
[NSNumber numberWithInt: 20871], @"ibm871",
|
||||
[NSNumber numberWithInt: 20880], @"ibm880",
|
||||
[NSNumber numberWithInt: 20905], @"ibm905",
|
||||
[NSNumber numberWithInt: 20924], @"ibm00924",
|
||||
[NSNumber numberWithInt: 20932], @"euc-jp",
|
||||
[NSNumber numberWithInt: 20936], @"x-cp20936",
|
||||
[NSNumber numberWithInt: 20949], @"x-cp20949",
|
||||
[NSNumber numberWithInt: 21025], @"cp1025",
|
||||
[NSNumber numberWithInt: 21866], @"koi8-u",
|
||||
[NSNumber numberWithInt: 28591], @"iso-8859-1",
|
||||
[NSNumber numberWithInt: 28592], @"iso-8859-2",
|
||||
[NSNumber numberWithInt: 28593], @"iso-8859-3",
|
||||
[NSNumber numberWithInt: 28594], @"iso-8859-4",
|
||||
[NSNumber numberWithInt: 28595], @"iso-8859-5",
|
||||
[NSNumber numberWithInt: 28596], @"iso-8859-6",
|
||||
[NSNumber numberWithInt: 28597], @"iso-8859-7",
|
||||
[NSNumber numberWithInt: 28598], @"iso-8859-8",
|
||||
[NSNumber numberWithInt: 28599], @"iso-8859-9",
|
||||
[NSNumber numberWithInt: 28603], @"iso-8859-13",
|
||||
[NSNumber numberWithInt: 28605], @"iso-8859-15",
|
||||
[NSNumber numberWithInt: 29001], @"x-europa",
|
||||
[NSNumber numberWithInt: 38598], @"iso-8859-8-i",
|
||||
[NSNumber numberWithInt: 50220], @"iso-2022-jp",
|
||||
[NSNumber numberWithInt: 50221], @"csiso2022jp",
|
||||
[NSNumber numberWithInt: 50222], @"iso-2022-jp",
|
||||
[NSNumber numberWithInt: 50225], @"iso-2022-kr",
|
||||
[NSNumber numberWithInt: 50227], @"x-cp50227",
|
||||
[NSNumber numberWithInt: 51932], @"euc-jp",
|
||||
[NSNumber numberWithInt: 51936], @"euc-cn",
|
||||
[NSNumber numberWithInt: 51949], @"euc-kr",
|
||||
[NSNumber numberWithInt: 52936], @"hz-gb-2312",
|
||||
[NSNumber numberWithInt: 54936], @"gb18030",
|
||||
[NSNumber numberWithInt: 57002], @"x-iscii-de",
|
||||
[NSNumber numberWithInt: 57003], @"x-iscii-be",
|
||||
[NSNumber numberWithInt: 57004], @"x-iscii-ta",
|
||||
[NSNumber numberWithInt: 57005], @"x-iscii-te",
|
||||
[NSNumber numberWithInt: 57006], @"x-iscii-as",
|
||||
[NSNumber numberWithInt: 57007], @"x-iscii-or",
|
||||
[NSNumber numberWithInt: 57008], @"x-iscii-ka",
|
||||
[NSNumber numberWithInt: 57009], @"x-iscii-ma",
|
||||
[NSNumber numberWithInt: 57010], @"x-iscii-gu",
|
||||
[NSNumber numberWithInt: 57011], @"x-iscii-pa",
|
||||
[NSNumber numberWithInt: 65000], @"utf-7",
|
||||
[NSNumber numberWithInt: 65001], @"utf-8",
|
||||
nil] retain];
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
||||
+ (NSDictionary *) getReverseCodepagesTable
|
||||
{
|
||||
static NSDictionary *table = nil;
|
||||
|
||||
if (table == nil)
|
||||
{
|
||||
NSDictionary *codepages_table;
|
||||
NSEnumerator *enumerator;
|
||||
NSMutableArray *codepages, *names;
|
||||
id key;
|
||||
// Build reverse table: (NSNumber) codepage -> (NSString) encoding name
|
||||
codepages_table = [self getCodepagesTable];
|
||||
codepages = [NSMutableArray arrayWithCapacity: [codepages_table count]];
|
||||
names = [NSMutableArray arrayWithCapacity: [codepages_table count]];
|
||||
enumerator = [codepages_table keyEnumerator];
|
||||
while ((key = [enumerator nextObject]))
|
||||
{
|
||||
[names addObject: key];
|
||||
[codepages addObject: [codepages_table objectForKey: key]];
|
||||
}
|
||||
table = [[NSDictionary dictionaryWithObjects: names forKeys: codepages] retain];
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
||||
+ (NSNumber *) getCodepageFromName: (NSString *) name
|
||||
{
|
||||
return [[self getCodepagesTable] objectForKey: [name lowercaseString]];
|
||||
}
|
||||
|
||||
+ (NSString *) getNameFromCodepage: (NSNumber *) codepage
|
||||
{
|
||||
return [[self getReverseCodepagesTable] objectForKey: codepage];
|
||||
}
|
||||
|
||||
@end
|
||||
+10
-4
@@ -31,7 +31,7 @@ endif
|
||||
all::
|
||||
@echo " Python executable: ${PYTHON}"
|
||||
|
||||
SAMBA_PRIVATE_DIR = $(shell $(PYTHON) ./samba-get-config.py "private dir")
|
||||
SAMBA_PRIVATE_DIR = $(shell $(PYTHON) ./samba-get-config.py 'private dir' || echo /var/lib/samba/private)
|
||||
|
||||
$(SOGOBACKEND)_PRINCIPAL_CLASS = MAPIApplication
|
||||
|
||||
@@ -100,6 +100,7 @@ $(SOGOBACKEND)_OBJC_FILES += \
|
||||
MAPIStoreMailAttachment.m \
|
||||
MAPIStoreMailContext.m \
|
||||
MAPIStoreMailFolder.m \
|
||||
MAPIStoreMailFolderTable.m \
|
||||
MAPIStoreMailMessage.m \
|
||||
MAPIStoreMailVolatileMessage.m \
|
||||
MAPIStoreMailMessageTable.m \
|
||||
@@ -110,6 +111,8 @@ $(SOGOBACKEND)_OBJC_FILES += \
|
||||
\
|
||||
MAPIStoreFallbackContext.m \
|
||||
\
|
||||
MAPIStoreSharingMessage.m \
|
||||
\
|
||||
NSArray+MAPIStore.m \
|
||||
NSData+MAPIStore.m \
|
||||
NSDate+MAPIStore.m \
|
||||
@@ -120,7 +123,9 @@ $(SOGOBACKEND)_OBJC_FILES += \
|
||||
iCalEvent+MAPIStore.m \
|
||||
iCalTimeZone+MAPIStore.m \
|
||||
\
|
||||
RTFHandler.m
|
||||
RTFHandler.m \
|
||||
\
|
||||
Codepages.m
|
||||
|
||||
|
||||
$(SOGOBACKEND)_RESOURCE_FILES += \
|
||||
@@ -140,7 +145,8 @@ $(DBMSGREADER_TOOL)_LIB_DIRS += \
|
||||
-L../SoObjects/SOGo/SOGo.framework/sogo -lSOGo \
|
||||
-L../SOPE/GDLContentStore/obj/ -lGDLContentStore \
|
||||
-L../SOPE/NGCards/obj/ -lNGCards \
|
||||
-lNGObjWeb
|
||||
-lNGObjWeb \
|
||||
$(LIBMAPI_LIBS)
|
||||
|
||||
TEST_TOOL_NAME += $(PLREADER_TOOL) $(DBMSGREADER_TOOL)
|
||||
|
||||
@@ -171,7 +177,7 @@ $(SOGOBACKEND)_LIB_DIRS += \
|
||||
$(LIBMAPISTORE_LIBS)
|
||||
|
||||
ADDITIONAL_INCLUDE_DIRS += \
|
||||
-Werror -Wall \
|
||||
-Wall \
|
||||
-DSAMBA_PRIVATE_DIR=@"\"$(SAMBA_PRIVATE_DIR)\"" \
|
||||
$(LIBMAPI_CFLAGS) \
|
||||
$(LIBMAPISTORE_CFLAGS) \
|
||||
|
||||
@@ -33,8 +33,9 @@
|
||||
}
|
||||
|
||||
- (id) authenticatorInContext: (id) context;
|
||||
|
||||
- (MAPIStoreUserContext *) userContext;
|
||||
- (void) setUserContext: (MAPIStoreUserContext *) newContext;
|
||||
- (void) cleanup;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -76,6 +76,11 @@ MAPIApplication *MAPIApp = nil;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (MAPIStoreUserContext *) userContext
|
||||
{
|
||||
return userContext;
|
||||
}
|
||||
|
||||
- (void) setUserContext: (MAPIStoreUserContext *) newContext
|
||||
{
|
||||
/* user contexts must not be retained here ad their holder (mapistore)
|
||||
@@ -88,4 +93,9 @@ MAPIApplication *MAPIApp = nil;
|
||||
return [userContext authenticator];
|
||||
}
|
||||
|
||||
- (void) cleanup
|
||||
{
|
||||
[userContext deactivate];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -24,6 +24,7 @@
|
||||
#define MAPISTORECALENDARWRAPPER_H
|
||||
|
||||
#import <NGCards/iCalPerson.h>
|
||||
#import <NGCards/iCalTimeZone.h>
|
||||
#import <Appointments/iCalEntityObject+SOGo.h>
|
||||
|
||||
#import "MAPIStoreObjectProxy.h"
|
||||
@@ -42,7 +43,7 @@
|
||||
iCalCalendar *calendar;
|
||||
iCalEvent *firstEvent;
|
||||
iCalEvent *event;
|
||||
NSTimeZone *timeZone;
|
||||
iCalTimeZone *timeZone;
|
||||
SOGoUser *user;
|
||||
NSString *senderEmail;
|
||||
NSData *globalObjectId;
|
||||
@@ -57,12 +58,10 @@
|
||||
+ (id) wrapperWithICalEvent: (iCalEvent *) newEvent
|
||||
andUser: (SOGoUser *) newUser
|
||||
andSenderEmail: (NSString *) newSenderEmail
|
||||
inTimeZone: (NSTimeZone *) newTimeZone
|
||||
withConnectionInfo: (struct mapistore_connection_info *) newConnInfo;
|
||||
- (id) initWithICalEvent: (iCalEvent *) newEvent
|
||||
andUser: (SOGoUser *) newUser
|
||||
andSenderEmail: (NSString *) newSenderEmail
|
||||
inTimeZone: (NSTimeZone *) newTimeZone
|
||||
withConnectionInfo: (struct mapistore_connection_info *) newConnInfo;
|
||||
|
||||
/* getters */
|
||||
|
||||
@@ -37,7 +37,9 @@
|
||||
#import <NGCards/iCalEventChanges.h>
|
||||
#import <NGCards/iCalPerson.h>
|
||||
#import <NGCards/iCalTrigger.h>
|
||||
#import <NGCards/iCalTimeZonePeriod.h>
|
||||
#import <NGCards/NSString+NGCards.h>
|
||||
#import <SOGo/SOGoDomainDefaults.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserManager.h>
|
||||
|
||||
@@ -45,6 +47,7 @@
|
||||
#import "MAPIStoreRecurrenceUtils.h"
|
||||
#import "MAPIStoreSamDBUtils.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "NSArray+MAPIStore.h"
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSDate+MAPIStore.h"
|
||||
#import "NSObject+MAPIStore.h"
|
||||
@@ -79,7 +82,6 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
+ (id) wrapperWithICalEvent: (iCalEvent *) newEvent
|
||||
andUser: (SOGoUser *) newUser
|
||||
andSenderEmail: (NSString *) newSenderEmail
|
||||
inTimeZone: (NSTimeZone *) newTimeZone
|
||||
withConnectionInfo: (struct mapistore_connection_info *) newConnInfo
|
||||
{
|
||||
MAPIStoreAppointmentWrapper *wrapper;
|
||||
@@ -87,7 +89,6 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
wrapper = [[self alloc] initWithICalEvent: newEvent
|
||||
andUser: newUser
|
||||
andSenderEmail: newSenderEmail
|
||||
inTimeZone: newTimeZone
|
||||
withConnectionInfo: newConnInfo];
|
||||
[wrapper autorelease];
|
||||
|
||||
@@ -181,10 +182,10 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
- (id) initWithICalEvent: (iCalEvent *) newEvent
|
||||
andUser: (SOGoUser *) newUser
|
||||
andSenderEmail: (NSString *) newSenderEmail
|
||||
inTimeZone: (NSTimeZone *) newTimeZone
|
||||
withConnectionInfo: (struct mapistore_connection_info *) newConnInfo
|
||||
{
|
||||
NSArray *events;
|
||||
iCalTimeZone *tz;
|
||||
|
||||
if ((self = [self init]))
|
||||
{
|
||||
@@ -193,9 +194,20 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
event = newEvent;
|
||||
events = [calendar events];
|
||||
firstEvent = [events objectAtIndex: 0];
|
||||
ASSIGN (timeZone, newTimeZone);
|
||||
ASSIGN (user, newUser);
|
||||
ASSIGN (senderEmail, newSenderEmail);
|
||||
/* If newEvent comes from the client, we set its time zone in
|
||||
updateFromMAPIProperties. If it is not present, we use the
|
||||
time zone of the user */
|
||||
tz = (iCalTimeZone *) [calendar firstChildWithTag: @"vtimezone"];
|
||||
if (!tz)
|
||||
{
|
||||
tz = [iCalTimeZone timeZoneForName: [[[user userDefaults] timeZone] name]];
|
||||
if (!tz)
|
||||
[self logWithFormat: @"no time zone could be set"];
|
||||
}
|
||||
ASSIGN (timeZone, tz);
|
||||
|
||||
[self _setupITIPContext];
|
||||
}
|
||||
|
||||
@@ -263,16 +275,16 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
|
||||
if (contactInfos)
|
||||
{
|
||||
username = [contactInfos objectForKey: @"c_uid"];
|
||||
username = [contactInfos objectForKey: @"sAMAccountName"];
|
||||
recipient->username = [username asUnicodeInMemCtx: msgData];
|
||||
entryId = MAPIStoreInternalEntryId (connInfo->sam_ctx, username);
|
||||
entryId = MAPIStoreInternalEntryId (connInfo, username);
|
||||
}
|
||||
else
|
||||
{
|
||||
recipient->username = NULL;
|
||||
entryId = MAPIStoreExternalEntryId (cn, email);
|
||||
}
|
||||
recipient->type = MAPI_TO;
|
||||
recipient->type = [[person role] isEqualToString: @"OPT-PARTICIPANT"] ? MAPI_CC : MAPI_TO;
|
||||
|
||||
/* properties */
|
||||
p = 0;
|
||||
@@ -282,7 +294,7 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
// PR_OBJECT_TYPE = MAPI_MAILUSER (see MAPI_OBJTYPE)
|
||||
recipient->data[p] = MAPILongValue (msgData, MAPI_MAILUSER);
|
||||
p++;
|
||||
|
||||
|
||||
// PR_DISPLAY_TYPE = DT_MAILUSER (see MS-NSPI)
|
||||
recipient->data[p] = MAPILongValue (msgData, 0);
|
||||
p++;
|
||||
@@ -364,9 +376,9 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
|
||||
if (contactInfos)
|
||||
{
|
||||
username = [contactInfos objectForKey: @"c_uid"];
|
||||
username = [contactInfos objectForKey: @"sAMAccountName"];
|
||||
recipient->username = [username asUnicodeInMemCtx: msgData];
|
||||
entryId = MAPIStoreInternalEntryId (connInfo->sam_ctx, username);
|
||||
entryId = MAPIStoreInternalEntryId (connInfo, username);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -382,7 +394,7 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
// PR_OBJECT_TYPE = MAPI_MAILUSER (see MAPI_OBJTYPE)
|
||||
recipient->data[p] = MAPILongValue (msgData, MAPI_MAILUSER);
|
||||
p++;
|
||||
|
||||
|
||||
// PR_DISPLAY_TYPE = DT_MAILUSER (see MS-NSPI)
|
||||
recipient->data[p] = MAPILongValue (msgData, 0);
|
||||
p++;
|
||||
@@ -720,22 +732,15 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
NSCalendarDate *dateValue;
|
||||
NSInteger offset;
|
||||
|
||||
// if ([event isRecurrent])
|
||||
// dateValue = [event firstRecurrenceStartDate];
|
||||
// else
|
||||
dateValue = [event startDate];
|
||||
if ([event isAllDay])
|
||||
{
|
||||
offset = -[timeZone secondsFromGMTForDate: dateValue];
|
||||
dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: offset];
|
||||
}
|
||||
[dateValue setTimeZone: utcTZ];
|
||||
dateValue = [timeZone shiftedCalendarDateForDate: dateValue];
|
||||
*data = [dateValue asFileTimeInMemCtx: memCtx];
|
||||
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -748,22 +753,14 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
exceptions, where it is the normal start date for the day of the
|
||||
exception. */
|
||||
NSCalendarDate *dateValue;
|
||||
NSInteger offset;
|
||||
|
||||
dateValue = [event recurrenceId];
|
||||
if (!dateValue)
|
||||
dateValue = [event startDate];
|
||||
[dateValue setTimeZone: timeZone];
|
||||
if ([event isAllDay])
|
||||
{
|
||||
offset = -[timeZone secondsFromGMTForDate: dateValue];
|
||||
dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: offset];
|
||||
}
|
||||
[dateValue setTimeZone: utcTZ];
|
||||
dateValue = [timeZone shiftedCalendarDateForDate: dateValue];
|
||||
*data = [dateValue asFileTimeInMemCtx: memCtx];
|
||||
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -771,19 +768,12 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
NSCalendarDate *dateValue;
|
||||
NSInteger offset;
|
||||
|
||||
dateValue = [firstEvent startDate];
|
||||
if ([firstEvent isAllDay])
|
||||
{
|
||||
offset = -[timeZone secondsFromGMTForDate: dateValue];
|
||||
dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: offset];
|
||||
}
|
||||
[dateValue setTimeZone: utcTZ];
|
||||
dateValue = [timeZone shiftedCalendarDateForDate: dateValue];
|
||||
*data = [dateValue asFileTimeInMemCtx: memCtx];
|
||||
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -791,11 +781,20 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
enum mapistore_error rc;
|
||||
NSCalendarDate *dateValue;
|
||||
NSCalendarDate *dateValue, *start;
|
||||
|
||||
if ([event isRecurrent])
|
||||
{
|
||||
dateValue = [[event startDate] hour: 0 minute: 0 second: 0];
|
||||
/* [MS-OXOCAL] For a recurring series, this property specifies
|
||||
midnight in the user's machine time zone, on the date of the
|
||||
first instance, then is persisted in UTC. */
|
||||
start = [event startDate];
|
||||
dateValue = [NSCalendarDate dateWithYear: [start yearOfCommonEra]
|
||||
month: [start monthOfYear]
|
||||
day: [start dayOfMonth]
|
||||
hour: 0 minute: 0 second: 0
|
||||
timeZone: utcTZ];
|
||||
dateValue = [timeZone shiftedCalendarDateForDate: dateValue];
|
||||
*data = [dateValue asFileTimeInMemCtx: memCtx];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
@@ -819,7 +818,7 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
dateValue = [event startDate];
|
||||
offset = [event durationAsTimeInterval];
|
||||
if ([event isAllDay])
|
||||
offset -= [timeZone secondsFromGMTForDate: dateValue];
|
||||
offset -= [[timeZone periodForDate: dateValue] secondsOffsetFromGMT];
|
||||
dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: offset];
|
||||
@@ -837,15 +836,14 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
dateValue = [event recurrenceId];
|
||||
if (!dateValue)
|
||||
dateValue = [event startDate];
|
||||
[dateValue setTimeZone: timeZone];
|
||||
offset = [firstEvent durationAsTimeInterval];
|
||||
if ([firstEvent isAllDay])
|
||||
offset -= [timeZone secondsFromGMTForDate: dateValue];
|
||||
offset -= [[timeZone periodForDate: dateValue] secondsOffsetFromGMT];
|
||||
dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: offset];
|
||||
*data = [dateValue asFileTimeInMemCtx: memCtx];
|
||||
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -861,7 +859,7 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
dateValue = [firstEvent startDate];
|
||||
offset = [firstEvent durationAsTimeInterval];
|
||||
if ([event isAllDay])
|
||||
offset -= [timeZone secondsFromGMTForDate: dateValue];
|
||||
offset -= [[timeZone periodForDate: dateValue] secondsOffsetFromGMT];
|
||||
dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: offset];
|
||||
@@ -875,26 +873,17 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
{
|
||||
enum mapistore_error rc;
|
||||
NSCalendarDate *dateValue;
|
||||
NSInteger offset;
|
||||
iCalRecurrenceRule *rrule;
|
||||
|
||||
if ([event isRecurrent])
|
||||
{
|
||||
rrule = [[event recurrenceRules] objectAtIndex: 0];
|
||||
dateValue = [rrule untilDate];
|
||||
if (dateValue)
|
||||
{
|
||||
if ([event isAllDay])
|
||||
offset = -[timeZone secondsFromGMTForDate: dateValue];
|
||||
else
|
||||
offset = 0;
|
||||
dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: offset];
|
||||
}
|
||||
if (dateValue && [event isAllDay])
|
||||
dateValue = [timeZone shiftedCalendarDateForDate: dateValue];
|
||||
else
|
||||
dateValue = [NSCalendarDate dateWithYear: 4500 month: 8 day: 31
|
||||
hour: 23 minute: 59 second: 59
|
||||
hour: 23 minute: 59 second: 00
|
||||
timeZone: utcTZ];
|
||||
*data = [dateValue asFileTimeInMemCtx: memCtx];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
@@ -921,8 +910,8 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
|
||||
if (contactInfos)
|
||||
{
|
||||
username = [contactInfos objectForKey: @"c_uid"];
|
||||
entryId = MAPIStoreInternalEntryId (connInfo->sam_ctx, username);
|
||||
username = [contactInfos objectForKey: @"sAMAccountName"];
|
||||
entryId = MAPIStoreInternalEntryId (connInfo, username);
|
||||
}
|
||||
else
|
||||
entryId = MAPIStoreExternalEntryId (cn, email);
|
||||
@@ -1191,11 +1180,31 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
return [self getYes: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidTagSensitivity: (void **) data // not implemented, depends on CLASS
|
||||
- (int) getPidTagSensitivity: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
// normal = 0, personal?? = 1, private = 2, confidential = 3
|
||||
return [self getLongZero: data inMemCtx: memCtx];
|
||||
/* See [MS-OXCICAL] Section 2.1.3.11.20.4 */
|
||||
uint32_t v;
|
||||
NSString *accessClass;
|
||||
|
||||
accessClass = [event accessClass];
|
||||
if (accessClass)
|
||||
{
|
||||
if ([accessClass isEqualToString: @"X-PERSONAL"])
|
||||
v = 0x1;
|
||||
else if ([accessClass isEqualToString: @"PRIVATE"])
|
||||
v = 0x2;
|
||||
else if ([accessClass isEqualToString: @"CONFIDENTIAL"])
|
||||
v = 0x3;
|
||||
else
|
||||
v = 0x0; /* PUBLIC */
|
||||
}
|
||||
else
|
||||
v = 0x0; /* PUBLIC */
|
||||
|
||||
*data = MAPILongValue (memCtx, v);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getPidTagImportance: (void **) data
|
||||
@@ -1214,6 +1223,22 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getPidNameKeywords: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
/* See [MS-OXCICAL] Section 2.1.3.1.1.20.3 */
|
||||
NSArray *categories;
|
||||
|
||||
categories = [event categories];
|
||||
if (categories)
|
||||
{
|
||||
*data = [categories asMVUnicodeInMemCtx: memCtx];
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
else
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (int) getPidTagBody: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
@@ -1231,7 +1256,7 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
/* Avoiding those trail weird characters at event description */
|
||||
range = [stringValue rangeOfString: trimingString
|
||||
options: NSBackwardsSearch];
|
||||
if (range.location > 0)
|
||||
if (range.location != NSNotFound)
|
||||
{
|
||||
stringValue = [stringValue substringToIndex: (NSMaxRange(range) -1)];
|
||||
}
|
||||
@@ -1292,21 +1317,14 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
{
|
||||
enum mapistore_error rc;
|
||||
NSCalendarDate *dateValue;
|
||||
NSInteger offset;
|
||||
|
||||
dateValue = [event recurrenceId];
|
||||
if (dateValue)
|
||||
{
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
|
||||
|
||||
if ([event isAllDay])
|
||||
{
|
||||
offset = -[timeZone secondsFromGMTForDate: dateValue];
|
||||
dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: offset];
|
||||
}
|
||||
[dateValue setTimeZone: utcTZ];
|
||||
dateValue = [timeZone shiftedCalendarDateForDate: dateValue];
|
||||
*data = [dateValue asFileTimeInMemCtx: memCtx];
|
||||
}
|
||||
else
|
||||
@@ -1331,7 +1349,6 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
iCalEventChanges *changes;
|
||||
NSArray *changedProperties;
|
||||
NSCalendarDate *dateValue;
|
||||
NSInteger offset;
|
||||
|
||||
changes = [iCalEventChanges changesFromEvent: event toEvent: exceptionEvent];
|
||||
|
||||
@@ -1339,28 +1356,17 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
memset (extendedException, 0, sizeof (struct ExtendedException));
|
||||
extendedException->ChangeHighlight.Size = sizeof (uint32_t);
|
||||
|
||||
dateValue = [exceptionEvent startDate];
|
||||
offset = [timeZone secondsFromGMTForDate: dateValue];
|
||||
dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: offset];
|
||||
dateValue = [timeZone computedDateForDate: [exceptionEvent startDate]];
|
||||
exceptionInfo->StartDateTime = [dateValue asMinutesSince1601];
|
||||
extendedException->ChangeHighlight.Value = BIT_CH_START;
|
||||
extendedException->StartDateTime = exceptionInfo->StartDateTime;
|
||||
|
||||
dateValue = [exceptionEvent endDate];
|
||||
offset = [timeZone secondsFromGMTForDate: dateValue];
|
||||
dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: offset];
|
||||
dateValue = [timeZone computedDateForDate: [exceptionEvent endDate]];
|
||||
exceptionInfo->EndDateTime = [dateValue asMinutesSince1601];
|
||||
extendedException->ChangeHighlight.Value |= BIT_CH_END;
|
||||
extendedException->EndDateTime = exceptionInfo->EndDateTime;
|
||||
|
||||
dateValue = [[exceptionEvent recurrenceId]
|
||||
dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: offset];
|
||||
dateValue = [timeZone computedDateForDate: [exceptionEvent recurrenceId]];
|
||||
exceptionInfo->OriginalStartDate = [dateValue asMinutesSince1601];
|
||||
extendedException->OriginalStartDate = exceptionInfo->OriginalStartDate;
|
||||
|
||||
@@ -1415,17 +1421,20 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
firstStartDate = [event firstRecurrenceStartDate];
|
||||
if (firstStartDate)
|
||||
{
|
||||
[firstStartDate setTimeZone: timeZone];
|
||||
|
||||
arp = talloc_zero (NULL, struct AppointmentRecurrencePattern);
|
||||
[rule fillRecurrencePattern: &arp->RecurrencePattern
|
||||
withEvent: event
|
||||
inTimeZone: timeZone
|
||||
inMemCtx: arp];
|
||||
arp->ReaderVersion2 = 0x00003006;
|
||||
arp->WriterVersion2 = 0x00003008; /* 0x3008 for compatibility with
|
||||
ol2003 */
|
||||
|
||||
/* All day events' dates are specified in floating time
|
||||
([MS-OXCICAL] 2.1.3.1.1.20.10). The StartTimeOffset and EndTimeOffset
|
||||
fields are relative to midnight of those days ([MS-OXOCAL] 2.2.1.44.5),
|
||||
so no time zone adjustment is needed */
|
||||
if (![event isAllDay])
|
||||
firstStartDate = [timeZone computedDateForDate: firstStartDate];
|
||||
startMinutes = ([firstStartDate hourOfDay] * 60
|
||||
+ [firstStartDate minuteOfHour]);
|
||||
arp->StartTimeOffset = startMinutes;
|
||||
@@ -1651,15 +1660,16 @@ ReservedBlockEE2Size: 00 00 00 00
|
||||
fromDate: (NSCalendarDate *) instanceDate;
|
||||
{
|
||||
uint16_t year;
|
||||
NSCalendarDate *dateValue;
|
||||
|
||||
if (instanceDate)
|
||||
{
|
||||
[instanceDate setTimeZone: timeZone];
|
||||
year = [instanceDate yearOfCommonEra];
|
||||
dateValue = [timeZone computedDateForDate: instanceDate];
|
||||
year = [dateValue yearOfCommonEra];
|
||||
newGlobalId->YH = year >> 8;
|
||||
newGlobalId->YL = year & 0xff;
|
||||
newGlobalId->Month = [instanceDate monthOfYear];
|
||||
newGlobalId->D = [instanceDate dayOfMonth];
|
||||
newGlobalId->Month = [dateValue monthOfYear];
|
||||
newGlobalId->D = [dateValue dayOfMonth];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1826,16 +1836,25 @@ ReservedBlockEE2Size: 00 00 00 00
|
||||
NSArray *alarms;
|
||||
NSUInteger count, max;
|
||||
iCalAlarm *currentAlarm;
|
||||
NSString *action;
|
||||
NSString *action, *webstatus;
|
||||
|
||||
alarms = [event alarms];
|
||||
max = [alarms count];
|
||||
for (count = 0; !alarm && count < max; count++)
|
||||
{
|
||||
currentAlarm = [alarms objectAtIndex: count];
|
||||
action = [[currentAlarm action] lowercaseString];
|
||||
if (!action || [action isEqualToString: @"display"])
|
||||
ASSIGN (alarm, currentAlarm);
|
||||
|
||||
// Only handle 'display' alarms
|
||||
action = [currentAlarm action];
|
||||
if ([action caseInsensitiveCompare: @"display"] != NSOrderedSame)
|
||||
continue;
|
||||
|
||||
// Ignore alarms already triggered
|
||||
webstatus = [[currentAlarm trigger] value: 0 ofAttribute: @"x-webstatus"];
|
||||
if ([webstatus caseInsensitiveCompare: @"triggered"] == NSOrderedSame)
|
||||
continue;
|
||||
|
||||
ASSIGN (alarm, currentAlarm);
|
||||
}
|
||||
|
||||
alarmSet = YES;
|
||||
@@ -1915,7 +1934,6 @@ ReservedBlockEE2Size: 00 00 00 00
|
||||
if (alarm)
|
||||
{
|
||||
alarmDate = [alarm nextAlarmDate];
|
||||
[alarmDate setTimeZone: utcTZ];
|
||||
*data = [alarmDate asFileTimeInMemCtx: memCtx];
|
||||
}
|
||||
else
|
||||
@@ -1977,8 +1995,7 @@ ReservedBlockEE2Size: 00 00 00 00
|
||||
enum mapistore_error rc;
|
||||
NSString *tzid;
|
||||
|
||||
tzid = [(iCalDateTime *) [event firstChildWithTag: @"dtstart"]
|
||||
value: 0 ofAttribute: @"tzid"];
|
||||
tzid = [timeZone tzId];
|
||||
if ([tzid length] > 0)
|
||||
{
|
||||
*data = [tzid asUnicodeInMemCtx: memCtx];
|
||||
@@ -1994,16 +2011,9 @@ ReservedBlockEE2Size: 00 00 00 00
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
enum mapistore_error rc;
|
||||
iCalTimeZone *icalTZ;
|
||||
|
||||
icalTZ = [(iCalDateTime *) [event firstChildWithTag: @"dtstart"] timeZone];
|
||||
if (icalTZ)
|
||||
{
|
||||
*data = [icalTZ asTimeZoneStructInMemCtx: memCtx];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
else
|
||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
*data = [timeZone asTimeZoneStructInMemCtx: memCtx];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -2012,19 +2022,17 @@ ReservedBlockEE2Size: 00 00 00 00
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
enum mapistore_error rc;
|
||||
iCalTimeZone *icalTZ;
|
||||
|
||||
if ([event isRecurrent])
|
||||
/* [MS-OXOCAL] 3.1.5.5.1: This property is used in floating (all-day) events,
|
||||
specified in floating time, to convert the start date from UTC to the user's
|
||||
time zone */
|
||||
if ([event isAllDay] | [event isRecurrent])
|
||||
{
|
||||
icalTZ = [(iCalDateTime *) [event firstChildWithTag: @"dtstart"] timeZone];
|
||||
if (icalTZ)
|
||||
{
|
||||
*data = [icalTZ asZoneTimeDefinitionWithFlags: TZRULE_FLAG_EFFECTIVE_TZREG | TZRULE_FLAG_RECUR_CURRENT_TZREG
|
||||
inMemCtx: memCtx];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
else
|
||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
/* [MS-OXOCAL] 2.2.1.42: This property can only have the E flag set in the
|
||||
TimeZoneDefinition struct */
|
||||
*data = [timeZone asZoneTimeDefinitionWithFlags: TZRULE_FLAG_EFFECTIVE_TZREG
|
||||
inMemCtx: memCtx];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
else
|
||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
|
||||
@@ -46,6 +46,9 @@
|
||||
forURL: (NSURL *) server
|
||||
forceRenew: (BOOL) renew;
|
||||
|
||||
- (NSString *) passwordInContext: (WOContext *) context;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREAUTHENTICATOR_H */
|
||||
@@ -72,4 +72,8 @@
|
||||
return imapPassword;
|
||||
}
|
||||
|
||||
- (NSString *) passwordInContext: (WOContext *) context
|
||||
{
|
||||
return password;
|
||||
}
|
||||
@end
|
||||
@@ -58,7 +58,6 @@
|
||||
wrapperWithICalEvent: [newContainer event]
|
||||
andUser: [userContext sogoUser]
|
||||
andSenderEmail: nil
|
||||
inTimeZone: [userContext timeZone]
|
||||
withConnectionInfo: [context connectionInfo]];
|
||||
[self addProxy: appointmentWrapper];
|
||||
}
|
||||
|
||||
@@ -63,24 +63,31 @@
|
||||
SOGoAppointmentObject *newEntry;
|
||||
NSString *name;
|
||||
|
||||
//[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__];
|
||||
[[self userContext] activate];
|
||||
|
||||
name = [NSString stringWithFormat: @"%@.ics",
|
||||
[SOGoObject globallyUniqueObjectId]];
|
||||
newEntry = [SOGoAppointmentObject objectWithName: name
|
||||
inContainer: sogoObject];
|
||||
[newEntry setIsNew: YES];
|
||||
/* the WOContext is required here for resolving notification pages */
|
||||
[newEntry setContext: [[self userContext] woContext]];
|
||||
newMessage = [MAPIStoreCalendarMessage mapiStoreObjectWithSOGoObject: newEntry
|
||||
inContainer: self];
|
||||
|
||||
|
||||
return newMessage;
|
||||
}
|
||||
|
||||
- (NSArray *) rolesForExchangeRights: (uint32_t) rights
|
||||
{
|
||||
/* Limitations
|
||||
|
||||
Following rights are not supported by SOGo specifically:
|
||||
|
||||
- DeleteOwned : Delete only own objects
|
||||
- EditOwned : Edit only own objects
|
||||
- CreateSubfolders: No calendar subfolders
|
||||
- FolderOwner: No sharing folder ownership?
|
||||
- FolderContact: No support to store this information
|
||||
- FolderVisible: It is inferred by other rights when extracting
|
||||
*/
|
||||
NSMutableArray *roles;
|
||||
|
||||
roles = [NSMutableArray arrayWithCapacity: 6];
|
||||
@@ -100,6 +107,14 @@
|
||||
[roles addObject: SOGoCalendarRole_PrivateViewer];
|
||||
[roles addObject: SOGoCalendarRole_ConfidentialViewer];
|
||||
}
|
||||
if (rights & RightsFreeBusySimple)
|
||||
{
|
||||
[roles addObject: SOGoCalendarRole_PublicDAndTViewer];
|
||||
}
|
||||
if (rights & RightsFreeBusyDetailed)
|
||||
{
|
||||
[roles addObject: SOGoCalendarRole_ConfidentialDAndTViewer];
|
||||
}
|
||||
|
||||
// [self logWithFormat: @"roles for rights %.8x = (%@)", rights, roles];
|
||||
|
||||
@@ -113,20 +128,29 @@
|
||||
if ([roles containsObject: SOGoRole_ObjectCreator])
|
||||
rights |= RightsCreateItems;
|
||||
if ([roles containsObject: SOGoRole_ObjectEraser])
|
||||
rights |= RightsDeleteAll;
|
||||
rights |= RightsDeleteAll | RightsDeleteOwn;
|
||||
if ([roles containsObject: SOGoCalendarRole_PublicModifier]
|
||||
&& [roles containsObject: SOGoCalendarRole_PrivateModifier]
|
||||
&& [roles containsObject: SOGoCalendarRole_ConfidentialModifier])
|
||||
rights |= RightsReadItems | RightsEditAll;
|
||||
rights |= RightsReadItems | RightsEditAll | RightsEditOwn | RightsFreeBusySimple | RightsFreeBusyDetailed;
|
||||
else if ([roles containsObject: SOGoCalendarRole_PublicViewer]
|
||||
&& [roles containsObject: SOGoCalendarRole_PrivateViewer]
|
||||
&& [roles containsObject: SOGoCalendarRole_ConfidentialViewer])
|
||||
rights |= RightsReadItems | 0x1800;
|
||||
if (rights != 0)
|
||||
// We have to set by hand other rights as only the highest role is returned
|
||||
// See SOGoAppointmentFolder.m:aclsForUser for details
|
||||
rights |= RightsReadItems | RightsFreeBusySimple | RightsFreeBusyDetailed;
|
||||
|
||||
if ([roles containsObject: SOGoCalendarRole_PublicDAndTViewer])
|
||||
rights |= RightsFreeBusySimple;
|
||||
|
||||
if ([roles containsObject: SOGoCalendarRole_ConfidentialDAndTViewer])
|
||||
rights |= RightsFreeBusyDetailed;
|
||||
|
||||
if ((rights & RightsReadItems) != 0 || (rights & RightsCreateItems) != 0 || (rights & RightsDeleteAll) != 0)
|
||||
rights |= RoleNone; /* actually "folder visible" */
|
||||
|
||||
// [self logWithFormat: @"rights for roles (%@) = %.8x", roles, rights];
|
||||
|
||||
|
||||
return rights;
|
||||
}
|
||||
|
||||
@@ -169,6 +193,14 @@
|
||||
[(SOGoAppointmentFolder *) sogoObject aclSQLListingFilter]];
|
||||
}
|
||||
|
||||
- (int) getPidTagContainerClass: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = [@"IPF.Appointment" asUnicodeInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getPidTagDefaultPostMessageClass: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
// extern void ndr_print_AppointmentRecurrencePattern(struct ndr_print *ndr, const char *name, const struct AppointmentRecurrencePattern *r);
|
||||
|
||||
static Class NSArrayK;
|
||||
static Class NSArrayK, MAPIStoreAppointmentWrapperK;
|
||||
|
||||
@implementation SOGoAppointmentObject (MAPIStoreExtension)
|
||||
|
||||
@@ -97,6 +97,7 @@ static Class NSArrayK;
|
||||
+ (void) initialize
|
||||
{
|
||||
NSArrayK = [NSArray class];
|
||||
MAPIStoreAppointmentWrapperK = [MAPIStoreAppointmentWrapper class];
|
||||
}
|
||||
|
||||
+ (enum mapistore_error) getAvailableProperties: (struct SPropTagArray **) propertiesP
|
||||
@@ -180,6 +181,12 @@ static Class NSArrayK;
|
||||
else
|
||||
{
|
||||
origCalendar = [sogoObject calendar: YES secure: YES];
|
||||
if (!origCalendar)
|
||||
{
|
||||
[self errorWithFormat: @"Incorrect calendar event %@. Empty message is created",
|
||||
[self url]];
|
||||
return self;
|
||||
}
|
||||
calendar = [origCalendar mutableCopy];
|
||||
masterEvent = [[calendar events] objectAtIndex: 0];
|
||||
[self _setupAttachmentParts];
|
||||
@@ -190,7 +197,6 @@ static Class NSArrayK;
|
||||
= [MAPIStoreAppointmentWrapper wrapperWithICalEvent: masterEvent
|
||||
andUser: [userContext sogoUser]
|
||||
andSenderEmail: nil
|
||||
inTimeZone: [userContext timeZone]
|
||||
withConnectionInfo: [context connectionInfo]];
|
||||
[self addProxy: appointmentWrapper];
|
||||
}
|
||||
@@ -205,13 +211,23 @@ static Class NSArrayK;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/* getters */
|
||||
- (int) getPidLidFInvited: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
- (MAPIStoreAppointmentWrapper *) _appointmentWrapper
|
||||
{
|
||||
return [self getYes: data inMemCtx: memCtx];
|
||||
NSUInteger i, max;
|
||||
id proxy;
|
||||
max = [proxies count];
|
||||
for (i = 0; i < max; i++) {
|
||||
proxy = [proxies objectAtIndex: i];
|
||||
if ([proxy isKindOfClass: MAPIStoreAppointmentWrapperK])
|
||||
{
|
||||
return proxy;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
/* getters */
|
||||
- (int) getPidTagMessageClass: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
@@ -324,100 +340,63 @@ static Class NSArrayK;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* HACK: we know the first (and only) proxy is our appointment wrapper
|
||||
instance, but this might not always be true */
|
||||
[[proxies objectAtIndex: 0] fillMessageData: msgData
|
||||
inMemCtx: memCtx];
|
||||
[[self _appointmentWrapper] fillMessageData: msgData
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
*dataPtr = msgData;
|
||||
}
|
||||
|
||||
/* sender representing */
|
||||
// - (int) getPidTagSentRepresentingEmailAddress: (void **) data
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// return [self getPidTagSenderEmailAddress: data inMemCtx: memCtx];
|
||||
// }
|
||||
|
||||
// - (int) getPidTagSentRepresentingAddressType: (void **) data
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// return [self getSMTPAddrType: data inMemCtx: memCtx];
|
||||
// }
|
||||
|
||||
// - (int) getPidTagSentRepresentingName: (void **) data
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// return [self getPidTagSenderName: data inMemCtx: memCtx];
|
||||
// }
|
||||
|
||||
// - (int) getPidTagSentRepresentingEntryId: (void **) data
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// return [self getPidTagSenderEntryId: data inMemCtx: memCtx];
|
||||
// }
|
||||
|
||||
/* attendee */
|
||||
// - (int) getPidTagReceivedByAddressType: (void **) data
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// return [appointmentWrapper getPidTagReceivedByAddressType: data
|
||||
// inMemCtx: memCtx];
|
||||
// }
|
||||
|
||||
// - (int) getPidTagReceivedByEmailAddress: (void **) data
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// return [appointmentWrapper getPidTagReceivedByEmailAddress: data
|
||||
// inMemCtx: memCtx];
|
||||
// }
|
||||
|
||||
// - (int) getPidTagReceivedByName: (void **) data
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// return [appointmentWrapper getPidTagReceivedByName: data
|
||||
// inMemCtx: memCtx];
|
||||
// }
|
||||
|
||||
// - (int) getPidTagReceivedByEntryId: (void **) data
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// return [appointmentWrapper getPidTagReceivedByEntryId: data
|
||||
// inMemCtx: memCtx];
|
||||
// }
|
||||
|
||||
// /* attendee representing */
|
||||
// - (int) getPidTagReceivedRepresentingEmailAddress: (void **) data
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// return [self getPidTagReceivedByEmailAddress: data inMemCtx: memCtx];
|
||||
// }
|
||||
|
||||
// - (int) getPidTagReceivedRepresentingAddressType: (void **) data
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// return [self getSMTPAddrType: data inMemCtx: memCtx];
|
||||
// }
|
||||
|
||||
// - (int) getPidTagReceivedRepresentingName: (void **) data
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// return [self getPidTagReceivedByName: data inMemCtx: memCtx];
|
||||
// }
|
||||
|
||||
// - (int) getPidTagReceivedRepresentingEntryId: (void **) data
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// return [self getPidTagReceivedByEntryId: data inMemCtx: memCtx];
|
||||
// }
|
||||
|
||||
- (int) getPidTagResponseRequested: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getYes: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
/* This three methods: getPidTagNormalizedSubject,
|
||||
getPidTagSensitivity and getPidTagImportance are implemented in
|
||||
MAPIStoreMessage base class, then the proxy method is not reached
|
||||
(see MAPIStoreObject).
|
||||
*/
|
||||
- (int) getPidTagNormalizedSubject: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
MAPIStoreAppointmentWrapper *appointmentWrapper;
|
||||
|
||||
appointmentWrapper = [self _appointmentWrapper];
|
||||
if (appointmentWrapper)
|
||||
return [appointmentWrapper getPidTagNormalizedSubject: data inMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (int) getPidTagSensitivity: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
MAPIStoreAppointmentWrapper *appointmentWrapper;
|
||||
|
||||
appointmentWrapper = [self _appointmentWrapper];
|
||||
if (appointmentWrapper)
|
||||
return [appointmentWrapper getPidTagSensitivity: data inMemCtx: memCtx];
|
||||
|
||||
return [self getLongZero: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidTagImportance: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
MAPIStoreAppointmentWrapper *appointmentWrapper;
|
||||
|
||||
appointmentWrapper = [self _appointmentWrapper];
|
||||
if (appointmentWrapper)
|
||||
return [appointmentWrapper getPidTagImportance: data inMemCtx: memCtx];
|
||||
|
||||
*data = MAPILongValue (memCtx, 1);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
- (NSString *) _uidFromGlobalObjectId: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
NSData *objectId;
|
||||
@@ -514,6 +493,7 @@ static Class NSArrayK;
|
||||
folder = [sogoObject container];
|
||||
|
||||
/* reinstantiate the old sogo object and attach it to self */
|
||||
[[self userContext] activate];
|
||||
woContext = [[self userContext] woContext];
|
||||
if (isNew)
|
||||
{
|
||||
@@ -597,7 +577,7 @@ static Class NSArrayK;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) save: (TALLOC_CTX *) memCtx
|
||||
- (void) save: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
// iCalCalendar *vCalendar;
|
||||
// NSCalendarDate *now;
|
||||
@@ -654,7 +634,7 @@ static Class NSArrayK;
|
||||
withActiveUser: activeUser
|
||||
inMemCtx: memCtx];
|
||||
[self _updateAttachedEvents];
|
||||
[[self userContext] activateWithUser: activeUser];
|
||||
[[self userContext] activate];
|
||||
[sogoObject updateContentWithCalendar: calendar
|
||||
fromRequest: nil];
|
||||
[self updateVersions];
|
||||
@@ -690,7 +670,7 @@ static Class NSArrayK;
|
||||
return newAttachment;
|
||||
}
|
||||
|
||||
- (int) setReadFlag: (uint8_t) flag
|
||||
- (enum mapistore_error) setReadFlag: (uint8_t) flag
|
||||
{
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -182,6 +182,9 @@ static Class MAPIStoreCalendarMessageK = Nil;
|
||||
forKey: MAPIPropertyKey (PR_CREATION_TIME)];
|
||||
[knownProperties setObject: @"c_uid"
|
||||
forKey: MAPIPropertyKey (PR_OWNER_APPT_ID)];
|
||||
/* Use by oxcfxics to sort the latest first */
|
||||
[knownProperties setObject: @"c_lastmodified"
|
||||
forKey: MAPIPropertyKey (PidTagMessageDeliveryTime)];
|
||||
}
|
||||
|
||||
return [knownProperties objectForKey: MAPIPropertyKey (property)];
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#import <Contacts/SOGoContactFolders.h>
|
||||
|
||||
#import "MAPIApplication.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import "MAPIStoreContactsContext.h"
|
||||
#import "MAPIStoreContactsMessage.h"
|
||||
#import "MAPIStoreContactsMessageTable.h"
|
||||
@@ -58,10 +59,12 @@
|
||||
SOGoContactGCSEntry *newEntry;
|
||||
NSString *name;
|
||||
|
||||
[[self userContext] activate];
|
||||
|
||||
name = [NSString stringWithFormat: @"%@.vcf",
|
||||
[SOGoObject globallyUniqueObjectId]];
|
||||
newEntry = [SOGoContactGCSEntry objectWithName: name
|
||||
inContainer: sogoObject];
|
||||
inContainer: sogoObject];
|
||||
[newEntry setIsNew: YES];
|
||||
newMessage = [MAPIStoreContactsMessage mapiStoreObjectWithSOGoObject: newEntry
|
||||
inContainer: self];
|
||||
@@ -93,14 +96,14 @@
|
||||
if ([roles containsObject: SOGoRole_ObjectCreator])
|
||||
rights |= RightsCreateItems;
|
||||
if ([roles containsObject: SOGoRole_ObjectEraser])
|
||||
rights |= RightsDeleteAll;
|
||||
rights |= RightsDeleteAll | RightsDeleteOwn;
|
||||
if ([roles containsObject: SOGoRole_ObjectEditor])
|
||||
rights |= RightsEditAll;
|
||||
rights |= RightsEditAll | RightsEditOwn;
|
||||
if ([roles containsObject: SOGoRole_ObjectViewer])
|
||||
rights |= RightsReadItems;
|
||||
if (rights != 0)
|
||||
rights |= RoleNone; /* actually "folder visible" */
|
||||
|
||||
|
||||
return rights;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -220,6 +220,9 @@ static Class MAPIStoreContactsMessageK, NGMailAddressK, NSDataK, NSStringK;
|
||||
forKey: MAPIPropertyKey (PidTagSubject)];
|
||||
[knownProperties setObject: @"c_cn"
|
||||
forKey: MAPIPropertyKey (PidTagNormalizedSubject)];
|
||||
/* Use by oxcfxics to sort the latest first */
|
||||
[knownProperties setObject: @"c_lastmodified"
|
||||
forKey: MAPIPropertyKey (PidTagMessageDeliveryTime)];
|
||||
}
|
||||
|
||||
return [knownProperties objectForKey: MAPIPropertyKey (property)];
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#import <SOGo/SOGoUser.h>
|
||||
|
||||
#import "MAPIStoreAttachment.h"
|
||||
// #import "MAPIStoreAttachmentTable.h"
|
||||
#import "MAPIStoreFallbackContext.h"
|
||||
#import "MAPIStoreFolder.h"
|
||||
#import "MAPIStoreFolderTable.h"
|
||||
@@ -51,6 +50,7 @@
|
||||
#import "MAPIStoreContext.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <dlinklist.h>
|
||||
#include <stdbool.h>
|
||||
#include <gen_ndr/exchange.h>
|
||||
#include <util/attr.h>
|
||||
@@ -88,32 +88,31 @@ static NSMutableDictionary *contextClassMapping;
|
||||
currentClass = [classes objectAtIndex: count];
|
||||
moduleName = [currentClass MAPIModuleName];
|
||||
if (moduleName)
|
||||
{
|
||||
[contextClassMapping setObject: currentClass
|
||||
{
|
||||
[contextClassMapping setObject: currentClass
|
||||
forKey: moduleName];
|
||||
NSLog (@" registered class '%@' as handler of '%@' contexts",
|
||||
NSStringFromClass (currentClass), moduleName);
|
||||
}
|
||||
NSLog (@" registered class '%@' as handler of '%@' contexts",
|
||||
NSStringFromClass (currentClass), moduleName);
|
||||
}
|
||||
}
|
||||
|
||||
MAPIStoreFallbackContextK = [MAPIStoreFallbackContext class];
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listAllContextsForUser: (NSString *) userName
|
||||
withIndexing: (struct indexing_context *) indexing
|
||||
withIndexing: (struct indexing_context *) indexing
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
struct mapistore_contexts_list *list, *current;
|
||||
NSArray *classes;
|
||||
Class currentClass;
|
||||
NSUInteger count, max;
|
||||
MAPIStoreUserContext *userContext;
|
||||
|
||||
list = NULL;
|
||||
|
||||
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||
andTDBIndexing: indexing];
|
||||
[userContext activateWithUser: [userContext sogoUser]];
|
||||
// User context is activated on initialization
|
||||
[MAPIStoreUserContext userContextWithUsername: userName
|
||||
andTDBIndexing: indexing];
|
||||
|
||||
classes = GSObjCAllSubclassesOfClass (self);
|
||||
max = [classes count];
|
||||
@@ -121,7 +120,7 @@ static NSMutableDictionary *contextClassMapping;
|
||||
{
|
||||
currentClass = [classes objectAtIndex: count];
|
||||
current = [currentClass listContextsForUser: userName
|
||||
withIndexing: indexing
|
||||
withIndexing: indexing
|
||||
inMemCtx: memCtx];
|
||||
if (current)
|
||||
DLIST_CONCATENATE(list, current, void);
|
||||
@@ -131,7 +130,7 @@ static NSMutableDictionary *contextClassMapping;
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||
withIndexing: (struct indexing_context *) indexing
|
||||
withIndexing: (struct indexing_context *) indexing
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return NULL;
|
||||
@@ -224,8 +223,6 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||
NSURL *baseURL;
|
||||
int rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
|
||||
//NSLog (@"METHOD '%s' (%d) -- uri: '%s'", __FUNCTION__, __LINE__, newUri);
|
||||
|
||||
context = nil;
|
||||
|
||||
baseURL = CompleteURLFromMapistoreURI (newUri);
|
||||
@@ -276,6 +273,11 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||
{
|
||||
NSString *username;
|
||||
|
||||
if (newConnInfo == NULL)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
if ((self = [self init]))
|
||||
{
|
||||
ASSIGN (contextUrl, newUrl);
|
||||
@@ -292,13 +294,6 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||
ASSIGN (userContext,
|
||||
[MAPIStoreUserContext userContextWithUsername: username
|
||||
andTDBIndexing: indexing]);
|
||||
|
||||
#if 0
|
||||
mapistore_mgmt_backend_register_user (newConnInfo,
|
||||
"SOGo",
|
||||
[username UTF8String]);
|
||||
#endif
|
||||
|
||||
connInfo = newConnInfo;
|
||||
username = [NSString stringWithUTF8String: newConnInfo->username];
|
||||
ASSIGN (activeUser, [SOGoUser userWithLogin: username]);
|
||||
@@ -316,12 +311,6 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
#if 0
|
||||
mapistore_mgmt_backend_unregister_user ([self connectionInfo], "SOGo",
|
||||
[[userContext username]
|
||||
UTF8String]);
|
||||
#endif
|
||||
|
||||
[contextUrl release];
|
||||
[userContext release];
|
||||
[containersBag release];
|
||||
@@ -349,26 +338,16 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||
return activeUser;
|
||||
}
|
||||
|
||||
// - (void) logRestriction: (struct mapi_SRestriction *) res
|
||||
// withState: (MAPIRestrictionState) state
|
||||
// {
|
||||
// NSString *resStr;
|
||||
|
||||
// resStr = MAPIStringForRestriction (res);
|
||||
|
||||
// [self logWithFormat: @"%@ --> %@", resStr, MAPIStringForRestrictionState (state)];
|
||||
// }
|
||||
|
||||
- (int) getPath: (char **) path
|
||||
ofFMID: (uint64_t) fmid
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
int rc;
|
||||
NSString *objectURL, *url;
|
||||
// TDB_DATA key, dbuf;
|
||||
|
||||
url = [[contextUrl absoluteString]
|
||||
stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
||||
url = [contextUrl absoluteString];
|
||||
// FIXME transform percent escapes but not for user part of the url
|
||||
//[xxxx stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
||||
objectURL = [[userContext mapping] urlFromID: fmid];
|
||||
if (objectURL)
|
||||
{
|
||||
@@ -389,14 +368,6 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||
else
|
||||
{
|
||||
[self errorWithFormat: @"%s: you should *never* get here", __PRETTY_FUNCTION__];
|
||||
// /* attempt to populate our mapping dict with data from indexing.tdb */
|
||||
// key.dptr = (unsigned char *) talloc_asprintf (memCtx, "0x%.16llx",
|
||||
// (long long unsigned int )fmid);
|
||||
// key.dsize = strlen ((const char *) key.dptr);
|
||||
|
||||
// dbuf = tdb_fetch (memCtx->indexing_list->index_ctx->tdb, key);
|
||||
// talloc_free (key.dptr);
|
||||
// uri = talloc_strndup (memCtx, (const char *)dbuf.dptr, dbuf.dsize);
|
||||
*path = NULL;
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
@@ -412,7 +383,6 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||
withFID: (uint64_t) newFid
|
||||
{
|
||||
enum mapistore_error rc;
|
||||
MAPIStoreMapping *mapping;
|
||||
MAPIStoreFolder *baseFolder;
|
||||
SOGoFolder *currentFolder;
|
||||
WOContext *woContext;
|
||||
@@ -420,11 +390,7 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||
NSArray *pathComponents;
|
||||
NSUInteger count, max;
|
||||
|
||||
mapping = [userContext mapping];
|
||||
if (![mapping urlFromID: newFid])
|
||||
[mapping registerURL: [contextUrl absoluteString]
|
||||
withID: newFid];
|
||||
[userContext activateWithUser: activeUser];
|
||||
[userContext activate];
|
||||
woContext = [userContext woContext];
|
||||
|
||||
[self ensureContextFolder];
|
||||
@@ -486,7 +452,7 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||
/* utils */
|
||||
|
||||
- (NSString *) extractChildNameFromURL: (NSString *) objectURL
|
||||
andFolderURLAt: (NSString **) folderURL;
|
||||
andFolderURLAt: (NSString **) folderURL;
|
||||
{
|
||||
NSString *childKey;
|
||||
NSRange lastSlash;
|
||||
@@ -495,15 +461,15 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||
if ([objectURL hasSuffix: @"/"])
|
||||
objectURL = [objectURL substringToIndex: [objectURL length] - 2];
|
||||
lastSlash = [objectURL rangeOfString: @"/"
|
||||
options: NSBackwardsSearch];
|
||||
options: NSBackwardsSearch];
|
||||
if (lastSlash.location != NSNotFound)
|
||||
{
|
||||
slashPtr = NSMaxRange (lastSlash);
|
||||
childKey = [objectURL substringFromIndex: slashPtr];
|
||||
if ([childKey length] == 0)
|
||||
childKey = nil;
|
||||
childKey = nil;
|
||||
if (folderURL)
|
||||
*folderURL = [objectURL substringToIndex: slashPtr];
|
||||
*folderURL = [objectURL substringToIndex: slashPtr];
|
||||
}
|
||||
else
|
||||
childKey = nil;
|
||||
@@ -514,11 +480,10 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||
- (uint64_t) idForObjectWithKey: (NSString *) key
|
||||
inFolderURL: (NSString *) folderURL
|
||||
{
|
||||
NSString *childURL, *owner;
|
||||
NSString *childURL;
|
||||
MAPIStoreMapping *mapping;
|
||||
uint64_t mappingId;
|
||||
uint32_t contextId;
|
||||
void *rootObject;
|
||||
enum mapistore_error ret;
|
||||
|
||||
if (key)
|
||||
childURL = [NSString stringWithFormat: @"%@%@", folderURL,
|
||||
@@ -529,17 +494,13 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||
mappingId = [mapping idFromURL: childURL];
|
||||
if (mappingId == NSNotFound)
|
||||
{
|
||||
//[self warnWithFormat: @"no id exist yet for '%@', requesting one...",
|
||||
// childURL];
|
||||
mapistore_indexing_get_new_folderID (connInfo->mstore_ctx, &mappingId);
|
||||
[mapping registerURL: childURL withID: mappingId];
|
||||
contextId = 0;
|
||||
|
||||
mapistore_search_context_by_uri (connInfo->mstore_ctx, [folderURL UTF8String],
|
||||
&contextId, &rootObject);
|
||||
owner = [userContext username];
|
||||
mapistore_indexing_record_add_mid (connInfo->mstore_ctx, contextId,
|
||||
[owner UTF8String], mappingId);
|
||||
[self logWithFormat: @"No id exist yet for '%@', requesting one", childURL];
|
||||
ret = mapistore_indexing_get_new_folderID (connInfo->mstore_ctx, &mappingId);
|
||||
if (ret == MAPISTORE_SUCCESS)
|
||||
[mapping registerURL: childURL withID: mappingId];
|
||||
else
|
||||
[self errorWithFormat: @"Error trying to get new folder id (%d): %s",
|
||||
ret, mapistore_errstr (ret)];
|
||||
}
|
||||
|
||||
return mappingId;
|
||||
@@ -549,7 +510,7 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||
{
|
||||
uint64_t newVersionNumber;
|
||||
|
||||
if (openchangedb_get_new_changeNumber (connInfo->oc_ctx, &newVersionNumber)
|
||||
if (openchangedb_get_new_changeNumber (connInfo->oc_ctx, connInfo->username, &newVersionNumber)
|
||||
!= MAPI_E_SUCCESS)
|
||||
abort ();
|
||||
|
||||
@@ -566,9 +527,9 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||
|
||||
memCtx = talloc_zero(NULL, TALLOC_CTX);
|
||||
newChangeNumbers = [NSMutableArray arrayWithCapacity: max];
|
||||
|
||||
|
||||
if (openchangedb_get_new_changeNumbers (connInfo->oc_ctx,
|
||||
memCtx, max, &numbers)
|
||||
memCtx, connInfo->username, max, &numbers)
|
||||
!= MAPI_E_SUCCESS || numbers->cValues != max)
|
||||
abort ();
|
||||
for (count = 0; count < max; count++)
|
||||
@@ -593,15 +554,14 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||
|
||||
memCtx = talloc_zero(NULL, TALLOC_CTX);
|
||||
newFMIDs = [NSMutableArray arrayWithCapacity: max];
|
||||
|
||||
|
||||
if (mapistore_indexing_get_new_folderIDs (connInfo->mstore_ctx,
|
||||
memCtx, max, &numbers)
|
||||
!= MAPISTORE_SUCCESS || numbers->cValues != max)
|
||||
abort ();
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
newNumber
|
||||
= [NSString stringWithUnsignedLongLong: numbers->lpui8[count]];
|
||||
newNumber = [NSString stringWithUnsignedLongLong: numbers->lpui8[count]];
|
||||
[newFMIDs addObject: newNumber];
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
|
||||
{
|
||||
value = get_SPropValue_SRow (aRow, PidTagDisplayName_string8);
|
||||
if (value)
|
||||
folderName = [NSString stringWithUTF8String: value->value.lpszA];
|
||||
folderName = [NSString stringWithUTF8String: (const char *) value->value.lpszA];
|
||||
else
|
||||
folderName = nil;
|
||||
}
|
||||
@@ -138,7 +138,9 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
|
||||
MAPIStoreMapping *mapping;
|
||||
NSRange slashRange;
|
||||
|
||||
if (isMove && [targetFolder isKindOfClass: MAPIStoreDBFolderK])
|
||||
pathComponent = nil;
|
||||
|
||||
if (isMove && ([targetFolder isKindOfClass: MAPIStoreDBFolderK] || !targetFolder))
|
||||
{
|
||||
path = [sogoObject path];
|
||||
slashRange = [path rangeOfString: @"/" options: NSBackwardsSearch];
|
||||
@@ -147,14 +149,28 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
|
||||
format: @"db folder path must start with a '/'"];
|
||||
else
|
||||
pathComponent = [path substringFromIndex: slashRange.location + 1];
|
||||
targetPath = [[targetFolder sogoObject] path];
|
||||
newPath = [NSString stringWithFormat: @"%@/%@",
|
||||
targetPath, pathComponent];
|
||||
[dbFolder changePathTo: newPath];
|
||||
|
||||
|
||||
if (targetFolder)
|
||||
{
|
||||
targetPath = [[targetFolder sogoObject] path];
|
||||
newPath = [NSString stringWithFormat: @"%@/%@",
|
||||
targetPath, pathComponent];
|
||||
[dbFolder changePathTo: newPath
|
||||
intoNewContainer: [targetFolder dbFolder]];
|
||||
}
|
||||
else
|
||||
[dbFolder changePathTo: [NSString stringWithFormat: @"/fallback/%@", pathComponent]
|
||||
intoNewContainer: nil];
|
||||
|
||||
mapping = [self mapping];
|
||||
newURL = [NSString stringWithFormat: @"%@%@/",
|
||||
[targetFolder url], pathComponent];
|
||||
|
||||
if (targetFolder)
|
||||
newURL = [NSString stringWithFormat: @"%@%@/",
|
||||
[targetFolder url], pathComponent];
|
||||
else
|
||||
newURL = [NSString stringWithFormat: @"sogo://%@@fallback/%@/",
|
||||
[[self userContext] username], pathComponent];
|
||||
|
||||
[mapping updateID: [self objectId]
|
||||
withURL: newURL];
|
||||
|
||||
@@ -177,6 +193,8 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
|
||||
SOGoMAPIDBMessage *fsObject;
|
||||
NSString *newKey;
|
||||
|
||||
[[self userContext] activate];
|
||||
|
||||
newKey = [NSString stringWithFormat: @"%@.plist",
|
||||
[SOGoObject globallyUniqueObjectId]];
|
||||
fsObject = [SOGoMAPIDBMessage objectWithName: newKey
|
||||
@@ -198,10 +216,13 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
|
||||
ownerUser = [[self userContext] sogoUser];
|
||||
if ([[context activeUser] isEqual: ownerUser]
|
||||
|| [self subscriberCanReadMessages])
|
||||
keys = [(SOGoCacheGCSFolder *) sogoObject childKeysOfType: MAPIMessageCacheObject
|
||||
includeDeleted: NO
|
||||
matchingQualifier: qualifier
|
||||
andSortOrderings: sortOrderings];
|
||||
{
|
||||
[[self userContext] activate];
|
||||
keys = [(SOGoCacheGCSFolder *) sogoObject childKeysOfType: MAPIMessageCacheObject
|
||||
includeDeleted: NO
|
||||
matchingQualifier: qualifier
|
||||
andSortOrderings: sortOrderings];
|
||||
}
|
||||
else
|
||||
keys = [NSArray array];
|
||||
|
||||
@@ -211,6 +232,7 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
|
||||
- (NSArray *) folderKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
[[self userContext] activate];
|
||||
return [dbFolder childKeysOfType: MAPIFolderCacheObject
|
||||
includeDeleted: NO
|
||||
matchingQualifier: qualifier
|
||||
@@ -246,7 +268,7 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
|
||||
if ([date laterDate: fileDate] == fileDate)
|
||||
{
|
||||
//[self logWithFormat: @"current date: %@", date];
|
||||
|
||||
|
||||
date = fileDate;
|
||||
}
|
||||
}
|
||||
@@ -299,9 +321,9 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
|
||||
if ([roles containsObject: MAPIStoreRightDeleteOwn])
|
||||
rights |= RightsDeleteOwn;
|
||||
if ([roles containsObject: MAPIStoreRightEditAll])
|
||||
rights |= RightsEditAll;
|
||||
rights |= RightsEditAll | RightsEditOwn;
|
||||
if ([roles containsObject: MAPIStoreRightDeleteAll])
|
||||
rights |= RightsDeleteAll;
|
||||
rights |= RightsDeleteAll | RightsDeleteOwn;
|
||||
if ([roles containsObject: MAPIStoreRightCreateSubfolders])
|
||||
rights |= RightsCreateSubfolders;
|
||||
if ([roles containsObject: MAPIStoreRightFolderOwner])
|
||||
@@ -310,7 +332,7 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
|
||||
rights |= RightsFolderContact;
|
||||
if (rights != 0)
|
||||
rights |= RoleNone; /* actually "folder visible" */
|
||||
|
||||
|
||||
return rights;
|
||||
}
|
||||
|
||||
@@ -345,7 +367,7 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
|
||||
subscribed to read an open contained messages in order to enable them to
|
||||
find the "LocalFreebusy" message */
|
||||
[sogoObject reloadIfNeeded];
|
||||
|
||||
|
||||
displayName = [[sogoObject properties]
|
||||
objectForKey: MAPIPropertyKey (PidTagDisplayName)];
|
||||
|
||||
|
||||
+232
-16
@@ -22,6 +22,7 @@
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSCalendarDate.h>
|
||||
#import <Foundation/NSData.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
@@ -34,6 +35,7 @@
|
||||
#import "MAPIStoreDBFolder.h"
|
||||
#import "MAPIStoreDBMessage.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSObject+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
@@ -43,26 +45,41 @@
|
||||
|
||||
@implementation MAPIStoreDBMessage
|
||||
|
||||
+ (int) getAvailableProperties: (struct SPropTagArray **) propertiesP
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
+ (enum mapistore_error) getAvailableProperties: (struct SPropTagArray **) propertiesP
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
struct SPropTagArray *properties;
|
||||
NSUInteger count;
|
||||
enum MAPITAGS faiProperties[] = { 0x68350102, 0x683c0102, 0x683e0102,
|
||||
0x683f0102, 0x68410003, 0x68420102,
|
||||
0x68450102, 0x68460003 };
|
||||
|
||||
enum MAPITAGS faiProperties[] = {
|
||||
0x68330048, /* PR_VIEW_CLSID */
|
||||
0x68350102, /* PR_VIEW_STATE */
|
||||
0x683c0102,
|
||||
0x683d0040,
|
||||
0x683e0102,
|
||||
0x683f0102, /* PR_VIEW_VIEWTYPE_KEY */
|
||||
0x68410003,
|
||||
0x68420102,
|
||||
0x68450102,
|
||||
0x68460003,
|
||||
0x7006001F, /* PR_VD_NAME_W */
|
||||
0x70030003, /* PR_VD_FLAGS */
|
||||
0x70070003 /* PR_VD_VERSION */
|
||||
};
|
||||
|
||||
size_t faiSize = sizeof(faiProperties) / sizeof(enum MAPITAGS);
|
||||
|
||||
properties = talloc_zero (memCtx, struct SPropTagArray);
|
||||
properties->cValues = MAPIStoreSupportedPropertiesCount + 8;
|
||||
properties->cValues = MAPIStoreSupportedPropertiesCount + faiSize;
|
||||
properties->aulPropTag = talloc_array (properties, enum MAPITAGS,
|
||||
MAPIStoreSupportedPropertiesCount + 8);
|
||||
MAPIStoreSupportedPropertiesCount + faiSize);
|
||||
|
||||
for (count = 0; count < MAPIStoreSupportedPropertiesCount; count++)
|
||||
properties->aulPropTag[count] = MAPIStoreSupportedProperties[count];
|
||||
|
||||
/* FIXME (hack): append a few undocumented properties that can be added to
|
||||
FAI messages */
|
||||
for (count = 0; count < 8; count++)
|
||||
for (count = 0; count < faiSize; count++)
|
||||
properties->aulPropTag[MAPIStoreSupportedPropertiesCount+count]
|
||||
= faiProperties[count];
|
||||
|
||||
@@ -71,6 +88,13 @@
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getAvailableProperties: (struct SPropTagArray **) propertiesP
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [[self class] getAvailableProperties: propertiesP
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (id) initWithSOGoObject: (id) newSOGoObject
|
||||
inContainer: (MAPIStoreObject *) newContainer
|
||||
{
|
||||
@@ -85,22 +109,173 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *) description
|
||||
{
|
||||
id key, value;
|
||||
NSEnumerator *propEnumerator;
|
||||
NSMutableString *description;
|
||||
|
||||
description = [NSMutableString stringWithFormat: @"%@ %@. Properties: {", NSStringFromClass ([self class]),
|
||||
[self url]];
|
||||
|
||||
propEnumerator = [properties keyEnumerator];
|
||||
while ((key = [propEnumerator nextObject]))
|
||||
{
|
||||
uint32_t proptag = 0;
|
||||
if ([key isKindOfClass: [NSString class]] && [(NSString *)key intValue] > 0)
|
||||
proptag = [(NSString *)key intValue];
|
||||
else if ([key isKindOfClass: [NSNumber class]])
|
||||
proptag = [key unsignedLongValue];
|
||||
|
||||
if (proptag > 0)
|
||||
{
|
||||
const char *propTagName = get_proptag_name ([key unsignedLongValue]);
|
||||
NSString *propName;
|
||||
|
||||
if (propTagName)
|
||||
propName = [NSString stringWithCString: propTagName
|
||||
encoding: NSUTF8StringEncoding];
|
||||
else
|
||||
propName = [NSString stringWithFormat: @"0x%.4x", [key unsignedLongValue]];
|
||||
|
||||
[description appendFormat: @"'%@': ", propName];
|
||||
}
|
||||
else
|
||||
[description appendFormat: @"'%@': ", key];
|
||||
|
||||
value = [properties objectForKey: key];
|
||||
[description appendFormat: @"%@ (%@), ", value, NSStringFromClass ([value class])];
|
||||
}
|
||||
|
||||
[description appendString: @"}\n"];
|
||||
|
||||
return description;
|
||||
}
|
||||
|
||||
- (uint64_t) objectVersion
|
||||
{
|
||||
NSNumber *versionNbr;
|
||||
/* Return the global counter from CN structure.
|
||||
See [MS-OXCFXICS] Section 2.2.2.1 */
|
||||
NSNumber *versionNbr, *cn;
|
||||
uint64_t objectVersion;
|
||||
|
||||
[(SOGoMAPIDBMessage *) sogoObject reloadIfNeeded];
|
||||
versionNbr = [properties objectForKey: @"version"];
|
||||
versionNbr = [properties objectForKey: @"version_number"];
|
||||
if (versionNbr)
|
||||
objectVersion = (([versionNbr unsignedLongLongValue] >> 16)
|
||||
& 0x0000ffffffffffffLL);
|
||||
objectVersion = exchange_globcnt ([versionNbr unsignedLongLongValue]);
|
||||
else
|
||||
objectVersion = ULLONG_MAX;
|
||||
{
|
||||
/* Old version which stored the CN structure not useful for searching */
|
||||
cn = [properties objectForKey: @"version"];
|
||||
if (cn)
|
||||
objectVersion = (([cn unsignedLongLongValue] >> 16)
|
||||
& 0x0000ffffffffffffLL);
|
||||
else
|
||||
objectVersion = ULLONG_MAX;
|
||||
}
|
||||
|
||||
return objectVersion;
|
||||
}
|
||||
|
||||
- (void) _updatePredecessorChangeList
|
||||
{
|
||||
BOOL updated;
|
||||
enum mapistore_error rc;
|
||||
NSData *currentChangeList, *changeKey;
|
||||
NSMutableArray *changeKeys;
|
||||
NSMutableData *newChangeList;
|
||||
NSUInteger count, len;
|
||||
struct SizedXid *changes;
|
||||
struct SPropValue property;
|
||||
struct SRow aRow;
|
||||
struct XID *currentChangeKey;
|
||||
TALLOC_CTX *localMemCtx;
|
||||
uint32_t nChanges;
|
||||
|
||||
localMemCtx = talloc_new (NULL);
|
||||
if (!localMemCtx)
|
||||
{
|
||||
[self errorWithFormat: @"No more memory"];
|
||||
return;
|
||||
}
|
||||
|
||||
changeKey = [self getReplicaKeyFromGlobCnt: [self objectVersion]];
|
||||
|
||||
currentChangeList = [properties objectForKey: MAPIPropertyKey (PidTagPredecessorChangeList)];
|
||||
if (!currentChangeList)
|
||||
{
|
||||
/* Create a new PredecessorChangeList */
|
||||
len = [changeKey length];
|
||||
newChangeList = [NSMutableData dataWithCapacity: len + 1];
|
||||
[newChangeList appendUInt8: len];
|
||||
[newChangeList appendData: changeKey];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Update current predecessor change list with new change key */
|
||||
changes = [currentChangeList asSizedXidArrayInMemCtx: localMemCtx
|
||||
with: &nChanges];
|
||||
|
||||
updated = NO;
|
||||
currentChangeKey = [changeKey asXIDInMemCtx: localMemCtx];
|
||||
for (count = 0; count < nChanges && !updated; count++)
|
||||
{
|
||||
if (GUID_equal(&changes[count].XID.NameSpaceGuid, ¤tChangeKey->NameSpaceGuid))
|
||||
{
|
||||
NSData *globCnt, *oldGlobCnt;
|
||||
oldGlobCnt = [NSData dataWithBytes: changes[count].XID.LocalId.data length: changes[count].XID.LocalId.length];
|
||||
globCnt = [NSData dataWithBytes: currentChangeKey->LocalId.data length: currentChangeKey->LocalId.length];
|
||||
if ([globCnt compare: oldGlobCnt] == NSOrderedDescending)
|
||||
{
|
||||
if ([globCnt length] != [oldGlobCnt length])
|
||||
{
|
||||
[self errorWithFormat: @"Cannot compare globcnt with different length: %@ and %@", globCnt, oldGlobCnt];
|
||||
abort();
|
||||
}
|
||||
memcpy (changes[count].XID.LocalId.data, currentChangeKey->LocalId.data, currentChangeKey->LocalId.length);
|
||||
updated = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Serialise it */
|
||||
changeKeys = [NSMutableArray array];
|
||||
|
||||
if (!updated)
|
||||
[changeKeys addObject: changeKey];
|
||||
|
||||
for (count = 0; count < nChanges; count++)
|
||||
{
|
||||
changeKey = [NSData dataWithXID: &changes[count].XID];
|
||||
[changeKeys addObject: changeKey];
|
||||
}
|
||||
|
||||
[changeKeys sortUsingFunction: MAPIChangeKeyGUIDCompare context: localMemCtx];
|
||||
|
||||
newChangeList = [NSMutableData data];
|
||||
len = [changeKeys count];
|
||||
for (count = 0; count < len; count++)
|
||||
{
|
||||
changeKey = [changeKeys objectAtIndex: count];
|
||||
[newChangeList appendUInt8: [changeKey length]];
|
||||
[newChangeList appendData: changeKey];
|
||||
}
|
||||
}
|
||||
|
||||
if ([newChangeList length] > 0)
|
||||
{
|
||||
property.ulPropTag = PidTagPredecessorChangeList;
|
||||
property.value.bin = *[newChangeList asBinaryInMemCtx: localMemCtx];
|
||||
aRow.cValues = 1;
|
||||
aRow.lpProps = &property;
|
||||
rc = [self addPropertiesFromRow: &aRow];
|
||||
if (rc != MAPISTORE_SUCCESS)
|
||||
[self errorWithFormat: @"Impossible to add a new predecessor change list: %d", rc];
|
||||
}
|
||||
|
||||
talloc_free (localMemCtx);
|
||||
}
|
||||
|
||||
//
|
||||
// FIXME: how this can happen?
|
||||
//
|
||||
@@ -160,10 +335,19 @@
|
||||
[properties setObject: attachmentParts forKey: @"attachments"];
|
||||
|
||||
newVersion = [[self context] getNewChangeNumber];
|
||||
[properties setObject: [NSNumber numberWithUnsignedLongLong: newVersion]
|
||||
forKey: @"version"];
|
||||
newVersion = exchange_globcnt ((newVersion >> 16) & 0x0000ffffffffffffLL);
|
||||
|
||||
[self logWithFormat: @"%d props in dict", [properties count]];
|
||||
[properties setObject: [NSNumber numberWithUnsignedLongLong: newVersion]
|
||||
forKey: @"version_number"];
|
||||
|
||||
/* Remove old version */
|
||||
[properties removeObjectForKey: @"version"];
|
||||
|
||||
/* Update PredecessorChangeList accordingly */
|
||||
[self _updatePredecessorChangeList];
|
||||
|
||||
// [self logWithFormat: @"Saving %@", [self description]];
|
||||
// [self logWithFormat: @"%d props in dict", [properties count]];
|
||||
|
||||
[sogoObject save];
|
||||
}
|
||||
@@ -206,4 +390,36 @@
|
||||
return [sogoObject lastModified];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) setReadFlag: (uint8_t) flag
|
||||
{
|
||||
/* Modify PidTagMessageFlags from SetMessageReadFlag and
|
||||
SyncImportReadStateChanges ROPs */
|
||||
NSNumber *flags;
|
||||
uint32_t newFlag;
|
||||
|
||||
flags = [properties objectForKey: MAPIPropertyKey (PR_MESSAGE_FLAGS)];
|
||||
if (flags)
|
||||
{
|
||||
newFlag = [flags unsignedLongValue];
|
||||
if (flag & SUPPRESS_RECEIPT)
|
||||
newFlag |= MSGFLAG_READ;
|
||||
if (flag & CLEAR_RN_PENDING)
|
||||
newFlag &= ~MSGFLAG_RN_PENDING;
|
||||
if (flag & CLEAR_READ_FLAG)
|
||||
newFlag &= ~MSGFLAG_READ;
|
||||
if (flag & CLEAR_NRN_PENDING)
|
||||
newFlag &= ~MSGFLAG_NRN_PENDING;
|
||||
}
|
||||
else
|
||||
{
|
||||
newFlag = MSGFLAG_READ;
|
||||
if (flag & CLEAR_READ_FLAG)
|
||||
newFlag = 0x0;
|
||||
}
|
||||
[properties setObject: [NSNumber numberWithUnsignedLong: newFlag]
|
||||
forKey: MAPIPropertyKey (PR_MESSAGE_FLAGS)];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -61,14 +61,15 @@ static Class MAPIStoreDBMessageK = Nil;
|
||||
|
||||
if ((uint32_t) res->ulPropTag == PidTagChangeNumber)
|
||||
{
|
||||
SEL operator;
|
||||
|
||||
value = NSObjectFromMAPISPropValue (&res->lpProp);
|
||||
cVersion = exchange_globcnt (([value unsignedLongLongValue] >> 16)
|
||||
& 0x0000ffffffffffffLL);
|
||||
version = [NSNumber numberWithUnsignedLongLong: cVersion];
|
||||
//[self logWithFormat: @"change number from oxcfxics: %.16lx", [value unsignedLongLongValue]];
|
||||
[self logWithFormat: @" version: %.16lx", cVersion];
|
||||
*qualifier = [[EOKeyValueQualifier alloc] initWithKey: @"version"
|
||||
operatorSelector: EOQualifierOperatorGreaterThanOrEqualTo
|
||||
operator = [self operatorFromRestrictionOperator: res->relop];
|
||||
*qualifier = [[EOKeyValueQualifier alloc] initWithKey: @"version_number"
|
||||
operatorSelector: operator
|
||||
value: version];
|
||||
[*qualifier autorelease];
|
||||
rc = MAPIRestrictionStateNeedsEval;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#undef DEBUG
|
||||
#include <inttypes.h>
|
||||
#include <dlinklist.h>
|
||||
#include <mapistore/mapistore.h>
|
||||
|
||||
@implementation MAPIStoreFallbackContext
|
||||
@@ -55,7 +56,10 @@
|
||||
NSString *baseURL, *url, *name;
|
||||
MAPIStoreUserContext *userContext;
|
||||
|
||||
baseURL = [NSString stringWithFormat: @"sogo://%@@fallback/", userName];
|
||||
baseURL = [NSString stringWithFormat: @"sogo://%@@fallback/",
|
||||
[userName stringByReplacingOccurrencesOfString: @"@"
|
||||
withString: @"%40"]];
|
||||
|
||||
|
||||
context = talloc_zero (memCtx, struct mapistore_contexts_list);
|
||||
context->url = [baseURL asUnicodeInMemCtx: context];
|
||||
@@ -99,7 +103,10 @@
|
||||
forUser: (NSString *) userName
|
||||
{
|
||||
return [NSString stringWithFormat: @"sogo://%@@fallback/0x%.16"PRIx64"/",
|
||||
userName, (unsigned long long) fid];
|
||||
[userName stringByReplacingOccurrencesOfString: @"@"
|
||||
withString: @"%40"],
|
||||
(unsigned long long) fid];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -121,6 +121,7 @@
|
||||
fromFolder: (MAPIStoreFolder *) sourceFolder
|
||||
withMIDs: (uint64_t *) targetMids
|
||||
andChangeKeys: (struct Binary_r **) targetChangeKeys
|
||||
andPredecessorChangeLists: (struct Binary_r **) targetPredecessorChangeLists
|
||||
wantCopy: (uint8_t) want_copy
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
|
||||
@@ -150,6 +151,7 @@
|
||||
|
||||
/* helpers */
|
||||
- (uint64_t) idForObjectWithKey: (NSString *) childKey;
|
||||
- (MAPIStoreFolder *) rootContainer;
|
||||
|
||||
/* subclasses */
|
||||
- (MAPIStoreMessage *) createMessage;
|
||||
@@ -184,12 +186,6 @@
|
||||
/* subclass helpers */
|
||||
- (void) setupVersionsMessage;
|
||||
- (void) ensureIDsForChildKeys: (NSArray *) keys;
|
||||
- (void) postNotificationsForMoveCopyMessagesWithMIDs: (uint64_t *) srcMids
|
||||
andMessageURLs: (NSArray *) oldMessageURLs
|
||||
andCount: (uint32_t) midCount
|
||||
fromFolder: (MAPIStoreFolder *) sourceFolder
|
||||
withMIDs: (uint64_t *) targetMids
|
||||
wantCopy: (uint8_t) wantCopy;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+124
-218
@@ -29,6 +29,7 @@
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <SOGo/SOGoContentObject.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoFolder.h>
|
||||
@@ -52,6 +53,7 @@
|
||||
#import <SOGo/SOGoCacheGCSFolder.h>
|
||||
#import "SOGoMAPIDBMessage.h"
|
||||
#import "SOGoCacheGCSObject+MAPIStore.h"
|
||||
#import <Mailer/SOGoMailObject.h>
|
||||
|
||||
#include <gen_ndr/exchange.h>
|
||||
|
||||
@@ -100,6 +102,8 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
NSUInteger lastPartIdx;
|
||||
MAPIStoreUserContext *userContext;
|
||||
|
||||
parts = 0;
|
||||
lastPartIdx = 0;
|
||||
folderURL = [NSURL URLWithString: [self url]];
|
||||
/* note: -[NSURL path] returns an unescaped representation */
|
||||
path = [folderURL path];
|
||||
@@ -116,6 +120,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
folderName = [folderURL host];
|
||||
|
||||
userContext = [self userContext];
|
||||
[userContext activate];
|
||||
[userContext ensureFolderTableExists];
|
||||
|
||||
ASSIGN (dbFolder,
|
||||
@@ -227,24 +232,19 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
|
||||
- (id) lookupFolder: (NSString *) folderKey
|
||||
{
|
||||
MAPIStoreFolder *childFolder;
|
||||
MAPIStoreFolder *childFolder = nil;
|
||||
SOGoFolder *sogoFolder;
|
||||
WOContext *woContext;
|
||||
|
||||
if ([[self folderKeys] containsObject: folderKey])
|
||||
{
|
||||
woContext = [[self userContext] woContext];
|
||||
sogoFolder = [sogoObject lookupName: folderKey inContext: woContext
|
||||
[[self userContext] activate];
|
||||
sogoFolder = [sogoObject lookupName: folderKey
|
||||
inContext: nil
|
||||
acquire: NO];
|
||||
if (sogoFolder && ![sogoFolder isKindOfClass: NSExceptionK])
|
||||
{
|
||||
[sogoFolder setContext: woContext];
|
||||
childFolder = [isa mapiStoreObjectWithSOGoObject: sogoFolder
|
||||
inContainer: self];
|
||||
}
|
||||
childFolder = [isa mapiStoreObjectWithSOGoObject: sogoFolder
|
||||
inContainer: self];
|
||||
}
|
||||
else
|
||||
childFolder = nil;
|
||||
|
||||
return childFolder;
|
||||
}
|
||||
@@ -275,9 +275,16 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
|
||||
if (messageKey)
|
||||
{
|
||||
[[self userContext] activate];
|
||||
msgObject = [sogoObject lookupName: messageKey
|
||||
inContext: nil
|
||||
acquire: NO];
|
||||
/* If the lookup in the indexing table works, but the IMAP does
|
||||
not have the message, then the message does not exist in this
|
||||
folder */
|
||||
if (msgObject && [msgObject isKindOfClass: [SOGoMailObject class]]
|
||||
&& ! [(SOGoMailObject *)msgObject doesMailExist])
|
||||
return nil;
|
||||
if (msgObject && ![msgObject isKindOfClass: NSExceptionK])
|
||||
{
|
||||
[msgObject setContext: [[self userContext] woContext]];
|
||||
@@ -298,6 +305,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
|
||||
if (messageKey)
|
||||
{
|
||||
[[self userContext] activate];
|
||||
if ([[self faiMessageKeys] containsObject: messageKey])
|
||||
{
|
||||
msgObject = [dbFolder lookupName: messageKey
|
||||
@@ -386,7 +394,8 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
withRow: (struct SRow *) aRow
|
||||
andFID: (uint64_t) fid
|
||||
{
|
||||
int rc = MAPISTORE_SUCCESS;
|
||||
BOOL mapped;
|
||||
enum mapistore_error rc = MAPISTORE_SUCCESS;
|
||||
MAPIStoreMapping *mapping;
|
||||
NSString *baseURL, *childURL, *folderKey;
|
||||
MAPIStoreFolder *childFolder;
|
||||
@@ -414,7 +423,12 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
childURL = [NSString stringWithFormat: @"%@%@/",
|
||||
baseURL,
|
||||
[folderKey stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
|
||||
[mapping registerURL: childURL withID: fid];
|
||||
|
||||
mapped = [mapping registerURL: childURL withID: fid];
|
||||
if (!mapped)
|
||||
/* Enforce the creation if the backend does know the fid */
|
||||
[mapping updateURL: childURL withID: fid];
|
||||
|
||||
childFolder = [self lookupFolder: folderKey];
|
||||
if (childFolder)
|
||||
{
|
||||
@@ -433,16 +447,11 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (void) deleteFolderImpl
|
||||
- (int) deleteFolder
|
||||
{
|
||||
// TODO: raise exception in case underlying delete fails?
|
||||
// [propsMessage delete];
|
||||
[dbFolder delete];
|
||||
}
|
||||
|
||||
- (int) deleteFolder
|
||||
{
|
||||
[self deleteFolderImpl];
|
||||
|
||||
[self cleanupCaches];
|
||||
|
||||
@@ -503,6 +512,12 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
else
|
||||
rc = MAPISTORE_ERR_DENIED;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Unregistering from indexing table as the backend says the
|
||||
object was not found */
|
||||
[mapping unregisterURLWithID: mid];
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
@@ -523,6 +538,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
|
||||
context = [self context];
|
||||
ownerUser = [[self userContext] sogoUser];
|
||||
[[self userContext] activate];
|
||||
|
||||
if ([[context activeUser] isEqual: ownerUser]
|
||||
|| (!isAssociated && [self subscriberCanCreateMessages]))
|
||||
@@ -564,12 +580,12 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
NSUInteger count, max;
|
||||
id msgObject;
|
||||
SOGoUser *ownerUser;
|
||||
struct mapistore_connection_info *connInfo;
|
||||
struct mapistore_object_notification_parameters *notif_parameters;
|
||||
int rc;
|
||||
|
||||
/* flags that control the behaviour of the operation
|
||||
(MAPISTORE_SOFT_DELETE or MAPISTORE_PERMANENT_DELETE) */
|
||||
[self logWithFormat: @"-deleteMessageWithMID: mid: 0x%.16llx flags: %d", mid, flags];
|
||||
|
||||
|
||||
mapping = [self mapping];
|
||||
childURL = [mapping urlFromID: mid];
|
||||
if (childURL)
|
||||
@@ -602,51 +618,9 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
}
|
||||
else
|
||||
{
|
||||
if (![message isNew])
|
||||
{
|
||||
/* folder notification */
|
||||
notif_parameters
|
||||
= talloc_zero(NULL,
|
||||
struct mapistore_object_notification_parameters);
|
||||
notif_parameters->object_id = [self objectId];
|
||||
notif_parameters->tag_count = 5;
|
||||
notif_parameters->tags = talloc_array (notif_parameters,
|
||||
enum MAPITAGS, 5);
|
||||
notif_parameters->tags[0] = PR_CONTENT_COUNT;
|
||||
notif_parameters->tags[1] = PR_DELETED_COUNT_TOTAL;
|
||||
notif_parameters->tags[2] = PR_MESSAGE_SIZE;
|
||||
notif_parameters->tags[3] = PR_NORMAL_MESSAGE_SIZE;
|
||||
notif_parameters->tags[4] = PR_DELETED_MSG_COUNT;
|
||||
notif_parameters->new_message_count = true;
|
||||
notif_parameters->message_count = [[self messageKeys]
|
||||
count] - 1;
|
||||
connInfo = [[self context] connectionInfo];
|
||||
mapistore_push_notification (connInfo->mstore_ctx,
|
||||
MAPISTORE_FOLDER,
|
||||
MAPISTORE_OBJECT_MODIFIED,
|
||||
notif_parameters);
|
||||
talloc_free(notif_parameters);
|
||||
|
||||
/* message notification */
|
||||
notif_parameters
|
||||
= talloc_zero(NULL,
|
||||
struct mapistore_object_notification_parameters);
|
||||
notif_parameters->object_id = mid;
|
||||
notif_parameters->folder_id = [self objectId];
|
||||
/* Exchange sends a fnevObjectCreated!! */
|
||||
mapistore_push_notification (connInfo->mstore_ctx,
|
||||
MAPISTORE_MESSAGE,
|
||||
MAPISTORE_OBJECT_CREATED,
|
||||
notif_parameters);
|
||||
talloc_free(notif_parameters);
|
||||
|
||||
/* table notification */
|
||||
for (count = 0; count < max; count++)
|
||||
[[activeTables objectAtIndex: count]
|
||||
notifyChangesForChild: message];
|
||||
}
|
||||
[self logWithFormat: @"successfully deleted object at URL: %@", childURL];
|
||||
[mapping unregisterURLWithID: mid];
|
||||
/* Ensure we are respecting flags parameter */
|
||||
[mapping unregisterURLWithID: mid andFlags: flags];
|
||||
[self cleanupCaches];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
@@ -668,6 +642,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
fromFolder: (MAPIStoreFolder *) sourceFolder
|
||||
withMID: (uint64_t) targetMid
|
||||
andChangeKey: (struct Binary_r *) targetChangeKey
|
||||
andPredecessorChangeList: (struct Binary_r *) targetPredecessorChangeList
|
||||
wantCopy: (uint8_t) wantCopy
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
@@ -676,6 +651,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
//TALLOC_CTX *memCtx;
|
||||
struct SRow aRow;
|
||||
struct SPropValue property;
|
||||
uint8_t deleteFlags;
|
||||
|
||||
[self logWithFormat: @"-moveCopyMessageWithMID: 0x%.16llx .. withMID: 0x%.16llx .. wantCopy: %d", srcMid, targetMid, wantCopy];
|
||||
|
||||
@@ -694,19 +670,24 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
|
||||
[sourceMsg copyToMessage: destMsg inMemCtx: memCtx];
|
||||
|
||||
if (targetChangeKey)
|
||||
if (targetPredecessorChangeList)
|
||||
{
|
||||
property.ulPropTag = PidTagChangeKey;
|
||||
property.value.bin = *targetChangeKey;
|
||||
property.ulPropTag = PidTagPredecessorChangeList;
|
||||
property.value.bin = *targetPredecessorChangeList;
|
||||
aRow.cValues = 1;
|
||||
aRow.lpProps = &property;
|
||||
rc = [destMsg addPropertiesFromRow: &aRow];
|
||||
if (rc != MAPISTORE_SUCCESS)
|
||||
goto end;
|
||||
{
|
||||
[self errorWithFormat: @"Cannot add PredecessorChangeList on move"];
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
[destMsg save: memCtx];
|
||||
if (!wantCopy)
|
||||
rc = [sourceFolder deleteMessageWithMID: srcMid andFlags: 0];
|
||||
/* We want to keep mid for restoring/shared data to work if mids are different. */
|
||||
deleteFlags = (srcMid == targetMid) ? MAPISTORE_PERMANENT_DELETE : MAPISTORE_SOFT_DELETE;
|
||||
rc = [sourceFolder deleteMessageWithMID: srcMid andFlags: deleteFlags];
|
||||
|
||||
end:
|
||||
//talloc_free (memCtx);
|
||||
@@ -719,6 +700,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
fromFolder: (MAPIStoreFolder *) sourceFolder
|
||||
withMIDs: (uint64_t *) targetMids
|
||||
andChangeKeys: (struct Binary_r **) targetChangeKeys
|
||||
andPredecessorChangeLists: (struct Binary_r **) targetPredecessorChangeLists
|
||||
wantCopy: (uint8_t) wantCopy
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
@@ -728,7 +710,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
NSString *oldMessageURL;
|
||||
MAPIStoreMapping *mapping;
|
||||
SOGoUser *ownerUser;
|
||||
struct Binary_r *targetChangeKey;
|
||||
struct Binary_r *targetChangeKey, *targetPredecessorChangeList;
|
||||
//TALLOC_CTX *memCtx;
|
||||
|
||||
//memCtx = talloc_zero (NULL, TALLOC_CTX);
|
||||
@@ -749,14 +731,21 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
if (oldMessageURL)
|
||||
{
|
||||
[oldMessageURLs addObject: oldMessageURL];
|
||||
if (targetChangeKeys)
|
||||
targetChangeKey = targetChangeKeys[count];
|
||||
if (targetChangeKeys && targetPredecessorChangeList)
|
||||
{
|
||||
targetChangeKey = targetChangeKeys[count];
|
||||
targetPredecessorChangeList = targetPredecessorChangeLists[count];
|
||||
}
|
||||
else
|
||||
targetChangeKey = NULL;
|
||||
{
|
||||
targetChangeKey = NULL;
|
||||
targetPredecessorChangeList = NULL;
|
||||
}
|
||||
rc = [self _moveCopyMessageWithMID: srcMids[count]
|
||||
fromFolder: sourceFolder
|
||||
withMID: targetMids[count]
|
||||
andChangeKey: targetChangeKey
|
||||
andPredecessorChangeList: targetPredecessorChangeList
|
||||
wantCopy: wantCopy
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
@@ -767,13 +756,6 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
/* Notifications */
|
||||
if (rc == MAPISTORE_SUCCESS)
|
||||
{
|
||||
[self postNotificationsForMoveCopyMessagesWithMIDs: srcMids
|
||||
andMessageURLs: oldMessageURLs
|
||||
andCount: midCount
|
||||
fromFolder: sourceFolder
|
||||
withMIDs: targetMids
|
||||
wantCopy: wantCopy];
|
||||
|
||||
// We cleanup cache of our source and destination folders
|
||||
[self cleanupCaches];
|
||||
[sourceFolder cleanupCaches];
|
||||
@@ -781,9 +763,9 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
}
|
||||
else
|
||||
rc = MAPISTORE_ERR_DENIED;
|
||||
|
||||
|
||||
//talloc_free (memCtx);
|
||||
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -845,7 +827,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
if (isMove)
|
||||
{
|
||||
fmid = [mapping idFromURL: [message url]];
|
||||
[self deleteMessageWithMID: fmid andFlags: 0];
|
||||
[self deleteMessageWithMID: fmid andFlags: MAPISTORE_PERMANENT_DELETE];
|
||||
[mapping registerURL: [targetMessage url]
|
||||
withID: fmid];
|
||||
}
|
||||
@@ -866,7 +848,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
if (isMove)
|
||||
{
|
||||
fmid = [mapping idFromURL: [message url]];
|
||||
[self deleteMessageWithMID: fmid andFlags: 0];
|
||||
[self deleteMessageWithMID: fmid andFlags: MAPISTORE_PERMANENT_DELETE];
|
||||
[mapping registerURL: [targetMessage url]
|
||||
withID: fmid];
|
||||
}
|
||||
@@ -893,16 +875,23 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
}
|
||||
|
||||
if (isMove)
|
||||
{
|
||||
fmid = [mapping idFromURL: [self url]];
|
||||
[mapping unregisterURLWithID: fmid];
|
||||
[self deleteFolderImpl];
|
||||
[mapping registerURL: [newFolder url]
|
||||
withID: fmid];
|
||||
}
|
||||
[self deleteFolder];
|
||||
|
||||
[targetFolder cleanupCaches];
|
||||
}
|
||||
[self cleanupCaches];
|
||||
|
||||
/* We perform the mapping operations at the
|
||||
end as objectId is required to be available
|
||||
until the caches are cleaned up */
|
||||
if (isMove && rc == MAPISTORE_SUCCESS)
|
||||
{
|
||||
fmid = [mapping idFromURL: [self url]];
|
||||
[mapping unregisterURLWithID: fmid];
|
||||
[mapping registerURL: [newFolder url]
|
||||
withID: fmid];
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
rc = MAPISTORE_ERR_DENIED;
|
||||
@@ -946,7 +935,8 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
NSString *baseURL, *URL, *key;
|
||||
NSArray *newIDs;
|
||||
uint64_t idNbr;
|
||||
|
||||
bool softDeleted;
|
||||
|
||||
baseURL = [self url];
|
||||
|
||||
mapping = [self mapping];
|
||||
@@ -956,8 +946,8 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
{
|
||||
key = [keys objectAtIndex: count];
|
||||
URL = [NSString stringWithFormat: @"%@%@", baseURL, key];
|
||||
idNbr = [mapping idFromURL: URL];
|
||||
if (idNbr == NSNotFound)
|
||||
idNbr = [mapping idFromURL: URL isSoftDeleted: &softDeleted];
|
||||
if (idNbr == NSNotFound && !softDeleted)
|
||||
[missingURLs addObject: URL];
|
||||
}
|
||||
|
||||
@@ -967,113 +957,6 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
withIDs: newIDs];
|
||||
}
|
||||
|
||||
- (void) postNotificationsForMoveCopyMessagesWithMIDs: (uint64_t *) srcMids
|
||||
andMessageURLs: (NSArray *) oldMessageURLs
|
||||
andCount: (uint32_t) midCount
|
||||
fromFolder: (MAPIStoreFolder *) sourceFolder
|
||||
withMIDs: (uint64_t *) targetMids
|
||||
wantCopy: (uint8_t) wantCopy
|
||||
{
|
||||
NSArray *activeTables;
|
||||
NSUInteger count, tableCount, max;
|
||||
MAPIStoreMessage *message;
|
||||
NSString *messageURL;
|
||||
MAPIStoreMapping *mapping;
|
||||
struct mapistore_object_notification_parameters *notif_parameters;
|
||||
struct mapistore_connection_info *connInfo;
|
||||
|
||||
connInfo = [[self context] connectionInfo];
|
||||
|
||||
// For the "source folder, we ensure the table caches are loaded so
|
||||
// that old and new state can be compared
|
||||
activeTables = [sourceFolder activeMessageTables];
|
||||
max = [activeTables count];
|
||||
for (count = 0; count < max; count++)
|
||||
[[activeTables objectAtIndex: count] restrictedChildKeys];
|
||||
|
||||
if (!wantCopy)
|
||||
{
|
||||
// We notify the client. We start with the source folder.
|
||||
notif_parameters = talloc_zero(NULL, struct mapistore_object_notification_parameters);
|
||||
notif_parameters->object_id = [sourceFolder objectId];
|
||||
notif_parameters->tag_count = 5;
|
||||
notif_parameters->tags = talloc_array (notif_parameters, enum MAPITAGS, 5);
|
||||
notif_parameters->tags[0] = PR_CONTENT_COUNT;
|
||||
notif_parameters->tags[1] = PR_DELETED_COUNT_TOTAL;
|
||||
notif_parameters->tags[2] = PR_MESSAGE_SIZE;
|
||||
notif_parameters->tags[3] = PR_NORMAL_MESSAGE_SIZE;
|
||||
notif_parameters->tags[4] = PR_RECIPIENT_ON_NORMAL_MSG_COUNT;
|
||||
notif_parameters->new_message_count = true;
|
||||
notif_parameters->message_count = [[sourceFolder messageKeys] count] - midCount;
|
||||
mapistore_push_notification (connInfo->mstore_ctx,
|
||||
MAPISTORE_FOLDER,
|
||||
MAPISTORE_OBJECT_MODIFIED,
|
||||
notif_parameters);
|
||||
talloc_free(notif_parameters);
|
||||
}
|
||||
|
||||
// move/copy notification of the copied/moved message
|
||||
for (count = 0; count < midCount; count++)
|
||||
{
|
||||
notif_parameters = talloc_zero (NULL, struct mapistore_object_notification_parameters);
|
||||
notif_parameters->tag_count = 0;
|
||||
notif_parameters->new_message_count = true;
|
||||
notif_parameters->message_count = 0;
|
||||
notif_parameters->object_id = targetMids[count];
|
||||
notif_parameters->folder_id = [self objectId];
|
||||
notif_parameters->old_object_id = srcMids[count];
|
||||
notif_parameters->old_folder_id = [sourceFolder objectId];
|
||||
|
||||
mapistore_push_notification (connInfo->mstore_ctx,
|
||||
MAPISTORE_MESSAGE,
|
||||
(wantCopy ? MAPISTORE_OBJECT_COPIED : MAPISTORE_OBJECT_MOVED),
|
||||
notif_parameters);
|
||||
talloc_free (notif_parameters);
|
||||
|
||||
message = [sourceFolder lookupMessageByURL: [oldMessageURLs objectAtIndex: count]];
|
||||
// table notification
|
||||
for (tableCount = 0; tableCount < max; tableCount++)
|
||||
[[activeTables objectAtIndex: tableCount]
|
||||
notifyChangesForChild: message];
|
||||
}
|
||||
|
||||
// For the "destination folder, we ensure the table caches are loaded so
|
||||
// that old and new state can be compared
|
||||
activeTables = [self activeMessageTables];
|
||||
max = [activeTables count];
|
||||
for (count = 0; count < max; count++)
|
||||
[[activeTables objectAtIndex: count] restrictedChildKeys];
|
||||
|
||||
notif_parameters = talloc_zero(NULL, struct mapistore_object_notification_parameters);
|
||||
notif_parameters->object_id = [self objectId];
|
||||
notif_parameters->tag_count = 5;
|
||||
notif_parameters->tags = talloc_array (notif_parameters, enum MAPITAGS, 5);
|
||||
notif_parameters->tags[0] = PR_CONTENT_COUNT;
|
||||
notif_parameters->tags[1] = PR_DELETED_COUNT_TOTAL;
|
||||
notif_parameters->tags[2] = PR_MESSAGE_SIZE;
|
||||
notif_parameters->tags[3] = PR_NORMAL_MESSAGE_SIZE;
|
||||
notif_parameters->tags[4] = PR_RECIPIENT_ON_NORMAL_MSG_COUNT;
|
||||
notif_parameters->new_message_count = true;
|
||||
notif_parameters->message_count = [[self messageKeys] count] + midCount;
|
||||
connInfo = [[self context] connectionInfo];
|
||||
mapistore_push_notification (connInfo->mstore_ctx,
|
||||
MAPISTORE_FOLDER,
|
||||
MAPISTORE_OBJECT_MODIFIED,
|
||||
notif_parameters);
|
||||
talloc_free(notif_parameters);
|
||||
|
||||
// table notification
|
||||
mapping = [self mapping];
|
||||
for (count = 0; count < midCount; count++)
|
||||
{
|
||||
messageURL = [mapping urlFromID: targetMids[count]];
|
||||
message = [self lookupMessageByURL: messageURL];
|
||||
for (tableCount = 0; tableCount < max; tableCount++)
|
||||
[[activeTables objectAtIndex: tableCount]
|
||||
notifyChangesForChild: message];
|
||||
}
|
||||
}
|
||||
|
||||
- (int) getDeletedFMIDs: (struct UI8Array_r **) fmidsPtr
|
||||
andCN: (uint64_t *) cnPtr
|
||||
fromChangeNumber: (uint64_t) changeNum
|
||||
@@ -1088,6 +971,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
MAPIStoreMapping *mapping;
|
||||
struct UI8Array_r *fmids;
|
||||
uint64_t fmid;
|
||||
bool softDeleted;
|
||||
|
||||
keys = [self getDeletedKeysFromChangeNumber: changeNum andCN: &cnNbr
|
||||
inTableType: tableType];
|
||||
@@ -1114,10 +998,10 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
{
|
||||
url = [NSString stringWithFormat: format,
|
||||
baseURL, [keys objectAtIndex: count]];
|
||||
fmid = [mapping idFromURL: url];
|
||||
fmid = [mapping idFromURL: url isSoftDeleted: &softDeleted];
|
||||
if (fmid != NSNotFound) /* if no fmid is returned, then the object
|
||||
"never existed" in the OpenChange
|
||||
databases */
|
||||
databases. Soft-deleted messages are returned back */
|
||||
{
|
||||
fmids->lpui8[fmids->cValues] = fmid;
|
||||
fmids->cValues++;
|
||||
@@ -1181,9 +1065,10 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
{
|
||||
static enum MAPITAGS bannedProps[] = { PR_MID, PR_FID, PR_PARENT_FID,
|
||||
PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY,
|
||||
PR_CHANGE_KEY, 0x00000000 };
|
||||
PR_CHANGE_KEY, PidTagChangeNumber, 0x00000000 };
|
||||
enum MAPITAGS *currentProp;
|
||||
NSMutableDictionary *propsCopy;
|
||||
uint64_t cn;
|
||||
|
||||
/* TODO: this should no longer be required once mapistore v2 API is in
|
||||
place, when we can then do this from -dealloc below */
|
||||
@@ -1201,6 +1086,12 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
}
|
||||
|
||||
[properties addEntriesFromDictionary: propsCopy];
|
||||
|
||||
/* Update change number after setting the properties */
|
||||
cn = [[self context] getNewChangeNumber];
|
||||
[properties setObject: [NSNumber numberWithUnsignedLongLong: cn]
|
||||
forKey: MAPIPropertyKey (PidTagChangeNumber)];
|
||||
|
||||
[dbFolder save];
|
||||
}
|
||||
|
||||
@@ -1226,6 +1117,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
- (NSArray *) faiMessageKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
[[self userContext] activate];
|
||||
return [dbFolder childKeysOfType: MAPIFAICacheObject
|
||||
includeDeleted: NO
|
||||
matchingQualifier: qualifier
|
||||
@@ -1334,7 +1226,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
|
||||
/*
|
||||
Possible values are:
|
||||
|
||||
|
||||
0x00000001 Modify
|
||||
0x00000002 Read
|
||||
0x00000004 Delete
|
||||
@@ -1365,7 +1257,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
access |= 0x10;
|
||||
if (userIsOwner)
|
||||
access |= 0x20;
|
||||
|
||||
|
||||
*data = MAPILongValue (memCtx, access);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
@@ -1394,7 +1286,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
rights |= RightsCreateSubfolders;
|
||||
if (userIsOwner)
|
||||
rights |= RightsFolderOwner | RightsFolderContact;
|
||||
|
||||
|
||||
*data = MAPILongValue (memCtx, rights);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
@@ -1430,7 +1322,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = MAPIBoolValue (memCtx, [self supportsSubFolders] && [[self folderKeys] count] > 0);
|
||||
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1438,7 +1330,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = MAPILongValue (memCtx, [[self folderKeys] count]);
|
||||
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1540,7 +1432,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
[dbObject setIsNew: YES];
|
||||
newMessage = [MAPIStoreFAIMessageK mapiStoreObjectWithSOGoObject: dbObject
|
||||
inContainer: self];
|
||||
|
||||
|
||||
return newMessage;
|
||||
}
|
||||
|
||||
@@ -1549,6 +1441,8 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
MAPIStoreMessage *newMessage;
|
||||
WOContext *woContext;
|
||||
|
||||
[[self userContext] activate];
|
||||
|
||||
if (isAssociated)
|
||||
newMessage = [self _createAssociatedMessage];
|
||||
else
|
||||
@@ -1655,7 +1549,6 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
struct Binary_r bin32;
|
||||
struct AddressBookEntryId *entryId;
|
||||
NSString *username;
|
||||
struct ldb_context *samCtx;
|
||||
|
||||
if (bin && bin->cb)
|
||||
{
|
||||
@@ -1665,8 +1558,8 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
entryId = get_AddressBookEntryId (NULL, &bin32);
|
||||
if (entryId)
|
||||
{
|
||||
samCtx = [[self context] connectionInfo]->sam_ctx;
|
||||
username = MAPIStoreSamDBUserAttribute (samCtx, @"legacyExchangeDN",
|
||||
username = MAPIStoreSamDBUserAttribute ([[self context] connectionInfo],
|
||||
@"legacyExchangeDN",
|
||||
[NSString stringWithUTF8String: entryId->X500DN],
|
||||
@"sAMAccountName");
|
||||
}
|
||||
@@ -1713,10 +1606,12 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
|
||||
aclFolder = [self aclFolder];
|
||||
|
||||
users = [aclFolder aclUsers];
|
||||
users = [[aclFolder aclUsers] copy];
|
||||
max = [users count];
|
||||
for (count = 0; count < max; count++)
|
||||
[aclFolder removeUserFromAcls: [users objectAtIndex: count]];
|
||||
|
||||
[users release];
|
||||
}
|
||||
|
||||
- (int) modifyPermissions: (struct PermissionData *) permissions
|
||||
@@ -1746,7 +1641,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
|
||||
permissionUser = nil;
|
||||
permissionRoles = nil;
|
||||
|
||||
|
||||
if (currentPermission->PermissionDataFlags == ROW_ADD)
|
||||
isAdd = YES;
|
||||
else if (currentPermission->PermissionDataFlags == ROW_MODIFY)
|
||||
@@ -1864,6 +1759,17 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
inFolderURL: [self url]];
|
||||
}
|
||||
|
||||
- (MAPIStoreFolder *) rootContainer
|
||||
{
|
||||
/* Return the oldest ancestor, which does not have
|
||||
container. If there is not container, it returns itself.
|
||||
*/
|
||||
if (container)
|
||||
return [container rootContainer];
|
||||
else
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSDate *) creationTime
|
||||
{
|
||||
return [dbFolder creationDate];
|
||||
@@ -1886,7 +1792,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
return nil;
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray *) getDeletedKeysFromChangeNumber: (uint64_t) changeNum
|
||||
|
||||
@@ -82,7 +82,9 @@
|
||||
andTDBIndexing: indexing];
|
||||
parentFolder = [[userContext rootFolders] objectForKey: moduleName];
|
||||
baseUrl = [NSString stringWithFormat: @"sogo://%@@%@/",
|
||||
userName, moduleName];
|
||||
[userName stringByReplacingOccurrencesOfString: @"@"
|
||||
withString: @"%40"],
|
||||
moduleName];
|
||||
|
||||
subfolders = [parentFolder subFolders];
|
||||
max = [subfolders count];
|
||||
@@ -119,7 +121,6 @@
|
||||
|
||||
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||
andTDBIndexing: NULL];
|
||||
[MAPIApp setUserContext: userContext];
|
||||
moduleName = [self MAPIModuleName];
|
||||
parentFolder = [[userContext rootFolders] objectForKey: moduleName];
|
||||
nameInContainer = nil;
|
||||
@@ -127,10 +128,11 @@
|
||||
if (![parentFolder newFolderWithName: folderName
|
||||
nameInContainer: &nameInContainer])
|
||||
mapistoreURI = [NSString stringWithFormat: @"sogo://%@@%@/%@/",
|
||||
userName, moduleName, nameInContainer];
|
||||
[userName stringByReplacingOccurrencesOfString: @"@"
|
||||
withString: @"%40"],
|
||||
moduleName, nameInContainer];
|
||||
else
|
||||
mapistoreURI = nil;
|
||||
[MAPIApp setUserContext: nil];
|
||||
|
||||
return mapistoreURI;
|
||||
}
|
||||
|
||||
@@ -41,8 +41,10 @@
|
||||
|
||||
/* synchronisation */
|
||||
- (BOOL) synchroniseCache;
|
||||
- (BOOL) synchroniseCacheFor: (NSString *) nameInContainer;
|
||||
- (void) updateVersionsForMessageWithKey: (NSString *) messageKey
|
||||
withChangeKey: (NSData *) newChangeKey;
|
||||
withChangeKey: (NSData *) oldChangeKey
|
||||
andPredecessorChangeList: (NSData *) pcl;
|
||||
- (NSNumber *) lastModifiedFromMessageChangeNumber: (NSString *) changeNumber;
|
||||
- (NSString *) changeNumberForMessageWithKey: (NSString *) messageKey;
|
||||
- (NSData *) changeKeyForMessageWithKey: (NSString *) messageKey;
|
||||
|
||||
+197
-21
@@ -75,6 +75,7 @@ static Class NSNumberK;
|
||||
[SOGoMAPIDBMessage objectWithName: @"versions.plist"
|
||||
inContainer: dbFolder]);
|
||||
[versionsMessage setObjectType: MAPIInternalCacheObject];
|
||||
[versionsMessage reloadIfNeeded];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
@@ -261,7 +262,6 @@ static Class NSNumberK;
|
||||
*/
|
||||
- (void) _setChangeKey: (NSData *) changeKey
|
||||
forMessageEntry: (NSMutableDictionary *) messageEntry
|
||||
inChangeListOnly: (BOOL) inChangeListOnly
|
||||
{
|
||||
struct XID *xid;
|
||||
NSString *guid;
|
||||
@@ -270,19 +270,15 @@ static Class NSNumberK;
|
||||
NSMutableDictionary *changeList;
|
||||
|
||||
xid = [changeKey asXIDInMemCtx: NULL];
|
||||
guid = [NSString stringWithGUID: &xid->GUID];
|
||||
globCnt = [NSData dataWithBytes: xid->Data length: xid->Size];
|
||||
guid = [NSString stringWithGUID: &xid->NameSpaceGuid];
|
||||
globCnt = [NSData dataWithBytes: xid->LocalId.data length: xid->LocalId.length];
|
||||
talloc_free (xid);
|
||||
|
||||
if (!inChangeListOnly)
|
||||
{
|
||||
/* 1. set change key association */
|
||||
changeKeyDict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
guid, @"GUID",
|
||||
globCnt, @"LocalId",
|
||||
nil];
|
||||
[messageEntry setObject: changeKeyDict forKey: @"ChangeKey"];
|
||||
}
|
||||
/* 1. set change key association */
|
||||
changeKeyDict = [NSDictionary dictionaryWithObjectsAndKeys: guid, @"GUID",
|
||||
globCnt, @"LocalId",
|
||||
nil];
|
||||
[messageEntry setObject: changeKeyDict forKey: @"ChangeKey"];
|
||||
|
||||
/* 2. append/update predecessor change list */
|
||||
changeList = [messageEntry objectForKey: @"PredecessorChangeList"];
|
||||
@@ -296,6 +292,77 @@ static Class NSNumberK;
|
||||
[changeList setObject: globCnt forKey: guid];
|
||||
}
|
||||
|
||||
- (void) _updatePredecessorChangeList: (NSData *) predecessorChangeList
|
||||
forMessageEntry: (NSMutableDictionary *) messageEntry
|
||||
withOldChangeKey: (NSData *) oldChangeKey
|
||||
{
|
||||
NSData *globCnt, *oldGlobCnt;
|
||||
NSDictionary *changeKeyDict;
|
||||
NSString *guid;
|
||||
NSMutableDictionary *changeList;
|
||||
struct SizedXid *sizedXIDList;
|
||||
struct XID xid, *givenChangeKey;
|
||||
TALLOC_CTX *localMemCtx;
|
||||
uint32_t i, length;
|
||||
|
||||
localMemCtx = talloc_new (NULL);
|
||||
if (!localMemCtx)
|
||||
{
|
||||
[self errorWithFormat: @"No more memory"];
|
||||
return;
|
||||
}
|
||||
|
||||
if (predecessorChangeList)
|
||||
{
|
||||
sizedXIDList = [predecessorChangeList asSizedXidArrayInMemCtx: localMemCtx with: &length];
|
||||
|
||||
changeList = [messageEntry objectForKey: @"PredecessorChangeList"];
|
||||
if (!changeList)
|
||||
{
|
||||
changeList = [NSMutableDictionary new];
|
||||
[messageEntry setObject: changeList
|
||||
forKey: @"PredecessorChangeList"];
|
||||
[changeList release];
|
||||
}
|
||||
|
||||
if (sizedXIDList) {
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
xid = sizedXIDList[i].XID;
|
||||
guid = [NSString stringWithGUID: &xid.NameSpaceGuid];
|
||||
globCnt = [NSData dataWithBytes: xid.LocalId.data length: xid.LocalId.length];
|
||||
oldGlobCnt = [changeList objectForKey: guid];
|
||||
if (!oldGlobCnt || ([globCnt compare: oldGlobCnt] == NSOrderedDescending))
|
||||
[changeList setObject: globCnt forKey: guid];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (oldChangeKey)
|
||||
{
|
||||
givenChangeKey = [oldChangeKey asXIDInMemCtx: localMemCtx];
|
||||
if (givenChangeKey) {
|
||||
guid = [NSString stringWithGUID: &givenChangeKey->NameSpaceGuid];
|
||||
globCnt = [NSData dataWithBytes: givenChangeKey->LocalId.data length: givenChangeKey->LocalId.length];
|
||||
|
||||
changeKeyDict = [messageEntry objectForKey: @"ChangeKey"];
|
||||
if (!changeKeyDict ||
|
||||
([guid isEqualToString: [changeKeyDict objectForKey: @"GUID"]]
|
||||
&& ([globCnt compare: [changeKeyDict objectForKey: @"LocalId"]] == NSOrderedDescending)))
|
||||
{
|
||||
/* The given change key is greater than current one stored in
|
||||
metadata or it does not exist */
|
||||
[messageEntry setObject: [NSDictionary dictionaryWithObjectsAndKeys: guid, @"GUID",
|
||||
globCnt, @"LocalId",
|
||||
nil]
|
||||
forKey: @"ChangeKey"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
talloc_free (localMemCtx);
|
||||
}
|
||||
|
||||
- (EOQualifier *) componentQualifier
|
||||
{
|
||||
if (!componentQualifier)
|
||||
@@ -465,8 +532,7 @@ static Class NSNumberK;
|
||||
// A GLOBCNT structure is a 6-byte global namespace counter,
|
||||
// we strip the first 2 bytes. The first two bytes is the ReplicaId
|
||||
changeKey = [self getReplicaKeyFromGlobCnt: newChangeNum >> 16];
|
||||
[self _setChangeKey: changeKey forMessageEntry: messageEntry
|
||||
inChangeListOnly: NO];
|
||||
[self _setChangeKey: changeKey forMessageEntry: messageEntry];
|
||||
}
|
||||
|
||||
now = [NSCalendarDate date];
|
||||
@@ -482,13 +548,123 @@ static Class NSNumberK;
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (BOOL) synchroniseCacheFor: (NSString *) nameInContainer
|
||||
{
|
||||
/* Try to synchronise old messages in versions.plist cache using an
|
||||
specific c_name. It returns a boolean indicating if the
|
||||
synchronisation was carried out succesfully.
|
||||
|
||||
It should be used as last resort, keeping synchroniseCache as the
|
||||
main sync entry point. */
|
||||
|
||||
uint64_t changeNumber;
|
||||
NSString *changeNumberStr;
|
||||
NSData *changeKey;
|
||||
NSNumber *cLastModified, *cDeleted, *cVersion;
|
||||
EOFetchSpecification *fs;
|
||||
EOQualifier *searchQualifier, *fetchQualifier;
|
||||
NSArray *fetchResults;
|
||||
NSDictionary *result;
|
||||
NSMutableDictionary *currentProperties, *messages, *mapping, *messageEntry;
|
||||
GCSFolder *ocsFolder;
|
||||
static NSArray *fields;
|
||||
|
||||
[versionsMessage reloadIfNeeded];
|
||||
currentProperties = [versionsMessage properties];
|
||||
|
||||
messages = [currentProperties objectForKey: @"Messages"];
|
||||
if (!messages)
|
||||
{
|
||||
messages = [NSMutableDictionary new];
|
||||
[currentProperties setObject: messages forKey: @"Messages"];
|
||||
[messages release];
|
||||
}
|
||||
|
||||
messageEntry = [messages objectForKey: nameInContainer];
|
||||
if (!messageEntry)
|
||||
{
|
||||
/* Fetch the message by its name */
|
||||
if (!fields)
|
||||
fields = [[NSArray alloc]
|
||||
initWithObjects: @"c_name", @"c_version", @"c_lastmodified",
|
||||
@"c_deleted", nil];
|
||||
|
||||
searchQualifier = [[EOKeyValueQualifier alloc] initWithKey: @"c_name"
|
||||
operatorSelector: EOQualifierOperatorEqual
|
||||
value: nameInContainer];
|
||||
fetchQualifier = [[EOAndQualifier alloc]
|
||||
initWithQualifiers: searchQualifier,
|
||||
[self contentComponentQualifier],
|
||||
nil];
|
||||
[fetchQualifier autorelease];
|
||||
[searchQualifier release];
|
||||
|
||||
ocsFolder = [sogoObject ocsFolder];
|
||||
fs = [EOFetchSpecification
|
||||
fetchSpecificationWithEntityName: [ocsFolder folderName]
|
||||
qualifier: fetchQualifier
|
||||
sortOrderings: nil];
|
||||
fetchResults = [ocsFolder fetchFields: fields
|
||||
fetchSpecification: fs
|
||||
ignoreDeleted: NO];
|
||||
|
||||
if ([fetchResults count] == 1)
|
||||
{
|
||||
result = [fetchResults objectAtIndex: 0];
|
||||
cLastModified = [result objectForKey: @"c_lastmodified"];
|
||||
cDeleted = [result objectForKey: @"c_deleted"];
|
||||
if ([cDeleted isKindOfClass: NSNumberK] && [cDeleted intValue])
|
||||
cVersion = [NSNumber numberWithInt: -1];
|
||||
else
|
||||
cVersion = [result objectForKey: @"c_version"];
|
||||
|
||||
changeNumber = [[self context] getNewChangeNumber];
|
||||
changeNumberStr = [NSString stringWithUnsignedLongLong: changeNumber];
|
||||
|
||||
/* Create new message entry in Messages dict */
|
||||
messageEntry = [NSMutableDictionary new];
|
||||
[messages setObject: messageEntry forKey: nameInContainer];
|
||||
[messageEntry release];
|
||||
|
||||
/* Store cLastModified, cVersion and the change number */
|
||||
[messageEntry setObject: cLastModified forKey: @"c_lastmodified"];
|
||||
[messageEntry setObject: cVersion forKey: @"c_version"];
|
||||
[messageEntry setObject: changeNumberStr forKey: @"version"];
|
||||
|
||||
/* Store the change key */
|
||||
changeKey = [self getReplicaKeyFromGlobCnt: changeNumber >> 16];
|
||||
[self _setChangeKey: changeKey forMessageEntry: messageEntry];
|
||||
|
||||
/* Store the changeNumber -> cLastModified mapping */
|
||||
mapping = [currentProperties objectForKey: @"VersionMapping"];
|
||||
if (!mapping)
|
||||
{
|
||||
mapping = [NSMutableDictionary new];
|
||||
[currentProperties setObject: mapping forKey: @"VersionMapping"];
|
||||
[mapping release];
|
||||
}
|
||||
[mapping setObject: cLastModified forKey: changeNumberStr];
|
||||
|
||||
/* Save the message */
|
||||
[versionsMessage save];
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
||||
/* If message entry exists, then synchroniseCache did its job */
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) updateVersionsForMessageWithKey: (NSString *) messageKey
|
||||
withChangeKey: (NSData *) newChangeKey
|
||||
withChangeKey: (NSData *) oldChangeKey
|
||||
andPredecessorChangeList: (NSData *) pcl
|
||||
{
|
||||
NSMutableDictionary *messages, *messageEntry;
|
||||
|
||||
[self synchroniseCache];
|
||||
if (newChangeKey)
|
||||
if (oldChangeKey || pcl)
|
||||
{
|
||||
messages = [[versionsMessage properties] objectForKey: @"Messages"];
|
||||
messageEntry = [messages objectForKey: messageKey];
|
||||
@@ -496,8 +672,8 @@ static Class NSNumberK;
|
||||
[NSException raise: @"MAPIStoreIOException"
|
||||
format: @"no version record found for message '%@'",
|
||||
messageKey];
|
||||
[self _setChangeKey: newChangeKey forMessageEntry: messageEntry
|
||||
inChangeListOnly: YES];
|
||||
[self _updatePredecessorChangeList: pcl forMessageEntry: messageEntry
|
||||
withOldChangeKey: oldChangeKey];
|
||||
[versionsMessage save];
|
||||
}
|
||||
}
|
||||
@@ -505,12 +681,12 @@ static Class NSNumberK;
|
||||
- (NSNumber *) lastModifiedFromMessageChangeNumber: (NSString *) changeNumber
|
||||
{
|
||||
NSDictionary *mapping;
|
||||
NSNumber *modseq;
|
||||
NSNumber *lastModified;
|
||||
|
||||
mapping = [[versionsMessage properties] objectForKey: @"VersionMapping"];
|
||||
modseq = [mapping objectForKey: changeNumber];
|
||||
lastModified = [mapping objectForKey: changeNumber];
|
||||
|
||||
return modseq;
|
||||
return lastModified;
|
||||
}
|
||||
|
||||
- (NSString *) changeNumberForMessageWithKey: (NSString *) messageKey
|
||||
|
||||
@@ -140,9 +140,16 @@
|
||||
[parentFolder synchroniseCache];
|
||||
changeKey = [parentFolder changeKeyForMessageWithKey: nameInContainer];
|
||||
}
|
||||
if (!changeKey)
|
||||
abort ();
|
||||
*data = [changeKey asBinaryInMemCtx: memCtx];
|
||||
if (changeKey)
|
||||
*data = [changeKey asBinaryInMemCtx: memCtx];
|
||||
else
|
||||
{
|
||||
[self warnWithFormat: @"No change key for %@ in folder %@",
|
||||
nameInContainer,
|
||||
[parentFolder url]
|
||||
];
|
||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
@@ -180,7 +187,8 @@
|
||||
{
|
||||
uint64_t version = ULLONG_MAX;
|
||||
NSString *changeNumber;
|
||||
|
||||
BOOL synced;
|
||||
|
||||
if (!isNew)
|
||||
{
|
||||
changeNumber = [(MAPIStoreGCSFolder *) container
|
||||
@@ -189,16 +197,28 @@
|
||||
{
|
||||
[self warnWithFormat: @"attempting to get change number"
|
||||
@" by synchronising folder..."];
|
||||
[(MAPIStoreGCSFolder *) container synchroniseCache];
|
||||
changeNumber = [(MAPIStoreGCSFolder *) container
|
||||
changeNumberForMessageWithKey: [self nameInContainer]];
|
||||
|
||||
if (changeNumber)
|
||||
[self logWithFormat: @"got one"];
|
||||
else
|
||||
synced = [(MAPIStoreGCSFolder *) container synchroniseCache];
|
||||
if (synced)
|
||||
{
|
||||
[self errorWithFormat: @"still nothing. We crash!"];
|
||||
abort();
|
||||
changeNumber = [(MAPIStoreGCSFolder *) container
|
||||
changeNumberForMessageWithKey: [self nameInContainer]];
|
||||
}
|
||||
if (!changeNumber)
|
||||
{
|
||||
[self warnWithFormat: @"attempting to get change number"
|
||||
@" by synchronising this specific message..."];
|
||||
synced = [(MAPIStoreGCSFolder *) container
|
||||
synchroniseCacheFor: [self nameInContainer]];
|
||||
if (synced)
|
||||
{
|
||||
changeNumber = [(MAPIStoreGCSFolder *) container
|
||||
changeNumberForMessageWithKey: [self nameInContainer]];
|
||||
}
|
||||
if (!changeNumber)
|
||||
{
|
||||
[self errorWithFormat: @"still nothing. We crash!"];
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
version = [changeNumber unsignedLongLongValue] >> 16;
|
||||
@@ -209,13 +229,16 @@
|
||||
|
||||
- (void) updateVersions
|
||||
{
|
||||
NSData *newChangeKey;
|
||||
/* Update ChangeKey and PredecessorChangeList on message's save */
|
||||
NSData *newChangeKey, *predecessorChangeList;
|
||||
|
||||
newChangeKey = [properties objectForKey: MAPIPropertyKey (PR_CHANGE_KEY)];
|
||||
predecessorChangeList = [properties objectForKey: MAPIPropertyKey (PR_PREDECESSOR_CHANGE_LIST)];
|
||||
|
||||
[(MAPIStoreGCSFolder *) container
|
||||
updateVersionsForMessageWithKey: [self nameInContainer]
|
||||
withChangeKey: newChangeKey];
|
||||
updateVersionsForMessageWithKey: [self nameInContainer]
|
||||
withChangeKey: newChangeKey
|
||||
andPredecessorChangeList: predecessorChangeList];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -27,6 +27,7 @@
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <NGExtensions/NSObject+Values.h>
|
||||
|
||||
#import <EOControl/EOFetchSpecification.h>
|
||||
#import <EOControl/EOQualifier.h>
|
||||
@@ -38,7 +39,6 @@
|
||||
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "MAPIStoreGCSFolder.h"
|
||||
|
||||
#import "MAPIStoreGCSMessageTable.h"
|
||||
|
||||
#undef DEBUG
|
||||
@@ -89,21 +89,31 @@
|
||||
|
||||
if (res->ulPropTag == PidTagChangeNumber)
|
||||
{
|
||||
NSString *changeNumber;
|
||||
|
||||
value = NSObjectFromMAPISPropValue (&res->lpProp);
|
||||
changeNumber = [NSString stringWithUnsignedLongLong: [(NSNumber *)value unsignedLongLongValue]];
|
||||
lastModified = [(MAPIStoreGCSFolder *)
|
||||
container lastModifiedFromMessageChangeNumber: value];
|
||||
container lastModifiedFromMessageChangeNumber: changeNumber];
|
||||
//[self logWithFormat: @"change number from oxcfxics: %.16lx", [value unsignedLongLongValue]];
|
||||
//[self logWithFormat: @" c_lastmodified: %@", lastModified];
|
||||
if (lastModified)
|
||||
{
|
||||
SEL operator;
|
||||
|
||||
operator = [self operatorFromRestrictionOperator: res->relop];
|
||||
*qualifier = [[EOKeyValueQualifier alloc] initWithKey: @"c_lastmodified"
|
||||
operatorSelector: EOQualifierOperatorGreaterThanOrEqualTo
|
||||
operatorSelector: operator
|
||||
value: lastModified];
|
||||
[*qualifier autorelease];
|
||||
rc = MAPIRestrictionStateNeedsEval;
|
||||
}
|
||||
else
|
||||
rc = MAPIRestrictionStateAlwaysTrue;
|
||||
{
|
||||
[self logWithFormat: @"No last modified found for: 0x%.16"PRIx64". Then no restriction applied",
|
||||
[value unsignedLongLongValue]];
|
||||
rc = MAPIRestrictionStateAlwaysTrue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#import <SOGo/NSArray+Utilities.h>
|
||||
#import <Mailer/SOGoMailBodyPart.h>
|
||||
#import <Mailer/SOGoMailObject.h>
|
||||
#import <Mailer/NSDictionary+Mail.h>
|
||||
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "MAPIStoreMailMessage.h"
|
||||
@@ -108,7 +109,7 @@
|
||||
static char recordBytes[] = {0xd9, 0xd8, 0x11, 0xa3, 0xe2, 0x90, 0x18, 0x41,
|
||||
0x9e, 0x04, 0x58, 0x46, 0x9d, 0x6d, 0x1b,
|
||||
0x68};
|
||||
|
||||
|
||||
*data = [[NSData dataWithBytes: recordBytes length: 16]
|
||||
asBinaryInMemCtx: memCtx];
|
||||
|
||||
@@ -117,19 +118,7 @@
|
||||
|
||||
- (NSString *) _fileName
|
||||
{
|
||||
NSString *fileName;
|
||||
NSDictionary *parameters;
|
||||
|
||||
fileName = [[bodyInfo objectForKey: @"parameterList"]
|
||||
objectForKey: @"name"];
|
||||
if (!fileName)
|
||||
{
|
||||
parameters = [[bodyInfo objectForKey: @"disposition"]
|
||||
objectForKey: @"parameterList"];
|
||||
fileName = [parameters objectForKey: @"filename"];
|
||||
}
|
||||
|
||||
return fileName;
|
||||
return [bodyInfo filename];
|
||||
}
|
||||
|
||||
- (int) getPidTagAttachLongFilename: (void **) data
|
||||
@@ -163,15 +152,22 @@
|
||||
- (int) getPidTagDisplayName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = [[bodyInfo objectForKey: @"description"]
|
||||
asUnicodeInMemCtx: memCtx];
|
||||
NSString *fileName;
|
||||
|
||||
fileName = [self _fileName];
|
||||
if ([fileName isEqualToString: @"sharing_metadata.xml"])
|
||||
/* Required to disallow user from seeing the attachment by default */
|
||||
*data = [@"sharing_metadata.xml" asUnicodeInMemCtx: memCtx];
|
||||
else
|
||||
*data = [[bodyInfo objectForKey: @"description"]
|
||||
asUnicodeInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getPidTagAttachContentId: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
{
|
||||
*data = [[bodyInfo objectForKey: @"bodyId"]
|
||||
asUnicodeInMemCtx: memCtx];
|
||||
|
||||
@@ -181,11 +177,17 @@
|
||||
- (int) getPidTagAttachMimeTag: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
NSString *mimeTag;
|
||||
NSString *mimeTag, *fileName;
|
||||
|
||||
fileName = [self _fileName];
|
||||
if ([fileName isEqualToString: @"sharing_metadata.xml"])
|
||||
/* Required by [MS-OXWSMSHR] Section 3.1.1 */
|
||||
mimeTag = [NSString stringWithFormat: @"application/x-sharing-metadata-xml"];
|
||||
else
|
||||
mimeTag = [NSString stringWithFormat: @"%@/%@",
|
||||
[bodyInfo objectForKey: @"type"],
|
||||
[bodyInfo objectForKey: @"subtype"]];
|
||||
|
||||
mimeTag = [NSString stringWithFormat: @"%@/%@",
|
||||
[bodyInfo objectForKey: @"type"],
|
||||
[bodyInfo objectForKey: @"subtype"]];
|
||||
*data = [[mimeTag lowercaseString] asUnicodeInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
|
||||
@@ -67,7 +67,7 @@ MakeDisplayFolderName (NSString *folderName)
|
||||
NSArray *parts;
|
||||
NSString *lastFolder;
|
||||
NSUInteger max;
|
||||
|
||||
|
||||
parts = [folderName componentsSeparatedByString: @"/"];
|
||||
max = [parts count];
|
||||
if (max > 1)
|
||||
@@ -87,7 +87,7 @@ MakeDisplayFolderName (NSString *folderName)
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
struct mapistore_contexts_list *firstContext = NULL, *context;
|
||||
NSString *urlBase, *stringData, *currentName, *inboxName, *draftsName, *sentName, *trashName;
|
||||
NSString *urlBase, *stringData, *currentName, *realName, *inboxName, *draftsName, *sentName, *trashName;
|
||||
NSArray *unprefixedFolders;
|
||||
NSMutableArray *secondaryFolders;
|
||||
enum mapistore_context_role role[] = {MAPISTORE_MAIL_ROLE,
|
||||
@@ -126,7 +126,11 @@ MakeDisplayFolderName (NSString *folderName)
|
||||
trashName = [NSString stringWithFormat: @"folder%@",
|
||||
[unprefixedFolders componentsJoinedByString: @"/folder"]];
|
||||
|
||||
urlBase = [NSString stringWithFormat: @"sogo://%@:%@@mail/", userName, userName];
|
||||
urlBase = [NSString stringWithFormat: @"sogo://%@:%@@mail/",
|
||||
[userName stringByReplacingOccurrencesOfString: @"@"
|
||||
withString: @"%40"],
|
||||
[userName stringByReplacingOccurrencesOfString: @"@"
|
||||
withString: @"%40"]];
|
||||
for (count = 0; count < 3; count++)
|
||||
{
|
||||
context = talloc_zero (memCtx, struct mapistore_contexts_list);
|
||||
@@ -142,6 +146,9 @@ MakeDisplayFolderName (NSString *folderName)
|
||||
DLIST_ADD_END (firstContext, context, void);
|
||||
}
|
||||
|
||||
/* FIXME: Flush any cache before retrieving the hierarchy */
|
||||
[accountFolder flushMailCaches];
|
||||
|
||||
secondaryFolders = [[accountFolder toManyRelationshipKeysWithNamespaces: NO]
|
||||
mutableCopy];
|
||||
[secondaryFolders autorelease];
|
||||
@@ -153,12 +160,25 @@ MakeDisplayFolderName (NSString *folderName)
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
context = talloc_zero (memCtx, struct mapistore_contexts_list);
|
||||
// secondaryFolders has the names (1) Imap4Encoded ,(2) asCSSIdentifier and (3) "folder"-prefixed
|
||||
// e.g.: folderProbl&AOg-mes_SP_de_SP_synchronisation
|
||||
currentName = [secondaryFolders objectAtIndex: count];
|
||||
stringData = [NSString stringWithFormat: @"%@%@",
|
||||
urlBase, [currentName stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
|
||||
context->url = [stringData asUnicodeInMemCtx: context];
|
||||
stringData = [[[currentName substringFromIndex: 6] fromCSSIdentifier] stringByDecodingImap4FolderName];
|
||||
context->name = [stringData asUnicodeInMemCtx: context];
|
||||
// To get the real name we have to revert that (applying the decode functions
|
||||
// in reverse order)
|
||||
// e.g.: Problèmes de synchronisation
|
||||
realName = [[[currentName substringFromIndex: 6]
|
||||
fromCSSIdentifier]
|
||||
stringByDecodingImap4FolderName];
|
||||
// And finally to represent that as URI we have to (1) asCSSIdentifier,
|
||||
// (2) Imap4Encode (3) AddPercentEscapes and (4) add the "folder" prefix
|
||||
// e.g.: folderProbl&AOg-mes_SP_de_SP_synchronisation
|
||||
// In the example there are no percent escapes added because is already ok
|
||||
stringData = [[[realName asCSSIdentifier]
|
||||
stringByEncodingImap4FolderName]
|
||||
stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
||||
stringData = [NSString stringWithFormat: @"folder%@", stringData];
|
||||
context->url = [[NSString stringWithFormat: @"%@%@", urlBase, stringData] asUnicodeInMemCtx: context];
|
||||
context->name = [realName asUnicodeInMemCtx: context];
|
||||
context->main_folder = false;
|
||||
context->role = MAPISTORE_MAIL_ROLE;
|
||||
context->tag = "tag";
|
||||
@@ -180,19 +200,20 @@ MakeDisplayFolderName (NSString *folderName)
|
||||
|
||||
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||
andTDBIndexing: NULL];
|
||||
[MAPIApp setUserContext: userContext];
|
||||
accountFolder = [[userContext rootFolders] objectForKey: @"mail"];
|
||||
folderName = [NSString stringWithFormat: @"folder%@",
|
||||
[newFolderName asCSSIdentifier]];
|
||||
[[newFolderName stringByEncodingImap4FolderName] asCSSIdentifier]];
|
||||
newFolder = [SOGoMailFolder objectWithName: folderName
|
||||
inContainer: accountFolder];
|
||||
if ([newFolder create])
|
||||
mapistoreURI = [NSString stringWithFormat: @"sogo://%@:%@@mail/%@/",
|
||||
userName, userName,
|
||||
[[folderName stringByEncodingImap4FolderName] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
|
||||
[userName stringByReplacingOccurrencesOfString: @"@"
|
||||
withString: @"%40"],
|
||||
[userName stringByReplacingOccurrencesOfString: @"@"
|
||||
withString: @"%40"],
|
||||
[folderName stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
|
||||
else
|
||||
mapistoreURI = nil;
|
||||
[MAPIApp setUserContext: nil];
|
||||
|
||||
return mapistoreURI;
|
||||
}
|
||||
@@ -264,8 +285,12 @@ MakeDisplayFolderName (NSString *folderName)
|
||||
componentsSeparatedByString: @"/"];
|
||||
folderName = [NSString stringWithFormat: @"folder%@",
|
||||
[unprefixedFolders componentsJoinedByString: @"/folder"]];
|
||||
url = [NSString stringWithFormat: @"sogo://%@:%@@outbox/%@", userName,
|
||||
userName, folderName];
|
||||
url = [NSString stringWithFormat: @"sogo://%@:%@@outbox/%@",
|
||||
[userName stringByReplacingOccurrencesOfString: @"@"
|
||||
withString: @"%40"],
|
||||
[userName stringByReplacingOccurrencesOfString: @"@"
|
||||
withString: @"%40"],
|
||||
folderName];
|
||||
|
||||
context = talloc_zero (memCtx, struct mapistore_contexts_list);
|
||||
context->url = [url asUnicodeInMemCtx: context];
|
||||
|
||||
@@ -44,14 +44,24 @@
|
||||
|
||||
/* synchronisation & versioning */
|
||||
- (BOOL) synchroniseCache;
|
||||
- (void) synchronizeUpdatedFolder: (NSNumber *) lastModseq
|
||||
withMapping: (NSMutableDictionary *) mapping;
|
||||
- (BOOL) synchroniseCacheForUID: (NSString *) messageUID;
|
||||
- (NSNumber *) modseqFromMessageChangeNumber: (NSString *) changeNum;
|
||||
- (NSString *) messageUIDFromMessageKey: (NSString *) messageKey;
|
||||
- (NSString *) changeNumberForMessageUID: (NSString *) messageUid;
|
||||
- (void) setChangeKey: (NSData *) changeKey
|
||||
forMessageWithKey: (NSString *) messageKey;
|
||||
- (BOOL) updatePredecessorChangeListWith: (NSData *) changeKey
|
||||
forMessageWithKey: (NSString *) messageKey;
|
||||
- (NSData *) changeKeyForMessageWithKey: (NSString *) messageKey;
|
||||
- (NSData *) predecessorChangeListForMessageWithKey: (NSString *) messageKey;
|
||||
|
||||
/* Extra properties from mail messages that already hit the server */
|
||||
- (void) setExtraProperties: (NSDictionary *) props
|
||||
forMessage: (NSString *) messageKey;
|
||||
- (NSDictionary *) extraPropertiesForMessage: (NSString *) messageKey;
|
||||
|
||||
@end
|
||||
|
||||
/* MAPIStoreOutboxFolder is a special subclass of MAPIStoreMailFolder where
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,31 @@
|
||||
/* MAPIStoreMailFolderTable.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2015 Enrique J. Hernández
|
||||
*
|
||||
* Author: Enrique J. Hernández <ejhernandez@zentyal.com>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef MAPISTOREMAILFOLDERTABLE_H
|
||||
#define MAPISTOREMAILFOLDERTABLE_H
|
||||
|
||||
#import "MAPIStoreFolderTable.h"
|
||||
|
||||
@interface MAPIStoreMailFolderTable : MAPIStoreFolderTable
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREMAILFOLDERTABLE_H */
|
||||
@@ -0,0 +1,42 @@
|
||||
/* MAPIStoreMailFolderTable.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2015 Enrique J. Hernández
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import "MAPIStoreMailFolderTable.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
|
||||
@implementation MAPIStoreMailFolderTable
|
||||
|
||||
- (NSString *) backendIdentifierForProperty: (enum MAPITAGS) property
|
||||
{
|
||||
switch(property)
|
||||
{
|
||||
case PR_DISPLAY_NAME:
|
||||
case PR_DISPLAY_NAME_UNICODE:
|
||||
return @"name";
|
||||
default:
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
{
|
||||
BOOL headerSetup;
|
||||
BOOL mailIsEvent;
|
||||
BOOL mailIsMeetingRequest;
|
||||
BOOL mailIsSharingObject;
|
||||
NSString *mimeKey;
|
||||
NSString *headerCharset;
|
||||
NSString *headerEncoding;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#import <NGImap4/NGImap4EnvelopeAddress.h>
|
||||
#import <NGMail/NGMailAddress.h>
|
||||
#import <NGMail/NGMailAddressParser.h>
|
||||
#import <NGMail/NGMimeMessageGenerator.h>
|
||||
#import <NGCards/iCalCalendar.h>
|
||||
#import <SOGo/NSArray+Utilities.h>
|
||||
#import <SOGo/NSString+Utilities.h>
|
||||
@@ -39,7 +40,9 @@
|
||||
#import <Mailer/NSData+Mail.h>
|
||||
#import <Mailer/SOGoMailBodyPart.h>
|
||||
#import <Mailer/SOGoMailObject.h>
|
||||
#import <Mailer/NSDictionary+Mail.h>
|
||||
|
||||
#import "Codepages.h"
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSObject+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
@@ -50,6 +53,7 @@
|
||||
#import "MAPIStoreMailFolder.h"
|
||||
#import "MAPIStoreMapping.h"
|
||||
#import "MAPIStoreSamDBUtils.h"
|
||||
#import "MAPIStoreSharingMessage.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
|
||||
@@ -63,7 +67,7 @@
|
||||
|
||||
@class iCalCalendar, iCalEvent;
|
||||
|
||||
static Class NSExceptionK;
|
||||
static Class NSExceptionK, MAPIStoreSharingMessageK;
|
||||
|
||||
@interface NSString (MAPIStoreMIME)
|
||||
|
||||
@@ -106,6 +110,7 @@ static Class NSExceptionK;
|
||||
+ (void) initialize
|
||||
{
|
||||
NSExceptionK = [NSException class];
|
||||
MAPIStoreSharingMessageK = [MAPIStoreSharingMessage class];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
@@ -114,6 +119,8 @@ static Class NSExceptionK;
|
||||
{
|
||||
mimeKey = nil;
|
||||
mailIsEvent = NO;
|
||||
mailIsMeetingRequest = NO;
|
||||
mailIsSharingObject = NO;
|
||||
headerCharset = nil;
|
||||
headerEncoding = nil;
|
||||
headerMimeType = nil;
|
||||
@@ -132,6 +139,7 @@ static Class NSExceptionK;
|
||||
[bodyContent release];
|
||||
[headerMimeType release];
|
||||
[headerCharset release];
|
||||
[headerEncoding release];
|
||||
[appointmentWrapper release];
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -151,6 +159,30 @@ static Class NSExceptionK;
|
||||
return [sogoObject date];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getAvailableProperties: (struct SPropTagArray **) propertiesP
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
BOOL listedProperties[65536];
|
||||
NSUInteger count;
|
||||
uint16_t propId;
|
||||
|
||||
if (mailIsSharingObject)
|
||||
{
|
||||
memset (listedProperties, NO, 65536 * sizeof (BOOL));
|
||||
[super getAvailableProperties: propertiesP inMemCtx: memCtx];
|
||||
for (count = 0; count < (*propertiesP)->cValues; count++)
|
||||
{
|
||||
propId = ((*propertiesP)->aulPropTag[count] >> 16) & 0xffff;
|
||||
listedProperties[propId] = YES;
|
||||
}
|
||||
[MAPIStoreSharingMessage fillAvailableProperties: *propertiesP
|
||||
withExclusions: listedProperties];
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
else
|
||||
return [super getAvailableProperties: propertiesP inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
static NSComparisonResult
|
||||
_compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
{
|
||||
@@ -165,7 +197,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
count1 = [keys indexOfObject: data1];
|
||||
data2 = [entry2 objectForKey: @"mimeType"];
|
||||
count2 = [keys indexOfObject: data2];
|
||||
|
||||
|
||||
if (count1 == count2)
|
||||
{
|
||||
data1 = [entry1 objectForKey: @"key"];
|
||||
@@ -200,9 +232,11 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
|
||||
- (void) _fetchHeaderData
|
||||
{
|
||||
MAPIStoreSharingMessage *sharingMessage;
|
||||
NSMutableArray *keys;
|
||||
NSArray *acceptedTypes;
|
||||
NSDictionary *messageData, *partHeaderData, *parameters;
|
||||
NSString *sharingHeader;
|
||||
|
||||
acceptedTypes = [NSArray arrayWithObjects: @"text/calendar",
|
||||
@"application/ics",
|
||||
@@ -226,7 +260,27 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
ASSIGN (headerCharset, [parameters objectForKey: @"charset"]);
|
||||
if ([headerMimeType isEqualToString: @"text/calendar"]
|
||||
|| [headerMimeType isEqualToString: @"application/ics"])
|
||||
{
|
||||
mailIsEvent = YES;
|
||||
if ([[parameters objectForKey: @"method"] isEqualToString: @"REQUEST"])
|
||||
mailIsMeetingRequest = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
sharingHeader = [[sogoObject mailHeaders] objectForKey: @"x-ms-sharing-localtype"];
|
||||
if (sharingHeader)
|
||||
{
|
||||
mailIsSharingObject = YES;
|
||||
/* It is difficult to subclass this in folder class, that's why
|
||||
a sharing object is a proxy in a mail message */
|
||||
sharingMessage = [[MAPIStoreSharingMessage alloc]
|
||||
initWithMailHeaders: [sogoObject mailHeaders]
|
||||
andConnectionInfo: [[self context] connectionInfo]
|
||||
fromMessage: self];
|
||||
[self addProxy: sharingMessage];
|
||||
[sharingMessage release];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
headerSetup = YES;
|
||||
@@ -286,7 +340,6 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
wrapperWithICalEvent: event
|
||||
andUser: [context activeUser]
|
||||
andSenderEmail: senderEmail
|
||||
inTimeZone: [[self userContext] timeZone]
|
||||
withConnectionInfo: [context connectionInfo]];
|
||||
[appointmentWrapper retain];
|
||||
}
|
||||
@@ -368,6 +421,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
{
|
||||
uint64_t version = ULLONG_MAX;
|
||||
NSString *uid, *changeNumber;
|
||||
BOOL synced;
|
||||
|
||||
uid = [(MAPIStoreMailFolder *)
|
||||
container messageUIDFromMessageKey: [self nameInContainer]];
|
||||
@@ -386,8 +440,19 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
[self logWithFormat: @"got one"];
|
||||
else
|
||||
{
|
||||
[self errorWithFormat: @"still nothing. We crash!"];
|
||||
abort();
|
||||
[self warnWithFormat: @"attempting to get change number"
|
||||
@" by synchronising this specific message..."];
|
||||
synced = [(MAPIStoreMailFolder *) container synchroniseCacheForUID: uid];
|
||||
if (synced)
|
||||
{
|
||||
changeNumber = [(MAPIStoreMailFolder *) container
|
||||
changeNumberForMessageUID: uid];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self errorWithFormat: @"still nothing. We crash!"];
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
version = [changeNumber unsignedLongLongValue] >> 16;
|
||||
@@ -456,6 +521,9 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
NSUInteger colIdx;
|
||||
NSString *stringValue;
|
||||
|
||||
/* As specified in [MS-OXCMAIL] 2.2.3.2.6.1, if there are three
|
||||
or less characters followed by a colon at the beginning of
|
||||
the subject, we can assume that's the subject prefix */
|
||||
subject = [self subject];
|
||||
colIdx = [subject rangeOfString: @":"].location;
|
||||
if (colIdx != NSNotFound && colIdx < 4)
|
||||
@@ -464,24 +532,52 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
else
|
||||
stringValue = @"";
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getPidTagNormalizedSubject: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
NSString *subject;
|
||||
NSUInteger colIdx;
|
||||
NSString *stringValue;
|
||||
NSString *stringValue, *subject;
|
||||
NSUInteger quoteStartIdx, quoteEndIdx, colIdx;
|
||||
NSRange quoteRange;
|
||||
|
||||
if (!headerSetup)
|
||||
[self _fetchHeaderData];
|
||||
|
||||
subject = [self subject];
|
||||
colIdx = [subject rangeOfString: @":"].location;
|
||||
if (colIdx != NSNotFound && colIdx < 4)
|
||||
stringValue = [[subject substringFromIndex: colIdx + 1]
|
||||
stringByTrimmingLeadSpaces];
|
||||
if (mailIsMeetingRequest)
|
||||
{
|
||||
|
||||
/* SOGo "spices up" the invitation/update mail's subject, but
|
||||
the client uses it to name the attendee's event, so we keep
|
||||
only what's inside the quotes */
|
||||
quoteStartIdx = [subject rangeOfString: @"\""].location;
|
||||
quoteEndIdx = [subject rangeOfString: @"\""
|
||||
options: NSBackwardsSearch].location;
|
||||
if (quoteStartIdx != NSNotFound
|
||||
&& quoteEndIdx != NSNotFound
|
||||
&& quoteStartIdx != quoteEndIdx)
|
||||
{
|
||||
quoteRange = NSMakeRange(quoteStartIdx + 1, quoteEndIdx - quoteStartIdx - 1);
|
||||
stringValue = [subject substringWithRange: quoteRange];
|
||||
}
|
||||
else stringValue = subject;
|
||||
}
|
||||
else
|
||||
stringValue = subject;
|
||||
{
|
||||
|
||||
/* As specified in [MS-OXCMAIL] 2.2.3.2.6.1, if there are three
|
||||
or less characters followed by a colon at the beginning of
|
||||
the subject, we can assume that's the subject prefix */
|
||||
colIdx = [subject rangeOfString: @":"].location;
|
||||
if (colIdx != NSNotFound && colIdx < 4)
|
||||
stringValue = [[subject substringFromIndex: colIdx + 1]
|
||||
stringByTrimmingLeadSpaces];
|
||||
else
|
||||
stringValue = subject;
|
||||
}
|
||||
if (!stringValue)
|
||||
stringValue = @"";
|
||||
*data = [stringValue asUnicodeInMemCtx: memCtx];
|
||||
@@ -504,36 +600,31 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
if (mailIsEvent)
|
||||
[[self _appointmentWrapper] getPidTagMessageClass: data
|
||||
inMemCtx: memCtx];
|
||||
else if (mailIsSharingObject)
|
||||
*data = talloc_strdup (memCtx, "IPM.Sharing");
|
||||
else
|
||||
*data = talloc_strdup (memCtx, "IPM.Note");
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
/* Note: this applies to regular mails... */
|
||||
// - (int) getPidTagReplyRequested: (void **) data // TODO
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// if (!headerSetup)
|
||||
// [self _fetchHeaderData];
|
||||
|
||||
// return (mailIsEvent
|
||||
// ? [self getYes: data inMemCtx: memCtx]
|
||||
// : [self getNo: data inMemCtx: memCtx]);
|
||||
// }
|
||||
|
||||
/* ... while this applies to invitations. */
|
||||
- (int) getPidTagResponseRequested: (void **) data // TODO
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
- (int) getPidTagReplyRequested: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
if (!headerSetup)
|
||||
[self _fetchHeaderData];
|
||||
|
||||
return (mailIsEvent
|
||||
? [self getNo: data inMemCtx: memCtx]
|
||||
return (mailIsMeetingRequest
|
||||
? [self getYes: data inMemCtx: memCtx]
|
||||
: MAPISTORE_ERR_NOT_FOUND);
|
||||
}
|
||||
|
||||
- (int) getPidTagResponseRequested: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getPidTagReplyRequested: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidTagLatestDeliveryTime: (void **) data // DOUBT
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
@@ -564,7 +655,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
NSDictionary *coreInfos;
|
||||
NSArray *flags;
|
||||
unsigned int v = 0;
|
||||
|
||||
|
||||
coreInfos = [sogoObject fetchCoreInfos];
|
||||
flags = [coreInfos objectForKey: @"flags"];
|
||||
|
||||
@@ -576,7 +667,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
if ([[self attachmentKeys]
|
||||
count] > 0)
|
||||
v |= MSGFLAG_HASATTACH;
|
||||
|
||||
|
||||
*data = MAPILongValue (memCtx, v);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
@@ -596,7 +687,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
v = 2;
|
||||
else
|
||||
v = 0;
|
||||
|
||||
|
||||
*data = MAPILongValue (memCtx, v);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
@@ -608,15 +699,15 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
NSDictionary *coreInfos;
|
||||
NSArray *flags;
|
||||
unsigned int v;
|
||||
|
||||
|
||||
coreInfos = [sogoObject fetchCoreInfos];
|
||||
|
||||
|
||||
flags = [coreInfos objectForKey: @"flags"];
|
||||
if ([flags containsObject: @"flagged"])
|
||||
v = 6;
|
||||
else
|
||||
v = 0;
|
||||
|
||||
|
||||
*data = MAPILongValue (memCtx, v);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
@@ -695,7 +786,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
if ([ngAddress isKindOfClass: [NGMailAddress class]])
|
||||
{
|
||||
cn = [ngAddress displayName];
|
||||
|
||||
|
||||
// If we don't have a displayName, we use the email address instead. This
|
||||
// avoid bug #2119 - where Outlook won't display anything in the "From" field,
|
||||
// nor in the recipient field if we reply to the email.
|
||||
@@ -719,7 +810,6 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
NSDictionary *contactInfos;
|
||||
NGMailAddress *ngAddress;
|
||||
NSData *entryId;
|
||||
struct ldb_context *samCtx;
|
||||
int rc;
|
||||
|
||||
if (fullMail)
|
||||
@@ -741,15 +831,14 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
|
||||
if (contactInfos)
|
||||
{
|
||||
username = [contactInfos objectForKey: @"c_uid"];
|
||||
samCtx = [[self context] connectionInfo]->sam_ctx;
|
||||
entryId = MAPIStoreInternalEntryId (samCtx, username);
|
||||
username = [contactInfos objectForKey: @"sAMAccountName"];
|
||||
entryId = MAPIStoreInternalEntryId([[self context] connectionInfo], username);
|
||||
}
|
||||
else
|
||||
entryId = MAPIStoreExternalEntryId (cn, email);
|
||||
|
||||
*data = [entryId asBinaryInMemCtx: memCtx];
|
||||
|
||||
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
else
|
||||
@@ -906,15 +995,15 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
{
|
||||
uint32_t v;
|
||||
NSString *s;
|
||||
|
||||
|
||||
s = [[sogoObject mailHeaders] objectForKey: @"x-priority"];
|
||||
v = 0x1;
|
||||
|
||||
|
||||
if ([s hasPrefix: @"1"]) v = 0x2;
|
||||
else if ([s hasPrefix: @"2"]) v = 0x2;
|
||||
else if ([s hasPrefix: @"4"]) v = 0x0;
|
||||
else if ([s hasPrefix: @"5"]) v = 0x0;
|
||||
|
||||
|
||||
*data = MAPILongValue (memCtx, v);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
@@ -923,15 +1012,17 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
- (int) getPidTagInternetCodepage: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
/* ref:
|
||||
http://msdn.microsoft.com/en-us/library/dd317756%28v=vs.85%29.aspx
|
||||
|
||||
minimal list that should be handled:
|
||||
us-ascii: 20127
|
||||
iso-8859-1: 28591
|
||||
iso-8859-15: 28605
|
||||
utf-8: 65001 */
|
||||
*data = MAPILongValue(memCtx, 65001);
|
||||
NSNumber *codepage;
|
||||
|
||||
codepage = [Codepages getCodepageFromName: headerCharset];
|
||||
if (!codepage)
|
||||
{
|
||||
[self warnWithFormat: @"Couldn't find codepage from `%@`. "
|
||||
@"Using UTF-8 by default", headerCharset];
|
||||
codepage = [Codepages getCodepageFromName: @"utf-8"];
|
||||
}
|
||||
|
||||
*data = MAPILongValue(memCtx, [codepage intValue]);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
@@ -1101,14 +1192,14 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
|
||||
if (!headerSetup)
|
||||
[self _fetchHeaderData];
|
||||
|
||||
|
||||
if ([headerMimeType isEqualToString: @"text/plain"])
|
||||
format = EDITOR_FORMAT_PLAINTEXT;
|
||||
else if ([headerMimeType isEqualToString: @"text/html"])
|
||||
format = EDITOR_FORMAT_HTML;
|
||||
else
|
||||
format = 0; /* EDITOR_FORMAT_DONTKNOW */
|
||||
|
||||
|
||||
*data = MAPILongValue (memCtx, format);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
@@ -1333,6 +1424,41 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
: MAPISTORE_ERR_NOT_FOUND);
|
||||
}
|
||||
|
||||
- (int) getPidTagTransportMessageHeaders: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
NSDictionary *mailHeaders;
|
||||
NSEnumerator *keyEnumerator;
|
||||
NSMutableArray *headers;
|
||||
NGMimeMessageGenerator *g;
|
||||
NSString *headerKey, *fullHeader, *headerGenerated;
|
||||
id headerValue;
|
||||
NSData *headerData;
|
||||
|
||||
/* Let's encode each mail header and put them on 'headers' array */
|
||||
mailHeaders = [sogoObject mailHeaders];
|
||||
headers = [NSMutableArray arrayWithCapacity: [mailHeaders count]];
|
||||
|
||||
g = [[NGMimeMessageGenerator alloc] init];
|
||||
keyEnumerator = [mailHeaders keyEnumerator];
|
||||
while ((headerKey = [keyEnumerator nextObject]))
|
||||
{
|
||||
headerValue = [mailHeaders objectForKey: headerKey];
|
||||
|
||||
headerData = [g generateDataForHeaderField: headerKey value: headerValue];
|
||||
headerGenerated = [[NSString alloc] initWithData: headerData encoding:NSUTF8StringEncoding];
|
||||
fullHeader = [NSString stringWithFormat:@"%@: %@", headerKey, headerGenerated];
|
||||
[headerGenerated release];
|
||||
|
||||
[headers addObject: fullHeader];
|
||||
}
|
||||
[g release];
|
||||
|
||||
*data = [[headers componentsJoinedByString:@"\n"] asUnicodeInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (void) getMessageData: (struct mapistore_message **) dataPtr
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
@@ -1349,11 +1475,9 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
NSData *entryId;
|
||||
NSDictionary *contactInfos;
|
||||
SOGoUserManager *mgr;
|
||||
struct ldb_context *samCtx;
|
||||
struct mapistore_message *msgData;
|
||||
struct mapistore_message_recipient *recipient;
|
||||
|
||||
samCtx = [[self context] connectionInfo]->sam_ctx;
|
||||
[super getMessageData: &msgData inMemCtx: memCtx];
|
||||
|
||||
if (!headerSetup)
|
||||
@@ -1402,12 +1526,12 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
if ([cn length] == 0)
|
||||
cn = email;
|
||||
contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
|
||||
|
||||
|
||||
if (contactInfos)
|
||||
{
|
||||
username = [contactInfos objectForKey: @"c_uid"];
|
||||
username = [contactInfos objectForKey: @"sAMAccountName"];
|
||||
recipient->username = [username asUnicodeInMemCtx: msgData];
|
||||
entryId = MAPIStoreInternalEntryId (samCtx, username);
|
||||
entryId = MAPIStoreInternalEntryId ([[self context] connectionInfo], username);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1420,7 +1544,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
p = 0;
|
||||
recipient->data = talloc_array (msgData, void *, msgData->columns->cValues);
|
||||
memset (recipient->data, 0, msgData->columns->cValues * sizeof (void *));
|
||||
|
||||
|
||||
// PR_OBJECT_TYPE = MAPI_MAILUSER (see MAPI_OBJTYPE)
|
||||
recipient->data[p] = MAPILongValue (msgData, MAPI_MAILUSER);
|
||||
p++;
|
||||
@@ -1428,7 +1552,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
// PR_DISPLAY_TYPE = DT_MAILUSER (see MS-NSPI)
|
||||
recipient->data[p] = MAPILongValue (msgData, 0);
|
||||
p++;
|
||||
|
||||
|
||||
// PR_7BIT_DISPLAY_NAME_UNICODE
|
||||
recipient->data[p] = [cn asUnicodeInMemCtx: msgData];
|
||||
p++;
|
||||
@@ -1436,7 +1560,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
// PR_SMTP_ADDRESS_UNICODE
|
||||
recipient->data[p] = [email asUnicodeInMemCtx: msgData];
|
||||
p++;
|
||||
|
||||
|
||||
// PR_SEND_INTERNET_ENCODING = 0x00060000 (plain text, see OXCMAIL)
|
||||
recipient->data[p] = MAPILongValue (msgData, 0x00060000);
|
||||
p++;
|
||||
@@ -1469,12 +1593,9 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
withPrefix: (NSString *) keyPrefix
|
||||
{
|
||||
NSArray *parts;
|
||||
NSDictionary *parameters;
|
||||
NSUInteger count, max;
|
||||
|
||||
parameters = [[bodyInfo objectForKey: @"disposition"]
|
||||
objectForKey: @"parameterList"];
|
||||
if ([[parameters objectForKey: @"filename"] length] > 0)
|
||||
if ([[bodyInfo filename] length] > 0)
|
||||
{
|
||||
if ([keyPrefix length] == 0)
|
||||
keyPrefix = @"0";
|
||||
@@ -1517,6 +1638,8 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
max = [keyParts count];
|
||||
if (max > 0)
|
||||
{
|
||||
[[self userContext] activate];
|
||||
|
||||
currentPart = [sogoObject lookupName: [keyParts objectAtIndex: 0]
|
||||
inContext: nil
|
||||
acquire: NO];
|
||||
@@ -1546,15 +1669,13 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
return attachment;
|
||||
}
|
||||
|
||||
- (int) setReadFlag: (uint8_t) flag
|
||||
- (enum mapistore_error) setReadFlag: (uint8_t) flag
|
||||
{
|
||||
NSString *imapFlag = @"\\Seen";
|
||||
|
||||
/* TODO: notifications should probably be emitted from here */
|
||||
if (flag & CLEAR_READ_FLAG)
|
||||
[sogoObject removeFlags: imapFlag];
|
||||
[properties setObject: [NSNumber numberWithBool: NO] forKey: @"read_flag_set"];
|
||||
else
|
||||
[sogoObject addFlags: imapFlag];
|
||||
[properties setObject: [NSNumber numberWithBool: YES] forKey: @"read_flag_set"];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
@@ -1566,11 +1687,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
if (!headerSetup)
|
||||
[self _fetchHeaderData];
|
||||
|
||||
if ([mimeKey hasPrefix: @"body.peek"])
|
||||
bodyPartKey = [NSString stringWithFormat: @"body[%@]",
|
||||
[mimeKey _strippedBodyKey]];
|
||||
else
|
||||
bodyPartKey = mimeKey;
|
||||
bodyPartKey = mimeKey;
|
||||
|
||||
return bodyPartKey;
|
||||
}
|
||||
@@ -1584,9 +1701,27 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
bodySetup = YES;
|
||||
}
|
||||
|
||||
- (void) save: (TALLOC_CTX *) memCtx
|
||||
- (MAPIStoreSharingMessage *) _sharingObject
|
||||
{
|
||||
/* Get the sharing object if available */
|
||||
NSUInteger i, max;
|
||||
id proxy;
|
||||
|
||||
max = [proxies count];
|
||||
for (i = 0; i < max; i++) {
|
||||
proxy = [proxies objectAtIndex: i];
|
||||
if ([proxy isKindOfClass: MAPIStoreSharingMessageK])
|
||||
return proxy;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) save: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
BOOL modified = NO;
|
||||
BOOL seen, storedSeenFlag;
|
||||
NSNumber *value;
|
||||
NSString *imapFlag = @"\\Seen";
|
||||
|
||||
value = [properties objectForKey: MAPIPropertyKey (PR_FLAG_STATUS)];
|
||||
if (value)
|
||||
@@ -1596,7 +1731,39 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
[sogoObject addFlags: @"\\Flagged"];
|
||||
else /* 0: unflagged, 1: follow up complete */
|
||||
[sogoObject removeFlags: @"\\Flagged"];
|
||||
|
||||
modified = YES;
|
||||
}
|
||||
|
||||
/* Manage seen flag on save */
|
||||
value = [properties objectForKey: @"read_flag_set"];
|
||||
if (value)
|
||||
{
|
||||
seen = [value boolValue];
|
||||
storedSeenFlag = [[[sogoObject fetchCoreInfos] objectForKey: @"flags"] containsObject: @"seen"];
|
||||
/* We modify the flags anyway to generate a new change number */
|
||||
if (seen)
|
||||
{
|
||||
if (storedSeenFlag)
|
||||
[sogoObject removeFlags: imapFlag];
|
||||
[sogoObject addFlags: imapFlag];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!storedSeenFlag)
|
||||
[sogoObject addFlags: imapFlag];
|
||||
[sogoObject removeFlags: imapFlag];
|
||||
}
|
||||
modified = YES;
|
||||
}
|
||||
|
||||
if (modified)
|
||||
[(MAPIStoreMailFolder *)[self container] synchroniseCache];
|
||||
|
||||
if (mailIsSharingObject)
|
||||
[[self _sharingObject] saveWithMessage: self
|
||||
andSOGoObject: sogoObject];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -161,15 +161,30 @@ static Class MAPIStoreMailMessageK, NSDataK, NSStringK;
|
||||
//[self logWithFormat: @"change number from oxcfxics: %.16lx", [value unsignedLongLongValue]];
|
||||
//[self logWithFormat: @" modseq: %.16lx", [modseq unsignedLongLongValue]];
|
||||
if (modseq)
|
||||
modseq = [NSNumber numberWithUnsignedLongLong:
|
||||
[modseq unsignedLongLongValue] + 1];
|
||||
{
|
||||
if (res->relop == RELOP_GT)
|
||||
modseq = [NSNumber numberWithUnsignedLongLong:
|
||||
[modseq unsignedLongLongValue] + 1];
|
||||
|
||||
}
|
||||
else
|
||||
modseq = [NSNumber numberWithUnsignedLongLong: 0];
|
||||
*qualifier = [[EOKeyValueQualifier alloc] initWithKey: @"MODSEQ"
|
||||
operatorSelector: EOQualifierOperatorGreaterThanOrEqualTo
|
||||
value: modseq];
|
||||
[*qualifier autorelease];
|
||||
rc = MAPIRestrictionStateNeedsEval;
|
||||
|
||||
if (res->relop == RELOP_GT || res->relop == RELOP_GE)
|
||||
{
|
||||
*qualifier = [[EOKeyValueQualifier alloc] initWithKey: @"MODSEQ"
|
||||
operatorSelector: EOQualifierOperatorGreaterThanOrEqualTo
|
||||
value: modseq];
|
||||
[*qualifier autorelease];
|
||||
rc = MAPIRestrictionStateNeedsEval;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Ignore other operations as IMAP only support MODSEQ >= X */
|
||||
[self warnWithFormat: @"Ignoring '%@' as only supported operators are > and >=",
|
||||
NSStringFromSelector ([self operatorFromRestrictionOperator: res->relop])];
|
||||
rc = MAPIRestrictionStateAlwaysTrue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -28,11 +28,13 @@
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSData.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSScanner.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSTimeZone.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
#import <NGExtensions/NGBase64Coding.h>
|
||||
#import <NGExtensions/NGHashMap.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <NGExtensions/NSObject+Values.h>
|
||||
#import <NGExtensions/NSString+Encoding.h>
|
||||
#import <NGMime/NGMimeBodyPart.h>
|
||||
#import <NGMime/NGMimeMultipartBody.h>
|
||||
@@ -43,6 +45,7 @@
|
||||
#import <SOGo/NSArray+Utilities.h>
|
||||
#import <SOGo/NSCalendarDate+SOGo.h>
|
||||
#import <SOGo/NSString+Utilities.h>
|
||||
#import <SOGo/SOGoCacheObject.h>
|
||||
#import <SOGo/SOGoDomainDefaults.h>
|
||||
#import <SOGo/SOGoMailer.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
@@ -50,6 +53,7 @@
|
||||
#import <Mailer/SOGoMailFolder.h>
|
||||
#import <Mailer/NSString+Mail.h>
|
||||
|
||||
#import "Codepages.h"
|
||||
#import "MAPIStoreAttachment.h"
|
||||
#import "MAPIStoreAttachmentTable.h"
|
||||
#import "MAPIStoreContext.h"
|
||||
@@ -62,13 +66,13 @@
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSObject+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
#import <SOGo/SOGoCacheObject.h>
|
||||
|
||||
#import "MAPIStoreMailVolatileMessage.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
#include <mapistore/mapistore_nameid.h>
|
||||
|
||||
static Class NSNumberK = Nil;
|
||||
|
||||
@@ -163,9 +167,9 @@ static NSString *recTypes[] = { @"orig", @"to", @"cc", @"bcc" };
|
||||
|
||||
- (BOOL) hasContentId
|
||||
{
|
||||
return ([properties
|
||||
objectForKey: MAPIPropertyKey (PR_ATTACH_CONTENT_ID_UNICODE)]
|
||||
!= nil);
|
||||
NSString *contentId = [properties
|
||||
objectForKey: MAPIPropertyKey (PR_ATTACH_CONTENT_ID_UNICODE)];
|
||||
return contentId && [contentId length] > 0;
|
||||
}
|
||||
|
||||
- (NGMimeBodyPart *) asMIMEBodyPart
|
||||
@@ -229,7 +233,7 @@ static NSString *recTypes[] = { @"orig", @"to", @"cc", @"bcc" };
|
||||
[map addObject: contentDisposition forKey: @"content-disposition"];
|
||||
contentId = [properties
|
||||
objectForKey: MAPIPropertyKey (PR_ATTACH_CONTENT_ID_UNICODE)];
|
||||
if (contentId)
|
||||
if (contentId && [contentId length] > 0)
|
||||
[map setObject: [NSString stringWithFormat: @"<%@>", contentId]
|
||||
forKey: @"content-id"];
|
||||
bodyPart = [NGMimeBodyPart bodyPartWithHeader: map];
|
||||
@@ -282,7 +286,7 @@ static NSString *recTypes[] = { @"orig", @"to", @"cc", @"bcc" };
|
||||
version = [properties objectForKey: @"version"];
|
||||
|
||||
return (version
|
||||
? exchange_globcnt ([version unsignedLongLongValue])
|
||||
? [version unsignedLongLongValue]
|
||||
: ULLONG_MAX);
|
||||
}
|
||||
|
||||
@@ -334,13 +338,10 @@ static NSString *recTypes[] = { @"orig", @"to", @"cc", @"bcc" };
|
||||
NSData *entryId;
|
||||
NSDictionary *allRecipients, *dict, *contactInfos;
|
||||
SOGoUserManager *mgr;
|
||||
struct ldb_context *samCtx;
|
||||
struct mapistore_message *msgData;
|
||||
struct mapistore_message_recipient *recipient;
|
||||
enum ulRecipClass type;
|
||||
|
||||
samCtx = [[self context] connectionInfo]->sam_ctx;
|
||||
|
||||
// [super getMessageData: &msgData inMemCtx: memCtx];
|
||||
|
||||
msgData = talloc_zero (memCtx, struct mapistore_message);
|
||||
@@ -383,9 +384,9 @@ static NSString *recTypes[] = { @"orig", @"to", @"cc", @"bcc" };
|
||||
contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
|
||||
if (contactInfos)
|
||||
{
|
||||
username = [contactInfos objectForKey: @"c_uid"];
|
||||
username = [contactInfos objectForKey: @"sAMAccountName"];
|
||||
recipient->username = [username asUnicodeInMemCtx: msgData];
|
||||
entryId = MAPIStoreInternalEntryId (samCtx, username);
|
||||
entryId = MAPIStoreInternalEntryId ([[self context] connectionInfo], username);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -531,13 +532,112 @@ QuoteSpecials (NSString *address)
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline void
|
||||
FillMessageHeadersFromSharingProperties (NGMutableHashMap *headers, NSDictionary *mailProperties)
|
||||
{
|
||||
/* Store the *important* properties related with a sharing object as
|
||||
MIME eXtension headers. See [MS-OXSHARE] Section 2.2 for details
|
||||
about the properties */
|
||||
|
||||
id value;
|
||||
NSNumber *sharingFlavourNum = nil;
|
||||
|
||||
value = [mailProperties objectForKey: MAPIPropertyKey (PidLidSharingCapabilities)];
|
||||
if (value)
|
||||
[headers setObject: value
|
||||
forKey: @"X-MS-Sharing-Capabilities"];
|
||||
|
||||
value = [mailProperties objectForKey: MAPIPropertyKey (PidLidSharingFlavor)];
|
||||
if (value)
|
||||
sharingFlavourNum = (NSNumber *)value;
|
||||
else
|
||||
{
|
||||
value = [mailProperties objectForKey: MAPIPropertyKey (PidNameXSharingFlavor)];
|
||||
if (value)
|
||||
{
|
||||
/* Transform the hex string to unsigned int */
|
||||
NSScanner *scanner;
|
||||
unsigned int sharingFlavour;
|
||||
scanner = [NSScanner scannerWithString:value];
|
||||
if ([scanner scanHexInt:&sharingFlavour])
|
||||
sharingFlavourNum =[NSNumber numberWithUnsignedInt: sharingFlavour];
|
||||
}
|
||||
}
|
||||
if (sharingFlavourNum)
|
||||
{
|
||||
if ([sharingFlavourNum unsignedIntegerValue] == 0x5100)
|
||||
{
|
||||
/* 0x5100 sharing flavour is not in standard but it seems to
|
||||
be a denial of request + invitation message so we store
|
||||
deny sharing flavour */
|
||||
sharingFlavourNum = [NSNumber numberWithUnsignedInt: SHARING_DENY_REQUEST];
|
||||
}
|
||||
[headers setObject: sharingFlavourNum
|
||||
forKey: @"X-MS-Sharing-Flavor"];
|
||||
}
|
||||
|
||||
value = [mailProperties objectForKey: MAPIPropertyKey (PidLidSharingInitiatorEntryId)];
|
||||
if (value)
|
||||
[headers setObject: [[value stringByEncodingBase64] stringByReplacingOccurrencesOfString: @"\n"
|
||||
withString: @""]
|
||||
forKey: @"X-MS-Sharing-InitiatorEntryId"];
|
||||
|
||||
value = [mailProperties objectForKey: MAPIPropertyKey (PidLidSharingInitiatorName)];
|
||||
if (value)
|
||||
[headers setObject: value
|
||||
forKey: @"X-MS-Sharing-InitiatorName"];
|
||||
|
||||
value = [mailProperties objectForKey: MAPIPropertyKey (PidLidSharingInitiatorSmtp)];
|
||||
if (value)
|
||||
[headers setObject: value
|
||||
forKey: @"X-MS-Sharing-InitiatorSmtp"];
|
||||
|
||||
value = [mailProperties objectForKey: MAPIPropertyKey (PidLidSharingLocalType)];
|
||||
if (value)
|
||||
[headers setObject: value
|
||||
forKey: @"X-MS-Sharing-LocalType"];
|
||||
|
||||
value = [mailProperties objectForKey: MAPIPropertyKey (PidLidSharingProviderName)];
|
||||
if (value)
|
||||
[headers setObject: value
|
||||
forKey: @"X-MS-Sharing-ProviderName"];
|
||||
|
||||
value = [mailProperties objectForKey: MAPIPropertyKey (PidLidSharingRemoteName)];
|
||||
if (value)
|
||||
[headers setObject: value
|
||||
forKey: @"X-MS-Sharing-RemoteName"];
|
||||
|
||||
value = [mailProperties objectForKey: MAPIPropertyKey (PidLidSharingRemoteStoreUid)];
|
||||
if (value)
|
||||
[headers setObject: value
|
||||
forKey: @"X-MS-Sharing-RemoteStoreUid"];
|
||||
|
||||
value = [mailProperties objectForKey: MAPIPropertyKey (PidLidSharingRemoteUid)];
|
||||
if (value)
|
||||
[headers setObject: value
|
||||
forKey: @"X-MS-Sharing-RemoteUid"];
|
||||
|
||||
value = [mailProperties objectForKey: MAPIPropertyKey (PidLidSharingResponseTime)];
|
||||
if (value)
|
||||
[headers setObject: value
|
||||
forKey: @"X-MS-Sharing-ResponseTime"];
|
||||
|
||||
value = [mailProperties objectForKey: MAPIPropertyKey (PidLidSharingResponseType)];
|
||||
if (value)
|
||||
[headers setObject: value
|
||||
forKey: @"X-MS-Sharing-ResponseType"];
|
||||
|
||||
}
|
||||
|
||||
static inline void
|
||||
FillMessageHeadersFromProperties (NGMutableHashMap *headers,
|
||||
NSDictionary *mailProperties, BOOL withBcc,
|
||||
struct mapistore_connection_info *connInfo)
|
||||
{
|
||||
BOOL fromResolved = NO;
|
||||
NSData *senderEntryId;
|
||||
NSMutableString *subject;
|
||||
NSString *from, *recId, *messageId, *subjectData;
|
||||
NSString *from, *recId, *messageId, *subjectData, *recipientsStr, *msgClass;
|
||||
NSArray *list;
|
||||
NSCalendarDate *date;
|
||||
NSDictionary *recipients;
|
||||
@@ -571,10 +671,104 @@ FillMessageHeadersFromProperties (NGMutableHashMap *headers,
|
||||
|
||||
list = MakeRecipientsList ([recipients objectForKey: @"orig"]);
|
||||
if ([list count])
|
||||
[headers setObjects: list forKey: @"from"];
|
||||
{
|
||||
[headers setObjects: list forKey: @"from"];
|
||||
fromResolved = YES;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fromResolved)
|
||||
{
|
||||
TALLOC_CTX *local_mem_ctx;
|
||||
local_mem_ctx = talloc_new(NULL);
|
||||
if (!local_mem_ctx)
|
||||
{
|
||||
NSLog (@"%s: Out of memory", __PRETTY_FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
NSLog (@"Message without an orig from, try to guess it from PidTagSenderEntryId");
|
||||
senderEntryId = [mailProperties objectForKey: MAPIPropertyKey (PR_SENDER_ENTRYID)];
|
||||
if (senderEntryId)
|
||||
{
|
||||
struct Binary_r bin32;
|
||||
struct AddressBookEntryId *addrBookEntryId;
|
||||
NSString *username;
|
||||
NSMutableDictionary *fromRecipient;
|
||||
|
||||
fromRecipient = [NSMutableDictionary dictionaryWithCapacity: 2];
|
||||
|
||||
bin32.cb = [senderEntryId length];
|
||||
bin32.lpb = (uint8_t *) [senderEntryId bytes];
|
||||
addrBookEntryId = get_AddressBookEntryId (local_mem_ctx, &bin32);
|
||||
if (addrBookEntryId && [[NSString stringWithGUID: &addrBookEntryId->ProviderUID]
|
||||
hasSuffix: @"08002b2fe182"])
|
||||
{
|
||||
/* TODO: better way to distinguish local and other ones */
|
||||
username = MAPIStoreSamDBUserAttribute (connInfo, @"legacyExchangeDN",
|
||||
[NSString stringWithUTF8String: addrBookEntryId->X500DN], @"sAMAccountName");
|
||||
if (username)
|
||||
{
|
||||
SOGoUser *fromUser;
|
||||
|
||||
fromUser = [SOGoUser userWithLogin: [username lowercaseString]];
|
||||
[fromRecipient setObject: [fromUser cn] forKey: @"fullName"];
|
||||
[fromRecipient setObject: [[fromUser allEmails] objectAtIndex: 0]
|
||||
forKey: @"email"];
|
||||
}
|
||||
else
|
||||
[fromRecipient setObject: [NSString stringWithUTF8String: addrBookEntryId->X500DN]
|
||||
forKey: @"email"];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Try with One-Off EntryId */
|
||||
struct OneOffEntryId *oneOffEntryId;
|
||||
|
||||
oneOffEntryId = get_OneOffEntryId (local_mem_ctx, &bin32);
|
||||
if (oneOffEntryId && [[NSString stringWithGUID: &oneOffEntryId->ProviderUID]
|
||||
hasSuffix: @"00dd010f5402"])
|
||||
{
|
||||
[fromRecipient setObject: [NSString stringWithUTF8String: oneOffEntryId->DisplayName.lpszW]
|
||||
forKey: @"fullName"];
|
||||
[fromRecipient setObject: [NSString stringWithUTF8String: oneOffEntryId->EmailAddress.lpszW]
|
||||
forKey: @"email"];
|
||||
}
|
||||
}
|
||||
|
||||
if ([[fromRecipient allKeys] count] > 0)
|
||||
{
|
||||
list = MakeRecipientsList ([NSArray arrayWithObjects: fromRecipient, nil]);
|
||||
if ([list count])
|
||||
[headers setObjects: list forKey: @"from"];
|
||||
}
|
||||
|
||||
}
|
||||
/* Free entryId */
|
||||
talloc_free(local_mem_ctx);
|
||||
}
|
||||
|
||||
if (!recipients)
|
||||
{
|
||||
NSLog (@"Message without recipients."
|
||||
@"Guessing recipients from PidTagOriginalDisplayTo and PidTagOriginalCc");
|
||||
recipientsStr = [mailProperties objectForKey: MAPIPropertyKey (PidTagOriginalDisplayTo)];
|
||||
if (recipientsStr)
|
||||
{
|
||||
list = [recipientsStr componentsSeparatedByString:@", "];
|
||||
if ([list count])
|
||||
[headers setObjects: list forKey: @"to"];
|
||||
}
|
||||
|
||||
recipientsStr = [mailProperties objectForKey: MAPIPropertyKey (PidTagOriginalDisplayCc)];
|
||||
if (recipientsStr)
|
||||
{
|
||||
list = [recipientsStr componentsSeparatedByString:@", "];
|
||||
if ([list count])
|
||||
[headers setObjects: list forKey: @"cc"];
|
||||
}
|
||||
}
|
||||
else
|
||||
NSLog (@"message without recipients");
|
||||
|
||||
subject = [NSMutableString stringWithCapacity: 128];
|
||||
subjectData = [mailProperties objectForKey: MAPIPropertyKey (PR_SUBJECT_PREFIX_UNICODE)];
|
||||
@@ -583,6 +777,12 @@ FillMessageHeadersFromProperties (NGMutableHashMap *headers,
|
||||
subjectData = [mailProperties objectForKey: MAPIPropertyKey (PR_NORMALIZED_SUBJECT_UNICODE)];
|
||||
if (subjectData)
|
||||
[subject appendString: subjectData];
|
||||
if ([subject length] == 0)
|
||||
{
|
||||
subjectData = [mailProperties objectForKey: MAPIPropertyKey (PR_SUBJECT_UNICODE)];
|
||||
if (subjectData)
|
||||
[subject appendString: subjectData];
|
||||
}
|
||||
[headers setObject: [subject asQPSubjectString: @"utf-8"] forKey: @"subject"];
|
||||
|
||||
messageId = [mailProperties objectForKey: MAPIPropertyKey (PR_INTERNET_MESSAGE_ID_UNICODE)];
|
||||
@@ -592,8 +792,6 @@ FillMessageHeadersFromProperties (NGMutableHashMap *headers,
|
||||
date = [mailProperties objectForKey: MAPIPropertyKey (PR_CLIENT_SUBMIT_TIME)];
|
||||
if (date)
|
||||
{
|
||||
date = [date addYear: 0 month: 0 day: 0
|
||||
hour: 0 minute: 0 second: [[date timeZone] secondsFromGMT]];
|
||||
[headers addObject: [date rfc822DateString] forKey: @"date"];
|
||||
}
|
||||
[headers addObject: @"1.0" forKey: @"MIME-Version"];
|
||||
@@ -612,6 +810,13 @@ FillMessageHeadersFromProperties (NGMutableHashMap *headers,
|
||||
{
|
||||
[headers addObject: @"5 (Lowest)" forKey: @"X-Priority"];
|
||||
}
|
||||
|
||||
msgClass = [mailProperties objectForKey: MAPIPropertyKey (PidTagMessageClass)];
|
||||
if ([msgClass isEqualToString: @"IPM.Sharing"])
|
||||
{
|
||||
FillMessageHeadersFromSharingProperties (headers, mailProperties);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static NSArray *
|
||||
@@ -672,21 +877,9 @@ MakeTextHtmlBody (NSDictionary *mailProperties, NSDictionary *attachmentParts,
|
||||
{
|
||||
/* charset */
|
||||
codePage = [mailProperties objectForKey: MAPIPropertyKey (PR_INTERNET_CPID)];
|
||||
switch ([codePage intValue])
|
||||
{
|
||||
case 20127:
|
||||
charset = @"us-ascii";
|
||||
break;
|
||||
case 28605:
|
||||
charset = @"iso-8859-15";
|
||||
break;
|
||||
case 65001:
|
||||
charset = @"utf-8";
|
||||
break;
|
||||
case 28591:
|
||||
default:
|
||||
charset = @"iso-8859-1";
|
||||
}
|
||||
charset = [Codepages getNameFromCodepage: codePage];
|
||||
if (!charset)
|
||||
charset = @"utf-8";
|
||||
htmlContentType = [NSString stringWithFormat: @"text/html; charset=%@",
|
||||
charset];
|
||||
|
||||
@@ -820,7 +1013,7 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS
|
||||
- (NGMimeMessage *) _generateMessageWithBcc: (BOOL) withBcc
|
||||
{
|
||||
NSString *contentType;
|
||||
NGMimeMessage *message;
|
||||
NGMimeMessage *message;
|
||||
NGMutableHashMap *headers;
|
||||
id messageBody;
|
||||
|
||||
@@ -834,7 +1027,7 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS
|
||||
messageBody = MakeMessageBody (properties, attachmentParts, &contentType);
|
||||
if (messageBody)
|
||||
{
|
||||
[headers setObject: contentType forKey: @"content-type"];
|
||||
[message setHeader: contentType forKey: @"content-type"];
|
||||
[message setBody: messageBody];
|
||||
}
|
||||
|
||||
@@ -860,6 +1053,7 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS
|
||||
|
||||
- (int) submitWithFlags: (enum SubmitFlags) flags
|
||||
{
|
||||
enum mapistore_error rc = MAPISTORE_SUCCESS;
|
||||
NSDictionary *recipients;
|
||||
NSData *messageData;
|
||||
NSMutableArray *recipientEmails;
|
||||
@@ -873,12 +1067,12 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS
|
||||
id <SOGoAuthenticator> authenticator;
|
||||
|
||||
msgClass = [properties objectForKey: MAPIPropertyKey (PidTagMessageClass)];
|
||||
if ([msgClass isEqualToString: @"IPM.Note"]) /* we skip invitation replies */
|
||||
if ([msgClass isEqualToString: @"IPM.Note"] || [msgClass isEqualToString: @"IPM.Sharing"]) /* we skip invitation replies */
|
||||
{
|
||||
/* send mail */
|
||||
|
||||
messageData = [self _generateMailDataWithBcc: NO];
|
||||
|
||||
|
||||
recipientEmails = [NSMutableArray arrayWithCapacity: 32];
|
||||
recipients = [properties objectForKey: @"recipients"];
|
||||
for (type = MAPI_ORIG; type <= MAPI_BCC; type++)
|
||||
@@ -896,6 +1090,7 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS
|
||||
dd = [activeUser domainDefaults];
|
||||
from = [[activeUser allEmails] objectAtIndex: 0];
|
||||
|
||||
[[self userContext] activate];
|
||||
woContext = [[self userContext] woContext];
|
||||
authenticator = [sogoObject authenticatorInContext: woContext];
|
||||
error = [[SOGoMailer mailerWithDomainDefaults: dd]
|
||||
@@ -905,7 +1100,10 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS
|
||||
withAuthenticator: authenticator
|
||||
inContext: woContext];
|
||||
if (error)
|
||||
[self logWithFormat: @"an error occurred: '%@'", error];
|
||||
{
|
||||
[self errorWithFormat: @"an error occurred: '%@'", error];
|
||||
rc = MAPISTORE_ERR_MSG_SEND;
|
||||
}
|
||||
|
||||
// mapping = [self mapping];
|
||||
// [mapping unregisterURLWithID: [self objectId]];
|
||||
@@ -917,12 +1115,13 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS
|
||||
[self logWithFormat: @"skipping submit of message with class '%@'",
|
||||
msgClass];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (void) save: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
NSString *folderName, *flag, *newIdString, *messageKey;
|
||||
BOOL updatedMetadata;
|
||||
NSString *folderName, *flag, *newIdString, *messageKey, *changeNumber;
|
||||
NSData *changeKey, *messageData;
|
||||
NGImap4Connection *connection;
|
||||
NGImap4Client *client;
|
||||
@@ -958,21 +1157,33 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS
|
||||
[sogoObject setNameInContainer: messageKey];
|
||||
[mapping registerURL: [self url] withID: mid];
|
||||
|
||||
/* synchronise the cache and update the change key with the one provided
|
||||
by the client. Before doing this, lets issue a unselect/select combo
|
||||
because of timing issues with Dovecot in obtaining the latest modseq.
|
||||
Sometimes, Dovecot doesn't return the newly appended UID if we do
|
||||
a "UID SORT (DATE) UTF-8 (MODSEQ XYZ) (NOT DELETED)" command (where
|
||||
XYZ is the HIGHESTMODSEQ+1) immediately after IMAP APPEND */
|
||||
/* synchronise the cache and update the predecessor change list
|
||||
with the change key provided by the client. Before doing
|
||||
this, lets issue a unselect/select combo because of timing
|
||||
issues with Dovecot in obtaining the latest modseq.
|
||||
Sometimes, Dovecot doesn't return the newly appended UID if
|
||||
we do a "UID SORT (DATE) UTF-8 (MODSEQ XYZ) (NOT DELETED)"
|
||||
command (where XYZ is the HIGHESTMODSEQ+1) immediately after
|
||||
IMAP APPEND */
|
||||
[client unselect];
|
||||
[client select: folderName];
|
||||
|
||||
[(MAPIStoreMailFolder *) container synchroniseCache];
|
||||
changeKey = [properties objectForKey: MAPIPropertyKey (PR_CHANGE_KEY)];
|
||||
if (changeKey)
|
||||
[(MAPIStoreMailFolder *) container
|
||||
setChangeKey: changeKey
|
||||
forMessageWithKey: messageKey];
|
||||
{
|
||||
updatedMetadata = [(MAPIStoreMailFolder *) container updatePredecessorChangeListWith: changeKey
|
||||
forMessageWithKey: messageKey];
|
||||
if (!updatedMetadata)
|
||||
[self warnWithFormat: @"Predecessor change list not updated with client data"];
|
||||
}
|
||||
|
||||
/* Update version property (PR_CHANGE_KEY indeed) as it is
|
||||
requested once it is saved */
|
||||
changeNumber = [(MAPIStoreMailFolder *) container changeNumberForMessageUID: newIdString];
|
||||
if (changeNumber)
|
||||
[properties setObject: [NSNumber numberWithUnsignedLongLong: [changeNumber unsignedLongLongValue] >> 16]
|
||||
forKey: @"version"];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,13 +49,19 @@
|
||||
- (NSString *) urlFromID: (uint64_t) idKey;
|
||||
|
||||
- (uint64_t) idFromURL: (NSString *) url;
|
||||
- (uint64_t) idFromURL: (NSString *) url
|
||||
isSoftDeleted: (bool *) softDeleted;
|
||||
- (BOOL) registerURL: (NSString *) urlString
|
||||
withID: (uint64_t) idNbr;
|
||||
- (void) registerURLs: (NSArray *) urlString
|
||||
withIDs: (NSArray *) idNbrs;
|
||||
- (void) unregisterURLWithID: (uint64_t) idNbr;
|
||||
- (void) unregisterURLWithID: (uint64_t) idNbr
|
||||
andFlags: (uint8_t) flags;
|
||||
- (void) updateID: (uint64_t) idNbr
|
||||
withURL: (NSString *) urlString;
|
||||
- (BOOL) updateURL: (NSString *) urlString
|
||||
withID: (uint64_t) idNbr;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -114,6 +114,9 @@ MAPIStoreMappingKeyFromId (uint64_t idNbr)
|
||||
{
|
||||
ASSIGN (username, newUsername);
|
||||
indexing = newIndexing;
|
||||
/* Workaround so all indexing context are valid and won't be freed. */
|
||||
// TODO refactor indexing interface
|
||||
talloc_reference(memCtx, indexing);
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -157,6 +160,21 @@ MAPIStoreMappingKeyFromId (uint64_t idNbr)
|
||||
return NSNotFound;
|
||||
}
|
||||
|
||||
- (uint64_t) idFromURL: (NSString *) url
|
||||
isSoftDeleted: (bool *) softDeleted
|
||||
{
|
||||
enum mapistore_error ret;
|
||||
uint64_t idNbr;
|
||||
|
||||
ret = indexing->get_fmid(indexing, [username UTF8String], [url UTF8String],
|
||||
false, &idNbr, softDeleted);
|
||||
|
||||
if (ret != MAPISTORE_SUCCESS)
|
||||
return NSNotFound;
|
||||
|
||||
return idNbr;
|
||||
}
|
||||
|
||||
- (void) _updateFolderWithURL: (NSString *) oldURL
|
||||
withURL: (NSString *) urlString
|
||||
{
|
||||
@@ -209,12 +227,32 @@ MAPIStoreMappingKeyFromId (uint64_t idNbr)
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) updateURL: (NSString *) urlString
|
||||
withID: (uint64_t) idNbr
|
||||
{
|
||||
BOOL rc = NO;
|
||||
uint64_t oldIDNbr;
|
||||
|
||||
oldIDNbr = [self idFromURL: urlString];
|
||||
if (oldIDNbr)
|
||||
{
|
||||
[self logWithFormat: @"Updating URL: %@ with id %.16"PRIx64" from old id %.16"PRIx64,
|
||||
urlString, idNbr, oldIDNbr];
|
||||
[self unregisterURLWithID: oldIDNbr];
|
||||
[self registerURL: urlString
|
||||
withID: idNbr];
|
||||
rc = YES;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (BOOL) registerURL: (NSString *) urlString
|
||||
withID: (uint64_t) idNbr
|
||||
{
|
||||
NSString *oldURL;
|
||||
uint64_t oldIdNbr;
|
||||
bool rc;
|
||||
bool softDeleted;
|
||||
|
||||
oldURL = [self urlFromID: idNbr];
|
||||
if (oldURL != NULL)
|
||||
@@ -225,18 +263,20 @@ MAPIStoreMappingKeyFromId (uint64_t idNbr)
|
||||
return NO;
|
||||
}
|
||||
|
||||
oldIdNbr = [self idFromURL: urlString];
|
||||
oldIdNbr = [self idFromURL: urlString isSoftDeleted: &softDeleted];
|
||||
if (oldIdNbr != NSNotFound)
|
||||
{
|
||||
[self errorWithFormat:
|
||||
@"attempt to double register an entry with idNbr ('%@', %lld,"
|
||||
@" 0x%.16"PRIx64", oldid=0x%.16"PRIx64")",
|
||||
urlString, idNbr, idNbr, oldIdNbr];
|
||||
if (softDeleted)
|
||||
[self logWithFormat: @"Attempt to register a soft-deleted %@", urlString];
|
||||
else
|
||||
[self errorWithFormat:
|
||||
@"attempt to double register an entry with idNbr ('%@', %lld,"
|
||||
@" 0x%.16"PRIx64", oldid=0x%.16"PRIx64")",
|
||||
urlString, idNbr, idNbr, oldIdNbr];
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = YES;
|
||||
// [self logWithFormat: @"registered url '%@' with id %lld (0x%.16"PRIx64")",
|
||||
// urlString, idNbr, idNbr];
|
||||
|
||||
@@ -245,7 +285,7 @@ MAPIStoreMappingKeyFromId (uint64_t idNbr)
|
||||
idNbr, [urlString UTF8String]);
|
||||
}
|
||||
|
||||
return rc;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) registerURLs: (NSArray *) urlStrings
|
||||
@@ -275,4 +315,13 @@ MAPIStoreMappingKeyFromId (uint64_t idNbr)
|
||||
idNbr, MAPISTORE_PERMANENT_DELETE);
|
||||
}
|
||||
|
||||
- (void) unregisterURLWithID: (uint64_t) idNbr
|
||||
andFlags: (uint8_t) flags
|
||||
{
|
||||
indexing->del_fmid(indexing, [username UTF8String],
|
||||
idNbr,
|
||||
(flags == MAPISTORE_SOFT_DELETE) ? MAPISTORE_SOFT_DELETE : MAPISTORE_PERMANENT_DELETE);
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -63,7 +63,7 @@
|
||||
withAID: (uint32_t) aid;
|
||||
- (int) getAttachmentTable: (MAPIStoreAttachmentTable **) tablePtr
|
||||
andRowCount: (uint32_t *) countPtr;
|
||||
- (int) setReadFlag: (uint8_t) flag;
|
||||
- (enum mapistore_error) setReadFlag: (uint8_t) flag;
|
||||
- (enum mapistore_error) saveMessage: (TALLOC_CTX *) memCtx;
|
||||
|
||||
- (NSArray *) activeContainerMessageTables;
|
||||
|
||||
@@ -178,56 +178,101 @@ rtf2html (NSData *compressedRTF)
|
||||
andColumns: (struct SPropTagArray *) columns
|
||||
{
|
||||
NSMutableDictionary *recipientProperties;
|
||||
enum MAPITAGS prop_tag;
|
||||
char *displayName = NULL;
|
||||
char *email = NULL;
|
||||
enum MAPI_OBJTYPE object_type = 0;
|
||||
char *smtpAddress = NULL;
|
||||
SOGoUser *recipientUser;
|
||||
NSUInteger count;
|
||||
NSString *recipientEmail = nil;
|
||||
NSString *recipientFullName = nil;
|
||||
id value;
|
||||
|
||||
recipientProperties = [NSMutableDictionary dictionaryWithCapacity: columns->cValues + 2];
|
||||
|
||||
for (count = 0; count < columns->cValues; count++)
|
||||
{
|
||||
prop_tag = columns->aulPropTag[count];
|
||||
switch(prop_tag) {
|
||||
case PidTagDisplayName:
|
||||
displayName = recipient->data[count];
|
||||
break;
|
||||
case PidTagEmailAddress:
|
||||
email = recipient->data[count];
|
||||
break;
|
||||
case PidTagObjectType:
|
||||
if (recipient->data[count])
|
||||
object_type = *((uint8_t*) recipient->data[count]);
|
||||
break;
|
||||
case PidTagSmtpAddress:
|
||||
smtpAddress = recipient->data[count];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (recipient->data[count])
|
||||
{
|
||||
value = NSObjectFromValuePointer (prop_tag,
|
||||
recipient->data[count]);
|
||||
if (value)
|
||||
[recipientProperties setObject: value
|
||||
forKey: MAPIPropertyKey (prop_tag)];
|
||||
}
|
||||
}
|
||||
|
||||
if (recipient->username)
|
||||
{
|
||||
value = [NSString stringWithUTF8String: recipient->username];
|
||||
[recipientProperties setObject: value forKey: @"x500dn"];
|
||||
}
|
||||
|
||||
if (object_type == MAPI_MAILUSER && recipient->username)
|
||||
{
|
||||
/* values from user object have priority over data sent by the client */
|
||||
recipientUser = [SOGoUser userWithLogin: [value lowercaseString]];
|
||||
if (recipientUser)
|
||||
{
|
||||
value = [recipientUser cn];
|
||||
if ([value length] > 0)
|
||||
[recipientProperties setObject: value forKey: @"fullName"];
|
||||
recipientFullName = value;
|
||||
|
||||
value = [[recipientUser allEmails] objectAtIndex: 0];
|
||||
if ([value length] > 0)
|
||||
[recipientProperties setObject: value forKey: @"email"];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (recipient->data[0])
|
||||
{
|
||||
value = [NSString stringWithUTF8String: recipient->data[0]];
|
||||
if ([value length] > 0)
|
||||
[recipientProperties setObject: value forKey: @"fullName"];
|
||||
}
|
||||
if (recipient->data[1])
|
||||
{
|
||||
value = [NSString stringWithUTF8String: recipient->data[1]];
|
||||
if ([value length] > 0)
|
||||
[recipientProperties setObject: value forKey: @"email"];
|
||||
}
|
||||
recipientEmail = value;
|
||||
}
|
||||
}
|
||||
|
||||
for (count = 0; count < columns->cValues; count++)
|
||||
/* If we do not have values from the user object we try to get them from the parameters */
|
||||
if (!recipientFullName && displayName)
|
||||
{
|
||||
if (recipient->data[count])
|
||||
{
|
||||
value = NSObjectFromValuePointer (columns->aulPropTag[count],
|
||||
recipient->data[count]);
|
||||
if (value)
|
||||
[recipientProperties setObject: value
|
||||
forKey: MAPIPropertyKey (columns->aulPropTag[count])];
|
||||
}
|
||||
value = [NSString stringWithUTF8String: displayName];
|
||||
if ([value length] > 0)
|
||||
recipientFullName = value;
|
||||
}
|
||||
|
||||
if (!recipientEmail && email)
|
||||
{
|
||||
value = [NSString stringWithUTF8String: email];
|
||||
if ([value length] > 0)
|
||||
recipientEmail = value;
|
||||
}
|
||||
|
||||
if (!recipientEmail && smtpAddress)
|
||||
{
|
||||
value = [NSString stringWithUTF8String: smtpAddress];
|
||||
if ([value length] > 0)
|
||||
recipientEmail = value;
|
||||
}
|
||||
|
||||
/* Now we can set the properties if we have them */
|
||||
if (recipientFullName)
|
||||
[recipientProperties setObject: recipientFullName forKey: @"fullName"];
|
||||
|
||||
if (recipientEmail)
|
||||
[recipientProperties setObject: recipientEmail forKey: @"email"];
|
||||
|
||||
return recipientProperties;
|
||||
}
|
||||
|
||||
@@ -465,16 +510,15 @@ rtf2html (NSData *compressedRTF)
|
||||
enum mapistore_error rc;
|
||||
NSArray *containerTables;
|
||||
NSUInteger count, max;
|
||||
struct mapistore_object_notification_parameters *notif_parameters;
|
||||
uint64_t folderId;
|
||||
struct mapistore_context *mstoreCtx;
|
||||
MAPIStoreContext *context;
|
||||
SOGoUser *ownerUser;
|
||||
BOOL userIsOwner;
|
||||
MAPIStoreMessage *mainMessage;
|
||||
|
||||
//[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__];
|
||||
|
||||
|
||||
containerTables = nil;
|
||||
max = 0;
|
||||
context = [self context];
|
||||
ownerUser = [[self userContext] sogoUser];
|
||||
userIsOwner = [[context activeUser] isEqual: ownerUser];
|
||||
@@ -496,47 +540,6 @@ rtf2html (NSData *compressedRTF)
|
||||
/* notifications */
|
||||
if ([container isKindOfClass: MAPIStoreFolderK])
|
||||
{
|
||||
folderId = [(MAPIStoreFolder *) container objectId];
|
||||
mstoreCtx = [[self context] connectionInfo]->mstore_ctx;
|
||||
|
||||
/* folder modified */
|
||||
notif_parameters
|
||||
= talloc_zero(memCtx, struct mapistore_object_notification_parameters);
|
||||
notif_parameters->object_id = folderId;
|
||||
if (isNew)
|
||||
{
|
||||
notif_parameters->tag_count = 3;
|
||||
notif_parameters->tags = talloc_array (notif_parameters,
|
||||
enum MAPITAGS, 3);
|
||||
notif_parameters->tags[0] = PR_CONTENT_COUNT;
|
||||
notif_parameters->tags[1] = PR_MESSAGE_SIZE;
|
||||
notif_parameters->tags[2] = PR_NORMAL_MESSAGE_SIZE;
|
||||
notif_parameters->new_message_count = true;
|
||||
notif_parameters->message_count
|
||||
= [[(MAPIStoreFolder *) container messageKeys] count] + 1;
|
||||
}
|
||||
mapistore_push_notification (mstoreCtx,
|
||||
MAPISTORE_FOLDER,
|
||||
MAPISTORE_OBJECT_MODIFIED,
|
||||
notif_parameters);
|
||||
talloc_free (notif_parameters);
|
||||
|
||||
/* message created */
|
||||
if (isNew)
|
||||
{
|
||||
notif_parameters
|
||||
= talloc_zero(memCtx,
|
||||
struct mapistore_object_notification_parameters);
|
||||
notif_parameters->object_id = [self objectId];
|
||||
notif_parameters->folder_id = folderId;
|
||||
|
||||
notif_parameters->tag_count = 0xffff;
|
||||
mapistore_push_notification (mstoreCtx,
|
||||
MAPISTORE_MESSAGE, MAPISTORE_OBJECT_CREATED,
|
||||
notif_parameters);
|
||||
talloc_free (notif_parameters);
|
||||
}
|
||||
|
||||
/* we ensure the table caches are loaded so that old and new state
|
||||
can be compared */
|
||||
containerTables = [self activeContainerMessageTables];
|
||||
@@ -546,11 +549,12 @@ rtf2html (NSData *compressedRTF)
|
||||
}
|
||||
|
||||
[self save: memCtx];
|
||||
/* We make sure that any change-related properties are removes from the
|
||||
/* We make sure that any change-related properties are removed from the
|
||||
properties dictionary, to make sure that related methods will be
|
||||
invoked the next time they are requested. */
|
||||
[properties removeObjectForKey: MAPIPropertyKey (PidTagChangeKey)];
|
||||
[properties removeObjectForKey: MAPIPropertyKey (PidTagChangeNumber)];
|
||||
[properties removeObjectForKey: MAPIPropertyKey (PidTagPredecessorChangeList)];
|
||||
|
||||
if ([container isKindOfClass: MAPIStoreFolderK])
|
||||
{
|
||||
@@ -782,7 +786,7 @@ rtf2html (NSData *compressedRTF)
|
||||
return [self getLongZero: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidTagSensitivity: (void **) data // TODO -> subclass in calendar
|
||||
- (int) getPidTagSensitivity: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getLongZero: data inMemCtx: memCtx];
|
||||
@@ -795,7 +799,7 @@ rtf2html (NSData *compressedRTF)
|
||||
TALLOC_CTX *localMemCtx;
|
||||
char *prefix, *normalizedSubject;
|
||||
|
||||
localMemCtx = talloc_zero (NULL, TALLOC_CTX);
|
||||
localMemCtx = talloc_zero (memCtx, TALLOC_CTX);
|
||||
if ([self getProperty: (void **) &prefix
|
||||
withTag: PidTagSubjectPrefix
|
||||
inMemCtx: localMemCtx]
|
||||
@@ -807,6 +811,8 @@ rtf2html (NSData *compressedRTF)
|
||||
if (rc == MAPISTORE_SUCCESS)
|
||||
*data = talloc_asprintf (memCtx, "%s%s", prefix, normalizedSubject);
|
||||
|
||||
talloc_free(localMemCtx);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -913,7 +919,7 @@ rtf2html (NSData *compressedRTF)
|
||||
return [self getNo: data inMemCtx: memCtx];;
|
||||
}
|
||||
|
||||
- (int) setReadFlag: (uint8_t) flag
|
||||
- (enum mapistore_error) setReadFlag: (uint8_t) flag
|
||||
{
|
||||
// [self subclassResponsibility: _cmd];
|
||||
|
||||
|
||||
@@ -87,58 +87,7 @@
|
||||
|
||||
- (void) notifyChangesForChild: (MAPIStoreMessage *) child
|
||||
{
|
||||
NSUInteger currentChildRow, newChildRow;
|
||||
NSArray *list;
|
||||
NSString *childName;
|
||||
struct mapistore_table_notification_parameters notif_parameters;
|
||||
struct mapistore_context *mstoreCtx;
|
||||
|
||||
mstoreCtx = [[(MAPIStoreFolder *) container context]
|
||||
connectionInfo]->mstore_ctx;
|
||||
|
||||
notif_parameters.table_type = tableType;
|
||||
notif_parameters.handle = handleId;
|
||||
notif_parameters.folder_id = [(MAPIStoreFolder *) container objectId];
|
||||
notif_parameters.object_id = [child objectId];
|
||||
notif_parameters.instance_id = 0; /* TODO: always 0 ? */
|
||||
|
||||
childName = [child nameInContainer];
|
||||
list = [self restrictedChildKeys];
|
||||
currentChildRow = [list indexOfObject: childName];
|
||||
notif_parameters.row_id = currentChildRow;
|
||||
|
||||
[self cleanupCaches];
|
||||
list = [self restrictedChildKeys];
|
||||
newChildRow = [list indexOfObject: childName];
|
||||
|
||||
if (currentChildRow == NSNotFound)
|
||||
{
|
||||
if (newChildRow != NSNotFound)
|
||||
{
|
||||
notif_parameters.row_id = newChildRow;
|
||||
mapistore_push_notification (mstoreCtx,
|
||||
MAPISTORE_TABLE,
|
||||
MAPISTORE_OBJECT_CREATED,
|
||||
¬if_parameters);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (newChildRow == NSNotFound)
|
||||
mapistore_push_notification (mstoreCtx,
|
||||
MAPISTORE_TABLE,
|
||||
MAPISTORE_OBJECT_DELETED,
|
||||
¬if_parameters);
|
||||
else
|
||||
{
|
||||
/* the fact that the row order has changed has no impact here */
|
||||
notif_parameters.row_id = newChildRow;
|
||||
mapistore_push_notification (mstoreCtx,
|
||||
MAPISTORE_TABLE,
|
||||
MAPISTORE_OBJECT_MODIFIED,
|
||||
¬if_parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -45,7 +45,8 @@
|
||||
|
||||
context = talloc_zero(memCtx, struct mapistore_contexts_list);
|
||||
context->url = talloc_asprintf (context, "sogo://%s@notes/",
|
||||
[userName UTF8String]);
|
||||
[[userName stringByReplacingOccurrencesOfString: @"@"
|
||||
withString: @"%40"] UTF8String]);
|
||||
// context->name = "Notes personnelles";
|
||||
context->main_folder = true;
|
||||
context->role = MAPISTORE_NOTES_ROLE;
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSCalendarDate.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSTimeZone.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <SOGo/SOGoObject.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
@@ -245,17 +244,16 @@ static Class NSExceptionK, MAPIStoreFolderK;
|
||||
struct SPropValue *cValue;
|
||||
NSUInteger counter;
|
||||
NSMutableDictionary *newProperties;
|
||||
NSTimeZone *tz;
|
||||
NSInteger tzOffset;
|
||||
id value;
|
||||
|
||||
tz = nil;
|
||||
|
||||
newProperties = [NSMutableDictionary dictionaryWithCapacity: aRow->cValues];
|
||||
for (counter = 0; counter < aRow->cValues; counter++)
|
||||
{
|
||||
cValue = aRow->lpProps + counter;
|
||||
value = NSObjectFromSPropValue (cValue);
|
||||
if (value == nil)
|
||||
continue;
|
||||
|
||||
switch (cValue->ulPropTag & 0xffff)
|
||||
{
|
||||
case PT_STRING8:
|
||||
@@ -264,16 +262,6 @@ static Class NSExceptionK, MAPIStoreFolderK;
|
||||
@"attempting to set string property as PR_STRING8: %.8x",
|
||||
cValue->ulPropTag];
|
||||
break;
|
||||
case PT_SYSTIME:
|
||||
if (!tz)
|
||||
{
|
||||
tz = [[self userContext] timeZone];
|
||||
tzOffset = -[tz secondsFromGMT];
|
||||
}
|
||||
value = [value addYear: 0 month: 0 day: 0
|
||||
hour: 0 minute: 0 second: tzOffset];
|
||||
[value setTimeZone: tz];
|
||||
break;
|
||||
}
|
||||
[newProperties setObject: value
|
||||
forKey: MAPIPropertyKey (cValue->ulPropTag)];
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
else
|
||||
{
|
||||
connInfo = [(MAPIStoreContext *) [container context] connectionInfo];
|
||||
entryId = MAPIStoreInternalEntryId (connInfo->sam_ctx, userId);
|
||||
entryId = MAPIStoreInternalEntryId (connInfo, userId);
|
||||
}
|
||||
*data = [entryId asBinaryInMemCtx: memCtx];
|
||||
|
||||
|
||||
@@ -27,8 +27,7 @@
|
||||
|
||||
#import <NGCards/iCalCalendar.h>
|
||||
#import <NGCards/iCalRecurrenceRule.h>
|
||||
|
||||
@class NSTimeZone;
|
||||
#import <NGCards/iCalTimeZone.h>
|
||||
|
||||
@class iCalEvent;
|
||||
@class iCalRepeatableEntityObject;
|
||||
@@ -41,7 +40,10 @@
|
||||
@interface iCalCalendar (MAPIStoreRecurrence)
|
||||
|
||||
- (void) setupRecurrenceWithMasterEntity: (iCalRepeatableEntityObject *) entity
|
||||
fromRecurrencePattern: (struct RecurrencePattern *) rp;
|
||||
fromRecurrencePattern: (struct RecurrencePattern *) rp
|
||||
withExceptions: (struct ExceptionInfo *) exInfos
|
||||
andExceptionCount: (uint16_t) exInfoCount
|
||||
inTimeZone: (iCalTimeZone *) tz;
|
||||
|
||||
@end
|
||||
|
||||
@@ -49,7 +51,6 @@
|
||||
|
||||
- (void) fillRecurrencePattern: (struct RecurrencePattern *) rp
|
||||
withEvent: (iCalEvent *) event
|
||||
inTimeZone: (NSTimeZone *) timeZone
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
|
||||
@end
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#import <NGCards/iCalRepeatableEntityObject.h>
|
||||
#import <NGCards/iCalRecurrenceRule.h>
|
||||
#import <NGCards/iCalTimeZone.h>
|
||||
#import <NGCards/iCalTimeZonePeriod.h>
|
||||
|
||||
#import "NSDate+MAPIStore.h"
|
||||
#import "MAPIStoreRecurrenceUtils.h"
|
||||
@@ -48,6 +49,10 @@
|
||||
|
||||
- (void) setupRecurrenceWithMasterEntity: (iCalRepeatableEntityObject *) entity
|
||||
fromRecurrencePattern: (struct RecurrencePattern *) rp
|
||||
withExceptions: (struct ExceptionInfo *) exInfos
|
||||
andExceptionCount: (uint16_t) exInfoCount
|
||||
inTimeZone: (iCalTimeZone *) tz
|
||||
|
||||
{
|
||||
NSCalendarDate *startDate, *olEndDate, *untilDate, *exDate;
|
||||
NSString *monthDay, *month;
|
||||
@@ -58,7 +63,7 @@
|
||||
iCalWeekOccurrence weekOccurrence;
|
||||
iCalWeekOccurrences dayMaskDays;
|
||||
NSUInteger count, max;
|
||||
NSInteger bySetPos;
|
||||
NSInteger bySetPos, tzOffset;
|
||||
unsigned char maskValue;
|
||||
|
||||
[entity removeAllRecurrenceRules];
|
||||
@@ -214,34 +219,43 @@
|
||||
|
||||
/* exception dates:
|
||||
- take all deleted instances
|
||||
- remove all modified instances from the above set
|
||||
- remove all modified instances available in ExceptionInfo from the above set
|
||||
- add remaining instances, in chronological order
|
||||
*/
|
||||
exceptionDates = [NSMutableSet set];
|
||||
for (count = 0; count < rp->DeletedInstanceCount; count++)
|
||||
{
|
||||
exDate
|
||||
= [NSDate dateFromMinutesSince1601: rp->DeletedInstanceDates[count]];
|
||||
exDate = [exDate hour: [startDate hourOfDay]
|
||||
minute: [startDate minuteOfHour]
|
||||
second: [startDate secondOfMinute]];
|
||||
[exceptionDates addObject: exDate];
|
||||
}
|
||||
for (count = 0; count < rp->ModifiedInstanceCount; count++)
|
||||
{
|
||||
exDate
|
||||
= [NSDate dateFromMinutesSince1601: rp->ModifiedInstanceDates[count]];
|
||||
exDate = [exDate hour: [startDate hourOfDay]
|
||||
minute: [startDate minuteOfHour]
|
||||
second: [startDate secondOfMinute]];
|
||||
[exceptionDates removeObject: exDate];
|
||||
}
|
||||
|
||||
realExDates = [[exceptionDates allObjects]
|
||||
sortedArrayUsingSelector: @selector (compare:)];
|
||||
max = [realExDates count];
|
||||
for (count = 0; count < max; count++)
|
||||
[entity addToExceptionDates: [realExDates objectAtIndex: count]];
|
||||
/* Heuristic to avoid these loops */
|
||||
if (rp->DeletedInstanceCount != rp->ModifiedInstanceCount) {
|
||||
exceptionDates = [NSMutableSet set];
|
||||
for (count = 0; count < rp->DeletedInstanceCount; count++)
|
||||
{
|
||||
exDate
|
||||
= [NSDate dateFromMinutesSince1601: rp->DeletedInstanceDates[count]];
|
||||
exDate = [exDate hour: [startDate hourOfDay]
|
||||
minute: [startDate minuteOfHour]
|
||||
second: [startDate secondOfMinute]];
|
||||
[exceptionDates addObject: exDate];
|
||||
}
|
||||
/* Read the exceptions to remove the instances that are modified and not deleted */
|
||||
if (exInfos && exInfoCount > 0)
|
||||
{
|
||||
for (count = 0; count < exInfoCount; count++)
|
||||
{
|
||||
/* The OriginalStartDate is in local time */
|
||||
exDate = [NSDate dateFromMinutesSince1601: exInfos[count].OriginalStartDate];
|
||||
tzOffset = -[[tz periodForDate: exDate] secondsOffsetFromGMT];
|
||||
exDate = [exDate dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: tzOffset];
|
||||
[exceptionDates removeObject: exDate];
|
||||
}
|
||||
}
|
||||
|
||||
realExDates = [[exceptionDates allObjects]
|
||||
sortedArrayUsingSelector: @selector (compare:)];
|
||||
max = [realExDates count];
|
||||
for (count = 0; count < max; count++)
|
||||
[entity addToExceptionDates: [realExDates objectAtIndex: count]];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -250,7 +264,6 @@
|
||||
|
||||
- (void) fillRecurrencePattern: (struct RecurrencePattern *) rp
|
||||
withEvent: (iCalEvent *) event
|
||||
inTimeZone: (NSTimeZone *) timeZone
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
iCalRecurrenceFrequency freq;
|
||||
@@ -266,10 +279,8 @@
|
||||
NSMutableArray *deletedDates, *modifiedDates;
|
||||
|
||||
startDate = [event firstRecurrenceStartDate];
|
||||
[startDate setTimeZone: timeZone];
|
||||
endDate = [event lastPossibleRecurrenceStartDate];
|
||||
[endDate setTimeZone: timeZone];
|
||||
|
||||
|
||||
rp->ReaderVersion = 0x3004;
|
||||
rp->WriterVersion = 0x3004;
|
||||
|
||||
@@ -312,15 +323,25 @@
|
||||
rp->RecurFrequency = RecurFrequency_Weekly;
|
||||
rp->PatternType = PatternType_Week;
|
||||
rp->Period = repeatInterval;
|
||||
|
||||
dayOfWeek = [startDate dayOfWeek];
|
||||
|
||||
mask = 0;
|
||||
byDayMask = [self byDayMask];
|
||||
for (count = 0; count < 7; count++)
|
||||
if ([byDayMask occursOnDay: count])
|
||||
mask |= 1 << count;
|
||||
if (byDayMask)
|
||||
{
|
||||
for (count = 0; count < 7; count++)
|
||||
if ([byDayMask occursOnDay: count])
|
||||
mask |= 1 << count;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set the recurrence pattern using start date */
|
||||
mask |= 1 << dayOfWeek;
|
||||
}
|
||||
rp->PatternTypeSpecific.WeekRecurrencePattern = mask;
|
||||
|
||||
/* FirstDateTime */
|
||||
dayOfWeek = [startDate dayOfWeek];
|
||||
if (dayOfWeek)
|
||||
beginOfWeek = [startDate dateByAddingYears: 0 months: 0
|
||||
days: -dayOfWeek
|
||||
|
||||
+89
-149
@@ -47,6 +47,7 @@
|
||||
#import "NSObject+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
#include <libmapi/libmapi.h>
|
||||
#include <mapistore/mapistore.h>
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
#include <execinfo.h>
|
||||
@@ -58,22 +59,27 @@ static BOOL initialization_done = NO;
|
||||
#define NS_CURRENT_THREAD_REGISTER() \
|
||||
BOOL __nsrct_thread_registered = GSRegisterCurrentThread(); \
|
||||
if (!initialization_done) { \
|
||||
DEBUG(5, ("[SOGo: %s:%d] You should call sogo_backend_init() first. Current thread: %p, pid: %d\n", \
|
||||
__FUNCTION__, __LINE__, GSCurrentThread(), getpid())); \
|
||||
}
|
||||
#define NS_CURRENT_THREAD_TRY_UNREGISTER() \
|
||||
OC_DEBUG(5, "[SOGo] You should call sogo_backend_init() first. Current thread: %p, pid: %d\n", \
|
||||
GSCurrentThread(), getpid()); \
|
||||
} \
|
||||
OC_DEBUG(5, "[SOGo] --->");
|
||||
|
||||
#define NS_CURRENT_THREAD_TRY_UNREGISTER(rc) \
|
||||
if (__nsrct_thread_registered) { \
|
||||
GSUnregisterCurrentThread(); \
|
||||
}
|
||||
} \
|
||||
OC_DEBUG(6, "[SOGo] <--- [%s]", mapistore_errstr (rc));
|
||||
|
||||
#define TRYCATCH_START @try {
|
||||
#define TRYCATCH_END(pool) \
|
||||
} @catch (NSException * e) { \
|
||||
enum mapistore_error ret = sogo_backend_handle_objc_exception(e, __PRETTY_FUNCTION__, __LINE__); \
|
||||
mapiapp_cleanup(); \
|
||||
[pool release]; \
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(); \
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(ret); \
|
||||
return ret; \
|
||||
}
|
||||
} \
|
||||
mapiapp_cleanup();
|
||||
|
||||
|
||||
static enum mapistore_error
|
||||
@@ -144,7 +150,7 @@ sogo_backend_init (void)
|
||||
GSRegisterCurrentThread();
|
||||
|
||||
if (initialization_done) {
|
||||
DEBUG(0, ("SOGo backend already initialized.\n"));
|
||||
OC_DEBUG(5, "[SOGo] SOGo backend already initialized.\n");
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -189,18 +195,34 @@ sogo_backend_init (void)
|
||||
|
||||
[pool release];
|
||||
|
||||
DEBUG(0, ("[SOGo: %s:%d] backend init SUCCESS. Current thread: %p, pid: %d\n", __FUNCTION__, __LINE__, GSCurrentThread(), getpid()));
|
||||
OC_DEBUG(5, "[SOGo] backend init SUCCESS. Current thread: %p, pid: %d\n", GSCurrentThread(), getpid());
|
||||
initialization_done = YES;
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
\details Cleanup operation to execute after an action has been performed
|
||||
so there won't be any conflicts with future calls.
|
||||
In practice this will deactivate the current user context set on MAPIApp
|
||||
(which is the current WOApplication), this means two things: (1) set nil
|
||||
as current user context on MAPIApp and (2) remove woContext from current
|
||||
thread dictionary (this is used on WOContext.m).
|
||||
*/
|
||||
static void mapiapp_cleanup(void)
|
||||
{
|
||||
Class MAPIApplicationK;
|
||||
MAPIApplicationK = NSClassFromString (@"MAPIApplication");
|
||||
if (MAPIApplicationK)
|
||||
[[MAPIApplicationK application] cleanup];
|
||||
}
|
||||
|
||||
/**
|
||||
\details Create a connection context to the sogo backend
|
||||
|
||||
\param mem_ctx pointer to the memory context
|
||||
\param uri pointer to the sogo path
|
||||
\param private_data pointer to the private backend context
|
||||
\param private_data pointer to the private backend context
|
||||
*/
|
||||
|
||||
static enum mapistore_error
|
||||
@@ -213,8 +235,6 @@ sogo_backend_create_context(TALLOC_CTX *mem_ctx,
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
DEBUG(0, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
NS_CURRENT_THREAD_REGISTER();
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
@@ -233,7 +253,7 @@ sogo_backend_create_context(TALLOC_CTX *mem_ctx,
|
||||
rc = MAPISTORE_ERROR;
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -250,8 +270,6 @@ sogo_backend_create_root_folder (const char *username,
|
||||
NSString *mapistoreUri;
|
||||
int rc;
|
||||
|
||||
DEBUG(0, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
NS_CURRENT_THREAD_REGISTER();
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
@@ -273,7 +291,7 @@ sogo_backend_create_root_folder (const char *username,
|
||||
rc = MAPISTORE_ERROR;
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -287,8 +305,6 @@ sogo_backend_list_contexts(const char *username, struct indexing_context *indexi
|
||||
NSString *userName;
|
||||
int rc;
|
||||
|
||||
DEBUG(0, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
NS_CURRENT_THREAD_REGISTER();
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
@@ -306,7 +322,7 @@ sogo_backend_list_contexts(const char *username, struct indexing_context *indexi
|
||||
rc = MAPISTORE_ERROR;
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -335,8 +351,6 @@ sogo_context_get_path(void *backend_object, TALLOC_CTX *mem_ctx,
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (backend_object)
|
||||
{
|
||||
wrapper = backend_object;
|
||||
@@ -349,7 +363,7 @@ sogo_context_get_path(void *backend_object, TALLOC_CTX *mem_ctx,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -369,8 +383,6 @@ sogo_context_get_root_folder(void *backend_object, TALLOC_CTX *mem_ctx,
|
||||
MAPIStoreFolder *folder;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (backend_object)
|
||||
{
|
||||
wrapper = backend_object;
|
||||
@@ -385,7 +397,7 @@ sogo_context_get_root_folder(void *backend_object, TALLOC_CTX *mem_ctx,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -412,8 +424,6 @@ sogo_folder_open_folder(void *folder_object, TALLOC_CTX *mem_ctx, uint64_t fid,
|
||||
MAPIStoreFolder *folder, *childFolder;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (folder_object)
|
||||
{
|
||||
wrapper = folder_object;
|
||||
@@ -429,7 +439,7 @@ sogo_folder_open_folder(void *folder_object, TALLOC_CTX *mem_ctx, uint64_t fid,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -441,7 +451,7 @@ sogo_folder_open_folder(void *folder_object, TALLOC_CTX *mem_ctx, uint64_t fid,
|
||||
|
||||
/**
|
||||
\details Create a folder in the sogo backend
|
||||
|
||||
|
||||
\param private_data pointer to the current sogo context
|
||||
|
||||
\return MAPISTORE_SUCCESS on success, otherwise MAPISTORE_ERROR
|
||||
@@ -456,8 +466,6 @@ sogo_folder_create_folder(void *folder_object, TALLOC_CTX *mem_ctx,
|
||||
MAPIStoreFolder *folder, *childFolder;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (folder_object)
|
||||
{
|
||||
wrapper = folder_object;
|
||||
@@ -472,7 +480,7 @@ sogo_folder_create_folder(void *folder_object, TALLOC_CTX *mem_ctx,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -499,8 +507,6 @@ sogo_folder_delete(void *folder_object)
|
||||
MAPIStoreFolder *folder;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (folder_object)
|
||||
{
|
||||
wrapper = folder_object;
|
||||
@@ -513,7 +519,7 @@ sogo_folder_delete(void *folder_object)
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -531,8 +537,6 @@ sogo_folder_get_child_count(void *folder_object, enum mapistore_table_type table
|
||||
MAPIStoreFolder *folder;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (folder_object)
|
||||
{
|
||||
wrapper = folder_object;
|
||||
@@ -545,7 +549,7 @@ sogo_folder_get_child_count(void *folder_object, enum mapistore_table_type table
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -567,8 +571,6 @@ sogo_folder_open_message(void *folder_object,
|
||||
MAPIStoreMessage *message;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (folder_object)
|
||||
{
|
||||
wrapper = folder_object;
|
||||
@@ -586,7 +588,7 @@ sogo_folder_open_message(void *folder_object,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -609,8 +611,6 @@ sogo_folder_create_message(void *folder_object,
|
||||
MAPIStoreMessage *message;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (folder_object)
|
||||
{
|
||||
wrapper = folder_object;
|
||||
@@ -621,13 +621,13 @@ sogo_folder_create_message(void *folder_object,
|
||||
TRYCATCH_START
|
||||
rc = [folder createMessage: &message
|
||||
withMID: mid
|
||||
isAssociated: associated];
|
||||
isAssociated: associated];
|
||||
if (rc == MAPISTORE_SUCCESS)
|
||||
*message_object = [message tallocWrapper: mem_ctx];
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -645,8 +645,6 @@ sogo_folder_delete_message(void *folder_object, uint64_t mid, uint8_t flags)
|
||||
MAPIStoreFolder *folder;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (folder_object)
|
||||
{
|
||||
wrapper = folder_object;
|
||||
@@ -659,7 +657,7 @@ sogo_folder_delete_message(void *folder_object, uint64_t mid, uint8_t flags)
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -676,6 +674,7 @@ sogo_folder_move_copy_messages(void *folder_object,
|
||||
uint32_t mid_count,
|
||||
uint64_t *src_mids, uint64_t *t_mids,
|
||||
struct Binary_r **target_change_keys,
|
||||
struct Binary_r **target_predecessor_change_lists,
|
||||
uint8_t want_copy)
|
||||
{
|
||||
MAPIStoreFolder *sourceFolder, *targetFolder;
|
||||
@@ -683,8 +682,6 @@ sogo_folder_move_copy_messages(void *folder_object,
|
||||
struct MAPIStoreTallocWrapper *wrapper;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (folder_object)
|
||||
{
|
||||
wrapper = folder_object;
|
||||
@@ -702,12 +699,13 @@ sogo_folder_move_copy_messages(void *folder_object,
|
||||
fromFolder: sourceFolder
|
||||
withMIDs: t_mids
|
||||
andChangeKeys: target_change_keys
|
||||
andPredecessorChangeLists: target_predecessor_change_lists
|
||||
wantCopy: want_copy
|
||||
inMemCtx: mem_ctx];
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -727,8 +725,6 @@ sogo_folder_move_folder(void *folder_object, void *target_folder_object,
|
||||
struct MAPIStoreTallocWrapper *wrapper;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (folder_object)
|
||||
{
|
||||
wrapper = folder_object;
|
||||
@@ -757,7 +753,7 @@ sogo_folder_move_folder(void *folder_object, void *target_folder_object,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -777,8 +773,6 @@ sogo_folder_copy_folder(void *folder_object, void *target_folder_object, TALLOC_
|
||||
struct MAPIStoreTallocWrapper *wrapper;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (folder_object)
|
||||
{
|
||||
wrapper = folder_object;
|
||||
@@ -801,7 +795,7 @@ sogo_folder_copy_folder(void *folder_object, void *target_folder_object, TALLOC_
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -821,8 +815,6 @@ sogo_folder_get_deleted_fmids(void *folder_object, TALLOC_CTX *mem_ctx,
|
||||
MAPIStoreFolder *folder;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (folder_object)
|
||||
{
|
||||
wrapper = folder_object;
|
||||
@@ -839,7 +831,7 @@ sogo_folder_get_deleted_fmids(void *folder_object, TALLOC_CTX *mem_ctx,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -860,8 +852,6 @@ sogo_folder_open_table(void *folder_object, TALLOC_CTX *mem_ctx,
|
||||
MAPIStoreTable *table;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (folder_object)
|
||||
{
|
||||
wrapper = folder_object;
|
||||
@@ -879,7 +869,7 @@ sogo_folder_open_table(void *folder_object, TALLOC_CTX *mem_ctx,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -899,8 +889,6 @@ sogo_folder_modify_permissions(void *folder_object, uint8_t flags,
|
||||
MAPIStoreFolder *folder;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (folder_object)
|
||||
{
|
||||
wrapper = folder_object;
|
||||
@@ -915,7 +903,7 @@ sogo_folder_modify_permissions(void *folder_object, uint8_t flags,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -933,8 +921,6 @@ sogo_folder_preload_message_bodies(void *folder_object, enum mapistore_table_typ
|
||||
MAPIStoreFolder *folder;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (folder_object)
|
||||
{
|
||||
wrapper = folder_object;
|
||||
@@ -948,7 +934,7 @@ sogo_folder_preload_message_bodies(void *folder_object, enum mapistore_table_typ
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -968,8 +954,6 @@ sogo_message_get_message_data(void *message_object,
|
||||
MAPIStoreMessage *message;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (message_object)
|
||||
{
|
||||
wrapper = message_object;
|
||||
@@ -983,8 +967,8 @@ sogo_message_get_message_data(void *message_object,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1003,8 +987,6 @@ sogo_message_create_attachment (void *message_object, TALLOC_CTX *mem_ctx, void
|
||||
MAPIStoreAttachment *attachment;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (message_object)
|
||||
{
|
||||
wrapper = message_object;
|
||||
@@ -1016,11 +998,10 @@ sogo_message_create_attachment (void *message_object, TALLOC_CTX *mem_ctx, void
|
||||
rc = [message createAttachment: &attachment inAID: aidp];
|
||||
if (rc == MAPISTORE_SUCCESS)
|
||||
*attachment_object = [attachment tallocWrapper: mem_ctx];
|
||||
// [context tearDownRequest];
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1040,8 +1021,6 @@ sogo_message_open_attachment (void *message_object, TALLOC_CTX *mem_ctx,
|
||||
MAPIStoreAttachment *attachment;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (message_object)
|
||||
{
|
||||
wrapper = message_object;
|
||||
@@ -1053,11 +1032,10 @@ sogo_message_open_attachment (void *message_object, TALLOC_CTX *mem_ctx,
|
||||
rc = [message getAttachment: &attachment withAID: aid];
|
||||
if (rc == MAPISTORE_SUCCESS)
|
||||
*attachment_object = [attachment tallocWrapper: mem_ctx];
|
||||
// [context tearDownRequest];
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1076,8 +1054,6 @@ sogo_message_get_attachment_table (void *message_object, TALLOC_CTX *mem_ctx, vo
|
||||
MAPIStoreAttachmentTable *table;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (message_object)
|
||||
{
|
||||
wrapper = message_object;
|
||||
@@ -1090,11 +1066,10 @@ sogo_message_get_attachment_table (void *message_object, TALLOC_CTX *mem_ctx, vo
|
||||
andRowCount: row_count];
|
||||
if (rc == MAPISTORE_SUCCESS)
|
||||
*table_object = [table tallocWrapper: mem_ctx];
|
||||
// [context tearDownRequest];
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1115,8 +1090,6 @@ sogo_message_modify_recipients (void *message_object,
|
||||
MAPIStoreMessage *message;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (message_object)
|
||||
{
|
||||
wrapper = message_object;
|
||||
@@ -1128,11 +1101,10 @@ sogo_message_modify_recipients (void *message_object,
|
||||
rc = [message modifyRecipientsWithRecipients: recipients
|
||||
andCount: count
|
||||
andColumns: columns];
|
||||
// [context tearDownRequest];
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1148,9 +1120,7 @@ sogo_message_set_read_flag (void *message_object, uint8_t flag)
|
||||
struct MAPIStoreTallocWrapper *wrapper;
|
||||
NSAutoreleasePool *pool;
|
||||
MAPIStoreMessage *message;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
enum mapistore_error rc;
|
||||
|
||||
if (message_object)
|
||||
{
|
||||
@@ -1161,11 +1131,10 @@ sogo_message_set_read_flag (void *message_object, uint8_t flag)
|
||||
|
||||
TRYCATCH_START
|
||||
rc = [message setReadFlag: flag];
|
||||
// [context tearDownRequest];
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1183,8 +1152,6 @@ sogo_message_save (void *message_object, TALLOC_CTX *mem_ctx)
|
||||
MAPIStoreMessage *message;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (message_object)
|
||||
{
|
||||
wrapper = message_object;
|
||||
@@ -1194,11 +1161,10 @@ sogo_message_save (void *message_object, TALLOC_CTX *mem_ctx)
|
||||
|
||||
TRYCATCH_START
|
||||
rc = [message saveMessage: mem_ctx];
|
||||
// [context tearDownRequest];
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1216,8 +1182,6 @@ sogo_message_submit (void *message_object, enum SubmitFlags flags)
|
||||
MAPIStoreMailVolatileMessage *message;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (message_object)
|
||||
{
|
||||
wrapper = message_object;
|
||||
@@ -1227,11 +1191,10 @@ sogo_message_submit (void *message_object, enum SubmitFlags flags)
|
||||
|
||||
TRYCATCH_START
|
||||
rc = [message submitWithFlags: flags];
|
||||
// [context tearDownRequest];
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1254,8 +1217,6 @@ sogo_message_attachment_open_embedded_message (void *attachment_object,
|
||||
MAPIStoreEmbeddedMessage *message;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (attachment_object)
|
||||
{
|
||||
wrapper = attachment_object;
|
||||
@@ -1273,7 +1234,7 @@ sogo_message_attachment_open_embedded_message (void *attachment_object,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1295,8 +1256,6 @@ sogo_message_attachment_create_embedded_message (void *attachment_object,
|
||||
MAPIStoreEmbeddedMessage *message;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (attachment_object)
|
||||
{
|
||||
wrapper = attachment_object;
|
||||
@@ -1313,7 +1272,7 @@ sogo_message_attachment_create_embedded_message (void *attachment_object,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1331,8 +1290,6 @@ static enum mapistore_error sogo_table_get_available_properties(void *table_obje
|
||||
MAPIStoreTable *table;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (table_object)
|
||||
{
|
||||
wrapper = table_object;
|
||||
@@ -1345,7 +1302,7 @@ static enum mapistore_error sogo_table_get_available_properties(void *table_obje
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1363,8 +1320,6 @@ sogo_table_set_columns (void *table_object, uint16_t count, enum MAPITAGS *prope
|
||||
MAPIStoreTable *table;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (table_object)
|
||||
{
|
||||
wrapper = table_object;
|
||||
@@ -1378,7 +1333,7 @@ sogo_table_set_columns (void *table_object, uint16_t count, enum MAPITAGS *prope
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1396,8 +1351,6 @@ sogo_table_set_restrictions (void *table_object, struct mapi_SRestriction *restr
|
||||
MAPIStoreTable *table;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (table_object)
|
||||
{
|
||||
wrapper = table_object;
|
||||
@@ -1413,7 +1366,7 @@ sogo_table_set_restrictions (void *table_object, struct mapi_SRestriction *restr
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1431,8 +1384,6 @@ sogo_table_set_sort_order (void *table_object, struct SSortOrderSet *sort_order,
|
||||
MAPIStoreTable *table;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (table_object)
|
||||
{
|
||||
wrapper = table_object;
|
||||
@@ -1448,7 +1399,7 @@ sogo_table_set_sort_order (void *table_object, struct SSortOrderSet *sort_order,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1468,8 +1419,6 @@ sogo_table_get_row (void *table_object, TALLOC_CTX *mem_ctx,
|
||||
MAPIStoreTable *table;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (table_object)
|
||||
{
|
||||
wrapper = table_object;
|
||||
@@ -1483,7 +1432,7 @@ sogo_table_get_row (void *table_object, TALLOC_CTX *mem_ctx,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1503,8 +1452,6 @@ sogo_table_get_row_count (void *table_object,
|
||||
MAPIStoreTable *table;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (table_object)
|
||||
{
|
||||
wrapper = table_object;
|
||||
@@ -1518,7 +1465,7 @@ sogo_table_get_row_count (void *table_object,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1536,8 +1483,6 @@ sogo_table_handle_destructor (void *table_object, uint32_t handle_id)
|
||||
MAPIStoreTable *table;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (table_object)
|
||||
{
|
||||
wrapper = table_object;
|
||||
@@ -1550,8 +1495,8 @@ sogo_table_handle_destructor (void *table_object, uint32_t handle_id)
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1570,8 +1515,6 @@ static enum mapistore_error sogo_properties_get_available_properties(void *objec
|
||||
MAPIStoreObject *propObject;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (object)
|
||||
{
|
||||
wrapper = object;
|
||||
@@ -1584,7 +1527,7 @@ static enum mapistore_error sogo_properties_get_available_properties(void *objec
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1605,8 +1548,6 @@ sogo_properties_get_properties (void *object,
|
||||
MAPIStoreObject *propObject;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (object)
|
||||
{
|
||||
wrapper = object;
|
||||
@@ -1621,7 +1562,7 @@ sogo_properties_get_properties (void *object,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1639,8 +1580,6 @@ sogo_properties_set_properties (void *object, struct SRow *aRow)
|
||||
MAPIStoreObject *propObject;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (object)
|
||||
{
|
||||
wrapper = object;
|
||||
@@ -1653,7 +1592,7 @@ sogo_properties_set_properties (void *object, struct SRow *aRow)
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1664,18 +1603,16 @@ sogo_properties_set_properties (void *object, struct SRow *aRow)
|
||||
}
|
||||
|
||||
static enum mapistore_error
|
||||
sogo_manager_generate_uri (TALLOC_CTX *mem_ctx,
|
||||
const char *user,
|
||||
const char *folder,
|
||||
const char *message,
|
||||
sogo_manager_generate_uri (TALLOC_CTX *mem_ctx,
|
||||
const char *user,
|
||||
const char *folder,
|
||||
const char *message,
|
||||
const char *rootURI,
|
||||
char **uri)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
NSString *partialURLString, *username, *directory;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
if (uri == NULL) return MAPISTORE_ERR_INVALID_PARAMETER;
|
||||
|
||||
/* This fixes a crash occurring during the instantiation of the
|
||||
@@ -1693,7 +1630,10 @@ sogo_manager_generate_uri (TALLOC_CTX *mem_ctx,
|
||||
username = [NSString stringWithUTF8String: (user ? user : "*")];
|
||||
/* Do proper directory lookup here */
|
||||
directory = [NSString stringWithUTF8String: (folder ? folder : "*")];
|
||||
partialURLString = [NSString stringWithFormat: @"sogo://%@:*@%@", username, directory];
|
||||
partialURLString = [NSString stringWithFormat: @"sogo://%@:*@%@",
|
||||
[username stringByReplacingOccurrencesOfString: @"@"
|
||||
withString: @"%40"],
|
||||
directory];
|
||||
}
|
||||
if (![partialURLString hasSuffix: @"/"])
|
||||
partialURLString = [partialURLString stringByAppendingString: @"/"];
|
||||
@@ -1706,7 +1646,7 @@ sogo_manager_generate_uri (TALLOC_CTX *mem_ctx,
|
||||
TRYCATCH_END(pool)
|
||||
|
||||
[pool release];
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER();
|
||||
NS_CURRENT_THREAD_TRY_UNREGISTER(MAPISTORE_SUCCESS);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
@@ -1718,9 +1658,9 @@ sogo_manager_generate_uri (TALLOC_CTX *mem_ctx,
|
||||
*/
|
||||
int mapistore_init_backend(void)
|
||||
{
|
||||
struct mapistore_backend backend;
|
||||
int ret;
|
||||
static BOOL registered = NO;
|
||||
struct mapistore_backend backend;
|
||||
int ret;
|
||||
static BOOL registered = NO;
|
||||
|
||||
if (registered)
|
||||
ret = MAPISTORE_SUCCESS;
|
||||
@@ -1776,7 +1716,7 @@ int mapistore_init_backend(void)
|
||||
/* Register ourselves with the MAPISTORE subsystem */
|
||||
ret = mapistore_backend_register (&backend);
|
||||
if (ret != MAPISTORE_SUCCESS)
|
||||
DEBUG(0, ("Failed to register the '%s' mapistore backend!\n", backend.backend.name));
|
||||
OC_DEBUG(0, "[SOGo] Failed to register the '%s' mapistore backend!\n", backend.backend.name);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -197,6 +197,7 @@ static Class MAPIStoreFolderK;
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
int rc;
|
||||
struct mapistore_connection_info *connInfo;
|
||||
uint64_t obVersion;
|
||||
|
||||
obVersion = [self objectVersion];
|
||||
@@ -204,8 +205,9 @@ static Class MAPIStoreFolderK;
|
||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
else
|
||||
{
|
||||
connInfo = [[self context] connectionInfo];
|
||||
*data = MAPILongLongValue (memCtx, ((obVersion << 16)
|
||||
| 0x0001));
|
||||
| connInfo->repl_id));
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
|
||||
@class NSString;
|
||||
|
||||
struct ldb_context;
|
||||
#include <mapistore/mapistore.h>
|
||||
|
||||
NSString *MAPIStoreSamDBUserAttribute (struct ldb_context *samCtx,
|
||||
NSString *MAPIStoreSamDBUserAttribute (struct mapistore_connection_info *connInfo,
|
||||
NSString *userKey,
|
||||
NSString *value,
|
||||
NSString *attributeName);
|
||||
NSData *MAPIStoreInternalEntryId (struct ldb_context *, NSString *username);
|
||||
NSData *MAPIStoreInternalEntryId (struct mapistore_connection_info *connInfo, NSString *username);
|
||||
NSData *MAPIStoreExternalEntryId (NSString *cn, NSString *email);
|
||||
|
||||
#endif /* MAPISTORESAMDBUTILS_H */
|
||||
@@ -24,13 +24,18 @@
|
||||
#import <Foundation/NSString.h>
|
||||
#include <talloc.h>
|
||||
#include <ldb.h>
|
||||
#include <libmapiproxy.h>
|
||||
#include <samba/version.h>
|
||||
|
||||
#import "NSData+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreSamDBUtils.h"
|
||||
|
||||
|
||||
|
||||
|
||||
NSString *
|
||||
MAPIStoreSamDBUserAttribute (struct ldb_context *samCtx,
|
||||
MAPIStoreSamDBUserAttribute (struct mapistore_connection_info *connInfo,
|
||||
NSString *userKey,
|
||||
NSString *value,
|
||||
NSString *attributeName)
|
||||
@@ -48,10 +53,20 @@ MAPIStoreSamDBUserAttribute (struct ldb_context *samCtx,
|
||||
attrs[0] = [attributeName UTF8String];
|
||||
searchFormat
|
||||
= [NSString stringWithFormat: @"(&(objectClass=user)(%@=%%s))", userKey];
|
||||
ret = ldb_search (samCtx, memCtx, &res, ldb_get_default_basedn(samCtx),
|
||||
#if SAMBA_VERSION_MAJOR <= 4 && SAMBA_VERSION_MINOR < 3
|
||||
ret = ldb_search (connInfo->sam_ctx, memCtx, &res,
|
||||
ldb_get_default_basedn(connInfo->sam_ctx),
|
||||
LDB_SCOPE_SUBTREE, attrs,
|
||||
[searchFormat UTF8String],
|
||||
[value UTF8String]);
|
||||
#else
|
||||
ret = safe_ldb_search (&connInfo->sam_ctx, memCtx, &res,
|
||||
ldb_get_default_basedn(connInfo->sam_ctx),
|
||||
LDB_SCOPE_SUBTREE, attrs,
|
||||
[searchFormat UTF8String],
|
||||
[value UTF8String]);
|
||||
#endif
|
||||
|
||||
if (ret == LDB_SUCCESS && res->count == 1)
|
||||
{
|
||||
result = ldb_msg_find_attr_as_string (res->msgs[0], attrs[0], NULL);
|
||||
@@ -65,7 +80,7 @@ MAPIStoreSamDBUserAttribute (struct ldb_context *samCtx,
|
||||
}
|
||||
|
||||
NSData *
|
||||
MAPIStoreInternalEntryId (struct ldb_context *samCtx, NSString *username)
|
||||
MAPIStoreInternalEntryId (struct mapistore_connection_info *connInfo, NSString *username)
|
||||
{
|
||||
static const uint8_t const providerUid[] = { 0xdc, 0xa7, 0x40, 0xc8,
|
||||
0xc0, 0x42, 0x10, 0x1a,
|
||||
@@ -82,7 +97,7 @@ MAPIStoreInternalEntryId (struct ldb_context *samCtx, NSString *username)
|
||||
type: 32
|
||||
X500DN: variable */
|
||||
|
||||
legacyDN = MAPIStoreSamDBUserAttribute (samCtx, @"sAMAccountName", username,
|
||||
legacyDN = MAPIStoreSamDBUserAttribute (connInfo, @"sAMAccountName", username,
|
||||
@"legacyExchangeDN");
|
||||
if (legacyDN)
|
||||
{
|
||||
@@ -96,8 +111,11 @@ MAPIStoreInternalEntryId (struct ldb_context *samCtx, NSString *username)
|
||||
[entryId appendUInt8: 0]; // end of string
|
||||
}
|
||||
else
|
||||
entryId = nil;
|
||||
|
||||
{
|
||||
NSLog (@"Error trying to generate EntryId for `%@`", username);
|
||||
entryId = nil;
|
||||
}
|
||||
|
||||
return entryId;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
/* MAPIStoreSharingMessage.h - this file is part of SOGo-OpenChange
|
||||
*
|
||||
* Copyright (C) 2015 Enrique J. Hernández
|
||||
*
|
||||
* Author: Enrique J. Hernández <ejhernandez@zentyal.com>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef MAPISTORESHARINGMESSAGE_H
|
||||
#define MAPISTORESHARINGMESSAGE_H
|
||||
|
||||
#import "MAPIStoreMailMessage.h"
|
||||
#import "MAPIStoreObjectProxy.h"
|
||||
|
||||
#define SHARING_SPECIAL_FOLDER 0x40290
|
||||
|
||||
@interface MAPIStoreSharingMessage : MAPIStoreObjectProxy
|
||||
{
|
||||
struct mapistore_connection_info *connInfo;
|
||||
NSMutableDictionary *properties;
|
||||
}
|
||||
|
||||
- (id) initWithMailHeaders: (NSDictionary *) mailHeaders
|
||||
andConnectionInfo: (struct mapistore_connection_info *) newConnInfo
|
||||
fromMessage: (MAPIStoreMailMessage *) msg;
|
||||
|
||||
/* getters */
|
||||
- (int) getPidLidSharingCapabilities: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidNameXSharingCapabilities: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidSharingConfigurationUrl: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidNameXSharingConfigUrl: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidSharingFlavor: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidNameXSharingFlavor: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidSharingInitiatorEntryId: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidSharingInitiatorName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidSharingInitiatorSmtp: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidSharingLocalType: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidNameXSharingLocalType: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidSharingProviderGuid: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidNameXSharingProviderGuid: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidSharingProviderName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidNameXSharingProviderName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidSharingProviderUrl: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidNameXSharingProviderUrl: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidSharingRemoteName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidNameXSharingRemoteName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidSharingRemoteStoreUid: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidNameXSharingRemoteStoreUid: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidSharingRemoteType: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidTypeXSharingRemoteType: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidSharingResponseTime: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidSharingResponseType: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidNameContentClass: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
|
||||
/* Save */
|
||||
- (void) saveWithMessage: (MAPIStoreMailMessage *) msg
|
||||
andSOGoObject: (SOGoMailObject *) sogoObject;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTORECALENDARWRAPPER_H */
|
||||
@@ -0,0 +1,463 @@
|
||||
/* MAPIStoreSharingMessage.m - this file is part of SOGo-OpenChange
|
||||
*
|
||||
* Copyright (C) 2015 Enrique J. Hernández
|
||||
*
|
||||
* Author: Enrique J. Hernández <ejhernandez@zentyal.com>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <talloc.h>
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSData.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
|
||||
#import <Mailer/SOGoMailObject.h>
|
||||
#import <NGExtensions/NGBase64Coding.h>
|
||||
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSDate+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
#import "NSValue+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreMailFolder.h"
|
||||
#import "MAPIStoreSharingMessage.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
|
||||
#include <gen_ndr/property.h>
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
#include <mapistore/mapistore_nameid.h>
|
||||
|
||||
@implementation MAPIStoreSharingMessage
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
connInfo = NULL;
|
||||
properties = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithMailHeaders: (NSDictionary *) mailHeaders
|
||||
andConnectionInfo: (struct mapistore_connection_info *) newConnInfo
|
||||
fromMessage: (MAPIStoreMailMessage *) msg
|
||||
{
|
||||
NSEnumerator *enumerator;
|
||||
NSString *key;
|
||||
|
||||
if ((self = [self init]))
|
||||
{
|
||||
connInfo = newConnInfo;
|
||||
enumerator = [mailHeaders keyEnumerator];
|
||||
properties = [NSMutableDictionary new];
|
||||
while ((key = [enumerator nextObject]))
|
||||
{
|
||||
if ([key hasPrefix: @"x-ms-sharing-"])
|
||||
[properties setObject: [mailHeaders objectForKey: key]
|
||||
forKey: key];
|
||||
}
|
||||
|
||||
/* Set request properties from container folder */
|
||||
NSDictionary *requestProps = [(MAPIStoreMailFolder *)[msg container]
|
||||
extraPropertiesForMessage: [msg nameInContainer]];
|
||||
if (requestProps)
|
||||
[properties addEntriesFromDictionary: requestProps];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[properties release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) _getStringProperty: (NSString *) propertyName
|
||||
inData: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
enum mapistore_error rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
id value;
|
||||
|
||||
value = [properties objectForKey: propertyName];
|
||||
if (value)
|
||||
{
|
||||
*data = [value asUnicodeInMemCtx: memCtx];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
||||
}
|
||||
|
||||
- (int) getPidLidSharingCapabilities: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
|
||||
enum mapistore_error rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
id value;
|
||||
|
||||
value = [properties objectForKey: @"x-ms-sharing-capabilities"];
|
||||
if (value)
|
||||
{
|
||||
*data = MAPILongValue (memCtx, [value intValue]);
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (int) getPidNameXSharingCapabilities: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
|
||||
enum mapistore_error rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
id value;
|
||||
|
||||
value = [properties objectForKey: @"x-ms-sharing-capabilities"];
|
||||
if (value)
|
||||
{
|
||||
*data = [[NSString stringWithFormat:@"%X", [value intValue]]
|
||||
asUnicodeInMemCtx: memCtx];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (int) getPidLidSharingConfigurationUrl: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
|
||||
*data = [@"" asUnicodeInMemCtx: memCtx];
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getPidNameXSharingConfigUrl: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getPidLidSharingConfigurationUrl: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidLidSharingFlavor: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
/* See [MS-OXSHARE] Section 2.2.2.5 for details */
|
||||
enum mapistore_error rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
id value, auxValue;
|
||||
|
||||
value = [properties objectForKey: @"x-ms-sharing-flavor"];
|
||||
if (value)
|
||||
{
|
||||
*data = MAPILongValue (memCtx, [value intValue]);
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Guess its value required by old clients based on other properties */
|
||||
value = [properties objectForKey: @"x-ms-sharing-capabilities"];
|
||||
if (value)
|
||||
{
|
||||
if ([value intValue] == SHARING_SPECIAL_FOLDER)
|
||||
{
|
||||
value = [properties objectForKey: @"x-ms-sharing-responsetime"];
|
||||
auxValue = [properties objectForKey: @"x-ms-sharing-remoteuid"];
|
||||
if (value) /* A sharing request */
|
||||
{
|
||||
if (auxValue)
|
||||
*data = MAPILongValue (memCtx, SHARING_INVITATION_REQUEST_FOLDER);
|
||||
else
|
||||
*data = MAPILongValue (memCtx, SHARING_REQUEST_SPECIAL_FOLDER);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (auxValue) /* It SHOULD be an invitation or response */
|
||||
*data = MAPILongValue (memCtx, SHARING_INVITATION_SPECIAL_FOLDER);
|
||||
else /* No remote info, then denial */
|
||||
*data = MAPILongValue (memCtx, SHARING_DENY_REQUEST);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*data = MAPILongValue (memCtx, SHARING_INVITATION_FOLDER);
|
||||
}
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (int) getPidNameXSharingFlavor: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
enum mapistore_error rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
id value;
|
||||
|
||||
value = [properties objectForKey: @"x-ms-sharing-flavor"];
|
||||
if (value)
|
||||
{
|
||||
*data = [[NSString stringWithFormat:@"%X", [value intValue]]
|
||||
asUnicodeInMemCtx: memCtx];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (int) getPidLidSharingInitiatorEntryId: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
enum mapistore_error rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
id value;
|
||||
NSData *entryId;
|
||||
|
||||
value = [properties objectForKey: @"x-ms-sharing-initiatorentryid"];
|
||||
if (value)
|
||||
{
|
||||
entryId = [value dataByDecodingBase64];
|
||||
if (entryId)
|
||||
{
|
||||
*data = [entryId asBinaryInMemCtx: memCtx];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (int) getPidLidSharingInitiatorName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self _getStringProperty: @"x-ms-sharing-initiatorname"
|
||||
inData: data
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidLidSharingInitiatorSmtp: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self _getStringProperty: @"x-ms-sharing-initiatorsmtp"
|
||||
inData: data
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidLidSharingLocalType: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self _getStringProperty: @"x-ms-sharing-localtype"
|
||||
inData: data
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidNameXSharingLocalType: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getPidLidSharingLocalType: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidLidSharingProviderGuid: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
const unsigned char providerGuidBytes[] = {0xAE, 0xF0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46};
|
||||
NSData *providerGuid = [NSData dataWithBytes: providerGuidBytes length: 16];
|
||||
*data = [providerGuid asBinaryInMemCtx: memCtx];
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getPidNameXSharingProviderGuid: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = [@"AEF0060000000000C000000000000046" asUnicodeInMemCtx: memCtx];
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getPidLidSharingProviderName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
|
||||
return [self _getStringProperty: @"x-ms-sharing-providername"
|
||||
inData: data
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidNameXSharingProviderName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getPidLidSharingProviderName: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidLidSharingProviderUrl: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self _getStringProperty: @"x-ms-sharing-providerurl"
|
||||
inData: data
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidNameXSharingProviderUrl: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getPidLidSharingProviderUrl: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidLidSharingRemoteName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self _getStringProperty: @"x-ms-sharing-remotename"
|
||||
inData: data
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidNameXSharingRemoteName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getPidLidSharingRemoteName: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidLidSharingRemoteStoreUid: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self _getStringProperty: @"x-ms-sharing-remotestoreuid"
|
||||
inData: data
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidNameXSharingRemoteStoreUid: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getPidLidSharingRemoteStoreUid: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidLidSharingRemoteType: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self _getStringProperty: @"x-ms-sharing-remotetype"
|
||||
inData: data
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidTypeXSharingRemoteType: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getPidLidSharingRemoteType: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidLidSharingRemoteUid: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self _getStringProperty: @"x-ms-sharing-remoteuid"
|
||||
inData: data
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidUidXSharingRemoteUid: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getPidLidSharingRemoteUid: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidLidSharingResponseTime: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
enum mapistore_error rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
id value;
|
||||
|
||||
value = [properties objectForKey: MAPIPropertyKey (PidLidSharingResponseTime)];
|
||||
if (!value)
|
||||
{
|
||||
value = [properties objectForKey: @"x-ms-sharing-responsetime"];
|
||||
if (value)
|
||||
{
|
||||
/* Here the value is a GSCBufferString */
|
||||
NSString * responseTime = [NSString stringWithUTF8String: [value UTF8String]];
|
||||
value = [NSDate dateWithString: responseTime];
|
||||
}
|
||||
}
|
||||
|
||||
if (value)
|
||||
{
|
||||
*data = [value asFileTimeInMemCtx: memCtx];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (int) getPidLidSharingResponseType: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
|
||||
enum mapistore_error rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
id value;
|
||||
|
||||
value = [properties objectForKey: MAPIPropertyKey (PidLidSharingResponseType)];
|
||||
if (!value)
|
||||
value = [properties objectForKey: @"x-ms-sharing-responsetype"];
|
||||
|
||||
if (value)
|
||||
{
|
||||
*data = MAPILongValue (memCtx, [value intValue]);
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (int) getPidNameContentClass: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = talloc_strdup (memCtx, "Sharing");
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (void) saveWithMessage: (MAPIStoreMailMessage *) msg
|
||||
andSOGoObject: (SOGoMailObject *) sogoObject
|
||||
{
|
||||
/* Store PidLidSharingResponseType and PidLidSharingResponseTime if
|
||||
required in versions message from the container as I don't see
|
||||
other straightforward place to put that information */
|
||||
id response;
|
||||
NSDictionary *propsToStore;
|
||||
|
||||
response = [[msg properties] objectForKey: MAPIPropertyKey (PidLidSharingResponseType)];
|
||||
if (response)
|
||||
{
|
||||
/* FIXME: Is there any better way to increase the modseq? */
|
||||
[sogoObject addFlags: @"\\Draft"];
|
||||
[sogoObject removeFlags: @"\\Draft"];
|
||||
|
||||
/* Store this modification in container folder along the property values */
|
||||
propsToStore = [NSDictionary dictionaryWithObjects:
|
||||
[NSArray arrayWithObjects: response,
|
||||
[[msg properties] objectForKey: MAPIPropertyKey (PidLidSharingResponseTime)],
|
||||
nil]
|
||||
forKeys:
|
||||
[NSArray arrayWithObjects: MAPIPropertyKey (PidLidSharingResponseType),
|
||||
MAPIPropertyKey (PidLidSharingResponseTime), nil]];
|
||||
|
||||
[(MAPIStoreMailFolder *)[msg container] setExtraProperties: propsToStore
|
||||
forMessage: [msg nameInContainer]];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -31,6 +31,7 @@
|
||||
#import <Appointments/SOGoTaskObject.h>
|
||||
|
||||
#import "MAPIApplication.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import "MAPIStoreTasksContext.h"
|
||||
#import "MAPIStoreTasksMessage.h"
|
||||
#import "MAPIStoreTasksMessageTable.h"
|
||||
@@ -61,6 +62,7 @@
|
||||
SOGoTaskObject *newEntry;
|
||||
NSString *name;
|
||||
|
||||
[[[self context] userContext] activate];
|
||||
name = [NSString stringWithFormat: @"%@.ics",
|
||||
[SOGoObject globallyUniqueObjectId]];
|
||||
newEntry = [SOGoTaskObject objectWithName: name
|
||||
@@ -69,7 +71,7 @@
|
||||
newMessage = [MAPIStoreTasksMessage mapiStoreObjectWithSOGoObject: newEntry
|
||||
inContainer: self];
|
||||
|
||||
|
||||
|
||||
return newMessage;
|
||||
}
|
||||
|
||||
@@ -105,18 +107,18 @@
|
||||
if ([roles containsObject: SOGoRole_ObjectCreator])
|
||||
rights |= RightsCreateItems;
|
||||
if ([roles containsObject: SOGoRole_ObjectEraser])
|
||||
rights |= RightsDeleteAll;
|
||||
rights |= RightsDeleteAll | RightsDeleteOwn;
|
||||
if ([roles containsObject: SOGoCalendarRole_PublicModifier]
|
||||
&& [roles containsObject: SOGoCalendarRole_PrivateModifier]
|
||||
&& [roles containsObject: SOGoCalendarRole_ConfidentialModifier])
|
||||
rights |= RightsReadItems | RightsEditAll;
|
||||
rights |= RightsReadItems | RightsEditAll | RightsEditOwn;
|
||||
else if ([roles containsObject: SOGoCalendarRole_PublicViewer]
|
||||
&& [roles containsObject: SOGoCalendarRole_PrivateViewer]
|
||||
&& [roles containsObject: SOGoCalendarRole_ConfidentialViewer])
|
||||
rights |= RightsReadItems;
|
||||
if (rights != 0)
|
||||
rights |= RoleNone; /* actually "folder visible" */
|
||||
|
||||
|
||||
return rights;
|
||||
}
|
||||
|
||||
|
||||
@@ -367,13 +367,15 @@
|
||||
NSString *status, *priority, *tzName;
|
||||
NSCalendarDate *now;
|
||||
NSInteger tzOffset;
|
||||
NSTimeZone *userTZ;
|
||||
double doubleValue;
|
||||
|
||||
vToDo = [sogoObject component: YES secure: NO];
|
||||
vCalendar = [vToDo parent];
|
||||
[vCalendar setProdID: @"-//Inverse inc.//OpenChange+SOGo//EN"];
|
||||
|
||||
tzName = [[[self userContext] timeZone] name];
|
||||
userTZ = [[self userContext] timeZone];
|
||||
tzName = [userTZ name];
|
||||
tz = [iCalTimeZone timeZoneForName: tzName];
|
||||
[vCalendar addTimeZone: tz];
|
||||
|
||||
@@ -428,6 +430,13 @@
|
||||
{
|
||||
date = (iCalDateTime *) [vToDo uniqueChildWithTag: @"dtstart"];
|
||||
[date setTimeZone: tz];
|
||||
/* The property is set to user's local time zone.
|
||||
See: [MS-OXOTASK] 2.2.2.2.4
|
||||
TODO: Ignore when the PT_SYSTIME is 0x5AE980E0*/
|
||||
tzOffset = [userTZ secondsFromGMTForDate: value];
|
||||
value = [value dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: -tzOffset];
|
||||
[date setDateTime: value];
|
||||
}
|
||||
|
||||
@@ -437,6 +446,13 @@
|
||||
{
|
||||
date = (iCalDateTime *) [vToDo uniqueChildWithTag: @"due"];
|
||||
[date setTimeZone: tz];
|
||||
/* The property is set to user's local time zone.
|
||||
See: [MS-OXOTASK] 2.2.2.2.5
|
||||
TODO: Ignore when the PT_SYSTIME is 0x5AE980E0*/
|
||||
tzOffset = [userTZ secondsFromGMTForDate: value];
|
||||
value = [value dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: -tzOffset];
|
||||
[date setDateTime: value];
|
||||
}
|
||||
|
||||
@@ -445,7 +461,9 @@
|
||||
if (value)
|
||||
{
|
||||
date = (iCalDateTime *) [vToDo uniqueChildWithTag: @"completed"];
|
||||
tzOffset = [[value timeZone] secondsFromGMTForDate: value];
|
||||
/* The property is set to midnight in local time zone converted to UTC:
|
||||
See: [MS-OXOTASK] 2.2.2.2.9 */
|
||||
tzOffset = [userTZ secondsFromGMTForDate: value];
|
||||
value = [value dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: -tzOffset];
|
||||
@@ -513,7 +531,7 @@
|
||||
}
|
||||
[vToDo setTimeStampAsDate: now];
|
||||
|
||||
[sogoObject saveComponent: vCalendar];
|
||||
[sogoObject saveCalendar: vCalendar];
|
||||
|
||||
[self updateVersions];
|
||||
}
|
||||
|
||||
@@ -157,6 +157,9 @@ static Class MAPIStoreTasksMessageK = Nil;
|
||||
forKey: MAPIPropertyKey (PidLidTaskDueDate)];
|
||||
[knownProperties setObject: @"c_creationdate"
|
||||
forKey: MAPIPropertyKey (PidLidTaskOrdinal)];
|
||||
/* Use by oxcfxics to sort the latest first */
|
||||
[knownProperties setObject: @"c_lastmodified"
|
||||
forKey: MAPIPropertyKey (PidTagMessageDeliveryTime)];
|
||||
}
|
||||
|
||||
return [knownProperties objectForKey: MAPIPropertyKey (property)];
|
||||
|
||||
@@ -119,6 +119,7 @@ NSObjectFromMAPISPropValue (const struct mapi_SPropValue *value)
|
||||
break;
|
||||
case PT_SYSTIME:
|
||||
result = [NSCalendarDate dateFromFileTime: &(value->value.ft)];
|
||||
[result setTimeZone: utcTZ];
|
||||
break;
|
||||
case PT_BINARY:
|
||||
case PT_SVREID:
|
||||
@@ -154,8 +155,7 @@ NSObjectFromMAPISPropValue (const struct mapi_SPropValue *value)
|
||||
// #define PT_I8 0x14
|
||||
// #define PT_SRESTRICT 0xFD
|
||||
// #define PT_ACTIONS 0xFE
|
||||
result = [NSNull null];
|
||||
abort();
|
||||
result = nil;
|
||||
NSLog (@"%s: object type not handled: %d (0x%.4x)",
|
||||
__PRETTY_FUNCTION__, valueType, valueType);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ NSObjectFromSPropValue (const struct SPropValue *value)
|
||||
break;
|
||||
case PT_STRING8:
|
||||
result = (value->value.lpszA
|
||||
? [NSString stringWithUTF8String: value->value.lpszA]
|
||||
? [NSString stringWithUTF8String: (const char *) value->value.lpszA]
|
||||
: (id) @"");
|
||||
break;
|
||||
case PT_SYSTIME:
|
||||
@@ -250,8 +250,7 @@ NSObjectFromSPropValue (const struct SPropValue *value)
|
||||
// #define PT_I8 0x14
|
||||
// #define PT_SRESTRICT 0xFD
|
||||
// #define PT_ACTIONS 0xFE
|
||||
result = [NSNull null];
|
||||
abort();
|
||||
result = nil;
|
||||
NSLog (@"%s: object type not handled: %d (0x%.4x)",
|
||||
__PRETTY_FUNCTION__, valueType, valueType);
|
||||
}
|
||||
|
||||
@@ -86,6 +86,8 @@
|
||||
|
||||
/* SOGo hacky magic */
|
||||
- (void) activateWithUser: (SOGoUser *) activeUser;
|
||||
- (void) activate;
|
||||
- (void) deactivate;
|
||||
- (MAPIStoreAuthenticator *) authenticator;
|
||||
- (WOContext *) woContext;
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserFolder.h>
|
||||
#import <SOGo/NSString+Utilities.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <Mailer/SOGoMailAccount.h>
|
||||
#import <Mailer/SOGoMailAccounts.h>
|
||||
|
||||
@@ -72,6 +73,8 @@ static NSMapTable *contextsTable = nil;
|
||||
[userContext autorelease];
|
||||
[contextsTable setObject: userContext forKey: username];
|
||||
}
|
||||
else
|
||||
[userContext activate];
|
||||
|
||||
return userContext;
|
||||
}
|
||||
@@ -158,6 +161,8 @@ static NSMapTable *contextsTable = nil;
|
||||
if ([userPassword length] == 0)
|
||||
userPassword = username;
|
||||
[authenticator setPassword: userPassword];
|
||||
// Activate the profile on initialization
|
||||
[self activate];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -214,7 +219,7 @@ static NSMapTable *contextsTable = nil;
|
||||
if (!userFolder)
|
||||
{
|
||||
userFolder = [SOGoUserFolder objectWithName: username
|
||||
inContainer: MAPIApp];
|
||||
inContainer: nil];
|
||||
[userFolder retain];
|
||||
}
|
||||
|
||||
@@ -232,7 +237,8 @@ static NSMapTable *contextsTable = nil;
|
||||
if (!rootFolders)
|
||||
{
|
||||
rootFolders = [NSMutableDictionary new];
|
||||
[self userFolder];
|
||||
[self activate];
|
||||
[self userFolder]; // force lazy initialization
|
||||
[woContext setClientObject: userFolder];
|
||||
|
||||
/* Calendar */
|
||||
@@ -257,10 +263,10 @@ static NSMapTable *contextsTable = nil;
|
||||
acquire: NO];
|
||||
[containersBag addObject: accountsFolder];
|
||||
[woContext setClientObject: accountsFolder];
|
||||
|
||||
currentFolder = [accountsFolder lookupName: @"0"
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
|
||||
[rootFolders setObject: currentFolder
|
||||
forKey: @"mail"];
|
||||
connection = [currentFolder imap4Connection];
|
||||
@@ -268,8 +274,7 @@ static NSMapTable *contextsTable = nil;
|
||||
|
||||
/* ensure the folder cache is filled */
|
||||
[currentFolder toManyRelationshipKeysWithNamespaces: YES];
|
||||
hierarchy = [connection
|
||||
cachedHierarchyResultsForURL: [currentFolder imap4URL]];
|
||||
hierarchy = [connection cachedHierarchyResultsForURL: [currentFolder imap4URL]];
|
||||
flags = [[hierarchy objectForKey: @"list"] objectForKey: @"/INBOX"];
|
||||
inboxHasNoInferiors = [flags containsObject: @"noinferiors"];
|
||||
}
|
||||
@@ -311,9 +316,9 @@ static NSMapTable *contextsTable = nil;
|
||||
parts in this url. We strip the '-' character in case we have
|
||||
this in the domain part - like foo@bar-zot.com */
|
||||
ocFSTableName = [NSString stringWithFormat: @"sogo_cache_folder_%@",
|
||||
[[[user loginInDomain] asCSSIdentifier]
|
||||
stringByReplacingOccurrencesOfString: @"-"
|
||||
withString: @"_"]];
|
||||
[[[user login] asCSSIdentifier]
|
||||
stringByReplacingOccurrencesOfString: @"-"
|
||||
withString: @"_"]];
|
||||
[parts replaceObjectAtIndex: 4 withObject: ocFSTableName];
|
||||
folderTableURL
|
||||
= [NSURL URLWithString: [parts componentsJoinedByString: @"/"]];
|
||||
@@ -338,7 +343,7 @@ static NSMapTable *contextsTable = nil;
|
||||
|
||||
cm = [GCSChannelManager defaultChannelManager];
|
||||
channel = [cm acquireOpenChannelForURL: folderTableURL];
|
||||
|
||||
|
||||
/* FIXME: make use of [EOChannelAdaptor describeTableNames] instead */
|
||||
tableName = [[folderTableURL path] lastPathComponent];
|
||||
if ([channel evaluateExpressionX:
|
||||
@@ -355,7 +360,7 @@ static NSMapTable *contextsTable = nil;
|
||||
[channel cancelFetch];
|
||||
|
||||
|
||||
[cm releaseChannel: channel];
|
||||
[cm releaseChannel: channel];
|
||||
}
|
||||
|
||||
/* SOGo context objects */
|
||||
@@ -369,6 +374,11 @@ static NSMapTable *contextsTable = nil;
|
||||
return authenticator;
|
||||
}
|
||||
|
||||
- (void) activate
|
||||
{
|
||||
[self activateWithUser: [self sogoUser]];
|
||||
}
|
||||
|
||||
- (void) activateWithUser: (SOGoUser *) activeUser;
|
||||
{
|
||||
NSMutableDictionary *info;
|
||||
@@ -379,4 +389,24 @@ static NSMapTable *contextsTable = nil;
|
||||
[info setObject: woContext forKey: @"WOContext"];
|
||||
}
|
||||
|
||||
- (void) deactivate
|
||||
{
|
||||
NSMutableDictionary *info;
|
||||
|
||||
if (self == [MAPIApp userContext])
|
||||
[MAPIApp setUserContext: nil];
|
||||
else
|
||||
[self errorWithFormat: @"Error: Tried to deactivate an user context "
|
||||
@"not enabled (%@ vs %@)",
|
||||
[self username], [[MAPIApp userContext] username]];
|
||||
|
||||
info = [[NSThread currentThread] threadDictionary];
|
||||
if (woContext == [info objectForKey: @"WOContext"])
|
||||
[info removeObjectForKey: @"WOContext"];
|
||||
else
|
||||
[self errorWithFormat: @"Error: Tried to deactivate a WOContext "
|
||||
@"not enabled (%@ vs %@)",
|
||||
woContext, [info objectForKey: @"WOContext"]];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -228,7 +228,7 @@
|
||||
mvResult = [NSMutableArray arrayWithCapacity: mvString->cValues];
|
||||
for (count = 0; count < mvString->cValues; count++)
|
||||
{
|
||||
subObject = [NSString stringWithUTF8String: mvString->lppszA[count]];
|
||||
subObject = [NSString stringWithUTF8String: (const char *) mvString->lppszA[count]];
|
||||
[mvResult addObject: subObject];
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
|
||||
+ (id) dataWithXID: (const struct XID *) xid;
|
||||
- (struct XID *) asXIDInMemCtx: (void *) memCtx;
|
||||
- (struct SizedXid *) asSizedXidArrayInMemCtx: (void *) memCtx
|
||||
with: (uint32_t *) length;
|
||||
|
||||
+ (id) dataWithChangeKeyGUID: (NSString *) guidString
|
||||
andCnt: (NSData *) globCnt;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "NSObject+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
@@ -29,6 +30,7 @@
|
||||
|
||||
#undef DEBUG
|
||||
#include <stdbool.h>
|
||||
#include <libmapi/libmapi.h>
|
||||
#include <talloc.h>
|
||||
#include <util/time.h>
|
||||
#include <gen_ndr/exchange.h>
|
||||
@@ -136,11 +138,11 @@ static void _fillFlatUIDWithGUID (struct FlatUID_r *flatUID, const struct GUID *
|
||||
NSMutableData *xidData;
|
||||
struct FlatUID_r flatUID;
|
||||
|
||||
_fillFlatUIDWithGUID (&flatUID, &xid->GUID);
|
||||
_fillFlatUIDWithGUID (&flatUID, &xid->NameSpaceGuid);
|
||||
|
||||
xidData = [NSMutableData dataWithCapacity: 16 + xid->Size];
|
||||
xidData = [NSMutableData dataWithCapacity: 16 + xid->LocalId.length];
|
||||
[xidData appendBytes: flatUID.ab length: 16];
|
||||
[xidData appendBytes: xid->Data length: xid->Size];
|
||||
[xidData appendBytes: xid->LocalId.data length: xid->LocalId.length];
|
||||
|
||||
return xidData;
|
||||
}
|
||||
@@ -156,12 +158,12 @@ static void _fillFlatUIDWithGUID (struct FlatUID_r *flatUID, const struct GUID *
|
||||
{
|
||||
xid = talloc_zero (memCtx, struct XID);
|
||||
|
||||
[self _extractGUID: &xid->GUID];
|
||||
[self _extractGUID: &xid->NameSpaceGuid];
|
||||
|
||||
xid->Size = max - 16;
|
||||
xid->LocalId.length = max - 16;
|
||||
|
||||
bytes = (uint8_t *) [self bytes];
|
||||
xid->Data = talloc_memdup (xid, (bytes+16), xid->Size);
|
||||
xid->LocalId.data = talloc_memdup (xid, (bytes+16), xid->LocalId.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -172,6 +174,38 @@ static void _fillFlatUIDWithGUID (struct FlatUID_r *flatUID, const struct GUID *
|
||||
return xid;
|
||||
}
|
||||
|
||||
- (struct SizedXid *) asSizedXidArrayInMemCtx: (void *) memCtx
|
||||
with: (uint32_t *) length
|
||||
{
|
||||
struct Binary_r bin;
|
||||
struct SizedXid *sizedXIDArray;
|
||||
|
||||
bin.cb = [self length];
|
||||
bin.lpb = (uint8_t *)[self bytes];
|
||||
|
||||
sizedXIDArray = get_SizedXidArray(memCtx, &bin, length);
|
||||
if (!sizedXIDArray)
|
||||
{
|
||||
NSLog (@"Impossible to parse SizedXID array");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return sizedXIDArray;
|
||||
}
|
||||
|
||||
- (NSComparisonResult) compare: (NSData *) otherGlobCnt
|
||||
{
|
||||
uint64_t globCnt = 0, oGlobCnt = 0;
|
||||
|
||||
if ([self length] > 0)
|
||||
globCnt = *(uint64_t *) [self bytes];
|
||||
|
||||
if ([otherGlobCnt length] > 0)
|
||||
oGlobCnt = *(uint64_t *) [otherGlobCnt bytes];
|
||||
|
||||
return MAPICNCompare (globCnt, oGlobCnt, NULL);
|
||||
}
|
||||
|
||||
+ (id) dataWithChangeKeyGUID: (NSString *) guidString
|
||||
andCnt: (NSData *) globCnt;
|
||||
{
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
|
||||
- (BOOL) isNever; /* occurs on 4500-12-31 */
|
||||
|
||||
+ (NSCalendarDate *) dateFromSystemTime: (struct SYSTEMTIME) date
|
||||
andRuleYear: (uint16_t) rYear;
|
||||
@end
|
||||
|
||||
NSComparisonResult NSDateCompare (id date1, id date2, void *);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSTimeZone.h>
|
||||
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "NSDate+MAPIStore.h"
|
||||
|
||||
#undef DEBUG
|
||||
@@ -48,7 +49,7 @@ _setupRefDate ()
|
||||
refDate = [[NSCalendarDate alloc]
|
||||
initWithYear: 1601 month: 1 day: 1
|
||||
hour: 0 minute: 0 second: 0
|
||||
timeZone: [NSTimeZone timeZoneWithName: @"UTC"]];
|
||||
timeZone: utcTZ];
|
||||
}
|
||||
|
||||
+ (NSCalendarDate *) dateFromMinutesSince1601: (uint32_t) minutes
|
||||
@@ -128,6 +129,64 @@ _setupRefDate ()
|
||||
return [calDate yearOfCommonEra] == 4500;
|
||||
}
|
||||
|
||||
+ (NSCalendarDate *) dateFromSystemTime: (struct SYSTEMTIME) date
|
||||
andRuleYear: (uint16_t) rYear
|
||||
{
|
||||
NSCalendarDate *result;
|
||||
NSInteger daysToDate;
|
||||
NSUInteger firstDayOfWeek, year;
|
||||
|
||||
/* ([MS-OXOCAL] 2.2.1.41.1) When we're provided an absolute date (i.e., it
|
||||
happens once), the SYSTEMTIME structure is enough to fill the date.
|
||||
When we're parsing a SYSTEMTIME field from a time zone rule, however, a
|
||||
relative date can be provided for the peroidicity of its periods. In this
|
||||
scenario, the wYear field is empty and we have to use the wYear field in
|
||||
the parent rule */
|
||||
if (date.wYear != 0)
|
||||
year = date.wYear;
|
||||
else
|
||||
year = rYear;
|
||||
|
||||
/* The wDay field indicates the occurrence of the wDayOfWeek within the month.
|
||||
The 5th occurrence means the last one, even if it is the 4th. */
|
||||
if (date.wDay < 5)
|
||||
{
|
||||
result = [[NSCalendarDate alloc] initWithYear: year month: date.wMonth day: 1
|
||||
hour: date.wHour minute: date.wMinute second: date.wSecond
|
||||
timeZone: utcTZ];
|
||||
[result autorelease];
|
||||
|
||||
firstDayOfWeek = [result dayOfWeek];
|
||||
|
||||
daysToDate = 7 * (date.wDay - 1) + date.wDayOfWeek - firstDayOfWeek;
|
||||
if (date.wDayOfWeek < firstDayOfWeek)
|
||||
daysToDate += 7;
|
||||
|
||||
result = [result dateByAddingYears: 0 months: 0 days: daysToDate
|
||||
hours: 0 minutes: 0
|
||||
seconds: 0];
|
||||
}
|
||||
else
|
||||
{
|
||||
result = [[NSCalendarDate alloc] initWithYear: year month: date.wMonth + 1 day: 1
|
||||
hour: date.wHour minute: date.wMinute second: date.wSecond
|
||||
timeZone: utcTZ];
|
||||
[result autorelease];
|
||||
|
||||
firstDayOfWeek = [result dayOfWeek];
|
||||
|
||||
daysToDate = date.wDayOfWeek - firstDayOfWeek;
|
||||
if (date.wDayOfWeek >= firstDayOfWeek)
|
||||
daysToDate -= 7;
|
||||
|
||||
result = [result dateByAddingYears: 0 months: 0 days: daysToDate
|
||||
hours: 0 minutes: 0
|
||||
seconds: 0];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NSComparisonResult
|
||||
|
||||
+11
-2
@@ -28,6 +28,8 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
@class RTFFontTable;
|
||||
|
||||
@interface RTFHandler : NSObject
|
||||
{
|
||||
NSMapTable *_charsets;
|
||||
@@ -41,6 +43,11 @@
|
||||
|
||||
- (id) initWithData: (NSData *) theData;
|
||||
- (NSMutableData *) parse;
|
||||
|
||||
- (RTFFontTable *) parseFontTable;
|
||||
- (void) mangleInternalStateWithBytesPtr: (const char*) newBytes
|
||||
andCurrentPos: (int) newCurrentPos;
|
||||
|
||||
@end
|
||||
|
||||
//
|
||||
@@ -67,6 +74,7 @@
|
||||
int font_index;
|
||||
int color_index;
|
||||
int start_pos;
|
||||
const unsigned short *charset;
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -77,12 +85,13 @@
|
||||
{
|
||||
@public
|
||||
NSString *family;
|
||||
NSString *charset;
|
||||
unsigned char charset;
|
||||
NSString *name;
|
||||
unsigned int pitch;
|
||||
unsigned int index;
|
||||
}
|
||||
|
||||
- (NSString *) description;
|
||||
@end
|
||||
|
||||
//
|
||||
@@ -96,8 +105,8 @@
|
||||
|
||||
- (void) addFontInfo: (RTFFontInfo *) theFontInfo
|
||||
atIndex: (unsigned int ) theIndex;
|
||||
|
||||
- (RTFFontInfo *) fontInfoAtIndex: (unsigned int ) theIndex;
|
||||
- (NSString *) description;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+801
-289
File diff suppressed because it is too large.
Load diff
@@ -1,8 +1,8 @@
|
||||
/* dbmsgreader.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
* 2015 Enrique J. Hernandez
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -33,21 +33,58 @@
|
||||
#import <SOGo/SOGoProductLoader.h>
|
||||
#import <SOGo/SOGoSystemDefaults.h>
|
||||
|
||||
#import <libmapi/libmapi.h>
|
||||
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import <SOGo/SOGoCacheGCSObject.h>
|
||||
|
||||
#import <SOGo/BSONCodec.h>
|
||||
#import "NSObject+PropertyList.h"
|
||||
|
||||
Class MAPIStoreUserContextK, SOGoMAPIDBObjectK;
|
||||
|
||||
Class MAPIStoreUserContextK, SOGoCacheGCSObjectK, NSStringK;
|
||||
|
||||
static void
|
||||
DumpBSONData(NSData *data)
|
||||
{
|
||||
id key, value;
|
||||
NSEnumerator *dictEnum;
|
||||
NSDictionary *dvalue;
|
||||
NSMutableString *outStr;
|
||||
NSUInteger max;
|
||||
|
||||
dvalue = [data BSONValue];
|
||||
[dvalue displayWithIndentation:0];
|
||||
printf("\n");
|
||||
max = [dvalue count];
|
||||
dictEnum = [dvalue keyEnumerator];
|
||||
NSStringK = [NSString class];
|
||||
outStr = [NSMutableString stringWithFormat: @"{ %d items\n", max];
|
||||
while ((key = [dictEnum nextObject]))
|
||||
{
|
||||
uint32_t proptag = 0;
|
||||
if ([key isKindOfClass: NSStringK] && [(NSString *)key intValue] > 0)
|
||||
proptag = [(NSString *)key intValue];
|
||||
|
||||
if (proptag > 0)
|
||||
{
|
||||
const char *propTagName = get_proptag_name (proptag);
|
||||
NSString *propName;
|
||||
|
||||
if (propTagName)
|
||||
propName = [NSString stringWithCString: propTagName
|
||||
encoding: NSUTF8StringEncoding];
|
||||
else
|
||||
propName = [NSString stringWithFormat: @"0x%.4x", [key unsignedLongValue]];
|
||||
|
||||
[outStr appendFormat: @" %@ = ", propName];
|
||||
}
|
||||
else
|
||||
[outStr appendFormat: @" %@ = ", key];
|
||||
|
||||
value = [dvalue objectForKey: key];
|
||||
[outStr appendFormat: @"(%@) %@,\n", NSStringFromClass ([value class]), value];
|
||||
}
|
||||
[outStr appendFormat: @"}\n"];
|
||||
printf ("%s\n", [outStr UTF8String]);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -60,14 +97,14 @@ DbDumpObject (NSString *username, NSString *path)
|
||||
|
||||
ctx = [MAPIStoreUserContextK userContextWithUsername: username
|
||||
andTDBIndexing: NULL];
|
||||
dbobject = [SOGoMAPIDBObjectK new];
|
||||
dbobject = [SOGoCacheGCSObjectK new];
|
||||
[dbobject setTableUrl: [ctx folderTableURL]];
|
||||
record = [dbobject lookupRecord: path newerThanVersion: -1];
|
||||
if (record)
|
||||
{
|
||||
printf("record found: %p\n", record);
|
||||
content = [[record objectForKey: @"c_content"] dataByDecodingBase64];
|
||||
DumpBSONData(content);
|
||||
DumpBSONData (content);
|
||||
}
|
||||
else
|
||||
NSLog (@"record not found");
|
||||
@@ -107,7 +144,7 @@ int main (int argc, char *argv[], char *envp[])
|
||||
[loader loadProducts: [NSArray arrayWithObject: BACKEND_BUNDLE_NAME]];
|
||||
|
||||
MAPIStoreUserContextK = NSClassFromString (@"MAPIStoreUserContext");
|
||||
SOGoMAPIDBObjectK = NSClassFromString (@"SOGoMAPIDBObject");
|
||||
SOGoCacheGCSObjectK = NSClassFromString (@"SOGoCacheGCSObject");
|
||||
|
||||
arguments = [[NSProcessInfo processInfo] arguments];
|
||||
if ([arguments count] > 2) {
|
||||
|
||||
Loaded 100 of 861 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user