Tidied browser.py
This commit is contained in:
42
browser.py
42
browser.py
@@ -89,7 +89,7 @@ def prof_on_room_win_focus(room):
|
|||||||
prof.completer_add("/browser", _links[room])
|
prof.completer_add("/browser", _links[room])
|
||||||
|
|
||||||
|
|
||||||
def prof_post_chat_message_display(jid, message):
|
def _process_message(jid, current_jid, message):
|
||||||
links = re.findall(r'(https?://\S+)', message)
|
links = re.findall(r'(https?://\S+)', message)
|
||||||
if (len(links) > 0):
|
if (len(links) > 0):
|
||||||
if jid not in _links:
|
if jid not in _links:
|
||||||
@@ -98,43 +98,23 @@ def prof_post_chat_message_display(jid, message):
|
|||||||
for link in links:
|
for link in links:
|
||||||
if link not in _links[jid]:
|
if link not in _links[jid]:
|
||||||
_links[jid].append(link)
|
_links[jid].append(link)
|
||||||
# add to autocompleter if in chat with jid
|
# add to autocompleter if message for current window
|
||||||
current_jid = prof.get_current_recipient()
|
|
||||||
if current_jid == jid:
|
if current_jid == jid:
|
||||||
prof.completer_add("/browser", _links[jid])
|
prof.completer_add("/browser", _links[jid])
|
||||||
# set last link for jid
|
# set last link for jid
|
||||||
_lastlink[jid] = links[len(links)-1]
|
_lastlink[jid] = links[len(links)-1]
|
||||||
|
|
||||||
|
|
||||||
|
def prof_post_chat_message_display(jid, message):
|
||||||
|
current_jid = prof.get_current_recipient()
|
||||||
|
_process_message(jid, current_jid, message)
|
||||||
|
|
||||||
|
|
||||||
def prof_post_room_message_display(room, nick, message):
|
def prof_post_room_message_display(room, nick, message):
|
||||||
links = re.findall(r'(https?://\S+)', message)
|
current_jid = prof.get_current_muc()
|
||||||
if (len(links) > 0):
|
_process_message(room, current_jid, message)
|
||||||
if room not in _links:
|
|
||||||
_links[room] = []
|
|
||||||
# add to list of links for room
|
|
||||||
for link in links:
|
|
||||||
if link not in _links[room]:
|
|
||||||
_links[room].append(link)
|
|
||||||
# add to autocompleter if in room
|
|
||||||
current_room = prof.get_current_muc()
|
|
||||||
if current_room == room:
|
|
||||||
prof.completer_add("/browser", _links[room])
|
|
||||||
# set last link for room
|
|
||||||
_lastlink[room] = links[len(links)-1]
|
|
||||||
|
|
||||||
|
|
||||||
def prof_on_room_history_message(room, nick, message, timestamp):
|
def prof_on_room_history_message(room, nick, message, timestamp):
|
||||||
links = re.findall(r'(https?://\S+)', message)
|
current_jid = prof.get_current_muc()
|
||||||
if (len(links) > 0):
|
_process_message(room, current_jid, message)
|
||||||
if room not in _links:
|
|
||||||
_links[room] = []
|
|
||||||
# add to list of links for room
|
|
||||||
for link in links:
|
|
||||||
if link not in _links[room]:
|
|
||||||
_links[room].append(link)
|
|
||||||
# add to autocompleter if in room
|
|
||||||
current_room = prof.get_current_muc()
|
|
||||||
if current_room == room:
|
|
||||||
prof.completer_add("/browser", _links[room])
|
|
||||||
# set last link for room
|
|
||||||
_lastlink[room] = links[len(links)-1]
|
|
||||||
|
|||||||
Reference in New Issue
Block a user