|
|
@ -5,6 +5,9 @@ Import or export from dec to banana or from banana to dec. Thx to itec (https://
|
|
|
|
import prof
|
|
|
|
import prof
|
|
|
|
import re
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_links = {}
|
|
|
|
|
|
|
|
_lastlink = {}
|
|
|
|
|
|
|
|
|
|
|
|
def dec2banana(num, dictstart = None, shiftend = None, minlength = None, dictionary = None):
|
|
|
|
def dec2banana(num, dictstart = None, shiftend = None, minlength = None, dictionary = None):
|
|
|
|
#defaults
|
|
|
|
#defaults
|
|
|
|
if dictstart is None: dictstart = 0
|
|
|
|
if dictstart is None: dictstart = 0
|
|
|
@ -98,12 +101,41 @@ def _cmd_banana(cmd=None,text=None):
|
|
|
|
recipient = prof.get_current_recipient()
|
|
|
|
recipient = prof.get_current_recipient()
|
|
|
|
room = prof.get_current_muc()
|
|
|
|
room = prof.get_current_muc()
|
|
|
|
if recipient:
|
|
|
|
if recipient:
|
|
|
|
prof.send_line(proc)
|
|
|
|
prof.chat_show(recipient, proc)
|
|
|
|
elif room:
|
|
|
|
elif room:
|
|
|
|
prof.send_line(proc)
|
|
|
|
prof.room_show(room, proc)
|
|
|
|
elif prof.current_win_is_console():
|
|
|
|
elif prof.current_win_is_console():
|
|
|
|
prof.cons_show(proc)
|
|
|
|
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):
|
|
|
|
def prof_init(version, status, account_name, fulljid):
|
|
|
|
synopsis = [
|
|
|
|
synopsis = [
|
|
|
|
"/banana enc <message>"
|
|
|
|
"/banana enc <message>"
|
|
|
@ -114,7 +146,7 @@ def prof_init(version, status, account_name, fulljid):
|
|
|
|
[ "<message>", "The message to be bananified or debananified" ]
|
|
|
|
[ "<message>", "The message to be bananified or debananified" ]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
examples = [
|
|
|
|
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)
|
|
|
|
prof.register_command("/banana", 0, 2, synopsis, description, args, examples, _cmd_banana)
|
|
|
|