pounce.h
Go to the documentation of this file.
/* purple
*
* Purple is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
* source distribution.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#ifndef _PURPLE_POUNCE_H_
#define _PURPLE_POUNCE_H_
typedef struct _PurplePounce PurplePounce;
#include <glib.h>
#include "account.h"
typedef enum
{
PURPLE_POUNCE_NONE = 0x000,
PURPLE_POUNCE_SIGNON = 0x001,
PURPLE_POUNCE_SIGNOFF = 0x002,
PURPLE_POUNCE_AWAY = 0x004,
PURPLE_POUNCE_AWAY_RETURN = 0x008,
PURPLE_POUNCE_IDLE = 0x010,
PURPLE_POUNCE_IDLE_RETURN = 0x020,
PURPLE_POUNCE_TYPING = 0x040,
PURPLE_POUNCE_TYPED = 0x080,
PURPLE_POUNCE_TYPING_STOPPED = 0x100,
PURPLE_POUNCE_MESSAGE_RECEIVED = 0x200
} PurplePounceEvent;
typedef enum
{
PURPLE_POUNCE_OPTION_NONE = 0x00,
PURPLE_POUNCE_OPTION_AWAY = 0x01
} PurplePounceOption;
typedef void (*PurplePounceCb)(PurplePounce *, PurplePounceEvent, void *);
struct _PurplePounce
{
char *ui_type;
PurplePounceEvent events;
PurplePounceOption options;
PurpleAccount *pouncer;
char *pouncee;
GHashTable *actions;
gboolean save;
void *data;
};
#ifdef __cplusplus
extern "C" {
#endif
/**************************************************************************/
/**************************************************************************/
PurplePounce *purple_pounce_new(const char *ui_type, PurpleAccount *pouncer,
const char *pouncee, PurplePounceEvent event,
PurplePounceOption option);
void purple_pounce_destroy(PurplePounce *pounce);
void purple_pounce_destroy_all_by_account(PurpleAccount *account);
void purple_pounce_destroy_all_by_buddy(PurpleBuddy *buddy);
void purple_pounce_set_events(PurplePounce *pounce, PurplePounceEvent events);
void purple_pounce_set_options(PurplePounce *pounce, PurplePounceOption options);
void purple_pounce_set_pouncer(PurplePounce *pounce, PurpleAccount *pouncer);
void purple_pounce_set_pouncee(PurplePounce *pounce, const char *pouncee);
void purple_pounce_set_save(PurplePounce *pounce, gboolean save);
void purple_pounce_action_register(PurplePounce *pounce, const char *name);
void purple_pounce_action_set_enabled(PurplePounce *pounce, const char *action,
gboolean enabled);
void purple_pounce_action_set_attribute(PurplePounce *pounce, const char *action,
const char *attr, const char *value);
void purple_pounce_set_data(PurplePounce *pounce, void *data);
PurplePounceEvent purple_pounce_get_events(const PurplePounce *pounce);
PurplePounceOption purple_pounce_get_options(const PurplePounce *pounce);
PurpleAccount *purple_pounce_get_pouncer(const PurplePounce *pounce);
const char *purple_pounce_get_pouncee(const PurplePounce *pounce);
gboolean purple_pounce_get_save(const PurplePounce *pounce);
gboolean purple_pounce_action_is_enabled(const PurplePounce *pounce,
const char *action);
const char *purple_pounce_action_get_attribute(const PurplePounce *pounce,
const char *action,
const char *attr);
void *purple_pounce_get_data(const PurplePounce *pounce);
void purple_pounce_execute(const PurpleAccount *pouncer, const char *pouncee,
PurplePounceEvent events);
/**************************************************************************/
/**************************************************************************/
PurplePounce *purple_find_pounce(const PurpleAccount *pouncer,
const char *pouncee, PurplePounceEvent events);
gboolean purple_pounces_load(void);
void purple_pounces_register_handler(const char *ui, PurplePounceCb cb,
void (*new_pounce)(PurplePounce *pounce),
void (*free_pounce)(PurplePounce *pounce));
void purple_pounces_unregister_handler(const char *ui);
GList *purple_pounces_get_all(void);
GList *purple_pounces_get_all_for_ui(const char *ui);
void *purple_pounces_get_handle(void);
void purple_pounces_init(void);
void purple_pounces_uninit(void);
#ifdef __cplusplus
}
#endif
#endif /* _PURPLE_POUNCE_H_ */
_PurplePounce::events
PurplePounceEvent events
The event(s) to pounce on.
Definition: pounce.h:74
PurplePounceCb
void(* PurplePounceCb)(PurplePounce *, PurplePounceEvent, void *)
A pounce callback.
Definition: pounce.h:60
purple_pounce_destroy_all_by_account
void purple_pounce_destroy_all_by_account(PurpleAccount *account)
Destroys all buddy pounces for the account.
purple_pounces_unregister_handler
void purple_pounces_unregister_handler(const char *ui)
Unregisters a pounce handle for a UI.
PURPLE_POUNCE_NONE
No events.
Definition: pounce.h:39
purple_pounce_set_pouncee
void purple_pounce_set_pouncee(PurplePounce *pounce, const char *pouncee)
Sets the buddy a pounce should pounce on.
_PurplePounce::ui_type
char * ui_type
The type of UI.
Definition: pounce.h:72
purple_pounce_set_data
void purple_pounce_set_data(PurplePounce *pounce, void *data)
Sets the pounce-specific data.
account.h
purple_pounce_action_set_enabled
void purple_pounce_action_set_enabled(PurplePounce *pounce, const char *action, gboolean enabled)
Enables or disables an action for a pounce.
purple_pounce_get_pouncer
PurpleAccount * purple_pounce_get_pouncer(const PurplePounce *pounce)
Returns the account that will do the pouncing.
purple_pounce_set_pouncer
void purple_pounce_set_pouncer(PurplePounce *pounce, PurpleAccount *pouncer)
Sets the account that will do the pouncing.
purple_pounce_set_save
void purple_pounce_set_save(PurplePounce *pounce, gboolean save)
Sets whether or not the pounce should be saved after execution.
_PurplePounce
A buddy pounce structure.
Definition: pounce.h:70
_PurplePounce::data
void * data
Pounce-specific data.
Definition: pounce.h:84
purple_pounce_destroy
void purple_pounce_destroy(PurplePounce *pounce)
Destroys a buddy pounce.
purple_pounce_get_data
void * purple_pounce_get_data(const PurplePounce *pounce)
Returns the pounce-specific data.
purple_pounce_get_options
PurplePounceOption purple_pounce_get_options(const PurplePounce *pounce)
Returns the options for a pounce.
PurplePounceOption
PurplePounceOption
Definition: pounce.h:53
PURPLE_POUNCE_OPTION_NONE
No Option
Definition: pounce.h:55
purple_pounce_get_pouncee
const char * purple_pounce_get_pouncee(const PurplePounce *pounce)
Returns the buddy a pounce should pounce on.
_PurplePounce::options
PurplePounceOption options
The pounce options
Definition: pounce.h:75
purple_pounces_register_handler
void purple_pounces_register_handler(const char *ui, PurplePounceCb cb, void(*new_pounce)(PurplePounce *pounce), void(*free_pounce)(PurplePounce *pounce))
Registers a pounce handler for a UI.
PURPLE_POUNCE_IDLE
The buddy became idle.
Definition: pounce.h:44
PURPLE_POUNCE_AWAY_RETURN
The buddy returned from away.
Definition: pounce.h:43
PURPLE_POUNCE_SIGNON
The buddy signed on.
Definition: pounce.h:40
_PurpleAccount
Structure representing an account.
Definition: account.h:169
purple_pounce_destroy_all_by_buddy
void purple_pounce_destroy_all_by_buddy(PurpleBuddy *buddy)
Destroys all buddy pounces for a buddy.
purple_pounce_get_events
PurplePounceEvent purple_pounce_get_events(const PurplePounce *pounce)
Returns the events a pounce should watch for.
purple_pounces_get_all
GList * purple_pounces_get_all(void)
Returns a list of all registered buddy pounces.
_PurplePounce::save
gboolean save
Whether or not the pounce should be saved after activation.
Definition: pounce.h:82
purple_pounce_action_register
void purple_pounce_action_register(PurplePounce *pounce, const char *name)
Registers an action type for the pounce.
PURPLE_POUNCE_IDLE_RETURN
The buddy is no longer idle.
Definition: pounce.h:45
purple_find_pounce
PurplePounce * purple_find_pounce(const PurpleAccount *pouncer, const char *pouncee, PurplePounceEvent events)
Finds a pounce with the specified event(s) and buddy.
_PurplePounce::pouncer
PurpleAccount * pouncer
The user who is pouncing.
Definition: pounce.h:76
purple_pounce_new
PurplePounce * purple_pounce_new(const char *ui_type, PurpleAccount *pouncer, const char *pouncee, PurplePounceEvent event, PurplePounceOption option)
Creates a new buddy pounce.
PURPLE_POUNCE_TYPED
The buddy has entered text.
Definition: pounce.h:47
PURPLE_POUNCE_TYPING_STOPPED
The buddy stopped typing.
Definition: pounce.h:48
purple_pounces_get_handle
void * purple_pounces_get_handle(void)
Returns the buddy pounce subsystem handle.
purple_pounces_load
gboolean purple_pounces_load(void)
Loads the pounces.
_PurplePounce::actions
GHashTable * actions
The registered actions.
Definition: pounce.h:80
option
Definition: finch/getopt.h:84
purple_pounce_action_get_attribute
const char * purple_pounce_action_get_attribute(const PurplePounce *pounce, const char *action, const char *attr)
Returns the value for an attribute in an action.
purple_pounces_init
void purple_pounces_init(void)
Initializes the pounces subsystem.
purple_pounce_action_is_enabled
gboolean purple_pounce_action_is_enabled(const PurplePounce *pounce, const char *action)
Returns whether or not an action is enabled.
purple_pounce_execute
void purple_pounce_execute(const PurpleAccount *pouncer, const char *pouncee, PurplePounceEvent events)
Executes a pounce with the specified pouncer, pouncee, and event type.
purple_pounces_uninit
void purple_pounces_uninit(void)
Uninitializes the pounces subsystem.
PURPLE_POUNCE_OPTION_AWAY
Pounce only when away
Definition: pounce.h:56
purple_pounce_set_events
void purple_pounce_set_events(PurplePounce *pounce, PurplePounceEvent events)
Sets the events a pounce should watch for.
PURPLE_POUNCE_AWAY
The buddy went away.
Definition: pounce.h:42
purple_pounce_set_options
void purple_pounce_set_options(PurplePounce *pounce, PurplePounceOption options)
Sets the options for a pounce.
purple_pounce_action_set_attribute
void purple_pounce_action_set_attribute(PurplePounce *pounce, const char *action, const char *attr, const char *value)
Sets a value for an attribute in an action.
PURPLE_POUNCE_SIGNOFF
The buddy signed off.
Definition: pounce.h:41
_PurpleBuddy
A buddy.
Definition: blist.h:138
PURPLE_POUNCE_MESSAGE_RECEIVED
The buddy sent a message
Definition: pounce.h:49
purple_pounces_get_all_for_ui
GList * purple_pounces_get_all_for_ui(const char *ui)
Returns a list of registered buddy pounces for the ui-type.
_PurplePounce::pouncee
char * pouncee
The buddy to pounce on.
Definition: pounce.h:78
PurplePounceEvent
PurplePounceEvent
Events that trigger buddy pounces.
Definition: pounce.h:37
purple_pounce_get_save
gboolean purple_pounce_get_save(const PurplePounce *pounce)
Returns whether or not the pounce should save after execution.
PURPLE_POUNCE_TYPING
The buddy started typing.
Definition: pounce.h:46