This should fix LP #245291

This commit is contained in:
Chris Jones 2008-07-13 01:12:11 +01:00
parent c4d5d8c1a8
commit 95cee4485b
1 changed files with 11 additions and 10 deletions

View File

@ -318,7 +318,7 @@ text/plain
pos = "bottom" pos = "bottom"
return pos return pos
def add_matches (self, lboundry="[[:<:]]", rboundry="[[:>:]]"): def add_matches (self):
userchars = "-A-Za-z0-9" userchars = "-A-Za-z0-9"
passchars = "-A-Za-z0-9,?;.:/!%$^*&~\"#'" passchars = "-A-Za-z0-9,?;.:/!%$^*&~\"#'"
hostchars = "-A-Za-z0-9" hostchars = "-A-Za-z0-9"
@ -327,16 +327,17 @@ text/plain
user = "[" + userchars + "]+(:[" + passchars + "]+)?" user = "[" + userchars + "]+(:[" + passchars + "]+)?"
urlpath = "/[" + pathchars + "]*[^]'.}>) \t\r\n,\\\"]" urlpath = "/[" + pathchars + "]*[^]'.}>) \t\r\n,\\\"]"
self.matches['full_uri'] = self._vte.match_add(lboundry + schemes + "//(" + user + "@)?[" + hostchars +".]+(:[0-9]+)?(" + urlpath + ")?" + rboundry + "/?") if platform.system() == 'FreeBSD':
lboundary = "\\<"
# FreeBSD works with [[:<:]], Linux works with \< rboundary = "\\>"
if self.matches['full_uri'] == -1:
if lboundry != "\\<":
self.add_matches(lboundry = "\\<", rboundry = "\\>")
else: else:
self.matches['addr_only'] = self._vte.match_add (lboundry + "(www|ftp)[" + hostchars + "]*\.[" + hostchars + ".]+(:[0-9]+)?(" + urlpath + ")?" + rboundry + "/?") lboundry = "[[:<:]]"
self.matches['email'] = self._vte.match_add (lboundry + "(mailto:)?[a-zA-Z0-9][a-zA-Z0-9.+-]*@[a-zA-Z0-9][a-zA-Z0-9-]*\.[a-zA-Z0-9][a-zA-Z0-9-]+[.a-zA-Z0-9-]*" + rboundry) rboundry = "[[:>:]]"
self.matches['nntp'] = self._vte.match_add (lboundry + '''news:[-A-Z\^_a-z{|}~!"#$%&'()*+,./0-9;:=?`]+@[-A-Za-z0-9.]+(:[0-9]+)?''' + rboundry)
self.matches['full_uri'] = self._vte.match_add(lboundry + schemes + "//(" + user + "@)?[" + hostchars +".]+(:[0-9]+)?(" + urlpath + ")?" + rboundry + "/?")
self.matches['addr_only'] = self._vte.match_add (lboundry + "(www|ftp)[" + hostchars + "]*\.[" + hostchars + ".]+(:[0-9]+)?(" + urlpath + ")?" + rboundry + "/?")
self.matches['email'] = self._vte.match_add (lboundry + "(mailto:)?[a-zA-Z0-9][a-zA-Z0-9.+-]*@[a-zA-Z0-9][a-zA-Z0-9-]*\.[a-zA-Z0-9][a-zA-Z0-9-]+[.a-zA-Z0-9-]*" + rboundry)
self.matches['nntp'] = self._vte.match_add (lboundry + '''news:[-A-Z\^_a-z{|}~!"#$%&'()*+,./0-9;:=?`]+@[-A-Za-z0-9.]+(:[0-9]+)?''' + rboundry)
def spawn_child (self, event=None): def spawn_child (self, event=None):
update_records = self.conf.update_records update_records = self.conf.update_records