Profanity C Plugin API
Functions
profhooks.h File Reference

Go to the source code of this file.

Functions

void prof_init (const char *const version, const char *const status, const char *const account_name, const char *const fulljid)
 
void prof_on_start (void)
 
void prof_on_shutdown (void)
 
void prof_on_unload (void)
 
void prof_on_connect (const char *const account_name, const char *const fulljid)
 
void prof_on_disconnect (const char *const account_name, const char *const fulljid)
 
char * prof_pre_chat_message_display (const char *const barejid, const char *const resource, const char *message)
 
void prof_post_chat_message_display (const char *const barejid, const char *const resource, const char *message)
 
char * prof_pre_chat_message_send (const char *const barejid, const char *message)
 
void prof_post_chat_message_send (const char *const barejid, const char *message)
 
char * prof_pre_room_message_display (const char *const barejid, const char *const nick, const char *message)
 
void prof_post_room_message_display (const char *const barejid, const char *const nick, const char *message)
 
char * prof_pre_room_message_send (const char *const barejid, const char *message)
 
void prof_post_room_message_send (const char *const barejid, const char *message)
 
void prof_on_room_history_message (const char *const barejid, const char *const nick, const char *const message, const char *const timestamp)
 
char * prof_pre_priv_message_display (const char *const barejid, const char *const nick, const char *message)
 
void prof_post_priv_message_display (const char *const barejid, const char *const nick, const char *message)
 
char * prof_pre_priv_message_send (const char *const barejid, const char *const nick, const char *message)
 
void prof_post_priv_message_send (const char *const barejid, const char *const nick, const char *message)
 
char * prof_on_message_stanza_send (const char *const stanza)
 
int prof_on_message_stanza_receive (const char *const stanza)
 
char * prof_on_presence_stanza_send (const char *const stanza)
 
int prof_on_presence_stanza_receive (const char *const stanza)
 
char * prof_on_iq_stanza_send (const char *const stanza)
 
int prof_on_iq_stanza_receive (const char *const stanza)
 
void prof_on_contact_offline (const char *const barejid, const char *const resource, const char *const status)
 
void prof_on_contact_presence (const char *const barejid, const char *const resource, const char *const presence, const char *const status, const int priority)
 
void prof_on_chat_win_focus (const char *const barejid)
 
void prof_on_room_win_focus (const char *const barejid)
 

Detailed Description

C Hooks.

Function Documentation

void prof_init ( const char *const  version,
const char *const  status,
const char *const  account_name,
const char *const  fulljid 
)

Called when a plugin is loaded, either when profanity is started, or when the /plugins load or /plugins install commands are called

Parameters
versionthe version of Profanity
statusthe package status of Profanity, "development" or "release"
account_nameaccount name of the currently logged in account, or NULL if not logged in
fulljidthe users full Jabber ID (barejid and resource) if logged in, NULL otherwise
void prof_on_chat_win_focus ( const char *const  barejid)

Called when a chat window is focussed

Parameters
barejidJabber ID of the chat window recipient
void prof_on_connect ( const char *const  account_name,
const char *const  fulljid 
)

Called when the user connects with an account

Parameters
account_nameaccount name of the account used for logging in
fulljidthe full Jabber ID (barejid and resource) of the account
void prof_on_contact_offline ( const char *const  barejid,
const char *const  resource,
const char *const  status 
)

Called when a contact goes offline

Parameters
barejidJabber ID of the contact
resourcethe resource being disconnected
statusthe status message received with the offline presence, or NULL
void prof_on_contact_presence ( const char *const  barejid,
const char *const  resource,
const char *const  presence,
const char *const  status,
const int  priority 
)

Called when a presence notification is received from a contact

Parameters
barejidJabber ID of the contact
resourcethe resource being disconnected
presencepresence of the contact, one of "chat", "online", "away", "xa" or "dnd"
statusthe status message received with the presence, or NULL
prioritythe priority associated with the resource
void prof_on_disconnect ( const char *const  account_name,
const char *const  fulljid 
)

Called when the user disconnects an account

Parameters
account_nameaccount name of the account being disconnected
fulljidthe full Jabber ID (barejid and resource) of the account
int prof_on_iq_stanza_receive ( const char *const  stanza)

Called when an XMPP iq stanza is received

Parameters
stanzaThe stanza received
Returns
1 if Profanity should continue to process the iq stanza, 0 otherwise
char* prof_on_iq_stanza_send ( const char *const  stanza)

Called before an XMPP iq stanza is sent

