smiley.h
Go to the documentation of this file.
1 
7 /* purple
8  *
9  * Purple is the legal property of its developers, whose names are too numerous
10  * to list here. Please refer to the COPYRIGHT file distributed with this
11  * source distribution.
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26  *
27  */
28 
29 #ifndef _PURPLE_SMILEY_H_
30 #define _PURPLE_SMILEY_H_
31 
32 #include <glib-object.h>
33 
34 #include "imgstore.h"
35 #include "util.h"
36 
44 typedef struct _PurpleSmiley PurpleSmiley;
45 typedef struct _PurpleSmileyClass PurpleSmileyClass;
46 
47 #define PURPLE_TYPE_SMILEY (purple_smiley_get_type ())
48 #define PURPLE_SMILEY(smiley) (G_TYPE_CHECK_INSTANCE_CAST ((smiley), PURPLE_TYPE_SMILEY, PurpleSmiley))
49 #define PURPLE_SMILEY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PURPLE_TYPE_SMILEY, PurpleSmileyClass))
50 #define PURPLE_IS_SMILEY(smiley) (G_TYPE_CHECK_INSTANCE_TYPE ((smiley), PURPLE_TYPE_SMILEY))
51 #define PURPLE_IS_SMILEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PURPLE_TYPE_SMILEY))
52 #define PURPLE_SMILEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PURPLE_TYPE_SMILEY, PurpleSmileyClass))
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58 /**************************************************************************/
60 /**************************************************************************/
67 GType purple_smiley_get_type(void);
68 
81 purple_smiley_new(PurpleStoredImage *img, const char *shortcut);
82 
95 purple_smiley_new_from_file(const char *shortcut, const char *filepath);
96 
102 void
104 
114 gboolean
115 purple_smiley_set_shortcut(PurpleSmiley *smiley, const char *shortcut);
116 
125 void
126 purple_smiley_set_data(PurpleSmiley *smiley, guchar *smiley_data,
127  size_t smiley_data_len);
128 
136 const char *purple_smiley_get_shortcut(const PurpleSmiley *smiley);
137 
145 const char *purple_smiley_get_checksum(const PurpleSmiley *smiley);
146 
158 
168 gconstpointer purple_smiley_get_data(const PurpleSmiley *smiley, size_t *len);
169 
178 const char *purple_smiley_get_extension(const PurpleSmiley *smiley);
179 
198 
202 /**************************************************************************/
204 /**************************************************************************/
213 GList *
215 
223 PurpleSmiley *
224 purple_smileys_find_by_shortcut(const char *shortcut);
225 
233 PurpleSmiley *
234 purple_smileys_find_by_checksum(const char *checksum);
235 
243 const char *purple_smileys_get_storing_dir(void);
244 
248 void purple_smileys_init(void);
249 
253 void purple_smileys_uninit(void);
254 
257 #ifdef __cplusplus
258 }
259 #endif
260 
261 #endif /* _PURPLE_SMILEY_H_ */
262 
struct _PurpleSmiley PurpleSmiley
A custom smiley.
Definition: smiley.h:44
void purple_smileys_init(void)
Initializes the custom smiley subsystem.
struct _PurpleStoredImage PurpleStoredImage
A set of utility functions that provide a reference-counted immutable wrapper around an image's data ...
Definition: imgstore.h:37
const char * purple_smiley_get_checksum(const PurpleSmiley *smiley)
Returns the custom smiley data's checksum.
const char * purple_smiley_get_extension(const PurpleSmiley *smiley)
Returns an extension corresponding to the custom smiley's file type.
PurpleSmiley * purple_smileys_find_by_checksum(const char *checksum)
Returns a custom smiley given its checksum.
PurpleSmiley * purple_smileys_find_by_shortcut(const char *shortcut)
Returns a custom smiley given its shortcut.
gconstpointer purple_smiley_get_data(const PurpleSmiley *smiley, size_t *len)
Returns the custom smiley's data.
char * purple_smiley_get_full_path(PurpleSmiley *smiley)
Returns a full path to an custom smiley.
PurpleStoredImage * purple_smiley_get_stored_image(const PurpleSmiley *smiley)
Returns the PurpleStoredImage with the reference counter incremented.
GType purple_smiley_get_type(void)
GObject-fu.
Utility Functions.
GList * purple_smileys_get_all(void)
Returns a list of all custom smileys.
void purple_smiley_set_data(PurpleSmiley *smiley, guchar *smiley_data, size_t smiley_data_len)
Changes the custom smiley's image data.
IM Image Store API.
void purple_smiley_delete(PurpleSmiley *smiley)
Destroys the custom smiley and releases the associated resources.
gboolean purple_smiley_set_shortcut(PurpleSmiley *smiley, const char *shortcut)
Changes the custom smiley's shortcut.
void purple_smileys_uninit(void)
Uninitializes the custom smiley subsystem.
PurpleSmiley * purple_smiley_new(PurpleStoredImage *img, const char *shortcut)
Creates a new custom smiley from a PurpleStoredImage.
PurpleSmiley * purple_smiley_new_from_file(const char *shortcut, const char *filepath)
Creates a new custom smiley, reading the image data from a file.
const char * purple_smileys_get_storing_dir(void)
Returns the directory used to store custom smiley cached files.
const char * purple_smiley_get_shortcut(const PurpleSmiley *smiley)
Returns the custom smiley's associated shortcut (e.g.