def _boolean(op, group, key, value_str):
    if op != "get" and op != "set":
        prof.cons_bad_cmd_usage("/python-test")
        return

    if group == None or key == None:
        prof.cons_bad_cmd_usage("/python-test")
        return

    if op == "set" and value_str != "true" and value_str != "false":
        prof.cons_bad_cmd_usage("/python-test")
        return

    if op == "get":
        dflt = False
        prof.win_create(plugin_win, _handle_win_input)
        prof.win_focus(plugin_win)
        res = prof.settings_boolean_get(group, key, dflt)
        if res:
            prof.win_show(plugin_win, "Boolean setting: TRUE")
        else:
            prof.win_show(plugin_win, "Boolean setting: FALSE")
    elif op == "set":
        value = False
        if value_str == "true":
            value = True
        prof.win_create(plugin_win, _handle_win_input)
        prof.win_focus(plugin_win)
        prof.settings_boolean_set(group, key, value)
        prof.win_show(plugin_win,
                      "Set [" + group + "] " + key + " to " + str(value))
def prof_on_unload():
    global thread_stop

    prof.win_create(plugin_win, _handle_win_input)
    prof.win_show(plugin_win, "fired -> prof_on_unload")
    thread_stop.set()
    count_thread.join()
def _string(op, group, key, value):
    if op != "get" and op != "set":
        prof.cons_bad_cmd_usage("/python-test")
        return

    if group == None or key == None:
        prof.cons_bad_cmd_usage("/python-test")
        return

    if op == "set" and not value:
        prof.cons_bad_cmd_usage("/python-test")
        return

    if op == "get":
        prof.win_create(plugin_win, _handle_win_input)
        prof.win_focus(plugin_win)
        res = prof.settings_string_get(group, key, None)
        if res:
            prof.win_show(plugin_win, "String setting: " + res)
        else:
            prof.win_show(plugin_win, "String setting: None")
    elif op == "set":
        prof.win_create(plugin_win, _handle_win_input)
        prof.win_focus(plugin_win)
        prof.settings_string_set(group, key, value)
        prof.win_show(plugin_win,
                      "Set [" + group + "] " + key + " to " + value)
def _notify(msg):
    if not msg:
        prof.cons_bad_cmd_usage("/python-test")
        return

    prof.win_create(plugin_win, _handle_win_input)
    prof.win_focus(plugin_win)
    prof.notify(msg, 5000, "python-test plugin")
    prof.win_show(plugin_win, "called -> prof.notify: " + msg)
def _sendline(line):
    if not line:
        prof.cons_bad_cmd_usage("/python-test")
        return

    prof.win_create(plugin_win, _handle_win_input)
    prof.win_focus(plugin_win)
    prof.send_line(line)
    prof.win_show(plugin_win, "called -> prof.send_line: " + line)
示例#6
0
def _cmd_upper(line):
    global _win_tag;
    if prof.win_exists(_win_tag) == False:
        prof.win_create(_win_tag, _handle_upper)

    prof.win_focus(_win_tag)

    if line:
        _handle_upper(_win_tag, line)
def _winshow(msg):
    if not msg:
        prof.cons_bad_cmd_usage("/python-test")
        return

    prof.win_create(plugin_win, _handle_win_input)
    prof.win_focus(plugin_win)
    prof.win_show(plugin_win, msg)
    prof.win_show(plugin_win, "called -> prof.win_show: " + msg)
def _constest():
    res = prof.current_win_is_console()
    prof.win_create(plugin_win, _handle_win_input)
    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")
def prof_on_contact_offline(barejid, resource, status):
    prof.win_create(plugin_win, _handle_win_input)
    if status:
        prof.win_show(
            plugin_win, "fired -> prof_on_contact_offline: " + barejid + "/" +
            resource + " \"" + status + "\"")
    else:
        prof.win_show(
            plugin_win,
            "fired -> prof_on_contact_offline: " + barejid + "/" + resource)
