3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 #ifndef PURPLE_ATTENTION_H
23 #define PURPLE_ATTENTION_H
26 #include <glib-object.h>
30 * @section_id: libpurple-attention
31 * @short_description: <filename>attention.h</filename>
32 * @title: Attention Object and Interfaces
35 #define PURPLE_TYPE_ATTENTION_TYPE (purple_attention_type_get_type())
38 * PurpleAttentionType:
39 * @name: The name to show in GUI elements.
40 * @incoming_description: Shown when received.
41 * @outgoing_description: Shown when sent.
42 * @icon_name: Optional name of the icon to display.
43 * @unlocalized_name: An unlocalized name for UIs that would rather use that.
45 * Represents "nudges" and "buzzes" that you may send to a buddy to attract
46 * their attention (or vice-versa).
48 typedef struct _PurpleAttentionType PurpleAttentionType
;
50 #define PURPLE_TYPE_PROTOCOL_ATTENTION (purple_protocol_attention_get_type())
51 #define PURPLE_PROTOCOL_ATTENTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_PROTOCOL_ATTENTION, PurpleProtocolAttention))
52 #define PURPLE_IS_PROTOCOL_ATTENTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_PROTOCOL_ATTENTION))
53 #define PURPLE_PROTOCOL_ATTENTION_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE((obj), PURPLE_TYPE_PROTOCOL_ATTENTION, PurpleProtocolAttentionInterface))
55 typedef struct _PurpleProtocolAttention PurpleProtocolAttention
;
56 typedef struct _PurpleProtocolAttentionInterface PurpleProtocolAttentionInterface
;
59 #include "connection.h"
62 * PurpleProtocolAttentionInterface:
64 * The protocol attention interface.
66 * This interface provides attention API for sending and receiving
67 * zaps/nudges/buzzes etc.
69 struct _PurpleProtocolAttentionInterface
72 GTypeInterface parent
;
75 gboolean (*send
)(PurpleProtocolAttention
*attn
, PurpleConnection
*gc
, const gchar
*username
, guint type
);
77 GList
*(*get_types
)(PurpleProtocolAttention
*attn
, PurpleAccount
*acct
);
82 /******************************************************************************
84 *****************************************************************************/
87 * purple_attention_type_get_type:
89 * Returns: The #GType for the #PurpleAttentionType boxed structure.
91 GType
purple_attention_type_get_type(void);
93 PurpleAttentionType
*purple_attention_type_copy(PurpleAttentionType
*attn
);
96 * purple_attention_type_new:
97 * @unlocalized_name: A non-localized string that can be used by UIs in need of such
98 * non-localized strings. This should be the same as @name,
99 * without localization.
100 * @name: A localized string that the UI may display for the event. This
101 * should be the same string as @unlocalized_name, with localization.
102 * @incoming_description: A localized description shown when the event is received.
103 * @outgoing_description: A localized description shown when the event is sent.
105 * Creates a new #PurpleAttentionType object and sets its mandatory parameters.
107 * Returns: A pointer to the new object.
109 PurpleAttentionType
*purple_attention_type_new(const gchar
*unlocalized_name
, const gchar
*name
,
110 const gchar
*incoming_description
, const gchar
*outgoing_description
);
113 * purple_attention_type_get_name:
114 * @type: The attention type.
116 * Get the attention type's name as displayed by the UI.
120 const gchar
*purple_attention_type_get_name(const PurpleAttentionType
*type
);
123 * purple_attention_type_set_name:
124 * @type: The attention type.
125 * @name: The localized name that will be displayed by UIs. This should be
126 * the same string given as the unlocalized name, but with
129 * Sets the displayed name of the attention-demanding event.
131 void purple_attention_type_set_name(PurpleAttentionType
*type
, const gchar
*name
);
134 * purple_attention_type_get_incoming_desc:
135 * @type: The attention type.
137 * Get the attention type's description shown when the event is received.
139 * Returns: The description.
141 const gchar
*purple_attention_type_get_incoming_desc(const PurpleAttentionType
*type
);
144 * purple_attention_type_set_incoming_desc:
145 * @type: The attention type.
146 * @desc: The localized description for incoming events.
148 * Sets the description of the attention-demanding event shown in conversations
149 * when the event is received.
151 void purple_attention_type_set_incoming_desc(PurpleAttentionType
*type
, const gchar
*desc
);
154 * purple_attention_type_get_outgoing_desc:
155 * @type: The attention type.
157 * Get the attention type's description shown when the event is sent.
159 * Returns: The description.
161 const gchar
*purple_attention_type_get_outgoing_desc(const PurpleAttentionType
*type
);
164 * purple_attention_type_set_outgoing_desc:
165 * @type: The attention type.
166 * @desc: The localized description for outgoing events.
168 * Sets the description of the attention-demanding event shown in conversations
169 * when the event is sent.
171 void purple_attention_type_set_outgoing_desc(PurpleAttentionType
*type
, const gchar
*desc
);
174 * purple_attention_type_get_icon_name:
175 * @type: The attention type.
177 * Get the attention type's icon name.
179 * Note: Icons are optional for attention events.
181 * Returns: The icon name or %NULL if unset/empty.
183 const gchar
*purple_attention_type_get_icon_name(const PurpleAttentionType
*type
);
186 * purple_attention_type_set_icon_name:
187 * @type: The attention type.
188 * @name: The icon's name.
190 * Sets the name of the icon to display for the attention event; this is optional.
192 * Note: Icons are optional for attention events.
194 void purple_attention_type_set_icon_name(PurpleAttentionType
*type
, const gchar
*name
);
197 * purple_attention_type_get_unlocalized_name:
198 * @type: The attention type
200 * Get the attention type's unlocalized name; this is useful for some UIs.
202 * Returns: The unlocalized name.
204 const gchar
*purple_attention_type_get_unlocalized_name(const PurpleAttentionType
*type
);
207 * purple_attention_type_set_unlocalized_name:
208 * @type: The attention type.
209 * @ulname: The unlocalized name. This should be the same string given as
210 * the localized name, but without localization.
212 * Sets the unlocalized name of the attention event; some UIs may need this,
213 * thus it is required.
215 void purple_attention_type_set_unlocalized_name(PurpleAttentionType
*type
, const gchar
*ulname
);
217 /******************************************************************************
219 *****************************************************************************/
222 * purple_protocol_attention_get_type:
224 * Returns: The #GType for the protocol attention interface.
226 GType
purple_protocol_attention_get_type(void);
229 * purple_protocol_attention_get_types:
230 * @attn: The #PurpleProtocolAttention.
231 * @acct: The #PurpleAccount whose attention types to get.
233 * Returns a list of #PurpleAttentionType's for @attn.
235 * Returns: (transfer container) (element-type PurpleAttentionType): The list of #PurpleAttentionType's.
237 GList
*purple_protocol_attention_get_types(PurpleProtocolAttention
*attn
, PurpleAccount
*acct
);
240 * purple_protocol_attention_send:
241 * @attn: The #PurpleProtocolAttention instance.
242 * @gc: The #PurpleConnection to send on
243 * @username: The name of the user to send the attention to.
244 * @type: The type of attention to send.
246 * Sends an attention message of @type to @username.
248 * Returns: TRUE on success, FALSE otherwise.
250 gboolean
purple_protocol_attention_send(PurpleProtocolAttention
*attn
, PurpleConnection
*gc
, const gchar
*username
, guint type
);
254 #endif /* PURPLE_ATTENTION_H */