Example #1
0
def prof_init(version, status, account_name, fulljid):
    synopsis = [
        "/autocorrector on|off", "/autocorrector showlist",
        "/autocorrector clearall", "/autocorrector add"
        "/autocorrector rm"
    ]
    description = "Messy typist autocorrector. Replaces common typos in your outgoing messages."
    args = [
        ["on|off", "Enable/disable correction for all windows"],
        ["showlist", "show typolist."],
        ["add", "Add entry to typolist. Use pattern:replacement as format."],
        [
            "rm",
            "Remove entry from typolist. Use pattern:replacement as format."
        ], ["clearall", "Remove all entries from typolist"]
    ]
    examples = [
        "/autocorrector on",
        "/autocorrector add tpyo:typo",
        "/autocorrector add tset:test",
        "/autocorrector rm tset:test",
        "/autocorrector showlist",
    ]

    prof.settings_string_set("autocorrector", "enabled", "on")
    prof.register_command("/autocorrector", 0, 2, synopsis, description, args,
                          examples, _cmd_autocorrector)
    prof.completer_add("/autocorrector",
                       ["on", "off", "clearall", "add", "rm", "showlist"])
def prof_init(version, status, account_name, fulljid):
    synopsis = [
        "/wikipedia search <text>",
        "/wikipedia summary <title>",
        "/wikipedia page <title>",
        "/wikipedia images <title>",
        "/wikipedia links <title>",
        "/wikipedia refs <title>",
        "/wikipedia open <url>"
    ]
    description = "Interact with wikipedia."
    args = [
        [ "search <text>",  "Search for pages" ],
        [ "summary <title>", "Show summary for page" ],
        [ "page <title>",    "Show the whole page" ],
        [ "images <title>",  "Show images URLs for page" ],
        [ "links <title>",   "Show links to other pages from page" ],
        [ "refs <title>",   "Show external references for page" ],
        [ "open <url>",     "Open the a URL in the browser" ]
    ]
    examples = [
        "/wikipedia search Iron Maiden"
    ]

    prof.register_command("/wikipedia", 2, 2, synopsis, description, args, examples, cmd_wp)

    prof.completer_add("/wikipedia", 
        [ "search", "summary", "page", "images", "links", "refs", "open" ]
    )
Example #3
0
def prof_init(version, status, account_name, fulljid):
    synopsis = [
        "/notifycmd on|off|active", "/notifycmd command <command>",
        "/notifycmd rooms on|off|mention"
    ]
    description = "Executes a command when a message is received"
    args = [
        ["on|off", "Enable/disable notifycmd for all windows"],
        ["active", "Enable notifycmd for active window only"],
        [
            "command <args>",
            "Set command to execute. Replaces %s with sender, %m with message and %% with literal %."
        ],
        [
            "rooms <args>",
            "Setting for multi-user rooms. Set to 'on', 'off' or 'mention'. If set to mention it will only run it your nick was mentioned."
        ]
    ]
    examples = []

    prof.register_command("/notifycmd", 0, 2, synopsis, description, args,
                          examples, _cmd_notifycmd)
    prof.completer_add("/notifycmd",
                       ["on", "off", "active", "command", "rooms"])
    prof.completer_add("/notifycmd rooms", ["on", "off", "mention"])
Example #4
0
def prof_init(version, status, account_name, fulljid):
    synopsis = ["/chatterbot", "/chatterbot enable|disable"]
    description = "ChatterBot, running with no args will show the current chatterbot status"
    args = [["enable", "Enable chatterbot"], ["disable", "Disable chatterbot"]]
    examples = []

    prof.register_command("/chatterbot", 0, 1, synopsis, description, args,
                          examples, _cmd_chatterbot)
    prof.completer_add("/chatterbot", ["enable", "disable"])
Example #5
0
def prof_init(version, status, account_name, fulljid):
    synopsis = ["/imgur <file_path>", "/imgur screenshot"]
    description = "Upload an image or screenshot to imgur and send the link"
    args = [["<file_path>", "full path to image file"],
            ["screenshot", "upload a full screen capture"]]
    examples = ["/imgur ~/images/cats.jpg", "/imgur screenshot"]

    prof.register_command("/imgur", 1, 1, synopsis, description, args,
                          examples, _cmd_imgur)
    prof.completer_add("/imgur", ["screenshot"])
    prof.filepath_completer_add("/imgur")
Example #6
0
def prof_init(version, status, account_name, fulljid):
    synopsis = ["/paste", "/paste newline on|off"]
    description = "Paste contents of clipboard."
    args = [[
        "newline on|off",
        "Send newline before multiline clipboard text, defaults to on"
    ]]
    examples = []
    prof.register_command("/paste", 0, 2, synopsis, description, args,
                          examples, _cmd_paste)
    prof.completer_add("/paste", ["newline"])
    prof.completer_add("/paste newline", ["on", "off"])