示例#10
0
def prof_on_room_history_message(barejid, nick, message, timestamp):
    prof.win_create(plugin_win, _handle_win_input)
    if timestamp:
        prof.win_show(
            plugin_win, "fired -> prof_on_room_history_message: " + barejid +
            ", " + nick + ", " + message + ", " + timestamp)
    else:
        prof.win_show(
            plugin_win, "fired -> prof_on_room_history_message: " + barejid +
            ", " + nick + ", " + message)
示例#11
0
def prof_init(version, status):
    t = threading.Thread(target=_inc_counter)
    t.daemon = True
    t.start()

    prof.win_create(plugin_win, _handle_win_input)

    synopsis = [
        "/python-test consalert",
        "/python-test consshow <message>",
        "/python-test consshow_t <group> <key> <default> <message>",
        "/python-test constest",
        "/python-test winshow <message>",
        "/python-test winshow_t <group> <key> <default> <message>",
        "/python-test notify <message>",
        "/python-test sendline <line>",
        "/python-test get recipient|room",
        "/python-test log debug|info|warning|error <message>",
        "/python-test count"
    ]
    description = "Python test plugins. All commands focus the plugin window."
    args = [
        [ "consalert",                                      "Highlight the console window in the status bar" ],
        [ "consshow <message>",                             "Show the message in the console window" ],
        [ "consshow_t <group> <key> <default> <message>",   "Show the themed message in the console window. " ],
        [ "constest",                                       "Show whether the command was run in the console." ],
        [ "winshow <message>",                              "Show the message in the plugin window" ],
        [ "winshow_t <group> <key> <default> <message>",    "Show the themed message in the plugin window. " ],
        [ "notify <message>",                               "Send a desktop notification with message" ],
        [ "sendline <line>",                                "Pass line to profanity to process" ],
        [ "get recipient",                                  "Show the current chat recipient, if in a chat window" ],
        [ "get room",                                       "Show the current room JID, if ina a chat room"],
        [ "log debug|info|warning|error <message>",         "Log a message at the specified level" ],
        [ "count",                                          "Show the counter, incremented every 5 seconds by a worker thread" ]
    ]
    examples = [
        "/python-test sendline /about",
        "/python-test log debug \"Test debug message\"",
        "/python-test consshow_t c-test cons.show none \"This is themed\"",
        "/python-test consshow_t none none bold_cyan \"This is bold_cyan\""
    ]

    prof.register_command("/python-test", 1, 5, synopsis, description, args, examples, cmd_pythontest)

    prof.register_ac("/python-test", 
        [ "consalert", "consshow", "consshow_t", "constest", "winshow", "winshow_t", "notify", "sendline", "get", "log", "count" ]
    )
    prof.register_ac("/python-test get",
        [ "recipient", "room" ]
    )
    prof.register_ac("/python-test log",
        [ "debug", "info", "warning", "error" ]
    )

    prof.register_timed(timed_callback, 30)
示例#12
0
def prof_on_contact_presence(barejid, resource, presence, status, priority):
    prof.win_create(plugin_win, _handle_win_input)
    if status:
        prof.win_show(
            plugin_win,
            "fired -> prof_on_contact_presence: " + barejid + "/" + resource +
            " " + presence + " " + str(priority) + " \"" + status + "\"")
    else:
        prof.win_show(
            plugin_win, "fired -> prof_on_contact_presence: " + barejid + "/" +
            resource + " " + presence + " " + str(priority))
示例#13
0
def _winshow_t(group, key, dflt, msg):
    if not group or not key or not dflt or not msg:
        prof.cons_bad_cmd_usage("/python-test")
        return

    prof.win_create(plugin_win, _handle_win_input)
    prof.win_focus(plugin_win)
    groupval = None if group == "none" else group
    keyval = None if key == "none" else key
    dfltval = None if dflt == "none" else dflt
    prof.win_show_themed(plugin_win, groupval, keyval, dfltval, msg)
    prof.win_show(
        plugin_win, "called -> prof_win_show_themed: " + group + ", " + key +
        ", " + dflt + ", " + msg)
