Compare commits
48 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aef8541135 | ||
|
|
018f369ff4 | ||
|
|
9bc1cbc8a1 | ||
|
|
6569ad66d5 | ||
|
|
4f91f5cf67 | ||
|
|
55530de6b6 | ||
|
|
39f5a03e78 | ||
|
|
cd92ab06d3 | ||
|
|
9506e24609 | ||
|
|
da276cb2e8 | ||
|
|
18c2fc0654 | ||
|
|
b578b5d720 | ||
|
|
b8f03164ee | ||
|
|
409c383937 | ||
|
|
16e6d7257a | ||
|
|
9be0cdf568 | ||
|
|
009a5c79a3 | ||
|
|
72542b75dc | ||
|
|
afc2a585a3 | ||
|
|
b7c758161d | ||
|
|
83ec503ea9 | ||
|
|
c02c159e24 | ||
|
|
217f4e3c99 | ||
|
|
d5dcd54ec8 | ||
|
|
3036624725 | ||
|
|
042e626423 | ||
|
|
05b3d69cbb | ||
|
|
dc057d40a7 | ||
|
|
d80767f1c4 | ||
|
|
9a2234a1b4 | ||
|
|
47acbc76ac | ||
|
|
1250d1df42 | ||
|
|
c39550cd1c | ||
|
|
38c06599c1 | ||
|
|
32ad1708a9 | ||
|
|
dfd7b09d9e | ||
|
|
91558b7f06 | ||
|
|
6d954537b9 | ||
|
|
b8a19f3cff | ||
|
|
77c2eb0f56 | ||
|
|
eeb1c0e214 | ||
|
|
2a20b83f53 | ||
|
|
64a97f5177 | ||
|
|
9c7f05305b | ||
|
|
ff23b5b2ce | ||
|
|
ef43aa0267 | ||
|
|
8cf42e000b | ||
|
|
2895411eb6 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
*.so
|
*.so
|
||||||
|
.idea/
|
||||||
|
|||||||
98
README.md
98
README.md
@@ -1,110 +1,48 @@
|
|||||||
profanity-plugins
|
profanity-plugins
|
||||||
=================
|
=================
|
||||||
|
|
||||||
Plugin support for Profanity is currently in development.
|
* [Website documentation](http://www.profanity.im/plugins.html)
|
||||||
|
|
||||||
* The `master` branch of Profanity now includes support for C and Python plugins.
|
|
||||||
* The `plugins` branch contains additional support for Ruby and Lua, but is unstable.
|
|
||||||
|
|
||||||
For a list of outstanding issues before releasing 0.5.0, see: https://github.com/boothj5/profanity/milestones/0.5.0
|
|
||||||
|
|
||||||
Building Profanity with plugin support
|
Building Profanity with plugin support
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
|
|
||||||
Additional dependencies required:
|
Dependencies required:
|
||||||
|
|
||||||
```
|
```
|
||||||
autoconf-archive
|
autoconf-archive
|
||||||
libtool
|
libtool
|
||||||
```
|
```
|
||||||
|
|
||||||
Plus the development packages for supported languages:
|
For Python plugins the following is also required:
|
||||||
|
|
||||||
```
|
```
|
||||||
python-dev
|
python-dev
|
||||||
lua-dev
|
|
||||||
ruby-dev
|
|
||||||
```
|
|
||||||
|
|
||||||
Build with:
|
|
||||||
|
|
||||||
```
|
|
||||||
./bootstrap.sh
|
|
||||||
./configure --enable-python-plugins
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
```
|
|
||||||
|
|
||||||
Only support for Python 2.7 is currently included, after building, run `profanity -v` to see which language support is available, example output:
|
|
||||||
|
|
||||||
```
|
|
||||||
Profanity, version 0.5.0dev.plugins-python.63a7316
|
|
||||||
Copyright (C) 2012 - 2016 James Booth <boothj5web@gmail.com>.
|
|
||||||
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
|
||||||
|
|
||||||
This is free software; you are free to change and redistribute it.
|
|
||||||
There is NO WARRANTY, to the extent permitted by law.
|
|
||||||
|
|
||||||
Build information:
|
|
||||||
XMPP library: libmesode
|
|
||||||
Desktop notification support: Enabled
|
|
||||||
OTR support: Enabled
|
|
||||||
PGP support: Enabled
|
|
||||||
C plugins: Enabled
|
|
||||||
Python plugins: Enabled
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Installing plugins
|
Installing plugins
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
1 - Copy the plugin
|
Use the `/plugins install` command, e.g.
|
||||||
|
|
||||||
For Python, Ruby and Lua plugins, copy the plugin to `$XDG_DATA/profanity/plugins/`, (`~/.local/share/profanity/plugins/` on most systems).
|
|
||||||
|
|
||||||
For C plugins, build the plugin using the supplied Makefile, and then copy the `.so` file to the same location.
|
|
||||||
|
|
||||||
2 - Load the plugin
|
|
||||||
|
|
||||||
Run the `/plugins load <plugin>` command to load the plugin, e.g. `/plugins load browser.py`, the plugin can also be manually added to the config file `$XDG_CONFIG/profanity/profrc` (`~/.config/profanity/profrc` on most systems).
|
|
||||||
|
|
||||||
For example:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
[plugins]
|
/plugins install ~/projects-git/profanity-plugins/stable/say.py
|
||||||
load=browser.py;platform-info.py;ascii.py;pid.so
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Getting help on plugins:
|
See the `/help plugins` command for further plugin management options.
|
||||||
|
|
||||||
* `/plugins` - Shows a list of loaded plugins.
|
Branches
|
||||||
* `/help commands plugins` - Shows commands defined by plugins
|
--------
|
||||||
* `/help <plugin_cmd>` - Show help for a plugin command, e.g. `/help browser`
|
|
||||||
|
|
||||||
Plugin themes
|
* `0.5.0`: Maintenance branch for plugins compatible with the current Profanity release 0.5.0
|
||||||
-------------
|
* `0.5.1`: Development for the next Profanity patch release 0.5.1
|
||||||
|
* `master`: Development for the next Profanity major release 0.6.0
|
||||||
|
|
||||||
The plugins API includes functions to print themed output to the console or a plugins window. The themes need to be added to
|
Developing plugins
|
||||||
|
------------------
|
||||||
```
|
|
||||||
~/.local/share/profanity/plugin_themes
|
|
||||||
```
|
|
||||||
|
|
||||||
For example ([syscmd.py](https://github.com/boothj5/profanity-plugins/blob/master/syscmd.py) plugin):
|
|
||||||
|
|
||||||
```
|
|
||||||
[system]
|
|
||||||
command=cyan
|
|
||||||
result=green
|
|
||||||
```
|
|
||||||
|
|
||||||
Example plugin code
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
Whilst the API is being developed, the following test plugins are a good reference of possible hooks and API calls available, (Ruby and Lua examples might not be up to date):
|
|
||||||
|
|
||||||
* [tests/test-c-plugin.c](https://github.com/boothj5/profanity-plugins/blob/master/tests/test-c-plugin/test-c-plugin.c)
|
|
||||||
* [tests/python-test.py](https://github.com/boothj5/profanity-plugins/blob/master/tests/python-test.py)
|
|
||||||
* [tests/RubyTest.rb](https://github.com/boothj5/profanity-plugins/blob/master/tests/RubyTest.rb)
|
|
||||||
* [tests/luatest.lua](https://github.com/boothj5/profanity-plugins/blob/master/tests/luatest.lua)
|
|
||||||
|
|
||||||
|
API Documentation:
|
||||||
|
* [Python API](http://www.profanity.im/plugins/python/html/prof.html)
|
||||||
|
* [Python hooks](http://www.profanity.im/plugins/python/html/plugin.html)
|
||||||
|
* [C API](http://www.profanity.im/plugins/c/html/profapi_8h.html)
|
||||||
|
* [C hooks](http://www.profanity.im/plugins/c/html/profhooks_8h.html)
|
||||||
|
|
||||||
|
|||||||
175
browser.py
175
browser.py
@@ -1,175 +0,0 @@
|
|||||||
"""
|
|
||||||
Open the last link received in a chat or room window using the systems default browser
|
|
||||||
"""
|
|
||||||
|
|
||||||
import prof
|
|
||||||
import os
|
|
||||||
import webbrowser
|
|
||||||
import re
|
|
||||||
import requests
|
|
||||||
from os.path import expanduser
|
|
||||||
|
|
||||||
_links = {}
|
|
||||||
_lastlink = {}
|
|
||||||
|
|
||||||
|
|
||||||
def _get_url():
|
|
||||||
link = None
|
|
||||||
jid = prof.get_current_recipient()
|
|
||||||
room = prof.get_current_muc()
|
|
||||||
|
|
||||||
# check if in chat window
|
|
||||||
if jid is not None:
|
|
||||||
|
|
||||||
# check for link from recipient
|
|
||||||
if jid in _lastlink.keys():
|
|
||||||
link = _lastlink[jid]
|
|
||||||
else:
|
|
||||||
prof.cons_show("No links found from " + jid)
|
|
||||||
|
|
||||||
# check if in muc window
|
|
||||||
elif room is not None:
|
|
||||||
if room in _lastlink.keys():
|
|
||||||
link = _lastlink[room]
|
|
||||||
else:
|
|
||||||
prof.cons_show("No links found in " + room)
|
|
||||||
|
|
||||||
# not in chat/muc window
|
|
||||||
else:
|
|
||||||
prof.cons_show("You must supply a URL to the /browser command")
|
|
||||||
|
|
||||||
return link
|
|
||||||
|
|
||||||
def _cmd_browser(arg1=None, arg2=None):
|
|
||||||
global _lastlink
|
|
||||||
link = None
|
|
||||||
|
|
||||||
if arg1 == "setdir":
|
|
||||||
if not arg2:
|
|
||||||
prof.cons_bad_cmd_usage("/browser")
|
|
||||||
else:
|
|
||||||
prof.settings_set_string("browser", "download.path", arg2)
|
|
||||||
prof.cons_show("browser.py set download path to" + arg2)
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
if arg1 == "get":
|
|
||||||
link = arg2 if arg2 is not None else _get_url()
|
|
||||||
|
|
||||||
if not link:
|
|
||||||
prof.log_debug("browser.py: no link found for get command")
|
|
||||||
return
|
|
||||||
|
|
||||||
folder = prof.settings_get_string("browser", "download.path", "")
|
|
||||||
if folder == "":
|
|
||||||
prof.cons_show("Download path not set, see /help browser")
|
|
||||||
return
|
|
||||||
|
|
||||||
if folder[0] == '~':
|
|
||||||
folder = expanduser("~") + folder[1:]
|
|
||||||
|
|
||||||
response = requests.get(link)
|
|
||||||
if response.status_code != 200:
|
|
||||||
prof.log_debug("browser.py: received non 200 response for get command")
|
|
||||||
return
|
|
||||||
|
|
||||||
filename = link.split("/")[-1]
|
|
||||||
full_path = folder + "/" + filename
|
|
||||||
prof.log_debug("browser.py: Saving link {link} to file {file}".format(link=link, file=full_path))
|
|
||||||
with open(full_path, 'wb') as f:
|
|
||||||
for chunk in response.iter_content(8):
|
|
||||||
f.write(chunk)
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
link = arg1 if arg1 is not None else _get_url();
|
|
||||||
if link is not None:
|
|
||||||
prof.cons_show("Opening " + link + " in browser")
|
|
||||||
_open_browser(link)
|
|
||||||
|
|
||||||
|
|
||||||
def _open_browser(url):
|
|
||||||
savout = os.dup(1)
|
|
||||||
saverr = os.dup(2)
|
|
||||||
os.close(1)
|
|
||||||
os.close(2)
|
|
||||||
os.open(os.devnull, os.O_RDWR)
|
|
||||||
try:
|
|
||||||
webbrowser.open(url, new=2)
|
|
||||||
finally:
|
|
||||||
os.dup2(savout, 1)
|
|
||||||
os.dup2(saverr, 2)
|
|
||||||
|
|
||||||
|
|
||||||
def prof_init(version, status, account_name, fulljid):
|
|
||||||
synopsis = [
|
|
||||||
"/browser",
|
|
||||||
"/browser <url>",
|
|
||||||
"/browser get <url>",
|
|
||||||
"/browser setdir <folder>"
|
|
||||||
]
|
|
||||||
description = (
|
|
||||||
"View a URL in the systems default browser, or download and view link contents " +
|
|
||||||
"If no argument is supplied, the last URL in the current chat or room will be used. " +
|
|
||||||
"Tab autocompletion will go through all previous links in the current chat/room"
|
|
||||||
)
|
|
||||||
args = [
|
|
||||||
[ "<url>", "URL to open in the browser" ],
|
|
||||||
[ "download <url>", "Download contents of specified URL" ],
|
|
||||||
[ "setdir <dir>", "Filesystem path to store downloaded content" ]
|
|
||||||
]
|
|
||||||
examples = [
|
|
||||||
"/browser http://www.profanity.im",
|
|
||||||
"/browser setdir ~/Downloads",
|
|
||||||
"/browser get http://www.movenoticias.com/wp-content/uploads/2015/05/Bruce-Iron-Maiden-850x583.jpg"
|
|
||||||
]
|
|
||||||
|
|
||||||
prof.register_command("/browser", 0, 2, synopsis, description, args, examples, _cmd_browser)
|
|
||||||
prof.completer_add("/browser", [ "get", "setdir" ])
|
|
||||||
|
|
||||||
|
|
||||||
def prof_on_chat_win_focus(jid):
|
|
||||||
prof.completer_clear("/browser")
|
|
||||||
if jid in _links:
|
|
||||||
prof.completer_add("/browser", _links[jid])
|
|
||||||
|
|
||||||
|
|
||||||
def prof_on_room_win_focus(room):
|
|
||||||
prof.completer_clear("/browser")
|
|
||||||
if room in _links:
|
|
||||||
prof.completer_add("/browser", _links[room])
|
|
||||||
|
|
||||||
|
|
||||||
def _process_message(jid, current_jid, message):
|
|
||||||
links = re.findall(r'(https?://\S+)', message)
|
|
||||||
if len(links) > 0:
|
|
||||||
if jid not in _links:
|
|
||||||
_links[jid] = []
|
|
||||||
|
|
||||||
# add to list of links for jid
|
|
||||||
for link in links:
|
|
||||||
if link not in _links[jid]:
|
|
||||||
prof.log_debug("browser.py: Saving {link} for {jid}".format(link=link, jid=jid))
|
|
||||||
_links[jid].append(link)
|
|
||||||
|
|
||||||
# add to autocompleter if message for current window
|
|
||||||
if current_jid == jid:
|
|
||||||
prof.completer_add("/browser", _links[jid])
|
|
||||||
|
|
||||||
# set last link for jid
|
|
||||||
_lastlink[jid] = links[len(links)-1]
|
|
||||||
|
|
||||||
|
|
||||||
def prof_post_chat_message_display(jid, message):
|
|
||||||
current_jid = prof.get_current_recipient()
|
|
||||||
_process_message(jid, current_jid, message)
|
|
||||||
|
|
||||||
|
|
||||||
def prof_post_room_message_display(room, nick, message):
|
|
||||||
current_jid = prof.get_current_muc()
|
|
||||||
_process_message(room, current_jid, message)
|
|
||||||
|
|
||||||
|
|
||||||
def prof_on_room_history_message(room, nick, message, timestamp):
|
|
||||||
current_jid = prof.get_current_muc()
|
|
||||||
_process_message(room, current_jid, message)
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
rm -rf ~/.local/share/profanity/plugins/*
|
|
||||||
|
|
||||||
cp ascii.py ~/.local/share/profanity/plugins/.
|
|
||||||
cp syscmd.py ~/.local/share/profanity/plugins/.
|
|
||||||
cp paste.py ~/.local/share/profanity/plugins/.
|
|
||||||
cp browser.py ~/.local/share/profanity/plugins/.
|
|
||||||
cp platform-info.py ~/.local/share/profanity/plugins/.
|
|
||||||
cp say.py ~/.local/share/profanity/plugins/.
|
|
||||||
cp whoami.py ~/.local/share/profanity/plugins/.
|
|
||||||
cp wikipedia-prof.py ~/.local/share/profanity/plugins/.
|
|
||||||
cp clients.py ~/.local/share/profanity/plugins/.
|
|
||||||
cp tests/python-test.py ~/.local/share/profanity/plugins/.
|
|
||||||
|
|
||||||
cd pid
|
|
||||||
make clean
|
|
||||||
make
|
|
||||||
cp pid.so ~/.local/share/profanity/plugins/.
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
cd tests/test-c-plugin
|
|
||||||
make clean
|
|
||||||
make
|
|
||||||
cp test-c-plugin.so ~/.local/share/profanity/plugins/.
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
|
|
||||||
@@ -10,12 +10,12 @@ bot_session = {}
|
|||||||
bot_state = False
|
bot_state = False
|
||||||
|
|
||||||
|
|
||||||
def prof_post_chat_message_display(jid, message):
|
def prof_post_chat_message_display(barejid, resource, message):
|
||||||
if bot_state:
|
if bot_state:
|
||||||
if jid not in bot_session:
|
if barejid not in bot_session:
|
||||||
bot_session[jid] = bot.create_session()
|
bot_session[barejid] = bot.create_session()
|
||||||
response = bot_session[jid].think(message)
|
response = bot_session[barejid].think(message)
|
||||||
prof.send_line("/msg " + jid + " " + response)
|
prof.send_line("/msg " + barejid + " " + response)
|
||||||
|
|
||||||
|
|
||||||
def _cmd_chatterbot(state):
|
def _cmd_chatterbot(state):
|
||||||
26
emoticons.py
26
emoticons.py
@@ -1,26 +0,0 @@
|
|||||||
"""
|
|
||||||
Convert smileys ( :) :( etc) to the Unicode character representation
|
|
||||||
"""
|
|
||||||
|
|
||||||
import prof
|
|
||||||
|
|
||||||
|
|
||||||
def _emote(input_str):
|
|
||||||
result = input_str
|
|
||||||
result = result.replace(":-)", u'\u263a'.encode("utf-8"))
|
|
||||||
result = result.replace(":)", u'\u263a'.encode("utf-8"))
|
|
||||||
result = result.replace(":-(", u'\u2639'.encode("utf-8"))
|
|
||||||
result = result.replace(":(", u'\u2639'.encode("utf-8"))
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def prof_pre_chat_message_display(jid, message):
|
|
||||||
return _emote(message)
|
|
||||||
|
|
||||||
|
|
||||||
def prof_pre_room_message_display(room, nick, message):
|
|
||||||
return _emote(message)
|
|
||||||
|
|
||||||
|
|
||||||
def prof_pre_priv_message_display(room, nick, message):
|
|
||||||
return _emote(message)
|
|
||||||
24
paste.py
24
paste.py
@@ -1,24 +0,0 @@
|
|||||||
"""
|
|
||||||
Paste the contents of the clipboard when in a chat or room window.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import prof
|
|
||||||
import sys
|
|
||||||
import Tkinter as tk
|
|
||||||
|
|
||||||
|
|
||||||
def _cmd_paste():
|
|
||||||
root = tk.Tk(baseName="")
|
|
||||||
root.withdraw()
|
|
||||||
result = root.clipboard_get()
|
|
||||||
prof.send_line(u'\u000A' + result)
|
|
||||||
|
|
||||||
|
|
||||||
def prof_init(version, status, account_name, fulljid):
|
|
||||||
synopsis = [
|
|
||||||
"/paste"
|
|
||||||
]
|
|
||||||
description = "Paste contents of clipboard."
|
|
||||||
args = []
|
|
||||||
examples = []
|
|
||||||
prof.register_command("/paste", 0, 0, synopsis, description, args, examples, _cmd_paste)
|
|
||||||
121
stable/browser.py
Normal file
121
stable/browser.py
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
"""
|
||||||
|
Open the last link received in a chat or room window using the systems default browser
|
||||||
|
"""
|
||||||
|
|
||||||
|
import prof
|
||||||
|
import os
|
||||||
|
import webbrowser
|
||||||
|
import re
|
||||||
|
|
||||||
|
_links = {}
|
||||||
|
_lastlink = {}
|
||||||
|
|
||||||
|
|
||||||
|
def _cmd_browser(url):
|
||||||
|
global _lastlink
|
||||||
|
link = None
|
||||||
|
|
||||||
|
# use arg if supplied
|
||||||
|
if (url is not None):
|
||||||
|
link = url
|
||||||
|
else:
|
||||||
|
jid = prof.get_current_recipient()
|
||||||
|
room = prof.get_current_muc()
|
||||||
|
|
||||||
|
# check if in chat window
|
||||||
|
if (jid is not None):
|
||||||
|
|
||||||
|
# check for link from recipient
|
||||||
|
if jid in _lastlink.keys():
|
||||||
|
link = _lastlink[jid]
|
||||||
|
else:
|
||||||
|
prof.cons_show("No links found from " + jid)
|
||||||
|
|
||||||
|
# check if in muc window
|
||||||
|
elif (room is not None):
|
||||||
|
if room in _lastlink.keys():
|
||||||
|
link = _lastlink[room]
|
||||||
|
else:
|
||||||
|
prof.cons_show("No links found from " + room)
|
||||||
|
|
||||||
|
# not in chat/muc window
|
||||||
|
else:
|
||||||
|
prof.cons_show("You must supply a URL to the /browser command")
|
||||||
|
|
||||||
|
# open the browser if link found
|
||||||
|
if (link is not None):
|
||||||
|
prof.cons_show("Opening " + link + " in browser")
|
||||||
|
_open_browser(link)
|
||||||
|
|
||||||
|
|
||||||
|
def _open_browser(url):
|
||||||
|
savout = os.dup(1)
|
||||||
|
saverr = os.dup(2)
|
||||||
|
os.close(1)
|
||||||
|
os.close(2)
|
||||||
|
os.open(os.devnull, os.O_RDWR)
|
||||||
|
try:
|
||||||
|
webbrowser.open(url, new=2)
|
||||||
|
finally:
|
||||||
|
os.dup2(savout, 1)
|
||||||
|
os.dup2(saverr, 2)
|
||||||
|
|
||||||
|
|
||||||
|
def prof_init(version, status, account_name, fulljid):
|
||||||
|
synopsis = [
|
||||||
|
"/browser",
|
||||||
|
"/browser <url>"
|
||||||
|
]
|
||||||
|
description = "View a URL in the systems default browser. If no argument is supplied, the last URL in the current chat or room will be used. " \
|
||||||
|
"Tab autocompletion will go through all previous links in the current chat/room"
|
||||||
|
args = [
|
||||||
|
[ "<url>", "URL to open in the browser" ]
|
||||||
|
]
|
||||||
|
examples = [
|
||||||
|
"/browser http://www.profanity.im"
|
||||||
|
]
|
||||||
|
|
||||||
|
prof.register_command("/browser", 0, 1, synopsis, description, args, examples, _cmd_browser)
|
||||||
|
|
||||||
|
|
||||||
|
def prof_on_chat_win_focus(barejid):
|
||||||
|
prof.completer_clear("/browser")
|
||||||
|
if barejid in _links:
|
||||||
|
prof.completer_add("/browser", _links[barejid])
|
||||||
|
|
||||||
|
|
||||||
|
def prof_on_room_win_focus(barejid):
|
||||||
|
prof.completer_clear("/browser")
|
||||||
|
if barejid in _links:
|
||||||
|
prof.completer_add("/browser", _links[barejid])
|
||||||
|
|
||||||
|
|
||||||
|
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]
|
||||||
|
|
||||||
|
|
||||||
|
def prof_post_chat_message_display(barejid, resource, message):
|
||||||
|
current_jid = prof.get_current_recipient()
|
||||||
|
_process_message(barejid, current_jid, message)
|
||||||
|
|
||||||
|
|
||||||
|
def prof_post_room_message_display(barejid, nick, message):
|
||||||
|
current_jid = prof.get_current_muc()
|
||||||
|
_process_message(barejid, current_jid, message)
|
||||||
|
|
||||||
|
|
||||||
|
def prof_on_room_history_message(barejid, nick, message, timestamp):
|
||||||
|
current_jid = prof.get_current_muc()
|
||||||
|
_process_message(barejid, current_jid, message)
|
||||||
@@ -63,6 +63,7 @@ def _sv_send(muc, occupant):
|
|||||||
ET.SubElement(iq, "query", {
|
ET.SubElement(iq, "query", {
|
||||||
"xmlns": "jabber:iq:version"
|
"xmlns": "jabber:iq:version"
|
||||||
})
|
})
|
||||||
|
|
||||||
iq_id_count = iq_id_count + 1
|
iq_id_count = iq_id_count + 1
|
||||||
|
|
||||||
prof.send_stanza(ET.tostring(iq))
|
prof.send_stanza(ET.tostring(iq))
|
||||||
@@ -71,10 +72,12 @@ def _sv_send(muc, occupant):
|
|||||||
def _cmd_clients():
|
def _cmd_clients():
|
||||||
muc = prof.get_current_muc()
|
muc = prof.get_current_muc()
|
||||||
if muc == None:
|
if muc == None:
|
||||||
|
prof.cons_show("Command only valid in chat rooms.")
|
||||||
return
|
return
|
||||||
|
|
||||||
occupants = prof.get_current_occupants()
|
occupants = prof.get_current_occupants()
|
||||||
if occupants == None or len(occupants) == 0:
|
if occupants == None or len(occupants) == 0:
|
||||||
|
prof.cons_show("No occupants for /clients command.")
|
||||||
return
|
return
|
||||||
|
|
||||||
nick = prof.get_current_nick()
|
nick = prof.get_current_nick()
|
||||||
30
stable/emoticons.py
Normal file
30
stable/emoticons.py
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
"""
|
||||||
|
Convert smileys ( :) :( etc) to the Unicode character representation
|
||||||
|
|
||||||
|
Dependencies:
|
||||||
|
pip install future
|
||||||
|
"""
|
||||||
|
|
||||||
|
import prof
|
||||||
|
from builtins import chr
|
||||||
|
|
||||||
|
|
||||||
|
def _emote(input_str):
|
||||||
|
result = input_str
|
||||||
|
result = result.replace(":-)", chr(9786))
|
||||||
|
result = result.replace(":)", chr(9786))
|
||||||
|
result = result.replace(":-(", chr(9785))
|
||||||
|
result = result.replace(":(", chr(9785))
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def prof_pre_chat_message_display(barejid, resource, message):
|
||||||
|
return _emote(message)
|
||||||
|
|
||||||
|
|
||||||
|
def prof_pre_room_message_display(barejid, nick, message):
|
||||||
|
return _emote(message)
|
||||||
|
|
||||||
|
|
||||||
|
def prof_pre_priv_message_display(barejid, nick, message):
|
||||||
|
return _emote(message)
|
||||||
61
stable/imgur.py
Normal file
61
stable/imgur.py
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
"""
|
||||||
|
Requires imgur API
|
||||||
|
pip install imgurpython
|
||||||
|
Requires scrot installed for screenshot (on linux)
|
||||||
|
sudo apt-get install scrot
|
||||||
|
|
||||||
|
Uses built in screencapture on OSX
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
import prof
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
from os import path
|
||||||
|
|
||||||
|
from imgurpython import ImgurClient
|
||||||
|
from imgurpython.helpers.error import ImgurClientError
|
||||||
|
|
||||||
|
client_id = '19c4ba3fc2c26ef'
|
||||||
|
client_secret = 'dd5b0918a2f5d36391d574bd2061c50b47bade63'
|
||||||
|
client = ImgurClient(client_id, client_secret)
|
||||||
|
|
||||||
|
|
||||||
|
def _cmd_imgur(arg1):
|
||||||
|
if arg1 == "screenshot":
|
||||||
|
file_path = "/tmp/_prof_screenshot.png"
|
||||||
|
if sys.platform == "darwin":
|
||||||
|
subprocess.call("screencapture " + file_path, shell=True)
|
||||||
|
else:
|
||||||
|
subprocess.call("scrot " + file_path, shell=True)
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
file_path = path.expanduser(arg1)
|
||||||
|
except IOError as ioe:
|
||||||
|
prof.cons_show('Could not find file at ' + file_path)
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
data = client.upload_from_path(file_path, config=None, anon=True)
|
||||||
|
prof.send_line(data['link'])
|
||||||
|
except ImgurClientError as e:
|
||||||
|
prof.log_error('Could not upload to Imgur - ' + e.error_message)
|
||||||
|
prof.log_error('Imgur status code - ' + e.status_code)
|
||||||
|
|
||||||
|
|
||||||
|
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" ])
|
||||||
60
stable/paste.py
Normal file
60
stable/paste.py
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
"""
|
||||||
|
Paste the contents of the clipboard when in a chat or room window.
|
||||||
|
|
||||||
|
Dependencies:
|
||||||
|
pip install future
|
||||||
|
sudo apt-get python-tk (or python3-tk)
|
||||||
|
"""
|
||||||
|
|
||||||
|
import prof
|
||||||
|
import tkinter as tk
|
||||||
|
|
||||||
|
|
||||||
|
def _cmd_paste(arg1=None, arg2=None):
|
||||||
|
if not arg1:
|
||||||
|
root = tk.Tk(baseName="")
|
||||||
|
root.withdraw()
|
||||||
|
result = root.clipboard_get()
|
||||||
|
newline = prof.settings_boolean_get("paste", "newline", True)
|
||||||
|
if len(result.splitlines()) > 1 and newline:
|
||||||
|
prof.send_line(u'\u000A' + result)
|
||||||
|
else:
|
||||||
|
prof.send_line(result)
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
if arg1 == "newline":
|
||||||
|
if not arg2:
|
||||||
|
prof.cons_show("")
|
||||||
|
newline = prof.settings_boolean_get("paste", "newline", True)
|
||||||
|
if newline:
|
||||||
|
prof.cons_show("paste.py newline: on")
|
||||||
|
else:
|
||||||
|
prof.cons_show("paste.py newline: off")
|
||||||
|
elif arg2 == "on":
|
||||||
|
prof.settings_boolean_set("paste", "newline", True)
|
||||||
|
prof.cons_show("paste.py newline enabled.")
|
||||||
|
elif arg2 == "off":
|
||||||
|
prof.settings_boolean_set("paste", "newline", False)
|
||||||
|
prof.cons_show("paste.py newline disabled.")
|
||||||
|
else:
|
||||||
|
prof.cons_bad_cmd_usage("/paste")
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
prof.cons_bad_cmd_usage("/paste")
|
||||||
|
|
||||||
|
|
||||||
|
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" ])
|
||||||
@@ -30,10 +30,10 @@ cmd_pid(char **args)
|
|||||||
void
|
void
|
||||||
prof_init(const char * const version, const char * const status, const char *const account_name, const char *const fulljid)
|
prof_init(const char * const version, const char * const status, const char *const account_name, const char *const fulljid)
|
||||||
{
|
{
|
||||||
const char *synopsis[] = { "/pid", NULL };
|
char *synopsis[] = { "/pid", NULL };
|
||||||
const char *description = "Show process ID and parent Process ID in the console window.";
|
char *description = "Show process ID and parent Process ID in the console window.";
|
||||||
const char *args[][2] = { { NULL, NULL } };
|
char *args[][2] = { { NULL, NULL } };
|
||||||
const char *examples[] = { NULL };
|
char *examples[] = { NULL };
|
||||||
|
|
||||||
prof_register_command("/pid", 0, 0, synopsis, description, args, examples, cmd_pid);
|
prof_register_command("/pid", 0, 0, synopsis, description, args, examples, cmd_pid);
|
||||||
}
|
}
|
||||||
164
stable/presence_notify.py
Normal file
164
stable/presence_notify.py
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
import prof
|
||||||
|
|
||||||
|
online = set()
|
||||||
|
|
||||||
|
def _show_settings():
|
||||||
|
prof.cons_show("")
|
||||||
|
prof.cons_show("Presence notify plugin settings:")
|
||||||
|
|
||||||
|
mode = prof.settings_string_get("presence_notify", "mode", "all")
|
||||||
|
prof.cons_show("Mode: {mode}".format(mode=mode))
|
||||||
|
|
||||||
|
resource = prof.settings_boolean_get("presence_notify", "resource", False)
|
||||||
|
if resource:
|
||||||
|
prof.cons_show("Resource: ON")
|
||||||
|
else:
|
||||||
|
prof.cons_show("Resource: OFF")
|
||||||
|
|
||||||
|
ignored_list = prof.settings_string_list_get("presence_notify", "ignored")
|
||||||
|
if ignored_list and len(ignored_list) > 0:
|
||||||
|
prof.cons_show("Ignored:")
|
||||||
|
for contact in ignored_list:
|
||||||
|
prof.cons_show(" {barejid}".format(barejid=contact))
|
||||||
|
|
||||||
|
|
||||||
|
def _cmd_presence_notify(arg1=None, arg2=None, arg3=None):
|
||||||
|
if arg1 == "all":
|
||||||
|
prof.settings_string_set("presence_notify", "mode", "all")
|
||||||
|
prof.cons_show("Notifying on all presence changes")
|
||||||
|
return
|
||||||
|
|
||||||
|
if arg1 == "online":
|
||||||
|
prof.settings_string_set("presence_notify", "mode", "online")
|
||||||
|
prof.cons_show("Notifying on online/offline presence changes only")
|
||||||
|
return
|
||||||
|
|
||||||
|
if arg1 == "off":
|
||||||
|
prof.settings_string_set("presence_notify", "mode", "off")
|
||||||
|
prof.cons_show("Presence notifications disabled")
|
||||||
|
return
|
||||||
|
|
||||||
|
if arg1 == "ignored":
|
||||||
|
if arg2 == "clear":
|
||||||
|
prof.settings_string_list_clear("presence_notify", "ignored")
|
||||||
|
prof.cons_show("Removed all ignored contacts for presence notifications")
|
||||||
|
return
|
||||||
|
|
||||||
|
if arg2 == "add":
|
||||||
|
if not arg3:
|
||||||
|
prof.cons_bad_cmd_usage("/presence_notify")
|
||||||
|
return
|
||||||
|
prof.settings_string_list_add("presence_notify", "ignored", arg3)
|
||||||
|
prof.cons_show("Added {contact} to ignored contacts for presence notifications".format(contact=arg3))
|
||||||
|
return
|
||||||
|
|
||||||
|
if arg2 == "remove":
|
||||||
|
if not arg3:
|
||||||
|
prof.cons_bad_cmd_usage("/presence_notify")
|
||||||
|
return
|
||||||
|
res = prof.settings_string_list_remove("presence_notify", "ignored", arg3)
|
||||||
|
if res:
|
||||||
|
prof.cons_show("Removed {contact} from ignored contacts for presence notifications".format(contact=arg3))
|
||||||
|
else:
|
||||||
|
prof.cons_show("{contact} not in ignore list for presence notiications".format(contact=arg3))
|
||||||
|
return
|
||||||
|
|
||||||
|
prof.cons_bad_cmd_usage("/presence_notify")
|
||||||
|
return
|
||||||
|
|
||||||
|
if arg1 == "resource":
|
||||||
|
if arg2 == "on":
|
||||||
|
prof.settings_boolean_set("presence_notify", "resource", True)
|
||||||
|
prof.cons_show("Showing resource in presence notifications")
|
||||||
|
return;
|
||||||
|
if arg2 == "off":
|
||||||
|
prof.settings_boolean_set("presence_notify", "resource", False)
|
||||||
|
prof.cons_show("Hiding resource in presence notifications")
|
||||||
|
return;
|
||||||
|
|
||||||
|
prof.cons_bad_cmd_usage("/presence_notify")
|
||||||
|
return
|
||||||
|
|
||||||
|
_show_settings()
|
||||||
|
|
||||||
|
|
||||||
|
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 bob@server.org"
|
||||||
|
]
|
||||||
|
|
||||||
|
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" ]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _do_notify(barejid, presence):
|
||||||
|
ignored = prof.settings_string_list_get("presence_notify", "ignored")
|
||||||
|
if ignored and barejid in ignored:
|
||||||
|
return False
|
||||||
|
|
||||||
|
mode = prof.settings_string_get("presence_notify", "mode", "all")
|
||||||
|
if mode == "all":
|
||||||
|
return True
|
||||||
|
elif mode == "online":
|
||||||
|
if barejid in online:
|
||||||
|
if presence == "offline":
|
||||||
|
online.remove(barejid)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
if presence != "offline":
|
||||||
|
online.add(barejid)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
else: # off
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def prof_on_contact_presence(barejid, resource, presence, status, priority):
|
||||||
|
if _do_notify(barejid, presence):
|
||||||
|
jid = barejid
|
||||||
|
if prof.settings_boolean_get("presence_notify", "resource", False):
|
||||||
|
jid = jid + "/" + resource
|
||||||
|
message = "{jid} is {presence}".format(jid=jid, presence=presence)
|
||||||
|
if status:
|
||||||
|
message = message + ", \"{status}\"".format(status=status)
|
||||||
|
prof.notify(message, 5000, "Presence")
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def prof_on_contact_offline(barejid, resource, status):
|
||||||
|
if _do_notify(barejid, "offline"):
|
||||||
|
jid = barejid
|
||||||
|
if prof.settings_boolean_get("presence_notify", "resource", False):
|
||||||
|
jid = jid + "/" + resource
|
||||||
|
message = "{jid} is offline".format(jid=jid)
|
||||||
|
if status:
|
||||||
|
message = message + ", \"{status}\"".format(status=status)
|
||||||
|
prof.notify(message, 5000, "Presence")
|
||||||
|
return
|
||||||
@@ -12,7 +12,7 @@ import os
|
|||||||
from sys import platform
|
from sys import platform
|
||||||
|
|
||||||
def say(message):
|
def say(message):
|
||||||
args = prof.settings_get_string("say", "args", "")
|
args = prof.settings_string_get("say", "args", "")
|
||||||
|
|
||||||
if platform == "darwin":
|
if platform == "darwin":
|
||||||
os.system("say " + args + " '" + message + "' 2>/dev/null")
|
os.system("say " + args + " '" + message + "' 2>/dev/null")
|
||||||
@@ -20,25 +20,27 @@ def say(message):
|
|||||||
os.system("echo '" + message + "' | espeak " + args + " 2>/dev/null")
|
os.system("echo '" + message + "' | espeak " + args + " 2>/dev/null")
|
||||||
|
|
||||||
|
|
||||||
def prof_post_chat_message_display(jid, message):
|
def prof_post_chat_message_display(barejid, resource, message):
|
||||||
enabled = prof.settings_get_string("say", "enabled", "off")
|
enabled = prof.settings_string_get("say", "enabled", "off")
|
||||||
current_recipient = prof.get_current_recipient()
|
current_recipient = prof.get_current_recipient()
|
||||||
if enabled == "on" or (enabled == "active" and current_recipient == jid):
|
if enabled == "on" or (enabled == "active" and current_recipient == barejid):
|
||||||
say(jid + " says " + message)
|
say(barejid + " says " + message)
|
||||||
|
|
||||||
return message
|
return message
|
||||||
|
|
||||||
|
|
||||||
def prof_post_room_message_display(room, nick, message):
|
def prof_post_room_message_display(barejid, nick, message):
|
||||||
enabled = prof.settings_get_string("say", "enabled", "off")
|
enabled = prof.settings_string_get("say", "enabled", "off")
|
||||||
current_muc = prof.get_current_muc()
|
current_muc = prof.get_current_muc()
|
||||||
if enabled == "on" or (enable == "active" and current_muc == jid):
|
if enabled == "on":
|
||||||
say(nick + " says " + message + " in " + room)
|
say(nick + " in " + barejid + " says " + message)
|
||||||
|
elif enabled == "active" and current_muc == barejid:
|
||||||
|
say(nick + " says " + message)
|
||||||
|
|
||||||
return message
|
return message
|
||||||
|
|
||||||
|
|
||||||
def prof_post_priv_message_display(room, nick, message):
|
def prof_post_priv_message_display(barejid, nick, message):
|
||||||
# TODO add get current nick hook for private chats
|
# TODO add get current nick hook for private chats
|
||||||
if enabled:
|
if enabled:
|
||||||
say(nick + " says " + message)
|
say(nick + " says " + message)
|
||||||
@@ -48,22 +50,22 @@ def prof_post_priv_message_display(room, nick, message):
|
|||||||
|
|
||||||
def _cmd_say(arg1=None, arg2=None):
|
def _cmd_say(arg1=None, arg2=None):
|
||||||
if arg1 == "on":
|
if arg1 == "on":
|
||||||
prof.settings_set_string("say", "enabled", "on")
|
prof.settings_string_set("say", "enabled", "on")
|
||||||
prof.cons_show("Say plugin enabled")
|
prof.cons_show("Say plugin enabled")
|
||||||
elif arg1 == "off":
|
elif arg1 == "off":
|
||||||
prof.settings_set_string("say", "enabled", "off")
|
prof.settings_string_set("say", "enabled", "off")
|
||||||
prof.cons_show("Say plugin disabled")
|
prof.cons_show("Say plugin disabled")
|
||||||
elif arg1 == "active":
|
elif arg1 == "active":
|
||||||
prof.settings_set_string("say", "enabled", "active")
|
prof.settings_string_set("say", "enabled", "active")
|
||||||
prof.cons_show("Say plugin enabled for active window only")
|
prof.cons_show("Say plugin enabled for active window only")
|
||||||
elif arg1 == "args":
|
elif arg1 == "args":
|
||||||
if arg2 == None:
|
if arg2 == None:
|
||||||
prof.cons_bad_cmd_usage("/say")
|
prof.cons_bad_cmd_usage("/say")
|
||||||
else:
|
else:
|
||||||
prof.settings_set_string("say", "args", arg2)
|
prof.settings_string_set("say", "args", arg2)
|
||||||
prof.cons_show("Say plugin arguments set to: " + arg2)
|
prof.cons_show("Say plugin arguments set to: " + arg2)
|
||||||
elif arg1 == "clearargs":
|
elif arg1 == "clearargs":
|
||||||
prof.settings_set_string("say", "args", "")
|
prof.settings_string_set("say", "args", "")
|
||||||
prof.cons_show("Say plugin arguments cleared")
|
prof.cons_show("Say plugin arguments cleared")
|
||||||
elif arg1 == "test":
|
elif arg1 == "test":
|
||||||
if arg2 == None:
|
if arg2 == None:
|
||||||
@@ -71,8 +73,8 @@ def _cmd_say(arg1=None, arg2=None):
|
|||||||
else:
|
else:
|
||||||
say(arg2)
|
say(arg2)
|
||||||
else:
|
else:
|
||||||
enabled = prof.settings_get_string("say", "enabled", "off")
|
enabled = prof.settings_string_get("say", "enabled", "off")
|
||||||
args = prof.settings_get_string("say", "args", "")
|
args = prof.settings_string_get("say", "args", "")
|
||||||
prof.cons_show("Say plugin settings:")
|
prof.cons_show("Say plugin settings:")
|
||||||
prof.cons_show("enabled : " + enabled)
|
prof.cons_show("enabled : " + enabled)
|
||||||
if args != "":
|
if args != "":
|
||||||
@@ -86,7 +88,7 @@ def prof_init(version, status, account_name, fulljid):
|
|||||||
"/say clearargs",
|
"/say clearargs",
|
||||||
"/say test <message>"
|
"/say test <message>"
|
||||||
]
|
]
|
||||||
description = "Read all messages out loud"
|
description = "Read messages out loud"
|
||||||
args = [
|
args = [
|
||||||
[ "on|off", "Enable/disable say for all windows" ],
|
[ "on|off", "Enable/disable say for all windows" ],
|
||||||
[ "active", "Enable say for active window only" ],
|
[ "active", "Enable say for active window only" ],
|
||||||
198
stable/sounds.py
Normal file
198
stable/sounds.py
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
"""
|
||||||
|
Play sounds on various events.
|
||||||
|
Requires mpg123 to be installed on the host system:
|
||||||
|
sudo apt-get install mpg123
|
||||||
|
brew install mpg123
|
||||||
|
"""
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
from os.path import expanduser
|
||||||
|
|
||||||
|
import prof
|
||||||
|
|
||||||
|
|
||||||
|
def _play_sound(soundfile):
|
||||||
|
if soundfile.startswith("~/"):
|
||||||
|
soundfilenew = soundfile.replace("~", expanduser("~"), 1)
|
||||||
|
else:
|
||||||
|
soundfilenew = soundfile
|
||||||
|
subprocess.Popen(["mpg123", "-q", soundfilenew])
|
||||||
|
|
||||||
|
|
||||||
|
def _cmd_sounds(arg1=None, arg2=None, arg3=None):
|
||||||
|
if not arg1:
|
||||||
|
prof.cons_show("")
|
||||||
|
enabled = prof.settings_boolean_get("sounds", "enabled", False)
|
||||||
|
chatsound = prof.settings_string_get("sounds", "chat", None)
|
||||||
|
roomsound = prof.settings_string_get("sounds", "room", None)
|
||||||
|
privatesound = prof.settings_string_get("sounds", "private", None)
|
||||||
|
roomlist = prof.settings_string_list_get("sounds", "rooms")
|
||||||
|
if chatsound or roomsound or privatesound:
|
||||||
|
if enabled:
|
||||||
|
prof.cons_show("Sounds: ON")
|
||||||
|
else:
|
||||||
|
prof.cons_show("Sounds: OFF")
|
||||||
|
if chatsound:
|
||||||
|
prof.cons_show(" Chat : " + chatsound)
|
||||||
|
if roomsound:
|
||||||
|
prof.cons_show(" Room : " + roomsound)
|
||||||
|
if roomlist and len(roomlist) > 0:
|
||||||
|
for room in roomlist:
|
||||||
|
prof.cons_show(" " + room)
|
||||||
|
else:
|
||||||
|
prof.cons_show(" All rooms")
|
||||||
|
if privatesound:
|
||||||
|
prof.cons_show(" Private : " + privatesound)
|
||||||
|
|
||||||
|
else:
|
||||||
|
prof.cons_show("No sounds set.")
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
if arg1 == "on":
|
||||||
|
prof.settings_boolean_set("sounds", "enabled", True)
|
||||||
|
prof.cons_show("Sounds enabled")
|
||||||
|
return
|
||||||
|
|
||||||
|
if arg1 == "off":
|
||||||
|
prof.settings_boolean_set("sounds", "enabled", False)
|
||||||
|
prof.cons_show("Sounds disabled")
|
||||||
|
return
|
||||||
|
|
||||||
|
if arg1 == "set":
|
||||||
|
if arg2 == "chat":
|
||||||
|
prof.settings_string_set("sounds", "chat", arg3)
|
||||||
|
prof.cons_show("Set chat sound: " + arg3)
|
||||||
|
elif arg2 == "room":
|
||||||
|
prof.settings_string_set("sounds", "room", arg3)
|
||||||
|
prof.cons_show("Set room sound: " + arg3)
|
||||||
|
elif arg2 == "private":
|
||||||
|
prof.settings_string_set("sounds", "private", arg3)
|
||||||
|
prof.cons_show("Set private sound: " + arg3)
|
||||||
|
else:
|
||||||
|
prof.cons_bad_cmd_usage("/sounds")
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
if arg1 == "clear":
|
||||||
|
if arg2 == "chat":
|
||||||
|
prof.settings_string_set("sounds", "chat", "")
|
||||||
|
prof.cons_show("Removed chat sound.")
|
||||||
|
elif arg2 == "room":
|
||||||
|
prof.settings_string_set("sounds", "room", "")
|
||||||
|
prof.cons_show("Removed room sound.")
|
||||||
|
elif arg2 == "private":
|
||||||
|
prof.settings_string_set("sounds", "private", "")
|
||||||
|
prof.cons_show("Removed private sound.")
|
||||||
|
else:
|
||||||
|
prof.cons_bad_cmd_usage("/sounds")
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
if arg1 == "rooms":
|
||||||
|
if arg2 == "add":
|
||||||
|
if not arg3:
|
||||||
|
prof.cons_bad_cmd_usage("/sounds")
|
||||||
|
else:
|
||||||
|
prof.settings_string_list_add("sounds", "rooms", arg3)
|
||||||
|
prof.cons_show("Sounds enabled for room: " + arg3)
|
||||||
|
elif arg2 == "remove":
|
||||||
|
if not arg3:
|
||||||
|
prof.cons_bad_cmd_usage("/sounds")
|
||||||
|
else:
|
||||||
|
prof.settings_string_list_remove("sounds", "rooms", arg3)
|
||||||
|
roomlist = prof.settings_string_list_get("sounds", "rooms")
|
||||||
|
if roomlist and len(roomlist) > 0:
|
||||||
|
prof.cons_show("Sounds disabled for room: " + arg3)
|
||||||
|
else:
|
||||||
|
prof.cons_show("Empty room list for sounds, playing in all rooms.")
|
||||||
|
elif arg2 == "clear":
|
||||||
|
prof.settings_string_list_clear("sounds", "rooms")
|
||||||
|
prof.cons_show("Cleared sounds room list, playing in all rooms.")
|
||||||
|
else:
|
||||||
|
prof.cons_bad_cmd_usage("/sounds")
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
prof.cons_bad_cmd_usage("/sounds")
|
||||||
|
|
||||||
|
|
||||||
|
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 myroom@conference.server.org",
|
||||||
|
"/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" ])
|
||||||
|
|
||||||
|
|
||||||
|
def prof_post_chat_message_display(barejid, resource, message):
|
||||||
|
enabled = prof.settings_boolean_get("sounds", "enabled", False)
|
||||||
|
if not enabled:
|
||||||
|
return
|
||||||
|
|
||||||
|
soundfile = prof.settings_string_get("sounds", "chat", None)
|
||||||
|
if not soundfile:
|
||||||
|
return
|
||||||
|
|
||||||
|
_play_sound(soundfile)
|
||||||
|
|
||||||
|
|
||||||
|
def prof_post_room_message_display(barejid, nick, message):
|
||||||
|
enabled = prof.settings_boolean_get("sounds", "enabled", False)
|
||||||
|
if not enabled:
|
||||||
|
return
|
||||||
|
|
||||||
|
soundfile = prof.settings_string_get("sounds", "room", None)
|
||||||
|
if not soundfile:
|
||||||
|
return
|
||||||
|
|
||||||
|
roomlist = prof.settings_string_list_get("sounds", "rooms")
|
||||||
|
if roomlist and (barejid not in roomlist):
|
||||||
|
return
|
||||||
|
|
||||||
|
_play_sound(soundfile)
|
||||||
|
|
||||||
|
|
||||||
|
def prof_post_priv_message_display(barejid, nick, message):
|
||||||
|
enabled = prof.settings_boolean_get("sounds", "enabled", False)
|
||||||
|
if not enabled:
|
||||||
|
return
|
||||||
|
|
||||||
|
soundfile = prof.settings_string_get("sounds", "private", None)
|
||||||
|
if soundfile:
|
||||||
|
_play_sound(soundfile)
|
||||||
|
|
||||||
129
stable/syscmd.py
Normal file
129
stable/syscmd.py
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
"""
|
||||||
|
Allow running system commands in a plugin window, or send result to recipient
|
||||||
|
|
||||||
|
Theme options in ~/.local/share/profanity/plugin_themes
|
||||||
|
|
||||||
|
[system]
|
||||||
|
command=magenta
|
||||||
|
result=green
|
||||||
|
"""
|
||||||
|
|
||||||
|
import prof
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
system_win = "System"
|
||||||
|
|
||||||
|
|
||||||
|
def _get_result(command):
|
||||||
|
return subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).stdout.read()
|
||||||
|
|
||||||
|
|
||||||
|
def _handle_win_input(win, command):
|
||||||
|
prof.win_show_themed(win, "system", "command", None, command)
|
||||||
|
prof.win_show(win, "")
|
||||||
|
result = _get_result(command)
|
||||||
|
split = result.splitlines()
|
||||||
|
for s in split:
|
||||||
|
prof.win_show_themed(win, "system", "result", None, s)
|
||||||
|
prof.win_show(win, "")
|
||||||
|
|
||||||
|
|
||||||
|
def create_win():
|
||||||
|
if prof.win_exists(system_win) == False:
|
||||||
|
prof.win_create(system_win, _handle_win_input)
|
||||||
|
|
||||||
|
|
||||||
|
def _handle_send(command=None):
|
||||||
|
if command == None:
|
||||||
|
prof.cons_bad_cmd_usage("/system")
|
||||||
|
return
|
||||||
|
|
||||||
|
room = prof.get_current_muc()
|
||||||
|
recipient = prof.get_current_recipient()
|
||||||
|
if room == None and recipient == None:
|
||||||
|
prof.cons_show("You must be in a chat or muc window to send a system command")
|
||||||
|
prof.cons_alert()
|
||||||
|
return
|
||||||
|
|
||||||
|
result = _get_result(command)
|
||||||
|
newline = prof.settings_boolean_get("system", "newline", True)
|
||||||
|
if len(result.splitlines()) > 1 and newline:
|
||||||
|
prof.send_line(u'\u000A' + result)
|
||||||
|
else:
|
||||||
|
prof.send_line(result)
|
||||||
|
|
||||||
|
|
||||||
|
def _handle_exec(command=None):
|
||||||
|
if command == None:
|
||||||
|
prof.cons_bad_cmd_usage("/system")
|
||||||
|
return;
|
||||||
|
|
||||||
|
create_win()
|
||||||
|
prof.win_focus(system_win)
|
||||||
|
_handle_win_input(system_win, command)
|
||||||
|
|
||||||
|
|
||||||
|
def _handle_newline(setting=None):
|
||||||
|
if not setting:
|
||||||
|
prof.cons_show("")
|
||||||
|
newline = prof.settings_boolean_get("system", "newline", True)
|
||||||
|
if newline:
|
||||||
|
prof.cons_show("syscmd.py newline: on")
|
||||||
|
else:
|
||||||
|
prof.cons_show("syscmd.py newline: off")
|
||||||
|
return
|
||||||
|
|
||||||
|
if setting == "on":
|
||||||
|
prof.settings_boolean_set("system", "newline", True)
|
||||||
|
prof.cons_show("syscmd.py newline enabled.")
|
||||||
|
return
|
||||||
|
|
||||||
|
if setting == "off":
|
||||||
|
prof.settings_boolean_set("system", "newline", False)
|
||||||
|
prof.cons_show("syscmd.py newline disabled.")
|
||||||
|
return
|
||||||
|
|
||||||
|
prof.cons_bad_cmd_usage("/paste")
|
||||||
|
|
||||||
|
|
||||||
|
def _cmd_system(arg1=None, arg2=None):
|
||||||
|
if not arg1:
|
||||||
|
create_win()
|
||||||
|
prof.win_focus(system_win)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if arg1 == "newline":
|
||||||
|
_handle_newline(arg2)
|
||||||
|
return
|
||||||
|
|
||||||
|
if arg1 == "send":
|
||||||
|
_handle_send(arg2)
|
||||||
|
return
|
||||||
|
|
||||||
|
if arg1 == "exec":
|
||||||
|
_handle_exec(arg2)
|
||||||
|
return
|
||||||
|
|
||||||
|
prof.cons_bad_cmd_usage("/system")
|
||||||
|
|
||||||
|
|
||||||
|
def prof_init(version, status, account_name, fulljid):
|
||||||
|
synopsis = [
|
||||||
|
"/system",
|
||||||
|
"/system newline on|off",
|
||||||
|
"/system exec <comman>",
|
||||||
|
"/system send <command>"
|
||||||
|
]
|
||||||
|
description = "Run a system command, calling with no arguments will open or focus the system window."
|
||||||
|
args = [
|
||||||
|
[ "newline on|off", "Send newline before multiline command output, defaults to on" ],
|
||||||
|
[ "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", "newline" ])
|
||||||
|
prof.completer_add("/system newline", [ "on", "off" ])
|
||||||
@@ -78,8 +78,8 @@ def _search(search_terms):
|
|||||||
if len(results) > 0:
|
if len(results) > 0:
|
||||||
prof.win_show_themed(win, "wikipedia", "search", None, "Search results for \"" + search_terms + "\":")
|
prof.win_show_themed(win, "wikipedia", "search", None, "Search results for \"" + search_terms + "\":")
|
||||||
for index, result in enumerate(results):
|
for index, result in enumerate(results):
|
||||||
page_ac.append(result.encode("utf-8"))
|
page_ac.append(result)
|
||||||
prof.win_show_themed(win, "wikipedia", "search.results", None, result.encode("utf-8"))
|
prof.win_show_themed(win, "wikipedia", "search.results", None, result)
|
||||||
_update_autocomplete()
|
_update_autocomplete()
|
||||||
else:
|
else:
|
||||||
prof.win_show_themed(win, "wikipedia", "search.noresults", None, "No search results found for \"" + search_terms + "\"")
|
prof.win_show_themed(win, "wikipedia", "search.noresults", None, "No search results found for \"" + search_terms + "\"")
|
||||||
@@ -98,14 +98,14 @@ def _summary(page_str):
|
|||||||
prof.win_focus(win)
|
prof.win_focus(win)
|
||||||
return
|
return
|
||||||
|
|
||||||
link_ac.append(page.url.encode("utf-8"))
|
link_ac.append(page.url)
|
||||||
prof.completer_add("/wikipedia open", link_ac)
|
prof.completer_add("/wikipedia open", link_ac)
|
||||||
|
|
||||||
prof.win_show_themed(win, "wikipedia", "summary.title", None, page.title.encode("utf-8"))
|
prof.win_show_themed(win, "wikipedia", "summary.title", None, page.title)
|
||||||
prof.win_show_themed(win, "wikipedia", "summary.url", None, page.url.encode("utf-8"))
|
prof.win_show_themed(win, "wikipedia", "summary.url", None, page.url)
|
||||||
|
|
||||||
summary = wikipedia.summary(page_str)
|
summary = wikipedia.summary(page_str)
|
||||||
prof.win_show_themed(win, "wikipedia", "summary.text", None, summary.encode("utf-8"))
|
prof.win_show_themed(win, "wikipedia", "summary.text", None, summary)
|
||||||
prof.win_show(win, "")
|
prof.win_show(win, "")
|
||||||
prof.win_focus(win)
|
prof.win_focus(win)
|
||||||
|
|
||||||
@@ -119,8 +119,8 @@ def _page(page_str):
|
|||||||
prof.win_focus(win)
|
prof.win_focus(win)
|
||||||
return
|
return
|
||||||
|
|
||||||
prof.win_show_themed(win, "wikipedia", "page.title", None, page.title.encode("utf-8"))
|
prof.win_show_themed(win, "wikipedia", "page.title", None, page.title)
|
||||||
prof.win_show_themed(win, "wikipedia", "page.text", None, page.content.encode("utf-8"))
|
prof.win_show_themed(win, "wikipedia", "page.text", None, page.content)
|
||||||
prof.win_show(win, "")
|
prof.win_show(win, "")
|
||||||
prof.win_focus(win)
|
prof.win_focus(win)
|
||||||
|
|
||||||
@@ -138,8 +138,8 @@ def _images(page_str):
|
|||||||
|
|
||||||
prof.win_show_themed(win, "wikipedia", "images", None, "Images for " + page_str)
|
prof.win_show_themed(win, "wikipedia", "images", None, "Images for " + page_str)
|
||||||
for image in page.images:
|
for image in page.images:
|
||||||
prof.win_show_themed(win, "wikipedia", "images.url", None, image.encode("utf-8"))
|
prof.win_show_themed(win, "wikipedia", "images.url", None, image)
|
||||||
link_ac.append(image.encode("utf-8"))
|
link_ac.append(image)
|
||||||
prof.completer_add("/wikipedia open", link_ac)
|
prof.completer_add("/wikipedia open", link_ac)
|
||||||
prof.win_show(win, "")
|
prof.win_show(win, "")
|
||||||
prof.win_focus(win)
|
prof.win_focus(win)
|
||||||
@@ -159,8 +159,8 @@ def _links(page_str):
|
|||||||
prof.win_show_themed(win, "wikipedia", "links", None, "Links for " + page_str)
|
prof.win_show_themed(win, "wikipedia", "links", None, "Links for " + page_str)
|
||||||
|
|
||||||
for link in page.links:
|
for link in page.links:
|
||||||
prof.win_show_themed(win, "wikipedia", "links.link", None, link.encode("utf-8"))
|
prof.win_show_themed(win, "wikipedia", "links.link", None, link)
|
||||||
page_ac.append(link.encode("utf-8"))
|
page_ac.append(link)
|
||||||
_update_autocomplete()
|
_update_autocomplete()
|
||||||
prof.win_show(win, "")
|
prof.win_show(win, "")
|
||||||
prof.win_focus(win)
|
prof.win_focus(win)
|
||||||
@@ -179,8 +179,8 @@ def _refs(page_str):
|
|||||||
|
|
||||||
prof.win_show_themed(win, "wikipedia", "refs", None, "References for " + page_str)
|
prof.win_show_themed(win, "wikipedia", "refs", None, "References for " + page_str)
|
||||||
for ref in page.references:
|
for ref in page.references:
|
||||||
prof.win_show_themed(win, "wikipedia", "refs.url", None, ref.encode("utf-8"))
|
prof.win_show_themed(win, "wikipedia", "refs.url", None, ref)
|
||||||
link_ac.append(ref.encode("utf-8"))
|
link_ac.append(ref)
|
||||||
prof.completer_add("/wikipedia open", link_ac)
|
prof.completer_add("/wikipedia open", link_ac)
|
||||||
prof.win_show(win, "")
|
prof.win_show(win, "")
|
||||||
prof.win_focus(win)
|
prof.win_focus(win)
|
||||||
79
syscmd.py
79
syscmd.py
@@ -1,79 +0,0 @@
|
|||||||
"""
|
|
||||||
Allow running system commands in a plugin window, or send result to recipient
|
|
||||||
|
|
||||||
Theme options in ~/.local/share/profanity/plugin_themes
|
|
||||||
|
|
||||||
[system]
|
|
||||||
command=magenta
|
|
||||||
result=green
|
|
||||||
"""
|
|
||||||
|
|
||||||
import prof
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
system_win = "System"
|
|
||||||
|
|
||||||
|
|
||||||
def _get_result(command):
|
|
||||||
return subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).stdout.read()
|
|
||||||
|
|
||||||
|
|
||||||
def _handle_win_input(win, command):
|
|
||||||
prof.win_show_themed(win, "system", "command", None, command)
|
|
||||||
prof.win_show(win, "")
|
|
||||||
result = _get_result(command)
|
|
||||||
split = result.splitlines()
|
|
||||||
for s in split:
|
|
||||||
prof.win_show_themed(win, "system", "result", None, s)
|
|
||||||
prof.win_show(win, "")
|
|
||||||
|
|
||||||
|
|
||||||
def create_win():
|
|
||||||
if prof.win_exists(system_win) == False:
|
|
||||||
prof.win_create(system_win, _handle_win_input)
|
|
||||||
|
|
||||||
|
|
||||||
def _cmd_system(arg1=None, arg2=None):
|
|
||||||
if not arg1:
|
|
||||||
create_win()
|
|
||||||
prof.win_focus(system_win)
|
|
||||||
elif arg1 == "send":
|
|
||||||
if arg2 == None:
|
|
||||||
prof.cons_bad_cmd_usage("/system")
|
|
||||||
else:
|
|
||||||
room = prof.get_current_muc()
|
|
||||||
recipient = prof.get_current_recipient()
|
|
||||||
if room == None and recipient == None:
|
|
||||||
prof.cons_show("You must be in a chat or muc window to send a system command")
|
|
||||||
prof.cons_alert()
|
|
||||||
else:
|
|
||||||
result = _get_result(arg2)
|
|
||||||
prof.send_line(u'\u000A' + result)
|
|
||||||
elif arg1 == "exec":
|
|
||||||
if arg2 == None:
|
|
||||||
prof.cons_bad_cmd_usage("/system")
|
|
||||||
else:
|
|
||||||
create_win()
|
|
||||||
prof.win_focus(system_win)
|
|
||||||
_handle_win_input(system_win, arg2)
|
|
||||||
else:
|
|
||||||
prof.cons_bad_cmd_usage("/system")
|
|
||||||
|
|
||||||
|
|
||||||
def 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" ])
|
|
||||||
@@ -7,42 +7,46 @@ plugin_win = "Python Test"
|
|||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
ping_id = 1
|
ping_id = 1
|
||||||
|
count_thread = None
|
||||||
|
thread_stop = None
|
||||||
|
|
||||||
def _inc_counter():
|
def _inc_counter():
|
||||||
global count
|
global count
|
||||||
while True:
|
global thread_stop
|
||||||
|
|
||||||
|
while not thread_stop.is_set():
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
count = count + 1
|
count = count + 1
|
||||||
|
|
||||||
|
|
||||||
def _handle_win_input(win, line):
|
def _handle_win_input(win, line):
|
||||||
prof.win_show(win, "Input received: " + line)
|
prof.win_show(win, "Input received: " + line)
|
||||||
|
|
||||||
def _create_win():
|
|
||||||
if prof.win_exists(plugin_win) == False:
|
|
||||||
prof.win_create(plugin_win, _handle_win_input)
|
|
||||||
|
|
||||||
def _consalert():
|
def _consalert():
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.cons_alert()
|
prof.cons_alert()
|
||||||
prof.win_show(plugin_win, "called -> prof.cons_alert")
|
prof.win_show(plugin_win, "called -> prof.cons_alert")
|
||||||
|
|
||||||
|
|
||||||
def _consshow(msg):
|
def _consshow(msg):
|
||||||
if not msg:
|
if not msg:
|
||||||
prof.cons_bad_cmd_usage("/python-test")
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
return
|
return
|
||||||
|
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.cons_show(msg)
|
prof.cons_show(msg)
|
||||||
prof.win_show(plugin_win, "called -> prof.cons_show: " + msg)
|
prof.win_show(plugin_win, "called -> prof.cons_show: " + msg)
|
||||||
|
|
||||||
|
|
||||||
def _consshow_t(group, key, dflt, msg):
|
def _consshow_t(group, key, dflt, msg):
|
||||||
if not group or not key or not dflt or not msg:
|
if not group or not key or not dflt or not msg:
|
||||||
prof.cons_bad_cmd_usage("/python-test")
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
return
|
return
|
||||||
|
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
groupval = None if group == "none" else group
|
groupval = None if group == "none" else group
|
||||||
keyval = None if key == "none" else key
|
keyval = None if key == "none" else key
|
||||||
@@ -50,31 +54,34 @@ def _consshow_t(group, key, dflt, msg):
|
|||||||
prof.cons_show_themed(groupval, keyval, dfltval, msg)
|
prof.cons_show_themed(groupval, keyval, dfltval, msg)
|
||||||
prof.win_show(plugin_win, "called -> prof.cons_show_themed: " + group + ", " + key + ", " + dflt + ", " + msg)
|
prof.win_show(plugin_win, "called -> prof.cons_show_themed: " + group + ", " + key + ", " + dflt + ", " + msg)
|
||||||
|
|
||||||
|
|
||||||
def _constest():
|
def _constest():
|
||||||
res = prof.current_win_is_console()
|
res = prof.current_win_is_console()
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
if res:
|
if res:
|
||||||
prof.win_show(plugin_win, "called -> prof.current_win_is_console: true")
|
prof.win_show(plugin_win, "called -> prof.current_win_is_console: true")
|
||||||
else:
|
else:
|
||||||
prof.win_show(plugin_win, "called -> prof.current_win_is_console: false")
|
prof.win_show(plugin_win, "called -> prof.current_win_is_console: false")
|
||||||
|
|
||||||
|
|
||||||
def _winshow(msg):
|
def _winshow(msg):
|
||||||
if not msg:
|
if not msg:
|
||||||
prof.cons_bad_cmd_usage("/python-test")
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
return
|
return
|
||||||
|
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.win_show(plugin_win, msg)
|
prof.win_show(plugin_win, msg)
|
||||||
prof.win_show(plugin_win, "called -> prof.win_show: " + msg)
|
prof.win_show(plugin_win, "called -> prof.win_show: " + msg)
|
||||||
|
|
||||||
|
|
||||||
def _winshow_t(group, key, dflt, msg):
|
def _winshow_t(group, key, dflt, msg):
|
||||||
if not group or not key or not dflt or not msg:
|
if not group or not key or not dflt or not msg:
|
||||||
prof.cons_bad_cmd_usage("/python-test")
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
return
|
return
|
||||||
|
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
groupval = None if group == "none" else group
|
groupval = None if group == "none" else group
|
||||||
keyval = None if key == "none" else key
|
keyval = None if key == "none" else key
|
||||||
@@ -82,29 +89,32 @@ def _winshow_t(group, key, dflt, msg):
|
|||||||
prof.win_show_themed(plugin_win, groupval, keyval, dfltval, msg)
|
prof.win_show_themed(plugin_win, groupval, keyval, dfltval, msg)
|
||||||
prof.win_show(plugin_win, "called -> prof_win_show_themed: " + group + ", " + key + ", " + dflt + ", " + msg)
|
prof.win_show(plugin_win, "called -> prof_win_show_themed: " + group + ", " + key + ", " + dflt + ", " + msg)
|
||||||
|
|
||||||
|
|
||||||
def _sendline(line):
|
def _sendline(line):
|
||||||
if not line:
|
if not line:
|
||||||
prof.cons_bad_cmd_usage("/python-test")
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
return
|
return
|
||||||
|
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.send_line(line)
|
prof.send_line(line)
|
||||||
prof.win_show(plugin_win, "called -> prof.send_line: " + line)
|
prof.win_show(plugin_win, "called -> prof.send_line: " + line)
|
||||||
|
|
||||||
|
|
||||||
def _notify(msg):
|
def _notify(msg):
|
||||||
if not msg:
|
if not msg:
|
||||||
prof.cons_bad_cmd_usage("/python-test")
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
return
|
return
|
||||||
|
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.notify(msg, 5000, "python-test plugin")
|
prof.notify(msg, 5000, "python-test plugin")
|
||||||
prof.win_show(plugin_win, "called -> prof.notify: " + msg)
|
prof.win_show(plugin_win, "called -> prof.notify: " + msg)
|
||||||
|
|
||||||
|
|
||||||
def _get(subject):
|
def _get(subject):
|
||||||
if subject == "recipient":
|
if subject == "recipient":
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
recipient = prof.get_current_recipient();
|
recipient = prof.get_current_recipient();
|
||||||
if recipient:
|
if recipient:
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
@@ -113,7 +123,7 @@ def _get(subject):
|
|||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.win_show(plugin_win, "called -> prof_get_current_recipient: <none>")
|
prof.win_show(plugin_win, "called -> prof_get_current_recipient: <none>")
|
||||||
elif subject == "room":
|
elif subject == "room":
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
room = prof.get_current_muc()
|
room = prof.get_current_muc()
|
||||||
if room:
|
if room:
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
@@ -122,7 +132,7 @@ def _get(subject):
|
|||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.win_show(plugin_win, "called -> prof_get_current_muc: <none>")
|
prof.win_show(plugin_win, "called -> prof_get_current_muc: <none>")
|
||||||
elif subject == "nick":
|
elif subject == "nick":
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
nick = prof.get_current_nick()
|
nick = prof.get_current_nick()
|
||||||
if nick:
|
if nick:
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
@@ -131,7 +141,7 @@ def _get(subject):
|
|||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.win_show(plugin_win, "called -> prof_get_current_nick: <none>")
|
prof.win_show(plugin_win, "called -> prof_get_current_nick: <none>")
|
||||||
elif subject == "occupants":
|
elif subject == "occupants":
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
occupants = prof.get_current_occupants()
|
occupants = prof.get_current_occupants()
|
||||||
if occupants:
|
if occupants:
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
@@ -144,39 +154,42 @@ def _get(subject):
|
|||||||
else:
|
else:
|
||||||
prof.cons_bad_cmd_usage("/python-test")
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
|
|
||||||
|
|
||||||
def _log(level, msg):
|
def _log(level, msg):
|
||||||
if not level or not msg:
|
if not level or not msg:
|
||||||
prof.cons_bad_cmd_usage("/python-test")
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
return
|
return
|
||||||
|
|
||||||
if level == "debug":
|
if level == "debug":
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.log_debug(msg)
|
prof.log_debug(msg)
|
||||||
prof.win_show(plugin_win, "called -> prof.log_debug: " + msg)
|
prof.win_show(plugin_win, "called -> prof.log_debug: " + msg)
|
||||||
elif level == "info":
|
elif level == "info":
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.log_info(msg)
|
prof.log_info(msg)
|
||||||
prof.win_show(plugin_win, "called -> prof.log_info: " + msg)
|
prof.win_show(plugin_win, "called -> prof.log_info: " + msg)
|
||||||
elif level == "warning":
|
elif level == "warning":
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.log_warning(msg)
|
prof.log_warning(msg)
|
||||||
prof.win_show(plugin_win, "called -> prof.log_warning: " + msg)
|
prof.win_show(plugin_win, "called -> prof.log_warning: " + msg)
|
||||||
elif level == "error":
|
elif level == "error":
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.log_error(msg)
|
prof.log_error(msg)
|
||||||
prof.win_show(plugin_win, "called -> prof.log_error: " + msg)
|
prof.win_show(plugin_win, "called -> prof.log_error: " + msg)
|
||||||
else:
|
else:
|
||||||
prof.cons_bad_cmd_usage("/python-test")
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
|
|
||||||
|
|
||||||
def _count():
|
def _count():
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.win_show(plugin_win, "Count: " + str(count))
|
prof.win_show(plugin_win, "Count: " + str(count))
|
||||||
|
|
||||||
|
|
||||||
def _ping(jid):
|
def _ping(jid):
|
||||||
global ping_id
|
global ping_id
|
||||||
|
|
||||||
@@ -184,7 +197,7 @@ def _ping(jid):
|
|||||||
prof.cons_bad_cmd_usage("/python-test")
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
return
|
return
|
||||||
|
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
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>")
|
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
|
ping_id = ping_id + 1
|
||||||
@@ -193,6 +206,7 @@ def _ping(jid):
|
|||||||
else:
|
else:
|
||||||
prof.win_show(plugin_win, "Error sending ping")
|
prof.win_show(plugin_win, "Error sending ping")
|
||||||
|
|
||||||
|
|
||||||
def _boolean(op, group, key, value_str):
|
def _boolean(op, group, key, value_str):
|
||||||
if op != "get" and op != "set":
|
if op != "get" and op != "set":
|
||||||
prof.cons_bad_cmd_usage("/python-test")
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
@@ -208,9 +222,9 @@ def _boolean(op, group, key, value_str):
|
|||||||
|
|
||||||
if op == "get":
|
if op == "get":
|
||||||
dflt = False
|
dflt = False
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
res = prof.settings_get_boolean(group, key, dflt)
|
res = prof.settings_boolean_get(group, key, dflt)
|
||||||
if res:
|
if res:
|
||||||
prof.win_show(plugin_win, "Boolean setting: TRUE")
|
prof.win_show(plugin_win, "Boolean setting: TRUE")
|
||||||
else:
|
else:
|
||||||
@@ -219,11 +233,12 @@ def _boolean(op, group, key, value_str):
|
|||||||
value = False
|
value = False
|
||||||
if value_str == "true":
|
if value_str == "true":
|
||||||
value = True
|
value = True
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.settings_set_boolean(group, key, value)
|
prof.settings_boolean_set(group, key, value)
|
||||||
prof.win_show(plugin_win, "Set [" + group + "] " + key + " to " + str(value))
|
prof.win_show(plugin_win, "Set [" + group + "] " + key + " to " + str(value))
|
||||||
|
|
||||||
|
|
||||||
def _string(op, group, key, value):
|
def _string(op, group, key, value):
|
||||||
if op != "get" and op != "set":
|
if op != "get" and op != "set":
|
||||||
prof.cons_bad_cmd_usage("/python-test")
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
@@ -238,19 +253,73 @@ def _string(op, group, key, value):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if op == "get":
|
if op == "get":
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
res = prof.settings_get_string(group, key, None)
|
res = prof.settings_string_get(group, key, None)
|
||||||
if res:
|
if res:
|
||||||
prof.win_show(plugin_win, "String setting: " + res)
|
prof.win_show(plugin_win, "String setting: " + res)
|
||||||
else:
|
else:
|
||||||
prof.win_show(plugin_win, "String setting: None")
|
prof.win_show(plugin_win, "String setting: None")
|
||||||
elif op == "set":
|
elif op == "set":
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.settings_set_string(group, key, value)
|
prof.settings_string_set(group, key, value)
|
||||||
prof.win_show(plugin_win, "Set [" + group + "] " + key + " to " + value)
|
prof.win_show(plugin_win, "Set [" + group + "] " + key + " to " + value)
|
||||||
|
|
||||||
|
|
||||||
|
def _string_list(op, group, key, value):
|
||||||
|
if op != "get" and op != "add" and op !="remove" and op != "remove_all":
|
||||||
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
|
return
|
||||||
|
|
||||||
|
if op == "get":
|
||||||
|
if group == None or key == None:
|
||||||
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
|
return
|
||||||
|
res = prof.settings_string_list_get(group, key)
|
||||||
|
prof.win_focus(plugin_win)
|
||||||
|
if res is None:
|
||||||
|
prof.win_show(plugin_win, "No list found")
|
||||||
|
return
|
||||||
|
prof.win_show(plugin_win, "String list:")
|
||||||
|
for el in res:
|
||||||
|
prof.win_show(plugin_win, " " + el)
|
||||||
|
return
|
||||||
|
|
||||||
|
if op == "add":
|
||||||
|
if group == None or key == None or value == None:
|
||||||
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
|
return
|
||||||
|
prof.settings_string_list_add(group, key, value)
|
||||||
|
prof.win_focus(plugin_win)
|
||||||
|
prof.win_show(plugin_win, "Added '" + value + "' to [" + group + "]" + " " + key)
|
||||||
|
return
|
||||||
|
|
||||||
|
if op == "remove":
|
||||||
|
if group == None or key == None or value == None:
|
||||||
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
|
return
|
||||||
|
res = prof.settings_string_list_remove(group, key, value)
|
||||||
|
prof.win_focus(plugin_win)
|
||||||
|
if res:
|
||||||
|
prof.win_show(plugin_win, "Removed '" + value + "' from [" + group + "]" + " " + key)
|
||||||
|
else:
|
||||||
|
prof.win_show(plugin_win, "Error removing string item from list")
|
||||||
|
return;
|
||||||
|
|
||||||
|
if op == "remove_all":
|
||||||
|
if group == None or key == None:
|
||||||
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
|
return
|
||||||
|
res = prof.settings_string_list_clear(group, key)
|
||||||
|
prof.win_focus(plugin_win)
|
||||||
|
if res:
|
||||||
|
prof.win_show(plugin_win, "Removed all items from [" + group + "]" + " " + key)
|
||||||
|
else:
|
||||||
|
prof.win_show(plugin_win, "Error removing list")
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def _int(op, group, key, value):
|
def _int(op, group, key, value):
|
||||||
if op != "get" and op != "set":
|
if op != "get" and op != "set":
|
||||||
prof.cons_bad_cmd_usage("/python-test")
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
@@ -261,16 +330,17 @@ def _int(op, group, key, value):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if op == "get":
|
if op == "get":
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
res = prof.settings_get_int(group, key, 0)
|
res = prof.settings_int_get(group, key, 0)
|
||||||
prof.win_show(plugin_win, "Integer setting: " + str(res))
|
prof.win_show(plugin_win, "Integer setting: " + str(res))
|
||||||
elif op == "set":
|
elif op == "set":
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.settings_set_int(group, key, int(value))
|
prof.settings_int_set(group, key, int(value))
|
||||||
prof.win_show(plugin_win, "Set [" + group + "] " + key + " to " + str(value))
|
prof.win_show(plugin_win, "Set [" + group + "] " + key + " to " + str(value))
|
||||||
|
|
||||||
|
|
||||||
def _incoming(barejid, resource, message):
|
def _incoming(barejid, resource, message):
|
||||||
if not barejid or not resource or not message:
|
if not barejid or not resource or not message:
|
||||||
prof.cons_bad_cmd_usage("/python-test")
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
@@ -278,19 +348,20 @@ def _incoming(barejid, resource, message):
|
|||||||
|
|
||||||
prof.incoming_message(barejid, resource, message)
|
prof.incoming_message(barejid, resource, message)
|
||||||
|
|
||||||
|
|
||||||
def _completer(op, item):
|
def _completer(op, item):
|
||||||
if not item:
|
if not item:
|
||||||
prof.cons_bad_cmd_usage("/python-test")
|
prof.cons_bad_cmd_usage("/python-test")
|
||||||
return
|
return
|
||||||
|
|
||||||
if op == "add":
|
if op == "add":
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.completer_add("/python-test", [item])
|
prof.completer_add("/python-test", [item])
|
||||||
prof.win_show(plugin_win, "Added \"" + item + "\" to /python-test completer")
|
prof.win_show(plugin_win, "Added \"" + item + "\" to /python-test completer")
|
||||||
prof.completer_add("/python-test completer remove", [item])
|
prof.completer_add("/python-test completer remove", [item])
|
||||||
elif op == "remove":
|
elif op == "remove":
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_focus(plugin_win)
|
prof.win_focus(plugin_win)
|
||||||
prof.completer_remove("/python-test", [item])
|
prof.completer_remove("/python-test", [item])
|
||||||
prof.win_show(plugin_win, "Removed \"" + item + "\" to /python-test completer")
|
prof.win_show(plugin_win, "Removed \"" + item + "\" to /python-test completer")
|
||||||
@@ -300,33 +371,44 @@ def _completer(op, item):
|
|||||||
|
|
||||||
|
|
||||||
def _cmd_pythontest(subcmd=None, arg1=None, arg2=None, arg3=None, arg4=None):
|
def _cmd_pythontest(subcmd=None, arg1=None, arg2=None, arg3=None, arg4=None):
|
||||||
if subcmd == "consalert": _consalert()
|
if subcmd == "consalert": _consalert()
|
||||||
elif subcmd == "consshow": _consshow(arg1)
|
elif subcmd == "consshow": _consshow(arg1)
|
||||||
elif subcmd == "consshow_t": _consshow_t(arg1, arg2, arg3, arg4)
|
elif subcmd == "consshow_t": _consshow_t(arg1, arg2, arg3, arg4)
|
||||||
elif subcmd == "constest": _constest()
|
elif subcmd == "constest": _constest()
|
||||||
elif subcmd == "winshow": _winshow(arg1)
|
elif subcmd == "winshow": _winshow(arg1)
|
||||||
elif subcmd == "winshow_t": _winshow_t(arg1, arg2, arg3, arg4)
|
elif subcmd == "winshow_t": _winshow_t(arg1, arg2, arg3, arg4)
|
||||||
elif subcmd == "sendline": _sendline(arg1)
|
elif subcmd == "sendline": _sendline(arg1)
|
||||||
elif subcmd == "notify": _notify(arg1)
|
elif subcmd == "notify": _notify(arg1)
|
||||||
elif subcmd == "get": _get(arg1)
|
elif subcmd == "get": _get(arg1)
|
||||||
elif subcmd == "log": _log(arg1, arg2)
|
elif subcmd == "log": _log(arg1, arg2)
|
||||||
elif subcmd == "count": _count()
|
elif subcmd == "count": _count()
|
||||||
elif subcmd == "ping": _ping(arg1)
|
elif subcmd == "ping": _ping(arg1)
|
||||||
elif subcmd == "boolean": _boolean(arg1, arg2, arg3, arg4)
|
elif subcmd == "boolean": _boolean(arg1, arg2, arg3, arg4)
|
||||||
elif subcmd == "string": _string(arg1, arg2, arg3, arg4)
|
elif subcmd == "string": _string(arg1, arg2, arg3, arg4)
|
||||||
elif subcmd == "int": _int(arg1, arg2, arg3, arg4)
|
elif subcmd == "string_list": _string_list(arg1, arg2, arg3, arg4)
|
||||||
elif subcmd == "incoming": _incoming(arg1, arg2, arg3)
|
elif subcmd == "int": _int(arg1, arg2, arg3, arg4)
|
||||||
elif subcmd == "completer": _completer(arg1, arg2)
|
elif subcmd == "incoming": _incoming(arg1, arg2, arg3)
|
||||||
else: prof.cons_bad_cmd_usage("/python-test")
|
elif subcmd == "completer": _completer(arg1, arg2)
|
||||||
|
else: prof.cons_bad_cmd_usage("/python-test")
|
||||||
|
|
||||||
|
|
||||||
def timed_callback():
|
def timed_callback():
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "timed -> timed_callback called")
|
prof.win_show(plugin_win, "timed -> timed_callback called")
|
||||||
|
|
||||||
|
|
||||||
def prof_init(version, status, account_name, fulljid):
|
def prof_init(version, status, account_name, fulljid):
|
||||||
t = threading.Thread(target=_inc_counter)
|
global count
|
||||||
t.daemon = True
|
global ping_id
|
||||||
t.start()
|
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.disco_add_feature("urn:xmpp:profanity:python_test_plugin");
|
||||||
|
|
||||||
@@ -353,6 +435,10 @@ def prof_init(version, status, account_name, fulljid):
|
|||||||
"/python-test boolean set <group> <key> <value>",
|
"/python-test boolean set <group> <key> <value>",
|
||||||
"/python-test string get <group> <key>",
|
"/python-test string get <group> <key>",
|
||||||
"/python-test string set <group> <key> <value>",
|
"/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 get <group> <key>",
|
||||||
"/python-test int set <group> <key> <value>",
|
"/python-test int set <group> <key> <value>",
|
||||||
"/python-test incoming <barejid> <resource> <message>",
|
"/python-test incoming <barejid> <resource> <message>",
|
||||||
@@ -379,6 +465,10 @@ def prof_init(version, status, account_name, fulljid):
|
|||||||
[ "boolean set <group> <key> <value>", "Set a boolean setting" ],
|
[ "boolean set <group> <key> <value>", "Set a boolean setting" ],
|
||||||
[ "string get <group> <key>", "Get a string setting" ],
|
[ "string get <group> <key>", "Get a string setting" ],
|
||||||
[ "string set <group> <key> <value>", "Set 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 get <group> <key>", "Get a integer setting" ],
|
||||||
[ "int set <group> <key> <value>", "Set a integer setting" ],
|
[ "int set <group> <key> <value>", "Set a integer setting" ],
|
||||||
[ "incoming <barejid> <resource> <message>", "Show an incoming message." ],
|
[ "incoming <barejid> <resource> <message>", "Show an incoming message." ],
|
||||||
@@ -411,6 +501,7 @@ def prof_init(version, status, account_name, fulljid):
|
|||||||
"ping",
|
"ping",
|
||||||
"boolean",
|
"boolean",
|
||||||
"string",
|
"string",
|
||||||
|
"string_list",
|
||||||
"int",
|
"int",
|
||||||
"incoming",
|
"incoming",
|
||||||
"completer"
|
"completer"
|
||||||
@@ -428,6 +519,9 @@ def prof_init(version, status, account_name, fulljid):
|
|||||||
prof.completer_add("/python-test string",
|
prof.completer_add("/python-test string",
|
||||||
[ "get", "set" ]
|
[ "get", "set" ]
|
||||||
)
|
)
|
||||||
|
prof.completer_add("/python-test string_list",
|
||||||
|
[ "get", "add", "remove", "remove_all" ]
|
||||||
|
)
|
||||||
prof.completer_add("/python-test int",
|
prof.completer_add("/python-test int",
|
||||||
[ "get", "set" ]
|
[ "get", "set" ]
|
||||||
)
|
)
|
||||||
@@ -435,124 +529,164 @@ def prof_init(version, status, account_name, fulljid):
|
|||||||
[ "add", "remove" ]
|
[ "add", "remove" ]
|
||||||
)
|
)
|
||||||
|
|
||||||
prof.register_timed(timed_callback, 30)
|
prof.register_timed(timed_callback, 5)
|
||||||
|
|
||||||
|
|
||||||
def prof_on_start():
|
def prof_on_start():
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_start")
|
prof.win_show(plugin_win, "fired -> prof_on_start")
|
||||||
|
|
||||||
|
|
||||||
def prof_on_shutdown():
|
def prof_on_shutdown():
|
||||||
_create_win()
|
global thread_stop
|
||||||
|
|
||||||
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_shutdown")
|
prof.win_show(plugin_win, "fired -> prof_on_shutdown")
|
||||||
|
thread_stop.set()
|
||||||
|
count_thread.join()
|
||||||
|
|
||||||
|
|
||||||
|
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 prof_on_connect(account_name, fulljid):
|
def prof_on_connect(account_name, fulljid):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_connect: " + account_name + ", " + fulljid)
|
prof.win_show(plugin_win, "fired -> prof_on_connect: " + account_name + ", " + fulljid)
|
||||||
|
|
||||||
|
|
||||||
def prof_on_disconnect(account_name, fulljid):
|
def prof_on_disconnect(account_name, fulljid):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_disconnect: " + account_name + ", " + fulljid)
|
prof.win_show(plugin_win, "fired -> prof_on_disconnect: " + account_name + ", " + fulljid)
|
||||||
|
|
||||||
def prof_pre_chat_message_display(jid, message):
|
|
||||||
_create_win()
|
|
||||||
prof.win_show(plugin_win, "fired -> prof_pre_chat_message_display: " + jid + ", " + message)
|
|
||||||
|
|
||||||
def prof_post_chat_message_display(jid, message):
|
def prof_pre_chat_message_display(barejid, resource, message):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_post_chat_message_display: " + jid + ", " + message)
|
prof.win_show(plugin_win, "fired -> prof_pre_chat_message_display: " + barejid + "/" + resource + ", " + message)
|
||||||
|
|
||||||
def prof_pre_chat_message_send(jid, message):
|
|
||||||
_create_win()
|
|
||||||
prof.win_show(plugin_win, "fired -> prof_pre_chat_message_send: " + jid + ", " + message)
|
|
||||||
|
|
||||||
def prof_post_chat_message_send(jid, message):
|
def prof_post_chat_message_display(barejid, resource, message):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_post_chat_message_send: " + jid + ", " + message)
|
prof.win_show(plugin_win, "fired -> prof_post_chat_message_display: " + barejid + "/" + resource + ", " + message)
|
||||||
|
|
||||||
def prof_pre_room_message_display(room, nick, message):
|
|
||||||
_create_win()
|
|
||||||
prof.win_show(plugin_win, "fired -> prof_pre_room_message_display: " + room + ", " + nick + ", " + message)
|
|
||||||
|
|
||||||
def prof_post_room_message_display(room, nick, message):
|
def prof_pre_chat_message_send(barejid, message):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_post_room_message_display: " + room + ", " + nick + ", " + message)
|
prof.win_show(plugin_win, "fired -> prof_pre_chat_message_send: " + barejid + ", " + message)
|
||||||
|
|
||||||
def prof_pre_room_message_send(room, message):
|
|
||||||
_create_win()
|
|
||||||
prof.win_show(plugin_win, "fired -> prof_pre_room_message_send: " + room + ", " + message)
|
|
||||||
|
|
||||||
def prof_post_room_message_send(room, message):
|
def prof_post_chat_message_send(barejid, message):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_post_room_message_send: " + room + ", " + message)
|
prof.win_show(plugin_win, "fired -> prof_post_chat_message_send: " + barejid + ", " + message)
|
||||||
|
|
||||||
def prof_on_room_history_message(room, nick, message, timestamp):
|
|
||||||
_create_win()
|
def prof_pre_room_message_display(barejid, nick, message):
|
||||||
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
|
prof.win_show(plugin_win, "fired -> prof_pre_room_message_display: " + barejid + ", " + nick + ", " + message)
|
||||||
|
|
||||||
|
|
||||||
|
def prof_post_room_message_display(barejid, nick, message):
|
||||||
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
|
prof.win_show(plugin_win, "fired -> prof_post_room_message_display: " + barejid + ", " + nick + ", " + message)
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
def prof_post_room_message_send(barejid, message):
|
||||||
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
|
prof.win_show(plugin_win, "fired -> prof_post_room_message_send: " + barejid + ", " + message)
|
||||||
|
|
||||||
|
|
||||||
|
def prof_on_room_history_message(barejid, nick, message, timestamp):
|
||||||
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
if timestamp:
|
if timestamp:
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_room_history_message: " + room + ", " + nick + ", " + message + ", " + timestamp)
|
prof.win_show(plugin_win, "fired -> prof_on_room_history_message: " + barejid + ", " + nick + ", " + message + ", " + timestamp)
|
||||||
else:
|
else:
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_room_history_message: " + room + ", " + nick + ", " + message)
|
prof.win_show(plugin_win, "fired -> prof_on_room_history_message: " + barejid + ", " + nick + ", " + message)
|
||||||
|
|
||||||
def prof_pre_priv_message_display(room, nick, message):
|
|
||||||
_create_win()
|
|
||||||
prof.win_show(plugin_win, "fired -> prof_pre_priv_message_display: " + room + ", " + nick + ", " + message)
|
|
||||||
|
|
||||||
def prof_post_priv_message_display(room, nick, message):
|
def prof_pre_priv_message_display(barejid, nick, message):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_post_priv_message_display: " + room + ", " + nick + ", " + message)
|
prof.win_show(plugin_win, "fired -> prof_pre_priv_message_display: " + barejid + ", " + nick + ", " + message)
|
||||||
|
|
||||||
def prof_pre_priv_message_send(room, nick, message):
|
|
||||||
_create_win()
|
|
||||||
prof.win_show(plugin_win, "fired -> prof_pre_priv_message_send: " + room + ", " + nick + ", " + message)
|
|
||||||
|
|
||||||
def prof_post_priv_message_send(room, nick, message):
|
def prof_post_priv_message_display(barejid, nick, message):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_post_priv_message_send: " + room + ", " + nick + ", " + message)
|
prof.win_show(plugin_win, "fired -> prof_post_priv_message_display: " + barejid + ", " + nick + ", " + message)
|
||||||
|
|
||||||
|
|
||||||
|
def prof_pre_priv_message_send(barejid, nick, message):
|
||||||
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
|
prof.win_show(plugin_win, "fired -> prof_pre_priv_message_send: " + barejid + ", " + nick + ", " + message)
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
def prof_on_message_stanza_send(stanza):
|
def prof_on_message_stanza_send(stanza):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_message_stanza_send: " + stanza)
|
prof.win_show(plugin_win, "fired -> prof_on_message_stanza_send: " + stanza)
|
||||||
|
|
||||||
|
|
||||||
def prof_on_message_stanza_receive(stanza):
|
def prof_on_message_stanza_receive(stanza):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_message_stanza_receive: " + stanza)
|
prof.win_show(plugin_win, "fired -> prof_on_message_stanza_receive: " + stanza)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def prof_on_presence_stanza_send(stanza):
|
def prof_on_presence_stanza_send(stanza):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_presence_stanza_send: " + stanza)
|
prof.win_show(plugin_win, "fired -> prof_on_presence_stanza_send: " + stanza)
|
||||||
|
|
||||||
|
|
||||||
def prof_on_presence_stanza_receive(stanza):
|
def prof_on_presence_stanza_receive(stanza):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_presence_stanza_receive: " + stanza)
|
prof.win_show(plugin_win, "fired -> prof_on_presence_stanza_receive: " + stanza)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def prof_on_iq_stanza_send(stanza):
|
def prof_on_iq_stanza_send(stanza):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_iq_stanza_send: " + stanza)
|
prof.win_show(plugin_win, "fired -> prof_on_iq_stanza_send: " + stanza)
|
||||||
|
|
||||||
|
|
||||||
def prof_on_iq_stanza_receive(stanza):
|
def prof_on_iq_stanza_receive(stanza):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_iq_stanza_receive: " + stanza)
|
prof.win_show(plugin_win, "fired -> prof_on_iq_stanza_receive: " + stanza)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def prof_on_contact_offline(barejid, resource, status):
|
def prof_on_contact_offline(barejid, resource, status):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
if status:
|
if status:
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_contact_offline: " + barejid + "/" + resource + " \"" + status + "\"")
|
prof.win_show(plugin_win, "fired -> prof_on_contact_offline: " + barejid + "/" + resource + " \"" + status + "\"")
|
||||||
else:
|
else:
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_contact_offline: " + barejid + "/" + resource)
|
prof.win_show(plugin_win, "fired -> prof_on_contact_offline: " + barejid + "/" + resource)
|
||||||
|
|
||||||
|
|
||||||
def prof_on_contact_presence(barejid, resource, presence, status, priority):
|
def prof_on_contact_presence(barejid, resource, presence, status, priority):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
if status:
|
if status:
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_contact_presence: " + barejid + "/" + resource + " " + presence + " " + str(priority) + " \"" + status + "\"")
|
prof.win_show(plugin_win, "fired -> prof_on_contact_presence: " + barejid + "/" + resource + " " + presence + " " + str(priority) + " \"" + status + "\"")
|
||||||
else:
|
else:
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_contact_presence: " + barejid + "/" + resource + " " + presence + " " + str(priority))
|
prof.win_show(plugin_win, "fired -> prof_on_contact_presence: " + barejid + "/" + resource + " " + presence + " " + str(priority))
|
||||||
|
|
||||||
|
|
||||||
def prof_on_chat_win_focus(barejid):
|
def prof_on_chat_win_focus(barejid):
|
||||||
_create_win()
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_chat_win_focus: " + barejid)
|
prof.win_show(plugin_win, "fired -> prof_on_chat_win_focus: " + barejid)
|
||||||
|
|
||||||
def prof_on_room_win_focus(roomjid):
|
|
||||||
_create_win()
|
def prof_on_room_win_focus(barejid):
|
||||||
prof.win_show(plugin_win, "fired -> prof_on_room_win_focus: " + roomjid)
|
prof.win_create(plugin_win, _handle_win_input)
|
||||||
|
prof.win_show(plugin_win, "fired -> prof_on_room_win_focus: " + barejid)
|
||||||
|
|||||||
@@ -31,18 +31,10 @@ handle_win_input(PROF_WIN_TAG win, char *line)
|
|||||||
prof_win_show(win, buf);
|
prof_win_show(win, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
create_win(void)
|
|
||||||
{
|
|
||||||
if (!prof_win_exists(plugin_win)) {
|
|
||||||
prof_win_create(plugin_win, handle_win_input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
consalert(void)
|
consalert(void)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
prof_cons_alert();
|
prof_cons_alert();
|
||||||
prof_win_show(plugin_win, "called -> prof_cons_alert");
|
prof_win_show(plugin_win, "called -> prof_cons_alert");
|
||||||
@@ -55,7 +47,7 @@ consshow(char *msg)
|
|||||||
prof_cons_bad_cmd_usage("/c-test");
|
prof_cons_bad_cmd_usage("/c-test");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
prof_cons_show(msg);
|
prof_cons_show(msg);
|
||||||
char *str = "called -> prof_cons_show: ";
|
char *str = "called -> prof_cons_show: ";
|
||||||
@@ -71,7 +63,7 @@ consshow_t(char *group, char *key, char *def, char *msg)
|
|||||||
prof_cons_bad_cmd_usage("/c-test");
|
prof_cons_bad_cmd_usage("/c-test");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
char *groupval = strcmp(group, "none") == 0 ? NULL : group;
|
char *groupval = strcmp(group, "none") == 0 ? NULL : group;
|
||||||
char *keyval = strcmp(key, "none") == 0 ? NULL : key;
|
char *keyval = strcmp(key, "none") == 0 ? NULL : key;
|
||||||
@@ -87,7 +79,7 @@ void
|
|||||||
constest(void)
|
constest(void)
|
||||||
{
|
{
|
||||||
int res = prof_current_win_is_console();
|
int res = prof_current_win_is_console();
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
if (res) {
|
if (res) {
|
||||||
prof_win_show(plugin_win, "called -> prof_current_win_is_console: true");
|
prof_win_show(plugin_win, "called -> prof_current_win_is_console: true");
|
||||||
@@ -103,7 +95,7 @@ winshow(char *msg)
|
|||||||
prof_cons_bad_cmd_usage("/c-test");
|
prof_cons_bad_cmd_usage("/c-test");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
prof_win_show(plugin_win, msg);
|
prof_win_show(plugin_win, msg);
|
||||||
char *str = "called -> prof_win_show: ";
|
char *str = "called -> prof_win_show: ";
|
||||||
@@ -119,7 +111,7 @@ winshow_t(char *group, char *key, char *def, char *msg)
|
|||||||
prof_cons_bad_cmd_usage("/c-test");
|
prof_cons_bad_cmd_usage("/c-test");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
char *groupval = strcmp(group, "none") == 0 ? NULL : group;
|
char *groupval = strcmp(group, "none") == 0 ? NULL : group;
|
||||||
char *keyval = strcmp(key, "none") == 0 ? NULL : key;
|
char *keyval = strcmp(key, "none") == 0 ? NULL : key;
|
||||||
@@ -138,7 +130,7 @@ sendline(char *line)
|
|||||||
prof_cons_bad_cmd_usage("/c-test");
|
prof_cons_bad_cmd_usage("/c-test");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
prof_send_line(line);
|
prof_send_line(line);
|
||||||
char *str = "called -> prof_send_line: ";
|
char *str = "called -> prof_send_line: ";
|
||||||
@@ -154,7 +146,7 @@ donotify(char *msg)
|
|||||||
prof_cons_bad_cmd_usage("/c-test");
|
prof_cons_bad_cmd_usage("/c-test");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
prof_notify(msg, 5000, "c-test plugin");
|
prof_notify(msg, 5000, "c-test plugin");
|
||||||
char *str = "called -> prof_notify: ";
|
char *str = "called -> prof_notify: ";
|
||||||
@@ -172,7 +164,7 @@ getsubject(char *subject)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(subject, "recipient") == 0) {
|
if (strcmp(subject, "recipient") == 0) {
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
char *recipient = prof_get_current_recipient();
|
char *recipient = prof_get_current_recipient();
|
||||||
if (recipient) {
|
if (recipient) {
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
@@ -185,7 +177,7 @@ getsubject(char *subject)
|
|||||||
prof_win_show(plugin_win, "called -> prof_get_current_recipient: <none>");
|
prof_win_show(plugin_win, "called -> prof_get_current_recipient: <none>");
|
||||||
}
|
}
|
||||||
} else if (strcmp(subject, "room") == 0) {
|
} else if (strcmp(subject, "room") == 0) {
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
char *room = prof_get_current_muc();
|
char *room = prof_get_current_muc();
|
||||||
if (room) {
|
if (room) {
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
@@ -198,7 +190,7 @@ getsubject(char *subject)
|
|||||||
prof_win_show(plugin_win, "called -> prof_get_current_muc: <none>");
|
prof_win_show(plugin_win, "called -> prof_get_current_muc: <none>");
|
||||||
}
|
}
|
||||||
} else if (strcmp(subject, "nick") == 0) {
|
} else if (strcmp(subject, "nick") == 0) {
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
char *nick = prof_get_current_nick();
|
char *nick = prof_get_current_nick();
|
||||||
if (nick) {
|
if (nick) {
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
@@ -211,7 +203,7 @@ getsubject(char *subject)
|
|||||||
prof_win_show(plugin_win, "called -> prof_get_current_nick: <none>");
|
prof_win_show(plugin_win, "called -> prof_get_current_nick: <none>");
|
||||||
}
|
}
|
||||||
} else if (strcmp(subject, "occupants") == 0) {
|
} else if (strcmp(subject, "occupants") == 0) {
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
char **occupants = prof_get_current_occupants();
|
char **occupants = prof_get_current_occupants();
|
||||||
if (occupants) {
|
if (occupants) {
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
@@ -239,7 +231,7 @@ logmsg(char *level, char *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(level, "debug") == 0) {
|
if (strcmp(level, "debug") == 0) {
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
prof_log_debug(msg);
|
prof_log_debug(msg);
|
||||||
char *str = "called -> prof_log_debug: ";
|
char *str = "called -> prof_log_debug: ";
|
||||||
@@ -247,7 +239,7 @@ logmsg(char *level, char *msg)
|
|||||||
sprintf(buf, "%s%s", str, msg);
|
sprintf(buf, "%s%s", str, msg);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
} else if (strcmp(level, "info") == 0) {
|
} else if (strcmp(level, "info") == 0) {
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
prof_log_info(msg);
|
prof_log_info(msg);
|
||||||
char *str = "called -> prof_log_info: ";
|
char *str = "called -> prof_log_info: ";
|
||||||
@@ -255,7 +247,7 @@ logmsg(char *level, char *msg)
|
|||||||
sprintf(buf, "%s%s", str, msg);
|
sprintf(buf, "%s%s", str, msg);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
} else if (strcmp(level, "warning") == 0) {
|
} else if (strcmp(level, "warning") == 0) {
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
prof_log_warning(msg);
|
prof_log_warning(msg);
|
||||||
char *str = "called -> prof_log_warning: ";
|
char *str = "called -> prof_log_warning: ";
|
||||||
@@ -263,7 +255,7 @@ logmsg(char *level, char *msg)
|
|||||||
sprintf(buf, "%s%s", str, msg);
|
sprintf(buf, "%s%s", str, msg);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
} else if (strcmp(level, "error") == 0) {
|
} else if (strcmp(level, "error") == 0) {
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
prof_log_error(msg);
|
prof_log_error(msg);
|
||||||
char *str = "called -> prof_log_error: ";
|
char *str = "called -> prof_log_error: ";
|
||||||
@@ -278,7 +270,7 @@ logmsg(char *level, char *msg)
|
|||||||
void
|
void
|
||||||
docount(void)
|
docount(void)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
char buf[100];
|
char buf[100];
|
||||||
sprintf(buf, "Count: %d", count);
|
sprintf(buf, "Count: %d", count);
|
||||||
@@ -292,7 +284,7 @@ doping(char *jid)
|
|||||||
prof_cons_bad_cmd_usage("/c-test");
|
prof_cons_bad_cmd_usage("/c-test");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
char *strstart = "<iq to='";
|
char *strstart = "<iq to='";
|
||||||
char *strend = "' type='get'><ping xmlns='urn:xmpp:ping'/></iq>";
|
char *strend = "' type='get'><ping xmlns='urn:xmpp:ping'/></iq>";
|
||||||
@@ -330,9 +322,9 @@ booleansetting(char *op, char *group, char *key, char *value_str)
|
|||||||
|
|
||||||
if (strcmp(op, "get") == 0) {
|
if (strcmp(op, "get") == 0) {
|
||||||
int dflt = 0;
|
int dflt = 0;
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
int res = prof_settings_get_boolean(group, key, dflt);
|
int res = prof_settings_boolean_get(group, key, dflt);
|
||||||
if (res) {
|
if (res) {
|
||||||
prof_win_show(plugin_win, "Boolean setting: TRUE");
|
prof_win_show(plugin_win, "Boolean setting: TRUE");
|
||||||
} else {
|
} else {
|
||||||
@@ -343,9 +335,9 @@ booleansetting(char *op, char *group, char *key, char *value_str)
|
|||||||
if (strcmp(value_str, "true") == 0) {
|
if (strcmp(value_str, "true") == 0) {
|
||||||
value = 1;
|
value = 1;
|
||||||
}
|
}
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
prof_settings_set_boolean(group, key, value);
|
prof_settings_boolean_set(group, key, value);
|
||||||
char buf[5 + strlen(group) + 2 + strlen(key) + 4 + strlen(value_str)];
|
char buf[5 + strlen(group) + 2 + strlen(key) + 4 + strlen(value_str)];
|
||||||
sprintf(buf, "Set [%s] %s to %s", group, key, value_str);
|
sprintf(buf, "Set [%s] %s to %s", group, key, value_str);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
@@ -371,9 +363,9 @@ stringsetting(char *op, char *group, char *key, char *value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(op, "get") == 0) {
|
if (strcmp(op, "get") == 0) {
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
char *res = prof_settings_get_string(group, key, NULL);
|
char *res = prof_settings_string_get(group, key, NULL);
|
||||||
if (res) {
|
if (res) {
|
||||||
char buf[16 + strlen(res)];
|
char buf[16 + strlen(res)];
|
||||||
sprintf(buf, "String setting: %s", res);
|
sprintf(buf, "String setting: %s", res);
|
||||||
@@ -382,15 +374,96 @@ stringsetting(char *op, char *group, char *key, char *value)
|
|||||||
prof_win_show(plugin_win, "String setting: NULL");
|
prof_win_show(plugin_win, "String setting: NULL");
|
||||||
}
|
}
|
||||||
} else if (strcmp(op, "set") == 0) {
|
} else if (strcmp(op, "set") == 0) {
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
prof_settings_set_string(group, key, value);
|
prof_settings_string_set(group, key, value);
|
||||||
char buf[5 + strlen(group) + 2 + strlen(key) + 4 + strlen(value)];
|
char buf[5 + strlen(group) + 2 + strlen(key) + 4 + strlen(value)];
|
||||||
sprintf(buf, "Set [%s] %s to %s", group, key, value);
|
sprintf(buf, "Set [%s] %s to %s", group, key, value);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
stringlistsetting(char *op, char *group, char *key, char *value)
|
||||||
|
{
|
||||||
|
if ((strcmp(op, "get") != 0) && (strcmp(op, "add") != 0) && (strcmp(op, "remove") != 0) && (strcmp(op, "remove_all") != 0)) {
|
||||||
|
prof_cons_bad_cmd_usage("/c-test");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(op, "get") == 0) {
|
||||||
|
if (group == NULL || key == NULL) {
|
||||||
|
prof_cons_bad_cmd_usage("/c-test");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
char** res = prof_settings_string_list_get(group, key);
|
||||||
|
prof_win_focus(plugin_win);
|
||||||
|
if (res == NULL) {
|
||||||
|
prof_win_show(plugin_win, "No list found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
prof_win_show(plugin_win, "String list:");
|
||||||
|
int i = 0;
|
||||||
|
while (res[i] != NULL) {
|
||||||
|
char buf[2 + strlen(res[i]) + 1];
|
||||||
|
sprintf(buf, " %s", res[i]);
|
||||||
|
prof_win_show(plugin_win, buf);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(op, "add") == 0) {
|
||||||
|
if (group == NULL || key == NULL || value == NULL) {
|
||||||
|
prof_cons_bad_cmd_usage("/c-test");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
prof_settings_string_list_add(group, key, value);
|
||||||
|
prof_win_focus(plugin_win);
|
||||||
|
char buf[7 + strlen(value) + 6 + strlen(group) + 2 + strlen(key) + 1];
|
||||||
|
sprintf(buf, "Added '%s' to [%s] %s", value, group, key);
|
||||||
|
prof_win_show(plugin_win, buf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(op, "remove") == 0) {
|
||||||
|
if (group == NULL || key == NULL || value == NULL) {
|
||||||
|
prof_cons_bad_cmd_usage("/c-test");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int res = prof_settings_string_list_remove(group, key, value);
|
||||||
|
prof_win_focus(plugin_win);
|
||||||
|
if (res) {
|
||||||
|
char buf[9 + strlen(value) + 8 + strlen(group) + 2 + strlen(key) + 1];
|
||||||
|
sprintf(buf, "Removed '%s' from [%s] %s", value, group, key);
|
||||||
|
prof_win_show(plugin_win, buf);
|
||||||
|
} else {
|
||||||
|
prof_win_show(plugin_win, "Error removing string item from list");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(op, "remove_all") == 0) {
|
||||||
|
if (group == NULL || key == NULL) {
|
||||||
|
prof_cons_bad_cmd_usage("/c-test");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int res = prof_settings_string_list_clear(group, key);
|
||||||
|
prof_win_focus(plugin_win);
|
||||||
|
if (res) {
|
||||||
|
char buf[24 + strlen(group) + 2 + strlen(key) + 1];
|
||||||
|
sprintf(buf, "Removed all items from [%s] %s", group, key);
|
||||||
|
prof_win_show(plugin_win, buf);
|
||||||
|
} else {
|
||||||
|
prof_win_show(plugin_win, "Error removing list");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
intsetting(char *op, char *group, char *key, char *value)
|
intsetting(char *op, char *group, char *key, char *value)
|
||||||
{
|
{
|
||||||
@@ -405,17 +478,17 @@ intsetting(char *op, char *group, char *key, char *value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(op, "get") == 0) {
|
if (strcmp(op, "get") == 0) {
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
int res = prof_settings_get_int(group, key, 0);
|
int res = prof_settings_int_get(group, key, 0);
|
||||||
char buf[256];
|
char buf[256];
|
||||||
sprintf(buf, "Integer setting: %d", res);
|
sprintf(buf, "Integer setting: %d", res);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
} else if (strcmp(op, "set") == 0) {
|
} else if (strcmp(op, "set") == 0) {
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
int int_value = atoi(value);
|
int int_value = atoi(value);
|
||||||
prof_settings_set_int(group, key, int_value);
|
prof_settings_int_set(group, key, int_value);
|
||||||
char buf[256];
|
char buf[256];
|
||||||
sprintf(buf, "Set [%s] %s to %d", group, key, int_value);
|
sprintf(buf, "Set [%s] %s to %d", group, key, int_value);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
@@ -437,7 +510,7 @@ completer(char *op, char *item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(op, "add") == 0) {
|
if (strcmp(op, "add") == 0) {
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
char *ac[] = { item, NULL };
|
char *ac[] = { item, NULL };
|
||||||
prof_completer_add("/c-test", ac);
|
prof_completer_add("/c-test", ac);
|
||||||
@@ -446,7 +519,7 @@ completer(char *op, char *item)
|
|||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
prof_completer_add("/c-test completer remove", ac);
|
prof_completer_add("/c-test completer remove", ac);
|
||||||
} else if (strcmp(op, "remove") == 0) {
|
} else if (strcmp(op, "remove") == 0) {
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_focus(plugin_win);
|
prof_win_focus(plugin_win);
|
||||||
char *ac[] = { item, NULL };
|
char *ac[] = { item, NULL };
|
||||||
prof_completer_remove("/c-test", ac);
|
prof_completer_remove("/c-test", ac);
|
||||||
@@ -476,6 +549,7 @@ cmd_ctest(char **args)
|
|||||||
else if (strcmp(args[0], "ping") == 0) doping(args[1]);
|
else if (strcmp(args[0], "ping") == 0) doping(args[1]);
|
||||||
else if (strcmp(args[0], "boolean") == 0) booleansetting(args[1], args[2], args[3], args[4]);
|
else if (strcmp(args[0], "boolean") == 0) booleansetting(args[1], args[2], args[3], args[4]);
|
||||||
else if (strcmp(args[0], "string") == 0) stringsetting(args[1], args[2], args[3], args[4]);
|
else if (strcmp(args[0], "string") == 0) stringsetting(args[1], args[2], args[3], args[4]);
|
||||||
|
else if (strcmp(args[0], "string_list") == 0) stringlistsetting(args[1], args[2], args[3], args[4]);
|
||||||
else if (strcmp(args[0], "int") == 0) intsetting(args[1], args[2], args[3], args[4]);
|
else if (strcmp(args[0], "int") == 0) intsetting(args[1], args[2], args[3], args[4]);
|
||||||
else if (strcmp(args[0], "incoming") == 0) incomingmsg(args[1], args[2], args[3]);
|
else if (strcmp(args[0], "incoming") == 0) incomingmsg(args[1], args[2], args[3]);
|
||||||
else if (strcmp(args[0], "completer") == 0) completer(args[1], args[2]);
|
else if (strcmp(args[0], "completer") == 0) completer(args[1], args[2]);
|
||||||
@@ -485,7 +559,7 @@ cmd_ctest(char **args)
|
|||||||
void
|
void
|
||||||
timed_callback(void)
|
timed_callback(void)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_show(plugin_win, "timed -> timed_callback called");
|
prof_win_show(plugin_win, "timed -> timed_callback called");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,7 +580,7 @@ prof_init(const char * const version, const char * const status, const char *con
|
|||||||
}
|
}
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
|
|
||||||
const char *synopsis[] = {
|
char *synopsis[] = {
|
||||||
"/c-test consalert",
|
"/c-test consalert",
|
||||||
"/c-test consshow <message>",
|
"/c-test consshow <message>",
|
||||||
"/c-test consshow_t <group> <key> <default> <message>",
|
"/c-test consshow_t <group> <key> <default> <message>",
|
||||||
@@ -523,14 +597,18 @@ prof_init(const char * const version, const char * const status, const char *con
|
|||||||
"/c-test boolean set <group> <key> <value>",
|
"/c-test boolean set <group> <key> <value>",
|
||||||
"/c-test string get <group> <key>",
|
"/c-test string get <group> <key>",
|
||||||
"/c-test string set <group> <key> <value>",
|
"/c-test string set <group> <key> <value>",
|
||||||
|
"/c-test-test string_list get <group> <key>",
|
||||||
|
"/c-test string_list add <group> <key> <value>",
|
||||||
|
"/c-test string_list remove <group> <key> <value>",
|
||||||
|
"/c-test string_list remove_all <group> <key>",
|
||||||
"/c-test int get <group> <key>",
|
"/c-test int get <group> <key>",
|
||||||
"/c-test int set <group> <key> <value>",
|
"/c-test int set <group> <key> <value>",
|
||||||
"/c-test incoming <barejid> <resource> <message>",
|
"/c-test incoming <barejid> <resource> <message>",
|
||||||
"/c-test completer add|remove <item>",
|
"/c-test completer add|remove <item>",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
const char *description = "C test plugin. All commands focus the plugin window.";
|
char *description = "C test plugin. All commands focus the plugin window.";
|
||||||
const char *args[][2] = {
|
char *args[][2] = {
|
||||||
{ "consalert", "Highlight the console window in the status bar" },
|
{ "consalert", "Highlight the console window in the status bar" },
|
||||||
{ "consshow <message>", "Show the message in the console window" },
|
{ "consshow <message>", "Show the message in the console window" },
|
||||||
{ "consshow_t <group> <key> <default> <message>", "Show the themed message in the console window. " },
|
{ "consshow_t <group> <key> <default> <message>", "Show the themed message in the console window. " },
|
||||||
@@ -550,6 +628,10 @@ prof_init(const char * const version, const char * const status, const char *con
|
|||||||
{ "boolean set <group> <key> <value>", "Set a boolean setting" },
|
{ "boolean set <group> <key> <value>", "Set a boolean setting" },
|
||||||
{ "string get <group> <key>", "Get a string setting" },
|
{ "string get <group> <key>", "Get a string setting" },
|
||||||
{ "string set <group> <key> <value>", "Set 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 get <group> <key>", "Get a integer setting" },
|
||||||
{ "int set <group> <key> <value>", "Set a integer setting" },
|
{ "int set <group> <key> <value>", "Set a integer setting" },
|
||||||
{ "incoming <barejid> <resource> <message>", "Show an incoming message." },
|
{ "incoming <barejid> <resource> <message>", "Show an incoming message." },
|
||||||
@@ -558,7 +640,7 @@ prof_init(const char * const version, const char * const status, const char *con
|
|||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *examples[] = {
|
char *examples[] = {
|
||||||
"/c-test sendline /about",
|
"/c-test sendline /about",
|
||||||
"/c-test log debug \"Test debug message\"",
|
"/c-test log debug \"Test debug message\"",
|
||||||
"/c-test consshow_t c-test cons.show none \"This is themed\"",
|
"/c-test consshow_t c-test cons.show none \"This is themed\"",
|
||||||
@@ -584,6 +666,7 @@ prof_init(const char * const version, const char * const status, const char *con
|
|||||||
"ping",
|
"ping",
|
||||||
"boolean",
|
"boolean",
|
||||||
"string",
|
"string",
|
||||||
|
"string_list",
|
||||||
"int",
|
"int",
|
||||||
"incoming",
|
"incoming",
|
||||||
"completer",
|
"completer",
|
||||||
@@ -603,33 +686,45 @@ prof_init(const char * const version, const char * const status, const char *con
|
|||||||
char *string_ac[] = { "get", "set", NULL };
|
char *string_ac[] = { "get", "set", NULL };
|
||||||
prof_completer_add("/c-test string", string_ac);
|
prof_completer_add("/c-test string", string_ac);
|
||||||
|
|
||||||
|
char *stringlist_ac[] = { "get", "add", "remove", "remove_all", NULL };
|
||||||
|
prof_completer_add("/c-test string_list", stringlist_ac);
|
||||||
|
|
||||||
char *int_ac[] = { "get", "set", NULL };
|
char *int_ac[] = { "get", "set", NULL };
|
||||||
prof_completer_add("/c-test int", int_ac);
|
prof_completer_add("/c-test int", int_ac);
|
||||||
|
|
||||||
char *completer_ac[] = { "add", "remove", NULL };
|
char *completer_ac[] = { "add", "remove", NULL };
|
||||||
prof_completer_add("/c-test completer", completer_ac);
|
prof_completer_add("/c-test completer", completer_ac);
|
||||||
|
|
||||||
prof_register_timed(timed_callback, 30);
|
prof_register_timed(timed_callback, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_on_start(void)
|
prof_on_start(void)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_show(plugin_win, "fired -> prof_on_start");
|
prof_win_show(plugin_win, "fired -> prof_on_start");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_on_shutdown(void)
|
prof_on_shutdown(void)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
prof_win_show(plugin_win, "fired -> prof_on_shutdown");
|
prof_win_show(plugin_win, "fired -> prof_on_shutdown");
|
||||||
|
pthread_cancel(worker_thread);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
prof_on_unload(void)
|
||||||
|
{
|
||||||
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
prof_win_show(plugin_win, "fired -> prof_on_unload");
|
||||||
|
pthread_cancel(worker_thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_on_connect(const char * const account_name, const char * const fulljid)
|
prof_on_connect(const char * const account_name, const char * const fulljid)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_on_connect: ";
|
char *str = "fired -> prof_on_connect: ";
|
||||||
char buf[strlen(str) + strlen(account_name) + 2 + strlen(fulljid) + 1];
|
char buf[strlen(str) + strlen(account_name) + 2 + strlen(fulljid) + 1];
|
||||||
@@ -640,7 +735,7 @@ prof_on_connect(const char * const account_name, const char * const fulljid)
|
|||||||
void
|
void
|
||||||
prof_on_disconnect(const char * const account_name, const char * const fulljid)
|
prof_on_disconnect(const char * const account_name, const char * const fulljid)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_on_disconnect: ";
|
char *str = "fired -> prof_on_disconnect: ";
|
||||||
char buf[strlen(str) + strlen(account_name) + 2 + strlen(fulljid) + 1];
|
char buf[strlen(str) + strlen(account_name) + 2 + strlen(fulljid) + 1];
|
||||||
@@ -649,170 +744,170 @@ prof_on_disconnect(const char * const account_name, const char * const fulljid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char*
|
char*
|
||||||
prof_pre_chat_message_display(const char * const jid, const char *message)
|
prof_pre_chat_message_display(const char * const barejid, const char *const resource, const char *message)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_pre_chat_message_display: ";
|
char *str = "fired -> prof_pre_chat_message_display: ";
|
||||||
char buf[strlen(str) + strlen(jid) + 2 + strlen(message) + 1];
|
char buf[strlen(str) + strlen(barejid) + 1 + strlen(resource) + 2 + strlen(message) + 1];
|
||||||
sprintf(buf, "%s%s, %s", str, jid, message);
|
sprintf(buf, "%s%s/%s, %s", str, barejid, resource, message);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_post_chat_message_display(const char * const jid, const char *message)
|
prof_post_chat_message_display(const char * const barejid, const char *const resource, const char *message)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_post_chat_message_display: ";
|
char *str = "fired -> prof_post_chat_message_display: ";
|
||||||
char buf[strlen(str) + strlen(jid) + 2 + strlen(message) + 1];
|
char buf[strlen(str) + strlen(barejid) + 1 + strlen(resource) + 2 + strlen(message) + 1];
|
||||||
sprintf(buf, "%s%s, %s", str, jid, message);
|
sprintf(buf, "%s%s/%s, %s", str, barejid, resource, message);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
char*
|
char*
|
||||||
prof_pre_chat_message_send(const char * const jid, const char *message)
|
prof_pre_chat_message_send(const char * const barejid, const char *message)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_pre_chat_message_send: ";
|
char *str = "fired -> prof_pre_chat_message_send: ";
|
||||||
char buf[strlen(str) + strlen(jid) + 2 + strlen(message) + 1];
|
char buf[strlen(str) + strlen(barejid) + 2 + strlen(message) + 1];
|
||||||
sprintf(buf, "%s%s, %s", str, jid, message);
|
sprintf(buf, "%s%s, %s", str, barejid, message);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_post_chat_message_send(const char * const jid, const char *message)
|
prof_post_chat_message_send(const char * const barejid, const char *message)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_post_chat_message_send: ";
|
char *str = "fired -> prof_post_chat_message_send: ";
|
||||||
char buf[strlen(str) + strlen(jid) + 2 + strlen(message) + 1];
|
char buf[strlen(str) + strlen(barejid) + 2 + strlen(message) + 1];
|
||||||
sprintf(buf, "%s%s, %s", str, jid, message);
|
sprintf(buf, "%s%s, %s", str, barejid, message);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
char*
|
char*
|
||||||
prof_pre_room_message_display(const char * const room, const char * const nick, const char *message)
|
prof_pre_room_message_display(const char * const barejid, const char * const nick, const char *message)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_pre_room_message_display: ";
|
char *str = "fired -> prof_pre_room_message_display: ";
|
||||||
char buf[strlen(str) + strlen(room) + 2 + strlen(nick) + 2 + strlen(message) + 1];
|
char buf[strlen(str) + strlen(barejid) + 2 + strlen(nick) + 2 + strlen(message) + 1];
|
||||||
sprintf(buf, "%s%s, %s, %s", str, room, nick, message);
|
sprintf(buf, "%s%s, %s, %s", str, barejid, nick, message);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_post_room_message_display(const char * const room, const char * const nick, const char *message)
|
prof_post_room_message_display(const char * const barejid, const char * const nick, const char *message)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_post_room_message_display: ";
|
char *str = "fired -> prof_post_room_message_display: ";
|
||||||
char buf[strlen(str) + strlen(room) + 2 + strlen(nick) + 2 + strlen(message) + 1];
|
char buf[strlen(str) + strlen(barejid) + 2 + strlen(nick) + 2 + strlen(message) + 1];
|
||||||
sprintf(buf, "%s%s, %s, %s", str, room, nick, message);
|
sprintf(buf, "%s%s, %s, %s", str, barejid, nick, message);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
prof_pre_room_message_send(const char * const room, const char *message)
|
prof_pre_room_message_send(const char * const barejid, const char *message)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_pre_room_message_send: ";
|
char *str = "fired -> prof_pre_room_message_send: ";
|
||||||
char buf[strlen(str) + strlen(room) + 2 + strlen(message) + 1];
|
char buf[strlen(str) + strlen(barejid) + 2 + strlen(message) + 1];
|
||||||
sprintf(buf, "%s%s, %s", str, room, message);
|
sprintf(buf, "%s%s, %s", str, barejid, message);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_post_room_message_send(const char * const room, const char *message)
|
prof_post_room_message_send(const char * const barejid, const char *message)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_post_room_message_send: ";
|
char *str = "fired -> prof_post_room_message_send: ";
|
||||||
char buf[strlen(str) + strlen(room) + 2 + strlen(message) + 1];
|
char buf[strlen(str) + strlen(barejid) + 2 + strlen(message) + 1];
|
||||||
sprintf(buf, "%s%s, %s", str, room, message);
|
sprintf(buf, "%s%s, %s", str, barejid, message);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_on_room_history_message(const char * const room, const char *const nick, const char *const message, const char *const timestamp)
|
prof_on_room_history_message(const char * const barejid, const char *const nick, const char *const message, const char *const timestamp)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_on_room_history_message: ";
|
char *str = "fired -> prof_on_room_history_message: ";
|
||||||
if (timestamp == NULL) {
|
if (timestamp == NULL) {
|
||||||
char buf[strlen(str) + strlen(room) + 2 + strlen(nick) + 2 + strlen(message) + 1];
|
char buf[strlen(str) + strlen(barejid) + 2 + strlen(nick) + 2 + strlen(message) + 1];
|
||||||
sprintf(buf, "%s%s, %s, %s", str, room, nick, message);
|
sprintf(buf, "%s%s, %s, %s", str, barejid, nick, message);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
} else {
|
} else {
|
||||||
char buf[strlen(str) + strlen(room) + 2 + strlen(nick) + 2 + strlen(message) + 2 + strlen(timestamp) + 1];
|
char buf[strlen(str) + strlen(barejid) + 2 + strlen(nick) + 2 + strlen(message) + 2 + strlen(timestamp) + 1];
|
||||||
sprintf(buf, "%s%s, %s, %s, %s", str, room, nick, message, timestamp);
|
sprintf(buf, "%s%s, %s, %s, %s", str, barejid, nick, message, timestamp);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
prof_pre_priv_message_display(const char * const room, const char * const nick, const char *message)
|
prof_pre_priv_message_display(const char * const barejid, const char * const nick, const char *message)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_pre_priv_message_display: ";
|
char *str = "fired -> prof_pre_priv_message_display: ";
|
||||||
char buf[strlen(str) + strlen(room) + 2 + strlen(nick) + 2 + strlen(message) + 1];
|
char buf[strlen(str) + strlen(barejid) + 2 + strlen(nick) + 2 + strlen(message) + 1];
|
||||||
sprintf(buf, "%s%s, %s, %s", str, room, nick, message);
|
sprintf(buf, "%s%s, %s, %s", str, barejid, nick, message);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_post_priv_message_display(const char * const room, const char * const nick, const char *message)
|
prof_post_priv_message_display(const char * const barejid, const char * const nick, const char *message)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_post_priv_message_display: ";
|
char *str = "fired -> prof_post_priv_message_display: ";
|
||||||
char buf[strlen(str) + strlen(room) + 2 + strlen(nick) + 2 + strlen(message) + 1];
|
char buf[strlen(str) + strlen(barejid) + 2 + strlen(nick) + 2 + strlen(message) + 1];
|
||||||
sprintf(buf, "%s%s, %s, %s", str, room, nick, message);
|
sprintf(buf, "%s%s, %s, %s", str, barejid, nick, message);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
prof_pre_priv_message_send(const char * const room, const char * const nick, const char *message)
|
prof_pre_priv_message_send(const char * const barejid, const char * const nick, const char *message)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_pre_priv_message_send: ";
|
char *str = "fired -> prof_pre_priv_message_send: ";
|
||||||
char buf[strlen(str) + strlen(room) + 2 + strlen(nick) + 2 + strlen(message) + 1];
|
char buf[strlen(str) + strlen(barejid) + 2 + strlen(nick) + 2 + strlen(message) + 1];
|
||||||
sprintf(buf, "%s%s, %s, %s", str, room, nick, message);
|
sprintf(buf, "%s%s, %s, %s", str, barejid, nick, message);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_post_priv_message_send(const char * const room, const char * const nick, const char *message)
|
prof_post_priv_message_send(const char * const barejid, const char * const nick, const char *message)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_post_priv_message_send: ";
|
char *str = "fired -> prof_post_priv_message_send: ";
|
||||||
char buf[strlen(str) + strlen(room) + 2 + strlen(nick) + 2 + strlen(message) + 1];
|
char buf[strlen(str) + strlen(barejid) + 2 + strlen(nick) + 2 + strlen(message) + 1];
|
||||||
sprintf(buf, "%s%s, %s, %s", str, room, nick, message);
|
sprintf(buf, "%s%s, %s, %s", str, barejid, nick, message);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
char*
|
char*
|
||||||
prof_on_message_stanza_send(const char *const stanza)
|
prof_on_message_stanza_send(const char *const stanza)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_on_message_stanza_send: ";
|
char *str = "fired -> prof_on_message_stanza_send: ";
|
||||||
char buf[strlen(str) + strlen(stanza) + 1];
|
char buf[strlen(str) + strlen(stanza) + 1];
|
||||||
@@ -827,7 +922,7 @@ prof_on_message_stanza_send(const char *const stanza)
|
|||||||
int
|
int
|
||||||
prof_on_message_stanza_receive(const char *const stanza)
|
prof_on_message_stanza_receive(const char *const stanza)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_on_message_stanza_receive: ";
|
char *str = "fired -> prof_on_message_stanza_receive: ";
|
||||||
char buf[strlen(str) + strlen(stanza) + 1];
|
char buf[strlen(str) + strlen(stanza) + 1];
|
||||||
@@ -840,7 +935,7 @@ prof_on_message_stanza_receive(const char *const stanza)
|
|||||||
char*
|
char*
|
||||||
prof_on_presence_stanza_send(const char *const stanza)
|
prof_on_presence_stanza_send(const char *const stanza)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_on_presence_stanza_send: ";
|
char *str = "fired -> prof_on_presence_stanza_send: ";
|
||||||
char buf[strlen(str) + strlen(stanza) + 1];
|
char buf[strlen(str) + strlen(stanza) + 1];
|
||||||
@@ -853,7 +948,7 @@ prof_on_presence_stanza_send(const char *const stanza)
|
|||||||
int
|
int
|
||||||
prof_on_presence_stanza_receive(const char *const stanza)
|
prof_on_presence_stanza_receive(const char *const stanza)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_on_presence_stanza_receive: ";
|
char *str = "fired -> prof_on_presence_stanza_receive: ";
|
||||||
char buf[strlen(str) + strlen(stanza) + 1];
|
char buf[strlen(str) + strlen(stanza) + 1];
|
||||||
@@ -866,7 +961,7 @@ prof_on_presence_stanza_receive(const char *const stanza)
|
|||||||
char*
|
char*
|
||||||
prof_on_iq_stanza_send(const char *const stanza)
|
prof_on_iq_stanza_send(const char *const stanza)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_on_iq_stanza_send: ";
|
char *str = "fired -> prof_on_iq_stanza_send: ";
|
||||||
char buf[strlen(str) + strlen(stanza) + 1];
|
char buf[strlen(str) + strlen(stanza) + 1];
|
||||||
@@ -879,7 +974,7 @@ prof_on_iq_stanza_send(const char *const stanza)
|
|||||||
int
|
int
|
||||||
prof_on_iq_stanza_receive(const char *const stanza)
|
prof_on_iq_stanza_receive(const char *const stanza)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_on_iq_stanza_receive: ";
|
char *str = "fired -> prof_on_iq_stanza_receive: ";
|
||||||
char buf[strlen(str) + strlen(stanza) + 1];
|
char buf[strlen(str) + strlen(stanza) + 1];
|
||||||
@@ -892,7 +987,7 @@ prof_on_iq_stanza_receive(const char *const stanza)
|
|||||||
void
|
void
|
||||||
prof_on_contact_offline(const char *const barejid, const char *const resource, const char *const status)
|
prof_on_contact_offline(const char *const barejid, const char *const resource, const char *const status)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_on_contact_offline: ";
|
char *str = "fired -> prof_on_contact_offline: ";
|
||||||
int status_len = status == NULL ? 0 : strlen(status) + 2;
|
int status_len = status == NULL ? 0 : strlen(status) + 2;
|
||||||
@@ -908,7 +1003,7 @@ prof_on_contact_offline(const char *const barejid, const char *const resource, c
|
|||||||
void
|
void
|
||||||
prof_on_contact_presence(const char *const barejid, const char *const resource, const char *const presence, const char *const status, const int priority)
|
prof_on_contact_presence(const char *const barejid, const char *const resource, const char *const presence, const char *const status, const int priority)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
|
|
||||||
char *str = "fired -> prof_on_contact_presence: ";
|
char *str = "fired -> prof_on_contact_presence: ";
|
||||||
int status_len = status == NULL ? 0 : strlen(status) + 2;
|
int status_len = status == NULL ? 0 : strlen(status) + 2;
|
||||||
@@ -924,7 +1019,7 @@ prof_on_contact_presence(const char *const barejid, const char *const resource,
|
|||||||
void
|
void
|
||||||
prof_on_chat_win_focus(const char *const barejid)
|
prof_on_chat_win_focus(const char *const barejid)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
char *str = "fired -> prof_on_chat_win_focus: ";
|
char *str = "fired -> prof_on_chat_win_focus: ";
|
||||||
char buf[strlen(str) + strlen(barejid) + 1];
|
char buf[strlen(str) + strlen(barejid) + 1];
|
||||||
sprintf(buf, "%s%s", str, barejid);
|
sprintf(buf, "%s%s", str, barejid);
|
||||||
@@ -932,11 +1027,11 @@ prof_on_chat_win_focus(const char *const barejid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_on_room_win_focus(const char *const roomjid)
|
prof_on_room_win_focus(const char *const barejid)
|
||||||
{
|
{
|
||||||
create_win();
|
prof_win_create(plugin_win, handle_win_input);
|
||||||
char *str = "fired -> prof_on_room_win_focus: ";
|
char *str = "fired -> prof_on_room_win_focus: ";
|
||||||
char buf[strlen(str) + strlen(roomjid) + 1];
|
char buf[strlen(str) + strlen(barejid) + 1];
|
||||||
sprintf(buf, "%s%s", str, roomjid);
|
sprintf(buf, "%s%s", str, barejid);
|
||||||
prof_win_show(plugin_win, buf);
|
prof_win_show(plugin_win, buf);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user