Example #7
0
def prof_init(version, status, account_name, fulljid):
    synopsis = [
        "/paste",
        "/paste newline on|off"
    ]
    description = "Paste contents of clipboard."
    args = [
        [ "newline on|off", "Send newline before multiline clipboard text, defaults to on" ]
    ]
    examples = []
    prof.register_command("/paste", 0, 2, synopsis, description, args, examples, _cmd_paste)
    prof.completer_add("/paste", [ "newline" ])
    prof.completer_add("/paste newline", [ "on", "off" ])
Example #8
0
def _process_message(barejid, current_jid, message):
    links = re.findall(r'(https?://\S+)', message)
    if (len(links) > 0):
        if barejid not in _links:
            _links[barejid] = []
        # add to list of links for barejid
        for link in links:
            if link not in _links[barejid]:
                _links[barejid].append(link)
        # add to autocompleter if message for current window
        if current_jid == barejid:
            prof.completer_add("/browser", _links[barejid])
        # set last link for barejid
        _lastlink[barejid] = links[len(links) - 1]
Example #9
0
def _process_message(barejid, current_jid, message):
    links = re.findall(r'(https?://\S+)', message)
    if (len(links) > 0):
        if barejid not in _links:
            _links[barejid] = []
        # add to list of links for barejid
        for link in links:
            if link not in _links[barejid]:
                _links[barejid].append(link)
        # add to autocompleter if message for current window
        if current_jid == barejid:
            prof.completer_add("/browser", _links[barejid])
        # set last link for barejid
        _lastlink[barejid] = links[len(links)-1]
Example #10
0
def prof_init(version, status, account_name, fulljid):
    synopsis = [ 
        "/chatterbot",
        "/chatterbot enable|disable"
    ]
    description = "ChatterBot, running with no args will show the current chatterbot status"
    args = [
        [ "enable", "Enable chatterbot" ],
        [ "disable", "Disable chatterbot" ]
    ]
    examples = []

    prof.register_command("/chatterbot", 0, 1, synopsis, description, args, examples, _cmd_chatterbot)
    prof.completer_add("/chatterbot", [ "enable", "disable" ])
Example #11
0
def prof_init(version, status, account_name, fulljid):
    synopsis = ["/system", "/system exec <comman>", "/system send <command>"]
    description = "Run a system command, calling with no arguments will open or focus the system window."
    args = [
        ["exec <command>", "Execute a command"],
        [
            "send <command>",
            "Send the result of the command to the current recipient or room"
        ]
    ]
    examples = ["/system exec ls -l", "/system send uname -a"]
    prof.register_command("/system", 0, 2, synopsis, description, args,
                          examples, _cmd_system)
    prof.completer_add("/system", ["exec", "send"])
Example #12
0
def prof_init(version, status, account_name, fulljid):
    log.info('prof_init() called')
    synopsis = [
        '/omemo',
        '/omemo on|off',
        '/omemo start|end [jid]',
        '/omemo set'
        '/omemo status',
        '/omemo account',
        '/omemo fulljid',
        '/omemo fingerprints',
        '/omemo show_devices',
        '/omemo reset_devicelist'
    ]

    description = 'Plugin to enable OMEMO encryption'
    args = [
        ['on|off', 'Enable/Disable the Profanity OMEMO Plugin'],
        ['start|end <jid>', ('Start an OMEMO based conversation with <jid> '
                             'window or current window.')],
        ['set', 'Set Settings like Message Prefix'],
        ['status', 'Display the current Profanity OMEMO Plugin status.'],
        ['fingerprints <jid>', 'Display the known fingerprints for <jid>'],
        ['account', 'Show current account name'],
        ['reset_devicelist <jid>', 'Manually reset a contacts devicelist.'],
        ['fulljid', 'Show current <full-jid>']
    ]

    examples = []

    # ensure the plugin is not registered if python-omemo is not available
    prof.register_command('/omemo', 1, 3,
                          synopsis, description, args, examples, _parse_args)

    prof.completer_add('/omemo', ['on', 'off', 'status', 'start', 'end', 'set'
                                  'account', 'fulljid', 'show_devices',
                                  'reset_devicelist', 'fingerprints'])

    prof.completer_add('/omemo set', ['message_prefix'])

    # set user and init omemo only if account_name and fulljid provided
    if account_name is not None and fulljid is not None:
        ProfOmemoUser.set_user(account_name, fulljid)
        _init_omemo()
    else:
        log.warning('No User logged in on plugin.prof_init()')
Example #13
0
def prof_init(version, status, account_name, fulljid):
    synopsis = [
        "/system",
        "/system exec <comman>",
        "/system send <command>"
    ]
    description = "Run a system command, calling with no arguments will open or focus the system window."
    args = [
        [ "exec <command>", "Execute a command" ],
        [ "send <command>", "Send the result of the command to the current recipient or room" ]
    ]
    examples = [
        "/system exec ls -l",
        "/system send uname -a"
    ]
    prof.register_command("/system", 0, 2, synopsis, description, args, examples, _cmd_system)
    prof.completer_add("/system", [ "exec", "send" ])
