pidgin  2.14.10
pounce.h
Go to the documentation of this file.
1 
6 /* purple
7  *
8  * Purple is the legal property of its developers, whose names are too numerous
9  * to list here. Please refer to the COPYRIGHT file distributed with this
10  * source distribution.
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25  */
26 #ifndef _PURPLE_POUNCE_H_
27 #define _PURPLE_POUNCE_H_
28 
29 typedef struct _PurplePounce PurplePounce;
30 
31 #include <glib.h>
32 #include "account.h"
33 
37 typedef enum
38 {
52 
53 typedef enum
54 {
58 
60 typedef void (*PurplePounceCb)(PurplePounce *, PurplePounceEvent, void *);
61 
71 {
72  char *ui_type;
78  char *pouncee;
80  GHashTable *actions;
82  gboolean save;
84  void *data;
85 };
86 
87 #ifdef __cplusplus
88 extern "C" {
89 #endif
90 
91 /**************************************************************************/
93 /**************************************************************************/
107 PurplePounce *purple_pounce_new(const char *ui_type, PurpleAccount *pouncer,
108  const char *pouncee, PurplePounceEvent event,
110 
117 
124 
133 
141 
149 
157 
164 void purple_pounce_set_pouncee(PurplePounce *pounce, const char *pouncee);
165 
172 void purple_pounce_set_save(PurplePounce *pounce, gboolean save);
173 
180 void purple_pounce_action_register(PurplePounce *pounce, const char *name);
181 
189 void purple_pounce_action_set_enabled(PurplePounce *pounce, const char *action,
190  gboolean enabled);
191 
202 void purple_pounce_action_set_attribute(PurplePounce *pounce, const char *action,
203  const char *attr, const char *value);
204 
211 void purple_pounce_set_data(PurplePounce *pounce, void *data);
212 
221 
230 
239 
247 const char *purple_pounce_get_pouncee(const PurplePounce *pounce);
248 
257 gboolean purple_pounce_get_save(const PurplePounce *pounce);
258 
268  const char *action);
269 
280  const char *action,
281  const char *attr);
282 
291 
299 void purple_pounce_execute(const PurpleAccount *pouncer, const char *pouncee,
300  PurplePounceEvent events);
301 
304 /**************************************************************************/
306 /**************************************************************************/
319  const char *pouncee, PurplePounceEvent events);
320 
321 
327 gboolean purple_pounces_load(void);
328 
338  void (*new_pounce)(PurplePounce *pounce),
339  void (*free_pounce)(PurplePounce *pounce));
340 
347 
354 
364 GList *purple_pounces_get_all_for_ui(const char *ui);
365 
372 
377 
382 
385 #ifdef __cplusplus
386 }
387 #endif
388 
389 #endif /* _PURPLE_POUNCE_H_ */
Account API.
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.
PurplePounce * purple_pounce_new(const char *ui_type, PurpleAccount *pouncer, const char *pouncee, PurplePounceEvent event, PurplePounceOption option)
Creates a new buddy pounce.
PurpleAccount * purple_pounce_get_pouncer(const PurplePounce *pounce)
Returns the account that will do the pouncing.
void purple_pounce_destroy_all_by_account(PurpleAccount *account)
Destroys all buddy pounces for the account.
void(* PurplePounceCb)(PurplePounce *, PurplePounceEvent, void *)
A pounce callback.
Definition: pounce.h:60
PurplePounce * purple_find_pounce(const PurpleAccount *pouncer, const char *pouncee, PurplePounceEvent events)
Finds a pounce with the specified event(s) and buddy.
void purple_pounces_uninit(void)
Uninitializes the pounces subsystem.
gboolean purple_pounce_get_save(const PurplePounce *pounce)
Returns whether or not the pounce should save after execution.
void purple_pounce_set_save(PurplePounce *pounce, gboolean save)
Sets whether or not the pounce should be saved after execution.
void purple_pounce_action_set_enabled(PurplePounce *pounce, const char *action, gboolean enabled)
Enables or disables an action for a pounce.
PurplePounceEvent
Events that trigger buddy pounces.
Definition: pounce.h:38
@ PURPLE_POUNCE_NONE
No events.
Definition: pounce.h:39
@ PURPLE_POUNCE_IDLE_RETURN
The buddy is no longer idle.
Definition: pounce.h:45
@ PURPLE_POUNCE_TYPING_STOPPED
The buddy stopped typing.
Definition: pounce.h:48
@ PURPLE_POUNCE_MESSAGE_RECEIVED
The buddy sent a message
Definition: pounce.h:49
@ PURPLE_POUNCE_SIGNON
The buddy signed on.
Definition: pounce.h:40
@ PURPLE_POUNCE_TYPED
The buddy has entered text.
Definition: pounce.h:47
@ PURPLE_POUNCE_AWAY_RETURN
The buddy returned from away.
Definition: pounce.h:43
@ PURPLE_POUNCE_TYPING
The buddy started typing.
Definition: pounce.h:46
@ PURPLE_POUNCE_AWAY
The buddy went away.
Definition: pounce.h:42
@ PURPLE_POUNCE_SIGNOFF
The buddy signed off.
Definition: pounce.h:41
@ PURPLE_POUNCE_IDLE
The buddy became idle.
Definition: pounce.h:44
void * purple_pounces_get_handle(void)
Returns the buddy pounce subsystem handle.
PurplePounceEvent purple_pounce_get_events(const PurplePounce *pounce)
Returns the events a pounce should watch for.
void * purple_pounce_get_data(const PurplePounce *pounce)
Returns the pounce-specific data.
void purple_pounce_destroy(PurplePounce *pounce)
Destroys a buddy pounce.
void purple_pounce_action_register(PurplePounce *pounce, const char *name)
Registers an action type for the pounce.
void purple_pounce_set_data(PurplePounce *pounce, void *data)
Sets the pounce-specific data.
void purple_pounces_unregister_handler(const char *ui)
Unregisters a pounce handle for a UI.
void purple_pounce_execute(const PurpleAccount *pouncer, const char *pouncee, PurplePounceEvent events)
Executes a pounce with the specified pouncer, pouncee, and event type.
void purple_pounce_set_pouncer(PurplePounce *pounce, PurpleAccount *pouncer)
Sets the account that will do the pouncing.
GList * purple_pounces_get_all_for_ui(const char *ui)
Returns a list of registered buddy pounces for the ui-type.
void purple_pounce_set_pouncee(PurplePounce *pounce, const char *pouncee)
Sets the buddy a pounce should pounce on.
void purple_pounce_set_events(PurplePounce *pounce, PurplePounceEvent events)
Sets the events a pounce should watch for.
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.
PurplePounceOption purple_pounce_get_options(const PurplePounce *pounce)
Returns the options for a pounce.
gboolean purple_pounces_load(void)
Loads the pounces.
const char * purple_pounce_get_pouncee(const PurplePounce *pounce)
Returns the buddy a pounce should pounce on.
void purple_pounce_set_options(PurplePounce *pounce, PurplePounceOption options)
Sets the options for a pounce.
gboolean purple_pounce_action_is_enabled(const PurplePounce *pounce, const char *action)
Returns whether or not an action is enabled.
void purple_pounces_init(void)
Initializes the pounces subsystem.
void purple_pounce_destroy_all_by_buddy(PurpleBuddy *buddy)
Destroys all buddy pounces for a buddy.
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.
PurplePounceOption
Definition: pounce.h:54
@ PURPLE_POUNCE_OPTION_NONE
No Option
Definition: pounce.h:55
@ PURPLE_POUNCE_OPTION_AWAY
Pounce only when away
Definition: pounce.h:56
GList * purple_pounces_get_all(void)
Returns a list of all registered buddy pounces.
Structure representing an account.
Definition: account.h:170
A buddy.
Definition: blist.h:140
A buddy pounce structure.
Definition: pounce.h:71
char * ui_type
The type of UI.
Definition: pounce.h:72
PurplePounceEvent events
The event(s) to pounce on.
Definition: pounce.h:74
gboolean save
Whether or not the pounce should be saved after activation.
Definition: pounce.h:82
GHashTable * actions
The registered actions.
Definition: pounce.h:80
PurpleAccount * pouncer
The user who is pouncing.
Definition: pounce.h:76
char * pouncee
The buddy to pounce on.
Definition: pounce.h:78
PurplePounceOption options
The pounce options
Definition: pounce.h:75
void * data
Pounce-specific data.
Definition: pounce.h:84