pidgin 2.14.14dev
Loading...
Searching...
No Matches
smiley.h File Reference

Smiley API. More...

#include <glib-object.h>
#include "imgstore.h"
#include "util.h"
Include dependency graph for smiley.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#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))
 

Typedefs

typedef struct _PurpleSmiley PurpleSmiley
 A custom smiley.
 
typedef struct _PurpleSmileyClass PurpleSmileyClass
 

Functions

Custom Smiley API <br>
GType purple_smiley_get_type (void)
 GObject-fu.
 
PurpleSmileypurple_smiley_new (PurpleStoredImage *img, const char *shortcut)
 Creates a new custom smiley from a PurpleStoredImage.
 
PurpleSmileypurple_smiley_new_from_file (const char *shortcut, const char *filepath)
 Creates a new custom smiley, reading the image data from a file.
 
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_smiley_set_data (PurpleSmiley *smiley, guchar *smiley_data, size_t smiley_data_len)
 Changes the custom smiley's image data.
 
const char * purple_smiley_get_shortcut (const PurpleSmiley *smiley)
 Returns the custom smiley's associated shortcut (e.g.
 
const char * purple_smiley_get_checksum (const PurpleSmiley *smiley)
 Returns the custom smiley data's checksum.
 
PurpleStoredImagepurple_smiley_get_stored_image (const PurpleSmiley *smiley)
 Returns the PurpleStoredImage with the reference counter incremented.
 
gconstpointer purple_smiley_get_data (const PurpleSmiley *smiley, size_t *len)
 Returns the custom smiley's data.
 
const char * purple_smiley_get_extension (const PurpleSmiley *smiley)
 Returns an extension corresponding to the custom smiley's file type.
 
char * purple_smiley_get_full_path (PurpleSmiley *smiley)
 Returns a full path to an custom smiley.
 
Custom Smiley Subsystem API <br>
GList * purple_smileys_get_all (void)
 Returns a list of all custom smileys.
 
PurpleSmileypurple_smileys_find_by_shortcut (const char *shortcut)
 Returns a custom smiley given its shortcut.
 
PurpleSmileypurple_smileys_find_by_checksum (const char *checksum)
 Returns a custom smiley given its checksum.
 
const char * purple_smileys_get_storing_dir (void)
 Returns the directory used to store custom smiley cached files.
 
void purple_smileys_init (void)
 Initializes the custom smiley subsystem.
 
void purple_smileys_uninit (void)
 Uninitializes the custom smiley subsystem.
 

Detailed Description

Smiley API.

Since
2.5.0

Definition in file smiley.h.

Macro Definition Documentation

◆ PURPLE_IS_SMILEY

#define PURPLE_IS_SMILEY (   smiley)    (G_TYPE_CHECK_INSTANCE_TYPE ((smiley), PURPLE_TYPE_SMILEY))

Definition at line 50 of file smiley.h.

◆ PURPLE_IS_SMILEY_CLASS

#define PURPLE_IS_SMILEY_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), PURPLE_TYPE_SMILEY))

Definition at line 51 of file smiley.h.

◆ PURPLE_SMILEY

#define PURPLE_SMILEY (   smiley)    (G_TYPE_CHECK_INSTANCE_CAST ((smiley), PURPLE_TYPE_SMILEY, PurpleSmiley))

Definition at line 48 of file smiley.h.

◆ PURPLE_SMILEY_CLASS

#define PURPLE_SMILEY_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PURPLE_TYPE_SMILEY, PurpleSmileyClass))

Definition at line 49 of file smiley.h.

◆ PURPLE_SMILEY_GET_CLASS

#define PURPLE_SMILEY_GET_CLASS (   obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), PURPLE_TYPE_SMILEY, PurpleSmileyClass))

Definition at line 52 of file smiley.h.

◆ PURPLE_TYPE_SMILEY

#define PURPLE_TYPE_SMILEY   (purple_smiley_get_type ())

Definition at line 47 of file smiley.h.

Typedef Documentation

◆ PurpleSmiley

typedef struct _PurpleSmiley PurpleSmiley

A custom smiley.

This contains everything Purple will ever need to know about a custom smiley. Everything.

PurpleSmiley is a GObject.

Definition at line 44 of file smiley.h.

◆ PurpleSmileyClass

typedef struct _PurpleSmileyClass PurpleSmileyClass