def prof_init(version, status, account_name, fulljid):
    log.info('prof_init() called')
    synopsis = [
        '/omemo',
        '/omemo on|off',
        '/omemo start|end [jid]',
        '/omemo set'
        '/omemo status',
        '/omemo account',
        '/omemo fulljid',
        '/omemo fingerprints',
        '/omemo show_devices',
        '/omemo reset_devicelist'
    ]

    description = 'Plugin to enable OMEMO encryption'
    args = [
        ['on|off', 'Enable/Disable the Profanity OMEMO Plugin'],
        ['start|end <jid>', ('Start an OMEMO based conversation with <jid> '
                             'window or current window.')],
        ['set', 'Set Settings like Message Prefix'],
        ['status', 'Display the current Profanity OMEMO Plugin status.'],
        ['fingerprints <jid>', 'Display the known fingerprints for <jid>'],
        ['account', 'Show current account name'],
        ['reset_devicelist <jid>', 'Manually reset a contacts devicelist.'],
        ['fulljid', 'Show current <full-jid>']
    ]

    examples = []

    # ensure the plugin is not registered if python-omemo is not available
    prof.register_command('/omemo', 1, 3,
                          synopsis, description, args, examples, _parse_args)

    prof.completer_add('/omemo', ['on', 'off', 'status', 'start', 'end', 'set'
                                  'account', 'fulljid', 'show_devices',
                                  'reset_devicelist', 'fingerprints'])

    prof.completer_add('/omemo set', ['message_prefix'])

    # set user and init omemo only if account_name and fulljid provided
    if account_name is not None and fulljid is not None:
        ProfOmemoUser.set_user(account_name, fulljid)
        _init_omemo()
    else:
        log.warning('No User logged in on plugin.prof_init()')
Example #15
0
def prof_init(version, status, account_name, fulljid):
    synopsis = [
        "/say on|off|active", "/say args <args>", "/say clearargs",
        "/say test <message>"
    ]
    description = "Read messages out loud"
    args = [["on|off", "Enable/disable say for all windows"],
            ["active", "Enable say for active window only"],
            ["args <args>", "Arguments to pass to command"],
            ["clearargs", "Clear command arguments"],
            ["test <message>", "Say message"]]
    examples = []

    prof.register_command("/say", 0, 2, synopsis, description, args, examples,
                          _cmd_say)
    prof.completer_add("/say",
                       ["on", "off", "test", "active", "args", "clearargs"])
def _refs(page_str):
    global link_ac

    page = wikipedia.page(page_str)
    create_win()
    if not page:
        prof.win_show_themed(win, "wikipedia", "refs.nopage", None, "No such page: \"" + page_str + "\"")
        prof.win_show(win, "")
        prof.win_focus(win)
        return

    prof.win_show_themed(win, "wikipedia", "refs", None, "References for " + page_str)
    for ref in page.references:
        prof.win_show_themed(win, "wikipedia", "refs.url", None, ref)
        link_ac.append(ref)
    prof.completer_add("/wikipedia open", link_ac)
    prof.win_show(win, "")
    prof.win_focus(win)
def _images(page_str):
    global link_ac

    page = wikipedia.page(page_str)
    create_win()
    if not page:
        prof.win_show_themed(win, "wikipedia", "images.nopage", None, "No such page: \"" + page_str + "\"")
        prof.win_show(win, "")
        prof.win_focus(win)
        return

    prof.win_show_themed(win, "wikipedia", "images", None, "Images for " + page_str)
    for image in page.images:
        prof.win_show_themed(win, "wikipedia", "images.url", None, image)
        link_ac.append(image)
    prof.completer_add("/wikipedia open", link_ac)
    prof.win_show(win, "")
    prof.win_focus(win)
Example #18
0
def prof_init(version, status, account_name, fulljid):
    synopsis = [ 
        "/say on|off|active",
        "/say args <args>",
        "/say clearargs",
        "/say test <message>"
    ]
    description = "Read messages out loud"
    args = [
        [ "on|off",         "Enable/disable say for all windows" ],
        [ "active",         "Enable say for active window only" ],
        [ "args <args>",    "Arguments to pass to command" ],
        [ "clearargs",      "Clear command arguments" ],
        [ "test <message>", "Say message" ]
    ]
    examples = []

    prof.register_command("/say", 0, 2, synopsis, description, args, examples, _cmd_say)
    prof.completer_add("/say", [ "on", "off", "test", "active", "args", "clearargs" ])
Example #19
0
def _images(page_str):
    global link_ac

    page = wikipedia.page(page_str)
    create_win()
    if not page:
        prof.win_show_themed(win, "wikipedia", "images.nopage", None,
                             "No such page: \"" + page_str + "\"")
        prof.win_show(win, "")
        prof.win_focus(win)
        return

    prof.win_show_themed(win, "wikipedia", "images", None,
                         "Images for " + page_str)
    for image in page.images:
        prof.win_show_themed(win, "wikipedia", "images.url", None, image)
        link_ac.append(image)
    prof.completer_add("/wikipedia open", link_ac)
    prof.win_show(win, "")
    prof.win_focus(win)
