Mercurial > pidgin
comparison src/pounce.h @ 5864:417b1001d2b1
[gaim-migrate @ 6295]
Rewrote the pounce API again. Now it's even MORE core/UI-split, and will
allow for loading/saving.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sat, 14 Jun 2003 11:14:49 +0000 |
parents | 2fa4aa9c1885 |
children | d6b5cab288bb |
comparison
equal
deleted
inserted
replaced
5863:98ec3e394f59 | 5864:417b1001d2b1 |
---|---|
1 /** | 1 /** |
2 * @file pounce.h Buddy pounce API | 2 * @file pounce.h Buddy Pounce API |
3 * @ingroup core | 3 * @ingroup core |
4 * | 4 * |
5 * gaim | 5 * gaim |
6 * | 6 * |
7 * Copyright (C) 2003, Christian Hammond <chipx86@gnupdate.org> | 7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> |
8 * | 8 * |
9 * This program is free software; you can redistribute it and/or modify | 9 * This program is free software; you can redistribute it and/or modify |
10 * it under the terms of the GNU General Public License as published by | 10 * it under the terms of the GNU General Public License as published by |
11 * the Free Software Foundation; either version 2 of the License, or | 11 * the Free Software Foundation; either version 2 of the License, or |
12 * (at your option) any later version. | 12 * (at your option) any later version. |
53 * signs on or returns from away. Such responses are handled in the | 53 * signs on or returns from away. Such responses are handled in the |
54 * UI. The events themselves are done in the core. | 54 * UI. The events themselves are done in the core. |
55 */ | 55 */ |
56 struct _GaimPounce | 56 struct _GaimPounce |
57 { | 57 { |
58 char *ui_type; /**< The type of UI. */ | |
59 | |
58 GaimPounceEvent events; /**< The event(s) to pounce on. */ | 60 GaimPounceEvent events; /**< The event(s) to pounce on. */ |
59 GaimAccount *pouncer; /**< The user who is pouncing. */ | 61 GaimAccount *pouncer; /**< The user who is pouncing. */ |
60 | 62 |
61 char *pouncee; /**< The buddy to pounce on. */ | 63 char *pouncee; /**< The buddy to pounce on. */ |
62 | 64 |
63 GaimPounceCb callback; /**< The callback function to call when the | 65 GHashTable *actions; /**< The registered actions. */ |
64 event is triggered. */ | 66 |
65 void (*free)(void *data); /**< The data free function. */ | 67 gboolean save; /**< Whether or not the pounce should |
66 void *data; /**< Pounce-specific data. */ | 68 be saved after activation. */ |
69 GaimPounceCb callback; /**< The callback function to call when the | |
70 event is triggered. */ | |
71 void (*free)(void *data); /**< The data free function. */ | |
72 void *data; /**< Pounce-specific data. */ | |
67 }; | 73 }; |
68 | 74 |
69 /** | 75 /** |
70 * Creates a new buddy pounce. | 76 * Creates a new buddy pounce. |
71 * | 77 * |
78 * @param ui_type The type of UI the pounce is for. | |
72 * @param pouncer The account that will pounce. | 79 * @param pouncer The account that will pounce. |
73 * @param pouncee The buddy to pounce on. | 80 * @param pouncee The buddy to pounce on. |
74 * @param event The event(s) to pounce on. | 81 * @param event The event(s) to pounce on. |
75 * @param cb The callback function to call when the pounce is triggered. | 82 * @param cb The callback function to call when the pounce is triggered. |
76 * @param data Pounce-specific data. | 83 * @param data Pounce-specific data. |
77 * @param free The function to free the pounce-specific data. | 84 * @param free The function to free the pounce-specific data. |
78 * | 85 * |
79 * @return The new buddy pounce structure. | 86 * @return The new buddy pounce structure. |
80 */ | 87 */ |
81 GaimPounce *gaim_pounce_new(GaimAccount *pouncer, const char *pouncee, | 88 GaimPounce *gaim_pounce_new(const char *ui_type, |
89 GaimAccount *pouncer, const char *pouncee, | |
82 GaimPounceEvent event, GaimPounceCb cb, | 90 GaimPounceEvent event, GaimPounceCb cb, |
83 void *data, void (*free)(void *)); | 91 void *data, void (*free)(void *)); |
84 | 92 |
85 /** | 93 /** |
86 * Destroys a buddy pounce. | 94 * Destroys a buddy pounce. |
112 * @param pouncee The buddy to pounce on. | 120 * @param pouncee The buddy to pounce on. |
113 */ | 121 */ |
114 void gaim_pounce_set_pouncee(GaimPounce *pounce, const char *buddy); | 122 void gaim_pounce_set_pouncee(GaimPounce *pounce, const char *buddy); |
115 | 123 |
116 /** | 124 /** |
117 * Sets the callback function to call when the pounce event is triggered. | 125 * Sets whether or not the pounce should be saved after execution. |
118 * | 126 * |
119 * @param pounce The buddy pounce. | 127 * @param pounce The buddy pounce. |
120 * @param cb The callback function. | 128 * @param save @c TRUE if the pounce should be saved, or @c FALSE otherwise. |
121 */ | 129 */ |
122 void gaim_pounce_set_callback(GaimPounce *pounce, GaimPounceCb cb); | 130 void gaim_pounce_set_save(GaimPounce *pounce, gboolean save); |
131 | |
132 /** | |
133 * Registers an action type for the pounce. | |
134 * | |
135 * @param pounce The buddy pounce. | |
136 * @param name The action name. | |
137 */ | |
138 void gaim_pounce_action_register(GaimPounce *pounce, const char *name); | |
139 | |
140 /** | |
141 * Enables or disables an action for a pounce. | |
142 * | |
143 * @param pounce The buddy pounce. | |
144 * @param action The name of the action. | |
145 * @param enabled The enabled state. | |
146 */ | |
147 void gaim_pounce_action_set_enabled(GaimPounce *pounce, const char *action, | |
148 gboolean enabled); | |
149 | |
150 /** | |
151 * Sets a value for an attribute in an action. | |
152 * | |
153 * If @a value is @c NULL, the value will be unset. | |
154 * | |
155 * @param pounce The buddy pounce. | |
156 * @param action The action name. | |
157 * @param attr The attribute name. | |
158 * @param value The value. | |
159 */ | |
160 void gaim_pounce_action_set_attribute(GaimPounce *pounce, const char *action, | |
161 const char *attr, const char *value); | |
123 | 162 |
124 /** | 163 /** |
125 * Sets the pounce-specific data. | 164 * Sets the pounce-specific data. |
126 * | 165 * |
127 * @param pounce The buddy pounce. | 166 * @param pounce The buddy pounce. |
153 * @param pounce The buddy pounce. | 192 * @param pounce The buddy pounce. |
154 * | 193 * |
155 * @return The buddy to pounce on. | 194 * @return The buddy to pounce on. |
156 */ | 195 */ |
157 const char *gaim_pounce_get_pouncee(const GaimPounce *pounce); | 196 const char *gaim_pounce_get_pouncee(const GaimPounce *pounce); |
197 | |
198 /** | |
199 * Returns whether or not the pounce should save after execution. | |
200 * | |
201 * @param pounce The buddy pounce. | |
202 * | |
203 * @return @c TRUE if the pounce should be saved after execution, or | |
204 * @c FALSE otherwise. | |
205 */ | |
206 gboolean gaim_pounce_get_save(const GaimPounce *pounce); | |
207 | |
208 /** | |
209 * Returns whether or not an action is enabled. | |
210 * | |
211 * @param pounce The buddy pounce. | |
212 * @param action The action name. | |
213 * | |
214 * @return @c TRUE if the action is enabled, or @c FALSE otherwise. | |
215 */ | |
216 gboolean gaim_pounce_action_is_enabled(const GaimPounce *pounce, | |
217 const char *action); | |
218 | |
219 /** | |
220 * Returns the value for an attribute in an action. | |
221 * | |
222 * @param pounce The buddy pounce. | |
223 * @param action The action name. | |
224 * @param attr The attribute name. | |
225 * | |
226 * @return The attribute value, if it exists, or @c NULL. | |
227 */ | |
228 const char *gaim_pounce_action_get_attribute(const GaimPounce *pounce, | |
229 const char *action, | |
230 const char *attr); | |
158 | 231 |
159 /** | 232 /** |
160 * Returns the pounce-specific data. | 233 * Returns the pounce-specific data. |
161 * | 234 * |
162 * @param pounce The buddy pounce. | 235 * @param pounce The buddy pounce. |