Updated prof_init hook args
This commit is contained in:
4
ascii.py
4
ascii.py
@@ -10,6 +10,7 @@ Requires 'figlet' which is available on most linux distros e.g.:
|
|||||||
import prof
|
import prof
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
def _cmd_ascii(text):
|
def _cmd_ascii(text):
|
||||||
proc = subprocess.Popen(['figlet', '--', text], stdout=subprocess.PIPE)
|
proc = subprocess.Popen(['figlet', '--', text], stdout=subprocess.PIPE)
|
||||||
ascii_out = proc.communicate()[0].decode('utf-8')
|
ascii_out = proc.communicate()[0].decode('utf-8')
|
||||||
@@ -22,7 +23,8 @@ def _cmd_ascii(text):
|
|||||||
elif prof.current_win_is_console():
|
elif prof.current_win_is_console():
|
||||||
prof.cons_show(u'\u000A' + ascii_out)
|
prof.cons_show(u'\u000A' + ascii_out)
|
||||||
|
|
||||||
def prof_init(version, status):
|
|
||||||
|
def prof_init(version, status, account_name, fulljid):
|
||||||
synopsis = [ "/ascii <message>" ]
|
synopsis = [ "/ascii <message>" ]
|
||||||
description = "ASCIIfy a message."
|
description = "ASCIIfy a message."
|
||||||
args = [
|
args = [
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ def _open_browser(url):
|
|||||||
os.dup2(saverr, 2)
|
os.dup2(saverr, 2)
|
||||||
|
|
||||||
|
|
||||||
def prof_init(version, status):
|
def prof_init(version, status, account_name, fulljid):
|
||||||
synopsis = [
|
synopsis = [
|
||||||
"/browser",
|
"/browser",
|
||||||
"/browser <url>"
|
"/browser <url>"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import prof
|
import prof
|
||||||
from chatterbotapi import ChatterBotFactory, ChatterBotType
|
from chatterbotapi import ChatterBotFactory, ChatterBotType
|
||||||
|
|
||||||
|
|
||||||
factory = ChatterBotFactory()
|
factory = ChatterBotFactory()
|
||||||
bot = factory.create(ChatterBotType.CLEVERBOT)
|
bot = factory.create(ChatterBotType.CLEVERBOT)
|
||||||
# bot = factory.create(ChatterBotType.JABBERWACKY)
|
# bot = factory.create(ChatterBotType.JABBERWACKY)
|
||||||
@@ -8,6 +9,7 @@ bot = factory.create(ChatterBotType.CLEVERBOT)
|
|||||||
bot_session = {}
|
bot_session = {}
|
||||||
bot_state = False
|
bot_state = False
|
||||||
|
|
||||||
|
|
||||||
def prof_post_chat_message_display(jid, message):
|
def prof_post_chat_message_display(jid, message):
|
||||||
if bot_state:
|
if bot_state:
|
||||||
if jid not in bot_session:
|
if jid not in bot_session:
|
||||||
@@ -15,6 +17,7 @@ def prof_post_chat_message_display(jid, message):
|
|||||||
response = bot_session[jid].think(message)
|
response = bot_session[jid].think(message)
|
||||||
prof.send_line("/msg " + jid + " " + response)
|
prof.send_line("/msg " + jid + " " + response)
|
||||||
|
|
||||||
|
|
||||||
def _cmd_chatterbot(state):
|
def _cmd_chatterbot(state):
|
||||||
global bot_state
|
global bot_state
|
||||||
|
|
||||||
@@ -31,7 +34,8 @@ def _cmd_chatterbot(state):
|
|||||||
else:
|
else:
|
||||||
prof.cons_show("ChatterBot is stopped - /chatterbot enable to activate.")
|
prof.cons_show("ChatterBot is stopped - /chatterbot enable to activate.")
|
||||||
|
|
||||||
def prof_init(version, status):
|
|
||||||
|
def prof_init(version, status, account_name, fulljid):
|
||||||
synopsis = [
|
synopsis = [
|
||||||
"/chatterbot",
|
"/chatterbot",
|
||||||
"/chatterbot enable|disable"
|
"/chatterbot enable|disable"
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ Convert smileys ( :) :( etc) to the Unicode character representation
|
|||||||
|
|
||||||
import prof
|
import prof
|
||||||
|
|
||||||
|
|
||||||
def _emote(input_str):
|
def _emote(input_str):
|
||||||
result = input_str
|
result = input_str
|
||||||
result = result.replace(":-)", u'\u263a'.encode("utf-8"))
|
result = result.replace(":-)", u'\u263a'.encode("utf-8"))
|
||||||
@@ -12,11 +13,14 @@ def _emote(input_str):
|
|||||||
result = result.replace(":(", u'\u2639'.encode("utf-8"))
|
result = result.replace(":(", u'\u2639'.encode("utf-8"))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def prof_pre_chat_message_display(jid, message):
|
def prof_pre_chat_message_display(jid, message):
|
||||||
return _emote(message)
|
return _emote(message)
|
||||||
|
|
||||||
|
|
||||||
def prof_pre_room_message_display(room, nick, message):
|
def prof_pre_room_message_display(room, nick, message):
|
||||||
return _emote(message)
|
return _emote(message)
|
||||||
|
|
||||||
|
|
||||||
def prof_pre_priv_message_display(room, nick, message):
|
def prof_pre_priv_message_display(room, nick, message):
|
||||||
return _emote(message)
|
return _emote(message)
|
||||||
|
|||||||
21
jenkins.py
21
jenkins.py
@@ -53,6 +53,7 @@ poll_fail_message = None
|
|||||||
job_list = None
|
job_list = None
|
||||||
changes_list = None
|
changes_list = None
|
||||||
|
|
||||||
|
|
||||||
def _help():
|
def _help():
|
||||||
prof.win_show(win_tag, "Commands:")
|
prof.win_show(win_tag, "Commands:")
|
||||||
prof.win_show(win_tag, " /jenkins help - Show this help")
|
prof.win_show(win_tag, " /jenkins help - Show this help")
|
||||||
@@ -67,6 +68,7 @@ def _help():
|
|||||||
prof.win_show(win_tag, " /jenkins notify on|off - Enable/disable build notifications")
|
prof.win_show(win_tag, " /jenkins notify on|off - Enable/disable build notifications")
|
||||||
prof.win_show(win_tag, " /jenkins settings - Show current settings")
|
prof.win_show(win_tag, " /jenkins settings - Show current settings")
|
||||||
|
|
||||||
|
|
||||||
def _settings():
|
def _settings():
|
||||||
prof.win_show(win_tag, "Jenkins settings:")
|
prof.win_show(win_tag, "Jenkins settings:")
|
||||||
prof.win_show(win_tag, " Jenkins URL : " + jenkins_url)
|
prof.win_show(win_tag, " Jenkins URL : " + jenkins_url)
|
||||||
@@ -76,10 +78,12 @@ def _settings():
|
|||||||
prof.win_show(win_tag, " Notifications enabled : " + str(enable_notify))
|
prof.win_show(win_tag, " Notifications enabled : " + str(enable_notify))
|
||||||
prof.win_show(win_tag, " Reminders enabled : " + str(enable_remind))
|
prof.win_show(win_tag, " Reminders enabled : " + str(enable_remind))
|
||||||
|
|
||||||
|
|
||||||
def _safe_remove(jobname, state):
|
def _safe_remove(jobname, state):
|
||||||
if jobname in last_state[state]:
|
if jobname in last_state[state]:
|
||||||
last_state[state].remove(jobname)
|
last_state[state].remove(jobname)
|
||||||
|
|
||||||
|
|
||||||
def _set_state(jobname, state):
|
def _set_state(jobname, state):
|
||||||
if not jobname in last_state[state]:
|
if not jobname in last_state[state]:
|
||||||
_safe_remove(jobname, STATE_SUCCESS)
|
_safe_remove(jobname, STATE_SUCCESS)
|
||||||
@@ -94,6 +98,7 @@ def _set_state(jobname, state):
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def _open_job_url(url):
|
def _open_job_url(url):
|
||||||
savout = os.dup(1)
|
savout = os.dup(1)
|
||||||
saverr = os.dup(2)
|
saverr = os.dup(2)
|
||||||
@@ -106,6 +111,7 @@ def _open_job_url(url):
|
|||||||
os.dup2(savout, 1)
|
os.dup2(savout, 1)
|
||||||
os.dup2(saverr, 2)
|
os.dup2(saverr, 2)
|
||||||
|
|
||||||
|
|
||||||
class JobList():
|
class JobList():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.jobs = []
|
self.jobs = []
|
||||||
@@ -142,6 +148,7 @@ class JobList():
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
return count
|
return count
|
||||||
|
|
||||||
|
|
||||||
class JobUpdates():
|
class JobUpdates():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.states = {}
|
self.states = {}
|
||||||
@@ -160,6 +167,7 @@ class JobUpdates():
|
|||||||
def get_in_state(self, state):
|
def get_in_state(self, state):
|
||||||
return self.states[state]
|
return self.states[state]
|
||||||
|
|
||||||
|
|
||||||
def _process_build(name, build, new_job_list, new_changes_list):
|
def _process_build(name, build, new_job_list, new_changes_list):
|
||||||
if build.get_status() == STATE_FAILURE:
|
if build.get_status() == STATE_FAILURE:
|
||||||
new_job_list.add_job(name, build.get_number(), STATE_FAILURE)
|
new_job_list.add_job(name, build.get_number(), STATE_FAILURE)
|
||||||
@@ -177,6 +185,7 @@ def _process_build(name, build, new_job_list, new_changes_list):
|
|||||||
if changed:
|
if changed:
|
||||||
new_changes_list.add_update(STATE_UNSTABLE, name, build.get_number())
|
new_changes_list.add_update(STATE_UNSTABLE, name, build.get_number())
|
||||||
|
|
||||||
|
|
||||||
def _process_queued_or_running(name, job, new_job_list, new_changes_list):
|
def _process_queued_or_running(name, job, new_job_list, new_changes_list):
|
||||||
if job.is_queued():
|
if job.is_queued():
|
||||||
new_job_list.add_job(name, None, STATE_QUEUED)
|
new_job_list.add_job(name, None, STATE_QUEUED)
|
||||||
@@ -189,6 +198,7 @@ def _process_queued_or_running(name, job, new_job_list, new_changes_list):
|
|||||||
if changed:
|
if changed:
|
||||||
new_changes_list.add_update(STATE_RUNNING, name)
|
new_changes_list.add_update(STATE_RUNNING, name)
|
||||||
|
|
||||||
|
|
||||||
def _jenkins_poll():
|
def _jenkins_poll():
|
||||||
global poll_fail
|
global poll_fail
|
||||||
global poll_fail_message
|
global poll_fail_message
|
||||||
@@ -229,6 +239,7 @@ def _jenkins_poll():
|
|||||||
job_list = new_job_list
|
job_list = new_job_list
|
||||||
changes_list = new_changes_list
|
changes_list = new_changes_list
|
||||||
|
|
||||||
|
|
||||||
def _prof_callback():
|
def _prof_callback():
|
||||||
global changes_list
|
global changes_list
|
||||||
if poll_fail:
|
if poll_fail:
|
||||||
@@ -269,9 +280,11 @@ def _prof_callback():
|
|||||||
|
|
||||||
changes_list = None
|
changes_list = None
|
||||||
|
|
||||||
|
|
||||||
def _handle_input(win, line):
|
def _handle_input(win, line):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def _list_jobs(jobs):
|
def _list_jobs(jobs):
|
||||||
for name, build_number, state in jobs:
|
for name, build_number, state in jobs:
|
||||||
if state == STATE_SUCCESS:
|
if state == STATE_SUCCESS:
|
||||||
@@ -285,6 +298,7 @@ def _list_jobs(jobs):
|
|||||||
else:
|
else:
|
||||||
prof.win_show_themed(win_tag, None, None, "cyan", " " + name + " " + state)
|
prof.win_show_themed(win_tag, None, None, "cyan", " " + name + " " + state)
|
||||||
|
|
||||||
|
|
||||||
def _build_job(job):
|
def _build_job(job):
|
||||||
try:
|
try:
|
||||||
request = urllib2.Request(jenkins_url + "/job/" + job + "/build");
|
request = urllib2.Request(jenkins_url + "/job/" + job + "/build");
|
||||||
@@ -299,6 +313,7 @@ def _build_job(job):
|
|||||||
else:
|
else:
|
||||||
prof.win_show(win_tag, "Build request sent for " + job)
|
prof.win_show(win_tag, "Build request sent for " + job)
|
||||||
|
|
||||||
|
|
||||||
def _job_log(job):
|
def _job_log(job):
|
||||||
name = job[0]
|
name = job[0]
|
||||||
build_no = job[1]
|
build_no = job[1]
|
||||||
@@ -314,6 +329,7 @@ def _job_log(job):
|
|||||||
else:
|
else:
|
||||||
prof.win_show(win_tag, "No build found for " + name)
|
prof.win_show(win_tag, "No build found for " + name)
|
||||||
|
|
||||||
|
|
||||||
def _cmd_jenkins(cmd=None, arg=None):
|
def _cmd_jenkins(cmd=None, arg=None):
|
||||||
global enable_remind
|
global enable_remind
|
||||||
global enable_notify
|
global enable_notify
|
||||||
@@ -411,6 +427,7 @@ def _cmd_jenkins(cmd=None, arg=None):
|
|||||||
else:
|
else:
|
||||||
prof.win_show(win_tag, "Unknown command.")
|
prof.win_show(win_tag, "Unknown command.")
|
||||||
|
|
||||||
|
|
||||||
def _remind():
|
def _remind():
|
||||||
if enable_remind and job_list:
|
if enable_remind and job_list:
|
||||||
notify_string = ""
|
notify_string = ""
|
||||||
@@ -433,7 +450,8 @@ def _remind():
|
|||||||
if not notify_string == "":
|
if not notify_string == "":
|
||||||
prof.notify(notify_string, 5000, "Jenkins")
|
prof.notify(notify_string, 5000, "Jenkins")
|
||||||
|
|
||||||
def prof_init(version, status):
|
|
||||||
|
def prof_init(version, status, account_name, fulljid):
|
||||||
last_state[STATE_SUCCESS] = []
|
last_state[STATE_SUCCESS] = []
|
||||||
last_state[STATE_UNSTABLE] = []
|
last_state[STATE_UNSTABLE] = []
|
||||||
last_state[STATE_FAILURE] = []
|
last_state[STATE_FAILURE] = []
|
||||||
@@ -507,6 +525,7 @@ def prof_init(version, status):
|
|||||||
|
|
||||||
prof.register_command("/jenkins", 0, 2, synopsis, description, args, examples, _cmd_jenkins)
|
prof.register_command("/jenkins", 0, 2, synopsis, description, args, examples, _cmd_jenkins)
|
||||||
|
|
||||||
|
|
||||||
def prof_on_start():
|
def prof_on_start():
|
||||||
prof.win_create(win_tag, _handle_input)
|
prof.win_create(win_tag, _handle_input)
|
||||||
prof.win_show(win_tag, "Jenkins plugin started.")
|
prof.win_show(win_tag, "Jenkins plugin started.")
|
||||||
|
|||||||
4
paste.py
4
paste.py
@@ -6,13 +6,15 @@ import prof
|
|||||||
import sys
|
import sys
|
||||||
import Tkinter as tk
|
import Tkinter as tk
|
||||||
|
|
||||||
|
|
||||||
def _cmd_paste():
|
def _cmd_paste():
|
||||||
root = tk.Tk(baseName="")
|
root = tk.Tk(baseName="")
|
||||||
root.withdraw()
|
root.withdraw()
|
||||||
result = root.clipboard_get()
|
result = root.clipboard_get()
|
||||||
prof.send_line(u'\u000A' + result)
|
prof.send_line(u'\u000A' + result)
|
||||||
|
|
||||||
def prof_init(version, status):
|
|
||||||
|
def prof_init(version, status, account_name, fulljid):
|
||||||
synopsis = [
|
synopsis = [
|
||||||
"/paste"
|
"/paste"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ cmd_pid(char **args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_init(const char * const version, const char * const status)
|
prof_init(const char * const version, const char * const status, const char *const account_name, const char *const fulljid)
|
||||||
{
|
{
|
||||||
const char *synopsis[] = { "/pid", NULL };
|
const char *synopsis[] = { "/pid", NULL };
|
||||||
const char *description = "Show process ID and parent Process ID in the console window.";
|
const char *description = "Show process ID and parent Process ID in the console window.";
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ line=cyan
|
|||||||
import prof
|
import prof
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
|
|
||||||
def _cmd_platform():
|
def _cmd_platform():
|
||||||
result_summary = platform.platform()
|
result_summary = platform.platform()
|
||||||
prof.cons_show_themed("platform", "line", None, result_summary)
|
prof.cons_show_themed("platform", "line", None, result_summary)
|
||||||
|
|
||||||
def prof_init(version, status):
|
|
||||||
|
def prof_init(version, status, account_name, fulljid):
|
||||||
synopsis = [
|
synopsis = [
|
||||||
"/platform"
|
"/platform"
|
||||||
]
|
]
|
||||||
|
|||||||
8
say.py
8
say.py
@@ -13,30 +13,35 @@ from sys import platform
|
|||||||
|
|
||||||
enabled = False
|
enabled = False
|
||||||
|
|
||||||
|
|
||||||
def say(message):
|
def say(message):
|
||||||
if platform == "darwin":
|
if platform == "darwin":
|
||||||
os.system("say '" + message + "' 2>/dev/null")
|
os.system("say '" + message + "' 2>/dev/null")
|
||||||
elif platform == "linux" or platform == "linux2":
|
elif platform == "linux" or platform == "linux2":
|
||||||
os.system("echo '" + message + "' | espeak 2>/dev/null")
|
os.system("echo '" + message + "' | espeak 2>/dev/null")
|
||||||
|
|
||||||
|
|
||||||
def prof_post_chat_message_display(jid, message):
|
def prof_post_chat_message_display(jid, message):
|
||||||
global enabled
|
global enabled
|
||||||
if enabled:
|
if enabled:
|
||||||
say(jid + " says " + message)
|
say(jid + " says " + message)
|
||||||
return message
|
return message
|
||||||
|
|
||||||
|
|
||||||
def prof_post_room_message_display(room, nick, message):
|
def prof_post_room_message_display(room, nick, message):
|
||||||
global enabled
|
global enabled
|
||||||
if enabled:
|
if enabled:
|
||||||
say(nick + " says " + message + " in " + room)
|
say(nick + " says " + message + " in " + room)
|
||||||
return message
|
return message
|
||||||
|
|
||||||
|
|
||||||
def prof_post_priv_message_display(room, nick, message):
|
def prof_post_priv_message_display(room, nick, message):
|
||||||
global enabled
|
global enabled
|
||||||
if enabled:
|
if enabled:
|
||||||
say(nick + " says " + message)
|
say(nick + " says " + message)
|
||||||
return message
|
return message
|
||||||
|
|
||||||
|
|
||||||
def _cmd_say(arg1=None, arg2=None):
|
def _cmd_say(arg1=None, arg2=None):
|
||||||
global enabled
|
global enabled
|
||||||
if arg1 == "on":
|
if arg1 == "on":
|
||||||
@@ -51,7 +56,8 @@ def _cmd_say(arg1=None, arg2=None):
|
|||||||
else:
|
else:
|
||||||
prof.cons_bad_cmd_usage("/say")
|
prof.cons_bad_cmd_usage("/say")
|
||||||
|
|
||||||
def prof_init(version, status):
|
|
||||||
|
def prof_init(version, status, account_name, fulljid):
|
||||||
synopsis = [
|
synopsis = [
|
||||||
"/say on|off",
|
"/say on|off",
|
||||||
"/say test <message>"
|
"/say test <message>"
|
||||||
|
|||||||
@@ -13,9 +13,11 @@ import subprocess
|
|||||||
|
|
||||||
system_win = "System"
|
system_win = "System"
|
||||||
|
|
||||||
|
|
||||||
def _get_result(command):
|
def _get_result(command):
|
||||||
return subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).stdout.read()
|
return subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).stdout.read()
|
||||||
|
|
||||||
|
|
||||||
def _handle_win_input(win, command):
|
def _handle_win_input(win, command):
|
||||||
prof.win_show_themed(win, "system", "command", None, command)
|
prof.win_show_themed(win, "system", "command", None, command)
|
||||||
prof.win_show(win, "")
|
prof.win_show(win, "")
|
||||||
@@ -25,10 +27,12 @@ def _handle_win_input(win, command):
|
|||||||
prof.win_show_themed(win, "system", "result", None, s)
|
prof.win_show_themed(win, "system", "result", None, s)
|
||||||
prof.win_show(win, "")
|
prof.win_show(win, "")
|
||||||
|
|
||||||
|
|
||||||
def create_win():
|
def create_win():
|
||||||
if prof.win_exists(system_win) == False:
|
if prof.win_exists(system_win) == False:
|
||||||
prof.win_create(system_win, _handle_win_input)
|
prof.win_create(system_win, _handle_win_input)
|
||||||
|
|
||||||
|
|
||||||
def _cmd_system(arg1=None, arg2=None):
|
def _cmd_system(arg1=None, arg2=None):
|
||||||
if not arg1:
|
if not arg1:
|
||||||
create_win()
|
create_win()
|
||||||
@@ -55,7 +59,8 @@ def _cmd_system(arg1=None, arg2=None):
|
|||||||
else:
|
else:
|
||||||
prof.cons_bad_cmd_usage("/system")
|
prof.cons_bad_cmd_usage("/system")
|
||||||
|
|
||||||
def prof_init(version, status):
|
|
||||||
|
def prof_init(version, status, account_name, fulljid):
|
||||||
synopsis = [
|
synopsis = [
|
||||||
"/system",
|
"/system",
|
||||||
"/system exec <comman>",
|
"/system exec <comman>",
|
||||||
|
|||||||
@@ -303,12 +303,16 @@ def timed_callback():
|
|||||||
_create_win()
|
_create_win()
|
||||||
prof.win_show(plugin_win, "timed -> timed_callback called")
|
prof.win_show(plugin_win, "timed -> timed_callback called")
|
||||||
|
|
||||||
def prof_init(version, status):
|
def prof_init(version, status, account_name, fulljid):
|
||||||
t = threading.Thread(target=_inc_counter)
|
t = threading.Thread(target=_inc_counter)
|
||||||
t.daemon = True
|
t.daemon = True
|
||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
prof.win_create(plugin_win, _handle_win_input)
|
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 = [
|
synopsis = [
|
||||||
"/python-test consalert",
|
"/python-test consalert",
|
||||||
|
|||||||
@@ -462,12 +462,20 @@ timed_callback(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_init(const char * const version, const char * const status)
|
prof_init(const char * const version, const char * const status, const char *const account_name, const char *const fulljid)
|
||||||
{
|
{
|
||||||
pthread_create(&worker_thread, NULL, inc_counter, NULL);
|
pthread_create(&worker_thread, NULL, inc_counter, NULL);
|
||||||
|
|
||||||
prof_win_create(plugin_win, handle_win_input);
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
|
char buf[256];
|
||||||
|
if (account_name != NULL && fulljid != NULL) {
|
||||||
|
sprintf(buf, "fired -> prof_init: %s, %s, %s, %s", version, status, account_name, fulljid);
|
||||||
|
} else {
|
||||||
|
sprintf(buf, "fired -> prof_init: %s, %s", version, status);
|
||||||
|
}
|
||||||
|
prof_win_show(plugin_win, buf);
|
||||||
|
|
||||||
const char *synopsis[] = {
|
const char *synopsis[] = {
|
||||||
"/c-test consalert",
|
"/c-test consalert",
|
||||||
"/c-test consshow <message>",
|
"/c-test consshow <message>",
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ result=bold_magenta
|
|||||||
import prof
|
import prof
|
||||||
import getpass
|
import getpass
|
||||||
|
|
||||||
|
|
||||||
def _cmd_whoami():
|
def _cmd_whoami():
|
||||||
me = getpass.getuser()
|
me = getpass.getuser()
|
||||||
prof.cons_show_themed("whoami", "result", None, me)
|
prof.cons_show_themed("whoami", "result", None, me)
|
||||||
|
|
||||||
def prof_init(version, status):
|
|
||||||
|
def prof_init(version, status, account_name, fulljid):
|
||||||
synopsis = [ "/whoami" ]
|
synopsis = [ "/whoami" ]
|
||||||
description = "Calls the system whoami command"
|
description = "Calls the system whoami command"
|
||||||
args = []
|
args = []
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ win = "Wikipedia"
|
|||||||
page_ac = []
|
page_ac = []
|
||||||
link_ac = []
|
link_ac = []
|
||||||
|
|
||||||
|
|
||||||
def _open_browser(url):
|
def _open_browser(url):
|
||||||
savout = os.dup(1)
|
savout = os.dup(1)
|
||||||
saverr = os.dup(2)
|
saverr = os.dup(2)
|
||||||
@@ -51,13 +52,16 @@ def _open_browser(url):
|
|||||||
os.dup2(savout, 1)
|
os.dup2(savout, 1)
|
||||||
os.dup2(saverr, 2)
|
os.dup2(saverr, 2)
|
||||||
|
|
||||||
|
|
||||||
def _handle_win_input():
|
def _handle_win_input():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def create_win():
|
def create_win():
|
||||||
if prof.win_exists(win) == False:
|
if prof.win_exists(win) == False:
|
||||||
prof.win_create(win, _handle_win_input)
|
prof.win_create(win, _handle_win_input)
|
||||||
|
|
||||||
|
|
||||||
def _update_autocomplete():
|
def _update_autocomplete():
|
||||||
prof.completer_add("/wikipedia page", page_ac)
|
prof.completer_add("/wikipedia page", page_ac)
|
||||||
prof.completer_add("/wikipedia summary", page_ac)
|
prof.completer_add("/wikipedia summary", page_ac)
|
||||||
@@ -65,6 +69,7 @@ def _update_autocomplete():
|
|||||||
prof.completer_add("/wikipedia links", page_ac)
|
prof.completer_add("/wikipedia links", page_ac)
|
||||||
prof.completer_add("/wikipedia refs", page_ac)
|
prof.completer_add("/wikipedia refs", page_ac)
|
||||||
|
|
||||||
|
|
||||||
def _search(search_terms):
|
def _search(search_terms):
|
||||||
global page_ac
|
global page_ac
|
||||||
|
|
||||||
@@ -81,6 +86,7 @@ def _search(search_terms):
|
|||||||
prof.win_show(win, "")
|
prof.win_show(win, "")
|
||||||
prof.win_focus(win)
|
prof.win_focus(win)
|
||||||
|
|
||||||
|
|
||||||
def _summary(page_str):
|
def _summary(page_str):
|
||||||
global link_ac
|
global link_ac
|
||||||
|
|
||||||
@@ -103,6 +109,7 @@ def _summary(page_str):
|
|||||||
prof.win_show(win, "")
|
prof.win_show(win, "")
|
||||||
prof.win_focus(win)
|
prof.win_focus(win)
|
||||||
|
|
||||||
|
|
||||||
def _page(page_str):
|
def _page(page_str):
|
||||||
page = wikipedia.page(page_str)
|
page = wikipedia.page(page_str)
|
||||||
create_win()
|
create_win()
|
||||||
@@ -117,6 +124,7 @@ def _page(page_str):
|
|||||||
prof.win_show(win, "")
|
prof.win_show(win, "")
|
||||||
prof.win_focus(win)
|
prof.win_focus(win)
|
||||||
|
|
||||||
|
|
||||||
def _images(page_str):
|
def _images(page_str):
|
||||||
global link_ac
|
global link_ac
|
||||||
|
|
||||||
@@ -136,6 +144,7 @@ def _images(page_str):
|
|||||||
prof.win_show(win, "")
|
prof.win_show(win, "")
|
||||||
prof.win_focus(win)
|
prof.win_focus(win)
|
||||||
|
|
||||||
|
|
||||||
def _links(page_str):
|
def _links(page_str):
|
||||||
global page_ac
|
global page_ac
|
||||||
|
|
||||||
@@ -156,6 +165,7 @@ def _links(page_str):
|
|||||||
prof.win_show(win, "")
|
prof.win_show(win, "")
|
||||||
prof.win_focus(win)
|
prof.win_focus(win)
|
||||||
|
|
||||||
|
|
||||||
def _refs(page_str):
|
def _refs(page_str):
|
||||||
global link_ac
|
global link_ac
|
||||||
|
|
||||||
@@ -175,6 +185,7 @@ def _refs(page_str):
|
|||||||
prof.win_show(win, "")
|
prof.win_show(win, "")
|
||||||
prof.win_focus(win)
|
prof.win_focus(win)
|
||||||
|
|
||||||
|
|
||||||
def cmd_wp(subcmd, arg):
|
def cmd_wp(subcmd, arg):
|
||||||
try:
|
try:
|
||||||
if subcmd == "search": _search(arg)
|
if subcmd == "search": _search(arg)
|
||||||
@@ -195,7 +206,8 @@ def cmd_wp(subcmd, arg):
|
|||||||
prof.win_show(win, "")
|
prof.win_show(win, "")
|
||||||
prof.win_focus(win)
|
prof.win_focus(win)
|
||||||
|
|
||||||
def prof_init(version, status):
|
|
||||||
|
def prof_init(version, status, account_name, fulljid):
|
||||||
synopsis = [
|
synopsis = [
|
||||||
"/wikipedia search <text>",
|
"/wikipedia search <text>",
|
||||||
"/wikipedia summary <title>",
|
"/wikipedia summary <title>",
|
||||||
|
|||||||
Reference in New Issue
Block a user