Example #20
0
def _refs(page_str):
    global link_ac

    page = wikipedia.page(page_str)
    create_win()
    if not page:
        prof.win_show_themed(win, "wikipedia", "refs.nopage", None,
                             "No such page: \"" + page_str + "\"")
        prof.win_show(win, "")
        prof.win_focus(win)
        return

    prof.win_show_themed(win, "wikipedia", "refs", None,
                         "References for " + page_str)
    for ref in page.references:
        prof.win_show_themed(win, "wikipedia", "refs.url", None, ref)
        link_ac.append(ref)
    prof.completer_add("/wikipedia open", link_ac)
    prof.win_show(win, "")
    prof.win_focus(win)
def _summary(page_str):
    global link_ac

    page = wikipedia.page(page_str)
    create_win()
    if not page:
        prof.win_show_themed(win, "wikipedia", "summary.nopage", None, "No such page: \"" + page_str + "\"")
        prof.win_show(win, "")
        prof.win_focus(win)
        return

    link_ac.append(page.url)
    prof.completer_add("/wikipedia open", link_ac)

    prof.win_show_themed(win, "wikipedia", "summary.title", None, page.title)
    prof.win_show_themed(win, "wikipedia", "summary.url", None, page.url)

    summary = wikipedia.summary(page_str)
    prof.win_show_themed(win, "wikipedia", "summary.text", None, summary)
    prof.win_show(win, "")
    prof.win_focus(win)
Example #22
0
def _handle_bundle_update(stanza):
    log.info('Bundle Information received.')
    omemo_state = ProfOmemoState()
    bundle_info = xmpp.unpack_bundle_info(stanza)

    if not bundle_info:
        log.error('Could not unpack bundle info.')
        return

    sender = bundle_info.get('sender')
    device_id = bundle_info.get('device')

    try:
        omemo_state.build_session(sender, device_id, bundle_info)
        log.info('Session built with user: {0}:{1}'.format(sender, device_id))
        prof.completer_add('/omemo end', [sender])
    except Exception as e:
        msg_tmpl = 'Could not build session with {0}:{1}. {2}:{3}'
        msg = msg_tmpl.format(sender, device_id, type(e).__name__, str(e))
        log.error(msg)
        return
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")
def _handle_bundle_update(stanza):
    log.info('Bundle Information received.')
    omemo_state = ProfOmemoState()
    bundle_info = xmpp.unpack_bundle_info(stanza)

    if not bundle_info:
        log.error('Could not unpack bundle info.')
        return

    sender = bundle_info.get('sender')
    device_id = bundle_info.get('device')

    try:
        omemo_state.build_session(sender, device_id, bundle_info)
        log.info('Session built with user: {0}:{1}'.format(sender, device_id))
        prof.completer_add('/omemo end', [sender])
    except Exception as e:
        msg_tmpl = 'Could not build session with {0}:{1}. {2}:{3}'
        msg = msg_tmpl.format(sender, device_id, type(e).__name__, str(e))
        log.error(msg)
        return
Example #25
0
def prof_init(version, status, account_name, fulljid):
    synopsis = [ 
        "/presence_notify all|online|off",
        "/presence_notify ignored add|remove|clear [<barejid>]",
        "/presence_notify resource on|off"
    ]
    description = "Send a desktop notification on presence updates."
    args = [
        [ "all",                            "Enable all presence notifications" ],
        [ "online",                         "Enable only online/offline presence notifications" ],
        [ "off",                            "Disable presence notifications" ],
        [ "ignored add|remove <barejid>",   "Add or remove a contact from the list excluded from presence notifications"],
        [ "ignored clear",                  "Clear the list of excluded contacts"],
        [ "resource on|off",                "Enable/disable showing the contacts resource in the notification"]
    ]
    examples = [
        "/presence_notify all",
        "/presence_notify ignored add [email protected]"
    ]

    prof.register_command("/presence_notify", 0, 3, synopsis, description, args, examples, _cmd_presence_notify)

    prof.completer_add("/presence_notify",
        [ "all", "online", "off", "ignored", "resource" ]
    )
    prof.completer_add("/presence_notify ignored",
        [ "add", "remove", "clear" ]
    )
    prof.completer_add("/presence_notify resource",
        [ "on", "off" ]
    )
Example #26
0
def _summary(page_str):
    global link_ac

    page = wikipedia.page(page_str)
    create_win()
    if not page:
        prof.win_show_themed(win, "wikipedia", "summary.nopage", None,
                             "No such page: \"" + page_str + "\"")
        prof.win_show(win, "")
        prof.win_focus(win)
        return

    link_ac.append(page.url)
    prof.completer_add("/wikipedia open", link_ac)

    prof.win_show_themed(win, "wikipedia", "summary.title", None, page.title)
    prof.win_show_themed(win, "wikipedia", "summary.url", None, page.url)

    summary = wikipedia.summary(page_str)
    prof.win_show_themed(win, "wikipedia", "summary.text", None, summary)
    prof.win_show(win, "")
    prof.win_focus(win)
