1.1 --- a/imiptools/content.py Wed Oct 22 15:46:50 2014 +0200
1.2 +++ b/imiptools/content.py Thu Oct 23 22:24:17 2014 +0200
1.3 @@ -142,7 +142,8 @@
1.4
1.5 """
1.6 Handle the given iTIP 'part' for the given 'recipients' using the given
1.7 - 'handlers'.
1.8 + 'handlers'. Return a list of responses, each response being a tuple of the
1.9 + form (is-outgoing, message-part).
1.10 """
1.11
1.12 method = part.get_param("method")
1.13 @@ -158,17 +159,13 @@
1.14 if not itip:
1.15 return []
1.16
1.17 - # Only handle calendar information.
1.18 -
1.19 - all_parts = []
1.20 -
1.21 # Require consistency between declared and employed methods.
1.22
1.23 if get_value(itip, "METHOD") == method:
1.24
1.25 # Look for different kinds of sections.
1.26
1.27 - all_objects = []
1.28 + all_results = []
1.29
1.30 for name, cls in handlers:
1.31 for details in get_values(itip, name) or []:
1.32 @@ -176,19 +173,18 @@
1.33 # Dispatch to a handler and obtain any response.
1.34
1.35 handler = cls(details, recipients)
1.36 - object = methods[method](handler)()
1.37 + result = methods[method](handler)()
1.38
1.39 # Concatenate responses for a single calendar object.
1.40
1.41 - if object:
1.42 - all_objects += object
1.43 -
1.44 - # Obtain a message part for the objects.
1.45 + if result:
1.46 + response_method, part = result
1.47 + outgoing = method != response_method
1.48 + all_results.append((outgoing, part))
1.49
1.50 - if all_objects:
1.51 - all_parts.append(to_part(response_methods[method], all_objects))
1.52 + return all_results
1.53
1.54 - return all_parts
1.55 + return []
1.56
1.57 def parse_object(f, encoding, objtype):
1.58
1.59 @@ -337,8 +333,4 @@
1.60 "REQUEST" : lambda handler: handler.request,
1.61 }
1.62
1.63 -response_methods = {
1.64 - "REQUEST" : "REPLY",
1.65 - }
1.66 -
1.67 # vim: tabstop=4 expandtab shiftwidth=4