From 915f863e2ef576100915708367376d4ab03d9892 Mon Sep 17 00:00:00 2001 From: Quinox Date: Sun, 31 Oct 2010 17:48:26 +0000 Subject: [PATCH] Reinstated propagating UserResolveNotification for plugin system --- pynicotine/pluginsystem.py | 5 ++++- pynicotine/pynicotine.py | 3 +++ pynicotine/utils.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pynicotine/pluginsystem.py b/pynicotine/pluginsystem.py index f07c6089d299..a0c7a1a45020 100644 --- a/pynicotine/pluginsystem.py +++ b/pynicotine/pluginsystem.py @@ -336,7 +336,10 @@ def OutgoingBuddySearchEvent(self, text): return self.TriggerEvent("OutgoingBuddySearchEvent", (text,)) def OutgoingUserSearchEvent(self, users): return self.TriggerEvent("OutgoingUserSearchEvent", (users,)) - def UserResolveNotification(self, user, ip, port, country): + def UserResolveNotification(self, user, ip, port, country=None): + """Notification for user IP:Port resolving. + + Note that country is only set when the user requested the resolving""" start_new_thread(self.TriggerEvent, ("UserResolveNotification", (user, ip, port, country))) def ServerConnectNotification(self): start_new_thread(self.TriggerEvent, ("ServerConnectNotification", (),)) diff --git a/pynicotine/pynicotine.py b/pynicotine/pynicotine.py index b12f7c155f4b..379daf17b0b4 100644 --- a/pynicotine/pynicotine.py +++ b/pynicotine/pynicotine.py @@ -1087,9 +1087,12 @@ def GetPeerAddress(self, msg): self.frame.OnIgnoreUser(msg.user) del self.ipignore_requested[msg.user] return + # From this point on all paths should call + # self.frame.pluginhandler.UserResolveNotification precisely once if msg.user in self.PrivateMessageQueue: self.PrivateMessageQueueProcess(msg.user) if msg.user not in self.ip_requested: + self.frame.pluginhandler.UserResolveNotification(msg.user, msg.ip, msg.port) return self.ip_requested.remove(msg.user) import socket diff --git a/pynicotine/utils.py b/pynicotine/utils.py index 3b59abdfb086..7f97dddc8213 100644 --- a/pynicotine/utils.py +++ b/pynicotine/utils.py @@ -69,7 +69,7 @@ def CleanPath(path, absolute=False): for char in illegalpathchars: path = path.replace(char, replacementchar) path = ''.join([drive, path]) - # Path can never end in a period on Windows machines + # Path can never end with a period on Windows machines path = path.rstrip('.') return path