From a60d888467b796bdf7ed7cd63c53cef8dcfc779c Mon Sep 17 00:00:00 2001 From: James French Date: Mon, 4 Mar 2013 22:42:58 +0800 Subject: [PATCH] Disable Outlook Rules for Facebook - Bugfixes as a bonus --- icalparse.py | 7 +++++-- parserrules.py | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/icalparse.py b/icalparse.py index 4dd1229..1d62a70 100755 --- a/icalparse.py +++ b/icalparse.py @@ -206,11 +206,14 @@ def exitQuiet(exitstate=0): def runCGI(): - '''Main run function if this script is called as a CGI script''' + '''Main run function if this script is called as a CGI script + to process facebook ical files''' import cgi import re import cgitb; cgitb.enable() + ruleConfig["facebook"] = True + form = cgi.FieldStorage() if "uid" not in form or "key" not in form: print('Content-Type: text/calendar\n') @@ -248,7 +251,7 @@ def runCGI(): cal = applyRules(cal, generateRules(ruleConfig), False) print('Content-Type: text/calendar; charset=%s\n'%encoding) - icalparse.writeOutput(cal) + writeOutput(cal) if __name__ == '__main__': diff --git a/parserrules.py b/parserrules.py index 4bb0dd5..4ba71e8 100644 --- a/parserrules.py +++ b/parserrules.py @@ -62,6 +62,8 @@ def whatPrivacy(cal): def dropAttributes(cal): '''Removing unwanted metadata''' + if "facebook" in ruleConfig: + if ruleConfig["facebook"] == True: return cal eventBlacklist = [x.lower() for x in [ "X-ALT-DESC", @@ -103,6 +105,8 @@ def dropAttributes(cal): def exDate(cal): '''Replacing multi-value EXDATES with multiple single-value EXDATES''' + if "facebook" in ruleConfig: + if ruleConfig["facebook"] == True: return cal from datetime import datetime from pytz import timezone -- 2.20.1