Definition at line 45 of file smiley.h.

Function Documentation

◆ purple_smiley_delete()

void purple_smiley_delete ( PurpleSmiley smiley)

Destroys the custom smiley and releases the associated resources.

Parameters
smileyThe custom smiley.

◆ purple_smiley_get_checksum()

const char * purple_smiley_get_checksum ( const PurpleSmiley smiley)

Returns the custom smiley data's checksum.

Parameters
smileyThe custom smiley.
Returns
The checksum.

◆ purple_smiley_get_data()

gconstpointer purple_smiley_get_data ( const PurpleSmiley smiley,
size_t *  len 
)

Returns the custom smiley's data.

Parameters
smileyThe custom smiley.
lenIf not NULL, the length of the image data returned will be set in the location pointed to by this.
Returns
A pointer to the custom smiley data.

◆ purple_smiley_get_extension()

const char * purple_smiley_get_extension ( const PurpleSmiley smiley)

Returns an extension corresponding to the custom smiley's file type.

Parameters
smileyThe custom smiley.
Returns
The custom smiley's extension, "icon" if unknown, or NULL if the image data has disappeared.

◆ purple_smiley_get_full_path()

char * purple_smiley_get_full_path ( 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.

Parameters
smileyThe custom smiley.
Returns
A full path to the file, or NULL under various conditions. The caller should use g_free to free the returned string.

◆ purple_smiley_get_shortcut()

const char * purple_smiley_get_shortcut ( const PurpleSmiley smiley)

Returns the custom smiley's associated shortcut (e.g.

"(homer)").

Parameters
smileyThe custom smiley.
Returns
The shortcut.

◆ purple_smiley_get_stored_image()

PurpleStoredImage * purple_smiley_get_stored_image ( 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.

Parameters
smileyThe custom smiley.
Returns
A PurpleStoredImage.

◆ purple_smiley_new()

PurpleSmiley * purple_smiley_new ( PurpleStoredImage img,
const char *  shortcut 
)

Creates a new custom smiley from a PurpleStoredImage.

If a custom smiley with the given shortcut already exists, it will be automaticaly returned.

Parameters
imgThe image associated with the smiley.
shortcutThe associated shortcut (e.g. "(homer)").
Returns
The custom smiley.

◆ purple_smiley_new_from_file()

PurpleSmiley * purple_smiley_new_from_file ( const char *  shortcut,
const char *  filepath 
)

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.

Parameters
shortcutThe associated shortcut (e.g. "(homer)").
filepathThe image file.
Returns
The custom smiley.

◆ purple_smiley_set_data()

void purple_smiley_set_data ( PurpleSmiley smiley,
guchar *  smiley_data,
size_t  smiley_data_len 
)

Changes the custom smiley's image data.

Parameters
smileyThe custom smiley.
smiley_dataThe custom smiley data, which the smiley code takes ownership of and will free.
smiley_data_lenThe length of the data in smiley_data.

◆ purple_smiley_set_shortcut()

gboolean purple_smiley_set_shortcut ( PurpleSmiley smiley,
const char *  shortcut 
)

Changes the custom smiley's shortcut.

Parameters
smileyThe custom smiley.
shortcutThe new shortcut. A custom smiley with this shortcut cannot already be in use.
Returns
TRUE if the shortcut was changed. FALSE otherwise.

◆ purple_smileys_find_by_checksum()

PurpleSmiley * purple_smileys_find_by_checksum ( const char *  checksum)

Returns a custom smiley given its checksum.

Parameters
checksumThe custom smiley's checksum.
Returns
The custom smiley if found, or NULL if not found.

◆ purple_smileys_find_by_shortcut()

PurpleSmiley * purple_smileys_find_by_shortcut ( const char *  shortcut)

Returns a custom smiley given its shortcut.

Parameters
shortcutThe custom smiley's shortcut.
Returns
The custom smiley if found, or NULL if not found.

◆ purple_smileys_get_all()

GList * purple_smileys_get_all ( void  )

Returns a list of all custom smileys.

The caller is responsible for freeing the list.

Returns
A list of all custom smileys.

◆ purple_smileys_get_storing_dir()

const char * purple_smileys_get_storing_dir ( void  )

Returns the directory used to store custom smiley cached files.

The default directory is PURPLEDIR/custom_smiley.

Returns
The directory in which to store custom smileys cached files.