decode entire mex with autocompletion

master
Totem4 Totem4 4 years ago
parent 69aacb9e27
commit e0fd6d4577

@ -5,6 +5,9 @@ Import or export from dec to banana or from banana to dec. Thx to itec (https://
import prof
import re
_links = {}
_lastlink = {}
def dec2banana(num, dictstart = None, shiftend = None, minlength = None, dictionary = None):
#defaults
if dictstart is None: dictstart = 0
@ -98,12 +101,41 @@ def _cmd_banana(cmd=None,text=None):
recipient = prof.get_current_recipient()
room = prof.get_current_muc()
if recipient:
prof.send_line(proc)
prof.chat_show(recipient, proc)
elif room:
prof.send_line(proc)
prof.room_show(room, proc)
elif prof.current_win_is_console():
prof.cons_show(proc)
def _process_message(jid, current_jid, message):
links = re.search(r'[A-Z][A-Z]*',message).string.split('\n')
if links:
if jid not in _links:
_links[jid] = []
for link in links:
if link not in _links[jid]:
_links[jid].append(link)
if current_jid == jid:
prof.completer_add("/banana dec", _links[jid])
_lastlink[jid] = links[len(links)-1]
def prof_post_chat_message_display(jid, resource, message):
current_jid = prof.get_current_recipient()
_process_message(jid, current_jid, message)
def prof_post_room_message_display(room, nick, message):
current_jid = prof.get_current_muc()
_process_message(jid, current_jid, message)
def prof_on_room_history_message(room, nick, message, timestamp):
current_jid = prof.get_current_muc()
_process_message(jid, current_jid, message)
def prof_init(version, status, account_name, fulljid):
synopsis = [
"/banana enc <message>"
@ -114,7 +146,7 @@ def prof_init(version, status, account_name, fulljid):
[ "<message>", "The message to be bananified or debananified" ]
]
examples = [
"/banana dec 7467986 \n/banana enc GESUCANE"
"/banana enc 7467986 \n/banana dec GESUCANE"
]
prof.register_command("/banana", 0, 2, synopsis, description, args, examples, _cmd_banana)

Loading…
Cancel
Save