/usr/include/libpurple/pounce.h is in libpurple-dev 1:2.10.9-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | /**
* @file pounce.h Buddy Pounce API
* @ingroup core
*/
/* 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"
/**
* Events that trigger buddy pounces.
*/
typedef enum
{
PURPLE_POUNCE_NONE = 0x000, /**< No events. */
PURPLE_POUNCE_SIGNON = 0x001, /**< The buddy signed on. */
PURPLE_POUNCE_SIGNOFF = 0x002, /**< The buddy signed off. */
PURPLE_POUNCE_AWAY = 0x004, /**< The buddy went away. */
PURPLE_POUNCE_AWAY_RETURN = 0x008, /**< The buddy returned from away. */
PURPLE_POUNCE_IDLE = 0x010, /**< The buddy became idle. */
PURPLE_POUNCE_IDLE_RETURN = 0x020, /**< The buddy is no longer idle. */
PURPLE_POUNCE_TYPING = 0x040, /**< The buddy started typing. */
PURPLE_POUNCE_TYPED = 0x080, /**< The buddy has entered text. */
PURPLE_POUNCE_TYPING_STOPPED = 0x100, /**< The buddy stopped typing. */
PURPLE_POUNCE_MESSAGE_RECEIVED = 0x200 /**< The buddy sent a message */
} PurplePounceEvent;
typedef enum
{
PURPLE_POUNCE_OPTION_NONE = 0x00, /**< No Option */
PURPLE_POUNCE_OPTION_AWAY = 0x01 /**< Pounce only when away */
} PurplePounceOption;
/** A pounce callback. */
typedef void (*PurplePounceCb)(PurplePounce *, PurplePounceEvent, void *);
/**
* A buddy pounce structure.
*
* Buddy pounces are actions triggered by a buddy-related event. For
* example, a sound can be played or an IM window opened when a buddy
* signs on or returns from away. Such responses are handled in the
* UI. The events themselves are done in the core.
*/
struct _PurplePounce
{
char *ui_type; /**< The type of UI. */
PurplePounceEvent events; /**< The event(s) to pounce on. */
PurplePounceOption options; /**< The pounce options */
PurpleAccount *pouncer; /**< The user who is pouncing. */
char *pouncee; /**< The buddy to pounce on. */
GHashTable *actions; /**< The registered actions. */
gboolean save; /**< Whether or not the pounce should
be saved after activation. */
void *data; /**< Pounce-specific data. */
};
#ifdef __cplusplus
extern "C" {
#endif
/**************************************************************************/
/** @name Buddy Pounce API */
/**************************************************************************/
/*@{*/
/**
* Creates a new buddy pounce.
*
* @param ui_type The type of UI the pounce is for.
* @param pouncer The account that will pounce.
* @param pouncee The buddy to pounce on.
* @param event The event(s) to pounce on.
* @param option Pounce options.
*
* @return The new buddy pounce structure.
*/
PurplePounce *purple_pounce_new(const char *ui_type, PurpleAccount *pouncer,
const char *pouncee, PurplePounceEvent event,
PurplePounceOption option);
/**
* Destroys a buddy pounce.
*
* @param pounce The buddy pounce.
*/
void purple_pounce_destroy(PurplePounce *pounce);
/**
* Destroys all buddy pounces for the account
*
* @param account The account to remove all pounces from.
*/
void purple_pounce_destroy_all_by_account(PurpleAccount *account);
/**
* Destroys all buddy pounces for a buddy
*
* @param buddy The buddy whose pounces are to be removed
*
* @since 2.8.0
*/
void purple_pounce_destroy_all_by_buddy(PurpleBuddy *buddy);
/**
* Sets the events a pounce should watch for.
*
* @param pounce The buddy pounce.
* @param events The events to watch for.
*/
void purple_pounce_set_events(PurplePounce *pounce, PurplePounceEvent events);
/**
* Sets the options for a pounce.
*
* @param pounce The buddy pounce.
* @param options The options for the pounce.
*/
void purple_pounce_set_options(PurplePounce *pounce, PurplePounceOption options);
/**
* Sets the account that will do the pouncing.
*
* @param pounce The buddy pounce.
* @param pouncer The account that will pounce.
*/
void purple_pounce_set_pouncer(PurplePounce *pounce, PurpleAccount *pouncer);
/**
* Sets the buddy a pounce should pounce on.
*
* @param pounce The buddy pounce.
* @param pouncee The buddy to pounce on.
*/
void purple_pounce_set_pouncee(PurplePounce *pounce, const char *pouncee);
/**
* Sets whether or not the pounce should be saved after execution.
*
* @param pounce The buddy pounce.
* @param save @c TRUE if the pounce should be saved, or @c FALSE otherwise.
*/
void purple_pounce_set_save(PurplePounce *pounce, gboolean save);
/**
* Registers an action type for the pounce.
*
* @param pounce The buddy pounce.
* @param name The action name.
*/
void purple_pounce_action_register(PurplePounce *pounce, const char *name);
/**
* Enables or disables an action for a pounce.
*
* @param pounce The buddy pounce.
* @param action The name of the action.
* @param enabled The enabled state.
*/
void purple_pounce_action_set_enabled(PurplePounce *pounce, const char *action,
gboolean enabled);
/**
* Sets a value for an attribute in an action.
*
* If @a value is @c NULL, the value will be unset.
*
* @param pounce The buddy pounce.
* @param action The action name.
* @param attr The attribute name.
* @param value The value.
*/
void purple_pounce_action_set_attribute(PurplePounce *pounce, const char *action,
const char *attr, const char *value);
/**
* Sets the pounce-specific data.
*
* @param pounce The buddy pounce.
* @param data Data specific to the pounce.
*/
void purple_pounce_set_data(PurplePounce *pounce, void *data);
/**
* Returns the events a pounce should watch for.
*
* @param pounce The buddy pounce.
*
* @return The events the pounce is watching for.
*/
PurplePounceEvent purple_pounce_get_events(const PurplePounce *pounce);
/**
* Returns the options for a pounce.
*
* @param pounce The buddy pounce.
*
* @return The options for the pounce.
*/
PurplePounceOption purple_pounce_get_options(const PurplePounce *pounce);
/**
* Returns the account that will do the pouncing.
*
* @param pounce The buddy pounce.
*
* @return The account that will pounce.
*/
PurpleAccount *purple_pounce_get_pouncer(const PurplePounce *pounce);
/**
* Returns the buddy a pounce should pounce on.
*
* @param pounce The buddy pounce.
*
* @return The buddy to pounce on.
*/
const char *purple_pounce_get_pouncee(const PurplePounce *pounce);
/**
* Returns whether or not the pounce should save after execution.
*
* @param pounce The buddy pounce.
*
* @return @c TRUE if the pounce should be saved after execution, or
* @c FALSE otherwise.
*/
gboolean purple_pounce_get_save(const PurplePounce *pounce);
/**
* Returns whether or not an action is enabled.
*
* @param pounce The buddy pounce.
* @param action The action name.
*
* @return @c TRUE if the action is enabled, or @c FALSE otherwise.
*/
gboolean purple_pounce_action_is_enabled(const PurplePounce *pounce,
const char *action);
/**
* Returns the value for an attribute in an action.
*
* @param pounce The buddy pounce.
* @param action The action name.
* @param attr The attribute name.
*
* @return The attribute value, if it exists, or @c NULL.
*/
const char *purple_pounce_action_get_attribute(const PurplePounce *pounce,
const char *action,
const char *attr);
/**
* Returns the pounce-specific data.
*
* @param pounce The buddy pounce.
*
* @return The data specific to a buddy pounce.
*/
void *purple_pounce_get_data(const PurplePounce *pounce);
/**
* Executes a pounce with the specified pouncer, pouncee, and event type.
*
* @param pouncer The account that will do the pouncing.
* @param pouncee The buddy that is being pounced.
* @param events The events that triggered the pounce.
*/
void purple_pounce_execute(const PurpleAccount *pouncer, const char *pouncee,
PurplePounceEvent events);
/*@}*/
/**************************************************************************/
/** @name Buddy Pounce Subsystem API */
/**************************************************************************/
/*@{*/
/**
* Finds a pounce with the specified event(s) and buddy.
*
* @param pouncer The account to match against.
* @param pouncee The buddy to match against.
* @param events The event(s) to match against.
*
* @return The pounce if found, or @c NULL otherwise.
*/
PurplePounce *purple_find_pounce(const PurpleAccount *pouncer,
const char *pouncee, PurplePounceEvent events);
/**
* Loads the pounces.
*
* @return @c TRUE if the pounces could be loaded.
*/
gboolean purple_pounces_load(void);
/**
* Registers a pounce handler for a UI.
*
* @param ui The UI name.
* @param cb The callback function.
* @param new_pounce The function called when a pounce is created.
* @param free_pounce The function called when a pounce is freed.
*/
void purple_pounces_register_handler(const char *ui, PurplePounceCb cb,
void (*new_pounce)(PurplePounce *pounce),
void (*free_pounce)(PurplePounce *pounce));
/**
* Unregisters a pounce handle for a UI.
*
* @param ui The UI name.
*/
void purple_pounces_unregister_handler(const char *ui);
/**
* Returns a list of all registered buddy pounces.
*
* @constreturn The list of buddy pounces.
*/
GList *purple_pounces_get_all(void);
/**
* Returns a list of registered buddy pounces for the ui-type.
*
* @param ui The ID of the UI using the core.
*
* @return The list of buddy pounces. The list should be freed by
* the caller when it's no longer used.
* @since 2.1.0
*/
GList *purple_pounces_get_all_for_ui(const char *ui);
/**
* Returns the buddy pounce subsystem handle.
*
* @return The subsystem handle.
*/
void *purple_pounces_get_handle(void);
/**
* Initializes the pounces subsystem.
*/
void purple_pounces_init(void);
/**
* Uninitializes the pounces subsystem.
*/
void purple_pounces_uninit(void);
/*@}*/
#ifdef __cplusplus
}
#endif
#endif /* _PURPLE_POUNCE_H_ */
|