libpurple/smiley.h

Fri, 20 Dec 2019 02:44:13 +0000

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 20 Dec 2019 02:44:13 +0000
changeset 40247
2a80cd63e914
parent 39546
9fd07be714dd
child 40474
1341be8e3402
permissions
-rw-r--r--

Merged in default (pull request #661)

Add metadata to Glade ui files.

Approved-by: Gary Kramlich

22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1 /* purple
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
2 *
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
3 * Purple is the legal property of its developers, whose names are too numerous
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
5 * source distribution.
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
6 *
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
10 * (at your option) any later version.
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
11 *
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
15 * GNU General Public License for more details.
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
16 *
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
35698
302a7cb4c1ab Initial generic PurpleSmiley implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35487
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
20 */
35487
494f09f7f331 Move section blocks inside inclusion guards -- otherwise g-ir-scanner yells
Ankit Vani <a@nevitus.org>
parents: 35486
diff changeset
21
38279
a04046a1d93f A bunch of cleanups for smileys
Gary Kramlich <grim@reaperworld.com>
parents: 37135
diff changeset
22 #ifndef PURPLE_SMILEY_H
a04046a1d93f A bunch of cleanups for smileys
Gary Kramlich <grim@reaperworld.com>
parents: 37135
diff changeset
23 #define PURPLE_SMILEY_H
a04046a1d93f A bunch of cleanups for smileys
Gary Kramlich <grim@reaperworld.com>
parents: 37135
diff changeset
24
35442
84e906df98dd Add section blocks for purple-socket.h to xmlnode.h
Ankit Vani <a@nevitus.org>
parents: 35402
diff changeset
25 /**
84e906df98dd Add section blocks for purple-socket.h to xmlnode.h
Ankit Vani <a@nevitus.org>
parents: 35402
diff changeset
26 * SECTION:smiley
35774
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
27 * @include:smiley.h
35442
84e906df98dd Add section blocks for purple-socket.h to xmlnode.h
Ankit Vani <a@nevitus.org>
parents: 35402
diff changeset
28 * @section_id: libpurple-smiley
35774
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
29 * @short_description: a link between emoticon image and its textual representation
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
30 * @title: Smileys
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
31 *
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
32 * A #PurpleSmiley is a base class for associating emoticon images and their
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
33 * textual representation. It's intended for various smiley-related tasks:
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
34 * parsing the text against them, displaying in the smiley selector, or handling
38548
46e985dde7a5 libpurple: Remove references to dropped PurpleRemoteSmileys
Mike Ruprecht <cmaiku@gmail.com>
parents: 38283
diff changeset
35 * remote data.
35774
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
36 *
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
37 * The #PurpleSmiley:shortcut is always unescaped, but <link linkend="libpurple-smiley-parser">smiley parser</link>
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
38 * may deal with special characters.
35442
84e906df98dd Add section blocks for purple-socket.h to xmlnode.h
Ankit Vani <a@nevitus.org>
parents: 35402
diff changeset
39 */
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
40
35812
48c6ee645ca1 Imgstore vs PurpleImage: rip and fix
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35774
diff changeset
41 #include "image.h"
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22896
diff changeset
42
35744
34964f8d43fe Remote smileys: initial implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35701
diff changeset
43 #include <glib-object.h>
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
44
39546
9fd07be714dd Use G_DECLARE* for PurpleSmiley and drop private macro.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38548
diff changeset
45 G_BEGIN_DECLS
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
46
39546
9fd07be714dd Use G_DECLARE* for PurpleSmiley and drop private macro.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38548
diff changeset
47 #define PURPLE_TYPE_SMILEY purple_smiley_get_type()
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
48
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
49 /**
35402
6eae3b385153 Convert docs from doxygen to gtk-doc format for purple-socket to smiley
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
50 * purple_smiley_get_type:
6eae3b385153 Convert docs from doxygen to gtk-doc format for purple-socket to smiley
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
51 *
35774
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
52 * Returns: the #GType for a smiley.
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22896
diff changeset
53 */
39546
9fd07be714dd Use G_DECLARE* for PurpleSmiley and drop private macro.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38548
diff changeset
54 G_DECLARE_FINAL_TYPE(PurpleSmiley, purple_smiley, PURPLE, SMILEY, PurpleImage)
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
55
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
56 /**
35699
7bc9ddd6f6af Smiley: make generic implementation a bit more complete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35698
diff changeset
57 * purple_smiley_new:
35774
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
58 * @shortcut: the smiley shortcut (unescaped).
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
59 * @path: the smiley image file path.
35402
6eae3b385153 Convert docs from doxygen to gtk-doc format for purple-socket to smiley
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
60 *
35774
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
61 * Creates new smiley, which is ready to display (its file exists
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
62 * and is a valid image).
35699
7bc9ddd6f6af Smiley: make generic implementation a bit more complete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35698
diff changeset
63 *
35774
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
64 * Returns: the new #PurpleSmiley.
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
65 */
38279
a04046a1d93f A bunch of cleanups for smileys
Gary Kramlich <grim@reaperworld.com>
parents: 37135
diff changeset
66 PurpleSmiley *purple_smiley_new(const gchar *shortcut, const gchar *path);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
67
38283
d9ac28fb753c Fix a few more issues with smileys and smiley lists
Gary Kramlich <grim@reaperworld.com>
parents: 38281
diff changeset
68 /**
d9ac28fb753c Fix a few more issues with smileys and smiley lists
Gary Kramlich <grim@reaperworld.com>
parents: 38281
diff changeset
69 * purple_smiley_new_from_data:
d9ac28fb753c Fix a few more issues with smileys and smiley lists
Gary Kramlich <grim@reaperworld.com>
parents: 38281
diff changeset
70 * @shortcut: The smiley shortcut (unescaped).
d9ac28fb753c Fix a few more issues with smileys and smiley lists
Gary Kramlich <grim@reaperworld.com>
parents: 38281
diff changeset
71 * @data: The raw data of the image.
d9ac28fb753c Fix a few more issues with smileys and smiley lists
Gary Kramlich <grim@reaperworld.com>
parents: 38281
diff changeset
72 * @length: The length of @data in bytes.
d9ac28fb753c Fix a few more issues with smileys and smiley lists
Gary Kramlich <grim@reaperworld.com>
parents: 38281
diff changeset
73 *
d9ac28fb753c Fix a few more issues with smileys and smiley lists
Gary Kramlich <grim@reaperworld.com>
parents: 38281
diff changeset
74 * Creates new smiley from @data.
d9ac28fb753c Fix a few more issues with smileys and smiley lists
Gary Kramlich <grim@reaperworld.com>
parents: 38281
diff changeset
75 *
d9ac28fb753c Fix a few more issues with smileys and smiley lists
Gary Kramlich <grim@reaperworld.com>
parents: 38281
diff changeset
76 * Returns: A new #PurpleSmiley.
d9ac28fb753c Fix a few more issues with smileys and smiley lists
Gary Kramlich <grim@reaperworld.com>
parents: 38281
diff changeset
77 */
38281
df274be2afa2 A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents: 38279
diff changeset
78 PurpleSmiley *purple_smiley_new_from_data(const gchar *shortcut, const guint8 *data, gsize length);
df274be2afa2 A bunch more hack and slash with a bit more design on the fly
Gary Kramlich <grim@reaperworld.com>
parents: 38279
diff changeset
79
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
80 /**
35845
ea1c4f205efb PurpleImage: fill comments
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35840
diff changeset
81 * purple_smiley_new_remote:
ea1c4f205efb PurpleImage: fill comments
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35840
diff changeset
82 * @shortcut: the smiley shortcut (unescaped).
35840
e62c5033bd54 PurpleImage: drop get_image class callback and path property
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35839
diff changeset
83 *
35845
ea1c4f205efb PurpleImage: fill comments
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35840
diff changeset
84 * Creates new remote smiley. It's not bound to any conversation, so most
ea1c4f205efb PurpleImage: fill comments
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35840
diff changeset
85 * probably you might want to use
ea1c4f205efb PurpleImage: fill comments
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35840
diff changeset
86 * #purple_conversation_add_remote_smiley instead.
ea1c4f205efb PurpleImage: fill comments
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35840
diff changeset
87 *
ea1c4f205efb PurpleImage: fill comments
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35840
diff changeset
88 * Returns: the new remote #PurpleSmiley.
35838
64f331a1eaa0 Drop remote smileys in favor of remote images
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35812
diff changeset
89 */
38279
a04046a1d93f A bunch of cleanups for smileys
Gary Kramlich <grim@reaperworld.com>
parents: 37135
diff changeset
90 PurpleSmiley *purple_smiley_new_remote(const gchar *shortcut);
35838
64f331a1eaa0 Drop remote smileys in favor of remote images
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35812
diff changeset
91
64f331a1eaa0 Drop remote smileys in favor of remote images
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35812
diff changeset
92 /**
35402
6eae3b385153 Convert docs from doxygen to gtk-doc format for purple-socket to smiley
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
93 * purple_smiley_get_shortcut:
35774
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
94 * @smiley: the smiley.
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
95 *
35774
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
96 * Returns the @smiley's associated shortcut (e.g. <literal>(homer)</literal> or
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
97 * <literal>:-)</literal>).
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
98 *
35774
9227a7757e92 Comments: PurpleSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35771
diff changeset
99 * Returns: the unescaped shortcut.
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
100 */
39546
9fd07be714dd Use G_DECLARE* for PurpleSmiley and drop private macro.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38548
diff changeset
101 const gchar *purple_smiley_get_shortcut(PurpleSmiley *smiley);
35749
d71c41a54bb3 Smileys: implement get_image interface
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35744
diff changeset
102
32787
7072f190d6ad Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
103 G_END_DECLS
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
104
38279
a04046a1d93f A bunch of cleanups for smileys
Gary Kramlich <grim@reaperworld.com>
parents: 37135
diff changeset
105 #endif /* PURPLE_SMILEY_H */

mercurial