paul@1039 | 1 | #!/usr/bin/env python |
paul@1039 | 2 | |
paul@1039 | 3 | """ |
paul@1039 | 4 | Quota-related scheduling functionality. |
paul@1039 | 5 | |
paul@1232 | 6 | Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> |
paul@1039 | 7 | |
paul@1039 | 8 | This program is free software; you can redistribute it and/or modify it under |
paul@1039 | 9 | the terms of the GNU General Public License as published by the Free Software |
paul@1039 | 10 | Foundation; either version 3 of the License, or (at your option) any later |
paul@1039 | 11 | version. |
paul@1039 | 12 | |
paul@1039 | 13 | This program is distributed in the hope that it will be useful, but WITHOUT |
paul@1039 | 14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paul@1039 | 15 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paul@1039 | 16 | details. |
paul@1039 | 17 | |
paul@1039 | 18 | You should have received a copy of the GNU General Public License along with |
paul@1039 | 19 | this program. If not, see <http://www.gnu.org/licenses/>. |
paul@1039 | 20 | """ |
paul@1039 | 21 | |
paul@1059 | 22 | from imiptools.dates import get_duration, to_utc_datetime |
paul@1185 | 23 | from imiptools.handlers.scheduling.common import get_scheduling_conflicts, \ |
paul@1185 | 24 | standard_responses |
paul@1039 | 25 | from imiptools.period import Endless |
paul@1039 | 26 | from datetime import timedelta |
paul@1039 | 27 | |
paul@1039 | 28 | # Quota maintenance. |
paul@1039 | 29 | |
paul@1039 | 30 | def check_quota(handler, args): |
paul@1039 | 31 | |
paul@1039 | 32 | """ |
paul@1039 | 33 | Check the current object of the given 'handler' against the applicable |
paul@1039 | 34 | quota. |
paul@1039 | 35 | """ |
paul@1039 | 36 | |
paul@1153 | 37 | _ = handler.get_translator() |
paul@1153 | 38 | |
paul@1039 | 39 | quota, group = _get_quota_and_group(handler, args) |
paul@1039 | 40 | |
paul@1039 | 41 | # Obtain the journal entries and check the balance. |
paul@1039 | 42 | |
paul@1039 | 43 | journal = handler.get_journal() |
paul@1039 | 44 | entries = journal.get_entries(quota, group) |
paul@1039 | 45 | limits = journal.get_limits(quota) |
paul@1039 | 46 | |
paul@1039 | 47 | # Obtain a limit for the group or any general limit. |
paul@1039 | 48 | # Decline invitations if no limit has been set. |
paul@1039 | 49 | |
paul@1039 | 50 | limit = limits.get(group) or limits.get("*") |
paul@1039 | 51 | if not limit: |
paul@1153 | 52 | return "DECLINED", _("You have no quota allocation for the recipient.") |
paul@1039 | 53 | |
paul@1196 | 54 | # Where the quota is unlimited, accept the invitation. |
paul@1196 | 55 | |
paul@1196 | 56 | if limit == "*": |
paul@1196 | 57 | return "ACCEPTED", _("The recipient has scheduled the requested period.") |
paul@1196 | 58 | |
paul@1196 | 59 | # Decline endless events for limited quotas. |
paul@1185 | 60 | |
paul@1185 | 61 | total = _get_duration(handler) |
paul@1185 | 62 | |
paul@1185 | 63 | if total == Endless(): |
paul@1185 | 64 | return "DECLINED", _("The event period exceeds your quota allocation for the recipient.") |
paul@1185 | 65 | |
paul@1039 | 66 | # Decline events whose durations exceed the balance. |
paul@1039 | 67 | |
paul@1039 | 68 | balance = get_duration(limit) - _get_usage(entries) |
paul@1039 | 69 | |
paul@1039 | 70 | if total > balance: |
paul@1153 | 71 | return "DECLINED", _("The event period exceeds your quota allocation for the recipient.") |
paul@1039 | 72 | else: |
paul@1153 | 73 | return "ACCEPTED", _("The recipient has scheduled the requested period.") |
paul@1039 | 74 | |
paul@1039 | 75 | def add_to_quota(handler, args): |
paul@1039 | 76 | |
paul@1039 | 77 | """ |
paul@1039 | 78 | Record details of the current object of the given 'handler' in the |
paul@1039 | 79 | applicable quota. |
paul@1039 | 80 | """ |
paul@1039 | 81 | |
paul@1039 | 82 | quota, group = _get_quota_and_group(handler, args) |
paul@1199 | 83 | _add_to_quota(handler, quota, group, handler.user, False) |
paul@1196 | 84 | |
paul@1039 | 85 | def remove_from_quota(handler, args): |
paul@1039 | 86 | |
paul@1039 | 87 | """ |
paul@1039 | 88 | Remove details of the current object of the given 'handler' from the |
paul@1039 | 89 | applicable quota. |
paul@1039 | 90 | """ |
paul@1039 | 91 | |
paul@1039 | 92 | quota, group = _get_quota_and_group(handler, args) |
paul@1199 | 93 | _remove_from_quota(handler, quota, group, handler.user) |
paul@1196 | 94 | |
paul@1199 | 95 | def update_event(handler, args): |
paul@1196 | 96 | |
paul@1196 | 97 | "Update a stored version of the current object of the given 'handler'." |
paul@1196 | 98 | |
paul@1196 | 99 | quota, group = _get_quota_and_group(handler, args) |
paul@1196 | 100 | journal = handler.get_journal() |
paul@1196 | 101 | |
paul@1196 | 102 | # Where an existing version of the object exists, merge the recipient's |
paul@1196 | 103 | # attendance information. |
paul@1196 | 104 | |
paul@1232 | 105 | obj = journal.get_event(quota, handler.uid, handler.recurrenceid) |
paul@1196 | 106 | if not obj: |
paul@1196 | 107 | obj = handler.obj |
paul@1196 | 108 | |
paul@1196 | 109 | # Set attendance. |
paul@1196 | 110 | |
paul@1336 | 111 | attendee_map = obj.get_uri_map("ATTENDEE") |
paul@1196 | 112 | attendee_map[handler.user]["PARTSTAT"] = "ACCEPTED" |
paul@1196 | 113 | obj["ATTENDEE"] = attendee_map.items() |
paul@1196 | 114 | |
paul@1196 | 115 | # Record the object so that recurrences can be generated. |
paul@1196 | 116 | |
paul@1196 | 117 | journal.set_event(quota, handler.uid, handler.recurrenceid, obj.to_node()) |
paul@1196 | 118 | |
paul@1199 | 119 | def remove_event(handler, args): |
paul@1196 | 120 | |
paul@1196 | 121 | "Remove a stored version of the current object of the given 'handler'." |
paul@1196 | 122 | |
paul@1196 | 123 | quota, group = _get_quota_and_group(handler, args) |
paul@1196 | 124 | journal = handler.get_journal() |
paul@1196 | 125 | |
paul@1196 | 126 | # Where an existing version of the object exists, remove the recipient's |
paul@1196 | 127 | # attendance information. |
paul@1196 | 128 | |
paul@1232 | 129 | obj = journal.get_event(quota, handler.uid, handler.recurrenceid) |
paul@1196 | 130 | if not obj: |
paul@1196 | 131 | return |
paul@1196 | 132 | |
paul@1336 | 133 | attendee_map = obj.get_uri_map("ATTENDEE") |
paul@1196 | 134 | delegates = journal.get_delegates(quota) |
paul@1196 | 135 | |
paul@1196 | 136 | # Determine whether any of the delegates are still involved. |
paul@1196 | 137 | |
paul@1196 | 138 | attendees = set(delegates).intersection(attendee_map.keys()) |
paul@1196 | 139 | if handler.user in attendees: |
paul@1196 | 140 | attendees.remove(handler.user) |
paul@1196 | 141 | |
paul@1196 | 142 | # Remove event details where no delegates will be involved. |
paul@1196 | 143 | |
paul@1196 | 144 | if not attendees: |
paul@1196 | 145 | journal.remove_event(quota, handler.uid, handler.recurrenceid) |
paul@1196 | 146 | return |
paul@1196 | 147 | |
paul@1196 | 148 | del attendee_map[handler.user] |
paul@1196 | 149 | obj["ATTENDEE"] = attendee_map.items() |
paul@1196 | 150 | |
paul@1196 | 151 | # Record the object so that recurrences can be generated. |
paul@1196 | 152 | |
paul@1196 | 153 | journal.set_event(quota, handler.uid, handler.recurrenceid, obj.to_node()) |
paul@1196 | 154 | |
paul@1039 | 155 | def _get_quota_and_group(handler, args): |
paul@1039 | 156 | |
paul@1039 | 157 | """ |
paul@1039 | 158 | Combine information about the current object from the 'handler' with the |
paul@1039 | 159 | given 'args' to return a tuple containing the quota group and the user |
paul@1039 | 160 | identity or group involved. |
paul@1039 | 161 | """ |
paul@1039 | 162 | |
paul@1039 | 163 | quota = args and args[0] or handler.user |
paul@1039 | 164 | |
paul@1039 | 165 | # Obtain the identity to whom the quota will apply. |
paul@1039 | 166 | |
paul@1336 | 167 | organiser = handler.obj.get_uri("ORGANIZER") |
paul@1039 | 168 | |
paul@1039 | 169 | # Obtain any user group to which the quota will apply instead. |
paul@1039 | 170 | |
paul@1039 | 171 | journal = handler.get_journal() |
paul@1039 | 172 | groups = journal.get_groups(quota) |
paul@1039 | 173 | |
paul@1179 | 174 | return quota, groups.get(organiser) or groups.get("*") or organiser |
paul@1039 | 175 | |
paul@1039 | 176 | def _get_duration(handler): |
paul@1039 | 177 | |
paul@1039 | 178 | "Return the duration of the current object provided by the 'handler'." |
paul@1039 | 179 | |
paul@1050 | 180 | # Reject indefinitely recurring events. |
paul@1050 | 181 | |
paul@1050 | 182 | if handler.obj.possibly_recurring_indefinitely(): |
paul@1050 | 183 | return Endless() |
paul@1050 | 184 | |
paul@1050 | 185 | # Otherwise, return a sum of the period durations. |
paul@1039 | 186 | |
paul@1039 | 187 | total = timedelta(0) |
paul@1039 | 188 | |
paul@1238 | 189 | for period in handler.get_periods(handler.obj, future_only=True): |
paul@1039 | 190 | duration = period.get_duration() |
paul@1039 | 191 | |
paul@1039 | 192 | # Decline events whose period durations are endless. |
paul@1039 | 193 | |
paul@1039 | 194 | if duration == Endless(): |
paul@1039 | 195 | return duration |
paul@1039 | 196 | else: |
paul@1039 | 197 | total += duration |
paul@1039 | 198 | |
paul@1039 | 199 | return total |
paul@1039 | 200 | |
paul@1048 | 201 | def _get_expiry_time(handler): |
paul@1048 | 202 | |
paul@1048 | 203 | """ |
paul@1048 | 204 | Return the expiry time for quota purposes of the current object provided by |
paul@1048 | 205 | the 'handler'. |
paul@1048 | 206 | """ |
paul@1048 | 207 | |
paul@1050 | 208 | # Reject indefinitely recurring events. |
paul@1048 | 209 | |
paul@1050 | 210 | if handler.obj.possibly_recurring_indefinitely(): |
paul@1050 | 211 | return None |
paul@1050 | 212 | |
paul@1238 | 213 | periods = handler.get_periods(handler.obj, future_only=True) |
paul@1048 | 214 | return periods and to_utc_datetime(periods[-1].get_end_point()) or None |
paul@1048 | 215 | |
paul@1039 | 216 | def _get_usage(entries): |
paul@1039 | 217 | |
paul@1039 | 218 | "Return the usage total according to the given 'entries'." |
paul@1039 | 219 | |
paul@1039 | 220 | total = timedelta(0) |
paul@1059 | 221 | for period in entries: |
paul@1059 | 222 | total += period.get_duration() |
paul@1039 | 223 | return total |
paul@1039 | 224 | |
paul@1199 | 225 | def _add_to_quota(handler, quota, user, participant, is_organiser): |
paul@1199 | 226 | |
paul@1199 | 227 | """ |
paul@1199 | 228 | Record details of the current object of the 'handler' in the applicable |
paul@1199 | 229 | free/busy resource. |
paul@1199 | 230 | """ |
paul@1199 | 231 | |
paul@1199 | 232 | journal = handler.get_journal() |
paul@1199 | 233 | freebusy = journal.get_entries_for_update(quota, user) |
paul@1199 | 234 | handler.update_freebusy(freebusy, participant, is_organiser) |
paul@1199 | 235 | |
paul@1199 | 236 | # Remove original recurrence details replaced by additional |
paul@1199 | 237 | # recurrences, as well as obsolete additional recurrences. |
paul@1199 | 238 | |
paul@1199 | 239 | handler.remove_freebusy_for_recurrences(freebusy, journal.get_recurrences(quota, handler.uid)) |
paul@1199 | 240 | |
paul@1199 | 241 | # Update free/busy provider information if the event may recur indefinitely. |
paul@1199 | 242 | |
paul@1199 | 243 | if handler.possibly_recurring_indefinitely(): |
paul@1199 | 244 | journal.append_freebusy_provider(quota, handler.obj) |
paul@1199 | 245 | |
paul@1199 | 246 | journal.set_entries(quota, user, freebusy) |
paul@1199 | 247 | |
paul@1199 | 248 | def _remove_from_quota(handler, quota, user, participant): |
paul@1199 | 249 | |
paul@1199 | 250 | """ |
paul@1199 | 251 | Remove details of the current object of the 'handler' from the applicable |
paul@1199 | 252 | free/busy resource. |
paul@1199 | 253 | """ |
paul@1199 | 254 | |
paul@1199 | 255 | journal = handler.get_journal() |
paul@1199 | 256 | freebusy = journal.get_entries_for_update(quota, user) |
paul@1199 | 257 | |
paul@1199 | 258 | # Remove only the entries associated with this recipient. |
paul@1199 | 259 | |
paul@1231 | 260 | handler.remove_from_freebusy(freebusy, participant) |
paul@1199 | 261 | |
paul@1199 | 262 | # Update free/busy provider information if the event may recur indefinitely. |
paul@1199 | 263 | |
paul@1199 | 264 | if handler.possibly_recurring_indefinitely(): |
paul@1199 | 265 | journal.remove_freebusy_provider(quota, handler.obj) |
paul@1199 | 266 | |
paul@1199 | 267 | journal.set_entries(quota, user, freebusy) |
paul@1199 | 268 | |
paul@1039 | 269 | # Collective free/busy maintenance. |
paul@1039 | 270 | |
paul@1039 | 271 | def schedule_across_quota(handler, args): |
paul@1039 | 272 | |
paul@1039 | 273 | """ |
paul@1181 | 274 | Check the current object of the given 'handler' against the individual |
paul@1181 | 275 | schedules managed by the quota. The consolidated schedules are not tested, |
paul@1181 | 276 | nor are the quotas themselves. |
paul@1039 | 277 | """ |
paul@1039 | 278 | |
paul@1039 | 279 | quota, organiser = _get_quota_and_identity(handler, args) |
paul@1039 | 280 | |
paul@1166 | 281 | # Check the event periods against the quota's consolidated record of the |
paul@1166 | 282 | # organiser's reservations. |
paul@1039 | 283 | |
paul@1238 | 284 | periods = handler.get_periods(handler.obj, future_only=True) |
paul@1192 | 285 | freebusy = handler.get_journal().get_entries(quota, organiser) |
paul@1039 | 286 | scheduled = handler.can_schedule(freebusy, periods) |
paul@1039 | 287 | |
paul@1185 | 288 | return standard_responses(handler, scheduled and "ACCEPTED" or "DECLINED") |
paul@1039 | 289 | |
paul@1039 | 290 | def add_to_quota_freebusy(handler, args): |
paul@1039 | 291 | |
paul@1039 | 292 | """ |
paul@1039 | 293 | Record details of the current object of the 'handler' in the applicable |
paul@1039 | 294 | free/busy resource. |
paul@1039 | 295 | """ |
paul@1039 | 296 | |
paul@1039 | 297 | quota, organiser = _get_quota_and_identity(handler, args) |
paul@1199 | 298 | _add_to_quota(handler, quota, organiser, organiser, True) |
paul@1039 | 299 | |
paul@1039 | 300 | def remove_from_quota_freebusy(handler, args): |
paul@1039 | 301 | |
paul@1039 | 302 | """ |
paul@1039 | 303 | Remove details of the current object of the 'handler' from the applicable |
paul@1039 | 304 | free/busy resource. |
paul@1039 | 305 | """ |
paul@1039 | 306 | |
paul@1039 | 307 | quota, organiser = _get_quota_and_identity(handler, args) |
paul@1199 | 308 | _remove_from_quota(handler, quota, organiser, organiser) |
paul@1039 | 309 | |
paul@1039 | 310 | def _get_quota_and_identity(handler, args): |
paul@1039 | 311 | |
paul@1039 | 312 | """ |
paul@1039 | 313 | Combine information about the current object from the 'handler' with the |
paul@1039 | 314 | given 'args' to return a tuple containing the quota group and the user |
paul@1039 | 315 | identity involved. |
paul@1039 | 316 | """ |
paul@1039 | 317 | |
paul@1039 | 318 | quota = args and args[0] or handler.user |
paul@1039 | 319 | |
paul@1039 | 320 | # Obtain the identity for whom the scheduling will apply. |
paul@1039 | 321 | |
paul@1336 | 322 | organiser = handler.obj.get_uri("ORGANIZER") |
paul@1039 | 323 | |
paul@1039 | 324 | return quota, organiser |
paul@1039 | 325 | |
paul@1176 | 326 | # Delegation of reservations. |
paul@1176 | 327 | |
paul@1176 | 328 | def schedule_for_delegate(handler, args): |
paul@1176 | 329 | |
paul@1176 | 330 | """ |
paul@1176 | 331 | Check the current object of the given 'handler' against the schedules |
paul@1176 | 332 | managed by the quota, delegating to a specific recipient according to the |
paul@1185 | 333 | given policies. |
paul@1176 | 334 | """ |
paul@1176 | 335 | |
paul@1181 | 336 | # First check the quota and decline any request that would exceed the quota. |
paul@1181 | 337 | |
paul@1181 | 338 | scheduled = check_quota(handler, args) |
paul@1181 | 339 | response, description = scheduled or ("DECLINED", None) |
paul@1181 | 340 | |
paul@1181 | 341 | if response == "DECLINED": |
paul@1181 | 342 | return response, description |
paul@1181 | 343 | |
paul@1181 | 344 | # Obtain the quota and organiser group details to evaluate delegation. |
paul@1181 | 345 | |
paul@1176 | 346 | quota, group = _get_quota_and_group(handler, args) |
paul@1185 | 347 | policies = args and args[1:] or ["available"] |
paul@1176 | 348 | |
paul@1176 | 349 | # Determine the status of the recipient. |
paul@1176 | 350 | |
paul@1336 | 351 | attendee_map = handler.obj.get_uri_map("ATTENDEE") |
paul@1176 | 352 | attendee_attr = attendee_map[handler.user] |
paul@1176 | 353 | |
paul@1176 | 354 | # Prevent delegation by a delegate. |
paul@1176 | 355 | |
paul@1176 | 356 | if attendee_attr.get("DELEGATED-FROM"): |
paul@1176 | 357 | delegates = set([handler.user]) |
paul@1176 | 358 | |
paul@1176 | 359 | # Obtain the delegate pool for the quota. |
paul@1176 | 360 | |
paul@1176 | 361 | else: |
paul@1176 | 362 | delegates = handler.get_journal().get_delegates(quota) |
paul@1176 | 363 | |
paul@1176 | 364 | # Obtain the remaining delegates not already involved in the event. |
paul@1176 | 365 | |
paul@1176 | 366 | delegates = set(delegates).difference(attendee_map) |
paul@1176 | 367 | delegates.add(handler.user) |
paul@1176 | 368 | |
paul@1176 | 369 | # Get the quota's schedule for the requested periods and identify |
paul@1176 | 370 | # unavailable delegates. |
paul@1176 | 371 | |
paul@1176 | 372 | entries = handler.get_journal().get_entries(quota, group) |
paul@1185 | 373 | conflicts = get_scheduling_conflicts(handler, entries, delegates, attendee=True) |
paul@1176 | 374 | |
paul@1185 | 375 | # Get the delegates in order of increasing unavailability (or decreasing |
paul@1185 | 376 | # availability). |
paul@1176 | 377 | |
paul@1185 | 378 | unavailability = conflicts.items() |
paul@1185 | 379 | |
paul@1185 | 380 | # Apply the policies to choose a suitable delegate. |
paul@1176 | 381 | |
paul@1185 | 382 | if "most-available" in policies: |
paul@1185 | 383 | unavailability.sort(key=lambda t: t[1]) |
paul@1185 | 384 | available = [delegate for (delegate, commitments) in unavailability] |
paul@1185 | 385 | delegate = available and available[0] |
paul@1176 | 386 | |
paul@1185 | 387 | # The default is to select completely available delegates. |
paul@1176 | 388 | |
paul@1185 | 389 | else: |
paul@1185 | 390 | available = [delegate for (delegate, commitments) in unavailability if not commitments] |
paul@1185 | 391 | delegate = available and (handler.user in available and handler.user or available[0]) |
paul@1176 | 392 | |
paul@1185 | 393 | # Only accept or delegate if a suitably available delegate is found. |
paul@1176 | 394 | |
paul@1185 | 395 | if delegate: |
paul@1176 | 396 | |
paul@1176 | 397 | # Add attendee for delegate, obtaining the original attendee dictionary. |
paul@1176 | 398 | # Modify this user's status to refer to the delegate. |
paul@1176 | 399 | |
paul@1176 | 400 | if delegate != handler.user: |
paul@1176 | 401 | attendee_map = handler.obj.get_value_map("ATTENDEE") |
paul@1176 | 402 | attendee_map[delegate] = {"DELEGATED-FROM" : [handler.user]} |
paul@1176 | 403 | attendee_attr["DELEGATED-TO"] = [delegate] |
paul@1176 | 404 | handler.obj["ATTENDEE"] = attendee_map.items() |
paul@1176 | 405 | |
paul@1185 | 406 | response = "DELEGATED" |
paul@1176 | 407 | else: |
paul@1185 | 408 | response = "ACCEPTED" |
paul@1176 | 409 | else: |
paul@1185 | 410 | response = "DECLINED" |
paul@1185 | 411 | |
paul@1185 | 412 | return standard_responses(handler, response) |
paul@1176 | 413 | |
paul@1040 | 414 | # Locking and unlocking. |
paul@1040 | 415 | |
paul@1040 | 416 | def lock_journal(handler, args): |
paul@1040 | 417 | |
paul@1040 | 418 | "Using the 'handler' and 'args', lock the journal for the quota." |
paul@1040 | 419 | |
paul@1040 | 420 | handler.get_journal().acquire_lock(_get_quota(handler, args)) |
paul@1040 | 421 | |
paul@1040 | 422 | def unlock_journal(handler, args): |
paul@1040 | 423 | |
paul@1040 | 424 | "Using the 'handler' and 'args', unlock the journal for the quota." |
paul@1040 | 425 | |
paul@1040 | 426 | handler.get_journal().release_lock(_get_quota(handler, args)) |
paul@1040 | 427 | |
paul@1040 | 428 | def _get_quota(handler, args): |
paul@1040 | 429 | |
paul@1040 | 430 | "Return the quota using the 'handler' and 'args'." |
paul@1040 | 431 | |
paul@1040 | 432 | return args and args[0] or handler.user |
paul@1040 | 433 | |
paul@1039 | 434 | # Registry of scheduling functions. |
paul@1039 | 435 | |
paul@1039 | 436 | scheduling_functions = { |
paul@1199 | 437 | "check_quota" : [check_quota], |
paul@1199 | 438 | "schedule_across_quota" : [schedule_across_quota], |
paul@1199 | 439 | "schedule_for_delegate" : [schedule_for_delegate], |
paul@1039 | 440 | } |
paul@1039 | 441 | |
paul@1040 | 442 | # Registries of locking and unlocking functions. |
paul@1040 | 443 | |
paul@1040 | 444 | locking_functions = { |
paul@1199 | 445 | "check_quota" : [lock_journal], |
paul@1199 | 446 | "schedule_across_quota" : [lock_journal], |
paul@1199 | 447 | "schedule_for_delegate" : [lock_journal], |
paul@1040 | 448 | } |
paul@1040 | 449 | |
paul@1040 | 450 | unlocking_functions = { |
paul@1199 | 451 | "check_quota" : [unlock_journal], |
paul@1199 | 452 | "schedule_across_quota" : [unlock_journal], |
paul@1199 | 453 | "schedule_for_delegate" : [unlock_journal], |
paul@1040 | 454 | } |
paul@1040 | 455 | |
paul@1039 | 456 | # Registries of listener functions. |
paul@1039 | 457 | |
paul@1039 | 458 | confirmation_functions = { |
paul@1199 | 459 | "check_quota" : [add_to_quota, update_event], |
paul@1199 | 460 | "schedule_across_quota" : [add_to_quota_freebusy, update_event], |
paul@1199 | 461 | "schedule_for_delegate" : [add_to_quota, update_event], |
paul@1039 | 462 | } |
paul@1039 | 463 | |
paul@1039 | 464 | retraction_functions = { |
paul@1199 | 465 | "check_quota" : [remove_from_quota, remove_event], |
paul@1199 | 466 | "schedule_across_quota" : [remove_from_quota_freebusy, remove_event], |
paul@1199 | 467 | "schedule_for_delegate" : [remove_from_quota, remove_event], |
paul@1039 | 468 | } |
paul@1039 | 469 | |
paul@1039 | 470 | # vim: tabstop=4 expandtab shiftwidth=4 |