* 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
* 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
/******************************************************************************
* PurpleAttentionType API
*****************************************************************************/
struct _PurpleAttentionType {
/* The name to show in GUI elements. */
/* Shown when received. */
const gchar *incoming_description;
const gchar *outgoing_description;
/* Optional name of the icon to display. */
/* An unlocalized name for UIs that would rather use that. */
const gchar *unlocalized_name;
purple_attention_type_copy,
purple_attention_type_new(const gchar *unlocalized_name,
const gchar *incoming_description,
const gchar *outgoing_description)
PurpleAttentionType *attn = g_new0(PurpleAttentionType, 1);
attn->unlocalized_name = unlocalized_name;
attn->incoming_description = incoming_description;
attn->outgoing_description = outgoing_description;
purple_attention_type_copy(PurpleAttentionType *attn) {
PurpleAttentionType *attn_copy = NULL;
g_return_val_if_fail(attn != NULL, NULL);
attn_copy = g_new(PurpleAttentionType, 1);
purple_attention_type_get_name(const PurpleAttentionType *type) {
g_return_val_if_fail(type, NULL);
purple_attention_type_set_name(PurpleAttentionType *type, const gchar *name) {
purple_attention_type_get_incoming_desc(const PurpleAttentionType *type) {
g_return_val_if_fail(type, NULL);
return type->incoming_description;
purple_attention_type_set_incoming_desc(PurpleAttentionType *type, const gchar *desc) {
type->incoming_description = desc;
purple_attention_type_get_outgoing_desc(const PurpleAttentionType *type) {
g_return_val_if_fail(type, NULL);
return type->outgoing_description;
purple_attention_type_set_outgoing_desc(PurpleAttentionType *type, const gchar *desc) {
g_return_if_fail(type != NULL);
type->outgoing_description = desc;
purple_attention_type_get_icon_name(const PurpleAttentionType *type) {
g_return_val_if_fail(type, NULL);
if(type->icon_name == NULL || *(type->icon_name) == '\0')
purple_attention_type_set_icon_name(PurpleAttentionType *type, const gchar *name) {
purple_attention_type_get_unlocalized_name(const PurpleAttentionType *type) {
g_return_val_if_fail(type, NULL);
return type->unlocalized_name;
purple_attention_type_set_unlocalized_name(PurpleAttentionType *type, const gchar *ulname) {
type->unlocalized_name = ulname;
/******************************************************************************
* PurpleAttentionType API
*****************************************************************************/
G_DEFINE_INTERFACE(PurpleProtocolAttention, purple_protocol_attention, G_TYPE_INVALID);
purple_protocol_attention_default_init(PurpleProtocolAttentionInterface *iface) {
purple_protocol_attention_send(PurpleProtocolAttention *attn, PurpleConnection *gc, const gchar *username, guint type) {
PurpleProtocolAttentionInterface *iface = NULL;
g_return_val_if_fail(PURPLE_IS_PROTOCOL_ATTENTION(attn), FALSE);
iface = PURPLE_PROTOCOL_ATTENTION_GET_IFACE(attn);
if(iface && iface->send) {
return iface->send(attn, gc, username, type);
purple_protocol_attention_get_types(PurpleProtocolAttention *attn, PurpleAccount *account) {
PurpleProtocolAttentionInterface *iface = NULL;
g_return_val_if_fail(PURPLE_IS_PROTOCOL_ATTENTION(attn), NULL);
iface = PURPLE_PROTOCOL_ATTENTION_GET_IFACE(attn);
if(iface && iface->get_types) {
return iface->get_types(attn, account);