示例#14
0
def _log(level, msg):
    if not level or not msg:
        prof.cons_bad_cmd_usage("/python-test")
        return

    if level == "debug":
        prof.win_create(plugin_win, _handle_win_input)
        prof.win_focus(plugin_win)
        prof.log_debug(msg)
        prof.win_show(plugin_win, "called -> prof.log_debug: " + msg)
    elif level == "info":
        prof.win_create(plugin_win, _handle_win_input)
        prof.win_focus(plugin_win)
        prof.log_info(msg)
        prof.win_show(plugin_win, "called -> prof.log_info: " + msg)
    elif level == "warning":
        prof.win_create(plugin_win, _handle_win_input)
        prof.win_focus(plugin_win)
        prof.log_warning(msg)
        prof.win_show(plugin_win, "called -> prof.log_warning: " + msg)
    elif level == "error":
        prof.win_create(plugin_win, _handle_win_input)
        prof.win_focus(plugin_win)
        prof.log_error(msg)
        prof.win_show(plugin_win, "called -> prof.log_error: " + msg)
    else:
        prof.cons_bad_cmd_usage("/python-test")
示例#15
0
def _quit_application():
    quit_keyword = 'quit'
    user_message = "Enter '" + quit_keyword + "' to quit the program: "
    user_entry =   prof.win_create(user_message)

    if user_entry != quit_keyword:
        _quit_application()
示例#16
0
def _ping(jid):
    global ping_id

    if not jid:
        prof.cons_bad_cmd_usage("/python-test")
        return

    prof.win_create(plugin_win, _handle_win_input)
    prof.win_focus(plugin_win)
    res = prof.send_stanza("<iq to='" + jid + "' id='pythonplugin-" +
                           str(ping_id) +
                           "' type='get'><ping xmlns='urn:xmpp:ping'/></iq>")
    ping_id = ping_id + 1
    if res:
        prof.win_show(plugin_win, "Ping sent successfully")
    else:
        prof.win_show(plugin_win, "Error sending ping")
示例#17
0
def _get(subject):
    if subject == "recipient":
        prof.win_create(plugin_win, _handle_win_input)
        recipient = prof.get_current_recipient()
        if recipient:
            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 subject == "room":
        prof.win_create(plugin_win, _handle_win_input)
        room = prof.get_current_muc()
        if room:
            prof.win_focus(plugin_win)
            prof.win_show(plugin_win,
                          "called -> prof_get_current_muc: " + room)
            nick = prof.get_room_nick(room)
            if nick:
                prof.win_focus(plugin_win)
                prof.win_show(
                    plugin_win,
                    "called -> prof_get_room_nick('" + room + "'): " + nick)
        else:
            prof.win_focus(plugin_win)
            prof.win_show(plugin_win, "called -> prof_get_current_muc: <none>")
    elif subject == "nick":
        prof.win_create(plugin_win, _handle_win_input)
        nick = prof.get_current_nick()
        if nick:
            prof.win_focus(plugin_win)
            prof.win_show(plugin_win,
                          "called -> prof_get_current_nick: " + nick)
        else:
            prof.win_focus(plugin_win)
            prof.win_show(plugin_win,
                          "called -> prof_get_current_nick: <none>")
    elif subject == "occupants":
        prof.win_create(plugin_win, _handle_win_input)
        occupants = prof.get_current_occupants()
        if occupants:
            prof.win_focus(plugin_win)
            prof.win_show(plugin_win, "called -> prof_get_current_occupants:")
            for occupant in occupants:
                prof.win_show(plugin_win, occupant)
        else:
            prof.win_focus(plugin_win)
            prof.win_show(plugin_win,
                          "called -> prof_get_current_occupants: <none>")
    else:
        prof.cons_bad_cmd_usage("/python-test")
