pounce.h

Go to the documentation of this file.
00001
00006 /* purple
00007  *
00008  * Purple is the legal property of its developers, whose names are too numerous
00009  * to list here.  Please refer to the COPYRIGHT file distributed with this
00010  * source distribution.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00025  */
00026 #ifndef _PURPLE_POUNCE_H_
00027 #define _PURPLE_POUNCE_H_
00028 
00029 typedef struct _PurplePounce PurplePounce;
00030
00031 #include <glib.h>
00032 #include "account.h"
00033
00037 typedef enum
00038 {
00039     PURPLE_POUNCE_NONE             = 0x000,
00040     PURPLE_POUNCE_SIGNON           = 0x001,
00041     PURPLE_POUNCE_SIGNOFF          = 0x002,
00042     PURPLE_POUNCE_AWAY             = 0x004,
00043     PURPLE_POUNCE_AWAY_RETURN      = 0x008,
00044     PURPLE_POUNCE_IDLE             = 0x010,
00045     PURPLE_POUNCE_IDLE_RETURN      = 0x020,
00046     PURPLE_POUNCE_TYPING           = 0x040,
00047     PURPLE_POUNCE_TYPED            = 0x080,
00048     PURPLE_POUNCE_TYPING_STOPPED   = 0x100,
00049     PURPLE_POUNCE_MESSAGE_RECEIVED = 0x200
00051 } PurplePounceEvent;
00052
00053 typedef enum
00054 {
00055     PURPLE_POUNCE_OPTION_NONE       = 0x00,
00056     PURPLE_POUNCE_OPTION_AWAY       = 0x01
00057 } PurplePounceOption;
00058
00060 typedef void (*PurplePounceCb)(PurplePounce *, PurplePounceEvent, void *);
00061
00070 struct _PurplePounce
00071 {
00072     char *ui_type;
00074     PurplePounceEvent events;
00075     PurplePounceOption options;
00076     PurpleAccount *pouncer;
00078     char *pouncee;
00080     GHashTable *actions;
00082     gboolean save;
00084     void *data;
00085 };
00086
00087 #ifdef __cplusplus
00088 extern "C" {
00089 #endif
00090 
00091 /**************************************************************************/
00093 /**************************************************************************/
00107 PurplePounce *purple_pounce_new(const char *ui_type, PurpleAccount *pouncer,
00108                             const char *pouncee, PurplePounceEvent event,
00109                             PurplePounceOption option);
00110
00116 void purple_pounce_destroy(PurplePounce *pounce);
00117
00123 void purple_pounce_destroy_all_by_account(PurpleAccount *account);
00124
00131 void purple_pounce_set_events(PurplePounce *pounce, PurplePounceEvent events);
00132
00139 void purple_pounce_set_options(PurplePounce *pounce, PurplePounceOption options);
00140
00147 void purple_pounce_set_pouncer(PurplePounce *pounce, PurpleAccount *pouncer);
00148
00155 void purple_pounce_set_pouncee(PurplePounce *pounce, const char *pouncee);
00156
00163 void purple_pounce_set_save(PurplePounce *pounce, gboolean save);
00164
00171 void purple_pounce_action_register(PurplePounce *pounce, const char *name);
00172
00180 void purple_pounce_action_set_enabled(PurplePounce *pounce, const char *action,
00181                                     gboolean enabled);
00182
00193 void purple_pounce_action_set_attribute(PurplePounce *pounce, const char *action,
00194                                       const char *attr, const char *value);
00195
00202 void purple_pounce_set_data(PurplePounce *pounce, void *data);
00203
00211 PurplePounceEvent purple_pounce_get_events(const PurplePounce *pounce);
00212
00220 PurplePounceOption purple_pounce_get_options(const PurplePounce *pounce);
00221
00229 PurpleAccount *purple_pounce_get_pouncer(const PurplePounce *pounce);
00230
00238 const char *purple_pounce_get_pouncee(const PurplePounce *pounce);
00239
00248 gboolean purple_pounce_get_save(const PurplePounce *pounce);
00249
00258 gboolean purple_pounce_action_is_enabled(const PurplePounce *pounce,
00259                                        const char *action);
00260
00270 const char *purple_pounce_action_get_attribute(const PurplePounce *pounce,
00271                                              const char *action,
00272                                              const char *attr);
00273
00281 void *purple_pounce_get_data(const PurplePounce *pounce);
00282
00290 void purple_pounce_execute(const PurpleAccount *pouncer, const char *pouncee,
00291                          PurplePounceEvent events);
00292
00295 /**************************************************************************/
00297 /**************************************************************************/
00309 PurplePounce *purple_find_pounce(const PurpleAccount *pouncer,
00310                              const char *pouncee, PurplePounceEvent events);
00311
00312
00318 gboolean purple_pounces_load(void);
00319
00328 void purple_pounces_register_handler(const char *ui, PurplePounceCb cb,
00329                                    void (*new_pounce)(PurplePounce *pounce),
00330                                    void (*free_pounce)(PurplePounce *pounce));
00331
00337 void purple_pounces_unregister_handler(const char *ui);
00338
00344 GList *purple_pounces_get_all(void);
00345
00355 GList *purple_pounces_get_all_for_ui(const char *ui);
00356
00362 void *purple_pounces_get_handle(void);
00363
00367 void purple_pounces_init(void);
00368
00372 void purple_pounces_uninit(void);
00373
00376 #ifdef __cplusplus
00377 }
00378 #endif
00379 
00380 #endif /* _PURPLE_POUNCE_H_ */