Parameters
stanzaThe stanza to send
Returns
The new stanza to send, or NULL to preserve the original stanza
int prof_on_message_stanza_receive ( const char *const  stanza)

Called when an XMPP message stanza is received

Parameters
stanzaThe stanza received
Returns
1 if Profanity should continue to process the message stanza, 0 otherwise
char* prof_on_message_stanza_send ( const char *const  stanza)

Called before an XMPP message stanza is sent

Parameters
stanzaThe stanza to send
Returns
The new stanza to send, or NULL to preserve the original stanza
int prof_on_presence_stanza_receive ( const char *const  stanza)

Called when an XMPP presence stanza is received

Parameters
stanzaThe stanza received
Returns
1 if Profanity should continue to process the presence stanza, 0 otherwise
char* prof_on_presence_stanza_send ( const char *const  stanza)

Called before an XMPP presence stanza is sent

Parameters
stanzaThe stanza to send
Returns
The new stanza to send, or NULL to preserve the original stanza
void prof_on_room_history_message ( const char *const  barejid,
const char *const  nick,
const char *const  message,
const char *const  timestamp 
)

Called when the server sends a chat room history message

Parameters
barejidJabber ID of the room
nicknickname of the message sender
messagethe message to be sent
timestamptime the message was originally sent to the room, in ISO8601 format
void prof_on_room_win_focus ( const char *const  barejid)

Called when a chat room window is focussed

Parameters
barejidJabber ID of the room
void prof_on_shutdown ( void  )

Called when the user quits Profanity

void prof_on_start ( void  )

Called when Profanity is started

void prof_on_unload ( void  )

Called when a plugin is unloaded with the /plugins unload command

void prof_post_chat_message_display ( const char *const  barejid,
const char *const  resource,
const char *  message 
)

Called after a chat message is displayed

Parameters
barejidJabber ID of the message sender
resourceresource of the message sender
messagethe received message
void prof_post_chat_message_send ( const char *const  barejid,
const char *  message 
)

Called after a chat message has been sent

Parameters
barejidJabber ID of the message recipient
messagethe sent message
void prof_post_priv_message_display ( const char *const  barejid,
const char *const  nick,
const char *  message 
)

Called after a private chat room message is displayed

Parameters
barejidJabber ID of the room
nicknickname of the message sender
messagethe received message
void prof_post_priv_message_send ( const char *const  barejid,
const char *const  nick,
const char *  message 
)

Called after a private chat room message has been sent

Parameters
barejidJabber ID of the room
nicknickname of the message recipient
messagethe sent message
void prof_post_room_message_display ( const char *const  barejid,
const char *const  nick,
const char *  message 
)

Called after a chat room message is displayed

Parameters
barejidJabber ID of the room
nicknickname of the message sender
messagethe received message
void prof_post_room_message_send ( const char *const  barejid,
const char *  message 
)

Called after a chat room message has been sent

Parameters
barejidJabber ID of the room
messagethe sent message
char* prof_pre_chat_message_display ( const char *const  barejid,
const char *const  resource,
const char *  message 
)

Called before a chat message is displayed

Parameters
barejidJabber ID of the message sender
resourceresource of the message sender
messagethe received message
Returns
the new message to display, or NULL to preserve the original message
char* prof_pre_chat_message_send ( const char *const  barejid,
const char *  message 
)

Called before a chat message is sent

Parameters
barejidJabber ID of the message recipient
messagethe message to be sent
Returns
the modified or original message to send, or NULL to cancel sending of the message
char* prof_pre_priv_message_display ( const char *const  barejid,
const char *const  nick,
const char *  message 
)

Called before a private chat room message is displayed

Parameters
barejidJabber ID of the room
nicknickname of message sender
messagethe received message
Returns
the new message to display, or NULL to preserve the original message
char* prof_pre_priv_message_send ( const char *const  barejid,
const char *const  nick,
const char *  message 
)

Called before a private chat room message is sent

Parameters
barejidJabber ID of the room
nicknickname of message recipient
messagethe message to be sent
Returns
the modified or original message to send, or NULL to cancel sending of the message
char* prof_pre_room_message_display ( const char *const  barejid,
const char *const  nick,
const char *  message 
)

Called before a chat room message is displayed

Parameters
barejidJabber ID of the room
nicknickname of message sender
messagethe received message
Returns
the new message to display, or NULL to preserve the original message
char* prof_pre_room_message_send ( const char *const  barejid,
const char *  message 
)

Called before a chat room message is sent

Parameters
barejidJabber ID of the room
messagethe message to be sent
Returns
the modified or original message to send, or NULL to cancel sending of the message