infocalypse
 
(Steve Dougherty)
2013-06-20: Fix formatting of derived Freemail addresses.

Fix formatting of derived Freemail addresses. Padding is omitted, the entire thing is lower case, and there is a '.' before 'freemail'.

diff --git a/infocalypse/wot.py b/infocalypse/wot.py
--- a/infocalypse/wot.py
+++ b/infocalypse/wot.py
@@ -1,3 +1,4 @@
+import string
 import fcp
 from config import Config
 import xml.etree.ElementTree as ET
@@ -322,7 +323,12 @@ def to_freemail_address(identity):
 
     for item in identity.iteritems():
         if item[1] == 'Freemail' and item[0].startswith('Context'):
-            return identity['Nickname'] + '@' + b32encode(base64decode(
-                identity['Identity'])) + 'freemail'
+            re_encode = b32encode(base64decode(identity['Identity']))
+            # Remove '=' padding.
+            re_encode = re_encode.split('=', 1)[0]
+
+            # Freemail addresses are lower case.
+            return string.lower(identity['Nickname'] + '@' + re_encode +
+                                '.freemail')
 
     return None