/usr/include/libpurple/smiley.h is in libpurple-dev 2.12.0-1.
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 | /**
* @file smiley.h Smiley API
* @ingroup core
* @since 2.5.0
*/
/* 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_SMILEY_H_
#define _PURPLE_SMILEY_H_
#include <glib-object.h>
#include "imgstore.h"
#include "util.h"
/**
* A custom smiley.
* This contains everything Purple will ever need to know about a custom smiley.
* Everything.
*
* PurpleSmiley is a GObject.
*/
typedef struct _PurpleSmiley PurpleSmiley;
typedef struct _PurpleSmileyClass PurpleSmileyClass;
#define PURPLE_TYPE_SMILEY (purple_smiley_get_type ())
#define PURPLE_SMILEY(smiley) (G_TYPE_CHECK_INSTANCE_CAST ((smiley), PURPLE_TYPE_SMILEY, PurpleSmiley))
#define PURPLE_SMILEY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PURPLE_TYPE_SMILEY, PurpleSmileyClass))
#define PURPLE_IS_SMILEY(smiley) (G_TYPE_CHECK_INSTANCE_TYPE ((smiley), PURPLE_TYPE_SMILEY))
#define PURPLE_IS_SMILEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PURPLE_TYPE_SMILEY))
#define PURPLE_SMILEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PURPLE_TYPE_SMILEY, PurpleSmileyClass))
#ifdef __cplusplus
extern "C" {
#endif
/**************************************************************************/
/** @name Custom Smiley API */
/**************************************************************************/
/*@{*/
/**
* GObject-fu.
* @internal.
*/
GType purple_smiley_get_type(void);
/**
* Creates a new custom smiley from a PurpleStoredImage.
*
* If a custom smiley with the given shortcut already exists, it
* will be automaticaly returned.
*
* @param img The image associated with the smiley.
* @param shortcut The associated shortcut (e.g. "(homer)").
*
* @return The custom smiley.
*/
PurpleSmiley *
purple_smiley_new(PurpleStoredImage *img, const char *shortcut);
/**
* Creates a new custom smiley, reading the image data from a file.
*
* If a custom smiley with the given shortcut already exists, it
* will be automaticaly returned.
*
* @param shortcut The associated shortcut (e.g. "(homer)").
* @param filepath The image file.
*
* @return The custom smiley.
*/
PurpleSmiley *
purple_smiley_new_from_file(const char *shortcut, const char *filepath);
/**
* Destroys the custom smiley and releases the associated resources.
*
* @param smiley The custom smiley.
*/
void
purple_smiley_delete(PurpleSmiley *smiley);
/**
* Changes the custom smiley's shortcut.
*
* @param smiley The custom smiley.
* @param shortcut The new shortcut. A custom smiley with this shortcut
* cannot already be in use.
*
* @return TRUE if the shortcut was changed. FALSE otherwise.
*/
gboolean
purple_smiley_set_shortcut(PurpleSmiley *smiley, const char *shortcut);
/**
* Changes the custom smiley's image data.
*
* @param smiley The custom smiley.
* @param smiley_data The custom smiley data, which the smiley code
* takes ownership of and will free.
* @param smiley_data_len The length of the data in @a smiley_data.
*/
void
purple_smiley_set_data(PurpleSmiley *smiley, guchar *smiley_data,
size_t smiley_data_len);
/**
* Returns the custom smiley's associated shortcut (e.g. "(homer)").
*
* @param smiley The custom smiley.
*
* @return The shortcut.
*/
const char *purple_smiley_get_shortcut(const PurpleSmiley *smiley);
/**
* Returns the custom smiley data's checksum.
*
* @param smiley The custom smiley.
*
* @return The checksum.
*/
const char *purple_smiley_get_checksum(const PurpleSmiley *smiley);
/**
* Returns the PurpleStoredImage with the reference counter incremented.
*
* The returned PurpleStoredImage reference counter must be decremented
* when the caller is done using it.
*
* @param smiley The custom smiley.
*
* @return A PurpleStoredImage.
*/
PurpleStoredImage *purple_smiley_get_stored_image(const PurpleSmiley *smiley);
/**
* Returns the custom smiley's data.
*
* @param smiley The custom smiley.
* @param len If not @c NULL, the length of the image data returned
* will be set in the location pointed to by this.
*
* @return A pointer to the custom smiley data.
*/
gconstpointer purple_smiley_get_data(const PurpleSmiley *smiley, size_t *len);
/**
* Returns an extension corresponding to the custom smiley's file type.
*
* @param smiley The custom smiley.
*
* @return The custom smiley's extension, "icon" if unknown, or @c NULL if
* the image data has disappeared.
*/
const char *purple_smiley_get_extension(const PurpleSmiley *smiley);
/**
* Returns a full path to an custom smiley.
*
* If the custom smiley has data and the file exists in the cache, this
* will return a full path to the cached file.
*
* In general, it is not appropriate to be poking in the file cache
* directly. If you find yourself wanting to use this function, think
* very long and hard about it, and then don't.
*
* Think some more.
*
* @param smiley The custom smiley.
*
* @return A full path to the file, or @c NULL under various conditions.
* The caller should use g_free to free the returned string.
*/
char *purple_smiley_get_full_path(PurpleSmiley *smiley);
/*@}*/
/**************************************************************************/
/** @name Custom Smiley Subsystem API */
/**************************************************************************/
/*@{*/
/**
* Returns a list of all custom smileys. The caller is responsible for freeing
* the list.
*
* @return A list of all custom smileys.
*/
GList *
purple_smileys_get_all(void);
/**
* Returns a custom smiley given its shortcut.
*
* @param shortcut The custom smiley's shortcut.
*
* @return The custom smiley if found, or @c NULL if not found.
*/
PurpleSmiley *
purple_smileys_find_by_shortcut(const char *shortcut);
/**
* Returns a custom smiley given its checksum.
*
* @param checksum The custom smiley's checksum.
*
* @return The custom smiley if found, or @c NULL if not found.
*/
PurpleSmiley *
purple_smileys_find_by_checksum(const char *checksum);
/**
* Returns the directory used to store custom smiley cached files.
*
* The default directory is PURPLEDIR/custom_smiley.
*
* @return The directory in which to store custom smileys cached files.
*/
const char *purple_smileys_get_storing_dir(void);
/**
* Initializes the custom smiley subsystem.
*/
void purple_smileys_init(void);
/**
* Uninitializes the custom smiley subsystem.
*/
void purple_smileys_uninit(void);
/*@}*/
#ifdef __cplusplus
}
#endif
#endif /* _PURPLE_SMILEY_H_ */
|