Example #27
0
def prof_init(version, status, account_name, fulljid):
    synopsis = [
        "/wikipedia search <text>", "/wikipedia summary <title>",
        "/wikipedia page <title>", "/wikipedia images <title>",
        "/wikipedia links <title>", "/wikipedia refs <title>",
        "/wikipedia open <url>"
    ]
    description = "Interact with wikipedia."
    args = [["search <text>", "Search for pages"],
            ["summary <title>", "Show summary for page"],
            ["page <title>", "Show the whole page"],
            ["images <title>", "Show images URLs for page"],
            ["links <title>", "Show links to other pages from page"],
            ["refs <title>", "Show external references for page"],
            ["open <url>", "Open the a URL in the browser"]]
    examples = ["/wikipedia search Iron Maiden"]

    prof.register_command("/wikipedia", 2, 2, synopsis, description, args,
                          examples, cmd_wp)

    prof.completer_add(
        "/wikipedia",
        ["search", "summary", "page", "images", "links", "refs", "open"])
Example #28
0
def prof_init(version, status, account_name, fulljid):
    synopsis = [ 
        "/sounds",
        "/sounds on|off",
        "/sounds set chat <file>",
        "/sounds set room <file>",
        "/sounds set private <file>",
        "/sounds clear chat",
        "/sounds clear room",
        "/sounds clear private",
        "/sounds rooms add <roomjid>"
    ]
    description = "Play mp3 sounds on various Profanity events. Calling with no args shows current sound files."
    args = [
        [ "on|off", "Enable or disable playing sounds." ],
        [ "set chat <file>", "Path to mp3 file to play on chat messages." ],
        [ "set room <file>", "Path to mp3 file to play on room messages." ],
        [ "set private <file>", "Path to mp3 file to play on private room messages." ],
        [ "clear chat", "Remove the sound for chat messages." ],
        [ "clear room", "Remove the sound for room messages." ],
        [ "clear private", "Remove the sound for private messages." ],
        [ "rooms add <roomjid>", "Add the room to the list that will play the room sound."],
        [ "rooms remove <roomjid>", "Remove the room from the list that will play the room sound."],
        [ "rooms clear", "Clear the room list, all rooms will play sounds on new messages."]
    ]
    examples = [
        "/sounds set chat ~/sounds/woof.mp3",
        "/sounds set room ~/sounds/meow.mp3",
        "/sounds set private ~/sounds/shhh.mp3",
        "/sounds remove private",
        "/sounds rooms add [email protected]",
        "/sounds on"
    ]

    prof.register_command("/sounds", 0, 3, synopsis, description, args, examples, _cmd_sounds)

    prof.completer_add("/sounds", [ "set", "clear", "on", "off", "rooms" ])
    prof.completer_add("/sounds set", [ "chat", "room", "private" ])
    prof.completer_add("/sounds clear", [ "chat", "room", "private" ])
    prof.completer_add("/sounds rooms", [ "add", "remove", "clear" ])
    prof.filepath_completer_add("/sounds set chat")
    prof.filepath_completer_add("/sounds set room")
    prof.filepath_completer_add("/sounds set private")
Example #29
0
def prof_init(version, status, account_name, fulljid):
    last_state[STATE_SUCCESS] = []
    last_state[STATE_UNSTABLE] = []
    last_state[STATE_FAILURE] = []
    last_state[STATE_QUEUED] = []
    last_state[STATE_RUNNING] = []
    last_state[STATE_NOBUILDS] = []
    last_state[STATE_UNKNOWN] = []

    jenkins_t = threading.Thread(target=_jenkins_poll)
    jenkins_t.daemon = True
    jenkins_t.start()

    prof.register_timed(_prof_callback, prof_cb_interval)
    prof.register_timed(_remind, prof_remind_interval)

    prof.completer_add("/jenkins", [
        "help", "jobs", "failing", "passing", "unstable", "build", "open",
        "log", "remind", "notify", "settings"
    ])
    prof.completer_add("/jenkins remind", ["on", "off"])
    prof.completer_add("/jenkins notify", ["on", "off"])

    synopsis = [
        "/jenkins jobs|failing|passing|unstable", "/jenkins build <job>",
        "/jenkins open <job>", "/jenkins log <job>", "/jenkins remind on|off",
        "/jenkins notify on|off", "/jenkins settings"
    ]
    description = "Monitor, run and view Jenkins jobs."
    args = [["jobs", "List all jobs"], ["failing", "List all failing jobs"],
            ["passing", "List all passing jobs"],
            ["unstable", "List all unstable jobs"],
            ["build <job>", "Trigger build for job"],
            ["open <job>", "Open job in browser"],
            ["log <job>", "Show the latest build log for job"],
            ["remind on|off", "Enable/disable reminder notifications"],
            ["notify on|off", "Enable/disable build notifications"],
            ["settings", "Show current settings"]]
    examples = [
        "/kenkins failing", "/kenkins build stabber-build",
        "/kenkins remind off"
    ]

    prof.register_command("/jenkins", 0, 2, synopsis, description, args,
                          examples, _cmd_jenkins)