示例#18
0
def _int(op, group, key, value):
    if op != "get" and op != "set":
        prof.cons_bad_cmd_usage("/python-test")
        return

    if group == None or key == None:
        prof.cons_bad_cmd_usage("/python-test")
        return

    if op == "get":
        prof.win_create(plugin_win, _handle_win_input)
        prof.win_focus(plugin_win)
        res = prof.settings_int_get(group, key, 0)
        prof.win_show(plugin_win, "Integer setting: " + str(res))
    elif op == "set":
        prof.win_create(plugin_win, _handle_win_input)
        prof.win_focus(plugin_win)
        prof.settings_int_set(group, key, int(value))
        prof.win_show(plugin_win,
                      "Set [" + group + "] " + key + " to " + str(value))
示例#19
0
def _completer(op, item):
    if not item:
        prof.cons_bad_cmd_usage("/python-test")
        return

    if op == "add":
        prof.win_create(plugin_win, _handle_win_input)
        prof.win_focus(plugin_win)
        prof.completer_add("/python-test", [item])
        prof.win_show(plugin_win,
                      "Added \"" + item + "\" to /python-test completer")
        prof.completer_add("/python-test completer remove", [item])
    elif op == "remove":
        prof.win_create(plugin_win, _handle_win_input)
        prof.win_focus(plugin_win)
        prof.completer_remove("/python-test", [item])
        prof.win_show(plugin_win,
                      "Removed \"" + item + "\" to /python-test completer")
        prof.completer_remove("/python-test completer remove", [item])
    else:
        prof.cons_bad_cmd_usage("/python-test")
示例#20
0
def create_win():
    if prof.win_exists(plugin_win) == False:
        prof.win_create(plugin_win, _handle_win_input)
示例#21
0
def _create_win():
    if prof.win_exists(clients_win) == False:
        prof.win_create(clients_win, _handle_win_input)
示例#22
0
def prof_on_start():
    prof.win_create(win_tag, _handle_input)
    prof.win_show(win_tag, "Jenkins plugin started.")
示例#23
0
def prof_post_priv_message_send(barejid, nick, message):
    prof.win_create(plugin_win, _handle_win_input)
    prof.win_show(
        plugin_win, "fired -> prof_post_priv_message_send: " + barejid + ", " +
        nick + ", " + message)
示例#24
0
def _prof_callback():
    global changes_list
    if poll_fail:
        if not prof.win_exists(win_tag):
            prof.win_create(win_tag, _handle_input)
        prof.win_show(win_tag, "Could not connect to jenkins, see the logs.")
        if poll_fail_message:
            prof.log_warning("Jenkins poll failed: " + str(poll_fail_message))
        else:
            prof.log_warning("Jenkins poll failed")
    elif changes_list:
        for name in changes_list.get_in_state(STATE_QUEUED):
            if not prof.win_exists(win_tag):
                prof.win_create(win_tag, _handle_input)
            prof.win_show_themed(win_tag, None, None, "cyan", name + " " + STATE_QUEUED)
        for name in changes_list.get_in_state(STATE_RUNNING):
            if not prof.win_exists(win_tag):
                prof.win_create(win_tag, _handle_input)
            prof.win_show_themed(win_tag, None, None, "cyan", name + " " + STATE_RUNNING)
        for name, build_number in changes_list.get_in_state(STATE_SUCCESS):
            if not prof.win_exists(win_tag):
                prof.win_create(win_tag, _handle_input)
            prof.win_show_themed(win_tag, None, None, "green", name + " #" + str(build_number) + " " + STATE_SUCCESS)
            if enable_notify:
                prof.notify(name + " " + STATE_SUCCESS, 5000, "Jenkins")
        for name, build_number in changes_list.get_in_state(STATE_UNSTABLE):
            if not prof.win_exists(win_tag):
                prof.win_create(win_tag, _handle_input)
            prof.win_show_themed(win_tag, None, None, "yellow", name + " #" + str(build_number) + " " + STATE_UNSTABLE)
            if enable_notify:
                prof.notify(name + " " + STATE_UNSTABLE, 5000, "Jenkins")
        for name, build_number in changes_list.get_in_state(STATE_FAILURE):
            if not prof.win_exists(win_tag):
                prof.win_create(win_tag, _handle_input)
            prof.win_show_themed(win_tag, None, None, "red", name + " #" + str(build_number) + " " + STATE_FAILURE)
            if enable_notify:
                prof.notify(name + " " + STATE_FAILURE, 5000, "Jenkins")

        changes_list = None
