# HG changeset patch # User Paul Boddie # Date 1445708660 -7200 # Node ID d8cc0e7eed7626eb6af4a754e546ea8d88a16f9c # Parent ef84998441fd46c0ffc157b12e92b76ddd50e1e0 Support the non-complaint COUNTER described as REQUEST practice of Kontact. diff -r ef84998441fd -r d8cc0e7eed76 imiptools/config.py --- a/imiptools/config.py Sat Oct 24 17:14:59 2015 +0200 +++ b/imiptools/config.py Sat Oct 24 19:44:20 2015 +0200 @@ -104,4 +104,13 @@ FREEBUSY_OFFER_DEFAULT = None + + +# Policy settings. + +# Allow mislabelled iMIP Content-Type method parameter values for COUNTER +# messages (seen in Kontact). + +IMIP_COUNTER_AS_REQUEST = True + # vim: tabstop=4 expandtab shiftwidth=4 diff -r ef84998441fd -r d8cc0e7eed76 imiptools/content.py --- a/imiptools/content.py Sat Oct 24 17:14:59 2015 +0200 +++ b/imiptools/content.py Sat Oct 24 19:44:20 2015 +0200 @@ -19,6 +19,7 @@ this program. If not, see . """ +from imiptools.config import IMIP_COUNTER_AS_REQUEST from imiptools.data import Object, parse_object, get_value try: @@ -51,7 +52,14 @@ # Require consistency between declared and employed methods. - if get_value(itip, "METHOD") == method: + itip_method = get_value(itip, "METHOD") + + if itip_method == method or \ + IMIP_COUNTER_AS_REQUEST and itip_method == "COUNTER" and method == "REQUEST": + + # Assert the object's method as the definitive one. + + method = itip_method # Look for different kinds of sections.