def prof_init(version, status, account_name, fulljid):
    synopsis = [
        "/termuxnotify on|off|active", "/termuxnotify vibrate on|off",
        "/termuxnotify rooms on|off"
    ]
    description = "Read messages out loud"
    args = [["on|off", "Enable/disable termuxnotify for all windows"],
            ["active", "Enable termuxnotify for active window only"],
            ["vibrate <args>", "Turn vibrate on or off"],
            ["rooms <args>", "Turn notifications for rooms on or off"]]
    examples = []

    prof.register_command("/termuxnotify", 0, 2, synopsis, description, args,
                          examples, _cmd_say)
    prof.completer_add("/termuxnotify",
                       ["on", "off", "active", "vibrate", "rooms"])
    prof.completer_add("/termuxnotify vibrate", ["on", "off"])
    prof.completer_add("/termuxnotify rooms", ["on", "off"])
Example #31
0
def _jenkins_poll():
    global poll_fail
    global poll_fail_message
    global job_list
    global changes_list

    job_ac = []

    while True:
        time.sleep(jenkins_poll_interval)
        try:
            j = Jenkins(jenkins_url, username, password)
        except Exception, e:
            poll_fail = True
            poll_fail_message = str(e)
        else:
            poll_fail = False
            poll_fail_message = None
            new_job_list = JobList()
            new_changes_list = JobUpdates()
            for name, job in j.get_jobs():
                if not job.is_queued_or_running():
                    build = job.get_last_build_or_none()
                    if build:
                        _process_build(name, build, new_job_list,
                                       new_changes_list)
                    else:
                        new_job_list.add_job(name, None, STATE_NOBUILDS)
                else:
                    _process_queued_or_running(name, job, new_job_list,
                                               new_changes_list)
                if not job_list:
                    job_ac.append(name)

            if not job_list:
                prof.completer_add("/jenkins build", job_ac)
                prof.completer_add("/jenkins open", job_ac)
                prof.completer_add("/jenkins log", job_ac)

            job_list = new_job_list
            changes_list = new_changes_list
Example #32
0
def _jenkins_poll():
    global poll_fail
    global poll_fail_message
    global job_list
    global changes_list

    job_ac = []

    while True:
        time.sleep(jenkins_poll_interval)
        try:
            j = Jenkins(jenkins_url, username, password)
        except Exception, e:
            poll_fail = True
            poll_fail_message = str(e)
        else:
            poll_fail = False
            poll_fail_message = None
            new_job_list = JobList()
            new_changes_list = JobUpdates()        
            for name, job in j.get_jobs():
                if not job.is_queued_or_running():
                    build = job.get_last_build_or_none()
                    if build:
                        _process_build(name, build, new_job_list, new_changes_list)
                    else:
                        new_job_list.add_job(name, None, STATE_NOBUILDS)
                else:
                    _process_queued_or_running(name, job, new_job_list, new_changes_list)
                if not job_list:
                    job_ac.append(name)

            if not job_list:
                prof.completer_add("/jenkins build", job_ac)
                prof.completer_add("/jenkins open", job_ac)
                prof.completer_add("/jenkins log", job_ac)

            job_list = new_job_list
            changes_list = new_changes_list
Example #33
0
def prof_on_room_win_focus(barejid):
    prof.completer_clear("/browser")
    if barejid in _links:
        prof.completer_add("/browser", _links[barejid])
def add_recipient_to_completer(recipient):
    log.info('Adding {} to the completer.'.format(recipient))
    prof.completer_add('/omemo start', [recipient])
    prof.completer_add('/omemo show_devices', [recipient])
    prof.completer_add('/omemo fingerprints', [recipient])
    prof.completer_add('/omemo reset_devicelist', [recipient])