示例#25
0
def _cmd_jenkins(cmd=None, arg=None):
    global enable_remind
    global enable_notify

    if not prof.win_exists(win_tag):
        prof.win_create(win_tag, _handle_input)

    prof.win_focus(win_tag)

    if cmd == "jobs":
        if job_list and job_list.get_jobs():
            prof.win_show(win_tag, "Jobs:")
            _list_jobs(job_list.get_jobs())
        else:
            prof.win_show(win_tag, "No job data yet.")
    elif cmd == "failing":
        if job_list:
            jobs_in_state = job_list.get_jobs(STATE_FAILURE)
            if jobs_in_state:
                prof.win_show(win_tag, "Failing jobs:")
                _list_jobs(jobs_in_state)
            else:
                prof.win_show(win_tag, "No failing jobs.")
        else:
            prof.win_show(win_tag, "No job data yet.")
    elif cmd == "passing":
        if job_list:
            jobs_in_state = job_list.get_jobs(STATE_SUCCESS)
            if jobs_in_state:
                prof.win_show(win_tag, "Passing jobs:")
                _list_jobs(jobs_in_state)
            else:
                prof.win_show(win_tag, "No passing jobs.")
        else:
            prof.win_show(win_tag, "No job data yet.")
    elif cmd == "unstable":
        if job_list:
            jobs_in_state = job_list.get_jobs(STATE_UNSTABLE)
            if jobs_in_state:
                prof.win_show(win_tag, "Unstable jobs:")
                _list_jobs(jobs_in_state)
            else:
                prof.win_show(win_tag, "No unstable jobs.")
        else:
            prof.win_show(win_tag, "No job data yet.")
    elif cmd == "build":
        if not arg:
            prof.win_show(win_tag, "You must supply a job argument.")
        elif job_list and job_list.contains_job(arg):
            _build_job(arg)
        else:
            prof.win_show(win_tag, "No such job: " + arg)
    elif cmd == "open":
        if not arg:
            prof.win_show(win_tag, "You must supply a job argument.")
        elif job_list and job_list.contains_job(arg):
            _open_job_url(jenkins_url + "/job/" + arg)
        else:
            prof.win_show(win_tag, "No such job: " + arg)
    elif cmd == "remind":
        if not arg:
            prof.win_show(win_tag, "You must specify either 'on' or 'off'.")
        elif arg == "on":
            enable_remind = True
            prof.win_show(win_tag, "Reminder notifications enabled.")
        elif arg == "off":
            enable_remind = False
            prof.win_show(win_tag, "Reminder notifications disabled.")
        else:
            prof.win_show(win_tag, "You must specify either 'on' or 'off'.")
    elif cmd == "notify":
        if not arg:
            prof.win_show(win_tag, "You must specify either 'on' or 'off'.")
        elif arg == "on":
            enable_notify = True
            prof.win_show(win_tag, "Build notifications enabled.")
        elif arg == "off":
            enable_notify = False
            prof.win_show(win_tag, "Build notifications disabled.")
        else:
            prof.win_show(win_tag, "You must specify either 'on' or 'off'.")
    elif cmd == "settings":
        _settings()
    elif cmd == "help":
        _help()
    elif cmd == "log":
        if not arg:
            prof.win_show(win_tag, "You must specify a job.")
        else:
            job = job_list.get_job(arg)
            if job:
                _job_log(job)
            else:
                prof.win_show(win_tag, "No job found: " + arg)
    else:
        prof.win_show(win_tag, "Unknown command.")
示例#26
0
def create_win():
    if prof.win_exists(system_win) == False:
        prof.win_create(system_win, _handle_win_input)
