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