Example #35
0
def prof_init(version, status, account_name, fulljid):
    last_state[STATE_SUCCESS] = []
    last_state[STATE_UNSTABLE] = []
    last_state[STATE_FAILURE] = []
    last_state[STATE_QUEUED] = []
    last_state[STATE_RUNNING] = []
    last_state[STATE_NOBUILDS] = []
    last_state[STATE_UNKNOWN] = []

    jenkins_t = threading.Thread(target=_jenkins_poll)
    jenkins_t.daemon = True;
    jenkins_t.start()

    prof.register_timed(_prof_callback, prof_cb_interval)
    prof.register_timed(_remind, prof_remind_interval)

    prof.completer_add(
        "/jenkins", [
            "help",
            "jobs",
            "failing",
            "passing",
            "unstable",
            "build",
            "open",
            "log",
            "remind",
            "notify",
            "settings"
        ]
    );
    prof.completer_add(
        "/jenkins remind", [
            "on",
            "off"
        ]
    );
    prof.completer_add(
        "/jenkins notify", [
            "on",
            "off"
        ]
    );

    synopsis = [ 
        "/jenkins jobs|failing|passing|unstable",
        "/jenkins build <job>",
        "/jenkins open <job>",
        "/jenkins log <job>",
        "/jenkins remind on|off",
        "/jenkins notify on|off",
        "/jenkins settings"
    ]
    description = "Monitor, run and view Jenkins jobs."
    args = [
        [ "jobs",           "List all jobs" ],
        [ "failing",        "List all failing jobs" ],
        [ "passing",        "List all passing jobs" ],
        [ "unstable",       "List all unstable jobs" ],
        [ "build <job>",    "Trigger build for job" ],
        [ "open <job>",     "Open job in browser" ],
        [ "log <job>",      "Show the latest build log for job" ],
        [ "remind on|off",  "Enable/disable reminder notifications" ],
        [ "notify on|off",  "Enable/disable build notifications" ],
        [ "settings",       "Show current settings" ]
    ]
    examples = [
        "/kenkins failing",
        "/kenkins build stabber-build",
        "/kenkins remind off"
    ]

    prof.register_command("/jenkins", 0, 2, synopsis, description, args, examples, _cmd_jenkins)
Example #36
0
def prof_on_room_win_focus(barejid):
    prof.completer_clear("/browser")
    if barejid in _links:
        prof.completer_add("/browser", _links[barejid])
Example #37
0
def prof_init(version, status, account_name, fulljid):
    synopsis = [ 
        "/enc_py end <barejid>",
        "/enc_py chat_title set <barejid> <text>",
        "/enc_py chat_title unset <barejid>",
        "/enc_py chat_ch set in <barejid> <ch>",
        "/enc_py chat_ch reset in <barejid>",
        "/enc_py chat_ch set out <barejid> <ch>",
        "/enc_py chat_ch reset out <barejid>",
        "/enc_py chat_show <barejid> <message>",
        "/enc_py chat_show_themed <barejid> <message>",
        "/enc_py room_title set <roomjid> <text>",
        "/enc_py room_title unset <roomjid>"
        "/enc_py room_ch set <roomjid> <ch>",
        "/enc_py room_ch reset <roomjid>",
        "/enc_py room_show <roomjid> <message>",
        "/enc_py room_show_themed <roomjid> <message>"
        "/enc_py chat_msg none",
        "/enc_py chat_msg modify",
        "/enc_py chat_msg block",
        "/enc_py room_msg none",
        "/enc_py room_msg modify",
        "/enc_py room_msg block"
    ]
    description = "Various enc things"
    args = [
        [ "end <barejid>",                          "User to end the session with" ],
        [ "chat_title set <barejid> <text>",        "Set encryption text in titlebar for recipient" ],
        [ "chat_title reset <barejid>",             "Reset encryption text in titlebar for recipient" ],
        [ "chat_ch set in <barejid> <ch>",          "Set incoming char for recipient" ],
        [ "chat_ch reset in <barejid>",             "Reset incoming char for recipient" ],
        [ "chat_ch set out <barejid> <ch>",         "Set outgoing char for recipient" ],
        [ "chat_ch reset out <barejid>",            "Reset outgoing char for recipient" ],
        [ "chat_show <barejid> <message>",          "Show chat message" ],
        [ "chat_show_themed <barejid> <message>",   "Show themed chat message" ],
        [ "room_title set <roomjid> <text>",        "Set encryption text in titlebar for room" ],
        [ "room_title reset <roomjid>",             "Reset encryption text in titlebar for room" ],
        [ "room_ch set <roomjid> <ch>",             "Set char for room" ],
        [ "room_ch reset <roomjid>",                "Reset char for room" ],
        [ "room_show <roomjid> <message>",          "Show chat room message" ],
        [ "room_show_themed <roomjid> <message>",   "Show themed chat room message" ],
        [ "chat_msg none",                          "Preserve chat messages" ],
        [ "chat_msg modify",                        "Modify chat messages" ],
        [ "chat_msg block",                         "Block chat messages" ],
        [ "room_msg none",                          "Preserve chat room messages" ],
        [ "room_msg modify",                        "Modify chat room messages" ],
        [ "room_msg block",                         "Block chat room messages" ]
    ]
    examples = []

    prof.register_command("/enc_py", 2, 5, synopsis, description, args, examples, _cmd_enc)
    prof.completer_add("/enc_py", [
        "end",
        "chat_title",
        "chat_ch",
        "chat_show",
        "chat_show_themed",
        "room_title",
        "room_ch",
        "room_show",
        "room_show_themed",
        "chat_msg",
        "room_msg"
    ])
    prof.completer_add("/enc_py chat_title", [ "set", "reset" ])
    prof.completer_add("/enc_py chat_ch", [ "set", "reset" ])
    prof.completer_add("/enc_py chat_ch set", [ "in", "out" ])
    prof.completer_add("/enc_py chat_ch reset", [ "in", "out" ])
    prof.completer_add("/enc_py room_title", [ "set", "reset" ])
    prof.completer_add("/enc_py room_ch", [ "set", "reset" ])
    prof.completer_add("/enc_py chat_msg", [ "none", "modify", "block" ])
    prof.completer_add("/enc_py room_msg", [ "none", "modify", "block" ])
