Compare commits
404
Commits
SOGo-2.3.12
...
v2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d601fff28 | ||
|
|
731c1bdfd9 | ||
|
|
1349179c3e | ||
|
|
e528096b10 | ||
|
|
3c85dbd74d | ||
|
|
dd7dd49641 | ||
|
|
f38eded701 | ||
|
|
0f3d7dc6bc | ||
|
|
f331211977 | ||
|
|
2389e44513 | ||
|
|
9bffee269d | ||
|
|
5d0a48d6fa | ||
|
|
4ed6bce05c | ||
|
|
64414ee060 | ||
|
|
3d2e5adee8 | ||
|
|
dc4fdb2d5a | ||
|
|
3e96d68f30 | ||
|
|
697eda298d | ||
|
|
71e0871629 | ||
|
|
ef99973621 | ||
|
|
7fbc3f7fc3 | ||
|
|
c5d74f5f32 | ||
|
|
9703cfdfd5 | ||
|
|
3d1b365b5d | ||
|
|
c0e60902a0 | ||
|
|
a2ef542ad4 | ||
|
|
69b86d3f93 | ||
|
|
61e15eab23 | ||
|
|
782e4d9006 | ||
|
|
32bc1e8ffc | ||
|
|
02512b833b | ||
|
|
3693033922 | ||
|
|
bbf0ff79e8 | ||
|
|
a98fe2f850 | ||
|
|
0057524983 | ||
|
|
c65e1212a5 | ||
|
|
1268e2370f | ||
|
|
f1d9df693c | ||
|
|
cd3095e43b | ||
|
|
9198fc9bf6 | ||
|
|
0fa6947a74 | ||
|
|
9a0b0ccb83 | ||
|
|
cfd4c7b999 | ||
|
|
2911578f4b | ||
|
|
47d01326c9 | ||
|
|
0c47b639b2 | ||
|
|
acb2a34b61 | ||
|
|
2b33d45346 | ||
|
|
eafbdd3884 | ||
|
|
2fbe721c60 | ||
|
|
5c3bff74a0 | ||
|
|
924d5eb834 | ||
|
|
b90723c9d6 | ||
|
|
f29793b781 | ||
|
|
bae39ffefa | ||
|
|
2c60f03339 | ||
|
|
8acc9050fb | ||
|
|
4e04d895cd | ||
|
|
5d3b1b0dc0 | ||
|
|
5fbe25e0d7 | ||
|
|
d278fc9925 | ||
|
|
5aa36a6d28 | ||
|
|
ececdda8ce | ||
|
|
fe80f1e729 | ||
|
|
5cd3a8f245 | ||
|
|
a2f84f1358 | ||
|
|
388298493f | ||
|
|
1085e55f82 | ||
|
|
5ca9a90a65 | ||
|
|
f5a28ca325 | ||
|
|
c43411ae1e | ||
|
|
7157422125 | ||
|
|
2249562caa | ||
|
|
fed96dee42 | ||
|
|
51ebf737db | ||
|
|
e80f5b6beb | ||
|
|
e62fd36653 | ||
|
|
88f964cebd | ||
|
|
4309b08c75 | ||
|
|
f3cf29ea1f | ||
|
|
7d190e537e | ||
|
|
c915bc7c95 | ||
|
|
630befd23b | ||
|
|
edaa0f3956 | ||
|
|
e1791ac8f5 | ||
|
|
44dbb30ffe | ||
|
|
b5bb9e86e3 | ||
|
|
938fd3a6f4 | ||
|
|
a15765df7b | ||
|
|
d536f090d1 | ||
|
|
d0898879ca | ||
|
|
12993e45be | ||
|
|
00948f5753 | ||
|
|
6272cb5a85 | ||
|
|
98064259a2 | ||
|
|
67fef95024 | ||
|
|
a9d9e114aa | ||
|
|
8d1b02d52b | ||
|
|
722c813909 | ||
|
|
4bcc6d128a | ||
|
|
b0e5d330e5 | ||
|
|
b3650d61e1 | ||
|
|
a7d07b2a12 | ||
|
|
a30efc6cc7 | ||
|
|
31d131f4d3 | ||
|
|
fc740b1c9f | ||
|
|
a5a40b2ea0 | ||
|
|
5b70632de0 | ||
|
|
842188744c | ||
|
|
a84b55f36c | ||
|
|
636264d782 | ||
|
|
1666048da5 | ||
|
|
71fe42e8c3 | ||
|
|
875b1c9836 | ||
|
|
428d179b9f | ||
|
|
e73a3495bb | ||
|
|
678cf66a57 | ||
|
|
0cca551c22 | ||
|
|
98f042b390 | ||
|
|
bbac466276 | ||
|
|
d7eb751951 | ||
|
|
7cc3ff2fcc | ||
|
|
ec397b39b0 | ||
|
|
95d08c0150 | ||
|
|
b3149ee7c2 | ||
|
|
20cbe3cf77 | ||
|
|
a57cad33f6 | ||
|
|
5027aabc1b | ||
|
|
149997b4cd | ||
|
|
9b4dd624c6 | ||
|
|
c3121c50d5 | ||
|
|
3f698447b9 | ||
|
|
2705b5956a | ||
|
|
e0cb700f54 | ||
|
|
65e735a314 | ||
|
|
89400fe980 | ||
|
|
e6baba445f | ||
|
|
341885542b | ||
|
|
9c1e481d54 | ||
|
|
8fc55833d2 | ||
|
|
43385ce5bf | ||
|
|
f28b7f2f8c | ||
|
|
7a418582c4 | ||
|
|
34e22dad42 | ||
|
|
b8ae9afbd2 | ||
|
|
be527031bc | ||
|
|
b4f5430ac5 | ||
|
|
8b307d8ac6 | ||
|
|
2e8c6680fe | ||
|
|
d9d4808d29 | ||
|
|
43dc7dee87 | ||
|
|
9995ccc29f | ||
|
|
28ab0015a9 | ||
|
|
4a3f17506c | ||
|
|
a7740dc5ed | ||
|
|
3155ecf325 | ||
|
|
fb8ba8f3b9 | ||
|
|
4cd8a32081 | ||
|
|
fbc6bb71a8 | ||
|
|
4ecff8a437 | ||
|
|
e5b4a12f8a | ||
|
|
41ea0341a8 | ||
|
|
9df8eb367a | ||
|
|
4f73005d1d | ||
|
|
45255cd27f | ||
|
|
8c7a2cb2eb | ||
|
|
2428c3cb3d | ||
|
|
05ab2015c6 | ||
|
|
847313fe25 | ||
|
|
84deb2fe45 | ||
|
|
2f56bb43be | ||
|
|
3cfbaecbf8 | ||
|
|
48861491c1 | ||
|
|
6720b9aaed | ||
|
|
505079dfda | ||
|
|
e0497448e6 | ||
|
|
f4394ad8b5 | ||
|
|
3c2fa1c769 | ||
|
|
12fb067f47 | ||
|
|
bad4abeba7 | ||
|
|
0c61de49ee | ||
|
|
7436d54f9e | ||
|
|
4bb5d15cfa | ||
|
|
94a94e3c2a | ||
|
|
01983f60d1 | ||
|
|
9a1f91ead2 | ||
|
|
6cff413e4d | ||
|
|
9539b8ce6e | ||
|
|
86c0f32fe6 | ||
|
|
b01988b6a6 | ||
|
|
59281f02c1 | ||
|
|
a42d6ce450 | ||
|
|
494b2d7b7e | ||
|
|
ccb176d996 | ||
|
|
5afb4b7dd3 | ||
|
|
bdcba43f10 | ||
|
|
de46924950 | ||
|
|
8a2f88bc07 | ||
|
|
82fbeee7e5 | ||
|
|
cd3d59428f | ||
|
|
2d2f3fbe7b | ||
|
|
59734d18e8 | ||
|
|
d1cc3e8c25 | ||
|
|
d434f709bf | ||
|
|
441a503802 | ||
|
|
a883d93a80 | ||
|
|
2c801e7756 | ||
|
|
e71709c09f | ||
|
|
926cf6f34c | ||
|
|
d139d9e75d | ||
|
|
160450f15d | ||
|
|
72c03390cc | ||
|
|
2af6674ce8 | ||
|
|
c36b90dc3d | ||
|
|
d8582dbcc0 | ||
|
|
0463d7f88c | ||
|
|
e46c51e242 | ||
|
|
6349365dc7 | ||
|
|
a8335541e8 | ||
|
|
119792786f | ||
|
|
30513c7ce8 | ||
|
|
2a648895df | ||
|
|
7049519d85 | ||
|
|
51114438aa | ||
|
|
4d3de95f39 | ||
|
|
366681e6b2 | ||
|
|
dd932802f4 | ||
|
|
7a55338c08 | ||
|
|
6ea37ce3e6 | ||
|
|
3f68fb7b53 | ||
|
|
d5eb18a247 | ||
|
|
42c2c66caa | ||
|
|
8c6cc990df | ||
|
|
4602e70b91 | ||
|
|
b7e40776ad | ||
|
|
122f912718 | ||
|
|
3c8412e90c | ||
|
|
ee265c2ab7 | ||
|
|
73309f9c24 | ||
|
|
4221b6dfab | ||
|
|
e64b3bc1f2 | ||
|
|
ffa2efbc7d | ||
|
|
9d8778b10d | ||
|
|
e436816fc3 | ||
|
|
0e7ffa18a1 | ||
|
|
fd0180fe74 | ||
|
|
629b7f4d22 | ||
|
|
a3047e0756 | ||
|
|
bb180710c7 | ||
|
|
b0c355a36c | ||
|
|
c7c5046cfb | ||
|
|
eff3446353 | ||
|
|
c5a3f06538 | ||
|
|
8b2a6b05f1 | ||
|
|
cab308a2c7 | ||
|
|
a556af43c1 | ||
|
|
595a6ed048 | ||
|
|
d6440b9dd5 | ||
|
|
9529881948 | ||
|
|
b327be656b | ||
|
|
1b13d7b862 | ||
|
|
3fe20b4b2f | ||
|
|
62813cd4b8 | ||
|
|
f370ce71c6 | ||
|
|
b450f999f0 | ||
|
|
6270a11d73 | ||
|
|
2ad709e4d1 | ||
|
|
4c87898167 | ||
|
|
0329133601 | ||
|
|
b2f3585739 | ||
|
|
9b7b637866 | ||
|
|
3711e7d123 | ||
|
|
1ff24dddfc | ||
|
|
eee1cb19d0 | ||
|
|
26c2fd3d28 | ||
|
|
73d663fe85 | ||
|
|
01b0b5f783 | ||
|
|
8cb6061b55 | ||
|
|
b5fa808758 | ||
|
|
c254ae327b | ||
|
|
53b1cc5477 | ||
|
|
d992ab921f | ||
|
|
c79e3790c5 | ||
|
|
dc70e7e691 | ||
|
|
5f4acda249 | ||
|
|
ebd4058b11 | ||
|
|
4229918693 | ||
|
|
7a628bac12 | ||
|
|
eb0917f42f | ||
|
|
7d70538517 | ||
|
|
e948b45899 | ||
|
|
892db449e5 | ||
|
|
7d1549250d | ||
|
|
cdae46c7c1 | ||
|
|
d74755fb63 | ||
|
|
feca02e740 | ||
|
|
bde322b0b4 | ||
|
|
56a9f5f215 | ||
|
|
fce60e1c25 | ||
|
|
0d817c8e18 | ||
|
|
700a1aa706 | ||
|
|
ef84985025 | ||
|
|
827e9cfca6 | ||
|
|
6d9c5e4542 | ||
|
|
cad99d476d | ||
|
|
eaf0a19002 | ||
|
|
a912fe0c5e | ||
|
|
73cc81c71f | ||
|
|
5796992b56 | ||
|
|
be12528a0e | ||
|
|
0fc3791f37 | ||
|
|
3badf13c22 | ||
|
|
665367f8f8 | ||
|
|
340c110442 | ||
|
|
81d3d3bc5b | ||
|
|
686b32d78b | ||
|
|
6b322e6b75 | ||
|
|
29d004c4a4 | ||
|
|
1a8b82d75d | ||
|
|
ca87ac05a2 | ||
|
|
0c33bc58b6 | ||
|
|
6319007631 | ||
|
|
156a83046b | ||
|
|
84e170a601 | ||
|
|
5ada0024af | ||
|
|
7daa6728a1 | ||
|
|
1cbced4965 | ||
|
|
323bc50f10 | ||
|
|
8c81d55061 | ||
|
|
36fb9c138e | ||
|
|
81aee49555 | ||
|
|
ed4c2b3dca | ||
|
|
677df619fd | ||
|
|
40cd481ec0 | ||
|
|
cfcc4922ac | ||
|
|
1cf85475d7 | ||
|
|
83ce0f01b4 | ||
|
|
d1dcb820bd | ||
|
|
e098b3d050 | ||
|
|
18f7bc7e69 | ||
|
|
1a1afb7b95 | ||
|
|
44f7fdc50a | ||
|
|
3de6e0fc5a | ||
|
|
928b18890c | ||
|
|
828fed54a0 | ||
|
|
1b88d17e01 | ||
|
|
3d54bfb882 | ||
|
|
96914b39fb | ||
|
|
ec11b8abb4 | ||
|
|
2fbe6e8429 | ||
|
|
ac6b60c4c9 | ||
|
|
76eeef2541 | ||
|
|
086b905215 | ||
|
|
713e0d5ecb | ||
|
|
58732e316b | ||
|
|
9199d42e51 | ||
|
|
8c217103f8 | ||
|
|
ab5fd9fef1 | ||
|
|
165d866cfc | ||
|
|
8ba6c6d9f5 | ||
|
|
960962f92f | ||
|
|
cbb23bd536 | ||
|
|
196e36acb2 | ||
|
|
6c05576e53 | ||
|
|
9449b0df27 | ||
|
|
9ecee32d08 | ||
|
|
199c9d9237 | ||
|
|
d95b90281b | ||
|
|
8545f89b2f | ||
|
|
c827b62f7f | ||
|
|
16356aaf36 | ||
|
|
4c4d3e4c25 | ||
|
|
f638113d53 | ||
|
|
09bda83bc8 | ||
|
|
04bba82d2e | ||
|
|
0655e9d76e | ||
|
|
4b4846b0a3 | ||
|
|
d73148a440 | ||
|
|
23a5274881 | ||
|
|
1586180ebb | ||
|
|
43f669b6d9 | ||
|
|
12314c8bd0 | ||
|
|
c44f90cff0 | ||
|
|
3c35ecbd66 | ||
|
|
f41e30af3a | ||
|
|
99ca9d7046 | ||
|
|
ac69de19d0 | ||
|
|
9eda80b5fd | ||
|
|
bdeb127bb5 | ||
|
|
e4ab4d4ff4 | ||
|
|
ea87ffd95b | ||
|
|
f223b745ad | ||
|
|
c0bfb42c12 | ||
|
|
b09bdab3ca | ||
|
|
b4d51391ed | ||
|
|
92aab1fd1f | ||
|
|
c59b4e5189 | ||
|
|
95cf877b49 | ||
|
|
a14ba4855f | ||
|
|
738a34822a | ||
|
|
eab6502d5a | ||
|
|
dab18608c7 | ||
|
|
2b8dbff9ec | ||
|
|
78b5548d20 |
No files matched your search
+44
@@ -15,11 +15,13 @@ 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.he = UI/MailerUI/Hebrew.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.lv = UI/MailerUI/Latvian.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
|
||||
@@ -30,9 +32,11 @@ 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.sr = UI/MailerUI/Serbian.lproj/Localizable.strings
|
||||
trans.sv = UI/MailerUI/Swedish.lproj/Localizable.strings
|
||||
trans.tr_TR = UI/MailerUI/TurkishTurkey.lproj/Localizable.strings
|
||||
trans.uk = UI/MailerUI/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_CN = UI/MailerUI/ChineseChina.lproj/Localizable.strings
|
||||
trans.zh_TW = UI/MailerUI/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.ui-preferencesui]
|
||||
@@ -49,11 +53,13 @@ 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.he = UI/PreferencesUI/Hebrew.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.lv = UI/PreferencesUI/Latvian.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
|
||||
@@ -64,9 +70,11 @@ 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.sr = UI/PreferencesUI/Serbian.lproj/Localizable.strings
|
||||
trans.sv = UI/PreferencesUI/Swedish.lproj/Localizable.strings
|
||||
trans.tr_TR = UI/PreferencesUI/TurkishTurkey.lproj/Localizable.strings
|
||||
trans.uk = UI/PreferencesUI/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_CN = UI/PreferencesUI/ChineseChina.lproj/Localizable.strings
|
||||
trans.zh_TW = UI/PreferencesUI/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.ui-scheduler]
|
||||
@@ -83,11 +91,13 @@ 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.he = UI/Scheduler/Hebrew.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.lv = UI/Scheduler/Latvian.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
|
||||
@@ -98,9 +108,11 @@ 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.sr = UI/Scheduler/Serbian.lproj/Localizable.strings
|
||||
trans.sv = UI/Scheduler/Swedish.lproj/Localizable.strings
|
||||
trans.tr_TR = UI/Scheduler/TurkishTurkey.lproj/Localizable.strings
|
||||
trans.uk = UI/Scheduler/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_CN = UI/Scheduler/ChineseChina.lproj/Localizable.strings
|
||||
trans.zh_TW = UI/Scheduler/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.ui-contacts]
|
||||
@@ -117,11 +129,13 @@ 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.he = UI/Contacts/Hebrew.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.lv = UI/Contacts/Latvian.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
|
||||
@@ -132,9 +146,11 @@ 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.sr = UI/Contacts/Serbian.lproj/Localizable.strings
|
||||
trans.sv = UI/Contacts/Swedish.lproj/Localizable.strings
|
||||
trans.tr_TR = UI/Contacts/TurkishTurkey.lproj/Localizable.strings
|
||||
trans.uk = UI/Contacts/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_CN = UI/Contacts/ChineseChina.lproj/Localizable.strings
|
||||
trans.zh_TW = UI/Contacts/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.ui-mainui]
|
||||
@@ -151,11 +167,13 @@ 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.he = UI/MainUI/Hebrew.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.lv = UI/MainUI/Latvian.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
|
||||
@@ -166,9 +184,11 @@ 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.sr = UI/MainUI/Serbian.lproj/Localizable.strings
|
||||
trans.sv = UI/MainUI/Swedish.lproj/Localizable.strings
|
||||
trans.tr_TR = UI/MainUI/TurkishTurkey.lproj/Localizable.strings
|
||||
trans.uk = UI/MainUI/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_CN = UI/MainUI/ChineseChina.lproj/Localizable.strings
|
||||
trans.zh_TW = UI/MainUI/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.ui-common]
|
||||
@@ -185,11 +205,13 @@ 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.he = UI/Common/Hebrew.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.lv = UI/Common/Latvian.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
|
||||
@@ -200,9 +222,11 @@ 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.sr = UI/Common/Serbian.lproj/Localizable.strings
|
||||
trans.sv = UI/Common/Swedish.lproj/Localizable.strings
|
||||
trans.tr_TR = UI/Common/TurkishTurkey.lproj/Localizable.strings
|
||||
trans.uk = UI/Common/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_CN = UI/Common/ChineseChina.lproj/Localizable.strings
|
||||
trans.zh_TW = UI/Common/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.ui-administrationui]
|
||||
@@ -219,11 +243,13 @@ 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.he = UI/AdministrationUI/Hebrew.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.lv = UI/AdministrationUI/Latvian.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
|
||||
@@ -234,9 +260,11 @@ 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.sr = UI/AdministrationUI/Serbian.lproj/Localizable.strings
|
||||
trans.sv = UI/AdministrationUI/Swedish.lproj/Localizable.strings
|
||||
trans.tr_TR = UI/AdministrationUI/TurkishTurkey.lproj/Localizable.strings
|
||||
trans.uk = UI/AdministrationUI/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_CN = UI/AdministrationUI/ChineseChina.lproj/Localizable.strings
|
||||
trans.zh_TW = UI/AdministrationUI/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.soobjects-appointments]
|
||||
@@ -253,11 +281,13 @@ 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.he = SoObjects/Appointments/Hebrew.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.lv = SoObjects/Appointments/Latvian.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
|
||||
@@ -268,9 +298,11 @@ trans.pt_BR = SoObjects/Appointments/BrazilianPortuguese.lproj/Localizable.strin
|
||||
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.sr = SoObjects/Appointments/Serbian.lproj/Localizable.strings
|
||||
trans.sv = SoObjects/Appointments/Swedish.lproj/Localizable.strings
|
||||
trans.tr_TR = SoObjects/Appointments/TurkishTurkey.lproj/Localizable.strings
|
||||
trans.uk = SoObjects/Appointments/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_CN = SoObjects/Appointments/ChineseChina.lproj/Localizable.strings
|
||||
trans.zh_TW = SoObjects/Appointments/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.soobjects-contacts]
|
||||
@@ -287,11 +319,13 @@ 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.he = SoObjects/Contacts/Hebrew.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.lv = SoObjects/Contacts/Latvian.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
|
||||
@@ -302,9 +336,11 @@ 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.sr = SoObjects/Contacts/Serbian.lproj/Localizable.strings
|
||||
trans.sv = SoObjects/Contacts/Swedish.lproj/Localizable.strings
|
||||
trans.tr_TR = SoObjects/Contacts/TurkishTurkey.lproj/Localizable.strings
|
||||
trans.uk = SoObjects/Contacts/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_CN = SoObjects/Contacts/ChineseChina.lproj/Localizable.strings
|
||||
trans.zh_TW = SoObjects/Contacts/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.soobjects-mailer]
|
||||
@@ -321,11 +357,13 @@ 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.he = SoObjects/Mailer/Hebrew.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.lv = SoObjects/Mailer/Latvian.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
|
||||
@@ -336,9 +374,11 @@ 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.sr = SoObjects/Mailer/Serbian.lproj/Localizable.strings
|
||||
trans.sv = SoObjects/Mailer/Swedish.lproj/Localizable.strings
|
||||
trans.tr_TR = SoObjects/Mailer/TurkishTurkey.lproj/Localizable.strings
|
||||
trans.uk = SoObjects/Mailer/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_CN = SoObjects/Mailer/ChineseChina.lproj/Localizable.strings
|
||||
trans.zh_TW = SoObjects/Mailer/ChineseTaiwan.lproj/Localizable.strings
|
||||
|
||||
[sogo.ui-mailpartviewers]
|
||||
@@ -355,11 +395,13 @@ 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.he = UI/MailPartViewers/Hebrew.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.lv = UI/MailPartViewers/Latvian.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
|
||||
@@ -370,7 +412,9 @@ 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.sr = UI/MailPartViewers/Serbian.lproj/Localizable.strings
|
||||
trans.sv = UI/MailPartViewers/Swedish.lproj/Localizable.strings
|
||||
trans.tr_TR = UI/MailPartViewers/TurkishTurkey.lproj/Localizable.strings
|
||||
trans.uk = UI/MailPartViewers/Ukrainian.lproj/Localizable.strings
|
||||
trans.zh_CN = UI/MailPartViewers/ChineseChina.lproj/Localizable.strings
|
||||
trans.zh_TW = UI/MailPartViewers/ChineseTaiwan.lproj/Localizable.strings
|
||||
@@ -0,0 +1,27 @@
|
||||
const tracker = {
|
||||
filename: "Version",
|
||||
updater: require("./Scripts/standard-version-updater.js")
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
tagPrefix: "SOGo-",
|
||||
issueUrlFormat: "https://www.sogo.nu/bugs/view.php?id={{id}}",
|
||||
compareUrlFormat: "{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}",
|
||||
types: [
|
||||
{type: "feat", section: "Features"},
|
||||
{type: "refactor", section: "Enhancements"},
|
||||
{type: "perf", section: "Enhancements"},
|
||||
{type: "i18n", section: "Localization"},
|
||||
{type: "fix", section: "Bug Fixes"},
|
||||
{type: "chore", hidden: true},
|
||||
{type: "docs", hidden: true},
|
||||
{type: "style", hidden: true},
|
||||
{type: "test", hidden: true}
|
||||
],
|
||||
skip: {
|
||||
commit: true,
|
||||
tag: true
|
||||
},
|
||||
packageFiles: [tracker],
|
||||
bumpFiles: [tracker]
|
||||
}
|
||||
+101
-10
@@ -87,7 +87,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
|
||||
{
|
||||
NSArray *emails, *addresses, *categories, *elements;
|
||||
CardElement *n, *homeAdr, *workAdr;
|
||||
NSMutableArray *other_addresses;
|
||||
CardElement *n, *homeAdr, *workAdr, *otherAdr;
|
||||
NSMutableString *s, *a;
|
||||
NSString *url;
|
||||
id o;
|
||||
@@ -142,7 +143,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
[s appendFormat: @"<JobTitle xmlns=\"Contacts:\">%@</JobTitle>", [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
if ((o = [self preferredEMail]))
|
||||
[s appendFormat: @"<Email1Address xmlns=\"Contacts:\">%@</Email1Address>", o];
|
||||
[s appendFormat: @"<Email1Address xmlns=\"Contacts:\">%@</Email1Address>", [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
|
||||
// Secondary email addresses (2 and 3)
|
||||
@@ -152,7 +153,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
{
|
||||
o = [[emails objectAtIndex: i] flattenedValuesForKey: @""];
|
||||
|
||||
[s appendFormat: @"<Email%dAddress xmlns=\"Contacts:\">%@</Email%dAddress>", i+2, o, i+2];
|
||||
[s appendFormat: @"<Email%dAddress xmlns=\"Contacts:\">%@</Email%dAddress>", i+2, [o activeSyncRepresentationInContext: context], i+2];
|
||||
|
||||
if (i == 1)
|
||||
break;
|
||||
@@ -185,12 +186,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
a = [NSMutableString string];
|
||||
|
||||
if ((o = [homeAdr flattenedValueAtIndex: 2 forKey: @""]))
|
||||
[a appendString: o];
|
||||
[a appendString: [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
if ((o = [homeAdr flattenedValueAtIndex: 1 forKey: @""]) && [o length])
|
||||
[a appendFormat: @"\n%@", o];
|
||||
[a appendFormat: @"\n%@", [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
[s appendFormat: @"<HomeStreet xmlns=\"Contacts:\">%@</HomeStreet>", [a activeSyncRepresentationInContext: context]];
|
||||
[s appendFormat: @"<HomeStreet xmlns=\"Contacts:\">%@</HomeStreet>", a];
|
||||
|
||||
if ((o = [homeAdr flattenedValueAtIndex: 3 forKey: @""]))
|
||||
[s appendFormat: @"<HomeCity xmlns=\"Contacts:\">%@</HomeCity>", [o activeSyncRepresentationInContext: context]];
|
||||
@@ -216,12 +217,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
a = [NSMutableString string];
|
||||
|
||||
if ((o = [workAdr flattenedValueAtIndex: 2 forKey: @""]))
|
||||
[a appendString: o];
|
||||
[a appendString: [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
if ((o = [workAdr flattenedValueAtIndex: 1 forKey: @""]) && [o length])
|
||||
[a appendFormat: @"\n%@", o];
|
||||
[a appendFormat: @"\n%@", [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
[s appendFormat: @"<BusinessStreet xmlns=\"Contacts:\">%@</BusinessStreet>", [a activeSyncRepresentationInContext: context]];
|
||||
[s appendFormat: @"<BusinessStreet xmlns=\"Contacts:\">%@</BusinessStreet>", a];
|
||||
|
||||
if ((o = [workAdr flattenedValueAtIndex: 3 forKey: @""]))
|
||||
[s appendFormat: @"<BusinessCity xmlns=\"Contacts:\">%@</BusinessCity>", [o activeSyncRepresentationInContext: context]];
|
||||
@@ -236,6 +237,39 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
[s appendFormat: @"<BusinessCountry xmlns=\"Contacts:\">%@</BusinessCountry>", [o activeSyncRepresentationInContext: context]];
|
||||
}
|
||||
|
||||
|
||||
// Other Address
|
||||
|
||||
other_addresses = [[self childrenWithTag: @"adr"] mutableCopy];
|
||||
[other_addresses removeObjectsInArray: [self childrenWithTag: @"adr" andAttribute: @"type" havingValue: @"work"]];
|
||||
[other_addresses removeObjectsInArray: [self childrenWithTag: @"adr" andAttribute: @"type" havingValue: @"home"]];
|
||||
|
||||
if ([other_addresses count])
|
||||
{
|
||||
otherAdr = [other_addresses objectAtIndex: 0];
|
||||
a = [NSMutableString string];
|
||||
|
||||
if ((o = [otherAdr flattenedValueAtIndex: 2 forKey: @""]))
|
||||
[a appendString: [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
if ((o = [otherAdr flattenedValueAtIndex: 1 forKey: @""]) && [o length])
|
||||
[a appendFormat: @"\n%@", [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
[s appendFormat: @"<OtherStreet xmlns=\"Contacts:\">%@</OtherStreet>", a];
|
||||
|
||||
if ((o = [otherAdr flattenedValueAtIndex: 3 forKey: @""]))
|
||||
[s appendFormat: @"<OtherCity xmlns=\"Contacts:\">%@</OtherCity>", [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
if ((o = [otherAdr flattenedValueAtIndex: 4 forKey: @""]))
|
||||
[s appendFormat: @"<OtherState xmlns=\"Contacts:\">%@</OtherState>", [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
if ((o = [otherAdr flattenedValueAtIndex: 5 forKey: @""]))
|
||||
[s appendFormat: @"<OtherPostalCode xmlns=\"Contacts:\">%@</OtherPostalCode>", [o activeSyncRepresentationInContext: context]];
|
||||
|
||||
if ((o = [otherAdr flattenedValueAtIndex: 6 forKey: @""]))
|
||||
[s appendFormat: @"<OtherCountry xmlns=\"Contacts:\">%@</OtherCountry>", [o activeSyncRepresentationInContext: context]];
|
||||
}
|
||||
|
||||
// Other, less important fields
|
||||
if ((o = [self birthday]))
|
||||
{
|
||||
@@ -271,7 +305,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
inContext: (WOContext *) context
|
||||
{
|
||||
CardElement *element;
|
||||
NSMutableArray *addressLines;
|
||||
NSMutableArray *addressLines, *other_addresses;
|
||||
id o;
|
||||
|
||||
// Contact's note
|
||||
@@ -402,6 +436,63 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
atIndex: 6 forKey: @""];
|
||||
}
|
||||
|
||||
// OtherCountry
|
||||
//
|
||||
|
||||
other_addresses = [[self childrenWithTag: @"adr"] mutableCopy];
|
||||
[other_addresses removeObjectsInArray: [self childrenWithTag: @"adr" andAttribute: @"type" havingValue: @"work"]];
|
||||
[other_addresses removeObjectsInArray: [self childrenWithTag: @"adr" andAttribute: @"type" havingValue: @"home"]];
|
||||
|
||||
if ([other_addresses count])
|
||||
element = [other_addresses objectAtIndex: 0];
|
||||
else
|
||||
{
|
||||
element = [CardElement elementWithTag: @"adr"];
|
||||
[self addChild: element];
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"OtherStreet"]) || ![self _isGhosted: @"OtherStreet" 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: @"OtherCity"]) || ![self _isGhosted: @"OtherCity" inContext: context])
|
||||
{
|
||||
[element setSingleValue: [theValues objectForKey: @"OtherCity"]
|
||||
atIndex: 3 forKey: @""];
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"OtherState"]) || ![self _isGhosted: @"OtherState" inContext: context])
|
||||
{
|
||||
[element setSingleValue: [theValues objectForKey: @"OtherState"]
|
||||
atIndex: 4 forKey: @""];
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"OtherPostalCode"]) || ![self _isGhosted: @"OtherPostalCode" inContext: context])
|
||||
{
|
||||
[element setSingleValue: [theValues objectForKey: @"OtherPostalCode"]
|
||||
atIndex: 5 forKey: @""];
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"OtherCountry"]) || ![self _isGhosted: @"OtherCountry" inContext: context])
|
||||
{
|
||||
[element setSingleValue: [theValues objectForKey: @"OtherCountry"]
|
||||
atIndex: 6 forKey: @""];
|
||||
}
|
||||
|
||||
// Company's name
|
||||
if ((o = [theValues objectForKey: @"CompanyName"]))
|
||||
[self setOrg: o units: nil];
|
||||
|
||||
@@ -53,6 +53,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
- (NSString *) itemid;
|
||||
- (BOOL) acceptsMultiPart;
|
||||
- (NSData *) convertHexStringToBytes;
|
||||
- (NSString *) protocolVersion;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -138,6 +138,31 @@ static NSArray *easCommandParameters = nil;
|
||||
return o;
|
||||
}
|
||||
|
||||
- (NSString *) protocolVersion
|
||||
{
|
||||
NSMutableArray *components;
|
||||
|
||||
components = [NSMutableArray arrayWithArray: [[[self componentsSeparatedByString: @"?"] lastObject] componentsSeparatedByString: @"&"]];
|
||||
|
||||
// We handle BASE64 encoded queryStrings. See http://msdn.microsoft.com/en-us/library/ee160227%28v=exchg.80%29.aspx for details.
|
||||
if ([components count] == 1)
|
||||
{
|
||||
NSData *queryString;
|
||||
const char* qs_bytes;
|
||||
|
||||
queryString = [[components objectAtIndex: 0] dataByDecodingBase64];
|
||||
|
||||
if (![queryString length])
|
||||
return nil;
|
||||
|
||||
qs_bytes = (const char*)[queryString bytes];
|
||||
|
||||
return [NSString stringWithFormat:@"%.1f", (float)((uint8_t)qs_bytes[0]/10)];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *) _valueForParameter: (NSString *) theParameter
|
||||
{
|
||||
NSMutableArray *components;
|
||||
@@ -178,6 +203,11 @@ static NSArray *easCommandParameters = nil;
|
||||
|
||||
// Command code, 1 byte, ie.: cmd=
|
||||
cmd_code = qs_bytes[1];
|
||||
|
||||
// Check whether the command code is within the known range.
|
||||
if (cmd_code < 0 || cmd_code > 22)
|
||||
return nil;
|
||||
|
||||
[components addObject: [NSString stringWithFormat: @"cmd=%@", [easCommandCodes objectAtIndex: cmd_code]]];
|
||||
|
||||
// Device ID length and Device ID (variable)
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+1071
-292
File diff suppressed because it is too large.
Load diff
@@ -42,6 +42,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
- (NSString *) activeSyncRepresentationInContext: (WOContext *) context;
|
||||
- (void) takeActiveSyncValues: (NSDictionary *) theValues
|
||||
inContext: (WOContext *) context;
|
||||
- (NSString *) storeMail: (NSDictionary *) theValues
|
||||
inContext: (WOContext *) _context;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#import <Foundation/NSException.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSCharacterSet.h>
|
||||
#import <Foundation/NSTimeZone.h>
|
||||
|
||||
#import <NGCards/iCalCalendar.h>
|
||||
#import <NGCards/iCalDateTime.h>
|
||||
@@ -46,9 +47,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#import <NGExtensions/NGQuotedPrintableCoding.h>
|
||||
#import <NGExtensions/NSString+misc.h>
|
||||
#import <NGExtensions/NSString+Encoding.h>
|
||||
#import <NGExtensions/NGHashMap.h>
|
||||
#import <NGImap4/NGImap4Envelope.h>
|
||||
#import <NGImap4/NGImap4EnvelopeAddress.h>
|
||||
#import <NGImap4/NSString+Imap4.h>
|
||||
#import <NGImap4/NGImap4Connection.h>
|
||||
#import <NGImap4/NGImap4Client.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGObjWeb/WOApplication.h>
|
||||
|
||||
@@ -63,6 +67,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#import <Mailer/SOGoMailLabel.h>
|
||||
|
||||
#import <SOGo/SOGoUserDefaults.h>
|
||||
#import <SOGo/SOGoUserFolder.h>
|
||||
|
||||
#include "iCalTimeZone+ActiveSync.h"
|
||||
#include "NSData+ActiveSync.h"
|
||||
@@ -73,6 +78,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <Appointments/iCalPerson+SOGo.h>
|
||||
#include <Mailer/NSString+Mail.h>
|
||||
#include <Mailer/SOGoMailBodyPart.h>
|
||||
#import <Mailer/SOGoMailLabel.h>
|
||||
#import <Mailer/SOGoMailFolder.h>
|
||||
#import <Mailer/SOGoMailObject.h>
|
||||
#import <Mailer/SOGoMailAccount.h>
|
||||
#import <Mailer/SOGoMailAccounts.h>
|
||||
|
||||
#include <SOGo/SOGoUser.h>
|
||||
#include <SOGo/NSString+Utilities.h>
|
||||
|
||||
@@ -163,7 +174,7 @@ struct GlobalObjectId {
|
||||
const char *bytes;
|
||||
|
||||
uid = [event uid];
|
||||
uidAsASCII = [uid decodeFromHexidecimal];
|
||||
uidAsASCII = [uid dataUsingEncoding: NSASCIIStringEncoding];
|
||||
newGlobalId = (struct GlobalObjectId*)calloc(sizeof(uint8_t), sizeof(struct GlobalObjectId) + 0x0c + [uidAsASCII length]);
|
||||
|
||||
prefix = @"040000008200e00074c5b7101a82e008";
|
||||
@@ -934,7 +945,7 @@ struct GlobalObjectId {
|
||||
else if ([method isEqualToString: @"COUNTER"])
|
||||
className = @"IPM.Schedule.Meeting.Resp.Tent";
|
||||
else if ([method isEqualToString: @"CANCEL"])
|
||||
className = @"IPM.Schedule.Meeting.Cancelled";
|
||||
className = @"IPM.Schedule.Meeting.Canceled";
|
||||
else
|
||||
className = @"IPM.Appointment";
|
||||
|
||||
@@ -962,7 +973,12 @@ struct GlobalObjectId {
|
||||
|
||||
// Location
|
||||
if ([[event location] length])
|
||||
[s appendFormat: @"<Location xmlns=\"Email:\">%@</Location>", [[event location] activeSyncRepresentationInContext: context]];
|
||||
{
|
||||
if ([[context objectForKey: @"ASProtocolVersion"] floatValue] >= 16.0)
|
||||
[s appendFormat: @"<Location xmlns=\"AirSyncBase:\"><DisplayName>%@</DisplayName></Location>", [[event location] activeSyncRepresentationInContext: context]];
|
||||
else
|
||||
[s appendFormat: @"<Location xmlns=\"Email:\">%@</Location>", [[event location] activeSyncRepresentationInContext: context]];
|
||||
}
|
||||
|
||||
[s appendFormat: @"<Organizer xmlns=\"Email:\">%@</Organizer>", [[[event organizer] mailAddress] activeSyncRepresentationInContext: context]];
|
||||
|
||||
@@ -1003,7 +1019,7 @@ 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
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"14.1"])
|
||||
if ([[context objectForKey: @"ASProtocolVersion"] floatValue] >= 14.1)
|
||||
[s appendFormat: @"<MeetingMessageType xmlns=\"Email2:\">%d</MeetingMessageType>", 1];
|
||||
|
||||
[s appendString: @"</MeetingRequest>"];
|
||||
@@ -1169,7 +1185,7 @@ struct GlobalObjectId {
|
||||
truncated = 0;
|
||||
}
|
||||
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
if ([[context objectForKey: @"ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
{
|
||||
[s appendFormat: @"<Body xmlns=\"Email:\">%@</Body>", content];
|
||||
[s appendFormat: @"<BodyTruncated xmlns=\"Email:\">%d</BodyTruncated>", truncated];
|
||||
@@ -1204,7 +1220,7 @@ struct GlobalObjectId {
|
||||
{
|
||||
int i;
|
||||
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
if ([[context objectForKey: @"ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
[s appendString: @"<Attachments xmlns=\"Email:\">"];
|
||||
else
|
||||
[s appendString: @"<Attachments xmlns=\"AirSyncBase:\">"];
|
||||
@@ -1219,18 +1235,24 @@ 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
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
if ([[context objectForKey: @"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"]];
|
||||
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
if ([[context objectForKey: @"ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
{
|
||||
[s appendFormat: @"<AttMethod>%d</AttMethod>", 1];
|
||||
[s appendFormat: @"<AttSize>%d</AttSize>", [[value objectForKey: @"size"] intValue]];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([[value objectForKey: @"bodyId"] length])
|
||||
{
|
||||
[s appendFormat: @"<ContentId>%@</ContentId>", [[value objectForKey: @"bodyId"] activeSyncRepresentationInContext: context]];
|
||||
[s appendFormat: @"<IsInline>%d</IsInline>", 1];
|
||||
}
|
||||
|
||||
[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];
|
||||
@@ -1267,8 +1289,7 @@ struct GlobalObjectId {
|
||||
[s appendFormat: @"</Categories>"];
|
||||
}
|
||||
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"14.0"] ||
|
||||
[[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"14.1"])
|
||||
if ([[context objectForKey: @"ASProtocolVersion"] floatValue] >= 14.0)
|
||||
{
|
||||
id value;
|
||||
NSString *reference;
|
||||
@@ -1286,6 +1307,13 @@ struct GlobalObjectId {
|
||||
[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]];
|
||||
|
||||
if ([self replied])
|
||||
[s appendFormat: @"<LastVerbExecuted xmlns=\"Email2:\">%d</LastVerbExecuted>", 1];
|
||||
else if ([self forwarded])
|
||||
[s appendFormat: @"<LastVerbExecuted xmlns=\"Email2:\">%d</LastVerbExecuted>", 3];
|
||||
else
|
||||
[s appendFormat: @"<LastVerbExecuted xmlns=\"Email2:\">%d</LastVerbExecuted>", 0];
|
||||
}
|
||||
|
||||
// FIXME - support these in the future
|
||||
@@ -1410,4 +1438,104 @@ struct GlobalObjectId {
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *) storeMail: (NSDictionary *) theValues
|
||||
inContext: (WOContext *) _context
|
||||
{
|
||||
NSString *dateReceived, *folder, *s;
|
||||
NGMimeMessageGenerator *generator;
|
||||
NGMimeMessage *bounceMessage;
|
||||
NSDictionary *identity;
|
||||
NGMutableHashMap *map;
|
||||
NGImap4Client *client;
|
||||
NSData *message_data;
|
||||
|
||||
id o, result;
|
||||
int bodyType;
|
||||
|
||||
identity = [[context activeUser] primaryIdentity];
|
||||
message_data = nil;
|
||||
bodyType = 1;
|
||||
|
||||
if ((o = [[theValues objectForKey: @"Body"] objectForKey: @"Type"]))
|
||||
bodyType = [o intValue];
|
||||
|
||||
if (bodyType == 4)
|
||||
{
|
||||
s = [[theValues objectForKey: @"Body"] objectForKey: @"Data"];
|
||||
message_data = [s dataUsingEncoding: NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
if (bodyType == 1 || bodyType == 2)
|
||||
{
|
||||
map = [[[NGMutableHashMap alloc] initWithCapacity: 1] autorelease];
|
||||
|
||||
[map setObject: [NSString stringWithFormat: @"%@ <%@>", [identity objectForKey: @"fullName"], [identity objectForKey: @"email"]] forKey: @"from"];
|
||||
if ((o = [theValues objectForKey: @"To"]))
|
||||
[map setObject: o forKey: @"to"];
|
||||
|
||||
if ((o = [theValues objectForKey: @"Subject"]))
|
||||
[map setObject: o forKey: @"subject"];
|
||||
|
||||
o = [[theValues objectForKey: @"DateReceived"] calendarDate];
|
||||
|
||||
if (!o)
|
||||
o = [NSCalendarDate date];
|
||||
|
||||
#if GNUSTEP_BASE_MINOR_VERSION < 21
|
||||
dateReceived = [o descriptionWithCalendarFormat: @"%a, %d %b %Y %H:%M:%S %z"
|
||||
timeZone: [NSTimeZone timeZoneWithName: @"GMT"]
|
||||
locale: nil];
|
||||
#else
|
||||
dateReceived = [o descriptionWithCalendarFormat: @"%a, %d %b %Y %H:%M:%S %z"
|
||||
timeZone: [NSTimeZone timeZoneWithName: @"GMT"]
|
||||
locale: [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSArray arrayWithObjects: @"Jan", @"Feb", @"Mar", @"Apr",
|
||||
@"May", @"Jun", @"Jul", @"Aug",
|
||||
@"Sep", @"Oct", @"Nov", @"Dec", nil],
|
||||
@"NSShortMonthNameArray",
|
||||
[NSArray arrayWithObjects: @"Sun", @"Mon", @"Tue", @"Wed", @"Thu",
|
||||
@"Fri", @"Sat", nil],
|
||||
@"NSShortWeekDayNameArray",
|
||||
nil]];
|
||||
#endif
|
||||
|
||||
[map setObject: dateReceived forKey: @"date"];
|
||||
[map setObject: [NSString generateMessageID] forKey: @"message-id"];
|
||||
[map setObject: (bodyType == 1 ? @"text/plain; charset=utf-8" : @"text/html; charset=utf-8")
|
||||
forKey: @"content-type"];
|
||||
[map setObject: @"quoted-printable" forKey: @"content-transfer-encoding"];
|
||||
|
||||
bounceMessage = [[[NGMimeMessage alloc] initWithHeader: map] autorelease];
|
||||
|
||||
[bounceMessage setBody: [[NSString stringWithFormat: @"%@", [[theValues objectForKey: @"Body"] objectForKey: @"Data"] ] dataUsingEncoding: NSUTF8StringEncoding]];
|
||||
|
||||
generator = [[[NGMimeMessageGenerator alloc] init] autorelease];
|
||||
message_data = [generator generateMimeFromPart: bounceMessage];
|
||||
}
|
||||
|
||||
if (message_data)
|
||||
{
|
||||
client = [[self imap4Connection] client];
|
||||
|
||||
if (![imap4 doesMailboxExistAtURL: [container imap4URL]])
|
||||
{
|
||||
[[self imap4Connection] createMailbox: [[self imap4Connection] imap4FolderNameForURL: [container imap4URL]]
|
||||
atURL: [[self mailAccountFolder] imap4URL]];
|
||||
[imap4 flushFolderHierarchyCache];
|
||||
}
|
||||
|
||||
folder = [imap4 imap4FolderNameForURL: [container imap4URL]];
|
||||
|
||||
result = [client append: message_data
|
||||
toFolder: folder
|
||||
withFlags: [NSArray arrayWithObjects: @"draft", nil]];
|
||||
|
||||
if ([[result objectForKey: @"result"] boolValue])
|
||||
return [NSString stringWithFormat: @"%d", [self IMAP4IDFromAppendResult: result]];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -39,6 +39,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#import <NGCards/iCalAlarm.h>
|
||||
#import <NGCards/iCalEvent.h>
|
||||
#import <NGCards/iCalTrigger.h>
|
||||
#import <NGCards/NSCalendarDate+NGCards.h>
|
||||
|
||||
#include "NSDate+ActiveSync.h"
|
||||
|
||||
@implementation iCalAlarm (ActiveSync)
|
||||
|
||||
@@ -56,9 +59,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
nextAlarmDate = [self nextAlarmDate];
|
||||
delta = (int)(([[(iCalEvent *)parent startDate] timeIntervalSince1970] - [nextAlarmDate timeIntervalSince1970])/60);
|
||||
|
||||
// don't send negative reminder - not supported
|
||||
if (delta > 0)
|
||||
[s appendFormat: @"<Reminder xmlns=\"Calendar:\">%d</Reminder>", (int)delta];
|
||||
if ([parent isKindOfClass: [iCalEvent class]])
|
||||
{
|
||||
// don't send negative reminder - not supported
|
||||
if (delta > 0)
|
||||
[s appendFormat: @"<Reminder xmlns=\"Calendar:\">%d</Reminder>", (int)delta];
|
||||
}
|
||||
else
|
||||
{
|
||||
[s appendFormat: @"<ReminderTime xmlns=\"Task:\">%@</ReminderTime>", [nextAlarmDate activeSyncRepresentationInContext: context]];
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
@@ -70,37 +80,47 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
iCalTrigger *trigger;
|
||||
id o;
|
||||
|
||||
o = [theValues objectForKey: @"Reminder"];
|
||||
|
||||
// Outlook: if reminder is set to 0 minutes before start save it as 1 minute since -> 0 minutes in not accepted by SOGo
|
||||
if ([o isEqualToString: @"0"])
|
||||
o = @"1";
|
||||
|
||||
trigger = [iCalTrigger elementWithTag: @"TRIGGER"];
|
||||
[trigger setValueType: @"DURATION"];
|
||||
[self setTrigger: trigger];
|
||||
[self setAction: @"DISPLAY"];
|
||||
|
||||
// SOGo web ui only supports 1w but not 2w (custom reminder only supports min/hours/days)
|
||||
// 1week = -P1W
|
||||
// 2weeks > -PxD
|
||||
// xdays > -PxD
|
||||
// xhours -> -PTxH
|
||||
// xmin -> -PTxM
|
||||
if ([o intValue] == 10080)
|
||||
[trigger setSingleValue: [NSString stringWithFormat: @"-P1W" ] forKey: @""];
|
||||
else
|
||||
if ((o = [theValues objectForKey: @"Reminder"]))
|
||||
{
|
||||
if (([o intValue] % 1440) == 0)
|
||||
[trigger setSingleValue: [NSString stringWithFormat: @"-P%dD", ([o intValue] / 1440)] forKey: @""];
|
||||
// Outlook: if reminder is set to 0 minutes before starttime, save it as 1 minute since -> 0 minutes in not accepted by SOGo
|
||||
if ([o isEqualToString: @"0"])
|
||||
o = @"1";
|
||||
|
||||
trigger = [iCalTrigger elementWithTag: @"TRIGGER"];
|
||||
[trigger setValueType: @"DURATION"];
|
||||
[self setTrigger: trigger];
|
||||
[self setAction: @"DISPLAY"];
|
||||
|
||||
// SOGo web ui only supports 1w but not 2w (custom reminder only supports min/hours/days)
|
||||
// 1week = -P1W
|
||||
// 2weeks > -PxD
|
||||
// xdays > -PxD
|
||||
// xhours -> -PTxH
|
||||
// xmin -> -PTxM
|
||||
if ([o intValue] == 10080)
|
||||
[trigger setSingleValue: [NSString stringWithFormat: @"-P1W" ] forKey: @""];
|
||||
else
|
||||
{
|
||||
if (([o intValue] % 60) == 0)
|
||||
[trigger setSingleValue: [NSString stringWithFormat: @"-PT%dH", ([o intValue] / 60)] forKey: @""];
|
||||
if (([o intValue] % 1440) == 0)
|
||||
[trigger setSingleValue: [NSString stringWithFormat: @"-P%dD", ([o intValue] / 1440)] forKey: @""];
|
||||
else
|
||||
[trigger setSingleValue: [NSString stringWithFormat: @"-PT%@M", o] forKey: @""];
|
||||
{
|
||||
if (([o intValue] % 60) == 0)
|
||||
[trigger setSingleValue: [NSString stringWithFormat: @"-PT%dH", ([o intValue] / 60)] forKey: @""];
|
||||
else
|
||||
[trigger setSingleValue: [NSString stringWithFormat: @"-PT%@M", o] forKey: @""];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((o = [theValues objectForKey: @"ReminderTime"]))
|
||||
{
|
||||
o = [o calendarDate];
|
||||
trigger = [iCalTrigger elementWithTag: @"TRIGGER"];
|
||||
[trigger setValueType: @"DATE-TIME"];
|
||||
[trigger setSingleValue: [NSString stringWithFormat: @"%@Z", [o iCalFormattedDateTimeString]] forKey: @""];
|
||||
[self setTrigger: trigger];
|
||||
[self setAction: @"DISPLAY"];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -70,7 +70,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
- (int) _attendeeStatus: (iCalPerson *) attendee
|
||||
{
|
||||
int attendee_status;
|
||||
|
||||
|
||||
attendee_status = 5;
|
||||
if ([[attendee partStat] caseInsensitiveCompare: @"ACCEPTED"] == NSOrderedSame)
|
||||
attendee_status = 3;
|
||||
@@ -82,6 +82,29 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
return attendee_status;
|
||||
}
|
||||
|
||||
//
|
||||
// Possible values are:
|
||||
// 0 Free
|
||||
// 1 Tentative
|
||||
// 2 Busy
|
||||
// 3 Out of Office
|
||||
// 4 Working elsewhere
|
||||
//
|
||||
- (int) _busyStatus: (iCalPerson *) attendee
|
||||
{
|
||||
int attendee_status;
|
||||
|
||||
attendee_status = 2;
|
||||
|
||||
if ([[attendee partStat] caseInsensitiveCompare: @"DECLINED"] == NSOrderedSame)
|
||||
attendee_status = 0;
|
||||
else if ([[attendee partStat] caseInsensitiveCompare: @"TENTATIVE"] == NSOrderedSame)
|
||||
attendee_status = 1;
|
||||
|
||||
return attendee_status;
|
||||
}
|
||||
|
||||
|
||||
- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
|
||||
{
|
||||
NSMutableString *s;
|
||||
@@ -190,7 +213,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
}
|
||||
else
|
||||
{
|
||||
meetingStatus = 0; // appointment
|
||||
meetingStatus = 0; // The event is an appointment, which has no attendees.
|
||||
}
|
||||
|
||||
// This depends on the 'NEEDS-ACTION' parameter.
|
||||
@@ -211,7 +234,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
[s appendFormat: @"<DisallowNewTimeProposal xmlns=\"Calendar:\">%d</DisallowNewTimeProposal>", 1];
|
||||
|
||||
// BusyStatus -- http://msdn.microsoft.com/en-us/library/ee202290(v=exchg.80).aspx
|
||||
[s appendFormat: @"<BusyStatus xmlns=\"Calendar:\">%d</BusyStatus>", 2];
|
||||
[s appendFormat: @"<BusyStatus xmlns=\"Calendar:\">%d</BusyStatus>", [self _busyStatus: attendee]];
|
||||
}
|
||||
else
|
||||
{
|
||||
// If it's a normal event (i.e. with no organizer/attendee) or we are the organizer of an event
|
||||
// invitation, we set the busy status depending on TRANSP.
|
||||
[s appendFormat: @"<BusyStatus xmlns=\"Calendar:\">%d</BusyStatus>", (([self isOpaque]) ? 2 : 0)];
|
||||
}
|
||||
|
||||
[s appendFormat: @"<MeetingStatus xmlns=\"Calendar:\">%d</MeetingStatus>", meetingStatus];
|
||||
@@ -222,7 +251,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Location
|
||||
if ([[self location] length])
|
||||
[s appendFormat: @"<Location xmlns=\"Calendar:\">%@</Location>", [[self location] activeSyncRepresentationInContext: context]];
|
||||
{
|
||||
if ([[context objectForKey: @"ASProtocolVersion"] floatValue] >= 16.0)
|
||||
[s appendFormat: @"<Location xmlns=\"AirSyncBase:\"><DisplayName>%@</DisplayName></Location>", [[self location] activeSyncRepresentationInContext: context]];
|
||||
else
|
||||
[s appendFormat: @"<Location xmlns=\"Calendar:\">%@</Location>", [[self location] activeSyncRepresentationInContext: context]];
|
||||
}
|
||||
|
||||
// Importance - NOT SUPPORTED - DO NOT ENABLE
|
||||
//o = [self priority];
|
||||
@@ -251,7 +285,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// 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"])
|
||||
if ([[context objectForKey: @"ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
{
|
||||
[s appendFormat: @"<Body xmlns=\"Calendar:\">%@</Body>", o];
|
||||
[s appendString: @"<BodyTruncated xmlns=\"Calendar:\">0</BodyTruncated>"];
|
||||
@@ -429,7 +463,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
occurences = [NSMutableArray arrayWithArray: [[self parent] events]];
|
||||
|
||||
if ((o = [theValues objectForKey: @"UID"]))
|
||||
if ((o = [theValues objectForKey: ([[context objectForKey: @"ASProtocolVersion"] floatValue] >= 16.0) ? @"ClientUid" : @"UID"]))
|
||||
[self setUid: o];
|
||||
|
||||
// FIXME: merge with iCalToDo
|
||||
@@ -452,7 +486,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
if ((o = [theValues objectForKey: @"BusyStatus"]))
|
||||
{
|
||||
[o intValue];
|
||||
if ([o boolValue])
|
||||
[self setTransparency: @"OPAQUE"];
|
||||
else
|
||||
[self setTransparency: @"TRANSPARENT"];
|
||||
}
|
||||
|
||||
//
|
||||
@@ -494,7 +531,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
}
|
||||
|
||||
// FIXME: merge with iCalToDo
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
if ([[context objectForKey: @"ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
{
|
||||
if ((o = [theValues objectForKey: @"Body"]))
|
||||
[self setComment: o];
|
||||
@@ -505,8 +542,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
[self setComment: o];
|
||||
}
|
||||
|
||||
if ((o = [theValues objectForKey: @"Location"]))
|
||||
if ([[context objectForKey: @"ASProtocolVersion"] floatValue] < 16.0 && (o = [theValues objectForKey: @"Location"]))
|
||||
[self setLocation: o];
|
||||
else if ([[context objectForKey: @"ASProtocolVersion"] floatValue] >= 16.0 && (o = [theValues objectForKey: @"Location"]) && [o isKindOfClass: [NSDictionary class]])
|
||||
[self setLocation: [o objectForKey: @"DisplayName"]];
|
||||
|
||||
deltasecs = 0;
|
||||
start = nil;
|
||||
@@ -557,7 +596,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
{
|
||||
// Ignore the alarm for now
|
||||
}
|
||||
else if ((o = [theValues objectForKey: @"Reminder"]))
|
||||
else if ((o = [theValues objectForKey: @"Reminder"]) && [o length])
|
||||
{
|
||||
// NOTE: Outlook sends a 15 min reminder (18 hour for allday) if no reminder is specified
|
||||
// although no default reminder is defined (File -> Options -> Clendar -> Calendar Options - > Default Reminders)
|
||||
@@ -580,7 +619,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
}
|
||||
|
||||
// Recurrence
|
||||
if ((o = [theValues objectForKey: @"Recurrence"]))
|
||||
if ((o = [theValues objectForKey: @"Recurrence"]) && [o isKindOfClass: [NSDictionary class]])
|
||||
{
|
||||
iCalRecurrenceRule *rule;
|
||||
|
||||
@@ -808,7 +847,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Attendees - we don't touch the values if we're an attendee. This is gonna
|
||||
// be done automatically by the ActiveSync client when invoking MeetingResponse.
|
||||
if (![self userIsAttendee: [context activeUser]])
|
||||
@@ -833,7 +871,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
person = [iCalPerson elementWithTag: @"attendee"];
|
||||
[person setCn: [attendee objectForKey: @"Attendee_Name"]];
|
||||
[person setEmail: [attendee objectForKey: @"Attendee_Email"]];
|
||||
|
||||
|
||||
status = [[attendee objectForKey: @"Attendee_Status"] intValue];
|
||||
|
||||
switch (status)
|
||||
@@ -850,7 +888,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
case 0:
|
||||
case 5:
|
||||
default:
|
||||
[person setPartStat: @"NEEDS-ACTION"];
|
||||
{
|
||||
[person setPartStat: @"NEEDS-ACTION"];
|
||||
[person setRsvp: @"TRUE"];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -862,6 +903,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
[self setAttendees: attendees];
|
||||
}
|
||||
}
|
||||
|
||||
[self setLastModified: [NSCalendarDate calendarDate]];
|
||||
}
|
||||
|
||||
- (void) changeParticipationStatus: (NSDictionary *) theValues
|
||||
|
||||
@@ -35,21 +35,42 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <NGCards/iCalEvent.h>
|
||||
#import <NGCards/iCalToDo.h>
|
||||
#import <NGCards/iCalByDayMask.h>
|
||||
|
||||
#import <NGCards/iCalDateTime.h>
|
||||
#import <NGCards/iCalTimeZone.h>
|
||||
|
||||
#import "NSCalendarDate+ActiveSync.h"
|
||||
#import "NSDate+ActiveSync.h"
|
||||
|
||||
@implementation iCalRecurrenceRule (ActiveSync)
|
||||
|
||||
- (NSCalendarDate *) _adjustedStartDate
|
||||
{
|
||||
iCalTimeZone *timeZone;
|
||||
|
||||
timeZone = [(iCalDateTime *)[[self parent] firstChildWithTag: @"dtstart"] timeZone];
|
||||
if (timeZone)
|
||||
return [timeZone computedDateForDate: [[self parent] startDate]];
|
||||
else
|
||||
return [[self parent] startDate];
|
||||
}
|
||||
|
||||
- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
|
||||
{
|
||||
NSMutableString *s;
|
||||
NSString *t;
|
||||
int type;
|
||||
|
||||
s = [NSMutableString string];
|
||||
|
||||
[s appendString: @"<Recurrence xmlns=\"Calendar:\">"];
|
||||
|
||||
if ([[self parent] isKindOfClass: [iCalToDo class]])
|
||||
t = @"Tasks";
|
||||
else
|
||||
t = @"Calendar";
|
||||
|
||||
[s appendFormat: @"<Recurrence xmlns=\"%@:\">", t];
|
||||
|
||||
// 0 -> daily, 1 -> weekly, 2 -> montly, 5 -> yearly
|
||||
type = 0;
|
||||
@@ -61,11 +82,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// 1 -> sunday, 2 -> monday, 4 -> tuesday, 8 -> wednesday, 16 -> thursday, 32 -> friday, 64 -> saturday, 127 -> last day of month (montly or yearl recurrences only)
|
||||
if ([[self byDayMask] isWeekDays])
|
||||
{
|
||||
[s appendFormat: @"<Recurrence_DayOfWeek xmlns=\"Calendar:\">%d</Recurrence_DayOfWeek>", (2|4|8|16|32)];
|
||||
[s appendFormat: @"<Recurrence_DayOfWeek xmlns=\"%@:\">%d</Recurrence_DayOfWeek>", t, (2|4|8|16|32)];
|
||||
}
|
||||
else
|
||||
{
|
||||
[s appendFormat: @"<Recurrence_Interval xmlns=\"Calendar:\">%d</Recurrence_Interval>", [self repeatInterval]];
|
||||
[s appendFormat: @"<Recurrence_Interval xmlns=\"%@:\">%d</Recurrence_Interval>", t, [self repeatInterval]];
|
||||
}
|
||||
}
|
||||
else if ([self frequency] == iCalRecurrenceFrequenceWeekly)
|
||||
@@ -90,11 +111,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
{
|
||||
// No byDayMask, we take the event's start date to compute the DayOfWeek
|
||||
// 0 == Sunday, 6 == Saturday
|
||||
v = (1 << [[[self parent] startDate] dayOfWeek]);
|
||||
v = (1 << [[self _adjustedStartDate] dayOfWeek]);
|
||||
}
|
||||
|
||||
[s appendFormat: @"<Recurrence_DayOfWeek xmlns=\"Calendar:\">%d</Recurrence_DayOfWeek>", v];
|
||||
[s appendFormat: @"<Recurrence_Interval xmlns=\"Calendar:\">%d</Recurrence_Interval>", [self repeatInterval]];
|
||||
[s appendFormat: @"<Recurrence_DayOfWeek xmlns=\"%@:\">%d</Recurrence_DayOfWeek>", t, v];
|
||||
[s appendFormat: @"<Recurrence_Interval xmlns=\"%@:\">%d</Recurrence_Interval>", t, [self repeatInterval]];
|
||||
}
|
||||
else if ([self frequency] == iCalRecurrenceFrequenceMonthly)
|
||||
{
|
||||
@@ -111,8 +132,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
if (firstOccurrence < 0)
|
||||
firstOccurrence = 5;
|
||||
|
||||
[s appendFormat: @"<Recurrence_DayOfWeek xmlns=\"Calendar:\">%d</Recurrence_DayOfWeek>", (1 << [dm firstDay])];
|
||||
[s appendFormat: @"<Recurrence_WeekOfMonth xmlns=\"Calendar:\">%d</Recurrence_WeekOfMonth>", firstOccurrence];
|
||||
[s appendFormat: @"<Recurrence_DayOfWeek xmlns=\"%@:\">%d</Recurrence_DayOfWeek>", t, (1 << [dm firstDay])];
|
||||
[s appendFormat: @"<Recurrence_WeekOfMonth xmlns=\"%@:\">%d</Recurrence_WeekOfMonth>", t, firstOccurrence];
|
||||
[s appendFormat: @"<Recurrence_Interval xmlns=\"%@:\">%d</Recurrence_Interval>", t, [self repeatInterval]];
|
||||
}
|
||||
else if ([[self byMonthDay] count])
|
||||
{
|
||||
@@ -126,8 +148,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
iCalByDayMask *dm;
|
||||
|
||||
dm = [self byDayMask];
|
||||
[s appendFormat: @"<Recurrence_DayOfWeek xmlns=\"Calendar:\">%d</Recurrence_DayOfWeek>", (1 << [dm firstDay])];
|
||||
[s appendFormat: @"<Recurrence_WeekOfMonth xmlns=\"Calendar:\">%d</Recurrence_WeekOfMonth>", 5];
|
||||
[s appendFormat: @"<Recurrence_DayOfWeek xmlns=\"%@:\">%d</Recurrence_DayOfWeek>", t, (1 << [dm firstDay])];
|
||||
[s appendFormat: @"<Recurrence_WeekOfMonth xmlns=\"%@:\">%d</Recurrence_WeekOfMonth>", t, 5];
|
||||
[s appendFormat: @"<Recurrence_Interval xmlns=\"%@:\">%d</Recurrence_Interval>", t, [self repeatInterval]];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -139,8 +162,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>",
|
||||
(int)[[[self parent] startDate] dayOfMonth]];
|
||||
[s appendFormat: @"<Recurrence_DayOfMonth xmlns=\"%@:\">%d</Recurrence_DayOfMonth>", t, [[self _adjustedStartDate] dayOfMonth]];
|
||||
}
|
||||
}
|
||||
else if ([self frequency] == iCalRecurrenceFrequenceYearly)
|
||||
@@ -159,33 +181,39 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
if (firstOccurrence < 0)
|
||||
firstOccurrence = 5;
|
||||
|
||||
[s appendFormat: @"<Recurrence_DayOfWeek xmlns=\"Calendar:\">%d</Recurrence_DayOfWeek>", (1 << [dm firstDay])];
|
||||
[s appendFormat: @"<Recurrence_WeekOfMonth xmlns=\"Calendar:\">%d</Recurrence_WeekOfMonth>", firstOccurrence];
|
||||
[s appendFormat: @"<Recurrence_MonthOfYear xmlns=\"Calendar:\">%@</Recurrence_MonthOfYear>",
|
||||
[s appendFormat: @"<Recurrence_DayOfWeek xmlns=\"%@:\">%d</Recurrence_DayOfWeek>", t, (1 << [dm firstDay])];
|
||||
[s appendFormat: @"<Recurrence_WeekOfMonth xmlns=\"%@:\">%d</Recurrence_WeekOfMonth>", t, firstOccurrence];
|
||||
[s appendFormat: @"<Recurrence_MonthOfYear xmlns=\"%@:\">%@</Recurrence_MonthOfYear>", t,
|
||||
[self flattenedValuesForKey: @"bymonth"]];
|
||||
}
|
||||
else
|
||||
{
|
||||
type = 5; // Yearly
|
||||
|
||||
[s appendFormat: @"<Recurrence_DayOfMonth xmlns=\"Calendar:\">%@</Recurrence_DayOfMonth>",
|
||||
[s appendFormat: @"<Recurrence_DayOfMonth xmlns=\"%@:\">%@</Recurrence_DayOfMonth>", t,
|
||||
[self flattenedValuesForKey: @"bymonthday"]];
|
||||
|
||||
[s appendFormat: @"<Recurrence_MonthOfYear xmlns=\"Calendar:\">%@</Recurrence_MonthOfYear>",
|
||||
[s appendFormat: @"<Recurrence_MonthOfYear xmlns=\"%@:\">%@</Recurrence_MonthOfYear>", t,
|
||||
[self flattenedValuesForKey: @"bymonth"]];
|
||||
}
|
||||
}
|
||||
else
|
||||
type = 5;
|
||||
{
|
||||
type = 5;
|
||||
[s appendFormat: @"<Recurrence_DayOfMonth xmlns=\"%@:\">%d</Recurrence_DayOfMonth>", t, [[self _adjustedStartDate] dayOfMonth]];
|
||||
[s appendFormat: @"<Recurrence_MonthOfYear xmlns=\"%@:\">%d</Recurrence_MonthOfYear>", t, [[self _adjustedStartDate] monthOfYear]];
|
||||
}
|
||||
}
|
||||
|
||||
[s appendFormat: @"<Recurrence_Type xmlns=\"Calendar:\">%d</Recurrence_Type>", type];
|
||||
[s appendFormat: @"<Recurrence_Type xmlns=\"%@:\">%d</Recurrence_Type>", t, type];
|
||||
|
||||
if ([[self parent] isKindOfClass: [iCalToDo class]])
|
||||
[s appendFormat: @"<Recurrence_Start xmlns=\"%@:\">%@</Recurrence_Start>", t, [[[self parent] startDate] activeSyncRepresentationInContext: context]];
|
||||
|
||||
// Occurrences / Until
|
||||
//[s appendFormat: @"<Recurrence_Occurrences xmlns=\"Calendar:\">%d</Recurrence_Occurrences>", 5];
|
||||
if ([self repeatCount])
|
||||
{
|
||||
[s appendFormat: @"<Recurrence_Occurrences xmlns=\"Calendar:\">%@</Recurrence_Occurrences>",
|
||||
[s appendFormat: @"<Recurrence_Occurrences xmlns=\"%@:\">%@</Recurrence_Occurrences>", t,
|
||||
[self flattenedValuesForKey: @"count"]];
|
||||
}
|
||||
else if ([self untilDate])
|
||||
@@ -196,11 +224,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//ud = [[context activeUser] userDefaults];
|
||||
//[date setTimeZone: [ud timeZone]];
|
||||
|
||||
[s appendFormat: @"<Recurrence_Until xmlns=\"Calendar:\">%@</Recurrence_Until>",
|
||||
[s appendFormat: @"<Recurrence_Until xmlns=\"%@:\">%@</Recurrence_Until>", t,
|
||||
[date activeSyncRepresentationWithoutSeparatorsInContext: context]];
|
||||
}
|
||||
|
||||
|
||||
[s appendString: @"</Recurrence>"];
|
||||
|
||||
return s;
|
||||
|
||||
@@ -128,7 +128,7 @@ struct SYSTEMTIME {
|
||||
//uint16_t wStandardYear;
|
||||
struct SYSTEMTIME stStandardDate;
|
||||
//uint16_t wDaylightYear;
|
||||
struct SYSTEMTIME stDaylightDate;
|
||||
struct SYSTEMTIME stDaylightDate = {0,0,0,0,0,0,0,0};
|
||||
|
||||
char standardName[64], daylightName[64];
|
||||
|
||||
@@ -144,13 +144,17 @@ struct SYSTEMTIME {
|
||||
|
||||
period = [self _mostRecentPeriodWithName: @"DAYLIGHT"];
|
||||
if (!period)
|
||||
stStandardDate.wMonth = 0;
|
||||
|
||||
lDaylightBias = (uint32_t) -([period secondsOffsetFromGMT] / 60) - lBias;
|
||||
[period _fillTZDate: &stDaylightDate];
|
||||
//wStandardYear = stStandardDate.wYear;
|
||||
//wDaylightYear = stDaylightDate.wYear;
|
||||
|
||||
{
|
||||
stStandardDate.wMonth = 0;
|
||||
lDaylightBias = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
lDaylightBias = (uint32_t) -([period secondsOffsetFromGMT] / 60) - lBias;
|
||||
[period _fillTZDate: &stDaylightDate];
|
||||
//wStandardYear = stStandardDate.wYear;
|
||||
//wDaylightYear = stDaylightDate.wYear;
|
||||
}
|
||||
|
||||
// We build the timezone
|
||||
[bytes appendBytes: &lBias length: 4];
|
||||
|
||||
@@ -47,9 +47,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#import <NGCards/iCalDateTime.h>
|
||||
#import <NGCards/iCalTimeZone.h>
|
||||
|
||||
#import <Appointments/iCalEntityObject+SOGo.h>
|
||||
|
||||
#include "NSDate+ActiveSync.h"
|
||||
#include "NSString+ActiveSync.h"
|
||||
|
||||
#include "iCalRecurrenceRule+ActiveSync.h"
|
||||
#include "iCalAlarm+ActiveSync.h"
|
||||
|
||||
@implementation iCalToDo (ActiveSync)
|
||||
|
||||
@@ -84,6 +87,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
[s appendFormat: @"<DueDate xmlns=\"Tasks:\">%@</DueDate>", [o activeSyncRepresentationInContext: context]];
|
||||
[s appendFormat: @"<UTCDueDate xmlns=\"Tasks:\">%@</UTCDueDate>", [o activeSyncRepresentationInContext: context]];
|
||||
}
|
||||
|
||||
// Recurrence rules
|
||||
if ([self isRecurrent])
|
||||
[s appendString: [[[self recurrenceRules] lastObject] activeSyncRepresentationInContext: context]];
|
||||
|
||||
// Importance
|
||||
o = [self priority];
|
||||
@@ -95,8 +102,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
v = 1;
|
||||
[s appendFormat: @"<Importance xmlns=\"Tasks:\">%d</Importance>", v];
|
||||
|
||||
// Reminder - FIXME
|
||||
[s appendFormat: @"<ReminderSet xmlns=\"Tasks:\">%d</ReminderSet>", 0];
|
||||
// Reminder
|
||||
if ([self hasAlarms])
|
||||
{
|
||||
iCalAlarm *alarm;
|
||||
|
||||
alarm = [self firstDisplayOrAudioAlarm];
|
||||
[s appendFormat: @"<ReminderSet xmlns=\"Tasks:\">%d</ReminderSet>", 1];
|
||||
[s appendString: [alarm activeSyncRepresentationInContext: context]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[s appendFormat: @"<ReminderSet xmlns=\"Tasks:\">%d</ReminderSet>", 0];
|
||||
}
|
||||
|
||||
// Sensitivity
|
||||
if ([[self accessClass] isEqualToString: @"PRIVATE"])
|
||||
@@ -131,7 +149,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// 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"])
|
||||
if ([[context objectForKey: @"ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
{
|
||||
[s appendFormat: @"<Body xmlns=\"Tasks:\">%@</Body>", o];
|
||||
[s appendString: @"<BodyTruncated xmlns=\"Tasks:\">0</BodyTruncated>"];
|
||||
@@ -145,7 +163,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
[s appendString: @"</Body>"];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -165,7 +183,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
[self setSummary: o];
|
||||
|
||||
// FIXME: merge with iCalEvent
|
||||
if ([[[context request] headerForKey: @"MS-ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
if ([[context objectForKey: @"ASProtocolVersion"] isEqualToString: @"2.5"])
|
||||
{
|
||||
if ((o = [theValues objectForKey: @"Body"]))
|
||||
[self setComment: o];
|
||||
@@ -249,8 +267,39 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
if ((o = [theValues objectForKey: @"ReminderTime"]))
|
||||
{
|
||||
iCalAlarm *alarm;
|
||||
|
||||
alarm = [[iCalAlarm alloc] init];
|
||||
[alarm takeActiveSyncValues: theValues inContext: context];
|
||||
|
||||
[self removeAllAlarms];
|
||||
[self addToAlarms: alarm];
|
||||
RELEASE(alarm);
|
||||
|
||||
}
|
||||
|
||||
// Recurrence
|
||||
if ((o = [theValues objectForKey: @"Recurrence"]) && !([[o objectForKey: @"Recurrence_DeadOccur"] intValue]))
|
||||
{
|
||||
iCalRecurrenceRule *rule;
|
||||
|
||||
rule = [[iCalRecurrenceRule alloc] init];
|
||||
[self setRecurrenceRules: [NSArray arrayWithObject: rule]];
|
||||
RELEASE(rule);
|
||||
|
||||
[rule takeActiveSyncValues: o inContext: context];
|
||||
|
||||
if (!([theValues objectForKey: @"StartDate"]))
|
||||
{
|
||||
iCalDateTime *start;
|
||||
|
||||
start = (iCalDateTime *) [self uniqueChildWithTag: @"dtstart"];
|
||||
|
||||
[start setTimeZone: tz];
|
||||
[start setDate: [[o objectForKey: @"Recurrence_Start"] calendarDate]];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
+2
-2
@@ -72,8 +72,8 @@ ProxyPass /SOGo http://127.0.0.1:20000/SOGo retry=0
|
||||
## and do not forget to enable the headers module
|
||||
<IfModule headers_module>
|
||||
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" "%{HTTP_HOST}e" env=HTTP_HOST
|
||||
RequestHeader set "x-webobjects-server-url" "https://%{HTTP_HOST}e" env=HTTP_HOST
|
||||
|
||||
## When using proxy-side autentication, you need to uncomment and
|
||||
## adjust the following line:
|
||||
|
||||
+2345
File diff suppressed because it is too large.
Load diff
-5655
File diff suppressed because it is too large.
Load diff
@@ -2,7 +2,8 @@ all: $(patsubst %.asciidoc,%.pdf,$(wildcard *.asciidoc))
|
||||
|
||||
%.pdf : %.asciidoc
|
||||
asciidoc -a docinfo1 -b docbook -d book -o $<.docbook $<
|
||||
fop -c fonts/fop-config.xml -xsl docbook/xsl/sogo-fo.xsl -xml $<.docbook -pdf $@
|
||||
xsltproc -o $<.fo docbook/xsl/sogo-fo.xsl $<.docbook
|
||||
fop -c fonts/fop-config.xml $<.fo -pdf $@
|
||||
|
||||
clean:
|
||||
rm *.asciidoc.docbook *.pdf
|
||||
rm -f *.asciidoc.fo *.asciidoc.docbook *.pdf
|
||||
@@ -18,13 +18,13 @@ About this Guide
|
||||
|
||||
This guide will walk you through the installation and configuration of
|
||||
the SOGo solution. It also covers the installation and configuration of
|
||||
SOGo ActiveSync support – the solution used to synchronize mobile
|
||||
SOGo ActiveSync support - the solution used to synchronize mobile
|
||||
devices with SOGo.
|
||||
|
||||
The instructions are based on version {release_version} of SOGo.
|
||||
|
||||
The latest version of this guide is available
|
||||
at http://www.sogo.nu/downloads/documentation.html.
|
||||
at http://sogo.nu/downloads/documentation.html.
|
||||
|
||||
Introduction
|
||||
------------
|
||||
@@ -47,11 +47,10 @@ and the data of Mozilla Thunderbird and Lightning
|
||||
the SOGo Connector and the SOGo Integrator
|
||||
* Native compatibility for Microsoft Outlook 2003, 2007, 2010, and 2013
|
||||
* Two-way synchronization support with any Microsoft ActiveSync-capable
|
||||
device, or Outlook 2013
|
||||
device, or Outlook 2013/2016
|
||||
|
||||
SOGo is developed by a community of developers located mainly in North
|
||||
America and Europe. More information can be found
|
||||
at http://www.sogo.nu/
|
||||
America and Europe. More information can be found at http://sogo.nu/
|
||||
|
||||
Architecture and Compatibility
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -202,6 +201,11 @@ should apply to all supported operating systems.
|
||||
Software Downloads
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
[NOTE]
|
||||
In order to access the production builds, you need a proper support contract
|
||||
from https://sogo.nu/support/index_new.html#support-plans[Inverse]. Continue
|
||||
with the configuration once you received your username and password.
|
||||
|
||||
SOGo can be installed using the `yum` utility. To do so, first create
|
||||
the `/etc/yum.repos.d/inverse.repo` configuration file with the following
|
||||
content:
|
||||
@@ -209,17 +213,22 @@ content:
|
||||
----
|
||||
[SOGo]
|
||||
name=Inverse SOGo Repository
|
||||
baseurl=http://inverse.ca/downloads/SOGo/RHEL6/$basearch
|
||||
baseurl=https://<username>:<password>@packages.inverse.ca/SOGo/release/2/rhel/6/$basearch
|
||||
gpgcheck=0
|
||||
----
|
||||
|
||||
Some of the softwares on which SOGo depends are available from the
|
||||
repository of RepoForge (previously known as RPMforge). To add RepoForge
|
||||
to your packages sources, download and install the appropriate RPM
|
||||
package from http://packages.sw.be/rpmforge-release/.
|
||||
Also make sure you enabled the "rpmforge-extras" repository.
|
||||
[NOTE]
|
||||
Any non-URL safe characters in username/password must be URL-encoded. For
|
||||
example, if your password is `so%go`, you must set the value in your
|
||||
configuration file to `so%25go` - where `%` is encoded to `%25`.
|
||||
|
||||
For more information on using RepoForge, visit http://repoforge.org/use/.
|
||||
Inverse signs its RPM packages with its GPG key. Integrity verification happens
|
||||
all by itself on package installation, all you need to do is first import the
|
||||
key into your rpm keychain:
|
||||
|
||||
----
|
||||
rpm --import "https://pgp.mit.edu/pks/lookup?op=get&search=0xCB2D3A2AA0030E2C"
|
||||
----
|
||||
|
||||
Software Installation
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -482,7 +491,7 @@ SOGoSAML2LogoutEnabled must be set to YES. If unset, the user will be
|
||||
redirected to a blank page.
|
||||
|
||||
|D |SOGoTimeZone
|
||||
|Parameter used to set a default time zone for users. The default
|
||||
|Mandatory parameter used to set a default time zone for users. The default
|
||||
timezone is set to UTC. The Olson database is a standard database that
|
||||
takes all the time zones around the world into account and represents
|
||||
them along with their history. On GNU/Linux systems, time zone
|
||||
@@ -504,8 +513,8 @@ In our example, we set the default domain to `acme.com`.
|
||||
meeting participants. Possible values are:
|
||||
|
||||
[options="compact"]
|
||||
* `YES` – to send notifications
|
||||
* `NO` – to not send notifications
|
||||
* `YES` - to send notifications
|
||||
* `NO` - to not send notifications
|
||||
|
||||
Defaults to `NO` when unset.
|
||||
|
||||
@@ -578,6 +587,8 @@ for SOGo. Possible values are:
|
||||
* `Basque`
|
||||
* `BrazilianPortuguese`
|
||||
* `Catalan`
|
||||
* `ChineseTaiwan`
|
||||
* `Croatian`
|
||||
* `Czech`
|
||||
* `Danish`
|
||||
* `Dutch`
|
||||
@@ -588,14 +599,19 @@ for SOGo. Possible values are:
|
||||
* `Hungarian`
|
||||
* `Icelandic`
|
||||
* `Italian`
|
||||
* `Lithuanian`
|
||||
* `Macedonian`
|
||||
* `NorwegianBokmal`
|
||||
* `NorwegianNynorsk`
|
||||
* `Polish`
|
||||
* `Portuguese`
|
||||
* `Russian`
|
||||
* `Slovak`
|
||||
* `SpanishSpain`
|
||||
* `Slovenian`
|
||||
* `SpanishArgentina`
|
||||
* `SpanishSpain`
|
||||
* `Swedish`
|
||||
* `TurkishTurkey`
|
||||
* `Ukrainian`
|
||||
* `Welsh`
|
||||
|
||||
@@ -604,8 +620,8 @@ for SOGo. Possible values are:
|
||||
someone changes his/her own calendar. Possible values are:
|
||||
|
||||
[options="compact"]
|
||||
- `YES` – to send notifications
|
||||
- `NO` – to not send notifications
|
||||
- `YES` - to send notifications
|
||||
- `NO` - to not send notifications
|
||||
|
||||
Defaults to `NO` when unset. User can overwrite this from the calendar
|
||||
properties window.
|
||||
@@ -616,8 +632,8 @@ modification is being done to his/her own calendar by someone else.
|
||||
Possible values are:
|
||||
|
||||
[options="compact"]
|
||||
* `YES` – to send notifications
|
||||
* `NO` – to not send notifications
|
||||
* `YES` - to send notifications
|
||||
* `NO` - to not send notifications
|
||||
|
||||
Defaults to `NO` when unset. User can overwrite this from the calendar
|
||||
properties window.
|
||||
@@ -640,8 +656,8 @@ requiring not authentication) their calendars and address books.
|
||||
Possible values are:
|
||||
|
||||
[options="compact"]
|
||||
* `YES` – to allow them
|
||||
* `NO` – to prevent them from doing so
|
||||
* `YES` - to allow them
|
||||
* `NO` - to prevent them from doing so
|
||||
|
||||
Defaults to `NO` when unset.
|
||||
|
||||
@@ -652,8 +668,8 @@ SOGo.
|
||||
Possible values are:
|
||||
|
||||
[options="compact"]
|
||||
* `YES` – to allow them
|
||||
* `NO` – to prevent them from doing so
|
||||
* `YES` - to allow them
|
||||
* `NO` - to prevent them from doing so
|
||||
|
||||
Defaults to `NO` when unset.
|
||||
|
||||
@@ -683,7 +699,7 @@ Defaults to `NO` when unset.
|
||||
string (attendee completion, address book search, etc.) prior triggering
|
||||
the server-side search operation.
|
||||
|
||||
Defaults to `2` when unset – which means a search operation will be
|
||||
Defaults to `2` when unset - which means a search operation will be
|
||||
triggered on the 3rd typed character.
|
||||
|
||||
|S |SOGoMaximumFailedLoginCount
|
||||
@@ -888,7 +904,7 @@ source can contain the following values:
|
||||
|The type of this user source, set to ldap` for an LDAP source.
|
||||
|
||||
|id
|
||||
|The identification name of the LDAP repository. This must be unique –
|
||||
|The identification name of the LDAP repository. This must be unique -
|
||||
even when using multiple domains.
|
||||
|
||||
|CNFieldName
|
||||
@@ -907,7 +923,8 @@ table.
|
||||
|
||||
|MailFieldNames
|
||||
|An array of fields that returns the user's email addresses (defaults to
|
||||
`mail` when unset).
|
||||
`mail` when unset). Note that SOGo will always automatically strip the
|
||||
protocol value from the attribute if the attribute name is `proxyAddresses`.
|
||||
|
||||
|SearchFieldNames
|
||||
|An array of fields to to match against the search string when filtering
|
||||
@@ -954,8 +971,8 @@ be marked as busy the first time it is booked.
|
||||
EOQualifier. The following operators are supported:
|
||||
|
||||
[options="compact"]
|
||||
* `<>` – inequality operator
|
||||
* `=` – equality operator
|
||||
* `<>` - inequality operator
|
||||
* `=` - equality operator
|
||||
|
||||
Multiple qualifiers can be joined by using `OR` and `AND`, they can also
|
||||
be grouped together by using parenthesis. Attribute values should be
|
||||
@@ -1017,9 +1034,9 @@ be specified as a LDAP Extension in the LDAP URL (e.g.
|
||||
without Password Policies enabled.
|
||||
|
||||
Possible values are: `none`, `plain`, `crypt`, `md5`, `md5-crypt`,
|
||||
`smd5`, `cram-md5` and `sha`, `sha256`, `sha512` and its ssha (e.g.
|
||||
`ssha` or `ssha256`) variants (plus setting of the encoding with `.b64`
|
||||
or `.hex`).
|
||||
`sha256-crypt` and `sha512-crypt`, `smd5`, `cram-md5` and `sha`, `sha256`,
|
||||
`sha512` and its ssha (e.g. `ssha` or `ssha256`) variants
|
||||
(plus setting of the encoding with `.b64` or `.hex`).
|
||||
|
||||
For a more detailed description see
|
||||
http://wiki.dovecot.org/Authentication/PasswordSchemes.
|
||||
@@ -1028,6 +1045,9 @@ Note that `cram-md5` is not actually using cram-md5 (due to the lack of
|
||||
challenge-response mechanism), its just saving the intermediate MD5
|
||||
context as Dovecot stores in its database.
|
||||
|
||||
Also note that `sha256-crypt` and `sha512-crypt` requires that your
|
||||
operating system supports glibc 2.7 or more recent.
|
||||
|
||||
|canAuthenticate
|
||||
|If set to `YES`, this LDAP source is used for authentication
|
||||
|
||||
@@ -1370,9 +1390,9 @@ SOGoProfileURL =
|
||||
Create the database user and schema using the following commands:
|
||||
|
||||
----
|
||||
su – postgres
|
||||
createuser --no-superuser --no-createdb –-no-createrole \
|
||||
–-encrypted --pwprompt sogo
|
||||
su - postgres
|
||||
createuser --no-superuser --no-createdb --no-createrole \
|
||||
--encrypted --pwprompt sogo
|
||||
(specify “sogo” as password)
|
||||
createdb -O sogo sogo
|
||||
----
|
||||
@@ -1473,7 +1493,7 @@ source can contain the following values:
|
||||
|The type of this user source, set to `sql` for a SQL source.
|
||||
|
||||
|id
|
||||
|The identification name of the SQL repository. This must be unique –
|
||||
|The identification name of the SQL repository. This must be unique -
|
||||
even when using multiple domains.
|
||||
|
||||
|viewURL
|
||||
@@ -1481,9 +1501,9 @@ even when using multiple domains.
|
||||
present. Required columns are:
|
||||
|
||||
[options="compact"]
|
||||
* `c_uid`: will be used for authentication – it's a username or
|
||||
* `c_uid`: will be used for authentication - it's a username or
|
||||
username@domain.tld
|
||||
* `c_name`: will be used to uniquely identify entries – which can be
|
||||
* `c_name`: will be used to uniquely identify entries - which can be
|
||||
identical to `c_uid`
|
||||
* `c_password`: password of the user, plain text, crypt, md5 or sha
|
||||
encoded
|
||||
@@ -1589,14 +1609,14 @@ SOGoUserSources =
|
||||
|
||||
Certain database columns must be present in the view/table, such as:
|
||||
|
||||
* `c_uid` – will be used for authentication – it's the username
|
||||
* `c_uid` - will be used for authentication - it's the username
|
||||
or username@domain.tld
|
||||
* `c_name` – which can be identical to `c_uid` – will be used to
|
||||
* `c_name` - which can be identical to `c_uid` - will be used to
|
||||
uniquely identify entries
|
||||
* `c_password` – password of the user, plain-text, md5 or sha encoded
|
||||
* `c_password` - password of the user, plain-text, md5 or sha encoded
|
||||
for now
|
||||
* `c_cn` – the user's common name – such as "John Doe"
|
||||
* `mail` – the user's mail address
|
||||
* `c_cn` - the user's common name - such as "John Doe"
|
||||
* `mail` - the user's mail address
|
||||
|
||||
Note that groups are currently not supported for SQL-based
|
||||
authentication sources.
|
||||
@@ -1616,16 +1636,22 @@ The following table describes the related parameters.
|
||||
are:
|
||||
|
||||
[options="compact"]
|
||||
* `sendmail` – to use the sendmail binary
|
||||
* `smtp` – to use the SMTP protocol
|
||||
* `sendmail` - to use the sendmail binary
|
||||
* `smtp` - to use the SMTP protocol
|
||||
|
||||
|D |SOGoSMTPServer
|
||||
|The DNS name or IP address of the SMTP server used when
|
||||
_SOGoMailingMechanism_ is set to `smtp`.
|
||||
Supported formats are: `smtp://domain:port`, `smtps://domain`,
|
||||
`domain:port`, `smtp://domain:port/?tls=YES`. Using the option
|
||||
`tls=YES` will enforce using STARTTLS smtp connections. Thus,
|
||||
`smtp://localhost:587/?tls=YES` would use the default MUA port
|
||||
on localhost with STARTTLS enforced.
|
||||
|
||||
|D |SOGoSMTPAuthenticationType
|
||||
|Activate SMTP authentication and specifies which type is in use.
|
||||
Current, only `PLAIN` is supported and other values will be ignored.
|
||||
Current, only `PLAIN` is supported and other values will cause
|
||||
the authentication to fail.
|
||||
|
||||
|S |WOSendMail
|
||||
|The path of the sendmail binary.
|
||||
@@ -1892,6 +1918,11 @@ host.
|
||||
|
||||
Defaults to `NO` when unset.
|
||||
|
||||
|U |SOGoSieveFilters
|
||||
|Parameter used to define initial Sieve scripts for users. The user
|
||||
can still modify the scripts and the initial values will be written
|
||||
to the Sieve server upon first login.
|
||||
|
||||
|D |SOGoMailPollingIntervals
|
||||
|Parameter used to define the mail polling intervals (in minutes)
|
||||
available to the user. The parameter is an array that can contain the
|
||||
@@ -2189,7 +2220,7 @@ like this:
|
||||
SOGoTrashFolderName = Trash;
|
||||
SOGoJunkFolderName = Junk;
|
||||
SOGoMailingMechanism = smtp;
|
||||
SOGoSMTPServer = 127.0.0.1;
|
||||
SOGoSMTPServer = "smtp://127.0.0.1";
|
||||
SOGoUserSources = (
|
||||
{
|
||||
type = ldap;
|
||||
@@ -2536,13 +2567,19 @@ have unexpected behaviour with various ActiveSync clients.
|
||||
EAS command.
|
||||
|
||||
Defaults to `NO`, which means no logging is performed.
|
||||
|
||||
|S |SOGoMaximumPictureSize
|
||||
|Parameter used to overwrite the maximum number of bytes returned in the picture
|
||||
for EAS Search operations in the GAL.
|
||||
|
||||
If not set, it defaults to `102400` bytes, or 100 KB.
|
||||
|=======================================================================
|
||||
|
||||
Please be aware of the following limitations:
|
||||
|
||||
* Outlook 2013 does not search the GAL. One possible alternative
|
||||
* Outlook 2013/2016 does not search the GAL. One possible alternative
|
||||
solution is to configure Outlook to use a LDAP server (over SSL) with
|
||||
authentication. Outlook 2013 also does not seem to support multiple
|
||||
authentication. Outlook 2013/2016 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
|
||||
@@ -2558,9 +2595,9 @@ 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.
|
||||
* Outlook 2013 freebusy lookups are supported using the Internet
|
||||
Free/Busy feature of Outlook 2013. Please
|
||||
* Outlook 2013/2016 Autodiscovery is currently not supported.
|
||||
* Outlook 2013/2016 freebusy lookups are supported using the Internet
|
||||
Free/Busy feature of Outlook 2013/2016. Please
|
||||
see http://support.microsoft.com/kb/291621 for configuration
|
||||
instructions. On the SOGo side, _SOGoEnablePublicAccess_ must be set to
|
||||
`YES` and the URL to use must be of the following format:
|
||||
@@ -2569,6 +2606,9 @@ instructions. On the SOGo side, _SOGoEnablePublicAccess_ must be set to
|
||||
need to adjust the word size of your IMAP server. In Dovecot, the parameter
|
||||
to increase is "imap_max_line_length" while under Cyrus IMAP Server, the
|
||||
parameter is "maxword". We suggest a buffer of 2MB.
|
||||
* If you are using MySQL, make sure you set "max_allowed_packet" to a large value
|
||||
since the EAS cache size can be large for mailboxes with thousands of messages.
|
||||
A 64M or even 128M value is recommended.
|
||||
|
||||
In order to use the SOGo ActiveSync support code in production
|
||||
environments, you need to get a proper usage license from Microsoft.
|
||||
@@ -2717,17 +2757,18 @@ To access your personal calendar:
|
||||
`http://localhost/SOGo/dav/jdoe/Calendar/personal/`
|
||||
* Click on Continue.
|
||||
|
||||
Apple iCal
|
||||
~~~~~~~~~~
|
||||
Apple Calendar and iOS
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Apple iCal can also be used as a client application for SOGo.
|
||||
Apple Calendar and Mac OS X and the calendar application on iOS can also be used
|
||||
as a client application for SOGo.
|
||||
|
||||
To configure it so it works with SOGo, create a new account and specify,
|
||||
To configure the application so it works with SOGo, create a new account and specify,
|
||||
as the Account URL, an URL such as:
|
||||
|
||||
http://localhost/SOGo/dav/jdoe/
|
||||
|
||||
Note that the trailing slash is important for Apple iCal 3.
|
||||
Note that the trailing slash is important for the old Apple iCal 3 application.
|
||||
|
||||
Apple AddressBook
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -121,9 +121,9 @@
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template name="next.itemsymbol">
|
||||
<xsl:param name="itemsymbol" select="'default'"/>
|
||||
<xsl:param name="itemsymbol" select="'square'"/>
|
||||
<xsl:choose>
|
||||
<xsl:otherwise>square</xsl:otherwise>
|
||||
<xsl:when test="$itemsymbol='square'">square</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- TODO have the build system take care of this -->
|
||||
<releaseinfo>Version 2.3.12 - June 2016</releaseinfo>
|
||||
<subtitle>for version 2.3.12</subtitle>
|
||||
<date>2016-06-10</date>
|
||||
<releaseinfo>Version 2.4.1 - June 2021</releaseinfo>
|
||||
<subtitle>for version 2.4.1</subtitle>
|
||||
<date>2021-06-01</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>
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
Authors:
|
||||
- Inverse inc. <info@inverse.ca>
|
||||
|
||||
Copyright (C) 2008-2016 Inverse inc.
|
||||
Copyright (C) 2008-2017 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.3.12
|
||||
:release_version: 2.4.1
|
||||
|
||||
// vim: set syntax=asciidoc tabstop=2 shiftwidth=2 expandtab:
|
||||
+14
-19
@@ -42,6 +42,7 @@
|
||||
#import <SOGo/SOGoPermissions.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserFolder.h>
|
||||
#import <SOGo/SOGoUserManager.h>
|
||||
|
||||
#import "SOGo+DAV.h"
|
||||
|
||||
@@ -365,31 +366,26 @@
|
||||
withEmailAddressSetMatching: (NSString *) value
|
||||
inContext: (WOContext *) localContext
|
||||
{
|
||||
id <SOGoSource> authenticationSource;
|
||||
SOGoUser *activeUser;
|
||||
SOGoUserManager *um;
|
||||
NSArray *records;
|
||||
NSUInteger count, max;
|
||||
NSString *uid;
|
||||
SOGoUserFolder *collection;
|
||||
|
||||
activeUser = [localContext activeUser];
|
||||
if ([activeUser respondsToSelector: @selector (authenticationSource)])
|
||||
um = [SOGoUserManager sharedUserManager];
|
||||
records = [um fetchUsersMatching: value
|
||||
inDomain: [[localContext activeUser] domain]];
|
||||
|
||||
max = [records count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
authenticationSource = [[localContext activeUser] authenticationSource];
|
||||
records = [authenticationSource
|
||||
fetchContactsMatching: value
|
||||
inDomain: [activeUser domain]];
|
||||
max = [records count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
uid = [[records objectAtIndex: count] objectForKey: @"c_uid"];
|
||||
if ([uid length] > 0)
|
||||
{
|
||||
collection = [[SOGoUser userWithLogin: uid]
|
||||
uid = [[records objectAtIndex: count] objectForKey: @"c_uid"];
|
||||
if ([uid length] > 0)
|
||||
{
|
||||
collection = [[SOGoUser userWithLogin: uid]
|
||||
homeFolderInContext: localContext];
|
||||
[collections addObject: collection];
|
||||
}
|
||||
}
|
||||
[collections addObject: collection];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,7 +581,6 @@
|
||||
@"addressbook", @"calendar-access",
|
||||
@"calendar-schedule", @"calendar-auto-schedule",
|
||||
@"calendar-proxy",
|
||||
|
||||
@"calendar-query-extended",
|
||||
@"extended-mkcol",
|
||||
@"calendarserver-principal-property-search",
|
||||
|
||||
+17
-6
@@ -35,6 +35,7 @@
|
||||
#import <GDLContentStore/GCSAlarmsFolder.h>
|
||||
#import <GDLContentStore/GCSSessionsFolder.h>
|
||||
|
||||
#import <NGObjWeb/NSException+HTTP.h>
|
||||
#import <NGObjWeb/SoClassSecurityInfo.h>
|
||||
#import <NGObjWeb/WOContext.h>
|
||||
#import <NGObjWeb/WORequest+So.h>
|
||||
@@ -123,7 +124,7 @@ static BOOL debugLeaks;
|
||||
vMemSizeLimit = [defaults vmemLimit];
|
||||
if (vMemSizeLimit > 0)
|
||||
[self logWithFormat: @"vmem size check enabled: shutting down app when "
|
||||
@"vmem > %d MB", vMemSizeLimit];
|
||||
@"vmem > %d MB. Currently at %d MB", vMemSizeLimit, [[NSProcessInfo processInfo] virtualMemorySize]/1048576];
|
||||
|
||||
/* SoClass security declarations */
|
||||
sInfo = [self soClassSecurityInfo];
|
||||
@@ -145,7 +146,9 @@ static BOOL debugLeaks;
|
||||
[$(@"SOGoFolder") soClass];
|
||||
|
||||
/* load products */
|
||||
[[SOGoProductLoader productLoader] loadAllProducts];
|
||||
[[SOGoProductLoader productLoader] loadAllProducts: YES];
|
||||
if (vMemSizeLimit > 0)
|
||||
[self logWithFormat: @"All products loaded - current memory usage at %d MB", [[NSProcessInfo processInfo] virtualMemorySize]/1048576];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
@@ -369,8 +372,12 @@ static BOOL debugLeaks;
|
||||
"GET" if no method was provided in the query path.
|
||||
*/
|
||||
if ([_key length] > 0 && ![_key isEqualToString:@"favicon.ico"])
|
||||
obj = [self lookupUser: _key inContext: _ctx];
|
||||
}
|
||||
{
|
||||
obj = [self lookupUser: _key inContext: _ctx];
|
||||
if (!obj && ![_key isEqualToString: @"public"])
|
||||
obj = [self lookupUser: @"anonymous" inContext: _ctx];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
obj = nil;
|
||||
@@ -396,8 +403,12 @@ static BOOL debugLeaks;
|
||||
- (WOResponse *) handleException: (NSException *) _exc
|
||||
inContext: (WOContext *) _ctx
|
||||
{
|
||||
printf("EXCEPTION: %s\n", [[_exc description] cString]);
|
||||
abort();
|
||||
WOResponse *resp;
|
||||
|
||||
NSLog(@"EXCEPTION: %s\n", [[_exc description] cString]);
|
||||
resp = [WOResponse responseWithRequest: [_ctx request]];
|
||||
[resp setStatus: 501];
|
||||
return resp;
|
||||
}
|
||||
|
||||
/* runtime maintenance */
|
||||
|
||||
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -1,34 +0,0 @@
|
||||
/* 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
|
||||
@@ -1,214 +0,0 @@
|
||||
/* 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
|
||||
@@ -1,200 +0,0 @@
|
||||
|
||||
# GNUstep makefile
|
||||
|
||||
include ../config.make
|
||||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
include ../Version
|
||||
|
||||
BACKEND_VERSION = 1.0.0
|
||||
|
||||
### bootstrap library
|
||||
MAPISTORESOGO = MAPIStoreSOGo
|
||||
LIBRARY_NAME = $(MAPISTORESOGO)
|
||||
|
||||
$(MAPISTORESOGO)_VERSION = $(BACKEND_VERSION)
|
||||
|
||||
$(MAPISTORESOGO)_OBJC_FILES += \
|
||||
MAPIStoreSOGo.m
|
||||
|
||||
### backend bundle
|
||||
SOGOBACKEND = SOGoBackend
|
||||
BUNDLE_NAME = $(SOGOBACKEND)
|
||||
BUNDLE_EXTENSION = .MAPIStore
|
||||
BUNDLE_INSTALL_DIR = $(SOGO_LIBDIR)
|
||||
|
||||
PYTHON = /usr/bin/python
|
||||
PYTHON_IS_GOOD = $(shell $(PYTHON) -c 'from sys import version_info; a=version_info; print a[0] == 2 and a[1] >= 6')
|
||||
ifeq (${PYTHON_IS_GOOD},False)
|
||||
PYTHON = /usr/bin/python2.6
|
||||
endif
|
||||
|
||||
all::
|
||||
@echo " Python executable: ${PYTHON}"
|
||||
|
||||
SAMBA_PRIVATE_DIR = $(shell $(PYTHON) ./samba-get-config.py 'private dir' || echo /var/lib/samba/private)
|
||||
|
||||
$(SOGOBACKEND)_PRINCIPAL_CLASS = MAPIApplication
|
||||
|
||||
$(SOGOBACKEND)_OBJC_FILES += \
|
||||
MAPIApplication.m \
|
||||
MAPIStoreActiveTables.m \
|
||||
MAPIStoreAuthenticator.m \
|
||||
MAPIStoreMapping.m \
|
||||
MAPIStoreMIME.m \
|
||||
MAPIStoreTypes.m \
|
||||
MAPIStorePropertySelectors.m \
|
||||
MAPIStoreSamDBUtils.m \
|
||||
MAPIStoreUserContext.m \
|
||||
\
|
||||
SOGoMAPIDBMessage.m \
|
||||
SOGoCacheGCSObject+MAPIStore.m \
|
||||
\
|
||||
MAPIStoreAppointmentWrapper.m \
|
||||
MAPIStoreAttachment.m \
|
||||
MAPIStoreAttachmentTable.m \
|
||||
MAPIStoreContext.m \
|
||||
MAPIStoreEmbeddedMessage.m \
|
||||
MAPIStoreFolder.m \
|
||||
MAPIStoreMessage.m \
|
||||
MAPIStoreObject.m \
|
||||
MAPIStoreObjectProxy.m \
|
||||
MAPIStoreSOGoObject.m \
|
||||
MAPIStoreTable.m \
|
||||
MAPIStoreMessageTable.m \
|
||||
MAPIStoreFolderTable.m \
|
||||
MAPIStorePermissionsTable.m \
|
||||
\
|
||||
MAPIStoreDBBaseContext.m \
|
||||
MAPIStoreDBFolder.m \
|
||||
MAPIStoreDBFolderTable.m \
|
||||
MAPIStoreDBMessage.m \
|
||||
MAPIStoreDBMessageTable.m \
|
||||
\
|
||||
MAPIStoreFAIMessage.m \
|
||||
MAPIStoreFAIMessageTable.m \
|
||||
\
|
||||
MAPIStoreGCSBaseContext.m \
|
||||
MAPIStoreGCSFolder.m \
|
||||
MAPIStoreGCSMessage.m \
|
||||
MAPIStoreGCSMessageTable.m \
|
||||
\
|
||||
MAPIStoreCalTaskFolder.m \
|
||||
MAPIStoreCalTaskMessage.m \
|
||||
\
|
||||
MAPIStoreCalendarAttachment.m \
|
||||
MAPIStoreCalendarContext.m \
|
||||
MAPIStoreCalendarFolder.m \
|
||||
MAPIStoreCalendarMessage.m \
|
||||
MAPIStoreCalendarEmbeddedMessage.m \
|
||||
MAPIStoreCalendarMessageTable.m \
|
||||
MAPIStoreRecurrenceUtils.m \
|
||||
\
|
||||
MAPIStoreContactsAttachment.m \
|
||||
MAPIStoreContactsContext.m \
|
||||
MAPIStoreContactsFolder.m \
|
||||
MAPIStoreContactsMessage.m \
|
||||
MAPIStoreContactsMessageTable.m \
|
||||
\
|
||||
MAPIStoreTasksContext.m \
|
||||
MAPIStoreTasksFolder.m \
|
||||
MAPIStoreTasksMessage.m \
|
||||
MAPIStoreTasksMessageTable.m \
|
||||
\
|
||||
MAPIStoreMailAttachment.m \
|
||||
MAPIStoreMailContext.m \
|
||||
MAPIStoreMailFolder.m \
|
||||
MAPIStoreMailFolderTable.m \
|
||||
MAPIStoreMailMessage.m \
|
||||
MAPIStoreMailVolatileMessage.m \
|
||||
MAPIStoreMailMessageTable.m \
|
||||
\
|
||||
MAPIStoreNotesContext.m \
|
||||
MAPIStoreNotesFolder.m \
|
||||
MAPIStoreNotesMessage.m \
|
||||
\
|
||||
MAPIStoreFallbackContext.m \
|
||||
\
|
||||
MAPIStoreSharingMessage.m \
|
||||
\
|
||||
NSArray+MAPIStore.m \
|
||||
NSData+MAPIStore.m \
|
||||
NSDate+MAPIStore.m \
|
||||
NSObject+MAPIStore.m \
|
||||
NSString+MAPIStore.m \
|
||||
NSValue+MAPIStore.m \
|
||||
\
|
||||
iCalEvent+MAPIStore.m \
|
||||
iCalTimeZone+MAPIStore.m \
|
||||
\
|
||||
RTFHandler.m \
|
||||
\
|
||||
Codepages.m
|
||||
|
||||
|
||||
$(SOGOBACKEND)_RESOURCE_FILES += \
|
||||
product.plist
|
||||
|
||||
### pl reader
|
||||
PLREADER_TOOL = plreader
|
||||
$(PLREADER_TOOL)_OBJC_FILES += \
|
||||
plreader.m \
|
||||
|
||||
DBMSGREADER_TOOL = dbmsgreader
|
||||
$(DBMSGREADER_TOOL)_OBJC_FILES += \
|
||||
dbmsgreader.m \
|
||||
NSObject+PropertyList.m
|
||||
|
||||
$(DBMSGREADER_TOOL)_LIB_DIRS += \
|
||||
-L../SoObjects/SOGo/SOGo.framework/sogo -lSOGo \
|
||||
-L../SOPE/GDLContentStore/obj/ -lGDLContentStore \
|
||||
-L../SOPE/NGCards/obj/ -lNGCards \
|
||||
-lNGObjWeb \
|
||||
$(LIBMAPI_LIBS)
|
||||
|
||||
TEST_TOOL_NAME += $(PLREADER_TOOL) $(DBMSGREADER_TOOL)
|
||||
|
||||
### cflags and libs
|
||||
LIBMAPI_CFLAGS = $(shell pkg-config libmapi --cflags)
|
||||
|
||||
ifeq ($(LIBMAPI_CFLAGS),)
|
||||
all install::
|
||||
@echo "Cannot build the OpenChange SOGo backend (empty CFLAGS for libmapistore)"
|
||||
else
|
||||
|
||||
SAMBA_LIB_DIR = $(shell pkg-config libmapistore --variable=libdir)
|
||||
|
||||
LIBMAPI_LIBS = $(shell pkg-config libmapi --libs)
|
||||
|
||||
LIBMAPISTORE_CFLAGS = $(shell pkg-config libmapistore --cflags) -DSAMBA_PREFIX="\"$(shell pkg-config libmapistore --variable=prefix)\""
|
||||
LIBMAPISTORE_LIBS = $(shell pkg-config libmapistore --libs) -lmapiproxy -lWEExtensions
|
||||
|
||||
$(MAPISTORESOGO)_INSTALL_DIR = $(DESTDIR)/$(SAMBA_LIB_DIR)/mapistore_backends
|
||||
$(MAPISTORESOGO)_LIB_DIRS += \
|
||||
-L../SoObjects/SOGo/SOGo.framework/sogo/ -lSOGo -lgnustep-base -lobjc -lNGObjWeb \
|
||||
$(LIBMAPI_LIBS) \
|
||||
$(LIBMAPISTORE_LIBS)
|
||||
|
||||
$(SOGOBACKEND)_LIB_DIRS += \
|
||||
-L../SoObjects/SOGo/SOGo.framework/sogo/ -lSOGo \
|
||||
$(LIBMAPI_LIBS) \
|
||||
$(LIBMAPISTORE_LIBS)
|
||||
|
||||
ADDITIONAL_INCLUDE_DIRS += \
|
||||
-Wall \
|
||||
-DSAMBA_PRIVATE_DIR=@"\"$(SAMBA_PRIVATE_DIR)\"" \
|
||||
$(LIBMAPI_CFLAGS) \
|
||||
$(LIBMAPISTORE_CFLAGS) \
|
||||
-I../SoObjects -I../SOPE \
|
||||
-DBACKEND_BUNDLE_NAME="@\"$(BUNDLE_NAME)$(BUNDLE_EXTENSION)\"" \
|
||||
-DSOGO_BUNDLES_DIR="@\"$(BUNDLE_INSTALL_DIR)\""
|
||||
|
||||
ADDITIONAL_LDFLAGS += -Wl,--rpath,$(SOGO_SYSLIBDIR)/sogo
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
include $(GNUSTEP_MAKEFILES)/bundle.make
|
||||
include $(GNUSTEP_MAKEFILES)/library.make
|
||||
include $(GNUSTEP_MAKEFILES)/test-tool.make
|
||||
include $(GNUSTEP_MAKEFILES)/aggregate.make
|
||||
-include GNUmakefile.postamble
|
||||
|
||||
endif
|
||||
@@ -1,8 +0,0 @@
|
||||
all:: MAPIStorePropertySelectors.m MAPIStorePropertySelectors.h
|
||||
|
||||
MAPIStorePropertySelectors.m MAPIStorePropertySelectors.h: gen-property-selectors.py code-MAPIStorePropertySelectors.m code-MAPIStorePropertySelectors.h
|
||||
@echo " Auto-generating MAPIStorePropertySelectors.[hm]..."
|
||||
@$(PYTHON) ./gen-property-selectors.py -o MAPIStorePropertySelectors $(LIBMAPISTORE_CFLAGS)
|
||||
|
||||
distclean clean::
|
||||
-rm -f MAPIStorePropertySelectors.m MAPIStorePropertySelectors.h
|
||||
@@ -1,44 +0,0 @@
|
||||
/* MAPIApplication.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc.
|
||||
*
|
||||
* 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
|
||||
* 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 MAPIAPPLICATION_H
|
||||
#define MAPIAPPLICATION_H
|
||||
|
||||
#import <NGObjWeb/SoApplication.h>
|
||||
|
||||
@class MAPIStoreUserContext;
|
||||
|
||||
@interface MAPIApplication : SoApplication
|
||||
{
|
||||
MAPIStoreUserContext *userContext;
|
||||
}
|
||||
|
||||
- (id) authenticatorInContext: (id) context;
|
||||
- (MAPIStoreUserContext *) userContext;
|
||||
- (void) setUserContext: (MAPIStoreUserContext *) newContext;
|
||||
- (void) cleanup;
|
||||
|
||||
@end
|
||||
|
||||
extern MAPIApplication *MAPIApp;
|
||||
|
||||
#endif /* MAPIAPPLICATION_H */
|
||||
@@ -1,101 +0,0 @@
|
||||
/* MAPIApplication.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010 Inverse inc.
|
||||
*
|
||||
* 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
|
||||
* 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/NSUserDefaults.h>
|
||||
#import <Foundation/NSTimeZone.h>
|
||||
#import <WEExtensions/WEResourceManager.h>
|
||||
|
||||
#import <SOGo/SOGoProductLoader.h>
|
||||
#import <SOGo/SOGoSystemDefaults.h>
|
||||
|
||||
#import <Appointments/iCalEntityObject+SOGo.h>
|
||||
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
|
||||
#import "MAPIApplication.h"
|
||||
|
||||
MAPIApplication *MAPIApp = nil;
|
||||
|
||||
@implementation MAPIApplication
|
||||
|
||||
+ (BOOL) isCachingEnabled;
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSString *) name
|
||||
{
|
||||
return @"SOGo";
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if (!MAPIApp)
|
||||
{
|
||||
WEResourceManager *rm;
|
||||
|
||||
// TODO publish
|
||||
[iCalEntityObject initializeSOGoExtensions];
|
||||
|
||||
MAPIApp = [super init];
|
||||
[MAPIApp retain];
|
||||
|
||||
rm = [[WEResourceManager alloc] init];
|
||||
[self setResourceManager:rm];
|
||||
[rm release];
|
||||
|
||||
utcTZ = [NSTimeZone timeZoneWithName: @"UTC"];
|
||||
[utcTZ retain];
|
||||
}
|
||||
|
||||
return MAPIApp;
|
||||
}
|
||||
|
||||
- (BOOL) shouldSetupSignalHandlers
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (MAPIStoreUserContext *) userContext
|
||||
{
|
||||
return userContext;
|
||||
}
|
||||
|
||||
- (void) setUserContext: (MAPIStoreUserContext *) newContext
|
||||
{
|
||||
/* user contexts must not be retained here ad their holder (mapistore)
|
||||
contexts must be active when any operation occurs. */
|
||||
userContext = newContext;
|
||||
}
|
||||
|
||||
- (id) authenticatorInContext: (id) context
|
||||
{
|
||||
return [userContext authenticator];
|
||||
}
|
||||
|
||||
- (void) cleanup
|
||||
{
|
||||
[userContext deactivate];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,47 +0,0 @@
|
||||
/* MAPIStoreActiveTables.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREACTIVETABLES_H
|
||||
#define MAPISTOREACTIVETABLES_H
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class NSMutableArray;
|
||||
|
||||
@class MAPIStoreTable;
|
||||
|
||||
@interface MAPIStoreActiveTables : NSObject
|
||||
{
|
||||
NSMutableArray *records;
|
||||
}
|
||||
|
||||
+ (id) activeTables;
|
||||
|
||||
- (void) registerTable: (MAPIStoreTable *) table;
|
||||
- (void) unregisterTable: (MAPIStoreTable *) table;
|
||||
|
||||
- (NSArray *) activeTablesForFMID: (uint64_t) fmid
|
||||
andType: (uint8_t) tableType;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREACTIVETABLES_H */
|
||||
@@ -1,198 +0,0 @@
|
||||
/* MAPIStoreActiveTables.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* MAPIStoreActiveTables provides an interface to keep accounting of all
|
||||
instances of a given table, independently from its store and context.
|
||||
Primary useful for notifications across different connections. */
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import "MAPIStoreFolder.h"
|
||||
#import "MAPIStoreTable.h"
|
||||
|
||||
#import "MAPIStoreActiveTables.h"
|
||||
|
||||
@interface MAPIStoreActiveTableRecord : NSObject
|
||||
{
|
||||
uint64_t folderId;
|
||||
uint8_t tableType;
|
||||
MAPIStoreTable *table;
|
||||
}
|
||||
|
||||
+ (id) recordForTable: (MAPIStoreTable *) newTable;
|
||||
- (id) initWithTable: (MAPIStoreTable *) newTable;
|
||||
|
||||
- (MAPIStoreTable *) table;
|
||||
|
||||
- (BOOL) exactlyMatchesTable: (MAPIStoreTable *) otherTable;
|
||||
- (BOOL) matchesFMID: (uint64_t) otherFMid
|
||||
andTableType: (uint8_t) otherTableType;
|
||||
- (BOOL) matchesTable: (MAPIStoreTable *) otherTable;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MAPIStoreActiveTableRecord : NSObject
|
||||
|
||||
+ (id) recordForTable: (MAPIStoreTable *) newTable
|
||||
{
|
||||
MAPIStoreActiveTableRecord *record;
|
||||
|
||||
record = [[self alloc] initWithTable: newTable];
|
||||
[record autorelease];
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
folderId = 0;
|
||||
tableType = 0;
|
||||
table = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithTable: (MAPIStoreTable *) newTable
|
||||
{
|
||||
if ((self = [self init]))
|
||||
{
|
||||
table = newTable;
|
||||
folderId = [[table container] objectId];
|
||||
tableType = [table tableType];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (MAPIStoreTable *) table
|
||||
{
|
||||
return table;
|
||||
}
|
||||
|
||||
- (BOOL) exactlyMatchesTable: (MAPIStoreTable *) otherTable
|
||||
{
|
||||
return (table == otherTable);
|
||||
}
|
||||
|
||||
- (BOOL) matchesFMID: (uint64_t) otherFMid
|
||||
andTableType: (uint8_t) otherTableType
|
||||
{
|
||||
return (tableType == otherTableType
|
||||
&& folderId == otherFMid);
|
||||
}
|
||||
|
||||
- (BOOL) matchesTable: (MAPIStoreTable *) otherTable
|
||||
{
|
||||
uint64_t otherFMid;
|
||||
BOOL rc;
|
||||
|
||||
rc = [self exactlyMatchesTable: otherTable];
|
||||
if (!rc)
|
||||
{
|
||||
otherFMid = [[otherTable container] objectId];
|
||||
rc = [self matchesFMID: otherFMid andTableType: [otherTable tableType]];
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MAPIStoreActiveTables
|
||||
|
||||
+ (id) activeTables
|
||||
{
|
||||
static MAPIStoreActiveTables *activeTables = nil;
|
||||
|
||||
if (!activeTables)
|
||||
activeTables = [self new];
|
||||
|
||||
return activeTables;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
records = [NSMutableArray new];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[records release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) registerTable: (MAPIStoreTable *) table
|
||||
{
|
||||
MAPIStoreActiveTableRecord *newRecord;
|
||||
|
||||
newRecord = [MAPIStoreActiveTableRecord recordForTable: table];
|
||||
[records addObject: newRecord];
|
||||
}
|
||||
|
||||
- (void) unregisterTable: (MAPIStoreTable *) table
|
||||
{
|
||||
MAPIStoreActiveTableRecord *currentRecord;
|
||||
NSUInteger count, max;
|
||||
BOOL done = NO;
|
||||
|
||||
max = [records count];
|
||||
for (count = 0; !done && count < max; count++)
|
||||
{
|
||||
currentRecord = [records objectAtIndex: count];
|
||||
if ([currentRecord exactlyMatchesTable: table])
|
||||
{
|
||||
[records removeObject: currentRecord];
|
||||
done = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray *) activeTablesForFMID: (uint64_t) fmid
|
||||
andType: (uint8_t) tableType
|
||||
{
|
||||
NSUInteger count, max;
|
||||
NSMutableArray *tables;
|
||||
MAPIStoreActiveTableRecord *currentRecord;
|
||||
|
||||
tables = [NSMutableArray arrayWithCapacity: 5];
|
||||
|
||||
max = [records count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
currentRecord = [records objectAtIndex: count];
|
||||
if ([currentRecord matchesFMID: fmid andTableType: tableType])
|
||||
[tables addObject: [currentRecord table]];
|
||||
}
|
||||
|
||||
return tables;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,177 +0,0 @@
|
||||
/* MAPIStoreAppointmentWrapper.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTORECALENDARWRAPPER_H
|
||||
#define MAPISTORECALENDARWRAPPER_H
|
||||
|
||||
#import <NGCards/iCalPerson.h>
|
||||
#import <NGCards/iCalTimeZone.h>
|
||||
#import <Appointments/iCalEntityObject+SOGo.h>
|
||||
|
||||
#import "MAPIStoreObjectProxy.h"
|
||||
|
||||
@class NSTimeZone;
|
||||
|
||||
@class iCalAlarm;
|
||||
@class iCalCalendar;
|
||||
@class iCalEvent;
|
||||
|
||||
@class SOGoUser;
|
||||
|
||||
@interface MAPIStoreAppointmentWrapper : MAPIStoreObjectProxy
|
||||
{
|
||||
struct mapistore_connection_info *connInfo;
|
||||
iCalCalendar *calendar;
|
||||
iCalEvent *firstEvent;
|
||||
iCalEvent *event;
|
||||
iCalTimeZone *timeZone;
|
||||
SOGoUser *user;
|
||||
NSString *senderEmail;
|
||||
NSData *globalObjectId;
|
||||
NSData *cleanGlobalObjectId;
|
||||
BOOL alarmSet;
|
||||
iCalAlarm *alarm;
|
||||
BOOL itipSetup;
|
||||
NSString *method;
|
||||
iCalPersonPartStat partstat;
|
||||
}
|
||||
|
||||
+ (id) wrapperWithICalEvent: (iCalEvent *) newEvent
|
||||
andUser: (SOGoUser *) newUser
|
||||
andSenderEmail: (NSString *) newSenderEmail
|
||||
withConnectionInfo: (struct mapistore_connection_info *) newConnInfo;
|
||||
- (id) initWithICalEvent: (iCalEvent *) newEvent
|
||||
andUser: (SOGoUser *) newUser
|
||||
andSenderEmail: (NSString *) newSenderEmail
|
||||
withConnectionInfo: (struct mapistore_connection_info *) newConnInfo;
|
||||
|
||||
/* getters */
|
||||
- (void) fillMessageData: (struct mapistore_message *) dataPtr
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
|
||||
- (NSString *) creator;
|
||||
- (NSString *) owner;
|
||||
- (NSUInteger) sensitivity;
|
||||
|
||||
- (enum mapistore_error) getPidTagSenderEmailAddress: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidTagSenderAddressType: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidTagSenderName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidTagSenderEntryId: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
|
||||
- (enum mapistore_error) getPidTagReceivedByAddressType: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidTagReceivedByEmailAddress: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidTagReceivedByName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidTagReceivedByEntryId: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
|
||||
- (enum mapistore_error) getPidTagIconIndex: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidTagOwnerAppointmentId: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidMeetingType: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidTagMessageClass: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidTagStartDate: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidAppointmentSequence: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidAppointmentStateFlags: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidResponseStatus: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
|
||||
- (enum mapistore_error) getPidLidAppointmentStartWhole: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidCommonStart: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidTagEndDate: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidAppointmentEndWhole: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidCommonEnd: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidAppointmentDuration: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidAppointmentSubType: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidBusyStatus: (void **) data // TODO
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidIndentedBusyStatus: (void **) data // TODO
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidTagNormalizedSubject: (void **) data // SUMMARY
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidLocation: (void **) data // LOCATION
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidPrivate: (void **) data // private (bool), should depend on CLASS and permissions
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidTagSensitivity: (void **) data // not implemented, depends on CLASS
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidTagImportance: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidTagBody: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidIsRecurring: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidRecurring: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidAppointmentRecur: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidGlobalObjectId: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidCleanGlobalObjectId: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidServerProcessed: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidServerProcessingActions: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidAppointmentReplyTime: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
|
||||
/* reminders */
|
||||
- (enum mapistore_error) getPidLidReminderSet: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidReminderDelta: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidReminderTime: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidReminderSignalTime: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidReminderOverride: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidReminderType: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidReminderPlaySound: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getPidLidReminderFileParameter: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTORECALENDARWRAPPER_H */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,59 +0,0 @@
|
||||
/* MAPIStoreAttachment.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREATTACHMENT_H
|
||||
#define MAPISTOREATTACHMENT_H
|
||||
|
||||
#import "MAPIStoreObject.h"
|
||||
|
||||
@class NSData;
|
||||
@class MAPIStoreEmbeddedMessage;
|
||||
|
||||
@interface MAPIStoreAttachment : MAPIStoreObject
|
||||
{
|
||||
uint32_t aid;
|
||||
}
|
||||
|
||||
- (void) setAID: (uint32_t) newAID;
|
||||
- (uint32_t) AID;
|
||||
|
||||
- (enum mapistore_error) openEmbeddedMessage: (MAPIStoreEmbeddedMessage **) messagePtr
|
||||
withMID: (uint64_t *) mid
|
||||
withMAPIStoreMsg: (struct mapistore_message **) mapistoreMsgPtr
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) createEmbeddedMessage: (MAPIStoreEmbeddedMessage **) messagePtr
|
||||
withMAPIStoreMsg: (struct mapistore_message **) mapistoreMsgPtr
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
|
||||
/* helpers */
|
||||
- (NSData *) mimeAttachTag;
|
||||
|
||||
/* move & copy operations */
|
||||
- (void) copyToAttachment: (MAPIStoreAttachment *) newAttachment inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
|
||||
/* subclasses */
|
||||
- (MAPIStoreEmbeddedMessage *) openEmbeddedMessage;
|
||||
- (MAPIStoreEmbeddedMessage *) createEmbeddedMessage;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREATTACHMENT_H */
|
||||
@@ -1,194 +0,0 @@
|
||||
/* MAPIStoreAttachment.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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/NSData.h>
|
||||
|
||||
#import "MAPIStoreAttachment.h"
|
||||
#import "MAPIStoreEmbeddedMessage.h"
|
||||
#import "MAPIStoreContext.h"
|
||||
#import "MAPIStoreMapping.h"
|
||||
#import "MAPIStoreMessage.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "NSObject+MAPIStore.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <stdbool.h>
|
||||
#include <gen_ndr/exchange.h>
|
||||
#include <mapistore/mapistore.h>
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
|
||||
@implementation MAPIStoreAttachment
|
||||
|
||||
- (void) setAID: (uint32_t) newAID
|
||||
{
|
||||
aid = newAID;
|
||||
}
|
||||
|
||||
- (uint32_t) AID
|
||||
{
|
||||
return aid;
|
||||
}
|
||||
|
||||
- (NSString *) nameInContainer
|
||||
{
|
||||
return [NSString stringWithFormat: @"%d", aid];
|
||||
}
|
||||
|
||||
- (NSData *) mimeAttachTag
|
||||
{
|
||||
static NSData *mimeAttachTag = nil;
|
||||
char tagBytes[] = {0x2a, 0x86, 0x48, 0x86, 0xf7, 0x14, 0x03, 0x0a, 0x04};
|
||||
|
||||
if (!mimeAttachTag)
|
||||
{
|
||||
mimeAttachTag = [NSData dataWithBytes: tagBytes length: 9];
|
||||
[mimeAttachTag retain];
|
||||
}
|
||||
|
||||
return mimeAttachTag;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagMid: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = MAPILongLongValue (memCtx, [container objectId]);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachNumber: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = MAPILongValue (memCtx, aid);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagRenderingPosition: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = MAPILongValue (memCtx, 0xffffffff);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAccessLevel: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getLongZero: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) openEmbeddedMessage: (MAPIStoreEmbeddedMessage **) messagePtr
|
||||
withMID: (uint64_t *) mid
|
||||
withMAPIStoreMsg: (struct mapistore_message **) mapistoreMsgPtr
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
MAPIStoreEmbeddedMessage *attMessage;
|
||||
struct mapistore_message *mapistoreMsg;
|
||||
|
||||
mapistoreMsg = talloc_zero (memCtx, struct mapistore_message);
|
||||
|
||||
attMessage = [self openEmbeddedMessage];
|
||||
if (attMessage)
|
||||
{
|
||||
*mid = [attMessage objectId];
|
||||
*messagePtr = attMessage;
|
||||
*mapistoreMsgPtr = mapistoreMsg;
|
||||
}
|
||||
|
||||
return (attMessage ? MAPISTORE_SUCCESS : MAPISTORE_ERROR);
|
||||
}
|
||||
|
||||
- (enum mapistore_error) createEmbeddedMessage: (MAPIStoreEmbeddedMessage **) messagePtr
|
||||
withMAPIStoreMsg: (struct mapistore_message **) mapistoreMsgPtr
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
MAPIStoreEmbeddedMessage *attMessage;
|
||||
struct mapistore_message *mapistoreMsg;
|
||||
|
||||
mapistoreMsg = talloc_zero (memCtx, struct mapistore_message);
|
||||
attMessage = [self createEmbeddedMessage];
|
||||
if (attMessage)
|
||||
{
|
||||
*messagePtr = attMessage;
|
||||
*mapistoreMsgPtr = mapistoreMsg;
|
||||
}
|
||||
|
||||
return (attMessage ? MAPISTORE_SUCCESS : MAPISTORE_ERROR);
|
||||
}
|
||||
|
||||
- (NSDate *) creationTime
|
||||
{
|
||||
return [container creationTime];
|
||||
}
|
||||
|
||||
- (NSDate *) lastModificationTime
|
||||
{
|
||||
return [container lastModificationTime];
|
||||
}
|
||||
|
||||
- (uint64_t) objectVersion
|
||||
{
|
||||
/* attachments have no version number */
|
||||
return ULLONG_MAX;
|
||||
}
|
||||
|
||||
- (void) copyToAttachment: (MAPIStoreAttachment *) newAttachment inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
void *attachMethod;
|
||||
enum mapistore_error error;
|
||||
MAPIStoreEmbeddedMessage *embeddedMessage, *newEmbeddedMessage;
|
||||
|
||||
[self copyPropertiesToObject: newAttachment inMemCtx: memCtx];
|
||||
|
||||
attachMethod = NULL;
|
||||
error = [self getProperty: &attachMethod
|
||||
withTag: PidTagAttachMethod
|
||||
inMemCtx: NULL];
|
||||
if (error == MAPISTORE_SUCCESS && attachMethod)
|
||||
{
|
||||
if (*(uint32_t *) attachMethod == afEmbeddedMessage)
|
||||
{
|
||||
embeddedMessage = [self openEmbeddedMessage];
|
||||
newEmbeddedMessage = [newAttachment createEmbeddedMessage];
|
||||
[embeddedMessage copyToMessage: newEmbeddedMessage inMemCtx: memCtx];
|
||||
}
|
||||
talloc_free (attachMethod);
|
||||
}
|
||||
}
|
||||
|
||||
/* subclasses */
|
||||
- (MAPIStoreEmbeddedMessage *) openEmbeddedMessage
|
||||
{
|
||||
// [self subclassResponsibility: _cmd];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (MAPIStoreEmbeddedMessage *) createEmbeddedMessage
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,31 +0,0 @@
|
||||
/* MAPIStoreAttachmentTable.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREATTACHMENTTABLE_H
|
||||
#define MAPISTOREATTACHMENTTABLE_H
|
||||
|
||||
#import "MAPIStoreTable.h"
|
||||
|
||||
@interface MAPIStoreAttachmentTable : MAPIStoreTable
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREATTACHMENTTABLE_H */
|
||||
@@ -1,73 +0,0 @@
|
||||
/* MAPIStoreAttachmentTable.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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/NSArray.h>
|
||||
|
||||
#import "MAPIStoreMessage.h"
|
||||
|
||||
#import "MAPIStoreAttachmentTable.h"
|
||||
|
||||
@implementation MAPIStoreAttachmentTable
|
||||
|
||||
- (NSArray *) childKeys
|
||||
{
|
||||
if (!childKeys)
|
||||
{
|
||||
childKeys = [(MAPIStoreMessage *)
|
||||
container attachmentKeysMatchingQualifier: nil
|
||||
andSortOrderings: sortOrderings];
|
||||
[childKeys retain];
|
||||
}
|
||||
|
||||
return childKeys;
|
||||
}
|
||||
|
||||
- (NSArray *) restrictedChildKeys
|
||||
{
|
||||
NSArray *keys;
|
||||
|
||||
if (!restrictedChildKeys)
|
||||
{
|
||||
if (restrictionState != MAPIRestrictionStateAlwaysTrue)
|
||||
{
|
||||
if (restrictionState == MAPIRestrictionStateNeedsEval)
|
||||
keys = [(MAPIStoreMessage *)
|
||||
container attachmentKeysMatchingQualifier: restriction
|
||||
andSortOrderings: sortOrderings];
|
||||
else
|
||||
keys = [NSArray array];
|
||||
}
|
||||
else
|
||||
keys = [self childKeys];
|
||||
|
||||
ASSIGN (restrictedChildKeys, keys);
|
||||
}
|
||||
|
||||
return restrictedChildKeys;
|
||||
}
|
||||
|
||||
- (id) lookupChild: (NSString *) childKey
|
||||
{
|
||||
return [(MAPIStoreMessage *) container lookupAttachment: childKey];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,54 +0,0 @@
|
||||
|
||||
/* MAPIStoreAuthenticator.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc.
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREAUTHENTICATOR_H
|
||||
#define MAPISTOREAUTHENTICATOR_H
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class NSString;
|
||||
@class NSURL;
|
||||
|
||||
@class WOContext;
|
||||
|
||||
@interface MAPIStoreAuthenticator : NSObject
|
||||
{
|
||||
NSString *username;
|
||||
NSString *password;
|
||||
}
|
||||
|
||||
- (void) setUsername: (NSString *) newUsername;
|
||||
- (NSString *) username;
|
||||
|
||||
- (void) setPassword: (NSString *) newPassword;
|
||||
|
||||
- (NSString *) imapPasswordInContext: (WOContext *) context
|
||||
forURL: (NSURL *) server
|
||||
forceRenew: (BOOL) renew;
|
||||
|
||||
- (NSString *) passwordInContext: (WOContext *) context;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREAUTHENTICATOR_H */
|
||||
@@ -1,79 +0,0 @@
|
||||
/* MAPIStoreAuthenticator.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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/NSArray.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoPermissions.h>
|
||||
|
||||
#import "MAPIStoreAuthenticator.h"
|
||||
|
||||
@implementation MAPIStoreAuthenticator
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[username release];
|
||||
[password release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) setUsername: (NSString *) newUsername
|
||||
{
|
||||
ASSIGN (username, newUsername);
|
||||
}
|
||||
|
||||
- (NSString *) username
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
- (void) setPassword: (NSString *) newPassword
|
||||
{
|
||||
ASSIGN (password, newPassword);
|
||||
}
|
||||
|
||||
- (SOGoUser *) userInContext: (WOContext *)_ctx
|
||||
{
|
||||
return [SOGoUser userWithLogin: username
|
||||
roles: [NSArray arrayWithObject: SoRole_Authenticated]];
|
||||
}
|
||||
|
||||
- (NSString *) imapPasswordInContext: (WOContext *) context
|
||||
forURL: (NSURL *) server
|
||||
forceRenew: (BOOL) renew
|
||||
{
|
||||
NSString *imapPassword;
|
||||
|
||||
if (renew)
|
||||
imapPassword = nil;
|
||||
else
|
||||
imapPassword = password;
|
||||
|
||||
return imapPassword;
|
||||
}
|
||||
|
||||
- (NSString *) passwordInContext: (WOContext *) context
|
||||
{
|
||||
return password;
|
||||
}
|
||||
@end
|
||||
@@ -1,35 +0,0 @@
|
||||
/* MAPIStoreCalTaskFolder.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2016 Enrique J. Hernandez
|
||||
*
|
||||
* Author: Enrique J. Hernandez <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 MAPISTORECALTASKFOLDER_H
|
||||
#define MAPISTORECALTASKFOLDER_H
|
||||
|
||||
#import "MAPIStoreGCSFolder.h"
|
||||
|
||||
/* This class is intended to share code between Calendar and Tasks as
|
||||
of nowadays share the table */
|
||||
|
||||
@interface MAPIStoreCalTaskFolder : MAPIStoreGCSFolder
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTORECALTASKFOLDER_H */
|
||||
@@ -1,101 +0,0 @@
|
||||
/* MAPIStoreCalTaskFolder.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2016 Enrique J. Hernandez
|
||||
*
|
||||
* Author: Enrique J. Hernandez <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.
|
||||
*/
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSSet.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <SOGo/SOGoPermissions.h>
|
||||
|
||||
#import "MAPIStoreCalTaskFolder.h"
|
||||
|
||||
@implementation MAPIStoreCalTaskFolder
|
||||
|
||||
- (NSArray *) expandRoles: (NSArray *) roles
|
||||
{
|
||||
static NSDictionary *rolesMap = nil;
|
||||
NSArray *subRoles;
|
||||
NSMutableSet *expandedRoles;
|
||||
NSString *role, *subRole;
|
||||
NSUInteger i, max, j;
|
||||
|
||||
if (!rolesMap)
|
||||
{
|
||||
/* Build the map of array permissions */
|
||||
rolesMap = [[NSDictionary alloc] initWithObjects: [NSArray arrayWithObjects:
|
||||
[NSArray arrayWithObjects: SOGoCalendarRole_PublicDAndTViewer,
|
||||
SOGoCalendarRole_PublicViewer,
|
||||
SOGoCalendarRole_PublicResponder,
|
||||
SOGoCalendarRole_PublicModifier, nil],
|
||||
[NSArray arrayWithObjects: SOGoCalendarRole_ConfidentialDAndTViewer,
|
||||
SOGoCalendarRole_ConfidentialViewer,
|
||||
SOGoCalendarRole_ConfidentialResponder,
|
||||
SOGoCalendarRole_ConfidentialModifier, nil],
|
||||
[NSArray arrayWithObjects: SOGoCalendarRole_PrivateDAndTViewer,
|
||||
SOGoCalendarRole_PrivateViewer,
|
||||
SOGoCalendarRole_PrivateResponder,
|
||||
SOGoCalendarRole_PrivateModifier, nil],
|
||||
[NSArray arrayWithObjects: SOGoCalendarRole_ComponentDAndTViewer,
|
||||
SOGoCalendarRole_ComponentViewer,
|
||||
SOGoCalendarRole_ComponentResponder,
|
||||
SOGoCalendarRole_ComponentModifier, nil],
|
||||
nil]
|
||||
forKeys: [NSArray arrayWithObjects: @"Public", @"Confidential", @"Private",
|
||||
@"Component", nil]];
|
||||
}
|
||||
|
||||
max = [roles count];
|
||||
expandedRoles = [NSMutableSet set];
|
||||
for (i = 0; i < max; i++)
|
||||
{
|
||||
role = [roles objectAtIndex: i];
|
||||
subRoles = nil;
|
||||
if ([role hasPrefix: @"Public"])
|
||||
subRoles = [rolesMap objectForKey: @"Public"];
|
||||
else if ([role hasPrefix: @"Confidential"])
|
||||
subRoles = [rolesMap objectForKey: @"Confidential"];
|
||||
else if ([role hasPrefix: @"Private"])
|
||||
subRoles = [rolesMap objectForKey: @"Private"];
|
||||
else if ([role hasPrefix: @"Component"])
|
||||
subRoles = [rolesMap objectForKey: @"Component"];
|
||||
|
||||
if (subRoles)
|
||||
{
|
||||
for (j = 0; j < [subRoles count]; j++)
|
||||
{
|
||||
subRole = [subRoles objectAtIndex: j];
|
||||
[expandedRoles addObject: subRole];
|
||||
|
||||
if ([subRole isEqualToString: role])
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[expandedRoles addObject: role];
|
||||
}
|
||||
}
|
||||
|
||||
return [expandedRoles allObjects];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,40 +0,0 @@
|
||||
/* MAPIStoreCalTaskMessage.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2016 Enrique J. Hernandez
|
||||
*
|
||||
* Author: Enrique J. Hernandez <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 MAPISTORECALTASKMESSAGE_H
|
||||
#define MAPISTORECALTASKMESSAGE_H
|
||||
|
||||
#import "MAPIStoreGCSMessage.h"
|
||||
|
||||
/* This class is intended to share common logic for Calendar and Tasks
|
||||
as of today they are stored in the same table. This is relevant for
|
||||
permissions */
|
||||
@interface MAPIStoreCalTaskMessage : MAPIStoreGCSMessage
|
||||
{
|
||||
}
|
||||
|
||||
/* Get the sensitivity (access class) from a message */
|
||||
- (NSUInteger) sensitivity;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTORECALTASKMESSAGE_H */
|
||||
@@ -1,107 +0,0 @@
|
||||
/* MAPIStoreCalTaskMessage.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2016 Enrique J. Hernandez
|
||||
*
|
||||
* Author: Enrique J. Hernandez <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.
|
||||
*/
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
|
||||
#import <SOGo/SOGoPermissions.h>
|
||||
|
||||
#import "MAPIStoreFolder.h"
|
||||
#import "MAPIStoreCalTaskMessage.h"
|
||||
|
||||
@implementation MAPIStoreCalTaskMessage
|
||||
|
||||
/* It must be implemented by subclasses */
|
||||
- (NSUInteger) sensitivity
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (NSArray *) expandRoles: (NSArray *) roles
|
||||
{
|
||||
return [container expandRoles: roles];
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanModifyMessage
|
||||
{
|
||||
BOOL rc;
|
||||
NSArray *roles;
|
||||
|
||||
roles = [self activeUserRoles];
|
||||
|
||||
if (isNew)
|
||||
rc = [roles containsObject: SOGoRole_ObjectCreator];
|
||||
else
|
||||
rc = ([roles containsObject: SOGoCalendarRole_ComponentModifier]
|
||||
|| [roles containsObject: SOGoCalendarRole_ComponentResponder]);
|
||||
|
||||
/* Check if the message is owned and it has permission to edit it */
|
||||
if (!rc && [roles containsObject: MAPIStoreRightEditOwn])
|
||||
{
|
||||
NSString *currentUser;
|
||||
|
||||
currentUser = [[container context] activeUser];
|
||||
rc = [currentUser isEqual: [self ownerUser]];
|
||||
}
|
||||
|
||||
if (!rc)
|
||||
{
|
||||
NSUInteger sensitivity;
|
||||
|
||||
/* Get sensitivity of the message to check if the user can
|
||||
modify the message */
|
||||
sensitivity = [self sensitivity];
|
||||
/* FIXME: Use OpenChange constant names */
|
||||
switch (sensitivity)
|
||||
{
|
||||
case 0: /* PUBLIC */
|
||||
rc = [roles containsObject: SOGoCalendarRole_PublicModifier]
|
||||
|| [roles containsObject: SOGoCalendarRole_PublicResponder];
|
||||
break;
|
||||
case 1: /* PERSONAL */
|
||||
case 2: /* PRIVATE */
|
||||
rc = [roles containsObject: SOGoCalendarRole_PrivateModifier]
|
||||
|| [roles containsObject: SOGoCalendarRole_PrivateResponder];
|
||||
break;
|
||||
case 3: /* CONFIDENTIAL */
|
||||
rc = [roles containsObject: SOGoCalendarRole_ConfidentialModifier]
|
||||
|| [roles containsObject: SOGoCalendarRole_ConfidentialResponder];
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanReadMessage
|
||||
{
|
||||
NSArray *roles;
|
||||
|
||||
roles = [self activeUserRoles];
|
||||
|
||||
return ([roles containsObject: SOGoCalendarRole_ComponentViewer]
|
||||
|| [roles containsObject: SOGoCalendarRole_ComponentDAndTViewer]
|
||||
|| [self subscriberCanModifyMessage]);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,43 +0,0 @@
|
||||
/* MAPIStoreCalendarAttachment.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTORECALENDARATTACHMENT_H
|
||||
#define MAPISTORECALENDARATTACHMENT_H
|
||||
|
||||
#import "MAPIStoreAttachment.h"
|
||||
|
||||
@class NSTimeZone;
|
||||
|
||||
@class iCalEvent;
|
||||
|
||||
@interface MAPIStoreCalendarAttachment : MAPIStoreAttachment
|
||||
{
|
||||
iCalEvent *event;
|
||||
NSTimeZone *timeZone;
|
||||
}
|
||||
|
||||
- (void) setEvent: (iCalEvent *) newEvent;
|
||||
- (iCalEvent *) event;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTORECALENDARATTACHMENT_H */
|
||||
@@ -1,255 +0,0 @@
|
||||
/* MAPIStoreCalendarAttachment.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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/NSCalendarDate.h>
|
||||
#import <Foundation/NSData.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSTimeZone.h>
|
||||
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import "iCalEvent+MAPIStore.h"
|
||||
#import "MAPIStoreCalendarEmbeddedMessage.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import "NSDate+MAPIStore.h"
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSObject+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreCalendarAttachment.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <stdbool.h>
|
||||
#include <gen_ndr/exchange.h>
|
||||
#include <mapistore/mapistore.h>
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
|
||||
@implementation MAPIStoreCalendarAttachment
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
event = nil;
|
||||
timeZone = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initInContainer: (MAPIStoreObject *) newContainer
|
||||
{
|
||||
MAPIStoreUserContext *userContext;
|
||||
|
||||
if ((self = [super initInContainer: newContainer]))
|
||||
{
|
||||
userContext = [newContainer userContext];
|
||||
ASSIGN (timeZone, [userContext timeZone]);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[event release];
|
||||
[timeZone release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) setEvent: (iCalEvent *) newEvent
|
||||
{
|
||||
ASSIGN (event, newEvent);
|
||||
}
|
||||
|
||||
- (iCalEvent *) event
|
||||
{
|
||||
return event;
|
||||
}
|
||||
|
||||
- (NSString *) nameInContainer
|
||||
{
|
||||
return [[event uniqueChildWithTag: @"recurrence-id"]
|
||||
flattenedValuesForKey: @""];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachmentHidden: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) localMemCtx
|
||||
{
|
||||
return [self getYes: data inMemCtx: localMemCtx];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachmentFlags: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) localMemCtx
|
||||
{
|
||||
*data = MAPILongValue (localMemCtx, 0x00000002); /* afException */
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachmentLinkId: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) localMemCtx
|
||||
{
|
||||
return [self getLongZero: data inMemCtx: localMemCtx];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachFlags: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) localMemCtx
|
||||
{
|
||||
return [self getLongZero: data inMemCtx: localMemCtx];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachMethod: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) localMemCtx
|
||||
{
|
||||
*data = MAPILongValue (localMemCtx, afEmbeddedMessage);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachEncoding: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) localMemCtx
|
||||
{
|
||||
*data = [[NSData data] asBinaryInMemCtx: localMemCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagDisplayName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) localMemCtx
|
||||
{
|
||||
*data = [@"Untitled" asUnicodeInMemCtx: localMemCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachmentContactPhoto: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getNo: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagExceptionReplaceTime: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
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];
|
||||
*data = [dateValue asFileTimeInMemCtx: memCtx];
|
||||
}
|
||||
else
|
||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagExceptionStartTime: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) localMemCtx
|
||||
{
|
||||
enum mapistore_error rc;
|
||||
NSCalendarDate *dateValue;
|
||||
NSInteger offset;
|
||||
|
||||
if ([event recurrenceId] != nil)
|
||||
{
|
||||
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];
|
||||
}
|
||||
*data = [dateValue asFileTimeInMemCtx: localMemCtx];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
else
|
||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagExceptionEndTime: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) localMemCtx
|
||||
{
|
||||
enum mapistore_error rc;
|
||||
NSCalendarDate *dateValue;
|
||||
NSInteger offset;
|
||||
|
||||
if ([event recurrenceId] != nil)
|
||||
{
|
||||
dateValue = [event startDate];
|
||||
[dateValue setTimeZone: timeZone];
|
||||
offset = [event durationAsTimeInterval];
|
||||
if (![event isAllDay])
|
||||
offset += [timeZone secondsFromGMTForDate: dateValue];
|
||||
dateValue = [dateValue dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: offset];
|
||||
*data = [dateValue asFileTimeInMemCtx: localMemCtx];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
else
|
||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* subclasses */
|
||||
- (MAPIStoreCalendarEmbeddedMessage *) openEmbeddedMessage
|
||||
{
|
||||
MAPIStoreCalendarEmbeddedMessage *msg;
|
||||
|
||||
msg = [MAPIStoreCalendarEmbeddedMessage
|
||||
mapiStoreObjectInContainer: self];
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
- (MAPIStoreCalendarEmbeddedMessage *) createEmbeddedMessage
|
||||
{
|
||||
MAPIStoreCalendarEmbeddedMessage *msg;
|
||||
|
||||
msg = [self openEmbeddedMessage];
|
||||
[msg setIsNew: YES];
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,32 +0,0 @@
|
||||
/* MAPIStoreCalendarContext.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc.
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTORECALENDARCONTEXT_H
|
||||
#define MAPISTORECALENDARCONTEXT_H
|
||||
|
||||
#import "MAPIStoreGCSBaseContext.h"
|
||||
|
||||
@interface MAPIStoreCalendarContext : MAPIStoreGCSBaseContext
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTORECALENDARCONTEXT_H */
|
||||
@@ -1,64 +0,0 @@
|
||||
/* MAPIStoreCalendarContext.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 <Appointments/SOGoAppointmentFolders.h>
|
||||
|
||||
#import "MAPIStoreMapping.h"
|
||||
#import "MAPIStoreCalendarFolder.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
|
||||
#import "MAPIStoreCalendarContext.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
|
||||
static Class MAPIStoreCalendarFolderK;
|
||||
|
||||
@implementation MAPIStoreCalendarContext
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
MAPIStoreCalendarFolderK = [MAPIStoreCalendarFolder class];
|
||||
}
|
||||
|
||||
+ (NSString *) MAPIModuleName
|
||||
{
|
||||
return @"calendar";
|
||||
}
|
||||
|
||||
+ (enum mapistore_context_role) MAPIContextRole
|
||||
{
|
||||
return MAPISTORE_CALENDAR_ROLE;
|
||||
}
|
||||
|
||||
- (Class) MAPIStoreFolderClass
|
||||
{
|
||||
return MAPIStoreCalendarFolderK;
|
||||
}
|
||||
|
||||
+ (NSString *) folderNameSuffix
|
||||
{
|
||||
return @"c";
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,34 +0,0 @@
|
||||
/* MAPIStoreCalendarEmbeddedMessage.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTORECALENDAREMBEDDEDMESSAGE_H
|
||||
#define MAPISTORECALENDAREMBEDDEDMESSAGE_H
|
||||
|
||||
#import "MAPIStoreEmbeddedMessage.h"
|
||||
|
||||
@class MAPIStoreAppointmentWrapper;
|
||||
|
||||
@interface MAPIStoreCalendarEmbeddedMessage : MAPIStoreEmbeddedMessage
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTORECALENDAREMBEDDEDMESSAGE_H */
|
||||
@@ -1,215 +0,0 @@
|
||||
/* MAPIStoreCalendarEmbeddedMessage.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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/NSCalendarDate.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import "iCalEvent+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreAppointmentWrapper.h"
|
||||
#import "MAPIStoreCalendarAttachment.h"
|
||||
#import "MAPIStoreContext.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "NSObject+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreCalendarEmbeddedMessage.h"
|
||||
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
|
||||
@implementation MAPIStoreCalendarEmbeddedMessage
|
||||
|
||||
- (id) initInContainer: (id) newContainer
|
||||
{
|
||||
MAPIStoreContext *context;
|
||||
MAPIStoreUserContext *userContext;
|
||||
MAPIStoreAppointmentWrapper *appointmentWrapper;
|
||||
|
||||
if ((self = [super initInContainer: newContainer]))
|
||||
{
|
||||
context = [self context];
|
||||
userContext = [self userContext];
|
||||
appointmentWrapper
|
||||
= [MAPIStoreAppointmentWrapper
|
||||
wrapperWithICalEvent: [newContainer event]
|
||||
andUser: [userContext sogoUser]
|
||||
andSenderEmail: nil
|
||||
withConnectionInfo: [context connectionInfo]];
|
||||
[self addProxy: appointmentWrapper];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSDate *) creationTime
|
||||
{
|
||||
return [[container event] created];
|
||||
}
|
||||
|
||||
- (NSDate *) lastModificationTime
|
||||
{
|
||||
return [[container event] lastModified];
|
||||
}
|
||||
|
||||
- (void) getMessageData: (struct mapistore_message **) dataPtr
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
struct mapistore_message *msgData;
|
||||
|
||||
[super getMessageData: &msgData inMemCtx: memCtx];
|
||||
|
||||
/* 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];
|
||||
*dataPtr = msgData;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagMessageClass: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = talloc_strdup (memCtx, "IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}");
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagMessageFlags: (void **) data // TODO
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = MAPILongValue (memCtx, MSGFLAG_UNMODIFIED);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagProcessed: (void **) data inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getYes: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagResponseRequested: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getYes: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
/* discarded properties */
|
||||
|
||||
- (enum mapistore_error) getPidLidAppointmentLastSequence: (void **)
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidLidMeetingWorkspaceUrl: (void **)
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidLidContacts: (void **)
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagSensitivity: (void **)
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidLidPrivate: (void **)
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidNameKeywords: (void **)
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidLidFExceptionalBody: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getNo: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (void) save: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
// (gdb) po embeddedMessage->properties
|
||||
// 2442592320 = "2012-07-11 22:30:00 +0000";
|
||||
// 2448359488 = "2012-07-11 22:30:00 +0000";
|
||||
// 2442723392 = "2012-07-11 22:30:00 +0000";
|
||||
// 2442068032 = "2012-07-11 22:30:00 +0000";
|
||||
// 2441740352 = "2012-07-11 23:00:00 +0000";
|
||||
// 131083 = 1; 2442330115 = 2;
|
||||
// 235339779 = 9;
|
||||
// 6291520 = "2012-07-11 16:00:00 +0000";
|
||||
// 2442526784 = "2012-07-11 23:00:00 +0000";
|
||||
// 2818059 = 0;
|
||||
// 1703967 = "IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}";
|
||||
// 3538947 = 0;
|
||||
// 1071513603 = 28591; 805830720 = "2012-07-10 16:42:00 +0000";
|
||||
// 2485977346 = <02013000 02001500 45006100 73007400
|
||||
// 65007200 6e002000 53007400 61006e00 64006100 72006400 20005400 69006d00
|
||||
// 65000200 02013e00 0000d607 00000000 00000000 00000000 00002c01 00000000
|
||||
// 0000c4ff ffff0000 0a000000 05000200 00000000 00000000 04000000 01000200
|
||||
// 00000000 00000201 3e000200 d7070000 00000000 00000000 00000000 2c010000
|
||||
// 00000000 c4ffffff 00000b00 00000100 02000000 00000000 00000300 00000200
|
||||
// 02000000 00000000>; 2454257728 = "2012-07-11 16:00:00 +0000"; 2442985475 =
|
||||
// 118330; 1507331 = 1; 805765184 = "2012-07-09 18:32:00 +0000"; 2442657856 =
|
||||
// "2012-07-11 23:00:00 +0000"; 2443051039 = "11.0"; 236912651 = 1; 2485911810 =
|
||||
// <02013000 02001500 45006100 73007400 65007200 6e002000 53007400 61006e00
|
||||
// 64006100 72006400 20005400 69006d00 65000200 02013e00 0000d607 00000000
|
||||
// 00000000 00000000 00002c01 00000000 0000c4ff ffff0000 0a000000 05000200
|
||||
// 00000000 00000000 04000000 01000200 00000000 00000201 3e000200 d7070000
|
||||
// 00000000 00000000 00000000 2c010000 00000000 c4ffffff 00000b00 00000100
|
||||
// 02000000 00000000 00000300 00000200 02000000 00000000>; 2441543683 = 30;
|
||||
// 2442068032 = "2012-07-11 22:30:00 +0000";
|
||||
// 1073348639 = "OpenChange User";
|
||||
// 806027522 = <2d64f6f5 89a59243 992d29d1 49173b3a>; 6357056 = "2012-07-11
|
||||
// 16:30:00 +0000";
|
||||
// */
|
||||
|
||||
// // 0x92490040 = 2454257728
|
||||
|
||||
// }
|
||||
|
||||
SOGoUser *activeUser;
|
||||
|
||||
activeUser = [[self context] activeUser];
|
||||
|
||||
[[container event] updateFromMAPIProperties: properties
|
||||
inUserContext: [self userContext]
|
||||
withActiveUser: activeUser
|
||||
isNew: NO
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,32 +0,0 @@
|
||||
/* MAPIStoreCalendarFolder.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTORECALENDARFOLDER_H
|
||||
#define MAPISTORECALENDARFOLDER_H
|
||||
|
||||
#import "MAPIStoreCalTaskFolder.h"
|
||||
|
||||
@interface MAPIStoreCalendarFolder : MAPIStoreCalTaskFolder
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTORECALENDARFOLDER_H */
|
||||
@@ -1,226 +0,0 @@
|
||||
/* MAPIStoreCalendarFolder.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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/NSArray.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <EOControl/EOQualifier.h>
|
||||
#import <SOGo/SOGoPermissions.h>
|
||||
#import <Appointments/SOGoAppointmentFolder.h>
|
||||
#import <Appointments/SOGoAppointmentFolders.h>
|
||||
#import <Appointments/SOGoAppointmentObject.h>
|
||||
|
||||
#import "MAPIApplication.h"
|
||||
#import "MAPIStoreCalendarContext.h"
|
||||
#import "MAPIStoreCalendarMessage.h"
|
||||
#import "MAPIStoreCalendarMessageTable.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreCalendarFolder.h"
|
||||
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
#include <util/time.h>
|
||||
#include <gen_ndr/exchange.h>
|
||||
|
||||
@implementation MAPIStoreCalendarFolder
|
||||
|
||||
- (MAPIStoreMessageTable *) messageTable
|
||||
{
|
||||
[self synchroniseCache];
|
||||
return [MAPIStoreCalendarMessageTable tableForContainer: self];
|
||||
}
|
||||
|
||||
- (NSString *) component
|
||||
{
|
||||
return @"vevent";
|
||||
}
|
||||
|
||||
- (MAPIStoreMessage *) createMessage
|
||||
{
|
||||
MAPIStoreMessage *newMessage;
|
||||
SOGoAppointmentObject *newEntry;
|
||||
NSString *name;
|
||||
|
||||
[[self userContext] activate];
|
||||
|
||||
name = [NSString stringWithFormat: @"%@.ics",
|
||||
[SOGoObject globallyUniqueObjectId]];
|
||||
newEntry = [SOGoAppointmentObject objectWithName: name
|
||||
inContainer: sogoObject];
|
||||
[newEntry setIsNew: YES];
|
||||
newMessage = [MAPIStoreCalendarMessage mapiStoreObjectWithSOGoObject: newEntry
|
||||
inContainer: self];
|
||||
return newMessage;
|
||||
}
|
||||
|
||||
- (NSArray *) rolesForExchangeRights: (uint32_t) rights
|
||||
{
|
||||
/* Limitations
|
||||
|
||||
Following rights are not supported by SOGo specifically:
|
||||
|
||||
- CreateSubfolders: No calendar subfolders
|
||||
- FolderVisible: It is inferred by other rights when extracting
|
||||
*/
|
||||
NSMutableArray *roles;
|
||||
|
||||
roles = [NSMutableArray arrayWithCapacity: 6];
|
||||
if (rights & RightsCreateItems)
|
||||
[roles addObject: SOGoRole_ObjectCreator];
|
||||
if (rights & RightsDeleteAll)
|
||||
[roles addObject: SOGoRole_ObjectEraser];
|
||||
if (rights & RightsDeleteOwn)
|
||||
[roles addObject: MAPIStoreRightDeleteOwn];
|
||||
|
||||
if (rights & RightsEditAll)
|
||||
{
|
||||
[roles addObject: SOGoCalendarRole_PublicModifier];
|
||||
[roles addObject: SOGoCalendarRole_PrivateModifier];
|
||||
[roles addObject: SOGoCalendarRole_ConfidentialModifier];
|
||||
}
|
||||
if (rights & RightsEditOwn)
|
||||
[roles addObject: MAPIStoreRightEditOwn];
|
||||
|
||||
if (rights & RightsReadItems)
|
||||
{
|
||||
[roles addObject: SOGoCalendarRole_PublicViewer];
|
||||
[roles addObject: SOGoCalendarRole_PrivateViewer];
|
||||
[roles addObject: SOGoCalendarRole_ConfidentialViewer];
|
||||
}
|
||||
if (rights & RightsFreeBusySimple)
|
||||
[roles addObject: SOGoCalendarRole_PublicDAndTViewer];
|
||||
|
||||
if (rights & RightsFreeBusyDetailed)
|
||||
[roles addObject: SOGoCalendarRole_ConfidentialDAndTViewer];
|
||||
|
||||
if (rights & RightsFolderOwner)
|
||||
[roles addObject: MAPIStoreRightFolderOwner];
|
||||
|
||||
if (rights & RightsFolderContact)
|
||||
[roles addObject: MAPIStoreRightFolderContact];
|
||||
|
||||
// [self logWithFormat: @"roles for rights %.8x = (%@)", rights, roles];
|
||||
|
||||
return roles;
|
||||
}
|
||||
|
||||
- (uint32_t) exchangeRightsForRoles: (NSArray *) roles
|
||||
{
|
||||
uint32_t rights = 0;
|
||||
|
||||
if ([roles containsObject: SOGoRole_ObjectCreator])
|
||||
rights |= RightsCreateItems;
|
||||
if ([roles containsObject: SOGoRole_ObjectEraser])
|
||||
rights |= RightsDeleteAll | RightsDeleteOwn;
|
||||
if ([roles containsObject: SOGoCalendarRole_PublicModifier]
|
||||
&& [roles containsObject: SOGoCalendarRole_PrivateModifier]
|
||||
&& [roles containsObject: SOGoCalendarRole_ConfidentialModifier])
|
||||
rights |= RightsReadItems | RightsEditAll | RightsEditOwn | RightsFreeBusySimple | RightsFreeBusyDetailed;
|
||||
else if ([roles containsObject: SOGoCalendarRole_PublicViewer]
|
||||
&& [roles containsObject: SOGoCalendarRole_PrivateViewer]
|
||||
&& [roles containsObject: SOGoCalendarRole_ConfidentialViewer])
|
||||
rights |= RightsReadItems;
|
||||
|
||||
if ([roles containsObject: MAPIStoreRightEditOwn])
|
||||
rights |= RightsEditOwn;
|
||||
if ([roles containsObject: MAPIStoreRightDeleteOwn])
|
||||
rights |= RightsDeleteOwn;
|
||||
|
||||
if ([roles containsObject: SOGoCalendarRole_PublicDAndTViewer])
|
||||
rights |= RightsFreeBusySimple;
|
||||
|
||||
if ([roles containsObject: SOGoCalendarRole_ConfidentialDAndTViewer])
|
||||
rights |= RightsFreeBusySimple | RightsFreeBusyDetailed;
|
||||
|
||||
if ((rights & RightsReadItems) != 0 || (rights & RightsCreateItems) != 0 || (rights & RightsDeleteAll) != 0)
|
||||
rights |= RoleNone; /* actually "folder visible" */
|
||||
|
||||
if ([roles containsObject: MAPIStoreRightFolderOwner])
|
||||
rights |= RightsFolderOwner | RoleNone;
|
||||
|
||||
if ([roles containsObject: MAPIStoreRightFolderContact])
|
||||
rights |= RightsFolderContact;
|
||||
|
||||
// [self logWithFormat: @"rights for roles (%@) = %.8x", roles, rights];
|
||||
|
||||
return rights;
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanReadMessages
|
||||
{
|
||||
static NSArray *viewerRoles = nil;
|
||||
|
||||
if (!viewerRoles)
|
||||
viewerRoles = [[NSArray alloc] initWithObjects:
|
||||
SOGoCalendarRole_PublicViewer,
|
||||
SOGoCalendarRole_PublicDAndTViewer,
|
||||
SOGoCalendarRole_PrivateViewer,
|
||||
SOGoCalendarRole_PrivateDAndTViewer,
|
||||
SOGoCalendarRole_ConfidentialViewer,
|
||||
SOGoCalendarRole_ConfidentialDAndTViewer,
|
||||
nil];
|
||||
|
||||
return ([[self activeUserRoles] firstObjectCommonWithArray: viewerRoles]
|
||||
!= nil);
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanModifyMessages
|
||||
{
|
||||
static NSArray *modifierRoles = nil;
|
||||
|
||||
if (!modifierRoles)
|
||||
modifierRoles = [[NSArray alloc] initWithObjects:
|
||||
SOGoCalendarRole_PublicModifier,
|
||||
SOGoCalendarRole_PrivateModifier,
|
||||
SOGoCalendarRole_ConfidentialModifier,
|
||||
nil];
|
||||
|
||||
return ([[self activeUserRoles] firstObjectCommonWithArray: modifierRoles]
|
||||
!= nil);
|
||||
}
|
||||
|
||||
- (EOQualifier *) aclQualifier
|
||||
{
|
||||
return [EOQualifier qualifierWithQualifierFormat:
|
||||
[(SOGoAppointmentFolder *) sogoObject aclSQLListingFilter]];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagContainerClass: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = [@"IPF.Appointment" asUnicodeInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagDefaultPostMessageClass: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = [@"IPM.Appointment" asUnicodeInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,40 +0,0 @@
|
||||
/* MAPIStoreCalendarMessage.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTORECALENDARMESSAGE_H
|
||||
#define MAPISTORECALENDARMESSAGE_H
|
||||
|
||||
#import "MAPIStoreCalTaskMessage.h"
|
||||
|
||||
@class iCalCalendar;
|
||||
@class iCalEvent;
|
||||
@class MAPIStoreAppointmentWrapper;
|
||||
|
||||
@interface MAPIStoreCalendarMessage : MAPIStoreCalTaskMessage
|
||||
{
|
||||
iCalCalendar *calendar;
|
||||
iCalEvent *masterEvent;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTORECALENDARMESSAGE_H */
|
||||
@@ -1,669 +0,0 @@
|
||||
/* MAPIStoreCalendarMessage.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* TODO:
|
||||
- merge common code with tasks
|
||||
- take the tz definitions from Outlook */
|
||||
|
||||
#include <talloc.h>
|
||||
#include <util/attr.h>
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSCalendarDate.h>
|
||||
#import <Foundation/NSData.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSTimeZone.h>
|
||||
#import <EOControl/EOQualifier.h>
|
||||
#import <EOControl/EOFetchSpecification.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <GDLContentStore/GCSFolder.h>
|
||||
#import <NGCards/iCalAlarm.h>
|
||||
#import <NGCards/iCalCalendar.h>
|
||||
#import <NGCards/iCalEvent.h>
|
||||
#import <NGCards/iCalDateTime.h>
|
||||
#import <NGCards/iCalPerson.h>
|
||||
#import <NGCards/iCalTimeZone.h>
|
||||
#import <NGCards/iCalTrigger.h>
|
||||
#import <SOGo/SOGoPermissions.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserManager.h>
|
||||
#import <Appointments/SOGoAppointmentFolder.h>
|
||||
#import <Appointments/SOGoAppointmentObject.h>
|
||||
#import <Appointments/iCalEntityObject+SOGo.h>
|
||||
#import <Mailer/NSString+Mail.h>
|
||||
|
||||
#import "iCalEvent+MAPIStore.h"
|
||||
#import "MAPIStoreAppointmentWrapper.h"
|
||||
#import "MAPIStoreCalendarAttachment.h"
|
||||
#import "MAPIStoreCalendarFolder.h"
|
||||
#import "MAPIStoreContext.h"
|
||||
#import "MAPIStoreMapping.h"
|
||||
#import "MAPIStoreRecurrenceUtils.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import "NSDate+MAPIStore.h"
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSObject+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
#import "NSValue+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreCalendarMessage.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <stdbool.h>
|
||||
#include <gen_ndr/exchange.h>
|
||||
#include <gen_ndr/property.h>
|
||||
#include <libmapi/libmapi.h>
|
||||
#include <mapistore/mapistore.h>
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
#include <mapistore/mapistore_nameid.h>
|
||||
|
||||
// extern void ndr_print_AppointmentRecurrencePattern(struct ndr_print *ndr, const char *name, const struct AppointmentRecurrencePattern *r);
|
||||
|
||||
static Class NSArrayK, MAPIStoreAppointmentWrapperK;
|
||||
|
||||
@implementation SOGoAppointmentObject (MAPIStoreExtension)
|
||||
|
||||
- (Class) mapistoreMessageClass
|
||||
{
|
||||
return [MAPIStoreCalendarMessage class];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MAPIStoreCalendarMessage
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
NSArrayK = [NSArray class];
|
||||
MAPIStoreAppointmentWrapperK = [MAPIStoreAppointmentWrapper class];
|
||||
}
|
||||
|
||||
+ (enum mapistore_error) getAvailableProperties: (struct SPropTagArray **) propertiesP
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
BOOL listedProperties[65536];
|
||||
NSUInteger count;
|
||||
uint16_t propId;
|
||||
|
||||
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;
|
||||
}
|
||||
[MAPIStoreAppointmentWrapper fillAvailableProperties: *propertiesP
|
||||
withExclusions: listedProperties];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
calendar = nil;
|
||||
masterEvent = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) _setupAttachmentParts
|
||||
{
|
||||
NSUInteger count, max;
|
||||
NSArray *events;
|
||||
NSString *newKey;
|
||||
MAPIStoreCalendarAttachment *attachment;
|
||||
NSUInteger aid;
|
||||
iCalEvent *event;
|
||||
|
||||
events = [calendar events];
|
||||
max = [events count];
|
||||
for (count = 1; count < max; count++)
|
||||
{
|
||||
attachment = [MAPIStoreCalendarAttachment
|
||||
mapiStoreObjectInContainer: self];
|
||||
/* we now that there are no attachments yet, so we can assume that the
|
||||
right AID is 0 from the start */
|
||||
aid = count - 1;
|
||||
[attachment setAID: aid];
|
||||
event = [events objectAtIndex: count];
|
||||
[attachment setEvent: event];
|
||||
newKey = [[event uniqueChildWithTag: @"recurrence-id"]
|
||||
flattenedValuesForKey: @""];
|
||||
[attachmentParts setObject: attachment forKey: newKey];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithSOGoObject: (id) newSOGoObject
|
||||
inContainer: (MAPIStoreObject *) newFolder
|
||||
{
|
||||
MAPIStoreContext *context;
|
||||
MAPIStoreUserContext *userContext;
|
||||
iCalCalendar *origCalendar;
|
||||
MAPIStoreAppointmentWrapper *appointmentWrapper;
|
||||
|
||||
if ((self = [super initWithSOGoObject: newSOGoObject
|
||||
inContainer: newFolder]))
|
||||
{
|
||||
if ([newSOGoObject isNew])
|
||||
{
|
||||
ASSIGN (calendar, [iCalCalendar groupWithTag: @"vcalendar"]);
|
||||
[calendar setVersion: @"2.0"];
|
||||
[calendar setProdID: @"-//Inverse inc.//OpenChange+SOGo//EN"];
|
||||
masterEvent = [iCalEvent groupWithTag: @"vevent"];
|
||||
[calendar addChild: masterEvent];
|
||||
[masterEvent setCreated: [NSCalendarDate date]];
|
||||
}
|
||||
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];
|
||||
}
|
||||
context = [self context];
|
||||
userContext = [self userContext];
|
||||
appointmentWrapper
|
||||
= [MAPIStoreAppointmentWrapper wrapperWithICalEvent: masterEvent
|
||||
andUser: [userContext sogoUser]
|
||||
andSenderEmail: nil
|
||||
withConnectionInfo: [context connectionInfo]];
|
||||
[self addProxy: appointmentWrapper];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
//NSLog(@"MAPIStoreCalendarMessage: -dealloc (%p)", self);
|
||||
[calendar release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (MAPIStoreAppointmentWrapper *) _appointmentWrapper
|
||||
{
|
||||
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 */
|
||||
- (enum mapistore_error) getPidTagMessageClass: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
SOGoUser *owner;
|
||||
|
||||
owner = [[self userContext] sogoUser];
|
||||
if ([masterEvent userAsAttendee: owner])
|
||||
*data = talloc_strdup (memCtx, "IPM.Schedule.Meeting.Request");
|
||||
else
|
||||
*data = talloc_strdup (memCtx, "IPM.Appointment");
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidLidSideEffects: (void **) data // TODO
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = MAPILongValue (memCtx,
|
||||
seOpenToDelete | seOpenToCopy | seOpenToMove
|
||||
| seCoerceToInbox | seOpenForCtxMenu);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagProcessed: (void **) data inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getYes: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (void) getMessageData: (struct mapistore_message **) dataPtr
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
static NSString *recTypes[] = {@"orig", @"to", @"cc", @"bcc"};
|
||||
static NSInteger recTypesValue[] = {MAPI_ORIG, MAPI_TO, MAPI_CC, MAPI_BCC};
|
||||
struct mapistore_message *msgData;
|
||||
NSDictionary *recipients, *contactInfos;
|
||||
NSString *email;
|
||||
NSArray *attendees;
|
||||
NSDictionary *attendee;
|
||||
SOGoUserManager *mgr;
|
||||
struct mapistore_message_recipient *recipient;
|
||||
NSUInteger nRecType, maxRecTypes, count, max, propCount;
|
||||
NSObject *currentValue;
|
||||
|
||||
[super getMessageData: &msgData inMemCtx: memCtx];
|
||||
|
||||
/* The presence of the "recipients" meta-property means that our most recent
|
||||
list of recipients has not been saved yet and that we must return that
|
||||
one instead of the one stored in the event. */
|
||||
recipients = [properties objectForKey: @"recipients"];
|
||||
if (recipients)
|
||||
{
|
||||
mgr = [SOGoUserManager sharedUserManager];
|
||||
|
||||
/* TODO: this code might need to be moved into MAPIStoreMessage */
|
||||
msgData->columns = set_SPropTagArray (msgData, 9,
|
||||
PR_OBJECT_TYPE,
|
||||
PR_DISPLAY_TYPE,
|
||||
PR_7BIT_DISPLAY_NAME_UNICODE,
|
||||
PR_SMTP_ADDRESS_UNICODE,
|
||||
PR_SEND_INTERNET_ENCODING,
|
||||
PR_RECIPIENT_DISPLAY_NAME_UNICODE,
|
||||
PR_RECIPIENT_FLAGS,
|
||||
PR_RECIPIENT_ENTRYID,
|
||||
PR_RECIPIENT_TRACKSTATUS);
|
||||
|
||||
maxRecTypes = sizeof(recTypes) / sizeof(recTypes[0]);
|
||||
for (nRecType = 0; nRecType < maxRecTypes; nRecType++)
|
||||
{
|
||||
attendees = [recipients objectForKey: recTypes[nRecType]];
|
||||
max = [attendees count];
|
||||
if (max > 0)
|
||||
{
|
||||
msgData->recipients_count += max;
|
||||
msgData->recipients = talloc_realloc(msgData,
|
||||
msgData->recipients, struct
|
||||
mapistore_message_recipient, msgData->recipients_count);
|
||||
recipient = msgData->recipients;
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
attendee = [attendees objectAtIndex: count];
|
||||
recipient->type = recTypesValue[nRecType];
|
||||
email = [attendee objectForKey: @"email"];
|
||||
if (email)
|
||||
{
|
||||
contactInfos
|
||||
= [mgr contactInfosForUserWithUIDorEmail: email];
|
||||
recipient->username = [[contactInfos
|
||||
objectForKey: @"c_uid"]
|
||||
asUnicodeInMemCtx: msgData];
|
||||
}
|
||||
else
|
||||
recipient->username = NULL;
|
||||
|
||||
recipient->data = talloc_array(msgData, void *,
|
||||
msgData->columns->cValues);
|
||||
for (propCount = 0;
|
||||
propCount < msgData->columns->cValues;
|
||||
propCount++)
|
||||
{
|
||||
currentValue = [attendee objectForKey: MAPIPropertyKey (msgData->columns->aulPropTag[propCount])];
|
||||
[currentValue getValue: recipient->data + propCount
|
||||
forTag: msgData->columns->aulPropTag[propCount]
|
||||
inMemCtx: msgData];
|
||||
}
|
||||
recipient++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[[self _appointmentWrapper] fillMessageData: msgData
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
*dataPtr = msgData;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) 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).
|
||||
*/
|
||||
- (enum mapistore_error) 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;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) 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];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) 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;
|
||||
NSString *uid = nil;
|
||||
char *bytesDup, *uidStart;
|
||||
NSUInteger length;
|
||||
|
||||
/* NOTE: we only handle the generic case at the moment, see
|
||||
MAPIStoreAppointmentWrapper */
|
||||
objectId = [properties
|
||||
objectForKey: MAPIPropertyKey (PidLidGlobalObjectId)];
|
||||
if (objectId)
|
||||
{
|
||||
length = [objectId length];
|
||||
bytesDup = talloc_array (memCtx, char, length + 1);
|
||||
memcpy (bytesDup, [objectId bytes], length);
|
||||
bytesDup[length] = 0;
|
||||
uidStart = bytesDup + length - 1;
|
||||
while (uidStart != bytesDup && *(uidStart - 1))
|
||||
uidStart--;
|
||||
if (uidStart > bytesDup && *uidStart)
|
||||
uid = [NSString stringWithUTF8String: uidStart];
|
||||
talloc_free (bytesDup);
|
||||
}
|
||||
|
||||
return uid;
|
||||
}
|
||||
|
||||
- (SOGoAppointmentObject *) _resurrectRecord: (NSString *) cname
|
||||
fromFolder: (SOGoAppointmentFolder *) folder
|
||||
{
|
||||
NSArray *records;
|
||||
EOQualifier *qualifier;
|
||||
EOFetchSpecification *fs;
|
||||
GCSFolder *ocsFolder;
|
||||
SOGoAppointmentObject *newObject;
|
||||
NSMutableDictionary *newRecord;
|
||||
static NSArray *childRecordFields = nil;
|
||||
|
||||
if (!childRecordFields)
|
||||
{
|
||||
childRecordFields = [NSArray arrayWithObjects: @"c_name",
|
||||
@"c_creationdate", @"c_lastmodified",
|
||||
@"c_content", nil];
|
||||
[childRecordFields retain];
|
||||
}
|
||||
|
||||
ocsFolder = [folder ocsFolder];
|
||||
|
||||
qualifier
|
||||
= [EOQualifier qualifierWithQualifierFormat:
|
||||
[NSString stringWithFormat: @"c_name='%@'", cname]];
|
||||
fs = [EOFetchSpecification fetchSpecificationWithEntityName: [ocsFolder folderName]
|
||||
qualifier: qualifier
|
||||
sortOrderings: nil];
|
||||
records = [ocsFolder fetchFields: childRecordFields
|
||||
fetchSpecification: fs
|
||||
ignoreDeleted: NO];
|
||||
if ([records isKindOfClass: NSArrayK] && [records count])
|
||||
{
|
||||
newRecord = [[records objectAtIndex: 0] mutableCopy];
|
||||
[newRecord setObject: [NSNumber numberWithInt: 0]
|
||||
forKey: @"c_version"];
|
||||
newObject = [SOGoAppointmentObject objectWithRecord: newRecord
|
||||
inContainer: folder];
|
||||
[newRecord autorelease];
|
||||
[newObject setIsNew: NO];
|
||||
}
|
||||
else
|
||||
newObject = nil;
|
||||
|
||||
|
||||
return newObject;
|
||||
}
|
||||
|
||||
- (void) _fixupAppointmentObjectWithUID: (NSString *) uid
|
||||
{
|
||||
NSString *cname, *url;
|
||||
MAPIStoreMapping *mapping;
|
||||
uint64_t objectId;
|
||||
WOContext *woContext;
|
||||
SOGoAppointmentFolder *folder;
|
||||
SOGoAppointmentObject *newObject;
|
||||
|
||||
cname = [[container sogoObject] resourceNameForEventUID: uid];
|
||||
if (cname)
|
||||
isNew = NO;
|
||||
else
|
||||
cname = [NSString stringWithFormat: @"%@.ics", uid];
|
||||
|
||||
mapping = [self mapping];
|
||||
|
||||
url = [NSString stringWithFormat: @"%@%@", [container url], cname];
|
||||
folder = [sogoObject container];
|
||||
|
||||
/* reinstantiate the old sogo object and attach it to self */
|
||||
[[self userContext] activate];
|
||||
woContext = [[self userContext] woContext];
|
||||
if (isNew)
|
||||
{
|
||||
/* event could have been deleted, let's try to resurrect it */
|
||||
newObject = [self _resurrectRecord: cname fromFolder: folder];
|
||||
if (!newObject)
|
||||
{
|
||||
newObject = [SOGoAppointmentObject objectWithName: cname
|
||||
inContainer: folder];
|
||||
[newObject setIsNew: YES];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* dissociate the object url from the old object's id */
|
||||
objectId = [mapping idFromURL: url];
|
||||
[mapping unregisterURLWithID: objectId];
|
||||
newObject = [folder lookupName: cname
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
}
|
||||
|
||||
/* dissociate the object url associated with this object, as we want to
|
||||
discard it */
|
||||
objectId = [self objectId];
|
||||
[mapping unregisterURLWithID: objectId];
|
||||
|
||||
/* associate the new object url with this object id */
|
||||
[mapping registerURL: url withID: objectId];
|
||||
|
||||
[newObject setContext: woContext];
|
||||
ASSIGN (sogoObject, newObject);
|
||||
}
|
||||
|
||||
- (NSUInteger) sensitivity
|
||||
{
|
||||
return [[self _appointmentWrapper] sensitivity];
|
||||
}
|
||||
|
||||
- (NSString *) creator
|
||||
{
|
||||
return [[self _appointmentWrapper] creator];
|
||||
}
|
||||
|
||||
- (NSString *) owner
|
||||
{
|
||||
return [[self _appointmentWrapper] owner];
|
||||
}
|
||||
|
||||
- (void) _updateAttachedEvents
|
||||
{
|
||||
NSArray *allAttachments;
|
||||
NSUInteger count, max;
|
||||
NSString *uid, *summary;
|
||||
iCalEvent *event;
|
||||
MAPIStoreCalendarAttachment *attachment;
|
||||
|
||||
/* ensure that all exception events have the same UID as the master */
|
||||
uid = [masterEvent uid];
|
||||
summary = [masterEvent summary];
|
||||
|
||||
allAttachments = [attachmentParts allValues];
|
||||
max = [allAttachments count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
attachment = [allAttachments objectAtIndex: count];
|
||||
event = [attachment event];
|
||||
if ([[event summary] length] == 0)
|
||||
[event setSummary: summary];
|
||||
[event setUid: uid];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) save: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
// iCalCalendar *vCalendar;
|
||||
// NSCalendarDate *now;
|
||||
NSString *uid, *nameInContainer;
|
||||
// iCalEvent *newEvent;
|
||||
// iCalPerson *userPerson;
|
||||
SOGoUser *activeUser;
|
||||
NSRange rangeOfDot;
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
uid = [self _uidFromGlobalObjectId: memCtx];
|
||||
if (uid)
|
||||
{
|
||||
/* Hack required because of what's explained in oxocal 3.1.4.7.1:
|
||||
basically, Outlook creates a copy of the event and then removes
|
||||
the old instance. We perform a trickery to avoid performing those
|
||||
operations in the backend, in a way that enables us to recover
|
||||
the initial instance and act solely on it. */
|
||||
[self _fixupAppointmentObjectWithUID: uid];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We create a UID from the nameInContainer, or the reverse if the
|
||||
latter is already set... */
|
||||
nameInContainer = [sogoObject nameInContainer];
|
||||
if (nameInContainer)
|
||||
{
|
||||
rangeOfDot = [nameInContainer rangeOfString: @"."
|
||||
options: NSBackwardsSearch];
|
||||
if (rangeOfDot.location == NSNotFound)
|
||||
uid = nameInContainer;
|
||||
else
|
||||
uid = [nameInContainer substringToIndex: rangeOfDot.location];
|
||||
}
|
||||
else
|
||||
{
|
||||
uid = [SOGoObject globallyUniqueObjectId];
|
||||
nameInContainer = [NSString stringWithFormat: @"%@.ics", uid];
|
||||
[sogoObject setNameInContainer: nameInContainer];
|
||||
}
|
||||
}
|
||||
[masterEvent setUid: uid];
|
||||
}
|
||||
|
||||
// [self logWithFormat: @"-save, event props:"];
|
||||
// MAPIStoreDumpMessageProperties (newProperties);
|
||||
|
||||
// now = [NSCalendarDate date];
|
||||
|
||||
activeUser = [[self context] activeUser];
|
||||
[masterEvent updateFromMAPIProperties: properties
|
||||
inUserContext: [self userContext]
|
||||
withActiveUser: activeUser
|
||||
isNew: isNew
|
||||
inMemCtx: memCtx];
|
||||
[self _updateAttachedEvents];
|
||||
[[self userContext] activate];
|
||||
[sogoObject updateContentWithCalendar: calendar
|
||||
fromRequest: nil];
|
||||
[self updateVersions];
|
||||
}
|
||||
|
||||
- (id) lookupAttachment: (NSString *) childKey
|
||||
{
|
||||
return [attachmentParts objectForKey: childKey];
|
||||
}
|
||||
|
||||
- (MAPIStoreAttachment *) createAttachment
|
||||
{
|
||||
MAPIStoreCalendarAttachment *newAttachment;
|
||||
uint32_t newAid;
|
||||
NSString *newKey;
|
||||
iCalEvent *newEvent;
|
||||
|
||||
newAid = [[self attachmentKeys] count];
|
||||
|
||||
newAttachment = [MAPIStoreCalendarAttachment
|
||||
mapiStoreObjectInContainer: self];
|
||||
[newAttachment setAID: newAid];
|
||||
newEvent = [iCalEvent groupWithTag: @"vevent"];
|
||||
[newAttachment setEvent: newEvent];
|
||||
[calendar addToEvents: newEvent];
|
||||
|
||||
newKey = [NSString stringWithFormat: @"%ul", newAid];
|
||||
[attachmentParts setObject: newAttachment
|
||||
forKey: newKey];
|
||||
[attachmentKeys release];
|
||||
attachmentKeys = nil;
|
||||
|
||||
return newAttachment;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) setReadFlag: (uint8_t) flag
|
||||
{
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,32 +0,0 @@
|
||||
/* MAPIStoreCalendarMessageTable.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTORECALENDARMESSAGETABLE_H
|
||||
#define MAPISTORECALENDARMESSAGETABLE_H
|
||||
|
||||
#import "MAPIStoreGCSMessageTable.h"
|
||||
|
||||
@interface MAPIStoreCalendarMessageTable : MAPIStoreGCSMessageTable
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTORECALENDARMESSAGETABLE_H */
|
||||
@@ -1,193 +0,0 @@
|
||||
/* MAPIStoreCalendarMessageTable.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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/NSNull.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <EOControl/EOQualifier.h>
|
||||
|
||||
#import <NGCards/iCalEvent.h>
|
||||
|
||||
#import "MAPIStoreCalendarMessage.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "NSDate+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreCalendarMessageTable.h"
|
||||
|
||||
#include <mapistore/mapistore_nameid.h>
|
||||
|
||||
static Class MAPIStoreCalendarMessageK = Nil;
|
||||
|
||||
@implementation MAPIStoreCalendarMessageTable
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
MAPIStoreCalendarMessageK = [MAPIStoreCalendarMessage class];
|
||||
}
|
||||
|
||||
+ (Class) childObjectClass
|
||||
{
|
||||
return MAPIStoreCalendarMessageK;
|
||||
}
|
||||
|
||||
- (EOQualifier *) _orgMailNotNullQualifier
|
||||
{
|
||||
static EOQualifier *orgMailQualifier = nil;
|
||||
EOQualifier *notNullQualifier, *nullQualifier, *notEmptyQualifier, *emptyQualifier;
|
||||
|
||||
if (!orgMailQualifier)
|
||||
{
|
||||
nullQualifier = [[EOKeyValueQualifier alloc]
|
||||
initWithKey: @"c_orgmail"
|
||||
operatorSelector: EOQualifierOperatorEqual
|
||||
value: [NSNull null]];
|
||||
notNullQualifier = [[EONotQualifier alloc]
|
||||
initWithQualifier: nullQualifier];
|
||||
emptyQualifier = [[EOKeyValueQualifier alloc]
|
||||
initWithKey: @"c_orgmail"
|
||||
operatorSelector: EOQualifierOperatorEqual
|
||||
value: @""];
|
||||
notEmptyQualifier = [[EONotQualifier alloc]
|
||||
initWithQualifier: emptyQualifier];
|
||||
orgMailQualifier = [[EOAndQualifier alloc]
|
||||
initWithQualifiers: notNullQualifier,
|
||||
notEmptyQualifier, nil];
|
||||
[nullQualifier release];
|
||||
[notNullQualifier release];
|
||||
[emptyQualifier release];
|
||||
[notEmptyQualifier release];
|
||||
}
|
||||
|
||||
return orgMailQualifier;
|
||||
}
|
||||
|
||||
- (MAPIRestrictionState) evaluatePropertyRestriction: (struct mapi_SPropertyRestriction *) res
|
||||
intoQualifier: (EOQualifier **) qualifier
|
||||
{
|
||||
MAPIRestrictionState rc;
|
||||
id value;
|
||||
NSMutableString *likeString;
|
||||
NSString *likePartString;
|
||||
EOAndQualifier *andQualifier, *stringQualifier;
|
||||
union {
|
||||
uint32_t longValue;
|
||||
char charValue[4];
|
||||
} apptIdValue;
|
||||
|
||||
value = NSObjectFromMAPISPropValue (&res->lpProp);
|
||||
switch ((uint32_t) res->ulPropTag)
|
||||
{
|
||||
case PR_MESSAGE_CLASS_UNICODE:
|
||||
if ([value isEqualToString: @"IPM.Appointment"])
|
||||
rc = MAPIRestrictionStateAlwaysTrue;
|
||||
else
|
||||
rc = MAPIRestrictionStateAlwaysFalse;
|
||||
break;
|
||||
case PR_OWNER_APPT_ID:
|
||||
// c_orgmail != NULL && c_orgmail != '' && c_uid like 'ab%89';
|
||||
apptIdValue.longValue = [value unsignedLongValue];
|
||||
likeString = [NSMutableString string];
|
||||
likePartString = [[NSString alloc]
|
||||
initWithBytes: apptIdValue.charValue
|
||||
length: 2
|
||||
encoding: NSISOLatin1StringEncoding];
|
||||
[likeString appendString: likePartString];
|
||||
[likePartString release];
|
||||
[likeString appendString: @"%%"];
|
||||
likePartString = [[NSString alloc]
|
||||
initWithBytes: apptIdValue.charValue + 2
|
||||
length: 2
|
||||
encoding: NSISOLatin1StringEncoding];
|
||||
[likeString appendString: likePartString];
|
||||
[likePartString release];
|
||||
stringQualifier = [[EOKeyValueQualifier alloc]
|
||||
initWithKey: @"c_uid"
|
||||
operatorSelector: EOQualifierOperatorLike
|
||||
value: likeString];
|
||||
andQualifier = [[EOAndQualifier alloc]
|
||||
initWithQualifiers: [self _orgMailNotNullQualifier],
|
||||
stringQualifier, nil];
|
||||
[andQualifier autorelease];
|
||||
[stringQualifier release];
|
||||
*qualifier = andQualifier;
|
||||
rc = MAPIRestrictionStateNeedsEval;
|
||||
break;
|
||||
case PidLidBusyStatus:
|
||||
rc = MAPIRestrictionStateAlwaysTrue; // should be based on c_isopaque
|
||||
break;
|
||||
default:
|
||||
rc = [super evaluatePropertyRestriction: res intoQualifier: qualifier];
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (NSString *) backendIdentifierForProperty: (enum MAPITAGS) property
|
||||
{
|
||||
static NSMutableDictionary *knownProperties = nil;
|
||||
|
||||
if (!knownProperties)
|
||||
{
|
||||
knownProperties = [NSMutableDictionary new];
|
||||
[knownProperties setObject: @"c_startdate"
|
||||
forKey: MAPIPropertyKey (PidLidAppointmentStartWhole)];
|
||||
[knownProperties setObject: @"c_enddate"
|
||||
forKey: MAPIPropertyKey (PidLidAppointmentEndWhole)];
|
||||
[knownProperties setObject: @"c_iscycle"
|
||||
forKey: MAPIPropertyKey (PidLidRecurring)];
|
||||
}
|
||||
|
||||
return [knownProperties objectForKey: MAPIPropertyKey (property)];
|
||||
}
|
||||
|
||||
/* sorting */
|
||||
|
||||
- (NSString *) sortIdentifierForProperty: (enum MAPITAGS) property
|
||||
{
|
||||
static NSMutableDictionary *knownProperties = nil;
|
||||
|
||||
if (!knownProperties)
|
||||
{
|
||||
knownProperties = [NSMutableDictionary new];
|
||||
[knownProperties setObject: @"c_startdate"
|
||||
forKey: MAPIPropertyKey (PidLidAppointmentStartWhole)];
|
||||
[knownProperties setObject: @"c_enddate"
|
||||
forKey: MAPIPropertyKey (PidLidAppointmentEndWhole)];
|
||||
[knownProperties setObject: @"c_iscycle"
|
||||
forKey: MAPIPropertyKey (PidLidRecurring)];
|
||||
[knownProperties setObject: @"c_isallday"
|
||||
forKey: MAPIPropertyKey (PidLidAppointmentSubType)];
|
||||
[knownProperties setObject: @"c_creationdate"
|
||||
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)];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,41 +0,0 @@
|
||||
/* MAPIStoreContactsAttachment.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTORECONTACTSATTACHMENT_H
|
||||
#define MAPISTORECONTACTSATTACHMENT_H
|
||||
|
||||
#import "MAPIStoreAttachment.h"
|
||||
|
||||
@class NSData;
|
||||
@class NGVCardPhoto;
|
||||
|
||||
@interface MAPIStoreContactsAttachment : MAPIStoreAttachment
|
||||
{
|
||||
NGVCardPhoto *photo;
|
||||
NSData *photoData;
|
||||
}
|
||||
|
||||
- (void) setPhoto: (NGVCardPhoto *) newPhoto;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTORECONTACTSATTACHMENT_H */
|
||||
@@ -1,197 +0,0 @@
|
||||
/* MAPIStoreContactsAttachment.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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/NSCalendarDate.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <NGExtensions/NGBase64Coding.h>
|
||||
#import <NGCards/NGVCardPhoto.h>
|
||||
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSDate+MAPIStore.h"
|
||||
#import "NSObject+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreContactsAttachment.h"
|
||||
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
|
||||
/* TODO: handle URL pictures via PidTagAttachMethod = ref ? */
|
||||
|
||||
@implementation MAPIStoreContactsAttachment
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
photo = nil;
|
||||
photoData = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[photo release];
|
||||
[photoData release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) setPhoto: (NGVCardPhoto *) newPhoto
|
||||
{
|
||||
ASSIGN (photo, newPhoto);
|
||||
}
|
||||
|
||||
- (NSString *) fileExtension
|
||||
{
|
||||
NSString *type, *extension;
|
||||
|
||||
type = [photo type];
|
||||
if ([type isEqualToString: @"JPEG"]
|
||||
|| [type isEqualToString: @"JPG"])
|
||||
extension = @".jpg";
|
||||
else if ([type isEqualToString: @"PNG"])
|
||||
extension = @".png";
|
||||
else if ([type isEqualToString: @"BMP"])
|
||||
extension = @".bmp";
|
||||
else if ([type isEqualToString: @"GIF"])
|
||||
extension = @".gif";
|
||||
else
|
||||
extension = nil;
|
||||
|
||||
return extension;
|
||||
}
|
||||
|
||||
- (NSDate *) creationTime
|
||||
{
|
||||
return [container creationTime];
|
||||
}
|
||||
|
||||
- (NSDate *) lastModificationTime
|
||||
{
|
||||
return [container lastModificationTime];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachEncoding: (void **) data inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
{
|
||||
*data = [[NSData data] asBinaryInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachFlags: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getLongZero: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachmentFlags: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getLongZero: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachmentHidden: (void **) data inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getNo: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachmentLinkId: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getLongZero: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachMethod: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = MAPILongValue (memCtx, 0x00000001);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachmentContactPhoto: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getYes: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachDataBinary: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
if (!photoData)
|
||||
ASSIGN (photoData,
|
||||
[[photo flattenedValuesForKey: @""] dataByDecodingBase64]);
|
||||
|
||||
*data = [photoData asBinaryInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachSize: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
if (!photoData)
|
||||
ASSIGN (photoData,
|
||||
[[photo flattenedValuesForKey: @""] dataByDecodingBase64]);
|
||||
|
||||
*data = MAPILongValue (memCtx, [photoData length]);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachExtension: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = [[self fileExtension] asUnicodeInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachLongFilename: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
NSString *filename;
|
||||
|
||||
filename = [NSString stringWithFormat: @"ContactPhoto%@",
|
||||
[self fileExtension]];
|
||||
|
||||
*data = [filename asUnicodeInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAttachFilename: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getPidTagAttachLongFilename: data
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagDisplayName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getPidTagAttachLongFilename: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,32 +0,0 @@
|
||||
/* MAPIStoreContactsContext.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc.
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTORECONTACTSCONTEXT_H
|
||||
#define MAPISTORECONTACTSCONTEXT_H
|
||||
|
||||
#import "MAPIStoreGCSBaseContext.h"
|
||||
|
||||
@interface MAPIStoreContactsContext : MAPIStoreGCSBaseContext
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTORECONTACTSCONTEXT_H */
|
||||
@@ -1,59 +0,0 @@
|
||||
/* MAPIStoreContactsContext.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc.
|
||||
*
|
||||
* 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
|
||||
* 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 <Contacts/SOGoContactFolders.h>
|
||||
|
||||
#import "MAPIStoreContactsFolder.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
|
||||
#import "MAPIStoreContactsContext.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
|
||||
static Class MAPIStoreContactsFolderK;
|
||||
|
||||
@implementation MAPIStoreContactsContext
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
MAPIStoreContactsFolderK = [MAPIStoreContactsFolder class];
|
||||
}
|
||||
|
||||
+ (NSString *) MAPIModuleName
|
||||
{
|
||||
return @"contacts";
|
||||
}
|
||||
|
||||
+ (enum mapistore_context_role) MAPIContextRole
|
||||
{
|
||||
return MAPISTORE_CONTACTS_ROLE;
|
||||
}
|
||||
|
||||
- (Class) MAPIStoreFolderClass
|
||||
{
|
||||
return MAPIStoreContactsFolderK;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,32 +0,0 @@
|
||||
/* MAPIStoreContactsFolder.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTORECONTACTSFOLDER_H
|
||||
#define MAPISTORECONTACTSFOLDER_H
|
||||
|
||||
#import "MAPIStoreGCSFolder.h"
|
||||
|
||||
@interface MAPIStoreContactsFolder : MAPIStoreGCSFolder
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTORECONTACTSFOLDER_H */
|
||||
@@ -1,157 +0,0 @@
|
||||
/* MAPIStoreContactsFolder.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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/NSURL.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <EOControl/EOQualifier.h>
|
||||
#import <SOGo/SOGoPermissions.h>
|
||||
#import <Contacts/SOGoContactGCSEntry.h>
|
||||
#import <Contacts/SOGoContactFolders.h>
|
||||
|
||||
#import "MAPIApplication.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import "MAPIStoreContactsContext.h"
|
||||
#import "MAPIStoreContactsMessage.h"
|
||||
#import "MAPIStoreContactsMessageTable.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreContactsFolder.h"
|
||||
|
||||
#include <util/time.h>
|
||||
#include <gen_ndr/exchange.h>
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
|
||||
@implementation MAPIStoreContactsFolder
|
||||
|
||||
- (MAPIStoreMessageTable *) messageTable
|
||||
{
|
||||
[self synchroniseCache];
|
||||
return [MAPIStoreContactsMessageTable tableForContainer: self];
|
||||
}
|
||||
|
||||
- (NSString *) component
|
||||
{
|
||||
return @"vcard";
|
||||
}
|
||||
|
||||
- (MAPIStoreMessage *) createMessage
|
||||
{
|
||||
MAPIStoreMessage *newMessage;
|
||||
SOGoContactGCSEntry *newEntry;
|
||||
NSString *name;
|
||||
|
||||
[[self userContext] activate];
|
||||
|
||||
name = [NSString stringWithFormat: @"%@.vcf",
|
||||
[SOGoObject globallyUniqueObjectId]];
|
||||
newEntry = [SOGoContactGCSEntry objectWithName: name
|
||||
inContainer: sogoObject];
|
||||
[newEntry setIsNew: YES];
|
||||
newMessage = [MAPIStoreContactsMessage mapiStoreObjectWithSOGoObject: newEntry
|
||||
inContainer: self];
|
||||
|
||||
return newMessage;
|
||||
}
|
||||
|
||||
- (NSArray *) rolesForExchangeRights: (uint32_t) rights
|
||||
{
|
||||
/* Limitations
|
||||
|
||||
Following rights are not supported by SOGo specifically:
|
||||
|
||||
- CreateSubfolders: No contacts subfolders
|
||||
- FolderVisible: It is inferred by other rights when extracting
|
||||
*/
|
||||
NSMutableArray *roles;
|
||||
|
||||
roles = [NSMutableArray arrayWithCapacity: 8];
|
||||
if (rights & RightsCreateItems)
|
||||
[roles addObject: SOGoRole_ObjectCreator];
|
||||
if (rights & RightsDeleteAll)
|
||||
[roles addObject: SOGoRole_ObjectEraser];
|
||||
if (rights & RightsDeleteOwn)
|
||||
[roles addObject: MAPIStoreRightDeleteOwn];
|
||||
if (rights & RightsEditAll)
|
||||
[roles addObject: SOGoRole_ObjectEditor];
|
||||
if (rights & RightsEditOwn)
|
||||
[roles addObject: MAPIStoreRightEditOwn];
|
||||
if (rights & RightsReadItems)
|
||||
[roles addObject: SOGoRole_ObjectViewer];
|
||||
|
||||
if (rights & RightsFolderOwner)
|
||||
[roles addObject: MAPIStoreRightFolderOwner];
|
||||
if (rights & RightsFolderContact)
|
||||
[roles addObject: MAPIStoreRightFolderContact];
|
||||
|
||||
return roles;
|
||||
}
|
||||
|
||||
- (uint32_t) exchangeRightsForRoles: (NSArray *) roles
|
||||
{
|
||||
uint32_t rights = 0;
|
||||
|
||||
if ([roles containsObject: SOGoRole_ObjectCreator])
|
||||
rights |= RightsCreateItems;
|
||||
|
||||
if ([roles containsObject: SOGoRole_ObjectEraser])
|
||||
rights |= RightsDeleteAll | RightsDeleteOwn;
|
||||
else if ([roles containsObject: MAPIStoreRightDeleteOwn])
|
||||
rights |= RightsDeleteOwn;
|
||||
|
||||
if ([roles containsObject: SOGoRole_ObjectEditor])
|
||||
rights |= RightsEditAll | RightsEditOwn;
|
||||
else if ([roles containsObject: MAPIStoreRightEditOwn])
|
||||
rights |= RightsEditOwn;
|
||||
|
||||
if ([roles containsObject: SOGoRole_ObjectViewer])
|
||||
rights |= RightsReadItems;
|
||||
if (rights != 0)
|
||||
rights |= RoleNone; /* actually "folder visible" */
|
||||
|
||||
if ([roles containsObject: MAPIStoreRightFolderOwner])
|
||||
rights |= RightsFolderOwner | RoleNone;
|
||||
|
||||
if ([roles containsObject: MAPIStoreRightFolderContact])
|
||||
rights |= RightsFolderContact;
|
||||
|
||||
return rights;
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanModifyMessages
|
||||
{
|
||||
return [[self activeUserRoles] containsObject: SOGoRole_ObjectEditor];
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanReadMessages
|
||||
{
|
||||
return [[self activeUserRoles] containsObject: SOGoRole_ObjectViewer];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagDefaultPostMessageClass: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = [@"IPM.Contact" asUnicodeInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,35 +0,0 @@
|
||||
/* MAPIStoreContactsMessage.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTORECONTACTSMESSAGE_H
|
||||
#define MAPISTORECONTACTSMESSAGE_H
|
||||
|
||||
#import "MAPIStoreGCSMessage.h"
|
||||
|
||||
@interface MAPIStoreContactsMessage : MAPIStoreGCSMessage
|
||||
{
|
||||
BOOL fetchedAttachments;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTORECONTACTSMESSAGE_H */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,31 +0,0 @@
|
||||
/* MAPIStoreContactsMessageTable.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTORECONTACTSMESSAGETABLE_H
|
||||
#define MAPISTORECONTACTSMESSAGETABLE_H
|
||||
|
||||
#import "MAPIStoreGCSMessageTable.h"
|
||||
|
||||
@interface MAPIStoreContactsMessageTable : MAPIStoreGCSMessageTable
|
||||
@end
|
||||
|
||||
#endif /* MAPISTORECONTACTSMESSAGETABLE_H */
|
||||
@@ -1,231 +0,0 @@
|
||||
/* MAPIStoreContactsMessageTable.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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/NSData.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSException.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <EOControl/EOQualifier.h>
|
||||
#import <NGMail/NGMailAddress.h>
|
||||
#import <NGMail/NGMailAddressParser.h>
|
||||
#import <NGCards/NSArray+NGCards.h>
|
||||
#import <NGCards/NGVCard.h>
|
||||
|
||||
#import <Contacts/SOGoContactGCSEntry.h>
|
||||
|
||||
#import "MAPIStoreContactsMessage.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "NSDate+MAPIStore.h"
|
||||
#import "NSArray+MAPIStore.h"
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreContactsMessageTable.h"
|
||||
|
||||
#include <mapistore/mapistore_nameid.h>
|
||||
|
||||
static Class MAPIStoreContactsMessageK, NGMailAddressK, NSDataK, NSStringK;
|
||||
|
||||
@implementation MAPIStoreContactsMessageTable
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
MAPIStoreContactsMessageK = [MAPIStoreContactsMessage class];
|
||||
NSDataK = [NSData class];
|
||||
NSStringK = [NSString class];
|
||||
NGMailAddressK = [NGMailAddress class];
|
||||
}
|
||||
|
||||
+ (Class) childObjectClass
|
||||
{
|
||||
return MAPIStoreContactsMessageK;
|
||||
}
|
||||
|
||||
- (NSString *) backendIdentifierForProperty: (enum MAPITAGS) property
|
||||
{
|
||||
static NSMutableDictionary *knownProperties = nil;
|
||||
|
||||
if (!knownProperties)
|
||||
{
|
||||
knownProperties = [NSMutableDictionary new];
|
||||
[knownProperties setObject: @"c_mail"
|
||||
forKey: MAPIPropertyKey (PidLidEmail1EmailAddress)];
|
||||
[knownProperties setObject: @"c_mail"
|
||||
forKey: MAPIPropertyKey (PidLidEmail2EmailAddress)];
|
||||
[knownProperties setObject: @"c_mail"
|
||||
forKey: MAPIPropertyKey (PidLidEmail3EmailAddress)];
|
||||
[knownProperties setObject: @"c_cn"
|
||||
forKey: MAPIPropertyKey (PidLidFileUnder)];
|
||||
[knownProperties setObject: @"c_cn"
|
||||
forKey: MAPIPropertyKey (PidTagDisplayName)];
|
||||
[knownProperties setObject: @"c_cn"
|
||||
forKey: MAPIPropertyKey (PidTagSubject)];
|
||||
}
|
||||
|
||||
return [knownProperties objectForKey: MAPIPropertyKey (property)];
|
||||
}
|
||||
|
||||
/* restrictions */
|
||||
|
||||
- (MAPIRestrictionState) evaluatePropertyRestriction: (struct mapi_SPropertyRestriction *) res
|
||||
intoQualifier: (EOQualifier **) qualifier
|
||||
{
|
||||
MAPIRestrictionState rc;
|
||||
EOAndQualifier *andQualifier;
|
||||
EOKeyValueQualifier *fullNameQualifier, *emailQualifier;
|
||||
NSString *fullName, *email;
|
||||
SEL operator;
|
||||
id value, ngAddress;
|
||||
|
||||
value = NSObjectFromMAPISPropValue (&res->lpProp);
|
||||
switch ((uint32_t) res->ulPropTag)
|
||||
{
|
||||
case PR_MESSAGE_CLASS_UNICODE:
|
||||
if ([value isEqualToString: @"IPM.Contact"])
|
||||
rc = MAPIRestrictionStateAlwaysTrue;
|
||||
else
|
||||
rc = MAPIRestrictionStateAlwaysFalse;
|
||||
break;
|
||||
|
||||
case PR_SENSITIVITY:
|
||||
rc = MAPIRestrictionStateAlwaysTrue;
|
||||
break;
|
||||
case PidLidAddressBookProviderArrayType:
|
||||
case PidLidAddressBookProviderEmailList:
|
||||
/* FIXME: this is a hack. We should return a real qualifier here */
|
||||
rc = MAPIRestrictionStateAlwaysTrue;
|
||||
break;
|
||||
|
||||
case PidLidEmail1OriginalDisplayName:
|
||||
case PidLidEmail2OriginalDisplayName:
|
||||
case PidLidEmail3OriginalDisplayName:
|
||||
rc = MAPIRestrictionStateAlwaysFalse;
|
||||
value = NSObjectFromMAPISPropValue (&res->lpProp);
|
||||
if (value && [value isKindOfClass: NSStringK])
|
||||
{
|
||||
rc = MAPIRestrictionStateNeedsEval;
|
||||
ngAddress = [[NGMailAddressParser mailAddressParserWithString: value]
|
||||
parse];
|
||||
if ([ngAddress isKindOfClass: NGMailAddressK])
|
||||
{
|
||||
operator = [self operatorFromRestrictionOperator: res->relop];
|
||||
fullName = [ngAddress displayName];
|
||||
email = [ngAddress address];
|
||||
emailQualifier = [[EOKeyValueQualifier alloc]
|
||||
initWithKey: @"c_mail"
|
||||
operatorSelector: operator
|
||||
value: email];
|
||||
if ([fullName length] > 0)
|
||||
{
|
||||
fullNameQualifier = [[EOKeyValueQualifier alloc]
|
||||
initWithKey: @"c_cn"
|
||||
operatorSelector: operator
|
||||
value: fullName];
|
||||
andQualifier = [[EOAndQualifier alloc]
|
||||
initWithQualifiers:
|
||||
emailQualifier, fullNameQualifier, nil];
|
||||
[fullNameQualifier release];
|
||||
[emailQualifier release];
|
||||
*qualifier = andQualifier;
|
||||
}
|
||||
else
|
||||
*qualifier = emailQualifier;
|
||||
[*qualifier autorelease];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PidLidEmail1AddressType:
|
||||
case PidLidEmail2AddressType:
|
||||
case PidLidEmail3AddressType:
|
||||
if ([value isEqualToString: @"SMTP"])
|
||||
rc = MAPIRestrictionStateAlwaysTrue;
|
||||
else
|
||||
rc = MAPIRestrictionStateAlwaysFalse;
|
||||
break;
|
||||
|
||||
default:
|
||||
rc = [super evaluatePropertyRestriction: res intoQualifier: qualifier];
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (MAPIRestrictionState) evaluateContentRestriction: (struct mapi_SContentRestriction *) res
|
||||
intoQualifier: (EOQualifier **) qualifier
|
||||
{
|
||||
MAPIRestrictionState rc;
|
||||
id value;
|
||||
|
||||
value = NSObjectFromMAPISPropValue (&res->lpProp);
|
||||
if ([value isKindOfClass: NSDataK])
|
||||
{
|
||||
value = [[NSString alloc] initWithData: value
|
||||
encoding: NSUTF8StringEncoding];
|
||||
[value autorelease];
|
||||
}
|
||||
else if (![value isKindOfClass: NSStringK])
|
||||
[NSException raise: @"MAPIStoreTypeConversionException"
|
||||
format: @"unhandled content restriction for class '%@'",
|
||||
NSStringFromClass ([value class])];
|
||||
|
||||
switch (res->ulPropTag)
|
||||
{
|
||||
case PR_MESSAGE_CLASS_UNICODE: /* FIXME: should make use of c_component here */
|
||||
if ([value isEqualToString: @"IPM.Contact"])
|
||||
rc = MAPIRestrictionStateAlwaysTrue;
|
||||
else
|
||||
rc = MAPIRestrictionStateAlwaysFalse;
|
||||
break;
|
||||
default:
|
||||
rc = [super evaluateContentRestriction: res intoQualifier: qualifier];
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* sorting */
|
||||
|
||||
- (NSString *) sortIdentifierForProperty: (enum MAPITAGS) property
|
||||
{
|
||||
static NSMutableDictionary *knownProperties = nil;
|
||||
|
||||
if (!knownProperties)
|
||||
{
|
||||
knownProperties = [NSMutableDictionary new];
|
||||
[knownProperties setObject: @"c_cn"
|
||||
forKey: MAPIPropertyKey (PidLidFileUnder)];
|
||||
[knownProperties setObject: @"c_cn"
|
||||
forKey: MAPIPropertyKey (PidTagDisplayName)];
|
||||
[knownProperties setObject: @"c_cn"
|
||||
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)];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,125 +0,0 @@
|
||||
/* MAPIStoreContext.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc.
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTORECONTEXT_H
|
||||
#define MAPISTORECONTEXT_H
|
||||
|
||||
#include <talloc.h>
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class NSArray;
|
||||
@class NSFileHandle;
|
||||
@class NSMutableArray;
|
||||
@class NSMutableDictionary;
|
||||
@class NSString;
|
||||
@class NSURL;
|
||||
|
||||
@class EOQualifier;
|
||||
|
||||
@class WOContext;
|
||||
|
||||
@class SOGoFolder;
|
||||
@class SOGoMAPIFSFolder;
|
||||
@class SOGoObject;
|
||||
@class SOGoUser;
|
||||
|
||||
@class MAPIStoreAuthenticator;
|
||||
@class MAPIStoreAttachment;
|
||||
@class MAPIStoreAttachmentTable;
|
||||
@class MAPIStoreFolder;
|
||||
@class MAPIStoreMessage;
|
||||
@class MAPIStoreTable;
|
||||
@class MAPIStoreUserContext;
|
||||
|
||||
@interface MAPIStoreContext : NSObject
|
||||
{
|
||||
struct mapistore_connection_info *connInfo;
|
||||
NSMutableArray *containersBag;
|
||||
SOGoUser *activeUser; /* the user accessing the resource */
|
||||
MAPIStoreUserContext *userContext; /* the owner or the resource */
|
||||
NSURL *contextUrl;
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listAllContextsForUser: (NSString *) userName
|
||||
withIndexing: (struct indexing_context *) indexing
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||
withIndexing: (struct indexing_context *) indexing
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
+ (enum mapistore_error) createRootFolder: (NSString **) mapistoreUriP
|
||||
withFID: (uint64_t ) fid
|
||||
andName: (NSString *) folderName
|
||||
forUser: (NSString *) username
|
||||
withRole: (enum mapistore_context_role) role;
|
||||
|
||||
+ (enum mapistore_error) openContext: (MAPIStoreContext **) contextPtr
|
||||
withURI: (const char *) newUri
|
||||
connectionInfo: (struct mapistore_connection_info *) newConnInfo
|
||||
andTDBIndexing: (struct indexing_context *) indexing;
|
||||
|
||||
- (id) initFromURL: (NSURL *) newUri
|
||||
withConnectionInfo: (struct mapistore_connection_info *) newConnInfo
|
||||
andTDBIndexing: (struct indexing_context *) indexing;
|
||||
|
||||
- (NSURL *) url;
|
||||
- (struct mapistore_connection_info *) connectionInfo;
|
||||
|
||||
- (MAPIStoreUserContext *) userContext;
|
||||
|
||||
- (SOGoUser *) activeUser;
|
||||
|
||||
// - (id) lookupObject: (NSString *) objectURLString;
|
||||
|
||||
/* backend methods */
|
||||
- (enum mapistore_error) getPath: (char **) path
|
||||
ofFMID: (uint64_t) fmid
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) getRootFolder: (MAPIStoreFolder **) folderPtr
|
||||
withFID: (uint64_t) fmid;
|
||||
|
||||
/* util methods */
|
||||
- (NSString *) extractChildNameFromURL: (NSString *) childURL
|
||||
andFolderURLAt: (NSString **) folderURL;
|
||||
|
||||
- (uint64_t) idForObjectWithKey: (NSString *) key
|
||||
inFolderURL: (NSString *) folderURL;
|
||||
- (NSArray *) getNewFMIDs: (uint64_t) max;
|
||||
- (uint64_t) getNewChangeNumber;
|
||||
- (NSArray *) getNewChangeNumbers: (uint64_t) max;
|
||||
|
||||
/* subclass methods */
|
||||
+ (NSString *) MAPIModuleName;
|
||||
+ (enum mapistore_context_role) MAPIContextRole;
|
||||
+ (NSString *)
|
||||
createRootSecondaryFolderWithFID: (uint64_t) fid
|
||||
andName: (NSString *) folderName
|
||||
forUser: (NSString *) userName;
|
||||
- (Class) MAPIStoreFolderClass;
|
||||
|
||||
/* the top-most parent of the context folder: SOGoMailAccount,
|
||||
SOGoCalendarFolders, ... */
|
||||
- (id) rootSOGoFolder;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTORECONTEXT_H */
|
||||
@@ -1,644 +0,0 @@
|
||||
/* MAPIStoreContext.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc.
|
||||
*
|
||||
* 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
|
||||
* 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/NSException.h>
|
||||
#import <Foundation/NSNull.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <NGExtensions/NSObject+Values.h>
|
||||
|
||||
#import <SOGo/SOGoFolder.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
|
||||
#import "MAPIStoreAttachment.h"
|
||||
#import "MAPIStoreFallbackContext.h"
|
||||
#import "MAPIStoreFolder.h"
|
||||
#import "MAPIStoreFolderTable.h"
|
||||
#import "MAPIStoreMapping.h"
|
||||
#import "MAPIStoreMessage.h"
|
||||
#import "MAPIStoreMessageTable.h"
|
||||
#import "MAPIStoreFAIMessage.h"
|
||||
#import "MAPIStoreFAIMessageTable.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import "NSArray+MAPIStore.h"
|
||||
#import "NSObject+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreContext.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <dlinklist.h>
|
||||
#include <stdbool.h>
|
||||
#include <gen_ndr/exchange.h>
|
||||
#include <util/attr.h>
|
||||
#include <libmapiproxy.h>
|
||||
#include <mapistore/mapistore.h>
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
#include <mapistore/mapistore_nameid.h>
|
||||
#include <talloc.h>
|
||||
|
||||
/* TODO: homogenize method names and order of parameters */
|
||||
|
||||
@implementation MAPIStoreContext : NSObject
|
||||
|
||||
/* sogo://username:password@{contacts,calendar,tasks,journal,notes,mail}/dossier/id */
|
||||
|
||||
static Class NSExceptionK, MAPIStoreFallbackContextK, SOGoObjectK;
|
||||
|
||||
static NSMutableDictionary *contextClassMapping;
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
NSArray *classes;
|
||||
Class currentClass;
|
||||
NSUInteger count, max;
|
||||
NSString *moduleName;
|
||||
|
||||
NSExceptionK = [NSException class];
|
||||
SOGoObjectK = [SOGoObject class];
|
||||
|
||||
contextClassMapping = [NSMutableDictionary new];
|
||||
classes = GSObjCAllSubclassesOfClass (self);
|
||||
max = [classes count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
currentClass = [classes objectAtIndex: count];
|
||||
moduleName = [currentClass MAPIModuleName];
|
||||
if (moduleName)
|
||||
{
|
||||
[contextClassMapping setObject: currentClass
|
||||
forKey: 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
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
struct mapistore_contexts_list *list, *current;
|
||||
NSArray *classes;
|
||||
Class currentClass;
|
||||
NSUInteger count, max;
|
||||
|
||||
list = NULL;
|
||||
|
||||
// User context is activated on initialization
|
||||
[MAPIStoreUserContext userContextWithUsername: userName
|
||||
andTDBIndexing: indexing];
|
||||
|
||||
classes = GSObjCAllSubclassesOfClass (self);
|
||||
max = [classes count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
currentClass = [classes objectAtIndex: count];
|
||||
current = [currentClass listContextsForUser: userName
|
||||
withIndexing: indexing
|
||||
inMemCtx: memCtx];
|
||||
if (current)
|
||||
DLIST_CONCATENATE(list, current, void);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||
withIndexing: (struct indexing_context *) indexing
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Class
|
||||
MAPIStoreLookupContextClassByRole (Class self, enum mapistore_context_role role)
|
||||
{
|
||||
static NSMutableDictionary *classMapping = nil;
|
||||
Class currentClass;
|
||||
enum mapistore_context_role classRole;
|
||||
NSNumber *roleNbr;
|
||||
NSArray *classes;
|
||||
NSUInteger count, max;
|
||||
|
||||
if (!classMapping)
|
||||
{
|
||||
classMapping = [NSMutableDictionary new];
|
||||
classes = GSObjCAllSubclassesOfClass (self);
|
||||
max = [classes count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
currentClass = [classes objectAtIndex: count];
|
||||
classRole = [currentClass MAPIContextRole];
|
||||
if (classRole != -1)
|
||||
{
|
||||
roleNbr = [NSNumber numberWithUnsignedInt: classRole];
|
||||
[classMapping setObject: currentClass
|
||||
forKey: roleNbr];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
roleNbr = [NSNumber numberWithUnsignedInt: role];
|
||||
|
||||
return [classMapping objectForKey: roleNbr];
|
||||
}
|
||||
|
||||
+ (enum mapistore_error) createRootFolder: (NSString **) mapistoreUriP
|
||||
withFID: (uint64_t) fid
|
||||
andName: (NSString *) folderName
|
||||
forUser: (NSString *) userName
|
||||
withRole: (enum mapistore_context_role) role
|
||||
{
|
||||
Class contextClass;
|
||||
NSString *mapistoreURI;
|
||||
enum mapistore_error rc = MAPISTORE_SUCCESS;
|
||||
|
||||
contextClass = MAPIStoreLookupContextClassByRole (self, role);
|
||||
if (!contextClass)
|
||||
contextClass = MAPIStoreFallbackContextK;
|
||||
|
||||
mapistoreURI = [contextClass createRootSecondaryFolderWithFID: fid
|
||||
andName: folderName
|
||||
forUser: userName];
|
||||
if (!mapistoreURI && contextClass != MAPIStoreFallbackContextK)
|
||||
mapistoreURI = [MAPIStoreFallbackContextK createRootSecondaryFolderWithFID: fid
|
||||
andName: folderName
|
||||
forUser: userName];
|
||||
if (mapistoreURI)
|
||||
*mapistoreUriP = mapistoreURI;
|
||||
else
|
||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||
{
|
||||
NSString *urlString;
|
||||
NSURL *completeURL;
|
||||
|
||||
urlString = [NSString stringWithFormat: @"sogo://%@",
|
||||
[NSString stringWithUTF8String: uri]];
|
||||
if (![urlString hasSuffix: @"/"])
|
||||
urlString = [urlString stringByAppendingString: @"/"];
|
||||
completeURL = [NSURL URLWithString: urlString];
|
||||
|
||||
return completeURL;
|
||||
}
|
||||
|
||||
+ (enum mapistore_error) openContext: (MAPIStoreContext **) contextPtr
|
||||
withURI: (const char *) newUri
|
||||
connectionInfo: (struct mapistore_connection_info *) newConnInfo
|
||||
andTDBIndexing: (struct indexing_context *) indexing
|
||||
{
|
||||
MAPIStoreContext *context;
|
||||
Class contextClass;
|
||||
NSString *module;
|
||||
NSURL *baseURL;
|
||||
enum mapistore_error rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
|
||||
context = nil;
|
||||
|
||||
baseURL = CompleteURLFromMapistoreURI (newUri);
|
||||
if (baseURL)
|
||||
{
|
||||
module = [baseURL host];
|
||||
if (module)
|
||||
{
|
||||
contextClass = [contextClassMapping objectForKey: module];
|
||||
if (contextClass)
|
||||
{
|
||||
context = [[contextClass alloc] initFromURL: baseURL
|
||||
withConnectionInfo: newConnInfo
|
||||
andTDBIndexing: indexing];
|
||||
if (context)
|
||||
{
|
||||
[context autorelease];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
*contextPtr = context;
|
||||
}
|
||||
}
|
||||
else
|
||||
NSLog (@"ERROR: unrecognized module name '%@'", module);
|
||||
}
|
||||
}
|
||||
else
|
||||
NSLog (@"ERROR: url could not be parsed");
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
activeUser = nil;
|
||||
userContext = nil;
|
||||
contextUrl = nil;
|
||||
containersBag = [NSMutableArray new];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initFromURL: (NSURL *) newUrl
|
||||
withConnectionInfo: (struct mapistore_connection_info *) newConnInfo
|
||||
andTDBIndexing: (struct indexing_context *) indexing
|
||||
{
|
||||
NSString *username;
|
||||
|
||||
if (newConnInfo == NULL)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
if ((self = [self init]))
|
||||
{
|
||||
ASSIGN (contextUrl, newUrl);
|
||||
|
||||
username = [newUrl user];
|
||||
if ([username length] == 0)
|
||||
{
|
||||
[self errorWithFormat:
|
||||
@"attempt to instantiate a context with an empty owner"];
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
|
||||
ASSIGN (userContext,
|
||||
[MAPIStoreUserContext userContextWithUsername: username
|
||||
andTDBIndexing: indexing]);
|
||||
connInfo = newConnInfo;
|
||||
username = [NSString stringWithUTF8String: newConnInfo->username];
|
||||
ASSIGN (activeUser, [SOGoUser userWithLogin: username]);
|
||||
if (!activeUser)
|
||||
{
|
||||
[self errorWithFormat: @"user '%@' not found in SOGo environment",
|
||||
username];
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[contextUrl release];
|
||||
[userContext release];
|
||||
[containersBag release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (MAPIStoreUserContext *) userContext
|
||||
{
|
||||
return userContext;
|
||||
}
|
||||
|
||||
- (NSURL *) url
|
||||
{
|
||||
return contextUrl;
|
||||
}
|
||||
|
||||
- (struct mapistore_connection_info *) connectionInfo
|
||||
{
|
||||
return connInfo;
|
||||
}
|
||||
|
||||
- (SOGoUser *) activeUser
|
||||
{
|
||||
return activeUser;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPath: (char **) path
|
||||
ofFMID: (uint64_t) fmid
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
enum mapistore_error rc;
|
||||
NSString *objectURL, *url;
|
||||
|
||||
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)
|
||||
{
|
||||
if ([objectURL hasPrefix: url])
|
||||
{
|
||||
*path = [[objectURL substringFromIndex: 7] asUnicodeInMemCtx: memCtx];
|
||||
[self logWithFormat: @"found path '%s' for fmid 0x%.16"PRIx64"", *path, fmid];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
[self logWithFormat: @"context (%@, %@) does not contain "
|
||||
@"found fmid: 0x%.16"PRIx64"", objectURL, url, fmid];
|
||||
*path = NULL;
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[self errorWithFormat: @"%s: you should *never* get here", __PRETTY_FUNCTION__];
|
||||
*path = NULL;
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (void) ensureContextFolder
|
||||
{
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getRootFolder: (MAPIStoreFolder **) folderPtr
|
||||
withFID: (uint64_t) newFid
|
||||
{
|
||||
enum mapistore_error rc;
|
||||
MAPIStoreFolder *baseFolder;
|
||||
SOGoFolder *currentFolder;
|
||||
WOContext *woContext;
|
||||
NSString *path;
|
||||
NSArray *pathComponents;
|
||||
NSUInteger count, max;
|
||||
|
||||
[userContext activate];
|
||||
woContext = [userContext woContext];
|
||||
|
||||
[self ensureContextFolder];
|
||||
currentFolder = [self rootSOGoFolder];
|
||||
[containersBag addObject: currentFolder];
|
||||
|
||||
/* HACK:
|
||||
-[NSURL path] returns unescaped strings in theory. In pratice, sometimes
|
||||
it does, sometimes not. Therefore we use the result of our own
|
||||
implementation of -[NSString
|
||||
stringByReplacingPercentEscapeUsingEncoding:], which returns nil if the
|
||||
original string contains non-ascii chars, from which we can determine
|
||||
whether the path was unescaped or not. */
|
||||
path = [[contextUrl path]
|
||||
stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
||||
if (!path)
|
||||
path = [contextUrl path];
|
||||
|
||||
if ([path hasPrefix: @"/"])
|
||||
path = [path substringFromIndex: 1];
|
||||
if ([path hasSuffix: @"/"])
|
||||
path = [path substringToIndex: [path length] - 1];
|
||||
if ([path length] > 0)
|
||||
{
|
||||
pathComponents = [path componentsSeparatedByString: @"/"];
|
||||
max = [pathComponents count];
|
||||
for (count = 0; currentFolder && count < max; count++)
|
||||
{
|
||||
[woContext setClientObject: currentFolder];
|
||||
currentFolder = [currentFolder
|
||||
lookupName: [pathComponents objectAtIndex: count]
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
if ([currentFolder isKindOfClass: SOGoObjectK]) /* class common to all
|
||||
SOGo folder types */
|
||||
[containersBag addObject: currentFolder];
|
||||
else
|
||||
currentFolder = nil;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentFolder)
|
||||
{
|
||||
baseFolder = [[self MAPIStoreFolderClass]
|
||||
mapiStoreObjectWithSOGoObject: currentFolder
|
||||
inContainer: nil];
|
||||
[baseFolder setContext: self];
|
||||
|
||||
if ([[userContext sogoUser] isEqual: activeUser]
|
||||
|| [baseFolder subscriberCanReadMessages])
|
||||
{
|
||||
*folderPtr = baseFolder;
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
else
|
||||
rc = MAPISTORE_ERR_DENIED;
|
||||
|
||||
}
|
||||
else if ([[userContext sogoUser] isEqual: activeUser])
|
||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
else
|
||||
rc = MAPISTORE_ERR_DENIED;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* utils */
|
||||
|
||||
- (NSString *) extractChildNameFromURL: (NSString *) objectURL
|
||||
andFolderURLAt: (NSString **) folderURL;
|
||||
{
|
||||
NSString *childKey;
|
||||
NSRange lastSlash;
|
||||
NSUInteger slashPtr;
|
||||
|
||||
if ([objectURL hasSuffix: @"/"])
|
||||
objectURL = [objectURL substringToIndex: [objectURL length] - 2];
|
||||
lastSlash = [objectURL rangeOfString: @"/"
|
||||
options: NSBackwardsSearch];
|
||||
if (lastSlash.location != NSNotFound)
|
||||
{
|
||||
slashPtr = NSMaxRange (lastSlash);
|
||||
childKey = [objectURL substringFromIndex: slashPtr];
|
||||
if ([childKey length] == 0)
|
||||
childKey = nil;
|
||||
if (folderURL)
|
||||
*folderURL = [objectURL substringToIndex: slashPtr];
|
||||
}
|
||||
else
|
||||
childKey = nil;
|
||||
|
||||
return childKey;
|
||||
}
|
||||
|
||||
- (uint64_t) idForObjectWithKey: (NSString *) key
|
||||
inFolderURL: (NSString *) folderURL
|
||||
{
|
||||
NSString *childURL;
|
||||
MAPIStoreMapping *mapping;
|
||||
uint64_t mappingId;
|
||||
enum mapistore_error ret;
|
||||
|
||||
if (key)
|
||||
childURL = [NSString stringWithFormat: @"%@%@", folderURL,
|
||||
[key stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
|
||||
else
|
||||
childURL = folderURL;
|
||||
mapping = [userContext mapping];
|
||||
mappingId = [mapping idFromURL: childURL];
|
||||
if (mappingId == NSNotFound)
|
||||
{
|
||||
const char *owner;
|
||||
|
||||
[self logWithFormat: @"No id exist yet for '%@', requesting one", childURL];
|
||||
owner = [[userContext username] UTF8String];
|
||||
ret = mapistore_indexing_get_new_folderID_as_user (connInfo->mstore_ctx, owner, &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;
|
||||
}
|
||||
|
||||
/* Get new change number from openchange db interface using
|
||||
resource's owner user */
|
||||
- (uint64_t) getNewChangeNumber
|
||||
{
|
||||
const char *owner;
|
||||
enum MAPISTATUS retval;
|
||||
uint64_t newVersionNumber;
|
||||
|
||||
owner = [[userContext username] UTF8String];
|
||||
retval = openchangedb_get_new_changeNumber (connInfo->oc_ctx, owner, &newVersionNumber);
|
||||
if (retval != MAPI_E_SUCCESS)
|
||||
[NSException raise: @"MAPIStoreIOException"
|
||||
format: @"Impossible to get new change number for %s: %s", owner,
|
||||
mapi_get_errstr (retval)];
|
||||
|
||||
return newVersionNumber;
|
||||
}
|
||||
|
||||
/* Get new change numbers from openchange db interface using
|
||||
resource's owner user */
|
||||
- (NSArray *) getNewChangeNumbers: (uint64_t) max
|
||||
{
|
||||
const char *owner;
|
||||
enum MAPISTATUS retval;
|
||||
TALLOC_CTX *memCtx;
|
||||
NSMutableArray *newChangeNumbers;
|
||||
uint64_t count;
|
||||
struct UI8Array_r *numbers;
|
||||
NSString *newNumber;
|
||||
|
||||
memCtx = talloc_new (NULL);
|
||||
if (!memCtx)
|
||||
[NSException raise: @"MAPIStoreIOException"
|
||||
format: @"Not enough memory to allocate change numbers"];
|
||||
|
||||
newChangeNumbers = [NSMutableArray arrayWithCapacity: max];
|
||||
owner = [[userContext username] UTF8String];
|
||||
|
||||
retval = openchangedb_get_new_changeNumbers (connInfo->oc_ctx, memCtx, owner, max, &numbers);
|
||||
if (retval != MAPI_E_SUCCESS || numbers->cValues != max)
|
||||
{
|
||||
talloc_free (memCtx);
|
||||
[NSException raise: @"MAPIStoreIOException"
|
||||
format: @"Failing to get %d new change numbers: %s", max,
|
||||
mapi_get_errstr (retval)];
|
||||
}
|
||||
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
newNumber = [NSString stringWithUnsignedLongLong: numbers->lpui8[count]];
|
||||
[newChangeNumbers addObject: newNumber];
|
||||
}
|
||||
|
||||
talloc_free (memCtx);
|
||||
|
||||
return newChangeNumbers;
|
||||
}
|
||||
|
||||
/* Get new fmids from mapistore_indexing interface using resource's
|
||||
owner user */
|
||||
- (NSArray *) getNewFMIDs: (uint64_t) max
|
||||
{
|
||||
const char *owner;
|
||||
enum mapistore_error ret;
|
||||
NSMutableArray *newFMIDs;
|
||||
NSString *newNumber;
|
||||
uint64_t count, newFID;
|
||||
|
||||
newFMIDs = [NSMutableArray arrayWithCapacity: max];
|
||||
/* Get the resource's owner name */
|
||||
owner = [[userContext username] UTF8String];
|
||||
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
ret = mapistore_indexing_get_new_folderID_as_user (connInfo->mstore_ctx, owner, &newFID);
|
||||
if (ret != MAPISTORE_SUCCESS)
|
||||
[NSException raise: @"MAPIStoreIOException"
|
||||
format: @"Impossible to get new fmid for %s", owner];
|
||||
|
||||
newNumber = [NSString stringWithUnsignedLongLong: newFID];
|
||||
[newFMIDs addObject: newNumber];
|
||||
}
|
||||
|
||||
return newFMIDs;
|
||||
}
|
||||
|
||||
/* subclasses */
|
||||
|
||||
+ (NSString *) MAPIModuleName
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (enum mapistore_context_role) MAPIContextRole
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ (NSString *)
|
||||
createRootSecondaryFolderWithFID: (uint64_t) fid
|
||||
andName: (NSString *) folderName
|
||||
forUser: (NSString *) userName
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (Class) MAPIStoreFolderClass
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) rootSOGoFolder
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,32 +0,0 @@
|
||||
/* MAPIStoreDBBaseContext.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2012 Inverse inc.
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREDBBASECONTEXT_H
|
||||
#define MAPISTOREDBBASECONTEXT_H
|
||||
|
||||
#import "MAPIStoreContext.h"
|
||||
|
||||
@interface MAPIStoreDBBaseContext : MAPIStoreContext
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREDBBASECONTEXT_H */
|
||||
@@ -1,114 +0,0 @@
|
||||
/* MAPIStoreDBBaseContext.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2012-2014 Inverse inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* A generic parent class for all context that will store their data on the
|
||||
disk in the form of a plist. */
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import "MAPIStoreDBFolder.h"
|
||||
#import "MAPIStoreMapping.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import <SOGo/SOGoCacheGCSFolder.h>
|
||||
|
||||
#import "MAPIStoreDBBaseContext.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
|
||||
static Class MAPIStoreDBFolderK;
|
||||
|
||||
@implementation MAPIStoreDBBaseContext
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
MAPIStoreDBFolderK = [MAPIStoreDBFolder class];
|
||||
}
|
||||
|
||||
+ (NSString *) MAPIModuleName
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (Class) MAPIStoreFolderClass
|
||||
{
|
||||
return MAPIStoreDBFolderK;
|
||||
}
|
||||
|
||||
- (void) ensureContextFolder
|
||||
{
|
||||
SOGoCacheGCSFolder *currentFolder;
|
||||
NSArray *parts;
|
||||
NSMutableArray *folders;
|
||||
NSString *folderName;
|
||||
NSUInteger count, max;
|
||||
|
||||
parts = [[contextUrl path] componentsSeparatedByString: @"/"];
|
||||
max = [parts count];
|
||||
folders = [NSMutableArray arrayWithCapacity: max];
|
||||
|
||||
/* build the folder chain */
|
||||
currentFolder = [self rootSOGoFolder];
|
||||
[folders addObject: currentFolder];
|
||||
for (count = 1; count < max; count++)
|
||||
{
|
||||
folderName = [parts objectAtIndex: count];
|
||||
if ([folderName length] > 0)
|
||||
{
|
||||
currentFolder = [SOGoCacheGCSFolder objectWithName: folderName
|
||||
inContainer: currentFolder];
|
||||
[folders addObject: currentFolder];
|
||||
}
|
||||
}
|
||||
|
||||
/* ensure each folder in the chain actually exists, so that it becomes
|
||||
"listable" in further operations */
|
||||
max = [folders count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
currentFolder = [folders objectAtIndex: count];
|
||||
[currentFolder reloadIfNeeded];
|
||||
if ([currentFolder isNew])
|
||||
[currentFolder save];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) rootSOGoFolder
|
||||
{
|
||||
SOGoCacheGCSFolder *folder;
|
||||
|
||||
[userContext ensureFolderTableExists];
|
||||
|
||||
folder = [SOGoCacheGCSFolder objectWithName: [isa MAPIModuleName]
|
||||
inContainer: nil];
|
||||
[folder setTableUrl: [userContext folderTableURL]];
|
||||
// [folder reloadIfNeeded];
|
||||
|
||||
/* we don't need to set the "path prefix" of the folder since the module
|
||||
name is used as the label for the top folder */
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,43 +0,0 @@
|
||||
/* MAPIStoreDBFolder.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREDBFOLDER_H
|
||||
#define MAPISTOREDBFOLDER_H
|
||||
|
||||
#import "MAPIStoreFolder.h"
|
||||
|
||||
extern NSString *MAPIStoreRightReadItems;
|
||||
extern NSString *MAPIStoreRightCreateItems;
|
||||
extern NSString *MAPIStoreRightEditOwn;
|
||||
extern NSString *MAPIStoreRightEditAll;
|
||||
extern NSString *MAPIStoreRightDeleteOwn;
|
||||
extern NSString *MAPIStoreRightDeleteAll;
|
||||
extern NSString *MAPIStoreRightCreateSubfolders;
|
||||
extern NSString *MAPIStoreRightFolderOwner;
|
||||
extern NSString *MAPIStoreRightFolderContact;
|
||||
|
||||
@interface MAPIStoreDBFolder : MAPIStoreFolder
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#endif /* MAPISTOREDBFOLDER_H */
|
||||
@@ -1,382 +0,0 @@
|
||||
/* MAPIStoreDBFolder.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSCalendarDate.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSException.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <EOControl/EOQualifier.h>
|
||||
#import <SOGo/SOGoFolder.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/EOQualifier+SOGoCacheObject.h>
|
||||
#import "MAPIStoreContext.h"
|
||||
#import "MAPIStoreDBFolderTable.h"
|
||||
#import "MAPIStoreDBMessage.h"
|
||||
#import "MAPIStoreDBMessageTable.h"
|
||||
#import "MAPIStoreMapping.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import <SOGo/SOGoCacheGCSFolder.h>
|
||||
#import "SOGoMAPIDBMessage.h"
|
||||
|
||||
#import "MAPIStoreDBFolder.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
|
||||
static Class EOKeyValueQualifierK, SOGoCacheGCSFolderK, MAPIStoreDBFolderK;
|
||||
|
||||
@implementation MAPIStoreDBFolder
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
EOKeyValueQualifierK = [EOKeyValueQualifier class];
|
||||
SOGoCacheGCSFolderK = [SOGoCacheGCSFolder class];
|
||||
MAPIStoreDBFolderK = [MAPIStoreDBFolder class];
|
||||
}
|
||||
|
||||
- (void) setupAuxiliaryObjects
|
||||
{
|
||||
[super setupAuxiliaryObjects];
|
||||
ASSIGN (sogoObject, dbFolder);
|
||||
}
|
||||
|
||||
- (MAPIStoreMessageTable *) messageTable
|
||||
{
|
||||
return [MAPIStoreDBMessageTable tableForContainer: self];
|
||||
}
|
||||
|
||||
- (MAPIStoreFolderTable *) folderTable
|
||||
{
|
||||
return [MAPIStoreDBFolderTable tableForContainer: self];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) createFolder: (struct SRow *) aRow
|
||||
withFID: (uint64_t) newFID
|
||||
andKey: (NSString **) newKeyP
|
||||
{
|
||||
enum mapistore_error rc;
|
||||
NSString *folderName, *nameInContainer;
|
||||
SOGoCacheGCSFolder *newFolder;
|
||||
struct SPropValue *value;
|
||||
|
||||
value = get_SPropValue_SRow (aRow, PidTagDisplayName);
|
||||
if (value)
|
||||
folderName = [NSString stringWithUTF8String: value->value.lpszW];
|
||||
else
|
||||
{
|
||||
value = get_SPropValue_SRow (aRow, PidTagDisplayName_string8);
|
||||
if (value)
|
||||
folderName = [NSString stringWithUTF8String: (const char *) value->value.lpszA];
|
||||
else
|
||||
folderName = nil;
|
||||
}
|
||||
|
||||
if (folderName)
|
||||
{
|
||||
nameInContainer = [NSString stringWithFormat: @"0x%.16"PRIx64,
|
||||
(unsigned long long) newFID];
|
||||
newFolder = [SOGoCacheGCSFolderK objectWithName: nameInContainer
|
||||
inContainer: sogoObject];
|
||||
[newFolder reloadIfNeeded];
|
||||
[[newFolder properties] setObject: folderName
|
||||
forKey: MAPIPropertyKey (PidTagDisplayName)];
|
||||
[newFolder save];
|
||||
*newKeyP = nameInContainer;
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
else
|
||||
rc = MAPISTORE_ERR_INVALID_PARAMETER;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) moveCopyToFolder: (MAPIStoreFolder *) targetFolder
|
||||
withNewName: (NSString *) newFolderName
|
||||
isMove: (BOOL) isMove
|
||||
isRecursive: (BOOL) isRecursive
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
enum mapistore_error rc;
|
||||
NSString *path, *pathComponent, *targetPath, *newPath;
|
||||
NSString *newURL;
|
||||
MAPIStoreMapping *mapping;
|
||||
NSRange slashRange;
|
||||
|
||||
pathComponent = nil;
|
||||
|
||||
if (isMove && ([targetFolder isKindOfClass: MAPIStoreDBFolderK] || !targetFolder))
|
||||
{
|
||||
path = [sogoObject path];
|
||||
slashRange = [path rangeOfString: @"/" options: NSBackwardsSearch];
|
||||
if (slashRange.location == NSNotFound)
|
||||
[NSException raise: @"MAPIStoreIOException"
|
||||
format: @"db folder path must start with a '/'"];
|
||||
else
|
||||
pathComponent = [path substringFromIndex: slashRange.location + 1];
|
||||
|
||||
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];
|
||||
|
||||
if (targetFolder)
|
||||
newURL = [NSString stringWithFormat: @"%@%@/",
|
||||
[targetFolder url], pathComponent];
|
||||
else
|
||||
newURL = [NSString stringWithFormat: @"sogo://%@@fallback/%@/",
|
||||
[[self userContext] username], pathComponent];
|
||||
|
||||
[mapping updateID: [self objectId]
|
||||
withURL: newURL];
|
||||
|
||||
[targetFolder cleanupCaches];
|
||||
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
else
|
||||
rc = [super moveCopyToFolder: targetFolder withNewName: newFolderName
|
||||
isMove: isMove
|
||||
isRecursive: isRecursive
|
||||
inMemCtx: memCtx];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (MAPIStoreMessage *) createMessage
|
||||
{
|
||||
MAPIStoreMessage *newMessage;
|
||||
SOGoMAPIDBMessage *fsObject;
|
||||
NSString *newKey;
|
||||
|
||||
[[self userContext] activate];
|
||||
|
||||
newKey = [NSString stringWithFormat: @"%@.plist",
|
||||
[SOGoObject globallyUniqueObjectId]];
|
||||
fsObject = [SOGoMAPIDBMessage objectWithName: newKey
|
||||
inContainer: sogoObject];
|
||||
[fsObject setObjectType: MAPIMessageCacheObject];
|
||||
[fsObject reloadIfNeeded];
|
||||
newMessage = [MAPIStoreDBMessage mapiStoreObjectWithSOGoObject: fsObject
|
||||
inContainer: self];
|
||||
|
||||
return newMessage;
|
||||
}
|
||||
|
||||
- (NSArray *) messageKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
NSArray *keys;
|
||||
SOGoUser *ownerUser;
|
||||
|
||||
ownerUser = [[self userContext] sogoUser];
|
||||
if ([[context activeUser] isEqual: ownerUser]
|
||||
|| [self subscriberCanReadMessages])
|
||||
{
|
||||
[[self userContext] activate];
|
||||
keys = [(SOGoCacheGCSFolder *) sogoObject childKeysOfType: MAPIMessageCacheObject
|
||||
includeDeleted: NO
|
||||
matchingQualifier: qualifier
|
||||
andSortOrderings: sortOrderings];
|
||||
}
|
||||
else
|
||||
keys = [NSArray array];
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
- (NSArray *) folderKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
[[self userContext] activate];
|
||||
return [dbFolder childKeysOfType: MAPIFolderCacheObject
|
||||
includeDeleted: NO
|
||||
matchingQualifier: qualifier
|
||||
andSortOrderings: sortOrderings];
|
||||
}
|
||||
|
||||
/* TODO: now that we are DB-based, this method can easily be implemented
|
||||
|
||||
- (NSArray *) getDeletedKeysFromChangeNumber: (uint64_t) changeNum
|
||||
andCN: (NSNumber **) cnNbrs
|
||||
inTableType: (enum mapistore_table_type) tableType
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
- (NSDate *) lastMessageModificationTime
|
||||
{
|
||||
NSUInteger count, max;
|
||||
NSDate *date, *fileDate;
|
||||
MAPIStoreDBMessage *msg;
|
||||
NSArray *messageKeys;
|
||||
|
||||
messageKeys = [self messageKeys];
|
||||
|
||||
date = [NSCalendarDate date];
|
||||
//[self logWithFormat: @"current date: %@", date];
|
||||
|
||||
max = [messageKeys count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
msg = [self lookupMessage: [messageKeys objectAtIndex: count]];
|
||||
fileDate = [msg lastModificationTime];
|
||||
if ([date laterDate: fileDate] == fileDate)
|
||||
{
|
||||
//[self logWithFormat: @"current date: %@", date];
|
||||
|
||||
date = fileDate;
|
||||
}
|
||||
}
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
- (SOGoFolder *) aclFolder
|
||||
{
|
||||
return sogoObject;
|
||||
}
|
||||
|
||||
- (NSArray *) rolesForExchangeRights: (uint32_t) rights
|
||||
{
|
||||
NSMutableArray *roles;
|
||||
|
||||
roles = [NSMutableArray arrayWithCapacity: 9];
|
||||
if (rights & RightsReadItems)
|
||||
[roles addObject: MAPIStoreRightReadItems];
|
||||
if (rights & RightsCreateItems)
|
||||
[roles addObject: MAPIStoreRightCreateItems];
|
||||
if (rights & RightsEditOwn)
|
||||
[roles addObject: MAPIStoreRightEditOwn];
|
||||
if (rights & RightsDeleteOwn)
|
||||
[roles addObject: MAPIStoreRightDeleteOwn];
|
||||
if (rights & RightsEditAll)
|
||||
[roles addObject: MAPIStoreRightEditAll];
|
||||
if (rights & RightsDeleteAll)
|
||||
[roles addObject: MAPIStoreRightDeleteAll];
|
||||
if (rights & RightsCreateSubfolders)
|
||||
[roles addObject: MAPIStoreRightCreateSubfolders];
|
||||
if (rights & RightsFolderOwner)
|
||||
[roles addObject: MAPIStoreRightFolderOwner];
|
||||
if (rights & RightsFolderContact)
|
||||
[roles addObject: MAPIStoreRightFolderContact];
|
||||
|
||||
return roles;
|
||||
}
|
||||
|
||||
- (uint32_t) exchangeRightsForRoles: (NSArray *) roles
|
||||
{
|
||||
uint32_t rights = 0;
|
||||
|
||||
if ([roles containsObject: MAPIStoreRightReadItems])
|
||||
rights |= RightsReadItems;
|
||||
if ([roles containsObject: MAPIStoreRightCreateItems])
|
||||
rights |= RightsCreateItems;
|
||||
if ([roles containsObject: MAPIStoreRightEditOwn])
|
||||
rights |= RightsEditOwn;
|
||||
if ([roles containsObject: MAPIStoreRightDeleteOwn])
|
||||
rights |= RightsDeleteOwn;
|
||||
if ([roles containsObject: MAPIStoreRightEditAll])
|
||||
rights |= RightsEditAll | RightsEditOwn;
|
||||
if ([roles containsObject: MAPIStoreRightDeleteAll])
|
||||
rights |= RightsDeleteAll | RightsDeleteOwn;
|
||||
if ([roles containsObject: MAPIStoreRightCreateSubfolders])
|
||||
rights |= RightsCreateSubfolders;
|
||||
if ([roles containsObject: MAPIStoreRightFolderOwner])
|
||||
rights |= RightsFolderOwner;
|
||||
if ([roles containsObject: MAPIStoreRightFolderContact])
|
||||
rights |= RightsFolderContact;
|
||||
if (rights != 0)
|
||||
rights |= RoleNone; /* actually "folder visible" */
|
||||
|
||||
return rights;
|
||||
}
|
||||
|
||||
- (BOOL) _testRoleForActiveUser: (const NSString *) role
|
||||
{
|
||||
SOGoUser *activeUser;
|
||||
NSArray *roles;
|
||||
|
||||
activeUser = [[self context] activeUser];
|
||||
|
||||
roles = [[self aclFolder] aclsForUser: [activeUser login]];
|
||||
|
||||
return [roles containsObject: role];
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanCreateMessages
|
||||
{
|
||||
return [self _testRoleForActiveUser: MAPIStoreRightCreateItems];
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanModifyMessages
|
||||
{
|
||||
return [self _testRoleForActiveUser: MAPIStoreRightEditAll];
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanReadMessages
|
||||
{
|
||||
NSString *displayName;
|
||||
|
||||
/* when this folder is the "Freebusy Data" folder, we need to allow
|
||||
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)];
|
||||
|
||||
return ([displayName isEqualToString: @"Freebusy Data"]
|
||||
|| [self _testRoleForActiveUser: MAPIStoreRightReadItems]);
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanDeleteMessages
|
||||
{
|
||||
return [self _testRoleForActiveUser: MAPIStoreRightDeleteAll];
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanCreateSubFolders
|
||||
{
|
||||
return [self _testRoleForActiveUser: MAPIStoreRightCreateSubfolders];
|
||||
}
|
||||
|
||||
- (BOOL) supportsSubFolders
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,31 +0,0 @@
|
||||
/* MAPIStoreDBFolderTable.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREDBFOLDERTABLE_H
|
||||
#define MAPISTOREDBFOLDERTABLE_H
|
||||
|
||||
#import "MAPIStoreFolderTable.h"
|
||||
|
||||
@interface MAPIStoreDBFolderTable : MAPIStoreFolderTable
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREDBFOLDERTABLE_H */
|
||||
@@ -1,36 +0,0 @@
|
||||
/* MAPIStoreDBFolderTable.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 "MAPIStoreTypes.h"
|
||||
|
||||
#import "MAPIStoreDBFolderTable.h"
|
||||
|
||||
@implementation MAPIStoreDBFolderTable
|
||||
|
||||
- (NSString *) backendIdentifierForProperty: (enum MAPITAGS) property
|
||||
{
|
||||
return [NSString stringWithFormat: @"%@", MAPIPropertyKey (property)];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,31 +0,0 @@
|
||||
/* MAPIStoreDBMessage.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREDBMESSAGE_H
|
||||
#define MAPISTOREDBMESSAGE_H
|
||||
|
||||
#import "MAPIStoreMessage.h"
|
||||
|
||||
@interface MAPIStoreDBMessage : MAPIStoreMessage
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREDBMESSAGE_H */
|
||||
@@ -1,495 +0,0 @@
|
||||
/* MAPIStoreDBMessage.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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/NSArray.h>
|
||||
#import <Foundation/NSCalendarDate.h>
|
||||
#import <Foundation/NSData.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <SOGo/SOGoFolder.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
|
||||
#import "MAPIStoreContext.h"
|
||||
#import "MAPIStorePropertySelectors.h"
|
||||
#import "SOGoMAPIDBMessage.h"
|
||||
|
||||
#import "MAPIStoreDBFolder.h"
|
||||
#import "MAPIStoreDBMessage.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSObject+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
|
||||
@implementation MAPIStoreDBMessage
|
||||
|
||||
+ (enum mapistore_error) getAvailableProperties: (struct SPropTagArray **) propertiesP
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
struct SPropTagArray *properties;
|
||||
NSUInteger count;
|
||||
|
||||
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 + faiSize;
|
||||
properties->aulPropTag = talloc_array (properties, enum MAPITAGS,
|
||||
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 < faiSize; count++)
|
||||
properties->aulPropTag[MAPIStoreSupportedPropertiesCount+count]
|
||||
= faiProperties[count];
|
||||
|
||||
*propertiesP = properties;
|
||||
|
||||
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
|
||||
{
|
||||
if ((self = [super initWithSOGoObject: newSOGoObject
|
||||
inContainer: newContainer]))
|
||||
{
|
||||
[properties release];
|
||||
properties = [newSOGoObject properties];
|
||||
[properties retain];
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
/* 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_number"];
|
||||
if (versionNbr)
|
||||
objectVersion = exchange_globcnt ([versionNbr unsignedLongLongValue]);
|
||||
else
|
||||
{
|
||||
/* 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?
|
||||
//
|
||||
// We might get there if for some reasons, all classes weren't able
|
||||
// to tell us the message class.
|
||||
//
|
||||
- (enum mapistore_error) getPidTagMessageClass: (void **) data inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = [@"IPM.Note" asUnicodeInMemCtx: memCtx];
|
||||
|
||||
[self logWithFormat: @"METHOD '%s' - unable to determine message class. Falling back to IPM.Note", __FUNCTION__];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getProperties: (struct mapistore_property_data *) data
|
||||
withTags: (enum MAPITAGS *) tags
|
||||
andCount: (uint16_t) columnCount
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
[sogoObject reloadIfNeeded];
|
||||
|
||||
return [super getProperties: data
|
||||
withTags: tags
|
||||
andCount: columnCount
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getProperty: (void **) data
|
||||
withTag: (enum MAPITAGS) propTag
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
id value;
|
||||
enum mapistore_error rc;
|
||||
|
||||
value = [properties objectForKey: MAPIPropertyKey (propTag)];
|
||||
if (value)
|
||||
rc = [value getValue: data forTag: propTag inMemCtx: memCtx];
|
||||
else
|
||||
rc = [super getProperty: data withTag: propTag inMemCtx: memCtx];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (void) addProperties: (NSDictionary *) newNewProperties
|
||||
{
|
||||
[sogoObject reloadIfNeeded];
|
||||
|
||||
[super addProperties: newNewProperties];
|
||||
}
|
||||
|
||||
- (void) save: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
uint64_t newVersion;
|
||||
|
||||
if ([attachmentKeys count] > 0)
|
||||
[properties setObject: attachmentParts forKey: @"attachments"];
|
||||
|
||||
newVersion = [[self context] getNewChangeNumber];
|
||||
newVersion = exchange_globcnt ((newVersion >> 16) & 0x0000ffffffffffffLL);
|
||||
|
||||
[properties setObject: [NSNumber numberWithUnsignedLongLong: newVersion]
|
||||
forKey: @"version_number"];
|
||||
|
||||
/* Remove old version */
|
||||
[properties removeObjectForKey: @"version"];
|
||||
|
||||
/* Update PredecessorChangeList accordingly */
|
||||
[self _updatePredecessorChangeList];
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
NSString *lastModifierName;
|
||||
|
||||
lastModifierName = (NSString *)[properties objectForKey: MAPIPropertyKey (PidTagLastModifierName)];
|
||||
if ([lastModifierName length] > 0)
|
||||
[properties setObject: lastModifierName
|
||||
forKey: MAPIPropertyKey (PidTagCreatorName)];
|
||||
}
|
||||
|
||||
// [self logWithFormat: @"Saving %@", [self description]];
|
||||
// [self logWithFormat: @"%d props in dict", [properties count]];
|
||||
|
||||
[sogoObject save];
|
||||
}
|
||||
|
||||
- (BOOL) _messageIsFreeBusy
|
||||
{
|
||||
NSString *msgClass;
|
||||
|
||||
/* This is a HACK until we figure out how to determine a message position in
|
||||
the mailbox hierarchy.... (missing: folderid and role) */
|
||||
msgClass = [properties
|
||||
objectForKey: MAPIPropertyKey (PR_MESSAGE_CLASS_UNICODE)];
|
||||
|
||||
return [msgClass isEqualToString: @"IPM.Microsoft.ScheduleData.FreeBusy"];
|
||||
}
|
||||
|
||||
//-----------------------------
|
||||
// Permissions
|
||||
//-----------------------------
|
||||
|
||||
- (BOOL) subscriberCanReadMessage
|
||||
{
|
||||
return [(MAPIStoreFolder *) container subscriberCanReadMessages];
|
||||
}
|
||||
|
||||
- (SOGoUser *) _ownerUser
|
||||
{
|
||||
NSString *ownerName;
|
||||
SOGoUser *ownerUser = nil;
|
||||
|
||||
ownerName = [properties objectForKey: MAPIPropertyKey (PidTagCreatorName)];
|
||||
if ([ownerName length] > 0)
|
||||
ownerUser = [SOGoUser userWithLogin: ownerName];
|
||||
|
||||
return ownerUser;
|
||||
}
|
||||
|
||||
- (NSArray *) activeUserRoles
|
||||
{
|
||||
/* Override because of this exception: NSInvalidArgumentException,
|
||||
reason: [SOGoMAPIDBMessage-aclsForUser:] should be overridden by
|
||||
subclass */
|
||||
if (!activeUserRoles)
|
||||
{
|
||||
SOGoUser *activeUser;
|
||||
|
||||
activeUser = [[self context] activeUser];
|
||||
activeUserRoles = [[container aclFolder] aclsForUser: [activeUser login]];
|
||||
[activeUserRoles retain];
|
||||
}
|
||||
|
||||
return activeUserRoles;
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanModifyMessage
|
||||
{
|
||||
BOOL rc;
|
||||
NSArray *roles;
|
||||
|
||||
roles = [self activeUserRoles];
|
||||
|
||||
if (isNew)
|
||||
rc = [(MAPIStoreFolder *) container subscriberCanCreateMessages];
|
||||
else
|
||||
rc = [roles containsObject: MAPIStoreRightEditAll];
|
||||
|
||||
/* Check if the message is owned and it has permission to edit it */
|
||||
if (!rc && [roles containsObject: MAPIStoreRightEditOwn])
|
||||
rc = [[[container context] activeUser] isEqual: [self _ownerUser]];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanDeleteMessage
|
||||
{
|
||||
BOOL rc;
|
||||
NSArray *roles;
|
||||
|
||||
roles = [self activeUserRoles];
|
||||
|
||||
rc = [roles containsObject: MAPIStoreRightDeleteAll];
|
||||
|
||||
/* Check if the message is owned and it has permission to delete it */
|
||||
if (!rc && [roles containsObject: MAPIStoreRightDeleteOwn])
|
||||
rc = [[[container context] activeUser] isEqual: [self _ownerUser]];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (NSDate *) creationTime
|
||||
{
|
||||
return [sogoObject creationDate];
|
||||
}
|
||||
|
||||
- (NSDate *) lastModificationTime
|
||||
{
|
||||
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
|
||||
@@ -1,31 +0,0 @@
|
||||
/* MAPIStoreDBMessageTable.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREDBMESSAGETABLE_H
|
||||
#define MAPISTOREDBMESSAGETABLE_H
|
||||
|
||||
#import "MAPIStoreMessageTable.h"
|
||||
|
||||
@interface MAPIStoreDBMessageTable : MAPIStoreMessageTable
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREDBMESSAGETABLE_H */
|
||||
@@ -1,133 +0,0 @@
|
||||
/* MAPIStoreDBMessageTable.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 <NGExtensions/NSObject+Logs.h>
|
||||
#import <EOControl/EOQualifier.h>
|
||||
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "MAPIStoreDBMessage.h"
|
||||
|
||||
#import "MAPIStoreDBMessageTable.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
|
||||
static Class MAPIStoreDBMessageK = Nil;
|
||||
|
||||
@implementation MAPIStoreDBMessageTable
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
MAPIStoreDBMessageK = [MAPIStoreDBMessage class];
|
||||
}
|
||||
|
||||
+ (Class) childObjectClass
|
||||
{
|
||||
return MAPIStoreDBMessageK;
|
||||
}
|
||||
|
||||
- (NSString *) backendIdentifierForProperty: (enum MAPITAGS) property
|
||||
{
|
||||
return [NSString stringWithFormat: @"%@", MAPIPropertyKey (property)];
|
||||
}
|
||||
|
||||
- (MAPIRestrictionState) evaluatePropertyRestriction: (struct mapi_SPropertyRestriction *) res
|
||||
intoQualifier: (EOQualifier **) qualifier
|
||||
{
|
||||
MAPIRestrictionState rc;
|
||||
id value;
|
||||
NSNumber *version;
|
||||
uint64_t cVersion;
|
||||
|
||||
if ((uint32_t) res->ulPropTag == PidTagChangeNumber)
|
||||
{
|
||||
SEL operator;
|
||||
|
||||
value = NSObjectFromMAPISPropValue (&res->lpProp);
|
||||
cVersion = exchange_globcnt (([value unsignedLongLongValue] >> 16)
|
||||
& 0x0000ffffffffffffLL);
|
||||
version = [NSNumber numberWithUnsignedLongLong: cVersion];
|
||||
operator = [self operatorFromRestrictionOperator: res->relop];
|
||||
*qualifier = [[EOKeyValueQualifier alloc] initWithKey: @"version_number"
|
||||
operatorSelector: operator
|
||||
value: version];
|
||||
[*qualifier autorelease];
|
||||
rc = MAPIRestrictionStateNeedsEval;
|
||||
}
|
||||
else if ((uint32_t) res->ulPropTag == PR_SUBJECT_UNICODE)
|
||||
{
|
||||
EOQualifier *subjectQualifier, *nSubjectQualifier, *subjectPQualifier;
|
||||
EOQualifier *orQualifier, *andQualifier;
|
||||
struct mapi_SPropertyRestriction subRes;
|
||||
char *colPtr, *prefix;
|
||||
|
||||
[super evaluatePropertyRestriction: res
|
||||
intoQualifier: &subjectQualifier];
|
||||
|
||||
subRes.relop = res->relop;
|
||||
subRes.ulPropTag = PR_NORMALIZED_SUBJECT_UNICODE;
|
||||
subRes.lpProp.ulPropTag = PR_NORMALIZED_SUBJECT_UNICODE;
|
||||
|
||||
colPtr = strstr (res->lpProp.value.lpszW, ":");
|
||||
if (colPtr)
|
||||
subRes.lpProp.value.lpszW = colPtr + 1;
|
||||
else
|
||||
subRes.lpProp.value.lpszW = res->lpProp.value.lpszW;
|
||||
|
||||
[self evaluatePropertyRestriction: &subRes
|
||||
intoQualifier: &nSubjectQualifier];
|
||||
if (colPtr)
|
||||
{
|
||||
prefix = strndup (res->lpProp.value.lpszW, (colPtr - res->lpProp.value.lpszW));
|
||||
|
||||
subRes.relop = RELOP_EQ;
|
||||
subRes.ulPropTag = PR_SUBJECT_PREFIX_UNICODE;
|
||||
subRes.lpProp.ulPropTag = PR_SUBJECT_PREFIX_UNICODE;
|
||||
subRes.lpProp.value.lpszW = prefix;
|
||||
[self evaluatePropertyRestriction: &subRes
|
||||
intoQualifier: &subjectPQualifier];
|
||||
free (prefix);
|
||||
|
||||
andQualifier = [[EOOrQualifier alloc]
|
||||
initWithQualifiers:
|
||||
subjectPQualifier, nSubjectQualifier, nil];
|
||||
orQualifier = [[EOOrQualifier alloc]
|
||||
initWithQualifiers:
|
||||
subjectQualifier, andQualifier, nil];
|
||||
[andQualifier release];
|
||||
}
|
||||
else
|
||||
orQualifier = [[EOOrQualifier alloc]
|
||||
initWithQualifiers:
|
||||
subjectQualifier, nSubjectQualifier, nil];
|
||||
[orQualifier autorelease];
|
||||
*qualifier = orQualifier;
|
||||
rc = MAPIRestrictionStateNeedsEval;
|
||||
}
|
||||
else
|
||||
rc = [super evaluatePropertyRestriction: res intoQualifier: qualifier];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,33 +0,0 @@
|
||||
/* MAPIStoreEmbeddedMessage.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREEMBEDDEDMESSAGE_H
|
||||
#define MAPISTOREEMBEDDEDMESSAGE_H
|
||||
|
||||
#import "MAPIStoreMessage.h"
|
||||
|
||||
@interface MAPIStoreEmbeddedMessage : MAPIStoreMessage
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#endif /* MAPISTOREEMBEDDEDMESSAGE_H */
|
||||
@@ -1,154 +0,0 @@
|
||||
/* MAPIStoreEmbeddedMessage.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 "MAPIStoreAttachment.h"
|
||||
#import "MAPIStoreFolder.h"
|
||||
#import "NSObject+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreEmbeddedMessage.h"
|
||||
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
|
||||
static Class MAPIStoreAttachmentK;
|
||||
|
||||
@implementation MAPIStoreEmbeddedMessage
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
MAPIStoreAttachmentK = [MAPIStoreAttachment class];
|
||||
}
|
||||
|
||||
- (uint64_t) objectId
|
||||
{
|
||||
NSString *objectKey;
|
||||
MAPIStoreMessage *grandParent;
|
||||
|
||||
grandParent = (MAPIStoreMessage *) [container container];
|
||||
|
||||
/* FIXME: this is a hack */
|
||||
objectKey = [NSString stringWithFormat: @"%@/%@/as-message",
|
||||
[grandParent nameInContainer],
|
||||
[container nameInContainer],
|
||||
[self nameInContainer]];
|
||||
|
||||
return [(MAPIStoreFolder *) [grandParent container]
|
||||
idForObjectWithKey: objectKey];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAccessLevel: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getLongZero: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
/* disabled properties */
|
||||
- (enum mapistore_error) getPidTagFolderId: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagChangeKey: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagSourceKey: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagParentSourceKey: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagChangeNumber: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagInstID: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagInstanceNum: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagRowType: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagDepth: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagIconIndex: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagGenerateExchangeViews: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagOriginalMessageClass: (void **) dataa
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return MAPISTORE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* common methods */
|
||||
- (NSString *) nameInContainer
|
||||
{
|
||||
return @"as-message";
|
||||
}
|
||||
|
||||
- (uint64_t) objectVersion
|
||||
{
|
||||
return ULLONG_MAX;
|
||||
}
|
||||
|
||||
- (void) save: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,31 +0,0 @@
|
||||
/* MAPIStoreFAIMessage.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREFAIMESSAGE_H
|
||||
#define MAPISTOREFAIMESSAGE_H
|
||||
|
||||
#import "MAPIStoreDBMessage.h"
|
||||
|
||||
@interface MAPIStoreFAIMessage : MAPIStoreDBMessage
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREFAIMESSAGE_H */
|
||||
@@ -1,81 +0,0 @@
|
||||
/* MAPIStoreFAIMessage.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 <SOGo/SOGoUser.h>
|
||||
|
||||
#import "MAPIStoreActiveTables.h"
|
||||
#import "MAPIStoreContext.h"
|
||||
#import "MAPIStoreFolder.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import "NSObject+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreFAIMessage.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <stdbool.h>
|
||||
#include <talloc.h>
|
||||
#include <util/time.h>
|
||||
#include <mapistore/mapistore.h>
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
|
||||
@implementation MAPIStoreFAIMessage
|
||||
|
||||
- (NSArray *) activeContainerMessageTables
|
||||
{
|
||||
return [[MAPIStoreActiveTables activeTables]
|
||||
activeTablesForFMID: [container objectId]
|
||||
andType: MAPISTORE_FAI_TABLE];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagAssociated: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [self getYes: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) saveMessage: (TALLOC_CTX *) memCtx;
|
||||
{
|
||||
enum mapistore_error rc;
|
||||
MAPIStoreContext *context;
|
||||
SOGoUser *ownerUser;
|
||||
|
||||
context = [self context];
|
||||
ownerUser = [[self userContext] sogoUser];
|
||||
if ([[context activeUser] isEqual: ownerUser])
|
||||
rc = [super saveMessage: memCtx];
|
||||
else
|
||||
rc = MAPISTORE_ERR_DENIED;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanReadMessage
|
||||
{
|
||||
return [(MAPIStoreFolder *)container subscriberCanReadMessages];
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanModifyMessage
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,31 +0,0 @@
|
||||
/* MAPIStoreFAIMessageTable.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREFAIMESSAGETABLE_H
|
||||
#define MAPISTOREFAIMESSAGETABLE_H
|
||||
|
||||
#import "MAPIStoreDBMessageTable.h"
|
||||
|
||||
@interface MAPIStoreFAIMessageTable : MAPIStoreDBMessageTable
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREFAIMESSAGETABLE_H */
|
||||
@@ -1,101 +0,0 @@
|
||||
/* MAPIStoreFAIMessageTable.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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/NSArray.h>
|
||||
|
||||
#import "MAPIStoreFAIMessage.h"
|
||||
#import "MAPIStoreFolder.h"
|
||||
|
||||
#import "MAPIStoreFAIMessageTable.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <talloc.h>
|
||||
#include <util/time.h>
|
||||
#include <mapistore/mapistore.h>
|
||||
|
||||
static Class MAPIStoreFAIMessageK = Nil;
|
||||
|
||||
@implementation MAPIStoreFAIMessageTable
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
MAPIStoreFAIMessageK = [MAPIStoreFAIMessage class];
|
||||
}
|
||||
|
||||
+ (Class) childObjectClass
|
||||
{
|
||||
return MAPIStoreFAIMessageK;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
tableType = MAPISTORE_FAI_TABLE;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSArray *) childKeys
|
||||
{
|
||||
if (!childKeys)
|
||||
{
|
||||
childKeys = [(MAPIStoreFolder *)
|
||||
container faiMessageKeysMatchingQualifier: nil
|
||||
andSortOrderings: sortOrderings];
|
||||
[childKeys retain];
|
||||
}
|
||||
|
||||
return childKeys;
|
||||
}
|
||||
|
||||
- (NSArray *) restrictedChildKeys
|
||||
{
|
||||
NSArray *keys;
|
||||
|
||||
if (!restrictedChildKeys)
|
||||
{
|
||||
if (restrictionState != MAPIRestrictionStateAlwaysTrue)
|
||||
{
|
||||
if (restrictionState == MAPIRestrictionStateNeedsEval)
|
||||
keys = [(MAPIStoreFolder *)
|
||||
container faiMessageKeysMatchingQualifier: restriction
|
||||
andSortOrderings: sortOrderings];
|
||||
else
|
||||
keys = [NSArray array];
|
||||
}
|
||||
else
|
||||
keys = [self childKeys];
|
||||
|
||||
ASSIGN (restrictedChildKeys, keys);
|
||||
}
|
||||
|
||||
return restrictedChildKeys;
|
||||
}
|
||||
|
||||
- (id) lookupChild: (NSString *) childKey
|
||||
{
|
||||
return [(MAPIStoreFolder *) container lookupFAIMessage: childKey];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,32 +0,0 @@
|
||||
/* MAPIStoreFallbackContext.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc.
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREFALLBACKCONTEXT_H
|
||||
#define MAPISTOREFALLBACKCONTEXT_H
|
||||
|
||||
#import "MAPIStoreDBBaseContext.h"
|
||||
|
||||
@interface MAPIStoreFallbackContext : MAPIStoreDBBaseContext
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREFALLBACKCONTEXT_H */
|
||||
@@ -1,112 +0,0 @@
|
||||
/* MAPIStoreFallbackContext.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2014 Inverse inc.
|
||||
*
|
||||
* 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/NSArray.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
#import <SOGo/SOGoCacheGCSFolder.h>
|
||||
|
||||
#import "MAPIStoreFallbackContext.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <inttypes.h>
|
||||
#include <dlinklist.h>
|
||||
#include <mapistore/mapistore.h>
|
||||
|
||||
@implementation MAPIStoreFallbackContext
|
||||
|
||||
+ (NSString *) MAPIModuleName
|
||||
{
|
||||
return @"fallback";
|
||||
}
|
||||
|
||||
+ (enum mapistore_context_role) MAPIContextRole
|
||||
{
|
||||
return MAPISTORE_MAIL_ROLE;
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||
withIndexing: (struct indexing_context *) indexing
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
struct mapistore_contexts_list *firstContext = NULL, *context;
|
||||
SOGoCacheGCSFolder *root;
|
||||
NSArray *names;
|
||||
NSUInteger count, max;
|
||||
NSString *baseURL, *url, *name;
|
||||
MAPIStoreUserContext *userContext;
|
||||
|
||||
baseURL = [NSString stringWithFormat: @"sogo://%@@fallback/",
|
||||
[userName stringByReplacingOccurrencesOfString: @"@"
|
||||
withString: @"%40"]];
|
||||
|
||||
|
||||
context = talloc_zero (memCtx, struct mapistore_contexts_list);
|
||||
context->url = [baseURL asUnicodeInMemCtx: context];
|
||||
context->name = "Fallback";
|
||||
context->main_folder = true;
|
||||
context->role = MAPISTORE_FALLBACK_ROLE;
|
||||
context->tag = "tag";
|
||||
|
||||
DLIST_ADD_END (firstContext, context, void);
|
||||
|
||||
/* Maybe emsmdbp_provisioning should be fixed in order to only take the uri
|
||||
returned above to avoid deleting its entries... */
|
||||
root = [SOGoCacheGCSFolder objectWithName: [self MAPIModuleName]
|
||||
inContainer: nil];
|
||||
[root setOwner: userName];
|
||||
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||
andTDBIndexing: indexing];
|
||||
[userContext ensureFolderTableExists];
|
||||
[root setTableUrl: [userContext folderTableURL]];
|
||||
names = [root toManyRelationshipKeys];
|
||||
max = [names count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
name = [names objectAtIndex: count];
|
||||
url = [NSString stringWithFormat: @"%@%@/", baseURL, name];
|
||||
context = talloc_zero (memCtx, struct mapistore_contexts_list);
|
||||
context->url = [url asUnicodeInMemCtx: context];
|
||||
context->name = [name asUnicodeInMemCtx: context];
|
||||
context->main_folder = false;
|
||||
context->role = MAPISTORE_FALLBACK_ROLE;
|
||||
context->tag = "tag";
|
||||
DLIST_ADD_END (firstContext, context, void);
|
||||
}
|
||||
|
||||
return firstContext;
|
||||
}
|
||||
|
||||
+ (NSString *)
|
||||
createRootSecondaryFolderWithFID: (uint64_t) fid
|
||||
andName: (NSString *) folderName
|
||||
forUser: (NSString *) userName
|
||||
{
|
||||
return [NSString stringWithFormat: @"sogo://%@@fallback/0x%.16"PRIx64"/",
|
||||
[userName stringByReplacingOccurrencesOfString: @"@"
|
||||
withString: @"%40"],
|
||||
(unsigned long long) fid];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,209 +0,0 @@
|
||||
/* MAPIStoreFolder.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2014 Inverse inc
|
||||
*
|
||||
* 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 MAPISTOREFOLDER_H
|
||||
#define MAPISTOREFOLDER_H
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
@class NSArray;
|
||||
@class NSMutableArray;
|
||||
@class NSNumber;
|
||||
|
||||
@class EOQualifier;
|
||||
|
||||
@class MAPIStoreContext;
|
||||
@class MAPIStoreMessage;
|
||||
@class MAPIStoreFAIMessageTable;
|
||||
@class MAPIStoreFolderTable;
|
||||
@class MAPIStoreMessageTable;
|
||||
@class MAPIStorePermissionsTable;
|
||||
@class SOGoFolder;
|
||||
@class SOGoCacheGCSFolder;
|
||||
@class SOGoMAPIDBMessage;
|
||||
|
||||
#import "MAPIStoreSOGoObject.h"
|
||||
|
||||
/* MAPI Permissions
|
||||
|
||||
This set has only sogo-openchange library scope
|
||||
*/
|
||||
extern NSString *MAPIStoreRightReadItems;
|
||||
extern NSString *MAPIStoreRightCreateItems;
|
||||
extern NSString *MAPIStoreRightEditOwn;
|
||||
extern NSString *MAPIStoreRightEditAll;
|
||||
extern NSString *MAPIStoreRightDeleteOwn;
|
||||
extern NSString *MAPIStoreRightDeleteAll;
|
||||
extern NSString *MAPIStoreRightCreateSubfolders;
|
||||
extern NSString *MAPIStoreRightFolderOwner;
|
||||
extern NSString *MAPIStoreRightFolderContact;
|
||||
|
||||
@interface MAPIStoreFolder : MAPIStoreSOGoObject
|
||||
{
|
||||
MAPIStoreContext *context;
|
||||
// NSArray *messageKeys;
|
||||
// NSArray *faiMessageKeys;
|
||||
// NSArray *folderKeys;
|
||||
|
||||
SOGoCacheGCSFolder *dbFolder;
|
||||
// SOGoMAPIDBFolder *faiFolder;
|
||||
// SOGoMAPIDBFolder *propsFolder;
|
||||
// SOGoMAPIDBMessage *propsMessage;
|
||||
}
|
||||
|
||||
- (void) setContext: (MAPIStoreContext *) newContext;
|
||||
|
||||
- (void) setupAuxiliaryObjects;
|
||||
|
||||
- (SOGoCacheGCSFolder *) dbFolder;
|
||||
|
||||
- (NSArray *) activeMessageTables;
|
||||
- (NSArray *) activeFAIMessageTables;
|
||||
|
||||
// - (SOGoMAPIDBMessage *) propertiesMessage;
|
||||
|
||||
- (NSString *) childKeyFromURL: (NSString *) childURL;
|
||||
|
||||
- (id) lookupMessageByURL: (NSString *) messageURL;
|
||||
- (id) lookupFolderByURL: (NSString *) folderURL;
|
||||
|
||||
/* permissions */
|
||||
- (MAPIStorePermissionsTable *) permissionsTable;
|
||||
- (NSArray *) permissionEntries;
|
||||
|
||||
- (NSArray *) expandRoles: (NSArray *) roles;
|
||||
|
||||
/* message objects and tables */
|
||||
- (id) lookupMessage: (NSString *) messageKey;
|
||||
- (NSArray *) messageKeys;
|
||||
|
||||
/* FAI message objects and tables */
|
||||
- (id) lookupFAIMessage: (NSString *) messageKey;
|
||||
- (MAPIStoreFAIMessageTable *) faiMessageTable;
|
||||
- (NSArray *) faiMessageKeys;
|
||||
- (NSArray *) faiMessageKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings;
|
||||
|
||||
/* folder objects and tables */
|
||||
- (id) lookupFolder: (NSString *) folderKey;
|
||||
- (MAPIStoreFolderTable *) folderTable;
|
||||
- (NSArray *) folderKeys;
|
||||
- (NSArray *) folderKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings;
|
||||
|
||||
- (MAPIStoreMessage *) createMessage: (BOOL) isAssociated;
|
||||
|
||||
/* backend interface */
|
||||
|
||||
- (enum mapistore_error) openFolder: (MAPIStoreFolder **) childFolderPtr
|
||||
withFID: (uint64_t) fid;
|
||||
- (enum mapistore_error) createFolder: (MAPIStoreFolder **) childFolderPtr
|
||||
withRow: (struct SRow *) aRow
|
||||
andFID: (uint64_t) fid;
|
||||
- (enum mapistore_error) deleteFolder;
|
||||
- (enum mapistore_error) getChildCount: (uint32_t *) rowCount
|
||||
ofTableType: (enum mapistore_table_type) tableType;
|
||||
|
||||
- (enum mapistore_error) createMessage: (MAPIStoreMessage **) messagePtr
|
||||
withMID: (uint64_t) mid
|
||||
isAssociated: (BOOL) isAssociated;
|
||||
|
||||
- (enum mapistore_error) openMessage: (MAPIStoreMessage **) messagePtr
|
||||
withMID: (uint64_t) mid
|
||||
forWriting: (BOOL) readWrite
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (enum mapistore_error) deleteMessageWithMID: (uint64_t) mid
|
||||
andFlags: (uint8_t) flags;
|
||||
|
||||
- (enum mapistore_error) moveCopyMessagesWithMIDs: (uint64_t *) srcMids
|
||||
andCount: (uint32_t) count
|
||||
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;
|
||||
|
||||
- (enum mapistore_error) moveCopyToFolder: (MAPIStoreFolder *) targetFolder
|
||||
withNewName: (NSString *) newFolderName
|
||||
isMove: (BOOL) isMove
|
||||
isRecursive: (BOOL) isRecursive
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
|
||||
- (enum mapistore_error) getDeletedFMIDs: (struct UI8Array_r **) fmidsPtr
|
||||
andCN: (uint64_t *) cnPtr
|
||||
fromChangeNumber: (uint64_t) changeNum
|
||||
inTableType: (enum mapistore_table_type) tableType
|
||||
inMemCtx: (TALLOC_CTX *) mem_ctx;
|
||||
|
||||
- (enum mapistore_error) getTable: (MAPIStoreTable **) tablePtr
|
||||
andRowCount: (uint32_t *) count
|
||||
tableType: (enum mapistore_table_type) tableType
|
||||
andHandleId: (uint32_t) handleId;
|
||||
|
||||
- (enum mapistore_error) modifyPermissions: (struct PermissionData *) permissions
|
||||
withCount: (uint16_t) pcount
|
||||
andFlags: (int8_t) flags;
|
||||
- (enum mapistore_error) preloadMessageBodiesWithMIDs: (const struct UI8Array_r *) mids
|
||||
ofTableType: (enum mapistore_table_type) tableType;
|
||||
|
||||
|
||||
/* helpers */
|
||||
- (uint64_t) idForObjectWithKey: (NSString *) childKey;
|
||||
- (MAPIStoreFolder *) rootContainer;
|
||||
|
||||
/* subclasses */
|
||||
- (MAPIStoreMessage *) createMessage;
|
||||
- (MAPIStoreMessageTable *) messageTable;
|
||||
- (NSArray *) messageKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings;
|
||||
- (NSArray *) getDeletedKeysFromChangeNumber: (uint64_t) changeNum
|
||||
andCN: (NSNumber **) cnNbr
|
||||
inTableType: (enum mapistore_table_type) tableType;
|
||||
|
||||
- (enum mapistore_error) createFolder: (struct SRow *) aRow
|
||||
withFID: (uint64_t) newFID
|
||||
andKey: (NSString **) newKeyP;
|
||||
|
||||
- (NSCalendarDate *) lastMessageModificationTime;
|
||||
|
||||
- (SOGoFolder *) aclFolder;
|
||||
- (NSArray *) rolesForExchangeRights: (uint32_t) rights;
|
||||
- (uint32_t) exchangeRightsForRoles: (NSArray *) roles;
|
||||
|
||||
- (BOOL) subscriberCanCreateMessages;
|
||||
- (BOOL) subscriberCanModifyMessages;
|
||||
- (BOOL) subscriberCanReadMessages;
|
||||
- (BOOL) subscriberCanDeleteMessages;
|
||||
- (BOOL) subscriberCanCreateSubFolders;
|
||||
|
||||
- (BOOL) supportsSubFolders; /* capability */
|
||||
|
||||
- (enum mapistore_error) preloadMessageBodiesWithKeys: (NSArray *) keys
|
||||
ofTableType: (enum mapistore_table_type) tableType;
|
||||
|
||||
/* subclass helpers */
|
||||
- (void) setupVersionsMessage;
|
||||
- (void) ensureIDsForChildKeys: (NSArray *) keys;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREFOLDER_H */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,31 +0,0 @@
|
||||
/* MAPIStoreFolderTable.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREFOLDERTABLE_H
|
||||
#define MAPISTOREFOLDERTABLE_H
|
||||
|
||||
#import "MAPIStoreTable.h"
|
||||
|
||||
@interface MAPIStoreFolderTable : MAPIStoreTable
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREFOLDERTABLE_H */
|
||||
@@ -1,118 +0,0 @@
|
||||
/* MAPIStoreFolderTable.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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/NSArray.h>
|
||||
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import "MAPIStoreFolder.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
|
||||
#import "MAPIStoreFolderTable.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
#include <mapistore/mapistore_nameid.h>
|
||||
#include <libmapiproxy.h>
|
||||
|
||||
@implementation MAPIStoreFolderTable
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
tableType = MAPISTORE_FOLDER_TABLE;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSArray *) childKeys
|
||||
{
|
||||
if (!childKeys)
|
||||
{
|
||||
childKeys = [(MAPIStoreFolder *)
|
||||
container folderKeysMatchingQualifier: nil
|
||||
andSortOrderings: sortOrderings];
|
||||
[childKeys retain];
|
||||
}
|
||||
|
||||
return childKeys;
|
||||
}
|
||||
|
||||
- (NSArray *) restrictedChildKeys
|
||||
{
|
||||
NSArray *keys;
|
||||
|
||||
/* FIXME: restrictions are ignored on folder tables */
|
||||
|
||||
if (!restrictedChildKeys)
|
||||
{
|
||||
if (restrictionState != MAPIRestrictionStateAlwaysTrue)
|
||||
{
|
||||
if (restrictionState == MAPIRestrictionStateNeedsEval)
|
||||
keys = [(MAPIStoreFolder *)
|
||||
container folderKeysMatchingQualifier: restriction
|
||||
andSortOrderings: sortOrderings];
|
||||
else
|
||||
keys = [NSArray array];
|
||||
}
|
||||
else
|
||||
keys = [self childKeys];
|
||||
|
||||
ASSIGN (restrictedChildKeys, keys);
|
||||
}
|
||||
|
||||
return restrictedChildKeys;
|
||||
}
|
||||
|
||||
- (MAPIRestrictionState) evaluatePropertyRestriction: (struct mapi_SPropertyRestriction *) res
|
||||
intoQualifier: (EOQualifier **) qualifier
|
||||
{
|
||||
MAPIRestrictionState rc;
|
||||
|
||||
switch ((uint32_t) res->ulPropTag)
|
||||
{
|
||||
/* HACK: we cheat here as we current have no mechanism for searching
|
||||
folders based on PR_CHANGE_NUM, which is used by the oxcfxics
|
||||
mechanism... */
|
||||
case PidTagChangeNumber:
|
||||
rc = MAPIRestrictionStateAlwaysTrue;
|
||||
break;
|
||||
default:
|
||||
rc = [super evaluatePropertyRestriction: res intoQualifier: qualifier];
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (id) lookupChild: (NSString *) childKey
|
||||
{
|
||||
return [(MAPIStoreFolder *) container lookupFolder: childKey];
|
||||
}
|
||||
|
||||
- (NSString *) backendIdentifierForProperty: (enum MAPITAGS) property
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,37 +0,0 @@
|
||||
/* MAPIStoreGCSBaseContext.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc.
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREGCSBASECONTEXT_H
|
||||
#define MAPISTOREGCSBASECONTEXT_H
|
||||
|
||||
#import "MAPIStoreContext.h"
|
||||
|
||||
@class EOQualifier;
|
||||
|
||||
@interface MAPIStoreGCSBaseContext : MAPIStoreContext
|
||||
|
||||
+ (NSString *) folderNameSuffix;
|
||||
+ (NSString *) getFolderDisplayName: (NSString *) sogoDisplayName;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREGCSBASECONTEXT_H */
|
||||
@@ -1,145 +0,0 @@
|
||||
/* MAPIStoreGCSBaseContext.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc.
|
||||
*
|
||||
* 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
|
||||
* 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/NSArray.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <SOGo/SOGoGCSFolder.h>
|
||||
#import <SOGo/SOGoParentFolder.h>
|
||||
|
||||
#import "MAPIApplication.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreGCSBaseContext.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
#include <dlinklist.h>
|
||||
|
||||
@implementation MAPIStoreGCSBaseContext
|
||||
|
||||
+ (NSString *) MAPIModuleName
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSString *) folderNameSuffix
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
|
||||
+ (NSString *) getFolderDisplayName: (NSString *) sogoDisplayName
|
||||
{
|
||||
NSString *suffix, *displayName;
|
||||
|
||||
suffix = [self folderNameSuffix];
|
||||
if ([suffix length] > 0 && ![sogoDisplayName hasSuffix: suffix])
|
||||
displayName = [NSString stringWithFormat: @"%@ (%@)",
|
||||
sogoDisplayName, suffix];
|
||||
else
|
||||
displayName = sogoDisplayName;
|
||||
|
||||
return displayName;
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||
withIndexing: (struct indexing_context *) indexing
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
struct mapistore_contexts_list *firstContext = NULL, *context;
|
||||
NSString *moduleName, *baseUrl, *url, *nameInContainer, *displayName;
|
||||
NSArray *subfolders;
|
||||
MAPIStoreUserContext *userContext;
|
||||
SOGoParentFolder *parentFolder;
|
||||
NSUInteger count, max;
|
||||
SOGoGCSFolder *currentFolder;
|
||||
|
||||
moduleName = [self MAPIModuleName];
|
||||
if (moduleName)
|
||||
{
|
||||
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||
andTDBIndexing: indexing];
|
||||
parentFolder = [[userContext rootFolders] objectForKey: moduleName];
|
||||
baseUrl = [NSString stringWithFormat: @"sogo://%@@%@/",
|
||||
[userName stringByReplacingOccurrencesOfString: @"@"
|
||||
withString: @"%40"],
|
||||
moduleName];
|
||||
|
||||
subfolders = [parentFolder subFolders];
|
||||
max = [subfolders count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
currentFolder = [subfolders objectAtIndex: count];
|
||||
if ([[currentFolder ownerInContext: nil] isEqualToString: userName])
|
||||
{
|
||||
context = talloc_zero (memCtx, struct mapistore_contexts_list);
|
||||
nameInContainer = [currentFolder nameInContainer];
|
||||
url = [NSString stringWithFormat: @"%@%@", baseUrl, nameInContainer];
|
||||
context->url = [url asUnicodeInMemCtx: context];
|
||||
displayName = [self getFolderDisplayName: [currentFolder displayName]];
|
||||
context->name = [displayName asUnicodeInMemCtx: context];
|
||||
context->main_folder = [nameInContainer isEqualToString: @"personal"];
|
||||
context->role = [self MAPIContextRole];
|
||||
context->tag = "tag";
|
||||
DLIST_ADD_END (firstContext, context, void);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return firstContext;
|
||||
}
|
||||
|
||||
+ (NSString *)
|
||||
createRootSecondaryFolderWithFID: (uint64_t) fid
|
||||
andName: (NSString *) folderName
|
||||
forUser: (NSString *) userName
|
||||
{
|
||||
NSString *mapistoreURI, *nameInContainer, *moduleName;
|
||||
MAPIStoreUserContext *userContext;
|
||||
SOGoParentFolder *parentFolder;
|
||||
|
||||
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||
andTDBIndexing: NULL];
|
||||
moduleName = [self MAPIModuleName];
|
||||
parentFolder = [[userContext rootFolders] objectForKey: moduleName];
|
||||
nameInContainer = nil;
|
||||
|
||||
if (![parentFolder newFolderWithName: folderName
|
||||
nameInContainer: &nameInContainer])
|
||||
mapistoreURI = [NSString stringWithFormat: @"sogo://%@@%@/%@/",
|
||||
[userName stringByReplacingOccurrencesOfString: @"@"
|
||||
withString: @"%40"],
|
||||
moduleName, nameInContainer];
|
||||
else
|
||||
mapistoreURI = nil;
|
||||
|
||||
return mapistoreURI;
|
||||
}
|
||||
|
||||
- (id) rootSOGoFolder
|
||||
{
|
||||
return [[userContext rootFolders] objectForKey: [isa MAPIModuleName]];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,64 +0,0 @@
|
||||
/* MAPIStoreGCSFolder.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREGCSFOLDER_H
|
||||
#define MAPISTOREGCSFOLDER_H
|
||||
|
||||
#import "MAPIStoreFolder.h"
|
||||
|
||||
@class NSArray;
|
||||
@class NSCalendarDate;
|
||||
@class NSData;
|
||||
@class NSMutableDictionary;
|
||||
@class NSNumber;
|
||||
@class NSString;
|
||||
|
||||
@interface MAPIStoreGCSFolder : MAPIStoreFolder
|
||||
{
|
||||
SOGoMAPIDBMessage *versionsMessage;
|
||||
NSArray *activeUserRoles;
|
||||
EOQualifier *componentQualifier;
|
||||
}
|
||||
|
||||
/* synchronisation */
|
||||
- (BOOL) synchroniseCache;
|
||||
- (BOOL) synchroniseCacheFor: (NSString *) nameInContainer;
|
||||
- (void) updateVersionsForMessageWithKey: (NSString *) messageKey
|
||||
withChangeKey: (NSData *) oldChangeKey
|
||||
andPredecessorChangeList: (NSData *) pcl;
|
||||
- (NSNumber *) lastModifiedFromMessageChangeNumber: (NSString *) changeNumber;
|
||||
- (NSString *) changeNumberForMessageWithKey: (NSString *) messageKey;
|
||||
- (NSData *) changeKeyForMessageWithKey: (NSString *) messageKey;
|
||||
- (NSData *) predecessorChangeListForMessageWithKey: (NSString *) messageKey;
|
||||
|
||||
- (NSArray *) activeUserRoles;
|
||||
|
||||
- (EOQualifier *) componentQualifier;
|
||||
- (EOQualifier *) contentComponentQualifier;
|
||||
|
||||
/* subclasses */
|
||||
- (EOQualifier *) aclQualifier;
|
||||
- (NSString *) component;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREGCSFOLDER_H */
|
||||
@@ -1,893 +0,0 @@
|
||||
/* MAPIStoreGCSFolder.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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/NSCalendarDate.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSException.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <NGExtensions/NSObject+Values.h>
|
||||
#import <EOControl/EOQualifier.h>
|
||||
#import <EOControl/EOFetchSpecification.h>
|
||||
#import <EOControl/EOSortOrdering.h>
|
||||
#import <GDLContentStore/GCSFolder.h>
|
||||
#import <SOGo/NSArray+Utilities.h>
|
||||
#import <SOGo/SOGoGCSFolder.h>
|
||||
#import <SOGo/SOGoParentFolder.h>
|
||||
#import <SOGo/SOGoPermissions.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
|
||||
#import "MAPIStoreGCSBaseContext.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSDate+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
#import "SOGoMAPIDBMessage.h"
|
||||
|
||||
#import "MAPIStoreGCSFolder.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
|
||||
static Class NSNumberK;
|
||||
|
||||
@implementation MAPIStoreGCSFolder
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
NSNumberK = [NSNumber class];
|
||||
}
|
||||
|
||||
- (id) initWithSOGoObject: (id) newSOGoObject
|
||||
inContainer: (MAPIStoreObject *) newContainer
|
||||
{
|
||||
if ((self = [super initWithSOGoObject: newSOGoObject inContainer: newContainer]))
|
||||
{
|
||||
activeUserRoles = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) setupVersionsMessage
|
||||
{
|
||||
ASSIGN (versionsMessage,
|
||||
[SOGoMAPIDBMessage objectWithName: @"versions.plist"
|
||||
inContainer: dbFolder]);
|
||||
[versionsMessage setObjectType: MAPIInternalCacheObject];
|
||||
[versionsMessage reloadIfNeeded];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[versionsMessage release];
|
||||
[activeUserRoles release];
|
||||
[componentQualifier release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) deleteFolder
|
||||
{
|
||||
enum mapistore_error rc;
|
||||
NSException *error;
|
||||
NSString *name;
|
||||
|
||||
name = [self nameInContainer];
|
||||
if ([name isEqualToString: @"personal"])
|
||||
rc = MAPISTORE_ERR_DENIED;
|
||||
else
|
||||
{
|
||||
[[sogoObject container] removeSubFolder: name];
|
||||
error = [(SOGoGCSFolder *) sogoObject delete];
|
||||
if (error)
|
||||
rc = MAPISTORE_ERROR;
|
||||
else
|
||||
{
|
||||
if (![versionsMessage delete])
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
else
|
||||
rc = MAPISTORE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return (rc == MAPISTORE_SUCCESS) ? [super deleteFolder] : rc;
|
||||
}
|
||||
|
||||
- (void) setDisplayName: (NSString *) newDisplayName
|
||||
{
|
||||
NSString *suffix, *fullSuffix;
|
||||
Class cClass;
|
||||
|
||||
cClass = [(MAPIStoreGCSBaseContext *) [self context] class];
|
||||
|
||||
/* if a suffix exists, we strip it from the final name */
|
||||
suffix = [cClass folderNameSuffix];
|
||||
if ([suffix length] > 0)
|
||||
{
|
||||
fullSuffix = [NSString stringWithFormat: @"(%@)", suffix];
|
||||
if ([newDisplayName hasSuffix: fullSuffix])
|
||||
{
|
||||
newDisplayName = [newDisplayName substringToIndex:
|
||||
[newDisplayName length]
|
||||
- [fullSuffix length]];
|
||||
newDisplayName = [newDisplayName stringByTrimmingSpaces];
|
||||
}
|
||||
}
|
||||
|
||||
if (![[sogoObject displayName] isEqualToString: newDisplayName])
|
||||
[sogoObject renameTo: newDisplayName];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagDisplayName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
NSString *displayName;
|
||||
Class cClass;
|
||||
|
||||
cClass = [(MAPIStoreGCSBaseContext *) [self context] class];
|
||||
displayName = [cClass getFolderDisplayName: [sogoObject displayName]];
|
||||
*data = [displayName asUnicodeInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (void) addProperties: (NSDictionary *) newProperties
|
||||
{
|
||||
NSString *newDisplayName;
|
||||
NSMutableDictionary *propsCopy;
|
||||
NSNumber *key;
|
||||
|
||||
key = MAPIPropertyKey (PR_DISPLAY_NAME_UNICODE);
|
||||
newDisplayName = [newProperties objectForKey: key];
|
||||
if (newDisplayName)
|
||||
{
|
||||
[self setDisplayName: newDisplayName];
|
||||
propsCopy = [newProperties mutableCopy];
|
||||
[propsCopy removeObjectForKey: key];
|
||||
[propsCopy autorelease];
|
||||
newProperties = propsCopy;
|
||||
}
|
||||
|
||||
[super addProperties: newProperties];
|
||||
}
|
||||
|
||||
- (NSArray *) messageKeysMatchingQualifier: (EOQualifier *) qualifier
|
||||
andSortOrderings: (NSArray *) sortOrderings
|
||||
{
|
||||
static NSArray *fields = nil;
|
||||
SOGoUser *ownerUser;
|
||||
NSArray *records;
|
||||
NSMutableArray *qualifierArray;
|
||||
EOQualifier *fetchQualifier, *aclQualifier;
|
||||
GCSFolder *ocsFolder;
|
||||
EOFetchSpecification *fs;
|
||||
NSArray *keys;
|
||||
|
||||
if (!fields)
|
||||
fields = [[NSArray alloc]
|
||||
initWithObjects: @"c_name", @"c_version", nil];
|
||||
|
||||
qualifierArray = [NSMutableArray new];
|
||||
ownerUser = [[self userContext] sogoUser];
|
||||
if (![[context activeUser] isEqual: ownerUser])
|
||||
{
|
||||
aclQualifier = [self aclQualifier];
|
||||
if (aclQualifier)
|
||||
[qualifierArray addObject: aclQualifier];
|
||||
}
|
||||
[qualifierArray addObject: [self componentQualifier]];
|
||||
if (qualifier)
|
||||
[qualifierArray addObject: qualifier];
|
||||
|
||||
fetchQualifier = [[EOAndQualifier alloc]
|
||||
initWithQualifierArray: qualifierArray];
|
||||
|
||||
ocsFolder = [sogoObject ocsFolder];
|
||||
fs = [EOFetchSpecification
|
||||
fetchSpecificationWithEntityName: [ocsFolder folderName]
|
||||
qualifier: fetchQualifier
|
||||
sortOrderings: sortOrderings];
|
||||
[fetchQualifier release];
|
||||
[qualifierArray release];
|
||||
records = [ocsFolder fetchFields: fields fetchSpecification: fs];
|
||||
keys = [records objectsForKey: @"c_name"
|
||||
notFoundMarker: nil];
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
- (NSDate *) lastMessageModificationTime
|
||||
{
|
||||
NSDate *value;
|
||||
NSNumber *ti;
|
||||
|
||||
[self synchroniseCache];
|
||||
|
||||
ti = [[versionsMessage properties]
|
||||
objectForKey: @"SyncLastModificationDate"];
|
||||
if (ti)
|
||||
value = [NSDate dateWithTimeIntervalSince1970: [ti doubleValue]];
|
||||
else
|
||||
value = nil;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
- (SOGoFolder *) aclFolder
|
||||
{
|
||||
return (SOGoFolder *) sogoObject;
|
||||
}
|
||||
|
||||
/* synchronisation */
|
||||
|
||||
/* Tree
|
||||
{
|
||||
SyncLastModseq = x;
|
||||
SyncLastSynchronisationDate = x; ** not updated until something changed
|
||||
Messages = {
|
||||
MessageKey = {
|
||||
Version = x;
|
||||
Modseq = x;
|
||||
Deleted = b;
|
||||
ChangeKey = d;
|
||||
PredecessorChangeList = { guid1 = globcnt1, guid2 ... };
|
||||
};
|
||||
...
|
||||
};
|
||||
VersionMapping = {
|
||||
Version = last-modified;
|
||||
...
|
||||
}
|
||||
}
|
||||
*/
|
||||
- (void) _setChangeKey: (NSData *) changeKey
|
||||
forMessageEntry: (NSMutableDictionary *) messageEntry
|
||||
{
|
||||
struct XID *xid;
|
||||
NSString *guid;
|
||||
NSData *globCnt;
|
||||
NSDictionary *changeKeyDict;
|
||||
NSMutableDictionary *changeList;
|
||||
|
||||
xid = [changeKey asXIDInMemCtx: NULL];
|
||||
guid = [NSString stringWithGUID: &xid->NameSpaceGuid];
|
||||
globCnt = [NSData dataWithBytes: xid->LocalId.data length: xid->LocalId.length];
|
||||
talloc_free (xid);
|
||||
|
||||
/* 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"];
|
||||
if (!changeList)
|
||||
{
|
||||
changeList = [NSMutableDictionary new];
|
||||
[messageEntry setObject: changeList
|
||||
forKey: @"PredecessorChangeList"];
|
||||
[changeList release];
|
||||
}
|
||||
[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)
|
||||
componentQualifier
|
||||
= [[EOKeyValueQualifier alloc] initWithKey: @"c_component"
|
||||
operatorSelector: EOQualifierOperatorEqual
|
||||
value: [self component]];
|
||||
|
||||
return componentQualifier;
|
||||
}
|
||||
|
||||
- (EOQualifier *) contentComponentQualifier
|
||||
{
|
||||
EOQualifier *contentComponentQualifier;
|
||||
NSString *likeString;
|
||||
|
||||
likeString = [NSString stringWithFormat: @"%%BEGIN:%@%%",
|
||||
[[self component] uppercaseString]];
|
||||
contentComponentQualifier = [[EOKeyValueQualifier alloc]
|
||||
initWithKey: @"c_content"
|
||||
operatorSelector: EOQualifierOperatorLike
|
||||
value: likeString];
|
||||
[contentComponentQualifier autorelease];
|
||||
|
||||
return contentComponentQualifier;
|
||||
}
|
||||
|
||||
- (BOOL) synchroniseCache
|
||||
{
|
||||
BOOL rc = YES;
|
||||
uint64_t newChangeNum;
|
||||
NSData *changeKey;
|
||||
NSString *cName, *changeNumber;
|
||||
NSNumber *ti, *lastModificationDate, *cVersion, *cLastModified, *cDeleted;
|
||||
EOFetchSpecification *fs;
|
||||
EOQualifier *searchQualifier, *fetchQualifier;
|
||||
NSUInteger count, max;
|
||||
NSArray *fetchResults, *changeNumbers;
|
||||
NSMutableArray *keys, *modifiedEntries;
|
||||
NSDictionary *result;
|
||||
NSMutableDictionary *currentProperties, *messages, *mapping, *messageEntry;
|
||||
NSCalendarDate *now;
|
||||
GCSFolder *ocsFolder;
|
||||
static NSArray *fields = nil;
|
||||
static EOSortOrdering *sortOrdering = nil;
|
||||
|
||||
/* NOTE: we are using NSString instance for "changeNumber" because
|
||||
NSNumber proved to give very bad performances when used as NSDictionary
|
||||
keys with GNUstep 1.22.1. The bug seems to be solved with 1.24 but many
|
||||
distros still ship an older version. */
|
||||
|
||||
if (!fields)
|
||||
fields = [[NSArray alloc]
|
||||
initWithObjects: @"c_name", @"c_version", @"c_lastmodified",
|
||||
@"c_deleted", nil];
|
||||
|
||||
if (!sortOrdering)
|
||||
{
|
||||
sortOrdering = [EOSortOrdering sortOrderingWithKey: @"c_lastmodified"
|
||||
selector: EOCompareAscending];
|
||||
[sortOrdering retain];
|
||||
}
|
||||
|
||||
[versionsMessage reloadIfNeeded];
|
||||
currentProperties = [versionsMessage properties];
|
||||
|
||||
lastModificationDate = [currentProperties objectForKey: @"SyncLastModificationDate"];
|
||||
if (lastModificationDate)
|
||||
{
|
||||
searchQualifier = [[EOKeyValueQualifier alloc]
|
||||
initWithKey: @"c_lastmodified"
|
||||
operatorSelector: EOQualifierOperatorGreaterThanOrEqualTo
|
||||
value: lastModificationDate];
|
||||
fetchQualifier = [[EOAndQualifier alloc]
|
||||
initWithQualifiers: searchQualifier,
|
||||
[self contentComponentQualifier],
|
||||
nil];
|
||||
[fetchQualifier autorelease];
|
||||
[searchQualifier release];
|
||||
}
|
||||
else
|
||||
fetchQualifier = [self componentQualifier];
|
||||
|
||||
ocsFolder = [sogoObject ocsFolder];
|
||||
fs = [EOFetchSpecification
|
||||
fetchSpecificationWithEntityName: [ocsFolder folderName]
|
||||
qualifier: fetchQualifier
|
||||
sortOrderings: [NSArray arrayWithObject: sortOrdering]];
|
||||
fetchResults = [ocsFolder fetchFields: fields
|
||||
fetchSpecification: fs
|
||||
ignoreDeleted: NO];
|
||||
max = [fetchResults count];
|
||||
if (max > 0)
|
||||
{
|
||||
messages = [currentProperties objectForKey: @"Messages"];
|
||||
if (!messages)
|
||||
{
|
||||
messages = [NSMutableDictionary new];
|
||||
[currentProperties setObject: messages forKey: @"Messages"];
|
||||
[messages release];
|
||||
}
|
||||
mapping = [currentProperties objectForKey: @"VersionMapping"];
|
||||
if (!mapping)
|
||||
{
|
||||
mapping = [NSMutableDictionary new];
|
||||
[currentProperties setObject: mapping forKey: @"VersionMapping"];
|
||||
[mapping release];
|
||||
}
|
||||
|
||||
keys = [NSMutableArray arrayWithCapacity: max];
|
||||
modifiedEntries = [NSMutableArray arrayWithCapacity: max];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
result = [fetchResults objectAtIndex: count];
|
||||
cName = [result objectForKey: @"c_name"];
|
||||
[keys addObject: cName];
|
||||
cDeleted = [result objectForKey: @"c_deleted"];
|
||||
if ([cDeleted isKindOfClass: NSNumberK] && [cDeleted intValue])
|
||||
cVersion = [NSNumber numberWithInt: -1];
|
||||
else
|
||||
cVersion = [result objectForKey: @"c_version"];
|
||||
cLastModified = [result objectForKey: @"c_lastmodified"];
|
||||
|
||||
messageEntry = [messages objectForKey: cName];
|
||||
if (!messageEntry)
|
||||
{
|
||||
messageEntry = [NSMutableDictionary new];
|
||||
[messages setObject: messageEntry forKey: cName];
|
||||
[messageEntry release];
|
||||
}
|
||||
|
||||
if (![[messageEntry objectForKey: @"c_version"]
|
||||
isEqual: cVersion])
|
||||
{
|
||||
[sogoObject removeChildRecordWithName: cName];
|
||||
|
||||
[modifiedEntries addObject: messageEntry];
|
||||
|
||||
[messageEntry setObject: cLastModified forKey: @"c_lastmodified"];
|
||||
[messageEntry setObject: cVersion forKey: @"c_version"];
|
||||
|
||||
if (!lastModificationDate
|
||||
|| ([lastModificationDate compare: cLastModified]
|
||||
== NSOrderedAscending))
|
||||
lastModificationDate = cLastModified;
|
||||
}
|
||||
}
|
||||
|
||||
/* make sure all returned objects have a corresponding mid */
|
||||
[self ensureIDsForChildKeys: keys];
|
||||
|
||||
max = [modifiedEntries count];
|
||||
if (max > 0)
|
||||
{
|
||||
changeNumbers = [[self context] getNewChangeNumbers: max];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
messageEntry = [modifiedEntries objectAtIndex: count];
|
||||
|
||||
changeNumber = [changeNumbers objectAtIndex: count];
|
||||
cLastModified = [messageEntry objectForKey: @"c_lastmodified"];
|
||||
[mapping setObject: cLastModified forKey: changeNumber];
|
||||
[messageEntry setObject: changeNumber forKey: @"version"];
|
||||
|
||||
newChangeNum = [changeNumber unsignedLongLongValue];
|
||||
|
||||
// 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];
|
||||
}
|
||||
|
||||
now = [NSCalendarDate date];
|
||||
ti = [NSNumber numberWithDouble: [now timeIntervalSince1970]];
|
||||
[currentProperties setObject: ti
|
||||
forKey: @"SyncLastSynchronisationDate"];
|
||||
[currentProperties setObject: lastModificationDate
|
||||
forKey: @"SyncLastModificationDate"];
|
||||
[versionsMessage save];
|
||||
}
|
||||
}
|
||||
|
||||
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 *) oldChangeKey
|
||||
andPredecessorChangeList: (NSData *) pcl
|
||||
{
|
||||
NSMutableDictionary *messages, *messageEntry;
|
||||
|
||||
[self synchroniseCache];
|
||||
if (oldChangeKey || pcl)
|
||||
{
|
||||
messages = [[versionsMessage properties] objectForKey: @"Messages"];
|
||||
messageEntry = [messages objectForKey: messageKey];
|
||||
if (!messageEntry)
|
||||
[NSException raise: @"MAPIStoreIOException"
|
||||
format: @"no version record found for message '%@'",
|
||||
messageKey];
|
||||
[self _updatePredecessorChangeList: pcl forMessageEntry: messageEntry
|
||||
withOldChangeKey: oldChangeKey];
|
||||
[versionsMessage save];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSNumber *) lastModifiedFromMessageChangeNumber: (NSString *) changeNumber
|
||||
{
|
||||
NSDictionary *mapping;
|
||||
NSNumber *lastModified;
|
||||
|
||||
mapping = [[versionsMessage properties] objectForKey: @"VersionMapping"];
|
||||
lastModified = [mapping objectForKey: changeNumber];
|
||||
|
||||
return lastModified;
|
||||
}
|
||||
|
||||
- (NSString *) changeNumberForMessageWithKey: (NSString *) messageKey
|
||||
{
|
||||
NSDictionary *messages;
|
||||
NSString *changeNumber;
|
||||
|
||||
messages = [[versionsMessage properties] objectForKey: @"Messages"];
|
||||
changeNumber = [[messages objectForKey: messageKey]
|
||||
objectForKey: @"version"];
|
||||
|
||||
return changeNumber;
|
||||
}
|
||||
|
||||
- (NSData *) changeKeyForMessageWithKey: (NSString *) messageKey
|
||||
{
|
||||
NSDictionary *messages, *changeKeyDict;
|
||||
NSString *guid;
|
||||
NSData *globCnt, *changeKey = nil;
|
||||
|
||||
messages = [[versionsMessage properties] objectForKey: @"Messages"];
|
||||
changeKeyDict = [[messages objectForKey: messageKey]
|
||||
objectForKey: @"ChangeKey"];
|
||||
if (changeKeyDict)
|
||||
{
|
||||
guid = [changeKeyDict objectForKey: @"GUID"];
|
||||
globCnt = [changeKeyDict objectForKey: @"LocalId"];
|
||||
changeKey = [NSData dataWithChangeKeyGUID: guid andCnt: globCnt];
|
||||
}
|
||||
|
||||
return changeKey;
|
||||
}
|
||||
|
||||
- (NSData *) predecessorChangeListForMessageWithKey: (NSString *) messageKey
|
||||
{
|
||||
NSMutableData *list = nil;
|
||||
NSDictionary *messages, *changeListDict;
|
||||
NSArray *keys;
|
||||
NSMutableArray *changeKeys;
|
||||
NSUInteger count, max;
|
||||
NSData *changeKey;
|
||||
NSString *guid;
|
||||
NSData *globCnt;
|
||||
|
||||
messages = [[versionsMessage properties] objectForKey: @"Messages"];
|
||||
changeListDict = [[messages objectForKey: messageKey]
|
||||
objectForKey: @"PredecessorChangeList"];
|
||||
if (changeListDict)
|
||||
{
|
||||
keys = [changeListDict allKeys];
|
||||
max = [keys count];
|
||||
|
||||
changeKeys = [NSMutableArray arrayWithCapacity: max];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
guid = [keys objectAtIndex: count];
|
||||
globCnt = [changeListDict objectForKey: guid];
|
||||
changeKey = [NSData dataWithChangeKeyGUID: guid andCnt: globCnt];
|
||||
[changeKeys addObject: changeKey];
|
||||
}
|
||||
[changeKeys sortUsingFunction: MAPIChangeKeyGUIDCompare
|
||||
context: nil];
|
||||
|
||||
list = [NSMutableData data];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
changeKey = [changeKeys objectAtIndex: count];
|
||||
[list appendUInt8: [changeKey length]];
|
||||
[list appendData: changeKey];
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
- (NSArray *) getDeletedKeysFromChangeNumber: (uint64_t) changeNum
|
||||
andCN: (NSNumber **) cnNbr
|
||||
inTableType: (uint8_t) tableType
|
||||
{
|
||||
NSArray *deletedKeys, *deletedCNames, *records;
|
||||
NSNumber *lastModified;
|
||||
NSString *cName, *changeNumber;
|
||||
NSDictionary *versionProperties, *messageEntry;
|
||||
NSMutableDictionary *messages;
|
||||
uint64_t maxChangeNum = changeNum, currentChangeNum;
|
||||
EOAndQualifier *fetchQualifier;
|
||||
EOKeyValueQualifier *cDeletedQualifier, *cLastModifiedQualifier;
|
||||
EOFetchSpecification *fs;
|
||||
GCSFolder *ocsFolder;
|
||||
NSUInteger count, max;
|
||||
|
||||
if (tableType == MAPISTORE_MESSAGE_TABLE)
|
||||
{
|
||||
deletedKeys = [NSMutableArray array];
|
||||
|
||||
changeNumber = [NSString stringWithUnsignedLongLong: changeNum];
|
||||
lastModified = [self lastModifiedFromMessageChangeNumber: changeNumber];
|
||||
if (lastModified)
|
||||
{
|
||||
versionProperties = [versionsMessage properties];
|
||||
messages = [versionProperties objectForKey: @"Messages"];
|
||||
|
||||
ocsFolder = [sogoObject ocsFolder];
|
||||
cLastModifiedQualifier = [[EOKeyValueQualifier alloc]
|
||||
initWithKey: @"c_lastmodified"
|
||||
operatorSelector: EOQualifierOperatorGreaterThanOrEqualTo
|
||||
value: lastModified];
|
||||
cDeletedQualifier = [[EOKeyValueQualifier alloc]
|
||||
initWithKey: @"c_deleted"
|
||||
operatorSelector: EOQualifierOperatorEqual
|
||||
value: [NSNumber numberWithInt: 1]];
|
||||
fetchQualifier = [[EOAndQualifier alloc] initWithQualifiers:
|
||||
cLastModifiedQualifier,
|
||||
cDeletedQualifier,
|
||||
nil];
|
||||
[fetchQualifier autorelease];
|
||||
[cLastModifiedQualifier release];
|
||||
[cDeletedQualifier release];
|
||||
|
||||
fs = [EOFetchSpecification
|
||||
fetchSpecificationWithEntityName: [ocsFolder folderName]
|
||||
qualifier: fetchQualifier
|
||||
sortOrderings: nil];
|
||||
records = [ocsFolder
|
||||
fetchFields: [NSArray arrayWithObject: @"c_name"]
|
||||
fetchSpecification: fs
|
||||
ignoreDeleted: NO];
|
||||
deletedCNames = [records objectsForKey: @"c_name" notFoundMarker: nil];
|
||||
max = [deletedCNames count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
cName = [deletedCNames objectAtIndex: count];
|
||||
[sogoObject removeChildRecordWithName: cName];
|
||||
messageEntry = [messages objectForKey: cName];
|
||||
if (messageEntry)
|
||||
{
|
||||
currentChangeNum
|
||||
= [[messageEntry objectForKey: @"version"]
|
||||
unsignedLongLongValue];
|
||||
if (MAPICNCompare (changeNum, currentChangeNum, NULL)
|
||||
== NSOrderedAscending)
|
||||
{
|
||||
[(NSMutableArray *) deletedKeys addObject: cName];
|
||||
if (MAPICNCompare (maxChangeNum, currentChangeNum, NULL)
|
||||
== NSOrderedAscending)
|
||||
maxChangeNum = currentChangeNum;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (maxChangeNum != changeNum)
|
||||
*cnNbr = [NSNumber numberWithUnsignedLongLong: maxChangeNum];
|
||||
}
|
||||
}
|
||||
else
|
||||
deletedKeys = [super getDeletedKeysFromChangeNumber: changeNum
|
||||
andCN: cnNbr
|
||||
inTableType: tableType];
|
||||
|
||||
return deletedKeys;
|
||||
}
|
||||
|
||||
- (NSArray *) activeUserRoles
|
||||
{
|
||||
SOGoUser *activeUser;
|
||||
WOContext *woContext;
|
||||
|
||||
if (!activeUserRoles)
|
||||
{
|
||||
activeUser = [[self context] activeUser];
|
||||
woContext = [[self userContext] woContext];
|
||||
activeUserRoles = [activeUser rolesForObject: sogoObject
|
||||
inContext: woContext];
|
||||
activeUserRoles = [self expandRoles: activeUserRoles];
|
||||
[activeUserRoles retain];
|
||||
}
|
||||
|
||||
return activeUserRoles;
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanCreateMessages
|
||||
{
|
||||
return [[self activeUserRoles] containsObject: SOGoRole_ObjectCreator];
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanDeleteMessages
|
||||
{
|
||||
return [[self activeUserRoles] containsObject: SOGoRole_ObjectEraser];
|
||||
}
|
||||
|
||||
/* subclasses */
|
||||
|
||||
- (EOQualifier *) aclQualifier
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *) component
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,44 +0,0 @@
|
||||
/* MAPIStoreGCSMessage.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREGCSMESSAGE_H
|
||||
#define MAPISTOREGCSMESSAGE_H
|
||||
|
||||
#import <SOGo/SOGoUser.h>
|
||||
|
||||
#import "MAPIStoreMessage.h"
|
||||
|
||||
@interface MAPIStoreGCSMessage : MAPIStoreMessage
|
||||
{
|
||||
}
|
||||
|
||||
/* subclass helpers */
|
||||
|
||||
/* Return the message original creator */
|
||||
- (NSString *) creator;
|
||||
- (NSString *) owner;
|
||||
- (SOGoUser *) ownerUser;
|
||||
- (void) updateVersions;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREGCSMESSAGE_H */
|
||||
@@ -1,264 +0,0 @@
|
||||
/* MAPIStoreGCSMessage.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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/NSArray.h>
|
||||
#import <Foundation/NSCalendarDate.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
#import <NGObjWeb/SoSecurityManager.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <NGExtensions/NSObject+Values.h>
|
||||
#import <SOGo/SOGoContentObject.h>
|
||||
#import <SOGo/SOGoPermissions.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
|
||||
#import "MAPIStoreContext.h"
|
||||
#import "MAPIStoreGCSFolder.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreGCSMessage.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
|
||||
@implementation MAPIStoreGCSMessage
|
||||
|
||||
- (NSDate *) creationTime
|
||||
{
|
||||
return [sogoObject creationDate];
|
||||
}
|
||||
|
||||
- (NSDate *) lastModificationTime
|
||||
{
|
||||
return [sogoObject lastModified];
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagCreatorName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
enum mapistore_error rc;
|
||||
NSString *creator;
|
||||
|
||||
creator = [self creator];
|
||||
if (creator)
|
||||
{
|
||||
*data = [creator asUnicodeInMemCtx: memCtx];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
else
|
||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagChangeKey: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
enum mapistore_error rc = MAPISTORE_SUCCESS;
|
||||
NSData *changeKey;
|
||||
MAPIStoreGCSFolder *parentFolder;
|
||||
NSString *nameInContainer;
|
||||
|
||||
if (isNew)
|
||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
else
|
||||
{
|
||||
parentFolder = (MAPIStoreGCSFolder *)[self container];
|
||||
nameInContainer = [self nameInContainer];
|
||||
changeKey = [parentFolder changeKeyForMessageWithKey: nameInContainer];
|
||||
if (!changeKey)
|
||||
{
|
||||
[parentFolder synchroniseCache];
|
||||
changeKey = [parentFolder changeKeyForMessageWithKey: nameInContainer];
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
- (enum mapistore_error) getPidTagPredecessorChangeList: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
enum mapistore_error rc = MAPISTORE_SUCCESS;
|
||||
NSData *changeList;
|
||||
MAPIStoreGCSFolder *parentFolder;
|
||||
|
||||
if (isNew)
|
||||
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||
else
|
||||
{
|
||||
parentFolder = (MAPIStoreGCSFolder *)[self container];
|
||||
changeList = [parentFolder
|
||||
predecessorChangeListForMessageWithKey: [self nameInContainer]];
|
||||
if (!changeList)
|
||||
{
|
||||
[parentFolder synchroniseCache];
|
||||
changeList = [parentFolder
|
||||
predecessorChangeListForMessageWithKey: [self nameInContainer]];
|
||||
}
|
||||
if (!changeList)
|
||||
abort ();
|
||||
*data = [changeList asBinaryInMemCtx: memCtx];
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (uint64_t) objectVersion
|
||||
{
|
||||
uint64_t version = ULLONG_MAX;
|
||||
NSString *changeNumber;
|
||||
BOOL synced;
|
||||
|
||||
if (!isNew)
|
||||
{
|
||||
changeNumber = [(MAPIStoreGCSFolder *) container
|
||||
changeNumberForMessageWithKey: [self nameInContainer]];
|
||||
if (!changeNumber)
|
||||
{
|
||||
[self warnWithFormat: @"attempting to get change number"
|
||||
@" by synchronising folder..."];
|
||||
synced = [(MAPIStoreGCSFolder *) container synchroniseCache];
|
||||
if (synced)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
- (void) updateVersions
|
||||
{
|
||||
/* 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
|
||||
andPredecessorChangeList: predecessorChangeList];
|
||||
}
|
||||
|
||||
//----------------------
|
||||
// Sharing
|
||||
//----------------------
|
||||
|
||||
- (NSString *) creator
|
||||
{
|
||||
return [self owner];
|
||||
}
|
||||
|
||||
- (NSString *) owner
|
||||
{
|
||||
return [sogoObject ownerInContext: nil];
|
||||
}
|
||||
|
||||
- (SOGoUser *) ownerUser
|
||||
{
|
||||
NSString *ownerName;
|
||||
SOGoUser *owner = nil;
|
||||
|
||||
ownerName = [self owner];
|
||||
if ([ownerName length] != 0)
|
||||
owner = [SOGoUser userWithLogin: ownerName];
|
||||
|
||||
return owner;
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanModifyMessage
|
||||
{
|
||||
BOOL rc;
|
||||
NSArray *roles;
|
||||
|
||||
roles = [self activeUserRoles];
|
||||
|
||||
if (isNew)
|
||||
rc = [roles containsObject: SOGoRole_ObjectCreator];
|
||||
else
|
||||
rc = [roles containsObject: SOGoRole_ObjectEditor];
|
||||
|
||||
/* Check if the message is owned and it has permission to edit it */
|
||||
if (!rc && [roles containsObject: MAPIStoreRightEditOwn])
|
||||
rc = [[[container context] activeUser] isEqual: [self ownerUser]];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanDeleteMessage
|
||||
{
|
||||
BOOL rc;
|
||||
NSArray *roles;
|
||||
|
||||
roles = [self activeUserRoles];
|
||||
rc = [roles containsObject: SOGoRole_ObjectEraser];
|
||||
|
||||
/* Check if the message is owned and it has permission to delete it */
|
||||
if (!rc && [roles containsObject: MAPIStoreRightDeleteOwn])
|
||||
{
|
||||
NSString *currentUser;
|
||||
|
||||
currentUser = [[container context] activeUser];
|
||||
rc = [currentUser isEqual: [self ownerUser]];
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,36 +0,0 @@
|
||||
/* MAPIStoreGCSMessageTable.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010-2012 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* 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 MAPISTOREGCSMESSAGETABLE_H
|
||||
#define MAPISTOREGCSMESSAGETABLE_H
|
||||
|
||||
#import "MAPIStoreMessageTable.h"
|
||||
|
||||
@class EOQualifier;
|
||||
|
||||
@interface MAPIStoreGCSMessageTable : MAPIStoreMessageTable
|
||||
|
||||
- (NSString *) sortIdentifierForProperty: (enum MAPITAGS) property;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MAPISTOREGCSMESSAGETABLE_H */
|
||||
Loaded 100 of 1263 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user