This page describes functions that plugins may implement to be called from Profanity on certain events. All functions are optional.
Examples:
def prof_on_start():
prof.cons_show("Profanity has started...")
def prof_pre_room_message_display(room, nick, message):
prof.cons_show("Manipulating chat room message before display...")
new_message = message + " (added by plugin)"
return new_message
def prof_on_contact_presence(barejid, resource, presence, status, priority):
notify_message = barejid + " is " + presence
prof.notify(notify_message, 5, "Presence")
Called when a plugin is loaded, either when profanity is started, or when the /plugins load or /plugins install commands are called
Parameters: |
|
---|
Called when a chat window is focussed
Parameters: | barejid (str or unicode) – Jabber ID of the chat window recipient |
---|
Called when the user connects with an account
Parameters: |
|
---|
Called when a contact goes offline
Parameters: |
|
---|
Called when a presence notification is received from a contact
Parameters: |
|
---|
Called when the user disconnects an account
Parameters: |
|
---|
Called when an XMPP iq stanza is received
Parameters: | stanza (str or unicode) – The stanza received |
---|---|
Returns: | True if Profanity should continue to process the iq stanza, False otherwise |
Return type: | boolean |
Called before an XMPP iq stanza is sent
Parameters: | stanza (str or unicode) – The stanza to send |
---|---|
Returns: | The new stanza to send, or None to preserve the original stanza |
Return type: | str or unicode |
Called when an XMPP message stanza is received
Parameters: | stanza (str or unicode) – The stanza received |
---|---|
Returns: | True if Profanity should continue to process the message stanza, False otherwise |
Return type: | boolean |
Called before an XMPP message stanza is sent
Parameters: | stanza (str or unicode) – The stanza to send |
---|---|
Returns: | The new stanza to send, or None to preserve the original stanza |
Return type: | str or unicode |
Called when an XMPP presence stanza is received
Parameters: | stanza (str or unicode) – The stanza received |
---|---|
Returns: | True if Profanity should continue to process the presence stanza, False otherwise |
Return type: | boolean |
Called before an XMPP presence stanza is sent
Parameters: | stanza (str or unicode) – The stanza to send |
---|---|
Returns: | The new stanza to send, or None to preserve the original stanza |
Return type: | str or unicode |
Called when the server sends a chat room history message
Parameters: |
|
---|
Called when a chat room window is focussed
Parameters: | barejid (str or unicode) – Jabber ID of the room |
---|
Called when the user quits Profanity
Called when Profanity is started
Called when a plugin is unloaded with the /plugins unload command
Called after a chat message is displayed
Parameters: |
|
---|
Called after a chat message has been sent
Parameters: |
|
---|
Called after a private chat room message is displayed
Parameters: |
|
---|
Called after a private chat room message has been sent
Parameters: |
|
---|
Called after a chat room message is displayed
Parameters: |
|
---|
Called after a chat room message has been sent
Parameters: |
|
---|
Called before a chat message is displayed
Parameters: |
|
---|---|
Returns: | the new message to display, or None to preserve the original message |
Return type: | str or unicode |
Called before a chat message is sent
Parameters: |
|
---|---|
Returns: | the modified or original message to send, or None to cancel sending of the message |
Return type: | str or unicode |
Called before a private chat room message is displayed
Parameters: |
|
---|---|
Returns: | the new message to display, or None to preserve the original message |
Return type: | str or unicode |
Called before a private chat room message is sent
Parameters: |
|
---|---|
Returns: | the modified or original message to send, or None to cancel sending of the message |
Return type: | str or unicode |
Called before a chat room message is displayed
Parameters: |
|
---|---|
Returns: | the new message to display, or None to preserve the original message |
Return type: | str or unicode |
Called before a chat room message is sent
Parameters: |
|
---|---|
Returns: | the modified or original message to send, or None to cancel sending of the message |
Return type: | str or unicode |