def _update_autocomplete():
    prof.completer_add("/wikipedia page", page_ac)
    prof.completer_add("/wikipedia summary", page_ac)
    prof.completer_add("/wikipedia images", page_ac)
    prof.completer_add("/wikipedia links", page_ac)
    prof.completer_add("/wikipedia refs", page_ac)
Example #39
0
def add_recipient_to_completer(recipient):
    log.info('Adding {} to the completer.'.format(recipient))
    prof.completer_add('/omemo start', [recipient])
    prof.completer_add('/omemo show_devices', [recipient])
    prof.completer_add('/omemo fingerprints', [recipient])
    prof.completer_add('/omemo reset_devicelist', [recipient])
def prof_init(version, status, account_name, fulljid):
    global count
    global ping_id
    global thread_stop

    count = 0
    ping_id = 1

    thread_stop = threading.Event()
    count_thread = threading.Thread(target=_inc_counter)
    count_thread.daemon = True
    count_thread.start()

    prof.disco_add_feature("urn:xmpp:profanity:python_test_plugin")

    prof.win_create(plugin_win, _handle_win_input)
    if account_name and fulljid:
        prof.win_show(
            plugin_win, "fired -> prof_init: " + version + ", " + status +
            ", " + account_name + ", " + fulljid)
    else:
        prof.win_show(plugin_win,
                      "fired -> prof_init: " + version + ", " + status)

    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|nick|occupants",
        "/python-test log debug|info|warning|error <message>",
        "/python-test count", "/python-test ping <jid>",
        "/python-test boolean get <group> <key>",
        "/python-test boolean set <group> <key> <value>",
        "/python-test string get <group> <key>",
        "/python-test string set <group> <key> <value>",
        "/python-test string_list get <group> <key>",
        "/python-test string_list add <group> <key> <value>",
        "/python-test string_list remove <group> <key> <value>",
        "/python-test string_list remove_all <group> <key>",
        "/python-test int get <group> <key>",
        "/python-test int set <group> <key> <value>",
        "/python-test incoming <barejid> <resource> <message>",
        "/python-test completer add|remove <item>", "/python-test file"
    ]
    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"],
        ["get nick", "Show nickname in current room, if ina a chat room"],
        [
            "get occupants",
            "Show occupants in current room, 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"
        ], ["ping <jid>", "Send an XMPP ping to the specified Jabber ID"],
        ["boolean get <group> <key>", "Get a boolean setting"],
        ["boolean set <group> <key> <value>", "Set a boolean setting"],
        ["string get <group> <key>", "Get a string setting"],
        ["string set <group> <key> <value>", "Set a string setting"],
        ["string_list get <group> <key>", "Get a string list setting"],
        [
            "string_list add <group> <key> <value>",
            "Add a string to a string list setting"
        ],
        [
            "string_list remove <group> <key> <value>",
            "Remove a string from a string list setting"
        ],
        [
            "string_list remove_all <group> <key>",
            "Remove all strings from a string list setting"
        ], ["int get <group> <key>", "Get a integer setting"],
        ["int set <group> <key> <value>", "Set a integer setting"],
        [
            "incoming <barejid> <resource> <message>",
            "Show an incoming message."
        ],
        [
            "completer add <item>",
            "Add an autocomplete item to the /c-test command."
        ],
        [
            "completer remove <item>",
            "Remove an autocomplete item from the /c-test command."
        ], ["file", "Complete a file path."]
    ]
    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\"",
        "/python-test ping [email protected]"
    ]

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

    prof.completer_add("/python-test", [
        "consalert", "consshow", "consshow_t", "constest", "winshow",
        "winshow_t", "notify", "sendline", "get", "log", "count", "ping",
        "boolean", "string", "string_list", "int", "incoming", "completer",
        "file"
    ])
    prof.completer_add("/python-test get",
                       ["recipient", "room", "nick", "occupants"])
    prof.completer_add("/python-test log",
                       ["debug", "info", "warning", "error"])
    prof.completer_add("/python-test boolean", ["get", "set"])
    prof.completer_add("/python-test string", ["get", "set"])
    prof.completer_add("/python-test string_list",
                       ["get", "add", "remove", "remove_all"])
    prof.completer_add("/python-test int", ["get", "set"])
    prof.completer_add("/python-test completer", ["add", "remove"])

    prof.filepath_completer_add("/python-test file")

    prof.register_timed(timed_callback, 5)
Example #41
0
def _update_autocomplete():
    prof.completer_add("/wikipedia page", page_ac)
    prof.completer_add("/wikipedia summary", page_ac)
    prof.completer_add("/wikipedia images", page_ac)
    prof.completer_add("/wikipedia links", page_ac)
    prof.completer_add("/wikipedia refs", page_ac)