示例#27
0
def prof_on_start():
    prof.win_create(win_tag, _handle_input)
    prof.win_show(win_tag, "Jenkins plugin started.")
示例#28
0
def _prof_callback():
    global changes_list
    if poll_fail:
        if not prof.win_exists(win_tag):
            prof.win_create(win_tag, _handle_input)
        prof.win_show(win_tag, "Could not connect to jenkins, see the logs.")
        if poll_fail_message:
            prof.log_warning("Jenkins poll failed: " + str(poll_fail_message))
        else:
            prof.log_warning("Jenkins poll failed")
    elif changes_list:
        for name in changes_list.get_in_state(STATE_QUEUED):
            if not prof.win_exists(win_tag):
                prof.win_create(win_tag, _handle_input)
            prof.win_show_themed(win_tag, None, None, "cyan",
                                 name + " " + STATE_QUEUED)
        for name in changes_list.get_in_state(STATE_RUNNING):
            if not prof.win_exists(win_tag):
                prof.win_create(win_tag, _handle_input)
            prof.win_show_themed(win_tag, None, None, "cyan",
                                 name + " " + STATE_RUNNING)
        for name, build_number in changes_list.get_in_state(STATE_SUCCESS):
            if not prof.win_exists(win_tag):
                prof.win_create(win_tag, _handle_input)
            prof.win_show_themed(
                win_tag, None, None, "green",
                name + " #" + str(build_number) + " " + STATE_SUCCESS)
            if enable_notify:
                prof.notify(name + " " + STATE_SUCCESS, 5000, "Jenkins")
        for name, build_number in changes_list.get_in_state(STATE_UNSTABLE):
            if not prof.win_exists(win_tag):
                prof.win_create(win_tag, _handle_input)
            prof.win_show_themed(
                win_tag, None, None, "yellow",
                name + " #" + str(build_number) + " " + STATE_UNSTABLE)
            if enable_notify:
                prof.notify(name + " " + STATE_UNSTABLE, 5000, "Jenkins")
        for name, build_number in changes_list.get_in_state(STATE_FAILURE):
            if not prof.win_exists(win_tag):
                prof.win_create(win_tag, _handle_input)
            prof.win_show_themed(
                win_tag, None, None, "red",
                name + " #" + str(build_number) + " " + STATE_FAILURE)
            if enable_notify:
                prof.notify(name + " " + STATE_FAILURE, 5000, "Jenkins")

        changes_list = None
示例#29
0
def prof_pre_priv_message_display(barejid, nick, message):
    prof.win_create(plugin_win, _handle_win_input)
    prof.win_show(
        plugin_win, "fired -> prof_pre_priv_message_display: " + barejid +
        ", " + nick + ", " + message)
示例#30
0
def prof_on_room_win_focus(barejid):
    prof.win_create(plugin_win, _handle_win_input)
    prof.win_show(plugin_win, "fired -> prof_on_room_win_focus: " + barejid)
示例#31
0
def prof_on_start():
    prof.win_create(plugin_win, _handle_win_input)
    prof.win_show(plugin_win, "fired -> prof_on_start")
示例#32
0
def prof_on_disconnect(account_name, fulljid):
    prof.win_create(plugin_win, _handle_win_input)
    prof.win_show(
        plugin_win,
        "fired -> prof_on_disconnect: " + account_name + ", " + fulljid)
示例#33
0
def prof_on_iq_stanza_receive(stanza):
    prof.win_create(plugin_win, _handle_win_input)
    prof.win_show(plugin_win, "fired -> prof_on_iq_stanza_receive: " + stanza)
    return True
示例#34
0
def prof_post_chat_message_display(barejid, resource, message):
    prof.win_create(plugin_win, _handle_win_input)
    prof.win_show(
        plugin_win, "fired -> prof_post_chat_message_display: " + barejid +
        "/" + resource + ", " + message)
