Merge lp:~renatofilho/indicator-datetime/fix-1508438 into lp:indicator-datetime/15.10
- fix-1508438
- Merge into trunk.15.10
Status: | Merged |
---|---|
Approved by: | Charles Kerr |
Approved revision: | 453 |
Merged at revision: | 446 |
Proposed branch: | lp:~renatofilho/indicator-datetime/fix-1508438 |
Merge into: | lp:indicator-datetime/15.10 |
Diff against target: |
1145 lines (+497/-214) 20 files modified
CMakeLists.txt (+3/-2) debian/control (+2/-0) include/datetime/engine-eds.h (+3/-2) include/datetime/myself.h (+62/-0) src/CMakeLists.txt (+1/-0) src/engine-eds.cpp (+185/-196) src/main.cpp (+2/-1) src/myself.cpp (+76/-0) tests/CMakeLists.txt (+3/-1) tests/run-eds-ics-test.sh (+9/-1) tests/test-eds-ics-all-day-events.cpp (+3/-2) tests/test-eds-ics-missing-trigger.cpp (+2/-1) tests/test-eds-ics-non-attending-alarms.cpp (+79/-0) tests/test-eds-ics-non-attending-alarms.ics.in (+53/-0) tests/test-eds-ics-nonrepeating-events.cpp (+3/-2) tests/test-eds-ics-repeating-events.cpp (+3/-2) tests/test-eds-ics-repeating-valarms.cpp (+2/-1) tests/test-eds-ics-tzids-2.cpp (+2/-1) tests/test-eds-ics-tzids-utc.cpp (+2/-1) tests/test-eds-ics-tzids.cpp (+2/-1) |
To merge this branch: | bzr merge lp:~renatofilho/indicator-datetime/fix-1508438 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Charles Kerr (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Arthur Mello (community) | Approve | ||
Review via email: mp+290502@code.launchpad.net |
Commit message
Ignore alarms for events marked as not attending.
Description of the change
How To test:
1 - Create a event on google calendar in the next minutes
2 - Mark the event as not attending
3 - On phone sync your calendar
3.1 - Make sure that the new event appears on your calendar app
4 - Make sure that the event does not show on indicator
5 - Wait until the event starts and make sure that no alarm is played.
Renato Araujo Oliveira Filho (renatofilho) : | # |
Charles Kerr (charlesk) : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:449
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Charles Kerr (charlesk) : | # |
Charles Kerr (charlesk) wrote : | # |
The code looks fine.
It may be an issue on my system, but I'm getting inconsistent test failures when I run ctest in a repeat-until-fail loop. I suspect this is a timing issue in the test setup rather than a bug in the new code.
Renato Araujo Oliveira Filho (renatofilho) wrote : | # |
any specific tets?
- 452. By Renato Araujo Oliveira Filho
-
Does not free list that was used on concat.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:452
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Charles Kerr (charlesk) : | # |
- 453. By Renato Araujo Oliveira Filho
-
Reduce libaccounts-
glib-dev required version.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:453
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Charles Kerr (charlesk) : | # |
- 454. By Renato Araujo Oliveira Filho
-
Trunk merged.
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2016-02-03 16:33:39 +0000 |
3 | +++ CMakeLists.txt 2016-04-19 02:46:55 +0000 |
4 | @@ -20,7 +20,7 @@ |
5 | |
6 | ## |
7 | ## GNU standard installation directories |
8 | -## |
9 | +## |
10 | |
11 | include (GNUInstallDirs) |
12 | if (EXISTS "/etc/debian_version") # Workaround for libexecdir on debian |
13 | @@ -47,7 +47,8 @@ |
14 | gstreamer-1.0>=1.2 |
15 | libnotify>=0.7.6 |
16 | url-dispatcher-1>=1 |
17 | - properties-cpp>=0.0.1) |
18 | + properties-cpp>=0.0.1 |
19 | + libaccounts-glib>=1.18) |
20 | include_directories (SYSTEM ${SERVICE_DEPS_INCLUDE_DIRS}) |
21 | |
22 | ## |
23 | |
24 | === modified file 'debian/control' |
25 | --- debian/control 2016-03-10 16:20:36 +0000 |
26 | +++ debian/control 2016-04-19 02:46:55 +0000 |
27 | @@ -29,6 +29,8 @@ |
28 | gvfs-daemons, |
29 | # for phone alarm/calendar notification sound tests: |
30 | ubuntu-touch-sounds, |
31 | +# for query user e-mails based on accounts |
32 | + libaccounts-glib-dev, |
33 | Standards-Version: 3.9.3 |
34 | Homepage: https://launchpad.net/indicator-datetime |
35 | # If you aren't a member of ~indicator-applet-developers but need to upload |
36 | |
37 | === modified file 'include/datetime/engine-eds.h' |
38 | --- include/datetime/engine-eds.h 2014-12-08 02:52:50 +0000 |
39 | +++ include/datetime/engine-eds.h 2016-04-19 02:46:55 +0000 |
40 | @@ -36,16 +36,17 @@ |
41 | /**** |
42 | ***** |
43 | ****/ |
44 | +class Myself; |
45 | |
46 | /** |
47 | * Class wrapper around EDS so multiple #EdsPlanners can share resources |
48 | - * |
49 | + * |
50 | * @see EdsPlanner |
51 | */ |
52 | class EdsEngine: public Engine |
53 | { |
54 | public: |
55 | - EdsEngine(); |
56 | + EdsEngine(const std::shared_ptr<Myself> &myself); |
57 | ~EdsEngine(); |
58 | |
59 | void get_appointments(const DateTime& begin, |
60 | |
61 | === added file 'include/datetime/myself.h' |
62 | --- include/datetime/myself.h 1970-01-01 00:00:00 +0000 |
63 | +++ include/datetime/myself.h 2016-04-19 02:46:55 +0000 |
64 | @@ -0,0 +1,62 @@ |
65 | +/* |
66 | + * Copyright 2016 Canonical Ltd. |
67 | + * |
68 | + * This program is free software: you can redistribute it and/or modify it |
69 | + * under the terms of the GNU General Public License version 3, as published |
70 | + * by the Free Software Foundation. |
71 | + * |
72 | + * This program is distributed in the hope that it will be useful, but |
73 | + * WITHOUT ANY WARRANTY; without even the implied warranties of |
74 | + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
75 | + * PURPOSE. See the GNU General Public License for more details. |
76 | + * |
77 | + * You should have received a copy of the GNU General Public License along |
78 | + * with this program. If not, see <http://www.gnu.org/licenses/>. |
79 | + * |
80 | + * Authors: |
81 | + * Renato Araujo Oliveira Filho <renato.filho@canonical.com> |
82 | + */ |
83 | + |
84 | +#ifndef INDICATOR_DATETIME_MYSELF_H |
85 | +#define INDICATOR_DATETIME_MYSELF_H |
86 | + |
87 | +#include <core/property.h> |
88 | + |
89 | +#include <string> |
90 | +#include <set> |
91 | +#include <memory.h> |
92 | +#include <glib.h> |
93 | + |
94 | +typedef struct _AgManager AgManager; |
95 | + |
96 | +namespace unity { |
97 | +namespace indicator { |
98 | +namespace datetime { |
99 | + |
100 | +class Myself |
101 | +{ |
102 | +public: |
103 | + Myself(); |
104 | + |
105 | + const core::Property<std::set<std::string>>& emails() |
106 | + { |
107 | + return m_emails; |
108 | + } |
109 | + |
110 | + bool isMyEmail(const std::string &email); |
111 | + |
112 | +private: |
113 | + std::shared_ptr<AgManager> m_accounts_manager; |
114 | + core::Property<std::set<std::string> > m_emails; |
115 | + |
116 | + static void on_accounts_changed(AgManager*, guint, Myself*); |
117 | + void reloadEmails(); |
118 | + |
119 | +}; |
120 | + |
121 | + |
122 | +} // namespace datetime |
123 | +} // namespace indicator |
124 | +} // namespace unity |
125 | + |
126 | +#endif // INDICATOR_DATETIME_MYSELF_H |
127 | |
128 | === modified file 'src/CMakeLists.txt' |
129 | --- src/CMakeLists.txt 2015-09-01 09:52:13 +0000 |
130 | +++ src/CMakeLists.txt 2016-04-19 02:46:55 +0000 |
131 | @@ -23,6 +23,7 @@ |
132 | locations.cpp |
133 | locations-settings.cpp |
134 | menu.cpp |
135 | + myself.cpp |
136 | notifications.cpp |
137 | planner.cpp |
138 | planner-aggregate.cpp |
139 | |
140 | === modified file 'src/engine-eds.cpp' |
141 | --- src/engine-eds.cpp 2016-03-22 19:32:25 +0000 |
142 | +++ src/engine-eds.cpp 2016-04-19 02:46:55 +0000 |
143 | @@ -18,6 +18,7 @@ |
144 | */ |
145 | |
146 | #include <datetime/engine-eds.h> |
147 | +#include <datetime/myself.h> |
148 | |
149 | #include <libical/ical.h> |
150 | #include <libical/icaltime.h> |
151 | @@ -48,7 +49,8 @@ |
152 | { |
153 | public: |
154 | |
155 | - Impl() |
156 | + Impl(const std::shared_ptr<Myself> &myself) |
157 | + : m_myself(myself) |
158 | { |
159 | auto cancellable_deleter = [](GCancellable * c) { |
160 | g_cancellable_cancel(c); |
161 | @@ -56,8 +58,10 @@ |
162 | }; |
163 | |
164 | m_cancellable = std::shared_ptr<GCancellable>(g_cancellable_new(), cancellable_deleter); |
165 | - |
166 | e_source_registry_new(m_cancellable.get(), on_source_registry_ready, this); |
167 | + m_myself->emails().changed().connect([this](const std::set<std::string> &) { |
168 | + set_dirty_soon(); |
169 | + }); |
170 | } |
171 | |
172 | ~Impl() |
173 | @@ -92,26 +96,19 @@ |
174 | /** |
175 | *** init the default timezone |
176 | **/ |
177 | - |
178 | icaltimezone * default_timezone = nullptr; |
179 | const auto tz = timezone.timezone.get().c_str(); |
180 | - if (tz && *tz) |
181 | - { |
182 | - default_timezone = icaltimezone_get_builtin_timezone(tz); |
183 | - |
184 | - if (default_timezone == nullptr) // maybe str is a tzid? |
185 | - default_timezone = icaltimezone_get_builtin_timezone_from_tzid(tz); |
186 | - |
187 | - g_debug("default_timezone is %p", (void*)default_timezone); |
188 | + auto gtz = timezone_from_name(tz, nullptr, nullptr, &default_timezone); |
189 | + if (gtz == nullptr) { |
190 | + gtz = g_time_zone_new_local(); |
191 | } |
192 | |
193 | + g_debug("default_timezone is %s", default_timezone ? icaltimezone_get_display_name(default_timezone) : "null"); |
194 | + |
195 | /** |
196 | *** walk through the sources to build the appointment list |
197 | **/ |
198 | |
199 | - auto gtz = default_timezone != nullptr |
200 | - ? g_time_zone_new(icaltimezone_get_location(default_timezone)) |
201 | - : g_time_zone_new_local(); |
202 | auto main_task = std::make_shared<Task>(this, func, default_timezone, gtz, begin, end); |
203 | |
204 | for (auto& kv : m_clients) |
205 | @@ -125,35 +122,14 @@ |
206 | auto extension = e_source_get_extension(source, E_SOURCE_EXTENSION_CALENDAR); |
207 | const auto color = e_source_selectable_get_color(E_SOURCE_SELECTABLE(extension)); |
208 | |
209 | - auto begin_str = isodate_from_time_t(begin.to_unix()); |
210 | - auto end_str = isodate_from_time_t(end.to_unix()); |
211 | - auto sexp_fmt = g_strdup_printf("(%%s? (make-time \"%s\") (make-time \"%s\"))", begin_str, end_str); |
212 | - g_clear_pointer(&begin_str, g_free); |
213 | - g_clear_pointer(&end_str, g_free); |
214 | - |
215 | - // ask EDS about alarms that occur in this window... |
216 | - auto sexp = g_strdup_printf(sexp_fmt, "has-alarms-in-range"); |
217 | - g_debug("%s alarm sexp is %s", G_STRLOC, sexp); |
218 | - e_cal_client_get_object_list_as_comps( |
219 | - client, |
220 | - sexp, |
221 | - m_cancellable.get(), |
222 | - on_alarm_component_list_ready, |
223 | - new ClientSubtask(main_task, client, m_cancellable, color)); |
224 | - g_clear_pointer(&sexp, g_free); |
225 | - |
226 | - // ask EDS about events that occur in this window... |
227 | - sexp = g_strdup_printf(sexp_fmt, "occur-in-time-range"); |
228 | - g_debug("%s event sexp is %s", G_STRLOC, sexp); |
229 | - e_cal_client_get_object_list_as_comps( |
230 | - client, |
231 | - sexp, |
232 | - m_cancellable.get(), |
233 | - on_event_component_list_ready, |
234 | - new ClientSubtask(main_task, client, m_cancellable, color)); |
235 | - g_clear_pointer(&sexp, g_free); |
236 | - |
237 | - g_clear_pointer(&sexp_fmt, g_free); |
238 | + e_cal_client_generate_instances( |
239 | + client, |
240 | + begin.to_unix(), |
241 | + end.to_unix(), |
242 | + m_cancellable.get(), |
243 | + on_event_generated, |
244 | + new ClientSubtask(main_task, client, m_cancellable, color), |
245 | + on_event_generated_list_ready); |
246 | } |
247 | } |
248 | |
249 | @@ -591,6 +567,8 @@ |
250 | ECalClient* client; |
251 | std::shared_ptr<GCancellable> cancellable; |
252 | std::string color; |
253 | + GList *components; |
254 | + GList *instance_components; |
255 | |
256 | ClientSubtask(const std::shared_ptr<Task>& task_in, |
257 | ECalClient* client_in, |
258 | @@ -598,10 +576,13 @@ |
259 | const char* color_in): |
260 | task(task_in), |
261 | client(client_in), |
262 | - cancellable(cancellable_in) |
263 | + cancellable(cancellable_in), |
264 | + components(nullptr), |
265 | + instance_components(nullptr) |
266 | { |
267 | if (color_in) |
268 | color = color_in; |
269 | + |
270 | } |
271 | }; |
272 | |
273 | @@ -648,87 +629,122 @@ |
274 | return ret; |
275 | } |
276 | |
277 | - static void |
278 | - on_alarm_component_list_ready(GObject * oclient, |
279 | - GAsyncResult * res, |
280 | - gpointer gsubtask) |
281 | - { |
282 | - GError * error = NULL; |
283 | - GSList * comps_slist = NULL; |
284 | - auto subtask = static_cast<ClientSubtask*>(gsubtask); |
285 | - |
286 | - if (e_cal_client_get_object_list_as_comps_finish(E_CAL_CLIENT(oclient), |
287 | - res, |
288 | - &comps_slist, |
289 | - &error)) |
290 | - { |
291 | - // _generate_alarms takes a GList, so make a shallow one |
292 | - GList * comps_list = nullptr; |
293 | - for (auto l=comps_slist; l!=nullptr; l=l->next) |
294 | - comps_list = g_list_prepend(comps_list, l->data); |
295 | - |
296 | - constexpr std::array<ECalComponentAlarmAction,1> omit = { |
297 | - (ECalComponentAlarmAction)-1 |
298 | - }; // list of action types to omit, terminated with -1 |
299 | - GSList * comp_alarms = nullptr; |
300 | - e_cal_util_generate_alarms_for_list( |
301 | - comps_list, |
302 | - subtask->task->begin.to_unix(), |
303 | - subtask->task->end.to_unix(), |
304 | - const_cast<ECalComponentAlarmAction*>(omit.data()), |
305 | - &comp_alarms, |
306 | - e_cal_client_resolve_tzid_cb, |
307 | - oclient, |
308 | - subtask->task->default_timezone); |
309 | - |
310 | - // walk the alarms & add them |
311 | - for (auto l=comp_alarms; l!=nullptr; l=l->next) |
312 | - add_alarms_to_subtask(static_cast<ECalComponentAlarms*>(l->data), subtask, subtask->task->gtz); |
313 | - |
314 | - // cleanup |
315 | - e_cal_free_alarms(comp_alarms); |
316 | - g_list_free(comps_list); |
317 | - e_cal_client_free_ecalcomp_slist(comps_slist); |
318 | - } |
319 | - else if (error != nullptr) |
320 | - { |
321 | - if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) |
322 | - g_warning("can't get ecalcomponent list: %s", error->message); |
323 | - |
324 | - g_error_free(error); |
325 | - } |
326 | - |
327 | - delete subtask; |
328 | - } |
329 | - |
330 | - static void |
331 | - on_event_component_list_ready(GObject * oclient, |
332 | - GAsyncResult * res, |
333 | - gpointer gsubtask) |
334 | - { |
335 | - GError * error = NULL; |
336 | - GSList * comps_slist = NULL; |
337 | - auto subtask = static_cast<ClientSubtask*>(gsubtask); |
338 | - |
339 | - if (e_cal_client_get_object_list_as_comps_finish(E_CAL_CLIENT(oclient), |
340 | - res, |
341 | - &comps_slist, |
342 | - &error)) |
343 | - { |
344 | - for (auto l=comps_slist; l!=nullptr; l=l->next) |
345 | - add_event_to_subtask(static_cast<ECalComponent*>(l->data), subtask, subtask->task->gtz); |
346 | - |
347 | - e_cal_client_free_ecalcomp_slist(comps_slist); |
348 | - } |
349 | - else if (error != nullptr) |
350 | - { |
351 | - if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) |
352 | - g_warning("can't get ecalcomponent list: %s", error->message); |
353 | - |
354 | - g_error_free(error); |
355 | - } |
356 | - |
357 | - delete subtask; |
358 | + static gboolean |
359 | + on_event_generated(ECalComponent *comp, |
360 | + time_t, |
361 | + time_t, |
362 | + gpointer gsubtask) |
363 | + { |
364 | + auto subtask = static_cast<ClientSubtask*>(gsubtask); |
365 | + const gchar *uid = nullptr; |
366 | + e_cal_component_get_uid (comp, &uid); |
367 | + g_object_ref(comp); |
368 | + if (e_cal_component_is_instance(comp)) |
369 | + subtask->instance_components = g_list_append(subtask->instance_components, comp); |
370 | + else |
371 | + subtask->components = g_list_append(subtask->components, comp); |
372 | + return TRUE; |
373 | + } |
374 | + |
375 | + static void |
376 | + on_event_generated_list_ready(gpointer gsubtask) |
377 | + { |
378 | + auto subtask = static_cast<ClientSubtask*>(gsubtask); |
379 | + |
380 | + // generate alarms |
381 | + constexpr std::array<ECalComponentAlarmAction,1> omit = { |
382 | + (ECalComponentAlarmAction)-1 |
383 | + }; // list of action types to omit, terminated with -1 |
384 | + GSList * comp_alarms = nullptr; |
385 | + |
386 | + // we do not need translate tz for instance events, |
387 | + // they are aredy in the correct time |
388 | + e_cal_util_generate_alarms_for_list( |
389 | + subtask->instance_components, |
390 | + subtask->task->begin.to_unix(), |
391 | + subtask->task->end.to_unix(), |
392 | + const_cast<ECalComponentAlarmAction*>(omit.data()), |
393 | + &comp_alarms, |
394 | + e_cal_client_resolve_tzid_cb, |
395 | + subtask->client, |
396 | + nullptr); |
397 | + |
398 | + // convert timezone for non-instance events |
399 | + e_cal_util_generate_alarms_for_list( |
400 | + subtask->components, |
401 | + subtask->task->begin.to_unix(), |
402 | + subtask->task->end.to_unix(), |
403 | + const_cast<ECalComponentAlarmAction*>(omit.data()), |
404 | + &comp_alarms, |
405 | + e_cal_client_resolve_tzid_cb, |
406 | + subtask->client, |
407 | + subtask->task->default_timezone); |
408 | + |
409 | + // walk the alarms & add them |
410 | + for (auto l=comp_alarms; l!=nullptr; l=l->next) |
411 | + add_alarms_to_subtask(static_cast<ECalComponentAlarms*>(l->data), subtask, subtask->task->gtz); |
412 | + |
413 | + subtask->components = g_list_concat(subtask->components, subtask->instance_components); |
414 | + // add events without alarm |
415 | + for (auto l=subtask->components; l!=nullptr; l=l->next) { |
416 | + auto component = static_cast<ECalComponent*>(l->data); |
417 | + if (!e_cal_component_has_alarms(component)) |
418 | + add_event_to_subtask(component, subtask, subtask->task->gtz); |
419 | + } |
420 | + g_list_free_full(subtask->components, g_object_unref); |
421 | + e_cal_free_alarms(comp_alarms); |
422 | + delete subtask; |
423 | + } |
424 | + |
425 | + static GTimeZone * |
426 | + timezone_from_name (const char * tzid, |
427 | + ECalClient * client, |
428 | + GCancellable * cancellable, |
429 | + icaltimezone **itimezone) |
430 | + { |
431 | + if (tzid == nullptr) |
432 | + return nullptr; |
433 | + |
434 | + auto itz = icaltimezone_get_builtin_timezone_from_tzid(tzid); // usually works |
435 | + |
436 | + if (itz == nullptr) // fallback |
437 | + itz = icaltimezone_get_builtin_timezone(tzid); |
438 | + |
439 | + if (client && (itz == nullptr)) // ok we have a strange tzid... ask EDS to look it up in VTIMEZONES |
440 | + e_cal_client_get_timezone_sync(client, tzid, &itz, cancellable, nullptr); |
441 | + |
442 | + const char* identifier {}; |
443 | + if (itimezone) |
444 | + *itimezone = itz; |
445 | + |
446 | + if (itz != nullptr) |
447 | + { |
448 | + identifier = icaltimezone_get_display_name(itz); |
449 | + |
450 | + if (identifier == nullptr) |
451 | + identifier = icaltimezone_get_location(itz); |
452 | + } |
453 | + |
454 | + // handle the TZID /freeassociation.sourceforge.net/Tzfile/[Location] case |
455 | + if (identifier != nullptr) |
456 | + { |
457 | + const char* pch; |
458 | + const char* key = "/freeassociation.sourceforge.net/"; |
459 | + if ((pch = strstr(identifier, key))) |
460 | + { |
461 | + identifier = pch + strlen(key); |
462 | + key = "Tzfile/"; // some don't have this, so check for it separately |
463 | + if ((pch = strstr(identifier, key))) |
464 | + identifier = pch + strlen(key); |
465 | + } |
466 | + } |
467 | + |
468 | + if (identifier == nullptr) |
469 | + g_warning("Unrecognized TZID: '%s'", tzid); |
470 | + else |
471 | + return g_time_zone_new(identifier); |
472 | + |
473 | + return nullptr; |
474 | } |
475 | |
476 | static DateTime |
477 | @@ -740,51 +756,9 @@ |
478 | DateTime out; |
479 | g_return_val_if_fail(in.value != nullptr, out); |
480 | |
481 | - GTimeZone * gtz {}; |
482 | - if (in.tzid != nullptr) |
483 | - { |
484 | - auto itz = icaltimezone_get_builtin_timezone_from_tzid(in.tzid); // usually works |
485 | - |
486 | - if (itz == nullptr) // fallback |
487 | - itz = icaltimezone_get_builtin_timezone(in.tzid); |
488 | - |
489 | - if (itz == nullptr) // ok we have a strange tzid... ask EDS to look it up in VTIMEZONES |
490 | - e_cal_client_get_timezone_sync(client, in.tzid, &itz, cancellable.get(), nullptr); |
491 | - |
492 | - const char* identifier {}; |
493 | - |
494 | - if (itz != nullptr) |
495 | - { |
496 | - identifier = icaltimezone_get_display_name(itz); |
497 | - |
498 | - if (identifier == nullptr) |
499 | - identifier = icaltimezone_get_location(itz); |
500 | - } |
501 | - |
502 | - // handle the TZID /freeassociation.sourceforge.net/Tzfile/[Location] case |
503 | - if (identifier != nullptr) |
504 | - { |
505 | - const char* pch; |
506 | - const char* key = "/freeassociation.sourceforge.net/"; |
507 | - if ((pch = strstr(identifier, key))) |
508 | - { |
509 | - identifier = pch + strlen(key); |
510 | - key = "Tzfile/"; // some don't have this, so check for it separately |
511 | - if ((pch = strstr(identifier, key))) |
512 | - identifier = pch + strlen(key); |
513 | - } |
514 | - } |
515 | - |
516 | - if (identifier == nullptr) |
517 | - g_warning("Unrecognized TZID: '%s'", in.tzid); |
518 | - |
519 | - gtz = g_time_zone_new(identifier); |
520 | - g_debug("%s eccdt.tzid -> offset is %d", G_STRLOC, in.tzid, (int)g_time_zone_get_offset(gtz,0)); |
521 | - } |
522 | - else |
523 | - { |
524 | + GTimeZone * gtz = timezone_from_name(in.tzid, client, cancellable.get(), nullptr); |
525 | + if (gtz == nullptr) |
526 | gtz = g_time_zone_ref(default_timezone); |
527 | - } |
528 | |
529 | out = DateTime(gtz, |
530 | in.value->year, |
531 | @@ -797,7 +771,7 @@ |
532 | return out; |
533 | } |
534 | |
535 | - static bool |
536 | + bool |
537 | is_component_interesting(ECalComponent * component) |
538 | { |
539 | // we only want calendar events and vtodos |
540 | @@ -823,6 +797,28 @@ |
541 | disabled = true; |
542 | } |
543 | e_cal_component_free_categories_list(categ_list); |
544 | + |
545 | + if (!disabled) { |
546 | + // we don't want not attending alarms |
547 | + // check if the user is part of attendee list if we found it check the status |
548 | + GSList *attendeeList = nullptr; |
549 | + e_cal_component_get_attendee_list(component, &attendeeList); |
550 | + |
551 | + for (GSList *attendeeIter=attendeeList; attendeeIter != nullptr; attendeeIter = attendeeIter->next) { |
552 | + ECalComponentAttendee *attendee = static_cast<ECalComponentAttendee *>(attendeeIter->data); |
553 | + if (attendee->value) { |
554 | + if (strncmp(attendee->value, "mailto:", 7) == 0) { |
555 | + if (m_myself->isMyEmail(attendee->value+7)) { |
556 | + disabled = (attendee->status == ICAL_PARTSTAT_DECLINED); |
557 | + break; |
558 | + } |
559 | + } |
560 | + } |
561 | + } |
562 | + if (attendeeList) |
563 | + e_cal_component_free_attendee_list(attendeeList); |
564 | + } |
565 | + |
566 | if (disabled) |
567 | return false; |
568 | |
569 | @@ -903,35 +899,13 @@ |
570 | } |
571 | |
572 | static void |
573 | - add_event_to_subtask(ECalComponent * component, |
574 | - ClientSubtask * subtask, |
575 | - GTimeZone * gtz) |
576 | - { |
577 | - // events with alarms are covered by add_alarms_to_subtask(), |
578 | - // so skip them here |
579 | - auto auids = e_cal_component_get_alarm_uids(component); |
580 | - const bool has_alarms = auids != nullptr; |
581 | - cal_obj_uid_list_free(auids); |
582 | - if (has_alarms) |
583 | - return; |
584 | - |
585 | - // add it. simple, eh? |
586 | - if (is_component_interesting(component)) |
587 | - { |
588 | - Appointment appointment = get_appointment(subtask->client, subtask->cancellable, component, gtz); |
589 | - appointment.color = subtask->color; |
590 | - subtask->task->appointments.push_back(appointment); |
591 | - } |
592 | - } |
593 | - |
594 | - static void |
595 | add_alarms_to_subtask(ECalComponentAlarms * comp_alarms, |
596 | ClientSubtask * subtask, |
597 | GTimeZone * gtz) |
598 | { |
599 | auto& component = comp_alarms->comp; |
600 | |
601 | - if (!is_component_interesting(component)) |
602 | + if (!subtask->task->p->is_component_interesting(component)) |
603 | return; |
604 | |
605 | Appointment baseline = get_appointment(subtask->client, subtask->cancellable, component, gtz); |
606 | @@ -965,7 +939,6 @@ |
607 | auto instance_time = std::make_pair(DateTime{gtz, ai->occur_start}, |
608 | DateTime{gtz, ai->occur_end}); |
609 | auto trigger_time = DateTime{gtz, ai->trigger}; |
610 | - |
611 | auto& alarm = alarms[instance_time][trigger_time]; |
612 | |
613 | if (alarm.text.empty()) |
614 | @@ -990,6 +963,21 @@ |
615 | } |
616 | } |
617 | |
618 | + |
619 | + static void |
620 | + add_event_to_subtask(ECalComponent * component, |
621 | + ClientSubtask * subtask, |
622 | + GTimeZone * gtz) |
623 | + { |
624 | + // add it. simple, eh? |
625 | + if (subtask->task->p->is_component_interesting(component)) |
626 | + { |
627 | + Appointment appointment = get_appointment(subtask->client, subtask->cancellable, component, gtz); |
628 | + appointment.color = subtask->color; |
629 | + subtask->task->appointments.push_back(appointment); |
630 | + } |
631 | + } |
632 | + |
633 | /*** |
634 | **** |
635 | ***/ |
636 | @@ -1062,14 +1050,15 @@ |
637 | ESourceRegistry* m_source_registry {}; |
638 | guint m_rebuild_tag {}; |
639 | time_t m_rebuild_deadline {}; |
640 | + std::shared_ptr<Myself> m_myself; |
641 | }; |
642 | |
643 | /*** |
644 | **** |
645 | ***/ |
646 | |
647 | -EdsEngine::EdsEngine(): |
648 | - p(new Impl()) |
649 | +EdsEngine::EdsEngine(const std::shared_ptr<Myself> &myself): |
650 | + p(new Impl(myself)) |
651 | { |
652 | } |
653 | |
654 | |
655 | === modified file 'src/main.cpp' |
656 | --- src/main.cpp 2016-04-12 17:03:36 +0000 |
657 | +++ src/main.cpp 2016-04-19 02:46:55 +0000 |
658 | @@ -25,6 +25,7 @@ |
659 | #include <datetime/exporter.h> |
660 | #include <datetime/locations-settings.h> |
661 | #include <datetime/menu.h> |
662 | +#include <datetime/myself.h> |
663 | #include <datetime/planner-aggregate.h> |
664 | #include <datetime/planner-snooze.h> |
665 | #include <datetime/planner-range.h> |
666 | @@ -58,7 +59,7 @@ |
667 | if (!g_strcmp0("lightdm", g_get_user_name())) |
668 | engine.reset(new MockEngine); |
669 | else |
670 | - engine.reset(new EdsEngine); |
671 | + engine.reset(new EdsEngine(std::shared_ptr<Myself>(new Myself))); |
672 | |
673 | return engine; |
674 | } |
675 | |
676 | === added file 'src/myself.cpp' |
677 | --- src/myself.cpp 1970-01-01 00:00:00 +0000 |
678 | +++ src/myself.cpp 2016-04-19 02:46:55 +0000 |
679 | @@ -0,0 +1,76 @@ |
680 | +/* |
681 | + * Copyright 2016 Canonical Ltd. |
682 | + * |
683 | + * This program is free software: you can redistribute it and/or modify it |
684 | + * under the terms of the GNU General Public License version 3, as published |
685 | + * by the Free Software Foundation. |
686 | + * |
687 | + * This program is distributed in the hope that it will be useful, but |
688 | + * WITHOUT ANY WARRANTY; without even the implied warranties of |
689 | + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
690 | + * PURPOSE. See the GNU General Public License for more details. |
691 | + * |
692 | + * You should have received a copy of the GNU General Public License along |
693 | + * with this program. If not, see <http://www.gnu.org/licenses/>. |
694 | + * |
695 | + * Authors: |
696 | + * Renato Araujo Oliveira Filho <renato.filho@canonical.com> |
697 | + */ |
698 | + |
699 | +#include "datetime/myself.h" |
700 | + |
701 | +#include <libaccounts-glib/ag-manager.h> |
702 | +#include <libaccounts-glib/ag-account.h> |
703 | + |
704 | +#include <algorithm> |
705 | + |
706 | +namespace unity { |
707 | +namespace indicator { |
708 | +namespace datetime { |
709 | + |
710 | +Myself::Myself() |
711 | + : m_accounts_manager(ag_manager_new(), g_object_unref) |
712 | +{ |
713 | + reloadEmails(); |
714 | + g_object_connect(m_accounts_manager.get(), |
715 | + "signal::account-created", on_accounts_changed, this, |
716 | + "signal::account-deleted", on_accounts_changed, this, |
717 | + "signal::account-updated", on_accounts_changed, this, |
718 | + nullptr); |
719 | +} |
720 | + |
721 | +bool Myself::isMyEmail(const std::string &email) |
722 | +{ |
723 | + return m_emails.get().count(email) > 0; |
724 | +} |
725 | + |
726 | +void Myself::on_accounts_changed(AgManager *, guint, Myself *self) |
727 | +{ |
728 | + self->reloadEmails(); |
729 | +} |
730 | + |
731 | +void Myself::reloadEmails() |
732 | +{ |
733 | + std::set<std::string> emails; |
734 | + |
735 | + auto manager = m_accounts_manager.get(); |
736 | + auto ids = ag_manager_list(manager); |
737 | + for (auto l=ids; l!=nullptr; l=l->next) |
738 | + { |
739 | + auto acc = ag_manager_get_account(manager, GPOINTER_TO_UINT(l->data)); |
740 | + if (acc) { |
741 | + auto account_name = ag_account_get_display_name(acc); |
742 | + if (account_name != nullptr) |
743 | + emails.insert(account_name); |
744 | + g_object_unref(acc); |
745 | + } |
746 | + } |
747 | + ag_manager_list_free(ids); |
748 | + |
749 | + m_emails.set(emails); |
750 | +} |
751 | + |
752 | +} // namespace datetime |
753 | +} // namespace indicator |
754 | +} // namespace unity |
755 | + |
756 | |
757 | === modified file 'tests/CMakeLists.txt' |
758 | --- tests/CMakeLists.txt 2016-03-22 18:51:50 +0000 |
759 | +++ tests/CMakeLists.txt 2016-04-19 02:46:55 +0000 |
760 | @@ -85,7 +85,8 @@ |
761 | ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} # arg2: test executable path |
762 | ${TEST_NAME} # arg3: test name |
763 | ${CMAKE_CURRENT_SOURCE_DIR}/test-eds-ics-config-files # arg4: base directory for config file template |
764 | - ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}.ics) # arg5: the ical file for this test |
765 | + ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}.ics # arg5: the ical file for this test |
766 | + ${CMAKE_CURRENT_SOURCE_DIR}/accounts.db) # arg6: online accounts database |
767 | endfunction() |
768 | add_eds_ics_test_by_name(test-eds-ics-all-day-events) |
769 | add_eds_ics_test_by_name(test-eds-ics-repeating-events) |
770 | @@ -95,6 +96,7 @@ |
771 | add_eds_ics_test_by_name(test-eds-ics-tzids) |
772 | add_eds_ics_test_by_name(test-eds-ics-tzids-2) |
773 | add_eds_ics_test_by_name(test-eds-ics-tzids-utc) |
774 | +add_eds_ics_test_by_name(test-eds-ics-non-attending-alarms) |
775 | |
776 | |
777 | # disabling the timezone unit tests because they require |
778 | |
779 | === added file 'tests/accounts.db' |
780 | Binary files tests/accounts.db 1970-01-01 00:00:00 +0000 and tests/accounts.db 2016-04-19 02:46:55 +0000 differ |
781 | === modified file 'tests/run-eds-ics-test.sh' |
782 | --- tests/run-eds-ics-test.sh 2015-07-20 16:31:28 +0000 |
783 | +++ tests/run-eds-ics-test.sh 2016-04-19 02:46:55 +0000 |
784 | @@ -6,6 +6,7 @@ |
785 | TEST_NAME=$3 # test name |
786 | CONFIG_DIR=$4 # config files |
787 | ICS_FILE=$5 # ical file holding test data |
788 | +ACCOUNTS_DB=$6 # online account database |
789 | |
790 | echo "this script: ${SELF}" |
791 | echo "test-runner: ${TEST_RUNNER}" |
792 | @@ -54,8 +55,15 @@ |
793 | cp --verbose --archive ${ICS_FILE} ${XDG_DATA_HOME}/evolution/tasks/system/tasks.ics |
794 | fi |
795 | |
796 | +# prepare online accounts database |
797 | +if [ -e ${ACCOUNTS_DB} ]; then |
798 | + echo "copying ${ACCOUNTS_DB} into $HOME" |
799 | + mkdir -p ${XDG_CONFIG_HOME}/libaccounts-glib/ |
800 | + cp --verbose --archive ${ACCOUNTS_DB} ${XDG_CONFIG_HOME}/libaccounts-glib/accounts.db |
801 | +fi |
802 | + |
803 | # run the test |
804 | -${TEST_RUNNER} --keep-env --max-wait=90 --task ${TEST_EXEC} --task-name ${TEST_NAME} --wait-until-complete |
805 | +${TEST_RUNNER} --keep-env --max-wait=90 --task ${TEST_EXEC} --task-name ${TEST_NAME} --wait-until-complete |
806 | rv=$? |
807 | |
808 | # if the test passed, blow away the tmpdir |
809 | |
810 | === modified file 'tests/test-eds-ics-all-day-events.cpp' |
811 | --- tests/test-eds-ics-all-day-events.cpp 2015-05-21 12:47:24 +0000 |
812 | +++ tests/test-eds-ics-all-day-events.cpp 2016-04-19 02:46:55 +0000 |
813 | @@ -22,6 +22,7 @@ |
814 | #include <datetime/alarm-queue-simple.h> |
815 | #include <datetime/clock-mock.h> |
816 | #include <datetime/engine-eds.h> |
817 | +#include <datetime/myself.h> |
818 | #include <datetime/planner-range.h> |
819 | |
820 | #include <gtest/gtest.h> |
821 | @@ -41,7 +42,7 @@ |
822 | TEST_F(VAlarmFixture, MultipleAppointments) |
823 | { |
824 | // start the EDS engine |
825 | - auto engine = std::make_shared<EdsEngine>(); |
826 | + auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
827 | |
828 | // we need a consistent timezone for the planner and our local DateTimes |
829 | constexpr char const * zone_str {"America/Chicago"}; |
830 | @@ -66,7 +67,7 @@ |
831 | constexpr int max_wait_sec = 10; |
832 | wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND); |
833 | } |
834 | - |
835 | + |
836 | // what we expect to get... |
837 | Appointment expected_appt; |
838 | expected_appt.uid = "20150521T111538Z-7449-1000-3572-0@ghidorah"; |
839 | |
840 | === modified file 'tests/test-eds-ics-missing-trigger.cpp' |
841 | --- tests/test-eds-ics-missing-trigger.cpp 2015-10-13 14:40:02 +0000 |
842 | +++ tests/test-eds-ics-missing-trigger.cpp 2016-04-19 02:46:55 +0000 |
843 | @@ -22,6 +22,7 @@ |
844 | #include <datetime/alarm-queue-simple.h> |
845 | #include <datetime/clock-mock.h> |
846 | #include <datetime/engine-eds.h> |
847 | +#include <datetime/myself.h> |
848 | #include <datetime/planner-range.h> |
849 | |
850 | #include <gtest/gtest.h> |
851 | @@ -41,7 +42,7 @@ |
852 | TEST_F(VAlarmFixture, MissingTriggers) |
853 | { |
854 | // start the EDS engine |
855 | - auto engine = std::make_shared<EdsEngine>(); |
856 | + auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
857 | |
858 | // we need a consistent timezone for the planner and our local DateTimes |
859 | constexpr char const * zone_str {"America/Chicago"}; |
860 | |
861 | === added file 'tests/test-eds-ics-non-attending-alarms.cpp' |
862 | --- tests/test-eds-ics-non-attending-alarms.cpp 1970-01-01 00:00:00 +0000 |
863 | +++ tests/test-eds-ics-non-attending-alarms.cpp 2016-04-19 02:46:55 +0000 |
864 | @@ -0,0 +1,79 @@ |
865 | +/* |
866 | + * Copyright 2015 Canonical Ltd. |
867 | + * |
868 | + * This program is free software: you can redistribute it and/or modify it |
869 | + * under the terms of the GNU General Public License version 3, as published |
870 | + * by the Free Software Foundation. |
871 | + * |
872 | + * This program is distributed in the hope that it will be useful, but |
873 | + * WITHOUT ANY WARRANTY; without even the implied warranties of |
874 | + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
875 | + * PURPOSE. See the GNU General Public License for more details. |
876 | + * |
877 | + * You should have received a copy of the GNU General Public License along |
878 | + * with this program. If not, see <http://www.gnu.org/licenses/>. |
879 | + * |
880 | + * Authors: |
881 | + * Charles Kerr <charles.kerr@canonical.com> |
882 | + */ |
883 | + |
884 | +#include <algorithm> |
885 | + |
886 | +#include <datetime/alarm-queue-simple.h> |
887 | +#include <datetime/clock-mock.h> |
888 | +#include <datetime/engine-eds.h> |
889 | +#include <datetime/myself.h> |
890 | +#include <datetime/planner-range.h> |
891 | + |
892 | +#include <gtest/gtest.h> |
893 | + |
894 | +#include "glib-fixture.h" |
895 | +#include "print-to.h" |
896 | +#include "timezone-mock.h" |
897 | +#include "wakeup-timer-mock.h" |
898 | + |
899 | +using namespace unity::indicator::datetime; |
900 | +using VAlarmFixture = GlibFixture; |
901 | + |
902 | +/*** |
903 | +**** |
904 | +***/ |
905 | + |
906 | +TEST_F(VAlarmFixture, NonAttendingEvent) |
907 | +{ |
908 | + // start the EDS engine |
909 | + auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
910 | + |
911 | + // we need a consistent timezone for the planner and our local DateTimes |
912 | + constexpr char const * zone_str {"America/Recife"}; |
913 | + auto tz = std::make_shared<MockTimezone>(zone_str); |
914 | + auto gtz = g_time_zone_new(zone_str); |
915 | + |
916 | + // make a planner that looks at the first half of 2016 in EDS |
917 | + auto planner = std::make_shared<SimpleRangePlanner>(engine, tz); |
918 | + const DateTime range_begin {gtz, 2016,1, 1, 0, 0, 0.0}; |
919 | + const DateTime range_end {gtz, 2016,6,31,23,59,59.5}; |
920 | + planner->range().set(std::make_pair(range_begin, range_end)); |
921 | + |
922 | + // give EDS a moment to load |
923 | + if (planner->appointments().get().empty()) { |
924 | + g_message("waiting a moment for EDS to load..."); |
925 | + auto on_appointments_changed = [this](const std::vector<Appointment>& appointments){ |
926 | + g_message("ah, they loaded"); |
927 | + if (!appointments.empty()) |
928 | + g_main_loop_quit(loop); |
929 | + }; |
930 | + core::ScopedConnection conn(planner->appointments().changed().connect(on_appointments_changed)); |
931 | + constexpr int max_wait_sec = 10; |
932 | + wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND); |
933 | + } |
934 | + |
935 | + // the planner should match what we've got in the calendar.ics file |
936 | + const auto appts = planner->appointments().get(); |
937 | + EXPECT_EQ(2, appts.size()); |
938 | + EXPECT_EQ(appts[0].begin, DateTime(gtz, 2016, 4, 4, 16, 0, 0)); |
939 | + EXPECT_EQ(appts[1].begin, DateTime(gtz, 2016, 4, 6, 16, 0, 0)); |
940 | + |
941 | + // cleanup |
942 | + g_time_zone_unref(gtz); |
943 | +} |
944 | |
945 | === added file 'tests/test-eds-ics-non-attending-alarms.ics.in' |
946 | --- tests/test-eds-ics-non-attending-alarms.ics.in 1970-01-01 00:00:00 +0000 |
947 | +++ tests/test-eds-ics-non-attending-alarms.ics.in 2016-04-19 02:46:55 +0000 |
948 | @@ -0,0 +1,53 @@ |
949 | +BEGIN:VCALENDAR |
950 | +CALSCALE:GREGORIAN |
951 | +PRODID:-//Ximian//NONSGML Evolution Calendar//EN |
952 | +VERSION:2.0 |
953 | +X-EVOLUTION-DATA-REVISION:2015-04-05T21:32:47.354433Z(2) |
954 | +BEGIN:VEVENT |
955 | +STATUS:CONFIRMED |
956 | +DTSTAMP:20160405T152128Z |
957 | +CREATED:20160405T152128Z |
958 | +UID:ddtvl069dn2cquo8dhg3j9c360@google.com |
959 | +SEQUENCE:1 |
960 | +TRANSP:OPAQUE |
961 | +SUMMARY:Every day at 4PM |
962 | +DTSTART;TZID=/freeassociation.sourceforge.net/Tzfile/America/Recife: |
963 | + 20160404T160000 |
964 | +RRULE:FREQ=DAILY;UNTIL=20160406T190000Z |
965 | +DTEND;TZID=/freeassociation.sourceforge.net/Tzfile/America/Recife: |
966 | + 20160404T170000 |
967 | +ATTENDEE;CN=Uphablet;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT; |
968 | + CUTYPE=INDIVIDUAL:mailto:uphablet@ubuntu.com |
969 | +LAST-MODIFIED:20160405T152128Z |
970 | +BEGIN:VALARM |
971 | +TRIGGER;VALUE=DURATION:-PT30M |
972 | +ACTION:EMAIL |
973 | +DESCRIPTION:This is an event reminder |
974 | +X-EVOLUTION-ALARM-UID:20160405T152128Z-2848-32011-1844-65@ubuntu-phablet |
975 | +END:VALARM |
976 | +END:VEVENT |
977 | +BEGIN:VEVENT |
978 | +STATUS:CONFIRMED |
979 | +DTSTAMP:20160405T152128Z |
980 | +CREATED:20160405T151054Z |
981 | +UID:ddtvl069dn2cquo8dhg3j9c360@google.com |
982 | +SEQUENCE:1 |
983 | +TRANSP:OPAQUE |
984 | +SUMMARY::Every day at 4PM |
985 | +DTSTART;TZID=/freeassociation.sourceforge.net/Tzfile/America/Fortaleza: |
986 | + 20160405T160000 |
987 | +RECURRENCE-ID;TZID=/freeassociation.sourceforge.net/Tzfile/America/Recife: |
988 | + 20160405T160000 |
989 | +DTEND;TZID=/freeassociation.sourceforge.net/Tzfile/America/Fortaleza: |
990 | + 20160405T170000 |
991 | +ATTENDEE;CN=Uphablet;PARTSTAT=DECLINED;ROLE=REQ-PARTICIPANT; |
992 | + CUTYPE=INDIVIDUAL:mailto:uphablet@ubuntu.com |
993 | +LAST-MODIFIED:20160405T152128Z |
994 | +BEGIN:VALARM |
995 | +TRIGGER;VALUE=DURATION:-PT30M |
996 | +ACTION:EMAIL |
997 | +DESCRIPTION:This is an event reminder |
998 | +X-EVOLUTION-ALARM-UID:20160405T152128Z-2848-32011-1844-66@ubuntu-phablet |
999 | +END:VALARM |
1000 | +END:VEVENT |
1001 | +END:VCALENDAR |
1002 | |
1003 | === modified file 'tests/test-eds-ics-nonrepeating-events.cpp' |
1004 | --- tests/test-eds-ics-nonrepeating-events.cpp 2015-10-13 14:40:02 +0000 |
1005 | +++ tests/test-eds-ics-nonrepeating-events.cpp 2016-04-19 02:46:55 +0000 |
1006 | @@ -22,6 +22,7 @@ |
1007 | #include <datetime/alarm-queue-simple.h> |
1008 | #include <datetime/clock-mock.h> |
1009 | #include <datetime/engine-eds.h> |
1010 | +#include <datetime/myself.h> |
1011 | #include <datetime/planner-range.h> |
1012 | |
1013 | #include <gtest/gtest.h> |
1014 | @@ -41,7 +42,7 @@ |
1015 | TEST_F(VAlarmFixture, MultipleAppointments) |
1016 | { |
1017 | // start the EDS engine |
1018 | - auto engine = std::make_shared<EdsEngine>(); |
1019 | + auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
1020 | |
1021 | // we need a consistent timezone for the planner and our local DateTimes |
1022 | constexpr char const * zone_str {"America/Chicago"}; |
1023 | @@ -66,7 +67,7 @@ |
1024 | constexpr int max_wait_sec = 10; |
1025 | wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND); |
1026 | } |
1027 | - |
1028 | + |
1029 | // what we expect to get... |
1030 | Appointment expected_appt; |
1031 | expected_appt.uid = "20150520T000726Z-3878-32011-1770-81@ubuntu-phablet"; |
1032 | |
1033 | === modified file 'tests/test-eds-ics-repeating-events.cpp' |
1034 | --- tests/test-eds-ics-repeating-events.cpp 2015-10-13 14:40:02 +0000 |
1035 | +++ tests/test-eds-ics-repeating-events.cpp 2016-04-19 02:46:55 +0000 |
1036 | @@ -22,6 +22,7 @@ |
1037 | #include <datetime/alarm-queue-simple.h> |
1038 | #include <datetime/clock-mock.h> |
1039 | #include <datetime/engine-eds.h> |
1040 | +#include <datetime/myself.h> |
1041 | #include <datetime/planner-range.h> |
1042 | |
1043 | #include <gtest/gtest.h> |
1044 | @@ -41,7 +42,7 @@ |
1045 | TEST_F(VAlarmFixture, MultipleAppointments) |
1046 | { |
1047 | // start the EDS engine |
1048 | - auto engine = std::make_shared<EdsEngine>(); |
1049 | + auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
1050 | |
1051 | // we need a consistent timezone for the planner and our local DateTimes |
1052 | constexpr char const * zone_str {"America/Chicago"}; |
1053 | @@ -66,7 +67,7 @@ |
1054 | constexpr int max_wait_sec = 10; |
1055 | wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND); |
1056 | } |
1057 | - |
1058 | + |
1059 | // what we expect to get... |
1060 | Appointment expected_appt; |
1061 | expected_appt.uid = "20150507T211449Z-4262-32011-1418-1@ubuntu-phablet"; |
1062 | |
1063 | === modified file 'tests/test-eds-ics-repeating-valarms.cpp' |
1064 | --- tests/test-eds-ics-repeating-valarms.cpp 2015-05-20 23:23:32 +0000 |
1065 | +++ tests/test-eds-ics-repeating-valarms.cpp 2016-04-19 02:46:55 +0000 |
1066 | @@ -22,6 +22,7 @@ |
1067 | #include <datetime/alarm-queue-simple.h> |
1068 | #include <datetime/clock-mock.h> |
1069 | #include <datetime/engine-eds.h> |
1070 | +#include <datetime/myself.h> |
1071 | #include <datetime/planner-range.h> |
1072 | |
1073 | #include <gtest/gtest.h> |
1074 | @@ -41,7 +42,7 @@ |
1075 | TEST_F(VAlarmFixture, MultipleAppointments) |
1076 | { |
1077 | // start the EDS engine |
1078 | - auto engine = std::make_shared<EdsEngine>(); |
1079 | + auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
1080 | |
1081 | // we need a consistent timezone for the planner and our local DateTimes |
1082 | constexpr char const * zone_str {"America/Chicago"}; |
1083 | |
1084 | === modified file 'tests/test-eds-ics-tzids-2.cpp' |
1085 | --- tests/test-eds-ics-tzids-2.cpp 2015-07-09 20:56:13 +0000 |
1086 | +++ tests/test-eds-ics-tzids-2.cpp 2016-04-19 02:46:55 +0000 |
1087 | @@ -22,6 +22,7 @@ |
1088 | #include <datetime/alarm-queue-simple.h> |
1089 | #include <datetime/clock-mock.h> |
1090 | #include <datetime/engine-eds.h> |
1091 | +#include <datetime/myself.h> |
1092 | #include <datetime/planner-range.h> |
1093 | |
1094 | #include <gtest/gtest.h> |
1095 | @@ -41,7 +42,7 @@ |
1096 | TEST_F(VAlarmFixture, MultipleAppointments) |
1097 | { |
1098 | // start the EDS engine |
1099 | - auto engine = std::make_shared<EdsEngine>(); |
1100 | + auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
1101 | |
1102 | // we need a consistent timezone for the planner and our local DateTimes |
1103 | constexpr char const * zone_str {"America/Los_Angeles"}; |
1104 | |
1105 | === modified file 'tests/test-eds-ics-tzids-utc.cpp' |
1106 | --- tests/test-eds-ics-tzids-utc.cpp 2016-03-22 19:13:10 +0000 |
1107 | +++ tests/test-eds-ics-tzids-utc.cpp 2016-04-19 02:46:55 +0000 |
1108 | @@ -22,6 +22,7 @@ |
1109 | #include <datetime/alarm-queue-simple.h> |
1110 | #include <datetime/clock-mock.h> |
1111 | #include <datetime/engine-eds.h> |
1112 | +#include <datetime/myself.h> |
1113 | #include <datetime/planner-range.h> |
1114 | |
1115 | #include <gtest/gtest.h> |
1116 | @@ -41,7 +42,7 @@ |
1117 | TEST_F(VAlarmFixture, UTCAppointments) |
1118 | { |
1119 | // start the EDS engine |
1120 | - auto engine = std::make_shared<EdsEngine>(); |
1121 | + auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
1122 | |
1123 | // we need a consistent timezone for the planner and our local DateTimes |
1124 | constexpr char const * zone_str {"America/Recife"}; |
1125 | |
1126 | === modified file 'tests/test-eds-ics-tzids.cpp' |
1127 | --- tests/test-eds-ics-tzids.cpp 2015-07-09 19:14:32 +0000 |
1128 | +++ tests/test-eds-ics-tzids.cpp 2016-04-19 02:46:55 +0000 |
1129 | @@ -22,6 +22,7 @@ |
1130 | #include <datetime/alarm-queue-simple.h> |
1131 | #include <datetime/clock-mock.h> |
1132 | #include <datetime/engine-eds.h> |
1133 | +#include <datetime/myself.h> |
1134 | #include <datetime/planner-range.h> |
1135 | |
1136 | #include <gtest/gtest.h> |
1137 | @@ -41,7 +42,7 @@ |
1138 | TEST_F(VAlarmFixture, MultipleAppointments) |
1139 | { |
1140 | // start the EDS engine |
1141 | - auto engine = std::make_shared<EdsEngine>(); |
1142 | + auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
1143 | |
1144 | // we need a consistent timezone for the planner and our local DateTimes |
1145 | constexpr char const * zone_str {"Europe/Berlin"}; |
Some change requests inline. Mostly minor, but one potential crasher and memory leak