def _cmd_cricket(): global _score_url global _summary new_summary = None result_json = _retrieve_scores_json() if (result_json): if 'ms' in result_json.keys(): new_summary = result_json['ms'] prof.cons_show("") prof.cons_show("Cricket score:") if 't1FI' in result_json.keys(): prof.cons_show(" " + result_json['t1FI']) if 't2FI' in result_json.keys(): prof.cons_show(" " + result_json['t2FI']) if 't1SI' in result_json.keys(): prof.cons_show(" " + result_json['t1SI']) if 't2SI' in result_json.keys(): prof.cons_show(" " + result_json['t2SI']) _summary = new_summary prof.cons_show("") prof.cons_show(" " + _summary) prof.cons_alert()
def _cmd_system(arg1=None, arg2=None): if not arg1: create_win() prof.win_focus(system_win) elif arg1 == "send": if arg2 == None: prof.cons_bad_cmd_usage("/system") else: room = prof.get_current_muc() recipient = prof.get_current_recipient() if room == None and recipient == None: prof.cons_show( "You must be in a chat or muc window to send a system command" ) prof.cons_alert() else: result = _get_result(arg2) prof.send_line(u'\u000A' + result) elif arg1 == "exec": if arg2 == None: prof.cons_bad_cmd_usage("/system") else: create_win() prof.win_focus(system_win) _handle_win_input(system_win, arg2) else: prof.cons_bad_cmd_usage("/system")
def _cmd_system(arg1=None, arg2=None): if not arg1: create_win() prof.win_focus(system_win) elif arg1 == "send": if arg2 == None: prof.cons_bad_cmd_usage("/system") else: room = prof.get_current_muc() recipient = prof.get_current_recipient() if room == None and recipient == None: prof.cons_show("You must be in a chat or muc window to send a system command") prof.cons_alert() else: result = _get_result(arg2) prof.send_line(u'\u000A' + result) elif arg1 == "exec": if arg2 == None: prof.cons_bad_cmd_usage("/system") else: create_win() prof.win_focus(system_win) _handle_win_input(system_win, arg2) else: prof.cons_bad_cmd_usage("/system")
def _cmd_python(msg): if msg: prof.cons_show("python-test: /python command called, arg = " + msg) else: prof.cons_show("python-test: /python command called with no arg") prof.cons_alert() prof.notify("python-test: notify", 2000, "Plugins") prof.send_line("/vercheck") prof.cons_show("python-test: sent \"/vercheck\" command")
def _handle_send(command=None): if command == None: prof.cons_bad_cmd_usage("/system") return room = prof.get_current_muc() recipient = prof.get_current_recipient() if room == None and recipient == None: prof.cons_show("You must be in a chat or muc window to send a system command") prof.cons_alert() return result = _get_result(command) newline = prof.settings_boolean_get("system", "newline", True) if len(result.splitlines()) > 1 and newline: prof.send_line(u'\u000A' + result) else: prof.send_line(result)
def _handle_send(command=None): if command == None: prof.cons_bad_cmd_usage("/system") return room = prof.get_current_muc() recipient = prof.get_current_recipient() if room == None and recipient == None: prof.cons_show( "You must be in a chat or muc window to send a system command") prof.cons_alert() return result = _get_result(command) newline = prof.settings_boolean_get("system", "newline", True) if len(result.splitlines()) > 1 and newline: prof.send_line(u'\u000A' + result) else: prof.send_line(result)
def _get_scores(): global _score_url global _summary notify = None new_summary = None change = False result_json = _retrieve_scores_json() if (result_json): if 'ms' in result_json.keys(): new_summary = result_json['ms'] if new_summary != _summary: change = True if change: prof.cons_show("") prof.cons_show("Cricket score:") if 't1FI' in result_json.keys(): notify = result_json['t1FI'] prof.cons_show(" " + result_json['t1FI']) if 't2FI' in result_json.keys(): notify += "\n" + result_json['t2FI'] prof.cons_show(" " + result_json['t2FI']) if 't1SI' in result_json.keys(): notify += "\n" + result_json['t1SI'] prof.cons_show(" " + result_json['t1SI']) if 't2SI' in result_json.keys(): notify += "\n" + result_json['t2SI'] prof.cons_show(" " + result_json['t2SI']) _summary = new_summary notify += "\n\n" + _summary prof.cons_show("") prof.cons_show(" " + _summary) prof.cons_alert() prof.notify(notify, 5000, "Cricket score")
def cmd_pythontest(arg1=None, arg2=None, arg3=None, arg4=None, arg5=None): if arg1 == "consalert": create_win() prof.win_focus(plugin_win) prof.cons_alert() prof.win_show(plugin_win, "called -> prof.cons_alert") elif arg1 == "consshow": if arg2 != None: create_win() prof.win_focus(plugin_win) prof.cons_show(arg2) prof.win_show(plugin_win, "called -> prof.cons_show: " + arg2) else: prof.cons_bad_cmd_usage("/python-test") elif arg1 == "consshow_t": if arg2 == None or arg3 == None or arg4 == None or arg5 == None: prof.cons_bad_cmd_usage("/python-test"); else: group = None if arg2 == "none" else arg2 key = None if arg3 == "none" else arg3 dflt = None if arg4 == "none" else arg4 message = arg5 create_win() prof.win_focus(plugin_win) prof.cons_show_themed(group, key, dflt, message) prof.win_show(plugin_win, "called -> prof.cons_show_themed: " + arg2 + ", " + arg3 + ", " + arg4 + ", " + arg5) elif arg1 == "constest": res = prof.current_win_is_console() create_win() prof.win_focus(plugin_win) if res: prof.win_show(plugin_win, "called -> prof.current_win_is_console: true") else: prof.win_show(plugin_win, "called -> prof.current_win_is_console: false") elif arg1 == "winshow": if arg2 != None: create_win() prof.win_focus(plugin_win) prof.win_show(plugin_win, arg2) prof.win_show(plugin_win, "called -> prof.win_show: " + arg2) else: prof.cons_bad_cmd_usage("/python-test") elif arg1 == "winshow_t": if arg2 == None or arg3 == None or arg4 == None or arg5 == None: prof.cons_bad_cmd_usage("/python-test"); else: group = None if arg2 == "none" else arg2 key = None if arg3 == "none" else arg3 dflt = None if arg4 == "none" else arg4 message = arg5 create_win() prof.win_focus(plugin_win) prof.win_show_themed(plugin_win, group, key, dflt, message) prof.win_show(plugin_win, "called -> prof_win_show_themed: " + arg2 + ", " + arg3 + ", " + arg4 + ", " + arg5) elif arg1 == "sendline": if arg2 != None: create_win() prof.win_focus(plugin_win) prof.send_line(arg2) prof.win_show(plugin_win, "called -> prof.send_line: " + arg2) else: prof.cons_bad_cmd_usage("/python-test") elif arg1 == "notify": if arg2 != None: create_win() prof.win_focus(plugin_win) prof.notify(arg2, 5000, "python-test plugin") prof.win_show(plugin_win, "called -> prof.notify: " + arg2) else: prof.cons_bad_cmd_usage("/python-test") elif arg1 == "get": if arg2 == None: prof.cons_bad_cmd_usage("/python-test") elif arg2 == "recipient": create_win() recipient = prof.get_current_recipient(); if recipient != None: prof.win_focus(plugin_win) prof.win_show(plugin_win, "called -> prof.get_current_recipient: " + recipient) else: prof.win_focus(plugin_win) prof.win_show(plugin_win, "called -> prof_get_current_recipient: <none>") elif arg2 == "room": create_win() room = prof.get_current_muc() if room != None: prof.win_focus(plugin_win) prof.win_show(plugin_win, "called -> prof_get_current_muc: " + room) else: prof.win_focus(plugin_win) prof.win_show(plugin_win, "called -> prof_get_current_muc: <none>") else: prof.cons_bad_cmd_usage("/python-test") elif arg1 == "log": if arg2 == None: prof.cons_bad_cmd_usage("/python-test") elif arg2 == "debug": if arg3 == None: prof.cons_bad_cmd_usage("/python-test") else: create_win() prof.win_focus(plugin_win) prof.log_debug(arg3) prof.win_show(plugin_win, "called -> prof.log_debug: " + arg3) elif arg2 == "info": if arg3 == None: prof.cons_bad_cmd_usage("/python-test") else: create_win() prof.win_focus(plugin_win) prof.log_info(arg3) prof.win_show(plugin_win, "called -> prof.log_info: " + arg3) elif arg2 == "warning": if arg3 == None: prof.cons_bad_cmd_usage("/python-test") else: create_win() prof.win_focus(plugin_win) prof.log_warning(arg3) prof.win_show(plugin_win, "called -> prof.log_warning: " + arg3) elif arg2 == "error": if arg3 == None: prof.cons_bad_cmd_usage("/python-test") else: create_win() prof.win_focus(plugin_win) prof.log_error(arg3) prof.win_show(plugin_win, "called -> prof.log_error: " + arg3) else: prof.cons_bad_cmd_usage("/python-test") elif arg1 == "count": create_win() prof.win_focus(plugin_win) prof.win_show(plugin_win, "Count: " + str(count)) else: prof.cons_bad_cmd_usage("/python-test")
def prof_on_room_message_send(room, message): prof.cons_show("python-test: on_room_message_send, " + room + ", " + message) prof.cons_alert() return message + "[PYTHON]"
def prof_on_message_send(jid, message): prof.cons_show("python-test: on_message_send, " + jid + ", " + message) prof.cons_alert() return message + "[PYTHON]"
def prof_on_private_message_received(room, nick, message): prof.cons_show("python-test: on_private_message_received, " + room + ", " + nick + ", " + message) prof.cons_alert() return message + "[PYTHON]"
def _timer_test(): prof.cons_show("python-test: timer fired.") recipient = prof.get_current_recipient() if recipient: prof.cons_show(" current recipient = " + recipient) prof.cons_alert()
def _consalert(): prof.win_create(plugin_win, _handle_win_input) prof.win_focus(plugin_win) prof.cons_alert() prof.win_show(plugin_win, "called -> prof.cons_alert")