示例#35
0
def _cmd_jenkins(cmd=None, arg=None):
    global enable_remind
    global enable_notify

    if not prof.win_exists(win_tag):
        prof.win_create(win_tag, _handle_input)

    prof.win_focus(win_tag)

    if cmd == "jobs":
        if job_list and job_list.get_jobs():
            prof.win_show(win_tag, "Jobs:")
            _list_jobs(job_list.get_jobs())
        else:
            prof.win_show(win_tag, "No job data yet.")
    elif cmd == "failing":
        if job_list:
            jobs_in_state = job_list.get_jobs(STATE_FAILURE)
            if jobs_in_state:
                prof.win_show(win_tag, "Failing jobs:")
                _list_jobs(jobs_in_state)
            else:
                prof.win_show(win_tag, "No failing jobs.")
        else:
            prof.win_show(win_tag, "No job data yet.")
    elif cmd == "passing":
        if job_list:
            jobs_in_state = job_list.get_jobs(STATE_SUCCESS)
            if jobs_in_state:
                prof.win_show(win_tag, "Passing jobs:")
                _list_jobs(jobs_in_state)
            else:
                prof.win_show(win_tag, "No passing jobs.")
        else:
            prof.win_show(win_tag, "No job data yet.")
    elif cmd == "unstable":
        if job_list:
            jobs_in_state = job_list.get_jobs(STATE_UNSTABLE)
            if jobs_in_state:
                prof.win_show(win_tag, "Unstable jobs:")
                _list_jobs(jobs_in_state)
            else:
                prof.win_show(win_tag, "No unstable jobs.")
        else:
            prof.win_show(win_tag, "No job data yet.")
    elif cmd == "build":
        if not arg:
            prof.win_show(win_tag, "You must supply a job argument.")
        elif job_list and job_list.contains_job(arg):
            _build_job(arg)
        else:
            prof.win_show(win_tag, "No such job: " + arg)
    elif cmd == "open":
        if not arg:
            prof.win_show(win_tag, "You must supply a job argument.")
        elif job_list and job_list.contains_job(arg):
            _open_job_url(jenkins_url + "/job/" + arg)
        else:
            prof.win_show(win_tag, "No such job: " + arg)
    elif cmd == "remind":
        if not arg:
            prof.win_show(win_tag, "You must specify either 'on' or 'off'.")
        elif arg == "on":
            enable_remind = True
            prof.win_show(win_tag, "Reminder notifications enabled.")
        elif arg == "off":
            enable_remind = False
            prof.win_show(win_tag, "Reminder notifications disabled.")
        else:
            prof.win_show(win_tag, "You must specify either 'on' or 'off'.")
    elif cmd == "notify":
        if not arg:
            prof.win_show(win_tag, "You must specify either 'on' or 'off'.")
        elif arg == "on":
            enable_notify = True
            prof.win_show(win_tag, "Build notifications enabled.")
        elif arg == "off":
            enable_notify = False
            prof.win_show(win_tag, "Build notifications disabled.")
        else:
            prof.win_show(win_tag, "You must specify either 'on' or 'off'.")
    elif cmd == "settings":
        _settings()
    elif cmd == "help":
        _help()
    elif cmd == "log":
        if not arg:
            prof.win_show(win_tag, "You must specify a job.")
        else:
            job = job_list.get_job(arg)
            if job:
                _job_log(job)
            else:
                prof.win_show(win_tag, "No job found: " + arg)
    else:
        prof.win_show(win_tag, "Unknown command.")
示例#36
0
def prof_pre_room_message_send(barejid, message):
    prof.win_create(plugin_win, _handle_win_input)
    prof.win_show(
        plugin_win,
        "fired -> prof_pre_room_message_send: " + barejid + ", " + message)
示例#37
0
def create_win():
    if prof.win_exists(system_win) == False:
        prof.win_create(system_win, _handle_win_input)
示例#38
0
def prof_on_iq_stanza_send(stanza):
    prof.win_create(plugin_win, _handle_win_input)
    prof.win_show(plugin_win, "fired -> prof_on_iq_stanza_send: " + stanza)