Add chat and room show calls to plugins api

This commit is contained in:
James Booth
2017-01-21 20:23:28 +00:00
parent 9cfd17821c
commit 7090f85d85
8 changed files with 477 additions and 6 deletions

View File

@@ -23,16 +23,16 @@ typedef void(*WINDOW_CB)(PROF_WIN_TAG win, char *line);
/** Highlights the console window in the status bar. */
void prof_cons_alert(void);
/**
/**
Show a message in the console window.
@param message the message to print
@return 1 on success, 0 on failure
*/
int prof_cons_show(const char * const message);
/**
/**
Show a message in the console, using the specified theme.
Themes can be must be specified in ~/.local/share/profanity/plugin_themes
Themes are specified in ~/.local/share/profanity/plugin_themes
@param group the group name in the themes file
@param item the item name within the group
@param def default colour if the theme cannot be found
@@ -206,7 +206,7 @@ int prof_win_show(PROF_WIN_TAG win, char *message);
/**
Show a message in the plugin window, using the specified theme.
Themes must be specified in ~/.local/share/profanity/plugin_themes
Themes are specified in ~/.local/share/profanity/plugin_themes
@param tag The {@link PROF_WIN_TAG} of the window to display the message
@param group the group name in the themes file
@param key the item name within the group
@@ -414,3 +414,45 @@ Reset the message prefix character for specified room.
@return 1 on success, 0 on failure
*/
int prof_room_unset_message_char(char *roomjid);
/**
Show a message in a chat window.
@param barejid Jabber ID of the recipient
@param message the message to print
@return 1 on success, 0 on failure
*/
int prof_chat_show(char *barejid, char *message);
/**
Show a message in a chat window, using the specified theme, and prefix character
Themes are specified in ~/.local/share/profanity/plugin_themes
@param barejid Jabber ID of the recipient
@param group the group name in the themes file or NULL
@param item the item name within the group or NULL
@param def default colour if the theme cannot be found
@param ch The character to prefix the message, or NULL for default behaviour
@param message the message to print
@return 1 on success, 0 on failure
*/
int prof_chat_show_themed(char *barejid, char *group, char *item, char *def, char *ch, char *message);
/**
Show a message in a chat room window.
@param barejid Jabber ID of the room
@param message the message to print
@return 1 on success, 0 on failure
*/
int prof_room_show(char *roomjid, char *message);
/**
Show a message in a chat room window, using the specified theme, and prefix character
Themes are specified in ~/.local/share/profanity/plugin_themes
@param barejid Jabber ID of the room
@param group the group name in the themes file or NULL
@param item the item name within the group or NULL
@param def default colour if the theme cannot be found
@param ch The character to prefix the message, or NULL for default behaviour
@param message the message to print
@return 1 on success, 0 on failure
*/
int prof_room_show_themed(char *roomjid, char *group, char *item, char *def, char *ch, char *message);

View File

@@ -31,7 +31,7 @@ def cons_show(message):
def cons_show_themed(group, key, default, message):
"""Show a message in the console, using the specified theme.\n
Themes can be must be specified in ``~/.local/share/profanity/plugin_themes``
Themes are specified in ``~/.local/share/profanity/plugin_themes``
:param group: the group name in the themes file
:param key: the item name within the group
@@ -376,7 +376,7 @@ def win_show(tag, message):
def win_show_themed(tag, group, key, default, message):
"""Show a message in the plugin window, using the specified theme.\n
Themes must be specified in ``~/.local/share/profanity/plugin_themes``
Themes are specified in ``~/.local/share/profanity/plugin_themes``
:param tag: The tag of the window to display the message
:type tag: str or unicode
@@ -797,3 +797,89 @@ def room_unset_message_char(roomjid):
prof.room_unset_message_char("ohnoes@conference.chat.org")
"""
pass
def chat_show(barejid, message):
"""Show a message in a chat window.
:param barejid: Jabber ID of the recipient
:param message: the message to print
:type barejid: str or unicode
:type message: str or unicode
:return: ``True`` if the message was printed, ``False`` otherwise
:rtype: boolean
Example:
::
prof.chat_show("bob@server.org", "From a plugin in the chat window for bob")
"""
pass
def chat_show_themed(barejid, group, key, default, ch, message):
"""Show a message a chat window, using the specified theme and prefix character.\n
Themes are specified in ``~/.local/share/profanity/plugin_themes``
:param barejid: Jabber ID of the recipient
:param group: the group name in the themes file or ``None``
:param key: the item name within the group or ``None``
:param default: default colour if the theme cannot be found or ``None``
:param ch: The prefix character to show, or ``None`` for default behaviour
:param message: the message to print
:type barejid: str or unicode
:type group: str, unicode or None
:type key: str, unicode or None
:type default: str, unicode or None
:type ch: str or unicode
:type message: str or unicode
:return: ``True`` if the message was printed, ``False`` otherwise
:rtype: boolean
Example:
::
prof.chat_show_themed("bob@server.org", "myplugin", "text", None, "!", "Plugin themed message")
"""
pass
def room_show(roomjid, message):
"""Show a message in a chat room window.
:param roomjid: Jabber ID of the room
:param message: the message to print
:type roomjid: str or unicode
:type message: str or unicode
:return: ``True`` if the message was printed, ``False`` otherwise
:rtype: boolean
Example:
::
prof.room_show("chat@conference.chat.org", "From a plugin in the chat room window")
"""
pass
def room_show_themed(roomjid, group, key, default, ch, message):
"""Show a message a chat room window, using the specified theme and prefix character.\n
Themes are specified in ``~/.local/share/profanity/plugin_themes``
:param roomjid: Jabber ID of the room
:param group: the group name in the themes file or ``None``
:param key: the item name within the group or ``None``
:param default: default colour if the theme cannot be found or ``None``
:param ch: The prefix character to show, or ``None`` for default behaviour
:param message: the message to print
:type roomjid: str or unicode
:type group: str, unicode or None
:type key: str, unicode or None
:type default: str, unicode or None
:type ch: str or unicode
:type message: str or unicode
:return: ``True`` if the message was printed, ``False`` otherwise
:rtype: boolean
Example:
::
prof.room_show_themed("chat@conference.chat.org", "myplugin", "text", None, "!", "Plugin themed message")
"""
pass