Skip to content

Commit

Permalink
[FritzCall] 2021-04-29 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-99 committed May 3, 2021
1 parent a29ce52 commit f76f77b
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions fritzcall/src/plugin.py
Expand Up @@ -2,9 +2,9 @@
'''
Update rev
$Author: michael $
$Revision: 1589 $
$Date: 2021-04-25 11:48:00 +0200 (Sun, 25 Apr 2021) $
$Id: plugin.py 1589 2021-04-25 09:48:00Z michael $
$Revision: 1591 $
$Date: 2021-04-29 16:52:10 +0200 (Thu, 29 Apr 2021) $
$Id: plugin.py 1591 2021-04-29 14:52:10Z michael $
'''

# C0111 (Missing docstring)
Expand Down Expand Up @@ -213,7 +213,10 @@ def initAvon():
avonFileName = resolveFilename(SCOPE_PLUGINS, "Extensions/FritzCall/avon.dat")
if os.path.exists(avonFileName):
for line in open(avonFileName):
line = six.ensure_text(line)
try:
line = six.ensure_text(line)
except UnicodeDecodeError:
line = six.ensure_text(line, "iso-8859-1") # to deal with old avon.dat
if line[0] == '#':
continue
parts = line.split(':')
Expand Down Expand Up @@ -347,8 +350,8 @@ def __init__(self, session):
self["text"] = Label(
"FritzCall Plugin" + "\n\n" +
"$Author: michael $"[1:-2] + "\n" +
"$Revision: 1589 $"[1:-2] + "\n" +
"$Date: 2021-04-25 11:48:00 +0200 (Sun, 25 Apr 2021) $"[1:23] + "\n"
"$Revision: 1591 $"[1:-2] + "\n" +
"$Date: 2021-04-29 16:52:10 +0200 (Thu, 29 Apr 2021) $"[1:23] + "\n"
)
self["url"] = Label("http://wiki.blue-panel.com/index.php/FritzCall")
self.onLayoutFinish.append(self.setWindowTitle)
Expand Down Expand Up @@ -2119,7 +2122,7 @@ def __init__(self, session, args = None): # @UnusedVariable # pylint: disable=W

def setWindowTitle(self):
# TRANSLATORS: this is a window title.
self.setTitle(_("FritzCall Setup") + " (" + "$Revision: 1589 $"[1:-1] + "$Date: 2021-04-25 11:48:00 +0200 (Sun, 25 Apr 2021) $"[7:23] + ")")
self.setTitle(_("FritzCall Setup") + " (" + "$Revision: 1591 $"[1:-1] + "$Date: 2021-04-29 16:52:10 +0200 (Thu, 29 Apr 2021) $"[7:23] + ")")

def keyLeft(self):
ConfigListScreen.keyLeft(self)
Expand Down Expand Up @@ -2679,7 +2682,7 @@ def notifyAndReset(self, number, caller):

class FritzProtocol(LineReceiver): # pylint: disable=W0223
def __init__(self):
info("[FritzProtocol] %s%s starting", "$Revision: 1589 $"[1:-1], "$Date: 2021-04-25 11:48:00 +0200 (Sun, 25 Apr 2021) $"[7:23])
info("[FritzProtocol] %s%s starting", "$Revision: 1591 $"[1:-1], "$Date: 2021-04-29 16:52:10 +0200 (Thu, 29 Apr 2021) $"[7:23])
global mutedOnConnID
mutedOnConnID = None
self.number = '0'
Expand Down Expand Up @@ -2809,9 +2812,13 @@ def lineReceived(self, line):
debug("[FritzProtocol] add local prefix")
self.number = config.plugins.FritzCall.prefix.value + self.number

# strip trailing #
if self.number[-1] == "#":
self.number = self.number[:-1]

# strip CbC prefixes
if self.event == "CALL":
number = stripCbCPrefix(self.number, config.plugins.FritzCall.countrycode.value)
self.number = stripCbCPrefix(self.number, config.plugins.FritzCall.countrycode.value)

info("[FritzProtocol] phonebook.search: %s", self.number)
self.caller = phonebook.search(self.number)
Expand Down

0 comments on commit f76f77b

Please sign in to comment.